Skip to content

backlight: qcom-wled: Fix OVP IRQ imbalance and start from the hardware state

David Heidelberg b4-sent dri-devel linux-arm-msm linux-fbdev lkml phone-devel stable 4 versions – Applied

Status from this message: Applied, thanks!

Get series with b4
b4 am [email protected] change-id 20260908-qcom-wled-backlight-fd9574027353

Versions newest first

  1. v4 Latest4 patches 10 repliesApplied
  2. v34 patches 3 repliesSuperseded
  3. v23 patches 0 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v11 patch1 replySuperseded

Changes in v4 from the cover letter

- I applied the 0x10 fix too late, now it's fixed in the right commit. (Konrad)
- Right object stored in the drvdata. (Konrad)
- Set the drvdata next to the other wled fields instead of next to the backlight device registration.
- Reworded the drvdata commit, the NULL dereference is in wled_remove(),
the driver has no PM callbacks.
- Link to v3: https://patch.msgid.link/[email protected]

Patches in v4 Applied

#Subject and filesSizeRepliesApplied
1/4backlight: qcom-wled: Fix NULL pointer dereference in wled_remove()drivers/video/backlight/qcom-wled.c+1 -02 replies
2/4backlight: qcom-wled: Fix WLED3 brightness register stridedrivers/video/backlight/qcom-wled.c+1 -13 replies
3/4backlight: qcom-wled: Fix unbalanced OVP IRQ enable at probedrivers/video/backlight/qcom-wled.c+21 -111 reply
4/4backlight: qcom-wled: Read back the programmed brightness at probedrivers/video/backlight/qcom-wled.c+63 -111 reply

Reviews trailers per patch

All 4 patches have a Reviewed-by or Acked-by.

PatchKonrad DybcioDaniel Thompson (RISCstar)
1/4R-b R-b
2/4R-b R-b
3/4R-b
4/4R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v4 thread

Cover letter [PATCH v4 0/4] backlight: qcom-wled: Fix OVP IRQ imbalance and start from the hardware state

The qcom-wled OVP interrupt is enabled at probe whenever the module is already on, but the driver still believes the backlight is off, so the first brightness update re-enables the interrupt and trips "Unbalanced enable for IRQ". sdm845-mainline has carried a workaround for years and Joel posted a flag-based version last October [1], which Konrad and Daniel asked to be replaced by something that does not track the IRQ state by hand.

Patch 1 is the drvdata fix I said I would drop after v3. The objection was that it stored the wrong object, not that the fix was wrong, so it is back with the right one stored.

Patch 2 is unrelated too and fell out of writing the readback: the WLED3 brightness register stride has been one byte instead of two since the 2019 restructuring, so multi-string pm8941 boards only program one string correctly. Untested, I have no WLED3 board; it restores what pm8941-wled.c did and matches the downstream leds-qpnp.c layout.

[1] https://lore.kernel.org/all/20251021-qcom-wled-fix-unbalanced-ovp-irq-enable-v2-1-7ff115b4ffe7@joelselvaraj.com/

---
Changes in v4:
- I applied the 0x10 fix too late, now it's fixed in the right commit. (Konrad)
- Right object stored in the drvdata. (Konrad)
- Set the drvdata next to the other wled fields instead of next to the backlight device registration.
- Reworded the drvdata commit, the NULL dereference is in wled_remove(),
the driver has no PM callbacks.
- Link to v3: https://patch.msgid.link/[email protected]

Changes in v3:
- Fix typo 0x10 != 0b10. (Sashiko)
- Added fix for a unrelated issue, but since reported as critical, let's
squeeze it:
Missing platform_set_drvdata() in wled_probe() leads to a guaranteed NULL pointer dereference in wled_remove(). (Sashiko)
- Link to v2: https://patch.msgid.link/[email protected]

Changes in v2:
- Add a fix for the WLED3 brightness register stride.
- Add patch reading the programmed brightness back via backlight_ops.get_brightness. (Konrad)
- Note the brightness readback is done in the follow-up to the first
patch.
- Link to v1: https://patch.msgid.link/[email protected]

---
David Heidelberg (4):
backlight: qcom-wled: Fix NULL pointer dereference in wled_remove()
backlight: qcom-wled: Fix WLED3 brightness register stride
backlight: qcom-wled: Fix unbalanced OVP IRQ enable at probe
backlight: qcom-wled: Read back the programmed brightness at probe

 drivers/video/backlight/qcom-wled.c | 89 +++++++++++++++++++++++++++++++------
 1 file changed, 76 insertions(+), 13 deletions(-)

---
base-commit: 944a035ecca915ae947905dcfb03f2b9dc6d032c
change-id: 20260908-qcom-wled-backlight-fd9574027353

Best regards,

Signature · 1 line
David Heidelberg <[email protected]>