aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--Documentation/devicetree/bindings/regulator/maxim,max20086.yaml1
-rw-r--r--Documentation/devicetree/bindings/regulator/maxim,max77826.yaml2
-rw-r--r--Documentation/devicetree/bindings/regulator/onnn,fan53880.yaml2
-rw-r--r--drivers/regulator/fan53555.c9
-rw-r--r--drivers/regulator/ltc3589.c61
-rw-r--r--drivers/regulator/max20086-regulator.c65
-rw-r--r--drivers/regulator/mc13xxx.h2
-rw-r--r--drivers/regulator/mp5416.c10
-rw-r--r--drivers/regulator/mp886x.c14
-rw-r--r--drivers/regulator/pv88080-regulator.c58
-rw-r--r--drivers/regulator/rk808-regulator.c2
-rw-r--r--drivers/regulator/sy8824x.c26
12 files changed, 98 insertions, 154 deletions
diff --git a/Documentation/devicetree/bindings/regulator/maxim,max20086.yaml b/Documentation/devicetree/bindings/regulator/maxim,max20086.yaml
index 05f72391185e..7394c0a339c5 100644
--- a/Documentation/devicetree/bindings/regulator/maxim,max20086.yaml
+++ b/Documentation/devicetree/bindings/regulator/maxim,max20086.yaml
@@ -43,6 +43,7 @@ properties:
"^OUT[1-4]$":
type: object
$ref: regulator.yaml#
+ unevaluatedProperties: false
additionalProperties: false
diff --git a/Documentation/devicetree/bindings/regulator/maxim,max77826.yaml b/Documentation/devicetree/bindings/regulator/maxim,max77826.yaml
index 78c0b63243f7..6d6bbfbd26d4 100644
--- a/Documentation/devicetree/bindings/regulator/maxim,max77826.yaml
+++ b/Documentation/devicetree/bindings/regulator/maxim,max77826.yaml
@@ -30,10 +30,12 @@ properties:
"^LDO([1-9]|1[0-5])$":
type: object
$ref: regulator.yaml#
+ unevaluatedProperties: false
"^BUCK|BUCKBOOST$":
type: object
$ref: regulator.yaml#
+ unevaluatedProperties: false
additionalProperties: false
diff --git a/Documentation/devicetree/bindings/regulator/onnn,fan53880.yaml b/Documentation/devicetree/bindings/regulator/onnn,fan53880.yaml
index eb61e04ef852..b5181719daa1 100644
--- a/Documentation/devicetree/bindings/regulator/onnn,fan53880.yaml
+++ b/Documentation/devicetree/bindings/regulator/onnn,fan53880.yaml
@@ -48,10 +48,12 @@ properties:
"^LDO[1-4]$":
type: object
$ref: regulator.yaml#
+ unevaluatedProperties: false
"^BUCK|BOOST$":
type: object
$ref: regulator.yaml#
+ unevaluatedProperties: false
additionalProperties: false
diff --git a/drivers/regulator/fan53555.c b/drivers/regulator/fan53555.c
index 48f312167e53..17c9bf204385 100644
--- a/drivers/regulator/fan53555.c
+++ b/drivers/regulator/fan53555.c
@@ -659,7 +659,6 @@ MODULE_DEVICE_TABLE(of, fan53555_dt_ids);
static int fan53555_regulator_probe(struct i2c_client *client)
{
- const struct i2c_device_id *id = i2c_client_get_device_id(client);
struct device_node *np = client->dev.of_node;
struct fan53555_device_info *di;
struct fan53555_platform_data *pdata;
@@ -682,10 +681,8 @@ static int fan53555_regulator_probe(struct i2c_client *client)
"Platform data not found!\n");
di->regulator = pdata->regulator;
- if (client->dev.of_node) {
- di->vendor =
- (unsigned long)of_device_get_match_data(&client->dev);
- } else {
+ di->vendor = (uintptr_t)i2c_get_match_data(client);
+ if (!dev_fwnode(&client->dev)) {
/* if no ramp constraint set, get the pdata ramp_delay */
if (!di->regulator->constraints.ramp_delay) {
if (pdata->slew_rate >= ARRAY_SIZE(slew_rates))
@@ -695,8 +692,6 @@ static int fan53555_regulator_probe(struct i2c_client *client)
di->regulator->constraints.ramp_delay
= slew_rates[pdata->slew_rate];
}
-
- di->vendor = id->driver_data;
}
regmap = devm_regmap_init_i2c(client, &fan53555_regmap_config);
diff --git a/drivers/regulator/ltc3589.c b/drivers/regulator/ltc3589.c
index d892c2a5df7b..3f70c2225dba 100644
--- a/drivers/regulator/ltc3589.c
+++ b/drivers/regulator/ltc3589.c
@@ -58,12 +58,6 @@
#define LTC3589_VRRCR_SW3_RAMP_MASK GENMASK(5, 4)
#define LTC3589_VRRCR_LDO2_RAMP_MASK GENMASK(7, 6)
-enum ltc3589_variant {
- LTC3589,
- LTC3589_1,
- LTC3589_2,
-};
-
enum ltc3589_reg {
LTC3589_SW1,
LTC3589_SW2,
@@ -76,10 +70,14 @@ enum ltc3589_reg {
LTC3589_NUM_REGULATORS,
};
+struct ltc3589_info {
+ const unsigned int *volt_table;
+ int fixed_uV;
+};
+
struct ltc3589 {
struct regmap *regmap;
struct device *dev;
- enum ltc3589_variant variant;
struct regulator_desc regulator_descs[LTC3589_NUM_REGULATORS];
struct regulator_dev *regulators[LTC3589_NUM_REGULATORS];
};
@@ -379,8 +377,8 @@ static irqreturn_t ltc3589_isr(int irq, void *dev_id)
static int ltc3589_probe(struct i2c_client *client)
{
- const struct i2c_device_id *id = i2c_client_get_device_id(client);
struct device *dev = &client->dev;
+ const struct ltc3589_info *info;
struct regulator_desc *descs;
struct ltc3589 *ltc3589;
int i, ret;
@@ -390,21 +388,13 @@ static int ltc3589_probe(struct i2c_client *client)
return -ENOMEM;
i2c_set_clientdata(client, ltc3589);
- if (client->dev.of_node)
- ltc3589->variant = (uintptr_t)of_device_get_match_data(&client->dev);
- else
- ltc3589->variant = id->driver_data;
+ info = i2c_get_match_data(client);
ltc3589->dev = dev;
descs = ltc3589->regulator_descs;
memcpy(descs, ltc3589_regulators, sizeof(ltc3589_regulators));
- if (ltc3589->variant == LTC3589) {
- descs[LTC3589_LDO3].fixed_uV = 1800000;
- descs[LTC3589_LDO4].volt_table = ltc3589_ldo4;
- } else {
- descs[LTC3589_LDO3].fixed_uV = 2800000;
- descs[LTC3589_LDO4].volt_table = ltc3589_12_ldo4;
- }
+ descs[LTC3589_LDO3].fixed_uV = info->fixed_uV;
+ descs[LTC3589_LDO4].volt_table = info->volt_table;
ltc3589->regmap = devm_regmap_init_i2c(client, &ltc3589_regmap_config);
if (IS_ERR(ltc3589->regmap)) {
@@ -444,28 +434,29 @@ static int ltc3589_probe(struct i2c_client *client)
return 0;
}
+static const struct ltc3589_info ltc3589_info = {
+ .fixed_uV = 1800000,
+ .volt_table = ltc3589_ldo4,
+};
+
+static const struct ltc3589_info ltc3589_12_info = {
+ .fixed_uV = 2800000,
+ .volt_table = ltc3589_12_ldo4,
+};
+
static const struct i2c_device_id ltc3589_i2c_id[] = {
- { "ltc3589", LTC3589 },
- { "ltc3589-1", LTC3589_1 },
- { "ltc3589-2", LTC3589_2 },
+ { "ltc3589", (kernel_ulong_t)&ltc3589_info },
+ { "ltc3589-1", (kernel_ulong_t)&ltc3589_12_info },
+ { "ltc3589-2", (kernel_ulong_t)&ltc3589_12_info },
{ }
};
MODULE_DEVICE_TABLE(i2c, ltc3589_i2c_id);
static const struct of_device_id __maybe_unused ltc3589_of_match[] = {
- {
- .compatible = "lltc,ltc3589",
- .data = (void *)LTC3589,
- },
- {
- .compatible = "lltc,ltc3589-1",
- .data = (void *)LTC3589_1,
- },
- {
- .compatible = "lltc,ltc3589-2",
- .data = (void *)LTC3589_2,
- },
- { },
+ { .compatible = "lltc,ltc3589", .data = &ltc3589_info },
+ { .compatible = "lltc,ltc3589-1", .data = &ltc3589_12_info },
+ { .compatible = "lltc,ltc3589-2", .data = &ltc3589_12_info },
+ { }
};
MODULE_DEVICE_TABLE(of, ltc3589_of_match);
diff --git a/drivers/regulator/max20086-regulator.c b/drivers/regulator/max20086-regulator.c
index 32f47b896fd1..59eb23d467ec 100644
--- a/drivers/regulator/max20086-regulator.c
+++ b/drivers/regulator/max20086-regulator.c
@@ -223,7 +223,7 @@ static int max20086_i2c_probe(struct i2c_client *i2c)
return -ENOMEM;
chip->dev = &i2c->dev;
- chip->info = device_get_match_data(chip->dev);
+ chip->info = i2c_get_match_data(i2c);
i2c_set_clientdata(i2c, chip);
@@ -275,45 +275,42 @@ static int max20086_i2c_probe(struct i2c_client *i2c)
return 0;
}
-static const struct i2c_device_id max20086_i2c_id[] = {
- { "max20086" },
- { "max20087" },
- { "max20088" },
- { "max20089" },
- { /* Sentinel */ },
+static const struct max20086_chip_info max20086_chip_info = {
+ .id = MAX20086_DEVICE_ID_MAX20086,
+ .num_outputs = 4,
+};
+
+static const struct max20086_chip_info max20087_chip_info = {
+ .id = MAX20086_DEVICE_ID_MAX20087,
+ .num_outputs = 4,
+};
+
+static const struct max20086_chip_info max20088_chip_info = {
+ .id = MAX20086_DEVICE_ID_MAX20088,
+ .num_outputs = 2,
+};
+
+static const struct max20086_chip_info max20089_chip_info = {
+ .id = MAX20086_DEVICE_ID_MAX20089,
+ .num_outputs = 2,
};
+static const struct i2c_device_id max20086_i2c_id[] = {
+ { "max20086", (kernel_ulong_t)&max20086_chip_info },
+ { "max20087", (kernel_ulong_t)&max20087_chip_info },
+ { "max20088", (kernel_ulong_t)&max20088_chip_info },
+ { "max20089", (kernel_ulong_t)&max20089_chip_info },
+ { /* Sentinel */ }
+};
MODULE_DEVICE_TABLE(i2c, max20086_i2c_id);
static const struct of_device_id max20086_dt_ids[] __maybe_unused = {
- {
- .compatible = "maxim,max20086",
- .data = &(const struct max20086_chip_info) {
- .id = MAX20086_DEVICE_ID_MAX20086,
- .num_outputs = 4,
- }
- }, {
- .compatible = "maxim,max20087",
- .data = &(const struct max20086_chip_info) {
- .id = MAX20086_DEVICE_ID_MAX20087,
- .num_outputs = 4,
- }
- }, {
- .compatible = "maxim,max20088",
- .data = &(const struct max20086_chip_info) {
- .id = MAX20086_DEVICE_ID_MAX20088,
- .num_outputs = 2,
- }
- }, {
- .compatible = "maxim,max20089",
- .data = &(const struct max20086_chip_info) {
- .id = MAX20086_DEVICE_ID_MAX20089,
- .num_outputs = 2,
- }
- },
- { /* Sentinel */ },
+ { .compatible = "maxim,max20086", .data = &max20086_chip_info },
+ { .compatible = "maxim,max20087", .data = &max20087_chip_info },
+ { .compatible = "maxim,max20088", .data = &max20088_chip_info },
+ { .compatible = "maxim,max20089", .data = &max20089_chip_info },
+ { /* Sentinel */ }
};
-
MODULE_DEVICE_TABLE(of, max20086_dt_ids);
static struct i2c_driver max20086_regulator_driver = {
diff --git a/drivers/regulator/mc13xxx.h b/drivers/regulator/mc13xxx.h
index e03279dc43f4..057aaef6f086 100644
--- a/drivers/regulator/mc13xxx.h
+++ b/drivers/regulator/mc13xxx.h
@@ -24,7 +24,7 @@ struct mc13xxx_regulator_priv {
u32 powermisc_pwgt_state;
struct mc13xxx_regulator *mc13xxx_regulators;
int num_regulators;
- struct regulator_dev *regulators[];
+ struct regulator_dev *regulators[] __counted_by(num_regulators);
};
extern int mc13xxx_fixed_regulator_set_voltage(struct regulator_dev *rdev,
diff --git a/drivers/regulator/mp5416.c b/drivers/regulator/mp5416.c
index d068ac93d373..3457e650a994 100644
--- a/drivers/regulator/mp5416.c
+++ b/drivers/regulator/mp5416.c
@@ -200,7 +200,7 @@ static int mp5416_i2c_probe(struct i2c_client *client)
return PTR_ERR(regmap);
}
- desc = of_device_get_match_data(dev);
+ desc = i2c_get_match_data(client);
if (!desc)
return -ENODEV;
@@ -223,14 +223,14 @@ static int mp5416_i2c_probe(struct i2c_client *client)
static const struct of_device_id mp5416_of_match[] = {
{ .compatible = "mps,mp5416", .data = &mp5416_regulators_desc },
{ .compatible = "mps,mp5496", .data = &mp5496_regulators_desc },
- {},
+ {}
};
MODULE_DEVICE_TABLE(of, mp5416_of_match);
static const struct i2c_device_id mp5416_id[] = {
- { "mp5416", },
- { "mp5496", },
- { },
+ { "mp5416", (kernel_ulong_t)&mp5416_regulators_desc },
+ { "mp5496", (kernel_ulong_t)&mp5496_regulators_desc },
+ {}
};
MODULE_DEVICE_TABLE(i2c, mp5416_id);
diff --git a/drivers/regulator/mp886x.c b/drivers/regulator/mp886x.c
index 9911be2e6bac..48dcee5287f3 100644
--- a/drivers/regulator/mp886x.c
+++ b/drivers/regulator/mp886x.c
@@ -315,7 +315,7 @@ static int mp886x_i2c_probe(struct i2c_client *client)
if (IS_ERR(di->en_gpio))
return PTR_ERR(di->en_gpio);
- di->ci = of_device_get_match_data(dev);
+ di->ci = i2c_get_match_data(client);
di->dev = dev;
regmap = devm_regmap_init_i2c(client, &mp886x_regmap_config);
@@ -341,20 +341,14 @@ static int mp886x_i2c_probe(struct i2c_client *client)
}
static const struct of_device_id mp886x_dt_ids[] = {
- {
- .compatible = "mps,mp8867",
- .data = &mp8867_ci
- },
- {
- .compatible = "mps,mp8869",
- .data = &mp8869_ci
- },
+ { .compatible = "mps,mp8867", .data = &mp8867_ci },
+ { .compatible = "mps,mp8869", .data = &mp8869_ci },
{ }
};
MODULE_DEVICE_TABLE(of, mp886x_dt_ids);
static const struct i2c_device_id mp886x_id[] = {
- { "mp886x", },
+ { "mp886x", (kernel_ulong_t)&mp8869_ci },
{ },
};
MODULE_DEVICE_TABLE(i2c, mp886x_id);
diff --git a/drivers/regulator/pv88080-regulator.c b/drivers/regulator/pv88080-regulator.c
index 7ab3e4a9bd28..9fe539a34786 100644
--- a/drivers/regulator/pv88080-regulator.c
+++ b/drivers/regulator/pv88080-regulator.c
@@ -5,6 +5,7 @@
#include <linux/err.h>
#include <linux/i2c.h>
+#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/init.h>
@@ -28,11 +29,6 @@ enum {
PV88080_ID_HVBUCK,
};
-enum pv88080_types {
- TYPE_PV88080_AA,
- TYPE_PV88080_BA,
-};
-
struct pv88080_regulator {
struct regulator_desc desc;
unsigned int mode_reg;
@@ -196,16 +192,6 @@ static const struct pv88080_compatible_regmap pv88080_ba_regs = {
.hvbuck_vsel_mask = PV88080_VHVBUCK_MASK,
};
-#ifdef CONFIG_OF
-static const struct of_device_id pv88080_dt_ids[] = {
- { .compatible = "pvs,pv88080", .data = (void *)TYPE_PV88080_AA },
- { .compatible = "pvs,pv88080-aa", .data = (void *)TYPE_PV88080_AA },
- { .compatible = "pvs,pv88080-ba", .data = (void *)TYPE_PV88080_BA },
- {},
-};
-MODULE_DEVICE_TABLE(of, pv88080_dt_ids);
-#endif
-
static unsigned int pv88080_buck_get_mode(struct regulator_dev *rdev)
{
struct pv88080_regulator *info = rdev_get_drvdata(rdev);
@@ -376,11 +362,9 @@ error_i2c:
*/
static int pv88080_i2c_probe(struct i2c_client *i2c)
{
- const struct i2c_device_id *id = i2c_client_get_device_id(i2c);
struct regulator_init_data *init_data = dev_get_platdata(&i2c->dev);
struct pv88080 *chip;
const struct pv88080_compatible_regmap *regmap_config;
- const struct of_device_id *match;
struct regulator_config config = { };
int i, error, ret;
unsigned int conf2, conf5;
@@ -398,16 +382,9 @@ static int pv88080_i2c_probe(struct i2c_client *i2c)
return error;
}
- if (i2c->dev.of_node) {
- match = of_match_node(pv88080_dt_ids, i2c->dev.of_node);
- if (!match) {
- dev_err(chip->dev, "Failed to get of_match_node\n");
- return -EINVAL;
- }
- chip->type = (unsigned long)match->data;
- } else {
- chip->type = id->driver_data;
- }
+ chip->regmap_config = i2c_get_match_data(i2c);
+ if (!chip->regmap_config)
+ return -ENODEV;
i2c_set_clientdata(i2c, chip);
@@ -452,15 +429,6 @@ static int pv88080_i2c_probe(struct i2c_client *i2c)
dev_warn(chip->dev, "No IRQ configured\n");
}
- switch (chip->type) {
- case TYPE_PV88080_AA:
- chip->regmap_config = &pv88080_aa_regs;
- break;
- case TYPE_PV88080_BA:
- chip->regmap_config = &pv88080_ba_regs;
- break;
- }
-
regmap_config = chip->regmap_config;
config.dev = chip->dev;
config.regmap = chip->regmap;
@@ -546,11 +514,19 @@ static int pv88080_i2c_probe(struct i2c_client *i2c)
return 0;
}
+static const struct of_device_id pv88080_dt_ids[] = {
+ { .compatible = "pvs,pv88080", .data = &pv88080_aa_regs },
+ { .compatible = "pvs,pv88080-aa", .data = &pv88080_aa_regs },
+ { .compatible = "pvs,pv88080-ba", .data = &pv88080_ba_regs },
+ {}
+};
+MODULE_DEVICE_TABLE(of, pv88080_dt_ids);
+
static const struct i2c_device_id pv88080_i2c_id[] = {
- { "pv88080", TYPE_PV88080_AA },
- { "pv88080-aa", TYPE_PV88080_AA },
- { "pv88080-ba", TYPE_PV88080_BA },
- {},
+ { "pv88080", (kernel_ulong_t)&pv88080_aa_regs },
+ { "pv88080-aa", (kernel_ulong_t)&pv88080_aa_regs },
+ { "pv88080-ba", (kernel_ulong_t)&pv88080_ba_regs },
+ {}
};
MODULE_DEVICE_TABLE(i2c, pv88080_i2c_id);
@@ -558,7 +534,7 @@ static struct i2c_driver pv88080_regulator_driver = {
.driver = {
.name = "pv88080",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
- .of_match_table = of_match_ptr(pv88080_dt_ids),
+ .of_match_table = pv88080_dt_ids,
},
.probe = pv88080_i2c_probe,
.id_table = pv88080_i2c_id,
diff --git a/drivers/regulator/rk808-regulator.c b/drivers/regulator/rk808-regulator.c
index 867a2cf243f6..e374fa6e5f28 100644
--- a/drivers/regulator/rk808-regulator.c
+++ b/drivers/regulator/rk808-regulator.c
@@ -15,10 +15,8 @@
*/
#include <linux/delay.h>
-#include <linux/gpio.h>
#include <linux/module.h>
#include <linux/of.h>
-#include <linux/of_gpio.h>
#include <linux/mfd/rk808.h>
#include <linux/platform_device.h>
#include <linux/regulator/driver.h>
diff --git a/drivers/regulator/sy8824x.c b/drivers/regulator/sy8824x.c
index d49c0cba09fb..c05b67e26ac8 100644
--- a/drivers/regulator/sy8824x.c
+++ b/drivers/regulator/sy8824x.c
@@ -142,7 +142,7 @@ static int sy8824_i2c_probe(struct i2c_client *client)
}
di->dev = dev;
- di->cfg = of_device_get_match_data(dev);
+ di->cfg = i2c_get_match_data(client);
regmap = devm_regmap_init_i2c(client, di->cfg->config);
if (IS_ERR(regmap)) {
@@ -204,29 +204,17 @@ static const struct sy8824_config sy20278_cfg = {
};
static const struct of_device_id sy8824_dt_ids[] = {
- {
- .compatible = "silergy,sy8824c",
- .data = &sy8824c_cfg
- },
- {
- .compatible = "silergy,sy8824e",
- .data = &sy8824e_cfg
- },
- {
- .compatible = "silergy,sy20276",
- .data = &sy20276_cfg
- },
- {
- .compatible = "silergy,sy20278",
- .data = &sy20278_cfg
- },
+ { .compatible = "silergy,sy8824c", .data = &sy8824c_cfg },
+ { .compatible = "silergy,sy8824e", .data = &sy8824e_cfg },
+ { .compatible = "silergy,sy20276", .data = &sy20276_cfg },
+ { .compatible = "silergy,sy20278", .data = &sy20278_cfg },
{ }
};
MODULE_DEVICE_TABLE(of, sy8824_dt_ids);
static const struct i2c_device_id sy8824_id[] = {
- { "sy8824", },
- { },
+ { "sy8824", (kernel_ulong_t)&sy8824c_cfg },
+ { }
};
MODULE_DEVICE_TABLE(i2c, sy8824_id);