public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Marek Szyprowski <m.szyprowski@samsung.com>
To: Axel Lin <axel.lin@ingics.com>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>,
	Pawel Moll <pawel.moll@arm.com>, Liam Girdwood <lrg@ti.com>,
	linux-kernel@vger.kernel.org, Chris Ball <cjb@laptop.org>,
	Kevin Liu <keyuan.liu@gmail.com>
Subject: Re: [PATCH RFC/RFT] regulator: core: Fix continuous_voltage_range case in regulator_can_change_voltage
Date: Thu, 13 Dec 2012 09:56:25 +0100	[thread overview]
Message-ID: <50C99839.1040803@samsung.com> (raw)
In-Reply-To: <1355275366.11924.2.camel@phoenix>

Hello,

On 12/12/2012 2:22 AM, Axel Lin wrote:
> Regulator drivers with continuous_voltage_range flag set allows not setting
> n_voltages. Thus if continuous_voltage_range is set, check the constraint range
> instead.
>
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
> ---
>   drivers/regulator/core.c |   12 +++++++++---
>   1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
> index 0f65b24..d7448ad 100644
> --- a/drivers/regulator/core.c
> +++ b/drivers/regulator/core.c
> @@ -1885,9 +1885,15 @@ int regulator_can_change_voltage(struct regulator *regulator)
>   	struct regulator_dev	*rdev = regulator->rdev;
>
>   	if (rdev->constraints &&
> -	    rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_VOLTAGE &&
> -	    (rdev->desc->n_voltages - rdev->desc->linear_min_sel) > 1)
> -		return 1;
> +	    (rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_VOLTAGE)) {
> +		if (rdev->desc->n_voltages - rdev->desc->linear_min_sel > 1)
> +			return 1;
> +
> +		if (rdev->desc->continuous_voltage_range &&
> +		    rdev->constraints->min_uV && rdev->constraints->max_uV &&
> +		    rdev->constraints->min_uV != rdev->constraints->max_uV)
> +			return 1;
> +	}
>
>   	return 0;
>   }
>

This change looks reasonable, I've missed the fact that there is a
support for regulators with continuous voltage range. This change also
shows that the n_voltages based workaround used earlier by mmc core was
indeed only a hack and regulator_can_change_voltage() approach is much
cleaner solution.

Best regards
-- 
Marek Szyprowski
Samsung Poland R&D Center


  reply	other threads:[~2012-12-13  8:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-12  1:22 [PATCH RFC/RFT] regulator: core: Fix continuous_voltage_range case in regulator_can_change_voltage Axel Lin
2012-12-13  8:56 ` Marek Szyprowski [this message]
2012-12-13  8:59   ` Mark Brown
2012-12-24 16:31 ` 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=50C99839.1040803@samsung.com \
    --to=m.szyprowski@samsung.com \
    --cc=axel.lin@ingics.com \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=cjb@laptop.org \
    --cc=keyuan.liu@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lrg@ti.com \
    --cc=pawel.moll@arm.com \
    /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