aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
Diffstat (limited to 'sound')
-rw-r--r--sound/arm/pxa2xx-ac97-lib.c68
-rw-r--r--sound/core/sound.c4
-rw-r--r--sound/core/sound_oss.c2
-rw-r--r--sound/pci/ctxfi/ctatc.c15
-rw-r--r--sound/pci/ctxfi/ctvmem.c38
-rw-r--r--sound/pci/ctxfi/ctvmem.h8
-rw-r--r--sound/pci/hda/hda_intel.c25
-rw-r--r--sound/pci/hda/patch_realtek.c131
-rw-r--r--sound/pci/hda/patch_sigmatel.c61
-rw-r--r--sound/pci/ice1712/aureon.c12
-rw-r--r--sound/soc/codecs/tlv320aic23.c2
-rw-r--r--sound/soc/codecs/wm8903.c3
-rw-r--r--sound/soc/omap/Makefile2
-rw-r--r--sound/soc/omap/omap3pandora.c1
-rw-r--r--sound/soc/pxa/pxa-ssp.c90
-rw-r--r--sound/sound_core.c2
16 files changed, 280 insertions, 184 deletions
diff --git a/sound/arm/pxa2xx-ac97-lib.c b/sound/arm/pxa2xx-ac97-lib.c
index 6fdca97186e7..88eec3847df2 100644
--- a/sound/arm/pxa2xx-ac97-lib.c
+++ b/sound/arm/pxa2xx-ac97-lib.c
@@ -22,7 +22,6 @@
22 22
23#include <asm/irq.h> 23#include <asm/irq.h>
24#include <mach/regs-ac97.h> 24#include <mach/regs-ac97.h>
25#include <mach/pxa2xx-gpio.h>
26#include <mach/audio.h> 25#include <mach/audio.h>
27 26
28static DEFINE_MUTEX(car_mutex); 27static DEFINE_MUTEX(car_mutex);
@@ -32,6 +31,8 @@ static struct clk *ac97_clk;
32static struct clk *ac97conf_clk; 31static struct clk *ac97conf_clk;
33static int reset_gpio; 32static int reset_gpio;
34 33
34extern void pxa27x_assert_ac97reset(int reset_gpio, int on);
35
35/* 36/*
36 * Beware PXA27x bugs: 37 * Beware PXA27x bugs:
37 * 38 *
@@ -42,45 +43,6 @@ static int reset_gpio;
42 * 1 jiffy timeout if interrupt never comes). 43 * 1 jiffy timeout if interrupt never comes).
43 */ 44 */
44 45
45enum {
46 RESETGPIO_FORCE_HIGH,
47 RESETGPIO_FORCE_LOW,
48 RESETGPIO_NORMAL_ALTFUNC
49};
50
51/**
52 * set_resetgpio_mode - computes and sets the AC97_RESET gpio mode on PXA
53 * @mode: chosen action
54 *
55 * As the PXA27x CPUs suffer from a AC97 bug, a manual control of the reset line
56 * must be done to insure proper work of AC97 reset line. This function
57 * computes the correct gpio_mode for further use by reset functions, and
58 * applied the change through pxa_gpio_mode.
59 */
60static void set_resetgpio_mode(int resetgpio_action)
61{
62 int mode = 0;
63
64 if (reset_gpio)
65 switch (resetgpio_action) {
66 case RESETGPIO_NORMAL_ALTFUNC:
67 if (reset_gpio == 113)
68 mode = 113 | GPIO_ALT_FN_2_OUT;
69 if (reset_gpio == 95)
70 mode = 95 | GPIO_ALT_FN_1_OUT;
71 break;
72 case RESETGPIO_FORCE_LOW:
73 mode = reset_gpio | GPIO_OUT | GPIO_DFLT_LOW;
74 break;
75 case RESETGPIO_FORCE_HIGH:
76 mode = reset_gpio | GPIO_OUT | GPIO_DFLT_HIGH;
77 break;
78 };
79
80 if (mode)
81 pxa_gpio_mode(mode);
82}
83
84unsigned short pxa2xx_ac97_read(struct snd_ac97 *ac97, unsigned short reg) 46unsigned short pxa2xx_ac97_read(struct snd_ac97 *ac97, unsigned short reg)
85{ 47{
86 unsigned short val = -1; 48 unsigned short val = -1;
@@ -174,12 +136,11 @@ static inline void pxa_ac97_warm_pxa27x(void)
174{ 136{
175 gsr_bits = 0; 137 gsr_bits = 0;
176 138
177 /* warm reset broken on Bulverde, 139 /* warm reset broken on Bulverde, so manually keep AC97 reset high */
178 so manually keep AC97 reset high */ 140 pxa27x_assert_ac97reset(reset_gpio, 1);
179 set_resetgpio_mode(RESETGPIO_FORCE_HIGH);
180 udelay(10); 141 udelay(10);
181 GCR |= GCR_WARM_RST; 142 GCR |= GCR_WARM_RST;
182 set_resetgpio_mode(RESETGPIO_NORMAL_ALTFUNC); 143 pxa27x_assert_ac97reset(reset_gpio, 0);
183 udelay(500); 144 udelay(500);
184} 145}
185 146
@@ -345,16 +306,6 @@ EXPORT_SYMBOL_GPL(pxa2xx_ac97_hw_suspend);
345 306
346int pxa2xx_ac97_hw_resume(void) 307int pxa2xx_ac97_hw_resume(void)
347{ 308{
348 if (cpu_is_pxa25x() || cpu_is_pxa27x()) {
349 pxa_gpio_mode(GPIO31_SYNC_AC97_MD);
350 pxa_gpio_mode(GPIO30_SDATA_OUT_AC97_MD);
351 pxa_gpio_mode(GPIO28_BITCLK_AC97_MD);
352 pxa_gpio_mode(GPIO29_SDATA_IN_AC97_MD);
353 }
354 if (cpu_is_pxa27x()) {
355 /* Use GPIO 113 or 95 as AC97 Reset on Bulverde */
356 set_resetgpio_mode(RESETGPIO_NORMAL_ALTFUNC);
357 }
358 clk_enable(ac97_clk); 309 clk_enable(ac97_clk);
359 return 0; 310 return 0;
360} 311}
@@ -386,16 +337,9 @@ int __devinit pxa2xx_ac97_hw_probe(struct platform_device *dev)
386 reset_gpio = 113; 337 reset_gpio = 113;
387 } 338 }
388 339
389 if (cpu_is_pxa25x() || cpu_is_pxa27x()) {
390 pxa_gpio_mode(GPIO31_SYNC_AC97_MD);
391 pxa_gpio_mode(GPIO30_SDATA_OUT_AC97_MD);
392 pxa_gpio_mode(GPIO28_BITCLK_AC97_MD);
393 pxa_gpio_mode(GPIO29_SDATA_IN_AC97_MD);
394 }
395
396 if (cpu_is_pxa27x()) { 340 if (cpu_is_pxa27x()) {
397 /* Use GPIO 113 as AC97 Reset on Bulverde */ 341 /* Use GPIO 113 as AC97 Reset on Bulverde */
398 set_resetgpio_mode(RESETGPIO_NORMAL_ALTFUNC); 342 pxa27x_assert_ac97reset(reset_gpio, 0);
399 ac97conf_clk = clk_get(&dev->dev, "AC97CONFCLK"); 343 ac97conf_clk = clk_get(&dev->dev, "AC97CONFCLK");
400 if (IS_ERR(ac97conf_clk)) { 344 if (IS_ERR(ac97conf_clk)) {
401 ret = PTR_ERR(ac97conf_clk); 345 ret = PTR_ERR(ac97conf_clk);
diff --git a/sound/core/sound.c b/sound/core/sound.c
index 7872a02f6ca9..563d1967a0ad 100644
--- a/sound/core/sound.c
+++ b/sound/core/sound.c
@@ -468,5 +468,5 @@ static void __exit alsa_sound_exit(void)
468 unregister_chrdev(major, "alsa"); 468 unregister_chrdev(major, "alsa");
469} 469}
470 470
471module_init(alsa_sound_init) 471subsys_initcall(alsa_sound_init);
472module_exit(alsa_sound_exit) 472module_exit(alsa_sound_exit);
diff --git a/sound/core/sound_oss.c b/sound/core/sound_oss.c
index 7fe12264ff80..0c164e5e4322 100644
--- a/sound/core/sound_oss.c
+++ b/sound/core/sound_oss.c
@@ -93,7 +93,7 @@ static int snd_oss_kernel_minor(int type, struct snd_card *card, int dev)
93 default: 93 default:
94 return -EINVAL; 94 return -EINVAL;
95 } 95 }
96 if (snd_BUG_ON(minor < 0 || minor >= SNDRV_OSS_MINORS)) 96 if (minor < 0 || minor >= SNDRV_OSS_MINORS)
97 return -EINVAL; 97 return -EINVAL;
98 return minor; 98 return minor;
99} 99}
diff --git a/sound/pci/ctxfi/ctatc.c b/sound/pci/ctxfi/ctatc.c
index cb65bd0dd35b..459c1f62783b 100644
--- a/sound/pci/ctxfi/ctatc.c
+++ b/sound/pci/ctxfi/ctatc.c
@@ -166,18 +166,7 @@ static void ct_unmap_audio_buffer(struct ct_atc *atc, struct ct_atc_pcm *apcm)
166 166
167static unsigned long atc_get_ptp_phys(struct ct_atc *atc, int index) 167static unsigned long atc_get_ptp_phys(struct ct_atc *atc, int index)
168{ 168{
169 struct ct_vm *vm; 169 return atc->vm->get_ptp_phys(atc->vm, index);
170 void *kvirt_addr;
171 unsigned long phys_addr;
172
173 vm = atc->vm;
174 kvirt_addr = vm->get_ptp_virt(vm, index);
175 if (kvirt_addr == NULL)
176 phys_addr = (~0UL);
177 else
178 phys_addr = virt_to_phys(kvirt_addr);
179
180 return phys_addr;
181} 170}
182 171
183static unsigned int convert_format(snd_pcm_format_t snd_format) 172static unsigned int convert_format(snd_pcm_format_t snd_format)
@@ -1669,7 +1658,7 @@ int __devinit ct_atc_create(struct snd_card *card, struct pci_dev *pci,
1669 } 1658 }
1670 1659
1671 /* Set up device virtual memory management object */ 1660 /* Set up device virtual memory management object */
1672 err = ct_vm_create(&atc->vm); 1661 err = ct_vm_create(&atc->vm, pci);
1673 if (err < 0) 1662 if (err < 0)
1674 goto error1; 1663 goto error1;
1675 1664
diff --git a/sound/pci/ctxfi/ctvmem.c b/sound/pci/ctxfi/ctvmem.c
index 6b78752e9503..65da6e466f80 100644
--- a/sound/pci/ctxfi/ctvmem.c
+++ b/sound/pci/ctxfi/ctvmem.c
@@ -138,7 +138,7 @@ ct_vm_map(struct ct_vm *vm, struct snd_pcm_substream *substream, int size)
138 return NULL; 138 return NULL;
139 } 139 }
140 140
141 ptp = vm->ptp[0]; 141 ptp = (unsigned long *)vm->ptp[0].area;
142 pte_start = (block->addr >> CT_PAGE_SHIFT); 142 pte_start = (block->addr >> CT_PAGE_SHIFT);
143 pages = block->size >> CT_PAGE_SHIFT; 143 pages = block->size >> CT_PAGE_SHIFT;
144 for (i = 0; i < pages; i++) { 144 for (i = 0; i < pages; i++) {
@@ -158,25 +158,25 @@ static void ct_vm_unmap(struct ct_vm *vm, struct ct_vm_block *block)
158} 158}
159 159
160/* * 160/* *
161 * return the host (kmalloced) addr of the @index-th device 161 * return the host physical addr of the @index-th device
162 * page talbe page on success, or NULL on failure. 162 * page table page on success, or ~0UL on failure.
163 * The first returned NULL indicates the termination. 163 * The first returned ~0UL indicates the termination.
164 * */ 164 * */
165static void * 165static dma_addr_t
166ct_get_ptp_virt(struct ct_vm *vm, int index) 166ct_get_ptp_phys(struct ct_vm *vm, int index)
167{ 167{
168 void *addr; 168 dma_addr_t addr;
169 169
170 addr = (index >= CT_PTP_NUM) ? NULL : vm->ptp[index]; 170 addr = (index >= CT_PTP_NUM) ? ~0UL : vm->ptp[index].addr;
171 171
172 return addr; 172 return addr;
173} 173}
174 174
175int ct_vm_create(struct ct_vm **rvm) 175int ct_vm_create(struct ct_vm **rvm, struct pci_dev *pci)
176{ 176{
177 struct ct_vm *vm; 177 struct ct_vm *vm;
178 struct ct_vm_block *block; 178 struct ct_vm_block *block;
179 int i; 179 int i, err = 0;
180 180
181 *rvm = NULL; 181 *rvm = NULL;
182 182
@@ -188,23 +188,21 @@ int ct_vm_create(struct ct_vm **rvm)
188 188
189 /* Allocate page table pages */ 189 /* Allocate page table pages */
190 for (i = 0; i < CT_PTP_NUM; i++) { 190 for (i = 0; i < CT_PTP_NUM; i++) {
191 vm->ptp[i] = kmalloc(PAGE_SIZE, GFP_KERNEL); 191 err = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV,
192 if (!vm->ptp[i]) 192 snd_dma_pci_data(pci),
193 PAGE_SIZE, &vm->ptp[i]);
194 if (err < 0)
193 break; 195 break;
194 } 196 }
195 if (!i) { 197 if (err < 0) {
196 /* no page table pages are allocated */ 198 /* no page table pages are allocated */
197 kfree(vm); 199 ct_vm_destroy(vm);
198 return -ENOMEM; 200 return -ENOMEM;
199 } 201 }
200 vm->size = CT_ADDRS_PER_PAGE * i; 202 vm->size = CT_ADDRS_PER_PAGE * i;
201 /* Initialise remaining ptps */
202 for (; i < CT_PTP_NUM; i++)
203 vm->ptp[i] = NULL;
204
205 vm->map = ct_vm_map; 203 vm->map = ct_vm_map;
206 vm->unmap = ct_vm_unmap; 204 vm->unmap = ct_vm_unmap;
207 vm->get_ptp_virt = ct_get_ptp_virt; 205 vm->get_ptp_phys = ct_get_ptp_phys;
208 INIT_LIST_HEAD(&vm->unused); 206 INIT_LIST_HEAD(&vm->unused);
209 INIT_LIST_HEAD(&vm->used); 207 INIT_LIST_HEAD(&vm->used);
210 block = kzalloc(sizeof(*block), GFP_KERNEL); 208 block = kzalloc(sizeof(*block), GFP_KERNEL);
@@ -242,7 +240,7 @@ void ct_vm_destroy(struct ct_vm *vm)
242 240
243 /* free allocated page table pages */ 241 /* free allocated page table pages */
244 for (i = 0; i < CT_PTP_NUM; i++) 242 for (i = 0; i < CT_PTP_NUM; i++)
245 kfree(vm->ptp[i]); 243 snd_dma_free_pages(&vm->ptp[i]);
246 244
247 vm->size = 0; 245 vm->size = 0;
248 246
diff --git a/sound/pci/ctxfi/ctvmem.h b/sound/pci/ctxfi/ctvmem.h
index 01e4fd0386a3..b23adfca4de6 100644
--- a/sound/pci/ctxfi/ctvmem.h
+++ b/sound/pci/ctxfi/ctvmem.h
@@ -22,6 +22,8 @@
22 22
23#include <linux/mutex.h> 23#include <linux/mutex.h>
24#include <linux/list.h> 24#include <linux/list.h>
25#include <linux/pci.h>
26#include <sound/memalloc.h>
25 27
26/* The chip can handle the page table of 4k pages 28/* The chip can handle the page table of 4k pages
27 * (emu20k1 can handle even 8k pages, but we don't use it right now) 29 * (emu20k1 can handle even 8k pages, but we don't use it right now)
@@ -41,7 +43,7 @@ struct snd_pcm_substream;
41 43
42/* Virtual memory management object for card device */ 44/* Virtual memory management object for card device */
43struct ct_vm { 45struct ct_vm {
44 void *ptp[CT_PTP_NUM]; /* Device page table pages */ 46 struct snd_dma_buffer ptp[CT_PTP_NUM]; /* Device page table pages */
45 unsigned int size; /* Available addr space in bytes */ 47 unsigned int size; /* Available addr space in bytes */
46 struct list_head unused; /* List of unused blocks */ 48 struct list_head unused; /* List of unused blocks */
47 struct list_head used; /* List of used blocks */ 49 struct list_head used; /* List of used blocks */
@@ -52,10 +54,10 @@ struct ct_vm {
52 int size); 54 int size);
53 /* Unmap device logical addr area. */ 55 /* Unmap device logical addr area. */
54 void (*unmap)(struct ct_vm *, struct ct_vm_block *block); 56 void (*unmap)(struct ct_vm *, struct ct_vm_block *block);
55 void *(*get_ptp_virt)(struct ct_vm *vm, int index); 57 dma_addr_t (*get_ptp_phys)(struct ct_vm *vm, int index);
56}; 58};
57 59
58int ct_vm_create(struct ct_vm **rvm); 60int ct_vm_create(struct ct_vm **rvm, struct pci_dev *pci);
59void ct_vm_destroy(struct ct_vm *vm); 61void ct_vm_destroy(struct ct_vm *vm);
60 62
61#endif /* CTVMEM_H */ 63#endif /* CTVMEM_H */
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index ec9c348336cc..ff6da6f386d1 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -426,6 +426,7 @@ struct azx {
426 426
427 /* flags */ 427 /* flags */
428 int position_fix; 428 int position_fix;
429 int poll_count;
429 unsigned int running :1; 430 unsigned int running :1;
430 unsigned int initialized :1; 431 unsigned int initialized :1;
431 unsigned int single_cmd :1; 432 unsigned int single_cmd :1;
@@ -506,7 +507,7 @@ static char *driver_short_names[] __devinitdata = {
506#define get_azx_dev(substream) (substream->runtime->private_data) 507#define get_azx_dev(substream) (substream->runtime->private_data)
507 508
508static int azx_acquire_irq(struct azx *chip, int do_disconnect); 509static int azx_acquire_irq(struct azx *chip, int do_disconnect);
509 510static int azx_send_cmd(struct hda_bus *bus, unsigned int val);
510/* 511/*
511 * Interface for HD codec 512 * Interface for HD codec
512 */ 513 */
@@ -664,11 +665,12 @@ static unsigned int azx_rirb_get_response(struct hda_bus *bus,
664{ 665{
665 struct azx *chip = bus->private_data; 666 struct azx *chip = bus->private_data;
666 unsigned long timeout; 667 unsigned long timeout;
668 int do_poll = 0;
667 669
668 again: 670 again:
669 timeout = jiffies + msecs_to_jiffies(1000); 671 timeout = jiffies + msecs_to_jiffies(1000);
670 for (;;) { 672 for (;;) {
671 if (chip->polling_mode) { 673 if (chip->polling_mode || do_poll) {
672 spin_lock_irq(&chip->reg_lock); 674 spin_lock_irq(&chip->reg_lock);
673 azx_update_rirb(chip); 675 azx_update_rirb(chip);
674 spin_unlock_irq(&chip->reg_lock); 676 spin_unlock_irq(&chip->reg_lock);
@@ -676,6 +678,9 @@ static unsigned int azx_rirb_get_response(struct hda_bus *bus,
676 if (!chip->rirb.cmds[addr]) { 678 if (!chip->rirb.cmds[addr]) {
677 smp_rmb(); 679 smp_rmb();
678 bus->rirb_error = 0; 680 bus->rirb_error = 0;
681
682 if (!do_poll)
683 chip->poll_count = 0;
679 return chip->rirb.res[addr]; /* the last value */ 684 return chip->rirb.res[addr]; /* the last value */
680 } 685 }
681 if (time_after(jiffies, timeout)) 686 if (time_after(jiffies, timeout))
@@ -688,6 +693,16 @@ static unsigned int azx_rirb_get_response(struct hda_bus *bus,
688 } 693 }
689 } 694 }
690 695
696 if (!chip->polling_mode && chip->poll_count < 2) {
697 snd_printdd(SFX "azx_get_response timeout, "
698 "polling the codec once: last cmd=0x%08x\n",
699 chip->last_cmd[addr]);
700 do_poll = 1;
701 chip->poll_count++;
702 goto again;
703 }
704
705
691 if (!chip->polling_mode) { 706 if (!chip->polling_mode) {
692 snd_printk(KERN_WARNING SFX "azx_get_response timeout, " 707 snd_printk(KERN_WARNING SFX "azx_get_response timeout, "
693 "switching to polling mode: last cmd=0x%08x\n", 708 "switching to polling mode: last cmd=0x%08x\n",
@@ -1878,6 +1893,9 @@ static int azx_position_ok(struct azx *chip, struct azx_dev *azx_dev)
1878 1893
1879 if (!bdl_pos_adj[chip->dev_index]) 1894 if (!bdl_pos_adj[chip->dev_index])
1880 return 1; /* no delayed ack */ 1895 return 1; /* no delayed ack */
1896 if (WARN_ONCE(!azx_dev->period_bytes,
1897 "hda-intel: zero azx_dev->period_bytes"))
1898 return 0; /* this shouldn't happen! */
1881 if (pos % azx_dev->period_bytes > azx_dev->period_bytes / 2) 1899 if (pos % azx_dev->period_bytes > azx_dev->period_bytes / 2)
1882 return 0; /* NG - it's below the period boundary */ 1900 return 0; /* NG - it's below the period boundary */
1883 return 1; /* OK, it's fine */ 1901 return 1; /* OK, it's fine */
@@ -2043,7 +2061,7 @@ static int azx_acquire_irq(struct azx *chip, int do_disconnect)
2043{ 2061{
2044 if (request_irq(chip->pci->irq, azx_interrupt, 2062 if (request_irq(chip->pci->irq, azx_interrupt,
2045 chip->msi ? 0 : IRQF_SHARED, 2063 chip->msi ? 0 : IRQF_SHARED,
2046 "HDA Intel", chip)) { 2064 "hda_intel", chip)) {
2047 printk(KERN_ERR "hda-intel: unable to grab IRQ %d, " 2065 printk(KERN_ERR "hda-intel: unable to grab IRQ %d, "
2048 "disabling device\n", chip->pci->irq); 2066 "disabling device\n", chip->pci->irq);
2049 if (do_disconnect) 2067 if (do_disconnect)
@@ -2332,6 +2350,7 @@ static void __devinit check_probe_mask(struct azx *chip, int dev)
2332 */ 2350 */
2333static struct snd_pci_quirk msi_black_list[] __devinitdata = { 2351static struct snd_pci_quirk msi_black_list[] __devinitdata = {
2334 SND_PCI_QUIRK(0x1043, 0x81f2, "ASUS", 0), /* Athlon64 X2 + nvidia */ 2352 SND_PCI_QUIRK(0x1043, 0x81f2, "ASUS", 0), /* Athlon64 X2 + nvidia */
2353 SND_PCI_QUIRK(0x1043, 0x81f6, "ASUS", 0), /* nvidia */
2335 {} 2354 {}
2336}; 2355};
2337 2356
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index e3caa78ccd54..da34095c707f 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -1093,6 +1093,16 @@ static void alc889_coef_init(struct hda_codec *codec)
1093 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010); 1093 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010);
1094} 1094}
1095 1095
1096/* turn on/off EAPD control (only if available) */
1097static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
1098{
1099 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
1100 return;
1101 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
1102 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
1103 on ? 2 : 0);
1104}
1105
1096static void alc_auto_init_amp(struct hda_codec *codec, int type) 1106static void alc_auto_init_amp(struct hda_codec *codec, int type)
1097{ 1107{
1098 unsigned int tmp; 1108 unsigned int tmp;
@@ -1110,25 +1120,22 @@ static void alc_auto_init_amp(struct hda_codec *codec, int type)
1110 case ALC_INIT_DEFAULT: 1120 case ALC_INIT_DEFAULT:
1111 switch (codec->vendor_id) { 1121 switch (codec->vendor_id) {
1112 case 0x10ec0260: 1122 case 0x10ec0260:
1113 snd_hda_codec_write(codec, 0x0f, 0, 1123 set_eapd(codec, 0x0f, 1);
1114 AC_VERB_SET_EAPD_BTLENABLE, 2); 1124 set_eapd(codec, 0x10, 1);
1115 snd_hda_codec_write(codec, 0x10, 0,
1116 AC_VERB_SET_EAPD_BTLENABLE, 2);
1117 break; 1125 break;
1118 case 0x10ec0262: 1126 case 0x10ec0262:
1119 case 0x10ec0267: 1127 case 0x10ec0267:
1120 case 0x10ec0268: 1128 case 0x10ec0268:
1121 case 0x10ec0269: 1129 case 0x10ec0269:
1130 case 0x10ec0270:
1122 case 0x10ec0272: 1131 case 0x10ec0272:
1123 case 0x10ec0660: 1132 case 0x10ec0660:
1124 case 0x10ec0662: 1133 case 0x10ec0662:
1125 case 0x10ec0663: 1134 case 0x10ec0663:
1126 case 0x10ec0862: 1135 case 0x10ec0862:
1127 case 0x10ec0889: 1136 case 0x10ec0889:
1128 snd_hda_codec_write(codec, 0x14, 0, 1137 set_eapd(codec, 0x14, 1);
1129 AC_VERB_SET_EAPD_BTLENABLE, 2); 1138 set_eapd(codec, 0x15, 1);
1130 snd_hda_codec_write(codec, 0x15, 0,
1131 AC_VERB_SET_EAPD_BTLENABLE, 2);
1132 break; 1139 break;
1133 } 1140 }
1134 switch (codec->vendor_id) { 1141 switch (codec->vendor_id) {
@@ -1230,6 +1237,8 @@ static void alc_init_auto_mic(struct hda_codec *codec)
1230 return; /* invalid entry */ 1237 return; /* invalid entry */
1231 } 1238 }
1232 } 1239 }
1240 if (!ext || !fixed)
1241 return;
1233 if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP)) 1242 if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP))
1234 return; /* no unsol support */ 1243 return; /* no unsol support */
1235 snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n", 1244 snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n",
@@ -1834,10 +1843,8 @@ static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec)
1834#ifdef CONFIG_SND_HDA_POWER_SAVE 1843#ifdef CONFIG_SND_HDA_POWER_SAVE
1835static void alc889_power_eapd(struct hda_codec *codec, int power) 1844static void alc889_power_eapd(struct hda_codec *codec, int power)
1836{ 1845{
1837 snd_hda_codec_write(codec, 0x14, 0, 1846 set_eapd(codec, 0x14, power);
1838 AC_VERB_SET_EAPD_BTLENABLE, power ? 2 : 0); 1847 set_eapd(codec, 0x15, power);
1839 snd_hda_codec_write(codec, 0x15, 0,
1840 AC_VERB_SET_EAPD_BTLENABLE, power ? 2 : 0);
1841} 1848}
1842#endif 1849#endif
1843 1850
@@ -4812,6 +4819,49 @@ static void fixup_automic_adc(struct hda_codec *codec)
4812 spec->auto_mic = 0; /* disable auto-mic to be sure */ 4819 spec->auto_mic = 0; /* disable auto-mic to be sure */
4813} 4820}
4814 4821
4822/* choose the ADC/MUX containing the input pin and initialize the setup */
4823static void fixup_single_adc(struct hda_codec *codec)
4824{
4825 struct alc_spec *spec = codec->spec;
4826 hda_nid_t pin;
4827 int i;
4828
4829 /* search for the input pin; there must be only one */
4830 for (i = 0; i < AUTO_PIN_LAST; i++) {
4831 if (spec->autocfg.input_pins[i]) {
4832 pin = spec->autocfg.input_pins[i];
4833 break;
4834 }
4835 }
4836 if (!pin)
4837 return;
4838
4839 /* set the default connection to that pin */
4840 for (i = 0; i < spec->num_adc_nids; i++) {
4841 hda_nid_t cap = spec->capsrc_nids ?
4842 spec->capsrc_nids[i] : spec->adc_nids[i];
4843 int idx;
4844
4845 idx = get_connection_index(codec, cap, pin);
4846 if (idx < 0)
4847 continue;
4848 /* use only this ADC */
4849 if (spec->capsrc_nids)
4850 spec->capsrc_nids += i;
4851 spec->adc_nids += i;
4852 spec->num_adc_nids = 1;
4853 /* select or unmute this route */
4854 if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) {
4855 snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx,
4856 HDA_AMP_MUTE, 0);
4857 } else {
4858 snd_hda_codec_write_cache(codec, cap, 0,
4859 AC_VERB_SET_CONNECT_SEL, idx);
4860 }
4861 return;
4862 }
4863}
4864
4815static void set_capture_mixer(struct hda_codec *codec) 4865static void set_capture_mixer(struct hda_codec *codec)
4816{ 4866{
4817 struct alc_spec *spec = codec->spec; 4867 struct alc_spec *spec = codec->spec;
@@ -4824,14 +4874,15 @@ static void set_capture_mixer(struct hda_codec *codec)
4824 alc_capture_mixer3 }, 4874 alc_capture_mixer3 },
4825 }; 4875 };
4826 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) { 4876 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
4827 int mux; 4877 int mux = 0;
4828 if (spec->auto_mic) { 4878 if (spec->auto_mic)
4829 mux = 0;
4830 fixup_automic_adc(codec); 4879 fixup_automic_adc(codec);
4831 } else if (spec->input_mux && spec->input_mux->num_items > 1) 4880 else if (spec->input_mux) {
4832 mux = 1; 4881 if (spec->input_mux->num_items > 1)
4833 else 4882 mux = 1;
4834 mux = 0; 4883 else if (spec->input_mux->num_items == 1)
4884 fixup_single_adc(codec);
4885 }
4835 spec->cap_mixer = caps[mux][spec->num_adc_nids - 1]; 4886 spec->cap_mixer = caps[mux][spec->num_adc_nids - 1];
4836 } 4887 }
4837} 4888}
@@ -7094,8 +7145,8 @@ static struct snd_kcontrol_new alc885_mb5_mixer[] = {
7094 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), 7145 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7095 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), 7146 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7096 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), 7147 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7097 HDA_CODEC_VOLUME("HP Playback Volume", 0x0f, 0x00, HDA_OUTPUT), 7148 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7098 HDA_BIND_MUTE ("HP Playback Switch", 0x0f, 0x02, HDA_INPUT), 7149 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
7099 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), 7150 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7100 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), 7151 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7101 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), 7152 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
@@ -7496,6 +7547,7 @@ static struct hda_verb alc885_mb5_init_verbs[] = {
7496 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 7547 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7497 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 7548 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7498 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, 7549 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
7550 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7499 /* Front Mic pin: input vref at 80% */ 7551 /* Front Mic pin: input vref at 80% */
7500 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 7552 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7501 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 7553 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
@@ -7680,6 +7732,27 @@ static void alc885_mbp3_setup(struct hda_codec *codec)
7680 spec->autocfg.speaker_pins[0] = 0x14; 7732 spec->autocfg.speaker_pins[0] = 0x14;
7681} 7733}
7682 7734
7735static void alc885_mb5_automute(struct hda_codec *codec)
7736{
7737 unsigned int present;
7738
7739 present = snd_hda_codec_read(codec, 0x14, 0,
7740 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7741 snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0,
7742 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7743 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
7744 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7745
7746}
7747
7748static void alc885_mb5_unsol_event(struct hda_codec *codec,
7749 unsigned int res)
7750{
7751 /* Headphone insertion or removal. */
7752 if ((res >> 26) == ALC880_HP_EVENT)
7753 alc885_mb5_automute(codec);
7754}
7755
7683static void alc885_imac91_automute(struct hda_codec *codec) 7756static void alc885_imac91_automute(struct hda_codec *codec)
7684{ 7757{
7685 unsigned int present; 7758 unsigned int present;
@@ -9126,6 +9199,8 @@ static struct alc_config_preset alc882_presets[] = {
9126 .input_mux = &mb5_capture_source, 9199 .input_mux = &mb5_capture_source,
9127 .dig_out_nid = ALC882_DIGOUT_NID, 9200 .dig_out_nid = ALC882_DIGOUT_NID,
9128 .dig_in_nid = ALC882_DIGIN_NID, 9201 .dig_in_nid = ALC882_DIGIN_NID,
9202 .unsol_event = alc885_mb5_unsol_event,
9203 .init_hook = alc885_mb5_automute,
9129 }, 9204 },
9130 [ALC885_MACPRO] = { 9205 [ALC885_MACPRO] = {
9131 .mixers = { alc882_macpro_mixer }, 9206 .mixers = { alc882_macpro_mixer },
@@ -9403,6 +9478,7 @@ static struct alc_config_preset alc882_presets[] = {
9403 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), 9478 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9404 .channel_mode = alc883_3ST_6ch_modes, 9479 .channel_mode = alc883_3ST_6ch_modes,
9405 .need_dac_fix = 1, 9480 .need_dac_fix = 1,
9481 .const_channel_count = 6,
9406 .num_mux_defs = 9482 .num_mux_defs =
9407 ARRAY_SIZE(alc888_2_capture_sources), 9483 ARRAY_SIZE(alc888_2_capture_sources),
9408 .input_mux = alc888_2_capture_sources, 9484 .input_mux = alc888_2_capture_sources,
@@ -10307,7 +10383,7 @@ static void alc262_hp_t5735_setup(struct hda_codec *codec)
10307 struct alc_spec *spec = codec->spec; 10383 struct alc_spec *spec = codec->spec;
10308 10384
10309 spec->autocfg.hp_pins[0] = 0x15; 10385 spec->autocfg.hp_pins[0] = 0x15;
10310 spec->autocfg.speaker_pins[0] = 0x0c; /* HACK: not actually a pin */ 10386 spec->autocfg.speaker_pins[0] = 0x14;
10311} 10387}
10312 10388
10313static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { 10389static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
@@ -11179,7 +11255,7 @@ static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
11179} 11255}
11180 11256
11181#define alc262_auto_create_input_ctls \ 11257#define alc262_auto_create_input_ctls \
11182 alc880_auto_create_input_ctls 11258 alc882_auto_create_input_ctls
11183 11259
11184/* 11260/*
11185 * generic initialization of ADC, input mixers and output mixers 11261 * generic initialization of ADC, input mixers and output mixers
@@ -11718,9 +11794,9 @@ static struct alc_config_preset alc262_presets[] = {
11718 .num_channel_mode = ARRAY_SIZE(alc262_modes), 11794 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11719 .channel_mode = alc262_modes, 11795 .channel_mode = alc262_modes,
11720 .input_mux = &alc262_capture_source, 11796 .input_mux = &alc262_capture_source,
11721 .unsol_event = alc_automute_amp_unsol_event, 11797 .unsol_event = alc_sku_unsol_event,
11722 .setup = alc262_hp_t5735_setup, 11798 .setup = alc262_hp_t5735_setup,
11723 .init_hook = alc_automute_amp, 11799 .init_hook = alc_inithook,
11724 }, 11800 },
11725 [ALC262_HP_RP5700] = { 11801 [ALC262_HP_RP5700] = {
11726 .mixers = { alc262_hp_rp5700_mixer }, 11802 .mixers = { alc262_hp_rp5700_mixer },
@@ -12471,6 +12547,7 @@ static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
12471 dac = 0x02; 12547 dac = 0x02;
12472 break; 12548 break;
12473 case 0x15: 12549 case 0x15:
12550 case 0x21:
12474 dac = 0x03; 12551 dac = 0x03;
12475 break; 12552 break;
12476 default: 12553 default:
@@ -14855,6 +14932,8 @@ static int patch_alc861(struct hda_codec *codec)
14855 spec->stream_digital_playback = &alc861_pcm_digital_playback; 14932 spec->stream_digital_playback = &alc861_pcm_digital_playback;
14856 spec->stream_digital_capture = &alc861_pcm_digital_capture; 14933 spec->stream_digital_capture = &alc861_pcm_digital_capture;
14857 14934
14935 if (!spec->cap_mixer)
14936 set_capture_mixer(codec);
14858 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); 14937 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
14859 14938
14860 spec->vmaster_nid = 0x03; 14939 spec->vmaster_nid = 0x03;
@@ -17251,7 +17330,7 @@ static struct snd_pci_quirk alc662_cfg_tbl[] = {
17251 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), 17330 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
17252 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", 17331 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
17253 ALC662_3ST_6ch_DIG), 17332 ALC662_3ST_6ch_DIG),
17254 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB200", ALC663_ASUS_MODE4), 17333 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO),
17255 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10), 17334 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
17256 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", 17335 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
17257 ALC662_3ST_6ch_DIG), 17336 ALC662_3ST_6ch_DIG),
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 2291a8396817..799ba2570902 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -4730,6 +4730,26 @@ static void stac92xx_unsol_event(struct hda_codec *codec, unsigned int res)
4730 } 4730 }
4731} 4731}
4732 4732
4733static int hp_blike_system(u32 subsystem_id);
4734
4735static void set_hp_led_gpio(struct hda_codec *codec)
4736{
4737 struct sigmatel_spec *spec = codec->spec;
4738 switch (codec->vendor_id) {
4739 case 0x111d7608:
4740 /* GPIO 0 */
4741 spec->gpio_led = 0x01;
4742 break;
4743 case 0x111d7600:
4744 case 0x111d7601:
4745 case 0x111d7602:
4746 case 0x111d7603:
4747 /* GPIO 3 */
4748 spec->gpio_led = 0x08;
4749 break;
4750 }
4751}
4752
4733/* 4753/*
4734 * This method searches for the mute LED GPIO configuration 4754 * This method searches for the mute LED GPIO configuration
4735 * provided as OEM string in SMBIOS. The format of that string 4755 * provided as OEM string in SMBIOS. The format of that string
@@ -4741,6 +4761,14 @@ static void stac92xx_unsol_event(struct hda_codec *codec, unsigned int res)
4741 * 4761 *
4742 * So, HP B-series like systems may have HP_Mute_LED_0 (current models) 4762 * So, HP B-series like systems may have HP_Mute_LED_0 (current models)
4743 * or HP_Mute_LED_0_3 (future models) OEM SMBIOS strings 4763 * or HP_Mute_LED_0_3 (future models) OEM SMBIOS strings
4764 *
4765 *
4766 * The dv-series laptops don't seem to have the HP_Mute_LED* strings in
4767 * SMBIOS - at least the ones I have seen do not have them - which include
4768 * my own system (HP Pavilion dv6-1110ax) and my cousin's
4769 * HP Pavilion dv9500t CTO.
4770 * Need more information on whether it is true across the entire series.
4771 * -- kunal
4744 */ 4772 */
4745static int find_mute_led_gpio(struct hda_codec *codec) 4773static int find_mute_led_gpio(struct hda_codec *codec)
4746{ 4774{
@@ -4751,28 +4779,27 @@ static int find_mute_led_gpio(struct hda_codec *codec)
4751 while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, 4779 while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING,
4752 NULL, dev))) { 4780 NULL, dev))) {
4753 if (sscanf(dev->name, "HP_Mute_LED_%d_%d", 4781 if (sscanf(dev->name, "HP_Mute_LED_%d_%d",
4754 &spec->gpio_led_polarity, 4782 &spec->gpio_led_polarity,
4755 &spec->gpio_led) == 2) { 4783 &spec->gpio_led) == 2) {
4756 spec->gpio_led = 1 << spec->gpio_led; 4784 spec->gpio_led = 1 << spec->gpio_led;
4757 return 1; 4785 return 1;
4758 } 4786 }
4759 if (sscanf(dev->name, "HP_Mute_LED_%d", 4787 if (sscanf(dev->name, "HP_Mute_LED_%d",
4760 &spec->gpio_led_polarity) == 1) { 4788 &spec->gpio_led_polarity) == 1) {
4761 switch (codec->vendor_id) { 4789 set_hp_led_gpio(codec);
4762 case 0x111d7608: 4790 return 1;
4763 /* GPIO 0 */
4764 spec->gpio_led = 0x01;
4765 return 1;
4766 case 0x111d7600:
4767 case 0x111d7601:
4768 case 0x111d7602:
4769 case 0x111d7603:
4770 /* GPIO 3 */
4771 spec->gpio_led = 0x08;
4772 return 1;
4773 }
4774 } 4791 }
4775 } 4792 }
4793
4794 /*
4795 * Fallback case - if we don't find the DMI strings,
4796 * we statically set the GPIO - if not a B-series system.
4797 */
4798 if (!hp_blike_system(codec->subsystem_id)) {
4799 set_hp_led_gpio(codec);
4800 spec->gpio_led_polarity = 1;
4801 return 1;
4802 }
4776 } 4803 }
4777 return 0; 4804 return 0;
4778} 4805}
@@ -5548,6 +5575,8 @@ again:
5548 spec->num_dmuxes = ARRAY_SIZE(stac92hd71bxx_dmux_nids); 5575 spec->num_dmuxes = ARRAY_SIZE(stac92hd71bxx_dmux_nids);
5549 spec->num_smuxes = stac92hd71bxx_connected_smuxes(codec, 0x1e); 5576 spec->num_smuxes = stac92hd71bxx_connected_smuxes(codec, 0x1e);
5550 5577
5578 snd_printdd("Found board config: %d\n", spec->board_config);
5579
5551 switch (spec->board_config) { 5580 switch (spec->board_config) {
5552 case STAC_HP_M4: 5581 case STAC_HP_M4:
5553 /* enable internal microphone */ 5582 /* enable internal microphone */
diff --git a/sound/pci/ice1712/aureon.c b/sound/pci/ice1712/aureon.c
index 765d7bd4c3d4..9e66f6d306f8 100644
--- a/sound/pci/ice1712/aureon.c
+++ b/sound/pci/ice1712/aureon.c
@@ -703,11 +703,13 @@ static void wm_set_vol(struct snd_ice1712 *ice, unsigned int index, unsigned sho
703{ 703{
704 unsigned char nvol; 704 unsigned char nvol;
705 705
706 if ((master & WM_VOL_MUTE) || (vol & WM_VOL_MUTE)) 706 if ((master & WM_VOL_MUTE) || (vol & WM_VOL_MUTE)) {
707 nvol = 0; 707 nvol = 0;
708 else 708 } else {
709 nvol = ((vol % WM_VOL_CNT) * (master % WM_VOL_CNT)) / 709 nvol = ((vol % WM_VOL_CNT) * (master % WM_VOL_CNT)) /
710 WM_VOL_MAX; 710 WM_VOL_MAX;
711 nvol += 0x1b;
712 }
711 713
712 wm_put(ice, index, nvol); 714 wm_put(ice, index, nvol);
713 wm_put_nocache(ice, index, 0x180 | nvol); 715 wm_put_nocache(ice, index, 0x180 | nvol);
@@ -778,7 +780,7 @@ static int wm_master_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_
778 for (ch = 0; ch < 2; ch++) { 780 for (ch = 0; ch < 2; ch++) {
779 unsigned int vol = ucontrol->value.integer.value[ch]; 781 unsigned int vol = ucontrol->value.integer.value[ch];
780 if (vol > WM_VOL_MAX) 782 if (vol > WM_VOL_MAX)
781 continue; 783 vol = WM_VOL_MAX;
782 vol |= spec->master[ch] & WM_VOL_MUTE; 784 vol |= spec->master[ch] & WM_VOL_MUTE;
783 if (vol != spec->master[ch]) { 785 if (vol != spec->master[ch]) {
784 int dac; 786 int dac;
@@ -834,8 +836,8 @@ static int wm_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *
834 for (i = 0; i < voices; i++) { 836 for (i = 0; i < voices; i++) {
835 unsigned int vol = ucontrol->value.integer.value[i]; 837 unsigned int vol = ucontrol->value.integer.value[i];
836 if (vol > WM_VOL_MAX) 838 if (vol > WM_VOL_MAX)
837 continue; 839 vol = WM_VOL_MAX;
838 vol |= spec->vol[ofs+i]; 840 vol |= spec->vol[ofs+i] & WM_VOL_MUTE;
839 if (vol != spec->vol[ofs+i]) { 841 if (vol != spec->vol[ofs+i]) {
840 spec->vol[ofs+i] = vol; 842 spec->vol[ofs+i] = vol;
841 idx = WM_DAC_ATTEN + ofs + i; 843 idx = WM_DAC_ATTEN + ofs + i;
diff --git a/sound/soc/codecs/tlv320aic23.c b/sound/soc/codecs/tlv320aic23.c
index a9dc5fb54774..da589d8664d0 100644
--- a/sound/soc/codecs/tlv320aic23.c
+++ b/sound/soc/codecs/tlv320aic23.c
@@ -627,7 +627,7 @@ static int tlv320aic23_resume(struct platform_device *pdev)
627 u16 reg; 627 u16 reg;
628 628
629 /* Sync reg_cache with the hardware */ 629 /* Sync reg_cache with the hardware */
630 for (reg = 0; reg < TLV320AIC23_RESET; reg++) { 630 for (reg = 0; reg <= TLV320AIC23_ACTIVE; reg++) {
631 u16 val = tlv320aic23_read_reg_cache(codec, reg); 631 u16 val = tlv320aic23_read_reg_cache(codec, reg);
632 tlv320aic23_write(codec, reg, val); 632 tlv320aic23_write(codec, reg, val);
633 } 633 }
diff --git a/sound/soc/codecs/wm8903.c b/sound/soc/codecs/wm8903.c
index ce5515e3f2b0..3595bd57c4eb 100644
--- a/sound/soc/codecs/wm8903.c
+++ b/sound/soc/codecs/wm8903.c
@@ -1504,7 +1504,7 @@ static int wm8903_resume(struct platform_device *pdev)
1504 struct i2c_client *i2c = codec->control_data; 1504 struct i2c_client *i2c = codec->control_data;
1505 int i; 1505 int i;
1506 u16 *reg_cache = codec->reg_cache; 1506 u16 *reg_cache = codec->reg_cache;
1507 u16 *tmp_cache = kmemdup(codec->reg_cache, sizeof(wm8903_reg_defaults), 1507 u16 *tmp_cache = kmemdup(reg_cache, sizeof(wm8903_reg_defaults),
1508 GFP_KERNEL); 1508 GFP_KERNEL);
1509 1509
1510 /* Bring the codec back up to standby first to minimise pop/clicks */ 1510 /* Bring the codec back up to standby first to minimise pop/clicks */
@@ -1516,6 +1516,7 @@ static int wm8903_resume(struct platform_device *pdev)
1516 for (i = 2; i < ARRAY_SIZE(wm8903_reg_defaults); i++) 1516 for (i = 2; i < ARRAY_SIZE(wm8903_reg_defaults); i++)
1517 if (tmp_cache[i] != reg_cache[i]) 1517 if (tmp_cache[i] != reg_cache[i])
1518 snd_soc_write(codec, i, tmp_cache[i]); 1518 snd_soc_write(codec, i, tmp_cache[i]);
1519 kfree(tmp_cache);
1519 } else { 1520 } else {
1520 dev_err(&i2c->dev, "Failed to allocate temporary cache\n"); 1521 dev_err(&i2c->dev, "Failed to allocate temporary cache\n");
1521 } 1522 }
diff --git a/sound/soc/omap/Makefile b/sound/soc/omap/Makefile
index 3db8a6c523f4..19283e5edfbf 100644
--- a/sound/soc/omap/Makefile
+++ b/sound/soc/omap/Makefile
@@ -25,7 +25,7 @@ obj-$(CONFIG_SND_OMAP_SOC_OSK5912) += snd-soc-osk5912.o
25obj-$(CONFIG_SND_OMAP_SOC_OVERO) += snd-soc-overo.o 25obj-$(CONFIG_SND_OMAP_SOC_OVERO) += snd-soc-overo.o
26obj-$(CONFIG_SND_OMAP_SOC_OMAP2EVM) += snd-soc-omap2evm.o 26obj-$(CONFIG_SND_OMAP_SOC_OMAP2EVM) += snd-soc-omap2evm.o
27obj-$(CONFIG_SND_OMAP_SOC_OMAP3EVM) += snd-soc-omap3evm.o 27obj-$(CONFIG_SND_OMAP_SOC_OMAP3EVM) += snd-soc-omap3evm.o
28obj-$(CONFIG_SND_OMAP_SOC_OMAP3517EVM) += snd-soc-am3517evm.o 28obj-$(CONFIG_SND_OMAP_SOC_AM3517EVM) += snd-soc-am3517evm.o
29obj-$(CONFIG_SND_OMAP_SOC_SDP3430) += snd-soc-sdp3430.o 29obj-$(CONFIG_SND_OMAP_SOC_SDP3430) += snd-soc-sdp3430.o
30obj-$(CONFIG_SND_OMAP_SOC_OMAP3_PANDORA) += snd-soc-omap3pandora.o 30obj-$(CONFIG_SND_OMAP_SOC_OMAP3_PANDORA) += snd-soc-omap3pandora.o
31obj-$(CONFIG_SND_OMAP_SOC_OMAP3_BEAGLE) += snd-soc-omap3beagle.o 31obj-$(CONFIG_SND_OMAP_SOC_OMAP3_BEAGLE) += snd-soc-omap3beagle.o
diff --git a/sound/soc/omap/omap3pandora.c b/sound/soc/omap/omap3pandora.c
index 71b2c161158d..68980c19a3bc 100644
--- a/sound/soc/omap/omap3pandora.c
+++ b/sound/soc/omap/omap3pandora.c
@@ -145,6 +145,7 @@ static const struct snd_soc_dapm_widget omap3pandora_in_dapm_widgets[] = {
145}; 145};
146 146
147static const struct snd_soc_dapm_route omap3pandora_out_map[] = { 147static const struct snd_soc_dapm_route omap3pandora_out_map[] = {
148 {"PCM DAC", NULL, "APLL Enable"},
148 {"Headphone Amplifier", NULL, "PCM DAC"}, 149 {"Headphone Amplifier", NULL, "PCM DAC"},
149 {"Line Out", NULL, "PCM DAC"}, 150 {"Line Out", NULL, "PCM DAC"},
150 {"Headphone Jack", NULL, "Headphone Amplifier"}, 151 {"Headphone Jack", NULL, "Headphone Amplifier"},
diff --git a/sound/soc/pxa/pxa-ssp.c b/sound/soc/pxa/pxa-ssp.c
index 3bd7712f029b..cf00df9c40f4 100644
--- a/sound/soc/pxa/pxa-ssp.c
+++ b/sound/soc/pxa/pxa-ssp.c
@@ -42,11 +42,14 @@
42 * SSP audio private data 42 * SSP audio private data
43 */ 43 */
44struct ssp_priv { 44struct ssp_priv {
45 struct ssp_dev dev; 45 struct ssp_device *ssp;
46 unsigned int sysclk; 46 unsigned int sysclk;
47 int dai_fmt; 47 int dai_fmt;
48#ifdef CONFIG_PM 48#ifdef CONFIG_PM
49 struct ssp_state state; 49 uint32_t cr0;
50 uint32_t cr1;
51 uint32_t to;
52 uint32_t psp;
50#endif 53#endif
51}; 54};
52 55
@@ -61,6 +64,22 @@ static void dump_registers(struct ssp_device *ssp)
61 ssp_read_reg(ssp, SSACD)); 64 ssp_read_reg(ssp, SSACD));
62} 65}
63 66
67static void ssp_enable(struct ssp_device *ssp)
68{
69 uint32_t sscr0;
70
71 sscr0 = __raw_readl(ssp->mmio_base + SSCR0) | SSCR0_SSE;
72 __raw_writel(sscr0, ssp->mmio_base + SSCR0);
73}
74
75static void ssp_disable(struct ssp_device *ssp)
76{
77 uint32_t sscr0;
78
79 sscr0 = __raw_readl(ssp->mmio_base + SSCR0) & ~SSCR0_SSE;
80 __raw_writel(sscr0, ssp->mmio_base + SSCR0);
81}
82
64struct pxa2xx_pcm_dma_data { 83struct pxa2xx_pcm_dma_data {
65 struct pxa2xx_pcm_dma_params params; 84 struct pxa2xx_pcm_dma_params params;
66 char name[20]; 85 char name[20];
@@ -94,13 +113,12 @@ static int pxa_ssp_startup(struct snd_pcm_substream *substream,
94 struct snd_soc_pcm_runtime *rtd = substream->private_data; 113 struct snd_soc_pcm_runtime *rtd = substream->private_data;
95 struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; 114 struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai;
96 struct ssp_priv *priv = cpu_dai->private_data; 115 struct ssp_priv *priv = cpu_dai->private_data;
116 struct ssp_device *ssp = priv->ssp;
97 int ret = 0; 117 int ret = 0;
98 118
99 if (!cpu_dai->active) { 119 if (!cpu_dai->active) {
100 priv->dev.port = cpu_dai->id + 1; 120 clk_enable(ssp->clk);
101 priv->dev.irq = NO_IRQ; 121 ssp_disable(ssp);
102 clk_enable(priv->dev.ssp->clk);
103 ssp_disable(&priv->dev);
104 } 122 }
105 123
106 if (cpu_dai->dma_data) { 124 if (cpu_dai->dma_data) {
@@ -116,10 +134,11 @@ static void pxa_ssp_shutdown(struct snd_pcm_substream *substream,
116 struct snd_soc_pcm_runtime *rtd = substream->private_data; 134 struct snd_soc_pcm_runtime *rtd = substream->private_data;
117 struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; 135 struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai;
118 struct ssp_priv *priv = cpu_dai->private_data; 136 struct ssp_priv *priv = cpu_dai->private_data;
137 struct ssp_device *ssp = priv->ssp;
119 138
120 if (!cpu_dai->active) { 139 if (!cpu_dai->active) {
121 ssp_disable(&priv->dev); 140 ssp_disable(ssp);
122 clk_disable(priv->dev.ssp->clk); 141 clk_disable(ssp->clk);
123 } 142 }
124 143
125 if (cpu_dai->dma_data) { 144 if (cpu_dai->dma_data) {
@@ -133,26 +152,39 @@ static void pxa_ssp_shutdown(struct snd_pcm_substream *substream,
133static int pxa_ssp_suspend(struct snd_soc_dai *cpu_dai) 152static int pxa_ssp_suspend(struct snd_soc_dai *cpu_dai)
134{ 153{
135 struct ssp_priv *priv = cpu_dai->private_data; 154 struct ssp_priv *priv = cpu_dai->private_data;
155 struct ssp_device *ssp = priv->ssp;
136 156
137 if (!cpu_dai->active) 157 if (!cpu_dai->active)
138 return 0; 158 return 0;
139 159
140 ssp_save_state(&priv->dev, &priv->state); 160 priv->cr0 = __raw_readl(ssp->mmio_base + SSCR0);
141 clk_disable(priv->dev.ssp->clk); 161 priv->cr1 = __raw_readl(ssp->mmio_base + SSCR1);
162 priv->to = __raw_readl(ssp->mmio_base + SSTO);
163 priv->psp = __raw_readl(ssp->mmio_base + SSPSP);
164
165 ssp_disable(ssp);
166 clk_disable(ssp->clk);
142 return 0; 167 return 0;
143} 168}
144 169
145static int pxa_ssp_resume(struct snd_soc_dai *cpu_dai) 170static int pxa_ssp_resume(struct snd_soc_dai *cpu_dai)
146{ 171{
147 struct ssp_priv *priv = cpu_dai->private_data; 172 struct ssp_priv *priv = cpu_dai->private_data;
173 struct ssp_device *ssp = priv->ssp;
174 uint32_t sssr = SSSR_ROR | SSSR_TUR | SSSR_BCE;
148 175
149 if (!cpu_dai->active) 176 if (!cpu_dai->active)
150 return 0; 177 return 0;
151 178
152 clk_enable(priv->dev.ssp->clk); 179 clk_enable(ssp->clk);
153 ssp_restore_state(&priv->dev, &priv->state); 180
154 ssp_enable(&priv->dev); 181 __raw_writel(sssr, ssp->mmio_base + SSSR);
155 182
183 __raw_writel(priv->cr0 & ~SSCR0_SSE, ssp->mmio_base + SSCR0);
184 __raw_writel(priv->cr1, ssp->mmio_base + SSCR1);
185 __raw_writel(priv->to, ssp->mmio_base + SSTO);
186 __raw_writel(priv->psp, ssp->mmio_base + SSPSP);
187 __raw_writel(priv->cr0 | SSCR0_SSE, ssp->mmio_base + SSCR0);
156 return 0; 188 return 0;
157} 189}
158 190
@@ -201,7 +233,7 @@ static int pxa_ssp_set_dai_sysclk(struct snd_soc_dai *cpu_dai,
201 int clk_id, unsigned int freq, int dir) 233 int clk_id, unsigned int freq, int dir)
202{ 234{
203 struct ssp_priv *priv = cpu_dai->private_data; 235 struct ssp_priv *priv = cpu_dai->private_data;
204 struct ssp_device *ssp = priv->dev.ssp; 236 struct ssp_device *ssp = priv->ssp;
205 int val; 237 int val;
206 238
207 u32 sscr0 = ssp_read_reg(ssp, SSCR0) & 239 u32 sscr0 = ssp_read_reg(ssp, SSCR0) &
@@ -242,11 +274,11 @@ static int pxa_ssp_set_dai_sysclk(struct snd_soc_dai *cpu_dai,
242 /* The SSP clock must be disabled when changing SSP clock mode 274 /* The SSP clock must be disabled when changing SSP clock mode
243 * on PXA2xx. On PXA3xx it must be enabled when doing so. */ 275 * on PXA2xx. On PXA3xx it must be enabled when doing so. */
244 if (!cpu_is_pxa3xx()) 276 if (!cpu_is_pxa3xx())
245 clk_disable(priv->dev.ssp->clk); 277 clk_disable(ssp->clk);
246 val = ssp_read_reg(ssp, SSCR0) | sscr0; 278 val = ssp_read_reg(ssp, SSCR0) | sscr0;
247 ssp_write_reg(ssp, SSCR0, val); 279 ssp_write_reg(ssp, SSCR0, val);
248 if (!cpu_is_pxa3xx()) 280 if (!cpu_is_pxa3xx())
249 clk_enable(priv->dev.ssp->clk); 281 clk_enable(ssp->clk);
250 282
251 return 0; 283 return 0;
252} 284}
@@ -258,7 +290,7 @@ static int pxa_ssp_set_dai_clkdiv(struct snd_soc_dai *cpu_dai,
258 int div_id, int div) 290 int div_id, int div)
259{ 291{
260 struct ssp_priv *priv = cpu_dai->private_data; 292 struct ssp_priv *priv = cpu_dai->private_data;
261 struct ssp_device *ssp = priv->dev.ssp; 293 struct ssp_device *ssp = priv->ssp;
262 int val; 294 int val;
263 295
264 switch (div_id) { 296 switch (div_id) {
@@ -309,7 +341,7 @@ static int pxa_ssp_set_dai_pll(struct snd_soc_dai *cpu_dai, int pll_id,
309 int source, unsigned int freq_in, unsigned int freq_out) 341 int source, unsigned int freq_in, unsigned int freq_out)
310{ 342{
311 struct ssp_priv *priv = cpu_dai->private_data; 343 struct ssp_priv *priv = cpu_dai->private_data;
312 struct ssp_device *ssp = priv->dev.ssp; 344 struct ssp_device *ssp = priv->ssp;
313 u32 ssacd = ssp_read_reg(ssp, SSACD) & ~0x70; 345 u32 ssacd = ssp_read_reg(ssp, SSACD) & ~0x70;
314 346
315#if defined(CONFIG_PXA3xx) 347#if defined(CONFIG_PXA3xx)
@@ -378,7 +410,7 @@ static int pxa_ssp_set_dai_tdm_slot(struct snd_soc_dai *cpu_dai,
378 unsigned int tx_mask, unsigned int rx_mask, int slots, int slot_width) 410 unsigned int tx_mask, unsigned int rx_mask, int slots, int slot_width)
379{ 411{
380 struct ssp_priv *priv = cpu_dai->private_data; 412 struct ssp_priv *priv = cpu_dai->private_data;
381 struct ssp_device *ssp = priv->dev.ssp; 413 struct ssp_device *ssp = priv->ssp;
382 u32 sscr0; 414 u32 sscr0;
383 415
384 sscr0 = ssp_read_reg(ssp, SSCR0); 416 sscr0 = ssp_read_reg(ssp, SSCR0);
@@ -413,7 +445,7 @@ static int pxa_ssp_set_dai_tristate(struct snd_soc_dai *cpu_dai,
413 int tristate) 445 int tristate)
414{ 446{
415 struct ssp_priv *priv = cpu_dai->private_data; 447 struct ssp_priv *priv = cpu_dai->private_data;
416 struct ssp_device *ssp = priv->dev.ssp; 448 struct ssp_device *ssp = priv->ssp;
417 u32 sscr1; 449 u32 sscr1;
418 450
419 sscr1 = ssp_read_reg(ssp, SSCR1); 451 sscr1 = ssp_read_reg(ssp, SSCR1);
@@ -435,7 +467,7 @@ static int pxa_ssp_set_dai_fmt(struct snd_soc_dai *cpu_dai,
435 unsigned int fmt) 467 unsigned int fmt)
436{ 468{
437 struct ssp_priv *priv = cpu_dai->private_data; 469 struct ssp_priv *priv = cpu_dai->private_data;
438 struct ssp_device *ssp = priv->dev.ssp; 470 struct ssp_device *ssp = priv->ssp;
439 u32 sscr0; 471 u32 sscr0;
440 u32 sscr1; 472 u32 sscr1;
441 u32 sspsp; 473 u32 sspsp;
@@ -530,7 +562,7 @@ static int pxa_ssp_hw_params(struct snd_pcm_substream *substream,
530 struct snd_soc_pcm_runtime *rtd = substream->private_data; 562 struct snd_soc_pcm_runtime *rtd = substream->private_data;
531 struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; 563 struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai;
532 struct ssp_priv *priv = cpu_dai->private_data; 564 struct ssp_priv *priv = cpu_dai->private_data;
533 struct ssp_device *ssp = priv->dev.ssp; 565 struct ssp_device *ssp = priv->ssp;
534 int chn = params_channels(params); 566 int chn = params_channels(params);
535 u32 sscr0; 567 u32 sscr0;
536 u32 sspsp; 568 u32 sspsp;
@@ -640,12 +672,12 @@ static int pxa_ssp_trigger(struct snd_pcm_substream *substream, int cmd,
640 struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; 672 struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai;
641 int ret = 0; 673 int ret = 0;
642 struct ssp_priv *priv = cpu_dai->private_data; 674 struct ssp_priv *priv = cpu_dai->private_data;
643 struct ssp_device *ssp = priv->dev.ssp; 675 struct ssp_device *ssp = priv->ssp;
644 int val; 676 int val;
645 677
646 switch (cmd) { 678 switch (cmd) {
647 case SNDRV_PCM_TRIGGER_RESUME: 679 case SNDRV_PCM_TRIGGER_RESUME:
648 ssp_enable(&priv->dev); 680 ssp_enable(ssp);
649 break; 681 break;
650 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: 682 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
651 val = ssp_read_reg(ssp, SSCR1); 683 val = ssp_read_reg(ssp, SSCR1);
@@ -664,7 +696,7 @@ static int pxa_ssp_trigger(struct snd_pcm_substream *substream, int cmd,
664 else 696 else
665 val |= SSCR1_RSRE; 697 val |= SSCR1_RSRE;
666 ssp_write_reg(ssp, SSCR1, val); 698 ssp_write_reg(ssp, SSCR1, val);
667 ssp_enable(&priv->dev); 699 ssp_enable(ssp);
668 break; 700 break;
669 case SNDRV_PCM_TRIGGER_STOP: 701 case SNDRV_PCM_TRIGGER_STOP:
670 val = ssp_read_reg(ssp, SSCR1); 702 val = ssp_read_reg(ssp, SSCR1);
@@ -675,7 +707,7 @@ static int pxa_ssp_trigger(struct snd_pcm_substream *substream, int cmd,
675 ssp_write_reg(ssp, SSCR1, val); 707 ssp_write_reg(ssp, SSCR1, val);
676 break; 708 break;
677 case SNDRV_PCM_TRIGGER_SUSPEND: 709 case SNDRV_PCM_TRIGGER_SUSPEND:
678 ssp_disable(&priv->dev); 710 ssp_disable(ssp);
679 break; 711 break;
680 case SNDRV_PCM_TRIGGER_PAUSE_PUSH: 712 case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
681 val = ssp_read_reg(ssp, SSCR1); 713 val = ssp_read_reg(ssp, SSCR1);
@@ -705,8 +737,8 @@ static int pxa_ssp_probe(struct platform_device *pdev,
705 if (!priv) 737 if (!priv)
706 return -ENOMEM; 738 return -ENOMEM;
707 739
708 priv->dev.ssp = ssp_request(dai->id + 1, "SoC audio"); 740 priv->ssp = ssp_request(dai->id + 1, "SoC audio");
709 if (priv->dev.ssp == NULL) { 741 if (priv->ssp == NULL) {
710 ret = -ENODEV; 742 ret = -ENODEV;
711 goto err_priv; 743 goto err_priv;
712 } 744 }
@@ -725,7 +757,7 @@ static void pxa_ssp_remove(struct platform_device *pdev,
725 struct snd_soc_dai *dai) 757 struct snd_soc_dai *dai)
726{ 758{
727 struct ssp_priv *priv = dai->private_data; 759 struct ssp_priv *priv = dai->private_data;
728 ssp_free(priv->dev.ssp); 760 ssp_free(priv->ssp);
729} 761}
730 762
731#define PXA_SSP_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 |\ 763#define PXA_SSP_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 |\
diff --git a/sound/sound_core.c b/sound/sound_core.c
index dbca7c909a31..7c2d677a2df5 100644
--- a/sound/sound_core.c
+++ b/sound/sound_core.c
@@ -61,7 +61,7 @@ static void __exit cleanup_soundcore(void)
61 class_destroy(sound_class); 61 class_destroy(sound_class);
62} 62}
63 63
64module_init(init_soundcore); 64subsys_initcall(init_soundcore);
65module_exit(cleanup_soundcore); 65module_exit(cleanup_soundcore);
66 66
67 67