aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
Diffstat (limited to 'sound')
-rw-r--r--sound/drivers/mpu401/mpu401_uart.c12
-rw-r--r--sound/drivers/portman2x4.c2
-rw-r--r--sound/pci/ca0106/ca0106_mixer.c18
-rw-r--r--sound/pci/ca0106/ca0106_proc.c4
-rw-r--r--sound/pci/cmipci.c5
-rw-r--r--sound/pci/emu10k1/emumixer.c65
-rw-r--r--sound/pci/emu10k1/p16v.c4
-rw-r--r--sound/pci/hda/hda_codec.c40
-rw-r--r--sound/pci/hda/hda_local.h1
-rw-r--r--sound/pci/hda/patch_analog.c8
-rw-r--r--sound/pci/hda/patch_sigmatel.c57
-rw-r--r--sound/soc/codecs/cs4270.c3
-rw-r--r--sound/soc/s3c24xx/s3c2443-ac97.c2
13 files changed, 117 insertions, 104 deletions
diff --git a/sound/drivers/mpu401/mpu401_uart.c b/sound/drivers/mpu401/mpu401_uart.c
index 3306ecd49243..b57f2d5a1c9d 100644
--- a/sound/drivers/mpu401/mpu401_uart.c
+++ b/sound/drivers/mpu401/mpu401_uart.c
@@ -97,23 +97,27 @@ static void snd_mpu401_uart_clear_rx(struct snd_mpu401 *mpu)
97 97
98static void uart_interrupt_tx(struct snd_mpu401 *mpu) 98static void uart_interrupt_tx(struct snd_mpu401 *mpu)
99{ 99{
100 unsigned long flags;
101
100 if (test_bit(MPU401_MODE_BIT_OUTPUT, &mpu->mode) && 102 if (test_bit(MPU401_MODE_BIT_OUTPUT, &mpu->mode) &&
101 test_bit(MPU401_MODE_BIT_OUTPUT_TRIGGER, &mpu->mode)) { 103 test_bit(MPU401_MODE_BIT_OUTPUT_TRIGGER, &mpu->mode)) {
102 spin_lock(&mpu->output_lock); 104 spin_lock_irqsave(&mpu->output_lock, flags);
103 snd_mpu401_uart_output_write(mpu); 105 snd_mpu401_uart_output_write(mpu);
104 spin_unlock(&mpu->output_lock); 106 spin_unlock_irqrestore(&mpu->output_lock, flags);
105 } 107 }
106} 108}
107 109
108static void _snd_mpu401_uart_interrupt(struct snd_mpu401 *mpu) 110static void _snd_mpu401_uart_interrupt(struct snd_mpu401 *mpu)
109{ 111{
112 unsigned long flags;
113
110 if (mpu->info_flags & MPU401_INFO_INPUT) { 114 if (mpu->info_flags & MPU401_INFO_INPUT) {
111 spin_lock(&mpu->input_lock); 115 spin_lock_irqsave(&mpu->input_lock, flags);
112 if (test_bit(MPU401_MODE_BIT_INPUT, &mpu->mode)) 116 if (test_bit(MPU401_MODE_BIT_INPUT, &mpu->mode))
113 snd_mpu401_uart_input_read(mpu); 117 snd_mpu401_uart_input_read(mpu);
114 else 118 else
115 snd_mpu401_uart_clear_rx(mpu); 119 snd_mpu401_uart_clear_rx(mpu);
116 spin_unlock(&mpu->input_lock); 120 spin_unlock_irqrestore(&mpu->input_lock, flags);
117 } 121 }
118 if (! (mpu->info_flags & MPU401_INFO_TX_IRQ)) 122 if (! (mpu->info_flags & MPU401_INFO_TX_IRQ))
119 /* ok. for better Tx performance try do some output 123 /* ok. for better Tx performance try do some output
diff --git a/sound/drivers/portman2x4.c b/sound/drivers/portman2x4.c
index e065b2a6444a..1b832870cc84 100644
--- a/sound/drivers/portman2x4.c
+++ b/sound/drivers/portman2x4.c
@@ -668,7 +668,7 @@ static int __devinit snd_portman_probe_port(struct parport *p)
668 parport_release(pardev); 668 parport_release(pardev);
669 parport_unregister_device(pardev); 669 parport_unregister_device(pardev);
670 670
671 return res; 671 return res ? -EIO : 0;
672} 672}
673 673
674static void __devinit snd_portman_attach(struct parport *p) 674static void __devinit snd_portman_attach(struct parport *p)
diff --git a/sound/pci/ca0106/ca0106_mixer.c b/sound/pci/ca0106/ca0106_mixer.c
index be519a17dfa5..3f9b5c560036 100644
--- a/sound/pci/ca0106/ca0106_mixer.c
+++ b/sound/pci/ca0106/ca0106_mixer.c
@@ -86,7 +86,7 @@ static int snd_ca0106_shared_spdif_get(struct snd_kcontrol *kcontrol,
86{ 86{
87 struct snd_ca0106 *emu = snd_kcontrol_chip(kcontrol); 87 struct snd_ca0106 *emu = snd_kcontrol_chip(kcontrol);
88 88
89 ucontrol->value.enumerated.item[0] = emu->spdif_enable; 89 ucontrol->value.integer.value[0] = emu->spdif_enable;
90 return 0; 90 return 0;
91} 91}
92 92
@@ -98,11 +98,11 @@ static int snd_ca0106_shared_spdif_put(struct snd_kcontrol *kcontrol,
98 int change = 0; 98 int change = 0;
99 u32 mask; 99 u32 mask;
100 100
101 val = ucontrol->value.enumerated.item[0] ; 101 val = !!ucontrol->value.integer.value[0];
102 change = (emu->spdif_enable != val); 102 change = (emu->spdif_enable != val);
103 if (change) { 103 if (change) {
104 emu->spdif_enable = val; 104 emu->spdif_enable = val;
105 if (val == 1) { 105 if (val) {
106 /* Digital */ 106 /* Digital */
107 snd_ca0106_ptr_write(emu, SPDIF_SELECT1, 0, 0xf); 107 snd_ca0106_ptr_write(emu, SPDIF_SELECT1, 0, 0xf);
108 snd_ca0106_ptr_write(emu, SPDIF_SELECT2, 0, 0x0b000000); 108 snd_ca0106_ptr_write(emu, SPDIF_SELECT2, 0, 0x0b000000);
@@ -159,6 +159,8 @@ static int snd_ca0106_capture_source_put(struct snd_kcontrol *kcontrol,
159 u32 source; 159 u32 source;
160 160
161 val = ucontrol->value.enumerated.item[0] ; 161 val = ucontrol->value.enumerated.item[0] ;
162 if (val >= 6)
163 return -EINVAL;
162 change = (emu->capture_source != val); 164 change = (emu->capture_source != val);
163 if (change) { 165 if (change) {
164 emu->capture_source = val; 166 emu->capture_source = val;
@@ -207,6 +209,8 @@ static int snd_ca0106_i2c_capture_source_put(struct snd_kcontrol *kcontrol,
207 * for the particular source. 209 * for the particular source.
208 */ 210 */
209 source_id = ucontrol->value.enumerated.item[0] ; 211 source_id = ucontrol->value.enumerated.item[0] ;
212 if (source_id >= 4)
213 return -EINVAL;
210 change = (emu->i2c_capture_source != source_id); 214 change = (emu->i2c_capture_source != source_id);
211 if (change) { 215 if (change) {
212 snd_ca0106_i2c_write(emu, ADC_MUX, 0); /* Mute input */ 216 snd_ca0106_i2c_write(emu, ADC_MUX, 0); /* Mute input */
@@ -271,6 +275,8 @@ static int snd_ca0106_capture_mic_line_in_put(struct snd_kcontrol *kcontrol,
271 u32 tmp; 275 u32 tmp;
272 276
273 val = ucontrol->value.enumerated.item[0] ; 277 val = ucontrol->value.enumerated.item[0] ;
278 if (val > 1)
279 return -EINVAL;
274 change = (emu->capture_mic_line_in != val); 280 change = (emu->capture_mic_line_in != val);
275 if (change) { 281 if (change) {
276 emu->capture_mic_line_in = val; 282 emu->capture_mic_line_in = val;
@@ -443,7 +449,7 @@ static int snd_ca0106_i2c_volume_put(struct snd_kcontrol *kcontrol,
443 ogain = emu->i2c_capture_volume[source_id][0]; /* Left */ 449 ogain = emu->i2c_capture_volume[source_id][0]; /* Left */
444 ngain = ucontrol->value.integer.value[0]; 450 ngain = ucontrol->value.integer.value[0];
445 if (ngain > 0xff) 451 if (ngain > 0xff)
446 return 0; 452 return -EINVAL;
447 if (ogain != ngain) { 453 if (ogain != ngain) {
448 if (emu->i2c_capture_source == source_id) 454 if (emu->i2c_capture_source == source_id)
449 snd_ca0106_i2c_write(emu, ADC_ATTEN_ADCL, ((ngain) & 0xff) ); 455 snd_ca0106_i2c_write(emu, ADC_ATTEN_ADCL, ((ngain) & 0xff) );
@@ -453,7 +459,7 @@ static int snd_ca0106_i2c_volume_put(struct snd_kcontrol *kcontrol,
453 ogain = emu->i2c_capture_volume[source_id][1]; /* Right */ 459 ogain = emu->i2c_capture_volume[source_id][1]; /* Right */
454 ngain = ucontrol->value.integer.value[1]; 460 ngain = ucontrol->value.integer.value[1];
455 if (ngain > 0xff) 461 if (ngain > 0xff)
456 return 0; 462 return -EINVAL;
457 if (ogain != ngain) { 463 if (ogain != ngain) {
458 if (emu->i2c_capture_source == source_id) 464 if (emu->i2c_capture_source == source_id)
459 snd_ca0106_i2c_write(emu, ADC_ATTEN_ADCR, ((ngain) & 0xff)); 465 snd_ca0106_i2c_write(emu, ADC_ATTEN_ADCR, ((ngain) & 0xff));
@@ -497,7 +503,7 @@ static int spi_mute_put(struct snd_kcontrol *kcontrol,
497 } 503 }
498 504
499 ret = snd_ca0106_spi_write(emu, emu->spi_dac_reg[reg]); 505 ret = snd_ca0106_spi_write(emu, emu->spi_dac_reg[reg]);
500 return ret ? -1 : 1; 506 return ret ? -EINVAL : 1;
501} 507}
502 508
503#define CA_VOLUME(xname,chid,reg) \ 509#define CA_VOLUME(xname,chid,reg) \
diff --git a/sound/pci/ca0106/ca0106_proc.c b/sound/pci/ca0106/ca0106_proc.c
index ae80f51d8c4f..61f2718ae359 100644
--- a/sound/pci/ca0106/ca0106_proc.c
+++ b/sound/pci/ca0106/ca0106_proc.c
@@ -445,13 +445,11 @@ int __devinit snd_ca0106_proc_init(struct snd_ca0106 * emu)
445 snd_info_set_text_ops(entry, emu, snd_ca0106_proc_reg_read1); 445 snd_info_set_text_ops(entry, emu, snd_ca0106_proc_reg_read1);
446 entry->c.text.write = snd_ca0106_proc_reg_write; 446 entry->c.text.write = snd_ca0106_proc_reg_write;
447 entry->mode |= S_IWUSR; 447 entry->mode |= S_IWUSR;
448// entry->private_data = emu;
449 } 448 }
450 if(! snd_card_proc_new(emu->card, "ca0106_i2c", &entry)) { 449 if(! snd_card_proc_new(emu->card, "ca0106_i2c", &entry)) {
451 snd_info_set_text_ops(entry, emu, snd_ca0106_proc_i2c_write);
452 entry->c.text.write = snd_ca0106_proc_i2c_write; 450 entry->c.text.write = snd_ca0106_proc_i2c_write;
451 entry->private_data = emu;
453 entry->mode |= S_IWUSR; 452 entry->mode |= S_IWUSR;
454// entry->private_data = emu;
455 } 453 }
456 if(! snd_card_proc_new(emu->card, "ca0106_regs2", &entry)) 454 if(! snd_card_proc_new(emu->card, "ca0106_regs2", &entry))
457 snd_info_set_text_ops(entry, emu, snd_ca0106_proc_reg_read2); 455 snd_info_set_text_ops(entry, emu, snd_ca0106_proc_reg_read2);
diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c
index 6832649879ce..1fa5f004e858 100644
--- a/sound/pci/cmipci.c
+++ b/sound/pci/cmipci.c
@@ -246,10 +246,9 @@ MODULE_PARM_DESC(joystick_port, "Joystick port address.");
246#define CM_MMODE_MASK 0x00000E00 /* model DAA interface mode */ 246#define CM_MMODE_MASK 0x00000E00 /* model DAA interface mode */
247#define CM_SPDIF_SELECT2 0x00000100 /* for model > 039 ? */ 247#define CM_SPDIF_SELECT2 0x00000100 /* for model > 039 ? */
248#define CM_ENCENTER 0x00000080 248#define CM_ENCENTER 0x00000080
249#define CM_FLINKON 0x00000080 /* force modem link detection on, model 037 */ 249#define CM_FLINKON 0x00000040 /* force modem link detection on, model 037 */
250#define CM_MUTECH1 0x00000040 /* mute PCI ch1 to DAC */ 250#define CM_MUTECH1 0x00000040 /* mute PCI ch1 to DAC */
251#define CM_FLINKOFF 0x00000040 /* force modem link detection off, model 037 */ 251#define CM_FLINKOFF 0x00000020 /* force modem link detection off, model 037 */
252#define CM_UNKNOWN_18_5 0x00000020 /* ? */
253#define CM_MIDSMP 0x00000010 /* 1/2 interpolation at front end DAC */ 252#define CM_MIDSMP 0x00000010 /* 1/2 interpolation at front end DAC */
254#define CM_UPDDMA_MASK 0x0000000C /* TDMA position update notification */ 253#define CM_UPDDMA_MASK 0x0000000C /* TDMA position update notification */
255#define CM_UPDDMA_2048 0x00000000 254#define CM_UPDDMA_2048 0x00000000
diff --git a/sound/pci/emu10k1/emumixer.c b/sound/pci/emu10k1/emumixer.c
index 54a2034d8edd..ccacd7b890e8 100644
--- a/sound/pci/emu10k1/emumixer.c
+++ b/sound/pci/emu10k1/emumixer.c
@@ -58,6 +58,9 @@ static int snd_emu10k1_spdif_get(struct snd_kcontrol *kcontrol,
58 unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); 58 unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
59 unsigned long flags; 59 unsigned long flags;
60 60
61 /* Limit: emu->spdif_bits */
62 if (idx >= 3)
63 return -EINVAL;
61 spin_lock_irqsave(&emu->reg_lock, flags); 64 spin_lock_irqsave(&emu->reg_lock, flags);
62 ucontrol->value.iec958.status[0] = (emu->spdif_bits[idx] >> 0) & 0xff; 65 ucontrol->value.iec958.status[0] = (emu->spdif_bits[idx] >> 0) & 0xff;
63 ucontrol->value.iec958.status[1] = (emu->spdif_bits[idx] >> 8) & 0xff; 66 ucontrol->value.iec958.status[1] = (emu->spdif_bits[idx] >> 8) & 0xff;
@@ -272,9 +275,12 @@ static int snd_emu1010_output_source_get(struct snd_kcontrol *kcontrol,
272 struct snd_ctl_elem_value *ucontrol) 275 struct snd_ctl_elem_value *ucontrol)
273{ 276{
274 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); 277 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
275 int channel; 278 unsigned int channel;
276 279
277 channel = (kcontrol->private_value) & 0xff; 280 channel = (kcontrol->private_value) & 0xff;
281 /* Limit: emu1010_output_dst, emu->emu1010.output_source */
282 if (channel >= 24)
283 return -EINVAL;
278 ucontrol->value.enumerated.item[0] = emu->emu1010.output_source[channel]; 284 ucontrol->value.enumerated.item[0] = emu->emu1010.output_source[channel];
279 return 0; 285 return 0;
280} 286}
@@ -285,11 +291,17 @@ static int snd_emu1010_output_source_put(struct snd_kcontrol *kcontrol,
285 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); 291 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
286 int change = 0; 292 int change = 0;
287 unsigned int val; 293 unsigned int val;
288 int channel; 294 unsigned int channel;
289 295
296 val = ucontrol->value.enumerated.item[0];
297 if (val >= 53)
298 return -EINVAL;
290 channel = (kcontrol->private_value) & 0xff; 299 channel = (kcontrol->private_value) & 0xff;
291 if (emu->emu1010.output_source[channel] != ucontrol->value.enumerated.item[0]) { 300 /* Limit: emu1010_output_dst, emu->emu1010.output_source */
292 val = emu->emu1010.output_source[channel] = ucontrol->value.enumerated.item[0]; 301 if (channel >= 24)
302 return -EINVAL;
303 if (emu->emu1010.output_source[channel] != val) {
304 emu->emu1010.output_source[channel] = val;
293 change = 1; 305 change = 1;
294 snd_emu1010_fpga_link_dst_src_write(emu, 306 snd_emu1010_fpga_link_dst_src_write(emu,
295 emu1010_output_dst[channel], emu1010_src_regs[val]); 307 emu1010_output_dst[channel], emu1010_src_regs[val]);
@@ -301,9 +313,12 @@ static int snd_emu1010_input_source_get(struct snd_kcontrol *kcontrol,
301 struct snd_ctl_elem_value *ucontrol) 313 struct snd_ctl_elem_value *ucontrol)
302{ 314{
303 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); 315 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
304 int channel; 316 unsigned int channel;
305 317
306 channel = (kcontrol->private_value) & 0xff; 318 channel = (kcontrol->private_value) & 0xff;
319 /* Limit: emu1010_input_dst, emu->emu1010.input_source */
320 if (channel >= 22)
321 return -EINVAL;
307 ucontrol->value.enumerated.item[0] = emu->emu1010.input_source[channel]; 322 ucontrol->value.enumerated.item[0] = emu->emu1010.input_source[channel];
308 return 0; 323 return 0;
309} 324}
@@ -314,11 +329,17 @@ static int snd_emu1010_input_source_put(struct snd_kcontrol *kcontrol,
314 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); 329 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
315 int change = 0; 330 int change = 0;
316 unsigned int val; 331 unsigned int val;
317 int channel; 332 unsigned int channel;
318 333
334 val = ucontrol->value.enumerated.item[0];
335 if (val >= 53)
336 return -EINVAL;
319 channel = (kcontrol->private_value) & 0xff; 337 channel = (kcontrol->private_value) & 0xff;
320 if (emu->emu1010.input_source[channel] != ucontrol->value.enumerated.item[0]) { 338 /* Limit: emu1010_input_dst, emu->emu1010.input_source */
321 val = emu->emu1010.input_source[channel] = ucontrol->value.enumerated.item[0]; 339 if (channel >= 22)
340 return -EINVAL;
341 if (emu->emu1010.input_source[channel] != val) {
342 emu->emu1010.input_source[channel] = val;
322 change = 1; 343 change = 1;
323 snd_emu1010_fpga_link_dst_src_write(emu, 344 snd_emu1010_fpga_link_dst_src_write(emu,
324 emu1010_input_dst[channel], emu1010_src_regs[val]); 345 emu1010_input_dst[channel], emu1010_src_regs[val]);
@@ -533,6 +554,9 @@ static int snd_emu1010_internal_clock_put(struct snd_kcontrol *kcontrol,
533 int change = 0; 554 int change = 0;
534 555
535 val = ucontrol->value.enumerated.item[0] ; 556 val = ucontrol->value.enumerated.item[0] ;
557 /* Limit: uinfo->value.enumerated.items = 4; */
558 if (val >= 4)
559 return -EINVAL;
536 change = (emu->emu1010.internal_clock != val); 560 change = (emu->emu1010.internal_clock != val);
537 if (change) { 561 if (change) {
538 emu->emu1010.internal_clock = val; 562 emu->emu1010.internal_clock = val;
@@ -669,7 +693,11 @@ static int snd_audigy_i2c_capture_source_put(struct snd_kcontrol *kcontrol,
669 * update the capture volume from the cached value 693 * update the capture volume from the cached value
670 * for the particular source. 694 * for the particular source.
671 */ 695 */
672 source_id = ucontrol->value.enumerated.item[0]; /* Use 2 and 3 */ 696 source_id = ucontrol->value.enumerated.item[0];
697 /* Limit: uinfo->value.enumerated.items = 2; */
698 /* emu->i2c_capture_volume */
699 if (source_id >= 2)
700 return -EINVAL;
673 change = (emu->i2c_capture_source != source_id); 701 change = (emu->i2c_capture_source != source_id);
674 if (change) { 702 if (change) {
675 snd_emu10k1_i2c_write(emu, ADC_MUX, 0); /* Mute input */ 703 snd_emu10k1_i2c_write(emu, ADC_MUX, 0); /* Mute input */
@@ -720,9 +748,13 @@ static int snd_audigy_i2c_volume_get(struct snd_kcontrol *kcontrol,
720 struct snd_ctl_elem_value *ucontrol) 748 struct snd_ctl_elem_value *ucontrol)
721{ 749{
722 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); 750 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
723 int source_id; 751 unsigned int source_id;
724 752
725 source_id = kcontrol->private_value; 753 source_id = kcontrol->private_value;
754 /* Limit: emu->i2c_capture_volume */
755 /* capture_source: uinfo->value.enumerated.items = 2 */
756 if (source_id >= 2)
757 return -EINVAL;
726 758
727 ucontrol->value.integer.value[0] = emu->i2c_capture_volume[source_id][0]; 759 ucontrol->value.integer.value[0] = emu->i2c_capture_volume[source_id][0];
728 ucontrol->value.integer.value[1] = emu->i2c_capture_volume[source_id][1]; 760 ucontrol->value.integer.value[1] = emu->i2c_capture_volume[source_id][1];
@@ -735,10 +767,14 @@ static int snd_audigy_i2c_volume_put(struct snd_kcontrol *kcontrol,
735 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); 767 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
736 unsigned int ogain; 768 unsigned int ogain;
737 unsigned int ngain; 769 unsigned int ngain;
738 int source_id; 770 unsigned int source_id;
739 int change = 0; 771 int change = 0;
740 772
741 source_id = kcontrol->private_value; 773 source_id = kcontrol->private_value;
774 /* Limit: emu->i2c_capture_volume */
775 /* capture_source: uinfo->value.enumerated.items = 2 */
776 if (source_id >= 2)
777 return -EINVAL;
742 ogain = emu->i2c_capture_volume[source_id][0]; /* Left */ 778 ogain = emu->i2c_capture_volume[source_id][0]; /* Left */
743 ngain = ucontrol->value.integer.value[0]; 779 ngain = ucontrol->value.integer.value[0];
744 if (ngain > 0xff) 780 if (ngain > 0xff)
@@ -746,7 +782,7 @@ static int snd_audigy_i2c_volume_put(struct snd_kcontrol *kcontrol,
746 if (ogain != ngain) { 782 if (ogain != ngain) {
747 if (emu->i2c_capture_source == source_id) 783 if (emu->i2c_capture_source == source_id)
748 snd_emu10k1_i2c_write(emu, ADC_ATTEN_ADCL, ((ngain) & 0xff) ); 784 snd_emu10k1_i2c_write(emu, ADC_ATTEN_ADCL, ((ngain) & 0xff) );
749 emu->i2c_capture_volume[source_id][0] = ucontrol->value.integer.value[0]; 785 emu->i2c_capture_volume[source_id][0] = ngain;
750 change = 1; 786 change = 1;
751 } 787 }
752 ogain = emu->i2c_capture_volume[source_id][1]; /* Right */ 788 ogain = emu->i2c_capture_volume[source_id][1]; /* Right */
@@ -756,7 +792,7 @@ static int snd_audigy_i2c_volume_put(struct snd_kcontrol *kcontrol,
756 if (ogain != ngain) { 792 if (ogain != ngain) {
757 if (emu->i2c_capture_source == source_id) 793 if (emu->i2c_capture_source == source_id)
758 snd_emu10k1_i2c_write(emu, ADC_ATTEN_ADCR, ((ngain) & 0xff)); 794 snd_emu10k1_i2c_write(emu, ADC_ATTEN_ADCR, ((ngain) & 0xff));
759 emu->i2c_capture_volume[source_id][1] = ucontrol->value.integer.value[1]; 795 emu->i2c_capture_volume[source_id][1] = ngain;
760 change = 1; 796 change = 1;
761 } 797 }
762 798
@@ -877,6 +913,9 @@ static int snd_emu10k1_spdif_put(struct snd_kcontrol *kcontrol,
877 unsigned int val; 913 unsigned int val;
878 unsigned long flags; 914 unsigned long flags;
879 915
916 /* Limit: emu->spdif_bits */
917 if (idx >= 3)
918 return -EINVAL;
880 val = (ucontrol->value.iec958.status[0] << 0) | 919 val = (ucontrol->value.iec958.status[0] << 0) |
881 (ucontrol->value.iec958.status[1] << 8) | 920 (ucontrol->value.iec958.status[1] << 8) |
882 (ucontrol->value.iec958.status[2] << 16) | 921 (ucontrol->value.iec958.status[2] << 16) |
diff --git a/sound/pci/emu10k1/p16v.c b/sound/pci/emu10k1/p16v.c
index d619a3842cdd..9fd3135f3118 100644
--- a/sound/pci/emu10k1/p16v.c
+++ b/sound/pci/emu10k1/p16v.c
@@ -742,6 +742,8 @@ static int snd_p16v_capture_source_put(struct snd_kcontrol *kcontrol,
742 u32 source; 742 u32 source;
743 743
744 val = ucontrol->value.enumerated.item[0] ; 744 val = ucontrol->value.enumerated.item[0] ;
745 if (val > 7)
746 return -EINVAL;
745 change = (emu->p16v_capture_source != val); 747 change = (emu->p16v_capture_source != val);
746 if (change) { 748 if (change) {
747 emu->p16v_capture_source = val; 749 emu->p16v_capture_source = val;
@@ -784,6 +786,8 @@ static int snd_p16v_capture_channel_put(struct snd_kcontrol *kcontrol,
784 u32 tmp; 786 u32 tmp;
785 787
786 val = ucontrol->value.enumerated.item[0] ; 788 val = ucontrol->value.enumerated.item[0] ;
789 if (val > 3)
790 return -EINVAL;
787 change = (emu->p16v_capture_channel != val); 791 change = (emu->p16v_capture_channel != val);
788 if (change) { 792 if (change) {
789 emu->p16v_capture_channel = val; 793 emu->p16v_capture_channel = val;
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index ad4cb38109fc..8cbe3bf1e317 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -1625,19 +1625,26 @@ static void hda_set_power_state(struct hda_codec *codec, hda_nid_t fg,
1625 1625
1626 nid = codec->start_nid; 1626 nid = codec->start_nid;
1627 for (i = 0; i < codec->num_nodes; i++, nid++) { 1627 for (i = 0; i < codec->num_nodes; i++, nid++) {
1628 if (get_wcaps(codec, nid) & AC_WCAP_POWER) { 1628 unsigned int wcaps = get_wcaps(codec, nid);
1629 unsigned int pincap; 1629 if (wcaps & AC_WCAP_POWER) {
1630 /* 1630 unsigned int wid_type = (wcaps & AC_WCAP_TYPE) >>
1631 * don't power down the widget if it controls eapd 1631 AC_WCAP_TYPE_SHIFT;
1632 * and EAPD_BTLENABLE is set. 1632 if (wid_type == AC_WID_PIN) {
1633 */ 1633 unsigned int pincap;
1634 pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP); 1634 /*
1635 if (pincap & AC_PINCAP_EAPD) { 1635 * don't power down the widget if it controls
1636 int eapd = snd_hda_codec_read(codec, nid, 1636 * eapd and EAPD_BTLENABLE is set.
1637 0, AC_VERB_GET_EAPD_BTLENABLE, 0); 1637 */
1638 eapd &= 0x02; 1638 pincap = snd_hda_param_read(codec, nid,
1639 if (power_state == AC_PWRST_D3 && eapd) 1639 AC_PAR_PIN_CAP);
1640 continue; 1640 if (pincap & AC_PINCAP_EAPD) {
1641 int eapd = snd_hda_codec_read(codec,
1642 nid, 0,
1643 AC_VERB_GET_EAPD_BTLENABLE, 0);
1644 eapd &= 0x02;
1645 if (power_state == AC_PWRST_D3 && eapd)
1646 continue;
1647 }
1641 } 1648 }
1642 snd_hda_codec_write(codec, nid, 0, 1649 snd_hda_codec_write(codec, nid, 0,
1643 AC_VERB_SET_POWER_STATE, 1650 AC_VERB_SET_POWER_STATE,
@@ -2485,13 +2492,14 @@ int snd_hda_multi_out_analog_prepare(struct hda_codec *codec,
2485 /* front */ 2492 /* front */
2486 snd_hda_codec_setup_stream(codec, nids[HDA_FRONT], stream_tag, 2493 snd_hda_codec_setup_stream(codec, nids[HDA_FRONT], stream_tag,
2487 0, format); 2494 0, format);
2488 if (mout->hp_nid && mout->hp_nid != nids[HDA_FRONT]) 2495 if (!mout->no_share_stream &&
2496 mout->hp_nid && mout->hp_nid != nids[HDA_FRONT])
2489 /* headphone out will just decode front left/right (stereo) */ 2497 /* headphone out will just decode front left/right (stereo) */
2490 snd_hda_codec_setup_stream(codec, mout->hp_nid, stream_tag, 2498 snd_hda_codec_setup_stream(codec, mout->hp_nid, stream_tag,
2491 0, format); 2499 0, format);
2492 /* extra outputs copied from front */ 2500 /* extra outputs copied from front */
2493 for (i = 0; i < ARRAY_SIZE(mout->extra_out_nid); i++) 2501 for (i = 0; i < ARRAY_SIZE(mout->extra_out_nid); i++)
2494 if (mout->extra_out_nid[i]) 2502 if (!mout->no_share_stream && mout->extra_out_nid[i])
2495 snd_hda_codec_setup_stream(codec, 2503 snd_hda_codec_setup_stream(codec,
2496 mout->extra_out_nid[i], 2504 mout->extra_out_nid[i],
2497 stream_tag, 0, format); 2505 stream_tag, 0, format);
@@ -2501,7 +2509,7 @@ int snd_hda_multi_out_analog_prepare(struct hda_codec *codec,
2501 if (chs >= (i + 1) * 2) /* independent out */ 2509 if (chs >= (i + 1) * 2) /* independent out */
2502 snd_hda_codec_setup_stream(codec, nids[i], stream_tag, 2510 snd_hda_codec_setup_stream(codec, nids[i], stream_tag,
2503 i * 2, format); 2511 i * 2, format);
2504 else /* copy front */ 2512 else if (!mout->no_share_stream) /* copy front */
2505 snd_hda_codec_setup_stream(codec, nids[i], stream_tag, 2513 snd_hda_codec_setup_stream(codec, nids[i], stream_tag,
2506 0, format); 2514 0, format);
2507 } 2515 }
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h
index 20c5e6250374..8c56c9cb0d09 100644
--- a/sound/pci/hda/hda_local.h
+++ b/sound/pci/hda/hda_local.h
@@ -220,6 +220,7 @@ struct hda_multi_out {
220 hda_nid_t dig_out_nid; /* digital out audio widget */ 220 hda_nid_t dig_out_nid; /* digital out audio widget */
221 int max_channels; /* currently supported analog channels */ 221 int max_channels; /* currently supported analog channels */
222 int dig_out_used; /* current usage of digital out (HDA_DIG_XXX) */ 222 int dig_out_used; /* current usage of digital out (HDA_DIG_XXX) */
223 int no_share_stream; /* don't share a stream with multiple pins */
223}; 224};
224 225
225int snd_hda_multi_out_dig_open(struct hda_codec *codec, 226int snd_hda_multi_out_dig_open(struct hda_codec *codec,
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
index 0ee8ae4d4410..196ad3c9405d 100644
--- a/sound/pci/hda/patch_analog.c
+++ b/sound/pci/hda/patch_analog.c
@@ -957,6 +957,14 @@ static int patch_ad1986a(struct hda_codec *codec)
957 break; 957 break;
958 } 958 }
959 959
960 /* AD1986A has a hardware problem that it can't share a stream
961 * with multiple output pins. The copy of front to surrounds
962 * causes noisy or silent outputs at a certain timing, e.g.
963 * changing the volume.
964 * So, let's disable the shared stream.
965 */
966 spec->multiout.no_share_stream = 1;
967
960 return 0; 968 return 0;
961} 969}
962 970
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index f9b2c435a130..04012237096c 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -111,7 +111,6 @@ struct sigmatel_spec {
111 unsigned int alt_switch: 1; 111 unsigned int alt_switch: 1;
112 unsigned int hp_detect: 1; 112 unsigned int hp_detect: 1;
113 unsigned int gpio_mute: 1; 113 unsigned int gpio_mute: 1;
114 unsigned int no_vol_knob :1;
115 114
116 unsigned int gpio_mask, gpio_data; 115 unsigned int gpio_mask, gpio_data;
117 116
@@ -342,42 +341,6 @@ static int stac92xx_aloopback_put(struct snd_kcontrol *kcontrol,
342 return 1; 341 return 1;
343} 342}
344 343
345static int stac92xx_volknob_info(struct snd_kcontrol *kcontrol,
346 struct snd_ctl_elem_info *uinfo)
347{
348 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
349 uinfo->count = 1;
350 uinfo->value.integer.min = 0;
351 uinfo->value.integer.max = 127;
352 return 0;
353}
354
355static int stac92xx_volknob_get(struct snd_kcontrol *kcontrol,
356 struct snd_ctl_elem_value *ucontrol)
357{
358 ucontrol->value.integer.value[0] = kcontrol->private_value & 0xff;
359 return 0;
360}
361
362static int stac92xx_volknob_put(struct snd_kcontrol *kcontrol,
363 struct snd_ctl_elem_value *ucontrol)
364{
365 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
366 unsigned int val = kcontrol->private_value & 0xff;
367
368 if (val == ucontrol->value.integer.value[0])
369 return 0;
370
371 val = ucontrol->value.integer.value[0];
372 kcontrol->private_value &= ~0xff;
373 kcontrol->private_value |= val;
374
375 snd_hda_codec_write_cache(codec, kcontrol->private_value >> 16, 0,
376 AC_VERB_SET_VOLUME_KNOB_CONTROL, val | 0x80);
377 return 1;
378}
379
380
381static struct hda_verb stac9200_core_init[] = { 344static struct hda_verb stac9200_core_init[] = {
382 /* set dac0mux for dac converter */ 345 /* set dac0mux for dac converter */
383 { 0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, 346 { 0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
@@ -446,18 +409,6 @@ static struct hda_verb stac9205_core_init[] = {
446 .private_value = verb_read | (verb_write << 16), \ 409 .private_value = verb_read | (verb_write << 16), \
447 } 410 }
448 411
449#define STAC_VOLKNOB(knob_nid) \
450 { \
451 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
452 .name = "Master Playback Volume", \
453 .count = 1, \
454 .info = stac92xx_volknob_info, \
455 .get = stac92xx_volknob_get, \
456 .put = stac92xx_volknob_put, \
457 .private_value = 127 | (knob_nid << 16), \
458 }
459
460
461static struct snd_kcontrol_new stac9200_mixer[] = { 412static struct snd_kcontrol_new stac9200_mixer[] = {
462 HDA_CODEC_VOLUME("Master Playback Volume", 0xb, 0, HDA_OUTPUT), 413 HDA_CODEC_VOLUME("Master Playback Volume", 0xb, 0, HDA_OUTPUT),
463 HDA_CODEC_MUTE("Master Playback Switch", 0xb, 0, HDA_OUTPUT), 414 HDA_CODEC_MUTE("Master Playback Switch", 0xb, 0, HDA_OUTPUT),
@@ -487,7 +438,6 @@ static struct snd_kcontrol_new stac9205_mixer[] = {
487 }, 438 },
488 STAC_INPUT_SOURCE(2), 439 STAC_INPUT_SOURCE(2),
489 STAC_ANALOG_LOOPBACK(0xFE0, 0x7E0), 440 STAC_ANALOG_LOOPBACK(0xFE0, 0x7E0),
490 STAC_VOLKNOB(0x24),
491 441
492 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1b, 0x0, HDA_INPUT), 442 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1b, 0x0, HDA_INPUT),
493 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1d, 0x0, HDA_OUTPUT), 443 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1d, 0x0, HDA_OUTPUT),
@@ -503,7 +453,6 @@ static struct snd_kcontrol_new stac9205_mixer[] = {
503/* This needs to be generated dynamically based on sequence */ 453/* This needs to be generated dynamically based on sequence */
504static struct snd_kcontrol_new stac922x_mixer[] = { 454static struct snd_kcontrol_new stac922x_mixer[] = {
505 STAC_INPUT_SOURCE(2), 455 STAC_INPUT_SOURCE(2),
506 STAC_VOLKNOB(0x16),
507 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x17, 0x0, HDA_INPUT), 456 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x17, 0x0, HDA_INPUT),
508 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x17, 0x0, HDA_INPUT), 457 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x17, 0x0, HDA_INPUT),
509 HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x0, 0x12, 0x0, HDA_OUTPUT), 458 HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x0, 0x12, 0x0, HDA_OUTPUT),
@@ -517,7 +466,6 @@ static struct snd_kcontrol_new stac922x_mixer[] = {
517 466
518static struct snd_kcontrol_new stac927x_mixer[] = { 467static struct snd_kcontrol_new stac927x_mixer[] = {
519 STAC_INPUT_SOURCE(3), 468 STAC_INPUT_SOURCE(3),
520 STAC_VOLKNOB(0x24),
521 STAC_ANALOG_LOOPBACK(0xFEB, 0x7EB), 469 STAC_ANALOG_LOOPBACK(0xFEB, 0x7EB),
522 470
523 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x18, 0x0, HDA_INPUT), 471 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x18, 0x0, HDA_INPUT),
@@ -1931,8 +1879,7 @@ static int stac92xx_auto_create_hp_ctls(struct hda_codec *codec,
1931 } 1879 }
1932 if (spec->multiout.hp_nid) { 1880 if (spec->multiout.hp_nid) {
1933 const char *pfx; 1881 const char *pfx;
1934 if (old_num_dacs == spec->multiout.num_dacs && 1882 if (old_num_dacs == spec->multiout.num_dacs)
1935 spec->no_vol_knob)
1936 pfx = "Master"; 1883 pfx = "Master";
1937 else 1884 else
1938 pfx = "Headphone"; 1885 pfx = "Headphone";
@@ -2489,7 +2436,6 @@ static int patch_stac9200(struct hda_codec *codec)
2489 codec->spec = spec; 2436 codec->spec = spec;
2490 spec->num_pins = ARRAY_SIZE(stac9200_pin_nids); 2437 spec->num_pins = ARRAY_SIZE(stac9200_pin_nids);
2491 spec->pin_nids = stac9200_pin_nids; 2438 spec->pin_nids = stac9200_pin_nids;
2492 spec->no_vol_knob = 1;
2493 spec->board_config = snd_hda_check_board_config(codec, STAC_9200_MODELS, 2439 spec->board_config = snd_hda_check_board_config(codec, STAC_9200_MODELS,
2494 stac9200_models, 2440 stac9200_models,
2495 stac9200_cfg_tbl); 2441 stac9200_cfg_tbl);
@@ -2544,7 +2490,6 @@ static int patch_stac925x(struct hda_codec *codec)
2544 codec->spec = spec; 2490 codec->spec = spec;
2545 spec->num_pins = ARRAY_SIZE(stac925x_pin_nids); 2491 spec->num_pins = ARRAY_SIZE(stac925x_pin_nids);
2546 spec->pin_nids = stac925x_pin_nids; 2492 spec->pin_nids = stac925x_pin_nids;
2547 spec->no_vol_knob = 1;
2548 spec->board_config = snd_hda_check_board_config(codec, STAC_925x_MODELS, 2493 spec->board_config = snd_hda_check_board_config(codec, STAC_925x_MODELS,
2549 stac925x_models, 2494 stac925x_models,
2550 stac925x_cfg_tbl); 2495 stac925x_cfg_tbl);
diff --git a/sound/soc/codecs/cs4270.c b/sound/soc/codecs/cs4270.c
index 5d601ad6da70..abac62866da8 100644
--- a/sound/soc/codecs/cs4270.c
+++ b/sound/soc/codecs/cs4270.c
@@ -725,7 +725,8 @@ static int cs4270_probe(struct platform_device *pdev)
725 codec->owner = THIS_MODULE; 725 codec->owner = THIS_MODULE;
726 codec->dai = &cs4270_dai; 726 codec->dai = &cs4270_dai;
727 codec->num_dai = 1; 727 codec->num_dai = 1;
728 codec->private_data = codec + ALIGN(sizeof(struct snd_soc_codec), 4); 728 codec->private_data = (void *) codec +
729 ALIGN(sizeof(struct snd_soc_codec), 4);
729 730
730 socdev->codec = codec; 731 socdev->codec = codec;
731 732
diff --git a/sound/soc/s3c24xx/s3c2443-ac97.c b/sound/soc/s3c24xx/s3c2443-ac97.c
index 75acf7ef5528..758a2637e7ac 100644
--- a/sound/soc/s3c24xx/s3c2443-ac97.c
+++ b/sound/soc/s3c24xx/s3c2443-ac97.c
@@ -32,7 +32,7 @@
32 32
33#include <asm/hardware.h> 33#include <asm/hardware.h>
34#include <asm/io.h> 34#include <asm/io.h>
35#include <asm/arch/regs-ac97.h> 35#include <asm/plat-s3c/regs-ac97.h>
36#include <asm/arch/regs-gpio.h> 36#include <asm/arch/regs-gpio.h>
37#include <asm/arch/regs-clock.h> 37#include <asm/arch/regs-clock.h>
38#include <asm/arch/audio.h> 38#include <asm/arch/audio.h>