All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 0/2] HP: wmi: added support for 4 zone keyboard rgb
@ 2024-07-19  9:59 Carlos Ferreira
  2024-07-19  9:59 ` [PATCH v4 1/2] " Carlos Ferreira
  2024-07-19  9:59 ` [PATCH v4 2/2] HP: wmi: Add documentation for the LED API naming scheme Carlos Ferreira
  0 siblings, 2 replies; 9+ messages in thread
From: Carlos Ferreira @ 2024-07-19  9:59 UTC (permalink / raw)
  To: hdegoede, ilpo.jarvinen
  Cc: mustafa.eskieksi, platform-driver-x86, linux-kernel,
	Carlos Ferreira

Hi,
This driver now supports brightness control and an initial version of mode
control (all brightness values to 0 means off and otherwise its on).

About this mode control, it presents some limitations and problems.
The first problems i noticed happens when setting the keyboard to
off mode with software and on with hardware.

Example: If i have 2 zones with brightness != 0 and use sw to turn the
keyboard off, when turning it back on with the Fn + key combo, only the
last zone that received brightness 0 will be back and not both of them
as i would expect given that was effectively the state before the user
decided to turn it off (this is what happens on Win).

The other problem is a bit worse, and it happens because of the small time
frame in between me pressing the Fn + Key combo and fourzone_set_state()
actually running. If a userspace program sets a brightness/color value
to a zone in this interval, the driver will reach an inconsistent state,
making it pretty much useless as it happens frequently. According to my
tests, setting a color every 0.2s or even slower is enough to trigger this.
It could easily happen with software generated effects.

Both of this problems would be solved using a proper system to control
modes instead of trying to encode them in brightness values.

As far as i know, the multicolor LED API does not have this (maybe it should).
If it really doesn't have mode support, then creating a sysfs entry/attribute
in "/sys/devices/platform/hp-wmi/leds" would allow for proper mode control
and the mc LED API would also function as expected.

About the Kconfig file, i had to use "select" instead of "depends"
because i was running into a dependency cycle issue.

Changes in v4:
 - Added support for brightness control
 - Added initial support for on/off mode control
 - Changed from KEY_KBDILLUMTOGGLE to led_classdev_notify_brightness_hw_changed()
 - Changed from a single rgb subled to 3 subleds (R, G, B)
 - Added the LED_RETAIN_AT_SHUTDOWN flag to better mimic the Windows behaviour
 - Added the dependency on LEDS_CLASS_MULTICOLOR
 - Included some documentation for the LED API
Changes in v3:
 - Moved to the multicolor led api
 - Mapped the wmi backlight toggle event to KEY_KBDILLUMTOGGLE
 - Some other minor changes
Changes in v2:
 - Rearranged code to remove forward declarations
 - Changed from sprintf() to sysfs_emit()
 - Fixed some identation and coding style problems
 - Switched from manual bit manipulation to GENMASK(x, y) + FIELD_PREP(XX, )
 - #define'ed magic constants

Carlos Ferreira (2):
  HP: wmi: added support for 4 zone keyboard rgb
  HP: wmi: Add documentation for the LED API naming scheme

 Documentation/leds/leds-class.rst |  40 +++++
 drivers/platform/x86/hp/Kconfig   |   1 +
 drivers/platform/x86/hp/hp-wmi.c  | 282 +++++++++++++++++++++++++++++-
 3 files changed, 314 insertions(+), 9 deletions(-)

-- 
2.45.2


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-08-16 16:11 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-19  9:59 [PATCH v4 0/2] HP: wmi: added support for 4 zone keyboard rgb Carlos Ferreira
2024-07-19  9:59 ` [PATCH v4 1/2] " Carlos Ferreira
2024-07-25  3:40   ` kernel test robot
2024-08-12 13:17   ` Ilpo Järvinen
2024-08-12 13:44   ` Hans de Goede
2024-08-12 15:57     ` Ilpo Järvinen
2024-07-19  9:59 ` [PATCH v4 2/2] HP: wmi: Add documentation for the LED API naming scheme Carlos Ferreira
2024-08-12 12:48   ` Hans de Goede
2024-08-16 16:11     ` Lee Jones

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.