aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-04-07 11:42:25 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-04-07 11:42:25 -0400
commit84db18bbeb5c9c1a9c86e38a89d76ee526fd2c6f (patch)
tree49d3959eb24cd7c0754ed50e05fb96b0fb8d04aa /sound/pci
parent6948ec70355ae6cf6082519e3d76b280373dade1 (diff)
parent55b371d4ac5ed6f3338a398fbf9f2eb9ace78799 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6: ALSA: mixart: range checking proc file ALSA: hda - Fix a wrong array range check in patch_realtek.c ALSA: ASoC: move dma_data from snd_soc_dai to snd_soc_pcm_stream ALSA: hda - Enable amplifiers on Acer Inspire 6530G ASoC: Only do WM8994 bias off transition from standby ASoC: Don't use DCS_DATAPATH_BUSY for WM hubs devices ASoC: Don't do runtime wm_hubs DC servo updates if using offset correction ASoC: Support second DC servo readback method for wm_hubs ASoC: Avoid wraparound in wm_hubs DC servo correction ALSA: echoaudio - Eliminate use after free ALSA: i2c: cleanup: change parameter to pointer ALSA: hda - Add MSI blacklist for Aopen MZ915-M ASoC: OMAP: Fix capture pointer handling for OMAP1510 to work correctly with recent ALSA PCM code ALSA: hda - Update document about MSI and interrupts ALSA: hda: Fix 0 dB offset for Lenovo Thinkpad models using AD1981 ALSA: hda - Add missing printk argument in previous patch ASoC: Fix passing platform_data to ac97 bus users and fix a leak ALSA: hda - Fix ADC/MUX assignment of ALC269 codec ALSA: hda - Fix invalid bit values passed to snd_hda_codec_amp_stereo() ASoC: wm8994: playback => capture
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/echoaudio/echoaudio.c5
-rw-r--r--sound/pci/hda/hda_intel.c1
-rw-r--r--sound/pci/hda/patch_analog.c8
-rw-r--r--sound/pci/hda/patch_realtek.c164
-rw-r--r--sound/pci/mixart/mixart.c24
5 files changed, 142 insertions, 60 deletions
diff --git a/sound/pci/echoaudio/echoaudio.c b/sound/pci/echoaudio/echoaudio.c
index 8dab82d7d19d..668a5ec04499 100644
--- a/sound/pci/echoaudio/echoaudio.c
+++ b/sound/pci/echoaudio/echoaudio.c
@@ -2184,10 +2184,9 @@ static int __devinit snd_echo_probe(struct pci_dev *pci,
2184 goto ctl_error; 2184 goto ctl_error;
2185#endif 2185#endif
2186 2186
2187 if ((err = snd_card_register(card)) < 0) { 2187 err = snd_card_register(card);
2188 snd_card_free(card); 2188 if (err < 0)
2189 goto ctl_error; 2189 goto ctl_error;
2190 }
2191 snd_printk(KERN_INFO "Card registered: %s\n", card->longname); 2190 snd_printk(KERN_INFO "Card registered: %s\n", card->longname);
2192 2191
2193 pci_set_drvdata(pci, chip); 2192 pci_set_drvdata(pci, chip);
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 4bb90675f70f..f8fd586ae024 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -2362,6 +2362,7 @@ static struct snd_pci_quirk msi_black_list[] __devinitdata = {
2362 SND_PCI_QUIRK(0x1043, 0x81f6, "ASUS", 0), /* nvidia */ 2362 SND_PCI_QUIRK(0x1043, 0x81f6, "ASUS", 0), /* nvidia */
2363 SND_PCI_QUIRK(0x1043, 0x822d, "ASUS", 0), /* Athlon64 X2 + nvidia MCP55 */ 2363 SND_PCI_QUIRK(0x1043, 0x822d, "ASUS", 0), /* Athlon64 X2 + nvidia MCP55 */
2364 SND_PCI_QUIRK(0x1849, 0x0888, "ASRock", 0), /* Athlon64 X2 + nvidia */ 2364 SND_PCI_QUIRK(0x1849, 0x0888, "ASRock", 0), /* Athlon64 X2 + nvidia */
2365 SND_PCI_QUIRK(0xa0a0, 0x0575, "Aopen MZ915-M", 0), /* ICH6 */
2365 {} 2366 {}
2366}; 2367};
2367 2368
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
index e6d1bdff1b6e..af34606c30c3 100644
--- a/sound/pci/hda/patch_analog.c
+++ b/sound/pci/hda/patch_analog.c
@@ -1896,6 +1896,14 @@ static int patch_ad1981(struct hda_codec *codec)
1896 case AD1981_THINKPAD: 1896 case AD1981_THINKPAD:
1897 spec->mixers[0] = ad1981_thinkpad_mixers; 1897 spec->mixers[0] = ad1981_thinkpad_mixers;
1898 spec->input_mux = &ad1981_thinkpad_capture_source; 1898 spec->input_mux = &ad1981_thinkpad_capture_source;
1899 /* set the upper-limit for mixer amp to 0dB for avoiding the
1900 * possible damage by overloading
1901 */
1902 snd_hda_override_amp_caps(codec, 0x11, HDA_INPUT,
1903 (0x17 << AC_AMPCAP_OFFSET_SHIFT) |
1904 (0x17 << AC_AMPCAP_NUM_STEPS_SHIFT) |
1905 (0x05 << AC_AMPCAP_STEP_SIZE_SHIFT) |
1906 (1 << AC_AMPCAP_MUTE_SHIFT));
1899 break; 1907 break;
1900 case AD1981_TOSHIBA: 1908 case AD1981_TOSHIBA:
1901 spec->mixers[0] = ad1981_hp_mixers; 1909 spec->mixers[0] = ad1981_hp_mixers;
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 9a23444e9e7a..c7730dbb9ddb 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -1621,6 +1621,11 @@ static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
1621 */ 1621 */
1622 1622
1623static struct hda_verb alc888_acer_aspire_6530g_verbs[] = { 1623static struct hda_verb alc888_acer_aspire_6530g_verbs[] = {
1624/* Route to built-in subwoofer as well as speakers */
1625 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1626 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
1627 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1628 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
1624/* Bias voltage on for external mic port */ 1629/* Bias voltage on for external mic port */
1625 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80}, 1630 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
1626/* Front Mic: set to PIN_IN (empty by default) */ 1631/* Front Mic: set to PIN_IN (empty by default) */
@@ -1632,10 +1637,12 @@ static struct hda_verb alc888_acer_aspire_6530g_verbs[] = {
1632/* Enable speaker output */ 1637/* Enable speaker output */
1633 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 1638 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1634 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1639 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1640 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
1635/* Enable headphone output */ 1641/* Enable headphone output */
1636 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, 1642 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1637 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1643 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1638 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, 1644 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1645 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
1639 { } 1646 { }
1640}; 1647};
1641 1648
@@ -4984,6 +4991,70 @@ static void set_capture_mixer(struct hda_codec *codec)
4984 } 4991 }
4985} 4992}
4986 4993
4994/* fill adc_nids (and capsrc_nids) containing all active input pins */
4995static void fillup_priv_adc_nids(struct hda_codec *codec, hda_nid_t *nids,
4996 int num_nids)
4997{
4998 struct alc_spec *spec = codec->spec;
4999 int n;
5000 hda_nid_t fallback_adc = 0, fallback_cap = 0;
5001
5002 for (n = 0; n < num_nids; n++) {
5003 hda_nid_t adc, cap;
5004 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
5005 int nconns, i, j;
5006
5007 adc = nids[n];
5008 if (get_wcaps_type(get_wcaps(codec, adc)) != AC_WID_AUD_IN)
5009 continue;
5010 cap = adc;
5011 nconns = snd_hda_get_connections(codec, cap, conn,
5012 ARRAY_SIZE(conn));
5013 if (nconns == 1) {
5014 cap = conn[0];
5015 nconns = snd_hda_get_connections(codec, cap, conn,
5016 ARRAY_SIZE(conn));
5017 }
5018 if (nconns <= 0)
5019 continue;
5020 if (!fallback_adc) {
5021 fallback_adc = adc;
5022 fallback_cap = cap;
5023 }
5024 for (i = 0; i < AUTO_PIN_LAST; i++) {
5025 hda_nid_t nid = spec->autocfg.input_pins[i];
5026 if (!nid)
5027 continue;
5028 for (j = 0; j < nconns; j++) {
5029 if (conn[j] == nid)
5030 break;
5031 }
5032 if (j >= nconns)
5033 break;
5034 }
5035 if (i >= AUTO_PIN_LAST) {
5036 int num_adcs = spec->num_adc_nids;
5037 spec->private_adc_nids[num_adcs] = adc;
5038 spec->private_capsrc_nids[num_adcs] = cap;
5039 spec->num_adc_nids++;
5040 spec->adc_nids = spec->private_adc_nids;
5041 if (adc != cap)
5042 spec->capsrc_nids = spec->private_capsrc_nids;
5043 }
5044 }
5045 if (!spec->num_adc_nids) {
5046 printk(KERN_WARNING "hda_codec: %s: no valid ADC found;"
5047 " using fallback 0x%x\n",
5048 codec->chip_name, fallback_adc);
5049 spec->private_adc_nids[0] = fallback_adc;
5050 spec->adc_nids = spec->private_adc_nids;
5051 if (fallback_adc != fallback_cap) {
5052 spec->private_capsrc_nids[0] = fallback_cap;
5053 spec->capsrc_nids = spec->private_adc_nids;
5054 }
5055 }
5056}
5057
4987#ifdef CONFIG_SND_HDA_INPUT_BEEP 5058#ifdef CONFIG_SND_HDA_INPUT_BEEP
4988#define set_beep_amp(spec, nid, idx, dir) \ 5059#define set_beep_amp(spec, nid, idx, dir) \
4989 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir)) 5060 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
@@ -8398,9 +8469,7 @@ static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
8398 8469
8399static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = { 8470static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
8400 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 8471 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8401 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8402 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT), 8472 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8403 HDA_BIND_MUTE("LFE Playback Switch", 0x0f, 2, HDA_INPUT),
8404 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), 8473 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8405 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), 8474 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8406 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), 8475 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
@@ -10041,13 +10110,12 @@ static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
10041 int idx; 10110 int idx;
10042 10111
10043 alc_set_pin_output(codec, nid, pin_type); 10112 alc_set_pin_output(codec, nid, pin_type);
10113 if (dac_idx >= spec->multiout.num_dacs)
10114 return;
10044 if (spec->multiout.dac_nids[dac_idx] == 0x25) 10115 if (spec->multiout.dac_nids[dac_idx] == 0x25)
10045 idx = 4; 10116 idx = 4;
10046 else { 10117 else
10047 if (spec->multiout.num_dacs >= dac_idx)
10048 return;
10049 idx = spec->multiout.dac_nids[dac_idx] - 2; 10118 idx = spec->multiout.dac_nids[dac_idx] - 2;
10050 }
10051 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); 10119 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
10052 10120
10053} 10121}
@@ -12459,11 +12527,11 @@ static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
12459 unsigned char bits; 12527 unsigned char bits;
12460 12528
12461 present = snd_hda_jack_detect(codec, 0x15); 12529 present = snd_hda_jack_detect(codec, 0x15);
12462 bits = present ? AMP_IN_MUTE(0) : 0; 12530 bits = present ? HDA_AMP_MUTE : 0;
12463 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0, 12531 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
12464 AMP_IN_MUTE(0), bits); 12532 HDA_AMP_MUTE, bits);
12465 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1, 12533 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
12466 AMP_IN_MUTE(0), bits); 12534 HDA_AMP_MUTE, bits);
12467} 12535}
12468 12536
12469static void alc268_acer_lc_unsol_event(struct hda_codec *codec, 12537static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
@@ -13333,9 +13401,9 @@ static hda_nid_t alc269vb_capsrc_nids[1] = {
13333 0x22, 13401 0x22,
13334}; 13402};
13335 13403
13336/* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24), 13404static hda_nid_t alc269_adc_candidates[] = {
13337 * not a mux! 13405 0x08, 0x09, 0x07,
13338 */ 13406};
13339 13407
13340#define alc269_modes alc260_modes 13408#define alc269_modes alc260_modes
13341#define alc269_capture_source alc880_lg_lw_capture_source 13409#define alc269_capture_source alc880_lg_lw_capture_source
@@ -13482,11 +13550,11 @@ static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
13482 unsigned char bits; 13550 unsigned char bits;
13483 13551
13484 present = snd_hda_jack_detect(codec, 0x15); 13552 present = snd_hda_jack_detect(codec, 0x15);
13485 bits = present ? AMP_IN_MUTE(0) : 0; 13553 bits = present ? HDA_AMP_MUTE : 0;
13486 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, 13554 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13487 AMP_IN_MUTE(0), bits); 13555 HDA_AMP_MUTE, bits);
13488 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, 13556 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13489 AMP_IN_MUTE(0), bits); 13557 HDA_AMP_MUTE, bits);
13490 13558
13491 snd_hda_codec_write(codec, 0x20, 0, 13559 snd_hda_codec_write(codec, 0x20, 0,
13492 AC_VERB_SET_COEF_INDEX, 0x0c); 13560 AC_VERB_SET_COEF_INDEX, 0x0c);
@@ -13511,11 +13579,11 @@ static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
13511 /* Check port replicator headphone socket */ 13579 /* Check port replicator headphone socket */
13512 present |= snd_hda_jack_detect(codec, 0x1a); 13580 present |= snd_hda_jack_detect(codec, 0x1a);
13513 13581
13514 bits = present ? AMP_IN_MUTE(0) : 0; 13582 bits = present ? HDA_AMP_MUTE : 0;
13515 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, 13583 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13516 AMP_IN_MUTE(0), bits); 13584 HDA_AMP_MUTE, bits);
13517 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, 13585 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13518 AMP_IN_MUTE(0), bits); 13586 HDA_AMP_MUTE, bits);
13519 13587
13520 snd_hda_codec_write(codec, 0x20, 0, 13588 snd_hda_codec_write(codec, 0x20, 0,
13521 AC_VERB_SET_COEF_INDEX, 0x0c); 13589 AC_VERB_SET_COEF_INDEX, 0x0c);
@@ -13646,11 +13714,11 @@ static void alc269_speaker_automute(struct hda_codec *codec)
13646 unsigned char bits; 13714 unsigned char bits;
13647 13715
13648 present = snd_hda_jack_detect(codec, nid); 13716 present = snd_hda_jack_detect(codec, nid);
13649 bits = present ? AMP_IN_MUTE(0) : 0; 13717 bits = present ? HDA_AMP_MUTE : 0;
13650 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, 13718 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13651 AMP_IN_MUTE(0), bits); 13719 HDA_AMP_MUTE, bits);
13652 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, 13720 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13653 AMP_IN_MUTE(0), bits); 13721 HDA_AMP_MUTE, bits);
13654} 13722}
13655 13723
13656/* unsolicited event for HP jack sensing */ 13724/* unsolicited event for HP jack sensing */
@@ -13842,7 +13910,6 @@ static int alc269_parse_auto_config(struct hda_codec *codec)
13842 struct alc_spec *spec = codec->spec; 13910 struct alc_spec *spec = codec->spec;
13843 int err; 13911 int err;
13844 static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; 13912 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
13845 hda_nid_t real_capsrc_nids;
13846 13913
13847 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, 13914 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13848 alc269_ignore); 13915 alc269_ignore);
@@ -13866,18 +13933,19 @@ static int alc269_parse_auto_config(struct hda_codec *codec)
13866 13933
13867 if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010) { 13934 if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010) {
13868 add_verb(spec, alc269vb_init_verbs); 13935 add_verb(spec, alc269vb_init_verbs);
13869 real_capsrc_nids = alc269vb_capsrc_nids[0];
13870 alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21); 13936 alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21);
13871 } else { 13937 } else {
13872 add_verb(spec, alc269_init_verbs); 13938 add_verb(spec, alc269_init_verbs);
13873 real_capsrc_nids = alc269_capsrc_nids[0];
13874 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); 13939 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
13875 } 13940 }
13876 13941
13877 spec->num_mux_defs = 1; 13942 spec->num_mux_defs = 1;
13878 spec->input_mux = &spec->private_imux[0]; 13943 spec->input_mux = &spec->private_imux[0];
13944 fillup_priv_adc_nids(codec, alc269_adc_candidates,
13945 sizeof(alc269_adc_candidates));
13946
13879 /* set default input source */ 13947 /* set default input source */
13880 snd_hda_codec_write_cache(codec, real_capsrc_nids, 13948 snd_hda_codec_write_cache(codec, spec->capsrc_nids[0],
13881 0, AC_VERB_SET_CONNECT_SEL, 13949 0, AC_VERB_SET_CONNECT_SEL,
13882 spec->input_mux->items[0].index); 13950 spec->input_mux->items[0].index);
13883 13951
@@ -14156,14 +14224,16 @@ static int patch_alc269(struct hda_codec *codec)
14156 spec->stream_digital_playback = &alc269_pcm_digital_playback; 14224 spec->stream_digital_playback = &alc269_pcm_digital_playback;
14157 spec->stream_digital_capture = &alc269_pcm_digital_capture; 14225 spec->stream_digital_capture = &alc269_pcm_digital_capture;
14158 14226
14159 if (!is_alc269vb) { 14227 if (!spec->adc_nids) { /* wasn't filled automatically? use default */
14160 spec->adc_nids = alc269_adc_nids; 14228 if (!is_alc269vb) {
14161 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); 14229 spec->adc_nids = alc269_adc_nids;
14162 spec->capsrc_nids = alc269_capsrc_nids; 14230 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
14163 } else { 14231 spec->capsrc_nids = alc269_capsrc_nids;
14164 spec->adc_nids = alc269vb_adc_nids; 14232 } else {
14165 spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids); 14233 spec->adc_nids = alc269vb_adc_nids;
14166 spec->capsrc_nids = alc269vb_capsrc_nids; 14234 spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids);
14235 spec->capsrc_nids = alc269vb_capsrc_nids;
14236 }
14167 } 14237 }
14168 14238
14169 if (!spec->cap_mixer) 14239 if (!spec->cap_mixer)
@@ -17115,9 +17185,9 @@ static void alc663_m51va_speaker_automute(struct hda_codec *codec)
17115 present = snd_hda_jack_detect(codec, 0x21); 17185 present = snd_hda_jack_detect(codec, 0x21);
17116 bits = present ? HDA_AMP_MUTE : 0; 17186 bits = present ? HDA_AMP_MUTE : 0;
17117 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, 17187 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17118 AMP_IN_MUTE(0), bits); 17188 HDA_AMP_MUTE, bits);
17119 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, 17189 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17120 AMP_IN_MUTE(0), bits); 17190 HDA_AMP_MUTE, bits);
17121} 17191}
17122 17192
17123static void alc663_21jd_two_speaker_automute(struct hda_codec *codec) 17193static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
@@ -17128,13 +17198,13 @@ static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
17128 present = snd_hda_jack_detect(codec, 0x21); 17198 present = snd_hda_jack_detect(codec, 0x21);
17129 bits = present ? HDA_AMP_MUTE : 0; 17199 bits = present ? HDA_AMP_MUTE : 0;
17130 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, 17200 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17131 AMP_IN_MUTE(0), bits); 17201 HDA_AMP_MUTE, bits);
17132 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, 17202 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17133 AMP_IN_MUTE(0), bits); 17203 HDA_AMP_MUTE, bits);
17134 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, 17204 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
17135 AMP_IN_MUTE(0), bits); 17205 HDA_AMP_MUTE, bits);
17136 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, 17206 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
17137 AMP_IN_MUTE(0), bits); 17207 HDA_AMP_MUTE, bits);
17138} 17208}
17139 17209
17140static void alc663_15jd_two_speaker_automute(struct hda_codec *codec) 17210static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
@@ -17145,13 +17215,13 @@ static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
17145 present = snd_hda_jack_detect(codec, 0x15); 17215 present = snd_hda_jack_detect(codec, 0x15);
17146 bits = present ? HDA_AMP_MUTE : 0; 17216 bits = present ? HDA_AMP_MUTE : 0;
17147 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, 17217 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17148 AMP_IN_MUTE(0), bits); 17218 HDA_AMP_MUTE, bits);
17149 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, 17219 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17150 AMP_IN_MUTE(0), bits); 17220 HDA_AMP_MUTE, bits);
17151 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, 17221 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
17152 AMP_IN_MUTE(0), bits); 17222 HDA_AMP_MUTE, bits);
17153 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, 17223 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
17154 AMP_IN_MUTE(0), bits); 17224 HDA_AMP_MUTE, bits);
17155} 17225}
17156 17226
17157static void alc662_f5z_speaker_automute(struct hda_codec *codec) 17227static void alc662_f5z_speaker_automute(struct hda_codec *codec)
@@ -17190,14 +17260,14 @@ static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
17190 17260
17191 if (present1 || present2) { 17261 if (present1 || present2) {
17192 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, 17262 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17193 AMP_IN_MUTE(0), AMP_IN_MUTE(0)); 17263 HDA_AMP_MUTE, HDA_AMP_MUTE);
17194 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, 17264 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17195 AMP_IN_MUTE(0), AMP_IN_MUTE(0)); 17265 HDA_AMP_MUTE, HDA_AMP_MUTE);
17196 } else { 17266 } else {
17197 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, 17267 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17198 AMP_IN_MUTE(0), 0); 17268 HDA_AMP_MUTE, 0);
17199 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, 17269 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17200 AMP_IN_MUTE(0), 0); 17270 HDA_AMP_MUTE, 0);
17201 } 17271 }
17202} 17272}
17203 17273
diff --git a/sound/pci/mixart/mixart.c b/sound/pci/mixart/mixart.c
index 55e9315d4ccd..3be8f97c8bc0 100644
--- a/sound/pci/mixart/mixart.c
+++ b/sound/pci/mixart/mixart.c
@@ -1162,13 +1162,15 @@ static long snd_mixart_BA0_read(struct snd_info_entry *entry, void *file_private
1162 unsigned long count, unsigned long pos) 1162 unsigned long count, unsigned long pos)
1163{ 1163{
1164 struct mixart_mgr *mgr = entry->private_data; 1164 struct mixart_mgr *mgr = entry->private_data;
1165 unsigned long maxsize;
1165 1166
1166 count = count & ~3; /* make sure the read size is a multiple of 4 bytes */ 1167 if (pos >= MIXART_BA0_SIZE)
1167 if(count <= 0)
1168 return 0; 1168 return 0;
1169 if(pos + count > MIXART_BA0_SIZE) 1169 maxsize = MIXART_BA0_SIZE - pos;
1170 count = (long)(MIXART_BA0_SIZE - pos); 1170 if (count > maxsize)
1171 if(copy_to_user_fromio(buf, MIXART_MEM( mgr, pos ), count)) 1171 count = maxsize;
1172 count = count & ~3; /* make sure the read size is a multiple of 4 bytes */
1173 if (copy_to_user_fromio(buf, MIXART_MEM(mgr, pos), count))
1172 return -EFAULT; 1174 return -EFAULT;
1173 return count; 1175 return count;
1174} 1176}
@@ -1181,13 +1183,15 @@ static long snd_mixart_BA1_read(struct snd_info_entry *entry, void *file_private
1181 unsigned long count, unsigned long pos) 1183 unsigned long count, unsigned long pos)
1182{ 1184{
1183 struct mixart_mgr *mgr = entry->private_data; 1185 struct mixart_mgr *mgr = entry->private_data;
1186 unsigned long maxsize;
1184 1187
1185 count = count & ~3; /* make sure the read size is a multiple of 4 bytes */ 1188 if (pos > MIXART_BA1_SIZE)
1186 if(count <= 0)
1187 return 0; 1189 return 0;
1188 if(pos + count > MIXART_BA1_SIZE) 1190 maxsize = MIXART_BA1_SIZE - pos;
1189 count = (long)(MIXART_BA1_SIZE - pos); 1191 if (count > maxsize)
1190 if(copy_to_user_fromio(buf, MIXART_REG( mgr, pos ), count)) 1192 count = maxsize;
1193 count = count & ~3; /* make sure the read size is a multiple of 4 bytes */
1194 if (copy_to_user_fromio(buf, MIXART_REG(mgr, pos), count))
1191 return -EFAULT; 1195 return -EFAULT;
1192 return count; 1196 return count;
1193} 1197}