From: sashiko-bot@kernel.org
To: "Dmitry Baryshkov" <dmitry.baryshkov@oss.qualcomm.com>
Cc: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org,
mfd@lists.linux.dev, robh@kernel.org, conor+dt@kernel.org,
lee@kernel.org
Subject: Re: [PATCH 5/9] regulator: add Qualcomm LCDB driver
Date: Thu, 15 Oct 2026 09:31:10 +0000 [thread overview]
Message-ID: <sashiko-outbox-172577@kernel.org> (raw)
In-Reply-To: <20261015-sm8150-display-card-v1-5-5c14928cef29@oss.qualcomm.com>
Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider:
- [High] regulator: qcom-lcdb: LDO pull-down left forced on after disable error
- [High] regulator: qcom-lcdb: self-deadlock in short-circuit notifier chain
- [High] regulator: qcom-lcdb: state desync on SC recovery failure
- [Medium] regulator: qcom-lcdb: internal state corrupted on hardware write failure
--
commit 5e78a1b6d6d6c5c217f997a1d7627dc506e8ba37
Author: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
regulator: add Qualcomm LCDB driver
Adds a driver for the LCDB block found on Qualcomm PMICs (PMI632, PM6150L,
PM8150L) to provide positive and negative bias rails for LCD panels. The
driver supports enabling with voltage ramp-up and disabling with an LDO
pull-down.
> diff --git a/drivers/regulator/qcom-lcdb-regulator.c b/drivers/regulator/qcom-lcdb-regulator.c
> new file mode 100644
> index 0000000000000..45b3b7118e31d
> --- /dev/null
> +++ b/drivers/regulator/qcom-lcdb-regulator.c
[ ... ]
> +static int qcom_lcdb_module_disable(struct qcom_lcdb *lcdb)
> +{
> + int ret;
> +
> + /* Force the LDO pull-down to discharge the output quickly */
> + ret = regmap_write(lcdb->regmap, lcdb->base + LCDB_LDO_FORCE_PD_CTL,
> + LCDB_LDO_FORCE_PD_EN | LCDB_LDO_FORCE_PD_MODE);
> + if (ret)
> + return ret;
> +
> + ret = regmap_write(lcdb->regmap, lcdb->base + LCDB_ENABLE_CTL1, 0);
> + if (ret)
> + return ret;
[Severity: High]
If the regmap_write() to LCDB_ENABLE_CTL1 fails, the function returns
early without reverting the prior LCDB_LDO_FORCE_PD_CTL write. Will this
leave the physical regulator shorted to ground with the strong pull-down
resistor active while the LDO remains enabled?
> +
> + lcdb->off_time = ktime_get();
> +
> + usleep_range(10000, 11000);
> +
> + return regmap_write(lcdb->regmap, lcdb->base + LCDB_LDO_FORCE_PD_CTL, 0);
> +}
[ ... ]
> +static int qcom_lcdb_disable(struct regulator_dev *rdev)
> +{
> + struct qcom_lcdb *lcdb = rdev_get_drvdata(rdev);
> +
> + guard(mutex)(&lcdb->lock);
> +
> + lcdb->enabled_mask &= ~BIT(rdev_get_id(rdev));
> + if (lcdb->enabled_mask)
> + return 0;
> +
> + return qcom_lcdb_module_disable(lcdb);
> +}
[Severity: Medium]
Does clearing lcdb->enabled_mask before qcom_lcdb_module_disable() completes
permanently desynchronize the software state if the hardware disablement
fails?
If the write fails, the mask will remain cleared, causing qcom_lcdb_is_enabled()
to return false even though the hardware is still active. This misalignment
might cause the next enable call to incorrectly execute the ramp-up sequence
on an already active rail.
[ ... ]
> +static int qcom_lcdb_set_voltage_sel(struct regulator_dev *rdev, unsigned int sel)
> +{
> + struct qcom_lcdb *lcdb = rdev_get_drvdata(rdev);
> +
> + guard(mutex)(&lcdb->lock);
> +
> + lcdb->uV[rdev_get_id(rdev)] = qcom_lcdb_sel_to_uV(sel);
> +
> + return qcom_lcdb_write_voltages(lcdb, lcdb->uV[LCDB_LDO],
> + lcdb->uV[LCDB_NCP]);
> +}
[Severity: Medium]
If qcom_lcdb_write_voltages() fails, the cached lcdb->uV array will already
have been updated. Will this cause subsequent calls to qcom_lcdb_get_voltage_sel()
to return the new but unapplied voltage instead of the actual hardware
state?
[ ... ]
> +static void qcom_lcdb_handle_sc(struct qcom_lcdb *lcdb)
> +{
> + int i;
> +
> + guard(mutex)(&lcdb->lock);
> +
> + if (!lcdb->enabled_mask || lcdb->sc_disabled)
> + return;
> +
> + qcom_lcdb_module_disable(lcdb);
> +
> + if (ktime_us_delta(ktime_get(), lcdb->sc_time) > LCDB_SC_RESET_CNT_DLY_US) {
> + lcdb->sc_count = 0;
> + } else if (lcdb->sc_count > LCDB_SC_CNT_MAX) {
> + dev_err(lcdb->dev, "persistent short circuit, keeping the outputs off\n");
> + lcdb->sc_disabled = true;
> +
> + for (i = 0; i < LCDB_NUM_RAILS; i++)
> + regulator_notifier_call_chain(lcdb->rdev[i],
> + REGULATOR_EVENT_FAIL, NULL);
> + return;
> + }
[Severity: High]
Can calling the synchronous notifier chain with lcdb->lock held result in a
self-deadlock?
Consumers often react to REGULATOR_EVENT_FAIL by attempting to disable the
failing regulator via regulator_disable(). This acquires rdev->mutex and
then invokes the driver's disable callback:
regulator_disable()
qcom_lcdb_disable()
guard(mutex)(&lcdb->lock);
Since lcdb->lock is already held by qcom_lcdb_handle_sc(), wouldn't this
result in a self-deadlock?
> +
> + lcdb->sc_count++;
> + lcdb->sc_time = ktime_get();
> +
> + if (qcom_lcdb_module_enable(lcdb))
> + dev_err(lcdb->dev, "failed to recover from a short circuit\n");
> +}
[Severity: High]
If qcom_lcdb_module_enable() fails here, it returns an error and the
hardware is left off, but lcdb->enabled_mask is not cleared and
lcdb->sc_disabled is not set.
Does this create a state mismatch where future consumers might call
qcom_lcdb_enable() and falsely see a success without any actual physical
hardware enablement?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261015-sm8150-display-card-v1-0-5c14928cef29@oss.qualcomm.com?part=5
next prev parent reply other threads:[~2026-10-15 9:31 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-15 8:58 [PATCH 0/9] arm64: qcom: enable display card support on SM8150 HDK Dmitry Baryshkov
2026-10-15 8:58 ` [PATCH 1/9] backlight: qcom-wled: fix unbalanced OVP interrupt enable Dmitry Baryshkov
2026-10-15 9:11 ` Konrad Dybcio
2026-10-15 9:44 ` Dmitry Baryshkov
2026-10-15 9:22 ` sashiko-bot
2026-10-15 8:58 ` [PATCH 2/9] backlight: qcom-wled: fix string detection brightness on WLED5 Dmitry Baryshkov
2026-10-15 9:13 ` Konrad Dybcio
2026-10-15 9:17 ` sashiko-bot
2026-10-15 8:58 ` [PATCH 3/9] dt-bindings: regulator: add Qualcomm LCDB regulator Dmitry Baryshkov
2026-10-15 9:14 ` Konrad Dybcio
2026-10-15 18:39 ` Mark Brown
2026-10-15 8:58 ` [PATCH 4/9] dt-bindings: mfd: qcom,spmi-pmic: add LCDB Dmitry Baryshkov
2026-10-15 8:58 ` [PATCH 5/9] regulator: add Qualcomm LCDB driver Dmitry Baryshkov
2026-10-15 9:31 ` sashiko-bot [this message]
2026-10-15 8:58 ` [PATCH 6/9] arm64: dts: qcom: pm8150l: add LCDB regulators Dmitry Baryshkov
2026-10-15 9:39 ` sashiko-bot
2026-10-15 8:58 ` [PATCH 7/9] arm64: dts: qcom: sm8150: add MDSS reset Dmitry Baryshkov
2026-10-15 9:15 ` Konrad Dybcio
2026-10-15 8:58 ` [PATCH 8/9] arm64: dts: qcom: sm8150-hdk: fix FSA4480 address Dmitry Baryshkov
2026-10-15 9:10 ` Konrad Dybcio
2026-10-15 9:11 ` Konrad Dybcio
2026-10-15 8:58 ` [PATCH 9/9] arm64: dts: qcom: sm8150-hdk: add display card overlay Dmitry Baryshkov
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=sashiko-outbox-172577@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dmitry.baryshkov@oss.qualcomm.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=lee@kernel.org \
--cc=mfd@lists.linux.dev \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.