summaryrefslogtreecommitdiff
path: root/drivers/regulator/tps6287x-regulator.c
diff options
context:
space:
mode:
authorChen-Yu Tsai <wenst@chromium.org>2023-07-14 11:14:07 +0300
committerMark Brown <broonie@kernel.org>2023-07-25 14:14:27 +0300
commit269cb04b601dd8c35bbee180a9800335b93111fb (patch)
tree9210f24e017313a26b3adb2b15376693a4f225a6 /drivers/regulator/tps6287x-regulator.c
parent55c8b8ddc0d95912c7b0d066aaa4bbac146e3c42 (diff)
downloadlinux-269cb04b601dd8c35bbee180a9800335b93111fb.tar.xz
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>
Diffstat (limited to 'drivers/regulator/tps6287x-regulator.c')
-rw-r--r--drivers/regulator/tps6287x-regulator.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/regulator/tps6287x-regulator.c b/drivers/regulator/tps6287x-regulator.c
index 19a4a300a963..d022184a8e7d 100644
--- a/drivers/regulator/tps6287x-regulator.c
+++ b/drivers/regulator/tps6287x-regulator.c
@@ -41,7 +41,7 @@ static const struct linear_range tps6287x_voltage_ranges[] = {
};
static const unsigned int tps6287x_voltage_range_sel[] = {
- 0x0, 0x4, 0x8, 0xC
+ 0x0, 0x1, 0x2, 0x3
};
static const unsigned int tps6287x_ramp_table[] = {
@@ -122,7 +122,7 @@ static struct regulator_desc tps6287x_reg = {
.n_voltages = 256,
.linear_ranges = tps6287x_voltage_ranges,
.n_linear_ranges = ARRAY_SIZE(tps6287x_voltage_ranges),
- .linear_range_selectors = tps6287x_voltage_range_sel,
+ .linear_range_selectors_bitfield = tps6287x_voltage_range_sel,
};
static int tps6287x_i2c_probe(struct i2c_client *i2c)