summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--linux/drivers/media/video/saa7134/saa7134-alsa.c58
-rw-r--r--v4l/ChangeLog13
2 files changed, 35 insertions, 36 deletions
diff --git a/linux/drivers/media/video/saa7134/saa7134-alsa.c b/linux/drivers/media/video/saa7134/saa7134-alsa.c
index 9f0b4eee5..d8de17cda 100644
--- a/linux/drivers/media/video/saa7134/saa7134-alsa.c
+++ b/linux/drivers/media/video/saa7134/saa7134-alsa.c
@@ -1,7 +1,7 @@
/*
* SAA713x ALSA support for V4L
*
- * $Id: saa7134-alsa.c,v 1.22 2005/11/09 03:33:33 rmcc Exp $
+ * $Id: saa7134-alsa.c,v 1.23 2005/11/09 04:03:11 rmcc Exp $
*
* Caveats:
* - Volume doesn't work (it's always at max)
@@ -104,9 +104,7 @@ typedef struct snd_card_saa7134_pcm {
struct saa7134_dev *dev;
spinlock_t lock;
- unsigned int pcm_size; /* buffer size */
- unsigned int pcm_count; /* bytes per period */
- unsigned int pcm_bps; /* bytes per second */
+
snd_pcm_substream_t *substream;
} snd_card_saa7134_pcm_t;
@@ -208,6 +206,7 @@ void saa7134_irq_alsa_done(struct saa7134_dev *dev, unsigned long status)
snd_pcm_period_elapsed(dev->dmasound.substream);
spin_lock(&dev->slock);
}
+
done:
spin_unlock(&dev->slock);
@@ -264,8 +263,8 @@ static int snd_card_saa7134_capture_trigger(snd_pcm_substream_t * substream,
int cmd)
{
snd_pcm_runtime_t *runtime = substream->runtime;
- snd_card_saa7134_pcm_t *saapcm = runtime->private_data;
- struct saa7134_dev *dev=saapcm->dev;
+ snd_card_saa7134_pcm_t *pcm = runtime->private_data;
+ struct saa7134_dev *dev=pcm->dev;
int err = 0;
spin_lock_irq(&dev->slock);
@@ -360,28 +359,18 @@ static int snd_card_saa7134_capture_prepare(snd_pcm_substream_t * substream)
u32 fmt, control;
snd_card_saa7134_t *saa7134 = snd_pcm_substream_chip(substream);
struct saa7134_dev *dev;
- snd_card_saa7134_pcm_t *saapcm = runtime->private_data;
- unsigned int bps;
+ snd_card_saa7134_pcm_t *pcm = runtime->private_data;
unsigned long size;
unsigned count;
size = snd_pcm_lib_buffer_bytes(substream);
count = snd_pcm_lib_period_bytes(substream);
- saapcm->dev->dmasound.substream = substream;
- bps = runtime->rate * runtime->channels;
- bps *= snd_pcm_format_width(runtime->format);
- bps /= 8;
- if (bps <= 0)
- return -EINVAL;
- saapcm->pcm_bps = bps;
- saapcm->pcm_size = snd_pcm_lib_buffer_bytes(substream);
- saapcm->pcm_count = snd_pcm_lib_period_bytes(substream);
-
+ pcm->dev->dmasound.substream = substream;
dev=saa7134->dev;
- dsp_buffer_conf(dev,saapcm->pcm_count,(saapcm->pcm_size/saapcm->pcm_count));
+ dsp_buffer_conf(dev,count,(size/count));
err = dsp_buffer_init(dev);
if (0 != err)
@@ -461,7 +450,6 @@ static int snd_card_saa7134_capture_prepare(snd_pcm_substream_t * substream)
fmt |= 0x04;
saa_writel(SAA7133_NUM_SAMPLES, dev->dmasound.blksize -1);
saa_writel(SAA7133_AUDIO_CHANNEL, 0x543210 | (fmt << 24));
- //saa_writel(SAA7133_AUDIO_CHANNEL, 0x543210);
break;
}
@@ -512,10 +500,8 @@ static int snd_card_saa7134_capture_prepare(snd_pcm_substream_t * substream)
static snd_pcm_uframes_t snd_card_saa7134_capture_pointer(snd_pcm_substream_t * substream)
{
snd_pcm_runtime_t *runtime = substream->runtime;
- snd_card_saa7134_pcm_t *saapcm = runtime->private_data;
- struct saa7134_dev *dev=saapcm->dev;
-
-
+ snd_card_saa7134_pcm_t *pcm = runtime->private_data;
+ struct saa7134_dev *dev=pcm->dev;
if (dev->dmasound.read_count) {
dev->dmasound.read_count -= snd_pcm_lib_period_bytes(substream);
@@ -556,9 +542,9 @@ static snd_pcm_hardware_t snd_card_saa7134_capture =
static void snd_card_saa7134_runtime_free(snd_pcm_runtime_t *runtime)
{
- snd_card_saa7134_pcm_t *saapcm = runtime->private_data;
+ snd_card_saa7134_pcm_t *pcm = runtime->private_data;
- kfree(saapcm);
+ kfree(pcm);
}
@@ -587,7 +573,7 @@ static int snd_card_saa7134_hw_params(snd_pcm_substream_t * substream,
*
* Called after closing the device, but before snd_card_saa7134_capture_close
* Usually used in ALSA to free the DMA, but since we don't use the
- * ALSA DMA I'm almost sure this isn't necessary.
+ * ALSA DMA it does nothing
*
*/
@@ -653,29 +639,28 @@ static int snd_card_saa7134_capture_close(snd_pcm_substream_t * substream)
static int snd_card_saa7134_capture_open(snd_pcm_substream_t * substream)
{
snd_pcm_runtime_t *runtime = substream->runtime;
- snd_card_saa7134_pcm_t *saapcm;
+ snd_card_saa7134_pcm_t *pcm;
snd_card_saa7134_t *saa7134 = snd_pcm_substream_chip(substream);
struct saa7134_dev *dev = saa7134->dev;
int err;
down(&dev->dmasound.lock);
- dev->dmasound.afmt = SNDRV_PCM_FORMAT_U8;
- dev->dmasound.channels = 2;
dev->dmasound.read_count = 0;
dev->dmasound.read_offset = 0;
up(&dev->dmasound.lock);
- saapcm = kzalloc(sizeof(*saapcm), GFP_KERNEL);
- if (saapcm == NULL)
+ pcm = kzalloc(sizeof(*pcm), GFP_KERNEL);
+ if (pcm == NULL)
return -ENOMEM;
- saapcm->dev=saa7134->dev;
- spin_lock_init(&saapcm->lock);
+ pcm->dev=saa7134->dev;
- saapcm->substream = substream;
- runtime->private_data = saapcm;
+ spin_lock_init(&pcm->lock);
+
+ pcm->substream = substream;
+ runtime->private_data = pcm;
runtime->private_free = snd_card_saa7134_runtime_free;
runtime->hw = snd_card_saa7134_capture;
@@ -798,6 +783,7 @@ static int snd_saa7134_capsrc_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_
ucontrol->value.integer.value[0] = chip->capture_source[addr][0];
ucontrol->value.integer.value[1] = chip->capture_source[addr][1];
spin_unlock_irqrestore(&chip->mixer_lock, flags);
+
return 0;
}
diff --git a/v4l/ChangeLog b/v4l/ChangeLog
index 33406ee88..9b9927886 100644
--- a/v4l/ChangeLog
+++ b/v4l/ChangeLog
@@ -1,3 +1,16 @@
+2005-11-09 04:00 rmcc
+
+ * ../linux/drivers/media/video/saa7134/saa7134-alsa.c:
+ (saa7134_irq_alsa_done), (snd_card_saa7134_capture_trigger),
+ (snd_card_saa7134_capture_prepare),
+ (snd_card_saa7134_capture_pointer),
+ (snd_card_saa7134_runtime_free), (snd_card_saa7134_capture_open),
+ (snd_saa7134_capsrc_get):
+
+ - Removed some superfluous code in saa7134-alsa
+
+ Signed-off-by: Ricardo Cerqueira <v4l@cerqueira.org>
+
2005-11-09 03:25 rmcc
* ../linux/drivers/media/video/saa7134/Makefile: