diff options
author | Jerome Brunet <jbrunet@baylibre.com> | 2024-10-08 18:07:02 +0200 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2024-10-22 21:49:14 +0200 |
commit | cfcdf395c21eeac4543d2b8fef9d29ae9e4559e9 (patch) | |
tree | e9bcd01dc3bdd912cf7d4acf740014031a71b617 /drivers/regulator | |
parent | regulator: core: do not silently ignore provided init_data (diff) | |
download | linux-cfcdf395c21eeac4543d2b8fef9d29ae9e4559e9.tar.xz linux-cfcdf395c21eeac4543d2b8fef9d29ae9e4559e9.zip |
regulator: core: add callback to perform runtime init
Provide an initialisation callback to handle runtime parameters.
The idea is similar to the regulator_init() callback, but it provides
regulator specific structures, instead of just the driver specific data.
As an example, this allows the driver to amend the regulator constraints
based on runtime parameters if necessary.
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Link: https://patch.msgid.link/20241008-regulator-ignored-data-v2-2-d1251e0ee507@baylibre.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/regulator')
-rw-r--r-- | drivers/regulator/core.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 24bb7f5b12e3..eecb05a0d08c 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -5758,6 +5758,12 @@ regulator_register(struct device *dev, goto wash; } + if (regulator_desc->init_cb) { + ret = regulator_desc->init_cb(rdev, config); + if (ret < 0) + goto wash; + } + if ((rdev->supply_name && !rdev->supply) && (rdev->constraints->always_on || rdev->constraints->boot_on)) { |