[PATCH 0/2] leds: lp8864: Expose a backlight via led_bl helper
"A. Sverdlin" <[email protected]>
| Newsgroups | org.kernel.vger.linux-fbdev,org.freedesktop.lists.dri-devel,org.kernel.vger.linux-kernel,org.kernel.vger.linux-leds |
|---|---|
| Message-ID | <[email protected]> |
From: Alexander Sverdlin <[email protected]> This series lets the TI LP8864/LP8866 LED driver expose a standard backlight class device in addition to its LED class device, so it can be consumed by display/panel stacks that expect a backlight. This is a replacement for the earlier series "Convert LP8864 LED driver to backlight class" [1], which took a much more invasive route: it moved the driver from drivers/leds/ to drivers/video/backlight/ and added backlight class registration on top. Feedback on that approach was that a working LED driver should not be relocated and re-typed just to gain a backlight interface. The new approach keeps the LP8864 a plain LED driver and instead teaches the existing generic led-backlight code to register a backlight on behalf of a self-contained LED provider: * Patch 1 factors the backlight registration out of led_bl's probe path into a shared helper and exports devm_led_backlight_register(). This registers a backlight class device driven by a single LED, without a device-tree node, bound to the caller's device lifetime. The registration is now fully devres-managed, so the explicit .remove callback goes away. The exported symbol is a no-op when led-backlight support is not reachable (IS_REACHABLE(CONFIG_BACKLIGHT_LED)), so callers need no Kconfig plumbing and are not force-selected to build led_bl. * Patch 2 calls that helper from the LP8864 driver, spawning a backlight tied to the I2C device lifetime. Compared to [1] this means: * The driver stays in drivers/leds/ and remains an ordinary LED driver. * The generic led_bl helper becomes reusable by other self-contained LED providers. The motivating use case is unchanged: an LP8864 on a hot-pluggable segment of an I2C bus. The generic led-backlight platform driver cannot react to a dynamically (dis)appearing I2C device; letting the I2C driver register the backlight directly makes it a self-contained, hot-plug-safe driver. [1] https://lore.kernel.org/all/[email protected]/ Alexander Sverdlin (2): backlight: led_bl: Add devm_led_backlight_register() helper leds: lp8864: Register a backlight device drivers/leds/leds-lp8864.c | 5 +- drivers/video/backlight/led_bl.c | 130 ++++++++++++++++++++----------- include/linux/led_bl.h | 20 +++++ 3 files changed, 109 insertions(+), 46 deletions(-) create mode 100644 include/linux/led_bl.h -- 2.55.0