aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKailang Yang <kailang@realtek.com>2008-08-26 07:10:22 -0400
committerJaroslav Kysela <perex@perex.cz>2008-08-29 04:05:55 -0400
commit8ef355da64ff087b6f26c4c28a14753861e83e4b (patch)
tree8ef4aaad6be77fd7f50d83f1291ad41d21aae746
parent4e555fe5475437f5c05b9e1812959bf6d5cd50b9 (diff)
ALSA: hda - Add support of Acer Aspire One
Added the support of Acer Aspire One with ALC269 codec chip. Signed-off-by: Kailang Yang <kailang@realtek.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
-rw-r--r--sound/pci/hda/patch_realtek.c95
1 files changed, 95 insertions, 0 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index e558264d1f59..99c1de639e97 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -113,6 +113,7 @@ enum {
113 ALC268_3ST, 113 ALC268_3ST,
114 ALC268_TOSHIBA, 114 ALC268_TOSHIBA,
115 ALC268_ACER, 115 ALC268_ACER,
116 ALC268_ACER_ASPIRE_ONE,
116 ALC268_DELL, 117 ALC268_DELL,
117 ALC268_ZEPTO, 118 ALC268_ZEPTO,
118#ifdef CONFIG_SND_DEBUG 119#ifdef CONFIG_SND_DEBUG
@@ -10358,6 +10359,14 @@ static struct hda_verb alc268_toshiba_verbs[] = {
10358 { } /* end */ 10359 { } /* end */
10359}; 10360};
10360 10361
10362static struct hda_input_mux alc268_acer_lc_capture_source = {
10363 .num_items = 2,
10364 .items = {
10365 { "i-Mic", 0x6 },
10366 { "E-Mic", 0x0 },
10367 },
10368};
10369
10361/* Acer specific */ 10370/* Acer specific */
10362/* bind volumes of both NID 0x02 and 0x03 */ 10371/* bind volumes of both NID 0x02 and 0x03 */
10363static struct hda_bind_ctls alc268_acer_bind_master_vol = { 10372static struct hda_bind_ctls alc268_acer_bind_master_vol = {
@@ -10410,6 +10419,21 @@ static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
10410 return change; 10419 return change;
10411} 10420}
10412 10421
10422static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
10423 /* output mixer control */
10424 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
10425 {
10426 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10427 .name = "Master Playback Switch",
10428 .info = snd_hda_mixer_amp_switch_info,
10429 .get = snd_hda_mixer_amp_switch_get,
10430 .put = alc268_acer_master_sw_put,
10431 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10432 },
10433 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
10434 { }
10435};
10436
10413static struct snd_kcontrol_new alc268_acer_mixer[] = { 10437static struct snd_kcontrol_new alc268_acer_mixer[] = {
10414 /* output mixer control */ 10438 /* output mixer control */
10415 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), 10439 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
@@ -10427,6 +10451,16 @@ static struct snd_kcontrol_new alc268_acer_mixer[] = {
10427 { } 10451 { }
10428}; 10452};
10429 10453
10454static struct hda_verb alc268_acer_aspire_one_verbs[] = {
10455 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10456 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10457 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10458 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
10459 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
10460 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
10461 { }
10462};
10463
10430static struct hda_verb alc268_acer_verbs[] = { 10464static struct hda_verb alc268_acer_verbs[] = {
10431 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ 10465 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
10432 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 10466 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
@@ -10460,6 +10494,47 @@ static void alc268_acer_init_hook(struct hda_codec *codec)
10460 alc268_acer_automute(codec, 1); 10494 alc268_acer_automute(codec, 1);
10461} 10495}
10462 10496
10497/* toggle speaker-output according to the hp-jack state */
10498static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
10499{
10500 unsigned int present;
10501 unsigned char bits;
10502
10503 present = snd_hda_codec_read(codec, 0x15, 0,
10504 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
10505 bits = present ? AMP_IN_MUTE(0) : 0;
10506 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
10507 AMP_IN_MUTE(0), bits);
10508 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
10509 AMP_IN_MUTE(0), bits);
10510}
10511
10512
10513static void alc268_acer_mic_automute(struct hda_codec *codec)
10514{
10515 unsigned int present;
10516
10517 present = snd_hda_codec_read(codec, 0x18, 0,
10518 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
10519 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL,
10520 present ? 0x0 : 0x6);
10521}
10522
10523static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
10524 unsigned int res)
10525{
10526 if ((res >> 26) == ALC880_HP_EVENT)
10527 alc268_aspire_one_speaker_automute(codec);
10528 if ((res >> 26) == ALC880_MIC_EVENT)
10529 alc268_acer_mic_automute(codec);
10530}
10531
10532static void alc268_acer_lc_init_hook(struct hda_codec *codec)
10533{
10534 alc268_aspire_one_speaker_automute(codec);
10535 alc268_acer_mic_automute(codec);
10536}
10537
10463static struct snd_kcontrol_new alc268_dell_mixer[] = { 10538static struct snd_kcontrol_new alc268_dell_mixer[] = {
10464 /* output mixer control */ 10539 /* output mixer control */
10465 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), 10540 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
@@ -10987,6 +11062,7 @@ static const char *alc268_models[ALC268_MODEL_LAST] = {
10987 [ALC268_3ST] = "3stack", 11062 [ALC268_3ST] = "3stack",
10988 [ALC268_TOSHIBA] = "toshiba", 11063 [ALC268_TOSHIBA] = "toshiba",
10989 [ALC268_ACER] = "acer", 11064 [ALC268_ACER] = "acer",
11065 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
10990 [ALC268_DELL] = "dell", 11066 [ALC268_DELL] = "dell",
10991 [ALC268_ZEPTO] = "zepto", 11067 [ALC268_ZEPTO] = "zepto",
10992#ifdef CONFIG_SND_DEBUG 11068#ifdef CONFIG_SND_DEBUG
@@ -11001,6 +11077,8 @@ static struct snd_pci_quirk alc268_cfg_tbl[] = {
11001 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), 11077 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
11002 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), 11078 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
11003 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), 11079 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
11080 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
11081 ALC268_ACER_ASPIRE_ONE),
11004 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), 11082 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
11005 SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA), 11083 SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA),
11006 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), 11084 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
@@ -11078,6 +11156,23 @@ static struct alc_config_preset alc268_presets[] = {
11078 .unsol_event = alc268_acer_unsol_event, 11156 .unsol_event = alc268_acer_unsol_event,
11079 .init_hook = alc268_acer_init_hook, 11157 .init_hook = alc268_acer_init_hook,
11080 }, 11158 },
11159 [ALC268_ACER_ASPIRE_ONE] = {
11160 .mixers = { alc268_acer_aspire_one_mixer,
11161 alc268_capture_alt_mixer },
11162 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
11163 alc268_acer_aspire_one_verbs },
11164 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
11165 .dac_nids = alc268_dac_nids,
11166 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
11167 .adc_nids = alc268_adc_nids_alt,
11168 .capsrc_nids = alc268_capsrc_nids,
11169 .hp_nid = 0x03,
11170 .num_channel_mode = ARRAY_SIZE(alc268_modes),
11171 .channel_mode = alc268_modes,
11172 .input_mux = &alc268_acer_lc_capture_source,
11173 .unsol_event = alc268_acer_lc_unsol_event,
11174 .init_hook = alc268_acer_lc_init_hook,
11175 },
11081 [ALC268_DELL] = { 11176 [ALC268_DELL] = {
11082 .mixers = { alc268_dell_mixer, alc268_beep_mixer }, 11177 .mixers = { alc268_dell_mixer, alc268_beep_mixer },
11083 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, 11178 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,