All of lore.kernel.org
 help / color / mirror / Atom feed
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 v2 4/8] regulator: add Qualcomm LCDB driver
Date: Mon, 19 Oct 2026 11:39:14 +0000	[thread overview]
Message-ID: <sashiko-outbox-177045@kernel.org> (raw)
In-Reply-To: <20261019-sm8150-display-card-v2-4-86c05068efc5@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] regulator: qcom-lcdb: off-by-one and window reset in qcom_lcdb_handle_sc()
--

commit 5b5d0fa4182dea42061084cb3ab6d86b894783ff
Author: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>

regulator: add Qualcomm LCDB driver

This commit adds a regulator driver for the Qualcomm LCDB (LCD bias) block
found on PMICs such as PMI632, PM6150L, and PM8150L. It manages the shared
module enable, boost headroom tracking, voltage ramp-up, and short-circuit
recovery for the LDO and NCP bias rails.

> diff --git a/drivers/regulator/qcom-lcdb-regulator.c b/drivers/regulator/qcom-lcdb-regulator.c
> new file mode 100644
> index 0000000000000..bb2d4ee23ad5c
> --- /dev/null
> +++ b/drivers/regulator/qcom-lcdb-regulator.c
> @@ -0,0 +1,494 @@

[ ... ]

> +static bool qcom_lcdb_handle_sc(struct qcom_lcdb *lcdb)
> +{
> +	guard(mutex)(&lcdb->lock);
> +
> +	if (!lcdb->enabled_mask || lcdb->sc_disabled)
> +		return false;
> +
> +	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;
> +		return true;
> +	}
> +
> +	lcdb->sc_count++;
> +	lcdb->sc_time = ktime_get();

[Severity: Medium]
Does qcom_lcdb_handle_sc() have an off-by-one in the retry count and reset
the 1-second fault window on every short-circuit event?

The commit message notes that on a short circuit the module is restarted up
to ten times within a second. However, in qcom_lcdb_handle_sc(),
lcdb->sc_count > LCDB_SC_CNT_MAX is evaluated before lcdb->sc_count++,
allowing 11 restarts (for lcdb->sc_count values 0 through 10) before
disabling the outputs on the 12th fault.

In addition, lcdb->sc_time = ktime_get() is updated on every fault rather
than only when starting a new counting window. Because ktime_us_delta()
measures the time since the immediately preceding fault instead of the first
fault in the window, intermittent faults spaced less than 1 second apart
(for example, every 0.8 seconds) will never reset lcdb->sc_count and will
permanently disable the rails across multiple seconds.

> +
> +	if (qcom_lcdb_module_enable(lcdb)) {
> +		dev_err(lcdb->dev, "failed to recover from a short circuit\n");
> +		lcdb->sc_disabled = true;
> +		return true;
> +	}
> +
> +	return false;
> +}

[ ... ]

────
🤖 ThisDimensions (v1.2 · gpt-5.4) · 2026-10-19 04:01 UTC · [📚](https://github.com/masoncl/review-prompts)
  📧 dmitry.baryshkov@oss.qualcomm.com · 💬 ~420 words · 🪙 ~15k tokens · 💰 ~$0.05 ([📊](https://platform.openai.com/docs/pricing))
────

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261019-sm8150-display-card-v2-0-86c05068efc5@oss.qualcomm.com?part=4

  reply	other threads:[~2026-10-19 11:39 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-19 11:25 [PATCH v2 0/8] arm64: qcom: enable display card support on SM8150 HDK Dmitry Baryshkov
2026-10-19 11:25 ` [PATCH v2 1/8] backlight: qcom-wled: fix string detection brightness on WLED5 Dmitry Baryshkov
2026-10-19 11:32   ` sashiko-bot
2026-10-19 11:25 ` [PATCH v2 2/8] regulator: dt-bindings: add Qualcomm LCDB regulator Dmitry Baryshkov
2026-10-19 11:25 ` [PATCH v2 3/8] dt-bindings: mfd: qcom,spmi-pmic: add LCDB Dmitry Baryshkov
2026-10-20  7:57   ` Krzysztof Kozlowski
2026-10-19 11:25 ` [PATCH v2 4/8] regulator: add Qualcomm LCDB driver Dmitry Baryshkov
2026-10-19 11:39   ` sashiko-bot [this message]
2026-10-19 11:59   ` Konrad Dybcio
2026-10-19 11:25 ` [PATCH v2 5/8] arm64: dts: qcom: pm8150l: add LCDB regulators Dmitry Baryshkov
2026-10-19 11:47   ` Abel Vesa
2026-10-19 11:48   ` Konrad Dybcio
2026-10-19 11:25 ` [PATCH v2 6/8] arm64: dts: qcom: sm8150: add MDSS reset Dmitry Baryshkov
2026-10-19 11:46   ` Abel Vesa
2026-10-19 11:25 ` [PATCH v2 7/8] arm64: dts: qcom: sm8150-hdk: fix FSA4480 address Dmitry Baryshkov
2026-10-19 11:46   ` Abel Vesa
2026-10-19 11:25 ` [PATCH v2 8/8] arm64: dts: qcom: sm8150-hdk: add display card overlay Dmitry Baryshkov
2026-10-19 11:47   ` Konrad Dybcio
2026-10-19 11:47   ` Abel Vesa
2026-10-19 11:32 ` [PATCH v2 0/8] arm64: qcom: enable display card support on SM8150 HDK Konrad Dybcio

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-177045@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.