Patch For Lenovo Legion 7 15IMHg05 & Yoga 7 14ITL5
Takashi Iwai
tiwai at suse.de
Thu Jul 8 12:01:56 CEST 2021
On Thu, 08 Jul 2021 02:16:49 +0200,
Cameron Berkenpas wrote:
>
> Hello,
>
> I have a patch against 5.12.x that results in working speaker audio
> for the Lenovo Legion 7 15IMHg05 and the Lenovo Yoga 7 14ITL5.
>
> How should I go about getting this merged? Should this be against the
> latest torvalds git? Is this the right place to present this
> particular patch? There are no issues checking my changes against
> checkpatch.pl.
The patch needs to be arranged in a proper format and submitted to
alsa-devel ML (and Cc to me). It needs a description (what this patch
fixes and how), references to the information sources, and most
importantly, your signed-off-by line. Please refer to
Documentation/process/submitting-patches.rst for details.
As the size of the COEF table is relatively small, you can just put
all stuff into patch_realtek.c. Also, the verb { 0x20, 0x4b0, 0x20 }
is equivalent with { 0x20, AC_VERB_SET_COEF, 0xb020 }. Better to
replace in that form.
thanks,
Takashi
>
> Thanks!
>
> diff --git a/sound/pci/hda/legion_15imhg05_helper.c b/sound/pci/hda/legion_15imhg05_helper.c
> new file mode 100644
> index 000000000000..6ead999ec3c9
> --- /dev/null
> +++ b/sound/pci/hda/legion_15imhg05_helper.c
> @@ -0,0 +1,41 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/* Fixes for Lenovo Legion 15IMHg05 speaker output. */
> +
> +static const struct hda_verb legion_15imhg05_coefs[] = {
> +{0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
> +{0x20, AC_VERB_SET_PROC_COEF, 0x41 },
> +{0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
> +{0x20, AC_VERB_SET_PROC_COEF, 0x2 },
> +{0x20, AC_VERB_SET_PROC_COEF, 0x0 },
> +{0x20, AC_VERB_SET_PROC_COEF, 0x0 },
> +{0x20, 0x4b0, 0x20 },
> +
> +// Set right speaker for Legion 7i.
> +{0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
> +{0x20, AC_VERB_SET_PROC_COEF, 0x42 },
> +
> +{0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
> +{0x20, AC_VERB_SET_PROC_COEF, 0xc },
> +{0x20, AC_VERB_SET_PROC_COEF, 0x0 },
> +{0x20, AC_VERB_SET_PROC_COEF, 0x2a },
> +{0x20, 0x4b0, 0x20 },
> +{0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
> +{0x20, AC_VERB_SET_PROC_COEF, 0x2 },
> +{0x20, AC_VERB_SET_PROC_COEF, 0x0 },
> +{0x20, AC_VERB_SET_PROC_COEF, 0x0 },
> +{0x20, 0x4b0, 0x20 },
> +{}
> +};
> +
> +static void alc287_fixup_legion_15imhg05_speakers(struct hda_codec *codec,
> + const struct hda_fixup *fix,
> + int action)
> +{
> + struct alc_spec *spec = codec->spec;
> +
> + switch (action) {
> + case HDA_FIXUP_ACT_INIT:
> + spec->gen.automute_speaker = 0;
> + break;
> + }
> +}
> diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
> index e46e43dac6bf..28a4955cf2c2 100644
> --- a/sound/pci/hda/patch_realtek.c
> +++ b/sound/pci/hda/patch_realtek.c
> @@ -6352,6 +6352,12 @@ static void alc_fixup_thinkpad_acpi(struct hda_codec *codec,
> /* for alc285_fixup_ideapad_s740_coef() */
> #include "ideapad_s740_helper.c"
> +/* For alc287_fixup_legion_15imhg05_speakers() */
> +#include "legion_15imhg05_helper.c"
> +
> +/* For yoga7_14itl5_coefs */
> +#include "yoga7_14itl5_coefs.c"
> +
> enum {
> ALC269_FIXUP_GPIO2,
> ALC269_FIXUP_SONY_VAIO,
> @@ -6561,6 +6567,9 @@ enum {
> ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP,
> ALC623_FIXUP_LENOVO_THINKSTATION_P340,
> ALC255_FIXUP_ACER_HEADPHONE_AND_MIC,
> + ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS,
> + ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
> + ALC287_FIXUP_YOGA7_14ITL_SPEAKERS,
> };
> static const struct hda_fixup alc269_fixups[] = {
> @@ -8088,6 +8097,24 @@ static const struct hda_fixup alc269_fixups[] = {
> .chained = true,
> .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
> },
> + [ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS] = {
> + .type = HDA_FIXUP_VERBS,
> + .v.verbs = legion_15imhg05_coefs,
> + .chained = true,
> + .chain_id = ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
> + },
> + [ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE] = {
> + .type = HDA_FIXUP_FUNC,
> + .v.func = alc287_fixup_legion_15imhg05_speakers,
> + .chained = true,
> + .chain_id = ALC269_FIXUP_HEADSET_MODE,
> + },
> + [ALC287_FIXUP_YOGA7_14ITL_SPEAKERS] = {
> + .type = HDA_FIXUP_VERBS,
> + .v.verbs = yoga7_14itl5_coefs,
> + .chained = true,
> + .chain_id = ALC269_FIXUP_HEADSET_MODE,
> + },
> [ALC295_FIXUP_ASUS_DACS] = {
> .type = HDA_FIXUP_FUNC,
> .v.func = alc295_fixup_asus_dacs,
> @@ -8520,6 +8547,8 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
> SND_PCI_QUIRK(0x17aa, 0x3818, "Lenovo C940", ALC298_FIXUP_LENOVO_SPK_VOLUME),
> SND_PCI_QUIRK(0x17aa, 0x3827, "Ideapad S740", ALC285_FIXUP_IDEAPAD_S740_COEF),
> SND_PCI_QUIRK(0x17aa, 0x3843, "Yoga 9i", ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP),
> + SND_PCI_QUIRK(0x17aa, 0x3813, "Lenovo Legion 7", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
> + SND_PCI_QUIRK(0x17aa, 0x3852, "Lenovo Yoga 7 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
> SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
> SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
> SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
> diff --git a/sound/pci/hda/yoga7_14itl5_coefs.c b/sound/pci/hda/yoga7_14itl5_coefs.c
> new file mode 100644
> index 000000000000..a437fe042a1d
> --- /dev/null
> +++ b/sound/pci/hda/yoga7_14itl5_coefs.c
> @@ -0,0 +1,29 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/* Fixes for Lenovo Yoga 7 14ITL5 speaker output. */
> +
> +static const struct hda_verb yoga7_14itl5_coefs[] = {
> +{0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
> +{0x20, AC_VERB_SET_PROC_COEF, 0x41 },
> +{0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
> +{0x20, AC_VERB_SET_PROC_COEF, 0x2 },
> +{0x20, AC_VERB_SET_PROC_COEF, 0x0 },
> +{0x20, AC_VERB_SET_PROC_COEF, 0x0 },
> +{0x20, 0x4b0, 0x20 },
> +
> +// set right speaker Yoga 7i.
> +{0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
> +{0x20, AC_VERB_SET_PROC_COEF, 0x46 },
> +
> +{0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
> +{0x20, AC_VERB_SET_PROC_COEF, 0xc },
> +{0x20, AC_VERB_SET_PROC_COEF, 0x0 },
> +{0x20, AC_VERB_SET_PROC_COEF, 0x2a },
> +{0x20, 0x4b0, 0x20 },
> +{0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
> +{0x20, AC_VERB_SET_PROC_COEF, 0x2 },
> +{0x20, AC_VERB_SET_PROC_COEF, 0x0 },
> +{0x20, AC_VERB_SET_PROC_COEF, 0x0 },
> +{0x20, 0x4b0, 0x20 },
> +{}
> +};
> +
>
>
More information about the Alsa-devel
mailing list