[PATCH v2 0/2] cros_kbd_led_backlight: allow binding through cros_ec mfd device

From: Thomas Weißschuh
Date: Sat May 11 2024 - 05:05:31 EST


Extend the cros_ec MFD device to also load cros_kbd_led_backlight
when the EC reports EC_FEATURE_PWM_KEYB.

Tested on a Framework 13 AMD, Firmware 3.05.

This is based on
https://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux.git for-next

The helper keyboard_led_is_mfd_device is a bit iffy, but I couldn't find
a nicer way.

* driver_data from platform_device_id is overwritten by the mfd platform data
* Setting the driver_data in drivers/mfd/cros_ec_dev.c would expose the
internals of cros_kbd_led_backlight

Signed-off-by: Thomas Weißschuh <linux@xxxxxxxxxxxxxx>
---
Changes in v2:
- Fix build with CONFIG_MFD_CROS_EC_DEV=n (kernel test robot)
- Split out mfd registration into own commit (Lee)
- Simplify keyboard_led_is_mfd_device() with mfd_get_cell()
- Link to v1: https://lore.kernel.org/r/20240505-cros_ec-kbd-led-framework-v1-1-bfcca69013d2@xxxxxxxxxxxxxx

---
Thomas Weißschuh (2):
platform/chrome: cros_kbd_led_backlight: allow binding through mfd device
mfd: cros_ec: Register keyboard backlight subdevice

drivers/mfd/cros_ec_dev.c | 9 ++++++
drivers/platform/chrome/cros_kbd_led_backlight.c | 36 +++++++++++++++++++++++-
2 files changed, 44 insertions(+), 1 deletion(-)
---
base-commit: 2fbe479c0024e1c6b992184a799055e19932aa48
change-id: 20240505-cros_ec-kbd-led-framework-7e2e831bc79c

Best regards,
--
Thomas Weißschuh <linux@xxxxxxxxxxxxxx>