aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/sound/alsa/HD-Audio-Models.txt1
-rw-r--r--sound/aoa/codecs/tas.c9
-rw-r--r--sound/mips/hal2.c2
-rw-r--r--sound/mips/sgio2audio.c2
-rw-r--r--sound/pci/ctxfi/ctatc.c4
-rw-r--r--sound/pci/echoaudio/echoaudio.c30
-rw-r--r--sound/pci/echoaudio/mia.c1
-rw-r--r--sound/pci/hda/hda_intel.c1
-rw-r--r--sound/pci/hda/patch_analog.c139
-rw-r--r--sound/pci/hda/patch_conexant.c12
-rw-r--r--sound/pci/hda/patch_realtek.c244
-rw-r--r--sound/pci/hda/patch_sigmatel.c20
-rw-r--r--sound/pci/intel8x0.c12
-rw-r--r--sound/ppc/keywest.c14
-rw-r--r--sound/soc/blackfin/Kconfig98
-rw-r--r--sound/soc/blackfin/bf5xx-i2s.c8
-rw-r--r--sound/soc/blackfin/bf5xx-tdm.c8
-rw-r--r--sound/soc/davinci/davinci-i2s.c37
-rw-r--r--sound/soc/davinci/davinci-mcasp.c80
-rw-r--r--sound/soc/davinci/davinci-mcasp.h7
-rw-r--r--sound/soc/davinci/davinci-pcm.c13
-rw-r--r--sound/soc/davinci/davinci-pcm.h1
-rw-r--r--sound/soc/pxa/Kconfig2
-rw-r--r--sound/usb/usbmixer.c23
24 files changed, 512 insertions, 256 deletions
diff --git a/Documentation/sound/alsa/HD-Audio-Models.txt b/Documentation/sound/alsa/HD-Audio-Models.txt
index f1708b79f963..75fddb40f416 100644
--- a/Documentation/sound/alsa/HD-Audio-Models.txt
+++ b/Documentation/sound/alsa/HD-Audio-Models.txt
@@ -209,6 +209,7 @@ AD1884A / AD1883 / AD1984A / AD1984B
209 laptop laptop with HP jack sensing 209 laptop laptop with HP jack sensing
210 mobile mobile devices with HP jack sensing 210 mobile mobile devices with HP jack sensing
211 thinkpad Lenovo Thinkpad X300 211 thinkpad Lenovo Thinkpad X300
212 touchsmart HP Touchsmart
212 213
213AD1884 214AD1884
214====== 215======
diff --git a/sound/aoa/codecs/tas.c b/sound/aoa/codecs/tas.c
index f0ebc971c686..1dd66ddffcaf 100644
--- a/sound/aoa/codecs/tas.c
+++ b/sound/aoa/codecs/tas.c
@@ -897,6 +897,15 @@ static int tas_create(struct i2c_adapter *adapter,
897 client = i2c_new_device(adapter, &info); 897 client = i2c_new_device(adapter, &info);
898 if (!client) 898 if (!client)
899 return -ENODEV; 899 return -ENODEV;
900 /*
901 * We know the driver is already loaded, so the device should be
902 * already bound. If not it means binding failed, and then there
903 * is no point in keeping the device instantiated.
904 */
905 if (!client->driver) {
906 i2c_unregister_device(client);
907 return -ENODEV;
908 }
900 909
901 /* 910 /*
902 * Let i2c-core delete that device on driver removal. 911 * Let i2c-core delete that device on driver removal.
diff --git a/sound/mips/hal2.c b/sound/mips/hal2.c
index c52691c2fc46..9a88cdfd952a 100644
--- a/sound/mips/hal2.c
+++ b/sound/mips/hal2.c
@@ -915,7 +915,7 @@ static int __devinit hal2_probe(struct platform_device *pdev)
915 return 0; 915 return 0;
916} 916}
917 917
918static int __exit hal2_remove(struct platform_device *pdev) 918static int __devexit hal2_remove(struct platform_device *pdev)
919{ 919{
920 struct snd_card *card = platform_get_drvdata(pdev); 920 struct snd_card *card = platform_get_drvdata(pdev);
921 921
diff --git a/sound/mips/sgio2audio.c b/sound/mips/sgio2audio.c
index e497525bc11b..8691f4cf6191 100644
--- a/sound/mips/sgio2audio.c
+++ b/sound/mips/sgio2audio.c
@@ -973,7 +973,7 @@ static int __devinit snd_sgio2audio_probe(struct platform_device *pdev)
973 return 0; 973 return 0;
974} 974}
975 975
976static int __exit snd_sgio2audio_remove(struct platform_device *pdev) 976static int __devexit snd_sgio2audio_remove(struct platform_device *pdev)
977{ 977{
978 struct snd_card *card = platform_get_drvdata(pdev); 978 struct snd_card *card = platform_get_drvdata(pdev);
979 979
diff --git a/sound/pci/ctxfi/ctatc.c b/sound/pci/ctxfi/ctatc.c
index b1b3a644f738..75454648d50c 100644
--- a/sound/pci/ctxfi/ctatc.c
+++ b/sound/pci/ctxfi/ctatc.c
@@ -1037,7 +1037,7 @@ static int atc_line_front_unmute(struct ct_atc *atc, unsigned char state)
1037 1037
1038static int atc_line_surround_unmute(struct ct_atc *atc, unsigned char state) 1038static int atc_line_surround_unmute(struct ct_atc *atc, unsigned char state)
1039{ 1039{
1040 return atc_daio_unmute(atc, state, LINEO4); 1040 return atc_daio_unmute(atc, state, LINEO2);
1041} 1041}
1042 1042
1043static int atc_line_clfe_unmute(struct ct_atc *atc, unsigned char state) 1043static int atc_line_clfe_unmute(struct ct_atc *atc, unsigned char state)
@@ -1047,7 +1047,7 @@ static int atc_line_clfe_unmute(struct ct_atc *atc, unsigned char state)
1047 1047
1048static int atc_line_rear_unmute(struct ct_atc *atc, unsigned char state) 1048static int atc_line_rear_unmute(struct ct_atc *atc, unsigned char state)
1049{ 1049{
1050 return atc_daio_unmute(atc, state, LINEO2); 1050 return atc_daio_unmute(atc, state, LINEO4);
1051} 1051}
1052 1052
1053static int atc_line_in_unmute(struct ct_atc *atc, unsigned char state) 1053static int atc_line_in_unmute(struct ct_atc *atc, unsigned char state)
diff --git a/sound/pci/echoaudio/echoaudio.c b/sound/pci/echoaudio/echoaudio.c
index da2065cd2c0d..1305f7ca02c3 100644
--- a/sound/pci/echoaudio/echoaudio.c
+++ b/sound/pci/echoaudio/echoaudio.c
@@ -950,7 +950,7 @@ static int __devinit snd_echo_new_pcm(struct echoaudio *chip)
950 Control interface 950 Control interface
951******************************************************************************/ 951******************************************************************************/
952 952
953#ifndef ECHOCARD_HAS_VMIXER 953#if !defined(ECHOCARD_HAS_VMIXER) || defined(ECHOCARD_HAS_LINE_OUT_GAIN)
954 954
955/******************* PCM output volume *******************/ 955/******************* PCM output volume *******************/
956static int snd_echo_output_gain_info(struct snd_kcontrol *kcontrol, 956static int snd_echo_output_gain_info(struct snd_kcontrol *kcontrol,
@@ -1003,6 +1003,19 @@ static int snd_echo_output_gain_put(struct snd_kcontrol *kcontrol,
1003 return changed; 1003 return changed;
1004} 1004}
1005 1005
1006#ifdef ECHOCARD_HAS_LINE_OUT_GAIN
1007/* On the Mia this one controls the line-out volume */
1008static struct snd_kcontrol_new snd_echo_line_output_gain __devinitdata = {
1009 .name = "Line Playback Volume",
1010 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1011 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE |
1012 SNDRV_CTL_ELEM_ACCESS_TLV_READ,
1013 .info = snd_echo_output_gain_info,
1014 .get = snd_echo_output_gain_get,
1015 .put = snd_echo_output_gain_put,
1016 .tlv = {.p = db_scale_output_gain},
1017};
1018#else
1006static struct snd_kcontrol_new snd_echo_pcm_output_gain __devinitdata = { 1019static struct snd_kcontrol_new snd_echo_pcm_output_gain __devinitdata = {
1007 .name = "PCM Playback Volume", 1020 .name = "PCM Playback Volume",
1008 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1021 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
@@ -1012,9 +1025,10 @@ static struct snd_kcontrol_new snd_echo_pcm_output_gain __devinitdata = {
1012 .put = snd_echo_output_gain_put, 1025 .put = snd_echo_output_gain_put,
1013 .tlv = {.p = db_scale_output_gain}, 1026 .tlv = {.p = db_scale_output_gain},
1014}; 1027};
1015
1016#endif 1028#endif
1017 1029
1030#endif /* !ECHOCARD_HAS_VMIXER || ECHOCARD_HAS_LINE_OUT_GAIN */
1031
1018 1032
1019 1033
1020#ifdef ECHOCARD_HAS_INPUT_GAIN 1034#ifdef ECHOCARD_HAS_INPUT_GAIN
@@ -2030,10 +2044,18 @@ static int __devinit snd_echo_probe(struct pci_dev *pci,
2030 snd_echo_vmixer.count = num_pipes_out(chip) * num_busses_out(chip); 2044 snd_echo_vmixer.count = num_pipes_out(chip) * num_busses_out(chip);
2031 if ((err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_echo_vmixer, chip))) < 0) 2045 if ((err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_echo_vmixer, chip))) < 0)
2032 goto ctl_error; 2046 goto ctl_error;
2033#else 2047#ifdef ECHOCARD_HAS_LINE_OUT_GAIN
2034 if ((err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_echo_pcm_output_gain, chip))) < 0) 2048 err = snd_ctl_add(chip->card,
2049 snd_ctl_new1(&snd_echo_line_output_gain, chip));
2050 if (err < 0)
2035 goto ctl_error; 2051 goto ctl_error;
2036#endif 2052#endif
2053#else /* ECHOCARD_HAS_VMIXER */
2054 err = snd_ctl_add(chip->card,
2055 snd_ctl_new1(&snd_echo_pcm_output_gain, chip));
2056 if (err < 0)
2057 goto ctl_error;
2058#endif /* ECHOCARD_HAS_VMIXER */
2037 2059
2038#ifdef ECHOCARD_HAS_INPUT_GAIN 2060#ifdef ECHOCARD_HAS_INPUT_GAIN
2039 if ((err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_echo_line_input_gain, chip))) < 0) 2061 if ((err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_echo_line_input_gain, chip))) < 0)
diff --git a/sound/pci/echoaudio/mia.c b/sound/pci/echoaudio/mia.c
index f3b9b45c9c1b..f05c8c097aa8 100644
--- a/sound/pci/echoaudio/mia.c
+++ b/sound/pci/echoaudio/mia.c
@@ -29,6 +29,7 @@
29#define ECHOCARD_HAS_ADAT FALSE 29#define ECHOCARD_HAS_ADAT FALSE
30#define ECHOCARD_HAS_STEREO_BIG_ENDIAN32 30#define ECHOCARD_HAS_STEREO_BIG_ENDIAN32
31#define ECHOCARD_HAS_MIDI 31#define ECHOCARD_HAS_MIDI
32#define ECHOCARD_HAS_LINE_OUT_GAIN
32 33
33/* Pipe indexes */ 34/* Pipe indexes */
34#define PX_ANALOG_OUT 0 /* 8 */ 35#define PX_ANALOG_OUT 0 /* 8 */
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 20a66f85f0a4..c9ad182e1b4b 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -2303,6 +2303,7 @@ static void __devinit check_probe_mask(struct azx *chip, int dev)
2303 * white-list for enable_msi 2303 * white-list for enable_msi
2304 */ 2304 */
2305static struct snd_pci_quirk msi_white_list[] __devinitdata = { 2305static struct snd_pci_quirk msi_white_list[] __devinitdata = {
2306 SND_PCI_QUIRK(0x103c, 0x30f7, "HP Pavilion dv4t-1300", 1),
2306 SND_PCI_QUIRK(0x103c, 0x3607, "HP Compa CQ40", 1), 2307 SND_PCI_QUIRK(0x103c, 0x3607, "HP Compa CQ40", 1),
2307 {} 2308 {}
2308}; 2309};
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
index 215e72a87113..2d603f6aba63 100644
--- a/sound/pci/hda/patch_analog.c
+++ b/sound/pci/hda/patch_analog.c
@@ -4032,6 +4032,127 @@ static int ad1984a_thinkpad_init(struct hda_codec *codec)
4032} 4032}
4033 4033
4034/* 4034/*
4035 * HP Touchsmart
4036 * port-A (0x11) - front hp-out
4037 * port-B (0x14) - unused
4038 * port-C (0x15) - unused
4039 * port-D (0x12) - rear line out
4040 * port-E (0x1c) - front mic-in
4041 * port-F (0x16) - Internal speakers
4042 * digital-mic (0x17) - Internal mic
4043 */
4044
4045static struct hda_verb ad1984a_touchsmart_verbs[] = {
4046 /* DACs; unmute as default */
4047 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, 0x27}, /* 0dB */
4048 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x27}, /* 0dB */
4049 /* Port-A (HP) mixer - route only from analog mixer */
4050 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4051 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4052 /* Port-A pin */
4053 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4054 /* Port-A (HP) pin - always unmuted */
4055 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4056 /* Port-E (int speaker) mixer - route only from analog mixer */
4057 {0x25, AC_VERB_SET_AMP_GAIN_MUTE, 0x03},
4058 /* Port-E pin */
4059 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4060 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4061 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4062 /* Port-F (int speaker) mixer - route only from analog mixer */
4063 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4064 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4065 /* Port-F pin */
4066 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
4067 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4068 /* Analog mixer; mute as default */
4069 {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4070 {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4071 {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4072 {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4073 {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4074 {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
4075 /* Analog Mix output amp */
4076 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4077 /* capture sources */
4078 /* {0x0c, AC_VERB_SET_CONNECT_SEL, 0x0}, */ /* set via unsol */
4079 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4080 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x0},
4081 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4082 /* unsolicited event for pin-sense */
4083 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | AD1884A_HP_EVENT},
4084 {0x1c, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | AD1884A_MIC_EVENT},
4085 /* allow to touch GPIO1 (for mute control) */
4086 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
4087 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
4088 {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, /* first muted */
4089 /* internal mic - dmic */
4090 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4091 /* set magic COEFs for dmic */
4092 {0x01, AC_VERB_SET_COEF_INDEX, 0x13f7},
4093 {0x01, AC_VERB_SET_PROC_COEF, 0x08},
4094 { } /* end */
4095};
4096
4097static struct snd_kcontrol_new ad1984a_touchsmart_mixers[] = {
4098 HDA_CODEC_VOLUME("Master Playback Volume", 0x21, 0x0, HDA_OUTPUT),
4099/* HDA_CODEC_MUTE("Master Playback Switch", 0x21, 0x0, HDA_OUTPUT),*/
4100 {
4101 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4102 .name = "Master Playback Switch",
4103 .info = snd_hda_mixer_amp_switch_info,
4104 .get = snd_hda_mixer_amp_switch_get,
4105 .put = ad1884a_mobile_master_sw_put,
4106 .private_value = HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
4107 },
4108 HDA_CODEC_VOLUME("PCM Playback Volume", 0x20, 0x5, HDA_INPUT),
4109 HDA_CODEC_MUTE("PCM Playback Switch", 0x20, 0x5, HDA_INPUT),
4110 HDA_CODEC_VOLUME("Capture Volume", 0x0c, 0x0, HDA_OUTPUT),
4111 HDA_CODEC_MUTE("Capture Switch", 0x0c, 0x0, HDA_OUTPUT),
4112 HDA_CODEC_VOLUME("Mic Boost", 0x25, 0x0, HDA_OUTPUT),
4113 HDA_CODEC_VOLUME("Internal Mic Boost", 0x17, 0x0, HDA_INPUT),
4114 { } /* end */
4115};
4116
4117/* switch to external mic if plugged */
4118static void ad1984a_touchsmart_automic(struct hda_codec *codec)
4119{
4120 if (snd_hda_codec_read(codec, 0x1c, 0,
4121 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000) {
4122 snd_hda_codec_write(codec, 0x0c, 0,
4123 AC_VERB_SET_CONNECT_SEL, 0x4);
4124 } else {
4125 snd_hda_codec_write(codec, 0x0c, 0,
4126 AC_VERB_SET_CONNECT_SEL, 0x5);
4127 }
4128}
4129
4130
4131/* unsolicited event for HP jack sensing */
4132static void ad1984a_touchsmart_unsol_event(struct hda_codec *codec,
4133 unsigned int res)
4134{
4135 switch (res >> 26) {
4136 case AD1884A_HP_EVENT:
4137 ad1884a_hp_automute(codec);
4138 break;
4139 case AD1884A_MIC_EVENT:
4140 ad1984a_touchsmart_automic(codec);
4141 break;
4142 }
4143}
4144
4145/* initialize jack-sensing, too */
4146static int ad1984a_touchsmart_init(struct hda_codec *codec)
4147{
4148 ad198x_init(codec);
4149 ad1884a_hp_automute(codec);
4150 ad1984a_touchsmart_automic(codec);
4151 return 0;
4152}
4153
4154
4155/*
4035 */ 4156 */
4036 4157
4037enum { 4158enum {
@@ -4039,6 +4160,7 @@ enum {
4039 AD1884A_LAPTOP, 4160 AD1884A_LAPTOP,
4040 AD1884A_MOBILE, 4161 AD1884A_MOBILE,
4041 AD1884A_THINKPAD, 4162 AD1884A_THINKPAD,
4163 AD1984A_TOUCHSMART,
4042 AD1884A_MODELS 4164 AD1884A_MODELS
4043}; 4165};
4044 4166
@@ -4047,6 +4169,7 @@ static const char *ad1884a_models[AD1884A_MODELS] = {
4047 [AD1884A_LAPTOP] = "laptop", 4169 [AD1884A_LAPTOP] = "laptop",
4048 [AD1884A_MOBILE] = "mobile", 4170 [AD1884A_MOBILE] = "mobile",
4049 [AD1884A_THINKPAD] = "thinkpad", 4171 [AD1884A_THINKPAD] = "thinkpad",
4172 [AD1984A_TOUCHSMART] = "touchsmart",
4050}; 4173};
4051 4174
4052static struct snd_pci_quirk ad1884a_cfg_tbl[] = { 4175static struct snd_pci_quirk ad1884a_cfg_tbl[] = {
@@ -4059,6 +4182,7 @@ static struct snd_pci_quirk ad1884a_cfg_tbl[] = {
4059 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3600, "HP laptop", AD1884A_LAPTOP), 4182 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3600, "HP laptop", AD1884A_LAPTOP),
4060 SND_PCI_QUIRK_MASK(0x103c, 0xfff0, 0x7010, "HP laptop", AD1884A_MOBILE), 4183 SND_PCI_QUIRK_MASK(0x103c, 0xfff0, 0x7010, "HP laptop", AD1884A_MOBILE),
4061 SND_PCI_QUIRK(0x17aa, 0x20ac, "Thinkpad X300", AD1884A_THINKPAD), 4184 SND_PCI_QUIRK(0x17aa, 0x20ac, "Thinkpad X300", AD1884A_THINKPAD),
4185 SND_PCI_QUIRK(0x103c, 0x2a82, "Touchsmart", AD1984A_TOUCHSMART),
4062 {} 4186 {}
4063}; 4187};
4064 4188
@@ -4142,6 +4266,21 @@ static int patch_ad1884a(struct hda_codec *codec)
4142 codec->patch_ops.unsol_event = ad1984a_thinkpad_unsol_event; 4266 codec->patch_ops.unsol_event = ad1984a_thinkpad_unsol_event;
4143 codec->patch_ops.init = ad1984a_thinkpad_init; 4267 codec->patch_ops.init = ad1984a_thinkpad_init;
4144 break; 4268 break;
4269 case AD1984A_TOUCHSMART:
4270 spec->mixers[0] = ad1984a_touchsmart_mixers;
4271 spec->init_verbs[0] = ad1984a_touchsmart_verbs;
4272 spec->multiout.dig_out_nid = 0;
4273 codec->patch_ops.unsol_event = ad1984a_touchsmart_unsol_event;
4274 codec->patch_ops.init = ad1984a_touchsmart_init;
4275 /* set the upper-limit for mixer amp to 0dB for avoiding the
4276 * possible damage by overloading
4277 */
4278 snd_hda_override_amp_caps(codec, 0x20, HDA_INPUT,
4279 (0x17 << AC_AMPCAP_OFFSET_SHIFT) |
4280 (0x17 << AC_AMPCAP_NUM_STEPS_SHIFT) |
4281 (0x05 << AC_AMPCAP_STEP_SIZE_SHIFT) |
4282 (1 << AC_AMPCAP_MUTE_SHIFT));
4283 break;
4145 } 4284 }
4146 4285
4147 return 0; 4286 return 0;
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index 9d899eda44d7..3fbbc8c01e70 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -682,11 +682,13 @@ static struct hda_input_mux cxt5045_capture_source = {
682}; 682};
683 683
684static struct hda_input_mux cxt5045_capture_source_benq = { 684static struct hda_input_mux cxt5045_capture_source_benq = {
685 .num_items = 3, 685 .num_items = 5,
686 .items = { 686 .items = {
687 { "IntMic", 0x1 }, 687 { "IntMic", 0x1 },
688 { "ExtMic", 0x2 }, 688 { "ExtMic", 0x2 },
689 { "LineIn", 0x3 }, 689 { "LineIn", 0x3 },
690 { "CD", 0x4 },
691 { "Mixer", 0x0 },
690 } 692 }
691}; 693};
692 694
@@ -811,11 +813,19 @@ static struct snd_kcontrol_new cxt5045_mixers[] = {
811}; 813};
812 814
813static struct snd_kcontrol_new cxt5045_benq_mixers[] = { 815static struct snd_kcontrol_new cxt5045_benq_mixers[] = {
816 HDA_CODEC_VOLUME("CD Capture Volume", 0x1a, 0x04, HDA_INPUT),
817 HDA_CODEC_MUTE("CD Capture Switch", 0x1a, 0x04, HDA_INPUT),
818 HDA_CODEC_VOLUME("CD Playback Volume", 0x17, 0x4, HDA_INPUT),
819 HDA_CODEC_MUTE("CD Playback Switch", 0x17, 0x4, HDA_INPUT),
820
814 HDA_CODEC_VOLUME("Line In Capture Volume", 0x1a, 0x03, HDA_INPUT), 821 HDA_CODEC_VOLUME("Line In Capture Volume", 0x1a, 0x03, HDA_INPUT),
815 HDA_CODEC_MUTE("Line In Capture Switch", 0x1a, 0x03, HDA_INPUT), 822 HDA_CODEC_MUTE("Line In Capture Switch", 0x1a, 0x03, HDA_INPUT),
816 HDA_CODEC_VOLUME("Line In Playback Volume", 0x17, 0x3, HDA_INPUT), 823 HDA_CODEC_VOLUME("Line In Playback Volume", 0x17, 0x3, HDA_INPUT),
817 HDA_CODEC_MUTE("Line In Playback Switch", 0x17, 0x3, HDA_INPUT), 824 HDA_CODEC_MUTE("Line In Playback Switch", 0x17, 0x3, HDA_INPUT),
818 825
826 HDA_CODEC_VOLUME("Mixer Capture Volume", 0x1a, 0x0, HDA_INPUT),
827 HDA_CODEC_MUTE("Mixer Capture Switch", 0x1a, 0x0, HDA_INPUT),
828
819 {} 829 {}
820}; 830};
821 831
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 129605819560..7810d3dcad83 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -12660,7 +12660,7 @@ static struct alc_config_preset alc268_presets[] = {
12660 .init_hook = alc268_toshiba_automute, 12660 .init_hook = alc268_toshiba_automute,
12661 }, 12661 },
12662 [ALC268_ACER] = { 12662 [ALC268_ACER] = {
12663 .mixers = { alc268_acer_mixer, alc268_capture_nosrc_mixer, 12663 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
12664 alc268_beep_mixer }, 12664 alc268_beep_mixer },
12665 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, 12665 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12666 alc268_acer_verbs }, 12666 alc268_acer_verbs },
@@ -16852,6 +16852,7 @@ static struct snd_pci_quirk alc662_cfg_tbl[] = {
16852 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), 16852 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
16853 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", 16853 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
16854 ALC662_3ST_6ch_DIG), 16854 ALC662_3ST_6ch_DIG),
16855 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB200", ALC663_ASUS_MODE4),
16855 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10), 16856 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
16856 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", 16857 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
16857 ALC662_3ST_6ch_DIG), 16858 ALC662_3ST_6ch_DIG),
@@ -17145,70 +17146,145 @@ static struct alc_config_preset alc662_presets[] = {
17145 * BIOS auto configuration 17146 * BIOS auto configuration
17146 */ 17147 */
17147 17148
17149/* convert from MIX nid to DAC */
17150static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid)
17151{
17152 if (nid == 0x0f)
17153 return 0x02;
17154 else if (nid >= 0x0c && nid <= 0x0e)
17155 return nid - 0x0c + 0x02;
17156 else
17157 return 0;
17158}
17159
17160/* get MIX nid connected to the given pin targeted to DAC */
17161static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
17162 hda_nid_t dac)
17163{
17164 hda_nid_t mix[4];
17165 int i, num;
17166
17167 num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
17168 for (i = 0; i < num; i++) {
17169 if (alc662_mix_to_dac(mix[i]) == dac)
17170 return mix[i];
17171 }
17172 return 0;
17173}
17174
17175/* look for an empty DAC slot */
17176static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
17177{
17178 struct alc_spec *spec = codec->spec;
17179 hda_nid_t srcs[5];
17180 int i, j, num;
17181
17182 num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
17183 if (num < 0)
17184 return 0;
17185 for (i = 0; i < num; i++) {
17186 hda_nid_t nid = alc662_mix_to_dac(srcs[i]);
17187 if (!nid)
17188 continue;
17189 for (j = 0; j < spec->multiout.num_dacs; j++)
17190 if (spec->multiout.dac_nids[j] == nid)
17191 break;
17192 if (j >= spec->multiout.num_dacs)
17193 return nid;
17194 }
17195 return 0;
17196}
17197
17198/* fill in the dac_nids table from the parsed pin configuration */
17199static int alc662_auto_fill_dac_nids(struct hda_codec *codec,
17200 const struct auto_pin_cfg *cfg)
17201{
17202 struct alc_spec *spec = codec->spec;
17203 int i;
17204 hda_nid_t dac;
17205
17206 spec->multiout.dac_nids = spec->private_dac_nids;
17207 for (i = 0; i < cfg->line_outs; i++) {
17208 dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]);
17209 if (!dac)
17210 continue;
17211 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
17212 }
17213 return 0;
17214}
17215
17216static int alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx,
17217 hda_nid_t nid, unsigned int chs)
17218{
17219 char name[32];
17220 sprintf(name, "%s Playback Volume", pfx);
17221 return add_control(spec, ALC_CTL_WIDGET_VOL, name,
17222 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
17223}
17224
17225static int alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx,
17226 hda_nid_t nid, unsigned int chs)
17227{
17228 char name[32];
17229 sprintf(name, "%s Playback Switch", pfx);
17230 return add_control(spec, ALC_CTL_WIDGET_MUTE, name,
17231 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT));
17232}
17233
17234#define alc662_add_stereo_vol(spec, pfx, nid) \
17235 alc662_add_vol_ctl(spec, pfx, nid, 3)
17236#define alc662_add_stereo_sw(spec, pfx, nid) \
17237 alc662_add_sw_ctl(spec, pfx, nid, 3)
17238
17148/* add playback controls from the parsed DAC table */ 17239/* add playback controls from the parsed DAC table */
17149static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec, 17240static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
17150 const struct auto_pin_cfg *cfg) 17241 const struct auto_pin_cfg *cfg)
17151{ 17242{
17152 char name[32]; 17243 struct alc_spec *spec = codec->spec;
17153 static const char *chname[4] = { 17244 static const char *chname[4] = {
17154 "Front", "Surround", NULL /*CLFE*/, "Side" 17245 "Front", "Surround", NULL /*CLFE*/, "Side"
17155 }; 17246 };
17156 hda_nid_t nid; 17247 hda_nid_t nid, mix;
17157 int i, err; 17248 int i, err;
17158 17249
17159 for (i = 0; i < cfg->line_outs; i++) { 17250 for (i = 0; i < cfg->line_outs; i++) {
17160 if (!spec->multiout.dac_nids[i]) 17251 nid = spec->multiout.dac_nids[i];
17252 if (!nid)
17253 continue;
17254 mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid);
17255 if (!mix)
17161 continue; 17256 continue;
17162 nid = alc880_idx_to_dac(i);
17163 if (i == 2) { 17257 if (i == 2) {
17164 /* Center/LFE */ 17258 /* Center/LFE */
17165 err = add_control(spec, ALC_CTL_WIDGET_VOL, 17259 err = alc662_add_vol_ctl(spec, "Center", nid, 1);
17166 "Center Playback Volume",
17167 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
17168 HDA_OUTPUT));
17169 if (err < 0) 17260 if (err < 0)
17170 return err; 17261 return err;
17171 err = add_control(spec, ALC_CTL_WIDGET_VOL, 17262 err = alc662_add_vol_ctl(spec, "LFE", nid, 2);
17172 "LFE Playback Volume",
17173 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
17174 HDA_OUTPUT));
17175 if (err < 0) 17263 if (err < 0)
17176 return err; 17264 return err;
17177 err = add_control(spec, ALC_CTL_WIDGET_MUTE, 17265 err = alc662_add_sw_ctl(spec, "Center", mix, 1);
17178 "Center Playback Switch",
17179 HDA_COMPOSE_AMP_VAL(0x0e, 1, 0,
17180 HDA_INPUT));
17181 if (err < 0) 17266 if (err < 0)
17182 return err; 17267 return err;
17183 err = add_control(spec, ALC_CTL_WIDGET_MUTE, 17268 err = alc662_add_sw_ctl(spec, "LFE", mix, 2);
17184 "LFE Playback Switch",
17185 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
17186 HDA_INPUT));
17187 if (err < 0) 17269 if (err < 0)
17188 return err; 17270 return err;
17189 } else { 17271 } else {
17190 const char *pfx; 17272 const char *pfx;
17191 if (cfg->line_outs == 1 && 17273 if (cfg->line_outs == 1 &&
17192 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) { 17274 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
17193 if (!cfg->hp_pins) 17275 if (cfg->hp_outs)
17194 pfx = "Speaker"; 17276 pfx = "Speaker";
17195 else 17277 else
17196 pfx = "PCM"; 17278 pfx = "PCM";
17197 } else 17279 } else
17198 pfx = chname[i]; 17280 pfx = chname[i];
17199 sprintf(name, "%s Playback Volume", pfx); 17281 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
17200 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
17201 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
17202 HDA_OUTPUT));
17203 if (err < 0) 17282 if (err < 0)
17204 return err; 17283 return err;
17205 if (cfg->line_outs == 1 && 17284 if (cfg->line_outs == 1 &&
17206 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) 17285 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
17207 pfx = "Speaker"; 17286 pfx = "Speaker";
17208 sprintf(name, "%s Playback Switch", pfx); 17287 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
17209 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
17210 HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i),
17211 3, 0, HDA_INPUT));
17212 if (err < 0) 17288 if (err < 0)
17213 return err; 17289 return err;
17214 } 17290 }
@@ -17217,54 +17293,38 @@ static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
17217} 17293}
17218 17294
17219/* add playback controls for speaker and HP outputs */ 17295/* add playback controls for speaker and HP outputs */
17220static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, 17296/* return DAC nid if any new DAC is assigned */
17297static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
17221 const char *pfx) 17298 const char *pfx)
17222{ 17299{
17223 hda_nid_t nid; 17300 struct alc_spec *spec = codec->spec;
17301 hda_nid_t nid, mix;
17224 int err; 17302 int err;
17225 char name[32];
17226 17303
17227 if (!pin) 17304 if (!pin)
17228 return 0; 17305 return 0;
17229 17306 nid = alc662_look_for_dac(codec, pin);
17230 if (pin == 0x17) { 17307 if (!nid) {
17231 /* ALC663 has a mono output pin on 0x17 */ 17308 char name[32];
17309 /* the corresponding DAC is already occupied */
17310 if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP))
17311 return 0; /* no way */
17312 /* create a switch only */
17232 sprintf(name, "%s Playback Switch", pfx); 17313 sprintf(name, "%s Playback Switch", pfx);
17233 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, 17314 return add_control(spec, ALC_CTL_WIDGET_MUTE, name,
17234 HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT)); 17315 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
17235 return err;
17236 } 17316 }
17237 17317
17238 if (alc880_is_fixed_pin(pin)) { 17318 mix = alc662_dac_to_mix(codec, pin, nid);
17239 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); 17319 if (!mix)
17240 /* printk(KERN_DEBUG "DAC nid=%x\n",nid); */ 17320 return 0;
17241 /* specify the DAC as the extra output */ 17321 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
17242 if (!spec->multiout.hp_nid) 17322 if (err < 0)
17243 spec->multiout.hp_nid = nid; 17323 return err;
17244 else 17324 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
17245 spec->multiout.extra_out_nid[0] = nid; 17325 if (err < 0)
17246 /* control HP volume/switch on the output mixer amp */ 17326 return err;
17247 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); 17327 return nid;
17248 sprintf(name, "%s Playback Volume", pfx);
17249 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
17250 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
17251 if (err < 0)
17252 return err;
17253 sprintf(name, "%s Playback Switch", pfx);
17254 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
17255 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
17256 if (err < 0)
17257 return err;
17258 } else if (alc880_is_multi_pin(pin)) {
17259 /* set manual connection */
17260 /* we have only a switch on HP-out PIN */
17261 sprintf(name, "%s Playback Switch", pfx);
17262 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
17263 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
17264 if (err < 0)
17265 return err;
17266 }
17267 return 0;
17268} 17328}
17269 17329
17270/* create playback/capture controls for input pins */ 17330/* create playback/capture controls for input pins */
@@ -17273,30 +17333,35 @@ static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
17273 17333
17274static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, 17334static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
17275 hda_nid_t nid, int pin_type, 17335 hda_nid_t nid, int pin_type,
17276 int dac_idx) 17336 hda_nid_t dac)
17277{ 17337{
17338 int i, num;
17339 hda_nid_t srcs[4];
17340
17278 alc_set_pin_output(codec, nid, pin_type); 17341 alc_set_pin_output(codec, nid, pin_type);
17279 /* need the manual connection? */ 17342 /* need the manual connection? */
17280 if (alc880_is_multi_pin(nid)) { 17343 num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs));
17281 struct alc_spec *spec = codec->spec; 17344 if (num <= 1)
17282 int idx = alc880_multi_pin_idx(nid); 17345 return;
17283 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, 17346 for (i = 0; i < num; i++) {
17284 AC_VERB_SET_CONNECT_SEL, 17347 if (alc662_mix_to_dac(srcs[i]) != dac)
17285 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); 17348 continue;
17349 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i);
17350 return;
17286 } 17351 }
17287} 17352}
17288 17353
17289static void alc662_auto_init_multi_out(struct hda_codec *codec) 17354static void alc662_auto_init_multi_out(struct hda_codec *codec)
17290{ 17355{
17291 struct alc_spec *spec = codec->spec; 17356 struct alc_spec *spec = codec->spec;
17357 int pin_type = get_pin_type(spec->autocfg.line_out_type);
17292 int i; 17358 int i;
17293 17359
17294 for (i = 0; i <= HDA_SIDE; i++) { 17360 for (i = 0; i <= HDA_SIDE; i++) {
17295 hda_nid_t nid = spec->autocfg.line_out_pins[i]; 17361 hda_nid_t nid = spec->autocfg.line_out_pins[i];
17296 int pin_type = get_pin_type(spec->autocfg.line_out_type);
17297 if (nid) 17362 if (nid)
17298 alc662_auto_set_output_and_unmute(codec, nid, pin_type, 17363 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
17299 i); 17364 spec->multiout.dac_nids[i]);
17300 } 17365 }
17301} 17366}
17302 17367
@@ -17306,12 +17371,13 @@ static void alc662_auto_init_hp_out(struct hda_codec *codec)
17306 hda_nid_t pin; 17371 hda_nid_t pin;
17307 17372
17308 pin = spec->autocfg.hp_pins[0]; 17373 pin = spec->autocfg.hp_pins[0];
17309 if (pin) /* connect to front */ 17374 if (pin)
17310 /* use dac 0 */ 17375 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP,
17311 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); 17376 spec->multiout.hp_nid);
17312 pin = spec->autocfg.speaker_pins[0]; 17377 pin = spec->autocfg.speaker_pins[0];
17313 if (pin) 17378 if (pin)
17314 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); 17379 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT,
17380 spec->multiout.extra_out_nid[0]);
17315} 17381}
17316 17382
17317#define ALC662_PIN_CD_NID ALC880_PIN_CD_NID 17383#define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
@@ -17349,21 +17415,25 @@ static int alc662_parse_auto_config(struct hda_codec *codec)
17349 if (!spec->autocfg.line_outs) 17415 if (!spec->autocfg.line_outs)
17350 return 0; /* can't find valid BIOS pin config */ 17416 return 0; /* can't find valid BIOS pin config */
17351 17417
17352 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); 17418 err = alc662_auto_fill_dac_nids(codec, &spec->autocfg);
17353 if (err < 0) 17419 if (err < 0)
17354 return err; 17420 return err;
17355 err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg); 17421 err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg);
17356 if (err < 0) 17422 if (err < 0)
17357 return err; 17423 return err;
17358 err = alc662_auto_create_extra_out(spec, 17424 err = alc662_auto_create_extra_out(codec,
17359 spec->autocfg.speaker_pins[0], 17425 spec->autocfg.speaker_pins[0],
17360 "Speaker"); 17426 "Speaker");
17361 if (err < 0) 17427 if (err < 0)
17362 return err; 17428 return err;
17363 err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], 17429 if (err)
17430 spec->multiout.extra_out_nid[0] = err;
17431 err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0],
17364 "Headphone"); 17432 "Headphone");
17365 if (err < 0) 17433 if (err < 0)
17366 return err; 17434 return err;
17435 if (err)
17436 spec->multiout.hp_nid = err;
17367 err = alc662_auto_create_input_ctls(codec, &spec->autocfg); 17437 err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
17368 if (err < 0) 17438 if (err < 0)
17369 return err; 17439 return err;
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 826137ec3002..a9b26828a651 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -182,8 +182,8 @@ struct sigmatel_jack {
182 182
183struct sigmatel_mic_route { 183struct sigmatel_mic_route {
184 hda_nid_t pin; 184 hda_nid_t pin;
185 unsigned char mux_idx; 185 signed char mux_idx;
186 unsigned char dmux_idx; 186 signed char dmux_idx;
187}; 187};
188 188
189struct sigmatel_spec { 189struct sigmatel_spec {
@@ -3469,18 +3469,26 @@ static int set_mic_route(struct hda_codec *codec,
3469 break; 3469 break;
3470 if (i <= AUTO_PIN_FRONT_MIC) { 3470 if (i <= AUTO_PIN_FRONT_MIC) {
3471 /* analog pin */ 3471 /* analog pin */
3472 mic->dmux_idx = 0;
3473 i = get_connection_index(codec, spec->mux_nids[0], pin); 3472 i = get_connection_index(codec, spec->mux_nids[0], pin);
3474 if (i < 0) 3473 if (i < 0)
3475 return -1; 3474 return -1;
3476 mic->mux_idx = i; 3475 mic->mux_idx = i;
3476 mic->dmux_idx = -1;
3477 if (spec->dmux_nids)
3478 mic->dmux_idx = get_connection_index(codec,
3479 spec->dmux_nids[0],
3480 spec->mux_nids[0]);
3477 } else if (spec->dmux_nids) { 3481 } else if (spec->dmux_nids) {
3478 /* digital pin */ 3482 /* digital pin */
3479 mic->mux_idx = 0;
3480 i = get_connection_index(codec, spec->dmux_nids[0], pin); 3483 i = get_connection_index(codec, spec->dmux_nids[0], pin);
3481 if (i < 0) 3484 if (i < 0)
3482 return -1; 3485 return -1;
3483 mic->dmux_idx = i; 3486 mic->dmux_idx = i;
3487 mic->mux_idx = -1;
3488 if (spec->mux_nids)
3489 mic->mux_idx = get_connection_index(codec,
3490 spec->mux_nids[0],
3491 spec->dmux_nids[0]);
3484 } 3492 }
3485 return 0; 3493 return 0;
3486} 3494}
@@ -4557,11 +4565,11 @@ static void stac92xx_mic_detect(struct hda_codec *codec)
4557 mic = &spec->ext_mic; 4565 mic = &spec->ext_mic;
4558 else 4566 else
4559 mic = &spec->int_mic; 4567 mic = &spec->int_mic;
4560 if (mic->dmux_idx) 4568 if (mic->dmux_idx >= 0)
4561 snd_hda_codec_write_cache(codec, spec->dmux_nids[0], 0, 4569 snd_hda_codec_write_cache(codec, spec->dmux_nids[0], 0,
4562 AC_VERB_SET_CONNECT_SEL, 4570 AC_VERB_SET_CONNECT_SEL,
4563 mic->dmux_idx); 4571 mic->dmux_idx);
4564 else 4572 if (mic->mux_idx >= 0)
4565 snd_hda_codec_write_cache(codec, spec->mux_nids[0], 0, 4573 snd_hda_codec_write_cache(codec, spec->mux_nids[0], 0,
4566 AC_VERB_SET_CONNECT_SEL, 4574 AC_VERB_SET_CONNECT_SEL,
4567 mic->mux_idx); 4575 mic->mux_idx);
diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c
index 171ada535209..754867ed4785 100644
--- a/sound/pci/intel8x0.c
+++ b/sound/pci/intel8x0.c
@@ -1954,6 +1954,18 @@ static struct ac97_quirk ac97_quirks[] __devinitdata = {
1954 .name = "Sony S1XP", 1954 .name = "Sony S1XP",
1955 .type = AC97_TUNE_INV_EAPD 1955 .type = AC97_TUNE_INV_EAPD
1956 }, 1956 },
1957 {
1958 .subvendor = 0x104d,
1959 .subdevice = 0x81c0,
1960 .name = "Sony VAIO VGN-T350P", /*AD1981B*/
1961 .type = AC97_TUNE_INV_EAPD
1962 },
1963 {
1964 .subvendor = 0x104d,
1965 .subdevice = 0x81c5,
1966 .name = "Sony VAIO VGN-B1VP", /*AD1981B*/
1967 .type = AC97_TUNE_INV_EAPD
1968 },
1957 { 1969 {
1958 .subvendor = 0x1043, 1970 .subvendor = 0x1043,
1959 .subdevice = 0x80f3, 1971 .subdevice = 0x80f3,
diff --git a/sound/ppc/keywest.c b/sound/ppc/keywest.c
index 835fa19ed461..d06f780bd7e8 100644
--- a/sound/ppc/keywest.c
+++ b/sound/ppc/keywest.c
@@ -59,6 +59,18 @@ static int keywest_attach_adapter(struct i2c_adapter *adapter)
59 strlcpy(info.type, "keywest", I2C_NAME_SIZE); 59 strlcpy(info.type, "keywest", I2C_NAME_SIZE);
60 info.addr = keywest_ctx->addr; 60 info.addr = keywest_ctx->addr;
61 keywest_ctx->client = i2c_new_device(adapter, &info); 61 keywest_ctx->client = i2c_new_device(adapter, &info);
62 if (!keywest_ctx->client)
63 return -ENODEV;
64 /*
65 * We know the driver is already loaded, so the device should be
66 * already bound. If not it means binding failed, and then there
67 * is no point in keeping the device instantiated.
68 */
69 if (!keywest_ctx->client->driver) {
70 i2c_unregister_device(keywest_ctx->client);
71 keywest_ctx->client = NULL;
72 return -ENODEV;
73 }
62 74
63 /* 75 /*
64 * Let i2c-core delete that device on driver removal. 76 * Let i2c-core delete that device on driver removal.
@@ -86,7 +98,7 @@ static const struct i2c_device_id keywest_i2c_id[] = {
86 { } 98 { }
87}; 99};
88 100
89struct i2c_driver keywest_driver = { 101static struct i2c_driver keywest_driver = {
90 .driver = { 102 .driver = {
91 .name = "PMac Keywest Audio", 103 .name = "PMac Keywest Audio",
92 }, 104 },
diff --git a/sound/soc/blackfin/Kconfig b/sound/soc/blackfin/Kconfig
index ac927ffdc961..97f1a251e446 100644
--- a/sound/soc/blackfin/Kconfig
+++ b/sound/soc/blackfin/Kconfig
@@ -7,15 +7,6 @@ config SND_BF5XX_I2S
7 mode (supports single stereo In/Out). 7 mode (supports single stereo In/Out).
8 You will also need to select the audio interfaces to support below. 8 You will also need to select the audio interfaces to support below.
9 9
10config SND_BF5XX_TDM
11 tristate "SoC I2S(TDM mode) Audio for the ADI BF5xx chip"
12 depends on (BLACKFIN && SND_SOC)
13 help
14 Say Y or M if you want to add support for codecs attached to
15 the Blackfin SPORT (synchronous serial ports) interface in TDM
16 mode.
17 You will also need to select the audio interfaces to support below.
18
19config SND_BF5XX_SOC_SSM2602 10config SND_BF5XX_SOC_SSM2602
20 tristate "SoC SSM2602 Audio support for BF52x ezkit" 11 tristate "SoC SSM2602 Audio support for BF52x ezkit"
21 depends on SND_BF5XX_I2S 12 depends on SND_BF5XX_I2S
@@ -41,6 +32,31 @@ config SND_BFIN_AD73311_SE
41 Enter the GPIO used to control AD73311's SE pin. Acceptable 32 Enter the GPIO used to control AD73311's SE pin. Acceptable
42 values are 0 to 7 33 values are 0 to 7
43 34
35config SND_BF5XX_TDM
36 tristate "SoC I2S(TDM mode) Audio for the ADI BF5xx chip"
37 depends on (BLACKFIN && SND_SOC)
38 help
39 Say Y or M if you want to add support for codecs attached to
40 the Blackfin SPORT (synchronous serial ports) interface in TDM
41 mode.
42 You will also need to select the audio interfaces to support below.
43
44config SND_BF5XX_SOC_AD1836
45 tristate "SoC AD1836 Audio support for BF5xx"
46 depends on SND_BF5XX_TDM
47 select SND_BF5XX_SOC_TDM
48 select SND_SOC_AD1836
49 help
50 Say Y if you want to add support for SoC audio on BF5xx STAMP/EZKIT.
51
52config SND_BF5XX_SOC_AD1938
53 tristate "SoC AD1938 Audio support for Blackfin"
54 depends on SND_BF5XX_TDM
55 select SND_BF5XX_SOC_TDM
56 select SND_SOC_AD1938
57 help
58 Say Y if you want to add support for AD1938 codec on Blackfin.
59
44config SND_BF5XX_AC97 60config SND_BF5XX_AC97
45 tristate "SoC AC97 Audio for the ADI BF5xx chip" 61 tristate "SoC AC97 Audio for the ADI BF5xx chip"
46 depends on BLACKFIN 62 depends on BLACKFIN
@@ -71,6 +87,30 @@ config SND_BF5XX_MULTICHAN_SUPPORT
71 Say y if you want AC97 driver to support up to 5.1 channel audio. 87 Say y if you want AC97 driver to support up to 5.1 channel audio.
72 this mode will consume much more memory for DMA. 88 this mode will consume much more memory for DMA.
73 89
90config SND_BF5XX_HAVE_COLD_RESET
91 bool "BOARD has COLD Reset GPIO"
92 depends on SND_BF5XX_AC97
93 default y if BFIN548_EZKIT
94 default n if !BFIN548_EZKIT
95
96config SND_BF5XX_RESET_GPIO_NUM
97 int "Set a GPIO for cold reset"
98 depends on SND_BF5XX_HAVE_COLD_RESET
99 range 0 159
100 default 19 if BFIN548_EZKIT
101 default 5 if BFIN537_STAMP
102 default 0
103 help
104 Set the correct GPIO for RESET the sound chip.
105
106config SND_BF5XX_SOC_AD1980
107 tristate "SoC AD1980/1 Audio support for BF5xx"
108 depends on SND_BF5XX_AC97
109 select SND_BF5XX_SOC_AC97
110 select SND_SOC_AD1980
111 help
112 Say Y if you want to add support for SoC audio on BF5xx STAMP/EZKIT.
113
74config SND_BF5XX_SOC_SPORT 114config SND_BF5XX_SOC_SPORT
75 tristate 115 tristate
76 116
@@ -88,30 +128,6 @@ config SND_BF5XX_SOC_AC97
88 select SND_SOC_AC97_BUS 128 select SND_SOC_AC97_BUS
89 select SND_BF5XX_SOC_SPORT 129 select SND_BF5XX_SOC_SPORT
90 130
91config SND_BF5XX_SOC_AD1836
92 tristate "SoC AD1836 Audio support for BF5xx"
93 depends on SND_BF5XX_TDM
94 select SND_BF5XX_SOC_TDM
95 select SND_SOC_AD1836
96 help
97 Say Y if you want to add support for SoC audio on BF5xx STAMP/EZKIT.
98
99config SND_BF5XX_SOC_AD1980
100 tristate "SoC AD1980/1 Audio support for BF5xx"
101 depends on SND_BF5XX_AC97
102 select SND_BF5XX_SOC_AC97
103 select SND_SOC_AD1980
104 help
105 Say Y if you want to add support for SoC audio on BF5xx STAMP/EZKIT.
106
107config SND_BF5XX_SOC_AD1938
108 tristate "SoC AD1938 Audio support for Blackfin"
109 depends on SND_BF5XX_TDM
110 select SND_BF5XX_SOC_TDM
111 select SND_SOC_AD1938
112 help
113 Say Y if you want to add support for AD1938 codec on Blackfin.
114
115config SND_BF5XX_SPORT_NUM 131config SND_BF5XX_SPORT_NUM
116 int "Set a SPORT for Sound chip" 132 int "Set a SPORT for Sound chip"
117 depends on (SND_BF5XX_I2S || SND_BF5XX_AC97 || SND_BF5XX_TDM) 133 depends on (SND_BF5XX_I2S || SND_BF5XX_AC97 || SND_BF5XX_TDM)
@@ -120,19 +136,3 @@ config SND_BF5XX_SPORT_NUM
120 default 0 136 default 0
121 help 137 help
122 Set the correct SPORT for sound chip. 138 Set the correct SPORT for sound chip.
123
124config SND_BF5XX_HAVE_COLD_RESET
125 bool "BOARD has COLD Reset GPIO"
126 depends on SND_BF5XX_AC97
127 default y if BFIN548_EZKIT
128 default n if !BFIN548_EZKIT
129
130config SND_BF5XX_RESET_GPIO_NUM
131 int "Set a GPIO for cold reset"
132 depends on SND_BF5XX_HAVE_COLD_RESET
133 range 0 159
134 default 19 if BFIN548_EZKIT
135 default 5 if BFIN537_STAMP
136 default 0
137 help
138 Set the correct GPIO for RESET the sound chip.
diff --git a/sound/soc/blackfin/bf5xx-i2s.c b/sound/soc/blackfin/bf5xx-i2s.c
index 1e9d161c76c4..084b68884ada 100644
--- a/sound/soc/blackfin/bf5xx-i2s.c
+++ b/sound/soc/blackfin/bf5xx-i2s.c
@@ -77,12 +77,12 @@ static struct sport_param sport_params[2] = {
77 * TFS. When Port G is selected and EMAC then there is a conflict between 77 * TFS. When Port G is selected and EMAC then there is a conflict between
78 * the PHY interrupt line and TFS. Current settings prevent the conflict 78 * the PHY interrupt line and TFS. Current settings prevent the conflict
79 * by ignoring the TFS pin when Port G is selected. This allows both 79 * by ignoring the TFS pin when Port G is selected. This allows both
80 * ssm2602 using Port G and EMAC concurrently. 80 * codecs and EMAC using Port G concurrently.
81 */ 81 */
82#ifdef CONFIG_BF527_SPORT0_PORTF 82#ifdef CONFIG_BF527_SPORT0_PORTG
83#define LOCAL_SPORT0_TFS (P_SPORT0_TFS)
84#else
85#define LOCAL_SPORT0_TFS (0) 83#define LOCAL_SPORT0_TFS (0)
84#else
85#define LOCAL_SPORT0_TFS (P_SPORT0_TFS)
86#endif 86#endif
87 87
88static u16 sport_req[][7] = { {P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS, 88static u16 sport_req[][7] = { {P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS,
diff --git a/sound/soc/blackfin/bf5xx-tdm.c b/sound/soc/blackfin/bf5xx-tdm.c
index 3096badf09a5..ff546e91a22e 100644
--- a/sound/soc/blackfin/bf5xx-tdm.c
+++ b/sound/soc/blackfin/bf5xx-tdm.c
@@ -78,12 +78,12 @@ static struct sport_param sport_params[2] = {
78 * TFS. When Port G is selected and EMAC then there is a conflict between 78 * TFS. When Port G is selected and EMAC then there is a conflict between
79 * the PHY interrupt line and TFS. Current settings prevent the conflict 79 * the PHY interrupt line and TFS. Current settings prevent the conflict
80 * by ignoring the TFS pin when Port G is selected. This allows both 80 * by ignoring the TFS pin when Port G is selected. This allows both
81 * ssm2602 using Port G and EMAC concurrently. 81 * codecs and EMAC using Port G concurrently.
82 */ 82 */
83#ifdef CONFIG_BF527_SPORT0_PORTF 83#ifdef CONFIG_BF527_SPORT0_PORTG
84#define LOCAL_SPORT0_TFS (P_SPORT0_TFS)
85#else
86#define LOCAL_SPORT0_TFS (0) 84#define LOCAL_SPORT0_TFS (0)
85#else
86#define LOCAL_SPORT0_TFS (P_SPORT0_TFS)
87#endif 87#endif
88 88
89static u16 sport_req[][7] = { {P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS, 89static u16 sport_req[][7] = { {P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS,
diff --git a/sound/soc/davinci/davinci-i2s.c b/sound/soc/davinci/davinci-i2s.c
index 12a6c549ee6e..4ae707048021 100644
--- a/sound/soc/davinci/davinci-i2s.c
+++ b/sound/soc/davinci/davinci-i2s.c
@@ -97,22 +97,19 @@ enum {
97 DAVINCI_MCBSP_WORD_32, 97 DAVINCI_MCBSP_WORD_32,
98}; 98};
99 99
100static struct davinci_pcm_dma_params davinci_i2s_pcm_out = {
101 .name = "I2S PCM Stereo out",
102};
103
104static struct davinci_pcm_dma_params davinci_i2s_pcm_in = {
105 .name = "I2S PCM Stereo in",
106};
107
108struct davinci_mcbsp_dev { 100struct davinci_mcbsp_dev {
101 /*
102 * dma_params must be first because rtd->dai->cpu_dai->private_data
103 * is cast to a pointer of an array of struct davinci_pcm_dma_params in
104 * davinci_pcm_open.
105 */
106 struct davinci_pcm_dma_params dma_params[2];
109 void __iomem *base; 107 void __iomem *base;
110#define MOD_DSP_A 0 108#define MOD_DSP_A 0
111#define MOD_DSP_B 1 109#define MOD_DSP_B 1
112 int mode; 110 int mode;
113 u32 pcr; 111 u32 pcr;
114 struct clk *clk; 112 struct clk *clk;
115 struct davinci_pcm_dma_params *dma_params[2];
116}; 113};
117 114
118static inline void davinci_mcbsp_write_reg(struct davinci_mcbsp_dev *dev, 115static inline void davinci_mcbsp_write_reg(struct davinci_mcbsp_dev *dev,
@@ -215,14 +212,6 @@ static void davinci_mcbsp_stop(struct davinci_mcbsp_dev *dev, int playback)
215 toggle_clock(dev, playback); 212 toggle_clock(dev, playback);
216} 213}
217 214
218static int davinci_i2s_startup(struct snd_pcm_substream *substream,
219 struct snd_soc_dai *cpu_dai)
220{
221 struct davinci_mcbsp_dev *dev = cpu_dai->private_data;
222 cpu_dai->dma_data = dev->dma_params[substream->stream];
223 return 0;
224}
225
226#define DEFAULT_BITPERSAMPLE 16 215#define DEFAULT_BITPERSAMPLE 16
227 216
228static int davinci_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai, 217static int davinci_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai,
@@ -353,8 +342,9 @@ static int davinci_i2s_hw_params(struct snd_pcm_substream *substream,
353 struct snd_pcm_hw_params *params, 342 struct snd_pcm_hw_params *params,
354 struct snd_soc_dai *dai) 343 struct snd_soc_dai *dai)
355{ 344{
356 struct davinci_pcm_dma_params *dma_params = dai->dma_data;
357 struct davinci_mcbsp_dev *dev = dai->private_data; 345 struct davinci_mcbsp_dev *dev = dai->private_data;
346 struct davinci_pcm_dma_params *dma_params =
347 &dev->dma_params[substream->stream];
358 struct snd_interval *i = NULL; 348 struct snd_interval *i = NULL;
359 int mcbsp_word_length; 349 int mcbsp_word_length;
360 unsigned int rcr, xcr, srgr; 350 unsigned int rcr, xcr, srgr;
@@ -472,7 +462,6 @@ static void davinci_i2s_shutdown(struct snd_pcm_substream *substream,
472#define DAVINCI_I2S_RATES SNDRV_PCM_RATE_8000_96000 462#define DAVINCI_I2S_RATES SNDRV_PCM_RATE_8000_96000
473 463
474static struct snd_soc_dai_ops davinci_i2s_dai_ops = { 464static struct snd_soc_dai_ops davinci_i2s_dai_ops = {
475 .startup = davinci_i2s_startup,
476 .shutdown = davinci_i2s_shutdown, 465 .shutdown = davinci_i2s_shutdown,
477 .prepare = davinci_i2s_prepare, 466 .prepare = davinci_i2s_prepare,
478 .trigger = davinci_i2s_trigger, 467 .trigger = davinci_i2s_trigger,
@@ -534,12 +523,10 @@ static int davinci_i2s_probe(struct platform_device *pdev)
534 523
535 dev->base = (void __iomem *)IO_ADDRESS(mem->start); 524 dev->base = (void __iomem *)IO_ADDRESS(mem->start);
536 525
537 dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK] = &davinci_i2s_pcm_out; 526 dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK].dma_addr =
538 dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK]->dma_addr =
539 (dma_addr_t)(io_v2p(dev->base) + DAVINCI_MCBSP_DXR_REG); 527 (dma_addr_t)(io_v2p(dev->base) + DAVINCI_MCBSP_DXR_REG);
540 528
541 dev->dma_params[SNDRV_PCM_STREAM_CAPTURE] = &davinci_i2s_pcm_in; 529 dev->dma_params[SNDRV_PCM_STREAM_CAPTURE].dma_addr =
542 dev->dma_params[SNDRV_PCM_STREAM_CAPTURE]->dma_addr =
543 (dma_addr_t)(io_v2p(dev->base) + DAVINCI_MCBSP_DRR_REG); 530 (dma_addr_t)(io_v2p(dev->base) + DAVINCI_MCBSP_DRR_REG);
544 531
545 /* first TX, then RX */ 532 /* first TX, then RX */
@@ -549,7 +536,7 @@ static int davinci_i2s_probe(struct platform_device *pdev)
549 ret = -ENXIO; 536 ret = -ENXIO;
550 goto err_free_mem; 537 goto err_free_mem;
551 } 538 }
552 dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK]->channel = res->start; 539 dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK].channel = res->start;
553 540
554 res = platform_get_resource(pdev, IORESOURCE_DMA, 1); 541 res = platform_get_resource(pdev, IORESOURCE_DMA, 1);
555 if (!res) { 542 if (!res) {
@@ -557,7 +544,7 @@ static int davinci_i2s_probe(struct platform_device *pdev)
557 ret = -ENXIO; 544 ret = -ENXIO;
558 goto err_free_mem; 545 goto err_free_mem;
559 } 546 }
560 dev->dma_params[SNDRV_PCM_STREAM_CAPTURE]->channel = res->start; 547 dev->dma_params[SNDRV_PCM_STREAM_CAPTURE].channel = res->start;
561 548
562 davinci_i2s_dai.private_data = dev; 549 davinci_i2s_dai.private_data = dev;
563 ret = snd_soc_register_dai(&davinci_i2s_dai); 550 ret = snd_soc_register_dai(&davinci_i2s_dai);
diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c
index 7a06c0a86665..5d1f98a4c978 100644
--- a/sound/soc/davinci/davinci-mcasp.c
+++ b/sound/soc/davinci/davinci-mcasp.c
@@ -332,14 +332,6 @@ static inline void mcasp_set_ctl_reg(void __iomem *regs, u32 val)
332 printk(KERN_ERR "GBLCTL write error\n"); 332 printk(KERN_ERR "GBLCTL write error\n");
333} 333}
334 334
335static int davinci_mcasp_startup(struct snd_pcm_substream *substream,
336 struct snd_soc_dai *cpu_dai)
337{
338 struct davinci_audio_dev *dev = cpu_dai->private_data;
339 cpu_dai->dma_data = dev->dma_params[substream->stream];
340 return 0;
341}
342
343static void mcasp_start_rx(struct davinci_audio_dev *dev) 335static void mcasp_start_rx(struct davinci_audio_dev *dev)
344{ 336{
345 mcasp_set_ctl_reg(dev->base + DAVINCI_MCASP_GBLCTLR_REG, RXHCLKRST); 337 mcasp_set_ctl_reg(dev->base + DAVINCI_MCASP_GBLCTLR_REG, RXHCLKRST);
@@ -386,17 +378,17 @@ static void mcasp_start_tx(struct davinci_audio_dev *dev)
386 378
387static void davinci_mcasp_start(struct davinci_audio_dev *dev, int stream) 379static void davinci_mcasp_start(struct davinci_audio_dev *dev, int stream)
388{ 380{
389 if (stream == SNDRV_PCM_STREAM_PLAYBACK) 381 if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
382 if (dev->txnumevt) /* enable FIFO */
383 mcasp_set_bits(dev->base + DAVINCI_MCASP_WFIFOCTL,
384 FIFO_ENABLE);
390 mcasp_start_tx(dev); 385 mcasp_start_tx(dev);
391 else 386 } else {
387 if (dev->rxnumevt) /* enable FIFO */
388 mcasp_set_bits(dev->base + DAVINCI_MCASP_RFIFOCTL,
389 FIFO_ENABLE);
392 mcasp_start_rx(dev); 390 mcasp_start_rx(dev);
393 391 }
394 /* enable FIFO */
395 if (dev->txnumevt)
396 mcasp_set_bits(dev->base + DAVINCI_MCASP_WFIFOCTL, FIFO_ENABLE);
397
398 if (dev->rxnumevt)
399 mcasp_set_bits(dev->base + DAVINCI_MCASP_RFIFOCTL, FIFO_ENABLE);
400} 392}
401 393
402static void mcasp_stop_rx(struct davinci_audio_dev *dev) 394static void mcasp_stop_rx(struct davinci_audio_dev *dev)
@@ -413,17 +405,17 @@ static void mcasp_stop_tx(struct davinci_audio_dev *dev)
413 405
414static void davinci_mcasp_stop(struct davinci_audio_dev *dev, int stream) 406static void davinci_mcasp_stop(struct davinci_audio_dev *dev, int stream)
415{ 407{
416 if (stream == SNDRV_PCM_STREAM_PLAYBACK) 408 if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
409 if (dev->txnumevt) /* disable FIFO */
410 mcasp_clr_bits(dev->base + DAVINCI_MCASP_WFIFOCTL,
411 FIFO_ENABLE);
417 mcasp_stop_tx(dev); 412 mcasp_stop_tx(dev);
418 else 413 } else {
414 if (dev->rxnumevt) /* disable FIFO */
415 mcasp_clr_bits(dev->base + DAVINCI_MCASP_RFIFOCTL,
416 FIFO_ENABLE);
419 mcasp_stop_rx(dev); 417 mcasp_stop_rx(dev);
420 418 }
421 /* disable FIFO */
422 if (dev->txnumevt)
423 mcasp_clr_bits(dev->base + DAVINCI_MCASP_WFIFOCTL, FIFO_ENABLE);
424
425 if (dev->rxnumevt)
426 mcasp_clr_bits(dev->base + DAVINCI_MCASP_RFIFOCTL, FIFO_ENABLE);
427} 419}
428 420
429static int davinci_mcasp_set_dai_fmt(struct snd_soc_dai *cpu_dai, 421static int davinci_mcasp_set_dai_fmt(struct snd_soc_dai *cpu_dai,
@@ -720,7 +712,7 @@ static int davinci_mcasp_hw_params(struct snd_pcm_substream *substream,
720{ 712{
721 struct davinci_audio_dev *dev = cpu_dai->private_data; 713 struct davinci_audio_dev *dev = cpu_dai->private_data;
722 struct davinci_pcm_dma_params *dma_params = 714 struct davinci_pcm_dma_params *dma_params =
723 dev->dma_params[substream->stream]; 715 &dev->dma_params[substream->stream];
724 int word_length; 716 int word_length;
725 u8 numevt; 717 u8 numevt;
726 718
@@ -798,7 +790,6 @@ static int davinci_mcasp_trigger(struct snd_pcm_substream *substream,
798} 790}
799 791
800static struct snd_soc_dai_ops davinci_mcasp_dai_ops = { 792static struct snd_soc_dai_ops davinci_mcasp_dai_ops = {
801 .startup = davinci_mcasp_startup,
802 .trigger = davinci_mcasp_trigger, 793 .trigger = davinci_mcasp_trigger,
803 .hw_params = davinci_mcasp_hw_params, 794 .hw_params = davinci_mcasp_hw_params,
804 .set_fmt = davinci_mcasp_set_dai_fmt, 795 .set_fmt = davinci_mcasp_set_dai_fmt,
@@ -849,20 +840,12 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
849 struct resource *mem, *ioarea, *res; 840 struct resource *mem, *ioarea, *res;
850 struct snd_platform_data *pdata; 841 struct snd_platform_data *pdata;
851 struct davinci_audio_dev *dev; 842 struct davinci_audio_dev *dev;
852 int count = 0;
853 int ret = 0; 843 int ret = 0;
854 844
855 dev = kzalloc(sizeof(struct davinci_audio_dev), GFP_KERNEL); 845 dev = kzalloc(sizeof(struct davinci_audio_dev), GFP_KERNEL);
856 if (!dev) 846 if (!dev)
857 return -ENOMEM; 847 return -ENOMEM;
858 848
859 dma_data = kzalloc(sizeof(struct davinci_pcm_dma_params) * 2,
860 GFP_KERNEL);
861 if (!dma_data) {
862 ret = -ENOMEM;
863 goto err_release_dev;
864 }
865
866 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); 849 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
867 if (!mem) { 850 if (!mem) {
868 dev_err(&pdev->dev, "no mem resource?\n"); 851 dev_err(&pdev->dev, "no mem resource?\n");
@@ -897,11 +880,10 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
897 dev->txnumevt = pdata->txnumevt; 880 dev->txnumevt = pdata->txnumevt;
898 dev->rxnumevt = pdata->rxnumevt; 881 dev->rxnumevt = pdata->rxnumevt;
899 882
900 dma_data[count].name = "I2S PCM Stereo out"; 883 dma_data = &dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK];
901 dma_data[count].eventq_no = pdata->eventq_no; 884 dma_data->eventq_no = pdata->eventq_no;
902 dma_data[count].dma_addr = (dma_addr_t) (pdata->tx_dma_offset + 885 dma_data->dma_addr = (dma_addr_t) (pdata->tx_dma_offset +
903 io_v2p(dev->base)); 886 io_v2p(dev->base));
904 dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK] = &dma_data[count];
905 887
906 /* first TX, then RX */ 888 /* first TX, then RX */
907 res = platform_get_resource(pdev, IORESOURCE_DMA, 0); 889 res = platform_get_resource(pdev, IORESOURCE_DMA, 0);
@@ -910,13 +892,12 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
910 goto err_release_region; 892 goto err_release_region;
911 } 893 }
912 894
913 dma_data[count].channel = res->start; 895 dma_data->channel = res->start;
914 count++; 896
915 dma_data[count].name = "I2S PCM Stereo in"; 897 dma_data = &dev->dma_params[SNDRV_PCM_STREAM_CAPTURE];
916 dma_data[count].eventq_no = pdata->eventq_no; 898 dma_data->eventq_no = pdata->eventq_no;
917 dma_data[count].dma_addr = (dma_addr_t)(pdata->rx_dma_offset + 899 dma_data->dma_addr = (dma_addr_t)(pdata->rx_dma_offset +
918 io_v2p(dev->base)); 900 io_v2p(dev->base));
919 dev->dma_params[SNDRV_PCM_STREAM_CAPTURE] = &dma_data[count];
920 901
921 res = platform_get_resource(pdev, IORESOURCE_DMA, 1); 902 res = platform_get_resource(pdev, IORESOURCE_DMA, 1);
922 if (!res) { 903 if (!res) {
@@ -924,7 +905,7 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
924 goto err_release_region; 905 goto err_release_region;
925 } 906 }
926 907
927 dma_data[count].channel = res->start; 908 dma_data->channel = res->start;
928 davinci_mcasp_dai[pdata->op_mode].private_data = dev; 909 davinci_mcasp_dai[pdata->op_mode].private_data = dev;
929 davinci_mcasp_dai[pdata->op_mode].dev = &pdev->dev; 910 davinci_mcasp_dai[pdata->op_mode].dev = &pdev->dev;
930 ret = snd_soc_register_dai(&davinci_mcasp_dai[pdata->op_mode]); 911 ret = snd_soc_register_dai(&davinci_mcasp_dai[pdata->op_mode]);
@@ -936,8 +917,6 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
936err_release_region: 917err_release_region:
937 release_mem_region(mem->start, (mem->end - mem->start) + 1); 918 release_mem_region(mem->start, (mem->end - mem->start) + 1);
938err_release_data: 919err_release_data:
939 kfree(dma_data);
940err_release_dev:
941 kfree(dev); 920 kfree(dev);
942 921
943 return ret; 922 return ret;
@@ -946,7 +925,6 @@ err_release_dev:
946static int davinci_mcasp_remove(struct platform_device *pdev) 925static int davinci_mcasp_remove(struct platform_device *pdev)
947{ 926{
948 struct snd_platform_data *pdata = pdev->dev.platform_data; 927 struct snd_platform_data *pdata = pdev->dev.platform_data;
949 struct davinci_pcm_dma_params *dma_data;
950 struct davinci_audio_dev *dev; 928 struct davinci_audio_dev *dev;
951 struct resource *mem; 929 struct resource *mem;
952 930
@@ -959,8 +937,6 @@ static int davinci_mcasp_remove(struct platform_device *pdev)
959 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); 937 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
960 release_mem_region(mem->start, (mem->end - mem->start) + 1); 938 release_mem_region(mem->start, (mem->end - mem->start) + 1);
961 939
962 dma_data = dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK];
963 kfree(dma_data);
964 kfree(dev); 940 kfree(dev);
965 941
966 return 0; 942 return 0;
diff --git a/sound/soc/davinci/davinci-mcasp.h b/sound/soc/davinci/davinci-mcasp.h
index 554354c1cc2f..9d179cc88f7b 100644
--- a/sound/soc/davinci/davinci-mcasp.h
+++ b/sound/soc/davinci/davinci-mcasp.h
@@ -39,10 +39,15 @@ enum {
39}; 39};
40 40
41struct davinci_audio_dev { 41struct davinci_audio_dev {
42 /*
43 * dma_params must be first because rtd->dai->cpu_dai->private_data
44 * is cast to a pointer of an array of struct davinci_pcm_dma_params in
45 * davinci_pcm_open.
46 */
47 struct davinci_pcm_dma_params dma_params[2];
42 void __iomem *base; 48 void __iomem *base;
43 int sample_rate; 49 int sample_rate;
44 struct clk *clk; 50 struct clk *clk;
45 struct davinci_pcm_dma_params *dma_params[2];
46 unsigned int codec_fmt; 51 unsigned int codec_fmt;
47 52
48 /* McASP specific data */ 53 /* McASP specific data */
diff --git a/sound/soc/davinci/davinci-pcm.c b/sound/soc/davinci/davinci-pcm.c
index 2f7da49ed34f..c73a915f233f 100644
--- a/sound/soc/davinci/davinci-pcm.c
+++ b/sound/soc/davinci/davinci-pcm.c
@@ -126,16 +126,9 @@ static void davinci_pcm_dma_irq(unsigned lch, u16 ch_status, void *data)
126static int davinci_pcm_dma_request(struct snd_pcm_substream *substream) 126static int davinci_pcm_dma_request(struct snd_pcm_substream *substream)
127{ 127{
128 struct davinci_runtime_data *prtd = substream->runtime->private_data; 128 struct davinci_runtime_data *prtd = substream->runtime->private_data;
129 struct snd_soc_pcm_runtime *rtd = substream->private_data;
130 struct davinci_pcm_dma_params *dma_data = rtd->dai->cpu_dai->dma_data;
131 struct edmacc_param p_ram; 129 struct edmacc_param p_ram;
132 int ret; 130 int ret;
133 131
134 if (!dma_data)
135 return -ENODEV;
136
137 prtd->params = dma_data;
138
139 /* Request master DMA channel */ 132 /* Request master DMA channel */
140 ret = edma_alloc_channel(prtd->params->channel, 133 ret = edma_alloc_channel(prtd->params->channel,
141 davinci_pcm_dma_irq, substream, 134 davinci_pcm_dma_irq, substream,
@@ -244,6 +237,11 @@ static int davinci_pcm_open(struct snd_pcm_substream *substream)
244 struct snd_pcm_runtime *runtime = substream->runtime; 237 struct snd_pcm_runtime *runtime = substream->runtime;
245 struct davinci_runtime_data *prtd; 238 struct davinci_runtime_data *prtd;
246 int ret = 0; 239 int ret = 0;
240 struct snd_soc_pcm_runtime *rtd = substream->private_data;
241 struct davinci_pcm_dma_params *pa = rtd->dai->cpu_dai->private_data;
242 struct davinci_pcm_dma_params *params = &pa[substream->stream];
243 if (!params)
244 return -ENODEV;
247 245
248 snd_soc_set_runtime_hwparams(substream, &davinci_pcm_hardware); 246 snd_soc_set_runtime_hwparams(substream, &davinci_pcm_hardware);
249 /* ensure that buffer size is a multiple of period size */ 247 /* ensure that buffer size is a multiple of period size */
@@ -257,6 +255,7 @@ static int davinci_pcm_open(struct snd_pcm_substream *substream)
257 return -ENOMEM; 255 return -ENOMEM;
258 256
259 spin_lock_init(&prtd->lock); 257 spin_lock_init(&prtd->lock);
258 prtd->params = params;
260 259
261 runtime->private_data = prtd; 260 runtime->private_data = prtd;
262 261
diff --git a/sound/soc/davinci/davinci-pcm.h b/sound/soc/davinci/davinci-pcm.h
index 63d96253c73a..8746606efc89 100644
--- a/sound/soc/davinci/davinci-pcm.h
+++ b/sound/soc/davinci/davinci-pcm.h
@@ -17,7 +17,6 @@
17 17
18 18
19struct davinci_pcm_dma_params { 19struct davinci_pcm_dma_params {
20 char *name; /* stream identifier */
21 int channel; /* sync dma channel ID */ 20 int channel; /* sync dma channel ID */
22 unsigned short acnt; 21 unsigned short acnt;
23 dma_addr_t dma_addr; /* device physical address for DMA */ 22 dma_addr_t dma_addr; /* device physical address for DMA */
diff --git a/sound/soc/pxa/Kconfig b/sound/soc/pxa/Kconfig
index 6375b4ea525d..dcb3181bb340 100644
--- a/sound/soc/pxa/Kconfig
+++ b/sound/soc/pxa/Kconfig
@@ -138,7 +138,7 @@ config SND_PXA2XX_SOC_MIOA701
138 138
139config SND_PXA2XX_SOC_IMOTE2 139config SND_PXA2XX_SOC_IMOTE2
140 tristate "SoC Audio support for IMote 2" 140 tristate "SoC Audio support for IMote 2"
141 depends on SND_PXA2XX_SOC && MACH_INTELMOTE2 141 depends on SND_PXA2XX_SOC && MACH_INTELMOTE2 && I2C
142 select SND_PXA2XX_SOC_I2S 142 select SND_PXA2XX_SOC_I2S
143 select SND_SOC_WM8940 143 select SND_SOC_WM8940
144 help 144 help
diff --git a/sound/usb/usbmixer.c b/sound/usb/usbmixer.c
index ab5a3ac2ac47..9efcfd08d747 100644
--- a/sound/usb/usbmixer.c
+++ b/sound/usb/usbmixer.c
@@ -898,6 +898,11 @@ static struct snd_kcontrol_new usb_feature_unit_ctl = {
898 * build a feature control 898 * build a feature control
899 */ 899 */
900 900
901static size_t append_ctl_name(struct snd_kcontrol *kctl, const char *str)
902{
903 return strlcat(kctl->id.name, str, sizeof(kctl->id.name));
904}
905
901static void build_feature_ctl(struct mixer_build *state, unsigned char *desc, 906static void build_feature_ctl(struct mixer_build *state, unsigned char *desc,
902 unsigned int ctl_mask, int control, 907 unsigned int ctl_mask, int control,
903 struct usb_audio_term *iterm, int unitid) 908 struct usb_audio_term *iterm, int unitid)
@@ -978,13 +983,13 @@ static void build_feature_ctl(struct mixer_build *state, unsigned char *desc,
978 */ 983 */
979 if (! mapped_name && ! (state->oterm.type >> 16)) { 984 if (! mapped_name && ! (state->oterm.type >> 16)) {
980 if ((state->oterm.type & 0xff00) == 0x0100) { 985 if ((state->oterm.type & 0xff00) == 0x0100) {
981 len = strlcat(kctl->id.name, " Capture", sizeof(kctl->id.name)); 986 len = append_ctl_name(kctl, " Capture");
982 } else { 987 } else {
983 len = strlcat(kctl->id.name + len, " Playback", sizeof(kctl->id.name)); 988 len = append_ctl_name(kctl, " Playback");
984 } 989 }
985 } 990 }
986 strlcat(kctl->id.name + len, control == USB_FEATURE_MUTE ? " Switch" : " Volume", 991 append_ctl_name(kctl, control == USB_FEATURE_MUTE ?
987 sizeof(kctl->id.name)); 992 " Switch" : " Volume");
988 if (control == USB_FEATURE_VOLUME) { 993 if (control == USB_FEATURE_VOLUME) {
989 kctl->tlv.c = mixer_vol_tlv; 994 kctl->tlv.c = mixer_vol_tlv;
990 kctl->vd[0].access |= 995 kctl->vd[0].access |=
@@ -1143,7 +1148,7 @@ static void build_mixer_unit_ctl(struct mixer_build *state, unsigned char *desc,
1143 len = get_term_name(state, iterm, kctl->id.name, sizeof(kctl->id.name), 0); 1148 len = get_term_name(state, iterm, kctl->id.name, sizeof(kctl->id.name), 0);
1144 if (! len) 1149 if (! len)
1145 len = sprintf(kctl->id.name, "Mixer Source %d", in_ch + 1); 1150 len = sprintf(kctl->id.name, "Mixer Source %d", in_ch + 1);
1146 strlcat(kctl->id.name + len, " Volume", sizeof(kctl->id.name)); 1151 append_ctl_name(kctl, " Volume");
1147 1152
1148 snd_printdd(KERN_INFO "[%d] MU [%s] ch = %d, val = %d/%d\n", 1153 snd_printdd(KERN_INFO "[%d] MU [%s] ch = %d, val = %d/%d\n",
1149 cval->id, kctl->id.name, cval->channels, cval->min, cval->max); 1154 cval->id, kctl->id.name, cval->channels, cval->min, cval->max);
@@ -1400,8 +1405,8 @@ static int build_audio_procunit(struct mixer_build *state, int unitid, unsigned
1400 if (! len) 1405 if (! len)
1401 strlcpy(kctl->id.name, name, sizeof(kctl->id.name)); 1406 strlcpy(kctl->id.name, name, sizeof(kctl->id.name));
1402 } 1407 }
1403 strlcat(kctl->id.name, " ", sizeof(kctl->id.name)); 1408 append_ctl_name(kctl, " ");
1404 strlcat(kctl->id.name, valinfo->suffix, sizeof(kctl->id.name)); 1409 append_ctl_name(kctl, valinfo->suffix);
1405 1410
1406 snd_printdd(KERN_INFO "[%d] PU [%s] ch = %d, val = %d/%d\n", 1411 snd_printdd(KERN_INFO "[%d] PU [%s] ch = %d, val = %d/%d\n",
1407 cval->id, kctl->id.name, cval->channels, cval->min, cval->max); 1412 cval->id, kctl->id.name, cval->channels, cval->min, cval->max);
@@ -1610,9 +1615,9 @@ static int parse_audio_selector_unit(struct mixer_build *state, int unitid, unsi
1610 strlcpy(kctl->id.name, "USB", sizeof(kctl->id.name)); 1615 strlcpy(kctl->id.name, "USB", sizeof(kctl->id.name));
1611 1616
1612 if ((state->oterm.type & 0xff00) == 0x0100) 1617 if ((state->oterm.type & 0xff00) == 0x0100)
1613 strlcat(kctl->id.name, " Capture Source", sizeof(kctl->id.name)); 1618 append_ctl_name(kctl, " Capture Source");
1614 else 1619 else
1615 strlcat(kctl->id.name, " Playback Source", sizeof(kctl->id.name)); 1620 append_ctl_name(kctl, " Playback Source");
1616 } 1621 }
1617 1622
1618 snd_printdd(KERN_INFO "[%d] SU [%s] items = %d\n", 1623 snd_printdd(KERN_INFO "[%d] SU [%s] items = %d\n",