summaryrefslogtreecommitdiff
path: root/drivers/regulator/rohm-regulator.c
AgeCommit message (Collapse)Author
2024-05-16regulator: rohm-regulator: warn if unsupported voltage is setMatti Vaittinen
A few of the ROHM PMICs allow setting low-power state specific voltages for regulators. These voltages are then taken in use (by the hardware) when the PMIC state is changed. The voltages for these states can be given via device-tree. If unsupported voltage has been given, the users have only seen print: "driver callback failed to parse DT for regulator <name>". This does help to pinpoint the problem to some extent, but there may be several properties in device-tree so it should help if we can be a bit more specific. Print the voltage value and the run-state property if voltage can not be supported. Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com> Link: https://msgid.link/r/0937411855967cbefd9ff2d6045a52ca26712c4a.1715848512.git.mazziesaccount@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-07-25regulator: Use bitfield values for range selectorsChen-Yu Tsai
Right now the regulator helpers expect raw register values for the range selectors. This is different from the voltage selectors, which are normalized as bitfield values. This leads to a bit of confusion. Also, raw values are harder to copy from datasheets or match up with them, as datasheets will typically have bitfield values. Make the helpers expect bitfield values, and convert existing users. The field in regulator_desc is renamed to |linear_range_selectors_bitfield|. This is intended to cause drivers added in the same merge window and out-of-tree drivers using the incorrect variable and values to break, preventing incorrect values being used on actual hardware and potentially producing magic smoke. Also include bitops.h explicitly for ffs(), and reorder the header include statements. While at it, also replace module.h with export.h, since the only use is EXPORT_SYMBOL_GPL. Signed-off-by: Chen-Yu Tsai <wenst@chromium.org> Link: https://lore.kernel.org/r/20230714081408.274567-1-wenst@chromium.org Signed-off-by: Mark Brown <broonie@kernel.org>
2021-11-18regulator: rohm-regulator: add helper for restricted voltage settingMatti Vaittinen
Few ROHM PMICs have regulators where voltage setting can be done only when regulator is disabled. Add helper for those PMICs. Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com> Link: https://lore.kernel.org/r/6f51871e9fea611d133b5dd2560f4a7ee1ede9cd.1637233864.git.matti.vaittinen@fi.rohmeurope.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-14regulator: rohm-regulator: Support SNVS HW state.Matti Vaittinen
The ROHM BD71815 supports setting voltage levels/regulator status for HW-states "RUN", "SUSPEND", "LPSR" and "SNVS". Add DT parsing helper also for SNVS state. Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com> Acked-by: Mark Brown <broonie@kernel.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2021-04-14regulator: rohm-regulator: linear voltage supportMatti Vaittinen
The helper for obtaining HW-state based DVS voltage levels currently only works for regulators using linear-ranges. Extend support to regulators with simple linear mappings and add also proper error path if pickable-ranges regulators call this. Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com> Acked-by: Mark Brown <broonie@kernel.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2021-02-12regulator: bd718x7, bd71828, Fix dvs voltage levelsMatti Vaittinen
The ROHM BD718x7 and BD71828 drivers support setting HW state specific voltages from device-tree. This is used also by various in-tree DTS files. These drivers do incorrectly try to compose bit-map using enum values. By a chance this works for first two valid levels having values 1 and 2 - but setting values for the rest of the levels do indicate capability of setting values for first levels as well. Luckily the regulators which support setting values for SUSPEND/LPSR do usually also support setting values for RUN and IDLE too - thus this has not been such a fatal issue. Fix this by defining the old enum values as bits and fixing the parsing code. This allows keeping existing IC specific drivers intact and only slightly changing the rohm-regulator.c Fixes: 21b72156ede8b ("regulator: bd718x7: Split driver to common and bd718x7 specific parts") Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com> Acked-by: Lee Jones <lee.jones@linaro.org> Link: https://lore.kernel.org/r/20210212080023.GA880728@localhost.localdomain Signed-off-by: Mark Brown <broonie@kernel.org>
2020-01-24regulator: bd718x7: Split driver to common and bd718x7 specific partsMatti Vaittinen
Few ROHM PMICs allow setting the voltage states for different system states like RUN, IDLE, SUSPEND and LPSR. States are then changed via SoC specific mechanisms. bd718x7 driver implemented device-tree parsing functions for these state specific voltages. The parsing functions can be re-used by other ROHM chip drivers like bd71828. Split the generic functions from bd718x7-regulator.c to rohm-regulator.c and export them for other modules to use. Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com> Acked-by: Mark Brown <broonie@kernel.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>