Skip to content

Commit 62139f5

Browse files
Per-Daniel Olssonbroonie
authored andcommitted
regulator: pca9450: Make I2C Level Translator configurable
Make the I2C Level Translator included in PCA9450 configurable from devicetree. The reset state is off. By setting nxp,i2c-lt-enable, the I2C Level Translator will be enabled while in STANDBY or RUN state. Signed-off-by: Per-Daniel Olsson <[email protected]> Signed-off-by: Rickard x Andersson <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent e721b16 commit 62139f5

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

drivers/regulator/pca9450-regulator.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -810,6 +810,17 @@ static int pca9450_i2c_probe(struct i2c_client *i2c,
810810
return ret;
811811
}
812812

813+
if (of_property_read_bool(i2c->dev.of_node, "nxp,i2c-lt-enable")) {
814+
/* Enable I2C Level Translator */
815+
ret = regmap_update_bits(pca9450->regmap, PCA9450_REG_CONFIG2,
816+
I2C_LT_MASK, I2C_LT_ON_STANDBY_RUN);
817+
if (ret) {
818+
dev_err(&i2c->dev,
819+
"Failed to enable I2C level translator\n");
820+
return ret;
821+
}
822+
}
823+
813824
/*
814825
* The driver uses the LDO5CTRL_H register to control the LDO5 regulator.
815826
* This is only valid if the SD_VSEL input of the PMIC is high. Let's

include/linux/regulator/pca9450.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,4 +226,11 @@ enum {
226226
#define WDOG_B_CFG_COLD_LDO12 0x80
227227
#define WDOG_B_CFG_COLD 0xC0
228228

229+
/* PCA9450_REG_CONFIG2 bits */
230+
#define I2C_LT_MASK 0x03
231+
#define I2C_LT_FORCE_DISABLE 0x00
232+
#define I2C_LT_ON_STANDBY_RUN 0x01
233+
#define I2C_LT_ON_RUN 0x02
234+
#define I2C_LT_FORCE_ENABLE 0x03
235+
229236
#endif /* __LINUX_REG_PCA9450_H__ */

0 commit comments

Comments
 (0)