]> Pileus Git - ~andy/linux/commitdiff
ALSA: hda - Introduce the bitmask for excluding output volume
authorTakashi Iwai <tiwai@suse.de>
Mon, 4 Nov 2013 15:32:01 +0000 (16:32 +0100)
committerTakashi Iwai <tiwai@suse.de>
Tue, 5 Nov 2013 06:49:41 +0000 (07:49 +0100)
Add a bitmask to hda_gen_spec indicating NIDs to exclude from the
possible volume controls.  That is, when the bit is set, the NID
corresponding to the bit won't be picked as an output volume control
any longer.

Basically this is just a band-aid for working around the issue found
with CS4208 codec, where only the headphone pin has a volume AMP with
different dB steps.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=60811
Cc: <stable@vger.kernel.org> [v3.12+]
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/hda/hda_generic.c
sound/pci/hda/hda_generic.h
sound/pci/hda/patch_cirrus.c

index b7c89dff7066758e950feec6842dab58f2de29ed..276f6e759bacee18dbbe1d5c969575906e34dacf 100644 (file)
@@ -549,11 +549,15 @@ static hda_nid_t look_for_out_mute_nid(struct hda_codec *codec,
 static hda_nid_t look_for_out_vol_nid(struct hda_codec *codec,
                                      struct nid_path *path)
 {
+       struct hda_gen_spec *spec = codec->spec;
        int i;
 
        for (i = path->depth - 1; i >= 0; i--) {
-               if (nid_has_volume(codec, path->path[i], HDA_OUTPUT))
-                       return path->path[i];
+               hda_nid_t nid = path->path[i];
+               if ((spec->out_vol_mask >> nid) & 1)
+                       continue;
+               if (nid_has_volume(codec, nid, HDA_OUTPUT))
+                       return nid;
        }
        return 0;
 }
index 48d44026705b0f05ac01c51fbdb199215195979f..7e45cb44d1514497385f2f6bc2b63251391cdaba 100644 (file)
@@ -242,6 +242,9 @@ struct hda_gen_spec {
        /* additional mute flags (only effective with auto_mute_via_amp=1) */
        u64 mute_bits;
 
+       /* bitmask for skipping volume controls */
+       u64 out_vol_mask;
+
        /* badness tables for output path evaluations */
        const struct badness_table *main_out_badness;
        const struct badness_table *extra_out_badness;
index 18d9725015855c0ce3f33d174a3dfcd55836efeb..38d073ed4bcce0fbf2569d9bf9d33b986705cb49 100644 (file)
@@ -660,6 +660,8 @@ static int patch_cs4208(struct hda_codec *codec)
                return -ENOMEM;
 
        spec->gen.automute_hook = cs_automute;
+       /* exclude NID 0x10 (HP) from output volumes due to different steps */
+       spec->gen.out_vol_mask = 1ULL << 0x10;
 
        snd_hda_pick_fixup(codec, cs4208_models, cs4208_fixup_tbl,
                           cs4208_fixups);