From: sashiko-bot@kernel.org
To: "Jishnu Prakash" <jishnu.prakash@oss.qualcomm.com>
Cc: mfd@lists.linux.dev, devicetree@vger.kernel.org, robh@kernel.org,
conor+dt@kernel.org, lee@kernel.org
Subject: Re: [PATCH v2 3/7] regulator: qcom-pm8008: Add PM8010 mode support
Date: Wed, 14 Oct 2026 10:45:20 +0000 [thread overview]
Message-ID: <sashiko-outbox-171156@kernel.org> (raw)
In-Reply-To: <20261014-pm8010_i2c_support-v2-3-b395d2b3f668@oss.qualcomm.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] regulator: qcom-pm8008: get_mode() reads status instead of control reg
--
commit b99c63e4d74725e0e0de61987ec984083cab186f
Author: Dhruvin Rajpura <drajpura@qti.qualcomm.com>
regulator: qcom-pm8008: Add PM8010 mode support
This commit implements set_mode and get_mode support for PM8010 LDOs using
the mode control and status registers. It allows clients to vote for LDO
modes, a feature that is not supported in the PM8008 LDOs.
> diff --git a/drivers/regulator/qcom-pm8008-regulator.c b/drivers/regulator/qcom-pm8008-regulator.c
> index b484c0f73eeac..ae5370770b2fc 100644
> --- a/drivers/regulator/qcom-pm8008-regulator.c
> +++ b/drivers/regulator/qcom-pm8008-regulator.c
[ ... ]
> @@ -134,6 +145,51 @@ static int pm8008_regulator_get_voltage_sel(struct regulator_dev *rdev)
> return regulator_map_voltage_linear_range(rdev, uV, INT_MAX);
> }
>
[ ... ]
> +static unsigned int pm8010_regulator_get_mode(struct regulator_dev *rdev)
> +{
> + struct pm8008_regulator *preg = rdev_get_drvdata(rdev);
> + unsigned int val;
> + int ret;
> +
> + ret = regmap_read(preg->regmap, preg->base + LDO_STATUS1_REG, &val);
> + if (ret < 0)
> + return REGULATOR_MODE_INVALID;
> +
> + return (val & MODE_STATE_MASK) == MODE_STATE_NPM ?
> + REGULATOR_MODE_NORMAL : REGULATOR_MODE_IDLE;
> +}
[Severity: Medium]
Does reading LDO_STATUS1_REG instead of the control register
(LDO_MODE_CTL1_REG) here break the regulator core's set_mode optimization
when the LDO is disabled?
When the LDO is disabled, the physical status register indicates an OFF state
(evaluating to 0), which incorrectly falls through to return
REGULATOR_MODE_IDLE.
If a consumer calls regulator_set_mode() with REGULATOR_MODE_IDLE while the
regulator is disabled, the core compares the requested mode with the returned
get_mode() value. Seeing a match, it skips writing the new mode to the control
register. Later, when the regulator is enabled, it powers up using the stale
mode in LDO_MODE_CTL1_REG (e.g., REGULATOR_MODE_NORMAL), completely ignoring
the consumer's earlier REGULATOR_MODE_IDLE request.
Should pm8010_regulator_get_mode() read LDO_MODE_CTL1_REG instead to
accurately reflect the configured state rather than the dynamic physical
status?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261014-pm8010_i2c_support-v2-0-b395d2b3f668@oss.qualcomm.com?part=3
next prev parent reply other threads:[~2026-10-14 10:45 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-14 10:31 [PATCH v2 0/7] mfd: qcom-pm8008: Add support for PM8010 over I2C Jishnu Prakash
2026-10-14 10:31 ` [PATCH v2 1/7] dt-bindings: mfd: pm8008: Add qcom,pm8010-i2c compatible Jishnu Prakash
2026-10-14 10:31 ` [PATCH v2 2/7] regulator: pm8008: Add PM8010 support Jishnu Prakash
2026-10-14 10:32 ` [PATCH v2 3/7] regulator: qcom-pm8008: Add PM8010 mode support Jishnu Prakash
2026-10-14 10:45 ` sashiko-bot [this message]
2026-10-14 10:32 ` [PATCH v2 4/7] mfd: qcom-pm8008: Drop GPIO support Jishnu Prakash
2026-10-14 10:45 ` sashiko-bot
2026-10-14 10:32 ` [PATCH v2 5/7] mfd: qcom-pm8008: Add PM8010 support Jishnu Prakash
2026-10-14 10:44 ` sashiko-bot
2026-10-14 10:32 ` [PATCH v2 6/7] dt-bindings: mfd: pm8008: Make interrupts optional Jishnu Prakash
2026-10-14 10:32 ` [PATCH v2 7/7] mfd: qcom-pm8008: Tolerate missing interrupt Jishnu Prakash
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-171156@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=jishnu.prakash@oss.qualcomm.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox