Révision | 67b5663d771121b3d606fc3346dc83024618448b (tree) |
---|---|
l'heure | 2022-07-27 13:04:34 |
Auteur | Heiko Thiery <heiko.thiery@gmai...> |
Commiter | Jaehoon Chung |
pmic: pca9450: permit config on all bucks and LDOs
In order to have the possibility to configure the regulators at system
startup through DM support, all LDOs and bucks must be able to be
changeable. Currently there is a limitation to change the values when
the output is enabled. Since the driver is based on the ROHM BD71837 and a
comment that describes a limitation about switching while the output is
enabled can also be found there, the limitation probably comes from this type.
Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
Reviewed-by: Fabio Estevam <festevam@denx.de>
@@ -44,7 +44,6 @@ struct pca9450_vrange { | ||
44 | 44 | * @ranges: pointer to ranges of regulator voltages and matching register |
45 | 45 | * values |
46 | 46 | * @numranges: number of voltage ranges pointed by ranges |
47 | - * @dvs: whether the voltage can be changed when regulator is enabled | |
48 | 47 | */ |
49 | 48 | struct pca9450_plat { |
50 | 49 | const char *name; |
@@ -54,7 +53,6 @@ struct pca9450_plat { | ||
54 | 53 | u8 volt_mask; |
55 | 54 | struct pca9450_vrange *ranges; |
56 | 55 | unsigned int numranges; |
57 | - bool dvs; | |
58 | 56 | }; |
59 | 57 | |
60 | 58 | #define PCA_RANGE(_min, _vstep, _sel_low, _sel_hi) \ |
@@ -63,11 +61,11 @@ struct pca9450_plat { | ||
63 | 61 | .min_sel = (_sel_low), .max_sel = (_sel_hi), \ |
64 | 62 | } |
65 | 63 | |
66 | -#define PCA_DATA(_name, enreg, enmask, vreg, vmask, _range, _dvs) \ | |
64 | +#define PCA_DATA(_name, enreg, enmask, vreg, vmask, _range) \ | |
67 | 65 | { \ |
68 | 66 | .name = (_name), .enable_reg = (enreg), .enablemask = (enmask), \ |
69 | 67 | .volt_reg = (vreg), .volt_mask = (vmask), .ranges = (_range), \ |
70 | - .numranges = ARRAY_SIZE(_range), .dvs = (_dvs), \ | |
68 | + .numranges = ARRAY_SIZE(_range) \ | |
71 | 69 | } |
72 | 70 | |
73 | 71 | static struct pca9450_vrange pca9450_buck123_vranges[] = { |
@@ -107,39 +105,39 @@ static struct pca9450_plat pca9450_reg_data[] = { | ||
107 | 105 | /* Bucks 1-3 which support dynamic voltage scaling */ |
108 | 106 | PCA_DATA("BUCK1", PCA9450_BUCK1CTRL, HW_STATE_CONTROL, |
109 | 107 | PCA9450_BUCK1OUT_DVS0, PCA9450_DVS_BUCK_RUN_MASK, |
110 | - pca9450_buck123_vranges, true), | |
108 | + pca9450_buck123_vranges), | |
111 | 109 | PCA_DATA("BUCK2", PCA9450_BUCK2CTRL, HW_STATE_CONTROL, |
112 | 110 | PCA9450_BUCK2OUT_DVS0, PCA9450_DVS_BUCK_RUN_MASK, |
113 | - pca9450_buck123_vranges, true), | |
111 | + pca9450_buck123_vranges), | |
114 | 112 | PCA_DATA("BUCK3", PCA9450_BUCK3CTRL, HW_STATE_CONTROL, |
115 | 113 | PCA9450_BUCK3OUT_DVS0, PCA9450_DVS_BUCK_RUN_MASK, |
116 | - pca9450_buck123_vranges, true), | |
114 | + pca9450_buck123_vranges), | |
117 | 115 | /* Bucks 4-6 which do not support dynamic voltage scaling */ |
118 | 116 | PCA_DATA("BUCK4", PCA9450_BUCK4CTRL, HW_STATE_CONTROL, |
119 | 117 | PCA9450_BUCK4OUT, PCA9450_DVS_BUCK_RUN_MASK, |
120 | - pca9450_buck456_vranges, false), | |
118 | + pca9450_buck456_vranges), | |
121 | 119 | PCA_DATA("BUCK5", PCA9450_BUCK5CTRL, HW_STATE_CONTROL, |
122 | 120 | PCA9450_BUCK5OUT, PCA9450_DVS_BUCK_RUN_MASK, |
123 | - pca9450_buck456_vranges, false), | |
121 | + pca9450_buck456_vranges), | |
124 | 122 | PCA_DATA("BUCK6", PCA9450_BUCK6CTRL, HW_STATE_CONTROL, |
125 | 123 | PCA9450_BUCK6OUT, PCA9450_DVS_BUCK_RUN_MASK, |
126 | - pca9450_buck456_vranges, false), | |
124 | + pca9450_buck456_vranges), | |
127 | 125 | /* LDOs */ |
128 | 126 | PCA_DATA("LDO1", PCA9450_LDO1CTRL, HW_STATE_CONTROL, |
129 | 127 | PCA9450_LDO1CTRL, PCA9450_LDO12_MASK, |
130 | - pca9450_ldo1_vranges, false), | |
128 | + pca9450_ldo1_vranges), | |
131 | 129 | PCA_DATA("LDO2", PCA9450_LDO2CTRL, HW_STATE_CONTROL, |
132 | 130 | PCA9450_LDO2CTRL, PCA9450_LDO12_MASK, |
133 | - pca9450_ldo2_vranges, false), | |
131 | + pca9450_ldo2_vranges), | |
134 | 132 | PCA_DATA("LDO3", PCA9450_LDO3CTRL, HW_STATE_CONTROL, |
135 | 133 | PCA9450_LDO3CTRL, PCA9450_LDO34_MASK, |
136 | - pca9450_ldo34_vranges, false), | |
134 | + pca9450_ldo34_vranges), | |
137 | 135 | PCA_DATA("LDO4", PCA9450_LDO4CTRL, HW_STATE_CONTROL, |
138 | 136 | PCA9450_LDO4CTRL, PCA9450_LDO34_MASK, |
139 | - pca9450_ldo34_vranges, false), | |
137 | + pca9450_ldo34_vranges), | |
140 | 138 | PCA_DATA("LDO5", PCA9450_LDO5CTRL_H, HW_STATE_CONTROL, |
141 | 139 | PCA9450_LDO5CTRL_H, PCA9450_LDO5_MASK, |
142 | - pca9450_ldo5_vranges, false), | |
140 | + pca9450_ldo5_vranges), | |
143 | 141 | }; |
144 | 142 | |
145 | 143 | static int vrange_find_value(struct pca9450_vrange *r, unsigned int sel, |
@@ -246,20 +244,6 @@ static int pca9450_set_value(struct udevice *dev, int uvolt) | ||
246 | 244 | unsigned int sel; |
247 | 245 | int i, found = 0; |
248 | 246 | |
249 | - /* | |
250 | - * An under/overshooting may occur if voltage is changed for other | |
251 | - * regulators but buck 1,2,3 or 4 when regulator is enabled. Prevent | |
252 | - * change to protect the HW | |
253 | - */ | |
254 | - if (!plat->dvs) | |
255 | - if (pca9450_get_enable(dev)) { | |
256 | - /* If the value is already set, skip the warning. */ | |
257 | - if (pca9450_get_value(dev) == uvolt) | |
258 | - return 0; | |
259 | - pr_err("Only DVS bucks can be changed when enabled\n"); | |
260 | - return -EINVAL; | |
261 | - } | |
262 | - | |
263 | 247 | for (i = 0; i < plat->numranges; i++) { |
264 | 248 | struct pca9450_vrange *r = &plat->ranges[i]; |
265 | 249 |