Skip to content

Commit 017b76f

Browse files
1991Joyzoubroonie
authored andcommitted
regulator: pca9450: Add PMIC pca9452 support
Add the PMIC pca9452 support, which add ldo3 compared with pca9451a. Signed-off-by: Joy Zou <joy.zou@nxp.com> Signed-off-by: Frank Li <Frank.Li@nxp.com> Link: https://patch.msgid.link/20241205-pca9450-v1-4-aab448b74e78@nxp.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 17b531c commit 017b76f

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

drivers/regulator/pca9450-regulator.c

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -815,6 +815,24 @@ static const struct pca9450_regulator_desc pca9451a_regulators[] = {
815815
.owner = THIS_MODULE,
816816
},
817817
},
818+
{
819+
.desc = {
820+
.name = "ldo3",
821+
.of_match = of_match_ptr("LDO3"),
822+
.regulators_node = of_match_ptr("regulators"),
823+
.id = PCA9450_LDO3,
824+
.ops = &pca9450_ldo_regulator_ops,
825+
.type = REGULATOR_VOLTAGE,
826+
.n_voltages = PCA9450_LDO3_VOLTAGE_NUM,
827+
.linear_ranges = pca9450_ldo34_volts,
828+
.n_linear_ranges = ARRAY_SIZE(pca9450_ldo34_volts),
829+
.vsel_reg = PCA9450_REG_LDO3CTRL,
830+
.vsel_mask = LDO3OUT_MASK,
831+
.enable_reg = PCA9450_REG_LDO3CTRL,
832+
.enable_mask = LDO3_EN_MASK,
833+
.owner = THIS_MODULE,
834+
},
835+
},
818836
{
819837
.desc = {
820838
.name = "ldo4",
@@ -916,6 +934,7 @@ static int pca9450_i2c_probe(struct i2c_client *i2c)
916934
pca9450->rcnt = ARRAY_SIZE(pca9450bc_regulators);
917935
break;
918936
case PCA9450_TYPE_PCA9451A:
937+
case PCA9450_TYPE_PCA9452:
919938
regulator_desc = pca9451a_regulators;
920939
pca9450->rcnt = ARRAY_SIZE(pca9451a_regulators);
921940
break;
@@ -943,7 +962,8 @@ static int pca9450_i2c_probe(struct i2c_client *i2c)
943962
/* Check your board and dts for match the right pmic */
944963
if (((device_id >> 4) != 0x1 && type == PCA9450_TYPE_PCA9450A) ||
945964
((device_id >> 4) != 0x3 && type == PCA9450_TYPE_PCA9450BC) ||
946-
((device_id >> 4) != 0x9 && type == PCA9450_TYPE_PCA9451A))
965+
((device_id >> 4) != 0x9 && type == PCA9450_TYPE_PCA9451A) ||
966+
((device_id >> 4) != 0x9 && type == PCA9450_TYPE_PCA9452))
947967
return dev_err_probe(&i2c->dev, -EINVAL,
948968
"Device id(%x) mismatched\n", device_id >> 4);
949969

@@ -955,6 +975,9 @@ static int pca9450_i2c_probe(struct i2c_client *i2c)
955975
r = &regulator_desc[i];
956976
desc = &r->desc;
957977

978+
if (type == PCA9450_TYPE_PCA9451A && !strcmp(desc->name, "ldo3"))
979+
continue;
980+
958981
config.regmap = pca9450->regmap;
959982
config.dev = pca9450->dev;
960983

@@ -1043,6 +1066,10 @@ static const struct of_device_id pca9450_of_match[] = {
10431066
.compatible = "nxp,pca9451a",
10441067
.data = (void *)PCA9450_TYPE_PCA9451A,
10451068
},
1069+
{
1070+
.compatible = "nxp,pca9452",
1071+
.data = (void *)PCA9450_TYPE_PCA9452,
1072+
},
10461073
{ }
10471074
};
10481075
MODULE_DEVICE_TABLE(of, pca9450_of_match);

include/linux/regulator/pca9450.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ enum pca9450_chip_type {
1010
PCA9450_TYPE_PCA9450A = 0,
1111
PCA9450_TYPE_PCA9450BC,
1212
PCA9450_TYPE_PCA9451A,
13+
PCA9450_TYPE_PCA9452,
1314
PCA9450_TYPE_AMOUNT,
1415
};
1516

0 commit comments

Comments
 (0)