public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: "José Guilherme de Castro Rodrigues" <jose.guilherme.cr.bh@gmail.com>
Cc: Corentin Chary <corentin.chary@gmail.com>,
	 "Luke D. Jones" <luke@ljones.dev>,
	Denis Benato <denis.benato@linux.dev>,
	 Hans de Goede <hansg@kernel.org>,
	platform-driver-x86@vger.kernel.org,
	 LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] platform/x86: asus-wmi: fix camera key led on Zenbook S14
Date: Wed, 6 May 2026 16:18:39 +0300 (EEST)	[thread overview]
Message-ID: <cd3fc0ef-c15a-8f41-9162-c042daa44969@linux.intel.com> (raw)
In-Reply-To: <afFAvIbAS6ue3ZaF@djouze-zen>

[-- Attachment #1: Type: text/plain, Size: 2658 bytes --]

On Tue, 28 Apr 2026, José Guilherme de Castro Rodrigues wrote:

> Thanks for the comment, Ilpo.
> 
> On Tue, Apr 28, 2026 at 11:22:20AM +0300, Ilpo Järvinen wrote:
> > While I believe you are "correct" that userspace won't see a thing, is 
> > this really correct way to implement support for this device?
> 
> At first, I created another sysfs attribute that basically duplicated
> the logic that is used for the "asus::camera" attribute, with the
> exception being the value that was written to it, of course. I noticed,
> however, that calling asus_wmi_set_devstate() had not effect on the LED
> state. The LED only toggled when I read the attribute, which then called
> asus_wmi_get_devstate().
> 
> I don't know if this is a quirk for this device, or if all devices that
> expose ASUS_WMI_DEVID_CAMERA_LED_NEG behave the same, but the LED is not
> toggled until I call asus_wmi_get_devstate() - be it when detecting a
> key press (hardware change) or after the sysfs attribute is written to
> (software change).
> 
> Since in this case the LED state would not change after a write to the
> sysfs attribute, I went in the "do not make it visible to userspace at
> all" direction.
> 
> > I mean the camera led init in asus_wmi_led_init() is gated by 
> > asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_CAMERA_LED) but should that 
> > be gated by either CAMERA_LED or CAMERA_LED_NEG and the related code in 
> > *_camera_led_*() that now only uses ASUS_WMI_DEVID_CAMERA_LED 
> > should use which ever of them is available?
> 
> Yes, I think what you said makes sense as it would give userspace access
> to the resource without creating a new attribute.
> 
> In this case, I feel like a good option would be to gate the camera led
> initialization by both IDs, and assume that the write and read works as
> they probably should for CAMERA_LED_NEG. Then, somehow add a quirk for
> this specific device that performs a read when the key is pressed, and 
> right after the sysfs attribute is written to. If we can confirm that
> this behavior is expected when writing to CAMERA_LED_NEG, it might not
> need to be a quirk. Unfortunately, I am not able to try this on other
> devices.
> 
> What do you think about it?

So if I understood you correctly with LED_NEG (unknown if it's just on 
your device or generally with it),

This doesn't work: set
This works: set+get

The extra get shouldn't be that harmful so doing that always if 
CAMERA_LED_NEG is being used is okay at least with me (make sure to add 
add a comment though so it can be known later why it's there even 10 
years from now).

-- 
 i.

  reply	other threads:[~2026-05-06 13:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-09 23:45 [PATCH v2] platform/x86: asus-wmi: fix camera key led on Zenbook S14 José Guilherme de Castro Rodrigues
2026-04-28  8:22 ` Ilpo Järvinen
2026-04-28 23:20   ` José Guilherme de Castro Rodrigues
2026-05-06 13:18     ` Ilpo Järvinen [this message]
2026-05-06 22:29       ` José Guilherme de Castro Rodrigues

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=cd3fc0ef-c15a-8f41-9162-c042daa44969@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=corentin.chary@gmail.com \
    --cc=denis.benato@linux.dev \
    --cc=hansg@kernel.org \
    --cc=jose.guilherme.cr.bh@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luke@ljones.dev \
    --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