All of lore.kernel.org
 help / color / mirror / Atom feed
From: "José Guilherme de Castro Rodrigues" <jose.guilherme.cr.bh@gmail.com>
To: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.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: Tue, 28 Apr 2026 20:20:28 -0300	[thread overview]
Message-ID: <afFAvIbAS6ue3ZaF@djouze-zen> (raw)
In-Reply-To: <ce2a2f37-ad8a-647c-0db8-83f6efd99f12@linux.intel.com>

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?

Best regards,
José Rodrigues

  reply	other threads:[~2026-04-28 23:20 UTC|newest]

Thread overview: 6+ 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 [this message]
2026-05-06 13:18     ` Ilpo Järvinen
2026-05-06 22:29       ` José Guilherme de Castro Rodrigues
2026-05-11  0:25         ` 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=afFAvIbAS6ue3ZaF@djouze-zen \
    --to=jose.guilherme.cr.bh@gmail.com \
    --cc=corentin.chary@gmail.com \
    --cc=denis.benato@linux.dev \
    --cc=hansg@kernel.org \
    --cc=ilpo.jarvinen@linux.intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.