regulator: Use bitfield values for range selectors
authorChen-Yu Tsai <wenst@chromium.org>
Fri, 14 Jul 2023 08:14:07 +0000 (16:14 +0800)
committerMark Brown <broonie@kernel.org>
Tue, 25 Jul 2023 11:14:27 +0000 (12:14 +0100)
commit269cb04b601dd8c35bbee180a9800335b93111fb
tree9210f24e017313a26b3adb2b15376693a4f225a6
parent55c8b8ddc0d95912c7b0d066aaa4bbac146e3c42
regulator: Use bitfield values for range selectors

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>
drivers/regulator/atc260x-regulator.c
drivers/regulator/bd718x7-regulator.c
drivers/regulator/helpers.c
drivers/regulator/max77541-regulator.c
drivers/regulator/max77650-regulator.c
drivers/regulator/rohm-regulator.c
drivers/regulator/tps6287x-regulator.c
include/linux/regulator/driver.h