diff options
Diffstat (limited to 'sound')
42 files changed, 623 insertions, 455 deletions
diff --git a/sound/aoa/soundbus/soundbus.h b/sound/aoa/soundbus/soundbus.h index 622cd37a0118..a0f223c13f66 100644 --- a/sound/aoa/soundbus/soundbus.h +++ b/sound/aoa/soundbus/soundbus.h | |||
@@ -8,7 +8,7 @@ | |||
8 | #ifndef __SOUNDBUS_H | 8 | #ifndef __SOUNDBUS_H |
9 | #define __SOUNDBUS_H | 9 | #define __SOUNDBUS_H |
10 | 10 | ||
11 | #include <asm/of_device.h> | 11 | #include <linux/of_device.h> |
12 | #include <sound/pcm.h> | 12 | #include <sound/pcm.h> |
13 | #include <linux/list.h> | 13 | #include <linux/list.h> |
14 | 14 | ||
diff --git a/sound/arm/pxa2xx-ac97.c b/sound/arm/pxa2xx-ac97.c index cba71d867542..c2635beb4c88 100644 --- a/sound/arm/pxa2xx-ac97.c +++ b/sound/arm/pxa2xx-ac97.c | |||
@@ -44,7 +44,7 @@ static struct snd_ac97_bus_ops pxa2xx_ac97_ops = { | |||
44 | static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_out = { | 44 | static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_out = { |
45 | .name = "AC97 PCM out", | 45 | .name = "AC97 PCM out", |
46 | .dev_addr = __PREG(PCDR), | 46 | .dev_addr = __PREG(PCDR), |
47 | .drcmr = &DRCMRTXPCDR, | 47 | .drcmr = &DRCMR(12), |
48 | .dcmd = DCMD_INCSRCADDR | DCMD_FLOWTRG | | 48 | .dcmd = DCMD_INCSRCADDR | DCMD_FLOWTRG | |
49 | DCMD_BURST32 | DCMD_WIDTH4, | 49 | DCMD_BURST32 | DCMD_WIDTH4, |
50 | }; | 50 | }; |
@@ -52,7 +52,7 @@ static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_out = { | |||
52 | static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_in = { | 52 | static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_in = { |
53 | .name = "AC97 PCM in", | 53 | .name = "AC97 PCM in", |
54 | .dev_addr = __PREG(PCDR), | 54 | .dev_addr = __PREG(PCDR), |
55 | .drcmr = &DRCMRRXPCDR, | 55 | .drcmr = &DRCMR(11), |
56 | .dcmd = DCMD_INCTRGADDR | DCMD_FLOWSRC | | 56 | .dcmd = DCMD_INCTRGADDR | DCMD_FLOWSRC | |
57 | DCMD_BURST32 | DCMD_WIDTH4, | 57 | DCMD_BURST32 | DCMD_WIDTH4, |
58 | }; | 58 | }; |
diff --git a/sound/core/init.c b/sound/core/init.c index 8af467df9245..ef2352c2e451 100644 --- a/sound/core/init.c +++ b/sound/core/init.c | |||
@@ -549,9 +549,9 @@ int snd_card_register(struct snd_card *card) | |||
549 | return -EINVAL; | 549 | return -EINVAL; |
550 | #ifndef CONFIG_SYSFS_DEPRECATED | 550 | #ifndef CONFIG_SYSFS_DEPRECATED |
551 | if (!card->card_dev) { | 551 | if (!card->card_dev) { |
552 | card->card_dev = device_create_drvdata(sound_class, card->dev, | 552 | card->card_dev = device_create(sound_class, card->dev, |
553 | MKDEV(0, 0), NULL, | 553 | MKDEV(0, 0), NULL, |
554 | "card%i", card->number); | 554 | "card%i", card->number); |
555 | if (IS_ERR(card->card_dev)) | 555 | if (IS_ERR(card->card_dev)) |
556 | card->card_dev = NULL; | 556 | card->card_dev = NULL; |
557 | } | 557 | } |
diff --git a/sound/core/memalloc.c b/sound/core/memalloc.c index a7b46ec72f32..1b3534d67686 100644 --- a/sound/core/memalloc.c +++ b/sound/core/memalloc.c | |||
@@ -33,9 +33,6 @@ | |||
33 | #include <linux/moduleparam.h> | 33 | #include <linux/moduleparam.h> |
34 | #include <linux/mutex.h> | 34 | #include <linux/mutex.h> |
35 | #include <sound/memalloc.h> | 35 | #include <sound/memalloc.h> |
36 | #ifdef CONFIG_SBUS | ||
37 | #include <asm/sbus.h> | ||
38 | #endif | ||
39 | 36 | ||
40 | 37 | ||
41 | MODULE_AUTHOR("Takashi Iwai <tiwai@suse.de>, Jaroslav Kysela <perex@perex.cz>"); | 38 | MODULE_AUTHOR("Takashi Iwai <tiwai@suse.de>, Jaroslav Kysela <perex@perex.cz>"); |
@@ -162,39 +159,6 @@ static void snd_free_dev_pages(struct device *dev, size_t size, void *ptr, | |||
162 | } | 159 | } |
163 | #endif /* CONFIG_HAS_DMA */ | 160 | #endif /* CONFIG_HAS_DMA */ |
164 | 161 | ||
165 | #ifdef CONFIG_SBUS | ||
166 | |||
167 | static void *snd_malloc_sbus_pages(struct device *dev, size_t size, | ||
168 | dma_addr_t *dma_addr) | ||
169 | { | ||
170 | struct sbus_dev *sdev = (struct sbus_dev *)dev; | ||
171 | int pg; | ||
172 | void *res; | ||
173 | |||
174 | if (WARN_ON(!dma_addr)) | ||
175 | return NULL; | ||
176 | pg = get_order(size); | ||
177 | res = sbus_alloc_consistent(sdev, PAGE_SIZE * (1 << pg), dma_addr); | ||
178 | if (res != NULL) | ||
179 | inc_snd_pages(pg); | ||
180 | return res; | ||
181 | } | ||
182 | |||
183 | static void snd_free_sbus_pages(struct device *dev, size_t size, | ||
184 | void *ptr, dma_addr_t dma_addr) | ||
185 | { | ||
186 | struct sbus_dev *sdev = (struct sbus_dev *)dev; | ||
187 | int pg; | ||
188 | |||
189 | if (ptr == NULL) | ||
190 | return; | ||
191 | pg = get_order(size); | ||
192 | dec_snd_pages(pg); | ||
193 | sbus_free_consistent(sdev, PAGE_SIZE * (1 << pg), ptr, dma_addr); | ||
194 | } | ||
195 | |||
196 | #endif /* CONFIG_SBUS */ | ||
197 | |||
198 | /* | 162 | /* |
199 | * | 163 | * |
200 | * ALSA generic memory management | 164 | * ALSA generic memory management |
@@ -231,11 +195,6 @@ int snd_dma_alloc_pages(int type, struct device *device, size_t size, | |||
231 | dmab->area = snd_malloc_pages(size, (unsigned long)device); | 195 | dmab->area = snd_malloc_pages(size, (unsigned long)device); |
232 | dmab->addr = 0; | 196 | dmab->addr = 0; |
233 | break; | 197 | break; |
234 | #ifdef CONFIG_SBUS | ||
235 | case SNDRV_DMA_TYPE_SBUS: | ||
236 | dmab->area = snd_malloc_sbus_pages(device, size, &dmab->addr); | ||
237 | break; | ||
238 | #endif | ||
239 | #ifdef CONFIG_HAS_DMA | 198 | #ifdef CONFIG_HAS_DMA |
240 | case SNDRV_DMA_TYPE_DEV: | 199 | case SNDRV_DMA_TYPE_DEV: |
241 | dmab->area = snd_malloc_dev_pages(device, size, &dmab->addr); | 200 | dmab->area = snd_malloc_dev_pages(device, size, &dmab->addr); |
@@ -306,11 +265,6 @@ void snd_dma_free_pages(struct snd_dma_buffer *dmab) | |||
306 | case SNDRV_DMA_TYPE_CONTINUOUS: | 265 | case SNDRV_DMA_TYPE_CONTINUOUS: |
307 | snd_free_pages(dmab->area, dmab->bytes); | 266 | snd_free_pages(dmab->area, dmab->bytes); |
308 | break; | 267 | break; |
309 | #ifdef CONFIG_SBUS | ||
310 | case SNDRV_DMA_TYPE_SBUS: | ||
311 | snd_free_sbus_pages(dmab->dev.dev, dmab->bytes, dmab->area, dmab->addr); | ||
312 | break; | ||
313 | #endif | ||
314 | #ifdef CONFIG_HAS_DMA | 268 | #ifdef CONFIG_HAS_DMA |
315 | case SNDRV_DMA_TYPE_DEV: | 269 | case SNDRV_DMA_TYPE_DEV: |
316 | snd_free_dev_pages(dmab->dev.dev, dmab->bytes, dmab->area, dmab->addr); | 270 | snd_free_dev_pages(dmab->dev.dev, dmab->bytes, dmab->area, dmab->addr); |
@@ -419,7 +373,7 @@ static int snd_mem_proc_read(struct seq_file *seq, void *offset) | |||
419 | long pages = snd_allocated_pages >> (PAGE_SHIFT-12); | 373 | long pages = snd_allocated_pages >> (PAGE_SHIFT-12); |
420 | struct snd_mem_list *mem; | 374 | struct snd_mem_list *mem; |
421 | int devno; | 375 | int devno; |
422 | static char *types[] = { "UNKNOWN", "CONT", "DEV", "DEV-SG", "SBUS" }; | 376 | static char *types[] = { "UNKNOWN", "CONT", "DEV", "DEV-SG" }; |
423 | 377 | ||
424 | mutex_lock(&list_mutex); | 378 | mutex_lock(&list_mutex); |
425 | seq_printf(seq, "pages : %li bytes (%li pages per %likB)\n", | 379 | seq_printf(seq, "pages : %li bytes (%li pages per %likB)\n", |
diff --git a/sound/core/sound.c b/sound/core/sound.c index c0685e2f0afa..44a69bb8d4f0 100644 --- a/sound/core/sound.c +++ b/sound/core/sound.c | |||
@@ -274,9 +274,8 @@ int snd_register_device_for_dev(int type, struct snd_card *card, int dev, | |||
274 | return minor; | 274 | return minor; |
275 | } | 275 | } |
276 | snd_minors[minor] = preg; | 276 | snd_minors[minor] = preg; |
277 | preg->dev = device_create_drvdata(sound_class, device, | 277 | preg->dev = device_create(sound_class, device, MKDEV(major, minor), |
278 | MKDEV(major, minor), | 278 | private_data, "%s", name); |
279 | private_data, "%s", name); | ||
280 | if (IS_ERR(preg->dev)) { | 279 | if (IS_ERR(preg->dev)) { |
281 | snd_minors[minor] = NULL; | 280 | snd_minors[minor] = NULL; |
282 | mutex_unlock(&sound_mutex); | 281 | mutex_unlock(&sound_mutex); |
diff --git a/sound/i2c/other/tea575x-tuner.c b/sound/i2c/other/tea575x-tuner.c index 83e90057270e..c13a178383ba 100644 --- a/sound/i2c/other/tea575x-tuner.c +++ b/sound/i2c/other/tea575x-tuner.c | |||
@@ -87,8 +87,7 @@ static void snd_tea575x_set_freq(struct snd_tea575x *tea) | |||
87 | static int snd_tea575x_ioctl(struct inode *inode, struct file *file, | 87 | static int snd_tea575x_ioctl(struct inode *inode, struct file *file, |
88 | unsigned int cmd, unsigned long data) | 88 | unsigned int cmd, unsigned long data) |
89 | { | 89 | { |
90 | struct video_device *dev = video_devdata(file); | 90 | struct snd_tea575x *tea = video_drvdata(file); |
91 | struct snd_tea575x *tea = video_get_drvdata(dev); | ||
92 | void __user *arg = (void __user *)data; | 91 | void __user *arg = (void __user *)data; |
93 | 92 | ||
94 | switch(cmd) { | 93 | switch(cmd) { |
@@ -175,6 +174,21 @@ static void snd_tea575x_release(struct video_device *vfd) | |||
175 | { | 174 | { |
176 | } | 175 | } |
177 | 176 | ||
177 | static int snd_tea575x_exclusive_open(struct inode *inode, struct file *file) | ||
178 | { | ||
179 | struct snd_tea575x *tea = video_drvdata(file); | ||
180 | |||
181 | return test_and_set_bit(0, &tea->in_use) ? -EBUSY : 0; | ||
182 | } | ||
183 | |||
184 | static int snd_tea575x_exclusive_release(struct inode *inode, struct file *file) | ||
185 | { | ||
186 | struct snd_tea575x *tea = video_drvdata(file); | ||
187 | |||
188 | clear_bit(0, &tea->in_use); | ||
189 | return 0; | ||
190 | } | ||
191 | |||
178 | /* | 192 | /* |
179 | * initialize all the tea575x chips | 193 | * initialize all the tea575x chips |
180 | */ | 194 | */ |
@@ -193,9 +207,10 @@ void snd_tea575x_init(struct snd_tea575x *tea) | |||
193 | tea->vd.release = snd_tea575x_release; | 207 | tea->vd.release = snd_tea575x_release; |
194 | video_set_drvdata(&tea->vd, tea); | 208 | video_set_drvdata(&tea->vd, tea); |
195 | tea->vd.fops = &tea->fops; | 209 | tea->vd.fops = &tea->fops; |
210 | tea->in_use = 0; | ||
196 | tea->fops.owner = tea->card->module; | 211 | tea->fops.owner = tea->card->module; |
197 | tea->fops.open = video_exclusive_open; | 212 | tea->fops.open = snd_tea575x_exclusive_open; |
198 | tea->fops.release = video_exclusive_release; | 213 | tea->fops.release = snd_tea575x_exclusive_release; |
199 | tea->fops.ioctl = snd_tea575x_ioctl; | 214 | tea->fops.ioctl = snd_tea575x_ioctl; |
200 | if (video_register_device(&tea->vd, VFL_TYPE_RADIO, tea->dev_nr - 1) < 0) { | 215 | if (video_register_device(&tea->vd, VFL_TYPE_RADIO, tea->dev_nr - 1) < 0) { |
201 | snd_printk(KERN_ERR "unable to register tea575x tuner\n"); | 216 | snd_printk(KERN_ERR "unable to register tea575x tuner\n"); |
diff --git a/sound/oss/sh_dac_audio.c b/sound/oss/sh_dac_audio.c index b493660deb36..e5d423994918 100644 --- a/sound/oss/sh_dac_audio.c +++ b/sound/oss/sh_dac_audio.c | |||
@@ -26,7 +26,7 @@ | |||
26 | #include <asm/cpu/dac.h> | 26 | #include <asm/cpu/dac.h> |
27 | #include <asm/cpu/timer.h> | 27 | #include <asm/cpu/timer.h> |
28 | #include <asm/machvec.h> | 28 | #include <asm/machvec.h> |
29 | #include <asm/hp6xx.h> | 29 | #include <mach/hp6xx.h> |
30 | #include <asm/hd64461.h> | 30 | #include <asm/hd64461.h> |
31 | 31 | ||
32 | #define MODNAME "sh_dac_audio" | 32 | #define MODNAME "sh_dac_audio" |
diff --git a/sound/oss/soundcard.c b/sound/oss/soundcard.c index 7d89c081a086..61aaedae6b7e 100644 --- a/sound/oss/soundcard.c +++ b/sound/oss/soundcard.c | |||
@@ -560,19 +560,18 @@ static int __init oss_init(void) | |||
560 | sound_dmap_flag = (dmabuf > 0 ? 1 : 0); | 560 | sound_dmap_flag = (dmabuf > 0 ? 1 : 0); |
561 | 561 | ||
562 | for (i = 0; i < ARRAY_SIZE(dev_list); i++) { | 562 | for (i = 0; i < ARRAY_SIZE(dev_list); i++) { |
563 | device_create_drvdata(sound_class, NULL, | 563 | device_create(sound_class, NULL, |
564 | MKDEV(SOUND_MAJOR, dev_list[i].minor), | 564 | MKDEV(SOUND_MAJOR, dev_list[i].minor), NULL, |
565 | NULL, "%s", dev_list[i].name); | 565 | "%s", dev_list[i].name); |
566 | 566 | ||
567 | if (!dev_list[i].num) | 567 | if (!dev_list[i].num) |
568 | continue; | 568 | continue; |
569 | 569 | ||
570 | for (j = 1; j < *dev_list[i].num; j++) | 570 | for (j = 1; j < *dev_list[i].num; j++) |
571 | device_create_drvdata(sound_class, NULL, | 571 | device_create(sound_class, NULL, |
572 | MKDEV(SOUND_MAJOR, | 572 | MKDEV(SOUND_MAJOR, |
573 | dev_list[i].minor + (j*0x10)), | 573 | dev_list[i].minor + (j*0x10)), |
574 | NULL, | 574 | NULL, "%s%d", dev_list[i].name, j); |
575 | "%s%d", dev_list[i].name, j); | ||
576 | } | 575 | } |
577 | 576 | ||
578 | if (sound_nblocks >= 1024) | 577 | if (sound_nblocks >= 1024) |
diff --git a/sound/pci/ad1889.c b/sound/pci/ad1889.c index 92f3a976ef2e..a7f38e63303f 100644 --- a/sound/pci/ad1889.c +++ b/sound/pci/ad1889.c | |||
@@ -932,7 +932,7 @@ snd_ad1889_create(struct snd_card *card, | |||
932 | goto free_and_ret; | 932 | goto free_and_ret; |
933 | 933 | ||
934 | chip->bar = pci_resource_start(pci, 0); | 934 | chip->bar = pci_resource_start(pci, 0); |
935 | chip->iobase = ioremap_nocache(chip->bar, pci_resource_len(pci, 0)); | 935 | chip->iobase = pci_ioremap_bar(pci, 0); |
936 | if (chip->iobase == NULL) { | 936 | if (chip->iobase == NULL) { |
937 | printk(KERN_ERR PFX "unable to reserve region.\n"); | 937 | printk(KERN_ERR PFX "unable to reserve region.\n"); |
938 | err = -EBUSY; | 938 | err = -EBUSY; |
diff --git a/sound/pci/atiixp.c b/sound/pci/atiixp.c index 085a52b8c807..226fe8237d31 100644 --- a/sound/pci/atiixp.c +++ b/sound/pci/atiixp.c | |||
@@ -1609,7 +1609,7 @@ static int __devinit snd_atiixp_create(struct snd_card *card, | |||
1609 | return err; | 1609 | return err; |
1610 | } | 1610 | } |
1611 | chip->addr = pci_resource_start(pci, 0); | 1611 | chip->addr = pci_resource_start(pci, 0); |
1612 | chip->remap_addr = ioremap_nocache(chip->addr, pci_resource_len(pci, 0)); | 1612 | chip->remap_addr = pci_ioremap_bar(pci, 0); |
1613 | if (chip->remap_addr == NULL) { | 1613 | if (chip->remap_addr == NULL) { |
1614 | snd_printk(KERN_ERR "AC'97 space ioremap problem\n"); | 1614 | snd_printk(KERN_ERR "AC'97 space ioremap problem\n"); |
1615 | snd_atiixp_free(chip); | 1615 | snd_atiixp_free(chip); |
diff --git a/sound/pci/atiixp_modem.c b/sound/pci/atiixp_modem.c index 2f106306c7fe..0e6e5cc1c501 100644 --- a/sound/pci/atiixp_modem.c +++ b/sound/pci/atiixp_modem.c | |||
@@ -1252,7 +1252,7 @@ static int __devinit snd_atiixp_create(struct snd_card *card, | |||
1252 | return err; | 1252 | return err; |
1253 | } | 1253 | } |
1254 | chip->addr = pci_resource_start(pci, 0); | 1254 | chip->addr = pci_resource_start(pci, 0); |
1255 | chip->remap_addr = ioremap_nocache(chip->addr, pci_resource_len(pci, 0)); | 1255 | chip->remap_addr = pci_ioremap_bar(pci, 0); |
1256 | if (chip->remap_addr == NULL) { | 1256 | if (chip->remap_addr == NULL) { |
1257 | snd_printk(KERN_ERR "AC'97 space ioremap problem\n"); | 1257 | snd_printk(KERN_ERR "AC'97 space ioremap problem\n"); |
1258 | snd_atiixp_free(chip); | 1258 | snd_atiixp_free(chip); |
diff --git a/sound/pci/au88x0/au88x0.c b/sound/pci/au88x0/au88x0.c index 68368e490074..a36d4d1fd419 100644 --- a/sound/pci/au88x0/au88x0.c +++ b/sound/pci/au88x0/au88x0.c | |||
@@ -180,8 +180,7 @@ snd_vortex_create(struct snd_card *card, struct pci_dev *pci, vortex_t ** rchip) | |||
180 | if ((err = pci_request_regions(pci, CARD_NAME_SHORT)) != 0) | 180 | if ((err = pci_request_regions(pci, CARD_NAME_SHORT)) != 0) |
181 | goto regions_out; | 181 | goto regions_out; |
182 | 182 | ||
183 | chip->mmio = ioremap_nocache(pci_resource_start(pci, 0), | 183 | chip->mmio = pci_ioremap_bar(pci, 0); |
184 | pci_resource_len(pci, 0)); | ||
185 | if (!chip->mmio) { | 184 | if (!chip->mmio) { |
186 | printk(KERN_ERR "MMIO area remap failed.\n"); | 185 | printk(KERN_ERR "MMIO area remap failed.\n"); |
187 | err = -ENOMEM; | 186 | err = -ENOMEM; |
diff --git a/sound/pci/bt87x.c b/sound/pci/bt87x.c index 3aa8d973540a..1aa1c0402540 100644 --- a/sound/pci/bt87x.c +++ b/sound/pci/bt87x.c | |||
@@ -749,8 +749,7 @@ static int __devinit snd_bt87x_create(struct snd_card *card, | |||
749 | pci_disable_device(pci); | 749 | pci_disable_device(pci); |
750 | return err; | 750 | return err; |
751 | } | 751 | } |
752 | chip->mmio = ioremap_nocache(pci_resource_start(pci, 0), | 752 | chip->mmio = pci_ioremap_bar(pci, 0); |
753 | pci_resource_len(pci, 0)); | ||
754 | if (!chip->mmio) { | 753 | if (!chip->mmio) { |
755 | snd_printk(KERN_ERR "cannot remap io memory\n"); | 754 | snd_printk(KERN_ERR "cannot remap io memory\n"); |
756 | err = -ENOMEM; | 755 | err = -ENOMEM; |
diff --git a/sound/pci/cs4281.c b/sound/pci/cs4281.c index ef9308f7c45b..192e7842e181 100644 --- a/sound/pci/cs4281.c +++ b/sound/pci/cs4281.c | |||
@@ -1382,8 +1382,8 @@ static int __devinit snd_cs4281_create(struct snd_card *card, | |||
1382 | chip->ba0_addr = pci_resource_start(pci, 0); | 1382 | chip->ba0_addr = pci_resource_start(pci, 0); |
1383 | chip->ba1_addr = pci_resource_start(pci, 1); | 1383 | chip->ba1_addr = pci_resource_start(pci, 1); |
1384 | 1384 | ||
1385 | chip->ba0 = ioremap_nocache(chip->ba0_addr, pci_resource_len(pci, 0)); | 1385 | chip->ba0 = pci_ioremap_bar(pci, 0); |
1386 | chip->ba1 = ioremap_nocache(chip->ba1_addr, pci_resource_len(pci, 1)); | 1386 | chip->ba1 = pci_ioremap_bar(pci, 1); |
1387 | if (!chip->ba0 || !chip->ba1) { | 1387 | if (!chip->ba0 || !chip->ba1) { |
1388 | snd_cs4281_free(chip); | 1388 | snd_cs4281_free(chip); |
1389 | return -ENOMEM; | 1389 | return -ENOMEM; |
diff --git a/sound/pci/cs5530.c b/sound/pci/cs5530.c index 4ba2db2f4250..6dea5b5cc774 100644 --- a/sound/pci/cs5530.c +++ b/sound/pci/cs5530.c | |||
@@ -132,7 +132,7 @@ static int __devinit snd_cs5530_create(struct snd_card *card, | |||
132 | } | 132 | } |
133 | chip->pci_base = pci_resource_start(pci, 0); | 133 | chip->pci_base = pci_resource_start(pci, 0); |
134 | 134 | ||
135 | mem = ioremap_nocache(chip->pci_base, pci_resource_len(pci, 0)); | 135 | mem = pci_ioremap_bar(pci, 0); |
136 | if (mem == NULL) { | 136 | if (mem == NULL) { |
137 | kfree(chip); | 137 | kfree(chip); |
138 | pci_disable_device(pci); | 138 | pci_disable_device(pci); |
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 6447754ae56e..ba1ab737b55f 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
@@ -64,6 +64,7 @@ static struct hda_vendor_id hda_vendor_ids[] = { | |||
64 | { 0x14f1, "Conexant" }, | 64 | { 0x14f1, "Conexant" }, |
65 | { 0x17e8, "Chrontel" }, | 65 | { 0x17e8, "Chrontel" }, |
66 | { 0x1854, "LG" }, | 66 | { 0x1854, "LG" }, |
67 | { 0x1aec, "Wolfson Microelectronics" }, | ||
67 | { 0x434d, "C-Media" }, | 68 | { 0x434d, "C-Media" }, |
68 | { 0x8384, "SigmaTel" }, | 69 | { 0x8384, "SigmaTel" }, |
69 | {} /* terminator */ | 70 | {} /* terminator */ |
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 9f316c1b2790..35722ec920cb 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
@@ -45,6 +45,7 @@ | |||
45 | #include <linux/slab.h> | 45 | #include <linux/slab.h> |
46 | #include <linux/pci.h> | 46 | #include <linux/pci.h> |
47 | #include <linux/mutex.h> | 47 | #include <linux/mutex.h> |
48 | #include <linux/reboot.h> | ||
48 | #include <sound/core.h> | 49 | #include <sound/core.h> |
49 | #include <sound/initval.h> | 50 | #include <sound/initval.h> |
50 | #include "hda_codec.h" | 51 | #include "hda_codec.h" |
@@ -397,6 +398,9 @@ struct azx { | |||
397 | 398 | ||
398 | /* for pending irqs */ | 399 | /* for pending irqs */ |
399 | struct work_struct irq_pending_work; | 400 | struct work_struct irq_pending_work; |
401 | |||
402 | /* reboot notifier (for mysterious hangup problem at power-down) */ | ||
403 | struct notifier_block reboot_notifier; | ||
400 | }; | 404 | }; |
401 | 405 | ||
402 | /* driver types */ | 406 | /* driver types */ |
@@ -1979,12 +1983,36 @@ static int azx_resume(struct pci_dev *pci) | |||
1979 | 1983 | ||
1980 | 1984 | ||
1981 | /* | 1985 | /* |
1986 | * reboot notifier for hang-up problem at power-down | ||
1987 | */ | ||
1988 | static int azx_halt(struct notifier_block *nb, unsigned long event, void *buf) | ||
1989 | { | ||
1990 | struct azx *chip = container_of(nb, struct azx, reboot_notifier); | ||
1991 | azx_stop_chip(chip); | ||
1992 | return NOTIFY_OK; | ||
1993 | } | ||
1994 | |||
1995 | static void azx_notifier_register(struct azx *chip) | ||
1996 | { | ||
1997 | chip->reboot_notifier.notifier_call = azx_halt; | ||
1998 | register_reboot_notifier(&chip->reboot_notifier); | ||
1999 | } | ||
2000 | |||
2001 | static void azx_notifier_unregister(struct azx *chip) | ||
2002 | { | ||
2003 | if (chip->reboot_notifier.notifier_call) | ||
2004 | unregister_reboot_notifier(&chip->reboot_notifier); | ||
2005 | } | ||
2006 | |||
2007 | /* | ||
1982 | * destructor | 2008 | * destructor |
1983 | */ | 2009 | */ |
1984 | static int azx_free(struct azx *chip) | 2010 | static int azx_free(struct azx *chip) |
1985 | { | 2011 | { |
1986 | int i; | 2012 | int i; |
1987 | 2013 | ||
2014 | azx_notifier_unregister(chip); | ||
2015 | |||
1988 | if (chip->initialized) { | 2016 | if (chip->initialized) { |
1989 | azx_clear_irq_pending(chip); | 2017 | azx_clear_irq_pending(chip); |
1990 | for (i = 0; i < chip->num_streams; i++) | 2018 | for (i = 0; i < chip->num_streams; i++) |
@@ -2158,7 +2186,7 @@ static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci, | |||
2158 | } | 2186 | } |
2159 | 2187 | ||
2160 | chip->addr = pci_resource_start(pci, 0); | 2188 | chip->addr = pci_resource_start(pci, 0); |
2161 | chip->remap_addr = ioremap_nocache(chip->addr, pci_resource_len(pci,0)); | 2189 | chip->remap_addr = pci_ioremap_bar(pci, 0); |
2162 | if (chip->remap_addr == NULL) { | 2190 | if (chip->remap_addr == NULL) { |
2163 | snd_printk(KERN_ERR SFX "ioremap error\n"); | 2191 | snd_printk(KERN_ERR SFX "ioremap error\n"); |
2164 | err = -ENXIO; | 2192 | err = -ENXIO; |
@@ -2348,6 +2376,7 @@ static int __devinit azx_probe(struct pci_dev *pci, | |||
2348 | pci_set_drvdata(pci, card); | 2376 | pci_set_drvdata(pci, card); |
2349 | chip->running = 1; | 2377 | chip->running = 1; |
2350 | power_down_all_codecs(chip); | 2378 | power_down_all_codecs(chip); |
2379 | azx_notifier_register(chip); | ||
2351 | 2380 | ||
2352 | dev++; | 2381 | dev++; |
2353 | return err; | 2382 | return err; |
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index 2b00c4afdf97..d3fd432cb3ea 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c | |||
@@ -3860,6 +3860,7 @@ static const char *ad1884a_models[AD1884A_MODELS] = { | |||
3860 | 3860 | ||
3861 | static struct snd_pci_quirk ad1884a_cfg_tbl[] = { | 3861 | static struct snd_pci_quirk ad1884a_cfg_tbl[] = { |
3862 | SND_PCI_QUIRK(0x103c, 0x3030, "HP", AD1884A_MOBILE), | 3862 | SND_PCI_QUIRK(0x103c, 0x3030, "HP", AD1884A_MOBILE), |
3863 | SND_PCI_QUIRK(0x103c, 0x3056, "HP", AD1884A_MOBILE), | ||
3863 | SND_PCI_QUIRK(0x17aa, 0x20ac, "Thinkpad X300", AD1884A_THINKPAD), | 3864 | SND_PCI_QUIRK(0x17aa, 0x20ac, "Thinkpad X300", AD1884A_THINKPAD), |
3864 | {} | 3865 | {} |
3865 | }; | 3866 | }; |
diff --git a/sound/pci/hda/patch_nvhdmi.c b/sound/pci/hda/patch_nvhdmi.c index 1a65775d28e1..2eed2c8b98da 100644 --- a/sound/pci/hda/patch_nvhdmi.c +++ b/sound/pci/hda/patch_nvhdmi.c | |||
@@ -116,6 +116,7 @@ static int nvhdmi_build_pcms(struct hda_codec *codec) | |||
116 | codec->pcm_info = info; | 116 | codec->pcm_info = info; |
117 | 117 | ||
118 | info->name = "NVIDIA HDMI"; | 118 | info->name = "NVIDIA HDMI"; |
119 | info->pcm_type = HDA_PCM_TYPE_HDMI; | ||
119 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = nvhdmi_pcm_digital_playback; | 120 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = nvhdmi_pcm_digital_playback; |
120 | 121 | ||
121 | return 0; | 122 | return 0; |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 0b6e682c46d0..4eceab9bd109 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -307,6 +307,13 @@ struct alc_spec { | |||
307 | /* for PLL fix */ | 307 | /* for PLL fix */ |
308 | hda_nid_t pll_nid; | 308 | hda_nid_t pll_nid; |
309 | unsigned int pll_coef_idx, pll_coef_bit; | 309 | unsigned int pll_coef_idx, pll_coef_bit; |
310 | |||
311 | #ifdef SND_HDA_NEEDS_RESUME | ||
312 | #define ALC_MAX_PINS 16 | ||
313 | unsigned int num_pins; | ||
314 | hda_nid_t pin_nids[ALC_MAX_PINS]; | ||
315 | unsigned int pin_cfgs[ALC_MAX_PINS]; | ||
316 | #endif | ||
310 | }; | 317 | }; |
311 | 318 | ||
312 | /* | 319 | /* |
@@ -822,6 +829,27 @@ static void alc_sku_automute(struct hda_codec *codec) | |||
822 | spec->jack_present ? 0 : PIN_OUT); | 829 | spec->jack_present ? 0 : PIN_OUT); |
823 | } | 830 | } |
824 | 831 | ||
832 | static void alc_mic_automute(struct hda_codec *codec) | ||
833 | { | ||
834 | struct alc_spec *spec = codec->spec; | ||
835 | unsigned int present; | ||
836 | unsigned int mic_nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; | ||
837 | unsigned int fmic_nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; | ||
838 | unsigned int mix_nid = spec->capsrc_nids[0]; | ||
839 | unsigned int capsrc_idx_mic, capsrc_idx_fmic; | ||
840 | |||
841 | capsrc_idx_mic = mic_nid - 0x18; | ||
842 | capsrc_idx_fmic = fmic_nid - 0x18; | ||
843 | present = snd_hda_codec_read(codec, mic_nid, 0, | ||
844 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | ||
845 | snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, | ||
846 | 0x7000 | (capsrc_idx_mic << 8) | (present ? 0 : 0x80)); | ||
847 | snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, | ||
848 | 0x7000 | (capsrc_idx_fmic << 8) | (present ? 0x80 : 0)); | ||
849 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, capsrc_idx_fmic, | ||
850 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | ||
851 | } | ||
852 | |||
825 | /* unsolicited event for HP jack sensing */ | 853 | /* unsolicited event for HP jack sensing */ |
826 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) | 854 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
827 | { | 855 | { |
@@ -829,10 +857,17 @@ static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) | |||
829 | res >>= 28; | 857 | res >>= 28; |
830 | else | 858 | else |
831 | res >>= 26; | 859 | res >>= 26; |
832 | if (res != ALC880_HP_EVENT) | 860 | if (res == ALC880_HP_EVENT) |
833 | return; | 861 | alc_sku_automute(codec); |
834 | 862 | ||
863 | if (res == ALC880_MIC_EVENT) | ||
864 | alc_mic_automute(codec); | ||
865 | } | ||
866 | |||
867 | static void alc_inithook(struct hda_codec *codec) | ||
868 | { | ||
835 | alc_sku_automute(codec); | 869 | alc_sku_automute(codec); |
870 | alc_mic_automute(codec); | ||
836 | } | 871 | } |
837 | 872 | ||
838 | /* additional initialization for ALC888 variants */ | 873 | /* additional initialization for ALC888 variants */ |
@@ -1018,10 +1053,17 @@ do_sku: | |||
1018 | else | 1053 | else |
1019 | return; | 1054 | return; |
1020 | } | 1055 | } |
1021 | 1056 | if (spec->autocfg.hp_pins[0]) | |
1022 | snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0, | 1057 | snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0, |
1023 | AC_VERB_SET_UNSOLICITED_ENABLE, | 1058 | AC_VERB_SET_UNSOLICITED_ENABLE, |
1024 | AC_USRSP_EN | ALC880_HP_EVENT); | 1059 | AC_USRSP_EN | ALC880_HP_EVENT); |
1060 | |||
1061 | if (spec->autocfg.input_pins[AUTO_PIN_MIC] && | ||
1062 | spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]) | ||
1063 | snd_hda_codec_write(codec, | ||
1064 | spec->autocfg.input_pins[AUTO_PIN_MIC], 0, | ||
1065 | AC_VERB_SET_UNSOLICITED_ENABLE, | ||
1066 | AC_USRSP_EN | ALC880_MIC_EVENT); | ||
1025 | 1067 | ||
1026 | spec->unsol_event = alc_sku_unsol_event; | 1068 | spec->unsol_event = alc_sku_unsol_event; |
1027 | } | 1069 | } |
@@ -2743,6 +2785,64 @@ static void alc_free(struct hda_codec *codec) | |||
2743 | codec->spec = NULL; /* to be sure */ | 2785 | codec->spec = NULL; /* to be sure */ |
2744 | } | 2786 | } |
2745 | 2787 | ||
2788 | #ifdef SND_HDA_NEEDS_RESUME | ||
2789 | static void store_pin_configs(struct hda_codec *codec) | ||
2790 | { | ||
2791 | struct alc_spec *spec = codec->spec; | ||
2792 | hda_nid_t nid, end_nid; | ||
2793 | |||
2794 | end_nid = codec->start_nid + codec->num_nodes; | ||
2795 | for (nid = codec->start_nid; nid < end_nid; nid++) { | ||
2796 | unsigned int wid_caps = get_wcaps(codec, nid); | ||
2797 | unsigned int wid_type = | ||
2798 | (wid_caps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; | ||
2799 | if (wid_type != AC_WID_PIN) | ||
2800 | continue; | ||
2801 | if (spec->num_pins >= ARRAY_SIZE(spec->pin_nids)) | ||
2802 | break; | ||
2803 | spec->pin_nids[spec->num_pins] = nid; | ||
2804 | spec->pin_cfgs[spec->num_pins] = | ||
2805 | snd_hda_codec_read(codec, nid, 0, | ||
2806 | AC_VERB_GET_CONFIG_DEFAULT, 0); | ||
2807 | spec->num_pins++; | ||
2808 | } | ||
2809 | } | ||
2810 | |||
2811 | static void resume_pin_configs(struct hda_codec *codec) | ||
2812 | { | ||
2813 | struct alc_spec *spec = codec->spec; | ||
2814 | int i; | ||
2815 | |||
2816 | for (i = 0; i < spec->num_pins; i++) { | ||
2817 | hda_nid_t pin_nid = spec->pin_nids[i]; | ||
2818 | unsigned int pin_config = spec->pin_cfgs[i]; | ||
2819 | snd_hda_codec_write(codec, pin_nid, 0, | ||
2820 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_0, | ||
2821 | pin_config & 0x000000ff); | ||
2822 | snd_hda_codec_write(codec, pin_nid, 0, | ||
2823 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, | ||
2824 | (pin_config & 0x0000ff00) >> 8); | ||
2825 | snd_hda_codec_write(codec, pin_nid, 0, | ||
2826 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, | ||
2827 | (pin_config & 0x00ff0000) >> 16); | ||
2828 | snd_hda_codec_write(codec, pin_nid, 0, | ||
2829 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, | ||
2830 | pin_config >> 24); | ||
2831 | } | ||
2832 | } | ||
2833 | |||
2834 | static int alc_resume(struct hda_codec *codec) | ||
2835 | { | ||
2836 | resume_pin_configs(codec); | ||
2837 | codec->patch_ops.init(codec); | ||
2838 | snd_hda_codec_resume_amp(codec); | ||
2839 | snd_hda_codec_resume_cache(codec); | ||
2840 | return 0; | ||
2841 | } | ||
2842 | #else | ||
2843 | #define store_pin_configs(codec) | ||
2844 | #endif | ||
2845 | |||
2746 | /* | 2846 | /* |
2747 | */ | 2847 | */ |
2748 | static struct hda_codec_ops alc_patch_ops = { | 2848 | static struct hda_codec_ops alc_patch_ops = { |
@@ -2751,6 +2851,9 @@ static struct hda_codec_ops alc_patch_ops = { | |||
2751 | .init = alc_init, | 2851 | .init = alc_init, |
2752 | .free = alc_free, | 2852 | .free = alc_free, |
2753 | .unsol_event = alc_unsol_event, | 2853 | .unsol_event = alc_unsol_event, |
2854 | #ifdef SND_HDA_NEEDS_RESUME | ||
2855 | .resume = alc_resume, | ||
2856 | #endif | ||
2754 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 2857 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
2755 | .check_power_status = alc_check_power_status, | 2858 | .check_power_status = alc_check_power_status, |
2756 | #endif | 2859 | #endif |
@@ -3797,6 +3900,7 @@ static int alc880_parse_auto_config(struct hda_codec *codec) | |||
3797 | spec->num_mux_defs = 1; | 3900 | spec->num_mux_defs = 1; |
3798 | spec->input_mux = &spec->private_imux; | 3901 | spec->input_mux = &spec->private_imux; |
3799 | 3902 | ||
3903 | store_pin_configs(codec); | ||
3800 | return 1; | 3904 | return 1; |
3801 | } | 3905 | } |
3802 | 3906 | ||
@@ -3808,7 +3912,7 @@ static void alc880_auto_init(struct hda_codec *codec) | |||
3808 | alc880_auto_init_extra_out(codec); | 3912 | alc880_auto_init_extra_out(codec); |
3809 | alc880_auto_init_analog_input(codec); | 3913 | alc880_auto_init_analog_input(codec); |
3810 | if (spec->unsol_event) | 3914 | if (spec->unsol_event) |
3811 | alc_sku_automute(codec); | 3915 | alc_inithook(codec); |
3812 | } | 3916 | } |
3813 | 3917 | ||
3814 | /* | 3918 | /* |
@@ -4961,7 +5065,7 @@ static struct hda_verb alc260_test_init_verbs[] = { | |||
4961 | */ | 5065 | */ |
4962 | 5066 | ||
4963 | static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid, | 5067 | static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid, |
4964 | const char *pfx) | 5068 | const char *pfx, int *vol_bits) |
4965 | { | 5069 | { |
4966 | hda_nid_t nid_vol; | 5070 | hda_nid_t nid_vol; |
4967 | unsigned long vol_val, sw_val; | 5071 | unsigned long vol_val, sw_val; |
@@ -4983,10 +5087,14 @@ static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid, | |||
4983 | } else | 5087 | } else |
4984 | return 0; /* N/A */ | 5088 | return 0; /* N/A */ |
4985 | 5089 | ||
4986 | snprintf(name, sizeof(name), "%s Playback Volume", pfx); | 5090 | if (!(*vol_bits & (1 << nid_vol))) { |
4987 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val); | 5091 | /* first control for the volume widget */ |
4988 | if (err < 0) | 5092 | snprintf(name, sizeof(name), "%s Playback Volume", pfx); |
4989 | return err; | 5093 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val); |
5094 | if (err < 0) | ||
5095 | return err; | ||
5096 | *vol_bits |= (1 << nid_vol); | ||
5097 | } | ||
4990 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); | 5098 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); |
4991 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val); | 5099 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val); |
4992 | if (err < 0) | 5100 | if (err < 0) |
@@ -5000,6 +5108,7 @@ static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, | |||
5000 | { | 5108 | { |
5001 | hda_nid_t nid; | 5109 | hda_nid_t nid; |
5002 | int err; | 5110 | int err; |
5111 | int vols = 0; | ||
5003 | 5112 | ||
5004 | spec->multiout.num_dacs = 1; | 5113 | spec->multiout.num_dacs = 1; |
5005 | spec->multiout.dac_nids = spec->private_dac_nids; | 5114 | spec->multiout.dac_nids = spec->private_dac_nids; |
@@ -5007,21 +5116,22 @@ static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, | |||
5007 | 5116 | ||
5008 | nid = cfg->line_out_pins[0]; | 5117 | nid = cfg->line_out_pins[0]; |
5009 | if (nid) { | 5118 | if (nid) { |
5010 | err = alc260_add_playback_controls(spec, nid, "Front"); | 5119 | err = alc260_add_playback_controls(spec, nid, "Front", &vols); |
5011 | if (err < 0) | 5120 | if (err < 0) |
5012 | return err; | 5121 | return err; |
5013 | } | 5122 | } |
5014 | 5123 | ||
5015 | nid = cfg->speaker_pins[0]; | 5124 | nid = cfg->speaker_pins[0]; |
5016 | if (nid) { | 5125 | if (nid) { |
5017 | err = alc260_add_playback_controls(spec, nid, "Speaker"); | 5126 | err = alc260_add_playback_controls(spec, nid, "Speaker", &vols); |
5018 | if (err < 0) | 5127 | if (err < 0) |
5019 | return err; | 5128 | return err; |
5020 | } | 5129 | } |
5021 | 5130 | ||
5022 | nid = cfg->hp_pins[0]; | 5131 | nid = cfg->hp_pins[0]; |
5023 | if (nid) { | 5132 | if (nid) { |
5024 | err = alc260_add_playback_controls(spec, nid, "Headphone"); | 5133 | err = alc260_add_playback_controls(spec, nid, "Headphone", |
5134 | &vols); | ||
5025 | if (err < 0) | 5135 | if (err < 0) |
5026 | return err; | 5136 | return err; |
5027 | } | 5137 | } |
@@ -5209,6 +5319,7 @@ static int alc260_parse_auto_config(struct hda_codec *codec) | |||
5209 | } | 5319 | } |
5210 | spec->num_mixers++; | 5320 | spec->num_mixers++; |
5211 | 5321 | ||
5322 | store_pin_configs(codec); | ||
5212 | return 1; | 5323 | return 1; |
5213 | } | 5324 | } |
5214 | 5325 | ||
@@ -5219,7 +5330,7 @@ static void alc260_auto_init(struct hda_codec *codec) | |||
5219 | alc260_auto_init_multi_out(codec); | 5330 | alc260_auto_init_multi_out(codec); |
5220 | alc260_auto_init_analog_input(codec); | 5331 | alc260_auto_init_analog_input(codec); |
5221 | if (spec->unsol_event) | 5332 | if (spec->unsol_event) |
5222 | alc_sku_automute(codec); | 5333 | alc_inithook(codec); |
5223 | } | 5334 | } |
5224 | 5335 | ||
5225 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 5336 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
@@ -6629,7 +6740,7 @@ static void alc882_auto_init(struct hda_codec *codec) | |||
6629 | alc882_auto_init_analog_input(codec); | 6740 | alc882_auto_init_analog_input(codec); |
6630 | alc882_auto_init_input_src(codec); | 6741 | alc882_auto_init_input_src(codec); |
6631 | if (spec->unsol_event) | 6742 | if (spec->unsol_event) |
6632 | alc_sku_automute(codec); | 6743 | alc_inithook(codec); |
6633 | } | 6744 | } |
6634 | 6745 | ||
6635 | static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */ | 6746 | static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */ |
@@ -8306,8 +8417,8 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = { | |||
8306 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), | 8417 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
8307 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), | 8418 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
8308 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), | 8419 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
8420 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), | ||
8309 | SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG), | 8421 | SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG), |
8310 | SND_PCI_QUIRK(0x1043, 0x8317, "Asus M90V", ALC888_ASUS_M90V), | ||
8311 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), | 8422 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), |
8312 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), | 8423 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
8313 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG), | 8424 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG), |
@@ -8758,7 +8869,7 @@ static void alc883_auto_init(struct hda_codec *codec) | |||
8758 | alc883_auto_init_analog_input(codec); | 8869 | alc883_auto_init_analog_input(codec); |
8759 | alc883_auto_init_input_src(codec); | 8870 | alc883_auto_init_input_src(codec); |
8760 | if (spec->unsol_event) | 8871 | if (spec->unsol_event) |
8761 | alc_sku_automute(codec); | 8872 | alc_inithook(codec); |
8762 | } | 8873 | } |
8763 | 8874 | ||
8764 | static int patch_alc883(struct hda_codec *codec) | 8875 | static int patch_alc883(struct hda_codec *codec) |
@@ -8802,8 +8913,13 @@ static int patch_alc883(struct hda_codec *codec) | |||
8802 | 8913 | ||
8803 | switch (codec->vendor_id) { | 8914 | switch (codec->vendor_id) { |
8804 | case 0x10ec0888: | 8915 | case 0x10ec0888: |
8805 | spec->stream_name_analog = "ALC888 Analog"; | 8916 | if (codec->revision_id == 0x100101) { |
8806 | spec->stream_name_digital = "ALC888 Digital"; | 8917 | spec->stream_name_analog = "ALC1200 Analog"; |
8918 | spec->stream_name_digital = "ALC1200 Digital"; | ||
8919 | } else { | ||
8920 | spec->stream_name_analog = "ALC888 Analog"; | ||
8921 | spec->stream_name_digital = "ALC888 Digital"; | ||
8922 | } | ||
8807 | break; | 8923 | break; |
8808 | case 0x10ec0889: | 8924 | case 0x10ec0889: |
8809 | spec->stream_name_analog = "ALC889 Analog"; | 8925 | spec->stream_name_analog = "ALC889 Analog"; |
@@ -10267,6 +10383,7 @@ static int alc262_parse_auto_config(struct hda_codec *codec) | |||
10267 | if (err < 0) | 10383 | if (err < 0) |
10268 | return err; | 10384 | return err; |
10269 | 10385 | ||
10386 | store_pin_configs(codec); | ||
10270 | return 1; | 10387 | return 1; |
10271 | } | 10388 | } |
10272 | 10389 | ||
@@ -10285,7 +10402,7 @@ static void alc262_auto_init(struct hda_codec *codec) | |||
10285 | alc262_auto_init_analog_input(codec); | 10402 | alc262_auto_init_analog_input(codec); |
10286 | alc262_auto_init_input_src(codec); | 10403 | alc262_auto_init_input_src(codec); |
10287 | if (spec->unsol_event) | 10404 | if (spec->unsol_event) |
10288 | alc_sku_automute(codec); | 10405 | alc_inithook(codec); |
10289 | } | 10406 | } |
10290 | 10407 | ||
10291 | /* | 10408 | /* |
@@ -10343,7 +10460,7 @@ static struct snd_pci_quirk alc262_cfg_tbl[] = { | |||
10343 | SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD), | 10460 | SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD), |
10344 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", | 10461 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
10345 | ALC262_TOSHIBA_RX1), | 10462 | ALC262_TOSHIBA_RX1), |
10346 | SND_PCI_QUIRK(0x1179, 0x0268, "Toshiba S06", ALC262_TOSHIBA_S06), | 10463 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), |
10347 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), | 10464 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
10348 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), | 10465 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
10349 | SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA), | 10466 | SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA), |
@@ -11401,6 +11518,7 @@ static int alc268_parse_auto_config(struct hda_codec *codec) | |||
11401 | if (err < 0) | 11518 | if (err < 0) |
11402 | return err; | 11519 | return err; |
11403 | 11520 | ||
11521 | store_pin_configs(codec); | ||
11404 | return 1; | 11522 | return 1; |
11405 | } | 11523 | } |
11406 | 11524 | ||
@@ -11417,7 +11535,7 @@ static void alc268_auto_init(struct hda_codec *codec) | |||
11417 | alc268_auto_init_mono_speaker_out(codec); | 11535 | alc268_auto_init_mono_speaker_out(codec); |
11418 | alc268_auto_init_analog_input(codec); | 11536 | alc268_auto_init_analog_input(codec); |
11419 | if (spec->unsol_event) | 11537 | if (spec->unsol_event) |
11420 | alc_sku_automute(codec); | 11538 | alc_inithook(codec); |
11421 | } | 11539 | } |
11422 | 11540 | ||
11423 | /* | 11541 | /* |
@@ -12184,6 +12302,7 @@ static int alc269_parse_auto_config(struct hda_codec *codec) | |||
12184 | spec->mixers[spec->num_mixers] = alc269_capture_mixer; | 12302 | spec->mixers[spec->num_mixers] = alc269_capture_mixer; |
12185 | spec->num_mixers++; | 12303 | spec->num_mixers++; |
12186 | 12304 | ||
12305 | store_pin_configs(codec); | ||
12187 | return 1; | 12306 | return 1; |
12188 | } | 12307 | } |
12189 | 12308 | ||
@@ -12200,7 +12319,7 @@ static void alc269_auto_init(struct hda_codec *codec) | |||
12200 | alc269_auto_init_hp_out(codec); | 12319 | alc269_auto_init_hp_out(codec); |
12201 | alc269_auto_init_analog_input(codec); | 12320 | alc269_auto_init_analog_input(codec); |
12202 | if (spec->unsol_event) | 12321 | if (spec->unsol_event) |
12203 | alc_sku_automute(codec); | 12322 | alc_inithook(codec); |
12204 | } | 12323 | } |
12205 | 12324 | ||
12206 | /* | 12325 | /* |
@@ -13270,6 +13389,7 @@ static int alc861_parse_auto_config(struct hda_codec *codec) | |||
13270 | spec->mixers[spec->num_mixers] = alc861_capture_mixer; | 13389 | spec->mixers[spec->num_mixers] = alc861_capture_mixer; |
13271 | spec->num_mixers++; | 13390 | spec->num_mixers++; |
13272 | 13391 | ||
13392 | store_pin_configs(codec); | ||
13273 | return 1; | 13393 | return 1; |
13274 | } | 13394 | } |
13275 | 13395 | ||
@@ -13281,7 +13401,7 @@ static void alc861_auto_init(struct hda_codec *codec) | |||
13281 | alc861_auto_init_hp_out(codec); | 13401 | alc861_auto_init_hp_out(codec); |
13282 | alc861_auto_init_analog_input(codec); | 13402 | alc861_auto_init_analog_input(codec); |
13283 | if (spec->unsol_event) | 13403 | if (spec->unsol_event) |
13284 | alc_sku_automute(codec); | 13404 | alc_inithook(codec); |
13285 | } | 13405 | } |
13286 | 13406 | ||
13287 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 13407 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
@@ -14381,6 +14501,7 @@ static int alc861vd_parse_auto_config(struct hda_codec *codec) | |||
14381 | if (err < 0) | 14501 | if (err < 0) |
14382 | return err; | 14502 | return err; |
14383 | 14503 | ||
14504 | store_pin_configs(codec); | ||
14384 | return 1; | 14505 | return 1; |
14385 | } | 14506 | } |
14386 | 14507 | ||
@@ -14393,7 +14514,7 @@ static void alc861vd_auto_init(struct hda_codec *codec) | |||
14393 | alc861vd_auto_init_analog_input(codec); | 14514 | alc861vd_auto_init_analog_input(codec); |
14394 | alc861vd_auto_init_input_src(codec); | 14515 | alc861vd_auto_init_input_src(codec); |
14395 | if (spec->unsol_event) | 14516 | if (spec->unsol_event) |
14396 | alc_sku_automute(codec); | 14517 | alc_inithook(codec); |
14397 | } | 14518 | } |
14398 | 14519 | ||
14399 | static int patch_alc861vd(struct hda_codec *codec) | 14520 | static int patch_alc861vd(struct hda_codec *codec) |
@@ -15667,7 +15788,7 @@ static const char *alc662_models[ALC662_MODEL_LAST] = { | |||
15667 | 15788 | ||
15668 | static struct snd_pci_quirk alc662_cfg_tbl[] = { | 15789 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
15669 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), | 15790 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), |
15670 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS M51VA", ALC663_ASUS_G50V), | 15791 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), |
15671 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), | 15792 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
15672 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), | 15793 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
15673 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), | 15794 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
@@ -15680,6 +15801,7 @@ static struct snd_pci_quirk alc662_cfg_tbl[] = { | |||
15680 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), | 15801 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), |
15681 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), | 15802 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), |
15682 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), | 15803 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), |
15804 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), | ||
15683 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), | 15805 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), |
15684 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), | 15806 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), |
15685 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), | 15807 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), |
@@ -16211,6 +16333,8 @@ static int alc662_parse_auto_config(struct hda_codec *codec) | |||
16211 | 16333 | ||
16212 | spec->mixers[spec->num_mixers] = alc662_capture_mixer; | 16334 | spec->mixers[spec->num_mixers] = alc662_capture_mixer; |
16213 | spec->num_mixers++; | 16335 | spec->num_mixers++; |
16336 | |||
16337 | store_pin_configs(codec); | ||
16214 | return 1; | 16338 | return 1; |
16215 | } | 16339 | } |
16216 | 16340 | ||
@@ -16223,7 +16347,7 @@ static void alc662_auto_init(struct hda_codec *codec) | |||
16223 | alc662_auto_init_analog_input(codec); | 16347 | alc662_auto_init_analog_input(codec); |
16224 | alc662_auto_init_input_src(codec); | 16348 | alc662_auto_init_input_src(codec); |
16225 | if (spec->unsol_event) | 16349 | if (spec->unsol_event) |
16226 | alc_sku_automute(codec); | 16350 | alc_inithook(codec); |
16227 | } | 16351 | } |
16228 | 16352 | ||
16229 | static int patch_alc662(struct hda_codec *codec) | 16353 | static int patch_alc662(struct hda_codec *codec) |
@@ -16268,6 +16392,9 @@ static int patch_alc662(struct hda_codec *codec) | |||
16268 | if (codec->vendor_id == 0x10ec0663) { | 16392 | if (codec->vendor_id == 0x10ec0663) { |
16269 | spec->stream_name_analog = "ALC663 Analog"; | 16393 | spec->stream_name_analog = "ALC663 Analog"; |
16270 | spec->stream_name_digital = "ALC663 Digital"; | 16394 | spec->stream_name_digital = "ALC663 Digital"; |
16395 | } else if (codec->vendor_id == 0x10ec0272) { | ||
16396 | spec->stream_name_analog = "ALC272 Analog"; | ||
16397 | spec->stream_name_digital = "ALC272 Digital"; | ||
16271 | } else { | 16398 | } else { |
16272 | spec->stream_name_analog = "ALC662 Analog"; | 16399 | spec->stream_name_analog = "ALC662 Analog"; |
16273 | spec->stream_name_digital = "ALC662 Digital"; | 16400 | spec->stream_name_digital = "ALC662 Digital"; |
@@ -16305,6 +16432,7 @@ struct hda_codec_preset snd_hda_preset_realtek[] = { | |||
16305 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, | 16432 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
16306 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, | 16433 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
16307 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, | 16434 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
16435 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, | ||
16308 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", | 16436 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
16309 | .patch = patch_alc861 }, | 16437 | .patch = patch_alc861 }, |
16310 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, | 16438 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
@@ -16323,7 +16451,10 @@ struct hda_codec_preset snd_hda_preset_realtek[] = { | |||
16323 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", | 16451 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
16324 | .patch = patch_alc882 }, /* should be patch_alc883() in future */ | 16452 | .patch = patch_alc882 }, /* should be patch_alc883() in future */ |
16325 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, | 16453 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
16454 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc883 }, | ||
16326 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 }, | 16455 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 }, |
16456 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", | ||
16457 | .patch = patch_alc883 }, | ||
16327 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 }, | 16458 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 }, |
16328 | {} /* terminator */ | 16459 | {} /* terminator */ |
16329 | }; | 16460 | }; |
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index c59065513118..df9b0bc7f878 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -566,10 +566,8 @@ static int stac92xx_smux_enum_put(struct snd_kcontrol *kcontrol, | |||
566 | nid = codec->slave_dig_outs[smux_idx - 1]; | 566 | nid = codec->slave_dig_outs[smux_idx - 1]; |
567 | if (spec->cur_smux[smux_idx] == smux->num_items - 1) | 567 | if (spec->cur_smux[smux_idx] == smux->num_items - 1) |
568 | val = AMP_OUT_MUTE; | 568 | val = AMP_OUT_MUTE; |
569 | if (smux_idx == 0) | ||
570 | nid = spec->multiout.dig_out_nid; | ||
571 | else | 569 | else |
572 | nid = codec->slave_dig_outs[smux_idx - 1]; | 570 | val = AMP_OUT_UNMUTE; |
573 | /* un/mute SPDIF out */ | 571 | /* un/mute SPDIF out */ |
574 | snd_hda_codec_write_cache(codec, nid, 0, | 572 | snd_hda_codec_write_cache(codec, nid, 0, |
575 | AC_VERB_SET_AMP_GAIN_MUTE, val); | 573 | AC_VERB_SET_AMP_GAIN_MUTE, val); |
@@ -1282,7 +1280,7 @@ static int stac92xx_build_controls(struct hda_codec *codec) | |||
1282 | return err; | 1280 | return err; |
1283 | spec->multiout.share_spdif = 1; | 1281 | spec->multiout.share_spdif = 1; |
1284 | } | 1282 | } |
1285 | if (spec->dig_in_nid && (!spec->gpio_dir & 0x01)) { | 1283 | if (spec->dig_in_nid && !(spec->gpio_dir & 0x01)) { |
1286 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); | 1284 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
1287 | if (err < 0) | 1285 | if (err < 0) |
1288 | return err; | 1286 | return err; |
@@ -2816,7 +2814,7 @@ static int stac92xx_auto_create_multi_out_ctls(struct hda_codec *codec, | |||
2816 | static const char *chname[4] = { | 2814 | static const char *chname[4] = { |
2817 | "Front", "Surround", NULL /*CLFE*/, "Side" | 2815 | "Front", "Surround", NULL /*CLFE*/, "Side" |
2818 | }; | 2816 | }; |
2819 | hda_nid_t nid; | 2817 | hda_nid_t nid = 0; |
2820 | int i, err; | 2818 | int i, err; |
2821 | 2819 | ||
2822 | struct sigmatel_spec *spec = codec->spec; | 2820 | struct sigmatel_spec *spec = codec->spec; |
diff --git a/sound/pci/mixart/mixart.c b/sound/pci/mixart/mixart.c index 2d0dce649a64..ae7601f353a7 100644 --- a/sound/pci/mixart/mixart.c +++ b/sound/pci/mixart/mixart.c | |||
@@ -1314,8 +1314,7 @@ static int __devinit snd_mixart_probe(struct pci_dev *pci, | |||
1314 | } | 1314 | } |
1315 | for (i = 0; i < 2; i++) { | 1315 | for (i = 0; i < 2; i++) { |
1316 | mgr->mem[i].phys = pci_resource_start(pci, i); | 1316 | mgr->mem[i].phys = pci_resource_start(pci, i); |
1317 | mgr->mem[i].virt = ioremap_nocache(mgr->mem[i].phys, | 1317 | mgr->mem[i].virt = pci_ioremap_bar(pci, i); |
1318 | pci_resource_len(pci, i)); | ||
1319 | if (!mgr->mem[i].virt) { | 1318 | if (!mgr->mem[i].virt) { |
1320 | printk(KERN_ERR "unable to remap resource 0x%lx\n", | 1319 | printk(KERN_ERR "unable to remap resource 0x%lx\n", |
1321 | mgr->mem[i].phys); | 1320 | mgr->mem[i].phys); |
diff --git a/sound/ppc/snd_ps3.c b/sound/ppc/snd_ps3.c index 20d0e328288a..8f9e3859c37c 100644 --- a/sound/ppc/snd_ps3.c +++ b/sound/ppc/snd_ps3.c | |||
@@ -666,6 +666,7 @@ static int snd_ps3_init_avsetting(struct snd_ps3_card_info *card) | |||
666 | card->avs.avs_audio_width = PS3AV_CMD_AUDIO_WORD_BITS_16; | 666 | card->avs.avs_audio_width = PS3AV_CMD_AUDIO_WORD_BITS_16; |
667 | card->avs.avs_audio_format = PS3AV_CMD_AUDIO_FORMAT_PCM; | 667 | card->avs.avs_audio_format = PS3AV_CMD_AUDIO_FORMAT_PCM; |
668 | card->avs.avs_audio_source = PS3AV_CMD_AUDIO_SOURCE_SERIAL; | 668 | card->avs.avs_audio_source = PS3AV_CMD_AUDIO_SOURCE_SERIAL; |
669 | memcpy(card->avs.avs_cs_info, ps3av_mode_cs_info, 8); | ||
669 | 670 | ||
670 | ret = snd_ps3_change_avsetting(card); | 671 | ret = snd_ps3_change_avsetting(card); |
671 | 672 | ||
@@ -685,6 +686,7 @@ static int snd_ps3_set_avsetting(struct snd_pcm_substream *substream) | |||
685 | { | 686 | { |
686 | struct snd_ps3_card_info *card = snd_pcm_substream_chip(substream); | 687 | struct snd_ps3_card_info *card = snd_pcm_substream_chip(substream); |
687 | struct snd_ps3_avsetting_info avs; | 688 | struct snd_ps3_avsetting_info avs; |
689 | int ret; | ||
688 | 690 | ||
689 | avs = card->avs; | 691 | avs = card->avs; |
690 | 692 | ||
@@ -729,19 +731,92 @@ static int snd_ps3_set_avsetting(struct snd_pcm_substream *substream) | |||
729 | return 1; | 731 | return 1; |
730 | } | 732 | } |
731 | 733 | ||
732 | if ((card->avs.avs_audio_width != avs.avs_audio_width) || | 734 | memcpy(avs.avs_cs_info, ps3av_mode_cs_info, 8); |
733 | (card->avs.avs_audio_rate != avs.avs_audio_rate)) { | ||
734 | card->avs = avs; | ||
735 | snd_ps3_change_avsetting(card); | ||
736 | 735 | ||
736 | if (memcmp(&card->avs, &avs, sizeof(avs))) { | ||
737 | pr_debug("%s: after freq=%d width=%d\n", __func__, | 737 | pr_debug("%s: after freq=%d width=%d\n", __func__, |
738 | card->avs.avs_audio_rate, card->avs.avs_audio_width); | 738 | card->avs.avs_audio_rate, card->avs.avs_audio_width); |
739 | 739 | ||
740 | return 0; | 740 | card->avs = avs; |
741 | snd_ps3_change_avsetting(card); | ||
742 | ret = 0; | ||
741 | } else | 743 | } else |
744 | ret = 1; | ||
745 | |||
746 | /* check CS non-audio bit and mute accordingly */ | ||
747 | if (avs.avs_cs_info[0] & 0x02) | ||
748 | ps3av_audio_mute_analog(1); /* mute if non-audio */ | ||
749 | else | ||
750 | ps3av_audio_mute_analog(0); | ||
751 | |||
752 | return ret; | ||
753 | } | ||
754 | |||
755 | /* | ||
756 | * SPDIF status bits controls | ||
757 | */ | ||
758 | static int snd_ps3_spdif_mask_info(struct snd_kcontrol *kcontrol, | ||
759 | struct snd_ctl_elem_info *uinfo) | ||
760 | { | ||
761 | uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958; | ||
762 | uinfo->count = 1; | ||
763 | return 0; | ||
764 | } | ||
765 | |||
766 | /* FIXME: ps3av_set_audio_mode() assumes only consumer mode */ | ||
767 | static int snd_ps3_spdif_cmask_get(struct snd_kcontrol *kcontrol, | ||
768 | struct snd_ctl_elem_value *ucontrol) | ||
769 | { | ||
770 | memset(ucontrol->value.iec958.status, 0xff, 8); | ||
771 | return 0; | ||
772 | } | ||
773 | |||
774 | static int snd_ps3_spdif_pmask_get(struct snd_kcontrol *kcontrol, | ||
775 | struct snd_ctl_elem_value *ucontrol) | ||
776 | { | ||
777 | return 0; | ||
778 | } | ||
779 | |||
780 | static int snd_ps3_spdif_default_get(struct snd_kcontrol *kcontrol, | ||
781 | struct snd_ctl_elem_value *ucontrol) | ||
782 | { | ||
783 | memcpy(ucontrol->value.iec958.status, ps3av_mode_cs_info, 8); | ||
784 | return 0; | ||
785 | } | ||
786 | |||
787 | static int snd_ps3_spdif_default_put(struct snd_kcontrol *kcontrol, | ||
788 | struct snd_ctl_elem_value *ucontrol) | ||
789 | { | ||
790 | if (memcmp(ps3av_mode_cs_info, ucontrol->value.iec958.status, 8)) { | ||
791 | memcpy(ps3av_mode_cs_info, ucontrol->value.iec958.status, 8); | ||
742 | return 1; | 792 | return 1; |
793 | } | ||
794 | return 0; | ||
743 | } | 795 | } |
744 | 796 | ||
797 | static struct snd_kcontrol_new spdif_ctls[] = { | ||
798 | { | ||
799 | .access = SNDRV_CTL_ELEM_ACCESS_READ, | ||
800 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, | ||
801 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,CON_MASK), | ||
802 | .info = snd_ps3_spdif_mask_info, | ||
803 | .get = snd_ps3_spdif_cmask_get, | ||
804 | }, | ||
805 | { | ||
806 | .access = SNDRV_CTL_ELEM_ACCESS_READ, | ||
807 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, | ||
808 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,PRO_MASK), | ||
809 | .info = snd_ps3_spdif_mask_info, | ||
810 | .get = snd_ps3_spdif_pmask_get, | ||
811 | }, | ||
812 | { | ||
813 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, | ||
814 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,DEFAULT), | ||
815 | .info = snd_ps3_spdif_mask_info, | ||
816 | .get = snd_ps3_spdif_default_get, | ||
817 | .put = snd_ps3_spdif_default_put, | ||
818 | }, | ||
819 | }; | ||
745 | 820 | ||
746 | 821 | ||
747 | static int snd_ps3_map_mmio(void) | 822 | static int snd_ps3_map_mmio(void) |
@@ -842,7 +917,7 @@ static void snd_ps3_audio_set_base_addr(uint64_t ioaddr_start) | |||
842 | 917 | ||
843 | static int __init snd_ps3_driver_probe(struct ps3_system_bus_device *dev) | 918 | static int __init snd_ps3_driver_probe(struct ps3_system_bus_device *dev) |
844 | { | 919 | { |
845 | int ret; | 920 | int i, ret; |
846 | u64 lpar_addr, lpar_size; | 921 | u64 lpar_addr, lpar_size; |
847 | 922 | ||
848 | BUG_ON(!firmware_has_feature(FW_FEATURE_PS3_LV1)); | 923 | BUG_ON(!firmware_has_feature(FW_FEATURE_PS3_LV1)); |
@@ -903,6 +978,15 @@ static int __init snd_ps3_driver_probe(struct ps3_system_bus_device *dev) | |||
903 | strcpy(the_card.card->driver, "PS3"); | 978 | strcpy(the_card.card->driver, "PS3"); |
904 | strcpy(the_card.card->shortname, "PS3"); | 979 | strcpy(the_card.card->shortname, "PS3"); |
905 | strcpy(the_card.card->longname, "PS3 sound"); | 980 | strcpy(the_card.card->longname, "PS3 sound"); |
981 | |||
982 | /* create control elements */ | ||
983 | for (i = 0; i < ARRAY_SIZE(spdif_ctls); i++) { | ||
984 | ret = snd_ctl_add(the_card.card, | ||
985 | snd_ctl_new1(&spdif_ctls[i], &the_card)); | ||
986 | if (ret < 0) | ||
987 | goto clean_card; | ||
988 | } | ||
989 | |||
906 | /* create PCM devices instance */ | 990 | /* create PCM devices instance */ |
907 | /* NOTE:this driver works assuming pcm:substream = 1:1 */ | 991 | /* NOTE:this driver works assuming pcm:substream = 1:1 */ |
908 | ret = snd_pcm_new(the_card.card, | 992 | ret = snd_pcm_new(the_card.card, |
diff --git a/sound/ppc/snd_ps3.h b/sound/ppc/snd_ps3.h index 4b7e6fbbe500..326fb29e82d8 100644 --- a/sound/ppc/snd_ps3.h +++ b/sound/ppc/snd_ps3.h | |||
@@ -51,6 +51,7 @@ struct snd_ps3_avsetting_info { | |||
51 | uint32_t avs_audio_width; | 51 | uint32_t avs_audio_width; |
52 | uint32_t avs_audio_format; /* fixed */ | 52 | uint32_t avs_audio_format; /* fixed */ |
53 | uint32_t avs_audio_source; /* fixed */ | 53 | uint32_t avs_audio_source; /* fixed */ |
54 | unsigned char avs_cs_info[8]; | ||
54 | }; | 55 | }; |
55 | /* | 56 | /* |
56 | * PS3 audio 'card' instance | 57 | * PS3 audio 'card' instance |
diff --git a/sound/soc/at32/playpaq_wm8510.c b/sound/soc/at32/playpaq_wm8510.c index 98a2d5826a85..b1966e4dfcd3 100644 --- a/sound/soc/at32/playpaq_wm8510.c +++ b/sound/soc/at32/playpaq_wm8510.c | |||
@@ -304,7 +304,7 @@ static const struct snd_soc_dapm_widget playpaq_dapm_widgets[] = { | |||
304 | 304 | ||
305 | 305 | ||
306 | 306 | ||
307 | static const char *intercon[][3] = { | 307 | static const struct snd_soc_dapm_route intercon[] = { |
308 | /* speaker connected to SPKOUT */ | 308 | /* speaker connected to SPKOUT */ |
309 | {"Ext Spk", NULL, "SPKOUTP"}, | 309 | {"Ext Spk", NULL, "SPKOUTP"}, |
310 | {"Ext Spk", NULL, "SPKOUTN"}, | 310 | {"Ext Spk", NULL, "SPKOUTN"}, |
@@ -312,9 +312,6 @@ static const char *intercon[][3] = { | |||
312 | {"Mic Bias", NULL, "Int Mic"}, | 312 | {"Mic Bias", NULL, "Int Mic"}, |
313 | {"MICN", NULL, "Mic Bias"}, | 313 | {"MICN", NULL, "Mic Bias"}, |
314 | {"MICP", NULL, "Mic Bias"}, | 314 | {"MICP", NULL, "Mic Bias"}, |
315 | |||
316 | /* Terminator */ | ||
317 | {NULL, NULL, NULL}, | ||
318 | }; | 315 | }; |
319 | 316 | ||
320 | 317 | ||
@@ -334,11 +331,8 @@ static int playpaq_wm8510_init(struct snd_soc_codec *codec) | |||
334 | /* | 331 | /* |
335 | * Setup audio path interconnects | 332 | * Setup audio path interconnects |
336 | */ | 333 | */ |
337 | for (i = 0; intercon[i][0] != NULL; i++) { | 334 | snd_soc_dapm_add_routes(codec, intercon, ARRAY_SIZE(intercon)); |
338 | snd_soc_dapm_connect_input(codec, | 335 | |
339 | intercon[i][0], | ||
340 | intercon[i][1], intercon[i][2]); | ||
341 | } | ||
342 | 336 | ||
343 | 337 | ||
344 | /* always connected pins */ | 338 | /* always connected pins */ |
diff --git a/sound/soc/blackfin/bf5xx-i2s.c b/sound/soc/blackfin/bf5xx-i2s.c index 827587f08180..e020c160ee44 100644 --- a/sound/soc/blackfin/bf5xx-i2s.c +++ b/sound/soc/blackfin/bf5xx-i2s.c | |||
@@ -70,12 +70,24 @@ static struct sport_param sport_params[2] = { | |||
70 | } | 70 | } |
71 | }; | 71 | }; |
72 | 72 | ||
73 | static u16 sport_req[][7] = { | 73 | /* |
74 | { P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS, | 74 | * Setting the TFS pin selector for SPORT 0 based on whether the selected |
75 | P_SPORT0_DRPRI, P_SPORT0_RSCLK, 0}, | 75 | * port id F or G. If the port is F then no conflict should exist for the |
76 | { P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS, | 76 | * TFS. When Port G is selected and EMAC then there is a conflict between |
77 | P_SPORT1_DRPRI, P_SPORT1_RSCLK, 0}, | 77 | * the PHY interrupt line and TFS. Current settings prevent the conflict |
78 | }; | 78 | * by ignoring the TFS pin when Port G is selected. This allows both |
79 | * ssm2602 using Port G and EMAC concurrently. | ||
80 | */ | ||
81 | #ifdef CONFIG_BF527_SPORT0_PORTF | ||
82 | #define LOCAL_SPORT0_TFS (P_SPORT0_TFS) | ||
83 | #else | ||
84 | #define LOCAL_SPORT0_TFS (0) | ||
85 | #endif | ||
86 | |||
87 | static u16 sport_req[][7] = { {P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS, | ||
88 | P_SPORT0_DRPRI, P_SPORT0_RSCLK, LOCAL_SPORT0_TFS, 0}, | ||
89 | {P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS, P_SPORT1_DRPRI, | ||
90 | P_SPORT1_RSCLK, P_SPORT1_TFS, 0} }; | ||
79 | 91 | ||
80 | static int bf5xx_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai, | 92 | static int bf5xx_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai, |
81 | unsigned int fmt) | 93 | unsigned int fmt) |
@@ -98,23 +110,21 @@ static int bf5xx_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai, | |||
98 | ret = -EINVAL; | 110 | ret = -EINVAL; |
99 | break; | 111 | break; |
100 | default: | 112 | default: |
113 | printk(KERN_ERR "%s: Unknown DAI format type\n", __func__); | ||
101 | ret = -EINVAL; | 114 | ret = -EINVAL; |
102 | break; | 115 | break; |
103 | } | 116 | } |
104 | 117 | ||
105 | switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { | 118 | switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { |
106 | case SND_SOC_DAIFMT_CBS_CFS: | ||
107 | ret = -EINVAL; | ||
108 | break; | ||
109 | case SND_SOC_DAIFMT_CBM_CFS: | ||
110 | ret = -EINVAL; | ||
111 | break; | ||
112 | case SND_SOC_DAIFMT_CBM_CFM: | 119 | case SND_SOC_DAIFMT_CBM_CFM: |
113 | break; | 120 | break; |
121 | case SND_SOC_DAIFMT_CBS_CFS: | ||
122 | case SND_SOC_DAIFMT_CBM_CFS: | ||
114 | case SND_SOC_DAIFMT_CBS_CFM: | 123 | case SND_SOC_DAIFMT_CBS_CFM: |
115 | ret = -EINVAL; | 124 | ret = -EINVAL; |
116 | break; | 125 | break; |
117 | default: | 126 | default: |
127 | printk(KERN_ERR "%s: Unknown DAI master type\n", __func__); | ||
118 | ret = -EINVAL; | 128 | ret = -EINVAL; |
119 | break; | 129 | break; |
120 | } | 130 | } |
diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig index 4975d8573e4f..38a0e3b620a7 100644 --- a/sound/soc/codecs/Kconfig +++ b/sound/soc/codecs/Kconfig | |||
@@ -68,7 +68,7 @@ config SND_SOC_TLV320AIC23 | |||
68 | depends on I2C | 68 | depends on I2C |
69 | 69 | ||
70 | config SND_SOC_TLV320AIC26 | 70 | config SND_SOC_TLV320AIC26 |
71 | tristate "TI TLV320AIC26 Codec support" | 71 | tristate "TI TLV320AIC26 Codec support" if SND_SOC_OF_SIMPLE |
72 | depends on SPI | 72 | depends on SPI |
73 | 73 | ||
74 | config SND_SOC_TLV320AIC3X | 74 | config SND_SOC_TLV320AIC3X |
diff --git a/sound/soc/codecs/tlv320aic23.c b/sound/soc/codecs/tlv320aic23.c index bac7815e00fb..44308dac9e18 100644 --- a/sound/soc/codecs/tlv320aic23.c +++ b/sound/soc/codecs/tlv320aic23.c | |||
@@ -84,7 +84,7 @@ static int tlv320aic23_write(struct snd_soc_codec *codec, unsigned int reg, | |||
84 | unsigned int value) | 84 | unsigned int value) |
85 | { | 85 | { |
86 | 86 | ||
87 | u8 data; | 87 | u8 data[2]; |
88 | 88 | ||
89 | /* TLV320AIC23 has 7 bit address and 9 bits of data | 89 | /* TLV320AIC23 has 7 bit address and 9 bits of data |
90 | * so we need to switch one data bit into reg and rest | 90 | * so we need to switch one data bit into reg and rest |
@@ -96,12 +96,12 @@ static int tlv320aic23_write(struct snd_soc_codec *codec, unsigned int reg, | |||
96 | return -1; | 96 | return -1; |
97 | } | 97 | } |
98 | 98 | ||
99 | data = (reg << 1) | (value >> 8 & 0x01); | 99 | data[0] = (reg << 1) | (value >> 8 & 0x01); |
100 | data[1] = value & 0xff; | ||
100 | 101 | ||
101 | tlv320aic23_write_reg_cache(codec, reg, value); | 102 | tlv320aic23_write_reg_cache(codec, reg, value); |
102 | 103 | ||
103 | if (codec->hw_write(codec->control_data, data, | 104 | if (codec->hw_write(codec->control_data, data, 2) == 2) |
104 | (value & 0xff)) == 0) | ||
105 | return 0; | 105 | return 0; |
106 | 106 | ||
107 | printk(KERN_ERR "%s cannot write %03x to register R%d\n", __func__, | 107 | printk(KERN_ERR "%s cannot write %03x to register R%d\n", __func__, |
@@ -674,7 +674,7 @@ static int tlv320aic23_probe(struct platform_device *pdev) | |||
674 | 674 | ||
675 | tlv320aic23_socdev = socdev; | 675 | tlv320aic23_socdev = socdev; |
676 | #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) | 676 | #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) |
677 | codec->hw_write = (hw_write_t) i2c_smbus_write_byte_data; | 677 | codec->hw_write = (hw_write_t) i2c_master_send; |
678 | codec->hw_read = NULL; | 678 | codec->hw_read = NULL; |
679 | ret = i2c_add_driver(&tlv320aic23_i2c_driver); | 679 | ret = i2c_add_driver(&tlv320aic23_i2c_driver); |
680 | if (ret != 0) | 680 | if (ret != 0) |
diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c index 05336ed7e493..cff276ee261e 100644 --- a/sound/soc/codecs/tlv320aic3x.c +++ b/sound/soc/codecs/tlv320aic3x.c | |||
@@ -863,17 +863,21 @@ static int aic3x_set_dai_fmt(struct snd_soc_dai *codec_dai, | |||
863 | return -EINVAL; | 863 | return -EINVAL; |
864 | } | 864 | } |
865 | 865 | ||
866 | /* interface format */ | 866 | /* |
867 | switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { | 867 | * match both interface format and signal polarities since they |
868 | case SND_SOC_DAIFMT_I2S: | 868 | * are fixed |
869 | */ | ||
870 | switch (fmt & (SND_SOC_DAIFMT_FORMAT_MASK | | ||
871 | SND_SOC_DAIFMT_INV_MASK)) { | ||
872 | case (SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF): | ||
869 | break; | 873 | break; |
870 | case SND_SOC_DAIFMT_DSP_A: | 874 | case (SND_SOC_DAIFMT_DSP_B | SND_SOC_DAIFMT_IB_NF): |
871 | iface_breg |= (0x01 << 6); | 875 | iface_breg |= (0x01 << 6); |
872 | break; | 876 | break; |
873 | case SND_SOC_DAIFMT_RIGHT_J: | 877 | case (SND_SOC_DAIFMT_RIGHT_J | SND_SOC_DAIFMT_NB_NF): |
874 | iface_breg |= (0x02 << 6); | 878 | iface_breg |= (0x02 << 6); |
875 | break; | 879 | break; |
876 | case SND_SOC_DAIFMT_LEFT_J: | 880 | case (SND_SOC_DAIFMT_LEFT_J | SND_SOC_DAIFMT_NB_NF): |
877 | iface_breg |= (0x03 << 6); | 881 | iface_breg |= (0x03 << 6); |
878 | break; | 882 | break; |
879 | default: | 883 | default: |
diff --git a/sound/soc/codecs/wm9713.c b/sound/soc/codecs/wm9713.c index aba402b3c999..945b32ed9884 100644 --- a/sound/soc/codecs/wm9713.c +++ b/sound/soc/codecs/wm9713.c | |||
@@ -140,7 +140,7 @@ SOC_SINGLE("Capture ADC Boost (+20dB) Switch", AC97_VIDEO, 6, 1, 0), | |||
140 | 140 | ||
141 | SOC_SINGLE("ALC Target Volume", AC97_CODEC_CLASS_REV, 12, 15, 0), | 141 | SOC_SINGLE("ALC Target Volume", AC97_CODEC_CLASS_REV, 12, 15, 0), |
142 | SOC_SINGLE("ALC Hold Time", AC97_CODEC_CLASS_REV, 8, 15, 0), | 142 | SOC_SINGLE("ALC Hold Time", AC97_CODEC_CLASS_REV, 8, 15, 0), |
143 | SOC_SINGLE("ALC Decay Time ", AC97_CODEC_CLASS_REV, 4, 15, 0), | 143 | SOC_SINGLE("ALC Decay Time", AC97_CODEC_CLASS_REV, 4, 15, 0), |
144 | SOC_SINGLE("ALC Attack Time", AC97_CODEC_CLASS_REV, 0, 15, 0), | 144 | SOC_SINGLE("ALC Attack Time", AC97_CODEC_CLASS_REV, 0, 15, 0), |
145 | SOC_ENUM("ALC Function", wm9713_enum[6]), | 145 | SOC_ENUM("ALC Function", wm9713_enum[6]), |
146 | SOC_SINGLE("ALC Max Volume", AC97_PCI_SVID, 11, 7, 0), | 146 | SOC_SINGLE("ALC Max Volume", AC97_PCI_SVID, 11, 7, 0), |
diff --git a/sound/soc/fsl/mpc5200_psc_i2s.c b/sound/soc/fsl/mpc5200_psc_i2s.c index 86923299bc10..94a02eaa4825 100644 --- a/sound/soc/fsl/mpc5200_psc_i2s.c +++ b/sound/soc/fsl/mpc5200_psc_i2s.c | |||
@@ -277,7 +277,7 @@ static int psc_i2s_trigger(struct snd_pcm_substream *substream, int cmd) | |||
277 | struct mpc52xx_psc __iomem *regs = psc_i2s->psc_regs; | 277 | struct mpc52xx_psc __iomem *regs = psc_i2s->psc_regs; |
278 | u16 imr; | 278 | u16 imr; |
279 | u8 psc_cmd; | 279 | u8 psc_cmd; |
280 | long flags; | 280 | unsigned long flags; |
281 | 281 | ||
282 | if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE) | 282 | if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE) |
283 | s = &psc_i2s->capture; | 283 | s = &psc_i2s->capture; |
@@ -699,9 +699,11 @@ static ssize_t psc_i2s_stat_store(struct device *dev, | |||
699 | return count; | 699 | return count; |
700 | } | 700 | } |
701 | 701 | ||
702 | DEVICE_ATTR(status, 0644, psc_i2s_status_show, NULL); | 702 | static DEVICE_ATTR(status, 0644, psc_i2s_status_show, NULL); |
703 | DEVICE_ATTR(playback_underrun, 0644, psc_i2s_stat_show, psc_i2s_stat_store); | 703 | static DEVICE_ATTR(playback_underrun, 0644, psc_i2s_stat_show, |
704 | DEVICE_ATTR(capture_overrun, 0644, psc_i2s_stat_show, psc_i2s_stat_store); | 704 | psc_i2s_stat_store); |
705 | static DEVICE_ATTR(capture_overrun, 0644, psc_i2s_stat_show, | ||
706 | psc_i2s_stat_store); | ||
705 | 707 | ||
706 | /* --------------------------------------------------------------------- | 708 | /* --------------------------------------------------------------------- |
707 | * OF platform bus binding code: | 709 | * OF platform bus binding code: |
@@ -819,8 +821,8 @@ static int __devinit psc_i2s_of_probe(struct of_device *op, | |||
819 | 821 | ||
820 | /* Register the SYSFS files */ | 822 | /* Register the SYSFS files */ |
821 | rc = device_create_file(psc_i2s->dev, &dev_attr_status); | 823 | rc = device_create_file(psc_i2s->dev, &dev_attr_status); |
822 | rc = device_create_file(psc_i2s->dev, &dev_attr_capture_overrun); | 824 | rc |= device_create_file(psc_i2s->dev, &dev_attr_capture_overrun); |
823 | rc = device_create_file(psc_i2s->dev, &dev_attr_playback_underrun); | 825 | rc |= device_create_file(psc_i2s->dev, &dev_attr_playback_underrun); |
824 | if (rc) | 826 | if (rc) |
825 | dev_info(psc_i2s->dev, "error creating sysfs files\n"); | 827 | dev_info(psc_i2s->dev, "error creating sysfs files\n"); |
826 | 828 | ||
diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c index 0a063a98a661..8485a8a9d0ff 100644 --- a/sound/soc/omap/omap-mcbsp.c +++ b/sound/soc/omap/omap-mcbsp.c | |||
@@ -43,6 +43,7 @@ | |||
43 | struct omap_mcbsp_data { | 43 | struct omap_mcbsp_data { |
44 | unsigned int bus_id; | 44 | unsigned int bus_id; |
45 | struct omap_mcbsp_reg_cfg regs; | 45 | struct omap_mcbsp_reg_cfg regs; |
46 | unsigned int fmt; | ||
46 | /* | 47 | /* |
47 | * Flags indicating is the bus already activated and configured by | 48 | * Flags indicating is the bus already activated and configured by |
48 | * another substream | 49 | * another substream |
@@ -200,6 +201,7 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream, | |||
200 | struct omap_mcbsp_data *mcbsp_data = to_mcbsp(cpu_dai->private_data); | 201 | struct omap_mcbsp_data *mcbsp_data = to_mcbsp(cpu_dai->private_data); |
201 | struct omap_mcbsp_reg_cfg *regs = &mcbsp_data->regs; | 202 | struct omap_mcbsp_reg_cfg *regs = &mcbsp_data->regs; |
202 | int dma, bus_id = mcbsp_data->bus_id, id = cpu_dai->id; | 203 | int dma, bus_id = mcbsp_data->bus_id, id = cpu_dai->id; |
204 | int wlen; | ||
203 | unsigned long port; | 205 | unsigned long port; |
204 | 206 | ||
205 | if (cpu_class_is_omap1()) { | 207 | if (cpu_class_is_omap1()) { |
@@ -244,19 +246,29 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream, | |||
244 | switch (params_format(params)) { | 246 | switch (params_format(params)) { |
245 | case SNDRV_PCM_FORMAT_S16_LE: | 247 | case SNDRV_PCM_FORMAT_S16_LE: |
246 | /* Set word lengths */ | 248 | /* Set word lengths */ |
249 | wlen = 16; | ||
247 | regs->rcr2 |= RWDLEN2(OMAP_MCBSP_WORD_16); | 250 | regs->rcr2 |= RWDLEN2(OMAP_MCBSP_WORD_16); |
248 | regs->rcr1 |= RWDLEN1(OMAP_MCBSP_WORD_16); | 251 | regs->rcr1 |= RWDLEN1(OMAP_MCBSP_WORD_16); |
249 | regs->xcr2 |= XWDLEN2(OMAP_MCBSP_WORD_16); | 252 | regs->xcr2 |= XWDLEN2(OMAP_MCBSP_WORD_16); |
250 | regs->xcr1 |= XWDLEN1(OMAP_MCBSP_WORD_16); | 253 | regs->xcr1 |= XWDLEN1(OMAP_MCBSP_WORD_16); |
251 | /* Set FS period and length in terms of bit clock periods */ | ||
252 | regs->srgr2 |= FPER(16 * 2 - 1); | ||
253 | regs->srgr1 |= FWID(16 - 1); | ||
254 | break; | 254 | break; |
255 | default: | 255 | default: |
256 | /* Unsupported PCM format */ | 256 | /* Unsupported PCM format */ |
257 | return -EINVAL; | 257 | return -EINVAL; |
258 | } | 258 | } |
259 | 259 | ||
260 | /* Set FS period and length in terms of bit clock periods */ | ||
261 | switch (mcbsp_data->fmt & SND_SOC_DAIFMT_FORMAT_MASK) { | ||
262 | case SND_SOC_DAIFMT_I2S: | ||
263 | regs->srgr2 |= FPER(wlen * 2 - 1); | ||
264 | regs->srgr1 |= FWID(wlen - 1); | ||
265 | break; | ||
266 | case SND_SOC_DAIFMT_DSP_A: | ||
267 | regs->srgr2 |= FPER(wlen * 2 - 1); | ||
268 | regs->srgr1 |= FWID(wlen * 2 - 2); | ||
269 | break; | ||
270 | } | ||
271 | |||
260 | omap_mcbsp_config(bus_id, &mcbsp_data->regs); | 272 | omap_mcbsp_config(bus_id, &mcbsp_data->regs); |
261 | mcbsp_data->configured = 1; | 273 | mcbsp_data->configured = 1; |
262 | 274 | ||
@@ -276,6 +288,7 @@ static int omap_mcbsp_dai_set_dai_fmt(struct snd_soc_dai *cpu_dai, | |||
276 | if (mcbsp_data->configured) | 288 | if (mcbsp_data->configured) |
277 | return 0; | 289 | return 0; |
278 | 290 | ||
291 | mcbsp_data->fmt = fmt; | ||
279 | memset(regs, 0, sizeof(*regs)); | 292 | memset(regs, 0, sizeof(*regs)); |
280 | /* Generic McBSP register settings */ | 293 | /* Generic McBSP register settings */ |
281 | regs->spcr2 |= XINTM(3) | FREE; | 294 | regs->spcr2 |= XINTM(3) | FREE; |
diff --git a/sound/soc/pxa/corgi.c b/sound/soc/pxa/corgi.c index dd7fa0b329c7..2718eaf7895f 100644 --- a/sound/soc/pxa/corgi.c +++ b/sound/soc/pxa/corgi.c | |||
@@ -18,13 +18,13 @@ | |||
18 | #include <linux/timer.h> | 18 | #include <linux/timer.h> |
19 | #include <linux/interrupt.h> | 19 | #include <linux/interrupt.h> |
20 | #include <linux/platform_device.h> | 20 | #include <linux/platform_device.h> |
21 | #include <linux/gpio.h> | ||
21 | #include <sound/core.h> | 22 | #include <sound/core.h> |
22 | #include <sound/pcm.h> | 23 | #include <sound/pcm.h> |
23 | #include <sound/soc.h> | 24 | #include <sound/soc.h> |
24 | #include <sound/soc-dapm.h> | 25 | #include <sound/soc-dapm.h> |
25 | 26 | ||
26 | #include <asm/mach-types.h> | 27 | #include <asm/mach-types.h> |
27 | #include <asm/hardware/scoop.h> | ||
28 | #include <mach/pxa-regs.h> | 28 | #include <mach/pxa-regs.h> |
29 | #include <mach/hardware.h> | 29 | #include <mach/hardware.h> |
30 | #include <mach/corgi.h> | 30 | #include <mach/corgi.h> |
@@ -54,8 +54,8 @@ static void corgi_ext_control(struct snd_soc_codec *codec) | |||
54 | switch (corgi_jack_func) { | 54 | switch (corgi_jack_func) { |
55 | case CORGI_HP: | 55 | case CORGI_HP: |
56 | /* set = unmute headphone */ | 56 | /* set = unmute headphone */ |
57 | set_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_MUTE_L); | 57 | gpio_set_value(CORGI_GPIO_MUTE_L, 1); |
58 | set_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_MUTE_R); | 58 | gpio_set_value(CORGI_GPIO_MUTE_R, 1); |
59 | snd_soc_dapm_disable_pin(codec, "Mic Jack"); | 59 | snd_soc_dapm_disable_pin(codec, "Mic Jack"); |
60 | snd_soc_dapm_disable_pin(codec, "Line Jack"); | 60 | snd_soc_dapm_disable_pin(codec, "Line Jack"); |
61 | snd_soc_dapm_enable_pin(codec, "Headphone Jack"); | 61 | snd_soc_dapm_enable_pin(codec, "Headphone Jack"); |
@@ -63,24 +63,24 @@ static void corgi_ext_control(struct snd_soc_codec *codec) | |||
63 | break; | 63 | break; |
64 | case CORGI_MIC: | 64 | case CORGI_MIC: |
65 | /* reset = mute headphone */ | 65 | /* reset = mute headphone */ |
66 | reset_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_MUTE_L); | 66 | gpio_set_value(CORGI_GPIO_MUTE_L, 0); |
67 | reset_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_MUTE_R); | 67 | gpio_set_value(CORGI_GPIO_MUTE_R, 0); |
68 | snd_soc_dapm_enable_pin(codec, "Mic Jack"); | 68 | snd_soc_dapm_enable_pin(codec, "Mic Jack"); |
69 | snd_soc_dapm_disable_pin(codec, "Line Jack"); | 69 | snd_soc_dapm_disable_pin(codec, "Line Jack"); |
70 | snd_soc_dapm_disable_pin(codec, "Headphone Jack"); | 70 | snd_soc_dapm_disable_pin(codec, "Headphone Jack"); |
71 | snd_soc_dapm_disable_pin(codec, "Headset Jack"); | 71 | snd_soc_dapm_disable_pin(codec, "Headset Jack"); |
72 | break; | 72 | break; |
73 | case CORGI_LINE: | 73 | case CORGI_LINE: |
74 | reset_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_MUTE_L); | 74 | gpio_set_value(CORGI_GPIO_MUTE_L, 0); |
75 | reset_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_MUTE_R); | 75 | gpio_set_value(CORGI_GPIO_MUTE_R, 0); |
76 | snd_soc_dapm_disable_pin(codec, "Mic Jack"); | 76 | snd_soc_dapm_disable_pin(codec, "Mic Jack"); |
77 | snd_soc_dapm_enable_pin(codec, "Line Jack"); | 77 | snd_soc_dapm_enable_pin(codec, "Line Jack"); |
78 | snd_soc_dapm_disable_pin(codec, "Headphone Jack"); | 78 | snd_soc_dapm_disable_pin(codec, "Headphone Jack"); |
79 | snd_soc_dapm_disable_pin(codec, "Headset Jack"); | 79 | snd_soc_dapm_disable_pin(codec, "Headset Jack"); |
80 | break; | 80 | break; |
81 | case CORGI_HEADSET: | 81 | case CORGI_HEADSET: |
82 | reset_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_MUTE_L); | 82 | gpio_set_value(CORGI_GPIO_MUTE_L, 0); |
83 | set_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_MUTE_R); | 83 | gpio_set_value(CORGI_GPIO_MUTE_R, 1); |
84 | snd_soc_dapm_enable_pin(codec, "Mic Jack"); | 84 | snd_soc_dapm_enable_pin(codec, "Mic Jack"); |
85 | snd_soc_dapm_disable_pin(codec, "Line Jack"); | 85 | snd_soc_dapm_disable_pin(codec, "Line Jack"); |
86 | snd_soc_dapm_disable_pin(codec, "Headphone Jack"); | 86 | snd_soc_dapm_disable_pin(codec, "Headphone Jack"); |
@@ -114,8 +114,8 @@ static int corgi_shutdown(struct snd_pcm_substream *substream) | |||
114 | struct snd_soc_codec *codec = rtd->socdev->codec; | 114 | struct snd_soc_codec *codec = rtd->socdev->codec; |
115 | 115 | ||
116 | /* set = unmute headphone */ | 116 | /* set = unmute headphone */ |
117 | set_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_MUTE_L); | 117 | gpio_set_value(CORGI_GPIO_MUTE_L, 1); |
118 | set_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_MUTE_R); | 118 | gpio_set_value(CORGI_GPIO_MUTE_R, 1); |
119 | return 0; | 119 | return 0; |
120 | } | 120 | } |
121 | 121 | ||
@@ -218,22 +218,14 @@ static int corgi_set_spk(struct snd_kcontrol *kcontrol, | |||
218 | static int corgi_amp_event(struct snd_soc_dapm_widget *w, | 218 | static int corgi_amp_event(struct snd_soc_dapm_widget *w, |
219 | struct snd_kcontrol *k, int event) | 219 | struct snd_kcontrol *k, int event) |
220 | { | 220 | { |
221 | if (SND_SOC_DAPM_EVENT_ON(event)) | 221 | gpio_set_value(CORGI_GPIO_APM_ON, SND_SOC_DAPM_EVENT_ON(event)); |
222 | set_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_APM_ON); | ||
223 | else | ||
224 | reset_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_APM_ON); | ||
225 | |||
226 | return 0; | 222 | return 0; |
227 | } | 223 | } |
228 | 224 | ||
229 | static int corgi_mic_event(struct snd_soc_dapm_widget *w, | 225 | static int corgi_mic_event(struct snd_soc_dapm_widget *w, |
230 | struct snd_kcontrol *k, int event) | 226 | struct snd_kcontrol *k, int event) |
231 | { | 227 | { |
232 | if (SND_SOC_DAPM_EVENT_ON(event)) | 228 | gpio_set_value(CORGI_GPIO_MIC_BIAS, SND_SOC_DAPM_EVENT_ON(event)); |
233 | set_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_MIC_BIAS); | ||
234 | else | ||
235 | reset_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_MIC_BIAS); | ||
236 | |||
237 | return 0; | 229 | return 0; |
238 | } | 230 | } |
239 | 231 | ||
diff --git a/sound/soc/pxa/pxa2xx-ac97.c b/sound/soc/pxa/pxa2xx-ac97.c index a80ae074b090..a7a3a9c5c6ff 100644 --- a/sound/soc/pxa/pxa2xx-ac97.c +++ b/sound/soc/pxa/pxa2xx-ac97.c | |||
@@ -49,7 +49,7 @@ struct snd_ac97_bus_ops soc_ac97_ops = { | |||
49 | static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_stereo_out = { | 49 | static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_stereo_out = { |
50 | .name = "AC97 PCM Stereo out", | 50 | .name = "AC97 PCM Stereo out", |
51 | .dev_addr = __PREG(PCDR), | 51 | .dev_addr = __PREG(PCDR), |
52 | .drcmr = &DRCMRTXPCDR, | 52 | .drcmr = &DRCMR(12), |
53 | .dcmd = DCMD_INCSRCADDR | DCMD_FLOWTRG | | 53 | .dcmd = DCMD_INCSRCADDR | DCMD_FLOWTRG | |
54 | DCMD_BURST32 | DCMD_WIDTH4, | 54 | DCMD_BURST32 | DCMD_WIDTH4, |
55 | }; | 55 | }; |
@@ -57,7 +57,7 @@ static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_stereo_out = { | |||
57 | static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_stereo_in = { | 57 | static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_stereo_in = { |
58 | .name = "AC97 PCM Stereo in", | 58 | .name = "AC97 PCM Stereo in", |
59 | .dev_addr = __PREG(PCDR), | 59 | .dev_addr = __PREG(PCDR), |
60 | .drcmr = &DRCMRRXPCDR, | 60 | .drcmr = &DRCMR(11), |
61 | .dcmd = DCMD_INCTRGADDR | DCMD_FLOWSRC | | 61 | .dcmd = DCMD_INCTRGADDR | DCMD_FLOWSRC | |
62 | DCMD_BURST32 | DCMD_WIDTH4, | 62 | DCMD_BURST32 | DCMD_WIDTH4, |
63 | }; | 63 | }; |
@@ -65,7 +65,7 @@ static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_stereo_in = { | |||
65 | static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_aux_mono_out = { | 65 | static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_aux_mono_out = { |
66 | .name = "AC97 Aux PCM (Slot 5) Mono out", | 66 | .name = "AC97 Aux PCM (Slot 5) Mono out", |
67 | .dev_addr = __PREG(MODR), | 67 | .dev_addr = __PREG(MODR), |
68 | .drcmr = &DRCMRTXMODR, | 68 | .drcmr = &DRCMR(10), |
69 | .dcmd = DCMD_INCSRCADDR | DCMD_FLOWTRG | | 69 | .dcmd = DCMD_INCSRCADDR | DCMD_FLOWTRG | |
70 | DCMD_BURST16 | DCMD_WIDTH2, | 70 | DCMD_BURST16 | DCMD_WIDTH2, |
71 | }; | 71 | }; |
@@ -73,7 +73,7 @@ static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_aux_mono_out = { | |||
73 | static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_aux_mono_in = { | 73 | static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_aux_mono_in = { |
74 | .name = "AC97 Aux PCM (Slot 5) Mono in", | 74 | .name = "AC97 Aux PCM (Slot 5) Mono in", |
75 | .dev_addr = __PREG(MODR), | 75 | .dev_addr = __PREG(MODR), |
76 | .drcmr = &DRCMRRXMODR, | 76 | .drcmr = &DRCMR(9), |
77 | .dcmd = DCMD_INCTRGADDR | DCMD_FLOWSRC | | 77 | .dcmd = DCMD_INCTRGADDR | DCMD_FLOWSRC | |
78 | DCMD_BURST16 | DCMD_WIDTH2, | 78 | DCMD_BURST16 | DCMD_WIDTH2, |
79 | }; | 79 | }; |
@@ -81,7 +81,7 @@ static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_aux_mono_in = { | |||
81 | static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_mic_mono_in = { | 81 | static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_mic_mono_in = { |
82 | .name = "AC97 Mic PCM (Slot 6) Mono in", | 82 | .name = "AC97 Mic PCM (Slot 6) Mono in", |
83 | .dev_addr = __PREG(MCDR), | 83 | .dev_addr = __PREG(MCDR), |
84 | .drcmr = &DRCMRRXMCDR, | 84 | .drcmr = &DRCMR(8), |
85 | .dcmd = DCMD_INCTRGADDR | DCMD_FLOWSRC | | 85 | .dcmd = DCMD_INCTRGADDR | DCMD_FLOWSRC | |
86 | DCMD_BURST16 | DCMD_WIDTH2, | 86 | DCMD_BURST16 | DCMD_WIDTH2, |
87 | }; | 87 | }; |
diff --git a/sound/soc/pxa/pxa2xx-i2s.c b/sound/soc/pxa/pxa2xx-i2s.c index 64057b1d220d..e758034db5c3 100644 --- a/sound/soc/pxa/pxa2xx-i2s.c +++ b/sound/soc/pxa/pxa2xx-i2s.c | |||
@@ -39,6 +39,45 @@ struct pxa2xx_gpio { | |||
39 | u32 frm; | 39 | u32 frm; |
40 | }; | 40 | }; |
41 | 41 | ||
42 | /* | ||
43 | * I2S Controller Register and Bit Definitions | ||
44 | */ | ||
45 | #define SACR0 __REG(0x40400000) /* Global Control Register */ | ||
46 | #define SACR1 __REG(0x40400004) /* Serial Audio I 2 S/MSB-Justified Control Register */ | ||
47 | #define SASR0 __REG(0x4040000C) /* Serial Audio I 2 S/MSB-Justified Interface and FIFO Status Register */ | ||
48 | #define SAIMR __REG(0x40400014) /* Serial Audio Interrupt Mask Register */ | ||
49 | #define SAICR __REG(0x40400018) /* Serial Audio Interrupt Clear Register */ | ||
50 | #define SADIV __REG(0x40400060) /* Audio Clock Divider Register. */ | ||
51 | #define SADR __REG(0x40400080) /* Serial Audio Data Register (TX and RX FIFO access Register). */ | ||
52 | |||
53 | #define SACR0_RFTH(x) ((x) << 12) /* Rx FIFO Interrupt or DMA Trigger Threshold */ | ||
54 | #define SACR0_TFTH(x) ((x) << 8) /* Tx FIFO Interrupt or DMA Trigger Threshold */ | ||
55 | #define SACR0_STRF (1 << 5) /* FIFO Select for EFWR Special Function */ | ||
56 | #define SACR0_EFWR (1 << 4) /* Enable EFWR Function */ | ||
57 | #define SACR0_RST (1 << 3) /* FIFO, i2s Register Reset */ | ||
58 | #define SACR0_BCKD (1 << 2) /* Bit Clock Direction */ | ||
59 | #define SACR0_ENB (1 << 0) /* Enable I2S Link */ | ||
60 | #define SACR1_ENLBF (1 << 5) /* Enable Loopback */ | ||
61 | #define SACR1_DRPL (1 << 4) /* Disable Replaying Function */ | ||
62 | #define SACR1_DREC (1 << 3) /* Disable Recording Function */ | ||
63 | #define SACR1_AMSL (1 << 0) /* Specify Alternate Mode */ | ||
64 | |||
65 | #define SASR0_I2SOFF (1 << 7) /* Controller Status */ | ||
66 | #define SASR0_ROR (1 << 6) /* Rx FIFO Overrun */ | ||
67 | #define SASR0_TUR (1 << 5) /* Tx FIFO Underrun */ | ||
68 | #define SASR0_RFS (1 << 4) /* Rx FIFO Service Request */ | ||
69 | #define SASR0_TFS (1 << 3) /* Tx FIFO Service Request */ | ||
70 | #define SASR0_BSY (1 << 2) /* I2S Busy */ | ||
71 | #define SASR0_RNE (1 << 1) /* Rx FIFO Not Empty */ | ||
72 | #define SASR0_TNF (1 << 0) /* Tx FIFO Not Empty */ | ||
73 | |||
74 | #define SAICR_ROR (1 << 6) /* Clear Rx FIFO Overrun Interrupt */ | ||
75 | #define SAICR_TUR (1 << 5) /* Clear Tx FIFO Underrun Interrupt */ | ||
76 | |||
77 | #define SAIMR_ROR (1 << 6) /* Enable Rx FIFO Overrun Condition Interrupt */ | ||
78 | #define SAIMR_TUR (1 << 5) /* Enable Tx FIFO Underrun Condition Interrupt */ | ||
79 | #define SAIMR_RFS (1 << 4) /* Enable Rx FIFO Service Interrupt */ | ||
80 | #define SAIMR_TFS (1 << 3) /* Enable Tx FIFO Service Interrupt */ | ||
42 | 81 | ||
43 | struct pxa_i2s_port { | 82 | struct pxa_i2s_port { |
44 | u32 sadiv; | 83 | u32 sadiv; |
@@ -54,7 +93,7 @@ static struct clk *clk_i2s; | |||
54 | static struct pxa2xx_pcm_dma_params pxa2xx_i2s_pcm_stereo_out = { | 93 | static struct pxa2xx_pcm_dma_params pxa2xx_i2s_pcm_stereo_out = { |
55 | .name = "I2S PCM Stereo out", | 94 | .name = "I2S PCM Stereo out", |
56 | .dev_addr = __PREG(SADR), | 95 | .dev_addr = __PREG(SADR), |
57 | .drcmr = &DRCMRTXSADR, | 96 | .drcmr = &DRCMR(3), |
58 | .dcmd = DCMD_INCSRCADDR | DCMD_FLOWTRG | | 97 | .dcmd = DCMD_INCSRCADDR | DCMD_FLOWTRG | |
59 | DCMD_BURST32 | DCMD_WIDTH4, | 98 | DCMD_BURST32 | DCMD_WIDTH4, |
60 | }; | 99 | }; |
@@ -62,7 +101,7 @@ static struct pxa2xx_pcm_dma_params pxa2xx_i2s_pcm_stereo_out = { | |||
62 | static struct pxa2xx_pcm_dma_params pxa2xx_i2s_pcm_stereo_in = { | 101 | static struct pxa2xx_pcm_dma_params pxa2xx_i2s_pcm_stereo_in = { |
63 | .name = "I2S PCM Stereo in", | 102 | .name = "I2S PCM Stereo in", |
64 | .dev_addr = __PREG(SADR), | 103 | .dev_addr = __PREG(SADR), |
65 | .drcmr = &DRCMRRXSADR, | 104 | .drcmr = &DRCMR(2), |
66 | .dcmd = DCMD_INCTRGADDR | DCMD_FLOWSRC | | 105 | .dcmd = DCMD_INCTRGADDR | DCMD_FLOWSRC | |
67 | DCMD_BURST32 | DCMD_WIDTH4, | 106 | DCMD_BURST32 | DCMD_WIDTH4, |
68 | }; | 107 | }; |
diff --git a/sound/soc/pxa/spitz.c b/sound/soc/pxa/spitz.c index 8f89188e541e..d307b6757e95 100644 --- a/sound/soc/pxa/spitz.c +++ b/sound/soc/pxa/spitz.c | |||
@@ -19,16 +19,15 @@ | |||
19 | #include <linux/timer.h> | 19 | #include <linux/timer.h> |
20 | #include <linux/interrupt.h> | 20 | #include <linux/interrupt.h> |
21 | #include <linux/platform_device.h> | 21 | #include <linux/platform_device.h> |
22 | #include <linux/gpio.h> | ||
22 | #include <sound/core.h> | 23 | #include <sound/core.h> |
23 | #include <sound/pcm.h> | 24 | #include <sound/pcm.h> |
24 | #include <sound/soc.h> | 25 | #include <sound/soc.h> |
25 | #include <sound/soc-dapm.h> | 26 | #include <sound/soc-dapm.h> |
26 | 27 | ||
27 | #include <asm/mach-types.h> | 28 | #include <asm/mach-types.h> |
28 | #include <asm/hardware/scoop.h> | ||
29 | #include <mach/pxa-regs.h> | 29 | #include <mach/pxa-regs.h> |
30 | #include <mach/hardware.h> | 30 | #include <mach/hardware.h> |
31 | #include <mach/akita.h> | ||
32 | #include <mach/spitz.h> | 31 | #include <mach/spitz.h> |
33 | #include "../codecs/wm8750.h" | 32 | #include "../codecs/wm8750.h" |
34 | #include "pxa2xx-pcm.h" | 33 | #include "pxa2xx-pcm.h" |
@@ -63,8 +62,8 @@ static void spitz_ext_control(struct snd_soc_codec *codec) | |||
63 | snd_soc_dapm_disable_pin(codec, "Mic Jack"); | 62 | snd_soc_dapm_disable_pin(codec, "Mic Jack"); |
64 | snd_soc_dapm_disable_pin(codec, "Line Jack"); | 63 | snd_soc_dapm_disable_pin(codec, "Line Jack"); |
65 | snd_soc_dapm_enable_pin(codec, "Headphone Jack"); | 64 | snd_soc_dapm_enable_pin(codec, "Headphone Jack"); |
66 | set_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_MUTE_L); | 65 | gpio_set_value(SPITZ_GPIO_MUTE_L, 1); |
67 | set_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_MUTE_R); | 66 | gpio_set_value(SPITZ_GPIO_MUTE_R, 1); |
68 | break; | 67 | break; |
69 | case SPITZ_MIC: | 68 | case SPITZ_MIC: |
70 | /* enable mic jack and bias, mute hp */ | 69 | /* enable mic jack and bias, mute hp */ |
@@ -72,8 +71,8 @@ static void spitz_ext_control(struct snd_soc_codec *codec) | |||
72 | snd_soc_dapm_disable_pin(codec, "Headset Jack"); | 71 | snd_soc_dapm_disable_pin(codec, "Headset Jack"); |
73 | snd_soc_dapm_disable_pin(codec, "Line Jack"); | 72 | snd_soc_dapm_disable_pin(codec, "Line Jack"); |
74 | snd_soc_dapm_enable_pin(codec, "Mic Jack"); | 73 | snd_soc_dapm_enable_pin(codec, "Mic Jack"); |
75 | reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_MUTE_L); | 74 | gpio_set_value(SPITZ_GPIO_MUTE_L, 0); |
76 | reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_MUTE_R); | 75 | gpio_set_value(SPITZ_GPIO_MUTE_R, 0); |
77 | break; | 76 | break; |
78 | case SPITZ_LINE: | 77 | case SPITZ_LINE: |
79 | /* enable line jack, disable mic bias and mute hp */ | 78 | /* enable line jack, disable mic bias and mute hp */ |
@@ -81,8 +80,8 @@ static void spitz_ext_control(struct snd_soc_codec *codec) | |||
81 | snd_soc_dapm_disable_pin(codec, "Headset Jack"); | 80 | snd_soc_dapm_disable_pin(codec, "Headset Jack"); |
82 | snd_soc_dapm_disable_pin(codec, "Mic Jack"); | 81 | snd_soc_dapm_disable_pin(codec, "Mic Jack"); |
83 | snd_soc_dapm_enable_pin(codec, "Line Jack"); | 82 | snd_soc_dapm_enable_pin(codec, "Line Jack"); |
84 | reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_MUTE_L); | 83 | gpio_set_value(SPITZ_GPIO_MUTE_L, 0); |
85 | reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_MUTE_R); | 84 | gpio_set_value(SPITZ_GPIO_MUTE_R, 0); |
86 | break; | 85 | break; |
87 | case SPITZ_HEADSET: | 86 | case SPITZ_HEADSET: |
88 | /* enable and unmute headset jack enable mic bias, mute L hp */ | 87 | /* enable and unmute headset jack enable mic bias, mute L hp */ |
@@ -90,8 +89,8 @@ static void spitz_ext_control(struct snd_soc_codec *codec) | |||
90 | snd_soc_dapm_enable_pin(codec, "Mic Jack"); | 89 | snd_soc_dapm_enable_pin(codec, "Mic Jack"); |
91 | snd_soc_dapm_disable_pin(codec, "Line Jack"); | 90 | snd_soc_dapm_disable_pin(codec, "Line Jack"); |
92 | snd_soc_dapm_enable_pin(codec, "Headset Jack"); | 91 | snd_soc_dapm_enable_pin(codec, "Headset Jack"); |
93 | reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_MUTE_L); | 92 | gpio_set_value(SPITZ_GPIO_MUTE_L, 0); |
94 | set_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_MUTE_R); | 93 | gpio_set_value(SPITZ_GPIO_MUTE_R, 1); |
95 | break; | 94 | break; |
96 | case SPITZ_HP_OFF: | 95 | case SPITZ_HP_OFF: |
97 | 96 | ||
@@ -100,8 +99,8 @@ static void spitz_ext_control(struct snd_soc_codec *codec) | |||
100 | snd_soc_dapm_disable_pin(codec, "Headset Jack"); | 99 | snd_soc_dapm_disable_pin(codec, "Headset Jack"); |
101 | snd_soc_dapm_disable_pin(codec, "Mic Jack"); | 100 | snd_soc_dapm_disable_pin(codec, "Mic Jack"); |
102 | snd_soc_dapm_disable_pin(codec, "Line Jack"); | 101 | snd_soc_dapm_disable_pin(codec, "Line Jack"); |
103 | reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_MUTE_L); | 102 | gpio_set_value(SPITZ_GPIO_MUTE_L, 0); |
104 | reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_MUTE_R); | 103 | gpio_set_value(SPITZ_GPIO_MUTE_R, 0); |
105 | break; | 104 | break; |
106 | } | 105 | } |
107 | snd_soc_dapm_sync(codec); | 106 | snd_soc_dapm_sync(codec); |
@@ -215,23 +214,14 @@ static int spitz_set_spk(struct snd_kcontrol *kcontrol, | |||
215 | static int spitz_mic_bias(struct snd_soc_dapm_widget *w, | 214 | static int spitz_mic_bias(struct snd_soc_dapm_widget *w, |
216 | struct snd_kcontrol *k, int event) | 215 | struct snd_kcontrol *k, int event) |
217 | { | 216 | { |
218 | if (machine_is_borzoi() || machine_is_spitz()) { | 217 | if (machine_is_borzoi() || machine_is_spitz()) |
219 | if (SND_SOC_DAPM_EVENT_ON(event)) | 218 | gpio_set_value(SPITZ_GPIO_MIC_BIAS, |
220 | set_scoop_gpio(&spitzscoop2_device.dev, | 219 | SND_SOC_DAPM_EVENT_ON(event)); |
221 | SPITZ_SCP2_MIC_BIAS); | 220 | |
222 | else | 221 | if (machine_is_akita()) |
223 | reset_scoop_gpio(&spitzscoop2_device.dev, | 222 | gpio_set_value(AKITA_GPIO_MIC_BIAS, |
224 | SPITZ_SCP2_MIC_BIAS); | 223 | SND_SOC_DAPM_EVENT_ON(event)); |
225 | } | ||
226 | 224 | ||
227 | if (machine_is_akita()) { | ||
228 | if (SND_SOC_DAPM_EVENT_ON(event)) | ||
229 | akita_set_ioexp(&akitaioexp_device.dev, | ||
230 | AKITA_IOEXP_MIC_BIAS); | ||
231 | else | ||
232 | akita_reset_ioexp(&akitaioexp_device.dev, | ||
233 | AKITA_IOEXP_MIC_BIAS); | ||
234 | } | ||
235 | return 0; | 225 | return 0; |
236 | } | 226 | } |
237 | 227 | ||
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 462e635dfc74..a3adbf06b1e5 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -1462,7 +1462,7 @@ int snd_soc_info_volsw(struct snd_kcontrol *kcontrol, | |||
1462 | struct soc_mixer_control *mc = | 1462 | struct soc_mixer_control *mc = |
1463 | (struct soc_mixer_control *)kcontrol->private_value; | 1463 | (struct soc_mixer_control *)kcontrol->private_value; |
1464 | int max = mc->max; | 1464 | int max = mc->max; |
1465 | unsigned int shift = mc->min; | 1465 | unsigned int shift = mc->shift; |
1466 | unsigned int rshift = mc->rshift; | 1466 | unsigned int rshift = mc->rshift; |
1467 | 1467 | ||
1468 | if (max == 1) | 1468 | if (max == 1) |
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index efbd0b37810a..7351db9606e4 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c | |||
@@ -831,7 +831,7 @@ int snd_soc_dapm_sys_add(struct device *dev) | |||
831 | return ret; | 831 | return ret; |
832 | 832 | ||
833 | asoc_debugfs = debugfs_create_dir("asoc", NULL); | 833 | asoc_debugfs = debugfs_create_dir("asoc", NULL); |
834 | if (!IS_ERR(asoc_debugfs)) | 834 | if (!IS_ERR(asoc_debugfs) && asoc_debugfs) |
835 | debugfs_create_u32("dapm_pop_time", 0744, asoc_debugfs, | 835 | debugfs_create_u32("dapm_pop_time", 0744, asoc_debugfs, |
836 | &pop_time); | 836 | &pop_time); |
837 | else | 837 | else |
diff --git a/sound/sound_core.c b/sound/sound_core.c index ee66d43f848c..a75b289a5d78 100644 --- a/sound/sound_core.c +++ b/sound/sound_core.c | |||
@@ -220,9 +220,8 @@ static int sound_insert_unit(struct sound_unit **list, const struct file_operati | |||
220 | else | 220 | else |
221 | sprintf(s->name, "sound/%s%d", name, r / SOUND_STEP); | 221 | sprintf(s->name, "sound/%s%d", name, r / SOUND_STEP); |
222 | 222 | ||
223 | device_create_drvdata(sound_class, dev, | 223 | device_create(sound_class, dev, MKDEV(SOUND_MAJOR, s->unit_minor), |
224 | MKDEV(SOUND_MAJOR, s->unit_minor), | 224 | NULL, s->name+6); |
225 | NULL, s->name+6); | ||
226 | return r; | 225 | return r; |
227 | 226 | ||
228 | fail: | 227 | fail: |
diff --git a/sound/sparc/amd7930.c b/sound/sparc/amd7930.c index 49acee0c4840..f87933e48812 100644 --- a/sound/sparc/amd7930.c +++ b/sound/sparc/amd7930.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Driver for AMD7930 sound chips found on Sparcs. | 2 | * Driver for AMD7930 sound chips found on Sparcs. |
3 | * Copyright (C) 2002 David S. Miller <davem@redhat.com> | 3 | * Copyright (C) 2002, 2008 David S. Miller <davem@davemloft.net> |
4 | * | 4 | * |
5 | * Based entirely upon drivers/sbus/audio/amd7930.c which is: | 5 | * Based entirely upon drivers/sbus/audio/amd7930.c which is: |
6 | * Copyright (C) 1996,1997 Thomas K. Dyas (tdyas@eden.rutgers.edu) | 6 | * Copyright (C) 1996,1997 Thomas K. Dyas (tdyas@eden.rutgers.edu) |
@@ -35,6 +35,8 @@ | |||
35 | #include <linux/init.h> | 35 | #include <linux/init.h> |
36 | #include <linux/interrupt.h> | 36 | #include <linux/interrupt.h> |
37 | #include <linux/moduleparam.h> | 37 | #include <linux/moduleparam.h> |
38 | #include <linux/of.h> | ||
39 | #include <linux/of_device.h> | ||
38 | 40 | ||
39 | #include <sound/core.h> | 41 | #include <sound/core.h> |
40 | #include <sound/pcm.h> | 42 | #include <sound/pcm.h> |
@@ -44,7 +46,6 @@ | |||
44 | 46 | ||
45 | #include <asm/io.h> | 47 | #include <asm/io.h> |
46 | #include <asm/irq.h> | 48 | #include <asm/irq.h> |
47 | #include <asm/sbus.h> | ||
48 | #include <asm/prom.h> | 49 | #include <asm/prom.h> |
49 | 50 | ||
50 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ | 51 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ |
@@ -335,8 +336,8 @@ struct snd_amd7930 { | |||
335 | int pgain; | 336 | int pgain; |
336 | int mgain; | 337 | int mgain; |
337 | 338 | ||
339 | struct of_device *op; | ||
338 | unsigned int irq; | 340 | unsigned int irq; |
339 | unsigned int regs_size; | ||
340 | struct snd_amd7930 *next; | 341 | struct snd_amd7930 *next; |
341 | }; | 342 | }; |
342 | 343 | ||
@@ -905,13 +906,16 @@ static int __devinit snd_amd7930_mixer(struct snd_amd7930 *amd) | |||
905 | 906 | ||
906 | static int snd_amd7930_free(struct snd_amd7930 *amd) | 907 | static int snd_amd7930_free(struct snd_amd7930 *amd) |
907 | { | 908 | { |
909 | struct of_device *op = amd->op; | ||
910 | |||
908 | amd7930_idle(amd); | 911 | amd7930_idle(amd); |
909 | 912 | ||
910 | if (amd->irq) | 913 | if (amd->irq) |
911 | free_irq(amd->irq, amd); | 914 | free_irq(amd->irq, amd); |
912 | 915 | ||
913 | if (amd->regs) | 916 | if (amd->regs) |
914 | sbus_iounmap(amd->regs, amd->regs_size); | 917 | of_iounmap(&op->resource[0], amd->regs, |
918 | resource_size(&op->resource[0])); | ||
915 | 919 | ||
916 | kfree(amd); | 920 | kfree(amd); |
917 | 921 | ||
@@ -930,13 +934,12 @@ static struct snd_device_ops snd_amd7930_dev_ops = { | |||
930 | }; | 934 | }; |
931 | 935 | ||
932 | static int __devinit snd_amd7930_create(struct snd_card *card, | 936 | static int __devinit snd_amd7930_create(struct snd_card *card, |
933 | struct resource *rp, | 937 | struct of_device *op, |
934 | unsigned int reg_size, | ||
935 | int irq, int dev, | 938 | int irq, int dev, |
936 | struct snd_amd7930 **ramd) | 939 | struct snd_amd7930 **ramd) |
937 | { | 940 | { |
938 | unsigned long flags; | ||
939 | struct snd_amd7930 *amd; | 941 | struct snd_amd7930 *amd; |
942 | unsigned long flags; | ||
940 | int err; | 943 | int err; |
941 | 944 | ||
942 | *ramd = NULL; | 945 | *ramd = NULL; |
@@ -946,9 +949,10 @@ static int __devinit snd_amd7930_create(struct snd_card *card, | |||
946 | 949 | ||
947 | spin_lock_init(&amd->lock); | 950 | spin_lock_init(&amd->lock); |
948 | amd->card = card; | 951 | amd->card = card; |
949 | amd->regs_size = reg_size; | 952 | amd->op = op; |
950 | 953 | ||
951 | amd->regs = sbus_ioremap(rp, 0, amd->regs_size, "amd7930"); | 954 | amd->regs = of_ioremap(&op->resource[0], 0, |
955 | resource_size(&op->resource[0]), "amd7930"); | ||
952 | if (!amd->regs) { | 956 | if (!amd->regs) { |
953 | snd_printk("amd7930-%d: Unable to map chip registers.\n", dev); | 957 | snd_printk("amd7930-%d: Unable to map chip registers.\n", dev); |
954 | return -EIO; | 958 | return -EIO; |
@@ -997,12 +1001,15 @@ static int __devinit snd_amd7930_create(struct snd_card *card, | |||
997 | return 0; | 1001 | return 0; |
998 | } | 1002 | } |
999 | 1003 | ||
1000 | static int __devinit amd7930_attach_common(struct resource *rp, int irq) | 1004 | static int __devinit amd7930_sbus_probe(struct of_device *op, const struct of_device_id *match) |
1001 | { | 1005 | { |
1006 | struct resource *rp = &op->resource[0]; | ||
1002 | static int dev_num; | 1007 | static int dev_num; |
1003 | struct snd_card *card; | 1008 | struct snd_card *card; |
1004 | struct snd_amd7930 *amd; | 1009 | struct snd_amd7930 *amd; |
1005 | int err; | 1010 | int err, irq; |
1011 | |||
1012 | irq = op->irqs[0]; | ||
1006 | 1013 | ||
1007 | if (dev_num >= SNDRV_CARDS) | 1014 | if (dev_num >= SNDRV_CARDS) |
1008 | return -ENODEV; | 1015 | return -ENODEV; |
@@ -1023,8 +1030,7 @@ static int __devinit amd7930_attach_common(struct resource *rp, int irq) | |||
1023 | (unsigned long long)rp->start, | 1030 | (unsigned long long)rp->start, |
1024 | irq); | 1031 | irq); |
1025 | 1032 | ||
1026 | if ((err = snd_amd7930_create(card, rp, | 1033 | if ((err = snd_amd7930_create(card, op, |
1027 | (rp->end - rp->start) + 1, | ||
1028 | irq, dev_num, &amd)) < 0) | 1034 | irq, dev_num, &amd)) < 0) |
1029 | goto out_err; | 1035 | goto out_err; |
1030 | 1036 | ||
@@ -1049,43 +1055,7 @@ out_err: | |||
1049 | return err; | 1055 | return err; |
1050 | } | 1056 | } |
1051 | 1057 | ||
1052 | static int __devinit amd7930_obio_attach(struct device_node *dp) | 1058 | static const struct of_device_id amd7930_match[] = { |
1053 | { | ||
1054 | const struct linux_prom_registers *regs; | ||
1055 | const struct linux_prom_irqs *irqp; | ||
1056 | struct resource res, *rp; | ||
1057 | int len; | ||
1058 | |||
1059 | irqp = of_get_property(dp, "intr", &len); | ||
1060 | if (!irqp) { | ||
1061 | snd_printk("%s: Firmware node lacks IRQ property.\n", | ||
1062 | dp->full_name); | ||
1063 | return -ENODEV; | ||
1064 | } | ||
1065 | |||
1066 | regs = of_get_property(dp, "reg", &len); | ||
1067 | if (!regs) { | ||
1068 | snd_printk("%s: Firmware node lacks register property.\n", | ||
1069 | dp->full_name); | ||
1070 | return -ENODEV; | ||
1071 | } | ||
1072 | |||
1073 | rp = &res; | ||
1074 | rp->start = regs->phys_addr; | ||
1075 | rp->end = rp->start + regs->reg_size - 1; | ||
1076 | rp->flags = IORESOURCE_IO | (regs->which_io & 0xff); | ||
1077 | |||
1078 | return amd7930_attach_common(rp, irqp->pri); | ||
1079 | } | ||
1080 | |||
1081 | static int __devinit amd7930_sbus_probe(struct of_device *dev, const struct of_device_id *match) | ||
1082 | { | ||
1083 | struct sbus_dev *sdev = to_sbus_device(&dev->dev); | ||
1084 | |||
1085 | return amd7930_attach_common(&sdev->resource[0], sdev->irqs[0]); | ||
1086 | } | ||
1087 | |||
1088 | static struct of_device_id amd7930_match[] = { | ||
1089 | { | 1059 | { |
1090 | .name = "audio", | 1060 | .name = "audio", |
1091 | }, | 1061 | }, |
@@ -1100,20 +1070,7 @@ static struct of_platform_driver amd7930_sbus_driver = { | |||
1100 | 1070 | ||
1101 | static int __init amd7930_init(void) | 1071 | static int __init amd7930_init(void) |
1102 | { | 1072 | { |
1103 | struct device_node *dp; | 1073 | return of_register_driver(&amd7930_sbus_driver, &of_bus_type); |
1104 | |||
1105 | /* Try to find the sun4c "audio" node first. */ | ||
1106 | dp = of_find_node_by_path("/"); | ||
1107 | dp = dp->child; | ||
1108 | while (dp) { | ||
1109 | if (!strcmp(dp->name, "audio")) | ||
1110 | amd7930_obio_attach(dp); | ||
1111 | |||
1112 | dp = dp->sibling; | ||
1113 | } | ||
1114 | |||
1115 | /* Probe each SBUS for amd7930 chips. */ | ||
1116 | return of_register_driver(&amd7930_sbus_driver, &sbus_bus_type); | ||
1117 | } | 1074 | } |
1118 | 1075 | ||
1119 | static void __exit amd7930_exit(void) | 1076 | static void __exit amd7930_exit(void) |
diff --git a/sound/sparc/cs4231.c b/sound/sparc/cs4231.c index 791d2fb821d1..d44bf98e965e 100644 --- a/sound/sparc/cs4231.c +++ b/sound/sparc/cs4231.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Driver for CS4231 sound chips found on Sparcs. | 2 | * Driver for CS4231 sound chips found on Sparcs. |
3 | * Copyright (C) 2002 David S. Miller <davem@redhat.com> | 3 | * Copyright (C) 2002, 2008 David S. Miller <davem@davemloft.net> |
4 | * | 4 | * |
5 | * Based entirely upon drivers/sbus/audio/cs4231.c which is: | 5 | * Based entirely upon drivers/sbus/audio/cs4231.c which is: |
6 | * Copyright (C) 1996, 1997, 1998 Derrick J Brashear (shadow@andrew.cmu.edu) | 6 | * Copyright (C) 1996, 1997, 1998 Derrick J Brashear (shadow@andrew.cmu.edu) |
@@ -17,7 +17,8 @@ | |||
17 | #include <linux/moduleparam.h> | 17 | #include <linux/moduleparam.h> |
18 | #include <linux/irq.h> | 18 | #include <linux/irq.h> |
19 | #include <linux/io.h> | 19 | #include <linux/io.h> |
20 | 20 | #include <linux/of.h> | |
21 | #include <linux/of_device.h> | ||
21 | 22 | ||
22 | #include <sound/core.h> | 23 | #include <sound/core.h> |
23 | #include <sound/pcm.h> | 24 | #include <sound/pcm.h> |
@@ -29,13 +30,12 @@ | |||
29 | 30 | ||
30 | #ifdef CONFIG_SBUS | 31 | #ifdef CONFIG_SBUS |
31 | #define SBUS_SUPPORT | 32 | #define SBUS_SUPPORT |
32 | #include <asm/sbus.h> | ||
33 | #endif | 33 | #endif |
34 | 34 | ||
35 | #if defined(CONFIG_PCI) && defined(CONFIG_SPARC64) | 35 | #if defined(CONFIG_PCI) && defined(CONFIG_SPARC64) |
36 | #define EBUS_SUPPORT | 36 | #define EBUS_SUPPORT |
37 | #include <linux/pci.h> | 37 | #include <linux/pci.h> |
38 | #include <asm/ebus.h> | 38 | #include <asm/ebus_dma.h> |
39 | #endif | 39 | #endif |
40 | 40 | ||
41 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ | 41 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ |
@@ -70,8 +70,6 @@ struct cs4231_dma_control { | |||
70 | int (*request)(struct cs4231_dma_control *dma_cont, | 70 | int (*request)(struct cs4231_dma_control *dma_cont, |
71 | dma_addr_t bus_addr, size_t len); | 71 | dma_addr_t bus_addr, size_t len); |
72 | unsigned int (*address)(struct cs4231_dma_control *dma_cont); | 72 | unsigned int (*address)(struct cs4231_dma_control *dma_cont); |
73 | void (*preallocate)(struct snd_cs4231 *chip, | ||
74 | struct snd_pcm *pcm); | ||
75 | #ifdef EBUS_SUPPORT | 73 | #ifdef EBUS_SUPPORT |
76 | struct ebus_dma_info ebus_info; | 74 | struct ebus_dma_info ebus_info; |
77 | #endif | 75 | #endif |
@@ -114,21 +112,12 @@ struct snd_cs4231 { | |||
114 | struct mutex mce_mutex; /* mutex for mce register */ | 112 | struct mutex mce_mutex; /* mutex for mce register */ |
115 | struct mutex open_mutex; /* mutex for ALSA open/close */ | 113 | struct mutex open_mutex; /* mutex for ALSA open/close */ |
116 | 114 | ||
117 | union { | 115 | struct of_device *op; |
118 | #ifdef SBUS_SUPPORT | ||
119 | struct sbus_dev *sdev; | ||
120 | #endif | ||
121 | #ifdef EBUS_SUPPORT | ||
122 | struct pci_dev *pdev; | ||
123 | #endif | ||
124 | } dev_u; | ||
125 | unsigned int irq[2]; | 116 | unsigned int irq[2]; |
126 | unsigned int regs_size; | 117 | unsigned int regs_size; |
127 | struct snd_cs4231 *next; | 118 | struct snd_cs4231 *next; |
128 | }; | 119 | }; |
129 | 120 | ||
130 | static struct snd_cs4231 *cs4231_list; | ||
131 | |||
132 | /* Eventually we can use sound/isa/cs423x/cs4231_lib.c directly, but for | 121 | /* Eventually we can use sound/isa/cs423x/cs4231_lib.c directly, but for |
133 | * now.... -DaveM | 122 | * now.... -DaveM |
134 | */ | 123 | */ |
@@ -267,27 +256,19 @@ static unsigned char snd_cs4231_original_image[32] = | |||
267 | 256 | ||
268 | static u8 __cs4231_readb(struct snd_cs4231 *cp, void __iomem *reg_addr) | 257 | static u8 __cs4231_readb(struct snd_cs4231 *cp, void __iomem *reg_addr) |
269 | { | 258 | { |
270 | #ifdef EBUS_SUPPORT | ||
271 | if (cp->flags & CS4231_FLAG_EBUS) | 259 | if (cp->flags & CS4231_FLAG_EBUS) |
272 | return readb(reg_addr); | 260 | return readb(reg_addr); |
273 | else | 261 | else |
274 | #endif | ||
275 | #ifdef SBUS_SUPPORT | ||
276 | return sbus_readb(reg_addr); | 262 | return sbus_readb(reg_addr); |
277 | #endif | ||
278 | } | 263 | } |
279 | 264 | ||
280 | static void __cs4231_writeb(struct snd_cs4231 *cp, u8 val, | 265 | static void __cs4231_writeb(struct snd_cs4231 *cp, u8 val, |
281 | void __iomem *reg_addr) | 266 | void __iomem *reg_addr) |
282 | { | 267 | { |
283 | #ifdef EBUS_SUPPORT | ||
284 | if (cp->flags & CS4231_FLAG_EBUS) | 268 | if (cp->flags & CS4231_FLAG_EBUS) |
285 | return writeb(val, reg_addr); | 269 | return writeb(val, reg_addr); |
286 | else | 270 | else |
287 | #endif | ||
288 | #ifdef SBUS_SUPPORT | ||
289 | return sbus_writeb(val, reg_addr); | 271 | return sbus_writeb(val, reg_addr); |
290 | #endif | ||
291 | } | 272 | } |
292 | 273 | ||
293 | /* | 274 | /* |
@@ -1258,7 +1239,9 @@ static int __init snd_cs4231_pcm(struct snd_card *card) | |||
1258 | pcm->info_flags = SNDRV_PCM_INFO_JOINT_DUPLEX; | 1239 | pcm->info_flags = SNDRV_PCM_INFO_JOINT_DUPLEX; |
1259 | strcpy(pcm->name, "CS4231"); | 1240 | strcpy(pcm->name, "CS4231"); |
1260 | 1241 | ||
1261 | chip->p_dma.preallocate(chip, pcm); | 1242 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
1243 | &chip->op->dev, | ||
1244 | 64 * 1024, 128 * 1024); | ||
1262 | 1245 | ||
1263 | chip->pcm = pcm; | 1246 | chip->pcm = pcm; |
1264 | 1247 | ||
@@ -1627,8 +1610,7 @@ static int __init cs4231_attach_finish(struct snd_card *card) | |||
1627 | if (err < 0) | 1610 | if (err < 0) |
1628 | goto out_err; | 1611 | goto out_err; |
1629 | 1612 | ||
1630 | chip->next = cs4231_list; | 1613 | dev_set_drvdata(&chip->op->dev, chip); |
1631 | cs4231_list = chip; | ||
1632 | 1614 | ||
1633 | dev++; | 1615 | dev++; |
1634 | return 0; | 1616 | return 0; |
@@ -1783,24 +1765,19 @@ static unsigned int sbus_dma_addr(struct cs4231_dma_control *dma_cont) | |||
1783 | return sbus_readl(base->regs + base->dir + APCVA); | 1765 | return sbus_readl(base->regs + base->dir + APCVA); |
1784 | } | 1766 | } |
1785 | 1767 | ||
1786 | static void sbus_dma_preallocate(struct snd_cs4231 *chip, struct snd_pcm *pcm) | ||
1787 | { | ||
1788 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_SBUS, | ||
1789 | snd_dma_sbus_data(chip->dev_u.sdev), | ||
1790 | 64 * 1024, 128 * 1024); | ||
1791 | } | ||
1792 | |||
1793 | /* | 1768 | /* |
1794 | * Init and exit routines | 1769 | * Init and exit routines |
1795 | */ | 1770 | */ |
1796 | 1771 | ||
1797 | static int snd_cs4231_sbus_free(struct snd_cs4231 *chip) | 1772 | static int snd_cs4231_sbus_free(struct snd_cs4231 *chip) |
1798 | { | 1773 | { |
1774 | struct of_device *op = chip->op; | ||
1775 | |||
1799 | if (chip->irq[0]) | 1776 | if (chip->irq[0]) |
1800 | free_irq(chip->irq[0], chip); | 1777 | free_irq(chip->irq[0], chip); |
1801 | 1778 | ||
1802 | if (chip->port) | 1779 | if (chip->port) |
1803 | sbus_iounmap(chip->port, chip->regs_size); | 1780 | of_iounmap(&op->resource[0], chip->port, chip->regs_size); |
1804 | 1781 | ||
1805 | return 0; | 1782 | return 0; |
1806 | } | 1783 | } |
@@ -1817,7 +1794,7 @@ static struct snd_device_ops snd_cs4231_sbus_dev_ops = { | |||
1817 | }; | 1794 | }; |
1818 | 1795 | ||
1819 | static int __init snd_cs4231_sbus_create(struct snd_card *card, | 1796 | static int __init snd_cs4231_sbus_create(struct snd_card *card, |
1820 | struct sbus_dev *sdev, | 1797 | struct of_device *op, |
1821 | int dev) | 1798 | int dev) |
1822 | { | 1799 | { |
1823 | struct snd_cs4231 *chip = card->private_data; | 1800 | struct snd_cs4231 *chip = card->private_data; |
@@ -1828,13 +1805,13 @@ static int __init snd_cs4231_sbus_create(struct snd_card *card, | |||
1828 | spin_lock_init(&chip->p_dma.sbus_info.lock); | 1805 | spin_lock_init(&chip->p_dma.sbus_info.lock); |
1829 | mutex_init(&chip->mce_mutex); | 1806 | mutex_init(&chip->mce_mutex); |
1830 | mutex_init(&chip->open_mutex); | 1807 | mutex_init(&chip->open_mutex); |
1831 | chip->dev_u.sdev = sdev; | 1808 | chip->op = op; |
1832 | chip->regs_size = sdev->reg_addrs[0].reg_size; | 1809 | chip->regs_size = resource_size(&op->resource[0]); |
1833 | memcpy(&chip->image, &snd_cs4231_original_image, | 1810 | memcpy(&chip->image, &snd_cs4231_original_image, |
1834 | sizeof(snd_cs4231_original_image)); | 1811 | sizeof(snd_cs4231_original_image)); |
1835 | 1812 | ||
1836 | chip->port = sbus_ioremap(&sdev->resource[0], 0, | 1813 | chip->port = of_ioremap(&op->resource[0], 0, |
1837 | chip->regs_size, "cs4231"); | 1814 | chip->regs_size, "cs4231"); |
1838 | if (!chip->port) { | 1815 | if (!chip->port) { |
1839 | snd_printdd("cs4231-%d: Unable to map chip registers.\n", dev); | 1816 | snd_printdd("cs4231-%d: Unable to map chip registers.\n", dev); |
1840 | return -EIO; | 1817 | return -EIO; |
@@ -1849,22 +1826,20 @@ static int __init snd_cs4231_sbus_create(struct snd_card *card, | |||
1849 | chip->p_dma.enable = sbus_dma_enable; | 1826 | chip->p_dma.enable = sbus_dma_enable; |
1850 | chip->p_dma.request = sbus_dma_request; | 1827 | chip->p_dma.request = sbus_dma_request; |
1851 | chip->p_dma.address = sbus_dma_addr; | 1828 | chip->p_dma.address = sbus_dma_addr; |
1852 | chip->p_dma.preallocate = sbus_dma_preallocate; | ||
1853 | 1829 | ||
1854 | chip->c_dma.prepare = sbus_dma_prepare; | 1830 | chip->c_dma.prepare = sbus_dma_prepare; |
1855 | chip->c_dma.enable = sbus_dma_enable; | 1831 | chip->c_dma.enable = sbus_dma_enable; |
1856 | chip->c_dma.request = sbus_dma_request; | 1832 | chip->c_dma.request = sbus_dma_request; |
1857 | chip->c_dma.address = sbus_dma_addr; | 1833 | chip->c_dma.address = sbus_dma_addr; |
1858 | chip->c_dma.preallocate = sbus_dma_preallocate; | ||
1859 | 1834 | ||
1860 | if (request_irq(sdev->irqs[0], snd_cs4231_sbus_interrupt, | 1835 | if (request_irq(op->irqs[0], snd_cs4231_sbus_interrupt, |
1861 | IRQF_SHARED, "cs4231", chip)) { | 1836 | IRQF_SHARED, "cs4231", chip)) { |
1862 | snd_printdd("cs4231-%d: Unable to grab SBUS IRQ %d\n", | 1837 | snd_printdd("cs4231-%d: Unable to grab SBUS IRQ %d\n", |
1863 | dev, sdev->irqs[0]); | 1838 | dev, op->irqs[0]); |
1864 | snd_cs4231_sbus_free(chip); | 1839 | snd_cs4231_sbus_free(chip); |
1865 | return -EBUSY; | 1840 | return -EBUSY; |
1866 | } | 1841 | } |
1867 | chip->irq[0] = sdev->irqs[0]; | 1842 | chip->irq[0] = op->irqs[0]; |
1868 | 1843 | ||
1869 | if (snd_cs4231_probe(chip) < 0) { | 1844 | if (snd_cs4231_probe(chip) < 0) { |
1870 | snd_cs4231_sbus_free(chip); | 1845 | snd_cs4231_sbus_free(chip); |
@@ -1881,9 +1856,9 @@ static int __init snd_cs4231_sbus_create(struct snd_card *card, | |||
1881 | return 0; | 1856 | return 0; |
1882 | } | 1857 | } |
1883 | 1858 | ||
1884 | static int __init cs4231_sbus_attach(struct sbus_dev *sdev) | 1859 | static int __devinit cs4231_sbus_probe(struct of_device *op, const struct of_device_id *match) |
1885 | { | 1860 | { |
1886 | struct resource *rp = &sdev->resource[0]; | 1861 | struct resource *rp = &op->resource[0]; |
1887 | struct snd_card *card; | 1862 | struct snd_card *card; |
1888 | int err; | 1863 | int err; |
1889 | 1864 | ||
@@ -1895,9 +1870,9 @@ static int __init cs4231_sbus_attach(struct sbus_dev *sdev) | |||
1895 | card->shortname, | 1870 | card->shortname, |
1896 | rp->flags & 0xffL, | 1871 | rp->flags & 0xffL, |
1897 | (unsigned long long)rp->start, | 1872 | (unsigned long long)rp->start, |
1898 | sdev->irqs[0]); | 1873 | op->irqs[0]); |
1899 | 1874 | ||
1900 | err = snd_cs4231_sbus_create(card, sdev, dev); | 1875 | err = snd_cs4231_sbus_create(card, op, dev); |
1901 | if (err < 0) { | 1876 | if (err < 0) { |
1902 | snd_card_free(card); | 1877 | snd_card_free(card); |
1903 | return err; | 1878 | return err; |
@@ -1950,30 +1925,25 @@ static unsigned int _ebus_dma_addr(struct cs4231_dma_control *dma_cont) | |||
1950 | return ebus_dma_addr(&dma_cont->ebus_info); | 1925 | return ebus_dma_addr(&dma_cont->ebus_info); |
1951 | } | 1926 | } |
1952 | 1927 | ||
1953 | static void _ebus_dma_preallocate(struct snd_cs4231 *chip, struct snd_pcm *pcm) | ||
1954 | { | ||
1955 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | ||
1956 | snd_dma_pci_data(chip->dev_u.pdev), | ||
1957 | 64*1024, 128*1024); | ||
1958 | } | ||
1959 | |||
1960 | /* | 1928 | /* |
1961 | * Init and exit routines | 1929 | * Init and exit routines |
1962 | */ | 1930 | */ |
1963 | 1931 | ||
1964 | static int snd_cs4231_ebus_free(struct snd_cs4231 *chip) | 1932 | static int snd_cs4231_ebus_free(struct snd_cs4231 *chip) |
1965 | { | 1933 | { |
1934 | struct of_device *op = chip->op; | ||
1935 | |||
1966 | if (chip->c_dma.ebus_info.regs) { | 1936 | if (chip->c_dma.ebus_info.regs) { |
1967 | ebus_dma_unregister(&chip->c_dma.ebus_info); | 1937 | ebus_dma_unregister(&chip->c_dma.ebus_info); |
1968 | iounmap(chip->c_dma.ebus_info.regs); | 1938 | of_iounmap(&op->resource[2], chip->c_dma.ebus_info.regs, 0x10); |
1969 | } | 1939 | } |
1970 | if (chip->p_dma.ebus_info.regs) { | 1940 | if (chip->p_dma.ebus_info.regs) { |
1971 | ebus_dma_unregister(&chip->p_dma.ebus_info); | 1941 | ebus_dma_unregister(&chip->p_dma.ebus_info); |
1972 | iounmap(chip->p_dma.ebus_info.regs); | 1942 | of_iounmap(&op->resource[1], chip->p_dma.ebus_info.regs, 0x10); |
1973 | } | 1943 | } |
1974 | 1944 | ||
1975 | if (chip->port) | 1945 | if (chip->port) |
1976 | iounmap(chip->port); | 1946 | of_iounmap(&op->resource[0], chip->port, 0x10); |
1977 | 1947 | ||
1978 | return 0; | 1948 | return 0; |
1979 | } | 1949 | } |
@@ -1990,7 +1960,7 @@ static struct snd_device_ops snd_cs4231_ebus_dev_ops = { | |||
1990 | }; | 1960 | }; |
1991 | 1961 | ||
1992 | static int __init snd_cs4231_ebus_create(struct snd_card *card, | 1962 | static int __init snd_cs4231_ebus_create(struct snd_card *card, |
1993 | struct linux_ebus_device *edev, | 1963 | struct of_device *op, |
1994 | int dev) | 1964 | int dev) |
1995 | { | 1965 | { |
1996 | struct snd_cs4231 *chip = card->private_data; | 1966 | struct snd_cs4231 *chip = card->private_data; |
@@ -2002,35 +1972,35 @@ static int __init snd_cs4231_ebus_create(struct snd_card *card, | |||
2002 | mutex_init(&chip->mce_mutex); | 1972 | mutex_init(&chip->mce_mutex); |
2003 | mutex_init(&chip->open_mutex); | 1973 | mutex_init(&chip->open_mutex); |
2004 | chip->flags |= CS4231_FLAG_EBUS; | 1974 | chip->flags |= CS4231_FLAG_EBUS; |
2005 | chip->dev_u.pdev = edev->bus->self; | 1975 | chip->op = op; |
2006 | memcpy(&chip->image, &snd_cs4231_original_image, | 1976 | memcpy(&chip->image, &snd_cs4231_original_image, |
2007 | sizeof(snd_cs4231_original_image)); | 1977 | sizeof(snd_cs4231_original_image)); |
2008 | strcpy(chip->c_dma.ebus_info.name, "cs4231(capture)"); | 1978 | strcpy(chip->c_dma.ebus_info.name, "cs4231(capture)"); |
2009 | chip->c_dma.ebus_info.flags = EBUS_DMA_FLAG_USE_EBDMA_HANDLER; | 1979 | chip->c_dma.ebus_info.flags = EBUS_DMA_FLAG_USE_EBDMA_HANDLER; |
2010 | chip->c_dma.ebus_info.callback = snd_cs4231_ebus_capture_callback; | 1980 | chip->c_dma.ebus_info.callback = snd_cs4231_ebus_capture_callback; |
2011 | chip->c_dma.ebus_info.client_cookie = chip; | 1981 | chip->c_dma.ebus_info.client_cookie = chip; |
2012 | chip->c_dma.ebus_info.irq = edev->irqs[0]; | 1982 | chip->c_dma.ebus_info.irq = op->irqs[0]; |
2013 | strcpy(chip->p_dma.ebus_info.name, "cs4231(play)"); | 1983 | strcpy(chip->p_dma.ebus_info.name, "cs4231(play)"); |
2014 | chip->p_dma.ebus_info.flags = EBUS_DMA_FLAG_USE_EBDMA_HANDLER; | 1984 | chip->p_dma.ebus_info.flags = EBUS_DMA_FLAG_USE_EBDMA_HANDLER; |
2015 | chip->p_dma.ebus_info.callback = snd_cs4231_ebus_play_callback; | 1985 | chip->p_dma.ebus_info.callback = snd_cs4231_ebus_play_callback; |
2016 | chip->p_dma.ebus_info.client_cookie = chip; | 1986 | chip->p_dma.ebus_info.client_cookie = chip; |
2017 | chip->p_dma.ebus_info.irq = edev->irqs[1]; | 1987 | chip->p_dma.ebus_info.irq = op->irqs[1]; |
2018 | 1988 | ||
2019 | chip->p_dma.prepare = _ebus_dma_prepare; | 1989 | chip->p_dma.prepare = _ebus_dma_prepare; |
2020 | chip->p_dma.enable = _ebus_dma_enable; | 1990 | chip->p_dma.enable = _ebus_dma_enable; |
2021 | chip->p_dma.request = _ebus_dma_request; | 1991 | chip->p_dma.request = _ebus_dma_request; |
2022 | chip->p_dma.address = _ebus_dma_addr; | 1992 | chip->p_dma.address = _ebus_dma_addr; |
2023 | chip->p_dma.preallocate = _ebus_dma_preallocate; | ||
2024 | 1993 | ||
2025 | chip->c_dma.prepare = _ebus_dma_prepare; | 1994 | chip->c_dma.prepare = _ebus_dma_prepare; |
2026 | chip->c_dma.enable = _ebus_dma_enable; | 1995 | chip->c_dma.enable = _ebus_dma_enable; |
2027 | chip->c_dma.request = _ebus_dma_request; | 1996 | chip->c_dma.request = _ebus_dma_request; |
2028 | chip->c_dma.address = _ebus_dma_addr; | 1997 | chip->c_dma.address = _ebus_dma_addr; |
2029 | chip->c_dma.preallocate = _ebus_dma_preallocate; | ||
2030 | 1998 | ||
2031 | chip->port = ioremap(edev->resource[0].start, 0x10); | 1999 | chip->port = of_ioremap(&op->resource[0], 0, 0x10, "cs4231"); |
2032 | chip->p_dma.ebus_info.regs = ioremap(edev->resource[1].start, 0x10); | 2000 | chip->p_dma.ebus_info.regs = |
2033 | chip->c_dma.ebus_info.regs = ioremap(edev->resource[2].start, 0x10); | 2001 | of_ioremap(&op->resource[1], 0, 0x10, "cs4231_pdma"); |
2002 | chip->c_dma.ebus_info.regs = | ||
2003 | of_ioremap(&op->resource[2], 0, 0x10, "cs4231_cdma"); | ||
2034 | if (!chip->port || !chip->p_dma.ebus_info.regs || | 2004 | if (!chip->port || !chip->p_dma.ebus_info.regs || |
2035 | !chip->c_dma.ebus_info.regs) { | 2005 | !chip->c_dma.ebus_info.regs) { |
2036 | snd_cs4231_ebus_free(chip); | 2006 | snd_cs4231_ebus_free(chip); |
@@ -2078,7 +2048,7 @@ static int __init snd_cs4231_ebus_create(struct snd_card *card, | |||
2078 | return 0; | 2048 | return 0; |
2079 | } | 2049 | } |
2080 | 2050 | ||
2081 | static int __init cs4231_ebus_attach(struct linux_ebus_device *edev) | 2051 | static int __devinit cs4231_ebus_probe(struct of_device *op, const struct of_device_id *match) |
2082 | { | 2052 | { |
2083 | struct snd_card *card; | 2053 | struct snd_card *card; |
2084 | int err; | 2054 | int err; |
@@ -2089,10 +2059,10 @@ static int __init cs4231_ebus_attach(struct linux_ebus_device *edev) | |||
2089 | 2059 | ||
2090 | sprintf(card->longname, "%s at 0x%lx, irq %d", | 2060 | sprintf(card->longname, "%s at 0x%lx, irq %d", |
2091 | card->shortname, | 2061 | card->shortname, |
2092 | edev->resource[0].start, | 2062 | op->resource[0].start, |
2093 | edev->irqs[0]); | 2063 | op->irqs[0]); |
2094 | 2064 | ||
2095 | err = snd_cs4231_ebus_create(card, edev, dev); | 2065 | err = snd_cs4231_ebus_create(card, op, dev); |
2096 | if (err < 0) { | 2066 | if (err < 0) { |
2097 | snd_card_free(card); | 2067 | snd_card_free(card); |
2098 | return err; | 2068 | return err; |
@@ -2102,68 +2072,57 @@ static int __init cs4231_ebus_attach(struct linux_ebus_device *edev) | |||
2102 | } | 2072 | } |
2103 | #endif | 2073 | #endif |
2104 | 2074 | ||
2105 | static int __init cs4231_init(void) | 2075 | static int __devinit cs4231_probe(struct of_device *op, const struct of_device_id *match) |
2106 | { | 2076 | { |
2107 | #ifdef SBUS_SUPPORT | ||
2108 | struct sbus_bus *sbus; | ||
2109 | struct sbus_dev *sdev; | ||
2110 | #endif | ||
2111 | #ifdef EBUS_SUPPORT | 2077 | #ifdef EBUS_SUPPORT |
2112 | struct linux_ebus *ebus; | 2078 | if (!strcmp(op->node->parent->name, "ebus")) |
2113 | struct linux_ebus_device *edev; | 2079 | return cs4231_ebus_probe(op, match); |
2114 | #endif | 2080 | #endif |
2115 | int found; | ||
2116 | |||
2117 | found = 0; | ||
2118 | |||
2119 | #ifdef SBUS_SUPPORT | 2081 | #ifdef SBUS_SUPPORT |
2120 | for_all_sbusdev(sdev, sbus) { | 2082 | if (!strcmp(op->node->parent->name, "sbus") || |
2121 | if (!strcmp(sdev->prom_name, "SUNW,CS4231")) { | 2083 | !strcmp(op->node->parent->name, "sbi")) |
2122 | if (cs4231_sbus_attach(sdev) == 0) | 2084 | return cs4231_sbus_probe(op, match); |
2123 | found++; | ||
2124 | } | ||
2125 | } | ||
2126 | #endif | 2085 | #endif |
2127 | #ifdef EBUS_SUPPORT | 2086 | return -ENODEV; |
2128 | for_each_ebus(ebus) { | 2087 | } |
2129 | for_each_ebusdev(edev, ebus) { | ||
2130 | int match = 0; | ||
2131 | |||
2132 | if (!strcmp(edev->prom_node->name, "SUNW,CS4231")) { | ||
2133 | match = 1; | ||
2134 | } else if (!strcmp(edev->prom_node->name, "audio")) { | ||
2135 | const char *compat; | ||
2136 | |||
2137 | compat = of_get_property(edev->prom_node, | ||
2138 | "compatible", NULL); | ||
2139 | if (compat && !strcmp(compat, "SUNW,CS4231")) | ||
2140 | match = 1; | ||
2141 | } | ||
2142 | 2088 | ||
2143 | if (match && | 2089 | static int __devexit cs4231_remove(struct of_device *op) |
2144 | cs4231_ebus_attach(edev) == 0) | 2090 | { |
2145 | found++; | 2091 | struct snd_cs4231 *chip = dev_get_drvdata(&op->dev); |
2146 | } | ||
2147 | } | ||
2148 | #endif | ||
2149 | 2092 | ||
2093 | snd_card_free(chip->card); | ||
2150 | 2094 | ||
2151 | return (found > 0) ? 0 : -EIO; | 2095 | return 0; |
2152 | } | 2096 | } |
2153 | 2097 | ||
2154 | static void __exit cs4231_exit(void) | 2098 | static const struct of_device_id cs4231_match[] = { |
2155 | { | 2099 | { |
2156 | struct snd_cs4231 *p = cs4231_list; | 2100 | .name = "SUNW,CS4231", |
2101 | }, | ||
2102 | { | ||
2103 | .name = "audio", | ||
2104 | .compatible = "SUNW,CS4231", | ||
2105 | }, | ||
2106 | {}, | ||
2107 | }; | ||
2157 | 2108 | ||
2158 | while (p != NULL) { | 2109 | MODULE_DEVICE_TABLE(of, cs4231_match); |
2159 | struct snd_cs4231 *next = p->next; | ||
2160 | 2110 | ||
2161 | snd_card_free(p->card); | 2111 | static struct of_platform_driver cs4231_driver = { |
2112 | .name = "audio", | ||
2113 | .match_table = cs4231_match, | ||
2114 | .probe = cs4231_probe, | ||
2115 | .remove = __devexit_p(cs4231_remove), | ||
2116 | }; | ||
2162 | 2117 | ||
2163 | p = next; | 2118 | static int __init cs4231_init(void) |
2164 | } | 2119 | { |
2120 | return of_register_driver(&cs4231_driver, &of_bus_type); | ||
2121 | } | ||
2165 | 2122 | ||
2166 | cs4231_list = NULL; | 2123 | static void __exit cs4231_exit(void) |
2124 | { | ||
2125 | of_unregister_driver(&cs4231_driver); | ||
2167 | } | 2126 | } |
2168 | 2127 | ||
2169 | module_init(cs4231_init); | 2128 | module_init(cs4231_init); |
diff --git a/sound/sparc/dbri.c b/sound/sparc/dbri.c index c534a2a849fa..c257ad8bdfbc 100644 --- a/sound/sparc/dbri.c +++ b/sound/sparc/dbri.c | |||
@@ -57,6 +57,7 @@ | |||
57 | #include <linux/delay.h> | 57 | #include <linux/delay.h> |
58 | #include <linux/irq.h> | 58 | #include <linux/irq.h> |
59 | #include <linux/io.h> | 59 | #include <linux/io.h> |
60 | #include <linux/dma-mapping.h> | ||
60 | 61 | ||
61 | #include <sound/core.h> | 62 | #include <sound/core.h> |
62 | #include <sound/pcm.h> | 63 | #include <sound/pcm.h> |
@@ -66,7 +67,7 @@ | |||
66 | #include <sound/initval.h> | 67 | #include <sound/initval.h> |
67 | 68 | ||
68 | #include <linux/of.h> | 69 | #include <linux/of.h> |
69 | #include <asm/sbus.h> | 70 | #include <linux/of_device.h> |
70 | #include <asm/atomic.h> | 71 | #include <asm/atomic.h> |
71 | 72 | ||
72 | MODULE_AUTHOR("Rudolf Koenig, Brent Baccala and Martin Habets"); | 73 | MODULE_AUTHOR("Rudolf Koenig, Brent Baccala and Martin Habets"); |
@@ -297,7 +298,7 @@ struct dbri_streaminfo { | |||
297 | /* This structure holds the information for both chips (DBRI & CS4215) */ | 298 | /* This structure holds the information for both chips (DBRI & CS4215) */ |
298 | struct snd_dbri { | 299 | struct snd_dbri { |
299 | int regs_size, irq; /* Needed for unload */ | 300 | int regs_size, irq; /* Needed for unload */ |
300 | struct sbus_dev *sdev; /* SBUS device info */ | 301 | struct of_device *op; /* OF device info */ |
301 | spinlock_t lock; | 302 | spinlock_t lock; |
302 | 303 | ||
303 | struct dbri_dma *dma; /* Pointer to our DMA block */ | 304 | struct dbri_dma *dma; /* Pointer to our DMA block */ |
@@ -2093,14 +2094,15 @@ static int snd_dbri_hw_params(struct snd_pcm_substream *substream, | |||
2093 | */ | 2094 | */ |
2094 | if (info->dvma_buffer == 0) { | 2095 | if (info->dvma_buffer == 0) { |
2095 | if (DBRI_STREAMNO(substream) == DBRI_PLAY) | 2096 | if (DBRI_STREAMNO(substream) == DBRI_PLAY) |
2096 | direction = SBUS_DMA_TODEVICE; | 2097 | direction = DMA_TO_DEVICE; |
2097 | else | 2098 | else |
2098 | direction = SBUS_DMA_FROMDEVICE; | 2099 | direction = DMA_FROM_DEVICE; |
2099 | 2100 | ||
2100 | info->dvma_buffer = sbus_map_single(dbri->sdev, | 2101 | info->dvma_buffer = |
2101 | runtime->dma_area, | 2102 | dma_map_single(&dbri->op->dev, |
2102 | params_buffer_bytes(hw_params), | 2103 | runtime->dma_area, |
2103 | direction); | 2104 | params_buffer_bytes(hw_params), |
2105 | direction); | ||
2104 | } | 2106 | } |
2105 | 2107 | ||
2106 | direction = params_buffer_bytes(hw_params); | 2108 | direction = params_buffer_bytes(hw_params); |
@@ -2121,12 +2123,12 @@ static int snd_dbri_hw_free(struct snd_pcm_substream *substream) | |||
2121 | */ | 2123 | */ |
2122 | if (info->dvma_buffer) { | 2124 | if (info->dvma_buffer) { |
2123 | if (DBRI_STREAMNO(substream) == DBRI_PLAY) | 2125 | if (DBRI_STREAMNO(substream) == DBRI_PLAY) |
2124 | direction = SBUS_DMA_TODEVICE; | 2126 | direction = DMA_TO_DEVICE; |
2125 | else | 2127 | else |
2126 | direction = SBUS_DMA_FROMDEVICE; | 2128 | direction = DMA_FROM_DEVICE; |
2127 | 2129 | ||
2128 | sbus_unmap_single(dbri->sdev, info->dvma_buffer, | 2130 | dma_unmap_single(&dbri->op->dev, info->dvma_buffer, |
2129 | substream->runtime->buffer_size, direction); | 2131 | substream->runtime->buffer_size, direction); |
2130 | info->dvma_buffer = 0; | 2132 | info->dvma_buffer = 0; |
2131 | } | 2133 | } |
2132 | if (info->pipe != -1) { | 2134 | if (info->pipe != -1) { |
@@ -2519,31 +2521,32 @@ static void __devinit snd_dbri_proc(struct snd_card *card) | |||
2519 | static void snd_dbri_free(struct snd_dbri *dbri); | 2521 | static void snd_dbri_free(struct snd_dbri *dbri); |
2520 | 2522 | ||
2521 | static int __devinit snd_dbri_create(struct snd_card *card, | 2523 | static int __devinit snd_dbri_create(struct snd_card *card, |
2522 | struct sbus_dev *sdev, | 2524 | struct of_device *op, |
2523 | int irq, int dev) | 2525 | int irq, int dev) |
2524 | { | 2526 | { |
2525 | struct snd_dbri *dbri = card->private_data; | 2527 | struct snd_dbri *dbri = card->private_data; |
2526 | int err; | 2528 | int err; |
2527 | 2529 | ||
2528 | spin_lock_init(&dbri->lock); | 2530 | spin_lock_init(&dbri->lock); |
2529 | dbri->sdev = sdev; | 2531 | dbri->op = op; |
2530 | dbri->irq = irq; | 2532 | dbri->irq = irq; |
2531 | 2533 | ||
2532 | dbri->dma = sbus_alloc_consistent(sdev, sizeof(struct dbri_dma), | 2534 | dbri->dma = dma_alloc_coherent(&op->dev, |
2533 | &dbri->dma_dvma); | 2535 | sizeof(struct dbri_dma), |
2536 | &dbri->dma_dvma, GFP_ATOMIC); | ||
2534 | memset((void *)dbri->dma, 0, sizeof(struct dbri_dma)); | 2537 | memset((void *)dbri->dma, 0, sizeof(struct dbri_dma)); |
2535 | 2538 | ||
2536 | dprintk(D_GEN, "DMA Cmd Block 0x%p (0x%08x)\n", | 2539 | dprintk(D_GEN, "DMA Cmd Block 0x%p (0x%08x)\n", |
2537 | dbri->dma, dbri->dma_dvma); | 2540 | dbri->dma, dbri->dma_dvma); |
2538 | 2541 | ||
2539 | /* Map the registers into memory. */ | 2542 | /* Map the registers into memory. */ |
2540 | dbri->regs_size = sdev->reg_addrs[0].reg_size; | 2543 | dbri->regs_size = resource_size(&op->resource[0]); |
2541 | dbri->regs = sbus_ioremap(&sdev->resource[0], 0, | 2544 | dbri->regs = of_ioremap(&op->resource[0], 0, |
2542 | dbri->regs_size, "DBRI Registers"); | 2545 | dbri->regs_size, "DBRI Registers"); |
2543 | if (!dbri->regs) { | 2546 | if (!dbri->regs) { |
2544 | printk(KERN_ERR "DBRI: could not allocate registers\n"); | 2547 | printk(KERN_ERR "DBRI: could not allocate registers\n"); |
2545 | sbus_free_consistent(sdev, sizeof(struct dbri_dma), | 2548 | dma_free_coherent(&op->dev, sizeof(struct dbri_dma), |
2546 | (void *)dbri->dma, dbri->dma_dvma); | 2549 | (void *)dbri->dma, dbri->dma_dvma); |
2547 | return -EIO; | 2550 | return -EIO; |
2548 | } | 2551 | } |
2549 | 2552 | ||
@@ -2551,9 +2554,9 @@ static int __devinit snd_dbri_create(struct snd_card *card, | |||
2551 | "DBRI audio", dbri); | 2554 | "DBRI audio", dbri); |
2552 | if (err) { | 2555 | if (err) { |
2553 | printk(KERN_ERR "DBRI: Can't get irq %d\n", dbri->irq); | 2556 | printk(KERN_ERR "DBRI: Can't get irq %d\n", dbri->irq); |
2554 | sbus_iounmap(dbri->regs, dbri->regs_size); | 2557 | of_iounmap(&op->resource[0], dbri->regs, dbri->regs_size); |
2555 | sbus_free_consistent(sdev, sizeof(struct dbri_dma), | 2558 | dma_free_coherent(&op->dev, sizeof(struct dbri_dma), |
2556 | (void *)dbri->dma, dbri->dma_dvma); | 2559 | (void *)dbri->dma, dbri->dma_dvma); |
2557 | return err; | 2560 | return err; |
2558 | } | 2561 | } |
2559 | 2562 | ||
@@ -2577,27 +2580,23 @@ static void snd_dbri_free(struct snd_dbri *dbri) | |||
2577 | free_irq(dbri->irq, dbri); | 2580 | free_irq(dbri->irq, dbri); |
2578 | 2581 | ||
2579 | if (dbri->regs) | 2582 | if (dbri->regs) |
2580 | sbus_iounmap(dbri->regs, dbri->regs_size); | 2583 | of_iounmap(&dbri->op->resource[0], dbri->regs, dbri->regs_size); |
2581 | 2584 | ||
2582 | if (dbri->dma) | 2585 | if (dbri->dma) |
2583 | sbus_free_consistent(dbri->sdev, sizeof(struct dbri_dma), | 2586 | dma_free_coherent(&dbri->op->dev, |
2584 | (void *)dbri->dma, dbri->dma_dvma); | 2587 | sizeof(struct dbri_dma), |
2588 | (void *)dbri->dma, dbri->dma_dvma); | ||
2585 | } | 2589 | } |
2586 | 2590 | ||
2587 | static int __devinit dbri_probe(struct of_device *of_dev, | 2591 | static int __devinit dbri_probe(struct of_device *op, const struct of_device_id *match) |
2588 | const struct of_device_id *match) | ||
2589 | { | 2592 | { |
2590 | struct sbus_dev *sdev = to_sbus_device(&of_dev->dev); | ||
2591 | struct snd_dbri *dbri; | 2593 | struct snd_dbri *dbri; |
2592 | int irq; | ||
2593 | struct resource *rp; | 2594 | struct resource *rp; |
2594 | struct snd_card *card; | 2595 | struct snd_card *card; |
2595 | static int dev = 0; | 2596 | static int dev = 0; |
2597 | int irq; | ||
2596 | int err; | 2598 | int err; |
2597 | 2599 | ||
2598 | dprintk(D_GEN, "DBRI: Found %s in SBUS slot %d\n", | ||
2599 | sdev->prom_name, sdev->slot); | ||
2600 | |||
2601 | if (dev >= SNDRV_CARDS) | 2600 | if (dev >= SNDRV_CARDS) |
2602 | return -ENODEV; | 2601 | return -ENODEV; |
2603 | if (!enable[dev]) { | 2602 | if (!enable[dev]) { |
@@ -2605,7 +2604,7 @@ static int __devinit dbri_probe(struct of_device *of_dev, | |||
2605 | return -ENOENT; | 2604 | return -ENOENT; |
2606 | } | 2605 | } |
2607 | 2606 | ||
2608 | irq = sdev->irqs[0]; | 2607 | irq = op->irqs[0]; |
2609 | if (irq <= 0) { | 2608 | if (irq <= 0) { |
2610 | printk(KERN_ERR "DBRI-%d: No IRQ.\n", dev); | 2609 | printk(KERN_ERR "DBRI-%d: No IRQ.\n", dev); |
2611 | return -ENODEV; | 2610 | return -ENODEV; |
@@ -2618,12 +2617,12 @@ static int __devinit dbri_probe(struct of_device *of_dev, | |||
2618 | 2617 | ||
2619 | strcpy(card->driver, "DBRI"); | 2618 | strcpy(card->driver, "DBRI"); |
2620 | strcpy(card->shortname, "Sun DBRI"); | 2619 | strcpy(card->shortname, "Sun DBRI"); |
2621 | rp = &sdev->resource[0]; | 2620 | rp = &op->resource[0]; |
2622 | sprintf(card->longname, "%s at 0x%02lx:0x%016Lx, irq %d", | 2621 | sprintf(card->longname, "%s at 0x%02lx:0x%016Lx, irq %d", |
2623 | card->shortname, | 2622 | card->shortname, |
2624 | rp->flags & 0xffL, (unsigned long long)rp->start, irq); | 2623 | rp->flags & 0xffL, (unsigned long long)rp->start, irq); |
2625 | 2624 | ||
2626 | err = snd_dbri_create(card, sdev, irq, dev); | 2625 | err = snd_dbri_create(card, op, irq, dev); |
2627 | if (err < 0) { | 2626 | if (err < 0) { |
2628 | snd_card_free(card); | 2627 | snd_card_free(card); |
2629 | return err; | 2628 | return err; |
@@ -2640,7 +2639,7 @@ static int __devinit dbri_probe(struct of_device *of_dev, | |||
2640 | 2639 | ||
2641 | /* /proc file handling */ | 2640 | /* /proc file handling */ |
2642 | snd_dbri_proc(card); | 2641 | snd_dbri_proc(card); |
2643 | dev_set_drvdata(&of_dev->dev, card); | 2642 | dev_set_drvdata(&op->dev, card); |
2644 | 2643 | ||
2645 | err = snd_card_register(card); | 2644 | err = snd_card_register(card); |
2646 | if (err < 0) | 2645 | if (err < 0) |
@@ -2648,7 +2647,7 @@ static int __devinit dbri_probe(struct of_device *of_dev, | |||
2648 | 2647 | ||
2649 | printk(KERN_INFO "audio%d at %p (irq %d) is DBRI(%c)+CS4215(%d)\n", | 2648 | printk(KERN_INFO "audio%d at %p (irq %d) is DBRI(%c)+CS4215(%d)\n", |
2650 | dev, dbri->regs, | 2649 | dev, dbri->regs, |
2651 | dbri->irq, sdev->prom_name[9], dbri->mm.version); | 2650 | dbri->irq, op->node->name[9], dbri->mm.version); |
2652 | dev++; | 2651 | dev++; |
2653 | 2652 | ||
2654 | return 0; | 2653 | return 0; |
@@ -2659,19 +2658,19 @@ _err: | |||
2659 | return err; | 2658 | return err; |
2660 | } | 2659 | } |
2661 | 2660 | ||
2662 | static int __devexit dbri_remove(struct of_device *dev) | 2661 | static int __devexit dbri_remove(struct of_device *op) |
2663 | { | 2662 | { |
2664 | struct snd_card *card = dev_get_drvdata(&dev->dev); | 2663 | struct snd_card *card = dev_get_drvdata(&op->dev); |
2665 | 2664 | ||
2666 | snd_dbri_free(card->private_data); | 2665 | snd_dbri_free(card->private_data); |
2667 | snd_card_free(card); | 2666 | snd_card_free(card); |
2668 | 2667 | ||
2669 | dev_set_drvdata(&dev->dev, NULL); | 2668 | dev_set_drvdata(&op->dev, NULL); |
2670 | 2669 | ||
2671 | return 0; | 2670 | return 0; |
2672 | } | 2671 | } |
2673 | 2672 | ||
2674 | static struct of_device_id dbri_match[] = { | 2673 | static const struct of_device_id dbri_match[] = { |
2675 | { | 2674 | { |
2676 | .name = "SUNW,DBRIe", | 2675 | .name = "SUNW,DBRIe", |
2677 | }, | 2676 | }, |
@@ -2693,7 +2692,7 @@ static struct of_platform_driver dbri_sbus_driver = { | |||
2693 | /* Probe for the dbri chip and then attach the driver. */ | 2692 | /* Probe for the dbri chip and then attach the driver. */ |
2694 | static int __init dbri_init(void) | 2693 | static int __init dbri_init(void) |
2695 | { | 2694 | { |
2696 | return of_register_driver(&dbri_sbus_driver, &sbus_bus_type); | 2695 | return of_register_driver(&dbri_sbus_driver, &of_bus_type); |
2697 | } | 2696 | } |
2698 | 2697 | ||
2699 | static void __exit dbri_exit(void) | 2698 | static void __exit dbri_exit(void) |