Skip to contentSkip to conversation

regulator: sc2731: Fix defines for SC2731_WR_UNLOCK and SC2731_PWR_WR_PROT_VALUE

PATCH Superseded Axel Lin 2 participants 2 messages Dec 29, 2017 – Jan 1, 2018

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 regulator: sc2731: Fix defines for SC2731_WR_UNLOCK and SC2731_PWR_WR_PROT_VALUE

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.

---
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(-)
drivers/regulator/sc2731-regulator.c +4 -4
index 794fcd504b3d..7f2b137bb98a 100644
@@ -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)
Signature · 1 line
2.14.1
#1 lore raw

Hi Axel,

Quoted 8 lines · 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.

---
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,

Quoted 10 lines

Thanks,
Axel

 drivers/regulator/sc2731-regulator.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/regulator/sc2731-regulator.c +0 -0
index 794fcd504b3d..7f2b137bb98a 100644

drivers/regulator/sc2731-regulator.c line 17

Quoted 7 lines
drivers/regulator/sc2731-regulator.c +2 -2
@@ -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

drivers/regulator/sc2731-regulator.c static struct regulator_desc regulators[] = { · line 207

Quoted 10 lines
drivers/regulator/sc2731-regulator.c +2 -2
 /*
  * 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);
Quoted 6 lines
drivers/regulator/sc2731-regulator.c +0 -0
 }
 
 static int sc2731_regulator_probe(struct platform_device *pdev)
Signature · 1 line
2.14.1