Message ID | 0973174b-bd33-0a3c-bc12-d37ef61dc743@fbihome.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Tue, 13 Feb 2018 16:05:38 +0100, Jan-Marek Glogowski wrote: > > Am 13.02.2018 um 15:48 schrieb Takashi Iwai: > > On Tue, 13 Feb 2018 15:21:48 +0100, > > Jan-Marek Glogowski wrote: > >> > >> Am 13.02.2018 um 12:11 schrieb Takashi Iwai: > >>> The driver doesn't check any difference of the position for > >>> identifying the jack detection capability, so you can apply the same > >>> quirk to both models. Then I prefer putting with SND_PCI_QUIRK(). > >> > >> So the patch is implemented in the spirit of what I actually did when analysing an fixing the bug via hdajackretask. Instead of fixed numbers, it takes the original headphone pin, changes the device to microphone and updates the mics' pin config. > > > > The new patch looks better, but could you try to address warnings by > > checkpatch.pl? The 80-chars warning for SND_PCI_QUIRK() line can be > > ignored. > > Not sure if I should include the first hunk, but when I implemented my function I assumed the long function parameter list was ok, seeing alc269_fixup_pincfg_no_hp_to_lineout. The change in the first hunk can be dropped. It's an irrelevant change. > > @@ -3465,6 +3466,20 @@ static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec, > spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP; > } > > +static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec, > + const struct hda_fixup *fix, > + int action) > +{ > + unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21); > + unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19); > + > + if (cfg_headphone && cfg_headset_mic == 0x411111f0) > + // same config, but a mic instead of a headphone Avoid C++ style comment. > + snd_hda_codec_set_pincfg > + (codec, 0x19, (cfg_headphone & ~AC_DEFCFG_DEVICE) > + + (AC_JACK_MIC_IN << AC_DEFCFG_DEVICE_SHIFT)); I'd put the parenthesis adjacent to the function name. Also, better to use '|' instead of '+' for bit operations. snd_hda_codec_set_pincfg(codec, 0x19, (cfg_headphone & ~AC_DEFCFG_DEVICE) | (AC_JACK_MIC_IN << AC_DEFCFG_DEVICE_SHIFT)); thanks, Takashi
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 2347588..fc87d32 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -3457,7 +3457,8 @@ static int alc269_resume(struct hda_codec *codec) #endif /* CONFIG_PM */ static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec, - const struct hda_fixup *fix, int action) + const struct hda_fixup *fix, + int action) { struct alc_spec *spec = codec->spec; @@ -3465,6 +3466,20 @@ static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec, spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP; } +static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec, + const struct hda_fixup *fix, + int action) +{ + unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21); + unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19); + + if (cfg_headphone && cfg_headset_mic == 0x411111f0) + // same config, but a mic instead of a headphone + snd_hda_codec_set_pincfg + (codec, 0x19, (cfg_headphone & ~AC_DEFCFG_DEVICE) + + (AC_JACK_MIC_IN << AC_DEFCFG_DEVICE_SHIFT)); +} + static void alc269_fixup_hweq(struct hda_codec *codec, const struct hda_fixup *fix, int action) { @@ -5351,6 +5366,7 @@ enum { ALC269_FIXUP_LIFEBOOK_EXTMIC, ALC269_FIXUP_LIFEBOOK_HP_PIN, ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT, + ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC, ALC269_FIXUP_AMIC, ALC269_FIXUP_DMIC, ALC269VB_FIXUP_AMIC, @@ -5556,6 +5572,10 @@ static const struct hda_fixup alc269_fixups[] = { .type = HDA_FIXUP_FUNC, .v.func = alc269_fixup_pincfg_no_hp_to_lineout, }, + [ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC] = { + .type = HDA_FIXUP_FUNC, + .v.func = alc269_fixup_pincfg_U7x7_headset_mic, + }, [ALC269_FIXUP_AMIC] = { .type = HDA_FIXUP_PINS, .v.pins = (const struct hda_pintbl[]) { @@ -6422,6 +6442,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT), SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN), SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN), + SND_PCI_QUIRK(0x10cf, 0x1629, "Lifebook U7x7", ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC), SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC), SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE), SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),