From b40b04ad380ad641e5740486e4b9a56fd32b64cc Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Sat, 16 Feb 2008 09:44:56 +0100 Subject: [PATCH] [ALSA] hda-codec - Add model=mobile for AD1884A & co Added the new model mobile for AD1884A and compatible codecs. It's a reduced version of model=laptop. Signed-off-by: Takashi Iwai --- .../sound/alsa/ALSA-Configuration.txt | 1 + sound/pci/hda/patch_analog.c | 48 ++++++++++++++++++- 2 files changed, 48 insertions(+), 1 deletion(-) diff --git a/Documentation/sound/alsa/ALSA-Configuration.txt b/Documentation/sound/alsa/ALSA-Configuration.txt index bfc6d486ad99..2cfb8b469c53 100644 --- a/Documentation/sound/alsa/ALSA-Configuration.txt +++ b/Documentation/sound/alsa/ALSA-Configuration.txt @@ -915,6 +915,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. AD1884A / AD1883 / AD1984A / AD1984B desktop 3-stack desktop (default) laptop laptop with HP jack sensing + mobile mobile devices with HP jack sensing AD1884 N/A diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index b037fca1b44e..3f3905cc4e01 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c @@ -3623,6 +3623,36 @@ static struct snd_kcontrol_new ad1884a_laptop_mixers[] = { { } /* end */ }; +static struct hda_input_mux ad1884a_mobile_capture_source = { + .num_items = 2, + .items = { + { "Mic", 0x1 }, /* port-C */ + { "Mix", 0x3 }, + }, +}; + +static struct snd_kcontrol_new ad1884a_mobile_mixers[] = { + HDA_CODEC_VOLUME("Master Playback Volume", 0x21, 0x0, HDA_OUTPUT), + HDA_CODEC_MUTE("Master Playback Switch", 0x21, 0x0, HDA_OUTPUT), + HDA_CODEC_VOLUME("PCM Playback Volume", 0x20, 0x5, HDA_INPUT), + HDA_CODEC_MUTE("PCM Playback Switch", 0x20, 0x5, HDA_INPUT), + HDA_CODEC_VOLUME("Mic Playback Volume", 0x20, 0x01, HDA_INPUT), + HDA_CODEC_MUTE("Mic Playback Switch", 0x20, 0x01, HDA_INPUT), + HDA_CODEC_VOLUME("Beep Playback Volume", 0x20, 0x03, HDA_INPUT), + HDA_CODEC_MUTE("Beep Playback Switch", 0x20, 0x03, HDA_INPUT), + HDA_CODEC_VOLUME("Mic Boost", 0x15, 0x0, HDA_INPUT), + HDA_CODEC_VOLUME("Capture Volume", 0x0c, 0x0, HDA_OUTPUT), + HDA_CODEC_MUTE("Capture Switch", 0x0c, 0x0, HDA_OUTPUT), + { + .iface = SNDRV_CTL_ELEM_IFACE_MIXER, + .name = "Capture Source", + .info = ad198x_mux_enum_info, + .get = ad198x_mux_enum_get, + .put = ad198x_mux_enum_put, + }, + { } /* end */ +}; + /* mute internal speaker if HP is plugged */ static void ad1884a_hp_automute(struct hda_codec *codec) { @@ -3677,12 +3707,19 @@ static struct hda_verb ad1884a_laptop_verbs[] = { enum { AD1884A_DESKTOP, AD1884A_LAPTOP, + AD1884A_MOBILE, AD1884A_MODELS }; static const char *ad1884a_models[AD1884A_MODELS] = { [AD1884A_DESKTOP] = "desktop", [AD1884A_LAPTOP] = "laptop", + [AD1884A_MOBILE] = "mobile", +}; + +static struct snd_pci_quirk ad1884a_cfg_tbl[] = { + SND_PCI_QUIRK(0x103c, 0x3030, "HP", AD1884A_MOBILE), + {} }; static int patch_ad1884a(struct hda_codec *codec) @@ -3717,7 +3754,8 @@ static int patch_ad1884a(struct hda_codec *codec) /* override some parameters */ board_config = snd_hda_check_board_config(codec, AD1884A_MODELS, - ad1884a_models, NULL); + ad1884a_models, + ad1884a_cfg_tbl); switch (board_config) { case AD1884A_LAPTOP: spec->mixers[0] = ad1884a_laptop_mixers; @@ -3727,6 +3765,14 @@ static int patch_ad1884a(struct hda_codec *codec) codec->patch_ops.unsol_event = ad1884a_hp_unsol_event; codec->patch_ops.init = ad1884a_hp_init; break; + case AD1884A_MOBILE: + spec->mixers[0] = ad1884a_mobile_mixers; + spec->init_verbs[spec->num_init_verbs++] = ad1884a_laptop_verbs; + spec->multiout.dig_out_nid = 0; + spec->input_mux = &ad1884a_mobile_capture_source; + codec->patch_ops.unsol_event = ad1884a_hp_unsol_event; + codec->patch_ops.init = ad1884a_hp_init; + break; } return 0;