aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_conexant.c
diff options
context:
space:
mode:
authorJaroslav Kysela <perex@perex.cz>2010-01-08 03:11:18 -0500
committerJaroslav Kysela <perex@perex.cz>2010-01-08 03:11:18 -0500
commita4ad68d57e4dc4138304df23d1817eb094149389 (patch)
treeca7d8c4ce5377c4251560de06e15dd7be7063351 /sound/pci/hda/patch_conexant.c
parentcd9d95a55550555da8e587ead9cbba5f98a371a3 (diff)
parentc97259df3f2e163c72f4d0685c61fb2e026dc989 (diff)
Merge branch 'topic/hda' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6 into devel
Diffstat (limited to 'sound/pci/hda/patch_conexant.c')
-rw-r--r--sound/pci/hda/patch_conexant.c43
1 files changed, 37 insertions, 6 deletions
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index b20c640f7502..01e46ba72690 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -29,6 +29,7 @@
29 29
30#include "hda_codec.h" 30#include "hda_codec.h"
31#include "hda_local.h" 31#include "hda_local.h"
32#include "hda_beep.h"
32 33
33#define CXT_PIN_DIR_IN 0x00 34#define CXT_PIN_DIR_IN 0x00
34#define CXT_PIN_DIR_OUT 0x01 35#define CXT_PIN_DIR_OUT 0x01
@@ -111,6 +112,7 @@ struct conexant_spec {
111 unsigned int dell_automute; 112 unsigned int dell_automute;
112 unsigned int port_d_mode; 113 unsigned int port_d_mode;
113 unsigned char ext_mic_bias; 114 unsigned char ext_mic_bias;
115 unsigned int dell_vostro;
114}; 116};
115 117
116static int conexant_playback_pcm_open(struct hda_pcm_stream *hinfo, 118static int conexant_playback_pcm_open(struct hda_pcm_stream *hinfo,
@@ -476,6 +478,7 @@ static void conexant_free(struct hda_codec *codec)
476 snd_array_free(&spec->jacks); 478 snd_array_free(&spec->jacks);
477 } 479 }
478#endif 480#endif
481 snd_hda_detach_beep_device(codec);
479 kfree(codec->spec); 482 kfree(codec->spec);
480} 483}
481 484
@@ -2159,9 +2162,12 @@ static int cxt5066_mic_boost_mux_enum_get(struct snd_kcontrol *kcontrol,
2159{ 2162{
2160 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 2163 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2161 int val; 2164 int val;
2165 hda_nid_t nid = kcontrol->private_value & 0xff;
2166 int inout = (kcontrol->private_value & 0x100) ?
2167 AC_AMP_GET_INPUT : AC_AMP_GET_OUTPUT;
2162 2168
2163 val = snd_hda_codec_read(codec, 0x17, 0, 2169 val = snd_hda_codec_read(codec, nid, 0,
2164 AC_VERB_GET_AMP_GAIN_MUTE, AC_AMP_GET_OUTPUT); 2170 AC_VERB_GET_AMP_GAIN_MUTE, inout);
2165 2171
2166 ucontrol->value.enumerated.item[0] = val & AC_AMP_GAIN; 2172 ucontrol->value.enumerated.item[0] = val & AC_AMP_GAIN;
2167 return 0; 2173 return 0;
@@ -2173,6 +2179,9 @@ static int cxt5066_mic_boost_mux_enum_put(struct snd_kcontrol *kcontrol,
2173 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 2179 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2174 const struct hda_input_mux *imux = &cxt5066_analog_mic_boost; 2180 const struct hda_input_mux *imux = &cxt5066_analog_mic_boost;
2175 unsigned int idx; 2181 unsigned int idx;
2182 hda_nid_t nid = kcontrol->private_value & 0xff;
2183 int inout = (kcontrol->private_value & 0x100) ?
2184 AC_AMP_SET_INPUT : AC_AMP_SET_OUTPUT;
2176 2185
2177 if (!imux->num_items) 2186 if (!imux->num_items)
2178 return 0; 2187 return 0;
@@ -2180,9 +2189,9 @@ static int cxt5066_mic_boost_mux_enum_put(struct snd_kcontrol *kcontrol,
2180 if (idx >= imux->num_items) 2189 if (idx >= imux->num_items)
2181 idx = imux->num_items - 1; 2190 idx = imux->num_items - 1;
2182 2191
2183 snd_hda_codec_write_cache(codec, 0x17, 0, 2192 snd_hda_codec_write_cache(codec, nid, 0,
2184 AC_VERB_SET_AMP_GAIN_MUTE, 2193 AC_VERB_SET_AMP_GAIN_MUTE,
2185 AC_AMP_SET_RIGHT | AC_AMP_SET_LEFT | AC_AMP_SET_OUTPUT | 2194 AC_AMP_SET_RIGHT | AC_AMP_SET_LEFT | inout |
2186 imux->items[idx].index); 2195 imux->items[idx].index);
2187 2196
2188 return 1; 2197 return 1;
@@ -2252,10 +2261,11 @@ static struct snd_kcontrol_new cxt5066_mixers[] = {
2252 2261
2253 { 2262 {
2254 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2263 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2255 .name = "Analog Mic Boost Capture Enum", 2264 .name = "Ext Mic Boost Capture Enum",
2256 .info = cxt5066_mic_boost_mux_enum_info, 2265 .info = cxt5066_mic_boost_mux_enum_info,
2257 .get = cxt5066_mic_boost_mux_enum_get, 2266 .get = cxt5066_mic_boost_mux_enum_get,
2258 .put = cxt5066_mic_boost_mux_enum_put, 2267 .put = cxt5066_mic_boost_mux_enum_put,
2268 .private_value = 0x17,
2259 }, 2269 },
2260 2270
2261 HDA_BIND_VOL("Capture Volume", &cxt5066_bind_capture_vol_others), 2271 HDA_BIND_VOL("Capture Volume", &cxt5066_bind_capture_vol_others),
@@ -2263,6 +2273,19 @@ static struct snd_kcontrol_new cxt5066_mixers[] = {
2263 {} 2273 {}
2264}; 2274};
2265 2275
2276static struct snd_kcontrol_new cxt5066_vostro_mixers[] = {
2277 {
2278 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2279 .name = "Int Mic Boost Capture Enum",
2280 .info = cxt5066_mic_boost_mux_enum_info,
2281 .get = cxt5066_mic_boost_mux_enum_get,
2282 .put = cxt5066_mic_boost_mux_enum_put,
2283 .private_value = 0x23 | 0x100,
2284 },
2285 HDA_CODEC_VOLUME_MONO("Beep Playback Volume", 0x13, 1, 0x0, HDA_OUTPUT),
2286 {}
2287};
2288
2266static struct hda_verb cxt5066_init_verbs[] = { 2289static struct hda_verb cxt5066_init_verbs[] = {
2267 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, /* Port B */ 2290 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, /* Port B */
2268 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, /* Port C */ 2291 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, /* Port C */
@@ -2448,11 +2471,16 @@ static struct hda_verb cxt5066_init_verbs_portd_lo[] = {
2448/* initialize jack-sensing, too */ 2471/* initialize jack-sensing, too */
2449static int cxt5066_init(struct hda_codec *codec) 2472static int cxt5066_init(struct hda_codec *codec)
2450{ 2473{
2474 struct conexant_spec *spec = codec->spec;
2475
2451 snd_printdd("CXT5066: init\n"); 2476 snd_printdd("CXT5066: init\n");
2452 conexant_init(codec); 2477 conexant_init(codec);
2453 if (codec->patch_ops.unsol_event) { 2478 if (codec->patch_ops.unsol_event) {
2454 cxt5066_hp_automute(codec); 2479 cxt5066_hp_automute(codec);
2455 cxt5066_automic(codec); 2480 if (spec->dell_vostro)
2481 cxt5066_vostro_automic(codec);
2482 else
2483 cxt5066_automic(codec);
2456 } 2484 }
2457 return 0; 2485 return 0;
2458} 2486}
@@ -2551,7 +2579,10 @@ static int patch_cxt5066(struct hda_codec *codec)
2551 spec->init_verbs[0] = cxt5066_init_verbs_vostro; 2579 spec->init_verbs[0] = cxt5066_init_verbs_vostro;
2552 spec->mixers[spec->num_mixers++] = cxt5066_mixer_master_olpc; 2580 spec->mixers[spec->num_mixers++] = cxt5066_mixer_master_olpc;
2553 spec->mixers[spec->num_mixers++] = cxt5066_mixers; 2581 spec->mixers[spec->num_mixers++] = cxt5066_mixers;
2582 spec->mixers[spec->num_mixers++] = cxt5066_vostro_mixers;
2554 spec->port_d_mode = 0; 2583 spec->port_d_mode = 0;
2584 spec->dell_vostro = 1;
2585 snd_hda_attach_beep_device(codec, 0x13);
2555 2586
2556 /* no S/PDIF out */ 2587 /* no S/PDIF out */
2557 spec->multiout.dig_out_nid = 0; 2588 spec->multiout.dig_out_nid = 0;