Skip to contentSkip to conversation

regulator: fan53880: Fix missing n_voltages setting

PATCH Superseded Axel Lin 2 participants 3 messages May 17, 2021 Voltage and current regulator framework

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/2 regulator: fan53880: Fix missing n_voltages setting

Fixes e6dea51e2d41 ("regulator: fan53880: Add initial support")
---
 drivers/regulator/fan53880.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/regulator/fan53880.c +3 -0
index e83eb4fb1876..e26a1420c6c5 100644
@@ -51,6 +51,7 @@ static const struct regulator_ops fan53880_ops = {
 		      REGULATOR_LINEAR_RANGE(800000, 0xf, 0x73, 25000),	\
 		},							\
 		.n_linear_ranges = 2,					\
+		.n_voltages = 0x74,					\
 		.vsel_reg =	   FAN53880_LDO ## _num ## VOUT,	\
 		.vsel_mask =	   0x7f,				\
 		.enable_reg =	   FAN53880_ENABLE,			\
@@ -76,6 +77,7 @@ static const struct regulator_desc fan53880_regulators[] = {
 		      REGULATOR_LINEAR_RANGE(600000, 0x1f, 0xf7, 12500),
 		},
 		.n_linear_ranges = 2,
+		.n_voltages = 0xf8,
 		.vsel_reg =	   FAN53880_BUCKVOUT,
 		.vsel_mask =	   0x7f,
 		.enable_reg =	   FAN53880_ENABLE,
@@ -95,6 +97,7 @@ static const struct regulator_desc fan53880_regulators[] = {
 		      REGULATOR_LINEAR_RANGE(3000000, 0x4, 0x70, 25000),
 		},
 		.n_linear_ranges = 2,
+		.n_voltages = 0x71,
 		.vsel_reg =	   FAN53880_BOOSTVOUT,
 		.vsel_mask =	   0x7f,
 		.enable_reg =	   FAN53880_ENABLE_BOOST,
Signature · 1 line
2.25.1
author
#1 lore raw

PATCH 2/2 regulator: fan53880: Convert to use .probe_new

Use the new .probe_new for fan53880.

---
 drivers/regulator/fan53880.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/regulator/fan53880.c +2 -3
index e26a1420c6c5..d7a1bdded8d0 100644
@@ -114,8 +114,7 @@ static const struct regmap_config fan53880_regmap = {
 	.max_register = FAN53880_ENABLE_BOOST,
 };
 
-static int fan53880_i2c_probe(struct i2c_client *i2c,
-			     const struct i2c_device_id *id)
+static int fan53880_i2c_probe(struct i2c_client *i2c)
 {
 	struct regulator_config config = { };
 	struct regulator_dev *rdev;
@@ -177,7 +176,7 @@ static struct i2c_driver fan53880_regulator_driver = {
 		.name = "fan53880",
 		.of_match_table	= of_match_ptr(fan53880_dt_ids),
 	},
-	.probe = fan53880_i2c_probe,
+	.probe_new = fan53880_i2c_probe,
 	.id_table = fan53880_i2c_id,
 };
 module_i2c_driver(fan53880_regulator_driver);
Signature · 1 line
2.25.1
#2 lore raw
In reply to Axel Lin

Hi Axel,

thanks for your input. Please see my comments below.

Quoted 2 lines · Axel Lin
Fixes e6dea51e2d41 ("regulator: fan53880: Add initial support")

Could you add a simple explanation? "Necessary for list_voltage() ops"?

drivers/regulator/fan53880.c static const struct regulator_ops fan53880_ops = { · line 54

Quoted 13 lines
---
 drivers/regulator/fan53880.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/regulator/fan53880.c +1 -0
index e83eb4fb1876..e26a1420c6c5 100644
@@ -51,6 +51,7 @@ static const struct regulator_ops fan53880_ops = {
 		      REGULATOR_LINEAR_RANGE(800000, 0xf, 0x73, 25000),	\
 		},							\
 		.n_linear_ranges = 2,					\
+		.n_voltages = 0x74,					\

Could you add a tab and spaces to keep the alignment?

drivers/regulator/fan53880.c static const struct regulator_desc · line 81

Quoted 9 lines
drivers/regulator/fan53880.c +1 -0
 		.vsel_reg =	   FAN53880_LDO ## _num ## VOUT,	\
 		.vsel_mask =	   0x7f,				\
 		.enable_reg =	   FAN53880_ENABLE,			\
@@ -76,6 +77,7 @@ static const struct regulator_desc
 fan53880_regulators[] = {
 		      REGULATOR_LINEAR_RANGE(600000, 0x1f, 0xf7, 12500),
 		},
 		.n_linear_ranges = 2,
+		.n_voltages = 0xf8,

dito

drivers/regulator/fan53880.c static const struct regulator_desc · line 101

Quoted 9 lines
drivers/regulator/fan53880.c +0 -0
 		.vsel_reg =	   FAN53880_BUCKVOUT,
 		.vsel_mask =	   0x7f,
drivers/regulator/fan53880.c +1 -0
 		.enable_reg =	   FAN53880_ENABLE,
@@ -95,6 +97,7 @@ static const struct regulator_desc
 fan53880_regulators[] = {
 		      REGULATOR_LINEAR_RANGE(3000000, 0x4, 0x70, 25000),
 		},
 		.n_linear_ranges = 2,
+		.n_voltages = 0x71,

dito

Quoted 3 lines
drivers/regulator/fan53880.c +0 -0
 		.vsel_reg =	   FAN53880_BOOSTVOUT,
 		.vsel_mask =	   0x7f,

.enable_reg = FAN53880_ENABLE_BOOST,