From: "Leo L. Schwab" <ewhac@ewhac.org>
To: Hans de Goede <hansg@kernel.org>
Cc: Kate Hsuan <hpa@redhat.com>, Jiri Kosina <jikos@kernel.org>,
Benjamin Tissoires <bentiss@kernel.org>,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] HID: lg-g15 - Add support for Logitech G13.
Date: Wed, 17 Sep 2025 12:50:05 -0700 [thread overview]
Message-ID: <aMsQ7dBJrwpWbdJk@ewhac.org> (raw)
In-Reply-To: <8e2c3560-6cba-4808-8207-ba3e1dd0e661@kernel.org>
On Wed, Sep 17, 2025 at 12:33:36PM +0200, Hans de Goede wrote:
> On 16-Sep-25 00:18, Leo L. Schwab wrote:
> > What do you want to happen to `brightness_hw_changed` when
> > `brightness` is changed in sysfs while the backlight is on? As it stands,
> > the current behavior is:
> > * Driver loads and probes; `brightness` and `brightness_hw_changed`
> > both set to 255.
>
> Ack, except that as mentioned above I would not touch brightness_hw_changed
> and just leave it at -1.
>
> > * sysfs `brightness` changed to 128. `brightness_hw_changed`
> > remains at 255.
> > * Toggle backilght off. `brightness_hw_changed` changed to 0.
> > `brightness` remains at 128.
> > * Toggle backlight back on. `brightness_hw_changed` gets a copy of
> > `brightness`, and both are now 128.
>
> Ack this is all correct.
>
...Oy.
Okay, I can give you that.
> > This seems inconsistent to me.
>
> This is working as intended / how the API was designed as
> Documentation/ABI/testing/sysfs-class-led says:
>
> Reading this file will return the last brightness level set
> by the hardware, this may be different from the current
> brightness. Reading this file when no hw brightness change
> event has happened will return an ENODATA error.
>
First: Why isn't this mentioned in Documentation/leds/leds_class.rst?
And second: This doesn't really clarify anything. That paragraph
may be legitimately interpreted to mean that `brightness_hw_changed` is
completely independent of `brightness`, as it was in my original
implementation.
> > Hence my earlier suggestion that
> > `brightness_hw_changed` should track all changes to `brightness`, except
> > when the backlight is toggled off.
>
> Then it also would be reporting values coming from sysfs writes,
> which it explicitly should not do.
>
Okay, fair, but having `brightness_hw_changed` read as 255, then
later as 128 after hitting the toggle button a couple of times strikes me as
inconsistent behavior.
> Summarizing in my view the following changes are necessary on v4:
>
> 1. Add backlight_disabled (or backlight_enabled) flag to struct lg_g15_data
> 2. Init that flag from prope()
> 3. Use that flag on receiving input reports to see if notify()
> should be called
> 4. Replace the LED_FULL passed to notify() (for off->on)
> with g15_led->brightness
>
Will do; will post v6 shortly. And someone should update the docs
describing the expected interaction between `brightness` and
`brightness_hw_changed`.
Schwab
prev parent reply other threads:[~2025-09-17 19:50 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-14 21:26 [PATCH v3] HID: lg-g15 - Add support for Logitech G13 Leo L. Schwab
2025-08-31 13:01 ` Hans de Goede
2025-08-31 19:51 ` Leo L. Schwab
2025-09-02 9:07 ` Hans de Goede
2025-09-02 9:14 ` Hans de Goede
2025-09-02 20:41 ` Leo L. Schwab
2025-09-02 21:05 ` Hans de Goede
2025-09-03 19:39 ` Leo L. Schwab
2025-09-08 21:08 ` Hans de Goede
2025-09-10 5:52 ` Leo L. Schwab
2025-09-10 11:09 ` Hans de Goede
2025-09-10 18:02 ` Leo L. Schwab
2025-09-10 19:16 ` Hans de Goede
2025-09-15 22:18 ` Leo L. Schwab
2025-09-17 10:33 ` Hans de Goede
2025-09-17 19:50 ` Leo L. Schwab [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=aMsQ7dBJrwpWbdJk@ewhac.org \
--to=ewhac@ewhac.org \
--cc=bentiss@kernel.org \
--cc=hansg@kernel.org \
--cc=hpa@redhat.com \
--cc=jikos@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@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.