From nobody Tue Oct 7 17:46:31 2025 Received: from n169-114.mail.139.com (n169-114.mail.139.com [120.232.169.114]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0CC2179CF; Tue, 8 Jul 2025 09:44:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=120.232.169.114 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751967897; cv=none; b=jYY0aOhasaI02w4tngkekY3tG5TA2TofcRdMCVwD8PkAKgYEl09U9g5G2NvgPH4OMk1hYkzyDwhF/1eFmJTxHbL1tFwxnwJRuimyE9fB4PJPnv8HYlbsa9myDmC2tjxkIjfSBKGlZjYKoU/UrQ4guMsAxbPN3RcTx3Utpn8AmKY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751967897; c=relaxed/simple; bh=rjoGb4QYUa8g4YTR1lLJbpA0zCVoViTj52sglYfLdYo=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=IJEkue5xySAkSCYY8t7f5h08hw/NcGraLxG05dy28ewGDQItL9jFWFzseMk5LTHYBa2ukylinchqyv7abEFJxIJXDnp+8b4wIUfY8meLJL803xji+iQQjyfvUTCItL70fjgp1xVDTEWHmHJdCjsPswgXY/YU+BgujxhJy5VX/00= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=139.com; spf=pass smtp.mailfrom=139.com; arc=none smtp.client-ip=120.232.169.114 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=139.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=139.com X-RM-TagInfo: emlType=0 X-RM-SPAM: X-RM-SPAM-FLAG: 00000000 Received: from yoga-Lenovo-Slim-Pro-7-14APH8.lenovo.com (unknown[106.38.209.7]) by rmsmtp-lg-appmail-42-12056 (RichMail) with SMTP id 2f18686ce88523b-b9f71; Tue, 08 Jul 2025 17:44:48 +0800 (CST) X-RM-TRANSID: 2f18686ce88523b-b9f71 From: Jackie Dong To: hansg@kernel.org, ilpo.jarvinen@linux.intel.com Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, dongeg1@lenovo.com, Jackie Dong Subject: [PATCH v3] lenovo-wmi-hotkey: Fixed a kernel error report for some Lenovo non-ThinkPad devices Date: Tue, 8 Jul 2025 17:43:05 +0800 Message-ID: <20250708094352.26850-1-xy-jackie@139.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Not all of Lenovo non-ThinkPad devices support both mic mute LED (on F4) and audio mute LED (on F1). Some of them only support one mute LED, some of them don't have any mute LED. Add a decision to judge this device support mute LED or not. Without this decision, not support both of mic mute LED and audio mute LED Lenovo non-ThinkPad brand devices (including Ideapad/Yoga/Xiaoxin/Gaming/ThinkBook, etc.) will report a failed message with error -5. Signed-off-by: Jackie Dong Suggested-by: Hans de Goede Reviewed-by: Ilpo J=C3=A4rvinen --- Changes in v3: - Reverse orignal logic (obj && obj->type =3D=3D ACPI_TYPE_INTEGER)=20 and add new decision for led_version =3D=3D 0. - Optimize the descriptions based on reviewer comments. Changes in v2: - Add warning message and then return 0 if the device support mute LED abnormaly, based on Hans suggestion and Armin previous patch. .../x86/lenovo-wmi-hotkey-utilities.c | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/drivers/platform/x86/lenovo-wmi-hotkey-utilities.c b/drivers/p= latform/x86/lenovo-wmi-hotkey-utilities.c index 89153afd7015..1850992f2ea8 100644 --- a/drivers/platform/x86/lenovo-wmi-hotkey-utilities.c +++ b/drivers/platform/x86/lenovo-wmi-hotkey-utilities.c @@ -127,21 +127,30 @@ static int lenovo_super_hotkey_wmi_led_init(enum mute= _led_type led_type, struct else return -EIO; =20 - wpriv->cdev[led_type].max_brightness =3D LED_ON; - wpriv->cdev[led_type].flags =3D LED_CORE_SUSPENDRESUME; + /* + * Output parameters define: 0 means mute LED is not supported, Non-zero = means + * mute LED can be supported. + */ + if (led_version =3D=3D 0) + return 0; + =20 switch (led_type) { case MIC_MUTE: - if (led_version !=3D WMI_LUD_SUPPORT_MICMUTE_LED_VER) - return -EIO; + if (led_version !=3D WMI_LUD_SUPPORT_MICMUTE_LED_VER) { + pr_warn("The MIC_MUTE LED of this device isn't supported now.\n"); + return 0; + } =20 wpriv->cdev[led_type].name =3D "platform::micmute"; wpriv->cdev[led_type].brightness_set_blocking =3D &lsh_wmi_micmute_led_s= et; wpriv->cdev[led_type].default_trigger =3D "audio-micmute"; break; case AUDIO_MUTE: - if (led_version !=3D WMI_LUD_SUPPORT_AUDIOMUTE_LED_VER) - return -EIO; + if (led_version !=3D WMI_LUD_SUPPORT_AUDIOMUTE_LED_VER) { + pr_warn("The AUDIO_MUTE LED of this device isn't supported now.\n"); + return 0; + } =20 wpriv->cdev[led_type].name =3D "platform::mute"; wpriv->cdev[led_type].brightness_set_blocking =3D &lsh_wmi_audiomute_led= _set; @@ -152,6 +161,9 @@ static int lenovo_super_hotkey_wmi_led_init(enum mute_l= ed_type led_type, struct return -EINVAL; } =20 + wpriv->cdev[led_type].max_brightness =3D LED_ON; + wpriv->cdev[led_type].flags =3D LED_CORE_SUSPENDRESUME; + err =3D devm_led_classdev_register(dev, &wpriv->cdev[led_type]); if (err < 0) { dev_err(dev, "Could not register mute LED %d : %d\n", led_type, err); --=20 2.43.0