All of lore.kernel.org
 help / color / mirror / Atom feed
From: Raymond Yau <superquad.vortex2@gmail.com>
To: ALSA Development Mailing List <alsa-devel@alsa-project.org>,
	tiwai@suse.de, arthurborsboom@gmail.com
Subject: [PATCH - 2/2] HDA - add headset-sonicmaster and headset-multi-sonicmaster models
Date: Mon, 21 Sep 2015 10:12:44 +0800	[thread overview]
Message-ID: <CAN8cciY918bWjx7-GouR5biH072M=46YS0y6oMnzFOSrTQtTZw@mail.gmail.com> (raw)

>From e97383136359c5d3ef93282888540bbb20939a9e Mon Sep 17 00:00:00 2001
From: Raymond Yau <superquad.vortex2@gmail.com>
Date: Sun, 20 Sep 2015 22:18:56 +0800
Subject: [PATCH -  2/2] HDA - add headset-sonicmaster and
 headset-multi-sonicmaster models

add headset only model for ALC668 with Sonic Master Subwoofer

add 625ms delay after headset is plugged for correct detection of headset
type for ALC668

add headset multi model with Sonice Master Subwoofer

update HD-Audio-Models.txt

Signed-off-by: Raymond Yau <superquad.vortex2@gmail.com>

diff --git a/Documentation/sound/alsa/HD-Audio-Models.txt
b/Documentation/sound/alsa/HD-Audio-Models.txt
index ec099d4..8baddac 100644
--- a/Documentation/sound/alsa/HD-Audio-Models.txt
+++ b/Documentation/sound/alsa/HD-Audio-Models.txt
@@ -55,7 +55,12 @@ ALC66x/67x/892
   asus-mode7        ASUS
   asus-mode8        ASUS
   inv-dmic        Inverted internal mic workaround
+
+ALC668
+======
   dell-headset-multi    Headset jack, which can also be used as mic-in
+  headset-sonicmaster   Headset jack and SonicMaster Subwoofer
+  headset-multi-sonicmaster    Headset, HP or Mic and SonicMaster Subwoofer

 ALC680
 ======
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index a75b561..91de00c 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -4029,7 +4029,13 @@ static void alc_update_headset_mode(struct hda_codec
*codec)
                           PIN_VREFHIZ);
     }
     spec->current_headset_mode = new_headset_mode;
-
+    if (codec->core.vendor_id == 0x10ec0668) {
+        if (spec->gen.hs_mic_use_hp_sense && spec->gen.auto_mic) {
+            if (new_headset_mode == ALC_HEADSET_MODE_HEADPHONE)
+                msleep(625);
+            snd_hda_gen_mic_autoswitch(codec, NULL);
+        };
+    }
     snd_hda_gen_update_outputs(codec);
 }

@@ -6071,6 +6077,42 @@ static void alc662_fixup_led_gpio1(struct hda_codec
*codec,
     }
 }

+static void alc668_fixup_asus_headset_only(struct hda_codec *codec,
+                    const struct hda_fixup *fix, int action)
+{
+    const struct hda_pintbl hs_mic_pin[] = {
+        { 0x1b, 0x03a1113c }, /* headset mic */
+        { }
+    };
+    struct alc_spec *spec = codec->spec;
+
+    switch (action) {
+    case HDA_FIXUP_ACT_PRE_PROBE:
+        snd_hda_apply_pincfgs(codec, hs_mic_pin);
+        spec->gen.hs_mic_use_hp_sense = 1;
+        alc_fixup_disable_aamix(codec, fix, action);
+        break;
+    }
+}
+
+static void alc668_fixup_sonicmaster(struct hda_codec *codec,
+                    const struct hda_fixup *fix, int action)
+{
+    const struct hda_pintbl bass_pin[] = {
+        { 0x1a, 0x04110011 }, /* external subwoofer */
+        { }
+    };
+
+    switch (action) {
+    case HDA_FIXUP_ACT_PRE_PROBE:
+        snd_hda_apply_pincfgs(codec, bass_pin);
+        break;
+    case HDA_FIXUP_ACT_BUILD:
+        alc_fixup_bass_chmap(codec, fix, action);
+        break;
+    }
+}
+
 static struct coef_fw alc668_coefs[] = {
     WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa),
WRITE_COEF(0x03,    0x0),
     WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06,    0x0), WRITE_COEF(0x07,
0x0f80),
@@ -6130,6 +6172,9 @@ enum {
     ALC668_FIXUP_AUTO_MUTE,
     ALC668_FIXUP_DELL_DISABLE_AAMIX,
     ALC668_FIXUP_DELL_XPS13,
+    ALC668_FIXUP_HEADSET_ONLY,
+    ALC668_FIXUP_HEADSET_SONICMASTER,
+    ALC668_FIXUP_HEADSET_MULTI_SONICMASTER,
 };

 static const struct hda_fixup alc662_fixups[] = {
@@ -6370,6 +6415,24 @@ static const struct hda_fixup alc662_fixups[] = {
         .type = HDA_FIXUP_FUNC,
         .v.func = alc_fixup_bass_chmap,
     },
+    [ALC668_FIXUP_HEADSET_ONLY] = {
+        .type = HDA_FIXUP_FUNC,
+        .v.func = alc668_fixup_asus_headset_only,
+        .chained = true,
+        .chain_id = ALC668_FIXUP_HEADSET_MODE,
+    },
+    [ALC668_FIXUP_HEADSET_SONICMASTER] = {
+        .type = HDA_FIXUP_FUNC,
+        .v.func = alc668_fixup_sonicmaster,
+        .chained = true,
+        .chain_id = ALC668_FIXUP_HEADSET_ONLY,
+    },
+    [ALC668_FIXUP_HEADSET_MULTI_SONICMASTER] = {
+        .type = HDA_FIXUP_FUNC,
+        .v.func = alc668_fixup_sonicmaster,
+        .chained = true,
+        .chain_id = ALC668_FIXUP_DELL_DISABLE_AAMIX,
+    },
 };

 static const struct snd_pci_quirk alc662_fixup_tbl[] = {
@@ -6476,6 +6539,9 @@ static const struct hda_model_fixup
alc662_fixup_models[] = {
     {.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
     {.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
     {.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name =
"dell-headset-multi"},
+    {.id = ALC668_FIXUP_HEADSET_SONICMASTER, .name =
"headset-sonicmaster"},
+    {.id = ALC668_FIXUP_HEADSET_MULTI_SONICMASTER,
+        .name = "headset-multi-sonicmaster"},
     {}
 };

-- 
2.5.0

                 reply	other threads:[~2015-09-21  2:12 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAN8cciY918bWjx7-GouR5biH072M=46YS0y6oMnzFOSrTQtTZw@mail.gmail.com' \
    --to=superquad.vortex2@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=arthurborsboom@gmail.com \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.