public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Jackie EG1 Dong <dongeg1@lenovo.com>
Cc: Takashi Iwai <tiwai@suse.de>, Jackie Dong <xy-jackie@139.com>,
	"perex@perex.cz" <perex@perex.cz>,
	"tiwai@suse.com" <tiwai@suse.com>,
	"bo.liu@senarytech.com" <bo.liu@senarytech.com>,
	"kovalev@altlinux.org" <kovalev@altlinux.org>,
	"me@oldherl.one" <me@oldherl.one>,
	"jaroslaw.janik@gmail.com" <jaroslaw.janik@gmail.com>,
	"songxiebing@kylinos.cn" <songxiebing@kylinos.cn>,
	"kailang@realtek.com" <kailang@realtek.com>,
	"sbinding@opensource.cirrus.com" <sbinding@opensource.cirrus.com>,
	"simont@opensource.cirrus.com" <simont@opensource.cirrus.com>,
	"josh@joshuagrisham.com" <josh@joshuagrisham.com>,
	"rf@opensource.cirrus.com" <rf@opensource.cirrus.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"platform-driver-x86@vger.kernel.org"
	<platform-driver-x86@vger.kernel.org>,
	"linux-sound@vger.kernel.org" <linux-sound@vger.kernel.org>,
	"mpearson-lenovo@squebb.ca" <mpearson-lenovo@squebb.ca>
Subject: Re: [External] Re: [PATCH v2] ALSA: hda: Support for Ideapad hotkey mute LEDs
Date: Fri, 03 Jan 2025 16:17:32 +0100	[thread overview]
Message-ID: <87o70oylir.wl-tiwai@suse.de> (raw)
In-Reply-To: <SEYPR03MB8067D30F466738C51808461995092@SEYPR03MB8067.apcprd03.prod.outlook.com>

On Mon, 30 Dec 2024 01:33:01 +0100,
Jackie EG1 Dong wrote:
> 
> > On Tue, 24 Dec 2024 09:33:16 +0100,
>  > Jackie Dong wrote:
>  >>
>  >> --- a/sound/pci/hda/patch_realtek.c
>  >> +++ b/sound/pci/hda/patch_realtek.c
>  >> @@ -6934,6 +6934,16 @@ static void alc_fixup_thinkpad_acpi(struct hda_codec *codec,
>  >>   	hda_fixup_thinkpad_acpi(codec, fix, action);
>  >>   }
>  >>
>  >> +/* for hda_fixup_ideapad_acpi() */
>  >> +#include "ideapad_hotkey_led_helper.c"
>  >> +
>  >> +static void alc_fixup_ideapad_acpi(struct hda_codec *codec,
>  >> +				   const struct hda_fixup *fix, int action)
>  >> +{
>  >> +	alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */
>  >> +	hda_fixup_ideapad_acpi(codec, fix, action);
>  >> +}
>  >
>  > So this unconditionally call alc_fixup_no_shutup(), and this  > introduces another behavior to the existing entry -- i.e. there is a  > chance of breakage.
>  >
>  > If we want to be very conservative, this call should be limited to  > Ideapad.
>  > For alc_fixup_no_shutup(codec, fix, action),
>  I want to keep same behavior with alc_fixup_thinkpad_apci() and alc_fixup_idea_acpi() for one sound card. So, I add alc_fixup_no_shutup() in alc_fixup_ideapad_acpi().
> ----------Related source code of patch_reatek.c are FYR as below.
> static void alc_fixup_thinkpad_acpi(struct hda_codec *codec,
>                                      const struct hda_fixup *fix, int
> action)
> {
>          alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */
>          hda_fixup_thinkpad_acpi(codec, fix, action); }
> 
> /* for hda_fixup_ideapad_acpi() */
> #include "ideapad_hotkey_led_helper.c"
> 
> static void alc_fixup_ideapad_acpi(struct hda_codec *codec,
>                                     const struct hda_fixup *fix, int action) {
>          alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */
>          hda_fixup_ideapad_acpi(codec, fix, action);
> }

Oh yeah, but then it can be bad in other way round; the chain call of
alc_fixup_thinkpad_acpi() contains alc_fixup_no_shutup() and the
alc_fixup_ideadpad_acpi() also contains alc_fixup_no_shutup().
That is, alc_fixup_no_shutup() will be called twice for Thinkpad.

Instead, you can change like:

--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -6925,11 +6925,16 @@ static void alc285_fixup_hp_envy_x360(struct hda_codec *codec,
 /* for hda_fixup_thinkpad_acpi() */
 #include "thinkpad_helper.c"
 
-static void alc_fixup_thinkpad_acpi(struct hda_codec *codec,
-				    const struct hda_fixup *fix, int action)
+/* for hda_fixup_ideapad_acpi() */
+#include "ideapad_hotkey_led_helper.c"
+
+/* generic fixup for both Lenovo Thinkpad and Ideapad */
+static void alc_fixup_xpad_acpi(struct hda_codec *codec,
+				const struct hda_fixup *fix, int action)
 {
 	alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */
 	hda_fixup_thinkpad_acpi(codec, fix, action);
+	hda_fixup_ideapad_acpi(codec, fix, action);
 }
 
 /* Fixup for Lenovo Legion 15IMHg05 speaker output on headset removal. */
@@ -8321,7 +8326,7 @@ static const struct hda_fixup alc269_fixups[] = {
 	},
 	[ALC269_FIXUP_THINKPAD_ACPI] = {
 		.type = HDA_FIXUP_FUNC,
-		.v.func = alc_fixup_thinkpad_acpi,
+		.v.func = alc_fixup_xpad_acpi,
 		.chained = true,
 		.chain_id = ALC269_FIXUP_SKU_IGNORE,
 	},

Since hda_fixup_ideapad_acpi() is NOP except for Ideapad, this
shouldn't break other models, while it covers the Ideadpad now.


thanks,

Takashi

  reply	other threads:[~2025-01-03 15:17 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-24  8:33 [PATCH v2] ALSA: hda: Support for Ideapad hotkey mute LEDs Jackie Dong
2024-12-29  9:04 ` Takashi Iwai
2024-12-30  0:33   ` [External] " Jackie EG1 Dong
2025-01-03 15:17     ` Takashi Iwai [this message]
2025-01-06 12:49       ` Jackie Dong
2025-01-14  6:54         ` [External] Re: [PATCH v2] ALSA: hda: Support for Ideapad hotkeymute LEDs Jackie Dong
2025-01-14  7:19           ` Takashi Iwai
2025-01-14  8:28             ` Takashi Iwai
2025-01-14 15:47               ` Jackie Dong
2025-01-15 16:06                 ` Jackie Dong

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=87o70oylir.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=bo.liu@senarytech.com \
    --cc=dongeg1@lenovo.com \
    --cc=jaroslaw.janik@gmail.com \
    --cc=josh@joshuagrisham.com \
    --cc=kailang@realtek.com \
    --cc=kovalev@altlinux.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=me@oldherl.one \
    --cc=mpearson-lenovo@squebb.ca \
    --cc=perex@perex.cz \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=rf@opensource.cirrus.com \
    --cc=sbinding@opensource.cirrus.com \
    --cc=simont@opensource.cirrus.com \
    --cc=songxiebing@kylinos.cn \
    --cc=tiwai@suse.com \
    --cc=xy-jackie@139.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox