regulator: tps65217: Convert to use linear ranges
Below is the equation in original code: tps65217_uv1_ranges: 0 ... 24: uV = vsel * 25000 + 900000; 25 ... 52: uV = (vsel - 24) * 50000 + 1500000; = (vsel - 25) * 50000 + 1550000; 53 ... 55: uV = (vsel - 52) * 100000 + 2900000; = (vsel - 53) * 100000 + 3000000; 56 ... 62: uV = 3300000; tps65217_uv2_ranges: 0 ... 8: uV = vsel * 50000 + 1500000; 9 ... 13: uV = (vsel - 8) * 100000 + 1900000; = (vsel - 9) * 100000 + 2000000; 14 ... 31: uV = (vsel - 13) * 50000 + 2400000; = (vsel - 14) * 50000 + 2450000; The voltage tables are composed of linear ranges. This patch converts this driver to use multiple linear ranges APIs. In original code, voltage range for DCDC1 is 900000 ~ 1800000 and voltage range for DCDC3 is 900000 ~ 1500000. This patch separates the range 25~52 in tps65217_uv1_ranges table to two linear ranges: 25~30 and 31~52. This change makes it possible to reuse the same linear_ranges table for DCDCx. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@linaro.org>
This commit is contained in:
@@ -243,24 +243,6 @@ struct tps65217_board {
|
||||
struct tps65217_bl_pdata *bl_pdata;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct tps_info - packages regulator constraints
|
||||
* @name: Voltage regulator name
|
||||
* @min_uV: minimum micro volts
|
||||
* @max_uV: minimum micro volts
|
||||
* @vsel_to_uv: Function pointer to get voltage from selector
|
||||
* @uv_to_vsel: Function pointer to get selector from voltage
|
||||
*
|
||||
* This data is used to check the regualtor voltage limits while setting.
|
||||
*/
|
||||
struct tps_info {
|
||||
const char *name;
|
||||
int min_uV;
|
||||
int max_uV;
|
||||
int (*vsel_to_uv)(unsigned int vsel);
|
||||
int (*uv_to_vsel)(int uV, unsigned int *vsel);
|
||||
};
|
||||
|
||||
/**
|
||||
* struct tps65217 - tps65217 sub-driver chip access routines
|
||||
*
|
||||
@@ -273,7 +255,6 @@ struct tps65217 {
|
||||
unsigned int id;
|
||||
struct regulator_desc desc[TPS65217_NUM_REGULATOR];
|
||||
struct regulator_dev *rdev[TPS65217_NUM_REGULATOR];
|
||||
struct tps_info *info[TPS65217_NUM_REGULATOR];
|
||||
struct regmap *regmap;
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user