Commit 9b558950bb652a85861fef28172e134c367dab1a
Committed by
Mark Brown
1 parent
93f5de5c58
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
regulator: max1586: Convert max1586_v3_ops to set_voltage_sel and map_voltage_linear
Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Showing 1 changed file with 6 additions and 16 deletions Side-by-side Diff
drivers/regulator/max1586.c
... | ... | @@ -63,28 +63,17 @@ |
63 | 63 | * R24 and R25=100kOhm as described in the data sheet. |
64 | 64 | * The gain is approximately: 1 + R24/R25 + R24/185.5kOhm |
65 | 65 | */ |
66 | -static int max1586_v3_set(struct regulator_dev *rdev, int min_uV, int max_uV, | |
67 | - unsigned *selector) | |
66 | +static int max1586_v3_set_voltage_sel(struct regulator_dev *rdev, | |
67 | + unsigned selector) | |
68 | 68 | { |
69 | 69 | struct max1586_data *max1586 = rdev_get_drvdata(rdev); |
70 | 70 | struct i2c_client *client = max1586->client; |
71 | - unsigned range_uV = max1586->max_uV - max1586->min_uV; | |
72 | 71 | u8 v3_prog; |
73 | 72 | |
74 | - if (min_uV > max1586->max_uV || max_uV < max1586->min_uV) | |
75 | - return -EINVAL; | |
76 | - if (min_uV < max1586->min_uV) | |
77 | - min_uV = max1586->min_uV; | |
78 | - | |
79 | - *selector = DIV_ROUND_UP((min_uV - max1586->min_uV) * | |
80 | - MAX1586_V3_MAX_VSEL, range_uV); | |
81 | - if (regulator_list_voltage_linear(rdev, *selector) > max_uV) | |
82 | - return -EINVAL; | |
83 | - | |
84 | 73 | dev_dbg(&client->dev, "changing voltage v3 to %dmv\n", |
85 | - regulator_list_voltage_linear(rdev, *selector) / 1000); | |
74 | + regulator_list_voltage_linear(rdev, selector) / 1000); | |
86 | 75 | |
87 | - v3_prog = I2C_V3_SELECT | (u8) *selector; | |
76 | + v3_prog = I2C_V3_SELECT | (u8) selector; | |
88 | 77 | return i2c_smbus_write_byte(client, v3_prog); |
89 | 78 | } |
90 | 79 | |
91 | 80 | |
... | ... | @@ -106,8 +95,9 @@ |
106 | 95 | * the set up value. |
107 | 96 | */ |
108 | 97 | static struct regulator_ops max1586_v3_ops = { |
109 | - .set_voltage = max1586_v3_set, | |
98 | + .set_voltage_sel = max1586_v3_set_voltage_sel, | |
110 | 99 | .list_voltage = regulator_list_voltage_linear, |
100 | + .map_voltage = regulator_map_voltage_linear, | |
111 | 101 | }; |
112 | 102 | |
113 | 103 | static struct regulator_ops max1586_v6_ops = { |