[alsa-devel] [PATCH] Initial support of the Mitac 8252D (based on ALC883)
Hi!
The attached patch adds initial support of the Mitac 8252D (http://www.mitac-mtc.com.tw/English/products/8252Dspec.htm).
Working: - Front speakers (volume + mute) - Center/LFE speakers (volume + mute) - HP out (with Front Volume) - HP individual mute switch - HP Jack sense - Front Mic and its volume
Not tested: - external mic and its volume
Not working while now: - Mic Jack sense
Questionable: - is Mic have Jack sense? - one or two Mic volume controls? - CD/Line-in: presense in the mixer
Signed-off-by: Andy Shevchenko andy@smile.org.ua
--- alsa-kernel/pci/hda/patch_realtek.c.orig 2007-12-05 17:44:28.000000000 +0300 +++ alsa-kernel/pci/hda/patch_realtek.c 2007-12-05 20:16:46.000000000 +0300 @@ -185,6 +185,7 @@ ALC883_HAIER_W66, ALC888_6ST_HP, ALC888_3ST_HP, + ALC883_MITAC, ALC883_AUTO, ALC883_MODEL_LAST, }; @@ -6342,6 +6343,36 @@ { } /* end */ };
+static struct snd_kcontrol_new alc883_mitac_mixer[] = { + HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), + HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), + HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), + HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), + HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), + HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), + HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), + HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), + HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), + HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), + HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), + HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), + HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), + HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), + HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), + HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), + HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), + { + .iface = SNDRV_CTL_ELEM_IFACE_MIXER, + /* .name = "Capture Source", */ + .name = "Input Source", + .count = 2, + .info = alc883_mux_enum_info, + .get = alc883_mux_enum_get, + .put = alc883_mux_enum_put, + }, + { } /* end */ +}; + static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), @@ -6774,6 +6805,67 @@ { } };
+/* toggle speaker-output according to the hp-jack state */ +static void alc883_mitac_hp_automute(struct hda_codec *codec) +{ + unsigned int present; + + present = snd_hda_codec_read(codec, 0x15, 0, + AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; + snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, + HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); + snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, + HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); +} + +/* auto-toggle front mic */ +/* +static void alc883_mitac_mic_automute(struct hda_codec *codec) +{ + unsigned int present; + unsigned char bits; + + present = snd_hda_codec_read(codec, 0x18, 0, + AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; + bits = present ? HDA_AMP_MUTE : 0; + snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); +} +*/ + +static void alc883_mitac_automute(struct hda_codec *codec) +{ + alc883_mitac_hp_automute(codec); + /* alc883_mitac_mic_automute(codec); */ +} + +static void alc883_mitac_unsol_event(struct hda_codec *codec, + unsigned int res) +{ + switch (res >> 26) { + case ALC880_HP_EVENT: + alc883_mitac_hp_automute(codec); + break; + case ALC880_MIC_EVENT: + /* alc883_mitac_mic_automute(codec); */ + break; + } +} + +static struct hda_verb alc883_mitac_verbs[] = { + /* HP */ + {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, + {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, + /* Subwoofer */ + {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, + {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, + + /* enable unsolicited event */ + {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, + /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ + + { } /* end */ +}; + static struct hda_verb alc883_tagra_verbs[] = { {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, @@ -7156,6 +7246,7 @@ [ALC883_HAIER_W66] = "haier-w66", [ALC888_6ST_HP] = "6stack-hp", [ALC888_3ST_HP] = "3stack-hp", + [ALC883_MITAC] = "mitac", [ALC883_AUTO] = "auto", };
@@ -7190,6 +7281,7 @@ SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), + SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), @@ -7437,6 +7529,19 @@ .need_dac_fix = 1, .input_mux = &alc883_capture_source, }, + [ALC883_MITAC] = { + .mixers = { alc883_mitac_mixer }, + .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, + .num_dacs = ARRAY_SIZE(alc883_dac_nids), + .dac_nids = alc883_dac_nids, + .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), + .adc_nids = alc883_adc_nids, + .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), + .channel_mode = alc883_3ST_2ch_modes, + .input_mux = &alc883_capture_source, + .unsol_event = alc883_mitac_unsol_event, + .init_hook = alc883_mitac_automute, + }, };
Hi Andy Shevchenko!
On Thu, Dec 06, 2007 at 11:46:12AM +0200, Andy Shevchenko wrote next:
The attached patch adds initial support of the Mitac 8252D (http://www.mitac-mtc.com.tw/English/products/8252Dspec.htm).
Working:
- Front speakers (volume + mute)
- Center/LFE speakers (volume + mute)
- HP out (with Front Volume)
- HP individual mute switch
- HP Jack sense
- Front Mic and its volume
Not tested:
- external mic and its volume
Not working while now:
- Mic Jack sense
Questionable:
- is Mic have Jack sense?
- one or two Mic volume controls?
- CD/Line-in: presense in the mixer
Additional info here.
All jacks are connected to the one Jack sense input pin via different impedances (1:2:4 scale). However p.50 of the datasheet says 'The ALC883 does not support hardware impedance detect.' Due to above the Mic and S/PDIF sense couldn't be evaluated.
Also, the laptop has S/PDIF jack. And specifications are included the 5.1 outputs.
Þann Fimmtudagur 06 desember 2007 skrifaði Andy Shevchenko:
Hi!
The attached patch adds initial support of the Mitac 8252D (http://www.mitac-mtc.com.tw/English/products/8252Dspec.htm).
Thanks allot Andy! great work :)
Working:
- Front speakers (volume + mute)
- Center/LFE speakers (volume + mute)
- HP out (with Front Volume)
- HP individual mute switch
- HP Jack sense
- Front Mic and its volume
Not tested:
- external mic and its volume
Not working while now:
- Mic Jack sense
Questionable:
- is Mic have Jack sense?
- one or two Mic volume controls?
- CD/Line-in: presense in the mixer
According to the manual that comes with windows, the external mic mutes the internal one, but I don't have windows
Now kmix comes up with the headphone control, the mute works but the volume slider not(not present in alsamixer). A great thing to have would be a master volume control.
but again thank you!
Hi G?sli!
On Fri, Dec 07, 2007 at 01:23:26PM +0000, G?sli wrote next:
Not working while now:
- Mic Jack sense
Questionable:
- is Mic have Jack sense?
- one or two Mic volume controls?
- CD/Line-in: presense in the mixer
According to the manual that comes with windows, the external mic mutes the internal one, but I don't have windows
Hm... Somebody of my colleguas explains me that windows blind as a beetle. It asks user what the real device he attached. I'm thinking about callback for ALSA to produce analogue way.
Now kmix comes up with the headphone control, the mute works but the volume slider not(not present in alsamixer). A great thing to have would be a master volume control.
Of course, you proposed logical way: the Front Volume may be called as Master due to HP and speakers are used the same node (physical volume control device). However, the all devices based on ALC883 don't have 'Headphone' or 'Master' volume control in the code.
At Fri, 7 Dec 2007 13:23:26 +0000, Gísli wrote:
Now kmix comes up with the headphone control, the mute works but the volume slider not(not present in alsamixer). A great thing to have would be a master volume control.
A master control would be added with my patches for virtual master controls. It'll be added soon to HG tree, I hope.
Takashi
At Thu, 6 Dec 2007 11:46:12 +0200, Andy Shevchenko wrote:
Hi!
The attached patch adds initial support of the Mitac 8252D (http://www.mitac-mtc.com.tw/English/products/8252Dspec.htm).
Working:
- Front speakers (volume + mute)
- Center/LFE speakers (volume + mute)
- HP out (with Front Volume)
- HP individual mute switch
- HP Jack sense
- Front Mic and its volume
Not tested:
- external mic and its volume
Not working while now:
- Mic Jack sense
Questionable:
- is Mic have Jack sense?
- one or two Mic volume controls?
- CD/Line-in: presense in the mixer
Signed-off-by: Andy Shevchenko andy@smile.org.ua
Thanks, applied to HG tree now.
Takashi
participants (3)
-
Andy Shevchenko
-
Gísli
-
Takashi Iwai