public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] regulator: sc2731: Fix defines for SC2731_WR_UNLOCK and SC2731_PWR_WR_PROT_VALUE
@ 2017-12-29  6:12 Axel Lin
  2018-01-01  6:14 ` Erick Chen
  0 siblings, 1 reply; 2+ messages in thread
From: Axel Lin @ 2017-12-29  6:12 UTC (permalink / raw)
  To: Mark Brown; +Cc: Erick Chen, Baolin Wang, Liam Girdwood, linux-kernel, Axel Lin

The define for SC2731_WR_UNLOCK and SC2731_PWR_WR_PROT_VALUE are
swapped, so the code calling regmap_write() looks strange. Fix it.
regmap_write takes reg parameter first then val.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
Hi Erick,
I don't have the datasheet. Can you check this?
Thanks,
Axel
 drivers/regulator/sc2731-regulator.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/regulator/sc2731-regulator.c b/drivers/regulator/sc2731-regulator.c
index 794fcd504b3d..7f2b137bb98a 100644
--- a/drivers/regulator/sc2731-regulator.c
+++ b/drivers/regulator/sc2731-regulator.c
@@ -13,8 +13,8 @@
 /*
  * SC2731 regulator lock register
  */
-#define SC2731_PWR_WR_PROT_VALUE	0xf0c
-#define SC2731_WR_UNLOCK		0x6e7f
+#define SC2731_WR_UNLOCK		0xf0c
+#define SC2731_PWR_WR_PROT_VALUE	0x6e7f
 
 /*
  * SC2731 enable register
@@ -203,8 +203,8 @@ static struct regulator_desc regulators[] = {
 
 static int sc2731_regulator_unlock(struct regmap *regmap)
 {
-	return regmap_write(regmap, SC2731_PWR_WR_PROT_VALUE,
-			    SC2731_WR_UNLOCK);
+	return regmap_write(regmap, SC2731_WR_UNLOCK,
+			    SC2731_PWR_WR_PROT_VALUE);
 }
 
 static int sc2731_regulator_probe(struct platform_device *pdev)
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] regulator: sc2731: Fix defines for SC2731_WR_UNLOCK and SC2731_PWR_WR_PROT_VALUE
  2017-12-29  6:12 [PATCH] regulator: sc2731: Fix defines for SC2731_WR_UNLOCK and SC2731_PWR_WR_PROT_VALUE Axel Lin
@ 2018-01-01  6:14 ` Erick Chen
  0 siblings, 0 replies; 2+ messages in thread
From: Erick Chen @ 2018-01-01  6:14 UTC (permalink / raw)
  To: Axel Lin; +Cc: Mark Brown, Baolin Wang, Liam Girdwood, linux-kernel

Hi Axel,

O 五, 12月 29, 2017 at 02:12:18下午 +0800, Axel Lin wrote:
> The define for SC2731_WR_UNLOCK and SC2731_PWR_WR_PROT_VALUE are
> swapped, so the code calling regmap_write() looks strange. Fix it.
> regmap_write takes reg parameter first then val.
> 
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
> ---
> Hi Erick,
> I don't have the datasheet. Can you check this?

These definitions are following our datasheet's naming rule, may seem
puzzling. And your patch could be better, my suggestions are as follows.
Thanks,

> Thanks,
> Axel
>  drivers/regulator/sc2731-regulator.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/regulator/sc2731-regulator.c b/drivers/regulator/sc2731-regulator.c
> index 794fcd504b3d..7f2b137bb98a 100644
> --- a/drivers/regulator/sc2731-regulator.c
> +++ b/drivers/regulator/sc2731-regulator.c
> @@ -13,8 +13,8 @@
>  /*
>   * SC2731 regulator lock register
>   */
> -#define SC2731_PWR_WR_PROT_VALUE	0xf0c
> -#define SC2731_WR_UNLOCK		0x6e7f
> +#define SC2731_WR_UNLOCK		0xf0c
> +#define SC2731_PWR_WR_PROT_VALUE	0x6e7f

#define SC2731_PWR_WR_PROT		0xf0c
#define SC2731_WR_UNLOCK_VALUE		0x6e7f

>  /*
>   * SC2731 enable register
> @@ -203,8 +203,8 @@ static struct regulator_desc regulators[] = {
>  
>  static int sc2731_regulator_unlock(struct regmap *regmap)
>  {
> -	return regmap_write(regmap, SC2731_PWR_WR_PROT_VALUE,
> -			    SC2731_WR_UNLOCK);
> +	return regmap_write(regmap, SC2731_WR_UNLOCK,
> +			    SC2731_PWR_WR_PROT_VALUE);

return regmap_write(regmap, SC2731_PWR_WR_PROT,
			SC2731_WR_UNLOCK_VALUE);

>  }
>  
>  static int sc2731_regulator_probe(struct platform_device *pdev)
> -- 
> 2.14.1
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-01-01  6:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-29  6:12 [PATCH] regulator: sc2731: Fix defines for SC2731_WR_UNLOCK and SC2731_PWR_WR_PROT_VALUE Axel Lin
2018-01-01  6:14 ` Erick Chen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox