diff options
Diffstat (limited to 'drivers/media/video/saa7134/saa7134-alsa.c')
-rw-r--r-- | drivers/media/video/saa7134/saa7134-alsa.c | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/drivers/media/video/saa7134/saa7134-alsa.c b/drivers/media/video/saa7134/saa7134-alsa.c index 263c6e2e3e8e..ade05f75fdb0 100644 --- a/drivers/media/video/saa7134/saa7134-alsa.c +++ b/drivers/media/video/saa7134/saa7134-alsa.c | |||
@@ -51,6 +51,7 @@ MODULE_PARM_DESC(debug,"enable debug messages [alsa]"); | |||
51 | #define MIXER_ADDR_LINE2 2 | 51 | #define MIXER_ADDR_LINE2 2 |
52 | #define MIXER_ADDR_LAST 2 | 52 | #define MIXER_ADDR_LAST 2 |
53 | 53 | ||
54 | |||
54 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ | 55 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ |
55 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ | 56 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ |
56 | static int enable[SNDRV_CARDS] = {1, [1 ... (SNDRV_CARDS - 1)] = 0}; | 57 | static int enable[SNDRV_CARDS] = {1, [1 ... (SNDRV_CARDS - 1)] = 0}; |
@@ -59,11 +60,14 @@ module_param_array(index, int, NULL, 0444); | |||
59 | MODULE_PARM_DESC(index, "Index value for SAA7134 capture interface(s)."); | 60 | MODULE_PARM_DESC(index, "Index value for SAA7134 capture interface(s)."); |
60 | 61 | ||
61 | #define dprintk(fmt, arg...) if (debug) \ | 62 | #define dprintk(fmt, arg...) if (debug) \ |
62 | printk(KERN_DEBUG "%s/alsa: " fmt, dev->name , ## arg) | 63 | printk(KERN_DEBUG "%s/alsa: " fmt, dev->name , ##arg) |
64 | |||
65 | |||
63 | 66 | ||
64 | /* | 67 | /* |
65 | * Main chip structure | 68 | * Main chip structure |
66 | */ | 69 | */ |
70 | |||
67 | typedef struct snd_card_saa7134 { | 71 | typedef struct snd_card_saa7134 { |
68 | snd_card_t *card; | 72 | snd_card_t *card; |
69 | spinlock_t mixer_lock; | 73 | spinlock_t mixer_lock; |
@@ -208,8 +212,8 @@ static void saa7134_irq_alsa_done(struct saa7134_dev *dev, | |||
208 | 212 | ||
209 | static irqreturn_t saa7134_alsa_irq(int irq, void *dev_id, struct pt_regs *regs) | 213 | static irqreturn_t saa7134_alsa_irq(int irq, void *dev_id, struct pt_regs *regs) |
210 | { | 214 | { |
211 | struct saa7134_dmasound *dmasound = dev_id; | 215 | struct saa7134_dmasound *dmasound = dev_id; |
212 | struct saa7134_dev *dev = dmasound->priv_data; | 216 | struct saa7134_dev *dev = dmasound->priv_data; |
213 | 217 | ||
214 | unsigned long report, status; | 218 | unsigned long report, status; |
215 | int loop, handled = 0; | 219 | int loop, handled = 0; |
@@ -985,7 +989,15 @@ static int saa7134_alsa_init(void) | |||
985 | struct saa7134_dev *dev = NULL; | 989 | struct saa7134_dev *dev = NULL; |
986 | struct list_head *list; | 990 | struct list_head *list; |
987 | 991 | ||
988 | printk(KERN_INFO "saa7134 ALSA driver for DMA sound loaded\n"); | 992 | if (!dmasound_init && !dmasound_exit) { |
993 | dmasound_init = alsa_device_init; | ||
994 | dmasound_exit = alsa_device_exit; | ||
995 | } else { | ||
996 | printk(KERN_WARNING "saa7134 ALSA: can't load, DMA sound handler already assigned (probably to OSS)\n"); | ||
997 | return -EBUSY; | ||
998 | } | ||
999 | |||
1000 | printk(KERN_INFO "saa7134 ALSA driver for DMA sound loaded\n"); | ||
989 | 1001 | ||
990 | list_for_each(list,&saa7134_devlist) { | 1002 | list_for_each(list,&saa7134_devlist) { |
991 | dev = list_entry(list, struct saa7134_dev, devlist); | 1003 | dev = list_entry(list, struct saa7134_dev, devlist); |
@@ -997,13 +1009,11 @@ static int saa7134_alsa_init(void) | |||
997 | } | 1009 | } |
998 | } | 1010 | } |
999 | 1011 | ||
1000 | dmasound_init = alsa_device_init; | ||
1001 | dmasound_exit = alsa_device_exit; | ||
1002 | |||
1003 | if (dev == NULL) | 1012 | if (dev == NULL) |
1004 | printk(KERN_INFO "saa7134 ALSA: no saa7134 cards found\n"); | 1013 | printk(KERN_INFO "saa7134 ALSA: no saa7134 cards found\n"); |
1005 | 1014 | ||
1006 | return 0; | 1015 | return 0; |
1016 | |||
1007 | } | 1017 | } |
1008 | 1018 | ||
1009 | /* | 1019 | /* |
@@ -1018,12 +1028,18 @@ static void saa7134_alsa_exit(void) | |||
1018 | snd_card_free(snd_saa7134_cards[idx]); | 1028 | snd_card_free(snd_saa7134_cards[idx]); |
1019 | } | 1029 | } |
1020 | 1030 | ||
1031 | dmasound_init = NULL; | ||
1032 | dmasound_exit = NULL; | ||
1021 | printk(KERN_INFO "saa7134 ALSA driver for DMA sound unloaded\n"); | 1033 | printk(KERN_INFO "saa7134 ALSA driver for DMA sound unloaded\n"); |
1022 | 1034 | ||
1023 | return; | 1035 | return; |
1024 | } | 1036 | } |
1025 | 1037 | ||
1026 | module_init(saa7134_alsa_init); | 1038 | /* We initialize this late, to make sure the sound system is up and running */ |
1039 | late_initcall(saa7134_alsa_init); | ||
1027 | module_exit(saa7134_alsa_exit); | 1040 | module_exit(saa7134_alsa_exit); |
1028 | MODULE_LICENSE("GPL"); | 1041 | MODULE_LICENSE("GPL"); |
1029 | MODULE_AUTHOR("Ricardo Cerqueira"); | 1042 | MODULE_AUTHOR("Ricardo Cerqueira"); |
1043 | |||
1044 | |||
1045 | |||