All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: AngeloGioacchino Del Regno  <angelogioacchino.delregno@collabora.com>
Cc: lgirdwood@gmail.com, robh+dt@kernel.org,
	krzysztof.kozlowski+dt@linaro.org, matthias.bgg@gmail.com,
	linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org
Subject: Re: [PATCH 2/4] regulator: Add driver for MT6331 PMIC regulators
Date: Fri, 20 May 2022 15:45:29 +0100	[thread overview]
Message-ID: <YoepiTUfdhkYByo7@sirena.org.uk> (raw)
In-Reply-To: <20220520133305.265310-3-angelogioacchino.delregno@collabora.com>

[-- Attachment #1: Type: text/plain, Size: 1477 bytes --]

On Fri, May 20, 2022 at 03:33:03PM +0200, AngeloGioacchino Del Regno wrote:

> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Copyright (c) 2022 Collabora Ltd.
> + * Author: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> + *

Please make the entire comment a C++ one so things look more
intentional.

> +static const unsigned int ldo_volt_table10[] = {
> +	1200000, 1300000, 1500000, 1800000,
> +	1200000, 1300000, 1500000, 1800000,
> +	1200000, 1300000, 1500000, 1800000,
> +	1200000, 1300000, 1500000, 1800000,
> +};

So the top bits of the voltate selection field just get ignored?  Might
be easier to just write the code to not include the top bits.

> +static int mt6331_get_status(struct regulator_dev *rdev)
> +{
> +	struct mt6331_regulator_info *info = rdev_get_drvdata(rdev);
> +	u32 reg, en_mask, regval;
> +	int ret;
> +
> +	if (info->qi > 0) {
> +		reg = info->desc.enable_reg;
> +		en_mask = info->qi;

If the regulator doesn't have status readback it shouldn't provide a
get_status() operation.

> +static int mt6331_ldo_set_mode(struct regulator_dev *rdev, unsigned int mode)
> +{
> +	int ret, val = 0;
> +	struct mt6331_regulator_info *info = rdev_get_drvdata(rdev);
> +
> +	if (!info->modeset_mask) {
> +		dev_err(&rdev->dev, "regulator %s doesn't support set_mode\n",
> +			info->desc.name);
> +		return -EINVAL;
> +	}

Just don't provide the operation for these regulators then.  That'll
mean a separate ops struct but that's fine.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Mark Brown <broonie@kernel.org>
To: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Cc: lgirdwood@gmail.com, robh+dt@kernel.org,
	krzysztof.kozlowski+dt@linaro.org, matthias.bgg@gmail.com,
	linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org
Subject: Re: [PATCH 2/4] regulator: Add driver for MT6331 PMIC regulators
Date: Fri, 20 May 2022 15:45:29 +0100	[thread overview]
Message-ID: <YoepiTUfdhkYByo7@sirena.org.uk> (raw)
In-Reply-To: <20220520133305.265310-3-angelogioacchino.delregno@collabora.com>


[-- Attachment #1.1: Type: text/plain, Size: 1477 bytes --]

On Fri, May 20, 2022 at 03:33:03PM +0200, AngeloGioacchino Del Regno wrote:

> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Copyright (c) 2022 Collabora Ltd.
> + * Author: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> + *

Please make the entire comment a C++ one so things look more
intentional.

> +static const unsigned int ldo_volt_table10[] = {
> +	1200000, 1300000, 1500000, 1800000,
> +	1200000, 1300000, 1500000, 1800000,
> +	1200000, 1300000, 1500000, 1800000,
> +	1200000, 1300000, 1500000, 1800000,
> +};

So the top bits of the voltate selection field just get ignored?  Might
be easier to just write the code to not include the top bits.

> +static int mt6331_get_status(struct regulator_dev *rdev)
> +{
> +	struct mt6331_regulator_info *info = rdev_get_drvdata(rdev);
> +	u32 reg, en_mask, regval;
> +	int ret;
> +
> +	if (info->qi > 0) {
> +		reg = info->desc.enable_reg;
> +		en_mask = info->qi;

If the regulator doesn't have status readback it shouldn't provide a
get_status() operation.

> +static int mt6331_ldo_set_mode(struct regulator_dev *rdev, unsigned int mode)
> +{
> +	int ret, val = 0;
> +	struct mt6331_regulator_info *info = rdev_get_drvdata(rdev);
> +
> +	if (!info->modeset_mask) {
> +		dev_err(&rdev->dev, "regulator %s doesn't support set_mode\n",
> +			info->desc.name);
> +		return -EINVAL;
> +	}

Just don't provide the operation for these regulators then.  That'll
mean a separate ops struct but that's fine.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 170 bytes --]

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

WARNING: multiple messages have this Message-ID (diff)
From: Mark Brown <broonie@kernel.org>
To: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Cc: lgirdwood@gmail.com, robh+dt@kernel.org,
	krzysztof.kozlowski+dt@linaro.org, matthias.bgg@gmail.com,
	linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org
Subject: Re: [PATCH 2/4] regulator: Add driver for MT6331 PMIC regulators
Date: Fri, 20 May 2022 15:45:29 +0100	[thread overview]
Message-ID: <YoepiTUfdhkYByo7@sirena.org.uk> (raw)
In-Reply-To: <20220520133305.265310-3-angelogioacchino.delregno@collabora.com>


[-- Attachment #1.1: Type: text/plain, Size: 1477 bytes --]

On Fri, May 20, 2022 at 03:33:03PM +0200, AngeloGioacchino Del Regno wrote:

> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Copyright (c) 2022 Collabora Ltd.
> + * Author: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> + *

Please make the entire comment a C++ one so things look more
intentional.

> +static const unsigned int ldo_volt_table10[] = {
> +	1200000, 1300000, 1500000, 1800000,
> +	1200000, 1300000, 1500000, 1800000,
> +	1200000, 1300000, 1500000, 1800000,
> +	1200000, 1300000, 1500000, 1800000,
> +};

So the top bits of the voltate selection field just get ignored?  Might
be easier to just write the code to not include the top bits.

> +static int mt6331_get_status(struct regulator_dev *rdev)
> +{
> +	struct mt6331_regulator_info *info = rdev_get_drvdata(rdev);
> +	u32 reg, en_mask, regval;
> +	int ret;
> +
> +	if (info->qi > 0) {
> +		reg = info->desc.enable_reg;
> +		en_mask = info->qi;

If the regulator doesn't have status readback it shouldn't provide a
get_status() operation.

> +static int mt6331_ldo_set_mode(struct regulator_dev *rdev, unsigned int mode)
> +{
> +	int ret, val = 0;
> +	struct mt6331_regulator_info *info = rdev_get_drvdata(rdev);
> +
> +	if (!info->modeset_mask) {
> +		dev_err(&rdev->dev, "regulator %s doesn't support set_mode\n",
> +			info->desc.name);
> +		return -EINVAL;
> +	}

Just don't provide the operation for these regulators then.  That'll
mean a separate ops struct but that's fine.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2022-05-20 14:45 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-20 13:33 [PATCH 0/4] MediaTek Helio X10 MT6795 - MT6331/6332 Regulators AngeloGioacchino Del Regno
2022-05-20 13:33 ` AngeloGioacchino Del Regno
2022-05-20 13:33 ` AngeloGioacchino Del Regno
2022-05-20 13:33 ` [PATCH 1/4] dt-bindings: regulator: Add bindings for MT6331 regulator AngeloGioacchino Del Regno
2022-05-20 13:33   ` AngeloGioacchino Del Regno
2022-05-20 13:33   ` AngeloGioacchino Del Regno
2022-05-21 14:40   ` Krzysztof Kozlowski
2022-05-21 14:40     ` Krzysztof Kozlowski
2022-05-21 14:40     ` Krzysztof Kozlowski
2022-05-20 13:33 ` [PATCH 2/4] regulator: Add driver for MT6331 PMIC regulators AngeloGioacchino Del Regno
2022-05-20 13:33   ` AngeloGioacchino Del Regno
2022-05-20 13:33   ` AngeloGioacchino Del Regno
2022-05-20 14:45   ` Mark Brown [this message]
2022-05-20 14:45     ` Mark Brown
2022-05-20 14:45     ` Mark Brown
2022-05-23 12:49     ` AngeloGioacchino Del Regno
2022-05-23 12:49       ` AngeloGioacchino Del Regno
2022-05-23 12:49       ` AngeloGioacchino Del Regno
2022-05-23 13:00       ` Mark Brown
2022-05-23 13:00         ` Mark Brown
2022-05-23 13:00         ` Mark Brown
2022-05-23 13:22         ` AngeloGioacchino Del Regno
2022-05-23 13:22           ` AngeloGioacchino Del Regno
2022-05-23 13:22           ` AngeloGioacchino Del Regno
2022-05-23 13:43           ` Mark Brown
2022-05-23 13:43             ` Mark Brown
2022-05-23 13:43             ` Mark Brown
2022-05-23 13:53             ` AngeloGioacchino Del Regno
2022-05-23 13:53               ` AngeloGioacchino Del Regno
2022-05-23 13:53               ` AngeloGioacchino Del Regno
2022-05-20 13:33 ` [PATCH 3/4] dt-bindings: regulator: Add bindings for MT6332 regulator AngeloGioacchino Del Regno
2022-05-20 13:33   ` AngeloGioacchino Del Regno
2022-05-20 13:33   ` AngeloGioacchino Del Regno
2022-05-21 14:40   ` Krzysztof Kozlowski
2022-05-21 14:40     ` Krzysztof Kozlowski
2022-05-21 14:40     ` Krzysztof Kozlowski
2022-05-20 13:33 ` [PATCH 4/4] regulator: Add driver for MT6332 PMIC regulators AngeloGioacchino Del Regno
2022-05-20 13:33   ` AngeloGioacchino Del Regno
2022-05-20 13:33   ` AngeloGioacchino Del Regno

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=YoepiTUfdhkYByo7@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=devicetree@vger.kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=robh+dt@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 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.