regulator: core: let dt properties override driver init_data
PATCH 1/1 regulator: core: let dt properties override driver init_data
This reverts commit cd7a38c40b231350a3cd0fd774f4e6bb68c4b411.
When submitting the change above, it was thought that the origin of the init_data should be a clear choice, from the driver or from DT but not both.
It turns out some devices, such as qcom-msm8974-lge-nexus5-hammerhead, relied on the old behaviour to override the init_data provided by the driver, making it some kind of default if none is provided by the platform.
Using the init_data provided by the driver when it is present broke these devices so revert the change to fixup the situation and add a comment to make things a bit more clear
--- drivers/regulator/core.c | 61 +++++++++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 34 deletions(-)
drivers/regulator/core.c +27 -34
@@ -5774,43 +5774,36 @@ regulator_register(struct device *dev, goto clean; } -if (config->init_data) { -/* -* Providing of_match means the framework is expected to parse -* DT to get the init_data. This would conflict with provided -* init_data, if set. Warn if it happens. -*/ -if (regulator_desc->of_match) -dev_warn (dev,"Using provided init data - OF match ignored\n" ); +/* +* DT may override the config->init_data provided if the platform +* needs to do so. If so, config->init_data is completely ignored. +*/ + init_data =regulator_of_get_init_data (dev, regulator_desc, config, + &rdev->dev.of_node); +/* +* Sometimes not all resources are probed already so we need to take +* that into account. This happens most the time if the ena_gpiod comes +* from a gpio extender or something else. +*/ +if (PTR_ERR (init_data) == -EPROBE_DEFER ) { + ret = -EPROBE_DEFER ; + goto clean; + } + +/* +* We need to keep track of any GPIO descriptor coming from the +* device tree until we have handled it over to the core. If the +* config that was passed in to this function DOES NOT contain +* a descriptor, and the config after this call DOES contain +* a descriptor, we definitely got one from parsing the device +* tree. +*/ +if (!cfg->ena_gpiod && config->ena_gpiod) + dangling_of_gpiod = true; +if (!init_data) { init_data = config->init_data; rdev->dev.of_node =of_node_get (config->of_node); - - }else { - init_data =regulator_of_get_init_data (dev, regulator_desc, - config, - &rdev->dev.of_node); - -/* -* Sometimes not all resources are probed already so we need to -* take that into account. This happens most the time if the -* ena_gpiod comes from a gpio extender or something else. -*/ -if (PTR_ERR (init_data) == -EPROBE_DEFER ) { - ret = -EPROBE_DEFER ; - goto clean; - } - -/* -* We need to keep track of any GPIO descriptor coming from the -* device tree until we have handled it over to the core. If the -* config that was passed in to this function DOES NOT contain a -* descriptor, and the config after this call DOES contain a -* descriptor, we definitely got one from parsing the device -* tree. -*/ -if (!cfg->ena_gpiod && config->ena_gpiod) - dangling_of_gpiod = true; }ww_mutex_init (&rdev->mutex, ®ulator_ww_class);
---
base-commit: 2014c95afecee3e76ca4a56956a936e23283f05b
change-id: 20250211-regulator-init-data-fixup-ef6b537bc77c
Best regards,
Signature · 1 line
Jerome
Mark Brown
maintainerQuoted 11 lines · Jerome Brunet
This reverts commit
cd7a38c40b231350a3cd0fd774f4e6bb68c4b411.When submitting the change above, it was thought that the origin of the
init_datashould be a clear choice, from the driver or from DT but not both.It turns out some devices, such as qcom-msm8974-lge-nexus5-hammerhead, relied on the old behaviour to override the
init_dataprovided by the driver, making it some kind of default if none is provided by the platform.[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next
Thanks!
[1/1] regulator: core: let dt properties override driver init_data
commit: 35e21de48e693af1dcfdbf2dc3d73dcfa3c8f2d9
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark