Linux Framebuffer Layer development
 help / color / mirror / Atom feed
From: David Heidelberg via B4 Relay <devnull+david.ixit.cz@kernel.org>
To: "Lee Jones" <lee@kernel.org>,
	"Daniel Thompson" <danielt@kernel.org>,
	"Jingoo Han" <jingoohan1@gmail.com>,
	"Helge Deller" <deller@gmx.de>,
	"Kiran Gunda" <quic_kgunda@quicinc.com>,
	"Marco Mattiolo" <marco.mattiolo@hotmail.it>,
	"Barnabás Czémán" <barnabas.czeman@mainlining.org>
Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org,
	 linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	 phone-devel@vger.kernel.org,
	Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>,
	 Joel Selvaraj <foss@joelselvaraj.com>,
	David Heidelberg <david@ixit.cz>,
	 stable@vger.kernel.org
Subject: [PATCH v4 0/4] backlight: qcom-wled: Fix OVP IRQ imbalance and start from the hardware state
Date: Mon, 21 Sep 2026 12:46:21 +0200	[thread overview]
Message-ID: <20260921-qcom-wled-backlight-v4-0-bab8c7ef73cb@ixit.cz> (raw)

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/

Signed-off-by: David Heidelberg <david@ixit.cz>
---
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/20260914-qcom-wled-backlight-v3-0-d69fe9843841@ixit.cz

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/20260914-qcom-wled-backlight-v2-0-a908d9233e93@ixit.cz

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/20260908-qcom-wled-backlight-v1-1-c4dd4eabda07@ixit.cz

---
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,
--  
David Heidelberg <david@ixit.cz>



             reply	other threads:[~2026-09-21 10:46 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-21 10:46 David Heidelberg via B4 Relay [this message]
2026-09-21 10:46 ` [PATCH v4 1/4] backlight: qcom-wled: Fix NULL pointer dereference in wled_remove() David Heidelberg via B4 Relay
2026-09-21 11:06   ` Konrad Dybcio
2026-10-06  9:59   ` Daniel Thompson
2026-09-21 10:46 ` [PATCH v4 2/4] backlight: qcom-wled: Fix WLED3 brightness register stride David Heidelberg via B4 Relay
2026-09-21 11:08   ` Konrad Dybcio
2026-09-21 11:11     ` David Heidelberg
2026-10-06 10:03   ` Daniel Thompson
2026-09-21 10:46 ` [PATCH v4 3/4] backlight: qcom-wled: Fix unbalanced OVP IRQ enable at probe David Heidelberg via B4 Relay
2026-10-06 10:07   ` Daniel Thompson
2026-09-21 10:46 ` [PATCH v4 4/4] backlight: qcom-wled: Read back the programmed brightness " David Heidelberg via B4 Relay
2026-10-06 10:11   ` Daniel Thompson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260921-qcom-wled-backlight-v4-0-bab8c7ef73cb@ixit.cz \
    --to=devnull+david.ixit.cz@kernel.org \
    --cc=barnabas.czeman@mainlining.org \
    --cc=danielt@kernel.org \
    --cc=david@ixit.cz \
    --cc=deller@gmx.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=foss@joelselvaraj.com \
    --cc=jingoohan1@gmail.com \
    --cc=konrad.dybcio@oss.qualcomm.com \
    --cc=lee@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marco.mattiolo@hotmail.it \
    --cc=phone-devel@vger.kernel.org \
    --cc=quic_kgunda@quicinc.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox