]> Gentwo Git Trees - linux/.git/commit
leds: leds-lp50xx: Enable chip before any communication
authorChristian Hitz <christian.hitz@bbv.ch>
Tue, 28 Oct 2025 15:51:40 +0000 (16:51 +0100)
committerLee Jones <lee@kernel.org>
Thu, 13 Nov 2025 13:13:45 +0000 (13:13 +0000)
commit434959618c47efe9e5f2e20f4a850caac4f6b823
tree60acd12ab94be60b6e2753828aadf9f22a21a762
parentea1c4c7e648d1ca91577071fc42fdc219521098c
leds: leds-lp50xx: Enable chip before any communication

If a GPIO is used to control the chip's enable pin, it needs to be pulled
high before any i2c communication is attempted.

Currently, the enable GPIO handling is not correct.

Assume the enable GPIO is low when the probe function is entered. In this
case the device is in SHUTDOWN mode and does not react to i2c commands.

During probe the following sequence happens:
 1. The call to lp50xx_reset() on line 548 has no effect as i2c is not
    possible yet.
 2. Then - on line 552 - lp50xx_enable_disable() is called. As
    "priv->enable_gpio“ has not yet been initialized, setting the GPIO has
    no effect. Also the i2c enable command is not executed as the device
    is still in SHUTDOWN.
 3. On line 556 the call to lp50xx_probe_dt() finally parses the rest of
    the DT and the configured priv->enable_gpio is set up.

As a result the device is still in SHUTDOWN mode and not ready for
operation.

Split lp50xx_enable_disable() into distinct enable and disable functions
to enforce correct ordering between enable_gpio manipulations and i2c
commands.
Read enable_gpio configuration from DT before attempting to manipulate
enable_gpio.
Add delays to observe correct wait timing after manipulating enable_gpio
and before any i2c communication.

Cc: stable@vger.kernel.org
Fixes: 242b81170fb8 ("leds: lp50xx: Add the LP50XX family of the RGB LED driver")
Signed-off-by: Christian Hitz <christian.hitz@bbv.ch>
Link: https://patch.msgid.link/20251028155141.1603193-1-christian@klarinett.li
Signed-off-by: Lee Jones <lee@kernel.org>
drivers/leds/leds-lp50xx.c