From patchwork Sun Jul 12 02:16:05 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raymond Yau X-Patchwork-Id: 6771681 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C9C809F319 for ; Sun, 12 Jul 2015 02:16:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id ACFEF2062A for ; Sun, 12 Jul 2015 02:16:25 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 330992061A for ; Sun, 12 Jul 2015 02:16:24 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id AA9D7260451; Sun, 12 Jul 2015 04:16:22 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 6B416260452; Sun, 12 Jul 2015 04:16:15 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id C28C4260455; Sun, 12 Jul 2015 04:16:13 +0200 (CEST) Received: from mail-oi0-f52.google.com (mail-oi0-f52.google.com [209.85.218.52]) by alsa0.perex.cz (Postfix) with ESMTP id 9756B260451 for ; Sun, 12 Jul 2015 04:16:06 +0200 (CEST) Received: by oihq81 with SMTP id q81so20511841oih.2 for ; Sat, 11 Jul 2015 19:16:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=BZc47DGWVO+AMFfVLxUaN1JLqDxSFzUtzXiffK0Seec=; b=JH/yi4YHeIs6li40dU7HyTxKD1d5MOhrIjLP74QqWABKuT7/DCM6Mz1Zje68mvvx0A 2qz1njzbWT13zfbLAchkZIwDoghU+TwldrWkJYwPt6bSWy95hF3tkFZQ9DiCAmRDySty cDkfhSZ+FtMjhuqVwJvui2di5/tAV0H0X8LxLrA+lDmX/poRUdjVJ1PYSGUzlKmEWW8l QVKiUGASvxhJGwIIitw4AyA666MWareS5lId6/qHisw4LJANcTe5z73nsGKCz0spkruc Z3SBOrzOJokbX00/Wbn9zBASxn+fb0U6EE9beuACjL+j/CpL9SiWRvHjiI8xRCqimzZM Zfxg== MIME-Version: 1.0 X-Received: by 10.182.97.10 with SMTP id dw10mr3342758obb.60.1436667365141; Sat, 11 Jul 2015 19:16:05 -0700 (PDT) Received: by 10.202.197.15 with HTTP; Sat, 11 Jul 2015 19:16:05 -0700 (PDT) Date: Sun, 12 Jul 2015 10:16:05 +0800 Message-ID: From: Raymond Yau To: =?UTF-8?B?xYF1a2FzeiBXb2puacWCb3dpY3o=?= , ALSA Development Mailing List , pulseaudio-discuss@lists.freedesktop.org, tiwai@suse.de X-Content-Filtered-By: Mailman/MimeDel 2.1.14 Subject: [alsa-devel] When select 2.1 profile in pulseaudio, how do pulseaudio select notebook 's internal subwoofer or 5.1 external speaker ? X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP > > > > Are you sure that it is alsa driver bug since pulseaudio seem not using > > line out jack to mute internal speakers ? > > No, I'm not. I set all my jacks to line out and it works now. > Do pulseaudio 2.1 profile select the internal subwoofer or your 5.1 external speaker ? * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05 @@ -2048,12 +2104,8 @@ static const struct hda_fixup alc882_fixups[] = { .v.func = alc889_fixup_coef, }, [ALC882_FIXUP_ACER_ASPIRE_4930G] = { - .type = HDA_FIXUP_PINS, - .v.pins = (const struct hda_pintbl[]) { - { 0x16, 0x99130111 }, /* CLFE speaker */ - { 0x17, 0x99130112 }, /* surround speaker */ - { } - }, + .type = HDA_FIXUP_FUNC, + .v.func = alc888_fixup_acer_aspire_4930g, .chained = true, .chain_id = ALC882_FIXUP_GPIO1, }, diff --git a/sound/pci/hda/hda_auto_parser.c b/sound/pci/hda/hda_auto_parser.c index 03b7399..c9e45e7 100644 @@ -952,6 +960,7 @@ void snd_hda_pick_fixup(struct hda_codec *codec, const struct snd_pci_quirk *q; int id = HDA_FIXUP_ID_NOT_SET; const char *name = NULL; + int i; if (codec->fixup_id != HDA_FIXUP_ID_NOT_SET) return; @@ -966,6 +975,9 @@ void snd_hda_pick_fixup(struct hda_codec *codec, return; } + if (!snd_hda_get_int_hint(codec, "alt_config", &i)) + codec->alt_config = i; + if (codec->modelname && models) { while (models->name) { if (!strcmp(codec->modelname, models->name)) { diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h index 12837ab..38841db 100644 --- a/sound/pci/hda/hda_codec.h +++ b/sound/pci/hda/hda_codec.h @@ -283,6 +283,8 @@ struct hda_codec { /* additional init verbs */ struct snd_array verbs; + int alt_config; + int combo_jack; }; #define dev_to_hda_codec(_dev) container_of(_dev, struct hda_codec, core.dev) diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c index ac0db16..12ee7f7 100644 --- a/sound/pci/hda/hda_generic.c +++ b/sound/pci/hda/hda_generic.c @@ -39,7 +39,6 @@ #include "hda_beep.h" #include "hda_generic.h" - /** * snd_hda_gen_spec_init - initialize hda_gen_spec struct * @spec: hda_gen_spec object to initialize @@ -180,10 +179,10 @@ static void parse_user_hints(struct hda_codec *codec) /* the following two are just for compatibility */ val = snd_hda_get_bool_hint(codec, "add_out_jack_modes"); if (val >= 0) - spec->add_jack_modes = !!val; + spec->add_out_jack_modes = !!val; val = snd_hda_get_bool_hint(codec, "add_in_jack_modes"); if (val >= 0) - spec->add_jack_modes = !!val; + spec->add_in_jack_modes = !!val; val = snd_hda_get_bool_hint(codec, "add_jack_modes"); if (val >= 0) spec->add_jack_modes = !!val; @@ -2648,7 +2720,7 @@ static void get_jack_mode_name(struct hda_codec *codec, hda_nid_t pin, static int get_out_jack_num_items(struct hda_codec *codec, hda_nid_t pin) { struct hda_gen_spec *spec = codec->spec; - if (spec->add_jack_modes) { + if (spec->add_jack_modes || spec->add_out_jack_modes) { unsigned int pincap = snd_hda_query_pin_caps(codec, pin); if ((pincap & AC_PINCAP_OUT) && (pincap & AC_PINCAP_HP_DRV)) return 2; @@ -2791,7 +2863,7 @@ static int get_in_jack_num_items(struct hda_codec *codec, hda_nid_t pin) { struct hda_gen_spec *spec = codec->spec; int nitems = 0; - if (spec->add_jack_modes) + if (spec->add_jack_modes || spec->add_in_jack_modes) nitems = hweight32(get_vref_caps(codec, pin)); return nitems ? nitems : 1; } @@ -3287,7 +3359,7 @@ static int create_input_ctls(struct hda_codec *codec) if (err < 0) return err; - if (spec->add_jack_modes) { + if (spec->add_jack_modes || spec->add_in_jack_modes) { err = create_in_jack_mode(codec, pin); if (err < 0) return err; @@ -4895,13 +4971,13 @@ int snd_hda_gen_parse_auto_config(struct hda_codec *codec, */ if (spec->hp_mic_pin && (spec->auto_mic || spec->input_mux.num_items == 1 || - spec->add_jack_modes)) { + spec->add_jack_modes || spec->add_in_jack_modes)) { err = create_hp_mic_jack_mode(codec, spec->hp_mic_pin); if (err < 0) return err; } - if (spec->add_jack_modes) { + if (spec->add_jack_modes || spec->add_out_jack_modes) { if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) { err = create_out_jack_modes(codec, cfg->line_outs, cfg->line_out_pins); diff --git a/sound/pci/hda/hda_generic.h b/sound/pci/hda/hda_generic.h index 56e4139..f10c55b 100644 --- a/sound/pci/hda/hda_generic.h +++ b/sound/pci/hda/hda_generic.h @@ -227,6 +229,8 @@ struct hda_gen_spec { unsigned int prefer_hp_amp:1; /* enable HP amp for speaker if any */ unsigned int add_stereo_mix_input:2; /* add aamix as a capture src */ unsigned int add_jack_modes:1; /* add i/o jack mode enum ctls */ + unsigned int add_in_jack_modes:1; /* add in jack mode enum ctls */ + unsigned int add_out_jack_modes:1; /* add out jack mode enum ctls */ unsigned int power_down_unused:1; /* power down unused widgets */ unsigned int dac_min_mute:1; /* minimal = mute for DACs */ diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 8e02cdf..b13f588 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -1914,6 +1914,62 @@ static void alc889_fixup_mba21_vref(struct hda_codec *codec, alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids)); } +static const struct snd_pcm_chmap_elem acer_pcm_chmaps[] = { + { .channels = 2, + .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } }, + { .channels = 4, + .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, + SNDRV_CHMAP_LFE, SNDRV_CHMAP_NA } }, /* LFE only on left */ + { .channels = 4, + .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, + SNDRV_CHMAP_RL, SNDRV_CHMAP_RR } }, + { .channels = 6, + .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, + SNDRV_CHMAP_RL, SNDRV_CHMAP_RR, + SNDRV_CHMAP_FC, SNDRV_CHMAP_LFE } }, + { } +}; + +static void alc888_fixup_acer_aspire_4930g(struct hda_codec *codec, + const struct hda_fixup *fix, int action) +{ + static const struct hda_pintbl subwoofer_cfg[] = { + { 0x16, 0x90170111 }, /* internal subwoofer */ + {} + }; + static const struct hda_pintbl front_cfg[] = { + { 0x15, 0x02014010}, + {} + }; + static const struct hda_pintbl rear_cfg[] = { + { 0x1a, 0x02014011}, + {} + }; + static const struct hda_pintbl clfe_cfg[] = { + { 0x18, 0x02014012}, + {} + }; + struct alc_spec *spec = codec->spec; + switch(action){ + case HDA_FIXUP_ACT_PRE_PROBE: + snd_hda_apply_pincfgs(codec, subwoofer_cfg); + spec->gen.add_out_jack_modes = true; + switch(codec->alt_config){ + case 3: + snd_hda_apply_pincfgs(codec, clfe_cfg); + case 2: + snd_hda_apply_pincfgs(codec, rear_cfg); + case 1: + snd_hda_apply_pincfgs(codec, front_cfg); + break; + } + break; + case HDA_FIXUP_ACT_BUILD: + spec->gen.pcm_rec[0]->stream[0].chmap = acer_pcm_chmaps; + break; + } +} + /* Don't take HP output as primary * Strangely, the speaker output doesn't work on Vaio Z and some Vaio