From 3267a17bbae1706499b214ec3a7f35a6debcfb40 Mon Sep 17 00:00:00 2001 From: Patrick Delaunay Date: Thu, 23 May 2024 20:04:34 +0200 Subject: regulator: stm32-pwr: add support of STM32MP13 Add support of the new compatible "st,stm32mp13-pwr-reg" for STM32MP13. Signed-off-by: Patrick Delaunay Link: https://msgid.link/r/20240523200353.v4.2.I04ec53442753147c35efad1307b6ec133f53b471@changeid Signed-off-by: Mark Brown --- drivers/regulator/stm32-pwr.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers') diff --git a/drivers/regulator/stm32-pwr.c b/drivers/regulator/stm32-pwr.c index 85b0102fb9b1..b7aeef6e09e7 100644 --- a/drivers/regulator/stm32-pwr.c +++ b/drivers/regulator/stm32-pwr.c @@ -166,6 +166,7 @@ static int stm32_pwr_regulator_probe(struct platform_device *pdev) static const struct of_device_id __maybe_unused stm32_pwr_of_match[] = { { .compatible = "st,stm32mp1,pwr-reg", }, + { .compatible = "st,stm32mp13-pwr-reg", }, {}, }; MODULE_DEVICE_TABLE(of, stm32_pwr_of_match); -- cgit v1.2.3 From aea07a986c2f9d456fcdad21ad14cfc49b3114ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Date: Mon, 13 May 2024 10:05:26 +0200 Subject: regulator: Drop explicit initialization of struct i2c_device_id::driver_data to 0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These drivers don't use the driver_data member of struct i2c_device_id, so don't explicitly initialize this member. This prepares putting driver_data in an anonymous union which requires either no initialization or named designators. But it's also a nice cleanup on its own. While add it, also remove commas after the sentinel entries. Signed-off-by: Uwe Kleine-König Link: https://msgid.link/r/20240513080525.2353168-2-u.kleine-koenig@pengutronix.de Signed-off-by: Mark Brown --- drivers/regulator/da9210-regulator.c | 4 ++-- drivers/regulator/lp3971.c | 2 +- drivers/regulator/lp3972.c | 2 +- drivers/regulator/lp8755.c | 2 +- drivers/regulator/max1586.c | 2 +- drivers/regulator/max20411-regulator.c | 4 ++-- drivers/regulator/max8649.c | 2 +- drivers/regulator/max8893.c | 4 ++-- drivers/regulator/max8952.c | 4 ++-- drivers/regulator/mcp16502.c | 2 +- drivers/regulator/mt6311-regulator.c | 4 ++-- drivers/regulator/pf8x00-regulator.c | 8 ++++---- drivers/regulator/pv88060-regulator.c | 4 ++-- drivers/regulator/pv88090-regulator.c | 4 ++-- drivers/regulator/slg51000-regulator.c | 4 ++-- drivers/regulator/sy8106a-regulator.c | 4 ++-- drivers/regulator/tps6286x-regulator.c | 10 +++++----- drivers/regulator/tps6287x-regulator.c | 10 +++++----- 18 files changed, 38 insertions(+), 38 deletions(-) (limited to 'drivers') diff --git a/drivers/regulator/da9210-regulator.c b/drivers/regulator/da9210-regulator.c index 02b85ca4a6fc..39ade0dba40f 100644 --- a/drivers/regulator/da9210-regulator.c +++ b/drivers/regulator/da9210-regulator.c @@ -202,8 +202,8 @@ static int da9210_i2c_probe(struct i2c_client *i2c) } static const struct i2c_device_id da9210_i2c_id[] = { - {"da9210", 0}, - {}, + { "da9210" }, + {} }; MODULE_DEVICE_TABLE(i2c, da9210_i2c_id); diff --git a/drivers/regulator/lp3971.c b/drivers/regulator/lp3971.c index e1b5c45f97f4..d4dab86fe385 100644 --- a/drivers/regulator/lp3971.c +++ b/drivers/regulator/lp3971.c @@ -439,7 +439,7 @@ static int lp3971_i2c_probe(struct i2c_client *i2c) } static const struct i2c_device_id lp3971_i2c_id[] = { - { "lp3971", 0 }, + { "lp3971" }, { } }; MODULE_DEVICE_TABLE(i2c, lp3971_i2c_id); diff --git a/drivers/regulator/lp3972.c b/drivers/regulator/lp3972.c index 7bd6f05edd8d..1b918fb72134 100644 --- a/drivers/regulator/lp3972.c +++ b/drivers/regulator/lp3972.c @@ -537,7 +537,7 @@ static int lp3972_i2c_probe(struct i2c_client *i2c) } static const struct i2c_device_id lp3972_i2c_id[] = { - { "lp3972", 0 }, + { "lp3972" }, { } }; MODULE_DEVICE_TABLE(i2c, lp3972_i2c_id); diff --git a/drivers/regulator/lp8755.c b/drivers/regulator/lp8755.c index 8d01e18046f3..5509bee49bda 100644 --- a/drivers/regulator/lp8755.c +++ b/drivers/regulator/lp8755.c @@ -430,7 +430,7 @@ static void lp8755_remove(struct i2c_client *client) } static const struct i2c_device_id lp8755_id[] = { - {LP8755_NAME, 0}, + { LP8755_NAME }, {} }; diff --git a/drivers/regulator/max1586.c b/drivers/regulator/max1586.c index 0f133129252e..4242fbb7b147 100644 --- a/drivers/regulator/max1586.c +++ b/drivers/regulator/max1586.c @@ -276,7 +276,7 @@ static int max1586_pmic_probe(struct i2c_client *client) } static const struct i2c_device_id max1586_id[] = { - { "max1586", 0 }, + { "max1586" }, { } }; MODULE_DEVICE_TABLE(i2c, max1586_id); diff --git a/drivers/regulator/max20411-regulator.c b/drivers/regulator/max20411-regulator.c index 8c09dc71b16d..ce430c925c71 100644 --- a/drivers/regulator/max20411-regulator.c +++ b/drivers/regulator/max20411-regulator.c @@ -145,8 +145,8 @@ static const struct of_device_id of_max20411_match_tbl[] = { MODULE_DEVICE_TABLE(of, of_max20411_match_tbl); static const struct i2c_device_id max20411_id[] = { - { "max20411", 0 }, - { }, + { "max20411" }, + { } }; MODULE_DEVICE_TABLE(i2c, max20411_id); diff --git a/drivers/regulator/max8649.c b/drivers/regulator/max8649.c index 24e1dfba78c8..f57c588bcf28 100644 --- a/drivers/regulator/max8649.c +++ b/drivers/regulator/max8649.c @@ -240,7 +240,7 @@ static int max8649_regulator_probe(struct i2c_client *client) } static const struct i2c_device_id max8649_id[] = { - { "max8649", 0 }, + { "max8649" }, { } }; MODULE_DEVICE_TABLE(i2c, max8649_id); diff --git a/drivers/regulator/max8893.c b/drivers/regulator/max8893.c index 30592425e193..5a90633d8536 100644 --- a/drivers/regulator/max8893.c +++ b/drivers/regulator/max8893.c @@ -162,8 +162,8 @@ MODULE_DEVICE_TABLE(of, max8893_dt_match); #endif static const struct i2c_device_id max8893_ids[] = { - { "max8893", 0 }, - { }, + { "max8893" }, + { } }; MODULE_DEVICE_TABLE(i2c, max8893_ids); diff --git a/drivers/regulator/max8952.c b/drivers/regulator/max8952.c index 0b0b841d214a..1f94315bfb02 100644 --- a/drivers/regulator/max8952.c +++ b/drivers/regulator/max8952.c @@ -307,8 +307,8 @@ static int max8952_pmic_probe(struct i2c_client *client) } static const struct i2c_device_id max8952_ids[] = { - { "max8952", 0 }, - { }, + { "max8952" }, + { } }; MODULE_DEVICE_TABLE(i2c, max8952_ids); diff --git a/drivers/regulator/mcp16502.c b/drivers/regulator/mcp16502.c index 0c15a19fe83a..5de9d4fa5113 100644 --- a/drivers/regulator/mcp16502.c +++ b/drivers/regulator/mcp16502.c @@ -577,7 +577,7 @@ static const struct dev_pm_ops mcp16502_pm_ops = { }; #endif static const struct i2c_device_id mcp16502_i2c_id[] = { - { "mcp16502", 0 }, + { "mcp16502" }, { } }; MODULE_DEVICE_TABLE(i2c, mcp16502_i2c_id); diff --git a/drivers/regulator/mt6311-regulator.c b/drivers/regulator/mt6311-regulator.c index c00638cd2d1e..2ebc1c0b5e6f 100644 --- a/drivers/regulator/mt6311-regulator.c +++ b/drivers/regulator/mt6311-regulator.c @@ -133,8 +133,8 @@ static int mt6311_i2c_probe(struct i2c_client *i2c) } static const struct i2c_device_id mt6311_i2c_id[] = { - {"mt6311", 0}, - {}, + { "mt6311" }, + {} }; MODULE_DEVICE_TABLE(i2c, mt6311_i2c_id); diff --git a/drivers/regulator/pf8x00-regulator.c b/drivers/regulator/pf8x00-regulator.c index 9fd8e0949b32..ea3611de42b4 100644 --- a/drivers/regulator/pf8x00-regulator.c +++ b/drivers/regulator/pf8x00-regulator.c @@ -596,10 +596,10 @@ static const struct of_device_id pf8x00_dt_ids[] = { MODULE_DEVICE_TABLE(of, pf8x00_dt_ids); static const struct i2c_device_id pf8x00_i2c_id[] = { - { "pf8100", 0 }, - { "pf8121a", 0 }, - { "pf8200", 0 }, - {}, + { "pf8100" }, + { "pf8121a" }, + { "pf8200" }, + {} }; MODULE_DEVICE_TABLE(i2c, pf8x00_i2c_id); diff --git a/drivers/regulator/pv88060-regulator.c b/drivers/regulator/pv88060-regulator.c index aa90360fa046..ae1c4b9daaa1 100644 --- a/drivers/regulator/pv88060-regulator.c +++ b/drivers/regulator/pv88060-regulator.c @@ -360,8 +360,8 @@ static int pv88060_i2c_probe(struct i2c_client *i2c) } static const struct i2c_device_id pv88060_i2c_id[] = { - {"pv88060", 0}, - {}, + { "pv88060" }, + {} }; MODULE_DEVICE_TABLE(i2c, pv88060_i2c_id); diff --git a/drivers/regulator/pv88090-regulator.c b/drivers/regulator/pv88090-regulator.c index f4acde4d56c8..3c48757bbbda 100644 --- a/drivers/regulator/pv88090-regulator.c +++ b/drivers/regulator/pv88090-regulator.c @@ -381,8 +381,8 @@ static int pv88090_i2c_probe(struct i2c_client *i2c) } static const struct i2c_device_id pv88090_i2c_id[] = { - {"pv88090", 0}, - {}, + { "pv88090" }, + {} }; MODULE_DEVICE_TABLE(i2c, pv88090_i2c_id); diff --git a/drivers/regulator/slg51000-regulator.c b/drivers/regulator/slg51000-regulator.c index 59aa16825d8a..3bbd4a29e6d3 100644 --- a/drivers/regulator/slg51000-regulator.c +++ b/drivers/regulator/slg51000-regulator.c @@ -497,8 +497,8 @@ static int slg51000_i2c_probe(struct i2c_client *client) } static const struct i2c_device_id slg51000_i2c_id[] = { - {"slg51000", 0}, - {}, + { "slg51000" }, + {} }; MODULE_DEVICE_TABLE(i2c, slg51000_i2c_id); diff --git a/drivers/regulator/sy8106a-regulator.c b/drivers/regulator/sy8106a-regulator.c index 1bcfdd6dcfc1..d79a4cc25a0d 100644 --- a/drivers/regulator/sy8106a-regulator.c +++ b/drivers/regulator/sy8106a-regulator.c @@ -130,8 +130,8 @@ static const struct of_device_id sy8106a_i2c_of_match[] = { MODULE_DEVICE_TABLE(of, sy8106a_i2c_of_match); static const struct i2c_device_id sy8106a_i2c_id[] = { - { "sy8106a", 0 }, - { }, + { "sy8106a" }, + { } }; MODULE_DEVICE_TABLE(i2c, sy8106a_i2c_id); diff --git a/drivers/regulator/tps6286x-regulator.c b/drivers/regulator/tps6286x-regulator.c index 758c70269653..67e4c8d316d9 100644 --- a/drivers/regulator/tps6286x-regulator.c +++ b/drivers/regulator/tps6286x-regulator.c @@ -136,11 +136,11 @@ static int tps6286x_i2c_probe(struct i2c_client *i2c) } static const struct i2c_device_id tps6286x_i2c_id[] = { - { "tps62864", 0 }, - { "tps62866", 0 }, - { "tps62868", 0 }, - { "tps62869", 0 }, - {}, + { "tps62864" }, + { "tps62866" }, + { "tps62868" }, + { "tps62869" }, + {} }; MODULE_DEVICE_TABLE(i2c, tps6286x_i2c_id); diff --git a/drivers/regulator/tps6287x-regulator.c b/drivers/regulator/tps6287x-regulator.c index 3c9d79e003e4..7a0551f0c8c0 100644 --- a/drivers/regulator/tps6287x-regulator.c +++ b/drivers/regulator/tps6287x-regulator.c @@ -165,11 +165,11 @@ static const struct of_device_id tps6287x_dt_ids[] = { MODULE_DEVICE_TABLE(of, tps6287x_dt_ids); static const struct i2c_device_id tps6287x_i2c_id[] = { - { "tps62870", 0 }, - { "tps62871", 0 }, - { "tps62872", 0 }, - { "tps62873", 0 }, - {}, + { "tps62870" }, + { "tps62871" }, + { "tps62872" }, + { "tps62873" }, + {} }; MODULE_DEVICE_TABLE(i2c, tps6287x_i2c_id); -- cgit v1.2.3 From 4236b12c8731e97ab9336590a9bd4a6cb72c7dd4 Mon Sep 17 00:00:00 2001 From: "Dr. David Alan Gilbert" Date: Tue, 28 May 2024 18:46:59 +0100 Subject: regulator: max77503: remove unused struct 'max77503_dev' 'max77503_dev' is unused since the original commit a0c543bdf4ba ("regulator: max77503: Add ADI MAX77503 support"). Remove it. Signed-off-by: Dr. David Alan Gilbert Link: https://msgid.link/r/20240528174659.53022-1-linux@treblig.org Signed-off-by: Mark Brown --- drivers/regulator/max77503-regulator.c | 8 -------- 1 file changed, 8 deletions(-) (limited to 'drivers') diff --git a/drivers/regulator/max77503-regulator.c b/drivers/regulator/max77503-regulator.c index 4a6ba4dd2acd..c7c94e868fc1 100644 --- a/drivers/regulator/max77503-regulator.c +++ b/drivers/regulator/max77503-regulator.c @@ -25,14 +25,6 @@ #define MAX77503_AD_ENABLED 0x1 #define MAX77503_AD_DISABLED 0x0 -struct max77503_dev { - struct device *dev; - struct device_node *of_node; - struct regulator_desc desc; - struct regulator_dev *rdev; - struct regmap *regmap; -}; - static const struct regmap_config max77503_regmap_config = { .reg_bits = 8, .val_bits = 8, -- cgit v1.2.3 From 74259990b5938dc55fbe2f9b0431d5f370d34b85 Mon Sep 17 00:00:00 2001 From: Alina Yu Date: Tue, 28 May 2024 14:01:14 +0800 Subject: regulator: rtq2208: Fix LDO to be compatible with both fixed and adjustable vout In this patch, LDO's adjustable and fixed Vout settings are compatible. The LDO Vout ability depends on "richtek,fixed-microvolt". If adjustable, the Vout can be set to either 1800mV or 3300mV. Signed-off-by: Alina Yu Link: https://msgid.link/r/5ad4c7728c7fa7f6286db36b99d31c9d0f5d16c7.1716870419.git.alina_yu@richtek.com Signed-off-by: Mark Brown --- drivers/regulator/rtq2208-regulator.c | 37 +++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) (limited to 'drivers') diff --git a/drivers/regulator/rtq2208-regulator.c b/drivers/regulator/rtq2208-regulator.c index c31b6dc3229c..f6afa4e52814 100644 --- a/drivers/regulator/rtq2208-regulator.c +++ b/drivers/regulator/rtq2208-regulator.c @@ -219,7 +219,7 @@ static const struct regulator_ops rtq2208_regulator_buck_ops = { .set_suspend_mode = rtq2208_set_suspend_mode, }; -static const struct regulator_ops rtq2208_regulator_ldo_ops = { +static const struct regulator_ops rtq2208_regulator_ldo_fix_ops = { .enable = regulator_enable_regmap, .disable = regulator_disable_regmap, .is_enabled = regulator_is_enabled_regmap, @@ -228,6 +228,23 @@ static const struct regulator_ops rtq2208_regulator_ldo_ops = { .set_suspend_disable = rtq2208_set_suspend_disable, }; +static const struct regulator_ops rtq2208_regulator_ldo_adj_ops = { + .enable = regulator_enable_regmap, + .disable = regulator_disable_regmap, + .is_enabled = regulator_is_enabled_regmap, + .list_voltage = regulator_list_voltage_table, + .set_voltage_sel = regulator_set_voltage_sel_regmap, + .get_voltage_sel = regulator_get_voltage_sel_regmap, + .set_active_discharge = regulator_set_active_discharge_regmap, + .set_suspend_enable = rtq2208_set_suspend_enable, + .set_suspend_disable = rtq2208_set_suspend_disable, +}; + +static const unsigned int rtq2208_ldo_volt_table[] = { + 1800000, + 3300000, +}; + static struct of_regulator_match rtq2208_ldo_match[] = { {.name = "ldo2", }, {.name = "ldo1", }, @@ -331,7 +348,7 @@ static int rtq2208_of_get_ldo_dvs_ability(struct device *dev) { struct device_node *np; struct of_regulator_match *match; - struct rtq2208_regulator_desc *rdesc; + struct regulator_desc *desc; struct regulator_init_data *init_data; int ret, i; @@ -352,13 +369,21 @@ static int rtq2208_of_get_ldo_dvs_ability(struct device *dev) for (i = 0; i < ARRAY_SIZE(rtq2208_ldo_match); i++) { match = rtq2208_ldo_match + i; init_data = match->init_data; - rdesc = (struct rtq2208_regulator_desc *)match->driver_data; + desc = (struct regulator_desc *)match->desc; - if (!init_data || !rdesc) + if (!init_data || !desc) continue; - if (init_data->constraints.min_uV == init_data->constraints.max_uV) - rdesc->desc.fixed_uV = init_data->constraints.min_uV; + if (init_data->constraints.min_uV == init_data->constraints.max_uV) { + desc->fixed_uV = init_data->constraints.min_uV; + desc->n_voltages = 1; + desc->fixed_uV = init_data->constraints.min_uV; + desc->ops = &rtq2208_regulator_ldo_fix_ops; + } else { + desc->n_voltages = ARRAY_SIZE(rtq2208_ldo_volt_table); + desc->volt_table = rtq2208_ldo_volt_table; + desc->ops = &rtq2208_regulator_ldo_adj_ops; + } } return 0; -- cgit v1.2.3 From af1296d15d8907a5aeeeb4ecd3e5878c9a349048 Mon Sep 17 00:00:00 2001 From: Alina Yu Date: Tue, 28 May 2024 14:01:15 +0800 Subject: regulator: rtq2208: Add fixed LDO VOUT property and check that matches the constraints A fixed LDO VOUT property has been added to specify the fixed_uV of the regulator_desc. Additionally, a check has been included in this version to ensure that the fixed_uV matches the constraints. Signed-off-by: Alina Yu Link: https://msgid.link/r/39357ff9e6e5f3dec5a6f7f833a3591c0defc63a.1716870419.git.alina_yu@richtek.com Signed-off-by: Mark Brown --- drivers/regulator/rtq2208-regulator.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'drivers') diff --git a/drivers/regulator/rtq2208-regulator.c b/drivers/regulator/rtq2208-regulator.c index f6afa4e52814..a5c126afc648 100644 --- a/drivers/regulator/rtq2208-regulator.c +++ b/drivers/regulator/rtq2208-regulator.c @@ -350,6 +350,7 @@ static int rtq2208_of_get_ldo_dvs_ability(struct device *dev) struct of_regulator_match *match; struct regulator_desc *desc; struct regulator_init_data *init_data; + u32 fixed_uV; int ret, i; if (!dev->of_node) @@ -374,9 +375,15 @@ static int rtq2208_of_get_ldo_dvs_ability(struct device *dev) if (!init_data || !desc) continue; - if (init_data->constraints.min_uV == init_data->constraints.max_uV) { - desc->fixed_uV = init_data->constraints.min_uV; + /* specify working fixed voltage if the propery exists */ + ret = of_property_read_u32(match->of_node, "richtek,fixed-microvolt", &fixed_uV); + + if (!ret) { + if (fixed_uV != init_data->constraints.min_uV || + fixed_uV != init_data->constraints.max_uV) + return -EINVAL; desc->n_voltages = 1; + desc->fixed_uV = fixed_uV; desc->fixed_uV = init_data->constraints.min_uV; desc->ops = &rtq2208_regulator_ldo_fix_ops; } else { -- cgit v1.2.3 From 8a2744f2955a584188a82d631937aa365d4ea966 Mon Sep 17 00:00:00 2001 From: Jeff Johnson Date: Mon, 10 Jun 2024 07:30:51 -0700 Subject: regulator: add missing MODULE_DESCRIPTION() macro On x86, make allmodconfig && make W=1 C=1 reports: WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/regulator/da9121-regulator.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/regulator/max20411-regulator.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/regulator/rt4831-regulator.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/regulator/tps6286x-regulator.o Add the missing invocations of the MODULE_DESCRIPTION() macro. Reviewed-by: AngeloGioacchino Del Regno Signed-off-by: Jeff Johnson Link: https://lore.kernel.org/r/20240610-md-drivers-regulator-v2-1-cf39106d7e54@quicinc.com Signed-off-by: Mark Brown --- drivers/regulator/da9121-regulator.c | 1 + drivers/regulator/max20411-regulator.c | 1 + drivers/regulator/rt4831-regulator.c | 1 + drivers/regulator/tps6286x-regulator.c | 1 + 4 files changed, 4 insertions(+) (limited to 'drivers') diff --git a/drivers/regulator/da9121-regulator.c b/drivers/regulator/da9121-regulator.c index 96257551bb12..3571b6242e3a 100644 --- a/drivers/regulator/da9121-regulator.c +++ b/drivers/regulator/da9121-regulator.c @@ -1192,4 +1192,5 @@ static struct i2c_driver da9121_regulator_driver = { module_i2c_driver(da9121_regulator_driver); +MODULE_DESCRIPTION("Dialog Semiconductor DA9121/DA9122/DA9220/DA9217/DA9130/DA9131/DA9132 regulator driver"); MODULE_LICENSE("GPL v2"); diff --git a/drivers/regulator/max20411-regulator.c b/drivers/regulator/max20411-regulator.c index ce430c925c71..02d7009ea0e6 100644 --- a/drivers/regulator/max20411-regulator.c +++ b/drivers/regulator/max20411-regulator.c @@ -161,4 +161,5 @@ static struct i2c_driver max20411_i2c_driver = { }; module_i2c_driver(max20411_i2c_driver); +MODULE_DESCRIPTION("Maxim MAX20411 High-Efficiency Single Step-Down Converter driver"); MODULE_LICENSE("GPL"); diff --git a/drivers/regulator/rt4831-regulator.c b/drivers/regulator/rt4831-regulator.c index 97e6f7e2a0ba..dfc868a24056 100644 --- a/drivers/regulator/rt4831-regulator.c +++ b/drivers/regulator/rt4831-regulator.c @@ -202,4 +202,5 @@ static struct platform_driver rt4831_regulator_driver = { module_platform_driver(rt4831_regulator_driver); MODULE_AUTHOR("ChiYuan Huang "); +MODULE_DESCRIPTION("Richtek RT4831 DSV Regulators driver"); MODULE_LICENSE("GPL v2"); diff --git a/drivers/regulator/tps6286x-regulator.c b/drivers/regulator/tps6286x-regulator.c index 67e4c8d316d9..75f441f36de7 100644 --- a/drivers/regulator/tps6286x-regulator.c +++ b/drivers/regulator/tps6286x-regulator.c @@ -156,4 +156,5 @@ static struct i2c_driver tps6286x_regulator_driver = { module_i2c_driver(tps6286x_regulator_driver); +MODULE_DESCRIPTION("TI TPS6286x Power Regulator driver"); MODULE_LICENSE("GPL v2"); -- cgit v1.2.3 From 61a98ffc2081ac1e9070150932d9eb91d3935cf8 Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Sun, 23 Jun 2024 16:09:35 +0200 Subject: regulator: userspace-consumer: quiet device deferral Trying to use userspace-consumer when the required supplies have not yet been probed will throw an error message on deferral: reg-userspace-consumer output-led-power: Failed to get supplies: -517 So, lets simply use dev_err_probe() instead of dev_err() to not print errors in case when driver probe is being deferred. Signed-off-by: Robert Marko Link: https://patch.msgid.link/20240623140947.1252376-1-robimarko@gmail.com Signed-off-by: Mark Brown --- drivers/regulator/userspace-consumer.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'drivers') diff --git a/drivers/regulator/userspace-consumer.c b/drivers/regulator/userspace-consumer.c index 86a626a4f610..6153d0295b6d 100644 --- a/drivers/regulator/userspace-consumer.c +++ b/drivers/regulator/userspace-consumer.c @@ -158,10 +158,8 @@ static int regulator_userspace_consumer_probe(struct platform_device *pdev) ret = devm_regulator_bulk_get_exclusive(&pdev->dev, drvdata->num_supplies, drvdata->supplies); - if (ret) { - dev_err(&pdev->dev, "Failed to get supplies: %d\n", ret); - return ret; - } + if (ret) + return dev_err_probe(&pdev->dev, ret, "Failed to get supplies\n"); platform_set_drvdata(pdev, drvdata); -- cgit v1.2.3 From cd102850e32c145661c6a0640dc6c5feba11af72 Mon Sep 17 00:00:00 2001 From: AngeloGioacchino Del Regno Date: Mon, 10 Jun 2024 10:57:33 +0200 Subject: regulator: Remove mtk-dvfsrc-regulator.c This driver never worked, and never got even compiled, because it was missing the DVFSRC driver entirely, including headers it relies on! In preparation of a full refactoring of this driver, remove it. The Makefile and Kconfig entries are retained, as those are reused as-is for the refactored code. Acked-by: Mark Brown Signed-off-by: AngeloGioacchino Del Regno Link: https://patch.msgid.link/20240610085735.147134-6-angelogioacchino.delregno@collabora.com Signed-off-by: Mark Brown --- drivers/regulator/mtk-dvfsrc-regulator.c | 214 ------------------------------- 1 file changed, 214 deletions(-) delete mode 100644 drivers/regulator/mtk-dvfsrc-regulator.c (limited to 'drivers') diff --git a/drivers/regulator/mtk-dvfsrc-regulator.c b/drivers/regulator/mtk-dvfsrc-regulator.c deleted file mode 100644 index f1280d45265d..000000000000 --- a/drivers/regulator/mtk-dvfsrc-regulator.c +++ /dev/null @@ -1,214 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -// -// Copyright (c) 2020 MediaTek Inc. - -#include -#include -#include -#include -#include -#include -#include -#include - -#define DVFSRC_ID_VCORE 0 -#define DVFSRC_ID_VSCP 1 - -#define MT_DVFSRC_REGULAR(match, _name, _volt_table) \ -[DVFSRC_ID_##_name] = { \ - .desc = { \ - .name = match, \ - .of_match = of_match_ptr(match), \ - .ops = &dvfsrc_vcore_ops, \ - .type = REGULATOR_VOLTAGE, \ - .id = DVFSRC_ID_##_name, \ - .owner = THIS_MODULE, \ - .n_voltages = ARRAY_SIZE(_volt_table), \ - .volt_table = _volt_table, \ - }, \ -} - -/* - * DVFSRC regulators' information - * - * @desc: standard fields of regulator description. - * @voltage_selector: Selector used for get_voltage_sel() and - * set_voltage_sel() callbacks - */ - -struct dvfsrc_regulator { - struct regulator_desc desc; -}; - -/* - * MTK DVFSRC regulators' init data - * - * @size: num of regulators - * @regulator_info: regulator info. - */ -struct dvfsrc_regulator_init_data { - u32 size; - struct dvfsrc_regulator *regulator_info; -}; - -static inline struct device *to_dvfsrc_dev(struct regulator_dev *rdev) -{ - return rdev_get_dev(rdev)->parent; -} - -static int dvfsrc_set_voltage_sel(struct regulator_dev *rdev, - unsigned int selector) -{ - struct device *dvfsrc_dev = to_dvfsrc_dev(rdev); - int id = rdev_get_id(rdev); - - if (id == DVFSRC_ID_VCORE) - mtk_dvfsrc_send_request(dvfsrc_dev, - MTK_DVFSRC_CMD_VCORE_REQUEST, - selector); - else if (id == DVFSRC_ID_VSCP) - mtk_dvfsrc_send_request(dvfsrc_dev, - MTK_DVFSRC_CMD_VSCP_REQUEST, - selector); - else - return -EINVAL; - - return 0; -} - -static int dvfsrc_get_voltage_sel(struct regulator_dev *rdev) -{ - struct device *dvfsrc_dev = to_dvfsrc_dev(rdev); - int id = rdev_get_id(rdev); - int val, ret; - - if (id == DVFSRC_ID_VCORE) - ret = mtk_dvfsrc_query_info(dvfsrc_dev, - MTK_DVFSRC_CMD_VCORE_LEVEL_QUERY, - &val); - else if (id == DVFSRC_ID_VSCP) - ret = mtk_dvfsrc_query_info(dvfsrc_dev, - MTK_DVFSRC_CMD_VSCP_LEVEL_QUERY, - &val); - else - return -EINVAL; - - if (ret != 0) - return ret; - - return val; -} - -static const struct regulator_ops dvfsrc_vcore_ops = { - .list_voltage = regulator_list_voltage_table, - .get_voltage_sel = dvfsrc_get_voltage_sel, - .set_voltage_sel = dvfsrc_set_voltage_sel, -}; - -static const unsigned int mt8183_voltages[] = { - 725000, - 800000, -}; - -static struct dvfsrc_regulator mt8183_regulators[] = { - MT_DVFSRC_REGULAR("dvfsrc-vcore", VCORE, - mt8183_voltages), -}; - -static const struct dvfsrc_regulator_init_data regulator_mt8183_data = { - .size = ARRAY_SIZE(mt8183_regulators), - .regulator_info = &mt8183_regulators[0], -}; - -static const unsigned int mt6873_voltages[] = { - 575000, - 600000, - 650000, - 725000, -}; - -static struct dvfsrc_regulator mt6873_regulators[] = { - MT_DVFSRC_REGULAR("dvfsrc-vcore", VCORE, - mt6873_voltages), - MT_DVFSRC_REGULAR("dvfsrc-vscp", VSCP, - mt6873_voltages), -}; - -static const struct dvfsrc_regulator_init_data regulator_mt6873_data = { - .size = ARRAY_SIZE(mt6873_regulators), - .regulator_info = &mt6873_regulators[0], -}; - -static const struct of_device_id mtk_dvfsrc_regulator_match[] = { - { - .compatible = "mediatek,mt8183-dvfsrc", - .data = ®ulator_mt8183_data, - }, { - .compatible = "mediatek,mt8192-dvfsrc", - .data = ®ulator_mt6873_data, - }, { - .compatible = "mediatek,mt6873-dvfsrc", - .data = ®ulator_mt6873_data, - }, { - /* sentinel */ - }, -}; -MODULE_DEVICE_TABLE(of, mtk_dvfsrc_regulator_match); - -static int dvfsrc_vcore_regulator_probe(struct platform_device *pdev) -{ - const struct of_device_id *match; - struct device *dev = &pdev->dev; - struct regulator_config config = { }; - struct regulator_dev *rdev; - const struct dvfsrc_regulator_init_data *regulator_init_data; - struct dvfsrc_regulator *mt_regulators; - int i; - - match = of_match_node(mtk_dvfsrc_regulator_match, dev->parent->of_node); - - if (!match) { - dev_err(dev, "invalid compatible string\n"); - return -ENODEV; - } - - regulator_init_data = match->data; - - mt_regulators = regulator_init_data->regulator_info; - for (i = 0; i < regulator_init_data->size; i++) { - config.dev = dev->parent; - config.driver_data = (mt_regulators + i); - rdev = devm_regulator_register(dev, &(mt_regulators + i)->desc, - &config); - if (IS_ERR(rdev)) { - dev_err(dev, "failed to register %s\n", - (mt_regulators + i)->desc.name); - return PTR_ERR(rdev); - } - } - - return 0; -} - -static struct platform_driver mtk_dvfsrc_regulator_driver = { - .driver = { - .name = "mtk-dvfsrc-regulator", - .probe_type = PROBE_PREFER_ASYNCHRONOUS, - }, - .probe = dvfsrc_vcore_regulator_probe, -}; - -static int __init mtk_dvfsrc_regulator_init(void) -{ - return platform_driver_register(&mtk_dvfsrc_regulator_driver); -} -subsys_initcall(mtk_dvfsrc_regulator_init); - -static void __exit mtk_dvfsrc_regulator_exit(void) -{ - platform_driver_unregister(&mtk_dvfsrc_regulator_driver); -} -module_exit(mtk_dvfsrc_regulator_exit); - -MODULE_AUTHOR("Arvin wang "); -MODULE_LICENSE("GPL v2"); -- cgit v1.2.3 From d2ea920a4092b3c0a6a004b93ce198ca37455d90 Mon Sep 17 00:00:00 2001 From: AngeloGioacchino Del Regno Date: Mon, 10 Jun 2024 10:57:34 +0200 Subject: regulator: Add refactored mtk-dvfsrc-regulator driver The previous driver never worked, and never got even compiled because it was missing the DVFSRC driver entirely, including needed neaders. This is a full (or nearly full) refactoring of the MediaTek DVFSRC controlled Regulators driver, retaining support for the MT6873, MT8183 and MT8192 SoC, and adding MT8195. As part of the refactoring, this driver is now probed using its own devicetree compatible, as this is a child of the main DVFSRC driver and gets probed as a subnode of that. Reviewed-by: Mark Brown Signed-off-by: AngeloGioacchino Del Regno Link: https://patch.msgid.link/20240610085735.147134-7-angelogioacchino.delregno@collabora.com Signed-off-by: Mark Brown --- drivers/regulator/mtk-dvfsrc-regulator.c | 196 +++++++++++++++++++++++++++++++ 1 file changed, 196 insertions(+) create mode 100644 drivers/regulator/mtk-dvfsrc-regulator.c (limited to 'drivers') diff --git a/drivers/regulator/mtk-dvfsrc-regulator.c b/drivers/regulator/mtk-dvfsrc-regulator.c new file mode 100644 index 000000000000..9bf4163221f1 --- /dev/null +++ b/drivers/regulator/mtk-dvfsrc-regulator.c @@ -0,0 +1,196 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2020 MediaTek Inc. + * Copyright (c) 2024 Collabora Ltd. + * AngeloGioacchino Del Regno + */ + +#include +#include +#include +#include +#include +#include + +enum dvfsrc_regulator_id { + DVFSRC_ID_VCORE, + DVFSRC_ID_VSCP, + DVFSRC_ID_MAX +}; + +struct dvfsrc_regulator_pdata { + struct regulator_desc *descs; + u32 size; +}; + +#define MTK_DVFSRC_VREG(match, _name, _volt_table) \ +{ \ + .name = match, \ + .of_match = match, \ + .ops = &dvfsrc_vcore_ops, \ + .type = REGULATOR_VOLTAGE, \ + .id = DVFSRC_ID_##_name, \ + .owner = THIS_MODULE, \ + .n_voltages = ARRAY_SIZE(_volt_table), \ + .volt_table = _volt_table, \ +} + +static inline struct device *to_dvfs_regulator_dev(struct regulator_dev *rdev) +{ + return rdev_get_dev(rdev)->parent; +} + +static inline struct device *to_dvfsrc_dev(struct regulator_dev *rdev) +{ + return to_dvfs_regulator_dev(rdev)->parent; +} + +static int dvfsrc_get_cmd(int rdev_id, enum mtk_dvfsrc_cmd *cmd) +{ + switch (rdev_id) { + case DVFSRC_ID_VCORE: + *cmd = MTK_DVFSRC_CMD_VCORE_LEVEL; + break; + case DVFSRC_ID_VSCP: + *cmd = MTK_DVFSRC_CMD_VSCP_LEVEL; + break; + default: + return -EINVAL; + } + + return 0; +} + +static int dvfsrc_set_voltage_sel(struct regulator_dev *rdev, + unsigned int selector) +{ + struct device *dvfsrc_dev = to_dvfsrc_dev(rdev); + enum mtk_dvfsrc_cmd req_cmd; + int id = rdev_get_id(rdev); + int ret; + + ret = dvfsrc_get_cmd(id, &req_cmd); + if (ret) + return ret; + + return mtk_dvfsrc_send_request(dvfsrc_dev, req_cmd, selector); +} + +static int dvfsrc_get_voltage_sel(struct regulator_dev *rdev) +{ + struct device *dvfsrc_dev = to_dvfsrc_dev(rdev); + enum mtk_dvfsrc_cmd query_cmd; + int id = rdev_get_id(rdev); + int val, ret; + + ret = dvfsrc_get_cmd(id, &query_cmd); + if (ret) + return ret; + + ret = mtk_dvfsrc_query_info(dvfsrc_dev, query_cmd, &val); + if (ret) + return ret; + + return val; +} + +static const struct regulator_ops dvfsrc_vcore_ops = { + .list_voltage = regulator_list_voltage_table, + .get_voltage_sel = dvfsrc_get_voltage_sel, + .set_voltage_sel = dvfsrc_set_voltage_sel, +}; + +static const unsigned int mt6873_voltages[] = { + 575000, + 600000, + 650000, + 725000, +}; + +static struct regulator_desc mt6873_regulators[] = { + MTK_DVFSRC_VREG("dvfsrc-vcore", VCORE, mt6873_voltages), + MTK_DVFSRC_VREG("dvfsrc-vscp", VSCP, mt6873_voltages), +}; + +static const struct dvfsrc_regulator_pdata mt6873_data = { + .descs = mt6873_regulators, + .size = ARRAY_SIZE(mt6873_regulators), +}; + +static const unsigned int mt8183_voltages[] = { + 725000, + 800000, +}; + +static struct regulator_desc mt8183_regulators[] = { + MTK_DVFSRC_VREG("dvfsrc-vcore", VCORE, mt8183_voltages), +}; + +static const struct dvfsrc_regulator_pdata mt8183_data = { + .descs = mt8183_regulators, + .size = ARRAY_SIZE(mt8183_regulators), +}; + +static const unsigned int mt8195_voltages[] = { + 550000, + 600000, + 650000, + 750000, +}; + +static struct regulator_desc mt8195_regulators[] = { + MTK_DVFSRC_VREG("dvfsrc-vcore", VCORE, mt8195_voltages), + MTK_DVFSRC_VREG("dvfsrc-vscp", VSCP, mt8195_voltages), +}; + +static const struct dvfsrc_regulator_pdata mt8195_data = { + .descs = mt8195_regulators, + .size = ARRAY_SIZE(mt8195_regulators), +}; + +static int dvfsrc_vcore_regulator_probe(struct platform_device *pdev) +{ + struct regulator_config config = { .dev = &pdev->dev }; + const struct dvfsrc_regulator_pdata *pdata; + int i; + + pdata = device_get_match_data(&pdev->dev); + if (!pdata) + return -EINVAL; + + for (i = 0; i < pdata->size; i++) { + struct regulator_desc *vrdesc = &pdata->descs[i]; + struct regulator_dev *rdev; + + rdev = devm_regulator_register(&pdev->dev, vrdesc, &config); + if (IS_ERR(rdev)) + return dev_err_probe(&pdev->dev, PTR_ERR(rdev), + "failed to register %s\n", vrdesc->name); + } + + return 0; +} + +static const struct of_device_id mtk_dvfsrc_regulator_match[] = { + { .compatible = "mediatek,mt6873-dvfsrc-regulator", .data = &mt6873_data }, + { .compatible = "mediatek,mt8183-dvfsrc-regulator", .data = &mt8183_data }, + { .compatible = "mediatek,mt8192-dvfsrc-regulator", .data = &mt6873_data }, + { .compatible = "mediatek,mt8195-dvfsrc-regulator", .data = &mt8195_data }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(of, mtk_dvfsrc_regulator_match); + +static struct platform_driver mtk_dvfsrc_regulator_driver = { + .driver = { + .name = "mtk-dvfsrc-regulator", + .of_match_table = mtk_dvfsrc_regulator_match, + .probe_type = PROBE_PREFER_ASYNCHRONOUS, + }, + .probe = dvfsrc_vcore_regulator_probe, +}; +module_platform_driver(mtk_dvfsrc_regulator_driver); + +MODULE_AUTHOR("AngeloGioacchino Del Regno "); +MODULE_AUTHOR("Arvin wang "); +MODULE_DESCRIPTION("MediaTek DVFS Resource Collector Regulator driver"); +MODULE_LICENSE("GPL"); -- cgit v1.2.3 From 1cb7d29157603561af4c38535e936850ceb99f0f Mon Sep 17 00:00:00 2001 From: Biju Das Date: Sun, 16 Jun 2024 11:53:55 +0100 Subject: regulator: core: Add helper for allow HW access to enable/disable regulator Add a helper function that allow regulator consumers to allow low-level HW access, in order to enable/disable regulator in atomic context. The use-case for RZ/G2L SoC is to enable VBUS selection register based on vbus detection that happens in interrupt context. Signed-off-by: Biju Das Link: https://patch.msgid.link/20240616105402.45211-4-biju.das.jz@bp.renesas.com Signed-off-by: Mark Brown --- drivers/regulator/core.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'drivers') diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 844e9587a880..7674b7f2df14 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -3408,6 +3408,34 @@ int regulator_list_hardware_vsel(struct regulator *regulator, } EXPORT_SYMBOL_GPL(regulator_list_hardware_vsel); +/** + * regulator_hardware_enable - access the HW for enable/disable regulator + * @regulator: regulator source + * @enable: true for enable, false for disable + * + * Request that the regulator be enabled/disabled with the regulator output at + * the predefined voltage or current value. + * + * On success 0 is returned, otherwise a negative errno is returned. + */ +int regulator_hardware_enable(struct regulator *regulator, bool enable) +{ + struct regulator_dev *rdev = regulator->rdev; + const struct regulator_ops *ops = rdev->desc->ops; + int ret = -EOPNOTSUPP; + + if (!rdev->exclusive || !ops || !ops->enable || !ops->disable) + return ret; + + if (enable) + ret = ops->enable(rdev); + else + ret = ops->disable(rdev); + + return ret; +} +EXPORT_SYMBOL_GPL(regulator_hardware_enable); + /** * regulator_get_linear_step - return the voltage step size between VSEL values * @regulator: regulator source -- cgit v1.2.3 From 84fbd6198766336f627ba08f073fd9970729074e Mon Sep 17 00:00:00 2001 From: Biju Das Date: Sun, 16 Jun 2024 11:53:56 +0100 Subject: regulator: Add Renesas RZ/G2L USB VBUS regulator driver As per the RZ/G2L HW manual, VBUSEN can be controlled by the VBOUT bit of the VBUS Control Register. This register is mapped in the reset framework. The reset driver expose this register as regmap and instantiates this driver. The consumer will use the regulator API to control the VBOUT bit as the control need to be done in the atomic context. Signed-off-by: Biju Das Link: https://patch.msgid.link/20240616105402.45211-5-biju.das.jz@bp.renesas.com Signed-off-by: Mark Brown --- drivers/regulator/Kconfig | 9 ++++ drivers/regulator/Makefile | 1 + drivers/regulator/renesas-usb-vbus-regulator.c | 74 ++++++++++++++++++++++++++ 3 files changed, 84 insertions(+) create mode 100644 drivers/regulator/renesas-usb-vbus-regulator.c (limited to 'drivers') diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig index d333be2bea3b..0281a9a6f4ce 100644 --- a/drivers/regulator/Kconfig +++ b/drivers/regulator/Kconfig @@ -1634,6 +1634,15 @@ config REGULATOR_UNIPHIER help Support for regulators implemented on Socionext UniPhier SoCs. +config REGULATOR_RZG2L_VBCTRL + tristate "Renesas RZ/G2L USB VBUS regulator driver" + depends on ARCH_RZG2L || COMPILE_TEST + depends on OF + select REGMAP_MMIO + default ARCH_RZG2L + help + Support for VBUS regulators implemented on Renesas RZ/G2L SoCs. + config REGULATOR_VCTRL tristate "Voltage controlled regulators" depends on OF diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile index ba15fa5f30ad..6127ffb4b011 100644 --- a/drivers/regulator/Makefile +++ b/drivers/regulator/Makefile @@ -189,6 +189,7 @@ obj-$(CONFIG_REGULATOR_TPS65132) += tps65132-regulator.o obj-$(CONFIG_REGULATOR_TPS68470) += tps68470-regulator.o obj-$(CONFIG_REGULATOR_TWL4030) += twl-regulator.o twl6030-regulator.o obj-$(CONFIG_REGULATOR_UNIPHIER) += uniphier-regulator.o +obj-$(CONFIG_REGULATOR_RZG2L_VBCTRL) += renesas-usb-vbus-regulator.o obj-$(CONFIG_REGULATOR_VCTRL) += vctrl-regulator.o obj-$(CONFIG_REGULATOR_VEXPRESS) += vexpress-regulator.o obj-$(CONFIG_REGULATOR_VQMMC_IPQ4019) += vqmmc-ipq4019-regulator.o diff --git a/drivers/regulator/renesas-usb-vbus-regulator.c b/drivers/regulator/renesas-usb-vbus-regulator.c new file mode 100644 index 000000000000..4eceb6b54497 --- /dev/null +++ b/drivers/regulator/renesas-usb-vbus-regulator.c @@ -0,0 +1,74 @@ +// SPDX-License-Identifier: GPL-2.0 +// +// Renesas USB VBUS output regulator driver +// +// Copyright (C) 2024 Renesas Electronics Corporation +// + +#include +#include +#include +#include +#include +#include +#include +#include + +static const struct regulator_ops rzg2l_usb_vbus_reg_ops = { + .enable = regulator_enable_regmap, + .disable = regulator_disable_regmap, + .is_enabled = regulator_is_enabled_regmap, +}; + +static const struct regulator_desc rzg2l_usb_vbus_rdesc = { + .name = "vbus", + .of_match = of_match_ptr("regulator-vbus"), + .ops = &rzg2l_usb_vbus_reg_ops, + .type = REGULATOR_VOLTAGE, + .owner = THIS_MODULE, + .enable_reg = 0, + .enable_mask = BIT(0), + .enable_is_inverted = true, + .fixed_uV = 5000000, + .n_voltages = 1, +}; + +static int rzg2l_usb_vbus_regulator_probe(struct platform_device *pdev) +{ + struct regulator_config config = { }; + struct device *dev = &pdev->dev; + struct regulator_dev *rdev; + + config.regmap = dev_get_regmap(dev->parent, NULL); + if (!config.regmap) + return dev_err_probe(dev, -ENOENT, "Failed to get regmap\n"); + + config.dev = dev; + config.of_node = of_get_child_by_name(dev->parent->of_node, "regulator-vbus"); + if (!config.of_node) + return dev_err_probe(dev, -ENODEV, "regulator node not found\n"); + + rdev = devm_regulator_register(dev, &rzg2l_usb_vbus_rdesc, &config); + if (IS_ERR(rdev)) { + of_node_put(config.of_node); + return dev_err_probe(dev, PTR_ERR(rdev), + "not able to register vbus regulator\n"); + } + + of_node_put(config.of_node); + + return 0; +} + +static struct platform_driver rzg2l_usb_vbus_regulator_driver = { + .probe = rzg2l_usb_vbus_regulator_probe, + .driver = { + .name = "rzg2l-usb-vbus-regulator", + .probe_type = PROBE_PREFER_ASYNCHRONOUS, + }, +}; +module_platform_driver(rzg2l_usb_vbus_regulator_driver); + +MODULE_AUTHOR("Biju Das "); +MODULE_DESCRIPTION("Renesas RZ/G2L USB Vbus Regulator Driver"); +MODULE_LICENSE("GPL"); -- cgit v1.2.3 From 05db2e27b92302a43f996561dbb58ecabc3cc85d Mon Sep 17 00:00:00 2001 From: Javier Carrasco Date: Thu, 4 Jul 2024 20:13:07 +0200 Subject: regulator: da9121: Constify struct regmap_config `da9121_1ch_regmap_config` and `da9121_2ch_regmap_config` are not modified and can be declared as const to move their data to a read-only section. The pointer that references those structs has been converted to const accordingly. Signed-off-by: Javier Carrasco Link: https://patch.msgid.link/20240704-regulator-const-regmap-v1-1-bce0ddef63ea@gmail.com Signed-off-by: Mark Brown --- drivers/regulator/da9121-regulator.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers') diff --git a/drivers/regulator/da9121-regulator.c b/drivers/regulator/da9121-regulator.c index 3571b6242e3a..d97162f73793 100644 --- a/drivers/regulator/da9121-regulator.c +++ b/drivers/regulator/da9121-regulator.c @@ -865,7 +865,7 @@ static const struct regmap_access_table da9121_volatile_table = { }; /* DA9121 regmap config for 1 channel variants */ -static struct regmap_config da9121_1ch_regmap_config = { +static const struct regmap_config da9121_1ch_regmap_config = { .reg_bits = 8, .val_bits = 8, .max_register = DA9121_REG_OTP_CONFIG_ID, @@ -876,7 +876,7 @@ static struct regmap_config da9121_1ch_regmap_config = { }; /* DA9121 regmap config for 2 channel variants */ -static struct regmap_config da9121_2ch_regmap_config = { +static const struct regmap_config da9121_2ch_regmap_config = { .reg_bits = 8, .val_bits = 8, .max_register = DA9121_REG_OTP_CONFIG_ID, @@ -993,7 +993,7 @@ error: static int da9121_assign_chip_model(struct i2c_client *i2c, struct da9121 *chip) { - struct regmap_config *regmap; + const struct regmap_config *regmap; int ret = 0; chip->dev = &i2c->dev; -- cgit v1.2.3 From 32d1171014a74c788218e0a8a5fd6fef65fb10ba Mon Sep 17 00:00:00 2001 From: Javier Carrasco Date: Thu, 4 Jul 2024 20:13:08 +0200 Subject: regulator: max77857: Constify struct regmap_config `max77857_remgap_config` is not modified and can be declared as const to move its data to a read-only section. Signed-off-by: Javier Carrasco Link: https://patch.msgid.link/20240704-regulator-const-regmap-v1-2-bce0ddef63ea@gmail.com Signed-off-by: Mark Brown --- drivers/regulator/max77857-regulator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/regulator/max77857-regulator.c b/drivers/regulator/max77857-regulator.c index 145ad0281857..bc28dc8503a8 100644 --- a/drivers/regulator/max77857-regulator.c +++ b/drivers/regulator/max77857-regulator.c @@ -67,7 +67,7 @@ static bool max77857_volatile_reg(struct device *dev, unsigned int reg) } } -static struct regmap_config max77857_regmap_config = { +static const struct regmap_config max77857_regmap_config = { .reg_bits = 8, .val_bits = 8, .cache_type = REGCACHE_MAPLE, -- cgit v1.2.3 From 83808c54064eef620ad8645dfdcaffe125551532 Mon Sep 17 00:00:00 2001 From: Frieder Schrempf Date: Mon, 8 Jul 2024 10:40:34 +0200 Subject: regulator: pca9450: Make IRQ optional The IRQ line might not be connected on some boards. Allow the driver to be probed without it. Signed-off-by: Frieder Schrempf Link: https://patch.msgid.link/20240708084107.38986-5-frieder@fris.de Signed-off-by: Mark Brown --- drivers/regulator/pca9450-regulator.c | 41 ++++++++++++++++------------------- 1 file changed, 19 insertions(+), 22 deletions(-) (limited to 'drivers') diff --git a/drivers/regulator/pca9450-regulator.c b/drivers/regulator/pca9450-regulator.c index be488c5dff14..9714afe347dc 100644 --- a/drivers/regulator/pca9450-regulator.c +++ b/drivers/regulator/pca9450-regulator.c @@ -891,11 +891,6 @@ static int pca9450_i2c_probe(struct i2c_client *i2c) unsigned int reset_ctrl; int ret; - if (!i2c->irq) { - dev_err(&i2c->dev, "No IRQ configured?\n"); - return -EINVAL; - } - pca9450 = devm_kzalloc(&i2c->dev, sizeof(struct pca9450), GFP_KERNEL); if (!pca9450) return -ENOMEM; @@ -967,23 +962,25 @@ static int pca9450_i2c_probe(struct i2c_client *i2c) } } - ret = devm_request_threaded_irq(pca9450->dev, pca9450->irq, NULL, - pca9450_irq_handler, - (IRQF_TRIGGER_FALLING | IRQF_ONESHOT), - "pca9450-irq", pca9450); - if (ret != 0) { - dev_err(pca9450->dev, "Failed to request IRQ: %d\n", - pca9450->irq); - return ret; - } - /* Unmask all interrupt except PWRON/WDOG/RSVD */ - ret = regmap_update_bits(pca9450->regmap, PCA9450_REG_INT1_MSK, - IRQ_VR_FLT1 | IRQ_VR_FLT2 | IRQ_LOWVSYS | - IRQ_THERM_105 | IRQ_THERM_125, - IRQ_PWRON | IRQ_WDOGB | IRQ_RSVD); - if (ret) { - dev_err(&i2c->dev, "Unmask irq error\n"); - return ret; + if (pca9450->irq) { + ret = devm_request_threaded_irq(pca9450->dev, pca9450->irq, NULL, + pca9450_irq_handler, + (IRQF_TRIGGER_FALLING | IRQF_ONESHOT), + "pca9450-irq", pca9450); + if (ret != 0) { + dev_err(pca9450->dev, "Failed to request IRQ: %d\n", + pca9450->irq); + return ret; + } + /* Unmask all interrupt except PWRON/WDOG/RSVD */ + ret = regmap_update_bits(pca9450->regmap, PCA9450_REG_INT1_MSK, + IRQ_VR_FLT1 | IRQ_VR_FLT2 | IRQ_LOWVSYS | + IRQ_THERM_105 | IRQ_THERM_125, + IRQ_PWRON | IRQ_WDOGB | IRQ_RSVD); + if (ret) { + dev_err(&i2c->dev, "Unmask irq error\n"); + return ret; + } } /* Clear PRESET_EN bit in BUCK123_DVS to use DVS registers */ -- cgit v1.2.3