Re: [PATCH v4 4/4] backlight: qcom-wled: Read back the programmed brightness at probe
From: Daniel Thompson
Date: Tue Oct 06 2026 - 06:11:15 EST
On Mon, Sep 21, 2026 at 12:46:25PM +0200, David Heidelberg via B4 Relay wrote:
> From: David Heidelberg <david@xxxxxxx>
>
> Since the previous change wled_probe() seeds wled->brightness from
> MOD_EN, but with default-brightness rather than the level the hardware
> is actually driving, so a backlight left lit by the bootloader still
> visibly steps on the first update, and actual_brightness reports the
> last value written rather than what the panel shows.
>
> Add wled_read_brightness(), which returns 0 when MOD_EN is clear and
> otherwise reads the brightness register the matching
> wledN_set_brightness() writes: the first enabled string on WLED3 and
> WLED4, the selected modulator on WLED5. Use it to seed both
> wled->brightness and the initial backlight property, and expose it as
> backlight_ops.get_brightness so that actual_brightness reflects the
> hardware too.
>
> A module that is enabled with the brightness registers at zero, which
> wled4_setup() and wled_auto_string_detection() can leave behind on a
> cold boot, now reads back as off. The OVP interrupt is then armed by the
> first brightness update rather than from probe, which is what happens
> on every other board where the module starts out disabled.
>
> Suggested-by: Konrad Dybcio <konrad.dybcio@xxxxxxxxxxxxxxxx>
> Assisted-by: LLM
> Signed-off-by: David Heidelberg <david@xxxxxxx>
Reviewed-by: Daniel Thompson (RISCstar) <danielt@xxxxxxxxxx>
Daniel.