diff options
author | Thomas Gleixner <tglx@mtd.linutronix.de> | 2005-11-06 09:36:37 -0500 |
---|---|---|
committer | Thomas Gleixner <tglx@mtd.linutronix.de> | 2005-11-06 09:36:37 -0500 |
commit | 2fc2991175bf77395e6b15fe6b2304d3bf72da40 (patch) | |
tree | b0ff38c09240e7c00e1577d447ebe89143d752dc /sound | |
parent | 8b491d750885ebe8e7d385ce4186c85957d67123 (diff) | |
parent | 7015faa7df829876a0f931cd18aa6d7c24a1b581 (diff) |
Merge branch 'master' of /home/tglx/work/mtd/git/linux-2.6.git/
Diffstat (limited to 'sound')
230 files changed, 5504 insertions, 2897 deletions
diff --git a/sound/Kconfig b/sound/Kconfig index ee794ae06040..b65ee4701f98 100644 --- a/sound/Kconfig +++ b/sound/Kconfig | |||
@@ -77,7 +77,7 @@ source "sound/parisc/Kconfig" | |||
77 | endmenu | 77 | endmenu |
78 | 78 | ||
79 | menu "Open Sound System" | 79 | menu "Open Sound System" |
80 | depends on SOUND!=n && (BROKEN || (!SPARC32 && !SPARC64)) | 80 | depends on SOUND!=n |
81 | 81 | ||
82 | config SOUND_PRIME | 82 | config SOUND_PRIME |
83 | tristate "Open Sound System (DEPRECATED)" | 83 | tristate "Open Sound System (DEPRECATED)" |
diff --git a/sound/arm/Kconfig b/sound/arm/Kconfig index 2e4a5e0d16db..0864a7ce414d 100644 --- a/sound/arm/Kconfig +++ b/sound/arm/Kconfig | |||
@@ -7,6 +7,7 @@ config SND_SA11XX_UDA1341 | |||
7 | tristate "SA11xx UDA1341TS driver (iPaq H3600)" | 7 | tristate "SA11xx UDA1341TS driver (iPaq H3600)" |
8 | depends on ARCH_SA1100 && SND && L3 | 8 | depends on ARCH_SA1100 && SND && L3 |
9 | select SND_PCM | 9 | select SND_PCM |
10 | select SND_GENERIC_DRIVER | ||
10 | help | 11 | help |
11 | Say Y here if you have a Compaq iPaq H3x00 handheld computer | 12 | Say Y here if you have a Compaq iPaq H3x00 handheld computer |
12 | and want to use its Philips UDA 1341 audio chip. | 13 | and want to use its Philips UDA 1341 audio chip. |
diff --git a/sound/arm/Makefile b/sound/arm/Makefile index 103f136926d9..4ef6dd00c6ee 100644 --- a/sound/arm/Makefile +++ b/sound/arm/Makefile | |||
@@ -2,12 +2,14 @@ | |||
2 | # Makefile for ALSA | 2 | # Makefile for ALSA |
3 | # | 3 | # |
4 | 4 | ||
5 | snd-sa11xx-uda1341-objs := sa11xx-uda1341.o | ||
6 | snd-aaci-objs := aaci.o devdma.o | ||
7 | snd-pxa2xx-pcm-objs := pxa2xx-pcm.o | ||
8 | snd-pxa2xx-ac97-objs := pxa2xx-ac97.o | ||
9 | |||
10 | obj-$(CONFIG_SND_SA11XX_UDA1341) += snd-sa11xx-uda1341.o | 5 | obj-$(CONFIG_SND_SA11XX_UDA1341) += snd-sa11xx-uda1341.o |
6 | snd-sa11xx-uda1341-objs := sa11xx-uda1341.o | ||
7 | |||
11 | obj-$(CONFIG_SND_ARMAACI) += snd-aaci.o | 8 | obj-$(CONFIG_SND_ARMAACI) += snd-aaci.o |
12 | obj-$(CONFIG_SND_PXA2XX_PCM) += snd-pxa2xx-pcm.o | 9 | snd-aaci-objs := aaci.o devdma.o |
13 | obj-$(CONFIG_SND_PXA2XX_AC97) += snd-pxa2xx-ac97.o | 10 | |
11 | obj-$(CONFIG_SND_PXA2XX_PCM) += snd-pxa2xx-pcm.o | ||
12 | snd-pxa2xx-pcm-objs := pxa2xx-pcm.o | ||
13 | |||
14 | obj-$(CONFIG_SND_PXA2XX_AC97) += snd-pxa2xx-ac97.o | ||
15 | snd-pxa2xx-ac97-objs := pxa2xx-ac97.o | ||
diff --git a/sound/arm/aaci.c b/sound/arm/aaci.c index 08cc3ddca96f..559ead6367da 100644 --- a/sound/arm/aaci.c +++ b/sound/arm/aaci.c | |||
@@ -20,6 +20,7 @@ | |||
20 | 20 | ||
21 | #include <asm/io.h> | 21 | #include <asm/io.h> |
22 | #include <asm/irq.h> | 22 | #include <asm/irq.h> |
23 | #include <asm/sizes.h> | ||
23 | #include <asm/hardware/amba.h> | 24 | #include <asm/hardware/amba.h> |
24 | 25 | ||
25 | #include <sound/driver.h> | 26 | #include <sound/driver.h> |
@@ -650,7 +651,7 @@ static int aaci_do_resume(snd_card_t *card, unsigned int state) | |||
650 | return 0; | 651 | return 0; |
651 | } | 652 | } |
652 | 653 | ||
653 | static int aaci_suspend(struct amba_device *dev, u32 state) | 654 | static int aaci_suspend(struct amba_device *dev, pm_message_t state) |
654 | { | 655 | { |
655 | snd_card_t *card = amba_get_drvdata(dev); | 656 | snd_card_t *card = amba_get_drvdata(dev); |
656 | return card ? aaci_do_suspend(card) : 0; | 657 | return card ? aaci_do_suspend(card) : 0; |
@@ -821,7 +822,7 @@ static int __devinit aaci_init_pcm(struct aaci *aaci) | |||
821 | 822 | ||
822 | static unsigned int __devinit aaci_size_fifo(struct aaci *aaci) | 823 | static unsigned int __devinit aaci_size_fifo(struct aaci *aaci) |
823 | { | 824 | { |
824 | void *base = aaci->base + AACI_CSCH1; | 825 | void __iomem *base = aaci->base + AACI_CSCH1; |
825 | int i; | 826 | int i; |
826 | 827 | ||
827 | writel(TXCR_FEN | TXCR_TSZ16 | TXCR_TXEN, base + AACI_TXCR); | 828 | writel(TXCR_FEN | TXCR_TSZ16 | TXCR_TXEN, base + AACI_TXCR); |
@@ -877,7 +878,7 @@ static int __devinit aaci_probe(struct amba_device *dev, void *id) | |||
877 | aaci->playback.fifo = aaci->base + AACI_DR1; | 878 | aaci->playback.fifo = aaci->base + AACI_DR1; |
878 | 879 | ||
879 | for (i = 0; i < 4; i++) { | 880 | for (i = 0; i < 4; i++) { |
880 | void *base = aaci->base + i * 0x14; | 881 | void __iomem *base = aaci->base + i * 0x14; |
881 | 882 | ||
882 | writel(0, base + AACI_IE); | 883 | writel(0, base + AACI_IE); |
883 | writel(0, base + AACI_TXCR); | 884 | writel(0, base + AACI_TXCR); |
@@ -900,6 +901,8 @@ static int __devinit aaci_probe(struct amba_device *dev, void *id) | |||
900 | if (ret) | 901 | if (ret) |
901 | goto out; | 902 | goto out; |
902 | 903 | ||
904 | snd_card_set_dev(aaci->card, &dev->dev); | ||
905 | |||
903 | ret = snd_card_register(aaci->card); | 906 | ret = snd_card_register(aaci->card); |
904 | if (ret == 0) { | 907 | if (ret == 0) { |
905 | dev_info(&dev->dev, "%s, fifo %d\n", aaci->card->longname, | 908 | dev_info(&dev->dev, "%s, fifo %d\n", aaci->card->longname, |
diff --git a/sound/arm/aaci.h b/sound/arm/aaci.h index d752e6426894..b2f969bc7845 100644 --- a/sound/arm/aaci.h +++ b/sound/arm/aaci.h | |||
@@ -200,8 +200,8 @@ | |||
200 | 200 | ||
201 | 201 | ||
202 | struct aaci_runtime { | 202 | struct aaci_runtime { |
203 | void *base; | 203 | void __iomem *base; |
204 | void *fifo; | 204 | void __iomem *fifo; |
205 | 205 | ||
206 | struct ac97_pcm *pcm; | 206 | struct ac97_pcm *pcm; |
207 | int pcm_open; | 207 | int pcm_open; |
@@ -223,7 +223,7 @@ struct aaci_runtime { | |||
223 | struct aaci { | 223 | struct aaci { |
224 | struct amba_device *dev; | 224 | struct amba_device *dev; |
225 | snd_card_t *card; | 225 | snd_card_t *card; |
226 | void *base; | 226 | void __iomem *base; |
227 | unsigned int fifosize; | 227 | unsigned int fifosize; |
228 | 228 | ||
229 | /* AC'97 */ | 229 | /* AC'97 */ |
diff --git a/sound/arm/pxa2xx-ac97.c b/sound/arm/pxa2xx-ac97.c index 46052304e230..d1f9da498729 100644 --- a/sound/arm/pxa2xx-ac97.c +++ b/sound/arm/pxa2xx-ac97.c | |||
@@ -13,7 +13,7 @@ | |||
13 | #include <linux/init.h> | 13 | #include <linux/init.h> |
14 | #include <linux/module.h> | 14 | #include <linux/module.h> |
15 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
16 | #include <linux/device.h> | 16 | #include <linux/platform_device.h> |
17 | #include <linux/interrupt.h> | 17 | #include <linux/interrupt.h> |
18 | #include <linux/wait.h> | 18 | #include <linux/wait.h> |
19 | #include <linux/delay.h> | 19 | #include <linux/delay.h> |
@@ -132,9 +132,9 @@ static void pxa2xx_ac97_reset(ac97_t *ac97) | |||
132 | udelay(10); | 132 | udelay(10); |
133 | GCR |= GCR_WARM_RST; | 133 | GCR |= GCR_WARM_RST; |
134 | pxa_gpio_mode(113 | GPIO_ALT_FN_2_OUT); | 134 | pxa_gpio_mode(113 | GPIO_ALT_FN_2_OUT); |
135 | udelay(50); | 135 | udelay(500); |
136 | #else | 136 | #else |
137 | GCR |= GCR_WARM_RST|GCR_PRIRDY_IEN|GCR_SECRDY_IEN;; | 137 | GCR |= GCR_WARM_RST|GCR_PRIRDY_IEN|GCR_SECRDY_IEN; |
138 | wait_event_timeout(gsr_wq, gsr_bits & (GSR_PCR | GSR_SCR), 1); | 138 | wait_event_timeout(gsr_wq, gsr_bits & (GSR_PCR | GSR_SCR), 1); |
139 | #endif | 139 | #endif |
140 | 140 | ||
@@ -245,7 +245,7 @@ static pxa2xx_pcm_client_t pxa2xx_ac97_pcm_client = { | |||
245 | 245 | ||
246 | #ifdef CONFIG_PM | 246 | #ifdef CONFIG_PM |
247 | 247 | ||
248 | static int pxa2xx_ac97_do_suspend(snd_card_t *card, unsigned int state) | 248 | static int pxa2xx_ac97_do_suspend(snd_card_t *card, pm_message_t state) |
249 | { | 249 | { |
250 | if (card->power_state != SNDRV_CTL_POWER_D3cold) { | 250 | if (card->power_state != SNDRV_CTL_POWER_D3cold) { |
251 | pxa2xx_audio_ops_t *platform_ops = card->dev->platform_data; | 251 | pxa2xx_audio_ops_t *platform_ops = card->dev->platform_data; |
@@ -261,7 +261,7 @@ static int pxa2xx_ac97_do_suspend(snd_card_t *card, unsigned int state) | |||
261 | return 0; | 261 | return 0; |
262 | } | 262 | } |
263 | 263 | ||
264 | static int pxa2xx_ac97_do_resume(snd_card_t *card, unsigned int state) | 264 | static int pxa2xx_ac97_do_resume(snd_card_t *card) |
265 | { | 265 | { |
266 | if (card->power_state != SNDRV_CTL_POWER_D0) { | 266 | if (card->power_state != SNDRV_CTL_POWER_D0) { |
267 | pxa2xx_audio_ops_t *platform_ops = card->dev->platform_data; | 267 | pxa2xx_audio_ops_t *platform_ops = card->dev->platform_data; |
@@ -275,24 +275,24 @@ static int pxa2xx_ac97_do_resume(snd_card_t *card, unsigned int state) | |||
275 | return 0; | 275 | return 0; |
276 | } | 276 | } |
277 | 277 | ||
278 | static int pxa2xx_ac97_suspend(struct device *_dev, u32 state, u32 level) | 278 | static int pxa2xx_ac97_suspend(struct device *_dev, pm_message_t state) |
279 | { | 279 | { |
280 | snd_card_t *card = dev_get_drvdata(_dev); | 280 | snd_card_t *card = dev_get_drvdata(_dev); |
281 | int ret = 0; | 281 | int ret = 0; |
282 | 282 | ||
283 | if (card && level == SUSPEND_DISABLE) | 283 | if (card) |
284 | ret = pxa2xx_ac97_do_suspend(card, SNDRV_CTL_POWER_D3cold); | 284 | ret = pxa2xx_ac97_do_suspend(card, PMSG_SUSPEND); |
285 | 285 | ||
286 | return ret; | 286 | return ret; |
287 | } | 287 | } |
288 | 288 | ||
289 | static int pxa2xx_ac97_resume(struct device *_dev, u32 level) | 289 | static int pxa2xx_ac97_resume(struct device *_dev) |
290 | { | 290 | { |
291 | snd_card_t *card = dev_get_drvdata(_dev); | 291 | snd_card_t *card = dev_get_drvdata(_dev); |
292 | int ret = 0; | 292 | int ret = 0; |
293 | 293 | ||
294 | if (card && level == RESUME_ENABLE) | 294 | if (card) |
295 | ret = pxa2xx_ac97_do_resume(card, SNDRV_CTL_POWER_D0); | 295 | ret = pxa2xx_ac97_do_resume(card); |
296 | 296 | ||
297 | return ret; | 297 | return ret; |
298 | } | 298 | } |
diff --git a/sound/arm/sa11xx-uda1341.c b/sound/arm/sa11xx-uda1341.c index 174bc032d1ad..6ee912259cc5 100644 --- a/sound/arm/sa11xx-uda1341.c +++ b/sound/arm/sa11xx-uda1341.c | |||
@@ -21,7 +21,7 @@ | |||
21 | * merged HAL layer (patches from Brian) | 21 | * merged HAL layer (patches from Brian) |
22 | */ | 22 | */ |
23 | 23 | ||
24 | /* $Id: sa11xx-uda1341.c,v 1.21 2005/01/28 19:34:04 tiwai Exp $ */ | 24 | /* $Id: sa11xx-uda1341.c,v 1.23 2005/09/09 13:22:34 tiwai Exp $ */ |
25 | 25 | ||
26 | /*************************************************************************************************** | 26 | /*************************************************************************************************** |
27 | * | 27 | * |
@@ -918,7 +918,7 @@ static int __init sa11xx_uda1341_init(void) | |||
918 | if (card == NULL) | 918 | if (card == NULL) |
919 | return -ENOMEM; | 919 | return -ENOMEM; |
920 | 920 | ||
921 | sa11xx_uda1341 = kcalloc(1, sizeof(*sa11xx_uda1341), GFP_KERNEL); | 921 | sa11xx_uda1341 = kzalloc(sizeof(*sa11xx_uda1341), GFP_KERNEL); |
922 | if (sa11xx_uda1341 == NULL) | 922 | if (sa11xx_uda1341 == NULL) |
923 | return -ENOMEM; | 923 | return -ENOMEM; |
924 | spin_lock_init(&chip->s[0].dma_lock); | 924 | spin_lock_init(&chip->s[0].dma_lock); |
@@ -946,6 +946,9 @@ static int __init sa11xx_uda1341_init(void) | |||
946 | strcpy(card->shortname, "H3600 UDA1341TS"); | 946 | strcpy(card->shortname, "H3600 UDA1341TS"); |
947 | sprintf(card->longname, "Compaq iPAQ H3600 with Philips UDA1341TS"); | 947 | sprintf(card->longname, "Compaq iPAQ H3600 with Philips UDA1341TS"); |
948 | 948 | ||
949 | if ((err = snd_card_set_generic_dev(card)) < 0) | ||
950 | goto nodev; | ||
951 | |||
949 | if ((err = snd_card_register(card)) == 0) { | 952 | if ((err = snd_card_register(card)) == 0) { |
950 | printk( KERN_INFO "iPAQ audio support initialized\n" ); | 953 | printk( KERN_INFO "iPAQ audio support initialized\n" ); |
951 | return 0; | 954 | return 0; |
diff --git a/sound/core/Kconfig b/sound/core/Kconfig index d1e800b9866d..48cf45cfd0b7 100644 --- a/sound/core/Kconfig +++ b/sound/core/Kconfig | |||
@@ -99,6 +99,18 @@ config SND_RTCTIMER | |||
99 | To compile this driver as a module, choose M here: the module | 99 | To compile this driver as a module, choose M here: the module |
100 | will be called snd-rtctimer. | 100 | will be called snd-rtctimer. |
101 | 101 | ||
102 | config SND_SEQ_RTCTIMER_DEFAULT | ||
103 | bool "Use RTC as default sequencer timer" | ||
104 | depends on SND_RTCTIMER && SND_SEQUENCER | ||
105 | default y | ||
106 | help | ||
107 | Say Y here to use the RTC timer as the default sequencer | ||
108 | timer. This is strongly recommended because it ensures | ||
109 | precise MIDI timing even when the system timer runs at less | ||
110 | than 1000 Hz. | ||
111 | |||
112 | If in doubt, say Y. | ||
113 | |||
102 | config SND_VERBOSE_PRINTK | 114 | config SND_VERBOSE_PRINTK |
103 | bool "Verbose printk" | 115 | bool "Verbose printk" |
104 | depends on SND | 116 | depends on SND |
@@ -128,6 +140,6 @@ config SND_DEBUG_DETECT | |||
128 | Say Y here to enable extra-verbose log messages printed when | 140 | Say Y here to enable extra-verbose log messages printed when |
129 | detecting devices. | 141 | detecting devices. |
130 | 142 | ||
131 | config SND_GENERIC_PM | 143 | config SND_GENERIC_DRIVER |
132 | bool | 144 | bool |
133 | depends on SND | 145 | depends on SND |
diff --git a/sound/core/Makefile b/sound/core/Makefile index 764ac184b223..969d75528bde 100644 --- a/sound/core/Makefile +++ b/sound/core/Makefile | |||
@@ -5,7 +5,7 @@ | |||
5 | 5 | ||
6 | snd-objs := sound.o init.o memory.o info.o control.o misc.o \ | 6 | snd-objs := sound.o init.o memory.o info.o control.o misc.o \ |
7 | device.o wrappers.o | 7 | device.o wrappers.o |
8 | ifeq ($(CONFIG_ISA),y) | 8 | ifeq ($(CONFIG_ISA_DMA_API),y) |
9 | snd-objs += isadma.o | 9 | snd-objs += isadma.o |
10 | endif | 10 | endif |
11 | ifeq ($(CONFIG_SND_OSSEMUL),y) | 11 | ifeq ($(CONFIG_SND_OSSEMUL),y) |
diff --git a/sound/core/control.c b/sound/core/control.c index 227f3cf02771..736edf358e05 100644 --- a/sound/core/control.c +++ b/sound/core/control.c | |||
@@ -69,7 +69,7 @@ static int snd_ctl_open(struct inode *inode, struct file *file) | |||
69 | err = -EFAULT; | 69 | err = -EFAULT; |
70 | goto __error2; | 70 | goto __error2; |
71 | } | 71 | } |
72 | ctl = kcalloc(1, sizeof(*ctl), GFP_KERNEL); | 72 | ctl = kzalloc(sizeof(*ctl), GFP_KERNEL); |
73 | if (ctl == NULL) { | 73 | if (ctl == NULL) { |
74 | err = -ENOMEM; | 74 | err = -ENOMEM; |
75 | goto __error; | 75 | goto __error; |
@@ -162,7 +162,7 @@ void snd_ctl_notify(snd_card_t *card, unsigned int mask, snd_ctl_elem_id_t *id) | |||
162 | goto _found; | 162 | goto _found; |
163 | } | 163 | } |
164 | } | 164 | } |
165 | ev = kcalloc(1, sizeof(*ev), GFP_ATOMIC); | 165 | ev = kzalloc(sizeof(*ev), GFP_ATOMIC); |
166 | if (ev) { | 166 | if (ev) { |
167 | ev->id = *id; | 167 | ev->id = *id; |
168 | ev->mask = mask; | 168 | ev->mask = mask; |
@@ -195,7 +195,7 @@ snd_kcontrol_t *snd_ctl_new(snd_kcontrol_t * control, unsigned int access) | |||
195 | 195 | ||
196 | snd_runtime_check(control != NULL, return NULL); | 196 | snd_runtime_check(control != NULL, return NULL); |
197 | snd_runtime_check(control->count > 0, return NULL); | 197 | snd_runtime_check(control->count > 0, return NULL); |
198 | kctl = kcalloc(1, sizeof(*kctl) + sizeof(snd_kcontrol_volatile_t) * control->count, GFP_KERNEL); | 198 | kctl = kzalloc(sizeof(*kctl) + sizeof(snd_kcontrol_volatile_t) * control->count, GFP_KERNEL); |
199 | if (kctl == NULL) | 199 | if (kctl == NULL) |
200 | return NULL; | 200 | return NULL; |
201 | *kctl = *control; | 201 | *kctl = *control; |
@@ -521,7 +521,7 @@ static int snd_ctl_card_info(snd_card_t * card, snd_ctl_file_t * ctl, | |||
521 | { | 521 | { |
522 | snd_ctl_card_info_t *info; | 522 | snd_ctl_card_info_t *info; |
523 | 523 | ||
524 | info = kcalloc(1, sizeof(*info), GFP_KERNEL); | 524 | info = kzalloc(sizeof(*info), GFP_KERNEL); |
525 | if (! info) | 525 | if (! info) |
526 | return -ENOMEM; | 526 | return -ENOMEM; |
527 | down_read(&snd_ioctl_rwsem); | 527 | down_read(&snd_ioctl_rwsem); |
@@ -929,7 +929,7 @@ static int snd_ctl_elem_add(snd_ctl_file_t *file, snd_ctl_elem_info_t *info, int | |||
929 | return -EINVAL; | 929 | return -EINVAL; |
930 | } | 930 | } |
931 | private_size *= info->count; | 931 | private_size *= info->count; |
932 | ue = kcalloc(1, sizeof(struct user_element) + private_size, GFP_KERNEL); | 932 | ue = kzalloc(sizeof(struct user_element) + private_size, GFP_KERNEL); |
933 | if (ue == NULL) | 933 | if (ue == NULL) |
934 | return -ENOMEM; | 934 | return -ENOMEM; |
935 | ue->info = *info; | 935 | ue->info = *info; |
@@ -1185,7 +1185,7 @@ static int _snd_ctl_register_ioctl(snd_kctl_ioctl_func_t fcn, struct list_head * | |||
1185 | { | 1185 | { |
1186 | snd_kctl_ioctl_t *pn; | 1186 | snd_kctl_ioctl_t *pn; |
1187 | 1187 | ||
1188 | pn = kcalloc(1, sizeof(snd_kctl_ioctl_t), GFP_KERNEL); | 1188 | pn = kzalloc(sizeof(snd_kctl_ioctl_t), GFP_KERNEL); |
1189 | if (pn == NULL) | 1189 | if (pn == NULL) |
1190 | return -ENOMEM; | 1190 | return -ENOMEM; |
1191 | pn->fioctl = fcn; | 1191 | pn->fioctl = fcn; |
diff --git a/sound/core/control_compat.c b/sound/core/control_compat.c index 7fdabea4bfc8..207c7de5129c 100644 --- a/sound/core/control_compat.c +++ b/sound/core/control_compat.c | |||
@@ -92,7 +92,7 @@ static int snd_ctl_elem_info_compat(snd_ctl_file_t *ctl, struct sndrv_ctl_elem_i | |||
92 | struct sndrv_ctl_elem_info *data; | 92 | struct sndrv_ctl_elem_info *data; |
93 | int err; | 93 | int err; |
94 | 94 | ||
95 | data = kcalloc(1, sizeof(*data), GFP_KERNEL); | 95 | data = kzalloc(sizeof(*data), GFP_KERNEL); |
96 | if (! data) | 96 | if (! data) |
97 | return -ENOMEM; | 97 | return -ENOMEM; |
98 | 98 | ||
@@ -271,7 +271,7 @@ static int snd_ctl_elem_read_user_compat(snd_card_t *card, | |||
271 | struct sndrv_ctl_elem_value *data; | 271 | struct sndrv_ctl_elem_value *data; |
272 | int err, type, count; | 272 | int err, type, count; |
273 | 273 | ||
274 | data = kcalloc(1, sizeof(*data), GFP_KERNEL); | 274 | data = kzalloc(sizeof(*data), GFP_KERNEL); |
275 | if (data == NULL) | 275 | if (data == NULL) |
276 | return -ENOMEM; | 276 | return -ENOMEM; |
277 | 277 | ||
@@ -291,7 +291,7 @@ static int snd_ctl_elem_write_user_compat(snd_ctl_file_t *file, | |||
291 | struct sndrv_ctl_elem_value *data; | 291 | struct sndrv_ctl_elem_value *data; |
292 | int err, type, count; | 292 | int err, type, count; |
293 | 293 | ||
294 | data = kcalloc(1, sizeof(*data), GFP_KERNEL); | 294 | data = kzalloc(sizeof(*data), GFP_KERNEL); |
295 | if (data == NULL) | 295 | if (data == NULL) |
296 | return -ENOMEM; | 296 | return -ENOMEM; |
297 | 297 | ||
@@ -313,7 +313,7 @@ static int snd_ctl_elem_add_compat(snd_ctl_file_t *file, | |||
313 | struct sndrv_ctl_elem_info *data; | 313 | struct sndrv_ctl_elem_info *data; |
314 | int err; | 314 | int err; |
315 | 315 | ||
316 | data = kcalloc(1, sizeof(*data), GFP_KERNEL); | 316 | data = kzalloc(sizeof(*data), GFP_KERNEL); |
317 | if (! data) | 317 | if (! data) |
318 | return -ENOMEM; | 318 | return -ENOMEM; |
319 | 319 | ||
diff --git a/sound/core/device.c b/sound/core/device.c index ca00ad7740c9..1f509f56e60c 100644 --- a/sound/core/device.c +++ b/sound/core/device.c | |||
@@ -49,7 +49,7 @@ int snd_device_new(snd_card_t *card, snd_device_type_t type, | |||
49 | snd_assert(card != NULL, return -ENXIO); | 49 | snd_assert(card != NULL, return -ENXIO); |
50 | snd_assert(device_data != NULL, return -ENXIO); | 50 | snd_assert(device_data != NULL, return -ENXIO); |
51 | snd_assert(ops != NULL, return -ENXIO); | 51 | snd_assert(ops != NULL, return -ENXIO); |
52 | dev = kcalloc(1, sizeof(*dev), GFP_KERNEL); | 52 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); |
53 | if (dev == NULL) | 53 | if (dev == NULL) |
54 | return -ENOMEM; | 54 | return -ENOMEM; |
55 | dev->card = card; | 55 | dev->card = card; |
diff --git a/sound/core/hwdep.c b/sound/core/hwdep.c index 997dd41c584e..9383f1294fb5 100644 --- a/sound/core/hwdep.c +++ b/sound/core/hwdep.c | |||
@@ -359,7 +359,7 @@ int snd_hwdep_new(snd_card_t * card, char *id, int device, snd_hwdep_t ** rhwdep | |||
359 | snd_assert(rhwdep != NULL, return -EINVAL); | 359 | snd_assert(rhwdep != NULL, return -EINVAL); |
360 | *rhwdep = NULL; | 360 | *rhwdep = NULL; |
361 | snd_assert(card != NULL, return -ENXIO); | 361 | snd_assert(card != NULL, return -ENXIO); |
362 | hwdep = kcalloc(1, sizeof(*hwdep), GFP_KERNEL); | 362 | hwdep = kzalloc(sizeof(*hwdep), GFP_KERNEL); |
363 | if (hwdep == NULL) | 363 | if (hwdep == NULL) |
364 | return -ENOMEM; | 364 | return -ENOMEM; |
365 | hwdep->card = card; | 365 | hwdep->card = card; |
diff --git a/sound/core/info.c b/sound/core/info.c index 7f8bdf7b0058..37024d68a26e 100644 --- a/sound/core/info.c +++ b/sound/core/info.c | |||
@@ -295,7 +295,7 @@ static int snd_info_entry_open(struct inode *inode, struct file *file) | |||
295 | goto __error; | 295 | goto __error; |
296 | } | 296 | } |
297 | } | 297 | } |
298 | data = kcalloc(1, sizeof(*data), GFP_KERNEL); | 298 | data = kzalloc(sizeof(*data), GFP_KERNEL); |
299 | if (data == NULL) { | 299 | if (data == NULL) { |
300 | err = -ENOMEM; | 300 | err = -ENOMEM; |
301 | goto __error; | 301 | goto __error; |
@@ -304,7 +304,7 @@ static int snd_info_entry_open(struct inode *inode, struct file *file) | |||
304 | switch (entry->content) { | 304 | switch (entry->content) { |
305 | case SNDRV_INFO_CONTENT_TEXT: | 305 | case SNDRV_INFO_CONTENT_TEXT: |
306 | if (mode == O_RDONLY || mode == O_RDWR) { | 306 | if (mode == O_RDONLY || mode == O_RDWR) { |
307 | buffer = kcalloc(1, sizeof(*buffer), GFP_KERNEL); | 307 | buffer = kzalloc(sizeof(*buffer), GFP_KERNEL); |
308 | if (buffer == NULL) { | 308 | if (buffer == NULL) { |
309 | kfree(data); | 309 | kfree(data); |
310 | err = -ENOMEM; | 310 | err = -ENOMEM; |
@@ -323,7 +323,7 @@ static int snd_info_entry_open(struct inode *inode, struct file *file) | |||
323 | data->rbuffer = buffer; | 323 | data->rbuffer = buffer; |
324 | } | 324 | } |
325 | if (mode == O_WRONLY || mode == O_RDWR) { | 325 | if (mode == O_WRONLY || mode == O_RDWR) { |
326 | buffer = kcalloc(1, sizeof(*buffer), GFP_KERNEL); | 326 | buffer = kzalloc(sizeof(*buffer), GFP_KERNEL); |
327 | if (buffer == NULL) { | 327 | if (buffer == NULL) { |
328 | if (mode == O_RDWR) { | 328 | if (mode == O_RDWR) { |
329 | vfree(data->rbuffer->buffer); | 329 | vfree(data->rbuffer->buffer); |
@@ -752,7 +752,7 @@ char *snd_info_get_str(char *dest, char *src, int len) | |||
752 | static snd_info_entry_t *snd_info_create_entry(const char *name) | 752 | static snd_info_entry_t *snd_info_create_entry(const char *name) |
753 | { | 753 | { |
754 | snd_info_entry_t *entry; | 754 | snd_info_entry_t *entry; |
755 | entry = kcalloc(1, sizeof(*entry), GFP_KERNEL); | 755 | entry = kzalloc(sizeof(*entry), GFP_KERNEL); |
756 | if (entry == NULL) | 756 | if (entry == NULL) |
757 | return NULL; | 757 | return NULL; |
758 | entry->name = kstrdup(name, GFP_KERNEL); | 758 | entry->name = kstrdup(name, GFP_KERNEL); |
diff --git a/sound/core/init.c b/sound/core/init.c index d72f58f450ce..41e224986f35 100644 --- a/sound/core/init.c +++ b/sound/core/init.c | |||
@@ -28,6 +28,8 @@ | |||
28 | #include <linux/ctype.h> | 28 | #include <linux/ctype.h> |
29 | #include <linux/pci.h> | 29 | #include <linux/pci.h> |
30 | #include <linux/pm.h> | 30 | #include <linux/pm.h> |
31 | #include <linux/platform_device.h> | ||
32 | |||
31 | #include <sound/core.h> | 33 | #include <sound/core.h> |
32 | #include <sound/control.h> | 34 | #include <sound/control.h> |
33 | #include <sound/info.h> | 35 | #include <sound/info.h> |
@@ -72,7 +74,7 @@ snd_card_t *snd_card_new(int idx, const char *xid, | |||
72 | 74 | ||
73 | if (extra_size < 0) | 75 | if (extra_size < 0) |
74 | extra_size = 0; | 76 | extra_size = 0; |
75 | card = kcalloc(1, sizeof(*card) + extra_size, GFP_KERNEL); | 77 | card = kzalloc(sizeof(*card) + extra_size, GFP_KERNEL); |
76 | if (card == NULL) | 78 | if (card == NULL) |
77 | return NULL; | 79 | return NULL; |
78 | if (xid) { | 80 | if (xid) { |
@@ -226,8 +228,10 @@ int snd_card_disconnect(snd_card_t * card) | |||
226 | return 0; | 228 | return 0; |
227 | } | 229 | } |
228 | 230 | ||
229 | #if defined(CONFIG_PM) && defined(CONFIG_SND_GENERIC_PM) | 231 | #ifdef CONFIG_SND_GENERIC_DRIVER |
230 | static void snd_generic_device_unregister(struct snd_generic_device *dev); | 232 | static void snd_generic_device_unregister(snd_card_t *card); |
233 | #else | ||
234 | #define snd_generic_device_unregister(x) /*NOP*/ | ||
231 | #endif | 235 | #endif |
232 | 236 | ||
233 | /** | 237 | /** |
@@ -253,14 +257,7 @@ int snd_card_free(snd_card_t * card) | |||
253 | 257 | ||
254 | #ifdef CONFIG_PM | 258 | #ifdef CONFIG_PM |
255 | wake_up(&card->power_sleep); | 259 | wake_up(&card->power_sleep); |
256 | #ifdef CONFIG_SND_GENERIC_PM | ||
257 | if (card->pm_dev) { | ||
258 | snd_generic_device_unregister(card->pm_dev); | ||
259 | card->pm_dev = NULL; | ||
260 | } | ||
261 | #endif | 260 | #endif |
262 | #endif | ||
263 | |||
264 | /* wait, until all devices are ready for the free operation */ | 261 | /* wait, until all devices are ready for the free operation */ |
265 | wait_event(card->shutdown_sleep, card->files == NULL); | 262 | wait_event(card->shutdown_sleep, card->files == NULL); |
266 | 263 | ||
@@ -288,6 +285,7 @@ int snd_card_free(snd_card_t * card) | |||
288 | snd_printk(KERN_WARNING "unable to free card info\n"); | 285 | snd_printk(KERN_WARNING "unable to free card info\n"); |
289 | /* Not fatal error */ | 286 | /* Not fatal error */ |
290 | } | 287 | } |
288 | snd_generic_device_unregister(card); | ||
291 | while (card->s_f_ops) { | 289 | while (card->s_f_ops) { |
292 | s_f_ops = card->s_f_ops; | 290 | s_f_ops = card->s_f_ops; |
293 | card->s_f_ops = s_f_ops->next; | 291 | card->s_f_ops = s_f_ops->next; |
@@ -665,6 +663,96 @@ int snd_card_file_remove(snd_card_t *card, struct file *file) | |||
665 | return 0; | 663 | return 0; |
666 | } | 664 | } |
667 | 665 | ||
666 | #ifdef CONFIG_SND_GENERIC_DRIVER | ||
667 | /* | ||
668 | * generic device without a proper bus using platform_device | ||
669 | * (e.g. ISA) | ||
670 | */ | ||
671 | struct snd_generic_device { | ||
672 | struct platform_device pdev; | ||
673 | snd_card_t *card; | ||
674 | }; | ||
675 | |||
676 | #define get_snd_generic_card(dev) container_of(to_platform_device(dev), struct snd_generic_device, pdev)->card | ||
677 | |||
678 | #define SND_GENERIC_NAME "snd_generic" | ||
679 | |||
680 | #ifdef CONFIG_PM | ||
681 | static int snd_generic_suspend(struct device *dev, pm_message_t state); | ||
682 | static int snd_generic_resume(struct device *dev); | ||
683 | #endif | ||
684 | |||
685 | /* initialized in sound.c */ | ||
686 | struct device_driver snd_generic_driver = { | ||
687 | .name = SND_GENERIC_NAME, | ||
688 | .bus = &platform_bus_type, | ||
689 | #ifdef CONFIG_PM | ||
690 | .suspend = snd_generic_suspend, | ||
691 | .resume = snd_generic_resume, | ||
692 | #endif | ||
693 | }; | ||
694 | |||
695 | void snd_generic_device_release(struct device *dev) | ||
696 | { | ||
697 | } | ||
698 | |||
699 | static int snd_generic_device_register(snd_card_t *card) | ||
700 | { | ||
701 | struct snd_generic_device *dev; | ||
702 | int err; | ||
703 | |||
704 | if (card->generic_dev) | ||
705 | return 0; /* already registered */ | ||
706 | |||
707 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); | ||
708 | if (! dev) { | ||
709 | snd_printk(KERN_ERR "can't allocate generic_device\n"); | ||
710 | return -ENOMEM; | ||
711 | } | ||
712 | |||
713 | dev->pdev.name = SND_GENERIC_NAME; | ||
714 | dev->pdev.id = card->number; | ||
715 | dev->pdev.dev.release = snd_generic_device_release; | ||
716 | dev->card = card; | ||
717 | if ((err = platform_device_register(&dev->pdev)) < 0) { | ||
718 | kfree(dev); | ||
719 | return err; | ||
720 | } | ||
721 | card->generic_dev = dev; | ||
722 | return 0; | ||
723 | } | ||
724 | |||
725 | static void snd_generic_device_unregister(snd_card_t *card) | ||
726 | { | ||
727 | struct snd_generic_device *dev = card->generic_dev; | ||
728 | if (dev) { | ||
729 | platform_device_unregister(&dev->pdev); | ||
730 | kfree(dev); | ||
731 | card->generic_dev = NULL; | ||
732 | } | ||
733 | } | ||
734 | |||
735 | /** | ||
736 | * snd_card_set_generic_dev - assign the generic device to the card | ||
737 | * @card: soundcard structure | ||
738 | * | ||
739 | * Assigns a generic device to the card. This function is provided as the | ||
740 | * last resort, for devices without any proper bus. Thus this won't override | ||
741 | * the device already assigned to the card. | ||
742 | * | ||
743 | * Returns zero if successful, or a negative error code. | ||
744 | */ | ||
745 | int snd_card_set_generic_dev(snd_card_t *card) | ||
746 | { | ||
747 | int err; | ||
748 | if ((err = snd_generic_device_register(card)) < 0) | ||
749 | return err; | ||
750 | if (! card->dev) | ||
751 | snd_card_set_dev(card, &card->generic_dev->pdev.dev); | ||
752 | return 0; | ||
753 | } | ||
754 | #endif /* CONFIG_SND_GENERIC_DRIVER */ | ||
755 | |||
668 | #ifdef CONFIG_PM | 756 | #ifdef CONFIG_PM |
669 | /** | 757 | /** |
670 | * snd_power_wait - wait until the power-state is changed. | 758 | * snd_power_wait - wait until the power-state is changed. |
@@ -730,102 +818,30 @@ int snd_card_set_pm_callback(snd_card_t *card, | |||
730 | return 0; | 818 | return 0; |
731 | } | 819 | } |
732 | 820 | ||
733 | #ifdef CONFIG_SND_GENERIC_PM | 821 | #ifdef CONFIG_SND_GENERIC_DRIVER |
734 | /* | ||
735 | * use platform_device for generic power-management without a proper bus | ||
736 | * (e.g. ISA) | ||
737 | */ | ||
738 | struct snd_generic_device { | ||
739 | struct platform_device pdev; | ||
740 | snd_card_t *card; | ||
741 | }; | ||
742 | |||
743 | #define get_snd_generic_card(dev) container_of(to_platform_device(dev), struct snd_generic_device, pdev)->card | ||
744 | |||
745 | #define SND_GENERIC_NAME "snd_generic_pm" | ||
746 | |||
747 | static int snd_generic_suspend(struct device *dev, pm_message_t state, u32 level); | ||
748 | static int snd_generic_resume(struct device *dev, u32 level); | ||
749 | |||
750 | static struct device_driver snd_generic_driver = { | ||
751 | .name = SND_GENERIC_NAME, | ||
752 | .bus = &platform_bus_type, | ||
753 | .suspend = snd_generic_suspend, | ||
754 | .resume = snd_generic_resume, | ||
755 | }; | ||
756 | |||
757 | static int generic_driver_registered; | ||
758 | |||
759 | static void generic_driver_unregister(void) | ||
760 | { | ||
761 | if (generic_driver_registered) { | ||
762 | generic_driver_registered--; | ||
763 | if (! generic_driver_registered) | ||
764 | driver_unregister(&snd_generic_driver); | ||
765 | } | ||
766 | } | ||
767 | |||
768 | static struct snd_generic_device *snd_generic_device_register(snd_card_t *card) | ||
769 | { | ||
770 | struct snd_generic_device *dev; | ||
771 | |||
772 | if (! generic_driver_registered) { | ||
773 | if (driver_register(&snd_generic_driver) < 0) | ||
774 | return NULL; | ||
775 | } | ||
776 | generic_driver_registered++; | ||
777 | |||
778 | dev = kcalloc(1, sizeof(*dev), GFP_KERNEL); | ||
779 | if (! dev) { | ||
780 | generic_driver_unregister(); | ||
781 | return NULL; | ||
782 | } | ||
783 | |||
784 | dev->pdev.name = SND_GENERIC_NAME; | ||
785 | dev->pdev.id = card->number; | ||
786 | dev->card = card; | ||
787 | if (platform_device_register(&dev->pdev) < 0) { | ||
788 | kfree(dev); | ||
789 | generic_driver_unregister(); | ||
790 | return NULL; | ||
791 | } | ||
792 | return dev; | ||
793 | } | ||
794 | |||
795 | static void snd_generic_device_unregister(struct snd_generic_device *dev) | ||
796 | { | ||
797 | platform_device_unregister(&dev->pdev); | ||
798 | kfree(dev); | ||
799 | generic_driver_unregister(); | ||
800 | } | ||
801 | |||
802 | /* suspend/resume callbacks for snd_generic platform device */ | 822 | /* suspend/resume callbacks for snd_generic platform device */ |
803 | static int snd_generic_suspend(struct device *dev, pm_message_t state, u32 level) | 823 | static int snd_generic_suspend(struct device *dev, pm_message_t state) |
804 | { | 824 | { |
805 | snd_card_t *card; | 825 | snd_card_t *card; |
806 | 826 | ||
807 | if (level != SUSPEND_DISABLE) | ||
808 | return 0; | ||
809 | |||
810 | card = get_snd_generic_card(dev); | 827 | card = get_snd_generic_card(dev); |
811 | if (card->power_state == SNDRV_CTL_POWER_D3hot) | 828 | if (card->power_state == SNDRV_CTL_POWER_D3hot) |
812 | return 0; | 829 | return 0; |
813 | card->pm_suspend(card, PMSG_SUSPEND); | 830 | if (card->pm_suspend) |
831 | card->pm_suspend(card, PMSG_SUSPEND); | ||
814 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | 832 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
815 | return 0; | 833 | return 0; |
816 | } | 834 | } |
817 | 835 | ||
818 | static int snd_generic_resume(struct device *dev, u32 level) | 836 | static int snd_generic_resume(struct device *dev) |
819 | { | 837 | { |
820 | snd_card_t *card; | 838 | snd_card_t *card; |
821 | 839 | ||
822 | if (level != RESUME_ENABLE) | ||
823 | return 0; | ||
824 | |||
825 | card = get_snd_generic_card(dev); | 840 | card = get_snd_generic_card(dev); |
826 | if (card->power_state == SNDRV_CTL_POWER_D0) | 841 | if (card->power_state == SNDRV_CTL_POWER_D0) |
827 | return 0; | 842 | return 0; |
828 | card->pm_resume(card); | 843 | if (card->pm_suspend) |
844 | card->pm_resume(card); | ||
829 | snd_power_change_state(card, SNDRV_CTL_POWER_D0); | 845 | snd_power_change_state(card, SNDRV_CTL_POWER_D0); |
830 | return 0; | 846 | return 0; |
831 | } | 847 | } |
@@ -846,13 +862,12 @@ int snd_card_set_generic_pm_callback(snd_card_t *card, | |||
846 | int (*resume)(snd_card_t *), | 862 | int (*resume)(snd_card_t *), |
847 | void *private_data) | 863 | void *private_data) |
848 | { | 864 | { |
849 | card->pm_dev = snd_generic_device_register(card); | 865 | int err; |
850 | if (! card->pm_dev) | 866 | if ((err = snd_generic_device_register(card)) < 0) |
851 | return -ENOMEM; | 867 | return err; |
852 | snd_card_set_pm_callback(card, suspend, resume, private_data); | 868 | return snd_card_set_pm_callback(card, suspend, resume, private_data); |
853 | return 0; | ||
854 | } | 869 | } |
855 | #endif /* CONFIG_SND_GENERIC_PM */ | 870 | #endif /* CONFIG_SND_GENERIC_DRIVER */ |
856 | 871 | ||
857 | #ifdef CONFIG_PCI | 872 | #ifdef CONFIG_PCI |
858 | int snd_card_pci_suspend(struct pci_dev *dev, pm_message_t state) | 873 | int snd_card_pci_suspend(struct pci_dev *dev, pm_message_t state) |
diff --git a/sound/core/memalloc.c b/sound/core/memalloc.c index 02132561c3f8..129abab5ce98 100644 --- a/sound/core/memalloc.c +++ b/sound/core/memalloc.c | |||
@@ -106,7 +106,7 @@ struct snd_mem_list { | |||
106 | 106 | ||
107 | static void *snd_dma_hack_alloc_coherent(struct device *dev, size_t size, | 107 | static void *snd_dma_hack_alloc_coherent(struct device *dev, size_t size, |
108 | dma_addr_t *dma_handle, | 108 | dma_addr_t *dma_handle, |
109 | unsigned int __nocast flags) | 109 | gfp_t flags) |
110 | { | 110 | { |
111 | void *ret; | 111 | void *ret; |
112 | u64 dma_mask, coherent_dma_mask; | 112 | u64 dma_mask, coherent_dma_mask; |
@@ -190,7 +190,7 @@ static void unmark_pages(struct page *page, int order) | |||
190 | * | 190 | * |
191 | * Returns the pointer of the buffer, or NULL if no enoguh memory. | 191 | * Returns the pointer of the buffer, or NULL if no enoguh memory. |
192 | */ | 192 | */ |
193 | void *snd_malloc_pages(size_t size, unsigned int gfp_flags) | 193 | void *snd_malloc_pages(size_t size, gfp_t gfp_flags) |
194 | { | 194 | { |
195 | int pg; | 195 | int pg; |
196 | void *res; | 196 | void *res; |
@@ -235,7 +235,7 @@ static void *snd_malloc_dev_pages(struct device *dev, size_t size, dma_addr_t *d | |||
235 | { | 235 | { |
236 | int pg; | 236 | int pg; |
237 | void *res; | 237 | void *res; |
238 | unsigned int gfp_flags; | 238 | gfp_t gfp_flags; |
239 | 239 | ||
240 | snd_assert(size > 0, return NULL); | 240 | snd_assert(size > 0, return NULL); |
241 | snd_assert(dma != NULL, return NULL); | 241 | snd_assert(dma != NULL, return NULL); |
@@ -512,7 +512,7 @@ static void free_all_reserved_pages(void) | |||
512 | * proc file interface | 512 | * proc file interface |
513 | */ | 513 | */ |
514 | #define SND_MEM_PROC_FILE "driver/snd-page-alloc" | 514 | #define SND_MEM_PROC_FILE "driver/snd-page-alloc" |
515 | struct proc_dir_entry *snd_mem_proc; | 515 | static struct proc_dir_entry *snd_mem_proc; |
516 | 516 | ||
517 | static int snd_mem_proc_read(char *page, char **start, off_t off, | 517 | static int snd_mem_proc_read(char *page, char **start, off_t off, |
518 | int count, int *eof, void *data) | 518 | int count, int *eof, void *data) |
@@ -590,7 +590,7 @@ static int snd_mem_proc_write(struct file *file, const char __user *buffer, | |||
590 | 590 | ||
591 | alloced = 0; | 591 | alloced = 0; |
592 | pci = NULL; | 592 | pci = NULL; |
593 | while ((pci = pci_find_device(vendor, device, pci)) != NULL) { | 593 | while ((pci = pci_get_device(vendor, device, pci)) != NULL) { |
594 | if (mask > 0 && mask < 0xffffffff) { | 594 | if (mask > 0 && mask < 0xffffffff) { |
595 | if (pci_set_dma_mask(pci, mask) < 0 || | 595 | if (pci_set_dma_mask(pci, mask) < 0 || |
596 | pci_set_consistent_dma_mask(pci, mask) < 0) { | 596 | pci_set_consistent_dma_mask(pci, mask) < 0) { |
@@ -604,6 +604,7 @@ static int snd_mem_proc_write(struct file *file, const char __user *buffer, | |||
604 | if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(pci), | 604 | if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(pci), |
605 | size, &dmab) < 0) { | 605 | size, &dmab) < 0) { |
606 | printk(KERN_ERR "snd-page-alloc: cannot allocate buffer pages (size = %d)\n", size); | 606 | printk(KERN_ERR "snd-page-alloc: cannot allocate buffer pages (size = %d)\n", size); |
607 | pci_dev_put(pci); | ||
607 | return (int)count; | 608 | return (int)count; |
608 | } | 609 | } |
609 | snd_dma_reserve_buf(&dmab, snd_dma_pci_buf_id(pci)); | 610 | snd_dma_reserve_buf(&dmab, snd_dma_pci_buf_id(pci)); |
@@ -655,8 +656,7 @@ static int __init snd_mem_init(void) | |||
655 | 656 | ||
656 | static void __exit snd_mem_exit(void) | 657 | static void __exit snd_mem_exit(void) |
657 | { | 658 | { |
658 | if (snd_mem_proc) | 659 | remove_proc_entry(SND_MEM_PROC_FILE, NULL); |
659 | remove_proc_entry(SND_MEM_PROC_FILE, NULL); | ||
660 | free_all_reserved_pages(); | 660 | free_all_reserved_pages(); |
661 | if (snd_allocated_pages > 0) | 661 | if (snd_allocated_pages > 0) |
662 | printk(KERN_ERR "snd-malloc: Memory leak? pages not freed = %li\n", snd_allocated_pages); | 662 | printk(KERN_ERR "snd-malloc: Memory leak? pages not freed = %li\n", snd_allocated_pages); |
diff --git a/sound/core/memory.c b/sound/core/memory.c index f6895577bf86..7d8e2eebba51 100644 --- a/sound/core/memory.c +++ b/sound/core/memory.c | |||
@@ -56,7 +56,7 @@ static DEFINE_SPINLOCK(snd_alloc_vmalloc_lock); | |||
56 | #define VMALLOC_MAGIC 0x87654320 | 56 | #define VMALLOC_MAGIC 0x87654320 |
57 | static snd_info_entry_t *snd_memory_info_entry; | 57 | static snd_info_entry_t *snd_memory_info_entry; |
58 | 58 | ||
59 | void snd_memory_init(void) | 59 | void __init snd_memory_init(void) |
60 | { | 60 | { |
61 | snd_alloc_kmalloc = 0; | 61 | snd_alloc_kmalloc = 0; |
62 | snd_alloc_vmalloc = 0; | 62 | snd_alloc_vmalloc = 0; |
@@ -89,7 +89,7 @@ void snd_memory_done(void) | |||
89 | } | 89 | } |
90 | } | 90 | } |
91 | 91 | ||
92 | static void *__snd_kmalloc(size_t size, unsigned int __nocast flags, void *caller) | 92 | static void *__snd_kmalloc(size_t size, gfp_t flags, void *caller) |
93 | { | 93 | { |
94 | unsigned long cpu_flags; | 94 | unsigned long cpu_flags; |
95 | struct snd_alloc_track *t; | 95 | struct snd_alloc_track *t; |
@@ -111,20 +111,26 @@ static void *__snd_kmalloc(size_t size, unsigned int __nocast flags, void *calle | |||
111 | } | 111 | } |
112 | 112 | ||
113 | #define _snd_kmalloc(size, flags) __snd_kmalloc((size), (flags), __builtin_return_address(0)); | 113 | #define _snd_kmalloc(size, flags) __snd_kmalloc((size), (flags), __builtin_return_address(0)); |
114 | void *snd_hidden_kmalloc(size_t size, unsigned int __nocast flags) | 114 | void *snd_hidden_kmalloc(size_t size, gfp_t flags) |
115 | { | 115 | { |
116 | return _snd_kmalloc(size, flags); | 116 | return _snd_kmalloc(size, flags); |
117 | } | 117 | } |
118 | 118 | ||
119 | void *snd_hidden_kcalloc(size_t n, size_t size, unsigned int __nocast flags) | 119 | void *snd_hidden_kzalloc(size_t size, gfp_t flags) |
120 | { | ||
121 | void *ret = _snd_kmalloc(size, flags); | ||
122 | if (ret) | ||
123 | memset(ret, 0, size); | ||
124 | return ret; | ||
125 | } | ||
126 | EXPORT_SYMBOL(snd_hidden_kzalloc); | ||
127 | |||
128 | void *snd_hidden_kcalloc(size_t n, size_t size, gfp_t flags) | ||
120 | { | 129 | { |
121 | void *ret = NULL; | 130 | void *ret = NULL; |
122 | if (n != 0 && size > INT_MAX / n) | 131 | if (n != 0 && size > INT_MAX / n) |
123 | return ret; | 132 | return ret; |
124 | ret = _snd_kmalloc(n * size, flags); | 133 | return snd_hidden_kzalloc(n * size, flags); |
125 | if (ret) | ||
126 | memset(ret, 0, n * size); | ||
127 | return ret; | ||
128 | } | 134 | } |
129 | 135 | ||
130 | void snd_hidden_kfree(const void *obj) | 136 | void snd_hidden_kfree(const void *obj) |
@@ -184,7 +190,7 @@ void snd_hidden_vfree(void *obj) | |||
184 | snd_wrapper_vfree(obj); | 190 | snd_wrapper_vfree(obj); |
185 | } | 191 | } |
186 | 192 | ||
187 | char *snd_hidden_kstrdup(const char *s, unsigned int __nocast flags) | 193 | char *snd_hidden_kstrdup(const char *s, gfp_t flags) |
188 | { | 194 | { |
189 | int len; | 195 | int len; |
190 | char *buf; | 196 | char *buf; |
@@ -243,7 +249,7 @@ int __exit snd_memory_info_done(void) | |||
243 | int copy_to_user_fromio(void __user *dst, const volatile void __iomem *src, size_t count) | 249 | int copy_to_user_fromio(void __user *dst, const volatile void __iomem *src, size_t count) |
244 | { | 250 | { |
245 | #if defined(__i386__) || defined(CONFIG_SPARC32) | 251 | #if defined(__i386__) || defined(CONFIG_SPARC32) |
246 | return copy_to_user(dst, (const void*)src, count) ? -EFAULT : 0; | 252 | return copy_to_user(dst, (const void __force*)src, count) ? -EFAULT : 0; |
247 | #else | 253 | #else |
248 | char buf[256]; | 254 | char buf[256]; |
249 | while (count) { | 255 | while (count) { |
@@ -274,7 +280,7 @@ int copy_to_user_fromio(void __user *dst, const volatile void __iomem *src, size | |||
274 | int copy_from_user_toio(volatile void __iomem *dst, const void __user *src, size_t count) | 280 | int copy_from_user_toio(volatile void __iomem *dst, const void __user *src, size_t count) |
275 | { | 281 | { |
276 | #if defined(__i386__) || defined(CONFIG_SPARC32) | 282 | #if defined(__i386__) || defined(CONFIG_SPARC32) |
277 | return copy_from_user((void*)dst, src, count) ? -EFAULT : 0; | 283 | return copy_from_user((void __force *)dst, src, count) ? -EFAULT : 0; |
278 | #else | 284 | #else |
279 | char buf[256]; | 285 | char buf[256]; |
280 | while (count) { | 286 | while (count) { |
diff --git a/sound/core/oss/mixer_oss.c b/sound/core/oss/mixer_oss.c index 98fc0766f885..69e1059112d1 100644 --- a/sound/core/oss/mixer_oss.c +++ b/sound/core/oss/mixer_oss.c | |||
@@ -53,7 +53,7 @@ static int snd_mixer_oss_open(struct inode *inode, struct file *file) | |||
53 | err = snd_card_file_add(card, file); | 53 | err = snd_card_file_add(card, file); |
54 | if (err < 0) | 54 | if (err < 0) |
55 | return err; | 55 | return err; |
56 | fmixer = kcalloc(1, sizeof(*fmixer), GFP_KERNEL); | 56 | fmixer = kzalloc(sizeof(*fmixer), GFP_KERNEL); |
57 | if (fmixer == NULL) { | 57 | if (fmixer == NULL) { |
58 | snd_card_file_remove(card, file); | 58 | snd_card_file_remove(card, file); |
59 | return -ENOMEM; | 59 | return -ENOMEM; |
@@ -517,8 +517,8 @@ static void snd_mixer_oss_get_volume1_vol(snd_mixer_oss_file_t *fmixer, | |||
517 | up_read(&card->controls_rwsem); | 517 | up_read(&card->controls_rwsem); |
518 | return; | 518 | return; |
519 | } | 519 | } |
520 | uinfo = kcalloc(1, sizeof(*uinfo), GFP_KERNEL); | 520 | uinfo = kzalloc(sizeof(*uinfo), GFP_KERNEL); |
521 | uctl = kcalloc(1, sizeof(*uctl), GFP_KERNEL); | 521 | uctl = kzalloc(sizeof(*uctl), GFP_KERNEL); |
522 | if (uinfo == NULL || uctl == NULL) | 522 | if (uinfo == NULL || uctl == NULL) |
523 | goto __unalloc; | 523 | goto __unalloc; |
524 | snd_runtime_check(!kctl->info(kctl, uinfo), goto __unalloc); | 524 | snd_runtime_check(!kctl->info(kctl, uinfo), goto __unalloc); |
@@ -551,8 +551,8 @@ static void snd_mixer_oss_get_volume1_sw(snd_mixer_oss_file_t *fmixer, | |||
551 | up_read(&card->controls_rwsem); | 551 | up_read(&card->controls_rwsem); |
552 | return; | 552 | return; |
553 | } | 553 | } |
554 | uinfo = kcalloc(1, sizeof(*uinfo), GFP_KERNEL); | 554 | uinfo = kzalloc(sizeof(*uinfo), GFP_KERNEL); |
555 | uctl = kcalloc(1, sizeof(*uctl), GFP_KERNEL); | 555 | uctl = kzalloc(sizeof(*uctl), GFP_KERNEL); |
556 | if (uinfo == NULL || uctl == NULL) | 556 | if (uinfo == NULL || uctl == NULL) |
557 | goto __unalloc; | 557 | goto __unalloc; |
558 | snd_runtime_check(!kctl->info(kctl, uinfo), goto __unalloc); | 558 | snd_runtime_check(!kctl->info(kctl, uinfo), goto __unalloc); |
@@ -612,8 +612,8 @@ static void snd_mixer_oss_put_volume1_vol(snd_mixer_oss_file_t *fmixer, | |||
612 | down_read(&card->controls_rwsem); | 612 | down_read(&card->controls_rwsem); |
613 | if ((kctl = snd_ctl_find_numid(card, numid)) == NULL) | 613 | if ((kctl = snd_ctl_find_numid(card, numid)) == NULL) |
614 | return; | 614 | return; |
615 | uinfo = kcalloc(1, sizeof(*uinfo), GFP_KERNEL); | 615 | uinfo = kzalloc(sizeof(*uinfo), GFP_KERNEL); |
616 | uctl = kcalloc(1, sizeof(*uctl), GFP_KERNEL); | 616 | uctl = kzalloc(sizeof(*uctl), GFP_KERNEL); |
617 | if (uinfo == NULL || uctl == NULL) | 617 | if (uinfo == NULL || uctl == NULL) |
618 | goto __unalloc; | 618 | goto __unalloc; |
619 | snd_runtime_check(!kctl->info(kctl, uinfo), goto __unalloc); | 619 | snd_runtime_check(!kctl->info(kctl, uinfo), goto __unalloc); |
@@ -649,8 +649,8 @@ static void snd_mixer_oss_put_volume1_sw(snd_mixer_oss_file_t *fmixer, | |||
649 | up_read(&fmixer->card->controls_rwsem); | 649 | up_read(&fmixer->card->controls_rwsem); |
650 | return; | 650 | return; |
651 | } | 651 | } |
652 | uinfo = kcalloc(1, sizeof(*uinfo), GFP_KERNEL); | 652 | uinfo = kzalloc(sizeof(*uinfo), GFP_KERNEL); |
653 | uctl = kcalloc(1, sizeof(*uctl), GFP_KERNEL); | 653 | uctl = kzalloc(sizeof(*uctl), GFP_KERNEL); |
654 | if (uinfo == NULL || uctl == NULL) | 654 | if (uinfo == NULL || uctl == NULL) |
655 | goto __unalloc; | 655 | goto __unalloc; |
656 | snd_runtime_check(!kctl->info(kctl, uinfo), goto __unalloc); | 656 | snd_runtime_check(!kctl->info(kctl, uinfo), goto __unalloc); |
@@ -768,8 +768,8 @@ static int snd_mixer_oss_get_recsrc2(snd_mixer_oss_file_t *fmixer, unsigned int | |||
768 | snd_ctl_elem_value_t *uctl; | 768 | snd_ctl_elem_value_t *uctl; |
769 | int err, idx; | 769 | int err, idx; |
770 | 770 | ||
771 | uinfo = kcalloc(1, sizeof(*uinfo), GFP_KERNEL); | 771 | uinfo = kzalloc(sizeof(*uinfo), GFP_KERNEL); |
772 | uctl = kcalloc(1, sizeof(*uctl), GFP_KERNEL); | 772 | uctl = kzalloc(sizeof(*uctl), GFP_KERNEL); |
773 | if (uinfo == NULL || uctl == NULL) { | 773 | if (uinfo == NULL || uctl == NULL) { |
774 | err = -ENOMEM; | 774 | err = -ENOMEM; |
775 | goto __unlock; | 775 | goto __unlock; |
@@ -813,8 +813,8 @@ static int snd_mixer_oss_put_recsrc2(snd_mixer_oss_file_t *fmixer, unsigned int | |||
813 | int err; | 813 | int err; |
814 | unsigned int idx; | 814 | unsigned int idx; |
815 | 815 | ||
816 | uinfo = kcalloc(1, sizeof(*uinfo), GFP_KERNEL); | 816 | uinfo = kzalloc(sizeof(*uinfo), GFP_KERNEL); |
817 | uctl = kcalloc(1, sizeof(*uctl), GFP_KERNEL); | 817 | uctl = kzalloc(sizeof(*uctl), GFP_KERNEL); |
818 | if (uinfo == NULL || uctl == NULL) { | 818 | if (uinfo == NULL || uctl == NULL) { |
819 | err = -ENOMEM; | 819 | err = -ENOMEM; |
820 | goto __unlock; | 820 | goto __unlock; |
diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c index de7444c586f9..842c28b2ed55 100644 --- a/sound/core/oss/pcm_oss.c +++ b/sound/core/oss/pcm_oss.c | |||
@@ -850,7 +850,9 @@ static ssize_t snd_pcm_oss_write1(snd_pcm_substream_t *substream, const char __u | |||
850 | return xfer > 0 ? xfer : -EAGAIN; | 850 | return xfer > 0 ? xfer : -EAGAIN; |
851 | } | 851 | } |
852 | } else { | 852 | } else { |
853 | tmp = snd_pcm_oss_write2(substream, (const char *)buf, runtime->oss.period_bytes, 0); | 853 | tmp = snd_pcm_oss_write2(substream, |
854 | (const char __force *)buf, | ||
855 | runtime->oss.period_bytes, 0); | ||
854 | if (tmp <= 0) | 856 | if (tmp <= 0) |
855 | return xfer > 0 ? (snd_pcm_sframes_t)xfer : tmp; | 857 | return xfer > 0 ? (snd_pcm_sframes_t)xfer : tmp; |
856 | runtime->oss.bytes += tmp; | 858 | runtime->oss.bytes += tmp; |
@@ -926,7 +928,8 @@ static ssize_t snd_pcm_oss_read1(snd_pcm_substream_t *substream, char __user *bu | |||
926 | xfer += tmp; | 928 | xfer += tmp; |
927 | runtime->oss.buffer_used -= tmp; | 929 | runtime->oss.buffer_used -= tmp; |
928 | } else { | 930 | } else { |
929 | tmp = snd_pcm_oss_read2(substream, (char *)buf, runtime->oss.period_bytes, 0); | 931 | tmp = snd_pcm_oss_read2(substream, (char __force *)buf, |
932 | runtime->oss.period_bytes, 0); | ||
930 | if (tmp <= 0) | 933 | if (tmp <= 0) |
931 | return xfer > 0 ? (snd_pcm_sframes_t)xfer : tmp; | 934 | return xfer > 0 ? (snd_pcm_sframes_t)xfer : tmp; |
932 | runtime->oss.bytes += tmp; | 935 | runtime->oss.bytes += tmp; |
@@ -1540,7 +1543,11 @@ static int snd_pcm_oss_get_ptr(snd_pcm_oss_file_t *pcm_oss_file, int stream, str | |||
1540 | } else { | 1543 | } else { |
1541 | delay = snd_pcm_oss_bytes(substream, delay); | 1544 | delay = snd_pcm_oss_bytes(substream, delay); |
1542 | if (stream == SNDRV_PCM_STREAM_PLAYBACK) { | 1545 | if (stream == SNDRV_PCM_STREAM_PLAYBACK) { |
1543 | info.blocks = (runtime->oss.buffer_bytes - delay - fixup) / runtime->oss.period_bytes; | 1546 | snd_pcm_oss_setup_t *setup = substream->oss.setup; |
1547 | if (setup && setup->buggyptr) | ||
1548 | info.blocks = (runtime->oss.buffer_bytes - delay - fixup) / runtime->oss.period_bytes; | ||
1549 | else | ||
1550 | info.blocks = (delay + fixup) / runtime->oss.period_bytes; | ||
1544 | info.bytes = (runtime->oss.bytes - delay) & INT_MAX; | 1551 | info.bytes = (runtime->oss.bytes - delay) & INT_MAX; |
1545 | } else { | 1552 | } else { |
1546 | delay += fixup; | 1553 | delay += fixup; |
@@ -1705,13 +1712,12 @@ static int snd_pcm_oss_release_file(snd_pcm_oss_file_t *pcm_oss_file) | |||
1705 | if (snd_pcm_running(substream)) | 1712 | if (snd_pcm_running(substream)) |
1706 | snd_pcm_stop(substream, SNDRV_PCM_STATE_SETUP); | 1713 | snd_pcm_stop(substream, SNDRV_PCM_STATE_SETUP); |
1707 | snd_pcm_stream_unlock_irq(substream); | 1714 | snd_pcm_stream_unlock_irq(substream); |
1708 | if (substream->open_flag) { | 1715 | if (substream->ffile != NULL) { |
1709 | if (substream->ops->hw_free != NULL) | 1716 | if (substream->ops->hw_free != NULL) |
1710 | substream->ops->hw_free(substream); | 1717 | substream->ops->hw_free(substream); |
1711 | substream->ops->close(substream); | 1718 | substream->ops->close(substream); |
1712 | substream->open_flag = 0; | 1719 | substream->ffile = NULL; |
1713 | } | 1720 | } |
1714 | substream->ffile = NULL; | ||
1715 | snd_pcm_oss_release_substream(substream); | 1721 | snd_pcm_oss_release_substream(substream); |
1716 | snd_pcm_release_substream(substream); | 1722 | snd_pcm_release_substream(substream); |
1717 | } | 1723 | } |
@@ -1734,7 +1740,7 @@ static int snd_pcm_oss_open_file(struct file *file, | |||
1734 | snd_assert(rpcm_oss_file != NULL, return -EINVAL); | 1740 | snd_assert(rpcm_oss_file != NULL, return -EINVAL); |
1735 | *rpcm_oss_file = NULL; | 1741 | *rpcm_oss_file = NULL; |
1736 | 1742 | ||
1737 | pcm_oss_file = kcalloc(1, sizeof(*pcm_oss_file), GFP_KERNEL); | 1743 | pcm_oss_file = kzalloc(sizeof(*pcm_oss_file), GFP_KERNEL); |
1738 | if (pcm_oss_file == NULL) | 1744 | if (pcm_oss_file == NULL) |
1739 | return -ENOMEM; | 1745 | return -ENOMEM; |
1740 | 1746 | ||
@@ -1778,14 +1784,13 @@ static int snd_pcm_oss_open_file(struct file *file, | |||
1778 | snd_pcm_oss_release_file(pcm_oss_file); | 1784 | snd_pcm_oss_release_file(pcm_oss_file); |
1779 | return err; | 1785 | return err; |
1780 | } | 1786 | } |
1781 | psubstream->open_flag = 1; | 1787 | psubstream->ffile = file; |
1782 | err = snd_pcm_hw_constraints_complete(psubstream); | 1788 | err = snd_pcm_hw_constraints_complete(psubstream); |
1783 | if (err < 0) { | 1789 | if (err < 0) { |
1784 | snd_printd("snd_pcm_hw_constraint_complete failed\n"); | 1790 | snd_printd("snd_pcm_hw_constraint_complete failed\n"); |
1785 | snd_pcm_oss_release_file(pcm_oss_file); | 1791 | snd_pcm_oss_release_file(pcm_oss_file); |
1786 | return err; | 1792 | return err; |
1787 | } | 1793 | } |
1788 | psubstream->ffile = file; | ||
1789 | snd_pcm_oss_init_substream(psubstream, psetup, minor); | 1794 | snd_pcm_oss_init_substream(psubstream, psetup, minor); |
1790 | } | 1795 | } |
1791 | if (csubstream != NULL) { | 1796 | if (csubstream != NULL) { |
@@ -1800,14 +1805,13 @@ static int snd_pcm_oss_open_file(struct file *file, | |||
1800 | snd_pcm_oss_release_file(pcm_oss_file); | 1805 | snd_pcm_oss_release_file(pcm_oss_file); |
1801 | return err; | 1806 | return err; |
1802 | } | 1807 | } |
1803 | csubstream->open_flag = 1; | 1808 | csubstream->ffile = file; |
1804 | err = snd_pcm_hw_constraints_complete(csubstream); | 1809 | err = snd_pcm_hw_constraints_complete(csubstream); |
1805 | if (err < 0) { | 1810 | if (err < 0) { |
1806 | snd_printd("snd_pcm_hw_constraint_complete failed\n"); | 1811 | snd_printd("snd_pcm_hw_constraint_complete failed\n"); |
1807 | snd_pcm_oss_release_file(pcm_oss_file); | 1812 | snd_pcm_oss_release_file(pcm_oss_file); |
1808 | return err; | 1813 | return err; |
1809 | } | 1814 | } |
1810 | csubstream->ffile = file; | ||
1811 | snd_pcm_oss_init_substream(csubstream, csetup, minor); | 1815 | snd_pcm_oss_init_substream(csubstream, csetup, minor); |
1812 | } | 1816 | } |
1813 | 1817 | ||
@@ -2350,6 +2354,8 @@ static void snd_pcm_oss_proc_write(snd_info_entry_t *entry, | |||
2350 | template.partialfrag = 1; | 2354 | template.partialfrag = 1; |
2351 | } else if (!strcmp(str, "no-silence")) { | 2355 | } else if (!strcmp(str, "no-silence")) { |
2352 | template.nosilence = 1; | 2356 | template.nosilence = 1; |
2357 | } else if (!strcmp(str, "buggy-ptr")) { | ||
2358 | template.buggyptr = 1; | ||
2353 | } | 2359 | } |
2354 | } while (*str); | 2360 | } while (*str); |
2355 | if (setup == NULL) { | 2361 | if (setup == NULL) { |
diff --git a/sound/core/oss/pcm_plugin.c b/sound/core/oss/pcm_plugin.c index 6430410c6c04..fc23373c000d 100644 --- a/sound/core/oss/pcm_plugin.c +++ b/sound/core/oss/pcm_plugin.c | |||
@@ -171,7 +171,7 @@ int snd_pcm_plugin_build(snd_pcm_plug_t *plug, | |||
171 | 171 | ||
172 | snd_assert(plug != NULL, return -ENXIO); | 172 | snd_assert(plug != NULL, return -ENXIO); |
173 | snd_assert(src_format != NULL && dst_format != NULL, return -ENXIO); | 173 | snd_assert(src_format != NULL && dst_format != NULL, return -ENXIO); |
174 | plugin = kcalloc(1, sizeof(*plugin) + extra, GFP_KERNEL); | 174 | plugin = kzalloc(sizeof(*plugin) + extra, GFP_KERNEL); |
175 | if (plugin == NULL) | 175 | if (plugin == NULL) |
176 | return -ENOMEM; | 176 | return -ENOMEM; |
177 | plugin->name = name; | 177 | plugin->name = name; |
diff --git a/sound/core/pcm.c b/sound/core/pcm.c index 9f4c9209b271..1be470e942ef 100644 --- a/sound/core/pcm.c +++ b/sound/core/pcm.c | |||
@@ -597,7 +597,7 @@ int snd_pcm_new_stream(snd_pcm_t *pcm, int stream, int substream_count) | |||
597 | } | 597 | } |
598 | prev = NULL; | 598 | prev = NULL; |
599 | for (idx = 0, prev = NULL; idx < substream_count; idx++) { | 599 | for (idx = 0, prev = NULL; idx < substream_count; idx++) { |
600 | substream = kcalloc(1, sizeof(*substream), GFP_KERNEL); | 600 | substream = kzalloc(sizeof(*substream), GFP_KERNEL); |
601 | if (substream == NULL) | 601 | if (substream == NULL) |
602 | return -ENOMEM; | 602 | return -ENOMEM; |
603 | substream->pcm = pcm; | 603 | substream->pcm = pcm; |
@@ -657,7 +657,7 @@ int snd_pcm_new(snd_card_t * card, char *id, int device, | |||
657 | snd_assert(rpcm != NULL, return -EINVAL); | 657 | snd_assert(rpcm != NULL, return -EINVAL); |
658 | *rpcm = NULL; | 658 | *rpcm = NULL; |
659 | snd_assert(card != NULL, return -ENXIO); | 659 | snd_assert(card != NULL, return -ENXIO); |
660 | pcm = kcalloc(1, sizeof(*pcm), GFP_KERNEL); | 660 | pcm = kzalloc(sizeof(*pcm), GFP_KERNEL); |
661 | if (pcm == NULL) | 661 | if (pcm == NULL) |
662 | return -ENOMEM; | 662 | return -ENOMEM; |
663 | pcm->card = card; | 663 | pcm->card = card; |
@@ -795,7 +795,7 @@ int snd_pcm_open_substream(snd_pcm_t *pcm, int stream, | |||
795 | if (substream == NULL) | 795 | if (substream == NULL) |
796 | return -EAGAIN; | 796 | return -EAGAIN; |
797 | 797 | ||
798 | runtime = kcalloc(1, sizeof(*runtime), GFP_KERNEL); | 798 | runtime = kzalloc(sizeof(*runtime), GFP_KERNEL); |
799 | if (runtime == NULL) | 799 | if (runtime == NULL) |
800 | return -ENOMEM; | 800 | return -ENOMEM; |
801 | 801 | ||
diff --git a/sound/core/pcm_compat.c b/sound/core/pcm_compat.c index 3920bf0eebbf..4b6307df846d 100644 --- a/sound/core/pcm_compat.c +++ b/sound/core/pcm_compat.c | |||
@@ -103,10 +103,24 @@ struct sndrv_pcm_sw_params32 { | |||
103 | unsigned char reserved[64]; | 103 | unsigned char reserved[64]; |
104 | }; | 104 | }; |
105 | 105 | ||
106 | /* recalcuate the boundary within 32bit */ | ||
107 | static snd_pcm_uframes_t recalculate_boundary(snd_pcm_runtime_t *runtime) | ||
108 | { | ||
109 | snd_pcm_uframes_t boundary; | ||
110 | |||
111 | if (! runtime->buffer_size) | ||
112 | return 0; | ||
113 | boundary = runtime->buffer_size; | ||
114 | while (boundary * 2 <= 0x7fffffffUL - runtime->buffer_size) | ||
115 | boundary *= 2; | ||
116 | return boundary; | ||
117 | } | ||
118 | |||
106 | static int snd_pcm_ioctl_sw_params_compat(snd_pcm_substream_t *substream, | 119 | static int snd_pcm_ioctl_sw_params_compat(snd_pcm_substream_t *substream, |
107 | struct sndrv_pcm_sw_params32 __user *src) | 120 | struct sndrv_pcm_sw_params32 __user *src) |
108 | { | 121 | { |
109 | snd_pcm_sw_params_t params; | 122 | snd_pcm_sw_params_t params; |
123 | snd_pcm_uframes_t boundary; | ||
110 | int err; | 124 | int err; |
111 | 125 | ||
112 | memset(¶ms, 0, sizeof(params)); | 126 | memset(¶ms, 0, sizeof(params)); |
@@ -120,10 +134,17 @@ static int snd_pcm_ioctl_sw_params_compat(snd_pcm_substream_t *substream, | |||
120 | get_user(params.silence_threshold, &src->silence_threshold) || | 134 | get_user(params.silence_threshold, &src->silence_threshold) || |
121 | get_user(params.silence_size, &src->silence_size)) | 135 | get_user(params.silence_size, &src->silence_size)) |
122 | return -EFAULT; | 136 | return -EFAULT; |
137 | /* | ||
138 | * Check silent_size parameter. Since we have 64bit boundary, | ||
139 | * silence_size must be compared with the 32bit boundary. | ||
140 | */ | ||
141 | boundary = recalculate_boundary(substream->runtime); | ||
142 | if (boundary && params.silence_size >= boundary) | ||
143 | params.silence_size = substream->runtime->boundary; | ||
123 | err = snd_pcm_sw_params(substream, ¶ms); | 144 | err = snd_pcm_sw_params(substream, ¶ms); |
124 | if (err < 0) | 145 | if (err < 0) |
125 | return err; | 146 | return err; |
126 | if (put_user(params.boundary, &src->boundary)) | 147 | if (boundary && put_user(boundary, &src->boundary)) |
127 | return -EFAULT; | 148 | return -EFAULT; |
128 | return err; | 149 | return err; |
129 | } | 150 | } |
@@ -199,16 +220,6 @@ static int snd_pcm_status_user_compat(snd_pcm_substream_t *substream, | |||
199 | return err; | 220 | return err; |
200 | } | 221 | } |
201 | 222 | ||
202 | /* recalcuate the boundary within 32bit */ | ||
203 | static void recalculate_boundary(snd_pcm_runtime_t *runtime) | ||
204 | { | ||
205 | if (! runtime->buffer_size) | ||
206 | return; | ||
207 | runtime->boundary = runtime->buffer_size; | ||
208 | while (runtime->boundary * 2 <= 0x7fffffffUL - runtime->buffer_size) | ||
209 | runtime->boundary *= 2; | ||
210 | } | ||
211 | |||
212 | /* both for HW_PARAMS and HW_REFINE */ | 223 | /* both for HW_PARAMS and HW_REFINE */ |
213 | static int snd_pcm_ioctl_hw_params_compat(snd_pcm_substream_t *substream, | 224 | static int snd_pcm_ioctl_hw_params_compat(snd_pcm_substream_t *substream, |
214 | int refine, | 225 | int refine, |
@@ -241,8 +252,11 @@ static int snd_pcm_ioctl_hw_params_compat(snd_pcm_substream_t *substream, | |||
241 | goto error; | 252 | goto error; |
242 | } | 253 | } |
243 | 254 | ||
244 | if (! refine) | 255 | if (! refine) { |
245 | recalculate_boundary(runtime); | 256 | unsigned int new_boundary = recalculate_boundary(runtime); |
257 | if (new_boundary) | ||
258 | runtime->boundary = new_boundary; | ||
259 | } | ||
246 | error: | 260 | error: |
247 | kfree(data); | 261 | kfree(data); |
248 | return err; | 262 | return err; |
@@ -380,6 +394,7 @@ static int snd_pcm_ioctl_sync_ptr_compat(snd_pcm_substream_t *substream, | |||
380 | u32 sflags; | 394 | u32 sflags; |
381 | struct sndrv_pcm_mmap_control scontrol; | 395 | struct sndrv_pcm_mmap_control scontrol; |
382 | struct sndrv_pcm_mmap_status sstatus; | 396 | struct sndrv_pcm_mmap_status sstatus; |
397 | snd_pcm_uframes_t boundary; | ||
383 | int err; | 398 | int err; |
384 | 399 | ||
385 | snd_assert(runtime, return -EINVAL); | 400 | snd_assert(runtime, return -EINVAL); |
@@ -395,17 +410,21 @@ static int snd_pcm_ioctl_sync_ptr_compat(snd_pcm_substream_t *substream, | |||
395 | } | 410 | } |
396 | status = runtime->status; | 411 | status = runtime->status; |
397 | control = runtime->control; | 412 | control = runtime->control; |
413 | boundary = recalculate_boundary(runtime); | ||
414 | if (! boundary) | ||
415 | boundary = 0x7fffffff; | ||
398 | snd_pcm_stream_lock_irq(substream); | 416 | snd_pcm_stream_lock_irq(substream); |
417 | /* FIXME: we should consider the boundary for the sync from app */ | ||
399 | if (!(sflags & SNDRV_PCM_SYNC_PTR_APPL)) | 418 | if (!(sflags & SNDRV_PCM_SYNC_PTR_APPL)) |
400 | control->appl_ptr = scontrol.appl_ptr; | 419 | control->appl_ptr = scontrol.appl_ptr; |
401 | else | 420 | else |
402 | scontrol.appl_ptr = control->appl_ptr; | 421 | scontrol.appl_ptr = control->appl_ptr % boundary; |
403 | if (!(sflags & SNDRV_PCM_SYNC_PTR_AVAIL_MIN)) | 422 | if (!(sflags & SNDRV_PCM_SYNC_PTR_AVAIL_MIN)) |
404 | control->avail_min = scontrol.avail_min; | 423 | control->avail_min = scontrol.avail_min; |
405 | else | 424 | else |
406 | scontrol.avail_min = control->avail_min; | 425 | scontrol.avail_min = control->avail_min; |
407 | sstatus.state = status->state; | 426 | sstatus.state = status->state; |
408 | sstatus.hw_ptr = status->hw_ptr; | 427 | sstatus.hw_ptr = status->hw_ptr % boundary; |
409 | sstatus.tstamp = status->tstamp; | 428 | sstatus.tstamp = status->tstamp; |
410 | sstatus.suspended_state = status->suspended_state; | 429 | sstatus.suspended_state = status->suspended_state; |
411 | snd_pcm_stream_unlock_irq(substream); | 430 | snd_pcm_stream_unlock_irq(substream); |
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index c5bfd0918cff..0503980c23d9 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c | |||
@@ -524,6 +524,9 @@ void snd_interval_mul(const snd_interval_t *a, const snd_interval_t *b, snd_inte | |||
524 | 524 | ||
525 | /** | 525 | /** |
526 | * snd_interval_div - refine the interval value with division | 526 | * snd_interval_div - refine the interval value with division |
527 | * @a: dividend | ||
528 | * @b: divisor | ||
529 | * @c: quotient | ||
527 | * | 530 | * |
528 | * c = a / b | 531 | * c = a / b |
529 | * | 532 | * |
@@ -555,7 +558,11 @@ void snd_interval_div(const snd_interval_t *a, const snd_interval_t *b, snd_inte | |||
555 | 558 | ||
556 | /** | 559 | /** |
557 | * snd_interval_muldivk - refine the interval value | 560 | * snd_interval_muldivk - refine the interval value |
558 | * | 561 | * @a: dividend 1 |
562 | * @b: dividend 2 | ||
563 | * @k: divisor (as integer) | ||
564 | * @c: result | ||
565 | * | ||
559 | * c = a * b / k | 566 | * c = a * b / k |
560 | * | 567 | * |
561 | * Returns non-zero if the value is changed, zero if not changed. | 568 | * Returns non-zero if the value is changed, zero if not changed. |
@@ -582,6 +589,10 @@ void snd_interval_muldivk(const snd_interval_t *a, const snd_interval_t *b, | |||
582 | 589 | ||
583 | /** | 590 | /** |
584 | * snd_interval_mulkdiv - refine the interval value | 591 | * snd_interval_mulkdiv - refine the interval value |
592 | * @a: dividend 1 | ||
593 | * @k: dividend 2 (as integer) | ||
594 | * @b: divisor | ||
595 | * @c: result | ||
585 | * | 596 | * |
586 | * c = a * k / b | 597 | * c = a * k / b |
587 | * | 598 | * |
@@ -618,6 +629,11 @@ void snd_interval_mulkdiv(const snd_interval_t *a, unsigned int k, | |||
618 | 629 | ||
619 | /** | 630 | /** |
620 | * snd_interval_ratnum - refine the interval value | 631 | * snd_interval_ratnum - refine the interval value |
632 | * @i: interval to refine | ||
633 | * @rats_count: number of ratnum_t | ||
634 | * @rats: ratnum_t array | ||
635 | * @nump: pointer to store the resultant numerator | ||
636 | * @denp: pointer to store the resultant denominator | ||
621 | * | 637 | * |
622 | * Returns non-zero if the value is changed, zero if not changed. | 638 | * Returns non-zero if the value is changed, zero if not changed. |
623 | */ | 639 | */ |
@@ -715,6 +731,11 @@ int snd_interval_ratnum(snd_interval_t *i, | |||
715 | 731 | ||
716 | /** | 732 | /** |
717 | * snd_interval_ratden - refine the interval value | 733 | * snd_interval_ratden - refine the interval value |
734 | * @i: interval to refine | ||
735 | * @rats_count: number of ratden_t | ||
736 | * @rats: ratden_t array | ||
737 | * @nump: pointer to store the resultant numerator | ||
738 | * @denp: pointer to store the resultant denominator | ||
718 | * | 739 | * |
719 | * Returns non-zero if the value is changed, zero if not changed. | 740 | * Returns non-zero if the value is changed, zero if not changed. |
720 | */ | 741 | */ |
@@ -936,6 +957,11 @@ int snd_pcm_hw_rule_add(snd_pcm_runtime_t *runtime, unsigned int cond, | |||
936 | 957 | ||
937 | /** | 958 | /** |
938 | * snd_pcm_hw_constraint_mask | 959 | * snd_pcm_hw_constraint_mask |
960 | * @runtime: PCM runtime instance | ||
961 | * @var: hw_params variable to apply the mask | ||
962 | * @mask: the bitmap mask | ||
963 | * | ||
964 | * Apply the constraint of the given bitmap mask to a mask parameter. | ||
939 | */ | 965 | */ |
940 | int snd_pcm_hw_constraint_mask(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t var, | 966 | int snd_pcm_hw_constraint_mask(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t var, |
941 | u_int32_t mask) | 967 | u_int32_t mask) |
@@ -951,6 +977,11 @@ int snd_pcm_hw_constraint_mask(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t va | |||
951 | 977 | ||
952 | /** | 978 | /** |
953 | * snd_pcm_hw_constraint_mask64 | 979 | * snd_pcm_hw_constraint_mask64 |
980 | * @runtime: PCM runtime instance | ||
981 | * @var: hw_params variable to apply the mask | ||
982 | * @mask: the 64bit bitmap mask | ||
983 | * | ||
984 | * Apply the constraint of the given bitmap mask to a mask parameter. | ||
954 | */ | 985 | */ |
955 | int snd_pcm_hw_constraint_mask64(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t var, | 986 | int snd_pcm_hw_constraint_mask64(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t var, |
956 | u_int64_t mask) | 987 | u_int64_t mask) |
@@ -967,6 +998,10 @@ int snd_pcm_hw_constraint_mask64(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t | |||
967 | 998 | ||
968 | /** | 999 | /** |
969 | * snd_pcm_hw_constraint_integer | 1000 | * snd_pcm_hw_constraint_integer |
1001 | * @runtime: PCM runtime instance | ||
1002 | * @var: hw_params variable to apply the integer constraint | ||
1003 | * | ||
1004 | * Apply the constraint of integer to an interval parameter. | ||
970 | */ | 1005 | */ |
971 | int snd_pcm_hw_constraint_integer(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t var) | 1006 | int snd_pcm_hw_constraint_integer(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t var) |
972 | { | 1007 | { |
@@ -976,6 +1011,12 @@ int snd_pcm_hw_constraint_integer(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t | |||
976 | 1011 | ||
977 | /** | 1012 | /** |
978 | * snd_pcm_hw_constraint_minmax | 1013 | * snd_pcm_hw_constraint_minmax |
1014 | * @runtime: PCM runtime instance | ||
1015 | * @var: hw_params variable to apply the range | ||
1016 | * @min: the minimal value | ||
1017 | * @max: the maximal value | ||
1018 | * | ||
1019 | * Apply the min/max range constraint to an interval parameter. | ||
979 | */ | 1020 | */ |
980 | int snd_pcm_hw_constraint_minmax(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t var, | 1021 | int snd_pcm_hw_constraint_minmax(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t var, |
981 | unsigned int min, unsigned int max) | 1022 | unsigned int min, unsigned int max) |
@@ -999,6 +1040,12 @@ static int snd_pcm_hw_rule_list(snd_pcm_hw_params_t *params, | |||
999 | 1040 | ||
1000 | /** | 1041 | /** |
1001 | * snd_pcm_hw_constraint_list | 1042 | * snd_pcm_hw_constraint_list |
1043 | * @runtime: PCM runtime instance | ||
1044 | * @cond: condition bits | ||
1045 | * @var: hw_params variable to apply the list constraint | ||
1046 | * @l: list | ||
1047 | * | ||
1048 | * Apply the list of constraints to an interval parameter. | ||
1002 | */ | 1049 | */ |
1003 | int snd_pcm_hw_constraint_list(snd_pcm_runtime_t *runtime, | 1050 | int snd_pcm_hw_constraint_list(snd_pcm_runtime_t *runtime, |
1004 | unsigned int cond, | 1051 | unsigned int cond, |
@@ -1027,6 +1074,10 @@ static int snd_pcm_hw_rule_ratnums(snd_pcm_hw_params_t *params, | |||
1027 | 1074 | ||
1028 | /** | 1075 | /** |
1029 | * snd_pcm_hw_constraint_ratnums | 1076 | * snd_pcm_hw_constraint_ratnums |
1077 | * @runtime: PCM runtime instance | ||
1078 | * @cond: condition bits | ||
1079 | * @var: hw_params variable to apply the ratnums constraint | ||
1080 | * @r: ratnums_t constriants | ||
1030 | */ | 1081 | */ |
1031 | int snd_pcm_hw_constraint_ratnums(snd_pcm_runtime_t *runtime, | 1082 | int snd_pcm_hw_constraint_ratnums(snd_pcm_runtime_t *runtime, |
1032 | unsigned int cond, | 1083 | unsigned int cond, |
@@ -1054,6 +1105,10 @@ static int snd_pcm_hw_rule_ratdens(snd_pcm_hw_params_t *params, | |||
1054 | 1105 | ||
1055 | /** | 1106 | /** |
1056 | * snd_pcm_hw_constraint_ratdens | 1107 | * snd_pcm_hw_constraint_ratdens |
1108 | * @runtime: PCM runtime instance | ||
1109 | * @cond: condition bits | ||
1110 | * @var: hw_params variable to apply the ratdens constraint | ||
1111 | * @r: ratdens_t constriants | ||
1057 | */ | 1112 | */ |
1058 | int snd_pcm_hw_constraint_ratdens(snd_pcm_runtime_t *runtime, | 1113 | int snd_pcm_hw_constraint_ratdens(snd_pcm_runtime_t *runtime, |
1059 | unsigned int cond, | 1114 | unsigned int cond, |
@@ -1079,6 +1134,10 @@ static int snd_pcm_hw_rule_msbits(snd_pcm_hw_params_t *params, | |||
1079 | 1134 | ||
1080 | /** | 1135 | /** |
1081 | * snd_pcm_hw_constraint_msbits | 1136 | * snd_pcm_hw_constraint_msbits |
1137 | * @runtime: PCM runtime instance | ||
1138 | * @cond: condition bits | ||
1139 | * @width: sample bits width | ||
1140 | * @msbits: msbits width | ||
1082 | */ | 1141 | */ |
1083 | int snd_pcm_hw_constraint_msbits(snd_pcm_runtime_t *runtime, | 1142 | int snd_pcm_hw_constraint_msbits(snd_pcm_runtime_t *runtime, |
1084 | unsigned int cond, | 1143 | unsigned int cond, |
@@ -1101,6 +1160,10 @@ static int snd_pcm_hw_rule_step(snd_pcm_hw_params_t *params, | |||
1101 | 1160 | ||
1102 | /** | 1161 | /** |
1103 | * snd_pcm_hw_constraint_step | 1162 | * snd_pcm_hw_constraint_step |
1163 | * @runtime: PCM runtime instance | ||
1164 | * @cond: condition bits | ||
1165 | * @var: hw_params variable to apply the step constraint | ||
1166 | * @step: step size | ||
1104 | */ | 1167 | */ |
1105 | int snd_pcm_hw_constraint_step(snd_pcm_runtime_t *runtime, | 1168 | int snd_pcm_hw_constraint_step(snd_pcm_runtime_t *runtime, |
1106 | unsigned int cond, | 1169 | unsigned int cond, |
@@ -1126,6 +1189,9 @@ static int snd_pcm_hw_rule_pow2(snd_pcm_hw_params_t *params, snd_pcm_hw_rule_t * | |||
1126 | 1189 | ||
1127 | /** | 1190 | /** |
1128 | * snd_pcm_hw_constraint_pow2 | 1191 | * snd_pcm_hw_constraint_pow2 |
1192 | * @runtime: PCM runtime instance | ||
1193 | * @cond: condition bits | ||
1194 | * @var: hw_params variable to apply the power-of-2 constraint | ||
1129 | */ | 1195 | */ |
1130 | int snd_pcm_hw_constraint_pow2(snd_pcm_runtime_t *runtime, | 1196 | int snd_pcm_hw_constraint_pow2(snd_pcm_runtime_t *runtime, |
1131 | unsigned int cond, | 1197 | unsigned int cond, |
@@ -1162,7 +1228,7 @@ static void _snd_pcm_hw_param_any(snd_pcm_hw_params_t *params, | |||
1162 | } | 1228 | } |
1163 | 1229 | ||
1164 | #if 0 | 1230 | #if 0 |
1165 | /** | 1231 | /* |
1166 | * snd_pcm_hw_param_any | 1232 | * snd_pcm_hw_param_any |
1167 | */ | 1233 | */ |
1168 | int snd_pcm_hw_param_any(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, | 1234 | int snd_pcm_hw_param_any(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, |
@@ -1185,7 +1251,7 @@ void _snd_pcm_hw_params_any(snd_pcm_hw_params_t *params) | |||
1185 | } | 1251 | } |
1186 | 1252 | ||
1187 | #if 0 | 1253 | #if 0 |
1188 | /** | 1254 | /* |
1189 | * snd_pcm_hw_params_any | 1255 | * snd_pcm_hw_params_any |
1190 | * | 1256 | * |
1191 | * Fill PARAMS with full configuration space boundaries | 1257 | * Fill PARAMS with full configuration space boundaries |
@@ -1199,6 +1265,9 @@ int snd_pcm_hw_params_any(snd_pcm_t *pcm, snd_pcm_hw_params_t *params) | |||
1199 | 1265 | ||
1200 | /** | 1266 | /** |
1201 | * snd_pcm_hw_param_value | 1267 | * snd_pcm_hw_param_value |
1268 | * @params: the hw_params instance | ||
1269 | * @var: parameter to retrieve | ||
1270 | * @dir: pointer to the direction (-1,0,1) or NULL | ||
1202 | * | 1271 | * |
1203 | * Return the value for field PAR if it's fixed in configuration space | 1272 | * Return the value for field PAR if it's fixed in configuration space |
1204 | * defined by PARAMS. Return -EINVAL otherwise | 1273 | * defined by PARAMS. Return -EINVAL otherwise |
@@ -1228,6 +1297,9 @@ static int snd_pcm_hw_param_value(const snd_pcm_hw_params_t *params, | |||
1228 | 1297 | ||
1229 | /** | 1298 | /** |
1230 | * snd_pcm_hw_param_value_min | 1299 | * snd_pcm_hw_param_value_min |
1300 | * @params: the hw_params instance | ||
1301 | * @var: parameter to retrieve | ||
1302 | * @dir: pointer to the direction (-1,0,1) or NULL | ||
1231 | * | 1303 | * |
1232 | * Return the minimum value for field PAR. | 1304 | * Return the minimum value for field PAR. |
1233 | */ | 1305 | */ |
@@ -1251,6 +1323,9 @@ unsigned int snd_pcm_hw_param_value_min(const snd_pcm_hw_params_t *params, | |||
1251 | 1323 | ||
1252 | /** | 1324 | /** |
1253 | * snd_pcm_hw_param_value_max | 1325 | * snd_pcm_hw_param_value_max |
1326 | * @params: the hw_params instance | ||
1327 | * @var: parameter to retrieve | ||
1328 | * @dir: pointer to the direction (-1,0,1) or NULL | ||
1254 | * | 1329 | * |
1255 | * Return the maximum value for field PAR. | 1330 | * Return the maximum value for field PAR. |
1256 | */ | 1331 | */ |
@@ -1302,7 +1377,7 @@ int _snd_pcm_hw_param_setinteger(snd_pcm_hw_params_t *params, | |||
1302 | } | 1377 | } |
1303 | 1378 | ||
1304 | #if 0 | 1379 | #if 0 |
1305 | /** | 1380 | /* |
1306 | * snd_pcm_hw_param_setinteger | 1381 | * snd_pcm_hw_param_setinteger |
1307 | * | 1382 | * |
1308 | * Inside configuration space defined by PARAMS remove from PAR all | 1383 | * Inside configuration space defined by PARAMS remove from PAR all |
@@ -1347,6 +1422,10 @@ static int _snd_pcm_hw_param_first(snd_pcm_hw_params_t *params, | |||
1347 | 1422 | ||
1348 | /** | 1423 | /** |
1349 | * snd_pcm_hw_param_first | 1424 | * snd_pcm_hw_param_first |
1425 | * @pcm: PCM instance | ||
1426 | * @params: the hw_params instance | ||
1427 | * @var: parameter to retrieve | ||
1428 | * @dir: pointer to the direction (-1,0,1) or NULL | ||
1350 | * | 1429 | * |
1351 | * Inside configuration space defined by PARAMS remove from PAR all | 1430 | * Inside configuration space defined by PARAMS remove from PAR all |
1352 | * values > minimum. Reduce configuration space accordingly. | 1431 | * values > minimum. Reduce configuration space accordingly. |
@@ -1388,6 +1467,10 @@ static int _snd_pcm_hw_param_last(snd_pcm_hw_params_t *params, | |||
1388 | 1467 | ||
1389 | /** | 1468 | /** |
1390 | * snd_pcm_hw_param_last | 1469 | * snd_pcm_hw_param_last |
1470 | * @pcm: PCM instance | ||
1471 | * @params: the hw_params instance | ||
1472 | * @var: parameter to retrieve | ||
1473 | * @dir: pointer to the direction (-1,0,1) or NULL | ||
1391 | * | 1474 | * |
1392 | * Inside configuration space defined by PARAMS remove from PAR all | 1475 | * Inside configuration space defined by PARAMS remove from PAR all |
1393 | * values < maximum. Reduce configuration space accordingly. | 1476 | * values < maximum. Reduce configuration space accordingly. |
@@ -1439,6 +1522,11 @@ int _snd_pcm_hw_param_min(snd_pcm_hw_params_t *params, | |||
1439 | 1522 | ||
1440 | /** | 1523 | /** |
1441 | * snd_pcm_hw_param_min | 1524 | * snd_pcm_hw_param_min |
1525 | * @pcm: PCM instance | ||
1526 | * @params: the hw_params instance | ||
1527 | * @var: parameter to retrieve | ||
1528 | * @val: minimal value | ||
1529 | * @dir: pointer to the direction (-1,0,1) or NULL | ||
1442 | * | 1530 | * |
1443 | * Inside configuration space defined by PARAMS remove from PAR all | 1531 | * Inside configuration space defined by PARAMS remove from PAR all |
1444 | * values < VAL. Reduce configuration space accordingly. | 1532 | * values < VAL. Reduce configuration space accordingly. |
@@ -1494,6 +1582,11 @@ static int _snd_pcm_hw_param_max(snd_pcm_hw_params_t *params, | |||
1494 | 1582 | ||
1495 | /** | 1583 | /** |
1496 | * snd_pcm_hw_param_max | 1584 | * snd_pcm_hw_param_max |
1585 | * @pcm: PCM instance | ||
1586 | * @params: the hw_params instance | ||
1587 | * @var: parameter to retrieve | ||
1588 | * @val: maximal value | ||
1589 | * @dir: pointer to the direction (-1,0,1) or NULL | ||
1497 | * | 1590 | * |
1498 | * Inside configuration space defined by PARAMS remove from PAR all | 1591 | * Inside configuration space defined by PARAMS remove from PAR all |
1499 | * values >= VAL + 1. Reduce configuration space accordingly. | 1592 | * values >= VAL + 1. Reduce configuration space accordingly. |
@@ -1565,6 +1658,11 @@ int _snd_pcm_hw_param_set(snd_pcm_hw_params_t *params, | |||
1565 | 1658 | ||
1566 | /** | 1659 | /** |
1567 | * snd_pcm_hw_param_set | 1660 | * snd_pcm_hw_param_set |
1661 | * @pcm: PCM instance | ||
1662 | * @params: the hw_params instance | ||
1663 | * @var: parameter to retrieve | ||
1664 | * @val: value to set | ||
1665 | * @dir: pointer to the direction (-1,0,1) or NULL | ||
1568 | * | 1666 | * |
1569 | * Inside configuration space defined by PARAMS remove from PAR all | 1667 | * Inside configuration space defined by PARAMS remove from PAR all |
1570 | * values != VAL. Reduce configuration space accordingly. | 1668 | * values != VAL. Reduce configuration space accordingly. |
@@ -1584,8 +1682,8 @@ int snd_pcm_hw_param_set(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, | |||
1584 | return snd_pcm_hw_param_value(params, var, NULL); | 1682 | return snd_pcm_hw_param_value(params, var, NULL); |
1585 | } | 1683 | } |
1586 | 1684 | ||
1587 | int _snd_pcm_hw_param_mask(snd_pcm_hw_params_t *params, | 1685 | static int _snd_pcm_hw_param_mask(snd_pcm_hw_params_t *params, |
1588 | snd_pcm_hw_param_t var, const snd_mask_t *val) | 1686 | snd_pcm_hw_param_t var, const snd_mask_t *val) |
1589 | { | 1687 | { |
1590 | int changed; | 1688 | int changed; |
1591 | assert(hw_is_mask(var)); | 1689 | assert(hw_is_mask(var)); |
@@ -1599,6 +1697,10 @@ int _snd_pcm_hw_param_mask(snd_pcm_hw_params_t *params, | |||
1599 | 1697 | ||
1600 | /** | 1698 | /** |
1601 | * snd_pcm_hw_param_mask | 1699 | * snd_pcm_hw_param_mask |
1700 | * @pcm: PCM instance | ||
1701 | * @params: the hw_params instance | ||
1702 | * @var: parameter to retrieve | ||
1703 | * @val: mask to apply | ||
1602 | * | 1704 | * |
1603 | * Inside configuration space defined by PARAMS remove from PAR all values | 1705 | * Inside configuration space defined by PARAMS remove from PAR all values |
1604 | * not contained in MASK. Reduce configuration space accordingly. | 1706 | * not contained in MASK. Reduce configuration space accordingly. |
@@ -1671,6 +1773,11 @@ static int boundary_nearer(int min, int mindir, | |||
1671 | 1773 | ||
1672 | /** | 1774 | /** |
1673 | * snd_pcm_hw_param_near | 1775 | * snd_pcm_hw_param_near |
1776 | * @pcm: PCM instance | ||
1777 | * @params: the hw_params instance | ||
1778 | * @var: parameter to retrieve | ||
1779 | * @best: value to set | ||
1780 | * @dir: pointer to the direction (-1,0,1) or NULL | ||
1674 | * | 1781 | * |
1675 | * Inside configuration space defined by PARAMS set PAR to the available value | 1782 | * Inside configuration space defined by PARAMS set PAR to the available value |
1676 | * nearest to VAL. Reduce configuration space accordingly. | 1783 | * nearest to VAL. Reduce configuration space accordingly. |
@@ -1747,6 +1854,8 @@ int snd_pcm_hw_param_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, | |||
1747 | 1854 | ||
1748 | /** | 1855 | /** |
1749 | * snd_pcm_hw_param_choose | 1856 | * snd_pcm_hw_param_choose |
1857 | * @pcm: PCM instance | ||
1858 | * @params: the hw_params instance | ||
1750 | * | 1859 | * |
1751 | * Choose one configuration from configuration space defined by PARAMS | 1860 | * Choose one configuration from configuration space defined by PARAMS |
1752 | * The configuration chosen is that obtained fixing in this order: | 1861 | * The configuration chosen is that obtained fixing in this order: |
@@ -2063,7 +2172,7 @@ static snd_pcm_sframes_t snd_pcm_lib_write1(snd_pcm_substream_t *substream, | |||
2063 | if (((avail < runtime->control->avail_min && size > avail) || | 2172 | if (((avail < runtime->control->avail_min && size > avail) || |
2064 | (size >= runtime->xfer_align && avail < runtime->xfer_align))) { | 2173 | (size >= runtime->xfer_align && avail < runtime->xfer_align))) { |
2065 | wait_queue_t wait; | 2174 | wait_queue_t wait; |
2066 | enum { READY, SIGNALED, ERROR, SUSPENDED, EXPIRED } state; | 2175 | enum { READY, SIGNALED, ERROR, SUSPENDED, EXPIRED, DROPPED } state; |
2067 | long tout; | 2176 | long tout; |
2068 | 2177 | ||
2069 | if (nonblock) { | 2178 | if (nonblock) { |
@@ -2097,6 +2206,9 @@ static snd_pcm_sframes_t snd_pcm_lib_write1(snd_pcm_substream_t *substream, | |||
2097 | case SNDRV_PCM_STATE_SUSPENDED: | 2206 | case SNDRV_PCM_STATE_SUSPENDED: |
2098 | state = SUSPENDED; | 2207 | state = SUSPENDED; |
2099 | goto _end_loop; | 2208 | goto _end_loop; |
2209 | case SNDRV_PCM_STATE_SETUP: | ||
2210 | state = DROPPED; | ||
2211 | goto _end_loop; | ||
2100 | default: | 2212 | default: |
2101 | break; | 2213 | break; |
2102 | } | 2214 | } |
@@ -2123,6 +2235,9 @@ static snd_pcm_sframes_t snd_pcm_lib_write1(snd_pcm_substream_t *substream, | |||
2123 | snd_printd("playback write error (DMA or IRQ trouble?)\n"); | 2235 | snd_printd("playback write error (DMA or IRQ trouble?)\n"); |
2124 | err = -EIO; | 2236 | err = -EIO; |
2125 | goto _end_unlock; | 2237 | goto _end_unlock; |
2238 | case DROPPED: | ||
2239 | err = -EBADFD; | ||
2240 | goto _end_unlock; | ||
2126 | default: | 2241 | default: |
2127 | break; | 2242 | break; |
2128 | } | 2243 | } |
@@ -2359,7 +2474,7 @@ static snd_pcm_sframes_t snd_pcm_lib_read1(snd_pcm_substream_t *substream, | |||
2359 | } else if ((avail < runtime->control->avail_min && size > avail) || | 2474 | } else if ((avail < runtime->control->avail_min && size > avail) || |
2360 | (size >= runtime->xfer_align && avail < runtime->xfer_align)) { | 2475 | (size >= runtime->xfer_align && avail < runtime->xfer_align)) { |
2361 | wait_queue_t wait; | 2476 | wait_queue_t wait; |
2362 | enum { READY, SIGNALED, ERROR, SUSPENDED, EXPIRED } state; | 2477 | enum { READY, SIGNALED, ERROR, SUSPENDED, EXPIRED, DROPPED } state; |
2363 | long tout; | 2478 | long tout; |
2364 | 2479 | ||
2365 | if (nonblock) { | 2480 | if (nonblock) { |
@@ -2394,6 +2509,9 @@ static snd_pcm_sframes_t snd_pcm_lib_read1(snd_pcm_substream_t *substream, | |||
2394 | goto _end_loop; | 2509 | goto _end_loop; |
2395 | case SNDRV_PCM_STATE_DRAINING: | 2510 | case SNDRV_PCM_STATE_DRAINING: |
2396 | goto __draining; | 2511 | goto __draining; |
2512 | case SNDRV_PCM_STATE_SETUP: | ||
2513 | state = DROPPED; | ||
2514 | goto _end_loop; | ||
2397 | default: | 2515 | default: |
2398 | break; | 2516 | break; |
2399 | } | 2517 | } |
@@ -2420,6 +2538,9 @@ static snd_pcm_sframes_t snd_pcm_lib_read1(snd_pcm_substream_t *substream, | |||
2420 | snd_printd("capture read error (DMA or IRQ trouble?)\n"); | 2538 | snd_printd("capture read error (DMA or IRQ trouble?)\n"); |
2421 | err = -EIO; | 2539 | err = -EIO; |
2422 | goto _end_unlock; | 2540 | goto _end_unlock; |
2541 | case DROPPED: | ||
2542 | err = -EBADFD; | ||
2543 | goto _end_unlock; | ||
2423 | default: | 2544 | default: |
2424 | break; | 2545 | break; |
2425 | } | 2546 | } |
diff --git a/sound/core/pcm_memory.c b/sound/core/pcm_memory.c index 9a174fb96565..b3f5344f60be 100644 --- a/sound/core/pcm_memory.c +++ b/sound/core/pcm_memory.c | |||
@@ -244,7 +244,7 @@ int snd_pcm_lib_preallocate_pages(snd_pcm_substream_t *substream, | |||
244 | 244 | ||
245 | /** | 245 | /** |
246 | * snd_pcm_lib_preallocate_pages_for_all - pre-allocation for continous memory type (all substreams) | 246 | * snd_pcm_lib_preallocate_pages_for_all - pre-allocation for continous memory type (all substreams) |
247 | * @substream: the pcm substream instance | 247 | * @pcm: the pcm instance |
248 | * @type: DMA type (SNDRV_DMA_TYPE_*) | 248 | * @type: DMA type (SNDRV_DMA_TYPE_*) |
249 | * @data: DMA type dependant data | 249 | * @data: DMA type dependant data |
250 | * @size: the requested pre-allocation size in bytes | 250 | * @size: the requested pre-allocation size in bytes |
@@ -321,7 +321,7 @@ int snd_pcm_lib_malloc_pages(snd_pcm_substream_t *substream, size_t size) | |||
321 | if (substream->dma_buffer.area != NULL && substream->dma_buffer.bytes >= size) { | 321 | if (substream->dma_buffer.area != NULL && substream->dma_buffer.bytes >= size) { |
322 | dmab = &substream->dma_buffer; /* use the pre-allocated buffer */ | 322 | dmab = &substream->dma_buffer; /* use the pre-allocated buffer */ |
323 | } else { | 323 | } else { |
324 | dmab = kcalloc(1, sizeof(*dmab), GFP_KERNEL); | 324 | dmab = kzalloc(sizeof(*dmab), GFP_KERNEL); |
325 | if (! dmab) | 325 | if (! dmab) |
326 | return -ENOMEM; | 326 | return -ENOMEM; |
327 | dmab->dev = substream->dma_buffer.dev; | 327 | dmab->dev = substream->dma_buffer.dev; |
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index 10c2c9832649..e97b2d162cc7 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c | |||
@@ -859,6 +859,7 @@ static struct action_ops snd_pcm_action_start = { | |||
859 | 859 | ||
860 | /** | 860 | /** |
861 | * snd_pcm_start | 861 | * snd_pcm_start |
862 | * @substream: the PCM substream instance | ||
862 | * | 863 | * |
863 | * Start all linked streams. | 864 | * Start all linked streams. |
864 | */ | 865 | */ |
@@ -908,6 +909,8 @@ static struct action_ops snd_pcm_action_stop = { | |||
908 | 909 | ||
909 | /** | 910 | /** |
910 | * snd_pcm_stop | 911 | * snd_pcm_stop |
912 | * @substream: the PCM substream instance | ||
913 | * @state: PCM state after stopping the stream | ||
911 | * | 914 | * |
912 | * Try to stop all running streams in the substream group. | 915 | * Try to stop all running streams in the substream group. |
913 | * The state of each stream is changed to the given value after that unconditionally. | 916 | * The state of each stream is changed to the given value after that unconditionally. |
@@ -919,6 +922,7 @@ int snd_pcm_stop(snd_pcm_substream_t *substream, int state) | |||
919 | 922 | ||
920 | /** | 923 | /** |
921 | * snd_pcm_drain_done | 924 | * snd_pcm_drain_done |
925 | * @substream: the PCM substream | ||
922 | * | 926 | * |
923 | * Stop the DMA only when the given stream is playback. | 927 | * Stop the DMA only when the given stream is playback. |
924 | * The state is changed to SETUP. | 928 | * The state is changed to SETUP. |
@@ -1025,7 +1029,7 @@ static void snd_pcm_post_suspend(snd_pcm_substream_t *substream, int state) | |||
1025 | snd_pcm_runtime_t *runtime = substream->runtime; | 1029 | snd_pcm_runtime_t *runtime = substream->runtime; |
1026 | snd_pcm_trigger_tstamp(substream); | 1030 | snd_pcm_trigger_tstamp(substream); |
1027 | if (substream->timer) | 1031 | if (substream->timer) |
1028 | snd_timer_notify(substream->timer, SNDRV_TIMER_EVENT_MPAUSE, &runtime->trigger_tstamp); | 1032 | snd_timer_notify(substream->timer, SNDRV_TIMER_EVENT_MSUSPEND, &runtime->trigger_tstamp); |
1029 | runtime->status->suspended_state = runtime->status->state; | 1033 | runtime->status->suspended_state = runtime->status->state; |
1030 | runtime->status->state = SNDRV_PCM_STATE_SUSPENDED; | 1034 | runtime->status->state = SNDRV_PCM_STATE_SUSPENDED; |
1031 | snd_pcm_tick_set(substream, 0); | 1035 | snd_pcm_tick_set(substream, 0); |
@@ -1040,6 +1044,7 @@ static struct action_ops snd_pcm_action_suspend = { | |||
1040 | 1044 | ||
1041 | /** | 1045 | /** |
1042 | * snd_pcm_suspend | 1046 | * snd_pcm_suspend |
1047 | * @substream: the PCM substream | ||
1043 | * | 1048 | * |
1044 | * Trigger SUSPEND to all linked streams. | 1049 | * Trigger SUSPEND to all linked streams. |
1045 | * After this call, all streams are changed to SUSPENDED state. | 1050 | * After this call, all streams are changed to SUSPENDED state. |
@@ -1057,6 +1062,7 @@ int snd_pcm_suspend(snd_pcm_substream_t *substream) | |||
1057 | 1062 | ||
1058 | /** | 1063 | /** |
1059 | * snd_pcm_suspend_all | 1064 | * snd_pcm_suspend_all |
1065 | * @pcm: the PCM instance | ||
1060 | * | 1066 | * |
1061 | * Trigger SUSPEND to all substreams in the given pcm. | 1067 | * Trigger SUSPEND to all substreams in the given pcm. |
1062 | * After this call, all streams are changed to SUSPENDED state. | 1068 | * After this call, all streams are changed to SUSPENDED state. |
@@ -1115,7 +1121,7 @@ static void snd_pcm_post_resume(snd_pcm_substream_t *substream, int state) | |||
1115 | snd_pcm_runtime_t *runtime = substream->runtime; | 1121 | snd_pcm_runtime_t *runtime = substream->runtime; |
1116 | snd_pcm_trigger_tstamp(substream); | 1122 | snd_pcm_trigger_tstamp(substream); |
1117 | if (substream->timer) | 1123 | if (substream->timer) |
1118 | snd_timer_notify(substream->timer, SNDRV_TIMER_EVENT_MCONTINUE, &runtime->trigger_tstamp); | 1124 | snd_timer_notify(substream->timer, SNDRV_TIMER_EVENT_MRESUME, &runtime->trigger_tstamp); |
1119 | runtime->status->state = runtime->status->suspended_state; | 1125 | runtime->status->state = runtime->status->suspended_state; |
1120 | if (runtime->sleep_min) | 1126 | if (runtime->sleep_min) |
1121 | snd_pcm_tick_prepare(substream); | 1127 | snd_pcm_tick_prepare(substream); |
@@ -1272,6 +1278,9 @@ static struct action_ops snd_pcm_action_prepare = { | |||
1272 | 1278 | ||
1273 | /** | 1279 | /** |
1274 | * snd_pcm_prepare | 1280 | * snd_pcm_prepare |
1281 | * @substream: the PCM substream instance | ||
1282 | * | ||
1283 | * Prepare the PCM substream to be triggerable. | ||
1275 | */ | 1284 | */ |
1276 | int snd_pcm_prepare(snd_pcm_substream_t *substream) | 1285 | int snd_pcm_prepare(snd_pcm_substream_t *substream) |
1277 | { | 1286 | { |
@@ -1967,13 +1976,12 @@ static int snd_pcm_release_file(snd_pcm_file_t * pcm_file) | |||
1967 | runtime = substream->runtime; | 1976 | runtime = substream->runtime; |
1968 | str = substream->pstr; | 1977 | str = substream->pstr; |
1969 | snd_pcm_unlink(substream); | 1978 | snd_pcm_unlink(substream); |
1970 | if (substream->open_flag) { | 1979 | if (substream->ffile != NULL) { |
1971 | if (substream->ops->hw_free != NULL) | 1980 | if (substream->ops->hw_free != NULL) |
1972 | substream->ops->hw_free(substream); | 1981 | substream->ops->hw_free(substream); |
1973 | substream->ops->close(substream); | 1982 | substream->ops->close(substream); |
1974 | substream->open_flag = 0; | 1983 | substream->ffile = NULL; |
1975 | } | 1984 | } |
1976 | substream->ffile = NULL; | ||
1977 | snd_pcm_remove_file(str, pcm_file); | 1985 | snd_pcm_remove_file(str, pcm_file); |
1978 | snd_pcm_release_substream(substream); | 1986 | snd_pcm_release_substream(substream); |
1979 | kfree(pcm_file); | 1987 | kfree(pcm_file); |
@@ -1993,7 +2001,7 @@ static int snd_pcm_open_file(struct file *file, | |||
1993 | snd_assert(rpcm_file != NULL, return -EINVAL); | 2001 | snd_assert(rpcm_file != NULL, return -EINVAL); |
1994 | *rpcm_file = NULL; | 2002 | *rpcm_file = NULL; |
1995 | 2003 | ||
1996 | pcm_file = kcalloc(1, sizeof(*pcm_file), GFP_KERNEL); | 2004 | pcm_file = kzalloc(sizeof(*pcm_file), GFP_KERNEL); |
1997 | if (pcm_file == NULL) { | 2005 | if (pcm_file == NULL) { |
1998 | return -ENOMEM; | 2006 | return -ENOMEM; |
1999 | } | 2007 | } |
@@ -2022,18 +2030,15 @@ static int snd_pcm_open_file(struct file *file, | |||
2022 | snd_pcm_release_file(pcm_file); | 2030 | snd_pcm_release_file(pcm_file); |
2023 | return err; | 2031 | return err; |
2024 | } | 2032 | } |
2025 | substream->open_flag = 1; | 2033 | substream->ffile = file; |
2026 | 2034 | ||
2027 | err = snd_pcm_hw_constraints_complete(substream); | 2035 | err = snd_pcm_hw_constraints_complete(substream); |
2028 | if (err < 0) { | 2036 | if (err < 0) { |
2029 | snd_printd("snd_pcm_hw_constraints_complete failed\n"); | 2037 | snd_printd("snd_pcm_hw_constraints_complete failed\n"); |
2030 | substream->ops->close(substream); | ||
2031 | snd_pcm_release_file(pcm_file); | 2038 | snd_pcm_release_file(pcm_file); |
2032 | return err; | 2039 | return err; |
2033 | } | 2040 | } |
2034 | 2041 | ||
2035 | substream->ffile = file; | ||
2036 | |||
2037 | file->private_data = pcm_file; | 2042 | file->private_data = pcm_file; |
2038 | *rpcm_file = pcm_file; | 2043 | *rpcm_file = pcm_file; |
2039 | return 0; | 2044 | return 0; |
@@ -2944,8 +2949,7 @@ static struct page * snd_pcm_mmap_status_nopage(struct vm_area_struct *area, uns | |||
2944 | return NOPAGE_OOM; | 2949 | return NOPAGE_OOM; |
2945 | runtime = substream->runtime; | 2950 | runtime = substream->runtime; |
2946 | page = virt_to_page(runtime->status); | 2951 | page = virt_to_page(runtime->status); |
2947 | if (!PageReserved(page)) | 2952 | get_page(page); |
2948 | get_page(page); | ||
2949 | if (type) | 2953 | if (type) |
2950 | *type = VM_FAULT_MINOR; | 2954 | *type = VM_FAULT_MINOR; |
2951 | return page; | 2955 | return page; |
@@ -2987,8 +2991,7 @@ static struct page * snd_pcm_mmap_control_nopage(struct vm_area_struct *area, un | |||
2987 | return NOPAGE_OOM; | 2991 | return NOPAGE_OOM; |
2988 | runtime = substream->runtime; | 2992 | runtime = substream->runtime; |
2989 | page = virt_to_page(runtime->control); | 2993 | page = virt_to_page(runtime->control); |
2990 | if (!PageReserved(page)) | 2994 | get_page(page); |
2991 | get_page(page); | ||
2992 | if (type) | 2995 | if (type) |
2993 | *type = VM_FAULT_MINOR; | 2996 | *type = VM_FAULT_MINOR; |
2994 | return page; | 2997 | return page; |
@@ -3061,8 +3064,7 @@ static struct page *snd_pcm_mmap_data_nopage(struct vm_area_struct *area, unsign | |||
3061 | vaddr = runtime->dma_area + offset; | 3064 | vaddr = runtime->dma_area + offset; |
3062 | page = virt_to_page(vaddr); | 3065 | page = virt_to_page(vaddr); |
3063 | } | 3066 | } |
3064 | if (!PageReserved(page)) | 3067 | get_page(page); |
3065 | get_page(page); | ||
3066 | if (type) | 3068 | if (type) |
3067 | *type = VM_FAULT_MINOR; | 3069 | *type = VM_FAULT_MINOR; |
3068 | return page; | 3070 | return page; |
diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c index edba4118271c..7c20eafecb8a 100644 --- a/sound/core/rawmidi.c +++ b/sound/core/rawmidi.c | |||
@@ -101,7 +101,7 @@ static int snd_rawmidi_runtime_create(snd_rawmidi_substream_t * substream) | |||
101 | { | 101 | { |
102 | snd_rawmidi_runtime_t *runtime; | 102 | snd_rawmidi_runtime_t *runtime; |
103 | 103 | ||
104 | if ((runtime = kcalloc(1, sizeof(*runtime), GFP_KERNEL)) == NULL) | 104 | if ((runtime = kzalloc(sizeof(*runtime), GFP_KERNEL)) == NULL) |
105 | return -ENOMEM; | 105 | return -ENOMEM; |
106 | spin_lock_init(&runtime->lock); | 106 | spin_lock_init(&runtime->lock); |
107 | init_waitqueue_head(&runtime->sleep); | 107 | init_waitqueue_head(&runtime->sleep); |
@@ -984,7 +984,9 @@ static ssize_t snd_rawmidi_read(struct file *file, char __user *buf, size_t coun | |||
984 | spin_lock_irq(&runtime->lock); | 984 | spin_lock_irq(&runtime->lock); |
985 | } | 985 | } |
986 | spin_unlock_irq(&runtime->lock); | 986 | spin_unlock_irq(&runtime->lock); |
987 | count1 = snd_rawmidi_kernel_read1(substream, (unsigned char *)buf, count, 0); | 987 | count1 = snd_rawmidi_kernel_read1(substream, |
988 | (unsigned char __force *)buf, | ||
989 | count, 0); | ||
988 | if (count1 < 0) | 990 | if (count1 < 0) |
989 | return result > 0 ? result : count1; | 991 | return result > 0 ? result : count1; |
990 | result += count1; | 992 | result += count1; |
@@ -1107,7 +1109,7 @@ int snd_rawmidi_transmit_ack(snd_rawmidi_substream_t * substream, int count) | |||
1107 | /** | 1109 | /** |
1108 | * snd_rawmidi_transmit - copy from the buffer to the device | 1110 | * snd_rawmidi_transmit - copy from the buffer to the device |
1109 | * @substream: the rawmidi substream | 1111 | * @substream: the rawmidi substream |
1110 | * @buf: the buffer pointer | 1112 | * @buffer: the buffer pointer |
1111 | * @count: the data size to transfer | 1113 | * @count: the data size to transfer |
1112 | * | 1114 | * |
1113 | * Copies data from the buffer to the device and advances the pointer. | 1115 | * Copies data from the buffer to the device and advances the pointer. |
@@ -1213,7 +1215,9 @@ static ssize_t snd_rawmidi_write(struct file *file, const char __user *buf, size | |||
1213 | spin_lock_irq(&runtime->lock); | 1215 | spin_lock_irq(&runtime->lock); |
1214 | } | 1216 | } |
1215 | spin_unlock_irq(&runtime->lock); | 1217 | spin_unlock_irq(&runtime->lock); |
1216 | count1 = snd_rawmidi_kernel_write1(substream, (unsigned char *)buf, count, 0); | 1218 | count1 = snd_rawmidi_kernel_write1(substream, |
1219 | (unsigned char __force *)buf, | ||
1220 | count, 0); | ||
1217 | if (count1 < 0) | 1221 | if (count1 < 0) |
1218 | return result > 0 ? result : count1; | 1222 | return result > 0 ? result : count1; |
1219 | result += count1; | 1223 | result += count1; |
@@ -1370,7 +1374,7 @@ static int snd_rawmidi_alloc_substreams(snd_rawmidi_t *rmidi, | |||
1370 | 1374 | ||
1371 | INIT_LIST_HEAD(&stream->substreams); | 1375 | INIT_LIST_HEAD(&stream->substreams); |
1372 | for (idx = 0; idx < count; idx++) { | 1376 | for (idx = 0; idx < count; idx++) { |
1373 | substream = kcalloc(1, sizeof(*substream), GFP_KERNEL); | 1377 | substream = kzalloc(sizeof(*substream), GFP_KERNEL); |
1374 | if (substream == NULL) | 1378 | if (substream == NULL) |
1375 | return -ENOMEM; | 1379 | return -ENOMEM; |
1376 | substream->stream = direction; | 1380 | substream->stream = direction; |
@@ -1413,7 +1417,7 @@ int snd_rawmidi_new(snd_card_t * card, char *id, int device, | |||
1413 | snd_assert(rrawmidi != NULL, return -EINVAL); | 1417 | snd_assert(rrawmidi != NULL, return -EINVAL); |
1414 | *rrawmidi = NULL; | 1418 | *rrawmidi = NULL; |
1415 | snd_assert(card != NULL, return -ENXIO); | 1419 | snd_assert(card != NULL, return -ENXIO); |
1416 | rmidi = kcalloc(1, sizeof(*rmidi), GFP_KERNEL); | 1420 | rmidi = kzalloc(sizeof(*rmidi), GFP_KERNEL); |
1417 | if (rmidi == NULL) | 1421 | if (rmidi == NULL) |
1418 | return -ENOMEM; | 1422 | return -ENOMEM; |
1419 | rmidi->card = card; | 1423 | rmidi->card = card; |
diff --git a/sound/core/seq/instr/ainstr_gf1.c b/sound/core/seq/instr/ainstr_gf1.c index 32e91c6b25fe..0e4df8826eed 100644 --- a/sound/core/seq/instr/ainstr_gf1.c +++ b/sound/core/seq/instr/ainstr_gf1.c | |||
@@ -51,7 +51,7 @@ static int snd_seq_gf1_copy_wave_from_stream(snd_gf1_ops_t *ops, | |||
51 | gf1_wave_t *wp, *prev; | 51 | gf1_wave_t *wp, *prev; |
52 | gf1_xwave_t xp; | 52 | gf1_xwave_t xp; |
53 | int err; | 53 | int err; |
54 | unsigned int gfp_mask; | 54 | gfp_t gfp_mask; |
55 | unsigned int real_size; | 55 | unsigned int real_size; |
56 | 56 | ||
57 | gfp_mask = atomic ? GFP_ATOMIC : GFP_KERNEL; | 57 | gfp_mask = atomic ? GFP_ATOMIC : GFP_KERNEL; |
@@ -61,7 +61,7 @@ static int snd_seq_gf1_copy_wave_from_stream(snd_gf1_ops_t *ops, | |||
61 | return -EFAULT; | 61 | return -EFAULT; |
62 | *data += sizeof(xp); | 62 | *data += sizeof(xp); |
63 | *len -= sizeof(xp); | 63 | *len -= sizeof(xp); |
64 | wp = kcalloc(1, sizeof(*wp), gfp_mask); | 64 | wp = kzalloc(sizeof(*wp), gfp_mask); |
65 | if (wp == NULL) | 65 | if (wp == NULL) |
66 | return -ENOMEM; | 66 | return -ENOMEM; |
67 | wp->share_id[0] = le32_to_cpu(xp.share_id[0]); | 67 | wp->share_id[0] = le32_to_cpu(xp.share_id[0]); |
@@ -144,7 +144,8 @@ static int snd_seq_gf1_put(void *private_data, snd_seq_kinstr_t *instr, | |||
144 | snd_gf1_ops_t *ops = (snd_gf1_ops_t *)private_data; | 144 | snd_gf1_ops_t *ops = (snd_gf1_ops_t *)private_data; |
145 | gf1_instrument_t *ip; | 145 | gf1_instrument_t *ip; |
146 | gf1_xinstrument_t ix; | 146 | gf1_xinstrument_t ix; |
147 | int err, gfp_mask; | 147 | int err; |
148 | gfp_t gfp_mask; | ||
148 | 149 | ||
149 | if (cmd != SNDRV_SEQ_INSTR_PUT_CMD_CREATE) | 150 | if (cmd != SNDRV_SEQ_INSTR_PUT_CMD_CREATE) |
150 | return -EINVAL; | 151 | return -EINVAL; |
diff --git a/sound/core/seq/instr/ainstr_iw.c b/sound/core/seq/instr/ainstr_iw.c index 2622b8679ca7..7c19fbbc5d0f 100644 --- a/sound/core/seq/instr/ainstr_iw.c +++ b/sound/core/seq/instr/ainstr_iw.c | |||
@@ -58,7 +58,7 @@ static int snd_seq_iwffff_copy_env_from_stream(__u32 req_stype, | |||
58 | iwffff_xenv_t *ex, | 58 | iwffff_xenv_t *ex, |
59 | char __user **data, | 59 | char __user **data, |
60 | long *len, | 60 | long *len, |
61 | unsigned int __nocast gfp_mask) | 61 | gfp_t gfp_mask) |
62 | { | 62 | { |
63 | __u32 stype; | 63 | __u32 stype; |
64 | iwffff_env_record_t *rp, *rp_last; | 64 | iwffff_env_record_t *rp, *rp_last; |
@@ -92,7 +92,7 @@ static int snd_seq_iwffff_copy_env_from_stream(__u32 req_stype, | |||
92 | points_size = (le16_to_cpu(rx.nattack) + le16_to_cpu(rx.nrelease)) * 2 * sizeof(__u16); | 92 | points_size = (le16_to_cpu(rx.nattack) + le16_to_cpu(rx.nrelease)) * 2 * sizeof(__u16); |
93 | if (points_size > *len) | 93 | if (points_size > *len) |
94 | return -EINVAL; | 94 | return -EINVAL; |
95 | rp = kcalloc(1, sizeof(*rp) + points_size, gfp_mask); | 95 | rp = kzalloc(sizeof(*rp) + points_size, gfp_mask); |
96 | if (rp == NULL) | 96 | if (rp == NULL) |
97 | return -ENOMEM; | 97 | return -ENOMEM; |
98 | rp->nattack = le16_to_cpu(rx.nattack); | 98 | rp->nattack = le16_to_cpu(rx.nattack); |
@@ -129,7 +129,7 @@ static int snd_seq_iwffff_copy_wave_from_stream(snd_iwffff_ops_t *ops, | |||
129 | iwffff_wave_t *wp, *prev; | 129 | iwffff_wave_t *wp, *prev; |
130 | iwffff_xwave_t xp; | 130 | iwffff_xwave_t xp; |
131 | int err; | 131 | int err; |
132 | unsigned int gfp_mask; | 132 | gfp_t gfp_mask; |
133 | unsigned int real_size; | 133 | unsigned int real_size; |
134 | 134 | ||
135 | gfp_mask = atomic ? GFP_ATOMIC : GFP_KERNEL; | 135 | gfp_mask = atomic ? GFP_ATOMIC : GFP_KERNEL; |
@@ -139,7 +139,7 @@ static int snd_seq_iwffff_copy_wave_from_stream(snd_iwffff_ops_t *ops, | |||
139 | return -EFAULT; | 139 | return -EFAULT; |
140 | *data += sizeof(xp); | 140 | *data += sizeof(xp); |
141 | *len -= sizeof(xp); | 141 | *len -= sizeof(xp); |
142 | wp = kcalloc(1, sizeof(*wp), gfp_mask); | 142 | wp = kzalloc(sizeof(*wp), gfp_mask); |
143 | if (wp == NULL) | 143 | if (wp == NULL) |
144 | return -ENOMEM; | 144 | return -ENOMEM; |
145 | wp->share_id[0] = le32_to_cpu(xp.share_id[0]); | 145 | wp->share_id[0] = le32_to_cpu(xp.share_id[0]); |
@@ -236,7 +236,7 @@ static int snd_seq_iwffff_put(void *private_data, snd_seq_kinstr_t *instr, | |||
236 | iwffff_layer_t *lp, *prev_lp; | 236 | iwffff_layer_t *lp, *prev_lp; |
237 | iwffff_xlayer_t lx; | 237 | iwffff_xlayer_t lx; |
238 | int err; | 238 | int err; |
239 | unsigned int gfp_mask; | 239 | gfp_t gfp_mask; |
240 | 240 | ||
241 | if (cmd != SNDRV_SEQ_INSTR_PUT_CMD_CREATE) | 241 | if (cmd != SNDRV_SEQ_INSTR_PUT_CMD_CREATE) |
242 | return -EINVAL; | 242 | return -EINVAL; |
@@ -273,7 +273,7 @@ static int snd_seq_iwffff_put(void *private_data, snd_seq_kinstr_t *instr, | |||
273 | snd_seq_iwffff_instr_free(ops, ip, atomic); | 273 | snd_seq_iwffff_instr_free(ops, ip, atomic); |
274 | return -EINVAL; | 274 | return -EINVAL; |
275 | } | 275 | } |
276 | lp = kcalloc(1, sizeof(*lp), gfp_mask); | 276 | lp = kzalloc(sizeof(*lp), gfp_mask); |
277 | if (lp == NULL) { | 277 | if (lp == NULL) { |
278 | snd_seq_iwffff_instr_free(ops, ip, atomic); | 278 | snd_seq_iwffff_instr_free(ops, ip, atomic); |
279 | return -ENOMEM; | 279 | return -ENOMEM; |
diff --git a/sound/core/seq/instr/ainstr_simple.c b/sound/core/seq/instr/ainstr_simple.c index 6183d2151034..17ab94e76073 100644 --- a/sound/core/seq/instr/ainstr_simple.c +++ b/sound/core/seq/instr/ainstr_simple.c | |||
@@ -57,7 +57,8 @@ static int snd_seq_simple_put(void *private_data, snd_seq_kinstr_t *instr, | |||
57 | snd_simple_ops_t *ops = (snd_simple_ops_t *)private_data; | 57 | snd_simple_ops_t *ops = (snd_simple_ops_t *)private_data; |
58 | simple_instrument_t *ip; | 58 | simple_instrument_t *ip; |
59 | simple_xinstrument_t ix; | 59 | simple_xinstrument_t ix; |
60 | int err, gfp_mask; | 60 | int err; |
61 | gfp_t gfp_mask; | ||
61 | unsigned int real_size; | 62 | unsigned int real_size; |
62 | 63 | ||
63 | if (cmd != SNDRV_SEQ_INSTR_PUT_CMD_CREATE) | 64 | if (cmd != SNDRV_SEQ_INSTR_PUT_CMD_CREATE) |
diff --git a/sound/core/seq/oss/seq_oss_init.c b/sound/core/seq/oss/seq_oss_init.c index bac4b4f1a94e..1ab1cf8158c8 100644 --- a/sound/core/seq/oss/seq_oss_init.c +++ b/sound/core/seq/oss/seq_oss_init.c | |||
@@ -193,7 +193,7 @@ snd_seq_oss_open(struct file *file, int level) | |||
193 | int i, rc; | 193 | int i, rc; |
194 | seq_oss_devinfo_t *dp; | 194 | seq_oss_devinfo_t *dp; |
195 | 195 | ||
196 | if ((dp = kcalloc(1, sizeof(*dp), GFP_KERNEL)) == NULL) { | 196 | if ((dp = kzalloc(sizeof(*dp), GFP_KERNEL)) == NULL) { |
197 | snd_printk(KERN_ERR "can't malloc device info\n"); | 197 | snd_printk(KERN_ERR "can't malloc device info\n"); |
198 | return -ENOMEM; | 198 | return -ENOMEM; |
199 | } | 199 | } |
diff --git a/sound/core/seq/oss/seq_oss_midi.c b/sound/core/seq/oss/seq_oss_midi.c index 9aece6c65dbc..f0e95c8f2eef 100644 --- a/sound/core/seq/oss/seq_oss_midi.c +++ b/sound/core/seq/oss/seq_oss_midi.c | |||
@@ -76,8 +76,8 @@ snd_seq_oss_midi_lookup_ports(int client) | |||
76 | snd_seq_client_info_t *clinfo; | 76 | snd_seq_client_info_t *clinfo; |
77 | snd_seq_port_info_t *pinfo; | 77 | snd_seq_port_info_t *pinfo; |
78 | 78 | ||
79 | clinfo = kcalloc(1, sizeof(*clinfo), GFP_KERNEL); | 79 | clinfo = kzalloc(sizeof(*clinfo), GFP_KERNEL); |
80 | pinfo = kcalloc(1, sizeof(*pinfo), GFP_KERNEL); | 80 | pinfo = kzalloc(sizeof(*pinfo), GFP_KERNEL); |
81 | if (! clinfo || ! pinfo) { | 81 | if (! clinfo || ! pinfo) { |
82 | kfree(clinfo); | 82 | kfree(clinfo); |
83 | kfree(pinfo); | 83 | kfree(pinfo); |
@@ -172,7 +172,7 @@ snd_seq_oss_midi_check_new_port(snd_seq_port_info_t *pinfo) | |||
172 | /* | 172 | /* |
173 | * allocate midi info record | 173 | * allocate midi info record |
174 | */ | 174 | */ |
175 | if ((mdev = kcalloc(1, sizeof(*mdev), GFP_KERNEL)) == NULL) { | 175 | if ((mdev = kzalloc(sizeof(*mdev), GFP_KERNEL)) == NULL) { |
176 | snd_printk(KERN_ERR "can't malloc midi info\n"); | 176 | snd_printk(KERN_ERR "can't malloc midi info\n"); |
177 | return -ENOMEM; | 177 | return -ENOMEM; |
178 | } | 178 | } |
diff --git a/sound/core/seq/oss/seq_oss_readq.c b/sound/core/seq/oss/seq_oss_readq.c index 0a6f2a64f692..55571e15cd38 100644 --- a/sound/core/seq/oss/seq_oss_readq.c +++ b/sound/core/seq/oss/seq_oss_readq.c | |||
@@ -46,7 +46,7 @@ snd_seq_oss_readq_new(seq_oss_devinfo_t *dp, int maxlen) | |||
46 | { | 46 | { |
47 | seq_oss_readq_t *q; | 47 | seq_oss_readq_t *q; |
48 | 48 | ||
49 | if ((q = kcalloc(1, sizeof(*q), GFP_KERNEL)) == NULL) { | 49 | if ((q = kzalloc(sizeof(*q), GFP_KERNEL)) == NULL) { |
50 | snd_printk(KERN_ERR "can't malloc read queue\n"); | 50 | snd_printk(KERN_ERR "can't malloc read queue\n"); |
51 | return NULL; | 51 | return NULL; |
52 | } | 52 | } |
diff --git a/sound/core/seq/oss/seq_oss_synth.c b/sound/core/seq/oss/seq_oss_synth.c index 1a7736cbf3a4..8257fce2ca1b 100644 --- a/sound/core/seq/oss/seq_oss_synth.c +++ b/sound/core/seq/oss/seq_oss_synth.c | |||
@@ -103,7 +103,7 @@ snd_seq_oss_synth_register(snd_seq_device_t *dev) | |||
103 | snd_seq_oss_reg_t *reg = SNDRV_SEQ_DEVICE_ARGPTR(dev); | 103 | snd_seq_oss_reg_t *reg = SNDRV_SEQ_DEVICE_ARGPTR(dev); |
104 | unsigned long flags; | 104 | unsigned long flags; |
105 | 105 | ||
106 | if ((rec = kcalloc(1, sizeof(*rec), GFP_KERNEL)) == NULL) { | 106 | if ((rec = kzalloc(sizeof(*rec), GFP_KERNEL)) == NULL) { |
107 | snd_printk(KERN_ERR "can't malloc synth info\n"); | 107 | snd_printk(KERN_ERR "can't malloc synth info\n"); |
108 | return -ENOMEM; | 108 | return -ENOMEM; |
109 | } | 109 | } |
@@ -499,7 +499,7 @@ snd_seq_oss_synth_sysex(seq_oss_devinfo_t *dp, int dev, unsigned char *buf, snd_ | |||
499 | 499 | ||
500 | sysex = dp->synths[dev].sysex; | 500 | sysex = dp->synths[dev].sysex; |
501 | if (sysex == NULL) { | 501 | if (sysex == NULL) { |
502 | sysex = kcalloc(1, sizeof(*sysex), GFP_KERNEL); | 502 | sysex = kzalloc(sizeof(*sysex), GFP_KERNEL); |
503 | if (sysex == NULL) | 503 | if (sysex == NULL) |
504 | return -ENOMEM; | 504 | return -ENOMEM; |
505 | dp->synths[dev].sysex = sysex; | 505 | dp->synths[dev].sysex = sysex; |
diff --git a/sound/core/seq/oss/seq_oss_timer.c b/sound/core/seq/oss/seq_oss_timer.c index 42ca9493fa60..64d594b3170f 100644 --- a/sound/core/seq/oss/seq_oss_timer.c +++ b/sound/core/seq/oss/seq_oss_timer.c | |||
@@ -46,7 +46,7 @@ snd_seq_oss_timer_new(seq_oss_devinfo_t *dp) | |||
46 | { | 46 | { |
47 | seq_oss_timer_t *rec; | 47 | seq_oss_timer_t *rec; |
48 | 48 | ||
49 | rec = kcalloc(1, sizeof(*rec), GFP_KERNEL); | 49 | rec = kzalloc(sizeof(*rec), GFP_KERNEL); |
50 | if (rec == NULL) | 50 | if (rec == NULL) |
51 | return NULL; | 51 | return NULL; |
52 | 52 | ||
diff --git a/sound/core/seq/oss/seq_oss_writeq.c b/sound/core/seq/oss/seq_oss_writeq.c index 87f85f7ee814..b20378024547 100644 --- a/sound/core/seq/oss/seq_oss_writeq.c +++ b/sound/core/seq/oss/seq_oss_writeq.c | |||
@@ -38,7 +38,7 @@ snd_seq_oss_writeq_new(seq_oss_devinfo_t *dp, int maxlen) | |||
38 | seq_oss_writeq_t *q; | 38 | seq_oss_writeq_t *q; |
39 | snd_seq_client_pool_t pool; | 39 | snd_seq_client_pool_t pool; |
40 | 40 | ||
41 | if ((q = kcalloc(1, sizeof(*q), GFP_KERNEL)) == NULL) | 41 | if ((q = kzalloc(sizeof(*q), GFP_KERNEL)) == NULL) |
42 | return NULL; | 42 | return NULL; |
43 | q->dp = dp; | 43 | q->dp = dp; |
44 | q->maxlen = maxlen; | 44 | q->maxlen = maxlen; |
diff --git a/sound/core/seq/seq.c b/sound/core/seq/seq.c index 7449d2a62629..24644150f24b 100644 --- a/sound/core/seq/seq.c +++ b/sound/core/seq/seq.c | |||
@@ -43,7 +43,13 @@ int seq_client_load[64] = {[0 ... 63] = -1}; | |||
43 | int seq_default_timer_class = SNDRV_TIMER_CLASS_GLOBAL; | 43 | int seq_default_timer_class = SNDRV_TIMER_CLASS_GLOBAL; |
44 | int seq_default_timer_sclass = SNDRV_TIMER_SCLASS_NONE; | 44 | int seq_default_timer_sclass = SNDRV_TIMER_SCLASS_NONE; |
45 | int seq_default_timer_card = -1; | 45 | int seq_default_timer_card = -1; |
46 | int seq_default_timer_device = SNDRV_TIMER_GLOBAL_SYSTEM; | 46 | int seq_default_timer_device = |
47 | #ifdef CONFIG_SND_SEQ_RTCTIMER_DEFAULT | ||
48 | SNDRV_TIMER_GLOBAL_RTC | ||
49 | #else | ||
50 | SNDRV_TIMER_GLOBAL_SYSTEM | ||
51 | #endif | ||
52 | ; | ||
47 | int seq_default_timer_subdevice = 0; | 53 | int seq_default_timer_subdevice = 0; |
48 | int seq_default_timer_resolution = 0; /* Hz */ | 54 | int seq_default_timer_resolution = 0; /* Hz */ |
49 | 55 | ||
diff --git a/sound/core/seq/seq_clientmgr.c b/sound/core/seq/seq_clientmgr.c index d8f76afd284b..a886db94b1fa 100644 --- a/sound/core/seq/seq_clientmgr.c +++ b/sound/core/seq/seq_clientmgr.c | |||
@@ -203,7 +203,7 @@ static client_t *seq_create_client1(int client_index, int poolsize) | |||
203 | client_t *client; | 203 | client_t *client; |
204 | 204 | ||
205 | /* init client data */ | 205 | /* init client data */ |
206 | client = kcalloc(1, sizeof(*client), GFP_KERNEL); | 206 | client = kzalloc(sizeof(*client), GFP_KERNEL); |
207 | if (client == NULL) | 207 | if (client == NULL) |
208 | return NULL; | 208 | return NULL; |
209 | client->pool = snd_seq_pool_new(poolsize); | 209 | client->pool = snd_seq_pool_new(poolsize); |
@@ -413,7 +413,9 @@ static ssize_t snd_seq_read(struct file *file, char __user *buf, size_t count, l | |||
413 | } | 413 | } |
414 | count -= sizeof(snd_seq_event_t); | 414 | count -= sizeof(snd_seq_event_t); |
415 | buf += sizeof(snd_seq_event_t); | 415 | buf += sizeof(snd_seq_event_t); |
416 | err = snd_seq_expand_var_event(&cell->event, count, (char *)buf, 0, sizeof(snd_seq_event_t)); | 416 | err = snd_seq_expand_var_event(&cell->event, count, |
417 | (char __force *)buf, 0, | ||
418 | sizeof(snd_seq_event_t)); | ||
417 | if (err < 0) | 419 | if (err < 0) |
418 | break; | 420 | break; |
419 | result += err; | 421 | result += err; |
@@ -1009,7 +1011,8 @@ static ssize_t snd_seq_write(struct file *file, const char __user *buf, size_t c | |||
1009 | } | 1011 | } |
1010 | /* set user space pointer */ | 1012 | /* set user space pointer */ |
1011 | event.data.ext.len = extlen | SNDRV_SEQ_EXT_USRPTR; | 1013 | event.data.ext.len = extlen | SNDRV_SEQ_EXT_USRPTR; |
1012 | event.data.ext.ptr = (char*)buf + sizeof(snd_seq_event_t); | 1014 | event.data.ext.ptr = (char __force *)buf |
1015 | + sizeof(snd_seq_event_t); | ||
1013 | len += extlen; /* increment data length */ | 1016 | len += extlen; /* increment data length */ |
1014 | } else { | 1017 | } else { |
1015 | #ifdef CONFIG_COMPAT | 1018 | #ifdef CONFIG_COMPAT |
diff --git a/sound/core/seq/seq_device.c b/sound/core/seq/seq_device.c index 4d80f39612e8..252b52731003 100644 --- a/sound/core/seq/seq_device.c +++ b/sound/core/seq/seq_device.c | |||
@@ -200,7 +200,7 @@ int snd_seq_device_new(snd_card_t *card, int device, char *id, int argsize, | |||
200 | if (ops == NULL) | 200 | if (ops == NULL) |
201 | return -ENOMEM; | 201 | return -ENOMEM; |
202 | 202 | ||
203 | dev = kcalloc(1, sizeof(*dev)*2 + argsize, GFP_KERNEL); | 203 | dev = kzalloc(sizeof(*dev)*2 + argsize, GFP_KERNEL); |
204 | if (dev == NULL) { | 204 | if (dev == NULL) { |
205 | unlock_driver(ops); | 205 | unlock_driver(ops); |
206 | return -ENOMEM; | 206 | return -ENOMEM; |
diff --git a/sound/core/seq/seq_dummy.c b/sound/core/seq/seq_dummy.c index ea945a5d2a0b..5dd0e6a19e50 100644 --- a/sound/core/seq/seq_dummy.c +++ b/sound/core/seq/seq_dummy.c | |||
@@ -153,7 +153,7 @@ create_port(int idx, int type) | |||
153 | snd_seq_port_callback_t pcb; | 153 | snd_seq_port_callback_t pcb; |
154 | snd_seq_dummy_port_t *rec; | 154 | snd_seq_dummy_port_t *rec; |
155 | 155 | ||
156 | if ((rec = kcalloc(1, sizeof(*rec), GFP_KERNEL)) == NULL) | 156 | if ((rec = kzalloc(sizeof(*rec), GFP_KERNEL)) == NULL) |
157 | return NULL; | 157 | return NULL; |
158 | 158 | ||
159 | rec->client = my_client; | 159 | rec->client = my_client; |
diff --git a/sound/core/seq/seq_fifo.c b/sound/core/seq/seq_fifo.c index 3b7647ca7ad9..4767cfdc361f 100644 --- a/sound/core/seq/seq_fifo.c +++ b/sound/core/seq/seq_fifo.c | |||
@@ -33,7 +33,7 @@ fifo_t *snd_seq_fifo_new(int poolsize) | |||
33 | { | 33 | { |
34 | fifo_t *f; | 34 | fifo_t *f; |
35 | 35 | ||
36 | f = kcalloc(1, sizeof(*f), GFP_KERNEL); | 36 | f = kzalloc(sizeof(*f), GFP_KERNEL); |
37 | if (f == NULL) { | 37 | if (f == NULL) { |
38 | snd_printd("malloc failed for snd_seq_fifo_new() \n"); | 38 | snd_printd("malloc failed for snd_seq_fifo_new() \n"); |
39 | return NULL; | 39 | return NULL; |
diff --git a/sound/core/seq/seq_instr.c b/sound/core/seq/seq_instr.c index 5b40ea2ba8f4..019d43a462d7 100644 --- a/sound/core/seq/seq_instr.c +++ b/sound/core/seq/seq_instr.c | |||
@@ -53,7 +53,7 @@ static snd_seq_kinstr_t *snd_seq_instr_new(int add_len, int atomic) | |||
53 | { | 53 | { |
54 | snd_seq_kinstr_t *instr; | 54 | snd_seq_kinstr_t *instr; |
55 | 55 | ||
56 | instr = kcalloc(1, sizeof(snd_seq_kinstr_t) + add_len, atomic ? GFP_ATOMIC : GFP_KERNEL); | 56 | instr = kzalloc(sizeof(snd_seq_kinstr_t) + add_len, atomic ? GFP_ATOMIC : GFP_KERNEL); |
57 | if (instr == NULL) | 57 | if (instr == NULL) |
58 | return NULL; | 58 | return NULL; |
59 | instr->add_len = add_len; | 59 | instr->add_len = add_len; |
@@ -77,7 +77,7 @@ snd_seq_kinstr_list_t *snd_seq_instr_list_new(void) | |||
77 | { | 77 | { |
78 | snd_seq_kinstr_list_t *list; | 78 | snd_seq_kinstr_list_t *list; |
79 | 79 | ||
80 | list = kcalloc(1, sizeof(snd_seq_kinstr_list_t), GFP_KERNEL); | 80 | list = kzalloc(sizeof(snd_seq_kinstr_list_t), GFP_KERNEL); |
81 | if (list == NULL) | 81 | if (list == NULL) |
82 | return NULL; | 82 | return NULL; |
83 | spin_lock_init(&list->lock); | 83 | spin_lock_init(&list->lock); |
diff --git a/sound/core/seq/seq_memory.c b/sound/core/seq/seq_memory.c index 03acb2d519ba..d4d7d326c4b1 100644 --- a/sound/core/seq/seq_memory.c +++ b/sound/core/seq/seq_memory.c | |||
@@ -452,7 +452,7 @@ pool_t *snd_seq_pool_new(int poolsize) | |||
452 | pool_t *pool; | 452 | pool_t *pool; |
453 | 453 | ||
454 | /* create pool block */ | 454 | /* create pool block */ |
455 | pool = kcalloc(1, sizeof(*pool), GFP_KERNEL); | 455 | pool = kzalloc(sizeof(*pool), GFP_KERNEL); |
456 | if (pool == NULL) { | 456 | if (pool == NULL) { |
457 | snd_printd("seq: malloc failed for pool\n"); | 457 | snd_printd("seq: malloc failed for pool\n"); |
458 | return NULL; | 458 | return NULL; |
diff --git a/sound/core/seq/seq_midi.c b/sound/core/seq/seq_midi.c index 4374829ea770..b4674ae3bc30 100644 --- a/sound/core/seq/seq_midi.c +++ b/sound/core/seq/seq_midi.c | |||
@@ -322,7 +322,7 @@ snd_seq_midisynth_register_port(snd_seq_device_t *dev) | |||
322 | client = synths[card->number]; | 322 | client = synths[card->number]; |
323 | if (client == NULL) { | 323 | if (client == NULL) { |
324 | newclient = 1; | 324 | newclient = 1; |
325 | client = kcalloc(1, sizeof(*client), GFP_KERNEL); | 325 | client = kzalloc(sizeof(*client), GFP_KERNEL); |
326 | if (client == NULL) { | 326 | if (client == NULL) { |
327 | up(®ister_mutex); | 327 | up(®ister_mutex); |
328 | kfree(info); | 328 | kfree(info); |
diff --git a/sound/core/seq/seq_midi_event.c b/sound/core/seq/seq_midi_event.c index 603b63716db6..2dc1aecfb426 100644 --- a/sound/core/seq/seq_midi_event.c +++ b/sound/core/seq/seq_midi_event.c | |||
@@ -118,7 +118,7 @@ int snd_midi_event_new(int bufsize, snd_midi_event_t **rdev) | |||
118 | snd_midi_event_t *dev; | 118 | snd_midi_event_t *dev; |
119 | 119 | ||
120 | *rdev = NULL; | 120 | *rdev = NULL; |
121 | dev = kcalloc(1, sizeof(*dev), GFP_KERNEL); | 121 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); |
122 | if (dev == NULL) | 122 | if (dev == NULL) |
123 | return -ENOMEM; | 123 | return -ENOMEM; |
124 | if (bufsize > 0) { | 124 | if (bufsize > 0) { |
diff --git a/sound/core/seq/seq_ports.c b/sound/core/seq/seq_ports.c index b976951fc100..57ec31df0d15 100644 --- a/sound/core/seq/seq_ports.c +++ b/sound/core/seq/seq_ports.c | |||
@@ -141,7 +141,7 @@ client_port_t *snd_seq_create_port(client_t *client, int port) | |||
141 | } | 141 | } |
142 | 142 | ||
143 | /* create a new port */ | 143 | /* create a new port */ |
144 | new_port = kcalloc(1, sizeof(*new_port), GFP_KERNEL); | 144 | new_port = kzalloc(sizeof(*new_port), GFP_KERNEL); |
145 | if (! new_port) { | 145 | if (! new_port) { |
146 | snd_printd("malloc failed for registering client port\n"); | 146 | snd_printd("malloc failed for registering client port\n"); |
147 | return NULL; /* failure, out of memory */ | 147 | return NULL; /* failure, out of memory */ |
@@ -488,7 +488,7 @@ int snd_seq_port_connect(client_t *connector, | |||
488 | unsigned long flags; | 488 | unsigned long flags; |
489 | int exclusive; | 489 | int exclusive; |
490 | 490 | ||
491 | subs = kcalloc(1, sizeof(*subs), GFP_KERNEL); | 491 | subs = kzalloc(sizeof(*subs), GFP_KERNEL); |
492 | if (! subs) | 492 | if (! subs) |
493 | return -ENOMEM; | 493 | return -ENOMEM; |
494 | 494 | ||
diff --git a/sound/core/seq/seq_prioq.c b/sound/core/seq/seq_prioq.c index a519732ed833..cd641bca9945 100644 --- a/sound/core/seq/seq_prioq.c +++ b/sound/core/seq/seq_prioq.c | |||
@@ -59,7 +59,7 @@ prioq_t *snd_seq_prioq_new(void) | |||
59 | { | 59 | { |
60 | prioq_t *f; | 60 | prioq_t *f; |
61 | 61 | ||
62 | f = kcalloc(1, sizeof(*f), GFP_KERNEL); | 62 | f = kzalloc(sizeof(*f), GFP_KERNEL); |
63 | if (f == NULL) { | 63 | if (f == NULL) { |
64 | snd_printd("oops: malloc failed for snd_seq_prioq_new()\n"); | 64 | snd_printd("oops: malloc failed for snd_seq_prioq_new()\n"); |
65 | return NULL; | 65 | return NULL; |
diff --git a/sound/core/seq/seq_queue.c b/sound/core/seq/seq_queue.c index 98de2e711fde..5f5c3cb37cbf 100644 --- a/sound/core/seq/seq_queue.c +++ b/sound/core/seq/seq_queue.c | |||
@@ -111,7 +111,7 @@ static queue_t *queue_new(int owner, int locked) | |||
111 | { | 111 | { |
112 | queue_t *q; | 112 | queue_t *q; |
113 | 113 | ||
114 | q = kcalloc(1, sizeof(*q), GFP_KERNEL); | 114 | q = kzalloc(sizeof(*q), GFP_KERNEL); |
115 | if (q == NULL) { | 115 | if (q == NULL) { |
116 | snd_printd("malloc failed for snd_seq_queue_new()\n"); | 116 | snd_printd("malloc failed for snd_seq_queue_new()\n"); |
117 | return NULL; | 117 | return NULL; |
diff --git a/sound/core/seq/seq_system.c b/sound/core/seq/seq_system.c index e8f0a6683d50..0d9eff85ab88 100644 --- a/sound/core/seq/seq_system.c +++ b/sound/core/seq/seq_system.c | |||
@@ -126,8 +126,8 @@ int __init snd_seq_system_client_init(void) | |||
126 | snd_seq_client_info_t *inf; | 126 | snd_seq_client_info_t *inf; |
127 | snd_seq_port_info_t *port; | 127 | snd_seq_port_info_t *port; |
128 | 128 | ||
129 | inf = kcalloc(1, sizeof(*inf), GFP_KERNEL); | 129 | inf = kzalloc(sizeof(*inf), GFP_KERNEL); |
130 | port = kcalloc(1, sizeof(*port), GFP_KERNEL); | 130 | port = kzalloc(sizeof(*port), GFP_KERNEL); |
131 | if (! inf || ! port) { | 131 | if (! inf || ! port) { |
132 | kfree(inf); | 132 | kfree(inf); |
133 | kfree(port); | 133 | kfree(port); |
diff --git a/sound/core/seq/seq_timer.c b/sound/core/seq/seq_timer.c index a7f76fc95280..b57a3c07ff6f 100644 --- a/sound/core/seq/seq_timer.c +++ b/sound/core/seq/seq_timer.c | |||
@@ -60,7 +60,7 @@ seq_timer_t *snd_seq_timer_new(void) | |||
60 | { | 60 | { |
61 | seq_timer_t *tmr; | 61 | seq_timer_t *tmr; |
62 | 62 | ||
63 | tmr = kcalloc(1, sizeof(*tmr), GFP_KERNEL); | 63 | tmr = kzalloc(sizeof(*tmr), GFP_KERNEL); |
64 | if (tmr == NULL) { | 64 | if (tmr == NULL) { |
65 | snd_printd("malloc failed for snd_seq_timer_new() \n"); | 65 | snd_printd("malloc failed for snd_seq_timer_new() \n"); |
66 | return NULL; | 66 | return NULL; |
diff --git a/sound/core/seq/seq_virmidi.c b/sound/core/seq/seq_virmidi.c index a66484b5cf0e..e4f512aa7426 100644 --- a/sound/core/seq/seq_virmidi.c +++ b/sound/core/seq/seq_virmidi.c | |||
@@ -205,7 +205,7 @@ static int snd_virmidi_input_open(snd_rawmidi_substream_t * substream) | |||
205 | snd_virmidi_t *vmidi; | 205 | snd_virmidi_t *vmidi; |
206 | unsigned long flags; | 206 | unsigned long flags; |
207 | 207 | ||
208 | vmidi = kcalloc(1, sizeof(*vmidi), GFP_KERNEL); | 208 | vmidi = kzalloc(sizeof(*vmidi), GFP_KERNEL); |
209 | if (vmidi == NULL) | 209 | if (vmidi == NULL) |
210 | return -ENOMEM; | 210 | return -ENOMEM; |
211 | vmidi->substream = substream; | 211 | vmidi->substream = substream; |
@@ -233,7 +233,7 @@ static int snd_virmidi_output_open(snd_rawmidi_substream_t * substream) | |||
233 | snd_rawmidi_runtime_t *runtime = substream->runtime; | 233 | snd_rawmidi_runtime_t *runtime = substream->runtime; |
234 | snd_virmidi_t *vmidi; | 234 | snd_virmidi_t *vmidi; |
235 | 235 | ||
236 | vmidi = kcalloc(1, sizeof(*vmidi), GFP_KERNEL); | 236 | vmidi = kzalloc(sizeof(*vmidi), GFP_KERNEL); |
237 | if (vmidi == NULL) | 237 | if (vmidi == NULL) |
238 | return -ENOMEM; | 238 | return -ENOMEM; |
239 | vmidi->substream = substream; | 239 | vmidi->substream = substream; |
@@ -508,7 +508,7 @@ int snd_virmidi_new(snd_card_t *card, int device, snd_rawmidi_t **rrmidi) | |||
508 | &rmidi)) < 0) | 508 | &rmidi)) < 0) |
509 | return err; | 509 | return err; |
510 | strcpy(rmidi->name, rmidi->id); | 510 | strcpy(rmidi->name, rmidi->id); |
511 | rdev = kcalloc(1, sizeof(*rdev), GFP_KERNEL); | 511 | rdev = kzalloc(sizeof(*rdev), GFP_KERNEL); |
512 | if (rdev == NULL) { | 512 | if (rdev == NULL) { |
513 | snd_device_free(card, rmidi); | 513 | snd_device_free(card, rmidi); |
514 | return -ENOMEM; | 514 | return -ENOMEM; |
diff --git a/sound/core/sound.c b/sound/core/sound.c index 7612884f530b..b57519a3e3d9 100644 --- a/sound/core/sound.c +++ b/sound/core/sound.c | |||
@@ -231,7 +231,7 @@ int snd_register_device(int type, snd_card_t * card, int dev, snd_minor_t * reg, | |||
231 | devfs_mk_cdev(MKDEV(major, minor), S_IFCHR | device_mode, "snd/%s", name); | 231 | devfs_mk_cdev(MKDEV(major, minor), S_IFCHR | device_mode, "snd/%s", name); |
232 | if (card) | 232 | if (card) |
233 | device = card->dev; | 233 | device = card->dev; |
234 | class_device_create(sound_class, MKDEV(major, minor), device, "%s", name); | 234 | class_device_create(sound_class, NULL, MKDEV(major, minor), device, "%s", name); |
235 | 235 | ||
236 | up(&sound_mutex); | 236 | up(&sound_mutex); |
237 | return 0; | 237 | return 0; |
@@ -328,6 +328,10 @@ int __exit snd_minor_info_done(void) | |||
328 | * INIT PART | 328 | * INIT PART |
329 | */ | 329 | */ |
330 | 330 | ||
331 | #ifdef CONFIG_SND_GENERIC_DRIVER | ||
332 | extern struct device_driver snd_generic_driver; | ||
333 | #endif | ||
334 | |||
331 | static int __init alsa_sound_init(void) | 335 | static int __init alsa_sound_init(void) |
332 | { | 336 | { |
333 | short controlnum; | 337 | short controlnum; |
@@ -354,6 +358,9 @@ static int __init alsa_sound_init(void) | |||
354 | return -ENOMEM; | 358 | return -ENOMEM; |
355 | } | 359 | } |
356 | snd_info_minor_register(); | 360 | snd_info_minor_register(); |
361 | #ifdef CONFIG_SND_GENERIC_DRIVER | ||
362 | driver_register(&snd_generic_driver); | ||
363 | #endif | ||
357 | for (controlnum = 0; controlnum < cards_limit; controlnum++) | 364 | for (controlnum = 0; controlnum < cards_limit; controlnum++) |
358 | devfs_mk_cdev(MKDEV(major, controlnum<<5), S_IFCHR | device_mode, "snd/controlC%d", controlnum); | 365 | devfs_mk_cdev(MKDEV(major, controlnum<<5), S_IFCHR | device_mode, "snd/controlC%d", controlnum); |
359 | #ifndef MODULE | 366 | #ifndef MODULE |
@@ -369,6 +376,9 @@ static void __exit alsa_sound_exit(void) | |||
369 | for (controlnum = 0; controlnum < cards_limit; controlnum++) | 376 | for (controlnum = 0; controlnum < cards_limit; controlnum++) |
370 | devfs_remove("snd/controlC%d", controlnum); | 377 | devfs_remove("snd/controlC%d", controlnum); |
371 | 378 | ||
379 | #ifdef CONFIG_SND_GENERIC_DRIVER | ||
380 | driver_unregister(&snd_generic_driver); | ||
381 | #endif | ||
372 | snd_info_minor_unregister(); | 382 | snd_info_minor_unregister(); |
373 | snd_info_done(); | 383 | snd_info_done(); |
374 | snd_memory_done(); | 384 | snd_memory_done(); |
@@ -416,10 +426,13 @@ EXPORT_SYMBOL(snd_card_register); | |||
416 | EXPORT_SYMBOL(snd_component_add); | 426 | EXPORT_SYMBOL(snd_component_add); |
417 | EXPORT_SYMBOL(snd_card_file_add); | 427 | EXPORT_SYMBOL(snd_card_file_add); |
418 | EXPORT_SYMBOL(snd_card_file_remove); | 428 | EXPORT_SYMBOL(snd_card_file_remove); |
429 | #ifdef CONFIG_SND_GENERIC_DRIVER | ||
430 | EXPORT_SYMBOL(snd_card_set_generic_dev); | ||
431 | #endif | ||
419 | #ifdef CONFIG_PM | 432 | #ifdef CONFIG_PM |
420 | EXPORT_SYMBOL(snd_power_wait); | 433 | EXPORT_SYMBOL(snd_power_wait); |
421 | EXPORT_SYMBOL(snd_card_set_pm_callback); | 434 | EXPORT_SYMBOL(snd_card_set_pm_callback); |
422 | #if defined(CONFIG_PM) && defined(CONFIG_SND_GENERIC_PM) | 435 | #ifdef CONFIG_SND_GENERIC_DRIVER |
423 | EXPORT_SYMBOL(snd_card_set_generic_pm_callback); | 436 | EXPORT_SYMBOL(snd_card_set_generic_pm_callback); |
424 | #endif | 437 | #endif |
425 | #ifdef CONFIG_PCI | 438 | #ifdef CONFIG_PCI |
@@ -432,7 +445,7 @@ EXPORT_SYMBOL(snd_device_new); | |||
432 | EXPORT_SYMBOL(snd_device_register); | 445 | EXPORT_SYMBOL(snd_device_register); |
433 | EXPORT_SYMBOL(snd_device_free); | 446 | EXPORT_SYMBOL(snd_device_free); |
434 | /* isadma.c */ | 447 | /* isadma.c */ |
435 | #ifdef CONFIG_ISA | 448 | #ifdef CONFIG_ISA_DMA_API |
436 | EXPORT_SYMBOL(snd_dma_program); | 449 | EXPORT_SYMBOL(snd_dma_program); |
437 | EXPORT_SYMBOL(snd_dma_disable); | 450 | EXPORT_SYMBOL(snd_dma_disable); |
438 | EXPORT_SYMBOL(snd_dma_pointer); | 451 | EXPORT_SYMBOL(snd_dma_pointer); |
diff --git a/sound/core/sound_oss.c b/sound/core/sound_oss.c index de39d212bc15..e401c6703297 100644 --- a/sound/core/sound_oss.c +++ b/sound/core/sound_oss.c | |||
@@ -98,6 +98,7 @@ int snd_register_oss_device(int type, snd_card_t * card, int dev, snd_minor_t * | |||
98 | int cidx = SNDRV_MINOR_OSS_CARD(minor); | 98 | int cidx = SNDRV_MINOR_OSS_CARD(minor); |
99 | int track2 = -1; | 99 | int track2 = -1; |
100 | int register1 = -1, register2 = -1; | 100 | int register1 = -1, register2 = -1; |
101 | struct device *carddev = NULL; | ||
101 | 102 | ||
102 | if (minor < 0) | 103 | if (minor < 0) |
103 | return minor; | 104 | return minor; |
@@ -121,11 +122,13 @@ int snd_register_oss_device(int type, snd_card_t * card, int dev, snd_minor_t * | |||
121 | track2 = SNDRV_MINOR_OSS(cidx, SNDRV_MINOR_OSS_DMMIDI1); | 122 | track2 = SNDRV_MINOR_OSS(cidx, SNDRV_MINOR_OSS_DMMIDI1); |
122 | break; | 123 | break; |
123 | } | 124 | } |
124 | register1 = register_sound_special(reg->f_ops, minor); | 125 | if (card) |
126 | carddev = card->dev; | ||
127 | register1 = register_sound_special_device(reg->f_ops, minor, carddev); | ||
125 | if (register1 != minor) | 128 | if (register1 != minor) |
126 | goto __end; | 129 | goto __end; |
127 | if (track2 >= 0) { | 130 | if (track2 >= 0) { |
128 | register2 = register_sound_special(reg->f_ops, track2); | 131 | register2 = register_sound_special_device(reg->f_ops, track2, carddev); |
129 | if (register2 != track2) | 132 | if (register2 != track2) |
130 | goto __end; | 133 | goto __end; |
131 | } | 134 | } |
diff --git a/sound/core/timer.c b/sound/core/timer.c index cfaccd415b3b..22b104624084 100644 --- a/sound/core/timer.c +++ b/sound/core/timer.c | |||
@@ -98,7 +98,7 @@ static void snd_timer_reschedule(snd_timer_t * timer, unsigned long ticks_left); | |||
98 | static snd_timer_instance_t *snd_timer_instance_new(char *owner, snd_timer_t *timer) | 98 | static snd_timer_instance_t *snd_timer_instance_new(char *owner, snd_timer_t *timer) |
99 | { | 99 | { |
100 | snd_timer_instance_t *timeri; | 100 | snd_timer_instance_t *timeri; |
101 | timeri = kcalloc(1, sizeof(*timeri), GFP_KERNEL); | 101 | timeri = kzalloc(sizeof(*timeri), GFP_KERNEL); |
102 | if (timeri == NULL) | 102 | if (timeri == NULL) |
103 | return NULL; | 103 | return NULL; |
104 | timeri->owner = kstrdup(owner, GFP_KERNEL); | 104 | timeri->owner = kstrdup(owner, GFP_KERNEL); |
@@ -764,7 +764,7 @@ int snd_timer_new(snd_card_t *card, char *id, snd_timer_id_t *tid, snd_timer_t * | |||
764 | snd_assert(tid != NULL, return -EINVAL); | 764 | snd_assert(tid != NULL, return -EINVAL); |
765 | snd_assert(rtimer != NULL, return -EINVAL); | 765 | snd_assert(rtimer != NULL, return -EINVAL); |
766 | *rtimer = NULL; | 766 | *rtimer = NULL; |
767 | timer = kcalloc(1, sizeof(*timer), GFP_KERNEL); | 767 | timer = kzalloc(sizeof(*timer), GFP_KERNEL); |
768 | if (timer == NULL) | 768 | if (timer == NULL) |
769 | return -ENOMEM; | 769 | return -ENOMEM; |
770 | timer->tmr_class = tid->dev_class; | 770 | timer->tmr_class = tid->dev_class; |
@@ -799,13 +799,13 @@ static int snd_timer_free(snd_timer_t *timer) | |||
799 | return 0; | 799 | return 0; |
800 | } | 800 | } |
801 | 801 | ||
802 | int snd_timer_dev_free(snd_device_t *device) | 802 | static int snd_timer_dev_free(snd_device_t *device) |
803 | { | 803 | { |
804 | snd_timer_t *timer = device->device_data; | 804 | snd_timer_t *timer = device->device_data; |
805 | return snd_timer_free(timer); | 805 | return snd_timer_free(timer); |
806 | } | 806 | } |
807 | 807 | ||
808 | int snd_timer_dev_register(snd_device_t *dev) | 808 | static int snd_timer_dev_register(snd_device_t *dev) |
809 | { | 809 | { |
810 | snd_timer_t *timer = dev->device_data; | 810 | snd_timer_t *timer = dev->device_data; |
811 | snd_timer_t *timer1; | 811 | snd_timer_t *timer1; |
@@ -880,9 +880,11 @@ void snd_timer_notify(snd_timer_t *timer, enum sndrv_timer_event event, struct t | |||
880 | struct list_head *p, *n; | 880 | struct list_head *p, *n; |
881 | 881 | ||
882 | snd_runtime_check(timer->hw.flags & SNDRV_TIMER_HW_SLAVE, return); | 882 | snd_runtime_check(timer->hw.flags & SNDRV_TIMER_HW_SLAVE, return); |
883 | snd_assert(event >= SNDRV_TIMER_EVENT_MSTART && event <= SNDRV_TIMER_EVENT_MPAUSE, return); | 883 | snd_assert(event >= SNDRV_TIMER_EVENT_MSTART && event <= SNDRV_TIMER_EVENT_MRESUME, return); |
884 | spin_lock_irqsave(&timer->lock, flags); | 884 | spin_lock_irqsave(&timer->lock, flags); |
885 | if (event == SNDRV_TIMER_EVENT_MSTART || event == SNDRV_TIMER_EVENT_MCONTINUE) { | 885 | if (event == SNDRV_TIMER_EVENT_MSTART || |
886 | event == SNDRV_TIMER_EVENT_MCONTINUE || | ||
887 | event == SNDRV_TIMER_EVENT_MRESUME) { | ||
886 | if (timer->hw.c_resolution) | 888 | if (timer->hw.c_resolution) |
887 | resolution = timer->hw.c_resolution(timer); | 889 | resolution = timer->hw.c_resolution(timer); |
888 | else | 890 | else |
@@ -1015,7 +1017,7 @@ static int snd_timer_register_system(void) | |||
1015 | return err; | 1017 | return err; |
1016 | strcpy(timer->name, "system timer"); | 1018 | strcpy(timer->name, "system timer"); |
1017 | timer->hw = snd_timer_system; | 1019 | timer->hw = snd_timer_system; |
1018 | priv = kcalloc(1, sizeof(*priv), GFP_KERNEL); | 1020 | priv = kzalloc(sizeof(*priv), GFP_KERNEL); |
1019 | if (priv == NULL) { | 1021 | if (priv == NULL) { |
1020 | snd_timer_free(timer); | 1022 | snd_timer_free(timer); |
1021 | return -ENOMEM; | 1023 | return -ENOMEM; |
@@ -1200,7 +1202,7 @@ static int snd_timer_user_open(struct inode *inode, struct file *file) | |||
1200 | { | 1202 | { |
1201 | snd_timer_user_t *tu; | 1203 | snd_timer_user_t *tu; |
1202 | 1204 | ||
1203 | tu = kcalloc(1, sizeof(*tu), GFP_KERNEL); | 1205 | tu = kzalloc(sizeof(*tu), GFP_KERNEL); |
1204 | if (tu == NULL) | 1206 | if (tu == NULL) |
1205 | return -ENOMEM; | 1207 | return -ENOMEM; |
1206 | spin_lock_init(&tu->qlock); | 1208 | spin_lock_init(&tu->qlock); |
@@ -1511,7 +1513,7 @@ static int snd_timer_user_info(struct file *file, snd_timer_info_t __user *_info | |||
1511 | t = tu->timeri->timer; | 1513 | t = tu->timeri->timer; |
1512 | snd_assert(t != NULL, return -ENXIO); | 1514 | snd_assert(t != NULL, return -ENXIO); |
1513 | 1515 | ||
1514 | info = kcalloc(1, sizeof(*info), GFP_KERNEL); | 1516 | info = kzalloc(sizeof(*info), GFP_KERNEL); |
1515 | if (! info) | 1517 | if (! info) |
1516 | return -ENOMEM; | 1518 | return -ENOMEM; |
1517 | info->card = t->card ? t->card->number : -1; | 1519 | info->card = t->card ? t->card->number : -1; |
@@ -1555,10 +1557,14 @@ static int snd_timer_user_params(struct file *file, snd_timer_params_t __user *_ | |||
1555 | (1<<SNDRV_TIMER_EVENT_STOP)| | 1557 | (1<<SNDRV_TIMER_EVENT_STOP)| |
1556 | (1<<SNDRV_TIMER_EVENT_CONTINUE)| | 1558 | (1<<SNDRV_TIMER_EVENT_CONTINUE)| |
1557 | (1<<SNDRV_TIMER_EVENT_PAUSE)| | 1559 | (1<<SNDRV_TIMER_EVENT_PAUSE)| |
1560 | (1<<SNDRV_TIMER_EVENT_SUSPEND)| | ||
1561 | (1<<SNDRV_TIMER_EVENT_RESUME)| | ||
1558 | (1<<SNDRV_TIMER_EVENT_MSTART)| | 1562 | (1<<SNDRV_TIMER_EVENT_MSTART)| |
1559 | (1<<SNDRV_TIMER_EVENT_MSTOP)| | 1563 | (1<<SNDRV_TIMER_EVENT_MSTOP)| |
1560 | (1<<SNDRV_TIMER_EVENT_MCONTINUE)| | 1564 | (1<<SNDRV_TIMER_EVENT_MCONTINUE)| |
1561 | (1<<SNDRV_TIMER_EVENT_MPAUSE))) { | 1565 | (1<<SNDRV_TIMER_EVENT_MPAUSE)| |
1566 | (1<<SNDRV_TIMER_EVENT_MSUSPEND)| | ||
1567 | (1<<SNDRV_TIMER_EVENT_MRESUME))) { | ||
1562 | err = -EINVAL; | 1568 | err = -EINVAL; |
1563 | goto _end; | 1569 | goto _end; |
1564 | } | 1570 | } |
diff --git a/sound/core/wrappers.c b/sound/core/wrappers.c index 508e6d67ee19..296b716f1376 100644 --- a/sound/core/wrappers.c +++ b/sound/core/wrappers.c | |||
@@ -27,7 +27,7 @@ | |||
27 | #include <linux/fs.h> | 27 | #include <linux/fs.h> |
28 | 28 | ||
29 | #ifdef CONFIG_SND_DEBUG_MEMORY | 29 | #ifdef CONFIG_SND_DEBUG_MEMORY |
30 | void *snd_wrapper_kmalloc(size_t size, unsigned int __nocast flags) | 30 | void *snd_wrapper_kmalloc(size_t size, gfp_t flags) |
31 | { | 31 | { |
32 | return kmalloc(size, flags); | 32 | return kmalloc(size, flags); |
33 | } | 33 | } |
diff --git a/sound/drivers/Kconfig b/sound/drivers/Kconfig index 3b2bee19e2c0..efcb4eb2d1a0 100644 --- a/sound/drivers/Kconfig +++ b/sound/drivers/Kconfig | |||
@@ -29,6 +29,7 @@ config SND_DUMMY | |||
29 | tristate "Dummy (/dev/null) soundcard" | 29 | tristate "Dummy (/dev/null) soundcard" |
30 | depends on SND | 30 | depends on SND |
31 | select SND_PCM | 31 | select SND_PCM |
32 | select SND_GENERIC_DRIVER | ||
32 | help | 33 | help |
33 | Say Y here to include the dummy driver. This driver does | 34 | Say Y here to include the dummy driver. This driver does |
34 | nothing, but emulates various mixer controls and PCM devices. | 35 | nothing, but emulates various mixer controls and PCM devices. |
@@ -44,6 +45,7 @@ config SND_VIRMIDI | |||
44 | depends on SND_SEQUENCER | 45 | depends on SND_SEQUENCER |
45 | select SND_TIMER | 46 | select SND_TIMER |
46 | select SND_RAWMIDI | 47 | select SND_RAWMIDI |
48 | select SND_GENERIC_DRIVER | ||
47 | help | 49 | help |
48 | Say Y here to include the virtual MIDI driver. This driver | 50 | Say Y here to include the virtual MIDI driver. This driver |
49 | allows to connect applications using raw MIDI devices to | 51 | allows to connect applications using raw MIDI devices to |
@@ -59,6 +61,7 @@ config SND_MTPAV | |||
59 | depends on SND | 61 | depends on SND |
60 | select SND_TIMER | 62 | select SND_TIMER |
61 | select SND_RAWMIDI | 63 | select SND_RAWMIDI |
64 | select SND_GENERIC_DRIVER | ||
62 | help | 65 | help |
63 | To use a MOTU MidiTimePiece AV multiport MIDI adapter | 66 | To use a MOTU MidiTimePiece AV multiport MIDI adapter |
64 | connected to the parallel port, say Y here and make sure that | 67 | connected to the parallel port, say Y here and make sure that |
@@ -72,6 +75,7 @@ config SND_SERIAL_U16550 | |||
72 | depends on SND | 75 | depends on SND |
73 | select SND_TIMER | 76 | select SND_TIMER |
74 | select SND_RAWMIDI | 77 | select SND_RAWMIDI |
78 | select SND_GENERIC_DRIVER | ||
75 | help | 79 | help |
76 | To include support for MIDI serial port interfaces, say Y here | 80 | To include support for MIDI serial port interfaces, say Y here |
77 | and read <file:Documentation/sound/alsa/serial-u16550.txt>. | 81 | and read <file:Documentation/sound/alsa/serial-u16550.txt>. |
@@ -88,6 +92,7 @@ config SND_MPU401 | |||
88 | tristate "Generic MPU-401 UART driver" | 92 | tristate "Generic MPU-401 UART driver" |
89 | depends on SND | 93 | depends on SND |
90 | select SND_MPU401_UART | 94 | select SND_MPU401_UART |
95 | select SND_GENERIC_DRIVER | ||
91 | help | 96 | help |
92 | Say Y here to include support for MIDI ports compatible with | 97 | Say Y here to include support for MIDI ports compatible with |
93 | the Roland MPU-401 interface in UART mode. | 98 | the Roland MPU-401 interface in UART mode. |
diff --git a/sound/drivers/dummy.c b/sound/drivers/dummy.c index a61640cf7ae7..64ef7f62851d 100644 --- a/sound/drivers/dummy.c +++ b/sound/drivers/dummy.c | |||
@@ -337,7 +337,7 @@ static int snd_card_dummy_playback_open(snd_pcm_substream_t * substream) | |||
337 | snd_card_dummy_pcm_t *dpcm; | 337 | snd_card_dummy_pcm_t *dpcm; |
338 | int err; | 338 | int err; |
339 | 339 | ||
340 | dpcm = kcalloc(1, sizeof(*dpcm), GFP_KERNEL); | 340 | dpcm = kzalloc(sizeof(*dpcm), GFP_KERNEL); |
341 | if (dpcm == NULL) | 341 | if (dpcm == NULL) |
342 | return -ENOMEM; | 342 | return -ENOMEM; |
343 | init_timer(&dpcm->timer); | 343 | init_timer(&dpcm->timer); |
@@ -368,7 +368,7 @@ static int snd_card_dummy_capture_open(snd_pcm_substream_t * substream) | |||
368 | snd_card_dummy_pcm_t *dpcm; | 368 | snd_card_dummy_pcm_t *dpcm; |
369 | int err; | 369 | int err; |
370 | 370 | ||
371 | dpcm = kcalloc(1, sizeof(*dpcm), GFP_KERNEL); | 371 | dpcm = kzalloc(sizeof(*dpcm), GFP_KERNEL); |
372 | if (dpcm == NULL) | 372 | if (dpcm == NULL) |
373 | return -ENOMEM; | 373 | return -ENOMEM; |
374 | init_timer(&dpcm->timer); | 374 | init_timer(&dpcm->timer); |
@@ -600,6 +600,10 @@ static int __init snd_card_dummy_probe(int dev) | |||
600 | strcpy(card->driver, "Dummy"); | 600 | strcpy(card->driver, "Dummy"); |
601 | strcpy(card->shortname, "Dummy"); | 601 | strcpy(card->shortname, "Dummy"); |
602 | sprintf(card->longname, "Dummy %i", dev + 1); | 602 | sprintf(card->longname, "Dummy %i", dev + 1); |
603 | |||
604 | if ((err = snd_card_set_generic_dev(card)) < 0) | ||
605 | goto __nodev; | ||
606 | |||
603 | if ((err = snd_card_register(card)) == 0) { | 607 | if ((err = snd_card_register(card)) == 0) { |
604 | snd_dummy_cards[dev] = card; | 608 | snd_dummy_cards[dev] = card; |
605 | return 0; | 609 | return 0; |
diff --git a/sound/drivers/mpu401/mpu401.c b/sound/drivers/mpu401/mpu401.c index cb36ecb78697..54e2ff9b5ca1 100644 --- a/sound/drivers/mpu401/mpu401.c +++ b/sound/drivers/mpu401/mpu401.c | |||
@@ -77,20 +77,26 @@ static int snd_mpu401_create(int dev, snd_card_t **rcard) | |||
77 | strcat(card->longname, "polled"); | 77 | strcat(card->longname, "polled"); |
78 | } | 78 | } |
79 | 79 | ||
80 | if (snd_mpu401_uart_new(card, 0, | 80 | if ((err = snd_mpu401_uart_new(card, 0, |
81 | MPU401_HW_MPU401, | 81 | MPU401_HW_MPU401, |
82 | port[dev], 0, | 82 | port[dev], 0, |
83 | irq[dev], irq[dev] >= 0 ? SA_INTERRUPT : 0, NULL) < 0) { | 83 | irq[dev], irq[dev] >= 0 ? SA_INTERRUPT : 0, NULL)) < 0) { |
84 | printk(KERN_ERR "MPU401 not detected at 0x%lx\n", port[dev]); | 84 | printk(KERN_ERR "MPU401 not detected at 0x%lx\n", port[dev]); |
85 | snd_card_free(card); | 85 | goto _err; |
86 | return -ENODEV; | ||
87 | } | ||
88 | if ((err = snd_card_register(card)) < 0) { | ||
89 | snd_card_free(card); | ||
90 | return err; | ||
91 | } | 86 | } |
87 | |||
88 | if ((err = snd_card_set_generic_dev(card)) < 0) | ||
89 | goto _err; | ||
90 | |||
91 | if ((err = snd_card_register(card)) < 0) | ||
92 | goto _err; | ||
93 | |||
92 | *rcard = card; | 94 | *rcard = card; |
93 | return 0; | 95 | return 0; |
96 | |||
97 | _err: | ||
98 | snd_card_free(card); | ||
99 | return err; | ||
94 | } | 100 | } |
95 | 101 | ||
96 | static int __devinit snd_mpu401_probe(int dev) | 102 | static int __devinit snd_mpu401_probe(int dev) |
diff --git a/sound/drivers/mpu401/mpu401_uart.c b/sound/drivers/mpu401/mpu401_uart.c index 0f83c5241b6b..fe3f921ffbe3 100644 --- a/sound/drivers/mpu401/mpu401_uart.c +++ b/sound/drivers/mpu401/mpu401_uart.c | |||
@@ -463,7 +463,7 @@ int snd_mpu401_uart_new(snd_card_t * card, int device, | |||
463 | *rrawmidi = NULL; | 463 | *rrawmidi = NULL; |
464 | if ((err = snd_rawmidi_new(card, "MPU-401U", device, 1, 1, &rmidi)) < 0) | 464 | if ((err = snd_rawmidi_new(card, "MPU-401U", device, 1, 1, &rmidi)) < 0) |
465 | return err; | 465 | return err; |
466 | mpu = kcalloc(1, sizeof(*mpu), GFP_KERNEL); | 466 | mpu = kzalloc(sizeof(*mpu), GFP_KERNEL); |
467 | if (mpu == NULL) { | 467 | if (mpu == NULL) { |
468 | snd_device_free(card, rmidi); | 468 | snd_device_free(card, rmidi); |
469 | return -ENOMEM; | 469 | return -ENOMEM; |
diff --git a/sound/drivers/mtpav.c b/sound/drivers/mtpav.c index 1280a57c49eb..3a25c89d2983 100644 --- a/sound/drivers/mtpav.c +++ b/sound/drivers/mtpav.c | |||
@@ -688,7 +688,7 @@ static int snd_mtpav_get_RAWMIDI(mtpav_t * mcard) | |||
688 | 688 | ||
689 | static mtpav_t *new_mtpav(void) | 689 | static mtpav_t *new_mtpav(void) |
690 | { | 690 | { |
691 | mtpav_t *ncrd = kcalloc(1, sizeof(*ncrd), GFP_KERNEL); | 691 | mtpav_t *ncrd = kzalloc(sizeof(*ncrd), GFP_KERNEL); |
692 | if (ncrd != NULL) { | 692 | if (ncrd != NULL) { |
693 | spin_lock_init(&ncrd->spinlock); | 693 | spin_lock_init(&ncrd->spinlock); |
694 | 694 | ||
@@ -757,6 +757,9 @@ static int __init alsa_card_mtpav_init(void) | |||
757 | if (err < 0) | 757 | if (err < 0) |
758 | goto __error; | 758 | goto __error; |
759 | 759 | ||
760 | if ((err = snd_card_set_generic_dev(mtp_card->card)) < 0) | ||
761 | goto __error; | ||
762 | |||
760 | err = snd_card_register(mtp_card->card); // don't snd_card_register until AFTER all cards reources done! | 763 | err = snd_card_register(mtp_card->card); // don't snd_card_register until AFTER all cards reources done! |
761 | 764 | ||
762 | //printk("snd_card_register returned %d\n", err); | 765 | //printk("snd_card_register returned %d\n", err); |
diff --git a/sound/drivers/opl3/opl3_lib.c b/sound/drivers/opl3/opl3_lib.c index c313e5205cb8..1f84d78260de 100644 --- a/sound/drivers/opl3/opl3_lib.c +++ b/sound/drivers/opl3/opl3_lib.c | |||
@@ -354,7 +354,7 @@ int snd_opl3_new(snd_card_t *card, | |||
354 | int err; | 354 | int err; |
355 | 355 | ||
356 | *ropl3 = NULL; | 356 | *ropl3 = NULL; |
357 | opl3 = kcalloc(1, sizeof(*opl3), GFP_KERNEL); | 357 | opl3 = kzalloc(sizeof(*opl3), GFP_KERNEL); |
358 | if (opl3 == NULL) | 358 | if (opl3 == NULL) |
359 | return -ENOMEM; | 359 | return -ENOMEM; |
360 | 360 | ||
diff --git a/sound/drivers/opl3/opl3_oss.c b/sound/drivers/opl3/opl3_oss.c index 33da334ae981..21a2b409d6d3 100644 --- a/sound/drivers/opl3/opl3_oss.c +++ b/sound/drivers/opl3/opl3_oss.c | |||
@@ -241,7 +241,7 @@ static int snd_opl3_load_patch_seq_oss(snd_seq_oss_arg_t *arg, int format, | |||
241 | } | 241 | } |
242 | 242 | ||
243 | size = sizeof(*put) + sizeof(fm_xinstrument_t); | 243 | size = sizeof(*put) + sizeof(fm_xinstrument_t); |
244 | put = kcalloc(1, size, GFP_KERNEL); | 244 | put = kzalloc(size, GFP_KERNEL); |
245 | if (put == NULL) | 245 | if (put == NULL) |
246 | return -ENOMEM; | 246 | return -ENOMEM; |
247 | /* build header */ | 247 | /* build header */ |
diff --git a/sound/drivers/opl4/opl4_lib.c b/sound/drivers/opl4/opl4_lib.c index 8261464dade8..380c2c704c54 100644 --- a/sound/drivers/opl4/opl4_lib.c +++ b/sound/drivers/opl4/opl4_lib.c | |||
@@ -204,7 +204,7 @@ int snd_opl4_create(snd_card_t *card, | |||
204 | if (ropl4) | 204 | if (ropl4) |
205 | *ropl4 = NULL; | 205 | *ropl4 = NULL; |
206 | 206 | ||
207 | opl4 = kcalloc(1, sizeof(*opl4), GFP_KERNEL); | 207 | opl4 = kzalloc(sizeof(*opl4), GFP_KERNEL); |
208 | if (!opl4) | 208 | if (!opl4) |
209 | return -ENOMEM; | 209 | return -ENOMEM; |
210 | 210 | ||
diff --git a/sound/drivers/serial-u16550.c b/sound/drivers/serial-u16550.c index 986df35fb829..416172ea1f47 100644 --- a/sound/drivers/serial-u16550.c +++ b/sound/drivers/serial-u16550.c | |||
@@ -779,7 +779,7 @@ static int __init snd_uart16550_create(snd_card_t * card, | |||
779 | int err; | 779 | int err; |
780 | 780 | ||
781 | 781 | ||
782 | if ((uart = kcalloc(1, sizeof(*uart), GFP_KERNEL)) == NULL) | 782 | if ((uart = kzalloc(sizeof(*uart), GFP_KERNEL)) == NULL) |
783 | return -ENOMEM; | 783 | return -ENOMEM; |
784 | uart->adaptor = adaptor; | 784 | uart->adaptor = adaptor; |
785 | uart->card = card; | 785 | uart->card = card; |
@@ -928,15 +928,11 @@ static int __init snd_serial_probe(int dev) | |||
928 | base[dev], | 928 | base[dev], |
929 | adaptor[dev], | 929 | adaptor[dev], |
930 | droponfull[dev], | 930 | droponfull[dev], |
931 | &uart)) < 0) { | 931 | &uart)) < 0) |
932 | snd_card_free(card); | 932 | goto _err; |
933 | return err; | ||
934 | } | ||
935 | 933 | ||
936 | if ((err = snd_uart16550_rmidi(uart, 0, outs[dev], ins[dev], &uart->rmidi)) < 0) { | 934 | if ((err = snd_uart16550_rmidi(uart, 0, outs[dev], ins[dev], &uart->rmidi)) < 0) |
937 | snd_card_free(card); | 935 | goto _err; |
938 | return err; | ||
939 | } | ||
940 | 936 | ||
941 | sprintf(card->longname, "%s at 0x%lx, irq %d speed %d div %d outs %d ins %d adaptor %s droponfull %d", | 937 | sprintf(card->longname, "%s at 0x%lx, irq %d speed %d div %d outs %d ins %d adaptor %s droponfull %d", |
942 | card->shortname, | 938 | card->shortname, |
@@ -949,12 +945,18 @@ static int __init snd_serial_probe(int dev) | |||
949 | adaptor_names[uart->adaptor], | 945 | adaptor_names[uart->adaptor], |
950 | uart->drop_on_full); | 946 | uart->drop_on_full); |
951 | 947 | ||
952 | if ((err = snd_card_register(card)) < 0) { | 948 | if ((err = snd_card_set_generic_dev(card)) < 0) |
953 | snd_card_free(card); | 949 | goto _err; |
954 | return err; | 950 | |
955 | } | 951 | if ((err = snd_card_register(card)) < 0) |
952 | goto _err; | ||
953 | |||
956 | snd_serial_cards[dev] = card; | 954 | snd_serial_cards[dev] = card; |
957 | return 0; | 955 | return 0; |
956 | |||
957 | _err: | ||
958 | snd_card_free(card); | ||
959 | return err; | ||
958 | } | 960 | } |
959 | 961 | ||
960 | static int __init alsa_card_serial_init(void) | 962 | static int __init alsa_card_serial_init(void) |
diff --git a/sound/drivers/virmidi.c b/sound/drivers/virmidi.c index 5937711e9505..af12185ab8a2 100644 --- a/sound/drivers/virmidi.c +++ b/sound/drivers/virmidi.c | |||
@@ -116,6 +116,10 @@ static int __init snd_card_virmidi_probe(int dev) | |||
116 | strcpy(card->driver, "VirMIDI"); | 116 | strcpy(card->driver, "VirMIDI"); |
117 | strcpy(card->shortname, "VirMIDI"); | 117 | strcpy(card->shortname, "VirMIDI"); |
118 | sprintf(card->longname, "Virtual MIDI Card %i", dev + 1); | 118 | sprintf(card->longname, "Virtual MIDI Card %i", dev + 1); |
119 | |||
120 | if ((err = snd_card_set_generic_dev(card)) < 0) | ||
121 | goto __nodev; | ||
122 | |||
119 | if ((err = snd_card_register(card)) == 0) { | 123 | if ((err = snd_card_register(card)) == 0) { |
120 | snd_virmidi_cards[dev] = card; | 124 | snd_virmidi_cards[dev] = card; |
121 | return 0; | 125 | return 0; |
diff --git a/sound/drivers/vx/vx_core.c b/sound/drivers/vx/vx_core.c index c6fa5afa3e9a..4697b1d75cbb 100644 --- a/sound/drivers/vx/vx_core.c +++ b/sound/drivers/vx/vx_core.c | |||
@@ -782,7 +782,7 @@ vx_core_t *snd_vx_create(snd_card_t *card, struct snd_vx_hardware *hw, | |||
782 | 782 | ||
783 | snd_assert(card && hw && ops, return NULL); | 783 | snd_assert(card && hw && ops, return NULL); |
784 | 784 | ||
785 | chip = kcalloc(1, sizeof(*chip) + extra_size, GFP_KERNEL); | 785 | chip = kzalloc(sizeof(*chip) + extra_size, GFP_KERNEL); |
786 | if (! chip) { | 786 | if (! chip) { |
787 | snd_printk(KERN_ERR "vx_core: no memory\n"); | 787 | snd_printk(KERN_ERR "vx_core: no memory\n"); |
788 | return NULL; | 788 | return NULL; |
diff --git a/sound/drivers/vx/vx_mixer.c b/sound/drivers/vx/vx_mixer.c index f00c88886460..19fc68c23378 100644 --- a/sound/drivers/vx/vx_mixer.c +++ b/sound/drivers/vx/vx_mixer.c | |||
@@ -796,14 +796,14 @@ static int vx_iec958_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontro | |||
796 | 796 | ||
797 | static snd_kcontrol_new_t vx_control_iec958_mask = { | 797 | static snd_kcontrol_new_t vx_control_iec958_mask = { |
798 | .access = SNDRV_CTL_ELEM_ACCESS_READ, | 798 | .access = SNDRV_CTL_ELEM_ACCESS_READ, |
799 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 799 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, |
800 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,MASK), | 800 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,MASK), |
801 | .info = vx_iec958_info, /* shared */ | 801 | .info = vx_iec958_info, /* shared */ |
802 | .get = vx_iec958_mask_get, | 802 | .get = vx_iec958_mask_get, |
803 | }; | 803 | }; |
804 | 804 | ||
805 | static snd_kcontrol_new_t vx_control_iec958 = { | 805 | static snd_kcontrol_new_t vx_control_iec958 = { |
806 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 806 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, |
807 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,DEFAULT), | 807 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,DEFAULT), |
808 | .info = vx_iec958_info, | 808 | .info = vx_iec958_info, |
809 | .get = vx_iec958_get, | 809 | .get = vx_iec958_get, |
diff --git a/sound/drivers/vx/vx_pcm.c b/sound/drivers/vx/vx_pcm.c index af381b15fe5c..c2312d912fc7 100644 --- a/sound/drivers/vx/vx_pcm.c +++ b/sound/drivers/vx/vx_pcm.c | |||
@@ -473,7 +473,7 @@ static int vx_alloc_pipe(vx_core_t *chip, int capture, | |||
473 | return err; | 473 | return err; |
474 | 474 | ||
475 | /* initialize the pipe record */ | 475 | /* initialize the pipe record */ |
476 | pipe = kcalloc(1, sizeof(*pipe), GFP_KERNEL); | 476 | pipe = kzalloc(sizeof(*pipe), GFP_KERNEL); |
477 | if (! pipe) { | 477 | if (! pipe) { |
478 | /* release the pipe */ | 478 | /* release the pipe */ |
479 | vx_init_rmh(&rmh, CMD_FREE_PIPE); | 479 | vx_init_rmh(&rmh, CMD_FREE_PIPE); |
@@ -549,8 +549,8 @@ static int vx_stop_stream(vx_core_t *chip, vx_pipe_t *pipe) | |||
549 | 549 | ||
550 | static snd_pcm_hardware_t vx_pcm_playback_hw = { | 550 | static snd_pcm_hardware_t vx_pcm_playback_hw = { |
551 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | | 551 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | |
552 | SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_MMAP_VALID | | 552 | SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_MMAP_VALID /*|*/ |
553 | SNDRV_PCM_INFO_RESUME), | 553 | /*SNDRV_PCM_INFO_RESUME*/), |
554 | .formats = /*SNDRV_PCM_FMTBIT_U8 |*/ SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_3LE, | 554 | .formats = /*SNDRV_PCM_FMTBIT_U8 |*/ SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_3LE, |
555 | .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000, | 555 | .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000, |
556 | .rate_min = 5000, | 556 | .rate_min = 5000, |
@@ -949,8 +949,8 @@ static snd_pcm_ops_t vx_pcm_playback_ops = { | |||
949 | 949 | ||
950 | static snd_pcm_hardware_t vx_pcm_capture_hw = { | 950 | static snd_pcm_hardware_t vx_pcm_capture_hw = { |
951 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | | 951 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | |
952 | SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_MMAP_VALID | | 952 | SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_MMAP_VALID /*|*/ |
953 | SNDRV_PCM_INFO_RESUME), | 953 | /*SNDRV_PCM_INFO_RESUME*/), |
954 | .formats = /*SNDRV_PCM_FMTBIT_U8 |*/ SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_3LE, | 954 | .formats = /*SNDRV_PCM_FMTBIT_U8 |*/ SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_3LE, |
955 | .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000, | 955 | .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000, |
956 | .rate_min = 5000, | 956 | .rate_min = 5000, |
diff --git a/sound/i2c/cs8427.c b/sound/i2c/cs8427.c index a3fda859dd15..a21f7d541f86 100644 --- a/sound/i2c/cs8427.c +++ b/sound/i2c/cs8427.c | |||
@@ -200,7 +200,7 @@ int snd_cs8427_create(snd_i2c_bus_t *bus, | |||
200 | 200 | ||
201 | if ((err = snd_i2c_device_create(bus, "CS8427", CS8427_ADDR | (addr & 7), &device)) < 0) | 201 | if ((err = snd_i2c_device_create(bus, "CS8427", CS8427_ADDR | (addr & 7), &device)) < 0) |
202 | return err; | 202 | return err; |
203 | chip = device->private_data = kcalloc(1, sizeof(*chip), GFP_KERNEL); | 203 | chip = device->private_data = kzalloc(sizeof(*chip), GFP_KERNEL); |
204 | if (chip == NULL) { | 204 | if (chip == NULL) { |
205 | snd_i2c_device_free(device); | 205 | snd_i2c_device_free(device); |
206 | return -ENOMEM; | 206 | return -ENOMEM; |
diff --git a/sound/i2c/i2c.c b/sound/i2c/i2c.c index e8fa7e1a68e8..e4e505b9d88b 100644 --- a/sound/i2c/i2c.c +++ b/sound/i2c/i2c.c | |||
@@ -81,7 +81,7 @@ int snd_i2c_bus_create(snd_card_t *card, const char *name, snd_i2c_bus_t *master | |||
81 | }; | 81 | }; |
82 | 82 | ||
83 | *ri2c = NULL; | 83 | *ri2c = NULL; |
84 | bus = kcalloc(1, sizeof(*bus), GFP_KERNEL); | 84 | bus = kzalloc(sizeof(*bus), GFP_KERNEL); |
85 | if (bus == NULL) | 85 | if (bus == NULL) |
86 | return -ENOMEM; | 86 | return -ENOMEM; |
87 | init_MUTEX(&bus->lock_mutex); | 87 | init_MUTEX(&bus->lock_mutex); |
@@ -108,7 +108,7 @@ int snd_i2c_device_create(snd_i2c_bus_t *bus, const char *name, unsigned char ad | |||
108 | 108 | ||
109 | *rdevice = NULL; | 109 | *rdevice = NULL; |
110 | snd_assert(bus != NULL, return -EINVAL); | 110 | snd_assert(bus != NULL, return -EINVAL); |
111 | device = kcalloc(1, sizeof(*device), GFP_KERNEL); | 111 | device = kzalloc(sizeof(*device), GFP_KERNEL); |
112 | if (device == NULL) | 112 | if (device == NULL) |
113 | return -ENOMEM; | 113 | return -ENOMEM; |
114 | device->addr = addr; | 114 | device->addr = addr; |
diff --git a/sound/i2c/l3/uda1341.c b/sound/i2c/l3/uda1341.c index e13122f3fc50..103a7dcd0dde 100644 --- a/sound/i2c/l3/uda1341.c +++ b/sound/i2c/l3/uda1341.c | |||
@@ -17,7 +17,7 @@ | |||
17 | * 2002-05-12 Tomas Kasparek another code cleanup | 17 | * 2002-05-12 Tomas Kasparek another code cleanup |
18 | */ | 18 | */ |
19 | 19 | ||
20 | /* $Id: uda1341.c,v 1.15 2005/01/03 12:05:20 tiwai Exp $ */ | 20 | /* $Id: uda1341.c,v 1.16 2005/09/09 13:22:34 tiwai Exp $ */ |
21 | 21 | ||
22 | #include <sound/driver.h> | 22 | #include <sound/driver.h> |
23 | #include <linux/module.h> | 23 | #include <linux/module.h> |
@@ -670,7 +670,7 @@ int __init snd_chip_uda1341_mixer_new(snd_card_t *card, struct l3_client **clnt) | |||
670 | 670 | ||
671 | snd_assert(card != NULL, return -EINVAL); | 671 | snd_assert(card != NULL, return -EINVAL); |
672 | 672 | ||
673 | uda1341 = kcalloc(1, sizeof(*uda1341), GFP_KERNEL); | 673 | uda1341 = kzalloc(sizeof(*uda1341), GFP_KERNEL); |
674 | if (uda1341 == NULL) | 674 | if (uda1341 == NULL) |
675 | return -ENOMEM; | 675 | return -ENOMEM; |
676 | 676 | ||
@@ -707,7 +707,7 @@ static int uda1341_attach(struct l3_client *clnt) | |||
707 | { | 707 | { |
708 | struct uda1341 *uda; | 708 | struct uda1341 *uda; |
709 | 709 | ||
710 | uda = kcalloc(1, sizeof(*uda), 0, GFP_KERNEL); | 710 | uda = kzalloc(sizeof(*uda), 0, GFP_KERNEL); |
711 | if (!uda) | 711 | if (!uda) |
712 | return -ENOMEM; | 712 | return -ENOMEM; |
713 | 713 | ||
diff --git a/sound/i2c/other/ak4114.c b/sound/i2c/other/ak4114.c index 5adde308a00f..af5eadcddd92 100644 --- a/sound/i2c/other/ak4114.c +++ b/sound/i2c/other/ak4114.c | |||
@@ -92,7 +92,7 @@ int snd_ak4114_create(snd_card_t *card, | |||
92 | .dev_free = snd_ak4114_dev_free, | 92 | .dev_free = snd_ak4114_dev_free, |
93 | }; | 93 | }; |
94 | 94 | ||
95 | chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); | 95 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); |
96 | if (chip == NULL) | 96 | if (chip == NULL) |
97 | return -ENOMEM; | 97 | return -ENOMEM; |
98 | spin_lock_init(&chip->lock); | 98 | spin_lock_init(&chip->lock); |
diff --git a/sound/i2c/other/ak4117.c b/sound/i2c/other/ak4117.c index 0419c4336a55..d51b51dd86d6 100644 --- a/sound/i2c/other/ak4117.c +++ b/sound/i2c/other/ak4117.c | |||
@@ -83,7 +83,7 @@ int snd_ak4117_create(snd_card_t *card, ak4117_read_t *read, ak4117_write_t *wri | |||
83 | .dev_free = snd_ak4117_dev_free, | 83 | .dev_free = snd_ak4117_dev_free, |
84 | }; | 84 | }; |
85 | 85 | ||
86 | chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); | 86 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); |
87 | if (chip == NULL) | 87 | if (chip == NULL) |
88 | return -ENOMEM; | 88 | return -ENOMEM; |
89 | spin_lock_init(&chip->lock); | 89 | spin_lock_init(&chip->lock); |
diff --git a/sound/i2c/tea6330t.c b/sound/i2c/tea6330t.c index 2da8d7f157f4..fd65da654267 100644 --- a/sound/i2c/tea6330t.c +++ b/sound/i2c/tea6330t.c | |||
@@ -281,7 +281,7 @@ int snd_tea6330t_update_mixer(snd_card_t * card, | |||
281 | u8 default_treble, default_bass; | 281 | u8 default_treble, default_bass; |
282 | unsigned char bytes[7]; | 282 | unsigned char bytes[7]; |
283 | 283 | ||
284 | tea = kcalloc(1, sizeof(*tea), GFP_KERNEL); | 284 | tea = kzalloc(sizeof(*tea), GFP_KERNEL); |
285 | if (tea == NULL) | 285 | if (tea == NULL) |
286 | return -ENOMEM; | 286 | return -ENOMEM; |
287 | if ((err = snd_i2c_device_create(bus, "TEA6330T", TEA6330T_ADDR, &device)) < 0) { | 287 | if ((err = snd_i2c_device_create(bus, "TEA6330T", TEA6330T_ADDR, &device)) < 0) { |
diff --git a/sound/isa/Kconfig b/sound/isa/Kconfig index 148a856a43ad..5d6c300ac0d5 100644 --- a/sound/isa/Kconfig +++ b/sound/isa/Kconfig | |||
@@ -1,21 +1,22 @@ | |||
1 | # ALSA ISA drivers | 1 | # ALSA ISA drivers |
2 | 2 | ||
3 | menu "ISA devices" | 3 | menu "ISA devices" |
4 | depends on SND!=n && ISA | 4 | depends on SND!=n && ISA && ISA_DMA_API |
5 | 5 | ||
6 | config SND_AD1848_LIB | 6 | config SND_AD1848_LIB |
7 | tristate | 7 | tristate |
8 | select SND_PCM | 8 | select SND_PCM |
9 | select SND_GENERIC_PM | 9 | select SND_GENERIC_DRIVER |
10 | 10 | ||
11 | config SND_CS4231_LIB | 11 | config SND_CS4231_LIB |
12 | tristate | 12 | tristate |
13 | select SND_PCM | 13 | select SND_PCM |
14 | select SND_GENERIC_PM | 14 | select SND_GENERIC_DRIVER |
15 | 15 | ||
16 | config SND_AD1816A | 16 | config SND_AD1816A |
17 | tristate "Analog Devices SoundPort AD1816A" | 17 | tristate "Analog Devices SoundPort AD1816A" |
18 | depends on SND && ISAPNP | 18 | depends on SND && PNP && ISA |
19 | select ISAPNP | ||
19 | select SND_OPL3_LIB | 20 | select SND_OPL3_LIB |
20 | select SND_MPU401_UART | 21 | select SND_MPU401_UART |
21 | select SND_PCM | 22 | select SND_PCM |
@@ -80,7 +81,8 @@ config SND_CS4236 | |||
80 | 81 | ||
81 | config SND_ES968 | 82 | config SND_ES968 |
82 | tristate "Generic ESS ES968 driver" | 83 | tristate "Generic ESS ES968 driver" |
83 | depends on SND && ISAPNP | 84 | depends on SND && PNP && ISA |
85 | select ISAPNP | ||
84 | select SND_MPU401_UART | 86 | select SND_MPU401_UART |
85 | select SND_PCM | 87 | select SND_PCM |
86 | help | 88 | help |
@@ -95,6 +97,7 @@ config SND_ES1688 | |||
95 | select SND_OPL3_LIB | 97 | select SND_OPL3_LIB |
96 | select SND_MPU401_UART | 98 | select SND_MPU401_UART |
97 | select SND_PCM | 99 | select SND_PCM |
100 | select SND_GENERIC_DRIVER | ||
98 | help | 101 | help |
99 | Say Y here to include support for ESS AudioDrive ES688 or | 102 | Say Y here to include support for ESS AudioDrive ES688 or |
100 | ES1688 chips. | 103 | ES1688 chips. |
@@ -108,7 +111,7 @@ config SND_ES18XX | |||
108 | select SND_OPL3_LIB | 111 | select SND_OPL3_LIB |
109 | select SND_MPU401_UART | 112 | select SND_MPU401_UART |
110 | select SND_PCM | 113 | select SND_PCM |
111 | select SND_GENERIC_PM | 114 | select SND_GENERIC_DRIVER |
112 | help | 115 | help |
113 | Say Y here to include support for ESS AudioDrive ES18xx chips. | 116 | Say Y here to include support for ESS AudioDrive ES18xx chips. |
114 | 117 | ||
@@ -124,6 +127,7 @@ config SND_GUSCLASSIC | |||
124 | select SND_RAWMIDI | 127 | select SND_RAWMIDI |
125 | select SND_PCM | 128 | select SND_PCM |
126 | select SND_GUS_SYNTH | 129 | select SND_GUS_SYNTH |
130 | select SND_GENERIC_DRIVER | ||
127 | help | 131 | help |
128 | Say Y here to include support for Gravis UltraSound Classic | 132 | Say Y here to include support for Gravis UltraSound Classic |
129 | soundcards. | 133 | soundcards. |
@@ -138,6 +142,7 @@ config SND_GUSEXTREME | |||
138 | select SND_MPU401_UART | 142 | select SND_MPU401_UART |
139 | select SND_PCM | 143 | select SND_PCM |
140 | select SND_GUS_SYNTH | 144 | select SND_GUS_SYNTH |
145 | select SND_GENERIC_DRIVER | ||
141 | help | 146 | help |
142 | Say Y here to include support for Gravis UltraSound Extreme | 147 | Say Y here to include support for Gravis UltraSound Extreme |
143 | soundcards. | 148 | soundcards. |
@@ -151,6 +156,7 @@ config SND_GUSMAX | |||
151 | select SND_RAWMIDI | 156 | select SND_RAWMIDI |
152 | select SND_CS4231_LIB | 157 | select SND_CS4231_LIB |
153 | select SND_GUS_SYNTH | 158 | select SND_GUS_SYNTH |
159 | select SND_GENERIC_DRIVER | ||
154 | help | 160 | help |
155 | Say Y here to include support for Gravis UltraSound MAX | 161 | Say Y here to include support for Gravis UltraSound MAX |
156 | soundcards. | 162 | soundcards. |
@@ -160,11 +166,11 @@ config SND_GUSMAX | |||
160 | 166 | ||
161 | config SND_INTERWAVE | 167 | config SND_INTERWAVE |
162 | tristate "AMD InterWave, Gravis UltraSound PnP" | 168 | tristate "AMD InterWave, Gravis UltraSound PnP" |
163 | depends on SND | 169 | depends on SND && PNP && ISA |
164 | select SND_RAWMIDI | 170 | select SND_RAWMIDI |
165 | select SND_CS4231_LIB | 171 | select SND_CS4231_LIB |
166 | select SND_GUS_SYNTH | 172 | select SND_GUS_SYNTH |
167 | select ISAPNP | 173 | select SND_GENERIC_DRIVER |
168 | help | 174 | help |
169 | Say Y here to include support for AMD InterWave based | 175 | Say Y here to include support for AMD InterWave based |
170 | soundcards (Gravis UltraSound Plug & Play, STB SoundRage32, | 176 | soundcards (Gravis UltraSound Plug & Play, STB SoundRage32, |
@@ -175,11 +181,11 @@ config SND_INTERWAVE | |||
175 | 181 | ||
176 | config SND_INTERWAVE_STB | 182 | config SND_INTERWAVE_STB |
177 | tristate "AMD InterWave + TEA6330T (UltraSound 32-Pro)" | 183 | tristate "AMD InterWave + TEA6330T (UltraSound 32-Pro)" |
178 | depends on SND | 184 | depends on SND && PNP && ISA |
179 | select SND_RAWMIDI | 185 | select SND_RAWMIDI |
180 | select SND_CS4231_LIB | 186 | select SND_CS4231_LIB |
181 | select SND_GUS_SYNTH | 187 | select SND_GUS_SYNTH |
182 | select ISAPNP | 188 | select SND_GENERIC_DRIVER |
183 | help | 189 | help |
184 | Say Y here to include support for AMD InterWave based | 190 | Say Y here to include support for AMD InterWave based |
185 | soundcards with a TEA6330T bass and treble regulator | 191 | soundcards with a TEA6330T bass and treble regulator |
@@ -222,6 +228,7 @@ config SND_OPTI93X | |||
222 | select SND_OPL3_LIB | 228 | select SND_OPL3_LIB |
223 | select SND_MPU401_UART | 229 | select SND_MPU401_UART |
224 | select SND_PCM | 230 | select SND_PCM |
231 | select SND_GENERIC_DRIVER | ||
225 | help | 232 | help |
226 | Say Y here to include support for soundcards based on Opti | 233 | Say Y here to include support for soundcards based on Opti |
227 | 82C93x chips. | 234 | 82C93x chips. |
@@ -235,6 +242,7 @@ config SND_SB8 | |||
235 | select SND_OPL3_LIB | 242 | select SND_OPL3_LIB |
236 | select SND_RAWMIDI | 243 | select SND_RAWMIDI |
237 | select SND_PCM | 244 | select SND_PCM |
245 | select SND_GENERIC_DRIVER | ||
238 | help | 246 | help |
239 | Say Y here to include support for Creative Sound Blaster 1.0/ | 247 | Say Y here to include support for Creative Sound Blaster 1.0/ |
240 | 2.0/Pro (8-bit) or 100% compatible soundcards. | 248 | 2.0/Pro (8-bit) or 100% compatible soundcards. |
@@ -248,6 +256,7 @@ config SND_SB16 | |||
248 | select SND_OPL3_LIB | 256 | select SND_OPL3_LIB |
249 | select SND_MPU401_UART | 257 | select SND_MPU401_UART |
250 | select SND_PCM | 258 | select SND_PCM |
259 | select SND_GENERIC_DRIVER | ||
251 | help | 260 | help |
252 | Say Y here to include support for Sound Blaster 16 soundcards | 261 | Say Y here to include support for Sound Blaster 16 soundcards |
253 | (including the Plug and Play version). | 262 | (including the Plug and Play version). |
@@ -261,6 +270,7 @@ config SND_SBAWE | |||
261 | select SND_OPL3_LIB | 270 | select SND_OPL3_LIB |
262 | select SND_MPU401_UART | 271 | select SND_MPU401_UART |
263 | select SND_PCM | 272 | select SND_PCM |
273 | select SND_GENERIC_DRIVER | ||
264 | help | 274 | help |
265 | Say Y here to include support for Sound Blaster AWE soundcards | 275 | Say Y here to include support for Sound Blaster AWE soundcards |
266 | (including the Plug and Play version). | 276 | (including the Plug and Play version). |
@@ -291,7 +301,8 @@ config SND_WAVEFRONT | |||
291 | 301 | ||
292 | config SND_ALS100 | 302 | config SND_ALS100 |
293 | tristate "Avance Logic ALS100/ALS120" | 303 | tristate "Avance Logic ALS100/ALS120" |
294 | depends on SND && ISAPNP | 304 | depends on SND && PNP && ISA |
305 | select ISAPNP | ||
295 | select SND_OPL3_LIB | 306 | select SND_OPL3_LIB |
296 | select SND_MPU401_UART | 307 | select SND_MPU401_UART |
297 | select SND_PCM | 308 | select SND_PCM |
@@ -304,7 +315,8 @@ config SND_ALS100 | |||
304 | 315 | ||
305 | config SND_AZT2320 | 316 | config SND_AZT2320 |
306 | tristate "Aztech Systems AZT2320" | 317 | tristate "Aztech Systems AZT2320" |
307 | depends on SND && ISAPNP | 318 | depends on SND && PNP && ISA |
319 | select ISAPNP | ||
308 | select SND_OPL3_LIB | 320 | select SND_OPL3_LIB |
309 | select SND_MPU401_UART | 321 | select SND_MPU401_UART |
310 | select SND_CS4231_LIB | 322 | select SND_CS4231_LIB |
@@ -328,7 +340,8 @@ config SND_CMI8330 | |||
328 | 340 | ||
329 | config SND_DT019X | 341 | config SND_DT019X |
330 | tristate "Diamond Technologies DT-019X, Avance Logic ALS-007" | 342 | tristate "Diamond Technologies DT-019X, Avance Logic ALS-007" |
331 | depends on SND && ISAPNP | 343 | depends on SND && PNP && ISA |
344 | select ISAPNP | ||
332 | select SND_OPL3_LIB | 345 | select SND_OPL3_LIB |
333 | select SND_MPU401_UART | 346 | select SND_MPU401_UART |
334 | select SND_PCM | 347 | select SND_PCM |
diff --git a/sound/isa/ad1816a/ad1816a.c b/sound/isa/ad1816a/ad1816a.c index 563296d02894..0eb442ca23d6 100644 --- a/sound/isa/ad1816a/ad1816a.c +++ b/sound/isa/ad1816a/ad1816a.c | |||
@@ -53,6 +53,7 @@ static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* Pnp setup */ | |||
53 | static int mpu_irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* Pnp setup */ | 53 | static int mpu_irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* Pnp setup */ |
54 | static int dma1[SNDRV_CARDS] = SNDRV_DEFAULT_DMA; /* PnP setup */ | 54 | static int dma1[SNDRV_CARDS] = SNDRV_DEFAULT_DMA; /* PnP setup */ |
55 | static int dma2[SNDRV_CARDS] = SNDRV_DEFAULT_DMA; /* PnP setup */ | 55 | static int dma2[SNDRV_CARDS] = SNDRV_DEFAULT_DMA; /* PnP setup */ |
56 | static int clockfreq[SNDRV_CARDS]; | ||
56 | 57 | ||
57 | module_param_array(index, int, NULL, 0444); | 58 | module_param_array(index, int, NULL, 0444); |
58 | MODULE_PARM_DESC(index, "Index value for ad1816a based soundcard."); | 59 | MODULE_PARM_DESC(index, "Index value for ad1816a based soundcard."); |
@@ -74,6 +75,8 @@ module_param_array(dma1, int, NULL, 0444); | |||
74 | MODULE_PARM_DESC(dma1, "1st DMA # for ad1816a driver."); | 75 | MODULE_PARM_DESC(dma1, "1st DMA # for ad1816a driver."); |
75 | module_param_array(dma2, int, NULL, 0444); | 76 | module_param_array(dma2, int, NULL, 0444); |
76 | MODULE_PARM_DESC(dma2, "2nd DMA # for ad1816a driver."); | 77 | MODULE_PARM_DESC(dma2, "2nd DMA # for ad1816a driver."); |
78 | module_param_array(clockfreq, int, NULL, 0444); | ||
79 | MODULE_PARM_DESC(clockfreq, "Clock frequency for ad1816a driver (default = 0)."); | ||
77 | 80 | ||
78 | struct snd_card_ad1816a { | 81 | struct snd_card_ad1816a { |
79 | struct pnp_dev *dev; | 82 | struct pnp_dev *dev; |
@@ -209,6 +212,8 @@ static int __devinit snd_card_ad1816a_probe(int dev, struct pnp_card_link *pcard | |||
209 | snd_card_free(card); | 212 | snd_card_free(card); |
210 | return error; | 213 | return error; |
211 | } | 214 | } |
215 | if (clockfreq[dev] >= 5000 && clockfreq[dev] <= 100000) | ||
216 | chip->clock_freq = clockfreq[dev]; | ||
212 | 217 | ||
213 | strcpy(card->driver, "AD1816A"); | 218 | strcpy(card->driver, "AD1816A"); |
214 | strcpy(card->shortname, "ADI SoundPort AD1816A"); | 219 | strcpy(card->shortname, "ADI SoundPort AD1816A"); |
diff --git a/sound/isa/ad1816a/ad1816a_lib.c b/sound/isa/ad1816a/ad1816a_lib.c index 625b2eff14a1..27a9dcfbba00 100644 --- a/sound/isa/ad1816a/ad1816a_lib.c +++ b/sound/isa/ad1816a/ad1816a_lib.c | |||
@@ -234,7 +234,7 @@ static int snd_ad1816a_playback_prepare(snd_pcm_substream_t *substream) | |||
234 | ad1816a_t *chip = snd_pcm_substream_chip(substream); | 234 | ad1816a_t *chip = snd_pcm_substream_chip(substream); |
235 | unsigned long flags; | 235 | unsigned long flags; |
236 | snd_pcm_runtime_t *runtime = substream->runtime; | 236 | snd_pcm_runtime_t *runtime = substream->runtime; |
237 | unsigned int size; | 237 | unsigned int size, rate; |
238 | 238 | ||
239 | spin_lock_irqsave(&chip->lock, flags); | 239 | spin_lock_irqsave(&chip->lock, flags); |
240 | 240 | ||
@@ -245,7 +245,10 @@ static int snd_ad1816a_playback_prepare(snd_pcm_substream_t *substream) | |||
245 | snd_dma_program(chip->dma1, runtime->dma_addr, size, | 245 | snd_dma_program(chip->dma1, runtime->dma_addr, size, |
246 | DMA_MODE_WRITE | DMA_AUTOINIT); | 246 | DMA_MODE_WRITE | DMA_AUTOINIT); |
247 | 247 | ||
248 | snd_ad1816a_write(chip, AD1816A_PLAYBACK_SAMPLE_RATE, runtime->rate); | 248 | rate = runtime->rate; |
249 | if (chip->clock_freq) | ||
250 | rate = (rate * 33000) / chip->clock_freq; | ||
251 | snd_ad1816a_write(chip, AD1816A_PLAYBACK_SAMPLE_RATE, rate); | ||
249 | snd_ad1816a_out_mask(chip, AD1816A_PLAYBACK_CONFIG, | 252 | snd_ad1816a_out_mask(chip, AD1816A_PLAYBACK_CONFIG, |
250 | AD1816A_FMT_ALL | AD1816A_FMT_STEREO, | 253 | AD1816A_FMT_ALL | AD1816A_FMT_STEREO, |
251 | snd_ad1816a_get_format(chip, runtime->format, | 254 | snd_ad1816a_get_format(chip, runtime->format, |
@@ -263,7 +266,7 @@ static int snd_ad1816a_capture_prepare(snd_pcm_substream_t *substream) | |||
263 | ad1816a_t *chip = snd_pcm_substream_chip(substream); | 266 | ad1816a_t *chip = snd_pcm_substream_chip(substream); |
264 | unsigned long flags; | 267 | unsigned long flags; |
265 | snd_pcm_runtime_t *runtime = substream->runtime; | 268 | snd_pcm_runtime_t *runtime = substream->runtime; |
266 | unsigned int size; | 269 | unsigned int size, rate; |
267 | 270 | ||
268 | spin_lock_irqsave(&chip->lock, flags); | 271 | spin_lock_irqsave(&chip->lock, flags); |
269 | 272 | ||
@@ -274,7 +277,10 @@ static int snd_ad1816a_capture_prepare(snd_pcm_substream_t *substream) | |||
274 | snd_dma_program(chip->dma2, runtime->dma_addr, size, | 277 | snd_dma_program(chip->dma2, runtime->dma_addr, size, |
275 | DMA_MODE_READ | DMA_AUTOINIT); | 278 | DMA_MODE_READ | DMA_AUTOINIT); |
276 | 279 | ||
277 | snd_ad1816a_write(chip, AD1816A_CAPTURE_SAMPLE_RATE, runtime->rate); | 280 | rate = runtime->rate; |
281 | if (chip->clock_freq) | ||
282 | rate = (rate * 33000) / chip->clock_freq; | ||
283 | snd_ad1816a_write(chip, AD1816A_CAPTURE_SAMPLE_RATE, rate); | ||
278 | snd_ad1816a_out_mask(chip, AD1816A_CAPTURE_CONFIG, | 284 | snd_ad1816a_out_mask(chip, AD1816A_CAPTURE_CONFIG, |
279 | AD1816A_FMT_ALL | AD1816A_FMT_STEREO, | 285 | AD1816A_FMT_ALL | AD1816A_FMT_STEREO, |
280 | snd_ad1816a_get_format(chip, runtime->format, | 286 | snd_ad1816a_get_format(chip, runtime->format, |
@@ -585,7 +591,7 @@ int snd_ad1816a_create(snd_card_t *card, | |||
585 | 591 | ||
586 | *rchip = NULL; | 592 | *rchip = NULL; |
587 | 593 | ||
588 | chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); | 594 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); |
589 | if (chip == NULL) | 595 | if (chip == NULL) |
590 | return -ENOMEM; | 596 | return -ENOMEM; |
591 | chip->irq = -1; | 597 | chip->irq = -1; |
diff --git a/sound/isa/ad1848/ad1848.c b/sound/isa/ad1848/ad1848.c index 8c399340cd72..3ebcc482b07a 100644 --- a/sound/isa/ad1848/ad1848.c +++ b/sound/isa/ad1848/ad1848.c | |||
@@ -91,35 +91,36 @@ static int __init snd_card_ad1848_probe(int dev) | |||
91 | irq[dev], | 91 | irq[dev], |
92 | dma1[dev], | 92 | dma1[dev], |
93 | thinkpad[dev] ? AD1848_HW_THINKPAD : AD1848_HW_DETECT, | 93 | thinkpad[dev] ? AD1848_HW_THINKPAD : AD1848_HW_DETECT, |
94 | &chip)) < 0) { | 94 | &chip)) < 0) |
95 | snd_card_free(card); | 95 | goto _err; |
96 | return err; | 96 | |
97 | } | 97 | if ((err = snd_ad1848_pcm(chip, 0, &pcm)) < 0) |
98 | goto _err; | ||
99 | |||
100 | if ((err = snd_ad1848_mixer(chip)) < 0) | ||
101 | goto _err; | ||
98 | 102 | ||
99 | if ((err = snd_ad1848_pcm(chip, 0, &pcm)) < 0) { | ||
100 | snd_card_free(card); | ||
101 | return err; | ||
102 | } | ||
103 | if ((err = snd_ad1848_mixer(chip)) < 0) { | ||
104 | snd_card_free(card); | ||
105 | return err; | ||
106 | } | ||
107 | strcpy(card->driver, "AD1848"); | 103 | strcpy(card->driver, "AD1848"); |
108 | strcpy(card->shortname, pcm->name); | 104 | strcpy(card->shortname, pcm->name); |
109 | 105 | ||
110 | sprintf(card->longname, "%s at 0x%lx, irq %d, dma %d", | 106 | sprintf(card->longname, "%s at 0x%lx, irq %d, dma %d", |
111 | pcm->name, chip->port, irq[dev], dma1[dev]); | 107 | pcm->name, chip->port, irq[dev], dma1[dev]); |
112 | 108 | ||
113 | if (thinkpad[dev]) { | 109 | if (thinkpad[dev]) |
114 | strcat(card->longname, " [Thinkpad]"); | 110 | strcat(card->longname, " [Thinkpad]"); |
115 | } | ||
116 | 111 | ||
117 | if ((err = snd_card_register(card)) < 0) { | 112 | if ((err = snd_card_set_generic_dev(card)) < 0) |
118 | snd_card_free(card); | 113 | goto _err; |
119 | return err; | 114 | |
120 | } | 115 | if ((err = snd_card_register(card)) < 0) |
116 | goto _err; | ||
117 | |||
121 | snd_ad1848_cards[dev] = card; | 118 | snd_ad1848_cards[dev] = card; |
122 | return 0; | 119 | return 0; |
120 | |||
121 | _err: | ||
122 | snd_card_free(card); | ||
123 | return err; | ||
123 | } | 124 | } |
124 | 125 | ||
125 | static int __init alsa_card_ad1848_init(void) | 126 | static int __init alsa_card_ad1848_init(void) |
diff --git a/sound/isa/ad1848/ad1848_lib.c b/sound/isa/ad1848/ad1848_lib.c index 8fb3db103e48..303861cd03cd 100644 --- a/sound/isa/ad1848/ad1848_lib.c +++ b/sound/isa/ad1848/ad1848_lib.c | |||
@@ -890,7 +890,7 @@ int snd_ad1848_create(snd_card_t * card, | |||
890 | int err; | 890 | int err; |
891 | 891 | ||
892 | *rchip = NULL; | 892 | *rchip = NULL; |
893 | chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); | 893 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); |
894 | if (chip == NULL) | 894 | if (chip == NULL) |
895 | return -ENOMEM; | 895 | return -ENOMEM; |
896 | spin_lock_init(&chip->reg_lock); | 896 | spin_lock_init(&chip->reg_lock); |
@@ -1196,6 +1196,7 @@ int snd_ad1848_add_ctl(ad1848_t *chip, const char *name, int index, int type, un | |||
1196 | .put = snd_ad1848_put_double, | 1196 | .put = snd_ad1848_put_double, |
1197 | }, | 1197 | }, |
1198 | [AD1848_MIX_CAPTURE] = { | 1198 | [AD1848_MIX_CAPTURE] = { |
1199 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
1199 | .info = snd_ad1848_info_mux, | 1200 | .info = snd_ad1848_info_mux, |
1200 | .get = snd_ad1848_get_mux, | 1201 | .get = snd_ad1848_get_mux, |
1201 | .put = snd_ad1848_put_mux, | 1202 | .put = snd_ad1848_put_mux, |
diff --git a/sound/isa/cmi8330.c b/sound/isa/cmi8330.c index 46776cc0c157..5252206ea388 100644 --- a/sound/isa/cmi8330.c +++ b/sound/isa/cmi8330.c | |||
@@ -194,8 +194,8 @@ AD1848_DOUBLE("Wavetable Capture Volume", 0, CMI8330_WAVGAIN, CMI8330_WAVGAIN, 4 | |||
194 | AD1848_SINGLE("3D Control - Switch", 0, CMI8330_RMUX3D, 5, 1, 1), | 194 | AD1848_SINGLE("3D Control - Switch", 0, CMI8330_RMUX3D, 5, 1, 1), |
195 | AD1848_SINGLE("PC Speaker Playback Volume", 0, CMI8330_OUTPUTVOL, 3, 3, 0), | 195 | AD1848_SINGLE("PC Speaker Playback Volume", 0, CMI8330_OUTPUTVOL, 3, 3, 0), |
196 | AD1848_SINGLE("FM Playback Switch", 0, CMI8330_RECMUX, 3, 1, 1), | 196 | AD1848_SINGLE("FM Playback Switch", 0, CMI8330_RECMUX, 3, 1, 1), |
197 | AD1848_SINGLE("IEC958 Input Capture Switch", 0, CMI8330_RMUX3D, 7, 1, 1), | 197 | AD1848_SINGLE(SNDRV_CTL_NAME_IEC958("Input ",CAPTURE,SWITCH), 0, CMI8330_RMUX3D, 7, 1, 1), |
198 | AD1848_SINGLE("IEC958 Input Playback Switch", 0, CMI8330_MUTEMUX, 7, 1, 1), | 198 | AD1848_SINGLE(SNDRV_CTL_NAME_IEC958("Input ",PLAYBACK,SWITCH), 0, CMI8330_MUTEMUX, 7, 1, 1), |
199 | }; | 199 | }; |
200 | 200 | ||
201 | #ifdef ENABLE_SB_MIXER | 201 | #ifdef ENABLE_SB_MIXER |
@@ -438,33 +438,37 @@ static int __devinit snd_cmi8330_pcm(snd_card_t *card, struct snd_cmi8330 *chip) | |||
438 | /* | 438 | /* |
439 | */ | 439 | */ |
440 | 440 | ||
441 | #ifdef CONFIG_PNP | ||
442 | #define is_isapnp_selected(dev) isapnp[dev] | ||
443 | #else | ||
444 | #define is_isapnp_selected(dev) 0 | ||
445 | #endif | ||
446 | |||
447 | #define PFX "cmi8330: " | ||
448 | |||
441 | static int __devinit snd_cmi8330_probe(int dev, | 449 | static int __devinit snd_cmi8330_probe(int dev, |
442 | struct pnp_card_link *pcard, | 450 | struct pnp_card_link *pcard, |
443 | const struct pnp_card_device_id *pid) | 451 | const struct pnp_card_device_id *pid) |
444 | { | 452 | { |
445 | snd_card_t *card; | 453 | snd_card_t *card; |
446 | struct snd_cmi8330 *acard; | 454 | struct snd_cmi8330 *acard; |
447 | unsigned long flags; | ||
448 | int i, err; | 455 | int i, err; |
449 | 456 | ||
450 | #ifdef CONFIG_PNP | 457 | if (! is_isapnp_selected(dev)) { |
451 | if (!isapnp[dev]) { | ||
452 | #endif | ||
453 | if (wssport[dev] == SNDRV_AUTO_PORT) { | 458 | if (wssport[dev] == SNDRV_AUTO_PORT) { |
454 | snd_printk("specify wssport\n"); | 459 | snd_printk(KERN_ERR PFX "specify wssport\n"); |
455 | return -EINVAL; | 460 | return -EINVAL; |
456 | } | 461 | } |
457 | if (sbport[dev] == SNDRV_AUTO_PORT) { | 462 | if (sbport[dev] == SNDRV_AUTO_PORT) { |
458 | snd_printk("specify sbport\n"); | 463 | snd_printk(KERN_ERR PFX "specify sbport\n"); |
459 | return -EINVAL; | 464 | return -EINVAL; |
460 | } | 465 | } |
461 | #ifdef CONFIG_PNP | ||
462 | } | 466 | } |
463 | #endif | 467 | |
464 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, | 468 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, |
465 | sizeof(struct snd_cmi8330)); | 469 | sizeof(struct snd_cmi8330)); |
466 | if (card == NULL) { | 470 | if (card == NULL) { |
467 | snd_printk("could not get a new card\n"); | 471 | snd_printk(KERN_ERR PFX "could not get a new card\n"); |
468 | return -ENOMEM; | 472 | return -ENOMEM; |
469 | } | 473 | } |
470 | acard = (struct snd_cmi8330 *)card->private_data; | 474 | acard = (struct snd_cmi8330 *)card->private_data; |
@@ -473,9 +477,8 @@ static int __devinit snd_cmi8330_probe(int dev, | |||
473 | #ifdef CONFIG_PNP | 477 | #ifdef CONFIG_PNP |
474 | if (isapnp[dev]) { | 478 | if (isapnp[dev]) { |
475 | if ((err = snd_cmi8330_pnp(dev, acard, pcard, pid)) < 0) { | 479 | if ((err = snd_cmi8330_pnp(dev, acard, pcard, pid)) < 0) { |
476 | snd_printk("PnP detection failed\n"); | 480 | snd_printk(KERN_ERR PFX "PnP detection failed\n"); |
477 | snd_card_free(card); | 481 | goto _err; |
478 | return err; | ||
479 | } | 482 | } |
480 | snd_card_set_dev(card, &pcard->card->dev); | 483 | snd_card_set_dev(card, &pcard->card->dev); |
481 | } | 484 | } |
@@ -487,14 +490,13 @@ static int __devinit snd_cmi8330_probe(int dev, | |||
487 | wssdma[dev], | 490 | wssdma[dev], |
488 | AD1848_HW_DETECT, | 491 | AD1848_HW_DETECT, |
489 | &acard->wss)) < 0) { | 492 | &acard->wss)) < 0) { |
490 | snd_printk("(AD1848) device busy??\n"); | 493 | snd_printk(KERN_ERR PFX "(AD1848) device busy??\n"); |
491 | snd_card_free(card); | 494 | goto _err; |
492 | return err; | ||
493 | } | 495 | } |
494 | if (acard->wss->hardware != AD1848_HW_CMI8330) { | 496 | if (acard->wss->hardware != AD1848_HW_CMI8330) { |
495 | snd_printk("(AD1848) not found during probe\n"); | 497 | snd_printk(KERN_ERR PFX "(AD1848) not found during probe\n"); |
496 | snd_card_free(card); | 498 | err = -ENODEV; |
497 | return -ENODEV; | 499 | goto _err; |
498 | } | 500 | } |
499 | 501 | ||
500 | if ((err = snd_sbdsp_create(card, sbport[dev], | 502 | if ((err = snd_sbdsp_create(card, sbport[dev], |
@@ -503,32 +505,26 @@ static int __devinit snd_cmi8330_probe(int dev, | |||
503 | sbdma8[dev], | 505 | sbdma8[dev], |
504 | sbdma16[dev], | 506 | sbdma16[dev], |
505 | SB_HW_AUTO, &acard->sb)) < 0) { | 507 | SB_HW_AUTO, &acard->sb)) < 0) { |
506 | snd_printk("(SB16) device busy??\n"); | 508 | snd_printk(KERN_ERR PFX "(SB16) device busy??\n"); |
507 | snd_card_free(card); | 509 | goto _err; |
508 | return err; | ||
509 | } | 510 | } |
510 | if (acard->sb->hardware != SB_HW_16) { | 511 | if (acard->sb->hardware != SB_HW_16) { |
511 | snd_printk("(SB16) not found during probe\n"); | 512 | snd_printk(KERN_ERR PFX "(SB16) not found during probe\n"); |
512 | snd_card_free(card); | 513 | goto _err; |
513 | return -ENODEV; | ||
514 | } | 514 | } |
515 | 515 | ||
516 | spin_lock_irqsave(&acard->wss->reg_lock, flags); | ||
517 | snd_ad1848_out(acard->wss, AD1848_MISC_INFO, 0x40); /* switch on MODE2 */ | 516 | snd_ad1848_out(acard->wss, AD1848_MISC_INFO, 0x40); /* switch on MODE2 */ |
518 | for (i = CMI8330_RMUX3D; i <= CMI8330_CDINGAIN; i++) | 517 | for (i = CMI8330_RMUX3D; i <= CMI8330_CDINGAIN; i++) |
519 | snd_ad1848_out(acard->wss, i, snd_cmi8330_image[i - CMI8330_RMUX3D]); | 518 | snd_ad1848_out(acard->wss, i, snd_cmi8330_image[i - CMI8330_RMUX3D]); |
520 | spin_unlock_irqrestore(&acard->wss->reg_lock, flags); | ||
521 | 519 | ||
522 | if ((err = snd_cmi8330_mixer(card, acard)) < 0) { | 520 | if ((err = snd_cmi8330_mixer(card, acard)) < 0) { |
523 | snd_printk("failed to create mixers\n"); | 521 | snd_printk(KERN_ERR PFX "failed to create mixers\n"); |
524 | snd_card_free(card); | 522 | goto _err; |
525 | return err; | ||
526 | } | 523 | } |
527 | 524 | ||
528 | if ((err = snd_cmi8330_pcm(card, acard)) < 0) { | 525 | if ((err = snd_cmi8330_pcm(card, acard)) < 0) { |
529 | snd_printk("failed to create pcms\n"); | 526 | snd_printk(KERN_ERR PFX "failed to create pcms\n"); |
530 | snd_card_free(card); | 527 | goto _err; |
531 | return err; | ||
532 | } | 528 | } |
533 | 529 | ||
534 | strcpy(card->driver, "CMI8330/C3D"); | 530 | strcpy(card->driver, "CMI8330/C3D"); |
@@ -539,16 +535,21 @@ static int __devinit snd_cmi8330_probe(int dev, | |||
539 | wssirq[dev], | 535 | wssirq[dev], |
540 | wssdma[dev]); | 536 | wssdma[dev]); |
541 | 537 | ||
542 | if ((err = snd_card_register(card)) < 0) { | 538 | if ((err = snd_card_set_generic_dev(card)) < 0) |
543 | snd_card_free(card); | 539 | goto _err; |
544 | return err; | 540 | |
545 | } | 541 | if ((err = snd_card_register(card)) < 0) |
542 | goto _err; | ||
546 | 543 | ||
547 | if (pcard) | 544 | if (pcard) |
548 | pnp_set_card_drvdata(pcard, card); | 545 | pnp_set_card_drvdata(pcard, card); |
549 | else | 546 | else |
550 | snd_cmi8330_legacy[dev] = card; | 547 | snd_cmi8330_legacy[dev] = card; |
551 | return 0; | 548 | return 0; |
549 | |||
550 | _err: | ||
551 | snd_card_free(card); | ||
552 | return err; | ||
552 | } | 553 | } |
553 | 554 | ||
554 | #ifdef CONFIG_PNP | 555 | #ifdef CONFIG_PNP |
@@ -594,10 +595,8 @@ static int __init alsa_card_cmi8330_init(void) | |||
594 | for (dev = 0; dev < SNDRV_CARDS; dev++) { | 595 | for (dev = 0; dev < SNDRV_CARDS; dev++) { |
595 | if (!enable[dev]) | 596 | if (!enable[dev]) |
596 | continue; | 597 | continue; |
597 | #ifdef CONFIG_PNP | 598 | if (is_isapnp_selected(dev)) |
598 | if (isapnp[dev]) | ||
599 | continue; | 599 | continue; |
600 | #endif | ||
601 | if (snd_cmi8330_probe(dev, NULL, NULL) >= 0) | 600 | if (snd_cmi8330_probe(dev, NULL, NULL) >= 0) |
602 | cards++; | 601 | cards++; |
603 | } | 602 | } |
diff --git a/sound/isa/cs423x/cs4231.c b/sound/isa/cs423x/cs4231.c index 7640837659ea..9be5416bcb92 100644 --- a/sound/isa/cs423x/cs4231.c +++ b/sound/isa/cs423x/cs4231.c | |||
@@ -76,15 +76,15 @@ static int __init snd_card_cs4231_probe(int dev) | |||
76 | int err; | 76 | int err; |
77 | 77 | ||
78 | if (port[dev] == SNDRV_AUTO_PORT) { | 78 | if (port[dev] == SNDRV_AUTO_PORT) { |
79 | snd_printk("specify port\n"); | 79 | snd_printk(KERN_ERR "specify port\n"); |
80 | return -EINVAL; | 80 | return -EINVAL; |
81 | } | 81 | } |
82 | if (irq[dev] == SNDRV_AUTO_IRQ) { | 82 | if (irq[dev] == SNDRV_AUTO_IRQ) { |
83 | snd_printk("specify irq\n"); | 83 | snd_printk(KERN_ERR "specify irq\n"); |
84 | return -EINVAL; | 84 | return -EINVAL; |
85 | } | 85 | } |
86 | if (dma1[dev] == SNDRV_AUTO_DMA) { | 86 | if (dma1[dev] == SNDRV_AUTO_DMA) { |
87 | snd_printk("specify dma1\n"); | 87 | snd_printk(KERN_ERR "specify dma1\n"); |
88 | return -EINVAL; | 88 | return -EINVAL; |
89 | } | 89 | } |
90 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 90 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); |
@@ -96,15 +96,11 @@ static int __init snd_card_cs4231_probe(int dev) | |||
96 | dma1[dev], | 96 | dma1[dev], |
97 | dma2[dev], | 97 | dma2[dev], |
98 | CS4231_HW_DETECT, | 98 | CS4231_HW_DETECT, |
99 | 0, &chip)) < 0) { | 99 | 0, &chip)) < 0) |
100 | snd_card_free(card); | 100 | goto _err; |
101 | return err; | ||
102 | } | ||
103 | 101 | ||
104 | if ((err = snd_cs4231_pcm(chip, 0, &pcm)) < 0) { | 102 | if ((err = snd_cs4231_pcm(chip, 0, &pcm)) < 0) |
105 | snd_card_free(card); | 103 | goto _err; |
106 | return err; | ||
107 | } | ||
108 | 104 | ||
109 | strcpy(card->driver, "CS4231"); | 105 | strcpy(card->driver, "CS4231"); |
110 | strcpy(card->shortname, pcm->name); | 106 | strcpy(card->shortname, pcm->name); |
@@ -113,14 +109,10 @@ static int __init snd_card_cs4231_probe(int dev) | |||
113 | if (dma2[dev] >= 0) | 109 | if (dma2[dev] >= 0) |
114 | sprintf(card->longname + strlen(card->longname), "&%d", dma2[dev]); | 110 | sprintf(card->longname + strlen(card->longname), "&%d", dma2[dev]); |
115 | 111 | ||
116 | if ((err = snd_cs4231_mixer(chip)) < 0) { | 112 | if ((err = snd_cs4231_mixer(chip)) < 0) |
117 | snd_card_free(card); | 113 | goto _err; |
118 | return err; | 114 | if ((err = snd_cs4231_timer(chip, 0, NULL)) < 0) |
119 | } | 115 | goto _err; |
120 | if ((err = snd_cs4231_timer(chip, 0, NULL)) < 0) { | ||
121 | snd_card_free(card); | ||
122 | return err; | ||
123 | } | ||
124 | 116 | ||
125 | if (mpu_port[dev] > 0 && mpu_port[dev] != SNDRV_AUTO_PORT) { | 117 | if (mpu_port[dev] > 0 && mpu_port[dev] != SNDRV_AUTO_PORT) { |
126 | if (mpu_irq[dev] == SNDRV_AUTO_IRQ) | 118 | if (mpu_irq[dev] == SNDRV_AUTO_IRQ) |
@@ -130,14 +122,20 @@ static int __init snd_card_cs4231_probe(int dev) | |||
130 | mpu_irq[dev], | 122 | mpu_irq[dev], |
131 | mpu_irq[dev] >= 0 ? SA_INTERRUPT : 0, | 123 | mpu_irq[dev] >= 0 ? SA_INTERRUPT : 0, |
132 | NULL) < 0) | 124 | NULL) < 0) |
133 | printk(KERN_ERR "cs4231: MPU401 not detected\n"); | 125 | printk(KERN_WARNING "cs4231: MPU401 not detected\n"); |
134 | } | ||
135 | if ((err = snd_card_register(card)) < 0) { | ||
136 | snd_card_free(card); | ||
137 | return err; | ||
138 | } | 126 | } |
127 | |||
128 | if ((err = snd_card_set_generic_dev(card)) < 0) | ||
129 | goto _err; | ||
130 | |||
131 | if ((err = snd_card_register(card)) < 0) | ||
132 | goto _err; | ||
139 | snd_cs4231_cards[dev] = card; | 133 | snd_cs4231_cards[dev] = card; |
140 | return 0; | 134 | return 0; |
135 | |||
136 | _err: | ||
137 | snd_card_free(card); | ||
138 | return err; | ||
141 | } | 139 | } |
142 | 140 | ||
143 | static int __init alsa_card_cs4231_init(void) | 141 | static int __init alsa_card_cs4231_init(void) |
diff --git a/sound/isa/cs423x/cs4231_lib.c b/sound/isa/cs423x/cs4231_lib.c index 3e7a2a33a5ca..32318258cd8e 100644 --- a/sound/isa/cs423x/cs4231_lib.c +++ b/sound/isa/cs423x/cs4231_lib.c | |||
@@ -1346,6 +1346,8 @@ static void snd_cs4231_suspend(cs4231_t *chip) | |||
1346 | int reg; | 1346 | int reg; |
1347 | unsigned long flags; | 1347 | unsigned long flags; |
1348 | 1348 | ||
1349 | if (chip->pcm) | ||
1350 | snd_pcm_suspend_all(chip->pcm); | ||
1349 | spin_lock_irqsave(&chip->reg_lock, flags); | 1351 | spin_lock_irqsave(&chip->reg_lock, flags); |
1350 | for (reg = 0; reg < 32; reg++) | 1352 | for (reg = 0; reg < 32; reg++) |
1351 | chip->image[reg] = snd_cs4231_in(chip, reg); | 1353 | chip->image[reg] = snd_cs4231_in(chip, reg); |
@@ -1478,7 +1480,7 @@ static int snd_cs4231_new(snd_card_t * card, | |||
1478 | cs4231_t *chip; | 1480 | cs4231_t *chip; |
1479 | 1481 | ||
1480 | *rchip = NULL; | 1482 | *rchip = NULL; |
1481 | chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); | 1483 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); |
1482 | if (chip == NULL) | 1484 | if (chip == NULL) |
1483 | return -ENOMEM; | 1485 | return -ENOMEM; |
1484 | chip->hardware = hardware; | 1486 | chip->hardware = hardware; |
diff --git a/sound/isa/cs423x/cs4236.c b/sound/isa/cs423x/cs4236.c index 39f4eff44f5c..d28315dc72f7 100644 --- a/sound/isa/cs423x/cs4236.c +++ b/sound/isa/cs423x/cs4236.c | |||
@@ -387,6 +387,12 @@ static void snd_card_cs4236_free(snd_card_t *card) | |||
387 | } | 387 | } |
388 | } | 388 | } |
389 | 389 | ||
390 | #ifdef CONFIG_PNP | ||
391 | #define is_isapnp_selected(dev) isapnp[dev] | ||
392 | #else | ||
393 | #define is_isapnp_selected(dev) 0 | ||
394 | #endif | ||
395 | |||
390 | static int __devinit snd_card_cs423x_probe(int dev, struct pnp_card_link *pcard, | 396 | static int __devinit snd_card_cs423x_probe(int dev, struct pnp_card_link *pcard, |
391 | const struct pnp_card_device_id *pid) | 397 | const struct pnp_card_device_id *pid) |
392 | { | 398 | { |
@@ -397,20 +403,16 @@ static int __devinit snd_card_cs423x_probe(int dev, struct pnp_card_link *pcard, | |||
397 | opl3_t *opl3; | 403 | opl3_t *opl3; |
398 | int err; | 404 | int err; |
399 | 405 | ||
400 | #ifdef CONFIG_PNP | 406 | if (! is_isapnp_selected(dev)) { |
401 | if (!isapnp[dev]) { | ||
402 | #endif | ||
403 | if (port[dev] == SNDRV_AUTO_PORT) { | 407 | if (port[dev] == SNDRV_AUTO_PORT) { |
404 | snd_printk("specify port\n"); | 408 | snd_printk(KERN_ERR "specify port\n"); |
405 | return -EINVAL; | 409 | return -EINVAL; |
406 | } | 410 | } |
407 | if (cport[dev] == SNDRV_AUTO_PORT) { | 411 | if (cport[dev] == SNDRV_AUTO_PORT) { |
408 | snd_printk("specify cport\n"); | 412 | snd_printk(KERN_ERR "specify cport\n"); |
409 | return -EINVAL; | 413 | return -EINVAL; |
410 | } | 414 | } |
411 | #ifdef CONFIG_PNP | ||
412 | } | 415 | } |
413 | #endif | ||
414 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, | 416 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, |
415 | sizeof(struct snd_card_cs4236)); | 417 | sizeof(struct snd_card_cs4236)); |
416 | if (card == NULL) | 418 | if (card == NULL) |
@@ -421,8 +423,7 @@ static int __devinit snd_card_cs423x_probe(int dev, struct pnp_card_link *pcard, | |||
421 | if (isapnp[dev]) { | 423 | if (isapnp[dev]) { |
422 | if ((err = snd_card_cs4236_pnp(dev, acard, pcard, pid))<0) { | 424 | if ((err = snd_card_cs4236_pnp(dev, acard, pcard, pid))<0) { |
423 | printk(KERN_ERR "isapnp detection failed and probing for " IDENT " is not supported\n"); | 425 | printk(KERN_ERR "isapnp detection failed and probing for " IDENT " is not supported\n"); |
424 | snd_card_free(card); | 426 | goto _err; |
425 | return -ENXIO; | ||
426 | } | 427 | } |
427 | snd_card_set_dev(card, &pcard->card->dev); | 428 | snd_card_set_dev(card, &pcard->card->dev); |
428 | } | 429 | } |
@@ -430,8 +431,8 @@ static int __devinit snd_card_cs423x_probe(int dev, struct pnp_card_link *pcard, | |||
430 | if (sb_port[dev] > 0 && sb_port[dev] != SNDRV_AUTO_PORT) | 431 | if (sb_port[dev] > 0 && sb_port[dev] != SNDRV_AUTO_PORT) |
431 | if ((acard->res_sb_port = request_region(sb_port[dev], 16, IDENT " SB")) == NULL) { | 432 | if ((acard->res_sb_port = request_region(sb_port[dev], 16, IDENT " SB")) == NULL) { |
432 | printk(KERN_ERR IDENT ": unable to register SB port at 0x%lx\n", sb_port[dev]); | 433 | printk(KERN_ERR IDENT ": unable to register SB port at 0x%lx\n", sb_port[dev]); |
433 | snd_card_free(card); | 434 | err = -EBUSY; |
434 | return -ENOMEM; | 435 | goto _err; |
435 | } | 436 | } |
436 | 437 | ||
437 | #ifdef CS4232 | 438 | #ifdef CS4232 |
@@ -443,18 +444,14 @@ static int __devinit snd_card_cs423x_probe(int dev, struct pnp_card_link *pcard, | |||
443 | dma2[dev], | 444 | dma2[dev], |
444 | CS4231_HW_DETECT, | 445 | CS4231_HW_DETECT, |
445 | 0, | 446 | 0, |
446 | &chip)) < 0) { | 447 | &chip)) < 0) |
447 | snd_card_free(card); | 448 | goto _err; |
448 | return err; | 449 | |
449 | } | 450 | if ((err = snd_cs4231_pcm(chip, 0, &pcm)) < 0) |
450 | if ((err = snd_cs4231_pcm(chip, 0, &pcm)) < 0) { | 451 | goto _err; |
451 | snd_card_free(card); | 452 | |
452 | return err; | 453 | if ((err = snd_cs4231_mixer(chip)) < 0) |
453 | } | 454 | goto _err; |
454 | if ((err = snd_cs4231_mixer(chip)) < 0) { | ||
455 | snd_card_free(card); | ||
456 | return err; | ||
457 | } | ||
458 | 455 | ||
459 | #else /* CS4236 */ | 456 | #else /* CS4236 */ |
460 | if ((err = snd_cs4236_create(card, | 457 | if ((err = snd_cs4236_create(card, |
@@ -465,18 +462,14 @@ static int __devinit snd_card_cs423x_probe(int dev, struct pnp_card_link *pcard, | |||
465 | dma2[dev], | 462 | dma2[dev], |
466 | CS4231_HW_DETECT, | 463 | CS4231_HW_DETECT, |
467 | 0, | 464 | 0, |
468 | &chip)) < 0) { | 465 | &chip)) < 0) |
469 | snd_card_free(card); | 466 | goto _err; |
470 | return err; | 467 | |
471 | } | 468 | if ((err = snd_cs4236_pcm(chip, 0, &pcm)) < 0) |
472 | if ((err = snd_cs4236_pcm(chip, 0, &pcm)) < 0) { | 469 | goto _err; |
473 | snd_card_free(card); | 470 | |
474 | return err; | 471 | if ((err = snd_cs4236_mixer(chip)) < 0) |
475 | } | 472 | goto _err; |
476 | if ((err = snd_cs4236_mixer(chip)) < 0) { | ||
477 | snd_card_free(card); | ||
478 | return err; | ||
479 | } | ||
480 | #endif | 473 | #endif |
481 | strcpy(card->driver, pcm->name); | 474 | strcpy(card->driver, pcm->name); |
482 | strcpy(card->shortname, pcm->name); | 475 | strcpy(card->shortname, pcm->name); |
@@ -488,21 +481,17 @@ static int __devinit snd_card_cs423x_probe(int dev, struct pnp_card_link *pcard, | |||
488 | if (dma2[dev] >= 0) | 481 | if (dma2[dev] >= 0) |
489 | sprintf(card->longname + strlen(card->longname), "&%d", dma2[dev]); | 482 | sprintf(card->longname + strlen(card->longname), "&%d", dma2[dev]); |
490 | 483 | ||
491 | if ((err = snd_cs4231_timer(chip, 0, NULL)) < 0) { | 484 | if ((err = snd_cs4231_timer(chip, 0, NULL)) < 0) |
492 | snd_card_free(card); | 485 | goto _err; |
493 | return err; | ||
494 | } | ||
495 | 486 | ||
496 | if (fm_port[dev] > 0 && fm_port[dev] != SNDRV_AUTO_PORT) { | 487 | if (fm_port[dev] > 0 && fm_port[dev] != SNDRV_AUTO_PORT) { |
497 | if (snd_opl3_create(card, | 488 | if (snd_opl3_create(card, |
498 | fm_port[dev], fm_port[dev] + 2, | 489 | fm_port[dev], fm_port[dev] + 2, |
499 | OPL3_HW_OPL3_CS, 0, &opl3) < 0) { | 490 | OPL3_HW_OPL3_CS, 0, &opl3) < 0) { |
500 | printk(KERN_ERR IDENT ": OPL3 not detected\n"); | 491 | printk(KERN_WARNING IDENT ": OPL3 not detected\n"); |
501 | } else { | 492 | } else { |
502 | if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) { | 493 | if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) |
503 | snd_card_free(card); | 494 | goto _err; |
504 | return err; | ||
505 | } | ||
506 | } | 495 | } |
507 | } | 496 | } |
508 | 497 | ||
@@ -513,17 +502,23 @@ static int __devinit snd_card_cs423x_probe(int dev, struct pnp_card_link *pcard, | |||
513 | mpu_port[dev], 0, | 502 | mpu_port[dev], 0, |
514 | mpu_irq[dev], | 503 | mpu_irq[dev], |
515 | mpu_irq[dev] >= 0 ? SA_INTERRUPT : 0, NULL) < 0) | 504 | mpu_irq[dev] >= 0 ? SA_INTERRUPT : 0, NULL) < 0) |
516 | printk(KERN_ERR IDENT ": MPU401 not detected\n"); | 505 | printk(KERN_WARNING IDENT ": MPU401 not detected\n"); |
517 | } | ||
518 | if ((err = snd_card_register(card)) < 0) { | ||
519 | snd_card_free(card); | ||
520 | return err; | ||
521 | } | 506 | } |
507 | |||
508 | if ((err = snd_card_set_generic_dev(card)) < 0) | ||
509 | goto _err; | ||
510 | |||
511 | if ((err = snd_card_register(card)) < 0) | ||
512 | goto _err; | ||
522 | if (pcard) | 513 | if (pcard) |
523 | pnp_set_card_drvdata(pcard, card); | 514 | pnp_set_card_drvdata(pcard, card); |
524 | else | 515 | else |
525 | snd_cs4236_legacy[dev] = card; | 516 | snd_cs4236_legacy[dev] = card; |
526 | return 0; | 517 | return 0; |
518 | |||
519 | _err: | ||
520 | snd_card_free(card); | ||
521 | return err; | ||
527 | } | 522 | } |
528 | 523 | ||
529 | #ifdef CONFIG_PNP | 524 | #ifdef CONFIG_PNP |
@@ -569,10 +564,8 @@ static int __init alsa_card_cs423x_init(void) | |||
569 | for (dev = 0; dev < SNDRV_CARDS; dev++) { | 564 | for (dev = 0; dev < SNDRV_CARDS; dev++) { |
570 | if (!enable[dev]) | 565 | if (!enable[dev]) |
571 | continue; | 566 | continue; |
572 | #ifdef CONFIG_PNP | 567 | if (is_isapnp_selected(dev)) |
573 | if (isapnp[dev]) | ||
574 | continue; | 568 | continue; |
575 | #endif | ||
576 | if (snd_card_cs423x_probe(dev, NULL, NULL) >= 0) | 569 | if (snd_card_cs423x_probe(dev, NULL, NULL) >= 0) |
577 | cards++; | 570 | cards++; |
578 | } | 571 | } |
diff --git a/sound/isa/es1688/es1688.c b/sound/isa/es1688/es1688.c index c5eaec087b46..26a7d335ed8e 100644 --- a/sound/isa/es1688/es1688.c +++ b/sound/isa/es1688/es1688.c | |||
@@ -70,6 +70,7 @@ MODULE_PARM_DESC(dma8, "8-bit DMA # for ESx688 driver."); | |||
70 | 70 | ||
71 | static snd_card_t *snd_audiodrive_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR; | 71 | static snd_card_t *snd_audiodrive_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR; |
72 | 72 | ||
73 | #define PFX "es1688: " | ||
73 | 74 | ||
74 | static int __init snd_audiodrive_probe(int dev) | 75 | static int __init snd_audiodrive_probe(int dev) |
75 | { | 76 | { |
@@ -89,47 +90,41 @@ static int __init snd_audiodrive_probe(int dev) | |||
89 | xirq = irq[dev]; | 90 | xirq = irq[dev]; |
90 | if (xirq == SNDRV_AUTO_IRQ) { | 91 | if (xirq == SNDRV_AUTO_IRQ) { |
91 | if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) { | 92 | if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) { |
92 | snd_card_free(card); | 93 | snd_printk(KERN_ERR PFX "unable to find a free IRQ\n"); |
93 | snd_printk("unable to find a free IRQ\n"); | 94 | err = -EBUSY; |
94 | return -EBUSY; | 95 | goto _err; |
95 | } | 96 | } |
96 | } | 97 | } |
97 | xmpu_irq = mpu_irq[dev]; | 98 | xmpu_irq = mpu_irq[dev]; |
98 | xdma = dma8[dev]; | 99 | xdma = dma8[dev]; |
99 | if (xdma == SNDRV_AUTO_DMA) { | 100 | if (xdma == SNDRV_AUTO_DMA) { |
100 | if ((xdma = snd_legacy_find_free_dma(possible_dmas)) < 0) { | 101 | if ((xdma = snd_legacy_find_free_dma(possible_dmas)) < 0) { |
101 | snd_card_free(card); | 102 | snd_printk(KERN_ERR PFX "unable to find a free DMA\n"); |
102 | snd_printk("unable to find a free DMA\n"); | 103 | err = -EBUSY; |
103 | return -EBUSY; | 104 | goto _err; |
104 | } | 105 | } |
105 | } | 106 | } |
106 | 107 | ||
107 | if ((err = snd_es1688_create(card, port[dev], mpu_port[dev], | 108 | if ((err = snd_es1688_create(card, port[dev], mpu_port[dev], |
108 | xirq, xmpu_irq, xdma, | 109 | xirq, xmpu_irq, xdma, |
109 | ES1688_HW_AUTO, &chip)) < 0) { | 110 | ES1688_HW_AUTO, &chip)) < 0) |
110 | snd_card_free(card); | 111 | goto _err; |
111 | return err; | 112 | |
112 | } | 113 | if ((err = snd_es1688_pcm(chip, 0, &pcm)) < 0) |
113 | if ((err = snd_es1688_pcm(chip, 0, &pcm)) < 0) { | 114 | goto _err; |
114 | snd_card_free(card); | 115 | |
115 | return err; | 116 | if ((err = snd_es1688_mixer(chip)) < 0) |
116 | } | 117 | goto _err; |
117 | if ((err = snd_es1688_mixer(chip)) < 0) { | ||
118 | snd_card_free(card); | ||
119 | return err; | ||
120 | } | ||
121 | 118 | ||
122 | strcpy(card->driver, "ES1688"); | 119 | strcpy(card->driver, "ES1688"); |
123 | strcpy(card->shortname, pcm->name); | 120 | strcpy(card->shortname, pcm->name); |
124 | sprintf(card->longname, "%s at 0x%lx, irq %i, dma %i", pcm->name, chip->port, xirq, xdma); | 121 | sprintf(card->longname, "%s at 0x%lx, irq %i, dma %i", pcm->name, chip->port, xirq, xdma); |
125 | 122 | ||
126 | if ((snd_opl3_create(card, chip->port, chip->port + 2, OPL3_HW_OPL3, 0, &opl3)) < 0) { | 123 | if ((snd_opl3_create(card, chip->port, chip->port + 2, OPL3_HW_OPL3, 0, &opl3)) < 0) { |
127 | printk(KERN_ERR "es1688: opl3 not detected at 0x%lx\n", chip->port); | 124 | printk(KERN_WARNING PFX "opl3 not detected at 0x%lx\n", chip->port); |
128 | } else { | 125 | } else { |
129 | if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) { | 126 | if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) |
130 | snd_card_free(card); | 127 | goto _err; |
131 | return err; | ||
132 | } | ||
133 | } | 128 | } |
134 | 129 | ||
135 | if (xmpu_irq >= 0 && xmpu_irq != SNDRV_AUTO_IRQ && chip->mpu_port > 0) { | 130 | if (xmpu_irq >= 0 && xmpu_irq != SNDRV_AUTO_IRQ && chip->mpu_port > 0) { |
@@ -137,18 +132,22 @@ static int __init snd_audiodrive_probe(int dev) | |||
137 | chip->mpu_port, 0, | 132 | chip->mpu_port, 0, |
138 | xmpu_irq, | 133 | xmpu_irq, |
139 | SA_INTERRUPT, | 134 | SA_INTERRUPT, |
140 | NULL)) < 0) { | 135 | NULL)) < 0) |
141 | snd_card_free(card); | 136 | goto _err; |
142 | return err; | ||
143 | } | ||
144 | } | ||
145 | if ((err = snd_card_register(card)) < 0) { | ||
146 | snd_card_free(card); | ||
147 | return err; | ||
148 | } | 137 | } |
138 | |||
139 | if ((err = snd_card_set_generic_dev(card)) < 0) | ||
140 | goto _err; | ||
141 | |||
142 | if ((err = snd_card_register(card)) < 0) | ||
143 | goto _err; | ||
144 | |||
149 | snd_audiodrive_cards[dev] = card; | 145 | snd_audiodrive_cards[dev] = card; |
150 | return 0; | 146 | return 0; |
151 | 147 | ||
148 | _err: | ||
149 | snd_card_free(card); | ||
150 | return err; | ||
152 | } | 151 | } |
153 | 152 | ||
154 | static int __init snd_audiodrive_legacy_auto_probe(unsigned long xport) | 153 | static int __init snd_audiodrive_legacy_auto_probe(unsigned long xport) |
diff --git a/sound/isa/es1688/es1688_lib.c b/sound/isa/es1688/es1688_lib.c index 17f68d07d9b2..aac898765c02 100644 --- a/sound/isa/es1688/es1688_lib.c +++ b/sound/isa/es1688/es1688_lib.c | |||
@@ -649,7 +649,7 @@ int snd_es1688_create(snd_card_t * card, | |||
649 | int err; | 649 | int err; |
650 | 650 | ||
651 | *rchip = NULL; | 651 | *rchip = NULL; |
652 | chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); | 652 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); |
653 | if (chip == NULL) | 653 | if (chip == NULL) |
654 | return -ENOMEM; | 654 | return -ENOMEM; |
655 | chip->irq = -1; | 655 | chip->irq = -1; |
diff --git a/sound/isa/es18xx.c b/sound/isa/es18xx.c index 1d832b2adb7c..d0ea19f42703 100644 --- a/sound/isa/es18xx.c +++ b/sound/isa/es18xx.c | |||
@@ -1686,7 +1686,7 @@ static int __devinit snd_es18xx_new_device(snd_card_t * card, | |||
1686 | int err; | 1686 | int err; |
1687 | 1687 | ||
1688 | *rchip = NULL; | 1688 | *rchip = NULL; |
1689 | chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); | 1689 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); |
1690 | if (chip == NULL) | 1690 | if (chip == NULL) |
1691 | return -ENOMEM; | 1691 | return -ENOMEM; |
1692 | spin_lock_init(&chip->reg_lock); | 1692 | spin_lock_init(&chip->reg_lock); |
@@ -1988,6 +1988,12 @@ static int __devinit snd_audiodrive_pnp(int dev, struct snd_audiodrive *acard, | |||
1988 | } | 1988 | } |
1989 | #endif /* CONFIG_PNP */ | 1989 | #endif /* CONFIG_PNP */ |
1990 | 1990 | ||
1991 | #ifdef CONFIG_PNP | ||
1992 | #define is_isapnp_selected(dev) isapnp[dev] | ||
1993 | #else | ||
1994 | #define is_isapnp_selected(dev) 0 | ||
1995 | #endif | ||
1996 | |||
1991 | static int __devinit snd_audiodrive_probe(int dev, struct pnp_card_link *pcard, | 1997 | static int __devinit snd_audiodrive_probe(int dev, struct pnp_card_link *pcard, |
1992 | const struct pnp_card_device_id *pid) | 1998 | const struct pnp_card_device_id *pid) |
1993 | { | 1999 | { |
@@ -1996,7 +2002,6 @@ static int __devinit snd_audiodrive_probe(int dev, struct pnp_card_link *pcard, | |||
1996 | int xirq, xdma1, xdma2; | 2002 | int xirq, xdma1, xdma2; |
1997 | snd_card_t *card; | 2003 | snd_card_t *card; |
1998 | struct snd_audiodrive *acard; | 2004 | struct snd_audiodrive *acard; |
1999 | snd_rawmidi_t *rmidi = NULL; | ||
2000 | es18xx_t *chip; | 2005 | es18xx_t *chip; |
2001 | opl3_t *opl3; | 2006 | opl3_t *opl3; |
2002 | int err; | 2007 | int err; |
@@ -2019,25 +2024,25 @@ static int __devinit snd_audiodrive_probe(int dev, struct pnp_card_link *pcard, | |||
2019 | xirq = irq[dev]; | 2024 | xirq = irq[dev]; |
2020 | if (xirq == SNDRV_AUTO_IRQ) { | 2025 | if (xirq == SNDRV_AUTO_IRQ) { |
2021 | if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) { | 2026 | if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) { |
2022 | snd_card_free(card); | 2027 | snd_printk(KERN_ERR PFX "unable to find a free IRQ\n"); |
2023 | snd_printk("unable to find a free IRQ\n"); | 2028 | err = -EBUSY; |
2024 | return -EBUSY; | 2029 | goto _err; |
2025 | } | 2030 | } |
2026 | } | 2031 | } |
2027 | xdma1 = dma1[dev]; | 2032 | xdma1 = dma1[dev]; |
2028 | if (xdma1 == SNDRV_AUTO_DMA) { | 2033 | if (xdma1 == SNDRV_AUTO_DMA) { |
2029 | if ((xdma1 = snd_legacy_find_free_dma(possible_dmas)) < 0) { | 2034 | if ((xdma1 = snd_legacy_find_free_dma(possible_dmas)) < 0) { |
2030 | snd_card_free(card); | 2035 | snd_printk(KERN_ERR PFX "unable to find a free DMA1\n"); |
2031 | snd_printk("unable to find a free DMA1\n"); | 2036 | err = -EBUSY; |
2032 | return -EBUSY; | 2037 | goto _err; |
2033 | } | 2038 | } |
2034 | } | 2039 | } |
2035 | xdma2 = dma2[dev]; | 2040 | xdma2 = dma2[dev]; |
2036 | if (xdma2 == SNDRV_AUTO_DMA) { | 2041 | if (xdma2 == SNDRV_AUTO_DMA) { |
2037 | if ((xdma2 = snd_legacy_find_free_dma(possible_dmas)) < 0) { | 2042 | if ((xdma2 = snd_legacy_find_free_dma(possible_dmas)) < 0) { |
2038 | snd_card_free(card); | 2043 | snd_printk(KERN_ERR PFX "unable to find a free DMA2\n"); |
2039 | snd_printk("unable to find a free DMA2\n"); | 2044 | err = -EBUSY; |
2040 | return -EBUSY; | 2045 | goto _err; |
2041 | } | 2046 | } |
2042 | } | 2047 | } |
2043 | 2048 | ||
@@ -2046,10 +2051,8 @@ static int __devinit snd_audiodrive_probe(int dev, struct pnp_card_link *pcard, | |||
2046 | mpu_port[dev], | 2051 | mpu_port[dev], |
2047 | fm_port[dev], | 2052 | fm_port[dev], |
2048 | xirq, xdma1, xdma2, | 2053 | xirq, xdma1, xdma2, |
2049 | &chip)) < 0) { | 2054 | &chip)) < 0) |
2050 | snd_card_free(card); | 2055 | goto _err; |
2051 | return err; | ||
2052 | } | ||
2053 | 2056 | ||
2054 | sprintf(card->driver, "ES%x", chip->version); | 2057 | sprintf(card->driver, "ES%x", chip->version); |
2055 | sprintf(card->shortname, "ESS AudioDrive ES%x", chip->version); | 2058 | sprintf(card->shortname, "ESS AudioDrive ES%x", chip->version); |
@@ -2064,23 +2067,18 @@ static int __devinit snd_audiodrive_probe(int dev, struct pnp_card_link *pcard, | |||
2064 | chip->port, | 2067 | chip->port, |
2065 | xirq, xdma1); | 2068 | xirq, xdma1); |
2066 | 2069 | ||
2067 | if ((err = snd_es18xx_pcm(chip, 0, NULL)) < 0) { | 2070 | if ((err = snd_es18xx_pcm(chip, 0, NULL)) < 0) |
2068 | snd_card_free(card); | 2071 | goto _err; |
2069 | return err; | 2072 | |
2070 | } | 2073 | if ((err = snd_es18xx_mixer(chip)) < 0) |
2071 | if ((err = snd_es18xx_mixer(chip)) < 0) { | 2074 | goto _err; |
2072 | snd_card_free(card); | ||
2073 | return err; | ||
2074 | } | ||
2075 | 2075 | ||
2076 | if (fm_port[dev] > 0 && fm_port[dev] != SNDRV_AUTO_PORT) { | 2076 | if (fm_port[dev] > 0 && fm_port[dev] != SNDRV_AUTO_PORT) { |
2077 | if (snd_opl3_create(card, chip->fm_port, chip->fm_port + 2, OPL3_HW_OPL3, 0, &opl3) < 0) { | 2077 | if (snd_opl3_create(card, chip->fm_port, chip->fm_port + 2, OPL3_HW_OPL3, 0, &opl3) < 0) { |
2078 | snd_printk(KERN_ERR PFX "opl3 not detected at 0x%lx\n", chip->fm_port); | 2078 | snd_printk(KERN_WARNING PFX "opl3 not detected at 0x%lx\n", chip->fm_port); |
2079 | } else { | 2079 | } else { |
2080 | if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) { | 2080 | if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) |
2081 | snd_card_free(card); | 2081 | goto _err; |
2082 | return err; | ||
2083 | } | ||
2084 | } | 2082 | } |
2085 | } | 2083 | } |
2086 | 2084 | ||
@@ -2088,25 +2086,28 @@ static int __devinit snd_audiodrive_probe(int dev, struct pnp_card_link *pcard, | |||
2088 | if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_ES18XX, | 2086 | if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_ES18XX, |
2089 | chip->mpu_port, 0, | 2087 | chip->mpu_port, 0, |
2090 | xirq, 0, | 2088 | xirq, 0, |
2091 | &rmidi)) < 0) { | 2089 | &chip->rmidi)) < 0) |
2092 | snd_card_free(card); | 2090 | goto _err; |
2093 | return err; | ||
2094 | } | ||
2095 | chip->rmidi = rmidi; | ||
2096 | } | 2091 | } |
2097 | 2092 | ||
2093 | if ((err = snd_card_set_generic_dev(card)) < 0) | ||
2094 | goto _err; | ||
2095 | |||
2098 | /* Power Management */ | 2096 | /* Power Management */ |
2099 | snd_card_set_isa_pm_callback(card, snd_es18xx_suspend, snd_es18xx_resume, chip); | 2097 | snd_card_set_isa_pm_callback(card, snd_es18xx_suspend, snd_es18xx_resume, chip); |
2100 | 2098 | ||
2101 | if ((err = snd_card_register(card)) < 0) { | 2099 | if ((err = snd_card_register(card)) < 0) |
2102 | snd_card_free(card); | 2100 | goto _err; |
2103 | return err; | 2101 | |
2104 | } | ||
2105 | if (pcard) | 2102 | if (pcard) |
2106 | pnp_set_card_drvdata(pcard, card); | 2103 | pnp_set_card_drvdata(pcard, card); |
2107 | else | 2104 | else |
2108 | snd_audiodrive_legacy[dev] = card; | 2105 | snd_audiodrive_legacy[dev] = card; |
2109 | return 0; | 2106 | return 0; |
2107 | |||
2108 | _err: | ||
2109 | snd_card_free(card); | ||
2110 | return err; | ||
2110 | } | 2111 | } |
2111 | 2112 | ||
2112 | static int __devinit snd_audiodrive_probe_legacy_port(unsigned long xport) | 2113 | static int __devinit snd_audiodrive_probe_legacy_port(unsigned long xport) |
@@ -2117,10 +2118,8 @@ static int __devinit snd_audiodrive_probe_legacy_port(unsigned long xport) | |||
2117 | for ( ; dev < SNDRV_CARDS; dev++) { | 2118 | for ( ; dev < SNDRV_CARDS; dev++) { |
2118 | if (!enable[dev] || port[dev] != SNDRV_AUTO_PORT) | 2119 | if (!enable[dev] || port[dev] != SNDRV_AUTO_PORT) |
2119 | continue; | 2120 | continue; |
2120 | #ifdef CONFIG_PNP | 2121 | if (is_isapnp_selected(dev)) |
2121 | if (isapnp[dev]) | ||
2122 | continue; | 2122 | continue; |
2123 | #endif | ||
2124 | port[dev] = xport; | 2123 | port[dev] = xport; |
2125 | res = snd_audiodrive_probe(dev, NULL, NULL); | 2124 | res = snd_audiodrive_probe(dev, NULL, NULL); |
2126 | if (res < 0) | 2125 | if (res < 0) |
@@ -2177,10 +2176,8 @@ static int __init alsa_card_es18xx_init(void) | |||
2177 | for (dev = 0; dev < SNDRV_CARDS; dev++) { | 2176 | for (dev = 0; dev < SNDRV_CARDS; dev++) { |
2178 | if (!enable[dev] || port[dev] == SNDRV_AUTO_PORT) | 2177 | if (!enable[dev] || port[dev] == SNDRV_AUTO_PORT) |
2179 | continue; | 2178 | continue; |
2180 | #ifdef CONFIG_PNP | 2179 | if (is_isapnp_selected(dev)) |
2181 | if (isapnp[dev]) | ||
2182 | continue; | 2180 | continue; |
2183 | #endif | ||
2184 | if (snd_audiodrive_probe(dev, NULL, NULL) >= 0) | 2181 | if (snd_audiodrive_probe(dev, NULL, NULL) >= 0) |
2185 | cards++; | 2182 | cards++; |
2186 | } | 2183 | } |
diff --git a/sound/isa/gus/gus_io.c b/sound/isa/gus/gus_io.c index 337b0e2a8a36..23e1b5f19e1a 100644 --- a/sound/isa/gus/gus_io.c +++ b/sound/isa/gus/gus_io.c | |||
@@ -269,8 +269,9 @@ void snd_gf1_i_write_addr(snd_gus_card_t * gus, unsigned char reg, | |||
269 | 269 | ||
270 | #endif /* 0 */ | 270 | #endif /* 0 */ |
271 | 271 | ||
272 | unsigned int snd_gf1_i_read_addr(snd_gus_card_t * gus, | 272 | #ifdef CONFIG_SND_DEBUG |
273 | unsigned char reg, short w_16bit) | 273 | static unsigned int snd_gf1_i_read_addr(snd_gus_card_t * gus, |
274 | unsigned char reg, short w_16bit) | ||
274 | { | 275 | { |
275 | unsigned int res; | 276 | unsigned int res; |
276 | unsigned long flags; | 277 | unsigned long flags; |
@@ -280,6 +281,7 @@ unsigned int snd_gf1_i_read_addr(snd_gus_card_t * gus, | |||
280 | spin_unlock_irqrestore(&gus->reg_lock, flags); | 281 | spin_unlock_irqrestore(&gus->reg_lock, flags); |
281 | return res; | 282 | return res; |
282 | } | 283 | } |
284 | #endif | ||
283 | 285 | ||
284 | /* | 286 | /* |
285 | 287 | ||
diff --git a/sound/isa/gus/gus_main.c b/sound/isa/gus/gus_main.c index a636d9ce3502..8f2872f8e8f6 100644 --- a/sound/isa/gus/gus_main.c +++ b/sound/isa/gus/gus_main.c | |||
@@ -157,7 +157,7 @@ int snd_gus_create(snd_card_t * card, | |||
157 | }; | 157 | }; |
158 | 158 | ||
159 | *rgus = NULL; | 159 | *rgus = NULL; |
160 | gus = kcalloc(1, sizeof(*gus), GFP_KERNEL); | 160 | gus = kzalloc(sizeof(*gus), GFP_KERNEL); |
161 | if (gus == NULL) | 161 | if (gus == NULL) |
162 | return -ENOMEM; | 162 | return -ENOMEM; |
163 | gus->gf1.irq = -1; | 163 | gus->gf1.irq = -1; |
diff --git a/sound/isa/gus/gus_mem_proc.c b/sound/isa/gus/gus_mem_proc.c index 886763f12132..7f96ac237f3c 100644 --- a/sound/isa/gus/gus_mem_proc.c +++ b/sound/isa/gus/gus_mem_proc.c | |||
@@ -98,7 +98,7 @@ int snd_gf1_mem_proc_init(snd_gus_card_t * gus) | |||
98 | 98 | ||
99 | for (idx = 0; idx < 4; idx++) { | 99 | for (idx = 0; idx < 4; idx++) { |
100 | if (gus->gf1.mem_alloc.banks_8[idx].size > 0) { | 100 | if (gus->gf1.mem_alloc.banks_8[idx].size > 0) { |
101 | priv = kcalloc(1, sizeof(*priv), GFP_KERNEL); | 101 | priv = kzalloc(sizeof(*priv), GFP_KERNEL); |
102 | if (priv == NULL) | 102 | if (priv == NULL) |
103 | return -ENOMEM; | 103 | return -ENOMEM; |
104 | priv->gus = gus; | 104 | priv->gus = gus; |
@@ -115,7 +115,7 @@ int snd_gf1_mem_proc_init(snd_gus_card_t * gus) | |||
115 | } | 115 | } |
116 | for (idx = 0; idx < 4; idx++) { | 116 | for (idx = 0; idx < 4; idx++) { |
117 | if (gus->gf1.rom_present & (1 << idx)) { | 117 | if (gus->gf1.rom_present & (1 << idx)) { |
118 | priv = kcalloc(1, sizeof(*priv), GFP_KERNEL); | 118 | priv = kzalloc(sizeof(*priv), GFP_KERNEL); |
119 | if (priv == NULL) | 119 | if (priv == NULL) |
120 | return -ENOMEM; | 120 | return -ENOMEM; |
121 | priv->rom = 1; | 121 | priv->rom = 1; |
diff --git a/sound/isa/gus/gus_pcm.c b/sound/isa/gus/gus_pcm.c index b75066ab46fc..beb01365dc46 100644 --- a/sound/isa/gus/gus_pcm.c +++ b/sound/isa/gus/gus_pcm.c | |||
@@ -666,7 +666,7 @@ static int snd_gf1_pcm_playback_open(snd_pcm_substream_t *substream) | |||
666 | snd_pcm_runtime_t *runtime = substream->runtime; | 666 | snd_pcm_runtime_t *runtime = substream->runtime; |
667 | int err; | 667 | int err; |
668 | 668 | ||
669 | pcmp = kcalloc(1, sizeof(*pcmp), GFP_KERNEL); | 669 | pcmp = kzalloc(sizeof(*pcmp), GFP_KERNEL); |
670 | if (pcmp == NULL) | 670 | if (pcmp == NULL) |
671 | return -ENOMEM; | 671 | return -ENOMEM; |
672 | pcmp->gus = gus; | 672 | pcmp->gus = gus; |
diff --git a/sound/isa/gus/gusclassic.c b/sound/isa/gus/gusclassic.c index a99fa5040b46..39cef38835ca 100644 --- a/sound/isa/gus/gusclassic.c +++ b/sound/isa/gus/gusclassic.c | |||
@@ -72,40 +72,24 @@ MODULE_PARM_DESC(pcm_channels, "Reserved PCM channels for GUS Classic driver."); | |||
72 | 72 | ||
73 | static snd_card_t *snd_gusclassic_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR; | 73 | static snd_card_t *snd_gusclassic_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR; |
74 | 74 | ||
75 | #define PFX "gusclassic: " | ||
75 | 76 | ||
76 | static int __init snd_gusclassic_detect(snd_gus_card_t * gus) | 77 | static int __init snd_gusclassic_detect(snd_gus_card_t * gus) |
77 | { | 78 | { |
78 | snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 0); /* reset GF1 */ | 79 | unsigned char d; |
79 | #ifdef CONFIG_SND_DEBUG_DETECT | ||
80 | { | ||
81 | unsigned char d; | ||
82 | 80 | ||
83 | if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 0) { | 81 | snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 0); /* reset GF1 */ |
84 | snd_printk("[0x%lx] check 1 failed - 0x%x\n", gus->gf1.port, d); | 82 | if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 0) { |
85 | return -ENODEV; | 83 | snd_printdd("[0x%lx] check 1 failed - 0x%x\n", gus->gf1.port, d); |
86 | } | ||
87 | } | ||
88 | #else | ||
89 | if ((snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET) & 0x07) != 0) | ||
90 | return -ENODEV; | 84 | return -ENODEV; |
91 | #endif | 85 | } |
92 | udelay(160); | 86 | udelay(160); |
93 | snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 1); /* release reset */ | 87 | snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 1); /* release reset */ |
94 | udelay(160); | 88 | udelay(160); |
95 | #ifdef CONFIG_SND_DEBUG_DETECT | 89 | if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 1) { |
96 | { | 90 | snd_printdd("[0x%lx] check 2 failed - 0x%x\n", gus->gf1.port, d); |
97 | unsigned char d; | ||
98 | |||
99 | if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 1) { | ||
100 | snd_printk("[0x%lx] check 2 failed - 0x%x\n", gus->gf1.port, d); | ||
101 | return -ENODEV; | ||
102 | } | ||
103 | } | ||
104 | #else | ||
105 | if ((snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET) & 0x07) != 1) | ||
106 | return -ENODEV; | 91 | return -ENODEV; |
107 | #endif | 92 | } |
108 | |||
109 | return 0; | 93 | return 0; |
110 | } | 94 | } |
111 | 95 | ||
@@ -137,25 +121,25 @@ static int __init snd_gusclassic_probe(int dev) | |||
137 | xirq = irq[dev]; | 121 | xirq = irq[dev]; |
138 | if (xirq == SNDRV_AUTO_IRQ) { | 122 | if (xirq == SNDRV_AUTO_IRQ) { |
139 | if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) { | 123 | if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) { |
140 | snd_card_free(card); | 124 | snd_printk(KERN_ERR PFX "unable to find a free IRQ\n"); |
141 | snd_printk("unable to find a free IRQ\n"); | 125 | err = -EBUSY; |
142 | return -EBUSY; | 126 | goto _err; |
143 | } | 127 | } |
144 | } | 128 | } |
145 | xdma1 = dma1[dev]; | 129 | xdma1 = dma1[dev]; |
146 | if (xdma1 == SNDRV_AUTO_DMA) { | 130 | if (xdma1 == SNDRV_AUTO_DMA) { |
147 | if ((xdma1 = snd_legacy_find_free_dma(possible_dmas)) < 0) { | 131 | if ((xdma1 = snd_legacy_find_free_dma(possible_dmas)) < 0) { |
148 | snd_card_free(card); | 132 | snd_printk(KERN_ERR PFX "unable to find a free DMA1\n"); |
149 | snd_printk("unable to find a free DMA1\n"); | 133 | err = -EBUSY; |
150 | return -EBUSY; | 134 | goto _err; |
151 | } | 135 | } |
152 | } | 136 | } |
153 | xdma2 = dma2[dev]; | 137 | xdma2 = dma2[dev]; |
154 | if (xdma2 == SNDRV_AUTO_DMA) { | 138 | if (xdma2 == SNDRV_AUTO_DMA) { |
155 | if ((xdma2 = snd_legacy_find_free_dma(possible_dmas)) < 0) { | 139 | if ((xdma2 = snd_legacy_find_free_dma(possible_dmas)) < 0) { |
156 | snd_card_free(card); | 140 | snd_printk(KERN_ERR PFX "unable to find a free DMA2\n"); |
157 | snd_printk("unable to find a free DMA2\n"); | 141 | err = -EBUSY; |
158 | return -EBUSY; | 142 | goto _err; |
159 | } | 143 | } |
160 | } | 144 | } |
161 | 145 | ||
@@ -164,47 +148,48 @@ static int __init snd_gusclassic_probe(int dev) | |||
164 | port[dev], | 148 | port[dev], |
165 | xirq, xdma1, xdma2, | 149 | xirq, xdma1, xdma2, |
166 | 0, channels[dev], pcm_channels[dev], | 150 | 0, channels[dev], pcm_channels[dev], |
167 | 0, &gus)) < 0) { | 151 | 0, &gus)) < 0) |
168 | snd_card_free(card); | 152 | goto _err; |
169 | return err; | 153 | |
170 | } | 154 | if ((err = snd_gusclassic_detect(gus)) < 0) |
171 | if ((err = snd_gusclassic_detect(gus)) < 0) { | 155 | goto _err; |
172 | snd_card_free(card); | 156 | |
173 | return err; | ||
174 | } | ||
175 | snd_gusclassic_init(dev, gus); | 157 | snd_gusclassic_init(dev, gus); |
176 | if ((err = snd_gus_initialize(gus)) < 0) { | 158 | if ((err = snd_gus_initialize(gus)) < 0) |
177 | snd_card_free(card); | 159 | goto _err; |
178 | return err; | 160 | |
179 | } | ||
180 | if (gus->max_flag || gus->ess_flag) { | 161 | if (gus->max_flag || gus->ess_flag) { |
181 | snd_printdd("GUS Classic or ACE soundcard was not detected at 0x%lx\n", gus->gf1.port); | 162 | snd_printk(KERN_ERR PFX "GUS Classic or ACE soundcard was not detected at 0x%lx\n", gus->gf1.port); |
182 | snd_card_free(card); | 163 | err = -ENODEV; |
183 | return -ENODEV; | 164 | goto _err; |
184 | } | ||
185 | if ((err = snd_gf1_new_mixer(gus)) < 0) { | ||
186 | snd_card_free(card); | ||
187 | return err; | ||
188 | } | ||
189 | if ((err = snd_gf1_pcm_new(gus, 0, 0, NULL)) < 0) { | ||
190 | snd_card_free(card); | ||
191 | return err; | ||
192 | } | 165 | } |
166 | |||
167 | if ((err = snd_gf1_new_mixer(gus)) < 0) | ||
168 | goto _err; | ||
169 | |||
170 | if ((err = snd_gf1_pcm_new(gus, 0, 0, NULL)) < 0) | ||
171 | goto _err; | ||
172 | |||
193 | if (!gus->ace_flag) { | 173 | if (!gus->ace_flag) { |
194 | if ((err = snd_gf1_rawmidi_new(gus, 0, NULL)) < 0) { | 174 | if ((err = snd_gf1_rawmidi_new(gus, 0, NULL)) < 0) |
195 | snd_card_free(card); | 175 | goto _err; |
196 | return err; | ||
197 | } | ||
198 | } | 176 | } |
199 | sprintf(card->longname + strlen(card->longname), " at 0x%lx, irq %d, dma %d", gus->gf1.port, xirq, xdma1); | 177 | sprintf(card->longname + strlen(card->longname), " at 0x%lx, irq %d, dma %d", gus->gf1.port, xirq, xdma1); |
200 | if (dma2 >= 0) | 178 | if (dma2 >= 0) |
201 | sprintf(card->longname + strlen(card->longname), "&%d", xdma2); | 179 | sprintf(card->longname + strlen(card->longname), "&%d", xdma2); |
202 | if ((err = snd_card_register(card)) < 0) { | 180 | |
203 | snd_card_free(card); | 181 | if ((err = snd_card_set_generic_dev(card)) < 0) |
204 | return err; | 182 | goto _err; |
205 | } | 183 | |
184 | if ((err = snd_card_register(card)) < 0) | ||
185 | goto _err; | ||
186 | |||
206 | snd_gusclassic_cards[dev] = card; | 187 | snd_gusclassic_cards[dev] = card; |
207 | return 0; | 188 | return 0; |
189 | |||
190 | _err: | ||
191 | snd_card_free(card); | ||
192 | return err; | ||
208 | } | 193 | } |
209 | 194 | ||
210 | static int __init snd_gusclassic_legacy_auto_probe(unsigned long xport) | 195 | static int __init snd_gusclassic_legacy_auto_probe(unsigned long xport) |
diff --git a/sound/isa/gus/gusextreme.c b/sound/isa/gus/gusextreme.c index bc6fecb18dcf..d2e7cb1df537 100644 --- a/sound/isa/gus/gusextreme.c +++ b/sound/isa/gus/gusextreme.c | |||
@@ -87,6 +87,7 @@ MODULE_PARM_DESC(pcm_channels, "Reserved PCM channels for GUS Extreme driver."); | |||
87 | 87 | ||
88 | static snd_card_t *snd_gusextreme_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR; | 88 | static snd_card_t *snd_gusextreme_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR; |
89 | 89 | ||
90 | #define PFX "gusextreme: " | ||
90 | 91 | ||
91 | static int __init snd_gusextreme_detect(int dev, | 92 | static int __init snd_gusextreme_detect(int dev, |
92 | snd_card_t * card, | 93 | snd_card_t * card, |
@@ -94,6 +95,7 @@ static int __init snd_gusextreme_detect(int dev, | |||
94 | es1688_t *es1688) | 95 | es1688_t *es1688) |
95 | { | 96 | { |
96 | unsigned long flags; | 97 | unsigned long flags; |
98 | unsigned char d; | ||
97 | 99 | ||
98 | /* | 100 | /* |
99 | * This is main stuff - enable access to GF1 chip... | 101 | * This is main stuff - enable access to GF1 chip... |
@@ -123,36 +125,17 @@ static int __init snd_gusextreme_detect(int dev, | |||
123 | udelay(100); | 125 | udelay(100); |
124 | 126 | ||
125 | snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 0); /* reset GF1 */ | 127 | snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 0); /* reset GF1 */ |
126 | #ifdef CONFIG_SND_DEBUG_DETECT | 128 | if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 0) { |
127 | { | 129 | snd_printdd("[0x%lx] check 1 failed - 0x%x\n", gus->gf1.port, d); |
128 | unsigned char d; | ||
129 | |||
130 | if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 0) { | ||
131 | snd_printk("[0x%lx] check 1 failed - 0x%x\n", gus->gf1.port, d); | ||
132 | return -EIO; | ||
133 | } | ||
134 | } | ||
135 | #else | ||
136 | if ((snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET) & 0x07) != 0) | ||
137 | return -EIO; | 130 | return -EIO; |
138 | #endif | 131 | } |
139 | udelay(160); | 132 | udelay(160); |
140 | snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 1); /* release reset */ | 133 | snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 1); /* release reset */ |
141 | udelay(160); | 134 | udelay(160); |
142 | #ifdef CONFIG_SND_DEBUG_DETECT | 135 | if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 1) { |
143 | { | 136 | snd_printdd("[0x%lx] check 2 failed - 0x%x\n", gus->gf1.port, d); |
144 | unsigned char d; | ||
145 | |||
146 | if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 1) { | ||
147 | snd_printk("[0x%lx] check 2 failed - 0x%x\n", gus->gf1.port, d); | ||
148 | return -EIO; | ||
149 | } | ||
150 | } | ||
151 | #else | ||
152 | if ((snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET) & 0x07) != 1) | ||
153 | return -EIO; | 137 | return -EIO; |
154 | #endif | 138 | } |
155 | |||
156 | return 0; | 139 | return 0; |
157 | } | 140 | } |
158 | 141 | ||
@@ -205,7 +188,7 @@ static int __init snd_gusextreme_probe(int dev) | |||
205 | xgf1_irq = gf1_irq[dev]; | 188 | xgf1_irq = gf1_irq[dev]; |
206 | if (xgf1_irq == SNDRV_AUTO_IRQ) { | 189 | if (xgf1_irq == SNDRV_AUTO_IRQ) { |
207 | if ((xgf1_irq = snd_legacy_find_free_irq(possible_gf1_irqs)) < 0) { | 190 | if ((xgf1_irq = snd_legacy_find_free_irq(possible_gf1_irqs)) < 0) { |
208 | snd_printk("unable to find a free IRQ for GF1\n"); | 191 | snd_printk(KERN_ERR PFX "unable to find a free IRQ for GF1\n"); |
209 | err = -EBUSY; | 192 | err = -EBUSY; |
210 | goto out; | 193 | goto out; |
211 | } | 194 | } |
@@ -213,7 +196,7 @@ static int __init snd_gusextreme_probe(int dev) | |||
213 | xess_irq = irq[dev]; | 196 | xess_irq = irq[dev]; |
214 | if (xess_irq == SNDRV_AUTO_IRQ) { | 197 | if (xess_irq == SNDRV_AUTO_IRQ) { |
215 | if ((xess_irq = snd_legacy_find_free_irq(possible_ess_irqs)) < 0) { | 198 | if ((xess_irq = snd_legacy_find_free_irq(possible_ess_irqs)) < 0) { |
216 | snd_printk("unable to find a free IRQ for ES1688\n"); | 199 | snd_printk(KERN_ERR PFX "unable to find a free IRQ for ES1688\n"); |
217 | err = -EBUSY; | 200 | err = -EBUSY; |
218 | goto out; | 201 | goto out; |
219 | } | 202 | } |
@@ -226,7 +209,7 @@ static int __init snd_gusextreme_probe(int dev) | |||
226 | xgf1_dma = dma1[dev]; | 209 | xgf1_dma = dma1[dev]; |
227 | if (xgf1_dma == SNDRV_AUTO_DMA) { | 210 | if (xgf1_dma == SNDRV_AUTO_DMA) { |
228 | if ((xgf1_dma = snd_legacy_find_free_dma(possible_gf1_dmas)) < 0) { | 211 | if ((xgf1_dma = snd_legacy_find_free_dma(possible_gf1_dmas)) < 0) { |
229 | snd_printk("unable to find a free DMA for GF1\n"); | 212 | snd_printk(KERN_ERR PFX "unable to find a free DMA for GF1\n"); |
230 | err = -EBUSY; | 213 | err = -EBUSY; |
231 | goto out; | 214 | goto out; |
232 | } | 215 | } |
@@ -234,7 +217,7 @@ static int __init snd_gusextreme_probe(int dev) | |||
234 | xess_dma = dma8[dev]; | 217 | xess_dma = dma8[dev]; |
235 | if (xess_dma == SNDRV_AUTO_DMA) { | 218 | if (xess_dma == SNDRV_AUTO_DMA) { |
236 | if ((xess_dma = snd_legacy_find_free_dma(possible_ess_dmas)) < 0) { | 219 | if ((xess_dma = snd_legacy_find_free_dma(possible_ess_dmas)) < 0) { |
237 | snd_printk("unable to find a free DMA for ES1688\n"); | 220 | snd_printk(KERN_ERR PFX "unable to find a free DMA for ES1688\n"); |
238 | err = -EBUSY; | 221 | err = -EBUSY; |
239 | goto out; | 222 | goto out; |
240 | } | 223 | } |
@@ -264,7 +247,7 @@ static int __init snd_gusextreme_probe(int dev) | |||
264 | goto out; | 247 | goto out; |
265 | 248 | ||
266 | if (!gus->ess_flag) { | 249 | if (!gus->ess_flag) { |
267 | snd_printdd("GUS Extreme soundcard was not detected at 0x%lx\n", gus->gf1.port); | 250 | snd_printk(KERN_ERR PFX "GUS Extreme soundcard was not detected at 0x%lx\n", gus->gf1.port); |
268 | err = -ENODEV; | 251 | err = -ENODEV; |
269 | goto out; | 252 | goto out; |
270 | } | 253 | } |
@@ -287,7 +270,7 @@ static int __init snd_gusextreme_probe(int dev) | |||
287 | 270 | ||
288 | if (snd_opl3_create(card, es1688->port, es1688->port + 2, | 271 | if (snd_opl3_create(card, es1688->port, es1688->port + 2, |
289 | OPL3_HW_OPL3, 0, &opl3) < 0) { | 272 | OPL3_HW_OPL3, 0, &opl3) < 0) { |
290 | printk(KERN_ERR "gusextreme: opl3 not detected at 0x%lx\n", es1688->port); | 273 | printk(KERN_ERR PFX "gusextreme: opl3 not detected at 0x%lx\n", es1688->port); |
291 | } else { | 274 | } else { |
292 | if ((err = snd_opl3_hwdep_new(opl3, 0, 2, NULL)) < 0) | 275 | if ((err = snd_opl3_hwdep_new(opl3, 0, 2, NULL)) < 0) |
293 | goto out; | 276 | goto out; |
@@ -303,6 +286,10 @@ static int __init snd_gusextreme_probe(int dev) | |||
303 | 286 | ||
304 | sprintf(card->longname, "Gravis UltraSound Extreme at 0x%lx, irq %i&%i, dma %i&%i", | 287 | sprintf(card->longname, "Gravis UltraSound Extreme at 0x%lx, irq %i&%i, dma %i&%i", |
305 | es1688->port, xgf1_irq, xess_irq, xgf1_dma, xess_dma); | 288 | es1688->port, xgf1_irq, xess_irq, xgf1_dma, xess_dma); |
289 | |||
290 | if ((err = snd_card_set_generic_dev(card)) < 0) | ||
291 | goto out; | ||
292 | |||
306 | if ((err = snd_card_register(card)) < 0) | 293 | if ((err = snd_card_register(card)) < 0) |
307 | goto out; | 294 | goto out; |
308 | 295 | ||
diff --git a/sound/isa/gus/gusmax.c b/sound/isa/gus/gusmax.c index 400ff34710fb..0bb44b519340 100644 --- a/sound/isa/gus/gusmax.c +++ b/sound/isa/gus/gusmax.c | |||
@@ -82,39 +82,25 @@ struct snd_gusmax { | |||
82 | 82 | ||
83 | static snd_card_t *snd_gusmax_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR; | 83 | static snd_card_t *snd_gusmax_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR; |
84 | 84 | ||
85 | #define PFX "gusmax: " | ||
85 | 86 | ||
86 | static int __init snd_gusmax_detect(snd_gus_card_t * gus) | 87 | static int __init snd_gusmax_detect(snd_gus_card_t * gus) |
87 | { | 88 | { |
88 | snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 0); /* reset GF1 */ | 89 | unsigned char d; |
89 | #ifdef CONFIG_SND_DEBUG_DETECT | ||
90 | { | ||
91 | unsigned char d; | ||
92 | 90 | ||
93 | if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 0) { | 91 | snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 0); /* reset GF1 */ |
94 | snd_printk("[0x%lx] check 1 failed - 0x%x\n", gus->gf1.port, d); | 92 | if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 0) { |
95 | return -ENODEV; | 93 | snd_printdd("[0x%lx] check 1 failed - 0x%x\n", gus->gf1.port, d); |
96 | } | ||
97 | } | ||
98 | #else | ||
99 | if ((snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET) & 0x07) != 0) | ||
100 | return -ENODEV; | 94 | return -ENODEV; |
101 | #endif | 95 | } |
102 | udelay(160); | 96 | udelay(160); |
103 | snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 1); /* release reset */ | 97 | snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 1); /* release reset */ |
104 | udelay(160); | 98 | udelay(160); |
105 | #ifdef CONFIG_SND_DEBUG_DETECT | 99 | if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 1) { |
106 | { | 100 | snd_printdd("[0x%lx] check 2 failed - 0x%x\n", gus->gf1.port, d); |
107 | unsigned char d; | ||
108 | |||
109 | if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 1) { | ||
110 | snd_printk("[0x%lx] check 2 failed - 0x%x\n", gus->gf1.port, d); | ||
111 | return -ENODEV; | ||
112 | } | ||
113 | } | ||
114 | #else | ||
115 | if ((snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET) & 0x07) != 1) | ||
116 | return -ENODEV; | 101 | return -ENODEV; |
117 | #endif | 102 | } |
103 | |||
118 | return 0; | 104 | return 0; |
119 | } | 105 | } |
120 | 106 | ||
@@ -239,25 +225,25 @@ static int __init snd_gusmax_probe(int dev) | |||
239 | xirq = irq[dev]; | 225 | xirq = irq[dev]; |
240 | if (xirq == SNDRV_AUTO_IRQ) { | 226 | if (xirq == SNDRV_AUTO_IRQ) { |
241 | if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) { | 227 | if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) { |
242 | snd_card_free(card); | 228 | snd_printk(KERN_ERR PFX "unable to find a free IRQ\n"); |
243 | snd_printk("unable to find a free IRQ\n"); | 229 | err = -EBUSY; |
244 | return -EBUSY; | 230 | goto _err; |
245 | } | 231 | } |
246 | } | 232 | } |
247 | xdma1 = dma1[dev]; | 233 | xdma1 = dma1[dev]; |
248 | if (xdma1 == SNDRV_AUTO_DMA) { | 234 | if (xdma1 == SNDRV_AUTO_DMA) { |
249 | if ((xdma1 = snd_legacy_find_free_dma(possible_dmas)) < 0) { | 235 | if ((xdma1 = snd_legacy_find_free_dma(possible_dmas)) < 0) { |
250 | snd_card_free(card); | 236 | snd_printk(KERN_ERR PFX "unable to find a free DMA1\n"); |
251 | snd_printk("unable to find a free DMA1\n"); | 237 | err = -EBUSY; |
252 | return -EBUSY; | 238 | goto _err; |
253 | } | 239 | } |
254 | } | 240 | } |
255 | xdma2 = dma2[dev]; | 241 | xdma2 = dma2[dev]; |
256 | if (xdma2 == SNDRV_AUTO_DMA) { | 242 | if (xdma2 == SNDRV_AUTO_DMA) { |
257 | if ((xdma2 = snd_legacy_find_free_dma(possible_dmas)) < 0) { | 243 | if ((xdma2 = snd_legacy_find_free_dma(possible_dmas)) < 0) { |
258 | snd_card_free(card); | 244 | snd_printk(KERN_ERR PFX "unable to find a free DMA2\n"); |
259 | snd_printk("unable to find a free DMA2\n"); | 245 | err = -EBUSY; |
260 | return -EBUSY; | 246 | goto _err; |
261 | } | 247 | } |
262 | } | 248 | } |
263 | 249 | ||
@@ -266,31 +252,28 @@ static int __init snd_gusmax_probe(int dev) | |||
266 | -xirq, xdma1, xdma2, | 252 | -xirq, xdma1, xdma2, |
267 | 0, channels[dev], | 253 | 0, channels[dev], |
268 | pcm_channels[dev], | 254 | pcm_channels[dev], |
269 | 0, &gus)) < 0) { | 255 | 0, &gus)) < 0) |
270 | snd_card_free(card); | 256 | goto _err; |
271 | return err; | 257 | |
272 | } | 258 | if ((err = snd_gusmax_detect(gus)) < 0) |
273 | if ((err = snd_gusmax_detect(gus)) < 0) { | 259 | goto _err; |
274 | snd_card_free(card); | 260 | |
275 | return err; | ||
276 | } | ||
277 | maxcard->gus_status_reg = gus->gf1.reg_irqstat; | 261 | maxcard->gus_status_reg = gus->gf1.reg_irqstat; |
278 | maxcard->pcm_status_reg = gus->gf1.port + 0x10c + 2; | 262 | maxcard->pcm_status_reg = gus->gf1.port + 0x10c + 2; |
279 | snd_gusmax_init(dev, card, gus); | 263 | snd_gusmax_init(dev, card, gus); |
280 | if ((err = snd_gus_initialize(gus)) < 0) { | 264 | if ((err = snd_gus_initialize(gus)) < 0) |
281 | snd_card_free(card); | 265 | goto _err; |
282 | return err; | 266 | |
283 | } | ||
284 | if (!gus->max_flag) { | 267 | if (!gus->max_flag) { |
285 | printk(KERN_ERR "GUS MAX soundcard was not detected at 0x%lx\n", gus->gf1.port); | 268 | snd_printk(KERN_ERR PFX "GUS MAX soundcard was not detected at 0x%lx\n", gus->gf1.port); |
286 | snd_card_free(card); | 269 | err = -ENODEV; |
287 | return -ENODEV; | 270 | goto _err; |
288 | } | 271 | } |
289 | 272 | ||
290 | if (request_irq(xirq, snd_gusmax_interrupt, SA_INTERRUPT, "GUS MAX", (void *)maxcard)) { | 273 | if (request_irq(xirq, snd_gusmax_interrupt, SA_INTERRUPT, "GUS MAX", (void *)maxcard)) { |
291 | snd_card_free(card); | 274 | snd_printk(KERN_ERR PFX "unable to grab IRQ %d\n", xirq); |
292 | printk(KERN_ERR "gusmax: unable to grab IRQ %d\n", xirq); | 275 | err = -EBUSY; |
293 | return -EBUSY; | 276 | goto _err; |
294 | } | 277 | } |
295 | maxcard->irq = xirq; | 278 | maxcard->irq = xirq; |
296 | 279 | ||
@@ -301,50 +284,46 @@ static int __init snd_gusmax_probe(int dev) | |||
301 | CS4231_HWSHARE_IRQ | | 284 | CS4231_HWSHARE_IRQ | |
302 | CS4231_HWSHARE_DMA1 | | 285 | CS4231_HWSHARE_DMA1 | |
303 | CS4231_HWSHARE_DMA2, | 286 | CS4231_HWSHARE_DMA2, |
304 | &cs4231)) < 0) { | 287 | &cs4231)) < 0) |
305 | snd_card_free(card); | 288 | goto _err; |
306 | return err; | 289 | |
307 | } | 290 | if ((err = snd_cs4231_pcm(cs4231, 0, NULL)) < 0) |
308 | if ((err = snd_cs4231_pcm(cs4231, 0, NULL)) < 0) { | 291 | goto _err; |
309 | snd_card_free(card); | 292 | |
310 | return err; | 293 | if ((err = snd_cs4231_mixer(cs4231)) < 0) |
311 | } | 294 | goto _err; |
312 | if ((err = snd_cs4231_mixer(cs4231)) < 0) { | 295 | |
313 | snd_card_free(card); | 296 | if ((err = snd_cs4231_timer(cs4231, 2, NULL)) < 0) |
314 | return err; | 297 | goto _err; |
315 | } | 298 | |
316 | if ((err = snd_cs4231_timer(cs4231, 2, NULL)) < 0) { | ||
317 | snd_card_free(card); | ||
318 | return err; | ||
319 | } | ||
320 | if (pcm_channels[dev] > 0) { | 299 | if (pcm_channels[dev] > 0) { |
321 | if ((err = snd_gf1_pcm_new(gus, 1, 1, NULL)) < 0) { | 300 | if ((err = snd_gf1_pcm_new(gus, 1, 1, NULL)) < 0) |
322 | snd_card_free(card); | 301 | goto _err; |
323 | return err; | ||
324 | } | ||
325 | } | ||
326 | if ((err = snd_gusmax_mixer(cs4231)) < 0) { | ||
327 | snd_card_free(card); | ||
328 | return err; | ||
329 | } | 302 | } |
303 | if ((err = snd_gusmax_mixer(cs4231)) < 0) | ||
304 | goto _err; | ||
330 | 305 | ||
331 | if ((err = snd_gf1_rawmidi_new(gus, 0, NULL)) < 0) { | 306 | if ((err = snd_gf1_rawmidi_new(gus, 0, NULL)) < 0) |
332 | snd_card_free(card); | 307 | goto _err; |
333 | return err; | ||
334 | } | ||
335 | 308 | ||
336 | sprintf(card->longname + strlen(card->longname), " at 0x%lx, irq %i, dma %i", gus->gf1.port, xirq, xdma1); | 309 | sprintf(card->longname + strlen(card->longname), " at 0x%lx, irq %i, dma %i", gus->gf1.port, xirq, xdma1); |
337 | if (xdma2 >= 0) | 310 | if (xdma2 >= 0) |
338 | sprintf(card->longname + strlen(card->longname), "&%i", xdma2); | 311 | sprintf(card->longname + strlen(card->longname), "&%i", xdma2); |
339 | if ((err = snd_card_register(card)) < 0) { | 312 | |
340 | snd_card_free(card); | 313 | if ((err = snd_card_set_generic_dev(card)) < 0) |
341 | return err; | 314 | goto _err; |
342 | } | 315 | |
316 | if ((err = snd_card_register(card)) < 0) | ||
317 | goto _err; | ||
343 | 318 | ||
344 | maxcard->gus = gus; | 319 | maxcard->gus = gus; |
345 | maxcard->cs4231 = cs4231; | 320 | maxcard->cs4231 = cs4231; |
346 | snd_gusmax_cards[dev] = card; | 321 | snd_gusmax_cards[dev] = card; |
347 | return 0; | 322 | return 0; |
323 | |||
324 | _err: | ||
325 | snd_card_free(card); | ||
326 | return err; | ||
348 | } | 327 | } |
349 | 328 | ||
350 | static int __init snd_gusmax_legacy_auto_probe(unsigned long xport) | 329 | static int __init snd_gusmax_legacy_auto_probe(unsigned long xport) |
diff --git a/sound/isa/gus/interwave.c b/sound/isa/gus/interwave.c index 46e867daba6a..358cba9d738f 100644 --- a/sound/isa/gus/interwave.c +++ b/sound/isa/gus/interwave.c | |||
@@ -73,6 +73,12 @@ static int midi[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0}; | |||
73 | static int pcm_channels[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 2}; | 73 | static int pcm_channels[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 2}; |
74 | static int effect[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0}; | 74 | static int effect[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0}; |
75 | 75 | ||
76 | #ifdef SNDRV_STB | ||
77 | #define PFX "interwave-stb: " | ||
78 | #else | ||
79 | #define PFX "interwave: " | ||
80 | #endif | ||
81 | |||
76 | module_param_array(index, int, NULL, 0444); | 82 | module_param_array(index, int, NULL, 0444); |
77 | MODULE_PARM_DESC(index, "Index value for InterWave soundcard."); | 83 | MODULE_PARM_DESC(index, "Index value for InterWave soundcard."); |
78 | module_param_array(id, charp, NULL, 0444); | 84 | module_param_array(id, charp, NULL, 0444); |
@@ -249,38 +255,20 @@ static int __devinit snd_interwave_detect(struct snd_interwave *iwcard, | |||
249 | { | 255 | { |
250 | unsigned long flags; | 256 | unsigned long flags; |
251 | unsigned char rev1, rev2; | 257 | unsigned char rev1, rev2; |
258 | int d; | ||
252 | 259 | ||
253 | snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 0); /* reset GF1 */ | 260 | snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 0); /* reset GF1 */ |
254 | #ifdef CONFIG_SND_DEBUG_DETECT | 261 | if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 0) { |
255 | { | 262 | snd_printdd("[0x%lx] check 1 failed - 0x%x\n", gus->gf1.port, d); |
256 | int d; | ||
257 | |||
258 | if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 0) { | ||
259 | snd_printk("[0x%lx] check 1 failed - 0x%x\n", gus->gf1.port, d); | ||
260 | return -ENODEV; | ||
261 | } | ||
262 | } | ||
263 | #else | ||
264 | if ((snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET) & 0x07) != 0) | ||
265 | return -ENODEV; | 263 | return -ENODEV; |
266 | #endif | 264 | } |
267 | udelay(160); | 265 | udelay(160); |
268 | snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 1); /* release reset */ | 266 | snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 1); /* release reset */ |
269 | udelay(160); | 267 | udelay(160); |
270 | #ifdef CONFIG_SND_DEBUG_DETECT | 268 | if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 1) { |
271 | { | 269 | snd_printdd("[0x%lx] check 2 failed - 0x%x\n", gus->gf1.port, d); |
272 | int d; | ||
273 | |||
274 | if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 1) { | ||
275 | snd_printk("[0x%lx] check 2 failed - 0x%x\n", gus->gf1.port, d); | ||
276 | return -ENODEV; | ||
277 | } | ||
278 | } | ||
279 | #else | ||
280 | if ((snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET) & 0x07) != 1) | ||
281 | return -ENODEV; | 270 | return -ENODEV; |
282 | #endif | 271 | } |
283 | |||
284 | spin_lock_irqsave(&gus->reg_lock, flags); | 272 | spin_lock_irqsave(&gus->reg_lock, flags); |
285 | rev1 = snd_gf1_look8(gus, SNDRV_GF1_GB_VERSION_NUMBER); | 273 | rev1 = snd_gf1_look8(gus, SNDRV_GF1_GB_VERSION_NUMBER); |
286 | snd_gf1_write8(gus, SNDRV_GF1_GB_VERSION_NUMBER, ~rev1); | 274 | snd_gf1_write8(gus, SNDRV_GF1_GB_VERSION_NUMBER, ~rev1); |
@@ -686,35 +674,33 @@ static int __devinit snd_interwave_probe(int dev, struct pnp_card_link *pcard, | |||
686 | card->private_free = snd_interwave_free; | 674 | card->private_free = snd_interwave_free; |
687 | #ifdef CONFIG_PNP | 675 | #ifdef CONFIG_PNP |
688 | if (isapnp[dev]) { | 676 | if (isapnp[dev]) { |
689 | if (snd_interwave_pnp(dev, iwcard, pcard, pid)) { | 677 | if ((err = snd_interwave_pnp(dev, iwcard, pcard, pid)) < 0) |
690 | snd_card_free(card); | 678 | goto _err; |
691 | return -ENODEV; | ||
692 | } | ||
693 | snd_card_set_dev(card, &pcard->card->dev); | 679 | snd_card_set_dev(card, &pcard->card->dev); |
694 | } | 680 | } |
695 | #endif | 681 | #endif |
696 | xirq = irq[dev]; | 682 | xirq = irq[dev]; |
697 | if (xirq == SNDRV_AUTO_IRQ) { | 683 | if (xirq == SNDRV_AUTO_IRQ) { |
698 | if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) { | 684 | if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) { |
699 | snd_card_free(card); | 685 | snd_printk(KERN_ERR PFX "unable to find a free IRQ\n"); |
700 | snd_printk("unable to find a free IRQ\n"); | 686 | err = -EBUSY; |
701 | return -EBUSY; | 687 | goto _err; |
702 | } | 688 | } |
703 | } | 689 | } |
704 | xdma1 = dma1[dev]; | 690 | xdma1 = dma1[dev]; |
705 | if (xdma1 == SNDRV_AUTO_DMA) { | 691 | if (xdma1 == SNDRV_AUTO_DMA) { |
706 | if ((xdma1 = snd_legacy_find_free_dma(possible_dmas)) < 0) { | 692 | if ((xdma1 = snd_legacy_find_free_dma(possible_dmas)) < 0) { |
707 | snd_card_free(card); | 693 | snd_printk(KERN_ERR PFX "unable to find a free DMA1\n"); |
708 | snd_printk("unable to find a free DMA1\n"); | 694 | err = -EBUSY; |
709 | return -EBUSY; | 695 | goto _err; |
710 | } | 696 | } |
711 | } | 697 | } |
712 | xdma2 = dma2[dev]; | 698 | xdma2 = dma2[dev]; |
713 | if (xdma2 == SNDRV_AUTO_DMA) { | 699 | if (xdma2 == SNDRV_AUTO_DMA) { |
714 | if ((xdma2 = snd_legacy_find_free_dma(possible_dmas)) < 0) { | 700 | if ((xdma2 = snd_legacy_find_free_dma(possible_dmas)) < 0) { |
715 | snd_card_free(card); | 701 | snd_printk(KERN_ERR PFX "unable to find a free DMA2\n"); |
716 | snd_printk("unable to find a free DMA2\n"); | 702 | err = -EBUSY; |
717 | return -EBUSY; | 703 | goto _err; |
718 | } | 704 | } |
719 | } | 705 | } |
720 | 706 | ||
@@ -722,32 +708,28 @@ static int __devinit snd_interwave_probe(int dev, struct pnp_card_link *pcard, | |||
722 | port[dev], | 708 | port[dev], |
723 | -xirq, xdma1, xdma2, | 709 | -xirq, xdma1, xdma2, |
724 | 0, 32, | 710 | 0, 32, |
725 | pcm_channels[dev], effect[dev], &gus)) < 0) { | 711 | pcm_channels[dev], effect[dev], &gus)) < 0) |
726 | snd_card_free(card); | 712 | goto _err; |
727 | return err; | 713 | |
728 | } | ||
729 | if ((err = snd_interwave_detect(iwcard, gus, dev | 714 | if ((err = snd_interwave_detect(iwcard, gus, dev |
730 | #ifdef SNDRV_STB | 715 | #ifdef SNDRV_STB |
731 | , &i2c_bus | 716 | , &i2c_bus |
732 | #endif | 717 | #endif |
733 | )) < 0) { | 718 | )) < 0) |
734 | snd_card_free(card); | 719 | goto _err; |
735 | return err; | 720 | |
736 | } | ||
737 | iwcard->gus_status_reg = gus->gf1.reg_irqstat; | 721 | iwcard->gus_status_reg = gus->gf1.reg_irqstat; |
738 | iwcard->pcm_status_reg = gus->gf1.port + 0x10c + 2; | 722 | iwcard->pcm_status_reg = gus->gf1.port + 0x10c + 2; |
739 | 723 | ||
740 | snd_interwave_init(dev, gus); | 724 | snd_interwave_init(dev, gus); |
741 | snd_interwave_detect_memory(gus); | 725 | snd_interwave_detect_memory(gus); |
742 | if ((err = snd_gus_initialize(gus)) < 0) { | 726 | if ((err = snd_gus_initialize(gus)) < 0) |
743 | snd_card_free(card); | 727 | goto _err; |
744 | return err; | ||
745 | } | ||
746 | 728 | ||
747 | if (request_irq(xirq, snd_interwave_interrupt, SA_INTERRUPT, "InterWave", (void *)iwcard)) { | 729 | if (request_irq(xirq, snd_interwave_interrupt, SA_INTERRUPT, "InterWave", (void *)iwcard)) { |
748 | snd_card_free(card); | 730 | snd_printk(KERN_ERR PFX "unable to grab IRQ %d\n", xirq); |
749 | snd_printk("unable to grab IRQ %d\n", xirq); | 731 | err = -EBUSY; |
750 | return -EBUSY; | 732 | goto _err; |
751 | } | 733 | } |
752 | iwcard->irq = xirq; | 734 | iwcard->irq = xirq; |
753 | 735 | ||
@@ -758,34 +740,28 @@ static int __devinit snd_interwave_probe(int dev, struct pnp_card_link *pcard, | |||
758 | CS4231_HWSHARE_IRQ | | 740 | CS4231_HWSHARE_IRQ | |
759 | CS4231_HWSHARE_DMA1 | | 741 | CS4231_HWSHARE_DMA1 | |
760 | CS4231_HWSHARE_DMA2, | 742 | CS4231_HWSHARE_DMA2, |
761 | &cs4231)) < 0) { | 743 | &cs4231)) < 0) |
762 | snd_card_free(card); | 744 | goto _err; |
763 | return err; | 745 | |
764 | } | 746 | if ((err = snd_cs4231_pcm(cs4231, 0, &pcm)) < 0) |
765 | if ((err = snd_cs4231_pcm(cs4231, 0, &pcm)) < 0) { | 747 | goto _err; |
766 | snd_card_free(card); | 748 | |
767 | return err; | ||
768 | } | ||
769 | sprintf(pcm->name + strlen(pcm->name), " rev %c", gus->revision + 'A'); | 749 | sprintf(pcm->name + strlen(pcm->name), " rev %c", gus->revision + 'A'); |
770 | strcat(pcm->name, " (codec)"); | 750 | strcat(pcm->name, " (codec)"); |
771 | if ((err = snd_cs4231_timer(cs4231, 2, NULL)) < 0) { | 751 | |
772 | snd_card_free(card); | 752 | if ((err = snd_cs4231_timer(cs4231, 2, NULL)) < 0) |
773 | return err; | 753 | goto _err; |
774 | } | 754 | |
775 | if ((err = snd_cs4231_mixer(cs4231)) < 0) { | 755 | if ((err = snd_cs4231_mixer(cs4231)) < 0) |
776 | snd_card_free(card); | 756 | goto _err; |
777 | return err; | 757 | |
778 | } | ||
779 | if (pcm_channels[dev] > 0) { | 758 | if (pcm_channels[dev] > 0) { |
780 | if ((err = snd_gf1_pcm_new(gus, 1, 1, NULL)) < 0) { | 759 | if ((err = snd_gf1_pcm_new(gus, 1, 1, NULL)) < 0) |
781 | snd_card_free(card); | 760 | goto _err; |
782 | return err; | ||
783 | } | ||
784 | } | ||
785 | if ((err = snd_interwave_mixer(cs4231)) < 0) { | ||
786 | snd_card_free(card); | ||
787 | return err; | ||
788 | } | 761 | } |
762 | if ((err = snd_interwave_mixer(cs4231)) < 0) | ||
763 | goto _err; | ||
764 | |||
789 | #ifdef SNDRV_STB | 765 | #ifdef SNDRV_STB |
790 | { | 766 | { |
791 | snd_ctl_elem_id_t id1, id2; | 767 | snd_ctl_elem_id_t id1, id2; |
@@ -795,28 +771,20 @@ static int __devinit snd_interwave_probe(int dev, struct pnp_card_link *pcard, | |||
795 | strcpy(id1.name, "Master Playback Switch"); | 771 | strcpy(id1.name, "Master Playback Switch"); |
796 | strcpy(id2.name, id1.name); | 772 | strcpy(id2.name, id1.name); |
797 | id2.index = 1; | 773 | id2.index = 1; |
798 | if ((err = snd_ctl_rename_id(card, &id1, &id2)) < 0) { | 774 | if ((err = snd_ctl_rename_id(card, &id1, &id2)) < 0) |
799 | snd_card_free(card); | 775 | goto _err; |
800 | return err; | ||
801 | } | ||
802 | strcpy(id1.name, "Master Playback Volume"); | 776 | strcpy(id1.name, "Master Playback Volume"); |
803 | strcpy(id2.name, id1.name); | 777 | strcpy(id2.name, id1.name); |
804 | if ((err = snd_ctl_rename_id(card, &id1, &id2)) < 0) { | 778 | if ((err = snd_ctl_rename_id(card, &id1, &id2)) < 0) |
805 | snd_card_free(card); | 779 | goto _err; |
806 | return err; | 780 | if ((err = snd_tea6330t_update_mixer(card, i2c_bus, 0, 1)) < 0) |
807 | } | 781 | goto _err; |
808 | if ((err = snd_tea6330t_update_mixer(card, i2c_bus, 0, 1)) < 0) { | ||
809 | snd_card_free(card); | ||
810 | return err; | ||
811 | } | ||
812 | } | 782 | } |
813 | #endif | 783 | #endif |
814 | 784 | ||
815 | gus->uart_enable = midi[dev]; | 785 | gus->uart_enable = midi[dev]; |
816 | if ((err = snd_gf1_rawmidi_new(gus, 0, NULL)) < 0) { | 786 | if ((err = snd_gf1_rawmidi_new(gus, 0, NULL)) < 0) |
817 | snd_card_free(card); | 787 | goto _err; |
818 | return err; | ||
819 | } | ||
820 | 788 | ||
821 | #ifndef SNDRV_STB | 789 | #ifndef SNDRV_STB |
822 | str = "AMD InterWave"; | 790 | str = "AMD InterWave"; |
@@ -835,10 +803,11 @@ static int __devinit snd_interwave_probe(int dev, struct pnp_card_link *pcard, | |||
835 | if (xdma2 >= 0) | 803 | if (xdma2 >= 0) |
836 | sprintf(card->longname + strlen(card->longname), "&%d", xdma2); | 804 | sprintf(card->longname + strlen(card->longname), "&%d", xdma2); |
837 | 805 | ||
838 | if ((err = snd_card_register(card)) < 0) { | 806 | if ((err = snd_card_set_generic_dev(card)) < 0) |
839 | snd_card_free(card); | 807 | goto _err; |
840 | return err; | 808 | |
841 | } | 809 | if ((err = snd_card_register(card)) < 0) |
810 | goto _err; | ||
842 | 811 | ||
843 | iwcard->cs4231 = cs4231; | 812 | iwcard->cs4231 = cs4231; |
844 | iwcard->gus = gus; | 813 | iwcard->gus = gus; |
@@ -847,6 +816,10 @@ static int __devinit snd_interwave_probe(int dev, struct pnp_card_link *pcard, | |||
847 | else | 816 | else |
848 | snd_interwave_legacy[dev++] = card; | 817 | snd_interwave_legacy[dev++] = card; |
849 | return 0; | 818 | return 0; |
819 | |||
820 | _err: | ||
821 | snd_card_free(card); | ||
822 | return err; | ||
850 | } | 823 | } |
851 | 824 | ||
852 | static int __devinit snd_interwave_probe_legacy_port(unsigned long xport) | 825 | static int __devinit snd_interwave_probe_legacy_port(unsigned long xport) |
diff --git a/sound/isa/opl3sa2.c b/sound/isa/opl3sa2.c index 95c7b3e53407..4ba268f251e3 100644 --- a/sound/isa/opl3sa2.c +++ b/sound/isa/opl3sa2.c | |||
@@ -143,8 +143,18 @@ struct snd_opl3sa2 { | |||
143 | 143 | ||
144 | static snd_card_t *snd_opl3sa2_legacy[SNDRV_CARDS] = SNDRV_DEFAULT_PTR; | 144 | static snd_card_t *snd_opl3sa2_legacy[SNDRV_CARDS] = SNDRV_DEFAULT_PTR; |
145 | 145 | ||
146 | #define PFX "opl3sa2: " | ||
147 | |||
146 | #ifdef CONFIG_PNP | 148 | #ifdef CONFIG_PNP |
147 | 149 | ||
150 | static struct pnp_device_id snd_opl3sa2_pnpbiosids[] = { | ||
151 | { .id = "YMH0021" }, | ||
152 | { .id = "NMX2210" }, /* Gateway Solo 2500 */ | ||
153 | { .id = "" } /* end */ | ||
154 | }; | ||
155 | |||
156 | MODULE_DEVICE_TABLE(pnp, snd_opl3sa2_pnpbiosids); | ||
157 | |||
148 | static struct pnp_card_device_id snd_opl3sa2_pnpids[] = { | 158 | static struct pnp_card_device_id snd_opl3sa2_pnpids[] = { |
149 | /* Yamaha YMF719E-S (Genius Sound Maker 3DX) */ | 159 | /* Yamaha YMF719E-S (Genius Sound Maker 3DX) */ |
150 | { .id = "YMH0020", .devs = { { "YMH0021" } } }, | 160 | { .id = "YMH0020", .devs = { { "YMH0021" } } }, |
@@ -223,7 +233,7 @@ static int __init snd_opl3sa2_detect(opl3sa2_t *chip) | |||
223 | card = chip->card; | 233 | card = chip->card; |
224 | port = chip->port; | 234 | port = chip->port; |
225 | if ((chip->res_port = request_region(port, 2, "OPL3-SA control")) == NULL) { | 235 | if ((chip->res_port = request_region(port, 2, "OPL3-SA control")) == NULL) { |
226 | snd_printk(KERN_ERR "opl3sa2: can't grab port 0x%lx\n", port); | 236 | snd_printk(KERN_ERR PFX "can't grab port 0x%lx\n", port); |
227 | return -EBUSY; | 237 | return -EBUSY; |
228 | } | 238 | } |
229 | // snd_printk("REG 0A = 0x%x\n", snd_opl3sa2_read(chip, 0x0a)); | 239 | // snd_printk("REG 0A = 0x%x\n", snd_opl3sa2_read(chip, 0x0a)); |
@@ -568,20 +578,18 @@ static int snd_opl3sa2_resume(snd_card_t *card) | |||
568 | 578 | ||
569 | #ifdef CONFIG_PNP | 579 | #ifdef CONFIG_PNP |
570 | static int __init snd_opl3sa2_pnp(int dev, opl3sa2_t *chip, | 580 | static int __init snd_opl3sa2_pnp(int dev, opl3sa2_t *chip, |
571 | struct pnp_card_link *card, | 581 | struct pnp_dev *pdev, |
572 | const struct pnp_card_device_id *id) | 582 | int isapnp) |
573 | { | 583 | { |
574 | struct pnp_dev *pdev; | 584 | struct pnp_resource_table * cfg; |
575 | struct pnp_resource_table * cfg = kmalloc(sizeof(struct pnp_resource_table), GFP_KERNEL); | ||
576 | int err; | 585 | int err; |
577 | 586 | ||
587 | if (!isapnp && pnp_device_is_isapnp(pdev)) | ||
588 | return -ENOENT; /* we have another procedure - card */ | ||
589 | |||
590 | cfg = kmalloc(sizeof(struct pnp_resource_table), GFP_KERNEL); | ||
578 | if (!cfg) | 591 | if (!cfg) |
579 | return -ENOMEM; | 592 | return -ENOMEM; |
580 | pdev = chip->dev = pnp_request_card_device(card, id->devs[0].id, NULL); | ||
581 | if (chip->dev == NULL) { | ||
582 | kfree(cfg); | ||
583 | return -EBUSY; | ||
584 | } | ||
585 | /* PnP initialization */ | 593 | /* PnP initialization */ |
586 | pnp_init_resource_table(cfg); | 594 | pnp_init_resource_table(cfg); |
587 | if (sb_port[dev] != SNDRV_AUTO_PORT) | 595 | if (sb_port[dev] != SNDRV_AUTO_PORT) |
@@ -601,7 +609,7 @@ static int __init snd_opl3sa2_pnp(int dev, opl3sa2_t *chip, | |||
601 | if (irq[dev] != SNDRV_AUTO_IRQ) | 609 | if (irq[dev] != SNDRV_AUTO_IRQ) |
602 | pnp_resource_change(&cfg->irq_resource[0], irq[dev], 1); | 610 | pnp_resource_change(&cfg->irq_resource[0], irq[dev], 1); |
603 | err = pnp_manual_config_dev(pdev, cfg, 0); | 611 | err = pnp_manual_config_dev(pdev, cfg, 0); |
604 | if (err < 0) | 612 | if (err < 0 && isapnp) |
605 | snd_printk(KERN_ERR "PnP manual resources are invalid, using auto config\n"); | 613 | snd_printk(KERN_ERR "PnP manual resources are invalid, using auto config\n"); |
606 | err = pnp_activate_dev(pdev); | 614 | err = pnp_activate_dev(pdev); |
607 | if (err < 0) { | 615 | if (err < 0) { |
@@ -617,13 +625,31 @@ static int __init snd_opl3sa2_pnp(int dev, opl3sa2_t *chip, | |||
617 | dma1[dev] = pnp_dma(pdev, 0); | 625 | dma1[dev] = pnp_dma(pdev, 0); |
618 | dma2[dev] = pnp_dma(pdev, 1); | 626 | dma2[dev] = pnp_dma(pdev, 1); |
619 | irq[dev] = pnp_irq(pdev, 0); | 627 | irq[dev] = pnp_irq(pdev, 0); |
620 | snd_printdd("PnP OPL3-SA: sb port=0x%lx, wss port=0x%lx, fm port=0x%lx, midi port=0x%lx\n", | 628 | snd_printdd("%sPnP OPL3-SA: sb port=0x%lx, wss port=0x%lx, fm port=0x%lx, midi port=0x%lx\n", |
621 | sb_port[dev], wss_port[dev], fm_port[dev], midi_port[dev]); | 629 | pnp_device_is_pnpbios(pdev) ? "BIOS" : "ISA", sb_port[dev], wss_port[dev], fm_port[dev], midi_port[dev]); |
622 | snd_printdd("PnP OPL3-SA: control port=0x%lx, dma1=%i, dma2=%i, irq=%i\n", | 630 | snd_printdd("%sPnP OPL3-SA: control port=0x%lx, dma1=%i, dma2=%i, irq=%i\n", |
623 | port[dev], dma1[dev], dma2[dev], irq[dev]); | 631 | pnp_device_is_pnpbios(pdev) ? "BIOS" : "ISA", port[dev], dma1[dev], dma2[dev], irq[dev]); |
624 | kfree(cfg); | 632 | kfree(cfg); |
633 | chip->dev = pdev; | ||
625 | return 0; | 634 | return 0; |
626 | } | 635 | } |
636 | |||
637 | static int __init snd_opl3sa2_cpnp(int dev, opl3sa2_t *chip, | ||
638 | struct pnp_card_link *card, | ||
639 | const struct pnp_card_device_id *id) | ||
640 | { | ||
641 | struct pnp_dev *pdev; | ||
642 | struct pnp_resource_table * cfg = kmalloc(sizeof(struct pnp_resource_table), GFP_KERNEL); | ||
643 | |||
644 | if (!cfg) | ||
645 | return -ENOMEM; | ||
646 | pdev = pnp_request_card_device(card, id->devs[0].id, NULL); | ||
647 | if (pdev == NULL) { | ||
648 | kfree(cfg); | ||
649 | return -EBUSY; | ||
650 | } | ||
651 | return snd_opl3sa2_pnp(dev, chip, pdev, 1); | ||
652 | } | ||
627 | #endif /* CONFIG_PNP */ | 653 | #endif /* CONFIG_PNP */ |
628 | 654 | ||
629 | static int snd_opl3sa2_free(opl3sa2_t *chip) | 655 | static int snd_opl3sa2_free(opl3sa2_t *chip) |
@@ -644,7 +670,14 @@ static int snd_opl3sa2_dev_free(snd_device_t *device) | |||
644 | return snd_opl3sa2_free(chip); | 670 | return snd_opl3sa2_free(chip); |
645 | } | 671 | } |
646 | 672 | ||
673 | #ifdef CONFIG_PNP | ||
674 | #define is_isapnp_selected(dev) isapnp[dev] | ||
675 | #else | ||
676 | #define is_isapnp_selected(dev) 0 | ||
677 | #endif | ||
678 | |||
647 | static int __devinit snd_opl3sa2_probe(int dev, | 679 | static int __devinit snd_opl3sa2_probe(int dev, |
680 | struct pnp_dev *pdev, | ||
648 | struct pnp_card_link *pcard, | 681 | struct pnp_card_link *pcard, |
649 | const struct pnp_card_device_id *pid) | 682 | const struct pnp_card_device_id *pid) |
650 | { | 683 | { |
@@ -658,34 +691,31 @@ static int __devinit snd_opl3sa2_probe(int dev, | |||
658 | }; | 691 | }; |
659 | int err; | 692 | int err; |
660 | 693 | ||
661 | #ifdef CONFIG_PNP | 694 | if (! is_isapnp_selected(dev)) { |
662 | if (!isapnp[dev]) { | ||
663 | #endif | ||
664 | if (port[dev] == SNDRV_AUTO_PORT) { | 695 | if (port[dev] == SNDRV_AUTO_PORT) { |
665 | snd_printk("specify port\n"); | 696 | snd_printk(KERN_ERR PFX "specify port\n"); |
666 | return -EINVAL; | 697 | return -EINVAL; |
667 | } | 698 | } |
668 | if (wss_port[dev] == SNDRV_AUTO_PORT) { | 699 | if (wss_port[dev] == SNDRV_AUTO_PORT) { |
669 | snd_printk("specify wss_port\n"); | 700 | snd_printk(KERN_ERR PFX "specify wss_port\n"); |
670 | return -EINVAL; | 701 | return -EINVAL; |
671 | } | 702 | } |
672 | if (fm_port[dev] == SNDRV_AUTO_PORT) { | 703 | if (fm_port[dev] == SNDRV_AUTO_PORT) { |
673 | snd_printk("specify fm_port\n"); | 704 | snd_printk(KERN_ERR PFX "specify fm_port\n"); |
674 | return -EINVAL; | 705 | return -EINVAL; |
675 | } | 706 | } |
676 | if (midi_port[dev] == SNDRV_AUTO_PORT) { | 707 | if (midi_port[dev] == SNDRV_AUTO_PORT) { |
677 | snd_printk("specify midi_port\n"); | 708 | snd_printk(KERN_ERR PFX "specify midi_port\n"); |
678 | return -EINVAL; | 709 | return -EINVAL; |
679 | } | 710 | } |
680 | #ifdef CONFIG_PNP | ||
681 | } | 711 | } |
682 | #endif | 712 | |
683 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 713 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); |
684 | if (card == NULL) | 714 | if (card == NULL) |
685 | return -ENOMEM; | 715 | return -ENOMEM; |
686 | strcpy(card->driver, "OPL3SA2"); | 716 | strcpy(card->driver, "OPL3SA2"); |
687 | strcpy(card->shortname, "Yamaha OPL3-SA2"); | 717 | strcpy(card->shortname, "Yamaha OPL3-SA2"); |
688 | chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); | 718 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); |
689 | if (chip == NULL) { | 719 | if (chip == NULL) { |
690 | err = -ENOMEM; | 720 | err = -ENOMEM; |
691 | goto __error; | 721 | goto __error; |
@@ -695,8 +725,13 @@ static int __devinit snd_opl3sa2_probe(int dev, | |||
695 | if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) | 725 | if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) |
696 | goto __error; | 726 | goto __error; |
697 | #ifdef CONFIG_PNP | 727 | #ifdef CONFIG_PNP |
698 | if (isapnp[dev]) { | 728 | if (pdev) { |
699 | if ((err = snd_opl3sa2_pnp(dev, chip, pcard, pid)) < 0) | 729 | if ((err = snd_opl3sa2_pnp(dev, chip, pdev, 0)) < 0) |
730 | goto __error; | ||
731 | snd_card_set_dev(card, &pdev->dev); | ||
732 | } | ||
733 | if (pcard) { | ||
734 | if ((err = snd_opl3sa2_cpnp(dev, chip, pcard, pid)) < 0) | ||
700 | goto __error; | 735 | goto __error; |
701 | snd_card_set_dev(card, &pcard->card->dev); | 736 | snd_card_set_dev(card, &pcard->card->dev); |
702 | } | 737 | } |
@@ -712,7 +747,7 @@ static int __devinit snd_opl3sa2_probe(int dev, | |||
712 | if ((err = snd_opl3sa2_detect(chip)) < 0) | 747 | if ((err = snd_opl3sa2_detect(chip)) < 0) |
713 | goto __error; | 748 | goto __error; |
714 | if (request_irq(xirq, snd_opl3sa2_interrupt, SA_INTERRUPT, "OPL3-SA2", (void *)chip)) { | 749 | if (request_irq(xirq, snd_opl3sa2_interrupt, SA_INTERRUPT, "OPL3-SA2", (void *)chip)) { |
715 | snd_printk(KERN_ERR "opl3sa2: can't grab IRQ %d\n", xirq); | 750 | snd_printk(KERN_ERR PFX "can't grab IRQ %d\n", xirq); |
716 | err = -ENODEV; | 751 | err = -ENODEV; |
717 | goto __error; | 752 | goto __error; |
718 | } | 753 | } |
@@ -765,10 +800,15 @@ static int __devinit snd_opl3sa2_probe(int dev, | |||
765 | if (dma2 >= 0) | 800 | if (dma2 >= 0) |
766 | sprintf(card->longname + strlen(card->longname), "&%d", xdma2); | 801 | sprintf(card->longname + strlen(card->longname), "&%d", xdma2); |
767 | 802 | ||
803 | if ((err = snd_card_set_generic_dev(card)) < 0) | ||
804 | goto __error; | ||
805 | |||
768 | if ((err = snd_card_register(card)) < 0) | 806 | if ((err = snd_card_register(card)) < 0) |
769 | goto __error; | 807 | goto __error; |
770 | 808 | ||
771 | if (pcard) | 809 | if (pdev) |
810 | pnp_set_drvdata(pdev, card); | ||
811 | else if (pcard) | ||
772 | pnp_set_card_drvdata(pcard, card); | 812 | pnp_set_card_drvdata(pcard, card); |
773 | else | 813 | else |
774 | snd_opl3sa2_legacy[dev] = card; | 814 | snd_opl3sa2_legacy[dev] = card; |
@@ -780,8 +820,8 @@ static int __devinit snd_opl3sa2_probe(int dev, | |||
780 | } | 820 | } |
781 | 821 | ||
782 | #ifdef CONFIG_PNP | 822 | #ifdef CONFIG_PNP |
783 | static int __devinit snd_opl3sa2_pnp_detect(struct pnp_card_link *card, | 823 | static int __devinit snd_opl3sa2_pnp_detect(struct pnp_dev *pdev, |
784 | const struct pnp_card_device_id *id) | 824 | const struct pnp_device_id *id) |
785 | { | 825 | { |
786 | static int dev; | 826 | static int dev; |
787 | int res; | 827 | int res; |
@@ -789,7 +829,42 @@ static int __devinit snd_opl3sa2_pnp_detect(struct pnp_card_link *card, | |||
789 | for ( ; dev < SNDRV_CARDS; dev++) { | 829 | for ( ; dev < SNDRV_CARDS; dev++) { |
790 | if (!enable[dev] || !isapnp[dev]) | 830 | if (!enable[dev] || !isapnp[dev]) |
791 | continue; | 831 | continue; |
792 | res = snd_opl3sa2_probe(dev, card, id); | 832 | res = snd_opl3sa2_probe(dev, pdev, NULL, NULL); |
833 | if (res < 0) | ||
834 | return res; | ||
835 | dev++; | ||
836 | return 0; | ||
837 | } | ||
838 | return -ENODEV; | ||
839 | } | ||
840 | |||
841 | static void __devexit snd_opl3sa2_pnp_remove(struct pnp_dev * pdev) | ||
842 | { | ||
843 | snd_card_t *card = (snd_card_t *) pnp_get_drvdata(pdev); | ||
844 | |||
845 | snd_card_disconnect(card); | ||
846 | snd_card_free_in_thread(card); | ||
847 | } | ||
848 | |||
849 | static struct pnp_driver opl3sa2_pnp_driver = { | ||
850 | .name = "opl3sa2-pnpbios", | ||
851 | .id_table = snd_opl3sa2_pnpbiosids, | ||
852 | .probe = snd_opl3sa2_pnp_detect, | ||
853 | .remove = __devexit_p(snd_opl3sa2_pnp_remove), | ||
854 | }; | ||
855 | |||
856 | static int __devinit snd_opl3sa2_pnp_cdetect(struct pnp_card_link *card, | ||
857 | const struct pnp_card_device_id *id) | ||
858 | { | ||
859 | static int dev; | ||
860 | int res; | ||
861 | |||
862 | for ( ; dev < SNDRV_CARDS; dev++) { | ||
863 | if (!enable[dev]) | ||
864 | continue; | ||
865 | if (is_isapnp_selected(dev)) | ||
866 | continue; | ||
867 | res = snd_opl3sa2_probe(dev, NULL, card, id); | ||
793 | if (res < 0) | 868 | if (res < 0) |
794 | return res; | 869 | return res; |
795 | dev++; | 870 | dev++; |
@@ -798,7 +873,7 @@ static int __devinit snd_opl3sa2_pnp_detect(struct pnp_card_link *card, | |||
798 | return -ENODEV; | 873 | return -ENODEV; |
799 | } | 874 | } |
800 | 875 | ||
801 | static void __devexit snd_opl3sa2_pnp_remove(struct pnp_card_link * pcard) | 876 | static void __devexit snd_opl3sa2_pnp_cremove(struct pnp_card_link * pcard) |
802 | { | 877 | { |
803 | snd_card_t *card = (snd_card_t *) pnp_get_card_drvdata(pcard); | 878 | snd_card_t *card = (snd_card_t *) pnp_get_card_drvdata(pcard); |
804 | 879 | ||
@@ -810,8 +885,8 @@ static struct pnp_card_driver opl3sa2_pnpc_driver = { | |||
810 | .flags = PNP_DRIVER_RES_DISABLE, | 885 | .flags = PNP_DRIVER_RES_DISABLE, |
811 | .name = "opl3sa2", | 886 | .name = "opl3sa2", |
812 | .id_table = snd_opl3sa2_pnpids, | 887 | .id_table = snd_opl3sa2_pnpids, |
813 | .probe = snd_opl3sa2_pnp_detect, | 888 | .probe = snd_opl3sa2_pnp_cdetect, |
814 | .remove = __devexit_p(snd_opl3sa2_pnp_remove), | 889 | .remove = __devexit_p(snd_opl3sa2_pnp_cremove), |
815 | }; | 890 | }; |
816 | #endif /* CONFIG_PNP */ | 891 | #endif /* CONFIG_PNP */ |
817 | 892 | ||
@@ -826,10 +901,11 @@ static int __init alsa_card_opl3sa2_init(void) | |||
826 | if (isapnp[dev]) | 901 | if (isapnp[dev]) |
827 | continue; | 902 | continue; |
828 | #endif | 903 | #endif |
829 | if (snd_opl3sa2_probe(dev, NULL, NULL) >= 0) | 904 | if (snd_opl3sa2_probe(dev, NULL, NULL, NULL) >= 0) |
830 | cards++; | 905 | cards++; |
831 | } | 906 | } |
832 | #ifdef CONFIG_PNP | 907 | #ifdef CONFIG_PNP |
908 | cards += pnp_register_driver(&opl3sa2_pnp_driver); | ||
833 | cards += pnp_register_card_driver(&opl3sa2_pnpc_driver); | 909 | cards += pnp_register_card_driver(&opl3sa2_pnpc_driver); |
834 | #endif | 910 | #endif |
835 | if (!cards) { | 911 | if (!cards) { |
@@ -838,6 +914,7 @@ static int __init alsa_card_opl3sa2_init(void) | |||
838 | #endif | 914 | #endif |
839 | #ifdef CONFIG_PNP | 915 | #ifdef CONFIG_PNP |
840 | pnp_unregister_card_driver(&opl3sa2_pnpc_driver); | 916 | pnp_unregister_card_driver(&opl3sa2_pnpc_driver); |
917 | pnp_unregister_driver(&opl3sa2_pnp_driver); | ||
841 | #endif | 918 | #endif |
842 | return -ENODEV; | 919 | return -ENODEV; |
843 | } | 920 | } |
@@ -851,6 +928,7 @@ static void __exit alsa_card_opl3sa2_exit(void) | |||
851 | #ifdef CONFIG_PNP | 928 | #ifdef CONFIG_PNP |
852 | /* PnP cards first */ | 929 | /* PnP cards first */ |
853 | pnp_unregister_card_driver(&opl3sa2_pnpc_driver); | 930 | pnp_unregister_card_driver(&opl3sa2_pnpc_driver); |
931 | pnp_unregister_driver(&opl3sa2_pnp_driver); | ||
854 | #endif | 932 | #endif |
855 | for (idx = 0; idx < SNDRV_CARDS; idx++) | 933 | for (idx = 0; idx < SNDRV_CARDS; idx++) |
856 | snd_card_free(snd_opl3sa2_legacy[idx]); | 934 | snd_card_free(snd_opl3sa2_legacy[idx]); |
diff --git a/sound/isa/opti9xx/opti92x-ad1848.c b/sound/isa/opti9xx/opti92x-ad1848.c index 411a702d85ba..73573cb1db6a 100644 --- a/sound/isa/opti9xx/opti92x-ad1848.c +++ b/sound/isa/opti9xx/opti92x-ad1848.c | |||
@@ -1038,8 +1038,7 @@ static int snd_opti93x_capture_prepare(snd_pcm_substream_t *substream) | |||
1038 | 1038 | ||
1039 | chip->c_dma_size = size; | 1039 | chip->c_dma_size = size; |
1040 | snd_opti93x_out_mask(chip, OPTi93X_IFACE_CONF, | 1040 | snd_opti93x_out_mask(chip, OPTi93X_IFACE_CONF, |
1041 | OPTi93X_CAPTURE_ENABLE | OPTi93X_CAPTURE_PIO, | 1041 | OPTi93X_CAPTURE_ENABLE | OPTi93X_CAPTURE_PIO, 0); |
1042 | (unsigned char)~(OPTi93X_CAPTURE_ENABLE | OPTi93X_CAPTURE_PIO)); | ||
1043 | 1042 | ||
1044 | snd_dma_program(chip->dma2, runtime->dma_addr, size, | 1043 | snd_dma_program(chip->dma2, runtime->dma_addr, size, |
1045 | DMA_MODE_READ | DMA_AUTOINIT); | 1044 | DMA_MODE_READ | DMA_AUTOINIT); |
@@ -1274,7 +1273,7 @@ static int snd_opti93x_create(snd_card_t *card, opti9xx_t *chip, | |||
1274 | opti93x_t *codec; | 1273 | opti93x_t *codec; |
1275 | 1274 | ||
1276 | *rcodec = NULL; | 1275 | *rcodec = NULL; |
1277 | codec = kcalloc(1, sizeof(*codec), GFP_KERNEL); | 1276 | codec = kzalloc(sizeof(*codec), GFP_KERNEL); |
1278 | if (codec == NULL) | 1277 | if (codec == NULL) |
1279 | return -ENOMEM; | 1278 | return -ENOMEM; |
1280 | codec->irq = -1; | 1279 | codec->irq = -1; |
@@ -1895,8 +1894,8 @@ static void snd_card_opti9xx_free(snd_card_t *card) | |||
1895 | } | 1894 | } |
1896 | } | 1895 | } |
1897 | 1896 | ||
1898 | static int __devinit snd_card_opti9xx_probe(struct pnp_card_link *pcard, | 1897 | static int snd_card_opti9xx_probe(struct pnp_card_link *pcard, |
1899 | const struct pnp_card_device_id *pid) | 1898 | const struct pnp_card_device_id *pid) |
1900 | { | 1899 | { |
1901 | static long possible_ports[] = {0x530, 0xe80, 0xf40, 0x604, -1}; | 1900 | static long possible_ports[] = {0x530, 0xe80, 0xf40, 0x604, -1}; |
1902 | static long possible_mpu_ports[] = {0x300, 0x310, 0x320, 0x330, -1}; | 1901 | static long possible_mpu_ports[] = {0x300, 0x310, 0x320, 0x330, -1}; |
@@ -1966,6 +1965,10 @@ static int __devinit snd_card_opti9xx_probe(struct pnp_card_link *pcard, | |||
1966 | snd_card_free(card); | 1965 | snd_card_free(card); |
1967 | return error; | 1966 | return error; |
1968 | } | 1967 | } |
1968 | if ((error = snd_card_set_generic_dev(card)) < 0) { | ||
1969 | snd_card_free(card); | ||
1970 | return error; | ||
1971 | } | ||
1969 | #ifdef CONFIG_PNP | 1972 | #ifdef CONFIG_PNP |
1970 | } | 1973 | } |
1971 | #endif /* CONFIG_PNP */ | 1974 | #endif /* CONFIG_PNP */ |
diff --git a/sound/isa/sb/emu8000.c b/sound/isa/sb/emu8000.c index 028af4066595..5375705c054b 100644 --- a/sound/isa/sb/emu8000.c +++ b/sound/isa/sb/emu8000.c | |||
@@ -1097,7 +1097,7 @@ snd_emu8000_new(snd_card_t *card, int index, long port, int seq_ports, snd_seq_d | |||
1097 | if (seq_ports <= 0) | 1097 | if (seq_ports <= 0) |
1098 | return 0; | 1098 | return 0; |
1099 | 1099 | ||
1100 | hw = kcalloc(1, sizeof(*hw), GFP_KERNEL); | 1100 | hw = kzalloc(sizeof(*hw), GFP_KERNEL); |
1101 | if (hw == NULL) | 1101 | if (hw == NULL) |
1102 | return -ENOMEM; | 1102 | return -ENOMEM; |
1103 | spin_lock_init(&hw->reg_lock); | 1103 | spin_lock_init(&hw->reg_lock); |
diff --git a/sound/isa/sb/emu8000_pcm.c b/sound/isa/sb/emu8000_pcm.c index db5eb8b55058..0209790dc4b5 100644 --- a/sound/isa/sb/emu8000_pcm.c +++ b/sound/isa/sb/emu8000_pcm.c | |||
@@ -233,7 +233,7 @@ static int emu8k_pcm_open(snd_pcm_substream_t *subs) | |||
233 | emu8k_pcm_t *rec; | 233 | emu8k_pcm_t *rec; |
234 | snd_pcm_runtime_t *runtime = subs->runtime; | 234 | snd_pcm_runtime_t *runtime = subs->runtime; |
235 | 235 | ||
236 | rec = kcalloc(1, sizeof(*rec), GFP_KERNEL); | 236 | rec = kzalloc(sizeof(*rec), GFP_KERNEL); |
237 | if (! rec) | 237 | if (! rec) |
238 | return -ENOMEM; | 238 | return -ENOMEM; |
239 | 239 | ||
diff --git a/sound/isa/sb/sb16.c b/sound/isa/sb/sb16.c index 60e2c53c49fc..7888783d68f5 100644 --- a/sound/isa/sb/sb16.c +++ b/sound/isa/sb/sb16.c | |||
@@ -351,6 +351,12 @@ static void snd_sb16_free(snd_card_t *card) | |||
351 | } | 351 | } |
352 | } | 352 | } |
353 | 353 | ||
354 | #ifdef CONFIG_PNP | ||
355 | #define is_isapnp_selected(dev) isapnp[dev] | ||
356 | #else | ||
357 | #define is_isapnp_selected(dev) 0 | ||
358 | #endif | ||
359 | |||
354 | static int __init snd_sb16_probe(int dev, | 360 | static int __init snd_sb16_probe(int dev, |
355 | struct pnp_card_link *pcard, | 361 | struct pnp_card_link *pcard, |
356 | const struct pnp_card_device_id *pid) | 362 | const struct pnp_card_device_id *pid) |
@@ -378,10 +384,8 @@ static int __init snd_sb16_probe(int dev, | |||
378 | card->private_free = snd_sb16_free; | 384 | card->private_free = snd_sb16_free; |
379 | #ifdef CONFIG_PNP | 385 | #ifdef CONFIG_PNP |
380 | if (isapnp[dev]) { | 386 | if (isapnp[dev]) { |
381 | if ((err = snd_card_sb16_pnp(dev, acard, pcard, pid))) { | 387 | if ((err = snd_card_sb16_pnp(dev, acard, pcard, pid))) |
382 | snd_card_free(card); | 388 | goto _err; |
383 | return err; | ||
384 | } | ||
385 | snd_card_set_dev(card, &pcard->card->dev); | 389 | snd_card_set_dev(card, &pcard->card->dev); |
386 | } | 390 | } |
387 | #endif | 391 | #endif |
@@ -389,41 +393,37 @@ static int __init snd_sb16_probe(int dev, | |||
389 | xirq = irq[dev]; | 393 | xirq = irq[dev]; |
390 | xdma8 = dma8[dev]; | 394 | xdma8 = dma8[dev]; |
391 | xdma16 = dma16[dev]; | 395 | xdma16 = dma16[dev]; |
392 | #ifdef CONFIG_PNP | 396 | if (! is_isapnp_selected(dev)) { |
393 | if (!isapnp[dev]) { | 397 | if (xirq == SNDRV_AUTO_IRQ) { |
394 | #endif | 398 | if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) { |
395 | if (xirq == SNDRV_AUTO_IRQ) { | 399 | snd_printk(KERN_ERR PFX "unable to find a free IRQ\n"); |
396 | if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) { | 400 | err = -EBUSY; |
397 | snd_card_free(card); | 401 | goto _err; |
398 | snd_printk(KERN_ERR PFX "unable to find a free IRQ\n"); | 402 | } |
399 | return -EBUSY; | ||
400 | } | 403 | } |
401 | } | 404 | if (xdma8 == SNDRV_AUTO_DMA) { |
402 | if (xdma8 == SNDRV_AUTO_DMA) { | 405 | if ((xdma8 = snd_legacy_find_free_dma(possible_dmas8)) < 0) { |
403 | if ((xdma8 = snd_legacy_find_free_dma(possible_dmas8)) < 0) { | 406 | snd_printk(KERN_ERR PFX "unable to find a free 8-bit DMA\n"); |
404 | snd_card_free(card); | 407 | err = -EBUSY; |
405 | snd_printk(KERN_ERR PFX "unable to find a free 8-bit DMA\n"); | 408 | goto _err; |
406 | return -EBUSY; | 409 | } |
407 | } | 410 | } |
408 | } | 411 | if (xdma16 == SNDRV_AUTO_DMA) { |
409 | if (xdma16 == SNDRV_AUTO_DMA) { | 412 | if ((xdma16 = snd_legacy_find_free_dma(possible_dmas16)) < 0) { |
410 | if ((xdma16 = snd_legacy_find_free_dma(possible_dmas16)) < 0) { | 413 | snd_printk(KERN_ERR PFX "unable to find a free 16-bit DMA\n"); |
411 | snd_card_free(card); | 414 | err = -EBUSY; |
412 | snd_printk(KERN_ERR PFX "unable to find a free 16-bit DMA\n"); | 415 | goto _err; |
413 | return -EBUSY; | 416 | } |
414 | } | 417 | } |
415 | } | 418 | /* non-PnP FM port address is hardwired with base port address */ |
416 | /* non-PnP FM port address is hardwired with base port address */ | 419 | fm_port[dev] = port[dev]; |
417 | fm_port[dev] = port[dev]; | 420 | /* block the 0x388 port to avoid PnP conflicts */ |
418 | /* block the 0x388 port to avoid PnP conflicts */ | 421 | acard->fm_res = request_region(0x388, 4, "SoundBlaster FM"); |
419 | acard->fm_res = request_region(0x388, 4, "SoundBlaster FM"); | ||
420 | #ifdef SNDRV_SBAWE_EMU8000 | 422 | #ifdef SNDRV_SBAWE_EMU8000 |
421 | /* non-PnP AWE port address is hardwired with base port address */ | 423 | /* non-PnP AWE port address is hardwired with base port address */ |
422 | awe_port[dev] = port[dev] + 0x400; | 424 | awe_port[dev] = port[dev] + 0x400; |
423 | #endif | 425 | #endif |
424 | #ifdef CONFIG_PNP | ||
425 | } | 426 | } |
426 | #endif | ||
427 | 427 | ||
428 | if ((err = snd_sbdsp_create(card, | 428 | if ((err = snd_sbdsp_create(card, |
429 | port[dev], | 429 | port[dev], |
@@ -432,28 +432,20 @@ static int __init snd_sb16_probe(int dev, | |||
432 | xdma8, | 432 | xdma8, |
433 | xdma16, | 433 | xdma16, |
434 | SB_HW_AUTO, | 434 | SB_HW_AUTO, |
435 | &chip)) < 0) { | 435 | &chip)) < 0) |
436 | snd_card_free(card); | 436 | goto _err; |
437 | return err; | 437 | |
438 | } | ||
439 | if (chip->hardware != SB_HW_16) { | 438 | if (chip->hardware != SB_HW_16) { |
440 | snd_card_free(card); | 439 | snd_printk(KERN_ERR PFX "SB 16 chip was not detected at 0x%lx\n", port[dev]); |
441 | snd_printdd("SB 16 chip was not detected at 0x%lx\n", port[dev]); | 440 | err = -ENODEV; |
442 | return -ENODEV; | 441 | goto _err; |
443 | } | 442 | } |
444 | chip->mpu_port = mpu_port[dev]; | 443 | chip->mpu_port = mpu_port[dev]; |
445 | #ifdef CONFIG_PNP | 444 | if (! is_isapnp_selected(dev) && (err = snd_sb16dsp_configure(chip)) < 0) |
446 | if (!isapnp[dev] && (err = snd_sb16dsp_configure(chip)) < 0) { | 445 | goto _err; |
447 | #else | 446 | |
448 | if ((err = snd_sb16dsp_configure(chip)) < 0) { | 447 | if ((err = snd_sb16dsp_pcm(chip, 0, NULL)) < 0) |
449 | #endif | 448 | goto _err; |
450 | snd_card_free(card); | ||
451 | return -ENXIO; | ||
452 | } | ||
453 | if ((err = snd_sb16dsp_pcm(chip, 0, NULL)) < 0) { | ||
454 | snd_card_free(card); | ||
455 | return -ENXIO; | ||
456 | } | ||
457 | 449 | ||
458 | strcpy(card->driver, | 450 | strcpy(card->driver, |
459 | #ifdef SNDRV_SBAWE_EMU8000 | 451 | #ifdef SNDRV_SBAWE_EMU8000 |
@@ -474,10 +466,8 @@ static int __init snd_sb16_probe(int dev, | |||
474 | if (chip->mpu_port > 0 && chip->mpu_port != SNDRV_AUTO_PORT) { | 466 | if (chip->mpu_port > 0 && chip->mpu_port != SNDRV_AUTO_PORT) { |
475 | if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_SB, | 467 | if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_SB, |
476 | chip->mpu_port, 0, | 468 | chip->mpu_port, 0, |
477 | xirq, 0, &chip->rmidi)) < 0) { | 469 | xirq, 0, &chip->rmidi)) < 0) |
478 | snd_card_free(card); | 470 | goto _err; |
479 | return -ENXIO; | ||
480 | } | ||
481 | chip->rmidi_callback = snd_mpu401_uart_interrupt; | 471 | chip->rmidi_callback = snd_mpu401_uart_interrupt; |
482 | } | 472 | } |
483 | 473 | ||
@@ -499,17 +489,13 @@ static int __init snd_sb16_probe(int dev, | |||
499 | #else | 489 | #else |
500 | int seqdev = 1; | 490 | int seqdev = 1; |
501 | #endif | 491 | #endif |
502 | if ((err = snd_opl3_hwdep_new(opl3, 0, seqdev, &synth)) < 0) { | 492 | if ((err = snd_opl3_hwdep_new(opl3, 0, seqdev, &synth)) < 0) |
503 | snd_card_free(card); | 493 | goto _err; |
504 | return -ENXIO; | ||
505 | } | ||
506 | } | 494 | } |
507 | } | 495 | } |
508 | 496 | ||
509 | if ((err = snd_sbmixer_new(chip)) < 0) { | 497 | if ((err = snd_sbmixer_new(chip)) < 0) |
510 | snd_card_free(card); | 498 | goto _err; |
511 | return -ENXIO; | ||
512 | } | ||
513 | 499 | ||
514 | #ifdef CONFIG_SND_SB16_CSP | 500 | #ifdef CONFIG_SND_SB16_CSP |
515 | /* CSP chip on SB16ASP/AWE32 */ | 501 | /* CSP chip on SB16ASP/AWE32 */ |
@@ -525,11 +511,11 @@ static int __init snd_sb16_probe(int dev, | |||
525 | #endif | 511 | #endif |
526 | #ifdef SNDRV_SBAWE_EMU8000 | 512 | #ifdef SNDRV_SBAWE_EMU8000 |
527 | if (awe_port[dev] > 0) { | 513 | if (awe_port[dev] > 0) { |
528 | if (snd_emu8000_new(card, 1, awe_port[dev], | 514 | if ((err = snd_emu8000_new(card, 1, awe_port[dev], |
529 | seq_ports[dev], NULL) < 0) { | 515 | seq_ports[dev], NULL)) < 0) { |
530 | snd_printk(KERN_ERR PFX "fatal error - EMU-8000 synthesizer not detected at 0x%lx\n", awe_port[dev]); | 516 | snd_printk(KERN_ERR PFX "fatal error - EMU-8000 synthesizer not detected at 0x%lx\n", awe_port[dev]); |
531 | snd_card_free(card); | 517 | |
532 | return -ENXIO; | 518 | goto _err; |
533 | } | 519 | } |
534 | } | 520 | } |
535 | #endif | 521 | #endif |
@@ -541,15 +527,21 @@ static int __init snd_sb16_probe(int dev, | |||
541 | (mic_agc[dev] ? 0x00 : 0x01)); | 527 | (mic_agc[dev] ? 0x00 : 0x01)); |
542 | spin_unlock_irqrestore(&chip->mixer_lock, flags); | 528 | spin_unlock_irqrestore(&chip->mixer_lock, flags); |
543 | 529 | ||
544 | if ((err = snd_card_register(card)) < 0) { | 530 | if ((err = snd_card_set_generic_dev(card)) < 0) |
545 | snd_card_free(card); | 531 | goto _err; |
546 | return err; | 532 | |
547 | } | 533 | if ((err = snd_card_register(card)) < 0) |
534 | goto _err; | ||
535 | |||
548 | if (pcard) | 536 | if (pcard) |
549 | pnp_set_card_drvdata(pcard, card); | 537 | pnp_set_card_drvdata(pcard, card); |
550 | else | 538 | else |
551 | snd_sb16_legacy[dev] = card; | 539 | snd_sb16_legacy[dev] = card; |
552 | return 0; | 540 | return 0; |
541 | |||
542 | _err: | ||
543 | snd_card_free(card); | ||
544 | return err; | ||
553 | } | 545 | } |
554 | 546 | ||
555 | static int __init snd_sb16_probe_legacy_port(unsigned long xport) | 547 | static int __init snd_sb16_probe_legacy_port(unsigned long xport) |
@@ -560,10 +552,8 @@ static int __init snd_sb16_probe_legacy_port(unsigned long xport) | |||
560 | for ( ; dev < SNDRV_CARDS; dev++) { | 552 | for ( ; dev < SNDRV_CARDS; dev++) { |
561 | if (!enable[dev] || port[dev] != SNDRV_AUTO_PORT) | 553 | if (!enable[dev] || port[dev] != SNDRV_AUTO_PORT) |
562 | continue; | 554 | continue; |
563 | #ifdef CONFIG_PNP | 555 | if (is_isapnp_selected(dev)) |
564 | if (isapnp[dev]) | ||
565 | continue; | 556 | continue; |
566 | #endif | ||
567 | port[dev] = xport; | 557 | port[dev] = xport; |
568 | res = snd_sb16_probe(dev, NULL, NULL); | 558 | res = snd_sb16_probe(dev, NULL, NULL); |
569 | if (res < 0) | 559 | if (res < 0) |
@@ -621,10 +611,8 @@ static int __init alsa_card_sb16_init(void) | |||
621 | for (dev = 0; dev < SNDRV_CARDS; dev++) { | 611 | for (dev = 0; dev < SNDRV_CARDS; dev++) { |
622 | if (!enable[dev] || port[dev] == SNDRV_AUTO_PORT) | 612 | if (!enable[dev] || port[dev] == SNDRV_AUTO_PORT) |
623 | continue; | 613 | continue; |
624 | #ifdef CONFIG_PNP | 614 | if (is_isapnp_selected(dev)) |
625 | if (isapnp[dev]) | ||
626 | continue; | 615 | continue; |
627 | #endif | ||
628 | if (!snd_sb16_probe(dev, NULL, NULL)) { | 616 | if (!snd_sb16_probe(dev, NULL, NULL)) { |
629 | cards++; | 617 | cards++; |
630 | continue; | 618 | continue; |
diff --git a/sound/isa/sb/sb16_csp.c b/sound/isa/sb/sb16_csp.c index b62920eead3d..7192d4c758e6 100644 --- a/sound/isa/sb/sb16_csp.c +++ b/sound/isa/sb/sb16_csp.c | |||
@@ -42,8 +42,6 @@ MODULE_LICENSE("GPL"); | |||
42 | #else | 42 | #else |
43 | #define CSP_HDR_VALUE(a,b,c,d) ((d) | ((c)<<8) | ((b)<<16) | ((a)<<24)) | 43 | #define CSP_HDR_VALUE(a,b,c,d) ((d) | ((c)<<8) | ((b)<<16) | ((a)<<24)) |
44 | #endif | 44 | #endif |
45 | #define LE_SHORT(v) le16_to_cpu(v) | ||
46 | #define LE_INT(v) le32_to_cpu(v) | ||
47 | 45 | ||
48 | #define RIFF_HEADER CSP_HDR_VALUE('R', 'I', 'F', 'F') | 46 | #define RIFF_HEADER CSP_HDR_VALUE('R', 'I', 'F', 'F') |
49 | #define CSP__HEADER CSP_HDR_VALUE('C', 'S', 'P', ' ') | 47 | #define CSP__HEADER CSP_HDR_VALUE('C', 'S', 'P', ' ') |
@@ -56,20 +54,20 @@ MODULE_LICENSE("GPL"); | |||
56 | /* | 54 | /* |
57 | * RIFF data format | 55 | * RIFF data format |
58 | */ | 56 | */ |
59 | typedef struct riff_header { | 57 | struct riff_header { |
60 | __u32 name; | 58 | __u32 name; |
61 | __u32 len; | 59 | __u32 len; |
62 | } riff_header_t; | 60 | }; |
63 | 61 | ||
64 | typedef struct desc_header { | 62 | struct desc_header { |
65 | riff_header_t info; | 63 | struct riff_header info; |
66 | __u16 func_nr; | 64 | __u16 func_nr; |
67 | __u16 VOC_type; | 65 | __u16 VOC_type; |
68 | __u16 flags_play_rec; | 66 | __u16 flags_play_rec; |
69 | __u16 flags_16bit_8bit; | 67 | __u16 flags_16bit_8bit; |
70 | __u16 flags_stereo_mono; | 68 | __u16 flags_stereo_mono; |
71 | __u16 flags_rates; | 69 | __u16 flags_rates; |
72 | } desc_header_t; | 70 | }; |
73 | 71 | ||
74 | /* | 72 | /* |
75 | * prototypes | 73 | * prototypes |
@@ -124,7 +122,7 @@ int snd_sb_csp_new(sb_t *chip, int device, snd_hwdep_t ** rhwdep) | |||
124 | if ((err = snd_hwdep_new(chip->card, "SB16-CSP", device, &hw)) < 0) | 122 | if ((err = snd_hwdep_new(chip->card, "SB16-CSP", device, &hw)) < 0) |
125 | return err; | 123 | return err; |
126 | 124 | ||
127 | if ((p = kcalloc(1, sizeof(*p), GFP_KERNEL)) == NULL) { | 125 | if ((p = kzalloc(sizeof(*p), GFP_KERNEL)) == NULL) { |
128 | snd_device_free(chip->card, hw); | 126 | snd_device_free(chip->card, hw); |
129 | return -ENOMEM; | 127 | return -ENOMEM; |
130 | } | 128 | } |
@@ -302,9 +300,9 @@ static int snd_sb_csp_riff_load(snd_sb_csp_t * p, snd_sb_csp_microcode_t __user | |||
302 | unsigned char __user *data_end; | 300 | unsigned char __user *data_end; |
303 | unsigned short func_nr = 0; | 301 | unsigned short func_nr = 0; |
304 | 302 | ||
305 | riff_header_t file_h, item_h, code_h; | 303 | struct riff_header file_h, item_h, code_h; |
306 | __u32 item_type; | 304 | __u32 item_type; |
307 | desc_header_t funcdesc_h; | 305 | struct desc_header funcdesc_h; |
308 | 306 | ||
309 | unsigned long flags; | 307 | unsigned long flags; |
310 | int err; | 308 | int err; |
@@ -316,12 +314,12 @@ static int snd_sb_csp_riff_load(snd_sb_csp_t * p, snd_sb_csp_microcode_t __user | |||
316 | if (copy_from_user(&file_h, data_ptr, sizeof(file_h))) | 314 | if (copy_from_user(&file_h, data_ptr, sizeof(file_h))) |
317 | return -EFAULT; | 315 | return -EFAULT; |
318 | if ((file_h.name != RIFF_HEADER) || | 316 | if ((file_h.name != RIFF_HEADER) || |
319 | (LE_INT(file_h.len) >= SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE - sizeof(file_h))) { | 317 | (le32_to_cpu(file_h.len) >= SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE - sizeof(file_h))) { |
320 | snd_printd("%s: Invalid RIFF header\n", __FUNCTION__); | 318 | snd_printd("%s: Invalid RIFF header\n", __FUNCTION__); |
321 | return -EINVAL; | 319 | return -EINVAL; |
322 | } | 320 | } |
323 | data_ptr += sizeof(file_h); | 321 | data_ptr += sizeof(file_h); |
324 | data_end = data_ptr + LE_INT(file_h.len); | 322 | data_end = data_ptr + le32_to_cpu(file_h.len); |
325 | 323 | ||
326 | if (copy_from_user(&item_type, data_ptr, sizeof(item_type))) | 324 | if (copy_from_user(&item_type, data_ptr, sizeof(item_type))) |
327 | return -EFAULT; | 325 | return -EFAULT; |
@@ -331,7 +329,7 @@ static int snd_sb_csp_riff_load(snd_sb_csp_t * p, snd_sb_csp_microcode_t __user | |||
331 | } | 329 | } |
332 | data_ptr += sizeof (item_type); | 330 | data_ptr += sizeof (item_type); |
333 | 331 | ||
334 | for (; data_ptr < data_end; data_ptr += LE_INT(item_h.len)) { | 332 | for (; data_ptr < data_end; data_ptr += le32_to_cpu(item_h.len)) { |
335 | if (copy_from_user(&item_h, data_ptr, sizeof(item_h))) | 333 | if (copy_from_user(&item_h, data_ptr, sizeof(item_h))) |
336 | return -EFAULT; | 334 | return -EFAULT; |
337 | data_ptr += sizeof(item_h); | 335 | data_ptr += sizeof(item_h); |
@@ -344,7 +342,7 @@ static int snd_sb_csp_riff_load(snd_sb_csp_t * p, snd_sb_csp_microcode_t __user | |||
344 | case FUNC_HEADER: | 342 | case FUNC_HEADER: |
345 | if (copy_from_user(&funcdesc_h, data_ptr + sizeof(item_type), sizeof(funcdesc_h))) | 343 | if (copy_from_user(&funcdesc_h, data_ptr + sizeof(item_type), sizeof(funcdesc_h))) |
346 | return -EFAULT; | 344 | return -EFAULT; |
347 | func_nr = LE_SHORT(funcdesc_h.func_nr); | 345 | func_nr = le16_to_cpu(funcdesc_h.func_nr); |
348 | break; | 346 | break; |
349 | case CODE_HEADER: | 347 | case CODE_HEADER: |
350 | if (func_nr != info.func_req) | 348 | if (func_nr != info.func_req) |
@@ -370,11 +368,11 @@ static int snd_sb_csp_riff_load(snd_sb_csp_t * p, snd_sb_csp_microcode_t __user | |||
370 | if (code_h.name != INIT_HEADER) | 368 | if (code_h.name != INIT_HEADER) |
371 | break; | 369 | break; |
372 | data_ptr += sizeof(code_h); | 370 | data_ptr += sizeof(code_h); |
373 | err = snd_sb_csp_load_user(p, data_ptr, LE_INT(code_h.len), | 371 | err = snd_sb_csp_load_user(p, data_ptr, le32_to_cpu(code_h.len), |
374 | SNDRV_SB_CSP_LOAD_INITBLOCK); | 372 | SNDRV_SB_CSP_LOAD_INITBLOCK); |
375 | if (err) | 373 | if (err) |
376 | return err; | 374 | return err; |
377 | data_ptr += LE_INT(code_h.len); | 375 | data_ptr += le32_to_cpu(code_h.len); |
378 | } | 376 | } |
379 | /* main microcode block */ | 377 | /* main microcode block */ |
380 | if (copy_from_user(&code_h, data_ptr, sizeof(code_h))) | 378 | if (copy_from_user(&code_h, data_ptr, sizeof(code_h))) |
@@ -386,17 +384,17 @@ static int snd_sb_csp_riff_load(snd_sb_csp_t * p, snd_sb_csp_microcode_t __user | |||
386 | } | 384 | } |
387 | data_ptr += sizeof(code_h); | 385 | data_ptr += sizeof(code_h); |
388 | err = snd_sb_csp_load_user(p, data_ptr, | 386 | err = snd_sb_csp_load_user(p, data_ptr, |
389 | LE_INT(code_h.len), 0); | 387 | le32_to_cpu(code_h.len), 0); |
390 | if (err) | 388 | if (err) |
391 | return err; | 389 | return err; |
392 | 390 | ||
393 | /* fill in codec header */ | 391 | /* fill in codec header */ |
394 | strlcpy(p->codec_name, info.codec_name, sizeof(p->codec_name)); | 392 | strlcpy(p->codec_name, info.codec_name, sizeof(p->codec_name)); |
395 | p->func_nr = func_nr; | 393 | p->func_nr = func_nr; |
396 | p->mode = LE_SHORT(funcdesc_h.flags_play_rec); | 394 | p->mode = le16_to_cpu(funcdesc_h.flags_play_rec); |
397 | switch (LE_SHORT(funcdesc_h.VOC_type)) { | 395 | switch (le16_to_cpu(funcdesc_h.VOC_type)) { |
398 | case 0x0001: /* QSound decoder */ | 396 | case 0x0001: /* QSound decoder */ |
399 | if (LE_SHORT(funcdesc_h.flags_play_rec) == SNDRV_SB_CSP_MODE_DSP_WRITE) { | 397 | if (le16_to_cpu(funcdesc_h.flags_play_rec) == SNDRV_SB_CSP_MODE_DSP_WRITE) { |
400 | if (snd_sb_qsound_build(p) == 0) | 398 | if (snd_sb_qsound_build(p) == 0) |
401 | /* set QSound flag and clear all other mode flags */ | 399 | /* set QSound flag and clear all other mode flags */ |
402 | p->mode = SNDRV_SB_CSP_MODE_QSOUND; | 400 | p->mode = SNDRV_SB_CSP_MODE_QSOUND; |
@@ -426,12 +424,12 @@ static int snd_sb_csp_riff_load(snd_sb_csp_t * p, snd_sb_csp_microcode_t __user | |||
426 | p->mode = 0; | 424 | p->mode = 0; |
427 | snd_printd("%s: Unsupported CSP codec type: 0x%04x\n", | 425 | snd_printd("%s: Unsupported CSP codec type: 0x%04x\n", |
428 | __FUNCTION__, | 426 | __FUNCTION__, |
429 | LE_SHORT(funcdesc_h.VOC_type)); | 427 | le16_to_cpu(funcdesc_h.VOC_type)); |
430 | return -EINVAL; | 428 | return -EINVAL; |
431 | } | 429 | } |
432 | p->acc_channels = LE_SHORT(funcdesc_h.flags_stereo_mono); | 430 | p->acc_channels = le16_to_cpu(funcdesc_h.flags_stereo_mono); |
433 | p->acc_width = LE_SHORT(funcdesc_h.flags_16bit_8bit); | 431 | p->acc_width = le16_to_cpu(funcdesc_h.flags_16bit_8bit); |
434 | p->acc_rates = LE_SHORT(funcdesc_h.flags_rates); | 432 | p->acc_rates = le16_to_cpu(funcdesc_h.flags_rates); |
435 | 433 | ||
436 | /* Decouple CSP from IRQ and DMAREQ lines */ | 434 | /* Decouple CSP from IRQ and DMAREQ lines */ |
437 | spin_lock_irqsave(&p->chip->reg_lock, flags); | 435 | spin_lock_irqsave(&p->chip->reg_lock, flags); |
diff --git a/sound/isa/sb/sb16_main.c b/sound/isa/sb/sb16_main.c index a6a0fa516268..a99e642a68b5 100644 --- a/sound/isa/sb/sb16_main.c +++ b/sound/isa/sb/sb16_main.c | |||
@@ -729,7 +729,7 @@ static int snd_sb16_dma_control_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_valu | |||
729 | } | 729 | } |
730 | 730 | ||
731 | static snd_kcontrol_new_t snd_sb16_dma_control = { | 731 | static snd_kcontrol_new_t snd_sb16_dma_control = { |
732 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, | 732 | .iface = SNDRV_CTL_ELEM_IFACE_CARD, |
733 | .name = "16-bit DMA Allocation", | 733 | .name = "16-bit DMA Allocation", |
734 | .info = snd_sb16_dma_control_info, | 734 | .info = snd_sb16_dma_control_info, |
735 | .get = snd_sb16_dma_control_get, | 735 | .get = snd_sb16_dma_control_get, |
diff --git a/sound/isa/sb/sb8.c b/sound/isa/sb/sb8.c index e2cbc4202b3d..c41ac25e85ca 100644 --- a/sound/isa/sb/sb8.c +++ b/sound/isa/sb/sb8.c | |||
@@ -107,54 +107,47 @@ static int __init snd_sb8_probe(int dev) | |||
107 | dma8[dev], | 107 | dma8[dev], |
108 | -1, | 108 | -1, |
109 | SB_HW_AUTO, | 109 | SB_HW_AUTO, |
110 | &chip)) < 0) { | 110 | &chip)) < 0) |
111 | snd_card_free(card); | 111 | goto _err; |
112 | return err; | 112 | |
113 | } | ||
114 | if (chip->hardware >= SB_HW_16) { | 113 | if (chip->hardware >= SB_HW_16) { |
115 | snd_card_free(card); | ||
116 | if (chip->hardware == SB_HW_ALS100) | 114 | if (chip->hardware == SB_HW_ALS100) |
117 | snd_printdd("ALS100 chip detected at 0x%lx, try snd-als100 module\n", | 115 | snd_printk(KERN_WARNING "ALS100 chip detected at 0x%lx, try snd-als100 module\n", |
118 | port[dev]); | 116 | port[dev]); |
119 | else | 117 | else |
120 | snd_printdd("SB 16 chip detected at 0x%lx, try snd-sb16 module\n", | 118 | snd_printk(KERN_WARNING "SB 16 chip detected at 0x%lx, try snd-sb16 module\n", |
121 | port[dev]); | 119 | port[dev]); |
122 | return -ENODEV; | 120 | err = -ENODEV; |
121 | goto _err; | ||
123 | } | 122 | } |
124 | 123 | ||
125 | if ((err = snd_sb8dsp_pcm(chip, 0, NULL)) < 0) { | 124 | if ((err = snd_sb8dsp_pcm(chip, 0, NULL)) < 0) |
126 | snd_card_free(card); | 125 | goto _err; |
127 | return err; | 126 | |
128 | } | 127 | if ((err = snd_sbmixer_new(chip)) < 0) |
129 | if ((err = snd_sbmixer_new(chip)) < 0) { | 128 | goto _err; |
130 | snd_card_free(card); | 129 | |
131 | return err; | ||
132 | } | ||
133 | if (chip->hardware == SB_HW_10 || chip->hardware == SB_HW_20) { | 130 | if (chip->hardware == SB_HW_10 || chip->hardware == SB_HW_20) { |
134 | if ((err = snd_opl3_create(card, chip->port + 8, 0, | 131 | if ((err = snd_opl3_create(card, chip->port + 8, 0, |
135 | OPL3_HW_AUTO, 1, | 132 | OPL3_HW_AUTO, 1, |
136 | &opl3)) < 0) { | 133 | &opl3)) < 0) { |
137 | snd_printk(KERN_ERR "sb8: no OPL device at 0x%lx\n", chip->port + 8); | 134 | snd_printk(KERN_WARNING "sb8: no OPL device at 0x%lx\n", chip->port + 8); |
138 | } | 135 | } |
139 | } else { | 136 | } else { |
140 | if ((err = snd_opl3_create(card, chip->port, chip->port + 2, | 137 | if ((err = snd_opl3_create(card, chip->port, chip->port + 2, |
141 | OPL3_HW_AUTO, 1, | 138 | OPL3_HW_AUTO, 1, |
142 | &opl3)) < 0) { | 139 | &opl3)) < 0) { |
143 | snd_printk(KERN_ERR "sb8: no OPL device at 0x%lx-0x%lx\n", | 140 | snd_printk(KERN_WARNING "sb8: no OPL device at 0x%lx-0x%lx\n", |
144 | chip->port, chip->port + 2); | 141 | chip->port, chip->port + 2); |
145 | } | 142 | } |
146 | } | 143 | } |
147 | if (err >= 0) { | 144 | if (err >= 0) { |
148 | if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) { | 145 | if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) |
149 | snd_card_free(card); | 146 | goto _err; |
150 | return err; | ||
151 | } | ||
152 | } | 147 | } |
153 | 148 | ||
154 | if ((err = snd_sb8dsp_midi(chip, 0, NULL)) < 0) { | 149 | if ((err = snd_sb8dsp_midi(chip, 0, NULL)) < 0) |
155 | snd_card_free(card); | 150 | goto _err; |
156 | return err; | ||
157 | } | ||
158 | 151 | ||
159 | strcpy(card->driver, chip->hardware == SB_HW_PRO ? "SB Pro" : "SB8"); | 152 | strcpy(card->driver, chip->hardware == SB_HW_PRO ? "SB Pro" : "SB8"); |
160 | strcpy(card->shortname, chip->name); | 153 | strcpy(card->shortname, chip->name); |
@@ -162,12 +155,19 @@ static int __init snd_sb8_probe(int dev) | |||
162 | chip->name, | 155 | chip->name, |
163 | chip->port, | 156 | chip->port, |
164 | irq[dev], dma8[dev]); | 157 | irq[dev], dma8[dev]); |
165 | if ((err = snd_card_register(card)) < 0) { | 158 | |
166 | snd_card_free(card); | 159 | if ((err = snd_card_set_generic_dev(card)) < 0) |
167 | return err; | 160 | goto _err; |
168 | } | 161 | |
162 | if ((err = snd_card_register(card)) < 0) | ||
163 | goto _err; | ||
164 | |||
169 | snd_sb8_cards[dev] = card; | 165 | snd_sb8_cards[dev] = card; |
170 | return 0; | 166 | return 0; |
167 | |||
168 | _err: | ||
169 | snd_card_free(card); | ||
170 | return err; | ||
171 | } | 171 | } |
172 | 172 | ||
173 | static int __init snd_card_sb8_legacy_auto_probe(unsigned long xport) | 173 | static int __init snd_card_sb8_legacy_auto_probe(unsigned long xport) |
diff --git a/sound/isa/sb/sb_common.c b/sound/isa/sb/sb_common.c index 5b6bde213ea0..f0f205ae425f 100644 --- a/sound/isa/sb/sb_common.c +++ b/sound/isa/sb/sb_common.c | |||
@@ -221,7 +221,7 @@ int snd_sbdsp_create(snd_card_t *card, | |||
221 | 221 | ||
222 | snd_assert(r_chip != NULL, return -EINVAL); | 222 | snd_assert(r_chip != NULL, return -EINVAL); |
223 | *r_chip = NULL; | 223 | *r_chip = NULL; |
224 | chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); | 224 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); |
225 | if (chip == NULL) | 225 | if (chip == NULL) |
226 | return -ENOMEM; | 226 | return -ENOMEM; |
227 | spin_lock_init(&chip->reg_lock); | 227 | spin_lock_init(&chip->reg_lock); |
diff --git a/sound/isa/sgalaxy.c b/sound/isa/sgalaxy.c index 17f585b0ddc1..52f2294da62b 100644 --- a/sound/isa/sgalaxy.c +++ b/sound/isa/sgalaxy.c | |||
@@ -67,6 +67,8 @@ MODULE_PARM_DESC(dma1, "DMA1 # for Sound Galaxy driver."); | |||
67 | 67 | ||
68 | static snd_card_t *snd_sgalaxy_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR; | 68 | static snd_card_t *snd_sgalaxy_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR; |
69 | 69 | ||
70 | #define PFX "sgalaxy: " | ||
71 | |||
70 | /* | 72 | /* |
71 | 73 | ||
72 | */ | 74 | */ |
@@ -135,7 +137,7 @@ static int __init snd_sgalaxy_setup_wss(unsigned long port, int irq, int dma) | |||
135 | } | 137 | } |
136 | 138 | ||
137 | #if 0 | 139 | #if 0 |
138 | snd_printdd("sgalaxy - setting up IRQ/DMA for WSS\n"); | 140 | snd_printdd(PFX "setting up IRQ/DMA for WSS\n"); |
139 | #endif | 141 | #endif |
140 | 142 | ||
141 | /* initialize IRQ for WSS codec */ | 143 | /* initialize IRQ for WSS codec */ |
@@ -160,7 +162,7 @@ static int __init snd_sgalaxy_setup_wss(unsigned long port, int irq, int dma) | |||
160 | static int __init snd_sgalaxy_detect(int dev, int irq, int dma) | 162 | static int __init snd_sgalaxy_detect(int dev, int irq, int dma) |
161 | { | 163 | { |
162 | #if 0 | 164 | #if 0 |
163 | snd_printdd("sgalaxy - switching to WSS mode\n"); | 165 | snd_printdd(PFX "switching to WSS mode\n"); |
164 | #endif | 166 | #endif |
165 | 167 | ||
166 | /* switch to WSS mode */ | 168 | /* switch to WSS mode */ |
@@ -223,11 +225,11 @@ static int __init snd_sgalaxy_probe(int dev) | |||
223 | ad1848_t *chip; | 225 | ad1848_t *chip; |
224 | 226 | ||
225 | if (sbport[dev] == SNDRV_AUTO_PORT) { | 227 | if (sbport[dev] == SNDRV_AUTO_PORT) { |
226 | snd_printk("specify SB port\n"); | 228 | snd_printk(KERN_ERR PFX "specify SB port\n"); |
227 | return -EINVAL; | 229 | return -EINVAL; |
228 | } | 230 | } |
229 | if (wssport[dev] == SNDRV_AUTO_PORT) { | 231 | if (wssport[dev] == SNDRV_AUTO_PORT) { |
230 | snd_printk("specify WSS port\n"); | 232 | snd_printk(KERN_ERR PFX "specify WSS port\n"); |
231 | return -EINVAL; | 233 | return -EINVAL; |
232 | } | 234 | } |
233 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 235 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); |
@@ -237,46 +239,39 @@ static int __init snd_sgalaxy_probe(int dev) | |||
237 | xirq = irq[dev]; | 239 | xirq = irq[dev]; |
238 | if (xirq == SNDRV_AUTO_IRQ) { | 240 | if (xirq == SNDRV_AUTO_IRQ) { |
239 | if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) { | 241 | if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) { |
240 | snd_card_free(card); | 242 | snd_printk(KERN_ERR PFX "unable to find a free IRQ\n"); |
241 | snd_printk("unable to find a free IRQ\n"); | 243 | err = -EBUSY; |
242 | return -EBUSY; | 244 | goto _err; |
243 | } | 245 | } |
244 | } | 246 | } |
245 | xdma1 = dma1[dev]; | 247 | xdma1 = dma1[dev]; |
246 | if (xdma1 == SNDRV_AUTO_DMA) { | 248 | if (xdma1 == SNDRV_AUTO_DMA) { |
247 | if ((xdma1 = snd_legacy_find_free_dma(possible_dmas)) < 0) { | 249 | if ((xdma1 = snd_legacy_find_free_dma(possible_dmas)) < 0) { |
248 | snd_card_free(card); | 250 | snd_printk(KERN_ERR PFX "unable to find a free DMA\n"); |
249 | snd_printk("unable to find a free DMA\n"); | 251 | err = -EBUSY; |
250 | return -EBUSY; | 252 | goto _err; |
251 | } | 253 | } |
252 | } | 254 | } |
253 | 255 | ||
254 | if ((err = snd_sgalaxy_detect(dev, xirq, xdma1)) < 0) { | 256 | if ((err = snd_sgalaxy_detect(dev, xirq, xdma1)) < 0) |
255 | snd_card_free(card); | 257 | goto _err; |
256 | return err; | ||
257 | } | ||
258 | 258 | ||
259 | if ((err = snd_ad1848_create(card, wssport[dev] + 4, | 259 | if ((err = snd_ad1848_create(card, wssport[dev] + 4, |
260 | xirq, xdma1, | 260 | xirq, xdma1, |
261 | AD1848_HW_DETECT, &chip)) < 0) { | 261 | AD1848_HW_DETECT, &chip)) < 0) |
262 | snd_card_free(card); | 262 | goto _err; |
263 | return err; | ||
264 | } | ||
265 | 263 | ||
266 | if ((err = snd_ad1848_pcm(chip, 0, NULL)) < 0) { | 264 | if ((err = snd_ad1848_pcm(chip, 0, NULL)) < 0) { |
267 | snd_printdd("sgalaxy - error creating new ad1848 PCM device\n"); | 265 | snd_printdd(PFX "error creating new ad1848 PCM device\n"); |
268 | snd_card_free(card); | 266 | goto _err; |
269 | return err; | ||
270 | } | 267 | } |
271 | if ((err = snd_ad1848_mixer(chip)) < 0) { | 268 | if ((err = snd_ad1848_mixer(chip)) < 0) { |
272 | snd_printdd("sgalaxy - error creating new ad1848 mixer\n"); | 269 | snd_printdd(PFX "error creating new ad1848 mixer\n"); |
273 | snd_card_free(card); | 270 | goto _err; |
274 | return err; | ||
275 | } | 271 | } |
276 | if (snd_sgalaxy_mixer(chip) < 0) { | 272 | if ((err = snd_sgalaxy_mixer(chip)) < 0) { |
277 | snd_printdd("sgalaxy - the mixer rewrite failed\n"); | 273 | snd_printdd(PFX "the mixer rewrite failed\n"); |
278 | snd_card_free(card); | 274 | goto _err; |
279 | return err; | ||
280 | } | 275 | } |
281 | 276 | ||
282 | strcpy(card->driver, "Sound Galaxy"); | 277 | strcpy(card->driver, "Sound Galaxy"); |
@@ -284,12 +279,18 @@ static int __init snd_sgalaxy_probe(int dev) | |||
284 | sprintf(card->longname, "Sound Galaxy at 0x%lx, irq %d, dma %d", | 279 | sprintf(card->longname, "Sound Galaxy at 0x%lx, irq %d, dma %d", |
285 | wssport[dev], xirq, xdma1); | 280 | wssport[dev], xirq, xdma1); |
286 | 281 | ||
287 | if ((err = snd_card_register(card)) < 0) { | 282 | if ((err = snd_card_set_generic_dev(card)) < 0) |
288 | snd_card_free(card); | 283 | goto _err; |
289 | return err; | 284 | |
290 | } | 285 | if ((err = snd_card_register(card)) < 0) |
286 | goto _err; | ||
287 | |||
291 | snd_sgalaxy_cards[dev] = card; | 288 | snd_sgalaxy_cards[dev] = card; |
292 | return 0; | 289 | return 0; |
290 | |||
291 | _err: | ||
292 | snd_card_free(card); | ||
293 | return err; | ||
293 | } | 294 | } |
294 | 295 | ||
295 | static int __init alsa_card_sgalaxy_init(void) | 296 | static int __init alsa_card_sgalaxy_init(void) |
diff --git a/sound/isa/sscape.c b/sound/isa/sscape.c index 3959ed694eec..9f6b58c79209 100644 --- a/sound/isa/sscape.c +++ b/sound/isa/sscape.c | |||
@@ -1262,11 +1262,6 @@ static int __devinit create_sscape(const struct params *params, snd_card_t **rca | |||
1262 | */ | 1262 | */ |
1263 | sscape_write(sscape, GA_INTENA_REG, 0x80); | 1263 | sscape_write(sscape, GA_INTENA_REG, 0x80); |
1264 | 1264 | ||
1265 | if ((err = snd_card_register(card)) < 0) { | ||
1266 | printk(KERN_ERR "sscape: Failed to register sound card\n"); | ||
1267 | goto _release_card; | ||
1268 | } | ||
1269 | |||
1270 | /* | 1265 | /* |
1271 | * Initialize mixer | 1266 | * Initialize mixer |
1272 | */ | 1267 | */ |
@@ -1396,6 +1391,13 @@ static int __devinit sscape_pnp_detect(struct pnp_card_link *pcard, | |||
1396 | if (ret < 0) | 1391 | if (ret < 0) |
1397 | return ret; | 1392 | return ret; |
1398 | snd_card_set_dev(card, &pcard->card->dev); | 1393 | snd_card_set_dev(card, &pcard->card->dev); |
1394 | |||
1395 | if ((ret = snd_card_register(card)) < 0) { | ||
1396 | printk(KERN_ERR "sscape: Failed to register sound card\n"); | ||
1397 | snd_card_free(card); | ||
1398 | return ret; | ||
1399 | } | ||
1400 | |||
1399 | pnp_set_card_drvdata(pcard, card); | 1401 | pnp_set_card_drvdata(pcard, card); |
1400 | ++sscape_cards; | 1402 | ++sscape_cards; |
1401 | ++idx; | 1403 | ++idx; |
@@ -1460,6 +1462,16 @@ static int __init sscape_manual_probe(struct params *params) | |||
1460 | if (ret < 0) | 1462 | if (ret < 0) |
1461 | return ret; | 1463 | return ret; |
1462 | 1464 | ||
1465 | if ((ret = snd_card_set_generic_dev(card)) < 0) { | ||
1466 | snd_card_free(card); | ||
1467 | return ret; | ||
1468 | } | ||
1469 | if ((ret = snd_card_register(card)) < 0) { | ||
1470 | printk(KERN_ERR "sscape: Failed to register sound card\n"); | ||
1471 | snd_card_free(card); | ||
1472 | return ret; | ||
1473 | } | ||
1474 | |||
1463 | sscape_card[sscape_cards] = card; | 1475 | sscape_card[sscape_cards] = card; |
1464 | params++; | 1476 | params++; |
1465 | sscape_cards++; | 1477 | sscape_cards++; |
diff --git a/sound/isa/wavefront/wavefront.c b/sound/isa/wavefront/wavefront.c index 79b022070ba3..0a572e0a47e6 100644 --- a/sound/isa/wavefront/wavefront.c +++ b/sound/isa/wavefront/wavefront.c | |||
@@ -622,6 +622,11 @@ snd_wavefront_probe (int dev, struct pnp_card_link *pcard, | |||
622 | ics2115_port[dev], | 622 | ics2115_port[dev], |
623 | ics2115_irq[dev]); | 623 | ics2115_irq[dev]); |
624 | 624 | ||
625 | if ((err = snd_card_set_generic_dev(card)) < 0) { | ||
626 | snd_card_free(card); | ||
627 | return err; | ||
628 | } | ||
629 | |||
625 | if ((err = snd_card_register(card)) < 0) { | 630 | if ((err = snd_card_register(card)) < 0) { |
626 | snd_card_free(card); | 631 | snd_card_free(card); |
627 | return err; | 632 | return err; |
diff --git a/sound/mips/Kconfig b/sound/mips/Kconfig index 531f8ba96a71..2433b7727404 100644 --- a/sound/mips/Kconfig +++ b/sound/mips/Kconfig | |||
@@ -8,6 +8,7 @@ config SND_AU1X00 | |||
8 | depends on (SOC_AU1000 || SOC_AU1100 || SOC_AU1500) && SND | 8 | depends on (SOC_AU1000 || SOC_AU1100 || SOC_AU1500) && SND |
9 | select SND_PCM | 9 | select SND_PCM |
10 | select SND_AC97_CODEC | 10 | select SND_AC97_CODEC |
11 | select SND_GENERIC_DRIVER | ||
11 | help | 12 | help |
12 | ALSA Sound driver for the Au1x00's AC97 port. | 13 | ALSA Sound driver for the Au1x00's AC97 port. |
13 | 14 | ||
diff --git a/sound/mips/au1x00.c b/sound/mips/au1x00.c index c20522b02134..3f9684f1d1d2 100644 --- a/sound/mips/au1x00.c +++ b/sound/mips/au1x00.c | |||
@@ -667,6 +667,11 @@ au1000_init(void) | |||
667 | strcpy(au1000->card->shortname, "Au1000-AC97"); | 667 | strcpy(au1000->card->shortname, "Au1000-AC97"); |
668 | sprintf(au1000->card->longname, "AMD Au1000--AC97 ALSA Driver"); | 668 | sprintf(au1000->card->longname, "AMD Au1000--AC97 ALSA Driver"); |
669 | 669 | ||
670 | if ((err = snd_card_set_generic_dev(au1000->card)) < 0) { | ||
671 | snd_card_free(au1000->card); | ||
672 | return err; | ||
673 | } | ||
674 | |||
670 | if ((err = snd_card_register(au1000->card)) < 0) { | 675 | if ((err = snd_card_register(au1000->card)) < 0) { |
671 | snd_card_free(au1000->card); | 676 | snd_card_free(au1000->card); |
672 | return err; | 677 | return err; |
diff --git a/sound/oss/Kconfig b/sound/oss/Kconfig index 7bd95ceab7cc..953e5f3ea03d 100644 --- a/sound/oss/Kconfig +++ b/sound/oss/Kconfig | |||
@@ -6,7 +6,7 @@ | |||
6 | # Prompt user for primary drivers. | 6 | # Prompt user for primary drivers. |
7 | config SOUND_BT878 | 7 | config SOUND_BT878 |
8 | tristate "BT878 audio dma" | 8 | tristate "BT878 audio dma" |
9 | depends on SOUND_PRIME | 9 | depends on SOUND_PRIME && PCI |
10 | ---help--- | 10 | ---help--- |
11 | Audio DMA support for bt878 based grabber boards. As you might have | 11 | Audio DMA support for bt878 based grabber boards. As you might have |
12 | already noticed, bt878 is listed with two functions in /proc/pci. | 12 | already noticed, bt878 is listed with two functions in /proc/pci. |
@@ -80,14 +80,14 @@ config SOUND_EMU10K1 | |||
80 | 80 | ||
81 | config MIDI_EMU10K1 | 81 | config MIDI_EMU10K1 |
82 | bool "Creative SBLive! MIDI (EXPERIMENTAL)" | 82 | bool "Creative SBLive! MIDI (EXPERIMENTAL)" |
83 | depends on SOUND_EMU10K1 && EXPERIMENTAL | 83 | depends on SOUND_EMU10K1 && EXPERIMENTAL && ISA_DMA_API |
84 | help | 84 | help |
85 | Say Y if you want to be able to use the OSS /dev/sequencer | 85 | Say Y if you want to be able to use the OSS /dev/sequencer |
86 | interface. This code is still experimental. | 86 | interface. This code is still experimental. |
87 | 87 | ||
88 | config SOUND_FUSION | 88 | config SOUND_FUSION |
89 | tristate "Crystal SoundFusion (CS4280/461x)" | 89 | tristate "Crystal SoundFusion (CS4280/461x)" |
90 | depends on SOUND_PRIME | 90 | depends on SOUND_PRIME && PCI |
91 | help | 91 | help |
92 | This module drives the Crystal SoundFusion devices (CS4280/46xx | 92 | This module drives the Crystal SoundFusion devices (CS4280/46xx |
93 | series) when wired as native sound drivers with AC97 codecs. If | 93 | series) when wired as native sound drivers with AC97 codecs. If |
@@ -95,7 +95,7 @@ config SOUND_FUSION | |||
95 | 95 | ||
96 | config SOUND_CS4281 | 96 | config SOUND_CS4281 |
97 | tristate "Crystal Sound CS4281" | 97 | tristate "Crystal Sound CS4281" |
98 | depends on SOUND_PRIME | 98 | depends on SOUND_PRIME && PCI |
99 | help | 99 | help |
100 | Picture and feature list at | 100 | Picture and feature list at |
101 | <http://www.pcbroker.com/crystal4281.html>. | 101 | <http://www.pcbroker.com/crystal4281.html>. |
@@ -179,7 +179,7 @@ config SOUND_HARMONY | |||
179 | 179 | ||
180 | config SOUND_SONICVIBES | 180 | config SOUND_SONICVIBES |
181 | tristate "S3 SonicVibes" | 181 | tristate "S3 SonicVibes" |
182 | depends on SOUND_PRIME | 182 | depends on SOUND_PRIME && PCI |
183 | help | 183 | help |
184 | Say Y or M if you have a PCI sound card utilizing the S3 | 184 | Say Y or M if you have a PCI sound card utilizing the S3 |
185 | SonicVibes chipset. To find out if your sound card uses a | 185 | SonicVibes chipset. To find out if your sound card uses a |
@@ -226,7 +226,7 @@ config SOUND_AU1550_AC97 | |||
226 | 226 | ||
227 | config SOUND_TRIDENT | 227 | config SOUND_TRIDENT |
228 | tristate "Trident 4DWave DX/NX, SiS 7018 or ALi 5451 PCI Audio Core" | 228 | tristate "Trident 4DWave DX/NX, SiS 7018 or ALi 5451 PCI Audio Core" |
229 | depends on SOUND_PRIME | 229 | depends on SOUND_PRIME && PCI |
230 | ---help--- | 230 | ---help--- |
231 | Say Y or M if you have a PCI sound card utilizing the Trident | 231 | Say Y or M if you have a PCI sound card utilizing the Trident |
232 | 4DWave-DX/NX chipset or your mother board chipset has SiS 7018 | 232 | 4DWave-DX/NX chipset or your mother board chipset has SiS 7018 |
@@ -503,7 +503,7 @@ config SOUND_VIA82CXXX | |||
503 | 503 | ||
504 | config MIDI_VIA82CXXX | 504 | config MIDI_VIA82CXXX |
505 | bool "VIA 82C686 MIDI" | 505 | bool "VIA 82C686 MIDI" |
506 | depends on SOUND_VIA82CXXX | 506 | depends on SOUND_VIA82CXXX && ISA_DMA_API |
507 | help | 507 | help |
508 | Answer Y to use the MIDI interface of the Via686. You may need to | 508 | Answer Y to use the MIDI interface of the Via686. You may need to |
509 | enable this in the BIOS before it will work. This is for connection | 509 | enable this in the BIOS before it will work. This is for connection |
@@ -512,7 +512,7 @@ config MIDI_VIA82CXXX | |||
512 | 512 | ||
513 | config SOUND_OSS | 513 | config SOUND_OSS |
514 | tristate "OSS sound modules" | 514 | tristate "OSS sound modules" |
515 | depends on SOUND_PRIME | 515 | depends on SOUND_PRIME && ISA_DMA_API |
516 | help | 516 | help |
517 | OSS is the Open Sound System suite of sound card drivers. They make | 517 | OSS is the Open Sound System suite of sound card drivers. They make |
518 | sound programming easier since they provide a common API. Say Y or | 518 | sound programming easier since they provide a common API. Say Y or |
diff --git a/sound/oss/Makefile b/sound/oss/Makefile index db9afb61d6ff..9bf3ee544d86 100644 --- a/sound/oss/Makefile +++ b/sound/oss/Makefile | |||
@@ -80,7 +80,7 @@ obj-$(CONFIG_SOUND_ALI5455) += ali5455.o ac97_codec.o | |||
80 | obj-$(CONFIG_SOUND_IT8172) += ite8172.o ac97_codec.o | 80 | obj-$(CONFIG_SOUND_IT8172) += ite8172.o ac97_codec.o |
81 | obj-$(CONFIG_SOUND_FORTE) += forte.o ac97_codec.o | 81 | obj-$(CONFIG_SOUND_FORTE) += forte.o ac97_codec.o |
82 | 82 | ||
83 | obj-$(CONFIG_SOUND_AD1980) += ac97_plugin_ad1980.o | 83 | obj-$(CONFIG_SOUND_AD1980) += ac97_plugin_ad1980.o ac97_codec.o |
84 | obj-$(CONFIG_SOUND_WM97XX) += ac97_plugin_wm97xx.o | 84 | obj-$(CONFIG_SOUND_WM97XX) += ac97_plugin_wm97xx.o |
85 | 85 | ||
86 | ifeq ($(CONFIG_MIDI_EMU10K1),y) | 86 | ifeq ($(CONFIG_MIDI_EMU10K1),y) |
diff --git a/sound/oss/ac97_codec.c b/sound/oss/ac97_codec.c index 3ecef4689f1b..fd25aca25120 100644 --- a/sound/oss/ac97_codec.c +++ b/sound/oss/ac97_codec.c | |||
@@ -55,6 +55,7 @@ | |||
55 | #include <linux/pci.h> | 55 | #include <linux/pci.h> |
56 | #include <linux/ac97_codec.h> | 56 | #include <linux/ac97_codec.h> |
57 | #include <asm/uaccess.h> | 57 | #include <asm/uaccess.h> |
58 | #include <asm/semaphore.h> | ||
58 | 59 | ||
59 | #define CODEC_ID_BUFSZ 14 | 60 | #define CODEC_ID_BUFSZ 14 |
60 | 61 | ||
diff --git a/sound/oss/au1000.c b/sound/oss/au1000.c index 4491733c9e4e..2c2ae2ee01ac 100644 --- a/sound/oss/au1000.c +++ b/sound/oss/au1000.c | |||
@@ -1295,7 +1295,7 @@ static int au1000_mmap(struct file *file, struct vm_area_struct *vma) | |||
1295 | unsigned long size; | 1295 | unsigned long size; |
1296 | int ret = 0; | 1296 | int ret = 0; |
1297 | 1297 | ||
1298 | dbg(__FUNCTION__); | 1298 | dbg("%s", __FUNCTION__); |
1299 | 1299 | ||
1300 | lock_kernel(); | 1300 | lock_kernel(); |
1301 | down(&s->sem); | 1301 | down(&s->sem); |
diff --git a/sound/oss/au1550_ac97.c b/sound/oss/au1550_ac97.c index a78e48d412d2..6b46a8a4b1cc 100644 --- a/sound/oss/au1550_ac97.c +++ b/sound/oss/au1550_ac97.c | |||
@@ -35,7 +35,6 @@ | |||
35 | 35 | ||
36 | #undef DEBUG | 36 | #undef DEBUG |
37 | 37 | ||
38 | #include <linux/version.h> | ||
39 | #include <linux/module.h> | 38 | #include <linux/module.h> |
40 | #include <linux/string.h> | 39 | #include <linux/string.h> |
41 | #include <linux/ioport.h> | 40 | #include <linux/ioport.h> |
diff --git a/sound/oss/awe_wave.c b/sound/oss/awe_wave.c index d2b9beda8ace..b3ea719d33db 100644 --- a/sound/oss/awe_wave.c +++ b/sound/oss/awe_wave.c | |||
@@ -6062,7 +6062,7 @@ static int awe_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id | |||
6062 | io1 = pnp_port_start(dev,0); | 6062 | io1 = pnp_port_start(dev,0); |
6063 | io2 = pnp_port_start(dev,1); | 6063 | io2 = pnp_port_start(dev,1); |
6064 | io3 = pnp_port_start(dev,2); | 6064 | io3 = pnp_port_start(dev,2); |
6065 | printk(KERN_INFO "AWE32: A PnP Wave Table was detected at IO's %#x,%#x,%#x\n.", | 6065 | printk(KERN_INFO "AWE32: A PnP Wave Table was detected at IO's %#x,%#x,%#x.\n", |
6066 | io1, io2, io3); | 6066 | io1, io2, io3); |
6067 | setup_ports(io1, io2, io3); | 6067 | setup_ports(io1, io2, io3); |
6068 | 6068 | ||
diff --git a/sound/oss/cs4232.c b/sound/oss/cs4232.c index 6ec308f5d935..7c59e2d4003a 100644 --- a/sound/oss/cs4232.c +++ b/sound/oss/cs4232.c | |||
@@ -195,10 +195,12 @@ static int __init probe_cs4232(struct address_info *hw_config, int isapnp_config | |||
195 | CS_OUT2(0x15, 0x00); /* Select logical device 0 (WSS/SB/FM) */ | 195 | CS_OUT2(0x15, 0x00); /* Select logical device 0 (WSS/SB/FM) */ |
196 | CS_OUT3(0x47, (base >> 8) & 0xff, base & 0xff); /* WSS base */ | 196 | CS_OUT3(0x47, (base >> 8) & 0xff, base & 0xff); /* WSS base */ |
197 | 197 | ||
198 | if (check_region(0x388, 4)) /* Not free */ | 198 | if (!request_region(0x388, 4, "FM")) /* Not free */ |
199 | CS_OUT3(0x48, 0x00, 0x00) /* FM base off */ | 199 | CS_OUT3(0x48, 0x00, 0x00) /* FM base off */ |
200 | else | 200 | else { |
201 | release_region(0x388, 4); | ||
201 | CS_OUT3(0x48, 0x03, 0x88); /* FM base 0x388 */ | 202 | CS_OUT3(0x48, 0x03, 0x88); /* FM base 0x388 */ |
203 | } | ||
202 | 204 | ||
203 | CS_OUT3(0x42, 0x00, 0x00); /* SB base off */ | 205 | CS_OUT3(0x42, 0x00, 0x00); /* SB base off */ |
204 | CS_OUT2(0x22, irq); /* SB+WSS IRQ */ | 206 | CS_OUT2(0x22, irq); /* SB+WSS IRQ */ |
diff --git a/sound/oss/dmasound/dmasound.h b/sound/oss/dmasound/dmasound.h index 9a2f50f0b184..222014cafc1a 100644 --- a/sound/oss/dmasound/dmasound.h +++ b/sound/oss/dmasound/dmasound.h | |||
@@ -116,7 +116,7 @@ typedef struct { | |||
116 | const char *name; | 116 | const char *name; |
117 | const char *name2; | 117 | const char *name2; |
118 | struct module *owner; | 118 | struct module *owner; |
119 | void *(*dma_alloc)(unsigned int, int); | 119 | void *(*dma_alloc)(unsigned int, gfp_t); |
120 | void (*dma_free)(void *, unsigned int); | 120 | void (*dma_free)(void *, unsigned int); |
121 | int (*irqinit)(void); | 121 | int (*irqinit)(void); |
122 | #ifdef MODULE | 122 | #ifdef MODULE |
diff --git a/sound/oss/dmasound/dmasound_atari.c b/sound/oss/dmasound/dmasound_atari.c index 8daaf87664ba..59eb53f89318 100644 --- a/sound/oss/dmasound/dmasound_atari.c +++ b/sound/oss/dmasound/dmasound_atari.c | |||
@@ -114,7 +114,7 @@ static ssize_t ata_ctx_u16le(const u_char *userPtr, size_t userCount, | |||
114 | /*** Low level stuff *********************************************************/ | 114 | /*** Low level stuff *********************************************************/ |
115 | 115 | ||
116 | 116 | ||
117 | static void *AtaAlloc(unsigned int size, int flags); | 117 | static void *AtaAlloc(unsigned int size, gfp_t flags); |
118 | static void AtaFree(void *, unsigned int size); | 118 | static void AtaFree(void *, unsigned int size); |
119 | static int AtaIrqInit(void); | 119 | static int AtaIrqInit(void); |
120 | #ifdef MODULE | 120 | #ifdef MODULE |
@@ -810,7 +810,7 @@ static TRANS transFalconExpanding = { | |||
810 | * Atari (TT/Falcon) | 810 | * Atari (TT/Falcon) |
811 | */ | 811 | */ |
812 | 812 | ||
813 | static void *AtaAlloc(unsigned int size, int flags) | 813 | static void *AtaAlloc(unsigned int size, gfp_t flags) |
814 | { | 814 | { |
815 | return atari_stram_alloc(size, "dmasound"); | 815 | return atari_stram_alloc(size, "dmasound"); |
816 | } | 816 | } |
diff --git a/sound/oss/dmasound/dmasound_awacs.c b/sound/oss/dmasound/dmasound_awacs.c index 2ceb46f1d40f..b2bf8bac842d 100644 --- a/sound/oss/dmasound/dmasound_awacs.c +++ b/sound/oss/dmasound/dmasound_awacs.c | |||
@@ -271,7 +271,7 @@ int expand_read_bal; /* Balance factor for expanding reads (not volume!) */ | |||
271 | 271 | ||
272 | /*** Low level stuff *********************************************************/ | 272 | /*** Low level stuff *********************************************************/ |
273 | 273 | ||
274 | static void *PMacAlloc(unsigned int size, int flags); | 274 | static void *PMacAlloc(unsigned int size, gfp_t flags); |
275 | static void PMacFree(void *ptr, unsigned int size); | 275 | static void PMacFree(void *ptr, unsigned int size); |
276 | static int PMacIrqInit(void); | 276 | static int PMacIrqInit(void); |
277 | #ifdef MODULE | 277 | #ifdef MODULE |
@@ -614,7 +614,7 @@ tas_init_frame_rates(unsigned int *prop, unsigned int l) | |||
614 | /* | 614 | /* |
615 | * PCI PowerMac, with AWACS, Screamer, Burgundy, DACA or Tumbler and DBDMA. | 615 | * PCI PowerMac, with AWACS, Screamer, Burgundy, DACA or Tumbler and DBDMA. |
616 | */ | 616 | */ |
617 | static void *PMacAlloc(unsigned int size, int flags) | 617 | static void *PMacAlloc(unsigned int size, gfp_t flags) |
618 | { | 618 | { |
619 | return kmalloc(size, flags); | 619 | return kmalloc(size, flags); |
620 | } | 620 | } |
diff --git a/sound/oss/dmasound/dmasound_paula.c b/sound/oss/dmasound/dmasound_paula.c index 558db5311e06..d59f60b26410 100644 --- a/sound/oss/dmasound/dmasound_paula.c +++ b/sound/oss/dmasound/dmasound_paula.c | |||
@@ -69,7 +69,7 @@ static int write_sq_block_size_half, write_sq_block_size_quarter; | |||
69 | /*** Low level stuff *********************************************************/ | 69 | /*** Low level stuff *********************************************************/ |
70 | 70 | ||
71 | 71 | ||
72 | static void *AmiAlloc(unsigned int size, int flags); | 72 | static void *AmiAlloc(unsigned int size, gfp_t flags); |
73 | static void AmiFree(void *obj, unsigned int size); | 73 | static void AmiFree(void *obj, unsigned int size); |
74 | static int AmiIrqInit(void); | 74 | static int AmiIrqInit(void); |
75 | #ifdef MODULE | 75 | #ifdef MODULE |
@@ -317,7 +317,7 @@ static inline void StopDMA(void) | |||
317 | enable_heartbeat(); | 317 | enable_heartbeat(); |
318 | } | 318 | } |
319 | 319 | ||
320 | static void *AmiAlloc(unsigned int size, int flags) | 320 | static void *AmiAlloc(unsigned int size, gfp_t flags) |
321 | { | 321 | { |
322 | return amiga_chip_alloc((long)size, "dmasound [Paula]"); | 322 | return amiga_chip_alloc((long)size, "dmasound [Paula]"); |
323 | } | 323 | } |
diff --git a/sound/oss/dmasound/dmasound_q40.c b/sound/oss/dmasound/dmasound_q40.c index 92c25a0174db..1ddaa6284b08 100644 --- a/sound/oss/dmasound/dmasound_q40.c +++ b/sound/oss/dmasound/dmasound_q40.c | |||
@@ -36,7 +36,7 @@ static int expand_data; /* Data for expanding */ | |||
36 | /*** Low level stuff *********************************************************/ | 36 | /*** Low level stuff *********************************************************/ |
37 | 37 | ||
38 | 38 | ||
39 | static void *Q40Alloc(unsigned int size, int flags); | 39 | static void *Q40Alloc(unsigned int size, gfp_t flags); |
40 | static void Q40Free(void *, unsigned int); | 40 | static void Q40Free(void *, unsigned int); |
41 | static int Q40IrqInit(void); | 41 | static int Q40IrqInit(void); |
42 | #ifdef MODULE | 42 | #ifdef MODULE |
@@ -358,7 +358,7 @@ static TRANS transQ40Compressing = { | |||
358 | 358 | ||
359 | /*** Low level stuff *********************************************************/ | 359 | /*** Low level stuff *********************************************************/ |
360 | 360 | ||
361 | static void *Q40Alloc(unsigned int size, int flags) | 361 | static void *Q40Alloc(unsigned int size, gfp_t flags) |
362 | { | 362 | { |
363 | return kmalloc(size, flags); /* change to vmalloc */ | 363 | return kmalloc(size, flags); /* change to vmalloc */ |
364 | } | 364 | } |
diff --git a/sound/oss/i810_audio.c b/sound/oss/i810_audio.c index 7e9f667cf7a7..b9a640fe48b1 100644 --- a/sound/oss/i810_audio.c +++ b/sound/oss/i810_audio.c | |||
@@ -3430,9 +3430,9 @@ out_iospace: | |||
3430 | release_mem_region(card->iobase_mmio_phys, 256); | 3430 | release_mem_region(card->iobase_mmio_phys, 256); |
3431 | } | 3431 | } |
3432 | out_pio: | 3432 | out_pio: |
3433 | release_region(card->iobase, 64); | ||
3434 | out_region2: | ||
3435 | release_region(card->ac97base, 256); | 3433 | release_region(card->ac97base, 256); |
3434 | out_region2: | ||
3435 | release_region(card->iobase, 64); | ||
3436 | out_region1: | 3436 | out_region1: |
3437 | pci_free_consistent(pci_dev, sizeof(struct i810_channel)*NR_HW_CH, | 3437 | pci_free_consistent(pci_dev, sizeof(struct i810_channel)*NR_HW_CH, |
3438 | card->channel, card->chandma); | 3438 | card->channel, card->chandma); |
diff --git a/sound/oss/ite8172.c b/sound/oss/ite8172.c index 58f879fda975..26e5944b6ba8 100644 --- a/sound/oss/ite8172.c +++ b/sound/oss/ite8172.c | |||
@@ -1859,7 +1859,7 @@ static int it8172_release(struct inode *inode, struct file *file) | |||
1859 | struct it8172_state *s = (struct it8172_state *)file->private_data; | 1859 | struct it8172_state *s = (struct it8172_state *)file->private_data; |
1860 | 1860 | ||
1861 | #ifdef IT8172_VERBOSE_DEBUG | 1861 | #ifdef IT8172_VERBOSE_DEBUG |
1862 | dbg(__FUNCTION__); | 1862 | dbg("%s", __FUNCTION__); |
1863 | #endif | 1863 | #endif |
1864 | lock_kernel(); | 1864 | lock_kernel(); |
1865 | if (file->f_mode & FMODE_WRITE) | 1865 | if (file->f_mode & FMODE_WRITE) |
diff --git a/sound/oss/midibuf.c b/sound/oss/midibuf.c index b2676fa34630..6982556ded56 100644 --- a/sound/oss/midibuf.c +++ b/sound/oss/midibuf.c | |||
@@ -50,7 +50,7 @@ static struct midi_parms parms[MAX_MIDI_DEV]; | |||
50 | static void midi_poll(unsigned long dummy); | 50 | static void midi_poll(unsigned long dummy); |
51 | 51 | ||
52 | 52 | ||
53 | static struct timer_list poll_timer = TIMER_INITIALIZER(midi_poll, 0, 0); | 53 | static DEFINE_TIMER(poll_timer, midi_poll, 0, 0); |
54 | 54 | ||
55 | static volatile int open_devs; | 55 | static volatile int open_devs; |
56 | static DEFINE_SPINLOCK(lock); | 56 | static DEFINE_SPINLOCK(lock); |
diff --git a/sound/oss/os.h b/sound/oss/os.h index d6b96297835c..80dce329cc3a 100644 --- a/sound/oss/os.h +++ b/sound/oss/os.h | |||
@@ -19,9 +19,6 @@ | |||
19 | #include <linux/ioport.h> | 19 | #include <linux/ioport.h> |
20 | #include <asm/page.h> | 20 | #include <asm/page.h> |
21 | #include <asm/system.h> | 21 | #include <asm/system.h> |
22 | #ifdef __alpha__ | ||
23 | #include <asm/segment.h> | ||
24 | #endif | ||
25 | #include <linux/vmalloc.h> | 22 | #include <linux/vmalloc.h> |
26 | #include <asm/uaccess.h> | 23 | #include <asm/uaccess.h> |
27 | #include <linux/poll.h> | 24 | #include <linux/poll.h> |
diff --git a/sound/oss/skeleton.c b/sound/oss/skeleton.c deleted file mode 100644 index 8fea783dd0cb..000000000000 --- a/sound/oss/skeleton.c +++ /dev/null | |||
@@ -1,219 +0,0 @@ | |||
1 | /* | ||
2 | * PCI sound skeleton example | ||
3 | * | ||
4 | * (c) 1998 Red Hat Software | ||
5 | * | ||
6 | * This software may be used and distributed according to the | ||
7 | * terms of the GNU General Public License, incorporated herein by | ||
8 | * reference. | ||
9 | * | ||
10 | * This example is designed to be built in the linux/drivers/sound | ||
11 | * directory as part of a kernel build. The example is modular only | ||
12 | * drop me a note once you have a working modular driver and want | ||
13 | * to integrate it with the main code. | ||
14 | * -- Alan <alan@redhat.com> | ||
15 | * | ||
16 | * This is a first draft. Please report any errors, corrections or | ||
17 | * improvements to me. | ||
18 | */ | ||
19 | |||
20 | #include <linux/module.h> | ||
21 | #include <linux/delay.h> | ||
22 | #include <linux/errno.h> | ||
23 | #include <linux/fs.h> | ||
24 | #include <linux/kernel.h> | ||
25 | #include <linux/pci.h> | ||
26 | |||
27 | #include <asm/io.h> | ||
28 | |||
29 | #include "sound_config.h" | ||
30 | |||
31 | /* | ||
32 | * Define our PCI vendor ID here | ||
33 | */ | ||
34 | |||
35 | #ifndef PCI_VENDOR_MYIDENT | ||
36 | #define PCI_VENDOR_MYIDENT 0x125D | ||
37 | |||
38 | /* | ||
39 | * PCI identity for the card. | ||
40 | */ | ||
41 | |||
42 | #define PCI_DEVICE_ID_MYIDENT_MYCARD1 0x1969 | ||
43 | #endif | ||
44 | |||
45 | #define CARD_NAME "ExampleWave 3D Pro Ultra ThingyWotsit" | ||
46 | |||
47 | #define MAX_CARDS 8 | ||
48 | |||
49 | /* | ||
50 | * Each address_info object holds the information about one of | ||
51 | * our card resources. In this case the MSS emulation of our | ||
52 | * ficticious card. Its used to manage and attach things. | ||
53 | */ | ||
54 | |||
55 | static struct address_info mss_data[MAX_CARDS]; | ||
56 | static int cards; | ||
57 | |||
58 | /* | ||
59 | * Install the actual card. This is an example | ||
60 | */ | ||
61 | |||
62 | static int mycard_install(struct pci_dev *pcidev) | ||
63 | { | ||
64 | int iobase; | ||
65 | int mssbase; | ||
66 | int mpubase; | ||
67 | u8 x; | ||
68 | u16 w; | ||
69 | u32 v; | ||
70 | int i; | ||
71 | int dma; | ||
72 | |||
73 | /* | ||
74 | * Our imaginary code has its I/O on PCI address 0, a | ||
75 | * MSS on PCI address 1 and an MPU on address 2 | ||
76 | * | ||
77 | * For the example we will only initialise the MSS | ||
78 | */ | ||
79 | |||
80 | iobase = pci_resource_start(pcidev, 0); | ||
81 | mssbase = pci_resource_start(pcidev, 1); | ||
82 | mpubase = pci_resource_start(pcidev, 2); | ||
83 | |||
84 | /* | ||
85 | * Reset the board | ||
86 | */ | ||
87 | |||
88 | /* | ||
89 | * Wait for completion. udelay() waits in microseconds | ||
90 | */ | ||
91 | |||
92 | udelay(100); | ||
93 | |||
94 | /* | ||
95 | * Ok card ready. Begin setup proper. You might for example | ||
96 | * load the firmware here | ||
97 | */ | ||
98 | |||
99 | dma = card_specific_magic(ioaddr); | ||
100 | |||
101 | /* | ||
102 | * Turn on legacy mode (example), There are also byte and | ||
103 | * dword (32bit) PCI configuration function calls | ||
104 | */ | ||
105 | |||
106 | pci_read_config_word(pcidev, 0x40, &w); | ||
107 | w&=~(1<<15); /* legacy decode on */ | ||
108 | w|=(1<<14); /* Reserved write as 1 in this case */ | ||
109 | w|=(1<<3)|(1<<1)|(1<<0); /* SB on , FM on, MPU on */ | ||
110 | pci_write_config_word(pcidev, 0x40, w); | ||
111 | |||
112 | /* | ||
113 | * Let the user know we found his toy. | ||
114 | */ | ||
115 | |||
116 | printk(KERN_INFO "Programmed "CARD_NAME" at 0x%X to legacy mode.\n", | ||
117 | iobase); | ||
118 | |||
119 | /* | ||
120 | * Now set it up the description of the card | ||
121 | */ | ||
122 | |||
123 | mss_data[cards].io_base = mssbase; | ||
124 | mss_data[cards].irq = pcidev->irq; | ||
125 | mss_data[cards].dma = dma; | ||
126 | |||
127 | /* | ||
128 | * Check there is an MSS present | ||
129 | */ | ||
130 | |||
131 | if(ad1848_detect(mssbase, NULL, mss_data[cards].osp)==0) | ||
132 | return 0; | ||
133 | |||
134 | /* | ||
135 | * Initialize it | ||
136 | */ | ||
137 | |||
138 | mss_data[cards].slots[3] = ad1848_init("MyCard MSS 16bit", | ||
139 | mssbase, | ||
140 | mss_data[cards].irq, | ||
141 | mss_data[cards].dma, | ||
142 | mss_data[cards].dma, | ||
143 | 0, | ||
144 | 0, | ||
145 | THIS_MODULE); | ||
146 | |||
147 | cards++; | ||
148 | return 1; | ||
149 | } | ||
150 | |||
151 | |||
152 | /* | ||
153 | * This loop walks the PCI configuration database and finds where | ||
154 | * the sound cards are. | ||
155 | */ | ||
156 | |||
157 | int init_mycard(void) | ||
158 | { | ||
159 | struct pci_dev *pcidev=NULL; | ||
160 | int count=0; | ||
161 | |||
162 | while((pcidev = pci_find_device(PCI_VENDOR_MYIDENT, PCI_DEVICE_ID_MYIDENT_MYCARD1, pcidev))!=NULL) | ||
163 | { | ||
164 | if (pci_enable_device(pcidev)) | ||
165 | continue; | ||
166 | count+=mycard_install(pcidev); | ||
167 | if(count) | ||
168 | return 0; | ||
169 | if(count==MAX_CARDS) | ||
170 | break; | ||
171 | } | ||
172 | |||
173 | if(count==0) | ||
174 | return -ENODEV; | ||
175 | return 0; | ||
176 | } | ||
177 | |||
178 | /* | ||
179 | * This function is called when the user or kernel loads the | ||
180 | * module into memory. | ||
181 | */ | ||
182 | |||
183 | |||
184 | int init_module(void) | ||
185 | { | ||
186 | if(init_mycard()<0) | ||
187 | { | ||
188 | printk(KERN_ERR "No "CARD_NAME" cards found.\n"); | ||
189 | return -ENODEV; | ||
190 | } | ||
191 | |||
192 | return 0; | ||
193 | } | ||
194 | |||
195 | /* | ||
196 | * This is called when it is removed. It will only be removed | ||
197 | * when its use count is 0. | ||
198 | */ | ||
199 | |||
200 | void cleanup_module(void) | ||
201 | { | ||
202 | for(i=0;i< cards; i++) | ||
203 | { | ||
204 | /* | ||
205 | * Free attached resources | ||
206 | */ | ||
207 | |||
208 | ad1848_unload(mss_data[i].io_base, | ||
209 | mss_data[i].irq, | ||
210 | mss_data[i].dma, | ||
211 | mss_data[i].dma, | ||
212 | 0); | ||
213 | /* | ||
214 | * And disconnect the device from the kernel | ||
215 | */ | ||
216 | sound_unload_audiodevice(mss_data[i].slots[3]); | ||
217 | } | ||
218 | } | ||
219 | |||
diff --git a/sound/oss/soundcard.c b/sound/oss/soundcard.c index a686be936aff..d33bb464f70e 100644 --- a/sound/oss/soundcard.c +++ b/sound/oss/soundcard.c | |||
@@ -567,7 +567,7 @@ static int __init oss_init(void) | |||
567 | devfs_mk_cdev(MKDEV(SOUND_MAJOR, dev_list[i].minor), | 567 | devfs_mk_cdev(MKDEV(SOUND_MAJOR, dev_list[i].minor), |
568 | S_IFCHR | dev_list[i].mode, | 568 | S_IFCHR | dev_list[i].mode, |
569 | "sound/%s", dev_list[i].name); | 569 | "sound/%s", dev_list[i].name); |
570 | class_device_create(sound_class, | 570 | class_device_create(sound_class, NULL, |
571 | MKDEV(SOUND_MAJOR, dev_list[i].minor), | 571 | MKDEV(SOUND_MAJOR, dev_list[i].minor), |
572 | NULL, "%s", dev_list[i].name); | 572 | NULL, "%s", dev_list[i].name); |
573 | 573 | ||
@@ -579,7 +579,7 @@ static int __init oss_init(void) | |||
579 | dev_list[i].minor + (j*0x10)), | 579 | dev_list[i].minor + (j*0x10)), |
580 | S_IFCHR | dev_list[i].mode, | 580 | S_IFCHR | dev_list[i].mode, |
581 | "sound/%s%d", dev_list[i].name, j); | 581 | "sound/%s%d", dev_list[i].name, j); |
582 | class_device_create(sound_class, | 582 | class_device_create(sound_class, NULL, |
583 | MKDEV(SOUND_MAJOR, dev_list[i].minor + (j*0x10)), | 583 | MKDEV(SOUND_MAJOR, dev_list[i].minor + (j*0x10)), |
584 | NULL, "%s%d", dev_list[i].name, j); | 584 | NULL, "%s%d", dev_list[i].name, j); |
585 | } | 585 | } |
@@ -681,8 +681,7 @@ static void do_sequencer_timer(unsigned long dummy) | |||
681 | } | 681 | } |
682 | 682 | ||
683 | 683 | ||
684 | static struct timer_list seq_timer = | 684 | static DEFINE_TIMER(seq_timer, do_sequencer_timer, 0, 0); |
685 | TIMER_INITIALIZER(do_sequencer_timer, 0, 0); | ||
686 | 685 | ||
687 | void request_sound_timer(int count) | 686 | void request_sound_timer(int count) |
688 | { | 687 | { |
diff --git a/sound/oss/sys_timer.c b/sound/oss/sys_timer.c index 6afe29b763b7..c9d04518b172 100644 --- a/sound/oss/sys_timer.c +++ b/sound/oss/sys_timer.c | |||
@@ -28,8 +28,7 @@ static unsigned long prev_event_time; | |||
28 | 28 | ||
29 | static void poll_def_tmr(unsigned long dummy); | 29 | static void poll_def_tmr(unsigned long dummy); |
30 | static DEFINE_SPINLOCK(lock); | 30 | static DEFINE_SPINLOCK(lock); |
31 | 31 | static DEFINE_TIMER(def_tmr, poll_def_tmr, 0, 0); | |
32 | static struct timer_list def_tmr = TIMER_INITIALIZER(poll_def_tmr, 0, 0); | ||
33 | 32 | ||
34 | static unsigned long | 33 | static unsigned long |
35 | tmr2ticks(int tmr_value) | 34 | tmr2ticks(int tmr_value) |
diff --git a/sound/oss/uart6850.c b/sound/oss/uart6850.c index be00cf128651..74ae75f9e2dc 100644 --- a/sound/oss/uart6850.c +++ b/sound/oss/uart6850.c | |||
@@ -78,8 +78,7 @@ static void (*midi_input_intr) (int dev, unsigned char data); | |||
78 | static void poll_uart6850(unsigned long dummy); | 78 | static void poll_uart6850(unsigned long dummy); |
79 | 79 | ||
80 | 80 | ||
81 | static struct timer_list uart6850_timer = | 81 | static DEFINE_TIMER(uart6850_timer, poll_uart6850, 0, 0); |
82 | TIMER_INITIALIZER(poll_uart6850, 0, 0); | ||
83 | 82 | ||
84 | static void uart6850_input_loop(void) | 83 | static void uart6850_input_loop(void) |
85 | { | 84 | { |
diff --git a/sound/oss/vidc.h b/sound/oss/vidc.h index bab7044572d3..d5b8064dc565 100644 --- a/sound/oss/vidc.h +++ b/sound/oss/vidc.h | |||
@@ -10,10 +10,6 @@ | |||
10 | * VIDC sound function prototypes | 10 | * VIDC sound function prototypes |
11 | */ | 11 | */ |
12 | 12 | ||
13 | /* vidc.c */ | ||
14 | |||
15 | extern int vidc_busy; | ||
16 | |||
17 | /* vidc_fill.S */ | 13 | /* vidc_fill.S */ |
18 | 14 | ||
19 | /* | 15 | /* |
diff --git a/sound/oss/wavfront.c b/sound/oss/wavfront.c index b92ba8921638..b1a4eeb9dc08 100644 --- a/sound/oss/wavfront.c +++ b/sound/oss/wavfront.c | |||
@@ -2434,7 +2434,7 @@ static int __init detect_wavefront (int irq, int io_base) | |||
2434 | consumes 16. | 2434 | consumes 16. |
2435 | */ | 2435 | */ |
2436 | 2436 | ||
2437 | if (check_region (io_base, 16)) { | 2437 | if (!request_region (io_base, 16, "wavfront")) { |
2438 | printk (KERN_ERR LOGNAME "IO address range 0x%x - 0x%x " | 2438 | printk (KERN_ERR LOGNAME "IO address range 0x%x - 0x%x " |
2439 | "already in use - ignored\n", dev.base, | 2439 | "already in use - ignored\n", dev.base, |
2440 | dev.base+15); | 2440 | dev.base+15); |
@@ -2466,10 +2466,13 @@ static int __init detect_wavefront (int irq, int io_base) | |||
2466 | } else { | 2466 | } else { |
2467 | printk (KERN_WARNING LOGNAME "not raw, but no " | 2467 | printk (KERN_WARNING LOGNAME "not raw, but no " |
2468 | "hardware version!\n"); | 2468 | "hardware version!\n"); |
2469 | release_region (io_base, 16); | ||
2469 | return 0; | 2470 | return 0; |
2470 | } | 2471 | } |
2471 | 2472 | ||
2472 | if (!wf_raw) { | 2473 | if (!wf_raw) { |
2474 | /* will re-acquire region in install_wavefront() */ | ||
2475 | release_region (io_base, 16); | ||
2473 | return 1; | 2476 | return 1; |
2474 | } else { | 2477 | } else { |
2475 | printk (KERN_INFO LOGNAME | 2478 | printk (KERN_INFO LOGNAME |
@@ -2489,6 +2492,7 @@ static int __init detect_wavefront (int irq, int io_base) | |||
2489 | 2492 | ||
2490 | if (wavefront_hw_reset ()) { | 2493 | if (wavefront_hw_reset ()) { |
2491 | printk (KERN_WARNING LOGNAME "hardware reset failed\n"); | 2494 | printk (KERN_WARNING LOGNAME "hardware reset failed\n"); |
2495 | release_region (io_base, 16); | ||
2492 | return 0; | 2496 | return 0; |
2493 | } | 2497 | } |
2494 | 2498 | ||
@@ -2496,6 +2500,8 @@ static int __init detect_wavefront (int irq, int io_base) | |||
2496 | 2500 | ||
2497 | dev.has_fx = (detect_wffx () == 0); | 2501 | dev.has_fx = (detect_wffx () == 0); |
2498 | 2502 | ||
2503 | /* will re-acquire region in install_wavefront() */ | ||
2504 | release_region (io_base, 16); | ||
2499 | return 1; | 2505 | return 1; |
2500 | } | 2506 | } |
2501 | 2507 | ||
@@ -2804,17 +2810,27 @@ static int __init wavefront_init (int atboot) | |||
2804 | } | 2810 | } |
2805 | 2811 | ||
2806 | static int __init install_wavefront (void) | 2812 | static int __init install_wavefront (void) |
2807 | |||
2808 | { | 2813 | { |
2814 | if (!request_region (dev.base+2, 6, "wavefront synth")) | ||
2815 | return -1; | ||
2816 | |||
2817 | if (dev.has_fx) { | ||
2818 | if (!request_region (dev.base+8, 8, "wavefront fx")) { | ||
2819 | release_region (dev.base+2, 6); | ||
2820 | return -1; | ||
2821 | } | ||
2822 | } | ||
2823 | |||
2809 | if ((dev.synth_dev = register_sound_synth (&wavefront_fops, -1)) < 0) { | 2824 | if ((dev.synth_dev = register_sound_synth (&wavefront_fops, -1)) < 0) { |
2810 | printk (KERN_ERR LOGNAME "cannot register raw synth\n"); | 2825 | printk (KERN_ERR LOGNAME "cannot register raw synth\n"); |
2811 | return -1; | 2826 | goto err_out; |
2812 | } | 2827 | } |
2813 | 2828 | ||
2814 | #if OSS_SUPPORT_LEVEL & OSS_SUPPORT_SEQ | 2829 | #if OSS_SUPPORT_LEVEL & OSS_SUPPORT_SEQ |
2815 | if ((dev.oss_dev = sound_alloc_synthdev()) == -1) { | 2830 | if ((dev.oss_dev = sound_alloc_synthdev()) == -1) { |
2816 | printk (KERN_ERR LOGNAME "Too many sequencers\n"); | 2831 | printk (KERN_ERR LOGNAME "Too many sequencers\n"); |
2817 | return -1; | 2832 | /* FIXME: leak: should unregister sound synth */ |
2833 | goto err_out; | ||
2818 | } else { | 2834 | } else { |
2819 | synth_devs[dev.oss_dev] = &wavefront_operations; | 2835 | synth_devs[dev.oss_dev] = &wavefront_operations; |
2820 | } | 2836 | } |
@@ -2827,20 +2843,20 @@ static int __init install_wavefront (void) | |||
2827 | sound_unload_synthdev (dev.oss_dev); | 2843 | sound_unload_synthdev (dev.oss_dev); |
2828 | #endif /* OSS_SUPPORT_SEQ */ | 2844 | #endif /* OSS_SUPPORT_SEQ */ |
2829 | 2845 | ||
2830 | return -1; | 2846 | goto err_out; |
2831 | } | 2847 | } |
2832 | 2848 | ||
2833 | request_region (dev.base+2, 6, "wavefront synth"); | ||
2834 | |||
2835 | if (dev.has_fx) { | ||
2836 | request_region (dev.base+8, 8, "wavefront fx"); | ||
2837 | } | ||
2838 | |||
2839 | if (wavefront_config_midi ()) { | 2849 | if (wavefront_config_midi ()) { |
2840 | printk (KERN_WARNING LOGNAME "could not initialize MIDI.\n"); | 2850 | printk (KERN_WARNING LOGNAME "could not initialize MIDI.\n"); |
2841 | } | 2851 | } |
2842 | 2852 | ||
2843 | return dev.oss_dev; | 2853 | return dev.oss_dev; |
2854 | |||
2855 | err_out: | ||
2856 | release_region (dev.base+2, 6); | ||
2857 | if (dev.has_fx) | ||
2858 | release_region (dev.base+8, 8); | ||
2859 | return -1; | ||
2844 | } | 2860 | } |
2845 | 2861 | ||
2846 | static void __exit uninstall_wavefront (void) | 2862 | static void __exit uninstall_wavefront (void) |
diff --git a/sound/oss/ymfpci.c b/sound/oss/ymfpci.c index 05203ad523f7..8dae59bd05a2 100644 --- a/sound/oss/ymfpci.c +++ b/sound/oss/ymfpci.c | |||
@@ -107,14 +107,15 @@ static LIST_HEAD(ymf_devs); | |||
107 | */ | 107 | */ |
108 | 108 | ||
109 | static struct pci_device_id ymf_id_tbl[] = { | 109 | static struct pci_device_id ymf_id_tbl[] = { |
110 | #define DEV(v, d, data) \ | 110 | #define DEV(dev, data) \ |
111 | { PCI_VENDOR_ID_##v, PCI_DEVICE_ID_##v##_##d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (unsigned long)data } | 111 | { PCI_VENDOR_ID_YAMAHA, dev, PCI_ANY_ID, PCI_ANY_ID, 0, 0, \ |
112 | DEV (YAMAHA, 724, "YMF724"), | 112 | (unsigned long)data } |
113 | DEV (YAMAHA, 724F, "YMF724F"), | 113 | DEV (PCI_DEVICE_ID_YAMAHA_724, "YMF724"), |
114 | DEV (YAMAHA, 740, "YMF740"), | 114 | DEV (PCI_DEVICE_ID_YAMAHA_724F, "YMF724F"), |
115 | DEV (YAMAHA, 740C, "YMF740C"), | 115 | DEV (PCI_DEVICE_ID_YAMAHA_740, "YMF740"), |
116 | DEV (YAMAHA, 744, "YMF744"), | 116 | DEV (PCI_DEVICE_ID_YAMAHA_740C, "YMF740C"), |
117 | DEV (YAMAHA, 754, "YMF754"), | 117 | DEV (PCI_DEVICE_ID_YAMAHA_744, "YMF744"), |
118 | DEV (PCI_DEVICE_ID_YAMAHA_754, "YMF754"), | ||
118 | #undef DEV | 119 | #undef DEV |
119 | { } | 120 | { } |
120 | }; | 121 | }; |
diff --git a/sound/parisc/harmony.c b/sound/parisc/harmony.c index d7a8f9f5896f..d833349ed518 100644 --- a/sound/parisc/harmony.c +++ b/sound/parisc/harmony.c | |||
@@ -197,7 +197,7 @@ snd_harmony_interrupt(int irq, void *dev, struct pt_regs *regs) | |||
197 | spin_unlock(&h->lock); | 197 | spin_unlock(&h->lock); |
198 | 198 | ||
199 | if (dstatus & HARMONY_DSTATUS_PN) { | 199 | if (dstatus & HARMONY_DSTATUS_PN) { |
200 | if (h->psubs) { | 200 | if (h->psubs && h->st.playing) { |
201 | spin_lock(&h->lock); | 201 | spin_lock(&h->lock); |
202 | h->pbuf.buf += h->pbuf.count; /* PAGE_SIZE */ | 202 | h->pbuf.buf += h->pbuf.count; /* PAGE_SIZE */ |
203 | h->pbuf.buf %= h->pbuf.size; /* MAX_BUFS*PAGE_SIZE */ | 203 | h->pbuf.buf %= h->pbuf.size; /* MAX_BUFS*PAGE_SIZE */ |
@@ -216,7 +216,7 @@ snd_harmony_interrupt(int irq, void *dev, struct pt_regs *regs) | |||
216 | } | 216 | } |
217 | 217 | ||
218 | if (dstatus & HARMONY_DSTATUS_RN) { | 218 | if (dstatus & HARMONY_DSTATUS_RN) { |
219 | if (h->csubs) { | 219 | if (h->csubs && h->st.capturing) { |
220 | spin_lock(&h->lock); | 220 | spin_lock(&h->lock); |
221 | h->cbuf.buf += h->cbuf.count; | 221 | h->cbuf.buf += h->cbuf.count; |
222 | h->cbuf.buf %= h->cbuf.size; | 222 | h->cbuf.buf %= h->cbuf.size; |
@@ -316,6 +316,7 @@ snd_harmony_playback_trigger(snd_pcm_substream_t *ss, int cmd) | |||
316 | case SNDRV_PCM_TRIGGER_STOP: | 316 | case SNDRV_PCM_TRIGGER_STOP: |
317 | h->st.playing = 0; | 317 | h->st.playing = 0; |
318 | harmony_mute(h); | 318 | harmony_mute(h); |
319 | harmony_write(h, HARMONY_PNXTADD, h->sdma.addr); | ||
319 | harmony_disable_interrupts(h); | 320 | harmony_disable_interrupts(h); |
320 | break; | 321 | break; |
321 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: | 322 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: |
@@ -351,8 +352,9 @@ snd_harmony_capture_trigger(snd_pcm_substream_t *ss, int cmd) | |||
351 | break; | 352 | break; |
352 | case SNDRV_PCM_TRIGGER_STOP: | 353 | case SNDRV_PCM_TRIGGER_STOP: |
353 | h->st.capturing = 0; | 354 | h->st.capturing = 0; |
354 | harmony_mute(h); | 355 | harmony_mute(h); |
355 | harmony_disable_interrupts(h); | 356 | harmony_write(h, HARMONY_RNXTADD, h->gdma.addr); |
357 | harmony_disable_interrupts(h); | ||
356 | break; | 358 | break; |
357 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: | 359 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: |
358 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: | 360 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: |
@@ -408,7 +410,8 @@ snd_harmony_playback_prepare(snd_pcm_substream_t *ss) | |||
408 | 410 | ||
409 | h->pbuf.size = snd_pcm_lib_buffer_bytes(ss); | 411 | h->pbuf.size = snd_pcm_lib_buffer_bytes(ss); |
410 | h->pbuf.count = snd_pcm_lib_period_bytes(ss); | 412 | h->pbuf.count = snd_pcm_lib_period_bytes(ss); |
411 | h->pbuf.buf = 0; | 413 | if (h->pbuf.buf >= h->pbuf.size) |
414 | h->pbuf.buf = 0; | ||
412 | h->st.playing = 0; | 415 | h->st.playing = 0; |
413 | 416 | ||
414 | h->st.rate = snd_harmony_rate_bits(rt->rate); | 417 | h->st.rate = snd_harmony_rate_bits(rt->rate); |
@@ -437,7 +440,8 @@ snd_harmony_capture_prepare(snd_pcm_substream_t *ss) | |||
437 | 440 | ||
438 | h->cbuf.size = snd_pcm_lib_buffer_bytes(ss); | 441 | h->cbuf.size = snd_pcm_lib_buffer_bytes(ss); |
439 | h->cbuf.count = snd_pcm_lib_period_bytes(ss); | 442 | h->cbuf.count = snd_pcm_lib_period_bytes(ss); |
440 | h->cbuf.buf = 0; | 443 | if (h->cbuf.buf >= h->cbuf.size) |
444 | h->cbuf.buf = 0; | ||
441 | h->st.capturing = 0; | 445 | h->st.capturing = 0; |
442 | 446 | ||
443 | h->st.rate = snd_harmony_rate_bits(rt->rate); | 447 | h->st.rate = snd_harmony_rate_bits(rt->rate); |
@@ -712,13 +716,14 @@ snd_harmony_volume_get(snd_kcontrol_t *kc, | |||
712 | 716 | ||
713 | left = (h->st.gain >> shift_left) & mask; | 717 | left = (h->st.gain >> shift_left) & mask; |
714 | right = (h->st.gain >> shift_right) & mask; | 718 | right = (h->st.gain >> shift_right) & mask; |
715 | |||
716 | if (invert) { | 719 | if (invert) { |
717 | left = mask - left; | 720 | left = mask - left; |
718 | right = mask - right; | 721 | right = mask - right; |
719 | } | 722 | } |
723 | |||
720 | ucontrol->value.integer.value[0] = left; | 724 | ucontrol->value.integer.value[0] = left; |
721 | ucontrol->value.integer.value[1] = right; | 725 | if (shift_left != shift_right) |
726 | ucontrol->value.integer.value[1] = right; | ||
722 | 727 | ||
723 | spin_unlock_irqrestore(&h->mixer_lock, flags); | 728 | spin_unlock_irqrestore(&h->mixer_lock, flags); |
724 | 729 | ||
@@ -738,22 +743,82 @@ snd_harmony_volume_put(snd_kcontrol_t *kc, | |||
738 | int old_gain = h->st.gain; | 743 | int old_gain = h->st.gain; |
739 | unsigned long flags; | 744 | unsigned long flags; |
740 | 745 | ||
746 | spin_lock_irqsave(&h->mixer_lock, flags); | ||
747 | |||
741 | left = ucontrol->value.integer.value[0] & mask; | 748 | left = ucontrol->value.integer.value[0] & mask; |
742 | right = ucontrol->value.integer.value[1] & mask; | 749 | if (invert) |
743 | if (invert) { | ||
744 | left = mask - left; | 750 | left = mask - left; |
745 | right = mask - right; | 751 | h->st.gain &= ~( (mask << shift_left ) ); |
752 | h->st.gain |= (left << shift_left); | ||
753 | |||
754 | if (shift_left != shift_right) { | ||
755 | right = ucontrol->value.integer.value[1] & mask; | ||
756 | if (invert) | ||
757 | right = mask - right; | ||
758 | h->st.gain &= ~( (mask << shift_right) ); | ||
759 | h->st.gain |= (right << shift_right); | ||
746 | } | 760 | } |
761 | |||
762 | snd_harmony_set_new_gain(h); | ||
763 | |||
764 | spin_unlock_irqrestore(&h->mixer_lock, flags); | ||
765 | |||
766 | return h->st.gain != old_gain; | ||
767 | } | ||
768 | |||
769 | static int | ||
770 | snd_harmony_captureroute_info(snd_kcontrol_t *kc, | ||
771 | snd_ctl_elem_info_t *uinfo) | ||
772 | { | ||
773 | static char *texts[2] = { "Line", "Mic" }; | ||
774 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | ||
775 | uinfo->count = 1; | ||
776 | uinfo->value.enumerated.items = 2; | ||
777 | if (uinfo->value.enumerated.item > 1) | ||
778 | uinfo->value.enumerated.item = 1; | ||
779 | strcpy(uinfo->value.enumerated.name, | ||
780 | texts[uinfo->value.enumerated.item]); | ||
781 | return 0; | ||
782 | } | ||
783 | |||
784 | static int | ||
785 | snd_harmony_captureroute_get(snd_kcontrol_t *kc, | ||
786 | snd_ctl_elem_value_t *ucontrol) | ||
787 | { | ||
788 | harmony_t *h = snd_kcontrol_chip(kc); | ||
789 | int value; | ||
790 | unsigned long flags; | ||
747 | 791 | ||
748 | spin_lock_irqsave(&h->mixer_lock, flags); | 792 | spin_lock_irqsave(&h->mixer_lock, flags); |
749 | 793 | ||
750 | h->st.gain &= ~( (mask << shift_right) | (mask << shift_left) ); | 794 | value = (h->st.gain >> HARMONY_GAIN_IS_SHIFT) & 1; |
751 | h->st.gain |= ( (left << shift_left) | (right << shift_right) ); | 795 | ucontrol->value.enumerated.item[0] = value; |
796 | |||
797 | spin_unlock_irqrestore(&h->mixer_lock, flags); | ||
798 | |||
799 | return 0; | ||
800 | } | ||
801 | |||
802 | static int | ||
803 | snd_harmony_captureroute_put(snd_kcontrol_t *kc, | ||
804 | snd_ctl_elem_value_t *ucontrol) | ||
805 | { | ||
806 | harmony_t *h = snd_kcontrol_chip(kc); | ||
807 | int value; | ||
808 | int old_gain = h->st.gain; | ||
809 | unsigned long flags; | ||
810 | |||
811 | spin_lock_irqsave(&h->mixer_lock, flags); | ||
812 | |||
813 | value = ucontrol->value.enumerated.item[0] & 1; | ||
814 | h->st.gain &= ~HARMONY_GAIN_IS_MASK; | ||
815 | h->st.gain |= value << HARMONY_GAIN_IS_SHIFT; | ||
816 | |||
752 | snd_harmony_set_new_gain(h); | 817 | snd_harmony_set_new_gain(h); |
753 | 818 | ||
754 | spin_unlock_irqrestore(&h->mixer_lock, flags); | 819 | spin_unlock_irqrestore(&h->mixer_lock, flags); |
755 | 820 | ||
756 | return (old_gain - h->st.gain); | 821 | return h->st.gain != old_gain; |
757 | } | 822 | } |
758 | 823 | ||
759 | #define HARMONY_CONTROLS (sizeof(snd_harmony_controls)/ \ | 824 | #define HARMONY_CONTROLS (sizeof(snd_harmony_controls)/ \ |
@@ -767,10 +832,25 @@ snd_harmony_volume_put(snd_kcontrol_t *kc, | |||
767 | ((mask) << 16) | ((invert) << 24)) } | 832 | ((mask) << 16) | ((invert) << 24)) } |
768 | 833 | ||
769 | static snd_kcontrol_new_t snd_harmony_controls[] = { | 834 | static snd_kcontrol_new_t snd_harmony_controls[] = { |
770 | HARMONY_VOLUME("Playback Volume", HARMONY_GAIN_LO_SHIFT, | 835 | HARMONY_VOLUME("Master Playback Volume", HARMONY_GAIN_LO_SHIFT, |
771 | HARMONY_GAIN_RO_SHIFT, HARMONY_GAIN_OUT, 1), | 836 | HARMONY_GAIN_RO_SHIFT, HARMONY_GAIN_OUT, 1), |
772 | HARMONY_VOLUME("Capture Volume", HARMONY_GAIN_LI_SHIFT, | 837 | HARMONY_VOLUME("Capture Volume", HARMONY_GAIN_LI_SHIFT, |
773 | HARMONY_GAIN_RI_SHIFT, HARMONY_GAIN_IN, 0), | 838 | HARMONY_GAIN_RI_SHIFT, HARMONY_GAIN_IN, 0), |
839 | HARMONY_VOLUME("Monitor Volume", HARMONY_GAIN_MA_SHIFT, | ||
840 | HARMONY_GAIN_MA_SHIFT, HARMONY_GAIN_MA, 1), | ||
841 | { | ||
842 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
843 | .name = "Input Route", | ||
844 | .info = snd_harmony_captureroute_info, | ||
845 | .get = snd_harmony_captureroute_get, | ||
846 | .put = snd_harmony_captureroute_put | ||
847 | }, | ||
848 | HARMONY_VOLUME("Internal Speaker Switch", HARMONY_GAIN_SE_SHIFT, | ||
849 | HARMONY_GAIN_SE_SHIFT, 1, 0), | ||
850 | HARMONY_VOLUME("Line-Out Switch", HARMONY_GAIN_LE_SHIFT, | ||
851 | HARMONY_GAIN_LE_SHIFT, 1, 0), | ||
852 | HARMONY_VOLUME("Headphones Switch", HARMONY_GAIN_HE_SHIFT, | ||
853 | HARMONY_GAIN_HE_SHIFT, 1, 0), | ||
774 | }; | 854 | }; |
775 | 855 | ||
776 | static void __init | 856 | static void __init |
@@ -852,14 +932,14 @@ snd_harmony_create(snd_card_t *card, | |||
852 | memset(&h->pbuf, 0, sizeof(h->pbuf)); | 932 | memset(&h->pbuf, 0, sizeof(h->pbuf)); |
853 | memset(&h->cbuf, 0, sizeof(h->cbuf)); | 933 | memset(&h->cbuf, 0, sizeof(h->cbuf)); |
854 | 934 | ||
855 | h->hpa = padev->hpa; | 935 | h->hpa = padev->hpa.start; |
856 | h->card = card; | 936 | h->card = card; |
857 | h->dev = padev; | 937 | h->dev = padev; |
858 | h->irq = padev->irq; | 938 | h->irq = padev->irq; |
859 | h->iobase = ioremap_nocache(padev->hpa, HARMONY_SIZE); | 939 | h->iobase = ioremap_nocache(padev->hpa.start, HARMONY_SIZE); |
860 | if (h->iobase == NULL) { | 940 | if (h->iobase == NULL) { |
861 | printk(KERN_ERR PFX "unable to remap hpa 0x%lx\n", | 941 | printk(KERN_ERR PFX "unable to remap hpa 0x%lx\n", |
862 | padev->hpa); | 942 | padev->hpa.start); |
863 | err = -EBUSY; | 943 | err = -EBUSY; |
864 | goto free_and_ret; | 944 | goto free_and_ret; |
865 | } | 945 | } |
@@ -880,6 +960,8 @@ snd_harmony_create(snd_card_t *card, | |||
880 | goto free_and_ret; | 960 | goto free_and_ret; |
881 | } | 961 | } |
882 | 962 | ||
963 | snd_card_set_dev(card, &padev->dev); | ||
964 | |||
883 | *rchip = h; | 965 | *rchip = h; |
884 | 966 | ||
885 | return 0; | 967 | return 0; |
diff --git a/sound/parisc/harmony.h b/sound/parisc/harmony.h index ef77f9a577d5..526c52389de2 100644 --- a/sound/parisc/harmony.h +++ b/sound/parisc/harmony.h | |||
@@ -61,7 +61,7 @@ typedef struct snd_card_harmony { | |||
61 | #define HARMONY_SIZE 64 | 61 | #define HARMONY_SIZE 64 |
62 | 62 | ||
63 | #define BUF_SIZE PAGE_SIZE | 63 | #define BUF_SIZE PAGE_SIZE |
64 | #define MAX_BUFS 10 | 64 | #define MAX_BUFS 16 |
65 | #define MAX_BUF_SIZE (MAX_BUFS * BUF_SIZE) | 65 | #define MAX_BUF_SIZE (MAX_BUFS * BUF_SIZE) |
66 | 66 | ||
67 | #define PLAYBACK_BUFS MAX_BUFS | 67 | #define PLAYBACK_BUFS MAX_BUFS |
@@ -101,28 +101,31 @@ typedef struct snd_card_harmony { | |||
101 | #define HARMONY_SS_MONO 0x00000000 | 101 | #define HARMONY_SS_MONO 0x00000000 |
102 | #define HARMONY_SS_STEREO 0x00000001 | 102 | #define HARMONY_SS_STEREO 0x00000001 |
103 | 103 | ||
104 | #define HARMONY_GAIN_SILENCE 0x00F00FFF | 104 | #define HARMONY_GAIN_SILENCE 0x01F00FFF |
105 | #define HARMONY_GAIN_DEFAULT 0x0FF00000 | 105 | #define HARMONY_GAIN_DEFAULT 0x01F00FFF |
106 | 106 | ||
107 | #define HARMONY_GAIN_HE_SHIFT 27 | 107 | #define HARMONY_GAIN_HE_SHIFT 27 /* headphones enabled */ |
108 | #define HARMONY_GAIN_HE_MASK (1 << HARMONY_GAIN_HE_SHIFT) | 108 | #define HARMONY_GAIN_HE_MASK (1 << HARMONY_GAIN_HE_SHIFT) |
109 | #define HARMONY_GAIN_LE_SHIFT 26 | 109 | #define HARMONY_GAIN_LE_SHIFT 26 /* line-out enabled */ |
110 | #define HARMONY_GAIN_LE_MASK (1 << HARMONY_GAIN_LE_SHIFT) | 110 | #define HARMONY_GAIN_LE_MASK (1 << HARMONY_GAIN_LE_SHIFT) |
111 | #define HARMONY_GAIN_SE_SHIFT 25 | 111 | #define HARMONY_GAIN_SE_SHIFT 25 /* internal-speaker enabled */ |
112 | #define HARMONY_GAIN_SE_MASK (1 << HARMONY_GAIN_SE_SHIFT) | 112 | #define HARMONY_GAIN_SE_MASK (1 << HARMONY_GAIN_SE_SHIFT) |
113 | #define HARMONY_GAIN_IS_SHIFT 24 | 113 | #define HARMONY_GAIN_IS_SHIFT 24 /* input select - 0 for line, 1 for mic */ |
114 | #define HARMONY_GAIN_IS_MASK (1 << HARMONY_GAIN_IS_SHIFT) | 114 | #define HARMONY_GAIN_IS_MASK (1 << HARMONY_GAIN_IS_SHIFT) |
115 | 115 | ||
116 | /* monitor attenuation */ | ||
116 | #define HARMONY_GAIN_MA 0x0f | 117 | #define HARMONY_GAIN_MA 0x0f |
117 | #define HARMONY_GAIN_MA_SHIFT 20 | 118 | #define HARMONY_GAIN_MA_SHIFT 20 |
118 | #define HARMONY_GAIN_MA_MASK (HARMONY_GAIN_MA << HARMONY_GAIN_MA_SHIFT) | 119 | #define HARMONY_GAIN_MA_MASK (HARMONY_GAIN_MA << HARMONY_GAIN_MA_SHIFT) |
119 | 120 | ||
121 | /* input gain */ | ||
120 | #define HARMONY_GAIN_IN 0x0f | 122 | #define HARMONY_GAIN_IN 0x0f |
121 | #define HARMONY_GAIN_LI_SHIFT 16 | 123 | #define HARMONY_GAIN_LI_SHIFT 16 |
122 | #define HARMONY_GAIN_LI_MASK (HARMONY_GAIN_IN << HARMONY_GAIN_LI_SHIFT) | 124 | #define HARMONY_GAIN_LI_MASK (HARMONY_GAIN_IN << HARMONY_GAIN_LI_SHIFT) |
123 | #define HARMONY_GAIN_RI_SHIFT 12 | 125 | #define HARMONY_GAIN_RI_SHIFT 12 |
124 | #define HARMONY_GAIN_RI_MASK (HARMONY_GAIN_IN << HARMONY_GAIN_RI_SHIFT) | 126 | #define HARMONY_GAIN_RI_MASK (HARMONY_GAIN_IN << HARMONY_GAIN_RI_SHIFT) |
125 | 127 | ||
128 | /* output gain (master volume) */ | ||
126 | #define HARMONY_GAIN_OUT 0x3f | 129 | #define HARMONY_GAIN_OUT 0x3f |
127 | #define HARMONY_GAIN_LO_SHIFT 6 | 130 | #define HARMONY_GAIN_LO_SHIFT 6 |
128 | #define HARMONY_GAIN_LO_MASK (HARMONY_GAIN_OUT << HARMONY_GAIN_LO_SHIFT) | 131 | #define HARMONY_GAIN_LO_MASK (HARMONY_GAIN_OUT << HARMONY_GAIN_LO_SHIFT) |
diff --git a/sound/pci/Kconfig b/sound/pci/Kconfig index 6d7a00f34d82..a5d593c66f9f 100644 --- a/sound/pci/Kconfig +++ b/sound/pci/Kconfig | |||
@@ -1,11 +1,15 @@ | |||
1 | # ALSA PCI drivers | 1 | # ALSA PCI drivers |
2 | 2 | ||
3 | menu "PCI devices" | ||
4 | depends on SND!=n && PCI | ||
5 | |||
6 | config SND_AC97_CODEC | 3 | config SND_AC97_CODEC |
7 | tristate | 4 | tristate |
8 | select SND_PCM | 5 | select SND_PCM |
6 | select SND_AC97_BUS | ||
7 | |||
8 | config SND_AC97_BUS | ||
9 | tristate | ||
10 | |||
11 | menu "PCI devices" | ||
12 | depends on SND!=n && PCI | ||
9 | 13 | ||
10 | config SND_ALI5451 | 14 | config SND_ALI5451 |
11 | tristate "ALi M5451 PCI Audio Controller" | 15 | tristate "ALi M5451 PCI Audio Controller" |
@@ -312,9 +316,21 @@ config SND_YMFPCI | |||
312 | To compile this driver as a module, choose M here: the module | 316 | To compile this driver as a module, choose M here: the module |
313 | will be called snd-ymfpci. | 317 | will be called snd-ymfpci. |
314 | 318 | ||
319 | config SND_AD1889 | ||
320 | tristate "Analog Devices AD1889" | ||
321 | depends on SND | ||
322 | select SND_AC97_CODEC | ||
323 | help | ||
324 | Say Y here to include support for the integrated AC97 sound | ||
325 | device found in particular on the Hewlett-Packard [BCJ]-xxx0 | ||
326 | class PA-RISC workstations, using the AD1819 codec. | ||
327 | |||
328 | To compile this as a module, choose M here: the module | ||
329 | will be called snd-ad1889. | ||
330 | |||
315 | config SND_ALS4000 | 331 | config SND_ALS4000 |
316 | tristate "Avance Logic ALS4000" | 332 | tristate "Avance Logic ALS4000" |
317 | depends on SND | 333 | depends on SND && ISA_DMA_API |
318 | select SND_OPL3_LIB | 334 | select SND_OPL3_LIB |
319 | select SND_MPU401_UART | 335 | select SND_MPU401_UART |
320 | select SND_PCM | 336 | select SND_PCM |
diff --git a/sound/pci/Makefile b/sound/pci/Makefile index b40575c3349a..42fabfcfc2a9 100644 --- a/sound/pci/Makefile +++ b/sound/pci/Makefile | |||
@@ -3,6 +3,7 @@ | |||
3 | # Copyright (c) 2001 by Jaroslav Kysela <perex@suse.cz> | 3 | # Copyright (c) 2001 by Jaroslav Kysela <perex@suse.cz> |
4 | # | 4 | # |
5 | 5 | ||
6 | snd-ad1889-objs := ad1889.o | ||
6 | snd-als4000-objs := als4000.o | 7 | snd-als4000-objs := als4000.o |
7 | snd-atiixp-objs := atiixp.o | 8 | snd-atiixp-objs := atiixp.o |
8 | snd-atiixp-modem-objs := atiixp_modem.o | 9 | snd-atiixp-modem-objs := atiixp_modem.o |
@@ -25,6 +26,7 @@ snd-via82xx-objs := via82xx.o | |||
25 | snd-via82xx-modem-objs := via82xx_modem.o | 26 | snd-via82xx-modem-objs := via82xx_modem.o |
26 | 27 | ||
27 | # Toplevel Module Dependency | 28 | # Toplevel Module Dependency |
29 | obj-$(CONFIG_SND_AD1889) += snd-ad1889.o | ||
28 | obj-$(CONFIG_SND_ALS4000) += snd-als4000.o | 30 | obj-$(CONFIG_SND_ALS4000) += snd-als4000.o |
29 | obj-$(CONFIG_SND_ATIIXP) += snd-atiixp.o | 31 | obj-$(CONFIG_SND_ATIIXP) += snd-atiixp.o |
30 | obj-$(CONFIG_SND_ATIIXP_MODEM) += snd-atiixp-modem.o | 32 | obj-$(CONFIG_SND_ATIIXP_MODEM) += snd-atiixp-modem.o |
diff --git a/sound/pci/ac97/Makefile b/sound/pci/ac97/Makefile index 3c3222122d8b..77b3482cb133 100644 --- a/sound/pci/ac97/Makefile +++ b/sound/pci/ac97/Makefile | |||
@@ -10,9 +10,11 @@ snd-ac97-codec-objs += ac97_proc.o | |||
10 | endif | 10 | endif |
11 | 11 | ||
12 | snd-ak4531-codec-objs := ak4531_codec.o | 12 | snd-ak4531-codec-objs := ak4531_codec.o |
13 | snd-ac97-bus-objs := ac97_bus.o | ||
13 | 14 | ||
14 | # Toplevel Module Dependency | 15 | # Toplevel Module Dependency |
15 | obj-$(CONFIG_SND_AC97_CODEC) += snd-ac97-codec.o | 16 | obj-$(CONFIG_SND_AC97_CODEC) += snd-ac97-codec.o |
16 | obj-$(CONFIG_SND_ENS1370) += snd-ak4531-codec.o | 17 | obj-$(CONFIG_SND_ENS1370) += snd-ak4531-codec.o |
18 | obj-$(CONFIG_SND_AC97_BUS) += snd-ac97-bus.o | ||
17 | 19 | ||
18 | obj-m := $(sort $(obj-m)) | 20 | obj-m := $(sort $(obj-m)) |
diff --git a/sound/pci/ac97/ac97_bus.c b/sound/pci/ac97/ac97_bus.c new file mode 100644 index 000000000000..ec70fadde7d9 --- /dev/null +++ b/sound/pci/ac97/ac97_bus.c | |||
@@ -0,0 +1,72 @@ | |||
1 | /* | ||
2 | * Linux driver model AC97 bus interface | ||
3 | * | ||
4 | * Author: Nicolas Pitre | ||
5 | * Created: Jan 14, 2005 | ||
6 | * Copyright: (C) MontaVista Software Inc. | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | */ | ||
13 | |||
14 | #include <linux/module.h> | ||
15 | #include <linux/init.h> | ||
16 | #include <linux/device.h> | ||
17 | #include <linux/string.h> | ||
18 | |||
19 | /* | ||
20 | * Let drivers decide whether they want to support given codec from their | ||
21 | * probe method. Drivers have direct access to the ac97_t structure and may | ||
22 | * decide based on the id field amongst other things. | ||
23 | */ | ||
24 | static int ac97_bus_match(struct device *dev, struct device_driver *drv) | ||
25 | { | ||
26 | return 1; | ||
27 | } | ||
28 | |||
29 | static int ac97_bus_suspend(struct device *dev, pm_message_t state) | ||
30 | { | ||
31 | int ret = 0; | ||
32 | |||
33 | if (dev->driver && dev->driver->suspend) | ||
34 | ret = dev->driver->suspend(dev, state); | ||
35 | |||
36 | return ret; | ||
37 | } | ||
38 | |||
39 | static int ac97_bus_resume(struct device *dev) | ||
40 | { | ||
41 | int ret = 0; | ||
42 | |||
43 | if (dev->driver && dev->driver->resume) | ||
44 | ret = dev->driver->resume(dev); | ||
45 | |||
46 | return ret; | ||
47 | } | ||
48 | |||
49 | struct bus_type ac97_bus_type = { | ||
50 | .name = "ac97", | ||
51 | .match = ac97_bus_match, | ||
52 | .suspend = ac97_bus_suspend, | ||
53 | .resume = ac97_bus_resume, | ||
54 | }; | ||
55 | |||
56 | static int __init ac97_bus_init(void) | ||
57 | { | ||
58 | return bus_register(&ac97_bus_type); | ||
59 | } | ||
60 | |||
61 | subsys_initcall(ac97_bus_init); | ||
62 | |||
63 | static void __exit ac97_bus_exit(void) | ||
64 | { | ||
65 | bus_unregister(&ac97_bus_type); | ||
66 | } | ||
67 | |||
68 | module_exit(ac97_bus_exit); | ||
69 | |||
70 | EXPORT_SYMBOL(ac97_bus_type); | ||
71 | |||
72 | MODULE_LICENSE("GPL"); | ||
diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c index 6983eea226da..41fc290149ed 100644 --- a/sound/pci/ac97/ac97_codec.c +++ b/sound/pci/ac97/ac97_codec.c | |||
@@ -112,6 +112,7 @@ static const ac97_codec_id_t snd_ac97_codec_ids[] = { | |||
112 | { 0x414c4723, 0xffffffff, "ALC650F", NULL, NULL }, /* already patched */ | 112 | { 0x414c4723, 0xffffffff, "ALC650F", NULL, NULL }, /* already patched */ |
113 | { 0x414c4720, 0xfffffff0, "ALC650", patch_alc650, NULL }, | 113 | { 0x414c4720, 0xfffffff0, "ALC650", patch_alc650, NULL }, |
114 | { 0x414c4760, 0xfffffff0, "ALC655", patch_alc655, NULL }, | 114 | { 0x414c4760, 0xfffffff0, "ALC655", patch_alc655, NULL }, |
115 | { 0x414c4781, 0xffffffff, "ALC658D", NULL, NULL }, /* already patched */ | ||
115 | { 0x414c4780, 0xfffffff0, "ALC658", patch_alc655, NULL }, | 116 | { 0x414c4780, 0xfffffff0, "ALC658", patch_alc655, NULL }, |
116 | { 0x414c4790, 0xfffffff0, "ALC850", patch_alc850, NULL }, | 117 | { 0x414c4790, 0xfffffff0, "ALC850", patch_alc850, NULL }, |
117 | { 0x414c4730, 0xffffffff, "ALC101", NULL, NULL }, | 118 | { 0x414c4730, 0xffffffff, "ALC101", NULL, NULL }, |
@@ -157,6 +158,7 @@ static const ac97_codec_id_t snd_ac97_codec_ids[] = { | |||
157 | { 0x54524123, 0xffffffff, "TR28602", NULL, NULL }, // only guess --jk [TR28023 = eMicro EM28023 (new CT1297)] | 158 | { 0x54524123, 0xffffffff, "TR28602", NULL, NULL }, // only guess --jk [TR28023 = eMicro EM28023 (new CT1297)] |
158 | { 0x54584e20, 0xffffffff, "TLC320AD9xC", NULL, NULL }, | 159 | { 0x54584e20, 0xffffffff, "TLC320AD9xC", NULL, NULL }, |
159 | { 0x56494161, 0xffffffff, "VIA1612A", NULL, NULL }, // modified ICE1232 with S/PDIF | 160 | { 0x56494161, 0xffffffff, "VIA1612A", NULL, NULL }, // modified ICE1232 with S/PDIF |
161 | { 0x56494170, 0xffffffff, "VIA1617A", patch_vt1617a, NULL }, // modified VT1616 with S/PDIF | ||
160 | { 0x57454301, 0xffffffff, "W83971D", NULL, NULL }, | 162 | { 0x57454301, 0xffffffff, "W83971D", NULL, NULL }, |
161 | { 0x574d4c00, 0xffffffff, "WM9701A", NULL, NULL }, | 163 | { 0x574d4c00, 0xffffffff, "WM9701A", NULL, NULL }, |
162 | { 0x574d4C03, 0xffffffff, "WM9703,WM9707,WM9708,WM9717", patch_wolfson03, NULL}, | 164 | { 0x574d4C03, 0xffffffff, "WM9703,WM9707,WM9708,WM9717", patch_wolfson03, NULL}, |
@@ -1307,16 +1309,18 @@ static int snd_ac97_mixer_build(ac97_t * ac97) | |||
1307 | } | 1309 | } |
1308 | 1310 | ||
1309 | /* build master tone controls */ | 1311 | /* build master tone controls */ |
1310 | if (snd_ac97_try_volume_mix(ac97, AC97_MASTER_TONE)) { | 1312 | if (!(ac97->flags & AC97_HAS_NO_TONE)) { |
1311 | for (idx = 0; idx < 2; idx++) { | 1313 | if (snd_ac97_try_volume_mix(ac97, AC97_MASTER_TONE)) { |
1312 | if ((err = snd_ctl_add(card, kctl = snd_ac97_cnew(&snd_ac97_controls_tone[idx], ac97))) < 0) | 1314 | for (idx = 0; idx < 2; idx++) { |
1313 | return err; | 1315 | if ((err = snd_ctl_add(card, kctl = snd_ac97_cnew(&snd_ac97_controls_tone[idx], ac97))) < 0) |
1314 | if (ac97->id == AC97_ID_YMF753) { | 1316 | return err; |
1315 | kctl->private_value &= ~(0xff << 16); | 1317 | if (ac97->id == AC97_ID_YMF753) { |
1316 | kctl->private_value |= 7 << 16; | 1318 | kctl->private_value &= ~(0xff << 16); |
1319 | kctl->private_value |= 7 << 16; | ||
1320 | } | ||
1317 | } | 1321 | } |
1322 | snd_ac97_write_cache(ac97, AC97_MASTER_TONE, 0x0f0f); | ||
1318 | } | 1323 | } |
1319 | snd_ac97_write_cache(ac97, AC97_MASTER_TONE, 0x0f0f); | ||
1320 | } | 1324 | } |
1321 | 1325 | ||
1322 | /* build PC Speaker controls */ | 1326 | /* build PC Speaker controls */ |
@@ -1339,11 +1343,13 @@ static int snd_ac97_mixer_build(ac97_t * ac97) | |||
1339 | } | 1343 | } |
1340 | 1344 | ||
1341 | /* build MIC controls */ | 1345 | /* build MIC controls */ |
1342 | if (snd_ac97_try_volume_mix(ac97, AC97_MIC)) { | 1346 | if (!(ac97->flags & AC97_HAS_NO_MIC)) { |
1343 | if ((err = snd_ac97_cmix_new(card, "Mic Playback", AC97_MIC, ac97)) < 0) | 1347 | if (snd_ac97_try_volume_mix(ac97, AC97_MIC)) { |
1344 | return err; | 1348 | if ((err = snd_ac97_cmix_new(card, "Mic Playback", AC97_MIC, ac97)) < 0) |
1345 | if ((err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_mic_boost, ac97))) < 0) | 1349 | return err; |
1346 | return err; | 1350 | if ((err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_mic_boost, ac97))) < 0) |
1351 | return err; | ||
1352 | } | ||
1347 | } | 1353 | } |
1348 | 1354 | ||
1349 | /* build Line controls */ | 1355 | /* build Line controls */ |
@@ -1402,12 +1408,14 @@ static int snd_ac97_mixer_build(ac97_t * ac97) | |||
1402 | } | 1408 | } |
1403 | snd_ac97_write_cache(ac97, AC97_PCM, init_val); | 1409 | snd_ac97_write_cache(ac97, AC97_PCM, init_val); |
1404 | } else { | 1410 | } else { |
1405 | if (ac97->flags & AC97_HAS_NO_PCM_VOL) | 1411 | if (!(ac97->flags & AC97_HAS_NO_STD_PCM)) { |
1406 | err = snd_ac97_cmute_new(card, "PCM Playback Switch", AC97_PCM, ac97); | 1412 | if (ac97->flags & AC97_HAS_NO_PCM_VOL) |
1407 | else | 1413 | err = snd_ac97_cmute_new(card, "PCM Playback Switch", AC97_PCM, ac97); |
1408 | err = snd_ac97_cmix_new(card, "PCM Playback", AC97_PCM, ac97); | 1414 | else |
1409 | if (err < 0) | 1415 | err = snd_ac97_cmix_new(card, "PCM Playback", AC97_PCM, ac97); |
1410 | return err; | 1416 | if (err < 0) |
1417 | return err; | ||
1418 | } | ||
1411 | } | 1419 | } |
1412 | 1420 | ||
1413 | /* build Capture controls */ | 1421 | /* build Capture controls */ |
@@ -1549,7 +1557,7 @@ static int snd_ac97_modem_build(snd_card_t * card, ac97_t * ac97) | |||
1549 | 1557 | ||
1550 | /* build modem switches */ | 1558 | /* build modem switches */ |
1551 | for (idx = 0; idx < ARRAY_SIZE(snd_ac97_controls_modem_switches); idx++) | 1559 | for (idx = 0; idx < ARRAY_SIZE(snd_ac97_controls_modem_switches); idx++) |
1552 | if ((err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_modem_switches[idx], ac97))) < 0) | 1560 | if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_ac97_controls_modem_switches[idx], ac97))) < 0) |
1553 | return err; | 1561 | return err; |
1554 | 1562 | ||
1555 | /* build chip specific controls */ | 1563 | /* build chip specific controls */ |
@@ -1789,7 +1797,7 @@ int snd_ac97_bus(snd_card_t *card, int num, ac97_bus_ops_t *ops, | |||
1789 | 1797 | ||
1790 | snd_assert(card != NULL, return -EINVAL); | 1798 | snd_assert(card != NULL, return -EINVAL); |
1791 | snd_assert(rbus != NULL, return -EINVAL); | 1799 | snd_assert(rbus != NULL, return -EINVAL); |
1792 | bus = kcalloc(1, sizeof(*bus), GFP_KERNEL); | 1800 | bus = kzalloc(sizeof(*bus), GFP_KERNEL); |
1793 | if (bus == NULL) | 1801 | if (bus == NULL) |
1794 | return -ENOMEM; | 1802 | return -ENOMEM; |
1795 | bus->card = card; | 1803 | bus->card = card; |
@@ -1807,6 +1815,38 @@ int snd_ac97_bus(snd_card_t *card, int num, ac97_bus_ops_t *ops, | |||
1807 | return 0; | 1815 | return 0; |
1808 | } | 1816 | } |
1809 | 1817 | ||
1818 | /* stop no dev release warning */ | ||
1819 | static void ac97_device_release(struct device * dev) | ||
1820 | { | ||
1821 | } | ||
1822 | |||
1823 | /* register ac97 codec to bus */ | ||
1824 | static int snd_ac97_dev_register(snd_device_t *device) | ||
1825 | { | ||
1826 | ac97_t *ac97 = device->device_data; | ||
1827 | int err; | ||
1828 | |||
1829 | ac97->dev.bus = &ac97_bus_type; | ||
1830 | ac97->dev.parent = ac97->bus->card->dev; | ||
1831 | ac97->dev.release = ac97_device_release; | ||
1832 | snprintf(ac97->dev.bus_id, BUS_ID_SIZE, "card%d-%d", ac97->bus->card->number, ac97->num); | ||
1833 | if ((err = device_register(&ac97->dev)) < 0) { | ||
1834 | snd_printk(KERN_ERR "Can't register ac97 bus\n"); | ||
1835 | ac97->dev.bus = NULL; | ||
1836 | return err; | ||
1837 | } | ||
1838 | return 0; | ||
1839 | } | ||
1840 | |||
1841 | /* unregister ac97 codec */ | ||
1842 | static int snd_ac97_dev_unregister(snd_device_t *device) | ||
1843 | { | ||
1844 | ac97_t *ac97 = device->device_data; | ||
1845 | if (ac97->dev.bus) | ||
1846 | device_unregister(&ac97->dev); | ||
1847 | return snd_ac97_free(ac97); | ||
1848 | } | ||
1849 | |||
1810 | /* build_ops to do nothing */ | 1850 | /* build_ops to do nothing */ |
1811 | static struct snd_ac97_build_ops null_build_ops; | 1851 | static struct snd_ac97_build_ops null_build_ops; |
1812 | 1852 | ||
@@ -1840,6 +1880,8 @@ int snd_ac97_mixer(ac97_bus_t *bus, ac97_template_t *template, ac97_t **rac97) | |||
1840 | const ac97_codec_id_t *pid; | 1880 | const ac97_codec_id_t *pid; |
1841 | static snd_device_ops_t ops = { | 1881 | static snd_device_ops_t ops = { |
1842 | .dev_free = snd_ac97_dev_free, | 1882 | .dev_free = snd_ac97_dev_free, |
1883 | .dev_register = snd_ac97_dev_register, | ||
1884 | .dev_unregister = snd_ac97_dev_unregister, | ||
1843 | }; | 1885 | }; |
1844 | 1886 | ||
1845 | snd_assert(rac97 != NULL, return -EINVAL); | 1887 | snd_assert(rac97 != NULL, return -EINVAL); |
@@ -1863,7 +1905,7 @@ int snd_ac97_mixer(ac97_bus_t *bus, ac97_template_t *template, ac97_t **rac97) | |||
1863 | } | 1905 | } |
1864 | 1906 | ||
1865 | card = bus->card; | 1907 | card = bus->card; |
1866 | ac97 = kcalloc(1, sizeof(*ac97), GFP_KERNEL); | 1908 | ac97 = kzalloc(sizeof(*ac97), GFP_KERNEL); |
1867 | if (ac97 == NULL) | 1909 | if (ac97 == NULL) |
1868 | return -ENOMEM; | 1910 | return -ENOMEM; |
1869 | ac97->private_data = template->private_data; | 1911 | ac97->private_data = template->private_data; |
@@ -2539,8 +2581,6 @@ int snd_ac97_tune_hardware(ac97_t *ac97, struct ac97_quirk *quirk, const char *o | |||
2539 | { | 2581 | { |
2540 | int result; | 2582 | int result; |
2541 | 2583 | ||
2542 | snd_assert(quirk, return -EINVAL); | ||
2543 | |||
2544 | /* quirk overriden? */ | 2584 | /* quirk overriden? */ |
2545 | if (override && strcmp(override, "-1") && strcmp(override, "default")) { | 2585 | if (override && strcmp(override, "-1") && strcmp(override, "default")) { |
2546 | result = apply_quirk_str(ac97, override); | 2586 | result = apply_quirk_str(ac97, override); |
@@ -2549,6 +2589,9 @@ int snd_ac97_tune_hardware(ac97_t *ac97, struct ac97_quirk *quirk, const char *o | |||
2549 | return result; | 2589 | return result; |
2550 | } | 2590 | } |
2551 | 2591 | ||
2592 | if (! quirk) | ||
2593 | return -EINVAL; | ||
2594 | |||
2552 | for (; quirk->subvendor; quirk++) { | 2595 | for (; quirk->subvendor; quirk++) { |
2553 | if (quirk->subvendor != ac97->subsystem_vendor) | 2596 | if (quirk->subvendor != ac97->subsystem_vendor) |
2554 | continue; | 2597 | continue; |
diff --git a/sound/pci/ac97/ac97_id.h b/sound/pci/ac97/ac97_id.h index dadf387ad0b8..6d73514dc49e 100644 --- a/sound/pci/ac97/ac97_id.h +++ b/sound/pci/ac97/ac97_id.h | |||
@@ -52,6 +52,7 @@ | |||
52 | #define AC97_ID_ALC650F 0x414c4723 | 52 | #define AC97_ID_ALC650F 0x414c4723 |
53 | #define AC97_ID_ALC655 0x414c4760 | 53 | #define AC97_ID_ALC655 0x414c4760 |
54 | #define AC97_ID_ALC658 0x414c4780 | 54 | #define AC97_ID_ALC658 0x414c4780 |
55 | #define AC97_ID_ALC658D 0x414c4781 | ||
55 | #define AC97_ID_ALC850 0x414c4790 | 56 | #define AC97_ID_ALC850 0x414c4790 |
56 | #define AC97_ID_YMF753 0x594d4803 | 57 | #define AC97_ID_YMF753 0x594d4803 |
57 | #define AC97_ID_VT1616 0x49434551 | 58 | #define AC97_ID_VT1616 0x49434551 |
diff --git a/sound/pci/ac97/ac97_patch.c b/sound/pci/ac97/ac97_patch.c index 66edc857d3e6..0238cc65d32a 100644 --- a/sound/pci/ac97/ac97_patch.c +++ b/sound/pci/ac97/ac97_patch.c | |||
@@ -370,141 +370,387 @@ int patch_yamaha_ymf753(ac97_t * ac97) | |||
370 | * added support for WM9705,WM9708,WM9709,WM9710,WM9711,WM9712 and WM9717. | 370 | * added support for WM9705,WM9708,WM9709,WM9710,WM9711,WM9712 and WM9717. |
371 | */ | 371 | */ |
372 | 372 | ||
373 | int patch_wolfson03(ac97_t * ac97) | 373 | static const snd_kcontrol_new_t wm97xx_snd_ac97_controls[] = { |
374 | AC97_DOUBLE("Front Playback Volume", AC97_WM97XX_FMIXER_VOL, 8, 0, 31, 1), | ||
375 | AC97_SINGLE("Front Playback Switch", AC97_WM97XX_FMIXER_VOL, 15, 1, 1), | ||
376 | }; | ||
377 | |||
378 | static int patch_wolfson_wm9703_specific(ac97_t * ac97) | ||
374 | { | 379 | { |
375 | /* This is known to work for the ViewSonic ViewPad 1000 | 380 | /* This is known to work for the ViewSonic ViewPad 1000 |
376 | Randolph Bentson <bentson@holmsjoen.com> */ | 381 | * Randolph Bentson <bentson@holmsjoen.com> |
382 | * WM9703/9707/9708/9717 | ||
383 | */ | ||
384 | int err, i; | ||
385 | |||
386 | for (i = 0; i < ARRAY_SIZE(wm97xx_snd_ac97_controls); i++) { | ||
387 | if ((err = snd_ctl_add(ac97->bus->card, snd_ac97_cnew(&wm97xx_snd_ac97_controls[i], ac97))) < 0) | ||
388 | return err; | ||
389 | } | ||
390 | snd_ac97_write_cache(ac97, AC97_WM97XX_FMIXER_VOL, 0x0808); | ||
391 | return 0; | ||
392 | } | ||
393 | |||
394 | static struct snd_ac97_build_ops patch_wolfson_wm9703_ops = { | ||
395 | .build_specific = patch_wolfson_wm9703_specific, | ||
396 | }; | ||
377 | 397 | ||
378 | // WM9703/9707/9708/9717 | 398 | int patch_wolfson03(ac97_t * ac97) |
379 | snd_ac97_write_cache(ac97, AC97_WM97XX_FMIXER_VOL, 0x0808); | 399 | { |
380 | snd_ac97_write_cache(ac97, AC97_GENERAL_PURPOSE, 0x8000); | 400 | ac97->build_ops = &patch_wolfson_wm9703_ops; |
381 | return 0; | 401 | return 0; |
382 | } | 402 | } |
383 | 403 | ||
384 | int patch_wolfson04(ac97_t * ac97) | 404 | static const snd_kcontrol_new_t wm9704_snd_ac97_controls[] = { |
405 | AC97_DOUBLE("Front Playback Volume", AC97_WM97XX_FMIXER_VOL, 8, 0, 31, 1), | ||
406 | AC97_SINGLE("Front Playback Switch", AC97_WM97XX_FMIXER_VOL, 15, 1, 1), | ||
407 | AC97_DOUBLE("Rear Playback Volume", AC97_WM9704_RMIXER_VOL, 8, 0, 31, 1), | ||
408 | AC97_SINGLE("Rear Playback Switch", AC97_WM9704_RMIXER_VOL, 15, 1, 1), | ||
409 | AC97_DOUBLE("Rear DAC Volume", AC97_WM9704_RPCM_VOL, 8, 0, 31, 1), | ||
410 | AC97_DOUBLE("Surround Volume", AC97_SURROUND_MASTER, 8, 0, 31, 1), | ||
411 | }; | ||
412 | |||
413 | static int patch_wolfson_wm9704_specific(ac97_t * ac97) | ||
385 | { | 414 | { |
386 | // WM9704M/9704Q | 415 | int err, i; |
387 | // set front and rear mixer volume | 416 | for (i = 0; i < ARRAY_SIZE(wm9704_snd_ac97_controls); i++) { |
388 | snd_ac97_write_cache(ac97, AC97_WM97XX_FMIXER_VOL, 0x0808); | 417 | if ((err = snd_ctl_add(ac97->bus->card, snd_ac97_cnew(&wm9704_snd_ac97_controls[i], ac97))) < 0) |
389 | snd_ac97_write_cache(ac97, AC97_WM9704_RMIXER_VOL, 0x0808); | 418 | return err; |
390 | 419 | } | |
391 | // patch for DVD noise | 420 | /* patch for DVD noise */ |
392 | snd_ac97_write_cache(ac97, AC97_WM9704_TEST, 0x0200); | 421 | snd_ac97_write_cache(ac97, AC97_WM9704_TEST, 0x0200); |
393 | |||
394 | // init vol | ||
395 | snd_ac97_write_cache(ac97, AC97_WM9704_RPCM_VOL, 0x0808); | ||
396 | |||
397 | // set rear surround volume | ||
398 | snd_ac97_write_cache(ac97, AC97_SURROUND_MASTER, 0x0000); | ||
399 | return 0; | 422 | return 0; |
400 | } | 423 | } |
401 | 424 | ||
425 | static struct snd_ac97_build_ops patch_wolfson_wm9704_ops = { | ||
426 | .build_specific = patch_wolfson_wm9704_specific, | ||
427 | }; | ||
428 | |||
429 | int patch_wolfson04(ac97_t * ac97) | ||
430 | { | ||
431 | /* WM9704M/9704Q */ | ||
432 | ac97->build_ops = &patch_wolfson_wm9704_ops; | ||
433 | return 0; | ||
434 | } | ||
435 | |||
436 | static int patch_wolfson_wm9705_specific(ac97_t * ac97) | ||
437 | { | ||
438 | int err, i; | ||
439 | for (i = 0; i < ARRAY_SIZE(wm97xx_snd_ac97_controls); i++) { | ||
440 | if ((err = snd_ctl_add(ac97->bus->card, snd_ac97_cnew(&wm97xx_snd_ac97_controls[i], ac97))) < 0) | ||
441 | return err; | ||
442 | } | ||
443 | snd_ac97_write_cache(ac97, 0x72, 0x0808); | ||
444 | return 0; | ||
445 | } | ||
446 | |||
447 | static struct snd_ac97_build_ops patch_wolfson_wm9705_ops = { | ||
448 | .build_specific = patch_wolfson_wm9705_specific, | ||
449 | }; | ||
450 | |||
402 | int patch_wolfson05(ac97_t * ac97) | 451 | int patch_wolfson05(ac97_t * ac97) |
403 | { | 452 | { |
404 | // WM9705, WM9710 | 453 | /* WM9705, WM9710 */ |
405 | // set front mixer volume | 454 | ac97->build_ops = &patch_wolfson_wm9705_ops; |
406 | snd_ac97_write_cache(ac97, AC97_WM97XX_FMIXER_VOL, 0x0808); | 455 | return 0; |
456 | } | ||
457 | |||
458 | static const char* wm9711_alc_select[] = {"None", "Left", "Right", "Stereo"}; | ||
459 | static const char* wm9711_alc_mix[] = {"Stereo", "Right", "Left", "None"}; | ||
460 | static const char* wm9711_out3_src[] = {"Left", "VREF", "Left + Right", "Mono"}; | ||
461 | static const char* wm9711_out3_lrsrc[] = {"Master Mix", "Headphone Mix"}; | ||
462 | static const char* wm9711_rec_adc[] = {"Stereo", "Left", "Right", "Mute"}; | ||
463 | static const char* wm9711_base[] = {"Linear Control", "Adaptive Boost"}; | ||
464 | static const char* wm9711_rec_gain[] = {"+1.5dB Steps", "+0.75dB Steps"}; | ||
465 | static const char* wm9711_mic[] = {"Mic 1", "Differential", "Mic 2", "Stereo"}; | ||
466 | static const char* wm9711_rec_sel[] = | ||
467 | {"Mic 1", "NC", "NC", "Master Mix", "Line", "Headphone Mix", "Phone Mix", "Phone"}; | ||
468 | static const char* wm9711_ng_type[] = {"Constant Gain", "Mute"}; | ||
469 | |||
470 | static const struct ac97_enum wm9711_enum[] = { | ||
471 | AC97_ENUM_SINGLE(AC97_PCI_SVID, 14, 4, wm9711_alc_select), | ||
472 | AC97_ENUM_SINGLE(AC97_VIDEO, 10, 4, wm9711_alc_mix), | ||
473 | AC97_ENUM_SINGLE(AC97_AUX, 9, 4, wm9711_out3_src), | ||
474 | AC97_ENUM_SINGLE(AC97_AUX, 8, 2, wm9711_out3_lrsrc), | ||
475 | AC97_ENUM_SINGLE(AC97_REC_SEL, 12, 4, wm9711_rec_adc), | ||
476 | AC97_ENUM_SINGLE(AC97_MASTER_TONE, 15, 2, wm9711_base), | ||
477 | AC97_ENUM_DOUBLE(AC97_REC_GAIN, 14, 6, 2, wm9711_rec_gain), | ||
478 | AC97_ENUM_SINGLE(AC97_MIC, 5, 4, wm9711_mic), | ||
479 | AC97_ENUM_DOUBLE(AC97_REC_SEL, 8, 0, 8, wm9711_rec_sel), | ||
480 | AC97_ENUM_SINGLE(AC97_PCI_SVID, 5, 2, wm9711_ng_type), | ||
481 | }; | ||
482 | |||
483 | static const snd_kcontrol_new_t wm9711_snd_ac97_controls[] = { | ||
484 | AC97_SINGLE("ALC Target Volume", AC97_CODEC_CLASS_REV, 12, 15, 0), | ||
485 | AC97_SINGLE("ALC Hold Time", AC97_CODEC_CLASS_REV, 8, 15, 0), | ||
486 | AC97_SINGLE("ALC Decay Time", AC97_CODEC_CLASS_REV, 4, 15, 0), | ||
487 | AC97_SINGLE("ALC Attack Time", AC97_CODEC_CLASS_REV, 0, 15, 0), | ||
488 | AC97_ENUM("ALC Function", wm9711_enum[0]), | ||
489 | AC97_SINGLE("ALC Max Volume", AC97_PCI_SVID, 11, 7, 1), | ||
490 | AC97_SINGLE("ALC ZC Timeout", AC97_PCI_SVID, 9, 3, 1), | ||
491 | AC97_SINGLE("ALC ZC Switch", AC97_PCI_SVID, 8, 1, 0), | ||
492 | AC97_SINGLE("ALC NG Switch", AC97_PCI_SVID, 7, 1, 0), | ||
493 | AC97_ENUM("ALC NG Type", wm9711_enum[9]), | ||
494 | AC97_SINGLE("ALC NG Threshold", AC97_PCI_SVID, 0, 31, 1), | ||
495 | |||
496 | AC97_SINGLE("Side Tone Switch", AC97_VIDEO, 15, 1, 1), | ||
497 | AC97_SINGLE("Side Tone Volume", AC97_VIDEO, 12, 7, 1), | ||
498 | AC97_ENUM("ALC Headphone Mux", wm9711_enum[1]), | ||
499 | AC97_SINGLE("ALC Headphone Volume", AC97_VIDEO, 7, 7, 1), | ||
500 | |||
501 | AC97_SINGLE("Out3 Switch", AC97_AUX, 15, 1, 1), | ||
502 | AC97_SINGLE("Out3 ZC Switch", AC97_AUX, 7, 1, 1), | ||
503 | AC97_ENUM("Out3 Mux", wm9711_enum[2]), | ||
504 | AC97_ENUM("Out3 LR Mux", wm9711_enum[3]), | ||
505 | AC97_SINGLE("Out3 Volume", AC97_AUX, 0, 31, 1), | ||
506 | |||
507 | AC97_SINGLE("Beep to Headphone Switch", AC97_PC_BEEP, 15, 1, 1), | ||
508 | AC97_SINGLE("Beep to Headphone Volume", AC97_PC_BEEP, 12, 7, 1), | ||
509 | AC97_SINGLE("Beep to Side Tone Switch", AC97_PC_BEEP, 11, 1, 1), | ||
510 | AC97_SINGLE("Beep to Side Tone Volume", AC97_PC_BEEP, 8, 7, 1), | ||
511 | AC97_SINGLE("Beep to Phone Switch", AC97_PC_BEEP, 7, 1, 1), | ||
512 | AC97_SINGLE("Beep to Phone Volume", AC97_PC_BEEP, 4, 7, 1), | ||
513 | |||
514 | AC97_SINGLE("Aux to Headphone Switch", AC97_CD, 15, 1, 1), | ||
515 | AC97_SINGLE("Aux to Headphone Volume", AC97_CD, 12, 7, 1), | ||
516 | AC97_SINGLE("Aux to Side Tone Switch", AC97_CD, 11, 1, 1), | ||
517 | AC97_SINGLE("Aux to Side Tone Volume", AC97_CD, 8, 7, 1), | ||
518 | AC97_SINGLE("Aux to Phone Switch", AC97_CD, 7, 1, 1), | ||
519 | AC97_SINGLE("Aux to Phone Volume", AC97_CD, 4, 7, 1), | ||
520 | |||
521 | AC97_SINGLE("Phone to Headphone Switch", AC97_PHONE, 15, 1, 1), | ||
522 | AC97_SINGLE("Phone to Master Switch", AC97_PHONE, 14, 1, 1), | ||
523 | |||
524 | AC97_SINGLE("Line to Headphone Switch", AC97_LINE, 15, 1, 1), | ||
525 | AC97_SINGLE("Line to Master Switch", AC97_LINE, 14, 1, 1), | ||
526 | AC97_SINGLE("Line to Phone Switch", AC97_LINE, 13, 1, 1), | ||
527 | |||
528 | AC97_SINGLE("PCM Playback to Headphone Switch", AC97_PCM, 15, 1, 1), | ||
529 | AC97_SINGLE("PCM Playback to Master Switch", AC97_PCM, 14, 1, 1), | ||
530 | AC97_SINGLE("PCM Playback to Phone Switch", AC97_PCM, 13, 1, 1), | ||
531 | |||
532 | AC97_SINGLE("Capture 20dB Boost Switch", AC97_REC_SEL, 14, 1, 0), | ||
533 | AC97_ENUM("Capture to Phone Mux", wm9711_enum[4]), | ||
534 | AC97_SINGLE("Capture to Phone 20dB Boost Switch", AC97_REC_SEL, 11, 1, 1), | ||
535 | AC97_ENUM("Capture Select", wm9711_enum[8]), | ||
536 | |||
537 | AC97_SINGLE("3D Upper Cut-off Switch", AC97_3D_CONTROL, 5, 1, 1), | ||
538 | AC97_SINGLE("3D Lower Cut-off Switch", AC97_3D_CONTROL, 4, 1, 1), | ||
539 | |||
540 | AC97_ENUM("Bass Control", wm9711_enum[5]), | ||
541 | AC97_SINGLE("Bass Cut-off Switch", AC97_MASTER_TONE, 12, 1, 1), | ||
542 | AC97_SINGLE("Tone Cut-off Switch", AC97_MASTER_TONE, 4, 1, 1), | ||
543 | AC97_SINGLE("Playback Attenuate (-6dB) Switch", AC97_MASTER_TONE, 6, 1, 0), | ||
544 | |||
545 | AC97_SINGLE("ADC Switch", AC97_REC_GAIN, 15, 1, 1), | ||
546 | AC97_ENUM("Capture Volume Steps", wm9711_enum[6]), | ||
547 | AC97_DOUBLE("Capture Volume", AC97_REC_GAIN, 8, 0, 15, 1), | ||
548 | AC97_SINGLE("Capture ZC Switch", AC97_REC_GAIN, 7, 1, 0), | ||
549 | |||
550 | AC97_SINGLE("Mic 1 to Phone Switch", AC97_MIC, 14, 1, 1), | ||
551 | AC97_SINGLE("Mic 2 to Phone Switch", AC97_MIC, 13, 1, 1), | ||
552 | AC97_ENUM("Mic Select Source", wm9711_enum[7]), | ||
553 | AC97_SINGLE("Mic 1 Volume", AC97_MIC, 8, 32, 1), | ||
554 | AC97_SINGLE("Mic 20dB Boost Switch", AC97_MIC, 7, 1, 0), | ||
555 | |||
556 | AC97_SINGLE("Master ZC Switch", AC97_MASTER, 7, 1, 0), | ||
557 | AC97_SINGLE("Headphone ZC Switch", AC97_HEADPHONE, 7, 1, 0), | ||
558 | AC97_SINGLE("Mono ZC Switch", AC97_MASTER_MONO, 7, 1, 0), | ||
559 | }; | ||
560 | |||
561 | static int patch_wolfson_wm9711_specific(ac97_t * ac97) | ||
562 | { | ||
563 | int err, i; | ||
564 | |||
565 | for (i = 0; i < ARRAY_SIZE(wm9711_snd_ac97_controls); i++) { | ||
566 | if ((err = snd_ctl_add(ac97->bus->card, snd_ac97_cnew(&wm9711_snd_ac97_controls[i], ac97))) < 0) | ||
567 | return err; | ||
568 | } | ||
569 | snd_ac97_write_cache(ac97, AC97_CODEC_CLASS_REV, 0x0808); | ||
570 | snd_ac97_write_cache(ac97, AC97_PCI_SVID, 0x0808); | ||
571 | snd_ac97_write_cache(ac97, AC97_VIDEO, 0x0808); | ||
572 | snd_ac97_write_cache(ac97, AC97_AUX, 0x0808); | ||
573 | snd_ac97_write_cache(ac97, AC97_PC_BEEP, 0x0808); | ||
574 | snd_ac97_write_cache(ac97, AC97_CD, 0x0000); | ||
407 | return 0; | 575 | return 0; |
408 | } | 576 | } |
409 | 577 | ||
578 | static struct snd_ac97_build_ops patch_wolfson_wm9711_ops = { | ||
579 | .build_specific = patch_wolfson_wm9711_specific, | ||
580 | }; | ||
581 | |||
410 | int patch_wolfson11(ac97_t * ac97) | 582 | int patch_wolfson11(ac97_t * ac97) |
411 | { | 583 | { |
412 | // WM9711, WM9712 | 584 | /* WM9711, WM9712 */ |
413 | // set out3 volume | 585 | ac97->build_ops = &patch_wolfson_wm9711_ops; |
414 | snd_ac97_write_cache(ac97, AC97_WM9711_OUT3VOL, 0x0808); | 586 | |
587 | ac97->flags |= AC97_HAS_NO_REC_GAIN | AC97_STEREO_MUTES | AC97_HAS_NO_MIC | | ||
588 | AC97_HAS_NO_PC_BEEP | AC97_HAS_NO_VIDEO | AC97_HAS_NO_CD; | ||
589 | |||
415 | return 0; | 590 | return 0; |
416 | } | 591 | } |
417 | 592 | ||
418 | static const char* wm9713_mic_mixer[] = {"Stereo", "Mic1", "Mic2", "Mute"}; | 593 | static const char* wm9713_mic_mixer[] = {"Stereo", "Mic 1", "Mic 2", "Mute"}; |
419 | static const char* wm9713_rec_mux[] = {"Stereo", "Left", "Right", "Mute"}; | 594 | static const char* wm9713_rec_mux[] = {"Stereo", "Left", "Right", "Mute"}; |
420 | static const char* wm9713_rec_src_l[] = {"Mic1", "Mic2", "Line L", "Mono In", "HP Mix L", "Spk Mix", "Mono Mix", "Zh"}; | 595 | static const char* wm9713_rec_src[] = |
421 | static const char* wm9713_rec_src_r[] = {"Mic1", "Mic2", "Line R", "Mono In", "HP Mix R", "Spk Mix", "Mono Mix", "Zh"}; | 596 | {"Mic 1", "Mic 2", "Line", "Mono In", "Headphone Mix", "Master Mix", |
597 | "Mono Mix", "Zh"}; | ||
598 | static const char* wm9713_rec_gain[] = {"+1.5dB Steps", "+0.75dB Steps"}; | ||
599 | static const char* wm9713_alc_select[] = {"None", "Left", "Right", "Stereo"}; | ||
600 | static const char* wm9713_mono_pga[] = {"Vmid", "Zh", "Mono Mix", "Inv 1"}; | ||
601 | static const char* wm9713_spk_pga[] = | ||
602 | {"Vmid", "Zh", "Headphone Mix", "Master Mix", "Inv", "NC", "NC", "NC"}; | ||
603 | static const char* wm9713_hp_pga[] = {"Vmid", "Zh", "Headphone Mix", "NC"}; | ||
604 | static const char* wm9713_out3_pga[] = {"Vmid", "Zh", "Inv 1", "NC"}; | ||
605 | static const char* wm9713_out4_pga[] = {"Vmid", "Zh", "Inv 2", "NC"}; | ||
606 | static const char* wm9713_dac_inv[] = | ||
607 | {"Off", "Mono Mix", "Master Mix", "Headphone Mix L", "Headphone Mix R", | ||
608 | "Headphone Mix Mono", "NC", "Vmid"}; | ||
609 | static const char* wm9713_base[] = {"Linear Control", "Adaptive Boost"}; | ||
610 | static const char* wm9713_ng_type[] = {"Constant Gain", "Mute"}; | ||
422 | 611 | ||
423 | static const struct ac97_enum wm9713_enum[] = { | 612 | static const struct ac97_enum wm9713_enum[] = { |
424 | AC97_ENUM_SINGLE(AC97_LINE, 3, 4, wm9713_mic_mixer), | 613 | AC97_ENUM_SINGLE(AC97_LINE, 3, 4, wm9713_mic_mixer), |
425 | AC97_ENUM_SINGLE(AC97_VIDEO, 14, 4, wm9713_rec_mux), | 614 | AC97_ENUM_SINGLE(AC97_VIDEO, 14, 4, wm9713_rec_mux), |
426 | AC97_ENUM_SINGLE(AC97_VIDEO, 9, 4, wm9713_rec_mux), | 615 | AC97_ENUM_SINGLE(AC97_VIDEO, 9, 4, wm9713_rec_mux), |
427 | AC97_ENUM_SINGLE(AC97_VIDEO, 3, 8, wm9713_rec_src_l), | 616 | AC97_ENUM_DOUBLE(AC97_VIDEO, 3, 0, 8, wm9713_rec_src), |
428 | AC97_ENUM_SINGLE(AC97_VIDEO, 0, 8, wm9713_rec_src_r), | 617 | AC97_ENUM_DOUBLE(AC97_CD, 14, 6, 2, wm9713_rec_gain), |
618 | AC97_ENUM_SINGLE(AC97_PCI_SVID, 14, 4, wm9713_alc_select), | ||
619 | AC97_ENUM_SINGLE(AC97_REC_GAIN, 14, 4, wm9713_mono_pga), | ||
620 | AC97_ENUM_DOUBLE(AC97_REC_GAIN, 11, 8, 8, wm9713_spk_pga), | ||
621 | AC97_ENUM_DOUBLE(AC97_REC_GAIN, 6, 4, 4, wm9713_hp_pga), | ||
622 | AC97_ENUM_SINGLE(AC97_REC_GAIN, 2, 4, wm9713_out3_pga), | ||
623 | AC97_ENUM_SINGLE(AC97_REC_GAIN, 0, 4, wm9713_out4_pga), | ||
624 | AC97_ENUM_DOUBLE(AC97_REC_GAIN_MIC, 13, 10, 8, wm9713_dac_inv), | ||
625 | AC97_ENUM_SINGLE(AC97_GENERAL_PURPOSE, 15, 2, wm9713_base), | ||
626 | AC97_ENUM_SINGLE(AC97_PCI_SVID, 5, 2, wm9713_ng_type), | ||
429 | }; | 627 | }; |
430 | 628 | ||
431 | static const snd_kcontrol_new_t wm13_snd_ac97_controls_line_in[] = { | 629 | static const snd_kcontrol_new_t wm13_snd_ac97_controls[] = { |
432 | AC97_DOUBLE("Line In Volume", AC97_PC_BEEP, 8, 0, 31, 1), | 630 | AC97_DOUBLE("Line In Volume", AC97_PC_BEEP, 8, 0, 31, 1), |
433 | AC97_SINGLE("Line In to Headphone Mute", AC97_PC_BEEP, 15, 1, 1), | 631 | AC97_SINGLE("Line In to Headphone Switch", AC97_PC_BEEP, 15, 1, 1), |
434 | AC97_SINGLE("Line In to Speaker Mute", AC97_PC_BEEP, 14, 1, 1), | 632 | AC97_SINGLE("Line In to Master Switch", AC97_PC_BEEP, 14, 1, 1), |
435 | AC97_SINGLE("Line In to Mono Mute", AC97_PC_BEEP, 13, 1, 1), | 633 | AC97_SINGLE("Line In to Mono Switch", AC97_PC_BEEP, 13, 1, 1), |
436 | }; | 634 | |
437 | 635 | AC97_DOUBLE("PCM Playback Volume", AC97_PHONE, 8, 0, 31, 1), | |
438 | static const snd_kcontrol_new_t wm13_snd_ac97_controls_dac[] = { | 636 | AC97_SINGLE("PCM Playback to Headphone Switch", AC97_PHONE, 15, 1, 1), |
439 | AC97_DOUBLE("DAC Volume", AC97_PHONE, 8, 0, 31, 1), | 637 | AC97_SINGLE("PCM Playback to Master Switch", AC97_PHONE, 14, 1, 1), |
440 | AC97_SINGLE("DAC to Headphone Mute", AC97_PHONE, 15, 1, 1), | 638 | AC97_SINGLE("PCM Playback to Mono Switch", AC97_PHONE, 13, 1, 1), |
441 | AC97_SINGLE("DAC to Speaker Mute", AC97_PHONE, 14, 1, 1), | 639 | |
442 | AC97_SINGLE("DAC to Mono Mute", AC97_PHONE, 13, 1, 1), | 640 | AC97_SINGLE("Mic 1 Volume", AC97_MIC, 8, 31, 1), |
641 | AC97_SINGLE("Mic 2 Volume", AC97_MIC, 0, 31, 1), | ||
642 | AC97_SINGLE("Mic 1 to Mono Switch", AC97_LINE, 7, 1, 1), | ||
643 | AC97_SINGLE("Mic 2 to Mono Switch", AC97_LINE, 6, 1, 1), | ||
644 | AC97_SINGLE("Mic Boost (+20dB) Switch", AC97_LINE, 5, 1, 0), | ||
645 | AC97_ENUM("Mic to Headphone Mux", wm9713_enum[0]), | ||
646 | AC97_SINGLE("Mic Headphone Mixer Volume", AC97_LINE, 0, 7, 1), | ||
647 | |||
648 | AC97_SINGLE("Capture Switch", AC97_CD, 15, 1, 1), | ||
649 | AC97_ENUM("Capture Volume Steps", wm9713_enum[4]), | ||
650 | AC97_DOUBLE("Capture Volume", AC97_CD, 8, 0, 15, 0), | ||
651 | AC97_SINGLE("Capture ZC Switch", AC97_CD, 7, 1, 0), | ||
652 | |||
653 | AC97_ENUM("Capture to Headphone Mux", wm9713_enum[1]), | ||
654 | AC97_SINGLE("Capture to Headphone Volume", AC97_VIDEO, 11, 7, 1), | ||
655 | AC97_ENUM("Capture to Mono Mux", wm9713_enum[2]), | ||
656 | AC97_SINGLE("Capture to Mono Boost (+20dB) Switch", AC97_VIDEO, 8, 1, 0), | ||
657 | AC97_SINGLE("Capture ADC Boost (+20dB) Switch", AC97_VIDEO, 6, 1, 0), | ||
658 | AC97_ENUM("Capture Select", wm9713_enum[3]), | ||
659 | |||
660 | AC97_SINGLE("ALC Target Volume", AC97_CODEC_CLASS_REV, 12, 15, 0), | ||
661 | AC97_SINGLE("ALC Hold Time", AC97_CODEC_CLASS_REV, 8, 15, 0), | ||
662 | AC97_SINGLE("ALC Decay Time ", AC97_CODEC_CLASS_REV, 4, 15, 0), | ||
663 | AC97_SINGLE("ALC Attack Time", AC97_CODEC_CLASS_REV, 0, 15, 0), | ||
664 | AC97_ENUM("ALC Function", wm9713_enum[5]), | ||
665 | AC97_SINGLE("ALC Max Volume", AC97_PCI_SVID, 11, 7, 0), | ||
666 | AC97_SINGLE("ALC ZC Timeout", AC97_PCI_SVID, 9, 3, 0), | ||
667 | AC97_SINGLE("ALC ZC Switch", AC97_PCI_SVID, 8, 1, 0), | ||
668 | AC97_SINGLE("ALC NG Switch", AC97_PCI_SVID, 7, 1, 0), | ||
669 | AC97_ENUM("ALC NG Type", wm9713_enum[13]), | ||
670 | AC97_SINGLE("ALC NG Threshold", AC97_PCI_SVID, 0, 31, 0), | ||
671 | |||
672 | AC97_DOUBLE("Master ZC Switch", AC97_MASTER, 14, 6, 1, 0), | ||
673 | AC97_DOUBLE("Headphone ZC Switch", AC97_HEADPHONE, 14, 6, 1, 0), | ||
674 | AC97_DOUBLE("Out3/4 ZC Switch", AC97_MASTER_MONO, 14, 6, 1, 0), | ||
675 | AC97_SINGLE("Master Right Switch", AC97_MASTER, 7, 1, 1), | ||
676 | AC97_SINGLE("Headphone Right Switch", AC97_HEADPHONE, 7, 1, 1), | ||
677 | AC97_SINGLE("Out3/4 Right Switch", AC97_MASTER_MONO, 7, 1, 1), | ||
678 | |||
679 | AC97_SINGLE("Mono In to Headphone Switch", AC97_MASTER_TONE, 15, 1, 1), | ||
680 | AC97_SINGLE("Mono In to Master Switch", AC97_MASTER_TONE, 14, 1, 1), | ||
681 | AC97_SINGLE("Mono In Volume", AC97_MASTER_TONE, 8, 31, 1), | ||
682 | AC97_SINGLE("Mono Switch", AC97_MASTER_TONE, 7, 1, 1), | ||
683 | AC97_SINGLE("Mono ZC Switch", AC97_MASTER_TONE, 6, 1, 0), | ||
684 | AC97_SINGLE("Mono Volume", AC97_MASTER_TONE, 0, 31, 1), | ||
685 | |||
686 | AC97_SINGLE("PC Beep to Headphone Switch", AC97_AUX, 15, 1, 1), | ||
687 | AC97_SINGLE("PC Beep to Headphone Volume", AC97_AUX, 12, 7, 1), | ||
688 | AC97_SINGLE("PC Beep to Master Switch", AC97_AUX, 11, 1, 1), | ||
689 | AC97_SINGLE("PC Beep to Master Volume", AC97_AUX, 8, 7, 1), | ||
690 | AC97_SINGLE("PC Beep to Mono Switch", AC97_AUX, 7, 1, 1), | ||
691 | AC97_SINGLE("PC Beep to Mono Volume", AC97_AUX, 4, 7, 1), | ||
692 | |||
693 | AC97_SINGLE("Voice to Headphone Switch", AC97_PCM, 15, 1, 1), | ||
694 | AC97_SINGLE("Voice to Headphone Volume", AC97_PCM, 12, 7, 1), | ||
695 | AC97_SINGLE("Voice to Master Switch", AC97_PCM, 11, 1, 1), | ||
696 | AC97_SINGLE("Voice to Master Volume", AC97_PCM, 8, 7, 1), | ||
697 | AC97_SINGLE("Voice to Mono Switch", AC97_PCM, 7, 1, 1), | ||
698 | AC97_SINGLE("Voice to Mono Volume", AC97_PCM, 4, 7, 1), | ||
699 | |||
700 | AC97_SINGLE("Aux to Headphone Switch", AC97_REC_SEL, 15, 1, 1), | ||
701 | AC97_SINGLE("Aux to Headphone Volume", AC97_REC_SEL, 12, 7, 1), | ||
702 | AC97_SINGLE("Aux to Master Switch", AC97_REC_SEL, 11, 1, 1), | ||
703 | AC97_SINGLE("Aux to Master Volume", AC97_REC_SEL, 8, 7, 1), | ||
704 | AC97_SINGLE("Aux to Mono Switch", AC97_REC_SEL, 7, 1, 1), | ||
705 | AC97_SINGLE("Aux to Mono Volume", AC97_REC_SEL, 4, 7, 1), | ||
706 | |||
707 | AC97_ENUM("Mono Input Mux", wm9713_enum[6]), | ||
708 | AC97_ENUM("Master Input Mux", wm9713_enum[7]), | ||
709 | AC97_ENUM("Headphone Input Mux", wm9713_enum[8]), | ||
710 | AC97_ENUM("Out 3 Input Mux", wm9713_enum[9]), | ||
711 | AC97_ENUM("Out 4 Input Mux", wm9713_enum[10]), | ||
712 | |||
713 | AC97_ENUM("Bass Control", wm9713_enum[12]), | ||
714 | AC97_SINGLE("Bass Cut-off Switch", AC97_GENERAL_PURPOSE, 12, 1, 1), | ||
715 | AC97_SINGLE("Tone Cut-off Switch", AC97_GENERAL_PURPOSE, 4, 1, 1), | ||
716 | AC97_SINGLE("Playback Attenuate (-6dB) Switch", AC97_GENERAL_PURPOSE, 6, 1, 0), | ||
717 | AC97_SINGLE("Bass Volume", AC97_GENERAL_PURPOSE, 8, 15, 1), | ||
718 | AC97_SINGLE("Tone Volume", AC97_GENERAL_PURPOSE, 0, 15, 1), | ||
443 | }; | 719 | }; |
444 | 720 | ||
445 | static const snd_kcontrol_new_t wm13_snd_ac97_controls_mic[] = { | 721 | static const snd_kcontrol_new_t wm13_snd_ac97_controls_3d[] = { |
446 | AC97_SINGLE("MICA Volume", AC97_MIC, 8, 31, 1), | 722 | AC97_ENUM("Inv Input Mux", wm9713_enum[11]), |
447 | AC97_SINGLE("MICB Volume", AC97_MIC, 0, 31, 1), | 723 | AC97_SINGLE("3D Upper Cut-off Switch", AC97_REC_GAIN_MIC, 5, 1, 0), |
448 | AC97_SINGLE("MICA to Mono Mute", AC97_LINE, 7, 1, 1), | 724 | AC97_SINGLE("3D Lower Cut-off Switch", AC97_REC_GAIN_MIC, 4, 1, 0), |
449 | AC97_SINGLE("MICB to Mono Mute", AC97_LINE, 6, 1, 1), | 725 | AC97_SINGLE("3D Depth", AC97_REC_GAIN_MIC, 0, 15, 1), |
450 | AC97_SINGLE("MIC Boost (+20dB)", AC97_LINE, 5, 1, 1), | ||
451 | AC97_ENUM("MIC Headphone Routing", wm9713_enum[0]), | ||
452 | AC97_SINGLE("MIC Headphone Mixer Volume", AC97_LINE, 0, 7, 1) | ||
453 | }; | 726 | }; |
454 | 727 | ||
455 | static const snd_kcontrol_new_t wm13_snd_ac97_controls_adc[] = { | 728 | static int patch_wolfson_wm9713_3d (ac97_t * ac97) |
456 | AC97_SINGLE("ADC Mute", AC97_CD, 15, 1, 1), | 729 | { |
457 | AC97_DOUBLE("Gain Step Size (1.5dB/0.75dB)", AC97_CD, 14, 6, 1, 1), | 730 | int err, i; |
458 | AC97_DOUBLE("ADC Volume",AC97_CD, 8, 0, 15, 0), | 731 | |
459 | AC97_SINGLE("ADC Zero Cross", AC97_CD, 7, 1, 1), | 732 | for (i = 0; i < ARRAY_SIZE(wm13_snd_ac97_controls_3d); i++) { |
460 | }; | 733 | if ((err = snd_ctl_add(ac97->bus->card, snd_ac97_cnew(&wm13_snd_ac97_controls_3d[i], ac97))) < 0) |
461 | 734 | return err; | |
462 | static const snd_kcontrol_new_t wm13_snd_ac97_controls_recsel[] = { | 735 | } |
463 | AC97_ENUM("Record to Headphone Path", wm9713_enum[1]), | 736 | return 0; |
464 | AC97_SINGLE("Record to Headphone Volume", AC97_VIDEO, 11, 7, 0), | 737 | } |
465 | AC97_ENUM("Record to Mono Path", wm9713_enum[2]), | ||
466 | AC97_SINGLE("Record to Mono Boost (+20dB)", AC97_VIDEO, 8, 1, 0), | ||
467 | AC97_SINGLE("Record ADC Boost (+20dB)", AC97_VIDEO, 6, 1, 0), | ||
468 | AC97_ENUM("Record Select Left", wm9713_enum[3]), | ||
469 | AC97_ENUM("Record Select Right", wm9713_enum[4]), | ||
470 | }; | ||
471 | 738 | ||
472 | static int patch_wolfson_wm9713_specific(ac97_t * ac97) | 739 | static int patch_wolfson_wm9713_specific(ac97_t * ac97) |
473 | { | 740 | { |
474 | int err, i; | 741 | int err, i; |
475 | 742 | ||
476 | for (i = 0; i < ARRAY_SIZE(wm13_snd_ac97_controls_line_in); i++) { | 743 | for (i = 0; i < ARRAY_SIZE(wm13_snd_ac97_controls); i++) { |
477 | if ((err = snd_ctl_add(ac97->bus->card, snd_ac97_cnew(&wm13_snd_ac97_controls_line_in[i], ac97))) < 0) | 744 | if ((err = snd_ctl_add(ac97->bus->card, snd_ac97_cnew(&wm13_snd_ac97_controls[i], ac97))) < 0) |
478 | return err; | 745 | return err; |
479 | } | 746 | } |
480 | snd_ac97_write_cache(ac97, AC97_PC_BEEP, 0x0808); | 747 | snd_ac97_write_cache(ac97, AC97_PC_BEEP, 0x0808); |
481 | |||
482 | for (i = 0; i < ARRAY_SIZE(wm13_snd_ac97_controls_dac); i++) { | ||
483 | if ((err = snd_ctl_add(ac97->bus->card, snd_ac97_cnew(&wm13_snd_ac97_controls_dac[i], ac97))) < 0) | ||
484 | return err; | ||
485 | } | ||
486 | snd_ac97_write_cache(ac97, AC97_PHONE, 0x0808); | 748 | snd_ac97_write_cache(ac97, AC97_PHONE, 0x0808); |
487 | |||
488 | for (i = 0; i < ARRAY_SIZE(wm13_snd_ac97_controls_mic); i++) { | ||
489 | if ((err = snd_ctl_add(ac97->bus->card, snd_ac97_cnew(&wm13_snd_ac97_controls_mic[i], ac97))) < 0) | ||
490 | return err; | ||
491 | } | ||
492 | snd_ac97_write_cache(ac97, AC97_MIC, 0x0808); | 749 | snd_ac97_write_cache(ac97, AC97_MIC, 0x0808); |
493 | snd_ac97_write_cache(ac97, AC97_LINE, 0x00da); | 750 | snd_ac97_write_cache(ac97, AC97_LINE, 0x00da); |
494 | |||
495 | for (i = 0; i < ARRAY_SIZE(wm13_snd_ac97_controls_adc); i++) { | ||
496 | if ((err = snd_ctl_add(ac97->bus->card, snd_ac97_cnew(&wm13_snd_ac97_controls_adc[i], ac97))) < 0) | ||
497 | return err; | ||
498 | } | ||
499 | snd_ac97_write_cache(ac97, AC97_CD, 0x0808); | 751 | snd_ac97_write_cache(ac97, AC97_CD, 0x0808); |
500 | |||
501 | for (i = 0; i < ARRAY_SIZE(wm13_snd_ac97_controls_recsel); i++) { | ||
502 | if ((err = snd_ctl_add(ac97->bus->card, snd_ac97_cnew(&wm13_snd_ac97_controls_recsel[i], ac97))) < 0) | ||
503 | return err; | ||
504 | } | ||
505 | snd_ac97_write_cache(ac97, AC97_VIDEO, 0xd612); | 752 | snd_ac97_write_cache(ac97, AC97_VIDEO, 0xd612); |
506 | snd_ac97_write_cache(ac97, AC97_REC_GAIN, 0x1ba0); | 753 | snd_ac97_write_cache(ac97, AC97_REC_GAIN, 0x1ba0); |
507 | |||
508 | return 0; | 754 | return 0; |
509 | } | 755 | } |
510 | 756 | ||
@@ -525,6 +771,7 @@ static void patch_wolfson_wm9713_resume (ac97_t * ac97) | |||
525 | 771 | ||
526 | static struct snd_ac97_build_ops patch_wolfson_wm9713_ops = { | 772 | static struct snd_ac97_build_ops patch_wolfson_wm9713_ops = { |
527 | .build_specific = patch_wolfson_wm9713_specific, | 773 | .build_specific = patch_wolfson_wm9713_specific, |
774 | .build_3d = patch_wolfson_wm9713_3d, | ||
528 | #ifdef CONFIG_PM | 775 | #ifdef CONFIG_PM |
529 | .suspend = patch_wolfson_wm9713_suspend, | 776 | .suspend = patch_wolfson_wm9713_suspend, |
530 | .resume = patch_wolfson_wm9713_resume | 777 | .resume = patch_wolfson_wm9713_resume |
@@ -533,10 +780,13 @@ static struct snd_ac97_build_ops patch_wolfson_wm9713_ops = { | |||
533 | 780 | ||
534 | int patch_wolfson13(ac97_t * ac97) | 781 | int patch_wolfson13(ac97_t * ac97) |
535 | { | 782 | { |
783 | /* WM9713, WM9714 */ | ||
536 | ac97->build_ops = &patch_wolfson_wm9713_ops; | 784 | ac97->build_ops = &patch_wolfson_wm9713_ops; |
537 | 785 | ||
538 | ac97->flags |= AC97_HAS_NO_REC_GAIN | AC97_STEREO_MUTES | AC97_HAS_NO_PHONE | | 786 | ac97->flags |= AC97_HAS_NO_REC_GAIN | AC97_STEREO_MUTES | AC97_HAS_NO_PHONE | |
539 | AC97_HAS_NO_PC_BEEP | AC97_HAS_NO_VIDEO | AC97_HAS_NO_CD; | 787 | AC97_HAS_NO_PC_BEEP | AC97_HAS_NO_VIDEO | AC97_HAS_NO_CD | AC97_HAS_NO_TONE | |
788 | AC97_HAS_NO_STD_PCM; | ||
789 | ac97->scaps &= ~AC97_SCAP_MODEM; | ||
540 | 790 | ||
541 | snd_ac97_write_cache(ac97, AC97_EXTENDED_MID, 0xda00); | 791 | snd_ac97_write_cache(ac97, AC97_EXTENDED_MID, 0xda00); |
542 | snd_ac97_write_cache(ac97, AC97_EXTENDED_MSTATUS, 0x3810); | 792 | snd_ac97_write_cache(ac97, AC97_EXTENDED_MSTATUS, 0x3810); |
@@ -1379,6 +1629,7 @@ static void check_ad1981_hp_jack_sense(ac97_t *ac97) | |||
1379 | u32 subid = ((u32)ac97->subsystem_vendor << 16) | ac97->subsystem_device; | 1629 | u32 subid = ((u32)ac97->subsystem_vendor << 16) | ac97->subsystem_device; |
1380 | switch (subid) { | 1630 | switch (subid) { |
1381 | case 0x103c0890: /* HP nc6000 */ | 1631 | case 0x103c0890: /* HP nc6000 */ |
1632 | case 0x103c099c: /* HP nx6110 */ | ||
1382 | case 0x103c006d: /* HP nx9105 */ | 1633 | case 0x103c006d: /* HP nx9105 */ |
1383 | case 0x17340088: /* FSC Scenic-W */ | 1634 | case 0x17340088: /* FSC Scenic-W */ |
1384 | /* enable headphone jack sense */ | 1635 | /* enable headphone jack sense */ |
@@ -1706,7 +1957,7 @@ static const snd_kcontrol_new_t snd_ac97_controls_alc650[] = { | |||
1706 | }; | 1957 | }; |
1707 | 1958 | ||
1708 | static const snd_kcontrol_new_t snd_ac97_spdif_controls_alc650[] = { | 1959 | static const snd_kcontrol_new_t snd_ac97_spdif_controls_alc650[] = { |
1709 | AC97_SINGLE("IEC958 Capture Switch", AC97_ALC650_MULTICH, 11, 1, 0), | 1960 | AC97_SINGLE(SNDRV_CTL_NAME_IEC958("",CAPTURE,SWITCH), AC97_ALC650_MULTICH, 11, 1, 0), |
1710 | AC97_SINGLE("Analog to IEC958 Output", AC97_ALC650_MULTICH, 12, 1, 0), | 1961 | AC97_SINGLE("Analog to IEC958 Output", AC97_ALC650_MULTICH, 12, 1, 0), |
1711 | /* disable this controls since it doesn't work as expected */ | 1962 | /* disable this controls since it doesn't work as expected */ |
1712 | /* AC97_SINGLE("IEC958 Input Monitor", AC97_ALC650_MULTICH, 13, 1, 0), */ | 1963 | /* AC97_SINGLE("IEC958 Input Monitor", AC97_ALC650_MULTICH, 13, 1, 0), */ |
@@ -1849,12 +2100,12 @@ static int alc655_iec958_route_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_ | |||
1849 | } | 2100 | } |
1850 | 2101 | ||
1851 | static const snd_kcontrol_new_t snd_ac97_spdif_controls_alc655[] = { | 2102 | static const snd_kcontrol_new_t snd_ac97_spdif_controls_alc655[] = { |
1852 | AC97_PAGE_SINGLE("IEC958 Capture Switch", AC97_ALC650_MULTICH, 11, 1, 0, 0), | 2103 | AC97_PAGE_SINGLE(SNDRV_CTL_NAME_IEC958("",CAPTURE,SWITCH), AC97_ALC650_MULTICH, 11, 1, 0, 0), |
1853 | /* disable this controls since it doesn't work as expected */ | 2104 | /* disable this controls since it doesn't work as expected */ |
1854 | /* AC97_PAGE_SINGLE("IEC958 Input Monitor", AC97_ALC650_MULTICH, 14, 1, 0, 0), */ | 2105 | /* AC97_PAGE_SINGLE("IEC958 Input Monitor", AC97_ALC650_MULTICH, 14, 1, 0, 0), */ |
1855 | { | 2106 | { |
1856 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 2107 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
1857 | .name = "IEC958 Playback Route", | 2108 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,NONE) "Route", |
1858 | .info = alc655_iec958_route_info, | 2109 | .info = alc655_iec958_route_info, |
1859 | .get = alc655_iec958_route_get, | 2110 | .get = alc655_iec958_route_get, |
1860 | .put = alc655_iec958_route_put, | 2111 | .put = alc655_iec958_route_put, |
@@ -1883,7 +2134,13 @@ int patch_alc655(ac97_t * ac97) | |||
1883 | { | 2134 | { |
1884 | unsigned int val; | 2135 | unsigned int val; |
1885 | 2136 | ||
1886 | ac97->spec.dev_flags = (ac97->id == 0x414c4780); /* ALC658 */ | 2137 | if (ac97->id == AC97_ID_ALC658) { |
2138 | ac97->spec.dev_flags = 1; /* ALC658 */ | ||
2139 | if ((snd_ac97_read(ac97, AC97_ALC650_REVISION) & 0x3f) == 2) { | ||
2140 | ac97->id = AC97_ID_ALC658D; | ||
2141 | ac97->spec.dev_flags = 2; | ||
2142 | } | ||
2143 | } | ||
1887 | 2144 | ||
1888 | ac97->build_ops = &patch_alc655_ops; | 2145 | ac97->build_ops = &patch_alc655_ops; |
1889 | 2146 | ||
@@ -1892,10 +2149,15 @@ int patch_alc655(ac97_t * ac97) | |||
1892 | 2149 | ||
1893 | /* adjust default values */ | 2150 | /* adjust default values */ |
1894 | val = snd_ac97_read(ac97, 0x7a); /* misc control */ | 2151 | val = snd_ac97_read(ac97, 0x7a); /* misc control */ |
1895 | if (ac97->id == 0x414c4780) /* ALC658 */ | 2152 | if (ac97->spec.dev_flags) /* ALC658 */ |
1896 | val &= ~(1 << 1); /* Pin 47 is spdif input pin */ | 2153 | val &= ~(1 << 1); /* Pin 47 is spdif input pin */ |
1897 | else /* ALC655 */ | 2154 | else { /* ALC655 */ |
1898 | val |= (1 << 1); /* Pin 47 is spdif input pin */ | 2155 | if (ac97->subsystem_vendor == 0x1462 && |
2156 | ac97->subsystem_device == 0x0131) /* MSI S270 laptop */ | ||
2157 | val &= ~(1 << 1); /* Pin 47 is EAPD (for internal speaker) */ | ||
2158 | else | ||
2159 | val |= (1 << 1); /* Pin 47 is spdif input pin */ | ||
2160 | } | ||
1899 | val &= ~(1 << 12); /* vref enable */ | 2161 | val &= ~(1 << 12); /* vref enable */ |
1900 | snd_ac97_write_cache(ac97, 0x7a, val); | 2162 | snd_ac97_write_cache(ac97, 0x7a, val); |
1901 | /* set default: spdif-in enabled, | 2163 | /* set default: spdif-in enabled, |
@@ -1908,6 +2170,11 @@ int patch_alc655(ac97_t * ac97) | |||
1908 | /* full DAC volume */ | 2170 | /* full DAC volume */ |
1909 | snd_ac97_write_cache(ac97, AC97_ALC650_SURR_DAC_VOL, 0x0808); | 2171 | snd_ac97_write_cache(ac97, AC97_ALC650_SURR_DAC_VOL, 0x0808); |
1910 | snd_ac97_write_cache(ac97, AC97_ALC650_LFE_DAC_VOL, 0x0808); | 2172 | snd_ac97_write_cache(ac97, AC97_ALC650_LFE_DAC_VOL, 0x0808); |
2173 | |||
2174 | /* update undocumented bit... */ | ||
2175 | if (ac97->id == AC97_ID_ALC658D) | ||
2176 | snd_ac97_update_bits(ac97, 0x74, 0x0800, 0x0800); | ||
2177 | |||
1911 | return 0; | 2178 | return 0; |
1912 | } | 2179 | } |
1913 | 2180 | ||
@@ -2416,6 +2683,16 @@ int patch_vt1616(ac97_t * ac97) | |||
2416 | } | 2683 | } |
2417 | 2684 | ||
2418 | /* | 2685 | /* |
2686 | * VT1617A codec | ||
2687 | */ | ||
2688 | int patch_vt1617a(ac97_t * ac97) | ||
2689 | { | ||
2690 | ac97->ext_id |= AC97_EI_SPDIF; /* force the detection of spdif */ | ||
2691 | ac97->rates[AC97_RATES_SPDIF] = SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000; | ||
2692 | return 0; | ||
2693 | } | ||
2694 | |||
2695 | /* | ||
2419 | */ | 2696 | */ |
2420 | static void it2646_update_jacks(ac97_t *ac97) | 2697 | static void it2646_update_jacks(ac97_t *ac97) |
2421 | { | 2698 | { |
@@ -2433,7 +2710,7 @@ static const snd_kcontrol_new_t snd_ac97_controls_it2646[] = { | |||
2433 | }; | 2710 | }; |
2434 | 2711 | ||
2435 | static const snd_kcontrol_new_t snd_ac97_spdif_controls_it2646[] = { | 2712 | static const snd_kcontrol_new_t snd_ac97_spdif_controls_it2646[] = { |
2436 | AC97_SINGLE("IEC958 Capture Switch", 0x76, 11, 1, 0), | 2713 | AC97_SINGLE(SNDRV_CTL_NAME_IEC958("",CAPTURE,SWITCH), 0x76, 11, 1, 0), |
2437 | AC97_SINGLE("Analog to IEC958 Output", 0x76, 12, 1, 0), | 2714 | AC97_SINGLE("Analog to IEC958 Output", 0x76, 12, 1, 0), |
2438 | AC97_SINGLE("IEC958 Input Monitor", 0x76, 13, 1, 0), | 2715 | AC97_SINGLE("IEC958 Input Monitor", 0x76, 13, 1, 0), |
2439 | }; | 2716 | }; |
@@ -2475,7 +2752,11 @@ AC97_DOUBLE("Modem Speaker Volume", 0x5c, 14, 12, 3, 1) | |||
2475 | 2752 | ||
2476 | static int patch_si3036_specific(ac97_t * ac97) | 2753 | static int patch_si3036_specific(ac97_t * ac97) |
2477 | { | 2754 | { |
2478 | return patch_build_controls(ac97, snd_ac97_controls_si3036, ARRAY_SIZE(snd_ac97_controls_si3036)); | 2755 | int idx, err; |
2756 | for (idx = 0; idx < ARRAY_SIZE(snd_ac97_controls_si3036); idx++) | ||
2757 | if ((err = snd_ctl_add(ac97->bus->card, snd_ctl_new1(&snd_ac97_controls_si3036[idx], ac97))) < 0) | ||
2758 | return err; | ||
2759 | return 0; | ||
2479 | } | 2760 | } |
2480 | 2761 | ||
2481 | static struct snd_ac97_build_ops patch_si3036_ops = { | 2762 | static struct snd_ac97_build_ops patch_si3036_ops = { |
diff --git a/sound/pci/ac97/ac97_patch.h b/sound/pci/ac97/ac97_patch.h index 7b7377d0f2ae..ec1811320106 100644 --- a/sound/pci/ac97/ac97_patch.h +++ b/sound/pci/ac97/ac97_patch.h | |||
@@ -56,5 +56,6 @@ int patch_cm9739(ac97_t * ac97); | |||
56 | int patch_cm9761(ac97_t * ac97); | 56 | int patch_cm9761(ac97_t * ac97); |
57 | int patch_cm9780(ac97_t * ac97); | 57 | int patch_cm9780(ac97_t * ac97); |
58 | int patch_vt1616(ac97_t * ac97); | 58 | int patch_vt1616(ac97_t * ac97); |
59 | int patch_vt1617a(ac97_t * ac97); | ||
59 | int patch_it2646(ac97_t * ac97); | 60 | int patch_it2646(ac97_t * ac97); |
60 | int mpatch_si3036(ac97_t * ac97); | 61 | int mpatch_si3036(ac97_t * ac97); |
diff --git a/sound/pci/ac97/ak4531_codec.c b/sound/pci/ac97/ak4531_codec.c index f9ce0fd2f52f..4032c5748370 100644 --- a/sound/pci/ac97/ak4531_codec.c +++ b/sound/pci/ac97/ak4531_codec.c | |||
@@ -357,7 +357,7 @@ int snd_ak4531_mixer(snd_card_t * card, ak4531_t * _ak4531, ak4531_t ** rak4531) | |||
357 | snd_assert(rak4531 != NULL, return -EINVAL); | 357 | snd_assert(rak4531 != NULL, return -EINVAL); |
358 | *rak4531 = NULL; | 358 | *rak4531 = NULL; |
359 | snd_assert(card != NULL && _ak4531 != NULL, return -EINVAL); | 359 | snd_assert(card != NULL && _ak4531 != NULL, return -EINVAL); |
360 | ak4531 = kcalloc(1, sizeof(*ak4531), GFP_KERNEL); | 360 | ak4531 = kzalloc(sizeof(*ak4531), GFP_KERNEL); |
361 | if (ak4531 == NULL) | 361 | if (ak4531 == NULL) |
362 | return -ENOMEM; | 362 | return -ENOMEM; |
363 | *ak4531 = *_ak4531; | 363 | *ak4531 = *_ak4531; |
diff --git a/sound/pci/ad1889.c b/sound/pci/ad1889.c new file mode 100644 index 000000000000..d7d99a25c5e5 --- /dev/null +++ b/sound/pci/ad1889.c | |||
@@ -0,0 +1,1090 @@ | |||
1 | /* Analog Devices 1889 audio driver | ||
2 | * | ||
3 | * This is a driver for the AD1889 PCI audio chipset found | ||
4 | * on the HP PA-RISC [BCJ]-xxx0 workstations. | ||
5 | * | ||
6 | * Copyright (C) 2004-2005, Kyle McMartin <kyle@parisc-linux.org> | ||
7 | * Copyright (C) 2005, Thibaut Varene <varenet@parisc-linux.org> | ||
8 | * Based on the OSS AD1889 driver by Randolph Chung <tausq@debian.org> | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License, version 2, as | ||
12 | * published by the Free Software Foundation. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
22 | * | ||
23 | * TODO: | ||
24 | * Do we need to take care of CCS register? | ||
25 | * Maybe we could use finer grained locking (separate locks for pb/cap)? | ||
26 | * Wishlist: | ||
27 | * Control Interface (mixer) support | ||
28 | * Better AC97 support (VSR...)? | ||
29 | * PM support | ||
30 | * MIDI support | ||
31 | * Game Port support | ||
32 | * SG DMA support (this will need *alot* of work) | ||
33 | */ | ||
34 | |||
35 | #include <linux/init.h> | ||
36 | #include <linux/pci.h> | ||
37 | #include <linux/slab.h> | ||
38 | #include <linux/interrupt.h> | ||
39 | #include <linux/compiler.h> | ||
40 | #include <linux/delay.h> | ||
41 | |||
42 | #include <sound/driver.h> | ||
43 | #include <sound/core.h> | ||
44 | #include <sound/pcm.h> | ||
45 | #include <sound/initval.h> | ||
46 | #include <sound/ac97_codec.h> | ||
47 | |||
48 | #include <asm/io.h> | ||
49 | |||
50 | #include "ad1889.h" | ||
51 | #include "ac97/ac97_id.h" | ||
52 | |||
53 | #define AD1889_DRVVER "$Revision: 1.3 $" | ||
54 | |||
55 | MODULE_AUTHOR("Kyle McMartin <kyle@parisc-linux.org>, Thibaut Varene <t-bone@parisc-linux.org>"); | ||
56 | MODULE_DESCRIPTION("Analog Devices AD1889 ALSA sound driver"); | ||
57 | MODULE_LICENSE("GPL"); | ||
58 | MODULE_SUPPORTED_DEVICE("{{Analog Devices,AD1889}}"); | ||
59 | |||
60 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; | ||
61 | module_param_array(index, int, NULL, 0444); | ||
62 | MODULE_PARM_DESC(index, "Index value for the AD1889 soundcard."); | ||
63 | |||
64 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; | ||
65 | module_param_array(id, charp, NULL, 0444); | ||
66 | MODULE_PARM_DESC(id, "ID string for the AD1889 soundcard."); | ||
67 | |||
68 | static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; | ||
69 | module_param_array(enable, bool, NULL, 0444); | ||
70 | MODULE_PARM_DESC(enable, "Enable AD1889 soundcard."); | ||
71 | |||
72 | static char *ac97_quirk[SNDRV_CARDS]; | ||
73 | module_param_array(ac97_quirk, charp, NULL, 0444); | ||
74 | MODULE_PARM_DESC(ac97_quirk, "AC'97 workaround for strange hardware."); | ||
75 | |||
76 | #define DEVNAME "ad1889" | ||
77 | #define PFX DEVNAME ": " | ||
78 | |||
79 | /* let's use the global sound debug interfaces */ | ||
80 | #define ad1889_debug(fmt, arg...) snd_printd(KERN_DEBUG fmt, ## arg) | ||
81 | |||
82 | /* keep track of some hw registers */ | ||
83 | struct ad1889_register_state { | ||
84 | u16 reg; /* reg setup */ | ||
85 | u32 addr; /* dma base address */ | ||
86 | unsigned long size; /* DMA buffer size */ | ||
87 | }; | ||
88 | |||
89 | struct snd_ad1889 { | ||
90 | snd_card_t *card; | ||
91 | struct pci_dev *pci; | ||
92 | |||
93 | int irq; | ||
94 | unsigned long bar; | ||
95 | void __iomem *iobase; | ||
96 | |||
97 | ac97_t *ac97; | ||
98 | ac97_bus_t *ac97_bus; | ||
99 | snd_pcm_t *pcm; | ||
100 | snd_info_entry_t *proc; | ||
101 | |||
102 | snd_pcm_substream_t *psubs; | ||
103 | snd_pcm_substream_t *csubs; | ||
104 | |||
105 | /* playback register state */ | ||
106 | struct ad1889_register_state wave; | ||
107 | struct ad1889_register_state ramc; | ||
108 | |||
109 | spinlock_t lock; | ||
110 | }; | ||
111 | |||
112 | static inline u16 | ||
113 | ad1889_readw(struct snd_ad1889 *chip, unsigned reg) | ||
114 | { | ||
115 | return readw(chip->iobase + reg); | ||
116 | } | ||
117 | |||
118 | static inline void | ||
119 | ad1889_writew(struct snd_ad1889 *chip, unsigned reg, u16 val) | ||
120 | { | ||
121 | writew(val, chip->iobase + reg); | ||
122 | } | ||
123 | |||
124 | static inline u32 | ||
125 | ad1889_readl(struct snd_ad1889 *chip, unsigned reg) | ||
126 | { | ||
127 | return readl(chip->iobase + reg); | ||
128 | } | ||
129 | |||
130 | static inline void | ||
131 | ad1889_writel(struct snd_ad1889 *chip, unsigned reg, u32 val) | ||
132 | { | ||
133 | writel(val, chip->iobase + reg); | ||
134 | } | ||
135 | |||
136 | static inline void | ||
137 | ad1889_unmute(struct snd_ad1889 *chip) | ||
138 | { | ||
139 | u16 st; | ||
140 | st = ad1889_readw(chip, AD_DS_WADA) & | ||
141 | ~(AD_DS_WADA_RWAM | AD_DS_WADA_LWAM); | ||
142 | ad1889_writew(chip, AD_DS_WADA, st); | ||
143 | ad1889_readw(chip, AD_DS_WADA); | ||
144 | } | ||
145 | |||
146 | static inline void | ||
147 | ad1889_mute(struct snd_ad1889 *chip) | ||
148 | { | ||
149 | u16 st; | ||
150 | st = ad1889_readw(chip, AD_DS_WADA) | AD_DS_WADA_RWAM | AD_DS_WADA_LWAM; | ||
151 | ad1889_writew(chip, AD_DS_WADA, st); | ||
152 | ad1889_readw(chip, AD_DS_WADA); | ||
153 | } | ||
154 | |||
155 | static inline void | ||
156 | ad1889_load_adc_buffer_address(struct snd_ad1889 *chip, u32 address) | ||
157 | { | ||
158 | ad1889_writel(chip, AD_DMA_ADCBA, address); | ||
159 | ad1889_writel(chip, AD_DMA_ADCCA, address); | ||
160 | } | ||
161 | |||
162 | static inline void | ||
163 | ad1889_load_adc_buffer_count(struct snd_ad1889 *chip, u32 count) | ||
164 | { | ||
165 | ad1889_writel(chip, AD_DMA_ADCBC, count); | ||
166 | ad1889_writel(chip, AD_DMA_ADCCC, count); | ||
167 | } | ||
168 | |||
169 | static inline void | ||
170 | ad1889_load_adc_interrupt_count(struct snd_ad1889 *chip, u32 count) | ||
171 | { | ||
172 | ad1889_writel(chip, AD_DMA_ADCIB, count); | ||
173 | ad1889_writel(chip, AD_DMA_ADCIC, count); | ||
174 | } | ||
175 | |||
176 | static inline void | ||
177 | ad1889_load_wave_buffer_address(struct snd_ad1889 *chip, u32 address) | ||
178 | { | ||
179 | ad1889_writel(chip, AD_DMA_WAVBA, address); | ||
180 | ad1889_writel(chip, AD_DMA_WAVCA, address); | ||
181 | } | ||
182 | |||
183 | static inline void | ||
184 | ad1889_load_wave_buffer_count(struct snd_ad1889 *chip, u32 count) | ||
185 | { | ||
186 | ad1889_writel(chip, AD_DMA_WAVBC, count); | ||
187 | ad1889_writel(chip, AD_DMA_WAVCC, count); | ||
188 | } | ||
189 | |||
190 | static inline void | ||
191 | ad1889_load_wave_interrupt_count(struct snd_ad1889 *chip, u32 count) | ||
192 | { | ||
193 | ad1889_writel(chip, AD_DMA_WAVIB, count); | ||
194 | ad1889_writel(chip, AD_DMA_WAVIC, count); | ||
195 | } | ||
196 | |||
197 | static void | ||
198 | ad1889_channel_reset(struct snd_ad1889 *chip, unsigned int channel) | ||
199 | { | ||
200 | u16 reg; | ||
201 | |||
202 | if (channel & AD_CHAN_WAV) { | ||
203 | /* Disable wave channel */ | ||
204 | reg = ad1889_readw(chip, AD_DS_WSMC) & ~AD_DS_WSMC_WAEN; | ||
205 | ad1889_writew(chip, AD_DS_WSMC, reg); | ||
206 | chip->wave.reg = reg; | ||
207 | |||
208 | /* disable IRQs */ | ||
209 | reg = ad1889_readw(chip, AD_DMA_WAV); | ||
210 | reg &= AD_DMA_IM_DIS; | ||
211 | reg &= ~AD_DMA_LOOP; | ||
212 | ad1889_writew(chip, AD_DMA_WAV, reg); | ||
213 | |||
214 | /* clear IRQ and address counters and pointers */ | ||
215 | ad1889_load_wave_buffer_address(chip, 0x0); | ||
216 | ad1889_load_wave_buffer_count(chip, 0x0); | ||
217 | ad1889_load_wave_interrupt_count(chip, 0x0); | ||
218 | |||
219 | /* flush */ | ||
220 | ad1889_readw(chip, AD_DMA_WAV); | ||
221 | } | ||
222 | |||
223 | if (channel & AD_CHAN_ADC) { | ||
224 | /* Disable ADC channel */ | ||
225 | reg = ad1889_readw(chip, AD_DS_RAMC) & ~AD_DS_RAMC_ADEN; | ||
226 | ad1889_writew(chip, AD_DS_RAMC, reg); | ||
227 | chip->ramc.reg = reg; | ||
228 | |||
229 | reg = ad1889_readw(chip, AD_DMA_ADC); | ||
230 | reg &= AD_DMA_IM_DIS; | ||
231 | reg &= ~AD_DMA_LOOP; | ||
232 | ad1889_writew(chip, AD_DMA_ADC, reg); | ||
233 | |||
234 | ad1889_load_adc_buffer_address(chip, 0x0); | ||
235 | ad1889_load_adc_buffer_count(chip, 0x0); | ||
236 | ad1889_load_adc_interrupt_count(chip, 0x0); | ||
237 | |||
238 | /* flush */ | ||
239 | ad1889_readw(chip, AD_DMA_ADC); | ||
240 | } | ||
241 | } | ||
242 | |||
243 | static inline u16 | ||
244 | snd_ad1889_ac97_read(ac97_t *ac97, unsigned short reg) | ||
245 | { | ||
246 | struct snd_ad1889 *chip = ac97->private_data; | ||
247 | return ad1889_readw(chip, AD_AC97_BASE + reg); | ||
248 | } | ||
249 | |||
250 | static inline void | ||
251 | snd_ad1889_ac97_write(ac97_t *ac97, unsigned short reg, unsigned short val) | ||
252 | { | ||
253 | struct snd_ad1889 *chip = ac97->private_data; | ||
254 | ad1889_writew(chip, AD_AC97_BASE + reg, val); | ||
255 | } | ||
256 | |||
257 | static int | ||
258 | snd_ad1889_ac97_ready(struct snd_ad1889 *chip) | ||
259 | { | ||
260 | int retry = 400; /* average needs 352 msec */ | ||
261 | |||
262 | while (!(ad1889_readw(chip, AD_AC97_ACIC) & AD_AC97_ACIC_ACRDY) | ||
263 | && --retry) | ||
264 | mdelay(1); | ||
265 | if (!retry) { | ||
266 | snd_printk(KERN_ERR PFX "[%s] Link is not ready.\n", | ||
267 | __FUNCTION__); | ||
268 | return -EIO; | ||
269 | } | ||
270 | ad1889_debug("[%s] ready after %d ms\n", __FUNCTION__, 400 - retry); | ||
271 | |||
272 | return 0; | ||
273 | } | ||
274 | |||
275 | static int | ||
276 | snd_ad1889_hw_params(snd_pcm_substream_t *substream, | ||
277 | snd_pcm_hw_params_t *hw_params) | ||
278 | { | ||
279 | return snd_pcm_lib_malloc_pages(substream, | ||
280 | params_buffer_bytes(hw_params)); | ||
281 | } | ||
282 | |||
283 | static int | ||
284 | snd_ad1889_hw_free(snd_pcm_substream_t *substream) | ||
285 | { | ||
286 | return snd_pcm_lib_free_pages(substream); | ||
287 | } | ||
288 | |||
289 | static snd_pcm_hardware_t snd_ad1889_playback_hw = { | ||
290 | .info = SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | | ||
291 | SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_BLOCK_TRANSFER, | ||
292 | .formats = SNDRV_PCM_FMTBIT_S16_LE, | ||
293 | .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000, | ||
294 | .rate_min = 8000, /* docs say 7000, but we're lazy */ | ||
295 | .rate_max = 48000, | ||
296 | .channels_min = 1, | ||
297 | .channels_max = 2, | ||
298 | .buffer_bytes_max = BUFFER_BYTES_MAX, | ||
299 | .period_bytes_min = PERIOD_BYTES_MIN, | ||
300 | .period_bytes_max = PERIOD_BYTES_MAX, | ||
301 | .periods_min = PERIODS_MIN, | ||
302 | .periods_max = PERIODS_MAX, | ||
303 | /*.fifo_size = 0,*/ | ||
304 | }; | ||
305 | |||
306 | static snd_pcm_hardware_t snd_ad1889_capture_hw = { | ||
307 | .info = SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | | ||
308 | SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_BLOCK_TRANSFER, | ||
309 | .formats = SNDRV_PCM_FMTBIT_S16_LE, | ||
310 | .rates = SNDRV_PCM_RATE_48000, | ||
311 | .rate_min = 48000, /* docs say we could to VSR, but we're lazy */ | ||
312 | .rate_max = 48000, | ||
313 | .channels_min = 1, | ||
314 | .channels_max = 2, | ||
315 | .buffer_bytes_max = BUFFER_BYTES_MAX, | ||
316 | .period_bytes_min = PERIOD_BYTES_MIN, | ||
317 | .period_bytes_max = PERIOD_BYTES_MAX, | ||
318 | .periods_min = PERIODS_MIN, | ||
319 | .periods_max = PERIODS_MAX, | ||
320 | /*.fifo_size = 0,*/ | ||
321 | }; | ||
322 | |||
323 | static int | ||
324 | snd_ad1889_playback_open(snd_pcm_substream_t *ss) | ||
325 | { | ||
326 | struct snd_ad1889 *chip = snd_pcm_substream_chip(ss); | ||
327 | snd_pcm_runtime_t *rt = ss->runtime; | ||
328 | |||
329 | chip->psubs = ss; | ||
330 | rt->hw = snd_ad1889_playback_hw; | ||
331 | |||
332 | return 0; | ||
333 | } | ||
334 | |||
335 | static int | ||
336 | snd_ad1889_capture_open(snd_pcm_substream_t *ss) | ||
337 | { | ||
338 | struct snd_ad1889 *chip = snd_pcm_substream_chip(ss); | ||
339 | snd_pcm_runtime_t *rt = ss->runtime; | ||
340 | |||
341 | chip->csubs = ss; | ||
342 | rt->hw = snd_ad1889_capture_hw; | ||
343 | |||
344 | return 0; | ||
345 | } | ||
346 | |||
347 | static int | ||
348 | snd_ad1889_playback_close(snd_pcm_substream_t *ss) | ||
349 | { | ||
350 | struct snd_ad1889 *chip = snd_pcm_substream_chip(ss); | ||
351 | chip->psubs = NULL; | ||
352 | return 0; | ||
353 | } | ||
354 | |||
355 | static int | ||
356 | snd_ad1889_capture_close(snd_pcm_substream_t *ss) | ||
357 | { | ||
358 | struct snd_ad1889 *chip = snd_pcm_substream_chip(ss); | ||
359 | chip->csubs = NULL; | ||
360 | return 0; | ||
361 | } | ||
362 | |||
363 | static int | ||
364 | snd_ad1889_playback_prepare(snd_pcm_substream_t *ss) | ||
365 | { | ||
366 | struct snd_ad1889 *chip = snd_pcm_substream_chip(ss); | ||
367 | snd_pcm_runtime_t *rt = ss->runtime; | ||
368 | unsigned int size = snd_pcm_lib_buffer_bytes(ss); | ||
369 | unsigned int count = snd_pcm_lib_period_bytes(ss); | ||
370 | u16 reg; | ||
371 | |||
372 | ad1889_channel_reset(chip, AD_CHAN_WAV); | ||
373 | |||
374 | reg = ad1889_readw(chip, AD_DS_WSMC); | ||
375 | |||
376 | /* Mask out 16-bit / Stereo */ | ||
377 | reg &= ~(AD_DS_WSMC_WA16 | AD_DS_WSMC_WAST); | ||
378 | |||
379 | if (snd_pcm_format_width(rt->format) == 16) | ||
380 | reg |= AD_DS_WSMC_WA16; | ||
381 | |||
382 | if (rt->channels > 1) | ||
383 | reg |= AD_DS_WSMC_WAST; | ||
384 | |||
385 | /* let's make sure we don't clobber ourselves */ | ||
386 | spin_lock_irq(&chip->lock); | ||
387 | |||
388 | chip->wave.size = size; | ||
389 | chip->wave.reg = reg; | ||
390 | chip->wave.addr = rt->dma_addr; | ||
391 | |||
392 | ad1889_writew(chip, AD_DS_WSMC, chip->wave.reg); | ||
393 | |||
394 | /* Set sample rates on the codec */ | ||
395 | ad1889_writew(chip, AD_DS_WAS, rt->rate); | ||
396 | |||
397 | /* Set up DMA */ | ||
398 | ad1889_load_wave_buffer_address(chip, chip->wave.addr); | ||
399 | ad1889_load_wave_buffer_count(chip, size); | ||
400 | ad1889_load_wave_interrupt_count(chip, count); | ||
401 | |||
402 | /* writes flush */ | ||
403 | ad1889_readw(chip, AD_DS_WSMC); | ||
404 | |||
405 | spin_unlock_irq(&chip->lock); | ||
406 | |||
407 | ad1889_debug("prepare playback: addr = 0x%x, count = %u, " | ||
408 | "size = %u, reg = 0x%x, rate = %u\n", chip->wave.addr, | ||
409 | count, size, reg, rt->rate); | ||
410 | return 0; | ||
411 | } | ||
412 | |||
413 | static int | ||
414 | snd_ad1889_capture_prepare(snd_pcm_substream_t *ss) | ||
415 | { | ||
416 | struct snd_ad1889 *chip = snd_pcm_substream_chip(ss); | ||
417 | snd_pcm_runtime_t *rt = ss->runtime; | ||
418 | unsigned int size = snd_pcm_lib_buffer_bytes(ss); | ||
419 | unsigned int count = snd_pcm_lib_period_bytes(ss); | ||
420 | u16 reg; | ||
421 | |||
422 | ad1889_channel_reset(chip, AD_CHAN_ADC); | ||
423 | |||
424 | reg = ad1889_readw(chip, AD_DS_RAMC); | ||
425 | |||
426 | /* Mask out 16-bit / Stereo */ | ||
427 | reg &= ~(AD_DS_RAMC_AD16 | AD_DS_RAMC_ADST); | ||
428 | |||
429 | if (snd_pcm_format_width(rt->format) == 16) | ||
430 | reg |= AD_DS_RAMC_AD16; | ||
431 | |||
432 | if (rt->channels > 1) | ||
433 | reg |= AD_DS_RAMC_ADST; | ||
434 | |||
435 | /* let's make sure we don't clobber ourselves */ | ||
436 | spin_lock_irq(&chip->lock); | ||
437 | |||
438 | chip->ramc.size = size; | ||
439 | chip->ramc.reg = reg; | ||
440 | chip->ramc.addr = rt->dma_addr; | ||
441 | |||
442 | ad1889_writew(chip, AD_DS_RAMC, chip->ramc.reg); | ||
443 | |||
444 | /* Set up DMA */ | ||
445 | ad1889_load_adc_buffer_address(chip, chip->ramc.addr); | ||
446 | ad1889_load_adc_buffer_count(chip, size); | ||
447 | ad1889_load_adc_interrupt_count(chip, count); | ||
448 | |||
449 | /* writes flush */ | ||
450 | ad1889_readw(chip, AD_DS_RAMC); | ||
451 | |||
452 | spin_unlock_irq(&chip->lock); | ||
453 | |||
454 | ad1889_debug("prepare capture: addr = 0x%x, count = %u, " | ||
455 | "size = %u, reg = 0x%x, rate = %u\n", chip->ramc.addr, | ||
456 | count, size, reg, rt->rate); | ||
457 | return 0; | ||
458 | } | ||
459 | |||
460 | /* this is called in atomic context with IRQ disabled. | ||
461 | Must be as fast as possible and not sleep. | ||
462 | DMA should be *triggered* by this call. | ||
463 | The WSMC "WAEN" bit triggers DMA Wave On/Off */ | ||
464 | static int | ||
465 | snd_ad1889_playback_trigger(snd_pcm_substream_t *ss, int cmd) | ||
466 | { | ||
467 | u16 wsmc; | ||
468 | struct snd_ad1889 *chip = snd_pcm_substream_chip(ss); | ||
469 | |||
470 | wsmc = ad1889_readw(chip, AD_DS_WSMC); | ||
471 | |||
472 | switch (cmd) { | ||
473 | case SNDRV_PCM_TRIGGER_START: | ||
474 | /* enable DMA loop & interrupts */ | ||
475 | ad1889_writew(chip, AD_DMA_WAV, AD_DMA_LOOP | AD_DMA_IM_CNT); | ||
476 | wsmc |= AD_DS_WSMC_WAEN; | ||
477 | /* 1 to clear CHSS bit */ | ||
478 | ad1889_writel(chip, AD_DMA_CHSS, AD_DMA_CHSS_WAVS); | ||
479 | ad1889_unmute(chip); | ||
480 | break; | ||
481 | case SNDRV_PCM_TRIGGER_STOP: | ||
482 | ad1889_mute(chip); | ||
483 | wsmc &= ~AD_DS_WSMC_WAEN; | ||
484 | break; | ||
485 | default: | ||
486 | snd_BUG(); | ||
487 | return -EINVAL; | ||
488 | } | ||
489 | |||
490 | chip->wave.reg = wsmc; | ||
491 | ad1889_writew(chip, AD_DS_WSMC, wsmc); | ||
492 | ad1889_readw(chip, AD_DS_WSMC); /* flush */ | ||
493 | |||
494 | /* reset the chip when STOP - will disable IRQs */ | ||
495 | if (cmd == SNDRV_PCM_TRIGGER_STOP) | ||
496 | ad1889_channel_reset(chip, AD_CHAN_WAV); | ||
497 | |||
498 | return 0; | ||
499 | } | ||
500 | |||
501 | /* this is called in atomic context with IRQ disabled. | ||
502 | Must be as fast as possible and not sleep. | ||
503 | DMA should be *triggered* by this call. | ||
504 | The RAMC "ADEN" bit triggers DMA ADC On/Off */ | ||
505 | static int | ||
506 | snd_ad1889_capture_trigger(snd_pcm_substream_t *ss, int cmd) | ||
507 | { | ||
508 | u16 ramc; | ||
509 | struct snd_ad1889 *chip = snd_pcm_substream_chip(ss); | ||
510 | |||
511 | ramc = ad1889_readw(chip, AD_DS_RAMC); | ||
512 | |||
513 | switch (cmd) { | ||
514 | case SNDRV_PCM_TRIGGER_START: | ||
515 | /* enable DMA loop & interrupts */ | ||
516 | ad1889_writew(chip, AD_DMA_ADC, AD_DMA_LOOP | AD_DMA_IM_CNT); | ||
517 | ramc |= AD_DS_RAMC_ADEN; | ||
518 | /* 1 to clear CHSS bit */ | ||
519 | ad1889_writel(chip, AD_DMA_CHSS, AD_DMA_CHSS_ADCS); | ||
520 | break; | ||
521 | case SNDRV_PCM_TRIGGER_STOP: | ||
522 | ramc &= ~AD_DS_RAMC_ADEN; | ||
523 | break; | ||
524 | default: | ||
525 | return -EINVAL; | ||
526 | } | ||
527 | |||
528 | chip->ramc.reg = ramc; | ||
529 | ad1889_writew(chip, AD_DS_RAMC, ramc); | ||
530 | ad1889_readw(chip, AD_DS_RAMC); /* flush */ | ||
531 | |||
532 | /* reset the chip when STOP - will disable IRQs */ | ||
533 | if (cmd == SNDRV_PCM_TRIGGER_STOP) | ||
534 | ad1889_channel_reset(chip, AD_CHAN_ADC); | ||
535 | |||
536 | return 0; | ||
537 | } | ||
538 | |||
539 | /* Called in atomic context with IRQ disabled */ | ||
540 | static snd_pcm_uframes_t | ||
541 | snd_ad1889_playback_pointer(snd_pcm_substream_t *ss) | ||
542 | { | ||
543 | size_t ptr = 0; | ||
544 | struct snd_ad1889 *chip = snd_pcm_substream_chip(ss); | ||
545 | |||
546 | if (unlikely(!(chip->wave.reg & AD_DS_WSMC_WAEN))) | ||
547 | return 0; | ||
548 | |||
549 | ptr = ad1889_readl(chip, AD_DMA_WAVCA); | ||
550 | ptr -= chip->wave.addr; | ||
551 | |||
552 | snd_assert((ptr >= 0) && (ptr < chip->wave.size), return 0); | ||
553 | |||
554 | return bytes_to_frames(ss->runtime, ptr); | ||
555 | } | ||
556 | |||
557 | /* Called in atomic context with IRQ disabled */ | ||
558 | static snd_pcm_uframes_t | ||
559 | snd_ad1889_capture_pointer(snd_pcm_substream_t *ss) | ||
560 | { | ||
561 | size_t ptr = 0; | ||
562 | struct snd_ad1889 *chip = snd_pcm_substream_chip(ss); | ||
563 | |||
564 | if (unlikely(!(chip->ramc.reg & AD_DS_RAMC_ADEN))) | ||
565 | return 0; | ||
566 | |||
567 | ptr = ad1889_readl(chip, AD_DMA_ADCCA); | ||
568 | ptr -= chip->ramc.addr; | ||
569 | |||
570 | snd_assert((ptr >= 0) && (ptr < chip->ramc.size), return 0); | ||
571 | |||
572 | return bytes_to_frames(ss->runtime, ptr); | ||
573 | } | ||
574 | |||
575 | static snd_pcm_ops_t snd_ad1889_playback_ops = { | ||
576 | .open = snd_ad1889_playback_open, | ||
577 | .close = snd_ad1889_playback_close, | ||
578 | .ioctl = snd_pcm_lib_ioctl, | ||
579 | .hw_params = snd_ad1889_hw_params, | ||
580 | .hw_free = snd_ad1889_hw_free, | ||
581 | .prepare = snd_ad1889_playback_prepare, | ||
582 | .trigger = snd_ad1889_playback_trigger, | ||
583 | .pointer = snd_ad1889_playback_pointer, | ||
584 | }; | ||
585 | |||
586 | static snd_pcm_ops_t snd_ad1889_capture_ops = { | ||
587 | .open = snd_ad1889_capture_open, | ||
588 | .close = snd_ad1889_capture_close, | ||
589 | .ioctl = snd_pcm_lib_ioctl, | ||
590 | .hw_params = snd_ad1889_hw_params, | ||
591 | .hw_free = snd_ad1889_hw_free, | ||
592 | .prepare = snd_ad1889_capture_prepare, | ||
593 | .trigger = snd_ad1889_capture_trigger, | ||
594 | .pointer = snd_ad1889_capture_pointer, | ||
595 | }; | ||
596 | |||
597 | static irqreturn_t | ||
598 | snd_ad1889_interrupt(int irq, | ||
599 | void *dev_id, | ||
600 | struct pt_regs *regs) | ||
601 | { | ||
602 | unsigned long st; | ||
603 | struct snd_ad1889 *chip = dev_id; | ||
604 | |||
605 | st = ad1889_readl(chip, AD_DMA_DISR); | ||
606 | |||
607 | /* clear ISR */ | ||
608 | ad1889_writel(chip, AD_DMA_DISR, st); | ||
609 | |||
610 | st &= AD_INTR_MASK; | ||
611 | |||
612 | if (unlikely(!st)) | ||
613 | return IRQ_NONE; | ||
614 | |||
615 | if (st & (AD_DMA_DISR_PMAI|AD_DMA_DISR_PTAI)) | ||
616 | ad1889_debug("Unexpected master or target abort interrupt!\n"); | ||
617 | |||
618 | if ((st & AD_DMA_DISR_WAVI) && chip->psubs) | ||
619 | snd_pcm_period_elapsed(chip->psubs); | ||
620 | if ((st & AD_DMA_DISR_ADCI) && chip->csubs) | ||
621 | snd_pcm_period_elapsed(chip->csubs); | ||
622 | |||
623 | return IRQ_HANDLED; | ||
624 | } | ||
625 | |||
626 | static void | ||
627 | snd_ad1889_pcm_free(snd_pcm_t *pcm) | ||
628 | { | ||
629 | struct snd_ad1889 *chip = pcm->private_data; | ||
630 | chip->pcm = NULL; | ||
631 | snd_pcm_lib_preallocate_free_for_all(pcm); | ||
632 | } | ||
633 | |||
634 | static int __devinit | ||
635 | snd_ad1889_pcm_init(struct snd_ad1889 *chip, int device, snd_pcm_t **rpcm) | ||
636 | { | ||
637 | int err; | ||
638 | snd_pcm_t *pcm; | ||
639 | |||
640 | if (rpcm) | ||
641 | *rpcm = NULL; | ||
642 | |||
643 | err = snd_pcm_new(chip->card, chip->card->driver, device, 1, 1, &pcm); | ||
644 | if (err < 0) | ||
645 | return err; | ||
646 | |||
647 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, | ||
648 | &snd_ad1889_playback_ops); | ||
649 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, | ||
650 | &snd_ad1889_capture_ops); | ||
651 | |||
652 | pcm->private_data = chip; | ||
653 | pcm->private_free = snd_ad1889_pcm_free; | ||
654 | pcm->info_flags = 0; | ||
655 | strcpy(pcm->name, chip->card->shortname); | ||
656 | |||
657 | chip->pcm = pcm; | ||
658 | chip->psubs = NULL; | ||
659 | chip->csubs = NULL; | ||
660 | |||
661 | err = snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | ||
662 | snd_dma_pci_data(chip->pci), | ||
663 | BUFFER_BYTES_MAX / 2, | ||
664 | BUFFER_BYTES_MAX); | ||
665 | |||
666 | if (err < 0) { | ||
667 | snd_printk(KERN_ERR PFX "buffer allocation error: %d\n", err); | ||
668 | return err; | ||
669 | } | ||
670 | |||
671 | if (rpcm) | ||
672 | *rpcm = pcm; | ||
673 | |||
674 | return 0; | ||
675 | } | ||
676 | |||
677 | static void | ||
678 | snd_ad1889_proc_read(snd_info_entry_t *entry, snd_info_buffer_t *buffer) | ||
679 | { | ||
680 | struct snd_ad1889 *chip = entry->private_data; | ||
681 | u16 reg; | ||
682 | int tmp; | ||
683 | |||
684 | reg = ad1889_readw(chip, AD_DS_WSMC); | ||
685 | snd_iprintf(buffer, "Wave output: %s\n", | ||
686 | (reg & AD_DS_WSMC_WAEN) ? "enabled" : "disabled"); | ||
687 | snd_iprintf(buffer, "Wave Channels: %s\n", | ||
688 | (reg & AD_DS_WSMC_WAST) ? "stereo" : "mono"); | ||
689 | snd_iprintf(buffer, "Wave Quality: %d-bit linear\n", | ||
690 | (reg & AD_DS_WSMC_WA16) ? 16 : 8); | ||
691 | |||
692 | /* WARQ is at offset 12 */ | ||
693 | tmp = (reg & AD_DS_WSMC_WARQ) ? | ||
694 | (((reg & AD_DS_WSMC_WARQ >> 12) & 0x01) ? 12 : 18) : 4; | ||
695 | tmp /= (reg & AD_DS_WSMC_WAST) ? 2 : 1; | ||
696 | |||
697 | snd_iprintf(buffer, "Wave FIFO: %d %s words\n\n", tmp, | ||
698 | (reg & AD_DS_WSMC_WAST) ? "stereo" : "mono"); | ||
699 | |||
700 | |||
701 | snd_iprintf(buffer, "Synthesis output: %s\n", | ||
702 | reg & AD_DS_WSMC_SYEN ? "enabled" : "disabled"); | ||
703 | |||
704 | /* SYRQ is at offset 4 */ | ||
705 | tmp = (reg & AD_DS_WSMC_SYRQ) ? | ||
706 | (((reg & AD_DS_WSMC_SYRQ >> 4) & 0x01) ? 12 : 18) : 4; | ||
707 | tmp /= (reg & AD_DS_WSMC_WAST) ? 2 : 1; | ||
708 | |||
709 | snd_iprintf(buffer, "Synthesis FIFO: %d %s words\n\n", tmp, | ||
710 | (reg & AD_DS_WSMC_WAST) ? "stereo" : "mono"); | ||
711 | |||
712 | reg = ad1889_readw(chip, AD_DS_RAMC); | ||
713 | snd_iprintf(buffer, "ADC input: %s\n", | ||
714 | (reg & AD_DS_RAMC_ADEN) ? "enabled" : "disabled"); | ||
715 | snd_iprintf(buffer, "ADC Channels: %s\n", | ||
716 | (reg & AD_DS_RAMC_ADST) ? "stereo" : "mono"); | ||
717 | snd_iprintf(buffer, "ADC Quality: %d-bit linear\n", | ||
718 | (reg & AD_DS_RAMC_AD16) ? 16 : 8); | ||
719 | |||
720 | /* ACRQ is at offset 4 */ | ||
721 | tmp = (reg & AD_DS_RAMC_ACRQ) ? | ||
722 | (((reg & AD_DS_RAMC_ACRQ >> 4) & 0x01) ? 12 : 18) : 4; | ||
723 | tmp /= (reg & AD_DS_RAMC_ADST) ? 2 : 1; | ||
724 | |||
725 | snd_iprintf(buffer, "ADC FIFO: %d %s words\n\n", tmp, | ||
726 | (reg & AD_DS_RAMC_ADST) ? "stereo" : "mono"); | ||
727 | |||
728 | snd_iprintf(buffer, "Resampler input: %s\n", | ||
729 | reg & AD_DS_RAMC_REEN ? "enabled" : "disabled"); | ||
730 | |||
731 | /* RERQ is at offset 12 */ | ||
732 | tmp = (reg & AD_DS_RAMC_RERQ) ? | ||
733 | (((reg & AD_DS_RAMC_RERQ >> 12) & 0x01) ? 12 : 18) : 4; | ||
734 | tmp /= (reg & AD_DS_RAMC_ADST) ? 2 : 1; | ||
735 | |||
736 | snd_iprintf(buffer, "Resampler FIFO: %d %s words\n\n", tmp, | ||
737 | (reg & AD_DS_WSMC_WAST) ? "stereo" : "mono"); | ||
738 | |||
739 | |||
740 | /* doc says LSB represents -1.5dB, but the max value (-94.5dB) | ||
741 | suggests that LSB is -3dB, which is more coherent with the logarithmic | ||
742 | nature of the dB scale */ | ||
743 | reg = ad1889_readw(chip, AD_DS_WADA); | ||
744 | snd_iprintf(buffer, "Left: %s, -%d dB\n", | ||
745 | (reg & AD_DS_WADA_LWAM) ? "mute" : "unmute", | ||
746 | ((reg & AD_DS_WADA_LWAA) >> 8) * 3); | ||
747 | reg = ad1889_readw(chip, AD_DS_WADA); | ||
748 | snd_iprintf(buffer, "Right: %s, -%d dB\n", | ||
749 | (reg & AD_DS_WADA_RWAM) ? "mute" : "unmute", | ||
750 | ((reg & AD_DS_WADA_RWAA) >> 8) * 3); | ||
751 | |||
752 | reg = ad1889_readw(chip, AD_DS_WAS); | ||
753 | snd_iprintf(buffer, "Wave samplerate: %u Hz\n", reg); | ||
754 | reg = ad1889_readw(chip, AD_DS_RES); | ||
755 | snd_iprintf(buffer, "Resampler samplerate: %u Hz\n", reg); | ||
756 | } | ||
757 | |||
758 | static void __devinit | ||
759 | snd_ad1889_proc_init(struct snd_ad1889 *chip) | ||
760 | { | ||
761 | snd_info_entry_t *entry; | ||
762 | |||
763 | if (!snd_card_proc_new(chip->card, chip->card->driver, &entry)) | ||
764 | snd_info_set_text_ops(entry, chip, 1024, snd_ad1889_proc_read); | ||
765 | } | ||
766 | |||
767 | static struct ac97_quirk ac97_quirks[] = { | ||
768 | { | ||
769 | .subvendor = 0x11d4, /* AD */ | ||
770 | .subdevice = 0x1889, /* AD1889 */ | ||
771 | .codec_id = AC97_ID_AD1819, | ||
772 | .name = "AD1889", | ||
773 | .type = AC97_TUNE_HP_ONLY | ||
774 | }, | ||
775 | { } /* terminator */ | ||
776 | }; | ||
777 | |||
778 | static void __devinit | ||
779 | snd_ad1889_ac97_xinit(struct snd_ad1889 *chip) | ||
780 | { | ||
781 | u16 reg; | ||
782 | |||
783 | reg = ad1889_readw(chip, AD_AC97_ACIC); | ||
784 | reg |= AD_AC97_ACIC_ACRD; /* Reset Disable */ | ||
785 | ad1889_writew(chip, AD_AC97_ACIC, reg); | ||
786 | ad1889_readw(chip, AD_AC97_ACIC); /* flush posted write */ | ||
787 | udelay(10); | ||
788 | /* Interface Enable */ | ||
789 | reg |= AD_AC97_ACIC_ACIE; | ||
790 | ad1889_writew(chip, AD_AC97_ACIC, reg); | ||
791 | |||
792 | snd_ad1889_ac97_ready(chip); | ||
793 | |||
794 | /* Audio Stream Output | Variable Sample Rate Mode */ | ||
795 | reg = ad1889_readw(chip, AD_AC97_ACIC); | ||
796 | reg |= AD_AC97_ACIC_ASOE | AD_AC97_ACIC_VSRM; | ||
797 | ad1889_writew(chip, AD_AC97_ACIC, reg); | ||
798 | ad1889_readw(chip, AD_AC97_ACIC); /* flush posted write */ | ||
799 | |||
800 | } | ||
801 | |||
802 | static void | ||
803 | snd_ad1889_ac97_bus_free(ac97_bus_t *bus) | ||
804 | { | ||
805 | struct snd_ad1889 *chip = bus->private_data; | ||
806 | chip->ac97_bus = NULL; | ||
807 | } | ||
808 | |||
809 | static void | ||
810 | snd_ad1889_ac97_free(ac97_t *ac97) | ||
811 | { | ||
812 | struct snd_ad1889 *chip = ac97->private_data; | ||
813 | chip->ac97 = NULL; | ||
814 | } | ||
815 | |||
816 | static int __devinit | ||
817 | snd_ad1889_ac97_init(struct snd_ad1889 *chip, const char *quirk_override) | ||
818 | { | ||
819 | int err; | ||
820 | ac97_template_t ac97; | ||
821 | static ac97_bus_ops_t ops = { | ||
822 | .write = snd_ad1889_ac97_write, | ||
823 | .read = snd_ad1889_ac97_read, | ||
824 | }; | ||
825 | |||
826 | /* doing that here, it works. */ | ||
827 | snd_ad1889_ac97_xinit(chip); | ||
828 | |||
829 | err = snd_ac97_bus(chip->card, 0, &ops, chip, &chip->ac97_bus); | ||
830 | if (err < 0) | ||
831 | return err; | ||
832 | |||
833 | chip->ac97_bus->private_free = snd_ad1889_ac97_bus_free; | ||
834 | |||
835 | memset(&ac97, 0, sizeof(ac97)); | ||
836 | ac97.private_data = chip; | ||
837 | ac97.private_free = snd_ad1889_ac97_free; | ||
838 | ac97.pci = chip->pci; | ||
839 | |||
840 | err = snd_ac97_mixer(chip->ac97_bus, &ac97, &chip->ac97); | ||
841 | if (err < 0) | ||
842 | return err; | ||
843 | |||
844 | snd_ac97_tune_hardware(chip->ac97, ac97_quirks, quirk_override); | ||
845 | |||
846 | return 0; | ||
847 | } | ||
848 | |||
849 | static int | ||
850 | snd_ad1889_free(struct snd_ad1889 *chip) | ||
851 | { | ||
852 | if (chip->irq < 0) | ||
853 | goto skip_hw; | ||
854 | |||
855 | spin_lock_irq(&chip->lock); | ||
856 | |||
857 | ad1889_mute(chip); | ||
858 | |||
859 | /* Turn off interrupt on count and zero DMA registers */ | ||
860 | ad1889_channel_reset(chip, AD_CHAN_WAV | AD_CHAN_ADC); | ||
861 | |||
862 | /* clear DISR. If we don't, we'd better jump off the Eiffel Tower */ | ||
863 | ad1889_writel(chip, AD_DMA_DISR, AD_DMA_DISR_PTAI | AD_DMA_DISR_PMAI); | ||
864 | ad1889_readl(chip, AD_DMA_DISR); /* flush, dammit! */ | ||
865 | |||
866 | spin_unlock_irq(&chip->lock); | ||
867 | |||
868 | synchronize_irq(chip->irq); | ||
869 | |||
870 | if (chip->irq >= 0) | ||
871 | free_irq(chip->irq, (void*)chip); | ||
872 | |||
873 | skip_hw: | ||
874 | if (chip->iobase) | ||
875 | iounmap(chip->iobase); | ||
876 | |||
877 | pci_release_regions(chip->pci); | ||
878 | pci_disable_device(chip->pci); | ||
879 | |||
880 | kfree(chip); | ||
881 | return 0; | ||
882 | } | ||
883 | |||
884 | static inline int | ||
885 | snd_ad1889_dev_free(snd_device_t *device) | ||
886 | { | ||
887 | struct snd_ad1889 *chip = device->device_data; | ||
888 | return snd_ad1889_free(chip); | ||
889 | } | ||
890 | |||
891 | static int __devinit | ||
892 | snd_ad1889_init(struct snd_ad1889 *chip) | ||
893 | { | ||
894 | ad1889_writew(chip, AD_DS_CCS, AD_DS_CCS_CLKEN); /* turn on clock */ | ||
895 | ad1889_readw(chip, AD_DS_CCS); /* flush posted write */ | ||
896 | |||
897 | mdelay(10); | ||
898 | |||
899 | /* enable Master and Target abort interrupts */ | ||
900 | ad1889_writel(chip, AD_DMA_DISR, AD_DMA_DISR_PMAE | AD_DMA_DISR_PTAE); | ||
901 | |||
902 | return 0; | ||
903 | } | ||
904 | |||
905 | static int __devinit | ||
906 | snd_ad1889_create(snd_card_t *card, | ||
907 | struct pci_dev *pci, | ||
908 | struct snd_ad1889 **rchip) | ||
909 | { | ||
910 | int err; | ||
911 | |||
912 | struct snd_ad1889 *chip; | ||
913 | static snd_device_ops_t ops = { | ||
914 | .dev_free = snd_ad1889_dev_free, | ||
915 | }; | ||
916 | |||
917 | *rchip = NULL; | ||
918 | |||
919 | if ((err = pci_enable_device(pci)) < 0) | ||
920 | return err; | ||
921 | |||
922 | /* check PCI availability (32bit DMA) */ | ||
923 | if (pci_set_dma_mask(pci, 0xffffffff) < 0 || | ||
924 | pci_set_consistent_dma_mask(pci, 0xffffffff) < 0) { | ||
925 | printk(KERN_ERR PFX "error setting 32-bit DMA mask.\n"); | ||
926 | pci_disable_device(pci); | ||
927 | return -ENXIO; | ||
928 | } | ||
929 | |||
930 | /* allocate chip specific data with zero-filled memory */ | ||
931 | if ((chip = kzalloc(sizeof(*chip), GFP_KERNEL)) == NULL) { | ||
932 | pci_disable_device(pci); | ||
933 | return -ENOMEM; | ||
934 | } | ||
935 | |||
936 | chip->card = card; | ||
937 | card->private_data = chip; | ||
938 | chip->pci = pci; | ||
939 | chip->irq = -1; | ||
940 | |||
941 | /* (1) PCI resource allocation */ | ||
942 | if ((err = pci_request_regions(pci, card->driver)) < 0) | ||
943 | goto free_and_ret; | ||
944 | |||
945 | chip->bar = pci_resource_start(pci, 0); | ||
946 | chip->iobase = ioremap_nocache(chip->bar, pci_resource_len(pci, 0)); | ||
947 | if (chip->iobase == NULL) { | ||
948 | printk(KERN_ERR PFX "unable to reserve region.\n"); | ||
949 | err = -EBUSY; | ||
950 | goto free_and_ret; | ||
951 | } | ||
952 | |||
953 | pci_set_master(pci); | ||
954 | |||
955 | spin_lock_init(&chip->lock); /* only now can we call ad1889_free */ | ||
956 | |||
957 | if (request_irq(pci->irq, snd_ad1889_interrupt, | ||
958 | SA_INTERRUPT|SA_SHIRQ, card->driver, (void*)chip)) { | ||
959 | printk(KERN_ERR PFX "cannot obtain IRQ %d\n", pci->irq); | ||
960 | snd_ad1889_free(chip); | ||
961 | return -EBUSY; | ||
962 | } | ||
963 | |||
964 | chip->irq = pci->irq; | ||
965 | synchronize_irq(chip->irq); | ||
966 | |||
967 | /* (2) initialization of the chip hardware */ | ||
968 | if ((err = snd_ad1889_init(chip)) < 0) { | ||
969 | snd_ad1889_free(chip); | ||
970 | return err; | ||
971 | } | ||
972 | |||
973 | if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) { | ||
974 | snd_ad1889_free(chip); | ||
975 | return err; | ||
976 | } | ||
977 | |||
978 | snd_card_set_dev(card, &pci->dev); | ||
979 | |||
980 | *rchip = chip; | ||
981 | |||
982 | return 0; | ||
983 | |||
984 | free_and_ret: | ||
985 | if (chip) | ||
986 | kfree(chip); | ||
987 | pci_disable_device(pci); | ||
988 | |||
989 | return err; | ||
990 | } | ||
991 | |||
992 | static int __devinit | ||
993 | snd_ad1889_probe(struct pci_dev *pci, | ||
994 | const struct pci_device_id *pci_id) | ||
995 | { | ||
996 | int err; | ||
997 | static int devno; | ||
998 | snd_card_t *card; | ||
999 | struct snd_ad1889 *chip; | ||
1000 | |||
1001 | /* (1) */ | ||
1002 | if (devno >= SNDRV_CARDS) | ||
1003 | return -ENODEV; | ||
1004 | if (!enable[devno]) { | ||
1005 | devno++; | ||
1006 | return -ENOENT; | ||
1007 | } | ||
1008 | |||
1009 | /* (2) */ | ||
1010 | card = snd_card_new(index[devno], id[devno], THIS_MODULE, 0); | ||
1011 | /* XXX REVISIT: we can probably allocate chip in this call */ | ||
1012 | if (card == NULL) | ||
1013 | return -ENOMEM; | ||
1014 | |||
1015 | strcpy(card->driver, "AD1889"); | ||
1016 | strcpy(card->shortname, "Analog Devices AD1889"); | ||
1017 | |||
1018 | /* (3) */ | ||
1019 | err = snd_ad1889_create(card, pci, &chip); | ||
1020 | if (err < 0) | ||
1021 | goto free_and_ret; | ||
1022 | |||
1023 | /* (4) */ | ||
1024 | sprintf(card->longname, "%s at 0x%lx irq %i", | ||
1025 | card->shortname, chip->bar, chip->irq); | ||
1026 | |||
1027 | /* (5) */ | ||
1028 | /* register AC97 mixer */ | ||
1029 | err = snd_ad1889_ac97_init(chip, ac97_quirk[devno]); | ||
1030 | if (err < 0) | ||
1031 | goto free_and_ret; | ||
1032 | |||
1033 | err = snd_ad1889_pcm_init(chip, 0, NULL); | ||
1034 | if (err < 0) | ||
1035 | goto free_and_ret; | ||
1036 | |||
1037 | /* register proc interface */ | ||
1038 | snd_ad1889_proc_init(chip); | ||
1039 | |||
1040 | /* (6) */ | ||
1041 | err = snd_card_register(card); | ||
1042 | if (err < 0) | ||
1043 | goto free_and_ret; | ||
1044 | |||
1045 | /* (7) */ | ||
1046 | pci_set_drvdata(pci, card); | ||
1047 | |||
1048 | devno++; | ||
1049 | return 0; | ||
1050 | |||
1051 | free_and_ret: | ||
1052 | snd_card_free(card); | ||
1053 | return err; | ||
1054 | } | ||
1055 | |||
1056 | static void __devexit | ||
1057 | snd_ad1889_remove(struct pci_dev *pci) | ||
1058 | { | ||
1059 | snd_card_free(pci_get_drvdata(pci)); | ||
1060 | pci_set_drvdata(pci, NULL); | ||
1061 | } | ||
1062 | |||
1063 | static struct pci_device_id snd_ad1889_ids[] = { | ||
1064 | { PCI_DEVICE(PCI_VENDOR_ID_ANALOG_DEVICES, PCI_DEVICE_ID_AD1889JS) }, | ||
1065 | { 0, }, | ||
1066 | }; | ||
1067 | MODULE_DEVICE_TABLE(pci, snd_ad1889_ids); | ||
1068 | |||
1069 | static struct pci_driver ad1889_pci = { | ||
1070 | .name = "AD1889 Audio", | ||
1071 | .owner = THIS_MODULE, | ||
1072 | .id_table = snd_ad1889_ids, | ||
1073 | .probe = snd_ad1889_probe, | ||
1074 | .remove = __devexit_p(snd_ad1889_remove), | ||
1075 | }; | ||
1076 | |||
1077 | static int __init | ||
1078 | alsa_ad1889_init(void) | ||
1079 | { | ||
1080 | return pci_register_driver(&ad1889_pci); | ||
1081 | } | ||
1082 | |||
1083 | static void __exit | ||
1084 | alsa_ad1889_fini(void) | ||
1085 | { | ||
1086 | pci_unregister_driver(&ad1889_pci); | ||
1087 | } | ||
1088 | |||
1089 | module_init(alsa_ad1889_init); | ||
1090 | module_exit(alsa_ad1889_fini); | ||
diff --git a/sound/pci/ad1889.h b/sound/pci/ad1889.h new file mode 100644 index 000000000000..5e6dad5341a1 --- /dev/null +++ b/sound/pci/ad1889.h | |||
@@ -0,0 +1,189 @@ | |||
1 | /* Analog Devices 1889 audio driver | ||
2 | * Copyright (C) 2004, Kyle McMartin <kyle@parisc-linux.org> | ||
3 | */ | ||
4 | |||
5 | #ifndef __AD1889_H__ | ||
6 | #define __AD1889_H__ | ||
7 | |||
8 | #define AD_DS_WSMC 0x00 /* wave/synthesis channel mixer control */ | ||
9 | #define AD_DS_WSMC_SYEN 0x0004 /* synthesis channel enable */ | ||
10 | #define AD_DS_WSMC_SYRQ 0x0030 /* synth. fifo request point */ | ||
11 | #define AD_DS_WSMC_WA16 0x0100 /* wave channel 16bit select */ | ||
12 | #define AD_DS_WSMC_WAST 0x0200 /* wave channel stereo select */ | ||
13 | #define AD_DS_WSMC_WAEN 0x0400 /* wave channel enable */ | ||
14 | #define AD_DS_WSMC_WARQ 0x3000 /* wave fifo request point */ | ||
15 | |||
16 | #define AD_DS_RAMC 0x02 /* resampler/ADC channel mixer control */ | ||
17 | #define AD_DS_RAMC_AD16 0x0001 /* ADC channel 16bit select */ | ||
18 | #define AD_DS_RAMC_ADST 0x0002 /* ADC channel stereo select */ | ||
19 | #define AD_DS_RAMC_ADEN 0x0004 /* ADC channel enable */ | ||
20 | #define AD_DS_RAMC_ACRQ 0x0030 /* ADC fifo request point */ | ||
21 | #define AD_DS_RAMC_REEN 0x0400 /* resampler channel enable */ | ||
22 | #define AD_DS_RAMC_RERQ 0x3000 /* res. fifo request point */ | ||
23 | |||
24 | #define AD_DS_WADA 0x04 /* wave channel mix attenuation */ | ||
25 | #define AD_DS_WADA_RWAM 0x0080 /* right wave mute */ | ||
26 | #define AD_DS_WADA_RWAA 0x001f /* right wave attenuation */ | ||
27 | #define AD_DS_WADA_LWAM 0x8000 /* left wave mute */ | ||
28 | #define AD_DS_WADA_LWAA 0x3e00 /* left wave attenuation */ | ||
29 | |||
30 | #define AD_DS_SYDA 0x06 /* synthesis channel mix attenuation */ | ||
31 | #define AD_DS_SYDA_RSYM 0x0080 /* right synthesis mute */ | ||
32 | #define AD_DS_SYDA_RSYA 0x001f /* right synthesis attenuation */ | ||
33 | #define AD_DS_SYDA_LSYM 0x8000 /* left synthesis mute */ | ||
34 | #define AD_DS_SYDA_LSYA 0x3e00 /* left synthesis attenuation */ | ||
35 | |||
36 | #define AD_DS_WAS 0x08 /* wave channel sample rate */ | ||
37 | #define AD_DS_WAS_WAS 0xffff /* sample rate mask */ | ||
38 | |||
39 | #define AD_DS_RES 0x0a /* resampler channel sample rate */ | ||
40 | #define AD_DS_RES_RES 0xffff /* sample rate mask */ | ||
41 | |||
42 | #define AD_DS_CCS 0x0c /* chip control/status */ | ||
43 | #define AD_DS_CCS_ADO 0x0001 /* ADC channel overflow */ | ||
44 | #define AD_DS_CCS_REO 0x0002 /* resampler channel overflow */ | ||
45 | #define AD_DS_CCS_SYU 0x0004 /* synthesis channel underflow */ | ||
46 | #define AD_DS_CCS_WAU 0x0008 /* wave channel underflow */ | ||
47 | /* bits 4 -> 7, 9, 11 -> 14 reserved */ | ||
48 | #define AD_DS_CCS_XTD 0x0100 /* xtd delay control (4096 clock cycles) */ | ||
49 | #define AD_DS_CCS_PDALL 0x0400 /* power */ | ||
50 | #define AD_DS_CCS_CLKEN 0x8000 /* clock */ | ||
51 | |||
52 | #define AD_DMA_RESBA 0x40 /* RES base address */ | ||
53 | #define AD_DMA_RESCA 0x44 /* RES current address */ | ||
54 | #define AD_DMA_RESBC 0x48 /* RES base count */ | ||
55 | #define AD_DMA_RESCC 0x4c /* RES current count */ | ||
56 | |||
57 | #define AD_DMA_ADCBA 0x50 /* ADC base address */ | ||
58 | #define AD_DMA_ADCCA 0x54 /* ADC current address */ | ||
59 | #define AD_DMA_ADCBC 0x58 /* ADC base count */ | ||
60 | #define AD_DMA_ADCCC 0x5c /* ADC current count */ | ||
61 | |||
62 | #define AD_DMA_SYNBA 0x60 /* synth base address */ | ||
63 | #define AD_DMA_SYNCA 0x64 /* synth current address */ | ||
64 | #define AD_DMA_SYNBC 0x68 /* synth base count */ | ||
65 | #define AD_DMA_SYNCC 0x6c /* synth current count */ | ||
66 | |||
67 | #define AD_DMA_WAVBA 0x70 /* wave base address */ | ||
68 | #define AD_DMA_WAVCA 0x74 /* wave current address */ | ||
69 | #define AD_DMA_WAVBC 0x78 /* wave base count */ | ||
70 | #define AD_DMA_WAVCC 0x7c /* wave current count */ | ||
71 | |||
72 | #define AD_DMA_RESIC 0x80 /* RES dma interrupt current byte count */ | ||
73 | #define AD_DMA_RESIB 0x84 /* RES dma interrupt base byte count */ | ||
74 | |||
75 | #define AD_DMA_ADCIC 0x88 /* ADC dma interrupt current byte count */ | ||
76 | #define AD_DMA_ADCIB 0x8c /* ADC dma interrupt base byte count */ | ||
77 | |||
78 | #define AD_DMA_SYNIC 0x90 /* synth dma interrupt current byte count */ | ||
79 | #define AD_DMA_SYNIB 0x94 /* synth dma interrupt base byte count */ | ||
80 | |||
81 | #define AD_DMA_WAVIC 0x98 /* wave dma interrupt current byte count */ | ||
82 | #define AD_DMA_WAVIB 0x9c /* wave dma interrupt base byte count */ | ||
83 | |||
84 | #define AD_DMA_ICC 0xffffff /* current byte count mask */ | ||
85 | #define AD_DMA_IBC 0xffffff /* base byte count mask */ | ||
86 | /* bits 24 -> 31 reserved */ | ||
87 | |||
88 | /* 4 bytes pad */ | ||
89 | #define AD_DMA_ADC 0xa8 /* ADC dma control and status */ | ||
90 | #define AD_DMA_SYNTH 0xb0 /* Synth dma control and status */ | ||
91 | #define AD_DMA_WAV 0xb8 /* wave dma control and status */ | ||
92 | #define AD_DMA_RES 0xa0 /* Resample dma control and status */ | ||
93 | |||
94 | #define AD_DMA_SGDE 0x0001 /* SGD mode enable */ | ||
95 | #define AD_DMA_LOOP 0x0002 /* loop enable */ | ||
96 | #define AD_DMA_IM 0x000c /* interrupt mode mask */ | ||
97 | #define AD_DMA_IM_DIS (~AD_DMA_IM) /* disable */ | ||
98 | #define AD_DMA_IM_CNT 0x0004 /* interrupt on count */ | ||
99 | #define AD_DMA_IM_SGD 0x0008 /* interrupt on SGD flag */ | ||
100 | #define AD_DMA_IM_EOL 0x000c /* interrupt on End of Linked List */ | ||
101 | #define AD_DMA_SGDS 0x0030 /* SGD status */ | ||
102 | #define AD_DMA_SFLG 0x0040 /* SGD flag */ | ||
103 | #define AD_DMA_EOL 0x0080 /* SGD end of list */ | ||
104 | /* bits 8 -> 15 reserved */ | ||
105 | |||
106 | #define AD_DMA_DISR 0xc0 /* dma interrupt status */ | ||
107 | #define AD_DMA_DISR_RESI 0x000001 /* resampler channel interrupt */ | ||
108 | #define AD_DMA_DISR_ADCI 0x000002 /* ADC channel interrupt */ | ||
109 | #define AD_DMA_DISR_SYNI 0x000004 /* synthesis channel interrupt */ | ||
110 | #define AD_DMA_DISR_WAVI 0x000008 /* wave channel interrupt */ | ||
111 | /* bits 4, 5 reserved */ | ||
112 | #define AD_DMA_DISR_SEPS 0x000040 /* serial eeprom status */ | ||
113 | /* bits 7 -> 13 reserved */ | ||
114 | #define AD_DMA_DISR_PMAI 0x004000 /* pci master abort interrupt */ | ||
115 | #define AD_DMA_DISR_PTAI 0x008000 /* pci target abort interrupt */ | ||
116 | #define AD_DMA_DISR_PTAE 0x010000 /* pci target abort interrupt enable */ | ||
117 | #define AD_DMA_DISR_PMAE 0x020000 /* pci master abort interrupt enable */ | ||
118 | /* bits 19 -> 31 reserved */ | ||
119 | |||
120 | /* interrupt mask */ | ||
121 | #define AD_INTR_MASK (AD_DMA_DISR_RESI|AD_DMA_DISR_ADCI| \ | ||
122 | AD_DMA_DISR_WAVI|AD_DMA_DISR_SYNI| \ | ||
123 | AD_DMA_DISR_PMAI|AD_DMA_DISR_PTAI) | ||
124 | |||
125 | #define AD_DMA_CHSS 0xc4 /* dma channel stop status */ | ||
126 | #define AD_DMA_CHSS_RESS 0x000001 /* resampler channel stopped */ | ||
127 | #define AD_DMA_CHSS_ADCS 0x000002 /* ADC channel stopped */ | ||
128 | #define AD_DMA_CHSS_SYNS 0x000004 /* synthesis channel stopped */ | ||
129 | #define AD_DMA_CHSS_WAVS 0x000008 /* wave channel stopped */ | ||
130 | |||
131 | #define AD_GPIO_IPC 0xc8 /* gpio port control */ | ||
132 | #define AD_GPIO_OP 0xca /* gpio output port status */ | ||
133 | #define AD_GPIO_IP 0xcc /* gpio input port status */ | ||
134 | |||
135 | #define AD_AC97_BASE 0x100 /* ac97 base register */ | ||
136 | |||
137 | #define AD_AC97_RESET 0x100 /* reset */ | ||
138 | |||
139 | #define AD_AC97_PWR_CTL 0x126 /* == AC97_POWERDOWN */ | ||
140 | #define AD_AC97_PWR_ADC 0x0001 /* ADC ready status */ | ||
141 | #define AD_AC97_PWR_DAC 0x0002 /* DAC ready status */ | ||
142 | #define AD_AC97_PWR_PR0 0x0100 /* PR0 (ADC) powerdown */ | ||
143 | #define AD_AC97_PWR_PR1 0x0200 /* PR1 (DAC) powerdown */ | ||
144 | |||
145 | #define AD_MISC_CTL 0x176 /* misc control */ | ||
146 | #define AD_MISC_CTL_DACZ 0x8000 /* set for zero fill, unset for repeat */ | ||
147 | #define AD_MISC_CTL_ARSR 0x0001 /* set for SR1, unset for SR0 */ | ||
148 | #define AD_MISC_CTL_ALSR 0x0100 | ||
149 | #define AD_MISC_CTL_DLSR 0x0400 | ||
150 | #define AD_MISC_CTL_DRSR 0x0004 | ||
151 | |||
152 | #define AD_AC97_SR0 0x178 /* sample rate 0, 0xbb80 == 48K */ | ||
153 | #define AD_AC97_SR0_48K 0xbb80 /* 48KHz */ | ||
154 | #define AD_AC97_SR1 0x17a /* sample rate 1 */ | ||
155 | |||
156 | #define AD_AC97_ACIC 0x180 /* ac97 codec interface control */ | ||
157 | #define AD_AC97_ACIC_ACIE 0x0001 /* analog codec interface enable */ | ||
158 | #define AD_AC97_ACIC_ACRD 0x0002 /* analog codec reset disable */ | ||
159 | #define AD_AC97_ACIC_ASOE 0x0004 /* audio stream output enable */ | ||
160 | #define AD_AC97_ACIC_VSRM 0x0008 /* variable sample rate mode */ | ||
161 | #define AD_AC97_ACIC_FSDH 0x0100 /* force SDATA_OUT high */ | ||
162 | #define AD_AC97_ACIC_FSYH 0x0200 /* force sync high */ | ||
163 | #define AD_AC97_ACIC_ACRDY 0x8000 /* analog codec ready status */ | ||
164 | /* bits 10 -> 14 reserved */ | ||
165 | |||
166 | |||
167 | #define AD_DS_MEMSIZE 512 | ||
168 | #define AD_OPL_MEMSIZE 16 | ||
169 | #define AD_MIDI_MEMSIZE 16 | ||
170 | |||
171 | #define AD_WAV_STATE 0 | ||
172 | #define AD_ADC_STATE 1 | ||
173 | #define AD_MAX_STATES 2 | ||
174 | |||
175 | #define AD_CHAN_WAV 0x0001 | ||
176 | #define AD_CHAN_ADC 0x0002 | ||
177 | #define AD_CHAN_RES 0x0004 | ||
178 | #define AD_CHAN_SYN 0x0008 | ||
179 | |||
180 | |||
181 | /* The chip would support 4 GB buffers and 16 MB periods, | ||
182 | * but let's not overdo it ... */ | ||
183 | #define BUFFER_BYTES_MAX (256 * 1024) | ||
184 | #define PERIOD_BYTES_MIN 32 | ||
185 | #define PERIOD_BYTES_MAX (BUFFER_BYTES_MAX / 2) | ||
186 | #define PERIODS_MIN 2 | ||
187 | #define PERIODS_MAX (BUFFER_BYTES_MAX / PERIOD_BYTES_MIN) | ||
188 | |||
189 | #endif /* __AD1889_H__ */ | ||
diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c index f08ae71f902d..f35b558c29b2 100644 --- a/sound/pci/ali5451/ali5451.c +++ b/sound/pci/ali5451/ali5451.c | |||
@@ -78,15 +78,7 @@ MODULE_PARM_DESC(spdif, "Support SPDIF I/O"); | |||
78 | * Constants definition | 78 | * Constants definition |
79 | */ | 79 | */ |
80 | 80 | ||
81 | #ifndef PCI_VENDOR_ID_ALI | 81 | #define DEVICE_ID_ALI5451 ((PCI_VENDOR_ID_AL<<16)|PCI_DEVICE_ID_AL_M5451) |
82 | #define PCI_VENDOR_ID_ALI 0x10b9 | ||
83 | #endif | ||
84 | |||
85 | #ifndef PCI_DEVICE_ID_ALI_5451 | ||
86 | #define PCI_DEVICE_ID_ALI_5451 0x5451 | ||
87 | #endif | ||
88 | |||
89 | #define DEVICE_ID_ALI5451 ((PCI_VENDOR_ID_ALI<<16)|PCI_DEVICE_ID_ALI_5451) | ||
90 | 82 | ||
91 | 83 | ||
92 | #define ALI_CHANNELS 32 | 84 | #define ALI_CHANNELS 32 |
@@ -326,13 +318,12 @@ static void ali_read_regs(ali_t *codec, int channel) | |||
326 | static void ali_read_cfg(unsigned int vendor, unsigned deviceid) | 318 | static void ali_read_cfg(unsigned int vendor, unsigned deviceid) |
327 | { | 319 | { |
328 | unsigned int dwVal; | 320 | unsigned int dwVal; |
329 | struct pci_dev *pci_dev = NULL; | 321 | struct pci_dev *pci_dev; |
330 | int i,j; | 322 | int i,j; |
331 | 323 | ||
332 | 324 | pci_dev = pci_get_device(vendor, deviceid, NULL); | |
333 | pci_dev = pci_find_device(vendor, deviceid, pci_dev); | 325 | if (pci_dev == NULL) |
334 | if (pci_dev == NULL) | 326 | return ; |
335 | return ; | ||
336 | 327 | ||
337 | printk("\nM%x PCI CFG\n", deviceid); | 328 | printk("\nM%x PCI CFG\n", deviceid); |
338 | printk(" "); | 329 | printk(" "); |
@@ -349,6 +340,7 @@ static void ali_read_cfg(unsigned int vendor, unsigned deviceid) | |||
349 | } | 340 | } |
350 | printk("\n"); | 341 | printk("\n"); |
351 | } | 342 | } |
343 | pci_dev_put(pci_dev); | ||
352 | } | 344 | } |
353 | static void ali_read_ac97regs(ali_t *codec, int secondary) | 345 | static void ali_read_ac97regs(ali_t *codec, int secondary) |
354 | { | 346 | { |
@@ -1842,7 +1834,7 @@ static int __devinit snd_ali_pcm(ali_t * codec, int device, struct ali_pcm_descr | |||
1842 | return 0; | 1834 | return 0; |
1843 | } | 1835 | } |
1844 | 1836 | ||
1845 | struct ali_pcm_description ali_pcms[] = { | 1837 | static struct ali_pcm_description ali_pcms[] = { |
1846 | { "ALI 5451", ALI_CHANNELS, 1, &snd_ali_playback_ops, &snd_ali_capture_ops }, | 1838 | { "ALI 5451", ALI_CHANNELS, 1, &snd_ali_playback_ops, &snd_ali_capture_ops }, |
1847 | { "ALI 5451 modem", 1, 1, &snd_ali_modem_playback_ops, &snd_ali_modem_capture_ops } | 1839 | { "ALI 5451 modem", 1, 1, &snd_ali_modem_playback_ops, &snd_ali_modem_capture_ops } |
1848 | }; | 1840 | }; |
@@ -1959,9 +1951,9 @@ static int snd_ali5451_spdif_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t | |||
1959 | static snd_kcontrol_new_t snd_ali5451_mixer_spdif[] __devinitdata = { | 1951 | static snd_kcontrol_new_t snd_ali5451_mixer_spdif[] __devinitdata = { |
1960 | /* spdif aplayback switch */ | 1952 | /* spdif aplayback switch */ |
1961 | /* FIXME: "IEC958 Playback Switch" may conflict with one on ac97_codec */ | 1953 | /* FIXME: "IEC958 Playback Switch" may conflict with one on ac97_codec */ |
1962 | ALI5451_SPDIF("IEC958 Output switch", 0, 0), | 1954 | ALI5451_SPDIF(SNDRV_CTL_NAME_IEC958("Output ",NONE,SWITCH), 0, 0), |
1963 | /* spdif out to spdif channel */ | 1955 | /* spdif out to spdif channel */ |
1964 | ALI5451_SPDIF("IEC958 Channel Output Switch", 0, 1), | 1956 | ALI5451_SPDIF(SNDRV_CTL_NAME_IEC958("Channel Output ",NONE,SWITCH), 0, 1), |
1965 | /* spdif in from spdif channel */ | 1957 | /* spdif in from spdif channel */ |
1966 | ALI5451_SPDIF(SNDRV_CTL_NAME_IEC958("",CAPTURE,SWITCH), 0, 2) | 1958 | ALI5451_SPDIF(SNDRV_CTL_NAME_IEC958("",CAPTURE,SWITCH), 0, 2) |
1967 | }; | 1959 | }; |
@@ -2001,8 +1993,10 @@ static int __devinit snd_ali_mixer(ali_t * codec) | |||
2001 | if ((err = snd_ac97_mixer(codec->ac97_bus, &ac97, &codec->ac97[i])) < 0) { | 1993 | if ((err = snd_ac97_mixer(codec->ac97_bus, &ac97, &codec->ac97[i])) < 0) { |
2002 | snd_printk("ali mixer %d creating error.\n", i); | 1994 | snd_printk("ali mixer %d creating error.\n", i); |
2003 | if(i == 0) | 1995 | if(i == 0) |
2004 | return err; | 1996 | return err; |
2005 | } | 1997 | codec->num_of_codecs = 1; |
1998 | break; | ||
1999 | } | ||
2006 | } | 2000 | } |
2007 | 2001 | ||
2008 | if (codec->spdif_support) { | 2002 | if (codec->spdif_support) { |
@@ -2116,6 +2110,8 @@ static int snd_ali_free(ali_t * codec) | |||
2116 | #ifdef CONFIG_PM | 2110 | #ifdef CONFIG_PM |
2117 | kfree(codec->image); | 2111 | kfree(codec->image); |
2118 | #endif | 2112 | #endif |
2113 | pci_dev_put(codec->pci_m1533); | ||
2114 | pci_dev_put(codec->pci_m7101); | ||
2119 | kfree(codec); | 2115 | kfree(codec); |
2120 | return 0; | 2116 | return 0; |
2121 | } | 2117 | } |
@@ -2249,7 +2245,7 @@ static int __devinit snd_ali_create(snd_card_t * card, | |||
2249 | return -ENXIO; | 2245 | return -ENXIO; |
2250 | } | 2246 | } |
2251 | 2247 | ||
2252 | if ((codec = kcalloc(1, sizeof(*codec), GFP_KERNEL)) == NULL) { | 2248 | if ((codec = kzalloc(sizeof(*codec), GFP_KERNEL)) == NULL) { |
2253 | pci_disable_device(pci); | 2249 | pci_disable_device(pci); |
2254 | return -ENOMEM; | 2250 | return -ENOMEM; |
2255 | } | 2251 | } |
@@ -2305,7 +2301,7 @@ static int __devinit snd_ali_create(snd_card_t * card, | |||
2305 | codec->chregs.data.ainten = 0x00; | 2301 | codec->chregs.data.ainten = 0x00; |
2306 | 2302 | ||
2307 | /* M1533: southbridge */ | 2303 | /* M1533: southbridge */ |
2308 | pci_dev = pci_find_device(0x10b9, 0x1533, NULL); | 2304 | pci_dev = pci_get_device(0x10b9, 0x1533, NULL); |
2309 | codec->pci_m1533 = pci_dev; | 2305 | codec->pci_m1533 = pci_dev; |
2310 | if (! codec->pci_m1533) { | 2306 | if (! codec->pci_m1533) { |
2311 | snd_printk(KERN_ERR "ali5451: cannot find ALi 1533 chip.\n"); | 2307 | snd_printk(KERN_ERR "ali5451: cannot find ALi 1533 chip.\n"); |
@@ -2313,7 +2309,7 @@ static int __devinit snd_ali_create(snd_card_t * card, | |||
2313 | return -ENODEV; | 2309 | return -ENODEV; |
2314 | } | 2310 | } |
2315 | /* M7101: power management */ | 2311 | /* M7101: power management */ |
2316 | pci_dev = pci_find_device(0x10b9, 0x7101, NULL); | 2312 | pci_dev = pci_get_device(0x10b9, 0x7101, NULL); |
2317 | codec->pci_m7101 = pci_dev; | 2313 | codec->pci_m7101 = pci_dev; |
2318 | if (! codec->pci_m7101 && codec->revision == ALI_5451_V02) { | 2314 | if (! codec->pci_m7101 && codec->revision == ALI_5451_V02) { |
2319 | snd_printk(KERN_ERR "ali5451: cannot find ALi 7101 chip.\n"); | 2315 | snd_printk(KERN_ERR "ali5451: cannot find ALi 7101 chip.\n"); |
@@ -2417,6 +2413,7 @@ static void __devexit snd_ali_remove(struct pci_dev *pci) | |||
2417 | 2413 | ||
2418 | static struct pci_driver driver = { | 2414 | static struct pci_driver driver = { |
2419 | .name = "ALI 5451", | 2415 | .name = "ALI 5451", |
2416 | .owner = THIS_MODULE, | ||
2420 | .id_table = snd_ali_ids, | 2417 | .id_table = snd_ali_ids, |
2421 | .probe = snd_ali_probe, | 2418 | .probe = snd_ali_probe, |
2422 | .remove = __devexit_p(snd_ali_remove), | 2419 | .remove = __devexit_p(snd_ali_remove), |
diff --git a/sound/pci/als4000.c b/sound/pci/als4000.c index ca28b229c704..196ec1c61bb4 100644 --- a/sound/pci/als4000.c +++ b/sound/pci/als4000.c | |||
@@ -770,6 +770,7 @@ static void __devexit snd_card_als4000_remove(struct pci_dev *pci) | |||
770 | 770 | ||
771 | static struct pci_driver driver = { | 771 | static struct pci_driver driver = { |
772 | .name = "ALS4000", | 772 | .name = "ALS4000", |
773 | .owner = THIS_MODULE, | ||
773 | .id_table = snd_als4000_ids, | 774 | .id_table = snd_als4000_ids, |
774 | .probe = snd_card_als4000_probe, | 775 | .probe = snd_card_als4000_probe, |
775 | .remove = __devexit_p(snd_card_als4000_remove), | 776 | .remove = __devexit_p(snd_card_als4000_remove), |
diff --git a/sound/pci/atiixp.c b/sound/pci/atiixp.c index cafab4af5c57..241eacf1e652 100644 --- a/sound/pci/atiixp.c +++ b/sound/pci/atiixp.c | |||
@@ -248,6 +248,7 @@ struct snd_atiixp_dma { | |||
248 | unsigned int period_bytes, periods; | 248 | unsigned int period_bytes, periods; |
249 | int opened; | 249 | int opened; |
250 | int running; | 250 | int running; |
251 | int suspended; | ||
251 | int pcm_open_flag; | 252 | int pcm_open_flag; |
252 | int ac97_pcm_type; /* index # of ac97_pcm to access, -1 = not used */ | 253 | int ac97_pcm_type; /* index # of ac97_pcm to access, -1 = not used */ |
253 | unsigned int saved_curptr; | 254 | unsigned int saved_curptr; |
@@ -699,12 +700,18 @@ static int snd_atiixp_pcm_trigger(snd_pcm_substream_t *substream, int cmd) | |||
699 | spin_lock(&chip->reg_lock); | 700 | spin_lock(&chip->reg_lock); |
700 | switch (cmd) { | 701 | switch (cmd) { |
701 | case SNDRV_PCM_TRIGGER_START: | 702 | case SNDRV_PCM_TRIGGER_START: |
703 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: | ||
704 | case SNDRV_PCM_TRIGGER_RESUME: | ||
702 | dma->ops->enable_transfer(chip, 1); | 705 | dma->ops->enable_transfer(chip, 1); |
703 | dma->running = 1; | 706 | dma->running = 1; |
707 | dma->suspended = 0; | ||
704 | break; | 708 | break; |
705 | case SNDRV_PCM_TRIGGER_STOP: | 709 | case SNDRV_PCM_TRIGGER_STOP: |
710 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: | ||
711 | case SNDRV_PCM_TRIGGER_SUSPEND: | ||
706 | dma->ops->enable_transfer(chip, 0); | 712 | dma->ops->enable_transfer(chip, 0); |
707 | dma->running = 0; | 713 | dma->running = 0; |
714 | dma->suspended = cmd == SNDRV_PCM_TRIGGER_SUSPEND; | ||
708 | break; | 715 | break; |
709 | default: | 716 | default: |
710 | err = -EINVAL; | 717 | err = -EINVAL; |
@@ -975,6 +982,7 @@ static snd_pcm_hardware_t snd_atiixp_pcm_hw = | |||
975 | { | 982 | { |
976 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | | 983 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | |
977 | SNDRV_PCM_INFO_BLOCK_TRANSFER | | 984 | SNDRV_PCM_INFO_BLOCK_TRANSFER | |
985 | SNDRV_PCM_INFO_PAUSE | | ||
978 | SNDRV_PCM_INFO_RESUME | | 986 | SNDRV_PCM_INFO_RESUME | |
979 | SNDRV_PCM_INFO_MMAP_VALID), | 987 | SNDRV_PCM_INFO_MMAP_VALID), |
980 | .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S32_LE, | 988 | .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S32_LE, |
@@ -1419,7 +1427,7 @@ static int snd_atiixp_suspend(snd_card_t *card, pm_message_t state) | |||
1419 | snd_atiixp_aclink_down(chip); | 1427 | snd_atiixp_aclink_down(chip); |
1420 | snd_atiixp_chip_stop(chip); | 1428 | snd_atiixp_chip_stop(chip); |
1421 | 1429 | ||
1422 | pci_set_power_state(chip->pci, 3); | 1430 | pci_set_power_state(chip->pci, PCI_D3hot); |
1423 | pci_disable_device(chip->pci); | 1431 | pci_disable_device(chip->pci); |
1424 | return 0; | 1432 | return 0; |
1425 | } | 1433 | } |
@@ -1430,7 +1438,7 @@ static int snd_atiixp_resume(snd_card_t *card) | |||
1430 | int i; | 1438 | int i; |
1431 | 1439 | ||
1432 | pci_enable_device(chip->pci); | 1440 | pci_enable_device(chip->pci); |
1433 | pci_set_power_state(chip->pci, 0); | 1441 | pci_set_power_state(chip->pci, PCI_D0); |
1434 | pci_set_master(chip->pci); | 1442 | pci_set_master(chip->pci); |
1435 | 1443 | ||
1436 | snd_atiixp_aclink_reset(chip); | 1444 | snd_atiixp_aclink_reset(chip); |
@@ -1443,8 +1451,9 @@ static int snd_atiixp_resume(snd_card_t *card) | |||
1443 | for (i = 0; i < NUM_ATI_PCMDEVS; i++) | 1451 | for (i = 0; i < NUM_ATI_PCMDEVS; i++) |
1444 | if (chip->pcmdevs[i]) { | 1452 | if (chip->pcmdevs[i]) { |
1445 | atiixp_dma_t *dma = &chip->dmas[i]; | 1453 | atiixp_dma_t *dma = &chip->dmas[i]; |
1446 | if (dma->substream && dma->running) { | 1454 | if (dma->substream && dma->suspended) { |
1447 | dma->ops->enable_dma(chip, 1); | 1455 | dma->ops->enable_dma(chip, 1); |
1456 | dma->substream->ops->prepare(dma->substream); | ||
1448 | writel((u32)dma->desc_buf.addr | ATI_REG_LINKPTR_EN, | 1457 | writel((u32)dma->desc_buf.addr | ATI_REG_LINKPTR_EN, |
1449 | chip->remap_addr + dma->ops->llp_offset); | 1458 | chip->remap_addr + dma->ops->llp_offset); |
1450 | writel(dma->saved_curptr, chip->remap_addr + dma->ops->dt_cur); | 1459 | writel(dma->saved_curptr, chip->remap_addr + dma->ops->dt_cur); |
@@ -1522,7 +1531,7 @@ static int __devinit snd_atiixp_create(snd_card_t *card, | |||
1522 | if ((err = pci_enable_device(pci)) < 0) | 1531 | if ((err = pci_enable_device(pci)) < 0) |
1523 | return err; | 1532 | return err; |
1524 | 1533 | ||
1525 | chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); | 1534 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); |
1526 | if (chip == NULL) { | 1535 | if (chip == NULL) { |
1527 | pci_disable_device(pci); | 1536 | pci_disable_device(pci); |
1528 | return -ENOMEM; | 1537 | return -ENOMEM; |
@@ -1636,6 +1645,7 @@ static void __devexit snd_atiixp_remove(struct pci_dev *pci) | |||
1636 | 1645 | ||
1637 | static struct pci_driver driver = { | 1646 | static struct pci_driver driver = { |
1638 | .name = "ATI IXP AC97 controller", | 1647 | .name = "ATI IXP AC97 controller", |
1648 | .owner = THIS_MODULE, | ||
1639 | .id_table = snd_atiixp_ids, | 1649 | .id_table = snd_atiixp_ids, |
1640 | .probe = snd_atiixp_probe, | 1650 | .probe = snd_atiixp_probe, |
1641 | .remove = __devexit_p(snd_atiixp_remove), | 1651 | .remove = __devexit_p(snd_atiixp_remove), |
diff --git a/sound/pci/atiixp_modem.c b/sound/pci/atiixp_modem.c index 8d2002951bd7..c1a239a4dac6 100644 --- a/sound/pci/atiixp_modem.c +++ b/sound/pci/atiixp_modem.c | |||
@@ -405,7 +405,7 @@ static int snd_atiixp_acquire_codec(atiixp_t *chip) | |||
405 | 405 | ||
406 | while (atiixp_read(chip, PHYS_OUT_ADDR) & ATI_REG_PHYS_OUT_ADDR_EN) { | 406 | while (atiixp_read(chip, PHYS_OUT_ADDR) & ATI_REG_PHYS_OUT_ADDR_EN) { |
407 | if (! timeout--) { | 407 | if (! timeout--) { |
408 | snd_printk(KERN_WARNING "atiixp: codec acquire timeout\n"); | 408 | snd_printk(KERN_WARNING "atiixp-modem: codec acquire timeout\n"); |
409 | return -EBUSY; | 409 | return -EBUSY; |
410 | } | 410 | } |
411 | udelay(1); | 411 | udelay(1); |
@@ -436,7 +436,7 @@ static unsigned short snd_atiixp_codec_read(atiixp_t *chip, unsigned short codec | |||
436 | } while (--timeout); | 436 | } while (--timeout); |
437 | /* time out may happen during reset */ | 437 | /* time out may happen during reset */ |
438 | if (reg < 0x7c) | 438 | if (reg < 0x7c) |
439 | snd_printk(KERN_WARNING "atiixp: codec read timeout (reg %x)\n", reg); | 439 | snd_printk(KERN_WARNING "atiixp-modem: codec read timeout (reg %x)\n", reg); |
440 | return 0xffff; | 440 | return 0xffff; |
441 | } | 441 | } |
442 | 442 | ||
@@ -498,7 +498,7 @@ static int snd_atiixp_aclink_reset(atiixp_t *chip) | |||
498 | do_delay(); | 498 | do_delay(); |
499 | atiixp_update(chip, CMD, ATI_REG_CMD_AC_RESET, ATI_REG_CMD_AC_RESET); | 499 | atiixp_update(chip, CMD, ATI_REG_CMD_AC_RESET, ATI_REG_CMD_AC_RESET); |
500 | if (--timeout) { | 500 | if (--timeout) { |
501 | snd_printk(KERN_ERR "atiixp: codec reset timeout\n"); | 501 | snd_printk(KERN_ERR "atiixp-modem: codec reset timeout\n"); |
502 | break; | 502 | break; |
503 | } | 503 | } |
504 | } | 504 | } |
@@ -552,7 +552,7 @@ static int snd_atiixp_codec_detect(atiixp_t *chip) | |||
552 | atiixp_write(chip, IER, 0); /* disable irqs */ | 552 | atiixp_write(chip, IER, 0); /* disable irqs */ |
553 | 553 | ||
554 | if ((chip->codec_not_ready_bits & ALL_CODEC_NOT_READY) == ALL_CODEC_NOT_READY) { | 554 | if ((chip->codec_not_ready_bits & ALL_CODEC_NOT_READY) == ALL_CODEC_NOT_READY) { |
555 | snd_printk(KERN_ERR "atiixp: no codec detected!\n"); | 555 | snd_printk(KERN_ERR "atiixp-modem: no codec detected!\n"); |
556 | return -ENXIO; | 556 | return -ENXIO; |
557 | } | 557 | } |
558 | return 0; | 558 | return 0; |
@@ -635,7 +635,7 @@ static void snd_atiixp_xrun_dma(atiixp_t *chip, atiixp_dma_t *dma) | |||
635 | { | 635 | { |
636 | if (! dma->substream || ! dma->running) | 636 | if (! dma->substream || ! dma->running) |
637 | return; | 637 | return; |
638 | snd_printdd("atiixp: XRUN detected (DMA %d)\n", dma->ops->type); | 638 | snd_printdd("atiixp-modem: XRUN detected (DMA %d)\n", dma->ops->type); |
639 | snd_pcm_stop(dma->substream, SNDRV_PCM_STATE_XRUN); | 639 | snd_pcm_stop(dma->substream, SNDRV_PCM_STATE_XRUN); |
640 | } | 640 | } |
641 | 641 | ||
@@ -1081,14 +1081,14 @@ static int __devinit snd_atiixp_mixer_new(atiixp_t *chip, int clock) | |||
1081 | ac97.scaps = AC97_SCAP_SKIP_AUDIO; | 1081 | ac97.scaps = AC97_SCAP_SKIP_AUDIO; |
1082 | if ((err = snd_ac97_mixer(pbus, &ac97, &chip->ac97[i])) < 0) { | 1082 | if ((err = snd_ac97_mixer(pbus, &ac97, &chip->ac97[i])) < 0) { |
1083 | chip->ac97[i] = NULL; /* to be sure */ | 1083 | chip->ac97[i] = NULL; /* to be sure */ |
1084 | snd_printdd("atiixp: codec %d not available for modem\n", i); | 1084 | snd_printdd("atiixp-modem: codec %d not available for modem\n", i); |
1085 | continue; | 1085 | continue; |
1086 | } | 1086 | } |
1087 | codec_count++; | 1087 | codec_count++; |
1088 | } | 1088 | } |
1089 | 1089 | ||
1090 | if (! codec_count) { | 1090 | if (! codec_count) { |
1091 | snd_printk(KERN_ERR "atiixp: no codec available\n"); | 1091 | snd_printk(KERN_ERR "atiixp-modem: no codec available\n"); |
1092 | return -ENODEV; | 1092 | return -ENODEV; |
1093 | } | 1093 | } |
1094 | 1094 | ||
@@ -1159,7 +1159,7 @@ static void __devinit snd_atiixp_proc_init(atiixp_t *chip) | |||
1159 | { | 1159 | { |
1160 | snd_info_entry_t *entry; | 1160 | snd_info_entry_t *entry; |
1161 | 1161 | ||
1162 | if (! snd_card_proc_new(chip->card, "atiixp", &entry)) | 1162 | if (! snd_card_proc_new(chip->card, "atiixp-modem", &entry)) |
1163 | snd_info_set_text_ops(entry, chip, 1024, snd_atiixp_proc_read); | 1163 | snd_info_set_text_ops(entry, chip, 1024, snd_atiixp_proc_read); |
1164 | } | 1164 | } |
1165 | 1165 | ||
@@ -1208,7 +1208,7 @@ static int __devinit snd_atiixp_create(snd_card_t *card, | |||
1208 | if ((err = pci_enable_device(pci)) < 0) | 1208 | if ((err = pci_enable_device(pci)) < 0) |
1209 | return err; | 1209 | return err; |
1210 | 1210 | ||
1211 | chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); | 1211 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); |
1212 | if (chip == NULL) { | 1212 | if (chip == NULL) { |
1213 | pci_disable_device(pci); | 1213 | pci_disable_device(pci); |
1214 | return -ENOMEM; | 1214 | return -ENOMEM; |
@@ -1318,6 +1318,7 @@ static void __devexit snd_atiixp_remove(struct pci_dev *pci) | |||
1318 | 1318 | ||
1319 | static struct pci_driver driver = { | 1319 | static struct pci_driver driver = { |
1320 | .name = "ATI IXP MC97 controller", | 1320 | .name = "ATI IXP MC97 controller", |
1321 | .owner = THIS_MODULE, | ||
1321 | .id_table = snd_atiixp_ids, | 1322 | .id_table = snd_atiixp_ids, |
1322 | .probe = snd_atiixp_probe, | 1323 | .probe = snd_atiixp_probe, |
1323 | .remove = __devexit_p(snd_atiixp_remove), | 1324 | .remove = __devexit_p(snd_atiixp_remove), |
diff --git a/sound/pci/au88x0/au88x0.c b/sound/pci/au88x0/au88x0.c index f6236c63aaaa..04b695d6fd48 100644 --- a/sound/pci/au88x0/au88x0.c +++ b/sound/pci/au88x0/au88x0.c | |||
@@ -79,19 +79,21 @@ static void vortex_fix_agp_bridge(struct pci_dev *via) | |||
79 | 79 | ||
80 | static void __devinit snd_vortex_workaround(struct pci_dev *vortex, int fix) | 80 | static void __devinit snd_vortex_workaround(struct pci_dev *vortex, int fix) |
81 | { | 81 | { |
82 | struct pci_dev *via; | 82 | struct pci_dev *via = NULL; |
83 | 83 | ||
84 | /* autodetect if workarounds are required */ | 84 | /* autodetect if workarounds are required */ |
85 | if (fix == 255) { | 85 | if (fix == 255) { |
86 | /* VIA KT133 */ | 86 | /* VIA KT133 */ |
87 | via = pci_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8365_1, NULL); | 87 | via = pci_get_device(PCI_VENDOR_ID_VIA, |
88 | PCI_DEVICE_ID_VIA_8365_1, NULL); | ||
88 | /* VIA Apollo */ | 89 | /* VIA Apollo */ |
89 | if (via == NULL) { | 90 | if (via == NULL) { |
90 | via = pci_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C598_1, NULL); | 91 | via = pci_get_device(PCI_VENDOR_ID_VIA, |
91 | } | 92 | PCI_DEVICE_ID_VIA_82C598_1, NULL); |
92 | /* AMD Irongate */ | 93 | /* AMD Irongate */ |
93 | if (via == NULL) { | 94 | if (via == NULL) |
94 | via = pci_find_device(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_FE_GATE_7007, NULL); | 95 | via = pci_get_device(PCI_VENDOR_ID_AMD, |
96 | PCI_DEVICE_ID_AMD_FE_GATE_7007, NULL); | ||
95 | } | 97 | } |
96 | if (via) { | 98 | if (via) { |
97 | printk(KERN_INFO CARD_NAME ": Activating latency workaround...\n"); | 99 | printk(KERN_INFO CARD_NAME ": Activating latency workaround...\n"); |
@@ -101,13 +103,17 @@ static void __devinit snd_vortex_workaround(struct pci_dev *vortex, int fix) | |||
101 | } else { | 103 | } else { |
102 | if (fix & 0x1) | 104 | if (fix & 0x1) |
103 | vortex_fix_latency(vortex); | 105 | vortex_fix_latency(vortex); |
104 | if ((fix & 0x2) && (via = pci_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8365_1, NULL))) | 106 | if ((fix & 0x2) && (via = pci_get_device(PCI_VENDOR_ID_VIA, |
107 | PCI_DEVICE_ID_VIA_8365_1, NULL))) | ||
105 | vortex_fix_agp_bridge(via); | 108 | vortex_fix_agp_bridge(via); |
106 | if ((fix & 0x4) && (via = pci_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C598_1, NULL))) | 109 | if ((fix & 0x4) && (via = pci_get_device(PCI_VENDOR_ID_VIA, |
110 | PCI_DEVICE_ID_VIA_82C598_1, NULL))) | ||
107 | vortex_fix_agp_bridge(via); | 111 | vortex_fix_agp_bridge(via); |
108 | if ((fix & 0x8) && (via = pci_find_device(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_FE_GATE_7007, NULL))) | 112 | if ((fix & 0x8) && (via = pci_get_device(PCI_VENDOR_ID_AMD, |
113 | PCI_DEVICE_ID_AMD_FE_GATE_7007, NULL))) | ||
109 | vortex_fix_agp_bridge(via); | 114 | vortex_fix_agp_bridge(via); |
110 | } | 115 | } |
116 | pci_dev_put(via); | ||
111 | } | 117 | } |
112 | 118 | ||
113 | // component-destructor | 119 | // component-destructor |
@@ -150,7 +156,7 @@ snd_vortex_create(snd_card_t * card, struct pci_dev *pci, vortex_t ** rchip) | |||
150 | } | 156 | } |
151 | pci_set_dma_mask(pci, VORTEX_DMA_MASK); | 157 | pci_set_dma_mask(pci, VORTEX_DMA_MASK); |
152 | 158 | ||
153 | chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); | 159 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); |
154 | if (chip == NULL) | 160 | if (chip == NULL) |
155 | return -ENOMEM; | 161 | return -ENOMEM; |
156 | 162 | ||
@@ -367,6 +373,7 @@ static void __devexit snd_vortex_remove(struct pci_dev *pci) | |||
367 | // pci_driver definition | 373 | // pci_driver definition |
368 | static struct pci_driver driver = { | 374 | static struct pci_driver driver = { |
369 | .name = CARD_NAME_SHORT, | 375 | .name = CARD_NAME_SHORT, |
376 | .owner = THIS_MODULE, | ||
370 | .id_table = snd_vortex_ids, | 377 | .id_table = snd_vortex_ids, |
371 | .probe = snd_vortex_probe, | 378 | .probe = snd_vortex_probe, |
372 | .remove = __devexit_p(snd_vortex_remove), | 379 | .remove = __devexit_p(snd_vortex_remove), |
diff --git a/sound/pci/au88x0/au88x0_pcm.c b/sound/pci/au88x0/au88x0_pcm.c index 04dcefd8b8ff..38bd2b5dd434 100644 --- a/sound/pci/au88x0/au88x0_pcm.c +++ b/sound/pci/au88x0/au88x0_pcm.c | |||
@@ -33,7 +33,7 @@ | |||
33 | /* hardware definition */ | 33 | /* hardware definition */ |
34 | static snd_pcm_hardware_t snd_vortex_playback_hw_adb = { | 34 | static snd_pcm_hardware_t snd_vortex_playback_hw_adb = { |
35 | .info = | 35 | .info = |
36 | (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_RESUME | | 36 | (SNDRV_PCM_INFO_MMAP | /* SNDRV_PCM_INFO_RESUME | */ |
37 | SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_INTERLEAVED | | 37 | SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_INTERLEAVED | |
38 | SNDRV_PCM_INFO_MMAP_VALID), | 38 | SNDRV_PCM_INFO_MMAP_VALID), |
39 | .formats = | 39 | .formats = |
@@ -58,7 +58,7 @@ static snd_pcm_hardware_t snd_vortex_playback_hw_adb = { | |||
58 | #ifndef CHIP_AU8820 | 58 | #ifndef CHIP_AU8820 |
59 | static snd_pcm_hardware_t snd_vortex_playback_hw_a3d = { | 59 | static snd_pcm_hardware_t snd_vortex_playback_hw_a3d = { |
60 | .info = | 60 | .info = |
61 | (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_RESUME | | 61 | (SNDRV_PCM_INFO_MMAP | /* SNDRV_PCM_INFO_RESUME | */ |
62 | SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_INTERLEAVED | | 62 | SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_INTERLEAVED | |
63 | SNDRV_PCM_INFO_MMAP_VALID), | 63 | SNDRV_PCM_INFO_MMAP_VALID), |
64 | .formats = | 64 | .formats = |
@@ -78,7 +78,7 @@ static snd_pcm_hardware_t snd_vortex_playback_hw_a3d = { | |||
78 | #endif | 78 | #endif |
79 | static snd_pcm_hardware_t snd_vortex_playback_hw_spdif = { | 79 | static snd_pcm_hardware_t snd_vortex_playback_hw_spdif = { |
80 | .info = | 80 | .info = |
81 | (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_RESUME | | 81 | (SNDRV_PCM_INFO_MMAP | /* SNDRV_PCM_INFO_RESUME | */ |
82 | SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_INTERLEAVED | | 82 | SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_INTERLEAVED | |
83 | SNDRV_PCM_INFO_MMAP_VALID), | 83 | SNDRV_PCM_INFO_MMAP_VALID), |
84 | .formats = | 84 | .formats = |
@@ -220,8 +220,10 @@ snd_vortex_pcm_hw_params(snd_pcm_substream_t * substream, | |||
220 | vortex_adb_allocroute(chip, -1, | 220 | vortex_adb_allocroute(chip, -1, |
221 | params_channels(hw_params), | 221 | params_channels(hw_params), |
222 | substream->stream, type); | 222 | substream->stream, type); |
223 | if (dma < 0) | 223 | if (dma < 0) { |
224 | spin_unlock_irq(&chip->lock); | ||
224 | return dma; | 225 | return dma; |
226 | } | ||
225 | stream = substream->runtime->private_data = &chip->dma_adb[dma]; | 227 | stream = substream->runtime->private_data = &chip->dma_adb[dma]; |
226 | stream->substream = substream; | 228 | stream->substream = substream; |
227 | /* Setup Buffers. */ | 229 | /* Setup Buffers. */ |
diff --git a/sound/pci/azt3328.c b/sound/pci/azt3328.c index 72bba7b2d983..d5261bdec583 100644 --- a/sound/pci/azt3328.c +++ b/sound/pci/azt3328.c | |||
@@ -1345,7 +1345,7 @@ static int __devinit snd_azf3328_create(snd_card_t * card, | |||
1345 | if ((err = pci_enable_device(pci)) < 0) | 1345 | if ((err = pci_enable_device(pci)) < 0) |
1346 | return err; | 1346 | return err; |
1347 | 1347 | ||
1348 | chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); | 1348 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); |
1349 | if (chip == NULL) { | 1349 | if (chip == NULL) { |
1350 | pci_disable_device(pci); | 1350 | pci_disable_device(pci); |
1351 | return -ENOMEM; | 1351 | return -ENOMEM; |
@@ -1511,6 +1511,7 @@ static void __devexit snd_azf3328_remove(struct pci_dev *pci) | |||
1511 | 1511 | ||
1512 | static struct pci_driver driver = { | 1512 | static struct pci_driver driver = { |
1513 | .name = "AZF3328", | 1513 | .name = "AZF3328", |
1514 | .owner = THIS_MODULE, | ||
1514 | .id_table = snd_azf3328_ids, | 1515 | .id_table = snd_azf3328_ids, |
1515 | .probe = snd_azf3328_probe, | 1516 | .probe = snd_azf3328_probe, |
1516 | .remove = __devexit_p(snd_azf3328_remove), | 1517 | .remove = __devexit_p(snd_azf3328_remove), |
diff --git a/sound/pci/bt87x.c b/sound/pci/bt87x.c index c5557eaf3e2e..01d98eeb242e 100644 --- a/sound/pci/bt87x.c +++ b/sound/pci/bt87x.c | |||
@@ -59,16 +59,6 @@ module_param(load_all, bool, 0444); | |||
59 | MODULE_PARM_DESC(load_all, "Allow to load the non-whitelisted cards"); | 59 | MODULE_PARM_DESC(load_all, "Allow to load the non-whitelisted cards"); |
60 | 60 | ||
61 | 61 | ||
62 | #ifndef PCI_VENDOR_ID_BROOKTREE | ||
63 | #define PCI_VENDOR_ID_BROOKTREE 0x109e | ||
64 | #endif | ||
65 | #ifndef PCI_DEVICE_ID_BROOKTREE_878 | ||
66 | #define PCI_DEVICE_ID_BROOKTREE_878 0x0878 | ||
67 | #endif | ||
68 | #ifndef PCI_DEVICE_ID_BROOKTREE_879 | ||
69 | #define PCI_DEVICE_ID_BROOKTREE_879 0x0879 | ||
70 | #endif | ||
71 | |||
72 | /* register offsets */ | 62 | /* register offsets */ |
73 | #define REG_INT_STAT 0x100 /* interrupt status */ | 63 | #define REG_INT_STAT 0x100 /* interrupt status */ |
74 | #define REG_INT_MASK 0x104 /* interrupt mask */ | 64 | #define REG_INT_MASK 0x104 /* interrupt mask */ |
@@ -720,7 +710,7 @@ static int __devinit snd_bt87x_create(snd_card_t *card, | |||
720 | if (err < 0) | 710 | if (err < 0) |
721 | return err; | 711 | return err; |
722 | 712 | ||
723 | chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); | 713 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); |
724 | if (!chip) { | 714 | if (!chip) { |
725 | pci_disable_device(pci); | 715 | pci_disable_device(pci); |
726 | return -ENOMEM; | 716 | return -ENOMEM; |
@@ -771,15 +761,18 @@ static int __devinit snd_bt87x_create(snd_card_t *card, | |||
771 | 761 | ||
772 | #define BT_DEVICE(chip, subvend, subdev, rate) \ | 762 | #define BT_DEVICE(chip, subvend, subdev, rate) \ |
773 | { .vendor = PCI_VENDOR_ID_BROOKTREE, \ | 763 | { .vendor = PCI_VENDOR_ID_BROOKTREE, \ |
774 | .device = PCI_DEVICE_ID_BROOKTREE_##chip, \ | 764 | .device = chip, \ |
775 | .subvendor = subvend, .subdevice = subdev, \ | 765 | .subvendor = subvend, .subdevice = subdev, \ |
776 | .driver_data = rate } | 766 | .driver_data = rate } |
777 | 767 | ||
778 | /* driver_data is the default digital_rate value for that device */ | 768 | /* driver_data is the default digital_rate value for that device */ |
779 | static struct pci_device_id snd_bt87x_ids[] = { | 769 | static struct pci_device_id snd_bt87x_ids[] = { |
780 | BT_DEVICE(878, 0x0070, 0x13eb, 32000), /* Hauppauge WinTV series */ | 770 | /* Hauppauge WinTV series */ |
781 | BT_DEVICE(879, 0x0070, 0x13eb, 32000), /* Hauppauge WinTV series */ | 771 | BT_DEVICE(PCI_DEVICE_ID_BROOKTREE_878, 0x0070, 0x13eb, 32000), |
782 | BT_DEVICE(878, 0x0070, 0xff01, 44100), /* Viewcast Osprey 200 */ | 772 | /* Hauppauge WinTV series */ |
773 | BT_DEVICE(PCI_DEVICE_ID_BROOKTREE_879, 0x0070, 0x13eb, 32000), | ||
774 | /* Viewcast Osprey 200 */ | ||
775 | BT_DEVICE(PCI_DEVICE_ID_BROOKTREE_878, 0x0070, 0xff01, 44100), | ||
783 | { } | 776 | { } |
784 | }; | 777 | }; |
785 | MODULE_DEVICE_TABLE(pci, snd_bt87x_ids); | 778 | MODULE_DEVICE_TABLE(pci, snd_bt87x_ids); |
@@ -911,6 +904,7 @@ static struct pci_device_id snd_bt87x_default_ids[] = { | |||
911 | 904 | ||
912 | static struct pci_driver driver = { | 905 | static struct pci_driver driver = { |
913 | .name = "Bt87x", | 906 | .name = "Bt87x", |
907 | .owner = THIS_MODULE, | ||
914 | .id_table = snd_bt87x_ids, | 908 | .id_table = snd_bt87x_ids, |
915 | .probe = snd_bt87x_probe, | 909 | .probe = snd_bt87x_probe, |
916 | .remove = __devexit_p(snd_bt87x_remove), | 910 | .remove = __devexit_p(snd_bt87x_remove), |
diff --git a/sound/pci/ca0106/ca0106_main.c b/sound/pci/ca0106/ca0106_main.c index 95c289284267..ba07960921d8 100644 --- a/sound/pci/ca0106/ca0106_main.c +++ b/sound/pci/ca0106/ca0106_main.c | |||
@@ -188,6 +188,14 @@ static ca0106_details_t ca0106_chip_details[] = { | |||
188 | .name = "MSI K8N Diamond MB [SB0438]", | 188 | .name = "MSI K8N Diamond MB [SB0438]", |
189 | .gpio_type = 1, | 189 | .gpio_type = 1, |
190 | .i2c_adc = 1 } , | 190 | .i2c_adc = 1 } , |
191 | /* Shuttle XPC SD31P which has an onboard Creative Labs Sound Blaster Live! 24-bit EAX | ||
192 | * high-definition 7.1 audio processor". | ||
193 | * Added using info from andrewvegan in alsa bug #1298 | ||
194 | */ | ||
195 | { .serial = 0x30381297, | ||
196 | .name = "Shuttle XPC SD31P [SD31P]", | ||
197 | .gpio_type = 1, | ||
198 | .i2c_adc = 1 } , | ||
191 | { .serial = 0, | 199 | { .serial = 0, |
192 | .name = "AudigyLS [Unknown]" } | 200 | .name = "AudigyLS [Unknown]" } |
193 | }; | 201 | }; |
@@ -344,7 +352,7 @@ static int snd_ca0106_pcm_open_playback_channel(snd_pcm_substream_t *substream, | |||
344 | snd_pcm_runtime_t *runtime = substream->runtime; | 352 | snd_pcm_runtime_t *runtime = substream->runtime; |
345 | int err; | 353 | int err; |
346 | 354 | ||
347 | epcm = kcalloc(1, sizeof(*epcm), GFP_KERNEL); | 355 | epcm = kzalloc(sizeof(*epcm), GFP_KERNEL); |
348 | 356 | ||
349 | if (epcm == NULL) | 357 | if (epcm == NULL) |
350 | return -ENOMEM; | 358 | return -ENOMEM; |
@@ -411,7 +419,7 @@ static int snd_ca0106_pcm_open_capture_channel(snd_pcm_substream_t *substream, i | |||
411 | snd_pcm_runtime_t *runtime = substream->runtime; | 419 | snd_pcm_runtime_t *runtime = substream->runtime; |
412 | int err; | 420 | int err; |
413 | 421 | ||
414 | epcm = kcalloc(1, sizeof(*epcm), GFP_KERNEL); | 422 | epcm = kzalloc(sizeof(*epcm), GFP_KERNEL); |
415 | if (epcm == NULL) { | 423 | if (epcm == NULL) { |
416 | snd_printk("open_capture_channel: failed epcm alloc\n"); | 424 | snd_printk("open_capture_channel: failed epcm alloc\n"); |
417 | return -ENOMEM; | 425 | return -ENOMEM; |
@@ -1136,7 +1144,7 @@ static int __devinit snd_ca0106_create(snd_card_t *card, | |||
1136 | return -ENXIO; | 1144 | return -ENXIO; |
1137 | } | 1145 | } |
1138 | 1146 | ||
1139 | chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); | 1147 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); |
1140 | if (chip == NULL) { | 1148 | if (chip == NULL) { |
1141 | pci_disable_device(pci); | 1149 | pci_disable_device(pci); |
1142 | return -ENOMEM; | 1150 | return -ENOMEM; |
@@ -1382,6 +1390,7 @@ MODULE_DEVICE_TABLE(pci, snd_ca0106_ids); | |||
1382 | // pci_driver definition | 1390 | // pci_driver definition |
1383 | static struct pci_driver driver = { | 1391 | static struct pci_driver driver = { |
1384 | .name = "CA0106", | 1392 | .name = "CA0106", |
1393 | .owner = THIS_MODULE, | ||
1385 | .id_table = snd_ca0106_ids, | 1394 | .id_table = snd_ca0106_ids, |
1386 | .probe = snd_ca0106_probe, | 1395 | .probe = snd_ca0106_probe, |
1387 | .remove = __devexit_p(snd_ca0106_remove), | 1396 | .remove = __devexit_p(snd_ca0106_remove), |
diff --git a/sound/pci/ca0106/ca0106_mixer.c b/sound/pci/ca0106/ca0106_mixer.c index 0e5e9ce0ff28..c10e4a54301b 100644 --- a/sound/pci/ca0106/ca0106_mixer.c +++ b/sound/pci/ca0106/ca0106_mixer.c | |||
@@ -297,7 +297,7 @@ static int snd_ca0106_spdif_put(snd_kcontrol_t * kcontrol, | |||
297 | static snd_kcontrol_new_t snd_ca0106_spdif_mask_control = | 297 | static snd_kcontrol_new_t snd_ca0106_spdif_mask_control = |
298 | { | 298 | { |
299 | .access = SNDRV_CTL_ELEM_ACCESS_READ, | 299 | .access = SNDRV_CTL_ELEM_ACCESS_READ, |
300 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 300 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, |
301 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,MASK), | 301 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,MASK), |
302 | .count = 4, | 302 | .count = 4, |
303 | .info = snd_ca0106_spdif_info, | 303 | .info = snd_ca0106_spdif_info, |
@@ -306,7 +306,7 @@ static snd_kcontrol_new_t snd_ca0106_spdif_mask_control = | |||
306 | 306 | ||
307 | static snd_kcontrol_new_t snd_ca0106_spdif_control = | 307 | static snd_kcontrol_new_t snd_ca0106_spdif_control = |
308 | { | 308 | { |
309 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 309 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, |
310 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,DEFAULT), | 310 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,DEFAULT), |
311 | .count = 4, | 311 | .count = 4, |
312 | .info = snd_ca0106_spdif_info, | 312 | .info = snd_ca0106_spdif_info, |
@@ -482,7 +482,7 @@ static int snd_ca0106_volume_put_feedback(snd_kcontrol_t * kcontrol, | |||
482 | static snd_kcontrol_new_t snd_ca0106_volume_control_analog_front = | 482 | static snd_kcontrol_new_t snd_ca0106_volume_control_analog_front = |
483 | { | 483 | { |
484 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 484 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
485 | .name = "Analog Front Volume", | 485 | .name = "Analog Front Playback Volume", |
486 | .info = snd_ca0106_volume_info, | 486 | .info = snd_ca0106_volume_info, |
487 | .get = snd_ca0106_volume_get_analog_front, | 487 | .get = snd_ca0106_volume_get_analog_front, |
488 | .put = snd_ca0106_volume_put_analog_front | 488 | .put = snd_ca0106_volume_put_analog_front |
@@ -490,7 +490,7 @@ static snd_kcontrol_new_t snd_ca0106_volume_control_analog_front = | |||
490 | static snd_kcontrol_new_t snd_ca0106_volume_control_analog_center_lfe = | 490 | static snd_kcontrol_new_t snd_ca0106_volume_control_analog_center_lfe = |
491 | { | 491 | { |
492 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 492 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
493 | .name = "Analog Center/LFE Volume", | 493 | .name = "Analog Center/LFE Playback Volume", |
494 | .info = snd_ca0106_volume_info, | 494 | .info = snd_ca0106_volume_info, |
495 | .get = snd_ca0106_volume_get_analog_center_lfe, | 495 | .get = snd_ca0106_volume_get_analog_center_lfe, |
496 | .put = snd_ca0106_volume_put_analog_center_lfe | 496 | .put = snd_ca0106_volume_put_analog_center_lfe |
@@ -498,7 +498,7 @@ static snd_kcontrol_new_t snd_ca0106_volume_control_analog_center_lfe = | |||
498 | static snd_kcontrol_new_t snd_ca0106_volume_control_analog_unknown = | 498 | static snd_kcontrol_new_t snd_ca0106_volume_control_analog_unknown = |
499 | { | 499 | { |
500 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 500 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
501 | .name = "Analog Side Volume", | 501 | .name = "Analog Side Playback Volume", |
502 | .info = snd_ca0106_volume_info, | 502 | .info = snd_ca0106_volume_info, |
503 | .get = snd_ca0106_volume_get_analog_unknown, | 503 | .get = snd_ca0106_volume_get_analog_unknown, |
504 | .put = snd_ca0106_volume_put_analog_unknown | 504 | .put = snd_ca0106_volume_put_analog_unknown |
@@ -506,7 +506,7 @@ static snd_kcontrol_new_t snd_ca0106_volume_control_analog_unknown = | |||
506 | static snd_kcontrol_new_t snd_ca0106_volume_control_analog_rear = | 506 | static snd_kcontrol_new_t snd_ca0106_volume_control_analog_rear = |
507 | { | 507 | { |
508 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 508 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
509 | .name = "Analog Rear Volume", | 509 | .name = "Analog Rear Playback Volume", |
510 | .info = snd_ca0106_volume_info, | 510 | .info = snd_ca0106_volume_info, |
511 | .get = snd_ca0106_volume_get_analog_rear, | 511 | .get = snd_ca0106_volume_get_analog_rear, |
512 | .put = snd_ca0106_volume_put_analog_rear | 512 | .put = snd_ca0106_volume_put_analog_rear |
@@ -514,7 +514,7 @@ static snd_kcontrol_new_t snd_ca0106_volume_control_analog_rear = | |||
514 | static snd_kcontrol_new_t snd_ca0106_volume_control_spdif_front = | 514 | static snd_kcontrol_new_t snd_ca0106_volume_control_spdif_front = |
515 | { | 515 | { |
516 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 516 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
517 | .name = "SPDIF Front Volume", | 517 | .name = "SPDIF Front Playback Volume", |
518 | .info = snd_ca0106_volume_info, | 518 | .info = snd_ca0106_volume_info, |
519 | .get = snd_ca0106_volume_get_spdif_front, | 519 | .get = snd_ca0106_volume_get_spdif_front, |
520 | .put = snd_ca0106_volume_put_spdif_front | 520 | .put = snd_ca0106_volume_put_spdif_front |
@@ -522,7 +522,7 @@ static snd_kcontrol_new_t snd_ca0106_volume_control_spdif_front = | |||
522 | static snd_kcontrol_new_t snd_ca0106_volume_control_spdif_center_lfe = | 522 | static snd_kcontrol_new_t snd_ca0106_volume_control_spdif_center_lfe = |
523 | { | 523 | { |
524 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 524 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
525 | .name = "SPDIF Center/LFE Volume", | 525 | .name = "SPDIF Center/LFE Playback Volume", |
526 | .info = snd_ca0106_volume_info, | 526 | .info = snd_ca0106_volume_info, |
527 | .get = snd_ca0106_volume_get_spdif_center_lfe, | 527 | .get = snd_ca0106_volume_get_spdif_center_lfe, |
528 | .put = snd_ca0106_volume_put_spdif_center_lfe | 528 | .put = snd_ca0106_volume_put_spdif_center_lfe |
@@ -530,7 +530,7 @@ static snd_kcontrol_new_t snd_ca0106_volume_control_spdif_center_lfe = | |||
530 | static snd_kcontrol_new_t snd_ca0106_volume_control_spdif_unknown = | 530 | static snd_kcontrol_new_t snd_ca0106_volume_control_spdif_unknown = |
531 | { | 531 | { |
532 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 532 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
533 | .name = "SPDIF Unknown Volume", | 533 | .name = "SPDIF Unknown Playback Volume", |
534 | .info = snd_ca0106_volume_info, | 534 | .info = snd_ca0106_volume_info, |
535 | .get = snd_ca0106_volume_get_spdif_unknown, | 535 | .get = snd_ca0106_volume_get_spdif_unknown, |
536 | .put = snd_ca0106_volume_put_spdif_unknown | 536 | .put = snd_ca0106_volume_put_spdif_unknown |
@@ -538,7 +538,7 @@ static snd_kcontrol_new_t snd_ca0106_volume_control_spdif_unknown = | |||
538 | static snd_kcontrol_new_t snd_ca0106_volume_control_spdif_rear = | 538 | static snd_kcontrol_new_t snd_ca0106_volume_control_spdif_rear = |
539 | { | 539 | { |
540 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 540 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
541 | .name = "SPDIF Rear Volume", | 541 | .name = "SPDIF Rear Playback Volume", |
542 | .info = snd_ca0106_volume_info, | 542 | .info = snd_ca0106_volume_info, |
543 | .get = snd_ca0106_volume_get_spdif_rear, | 543 | .get = snd_ca0106_volume_get_spdif_rear, |
544 | .put = snd_ca0106_volume_put_spdif_rear | 544 | .put = snd_ca0106_volume_put_spdif_rear |
@@ -547,7 +547,7 @@ static snd_kcontrol_new_t snd_ca0106_volume_control_spdif_rear = | |||
547 | static snd_kcontrol_new_t snd_ca0106_volume_control_feedback = | 547 | static snd_kcontrol_new_t snd_ca0106_volume_control_feedback = |
548 | { | 548 | { |
549 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 549 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
550 | .name = "CAPTURE feedback into PLAYBACK", | 550 | .name = "CAPTURE feedback Playback Volume", |
551 | .info = snd_ca0106_volume_info, | 551 | .info = snd_ca0106_volume_info, |
552 | .get = snd_ca0106_volume_get_feedback, | 552 | .get = snd_ca0106_volume_get_feedback, |
553 | .put = snd_ca0106_volume_put_feedback | 553 | .put = snd_ca0106_volume_put_feedback |
diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c index f5a4ac1ceef9..1eb3315d136d 100644 --- a/sound/pci/cmipci.c +++ b/sound/pci/cmipci.c | |||
@@ -79,13 +79,6 @@ module_param_array(joystick_port, int, NULL, 0444); | |||
79 | MODULE_PARM_DESC(joystick_port, "Joystick port address."); | 79 | MODULE_PARM_DESC(joystick_port, "Joystick port address."); |
80 | #endif | 80 | #endif |
81 | 81 | ||
82 | #ifndef PCI_DEVICE_ID_CMEDIA_CM8738 | ||
83 | #define PCI_DEVICE_ID_CMEDIA_CM8738 0x0111 | ||
84 | #endif | ||
85 | #ifndef PCI_DEVICE_ID_CMEDIA_CM8738B | ||
86 | #define PCI_DEVICE_ID_CMEDIA_CM8738B 0x0112 | ||
87 | #endif | ||
88 | |||
89 | /* | 82 | /* |
90 | * CM8x38 registers definition | 83 | * CM8x38 registers definition |
91 | */ | 84 | */ |
@@ -348,25 +341,6 @@ MODULE_PARM_DESC(joystick_port, "Joystick port address."); | |||
348 | 341 | ||
349 | 342 | ||
350 | /* | 343 | /* |
351 | * pci ids | ||
352 | */ | ||
353 | #ifndef PCI_VENDOR_ID_CMEDIA | ||
354 | #define PCI_VENDOR_ID_CMEDIA 0x13F6 | ||
355 | #endif | ||
356 | #ifndef PCI_DEVICE_ID_CMEDIA_CM8338A | ||
357 | #define PCI_DEVICE_ID_CMEDIA_CM8338A 0x0100 | ||
358 | #endif | ||
359 | #ifndef PCI_DEVICE_ID_CMEDIA_CM8338B | ||
360 | #define PCI_DEVICE_ID_CMEDIA_CM8338B 0x0101 | ||
361 | #endif | ||
362 | #ifndef PCI_DEVICE_ID_CMEDIA_CM8738 | ||
363 | #define PCI_DEVICE_ID_CMEDIA_CM8738 0x0111 | ||
364 | #endif | ||
365 | #ifndef PCI_DEVICE_ID_CMEDIA_CM8738B | ||
366 | #define PCI_DEVICE_ID_CMEDIA_CM8738B 0x0112 | ||
367 | #endif | ||
368 | |||
369 | /* | ||
370 | * channels for playback / capture | 344 | * channels for playback / capture |
371 | */ | 345 | */ |
372 | #define CM_CH_PLAY 0 | 346 | #define CM_CH_PLAY 0 |
@@ -1029,7 +1003,7 @@ static int snd_cmipci_spdif_mask_get(snd_kcontrol_t * kcontrol, | |||
1029 | static snd_kcontrol_new_t snd_cmipci_spdif_mask __devinitdata = | 1003 | static snd_kcontrol_new_t snd_cmipci_spdif_mask __devinitdata = |
1030 | { | 1004 | { |
1031 | .access = SNDRV_CTL_ELEM_ACCESS_READ, | 1005 | .access = SNDRV_CTL_ELEM_ACCESS_READ, |
1032 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1006 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, |
1033 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,CON_MASK), | 1007 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,CON_MASK), |
1034 | .info = snd_cmipci_spdif_mask_info, | 1008 | .info = snd_cmipci_spdif_mask_info, |
1035 | .get = snd_cmipci_spdif_mask_get, | 1009 | .get = snd_cmipci_spdif_mask_get, |
@@ -2801,7 +2775,7 @@ static int __devinit snd_cmipci_create(snd_card_t *card, struct pci_dev *pci, | |||
2801 | if ((err = pci_enable_device(pci)) < 0) | 2775 | if ((err = pci_enable_device(pci)) < 0) |
2802 | return err; | 2776 | return err; |
2803 | 2777 | ||
2804 | cm = kcalloc(1, sizeof(*cm), GFP_KERNEL); | 2778 | cm = kzalloc(sizeof(*cm), GFP_KERNEL); |
2805 | if (cm == NULL) { | 2779 | if (cm == NULL) { |
2806 | pci_disable_device(pci); | 2780 | pci_disable_device(pci); |
2807 | return -ENOMEM; | 2781 | return -ENOMEM; |
@@ -3063,6 +3037,7 @@ static void __devexit snd_cmipci_remove(struct pci_dev *pci) | |||
3063 | 3037 | ||
3064 | static struct pci_driver driver = { | 3038 | static struct pci_driver driver = { |
3065 | .name = "C-Media PCI", | 3039 | .name = "C-Media PCI", |
3040 | .owner = THIS_MODULE, | ||
3066 | .id_table = snd_cmipci_ids, | 3041 | .id_table = snd_cmipci_ids, |
3067 | .probe = snd_cmipci_probe, | 3042 | .probe = snd_cmipci_probe, |
3068 | .remove = __devexit_p(snd_cmipci_remove), | 3043 | .remove = __devexit_p(snd_cmipci_remove), |
diff --git a/sound/pci/cs4281.c b/sound/pci/cs4281.c index c7a370d4f923..dc87e0144b5a 100644 --- a/sound/pci/cs4281.c +++ b/sound/pci/cs4281.c | |||
@@ -57,17 +57,6 @@ module_param_array(dual_codec, bool, NULL, 0444); | |||
57 | MODULE_PARM_DESC(dual_codec, "Secondary Codec ID (0 = disabled)."); | 57 | MODULE_PARM_DESC(dual_codec, "Secondary Codec ID (0 = disabled)."); |
58 | 58 | ||
59 | /* | 59 | /* |
60 | * | ||
61 | */ | ||
62 | |||
63 | #ifndef PCI_VENDOR_ID_CIRRUS | ||
64 | #define PCI_VENDOR_ID_CIRRUS 0x1013 | ||
65 | #endif | ||
66 | #ifndef PCI_DEVICE_ID_CIRRUS_4281 | ||
67 | #define PCI_DEVICE_ID_CIRRUS_4281 0x6005 | ||
68 | #endif | ||
69 | |||
70 | /* | ||
71 | * Direct registers | 60 | * Direct registers |
72 | */ | 61 | */ |
73 | 62 | ||
@@ -1394,7 +1383,7 @@ static int __devinit snd_cs4281_create(snd_card_t * card, | |||
1394 | *rchip = NULL; | 1383 | *rchip = NULL; |
1395 | if ((err = pci_enable_device(pci)) < 0) | 1384 | if ((err = pci_enable_device(pci)) < 0) |
1396 | return err; | 1385 | return err; |
1397 | chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); | 1386 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); |
1398 | if (chip == NULL) { | 1387 | if (chip == NULL) { |
1399 | pci_disable_device(pci); | 1388 | pci_disable_device(pci); |
1400 | return -ENOMEM; | 1389 | return -ENOMEM; |
@@ -2119,6 +2108,7 @@ static int cs4281_resume(snd_card_t *card) | |||
2119 | 2108 | ||
2120 | static struct pci_driver driver = { | 2109 | static struct pci_driver driver = { |
2121 | .name = "CS4281", | 2110 | .name = "CS4281", |
2111 | .owner = THIS_MODULE, | ||
2122 | .id_table = snd_cs4281_ids, | 2112 | .id_table = snd_cs4281_ids, |
2123 | .probe = snd_cs4281_probe, | 2113 | .probe = snd_cs4281_probe, |
2124 | .remove = __devexit_p(snd_cs4281_remove), | 2114 | .remove = __devexit_p(snd_cs4281_remove), |
diff --git a/sound/pci/cs46xx/cs46xx.c b/sound/pci/cs46xx/cs46xx.c index db212ecd792a..32b4f8465cef 100644 --- a/sound/pci/cs46xx/cs46xx.c +++ b/sound/pci/cs46xx/cs46xx.c | |||
@@ -113,7 +113,7 @@ static int __devinit snd_card_cs46xx_probe(struct pci_dev *pci, | |||
113 | return err; | 113 | return err; |
114 | } | 114 | } |
115 | #endif | 115 | #endif |
116 | if ((err = snd_cs46xx_mixer(chip)) < 0) { | 116 | if ((err = snd_cs46xx_mixer(chip, 2)) < 0) { |
117 | snd_card_free(card); | 117 | snd_card_free(card); |
118 | return err; | 118 | return err; |
119 | } | 119 | } |
@@ -163,6 +163,7 @@ static void __devexit snd_card_cs46xx_remove(struct pci_dev *pci) | |||
163 | 163 | ||
164 | static struct pci_driver driver = { | 164 | static struct pci_driver driver = { |
165 | .name = "Sound Fusion CS46xx", | 165 | .name = "Sound Fusion CS46xx", |
166 | .owner = THIS_MODULE, | ||
166 | .id_table = snd_cs46xx_ids, | 167 | .id_table = snd_cs46xx_ids, |
167 | .probe = snd_card_cs46xx_probe, | 168 | .probe = snd_card_cs46xx_probe, |
168 | .remove = __devexit_p(snd_card_cs46xx_remove), | 169 | .remove = __devexit_p(snd_card_cs46xx_remove), |
diff --git a/sound/pci/cs46xx/cs46xx_lib.c b/sound/pci/cs46xx/cs46xx_lib.c index ff28af1f658e..6e3855b8b33d 100644 --- a/sound/pci/cs46xx/cs46xx_lib.c +++ b/sound/pci/cs46xx/cs46xx_lib.c | |||
@@ -1243,8 +1243,8 @@ static snd_pcm_hardware_t snd_cs46xx_playback = | |||
1243 | { | 1243 | { |
1244 | .info = (SNDRV_PCM_INFO_MMAP | | 1244 | .info = (SNDRV_PCM_INFO_MMAP | |
1245 | SNDRV_PCM_INFO_INTERLEAVED | | 1245 | SNDRV_PCM_INFO_INTERLEAVED | |
1246 | SNDRV_PCM_INFO_BLOCK_TRANSFER | | 1246 | SNDRV_PCM_INFO_BLOCK_TRANSFER /*|*/ |
1247 | SNDRV_PCM_INFO_RESUME), | 1247 | /*SNDRV_PCM_INFO_RESUME*/), |
1248 | .formats = (SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_U8 | | 1248 | .formats = (SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_U8 | |
1249 | SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S16_BE | | 1249 | SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S16_BE | |
1250 | SNDRV_PCM_FMTBIT_U16_LE | SNDRV_PCM_FMTBIT_U16_BE), | 1250 | SNDRV_PCM_FMTBIT_U16_LE | SNDRV_PCM_FMTBIT_U16_BE), |
@@ -1265,8 +1265,8 @@ static snd_pcm_hardware_t snd_cs46xx_capture = | |||
1265 | { | 1265 | { |
1266 | .info = (SNDRV_PCM_INFO_MMAP | | 1266 | .info = (SNDRV_PCM_INFO_MMAP | |
1267 | SNDRV_PCM_INFO_INTERLEAVED | | 1267 | SNDRV_PCM_INFO_INTERLEAVED | |
1268 | SNDRV_PCM_INFO_BLOCK_TRANSFER | | 1268 | SNDRV_PCM_INFO_BLOCK_TRANSFER /*|*/ |
1269 | SNDRV_PCM_INFO_RESUME), | 1269 | /*SNDRV_PCM_INFO_RESUME*/), |
1270 | .formats = SNDRV_PCM_FMTBIT_S16_LE, | 1270 | .formats = SNDRV_PCM_FMTBIT_S16_LE, |
1271 | .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000, | 1271 | .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000, |
1272 | .rate_min = 5500, | 1272 | .rate_min = 5500, |
@@ -1304,7 +1304,7 @@ static int _cs46xx_playback_open_channel (snd_pcm_substream_t * substream,int pc | |||
1304 | cs46xx_pcm_t * cpcm; | 1304 | cs46xx_pcm_t * cpcm; |
1305 | snd_pcm_runtime_t *runtime = substream->runtime; | 1305 | snd_pcm_runtime_t *runtime = substream->runtime; |
1306 | 1306 | ||
1307 | cpcm = kcalloc(1, sizeof(*cpcm), GFP_KERNEL); | 1307 | cpcm = kzalloc(sizeof(*cpcm), GFP_KERNEL); |
1308 | if (cpcm == NULL) | 1308 | if (cpcm == NULL) |
1309 | return -ENOMEM; | 1309 | return -ENOMEM; |
1310 | if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(chip->pci), | 1310 | if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(chip->pci), |
@@ -2231,7 +2231,7 @@ static snd_kcontrol_new_t snd_cs46xx_controls[] __devinitdata = { | |||
2231 | }, | 2231 | }, |
2232 | { | 2232 | { |
2233 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 2233 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
2234 | .name = "IEC958 Output Switch", | 2234 | .name = SNDRV_CTL_NAME_IEC958("Output ",NONE,SWITCH), |
2235 | .info = snd_mixer_boolean_info, | 2235 | .info = snd_mixer_boolean_info, |
2236 | .get = snd_cs46xx_iec958_get, | 2236 | .get = snd_cs46xx_iec958_get, |
2237 | .put = snd_cs46xx_iec958_put, | 2237 | .put = snd_cs46xx_iec958_put, |
@@ -2239,7 +2239,7 @@ static snd_kcontrol_new_t snd_cs46xx_controls[] __devinitdata = { | |||
2239 | }, | 2239 | }, |
2240 | { | 2240 | { |
2241 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 2241 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
2242 | .name = "IEC958 Input Switch", | 2242 | .name = SNDRV_CTL_NAME_IEC958("Input ",NONE,SWITCH), |
2243 | .info = snd_mixer_boolean_info, | 2243 | .info = snd_mixer_boolean_info, |
2244 | .get = snd_cs46xx_iec958_get, | 2244 | .get = snd_cs46xx_iec958_get, |
2245 | .put = snd_cs46xx_iec958_put, | 2245 | .put = snd_cs46xx_iec958_put, |
@@ -2249,7 +2249,7 @@ static snd_kcontrol_new_t snd_cs46xx_controls[] __devinitdata = { | |||
2249 | /* Input IEC958 volume does not work for the moment. (Benny) */ | 2249 | /* Input IEC958 volume does not work for the moment. (Benny) */ |
2250 | { | 2250 | { |
2251 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 2251 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
2252 | .name = "IEC958 Input Volume", | 2252 | .name = SNDRV_CTL_NAME_IEC958("Input ",NONE,VOLUME), |
2253 | .info = snd_cs46xx_vol_info, | 2253 | .info = snd_cs46xx_vol_info, |
2254 | .get = snd_cs46xx_vol_iec958_get, | 2254 | .get = snd_cs46xx_vol_iec958_get, |
2255 | .put = snd_cs46xx_vol_iec958_put, | 2255 | .put = snd_cs46xx_vol_iec958_put, |
@@ -2440,7 +2440,7 @@ static int __devinit cs46xx_detect_codec(cs46xx_t *chip, int codec) | |||
2440 | return -ENXIO; | 2440 | return -ENXIO; |
2441 | } | 2441 | } |
2442 | 2442 | ||
2443 | int __devinit snd_cs46xx_mixer(cs46xx_t *chip) | 2443 | int __devinit snd_cs46xx_mixer(cs46xx_t *chip, int spdif_device) |
2444 | { | 2444 | { |
2445 | snd_card_t *card = chip->card; | 2445 | snd_card_t *card = chip->card; |
2446 | snd_ctl_elem_id_t id; | 2446 | snd_ctl_elem_id_t id; |
@@ -2476,6 +2476,8 @@ int __devinit snd_cs46xx_mixer(cs46xx_t *chip) | |||
2476 | for (idx = 0; idx < ARRAY_SIZE(snd_cs46xx_controls); idx++) { | 2476 | for (idx = 0; idx < ARRAY_SIZE(snd_cs46xx_controls); idx++) { |
2477 | snd_kcontrol_t *kctl; | 2477 | snd_kcontrol_t *kctl; |
2478 | kctl = snd_ctl_new1(&snd_cs46xx_controls[idx], chip); | 2478 | kctl = snd_ctl_new1(&snd_cs46xx_controls[idx], chip); |
2479 | if (kctl && kctl->id.iface == SNDRV_CTL_ELEM_IFACE_PCM) | ||
2480 | kctl->id.device = spdif_device; | ||
2479 | if ((err = snd_ctl_add(card, kctl)) < 0) | 2481 | if ((err = snd_ctl_add(card, kctl)) < 0) |
2480 | return err; | 2482 | return err; |
2481 | } | 2483 | } |
@@ -3523,17 +3525,6 @@ static void amp_voyetra_4294(cs46xx_t *chip, int change) | |||
3523 | 3525 | ||
3524 | 3526 | ||
3525 | /* | 3527 | /* |
3526 | * piix4 pci ids | ||
3527 | */ | ||
3528 | #ifndef PCI_VENDOR_ID_INTEL | ||
3529 | #define PCI_VENDOR_ID_INTEL 0x8086 | ||
3530 | #endif /* PCI_VENDOR_ID_INTEL */ | ||
3531 | |||
3532 | #ifndef PCI_DEVICE_ID_INTEL_82371AB_3 | ||
3533 | #define PCI_DEVICE_ID_INTEL_82371AB_3 0x7113 | ||
3534 | #endif /* PCI_DEVICE_ID_INTEL_82371AB_3 */ | ||
3535 | |||
3536 | /* | ||
3537 | * Handle the CLKRUN on a thinkpad. We must disable CLKRUN support | 3528 | * Handle the CLKRUN on a thinkpad. We must disable CLKRUN support |
3538 | * whenever we need to beat on the chip. | 3529 | * whenever we need to beat on the chip. |
3539 | * | 3530 | * |
@@ -3546,7 +3537,7 @@ static void clkrun_hack(cs46xx_t *chip, int change) | |||
3546 | { | 3537 | { |
3547 | u16 control, nval; | 3538 | u16 control, nval; |
3548 | 3539 | ||
3549 | if (chip->acpi_dev == NULL) | 3540 | if (!chip->acpi_port) |
3550 | return; | 3541 | return; |
3551 | 3542 | ||
3552 | chip->amplifier += change; | 3543 | chip->amplifier += change; |
@@ -3569,15 +3560,20 @@ static void clkrun_hack(cs46xx_t *chip, int change) | |||
3569 | */ | 3560 | */ |
3570 | static void clkrun_init(cs46xx_t *chip) | 3561 | static void clkrun_init(cs46xx_t *chip) |
3571 | { | 3562 | { |
3563 | struct pci_dev *pdev; | ||
3572 | u8 pp; | 3564 | u8 pp; |
3573 | 3565 | ||
3574 | chip->acpi_dev = pci_find_device(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB_3, NULL); | 3566 | chip->acpi_port = 0; |
3575 | if (chip->acpi_dev == NULL) | 3567 | |
3568 | pdev = pci_get_device(PCI_VENDOR_ID_INTEL, | ||
3569 | PCI_DEVICE_ID_INTEL_82371AB_3, NULL); | ||
3570 | if (pdev == NULL) | ||
3576 | return; /* Not a thinkpad thats for sure */ | 3571 | return; /* Not a thinkpad thats for sure */ |
3577 | 3572 | ||
3578 | /* Find the control port */ | 3573 | /* Find the control port */ |
3579 | pci_read_config_byte(chip->acpi_dev, 0x41, &pp); | 3574 | pci_read_config_byte(pdev, 0x41, &pp); |
3580 | chip->acpi_port = pp << 8; | 3575 | chip->acpi_port = pp << 8; |
3576 | pci_dev_put(pdev); | ||
3581 | } | 3577 | } |
3582 | 3578 | ||
3583 | 3579 | ||
@@ -3778,7 +3774,7 @@ int __devinit snd_cs46xx_create(snd_card_t * card, | |||
3778 | if ((err = pci_enable_device(pci)) < 0) | 3774 | if ((err = pci_enable_device(pci)) < 0) |
3779 | return err; | 3775 | return err; |
3780 | 3776 | ||
3781 | chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); | 3777 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); |
3782 | if (chip == NULL) { | 3778 | if (chip == NULL) { |
3783 | pci_disable_device(pci); | 3779 | pci_disable_device(pci); |
3784 | return -ENOMEM; | 3780 | return -ENOMEM; |
diff --git a/sound/pci/emu10k1/emu10k1.c b/sound/pci/emu10k1/emu10k1.c index b17142cabead..b0e00f0a7c2f 100644 --- a/sound/pci/emu10k1/emu10k1.c +++ b/sound/pci/emu10k1/emu10k1.c | |||
@@ -149,7 +149,7 @@ static int __devinit snd_card_emu10k1_probe(struct pci_dev *pci, | |||
149 | } | 149 | } |
150 | } | 150 | } |
151 | 151 | ||
152 | if ((err = snd_emu10k1_mixer(emu)) < 0) { | 152 | if ((err = snd_emu10k1_mixer(emu, 0, 3)) < 0) { |
153 | snd_card_free(card); | 153 | snd_card_free(card); |
154 | return err; | 154 | return err; |
155 | } | 155 | } |
@@ -223,6 +223,7 @@ static void __devexit snd_card_emu10k1_remove(struct pci_dev *pci) | |||
223 | 223 | ||
224 | static struct pci_driver driver = { | 224 | static struct pci_driver driver = { |
225 | .name = "EMU10K1_Audigy", | 225 | .name = "EMU10K1_Audigy", |
226 | .owner = THIS_MODULE, | ||
226 | .id_table = snd_emu10k1_ids, | 227 | .id_table = snd_emu10k1_ids, |
227 | .probe = snd_card_emu10k1_probe, | 228 | .probe = snd_card_emu10k1_probe, |
228 | .remove = __devexit_p(snd_card_emu10k1_remove), | 229 | .remove = __devexit_p(snd_card_emu10k1_remove), |
diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c index 746b51ef3966..53aeff0b783a 100644 --- a/sound/pci/emu10k1/emu10k1_main.c +++ b/sound/pci/emu10k1/emu10k1_main.c | |||
@@ -579,6 +579,30 @@ static int __devinit snd_emu10k1_ecard_init(emu10k1_t * emu) | |||
579 | return 0; | 579 | return 0; |
580 | } | 580 | } |
581 | 581 | ||
582 | static int __devinit snd_emu10k1_cardbus_init(emu10k1_t * emu) | ||
583 | { | ||
584 | unsigned long special_port; | ||
585 | unsigned int value; | ||
586 | |||
587 | /* Special initialisation routine | ||
588 | * before the rest of the IO-Ports become active. | ||
589 | */ | ||
590 | special_port = emu->port + 0x38; | ||
591 | value = inl(special_port); | ||
592 | outl(0x00d00000, special_port); | ||
593 | value = inl(special_port); | ||
594 | outl(0x00d00001, special_port); | ||
595 | value = inl(special_port); | ||
596 | outl(0x00d0005f, special_port); | ||
597 | value = inl(special_port); | ||
598 | outl(0x00d0007f, special_port); | ||
599 | value = inl(special_port); | ||
600 | outl(0x0090007f, special_port); | ||
601 | value = inl(special_port); | ||
602 | |||
603 | return 0; | ||
604 | } | ||
605 | |||
582 | /* | 606 | /* |
583 | * Create the EMU10K1 instance | 607 | * Create the EMU10K1 instance |
584 | */ | 608 | */ |
@@ -624,6 +648,16 @@ static emu_chip_details_t emu_chip_details[] = { | |||
624 | .ca0108_chip = 1, | 648 | .ca0108_chip = 1, |
625 | .spk71 = 1, | 649 | .spk71 = 1, |
626 | .ac97_chip = 1} , | 650 | .ac97_chip = 1} , |
651 | /* Audigy 2 ZS Notebook Cardbus card.*/ | ||
652 | /* Tested by James@superbug.co.uk 30th October 2005 */ | ||
653 | /* Not working yet, but progressing. */ | ||
654 | {.vendor = 0x1102, .device = 0x0008, .subsystem = 0x20011102, | ||
655 | .driver = "Audigy2", .name = "Audigy 2 ZS Notebook [SB0530]", | ||
656 | .id = "Audigy2", | ||
657 | .emu10k2_chip = 1, | ||
658 | .ca0108_chip = 1, | ||
659 | .ca_cardbus_chip = 1, | ||
660 | .spk71 = 1} , | ||
627 | {.vendor = 0x1102, .device = 0x0008, | 661 | {.vendor = 0x1102, .device = 0x0008, |
628 | .driver = "Audigy2", .name = "Audigy 2 Value [Unknown]", | 662 | .driver = "Audigy2", .name = "Audigy 2 Value [Unknown]", |
629 | .id = "Audigy2", | 663 | .id = "Audigy2", |
@@ -741,17 +775,27 @@ static emu_chip_details_t emu_chip_details[] = { | |||
741 | .emu10k1_chip = 1, | 775 | .emu10k1_chip = 1, |
742 | .ac97_chip = 1, | 776 | .ac97_chip = 1, |
743 | .sblive51 = 1} , | 777 | .sblive51 = 1} , |
778 | /* Tested by Thomas Zehetbauer 27th Aug 2005 */ | ||
779 | {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80651102, | ||
780 | .driver = "EMU10K1", .name = "SB Live 5.1 [SB0220]", | ||
781 | .id = "Live", | ||
782 | .emu10k1_chip = 1, | ||
783 | .ac97_chip = 1, | ||
784 | .sblive51 = 1} , | ||
744 | {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80641102, | 785 | {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80641102, |
745 | .driver = "EMU10K1", .name = "SB Live 5.1", | 786 | .driver = "EMU10K1", .name = "SB Live 5.1", |
746 | .id = "Live", | 787 | .id = "Live", |
747 | .emu10k1_chip = 1, | 788 | .emu10k1_chip = 1, |
748 | .ac97_chip = 1, | 789 | .ac97_chip = 1, |
749 | .sblive51 = 1} , | 790 | .sblive51 = 1} , |
791 | /* Tested by alsa bugtrack user "hus" bug #1297 12th Aug 2005 */ | ||
750 | {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80611102, | 792 | {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80611102, |
751 | .driver = "EMU10K1", .name = "SBLive! Player 5.1 [SB0060]", | 793 | .driver = "EMU10K1", .name = "SBLive 5.1 [SB0060]", |
752 | .id = "Live", | 794 | .id = "Live", |
753 | .emu10k1_chip = 1, | 795 | .emu10k1_chip = 1, |
754 | .ac97_chip = 1, | 796 | .ac97_chip = 2, /* ac97 is optional; both SBLive 5.1 and platinum |
797 | * share the same IDs! | ||
798 | */ | ||
755 | .sblive51 = 1} , | 799 | .sblive51 = 1} , |
756 | {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80511102, | 800 | {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80511102, |
757 | .driver = "EMU10K1", .name = "SBLive! Value [CT4850]", | 801 | .driver = "EMU10K1", .name = "SBLive! Value [CT4850]", |
@@ -857,7 +901,7 @@ int __devinit snd_emu10k1_create(snd_card_t * card, | |||
857 | if ((err = pci_enable_device(pci)) < 0) | 901 | if ((err = pci_enable_device(pci)) < 0) |
858 | return err; | 902 | return err; |
859 | 903 | ||
860 | emu = kcalloc(1, sizeof(*emu), GFP_KERNEL); | 904 | emu = kzalloc(sizeof(*emu), GFP_KERNEL); |
861 | if (emu == NULL) { | 905 | if (emu == NULL) { |
862 | pci_disable_device(pci); | 906 | pci_disable_device(pci); |
863 | return -ENOMEM; | 907 | return -ENOMEM; |
@@ -1001,6 +1045,11 @@ int __devinit snd_emu10k1_create(snd_card_t * card, | |||
1001 | snd_emu10k1_free(emu); | 1045 | snd_emu10k1_free(emu); |
1002 | return err; | 1046 | return err; |
1003 | } | 1047 | } |
1048 | } else if (emu->card_capabilities->ca_cardbus_chip) { | ||
1049 | if ((err = snd_emu10k1_cardbus_init(emu)) < 0) { | ||
1050 | snd_emu10k1_free(emu); | ||
1051 | return err; | ||
1052 | } | ||
1004 | } else { | 1053 | } else { |
1005 | /* 5.1: Enable the additional AC97 Slots. If the emu10k1 version | 1054 | /* 5.1: Enable the additional AC97 Slots. If the emu10k1 version |
1006 | does not support this, it shouldn't do any harm */ | 1055 | does not support this, it shouldn't do any harm */ |
diff --git a/sound/pci/emu10k1/emu10k1x.c b/sound/pci/emu10k1/emu10k1x.c index e90c5ddd1d17..ad15755a63c3 100644 --- a/sound/pci/emu10k1/emu10k1x.c +++ b/sound/pci/emu10k1/emu10k1x.c | |||
@@ -395,7 +395,7 @@ static int snd_emu10k1x_playback_open(snd_pcm_substream_t *substream) | |||
395 | if ((err = snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 64)) < 0) | 395 | if ((err = snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 64)) < 0) |
396 | return err; | 396 | return err; |
397 | 397 | ||
398 | epcm = kcalloc(1, sizeof(*epcm), GFP_KERNEL); | 398 | epcm = kzalloc(sizeof(*epcm), GFP_KERNEL); |
399 | if (epcm == NULL) | 399 | if (epcm == NULL) |
400 | return -ENOMEM; | 400 | return -ENOMEM; |
401 | epcm->emu = chip; | 401 | epcm->emu = chip; |
@@ -571,7 +571,7 @@ static int snd_emu10k1x_pcm_open_capture(snd_pcm_substream_t *substream) | |||
571 | if ((err = snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 64)) < 0) | 571 | if ((err = snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 64)) < 0) |
572 | return err; | 572 | return err; |
573 | 573 | ||
574 | epcm = kcalloc(1, sizeof(*epcm), GFP_KERNEL); | 574 | epcm = kzalloc(sizeof(*epcm), GFP_KERNEL); |
575 | if (epcm == NULL) | 575 | if (epcm == NULL) |
576 | return -ENOMEM; | 576 | return -ENOMEM; |
577 | 577 | ||
@@ -920,7 +920,7 @@ static int __devinit snd_emu10k1x_create(snd_card_t *card, | |||
920 | return -ENXIO; | 920 | return -ENXIO; |
921 | } | 921 | } |
922 | 922 | ||
923 | chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); | 923 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); |
924 | if (chip == NULL) { | 924 | if (chip == NULL) { |
925 | pci_disable_device(pci); | 925 | pci_disable_device(pci); |
926 | return -ENOMEM; | 926 | return -ENOMEM; |
@@ -1183,7 +1183,7 @@ static int snd_emu10k1x_spdif_put(snd_kcontrol_t * kcontrol, | |||
1183 | static snd_kcontrol_new_t snd_emu10k1x_spdif_mask_control = | 1183 | static snd_kcontrol_new_t snd_emu10k1x_spdif_mask_control = |
1184 | { | 1184 | { |
1185 | .access = SNDRV_CTL_ELEM_ACCESS_READ, | 1185 | .access = SNDRV_CTL_ELEM_ACCESS_READ, |
1186 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1186 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, |
1187 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,MASK), | 1187 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,MASK), |
1188 | .count = 3, | 1188 | .count = 3, |
1189 | .info = snd_emu10k1x_spdif_info, | 1189 | .info = snd_emu10k1x_spdif_info, |
@@ -1192,7 +1192,7 @@ static snd_kcontrol_new_t snd_emu10k1x_spdif_mask_control = | |||
1192 | 1192 | ||
1193 | static snd_kcontrol_new_t snd_emu10k1x_spdif_control = | 1193 | static snd_kcontrol_new_t snd_emu10k1x_spdif_control = |
1194 | { | 1194 | { |
1195 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1195 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, |
1196 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,DEFAULT), | 1196 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,DEFAULT), |
1197 | .count = 3, | 1197 | .count = 3, |
1198 | .info = snd_emu10k1x_spdif_info, | 1198 | .info = snd_emu10k1x_spdif_info, |
@@ -1615,6 +1615,7 @@ MODULE_DEVICE_TABLE(pci, snd_emu10k1x_ids); | |||
1615 | // pci_driver definition | 1615 | // pci_driver definition |
1616 | static struct pci_driver driver = { | 1616 | static struct pci_driver driver = { |
1617 | .name = "EMU10K1X", | 1617 | .name = "EMU10K1X", |
1618 | .owner = THIS_MODULE, | ||
1618 | .id_table = snd_emu10k1x_ids, | 1619 | .id_table = snd_emu10k1x_ids, |
1619 | .probe = snd_emu10k1x_probe, | 1620 | .probe = snd_emu10k1x_probe, |
1620 | .remove = __devexit_p(snd_emu10k1x_remove), | 1621 | .remove = __devexit_p(snd_emu10k1x_remove), |
diff --git a/sound/pci/emu10k1/emufx.c b/sound/pci/emu10k1/emufx.c index 0529fb281125..646b5d972e6f 100644 --- a/sound/pci/emu10k1/emufx.c +++ b/sound/pci/emu10k1/emufx.c | |||
@@ -470,7 +470,7 @@ static void snd_emu10k1_write_op(emu10k1_fx8010_code_t *icode, unsigned int *ptr | |||
470 | { | 470 | { |
471 | u_int32_t *code; | 471 | u_int32_t *code; |
472 | snd_assert(*ptr < 512, return); | 472 | snd_assert(*ptr < 512, return); |
473 | code = (u_int32_t *)icode->code + (*ptr) * 2; | 473 | code = (u_int32_t __force *)icode->code + (*ptr) * 2; |
474 | set_bit(*ptr, icode->code_valid); | 474 | set_bit(*ptr, icode->code_valid); |
475 | code[0] = ((x & 0x3ff) << 10) | (y & 0x3ff); | 475 | code[0] = ((x & 0x3ff) << 10) | (y & 0x3ff); |
476 | code[1] = ((op & 0x0f) << 20) | ((r & 0x3ff) << 10) | (a & 0x3ff); | 476 | code[1] = ((op & 0x0f) << 20) | ((r & 0x3ff) << 10) | (a & 0x3ff); |
@@ -485,7 +485,7 @@ static void snd_emu10k1_audigy_write_op(emu10k1_fx8010_code_t *icode, unsigned i | |||
485 | { | 485 | { |
486 | u_int32_t *code; | 486 | u_int32_t *code; |
487 | snd_assert(*ptr < 1024, return); | 487 | snd_assert(*ptr < 1024, return); |
488 | code = (u_int32_t *)icode->code + (*ptr) * 2; | 488 | code = (u_int32_t __force *)icode->code + (*ptr) * 2; |
489 | set_bit(*ptr, icode->code_valid); | 489 | set_bit(*ptr, icode->code_valid); |
490 | code[0] = ((x & 0x7ff) << 12) | (y & 0x7ff); | 490 | code[0] = ((x & 0x7ff) << 12) | (y & 0x7ff); |
491 | code[1] = ((op & 0x0f) << 24) | ((r & 0x7ff) << 12) | (a & 0x7ff); | 491 | code[1] = ((op & 0x0f) << 24) | ((r & 0x7ff) << 12) | (a & 0x7ff); |
@@ -1036,13 +1036,13 @@ static int __devinit _snd_emu10k1_audigy_init_efx(emu10k1_t *emu) | |||
1036 | spin_lock_init(&emu->fx8010.irq_lock); | 1036 | spin_lock_init(&emu->fx8010.irq_lock); |
1037 | INIT_LIST_HEAD(&emu->fx8010.gpr_ctl); | 1037 | INIT_LIST_HEAD(&emu->fx8010.gpr_ctl); |
1038 | 1038 | ||
1039 | if ((icode = kcalloc(1, sizeof(*icode), GFP_KERNEL)) == NULL || | 1039 | if ((icode = kzalloc(sizeof(*icode), GFP_KERNEL)) == NULL || |
1040 | (icode->gpr_map = (u_int32_t __user *)kcalloc(512 + 256 + 256 + 2 * 1024, sizeof(u_int32_t), GFP_KERNEL)) == NULL || | 1040 | (icode->gpr_map = (u_int32_t __user *)kcalloc(512 + 256 + 256 + 2 * 1024, sizeof(u_int32_t), GFP_KERNEL)) == NULL || |
1041 | (controls = kcalloc(SND_EMU10K1_GPR_CONTROLS, sizeof(*controls), GFP_KERNEL)) == NULL) { | 1041 | (controls = kcalloc(SND_EMU10K1_GPR_CONTROLS, sizeof(*controls), GFP_KERNEL)) == NULL) { |
1042 | err = -ENOMEM; | 1042 | err = -ENOMEM; |
1043 | goto __err; | 1043 | goto __err; |
1044 | } | 1044 | } |
1045 | gpr_map = (u32 *)icode->gpr_map; | 1045 | gpr_map = (u32 __force *)icode->gpr_map; |
1046 | 1046 | ||
1047 | icode->tram_data_map = icode->gpr_map + 512; | 1047 | icode->tram_data_map = icode->gpr_map + 512; |
1048 | icode->tram_addr_map = icode->tram_data_map + 256; | 1048 | icode->tram_addr_map = icode->tram_data_map + 256; |
@@ -1159,12 +1159,12 @@ A_OP(icode, &ptr, iMAC0, A_GPR(var), A_GPR(var), A_GPR(vol), A_EXTIN(input)) | |||
1159 | /* Optical SPDIF Playback Volume */ | 1159 | /* Optical SPDIF Playback Volume */ |
1160 | A_ADD_VOLUME_IN(stereo_mix, gpr, A_EXTIN_OPT_SPDIF_L); | 1160 | A_ADD_VOLUME_IN(stereo_mix, gpr, A_EXTIN_OPT_SPDIF_L); |
1161 | A_ADD_VOLUME_IN(stereo_mix+1, gpr+1, A_EXTIN_OPT_SPDIF_R); | 1161 | A_ADD_VOLUME_IN(stereo_mix+1, gpr+1, A_EXTIN_OPT_SPDIF_R); |
1162 | snd_emu10k1_init_stereo_control(&controls[nctl++], "IEC958 Optical Playback Volume", gpr, 0); | 1162 | snd_emu10k1_init_stereo_control(&controls[nctl++], SNDRV_CTL_NAME_IEC958("Optical ",PLAYBACK,VOLUME), gpr, 0); |
1163 | gpr += 2; | 1163 | gpr += 2; |
1164 | /* Optical SPDIF Capture Volume */ | 1164 | /* Optical SPDIF Capture Volume */ |
1165 | A_ADD_VOLUME_IN(capture, gpr, A_EXTIN_OPT_SPDIF_L); | 1165 | A_ADD_VOLUME_IN(capture, gpr, A_EXTIN_OPT_SPDIF_L); |
1166 | A_ADD_VOLUME_IN(capture+1, gpr+1, A_EXTIN_OPT_SPDIF_R); | 1166 | A_ADD_VOLUME_IN(capture+1, gpr+1, A_EXTIN_OPT_SPDIF_R); |
1167 | snd_emu10k1_init_stereo_control(&controls[nctl++], "IEC958 Optical Capture Volume", gpr, 0); | 1167 | snd_emu10k1_init_stereo_control(&controls[nctl++], SNDRV_CTL_NAME_IEC958("Optical ",CAPTURE,VOLUME), gpr, 0); |
1168 | gpr += 2; | 1168 | gpr += 2; |
1169 | 1169 | ||
1170 | /* Line2 Playback Volume */ | 1170 | /* Line2 Playback Volume */ |
@@ -1389,7 +1389,7 @@ A_OP(icode, &ptr, iMAC0, A_GPR(var), A_GPR(var), A_GPR(vol), A_EXTIN(input)) | |||
1389 | A_OP(icode, &ptr, iACC3, A_EXTOUT(A_EXTOUT_FRONT_L + z), A_GPR(tmp + 0), A_GPR(tmp + 1), A_C_00000000); | 1389 | A_OP(icode, &ptr, iACC3, A_EXTOUT(A_EXTOUT_FRONT_L + z), A_GPR(tmp + 0), A_GPR(tmp + 1), A_C_00000000); |
1390 | } | 1390 | } |
1391 | } | 1391 | } |
1392 | snd_emu10k1_init_stereo_onoff_control(controls + nctl++, "IEC958 Optical Raw Playback Switch", gpr, 0); | 1392 | snd_emu10k1_init_stereo_onoff_control(controls + nctl++, SNDRV_CTL_NAME_IEC958("Optical Raw ",PLAYBACK,SWITCH), gpr, 0); |
1393 | gpr += 2; | 1393 | gpr += 2; |
1394 | 1394 | ||
1395 | A_PUT_STEREO_OUTPUT(A_EXTOUT_REAR_L, A_EXTOUT_REAR_R, playback+2 + SND_EMU10K1_PLAYBACK_CHANNELS); | 1395 | A_PUT_STEREO_OUTPUT(A_EXTOUT_REAR_L, A_EXTOUT_REAR_R, playback+2 + SND_EMU10K1_PLAYBACK_CHANNELS); |
@@ -1431,7 +1431,7 @@ A_OP(icode, &ptr, iMAC0, A_GPR(var), A_GPR(var), A_GPR(vol), A_EXTIN(input)) | |||
1431 | __err: | 1431 | __err: |
1432 | kfree(controls); | 1432 | kfree(controls); |
1433 | if (icode != NULL) { | 1433 | if (icode != NULL) { |
1434 | kfree((void *)icode->gpr_map); | 1434 | kfree((void __force *)icode->gpr_map); |
1435 | kfree(icode); | 1435 | kfree(icode); |
1436 | } | 1436 | } |
1437 | return err; | 1437 | return err; |
@@ -1503,15 +1503,15 @@ static int __devinit _snd_emu10k1_init_efx(emu10k1_t *emu) | |||
1503 | spin_lock_init(&emu->fx8010.irq_lock); | 1503 | spin_lock_init(&emu->fx8010.irq_lock); |
1504 | INIT_LIST_HEAD(&emu->fx8010.gpr_ctl); | 1504 | INIT_LIST_HEAD(&emu->fx8010.gpr_ctl); |
1505 | 1505 | ||
1506 | if ((icode = kcalloc(1, sizeof(*icode), GFP_KERNEL)) == NULL) | 1506 | if ((icode = kzalloc(sizeof(*icode), GFP_KERNEL)) == NULL) |
1507 | return -ENOMEM; | 1507 | return -ENOMEM; |
1508 | if ((icode->gpr_map = (u_int32_t __user *)kcalloc(256 + 160 + 160 + 2 * 512, sizeof(u_int32_t), GFP_KERNEL)) == NULL || | 1508 | if ((icode->gpr_map = (u_int32_t __user *)kcalloc(256 + 160 + 160 + 2 * 512, sizeof(u_int32_t), GFP_KERNEL)) == NULL || |
1509 | (controls = kcalloc(SND_EMU10K1_GPR_CONTROLS, sizeof(emu10k1_fx8010_control_gpr_t), GFP_KERNEL)) == NULL || | 1509 | (controls = kcalloc(SND_EMU10K1_GPR_CONTROLS, sizeof(emu10k1_fx8010_control_gpr_t), GFP_KERNEL)) == NULL || |
1510 | (ipcm = kcalloc(1, sizeof(*ipcm), GFP_KERNEL)) == NULL) { | 1510 | (ipcm = kzalloc(sizeof(*ipcm), GFP_KERNEL)) == NULL) { |
1511 | err = -ENOMEM; | 1511 | err = -ENOMEM; |
1512 | goto __err; | 1512 | goto __err; |
1513 | } | 1513 | } |
1514 | gpr_map = (u32 *)icode->gpr_map; | 1514 | gpr_map = (u32 __force *)icode->gpr_map; |
1515 | 1515 | ||
1516 | icode->tram_data_map = icode->gpr_map + 256; | 1516 | icode->tram_data_map = icode->gpr_map + 256; |
1517 | icode->tram_addr_map = icode->tram_data_map + 160; | 1517 | icode->tram_addr_map = icode->tram_data_map + 160; |
@@ -1716,7 +1716,7 @@ static int __devinit _snd_emu10k1_init_efx(emu10k1_t *emu) | |||
1716 | /* IEC958 TTL Playback Volume */ | 1716 | /* IEC958 TTL Playback Volume */ |
1717 | for (z = 0; z < 2; z++) | 1717 | for (z = 0; z < 2; z++) |
1718 | VOLUME_ADDIN(icode, &ptr, playback + z, EXTIN_SPDIF_CD_L + z, gpr + z); | 1718 | VOLUME_ADDIN(icode, &ptr, playback + z, EXTIN_SPDIF_CD_L + z, gpr + z); |
1719 | snd_emu10k1_init_stereo_control(controls + i++, "IEC958 TTL Playback Volume", gpr, 0); | 1719 | snd_emu10k1_init_stereo_control(controls + i++, SNDRV_CTL_NAME_IEC958("TTL ",PLAYBACK,VOLUME), gpr, 0); |
1720 | gpr += 2; | 1720 | gpr += 2; |
1721 | 1721 | ||
1722 | /* IEC958 TTL Capture Volume + Switch */ | 1722 | /* IEC958 TTL Capture Volume + Switch */ |
@@ -1724,8 +1724,8 @@ static int __devinit _snd_emu10k1_init_efx(emu10k1_t *emu) | |||
1724 | SWITCH_IN(icode, &ptr, tmp + 0, EXTIN_SPDIF_CD_L + z, gpr + 2 + z); | 1724 | SWITCH_IN(icode, &ptr, tmp + 0, EXTIN_SPDIF_CD_L + z, gpr + 2 + z); |
1725 | VOLUME_ADD(icode, &ptr, capture + z, tmp + 0, gpr + z); | 1725 | VOLUME_ADD(icode, &ptr, capture + z, tmp + 0, gpr + z); |
1726 | } | 1726 | } |
1727 | snd_emu10k1_init_stereo_control(controls + i++, "IEC958 TTL Capture Volume", gpr, 0); | 1727 | snd_emu10k1_init_stereo_control(controls + i++, SNDRV_CTL_NAME_IEC958("TTL ",CAPTURE,VOLUME), gpr, 0); |
1728 | snd_emu10k1_init_stereo_onoff_control(controls + i++, "IEC958 TTL Capture Switch", gpr + 2, 0); | 1728 | snd_emu10k1_init_stereo_onoff_control(controls + i++, SNDRV_CTL_NAME_IEC958("TTL ",CAPTURE,SWITCH), gpr + 2, 0); |
1729 | gpr += 4; | 1729 | gpr += 4; |
1730 | } | 1730 | } |
1731 | 1731 | ||
@@ -1750,7 +1750,7 @@ static int __devinit _snd_emu10k1_init_efx(emu10k1_t *emu) | |||
1750 | /* IEC958 Optical Playback Volume */ | 1750 | /* IEC958 Optical Playback Volume */ |
1751 | for (z = 0; z < 2; z++) | 1751 | for (z = 0; z < 2; z++) |
1752 | VOLUME_ADDIN(icode, &ptr, playback + z, EXTIN_TOSLINK_L + z, gpr + z); | 1752 | VOLUME_ADDIN(icode, &ptr, playback + z, EXTIN_TOSLINK_L + z, gpr + z); |
1753 | snd_emu10k1_init_stereo_control(controls + i++, "IEC958 LiveDrive Playback Volume", gpr, 0); | 1753 | snd_emu10k1_init_stereo_control(controls + i++, SNDRV_CTL_NAME_IEC958("LiveDrive ",PLAYBACK,VOLUME), gpr, 0); |
1754 | gpr += 2; | 1754 | gpr += 2; |
1755 | 1755 | ||
1756 | /* IEC958 Optical Capture Volume */ | 1756 | /* IEC958 Optical Capture Volume */ |
@@ -1758,8 +1758,8 @@ static int __devinit _snd_emu10k1_init_efx(emu10k1_t *emu) | |||
1758 | SWITCH_IN(icode, &ptr, tmp + 0, EXTIN_TOSLINK_L + z, gpr + 2 + z); | 1758 | SWITCH_IN(icode, &ptr, tmp + 0, EXTIN_TOSLINK_L + z, gpr + 2 + z); |
1759 | VOLUME_ADD(icode, &ptr, capture + z, tmp + 0, gpr + z); | 1759 | VOLUME_ADD(icode, &ptr, capture + z, tmp + 0, gpr + z); |
1760 | } | 1760 | } |
1761 | snd_emu10k1_init_stereo_control(controls + i++, "IEC958 LiveDrive Capture Volume", gpr, 0); | 1761 | snd_emu10k1_init_stereo_control(controls + i++, SNDRV_CTL_NAME_IEC958("LiveDrive ",CAPTURE,VOLUME), gpr, 0); |
1762 | snd_emu10k1_init_stereo_onoff_control(controls + i++, "IEC958 LiveDrive Capture Switch", gpr + 2, 0); | 1762 | snd_emu10k1_init_stereo_onoff_control(controls + i++, SNDRV_CTL_NAME_IEC958("LiveDrive ",CAPTURE,SWITCH), gpr + 2, 0); |
1763 | gpr += 4; | 1763 | gpr += 4; |
1764 | } | 1764 | } |
1765 | 1765 | ||
@@ -1784,7 +1784,7 @@ static int __devinit _snd_emu10k1_init_efx(emu10k1_t *emu) | |||
1784 | /* IEC958 Coax Playback Volume */ | 1784 | /* IEC958 Coax Playback Volume */ |
1785 | for (z = 0; z < 2; z++) | 1785 | for (z = 0; z < 2; z++) |
1786 | VOLUME_ADDIN(icode, &ptr, playback + z, EXTIN_COAX_SPDIF_L + z, gpr + z); | 1786 | VOLUME_ADDIN(icode, &ptr, playback + z, EXTIN_COAX_SPDIF_L + z, gpr + z); |
1787 | snd_emu10k1_init_stereo_control(controls + i++, "IEC958 Coaxial Playback Volume", gpr, 0); | 1787 | snd_emu10k1_init_stereo_control(controls + i++, SNDRV_CTL_NAME_IEC958("Coaxial ",PLAYBACK,VOLUME), gpr, 0); |
1788 | gpr += 2; | 1788 | gpr += 2; |
1789 | 1789 | ||
1790 | /* IEC958 Coax Capture Volume + Switch */ | 1790 | /* IEC958 Coax Capture Volume + Switch */ |
@@ -1792,8 +1792,8 @@ static int __devinit _snd_emu10k1_init_efx(emu10k1_t *emu) | |||
1792 | SWITCH_IN(icode, &ptr, tmp + 0, EXTIN_COAX_SPDIF_L + z, gpr + 2 + z); | 1792 | SWITCH_IN(icode, &ptr, tmp + 0, EXTIN_COAX_SPDIF_L + z, gpr + 2 + z); |
1793 | VOLUME_ADD(icode, &ptr, capture + z, tmp + 0, gpr + z); | 1793 | VOLUME_ADD(icode, &ptr, capture + z, tmp + 0, gpr + z); |
1794 | } | 1794 | } |
1795 | snd_emu10k1_init_stereo_control(controls + i++, "IEC958 Coaxial Capture Volume", gpr, 0); | 1795 | snd_emu10k1_init_stereo_control(controls + i++, SNDRV_CTL_NAME_IEC958("Coaxial ",CAPTURE,VOLUME), gpr, 0); |
1796 | snd_emu10k1_init_stereo_onoff_control(controls + i++, "IEC958 Coaxial Capture Switch", gpr + 2, 0); | 1796 | snd_emu10k1_init_stereo_onoff_control(controls + i++, SNDRV_CTL_NAME_IEC958("Coaxial ",CAPTURE,SWITCH), gpr + 2, 0); |
1797 | gpr += 4; | 1797 | gpr += 4; |
1798 | } | 1798 | } |
1799 | 1799 | ||
@@ -1920,7 +1920,7 @@ static int __devinit _snd_emu10k1_init_efx(emu10k1_t *emu) | |||
1920 | #endif | 1920 | #endif |
1921 | } | 1921 | } |
1922 | 1922 | ||
1923 | snd_emu10k1_init_stereo_onoff_control(controls + i++, "IEC958 Optical Raw Playback Switch", gpr, 0); | 1923 | snd_emu10k1_init_stereo_onoff_control(controls + i++, SNDRV_CTL_NAME_IEC958("Optical Raw ",PLAYBACK,SWITCH), gpr, 0); |
1924 | gpr += 2; | 1924 | gpr += 2; |
1925 | } | 1925 | } |
1926 | 1926 | ||
@@ -2032,7 +2032,7 @@ static int __devinit _snd_emu10k1_init_efx(emu10k1_t *emu) | |||
2032 | kfree(ipcm); | 2032 | kfree(ipcm); |
2033 | kfree(controls); | 2033 | kfree(controls); |
2034 | if (icode != NULL) { | 2034 | if (icode != NULL) { |
2035 | kfree((void *)icode->gpr_map); | 2035 | kfree((void __force *)icode->gpr_map); |
2036 | kfree(icode); | 2036 | kfree(icode); |
2037 | } | 2037 | } |
2038 | return err; | 2038 | return err; |
@@ -2217,7 +2217,7 @@ static int snd_emu10k1_fx8010_ioctl(snd_hwdep_t * hw, struct file *file, unsigne | |||
2217 | kfree(ipcm); | 2217 | kfree(ipcm); |
2218 | return res; | 2218 | return res; |
2219 | case SNDRV_EMU10K1_IOCTL_PCM_PEEK: | 2219 | case SNDRV_EMU10K1_IOCTL_PCM_PEEK: |
2220 | ipcm = kcalloc(1, sizeof(*ipcm), GFP_KERNEL); | 2220 | ipcm = kzalloc(sizeof(*ipcm), GFP_KERNEL); |
2221 | if (ipcm == NULL) | 2221 | if (ipcm == NULL) |
2222 | return -ENOMEM; | 2222 | return -ENOMEM; |
2223 | if (copy_from_user(ipcm, argp, sizeof(*ipcm))) { | 2223 | if (copy_from_user(ipcm, argp, sizeof(*ipcm))) { |
diff --git a/sound/pci/emu10k1/emumixer.c b/sound/pci/emu10k1/emumixer.c index 6be82c5fe138..7cc831ccd0cb 100644 --- a/sound/pci/emu10k1/emumixer.c +++ b/sound/pci/emu10k1/emumixer.c | |||
@@ -181,7 +181,7 @@ static int snd_emu10k1_spdif_put(snd_kcontrol_t * kcontrol, | |||
181 | static snd_kcontrol_new_t snd_emu10k1_spdif_mask_control = | 181 | static snd_kcontrol_new_t snd_emu10k1_spdif_mask_control = |
182 | { | 182 | { |
183 | .access = SNDRV_CTL_ELEM_ACCESS_READ, | 183 | .access = SNDRV_CTL_ELEM_ACCESS_READ, |
184 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 184 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, |
185 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,MASK), | 185 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,MASK), |
186 | .count = 4, | 186 | .count = 4, |
187 | .info = snd_emu10k1_spdif_info, | 187 | .info = snd_emu10k1_spdif_info, |
@@ -190,7 +190,7 @@ static snd_kcontrol_new_t snd_emu10k1_spdif_mask_control = | |||
190 | 190 | ||
191 | static snd_kcontrol_new_t snd_emu10k1_spdif_control = | 191 | static snd_kcontrol_new_t snd_emu10k1_spdif_control = |
192 | { | 192 | { |
193 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 193 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, |
194 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,DEFAULT), | 194 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,DEFAULT), |
195 | .count = 4, | 195 | .count = 4, |
196 | .info = snd_emu10k1_spdif_info, | 196 | .info = snd_emu10k1_spdif_info, |
@@ -295,7 +295,7 @@ static int snd_emu10k1_send_routing_put(snd_kcontrol_t * kcontrol, | |||
295 | static snd_kcontrol_new_t snd_emu10k1_send_routing_control = | 295 | static snd_kcontrol_new_t snd_emu10k1_send_routing_control = |
296 | { | 296 | { |
297 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_INACTIVE, | 297 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_INACTIVE, |
298 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 298 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, |
299 | .name = "EMU10K1 PCM Send Routing", | 299 | .name = "EMU10K1 PCM Send Routing", |
300 | .count = 32, | 300 | .count = 32, |
301 | .info = snd_emu10k1_send_routing_info, | 301 | .info = snd_emu10k1_send_routing_info, |
@@ -364,7 +364,7 @@ static int snd_emu10k1_send_volume_put(snd_kcontrol_t * kcontrol, | |||
364 | static snd_kcontrol_new_t snd_emu10k1_send_volume_control = | 364 | static snd_kcontrol_new_t snd_emu10k1_send_volume_control = |
365 | { | 365 | { |
366 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_INACTIVE, | 366 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_INACTIVE, |
367 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 367 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, |
368 | .name = "EMU10K1 PCM Send Volume", | 368 | .name = "EMU10K1 PCM Send Volume", |
369 | .count = 32, | 369 | .count = 32, |
370 | .info = snd_emu10k1_send_volume_info, | 370 | .info = snd_emu10k1_send_volume_info, |
@@ -427,7 +427,7 @@ static int snd_emu10k1_attn_put(snd_kcontrol_t * kcontrol, | |||
427 | static snd_kcontrol_new_t snd_emu10k1_attn_control = | 427 | static snd_kcontrol_new_t snd_emu10k1_attn_control = |
428 | { | 428 | { |
429 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_INACTIVE, | 429 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_INACTIVE, |
430 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 430 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, |
431 | .name = "EMU10K1 PCM Volume", | 431 | .name = "EMU10K1 PCM Volume", |
432 | .count = 32, | 432 | .count = 32, |
433 | .info = snd_emu10k1_attn_info, | 433 | .info = snd_emu10k1_attn_info, |
@@ -737,7 +737,8 @@ static int rename_ctl(snd_card_t *card, const char *src, const char *dst) | |||
737 | return -ENOENT; | 737 | return -ENOENT; |
738 | } | 738 | } |
739 | 739 | ||
740 | int __devinit snd_emu10k1_mixer(emu10k1_t *emu) | 740 | int __devinit snd_emu10k1_mixer(emu10k1_t *emu, |
741 | int pcm_device, int multi_device) | ||
741 | { | 742 | { |
742 | int err, pcm; | 743 | int err, pcm; |
743 | snd_kcontrol_t *kctl; | 744 | snd_kcontrol_t *kctl; |
@@ -809,8 +810,14 @@ int __devinit snd_emu10k1_mixer(emu10k1_t *emu) | |||
809 | ac97.private_data = emu; | 810 | ac97.private_data = emu; |
810 | ac97.private_free = snd_emu10k1_mixer_free_ac97; | 811 | ac97.private_free = snd_emu10k1_mixer_free_ac97; |
811 | ac97.scaps = AC97_SCAP_NO_SPDIF; | 812 | ac97.scaps = AC97_SCAP_NO_SPDIF; |
812 | if ((err = snd_ac97_mixer(pbus, &ac97, &emu->ac97)) < 0) | 813 | if ((err = snd_ac97_mixer(pbus, &ac97, &emu->ac97)) < 0) { |
813 | return err; | 814 | if (emu->card_capabilities->ac97_chip == 1) |
815 | return err; | ||
816 | snd_printd(KERN_INFO "emu10k1: AC97 is optional on this board\n"); | ||
817 | snd_printd(KERN_INFO" Proceeding without ac97 mixers...\n"); | ||
818 | snd_device_free(emu->card, pbus); | ||
819 | goto no_ac97; /* FIXME: get rid of ugly gotos.. */ | ||
820 | } | ||
814 | if (emu->audigy) { | 821 | if (emu->audigy) { |
815 | /* set master volume to 0 dB */ | 822 | /* set master volume to 0 dB */ |
816 | snd_ac97_write(emu->ac97, AC97_MASTER, 0x0000); | 823 | snd_ac97_write(emu->ac97, AC97_MASTER, 0x0000); |
@@ -835,6 +842,7 @@ int __devinit snd_emu10k1_mixer(emu10k1_t *emu) | |||
835 | for (; *c; c++) | 842 | for (; *c; c++) |
836 | remove_ctl(card, *c); | 843 | remove_ctl(card, *c); |
837 | } else { | 844 | } else { |
845 | no_ac97: | ||
838 | if (emu->card_capabilities->ecard) | 846 | if (emu->card_capabilities->ecard) |
839 | strcpy(emu->card->mixername, "EMU APS"); | 847 | strcpy(emu->card->mixername, "EMU APS"); |
840 | else if (emu->audigy) | 848 | else if (emu->audigy) |
@@ -852,29 +860,35 @@ int __devinit snd_emu10k1_mixer(emu10k1_t *emu) | |||
852 | 860 | ||
853 | if ((kctl = emu->ctl_send_routing = snd_ctl_new1(&snd_emu10k1_send_routing_control, emu)) == NULL) | 861 | if ((kctl = emu->ctl_send_routing = snd_ctl_new1(&snd_emu10k1_send_routing_control, emu)) == NULL) |
854 | return -ENOMEM; | 862 | return -ENOMEM; |
863 | kctl->id.device = pcm_device; | ||
855 | if ((err = snd_ctl_add(card, kctl))) | 864 | if ((err = snd_ctl_add(card, kctl))) |
856 | return err; | 865 | return err; |
857 | if ((kctl = emu->ctl_send_volume = snd_ctl_new1(&snd_emu10k1_send_volume_control, emu)) == NULL) | 866 | if ((kctl = emu->ctl_send_volume = snd_ctl_new1(&snd_emu10k1_send_volume_control, emu)) == NULL) |
858 | return -ENOMEM; | 867 | return -ENOMEM; |
868 | kctl->id.device = pcm_device; | ||
859 | if ((err = snd_ctl_add(card, kctl))) | 869 | if ((err = snd_ctl_add(card, kctl))) |
860 | return err; | 870 | return err; |
861 | if ((kctl = emu->ctl_attn = snd_ctl_new1(&snd_emu10k1_attn_control, emu)) == NULL) | 871 | if ((kctl = emu->ctl_attn = snd_ctl_new1(&snd_emu10k1_attn_control, emu)) == NULL) |
862 | return -ENOMEM; | 872 | return -ENOMEM; |
873 | kctl->id.device = pcm_device; | ||
863 | if ((err = snd_ctl_add(card, kctl))) | 874 | if ((err = snd_ctl_add(card, kctl))) |
864 | return err; | 875 | return err; |
865 | 876 | ||
866 | if ((kctl = emu->ctl_efx_send_routing = snd_ctl_new1(&snd_emu10k1_efx_send_routing_control, emu)) == NULL) | 877 | if ((kctl = emu->ctl_efx_send_routing = snd_ctl_new1(&snd_emu10k1_efx_send_routing_control, emu)) == NULL) |
867 | return -ENOMEM; | 878 | return -ENOMEM; |
879 | kctl->id.device = multi_device; | ||
868 | if ((err = snd_ctl_add(card, kctl))) | 880 | if ((err = snd_ctl_add(card, kctl))) |
869 | return err; | 881 | return err; |
870 | 882 | ||
871 | if ((kctl = emu->ctl_efx_send_volume = snd_ctl_new1(&snd_emu10k1_efx_send_volume_control, emu)) == NULL) | 883 | if ((kctl = emu->ctl_efx_send_volume = snd_ctl_new1(&snd_emu10k1_efx_send_volume_control, emu)) == NULL) |
872 | return -ENOMEM; | 884 | return -ENOMEM; |
885 | kctl->id.device = multi_device; | ||
873 | if ((err = snd_ctl_add(card, kctl))) | 886 | if ((err = snd_ctl_add(card, kctl))) |
874 | return err; | 887 | return err; |
875 | 888 | ||
876 | if ((kctl = emu->ctl_efx_attn = snd_ctl_new1(&snd_emu10k1_efx_attn_control, emu)) == NULL) | 889 | if ((kctl = emu->ctl_efx_attn = snd_ctl_new1(&snd_emu10k1_efx_attn_control, emu)) == NULL) |
877 | return -ENOMEM; | 890 | return -ENOMEM; |
891 | kctl->id.device = multi_device; | ||
878 | if ((err = snd_ctl_add(card, kctl))) | 892 | if ((err = snd_ctl_add(card, kctl))) |
879 | return err; | 893 | return err; |
880 | 894 | ||
@@ -924,10 +938,14 @@ int __devinit snd_emu10k1_mixer(emu10k1_t *emu) | |||
924 | /* sb live! and audigy */ | 938 | /* sb live! and audigy */ |
925 | if ((kctl = snd_ctl_new1(&snd_emu10k1_spdif_mask_control, emu)) == NULL) | 939 | if ((kctl = snd_ctl_new1(&snd_emu10k1_spdif_mask_control, emu)) == NULL) |
926 | return -ENOMEM; | 940 | return -ENOMEM; |
941 | if (!emu->audigy) | ||
942 | kctl->id.device = emu->pcm_efx->device; | ||
927 | if ((err = snd_ctl_add(card, kctl))) | 943 | if ((err = snd_ctl_add(card, kctl))) |
928 | return err; | 944 | return err; |
929 | if ((kctl = snd_ctl_new1(&snd_emu10k1_spdif_control, emu)) == NULL) | 945 | if ((kctl = snd_ctl_new1(&snd_emu10k1_spdif_control, emu)) == NULL) |
930 | return -ENOMEM; | 946 | return -ENOMEM; |
947 | if (!emu->audigy) | ||
948 | kctl->id.device = emu->pcm_efx->device; | ||
931 | if ((err = snd_ctl_add(card, kctl))) | 949 | if ((err = snd_ctl_add(card, kctl))) |
932 | return err; | 950 | return err; |
933 | } | 951 | } |
diff --git a/sound/pci/emu10k1/emupcm.c b/sound/pci/emu10k1/emupcm.c index 520b99af5f55..66ba27afe962 100644 --- a/sound/pci/emu10k1/emupcm.c +++ b/sound/pci/emu10k1/emupcm.c | |||
@@ -1016,7 +1016,7 @@ static int snd_emu10k1_efx_playback_open(snd_pcm_substream_t * substream) | |||
1016 | snd_pcm_runtime_t *runtime = substream->runtime; | 1016 | snd_pcm_runtime_t *runtime = substream->runtime; |
1017 | int i; | 1017 | int i; |
1018 | 1018 | ||
1019 | epcm = kcalloc(1, sizeof(*epcm), GFP_KERNEL); | 1019 | epcm = kzalloc(sizeof(*epcm), GFP_KERNEL); |
1020 | if (epcm == NULL) | 1020 | if (epcm == NULL) |
1021 | return -ENOMEM; | 1021 | return -ENOMEM; |
1022 | epcm->emu = emu; | 1022 | epcm->emu = emu; |
@@ -1049,7 +1049,7 @@ static int snd_emu10k1_playback_open(snd_pcm_substream_t * substream) | |||
1049 | snd_pcm_runtime_t *runtime = substream->runtime; | 1049 | snd_pcm_runtime_t *runtime = substream->runtime; |
1050 | int i, err; | 1050 | int i, err; |
1051 | 1051 | ||
1052 | epcm = kcalloc(1, sizeof(*epcm), GFP_KERNEL); | 1052 | epcm = kzalloc(sizeof(*epcm), GFP_KERNEL); |
1053 | if (epcm == NULL) | 1053 | if (epcm == NULL) |
1054 | return -ENOMEM; | 1054 | return -ENOMEM; |
1055 | epcm->emu = emu; | 1055 | epcm->emu = emu; |
@@ -1094,7 +1094,7 @@ static int snd_emu10k1_capture_open(snd_pcm_substream_t * substream) | |||
1094 | snd_pcm_runtime_t *runtime = substream->runtime; | 1094 | snd_pcm_runtime_t *runtime = substream->runtime; |
1095 | emu10k1_pcm_t *epcm; | 1095 | emu10k1_pcm_t *epcm; |
1096 | 1096 | ||
1097 | epcm = kcalloc(1, sizeof(*epcm), GFP_KERNEL); | 1097 | epcm = kzalloc(sizeof(*epcm), GFP_KERNEL); |
1098 | if (epcm == NULL) | 1098 | if (epcm == NULL) |
1099 | return -ENOMEM; | 1099 | return -ENOMEM; |
1100 | epcm->emu = emu; | 1100 | epcm->emu = emu; |
@@ -1130,7 +1130,7 @@ static int snd_emu10k1_capture_mic_open(snd_pcm_substream_t * substream) | |||
1130 | emu10k1_pcm_t *epcm; | 1130 | emu10k1_pcm_t *epcm; |
1131 | snd_pcm_runtime_t *runtime = substream->runtime; | 1131 | snd_pcm_runtime_t *runtime = substream->runtime; |
1132 | 1132 | ||
1133 | epcm = kcalloc(1, sizeof(*epcm), GFP_KERNEL); | 1133 | epcm = kzalloc(sizeof(*epcm), GFP_KERNEL); |
1134 | if (epcm == NULL) | 1134 | if (epcm == NULL) |
1135 | return -ENOMEM; | 1135 | return -ENOMEM; |
1136 | epcm->emu = emu; | 1136 | epcm->emu = emu; |
@@ -1170,7 +1170,7 @@ static int snd_emu10k1_capture_efx_open(snd_pcm_substream_t * substream) | |||
1170 | int nefx = emu->audigy ? 64 : 32; | 1170 | int nefx = emu->audigy ? 64 : 32; |
1171 | int idx; | 1171 | int idx; |
1172 | 1172 | ||
1173 | epcm = kcalloc(1, sizeof(*epcm), GFP_KERNEL); | 1173 | epcm = kzalloc(sizeof(*epcm), GFP_KERNEL); |
1174 | if (epcm == NULL) | 1174 | if (epcm == NULL) |
1175 | return -ENOMEM; | 1175 | return -ENOMEM; |
1176 | epcm->emu = emu; | 1176 | epcm->emu = emu; |
@@ -1682,6 +1682,7 @@ static void snd_emu10k1_pcm_efx_free(snd_pcm_t *pcm) | |||
1682 | int __devinit snd_emu10k1_pcm_efx(emu10k1_t * emu, int device, snd_pcm_t ** rpcm) | 1682 | int __devinit snd_emu10k1_pcm_efx(emu10k1_t * emu, int device, snd_pcm_t ** rpcm) |
1683 | { | 1683 | { |
1684 | snd_pcm_t *pcm; | 1684 | snd_pcm_t *pcm; |
1685 | snd_kcontrol_t *kctl; | ||
1685 | int err; | 1686 | int err; |
1686 | 1687 | ||
1687 | if (rpcm) | 1688 | if (rpcm) |
@@ -1714,7 +1715,11 @@ int __devinit snd_emu10k1_pcm_efx(emu10k1_t * emu, int device, snd_pcm_t ** rpcm | |||
1714 | emu->efx_voices_mask[0] = 0xffff0000; | 1715 | emu->efx_voices_mask[0] = 0xffff0000; |
1715 | emu->efx_voices_mask[1] = 0; | 1716 | emu->efx_voices_mask[1] = 0; |
1716 | } | 1717 | } |
1717 | snd_ctl_add(emu->card, snd_ctl_new1(&snd_emu10k1_pcm_efx_voices_mask, emu)); | 1718 | kctl = snd_ctl_new1(&snd_emu10k1_pcm_efx_voices_mask, emu); |
1719 | if (!kctl) | ||
1720 | return -ENOMEM; | ||
1721 | kctl->id.device = device; | ||
1722 | snd_ctl_add(emu->card, kctl); | ||
1718 | 1723 | ||
1719 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(emu->pci), 64*1024, 64*1024); | 1724 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(emu->pci), 64*1024, 64*1024); |
1720 | 1725 | ||
diff --git a/sound/pci/emu10k1/p16v.c b/sound/pci/emu10k1/p16v.c index a1691330d3b6..d59c7f345ad6 100644 --- a/sound/pci/emu10k1/p16v.c +++ b/sound/pci/emu10k1/p16v.c | |||
@@ -178,7 +178,7 @@ static int snd_p16v_pcm_open_playback_channel(snd_pcm_substream_t *substream, in | |||
178 | snd_pcm_runtime_t *runtime = substream->runtime; | 178 | snd_pcm_runtime_t *runtime = substream->runtime; |
179 | int err; | 179 | int err; |
180 | 180 | ||
181 | epcm = kcalloc(1, sizeof(*epcm), GFP_KERNEL); | 181 | epcm = kzalloc(sizeof(*epcm), GFP_KERNEL); |
182 | //snd_printk("epcm kcalloc: %p\n", epcm); | 182 | //snd_printk("epcm kcalloc: %p\n", epcm); |
183 | 183 | ||
184 | if (epcm == NULL) | 184 | if (epcm == NULL) |
@@ -214,7 +214,7 @@ static int snd_p16v_pcm_open_capture_channel(snd_pcm_substream_t *substream, int | |||
214 | snd_pcm_runtime_t *runtime = substream->runtime; | 214 | snd_pcm_runtime_t *runtime = substream->runtime; |
215 | int err; | 215 | int err; |
216 | 216 | ||
217 | epcm = kcalloc(1, sizeof(*epcm), GFP_KERNEL); | 217 | epcm = kzalloc(sizeof(*epcm), GFP_KERNEL); |
218 | //snd_printk("epcm kcalloc: %p\n", epcm); | 218 | //snd_printk("epcm kcalloc: %p\n", epcm); |
219 | 219 | ||
220 | if (epcm == NULL) | 220 | if (epcm == NULL) |
diff --git a/sound/pci/ens1370.c b/sound/pci/ens1370.c index 78a81f3912a1..bef9a59f46d7 100644 --- a/sound/pci/ens1370.c +++ b/sound/pci/ens1370.c | |||
@@ -100,13 +100,6 @@ MODULE_PARM_DESC(joystick, "Enable joystick."); | |||
100 | #endif | 100 | #endif |
101 | #endif /* SUPPORT_JOYSTICK */ | 101 | #endif /* SUPPORT_JOYSTICK */ |
102 | 102 | ||
103 | #ifndef PCI_DEVICE_ID_ENSONIQ_CT5880 | ||
104 | #define PCI_DEVICE_ID_ENSONIQ_CT5880 0x5880 | ||
105 | #endif | ||
106 | #ifndef PCI_DEVICE_ID_ENSONIQ_ES1371 | ||
107 | #define PCI_DEVICE_ID_ENSONIQ_ES1371 0x1371 | ||
108 | #endif | ||
109 | |||
110 | /* ES1371 chip ID */ | 103 | /* ES1371 chip ID */ |
111 | /* This is a little confusing because all ES1371 compatible chips have the | 104 | /* This is a little confusing because all ES1371 compatible chips have the |
112 | same DEVICE_ID, the only thing differentiating them is the REV_ID field. | 105 | same DEVICE_ID, the only thing differentiating them is the REV_ID field. |
@@ -1444,7 +1437,7 @@ static int snd_es1371_spdif_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t | |||
1444 | 1437 | ||
1445 | /* spdif controls */ | 1438 | /* spdif controls */ |
1446 | static snd_kcontrol_new_t snd_es1371_mixer_spdif[] __devinitdata = { | 1439 | static snd_kcontrol_new_t snd_es1371_mixer_spdif[] __devinitdata = { |
1447 | ES1371_SPDIF("IEC958 Playback Switch"), | 1440 | ES1371_SPDIF(SNDRV_CTL_NAME_IEC958("",PLAYBACK,SWITCH)), |
1448 | { | 1441 | { |
1449 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, | 1442 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, |
1450 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,DEFAULT), | 1443 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,DEFAULT), |
@@ -1950,7 +1943,7 @@ static int __devinit snd_ensoniq_create(snd_card_t * card, | |||
1950 | *rensoniq = NULL; | 1943 | *rensoniq = NULL; |
1951 | if ((err = pci_enable_device(pci)) < 0) | 1944 | if ((err = pci_enable_device(pci)) < 0) |
1952 | return err; | 1945 | return err; |
1953 | ensoniq = kcalloc(1, sizeof(*ensoniq), GFP_KERNEL); | 1946 | ensoniq = kzalloc(sizeof(*ensoniq), GFP_KERNEL); |
1954 | if (ensoniq == NULL) { | 1947 | if (ensoniq == NULL) { |
1955 | pci_disable_device(pci); | 1948 | pci_disable_device(pci); |
1956 | return -ENOMEM; | 1949 | return -ENOMEM; |
@@ -2394,6 +2387,7 @@ static void __devexit snd_audiopci_remove(struct pci_dev *pci) | |||
2394 | 2387 | ||
2395 | static struct pci_driver driver = { | 2388 | static struct pci_driver driver = { |
2396 | .name = DRIVER_NAME, | 2389 | .name = DRIVER_NAME, |
2390 | .owner = THIS_MODULE, | ||
2397 | .id_table = snd_audiopci_ids, | 2391 | .id_table = snd_audiopci_ids, |
2398 | .probe = snd_audiopci_probe, | 2392 | .probe = snd_audiopci_probe, |
2399 | .remove = __devexit_p(snd_audiopci_remove), | 2393 | .remove = __devexit_p(snd_audiopci_remove), |
diff --git a/sound/pci/es1938.c b/sound/pci/es1938.c index b492777bc30f..17fa80c23870 100644 --- a/sound/pci/es1938.c +++ b/sound/pci/es1938.c | |||
@@ -76,13 +76,6 @@ MODULE_SUPPORTED_DEVICE("{{ESS,ES1938}," | |||
76 | #define SUPPORT_JOYSTICK 1 | 76 | #define SUPPORT_JOYSTICK 1 |
77 | #endif | 77 | #endif |
78 | 78 | ||
79 | #ifndef PCI_VENDOR_ID_ESS | ||
80 | #define PCI_VENDOR_ID_ESS 0x125d | ||
81 | #endif | ||
82 | #ifndef PCI_DEVICE_ID_ESS_ES1938 | ||
83 | #define PCI_DEVICE_ID_ESS_ES1938 0x1969 | ||
84 | #endif | ||
85 | |||
86 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ | 79 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ |
87 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ | 80 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ |
88 | static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ | 81 | static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ |
@@ -1501,7 +1494,7 @@ static int __devinit snd_es1938_create(snd_card_t * card, | |||
1501 | return -ENXIO; | 1494 | return -ENXIO; |
1502 | } | 1495 | } |
1503 | 1496 | ||
1504 | chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); | 1497 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); |
1505 | if (chip == NULL) { | 1498 | if (chip == NULL) { |
1506 | pci_disable_device(pci); | 1499 | pci_disable_device(pci); |
1507 | return -ENOMEM; | 1500 | return -ENOMEM; |
@@ -1753,6 +1746,7 @@ static void __devexit snd_es1938_remove(struct pci_dev *pci) | |||
1753 | 1746 | ||
1754 | static struct pci_driver driver = { | 1747 | static struct pci_driver driver = { |
1755 | .name = "ESS ES1938 (Solo-1)", | 1748 | .name = "ESS ES1938 (Solo-1)", |
1749 | .owner = THIS_MODULE, | ||
1756 | .id_table = snd_es1938_ids, | 1750 | .id_table = snd_es1938_ids, |
1757 | .probe = snd_es1938_probe, | 1751 | .probe = snd_es1938_probe, |
1758 | .remove = __devexit_p(snd_es1938_remove), | 1752 | .remove = __devexit_p(snd_es1938_remove), |
diff --git a/sound/pci/es1968.c b/sound/pci/es1968.c index 9d7a28783930..ecdcada90ca2 100644 --- a/sound/pci/es1968.c +++ b/sound/pci/es1968.c | |||
@@ -160,25 +160,6 @@ MODULE_PARM_DESC(joystick, "Enable joystick."); | |||
160 | #endif | 160 | #endif |
161 | 161 | ||
162 | 162 | ||
163 | /* PCI Dev ID's */ | ||
164 | |||
165 | #ifndef PCI_VENDOR_ID_ESS | ||
166 | #define PCI_VENDOR_ID_ESS 0x125D | ||
167 | #endif | ||
168 | |||
169 | #define PCI_VENDOR_ID_ESS_OLD 0x1285 /* Platform Tech, the people the ESS | ||
170 | was bought form */ | ||
171 | |||
172 | #ifndef PCI_DEVICE_ID_ESS_M2E | ||
173 | #define PCI_DEVICE_ID_ESS_M2E 0x1978 | ||
174 | #endif | ||
175 | #ifndef PCI_DEVICE_ID_ESS_M2 | ||
176 | #define PCI_DEVICE_ID_ESS_M2 0x1968 | ||
177 | #endif | ||
178 | #ifndef PCI_DEVICE_ID_ESS_M1 | ||
179 | #define PCI_DEVICE_ID_ESS_M1 0x0100 | ||
180 | #endif | ||
181 | |||
182 | #define NR_APUS 64 | 163 | #define NR_APUS 64 |
183 | #define NR_APU_REGS 16 | 164 | #define NR_APU_REGS 16 |
184 | 165 | ||
@@ -1596,7 +1577,7 @@ static int snd_es1968_playback_open(snd_pcm_substream_t *substream) | |||
1596 | if (apu1 < 0) | 1577 | if (apu1 < 0) |
1597 | return apu1; | 1578 | return apu1; |
1598 | 1579 | ||
1599 | es = kcalloc(1, sizeof(*es), GFP_KERNEL); | 1580 | es = kzalloc(sizeof(*es), GFP_KERNEL); |
1600 | if (!es) { | 1581 | if (!es) { |
1601 | snd_es1968_free_apu_pair(chip, apu1); | 1582 | snd_es1968_free_apu_pair(chip, apu1); |
1602 | return -ENOMEM; | 1583 | return -ENOMEM; |
@@ -1641,7 +1622,7 @@ static int snd_es1968_capture_open(snd_pcm_substream_t *substream) | |||
1641 | return apu2; | 1622 | return apu2; |
1642 | } | 1623 | } |
1643 | 1624 | ||
1644 | es = kcalloc(1, sizeof(*es), GFP_KERNEL); | 1625 | es = kzalloc(sizeof(*es), GFP_KERNEL); |
1645 | if (!es) { | 1626 | if (!es) { |
1646 | snd_es1968_free_apu_pair(chip, apu1); | 1627 | snd_es1968_free_apu_pair(chip, apu1); |
1647 | snd_es1968_free_apu_pair(chip, apu2); | 1628 | snd_es1968_free_apu_pair(chip, apu2); |
@@ -2588,7 +2569,7 @@ static int __devinit snd_es1968_create(snd_card_t * card, | |||
2588 | return -ENXIO; | 2569 | return -ENXIO; |
2589 | } | 2570 | } |
2590 | 2571 | ||
2591 | chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); | 2572 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); |
2592 | if (! chip) { | 2573 | if (! chip) { |
2593 | pci_disable_device(pci); | 2574 | pci_disable_device(pci); |
2594 | return -ENOMEM; | 2575 | return -ENOMEM; |
@@ -2782,6 +2763,7 @@ static void __devexit snd_es1968_remove(struct pci_dev *pci) | |||
2782 | 2763 | ||
2783 | static struct pci_driver driver = { | 2764 | static struct pci_driver driver = { |
2784 | .name = "ES1968 (ESS Maestro)", | 2765 | .name = "ES1968 (ESS Maestro)", |
2766 | .owner = THIS_MODULE, | ||
2785 | .id_table = snd_es1968_ids, | 2767 | .id_table = snd_es1968_ids, |
2786 | .probe = snd_es1968_probe, | 2768 | .probe = snd_es1968_probe, |
2787 | .remove = __devexit_p(snd_es1968_remove), | 2769 | .remove = __devexit_p(snd_es1968_remove), |
diff --git a/sound/pci/fm801.c b/sound/pci/fm801.c index ff10e637a95e..e5cfa2a0c246 100644 --- a/sound/pci/fm801.c +++ b/sound/pci/fm801.c | |||
@@ -1155,10 +1155,10 @@ FM801_SINGLE("FM Playback Switch", FM801_FM_VOL, 15, 1, 1), | |||
1155 | static snd_kcontrol_new_t snd_fm801_controls_multi[] __devinitdata = { | 1155 | static snd_kcontrol_new_t snd_fm801_controls_multi[] __devinitdata = { |
1156 | FM801_SINGLE("AC97 2ch->4ch Copy Switch", FM801_CODEC_CTRL, 7, 1, 0), | 1156 | FM801_SINGLE("AC97 2ch->4ch Copy Switch", FM801_CODEC_CTRL, 7, 1, 0), |
1157 | FM801_SINGLE("AC97 18-bit Switch", FM801_CODEC_CTRL, 10, 1, 0), | 1157 | FM801_SINGLE("AC97 18-bit Switch", FM801_CODEC_CTRL, 10, 1, 0), |
1158 | FM801_SINGLE("IEC958 Capture Switch", FM801_I2S_MODE, 8, 1, 0), | 1158 | FM801_SINGLE(SNDRV_CTL_NAME_IEC958("",CAPTURE,SWITCH), FM801_I2S_MODE, 8, 1, 0), |
1159 | FM801_SINGLE("IEC958 Raw Data Playback Switch", FM801_I2S_MODE, 9, 1, 0), | 1159 | FM801_SINGLE(SNDRV_CTL_NAME_IEC958("Raw Data ",PLAYBACK,SWITCH), FM801_I2S_MODE, 9, 1, 0), |
1160 | FM801_SINGLE("IEC958 Raw Data Capture Switch", FM801_I2S_MODE, 10, 1, 0), | 1160 | FM801_SINGLE(SNDRV_CTL_NAME_IEC958("Raw Data ",CAPTURE,SWITCH), FM801_I2S_MODE, 10, 1, 0), |
1161 | FM801_SINGLE("IEC958 Playback Switch", FM801_GEN_CTRL, 2, 1, 0), | 1161 | FM801_SINGLE(SNDRV_CTL_NAME_IEC958("",PLAYBACK,SWITCH), FM801_GEN_CTRL, 2, 1, 0), |
1162 | }; | 1162 | }; |
1163 | 1163 | ||
1164 | static void snd_fm801_mixer_free_ac97_bus(ac97_bus_t *bus) | 1164 | static void snd_fm801_mixer_free_ac97_bus(ac97_bus_t *bus) |
@@ -1263,7 +1263,7 @@ static int __devinit snd_fm801_create(snd_card_t * card, | |||
1263 | *rchip = NULL; | 1263 | *rchip = NULL; |
1264 | if ((err = pci_enable_device(pci)) < 0) | 1264 | if ((err = pci_enable_device(pci)) < 0) |
1265 | return err; | 1265 | return err; |
1266 | chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); | 1266 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); |
1267 | if (chip == NULL) { | 1267 | if (chip == NULL) { |
1268 | pci_disable_device(pci); | 1268 | pci_disable_device(pci); |
1269 | return -ENOMEM; | 1269 | return -ENOMEM; |
@@ -1462,6 +1462,7 @@ static void __devexit snd_card_fm801_remove(struct pci_dev *pci) | |||
1462 | 1462 | ||
1463 | static struct pci_driver driver = { | 1463 | static struct pci_driver driver = { |
1464 | .name = "FM801", | 1464 | .name = "FM801", |
1465 | .owner = THIS_MODULE, | ||
1465 | .id_table = snd_fm801_ids, | 1466 | .id_table = snd_fm801_ids, |
1466 | .probe = snd_card_fm801_probe, | 1467 | .probe = snd_card_fm801_probe, |
1467 | .remove = __devexit_p(snd_card_fm801_remove), | 1468 | .remove = __devexit_p(snd_card_fm801_remove), |
diff --git a/sound/pci/hda/Makefile b/sound/pci/hda/Makefile index bd8cb33c4fb4..ddfb5ff7fb8f 100644 --- a/sound/pci/hda/Makefile +++ b/sound/pci/hda/Makefile | |||
@@ -1,5 +1,5 @@ | |||
1 | snd-hda-intel-objs := hda_intel.o | 1 | snd-hda-intel-objs := hda_intel.o |
2 | snd-hda-codec-objs := hda_codec.o hda_generic.o patch_realtek.o patch_cmedia.o patch_analog.o patch_sigmatel.o | 2 | snd-hda-codec-objs := hda_codec.o hda_generic.o patch_realtek.o patch_cmedia.o patch_analog.o patch_sigmatel.o patch_si3054.o |
3 | ifdef CONFIG_PROC_FS | 3 | ifdef CONFIG_PROC_FS |
4 | snd-hda-codec-objs += hda_proc.o | 4 | snd-hda-codec-objs += hda_proc.o |
5 | endif | 5 | endif |
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index e2cf02387289..3815403ed095 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
@@ -288,7 +288,7 @@ static int init_unsol_queue(struct hda_bus *bus) | |||
288 | { | 288 | { |
289 | struct hda_bus_unsolicited *unsol; | 289 | struct hda_bus_unsolicited *unsol; |
290 | 290 | ||
291 | unsol = kcalloc(1, sizeof(*unsol), GFP_KERNEL); | 291 | unsol = kzalloc(sizeof(*unsol), GFP_KERNEL); |
292 | if (! unsol) { | 292 | if (! unsol) { |
293 | snd_printk(KERN_ERR "hda_codec: can't allocate unsolicited queue\n"); | 293 | snd_printk(KERN_ERR "hda_codec: can't allocate unsolicited queue\n"); |
294 | return -ENOMEM; | 294 | return -ENOMEM; |
@@ -358,7 +358,7 @@ int snd_hda_bus_new(snd_card_t *card, const struct hda_bus_template *temp, | |||
358 | if (busp) | 358 | if (busp) |
359 | *busp = NULL; | 359 | *busp = NULL; |
360 | 360 | ||
361 | bus = kcalloc(1, sizeof(*bus), GFP_KERNEL); | 361 | bus = kzalloc(sizeof(*bus), GFP_KERNEL); |
362 | if (bus == NULL) { | 362 | if (bus == NULL) { |
363 | snd_printk(KERN_ERR "can't allocate struct hda_bus\n"); | 363 | snd_printk(KERN_ERR "can't allocate struct hda_bus\n"); |
364 | return -ENOMEM; | 364 | return -ENOMEM; |
@@ -432,22 +432,26 @@ void snd_hda_get_codec_name(struct hda_codec *codec, | |||
432 | } | 432 | } |
433 | 433 | ||
434 | /* | 434 | /* |
435 | * look for an AFG node | 435 | * look for an AFG and MFG nodes |
436 | * | ||
437 | * return 0 if not found | ||
438 | */ | 436 | */ |
439 | static int look_for_afg_node(struct hda_codec *codec) | 437 | static void setup_fg_nodes(struct hda_codec *codec) |
440 | { | 438 | { |
441 | int i, total_nodes; | 439 | int i, total_nodes; |
442 | hda_nid_t nid; | 440 | hda_nid_t nid; |
443 | 441 | ||
444 | total_nodes = snd_hda_get_sub_nodes(codec, AC_NODE_ROOT, &nid); | 442 | total_nodes = snd_hda_get_sub_nodes(codec, AC_NODE_ROOT, &nid); |
445 | for (i = 0; i < total_nodes; i++, nid++) { | 443 | for (i = 0; i < total_nodes; i++, nid++) { |
446 | if ((snd_hda_param_read(codec, nid, AC_PAR_FUNCTION_TYPE) & 0xff) == | 444 | switch((snd_hda_param_read(codec, nid, AC_PAR_FUNCTION_TYPE) & 0xff)) { |
447 | AC_GRP_AUDIO_FUNCTION) | 445 | case AC_GRP_AUDIO_FUNCTION: |
448 | return nid; | 446 | codec->afg = nid; |
447 | break; | ||
448 | case AC_GRP_MODEM_FUNCTION: | ||
449 | codec->mfg = nid; | ||
450 | break; | ||
451 | default: | ||
452 | break; | ||
453 | } | ||
449 | } | 454 | } |
450 | return 0; | ||
451 | } | 455 | } |
452 | 456 | ||
453 | /* | 457 | /* |
@@ -489,7 +493,7 @@ int snd_hda_codec_new(struct hda_bus *bus, unsigned int codec_addr, | |||
489 | return -EBUSY; | 493 | return -EBUSY; |
490 | } | 494 | } |
491 | 495 | ||
492 | codec = kcalloc(1, sizeof(*codec), GFP_KERNEL); | 496 | codec = kzalloc(sizeof(*codec), GFP_KERNEL); |
493 | if (codec == NULL) { | 497 | if (codec == NULL) { |
494 | snd_printk(KERN_ERR "can't allocate struct hda_codec\n"); | 498 | snd_printk(KERN_ERR "can't allocate struct hda_codec\n"); |
495 | return -ENOMEM; | 499 | return -ENOMEM; |
@@ -507,10 +511,9 @@ int snd_hda_codec_new(struct hda_bus *bus, unsigned int codec_addr, | |||
507 | codec->subsystem_id = snd_hda_param_read(codec, AC_NODE_ROOT, AC_PAR_SUBSYSTEM_ID); | 511 | codec->subsystem_id = snd_hda_param_read(codec, AC_NODE_ROOT, AC_PAR_SUBSYSTEM_ID); |
508 | codec->revision_id = snd_hda_param_read(codec, AC_NODE_ROOT, AC_PAR_REV_ID); | 512 | codec->revision_id = snd_hda_param_read(codec, AC_NODE_ROOT, AC_PAR_REV_ID); |
509 | 513 | ||
510 | /* FIXME: support for multiple AFGs? */ | 514 | setup_fg_nodes(codec); |
511 | codec->afg = look_for_afg_node(codec); | 515 | if (! codec->afg && ! codec->mfg) { |
512 | if (! codec->afg) { | 516 | snd_printdd("hda_codec: no AFG or MFG node found\n"); |
513 | snd_printdd("hda_codec: no AFG node found\n"); | ||
514 | snd_hda_codec_free(codec); | 517 | snd_hda_codec_free(codec); |
515 | return -ENODEV; | 518 | return -ENODEV; |
516 | } | 519 | } |
@@ -749,12 +752,14 @@ int snd_hda_mixer_amp_volume_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t | |||
749 | long *valp = ucontrol->value.integer.value; | 752 | long *valp = ucontrol->value.integer.value; |
750 | int change = 0; | 753 | int change = 0; |
751 | 754 | ||
752 | if (chs & 1) | 755 | if (chs & 1) { |
753 | change = snd_hda_codec_amp_update(codec, nid, 0, dir, idx, | 756 | change = snd_hda_codec_amp_update(codec, nid, 0, dir, idx, |
754 | 0x7f, *valp); | 757 | 0x7f, *valp); |
758 | valp++; | ||
759 | } | ||
755 | if (chs & 2) | 760 | if (chs & 2) |
756 | change |= snd_hda_codec_amp_update(codec, nid, 1, dir, idx, | 761 | change |= snd_hda_codec_amp_update(codec, nid, 1, dir, idx, |
757 | 0x7f, valp[1]); | 762 | 0x7f, *valp); |
758 | return change; | 763 | return change; |
759 | } | 764 | } |
760 | 765 | ||
@@ -796,12 +801,15 @@ int snd_hda_mixer_amp_switch_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t | |||
796 | long *valp = ucontrol->value.integer.value; | 801 | long *valp = ucontrol->value.integer.value; |
797 | int change = 0; | 802 | int change = 0; |
798 | 803 | ||
799 | if (chs & 1) | 804 | if (chs & 1) { |
800 | change = snd_hda_codec_amp_update(codec, nid, 0, dir, idx, | 805 | change = snd_hda_codec_amp_update(codec, nid, 0, dir, idx, |
801 | 0x80, *valp ? 0 : 0x80); | 806 | 0x80, *valp ? 0 : 0x80); |
807 | valp++; | ||
808 | } | ||
802 | if (chs & 2) | 809 | if (chs & 2) |
803 | change |= snd_hda_codec_amp_update(codec, nid, 1, dir, idx, | 810 | change |= snd_hda_codec_amp_update(codec, nid, 1, dir, idx, |
804 | 0x80, valp[1] ? 0 : 0x80); | 811 | 0x80, *valp ? 0 : 0x80); |
812 | |||
805 | return change; | 813 | return change; |
806 | } | 814 | } |
807 | 815 | ||
@@ -1155,8 +1163,16 @@ int snd_hda_build_controls(struct hda_bus *bus) | |||
1155 | /* | 1163 | /* |
1156 | * stream formats | 1164 | * stream formats |
1157 | */ | 1165 | */ |
1158 | static unsigned int rate_bits[][3] = { | 1166 | struct hda_rate_tbl { |
1167 | unsigned int hz; | ||
1168 | unsigned int alsa_bits; | ||
1169 | unsigned int hda_fmt; | ||
1170 | }; | ||
1171 | |||
1172 | static struct hda_rate_tbl rate_bits[] = { | ||
1159 | /* rate in Hz, ALSA rate bitmask, HDA format value */ | 1173 | /* rate in Hz, ALSA rate bitmask, HDA format value */ |
1174 | |||
1175 | /* autodetected value used in snd_hda_query_supported_pcm */ | ||
1160 | { 8000, SNDRV_PCM_RATE_8000, 0x0500 }, /* 1/6 x 48 */ | 1176 | { 8000, SNDRV_PCM_RATE_8000, 0x0500 }, /* 1/6 x 48 */ |
1161 | { 11025, SNDRV_PCM_RATE_11025, 0x4300 }, /* 1/4 x 44 */ | 1177 | { 11025, SNDRV_PCM_RATE_11025, 0x4300 }, /* 1/4 x 44 */ |
1162 | { 16000, SNDRV_PCM_RATE_16000, 0x0200 }, /* 1/3 x 48 */ | 1178 | { 16000, SNDRV_PCM_RATE_16000, 0x0200 }, /* 1/3 x 48 */ |
@@ -1168,7 +1184,11 @@ static unsigned int rate_bits[][3] = { | |||
1168 | { 96000, SNDRV_PCM_RATE_96000, 0x0800 }, /* 2 x 48 */ | 1184 | { 96000, SNDRV_PCM_RATE_96000, 0x0800 }, /* 2 x 48 */ |
1169 | { 176400, SNDRV_PCM_RATE_176400, 0x5800 },/* 4 x 44 */ | 1185 | { 176400, SNDRV_PCM_RATE_176400, 0x5800 },/* 4 x 44 */ |
1170 | { 192000, SNDRV_PCM_RATE_192000, 0x1800 }, /* 4 x 48 */ | 1186 | { 192000, SNDRV_PCM_RATE_192000, 0x1800 }, /* 4 x 48 */ |
1171 | { 0 } | 1187 | |
1188 | /* not autodetected value */ | ||
1189 | { 9600, SNDRV_PCM_RATE_KNOT, 0x0400 }, /* 1/5 x 48 */ | ||
1190 | |||
1191 | { 0 } /* terminator */ | ||
1172 | }; | 1192 | }; |
1173 | 1193 | ||
1174 | /** | 1194 | /** |
@@ -1190,12 +1210,12 @@ unsigned int snd_hda_calc_stream_format(unsigned int rate, | |||
1190 | int i; | 1210 | int i; |
1191 | unsigned int val = 0; | 1211 | unsigned int val = 0; |
1192 | 1212 | ||
1193 | for (i = 0; rate_bits[i][0]; i++) | 1213 | for (i = 0; rate_bits[i].hz; i++) |
1194 | if (rate_bits[i][0] == rate) { | 1214 | if (rate_bits[i].hz == rate) { |
1195 | val = rate_bits[i][2]; | 1215 | val = rate_bits[i].hda_fmt; |
1196 | break; | 1216 | break; |
1197 | } | 1217 | } |
1198 | if (! rate_bits[i][0]) { | 1218 | if (! rate_bits[i].hz) { |
1199 | snd_printdd("invalid rate %d\n", rate); | 1219 | snd_printdd("invalid rate %d\n", rate); |
1200 | return 0; | 1220 | return 0; |
1201 | } | 1221 | } |
@@ -1258,9 +1278,9 @@ int snd_hda_query_supported_pcm(struct hda_codec *codec, hda_nid_t nid, | |||
1258 | 1278 | ||
1259 | if (ratesp) { | 1279 | if (ratesp) { |
1260 | u32 rates = 0; | 1280 | u32 rates = 0; |
1261 | for (i = 0; rate_bits[i][0]; i++) { | 1281 | for (i = 0; rate_bits[i].hz; i++) { |
1262 | if (val & (1 << i)) | 1282 | if (val & (1 << i)) |
1263 | rates |= rate_bits[i][1]; | 1283 | rates |= rate_bits[i].alsa_bits; |
1264 | } | 1284 | } |
1265 | *ratesp = rates; | 1285 | *ratesp = rates; |
1266 | } | 1286 | } |
@@ -1352,13 +1372,13 @@ int snd_hda_is_supported_format(struct hda_codec *codec, hda_nid_t nid, | |||
1352 | } | 1372 | } |
1353 | 1373 | ||
1354 | rate = format & 0xff00; | 1374 | rate = format & 0xff00; |
1355 | for (i = 0; rate_bits[i][0]; i++) | 1375 | for (i = 0; rate_bits[i].hz; i++) |
1356 | if (rate_bits[i][2] == rate) { | 1376 | if (rate_bits[i].hda_fmt == rate) { |
1357 | if (val & (1 << i)) | 1377 | if (val & (1 << i)) |
1358 | break; | 1378 | break; |
1359 | return 0; | 1379 | return 0; |
1360 | } | 1380 | } |
1361 | if (! rate_bits[i][0]) | 1381 | if (! rate_bits[i].hz) |
1362 | return 0; | 1382 | return 0; |
1363 | 1383 | ||
1364 | stream = snd_hda_param_read(codec, nid, AC_PAR_STREAM); | 1384 | stream = snd_hda_param_read(codec, nid, AC_PAR_STREAM); |
@@ -1541,8 +1561,11 @@ int snd_hda_check_board_config(struct hda_codec *codec, const struct hda_board_c | |||
1541 | for (c = tbl; c->modelname || c->pci_subvendor; c++) { | 1561 | for (c = tbl; c->modelname || c->pci_subvendor; c++) { |
1542 | if (c->pci_subvendor == subsystem_vendor && | 1562 | if (c->pci_subvendor == subsystem_vendor && |
1543 | (! c->pci_subdevice /* all match */|| | 1563 | (! c->pci_subdevice /* all match */|| |
1544 | (c->pci_subdevice == subsystem_device))) | 1564 | (c->pci_subdevice == subsystem_device))) { |
1565 | snd_printdd(KERN_INFO "hda_codec: PCI %x:%x, codec config %d is selected\n", | ||
1566 | subsystem_vendor, subsystem_device, c->config); | ||
1545 | return c->config; | 1567 | return c->config; |
1568 | } | ||
1546 | } | 1569 | } |
1547 | } | 1570 | } |
1548 | return -1; | 1571 | return -1; |
@@ -1803,11 +1826,25 @@ int snd_hda_parse_pin_def_config(struct hda_codec *codec, struct auto_pin_cfg *c | |||
1803 | cfg->line_out_pins[j] = nid; | 1826 | cfg->line_out_pins[j] = nid; |
1804 | } | 1827 | } |
1805 | 1828 | ||
1806 | /* Swap surround and CLFE: the association order is front/CLFE/surr/back */ | 1829 | /* Reorder the surround channels |
1807 | if (cfg->line_outs >= 3) { | 1830 | * ALSA sequence is front/surr/clfe/side |
1831 | * HDA sequence is: | ||
1832 | * 4-ch: front/surr => OK as it is | ||
1833 | * 6-ch: front/clfe/surr | ||
1834 | * 8-ch: front/clfe/side/surr | ||
1835 | */ | ||
1836 | switch (cfg->line_outs) { | ||
1837 | case 3: | ||
1808 | nid = cfg->line_out_pins[1]; | 1838 | nid = cfg->line_out_pins[1]; |
1809 | cfg->line_out_pins[1] = cfg->line_out_pins[2]; | 1839 | cfg->line_out_pins[1] = cfg->line_out_pins[2]; |
1810 | cfg->line_out_pins[2] = nid; | 1840 | cfg->line_out_pins[2] = nid; |
1841 | break; | ||
1842 | case 4: | ||
1843 | nid = cfg->line_out_pins[1]; | ||
1844 | cfg->line_out_pins[1] = cfg->line_out_pins[3]; | ||
1845 | cfg->line_out_pins[3] = cfg->line_out_pins[2]; | ||
1846 | cfg->line_out_pins[2] = nid; | ||
1847 | break; | ||
1811 | } | 1848 | } |
1812 | 1849 | ||
1813 | return 0; | 1850 | return 0; |
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h index dd0d99d2ad27..bb53bcf76742 100644 --- a/sound/pci/hda/hda_codec.h +++ b/sound/pci/hda/hda_codec.h | |||
@@ -505,6 +505,7 @@ struct hda_pcm_stream { | |||
505 | struct hda_pcm { | 505 | struct hda_pcm { |
506 | char *name; | 506 | char *name; |
507 | struct hda_pcm_stream stream[2]; | 507 | struct hda_pcm_stream stream[2]; |
508 | unsigned int is_modem; /* modem codec? */ | ||
508 | }; | 509 | }; |
509 | 510 | ||
510 | /* codec information */ | 511 | /* codec information */ |
@@ -514,6 +515,7 @@ struct hda_codec { | |||
514 | struct list_head list; /* list point */ | 515 | struct list_head list; /* list point */ |
515 | 516 | ||
516 | hda_nid_t afg; /* AFG node id */ | 517 | hda_nid_t afg; /* AFG node id */ |
518 | hda_nid_t mfg; /* MFG node id */ | ||
517 | 519 | ||
518 | /* ids */ | 520 | /* ids */ |
519 | u32 vendor_id; | 521 | u32 vendor_id; |
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c index 2d046abb5911..d0eb9f2250aa 100644 --- a/sound/pci/hda/hda_generic.c +++ b/sound/pci/hda/hda_generic.c | |||
@@ -98,7 +98,7 @@ static int add_new_node(struct hda_codec *codec, struct hda_gspec *spec, hda_nid | |||
98 | struct hda_gnode *node; | 98 | struct hda_gnode *node; |
99 | int nconns; | 99 | int nconns; |
100 | 100 | ||
101 | node = kcalloc(1, sizeof(*node), GFP_KERNEL); | 101 | node = kzalloc(sizeof(*node), GFP_KERNEL); |
102 | if (node == NULL) | 102 | if (node == NULL) |
103 | return -ENOMEM; | 103 | return -ENOMEM; |
104 | node->nid = nid; | 104 | node->nid = nid; |
@@ -881,7 +881,10 @@ int snd_hda_parse_generic_codec(struct hda_codec *codec) | |||
881 | struct hda_gspec *spec; | 881 | struct hda_gspec *spec; |
882 | int err; | 882 | int err; |
883 | 883 | ||
884 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); | 884 | if(!codec->afg) |
885 | return 0; | ||
886 | |||
887 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | ||
885 | if (spec == NULL) { | 888 | if (spec == NULL) { |
886 | printk(KERN_ERR "hda_generic: can't allocate spec\n"); | 889 | printk(KERN_ERR "hda_generic: can't allocate spec\n"); |
887 | return -ENOMEM; | 890 | return -ENOMEM; |
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 288ab0764830..6fe696e53ea6 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
@@ -62,7 +62,7 @@ MODULE_PARM_DESC(enable, "Enable Intel HD audio interface."); | |||
62 | module_param_array(model, charp, NULL, 0444); | 62 | module_param_array(model, charp, NULL, 0444); |
63 | MODULE_PARM_DESC(model, "Use the given board model."); | 63 | MODULE_PARM_DESC(model, "Use the given board model."); |
64 | module_param_array(position_fix, int, NULL, 0444); | 64 | module_param_array(position_fix, int, NULL, 0444); |
65 | MODULE_PARM_DESC(position_fix, "Fix DMA pointer (0 = FIFO size, 1 = none, 2 = POSBUF)."); | 65 | MODULE_PARM_DESC(position_fix, "Fix DMA pointer (0 = auto, 1 = none, 2 = POSBUF, 3 = FIFO size)."); |
66 | 66 | ||
67 | MODULE_LICENSE("GPL"); | 67 | MODULE_LICENSE("GPL"); |
68 | MODULE_SUPPORTED_DEVICE("{{Intel, ICH6}," | 68 | MODULE_SUPPORTED_DEVICE("{{Intel, ICH6}," |
@@ -71,7 +71,9 @@ MODULE_SUPPORTED_DEVICE("{{Intel, ICH6}," | |||
71 | "{Intel, ESB2}," | 71 | "{Intel, ESB2}," |
72 | "{ATI, SB450}," | 72 | "{ATI, SB450}," |
73 | "{VIA, VT8251}," | 73 | "{VIA, VT8251}," |
74 | "{VIA, VT8237A}}"); | 74 | "{VIA, VT8237A}," |
75 | "{SiS, SIS966}," | ||
76 | "{ULI, M5461}}"); | ||
75 | MODULE_DESCRIPTION("Intel HDA driver"); | 77 | MODULE_DESCRIPTION("Intel HDA driver"); |
76 | 78 | ||
77 | #define SFX "hda-intel: " | 79 | #define SFX "hda-intel: " |
@@ -141,13 +143,30 @@ enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO1, SDO2, SDO3 }; | |||
141 | */ | 143 | */ |
142 | 144 | ||
143 | /* max number of SDs */ | 145 | /* max number of SDs */ |
144 | #define MAX_ICH6_DEV 8 | 146 | /* ICH, ATI and VIA have 4 playback and 4 capture */ |
147 | #define ICH6_CAPTURE_INDEX 0 | ||
148 | #define ICH6_NUM_CAPTURE 4 | ||
149 | #define ICH6_PLAYBACK_INDEX 4 | ||
150 | #define ICH6_NUM_PLAYBACK 4 | ||
151 | |||
152 | /* ULI has 6 playback and 5 capture */ | ||
153 | #define ULI_CAPTURE_INDEX 0 | ||
154 | #define ULI_NUM_CAPTURE 5 | ||
155 | #define ULI_PLAYBACK_INDEX 5 | ||
156 | #define ULI_NUM_PLAYBACK 6 | ||
157 | |||
158 | /* this number is statically defined for simplicity */ | ||
159 | #define MAX_AZX_DEV 16 | ||
160 | |||
145 | /* max number of fragments - we may use more if allocating more pages for BDL */ | 161 | /* max number of fragments - we may use more if allocating more pages for BDL */ |
146 | #define AZX_MAX_FRAG (PAGE_SIZE / (MAX_ICH6_DEV * 16)) | 162 | #define BDL_SIZE PAGE_ALIGN(8192) |
163 | #define AZX_MAX_FRAG (BDL_SIZE / (MAX_AZX_DEV * 16)) | ||
147 | /* max buffer size - no h/w limit, you can increase as you like */ | 164 | /* max buffer size - no h/w limit, you can increase as you like */ |
148 | #define AZX_MAX_BUF_SIZE (1024*1024*1024) | 165 | #define AZX_MAX_BUF_SIZE (1024*1024*1024) |
149 | /* max number of PCM devics per card */ | 166 | /* max number of PCM devics per card */ |
150 | #define AZX_MAX_PCMS 8 | 167 | #define AZX_MAX_AUDIO_PCMS 6 |
168 | #define AZX_MAX_MODEM_PCMS 2 | ||
169 | #define AZX_MAX_PCMS (AZX_MAX_AUDIO_PCMS + AZX_MAX_MODEM_PCMS) | ||
151 | 170 | ||
152 | /* RIRB int mask: overrun[2], response[0] */ | 171 | /* RIRB int mask: overrun[2], response[0] */ |
153 | #define RIRB_INT_RESPONSE 0x01 | 172 | #define RIRB_INT_RESPONSE 0x01 |
@@ -194,13 +213,13 @@ enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO1, SDO2, SDO3 }; | |||
194 | 213 | ||
195 | /* position fix mode */ | 214 | /* position fix mode */ |
196 | enum { | 215 | enum { |
197 | POS_FIX_FIFO, | 216 | POS_FIX_AUTO, |
198 | POS_FIX_NONE, | 217 | POS_FIX_NONE, |
199 | POS_FIX_POSBUF | 218 | POS_FIX_POSBUF, |
219 | POS_FIX_FIFO, | ||
200 | }; | 220 | }; |
201 | 221 | ||
202 | /* Defines for ATI HD Audio support in SB450 south bridge */ | 222 | /* Defines for ATI HD Audio support in SB450 south bridge */ |
203 | #define ATI_SB450_HDAUDIO_PCI_DEVICE_ID 0x437b | ||
204 | #define ATI_SB450_HDAUDIO_MISC_CNTR2_ADDR 0x42 | 223 | #define ATI_SB450_HDAUDIO_MISC_CNTR2_ADDR 0x42 |
205 | #define ATI_SB450_HDAUDIO_ENABLE_SNOOP 0x02 | 224 | #define ATI_SB450_HDAUDIO_ENABLE_SNOOP 0x02 |
206 | 225 | ||
@@ -227,6 +246,7 @@ struct snd_azx_dev { | |||
227 | unsigned int fragsize; /* size of each period in bytes */ | 246 | unsigned int fragsize; /* size of each period in bytes */ |
228 | unsigned int frags; /* number for period in the play buffer */ | 247 | unsigned int frags; /* number for period in the play buffer */ |
229 | unsigned int fifo_size; /* FIFO size */ | 248 | unsigned int fifo_size; /* FIFO size */ |
249 | unsigned int last_pos; /* last updated period position */ | ||
230 | 250 | ||
231 | void __iomem *sd_addr; /* stream descriptor pointer */ | 251 | void __iomem *sd_addr; /* stream descriptor pointer */ |
232 | 252 | ||
@@ -240,6 +260,7 @@ struct snd_azx_dev { | |||
240 | 260 | ||
241 | unsigned int opened: 1; | 261 | unsigned int opened: 1; |
242 | unsigned int running: 1; | 262 | unsigned int running: 1; |
263 | unsigned int period_updating: 1; | ||
243 | }; | 264 | }; |
244 | 265 | ||
245 | /* CORB/RIRB */ | 266 | /* CORB/RIRB */ |
@@ -258,6 +279,14 @@ struct snd_azx { | |||
258 | snd_card_t *card; | 279 | snd_card_t *card; |
259 | struct pci_dev *pci; | 280 | struct pci_dev *pci; |
260 | 281 | ||
282 | /* chip type specific */ | ||
283 | int driver_type; | ||
284 | int playback_streams; | ||
285 | int playback_index_offset; | ||
286 | int capture_streams; | ||
287 | int capture_index_offset; | ||
288 | int num_streams; | ||
289 | |||
261 | /* pci resources */ | 290 | /* pci resources */ |
262 | unsigned long addr; | 291 | unsigned long addr; |
263 | void __iomem *remap_addr; | 292 | void __iomem *remap_addr; |
@@ -267,8 +296,8 @@ struct snd_azx { | |||
267 | spinlock_t reg_lock; | 296 | spinlock_t reg_lock; |
268 | struct semaphore open_mutex; | 297 | struct semaphore open_mutex; |
269 | 298 | ||
270 | /* streams */ | 299 | /* streams (x num_streams) */ |
271 | azx_dev_t azx_dev[MAX_ICH6_DEV]; | 300 | azx_dev_t *azx_dev; |
272 | 301 | ||
273 | /* PCM */ | 302 | /* PCM */ |
274 | unsigned int pcm_devs; | 303 | unsigned int pcm_devs; |
@@ -292,6 +321,23 @@ struct snd_azx { | |||
292 | unsigned int initialized: 1; | 321 | unsigned int initialized: 1; |
293 | }; | 322 | }; |
294 | 323 | ||
324 | /* driver types */ | ||
325 | enum { | ||
326 | AZX_DRIVER_ICH, | ||
327 | AZX_DRIVER_ATI, | ||
328 | AZX_DRIVER_VIA, | ||
329 | AZX_DRIVER_SIS, | ||
330 | AZX_DRIVER_ULI, | ||
331 | }; | ||
332 | |||
333 | static char *driver_short_names[] __devinitdata = { | ||
334 | [AZX_DRIVER_ICH] = "HDA Intel", | ||
335 | [AZX_DRIVER_ATI] = "HDA ATI SB", | ||
336 | [AZX_DRIVER_VIA] = "HDA VIA VT82xx", | ||
337 | [AZX_DRIVER_SIS] = "HDA SIS966", | ||
338 | [AZX_DRIVER_ULI] = "HDA ULI M5461" | ||
339 | }; | ||
340 | |||
295 | /* | 341 | /* |
296 | * macros for easy use | 342 | * macros for easy use |
297 | */ | 343 | */ |
@@ -360,6 +406,8 @@ static void azx_init_cmd_io(azx_t *chip) | |||
360 | azx_writel(chip, CORBLBASE, (u32)chip->corb.addr); | 406 | azx_writel(chip, CORBLBASE, (u32)chip->corb.addr); |
361 | azx_writel(chip, CORBUBASE, upper_32bit(chip->corb.addr)); | 407 | azx_writel(chip, CORBUBASE, upper_32bit(chip->corb.addr)); |
362 | 408 | ||
409 | /* set the corb size to 256 entries (ULI requires explicitly) */ | ||
410 | azx_writeb(chip, CORBSIZE, 0x02); | ||
363 | /* set the corb write pointer to 0 */ | 411 | /* set the corb write pointer to 0 */ |
364 | azx_writew(chip, CORBWP, 0); | 412 | azx_writew(chip, CORBWP, 0); |
365 | /* reset the corb hw read pointer */ | 413 | /* reset the corb hw read pointer */ |
@@ -373,6 +421,8 @@ static void azx_init_cmd_io(azx_t *chip) | |||
373 | azx_writel(chip, RIRBLBASE, (u32)chip->rirb.addr); | 421 | azx_writel(chip, RIRBLBASE, (u32)chip->rirb.addr); |
374 | azx_writel(chip, RIRBUBASE, upper_32bit(chip->rirb.addr)); | 422 | azx_writel(chip, RIRBUBASE, upper_32bit(chip->rirb.addr)); |
375 | 423 | ||
424 | /* set the rirb size to 256 entries (ULI requires explicitly) */ | ||
425 | azx_writeb(chip, RIRBSIZE, 0x02); | ||
376 | /* reset the rirb hw write pointer */ | 426 | /* reset the rirb hw write pointer */ |
377 | azx_writew(chip, RIRBWP, ICH6_RBRWP_CLR); | 427 | azx_writew(chip, RIRBWP, ICH6_RBRWP_CLR); |
378 | /* set N=1, get RIRB response interrupt for new entry */ | 428 | /* set N=1, get RIRB response interrupt for new entry */ |
@@ -596,7 +646,7 @@ static void azx_int_disable(azx_t *chip) | |||
596 | int i; | 646 | int i; |
597 | 647 | ||
598 | /* disable interrupts in stream descriptor */ | 648 | /* disable interrupts in stream descriptor */ |
599 | for (i = 0; i < MAX_ICH6_DEV; i++) { | 649 | for (i = 0; i < chip->num_streams; i++) { |
600 | azx_dev_t *azx_dev = &chip->azx_dev[i]; | 650 | azx_dev_t *azx_dev = &chip->azx_dev[i]; |
601 | azx_sd_writeb(azx_dev, SD_CTL, | 651 | azx_sd_writeb(azx_dev, SD_CTL, |
602 | azx_sd_readb(azx_dev, SD_CTL) & ~SD_INT_MASK); | 652 | azx_sd_readb(azx_dev, SD_CTL) & ~SD_INT_MASK); |
@@ -616,7 +666,7 @@ static void azx_int_clear(azx_t *chip) | |||
616 | int i; | 666 | int i; |
617 | 667 | ||
618 | /* clear stream status */ | 668 | /* clear stream status */ |
619 | for (i = 0; i < MAX_ICH6_DEV; i++) { | 669 | for (i = 0; i < chip->num_streams; i++) { |
620 | azx_dev_t *azx_dev = &chip->azx_dev[i]; | 670 | azx_dev_t *azx_dev = &chip->azx_dev[i]; |
621 | azx_sd_writeb(azx_dev, SD_STS, SD_INT_MASK); | 671 | azx_sd_writeb(azx_dev, SD_STS, SD_INT_MASK); |
622 | } | 672 | } |
@@ -679,15 +729,12 @@ static void azx_init_chip(azx_t *chip) | |||
679 | /* initialize the codec command I/O */ | 729 | /* initialize the codec command I/O */ |
680 | azx_init_cmd_io(chip); | 730 | azx_init_cmd_io(chip); |
681 | 731 | ||
682 | if (chip->position_fix == POS_FIX_POSBUF) { | 732 | /* program the position buffer */ |
683 | /* program the position buffer */ | 733 | azx_writel(chip, DPLBASE, (u32)chip->posbuf.addr); |
684 | azx_writel(chip, DPLBASE, (u32)chip->posbuf.addr); | 734 | azx_writel(chip, DPUBASE, upper_32bit(chip->posbuf.addr)); |
685 | azx_writel(chip, DPUBASE, upper_32bit(chip->posbuf.addr)); | ||
686 | } | ||
687 | 735 | ||
688 | /* For ATI SB450 azalia HD audio, we need to enable snoop */ | 736 | /* For ATI SB450 azalia HD audio, we need to enable snoop */ |
689 | if (chip->pci->vendor == PCI_VENDOR_ID_ATI && | 737 | if (chip->driver_type == AZX_DRIVER_ATI) { |
690 | chip->pci->device == ATI_SB450_HDAUDIO_PCI_DEVICE_ID) { | ||
691 | pci_read_config_byte(chip->pci, ATI_SB450_HDAUDIO_MISC_CNTR2_ADDR, | 738 | pci_read_config_byte(chip->pci, ATI_SB450_HDAUDIO_MISC_CNTR2_ADDR, |
692 | &ati_misc_cntl2); | 739 | &ati_misc_cntl2); |
693 | pci_write_config_byte(chip->pci, ATI_SB450_HDAUDIO_MISC_CNTR2_ADDR, | 740 | pci_write_config_byte(chip->pci, ATI_SB450_HDAUDIO_MISC_CNTR2_ADDR, |
@@ -714,14 +761,16 @@ static irqreturn_t azx_interrupt(int irq, void* dev_id, struct pt_regs *regs) | |||
714 | return IRQ_NONE; | 761 | return IRQ_NONE; |
715 | } | 762 | } |
716 | 763 | ||
717 | for (i = 0; i < MAX_ICH6_DEV; i++) { | 764 | for (i = 0; i < chip->num_streams; i++) { |
718 | azx_dev = &chip->azx_dev[i]; | 765 | azx_dev = &chip->azx_dev[i]; |
719 | if (status & azx_dev->sd_int_sta_mask) { | 766 | if (status & azx_dev->sd_int_sta_mask) { |
720 | azx_sd_writeb(azx_dev, SD_STS, SD_INT_MASK); | 767 | azx_sd_writeb(azx_dev, SD_STS, SD_INT_MASK); |
721 | if (azx_dev->substream && azx_dev->running) { | 768 | if (azx_dev->substream && azx_dev->running) { |
769 | azx_dev->period_updating = 1; | ||
722 | spin_unlock(&chip->reg_lock); | 770 | spin_unlock(&chip->reg_lock); |
723 | snd_pcm_period_elapsed(azx_dev->substream); | 771 | snd_pcm_period_elapsed(azx_dev->substream); |
724 | spin_lock(&chip->reg_lock); | 772 | spin_lock(&chip->reg_lock); |
773 | azx_dev->period_updating = 0; | ||
725 | } | 774 | } |
726 | } | 775 | } |
727 | } | 776 | } |
@@ -822,11 +871,9 @@ static int azx_setup_controller(azx_t *chip, azx_dev_t *azx_dev) | |||
822 | /* upper BDL address */ | 871 | /* upper BDL address */ |
823 | azx_sd_writel(azx_dev, SD_BDLPU, upper_32bit(azx_dev->bdl_addr)); | 872 | azx_sd_writel(azx_dev, SD_BDLPU, upper_32bit(azx_dev->bdl_addr)); |
824 | 873 | ||
825 | if (chip->position_fix == POS_FIX_POSBUF) { | 874 | /* enable the position buffer */ |
826 | /* enable the position buffer */ | 875 | if (! (azx_readl(chip, DPLBASE) & ICH6_DPLBASE_ENABLE)) |
827 | if (! (azx_readl(chip, DPLBASE) & ICH6_DPLBASE_ENABLE)) | 876 | azx_writel(chip, DPLBASE, (u32)chip->posbuf.addr | ICH6_DPLBASE_ENABLE); |
828 | azx_writel(chip, DPLBASE, (u32)chip->posbuf.addr | ICH6_DPLBASE_ENABLE); | ||
829 | } | ||
830 | 877 | ||
831 | /* set the interrupt enable bits in the descriptor control register */ | 878 | /* set the interrupt enable bits in the descriptor control register */ |
832 | azx_sd_writel(azx_dev, SD_CTL, azx_sd_readl(azx_dev, SD_CTL) | SD_INT_MASK); | 879 | azx_sd_writel(azx_dev, SD_CTL, azx_sd_readl(azx_dev, SD_CTL) | SD_INT_MASK); |
@@ -879,9 +926,15 @@ static int __devinit azx_codec_create(azx_t *chip, const char *model) | |||
879 | /* assign a stream for the PCM */ | 926 | /* assign a stream for the PCM */ |
880 | static inline azx_dev_t *azx_assign_device(azx_t *chip, int stream) | 927 | static inline azx_dev_t *azx_assign_device(azx_t *chip, int stream) |
881 | { | 928 | { |
882 | int dev, i; | 929 | int dev, i, nums; |
883 | dev = stream == SNDRV_PCM_STREAM_PLAYBACK ? 4 : 0; | 930 | if (stream == SNDRV_PCM_STREAM_PLAYBACK) { |
884 | for (i = 0; i < 4; i++, dev++) | 931 | dev = chip->playback_index_offset; |
932 | nums = chip->playback_streams; | ||
933 | } else { | ||
934 | dev = chip->capture_index_offset; | ||
935 | nums = chip->capture_streams; | ||
936 | } | ||
937 | for (i = 0; i < nums; i++, dev++) | ||
885 | if (! chip->azx_dev[dev].opened) { | 938 | if (! chip->azx_dev[dev].opened) { |
886 | chip->azx_dev[dev].opened = 1; | 939 | chip->azx_dev[dev].opened = 1; |
887 | return &chip->azx_dev[dev]; | 940 | return &chip->azx_dev[dev]; |
@@ -899,8 +952,8 @@ static snd_pcm_hardware_t azx_pcm_hw = { | |||
899 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | | 952 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | |
900 | SNDRV_PCM_INFO_BLOCK_TRANSFER | | 953 | SNDRV_PCM_INFO_BLOCK_TRANSFER | |
901 | SNDRV_PCM_INFO_MMAP_VALID | | 954 | SNDRV_PCM_INFO_MMAP_VALID | |
902 | SNDRV_PCM_INFO_PAUSE | | 955 | SNDRV_PCM_INFO_PAUSE /*|*/ |
903 | SNDRV_PCM_INFO_RESUME), | 956 | /*SNDRV_PCM_INFO_RESUME*/), |
904 | .formats = SNDRV_PCM_FMTBIT_S16_LE, | 957 | .formats = SNDRV_PCM_FMTBIT_S16_LE, |
905 | .rates = SNDRV_PCM_RATE_48000, | 958 | .rates = SNDRV_PCM_RATE_48000, |
906 | .rate_min = 48000, | 959 | .rate_min = 48000, |
@@ -1028,6 +1081,7 @@ static int azx_pcm_prepare(snd_pcm_substream_t *substream) | |||
1028 | azx_dev->fifo_size = azx_sd_readw(azx_dev, SD_FIFOSIZE) + 1; | 1081 | azx_dev->fifo_size = azx_sd_readw(azx_dev, SD_FIFOSIZE) + 1; |
1029 | else | 1082 | else |
1030 | azx_dev->fifo_size = 0; | 1083 | azx_dev->fifo_size = 0; |
1084 | azx_dev->last_pos = 0; | ||
1031 | 1085 | ||
1032 | return hinfo->ops.prepare(hinfo, apcm->codec, azx_dev->stream_tag, | 1086 | return hinfo->ops.prepare(hinfo, apcm->codec, azx_dev->stream_tag, |
1033 | azx_dev->format_val, substream); | 1087 | azx_dev->format_val, substream); |
@@ -1049,6 +1103,7 @@ static int azx_pcm_trigger(snd_pcm_substream_t *substream, int cmd) | |||
1049 | azx_dev->running = 1; | 1103 | azx_dev->running = 1; |
1050 | break; | 1104 | break; |
1051 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: | 1105 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: |
1106 | case SNDRV_PCM_TRIGGER_SUSPEND: | ||
1052 | case SNDRV_PCM_TRIGGER_STOP: | 1107 | case SNDRV_PCM_TRIGGER_STOP: |
1053 | azx_stream_stop(chip, azx_dev); | 1108 | azx_stream_stop(chip, azx_dev); |
1054 | azx_dev->running = 0; | 1109 | azx_dev->running = 0; |
@@ -1058,6 +1113,7 @@ static int azx_pcm_trigger(snd_pcm_substream_t *substream, int cmd) | |||
1058 | } | 1113 | } |
1059 | spin_unlock(&chip->reg_lock); | 1114 | spin_unlock(&chip->reg_lock); |
1060 | if (cmd == SNDRV_PCM_TRIGGER_PAUSE_PUSH || | 1115 | if (cmd == SNDRV_PCM_TRIGGER_PAUSE_PUSH || |
1116 | cmd == SNDRV_PCM_TRIGGER_SUSPEND || | ||
1061 | cmd == SNDRV_PCM_TRIGGER_STOP) { | 1117 | cmd == SNDRV_PCM_TRIGGER_STOP) { |
1062 | int timeout = 5000; | 1118 | int timeout = 5000; |
1063 | while (azx_sd_readb(azx_dev, SD_CTL) & SD_CTL_DMA_START && --timeout) | 1119 | while (azx_sd_readb(azx_dev, SD_CTL) & SD_CTL_DMA_START && --timeout) |
@@ -1081,6 +1137,31 @@ static snd_pcm_uframes_t azx_pcm_pointer(snd_pcm_substream_t *substream) | |||
1081 | pos = azx_sd_readl(azx_dev, SD_LPIB); | 1137 | pos = azx_sd_readl(azx_dev, SD_LPIB); |
1082 | if (chip->position_fix == POS_FIX_FIFO) | 1138 | if (chip->position_fix == POS_FIX_FIFO) |
1083 | pos += azx_dev->fifo_size; | 1139 | pos += azx_dev->fifo_size; |
1140 | #if 0 /* disabled temprarily, auto-correction doesn't work well... */ | ||
1141 | else if (chip->position_fix == POS_FIX_AUTO && azx_dev->period_updating) { | ||
1142 | /* check the validity of DMA position */ | ||
1143 | unsigned int diff = 0; | ||
1144 | azx_dev->last_pos += azx_dev->fragsize; | ||
1145 | if (azx_dev->last_pos > pos) | ||
1146 | diff = azx_dev->last_pos - pos; | ||
1147 | if (azx_dev->last_pos >= azx_dev->bufsize) { | ||
1148 | if (pos < azx_dev->fragsize) | ||
1149 | diff = 0; | ||
1150 | azx_dev->last_pos = 0; | ||
1151 | } | ||
1152 | if (diff > 0 && diff <= azx_dev->fifo_size) | ||
1153 | pos += azx_dev->fifo_size; | ||
1154 | else { | ||
1155 | snd_printdd(KERN_INFO "hda_intel: DMA position fix %d, switching to posbuf\n", diff); | ||
1156 | chip->position_fix = POS_FIX_POSBUF; | ||
1157 | pos = *azx_dev->posbuf; | ||
1158 | } | ||
1159 | azx_dev->period_updating = 0; | ||
1160 | } | ||
1161 | #else | ||
1162 | else if (chip->position_fix == POS_FIX_AUTO) | ||
1163 | pos += azx_dev->fifo_size; | ||
1164 | #endif | ||
1084 | } | 1165 | } |
1085 | if (pos >= azx_dev->bufsize) | 1166 | if (pos >= azx_dev->bufsize) |
1086 | pos = 0; | 1167 | pos = 0; |
@@ -1136,6 +1217,7 @@ static int __devinit create_codec_pcm(azx_t *chip, struct hda_codec *codec, | |||
1136 | snd_dma_pci_data(chip->pci), | 1217 | snd_dma_pci_data(chip->pci), |
1137 | 1024 * 64, 1024 * 128); | 1218 | 1024 * 64, 1024 * 128); |
1138 | chip->pcm[pcm_dev] = pcm; | 1219 | chip->pcm[pcm_dev] = pcm; |
1220 | chip->pcm_devs = pcm_dev + 1; | ||
1139 | 1221 | ||
1140 | return 0; | 1222 | return 0; |
1141 | } | 1223 | } |
@@ -1150,12 +1232,33 @@ static int __devinit azx_pcm_create(azx_t *chip) | |||
1150 | if ((err = snd_hda_build_pcms(chip->bus)) < 0) | 1232 | if ((err = snd_hda_build_pcms(chip->bus)) < 0) |
1151 | return err; | 1233 | return err; |
1152 | 1234 | ||
1235 | /* create audio PCMs */ | ||
1153 | pcm_dev = 0; | 1236 | pcm_dev = 0; |
1154 | list_for_each(p, &chip->bus->codec_list) { | 1237 | list_for_each(p, &chip->bus->codec_list) { |
1155 | codec = list_entry(p, struct hda_codec, list); | 1238 | codec = list_entry(p, struct hda_codec, list); |
1156 | for (c = 0; c < codec->num_pcms; c++) { | 1239 | for (c = 0; c < codec->num_pcms; c++) { |
1240 | if (codec->pcm_info[c].is_modem) | ||
1241 | continue; /* create later */ | ||
1242 | if (pcm_dev >= AZX_MAX_AUDIO_PCMS) { | ||
1243 | snd_printk(KERN_ERR SFX "Too many audio PCMs\n"); | ||
1244 | return -EINVAL; | ||
1245 | } | ||
1246 | err = create_codec_pcm(chip, codec, &codec->pcm_info[c], pcm_dev); | ||
1247 | if (err < 0) | ||
1248 | return err; | ||
1249 | pcm_dev++; | ||
1250 | } | ||
1251 | } | ||
1252 | |||
1253 | /* create modem PCMs */ | ||
1254 | pcm_dev = AZX_MAX_AUDIO_PCMS; | ||
1255 | list_for_each(p, &chip->bus->codec_list) { | ||
1256 | codec = list_entry(p, struct hda_codec, list); | ||
1257 | for (c = 0; c < codec->num_pcms; c++) { | ||
1258 | if (! codec->pcm_info[c].is_modem) | ||
1259 | continue; /* already created */ | ||
1157 | if (pcm_dev >= AZX_MAX_PCMS) { | 1260 | if (pcm_dev >= AZX_MAX_PCMS) { |
1158 | snd_printk(KERN_ERR SFX "Too many PCMs\n"); | 1261 | snd_printk(KERN_ERR SFX "Too many modem PCMs\n"); |
1159 | return -EINVAL; | 1262 | return -EINVAL; |
1160 | } | 1263 | } |
1161 | err = create_codec_pcm(chip, codec, &codec->pcm_info[c], pcm_dev); | 1264 | err = create_codec_pcm(chip, codec, &codec->pcm_info[c], pcm_dev); |
@@ -1186,13 +1289,12 @@ static int __devinit azx_init_stream(azx_t *chip) | |||
1186 | /* initialize each stream (aka device) | 1289 | /* initialize each stream (aka device) |
1187 | * assign the starting bdl address to each stream (device) and initialize | 1290 | * assign the starting bdl address to each stream (device) and initialize |
1188 | */ | 1291 | */ |
1189 | for (i = 0; i < MAX_ICH6_DEV; i++) { | 1292 | for (i = 0; i < chip->num_streams; i++) { |
1190 | unsigned int off = sizeof(u32) * (i * AZX_MAX_FRAG * 4); | 1293 | unsigned int off = sizeof(u32) * (i * AZX_MAX_FRAG * 4); |
1191 | azx_dev_t *azx_dev = &chip->azx_dev[i]; | 1294 | azx_dev_t *azx_dev = &chip->azx_dev[i]; |
1192 | azx_dev->bdl = (u32 *)(chip->bdl.area + off); | 1295 | azx_dev->bdl = (u32 *)(chip->bdl.area + off); |
1193 | azx_dev->bdl_addr = chip->bdl.addr + off; | 1296 | azx_dev->bdl_addr = chip->bdl.addr + off; |
1194 | if (chip->position_fix == POS_FIX_POSBUF) | 1297 | azx_dev->posbuf = (volatile u32 *)(chip->posbuf.area + i * 8); |
1195 | azx_dev->posbuf = (volatile u32 *)(chip->posbuf.area + i * 8); | ||
1196 | /* offset: SDI0=0x80, SDI1=0xa0, ... SDO3=0x160 */ | 1298 | /* offset: SDI0=0x80, SDI1=0xa0, ... SDO3=0x160 */ |
1197 | azx_dev->sd_addr = chip->remap_addr + (0x20 * i + 0x80); | 1299 | azx_dev->sd_addr = chip->remap_addr + (0x20 * i + 0x80); |
1198 | /* int mask: SDI0=0x01, SDI1=0x02, ... SDO3=0x80 */ | 1300 | /* int mask: SDI0=0x01, SDI1=0x02, ... SDO3=0x80 */ |
@@ -1245,7 +1347,7 @@ static int azx_free(azx_t *chip) | |||
1245 | if (chip->initialized) { | 1347 | if (chip->initialized) { |
1246 | int i; | 1348 | int i; |
1247 | 1349 | ||
1248 | for (i = 0; i < MAX_ICH6_DEV; i++) | 1350 | for (i = 0; i < chip->num_streams; i++) |
1249 | azx_stream_stop(chip, &chip->azx_dev[i]); | 1351 | azx_stream_stop(chip, &chip->azx_dev[i]); |
1250 | 1352 | ||
1251 | /* disable interrupts */ | 1353 | /* disable interrupts */ |
@@ -1261,10 +1363,10 @@ static int azx_free(azx_t *chip) | |||
1261 | 1363 | ||
1262 | /* wait a little for interrupts to finish */ | 1364 | /* wait a little for interrupts to finish */ |
1263 | msleep(1); | 1365 | msleep(1); |
1264 | |||
1265 | iounmap(chip->remap_addr); | ||
1266 | } | 1366 | } |
1267 | 1367 | ||
1368 | if (chip->remap_addr) | ||
1369 | iounmap(chip->remap_addr); | ||
1268 | if (chip->irq >= 0) | 1370 | if (chip->irq >= 0) |
1269 | free_irq(chip->irq, (void*)chip); | 1371 | free_irq(chip->irq, (void*)chip); |
1270 | 1372 | ||
@@ -1276,6 +1378,7 @@ static int azx_free(azx_t *chip) | |||
1276 | snd_dma_free_pages(&chip->posbuf); | 1378 | snd_dma_free_pages(&chip->posbuf); |
1277 | pci_release_regions(chip->pci); | 1379 | pci_release_regions(chip->pci); |
1278 | pci_disable_device(chip->pci); | 1380 | pci_disable_device(chip->pci); |
1381 | kfree(chip->azx_dev); | ||
1279 | kfree(chip); | 1382 | kfree(chip); |
1280 | 1383 | ||
1281 | return 0; | 1384 | return 0; |
@@ -1290,7 +1393,8 @@ static int azx_dev_free(snd_device_t *device) | |||
1290 | * constructor | 1393 | * constructor |
1291 | */ | 1394 | */ |
1292 | static int __devinit azx_create(snd_card_t *card, struct pci_dev *pci, | 1395 | static int __devinit azx_create(snd_card_t *card, struct pci_dev *pci, |
1293 | int posfix, azx_t **rchip) | 1396 | int posfix, int driver_type, |
1397 | azx_t **rchip) | ||
1294 | { | 1398 | { |
1295 | azx_t *chip; | 1399 | azx_t *chip; |
1296 | int err = 0; | 1400 | int err = 0; |
@@ -1303,7 +1407,7 @@ static int __devinit azx_create(snd_card_t *card, struct pci_dev *pci, | |||
1303 | if ((err = pci_enable_device(pci)) < 0) | 1407 | if ((err = pci_enable_device(pci)) < 0) |
1304 | return err; | 1408 | return err; |
1305 | 1409 | ||
1306 | chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); | 1410 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); |
1307 | 1411 | ||
1308 | if (NULL == chip) { | 1412 | if (NULL == chip) { |
1309 | snd_printk(KERN_ERR SFX "cannot allocate chip\n"); | 1413 | snd_printk(KERN_ERR SFX "cannot allocate chip\n"); |
@@ -1316,9 +1420,20 @@ static int __devinit azx_create(snd_card_t *card, struct pci_dev *pci, | |||
1316 | chip->card = card; | 1420 | chip->card = card; |
1317 | chip->pci = pci; | 1421 | chip->pci = pci; |
1318 | chip->irq = -1; | 1422 | chip->irq = -1; |
1423 | chip->driver_type = driver_type; | ||
1319 | 1424 | ||
1320 | chip->position_fix = posfix; | 1425 | chip->position_fix = posfix; |
1321 | 1426 | ||
1427 | #if BITS_PER_LONG != 64 | ||
1428 | /* Fix up base address on ULI M5461 */ | ||
1429 | if (chip->driver_type == AZX_DRIVER_ULI) { | ||
1430 | u16 tmp3; | ||
1431 | pci_read_config_word(pci, 0x40, &tmp3); | ||
1432 | pci_write_config_word(pci, 0x40, tmp3 | 0x10); | ||
1433 | pci_write_config_dword(pci, PCI_BASE_ADDRESS_1, 0); | ||
1434 | } | ||
1435 | #endif | ||
1436 | |||
1322 | if ((err = pci_request_regions(pci, "ICH HD audio")) < 0) { | 1437 | if ((err = pci_request_regions(pci, "ICH HD audio")) < 0) { |
1323 | kfree(chip); | 1438 | kfree(chip); |
1324 | pci_disable_device(pci); | 1439 | pci_disable_device(pci); |
@@ -1344,19 +1459,38 @@ static int __devinit azx_create(snd_card_t *card, struct pci_dev *pci, | |||
1344 | pci_set_master(pci); | 1459 | pci_set_master(pci); |
1345 | synchronize_irq(chip->irq); | 1460 | synchronize_irq(chip->irq); |
1346 | 1461 | ||
1462 | switch (chip->driver_type) { | ||
1463 | case AZX_DRIVER_ULI: | ||
1464 | chip->playback_streams = ULI_NUM_PLAYBACK; | ||
1465 | chip->capture_streams = ULI_NUM_CAPTURE; | ||
1466 | chip->playback_index_offset = ULI_PLAYBACK_INDEX; | ||
1467 | chip->capture_index_offset = ULI_CAPTURE_INDEX; | ||
1468 | break; | ||
1469 | default: | ||
1470 | chip->playback_streams = ICH6_NUM_PLAYBACK; | ||
1471 | chip->capture_streams = ICH6_NUM_CAPTURE; | ||
1472 | chip->playback_index_offset = ICH6_PLAYBACK_INDEX; | ||
1473 | chip->capture_index_offset = ICH6_CAPTURE_INDEX; | ||
1474 | break; | ||
1475 | } | ||
1476 | chip->num_streams = chip->playback_streams + chip->capture_streams; | ||
1477 | chip->azx_dev = kcalloc(chip->num_streams, sizeof(*chip->azx_dev), GFP_KERNEL); | ||
1478 | if (! chip->azx_dev) { | ||
1479 | snd_printk(KERN_ERR "cannot malloc azx_dev\n"); | ||
1480 | goto errout; | ||
1481 | } | ||
1482 | |||
1347 | /* allocate memory for the BDL for each stream */ | 1483 | /* allocate memory for the BDL for each stream */ |
1348 | if ((err = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(chip->pci), | 1484 | if ((err = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(chip->pci), |
1349 | PAGE_SIZE, &chip->bdl)) < 0) { | 1485 | BDL_SIZE, &chip->bdl)) < 0) { |
1350 | snd_printk(KERN_ERR SFX "cannot allocate BDL\n"); | 1486 | snd_printk(KERN_ERR SFX "cannot allocate BDL\n"); |
1351 | goto errout; | 1487 | goto errout; |
1352 | } | 1488 | } |
1353 | if (chip->position_fix == POS_FIX_POSBUF) { | 1489 | /* allocate memory for the position buffer */ |
1354 | /* allocate memory for the position buffer */ | 1490 | if ((err = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(chip->pci), |
1355 | if ((err = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(chip->pci), | 1491 | chip->num_streams * 8, &chip->posbuf)) < 0) { |
1356 | MAX_ICH6_DEV * 8, &chip->posbuf)) < 0) { | 1492 | snd_printk(KERN_ERR SFX "cannot allocate posbuf\n"); |
1357 | snd_printk(KERN_ERR SFX "cannot allocate posbuf\n"); | 1493 | goto errout; |
1358 | goto errout; | ||
1359 | } | ||
1360 | } | 1494 | } |
1361 | /* allocate CORB/RIRB */ | 1495 | /* allocate CORB/RIRB */ |
1362 | if ((err = azx_alloc_cmd_io(chip)) < 0) | 1496 | if ((err = azx_alloc_cmd_io(chip)) < 0) |
@@ -1382,6 +1516,10 @@ static int __devinit azx_create(snd_card_t *card, struct pci_dev *pci, | |||
1382 | goto errout; | 1516 | goto errout; |
1383 | } | 1517 | } |
1384 | 1518 | ||
1519 | strcpy(card->driver, "HDA-Intel"); | ||
1520 | strcpy(card->shortname, driver_short_names[chip->driver_type]); | ||
1521 | sprintf(card->longname, "%s at 0x%lx irq %i", card->shortname, chip->addr, chip->irq); | ||
1522 | |||
1385 | *rchip = chip; | 1523 | *rchip = chip; |
1386 | return 0; | 1524 | return 0; |
1387 | 1525 | ||
@@ -1410,15 +1548,12 @@ static int __devinit azx_probe(struct pci_dev *pci, const struct pci_device_id * | |||
1410 | return -ENOMEM; | 1548 | return -ENOMEM; |
1411 | } | 1549 | } |
1412 | 1550 | ||
1413 | if ((err = azx_create(card, pci, position_fix[dev], &chip)) < 0) { | 1551 | if ((err = azx_create(card, pci, position_fix[dev], pci_id->driver_data, |
1552 | &chip)) < 0) { | ||
1414 | snd_card_free(card); | 1553 | snd_card_free(card); |
1415 | return err; | 1554 | return err; |
1416 | } | 1555 | } |
1417 | 1556 | ||
1418 | strcpy(card->driver, "HDA-Intel"); | ||
1419 | strcpy(card->shortname, "HDA Intel"); | ||
1420 | sprintf(card->longname, "%s at 0x%lx irq %i", card->shortname, chip->addr, chip->irq); | ||
1421 | |||
1422 | /* create codec instances */ | 1557 | /* create codec instances */ |
1423 | if ((err = azx_codec_create(chip, model[dev])) < 0) { | 1558 | if ((err = azx_codec_create(chip, model[dev])) < 0) { |
1424 | snd_card_free(card); | 1559 | snd_card_free(card); |
@@ -1459,12 +1594,13 @@ static void __devexit azx_remove(struct pci_dev *pci) | |||
1459 | 1594 | ||
1460 | /* PCI IDs */ | 1595 | /* PCI IDs */ |
1461 | static struct pci_device_id azx_ids[] = { | 1596 | static struct pci_device_id azx_ids[] = { |
1462 | { 0x8086, 0x2668, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* ICH6 */ | 1597 | { 0x8086, 0x2668, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ICH }, /* ICH6 */ |
1463 | { 0x8086, 0x27d8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* ICH7 */ | 1598 | { 0x8086, 0x27d8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ICH }, /* ICH7 */ |
1464 | { 0x8086, 0x269a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* ESB2 */ | 1599 | { 0x8086, 0x269a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ICH }, /* ESB2 */ |
1465 | { 0x1002, 0x437b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* ATI SB450 */ | 1600 | { 0x1002, 0x437b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ATI }, /* ATI SB450 */ |
1466 | { 0x1106, 0x3288, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* VIA VT8251/VT8237A */ | 1601 | { 0x1106, 0x3288, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_VIA }, /* VIA VT8251/VT8237A */ |
1467 | { 0x10b9, 0x5461, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* ALI 5461? */ | 1602 | { 0x1039, 0x7502, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_SIS }, /* SIS966 */ |
1603 | { 0x10b9, 0x5461, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ULI }, /* ULI M5461 */ | ||
1468 | { 0, } | 1604 | { 0, } |
1469 | }; | 1605 | }; |
1470 | MODULE_DEVICE_TABLE(pci, azx_ids); | 1606 | MODULE_DEVICE_TABLE(pci, azx_ids); |
@@ -1472,6 +1608,7 @@ MODULE_DEVICE_TABLE(pci, azx_ids); | |||
1472 | /* pci_driver definition */ | 1608 | /* pci_driver definition */ |
1473 | static struct pci_driver driver = { | 1609 | static struct pci_driver driver = { |
1474 | .name = "HDA Intel", | 1610 | .name = "HDA Intel", |
1611 | .owner = THIS_MODULE, | ||
1475 | .id_table = azx_ids, | 1612 | .id_table = azx_ids, |
1476 | .probe = azx_probe, | 1613 | .probe = azx_probe, |
1477 | .remove = __devexit_p(azx_remove), | 1614 | .remove = __devexit_p(azx_remove), |
diff --git a/sound/pci/hda/hda_patch.h b/sound/pci/hda/hda_patch.h index a5de684b6944..acaef3c811b8 100644 --- a/sound/pci/hda/hda_patch.h +++ b/sound/pci/hda/hda_patch.h | |||
@@ -10,11 +10,14 @@ extern struct hda_codec_preset snd_hda_preset_cmedia[]; | |||
10 | extern struct hda_codec_preset snd_hda_preset_analog[]; | 10 | extern struct hda_codec_preset snd_hda_preset_analog[]; |
11 | /* SigmaTel codecs */ | 11 | /* SigmaTel codecs */ |
12 | extern struct hda_codec_preset snd_hda_preset_sigmatel[]; | 12 | extern struct hda_codec_preset snd_hda_preset_sigmatel[]; |
13 | /* SiLabs 3054/3055 modem codecs */ | ||
14 | extern struct hda_codec_preset snd_hda_preset_si3054[]; | ||
13 | 15 | ||
14 | static const struct hda_codec_preset *hda_preset_tables[] = { | 16 | static const struct hda_codec_preset *hda_preset_tables[] = { |
15 | snd_hda_preset_realtek, | 17 | snd_hda_preset_realtek, |
16 | snd_hda_preset_cmedia, | 18 | snd_hda_preset_cmedia, |
17 | snd_hda_preset_analog, | 19 | snd_hda_preset_analog, |
18 | snd_hda_preset_sigmatel, | 20 | snd_hda_preset_sigmatel, |
21 | snd_hda_preset_si3054, | ||
19 | NULL | 22 | NULL |
20 | }; | 23 | }; |
diff --git a/sound/pci/hda/hda_proc.c b/sound/pci/hda/hda_proc.c index de1217bd8e68..08f6a6efc5e6 100644 --- a/sound/pci/hda/hda_proc.c +++ b/sound/pci/hda/hda_proc.c | |||
@@ -207,6 +207,8 @@ static void print_codec_info(snd_info_entry_t *entry, snd_info_buffer_t *buffer) | |||
207 | snd_iprintf(buffer, "Vendor Id: 0x%x\n", codec->vendor_id); | 207 | snd_iprintf(buffer, "Vendor Id: 0x%x\n", codec->vendor_id); |
208 | snd_iprintf(buffer, "Subsystem Id: 0x%x\n", codec->subsystem_id); | 208 | snd_iprintf(buffer, "Subsystem Id: 0x%x\n", codec->subsystem_id); |
209 | snd_iprintf(buffer, "Revision Id: 0x%x\n", codec->revision_id); | 209 | snd_iprintf(buffer, "Revision Id: 0x%x\n", codec->revision_id); |
210 | if (! codec->afg) | ||
211 | return; | ||
210 | snd_iprintf(buffer, "Default PCM: "); | 212 | snd_iprintf(buffer, "Default PCM: "); |
211 | print_pcm_caps(buffer, codec, codec->afg); | 213 | print_pcm_caps(buffer, codec, codec->afg); |
212 | snd_iprintf(buffer, "Default Amp-In caps: "); | 214 | snd_iprintf(buffer, "Default Amp-In caps: "); |
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index 2fd05bb84136..da6874d3988c 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c | |||
@@ -465,7 +465,7 @@ static int patch_ad1986a(struct hda_codec *codec) | |||
465 | { | 465 | { |
466 | struct ad198x_spec *spec; | 466 | struct ad198x_spec *spec; |
467 | 467 | ||
468 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); | 468 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
469 | if (spec == NULL) | 469 | if (spec == NULL) |
470 | return -ENOMEM; | 470 | return -ENOMEM; |
471 | 471 | ||
@@ -572,7 +572,7 @@ static snd_kcontrol_new_t ad1983_mixers[] = { | |||
572 | }, | 572 | }, |
573 | { | 573 | { |
574 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 574 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
575 | .name = "IEC958 Playback Route", | 575 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,NONE) "Route", |
576 | .info = ad1983_spdif_route_info, | 576 | .info = ad1983_spdif_route_info, |
577 | .get = ad1983_spdif_route_get, | 577 | .get = ad1983_spdif_route_get, |
578 | .put = ad1983_spdif_route_put, | 578 | .put = ad1983_spdif_route_put, |
@@ -623,7 +623,7 @@ static int patch_ad1983(struct hda_codec *codec) | |||
623 | { | 623 | { |
624 | struct ad198x_spec *spec; | 624 | struct ad198x_spec *spec; |
625 | 625 | ||
626 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); | 626 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
627 | if (spec == NULL) | 627 | if (spec == NULL) |
628 | return -ENOMEM; | 628 | return -ENOMEM; |
629 | 629 | ||
@@ -705,7 +705,7 @@ static snd_kcontrol_new_t ad1981_mixers[] = { | |||
705 | /* identical with AD1983 */ | 705 | /* identical with AD1983 */ |
706 | { | 706 | { |
707 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 707 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
708 | .name = "IEC958 Playback Route", | 708 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,NONE) "Route", |
709 | .info = ad1983_spdif_route_info, | 709 | .info = ad1983_spdif_route_info, |
710 | .get = ad1983_spdif_route_get, | 710 | .get = ad1983_spdif_route_get, |
711 | .put = ad1983_spdif_route_put, | 711 | .put = ad1983_spdif_route_put, |
@@ -764,7 +764,7 @@ static int patch_ad1981(struct hda_codec *codec) | |||
764 | { | 764 | { |
765 | struct ad198x_spec *spec; | 765 | struct ad198x_spec *spec; |
766 | 766 | ||
767 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); | 767 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
768 | if (spec == NULL) | 768 | if (spec == NULL) |
769 | return -ENOMEM; | 769 | return -ENOMEM; |
770 | 770 | ||
diff --git a/sound/pci/hda/patch_cmedia.c b/sound/pci/hda/patch_cmedia.c index 86f195f19eef..523c362ec44d 100644 --- a/sound/pci/hda/patch_cmedia.c +++ b/sound/pci/hda/patch_cmedia.c | |||
@@ -647,6 +647,7 @@ static struct hda_board_config cmi9880_cfg_tbl[] = { | |||
647 | { .modelname = "min_fp", .config = CMI_MIN_FP }, | 647 | { .modelname = "min_fp", .config = CMI_MIN_FP }, |
648 | { .modelname = "full", .config = CMI_FULL }, | 648 | { .modelname = "full", .config = CMI_FULL }, |
649 | { .modelname = "full_dig", .config = CMI_FULL_DIG }, | 649 | { .modelname = "full_dig", .config = CMI_FULL_DIG }, |
650 | { .pci_subvendor = 0x1043, .pci_subdevice = 0x813d, .config = CMI_FULL_DIG }, /* ASUS P5AD2 */ | ||
650 | { .modelname = "allout", .config = CMI_ALLOUT }, | 651 | { .modelname = "allout", .config = CMI_ALLOUT }, |
651 | { .modelname = "auto", .config = CMI_AUTO }, | 652 | { .modelname = "auto", .config = CMI_AUTO }, |
652 | {} /* terminator */ | 653 | {} /* terminator */ |
@@ -666,7 +667,7 @@ static int patch_cmi9880(struct hda_codec *codec) | |||
666 | { | 667 | { |
667 | struct cmi_spec *spec; | 668 | struct cmi_spec *spec; |
668 | 669 | ||
669 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); | 670 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
670 | if (spec == NULL) | 671 | if (spec == NULL) |
671 | return -ENOMEM; | 672 | return -ENOMEM; |
672 | 673 | ||
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 9b8569900787..7327deb6df9f 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -687,6 +687,12 @@ static snd_kcontrol_new_t alc880_asus_w1v_mixer[] = { | |||
687 | { } /* end */ | 687 | { } /* end */ |
688 | }; | 688 | }; |
689 | 689 | ||
690 | /* additional mixers to alc880_asus_mixer */ | ||
691 | static snd_kcontrol_new_t alc880_pcbeep_mixer[] = { | ||
692 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | ||
693 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | ||
694 | { } /* end */ | ||
695 | }; | ||
690 | 696 | ||
691 | /* | 697 | /* |
692 | * build control elements | 698 | * build control elements |
@@ -1379,8 +1385,8 @@ static snd_kcontrol_new_t alc880_test_mixer[] = { | |||
1379 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | 1385 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
1380 | ALC_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | 1386 | ALC_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
1381 | ALC_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | 1387 | ALC_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
1382 | ALC_BIND_MUTE("CLFE Playback Volume", 0x0e, 2, HDA_INPUT), | 1388 | ALC_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
1383 | ALC_BIND_MUTE("Side Playback Volume", 0x0f, 2, HDA_INPUT), | 1389 | ALC_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
1384 | PIN_CTL_TEST("Front Pin Mode", 0x14), | 1390 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
1385 | PIN_CTL_TEST("Surround Pin Mode", 0x15), | 1391 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
1386 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), | 1392 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
@@ -1403,18 +1409,6 @@ static snd_kcontrol_new_t alc880_test_mixer[] = { | |||
1403 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), | 1409 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
1404 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), | 1410 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
1405 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), | 1411 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
1406 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | ||
1407 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | ||
1408 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), | ||
1409 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), | ||
1410 | { | ||
1411 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
1412 | .name = "Input Source", | ||
1413 | .count = 2, | ||
1414 | .info = alc_mux_enum_info, | ||
1415 | .get = alc_mux_enum_get, | ||
1416 | .put = alc_mux_enum_put, | ||
1417 | }, | ||
1418 | { | 1412 | { |
1419 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1413 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
1420 | .name = "Channel Mode", | 1414 | .name = "Channel Mode", |
@@ -1520,10 +1514,12 @@ static struct hda_board_config alc880_cfg_tbl[] = { | |||
1520 | /* Back 3 jack, front 2 jack (Internal add Aux-In) */ | 1514 | /* Back 3 jack, front 2 jack (Internal add Aux-In) */ |
1521 | { .pci_subvendor = 0x1025, .pci_subdevice = 0xe310, .config = ALC880_3ST }, | 1515 | { .pci_subvendor = 0x1025, .pci_subdevice = 0xe310, .config = ALC880_3ST }, |
1522 | { .pci_subvendor = 0x104d, .pci_subdevice = 0x81d6, .config = ALC880_3ST }, | 1516 | { .pci_subvendor = 0x104d, .pci_subdevice = 0x81d6, .config = ALC880_3ST }, |
1517 | { .pci_subvendor = 0x104d, .pci_subdevice = 0x81a0, .config = ALC880_3ST }, | ||
1523 | 1518 | ||
1524 | /* Back 3 jack plus 1 SPDIF out jack, front 2 jack */ | 1519 | /* Back 3 jack plus 1 SPDIF out jack, front 2 jack */ |
1525 | { .modelname = "3stack-digout", .config = ALC880_3ST_DIG }, | 1520 | { .modelname = "3stack-digout", .config = ALC880_3ST_DIG }, |
1526 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe308, .config = ALC880_3ST_DIG }, | 1521 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe308, .config = ALC880_3ST_DIG }, |
1522 | { .pci_subvendor = 0x1025, .pci_subdevice = 0x0070, .config = ALC880_3ST_DIG }, | ||
1527 | 1523 | ||
1528 | /* Back 3 jack plus 1 SPDIF out jack, front 2 jack (Internal add Aux-In)*/ | 1524 | /* Back 3 jack plus 1 SPDIF out jack, front 2 jack (Internal add Aux-In)*/ |
1529 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe305, .config = ALC880_3ST_DIG }, | 1525 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xe305, .config = ALC880_3ST_DIG }, |
@@ -1574,6 +1570,7 @@ static struct hda_board_config alc880_cfg_tbl[] = { | |||
1574 | { .pci_subvendor = 0x1043, .pci_subdevice = 0x1973, .config = ALC880_ASUS_DIG }, | 1570 | { .pci_subvendor = 0x1043, .pci_subdevice = 0x1973, .config = ALC880_ASUS_DIG }, |
1575 | { .pci_subvendor = 0x1043, .pci_subdevice = 0x19b3, .config = ALC880_ASUS_DIG }, | 1571 | { .pci_subvendor = 0x1043, .pci_subdevice = 0x19b3, .config = ALC880_ASUS_DIG }, |
1576 | { .pci_subvendor = 0x1043, .pci_subdevice = 0x1113, .config = ALC880_ASUS_DIG }, | 1572 | { .pci_subvendor = 0x1043, .pci_subdevice = 0x1113, .config = ALC880_ASUS_DIG }, |
1573 | { .pci_subvendor = 0x1043, .pci_subdevice = 0x1173, .config = ALC880_ASUS_DIG }, | ||
1577 | { .pci_subvendor = 0x1043, .pci_subdevice = 0x1993, .config = ALC880_ASUS }, | 1574 | { .pci_subvendor = 0x1043, .pci_subdevice = 0x1993, .config = ALC880_ASUS }, |
1578 | { .pci_subvendor = 0x1043, .pci_subdevice = 0x10c3, .config = ALC880_ASUS_DIG }, | 1575 | { .pci_subvendor = 0x1043, .pci_subdevice = 0x10c3, .config = ALC880_ASUS_DIG }, |
1579 | { .pci_subvendor = 0x1043, .pci_subdevice = 0x1133, .config = ALC880_ASUS }, | 1576 | { .pci_subvendor = 0x1043, .pci_subdevice = 0x1133, .config = ALC880_ASUS }, |
@@ -1734,7 +1731,7 @@ static struct alc_config_preset alc880_presets[] = { | |||
1734 | .input_mux = &alc880_capture_source, | 1731 | .input_mux = &alc880_capture_source, |
1735 | }, | 1732 | }, |
1736 | [ALC880_UNIWILL_DIG] = { | 1733 | [ALC880_UNIWILL_DIG] = { |
1737 | .mixers = { alc880_asus_mixer }, | 1734 | .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer }, |
1738 | .init_verbs = { alc880_volume_init_verbs, alc880_pin_asus_init_verbs }, | 1735 | .init_verbs = { alc880_volume_init_verbs, alc880_pin_asus_init_verbs }, |
1739 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | 1736 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
1740 | .dac_nids = alc880_asus_dac_nids, | 1737 | .dac_nids = alc880_asus_dac_nids, |
@@ -2086,7 +2083,7 @@ static int patch_alc880(struct hda_codec *codec) | |||
2086 | int board_config; | 2083 | int board_config; |
2087 | int i, err; | 2084 | int i, err; |
2088 | 2085 | ||
2089 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); | 2086 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
2090 | if (spec == NULL) | 2087 | if (spec == NULL) |
2091 | return -ENOMEM; | 2088 | return -ENOMEM; |
2092 | 2089 | ||
@@ -2234,7 +2231,7 @@ static snd_kcontrol_new_t alc260_base_mixer[] = { | |||
2234 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), | 2231 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
2235 | ALC_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), | 2232 | ALC_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
2236 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), | 2233 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
2237 | ALC_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_OUTPUT), | 2234 | ALC_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
2238 | HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT), | 2235 | HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT), |
2239 | HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT), | 2236 | HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT), |
2240 | { | 2237 | { |
@@ -2261,7 +2258,7 @@ static snd_kcontrol_new_t alc260_hp_mixer[] = { | |||
2261 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), | 2258 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
2262 | ALC_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), | 2259 | ALC_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
2263 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), | 2260 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
2264 | ALC_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_OUTPUT), | 2261 | ALC_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
2265 | HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT), | 2262 | HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT), |
2266 | HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT), | 2263 | HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT), |
2267 | { | 2264 | { |
@@ -2358,7 +2355,7 @@ static int patch_alc260(struct hda_codec *codec) | |||
2358 | struct alc_spec *spec; | 2355 | struct alc_spec *spec; |
2359 | int board_config; | 2356 | int board_config; |
2360 | 2357 | ||
2361 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); | 2358 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
2362 | if (spec == NULL) | 2359 | if (spec == NULL) |
2363 | return -ENOMEM; | 2360 | return -ENOMEM; |
2364 | 2361 | ||
@@ -2492,7 +2489,7 @@ static snd_kcontrol_new_t alc882_base_mixer[] = { | |||
2492 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | 2489 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
2493 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | 2490 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
2494 | ALC_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | 2491 | ALC_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
2495 | ALC_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_OUTPUT), | 2492 | ALC_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
2496 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | 2493 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
2497 | ALC_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), | 2494 | ALC_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
2498 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | 2495 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
@@ -2608,7 +2605,7 @@ static int patch_alc882(struct hda_codec *codec) | |||
2608 | { | 2605 | { |
2609 | struct alc_spec *spec; | 2606 | struct alc_spec *spec; |
2610 | 2607 | ||
2611 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); | 2608 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
2612 | if (spec == NULL) | 2609 | if (spec == NULL) |
2613 | return -ENOMEM; | 2610 | return -ENOMEM; |
2614 | 2611 | ||
diff --git a/sound/pci/hda/patch_si3054.c b/sound/pci/hda/patch_si3054.c new file mode 100644 index 000000000000..d014b7bb70df --- /dev/null +++ b/sound/pci/hda/patch_si3054.c | |||
@@ -0,0 +1,301 @@ | |||
1 | /* | ||
2 | * Universal Interface for Intel High Definition Audio Codec | ||
3 | * | ||
4 | * HD audio interface patch for Silicon Labs 3054/5 modem codec | ||
5 | * | ||
6 | * Copyright (c) 2005 Sasha Khapyorsky <sashak@smlink.com> | ||
7 | * Takashi Iwai <tiwai@suse.de> | ||
8 | * | ||
9 | * | ||
10 | * This driver is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License as published by | ||
12 | * the Free Software Foundation; either version 2 of the License, or | ||
13 | * (at your option) any later version. | ||
14 | * | ||
15 | * This driver is distributed in the hope that it will be useful, | ||
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
18 | * GNU General Public License for more details. | ||
19 | * | ||
20 | * You should have received a copy of the GNU General Public License | ||
21 | * along with this program; if not, write to the Free Software | ||
22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
23 | */ | ||
24 | |||
25 | #include <sound/driver.h> | ||
26 | #include <linux/init.h> | ||
27 | #include <linux/delay.h> | ||
28 | #include <linux/slab.h> | ||
29 | #include <linux/pci.h> | ||
30 | #include <sound/core.h> | ||
31 | #include "hda_codec.h" | ||
32 | #include "hda_local.h" | ||
33 | |||
34 | |||
35 | /* si3054 verbs */ | ||
36 | #define SI3054_VERB_READ_NODE 0x900 | ||
37 | #define SI3054_VERB_WRITE_NODE 0x100 | ||
38 | |||
39 | /* si3054 nodes (registers) */ | ||
40 | #define SI3054_EXTENDED_MID 2 | ||
41 | #define SI3054_LINE_RATE 3 | ||
42 | #define SI3054_LINE_LEVEL 4 | ||
43 | #define SI3054_GPIO_CFG 5 | ||
44 | #define SI3054_GPIO_POLARITY 6 | ||
45 | #define SI3054_GPIO_STICKY 7 | ||
46 | #define SI3054_GPIO_WAKEUP 8 | ||
47 | #define SI3054_GPIO_STATUS 9 | ||
48 | #define SI3054_GPIO_CONTROL 10 | ||
49 | #define SI3054_MISC_AFE 11 | ||
50 | #define SI3054_CHIPID 12 | ||
51 | #define SI3054_LINE_CFG1 13 | ||
52 | #define SI3054_LINE_STATUS 14 | ||
53 | #define SI3054_DC_TERMINATION 15 | ||
54 | #define SI3054_LINE_CONFIG 16 | ||
55 | #define SI3054_CALLPROG_ATT 17 | ||
56 | #define SI3054_SQ_CONTROL 18 | ||
57 | #define SI3054_MISC_CONTROL 19 | ||
58 | #define SI3054_RING_CTRL1 20 | ||
59 | #define SI3054_RING_CTRL2 21 | ||
60 | |||
61 | /* extended MID */ | ||
62 | #define SI3054_MEI_READY 0xf | ||
63 | |||
64 | /* line level */ | ||
65 | #define SI3054_ATAG_MASK 0x00f0 | ||
66 | #define SI3054_DTAG_MASK 0xf000 | ||
67 | |||
68 | /* GPIO bits */ | ||
69 | #define SI3054_GPIO_OH 0x0001 | ||
70 | #define SI3054_GPIO_CID 0x0002 | ||
71 | |||
72 | /* chipid and revisions */ | ||
73 | #define SI3054_CHIPID_CODEC_REV_MASK 0x000f | ||
74 | #define SI3054_CHIPID_DAA_REV_MASK 0x00f0 | ||
75 | #define SI3054_CHIPID_INTERNATIONAL 0x0100 | ||
76 | #define SI3054_CHIPID_DAA_ID 0x0f00 | ||
77 | #define SI3054_CHIPID_CODEC_ID (1<<12) | ||
78 | |||
79 | /* si3054 codec registers (nodes) access macros */ | ||
80 | #define GET_REG(codec,reg) (snd_hda_codec_read(codec,reg,0,SI3054_VERB_READ_NODE,0)) | ||
81 | #define SET_REG(codec,reg,val) (snd_hda_codec_write(codec,reg,0,SI3054_VERB_WRITE_NODE,val)) | ||
82 | |||
83 | |||
84 | struct si3054_spec { | ||
85 | unsigned international; | ||
86 | struct hda_pcm pcm; | ||
87 | }; | ||
88 | |||
89 | |||
90 | /* | ||
91 | * Modem mixer | ||
92 | */ | ||
93 | |||
94 | #define PRIVATE_VALUE(reg,mask) ((reg<<16)|(mask&0xffff)) | ||
95 | #define PRIVATE_REG(val) ((val>>16)&0xffff) | ||
96 | #define PRIVATE_MASK(val) (val&0xffff) | ||
97 | |||
98 | static int si3054_switch_info(snd_kcontrol_t *kcontrol, | ||
99 | snd_ctl_elem_info_t *uinfo) | ||
100 | { | ||
101 | uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; | ||
102 | uinfo->count = 1; | ||
103 | uinfo->value.integer.min = 0; | ||
104 | uinfo->value.integer.max = 1; | ||
105 | return 0; | ||
106 | } | ||
107 | |||
108 | static int si3054_switch_get(snd_kcontrol_t *kcontrol, | ||
109 | snd_ctl_elem_value_t *uvalue) | ||
110 | { | ||
111 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
112 | u16 reg = PRIVATE_REG(kcontrol->private_value); | ||
113 | u16 mask = PRIVATE_MASK(kcontrol->private_value); | ||
114 | uvalue->value.integer.value[0] = (GET_REG(codec, reg)) & mask ? 1 : 0 ; | ||
115 | return 0; | ||
116 | } | ||
117 | |||
118 | static int si3054_switch_put(snd_kcontrol_t *kcontrol, | ||
119 | snd_ctl_elem_value_t *uvalue) | ||
120 | { | ||
121 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
122 | u16 reg = PRIVATE_REG(kcontrol->private_value); | ||
123 | u16 mask = PRIVATE_MASK(kcontrol->private_value); | ||
124 | if (uvalue->value.integer.value[0]) | ||
125 | SET_REG(codec, reg, (GET_REG(codec, reg)) | mask); | ||
126 | else | ||
127 | SET_REG(codec, reg, (GET_REG(codec, reg)) & ~mask); | ||
128 | return 0; | ||
129 | } | ||
130 | |||
131 | #define SI3054_KCONTROL(kname,reg,mask) { \ | ||
132 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | ||
133 | .name = kname, \ | ||
134 | .info = si3054_switch_info, \ | ||
135 | .get = si3054_switch_get, \ | ||
136 | .put = si3054_switch_put, \ | ||
137 | .private_value = PRIVATE_VALUE(reg,mask), \ | ||
138 | } | ||
139 | |||
140 | |||
141 | static snd_kcontrol_new_t si3054_modem_mixer[] = { | ||
142 | SI3054_KCONTROL("Off-hook Switch", SI3054_GPIO_CONTROL, SI3054_GPIO_OH), | ||
143 | SI3054_KCONTROL("Caller ID Switch", SI3054_GPIO_CONTROL, SI3054_GPIO_CID), | ||
144 | {} | ||
145 | }; | ||
146 | |||
147 | static int si3054_build_controls(struct hda_codec *codec) | ||
148 | { | ||
149 | return snd_hda_add_new_ctls(codec, si3054_modem_mixer); | ||
150 | } | ||
151 | |||
152 | |||
153 | /* | ||
154 | * PCM callbacks | ||
155 | */ | ||
156 | |||
157 | static int si3054_pcm_prepare(struct hda_pcm_stream *hinfo, | ||
158 | struct hda_codec *codec, | ||
159 | unsigned int stream_tag, | ||
160 | unsigned int format, | ||
161 | snd_pcm_substream_t *substream) | ||
162 | { | ||
163 | u16 val; | ||
164 | |||
165 | SET_REG(codec, SI3054_LINE_RATE, substream->runtime->rate); | ||
166 | val = GET_REG(codec, SI3054_LINE_LEVEL); | ||
167 | val &= 0xff << (8 * (substream->stream != SNDRV_PCM_STREAM_PLAYBACK)); | ||
168 | val |= ((stream_tag & 0xf) << 4) << (8 * (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)); | ||
169 | SET_REG(codec, SI3054_LINE_LEVEL, val); | ||
170 | |||
171 | snd_hda_codec_setup_stream(codec, hinfo->nid, | ||
172 | stream_tag, 0, format); | ||
173 | return 0; | ||
174 | } | ||
175 | |||
176 | static int si3054_pcm_open(struct hda_pcm_stream *hinfo, | ||
177 | struct hda_codec *codec, | ||
178 | snd_pcm_substream_t *substream) | ||
179 | { | ||
180 | static unsigned int rates[] = { 8000, 9600, 16000 }; | ||
181 | static snd_pcm_hw_constraint_list_t hw_constraints_rates = { | ||
182 | .count = ARRAY_SIZE(rates), | ||
183 | .list = rates, | ||
184 | .mask = 0, | ||
185 | }; | ||
186 | substream->runtime->hw.period_bytes_min = 80; | ||
187 | return snd_pcm_hw_constraint_list(substream->runtime, 0, | ||
188 | SNDRV_PCM_HW_PARAM_RATE, &hw_constraints_rates); | ||
189 | } | ||
190 | |||
191 | |||
192 | static struct hda_pcm_stream si3054_pcm = { | ||
193 | .substreams = 1, | ||
194 | .channels_min = 1, | ||
195 | .channels_max = 1, | ||
196 | .nid = 0x1, | ||
197 | .rates = SNDRV_PCM_RATE_8000|SNDRV_PCM_RATE_16000|SNDRV_PCM_RATE_KNOT, | ||
198 | .formats = SNDRV_PCM_FMTBIT_S16_LE, | ||
199 | .maxbps = 16, | ||
200 | .ops = { | ||
201 | .open = si3054_pcm_open, | ||
202 | .prepare = si3054_pcm_prepare, | ||
203 | }, | ||
204 | }; | ||
205 | |||
206 | |||
207 | static int si3054_build_pcms(struct hda_codec *codec) | ||
208 | { | ||
209 | struct si3054_spec *spec = codec->spec; | ||
210 | struct hda_pcm *info = &spec->pcm; | ||
211 | si3054_pcm.nid = codec->mfg; | ||
212 | codec->num_pcms = 1; | ||
213 | codec->pcm_info = info; | ||
214 | info->name = "Si3054 Modem"; | ||
215 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = si3054_pcm; | ||
216 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = si3054_pcm; | ||
217 | info->is_modem = 1; | ||
218 | return 0; | ||
219 | } | ||
220 | |||
221 | |||
222 | /* | ||
223 | * Init part | ||
224 | */ | ||
225 | |||
226 | static int si3054_init(struct hda_codec *codec) | ||
227 | { | ||
228 | struct si3054_spec *spec = codec->spec; | ||
229 | unsigned wait_count; | ||
230 | u16 val; | ||
231 | |||
232 | snd_hda_codec_write(codec, AC_NODE_ROOT, 0, AC_VERB_SET_CODEC_RESET, 0); | ||
233 | snd_hda_codec_write(codec, codec->mfg, 0, AC_VERB_SET_STREAM_FORMAT, 0); | ||
234 | SET_REG(codec, SI3054_LINE_RATE, 9600); | ||
235 | SET_REG(codec, SI3054_LINE_LEVEL, SI3054_DTAG_MASK|SI3054_ATAG_MASK); | ||
236 | SET_REG(codec, SI3054_EXTENDED_MID, 0); | ||
237 | |||
238 | wait_count = 10; | ||
239 | do { | ||
240 | msleep(2); | ||
241 | val = GET_REG(codec, SI3054_EXTENDED_MID); | ||
242 | } while ((val & SI3054_MEI_READY) != SI3054_MEI_READY && wait_count--); | ||
243 | |||
244 | if((val&SI3054_MEI_READY) != SI3054_MEI_READY) { | ||
245 | snd_printk(KERN_ERR "si3054: cannot initialize. EXT MID = %04x\n", val); | ||
246 | return -EACCES; | ||
247 | } | ||
248 | |||
249 | SET_REG(codec, SI3054_GPIO_POLARITY, 0xffff); | ||
250 | SET_REG(codec, SI3054_GPIO_CFG, 0x0); | ||
251 | SET_REG(codec, SI3054_MISC_AFE, 0); | ||
252 | SET_REG(codec, SI3054_LINE_CFG1,0x200); | ||
253 | |||
254 | if((GET_REG(codec,SI3054_LINE_STATUS) & (1<<6)) == 0) { | ||
255 | snd_printd("Link Frame Detect(FDT) is not ready (line status: %04x)\n", | ||
256 | GET_REG(codec,SI3054_LINE_STATUS)); | ||
257 | } | ||
258 | |||
259 | spec->international = GET_REG(codec, SI3054_CHIPID) & SI3054_CHIPID_INTERNATIONAL; | ||
260 | |||
261 | return 0; | ||
262 | } | ||
263 | |||
264 | static void si3054_free(struct hda_codec *codec) | ||
265 | { | ||
266 | kfree(codec->spec); | ||
267 | } | ||
268 | |||
269 | |||
270 | /* | ||
271 | */ | ||
272 | |||
273 | static struct hda_codec_ops si3054_patch_ops = { | ||
274 | .build_controls = si3054_build_controls, | ||
275 | .build_pcms = si3054_build_pcms, | ||
276 | .init = si3054_init, | ||
277 | .free = si3054_free, | ||
278 | #ifdef CONFIG_PM | ||
279 | //.suspend = si3054_suspend, | ||
280 | .resume = si3054_init, | ||
281 | #endif | ||
282 | }; | ||
283 | |||
284 | static int patch_si3054(struct hda_codec *codec) | ||
285 | { | ||
286 | struct si3054_spec *spec = kzalloc(sizeof(*spec), GFP_KERNEL); | ||
287 | if (spec == NULL) | ||
288 | return -ENOMEM; | ||
289 | codec->spec = spec; | ||
290 | codec->patch_ops = si3054_patch_ops; | ||
291 | return 0; | ||
292 | } | ||
293 | |||
294 | /* | ||
295 | * patch entries | ||
296 | */ | ||
297 | struct hda_codec_preset snd_hda_preset_si3054[] = { | ||
298 | { .id = 0x163c3155, .name = "Si3054", .patch = patch_si3054 }, | ||
299 | {} | ||
300 | }; | ||
301 | |||
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 9d503da7320d..33a8adaea768 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -919,7 +919,7 @@ static int patch_stac9200(struct hda_codec *codec) | |||
919 | struct sigmatel_spec *spec; | 919 | struct sigmatel_spec *spec; |
920 | int err; | 920 | int err; |
921 | 921 | ||
922 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); | 922 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
923 | if (spec == NULL) | 923 | if (spec == NULL) |
924 | return -ENOMEM; | 924 | return -ENOMEM; |
925 | 925 | ||
@@ -957,7 +957,7 @@ static int patch_stac922x(struct hda_codec *codec) | |||
957 | struct sigmatel_spec *spec; | 957 | struct sigmatel_spec *spec; |
958 | int err; | 958 | int err; |
959 | 959 | ||
960 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); | 960 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
961 | if (spec == NULL) | 961 | if (spec == NULL) |
962 | return -ENOMEM; | 962 | return -ENOMEM; |
963 | 963 | ||
diff --git a/sound/pci/ice1712/aureon.c b/sound/pci/ice1712/aureon.c index 4405d96cbedf..2e0a31613ee6 100644 --- a/sound/pci/ice1712/aureon.c +++ b/sound/pci/ice1712/aureon.c | |||
@@ -1796,7 +1796,7 @@ static int __devinit aureon_init(ice1712_t *ice) | |||
1796 | } | 1796 | } |
1797 | 1797 | ||
1798 | /* to remeber the register values of CS8415 */ | 1798 | /* to remeber the register values of CS8415 */ |
1799 | ice->akm = kcalloc(1, sizeof(akm4xxx_t), GFP_KERNEL); | 1799 | ice->akm = kzalloc(sizeof(akm4xxx_t), GFP_KERNEL); |
1800 | if (! ice->akm) | 1800 | if (! ice->akm) |
1801 | return -ENOMEM; | 1801 | return -ENOMEM; |
1802 | ice->akm_codecs = 1; | 1802 | ice->akm_codecs = 1; |
diff --git a/sound/pci/ice1712/delta.c b/sound/pci/ice1712/delta.c index eb20f73be61a..39fbe662965d 100644 --- a/sound/pci/ice1712/delta.c +++ b/sound/pci/ice1712/delta.c | |||
@@ -618,15 +618,15 @@ static int __devinit snd_ice1712_delta_init(ice1712_t *ice) | |||
618 | */ | 618 | */ |
619 | 619 | ||
620 | static snd_kcontrol_new_t snd_ice1712_delta1010_wordclock_select __devinitdata = | 620 | static snd_kcontrol_new_t snd_ice1712_delta1010_wordclock_select __devinitdata = |
621 | ICE1712_GPIO(SNDRV_CTL_ELEM_IFACE_PCM, "Word Clock Sync", 0, ICE1712_DELTA_WORD_CLOCK_SELECT, 1, 0); | 621 | ICE1712_GPIO(SNDRV_CTL_ELEM_IFACE_MIXER, "Word Clock Sync", 0, ICE1712_DELTA_WORD_CLOCK_SELECT, 1, 0); |
622 | static snd_kcontrol_new_t snd_ice1712_delta1010lt_wordclock_select __devinitdata = | 622 | static snd_kcontrol_new_t snd_ice1712_delta1010lt_wordclock_select __devinitdata = |
623 | ICE1712_GPIO(SNDRV_CTL_ELEM_IFACE_PCM, "Word Clock Sync", 0, ICE1712_DELTA_1010LT_WORDCLOCK, 1, 0); | 623 | ICE1712_GPIO(SNDRV_CTL_ELEM_IFACE_MIXER, "Word Clock Sync", 0, ICE1712_DELTA_1010LT_WORDCLOCK, 1, 0); |
624 | static snd_kcontrol_new_t snd_ice1712_delta1010_wordclock_status __devinitdata = | 624 | static snd_kcontrol_new_t snd_ice1712_delta1010_wordclock_status __devinitdata = |
625 | ICE1712_GPIO(SNDRV_CTL_ELEM_IFACE_PCM, "Word Clock Status", 0, ICE1712_DELTA_WORD_CLOCK_STATUS, 1, SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE); | 625 | ICE1712_GPIO(SNDRV_CTL_ELEM_IFACE_MIXER, "Word Clock Status", 0, ICE1712_DELTA_WORD_CLOCK_STATUS, 1, SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE); |
626 | static snd_kcontrol_new_t snd_ice1712_deltadio2496_spdif_in_select __devinitdata = | 626 | static snd_kcontrol_new_t snd_ice1712_deltadio2496_spdif_in_select __devinitdata = |
627 | ICE1712_GPIO(SNDRV_CTL_ELEM_IFACE_PCM, "IEC958 Input Optical", 0, ICE1712_DELTA_SPDIF_INPUT_SELECT, 0, 0); | 627 | ICE1712_GPIO(SNDRV_CTL_ELEM_IFACE_MIXER, "IEC958 Input Optical", 0, ICE1712_DELTA_SPDIF_INPUT_SELECT, 0, 0); |
628 | static snd_kcontrol_new_t snd_ice1712_delta_spdif_in_status __devinitdata = | 628 | static snd_kcontrol_new_t snd_ice1712_delta_spdif_in_status __devinitdata = |
629 | ICE1712_GPIO(SNDRV_CTL_ELEM_IFACE_PCM, "Delta IEC958 Input Status", 0, ICE1712_DELTA_SPDIF_IN_STAT, 1, SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE); | 629 | ICE1712_GPIO(SNDRV_CTL_ELEM_IFACE_MIXER, "Delta IEC958 Input Status", 0, ICE1712_DELTA_SPDIF_IN_STAT, 1, SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE); |
630 | 630 | ||
631 | 631 | ||
632 | static int __devinit snd_ice1712_delta_add_controls(ice1712_t *ice) | 632 | static int __devinit snd_ice1712_delta_add_controls(ice1712_t *ice) |
diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c index a2545a5b26c4..a6d98013c331 100644 --- a/sound/pci/ice1712/ice1712.c +++ b/sound/pci/ice1712/ice1712.c | |||
@@ -100,12 +100,6 @@ MODULE_PARM_DESC(cs8427_timeout, "Define reset timeout for cs8427 chip in msec r | |||
100 | module_param_array(model, charp, NULL, 0444); | 100 | module_param_array(model, charp, NULL, 0444); |
101 | MODULE_PARM_DESC(model, "Use the given board model."); | 101 | MODULE_PARM_DESC(model, "Use the given board model."); |
102 | 102 | ||
103 | #ifndef PCI_VENDOR_ID_ICE | ||
104 | #define PCI_VENDOR_ID_ICE 0x1412 | ||
105 | #endif | ||
106 | #ifndef PCI_DEVICE_ID_ICE_1712 | ||
107 | #define PCI_DEVICE_ID_ICE_1712 0x1712 | ||
108 | #endif | ||
109 | 103 | ||
110 | static struct pci_device_id snd_ice1712_ids[] = { | 104 | static struct pci_device_id snd_ice1712_ids[] = { |
111 | { PCI_VENDOR_ID_ICE, PCI_DEVICE_ID_ICE_1712, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* ICE1712 */ | 105 | { PCI_VENDOR_ID_ICE, PCI_DEVICE_ID_ICE_1712, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* ICE1712 */ |
@@ -1422,7 +1416,7 @@ static snd_kcontrol_new_t snd_ice1712_multi_capture_analog_switch __devinitdata | |||
1422 | 1416 | ||
1423 | static snd_kcontrol_new_t snd_ice1712_multi_capture_spdif_switch __devinitdata = { | 1417 | static snd_kcontrol_new_t snd_ice1712_multi_capture_spdif_switch __devinitdata = { |
1424 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1418 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
1425 | .name = "IEC958 Multi Capture Switch", | 1419 | .name = SNDRV_CTL_NAME_IEC958("Multi ",CAPTURE,SWITCH), |
1426 | .info = snd_ice1712_pro_mixer_switch_info, | 1420 | .info = snd_ice1712_pro_mixer_switch_info, |
1427 | .get = snd_ice1712_pro_mixer_switch_get, | 1421 | .get = snd_ice1712_pro_mixer_switch_get, |
1428 | .put = snd_ice1712_pro_mixer_switch_put, | 1422 | .put = snd_ice1712_pro_mixer_switch_put, |
@@ -1441,7 +1435,7 @@ static snd_kcontrol_new_t snd_ice1712_multi_capture_analog_volume __devinitdata | |||
1441 | 1435 | ||
1442 | static snd_kcontrol_new_t snd_ice1712_multi_capture_spdif_volume __devinitdata = { | 1436 | static snd_kcontrol_new_t snd_ice1712_multi_capture_spdif_volume __devinitdata = { |
1443 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1437 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
1444 | .name = "IEC958 Multi Capture Volume", | 1438 | .name = SNDRV_CTL_NAME_IEC958("Multi ",CAPTURE,VOLUME), |
1445 | .info = snd_ice1712_pro_mixer_volume_info, | 1439 | .info = snd_ice1712_pro_mixer_volume_info, |
1446 | .get = snd_ice1712_pro_mixer_volume_get, | 1440 | .get = snd_ice1712_pro_mixer_volume_get, |
1447 | .put = snd_ice1712_pro_mixer_volume_put, | 1441 | .put = snd_ice1712_pro_mixer_volume_put, |
@@ -1715,7 +1709,7 @@ static int snd_ice1712_spdif_maskp_get(snd_kcontrol_t * kcontrol, | |||
1715 | static snd_kcontrol_new_t snd_ice1712_spdif_maskc __devinitdata = | 1709 | static snd_kcontrol_new_t snd_ice1712_spdif_maskc __devinitdata = |
1716 | { | 1710 | { |
1717 | .access = SNDRV_CTL_ELEM_ACCESS_READ, | 1711 | .access = SNDRV_CTL_ELEM_ACCESS_READ, |
1718 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1712 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, |
1719 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,CON_MASK), | 1713 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,CON_MASK), |
1720 | .info = snd_ice1712_spdif_info, | 1714 | .info = snd_ice1712_spdif_info, |
1721 | .get = snd_ice1712_spdif_maskc_get, | 1715 | .get = snd_ice1712_spdif_maskc_get, |
@@ -1724,7 +1718,7 @@ static snd_kcontrol_new_t snd_ice1712_spdif_maskc __devinitdata = | |||
1724 | static snd_kcontrol_new_t snd_ice1712_spdif_maskp __devinitdata = | 1718 | static snd_kcontrol_new_t snd_ice1712_spdif_maskp __devinitdata = |
1725 | { | 1719 | { |
1726 | .access = SNDRV_CTL_ELEM_ACCESS_READ, | 1720 | .access = SNDRV_CTL_ELEM_ACCESS_READ, |
1727 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1721 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, |
1728 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,PRO_MASK), | 1722 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,PRO_MASK), |
1729 | .info = snd_ice1712_spdif_info, | 1723 | .info = snd_ice1712_spdif_info, |
1730 | .get = snd_ice1712_spdif_maskp_get, | 1724 | .get = snd_ice1712_spdif_maskp_get, |
@@ -2203,7 +2197,7 @@ static snd_kcontrol_new_t snd_ice1712_mixer_pro_analog_route __devinitdata = { | |||
2203 | 2197 | ||
2204 | static snd_kcontrol_new_t snd_ice1712_mixer_pro_spdif_route __devinitdata = { | 2198 | static snd_kcontrol_new_t snd_ice1712_mixer_pro_spdif_route __devinitdata = { |
2205 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 2199 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
2206 | .name = "IEC958 Playback Route", | 2200 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,NONE) "Route", |
2207 | .info = snd_ice1712_pro_route_info, | 2201 | .info = snd_ice1712_pro_route_info, |
2208 | .get = snd_ice1712_pro_route_spdif_get, | 2202 | .get = snd_ice1712_pro_route_spdif_get, |
2209 | .put = snd_ice1712_pro_route_spdif_put, | 2203 | .put = snd_ice1712_pro_route_spdif_put, |
@@ -2535,7 +2529,7 @@ static int __devinit snd_ice1712_create(snd_card_t * card, | |||
2535 | return -ENXIO; | 2529 | return -ENXIO; |
2536 | } | 2530 | } |
2537 | 2531 | ||
2538 | ice = kcalloc(1, sizeof(*ice), GFP_KERNEL); | 2532 | ice = kzalloc(sizeof(*ice), GFP_KERNEL); |
2539 | if (ice == NULL) { | 2533 | if (ice == NULL) { |
2540 | pci_disable_device(pci); | 2534 | pci_disable_device(pci); |
2541 | return -ENOMEM; | 2535 | return -ENOMEM; |
@@ -2741,6 +2735,7 @@ static void __devexit snd_ice1712_remove(struct pci_dev *pci) | |||
2741 | 2735 | ||
2742 | static struct pci_driver driver = { | 2736 | static struct pci_driver driver = { |
2743 | .name = "ICE1712", | 2737 | .name = "ICE1712", |
2738 | .owner = THIS_MODULE, | ||
2744 | .id_table = snd_ice1712_ids, | 2739 | .id_table = snd_ice1712_ids, |
2745 | .probe = snd_ice1712_probe, | 2740 | .probe = snd_ice1712_probe, |
2746 | .remove = __devexit_p(snd_ice1712_remove), | 2741 | .remove = __devexit_p(snd_ice1712_remove), |
diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c index 79b5f12e06fc..c3ce8f93740b 100644 --- a/sound/pci/ice1712/ice1724.c +++ b/sound/pci/ice1712/ice1724.c | |||
@@ -83,12 +83,6 @@ MODULE_PARM_DESC(enable, "Enable ICE1724 soundcard."); | |||
83 | module_param_array(model, charp, NULL, 0444); | 83 | module_param_array(model, charp, NULL, 0444); |
84 | MODULE_PARM_DESC(model, "Use the given board model."); | 84 | MODULE_PARM_DESC(model, "Use the given board model."); |
85 | 85 | ||
86 | #ifndef PCI_VENDOR_ID_ICE | ||
87 | #define PCI_VENDOR_ID_ICE 0x1412 | ||
88 | #endif | ||
89 | #ifndef PCI_DEVICE_ID_VT1724 | ||
90 | #define PCI_DEVICE_ID_VT1724 0x1724 | ||
91 | #endif | ||
92 | 86 | ||
93 | /* Both VT1720 and VT1724 have the same PCI IDs */ | 87 | /* Both VT1720 and VT1724 have the same PCI IDs */ |
94 | static struct pci_device_id snd_vt1724_ids[] = { | 88 | static struct pci_device_id snd_vt1724_ids[] = { |
@@ -1414,7 +1408,7 @@ static int snd_vt1724_spdif_maskp_get(snd_kcontrol_t * kcontrol, | |||
1414 | static snd_kcontrol_new_t snd_vt1724_spdif_maskc __devinitdata = | 1408 | static snd_kcontrol_new_t snd_vt1724_spdif_maskc __devinitdata = |
1415 | { | 1409 | { |
1416 | .access = SNDRV_CTL_ELEM_ACCESS_READ, | 1410 | .access = SNDRV_CTL_ELEM_ACCESS_READ, |
1417 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1411 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, |
1418 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,CON_MASK), | 1412 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,CON_MASK), |
1419 | .info = snd_vt1724_spdif_info, | 1413 | .info = snd_vt1724_spdif_info, |
1420 | .get = snd_vt1724_spdif_maskc_get, | 1414 | .get = snd_vt1724_spdif_maskc_get, |
@@ -1423,7 +1417,7 @@ static snd_kcontrol_new_t snd_vt1724_spdif_maskc __devinitdata = | |||
1423 | static snd_kcontrol_new_t snd_vt1724_spdif_maskp __devinitdata = | 1417 | static snd_kcontrol_new_t snd_vt1724_spdif_maskp __devinitdata = |
1424 | { | 1418 | { |
1425 | .access = SNDRV_CTL_ELEM_ACCESS_READ, | 1419 | .access = SNDRV_CTL_ELEM_ACCESS_READ, |
1426 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1420 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, |
1427 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,PRO_MASK), | 1421 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,PRO_MASK), |
1428 | .info = snd_vt1724_spdif_info, | 1422 | .info = snd_vt1724_spdif_info, |
1429 | .get = snd_vt1724_spdif_maskp_get, | 1423 | .get = snd_vt1724_spdif_maskp_get, |
@@ -1466,7 +1460,7 @@ static snd_kcontrol_new_t snd_vt1724_spdif_switch __devinitdata = | |||
1466 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1460 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
1467 | /* FIXME: the following conflict with IEC958 Playback Route */ | 1461 | /* FIXME: the following conflict with IEC958 Playback Route */ |
1468 | // .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,SWITCH), | 1462 | // .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,SWITCH), |
1469 | .name = "IEC958 Output Switch", | 1463 | .name = SNDRV_CTL_NAME_IEC958("Output ",NONE,SWITCH), |
1470 | .info = snd_vt1724_spdif_sw_info, | 1464 | .info = snd_vt1724_spdif_sw_info, |
1471 | .get = snd_vt1724_spdif_sw_get, | 1465 | .get = snd_vt1724_spdif_sw_get, |
1472 | .put = snd_vt1724_spdif_sw_put | 1466 | .put = snd_vt1724_spdif_sw_put |
@@ -2130,7 +2124,7 @@ static int __devinit snd_vt1724_create(snd_card_t * card, | |||
2130 | if ((err = pci_enable_device(pci)) < 0) | 2124 | if ((err = pci_enable_device(pci)) < 0) |
2131 | return err; | 2125 | return err; |
2132 | 2126 | ||
2133 | ice = kcalloc(1, sizeof(*ice), GFP_KERNEL); | 2127 | ice = kzalloc(sizeof(*ice), GFP_KERNEL); |
2134 | if (ice == NULL) { | 2128 | if (ice == NULL) { |
2135 | pci_disable_device(pci); | 2129 | pci_disable_device(pci); |
2136 | return -ENOMEM; | 2130 | return -ENOMEM; |
@@ -2321,6 +2315,7 @@ static void __devexit snd_vt1724_remove(struct pci_dev *pci) | |||
2321 | 2315 | ||
2322 | static struct pci_driver driver = { | 2316 | static struct pci_driver driver = { |
2323 | .name = "ICE1724", | 2317 | .name = "ICE1724", |
2318 | .owner = THIS_MODULE, | ||
2324 | .id_table = snd_vt1724_ids, | 2319 | .id_table = snd_vt1724_ids, |
2325 | .probe = snd_vt1724_probe, | 2320 | .probe = snd_vt1724_probe, |
2326 | .remove = __devexit_p(snd_vt1724_remove), | 2321 | .remove = __devexit_p(snd_vt1724_remove), |
diff --git a/sound/pci/ice1712/juli.c b/sound/pci/ice1712/juli.c index 3fb297b969cd..2437876a44e4 100644 --- a/sound/pci/ice1712/juli.c +++ b/sound/pci/ice1712/juli.c | |||
@@ -182,7 +182,7 @@ static int __devinit juli_init(ice1712_t *ice) | |||
182 | ice->num_total_dacs = 2; | 182 | ice->num_total_dacs = 2; |
183 | ice->num_total_adcs = 2; | 183 | ice->num_total_adcs = 2; |
184 | 184 | ||
185 | ak = ice->akm = kcalloc(1, sizeof(akm4xxx_t), GFP_KERNEL); | 185 | ak = ice->akm = kzalloc(sizeof(akm4xxx_t), GFP_KERNEL); |
186 | if (! ak) | 186 | if (! ak) |
187 | return -ENOMEM; | 187 | return -ENOMEM; |
188 | ice->akm_codecs = 1; | 188 | ice->akm_codecs = 1; |
diff --git a/sound/pci/ice1712/phase.c b/sound/pci/ice1712/phase.c index 5bf734b04fa0..dcf1e8ca3f66 100644 --- a/sound/pci/ice1712/phase.c +++ b/sound/pci/ice1712/phase.c | |||
@@ -122,7 +122,7 @@ static int __devinit phase22_init(ice1712_t *ice) | |||
122 | } | 122 | } |
123 | 123 | ||
124 | // Initialize analog chips | 124 | // Initialize analog chips |
125 | ak = ice->akm = kcalloc(1, sizeof(akm4xxx_t), GFP_KERNEL); | 125 | ak = ice->akm = kzalloc(sizeof(akm4xxx_t), GFP_KERNEL); |
126 | if (! ak) | 126 | if (! ak) |
127 | return -ENOMEM; | 127 | return -ENOMEM; |
128 | ice->akm_codecs = 1; | 128 | ice->akm_codecs = 1; |
@@ -386,7 +386,7 @@ static int __devinit phase28_init(ice1712_t *ice) | |||
386 | ice->num_total_adcs = 2; | 386 | ice->num_total_adcs = 2; |
387 | 387 | ||
388 | // Initialize analog chips | 388 | // Initialize analog chips |
389 | ak = ice->akm = kcalloc(1, sizeof(akm4xxx_t), GFP_KERNEL); | 389 | ak = ice->akm = kzalloc(sizeof(akm4xxx_t), GFP_KERNEL); |
390 | if (!ak) | 390 | if (!ak) |
391 | return -ENOMEM; | 391 | return -ENOMEM; |
392 | ice->akm_codecs = 1; | 392 | ice->akm_codecs = 1; |
diff --git a/sound/pci/ice1712/pontis.c b/sound/pci/ice1712/pontis.c index 25f827d8fbd9..a5f852b1f575 100644 --- a/sound/pci/ice1712/pontis.c +++ b/sound/pci/ice1712/pontis.c | |||
@@ -781,7 +781,7 @@ static int __devinit pontis_init(ice1712_t *ice) | |||
781 | ice->num_total_adcs = 2; | 781 | ice->num_total_adcs = 2; |
782 | 782 | ||
783 | /* to remeber the register values */ | 783 | /* to remeber the register values */ |
784 | ice->akm = kcalloc(1, sizeof(akm4xxx_t), GFP_KERNEL); | 784 | ice->akm = kzalloc(sizeof(akm4xxx_t), GFP_KERNEL); |
785 | if (! ice->akm) | 785 | if (! ice->akm) |
786 | return -ENOMEM; | 786 | return -ENOMEM; |
787 | ice->akm_codecs = 1; | 787 | ice->akm_codecs = 1; |
diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c index d7af3e474432..1a96198a17ae 100644 --- a/sound/pci/intel8x0.c +++ b/sound/pci/intel8x0.c | |||
@@ -69,6 +69,7 @@ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ | |||
69 | static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ | 69 | static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ |
70 | static int ac97_clock[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0}; | 70 | static int ac97_clock[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0}; |
71 | static char *ac97_quirk[SNDRV_CARDS]; | 71 | static char *ac97_quirk[SNDRV_CARDS]; |
72 | static int buggy_semaphore[SNDRV_CARDS]; | ||
72 | static int buggy_irq[SNDRV_CARDS]; | 73 | static int buggy_irq[SNDRV_CARDS]; |
73 | static int xbox[SNDRV_CARDS]; | 74 | static int xbox[SNDRV_CARDS]; |
74 | 75 | ||
@@ -86,6 +87,8 @@ module_param_array(ac97_clock, int, NULL, 0444); | |||
86 | MODULE_PARM_DESC(ac97_clock, "AC'97 codec clock (0 = auto-detect)."); | 87 | MODULE_PARM_DESC(ac97_clock, "AC'97 codec clock (0 = auto-detect)."); |
87 | module_param_array(ac97_quirk, charp, NULL, 0444); | 88 | module_param_array(ac97_quirk, charp, NULL, 0444); |
88 | MODULE_PARM_DESC(ac97_quirk, "AC'97 workaround for strange hardware."); | 89 | MODULE_PARM_DESC(ac97_quirk, "AC'97 workaround for strange hardware."); |
90 | module_param_array(buggy_semaphore, bool, NULL, 0444); | ||
91 | MODULE_PARM_DESC(buggy_semaphore, "Enable workaround for hardwares with problematic codec semaphores."); | ||
89 | module_param_array(buggy_irq, bool, NULL, 0444); | 92 | module_param_array(buggy_irq, bool, NULL, 0444); |
90 | MODULE_PARM_DESC(buggy_irq, "Enable workaround for buggy interrupts on some motherboards."); | 93 | MODULE_PARM_DESC(buggy_irq, "Enable workaround for buggy interrupts on some motherboards."); |
91 | module_param_array(xbox, bool, NULL, 0444); | 94 | module_param_array(xbox, bool, NULL, 0444); |
@@ -94,62 +97,6 @@ MODULE_PARM_DESC(xbox, "Set to 1 for Xbox, if you have problems with the AC'97 c | |||
94 | /* | 97 | /* |
95 | * Direct registers | 98 | * Direct registers |
96 | */ | 99 | */ |
97 | |||
98 | #ifndef PCI_DEVICE_ID_INTEL_82801 | ||
99 | #define PCI_DEVICE_ID_INTEL_82801 0x2415 | ||
100 | #endif | ||
101 | #ifndef PCI_DEVICE_ID_INTEL_82901 | ||
102 | #define PCI_DEVICE_ID_INTEL_82901 0x2425 | ||
103 | #endif | ||
104 | #ifndef PCI_DEVICE_ID_INTEL_82801BA | ||
105 | #define PCI_DEVICE_ID_INTEL_82801BA 0x2445 | ||
106 | #endif | ||
107 | #ifndef PCI_DEVICE_ID_INTEL_440MX | ||
108 | #define PCI_DEVICE_ID_INTEL_440MX 0x7195 | ||
109 | #endif | ||
110 | #ifndef PCI_DEVICE_ID_INTEL_ICH3 | ||
111 | #define PCI_DEVICE_ID_INTEL_ICH3 0x2485 | ||
112 | #endif | ||
113 | #ifndef PCI_DEVICE_ID_INTEL_ICH4 | ||
114 | #define PCI_DEVICE_ID_INTEL_ICH4 0x24c5 | ||
115 | #endif | ||
116 | #ifndef PCI_DEVICE_ID_INTEL_ICH5 | ||
117 | #define PCI_DEVICE_ID_INTEL_ICH5 0x24d5 | ||
118 | #endif | ||
119 | #ifndef PCI_DEVICE_ID_INTEL_ESB_5 | ||
120 | #define PCI_DEVICE_ID_INTEL_ESB_5 0x25a6 | ||
121 | #endif | ||
122 | #ifndef PCI_DEVICE_ID_INTEL_ICH6_18 | ||
123 | #define PCI_DEVICE_ID_INTEL_ICH6_18 0x266e | ||
124 | #endif | ||
125 | #ifndef PCI_DEVICE_ID_INTEL_ICH7_20 | ||
126 | #define PCI_DEVICE_ID_INTEL_ICH7_20 0x27de | ||
127 | #endif | ||
128 | #ifndef PCI_DEVICE_ID_INTEL_ESB2_14 | ||
129 | #define PCI_DEVICE_ID_INTEL_ESB2_14 0x2698 | ||
130 | #endif | ||
131 | #ifndef PCI_DEVICE_ID_SI_7012 | ||
132 | #define PCI_DEVICE_ID_SI_7012 0x7012 | ||
133 | #endif | ||
134 | #ifndef PCI_DEVICE_ID_NVIDIA_MCP_AUDIO | ||
135 | #define PCI_DEVICE_ID_NVIDIA_MCP_AUDIO 0x01b1 | ||
136 | #endif | ||
137 | #ifndef PCI_DEVICE_ID_NVIDIA_CK804_AUDIO | ||
138 | #define PCI_DEVICE_ID_NVIDIA_CK804_AUDIO 0x0059 | ||
139 | #endif | ||
140 | #ifndef PCI_DEVICE_ID_NVIDIA_MCP2_AUDIO | ||
141 | #define PCI_DEVICE_ID_NVIDIA_MCP2_AUDIO 0x006a | ||
142 | #endif | ||
143 | #ifndef PCI_DEVICE_ID_NVIDIA_CK8_AUDIO | ||
144 | #define PCI_DEVICE_ID_NVIDIA_CK8_AUDIO 0x008a | ||
145 | #endif | ||
146 | #ifndef PCI_DEVICE_ID_NVIDIA_MCP3_AUDIO | ||
147 | #define PCI_DEVICE_ID_NVIDIA_MCP3_AUDIO 0x00da | ||
148 | #endif | ||
149 | #ifndef PCI_DEVICE_ID_NVIDIA_CK8S_AUDIO | ||
150 | #define PCI_DEVICE_ID_NVIDIA_CK8S_AUDIO 0x00ea | ||
151 | #endif | ||
152 | |||
153 | enum { DEVICE_INTEL, DEVICE_INTEL_ICH4, DEVICE_SIS, DEVICE_ALI, DEVICE_NFORCE }; | 100 | enum { DEVICE_INTEL, DEVICE_INTEL_ICH4, DEVICE_SIS, DEVICE_ALI, DEVICE_NFORCE }; |
154 | 101 | ||
155 | #define ICHREG(x) ICH_REG_##x | 102 | #define ICHREG(x) ICH_REG_##x |
@@ -389,6 +336,7 @@ typedef struct { | |||
389 | struct ac97_pcm *pcm; | 336 | struct ac97_pcm *pcm; |
390 | int pcm_open_flag; | 337 | int pcm_open_flag; |
391 | unsigned int page_attr_changed: 1; | 338 | unsigned int page_attr_changed: 1; |
339 | unsigned int suspended: 1; | ||
392 | } ichdev_t; | 340 | } ichdev_t; |
393 | 341 | ||
394 | typedef struct _snd_intel8x0 intel8x0_t; | 342 | typedef struct _snd_intel8x0 intel8x0_t; |
@@ -422,6 +370,7 @@ struct _snd_intel8x0 { | |||
422 | unsigned fix_nocache: 1; /* workaround for 440MX */ | 370 | unsigned fix_nocache: 1; /* workaround for 440MX */ |
423 | unsigned buggy_irq: 1; /* workaround for buggy mobos */ | 371 | unsigned buggy_irq: 1; /* workaround for buggy mobos */ |
424 | unsigned xbox: 1; /* workaround for Xbox AC'97 detection */ | 372 | unsigned xbox: 1; /* workaround for Xbox AC'97 detection */ |
373 | unsigned buggy_semaphore: 1; /* workaround for buggy codec semaphore */ | ||
425 | 374 | ||
426 | int spdif_idx; /* SPDIF BAR index; *_SPBAR or -1 if use PCMOUT */ | 375 | int spdif_idx; /* SPDIF BAR index; *_SPBAR or -1 if use PCMOUT */ |
427 | unsigned int sdm_saved; /* SDM reg value */ | 376 | unsigned int sdm_saved; /* SDM reg value */ |
@@ -576,6 +525,9 @@ static int snd_intel8x0_codec_semaphore(intel8x0_t *chip, unsigned int codec) | |||
576 | if ((igetdword(chip, ICHREG(GLOB_STA)) & codec) == 0) | 525 | if ((igetdword(chip, ICHREG(GLOB_STA)) & codec) == 0) |
577 | return -EIO; | 526 | return -EIO; |
578 | 527 | ||
528 | if (chip->buggy_semaphore) | ||
529 | return 0; /* just ignore ... */ | ||
530 | |||
579 | /* Anyone holding a semaphore for 1 msec should be shot... */ | 531 | /* Anyone holding a semaphore for 1 msec should be shot... */ |
580 | time = 100; | 532 | time = 100; |
581 | do { | 533 | do { |
@@ -862,12 +814,16 @@ static int snd_intel8x0_pcm_trigger(snd_pcm_substream_t *substream, int cmd) | |||
862 | unsigned long port = ichdev->reg_offset; | 814 | unsigned long port = ichdev->reg_offset; |
863 | 815 | ||
864 | switch (cmd) { | 816 | switch (cmd) { |
865 | case SNDRV_PCM_TRIGGER_START: | ||
866 | case SNDRV_PCM_TRIGGER_RESUME: | 817 | case SNDRV_PCM_TRIGGER_RESUME: |
818 | ichdev->suspended = 0; | ||
819 | /* fallthru */ | ||
820 | case SNDRV_PCM_TRIGGER_START: | ||
867 | val = ICH_IOCE | ICH_STARTBM; | 821 | val = ICH_IOCE | ICH_STARTBM; |
868 | break; | 822 | break; |
869 | case SNDRV_PCM_TRIGGER_STOP: | ||
870 | case SNDRV_PCM_TRIGGER_SUSPEND: | 823 | case SNDRV_PCM_TRIGGER_SUSPEND: |
824 | ichdev->suspended = 1; | ||
825 | /* fallthru */ | ||
826 | case SNDRV_PCM_TRIGGER_STOP: | ||
871 | val = 0; | 827 | val = 0; |
872 | break; | 828 | break; |
873 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: | 829 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: |
@@ -899,9 +855,11 @@ static int snd_intel8x0_ali_trigger(snd_pcm_substream_t *substream, int cmd) | |||
899 | 855 | ||
900 | val = igetdword(chip, ICHREG(ALI_DMACR)); | 856 | val = igetdword(chip, ICHREG(ALI_DMACR)); |
901 | switch (cmd) { | 857 | switch (cmd) { |
858 | case SNDRV_PCM_TRIGGER_RESUME: | ||
859 | ichdev->suspended = 0; | ||
860 | /* fallthru */ | ||
902 | case SNDRV_PCM_TRIGGER_START: | 861 | case SNDRV_PCM_TRIGGER_START: |
903 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: | 862 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: |
904 | case SNDRV_PCM_TRIGGER_RESUME: | ||
905 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { | 863 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { |
906 | /* clear FIFO for synchronization of channels */ | 864 | /* clear FIFO for synchronization of channels */ |
907 | fifo = igetdword(chip, fiforeg[ichdev->ali_slot / 4]); | 865 | fifo = igetdword(chip, fiforeg[ichdev->ali_slot / 4]); |
@@ -913,9 +871,11 @@ static int snd_intel8x0_ali_trigger(snd_pcm_substream_t *substream, int cmd) | |||
913 | val &= ~(1 << (ichdev->ali_slot + 16)); /* clear PAUSE flag */ | 871 | val &= ~(1 << (ichdev->ali_slot + 16)); /* clear PAUSE flag */ |
914 | iputdword(chip, ICHREG(ALI_DMACR), val | (1 << ichdev->ali_slot)); /* start DMA */ | 872 | iputdword(chip, ICHREG(ALI_DMACR), val | (1 << ichdev->ali_slot)); /* start DMA */ |
915 | break; | 873 | break; |
874 | case SNDRV_PCM_TRIGGER_SUSPEND: | ||
875 | ichdev->suspended = 1; | ||
876 | /* fallthru */ | ||
916 | case SNDRV_PCM_TRIGGER_STOP: | 877 | case SNDRV_PCM_TRIGGER_STOP: |
917 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: | 878 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: |
918 | case SNDRV_PCM_TRIGGER_SUSPEND: | ||
919 | iputdword(chip, ICHREG(ALI_DMACR), val | (1 << (ichdev->ali_slot + 16))); /* pause */ | 879 | iputdword(chip, ICHREG(ALI_DMACR), val | (1 << (ichdev->ali_slot + 16))); /* pause */ |
920 | iputbyte(chip, port + ICH_REG_OFF_CR, 0); | 880 | iputbyte(chip, port + ICH_REG_OFF_CR, 0); |
921 | while (igetbyte(chip, port + ICH_REG_OFF_CR)) | 881 | while (igetbyte(chip, port + ICH_REG_OFF_CR)) |
@@ -994,6 +954,8 @@ static void snd_intel8x0_setup_pcm_out(intel8x0_t *chip, | |||
994 | { | 954 | { |
995 | unsigned int cnt; | 955 | unsigned int cnt; |
996 | int dbl = runtime->rate > 48000; | 956 | int dbl = runtime->rate > 48000; |
957 | |||
958 | spin_lock_irq(&chip->reg_lock); | ||
997 | switch (chip->device_type) { | 959 | switch (chip->device_type) { |
998 | case DEVICE_ALI: | 960 | case DEVICE_ALI: |
999 | cnt = igetdword(chip, ICHREG(ALI_SCR)); | 961 | cnt = igetdword(chip, ICHREG(ALI_SCR)); |
@@ -1037,6 +999,7 @@ static void snd_intel8x0_setup_pcm_out(intel8x0_t *chip, | |||
1037 | iputdword(chip, ICHREG(GLOB_CNT), cnt); | 999 | iputdword(chip, ICHREG(GLOB_CNT), cnt); |
1038 | break; | 1000 | break; |
1039 | } | 1001 | } |
1002 | spin_unlock_irq(&chip->reg_lock); | ||
1040 | } | 1003 | } |
1041 | 1004 | ||
1042 | static int snd_intel8x0_pcm_prepare(snd_pcm_substream_t * substream) | 1005 | static int snd_intel8x0_pcm_prepare(snd_pcm_substream_t * substream) |
@@ -1048,15 +1011,12 @@ static int snd_intel8x0_pcm_prepare(snd_pcm_substream_t * substream) | |||
1048 | ichdev->physbuf = runtime->dma_addr; | 1011 | ichdev->physbuf = runtime->dma_addr; |
1049 | ichdev->size = snd_pcm_lib_buffer_bytes(substream); | 1012 | ichdev->size = snd_pcm_lib_buffer_bytes(substream); |
1050 | ichdev->fragsize = snd_pcm_lib_period_bytes(substream); | 1013 | ichdev->fragsize = snd_pcm_lib_period_bytes(substream); |
1051 | spin_lock_irq(&chip->reg_lock); | ||
1052 | if (ichdev->ichd == ICHD_PCMOUT) { | 1014 | if (ichdev->ichd == ICHD_PCMOUT) { |
1053 | snd_intel8x0_setup_pcm_out(chip, runtime); | 1015 | snd_intel8x0_setup_pcm_out(chip, runtime); |
1054 | if (chip->device_type == DEVICE_INTEL_ICH4) { | 1016 | if (chip->device_type == DEVICE_INTEL_ICH4) |
1055 | ichdev->pos_shift = (runtime->sample_bits > 16) ? 2 : 1; | 1017 | ichdev->pos_shift = (runtime->sample_bits > 16) ? 2 : 1; |
1056 | } | ||
1057 | } | 1018 | } |
1058 | snd_intel8x0_setup_periods(chip, ichdev); | 1019 | snd_intel8x0_setup_periods(chip, ichdev); |
1059 | spin_unlock_irq(&chip->reg_lock); | ||
1060 | return 0; | 1020 | return 0; |
1061 | } | 1021 | } |
1062 | 1022 | ||
@@ -1750,6 +1710,12 @@ static struct ac97_quirk ac97_quirks[] __devinitdata = { | |||
1750 | .type = AC97_TUNE_ALC_JACK | 1710 | .type = AC97_TUNE_ALC_JACK |
1751 | }, | 1711 | }, |
1752 | { | 1712 | { |
1713 | .subvendor = 0x1014, | ||
1714 | .subdevice = 0x0267, | ||
1715 | .name = "IBM NetVista A30p", /* AD1981B */ | ||
1716 | .type = AC97_TUNE_HP_ONLY | ||
1717 | }, | ||
1718 | { | ||
1753 | .subvendor = 0x1028, | 1719 | .subvendor = 0x1028, |
1754 | .subdevice = 0x00d8, | 1720 | .subdevice = 0x00d8, |
1755 | .name = "Dell Precision 530", /* AD1885 */ | 1721 | .name = "Dell Precision 530", /* AD1885 */ |
@@ -1817,6 +1783,18 @@ static struct ac97_quirk ac97_quirks[] __devinitdata = { | |||
1817 | }, | 1783 | }, |
1818 | { | 1784 | { |
1819 | .subvendor = 0x103c, | 1785 | .subvendor = 0x103c, |
1786 | .subdevice = 0x0934, | ||
1787 | .name = "HP nx8220", | ||
1788 | .type = AC97_TUNE_MUTE_LED | ||
1789 | }, | ||
1790 | { | ||
1791 | .subvendor = 0x103c, | ||
1792 | .subdevice = 0x099c, | ||
1793 | .name = "HP nx6110", /* AD1981B */ | ||
1794 | .type = AC97_TUNE_HP_ONLY | ||
1795 | }, | ||
1796 | { | ||
1797 | .subvendor = 0x103c, | ||
1820 | .subdevice = 0x129d, | 1798 | .subdevice = 0x129d, |
1821 | .name = "HP xw8000", | 1799 | .name = "HP xw8000", |
1822 | .type = AC97_TUNE_HP_ONLY | 1800 | .type = AC97_TUNE_HP_ONLY |
@@ -1870,6 +1848,12 @@ static struct ac97_quirk ac97_quirks[] __devinitdata = { | |||
1870 | .type = AC97_TUNE_HP_ONLY | 1848 | .type = AC97_TUNE_HP_ONLY |
1871 | }, | 1849 | }, |
1872 | { | 1850 | { |
1851 | .subvendor = 0x10cf, | ||
1852 | .subdevice = 0x12ec, | ||
1853 | .name = "Fujitsu-Siemens 4010", | ||
1854 | .type = AC97_TUNE_HP_ONLY | ||
1855 | }, | ||
1856 | { | ||
1873 | .subvendor = 0x10f1, | 1857 | .subvendor = 0x10f1, |
1874 | .subdevice = 0x2665, | 1858 | .subdevice = 0x2665, |
1875 | .name = "Fujitsu-Siemens Celsius", /* AD1981? */ | 1859 | .name = "Fujitsu-Siemens Celsius", /* AD1981? */ |
@@ -2424,6 +2408,20 @@ static int intel8x0_resume(snd_card_t *card) | |||
2424 | } | 2408 | } |
2425 | } | 2409 | } |
2426 | 2410 | ||
2411 | /* resume status */ | ||
2412 | for (i = 0; i < chip->bdbars_count; i++) { | ||
2413 | ichdev_t *ichdev = &chip->ichd[i]; | ||
2414 | unsigned long port = ichdev->reg_offset; | ||
2415 | if (! ichdev->substream || ! ichdev->suspended) | ||
2416 | continue; | ||
2417 | if (ichdev->ichd == ICHD_PCMOUT) | ||
2418 | snd_intel8x0_setup_pcm_out(chip, ichdev->substream->runtime); | ||
2419 | iputdword(chip, port + ICH_REG_OFF_BDBAR, ichdev->bdbar_addr); | ||
2420 | iputbyte(chip, port + ICH_REG_OFF_LVI, ichdev->lvi); | ||
2421 | iputbyte(chip, port + ICH_REG_OFF_CIV, ichdev->civ); | ||
2422 | iputbyte(chip, port + ichdev->roff_sr, ICH_FIFOE | ICH_BCIS | ICH_LVBCI); | ||
2423 | } | ||
2424 | |||
2427 | return 0; | 2425 | return 0; |
2428 | } | 2426 | } |
2429 | #endif /* CONFIG_PM */ | 2427 | #endif /* CONFIG_PM */ |
@@ -2558,6 +2556,7 @@ struct ich_reg_info { | |||
2558 | static int __devinit snd_intel8x0_create(snd_card_t * card, | 2556 | static int __devinit snd_intel8x0_create(snd_card_t * card, |
2559 | struct pci_dev *pci, | 2557 | struct pci_dev *pci, |
2560 | unsigned long device_type, | 2558 | unsigned long device_type, |
2559 | int buggy_sem, | ||
2561 | intel8x0_t ** r_intel8x0) | 2560 | intel8x0_t ** r_intel8x0) |
2562 | { | 2561 | { |
2563 | intel8x0_t *chip; | 2562 | intel8x0_t *chip; |
@@ -2605,7 +2604,7 @@ static int __devinit snd_intel8x0_create(snd_card_t * card, | |||
2605 | if ((err = pci_enable_device(pci)) < 0) | 2604 | if ((err = pci_enable_device(pci)) < 0) |
2606 | return err; | 2605 | return err; |
2607 | 2606 | ||
2608 | chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); | 2607 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); |
2609 | if (chip == NULL) { | 2608 | if (chip == NULL) { |
2610 | pci_disable_device(pci); | 2609 | pci_disable_device(pci); |
2611 | return -ENOMEM; | 2610 | return -ENOMEM; |
@@ -2615,6 +2614,7 @@ static int __devinit snd_intel8x0_create(snd_card_t * card, | |||
2615 | chip->card = card; | 2614 | chip->card = card; |
2616 | chip->pci = pci; | 2615 | chip->pci = pci; |
2617 | chip->irq = -1; | 2616 | chip->irq = -1; |
2617 | chip->buggy_semaphore = buggy_sem; | ||
2618 | 2618 | ||
2619 | if (pci->vendor == PCI_VENDOR_ID_INTEL && | 2619 | if (pci->vendor == PCI_VENDOR_ID_INTEL && |
2620 | pci->device == PCI_DEVICE_ID_INTEL_440MX) | 2620 | pci->device == PCI_DEVICE_ID_INTEL_440MX) |
@@ -2754,19 +2754,19 @@ static struct shortname_table { | |||
2754 | unsigned int id; | 2754 | unsigned int id; |
2755 | const char *s; | 2755 | const char *s; |
2756 | } shortnames[] __devinitdata = { | 2756 | } shortnames[] __devinitdata = { |
2757 | { PCI_DEVICE_ID_INTEL_82801, "Intel 82801AA-ICH" }, | 2757 | { PCI_DEVICE_ID_INTEL_82801AA_5, "Intel 82801AA-ICH" }, |
2758 | { PCI_DEVICE_ID_INTEL_82901, "Intel 82901AB-ICH0" }, | 2758 | { PCI_DEVICE_ID_INTEL_82801AB_5, "Intel 82901AB-ICH0" }, |
2759 | { PCI_DEVICE_ID_INTEL_82801BA, "Intel 82801BA-ICH2" }, | 2759 | { PCI_DEVICE_ID_INTEL_82801BA_4, "Intel 82801BA-ICH2" }, |
2760 | { PCI_DEVICE_ID_INTEL_440MX, "Intel 440MX" }, | 2760 | { PCI_DEVICE_ID_INTEL_440MX, "Intel 440MX" }, |
2761 | { PCI_DEVICE_ID_INTEL_ICH3, "Intel 82801CA-ICH3" }, | 2761 | { PCI_DEVICE_ID_INTEL_82801CA_5, "Intel 82801CA-ICH3" }, |
2762 | { PCI_DEVICE_ID_INTEL_ICH4, "Intel 82801DB-ICH4" }, | 2762 | { PCI_DEVICE_ID_INTEL_82801DB_5, "Intel 82801DB-ICH4" }, |
2763 | { PCI_DEVICE_ID_INTEL_ICH5, "Intel ICH5" }, | 2763 | { PCI_DEVICE_ID_INTEL_82801EB_5, "Intel ICH5" }, |
2764 | { PCI_DEVICE_ID_INTEL_ESB_5, "Intel 6300ESB" }, | 2764 | { PCI_DEVICE_ID_INTEL_ESB_5, "Intel 6300ESB" }, |
2765 | { PCI_DEVICE_ID_INTEL_ICH6_18, "Intel ICH6" }, | 2765 | { PCI_DEVICE_ID_INTEL_ICH6_18, "Intel ICH6" }, |
2766 | { PCI_DEVICE_ID_INTEL_ICH7_20, "Intel ICH7" }, | 2766 | { PCI_DEVICE_ID_INTEL_ICH7_20, "Intel ICH7" }, |
2767 | { PCI_DEVICE_ID_INTEL_ESB2_14, "Intel ESB2" }, | 2767 | { PCI_DEVICE_ID_INTEL_ESB2_14, "Intel ESB2" }, |
2768 | { PCI_DEVICE_ID_SI_7012, "SiS SI7012" }, | 2768 | { PCI_DEVICE_ID_SI_7012, "SiS SI7012" }, |
2769 | { PCI_DEVICE_ID_NVIDIA_MCP_AUDIO, "NVidia nForce" }, | 2769 | { PCI_DEVICE_ID_NVIDIA_MCP1_AUDIO, "NVidia nForce" }, |
2770 | { PCI_DEVICE_ID_NVIDIA_MCP2_AUDIO, "NVidia nForce2" }, | 2770 | { PCI_DEVICE_ID_NVIDIA_MCP2_AUDIO, "NVidia nForce2" }, |
2771 | { PCI_DEVICE_ID_NVIDIA_MCP3_AUDIO, "NVidia nForce3" }, | 2771 | { PCI_DEVICE_ID_NVIDIA_MCP3_AUDIO, "NVidia nForce3" }, |
2772 | { PCI_DEVICE_ID_NVIDIA_CK8S_AUDIO, "NVidia CK8S" }, | 2772 | { PCI_DEVICE_ID_NVIDIA_CK8S_AUDIO, "NVidia CK8S" }, |
@@ -2819,7 +2819,8 @@ static int __devinit snd_intel8x0_probe(struct pci_dev *pci, | |||
2819 | } | 2819 | } |
2820 | } | 2820 | } |
2821 | 2821 | ||
2822 | if ((err = snd_intel8x0_create(card, pci, pci_id->driver_data, &chip)) < 0) { | 2822 | if ((err = snd_intel8x0_create(card, pci, pci_id->driver_data, |
2823 | buggy_semaphore[dev], &chip)) < 0) { | ||
2823 | snd_card_free(card); | 2824 | snd_card_free(card); |
2824 | return err; | 2825 | return err; |
2825 | } | 2826 | } |
@@ -2863,6 +2864,7 @@ static void __devexit snd_intel8x0_remove(struct pci_dev *pci) | |||
2863 | 2864 | ||
2864 | static struct pci_driver driver = { | 2865 | static struct pci_driver driver = { |
2865 | .name = "Intel ICH", | 2866 | .name = "Intel ICH", |
2867 | .owner = THIS_MODULE, | ||
2866 | .id_table = snd_intel8x0_ids, | 2868 | .id_table = snd_intel8x0_ids, |
2867 | .probe = snd_intel8x0_probe, | 2869 | .probe = snd_intel8x0_probe, |
2868 | .remove = __devexit_p(snd_intel8x0_remove), | 2870 | .remove = __devexit_p(snd_intel8x0_remove), |
diff --git a/sound/pci/intel8x0m.c b/sound/pci/intel8x0m.c index bb758c77d211..9e2060d56c24 100644 --- a/sound/pci/intel8x0m.c +++ b/sound/pci/intel8x0m.c | |||
@@ -73,51 +73,6 @@ MODULE_PARM_DESC(ac97_clock, "AC'97 codec clock (0 = auto-detect)."); | |||
73 | /* | 73 | /* |
74 | * Direct registers | 74 | * Direct registers |
75 | */ | 75 | */ |
76 | |||
77 | #ifndef PCI_DEVICE_ID_INTEL_82801_6 | ||
78 | #define PCI_DEVICE_ID_INTEL_82801_6 0x2416 | ||
79 | #endif | ||
80 | #ifndef PCI_DEVICE_ID_INTEL_82901_6 | ||
81 | #define PCI_DEVICE_ID_INTEL_82901_6 0x2426 | ||
82 | #endif | ||
83 | #ifndef PCI_DEVICE_ID_INTEL_82801BA_6 | ||
84 | #define PCI_DEVICE_ID_INTEL_82801BA_6 0x2446 | ||
85 | #endif | ||
86 | #ifndef PCI_DEVICE_ID_INTEL_440MX_6 | ||
87 | #define PCI_DEVICE_ID_INTEL_440MX_6 0x7196 | ||
88 | #endif | ||
89 | #ifndef PCI_DEVICE_ID_INTEL_ICH3_6 | ||
90 | #define PCI_DEVICE_ID_INTEL_ICH3_6 0x2486 | ||
91 | #endif | ||
92 | #ifndef PCI_DEVICE_ID_INTEL_ICH4_6 | ||
93 | #define PCI_DEVICE_ID_INTEL_ICH4_6 0x24c6 | ||
94 | #endif | ||
95 | #ifndef PCI_DEVICE_ID_INTEL_ICH5_6 | ||
96 | #define PCI_DEVICE_ID_INTEL_ICH5_6 0x24d6 | ||
97 | #endif | ||
98 | #ifndef PCI_DEVICE_ID_INTEL_ICH6_6 | ||
99 | #define PCI_DEVICE_ID_INTEL_ICH6_6 0x266d | ||
100 | #endif | ||
101 | #ifndef PCI_DEVICE_ID_INTEL_ICH7_6 | ||
102 | #define PCI_DEVICE_ID_INTEL_ICH7_6 0x27dd | ||
103 | #endif | ||
104 | #ifndef PCI_DEVICE_ID_SI_7013 | ||
105 | #define PCI_DEVICE_ID_SI_7013 0x7013 | ||
106 | #endif | ||
107 | #ifndef PCI_DEVICE_ID_NVIDIA_MCP_MODEM | ||
108 | #define PCI_DEVICE_ID_NVIDIA_MCP_MODEM 0x01c1 | ||
109 | #endif | ||
110 | #ifndef PCI_DEVICE_ID_NVIDIA_MCP2_MODEM | ||
111 | #define PCI_DEVICE_ID_NVIDIA_MCP2_MODEM 0x0069 | ||
112 | #endif | ||
113 | #ifndef PCI_DEVICE_ID_NVIDIA_MCP2S_MODEM | ||
114 | #define PCI_DEVICE_ID_NVIDIA_MCP2S_MODEM 0x0089 | ||
115 | #endif | ||
116 | #ifndef PCI_DEVICE_ID_NVIDIA_MCP3_MODEM | ||
117 | #define PCI_DEVICE_ID_NVIDIA_MCP3_MODEM 0x00d9 | ||
118 | #endif | ||
119 | |||
120 | |||
121 | enum { DEVICE_INTEL, DEVICE_SIS, DEVICE_ALI, DEVICE_NFORCE }; | 76 | enum { DEVICE_INTEL, DEVICE_SIS, DEVICE_ALI, DEVICE_NFORCE }; |
122 | 77 | ||
123 | #define ICHREG(x) ICH_REG_##x | 78 | #define ICHREG(x) ICH_REG_##x |
@@ -1158,7 +1113,7 @@ static int __devinit snd_intel8x0m_create(snd_card_t * card, | |||
1158 | if ((err = pci_enable_device(pci)) < 0) | 1113 | if ((err = pci_enable_device(pci)) < 0) |
1159 | return err; | 1114 | return err; |
1160 | 1115 | ||
1161 | chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); | 1116 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); |
1162 | if (chip == NULL) { | 1117 | if (chip == NULL) { |
1163 | pci_disable_device(pci); | 1118 | pci_disable_device(pci); |
1164 | return -ENOMEM; | 1119 | return -ENOMEM; |
@@ -1283,18 +1238,18 @@ static struct shortname_table { | |||
1283 | unsigned int id; | 1238 | unsigned int id; |
1284 | const char *s; | 1239 | const char *s; |
1285 | } shortnames[] __devinitdata = { | 1240 | } shortnames[] __devinitdata = { |
1286 | { PCI_DEVICE_ID_INTEL_82801_6, "Intel 82801AA-ICH" }, | 1241 | { PCI_DEVICE_ID_INTEL_82801AA_6, "Intel 82801AA-ICH" }, |
1287 | { PCI_DEVICE_ID_INTEL_82901_6, "Intel 82901AB-ICH0" }, | 1242 | { PCI_DEVICE_ID_INTEL_82801AB_6, "Intel 82901AB-ICH0" }, |
1288 | { PCI_DEVICE_ID_INTEL_82801BA_6, "Intel 82801BA-ICH2" }, | 1243 | { PCI_DEVICE_ID_INTEL_82801BA_6, "Intel 82801BA-ICH2" }, |
1289 | { PCI_DEVICE_ID_INTEL_440MX_6, "Intel 440MX" }, | 1244 | { PCI_DEVICE_ID_INTEL_440MX_6, "Intel 440MX" }, |
1290 | { PCI_DEVICE_ID_INTEL_ICH3_6, "Intel 82801CA-ICH3" }, | 1245 | { PCI_DEVICE_ID_INTEL_82801CA_6, "Intel 82801CA-ICH3" }, |
1291 | { PCI_DEVICE_ID_INTEL_ICH4_6, "Intel 82801DB-ICH4" }, | 1246 | { PCI_DEVICE_ID_INTEL_82801DB_6, "Intel 82801DB-ICH4" }, |
1292 | { PCI_DEVICE_ID_INTEL_ICH5_6, "Intel ICH5" }, | 1247 | { PCI_DEVICE_ID_INTEL_82801EB_6, "Intel ICH5" }, |
1293 | { PCI_DEVICE_ID_INTEL_ICH6_6, "Intel ICH6" }, | 1248 | { PCI_DEVICE_ID_INTEL_ICH6_17, "Intel ICH6" }, |
1294 | { PCI_DEVICE_ID_INTEL_ICH7_6, "Intel ICH7" }, | 1249 | { PCI_DEVICE_ID_INTEL_ICH7_19, "Intel ICH7" }, |
1295 | { 0x7446, "AMD AMD768" }, | 1250 | { 0x7446, "AMD AMD768" }, |
1296 | { PCI_DEVICE_ID_SI_7013, "SiS SI7013" }, | 1251 | { PCI_DEVICE_ID_SI_7013, "SiS SI7013" }, |
1297 | { PCI_DEVICE_ID_NVIDIA_MCP_MODEM, "NVidia nForce" }, | 1252 | { PCI_DEVICE_ID_NVIDIA_MCP1_MODEM, "NVidia nForce" }, |
1298 | { PCI_DEVICE_ID_NVIDIA_MCP2_MODEM, "NVidia nForce2" }, | 1253 | { PCI_DEVICE_ID_NVIDIA_MCP2_MODEM, "NVidia nForce2" }, |
1299 | { PCI_DEVICE_ID_NVIDIA_MCP2S_MODEM, "NVidia nForce2s" }, | 1254 | { PCI_DEVICE_ID_NVIDIA_MCP2S_MODEM, "NVidia nForce2s" }, |
1300 | { PCI_DEVICE_ID_NVIDIA_MCP3_MODEM, "NVidia nForce3" }, | 1255 | { PCI_DEVICE_ID_NVIDIA_MCP3_MODEM, "NVidia nForce3" }, |
@@ -1371,6 +1326,7 @@ static void __devexit snd_intel8x0m_remove(struct pci_dev *pci) | |||
1371 | 1326 | ||
1372 | static struct pci_driver driver = { | 1327 | static struct pci_driver driver = { |
1373 | .name = "Intel ICH Modem", | 1328 | .name = "Intel ICH Modem", |
1329 | .owner = THIS_MODULE, | ||
1374 | .id_table = snd_intel8x0m_ids, | 1330 | .id_table = snd_intel8x0m_ids, |
1375 | .probe = snd_intel8x0m_probe, | 1331 | .probe = snd_intel8x0m_probe, |
1376 | .remove = __devexit_p(snd_intel8x0m_remove), | 1332 | .remove = __devexit_p(snd_intel8x0m_remove), |
diff --git a/sound/pci/korg1212/korg1212.c b/sound/pci/korg1212/korg1212.c index 79d8eda54f0d..5561fd4091e8 100644 --- a/sound/pci/korg1212/korg1212.c +++ b/sound/pci/korg1212/korg1212.c | |||
@@ -442,7 +442,7 @@ static char* stateName[] = { | |||
442 | "Setup for play", | 442 | "Setup for play", |
443 | "Playing", | 443 | "Playing", |
444 | "Monitor mode on", | 444 | "Monitor mode on", |
445 | "Calibrating" | 445 | "Calibrating", |
446 | "Invalid" | 446 | "Invalid" |
447 | }; | 447 | }; |
448 | 448 | ||
@@ -2067,7 +2067,7 @@ static int snd_korg1212_control_sync_put(snd_kcontrol_t * kcontrol, snd_ctl_elem | |||
2067 | }, \ | 2067 | }, \ |
2068 | { \ | 2068 | { \ |
2069 | .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_WRITE, \ | 2069 | .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_WRITE, \ |
2070 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, \ | 2070 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
2071 | .name = c_name " Monitor Phase Invert", \ | 2071 | .name = c_name " Monitor Phase Invert", \ |
2072 | .info = snd_korg1212_control_phase_info, \ | 2072 | .info = snd_korg1212_control_phase_info, \ |
2073 | .get = snd_korg1212_control_phase_get, \ | 2073 | .get = snd_korg1212_control_phase_get, \ |
@@ -2082,7 +2082,7 @@ static snd_kcontrol_new_t snd_korg1212_controls[] = { | |||
2082 | MON_MIXER(4, "ADAT-5"), MON_MIXER(5, "ADAT-6"), MON_MIXER(6, "ADAT-7"), MON_MIXER(7, "ADAT-8"), | 2082 | MON_MIXER(4, "ADAT-5"), MON_MIXER(5, "ADAT-6"), MON_MIXER(6, "ADAT-7"), MON_MIXER(7, "ADAT-8"), |
2083 | { | 2083 | { |
2084 | .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_WRITE, | 2084 | .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_WRITE, |
2085 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, | 2085 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
2086 | .name = "Sync Source", | 2086 | .name = "Sync Source", |
2087 | .info = snd_korg1212_control_sync_info, | 2087 | .info = snd_korg1212_control_sync_info, |
2088 | .get = snd_korg1212_control_sync_get, | 2088 | .get = snd_korg1212_control_sync_get, |
@@ -2220,7 +2220,7 @@ static int __devinit snd_korg1212_create(snd_card_t * card, struct pci_dev *pci, | |||
2220 | if ((err = pci_enable_device(pci)) < 0) | 2220 | if ((err = pci_enable_device(pci)) < 0) |
2221 | return err; | 2221 | return err; |
2222 | 2222 | ||
2223 | korg1212 = kcalloc(1, sizeof(*korg1212), GFP_KERNEL); | 2223 | korg1212 = kzalloc(sizeof(*korg1212), GFP_KERNEL); |
2224 | if (korg1212 == NULL) { | 2224 | if (korg1212 == NULL) { |
2225 | pci_disable_device(pci); | 2225 | pci_disable_device(pci); |
2226 | return -ENOMEM; | 2226 | return -ENOMEM; |
@@ -2534,6 +2534,7 @@ static void __devexit snd_korg1212_remove(struct pci_dev *pci) | |||
2534 | 2534 | ||
2535 | static struct pci_driver driver = { | 2535 | static struct pci_driver driver = { |
2536 | .name = "korg1212", | 2536 | .name = "korg1212", |
2537 | .owner = THIS_MODULE, | ||
2537 | .id_table = snd_korg1212_ids, | 2538 | .id_table = snd_korg1212_ids, |
2538 | .probe = snd_korg1212_probe, | 2539 | .probe = snd_korg1212_probe, |
2539 | .remove = __devexit_p(snd_korg1212_remove), | 2540 | .remove = __devexit_p(snd_korg1212_remove), |
diff --git a/sound/pci/maestro3.c b/sound/pci/maestro3.c index 39b5e7db1543..2693b6f731f3 100644 --- a/sound/pci/maestro3.c +++ b/sound/pci/maestro3.c | |||
@@ -872,35 +872,6 @@ struct snd_m3 { | |||
872 | /* | 872 | /* |
873 | * pci ids | 873 | * pci ids |
874 | */ | 874 | */ |
875 | |||
876 | #ifndef PCI_VENDOR_ID_ESS | ||
877 | #define PCI_VENDOR_ID_ESS 0x125D | ||
878 | #endif | ||
879 | #ifndef PCI_DEVICE_ID_ESS_ALLEGRO_1 | ||
880 | #define PCI_DEVICE_ID_ESS_ALLEGRO_1 0x1988 | ||
881 | #endif | ||
882 | #ifndef PCI_DEVICE_ID_ESS_ALLEGRO | ||
883 | #define PCI_DEVICE_ID_ESS_ALLEGRO 0x1989 | ||
884 | #endif | ||
885 | #ifndef PCI_DEVICE_ID_ESS_CANYON3D_2LE | ||
886 | #define PCI_DEVICE_ID_ESS_CANYON3D_2LE 0x1990 | ||
887 | #endif | ||
888 | #ifndef PCI_DEVICE_ID_ESS_CANYON3D_2 | ||
889 | #define PCI_DEVICE_ID_ESS_CANYON3D_2 0x1992 | ||
890 | #endif | ||
891 | #ifndef PCI_DEVICE_ID_ESS_MAESTRO3 | ||
892 | #define PCI_DEVICE_ID_ESS_MAESTRO3 0x1998 | ||
893 | #endif | ||
894 | #ifndef PCI_DEVICE_ID_ESS_MAESTRO3_1 | ||
895 | #define PCI_DEVICE_ID_ESS_MAESTRO3_1 0x1999 | ||
896 | #endif | ||
897 | #ifndef PCI_DEVICE_ID_ESS_MAESTRO3_HW | ||
898 | #define PCI_DEVICE_ID_ESS_MAESTRO3_HW 0x199a | ||
899 | #endif | ||
900 | #ifndef PCI_DEVICE_ID_ESS_MAESTRO3_2 | ||
901 | #define PCI_DEVICE_ID_ESS_MAESTRO3_2 0x199b | ||
902 | #endif | ||
903 | |||
904 | static struct pci_device_id snd_m3_ids[] = { | 875 | static struct pci_device_id snd_m3_ids[] = { |
905 | {PCI_VENDOR_ID_ESS, PCI_DEVICE_ID_ESS_ALLEGRO_1, PCI_ANY_ID, PCI_ANY_ID, | 876 | {PCI_VENDOR_ID_ESS, PCI_DEVICE_ID_ESS_ALLEGRO_1, PCI_ANY_ID, PCI_ANY_ID, |
906 | PCI_CLASS_MULTIMEDIA_AUDIO << 8, 0xffff00, 0}, | 877 | PCI_CLASS_MULTIMEDIA_AUDIO << 8, 0xffff00, 0}, |
@@ -2689,7 +2660,7 @@ snd_m3_create(snd_card_t *card, struct pci_dev *pci, | |||
2689 | return -ENXIO; | 2660 | return -ENXIO; |
2690 | } | 2661 | } |
2691 | 2662 | ||
2692 | chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); | 2663 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); |
2693 | if (chip == NULL) { | 2664 | if (chip == NULL) { |
2694 | pci_disable_device(pci); | 2665 | pci_disable_device(pci); |
2695 | return -ENOMEM; | 2666 | return -ENOMEM; |
@@ -2890,6 +2861,7 @@ static void __devexit snd_m3_remove(struct pci_dev *pci) | |||
2890 | 2861 | ||
2891 | static struct pci_driver driver = { | 2862 | static struct pci_driver driver = { |
2892 | .name = "Maestro3", | 2863 | .name = "Maestro3", |
2864 | .owner = THIS_MODULE, | ||
2893 | .id_table = snd_m3_ids, | 2865 | .id_table = snd_m3_ids, |
2894 | .probe = snd_m3_probe, | 2866 | .probe = snd_m3_probe, |
2895 | .remove = __devexit_p(snd_m3_remove), | 2867 | .remove = __devexit_p(snd_m3_remove), |
diff --git a/sound/pci/mixart/mixart.c b/sound/pci/mixart/mixart.c index 6c868d913634..1a62c7f6c52b 100644 --- a/sound/pci/mixart/mixart.c +++ b/sound/pci/mixart/mixart.c | |||
@@ -1004,7 +1004,7 @@ static int __devinit snd_mixart_create(mixart_mgr_t *mgr, snd_card_t *card, int | |||
1004 | .dev_free = snd_mixart_chip_dev_free, | 1004 | .dev_free = snd_mixart_chip_dev_free, |
1005 | }; | 1005 | }; |
1006 | 1006 | ||
1007 | mgr->chip[idx] = chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); | 1007 | mgr->chip[idx] = chip = kzalloc(sizeof(*chip), GFP_KERNEL); |
1008 | if (! chip) { | 1008 | if (! chip) { |
1009 | snd_printk(KERN_ERR "cannot allocate chip\n"); | 1009 | snd_printk(KERN_ERR "cannot allocate chip\n"); |
1010 | return -ENOMEM; | 1010 | return -ENOMEM; |
@@ -1292,7 +1292,7 @@ static int __devinit snd_mixart_probe(struct pci_dev *pci, | |||
1292 | 1292 | ||
1293 | /* | 1293 | /* |
1294 | */ | 1294 | */ |
1295 | mgr = kcalloc(1, sizeof(*mgr), GFP_KERNEL); | 1295 | mgr = kzalloc(sizeof(*mgr), GFP_KERNEL); |
1296 | if (! mgr) { | 1296 | if (! mgr) { |
1297 | pci_disable_device(pci); | 1297 | pci_disable_device(pci); |
1298 | return -ENOMEM; | 1298 | return -ENOMEM; |
@@ -1424,6 +1424,7 @@ static void __devexit snd_mixart_remove(struct pci_dev *pci) | |||
1424 | 1424 | ||
1425 | static struct pci_driver driver = { | 1425 | static struct pci_driver driver = { |
1426 | .name = "Digigram miXart", | 1426 | .name = "Digigram miXart", |
1427 | .owner = THIS_MODULE, | ||
1427 | .id_table = snd_mixart_ids, | 1428 | .id_table = snd_mixart_ids, |
1428 | .probe = snd_mixart_probe, | 1429 | .probe = snd_mixart_probe, |
1429 | .remove = __devexit_p(snd_mixart_remove), | 1430 | .remove = __devexit_p(snd_mixart_remove), |
diff --git a/sound/pci/nm256/nm256.c b/sound/pci/nm256/nm256.c index 7eb20b8f89f6..5c55a3b1d121 100644 --- a/sound/pci/nm256/nm256.c +++ b/sound/pci/nm256/nm256.c | |||
@@ -189,6 +189,7 @@ struct snd_nm256_stream { | |||
189 | nm256_t *chip; | 189 | nm256_t *chip; |
190 | snd_pcm_substream_t *substream; | 190 | snd_pcm_substream_t *substream; |
191 | int running; | 191 | int running; |
192 | int suspended; | ||
192 | 193 | ||
193 | u32 buf; /* offset from chip->buffer */ | 194 | u32 buf; /* offset from chip->buffer */ |
194 | int bufsize; /* buffer size in bytes */ | 195 | int bufsize; /* buffer size in bytes */ |
@@ -231,8 +232,10 @@ struct snd_nm256 { | |||
231 | int mixer_status_mask; /* bit mask to test the mixer status */ | 232 | int mixer_status_mask; /* bit mask to test the mixer status */ |
232 | 233 | ||
233 | int irq; | 234 | int irq; |
235 | int irq_acks; | ||
234 | irqreturn_t (*interrupt)(int, void *, struct pt_regs *); | 236 | irqreturn_t (*interrupt)(int, void *, struct pt_regs *); |
235 | int badintrcount; /* counter to check bogus interrupts */ | 237 | int badintrcount; /* counter to check bogus interrupts */ |
238 | struct semaphore irq_mutex; | ||
236 | 239 | ||
237 | nm256_stream_t streams[2]; | 240 | nm256_stream_t streams[2]; |
238 | 241 | ||
@@ -256,21 +259,6 @@ struct snd_nm256 { | |||
256 | /* | 259 | /* |
257 | * PCI ids | 260 | * PCI ids |
258 | */ | 261 | */ |
259 | |||
260 | #ifndef PCI_VENDOR_ID_NEOMAGIC | ||
261 | #define PCI_VENDOR_ID_NEOMEGIC 0x10c8 | ||
262 | #endif | ||
263 | #ifndef PCI_DEVICE_ID_NEOMAGIC_NM256AV_AUDIO | ||
264 | #define PCI_DEVICE_ID_NEOMAGIC_NM256AV_AUDIO 0x8005 | ||
265 | #endif | ||
266 | #ifndef PCI_DEVICE_ID_NEOMAGIC_NM256ZX_AUDIO | ||
267 | #define PCI_DEVICE_ID_NEOMAGIC_NM256ZX_AUDIO 0x8006 | ||
268 | #endif | ||
269 | #ifndef PCI_DEVICE_ID_NEOMAGIC_NM256XL_PLUS_AUDIO | ||
270 | #define PCI_DEVICE_ID_NEOMAGIC_NM256XL_PLUS_AUDIO 0x8016 | ||
271 | #endif | ||
272 | |||
273 | |||
274 | static struct pci_device_id snd_nm256_ids[] = { | 262 | static struct pci_device_id snd_nm256_ids[] = { |
275 | {PCI_VENDOR_ID_NEOMAGIC, PCI_DEVICE_ID_NEOMAGIC_NM256AV_AUDIO, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, | 263 | {PCI_VENDOR_ID_NEOMAGIC, PCI_DEVICE_ID_NEOMAGIC_NM256AV_AUDIO, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, |
276 | {PCI_VENDOR_ID_NEOMAGIC, PCI_DEVICE_ID_NEOMAGIC_NM256ZX_AUDIO, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, | 264 | {PCI_VENDOR_ID_NEOMAGIC, PCI_DEVICE_ID_NEOMAGIC_NM256ZX_AUDIO, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, |
@@ -464,6 +452,37 @@ snd_nm256_set_format(nm256_t *chip, nm256_stream_t *s, snd_pcm_substream_t *subs | |||
464 | } | 452 | } |
465 | } | 453 | } |
466 | 454 | ||
455 | /* acquire interrupt */ | ||
456 | static int snd_nm256_acquire_irq(nm256_t *chip) | ||
457 | { | ||
458 | down(&chip->irq_mutex); | ||
459 | if (chip->irq < 0) { | ||
460 | if (request_irq(chip->pci->irq, chip->interrupt, SA_INTERRUPT|SA_SHIRQ, | ||
461 | chip->card->driver, (void*)chip)) { | ||
462 | snd_printk("unable to grab IRQ %d\n", chip->pci->irq); | ||
463 | up(&chip->irq_mutex); | ||
464 | return -EBUSY; | ||
465 | } | ||
466 | chip->irq = chip->pci->irq; | ||
467 | } | ||
468 | chip->irq_acks++; | ||
469 | up(&chip->irq_mutex); | ||
470 | return 0; | ||
471 | } | ||
472 | |||
473 | /* release interrupt */ | ||
474 | static void snd_nm256_release_irq(nm256_t *chip) | ||
475 | { | ||
476 | down(&chip->irq_mutex); | ||
477 | if (chip->irq_acks > 0) | ||
478 | chip->irq_acks--; | ||
479 | if (chip->irq_acks == 0 && chip->irq >= 0) { | ||
480 | free_irq(chip->irq, (void*)chip); | ||
481 | chip->irq = -1; | ||
482 | } | ||
483 | up(&chip->irq_mutex); | ||
484 | } | ||
485 | |||
467 | /* | 486 | /* |
468 | * start / stop | 487 | * start / stop |
469 | */ | 488 | */ |
@@ -538,15 +557,19 @@ snd_nm256_playback_trigger(snd_pcm_substream_t *substream, int cmd) | |||
538 | 557 | ||
539 | spin_lock(&chip->reg_lock); | 558 | spin_lock(&chip->reg_lock); |
540 | switch (cmd) { | 559 | switch (cmd) { |
541 | case SNDRV_PCM_TRIGGER_START: | ||
542 | case SNDRV_PCM_TRIGGER_RESUME: | 560 | case SNDRV_PCM_TRIGGER_RESUME: |
561 | s->suspended = 0; | ||
562 | /* fallthru */ | ||
563 | case SNDRV_PCM_TRIGGER_START: | ||
543 | if (! s->running) { | 564 | if (! s->running) { |
544 | snd_nm256_playback_start(chip, s, substream); | 565 | snd_nm256_playback_start(chip, s, substream); |
545 | s->running = 1; | 566 | s->running = 1; |
546 | } | 567 | } |
547 | break; | 568 | break; |
548 | case SNDRV_PCM_TRIGGER_STOP: | ||
549 | case SNDRV_PCM_TRIGGER_SUSPEND: | 569 | case SNDRV_PCM_TRIGGER_SUSPEND: |
570 | s->suspended = 1; | ||
571 | /* fallthru */ | ||
572 | case SNDRV_PCM_TRIGGER_STOP: | ||
550 | if (s->running) { | 573 | if (s->running) { |
551 | snd_nm256_playback_stop(chip); | 574 | snd_nm256_playback_stop(chip); |
552 | s->running = 0; | 575 | s->running = 0; |
@@ -802,7 +825,7 @@ static void snd_nm256_setup_stream(nm256_t *chip, nm256_stream_t *s, | |||
802 | runtime->hw = *hw_ptr; | 825 | runtime->hw = *hw_ptr; |
803 | runtime->hw.buffer_bytes_max = s->bufsize; | 826 | runtime->hw.buffer_bytes_max = s->bufsize; |
804 | runtime->hw.period_bytes_max = s->bufsize / 2; | 827 | runtime->hw.period_bytes_max = s->bufsize / 2; |
805 | runtime->dma_area = (void*) s->bufptr; | 828 | runtime->dma_area = (void __force *) s->bufptr; |
806 | runtime->dma_addr = s->bufptr_addr; | 829 | runtime->dma_addr = s->bufptr_addr; |
807 | runtime->dma_bytes = s->bufsize; | 830 | runtime->dma_bytes = s->bufsize; |
808 | runtime->private_data = s; | 831 | runtime->private_data = s; |
@@ -818,6 +841,8 @@ snd_nm256_playback_open(snd_pcm_substream_t *substream) | |||
818 | { | 841 | { |
819 | nm256_t *chip = snd_pcm_substream_chip(substream); | 842 | nm256_t *chip = snd_pcm_substream_chip(substream); |
820 | 843 | ||
844 | if (snd_nm256_acquire_irq(chip) < 0) | ||
845 | return -EBUSY; | ||
821 | snd_nm256_setup_stream(chip, &chip->streams[SNDRV_PCM_STREAM_PLAYBACK], | 846 | snd_nm256_setup_stream(chip, &chip->streams[SNDRV_PCM_STREAM_PLAYBACK], |
822 | substream, &snd_nm256_playback); | 847 | substream, &snd_nm256_playback); |
823 | return 0; | 848 | return 0; |
@@ -828,6 +853,8 @@ snd_nm256_capture_open(snd_pcm_substream_t *substream) | |||
828 | { | 853 | { |
829 | nm256_t *chip = snd_pcm_substream_chip(substream); | 854 | nm256_t *chip = snd_pcm_substream_chip(substream); |
830 | 855 | ||
856 | if (snd_nm256_acquire_irq(chip) < 0) | ||
857 | return -EBUSY; | ||
831 | snd_nm256_setup_stream(chip, &chip->streams[SNDRV_PCM_STREAM_CAPTURE], | 858 | snd_nm256_setup_stream(chip, &chip->streams[SNDRV_PCM_STREAM_CAPTURE], |
832 | substream, &snd_nm256_capture); | 859 | substream, &snd_nm256_capture); |
833 | return 0; | 860 | return 0; |
@@ -839,6 +866,9 @@ snd_nm256_capture_open(snd_pcm_substream_t *substream) | |||
839 | static int | 866 | static int |
840 | snd_nm256_playback_close(snd_pcm_substream_t *substream) | 867 | snd_nm256_playback_close(snd_pcm_substream_t *substream) |
841 | { | 868 | { |
869 | nm256_t *chip = snd_pcm_substream_chip(substream); | ||
870 | |||
871 | snd_nm256_release_irq(chip); | ||
842 | return 0; | 872 | return 0; |
843 | } | 873 | } |
844 | 874 | ||
@@ -846,6 +876,9 @@ snd_nm256_playback_close(snd_pcm_substream_t *substream) | |||
846 | static int | 876 | static int |
847 | snd_nm256_capture_close(snd_pcm_substream_t *substream) | 877 | snd_nm256_capture_close(snd_pcm_substream_t *substream) |
848 | { | 878 | { |
879 | nm256_t *chip = snd_pcm_substream_chip(substream); | ||
880 | |||
881 | snd_nm256_release_irq(chip); | ||
849 | return 0; | 882 | return 0; |
850 | } | 883 | } |
851 | 884 | ||
@@ -915,18 +948,16 @@ snd_nm256_pcm(nm256_t *chip, int device) | |||
915 | static void | 948 | static void |
916 | snd_nm256_init_chip(nm256_t *chip) | 949 | snd_nm256_init_chip(nm256_t *chip) |
917 | { | 950 | { |
918 | spin_lock_irq(&chip->reg_lock); | ||
919 | /* Reset everything. */ | 951 | /* Reset everything. */ |
920 | snd_nm256_writeb(chip, 0x0, 0x11); | 952 | snd_nm256_writeb(chip, 0x0, 0x11); |
921 | snd_nm256_writew(chip, 0x214, 0); | 953 | snd_nm256_writew(chip, 0x214, 0); |
922 | /* stop sounds.. */ | 954 | /* stop sounds.. */ |
923 | //snd_nm256_playback_stop(chip); | 955 | //snd_nm256_playback_stop(chip); |
924 | //snd_nm256_capture_stop(chip); | 956 | //snd_nm256_capture_stop(chip); |
925 | spin_unlock_irq(&chip->reg_lock); | ||
926 | } | 957 | } |
927 | 958 | ||
928 | 959 | ||
929 | static inline void | 960 | static irqreturn_t |
930 | snd_nm256_intr_check(nm256_t *chip) | 961 | snd_nm256_intr_check(nm256_t *chip) |
931 | { | 962 | { |
932 | if (chip->badintrcount++ > 1000) { | 963 | if (chip->badintrcount++ > 1000) { |
@@ -947,7 +978,9 @@ snd_nm256_intr_check(nm256_t *chip) | |||
947 | if (chip->streams[SNDRV_PCM_STREAM_CAPTURE].running) | 978 | if (chip->streams[SNDRV_PCM_STREAM_CAPTURE].running) |
948 | snd_nm256_capture_stop(chip); | 979 | snd_nm256_capture_stop(chip); |
949 | chip->badintrcount = 0; | 980 | chip->badintrcount = 0; |
981 | return IRQ_HANDLED; | ||
950 | } | 982 | } |
983 | return IRQ_NONE; | ||
951 | } | 984 | } |
952 | 985 | ||
953 | /* | 986 | /* |
@@ -969,10 +1002,8 @@ snd_nm256_interrupt(int irq, void *dev_id, struct pt_regs *dummy) | |||
969 | status = snd_nm256_readw(chip, NM_INT_REG); | 1002 | status = snd_nm256_readw(chip, NM_INT_REG); |
970 | 1003 | ||
971 | /* Not ours. */ | 1004 | /* Not ours. */ |
972 | if (status == 0) { | 1005 | if (status == 0) |
973 | snd_nm256_intr_check(chip); | 1006 | return snd_nm256_intr_check(chip); |
974 | return IRQ_NONE; | ||
975 | } | ||
976 | 1007 | ||
977 | chip->badintrcount = 0; | 1008 | chip->badintrcount = 0; |
978 | 1009 | ||
@@ -1036,10 +1067,8 @@ snd_nm256_interrupt_zx(int irq, void *dev_id, struct pt_regs *dummy) | |||
1036 | status = snd_nm256_readl(chip, NM_INT_REG); | 1067 | status = snd_nm256_readl(chip, NM_INT_REG); |
1037 | 1068 | ||
1038 | /* Not ours. */ | 1069 | /* Not ours. */ |
1039 | if (status == 0) { | 1070 | if (status == 0) |
1040 | snd_nm256_intr_check(chip); | 1071 | return snd_nm256_intr_check(chip); |
1041 | return IRQ_NONE; | ||
1042 | } | ||
1043 | 1072 | ||
1044 | chip->badintrcount = 0; | 1073 | chip->badintrcount = 0; |
1045 | 1074 | ||
@@ -1192,7 +1221,7 @@ snd_nm256_mixer(nm256_t *chip) | |||
1192 | AC97_PC_BEEP, AC97_PHONE, AC97_MIC, AC97_LINE, AC97_CD, | 1221 | AC97_PC_BEEP, AC97_PHONE, AC97_MIC, AC97_LINE, AC97_CD, |
1193 | AC97_VIDEO, AC97_AUX, AC97_PCM, AC97_REC_SEL, | 1222 | AC97_VIDEO, AC97_AUX, AC97_PCM, AC97_REC_SEL, |
1194 | AC97_REC_GAIN, AC97_GENERAL_PURPOSE, AC97_3D_CONTROL, | 1223 | AC97_REC_GAIN, AC97_GENERAL_PURPOSE, AC97_3D_CONTROL, |
1195 | AC97_EXTENDED_ID, | 1224 | /*AC97_EXTENDED_ID,*/ |
1196 | AC97_VENDOR_ID1, AC97_VENDOR_ID2, | 1225 | AC97_VENDOR_ID1, AC97_VENDOR_ID2, |
1197 | -1 | 1226 | -1 |
1198 | }; | 1227 | }; |
@@ -1206,6 +1235,7 @@ snd_nm256_mixer(nm256_t *chip) | |||
1206 | for (i = 0; mixer_regs[i] >= 0; i++) | 1235 | for (i = 0; mixer_regs[i] >= 0; i++) |
1207 | set_bit(mixer_regs[i], ac97.reg_accessed); | 1236 | set_bit(mixer_regs[i], ac97.reg_accessed); |
1208 | ac97.private_data = chip; | 1237 | ac97.private_data = chip; |
1238 | pbus->no_vra = 1; | ||
1209 | err = snd_ac97_mixer(pbus, &ac97, &chip->ac97); | 1239 | err = snd_ac97_mixer(pbus, &ac97, &chip->ac97); |
1210 | if (err < 0) | 1240 | if (err < 0) |
1211 | return err; | 1241 | return err; |
@@ -1281,6 +1311,7 @@ static int nm256_suspend(snd_card_t *card, pm_message_t state) | |||
1281 | static int nm256_resume(snd_card_t *card) | 1311 | static int nm256_resume(snd_card_t *card) |
1282 | { | 1312 | { |
1283 | nm256_t *chip = card->pm_private_data; | 1313 | nm256_t *chip = card->pm_private_data; |
1314 | int i; | ||
1284 | 1315 | ||
1285 | /* Perform a full reset on the hardware */ | 1316 | /* Perform a full reset on the hardware */ |
1286 | pci_enable_device(chip->pci); | 1317 | pci_enable_device(chip->pci); |
@@ -1289,6 +1320,15 @@ static int nm256_resume(snd_card_t *card) | |||
1289 | /* restore ac97 */ | 1320 | /* restore ac97 */ |
1290 | snd_ac97_resume(chip->ac97); | 1321 | snd_ac97_resume(chip->ac97); |
1291 | 1322 | ||
1323 | for (i = 0; i < 2; i++) { | ||
1324 | nm256_stream_t *s = &chip->streams[i]; | ||
1325 | if (s->substream && s->suspended) { | ||
1326 | spin_lock_irq(&chip->reg_lock); | ||
1327 | snd_nm256_set_format(chip, s, s->substream); | ||
1328 | spin_unlock_irq(&chip->reg_lock); | ||
1329 | } | ||
1330 | } | ||
1331 | |||
1292 | return 0; | 1332 | return 0; |
1293 | } | 1333 | } |
1294 | #endif /* CONFIG_PM */ | 1334 | #endif /* CONFIG_PM */ |
@@ -1349,7 +1389,7 @@ snd_nm256_create(snd_card_t *card, struct pci_dev *pci, | |||
1349 | if ((err = pci_enable_device(pci)) < 0) | 1389 | if ((err = pci_enable_device(pci)) < 0) |
1350 | return err; | 1390 | return err; |
1351 | 1391 | ||
1352 | chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); | 1392 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); |
1353 | if (chip == NULL) { | 1393 | if (chip == NULL) { |
1354 | pci_disable_device(pci); | 1394 | pci_disable_device(pci); |
1355 | return -ENOMEM; | 1395 | return -ENOMEM; |
@@ -1360,6 +1400,7 @@ snd_nm256_create(snd_card_t *card, struct pci_dev *pci, | |||
1360 | chip->use_cache = usecache; | 1400 | chip->use_cache = usecache; |
1361 | spin_lock_init(&chip->reg_lock); | 1401 | spin_lock_init(&chip->reg_lock); |
1362 | chip->irq = -1; | 1402 | chip->irq = -1; |
1403 | init_MUTEX(&chip->irq_mutex); | ||
1363 | 1404 | ||
1364 | chip->streams[SNDRV_PCM_STREAM_PLAYBACK].bufsize = play_bufsize; | 1405 | chip->streams[SNDRV_PCM_STREAM_PLAYBACK].bufsize = play_bufsize; |
1365 | chip->streams[SNDRV_PCM_STREAM_CAPTURE].bufsize = capt_bufsize; | 1406 | chip->streams[SNDRV_PCM_STREAM_CAPTURE].bufsize = capt_bufsize; |
@@ -1470,15 +1511,6 @@ snd_nm256_create(snd_card_t *card, struct pci_dev *pci, | |||
1470 | chip->coeff_buf[SNDRV_PCM_STREAM_CAPTURE] = addr; | 1511 | chip->coeff_buf[SNDRV_PCM_STREAM_CAPTURE] = addr; |
1471 | } | 1512 | } |
1472 | 1513 | ||
1473 | /* acquire interrupt */ | ||
1474 | if (request_irq(pci->irq, chip->interrupt, SA_INTERRUPT|SA_SHIRQ, | ||
1475 | card->driver, (void*)chip)) { | ||
1476 | err = -EBUSY; | ||
1477 | snd_printk("unable to grab IRQ %d\n", pci->irq); | ||
1478 | goto __error; | ||
1479 | } | ||
1480 | chip->irq = pci->irq; | ||
1481 | |||
1482 | /* Fixed setting. */ | 1514 | /* Fixed setting. */ |
1483 | chip->mixer_base = NM_MIXER_OFFSET; | 1515 | chip->mixer_base = NM_MIXER_OFFSET; |
1484 | 1516 | ||
@@ -1636,6 +1668,7 @@ static void __devexit snd_nm256_remove(struct pci_dev *pci) | |||
1636 | 1668 | ||
1637 | static struct pci_driver driver = { | 1669 | static struct pci_driver driver = { |
1638 | .name = "NeoMagic 256", | 1670 | .name = "NeoMagic 256", |
1671 | .owner = THIS_MODULE, | ||
1639 | .id_table = snd_nm256_ids, | 1672 | .id_table = snd_nm256_ids, |
1640 | .probe = snd_nm256_probe, | 1673 | .probe = snd_nm256_probe, |
1641 | .remove = __devexit_p(snd_nm256_remove), | 1674 | .remove = __devexit_p(snd_nm256_remove), |
diff --git a/sound/pci/rme32.c b/sound/pci/rme32.c index b7b554df6705..cd313af6ebcf 100644 --- a/sound/pci/rme32.c +++ b/sound/pci/rme32.c | |||
@@ -192,20 +192,6 @@ MODULE_SUPPORTED_DEVICE("{{RME,Digi32}," "{RME,Digi32/8}," "{RME,Digi32 PRO}}"); | |||
192 | #define RME32_PRO_REVISION_WITH_8414 150 | 192 | #define RME32_PRO_REVISION_WITH_8414 150 |
193 | 193 | ||
194 | 194 | ||
195 | /* PCI vendor/device ID's */ | ||
196 | #ifndef PCI_VENDOR_ID_XILINX_RME | ||
197 | # define PCI_VENDOR_ID_XILINX_RME 0xea60 | ||
198 | #endif | ||
199 | #ifndef PCI_DEVICE_ID_DIGI32 | ||
200 | # define PCI_DEVICE_ID_DIGI32 0x9896 | ||
201 | #endif | ||
202 | #ifndef PCI_DEVICE_ID_DIGI32_PRO | ||
203 | # define PCI_DEVICE_ID_DIGI32_PRO 0x9897 | ||
204 | #endif | ||
205 | #ifndef PCI_DEVICE_ID_DIGI32_8 | ||
206 | # define PCI_DEVICE_ID_DIGI32_8 0x9898 | ||
207 | #endif | ||
208 | |||
209 | typedef struct snd_rme32 { | 195 | typedef struct snd_rme32 { |
210 | spinlock_t lock; | 196 | spinlock_t lock; |
211 | int irq; | 197 | int irq; |
@@ -242,11 +228,11 @@ typedef struct snd_rme32 { | |||
242 | } rme32_t; | 228 | } rme32_t; |
243 | 229 | ||
244 | static struct pci_device_id snd_rme32_ids[] = { | 230 | static struct pci_device_id snd_rme32_ids[] = { |
245 | {PCI_VENDOR_ID_XILINX_RME, PCI_DEVICE_ID_DIGI32, | 231 | {PCI_VENDOR_ID_XILINX_RME, PCI_DEVICE_ID_RME_DIGI32, |
246 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0,}, | 232 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0,}, |
247 | {PCI_VENDOR_ID_XILINX_RME, PCI_DEVICE_ID_DIGI32_8, | 233 | {PCI_VENDOR_ID_XILINX_RME, PCI_DEVICE_ID_RME_DIGI32_8, |
248 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0,}, | 234 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0,}, |
249 | {PCI_VENDOR_ID_XILINX_RME, PCI_DEVICE_ID_DIGI32_PRO, | 235 | {PCI_VENDOR_ID_XILINX_RME, PCI_DEVICE_ID_RME_DIGI32_PRO, |
250 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0,}, | 236 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0,}, |
251 | {0,} | 237 | {0,} |
252 | }; | 238 | }; |
@@ -254,7 +240,7 @@ static struct pci_device_id snd_rme32_ids[] = { | |||
254 | MODULE_DEVICE_TABLE(pci, snd_rme32_ids); | 240 | MODULE_DEVICE_TABLE(pci, snd_rme32_ids); |
255 | 241 | ||
256 | #define RME32_ISWORKING(rme32) ((rme32)->wcreg & RME32_WCR_START) | 242 | #define RME32_ISWORKING(rme32) ((rme32)->wcreg & RME32_WCR_START) |
257 | #define RME32_PRO_WITH_8414(rme32) ((rme32)->pci->device == PCI_DEVICE_ID_DIGI32_PRO && (rme32)->rev == RME32_PRO_REVISION_WITH_8414) | 243 | #define RME32_PRO_WITH_8414(rme32) ((rme32)->pci->device == PCI_DEVICE_ID_RME_DIGI32_PRO && (rme32)->rev == RME32_PRO_REVISION_WITH_8414) |
258 | 244 | ||
259 | static int snd_rme32_playback_prepare(snd_pcm_substream_t * substream); | 245 | static int snd_rme32_playback_prepare(snd_pcm_substream_t * substream); |
260 | 246 | ||
@@ -541,21 +527,21 @@ static int snd_rme32_playback_setrate(rme32_t * rme32, int rate) | |||
541 | RME32_WCR_FREQ_1; | 527 | RME32_WCR_FREQ_1; |
542 | break; | 528 | break; |
543 | case 64000: | 529 | case 64000: |
544 | if (rme32->pci->device != PCI_DEVICE_ID_DIGI32_PRO) | 530 | if (rme32->pci->device != PCI_DEVICE_ID_RME_DIGI32_PRO) |
545 | return -EINVAL; | 531 | return -EINVAL; |
546 | rme32->wcreg |= RME32_WCR_DS_BM; | 532 | rme32->wcreg |= RME32_WCR_DS_BM; |
547 | rme32->wcreg = (rme32->wcreg | RME32_WCR_FREQ_0) & | 533 | rme32->wcreg = (rme32->wcreg | RME32_WCR_FREQ_0) & |
548 | ~RME32_WCR_FREQ_1; | 534 | ~RME32_WCR_FREQ_1; |
549 | break; | 535 | break; |
550 | case 88200: | 536 | case 88200: |
551 | if (rme32->pci->device != PCI_DEVICE_ID_DIGI32_PRO) | 537 | if (rme32->pci->device != PCI_DEVICE_ID_RME_DIGI32_PRO) |
552 | return -EINVAL; | 538 | return -EINVAL; |
553 | rme32->wcreg |= RME32_WCR_DS_BM; | 539 | rme32->wcreg |= RME32_WCR_DS_BM; |
554 | rme32->wcreg = (rme32->wcreg | RME32_WCR_FREQ_1) & | 540 | rme32->wcreg = (rme32->wcreg | RME32_WCR_FREQ_1) & |
555 | ~RME32_WCR_FREQ_0; | 541 | ~RME32_WCR_FREQ_0; |
556 | break; | 542 | break; |
557 | case 96000: | 543 | case 96000: |
558 | if (rme32->pci->device != PCI_DEVICE_ID_DIGI32_PRO) | 544 | if (rme32->pci->device != PCI_DEVICE_ID_RME_DIGI32_PRO) |
559 | return -EINVAL; | 545 | return -EINVAL; |
560 | rme32->wcreg |= RME32_WCR_DS_BM; | 546 | rme32->wcreg |= RME32_WCR_DS_BM; |
561 | rme32->wcreg = (rme32->wcreg | RME32_WCR_FREQ_0) | | 547 | rme32->wcreg = (rme32->wcreg | RME32_WCR_FREQ_0) | |
@@ -692,7 +678,8 @@ snd_rme32_playback_hw_params(snd_pcm_substream_t * substream, | |||
692 | if (err < 0) | 678 | if (err < 0) |
693 | return err; | 679 | return err; |
694 | } else { | 680 | } else { |
695 | runtime->dma_area = (void *)(rme32->iobase + RME32_IO_DATA_BUFFER); | 681 | runtime->dma_area = (void __force *)(rme32->iobase + |
682 | RME32_IO_DATA_BUFFER); | ||
696 | runtime->dma_addr = rme32->port + RME32_IO_DATA_BUFFER; | 683 | runtime->dma_addr = rme32->port + RME32_IO_DATA_BUFFER; |
697 | runtime->dma_bytes = RME32_BUFFER_SIZE; | 684 | runtime->dma_bytes = RME32_BUFFER_SIZE; |
698 | } | 685 | } |
@@ -746,7 +733,8 @@ snd_rme32_capture_hw_params(snd_pcm_substream_t * substream, | |||
746 | if (err < 0) | 733 | if (err < 0) |
747 | return err; | 734 | return err; |
748 | } else { | 735 | } else { |
749 | runtime->dma_area = (void *)rme32->iobase + RME32_IO_DATA_BUFFER; | 736 | runtime->dma_area = (void __force *)rme32->iobase + |
737 | RME32_IO_DATA_BUFFER; | ||
750 | runtime->dma_addr = rme32->port + RME32_IO_DATA_BUFFER; | 738 | runtime->dma_addr = rme32->port + RME32_IO_DATA_BUFFER; |
751 | runtime->dma_bytes = RME32_BUFFER_SIZE; | 739 | runtime->dma_bytes = RME32_BUFFER_SIZE; |
752 | } | 740 | } |
@@ -893,7 +881,7 @@ static int snd_rme32_playback_spdif_open(snd_pcm_substream_t * substream) | |||
893 | runtime->hw = snd_rme32_spdif_fd_info; | 881 | runtime->hw = snd_rme32_spdif_fd_info; |
894 | else | 882 | else |
895 | runtime->hw = snd_rme32_spdif_info; | 883 | runtime->hw = snd_rme32_spdif_info; |
896 | if (rme32->pci->device == PCI_DEVICE_ID_DIGI32_PRO) { | 884 | if (rme32->pci->device == PCI_DEVICE_ID_RME_DIGI32_PRO) { |
897 | runtime->hw.rates |= SNDRV_PCM_RATE_64000 | SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000; | 885 | runtime->hw.rates |= SNDRV_PCM_RATE_64000 | SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000; |
898 | runtime->hw.rate_max = 96000; | 886 | runtime->hw.rate_max = 96000; |
899 | } | 887 | } |
@@ -1420,8 +1408,8 @@ static int __devinit snd_rme32_create(rme32_t * rme32) | |||
1420 | } | 1408 | } |
1421 | 1409 | ||
1422 | /* set up ALSA pcm device for ADAT */ | 1410 | /* set up ALSA pcm device for ADAT */ |
1423 | if ((pci->device == PCI_DEVICE_ID_DIGI32) || | 1411 | if ((pci->device == PCI_DEVICE_ID_RME_DIGI32) || |
1424 | (pci->device == PCI_DEVICE_ID_DIGI32_PRO)) { | 1412 | (pci->device == PCI_DEVICE_ID_RME_DIGI32_PRO)) { |
1425 | /* ADAT is not available on DIGI32 and DIGI32 Pro */ | 1413 | /* ADAT is not available on DIGI32 and DIGI32 Pro */ |
1426 | rme32->adat_pcm = NULL; | 1414 | rme32->adat_pcm = NULL; |
1427 | } | 1415 | } |
@@ -1651,11 +1639,11 @@ snd_rme32_info_inputtype_control(snd_kcontrol_t * kcontrol, | |||
1651 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | 1639 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
1652 | uinfo->count = 1; | 1640 | uinfo->count = 1; |
1653 | switch (rme32->pci->device) { | 1641 | switch (rme32->pci->device) { |
1654 | case PCI_DEVICE_ID_DIGI32: | 1642 | case PCI_DEVICE_ID_RME_DIGI32: |
1655 | case PCI_DEVICE_ID_DIGI32_8: | 1643 | case PCI_DEVICE_ID_RME_DIGI32_8: |
1656 | uinfo->value.enumerated.items = 3; | 1644 | uinfo->value.enumerated.items = 3; |
1657 | break; | 1645 | break; |
1658 | case PCI_DEVICE_ID_DIGI32_PRO: | 1646 | case PCI_DEVICE_ID_RME_DIGI32_PRO: |
1659 | uinfo->value.enumerated.items = 4; | 1647 | uinfo->value.enumerated.items = 4; |
1660 | break; | 1648 | break; |
1661 | default: | 1649 | default: |
@@ -1682,11 +1670,11 @@ snd_rme32_get_inputtype_control(snd_kcontrol_t * kcontrol, | |||
1682 | ucontrol->value.enumerated.item[0] = snd_rme32_getinputtype(rme32); | 1670 | ucontrol->value.enumerated.item[0] = snd_rme32_getinputtype(rme32); |
1683 | 1671 | ||
1684 | switch (rme32->pci->device) { | 1672 | switch (rme32->pci->device) { |
1685 | case PCI_DEVICE_ID_DIGI32: | 1673 | case PCI_DEVICE_ID_RME_DIGI32: |
1686 | case PCI_DEVICE_ID_DIGI32_8: | 1674 | case PCI_DEVICE_ID_RME_DIGI32_8: |
1687 | items = 3; | 1675 | items = 3; |
1688 | break; | 1676 | break; |
1689 | case PCI_DEVICE_ID_DIGI32_PRO: | 1677 | case PCI_DEVICE_ID_RME_DIGI32_PRO: |
1690 | items = 4; | 1678 | items = 4; |
1691 | break; | 1679 | break; |
1692 | default: | 1680 | default: |
@@ -1709,11 +1697,11 @@ snd_rme32_put_inputtype_control(snd_kcontrol_t * kcontrol, | |||
1709 | int change, items = 3; | 1697 | int change, items = 3; |
1710 | 1698 | ||
1711 | switch (rme32->pci->device) { | 1699 | switch (rme32->pci->device) { |
1712 | case PCI_DEVICE_ID_DIGI32: | 1700 | case PCI_DEVICE_ID_RME_DIGI32: |
1713 | case PCI_DEVICE_ID_DIGI32_8: | 1701 | case PCI_DEVICE_ID_RME_DIGI32_8: |
1714 | items = 3; | 1702 | items = 3; |
1715 | break; | 1703 | break; |
1716 | case PCI_DEVICE_ID_DIGI32_PRO: | 1704 | case PCI_DEVICE_ID_RME_DIGI32_PRO: |
1717 | items = 4; | 1705 | items = 4; |
1718 | break; | 1706 | break; |
1719 | default: | 1707 | default: |
@@ -1900,7 +1888,7 @@ static snd_kcontrol_new_t snd_rme32_controls[] = { | |||
1900 | }, | 1888 | }, |
1901 | { | 1889 | { |
1902 | .access = SNDRV_CTL_ELEM_ACCESS_READ, | 1890 | .access = SNDRV_CTL_ELEM_ACCESS_READ, |
1903 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1891 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, |
1904 | .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, CON_MASK), | 1892 | .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, CON_MASK), |
1905 | .info = snd_rme32_control_spdif_mask_info, | 1893 | .info = snd_rme32_control_spdif_mask_info, |
1906 | .get = snd_rme32_control_spdif_mask_get, | 1894 | .get = snd_rme32_control_spdif_mask_get, |
@@ -1908,7 +1896,7 @@ static snd_kcontrol_new_t snd_rme32_controls[] = { | |||
1908 | }, | 1896 | }, |
1909 | { | 1897 | { |
1910 | .access = SNDRV_CTL_ELEM_ACCESS_READ, | 1898 | .access = SNDRV_CTL_ELEM_ACCESS_READ, |
1911 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1899 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, |
1912 | .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, PRO_MASK), | 1900 | .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, PRO_MASK), |
1913 | .info = snd_rme32_control_spdif_mask_info, | 1901 | .info = snd_rme32_control_spdif_mask_info, |
1914 | .get = snd_rme32_control_spdif_mask_get, | 1902 | .get = snd_rme32_control_spdif_mask_get, |
@@ -1994,13 +1982,13 @@ snd_rme32_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) | |||
1994 | 1982 | ||
1995 | strcpy(card->driver, "Digi32"); | 1983 | strcpy(card->driver, "Digi32"); |
1996 | switch (rme32->pci->device) { | 1984 | switch (rme32->pci->device) { |
1997 | case PCI_DEVICE_ID_DIGI32: | 1985 | case PCI_DEVICE_ID_RME_DIGI32: |
1998 | strcpy(card->shortname, "RME Digi32"); | 1986 | strcpy(card->shortname, "RME Digi32"); |
1999 | break; | 1987 | break; |
2000 | case PCI_DEVICE_ID_DIGI32_8: | 1988 | case PCI_DEVICE_ID_RME_DIGI32_8: |
2001 | strcpy(card->shortname, "RME Digi32/8"); | 1989 | strcpy(card->shortname, "RME Digi32/8"); |
2002 | break; | 1990 | break; |
2003 | case PCI_DEVICE_ID_DIGI32_PRO: | 1991 | case PCI_DEVICE_ID_RME_DIGI32_PRO: |
2004 | strcpy(card->shortname, "RME Digi32 PRO"); | 1992 | strcpy(card->shortname, "RME Digi32 PRO"); |
2005 | break; | 1993 | break; |
2006 | } | 1994 | } |
@@ -2024,6 +2012,7 @@ static void __devexit snd_rme32_remove(struct pci_dev *pci) | |||
2024 | 2012 | ||
2025 | static struct pci_driver driver = { | 2013 | static struct pci_driver driver = { |
2026 | .name = "RME Digi32", | 2014 | .name = "RME Digi32", |
2015 | .owner = THIS_MODULE, | ||
2027 | .id_table = snd_rme32_ids, | 2016 | .id_table = snd_rme32_ids, |
2028 | .probe = snd_rme32_probe, | 2017 | .probe = snd_rme32_probe, |
2029 | .remove = __devexit_p(snd_rme32_remove), | 2018 | .remove = __devexit_p(snd_rme32_remove), |
diff --git a/sound/pci/rme96.c b/sound/pci/rme96.c index 10c4f45a913c..c495cae78dbf 100644 --- a/sound/pci/rme96.c +++ b/sound/pci/rme96.c | |||
@@ -200,25 +200,6 @@ MODULE_PARM_DESC(enable, "Enable RME Digi96 soundcard."); | |||
200 | #define RME96_AD1852_VOL_BITS 14 | 200 | #define RME96_AD1852_VOL_BITS 14 |
201 | #define RME96_AD1855_VOL_BITS 10 | 201 | #define RME96_AD1855_VOL_BITS 10 |
202 | 202 | ||
203 | /* | ||
204 | * PCI vendor/device ids, could in the future be defined in <linux/pci.h>, | ||
205 | * therefore #ifndef is used. | ||
206 | */ | ||
207 | #ifndef PCI_VENDOR_ID_XILINX | ||
208 | #define PCI_VENDOR_ID_XILINX 0x10ee | ||
209 | #endif | ||
210 | #ifndef PCI_DEVICE_ID_DIGI96 | ||
211 | #define PCI_DEVICE_ID_DIGI96 0x3fc0 | ||
212 | #endif | ||
213 | #ifndef PCI_DEVICE_ID_DIGI96_8 | ||
214 | #define PCI_DEVICE_ID_DIGI96_8 0x3fc1 | ||
215 | #endif | ||
216 | #ifndef PCI_DEVICE_ID_DIGI96_8_PRO | ||
217 | #define PCI_DEVICE_ID_DIGI96_8_PRO 0x3fc2 | ||
218 | #endif | ||
219 | #ifndef PCI_DEVICE_ID_DIGI96_8_PAD_OR_PST | ||
220 | #define PCI_DEVICE_ID_DIGI96_8_PAD_OR_PST 0x3fc3 | ||
221 | #endif | ||
222 | 203 | ||
223 | typedef struct snd_rme96 { | 204 | typedef struct snd_rme96 { |
224 | spinlock_t lock; | 205 | spinlock_t lock; |
@@ -252,13 +233,13 @@ typedef struct snd_rme96 { | |||
252 | } rme96_t; | 233 | } rme96_t; |
253 | 234 | ||
254 | static struct pci_device_id snd_rme96_ids[] = { | 235 | static struct pci_device_id snd_rme96_ids[] = { |
255 | { PCI_VENDOR_ID_XILINX, PCI_DEVICE_ID_DIGI96, | 236 | { PCI_VENDOR_ID_XILINX, PCI_DEVICE_ID_RME_DIGI96, |
256 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, | 237 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, |
257 | { PCI_VENDOR_ID_XILINX, PCI_DEVICE_ID_DIGI96_8, | 238 | { PCI_VENDOR_ID_XILINX, PCI_DEVICE_ID_RME_DIGI96_8, |
258 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, | 239 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, |
259 | { PCI_VENDOR_ID_XILINX, PCI_DEVICE_ID_DIGI96_8_PRO, | 240 | { PCI_VENDOR_ID_XILINX, PCI_DEVICE_ID_RME_DIGI96_8_PRO, |
260 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, | 241 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, |
261 | { PCI_VENDOR_ID_XILINX, PCI_DEVICE_ID_DIGI96_8_PAD_OR_PST, | 242 | { PCI_VENDOR_ID_XILINX, PCI_DEVICE_ID_RME_DIGI96_8_PAD_OR_PST, |
262 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, | 243 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, |
263 | { 0, } | 244 | { 0, } |
264 | }; | 245 | }; |
@@ -267,12 +248,12 @@ MODULE_DEVICE_TABLE(pci, snd_rme96_ids); | |||
267 | 248 | ||
268 | #define RME96_ISPLAYING(rme96) ((rme96)->wcreg & RME96_WCR_START) | 249 | #define RME96_ISPLAYING(rme96) ((rme96)->wcreg & RME96_WCR_START) |
269 | #define RME96_ISRECORDING(rme96) ((rme96)->wcreg & RME96_WCR_START_2) | 250 | #define RME96_ISRECORDING(rme96) ((rme96)->wcreg & RME96_WCR_START_2) |
270 | #define RME96_HAS_ANALOG_IN(rme96) ((rme96)->pci->device == PCI_DEVICE_ID_DIGI96_8_PAD_OR_PST) | 251 | #define RME96_HAS_ANALOG_IN(rme96) ((rme96)->pci->device == PCI_DEVICE_ID_RME_DIGI96_8_PAD_OR_PST) |
271 | #define RME96_HAS_ANALOG_OUT(rme96) ((rme96)->pci->device == PCI_DEVICE_ID_DIGI96_8_PRO || \ | 252 | #define RME96_HAS_ANALOG_OUT(rme96) ((rme96)->pci->device == PCI_DEVICE_ID_RME_DIGI96_8_PRO || \ |
272 | (rme96)->pci->device == PCI_DEVICE_ID_DIGI96_8_PAD_OR_PST) | 253 | (rme96)->pci->device == PCI_DEVICE_ID_RME_DIGI96_8_PAD_OR_PST) |
273 | #define RME96_DAC_IS_1852(rme96) (RME96_HAS_ANALOG_OUT(rme96) && (rme96)->rev >= 4) | 254 | #define RME96_DAC_IS_1852(rme96) (RME96_HAS_ANALOG_OUT(rme96) && (rme96)->rev >= 4) |
274 | #define RME96_DAC_IS_1855(rme96) (((rme96)->pci->device == PCI_DEVICE_ID_DIGI96_8_PAD_OR_PST && (rme96)->rev < 4) || \ | 255 | #define RME96_DAC_IS_1855(rme96) (((rme96)->pci->device == PCI_DEVICE_ID_RME_DIGI96_8_PAD_OR_PST && (rme96)->rev < 4) || \ |
275 | ((rme96)->pci->device == PCI_DEVICE_ID_DIGI96_8_PRO && (rme96)->rev == 2)) | 256 | ((rme96)->pci->device == PCI_DEVICE_ID_RME_DIGI96_8_PRO && (rme96)->rev == 2)) |
276 | #define RME96_185X_MAX_OUT(rme96) ((1 << (RME96_DAC_IS_1852(rme96) ? RME96_AD1852_VOL_BITS : RME96_AD1855_VOL_BITS)) - 1) | 257 | #define RME96_185X_MAX_OUT(rme96) ((1 << (RME96_DAC_IS_1852(rme96) ? RME96_AD1852_VOL_BITS : RME96_AD1855_VOL_BITS)) - 1) |
277 | 258 | ||
278 | static int | 259 | static int |
@@ -849,9 +830,9 @@ snd_rme96_setinputtype(rme96_t *rme96, | |||
849 | RME96_WCR_INP_1; | 830 | RME96_WCR_INP_1; |
850 | break; | 831 | break; |
851 | case RME96_INPUT_XLR: | 832 | case RME96_INPUT_XLR: |
852 | if ((rme96->pci->device != PCI_DEVICE_ID_DIGI96_8_PAD_OR_PST && | 833 | if ((rme96->pci->device != PCI_DEVICE_ID_RME_DIGI96_8_PAD_OR_PST && |
853 | rme96->pci->device != PCI_DEVICE_ID_DIGI96_8_PRO) || | 834 | rme96->pci->device != PCI_DEVICE_ID_RME_DIGI96_8_PRO) || |
854 | (rme96->pci->device == PCI_DEVICE_ID_DIGI96_8_PAD_OR_PST && | 835 | (rme96->pci->device == PCI_DEVICE_ID_RME_DIGI96_8_PAD_OR_PST && |
855 | rme96->rev > 4)) | 836 | rme96->rev > 4)) |
856 | { | 837 | { |
857 | /* Only Digi96/8 PRO and Digi96/8 PAD supports XLR */ | 838 | /* Only Digi96/8 PRO and Digi96/8 PAD supports XLR */ |
@@ -985,7 +966,8 @@ snd_rme96_playback_hw_params(snd_pcm_substream_t *substream, | |||
985 | snd_pcm_runtime_t *runtime = substream->runtime; | 966 | snd_pcm_runtime_t *runtime = substream->runtime; |
986 | int err, rate, dummy; | 967 | int err, rate, dummy; |
987 | 968 | ||
988 | runtime->dma_area = (void *)(rme96->iobase + RME96_IO_PLAY_BUFFER); | 969 | runtime->dma_area = (void __force *)(rme96->iobase + |
970 | RME96_IO_PLAY_BUFFER); | ||
989 | runtime->dma_addr = rme96->port + RME96_IO_PLAY_BUFFER; | 971 | runtime->dma_addr = rme96->port + RME96_IO_PLAY_BUFFER; |
990 | runtime->dma_bytes = RME96_BUFFER_SIZE; | 972 | runtime->dma_bytes = RME96_BUFFER_SIZE; |
991 | 973 | ||
@@ -1037,7 +1019,8 @@ snd_rme96_capture_hw_params(snd_pcm_substream_t *substream, | |||
1037 | snd_pcm_runtime_t *runtime = substream->runtime; | 1019 | snd_pcm_runtime_t *runtime = substream->runtime; |
1038 | int err, isadat, rate; | 1020 | int err, isadat, rate; |
1039 | 1021 | ||
1040 | runtime->dma_area = (void *)(rme96->iobase + RME96_IO_REC_BUFFER); | 1022 | runtime->dma_area = (void __force *)(rme96->iobase + |
1023 | RME96_IO_REC_BUFFER); | ||
1041 | runtime->dma_addr = rme96->port + RME96_IO_REC_BUFFER; | 1024 | runtime->dma_addr = rme96->port + RME96_IO_REC_BUFFER; |
1042 | runtime->dma_bytes = RME96_BUFFER_SIZE; | 1025 | runtime->dma_bytes = RME96_BUFFER_SIZE; |
1043 | 1026 | ||
@@ -1615,7 +1598,7 @@ snd_rme96_create(rme96_t *rme96) | |||
1615 | rme96->spdif_pcm->info_flags = 0; | 1598 | rme96->spdif_pcm->info_flags = 0; |
1616 | 1599 | ||
1617 | /* set up ALSA pcm device for ADAT */ | 1600 | /* set up ALSA pcm device for ADAT */ |
1618 | if (pci->device == PCI_DEVICE_ID_DIGI96) { | 1601 | if (pci->device == PCI_DEVICE_ID_RME_DIGI96) { |
1619 | /* ADAT is not available on the base model */ | 1602 | /* ADAT is not available on the base model */ |
1620 | rme96->adat_pcm = NULL; | 1603 | rme96->adat_pcm = NULL; |
1621 | } else { | 1604 | } else { |
@@ -1875,14 +1858,14 @@ snd_rme96_info_inputtype_control(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * | |||
1875 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | 1858 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
1876 | uinfo->count = 1; | 1859 | uinfo->count = 1; |
1877 | switch (rme96->pci->device) { | 1860 | switch (rme96->pci->device) { |
1878 | case PCI_DEVICE_ID_DIGI96: | 1861 | case PCI_DEVICE_ID_RME_DIGI96: |
1879 | case PCI_DEVICE_ID_DIGI96_8: | 1862 | case PCI_DEVICE_ID_RME_DIGI96_8: |
1880 | uinfo->value.enumerated.items = 3; | 1863 | uinfo->value.enumerated.items = 3; |
1881 | break; | 1864 | break; |
1882 | case PCI_DEVICE_ID_DIGI96_8_PRO: | 1865 | case PCI_DEVICE_ID_RME_DIGI96_8_PRO: |
1883 | uinfo->value.enumerated.items = 4; | 1866 | uinfo->value.enumerated.items = 4; |
1884 | break; | 1867 | break; |
1885 | case PCI_DEVICE_ID_DIGI96_8_PAD_OR_PST: | 1868 | case PCI_DEVICE_ID_RME_DIGI96_8_PAD_OR_PST: |
1886 | if (rme96->rev > 4) { | 1869 | if (rme96->rev > 4) { |
1887 | /* PST */ | 1870 | /* PST */ |
1888 | uinfo->value.enumerated.items = 4; | 1871 | uinfo->value.enumerated.items = 4; |
@@ -1912,14 +1895,14 @@ snd_rme96_get_inputtype_control(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t | |||
1912 | ucontrol->value.enumerated.item[0] = snd_rme96_getinputtype(rme96); | 1895 | ucontrol->value.enumerated.item[0] = snd_rme96_getinputtype(rme96); |
1913 | 1896 | ||
1914 | switch (rme96->pci->device) { | 1897 | switch (rme96->pci->device) { |
1915 | case PCI_DEVICE_ID_DIGI96: | 1898 | case PCI_DEVICE_ID_RME_DIGI96: |
1916 | case PCI_DEVICE_ID_DIGI96_8: | 1899 | case PCI_DEVICE_ID_RME_DIGI96_8: |
1917 | items = 3; | 1900 | items = 3; |
1918 | break; | 1901 | break; |
1919 | case PCI_DEVICE_ID_DIGI96_8_PRO: | 1902 | case PCI_DEVICE_ID_RME_DIGI96_8_PRO: |
1920 | items = 4; | 1903 | items = 4; |
1921 | break; | 1904 | break; |
1922 | case PCI_DEVICE_ID_DIGI96_8_PAD_OR_PST: | 1905 | case PCI_DEVICE_ID_RME_DIGI96_8_PAD_OR_PST: |
1923 | if (rme96->rev > 4) { | 1906 | if (rme96->rev > 4) { |
1924 | /* for handling PST case, (INPUT_ANALOG is moved to INPUT_XLR */ | 1907 | /* for handling PST case, (INPUT_ANALOG is moved to INPUT_XLR */ |
1925 | if (ucontrol->value.enumerated.item[0] == RME96_INPUT_ANALOG) { | 1908 | if (ucontrol->value.enumerated.item[0] == RME96_INPUT_ANALOG) { |
@@ -1949,14 +1932,14 @@ snd_rme96_put_inputtype_control(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t | |||
1949 | int change, items = 3; | 1932 | int change, items = 3; |
1950 | 1933 | ||
1951 | switch (rme96->pci->device) { | 1934 | switch (rme96->pci->device) { |
1952 | case PCI_DEVICE_ID_DIGI96: | 1935 | case PCI_DEVICE_ID_RME_DIGI96: |
1953 | case PCI_DEVICE_ID_DIGI96_8: | 1936 | case PCI_DEVICE_ID_RME_DIGI96_8: |
1954 | items = 3; | 1937 | items = 3; |
1955 | break; | 1938 | break; |
1956 | case PCI_DEVICE_ID_DIGI96_8_PRO: | 1939 | case PCI_DEVICE_ID_RME_DIGI96_8_PRO: |
1957 | items = 4; | 1940 | items = 4; |
1958 | break; | 1941 | break; |
1959 | case PCI_DEVICE_ID_DIGI96_8_PAD_OR_PST: | 1942 | case PCI_DEVICE_ID_RME_DIGI96_8_PAD_OR_PST: |
1960 | if (rme96->rev > 4) { | 1943 | if (rme96->rev > 4) { |
1961 | items = 4; | 1944 | items = 4; |
1962 | } else { | 1945 | } else { |
@@ -1970,7 +1953,7 @@ snd_rme96_put_inputtype_control(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t | |||
1970 | val = ucontrol->value.enumerated.item[0] % items; | 1953 | val = ucontrol->value.enumerated.item[0] % items; |
1971 | 1954 | ||
1972 | /* special case for PST */ | 1955 | /* special case for PST */ |
1973 | if (rme96->pci->device == PCI_DEVICE_ID_DIGI96_8_PAD_OR_PST && rme96->rev > 4) { | 1956 | if (rme96->pci->device == PCI_DEVICE_ID_RME_DIGI96_8_PAD_OR_PST && rme96->rev > 4) { |
1974 | if (val == RME96_INPUT_XLR) { | 1957 | if (val == RME96_INPUT_XLR) { |
1975 | val = RME96_INPUT_ANALOG; | 1958 | val = RME96_INPUT_ANALOG; |
1976 | } | 1959 | } |
@@ -2266,7 +2249,7 @@ static snd_kcontrol_new_t snd_rme96_controls[] = { | |||
2266 | }, | 2249 | }, |
2267 | { | 2250 | { |
2268 | .access = SNDRV_CTL_ELEM_ACCESS_READ, | 2251 | .access = SNDRV_CTL_ELEM_ACCESS_READ, |
2269 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 2252 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, |
2270 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,CON_MASK), | 2253 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,CON_MASK), |
2271 | .info = snd_rme96_control_spdif_mask_info, | 2254 | .info = snd_rme96_control_spdif_mask_info, |
2272 | .get = snd_rme96_control_spdif_mask_get, | 2255 | .get = snd_rme96_control_spdif_mask_get, |
@@ -2276,7 +2259,7 @@ static snd_kcontrol_new_t snd_rme96_controls[] = { | |||
2276 | }, | 2259 | }, |
2277 | { | 2260 | { |
2278 | .access = SNDRV_CTL_ELEM_ACCESS_READ, | 2261 | .access = SNDRV_CTL_ELEM_ACCESS_READ, |
2279 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 2262 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, |
2280 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,PRO_MASK), | 2263 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,PRO_MASK), |
2281 | .info = snd_rme96_control_spdif_mask_info, | 2264 | .info = snd_rme96_control_spdif_mask_info, |
2282 | .get = snd_rme96_control_spdif_mask_get, | 2265 | .get = snd_rme96_control_spdif_mask_get, |
@@ -2392,16 +2375,16 @@ snd_rme96_probe(struct pci_dev *pci, | |||
2392 | 2375 | ||
2393 | strcpy(card->driver, "Digi96"); | 2376 | strcpy(card->driver, "Digi96"); |
2394 | switch (rme96->pci->device) { | 2377 | switch (rme96->pci->device) { |
2395 | case PCI_DEVICE_ID_DIGI96: | 2378 | case PCI_DEVICE_ID_RME_DIGI96: |
2396 | strcpy(card->shortname, "RME Digi96"); | 2379 | strcpy(card->shortname, "RME Digi96"); |
2397 | break; | 2380 | break; |
2398 | case PCI_DEVICE_ID_DIGI96_8: | 2381 | case PCI_DEVICE_ID_RME_DIGI96_8: |
2399 | strcpy(card->shortname, "RME Digi96/8"); | 2382 | strcpy(card->shortname, "RME Digi96/8"); |
2400 | break; | 2383 | break; |
2401 | case PCI_DEVICE_ID_DIGI96_8_PRO: | 2384 | case PCI_DEVICE_ID_RME_DIGI96_8_PRO: |
2402 | strcpy(card->shortname, "RME Digi96/8 PRO"); | 2385 | strcpy(card->shortname, "RME Digi96/8 PRO"); |
2403 | break; | 2386 | break; |
2404 | case PCI_DEVICE_ID_DIGI96_8_PAD_OR_PST: | 2387 | case PCI_DEVICE_ID_RME_DIGI96_8_PAD_OR_PST: |
2405 | pci_read_config_byte(rme96->pci, 8, &val); | 2388 | pci_read_config_byte(rme96->pci, 8, &val); |
2406 | if (val < 5) { | 2389 | if (val < 5) { |
2407 | strcpy(card->shortname, "RME Digi96/8 PAD"); | 2390 | strcpy(card->shortname, "RME Digi96/8 PAD"); |
@@ -2430,6 +2413,7 @@ static void __devexit snd_rme96_remove(struct pci_dev *pci) | |||
2430 | 2413 | ||
2431 | static struct pci_driver driver = { | 2414 | static struct pci_driver driver = { |
2432 | .name = "RME Digi96", | 2415 | .name = "RME Digi96", |
2416 | .owner = THIS_MODULE, | ||
2433 | .id_table = snd_rme96_ids, | 2417 | .id_table = snd_rme96_ids, |
2434 | .probe = snd_rme96_probe, | 2418 | .probe = snd_rme96_probe, |
2435 | .remove = __devexit_p(snd_rme96_remove), | 2419 | .remove = __devexit_p(snd_rme96_remove), |
diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c index 796621de5009..52525eb198c7 100644 --- a/sound/pci/rme9652/hdsp.c +++ b/sound/pci/rme9652/hdsp.c | |||
@@ -370,13 +370,6 @@ MODULE_SUPPORTED_DEVICE("{{RME Hammerfall-DSP}," | |||
370 | #define UNITY_GAIN 32768 | 370 | #define UNITY_GAIN 32768 |
371 | #define MINUS_INFINITY_GAIN 0 | 371 | #define MINUS_INFINITY_GAIN 0 |
372 | 372 | ||
373 | #ifndef PCI_VENDOR_ID_XILINX | ||
374 | #define PCI_VENDOR_ID_XILINX 0x10ee | ||
375 | #endif | ||
376 | #ifndef PCI_DEVICE_ID_XILINX_HAMMERFALL_DSP | ||
377 | #define PCI_DEVICE_ID_XILINX_HAMMERFALL_DSP 0x3fc5 | ||
378 | #endif | ||
379 | |||
380 | /* the size of a substream (1 mono data stream) */ | 373 | /* the size of a substream (1 mono data stream) */ |
381 | 374 | ||
382 | #define HDSP_CHANNEL_BUFFER_SAMPLES (16*1024) | 375 | #define HDSP_CHANNEL_BUFFER_SAMPLES (16*1024) |
@@ -1524,7 +1517,7 @@ static int snd_hdsp_control_spdif_mask_get(snd_kcontrol_t * kcontrol, snd_ctl_el | |||
1524 | } | 1517 | } |
1525 | 1518 | ||
1526 | #define HDSP_SPDIF_IN(xname, xindex) \ | 1519 | #define HDSP_SPDIF_IN(xname, xindex) \ |
1527 | { .iface = SNDRV_CTL_ELEM_IFACE_PCM, \ | 1520 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
1528 | .name = xname, \ | 1521 | .name = xname, \ |
1529 | .index = xindex, \ | 1522 | .index = xindex, \ |
1530 | .info = snd_hdsp_info_spdif_in, \ | 1523 | .info = snd_hdsp_info_spdif_in, \ |
@@ -1584,7 +1577,7 @@ static int snd_hdsp_put_spdif_in(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t | |||
1584 | } | 1577 | } |
1585 | 1578 | ||
1586 | #define HDSP_SPDIF_OUT(xname, xindex) \ | 1579 | #define HDSP_SPDIF_OUT(xname, xindex) \ |
1587 | { .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, .name = xname, .index = xindex, \ | 1580 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \ |
1588 | .info = snd_hdsp_info_spdif_bits, \ | 1581 | .info = snd_hdsp_info_spdif_bits, \ |
1589 | .get = snd_hdsp_get_spdif_out, .put = snd_hdsp_put_spdif_out } | 1582 | .get = snd_hdsp_get_spdif_out, .put = snd_hdsp_put_spdif_out } |
1590 | 1583 | ||
@@ -1638,7 +1631,7 @@ static int snd_hdsp_put_spdif_out(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_ | |||
1638 | } | 1631 | } |
1639 | 1632 | ||
1640 | #define HDSP_SPDIF_PROFESSIONAL(xname, xindex) \ | 1633 | #define HDSP_SPDIF_PROFESSIONAL(xname, xindex) \ |
1641 | { .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, .name = xname, .index = xindex, \ | 1634 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \ |
1642 | .info = snd_hdsp_info_spdif_bits, \ | 1635 | .info = snd_hdsp_info_spdif_bits, \ |
1643 | .get = snd_hdsp_get_spdif_professional, .put = snd_hdsp_put_spdif_professional } | 1636 | .get = snd_hdsp_get_spdif_professional, .put = snd_hdsp_put_spdif_professional } |
1644 | 1637 | ||
@@ -1683,7 +1676,7 @@ static int snd_hdsp_put_spdif_professional(snd_kcontrol_t * kcontrol, snd_ctl_el | |||
1683 | } | 1676 | } |
1684 | 1677 | ||
1685 | #define HDSP_SPDIF_EMPHASIS(xname, xindex) \ | 1678 | #define HDSP_SPDIF_EMPHASIS(xname, xindex) \ |
1686 | { .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, .name = xname, .index = xindex, \ | 1679 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \ |
1687 | .info = snd_hdsp_info_spdif_bits, \ | 1680 | .info = snd_hdsp_info_spdif_bits, \ |
1688 | .get = snd_hdsp_get_spdif_emphasis, .put = snd_hdsp_put_spdif_emphasis } | 1681 | .get = snd_hdsp_get_spdif_emphasis, .put = snd_hdsp_put_spdif_emphasis } |
1689 | 1682 | ||
@@ -1728,7 +1721,7 @@ static int snd_hdsp_put_spdif_emphasis(snd_kcontrol_t * kcontrol, snd_ctl_elem_v | |||
1728 | } | 1721 | } |
1729 | 1722 | ||
1730 | #define HDSP_SPDIF_NON_AUDIO(xname, xindex) \ | 1723 | #define HDSP_SPDIF_NON_AUDIO(xname, xindex) \ |
1731 | { .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, .name = xname, .index = xindex, \ | 1724 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \ |
1732 | .info = snd_hdsp_info_spdif_bits, \ | 1725 | .info = snd_hdsp_info_spdif_bits, \ |
1733 | .get = snd_hdsp_get_spdif_nonaudio, .put = snd_hdsp_put_spdif_nonaudio } | 1726 | .get = snd_hdsp_get_spdif_nonaudio, .put = snd_hdsp_put_spdif_nonaudio } |
1734 | 1727 | ||
@@ -1773,7 +1766,7 @@ static int snd_hdsp_put_spdif_nonaudio(snd_kcontrol_t * kcontrol, snd_ctl_elem_v | |||
1773 | } | 1766 | } |
1774 | 1767 | ||
1775 | #define HDSP_SPDIF_SAMPLE_RATE(xname, xindex) \ | 1768 | #define HDSP_SPDIF_SAMPLE_RATE(xname, xindex) \ |
1776 | { .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \ | 1769 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
1777 | .name = xname, \ | 1770 | .name = xname, \ |
1778 | .index = xindex, \ | 1771 | .index = xindex, \ |
1779 | .access = SNDRV_CTL_ELEM_ACCESS_READ, \ | 1772 | .access = SNDRV_CTL_ELEM_ACCESS_READ, \ |
@@ -1834,7 +1827,7 @@ static int snd_hdsp_get_spdif_sample_rate(snd_kcontrol_t * kcontrol, snd_ctl_ele | |||
1834 | } | 1827 | } |
1835 | 1828 | ||
1836 | #define HDSP_SYSTEM_SAMPLE_RATE(xname, xindex) \ | 1829 | #define HDSP_SYSTEM_SAMPLE_RATE(xname, xindex) \ |
1837 | { .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \ | 1830 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
1838 | .name = xname, \ | 1831 | .name = xname, \ |
1839 | .index = xindex, \ | 1832 | .index = xindex, \ |
1840 | .access = SNDRV_CTL_ELEM_ACCESS_READ, \ | 1833 | .access = SNDRV_CTL_ELEM_ACCESS_READ, \ |
@@ -1858,7 +1851,7 @@ static int snd_hdsp_get_system_sample_rate(snd_kcontrol_t * kcontrol, snd_ctl_el | |||
1858 | } | 1851 | } |
1859 | 1852 | ||
1860 | #define HDSP_AUTOSYNC_SAMPLE_RATE(xname, xindex) \ | 1853 | #define HDSP_AUTOSYNC_SAMPLE_RATE(xname, xindex) \ |
1861 | { .iface = SNDRV_CTL_ELEM_IFACE_PCM, \ | 1854 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
1862 | .name = xname, \ | 1855 | .name = xname, \ |
1863 | .index = xindex, \ | 1856 | .index = xindex, \ |
1864 | .access = SNDRV_CTL_ELEM_ACCESS_READ, \ | 1857 | .access = SNDRV_CTL_ELEM_ACCESS_READ, \ |
@@ -1918,7 +1911,7 @@ static int snd_hdsp_get_autosync_sample_rate(snd_kcontrol_t * kcontrol, snd_ctl_ | |||
1918 | } | 1911 | } |
1919 | 1912 | ||
1920 | #define HDSP_SYSTEM_CLOCK_MODE(xname, xindex) \ | 1913 | #define HDSP_SYSTEM_CLOCK_MODE(xname, xindex) \ |
1921 | { .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \ | 1914 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
1922 | .name = xname, \ | 1915 | .name = xname, \ |
1923 | .index = xindex, \ | 1916 | .index = xindex, \ |
1924 | .access = SNDRV_CTL_ELEM_ACCESS_READ, \ | 1917 | .access = SNDRV_CTL_ELEM_ACCESS_READ, \ |
@@ -1958,7 +1951,7 @@ static int snd_hdsp_get_system_clock_mode(snd_kcontrol_t * kcontrol, snd_ctl_ele | |||
1958 | } | 1951 | } |
1959 | 1952 | ||
1960 | #define HDSP_CLOCK_SOURCE(xname, xindex) \ | 1953 | #define HDSP_CLOCK_SOURCE(xname, xindex) \ |
1961 | { .iface = SNDRV_CTL_ELEM_IFACE_PCM, \ | 1954 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
1962 | .name = xname, \ | 1955 | .name = xname, \ |
1963 | .index = xindex, \ | 1956 | .index = xindex, \ |
1964 | .info = snd_hdsp_info_clock_source, \ | 1957 | .info = snd_hdsp_info_clock_source, \ |
@@ -2124,7 +2117,7 @@ static int snd_hdsp_put_clock_source_lock(snd_kcontrol_t * kcontrol, snd_ctl_ele | |||
2124 | } | 2117 | } |
2125 | 2118 | ||
2126 | #define HDSP_DA_GAIN(xname, xindex) \ | 2119 | #define HDSP_DA_GAIN(xname, xindex) \ |
2127 | { .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \ | 2120 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
2128 | .name = xname, \ | 2121 | .name = xname, \ |
2129 | .index = xindex, \ | 2122 | .index = xindex, \ |
2130 | .info = snd_hdsp_info_da_gain, \ | 2123 | .info = snd_hdsp_info_da_gain, \ |
@@ -2210,7 +2203,7 @@ static int snd_hdsp_put_da_gain(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t | |||
2210 | } | 2203 | } |
2211 | 2204 | ||
2212 | #define HDSP_AD_GAIN(xname, xindex) \ | 2205 | #define HDSP_AD_GAIN(xname, xindex) \ |
2213 | { .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \ | 2206 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
2214 | .name = xname, \ | 2207 | .name = xname, \ |
2215 | .index = xindex, \ | 2208 | .index = xindex, \ |
2216 | .info = snd_hdsp_info_ad_gain, \ | 2209 | .info = snd_hdsp_info_ad_gain, \ |
@@ -2296,7 +2289,7 @@ static int snd_hdsp_put_ad_gain(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t | |||
2296 | } | 2289 | } |
2297 | 2290 | ||
2298 | #define HDSP_PHONE_GAIN(xname, xindex) \ | 2291 | #define HDSP_PHONE_GAIN(xname, xindex) \ |
2299 | { .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \ | 2292 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
2300 | .name = xname, \ | 2293 | .name = xname, \ |
2301 | .index = xindex, \ | 2294 | .index = xindex, \ |
2302 | .info = snd_hdsp_info_phone_gain, \ | 2295 | .info = snd_hdsp_info_phone_gain, \ |
@@ -2382,7 +2375,7 @@ static int snd_hdsp_put_phone_gain(snd_kcontrol_t * kcontrol, snd_ctl_elem_value | |||
2382 | } | 2375 | } |
2383 | 2376 | ||
2384 | #define HDSP_XLR_BREAKOUT_CABLE(xname, xindex) \ | 2377 | #define HDSP_XLR_BREAKOUT_CABLE(xname, xindex) \ |
2385 | { .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \ | 2378 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
2386 | .name = xname, \ | 2379 | .name = xname, \ |
2387 | .index = xindex, \ | 2380 | .index = xindex, \ |
2388 | .info = snd_hdsp_info_xlr_breakout_cable, \ | 2381 | .info = snd_hdsp_info_xlr_breakout_cable, \ |
@@ -2447,7 +2440,7 @@ static int snd_hdsp_put_xlr_breakout_cable(snd_kcontrol_t * kcontrol, snd_ctl_el | |||
2447 | Switching this on desactivates external ADAT | 2440 | Switching this on desactivates external ADAT |
2448 | */ | 2441 | */ |
2449 | #define HDSP_AEB(xname, xindex) \ | 2442 | #define HDSP_AEB(xname, xindex) \ |
2450 | { .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \ | 2443 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
2451 | .name = xname, \ | 2444 | .name = xname, \ |
2452 | .index = xindex, \ | 2445 | .index = xindex, \ |
2453 | .info = snd_hdsp_info_aeb, \ | 2446 | .info = snd_hdsp_info_aeb, \ |
@@ -2508,7 +2501,7 @@ static int snd_hdsp_put_aeb(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * uc | |||
2508 | } | 2501 | } |
2509 | 2502 | ||
2510 | #define HDSP_PREF_SYNC_REF(xname, xindex) \ | 2503 | #define HDSP_PREF_SYNC_REF(xname, xindex) \ |
2511 | { .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \ | 2504 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
2512 | .name = xname, \ | 2505 | .name = xname, \ |
2513 | .index = xindex, \ | 2506 | .index = xindex, \ |
2514 | .info = snd_hdsp_info_pref_sync_ref, \ | 2507 | .info = snd_hdsp_info_pref_sync_ref, \ |
@@ -2641,7 +2634,7 @@ static int snd_hdsp_put_pref_sync_ref(snd_kcontrol_t * kcontrol, snd_ctl_elem_va | |||
2641 | } | 2634 | } |
2642 | 2635 | ||
2643 | #define HDSP_AUTOSYNC_REF(xname, xindex) \ | 2636 | #define HDSP_AUTOSYNC_REF(xname, xindex) \ |
2644 | { .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \ | 2637 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
2645 | .name = xname, \ | 2638 | .name = xname, \ |
2646 | .index = xindex, \ | 2639 | .index = xindex, \ |
2647 | .access = SNDRV_CTL_ELEM_ACCESS_READ, \ | 2640 | .access = SNDRV_CTL_ELEM_ACCESS_READ, \ |
@@ -2697,7 +2690,7 @@ static int snd_hdsp_get_autosync_ref(snd_kcontrol_t * kcontrol, snd_ctl_elem_val | |||
2697 | } | 2690 | } |
2698 | 2691 | ||
2699 | #define HDSP_LINE_OUT(xname, xindex) \ | 2692 | #define HDSP_LINE_OUT(xname, xindex) \ |
2700 | { .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \ | 2693 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
2701 | .name = xname, \ | 2694 | .name = xname, \ |
2702 | .index = xindex, \ | 2695 | .index = xindex, \ |
2703 | .info = snd_hdsp_info_line_out, \ | 2696 | .info = snd_hdsp_info_line_out, \ |
@@ -2757,7 +2750,7 @@ static int snd_hdsp_put_line_out(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t | |||
2757 | } | 2750 | } |
2758 | 2751 | ||
2759 | #define HDSP_PRECISE_POINTER(xname, xindex) \ | 2752 | #define HDSP_PRECISE_POINTER(xname, xindex) \ |
2760 | { .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \ | 2753 | { .iface = SNDRV_CTL_ELEM_IFACE_CARD, \ |
2761 | .name = xname, \ | 2754 | .name = xname, \ |
2762 | .index = xindex, \ | 2755 | .index = xindex, \ |
2763 | .info = snd_hdsp_info_precise_pointer, \ | 2756 | .info = snd_hdsp_info_precise_pointer, \ |
@@ -2811,7 +2804,7 @@ static int snd_hdsp_put_precise_pointer(snd_kcontrol_t * kcontrol, snd_ctl_elem_ | |||
2811 | } | 2804 | } |
2812 | 2805 | ||
2813 | #define HDSP_USE_MIDI_TASKLET(xname, xindex) \ | 2806 | #define HDSP_USE_MIDI_TASKLET(xname, xindex) \ |
2814 | { .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \ | 2807 | { .iface = SNDRV_CTL_ELEM_IFACE_CARD, \ |
2815 | .name = xname, \ | 2808 | .name = xname, \ |
2816 | .index = xindex, \ | 2809 | .index = xindex, \ |
2817 | .info = snd_hdsp_info_use_midi_tasklet, \ | 2810 | .info = snd_hdsp_info_use_midi_tasklet, \ |
@@ -2868,6 +2861,7 @@ static int snd_hdsp_put_use_midi_tasklet(snd_kcontrol_t * kcontrol, snd_ctl_elem | |||
2868 | { .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \ | 2861 | { .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \ |
2869 | .name = xname, \ | 2862 | .name = xname, \ |
2870 | .index = xindex, \ | 2863 | .index = xindex, \ |
2864 | .device = 0, \ | ||
2871 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | \ | 2865 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | \ |
2872 | SNDRV_CTL_ELEM_ACCESS_VOLATILE, \ | 2866 | SNDRV_CTL_ELEM_ACCESS_VOLATILE, \ |
2873 | .info = snd_hdsp_info_mixer, \ | 2867 | .info = snd_hdsp_info_mixer, \ |
@@ -2939,7 +2933,7 @@ static int snd_hdsp_put_mixer(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * | |||
2939 | } | 2933 | } |
2940 | 2934 | ||
2941 | #define HDSP_WC_SYNC_CHECK(xname, xindex) \ | 2935 | #define HDSP_WC_SYNC_CHECK(xname, xindex) \ |
2942 | { .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \ | 2936 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
2943 | .name = xname, \ | 2937 | .name = xname, \ |
2944 | .index = xindex, \ | 2938 | .index = xindex, \ |
2945 | .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, \ | 2939 | .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, \ |
@@ -2983,7 +2977,7 @@ static int snd_hdsp_get_wc_sync_check(snd_kcontrol_t * kcontrol, snd_ctl_elem_va | |||
2983 | } | 2977 | } |
2984 | 2978 | ||
2985 | #define HDSP_SPDIF_SYNC_CHECK(xname, xindex) \ | 2979 | #define HDSP_SPDIF_SYNC_CHECK(xname, xindex) \ |
2986 | { .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \ | 2980 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
2987 | .name = xname, \ | 2981 | .name = xname, \ |
2988 | .index = xindex, \ | 2982 | .index = xindex, \ |
2989 | .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, \ | 2983 | .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, \ |
@@ -3015,7 +3009,7 @@ static int snd_hdsp_get_spdif_sync_check(snd_kcontrol_t * kcontrol, snd_ctl_elem | |||
3015 | } | 3009 | } |
3016 | 3010 | ||
3017 | #define HDSP_ADATSYNC_SYNC_CHECK(xname, xindex) \ | 3011 | #define HDSP_ADATSYNC_SYNC_CHECK(xname, xindex) \ |
3018 | { .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \ | 3012 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
3019 | .name = xname, \ | 3013 | .name = xname, \ |
3020 | .index = xindex, \ | 3014 | .index = xindex, \ |
3021 | .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, \ | 3015 | .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, \ |
@@ -3046,7 +3040,7 @@ static int snd_hdsp_get_adatsync_sync_check(snd_kcontrol_t * kcontrol, snd_ctl_e | |||
3046 | } | 3040 | } |
3047 | 3041 | ||
3048 | #define HDSP_ADAT_SYNC_CHECK \ | 3042 | #define HDSP_ADAT_SYNC_CHECK \ |
3049 | { .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \ | 3043 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
3050 | .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, \ | 3044 | .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, \ |
3051 | .info = snd_hdsp_info_sync_check, \ | 3045 | .info = snd_hdsp_info_sync_check, \ |
3052 | .get = snd_hdsp_get_adat_sync_check \ | 3046 | .get = snd_hdsp_get_adat_sync_check \ |
@@ -3119,7 +3113,7 @@ static snd_kcontrol_new_t snd_hdsp_controls[] = { | |||
3119 | }, | 3113 | }, |
3120 | { | 3114 | { |
3121 | .access = SNDRV_CTL_ELEM_ACCESS_READ, | 3115 | .access = SNDRV_CTL_ELEM_ACCESS_READ, |
3122 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 3116 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, |
3123 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,CON_MASK), | 3117 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,CON_MASK), |
3124 | .info = snd_hdsp_control_spdif_mask_info, | 3118 | .info = snd_hdsp_control_spdif_mask_info, |
3125 | .get = snd_hdsp_control_spdif_mask_get, | 3119 | .get = snd_hdsp_control_spdif_mask_get, |
@@ -3129,7 +3123,7 @@ static snd_kcontrol_new_t snd_hdsp_controls[] = { | |||
3129 | }, | 3123 | }, |
3130 | { | 3124 | { |
3131 | .access = SNDRV_CTL_ELEM_ACCESS_READ, | 3125 | .access = SNDRV_CTL_ELEM_ACCESS_READ, |
3132 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 3126 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, |
3133 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,PRO_MASK), | 3127 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,PRO_MASK), |
3134 | .info = snd_hdsp_control_spdif_mask_info, | 3128 | .info = snd_hdsp_control_spdif_mask_info, |
3135 | .get = snd_hdsp_control_spdif_mask_get, | 3129 | .get = snd_hdsp_control_spdif_mask_get, |
@@ -3146,8 +3140,6 @@ HDSP_SPDIF_NON_AUDIO("IEC958 Non-audio Bit", 0), | |||
3146 | /* 'Sample Clock Source' complies with the alsa control naming scheme */ | 3140 | /* 'Sample Clock Source' complies with the alsa control naming scheme */ |
3147 | HDSP_CLOCK_SOURCE("Sample Clock Source", 0), | 3141 | HDSP_CLOCK_SOURCE("Sample Clock Source", 0), |
3148 | { | 3142 | { |
3149 | /* FIXME: should be PCM or MIXER? */ | ||
3150 | /* .iface = SNDRV_CTL_ELEM_IFACE_PCM, */ | ||
3151 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 3143 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
3152 | .name = "Sample Clock Source Locking", | 3144 | .name = "Sample Clock Source Locking", |
3153 | .info = snd_hdsp_info_clock_source_lock, | 3145 | .info = snd_hdsp_info_clock_source_lock, |
@@ -4900,6 +4892,7 @@ static int snd_hdsp_create_alsa_devices(snd_card_t *card, hdsp_t *hdsp) | |||
4900 | } | 4892 | } |
4901 | 4893 | ||
4902 | if (!(hdsp->state & HDSP_InitializationComplete)) { | 4894 | if (!(hdsp->state & HDSP_InitializationComplete)) { |
4895 | strcpy(card->shortname, "Hammerfall DSP"); | ||
4903 | sprintf(card->longname, "%s at 0x%lx, irq %d", hdsp->card_name, | 4896 | sprintf(card->longname, "%s at 0x%lx, irq %d", hdsp->card_name, |
4904 | hdsp->port, hdsp->irq); | 4897 | hdsp->port, hdsp->irq); |
4905 | 4898 | ||
@@ -5223,6 +5216,7 @@ static void __devexit snd_hdsp_remove(struct pci_dev *pci) | |||
5223 | 5216 | ||
5224 | static struct pci_driver driver = { | 5217 | static struct pci_driver driver = { |
5225 | .name = "RME Hammerfall DSP", | 5218 | .name = "RME Hammerfall DSP", |
5219 | .owner = THIS_MODULE, | ||
5226 | .id_table = snd_hdsp_ids, | 5220 | .id_table = snd_hdsp_ids, |
5227 | .probe = snd_hdsp_probe, | 5221 | .probe = snd_hdsp_probe, |
5228 | .remove = __devexit_p(snd_hdsp_remove), | 5222 | .remove = __devexit_p(snd_hdsp_remove), |
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c index 9e86d0eb41ce..fc3f3283ff37 100644 --- a/sound/pci/rme9652/hdspm.c +++ b/sound/pci/rme9652/hdspm.c | |||
@@ -65,7 +65,7 @@ module_param_array(enable, bool, NULL, 0444); | |||
65 | MODULE_PARM_DESC(enable, "Enable/disable specific HDSPM soundcards."); | 65 | MODULE_PARM_DESC(enable, "Enable/disable specific HDSPM soundcards."); |
66 | 66 | ||
67 | module_param_array(precise_ptr, bool, NULL, 0444); | 67 | module_param_array(precise_ptr, bool, NULL, 0444); |
68 | MODULE_PARM_DESC(precise_ptr, "Enable precise pointer, or disable."); | 68 | MODULE_PARM_DESC(precise_ptr, "Enable or disable precise pointer."); |
69 | 69 | ||
70 | module_param_array(line_outs_monitor, bool, NULL, 0444); | 70 | module_param_array(line_outs_monitor, bool, NULL, 0444); |
71 | MODULE_PARM_DESC(line_outs_monitor, | 71 | MODULE_PARM_DESC(line_outs_monitor, |
@@ -301,18 +301,6 @@ MODULE_SUPPORTED_DEVICE("{{RME HDSPM-MADI}}"); | |||
301 | #define UNITY_GAIN 32768 /* = 65536/2 */ | 301 | #define UNITY_GAIN 32768 /* = 65536/2 */ |
302 | #define MINUS_INFINITY_GAIN 0 | 302 | #define MINUS_INFINITY_GAIN 0 |
303 | 303 | ||
304 | /* PCI info */ | ||
305 | #ifndef PCI_VENDOR_ID_XILINX | ||
306 | #define PCI_VENDOR_ID_XILINX 0x10ee | ||
307 | #endif | ||
308 | #ifndef PCI_DEVICE_ID_XILINX_HAMMERFALL_DSP | ||
309 | #define PCI_DEVICE_ID_XILINX_HAMMERFALL_DSP 0x3fc5 | ||
310 | #endif | ||
311 | #ifndef PCI_DEVICE_ID_XILINX_HAMMERFALL_DSP_MADI | ||
312 | #define PCI_DEVICE_ID_XILINX_HAMMERFALL_DSP_MADI 0x3fc6 | ||
313 | #endif | ||
314 | |||
315 | |||
316 | /* Number of channels for different Speed Modes */ | 304 | /* Number of channels for different Speed Modes */ |
317 | #define MADI_SS_CHANNELS 64 | 305 | #define MADI_SS_CHANNELS 64 |
318 | #define MADI_DS_CHANNELS 32 | 306 | #define MADI_DS_CHANNELS 32 |
@@ -1104,14 +1092,14 @@ static int snd_hdspm_midi_output_close(snd_rawmidi_substream_t * substream) | |||
1104 | return 0; | 1092 | return 0; |
1105 | } | 1093 | } |
1106 | 1094 | ||
1107 | snd_rawmidi_ops_t snd_hdspm_midi_output = | 1095 | static snd_rawmidi_ops_t snd_hdspm_midi_output = |
1108 | { | 1096 | { |
1109 | .open = snd_hdspm_midi_output_open, | 1097 | .open = snd_hdspm_midi_output_open, |
1110 | .close = snd_hdspm_midi_output_close, | 1098 | .close = snd_hdspm_midi_output_close, |
1111 | .trigger = snd_hdspm_midi_output_trigger, | 1099 | .trigger = snd_hdspm_midi_output_trigger, |
1112 | }; | 1100 | }; |
1113 | 1101 | ||
1114 | snd_rawmidi_ops_t snd_hdspm_midi_input = | 1102 | static snd_rawmidi_ops_t snd_hdspm_midi_input = |
1115 | { | 1103 | { |
1116 | .open = snd_hdspm_midi_input_open, | 1104 | .open = snd_hdspm_midi_input_open, |
1117 | .close = snd_hdspm_midi_input_close, | 1105 | .close = snd_hdspm_midi_input_close, |
@@ -1168,7 +1156,7 @@ static void hdspm_midi_tasklet(unsigned long arg) | |||
1168 | /* get the system sample rate which is set */ | 1156 | /* get the system sample rate which is set */ |
1169 | 1157 | ||
1170 | #define HDSPM_SYSTEM_SAMPLE_RATE(xname, xindex) \ | 1158 | #define HDSPM_SYSTEM_SAMPLE_RATE(xname, xindex) \ |
1171 | { .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \ | 1159 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
1172 | .name = xname, \ | 1160 | .name = xname, \ |
1173 | .index = xindex, \ | 1161 | .index = xindex, \ |
1174 | .access = SNDRV_CTL_ELEM_ACCESS_READ, \ | 1162 | .access = SNDRV_CTL_ELEM_ACCESS_READ, \ |
@@ -1195,7 +1183,7 @@ static int snd_hdspm_get_system_sample_rate(snd_kcontrol_t * kcontrol, | |||
1195 | } | 1183 | } |
1196 | 1184 | ||
1197 | #define HDSPM_AUTOSYNC_SAMPLE_RATE(xname, xindex) \ | 1185 | #define HDSPM_AUTOSYNC_SAMPLE_RATE(xname, xindex) \ |
1198 | { .iface = SNDRV_CTL_ELEM_IFACE_PCM, \ | 1186 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
1199 | .name = xname, \ | 1187 | .name = xname, \ |
1200 | .index = xindex, \ | 1188 | .index = xindex, \ |
1201 | .access = SNDRV_CTL_ELEM_ACCESS_READ, \ | 1189 | .access = SNDRV_CTL_ELEM_ACCESS_READ, \ |
@@ -1264,7 +1252,7 @@ static int snd_hdspm_get_autosync_sample_rate(snd_kcontrol_t * kcontrol, | |||
1264 | } | 1252 | } |
1265 | 1253 | ||
1266 | #define HDSPM_SYSTEM_CLOCK_MODE(xname, xindex) \ | 1254 | #define HDSPM_SYSTEM_CLOCK_MODE(xname, xindex) \ |
1267 | { .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \ | 1255 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
1268 | .name = xname, \ | 1256 | .name = xname, \ |
1269 | .index = xindex, \ | 1257 | .index = xindex, \ |
1270 | .access = SNDRV_CTL_ELEM_ACCESS_READ, \ | 1258 | .access = SNDRV_CTL_ELEM_ACCESS_READ, \ |
@@ -1310,7 +1298,7 @@ static int snd_hdspm_get_system_clock_mode(snd_kcontrol_t * kcontrol, | |||
1310 | } | 1298 | } |
1311 | 1299 | ||
1312 | #define HDSPM_CLOCK_SOURCE(xname, xindex) \ | 1300 | #define HDSPM_CLOCK_SOURCE(xname, xindex) \ |
1313 | { .iface = SNDRV_CTL_ELEM_IFACE_PCM, \ | 1301 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
1314 | .name = xname, \ | 1302 | .name = xname, \ |
1315 | .index = xindex, \ | 1303 | .index = xindex, \ |
1316 | .info = snd_hdspm_info_clock_source, \ | 1304 | .info = snd_hdspm_info_clock_source, \ |
@@ -1457,7 +1445,7 @@ static int snd_hdspm_put_clock_source(snd_kcontrol_t * kcontrol, | |||
1457 | } | 1445 | } |
1458 | 1446 | ||
1459 | #define HDSPM_PREF_SYNC_REF(xname, xindex) \ | 1447 | #define HDSPM_PREF_SYNC_REF(xname, xindex) \ |
1460 | { .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \ | 1448 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
1461 | .name = xname, \ | 1449 | .name = xname, \ |
1462 | .index = xindex, \ | 1450 | .index = xindex, \ |
1463 | .info = snd_hdspm_info_pref_sync_ref, \ | 1451 | .info = snd_hdspm_info_pref_sync_ref, \ |
@@ -1547,7 +1535,7 @@ static int snd_hdspm_put_pref_sync_ref(snd_kcontrol_t * kcontrol, | |||
1547 | } | 1535 | } |
1548 | 1536 | ||
1549 | #define HDSPM_AUTOSYNC_REF(xname, xindex) \ | 1537 | #define HDSPM_AUTOSYNC_REF(xname, xindex) \ |
1550 | { .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \ | 1538 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
1551 | .name = xname, \ | 1539 | .name = xname, \ |
1552 | .index = xindex, \ | 1540 | .index = xindex, \ |
1553 | .access = SNDRV_CTL_ELEM_ACCESS_READ, \ | 1541 | .access = SNDRV_CTL_ELEM_ACCESS_READ, \ |
@@ -1604,7 +1592,7 @@ static int snd_hdspm_get_autosync_ref(snd_kcontrol_t * kcontrol, | |||
1604 | } | 1592 | } |
1605 | 1593 | ||
1606 | #define HDSPM_LINE_OUT(xname, xindex) \ | 1594 | #define HDSPM_LINE_OUT(xname, xindex) \ |
1607 | { .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \ | 1595 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
1608 | .name = xname, \ | 1596 | .name = xname, \ |
1609 | .index = xindex, \ | 1597 | .index = xindex, \ |
1610 | .info = snd_hdspm_info_line_out, \ | 1598 | .info = snd_hdspm_info_line_out, \ |
@@ -1668,7 +1656,7 @@ static int snd_hdspm_put_line_out(snd_kcontrol_t * kcontrol, | |||
1668 | } | 1656 | } |
1669 | 1657 | ||
1670 | #define HDSPM_TX_64(xname, xindex) \ | 1658 | #define HDSPM_TX_64(xname, xindex) \ |
1671 | { .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \ | 1659 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
1672 | .name = xname, \ | 1660 | .name = xname, \ |
1673 | .index = xindex, \ | 1661 | .index = xindex, \ |
1674 | .info = snd_hdspm_info_tx_64, \ | 1662 | .info = snd_hdspm_info_tx_64, \ |
@@ -1731,7 +1719,7 @@ static int snd_hdspm_put_tx_64(snd_kcontrol_t * kcontrol, | |||
1731 | } | 1719 | } |
1732 | 1720 | ||
1733 | #define HDSPM_C_TMS(xname, xindex) \ | 1721 | #define HDSPM_C_TMS(xname, xindex) \ |
1734 | { .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \ | 1722 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
1735 | .name = xname, \ | 1723 | .name = xname, \ |
1736 | .index = xindex, \ | 1724 | .index = xindex, \ |
1737 | .info = snd_hdspm_info_c_tms, \ | 1725 | .info = snd_hdspm_info_c_tms, \ |
@@ -1794,7 +1782,7 @@ static int snd_hdspm_put_c_tms(snd_kcontrol_t * kcontrol, | |||
1794 | } | 1782 | } |
1795 | 1783 | ||
1796 | #define HDSPM_SAFE_MODE(xname, xindex) \ | 1784 | #define HDSPM_SAFE_MODE(xname, xindex) \ |
1797 | { .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \ | 1785 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
1798 | .name = xname, \ | 1786 | .name = xname, \ |
1799 | .index = xindex, \ | 1787 | .index = xindex, \ |
1800 | .info = snd_hdspm_info_safe_mode, \ | 1788 | .info = snd_hdspm_info_safe_mode, \ |
@@ -1857,7 +1845,7 @@ static int snd_hdspm_put_safe_mode(snd_kcontrol_t * kcontrol, | |||
1857 | } | 1845 | } |
1858 | 1846 | ||
1859 | #define HDSPM_INPUT_SELECT(xname, xindex) \ | 1847 | #define HDSPM_INPUT_SELECT(xname, xindex) \ |
1860 | { .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \ | 1848 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
1861 | .name = xname, \ | 1849 | .name = xname, \ |
1862 | .index = xindex, \ | 1850 | .index = xindex, \ |
1863 | .info = snd_hdspm_info_input_select, \ | 1851 | .info = snd_hdspm_info_input_select, \ |
@@ -1941,6 +1929,7 @@ static int snd_hdspm_put_input_select(snd_kcontrol_t * kcontrol, | |||
1941 | { .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \ | 1929 | { .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \ |
1942 | .name = xname, \ | 1930 | .name = xname, \ |
1943 | .index = xindex, \ | 1931 | .index = xindex, \ |
1932 | .device = 0, \ | ||
1944 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | \ | 1933 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | \ |
1945 | SNDRV_CTL_ELEM_ACCESS_VOLATILE, \ | 1934 | SNDRV_CTL_ELEM_ACCESS_VOLATILE, \ |
1946 | .info = snd_hdspm_info_mixer, \ | 1935 | .info = snd_hdspm_info_mixer, \ |
@@ -2124,7 +2113,7 @@ static int snd_hdspm_put_playback_mixer(snd_kcontrol_t * kcontrol, | |||
2124 | } | 2113 | } |
2125 | 2114 | ||
2126 | #define HDSPM_WC_SYNC_CHECK(xname, xindex) \ | 2115 | #define HDSPM_WC_SYNC_CHECK(xname, xindex) \ |
2127 | { .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \ | 2116 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
2128 | .name = xname, \ | 2117 | .name = xname, \ |
2129 | .index = xindex, \ | 2118 | .index = xindex, \ |
2130 | .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, \ | 2119 | .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, \ |
@@ -2170,7 +2159,7 @@ static int snd_hdspm_get_wc_sync_check(snd_kcontrol_t * kcontrol, | |||
2170 | 2159 | ||
2171 | 2160 | ||
2172 | #define HDSPM_MADI_SYNC_CHECK(xname, xindex) \ | 2161 | #define HDSPM_MADI_SYNC_CHECK(xname, xindex) \ |
2173 | { .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \ | 2162 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
2174 | .name = xname, \ | 2163 | .name = xname, \ |
2175 | .index = xindex, \ | 2164 | .index = xindex, \ |
2176 | .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, \ | 2165 | .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, \ |
@@ -3651,6 +3640,7 @@ static void __devexit snd_hdspm_remove(struct pci_dev *pci) | |||
3651 | 3640 | ||
3652 | static struct pci_driver driver = { | 3641 | static struct pci_driver driver = { |
3653 | .name = "RME Hammerfall DSP MADI", | 3642 | .name = "RME Hammerfall DSP MADI", |
3643 | .owner = THIS_MODULE, | ||
3654 | .id_table = snd_hdspm_ids, | 3644 | .id_table = snd_hdspm_ids, |
3655 | .probe = snd_hdspm_probe, | 3645 | .probe = snd_hdspm_probe, |
3656 | .remove = __devexit_p(snd_hdspm_remove), | 3646 | .remove = __devexit_p(snd_hdspm_remove), |
diff --git a/sound/pci/rme9652/rme9652.c b/sound/pci/rme9652/rme9652.c index 1bc9d0df8516..b600f45e1834 100644 --- a/sound/pci/rme9652/rme9652.c +++ b/sound/pci/rme9652/rme9652.c | |||
@@ -120,13 +120,6 @@ MODULE_SUPPORTED_DEVICE("{{RME,Hammerfall}," | |||
120 | 120 | ||
121 | #define RME9652_REV15_buf_pos(x) ((((x)&0xE0000000)>>26)|((x)&RME9652_buf_pos)) | 121 | #define RME9652_REV15_buf_pos(x) ((((x)&0xE0000000)>>26)|((x)&RME9652_buf_pos)) |
122 | 122 | ||
123 | #ifndef PCI_VENDOR_ID_XILINX | ||
124 | #define PCI_VENDOR_ID_XILINX 0x10ee | ||
125 | #endif | ||
126 | #ifndef PCI_DEVICE_ID_XILINX_HAMMERFALL | ||
127 | #define PCI_DEVICE_ID_XILINX_HAMMERFALL 0x3fc4 | ||
128 | #endif | ||
129 | |||
130 | /* amount of io space we remap for register access. i'm not sure we | 123 | /* amount of io space we remap for register access. i'm not sure we |
131 | even need this much, but 1K is nice round number :) | 124 | even need this much, but 1K is nice round number :) |
132 | */ | 125 | */ |
@@ -893,7 +886,7 @@ static int snd_rme9652_control_spdif_mask_get(snd_kcontrol_t * kcontrol, snd_ctl | |||
893 | } | 886 | } |
894 | 887 | ||
895 | #define RME9652_ADAT1_IN(xname, xindex) \ | 888 | #define RME9652_ADAT1_IN(xname, xindex) \ |
896 | { .iface = SNDRV_CTL_ELEM_IFACE_PCM, .name = xname, .index = xindex, \ | 889 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \ |
897 | .info = snd_rme9652_info_adat1_in, \ | 890 | .info = snd_rme9652_info_adat1_in, \ |
898 | .get = snd_rme9652_get_adat1_in, \ | 891 | .get = snd_rme9652_get_adat1_in, \ |
899 | .put = snd_rme9652_put_adat1_in } | 892 | .put = snd_rme9652_put_adat1_in } |
@@ -971,7 +964,7 @@ static int snd_rme9652_put_adat1_in(snd_kcontrol_t * kcontrol, snd_ctl_elem_valu | |||
971 | } | 964 | } |
972 | 965 | ||
973 | #define RME9652_SPDIF_IN(xname, xindex) \ | 966 | #define RME9652_SPDIF_IN(xname, xindex) \ |
974 | { .iface = SNDRV_CTL_ELEM_IFACE_PCM, .name = xname, .index = xindex, \ | 967 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \ |
975 | .info = snd_rme9652_info_spdif_in, \ | 968 | .info = snd_rme9652_info_spdif_in, \ |
976 | .get = snd_rme9652_get_spdif_in, .put = snd_rme9652_put_spdif_in } | 969 | .get = snd_rme9652_get_spdif_in, .put = snd_rme9652_put_spdif_in } |
977 | 970 | ||
@@ -1042,7 +1035,7 @@ static int snd_rme9652_put_spdif_in(snd_kcontrol_t * kcontrol, snd_ctl_elem_valu | |||
1042 | } | 1035 | } |
1043 | 1036 | ||
1044 | #define RME9652_SPDIF_OUT(xname, xindex) \ | 1037 | #define RME9652_SPDIF_OUT(xname, xindex) \ |
1045 | { .iface = SNDRV_CTL_ELEM_IFACE_PCM, .name = xname, .index = xindex, \ | 1038 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \ |
1046 | .info = snd_rme9652_info_spdif_out, \ | 1039 | .info = snd_rme9652_info_spdif_out, \ |
1047 | .get = snd_rme9652_get_spdif_out, .put = snd_rme9652_put_spdif_out } | 1040 | .get = snd_rme9652_get_spdif_out, .put = snd_rme9652_put_spdif_out } |
1048 | 1041 | ||
@@ -1110,7 +1103,7 @@ static int snd_rme9652_put_spdif_out(snd_kcontrol_t * kcontrol, snd_ctl_elem_val | |||
1110 | } | 1103 | } |
1111 | 1104 | ||
1112 | #define RME9652_SYNC_MODE(xname, xindex) \ | 1105 | #define RME9652_SYNC_MODE(xname, xindex) \ |
1113 | { .iface = SNDRV_CTL_ELEM_IFACE_PCM, .name = xname, .index = xindex, \ | 1106 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \ |
1114 | .info = snd_rme9652_info_sync_mode, \ | 1107 | .info = snd_rme9652_info_sync_mode, \ |
1115 | .get = snd_rme9652_get_sync_mode, .put = snd_rme9652_put_sync_mode } | 1108 | .get = snd_rme9652_get_sync_mode, .put = snd_rme9652_put_sync_mode } |
1116 | 1109 | ||
@@ -1195,7 +1188,7 @@ static int snd_rme9652_put_sync_mode(snd_kcontrol_t * kcontrol, snd_ctl_elem_val | |||
1195 | } | 1188 | } |
1196 | 1189 | ||
1197 | #define RME9652_SYNC_PREF(xname, xindex) \ | 1190 | #define RME9652_SYNC_PREF(xname, xindex) \ |
1198 | { .iface = SNDRV_CTL_ELEM_IFACE_PCM, .name = xname, .index = xindex, \ | 1191 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \ |
1199 | .info = snd_rme9652_info_sync_pref, \ | 1192 | .info = snd_rme9652_info_sync_pref, \ |
1200 | .get = snd_rme9652_get_sync_pref, .put = snd_rme9652_put_sync_pref } | 1193 | .get = snd_rme9652_get_sync_pref, .put = snd_rme9652_put_sync_pref } |
1201 | 1194 | ||
@@ -1340,7 +1333,7 @@ static int snd_rme9652_put_thru(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t | |||
1340 | } | 1333 | } |
1341 | 1334 | ||
1342 | #define RME9652_PASSTHRU(xname, xindex) \ | 1335 | #define RME9652_PASSTHRU(xname, xindex) \ |
1343 | { .iface = SNDRV_CTL_ELEM_IFACE_PCM, .name = xname, .index = xindex, \ | 1336 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \ |
1344 | .info = snd_rme9652_info_passthru, \ | 1337 | .info = snd_rme9652_info_passthru, \ |
1345 | .put = snd_rme9652_put_passthru, \ | 1338 | .put = snd_rme9652_put_passthru, \ |
1346 | .get = snd_rme9652_get_passthru } | 1339 | .get = snd_rme9652_get_passthru } |
@@ -1386,7 +1379,7 @@ static int snd_rme9652_put_passthru(snd_kcontrol_t * kcontrol, snd_ctl_elem_valu | |||
1386 | /* Read-only switches */ | 1379 | /* Read-only switches */ |
1387 | 1380 | ||
1388 | #define RME9652_SPDIF_RATE(xname, xindex) \ | 1381 | #define RME9652_SPDIF_RATE(xname, xindex) \ |
1389 | { .iface = SNDRV_CTL_ELEM_IFACE_PCM, .name = xname, .index = xindex, \ | 1382 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \ |
1390 | .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, \ | 1383 | .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, \ |
1391 | .info = snd_rme9652_info_spdif_rate, \ | 1384 | .info = snd_rme9652_info_spdif_rate, \ |
1392 | .get = snd_rme9652_get_spdif_rate } | 1385 | .get = snd_rme9652_get_spdif_rate } |
@@ -1411,7 +1404,7 @@ static int snd_rme9652_get_spdif_rate(snd_kcontrol_t * kcontrol, snd_ctl_elem_va | |||
1411 | } | 1404 | } |
1412 | 1405 | ||
1413 | #define RME9652_ADAT_SYNC(xname, xindex, xidx) \ | 1406 | #define RME9652_ADAT_SYNC(xname, xindex, xidx) \ |
1414 | { .iface = SNDRV_CTL_ELEM_IFACE_PCM, .name = xname, .index = xindex, \ | 1407 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \ |
1415 | .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, \ | 1408 | .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, \ |
1416 | .info = snd_rme9652_info_adat_sync, \ | 1409 | .info = snd_rme9652_info_adat_sync, \ |
1417 | .get = snd_rme9652_get_adat_sync, .private_value = xidx } | 1410 | .get = snd_rme9652_get_adat_sync, .private_value = xidx } |
@@ -1447,7 +1440,7 @@ static int snd_rme9652_get_adat_sync(snd_kcontrol_t * kcontrol, snd_ctl_elem_val | |||
1447 | } | 1440 | } |
1448 | 1441 | ||
1449 | #define RME9652_TC_VALID(xname, xindex) \ | 1442 | #define RME9652_TC_VALID(xname, xindex) \ |
1450 | { .iface = SNDRV_CTL_ELEM_IFACE_PCM, .name = xname, .index = xindex, \ | 1443 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \ |
1451 | .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, \ | 1444 | .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, \ |
1452 | .info = snd_rme9652_info_tc_valid, \ | 1445 | .info = snd_rme9652_info_tc_valid, \ |
1453 | .get = snd_rme9652_get_tc_valid } | 1446 | .get = snd_rme9652_get_tc_valid } |
@@ -1545,7 +1538,7 @@ static snd_kcontrol_new_t snd_rme9652_controls[] = { | |||
1545 | }, | 1538 | }, |
1546 | { | 1539 | { |
1547 | .access = SNDRV_CTL_ELEM_ACCESS_READ, | 1540 | .access = SNDRV_CTL_ELEM_ACCESS_READ, |
1548 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1541 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, |
1549 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,CON_MASK), | 1542 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,CON_MASK), |
1550 | .info = snd_rme9652_control_spdif_mask_info, | 1543 | .info = snd_rme9652_control_spdif_mask_info, |
1551 | .get = snd_rme9652_control_spdif_mask_get, | 1544 | .get = snd_rme9652_control_spdif_mask_get, |
@@ -1555,7 +1548,7 @@ static snd_kcontrol_new_t snd_rme9652_controls[] = { | |||
1555 | }, | 1548 | }, |
1556 | { | 1549 | { |
1557 | .access = SNDRV_CTL_ELEM_ACCESS_READ, | 1550 | .access = SNDRV_CTL_ELEM_ACCESS_READ, |
1558 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1551 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, |
1559 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,PRO_MASK), | 1552 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,PRO_MASK), |
1560 | .info = snd_rme9652_control_spdif_mask_info, | 1553 | .info = snd_rme9652_control_spdif_mask_info, |
1561 | .get = snd_rme9652_control_spdif_mask_get, | 1554 | .get = snd_rme9652_control_spdif_mask_get, |
@@ -1568,7 +1561,7 @@ RME9652_SPDIF_OUT("IEC958 Output also on ADAT1", 0), | |||
1568 | RME9652_SYNC_MODE("Sync Mode", 0), | 1561 | RME9652_SYNC_MODE("Sync Mode", 0), |
1569 | RME9652_SYNC_PREF("Preferred Sync Source", 0), | 1562 | RME9652_SYNC_PREF("Preferred Sync Source", 0), |
1570 | { | 1563 | { |
1571 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, | 1564 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
1572 | .name = "Channels Thru", | 1565 | .name = "Channels Thru", |
1573 | .index = 0, | 1566 | .index = 0, |
1574 | .info = snd_rme9652_info_thru, | 1567 | .info = snd_rme9652_info_thru, |
@@ -2661,6 +2654,7 @@ static void __devexit snd_rme9652_remove(struct pci_dev *pci) | |||
2661 | 2654 | ||
2662 | static struct pci_driver driver = { | 2655 | static struct pci_driver driver = { |
2663 | .name = "RME Digi9652 (Hammerfall)", | 2656 | .name = "RME Digi9652 (Hammerfall)", |
2657 | .owner = THIS_MODULE, | ||
2664 | .id_table = snd_rme9652_ids, | 2658 | .id_table = snd_rme9652_ids, |
2665 | .probe = snd_rme9652_probe, | 2659 | .probe = snd_rme9652_probe, |
2666 | .remove = __devexit_p(snd_rme9652_remove), | 2660 | .remove = __devexit_p(snd_rme9652_remove), |
diff --git a/sound/pci/sonicvibes.c b/sound/pci/sonicvibes.c index 60ecb2bdb65e..1f6c2bfd43fd 100644 --- a/sound/pci/sonicvibes.c +++ b/sound/pci/sonicvibes.c | |||
@@ -50,13 +50,6 @@ MODULE_SUPPORTED_DEVICE("{{S3,SonicVibes PCI}}"); | |||
50 | #define SUPPORT_JOYSTICK 1 | 50 | #define SUPPORT_JOYSTICK 1 |
51 | #endif | 51 | #endif |
52 | 52 | ||
53 | #ifndef PCI_VENDOR_ID_S3 | ||
54 | #define PCI_VENDOR_ID_S3 0x5333 | ||
55 | #endif | ||
56 | #ifndef PCI_DEVICE_ID_S3_SONICVIBES | ||
57 | #define PCI_DEVICE_ID_S3_SONICVIBES 0xca00 | ||
58 | #endif | ||
59 | |||
60 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ | 53 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ |
61 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ | 54 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ |
62 | static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ | 55 | static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ |
@@ -1257,7 +1250,7 @@ static int __devinit snd_sonicvibes_create(snd_card_t * card, | |||
1257 | return -ENXIO; | 1250 | return -ENXIO; |
1258 | } | 1251 | } |
1259 | 1252 | ||
1260 | sonic = kcalloc(1, sizeof(*sonic), GFP_KERNEL); | 1253 | sonic = kzalloc(sizeof(*sonic), GFP_KERNEL); |
1261 | if (sonic == NULL) { | 1254 | if (sonic == NULL) { |
1262 | pci_disable_device(pci); | 1255 | pci_disable_device(pci); |
1263 | return -ENOMEM; | 1256 | return -ENOMEM; |
@@ -1515,6 +1508,7 @@ static void __devexit snd_sonic_remove(struct pci_dev *pci) | |||
1515 | 1508 | ||
1516 | static struct pci_driver driver = { | 1509 | static struct pci_driver driver = { |
1517 | .name = "S3 SonicVibes", | 1510 | .name = "S3 SonicVibes", |
1511 | .owner = THIS_MODULE, | ||
1518 | .id_table = snd_sonic_ids, | 1512 | .id_table = snd_sonic_ids, |
1519 | .probe = snd_sonic_probe, | 1513 | .probe = snd_sonic_probe, |
1520 | .remove = __devexit_p(snd_sonic_remove), | 1514 | .remove = __devexit_p(snd_sonic_remove), |
diff --git a/sound/pci/trident/trident.c b/sound/pci/trident/trident.c index 940d531575c0..a8ca8e17853f 100644 --- a/sound/pci/trident/trident.c +++ b/sound/pci/trident/trident.c | |||
@@ -177,6 +177,7 @@ static void __devexit snd_trident_remove(struct pci_dev *pci) | |||
177 | 177 | ||
178 | static struct pci_driver driver = { | 178 | static struct pci_driver driver = { |
179 | .name = "Trident4DWaveAudio", | 179 | .name = "Trident4DWaveAudio", |
180 | .owner = THIS_MODULE, | ||
180 | .id_table = snd_trident_ids, | 181 | .id_table = snd_trident_ids, |
181 | .probe = snd_trident_probe, | 182 | .probe = snd_trident_probe, |
182 | .remove = __devexit_p(snd_trident_remove), | 183 | .remove = __devexit_p(snd_trident_remove), |
diff --git a/sound/pci/trident/trident_main.c b/sound/pci/trident/trident_main.c index 29d89bfba0a4..777da9a7298b 100644 --- a/sound/pci/trident/trident_main.c +++ b/sound/pci/trident/trident_main.c | |||
@@ -1689,7 +1689,7 @@ static snd_pcm_hardware_t snd_trident_playback = | |||
1689 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | | 1689 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | |
1690 | SNDRV_PCM_INFO_BLOCK_TRANSFER | | 1690 | SNDRV_PCM_INFO_BLOCK_TRANSFER | |
1691 | SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_SYNC_START | | 1691 | SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_SYNC_START | |
1692 | SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_RESUME), | 1692 | SNDRV_PCM_INFO_PAUSE /* | SNDRV_PCM_INFO_RESUME */), |
1693 | .formats = (SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE | | 1693 | .formats = (SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE | |
1694 | SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_U16_LE), | 1694 | SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_U16_LE), |
1695 | .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000, | 1695 | .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000, |
@@ -1714,7 +1714,7 @@ static snd_pcm_hardware_t snd_trident_capture = | |||
1714 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | | 1714 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | |
1715 | SNDRV_PCM_INFO_BLOCK_TRANSFER | | 1715 | SNDRV_PCM_INFO_BLOCK_TRANSFER | |
1716 | SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_SYNC_START | | 1716 | SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_SYNC_START | |
1717 | SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_RESUME), | 1717 | SNDRV_PCM_INFO_PAUSE /* | SNDRV_PCM_INFO_RESUME */), |
1718 | .formats = (SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE | | 1718 | .formats = (SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE | |
1719 | SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_U16_LE), | 1719 | SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_U16_LE), |
1720 | .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000, | 1720 | .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000, |
@@ -1739,7 +1739,7 @@ static snd_pcm_hardware_t snd_trident_foldback = | |||
1739 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | | 1739 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | |
1740 | SNDRV_PCM_INFO_BLOCK_TRANSFER | | 1740 | SNDRV_PCM_INFO_BLOCK_TRANSFER | |
1741 | SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_SYNC_START | | 1741 | SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_SYNC_START | |
1742 | SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_RESUME), | 1742 | SNDRV_PCM_INFO_PAUSE /* | SNDRV_PCM_INFO_RESUME */), |
1743 | .formats = SNDRV_PCM_FMTBIT_S16_LE, | 1743 | .formats = SNDRV_PCM_FMTBIT_S16_LE, |
1744 | .rates = SNDRV_PCM_RATE_48000, | 1744 | .rates = SNDRV_PCM_RATE_48000, |
1745 | .rate_min = 48000, | 1745 | .rate_min = 48000, |
@@ -1763,7 +1763,7 @@ static snd_pcm_hardware_t snd_trident_spdif = | |||
1763 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | | 1763 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | |
1764 | SNDRV_PCM_INFO_BLOCK_TRANSFER | | 1764 | SNDRV_PCM_INFO_BLOCK_TRANSFER | |
1765 | SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_SYNC_START | | 1765 | SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_SYNC_START | |
1766 | SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_RESUME), | 1766 | SNDRV_PCM_INFO_PAUSE /* | SNDRV_PCM_INFO_RESUME */), |
1767 | .formats = SNDRV_PCM_FMTBIT_S16_LE, | 1767 | .formats = SNDRV_PCM_FMTBIT_S16_LE, |
1768 | .rates = (SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | | 1768 | .rates = (SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | |
1769 | SNDRV_PCM_RATE_48000), | 1769 | SNDRV_PCM_RATE_48000), |
@@ -1784,7 +1784,7 @@ static snd_pcm_hardware_t snd_trident_spdif_7018 = | |||
1784 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | | 1784 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | |
1785 | SNDRV_PCM_INFO_BLOCK_TRANSFER | | 1785 | SNDRV_PCM_INFO_BLOCK_TRANSFER | |
1786 | SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_SYNC_START | | 1786 | SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_SYNC_START | |
1787 | SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_RESUME), | 1787 | SNDRV_PCM_INFO_PAUSE /* | SNDRV_PCM_INFO_RESUME */), |
1788 | .formats = SNDRV_PCM_FMTBIT_S16_LE, | 1788 | .formats = SNDRV_PCM_FMTBIT_S16_LE, |
1789 | .rates = SNDRV_PCM_RATE_48000, | 1789 | .rates = SNDRV_PCM_RATE_48000, |
1790 | .rate_min = 48000, | 1790 | .rate_min = 48000, |
@@ -2960,7 +2960,7 @@ static int __devinit snd_trident_mixer(trident_t * trident, int pcm_spdif_device | |||
2960 | .read = snd_trident_codec_read, | 2960 | .read = snd_trident_codec_read, |
2961 | }; | 2961 | }; |
2962 | 2962 | ||
2963 | uctl = kcalloc(1, sizeof(*uctl), GFP_KERNEL); | 2963 | uctl = kzalloc(sizeof(*uctl), GFP_KERNEL); |
2964 | if (!uctl) | 2964 | if (!uctl) |
2965 | return -ENOMEM; | 2965 | return -ENOMEM; |
2966 | 2966 | ||
@@ -3546,7 +3546,7 @@ int __devinit snd_trident_create(snd_card_t * card, | |||
3546 | return -ENXIO; | 3546 | return -ENXIO; |
3547 | } | 3547 | } |
3548 | 3548 | ||
3549 | trident = kcalloc(1, sizeof(*trident), GFP_KERNEL); | 3549 | trident = kzalloc(sizeof(*trident), GFP_KERNEL); |
3550 | if (trident == NULL) { | 3550 | if (trident == NULL) { |
3551 | pci_disable_device(pci); | 3551 | pci_disable_device(pci); |
3552 | return -ENOMEM; | 3552 | return -ENOMEM; |
diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c index 4889600387c8..3c0205b91e10 100644 --- a/sound/pci/via82xx.c +++ b/sound/pci/via82xx.c | |||
@@ -104,14 +104,6 @@ module_param_array(dxs_support, int, NULL, 0444); | |||
104 | MODULE_PARM_DESC(dxs_support, "Support for DXS channels (0 = auto, 1 = enable, 2 = disable, 3 = 48k only, 4 = no VRA, 5 = enable any sample rate)"); | 104 | MODULE_PARM_DESC(dxs_support, "Support for DXS channels (0 = auto, 1 = enable, 2 = disable, 3 = 48k only, 4 = no VRA, 5 = enable any sample rate)"); |
105 | 105 | ||
106 | 106 | ||
107 | /* pci ids */ | ||
108 | #ifndef PCI_DEVICE_ID_VIA_82C686_5 | ||
109 | #define PCI_DEVICE_ID_VIA_82C686_5 0x3058 | ||
110 | #endif | ||
111 | #ifndef PCI_DEVICE_ID_VIA_8233_5 | ||
112 | #define PCI_DEVICE_ID_VIA_8233_5 0x3059 | ||
113 | #endif | ||
114 | |||
115 | /* revision numbers for via686 */ | 107 | /* revision numbers for via686 */ |
116 | #define VIA_REV_686_A 0x10 | 108 | #define VIA_REV_686_A 0x10 |
117 | #define VIA_REV_686_B 0x11 | 109 | #define VIA_REV_686_B 0x11 |
@@ -663,10 +655,12 @@ static int snd_via82xx_pcm_trigger(snd_pcm_substream_t * substream, int cmd) | |||
663 | val = 0; | 655 | val = 0; |
664 | switch (cmd) { | 656 | switch (cmd) { |
665 | case SNDRV_PCM_TRIGGER_START: | 657 | case SNDRV_PCM_TRIGGER_START: |
658 | case SNDRV_PCM_TRIGGER_RESUME: | ||
666 | val |= VIA_REG_CTRL_START; | 659 | val |= VIA_REG_CTRL_START; |
667 | viadev->running = 1; | 660 | viadev->running = 1; |
668 | break; | 661 | break; |
669 | case SNDRV_PCM_TRIGGER_STOP: | 662 | case SNDRV_PCM_TRIGGER_STOP: |
663 | case SNDRV_PCM_TRIGGER_SUSPEND: | ||
670 | val = VIA_REG_CTRL_TERMINATE; | 664 | val = VIA_REG_CTRL_TERMINATE; |
671 | viadev->running = 0; | 665 | viadev->running = 0; |
672 | break; | 666 | break; |
@@ -929,12 +923,12 @@ static int snd_via8233_playback_prepare(snd_pcm_substream_t *substream) | |||
929 | 923 | ||
930 | if ((rate_changed = via_lock_rate(&chip->rates[0], ac97_rate)) < 0) | 924 | if ((rate_changed = via_lock_rate(&chip->rates[0], ac97_rate)) < 0) |
931 | return rate_changed; | 925 | return rate_changed; |
932 | if (rate_changed) { | 926 | if (rate_changed) |
933 | snd_ac97_set_rate(chip->ac97, AC97_PCM_FRONT_DAC_RATE, | 927 | snd_ac97_set_rate(chip->ac97, AC97_PCM_FRONT_DAC_RATE, |
934 | chip->no_vra ? 48000 : runtime->rate); | 928 | chip->no_vra ? 48000 : runtime->rate); |
935 | snd_ac97_set_rate(chip->ac97, AC97_SPDIF, | 929 | if (chip->spdif_on && viadev->reg_offset == 0x30) |
936 | chip->no_vra ? 48000 : runtime->rate); | 930 | snd_ac97_set_rate(chip->ac97, AC97_SPDIF, runtime->rate); |
937 | } | 931 | |
938 | if (runtime->rate == 48000) | 932 | if (runtime->rate == 48000) |
939 | rbits = 0xfffff; | 933 | rbits = 0xfffff; |
940 | else | 934 | else |
@@ -1035,7 +1029,7 @@ static snd_pcm_hardware_t snd_via82xx_hw = | |||
1035 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | | 1029 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | |
1036 | SNDRV_PCM_INFO_BLOCK_TRANSFER | | 1030 | SNDRV_PCM_INFO_BLOCK_TRANSFER | |
1037 | SNDRV_PCM_INFO_MMAP_VALID | | 1031 | SNDRV_PCM_INFO_MMAP_VALID | |
1038 | SNDRV_PCM_INFO_RESUME | | 1032 | /* SNDRV_PCM_INFO_RESUME | */ |
1039 | SNDRV_PCM_INFO_PAUSE), | 1033 | SNDRV_PCM_INFO_PAUSE), |
1040 | .formats = SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE, | 1034 | .formats = SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE, |
1041 | .rates = SNDRV_PCM_RATE_48000, | 1035 | .rates = SNDRV_PCM_RATE_48000, |
@@ -1484,7 +1478,7 @@ static int snd_via8233_dxs3_spdif_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_val | |||
1484 | } | 1478 | } |
1485 | 1479 | ||
1486 | static snd_kcontrol_new_t snd_via8233_dxs3_spdif_control __devinitdata = { | 1480 | static snd_kcontrol_new_t snd_via8233_dxs3_spdif_control __devinitdata = { |
1487 | .name = "IEC958 Output Switch", | 1481 | .name = SNDRV_CTL_NAME_IEC958("Output ",NONE,SWITCH), |
1488 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1482 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
1489 | .info = snd_via8233_dxs3_spdif_info, | 1483 | .info = snd_via8233_dxs3_spdif_info, |
1490 | .get = snd_via8233_dxs3_spdif_get, | 1484 | .get = snd_via8233_dxs3_spdif_get, |
@@ -1933,11 +1927,12 @@ static int snd_via82xx_chip_init(via82xx_t *chip) | |||
1933 | * DXS channels don't work properly with VRA if MC97 is disabled. | 1927 | * DXS channels don't work properly with VRA if MC97 is disabled. |
1934 | */ | 1928 | */ |
1935 | struct pci_dev *pci; | 1929 | struct pci_dev *pci; |
1936 | pci = pci_find_device(0x1106, 0x3068, NULL); /* MC97 */ | 1930 | pci = pci_get_device(0x1106, 0x3068, NULL); /* MC97 */ |
1937 | if (pci) { | 1931 | if (pci) { |
1938 | unsigned char data; | 1932 | unsigned char data; |
1939 | pci_read_config_byte(pci, 0x44, &data); | 1933 | pci_read_config_byte(pci, 0x44, &data); |
1940 | pci_write_config_byte(pci, 0x44, data | 0x40); | 1934 | pci_write_config_byte(pci, 0x44, data | 0x40); |
1935 | pci_dev_put(pci); | ||
1941 | } | 1936 | } |
1942 | } | 1937 | } |
1943 | 1938 | ||
@@ -2063,7 +2058,7 @@ static int __devinit snd_via82xx_create(snd_card_t * card, | |||
2063 | if ((err = pci_enable_device(pci)) < 0) | 2058 | if ((err = pci_enable_device(pci)) < 0) |
2064 | return err; | 2059 | return err; |
2065 | 2060 | ||
2066 | if ((chip = kcalloc(1, sizeof(*chip), GFP_KERNEL)) == NULL) { | 2061 | if ((chip = kzalloc(sizeof(*chip), GFP_KERNEL)) == NULL) { |
2067 | pci_disable_device(pci); | 2062 | pci_disable_device(pci); |
2068 | return -ENOMEM; | 2063 | return -ENOMEM; |
2069 | } | 2064 | } |
@@ -2152,10 +2147,13 @@ static int __devinit check_dxs_list(struct pci_dev *pci) | |||
2152 | { .subvendor = 0x1019, .subdevice = 0x0996, .action = VIA_DXS_48K }, | 2147 | { .subvendor = 0x1019, .subdevice = 0x0996, .action = VIA_DXS_48K }, |
2153 | { .subvendor = 0x1019, .subdevice = 0x0a81, .action = VIA_DXS_NO_VRA }, /* ECS K7VTA3 v8.0 */ | 2148 | { .subvendor = 0x1019, .subdevice = 0x0a81, .action = VIA_DXS_NO_VRA }, /* ECS K7VTA3 v8.0 */ |
2154 | { .subvendor = 0x1019, .subdevice = 0x0a85, .action = VIA_DXS_NO_VRA }, /* ECS L7VMM2 */ | 2149 | { .subvendor = 0x1019, .subdevice = 0x0a85, .action = VIA_DXS_NO_VRA }, /* ECS L7VMM2 */ |
2150 | { .subvendor = 0x1019, .subdevice = 0xa101, .action = VIA_DXS_SRC }, | ||
2155 | { .subvendor = 0x1025, .subdevice = 0x0033, .action = VIA_DXS_NO_VRA }, /* Acer Inspire 1353LM */ | 2151 | { .subvendor = 0x1025, .subdevice = 0x0033, .action = VIA_DXS_NO_VRA }, /* Acer Inspire 1353LM */ |
2152 | { .subvendor = 0x1025, .subdevice = 0x0046, .action = VIA_DXS_SRC }, /* Acer Aspire 1524 WLMi */ | ||
2156 | { .subvendor = 0x1043, .subdevice = 0x8095, .action = VIA_DXS_NO_VRA }, /* ASUS A7V8X (FIXME: possibly VIA_DXS_ENABLE?)*/ | 2153 | { .subvendor = 0x1043, .subdevice = 0x8095, .action = VIA_DXS_NO_VRA }, /* ASUS A7V8X (FIXME: possibly VIA_DXS_ENABLE?)*/ |
2157 | { .subvendor = 0x1043, .subdevice = 0x80a1, .action = VIA_DXS_NO_VRA }, /* ASUS A7V8-X */ | 2154 | { .subvendor = 0x1043, .subdevice = 0x80a1, .action = VIA_DXS_NO_VRA }, /* ASUS A7V8-X */ |
2158 | { .subvendor = 0x1043, .subdevice = 0x80b0, .action = VIA_DXS_NO_VRA }, /* ASUS A7V600 & K8V*/ | 2155 | { .subvendor = 0x1043, .subdevice = 0x80b0, .action = VIA_DXS_NO_VRA }, /* ASUS A7V600 & K8V*/ |
2156 | { .subvendor = 0x1043, .subdevice = 0x810d, .action = VIA_DXS_SRC }, /* ASUS */ | ||
2159 | { .subvendor = 0x1043, .subdevice = 0x812a, .action = VIA_DXS_SRC }, /* ASUS A8V Deluxe */ | 2157 | { .subvendor = 0x1043, .subdevice = 0x812a, .action = VIA_DXS_SRC }, /* ASUS A8V Deluxe */ |
2160 | { .subvendor = 0x1071, .subdevice = 0x8375, .action = VIA_DXS_NO_VRA }, /* Vobis/Yakumo/Mitac notebook */ | 2158 | { .subvendor = 0x1071, .subdevice = 0x8375, .action = VIA_DXS_NO_VRA }, /* Vobis/Yakumo/Mitac notebook */ |
2161 | { .subvendor = 0x1071, .subdevice = 0x8399, .action = VIA_DXS_NO_VRA }, /* Umax AB 595T (VIA K8N800A - VT8237) */ | 2159 | { .subvendor = 0x1071, .subdevice = 0x8399, .action = VIA_DXS_NO_VRA }, /* Umax AB 595T (VIA K8N800A - VT8237) */ |
@@ -2168,10 +2166,12 @@ static int __devinit check_dxs_list(struct pci_dev *pci) | |||
2168 | { .subvendor = 0x1297, .subdevice = 0xc160, .action = VIA_DXS_ENABLE }, /* Shuttle SK41G */ | 2166 | { .subvendor = 0x1297, .subdevice = 0xc160, .action = VIA_DXS_ENABLE }, /* Shuttle SK41G */ |
2169 | { .subvendor = 0x1458, .subdevice = 0xa002, .action = VIA_DXS_ENABLE }, /* Gigabyte GA-7VAXP */ | 2167 | { .subvendor = 0x1458, .subdevice = 0xa002, .action = VIA_DXS_ENABLE }, /* Gigabyte GA-7VAXP */ |
2170 | { .subvendor = 0x1462, .subdevice = 0x0080, .action = VIA_DXS_SRC }, /* MSI K8T Neo-FIS2R */ | 2168 | { .subvendor = 0x1462, .subdevice = 0x0080, .action = VIA_DXS_SRC }, /* MSI K8T Neo-FIS2R */ |
2169 | { .subvendor = 0x1462, .subdevice = 0x0430, .action = VIA_DXS_SRC }, /* MSI 7142 (K8MM-V) */ | ||
2171 | { .subvendor = 0x1462, .subdevice = 0x3800, .action = VIA_DXS_ENABLE }, /* MSI KT266 */ | 2170 | { .subvendor = 0x1462, .subdevice = 0x3800, .action = VIA_DXS_ENABLE }, /* MSI KT266 */ |
2172 | { .subvendor = 0x1462, .subdevice = 0x5901, .action = VIA_DXS_NO_VRA }, /* MSI KT6 Delta-SR */ | 2171 | { .subvendor = 0x1462, .subdevice = 0x5901, .action = VIA_DXS_NO_VRA }, /* MSI KT6 Delta-SR */ |
2173 | { .subvendor = 0x1462, .subdevice = 0x7023, .action = VIA_DXS_NO_VRA }, /* MSI K8T Neo2-FI */ | 2172 | { .subvendor = 0x1462, .subdevice = 0x7023, .action = VIA_DXS_NO_VRA }, /* MSI K8T Neo2-FI */ |
2174 | { .subvendor = 0x1462, .subdevice = 0x7120, .action = VIA_DXS_ENABLE }, /* MSI KT4V */ | 2173 | { .subvendor = 0x1462, .subdevice = 0x7120, .action = VIA_DXS_ENABLE }, /* MSI KT4V */ |
2174 | { .subvendor = 0x1462, .subdevice = 0x7142, .action = VIA_DXS_ENABLE }, /* MSI K8MM-V */ | ||
2175 | { .subvendor = 0x147b, .subdevice = 0x1401, .action = VIA_DXS_ENABLE }, /* ABIT KD7(-RAID) */ | 2175 | { .subvendor = 0x147b, .subdevice = 0x1401, .action = VIA_DXS_ENABLE }, /* ABIT KD7(-RAID) */ |
2176 | { .subvendor = 0x147b, .subdevice = 0x1411, .action = VIA_DXS_ENABLE }, /* ABIT VA-20 */ | 2176 | { .subvendor = 0x147b, .subdevice = 0x1411, .action = VIA_DXS_ENABLE }, /* ABIT VA-20 */ |
2177 | { .subvendor = 0x147b, .subdevice = 0x1413, .action = VIA_DXS_ENABLE }, /* ABIT KV8 Pro */ | 2177 | { .subvendor = 0x147b, .subdevice = 0x1413, .action = VIA_DXS_ENABLE }, /* ABIT KV8 Pro */ |
@@ -2345,6 +2345,7 @@ static void __devexit snd_via82xx_remove(struct pci_dev *pci) | |||
2345 | 2345 | ||
2346 | static struct pci_driver driver = { | 2346 | static struct pci_driver driver = { |
2347 | .name = "VIA 82xx Audio", | 2347 | .name = "VIA 82xx Audio", |
2348 | .owner = THIS_MODULE, | ||
2348 | .id_table = snd_via82xx_ids, | 2349 | .id_table = snd_via82xx_ids, |
2349 | .probe = snd_via82xx_probe, | 2350 | .probe = snd_via82xx_probe, |
2350 | .remove = __devexit_p(snd_via82xx_remove), | 2351 | .remove = __devexit_p(snd_via82xx_remove), |
diff --git a/sound/pci/via82xx_modem.c b/sound/pci/via82xx_modem.c index 4a9779cc9733..7eac6f6ac737 100644 --- a/sound/pci/via82xx_modem.c +++ b/sound/pci/via82xx_modem.c | |||
@@ -521,6 +521,7 @@ static int snd_via82xx_pcm_trigger(snd_pcm_substream_t * substream, int cmd) | |||
521 | 521 | ||
522 | switch (cmd) { | 522 | switch (cmd) { |
523 | case SNDRV_PCM_TRIGGER_START: | 523 | case SNDRV_PCM_TRIGGER_START: |
524 | case SNDRV_PCM_TRIGGER_SUSPEND: | ||
524 | val |= VIA_REG_CTRL_START; | 525 | val |= VIA_REG_CTRL_START; |
525 | viadev->running = 1; | 526 | viadev->running = 1; |
526 | break; | 527 | break; |
@@ -697,7 +698,7 @@ static snd_pcm_hardware_t snd_via82xx_hw = | |||
697 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | | 698 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | |
698 | SNDRV_PCM_INFO_BLOCK_TRANSFER | | 699 | SNDRV_PCM_INFO_BLOCK_TRANSFER | |
699 | SNDRV_PCM_INFO_MMAP_VALID | | 700 | SNDRV_PCM_INFO_MMAP_VALID | |
700 | SNDRV_PCM_INFO_RESUME | | 701 | /* SNDRV_PCM_INFO_RESUME | */ |
701 | SNDRV_PCM_INFO_PAUSE), | 702 | SNDRV_PCM_INFO_PAUSE), |
702 | .formats = SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE, | 703 | .formats = SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE, |
703 | .rates = SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_KNOT, | 704 | .rates = SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_KNOT, |
@@ -1082,7 +1083,7 @@ static int __devinit snd_via82xx_create(snd_card_t * card, | |||
1082 | if ((err = pci_enable_device(pci)) < 0) | 1083 | if ((err = pci_enable_device(pci)) < 0) |
1083 | return err; | 1084 | return err; |
1084 | 1085 | ||
1085 | if ((chip = kcalloc(1, sizeof(*chip), GFP_KERNEL)) == NULL) { | 1086 | if ((chip = kzalloc(sizeof(*chip), GFP_KERNEL)) == NULL) { |
1086 | pci_disable_device(pci); | 1087 | pci_disable_device(pci); |
1087 | return -ENOMEM; | 1088 | return -ENOMEM; |
1088 | } | 1089 | } |
@@ -1206,6 +1207,7 @@ static void __devexit snd_via82xx_remove(struct pci_dev *pci) | |||
1206 | 1207 | ||
1207 | static struct pci_driver driver = { | 1208 | static struct pci_driver driver = { |
1208 | .name = "VIA 82xx Modem", | 1209 | .name = "VIA 82xx Modem", |
1210 | .owner = THIS_MODULE, | ||
1209 | .id_table = snd_via82xx_modem_ids, | 1211 | .id_table = snd_via82xx_modem_ids, |
1210 | .probe = snd_via82xx_probe, | 1212 | .probe = snd_via82xx_probe, |
1211 | .remove = __devexit_p(snd_via82xx_remove), | 1213 | .remove = __devexit_p(snd_via82xx_remove), |
diff --git a/sound/pci/vx222/vx222.c b/sound/pci/vx222/vx222.c index dca6bd2c7580..2a7ad9dec021 100644 --- a/sound/pci/vx222/vx222.c +++ b/sound/pci/vx222/vx222.c | |||
@@ -252,6 +252,7 @@ static void __devexit snd_vx222_remove(struct pci_dev *pci) | |||
252 | 252 | ||
253 | static struct pci_driver driver = { | 253 | static struct pci_driver driver = { |
254 | .name = "Digigram VX222", | 254 | .name = "Digigram VX222", |
255 | .owner = THIS_MODULE, | ||
255 | .id_table = snd_vx222_ids, | 256 | .id_table = snd_vx222_ids, |
256 | .probe = snd_vx222_probe, | 257 | .probe = snd_vx222_probe, |
257 | .remove = __devexit_p(snd_vx222_remove), | 258 | .remove = __devexit_p(snd_vx222_remove), |
diff --git a/sound/pci/ymfpci/ymfpci.c b/sound/pci/ymfpci/ymfpci.c index 5b5b624b47d0..2e69abe51aa9 100644 --- a/sound/pci/ymfpci/ymfpci.c +++ b/sound/pci/ymfpci/ymfpci.c | |||
@@ -352,6 +352,7 @@ static void __devexit snd_card_ymfpci_remove(struct pci_dev *pci) | |||
352 | 352 | ||
353 | static struct pci_driver driver = { | 353 | static struct pci_driver driver = { |
354 | .name = "Yamaha DS-XG PCI", | 354 | .name = "Yamaha DS-XG PCI", |
355 | .owner = THIS_MODULE, | ||
355 | .id_table = snd_ymfpci_ids, | 356 | .id_table = snd_ymfpci_ids, |
356 | .probe = snd_card_ymfpci_probe, | 357 | .probe = snd_card_ymfpci_probe, |
357 | .remove = __devexit_p(snd_card_ymfpci_remove), | 358 | .remove = __devexit_p(snd_card_ymfpci_remove), |
diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c index d54f88a1b525..27fa523639ae 100644 --- a/sound/pci/ymfpci/ymfpci_main.c +++ b/sound/pci/ymfpci/ymfpci_main.c | |||
@@ -321,6 +321,26 @@ static void snd_ymfpci_pcm_interrupt(ymfpci_t *chip, ymfpci_voice_t *voice) | |||
321 | snd_pcm_period_elapsed(ypcm->substream); | 321 | snd_pcm_period_elapsed(ypcm->substream); |
322 | spin_lock(&chip->reg_lock); | 322 | spin_lock(&chip->reg_lock); |
323 | } | 323 | } |
324 | |||
325 | if (unlikely(ypcm->update_pcm_vol)) { | ||
326 | unsigned int subs = ypcm->substream->number; | ||
327 | unsigned int next_bank = 1 - chip->active_bank; | ||
328 | snd_ymfpci_playback_bank_t *bank; | ||
329 | u32 volume; | ||
330 | |||
331 | bank = &voice->bank[next_bank]; | ||
332 | volume = cpu_to_le32(chip->pcm_mixer[subs].left << 15); | ||
333 | bank->left_gain_end = volume; | ||
334 | if (ypcm->output_rear) | ||
335 | bank->eff2_gain_end = volume; | ||
336 | if (ypcm->voices[1]) | ||
337 | bank = &ypcm->voices[1]->bank[next_bank]; | ||
338 | volume = cpu_to_le32(chip->pcm_mixer[subs].right << 15); | ||
339 | bank->right_gain_end = volume; | ||
340 | if (ypcm->output_rear) | ||
341 | bank->eff3_gain_end = volume; | ||
342 | ypcm->update_pcm_vol--; | ||
343 | } | ||
324 | } | 344 | } |
325 | spin_unlock(&chip->reg_lock); | 345 | spin_unlock(&chip->reg_lock); |
326 | } | 346 | } |
@@ -451,87 +471,74 @@ static int snd_ymfpci_pcm_voice_alloc(ymfpci_pcm_t *ypcm, int voices) | |||
451 | return 0; | 471 | return 0; |
452 | } | 472 | } |
453 | 473 | ||
454 | static void snd_ymfpci_pcm_init_voice(ymfpci_voice_t *voice, int stereo, | 474 | static void snd_ymfpci_pcm_init_voice(ymfpci_pcm_t *ypcm, unsigned int voiceidx, |
455 | int rate, int w_16, unsigned long addr, | 475 | snd_pcm_runtime_t *runtime, |
456 | unsigned int end, | 476 | int has_pcm_volume) |
457 | int output_front, int output_rear) | ||
458 | { | 477 | { |
478 | ymfpci_voice_t *voice = ypcm->voices[voiceidx]; | ||
459 | u32 format; | 479 | u32 format; |
460 | u32 delta = snd_ymfpci_calc_delta(rate); | 480 | u32 delta = snd_ymfpci_calc_delta(runtime->rate); |
461 | u32 lpfQ = snd_ymfpci_calc_lpfQ(rate); | 481 | u32 lpfQ = snd_ymfpci_calc_lpfQ(runtime->rate); |
462 | u32 lpfK = snd_ymfpci_calc_lpfK(rate); | 482 | u32 lpfK = snd_ymfpci_calc_lpfK(runtime->rate); |
463 | snd_ymfpci_playback_bank_t *bank; | 483 | snd_ymfpci_playback_bank_t *bank; |
464 | unsigned int nbank; | 484 | unsigned int nbank; |
485 | u32 vol_left, vol_right; | ||
486 | u8 use_left, use_right; | ||
465 | 487 | ||
466 | snd_assert(voice != NULL, return); | 488 | snd_assert(voice != NULL, return); |
467 | format = (stereo ? 0x00010000 : 0) | (w_16 ? 0 : 0x80000000); | 489 | if (runtime->channels == 1) { |
490 | use_left = 1; | ||
491 | use_right = 1; | ||
492 | } else { | ||
493 | use_left = (voiceidx & 1) == 0; | ||
494 | use_right = !use_left; | ||
495 | } | ||
496 | if (has_pcm_volume) { | ||
497 | vol_left = cpu_to_le32(ypcm->chip->pcm_mixer | ||
498 | [ypcm->substream->number].left << 15); | ||
499 | vol_right = cpu_to_le32(ypcm->chip->pcm_mixer | ||
500 | [ypcm->substream->number].right << 15); | ||
501 | } else { | ||
502 | vol_left = cpu_to_le32(0x40000000); | ||
503 | vol_right = cpu_to_le32(0x40000000); | ||
504 | } | ||
505 | format = runtime->channels == 2 ? 0x00010000 : 0; | ||
506 | if (snd_pcm_format_width(runtime->format) == 8) | ||
507 | format |= 0x80000000; | ||
508 | if (runtime->channels == 2 && (voiceidx & 1) != 0) | ||
509 | format |= 1; | ||
468 | for (nbank = 0; nbank < 2; nbank++) { | 510 | for (nbank = 0; nbank < 2; nbank++) { |
469 | bank = &voice->bank[nbank]; | 511 | bank = &voice->bank[nbank]; |
512 | memset(bank, 0, sizeof(*bank)); | ||
470 | bank->format = cpu_to_le32(format); | 513 | bank->format = cpu_to_le32(format); |
471 | bank->loop_default = 0; | 514 | bank->base = cpu_to_le32(runtime->dma_addr); |
472 | bank->base = cpu_to_le32(addr); | 515 | bank->loop_end = cpu_to_le32(ypcm->buffer_size); |
473 | bank->loop_start = 0; | ||
474 | bank->loop_end = cpu_to_le32(end); | ||
475 | bank->loop_frac = 0; | ||
476 | bank->eg_gain_end = cpu_to_le32(0x40000000); | ||
477 | bank->lpfQ = cpu_to_le32(lpfQ); | 516 | bank->lpfQ = cpu_to_le32(lpfQ); |
478 | bank->status = 0; | ||
479 | bank->num_of_frames = 0; | ||
480 | bank->loop_count = 0; | ||
481 | bank->start = 0; | ||
482 | bank->start_frac = 0; | ||
483 | bank->delta = | 517 | bank->delta = |
484 | bank->delta_end = cpu_to_le32(delta); | 518 | bank->delta_end = cpu_to_le32(delta); |
485 | bank->lpfK = | 519 | bank->lpfK = |
486 | bank->lpfK_end = cpu_to_le32(lpfK); | 520 | bank->lpfK_end = cpu_to_le32(lpfK); |
487 | bank->eg_gain = cpu_to_le32(0x40000000); | 521 | bank->eg_gain = |
488 | bank->lpfD1 = | 522 | bank->eg_gain_end = cpu_to_le32(0x40000000); |
489 | bank->lpfD2 = 0; | 523 | |
490 | 524 | if (ypcm->output_front) { | |
491 | bank->left_gain = | 525 | if (use_left) { |
492 | bank->right_gain = | 526 | bank->left_gain = |
493 | bank->left_gain_end = | 527 | bank->left_gain_end = vol_left; |
494 | bank->right_gain_end = | 528 | } |
495 | bank->eff1_gain = | 529 | if (use_right) { |
496 | bank->eff2_gain = | ||
497 | bank->eff3_gain = | ||
498 | bank->eff1_gain_end = | ||
499 | bank->eff2_gain_end = | ||
500 | bank->eff3_gain_end = 0; | ||
501 | |||
502 | if (!stereo) { | ||
503 | if (output_front) { | ||
504 | bank->left_gain = | ||
505 | bank->right_gain = | 530 | bank->right_gain = |
506 | bank->left_gain_end = | 531 | bank->right_gain_end = vol_right; |
507 | bank->right_gain_end = cpu_to_le32(0x40000000); | ||
508 | } | 532 | } |
509 | if (output_rear) { | 533 | } |
534 | if (ypcm->output_rear) { | ||
535 | if (use_left) { | ||
510 | bank->eff2_gain = | 536 | bank->eff2_gain = |
511 | bank->eff2_gain_end = | 537 | bank->eff2_gain_end = vol_left; |
512 | bank->eff3_gain = | ||
513 | bank->eff3_gain_end = cpu_to_le32(0x40000000); | ||
514 | } | ||
515 | } else { | ||
516 | if (output_front) { | ||
517 | if ((voice->number & 1) == 0) { | ||
518 | bank->left_gain = | ||
519 | bank->left_gain_end = cpu_to_le32(0x40000000); | ||
520 | } else { | ||
521 | bank->format |= cpu_to_le32(1); | ||
522 | bank->right_gain = | ||
523 | bank->right_gain_end = cpu_to_le32(0x40000000); | ||
524 | } | ||
525 | } | 538 | } |
526 | if (output_rear) { | 539 | if (use_right) { |
527 | if ((voice->number & 1) == 0) { | 540 | bank->eff3_gain = |
528 | bank->eff3_gain = | 541 | bank->eff3_gain_end = vol_right; |
529 | bank->eff3_gain_end = cpu_to_le32(0x40000000); | ||
530 | } else { | ||
531 | bank->format |= cpu_to_le32(1); | ||
532 | bank->eff2_gain = | ||
533 | bank->eff2_gain_end = cpu_to_le32(0x40000000); | ||
534 | } | ||
535 | } | 542 | } |
536 | } | 543 | } |
537 | } | 544 | } |
@@ -613,7 +620,7 @@ static int snd_ymfpci_playback_hw_free(snd_pcm_substream_t * substream) | |||
613 | 620 | ||
614 | static int snd_ymfpci_playback_prepare(snd_pcm_substream_t * substream) | 621 | static int snd_ymfpci_playback_prepare(snd_pcm_substream_t * substream) |
615 | { | 622 | { |
616 | // ymfpci_t *chip = snd_pcm_substream_chip(substream); | 623 | ymfpci_t *chip = snd_pcm_substream_chip(substream); |
617 | snd_pcm_runtime_t *runtime = substream->runtime; | 624 | snd_pcm_runtime_t *runtime = substream->runtime; |
618 | ymfpci_pcm_t *ypcm = runtime->private_data; | 625 | ymfpci_pcm_t *ypcm = runtime->private_data; |
619 | unsigned int nvoice; | 626 | unsigned int nvoice; |
@@ -623,14 +630,8 @@ static int snd_ymfpci_playback_prepare(snd_pcm_substream_t * substream) | |||
623 | ypcm->period_pos = 0; | 630 | ypcm->period_pos = 0; |
624 | ypcm->last_pos = 0; | 631 | ypcm->last_pos = 0; |
625 | for (nvoice = 0; nvoice < runtime->channels; nvoice++) | 632 | for (nvoice = 0; nvoice < runtime->channels; nvoice++) |
626 | snd_ymfpci_pcm_init_voice(ypcm->voices[nvoice], | 633 | snd_ymfpci_pcm_init_voice(ypcm, nvoice, runtime, |
627 | runtime->channels == 2, | 634 | substream->pcm == chip->pcm); |
628 | runtime->rate, | ||
629 | snd_pcm_format_width(runtime->format) == 16, | ||
630 | runtime->dma_addr, | ||
631 | ypcm->buffer_size, | ||
632 | ypcm->output_front, | ||
633 | ypcm->output_rear); | ||
634 | return 0; | 635 | return 0; |
635 | } | 636 | } |
636 | 637 | ||
@@ -838,7 +839,7 @@ static int snd_ymfpci_playback_open_1(snd_pcm_substream_t * substream) | |||
838 | snd_pcm_runtime_t *runtime = substream->runtime; | 839 | snd_pcm_runtime_t *runtime = substream->runtime; |
839 | ymfpci_pcm_t *ypcm; | 840 | ymfpci_pcm_t *ypcm; |
840 | 841 | ||
841 | ypcm = kcalloc(1, sizeof(*ypcm), GFP_KERNEL); | 842 | ypcm = kzalloc(sizeof(*ypcm), GFP_KERNEL); |
842 | if (ypcm == NULL) | 843 | if (ypcm == NULL) |
843 | return -ENOMEM; | 844 | return -ENOMEM; |
844 | ypcm->chip = chip; | 845 | ypcm->chip = chip; |
@@ -882,6 +883,7 @@ static int snd_ymfpci_playback_open(snd_pcm_substream_t * substream) | |||
882 | ymfpci_t *chip = snd_pcm_substream_chip(substream); | 883 | ymfpci_t *chip = snd_pcm_substream_chip(substream); |
883 | snd_pcm_runtime_t *runtime = substream->runtime; | 884 | snd_pcm_runtime_t *runtime = substream->runtime; |
884 | ymfpci_pcm_t *ypcm; | 885 | ymfpci_pcm_t *ypcm; |
886 | snd_kcontrol_t *kctl; | ||
885 | int err; | 887 | int err; |
886 | 888 | ||
887 | if ((err = snd_ymfpci_playback_open_1(substream)) < 0) | 889 | if ((err = snd_ymfpci_playback_open_1(substream)) < 0) |
@@ -895,6 +897,10 @@ static int snd_ymfpci_playback_open(snd_pcm_substream_t * substream) | |||
895 | chip->rear_opened++; | 897 | chip->rear_opened++; |
896 | } | 898 | } |
897 | spin_unlock_irq(&chip->reg_lock); | 899 | spin_unlock_irq(&chip->reg_lock); |
900 | |||
901 | kctl = chip->pcm_mixer[substream->number].ctl; | ||
902 | kctl->vd[0].access &= ~SNDRV_CTL_ELEM_ACCESS_INACTIVE; | ||
903 | snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_INFO, &kctl->id); | ||
898 | return 0; | 904 | return 0; |
899 | } | 905 | } |
900 | 906 | ||
@@ -951,7 +957,7 @@ static int snd_ymfpci_capture_open(snd_pcm_substream_t * substream, | |||
951 | snd_pcm_runtime_t *runtime = substream->runtime; | 957 | snd_pcm_runtime_t *runtime = substream->runtime; |
952 | ymfpci_pcm_t *ypcm; | 958 | ymfpci_pcm_t *ypcm; |
953 | 959 | ||
954 | ypcm = kcalloc(1, sizeof(*ypcm), GFP_KERNEL); | 960 | ypcm = kzalloc(sizeof(*ypcm), GFP_KERNEL); |
955 | if (ypcm == NULL) | 961 | if (ypcm == NULL) |
956 | return -ENOMEM; | 962 | return -ENOMEM; |
957 | ypcm->chip = chip; | 963 | ypcm->chip = chip; |
@@ -987,6 +993,7 @@ static int snd_ymfpci_playback_close(snd_pcm_substream_t * substream) | |||
987 | { | 993 | { |
988 | ymfpci_t *chip = snd_pcm_substream_chip(substream); | 994 | ymfpci_t *chip = snd_pcm_substream_chip(substream); |
989 | ymfpci_pcm_t *ypcm = substream->runtime->private_data; | 995 | ymfpci_pcm_t *ypcm = substream->runtime->private_data; |
996 | snd_kcontrol_t *kctl; | ||
990 | 997 | ||
991 | spin_lock_irq(&chip->reg_lock); | 998 | spin_lock_irq(&chip->reg_lock); |
992 | if (ypcm->output_rear && chip->rear_opened > 0) { | 999 | if (ypcm->output_rear && chip->rear_opened > 0) { |
@@ -994,6 +1001,9 @@ static int snd_ymfpci_playback_close(snd_pcm_substream_t * substream) | |||
994 | ymfpci_close_extension(chip); | 1001 | ymfpci_close_extension(chip); |
995 | } | 1002 | } |
996 | spin_unlock_irq(&chip->reg_lock); | 1003 | spin_unlock_irq(&chip->reg_lock); |
1004 | kctl = chip->pcm_mixer[substream->number].ctl; | ||
1005 | kctl->vd[0].access |= SNDRV_CTL_ELEM_ACCESS_INACTIVE; | ||
1006 | snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_INFO, &kctl->id); | ||
997 | return snd_ymfpci_playback_close_1(substream); | 1007 | return snd_ymfpci_playback_close_1(substream); |
998 | } | 1008 | } |
999 | 1009 | ||
@@ -1665,6 +1675,66 @@ static snd_kcontrol_new_t snd_ymfpci_rear_shared __devinitdata = { | |||
1665 | .private_value = 2, | 1675 | .private_value = 2, |
1666 | }; | 1676 | }; |
1667 | 1677 | ||
1678 | /* | ||
1679 | * PCM voice volume | ||
1680 | */ | ||
1681 | |||
1682 | static int snd_ymfpci_pcm_vol_info(snd_kcontrol_t *kcontrol, | ||
1683 | snd_ctl_elem_info_t *uinfo) | ||
1684 | { | ||
1685 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; | ||
1686 | uinfo->count = 2; | ||
1687 | uinfo->value.integer.min = 0; | ||
1688 | uinfo->value.integer.max = 0x8000; | ||
1689 | return 0; | ||
1690 | } | ||
1691 | |||
1692 | static int snd_ymfpci_pcm_vol_get(snd_kcontrol_t *kcontrol, | ||
1693 | snd_ctl_elem_value_t *ucontrol) | ||
1694 | { | ||
1695 | ymfpci_t *chip = snd_kcontrol_chip(kcontrol); | ||
1696 | unsigned int subs = kcontrol->id.subdevice; | ||
1697 | |||
1698 | ucontrol->value.integer.value[0] = chip->pcm_mixer[subs].left; | ||
1699 | ucontrol->value.integer.value[1] = chip->pcm_mixer[subs].right; | ||
1700 | return 0; | ||
1701 | } | ||
1702 | |||
1703 | static int snd_ymfpci_pcm_vol_put(snd_kcontrol_t *kcontrol, | ||
1704 | snd_ctl_elem_value_t *ucontrol) | ||
1705 | { | ||
1706 | ymfpci_t *chip = snd_kcontrol_chip(kcontrol); | ||
1707 | unsigned int subs = kcontrol->id.subdevice; | ||
1708 | snd_pcm_substream_t *substream; | ||
1709 | unsigned long flags; | ||
1710 | |||
1711 | if (ucontrol->value.integer.value[0] != chip->pcm_mixer[subs].left || | ||
1712 | ucontrol->value.integer.value[1] != chip->pcm_mixer[subs].right) { | ||
1713 | chip->pcm_mixer[subs].left = ucontrol->value.integer.value[0]; | ||
1714 | chip->pcm_mixer[subs].right = ucontrol->value.integer.value[1]; | ||
1715 | |||
1716 | substream = (snd_pcm_substream_t *)kcontrol->private_value; | ||
1717 | spin_lock_irqsave(&chip->voice_lock, flags); | ||
1718 | if (substream->runtime && substream->runtime->private_data) { | ||
1719 | ymfpci_pcm_t *ypcm = substream->runtime->private_data; | ||
1720 | ypcm->update_pcm_vol = 2; | ||
1721 | } | ||
1722 | spin_unlock_irqrestore(&chip->voice_lock, flags); | ||
1723 | return 1; | ||
1724 | } | ||
1725 | return 0; | ||
1726 | } | ||
1727 | |||
1728 | static snd_kcontrol_new_t snd_ymfpci_pcm_volume __devinitdata = { | ||
1729 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, | ||
1730 | .name = "PCM Playback Volume", | ||
1731 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | | ||
1732 | SNDRV_CTL_ELEM_ACCESS_INACTIVE, | ||
1733 | .info = snd_ymfpci_pcm_vol_info, | ||
1734 | .get = snd_ymfpci_pcm_vol_get, | ||
1735 | .put = snd_ymfpci_pcm_vol_put, | ||
1736 | }; | ||
1737 | |||
1668 | 1738 | ||
1669 | /* | 1739 | /* |
1670 | * Mixer routines | 1740 | * Mixer routines |
@@ -1686,6 +1756,7 @@ int __devinit snd_ymfpci_mixer(ymfpci_t *chip, int rear_switch) | |||
1686 | { | 1756 | { |
1687 | ac97_template_t ac97; | 1757 | ac97_template_t ac97; |
1688 | snd_kcontrol_t *kctl; | 1758 | snd_kcontrol_t *kctl; |
1759 | snd_pcm_substream_t *substream; | ||
1689 | unsigned int idx; | 1760 | unsigned int idx; |
1690 | int err; | 1761 | int err; |
1691 | static ac97_bus_ops_t ops = { | 1762 | static ac97_bus_ops_t ops = { |
@@ -1739,6 +1810,23 @@ int __devinit snd_ymfpci_mixer(ymfpci_t *chip, int rear_switch) | |||
1739 | return err; | 1810 | return err; |
1740 | } | 1811 | } |
1741 | 1812 | ||
1813 | /* per-voice volume */ | ||
1814 | substream = chip->pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream; | ||
1815 | for (idx = 0; idx < 32; ++idx) { | ||
1816 | kctl = snd_ctl_new1(&snd_ymfpci_pcm_volume, chip); | ||
1817 | if (!kctl) | ||
1818 | return -ENOMEM; | ||
1819 | kctl->id.device = chip->pcm->device; | ||
1820 | kctl->id.subdevice = idx; | ||
1821 | kctl->private_value = (unsigned long)substream; | ||
1822 | if ((err = snd_ctl_add(chip->card, kctl)) < 0) | ||
1823 | return err; | ||
1824 | chip->pcm_mixer[idx].left = 0x8000; | ||
1825 | chip->pcm_mixer[idx].right = 0x8000; | ||
1826 | chip->pcm_mixer[idx].ctl = kctl; | ||
1827 | substream = substream->next; | ||
1828 | } | ||
1829 | |||
1742 | return 0; | 1830 | return 0; |
1743 | } | 1831 | } |
1744 | 1832 | ||
@@ -2182,7 +2270,7 @@ int __devinit snd_ymfpci_create(snd_card_t * card, | |||
2182 | if ((err = pci_enable_device(pci)) < 0) | 2270 | if ((err = pci_enable_device(pci)) < 0) |
2183 | return err; | 2271 | return err; |
2184 | 2272 | ||
2185 | chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); | 2273 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); |
2186 | if (chip == NULL) { | 2274 | if (chip == NULL) { |
2187 | pci_disable_device(pci); | 2275 | pci_disable_device(pci); |
2188 | return -ENOMEM; | 2276 | return -ENOMEM; |
diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf_core.c b/sound/pcmcia/pdaudiocf/pdaudiocf_core.c index a2132e3763dd..0208c54896b3 100644 --- a/sound/pcmcia/pdaudiocf/pdaudiocf_core.c +++ b/sound/pcmcia/pdaudiocf/pdaudiocf_core.c | |||
@@ -151,7 +151,7 @@ pdacf_t *snd_pdacf_create(snd_card_t *card) | |||
151 | { | 151 | { |
152 | pdacf_t *chip; | 152 | pdacf_t *chip; |
153 | 153 | ||
154 | chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); | 154 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); |
155 | if (chip == NULL) | 155 | if (chip == NULL) |
156 | return NULL; | 156 | return NULL; |
157 | chip->card = card; | 157 | chip->card = card; |
diff --git a/sound/pcmcia/vx/vxpocket.c b/sound/pcmcia/vx/vxpocket.c index 3a82161d3b24..1e8f16b4c073 100644 --- a/sound/pcmcia/vx/vxpocket.c +++ b/sound/pcmcia/vx/vxpocket.c | |||
@@ -297,6 +297,7 @@ static void vxpocket_config(dev_link_t *link) | |||
297 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link->handle, &link->conf)); | 297 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link->handle, &link->conf)); |
298 | 298 | ||
299 | chip->dev = &handle_to_dev(link->handle); | 299 | chip->dev = &handle_to_dev(link->handle); |
300 | snd_card_set_dev(chip->card, chip->dev); | ||
300 | 301 | ||
301 | if (snd_vxpocket_assign_resources(chip, link->io.BasePort1, link->irq.AssignedIRQ) < 0) | 302 | if (snd_vxpocket_assign_resources(chip, link->io.BasePort1, link->irq.AssignedIRQ) < 0) |
302 | goto failed; | 303 | goto failed; |
@@ -376,7 +377,7 @@ static int vxpocket_event(event_t event, int priority, event_callback_args_t *ar | |||
376 | 377 | ||
377 | /* | 378 | /* |
378 | */ | 379 | */ |
379 | static dev_link_t *vxp_attach(void) | 380 | static dev_link_t *vxpocket_attach(void) |
380 | { | 381 | { |
381 | snd_card_t *card; | 382 | snd_card_t *card; |
382 | struct snd_vxpocket *vxp; | 383 | struct snd_vxpocket *vxp; |
@@ -407,7 +408,7 @@ static dev_link_t *vxp_attach(void) | |||
407 | return NULL; | 408 | return NULL; |
408 | } | 409 | } |
409 | 410 | ||
410 | vxp->index = index[i]; | 411 | vxp->index = i; |
411 | card_alloc |= 1 << i; | 412 | card_alloc |= 1 << i; |
412 | 413 | ||
413 | /* Chain drivers */ | 414 | /* Chain drivers */ |
@@ -417,7 +418,7 @@ static dev_link_t *vxp_attach(void) | |||
417 | return &vxp->link; | 418 | return &vxp->link; |
418 | } | 419 | } |
419 | 420 | ||
420 | static void vxp_detach(dev_link_t *link) | 421 | static void vxpocket_detach(dev_link_t *link) |
421 | { | 422 | { |
422 | struct snd_vxpocket *vxp; | 423 | struct snd_vxpocket *vxp; |
423 | vx_core_t *chip; | 424 | vx_core_t *chip; |
@@ -458,8 +459,9 @@ static struct pcmcia_driver vxp_cs_driver = { | |||
458 | .drv = { | 459 | .drv = { |
459 | .name = "snd-vxpocket", | 460 | .name = "snd-vxpocket", |
460 | }, | 461 | }, |
461 | .attach = vxp_attach, | 462 | .attach = vxpocket_attach, |
462 | .detach = vxp_detach, | 463 | .detach = vxpocket_detach, |
464 | .event = vxpocket_event, | ||
463 | .id_table = vxp_ids, | 465 | .id_table = vxp_ids, |
464 | }; | 466 | }; |
465 | 467 | ||
diff --git a/sound/ppc/Kconfig b/sound/ppc/Kconfig index 75213bf4d567..206b9333f91f 100644 --- a/sound/ppc/Kconfig +++ b/sound/ppc/Kconfig | |||
@@ -13,11 +13,24 @@ config SND_POWERMAC | |||
13 | tristate "PowerMac (AWACS, DACA, Burgundy, Tumbler, Keywest)" | 13 | tristate "PowerMac (AWACS, DACA, Burgundy, Tumbler, Keywest)" |
14 | depends on SND && I2C && INPUT && PPC_PMAC | 14 | depends on SND && I2C && INPUT && PPC_PMAC |
15 | select SND_PCM | 15 | select SND_PCM |
16 | select SND_GENERIC_DRIVER | ||
16 | help | 17 | help |
17 | Say Y here to include support for the integrated sound device. | 18 | Say Y here to include support for the integrated sound device. |
18 | 19 | ||
19 | To compile this driver as a module, choose M here: the module | 20 | To compile this driver as a module, choose M here: the module |
20 | will be called snd-powermac. | 21 | will be called snd-powermac. |
21 | 22 | ||
22 | endmenu | 23 | config SND_POWERMAC_AUTO_DRC |
24 | bool "Toggle DRC automatically at headphone/line plug-in" | ||
25 | depends on SND_POWERMAC | ||
26 | default y | ||
27 | help | ||
28 | Say Y here to enable the automatic toggle of DRC (dynamic | ||
29 | range compression) on Tumbler/Snapper. | ||
30 | If this feature is enabled, DRC is turned off when the | ||
31 | headphone/line jack is plugged, and turned on when unplugged. | ||
23 | 32 | ||
33 | Note that you can turn on/off DRC manually even without this | ||
34 | option. | ||
35 | |||
36 | endmenu | ||
diff --git a/sound/ppc/beep.c b/sound/ppc/beep.c index 31ea7a4c069f..1681ee13efbb 100644 --- a/sound/ppc/beep.c +++ b/sound/ppc/beep.c | |||
@@ -31,14 +31,14 @@ | |||
31 | #include "pmac.h" | 31 | #include "pmac.h" |
32 | 32 | ||
33 | struct snd_pmac_beep { | 33 | struct snd_pmac_beep { |
34 | int running; /* boolean */ | 34 | int running; /* boolean */ |
35 | int volume; /* mixer volume: 0-100 */ | 35 | int volume; /* mixer volume: 0-100 */ |
36 | int volume_play; /* currently playing volume */ | 36 | int volume_play; /* currently playing volume */ |
37 | int hz; | 37 | int hz; |
38 | int nsamples; | 38 | int nsamples; |
39 | short *buf; /* allocated wave buffer */ | 39 | short *buf; /* allocated wave buffer */ |
40 | dma_addr_t addr; /* physical address of buffer */ | 40 | dma_addr_t addr; /* physical address of buffer */ |
41 | struct input_dev dev; | 41 | struct input_dev *dev; |
42 | }; | 42 | }; |
43 | 43 | ||
44 | /* | 44 | /* |
@@ -212,47 +212,55 @@ static snd_kcontrol_new_t snd_pmac_beep_mixer = { | |||
212 | int __init snd_pmac_attach_beep(pmac_t *chip) | 212 | int __init snd_pmac_attach_beep(pmac_t *chip) |
213 | { | 213 | { |
214 | pmac_beep_t *beep; | 214 | pmac_beep_t *beep; |
215 | int err; | 215 | struct input_dev *input_dev; |
216 | void *dmabuf; | ||
217 | int err = -ENOMEM; | ||
216 | 218 | ||
217 | beep = kmalloc(sizeof(*beep), GFP_KERNEL); | 219 | beep = kzalloc(sizeof(*beep), GFP_KERNEL); |
218 | if (! beep) | 220 | dmabuf = dma_alloc_coherent(&chip->pdev->dev, BEEP_BUFLEN * 4, |
219 | return -ENOMEM; | 221 | &beep->addr, GFP_KERNEL); |
220 | 222 | input_dev = input_allocate_device(); | |
221 | memset(beep, 0, sizeof(*beep)); | 223 | if (!beep || !dmabuf || !input_dev) |
222 | beep->buf = dma_alloc_coherent(&chip->pdev->dev, BEEP_BUFLEN * 4, | 224 | goto fail; |
223 | &beep->addr, GFP_KERNEL); | ||
224 | |||
225 | beep->dev.evbit[0] = BIT(EV_SND); | ||
226 | beep->dev.sndbit[0] = BIT(SND_BELL) | BIT(SND_TONE); | ||
227 | beep->dev.event = snd_pmac_beep_event; | ||
228 | beep->dev.private = chip; | ||
229 | 225 | ||
230 | /* FIXME: set more better values */ | 226 | /* FIXME: set more better values */ |
231 | beep->dev.name = "PowerMac Beep"; | 227 | input_dev->name = "PowerMac Beep"; |
232 | beep->dev.phys = "powermac/beep"; | 228 | input_dev->phys = "powermac/beep"; |
233 | beep->dev.id.bustype = BUS_ADB; | 229 | input_dev->id.bustype = BUS_ADB; |
234 | beep->dev.id.vendor = 0x001f; | 230 | input_dev->id.vendor = 0x001f; |
235 | beep->dev.id.product = 0x0001; | 231 | input_dev->id.product = 0x0001; |
236 | beep->dev.id.version = 0x0100; | 232 | input_dev->id.version = 0x0100; |
233 | |||
234 | input_dev->evbit[0] = BIT(EV_SND); | ||
235 | input_dev->sndbit[0] = BIT(SND_BELL) | BIT(SND_TONE); | ||
236 | input_dev->event = snd_pmac_beep_event; | ||
237 | input_dev->private = chip; | ||
238 | input_dev->cdev.dev = &chip->pdev->dev; | ||
237 | 239 | ||
240 | beep->dev = input_dev; | ||
241 | beep->buf = dmabuf; | ||
238 | beep->volume = BEEP_VOLUME; | 242 | beep->volume = BEEP_VOLUME; |
239 | beep->running = 0; | 243 | beep->running = 0; |
240 | if ((err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_pmac_beep_mixer, chip))) < 0) { | 244 | |
241 | kfree(beep->buf); | 245 | err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_pmac_beep_mixer, chip)); |
242 | kfree(beep); | 246 | if (err < 0) |
243 | return err; | 247 | goto fail; |
244 | } | ||
245 | 248 | ||
246 | chip->beep = beep; | 249 | chip->beep = beep; |
247 | input_register_device(&beep->dev); | 250 | input_register_device(beep->dev); |
248 | 251 | ||
249 | return 0; | 252 | return 0; |
253 | |||
254 | fail: input_free_device(input_dev); | ||
255 | kfree(dmabuf); | ||
256 | kfree(beep); | ||
257 | return err; | ||
250 | } | 258 | } |
251 | 259 | ||
252 | void snd_pmac_detach_beep(pmac_t *chip) | 260 | void snd_pmac_detach_beep(pmac_t *chip) |
253 | { | 261 | { |
254 | if (chip->beep) { | 262 | if (chip->beep) { |
255 | input_unregister_device(&chip->beep->dev); | 263 | input_unregister_device(chip->beep->dev); |
256 | dma_free_coherent(&chip->pdev->dev, BEEP_BUFLEN * 4, | 264 | dma_free_coherent(&chip->pdev->dev, BEEP_BUFLEN * 4, |
257 | chip->beep->buf, chip->beep->addr); | 265 | chip->beep->buf, chip->beep->addr); |
258 | kfree(chip->beep); | 266 | kfree(chip->beep); |
diff --git a/sound/ppc/pmac.c b/sound/ppc/pmac.c index 844d76152ea2..392b2abd9f13 100644 --- a/sound/ppc/pmac.c +++ b/sound/ppc/pmac.c | |||
@@ -765,7 +765,8 @@ snd_pmac_ctrl_intr(int irq, void *devid, struct pt_regs *regs) | |||
765 | */ | 765 | */ |
766 | static void snd_pmac_sound_feature(pmac_t *chip, int enable) | 766 | static void snd_pmac_sound_feature(pmac_t *chip, int enable) |
767 | { | 767 | { |
768 | ppc_md.feature_call(PMAC_FTR_SOUND_CHIP_ENABLE, chip->node, 0, enable); | 768 | if (ppc_md.feature_call) |
769 | ppc_md.feature_call(PMAC_FTR_SOUND_CHIP_ENABLE, chip->node, 0, enable); | ||
769 | } | 770 | } |
770 | 771 | ||
771 | /* | 772 | /* |
@@ -987,6 +988,8 @@ static int __init snd_pmac_detect(pmac_t *chip) | |||
987 | case 0x33: | 988 | case 0x33: |
988 | case 0x29: | 989 | case 0x29: |
989 | case 0x24: | 990 | case 0x24: |
991 | case 0x50: | ||
992 | case 0x5c: | ||
990 | chip->num_freqs = ARRAY_SIZE(tumbler_freqs); | 993 | chip->num_freqs = ARRAY_SIZE(tumbler_freqs); |
991 | chip->model = PMAC_SNAPPER; | 994 | chip->model = PMAC_SNAPPER; |
992 | chip->can_byte_swap = 0; /* FIXME: check this */ | 995 | chip->can_byte_swap = 0; /* FIXME: check this */ |
@@ -1158,7 +1161,7 @@ int __init snd_pmac_new(snd_card_t *card, pmac_t **chip_return) | |||
1158 | snd_runtime_check(chip_return, return -EINVAL); | 1161 | snd_runtime_check(chip_return, return -EINVAL); |
1159 | *chip_return = NULL; | 1162 | *chip_return = NULL; |
1160 | 1163 | ||
1161 | chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); | 1164 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); |
1162 | if (chip == NULL) | 1165 | if (chip == NULL) |
1163 | return -ENOMEM; | 1166 | return -ENOMEM; |
1164 | chip->card = card; | 1167 | chip->card = card; |
diff --git a/sound/ppc/powermac.c b/sound/ppc/powermac.c index 231f6432ea6d..a6d8cbf4064f 100644 --- a/sound/ppc/powermac.c +++ b/sound/ppc/powermac.c | |||
@@ -131,6 +131,9 @@ static int __init snd_pmac_probe(void) | |||
131 | if (enable_beep) | 131 | if (enable_beep) |
132 | snd_pmac_attach_beep(chip); | 132 | snd_pmac_attach_beep(chip); |
133 | 133 | ||
134 | if ((err = snd_card_set_generic_dev(card)) < 0) | ||
135 | goto __error; | ||
136 | |||
134 | if ((err = snd_card_register(card)) < 0) | 137 | if ((err = snd_card_register(card)) < 0) |
135 | goto __error; | 138 | goto __error; |
136 | 139 | ||
diff --git a/sound/ppc/tumbler.c b/sound/ppc/tumbler.c index b94437c024b1..65384afcfc3f 100644 --- a/sound/ppc/tumbler.c +++ b/sound/ppc/tumbler.c | |||
@@ -948,7 +948,6 @@ static void device_change_handler(void *self) | |||
948 | msleep(10); | 948 | msleep(10); |
949 | check_mute(chip, &mix->amp_mute, 1, mix->auto_mute_notify, | 949 | check_mute(chip, &mix->amp_mute, 1, mix->auto_mute_notify, |
950 | chip->speaker_sw_ctl); | 950 | chip->speaker_sw_ctl); |
951 | mix->drc_enable = 0; | ||
952 | } else { | 951 | } else { |
953 | /* unmute speaker, mute others */ | 952 | /* unmute speaker, mute others */ |
954 | check_mute(chip, &mix->amp_mute, 0, mix->auto_mute_notify, | 953 | check_mute(chip, &mix->amp_mute, 0, mix->auto_mute_notify, |
@@ -960,20 +959,21 @@ static void device_change_handler(void *self) | |||
960 | if (mix->line_mute.addr != 0) | 959 | if (mix->line_mute.addr != 0) |
961 | check_mute(chip, &mix->line_mute, 1, mix->auto_mute_notify, | 960 | check_mute(chip, &mix->line_mute, 1, mix->auto_mute_notify, |
962 | chip->lineout_sw_ctl); | 961 | chip->lineout_sw_ctl); |
963 | mix->drc_enable = 1; | ||
964 | } | 962 | } |
965 | if (mix->auto_mute_notify) { | 963 | if (mix->auto_mute_notify) |
966 | snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, | 964 | snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, |
967 | &chip->hp_detect_ctl->id); | 965 | &chip->hp_detect_ctl->id); |
966 | |||
967 | #ifdef CONFIG_SND_POWERMAC_AUTO_DRC | ||
968 | mix->drc_enable = ! (headphone || lineout); | ||
969 | if (mix->auto_mute_notify) | ||
968 | snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, | 970 | snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, |
969 | &chip->drc_sw_ctl->id); | 971 | &chip->drc_sw_ctl->id); |
970 | } | ||
971 | |||
972 | /* first set the DRC so the speaker do not explode -ReneR */ | ||
973 | if (chip->model == PMAC_TUMBLER) | 972 | if (chip->model == PMAC_TUMBLER) |
974 | tumbler_set_drc(mix); | 973 | tumbler_set_drc(mix); |
975 | else | 974 | else |
976 | snapper_set_drc(mix); | 975 | snapper_set_drc(mix); |
976 | #endif | ||
977 | 977 | ||
978 | /* reset the master volume so the correct amplification is applied */ | 978 | /* reset the master volume so the correct amplification is applied */ |
979 | tumbler_set_master_volume(mix); | 979 | tumbler_set_master_volume(mix); |
@@ -1370,6 +1370,17 @@ int __init snd_pmac_tumbler_init(pmac_t *chip) | |||
1370 | if ((err = snd_ctl_add(chip->card, chip->drc_sw_ctl)) < 0) | 1370 | if ((err = snd_ctl_add(chip->card, chip->drc_sw_ctl)) < 0) |
1371 | return err; | 1371 | return err; |
1372 | 1372 | ||
1373 | /* set initial DRC range to 60% */ | ||
1374 | if (chip->model == PMAC_TUMBLER) | ||
1375 | mix->drc_range = (TAS3001_DRC_MAX * 6) / 10; | ||
1376 | else | ||
1377 | mix->drc_range = (TAS3004_DRC_MAX * 6) / 10; | ||
1378 | mix->drc_enable = 1; /* will be changed later if AUTO_DRC is set */ | ||
1379 | if (chip->model == PMAC_TUMBLER) | ||
1380 | tumbler_set_drc(mix); | ||
1381 | else | ||
1382 | snapper_set_drc(mix); | ||
1383 | |||
1373 | #ifdef CONFIG_PM | 1384 | #ifdef CONFIG_PM |
1374 | chip->suspend = tumbler_suspend; | 1385 | chip->suspend = tumbler_suspend; |
1375 | chip->resume = tumbler_resume; | 1386 | chip->resume = tumbler_resume; |
diff --git a/sound/sound_core.c b/sound/sound_core.c index 21a69e096225..394b53e20cb8 100644 --- a/sound/sound_core.c +++ b/sound/sound_core.c | |||
@@ -153,7 +153,7 @@ static DEFINE_SPINLOCK(sound_loader_lock); | |||
153 | * list. Acquires locks as needed | 153 | * list. Acquires locks as needed |
154 | */ | 154 | */ |
155 | 155 | ||
156 | static int sound_insert_unit(struct sound_unit **list, struct file_operations *fops, int index, int low, int top, const char *name, umode_t mode) | 156 | static int sound_insert_unit(struct sound_unit **list, struct file_operations *fops, int index, int low, int top, const char *name, umode_t mode, struct device *dev) |
157 | { | 157 | { |
158 | struct sound_unit *s = kmalloc(sizeof(*s), GFP_KERNEL); | 158 | struct sound_unit *s = kmalloc(sizeof(*s), GFP_KERNEL); |
159 | int r; | 159 | int r; |
@@ -174,8 +174,8 @@ static int sound_insert_unit(struct sound_unit **list, struct file_operations *f | |||
174 | 174 | ||
175 | devfs_mk_cdev(MKDEV(SOUND_MAJOR, s->unit_minor), | 175 | devfs_mk_cdev(MKDEV(SOUND_MAJOR, s->unit_minor), |
176 | S_IFCHR | mode, s->name); | 176 | S_IFCHR | mode, s->name); |
177 | class_device_create(sound_class, MKDEV(SOUND_MAJOR, s->unit_minor), | 177 | class_device_create(sound_class, NULL, MKDEV(SOUND_MAJOR, s->unit_minor), |
178 | NULL, s->name+6); | 178 | dev, s->name+6); |
179 | return r; | 179 | return r; |
180 | 180 | ||
181 | fail: | 181 | fail: |
@@ -227,16 +227,18 @@ static void sound_remove_unit(struct sound_unit **list, int unit) | |||
227 | static struct sound_unit *chains[SOUND_STEP]; | 227 | static struct sound_unit *chains[SOUND_STEP]; |
228 | 228 | ||
229 | /** | 229 | /** |
230 | * register_sound_special - register a special sound node | 230 | * register_sound_special_device - register a special sound node |
231 | * @fops: File operations for the driver | 231 | * @fops: File operations for the driver |
232 | * @unit: Unit number to allocate | 232 | * @unit: Unit number to allocate |
233 | * @dev: device pointer | ||
233 | * | 234 | * |
234 | * Allocate a special sound device by minor number from the sound | 235 | * Allocate a special sound device by minor number from the sound |
235 | * subsystem. The allocated number is returned on succes. On failure | 236 | * subsystem. The allocated number is returned on succes. On failure |
236 | * a negative error code is returned. | 237 | * a negative error code is returned. |
237 | */ | 238 | */ |
238 | 239 | ||
239 | int register_sound_special(struct file_operations *fops, int unit) | 240 | int register_sound_special_device(struct file_operations *fops, int unit, |
241 | struct device *dev) | ||
240 | { | 242 | { |
241 | const int chain = unit % SOUND_STEP; | 243 | const int chain = unit % SOUND_STEP; |
242 | int max_unit = 128 + chain; | 244 | int max_unit = 128 + chain; |
@@ -294,9 +296,16 @@ int register_sound_special(struct file_operations *fops, int unit) | |||
294 | break; | 296 | break; |
295 | } | 297 | } |
296 | return sound_insert_unit(&chains[chain], fops, -1, unit, max_unit, | 298 | return sound_insert_unit(&chains[chain], fops, -1, unit, max_unit, |
297 | name, S_IRUSR | S_IWUSR); | 299 | name, S_IRUSR | S_IWUSR, dev); |
298 | } | 300 | } |
299 | 301 | ||
302 | EXPORT_SYMBOL(register_sound_special_device); | ||
303 | |||
304 | int register_sound_special(struct file_operations *fops, int unit) | ||
305 | { | ||
306 | return register_sound_special_device(fops, unit, NULL); | ||
307 | } | ||
308 | |||
300 | EXPORT_SYMBOL(register_sound_special); | 309 | EXPORT_SYMBOL(register_sound_special); |
301 | 310 | ||
302 | /** | 311 | /** |
@@ -312,7 +321,7 @@ EXPORT_SYMBOL(register_sound_special); | |||
312 | int register_sound_mixer(struct file_operations *fops, int dev) | 321 | int register_sound_mixer(struct file_operations *fops, int dev) |
313 | { | 322 | { |
314 | return sound_insert_unit(&chains[0], fops, dev, 0, 128, | 323 | return sound_insert_unit(&chains[0], fops, dev, 0, 128, |
315 | "mixer", S_IRUSR | S_IWUSR); | 324 | "mixer", S_IRUSR | S_IWUSR, NULL); |
316 | } | 325 | } |
317 | 326 | ||
318 | EXPORT_SYMBOL(register_sound_mixer); | 327 | EXPORT_SYMBOL(register_sound_mixer); |
@@ -330,7 +339,7 @@ EXPORT_SYMBOL(register_sound_mixer); | |||
330 | int register_sound_midi(struct file_operations *fops, int dev) | 339 | int register_sound_midi(struct file_operations *fops, int dev) |
331 | { | 340 | { |
332 | return sound_insert_unit(&chains[2], fops, dev, 2, 130, | 341 | return sound_insert_unit(&chains[2], fops, dev, 2, 130, |
333 | "midi", S_IRUSR | S_IWUSR); | 342 | "midi", S_IRUSR | S_IWUSR, NULL); |
334 | } | 343 | } |
335 | 344 | ||
336 | EXPORT_SYMBOL(register_sound_midi); | 345 | EXPORT_SYMBOL(register_sound_midi); |
@@ -356,7 +365,7 @@ EXPORT_SYMBOL(register_sound_midi); | |||
356 | int register_sound_dsp(struct file_operations *fops, int dev) | 365 | int register_sound_dsp(struct file_operations *fops, int dev) |
357 | { | 366 | { |
358 | return sound_insert_unit(&chains[3], fops, dev, 3, 131, | 367 | return sound_insert_unit(&chains[3], fops, dev, 3, 131, |
359 | "dsp", S_IWUSR | S_IRUSR); | 368 | "dsp", S_IWUSR | S_IRUSR, NULL); |
360 | } | 369 | } |
361 | 370 | ||
362 | EXPORT_SYMBOL(register_sound_dsp); | 371 | EXPORT_SYMBOL(register_sound_dsp); |
@@ -375,7 +384,7 @@ EXPORT_SYMBOL(register_sound_dsp); | |||
375 | int register_sound_synth(struct file_operations *fops, int dev) | 384 | int register_sound_synth(struct file_operations *fops, int dev) |
376 | { | 385 | { |
377 | return sound_insert_unit(&chains[9], fops, dev, 9, 137, | 386 | return sound_insert_unit(&chains[9], fops, dev, 9, 137, |
378 | "synth", S_IRUSR | S_IWUSR); | 387 | "synth", S_IRUSR | S_IWUSR, NULL); |
379 | } | 388 | } |
380 | 389 | ||
381 | EXPORT_SYMBOL(register_sound_synth); | 390 | EXPORT_SYMBOL(register_sound_synth); |
diff --git a/sound/sparc/Kconfig b/sound/sparc/Kconfig index 25a8a558ef92..09ab138646a6 100644 --- a/sound/sparc/Kconfig +++ b/sound/sparc/Kconfig | |||
@@ -7,6 +7,7 @@ config SND_SUN_AMD7930 | |||
7 | tristate "Sun AMD7930" | 7 | tristate "Sun AMD7930" |
8 | depends on SBUS && SND | 8 | depends on SBUS && SND |
9 | select SND_PCM | 9 | select SND_PCM |
10 | select SND_GENERIC_DRIVER | ||
10 | help | 11 | help |
11 | Say Y here to include support for AMD7930 sound device on Sun. | 12 | Say Y here to include support for AMD7930 sound device on Sun. |
12 | 13 | ||
@@ -17,6 +18,7 @@ config SND_SUN_CS4231 | |||
17 | tristate "Sun CS4231" | 18 | tristate "Sun CS4231" |
18 | depends on SND | 19 | depends on SND |
19 | select SND_PCM | 20 | select SND_PCM |
21 | select SND_GENERIC_DRIVER | ||
20 | help | 22 | help |
21 | Say Y here to include support for CS4231 sound device on Sun. | 23 | Say Y here to include support for CS4231 sound device on Sun. |
22 | 24 | ||
@@ -27,6 +29,7 @@ config SND_SUN_DBRI | |||
27 | tristate "Sun DBRI" | 29 | tristate "Sun DBRI" |
28 | depends on SND && SBUS | 30 | depends on SND && SBUS |
29 | select SND_PCM | 31 | select SND_PCM |
32 | select SND_GENERIC_DRIVER | ||
30 | help | 33 | help |
31 | Say Y here to include support for DBRI sound device on Sun. | 34 | Say Y here to include support for DBRI sound device on Sun. |
32 | 35 | ||
diff --git a/sound/sparc/amd7930.c b/sound/sparc/amd7930.c index bd8a850e93ea..46d504ba7e03 100644 --- a/sound/sparc/amd7930.c +++ b/sound/sparc/amd7930.c | |||
@@ -967,7 +967,7 @@ static int __init snd_amd7930_create(snd_card_t *card, | |||
967 | int err; | 967 | int err; |
968 | 968 | ||
969 | *ramd = NULL; | 969 | *ramd = NULL; |
970 | amd = kcalloc(1, sizeof(*amd), GFP_KERNEL); | 970 | amd = kzalloc(sizeof(*amd), GFP_KERNEL); |
971 | if (amd == NULL) | 971 | if (amd == NULL) |
972 | return -ENOMEM; | 972 | return -ENOMEM; |
973 | 973 | ||
@@ -1088,6 +1088,9 @@ static int __init amd7930_attach(int prom_node, struct sbus_dev *sdev) | |||
1088 | if ((err = snd_amd7930_mixer(amd)) < 0) | 1088 | if ((err = snd_amd7930_mixer(amd)) < 0) |
1089 | goto out_err; | 1089 | goto out_err; |
1090 | 1090 | ||
1091 | if ((err = snd_card_set_generic_dev(card)) < 0) | ||
1092 | goto out_err; | ||
1093 | |||
1091 | if ((err = snd_card_register(card)) < 0) | 1094 | if ((err = snd_card_register(card)) < 0) |
1092 | goto out_err; | 1095 | goto out_err; |
1093 | 1096 | ||
diff --git a/sound/sparc/cs4231.c b/sound/sparc/cs4231.c index 36f9fe4d7bea..f4361c518e46 100644 --- a/sound/sparc/cs4231.c +++ b/sound/sparc/cs4231.c | |||
@@ -173,7 +173,7 @@ static cs4231_t *cs4231_list; | |||
173 | 173 | ||
174 | #define CS4231_GLOBALIRQ 0x01 /* IRQ is active */ | 174 | #define CS4231_GLOBALIRQ 0x01 /* IRQ is active */ |
175 | 175 | ||
176 | /* definitions for codec irq status */ | 176 | /* definitions for codec irq status - CS4231_IRQ_STATUS */ |
177 | 177 | ||
178 | #define CS4231_PLAYBACK_IRQ 0x10 | 178 | #define CS4231_PLAYBACK_IRQ 0x10 |
179 | #define CS4231_RECORD_IRQ 0x20 | 179 | #define CS4231_RECORD_IRQ 0x20 |
@@ -402,7 +402,7 @@ static void snd_cs4231_outm(cs4231_t *chip, unsigned char reg, | |||
402 | udelay(100); | 402 | udelay(100); |
403 | #ifdef CONFIG_SND_DEBUG | 403 | #ifdef CONFIG_SND_DEBUG |
404 | if (__cs4231_readb(chip, CS4231P(chip, REGSEL)) & CS4231_INIT) | 404 | if (__cs4231_readb(chip, CS4231P(chip, REGSEL)) & CS4231_INIT) |
405 | snd_printk("outm: auto calibration time out - reg = 0x%x, value = 0x%x\n", reg, value); | 405 | snd_printdd("outm: auto calibration time out - reg = 0x%x, value = 0x%x\n", reg, value); |
406 | #endif | 406 | #endif |
407 | if (chip->calibrate_mute) { | 407 | if (chip->calibrate_mute) { |
408 | chip->image[reg] &= mask; | 408 | chip->image[reg] &= mask; |
@@ -425,6 +425,10 @@ static void snd_cs4231_dout(cs4231_t *chip, unsigned char reg, unsigned char val | |||
425 | timeout > 0 && (__cs4231_readb(chip, CS4231P(chip, REGSEL)) & CS4231_INIT); | 425 | timeout > 0 && (__cs4231_readb(chip, CS4231P(chip, REGSEL)) & CS4231_INIT); |
426 | timeout--) | 426 | timeout--) |
427 | udelay(100); | 427 | udelay(100); |
428 | #ifdef CONFIG_SND_DEBUG | ||
429 | if (__cs4231_readb(chip, CS4231P(chip, REGSEL)) & CS4231_INIT) | ||
430 | snd_printdd("out: auto calibration time out - reg = 0x%x, value = 0x%x\n", reg, value); | ||
431 | #endif | ||
428 | __cs4231_writeb(chip, chip->mce_bit | reg, CS4231P(chip, REGSEL)); | 432 | __cs4231_writeb(chip, chip->mce_bit | reg, CS4231P(chip, REGSEL)); |
429 | __cs4231_writeb(chip, value, CS4231P(chip, REG)); | 433 | __cs4231_writeb(chip, value, CS4231P(chip, REG)); |
430 | mb(); | 434 | mb(); |
@@ -440,15 +444,12 @@ static void snd_cs4231_out(cs4231_t *chip, unsigned char reg, unsigned char valu | |||
440 | udelay(100); | 444 | udelay(100); |
441 | #ifdef CONFIG_SND_DEBUG | 445 | #ifdef CONFIG_SND_DEBUG |
442 | if (__cs4231_readb(chip, CS4231P(chip, REGSEL)) & CS4231_INIT) | 446 | if (__cs4231_readb(chip, CS4231P(chip, REGSEL)) & CS4231_INIT) |
443 | snd_printk("out: auto calibration time out - reg = 0x%x, value = 0x%x\n", reg, value); | 447 | snd_printdd("out: auto calibration time out - reg = 0x%x, value = 0x%x\n", reg, value); |
444 | #endif | 448 | #endif |
445 | __cs4231_writeb(chip, chip->mce_bit | reg, CS4231P(chip, REGSEL)); | 449 | __cs4231_writeb(chip, chip->mce_bit | reg, CS4231P(chip, REGSEL)); |
446 | __cs4231_writeb(chip, value, CS4231P(chip, REG)); | 450 | __cs4231_writeb(chip, value, CS4231P(chip, REG)); |
447 | chip->image[reg] = value; | 451 | chip->image[reg] = value; |
448 | mb(); | 452 | mb(); |
449 | #if 0 | ||
450 | printk("codec out - reg 0x%x = 0x%x\n", chip->mce_bit | reg, value); | ||
451 | #endif | ||
452 | } | 453 | } |
453 | 454 | ||
454 | static unsigned char snd_cs4231_in(cs4231_t *chip, unsigned char reg) | 455 | static unsigned char snd_cs4231_in(cs4231_t *chip, unsigned char reg) |
@@ -462,61 +463,14 @@ static unsigned char snd_cs4231_in(cs4231_t *chip, unsigned char reg) | |||
462 | udelay(100); | 463 | udelay(100); |
463 | #ifdef CONFIG_SND_DEBUG | 464 | #ifdef CONFIG_SND_DEBUG |
464 | if (__cs4231_readb(chip, CS4231P(chip, REGSEL)) & CS4231_INIT) | 465 | if (__cs4231_readb(chip, CS4231P(chip, REGSEL)) & CS4231_INIT) |
465 | snd_printk("in: auto calibration time out - reg = 0x%x\n", reg); | 466 | snd_printdd("in: auto calibration time out - reg = 0x%x\n", reg); |
466 | #endif | 467 | #endif |
467 | __cs4231_writeb(chip, chip->mce_bit | reg, CS4231P(chip, REGSEL)); | 468 | __cs4231_writeb(chip, chip->mce_bit | reg, CS4231P(chip, REGSEL)); |
468 | mb(); | 469 | mb(); |
469 | ret = __cs4231_readb(chip, CS4231P(chip, REG)); | 470 | ret = __cs4231_readb(chip, CS4231P(chip, REG)); |
470 | #if 0 | ||
471 | printk("codec in - reg 0x%x = 0x%x\n", chip->mce_bit | reg, ret); | ||
472 | #endif | ||
473 | return ret; | 471 | return ret; |
474 | } | 472 | } |
475 | 473 | ||
476 | #if 0 | ||
477 | |||
478 | static void snd_cs4231_debug(cs4231_t *chip) | ||
479 | { | ||
480 | printk("CS4231 REGS: INDEX = 0x%02x ", | ||
481 | __cs4231_readb(chip, CS4231P(chip, REGSEL))); | ||
482 | printk(" STATUS = 0x%02x\n", | ||
483 | __cs4231_readb(chip, CS4231P(chip, STATUS))); | ||
484 | printk(" 0x00: left input = 0x%02x ", snd_cs4231_in(chip, 0x00)); | ||
485 | printk(" 0x10: alt 1 (CFIG 2) = 0x%02x\n", snd_cs4231_in(chip, 0x10)); | ||
486 | printk(" 0x01: right input = 0x%02x ", snd_cs4231_in(chip, 0x01)); | ||
487 | printk(" 0x11: alt 2 (CFIG 3) = 0x%02x\n", snd_cs4231_in(chip, 0x11)); | ||
488 | printk(" 0x02: GF1 left input = 0x%02x ", snd_cs4231_in(chip, 0x02)); | ||
489 | printk(" 0x12: left line in = 0x%02x\n", snd_cs4231_in(chip, 0x12)); | ||
490 | printk(" 0x03: GF1 right input = 0x%02x ", snd_cs4231_in(chip, 0x03)); | ||
491 | printk(" 0x13: right line in = 0x%02x\n", snd_cs4231_in(chip, 0x13)); | ||
492 | printk(" 0x04: CD left input = 0x%02x ", snd_cs4231_in(chip, 0x04)); | ||
493 | printk(" 0x14: timer low = 0x%02x\n", snd_cs4231_in(chip, 0x14)); | ||
494 | printk(" 0x05: CD right input = 0x%02x ", snd_cs4231_in(chip, 0x05)); | ||
495 | printk(" 0x15: timer high = 0x%02x\n", snd_cs4231_in(chip, 0x15)); | ||
496 | printk(" 0x06: left output = 0x%02x ", snd_cs4231_in(chip, 0x06)); | ||
497 | printk(" 0x16: left MIC (PnP) = 0x%02x\n", snd_cs4231_in(chip, 0x16)); | ||
498 | printk(" 0x07: right output = 0x%02x ", snd_cs4231_in(chip, 0x07)); | ||
499 | printk(" 0x17: right MIC (PnP) = 0x%02x\n", snd_cs4231_in(chip, 0x17)); | ||
500 | printk(" 0x08: playback format = 0x%02x ", snd_cs4231_in(chip, 0x08)); | ||
501 | printk(" 0x18: IRQ status = 0x%02x\n", snd_cs4231_in(chip, 0x18)); | ||
502 | printk(" 0x09: iface (CFIG 1) = 0x%02x ", snd_cs4231_in(chip, 0x09)); | ||
503 | printk(" 0x19: left line out = 0x%02x\n", snd_cs4231_in(chip, 0x19)); | ||
504 | printk(" 0x0a: pin control = 0x%02x ", snd_cs4231_in(chip, 0x0a)); | ||
505 | printk(" 0x1a: mono control = 0x%02x\n", snd_cs4231_in(chip, 0x1a)); | ||
506 | printk(" 0x0b: init & status = 0x%02x ", snd_cs4231_in(chip, 0x0b)); | ||
507 | printk(" 0x1b: right line out = 0x%02x\n", snd_cs4231_in(chip, 0x1b)); | ||
508 | printk(" 0x0c: revision & mode = 0x%02x ", snd_cs4231_in(chip, 0x0c)); | ||
509 | printk(" 0x1c: record format = 0x%02x\n", snd_cs4231_in(chip, 0x1c)); | ||
510 | printk(" 0x0d: loopback = 0x%02x ", snd_cs4231_in(chip, 0x0d)); | ||
511 | printk(" 0x1d: var freq (PnP) = 0x%02x\n", snd_cs4231_in(chip, 0x1d)); | ||
512 | printk(" 0x0e: ply upr count = 0x%02x ", snd_cs4231_in(chip, 0x0e)); | ||
513 | printk(" 0x1e: rec upr count = 0x%02x\n", snd_cs4231_in(chip, 0x1e)); | ||
514 | printk(" 0x0f: ply lwr count = 0x%02x ", snd_cs4231_in(chip, 0x0f)); | ||
515 | printk(" 0x1f: rec lwr count = 0x%02x\n", snd_cs4231_in(chip, 0x1f)); | ||
516 | } | ||
517 | |||
518 | #endif | ||
519 | |||
520 | /* | 474 | /* |
521 | * CS4231 detection / MCE routines | 475 | * CS4231 detection / MCE routines |
522 | */ | 476 | */ |
@@ -528,11 +482,12 @@ static void snd_cs4231_busy_wait(cs4231_t *chip) | |||
528 | /* huh.. looks like this sequence is proper for CS4231A chip (GUS MAX) */ | 482 | /* huh.. looks like this sequence is proper for CS4231A chip (GUS MAX) */ |
529 | for (timeout = 5; timeout > 0; timeout--) | 483 | for (timeout = 5; timeout > 0; timeout--) |
530 | __cs4231_readb(chip, CS4231P(chip, REGSEL)); | 484 | __cs4231_readb(chip, CS4231P(chip, REGSEL)); |
485 | |||
531 | /* end of cleanup sequence */ | 486 | /* end of cleanup sequence */ |
532 | for (timeout = 250; | 487 | for (timeout = 500; |
533 | timeout > 0 && (__cs4231_readb(chip, CS4231P(chip, REGSEL)) & CS4231_INIT); | 488 | timeout > 0 && (__cs4231_readb(chip, CS4231P(chip, REGSEL)) & CS4231_INIT); |
534 | timeout--) | 489 | timeout--) |
535 | udelay(100); | 490 | udelay(1000); |
536 | } | 491 | } |
537 | 492 | ||
538 | static void snd_cs4231_mce_up(cs4231_t *chip) | 493 | static void snd_cs4231_mce_up(cs4231_t *chip) |
@@ -545,12 +500,12 @@ static void snd_cs4231_mce_up(cs4231_t *chip) | |||
545 | udelay(100); | 500 | udelay(100); |
546 | #ifdef CONFIG_SND_DEBUG | 501 | #ifdef CONFIG_SND_DEBUG |
547 | if (__cs4231_readb(chip, CS4231P(chip, REGSEL)) & CS4231_INIT) | 502 | if (__cs4231_readb(chip, CS4231P(chip, REGSEL)) & CS4231_INIT) |
548 | snd_printk("mce_up - auto calibration time out (0)\n"); | 503 | snd_printdd("mce_up - auto calibration time out (0)\n"); |
549 | #endif | 504 | #endif |
550 | chip->mce_bit |= CS4231_MCE; | 505 | chip->mce_bit |= CS4231_MCE; |
551 | timeout = __cs4231_readb(chip, CS4231P(chip, REGSEL)); | 506 | timeout = __cs4231_readb(chip, CS4231P(chip, REGSEL)); |
552 | if (timeout == 0x80) | 507 | if (timeout == 0x80) |
553 | snd_printk("mce_up [%p]: serious init problem - codec still busy\n", chip->port); | 508 | snd_printdd("mce_up [%p]: serious init problem - codec still busy\n", chip->port); |
554 | if (!(timeout & CS4231_MCE)) | 509 | if (!(timeout & CS4231_MCE)) |
555 | __cs4231_writeb(chip, chip->mce_bit | (timeout & 0x1f), CS4231P(chip, REGSEL)); | 510 | __cs4231_writeb(chip, chip->mce_bit | (timeout & 0x1f), CS4231P(chip, REGSEL)); |
556 | spin_unlock_irqrestore(&chip->lock, flags); | 511 | spin_unlock_irqrestore(&chip->lock, flags); |
@@ -563,18 +518,15 @@ static void snd_cs4231_mce_down(cs4231_t *chip) | |||
563 | 518 | ||
564 | spin_lock_irqsave(&chip->lock, flags); | 519 | spin_lock_irqsave(&chip->lock, flags); |
565 | snd_cs4231_busy_wait(chip); | 520 | snd_cs4231_busy_wait(chip); |
566 | #if 0 | ||
567 | printk("(1) timeout = %i\n", timeout); | ||
568 | #endif | ||
569 | #ifdef CONFIG_SND_DEBUG | 521 | #ifdef CONFIG_SND_DEBUG |
570 | if (__cs4231_readb(chip, CS4231P(chip, REGSEL)) & CS4231_INIT) | 522 | if (__cs4231_readb(chip, CS4231P(chip, REGSEL)) & CS4231_INIT) |
571 | snd_printk("mce_down [%p] - auto calibration time out (0)\n", CS4231P(chip, REGSEL)); | 523 | snd_printdd("mce_down [%p] - auto calibration time out (0)\n", CS4231P(chip, REGSEL)); |
572 | #endif | 524 | #endif |
573 | chip->mce_bit &= ~CS4231_MCE; | 525 | chip->mce_bit &= ~CS4231_MCE; |
574 | timeout = __cs4231_readb(chip, CS4231P(chip, REGSEL)); | 526 | timeout = __cs4231_readb(chip, CS4231P(chip, REGSEL)); |
575 | __cs4231_writeb(chip, chip->mce_bit | (timeout & 0x1f), CS4231P(chip, REGSEL)); | 527 | __cs4231_writeb(chip, chip->mce_bit | (timeout & 0x1f), CS4231P(chip, REGSEL)); |
576 | if (timeout == 0x80) | 528 | if (timeout == 0x80) |
577 | snd_printk("mce_down [%p]: serious init problem - codec still busy\n", chip->port); | 529 | snd_printdd("mce_down [%p]: serious init problem - codec still busy\n", chip->port); |
578 | if ((timeout & CS4231_MCE) == 0) { | 530 | if ((timeout & CS4231_MCE) == 0) { |
579 | spin_unlock_irqrestore(&chip->lock, flags); | 531 | spin_unlock_irqrestore(&chip->lock, flags); |
580 | return; | 532 | return; |
@@ -590,9 +542,7 @@ static void snd_cs4231_mce_down(cs4231_t *chip) | |||
590 | spin_unlock_irqrestore(&chip->lock, flags); | 542 | spin_unlock_irqrestore(&chip->lock, flags); |
591 | return; | 543 | return; |
592 | } | 544 | } |
593 | #if 0 | 545 | |
594 | printk("(2) timeout = %i, jiffies = %li\n", timeout, jiffies); | ||
595 | #endif | ||
596 | /* in 10ms increments, check condition, up to 250ms */ | 546 | /* in 10ms increments, check condition, up to 250ms */ |
597 | timeout = 25; | 547 | timeout = 25; |
598 | while (snd_cs4231_in(chip, CS4231_TEST_INIT) & CS4231_CALIB_IN_PROGRESS) { | 548 | while (snd_cs4231_in(chip, CS4231_TEST_INIT) & CS4231_CALIB_IN_PROGRESS) { |
@@ -604,9 +554,7 @@ static void snd_cs4231_mce_down(cs4231_t *chip) | |||
604 | msleep(10); | 554 | msleep(10); |
605 | spin_lock_irqsave(&chip->lock, flags); | 555 | spin_lock_irqsave(&chip->lock, flags); |
606 | } | 556 | } |
607 | #if 0 | 557 | |
608 | printk("(3) jiffies = %li\n", jiffies); | ||
609 | #endif | ||
610 | /* in 10ms increments, check condition, up to 100ms */ | 558 | /* in 10ms increments, check condition, up to 100ms */ |
611 | timeout = 10; | 559 | timeout = 10; |
612 | while (__cs4231_readb(chip, CS4231P(chip, REGSEL)) & CS4231_INIT) { | 560 | while (__cs4231_readb(chip, CS4231P(chip, REGSEL)) & CS4231_INIT) { |
@@ -619,28 +567,7 @@ static void snd_cs4231_mce_down(cs4231_t *chip) | |||
619 | spin_lock_irqsave(&chip->lock, flags); | 567 | spin_lock_irqsave(&chip->lock, flags); |
620 | } | 568 | } |
621 | spin_unlock_irqrestore(&chip->lock, flags); | 569 | spin_unlock_irqrestore(&chip->lock, flags); |
622 | #if 0 | ||
623 | printk("(4) jiffies = %li\n", jiffies); | ||
624 | snd_printk("mce_down - exit = 0x%x\n", __cs4231_readb(chip, CS4231P(chip, REGSEL))); | ||
625 | #endif | ||
626 | } | ||
627 | |||
628 | #if 0 /* Unused for now... */ | ||
629 | static unsigned int snd_cs4231_get_count(unsigned char format, unsigned int size) | ||
630 | { | ||
631 | switch (format & 0xe0) { | ||
632 | case CS4231_LINEAR_16: | ||
633 | case CS4231_LINEAR_16_BIG: | ||
634 | size >>= 1; | ||
635 | break; | ||
636 | case CS4231_ADPCM_16: | ||
637 | return size >> 2; | ||
638 | } | ||
639 | if (format & CS4231_STEREO) | ||
640 | size >>= 1; | ||
641 | return size; | ||
642 | } | 570 | } |
643 | #endif | ||
644 | 571 | ||
645 | #ifdef EBUS_SUPPORT | 572 | #ifdef EBUS_SUPPORT |
646 | static void snd_cs4231_ebus_advance_dma(struct ebus_dma_info *p, snd_pcm_substream_t *substream, unsigned int *periods_sent) | 573 | static void snd_cs4231_ebus_advance_dma(struct ebus_dma_info *p, snd_pcm_substream_t *substream, unsigned int *periods_sent) |
@@ -648,25 +575,50 @@ static void snd_cs4231_ebus_advance_dma(struct ebus_dma_info *p, snd_pcm_substre | |||
648 | snd_pcm_runtime_t *runtime = substream->runtime; | 575 | snd_pcm_runtime_t *runtime = substream->runtime; |
649 | 576 | ||
650 | while (1) { | 577 | while (1) { |
651 | unsigned int dma_size = snd_pcm_lib_period_bytes(substream); | 578 | unsigned int period_size = snd_pcm_lib_period_bytes(substream); |
652 | unsigned int offset = dma_size * (*periods_sent); | 579 | unsigned int offset = period_size * (*periods_sent); |
653 | 580 | ||
654 | if (dma_size >= (1 << 24)) | 581 | if (period_size >= (1 << 24)) |
655 | BUG(); | 582 | BUG(); |
656 | 583 | ||
657 | if (ebus_dma_request(p, runtime->dma_addr + offset, dma_size)) | 584 | if (ebus_dma_request(p, runtime->dma_addr + offset, period_size)) |
658 | return; | 585 | return; |
659 | #if 0 | ||
660 | printk("ebus_advance: Sent period %u (size[%x] offset[%x])\n", | ||
661 | (*periods_sent), dma_size, offset); | ||
662 | #endif | ||
663 | (*periods_sent) = ((*periods_sent) + 1) % runtime->periods; | 586 | (*periods_sent) = ((*periods_sent) + 1) % runtime->periods; |
664 | } | 587 | } |
665 | } | 588 | } |
666 | #endif | 589 | #endif |
667 | 590 | ||
668 | static void cs4231_dma_trigger(cs4231_t *chip, unsigned int what, int on) | 591 | #ifdef SBUS_SUPPORT |
592 | static void snd_cs4231_sbus_advance_dma(snd_pcm_substream_t *substream, unsigned int *periods_sent) | ||
669 | { | 593 | { |
594 | cs4231_t *chip = snd_pcm_substream_chip(substream); | ||
595 | snd_pcm_runtime_t *runtime = substream->runtime; | ||
596 | |||
597 | unsigned int period_size = snd_pcm_lib_period_bytes(substream); | ||
598 | unsigned int offset = period_size * (*periods_sent % runtime->periods); | ||
599 | |||
600 | if (runtime->period_size > 0xffff + 1) | ||
601 | BUG(); | ||
602 | |||
603 | switch (substream->stream) { | ||
604 | case SNDRV_PCM_STREAM_PLAYBACK: | ||
605 | sbus_writel(runtime->dma_addr + offset, chip->port + APCPNVA); | ||
606 | sbus_writel(period_size, chip->port + APCPNC); | ||
607 | break; | ||
608 | case SNDRV_PCM_STREAM_CAPTURE: | ||
609 | sbus_writel(runtime->dma_addr + offset, chip->port + APCCNVA); | ||
610 | sbus_writel(period_size, chip->port + APCCNC); | ||
611 | break; | ||
612 | } | ||
613 | |||
614 | (*periods_sent) = (*periods_sent + 1) % runtime->periods; | ||
615 | } | ||
616 | #endif | ||
617 | |||
618 | static void cs4231_dma_trigger(snd_pcm_substream_t *substream, unsigned int what, int on) | ||
619 | { | ||
620 | cs4231_t *chip = snd_pcm_substream_chip(substream); | ||
621 | |||
670 | #ifdef EBUS_SUPPORT | 622 | #ifdef EBUS_SUPPORT |
671 | if (chip->flags & CS4231_FLAG_EBUS) { | 623 | if (chip->flags & CS4231_FLAG_EBUS) { |
672 | if (what & CS4231_PLAYBACK_ENABLE) { | 624 | if (what & CS4231_PLAYBACK_ENABLE) { |
@@ -694,6 +646,60 @@ static void cs4231_dma_trigger(cs4231_t *chip, unsigned int what, int on) | |||
694 | } else { | 646 | } else { |
695 | #endif | 647 | #endif |
696 | #ifdef SBUS_SUPPORT | 648 | #ifdef SBUS_SUPPORT |
649 | u32 csr = sbus_readl(chip->port + APCCSR); | ||
650 | /* I don't know why, but on sbus the period counter must | ||
651 | * only start counting after the first period is sent. | ||
652 | * Therefore this dummy thing. | ||
653 | */ | ||
654 | unsigned int dummy = 0; | ||
655 | |||
656 | switch (what) { | ||
657 | case CS4231_PLAYBACK_ENABLE: | ||
658 | if (on) { | ||
659 | csr &= ~APC_XINT_PLAY; | ||
660 | sbus_writel(csr, chip->port + APCCSR); | ||
661 | |||
662 | csr &= ~APC_PPAUSE; | ||
663 | sbus_writel(csr, chip->port + APCCSR); | ||
664 | |||
665 | snd_cs4231_sbus_advance_dma(substream, &dummy); | ||
666 | |||
667 | csr |= APC_GENL_INT | APC_PLAY_INT | APC_XINT_ENA | | ||
668 | APC_XINT_PLAY | APC_XINT_EMPT | APC_XINT_GENL | | ||
669 | APC_XINT_PENA | APC_PDMA_READY; | ||
670 | sbus_writel(csr, chip->port + APCCSR); | ||
671 | } else { | ||
672 | csr |= APC_PPAUSE; | ||
673 | sbus_writel(csr, chip->port + APCCSR); | ||
674 | |||
675 | csr &= ~APC_PDMA_READY; | ||
676 | sbus_writel(csr, chip->port + APCCSR); | ||
677 | } | ||
678 | break; | ||
679 | case CS4231_RECORD_ENABLE: | ||
680 | if (on) { | ||
681 | csr &= ~APC_XINT_CAPT; | ||
682 | sbus_writel(csr, chip->port + APCCSR); | ||
683 | |||
684 | csr &= ~APC_CPAUSE; | ||
685 | sbus_writel(csr, chip->port + APCCSR); | ||
686 | |||
687 | snd_cs4231_sbus_advance_dma(substream, &dummy); | ||
688 | |||
689 | csr |= APC_GENL_INT | APC_CAPT_INT | APC_XINT_ENA | | ||
690 | APC_XINT_CAPT | APC_XINT_CEMP | APC_XINT_GENL | | ||
691 | APC_CDMA_READY; | ||
692 | |||
693 | sbus_writel(csr, chip->port + APCCSR); | ||
694 | } else { | ||
695 | csr |= APC_CPAUSE; | ||
696 | sbus_writel(csr, chip->port + APCCSR); | ||
697 | |||
698 | csr &= ~APC_CDMA_READY; | ||
699 | sbus_writel(csr, chip->port + APCCSR); | ||
700 | } | ||
701 | break; | ||
702 | } | ||
697 | #endif | 703 | #endif |
698 | #ifdef EBUS_SUPPORT | 704 | #ifdef EBUS_SUPPORT |
699 | } | 705 | } |
@@ -725,25 +731,12 @@ static int snd_cs4231_trigger(snd_pcm_substream_t *substream, int cmd) | |||
725 | } | 731 | } |
726 | } | 732 | } |
727 | 733 | ||
728 | #if 0 | ||
729 | printk("TRIGGER: what[%x] on(%d)\n", | ||
730 | what, (cmd == SNDRV_PCM_TRIGGER_START)); | ||
731 | #endif | ||
732 | |||
733 | spin_lock_irqsave(&chip->lock, flags); | 734 | spin_lock_irqsave(&chip->lock, flags); |
734 | if (cmd == SNDRV_PCM_TRIGGER_START) { | 735 | if (cmd == SNDRV_PCM_TRIGGER_START) { |
735 | cs4231_dma_trigger(chip, what, 1); | 736 | cs4231_dma_trigger(substream, what, 1); |
736 | chip->image[CS4231_IFACE_CTRL] |= what; | 737 | chip->image[CS4231_IFACE_CTRL] |= what; |
737 | if (what & CS4231_PLAYBACK_ENABLE) { | ||
738 | snd_cs4231_out(chip, CS4231_PLY_LWR_CNT, 0xff); | ||
739 | snd_cs4231_out(chip, CS4231_PLY_UPR_CNT, 0xff); | ||
740 | } | ||
741 | if (what & CS4231_RECORD_ENABLE) { | ||
742 | snd_cs4231_out(chip, CS4231_REC_LWR_CNT, 0xff); | ||
743 | snd_cs4231_out(chip, CS4231_REC_UPR_CNT, 0xff); | ||
744 | } | ||
745 | } else { | 738 | } else { |
746 | cs4231_dma_trigger(chip, what, 0); | 739 | cs4231_dma_trigger(substream, what, 0); |
747 | chip->image[CS4231_IFACE_CTRL] &= ~what; | 740 | chip->image[CS4231_IFACE_CTRL] &= ~what; |
748 | } | 741 | } |
749 | snd_cs4231_out(chip, CS4231_IFACE_CTRL, | 742 | snd_cs4231_out(chip, CS4231_IFACE_CTRL, |
@@ -755,9 +748,7 @@ static int snd_cs4231_trigger(snd_pcm_substream_t *substream, int cmd) | |||
755 | result = -EINVAL; | 748 | result = -EINVAL; |
756 | break; | 749 | break; |
757 | } | 750 | } |
758 | #if 0 | 751 | |
759 | snd_cs4231_debug(chip); | ||
760 | #endif | ||
761 | return result; | 752 | return result; |
762 | } | 753 | } |
763 | 754 | ||
@@ -790,9 +781,6 @@ static unsigned char snd_cs4231_get_format(cs4231_t *chip, int format, int chann | |||
790 | } | 781 | } |
791 | if (channels > 1) | 782 | if (channels > 1) |
792 | rformat |= CS4231_STEREO; | 783 | rformat |= CS4231_STEREO; |
793 | #if 0 | ||
794 | snd_printk("get_format: 0x%x (mode=0x%x)\n", format, mode); | ||
795 | #endif | ||
796 | return rformat; | 784 | return rformat; |
797 | } | 785 | } |
798 | 786 | ||
@@ -944,7 +932,7 @@ static void snd_cs4231_init(cs4231_t *chip) | |||
944 | snd_cs4231_mce_down(chip); | 932 | snd_cs4231_mce_down(chip); |
945 | 933 | ||
946 | #ifdef SNDRV_DEBUG_MCE | 934 | #ifdef SNDRV_DEBUG_MCE |
947 | snd_printk("init: (1)\n"); | 935 | snd_printdd("init: (1)\n"); |
948 | #endif | 936 | #endif |
949 | snd_cs4231_mce_up(chip); | 937 | snd_cs4231_mce_up(chip); |
950 | spin_lock_irqsave(&chip->lock, flags); | 938 | spin_lock_irqsave(&chip->lock, flags); |
@@ -957,7 +945,7 @@ static void snd_cs4231_init(cs4231_t *chip) | |||
957 | snd_cs4231_mce_down(chip); | 945 | snd_cs4231_mce_down(chip); |
958 | 946 | ||
959 | #ifdef SNDRV_DEBUG_MCE | 947 | #ifdef SNDRV_DEBUG_MCE |
960 | snd_printk("init: (2)\n"); | 948 | snd_printdd("init: (2)\n"); |
961 | #endif | 949 | #endif |
962 | 950 | ||
963 | snd_cs4231_mce_up(chip); | 951 | snd_cs4231_mce_up(chip); |
@@ -967,7 +955,7 @@ static void snd_cs4231_init(cs4231_t *chip) | |||
967 | snd_cs4231_mce_down(chip); | 955 | snd_cs4231_mce_down(chip); |
968 | 956 | ||
969 | #ifdef SNDRV_DEBUG_MCE | 957 | #ifdef SNDRV_DEBUG_MCE |
970 | snd_printk("init: (3) - afei = 0x%x\n", chip->image[CS4231_ALT_FEATURE_1]); | 958 | snd_printdd("init: (3) - afei = 0x%x\n", chip->image[CS4231_ALT_FEATURE_1]); |
971 | #endif | 959 | #endif |
972 | 960 | ||
973 | spin_lock_irqsave(&chip->lock, flags); | 961 | spin_lock_irqsave(&chip->lock, flags); |
@@ -981,7 +969,7 @@ static void snd_cs4231_init(cs4231_t *chip) | |||
981 | snd_cs4231_mce_down(chip); | 969 | snd_cs4231_mce_down(chip); |
982 | 970 | ||
983 | #ifdef SNDRV_DEBUG_MCE | 971 | #ifdef SNDRV_DEBUG_MCE |
984 | snd_printk("init: (4)\n"); | 972 | snd_printdd("init: (4)\n"); |
985 | #endif | 973 | #endif |
986 | 974 | ||
987 | snd_cs4231_mce_up(chip); | 975 | snd_cs4231_mce_up(chip); |
@@ -991,7 +979,7 @@ static void snd_cs4231_init(cs4231_t *chip) | |||
991 | snd_cs4231_mce_down(chip); | 979 | snd_cs4231_mce_down(chip); |
992 | 980 | ||
993 | #ifdef SNDRV_DEBUG_MCE | 981 | #ifdef SNDRV_DEBUG_MCE |
994 | snd_printk("init: (5)\n"); | 982 | snd_printdd("init: (5)\n"); |
995 | #endif | 983 | #endif |
996 | } | 984 | } |
997 | 985 | ||
@@ -1022,6 +1010,7 @@ static int snd_cs4231_open(cs4231_t *chip, unsigned int mode) | |||
1022 | CS4231_RECORD_IRQ | | 1010 | CS4231_RECORD_IRQ | |
1023 | CS4231_TIMER_IRQ); | 1011 | CS4231_TIMER_IRQ); |
1024 | snd_cs4231_out(chip, CS4231_IRQ_STATUS, 0); | 1012 | snd_cs4231_out(chip, CS4231_IRQ_STATUS, 0); |
1013 | |||
1025 | spin_unlock_irqrestore(&chip->lock, flags); | 1014 | spin_unlock_irqrestore(&chip->lock, flags); |
1026 | 1015 | ||
1027 | chip->mode = mode; | 1016 | chip->mode = mode; |
@@ -1136,11 +1125,21 @@ static int snd_cs4231_playback_hw_free(snd_pcm_substream_t *substream) | |||
1136 | static int snd_cs4231_playback_prepare(snd_pcm_substream_t *substream) | 1125 | static int snd_cs4231_playback_prepare(snd_pcm_substream_t *substream) |
1137 | { | 1126 | { |
1138 | cs4231_t *chip = snd_pcm_substream_chip(substream); | 1127 | cs4231_t *chip = snd_pcm_substream_chip(substream); |
1128 | snd_pcm_runtime_t *runtime = substream->runtime; | ||
1139 | unsigned long flags; | 1129 | unsigned long flags; |
1140 | 1130 | ||
1141 | spin_lock_irqsave(&chip->lock, flags); | 1131 | spin_lock_irqsave(&chip->lock, flags); |
1132 | |||
1142 | chip->image[CS4231_IFACE_CTRL] &= ~(CS4231_PLAYBACK_ENABLE | | 1133 | chip->image[CS4231_IFACE_CTRL] &= ~(CS4231_PLAYBACK_ENABLE | |
1143 | CS4231_PLAYBACK_PIO); | 1134 | CS4231_PLAYBACK_PIO); |
1135 | |||
1136 | if (runtime->period_size > 0xffff + 1) | ||
1137 | BUG(); | ||
1138 | |||
1139 | snd_cs4231_out(chip, CS4231_PLY_LWR_CNT, (runtime->period_size - 1) & 0x00ff); | ||
1140 | snd_cs4231_out(chip, CS4231_PLY_UPR_CNT, (runtime->period_size - 1) >> 8 & 0x00ff); | ||
1141 | chip->p_periods_sent = 0; | ||
1142 | |||
1144 | spin_unlock_irqrestore(&chip->lock, flags); | 1143 | spin_unlock_irqrestore(&chip->lock, flags); |
1145 | 1144 | ||
1146 | return 0; | 1145 | return 0; |
@@ -1172,12 +1171,16 @@ static int snd_cs4231_capture_hw_free(snd_pcm_substream_t *substream) | |||
1172 | static int snd_cs4231_capture_prepare(snd_pcm_substream_t *substream) | 1171 | static int snd_cs4231_capture_prepare(snd_pcm_substream_t *substream) |
1173 | { | 1172 | { |
1174 | cs4231_t *chip = snd_pcm_substream_chip(substream); | 1173 | cs4231_t *chip = snd_pcm_substream_chip(substream); |
1174 | snd_pcm_runtime_t *runtime = substream->runtime; | ||
1175 | unsigned long flags; | 1175 | unsigned long flags; |
1176 | 1176 | ||
1177 | spin_lock_irqsave(&chip->lock, flags); | 1177 | spin_lock_irqsave(&chip->lock, flags); |
1178 | chip->image[CS4231_IFACE_CTRL] &= ~(CS4231_RECORD_ENABLE | | 1178 | chip->image[CS4231_IFACE_CTRL] &= ~(CS4231_RECORD_ENABLE | |
1179 | CS4231_RECORD_PIO); | 1179 | CS4231_RECORD_PIO); |
1180 | 1180 | ||
1181 | snd_cs4231_out(chip, CS4231_REC_LWR_CNT, (runtime->period_size - 1) & 0x00ff); | ||
1182 | snd_cs4231_out(chip, CS4231_REC_LWR_CNT, (runtime->period_size - 1) >> 8 & 0x00ff); | ||
1183 | |||
1181 | spin_unlock_irqrestore(&chip->lock, flags); | 1184 | spin_unlock_irqrestore(&chip->lock, flags); |
1182 | 1185 | ||
1183 | return 0; | 1186 | return 0; |
@@ -1196,53 +1199,61 @@ static void snd_cs4231_overrange(cs4231_t *chip) | |||
1196 | chip->capture_substream->runtime->overrange++; | 1199 | chip->capture_substream->runtime->overrange++; |
1197 | } | 1200 | } |
1198 | 1201 | ||
1199 | static void snd_cs4231_generic_interrupt(cs4231_t *chip) | 1202 | static irqreturn_t snd_cs4231_generic_interrupt(cs4231_t *chip) |
1200 | { | 1203 | { |
1201 | unsigned long flags; | 1204 | unsigned long flags; |
1202 | unsigned char status; | 1205 | unsigned char status; |
1203 | 1206 | ||
1207 | /*This is IRQ is not raised by the cs4231*/ | ||
1208 | if (!(__cs4231_readb(chip, CS4231P(chip, STATUS)) & CS4231_GLOBALIRQ)) | ||
1209 | return IRQ_NONE; | ||
1210 | |||
1204 | status = snd_cs4231_in(chip, CS4231_IRQ_STATUS); | 1211 | status = snd_cs4231_in(chip, CS4231_IRQ_STATUS); |
1205 | if (!status) | ||
1206 | return; | ||
1207 | 1212 | ||
1208 | if (status & CS4231_TIMER_IRQ) { | 1213 | if (status & CS4231_TIMER_IRQ) { |
1209 | if (chip->timer) | 1214 | if (chip->timer) |
1210 | snd_timer_interrupt(chip->timer, chip->timer->sticks); | 1215 | snd_timer_interrupt(chip->timer, chip->timer->sticks); |
1211 | } | 1216 | } |
1212 | if (status & CS4231_PLAYBACK_IRQ) | 1217 | |
1213 | snd_pcm_period_elapsed(chip->playback_substream); | 1218 | if (status & CS4231_RECORD_IRQ) |
1214 | if (status & CS4231_RECORD_IRQ) { | ||
1215 | snd_cs4231_overrange(chip); | 1219 | snd_cs4231_overrange(chip); |
1216 | snd_pcm_period_elapsed(chip->capture_substream); | ||
1217 | } | ||
1218 | 1220 | ||
1219 | /* ACK the CS4231 interrupt. */ | 1221 | /* ACK the CS4231 interrupt. */ |
1220 | spin_lock_irqsave(&chip->lock, flags); | 1222 | spin_lock_irqsave(&chip->lock, flags); |
1221 | snd_cs4231_outm(chip, CS4231_IRQ_STATUS, ~CS4231_ALL_IRQS | ~status, 0); | 1223 | snd_cs4231_outm(chip, CS4231_IRQ_STATUS, ~CS4231_ALL_IRQS | ~status, 0); |
1222 | spin_unlock_irqrestore(&chip->lock, flags); | 1224 | spin_unlock_irqrestore(&chip->lock, flags); |
1225 | |||
1226 | return 0; | ||
1223 | } | 1227 | } |
1224 | 1228 | ||
1225 | #ifdef SBUS_SUPPORT | 1229 | #ifdef SBUS_SUPPORT |
1226 | static irqreturn_t snd_cs4231_sbus_interrupt(int irq, void *dev_id, struct pt_regs *regs) | 1230 | static irqreturn_t snd_cs4231_sbus_interrupt(int irq, void *dev_id, struct pt_regs *regs) |
1227 | { | 1231 | { |
1228 | cs4231_t *chip = dev_id; | 1232 | cs4231_t *chip = dev_id; |
1229 | u32 csr; | ||
1230 | |||
1231 | csr = sbus_readl(chip->port + APCCSR); | ||
1232 | if (!(csr & (APC_INT_PENDING | | ||
1233 | APC_PLAY_INT | | ||
1234 | APC_CAPT_INT | | ||
1235 | APC_GENL_INT | | ||
1236 | APC_XINT_PEMP | | ||
1237 | APC_XINT_CEMP))) | ||
1238 | return IRQ_NONE; | ||
1239 | 1233 | ||
1240 | /* ACK the APC interrupt. */ | 1234 | /* ACK the APC interrupt. */ |
1235 | u32 csr = sbus_readl(chip->port + APCCSR); | ||
1236 | |||
1241 | sbus_writel(csr, chip->port + APCCSR); | 1237 | sbus_writel(csr, chip->port + APCCSR); |
1242 | 1238 | ||
1243 | snd_cs4231_generic_interrupt(chip); | 1239 | if ((chip->image[CS4231_IFACE_CTRL] & CS4231_PLAYBACK_ENABLE) && |
1240 | (csr & APC_PLAY_INT) && | ||
1241 | (csr & APC_XINT_PNVA) && | ||
1242 | !(csr & APC_XINT_EMPT)) { | ||
1243 | snd_cs4231_sbus_advance_dma(chip->playback_substream, | ||
1244 | &chip->p_periods_sent); | ||
1245 | snd_pcm_period_elapsed(chip->playback_substream); | ||
1246 | } | ||
1244 | 1247 | ||
1245 | return IRQ_HANDLED; | 1248 | if ((chip->image[CS4231_IFACE_CTRL] & CS4231_RECORD_ENABLE) && |
1249 | (csr & APC_CAPT_INT) && | ||
1250 | (csr & APC_XINT_CNVA)) { | ||
1251 | snd_cs4231_sbus_advance_dma(chip->capture_substream, | ||
1252 | &chip->c_periods_sent); | ||
1253 | snd_pcm_period_elapsed(chip->capture_substream); | ||
1254 | } | ||
1255 | |||
1256 | return snd_cs4231_generic_interrupt(chip); | ||
1246 | } | 1257 | } |
1247 | #endif | 1258 | #endif |
1248 | 1259 | ||
@@ -1290,7 +1301,8 @@ static snd_pcm_uframes_t snd_cs4231_playback_pointer(snd_pcm_substream_t *substr | |||
1290 | #ifdef EBUS_SUPPORT | 1301 | #ifdef EBUS_SUPPORT |
1291 | } | 1302 | } |
1292 | #endif | 1303 | #endif |
1293 | ptr += (period_bytes - residue); | 1304 | ptr += period_bytes - residue; |
1305 | |||
1294 | return bytes_to_frames(substream->runtime, ptr); | 1306 | return bytes_to_frames(substream->runtime, ptr); |
1295 | } | 1307 | } |
1296 | 1308 | ||
@@ -1314,7 +1326,7 @@ static snd_pcm_uframes_t snd_cs4231_capture_pointer(snd_pcm_substream_t * substr | |||
1314 | #ifdef EBUS_SUPPORT | 1326 | #ifdef EBUS_SUPPORT |
1315 | } | 1327 | } |
1316 | #endif | 1328 | #endif |
1317 | ptr += (period_bytes - residue); | 1329 | ptr += period_bytes - residue; |
1318 | return bytes_to_frames(substream->runtime, ptr); | 1330 | return bytes_to_frames(substream->runtime, ptr); |
1319 | } | 1331 | } |
1320 | 1332 | ||
@@ -1328,9 +1340,6 @@ static int snd_cs4231_probe(cs4231_t *chip) | |||
1328 | int i, id, vers; | 1340 | int i, id, vers; |
1329 | unsigned char *ptr; | 1341 | unsigned char *ptr; |
1330 | 1342 | ||
1331 | #if 0 | ||
1332 | snd_cs4231_debug(chip); | ||
1333 | #endif | ||
1334 | id = vers = 0; | 1343 | id = vers = 0; |
1335 | for (i = 0; i < 50; i++) { | 1344 | for (i = 0; i < 50; i++) { |
1336 | mb(); | 1345 | mb(); |
@@ -1915,6 +1924,9 @@ static int cs4231_attach_finish(snd_card_t *card, cs4231_t *chip) | |||
1915 | if ((err = snd_cs4231_timer(chip)) < 0) | 1924 | if ((err = snd_cs4231_timer(chip)) < 0) |
1916 | goto out_err; | 1925 | goto out_err; |
1917 | 1926 | ||
1927 | if ((err = snd_card_set_generic_dev(card)) < 0) | ||
1928 | goto out_err; | ||
1929 | |||
1918 | if ((err = snd_card_register(card)) < 0) | 1930 | if ((err = snd_card_register(card)) < 0) |
1919 | goto out_err; | 1931 | goto out_err; |
1920 | 1932 | ||
@@ -1966,7 +1978,7 @@ static int __init snd_cs4231_sbus_create(snd_card_t *card, | |||
1966 | int err; | 1978 | int err; |
1967 | 1979 | ||
1968 | *rchip = NULL; | 1980 | *rchip = NULL; |
1969 | chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); | 1981 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); |
1970 | if (chip == NULL) | 1982 | if (chip == NULL) |
1971 | return -ENOMEM; | 1983 | return -ENOMEM; |
1972 | 1984 | ||
@@ -1982,13 +1994,13 @@ static int __init snd_cs4231_sbus_create(snd_card_t *card, | |||
1982 | chip->port = sbus_ioremap(&sdev->resource[0], 0, | 1994 | chip->port = sbus_ioremap(&sdev->resource[0], 0, |
1983 | chip->regs_size, "cs4231"); | 1995 | chip->regs_size, "cs4231"); |
1984 | if (!chip->port) { | 1996 | if (!chip->port) { |
1985 | snd_printk("cs4231-%d: Unable to map chip registers.\n", dev); | 1997 | snd_printdd("cs4231-%d: Unable to map chip registers.\n", dev); |
1986 | return -EIO; | 1998 | return -EIO; |
1987 | } | 1999 | } |
1988 | 2000 | ||
1989 | if (request_irq(sdev->irqs[0], snd_cs4231_sbus_interrupt, | 2001 | if (request_irq(sdev->irqs[0], snd_cs4231_sbus_interrupt, |
1990 | SA_SHIRQ, "cs4231", chip)) { | 2002 | SA_SHIRQ, "cs4231", chip)) { |
1991 | snd_printk("cs4231-%d: Unable to grab SBUS IRQ %s\n", | 2003 | snd_printdd("cs4231-%d: Unable to grab SBUS IRQ %s\n", |
1992 | dev, | 2004 | dev, |
1993 | __irq_itoa(sdev->irqs[0])); | 2005 | __irq_itoa(sdev->irqs[0])); |
1994 | snd_cs4231_sbus_free(chip); | 2006 | snd_cs4231_sbus_free(chip); |
@@ -2080,7 +2092,7 @@ static int __init snd_cs4231_ebus_create(snd_card_t *card, | |||
2080 | int err; | 2092 | int err; |
2081 | 2093 | ||
2082 | *rchip = NULL; | 2094 | *rchip = NULL; |
2083 | chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); | 2095 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); |
2084 | if (chip == NULL) | 2096 | if (chip == NULL) |
2085 | return -ENOMEM; | 2097 | return -ENOMEM; |
2086 | 2098 | ||
@@ -2110,29 +2122,29 @@ static int __init snd_cs4231_ebus_create(snd_card_t *card, | |||
2110 | chip->eb2c.regs = ioremap(edev->resource[2].start, 0x10); | 2122 | chip->eb2c.regs = ioremap(edev->resource[2].start, 0x10); |
2111 | if (!chip->port || !chip->eb2p.regs || !chip->eb2c.regs) { | 2123 | if (!chip->port || !chip->eb2p.regs || !chip->eb2c.regs) { |
2112 | snd_cs4231_ebus_free(chip); | 2124 | snd_cs4231_ebus_free(chip); |
2113 | snd_printk("cs4231-%d: Unable to map chip registers.\n", dev); | 2125 | snd_printdd("cs4231-%d: Unable to map chip registers.\n", dev); |
2114 | return -EIO; | 2126 | return -EIO; |
2115 | } | 2127 | } |
2116 | 2128 | ||
2117 | if (ebus_dma_register(&chip->eb2c)) { | 2129 | if (ebus_dma_register(&chip->eb2c)) { |
2118 | snd_cs4231_ebus_free(chip); | 2130 | snd_cs4231_ebus_free(chip); |
2119 | snd_printk("cs4231-%d: Unable to register EBUS capture DMA\n", dev); | 2131 | snd_printdd("cs4231-%d: Unable to register EBUS capture DMA\n", dev); |
2120 | return -EBUSY; | 2132 | return -EBUSY; |
2121 | } | 2133 | } |
2122 | if (ebus_dma_irq_enable(&chip->eb2c, 1)) { | 2134 | if (ebus_dma_irq_enable(&chip->eb2c, 1)) { |
2123 | snd_cs4231_ebus_free(chip); | 2135 | snd_cs4231_ebus_free(chip); |
2124 | snd_printk("cs4231-%d: Unable to enable EBUS capture IRQ\n", dev); | 2136 | snd_printdd("cs4231-%d: Unable to enable EBUS capture IRQ\n", dev); |
2125 | return -EBUSY; | 2137 | return -EBUSY; |
2126 | } | 2138 | } |
2127 | 2139 | ||
2128 | if (ebus_dma_register(&chip->eb2p)) { | 2140 | if (ebus_dma_register(&chip->eb2p)) { |
2129 | snd_cs4231_ebus_free(chip); | 2141 | snd_cs4231_ebus_free(chip); |
2130 | snd_printk("cs4231-%d: Unable to register EBUS play DMA\n", dev); | 2142 | snd_printdd("cs4231-%d: Unable to register EBUS play DMA\n", dev); |
2131 | return -EBUSY; | 2143 | return -EBUSY; |
2132 | } | 2144 | } |
2133 | if (ebus_dma_irq_enable(&chip->eb2p, 1)) { | 2145 | if (ebus_dma_irq_enable(&chip->eb2p, 1)) { |
2134 | snd_cs4231_ebus_free(chip); | 2146 | snd_cs4231_ebus_free(chip); |
2135 | snd_printk("cs4231-%d: Unable to enable EBUS play IRQ\n", dev); | 2147 | snd_printdd("cs4231-%d: Unable to enable EBUS play IRQ\n", dev); |
2136 | return -EBUSY; | 2148 | return -EBUSY; |
2137 | } | 2149 | } |
2138 | 2150 | ||
diff --git a/sound/sparc/dbri.c b/sound/sparc/dbri.c index 941c7b1e7ebb..b5c4c15ae7f0 100644 --- a/sound/sparc/dbri.c +++ b/sound/sparc/dbri.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Driver for DBRI sound chip found on Sparcs. | 2 | * Driver for DBRI sound chip found on Sparcs. |
3 | * Copyright (C) 2004 Martin Habets (mhabets@users.sourceforge.net) | 3 | * Copyright (C) 2004, 2005 Martin Habets (mhabets@users.sourceforge.net) |
4 | * | 4 | * |
5 | * Based entirely upon drivers/sbus/audio/dbri.c which is: | 5 | * Based entirely upon drivers/sbus/audio/dbri.c which is: |
6 | * Copyright (C) 1997 Rudolf Koenig (rfkoenig@immd4.informatik.uni-erlangen.de) | 6 | * Copyright (C) 1997 Rudolf Koenig (rfkoenig@immd4.informatik.uni-erlangen.de) |
@@ -43,6 +43,12 @@ | |||
43 | * audio devices. But the SUN HW group decided against it, at least on my | 43 | * audio devices. But the SUN HW group decided against it, at least on my |
44 | * LX the speakerbox connector has at least 1 pin missing and 1 wrongly | 44 | * LX the speakerbox connector has at least 1 pin missing and 1 wrongly |
45 | * connected. | 45 | * connected. |
46 | * | ||
47 | * I've tried to stick to the following function naming conventions: | ||
48 | * snd_* ALSA stuff | ||
49 | * cs4215_* CS4215 codec specfic stuff | ||
50 | * dbri_* DBRI high-level stuff | ||
51 | * other DBRI low-level stuff | ||
46 | */ | 52 | */ |
47 | 53 | ||
48 | #include <sound/driver.h> | 54 | #include <sound/driver.h> |
@@ -87,7 +93,7 @@ MODULE_PARM_DESC(enable, "Enable Sun DBRI soundcard."); | |||
87 | #define D_DESC (1<<5) | 93 | #define D_DESC (1<<5) |
88 | 94 | ||
89 | static int dbri_debug = 0; | 95 | static int dbri_debug = 0; |
90 | module_param(dbri_debug, int, 0444); | 96 | module_param(dbri_debug, int, 0644); |
91 | MODULE_PARM_DESC(dbri_debug, "Debug value for Sun DBRI soundcard."); | 97 | MODULE_PARM_DESC(dbri_debug, "Debug value for Sun DBRI soundcard."); |
92 | 98 | ||
93 | #ifdef DBRI_DEBUG | 99 | #ifdef DBRI_DEBUG |
@@ -320,7 +326,8 @@ typedef struct snd_dbri { | |||
320 | void __iomem *regs; /* dbri HW regs */ | 326 | void __iomem *regs; /* dbri HW regs */ |
321 | int dbri_version; /* 'e' and up is OK */ | 327 | int dbri_version; /* 'e' and up is OK */ |
322 | int dbri_irqp; /* intr queue pointer */ | 328 | int dbri_irqp; /* intr queue pointer */ |
323 | int wait_seen; | 329 | int wait_send; /* sequence of command buffers send */ |
330 | int wait_ackd; /* sequence of command buffers acknowledged */ | ||
324 | 331 | ||
325 | struct dbri_pipe pipes[DBRI_NO_PIPES]; /* DBRI's 32 data pipes */ | 332 | struct dbri_pipe pipes[DBRI_NO_PIPES]; /* DBRI's 32 data pipes */ |
326 | struct dbri_desc descs[DBRI_NO_DESCS]; | 333 | struct dbri_desc descs[DBRI_NO_DESCS]; |
@@ -625,16 +632,13 @@ static __u32 reverse_bytes(__u32 b, int len) | |||
625 | 632 | ||
626 | Commands are sent to the DBRI by building a list of them in memory, | 633 | Commands are sent to the DBRI by building a list of them in memory, |
627 | then writing the address of the first list item to DBRI register 8. | 634 | then writing the address of the first list item to DBRI register 8. |
628 | The list is terminated with a WAIT command, which can generate a | 635 | The list is terminated with a WAIT command, which generates a |
629 | CPU interrupt if required. | 636 | CPU interrupt to signal completion. |
630 | 637 | ||
631 | Since the DBRI can run in parallel with the CPU, several means of | 638 | Since the DBRI can run in parallel with the CPU, several means of |
632 | synchronization present themselves. The original scheme (Rudolf's) | 639 | synchronization present themselves. The method implemented here is close |
633 | was to set a flag when we "cmdlock"ed the DBRI, clear the flag when | 640 | to the original scheme (Rudolf's), and uses 2 counters (wait_send and |
634 | an interrupt signaled completion, and wait on a wait_queue if a routine | 641 | wait_ackd) to synchronize the command buffer between the CPU and the DBRI. |
635 | attempted to cmdlock while the flag was set. The problems arose when | ||
636 | we tried to cmdlock from inside an interrupt handler, which might | ||
637 | cause scheduling in an interrupt (if we waited), etc, etc | ||
638 | 642 | ||
639 | A more sophisticated scheme might involve a circular command buffer | 643 | A more sophisticated scheme might involve a circular command buffer |
640 | or an array of command buffers. A routine could fill one with | 644 | or an array of command buffers. A routine could fill one with |
@@ -642,70 +646,75 @@ commands and link it onto a list. When a interrupt signaled | |||
642 | completion of the current command buffer, look on the list for | 646 | completion of the current command buffer, look on the list for |
643 | the next one. | 647 | the next one. |
644 | 648 | ||
645 | I've decided to implement something much simpler - after each command, | ||
646 | the CPU waits for the DBRI to finish the command by polling the P bit | ||
647 | in DBRI register 0. I've tried to implement this in such a way | ||
648 | that might make implementing a more sophisticated scheme easier. | ||
649 | |||
650 | Every time a routine wants to write commands to the DBRI, it must | 649 | Every time a routine wants to write commands to the DBRI, it must |
651 | first call dbri_cmdlock() and get an initial pointer into dbri->dma->cmd | 650 | first call dbri_cmdlock() and get an initial pointer into dbri->dma->cmd |
652 | in return. After the commands have been writen, dbri_cmdsend() is | 651 | in return. dbri_cmdlock() will block if the previous commands have not |
653 | called with the final pointer value. | 652 | been completed yet. After this the commands can be written to the buffer, |
653 | and dbri_cmdsend() is called with the final pointer value to send them | ||
654 | to the DBRI. | ||
654 | 655 | ||
655 | */ | 656 | */ |
656 | 657 | ||
658 | static void dbri_process_interrupt_buffer(snd_dbri_t * dbri); | ||
659 | |||
657 | enum dbri_lock_t { NoGetLock, GetLock }; | 660 | enum dbri_lock_t { NoGetLock, GetLock }; |
661 | #define MAXLOOPS 10 | ||
658 | 662 | ||
659 | static volatile s32 *dbri_cmdlock(snd_dbri_t * dbri, enum dbri_lock_t get) | 663 | static volatile s32 *dbri_cmdlock(snd_dbri_t * dbri, enum dbri_lock_t get) |
660 | { | 664 | { |
665 | int maxloops = MAXLOOPS; | ||
666 | |||
661 | #ifndef SMP | 667 | #ifndef SMP |
662 | if ((get == GetLock) && spin_is_locked(&dbri->lock)) { | 668 | if ((get == GetLock) && spin_is_locked(&dbri->lock)) { |
663 | printk(KERN_ERR "DBRI: cmdlock called while in spinlock."); | 669 | printk(KERN_ERR "DBRI: cmdlock called while in spinlock."); |
664 | } | 670 | } |
665 | #endif | 671 | #endif |
666 | 672 | ||
673 | /* Delay if previous commands are still being processed */ | ||
674 | while ((--maxloops) > 0 && (dbri->wait_send != dbri->wait_ackd)) { | ||
675 | msleep_interruptible(1); | ||
676 | /* If dbri_cmdlock() got called from inside the | ||
677 | * interrupt handler, this will do the processing. | ||
678 | */ | ||
679 | dbri_process_interrupt_buffer(dbri); | ||
680 | } | ||
681 | if (maxloops == 0) { | ||
682 | printk(KERN_ERR "DBRI: Chip never completed command buffer %d\n", | ||
683 | dbri->wait_send); | ||
684 | } else { | ||
685 | dprintk(D_CMD, "Chip completed command buffer (%d)\n", | ||
686 | MAXLOOPS - maxloops - 1); | ||
687 | } | ||
688 | |||
667 | /*if (get == GetLock) spin_lock(&dbri->lock); */ | 689 | /*if (get == GetLock) spin_lock(&dbri->lock); */ |
668 | return &dbri->dma->cmd[0]; | 690 | return &dbri->dma->cmd[0]; |
669 | } | 691 | } |
670 | 692 | ||
671 | static void dbri_process_interrupt_buffer(snd_dbri_t *); | ||
672 | |||
673 | static void dbri_cmdsend(snd_dbri_t * dbri, volatile s32 * cmd) | 693 | static void dbri_cmdsend(snd_dbri_t * dbri, volatile s32 * cmd) |
674 | { | 694 | { |
675 | int MAXLOOPS = 1000000; | ||
676 | int maxloops = MAXLOOPS; | ||
677 | volatile s32 *ptr; | 695 | volatile s32 *ptr; |
696 | u32 reg; | ||
678 | 697 | ||
679 | for (ptr = &dbri->dma->cmd[0]; ptr < cmd; ptr++) { | 698 | for (ptr = &dbri->dma->cmd[0]; ptr < cmd; ptr++) { |
680 | dprintk(D_CMD, "cmd: %lx:%08x\n", (unsigned long)ptr, *ptr); | 699 | dprintk(D_CMD, "cmd: %lx:%08x\n", (unsigned long)ptr, *ptr); |
681 | } | 700 | } |
682 | 701 | ||
683 | if ((cmd - &dbri->dma->cmd[0]) >= DBRI_NO_CMDS - 1) { | 702 | if ((cmd - &dbri->dma->cmd[0]) >= DBRI_NO_CMDS - 1) { |
684 | printk("DBRI: Command buffer overflow! (bug in driver)\n"); | 703 | printk(KERN_ERR "DBRI: Command buffer overflow! (bug in driver)\n"); |
685 | /* Ignore the last part. */ | 704 | /* Ignore the last part. */ |
686 | cmd = &dbri->dma->cmd[DBRI_NO_CMDS - 3]; | 705 | cmd = &dbri->dma->cmd[DBRI_NO_CMDS - 3]; |
687 | } | 706 | } |
688 | 707 | ||
708 | dbri->wait_send++; | ||
709 | dbri->wait_send &= 0xffff; /* restrict it to a 16 bit counter. */ | ||
689 | *(cmd++) = DBRI_CMD(D_PAUSE, 0, 0); | 710 | *(cmd++) = DBRI_CMD(D_PAUSE, 0, 0); |
690 | *(cmd++) = DBRI_CMD(D_WAIT, 1, 0); | 711 | *(cmd++) = DBRI_CMD(D_WAIT, 1, dbri->wait_send); |
691 | dbri->wait_seen = 0; | 712 | |
713 | /* Set command pointer and signal it is valid. */ | ||
692 | sbus_writel(dbri->dma_dvma, dbri->regs + REG8); | 714 | sbus_writel(dbri->dma_dvma, dbri->regs + REG8); |
693 | while ((--maxloops) > 0 && (sbus_readl(dbri->regs + REG0) & D_P)) | 715 | reg = sbus_readl(dbri->regs + REG0); |
694 | barrier(); | 716 | reg |= D_P; |
695 | if (maxloops == 0) { | 717 | sbus_writel(reg, dbri->regs + REG0); |
696 | printk(KERN_ERR "DBRI: Chip never completed command buffer\n"); | ||
697 | dprintk(D_CMD, "DBRI: Chip never completed command buffer\n"); | ||
698 | } else { | ||
699 | while ((--maxloops) > 0 && (!dbri->wait_seen)) | ||
700 | dbri_process_interrupt_buffer(dbri); | ||
701 | if (maxloops == 0) { | ||
702 | printk(KERN_ERR "DBRI: Chip never acked WAIT\n"); | ||
703 | dprintk(D_CMD, "DBRI: Chip never acked WAIT\n"); | ||
704 | } else { | ||
705 | dprintk(D_CMD, "Chip completed command " | ||
706 | "buffer (%d)\n", MAXLOOPS - maxloops); | ||
707 | } | ||
708 | } | ||
709 | 718 | ||
710 | /*spin_unlock(&dbri->lock); */ | 719 | /*spin_unlock(&dbri->lock); */ |
711 | } | 720 | } |
@@ -757,10 +766,11 @@ static void dbri_initialize(snd_dbri_t * dbri) | |||
757 | for (n = 0; n < DBRI_NO_PIPES; n++) | 766 | for (n = 0; n < DBRI_NO_PIPES; n++) |
758 | dbri->pipes[n].desc = dbri->pipes[n].first_desc = -1; | 767 | dbri->pipes[n].desc = dbri->pipes[n].first_desc = -1; |
759 | 768 | ||
760 | /* We should query the openprom to see what burst sizes this | 769 | /* A brute approach - DBRI falls back to working burst size by itself |
761 | * SBus supports. For now, just disable all SBus bursts */ | 770 | * On SS20 D_S does not work, so do not try so high. */ |
762 | tmp = sbus_readl(dbri->regs + REG0); | 771 | tmp = sbus_readl(dbri->regs + REG0); |
763 | tmp &= ~(D_G | D_S | D_E); | 772 | tmp |= D_G | D_E; |
773 | tmp &= ~D_S; | ||
764 | sbus_writel(tmp, dbri->regs + REG0); | 774 | sbus_writel(tmp, dbri->regs + REG0); |
765 | 775 | ||
766 | /* | 776 | /* |
@@ -805,13 +815,13 @@ static void reset_pipe(snd_dbri_t * dbri, int pipe) | |||
805 | volatile int *cmd; | 815 | volatile int *cmd; |
806 | 816 | ||
807 | if (pipe < 0 || pipe > 31) { | 817 | if (pipe < 0 || pipe > 31) { |
808 | printk("DBRI: reset_pipe called with illegal pipe number\n"); | 818 | printk(KERN_ERR "DBRI: reset_pipe called with illegal pipe number\n"); |
809 | return; | 819 | return; |
810 | } | 820 | } |
811 | 821 | ||
812 | sdp = dbri->pipes[pipe].sdp; | 822 | sdp = dbri->pipes[pipe].sdp; |
813 | if (sdp == 0) { | 823 | if (sdp == 0) { |
814 | printk("DBRI: reset_pipe called on uninitialized pipe\n"); | 824 | printk(KERN_ERR "DBRI: reset_pipe called on uninitialized pipe\n"); |
815 | return; | 825 | return; |
816 | } | 826 | } |
817 | 827 | ||
@@ -834,12 +844,12 @@ static void reset_pipe(snd_dbri_t * dbri, int pipe) | |||
834 | static void setup_pipe(snd_dbri_t * dbri, int pipe, int sdp) | 844 | static void setup_pipe(snd_dbri_t * dbri, int pipe, int sdp) |
835 | { | 845 | { |
836 | if (pipe < 0 || pipe > 31) { | 846 | if (pipe < 0 || pipe > 31) { |
837 | printk("DBRI: setup_pipe called with illegal pipe number\n"); | 847 | printk(KERN_ERR "DBRI: setup_pipe called with illegal pipe number\n"); |
838 | return; | 848 | return; |
839 | } | 849 | } |
840 | 850 | ||
841 | if ((sdp & 0xf800) != sdp) { | 851 | if ((sdp & 0xf800) != sdp) { |
842 | printk("DBRI: setup_pipe called with strange SDP value\n"); | 852 | printk(KERN_ERR "DBRI: setup_pipe called with strange SDP value\n"); |
843 | /* sdp &= 0xf800; */ | 853 | /* sdp &= 0xf800; */ |
844 | } | 854 | } |
845 | 855 | ||
@@ -872,13 +882,13 @@ static void link_time_slot(snd_dbri_t * dbri, int pipe, | |||
872 | int nextpipe; | 882 | int nextpipe; |
873 | 883 | ||
874 | if (pipe < 0 || pipe > 31 || basepipe < 0 || basepipe > 31) { | 884 | if (pipe < 0 || pipe > 31 || basepipe < 0 || basepipe > 31) { |
875 | printk | 885 | printk(KERN_ERR |
876 | ("DBRI: link_time_slot called with illegal pipe number\n"); | 886 | "DBRI: link_time_slot called with illegal pipe number\n"); |
877 | return; | 887 | return; |
878 | } | 888 | } |
879 | 889 | ||
880 | if (dbri->pipes[pipe].sdp == 0 || dbri->pipes[basepipe].sdp == 0) { | 890 | if (dbri->pipes[pipe].sdp == 0 || dbri->pipes[basepipe].sdp == 0) { |
881 | printk("DBRI: link_time_slot called on uninitialized pipe\n"); | 891 | printk(KERN_ERR "DBRI: link_time_slot called on uninitialized pipe\n"); |
882 | return; | 892 | return; |
883 | } | 893 | } |
884 | 894 | ||
@@ -960,8 +970,8 @@ static void unlink_time_slot(snd_dbri_t * dbri, int pipe, | |||
960 | int val; | 970 | int val; |
961 | 971 | ||
962 | if (pipe < 0 || pipe > 31 || prevpipe < 0 || prevpipe > 31) { | 972 | if (pipe < 0 || pipe > 31 || prevpipe < 0 || prevpipe > 31) { |
963 | printk | 973 | printk(KERN_ERR |
964 | ("DBRI: unlink_time_slot called with illegal pipe number\n"); | 974 | "DBRI: unlink_time_slot called with illegal pipe number\n"); |
965 | return; | 975 | return; |
966 | } | 976 | } |
967 | 977 | ||
@@ -1001,22 +1011,22 @@ static void xmit_fixed(snd_dbri_t * dbri, int pipe, unsigned int data) | |||
1001 | volatile s32 *cmd; | 1011 | volatile s32 *cmd; |
1002 | 1012 | ||
1003 | if (pipe < 16 || pipe > 31) { | 1013 | if (pipe < 16 || pipe > 31) { |
1004 | printk("DBRI: xmit_fixed: Illegal pipe number\n"); | 1014 | printk(KERN_ERR "DBRI: xmit_fixed: Illegal pipe number\n"); |
1005 | return; | 1015 | return; |
1006 | } | 1016 | } |
1007 | 1017 | ||
1008 | if (D_SDP_MODE(dbri->pipes[pipe].sdp) == 0) { | 1018 | if (D_SDP_MODE(dbri->pipes[pipe].sdp) == 0) { |
1009 | printk("DBRI: xmit_fixed: Uninitialized pipe %d\n", pipe); | 1019 | printk(KERN_ERR "DBRI: xmit_fixed: Uninitialized pipe %d\n", pipe); |
1010 | return; | 1020 | return; |
1011 | } | 1021 | } |
1012 | 1022 | ||
1013 | if (D_SDP_MODE(dbri->pipes[pipe].sdp) != D_SDP_FIXED) { | 1023 | if (D_SDP_MODE(dbri->pipes[pipe].sdp) != D_SDP_FIXED) { |
1014 | printk("DBRI: xmit_fixed: Non-fixed pipe %d\n", pipe); | 1024 | printk(KERN_ERR "DBRI: xmit_fixed: Non-fixed pipe %d\n", pipe); |
1015 | return; | 1025 | return; |
1016 | } | 1026 | } |
1017 | 1027 | ||
1018 | if (!(dbri->pipes[pipe].sdp & D_SDP_TO_SER)) { | 1028 | if (!(dbri->pipes[pipe].sdp & D_SDP_TO_SER)) { |
1019 | printk("DBRI: xmit_fixed: Called on receive pipe %d\n", pipe); | 1029 | printk(KERN_ERR "DBRI: xmit_fixed: Called on receive pipe %d\n", pipe); |
1020 | return; | 1030 | return; |
1021 | } | 1031 | } |
1022 | 1032 | ||
@@ -1036,17 +1046,17 @@ static void xmit_fixed(snd_dbri_t * dbri, int pipe, unsigned int data) | |||
1036 | static void recv_fixed(snd_dbri_t * dbri, int pipe, volatile __u32 * ptr) | 1046 | static void recv_fixed(snd_dbri_t * dbri, int pipe, volatile __u32 * ptr) |
1037 | { | 1047 | { |
1038 | if (pipe < 16 || pipe > 31) { | 1048 | if (pipe < 16 || pipe > 31) { |
1039 | printk("DBRI: recv_fixed called with illegal pipe number\n"); | 1049 | printk(KERN_ERR "DBRI: recv_fixed called with illegal pipe number\n"); |
1040 | return; | 1050 | return; |
1041 | } | 1051 | } |
1042 | 1052 | ||
1043 | if (D_SDP_MODE(dbri->pipes[pipe].sdp) != D_SDP_FIXED) { | 1053 | if (D_SDP_MODE(dbri->pipes[pipe].sdp) != D_SDP_FIXED) { |
1044 | printk("DBRI: recv_fixed called on non-fixed pipe %d\n", pipe); | 1054 | printk(KERN_ERR "DBRI: recv_fixed called on non-fixed pipe %d\n", pipe); |
1045 | return; | 1055 | return; |
1046 | } | 1056 | } |
1047 | 1057 | ||
1048 | if (dbri->pipes[pipe].sdp & D_SDP_TO_SER) { | 1058 | if (dbri->pipes[pipe].sdp & D_SDP_TO_SER) { |
1049 | printk("DBRI: recv_fixed called on transmit pipe %d\n", pipe); | 1059 | printk(KERN_ERR "DBRI: recv_fixed called on transmit pipe %d\n", pipe); |
1050 | return; | 1060 | return; |
1051 | } | 1061 | } |
1052 | 1062 | ||
@@ -1075,12 +1085,12 @@ static int setup_descs(snd_dbri_t * dbri, int streamno, unsigned int period) | |||
1075 | int last_desc = -1; | 1085 | int last_desc = -1; |
1076 | 1086 | ||
1077 | if (info->pipe < 0 || info->pipe > 15) { | 1087 | if (info->pipe < 0 || info->pipe > 15) { |
1078 | printk("DBRI: setup_descs: Illegal pipe number\n"); | 1088 | printk(KERN_ERR "DBRI: setup_descs: Illegal pipe number\n"); |
1079 | return -2; | 1089 | return -2; |
1080 | } | 1090 | } |
1081 | 1091 | ||
1082 | if (dbri->pipes[info->pipe].sdp == 0) { | 1092 | if (dbri->pipes[info->pipe].sdp == 0) { |
1083 | printk("DBRI: setup_descs: Uninitialized pipe %d\n", | 1093 | printk(KERN_ERR "DBRI: setup_descs: Uninitialized pipe %d\n", |
1084 | info->pipe); | 1094 | info->pipe); |
1085 | return -2; | 1095 | return -2; |
1086 | } | 1096 | } |
@@ -1090,20 +1100,20 @@ static int setup_descs(snd_dbri_t * dbri, int streamno, unsigned int period) | |||
1090 | 1100 | ||
1091 | if (streamno == DBRI_PLAY) { | 1101 | if (streamno == DBRI_PLAY) { |
1092 | if (!(dbri->pipes[info->pipe].sdp & D_SDP_TO_SER)) { | 1102 | if (!(dbri->pipes[info->pipe].sdp & D_SDP_TO_SER)) { |
1093 | printk("DBRI: setup_descs: Called on receive pipe %d\n", | 1103 | printk(KERN_ERR "DBRI: setup_descs: Called on receive pipe %d\n", |
1094 | info->pipe); | 1104 | info->pipe); |
1095 | return -2; | 1105 | return -2; |
1096 | } | 1106 | } |
1097 | } else { | 1107 | } else { |
1098 | if (dbri->pipes[info->pipe].sdp & D_SDP_TO_SER) { | 1108 | if (dbri->pipes[info->pipe].sdp & D_SDP_TO_SER) { |
1099 | printk | 1109 | printk(KERN_ERR |
1100 | ("DBRI: setup_descs: Called on transmit pipe %d\n", | 1110 | "DBRI: setup_descs: Called on transmit pipe %d\n", |
1101 | info->pipe); | 1111 | info->pipe); |
1102 | return -2; | 1112 | return -2; |
1103 | } | 1113 | } |
1104 | /* Should be able to queue multiple buffers to receive on a pipe */ | 1114 | /* Should be able to queue multiple buffers to receive on a pipe */ |
1105 | if (pipe_active(dbri, info->pipe)) { | 1115 | if (pipe_active(dbri, info->pipe)) { |
1106 | printk("DBRI: recv_on_pipe: Called on active pipe %d\n", | 1116 | printk(KERN_ERR "DBRI: recv_on_pipe: Called on active pipe %d\n", |
1107 | info->pipe); | 1117 | info->pipe); |
1108 | return -2; | 1118 | return -2; |
1109 | } | 1119 | } |
@@ -1120,7 +1130,7 @@ static int setup_descs(snd_dbri_t * dbri, int streamno, unsigned int period) | |||
1120 | break; | 1130 | break; |
1121 | } | 1131 | } |
1122 | if (desc == DBRI_NO_DESCS) { | 1132 | if (desc == DBRI_NO_DESCS) { |
1123 | printk("DBRI: setup_descs: No descriptors\n"); | 1133 | printk(KERN_ERR "DBRI: setup_descs: No descriptors\n"); |
1124 | return -1; | 1134 | return -1; |
1125 | } | 1135 | } |
1126 | 1136 | ||
@@ -1165,7 +1175,7 @@ static int setup_descs(snd_dbri_t * dbri, int streamno, unsigned int period) | |||
1165 | } | 1175 | } |
1166 | 1176 | ||
1167 | if (first_desc == -1 || last_desc == -1) { | 1177 | if (first_desc == -1 || last_desc == -1) { |
1168 | printk("DBRI: setup_descs: Not enough descriptors available\n"); | 1178 | printk(KERN_ERR "DBRI: setup_descs: Not enough descriptors available\n"); |
1169 | return -1; | 1179 | return -1; |
1170 | } | 1180 | } |
1171 | 1181 | ||
@@ -1270,7 +1280,7 @@ static void reset_chi(snd_dbri_t * dbri, enum master_or_slave master_or_slave, | |||
1270 | int divisor = 12288 / clockrate; | 1280 | int divisor = 12288 / clockrate; |
1271 | 1281 | ||
1272 | if (divisor > 255 || divisor * clockrate != 12288) | 1282 | if (divisor > 255 || divisor * clockrate != 12288) |
1273 | printk("DBRI: illegal bits_per_frame in setup_chi\n"); | 1283 | printk(KERN_ERR "DBRI: illegal bits_per_frame in setup_chi\n"); |
1274 | 1284 | ||
1275 | *(cmd++) = DBRI_CMD(D_CHI, 0, D_CHI_CHICM(divisor) | D_CHI_FD | 1285 | *(cmd++) = DBRI_CMD(D_CHI, 0, D_CHI_CHICM(divisor) | D_CHI_FD |
1276 | | D_CHI_BPF(bits_per_frame)); | 1286 | | D_CHI_BPF(bits_per_frame)); |
@@ -1474,7 +1484,6 @@ static int cs4215_setctrl(snd_dbri_t * dbri) | |||
1474 | /* Temporarily mute outputs, and wait 1/8000 sec (125 us) | 1484 | /* Temporarily mute outputs, and wait 1/8000 sec (125 us) |
1475 | * to make sure this takes. This avoids clicking noises. | 1485 | * to make sure this takes. This avoids clicking noises. |
1476 | */ | 1486 | */ |
1477 | |||
1478 | cs4215_setdata(dbri, 1); | 1487 | cs4215_setdata(dbri, 1); |
1479 | udelay(125); | 1488 | udelay(125); |
1480 | 1489 | ||
@@ -1530,8 +1539,8 @@ static int cs4215_setctrl(snd_dbri_t * dbri) | |||
1530 | tmp |= D_C; /* Enable CHI */ | 1539 | tmp |= D_C; /* Enable CHI */ |
1531 | sbus_writel(tmp, dbri->regs + REG0); | 1540 | sbus_writel(tmp, dbri->regs + REG0); |
1532 | 1541 | ||
1533 | for (i = 64; ((dbri->mm.status & 0xe4) != 0x20); --i) { | 1542 | for (i = 10; ((dbri->mm.status & 0xe4) != 0x20); --i) { |
1534 | udelay(125); | 1543 | msleep_interruptible(1); |
1535 | } | 1544 | } |
1536 | if (i == 0) { | 1545 | if (i == 0) { |
1537 | dprintk(D_MM, "CS4215 didn't respond to CLB (0x%02x)\n", | 1546 | dprintk(D_MM, "CS4215 didn't respond to CLB (0x%02x)\n", |
@@ -1678,8 +1687,8 @@ buffer and calls dbri_process_one_interrupt() for each interrupt word. | |||
1678 | Complicated interrupts are handled by dedicated functions (which | 1687 | Complicated interrupts are handled by dedicated functions (which |
1679 | appear first in this file). Any pending interrupts can be serviced by | 1688 | appear first in this file). Any pending interrupts can be serviced by |
1680 | calling dbri_process_interrupt_buffer(), which works even if the CPU's | 1689 | calling dbri_process_interrupt_buffer(), which works even if the CPU's |
1681 | interrupts are disabled. This function is used by dbri_cmdsend() | 1690 | interrupts are disabled. This function is used by dbri_cmdlock() |
1682 | to make sure we're synced up with the chip after each command sequence, | 1691 | to make sure we're synced up with the chip before each command sequence, |
1683 | even if we're running cli'ed. | 1692 | even if we're running cli'ed. |
1684 | 1693 | ||
1685 | */ | 1694 | */ |
@@ -1765,11 +1774,13 @@ DECLARE_TASKLET(xmit_descs_task, xmit_descs, 0); | |||
1765 | * Called by main interrupt handler when DBRI signals transmission complete | 1774 | * Called by main interrupt handler when DBRI signals transmission complete |
1766 | * on a pipe (interrupt triggered by the B bit in a transmit descriptor). | 1775 | * on a pipe (interrupt triggered by the B bit in a transmit descriptor). |
1767 | * | 1776 | * |
1768 | * Walks through the pipe's list of transmit buffer descriptors, releasing | 1777 | * Walks through the pipe's list of transmit buffer descriptors and marks |
1769 | * each one's DMA buffer (if present), flagging the descriptor available, | 1778 | * them as available. Stops when the first descriptor is found without |
1770 | * and signaling its callback routine (if present), before proceeding | ||
1771 | * to the next one. Stops when the first descriptor is found without | ||
1772 | * TBC (Transmit Buffer Complete) set, or we've run through them all. | 1779 | * TBC (Transmit Buffer Complete) set, or we've run through them all. |
1780 | * | ||
1781 | * The DMA buffers are not released, but re-used. Since the transmit buffer | ||
1782 | * descriptors are not clobbered, they can be re-submitted as is. This is | ||
1783 | * done by the xmit_descs() tasklet above since that could take longer. | ||
1773 | */ | 1784 | */ |
1774 | 1785 | ||
1775 | static void transmission_complete_intr(snd_dbri_t * dbri, int pipe) | 1786 | static void transmission_complete_intr(snd_dbri_t * dbri, int pipe) |
@@ -1885,7 +1896,11 @@ static void dbri_process_one_interrupt(snd_dbri_t * dbri, int x) | |||
1885 | } | 1896 | } |
1886 | 1897 | ||
1887 | if (channel == D_INTR_CMD && command == D_WAIT) { | 1898 | if (channel == D_INTR_CMD && command == D_WAIT) { |
1888 | dbri->wait_seen++; | 1899 | dbri->wait_ackd = val; |
1900 | if (dbri->wait_send != val) { | ||
1901 | printk(KERN_ERR "Processing wait command %d when %d was send.\n", | ||
1902 | val, dbri->wait_send); | ||
1903 | } | ||
1889 | return; | 1904 | return; |
1890 | } | 1905 | } |
1891 | 1906 | ||
@@ -1994,8 +2009,7 @@ static irqreturn_t snd_dbri_interrupt(int irq, void *dev_id, | |||
1994 | * The only one I've seen is MRR, which will be triggered | 2009 | * The only one I've seen is MRR, which will be triggered |
1995 | * if you let a transmit pipe underrun, then try to CDP it. | 2010 | * if you let a transmit pipe underrun, then try to CDP it. |
1996 | * | 2011 | * |
1997 | * If these things persist, we should probably reset | 2012 | * If these things persist, we reset the chip. |
1998 | * and re-init the chip. | ||
1999 | */ | 2013 | */ |
2000 | if ((++errcnt) % 10 == 0) { | 2014 | if ((++errcnt) % 10 == 0) { |
2001 | dprintk(D_INT, "Interrupt errors exceeded.\n"); | 2015 | dprintk(D_INT, "Interrupt errors exceeded.\n"); |
@@ -2094,7 +2108,7 @@ static int snd_dbri_hw_params(snd_pcm_substream_t * substream, | |||
2094 | 2108 | ||
2095 | if ((ret = snd_pcm_lib_malloc_pages(substream, | 2109 | if ((ret = snd_pcm_lib_malloc_pages(substream, |
2096 | params_buffer_bytes(hw_params))) < 0) { | 2110 | params_buffer_bytes(hw_params))) < 0) { |
2097 | snd_printk(KERN_ERR "malloc_pages failed with %d\n", ret); | 2111 | printk(KERN_ERR "malloc_pages failed with %d\n", ret); |
2098 | return ret; | 2112 | return ret; |
2099 | } | 2113 | } |
2100 | 2114 | ||
@@ -2455,8 +2469,7 @@ static int __init snd_dbri_mixer(snd_dbri_t * dbri) | |||
2455 | 2469 | ||
2456 | for (idx = 0; idx < NUM_CS4215_CONTROLS; idx++) { | 2470 | for (idx = 0; idx < NUM_CS4215_CONTROLS; idx++) { |
2457 | if ((err = snd_ctl_add(card, | 2471 | if ((err = snd_ctl_add(card, |
2458 | snd_ctl_new1(&dbri_controls[idx], | 2472 | snd_ctl_new1(&dbri_controls[idx], dbri))) < 0) |
2459 | dbri))) < 0) | ||
2460 | return err; | 2473 | return err; |
2461 | } | 2474 | } |
2462 | 2475 | ||
@@ -2490,8 +2503,6 @@ static void dbri_debug_read(snd_info_entry_t * entry, | |||
2490 | int pipe; | 2503 | int pipe; |
2491 | snd_iprintf(buffer, "debug=%d\n", dbri_debug); | 2504 | snd_iprintf(buffer, "debug=%d\n", dbri_debug); |
2492 | 2505 | ||
2493 | snd_iprintf(buffer, "CHI pipe in=%d, out=%d\n", | ||
2494 | dbri->chi_in_pipe, dbri->chi_out_pipe); | ||
2495 | for (pipe = 0; pipe < 32; pipe++) { | 2506 | for (pipe = 0; pipe < 32; pipe++) { |
2496 | if (pipe_active(dbri, pipe)) { | 2507 | if (pipe_active(dbri, pipe)) { |
2497 | struct dbri_pipe *pptr = &dbri->pipes[pipe]; | 2508 | struct dbri_pipe *pptr = &dbri->pipes[pipe]; |
@@ -2506,18 +2517,6 @@ static void dbri_debug_read(snd_info_entry_t * entry, | |||
2506 | } | 2517 | } |
2507 | } | 2518 | } |
2508 | } | 2519 | } |
2509 | |||
2510 | static void dbri_debug_write(snd_info_entry_t * entry, | ||
2511 | snd_info_buffer_t * buffer) | ||
2512 | { | ||
2513 | char line[80]; | ||
2514 | int i; | ||
2515 | |||
2516 | if (snd_info_get_line(buffer, line, 80) == 0) { | ||
2517 | sscanf(line, "%d\n", &i); | ||
2518 | dbri_debug = i & 0x3f; | ||
2519 | } | ||
2520 | } | ||
2521 | #endif | 2520 | #endif |
2522 | 2521 | ||
2523 | void snd_dbri_proc(snd_dbri_t * dbri) | 2522 | void snd_dbri_proc(snd_dbri_t * dbri) |
@@ -2531,9 +2530,7 @@ void snd_dbri_proc(snd_dbri_t * dbri) | |||
2531 | #ifdef DBRI_DEBUG | 2530 | #ifdef DBRI_DEBUG |
2532 | err = snd_card_proc_new(dbri->card, "debug", &entry); | 2531 | err = snd_card_proc_new(dbri->card, "debug", &entry); |
2533 | snd_info_set_text_ops(entry, dbri, 4096, dbri_debug_read); | 2532 | snd_info_set_text_ops(entry, dbri, 4096, dbri_debug_read); |
2534 | entry->mode = S_IFREG | S_IRUGO | S_IWUSR; /* Writable for root */ | 2533 | entry->mode = S_IFREG | S_IRUGO; /* Readable only. */ |
2535 | entry->c.text.write_size = 256; | ||
2536 | entry->c.text.write = dbri_debug_write; | ||
2537 | #endif | 2534 | #endif |
2538 | } | 2535 | } |
2539 | 2536 | ||
@@ -2637,7 +2634,11 @@ static int __init dbri_attach(int prom_node, struct sbus_dev *sdev) | |||
2637 | return -ENOENT; | 2634 | return -ENOENT; |
2638 | } | 2635 | } |
2639 | 2636 | ||
2640 | prom_getproperty(prom_node, "intr", (char *)&irq, sizeof(irq)); | 2637 | err = prom_getproperty(prom_node, "intr", (char *)&irq, sizeof(irq)); |
2638 | if (err < 0) { | ||
2639 | printk(KERN_ERR "DBRI-%d: Firmware node lacks IRQ property.\n", dev); | ||
2640 | return -ENODEV; | ||
2641 | } | ||
2641 | 2642 | ||
2642 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, | 2643 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, |
2643 | sizeof(snd_dbri_t)); | 2644 | sizeof(snd_dbri_t)); |
@@ -2657,26 +2658,20 @@ static int __init dbri_attach(int prom_node, struct sbus_dev *sdev) | |||
2657 | } | 2658 | } |
2658 | 2659 | ||
2659 | dbri = (snd_dbri_t *) card->private_data; | 2660 | dbri = (snd_dbri_t *) card->private_data; |
2660 | if ((err = snd_dbri_pcm(dbri)) < 0) { | 2661 | if ((err = snd_dbri_pcm(dbri)) < 0) |
2661 | snd_dbri_free(dbri); | 2662 | goto _err; |
2662 | snd_card_free(card); | ||
2663 | return err; | ||
2664 | } | ||
2665 | 2663 | ||
2666 | if ((err = snd_dbri_mixer(dbri)) < 0) { | 2664 | if ((err = snd_dbri_mixer(dbri)) < 0) |
2667 | snd_dbri_free(dbri); | 2665 | goto _err; |
2668 | snd_card_free(card); | ||
2669 | return err; | ||
2670 | } | ||
2671 | 2666 | ||
2672 | /* /proc file handling */ | 2667 | /* /proc file handling */ |
2673 | snd_dbri_proc(dbri); | 2668 | snd_dbri_proc(dbri); |
2674 | 2669 | ||
2675 | if ((err = snd_card_register(card)) < 0) { | 2670 | if ((err = snd_card_set_generic_dev(card)) < 0) |
2676 | snd_dbri_free(dbri); | 2671 | goto _err; |
2677 | snd_card_free(card); | 2672 | |
2678 | return err; | 2673 | if ((err = snd_card_register(card)) < 0) |
2679 | } | 2674 | goto _err; |
2680 | 2675 | ||
2681 | printk(KERN_INFO "audio%d at %p (irq %d) is DBRI(%c)+CS4215(%d)\n", | 2676 | printk(KERN_INFO "audio%d at %p (irq %d) is DBRI(%c)+CS4215(%d)\n", |
2682 | dev, dbri->regs, | 2677 | dev, dbri->regs, |
@@ -2684,6 +2679,11 @@ static int __init dbri_attach(int prom_node, struct sbus_dev *sdev) | |||
2684 | dev++; | 2679 | dev++; |
2685 | 2680 | ||
2686 | return 0; | 2681 | return 0; |
2682 | |||
2683 | _err: | ||
2684 | snd_dbri_free(dbri); | ||
2685 | snd_card_free(card); | ||
2686 | return err; | ||
2687 | } | 2687 | } |
2688 | 2688 | ||
2689 | /* Probe for the dbri chip and then attach the driver. */ | 2689 | /* Probe for the dbri chip and then attach the driver. */ |
diff --git a/sound/synth/emux/emux.c b/sound/synth/emux/emux.c index 60d0b2c66698..9e2b4c0c8a8a 100644 --- a/sound/synth/emux/emux.c +++ b/sound/synth/emux/emux.c | |||
@@ -40,7 +40,7 @@ int snd_emux_new(snd_emux_t **remu) | |||
40 | snd_emux_t *emu; | 40 | snd_emux_t *emu; |
41 | 41 | ||
42 | *remu = NULL; | 42 | *remu = NULL; |
43 | emu = kcalloc(1, sizeof(*emu), GFP_KERNEL); | 43 | emu = kzalloc(sizeof(*emu), GFP_KERNEL); |
44 | if (emu == NULL) | 44 | if (emu == NULL) |
45 | return -ENOMEM; | 45 | return -ENOMEM; |
46 | 46 | ||
diff --git a/sound/synth/emux/emux_seq.c b/sound/synth/emux/emux_seq.c index e41b28d9bf52..8ccd33f4aa57 100644 --- a/sound/synth/emux/emux_seq.c +++ b/sound/synth/emux/emux_seq.c | |||
@@ -146,7 +146,7 @@ snd_emux_create_port(snd_emux_t *emu, char *name, | |||
146 | int i, type, cap; | 146 | int i, type, cap; |
147 | 147 | ||
148 | /* Allocate structures for this channel */ | 148 | /* Allocate structures for this channel */ |
149 | if ((p = kcalloc(1, sizeof(*p), GFP_KERNEL)) == NULL) { | 149 | if ((p = kzalloc(sizeof(*p), GFP_KERNEL)) == NULL) { |
150 | snd_printk("no memory\n"); | 150 | snd_printk("no memory\n"); |
151 | return NULL; | 151 | return NULL; |
152 | } | 152 | } |
diff --git a/sound/synth/emux/emux_synth.c b/sound/synth/emux/emux_synth.c index f13b038329eb..751bf1272af3 100644 --- a/sound/synth/emux/emux_synth.c +++ b/sound/synth/emux/emux_synth.c | |||
@@ -98,7 +98,6 @@ snd_emux_note_on(void *p, int note, int vel, snd_midi_channel_t *chan) | |||
98 | vp = emu->ops.get_voice(emu, port); | 98 | vp = emu->ops.get_voice(emu, port); |
99 | if (vp == NULL || vp->ch < 0) | 99 | if (vp == NULL || vp->ch < 0) |
100 | continue; | 100 | continue; |
101 | snd_assert(vp->emu != NULL && vp->hw != NULL, return); | ||
102 | if (STATE_IS_PLAYING(vp->state)) | 101 | if (STATE_IS_PLAYING(vp->state)) |
103 | emu->ops.terminate(vp); | 102 | emu->ops.terminate(vp); |
104 | 103 | ||
diff --git a/sound/synth/emux/soundfont.c b/sound/synth/emux/soundfont.c index 901a7db05bde..d0925ea50838 100644 --- a/sound/synth/emux/soundfont.c +++ b/sound/synth/emux/soundfont.c | |||
@@ -266,7 +266,7 @@ newsf(snd_sf_list_t *sflist, int type, char *name) | |||
266 | } | 266 | } |
267 | 267 | ||
268 | /* not found -- create a new one */ | 268 | /* not found -- create a new one */ |
269 | sf = kcalloc(1, sizeof(*sf), GFP_KERNEL); | 269 | sf = kzalloc(sizeof(*sf), GFP_KERNEL); |
270 | if (sf == NULL) | 270 | if (sf == NULL) |
271 | return NULL; | 271 | return NULL; |
272 | sf->id = sflist->fonts_size; | 272 | sf->id = sflist->fonts_size; |
@@ -346,7 +346,7 @@ sf_zone_new(snd_sf_list_t *sflist, snd_soundfont_t *sf) | |||
346 | { | 346 | { |
347 | snd_sf_zone_t *zp; | 347 | snd_sf_zone_t *zp; |
348 | 348 | ||
349 | if ((zp = kcalloc(1, sizeof(*zp), GFP_KERNEL)) == NULL) | 349 | if ((zp = kzalloc(sizeof(*zp), GFP_KERNEL)) == NULL) |
350 | return NULL; | 350 | return NULL; |
351 | zp->next = sf->zones; | 351 | zp->next = sf->zones; |
352 | sf->zones = zp; | 352 | sf->zones = zp; |
@@ -377,7 +377,7 @@ sf_sample_new(snd_sf_list_t *sflist, snd_soundfont_t *sf) | |||
377 | { | 377 | { |
378 | snd_sf_sample_t *sp; | 378 | snd_sf_sample_t *sp; |
379 | 379 | ||
380 | if ((sp = kcalloc(1, sizeof(*sp), GFP_KERNEL)) == NULL) | 380 | if ((sp = kzalloc(sizeof(*sp), GFP_KERNEL)) == NULL) |
381 | return NULL; | 381 | return NULL; |
382 | 382 | ||
383 | sp->next = sf->samples; | 383 | sp->next = sf->samples; |
@@ -1362,7 +1362,7 @@ snd_sf_new(snd_sf_callback_t *callback, snd_util_memhdr_t *hdr) | |||
1362 | { | 1362 | { |
1363 | snd_sf_list_t *sflist; | 1363 | snd_sf_list_t *sflist; |
1364 | 1364 | ||
1365 | if ((sflist = kcalloc(1, sizeof(*sflist), GFP_KERNEL)) == NULL) | 1365 | if ((sflist = kzalloc(sizeof(*sflist), GFP_KERNEL)) == NULL) |
1366 | return NULL; | 1366 | return NULL; |
1367 | 1367 | ||
1368 | init_MUTEX(&sflist->presets_mutex); | 1368 | init_MUTEX(&sflist->presets_mutex); |
diff --git a/sound/synth/util_mem.c b/sound/synth/util_mem.c index 8b131a11e549..5f75bf31bc36 100644 --- a/sound/synth/util_mem.c +++ b/sound/synth/util_mem.c | |||
@@ -38,7 +38,7 @@ snd_util_memhdr_new(int memsize) | |||
38 | { | 38 | { |
39 | snd_util_memhdr_t *hdr; | 39 | snd_util_memhdr_t *hdr; |
40 | 40 | ||
41 | hdr = kcalloc(1, sizeof(*hdr), GFP_KERNEL); | 41 | hdr = kzalloc(sizeof(*hdr), GFP_KERNEL); |
42 | if (hdr == NULL) | 42 | if (hdr == NULL) |
43 | return NULL; | 43 | return NULL; |
44 | hdr->size = memsize; | 44 | hdr->size = memsize; |
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c index 8298c462c291..2ead878bcb8f 100644 --- a/sound/usb/usbaudio.c +++ b/sound/usb/usbaudio.c | |||
@@ -41,10 +41,12 @@ | |||
41 | #include <sound/driver.h> | 41 | #include <sound/driver.h> |
42 | #include <linux/bitops.h> | 42 | #include <linux/bitops.h> |
43 | #include <linux/init.h> | 43 | #include <linux/init.h> |
44 | #include <linux/interrupt.h> | ||
44 | #include <linux/list.h> | 45 | #include <linux/list.h> |
45 | #include <linux/slab.h> | 46 | #include <linux/slab.h> |
46 | #include <linux/string.h> | 47 | #include <linux/string.h> |
47 | #include <linux/usb.h> | 48 | #include <linux/usb.h> |
49 | #include <linux/vmalloc.h> | ||
48 | #include <linux/moduleparam.h> | 50 | #include <linux/moduleparam.h> |
49 | #include <sound/core.h> | 51 | #include <sound/core.h> |
50 | #include <sound/info.h> | 52 | #include <sound/info.h> |
@@ -79,7 +81,7 @@ module_param_array(vid, int, NULL, 0444); | |||
79 | MODULE_PARM_DESC(vid, "Vendor ID for the USB audio device."); | 81 | MODULE_PARM_DESC(vid, "Vendor ID for the USB audio device."); |
80 | module_param_array(pid, int, NULL, 0444); | 82 | module_param_array(pid, int, NULL, 0444); |
81 | MODULE_PARM_DESC(pid, "Product ID for the USB audio device."); | 83 | MODULE_PARM_DESC(pid, "Product ID for the USB audio device."); |
82 | module_param(nrpacks, int, 0444); | 84 | module_param(nrpacks, int, 0644); |
83 | MODULE_PARM_DESC(nrpacks, "Max. number of packets per URB."); | 85 | MODULE_PARM_DESC(nrpacks, "Max. number of packets per URB."); |
84 | module_param(async_unlink, bool, 0444); | 86 | module_param(async_unlink, bool, 0444); |
85 | MODULE_PARM_DESC(async_unlink, "Use async unlink mode."); | 87 | MODULE_PARM_DESC(async_unlink, "Use async unlink mode."); |
@@ -97,7 +99,7 @@ MODULE_PARM_DESC(async_unlink, "Use async unlink mode."); | |||
97 | 99 | ||
98 | #define MAX_PACKS 10 | 100 | #define MAX_PACKS 10 |
99 | #define MAX_PACKS_HS (MAX_PACKS * 8) /* in high speed mode */ | 101 | #define MAX_PACKS_HS (MAX_PACKS * 8) /* in high speed mode */ |
100 | #define MAX_URBS 5 /* max. 20ms long packets */ | 102 | #define MAX_URBS 8 |
101 | #define SYNC_URBS 4 /* always four urbs for sync */ | 103 | #define SYNC_URBS 4 /* always four urbs for sync */ |
102 | #define MIN_PACKS_URB 1 /* minimum 1 packet per urb */ | 104 | #define MIN_PACKS_URB 1 /* minimum 1 packet per urb */ |
103 | 105 | ||
@@ -126,11 +128,10 @@ struct audioformat { | |||
126 | 128 | ||
127 | struct snd_urb_ctx { | 129 | struct snd_urb_ctx { |
128 | struct urb *urb; | 130 | struct urb *urb; |
131 | unsigned int buffer_size; /* size of data buffer, if data URB */ | ||
129 | snd_usb_substream_t *subs; | 132 | snd_usb_substream_t *subs; |
130 | int index; /* index for urb array */ | 133 | int index; /* index for urb array */ |
131 | int packets; /* number of packets per urb */ | 134 | int packets; /* number of packets per urb */ |
132 | int transfer; /* transferred size */ | ||
133 | char *buf; /* buffer for capture */ | ||
134 | }; | 135 | }; |
135 | 136 | ||
136 | struct snd_urb_ops { | 137 | struct snd_urb_ops { |
@@ -165,12 +166,11 @@ struct snd_usb_substream { | |||
165 | unsigned int curframesize; /* current packet size in frames (for capture) */ | 166 | unsigned int curframesize; /* current packet size in frames (for capture) */ |
166 | unsigned int fill_max: 1; /* fill max packet size always */ | 167 | unsigned int fill_max: 1; /* fill max packet size always */ |
167 | unsigned int fmt_type; /* USB audio format type (1-3) */ | 168 | unsigned int fmt_type; /* USB audio format type (1-3) */ |
169 | unsigned int packs_per_ms; /* packets per millisecond (for playback) */ | ||
168 | 170 | ||
169 | unsigned int running: 1; /* running status */ | 171 | unsigned int running: 1; /* running status */ |
170 | 172 | ||
171 | unsigned int hwptr; /* free frame position in the buffer (only for playback) */ | ||
172 | unsigned int hwptr_done; /* processed frame position in the buffer */ | 173 | unsigned int hwptr_done; /* processed frame position in the buffer */ |
173 | unsigned int transfer_sched; /* scheduled frames since last period (for playback) */ | ||
174 | unsigned int transfer_done; /* processed frames since last period update */ | 174 | unsigned int transfer_done; /* processed frames since last period update */ |
175 | unsigned long active_mask; /* bitmask of active urbs */ | 175 | unsigned long active_mask; /* bitmask of active urbs */ |
176 | unsigned long unlink_mask; /* bitmask of unlinked urbs */ | 176 | unsigned long unlink_mask; /* bitmask of unlinked urbs */ |
@@ -178,13 +178,14 @@ struct snd_usb_substream { | |||
178 | unsigned int nurbs; /* # urbs */ | 178 | unsigned int nurbs; /* # urbs */ |
179 | snd_urb_ctx_t dataurb[MAX_URBS]; /* data urb table */ | 179 | snd_urb_ctx_t dataurb[MAX_URBS]; /* data urb table */ |
180 | snd_urb_ctx_t syncurb[SYNC_URBS]; /* sync urb table */ | 180 | snd_urb_ctx_t syncurb[SYNC_URBS]; /* sync urb table */ |
181 | char syncbuf[SYNC_URBS * 4]; /* sync buffer; it's so small - let's get static */ | 181 | char *syncbuf; /* sync buffer for all sync URBs */ |
182 | char *tmpbuf; /* temporary buffer for playback */ | 182 | dma_addr_t sync_dma; /* DMA address of syncbuf */ |
183 | 183 | ||
184 | u64 formats; /* format bitmasks (all or'ed) */ | 184 | u64 formats; /* format bitmasks (all or'ed) */ |
185 | unsigned int num_formats; /* number of supported audio formats (list) */ | 185 | unsigned int num_formats; /* number of supported audio formats (list) */ |
186 | struct list_head fmt_list; /* format list */ | 186 | struct list_head fmt_list; /* format list */ |
187 | spinlock_t lock; | 187 | spinlock_t lock; |
188 | struct tasklet_struct start_period_elapsed; /* for start trigger */ | ||
188 | 189 | ||
189 | struct snd_urb_ops ops; /* callbacks (must be filled at init) */ | 190 | struct snd_urb_ops ops; /* callbacks (must be filled at init) */ |
190 | }; | 191 | }; |
@@ -311,27 +312,17 @@ static int prepare_capture_urb(snd_usb_substream_t *subs, | |||
311 | struct urb *urb) | 312 | struct urb *urb) |
312 | { | 313 | { |
313 | int i, offs; | 314 | int i, offs; |
314 | unsigned long flags; | ||
315 | snd_urb_ctx_t *ctx = (snd_urb_ctx_t *)urb->context; | 315 | snd_urb_ctx_t *ctx = (snd_urb_ctx_t *)urb->context; |
316 | 316 | ||
317 | offs = 0; | 317 | offs = 0; |
318 | urb->dev = ctx->subs->dev; /* we need to set this at each time */ | 318 | urb->dev = ctx->subs->dev; /* we need to set this at each time */ |
319 | urb->number_of_packets = 0; | ||
320 | spin_lock_irqsave(&subs->lock, flags); | ||
321 | for (i = 0; i < ctx->packets; i++) { | 319 | for (i = 0; i < ctx->packets; i++) { |
322 | urb->iso_frame_desc[i].offset = offs; | 320 | urb->iso_frame_desc[i].offset = offs; |
323 | urb->iso_frame_desc[i].length = subs->curpacksize; | 321 | urb->iso_frame_desc[i].length = subs->curpacksize; |
324 | offs += subs->curpacksize; | 322 | offs += subs->curpacksize; |
325 | urb->number_of_packets++; | ||
326 | subs->transfer_sched += subs->curframesize; | ||
327 | if (subs->transfer_sched >= runtime->period_size) { | ||
328 | subs->transfer_sched -= runtime->period_size; | ||
329 | break; | ||
330 | } | ||
331 | } | 323 | } |
332 | spin_unlock_irqrestore(&subs->lock, flags); | ||
333 | urb->transfer_buffer = ctx->buf; | ||
334 | urb->transfer_buffer_length = offs; | 324 | urb->transfer_buffer_length = offs; |
325 | urb->number_of_packets = ctx->packets; | ||
335 | #if 0 // for check | 326 | #if 0 // for check |
336 | if (! urb->bandwidth) { | 327 | if (! urb->bandwidth) { |
337 | int bustime; | 328 | int bustime; |
@@ -359,6 +350,7 @@ static int retire_capture_urb(snd_usb_substream_t *subs, | |||
359 | unsigned char *cp; | 350 | unsigned char *cp; |
360 | int i; | 351 | int i; |
361 | unsigned int stride, len, oldptr; | 352 | unsigned int stride, len, oldptr; |
353 | int period_elapsed = 0; | ||
362 | 354 | ||
363 | stride = runtime->frame_bits >> 3; | 355 | stride = runtime->frame_bits >> 3; |
364 | 356 | ||
@@ -378,6 +370,10 @@ static int retire_capture_urb(snd_usb_substream_t *subs, | |||
378 | if (subs->hwptr_done >= runtime->buffer_size) | 370 | if (subs->hwptr_done >= runtime->buffer_size) |
379 | subs->hwptr_done -= runtime->buffer_size; | 371 | subs->hwptr_done -= runtime->buffer_size; |
380 | subs->transfer_done += len; | 372 | subs->transfer_done += len; |
373 | if (subs->transfer_done >= runtime->period_size) { | ||
374 | subs->transfer_done -= runtime->period_size; | ||
375 | period_elapsed = 1; | ||
376 | } | ||
381 | spin_unlock_irqrestore(&subs->lock, flags); | 377 | spin_unlock_irqrestore(&subs->lock, flags); |
382 | /* copy a data chunk */ | 378 | /* copy a data chunk */ |
383 | if (oldptr + len > runtime->buffer_size) { | 379 | if (oldptr + len > runtime->buffer_size) { |
@@ -388,15 +384,9 @@ static int retire_capture_urb(snd_usb_substream_t *subs, | |||
388 | } else { | 384 | } else { |
389 | memcpy(runtime->dma_area + oldptr * stride, cp, len * stride); | 385 | memcpy(runtime->dma_area + oldptr * stride, cp, len * stride); |
390 | } | 386 | } |
391 | /* update the pointer, call callback if necessary */ | ||
392 | spin_lock_irqsave(&subs->lock, flags); | ||
393 | if (subs->transfer_done >= runtime->period_size) { | ||
394 | subs->transfer_done -= runtime->period_size; | ||
395 | spin_unlock_irqrestore(&subs->lock, flags); | ||
396 | snd_pcm_period_elapsed(subs->pcm_substream); | ||
397 | } else | ||
398 | spin_unlock_irqrestore(&subs->lock, flags); | ||
399 | } | 387 | } |
388 | if (period_elapsed) | ||
389 | snd_pcm_period_elapsed(subs->pcm_substream); | ||
400 | return 0; | 390 | return 0; |
401 | } | 391 | } |
402 | 392 | ||
@@ -492,12 +482,10 @@ static int retire_playback_sync_urb_hs(snd_usb_substream_t *subs, | |||
492 | /* | 482 | /* |
493 | * prepare urb for playback data pipe | 483 | * prepare urb for playback data pipe |
494 | * | 484 | * |
495 | * we copy the data directly from the pcm buffer. | 485 | * Since a URB can handle only a single linear buffer, we must use double |
496 | * the current position to be copied is held in hwptr field. | 486 | * buffering when the data to be transferred overflows the buffer boundary. |
497 | * since a urb can handle only a single linear buffer, if the total | 487 | * To avoid inconsistencies when updating hwptr_done, we use double buffering |
498 | * transferred area overflows the buffer boundary, we cannot send | 488 | * for all URBs. |
499 | * it directly from the buffer. thus the data is once copied to | ||
500 | * a temporary buffer and urb points to that. | ||
501 | */ | 489 | */ |
502 | static int prepare_playback_urb(snd_usb_substream_t *subs, | 490 | static int prepare_playback_urb(snd_usb_substream_t *subs, |
503 | snd_pcm_runtime_t *runtime, | 491 | snd_pcm_runtime_t *runtime, |
@@ -506,6 +494,7 @@ static int prepare_playback_urb(snd_usb_substream_t *subs, | |||
506 | int i, stride, offs; | 494 | int i, stride, offs; |
507 | unsigned int counts; | 495 | unsigned int counts; |
508 | unsigned long flags; | 496 | unsigned long flags; |
497 | int period_elapsed = 0; | ||
509 | snd_urb_ctx_t *ctx = (snd_urb_ctx_t *)urb->context; | 498 | snd_urb_ctx_t *ctx = (snd_urb_ctx_t *)urb->context; |
510 | 499 | ||
511 | stride = runtime->frame_bits >> 3; | 500 | stride = runtime->frame_bits >> 3; |
@@ -530,80 +519,85 @@ static int prepare_playback_urb(snd_usb_substream_t *subs, | |||
530 | urb->iso_frame_desc[i].length = counts * stride; | 519 | urb->iso_frame_desc[i].length = counts * stride; |
531 | offs += counts; | 520 | offs += counts; |
532 | urb->number_of_packets++; | 521 | urb->number_of_packets++; |
533 | subs->transfer_sched += counts; | 522 | subs->transfer_done += counts; |
534 | if (subs->transfer_sched >= runtime->period_size) { | 523 | if (subs->transfer_done >= runtime->period_size) { |
535 | subs->transfer_sched -= runtime->period_size; | 524 | subs->transfer_done -= runtime->period_size; |
525 | period_elapsed = 1; | ||
536 | if (subs->fmt_type == USB_FORMAT_TYPE_II) { | 526 | if (subs->fmt_type == USB_FORMAT_TYPE_II) { |
537 | if (subs->transfer_sched > 0) { | 527 | if (subs->transfer_done > 0) { |
538 | /* FIXME: fill-max mode is not supported yet */ | 528 | /* FIXME: fill-max mode is not |
539 | offs -= subs->transfer_sched; | 529 | * supported yet */ |
540 | counts -= subs->transfer_sched; | 530 | offs -= subs->transfer_done; |
541 | urb->iso_frame_desc[i].length = counts * stride; | 531 | counts -= subs->transfer_done; |
542 | subs->transfer_sched = 0; | 532 | urb->iso_frame_desc[i].length = |
533 | counts * stride; | ||
534 | subs->transfer_done = 0; | ||
543 | } | 535 | } |
544 | i++; | 536 | i++; |
545 | if (i < ctx->packets) { | 537 | if (i < ctx->packets) { |
546 | /* add a transfer delimiter */ | 538 | /* add a transfer delimiter */ |
547 | urb->iso_frame_desc[i].offset = offs * stride; | 539 | urb->iso_frame_desc[i].offset = |
540 | offs * stride; | ||
548 | urb->iso_frame_desc[i].length = 0; | 541 | urb->iso_frame_desc[i].length = 0; |
549 | urb->number_of_packets++; | 542 | urb->number_of_packets++; |
550 | } | 543 | } |
544 | break; | ||
551 | } | 545 | } |
552 | break; | ||
553 | } | 546 | } |
547 | /* finish at the frame boundary at/after the period boundary */ | ||
548 | if (period_elapsed && | ||
549 | (i & (subs->packs_per_ms - 1)) == subs->packs_per_ms - 1) | ||
550 | break; | ||
554 | } | 551 | } |
555 | if (subs->hwptr + offs > runtime->buffer_size) { | 552 | if (subs->hwptr_done + offs > runtime->buffer_size) { |
556 | /* err, the transferred area goes over buffer boundary. | 553 | /* err, the transferred area goes over buffer boundary. */ |
557 | * copy the data to the temp buffer. | 554 | unsigned int len = runtime->buffer_size - subs->hwptr_done; |
558 | */ | 555 | memcpy(urb->transfer_buffer, |
559 | int len; | 556 | runtime->dma_area + subs->hwptr_done * stride, |
560 | len = runtime->buffer_size - subs->hwptr; | 557 | len * stride); |
561 | urb->transfer_buffer = subs->tmpbuf; | 558 | memcpy(urb->transfer_buffer + len * stride, |
562 | memcpy(subs->tmpbuf, runtime->dma_area + subs->hwptr * stride, len * stride); | 559 | runtime->dma_area, |
563 | memcpy(subs->tmpbuf + len * stride, runtime->dma_area, (offs - len) * stride); | 560 | (offs - len) * stride); |
564 | subs->hwptr += offs; | ||
565 | subs->hwptr -= runtime->buffer_size; | ||
566 | } else { | 561 | } else { |
567 | /* set the buffer pointer */ | 562 | memcpy(urb->transfer_buffer, |
568 | urb->transfer_buffer = runtime->dma_area + subs->hwptr * stride; | 563 | runtime->dma_area + subs->hwptr_done * stride, |
569 | subs->hwptr += offs; | 564 | offs * stride); |
570 | if (subs->hwptr == runtime->buffer_size) | ||
571 | subs->hwptr = 0; | ||
572 | } | 565 | } |
566 | subs->hwptr_done += offs; | ||
567 | if (subs->hwptr_done >= runtime->buffer_size) | ||
568 | subs->hwptr_done -= runtime->buffer_size; | ||
573 | spin_unlock_irqrestore(&subs->lock, flags); | 569 | spin_unlock_irqrestore(&subs->lock, flags); |
574 | urb->transfer_buffer_length = offs * stride; | 570 | urb->transfer_buffer_length = offs * stride; |
575 | ctx->transfer = offs; | 571 | if (period_elapsed) { |
576 | 572 | if (likely(subs->running)) | |
573 | snd_pcm_period_elapsed(subs->pcm_substream); | ||
574 | else | ||
575 | tasklet_hi_schedule(&subs->start_period_elapsed); | ||
576 | } | ||
577 | return 0; | 577 | return 0; |
578 | } | 578 | } |
579 | 579 | ||
580 | /* | 580 | /* |
581 | * process after playback data complete | 581 | * process after playback data complete |
582 | * | 582 | * - nothing to do |
583 | * update the current position and call callback if a period is processed. | ||
584 | */ | 583 | */ |
585 | static int retire_playback_urb(snd_usb_substream_t *subs, | 584 | static int retire_playback_urb(snd_usb_substream_t *subs, |
586 | snd_pcm_runtime_t *runtime, | 585 | snd_pcm_runtime_t *runtime, |
587 | struct urb *urb) | 586 | struct urb *urb) |
588 | { | 587 | { |
589 | unsigned long flags; | ||
590 | snd_urb_ctx_t *ctx = (snd_urb_ctx_t *)urb->context; | ||
591 | |||
592 | spin_lock_irqsave(&subs->lock, flags); | ||
593 | subs->transfer_done += ctx->transfer; | ||
594 | subs->hwptr_done += ctx->transfer; | ||
595 | ctx->transfer = 0; | ||
596 | if (subs->hwptr_done >= runtime->buffer_size) | ||
597 | subs->hwptr_done -= runtime->buffer_size; | ||
598 | if (subs->transfer_done >= runtime->period_size) { | ||
599 | subs->transfer_done -= runtime->period_size; | ||
600 | spin_unlock_irqrestore(&subs->lock, flags); | ||
601 | snd_pcm_period_elapsed(subs->pcm_substream); | ||
602 | } else | ||
603 | spin_unlock_irqrestore(&subs->lock, flags); | ||
604 | return 0; | 588 | return 0; |
605 | } | 589 | } |
606 | 590 | ||
591 | /* | ||
592 | * Delay the snd_pcm_period_elapsed() call until after the start trigger | ||
593 | * callback so that we're not longer in the substream's lock. | ||
594 | */ | ||
595 | static void start_period_elapsed(unsigned long data) | ||
596 | { | ||
597 | snd_usb_substream_t *subs = (snd_usb_substream_t *)data; | ||
598 | snd_pcm_period_elapsed(subs->pcm_substream); | ||
599 | } | ||
600 | |||
607 | 601 | ||
608 | /* | 602 | /* |
609 | */ | 603 | */ |
@@ -683,6 +677,42 @@ static void snd_complete_sync_urb(struct urb *urb, struct pt_regs *regs) | |||
683 | } | 677 | } |
684 | 678 | ||
685 | 679 | ||
680 | /* get the physical page pointer at the given offset */ | ||
681 | static struct page *snd_pcm_get_vmalloc_page(snd_pcm_substream_t *subs, | ||
682 | unsigned long offset) | ||
683 | { | ||
684 | void *pageptr = subs->runtime->dma_area + offset; | ||
685 | return vmalloc_to_page(pageptr); | ||
686 | } | ||
687 | |||
688 | /* allocate virtual buffer; may be called more than once */ | ||
689 | static int snd_pcm_alloc_vmalloc_buffer(snd_pcm_substream_t *subs, size_t size) | ||
690 | { | ||
691 | snd_pcm_runtime_t *runtime = subs->runtime; | ||
692 | if (runtime->dma_area) { | ||
693 | if (runtime->dma_bytes >= size) | ||
694 | return 0; /* already large enough */ | ||
695 | vfree_nocheck(runtime->dma_area); | ||
696 | } | ||
697 | runtime->dma_area = vmalloc_nocheck(size); | ||
698 | if (! runtime->dma_area) | ||
699 | return -ENOMEM; | ||
700 | runtime->dma_bytes = size; | ||
701 | return 0; | ||
702 | } | ||
703 | |||
704 | /* free virtual buffer; may be called more than once */ | ||
705 | static int snd_pcm_free_vmalloc_buffer(snd_pcm_substream_t *subs) | ||
706 | { | ||
707 | snd_pcm_runtime_t *runtime = subs->runtime; | ||
708 | if (runtime->dma_area) { | ||
709 | vfree_nocheck(runtime->dma_area); | ||
710 | runtime->dma_area = NULL; | ||
711 | } | ||
712 | return 0; | ||
713 | } | ||
714 | |||
715 | |||
686 | /* | 716 | /* |
687 | * unlink active urbs. | 717 | * unlink active urbs. |
688 | */ | 718 | */ |
@@ -705,10 +735,9 @@ static int deactivate_urbs(snd_usb_substream_t *subs, int force, int can_sleep) | |||
705 | if (test_bit(i, &subs->active_mask)) { | 735 | if (test_bit(i, &subs->active_mask)) { |
706 | if (! test_and_set_bit(i, &subs->unlink_mask)) { | 736 | if (! test_and_set_bit(i, &subs->unlink_mask)) { |
707 | struct urb *u = subs->dataurb[i].urb; | 737 | struct urb *u = subs->dataurb[i].urb; |
708 | if (async) { | 738 | if (async) |
709 | u->transfer_flags |= URB_ASYNC_UNLINK; | ||
710 | usb_unlink_urb(u); | 739 | usb_unlink_urb(u); |
711 | } else | 740 | else |
712 | usb_kill_urb(u); | 741 | usb_kill_urb(u); |
713 | } | 742 | } |
714 | } | 743 | } |
@@ -718,10 +747,9 @@ static int deactivate_urbs(snd_usb_substream_t *subs, int force, int can_sleep) | |||
718 | if (test_bit(i+16, &subs->active_mask)) { | 747 | if (test_bit(i+16, &subs->active_mask)) { |
719 | if (! test_and_set_bit(i+16, &subs->unlink_mask)) { | 748 | if (! test_and_set_bit(i+16, &subs->unlink_mask)) { |
720 | struct urb *u = subs->syncurb[i].urb; | 749 | struct urb *u = subs->syncurb[i].urb; |
721 | if (async) { | 750 | if (async) |
722 | u->transfer_flags |= URB_ASYNC_UNLINK; | ||
723 | usb_unlink_urb(u); | 751 | usb_unlink_urb(u); |
724 | } else | 752 | else |
725 | usb_kill_urb(u); | 753 | usb_kill_urb(u); |
726 | } | 754 | } |
727 | } | 755 | } |
@@ -824,8 +852,14 @@ static int wait_clear_urbs(snd_usb_substream_t *subs) | |||
824 | */ | 852 | */ |
825 | static snd_pcm_uframes_t snd_usb_pcm_pointer(snd_pcm_substream_t *substream) | 853 | static snd_pcm_uframes_t snd_usb_pcm_pointer(snd_pcm_substream_t *substream) |
826 | { | 854 | { |
827 | snd_usb_substream_t *subs = (snd_usb_substream_t *)substream->runtime->private_data; | 855 | snd_usb_substream_t *subs; |
828 | return subs->hwptr_done; | 856 | snd_pcm_uframes_t hwptr_done; |
857 | |||
858 | subs = (snd_usb_substream_t *)substream->runtime->private_data; | ||
859 | spin_lock(&subs->lock); | ||
860 | hwptr_done = subs->hwptr_done; | ||
861 | spin_unlock(&subs->lock); | ||
862 | return hwptr_done; | ||
829 | } | 863 | } |
830 | 864 | ||
831 | 865 | ||
@@ -858,11 +892,13 @@ static int snd_usb_pcm_trigger(snd_pcm_substream_t *substream, int cmd) | |||
858 | static void release_urb_ctx(snd_urb_ctx_t *u) | 892 | static void release_urb_ctx(snd_urb_ctx_t *u) |
859 | { | 893 | { |
860 | if (u->urb) { | 894 | if (u->urb) { |
895 | if (u->buffer_size) | ||
896 | usb_buffer_free(u->subs->dev, u->buffer_size, | ||
897 | u->urb->transfer_buffer, | ||
898 | u->urb->transfer_dma); | ||
861 | usb_free_urb(u->urb); | 899 | usb_free_urb(u->urb); |
862 | u->urb = NULL; | 900 | u->urb = NULL; |
863 | } | 901 | } |
864 | kfree(u->buf); | ||
865 | u->buf = NULL; | ||
866 | } | 902 | } |
867 | 903 | ||
868 | /* | 904 | /* |
@@ -880,8 +916,9 @@ static void release_substream_urbs(snd_usb_substream_t *subs, int force) | |||
880 | release_urb_ctx(&subs->dataurb[i]); | 916 | release_urb_ctx(&subs->dataurb[i]); |
881 | for (i = 0; i < SYNC_URBS; i++) | 917 | for (i = 0; i < SYNC_URBS; i++) |
882 | release_urb_ctx(&subs->syncurb[i]); | 918 | release_urb_ctx(&subs->syncurb[i]); |
883 | kfree(subs->tmpbuf); | 919 | usb_buffer_free(subs->dev, SYNC_URBS * 4, |
884 | subs->tmpbuf = NULL; | 920 | subs->syncbuf, subs->sync_dma); |
921 | subs->syncbuf = NULL; | ||
885 | subs->nurbs = 0; | 922 | subs->nurbs = 0; |
886 | } | 923 | } |
887 | 924 | ||
@@ -893,7 +930,7 @@ static int init_substream_urbs(snd_usb_substream_t *subs, unsigned int period_by | |||
893 | { | 930 | { |
894 | unsigned int maxsize, n, i; | 931 | unsigned int maxsize, n, i; |
895 | int is_playback = subs->direction == SNDRV_PCM_STREAM_PLAYBACK; | 932 | int is_playback = subs->direction == SNDRV_PCM_STREAM_PLAYBACK; |
896 | unsigned int npacks[MAX_URBS], urb_packs, total_packs; | 933 | unsigned int npacks[MAX_URBS], urb_packs, total_packs, packs_per_ms; |
897 | 934 | ||
898 | /* calculate the frequency in 16.16 format */ | 935 | /* calculate the frequency in 16.16 format */ |
899 | if (snd_usb_get_speed(subs->dev) == USB_SPEED_FULL) | 936 | if (snd_usb_get_speed(subs->dev) == USB_SPEED_FULL) |
@@ -920,24 +957,40 @@ static int init_substream_urbs(snd_usb_substream_t *subs, unsigned int period_by | |||
920 | else | 957 | else |
921 | subs->curpacksize = maxsize; | 958 | subs->curpacksize = maxsize; |
922 | 959 | ||
923 | if (snd_usb_get_speed(subs->dev) == USB_SPEED_FULL) | 960 | if (snd_usb_get_speed(subs->dev) == USB_SPEED_HIGH) |
924 | urb_packs = nrpacks; | 961 | packs_per_ms = 8 >> subs->datainterval; |
925 | else | 962 | else |
926 | urb_packs = (nrpacks * 8) >> subs->datainterval; | 963 | packs_per_ms = 1; |
964 | subs->packs_per_ms = packs_per_ms; | ||
927 | 965 | ||
928 | /* allocate a temporary buffer for playback */ | ||
929 | if (is_playback) { | 966 | if (is_playback) { |
930 | subs->tmpbuf = kmalloc(maxsize * urb_packs, GFP_KERNEL); | 967 | urb_packs = nrpacks; |
931 | if (! subs->tmpbuf) { | 968 | urb_packs = max(urb_packs, (unsigned int)MIN_PACKS_URB); |
932 | snd_printk(KERN_ERR "cannot malloc tmpbuf\n"); | 969 | urb_packs = min(urb_packs, (unsigned int)MAX_PACKS); |
933 | return -ENOMEM; | 970 | } else |
934 | } | 971 | urb_packs = 1; |
935 | } | 972 | urb_packs *= packs_per_ms; |
936 | 973 | ||
937 | /* decide how many packets to be used */ | 974 | /* decide how many packets to be used */ |
938 | total_packs = (period_bytes + maxsize - 1) / maxsize; | 975 | if (is_playback) { |
939 | if (total_packs < 2 * MIN_PACKS_URB) | 976 | unsigned int minsize; |
940 | total_packs = 2 * MIN_PACKS_URB; | 977 | /* determine how small a packet can be */ |
978 | minsize = (subs->freqn >> (16 - subs->datainterval)) | ||
979 | * (frame_bits >> 3); | ||
980 | /* with sync from device, assume it can be 12% lower */ | ||
981 | if (subs->syncpipe) | ||
982 | minsize -= minsize >> 3; | ||
983 | minsize = max(minsize, 1u); | ||
984 | total_packs = (period_bytes + minsize - 1) / minsize; | ||
985 | /* round up to multiple of packs_per_ms */ | ||
986 | total_packs = (total_packs + packs_per_ms - 1) | ||
987 | & ~(packs_per_ms - 1); | ||
988 | /* we need at least two URBs for queueing */ | ||
989 | if (total_packs < 2 * MIN_PACKS_URB * packs_per_ms) | ||
990 | total_packs = 2 * MIN_PACKS_URB * packs_per_ms; | ||
991 | } else { | ||
992 | total_packs = MAX_URBS * urb_packs; | ||
993 | } | ||
941 | subs->nurbs = (total_packs + urb_packs - 1) / urb_packs; | 994 | subs->nurbs = (total_packs + urb_packs - 1) / urb_packs; |
942 | if (subs->nurbs > MAX_URBS) { | 995 | if (subs->nurbs > MAX_URBS) { |
943 | /* too much... */ | 996 | /* too much... */ |
@@ -956,7 +1009,7 @@ static int init_substream_urbs(snd_usb_substream_t *subs, unsigned int period_by | |||
956 | subs->nurbs = 2; | 1009 | subs->nurbs = 2; |
957 | npacks[0] = (total_packs + 1) / 2; | 1010 | npacks[0] = (total_packs + 1) / 2; |
958 | npacks[1] = total_packs - npacks[0]; | 1011 | npacks[1] = total_packs - npacks[0]; |
959 | } else if (npacks[subs->nurbs-1] < MIN_PACKS_URB) { | 1012 | } else if (npacks[subs->nurbs-1] < MIN_PACKS_URB * packs_per_ms) { |
960 | /* the last packet is too small.. */ | 1013 | /* the last packet is too small.. */ |
961 | if (subs->nurbs > 2) { | 1014 | if (subs->nurbs > 2) { |
962 | /* merge to the first one */ | 1015 | /* merge to the first one */ |
@@ -975,27 +1028,20 @@ static int init_substream_urbs(snd_usb_substream_t *subs, unsigned int period_by | |||
975 | snd_urb_ctx_t *u = &subs->dataurb[i]; | 1028 | snd_urb_ctx_t *u = &subs->dataurb[i]; |
976 | u->index = i; | 1029 | u->index = i; |
977 | u->subs = subs; | 1030 | u->subs = subs; |
978 | u->transfer = 0; | ||
979 | u->packets = npacks[i]; | 1031 | u->packets = npacks[i]; |
1032 | u->buffer_size = maxsize * u->packets; | ||
980 | if (subs->fmt_type == USB_FORMAT_TYPE_II) | 1033 | if (subs->fmt_type == USB_FORMAT_TYPE_II) |
981 | u->packets++; /* for transfer delimiter */ | 1034 | u->packets++; /* for transfer delimiter */ |
982 | if (! is_playback) { | ||
983 | /* allocate a capture buffer per urb */ | ||
984 | u->buf = kmalloc(maxsize * u->packets, GFP_KERNEL); | ||
985 | if (! u->buf) { | ||
986 | release_substream_urbs(subs, 0); | ||
987 | return -ENOMEM; | ||
988 | } | ||
989 | } | ||
990 | u->urb = usb_alloc_urb(u->packets, GFP_KERNEL); | 1035 | u->urb = usb_alloc_urb(u->packets, GFP_KERNEL); |
991 | if (! u->urb) { | 1036 | if (! u->urb) |
992 | release_substream_urbs(subs, 0); | 1037 | goto out_of_memory; |
993 | return -ENOMEM; | 1038 | u->urb->transfer_buffer = |
994 | } | 1039 | usb_buffer_alloc(subs->dev, u->buffer_size, GFP_KERNEL, |
995 | u->urb->dev = subs->dev; | 1040 | &u->urb->transfer_dma); |
1041 | if (! u->urb->transfer_buffer) | ||
1042 | goto out_of_memory; | ||
996 | u->urb->pipe = subs->datapipe; | 1043 | u->urb->pipe = subs->datapipe; |
997 | u->urb->transfer_flags = URB_ISO_ASAP; | 1044 | u->urb->transfer_flags = URB_ISO_ASAP | URB_NO_TRANSFER_DMA_MAP; |
998 | u->urb->number_of_packets = u->packets; | ||
999 | u->urb->interval = 1 << subs->datainterval; | 1045 | u->urb->interval = 1 << subs->datainterval; |
1000 | u->urb->context = u; | 1046 | u->urb->context = u; |
1001 | u->urb->complete = snd_usb_complete_callback(snd_complete_urb); | 1047 | u->urb->complete = snd_usb_complete_callback(snd_complete_urb); |
@@ -1003,21 +1049,24 @@ static int init_substream_urbs(snd_usb_substream_t *subs, unsigned int period_by | |||
1003 | 1049 | ||
1004 | if (subs->syncpipe) { | 1050 | if (subs->syncpipe) { |
1005 | /* allocate and initialize sync urbs */ | 1051 | /* allocate and initialize sync urbs */ |
1052 | subs->syncbuf = usb_buffer_alloc(subs->dev, SYNC_URBS * 4, | ||
1053 | GFP_KERNEL, &subs->sync_dma); | ||
1054 | if (! subs->syncbuf) | ||
1055 | goto out_of_memory; | ||
1006 | for (i = 0; i < SYNC_URBS; i++) { | 1056 | for (i = 0; i < SYNC_URBS; i++) { |
1007 | snd_urb_ctx_t *u = &subs->syncurb[i]; | 1057 | snd_urb_ctx_t *u = &subs->syncurb[i]; |
1008 | u->index = i; | 1058 | u->index = i; |
1009 | u->subs = subs; | 1059 | u->subs = subs; |
1010 | u->packets = 1; | 1060 | u->packets = 1; |
1011 | u->urb = usb_alloc_urb(1, GFP_KERNEL); | 1061 | u->urb = usb_alloc_urb(1, GFP_KERNEL); |
1012 | if (! u->urb) { | 1062 | if (! u->urb) |
1013 | release_substream_urbs(subs, 0); | 1063 | goto out_of_memory; |
1014 | return -ENOMEM; | ||
1015 | } | ||
1016 | u->urb->transfer_buffer = subs->syncbuf + i * 4; | 1064 | u->urb->transfer_buffer = subs->syncbuf + i * 4; |
1065 | u->urb->transfer_dma = subs->sync_dma + i * 4; | ||
1017 | u->urb->transfer_buffer_length = 4; | 1066 | u->urb->transfer_buffer_length = 4; |
1018 | u->urb->dev = subs->dev; | ||
1019 | u->urb->pipe = subs->syncpipe; | 1067 | u->urb->pipe = subs->syncpipe; |
1020 | u->urb->transfer_flags = URB_ISO_ASAP; | 1068 | u->urb->transfer_flags = URB_ISO_ASAP | |
1069 | URB_NO_TRANSFER_DMA_MAP; | ||
1021 | u->urb->number_of_packets = 1; | 1070 | u->urb->number_of_packets = 1; |
1022 | u->urb->interval = 1 << subs->syncinterval; | 1071 | u->urb->interval = 1 << subs->syncinterval; |
1023 | u->urb->context = u; | 1072 | u->urb->context = u; |
@@ -1025,6 +1074,10 @@ static int init_substream_urbs(snd_usb_substream_t *subs, unsigned int period_by | |||
1025 | } | 1074 | } |
1026 | } | 1075 | } |
1027 | return 0; | 1076 | return 0; |
1077 | |||
1078 | out_of_memory: | ||
1079 | release_substream_urbs(subs, 0); | ||
1080 | return -ENOMEM; | ||
1028 | } | 1081 | } |
1029 | 1082 | ||
1030 | 1083 | ||
@@ -1293,7 +1346,8 @@ static int snd_usb_hw_params(snd_pcm_substream_t *substream, | |||
1293 | unsigned int channels, rate, format; | 1346 | unsigned int channels, rate, format; |
1294 | int ret, changed; | 1347 | int ret, changed; |
1295 | 1348 | ||
1296 | ret = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)); | 1349 | ret = snd_pcm_alloc_vmalloc_buffer(substream, |
1350 | params_buffer_bytes(hw_params)); | ||
1297 | if (ret < 0) | 1351 | if (ret < 0) |
1298 | return ret; | 1352 | return ret; |
1299 | 1353 | ||
@@ -1349,7 +1403,7 @@ static int snd_usb_hw_free(snd_pcm_substream_t *substream) | |||
1349 | subs->cur_rate = 0; | 1403 | subs->cur_rate = 0; |
1350 | subs->period_bytes = 0; | 1404 | subs->period_bytes = 0; |
1351 | release_substream_urbs(subs, 0); | 1405 | release_substream_urbs(subs, 0); |
1352 | return snd_pcm_lib_free_pages(substream); | 1406 | return snd_pcm_free_vmalloc_buffer(substream); |
1353 | } | 1407 | } |
1354 | 1408 | ||
1355 | /* | 1409 | /* |
@@ -1372,9 +1426,7 @@ static int snd_usb_pcm_prepare(snd_pcm_substream_t *substream) | |||
1372 | subs->curframesize = bytes_to_frames(runtime, subs->curpacksize); | 1426 | subs->curframesize = bytes_to_frames(runtime, subs->curpacksize); |
1373 | 1427 | ||
1374 | /* reset the pointer */ | 1428 | /* reset the pointer */ |
1375 | subs->hwptr = 0; | ||
1376 | subs->hwptr_done = 0; | 1429 | subs->hwptr_done = 0; |
1377 | subs->transfer_sched = 0; | ||
1378 | subs->transfer_done = 0; | 1430 | subs->transfer_done = 0; |
1379 | subs->phase = 0; | 1431 | subs->phase = 0; |
1380 | 1432 | ||
@@ -1387,24 +1439,28 @@ static int snd_usb_pcm_prepare(snd_pcm_substream_t *substream) | |||
1387 | 1439 | ||
1388 | static snd_pcm_hardware_t snd_usb_playback = | 1440 | static snd_pcm_hardware_t snd_usb_playback = |
1389 | { | 1441 | { |
1390 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | | 1442 | .info = SNDRV_PCM_INFO_MMAP | |
1391 | SNDRV_PCM_INFO_BLOCK_TRANSFER | | 1443 | SNDRV_PCM_INFO_MMAP_VALID | |
1392 | SNDRV_PCM_INFO_MMAP_VALID), | 1444 | SNDRV_PCM_INFO_BATCH | |
1393 | .buffer_bytes_max = (128*1024), | 1445 | SNDRV_PCM_INFO_INTERLEAVED | |
1446 | SNDRV_PCM_INFO_BLOCK_TRANSFER, | ||
1447 | .buffer_bytes_max = 1024 * 1024, | ||
1394 | .period_bytes_min = 64, | 1448 | .period_bytes_min = 64, |
1395 | .period_bytes_max = (128*1024), | 1449 | .period_bytes_max = 512 * 1024, |
1396 | .periods_min = 2, | 1450 | .periods_min = 2, |
1397 | .periods_max = 1024, | 1451 | .periods_max = 1024, |
1398 | }; | 1452 | }; |
1399 | 1453 | ||
1400 | static snd_pcm_hardware_t snd_usb_capture = | 1454 | static snd_pcm_hardware_t snd_usb_capture = |
1401 | { | 1455 | { |
1402 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | | 1456 | .info = SNDRV_PCM_INFO_MMAP | |
1403 | SNDRV_PCM_INFO_BLOCK_TRANSFER | | 1457 | SNDRV_PCM_INFO_MMAP_VALID | |
1404 | SNDRV_PCM_INFO_MMAP_VALID), | 1458 | SNDRV_PCM_INFO_BATCH | |
1405 | .buffer_bytes_max = (128*1024), | 1459 | SNDRV_PCM_INFO_INTERLEAVED | |
1460 | SNDRV_PCM_INFO_BLOCK_TRANSFER, | ||
1461 | .buffer_bytes_max = 1024 * 1024, | ||
1406 | .period_bytes_min = 64, | 1462 | .period_bytes_min = 64, |
1407 | .period_bytes_max = (128*1024), | 1463 | .period_bytes_max = 512 * 1024, |
1408 | .periods_min = 2, | 1464 | .periods_min = 2, |
1409 | .periods_max = 1024, | 1465 | .periods_max = 1024, |
1410 | }; | 1466 | }; |
@@ -1794,6 +1850,7 @@ static snd_pcm_ops_t snd_usb_playback_ops = { | |||
1794 | .prepare = snd_usb_pcm_prepare, | 1850 | .prepare = snd_usb_pcm_prepare, |
1795 | .trigger = snd_usb_pcm_trigger, | 1851 | .trigger = snd_usb_pcm_trigger, |
1796 | .pointer = snd_usb_pcm_pointer, | 1852 | .pointer = snd_usb_pcm_pointer, |
1853 | .page = snd_pcm_get_vmalloc_page, | ||
1797 | }; | 1854 | }; |
1798 | 1855 | ||
1799 | static snd_pcm_ops_t snd_usb_capture_ops = { | 1856 | static snd_pcm_ops_t snd_usb_capture_ops = { |
@@ -1805,6 +1862,7 @@ static snd_pcm_ops_t snd_usb_capture_ops = { | |||
1805 | .prepare = snd_usb_pcm_prepare, | 1862 | .prepare = snd_usb_pcm_prepare, |
1806 | .trigger = snd_usb_pcm_trigger, | 1863 | .trigger = snd_usb_pcm_trigger, |
1807 | .pointer = snd_usb_pcm_pointer, | 1864 | .pointer = snd_usb_pcm_pointer, |
1865 | .page = snd_pcm_get_vmalloc_page, | ||
1808 | }; | 1866 | }; |
1809 | 1867 | ||
1810 | 1868 | ||
@@ -2021,6 +2079,9 @@ static void init_substream(snd_usb_stream_t *as, int stream, struct audioformat | |||
2021 | 2079 | ||
2022 | INIT_LIST_HEAD(&subs->fmt_list); | 2080 | INIT_LIST_HEAD(&subs->fmt_list); |
2023 | spin_lock_init(&subs->lock); | 2081 | spin_lock_init(&subs->lock); |
2082 | if (stream == SNDRV_PCM_STREAM_PLAYBACK) | ||
2083 | tasklet_init(&subs->start_period_elapsed, start_period_elapsed, | ||
2084 | (unsigned long)subs); | ||
2024 | 2085 | ||
2025 | subs->stream = as; | 2086 | subs->stream = as; |
2026 | subs->direction = stream; | 2087 | subs->direction = stream; |
@@ -2029,10 +2090,6 @@ static void init_substream(snd_usb_stream_t *as, int stream, struct audioformat | |||
2029 | subs->ops = audio_urb_ops[stream]; | 2090 | subs->ops = audio_urb_ops[stream]; |
2030 | else | 2091 | else |
2031 | subs->ops = audio_urb_ops_high_speed[stream]; | 2092 | subs->ops = audio_urb_ops_high_speed[stream]; |
2032 | snd_pcm_lib_preallocate_pages(as->pcm->streams[stream].substream, | ||
2033 | SNDRV_DMA_TYPE_CONTINUOUS, | ||
2034 | snd_dma_continuous_data(GFP_KERNEL), | ||
2035 | 64 * 1024, 128 * 1024); | ||
2036 | snd_pcm_set_ops(as->pcm, stream, | 2093 | snd_pcm_set_ops(as->pcm, stream, |
2037 | stream == SNDRV_PCM_STREAM_PLAYBACK ? | 2094 | stream == SNDRV_PCM_STREAM_PLAYBACK ? |
2038 | &snd_usb_playback_ops : &snd_usb_capture_ops); | 2095 | &snd_usb_playback_ops : &snd_usb_capture_ops); |
@@ -2078,7 +2135,6 @@ static void snd_usb_audio_pcm_free(snd_pcm_t *pcm) | |||
2078 | snd_usb_stream_t *stream = pcm->private_data; | 2135 | snd_usb_stream_t *stream = pcm->private_data; |
2079 | if (stream) { | 2136 | if (stream) { |
2080 | stream->pcm = NULL; | 2137 | stream->pcm = NULL; |
2081 | snd_pcm_lib_preallocate_free_for_all(pcm); | ||
2082 | snd_usb_audio_stream_free(stream); | 2138 | snd_usb_audio_stream_free(stream); |
2083 | } | 2139 | } |
2084 | } | 2140 | } |
@@ -3080,7 +3136,7 @@ static int snd_usb_audio_create(struct usb_device *dev, int idx, | |||
3080 | return -ENOMEM; | 3136 | return -ENOMEM; |
3081 | } | 3137 | } |
3082 | 3138 | ||
3083 | chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); | 3139 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); |
3084 | if (! chip) { | 3140 | if (! chip) { |
3085 | snd_card_free(card); | 3141 | snd_card_free(card); |
3086 | return -ENOMEM; | 3142 | return -ENOMEM; |
diff --git a/sound/usb/usbmidi.c b/sound/usb/usbmidi.c index 5778a9b725ec..f1a2e2c2e02f 100644 --- a/sound/usb/usbmidi.c +++ b/sound/usb/usbmidi.c | |||
@@ -44,6 +44,7 @@ | |||
44 | #include <linux/string.h> | 44 | #include <linux/string.h> |
45 | #include <linux/init.h> | 45 | #include <linux/init.h> |
46 | #include <linux/slab.h> | 46 | #include <linux/slab.h> |
47 | #include <linux/timer.h> | ||
47 | #include <linux/usb.h> | 48 | #include <linux/usb.h> |
48 | #include <sound/core.h> | 49 | #include <sound/core.h> |
49 | #include <sound/minors.h> | 50 | #include <sound/minors.h> |
@@ -56,6 +57,12 @@ | |||
56 | */ | 57 | */ |
57 | /* #define DUMP_PACKETS */ | 58 | /* #define DUMP_PACKETS */ |
58 | 59 | ||
60 | /* | ||
61 | * how long to wait after some USB errors, so that khubd can disconnect() us | ||
62 | * without too many spurious errors | ||
63 | */ | ||
64 | #define ERROR_DELAY_JIFFIES (HZ / 10) | ||
65 | |||
59 | 66 | ||
60 | MODULE_AUTHOR("Clemens Ladisch <clemens@ladisch.de>"); | 67 | MODULE_AUTHOR("Clemens Ladisch <clemens@ladisch.de>"); |
61 | MODULE_DESCRIPTION("USB Audio/MIDI helper module"); | 68 | MODULE_DESCRIPTION("USB Audio/MIDI helper module"); |
@@ -100,6 +107,7 @@ struct snd_usb_midi { | |||
100 | snd_rawmidi_t* rmidi; | 107 | snd_rawmidi_t* rmidi; |
101 | struct usb_protocol_ops* usb_protocol_ops; | 108 | struct usb_protocol_ops* usb_protocol_ops; |
102 | struct list_head list; | 109 | struct list_head list; |
110 | struct timer_list error_timer; | ||
103 | 111 | ||
104 | struct snd_usb_midi_endpoint { | 112 | struct snd_usb_midi_endpoint { |
105 | snd_usb_midi_out_endpoint_t *out; | 113 | snd_usb_midi_out_endpoint_t *out; |
@@ -141,7 +149,8 @@ struct snd_usb_midi_in_endpoint { | |||
141 | struct usbmidi_in_port { | 149 | struct usbmidi_in_port { |
142 | snd_rawmidi_substream_t* substream; | 150 | snd_rawmidi_substream_t* substream; |
143 | } ports[0x10]; | 151 | } ports[0x10]; |
144 | int seen_f5; | 152 | u8 seen_f5; |
153 | u8 error_resubmit; | ||
145 | int current_port; | 154 | int current_port; |
146 | }; | 155 | }; |
147 | 156 | ||
@@ -154,7 +163,7 @@ static const uint8_t snd_usbmidi_cin_length[] = { | |||
154 | /* | 163 | /* |
155 | * Submits the URB, with error handling. | 164 | * Submits the URB, with error handling. |
156 | */ | 165 | */ |
157 | static int snd_usbmidi_submit_urb(struct urb* urb, int flags) | 166 | static int snd_usbmidi_submit_urb(struct urb* urb, gfp_t flags) |
158 | { | 167 | { |
159 | int err = usb_submit_urb(urb, flags); | 168 | int err = usb_submit_urb(urb, flags); |
160 | if (err < 0 && err != -ENODEV) | 169 | if (err < 0 && err != -ENODEV) |
@@ -167,14 +176,22 @@ static int snd_usbmidi_submit_urb(struct urb* urb, int flags) | |||
167 | */ | 176 | */ |
168 | static int snd_usbmidi_urb_error(int status) | 177 | static int snd_usbmidi_urb_error(int status) |
169 | { | 178 | { |
170 | if (status == -ENOENT) | 179 | switch (status) { |
171 | return status; /* killed */ | 180 | /* manually unlinked, or device gone */ |
172 | if (status == -EILSEQ || | 181 | case -ENOENT: |
173 | status == -ECONNRESET || | 182 | case -ECONNRESET: |
174 | status == -ETIMEDOUT) | 183 | case -ESHUTDOWN: |
175 | return -ENODEV; /* device removed/shutdown */ | 184 | case -ENODEV: |
176 | snd_printk(KERN_ERR "urb status %d\n", status); | 185 | return -ENODEV; |
177 | return 0; /* continue */ | 186 | /* errors that might occur during unplugging */ |
187 | case -EPROTO: /* EHCI */ | ||
188 | case -ETIMEDOUT: /* OHCI */ | ||
189 | case -EILSEQ: /* UHCI */ | ||
190 | return -EIO; | ||
191 | default: | ||
192 | snd_printk(KERN_ERR "urb status %d\n", status); | ||
193 | return 0; /* continue */ | ||
194 | } | ||
178 | } | 195 | } |
179 | 196 | ||
180 | /* | 197 | /* |
@@ -218,8 +235,15 @@ static void snd_usbmidi_in_urb_complete(struct urb* urb, struct pt_regs *regs) | |||
218 | ep->umidi->usb_protocol_ops->input(ep, urb->transfer_buffer, | 235 | ep->umidi->usb_protocol_ops->input(ep, urb->transfer_buffer, |
219 | urb->actual_length); | 236 | urb->actual_length); |
220 | } else { | 237 | } else { |
221 | if (snd_usbmidi_urb_error(urb->status) < 0) | 238 | int err = snd_usbmidi_urb_error(urb->status); |
239 | if (err < 0) { | ||
240 | if (err != -ENODEV) { | ||
241 | ep->error_resubmit = 1; | ||
242 | mod_timer(&ep->umidi->error_timer, | ||
243 | jiffies + ERROR_DELAY_JIFFIES); | ||
244 | } | ||
222 | return; | 245 | return; |
246 | } | ||
223 | } | 247 | } |
224 | 248 | ||
225 | if (usb_pipe_needs_resubmit(urb->pipe)) { | 249 | if (usb_pipe_needs_resubmit(urb->pipe)) { |
@@ -236,8 +260,13 @@ static void snd_usbmidi_out_urb_complete(struct urb* urb, struct pt_regs *regs) | |||
236 | ep->urb_active = 0; | 260 | ep->urb_active = 0; |
237 | spin_unlock(&ep->buffer_lock); | 261 | spin_unlock(&ep->buffer_lock); |
238 | if (urb->status < 0) { | 262 | if (urb->status < 0) { |
239 | if (snd_usbmidi_urb_error(urb->status) < 0) | 263 | int err = snd_usbmidi_urb_error(urb->status); |
264 | if (err < 0) { | ||
265 | if (err != -ENODEV) | ||
266 | mod_timer(&ep->umidi->error_timer, | ||
267 | jiffies + ERROR_DELAY_JIFFIES); | ||
240 | return; | 268 | return; |
269 | } | ||
241 | } | 270 | } |
242 | snd_usbmidi_do_output(ep); | 271 | snd_usbmidi_do_output(ep); |
243 | } | 272 | } |
@@ -276,6 +305,24 @@ static void snd_usbmidi_out_tasklet(unsigned long data) | |||
276 | snd_usbmidi_do_output(ep); | 305 | snd_usbmidi_do_output(ep); |
277 | } | 306 | } |
278 | 307 | ||
308 | /* called after transfers had been interrupted due to some USB error */ | ||
309 | static void snd_usbmidi_error_timer(unsigned long data) | ||
310 | { | ||
311 | snd_usb_midi_t *umidi = (snd_usb_midi_t *)data; | ||
312 | int i; | ||
313 | |||
314 | for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i) { | ||
315 | snd_usb_midi_in_endpoint_t *in = umidi->endpoints[i].in; | ||
316 | if (in && in->error_resubmit) { | ||
317 | in->error_resubmit = 0; | ||
318 | in->urb->dev = umidi->chip->dev; | ||
319 | snd_usbmidi_submit_urb(in->urb, GFP_ATOMIC); | ||
320 | } | ||
321 | if (umidi->endpoints[i].out) | ||
322 | snd_usbmidi_do_output(umidi->endpoints[i].out); | ||
323 | } | ||
324 | } | ||
325 | |||
279 | /* helper function to send static data that may not DMA-able */ | 326 | /* helper function to send static data that may not DMA-able */ |
280 | static int send_bulk_static_data(snd_usb_midi_out_endpoint_t* ep, | 327 | static int send_bulk_static_data(snd_usb_midi_out_endpoint_t* ep, |
281 | const void *data, int len) | 328 | const void *data, int len) |
@@ -594,17 +641,20 @@ static void snd_usbmidi_emagic_finish_out(snd_usb_midi_out_endpoint_t* ep) | |||
594 | static void snd_usbmidi_emagic_input(snd_usb_midi_in_endpoint_t* ep, | 641 | static void snd_usbmidi_emagic_input(snd_usb_midi_in_endpoint_t* ep, |
595 | uint8_t* buffer, int buffer_length) | 642 | uint8_t* buffer, int buffer_length) |
596 | { | 643 | { |
597 | /* ignore padding bytes at end of buffer */ | 644 | int i; |
598 | while (buffer_length > 0 && buffer[buffer_length - 1] == 0xff) | 645 | |
599 | --buffer_length; | 646 | /* FF indicates end of valid data */ |
647 | for (i = 0; i < buffer_length; ++i) | ||
648 | if (buffer[i] == 0xff) { | ||
649 | buffer_length = i; | ||
650 | break; | ||
651 | } | ||
600 | 652 | ||
601 | /* handle F5 at end of last buffer */ | 653 | /* handle F5 at end of last buffer */ |
602 | if (ep->seen_f5) | 654 | if (ep->seen_f5) |
603 | goto switch_port; | 655 | goto switch_port; |
604 | 656 | ||
605 | while (buffer_length > 0) { | 657 | while (buffer_length > 0) { |
606 | int i; | ||
607 | |||
608 | /* determine size of data until next F5 */ | 658 | /* determine size of data until next F5 */ |
609 | for (i = 0; i < buffer_length; ++i) | 659 | for (i = 0; i < buffer_length; ++i) |
610 | if (buffer[i] == 0xf5) | 660 | if (buffer[i] == 0xf5) |
@@ -671,6 +721,10 @@ static void snd_usbmidi_emagic_output(snd_usb_midi_out_endpoint_t* ep) | |||
671 | break; | 721 | break; |
672 | } | 722 | } |
673 | } | 723 | } |
724 | if (buf_free < ep->max_transfer && buf_free > 0) { | ||
725 | *buf = 0xff; | ||
726 | --buf_free; | ||
727 | } | ||
674 | ep->urb->transfer_buffer_length = ep->max_transfer - buf_free; | 728 | ep->urb->transfer_buffer_length = ep->max_transfer - buf_free; |
675 | } | 729 | } |
676 | 730 | ||
@@ -765,7 +819,10 @@ static snd_rawmidi_ops_t snd_usbmidi_input_ops = { | |||
765 | static void snd_usbmidi_in_endpoint_delete(snd_usb_midi_in_endpoint_t* ep) | 819 | static void snd_usbmidi_in_endpoint_delete(snd_usb_midi_in_endpoint_t* ep) |
766 | { | 820 | { |
767 | if (ep->urb) { | 821 | if (ep->urb) { |
768 | kfree(ep->urb->transfer_buffer); | 822 | usb_buffer_free(ep->umidi->chip->dev, |
823 | ep->urb->transfer_buffer_length, | ||
824 | ep->urb->transfer_buffer, | ||
825 | ep->urb->transfer_dma); | ||
769 | usb_free_urb(ep->urb); | 826 | usb_free_urb(ep->urb); |
770 | } | 827 | } |
771 | kfree(ep); | 828 | kfree(ep); |
@@ -784,7 +841,7 @@ static int snd_usbmidi_in_endpoint_create(snd_usb_midi_t* umidi, | |||
784 | int length; | 841 | int length; |
785 | 842 | ||
786 | rep->in = NULL; | 843 | rep->in = NULL; |
787 | ep = kcalloc(1, sizeof(*ep), GFP_KERNEL); | 844 | ep = kzalloc(sizeof(*ep), GFP_KERNEL); |
788 | if (!ep) | 845 | if (!ep) |
789 | return -ENOMEM; | 846 | return -ENOMEM; |
790 | ep->umidi = umidi; | 847 | ep->umidi = umidi; |
@@ -799,7 +856,8 @@ static int snd_usbmidi_in_endpoint_create(snd_usb_midi_t* umidi, | |||
799 | else | 856 | else |
800 | pipe = usb_rcvbulkpipe(umidi->chip->dev, ep_info->in_ep); | 857 | pipe = usb_rcvbulkpipe(umidi->chip->dev, ep_info->in_ep); |
801 | length = usb_maxpacket(umidi->chip->dev, pipe, 0); | 858 | length = usb_maxpacket(umidi->chip->dev, pipe, 0); |
802 | buffer = kmalloc(length, GFP_KERNEL); | 859 | buffer = usb_buffer_alloc(umidi->chip->dev, length, GFP_KERNEL, |
860 | &ep->urb->transfer_dma); | ||
803 | if (!buffer) { | 861 | if (!buffer) { |
804 | snd_usbmidi_in_endpoint_delete(ep); | 862 | snd_usbmidi_in_endpoint_delete(ep); |
805 | return -ENOMEM; | 863 | return -ENOMEM; |
@@ -812,6 +870,7 @@ static int snd_usbmidi_in_endpoint_create(snd_usb_midi_t* umidi, | |||
812 | usb_fill_bulk_urb(ep->urb, umidi->chip->dev, pipe, buffer, length, | 870 | usb_fill_bulk_urb(ep->urb, umidi->chip->dev, pipe, buffer, length, |
813 | snd_usb_complete_callback(snd_usbmidi_in_urb_complete), | 871 | snd_usb_complete_callback(snd_usbmidi_in_urb_complete), |
814 | ep); | 872 | ep); |
873 | ep->urb->transfer_flags = URB_NO_TRANSFER_DMA_MAP; | ||
815 | 874 | ||
816 | rep->in = ep; | 875 | rep->in = ep; |
817 | return 0; | 876 | return 0; |
@@ -832,10 +891,10 @@ static unsigned int snd_usbmidi_count_bits(unsigned int x) | |||
832 | */ | 891 | */ |
833 | static void snd_usbmidi_out_endpoint_delete(snd_usb_midi_out_endpoint_t* ep) | 892 | static void snd_usbmidi_out_endpoint_delete(snd_usb_midi_out_endpoint_t* ep) |
834 | { | 893 | { |
835 | if (ep->tasklet.func) | ||
836 | tasklet_kill(&ep->tasklet); | ||
837 | if (ep->urb) { | 894 | if (ep->urb) { |
838 | kfree(ep->urb->transfer_buffer); | 895 | usb_buffer_free(ep->umidi->chip->dev, ep->max_transfer, |
896 | ep->urb->transfer_buffer, | ||
897 | ep->urb->transfer_dma); | ||
839 | usb_free_urb(ep->urb); | 898 | usb_free_urb(ep->urb); |
840 | } | 899 | } |
841 | kfree(ep); | 900 | kfree(ep); |
@@ -854,7 +913,7 @@ static int snd_usbmidi_out_endpoint_create(snd_usb_midi_t* umidi, | |||
854 | void* buffer; | 913 | void* buffer; |
855 | 914 | ||
856 | rep->out = NULL; | 915 | rep->out = NULL; |
857 | ep = kcalloc(1, sizeof(*ep), GFP_KERNEL); | 916 | ep = kzalloc(sizeof(*ep), GFP_KERNEL); |
858 | if (!ep) | 917 | if (!ep) |
859 | return -ENOMEM; | 918 | return -ENOMEM; |
860 | ep->umidi = umidi; | 919 | ep->umidi = umidi; |
@@ -867,7 +926,8 @@ static int snd_usbmidi_out_endpoint_create(snd_usb_midi_t* umidi, | |||
867 | /* we never use interrupt output pipes */ | 926 | /* we never use interrupt output pipes */ |
868 | pipe = usb_sndbulkpipe(umidi->chip->dev, ep_info->out_ep); | 927 | pipe = usb_sndbulkpipe(umidi->chip->dev, ep_info->out_ep); |
869 | ep->max_transfer = usb_maxpacket(umidi->chip->dev, pipe, 1); | 928 | ep->max_transfer = usb_maxpacket(umidi->chip->dev, pipe, 1); |
870 | buffer = kmalloc(ep->max_transfer, GFP_KERNEL); | 929 | buffer = usb_buffer_alloc(umidi->chip->dev, ep->max_transfer, |
930 | GFP_KERNEL, &ep->urb->transfer_dma); | ||
871 | if (!buffer) { | 931 | if (!buffer) { |
872 | snd_usbmidi_out_endpoint_delete(ep); | 932 | snd_usbmidi_out_endpoint_delete(ep); |
873 | return -ENOMEM; | 933 | return -ENOMEM; |
@@ -875,6 +935,7 @@ static int snd_usbmidi_out_endpoint_create(snd_usb_midi_t* umidi, | |||
875 | usb_fill_bulk_urb(ep->urb, umidi->chip->dev, pipe, buffer, | 935 | usb_fill_bulk_urb(ep->urb, umidi->chip->dev, pipe, buffer, |
876 | ep->max_transfer, | 936 | ep->max_transfer, |
877 | snd_usb_complete_callback(snd_usbmidi_out_urb_complete), ep); | 937 | snd_usb_complete_callback(snd_usbmidi_out_urb_complete), ep); |
938 | ep->urb->transfer_flags = URB_NO_TRANSFER_DMA_MAP; | ||
878 | 939 | ||
879 | spin_lock_init(&ep->buffer_lock); | 940 | spin_lock_init(&ep->buffer_lock); |
880 | tasklet_init(&ep->tasklet, snd_usbmidi_out_tasklet, (unsigned long)ep); | 941 | tasklet_init(&ep->tasklet, snd_usbmidi_out_tasklet, (unsigned long)ep); |
@@ -918,8 +979,11 @@ void snd_usbmidi_disconnect(struct list_head* p) | |||
918 | int i; | 979 | int i; |
919 | 980 | ||
920 | umidi = list_entry(p, snd_usb_midi_t, list); | 981 | umidi = list_entry(p, snd_usb_midi_t, list); |
982 | del_timer_sync(&umidi->error_timer); | ||
921 | for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i) { | 983 | for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i) { |
922 | snd_usb_midi_endpoint_t* ep = &umidi->endpoints[i]; | 984 | snd_usb_midi_endpoint_t* ep = &umidi->endpoints[i]; |
985 | if (ep->out) | ||
986 | tasklet_kill(&ep->out->tasklet); | ||
923 | if (ep->out && ep->out->urb) { | 987 | if (ep->out && ep->out->urb) { |
924 | usb_kill_urb(ep->out->urb); | 988 | usb_kill_urb(ep->out->urb); |
925 | if (umidi->usb_protocol_ops->finish_out_endpoint) | 989 | if (umidi->usb_protocol_ops->finish_out_endpoint) |
@@ -1473,13 +1537,16 @@ int snd_usb_create_midi_interface(snd_usb_audio_t* chip, | |||
1473 | int out_ports, in_ports; | 1537 | int out_ports, in_ports; |
1474 | int i, err; | 1538 | int i, err; |
1475 | 1539 | ||
1476 | umidi = kcalloc(1, sizeof(*umidi), GFP_KERNEL); | 1540 | umidi = kzalloc(sizeof(*umidi), GFP_KERNEL); |
1477 | if (!umidi) | 1541 | if (!umidi) |
1478 | return -ENOMEM; | 1542 | return -ENOMEM; |
1479 | umidi->chip = chip; | 1543 | umidi->chip = chip; |
1480 | umidi->iface = iface; | 1544 | umidi->iface = iface; |
1481 | umidi->quirk = quirk; | 1545 | umidi->quirk = quirk; |
1482 | umidi->usb_protocol_ops = &snd_usbmidi_standard_ops; | 1546 | umidi->usb_protocol_ops = &snd_usbmidi_standard_ops; |
1547 | init_timer(&umidi->error_timer); | ||
1548 | umidi->error_timer.function = snd_usbmidi_error_timer; | ||
1549 | umidi->error_timer.data = (unsigned long)umidi; | ||
1483 | 1550 | ||
1484 | /* detect the endpoint(s) to use */ | 1551 | /* detect the endpoint(s) to use */ |
1485 | memset(endpoints, 0, sizeof(endpoints)); | 1552 | memset(endpoints, 0, sizeof(endpoints)); |
diff --git a/sound/usb/usbmixer.c b/sound/usb/usbmixer.c index fa7056f5caaf..c3c08c9cb46e 100644 --- a/sound/usb/usbmixer.c +++ b/sound/usb/usbmixer.c | |||
@@ -824,7 +824,7 @@ static void build_feature_ctl(mixer_build_t *state, unsigned char *desc, | |||
824 | if (check_ignored_ctl(state, unitid, control)) | 824 | if (check_ignored_ctl(state, unitid, control)) |
825 | return; | 825 | return; |
826 | 826 | ||
827 | cval = kcalloc(1, sizeof(*cval), GFP_KERNEL); | 827 | cval = kzalloc(sizeof(*cval), GFP_KERNEL); |
828 | if (! cval) { | 828 | if (! cval) { |
829 | snd_printk(KERN_ERR "cannot malloc kcontrol\n"); | 829 | snd_printk(KERN_ERR "cannot malloc kcontrol\n"); |
830 | return; | 830 | return; |
@@ -997,7 +997,7 @@ static void build_mixer_unit_ctl(mixer_build_t *state, unsigned char *desc, | |||
997 | if (check_ignored_ctl(state, unitid, 0)) | 997 | if (check_ignored_ctl(state, unitid, 0)) |
998 | return; | 998 | return; |
999 | 999 | ||
1000 | cval = kcalloc(1, sizeof(*cval), GFP_KERNEL); | 1000 | cval = kzalloc(sizeof(*cval), GFP_KERNEL); |
1001 | if (! cval) | 1001 | if (! cval) |
1002 | return; | 1002 | return; |
1003 | 1003 | ||
@@ -1244,7 +1244,7 @@ static int build_audio_procunit(mixer_build_t *state, int unitid, unsigned char | |||
1244 | continue; | 1244 | continue; |
1245 | if (check_ignored_ctl(state, unitid, valinfo->control)) | 1245 | if (check_ignored_ctl(state, unitid, valinfo->control)) |
1246 | continue; | 1246 | continue; |
1247 | cval = kcalloc(1, sizeof(*cval), GFP_KERNEL); | 1247 | cval = kzalloc(sizeof(*cval), GFP_KERNEL); |
1248 | if (! cval) { | 1248 | if (! cval) { |
1249 | snd_printk(KERN_ERR "cannot malloc kcontrol\n"); | 1249 | snd_printk(KERN_ERR "cannot malloc kcontrol\n"); |
1250 | return -ENOMEM; | 1250 | return -ENOMEM; |
@@ -1430,7 +1430,7 @@ static int parse_audio_selector_unit(mixer_build_t *state, int unitid, unsigned | |||
1430 | if (check_ignored_ctl(state, unitid, 0)) | 1430 | if (check_ignored_ctl(state, unitid, 0)) |
1431 | return 0; | 1431 | return 0; |
1432 | 1432 | ||
1433 | cval = kcalloc(1, sizeof(*cval), GFP_KERNEL); | 1433 | cval = kzalloc(sizeof(*cval), GFP_KERNEL); |
1434 | if (! cval) { | 1434 | if (! cval) { |
1435 | snd_printk(KERN_ERR "cannot malloc kcontrol\n"); | 1435 | snd_printk(KERN_ERR "cannot malloc kcontrol\n"); |
1436 | return -ENOMEM; | 1436 | return -ENOMEM; |
@@ -1945,7 +1945,7 @@ int snd_usb_create_mixer(snd_usb_audio_t *chip, int ctrlif) | |||
1945 | 1945 | ||
1946 | strcpy(chip->card->mixername, "USB Mixer"); | 1946 | strcpy(chip->card->mixername, "USB Mixer"); |
1947 | 1947 | ||
1948 | mixer = kcalloc(1, sizeof(*mixer), GFP_KERNEL); | 1948 | mixer = kzalloc(sizeof(*mixer), GFP_KERNEL); |
1949 | if (!mixer) | 1949 | if (!mixer) |
1950 | return -ENOMEM; | 1950 | return -ENOMEM; |
1951 | mixer->chip = chip; | 1951 | mixer->chip = chip; |
diff --git a/sound/usb/usbmixer_maps.c b/sound/usb/usbmixer_maps.c index f05500b05ec0..c1264434e50a 100644 --- a/sound/usb/usbmixer_maps.c +++ b/sound/usb/usbmixer_maps.c | |||
@@ -238,6 +238,16 @@ static struct usbmix_ctl_map usbmix_ctl_maps[] = { | |||
238 | .selector_map = audigy2nx_selectors, | 238 | .selector_map = audigy2nx_selectors, |
239 | }, | 239 | }, |
240 | { | 240 | { |
241 | /* Hercules DJ Console (Windows Edition) */ | ||
242 | .id = USB_ID(0x06f8, 0xb000), | ||
243 | .ignore_ctl_error = 1, | ||
244 | }, | ||
245 | { | ||
246 | /* Hercules DJ Console (Macintosh Edition) */ | ||
247 | .id = USB_ID(0x06f8, 0xd002), | ||
248 | .ignore_ctl_error = 1, | ||
249 | }, | ||
250 | { | ||
241 | .id = USB_ID(0x08bb, 0x2702), | 251 | .id = USB_ID(0x08bb, 0x2702), |
242 | .map = linex_map, | 252 | .map = linex_map, |
243 | .ignore_ctl_error = 1, | 253 | .ignore_ctl_error = 1, |
diff --git a/sound/usb/usbquirks.h b/sound/usb/usbquirks.h index f74e652a1e51..948759da6563 100644 --- a/sound/usb/usbquirks.h +++ b/sound/usb/usbquirks.h | |||
@@ -117,6 +117,10 @@ YAMAHA_DEVICE(0x103a, NULL), | |||
117 | YAMAHA_DEVICE(0x103b, NULL), | 117 | YAMAHA_DEVICE(0x103b, NULL), |
118 | YAMAHA_DEVICE(0x103c, NULL), | 118 | YAMAHA_DEVICE(0x103c, NULL), |
119 | YAMAHA_DEVICE(0x103d, NULL), | 119 | YAMAHA_DEVICE(0x103d, NULL), |
120 | YAMAHA_DEVICE(0x103e, NULL), | ||
121 | YAMAHA_DEVICE(0x103f, NULL), | ||
122 | YAMAHA_DEVICE(0x1040, NULL), | ||
123 | YAMAHA_DEVICE(0x1041, NULL), | ||
120 | YAMAHA_DEVICE(0x2000, "DGP-7"), | 124 | YAMAHA_DEVICE(0x2000, "DGP-7"), |
121 | YAMAHA_DEVICE(0x2001, "DGP-5"), | 125 | YAMAHA_DEVICE(0x2001, "DGP-5"), |
122 | YAMAHA_DEVICE(0x2002, NULL), | 126 | YAMAHA_DEVICE(0x2002, NULL), |
@@ -1010,6 +1014,40 @@ YAMAHA_DEVICE(0x7010, "UB99"), | |||
1010 | } | 1014 | } |
1011 | } | 1015 | } |
1012 | }, | 1016 | }, |
1017 | { | ||
1018 | USB_DEVICE_VENDOR_SPEC(0x0582, 0x007a), | ||
1019 | .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { | ||
1020 | .vendor_name = "Roland", | ||
1021 | /* RD-700SX, RD-300SX */ | ||
1022 | .ifnum = 0, | ||
1023 | .type = QUIRK_MIDI_FIXED_ENDPOINT, | ||
1024 | .data = & (const snd_usb_midi_endpoint_info_t) { | ||
1025 | .out_cables = 0x0003, | ||
1026 | .in_cables = 0x0003 | ||
1027 | } | ||
1028 | } | ||
1029 | }, | ||
1030 | |||
1031 | /* Guillemot devices */ | ||
1032 | { | ||
1033 | /* | ||
1034 | * This is for the "Windows Edition" where the external MIDI ports are | ||
1035 | * the only MIDI ports; the control data is reported through HID | ||
1036 | * interfaces. The "Macintosh Edition" has ID 0xd002 and uses standard | ||
1037 | * compliant USB MIDI ports for external MIDI and controls. | ||
1038 | */ | ||
1039 | USB_DEVICE_VENDOR_SPEC(0x06f8, 0xb000), | ||
1040 | .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { | ||
1041 | .vendor_name = "Hercules", | ||
1042 | .product_name = "DJ Console (WE)", | ||
1043 | .ifnum = 4, | ||
1044 | .type = QUIRK_MIDI_FIXED_ENDPOINT, | ||
1045 | .data = & (const snd_usb_midi_endpoint_info_t) { | ||
1046 | .out_cables = 0x0001, | ||
1047 | .in_cables = 0x0001 | ||
1048 | } | ||
1049 | } | ||
1050 | }, | ||
1013 | 1051 | ||
1014 | /* Midiman/M-Audio devices */ | 1052 | /* Midiman/M-Audio devices */ |
1015 | { | 1053 | { |
@@ -1339,10 +1377,20 @@ YAMAHA_DEVICE(0x7010, "UB99"), | |||
1339 | } | 1377 | } |
1340 | }, | 1378 | }, |
1341 | 1379 | ||
1380 | /* TerraTec devices */ | ||
1381 | { | ||
1382 | USB_DEVICE_VENDOR_SPEC(0x0ccd, 0x0012), | ||
1383 | .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { | ||
1384 | .vendor_name = "TerraTec", | ||
1385 | .product_name = "PHASE 26", | ||
1386 | .ifnum = 3, | ||
1387 | .type = QUIRK_MIDI_STANDARD_INTERFACE | ||
1388 | } | ||
1389 | }, | ||
1342 | { | 1390 | { |
1343 | USB_DEVICE_VENDOR_SPEC(0x0ccd, 0x0013), | 1391 | USB_DEVICE_VENDOR_SPEC(0x0ccd, 0x0013), |
1344 | .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { | 1392 | .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { |
1345 | .vendor_name = "Terratec", | 1393 | .vendor_name = "TerraTec", |
1346 | .product_name = "PHASE 26", | 1394 | .product_name = "PHASE 26", |
1347 | .ifnum = 3, | 1395 | .ifnum = 3, |
1348 | .type = QUIRK_MIDI_STANDARD_INTERFACE | 1396 | .type = QUIRK_MIDI_STANDARD_INTERFACE |
diff --git a/sound/usb/usx2y/usbusx2yaudio.c b/sound/usb/usx2y/usbusx2yaudio.c index 62dfd28b3b07..0f09e0de52dd 100644 --- a/sound/usb/usx2y/usbusx2yaudio.c +++ b/sound/usb/usx2y/usbusx2yaudio.c | |||
@@ -957,7 +957,7 @@ static int usX2Y_audio_stream_new(snd_card_t *card, int playback_endpoint, int c | |||
957 | 957 | ||
958 | for (i = playback_endpoint ? SNDRV_PCM_STREAM_PLAYBACK : SNDRV_PCM_STREAM_CAPTURE; | 958 | for (i = playback_endpoint ? SNDRV_PCM_STREAM_PLAYBACK : SNDRV_PCM_STREAM_CAPTURE; |
959 | i <= SNDRV_PCM_STREAM_CAPTURE; ++i) { | 959 | i <= SNDRV_PCM_STREAM_CAPTURE; ++i) { |
960 | usX2Y_substream[i] = kcalloc(1, sizeof(snd_usX2Y_substream_t), GFP_KERNEL); | 960 | usX2Y_substream[i] = kzalloc(sizeof(snd_usX2Y_substream_t), GFP_KERNEL); |
961 | if (NULL == usX2Y_substream[i]) { | 961 | if (NULL == usX2Y_substream[i]) { |
962 | snd_printk(KERN_ERR "cannot malloc\n"); | 962 | snd_printk(KERN_ERR "cannot malloc\n"); |
963 | return -ENOMEM; | 963 | return -ENOMEM; |
diff --git a/sound/usb/usx2y/usx2yhwdeppcm.c b/sound/usb/usx2y/usx2yhwdeppcm.c index ef28061287f2..d0199c4e5551 100644 --- a/sound/usb/usx2y/usx2yhwdeppcm.c +++ b/sound/usb/usx2y/usx2yhwdeppcm.c | |||
@@ -624,7 +624,7 @@ static int usX2Y_pcms_lock_check(snd_card_t *card) | |||
624 | for (s = 0; s < 2; ++s) { | 624 | for (s = 0; s < 2; ++s) { |
625 | snd_pcm_substream_t *substream; | 625 | snd_pcm_substream_t *substream; |
626 | substream = pcm->streams[s].substream; | 626 | substream = pcm->streams[s].substream; |
627 | if (substream && substream->open_flag) | 627 | if (substream && substream->ffile != NULL) |
628 | err = -EBUSY; | 628 | err = -EBUSY; |
629 | } | 629 | } |
630 | } | 630 | } |