aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_realtek.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2010-09-10 01:27:33 -0400
committerDavid S. Miller <davem@davemloft.net>2010-09-10 01:27:33 -0400
commite548833df83c3554229eff0672900bfe958b45fd (patch)
tree85efc4a76dc356593d6d394776aeb845dc580fb6 /sound/pci/hda/patch_realtek.c
parentcbd9da7be869f676afc204e1a664163778c770bd (diff)
parent053d8f6622701f849fda2ca2c9ae596c13599ba9 (diff)
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts: net/mac80211/main.c
Diffstat (limited to 'sound/pci/hda/patch_realtek.c')
-rw-r--r--sound/pci/hda/patch_realtek.c177
1 files changed, 145 insertions, 32 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 2cd1ae809e4..627bf996336 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -14467,6 +14467,7 @@ static const struct alc_fixup alc269_fixups[] = {
14467 14467
14468static struct snd_pci_quirk alc269_fixup_tbl[] = { 14468static struct snd_pci_quirk alc269_fixup_tbl[] = {
14469 SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), 14469 SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
14470 SND_PCI_QUIRK(0x104d, 0x9077, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
14470 {} 14471 {}
14471}; 14472};
14472 14473
@@ -19030,6 +19031,7 @@ static int patch_alc888(struct hda_codec *codec)
19030/* 19031/*
19031 * ALC680 support 19032 * ALC680 support
19032 */ 19033 */
19034#define ALC680_DIGIN_NID ALC880_DIGIN_NID
19033#define ALC680_DIGOUT_NID ALC880_DIGOUT_NID 19035#define ALC680_DIGOUT_NID ALC880_DIGOUT_NID
19034#define alc680_modes alc260_modes 19036#define alc680_modes alc260_modes
19035 19037
@@ -19044,23 +19046,93 @@ static hda_nid_t alc680_adc_nids[3] = {
19044 0x07, 0x08, 0x09 19046 0x07, 0x08, 0x09
19045}; 19047};
19046 19048
19049/*
19050 * Analog capture ADC cgange
19051 */
19052static int alc680_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
19053 struct hda_codec *codec,
19054 unsigned int stream_tag,
19055 unsigned int format,
19056 struct snd_pcm_substream *substream)
19057{
19058 struct alc_spec *spec = codec->spec;
19059 struct auto_pin_cfg *cfg = &spec->autocfg;
19060 unsigned int pre_mic, pre_line;
19061
19062 pre_mic = snd_hda_jack_detect(codec, cfg->input_pins[AUTO_PIN_MIC]);
19063 pre_line = snd_hda_jack_detect(codec, cfg->input_pins[AUTO_PIN_LINE]);
19064
19065 spec->cur_adc_stream_tag = stream_tag;
19066 spec->cur_adc_format = format;
19067
19068 if (pre_mic || pre_line) {
19069 if (pre_mic)
19070 snd_hda_codec_setup_stream(codec, 0x08, stream_tag, 0,
19071 format);
19072 else
19073 snd_hda_codec_setup_stream(codec, 0x09, stream_tag, 0,
19074 format);
19075 } else
19076 snd_hda_codec_setup_stream(codec, 0x07, stream_tag, 0, format);
19077 return 0;
19078}
19079
19080static int alc680_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
19081 struct hda_codec *codec,
19082 struct snd_pcm_substream *substream)
19083{
19084 snd_hda_codec_cleanup_stream(codec, 0x07);
19085 snd_hda_codec_cleanup_stream(codec, 0x08);
19086 snd_hda_codec_cleanup_stream(codec, 0x09);
19087 return 0;
19088}
19089
19090static struct hda_pcm_stream alc680_pcm_analog_auto_capture = {
19091 .substreams = 1, /* can be overridden */
19092 .channels_min = 2,
19093 .channels_max = 2,
19094 /* NID is set in alc_build_pcms */
19095 .ops = {
19096 .prepare = alc680_capture_pcm_prepare,
19097 .cleanup = alc680_capture_pcm_cleanup
19098 },
19099};
19100
19047static struct snd_kcontrol_new alc680_base_mixer[] = { 19101static struct snd_kcontrol_new alc680_base_mixer[] = {
19048 /* output mixer control */ 19102 /* output mixer control */
19049 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), 19103 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
19050 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), 19104 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
19051 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x4, 0x0, HDA_OUTPUT), 19105 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x4, 0x0, HDA_OUTPUT),
19052 HDA_CODEC_MUTE("Headphone Playback Switch", 0x16, 0x0, HDA_OUTPUT), 19106 HDA_CODEC_MUTE("Headphone Playback Switch", 0x16, 0x0, HDA_OUTPUT),
19107 HDA_CODEC_VOLUME("Int Mic Boost", 0x12, 0, HDA_INPUT),
19053 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), 19108 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
19109 HDA_CODEC_VOLUME("Line In Boost", 0x19, 0, HDA_INPUT),
19054 { } 19110 { }
19055}; 19111};
19056 19112
19057static struct snd_kcontrol_new alc680_capture_mixer[] = { 19113static struct hda_bind_ctls alc680_bind_cap_vol = {
19058 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), 19114 .ops = &snd_hda_bind_vol,
19059 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), 19115 .values = {
19060 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT), 19116 HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT),
19061 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT), 19117 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
19062 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT), 19118 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
19063 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT), 19119 0
19120 },
19121};
19122
19123static struct hda_bind_ctls alc680_bind_cap_switch = {
19124 .ops = &snd_hda_bind_sw,
19125 .values = {
19126 HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT),
19127 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
19128 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
19129 0
19130 },
19131};
19132
19133static struct snd_kcontrol_new alc680_master_capture_mixer[] = {
19134 HDA_BIND_VOL("Capture Volume", &alc680_bind_cap_vol),
19135 HDA_BIND_SW("Capture Switch", &alc680_bind_cap_switch),
19064 { } /* end */ 19136 { } /* end */
19065}; 19137};
19066 19138
@@ -19068,25 +19140,73 @@ static struct snd_kcontrol_new alc680_capture_mixer[] = {
19068 * generic initialization of ADC, input mixers and output mixers 19140 * generic initialization of ADC, input mixers and output mixers
19069 */ 19141 */
19070static struct hda_verb alc680_init_verbs[] = { 19142static struct hda_verb alc680_init_verbs[] = {
19071 /* Unmute DAC0-1 and set vol = 0 */ 19143 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19072 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 19144 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19073 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 19145 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19074 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
19075 19146
19076 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, 19147 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
19077 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, 19148 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
19078 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, 19149 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
19079 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, 19150 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
19080 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, 19151 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
19152 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
19081 19153
19082 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 19154 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19083 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 19155 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19084 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 19156 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19085 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 19157 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19086 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 19158 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19159
19160 {0x16, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
19161 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
19162
19087 { } 19163 { }
19088}; 19164};
19089 19165
19166/* toggle speaker-output according to the hp-jack state */
19167static void alc680_base_setup(struct hda_codec *codec)
19168{
19169 struct alc_spec *spec = codec->spec;
19170
19171 spec->autocfg.hp_pins[0] = 0x16;
19172 spec->autocfg.speaker_pins[0] = 0x14;
19173 spec->autocfg.speaker_pins[1] = 0x15;
19174 spec->autocfg.input_pins[AUTO_PIN_MIC] = 0x18;
19175 spec->autocfg.input_pins[AUTO_PIN_LINE] = 0x19;
19176}
19177
19178static void alc680_rec_autoswitch(struct hda_codec *codec)
19179{
19180 struct alc_spec *spec = codec->spec;
19181 struct auto_pin_cfg *cfg = &spec->autocfg;
19182 unsigned int present;
19183 hda_nid_t new_adc;
19184
19185 present = snd_hda_jack_detect(codec, cfg->input_pins[AUTO_PIN_MIC]);
19186
19187 new_adc = present ? 0x8 : 0x7;
19188 __snd_hda_codec_cleanup_stream(codec, !present ? 0x8 : 0x7, 1);
19189 snd_hda_codec_setup_stream(codec, new_adc,
19190 spec->cur_adc_stream_tag, 0,
19191 spec->cur_adc_format);
19192
19193}
19194
19195static void alc680_unsol_event(struct hda_codec *codec,
19196 unsigned int res)
19197{
19198 if ((res >> 26) == ALC880_HP_EVENT)
19199 alc_automute_amp(codec);
19200 if ((res >> 26) == ALC880_MIC_EVENT)
19201 alc680_rec_autoswitch(codec);
19202}
19203
19204static void alc680_inithook(struct hda_codec *codec)
19205{
19206 alc_automute_amp(codec);
19207 alc680_rec_autoswitch(codec);
19208}
19209
19090/* create input playback/capture controls for the given pin */ 19210/* create input playback/capture controls for the given pin */
19091static int alc680_new_analog_output(struct alc_spec *spec, hda_nid_t nid, 19211static int alc680_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
19092 const char *ctlname, int idx) 19212 const char *ctlname, int idx)
@@ -19197,13 +19317,7 @@ static void alc680_auto_init_hp_out(struct hda_codec *codec)
19197#define alc680_pcm_analog_capture alc880_pcm_analog_capture 19317#define alc680_pcm_analog_capture alc880_pcm_analog_capture
19198#define alc680_pcm_analog_alt_capture alc880_pcm_analog_alt_capture 19318#define alc680_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
19199#define alc680_pcm_digital_playback alc880_pcm_digital_playback 19319#define alc680_pcm_digital_playback alc880_pcm_digital_playback
19200 19320#define alc680_pcm_digital_capture alc880_pcm_digital_capture
19201static struct hda_input_mux alc680_capture_source = {
19202 .num_items = 1,
19203 .items = {
19204 { "Mic", 0x0 },
19205 },
19206};
19207 19321
19208/* 19322/*
19209 * BIOS auto configuration 19323 * BIOS auto configuration
@@ -19218,6 +19332,7 @@ static int alc680_parse_auto_config(struct hda_codec *codec)
19218 alc680_ignore); 19332 alc680_ignore);
19219 if (err < 0) 19333 if (err < 0)
19220 return err; 19334 return err;
19335
19221 if (!spec->autocfg.line_outs) { 19336 if (!spec->autocfg.line_outs) {
19222 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { 19337 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
19223 spec->multiout.max_channels = 2; 19338 spec->multiout.max_channels = 2;
@@ -19239,8 +19354,6 @@ static int alc680_parse_auto_config(struct hda_codec *codec)
19239 add_mixer(spec, spec->kctls.list); 19354 add_mixer(spec, spec->kctls.list);
19240 19355
19241 add_verb(spec, alc680_init_verbs); 19356 add_verb(spec, alc680_init_verbs);
19242 spec->num_mux_defs = 1;
19243 spec->input_mux = &alc680_capture_source;
19244 19357
19245 err = alc_auto_add_mic_boost(codec); 19358 err = alc_auto_add_mic_boost(codec);
19246 if (err < 0) 19359 if (err < 0)
@@ -19279,17 +19392,17 @@ static struct snd_pci_quirk alc680_cfg_tbl[] = {
19279static struct alc_config_preset alc680_presets[] = { 19392static struct alc_config_preset alc680_presets[] = {
19280 [ALC680_BASE] = { 19393 [ALC680_BASE] = {
19281 .mixers = { alc680_base_mixer }, 19394 .mixers = { alc680_base_mixer },
19282 .cap_mixer = alc680_capture_mixer, 19395 .cap_mixer = alc680_master_capture_mixer,
19283 .init_verbs = { alc680_init_verbs }, 19396 .init_verbs = { alc680_init_verbs },
19284 .num_dacs = ARRAY_SIZE(alc680_dac_nids), 19397 .num_dacs = ARRAY_SIZE(alc680_dac_nids),
19285 .dac_nids = alc680_dac_nids, 19398 .dac_nids = alc680_dac_nids,
19286 .num_adc_nids = ARRAY_SIZE(alc680_adc_nids),
19287 .adc_nids = alc680_adc_nids,
19288 .hp_nid = 0x04,
19289 .dig_out_nid = ALC680_DIGOUT_NID, 19399 .dig_out_nid = ALC680_DIGOUT_NID,
19290 .num_channel_mode = ARRAY_SIZE(alc680_modes), 19400 .num_channel_mode = ARRAY_SIZE(alc680_modes),
19291 .channel_mode = alc680_modes, 19401 .channel_mode = alc680_modes,
19292 .input_mux = &alc680_capture_source, 19402 .unsol_event = alc680_unsol_event,
19403 .setup = alc680_base_setup,
19404 .init_hook = alc680_inithook,
19405
19293 }, 19406 },
19294}; 19407};
19295 19408
@@ -19333,9 +19446,9 @@ static int patch_alc680(struct hda_codec *codec)
19333 setup_preset(codec, &alc680_presets[board_config]); 19446 setup_preset(codec, &alc680_presets[board_config]);
19334 19447
19335 spec->stream_analog_playback = &alc680_pcm_analog_playback; 19448 spec->stream_analog_playback = &alc680_pcm_analog_playback;
19336 spec->stream_analog_capture = &alc680_pcm_analog_capture; 19449 spec->stream_analog_capture = &alc680_pcm_analog_auto_capture;
19337 spec->stream_analog_alt_capture = &alc680_pcm_analog_alt_capture;
19338 spec->stream_digital_playback = &alc680_pcm_digital_playback; 19450 spec->stream_digital_playback = &alc680_pcm_digital_playback;
19451 spec->stream_digital_capture = &alc680_pcm_digital_capture;
19339 19452
19340 if (!spec->adc_nids) { 19453 if (!spec->adc_nids) {
19341 spec->adc_nids = alc680_adc_nids; 19454 spec->adc_nids = alc680_adc_nids;