Skip to content

Commit 649a819

Browse files
gmarullcarlescufi
authored andcommitted
drivers: regulator: pca9420: refactor mode handling
- Similar to what was done for other parts of the driver, remove any register specification from Devicetree (modesel-reg/mask) - Keep all the information in the driver, and define modes as "numbers", e.g. PCA9420_MODE0: 0, PCA9420_MODE1: 1, etc. - Bindings provide IC defaults now (all modes allowed 0/1/2/3 and initial mode set to 0). - When mode is controlled via the MODESEL0/1 pins (ie directly by an iMX MCU using the dedicated PMIC_MODE0/1 pins), the driver will not allow to select a mode (it is not possible). This mode is now enabled by setting `nxp,enable-modesel-pins` in Devicetree. When enabled, all the allowed modes are configured to be selectable via pins. When disabled, mode can be set via I2C (using TOP_CNTL3 MODE0/1_I2C fields) Signed-off-by: Gerard Marull-Paretas <[email protected]>
1 parent 535f5a6 commit 649a819

File tree

5 files changed

+158
-307
lines changed

5 files changed

+158
-307
lines changed

boards/arm/mimxrt595_evk/mimxrt595_evk_cm33.dts

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -159,28 +159,10 @@ arduino_serial: &flexcomm12 {
159159
pinctrl-names = "default";
160160

161161
pca9420: pca9420@61 {
162-
reg = <0x61>;
163162
compatible = "nxp,pca9420";
164-
/*
165-
* This mode-reg setting will permit mode control by
166-
* pins, a feature of the PCA9240. If mode control via
167-
* I2C is desired, the following settings
168-
* should be used:
169-
* regulator-initial-mode = <PCA9420_MODECFG0_I2C>;
170-
* regulator-allowed-modes = <PCA9420_MODECFG0_I2C>,
171-
* <PCA9420_MODECFG1_I2C>,
172-
* <PCA9420_MODECFG2_I2C>,
173-
* <PCA9420_MODECFG3_I2C>;
174-
* modesel-reg = <PCA9420_TOP_CNTL3>;
175-
* modesel-mask = <PCA9420_TOP_CNTL3_MODE_I2C_MASK>;
176-
*/
177-
regulator-allowed-modes = <PCA9420_MODECFG0_PIN>,
178-
<PCA9420_MODECFG1_PIN>,
179-
<PCA9420_MODECFG2_PIN>,
180-
<PCA9420_MODECFG3_PIN>;
181-
regulator-initial-mode = <PCA9420_MODECFG0_PIN>;
182-
modesel-reg = <PCA9420_MODECFG_0_0>;
183-
modesel-mask = <PCA9420_MODECFG_0_MODE_CTRL_SEL_MASK>;
163+
reg = <0x61>;
164+
nxp,enable-modesel-pins;
165+
184166
pca9420_sw1: BUCK1 {
185167
regulator-min-microvolt = <500000>;
186168
regulator-max-microvolt = <1800000>;

boards/arm/mimxrt685_evk/mimxrt685_evk_cm33.dts

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -229,28 +229,10 @@ i2s1: &flexcomm3 {
229229
pinctrl-names = "default";
230230

231231
pca9420: pca9420@61 {
232-
reg = <0x61>;
233232
compatible = "nxp,pca9420";
234-
/*
235-
* This mode-reg setting will permit mode control by
236-
* pins, a feature of the PCA9240. If mode control via
237-
* I2C is desired, the following settings
238-
* should be used:
239-
* regulator-initial-mode = <PCA9420_MODECFG0_I2C>;
240-
* regulator-allowed-modes = <PCA9420_MODECFG0_I2C>,
241-
* <PCA9420_MODECFG1_I2C>,
242-
* <PCA9420_MODECFG2_I2C>,
243-
* <PCA9420_MODECFG3_I2C>;
244-
* modesel-reg = <PCA9420_TOP_CNTL3>;
245-
* modesel-mask = <PCA9420_TOP_CNTL3_MODE_I2C_MASK>;
246-
*/
247-
regulator-allowed-modes = <PCA9420_MODECFG0_PIN>,
248-
<PCA9420_MODECFG1_PIN>,
249-
<PCA9420_MODECFG2_PIN>,
250-
<PCA9420_MODECFG3_PIN>;
251-
regulator-initial-mode = <PCA9420_MODECFG0_PIN>;
252-
modesel-reg = <PCA9420_MODECFG_0_0>;
253-
modesel-mask = <PCA9420_MODECFG_0_MODE_CTRL_SEL_MASK>;
233+
reg = <0x61>;
234+
nxp,enable-modesel-pins;
235+
254236
BUCK1 {
255237
regulator-min-microvolt = <500000>;
256238
regulator-max-microvolt = <1800000>;

0 commit comments

Comments
 (0)