public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Matti Vaittinen <mazziesaccount@gmail.com>
To: Chen-Yu Tsai <wenst@chromium.org>,
	Mark Brown <broonie@kernel.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Manivannan Sadhasivam <mani@kernel.org>,
	Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
Cc: linux-actions@lists.infradead.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] regulator: Use bitfield values for range selectors
Date: Thu, 8 Jun 2023 11:30:32 +0300	[thread overview]
Message-ID: <775471c6-7a68-938d-3641-6eb2a0f055f2@gmail.com> (raw)
In-Reply-To: <20230608075651.3214540-1-wenst@chromium.org>

On 6/8/23 10:56, Chen-Yu Tsai wrote:
> Right now the regulator helpers expect raw register values for the range
> selectors. This is different from the voltage selectors, which are
> normalized as bitfield values. This leads to a bit of confusion. Also,
> raw values are harder to copy from datasheets or match up with them,
> as datasheets will typically have bitfield values.
> 
> Make the helpers expect bitfield values, and convert existing users.
> Include bitops.h explicitly for ffs(), and reorder the header include
> statements. While at it, also replace module.h with export.h, since the
> only use is EXPORT_SYMBOL_GPL.
> 
> Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
> ---
>   drivers/regulator/atc260x-regulator.c  | 2 +-
>   drivers/regulator/bd718x7-regulator.c  | 8 ++++----
>   drivers/regulator/helpers.c            | 9 ++++++---
>   drivers/regulator/tps6287x-regulator.c | 2 +-
>   4 files changed, 12 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/regulator/atc260x-regulator.c b/drivers/regulator/atc260x-regulator.c
> index 87e237d740bc..0bba33955a1a 100644
> --- a/drivers/regulator/atc260x-regulator.c
> +++ b/drivers/regulator/atc260x-regulator.c
> @@ -37,7 +37,7 @@ static const struct linear_range atc2609a_ldo_voltage_ranges1[] = {
>   };
>   
>   static const unsigned int atc260x_ldo_voltage_range_sel[] = {
> -	0x0, 0x20,
> +	0x0, 0x1,
>   };
>   
>   static int atc260x_dcdc_set_voltage_time_sel(struct regulator_dev *rdev,
> diff --git a/drivers/regulator/bd718x7-regulator.c b/drivers/regulator/bd718x7-regulator.c
> index b0b9938c20a1..da1eea1207e5 100644
> --- a/drivers/regulator/bd718x7-regulator.c
> +++ b/drivers/regulator/bd718x7-regulator.c
> @@ -289,7 +289,7 @@ static const struct linear_range bd71837_buck5_volts[] = {
>    * and 0x1 for last 3 ranges.
>    */
>   static const unsigned int bd71837_buck5_volt_range_sel[] = {
> -	0x0, 0x0, 0x0, 0x80, 0x80, 0x80
> +	0x0, 0x0, 0x0, 0x1, 0x1, 0x1
>   };
>   
>   /*
> @@ -309,7 +309,7 @@ static const struct linear_range bd71847_buck3_volts[] = {
>   };
>   
>   static const unsigned int bd71847_buck3_volt_range_sel[] = {
> -	0x0, 0x0, 0x0, 0x40, 0x80, 0x80, 0x80
> +	0x0, 0x0, 0x0, 0x1, 0x2, 0x2, 0x2
>   };
>   
>   static const struct linear_range bd71847_buck4_volts[] = {
> @@ -360,7 +360,7 @@ static const struct linear_range bd718xx_ldo1_volts[] = {
>   	REGULATOR_LINEAR_RANGE(1600000, 0x00, 0x03, 100000),
>   };

Shouldn't the
static const unsigned int bd71847_buck4_volt_range_sel[] = { 0x0, 0x40 };

be also converted to { 0x0, 0x1 }? The range mask seems to be:
#define BD71847_BUCK4_RANGE_MASK        0x40

Other than that - the helpers + bd718x7 look good to me.

Yours,
	-- Matti

-- 
Matti Vaittinen
Linux kernel developer at ROHM Semiconductors
Oulu Finland

~~ When things go utterly wrong vim users can always type :help! ~~


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

  reply	other threads:[~2023-06-08  8:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-08  7:56 [PATCH] regulator: Use bitfield values for range selectors Chen-Yu Tsai
2023-06-08  8:30 ` Matti Vaittinen [this message]
2023-06-09 10:45 ` Matti Vaittinen
2023-06-09 10:53   ` Mark Brown
2023-06-09 11:00     ` Matti Vaittinen

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=775471c6-7a68-938d-3641-6eb2a0f055f2@gmail.com \
    --to=mazziesaccount@gmail.com \
    --cc=broonie@kernel.org \
    --cc=cristian.ciocaltea@gmail.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-actions@lists.infradead.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mani@kernel.org \
    --cc=wenst@chromium.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