diff options
Diffstat (limited to 'drivers/regulator')
-rw-r--r-- | drivers/regulator/fan53555.c | 9 | ||||
-rw-r--r-- | drivers/regulator/ltc3589.c | 61 | ||||
-rw-r--r-- | drivers/regulator/max20086-regulator.c | 65 | ||||
-rw-r--r-- | drivers/regulator/mp5416.c | 10 | ||||
-rw-r--r-- | drivers/regulator/mp886x.c | 14 | ||||
-rw-r--r-- | drivers/regulator/sy8824x.c | 26 |
6 files changed, 75 insertions, 110 deletions
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, <c3589_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)<c3589_info }, + { "ltc3589-1", (kernel_ulong_t)<c3589_12_info }, + { "ltc3589-2", (kernel_ulong_t)<c3589_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 = <c3589_info }, + { .compatible = "lltc,ltc3589-1", .data = <c3589_12_info }, + { .compatible = "lltc,ltc3589-2", .data = <c3589_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/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/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); |