From: Mark Brown <broonie@kernel.org>
To: Jerome NEANNE <jneanne@baylibre.com>
Cc: lgirdwood@gmail.com, robh+dt@kernel.org, nm@ti.com,
kristo@kernel.org, will@kernel.org, lee.jones@linaro.org,
khilman@baylibre.com, narmstrong@baylibre.com, msp@baylibre.com,
j-keerthy@ti.com, linux-kernel@vger.kernel.org,
devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [RFC PATCH 3/5] regulator: drivers: Add TI TPS65219 PMIC regulators support
Date: Mon, 13 Jun 2022 14:04:17 +0100 [thread overview]
Message-ID: <Yqc10QuvjQ1e/ivw@sirena.org.uk> (raw)
In-Reply-To: <20220613090604.9975-4-jneanne@baylibre.com>
[-- Attachment #1: Type: text/plain, Size: 1909 bytes --]
On Mon, Jun 13, 2022 at 11:06:02AM +0200, Jerome NEANNE wrote:
> +static int tps65219_pmic_enable(struct regulator_dev *dev)
> +{
> + struct tps65219 *tps = rdev_get_drvdata(dev);
> + int rid = rdev_get_id(dev);
> + int ret;
> +
> +
> +
Lots of random blank space here.
> + if (rid < TPS65219_BUCK_1 || rid > TPS65219_LDO_4)
> + return -EINVAL;
> +
If a regulator doesn't support an operation it shouldn't be providing
it, no need to check here.
> + ret = tps65219_set_bits(tps, dev->desc->enable_reg,
> + dev->desc->enable_mask, dev->desc->enable_mask);
If you provide the regmap to the child devices then this can use the
standard regmap helpers for most of the operations, meaning most of
the operations in the driver can be removed.
> +/* generic regulator_set_bypass_regmap does not match requirements use custom instead */
In what way? Please also try to keep within 80 columns normally.
> + if (dev->desc->ops->is_enabled) {
> + dev_err(tps->dev, "%s LDO%d is enabled, should be shut down to set bypass ",
> + __func__, rid);
> + return -EBUSY;
> + }
This is testing if there is an enable operation, not if the regulator is
enabled.
> + if (enable) {
> + dev_dbg(tps->dev, "%s, LDO%d already in bypass mode", __func__, rid);
> + return ret;
> + }
This is not a problem, just silently succeed.
> + /* Allocate memory for strobes */
> + tps->strobes = devm_kcalloc(&pdev->dev,
> + TPS65219_NUM_REGULATOR, sizeof(u8),
> + GFP_KERNEL);
> + if (!tps->strobes)
> + return -ENOMEM;
These are never referenced anywhere else in the driver, no need to
allocate them.
> + ret = regmap_read(tps->regmap, regulators[i].bypass_reg, &val);
> + if (ret) {
> + dev_err(tps->dev, "dev_err failed to map register for %s regulator\n",
> + pdev->name);
> + return ret;
> + }
I'm not clear what this check is intended to do, it at least needs to be
better documented.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2022-06-13 17:42 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-13 9:05 [RFC PATCH 0/5] Add TI TPS65219 PMIC support for AM642 SK board Jerome NEANNE
2022-06-13 9:06 ` [RFC PATCH 1/5] regulator: dt-bindings: Add TI TPS65219 PMIC bindings Jerome NEANNE
2022-06-16 17:52 ` Rob Herring
2022-06-13 9:06 ` [RFC PATCH 2/5] mfd: drivers: Add TI TPS65219 PMIC support Jerome NEANNE
2022-06-13 12:57 ` Mark Brown
2022-06-14 21:03 ` Kevin Hilman
2022-06-13 9:06 ` [RFC PATCH 3/5] regulator: drivers: Add TI TPS65219 PMIC regulators support Jerome NEANNE
2022-06-13 13:04 ` Mark Brown [this message]
2022-06-13 9:06 ` [RFC PATCH 4/5] arm64: Kconfig: Introduce CONFIG_MFD_TPS65219 and CONFIG_REGULATOR_TPS65219 Jerome NEANNE
2022-06-13 9:06 ` [RFC PATCH 5/5] arm64: dts: ti: Add TI TPS65219 PMIC support for AM642 SK board Jerome NEANNE
2022-06-13 13:06 ` Mark Brown
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=Yqc10QuvjQ1e/ivw@sirena.org.uk \
--to=broonie@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=j-keerthy@ti.com \
--cc=jneanne@baylibre.com \
--cc=khilman@baylibre.com \
--cc=kristo@kernel.org \
--cc=lee.jones@linaro.org \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=msp@baylibre.com \
--cc=narmstrong@baylibre.com \
--cc=nm@ti.com \
--cc=robh+dt@kernel.org \
--cc=will@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
all inboxes | Powered by JetHome®