mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Julian Haarmann <julian.haarmann@student.kit.edu>
Cc: Mark Pearson <mpearson-lenovo@squebb.ca>,
	 "Derek J . Clark" <derekjohn.clark@gmail.com>,
	 Hans de Goede <hansg@kernel.org>,
	platform-driver-x86@vger.kernel.org,
	 LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] platform/x86: lenovo/ymc: Only match lower byte in WMI lid switch response
Date: Mon, 8 Jun 2026 15:55:41 +0300 (EEST)	[thread overview]
Message-ID: <17d6f718-6653-a42d-5d12-d21c19874936@linux.intel.com> (raw)
In-Reply-To: <20260531204937.62049-1-julian.haarmann@student.kit.edu>

On Sun, 31 May 2026, Julian Haarmann wrote:

> On newer Lenovo Yoga devices like the "Yoga 9 2-in-1 14IPH11 - Type 83SE",
> the hinge switch WMI query returns extra data in the upper bits
> (e.g. 0x50001 laptop mode, 0x50002 tablet mode, ect.).
> 
> The driver previously checked for exact matches (0x01 laptop, 0x02 tablet,
> ect.) causing newer switches to not work.
> 
> Mask the WMI query result to only match the lower byte and ignore upper
> bits.
> 
> Signed-off-by: Julian Haarmann <julian.haarmann@student.kit.edu>
> ---
> 
> Hi everyone,
> 
> I just recieved this laptop and am trying to get it to work.
> FYI: To get tablet mode to work fully you might need to extract the
> Intel ISH firmware from the Windows driver.
> This is my first patch, so I hope the way I've solved this is up to
> standard.
> 
>  drivers/platform/x86/lenovo/ymc.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/platform/x86/lenovo/ymc.c b/drivers/platform/x86/lenovo/ymc.c
> index 1b73a55f1b89..ffeca452b392 100644
> --- a/drivers/platform/x86/lenovo/ymc.c
> +++ b/drivers/platform/x86/lenovo/ymc.c
> @@ -87,6 +87,9 @@ static void lenovo_ymc_notify(struct wmi_device *wdev, union acpi_object *data)
>  	}
>  	code = obj->integer.value;
>  
> +	/* strip upper bits (e.g. 0x50000) on newer devices */
> +	code &= 0xFF;

Thanks for the patch.

As it looks like there are now multiple fields in the value, it is better 
to add a define with GENMASK() and use FIELD_GET() to extract the field.

Please also remember to add bits.h and bitfield.h includes when using 
those macros.

-- 
 i.


      reply	other threads:[~2026-06-08 12:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-31 20:49 Julian Haarmann
2026-06-08 12:55 ` Ilpo Järvinen [this message]

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=17d6f718-6653-a42d-5d12-d21c19874936@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=derekjohn.clark@gmail.com \
    --cc=hansg@kernel.org \
    --cc=julian.haarmann@student.kit.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpearson-lenovo@squebb.ca \
    --cc=platform-driver-x86@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®