Commit 885845d7 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: hda - Apply MacBook fixups for CS4208 correctly

The commit [8fe7b65a: ALSA: hda - Apply GPIO setup for MacBooks
with CS4208] added a fixup entry matching with the vendor id 0x106b.
This broke the fixups for previous MBA6,1 and 6,2, since the PCI SSID
vendor id matches before evaluating the codec SSIDs.

We had a similar issue on Mac with Sigmatel codecs, and solve this
problem again similarly, by introducing a skeleton entry matching with
the all MacBooks, then remap to the right one.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=64401
Fixes: 8fe7b65a ('ALSA: hda - Apply GPIO setup for MacBooks with CS4208')
Cc: <stable@vger.kernel.org> [v3.12+]
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 38070219
...@@ -597,6 +597,7 @@ static int patch_cs420x(struct hda_codec *codec) ...@@ -597,6 +597,7 @@ static int patch_cs420x(struct hda_codec *codec)
* Its layout is no longer compatible with CS4206/CS4207 * Its layout is no longer compatible with CS4206/CS4207
*/ */
enum { enum {
CS4208_MAC_AUTO,
CS4208_MBA6, CS4208_MBA6,
CS4208_GPIO0, CS4208_GPIO0,
}; };
...@@ -608,10 +609,14 @@ static const struct hda_model_fixup cs4208_models[] = { ...@@ -608,10 +609,14 @@ static const struct hda_model_fixup cs4208_models[] = {
}; };
static const struct snd_pci_quirk cs4208_fixup_tbl[] = { static const struct snd_pci_quirk cs4208_fixup_tbl[] = {
/* codec SSID */ SND_PCI_QUIRK_VENDOR(0x106b, "Apple", CS4208_MAC_AUTO),
{} /* terminator */
};
/* codec SSID matching */
static const struct snd_pci_quirk cs4208_mac_fixup_tbl[] = {
SND_PCI_QUIRK(0x106b, 0x7100, "MacBookAir 6,1", CS4208_MBA6), SND_PCI_QUIRK(0x106b, 0x7100, "MacBookAir 6,1", CS4208_MBA6),
SND_PCI_QUIRK(0x106b, 0x7200, "MacBookAir 6,2", CS4208_MBA6), SND_PCI_QUIRK(0x106b, 0x7200, "MacBookAir 6,2", CS4208_MBA6),
SND_PCI_QUIRK_VENDOR(0x106b, "Apple", CS4208_GPIO0),
{} /* terminator */ {} /* terminator */
}; };
...@@ -627,6 +632,20 @@ static void cs4208_fixup_gpio0(struct hda_codec *codec, ...@@ -627,6 +632,20 @@ static void cs4208_fixup_gpio0(struct hda_codec *codec,
} }
} }
static const struct hda_fixup cs4208_fixups[];
/* remap the fixup from codec SSID and apply it */
static void cs4208_fixup_mac(struct hda_codec *codec,
const struct hda_fixup *fix, int action)
{
if (action != HDA_FIXUP_ACT_PRE_PROBE)
return;
snd_hda_pick_fixup(codec, NULL, cs4208_mac_fixup_tbl, cs4208_fixups);
if (codec->fixup_id < 0 || codec->fixup_id == CS4208_MAC_AUTO)
codec->fixup_id = CS4208_GPIO0; /* default fixup */
snd_hda_apply_fixup(codec, action);
}
static const struct hda_fixup cs4208_fixups[] = { static const struct hda_fixup cs4208_fixups[] = {
[CS4208_MBA6] = { [CS4208_MBA6] = {
.type = HDA_FIXUP_PINS, .type = HDA_FIXUP_PINS,
...@@ -638,6 +657,10 @@ static const struct hda_fixup cs4208_fixups[] = { ...@@ -638,6 +657,10 @@ static const struct hda_fixup cs4208_fixups[] = {
.type = HDA_FIXUP_FUNC, .type = HDA_FIXUP_FUNC,
.v.func = cs4208_fixup_gpio0, .v.func = cs4208_fixup_gpio0,
}, },
[CS4208_MAC_AUTO] = {
.type = HDA_FIXUP_FUNC,
.v.func = cs4208_fixup_mac,
},
}; };
/* correct the 0dB offset of input pins */ /* correct the 0dB offset of input pins */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment