From 689faacd1d952908f3591aa58fb3216bbc3458bf Mon Sep 17 00:00:00 2001 From: Ricardo Cerqueira Date: Tue, 8 Nov 2005 13:30:07 +0000 Subject: - SAA7134/ALSA IRQ management improvements Signed-off-by: Ricardo Cerqueira --- linux/drivers/media/video/saa7134/saa7134-alsa.c | 41 +++++++++++------------- 1 file changed, 19 insertions(+), 22 deletions(-) (limited to 'linux/drivers/media/video') diff --git a/linux/drivers/media/video/saa7134/saa7134-alsa.c b/linux/drivers/media/video/saa7134/saa7134-alsa.c index 9813a23ca..dd8317619 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.17 2005/11/08 13:14:21 mchehab Exp $ + * $Id: saa7134-alsa.c,v 1.18 2005/11/08 13:30:07 rmcc Exp $ * * Caveats: * - Volume doesn't work (it's always at max) @@ -60,7 +60,7 @@ static int enable[SNDRV_CARDS] = {1, [1 ... (SNDRV_CARDS - 1)] = 0}; module_param_array(index, int, NULL, 0444); MODULE_PARM_DESC(index, "Index value for SAA7134 capture interface(s)."); -int position = 0; +int position; #define dprintk(fmt, arg...) if (debug) \ printk(KERN_DEBUG "%s/alsa: " fmt, dev->name, ## arg) @@ -379,7 +379,7 @@ static int snd_card_saa7134_capture_prepare(snd_pcm_substream_t * substream) err = dsp_buffer_init(dev); if (0 != err) - goto fail2; + return err; /* prepare buffer */ if (0 != (err = videobuf_dma_pci_map(dev->pci,&dev->dmasound.dma))) @@ -570,10 +570,8 @@ static void snd_card_saa7134_runtime_free(snd_pcm_runtime_t *runtime) static int snd_card_saa7134_hw_params(snd_pcm_substream_t * substream, snd_pcm_hw_params_t * hw_params) { - return 0; - } /* @@ -800,7 +798,6 @@ static int snd_saa7134_capsrc_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_ static int snd_saa7134_capsrc_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) { snd_card_saa7134_t *chip = snd_kcontrol_chip(kcontrol); - unsigned long flags; int change, addr = kcontrol->private_value; int left, right; u32 anabar, xbarin; @@ -811,14 +808,14 @@ static int snd_saa7134_capsrc_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_ left = ucontrol->value.integer.value[0] & 1; right = ucontrol->value.integer.value[1] & 1; - spin_lock_irqsave(&chip->mixer_lock, flags); + spin_lock_irq(&chip->mixer_lock); change = chip->capture_source[addr][0] != left || chip->capture_source[addr][1] != right; chip->capture_source[addr][0] = left; chip->capture_source[addr][1] = right; dev->dmasound.input=addr; - spin_unlock_irqrestore(&chip->mixer_lock, flags); + spin_unlock_irq(&chip->mixer_lock); if (change) { @@ -908,20 +905,21 @@ static int snd_card_saa7134_new_mixer(snd_card_saa7134_t * chip) return 0; } -static int snd_saa7134_free(snd_card_saa7134_t *chip) +static void snd_saa7134_free(snd_card_t * card) { - if (chip->irq >= 0) { - synchronize_irq(chip->irq); - free_irq(chip->irq, (void *) chip); - } - kfree(chip); - return 0; + return; } static int snd_saa7134_dev_free(snd_device_t *device) { snd_card_saa7134_t *chip = device->device_data; - return snd_saa7134_free(chip); + + if (chip->irq >= 0) { + synchronize_irq(chip->irq); + free_irq(chip->irq, (void *) chip); + } + + return 0; } /* @@ -948,7 +946,7 @@ int alsa_card_saa7134_create(struct saa7134_dev *saadev, int dev) if (!enable[dev]) return -ENODEV; - card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); + card = snd_card_new(index[dev], id[dev], THIS_MODULE, sizeof(snd_card_saa7134_t)); if (card == NULL) return -ENOMEM; @@ -957,10 +955,8 @@ int alsa_card_saa7134_create(struct saa7134_dev *saadev, int dev) /* Card "creation" */ - chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); - if (chip == NULL) { - return -ENOMEM; - } + card->private_free = snd_saa7134_free; + chip = (snd_card_saa7134_t *) card->private_data; spin_lock_init(&chip->lock); spin_lock_init(&chip->mixer_lock); @@ -1007,7 +1003,6 @@ int alsa_card_saa7134_create(struct saa7134_dev *saadev, int dev) __nodev: snd_card_free(card); - kfree(chip); return err; } @@ -1024,6 +1019,8 @@ static int saa7134_alsa_init(void) struct saa7134_dev *saadev = NULL; struct list_head *list; + position = 0; + printk(KERN_INFO "saa7134 ALSA driver for DMA sound loaded\n"); list_for_each(list,&saa7134_devlist) { -- cgit v1.2.3