aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/saa7134/saa7134-alsa.c
diff options
context:
space:
mode:
authorRicardo Cerqueira <v4l@cerqueira.org>2005-12-01 03:51:20 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-12-01 18:48:56 -0500
commitf5b974cb16dd95d1ae0424f68f74550dbd793a33 (patch)
tree214fa2dc0ac32d84c56fe4a74b613eae6fbf68a0 /drivers/media/video/saa7134/saa7134-alsa.c
parent938606b02b3d7b587777e5b1e44f4196903250ca (diff)
[PATCH] V4L: Fix hotplugging issues with saa7134
- Fixed issue with hotplugging and DMA sound (sound was lost when replugging a card) - Added notifiers to main saa7134 module to let the sound sub-modules know when a card has been inserted or removed Signed-off-by: Ricardo Cerqueira <v4l@cerqueira.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@brturbo.com.br> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/media/video/saa7134/saa7134-alsa.c')
-rw-r--r--drivers/media/video/saa7134/saa7134-alsa.c29
1 files changed, 22 insertions, 7 deletions
diff --git a/drivers/media/video/saa7134/saa7134-alsa.c b/drivers/media/video/saa7134/saa7134-alsa.c
index 5707c666660b..32a1f3ec4410 100644
--- a/drivers/media/video/saa7134/saa7134-alsa.c
+++ b/drivers/media/video/saa7134/saa7134-alsa.c
@@ -58,8 +58,6 @@ static int enable[SNDRV_CARDS] = {1, [1 ... (SNDRV_CARDS - 1)] = 0};
58module_param_array(index, int, NULL, 0444); 58module_param_array(index, int, NULL, 0444);
59MODULE_PARM_DESC(index, "Index value for SAA7134 capture interface(s)."); 59MODULE_PARM_DESC(index, "Index value for SAA7134 capture interface(s).");
60 60
61int position;
62
63#define dprintk(fmt, arg...) if (debug) \ 61#define dprintk(fmt, arg...) if (debug) \
64 printk(KERN_DEBUG "%s/alsa: " fmt, dev->name , ## arg) 62 printk(KERN_DEBUG "%s/alsa: " fmt, dev->name , ## arg)
65 63
@@ -945,6 +943,8 @@ int alsa_card_saa7134_create(struct saa7134_dev *dev, int devnum)
945 sprintf(card->longname, "%s at 0x%lx irq %d", 943 sprintf(card->longname, "%s at 0x%lx irq %d",
946 chip->dev->name, chip->iobase, chip->irq); 944 chip->dev->name, chip->iobase, chip->irq);
947 945
946 printk(KERN_INFO "%s/alsa: %s registered as card %d\n",dev->name,card->longname,index[devnum]);
947
948 if ((err = snd_card_register(card)) == 0) { 948 if ((err = snd_card_register(card)) == 0) {
949 snd_saa7134_cards[devnum] = card; 949 snd_saa7134_cards[devnum] = card;
950 return 0; 950 return 0;
@@ -955,6 +955,22 @@ __nodev:
955 return err; 955 return err;
956} 956}
957 957
958
959static int alsa_device_init(struct saa7134_dev *dev)
960{
961 dev->dmasound.priv_data = dev;
962 alsa_card_saa7134_create(dev,dev->nr);
963 return 1;
964}
965
966static int alsa_device_exit(struct saa7134_dev *dev)
967{
968
969 snd_card_free(snd_saa7134_cards[dev->nr]);
970 snd_saa7134_cards[dev->nr] = NULL;
971 return 1;
972}
973
958/* 974/*
959 * Module initializer 975 * Module initializer
960 * 976 *
@@ -968,22 +984,21 @@ static int saa7134_alsa_init(void)
968 struct saa7134_dev *dev = NULL; 984 struct saa7134_dev *dev = NULL;
969 struct list_head *list; 985 struct list_head *list;
970 986
971 position = 0;
972
973 printk(KERN_INFO "saa7134 ALSA driver for DMA sound loaded\n"); 987 printk(KERN_INFO "saa7134 ALSA driver for DMA sound loaded\n");
974 988
975 list_for_each(list,&saa7134_devlist) { 989 list_for_each(list,&saa7134_devlist) {
976 dev = list_entry(list, struct saa7134_dev, devlist); 990 dev = list_entry(list, struct saa7134_dev, devlist);
977 if (dev->dmasound.priv_data == NULL) { 991 if (dev->dmasound.priv_data == NULL) {
978 dev->dmasound.priv_data = dev; 992 alsa_device_init(dev);
979 alsa_card_saa7134_create(dev,position);
980 position++;
981 } else { 993 } else {
982 printk(KERN_ERR "saa7134 ALSA: DMA sound is being handled by OSS. ignoring %s\n",dev->name); 994 printk(KERN_ERR "saa7134 ALSA: DMA sound is being handled by OSS. ignoring %s\n",dev->name);
983 return -EBUSY; 995 return -EBUSY;
984 } 996 }
985 } 997 }
986 998
999 dmasound_init = alsa_device_init;
1000 dmasound_exit = alsa_device_exit;
1001
987 if (dev == NULL) 1002 if (dev == NULL)
988 printk(KERN_INFO "saa7134 ALSA: no saa7134 cards found\n"); 1003 printk(KERN_INFO "saa7134 ALSA: no saa7134 cards found\n");
989 1004