Lines Matching +full:axp209 +full:- +full:battery +full:- +full:power +full:- +full:supply

1 // SPDX-License-Identifier: GPL-2.0-only
3 * MFD core driver for the X-Powers' Power Management ICs
5 * AXP20x typically comprises an adaptive USB-Compatible PWM charger, BUCK DC-DC
6 * converters, LDOs, multiple 12-bit ADCs of voltage, current and temperature
40 [AXP209_ID] = "AXP209",
941 .name = "axp192-adc",
942 .of_compatible = "x-powers,axp192-adc",
944 .name = "axp20x-battery-power-supply",
945 .of_compatible = "x-powers,axp192-battery-power-supply",
947 .name = "axp20x-ac-power-supply",
948 .of_compatible = "x-powers,axp202-ac-power-supply",
952 .name = "axp20x-usb-power-supply",
953 .of_compatible = "x-powers,axp192-usb-power-supply",
957 { .name = "axp20x-regulator" },
962 .name = "axp20x-gpio",
963 .of_compatible = "x-powers,axp209-gpio",
965 .name = "axp20x-pek",
969 .name = "axp20x-regulator",
971 .name = "axp20x-adc",
972 .of_compatible = "x-powers,axp209-adc",
974 .name = "axp20x-battery-power-supply",
975 .of_compatible = "x-powers,axp209-battery-power-supply",
977 .name = "axp20x-ac-power-supply",
978 .of_compatible = "x-powers,axp202-ac-power-supply",
982 .name = "axp20x-usb-power-supply",
983 .of_compatible = "x-powers,axp202-usb-power-supply",
991 .name = "axp20x-gpio",
992 .of_compatible = "x-powers,axp221-gpio",
994 .name = "axp221-pek",
998 .name = "axp20x-regulator",
1000 .name = "axp22x-adc",
1001 .of_compatible = "x-powers,axp221-adc",
1003 .name = "axp20x-ac-power-supply",
1004 .of_compatible = "x-powers,axp221-ac-power-supply",
1008 .name = "axp20x-battery-power-supply",
1009 .of_compatible = "x-powers,axp221-battery-power-supply",
1011 .name = "axp20x-usb-power-supply",
1012 .of_compatible = "x-powers,axp221-usb-power-supply",
1020 .name = "axp20x-gpio",
1021 .of_compatible = "x-powers,axp221-gpio",
1023 .name = "axp221-pek",
1027 .name = "axp22x-adc",
1028 .of_compatible = "x-powers,axp221-adc",
1030 .name = "axp20x-battery-power-supply",
1031 .of_compatible = "x-powers,axp221-battery-power-supply",
1033 .name = "axp20x-regulator",
1035 .name = "axp20x-ac-power-supply",
1036 .of_compatible = "x-powers,axp221-ac-power-supply",
1040 .name = "axp20x-usb-power-supply",
1041 .of_compatible = "x-powers,axp223-usb-power-supply",
1049 .name = "axp20x-pek",
1056 MFD_CELL_NAME("axp20x-regulator"),
1057 MFD_CELL_RES("axp313a-pek", axp313a_pek_resources),
1061 MFD_CELL_NAME("axp20x-regulator"),
1062 MFD_CELL_RES("axp20x-pek", axp717_pek_resources),
1063 MFD_CELL_OF("axp717-adc",
1064 NULL, NULL, 0, 0, "x-powers,axp717-adc"),
1065 MFD_CELL_OF("axp20x-usb-power-supply",
1067 "x-powers,axp717-usb-power-supply"),
1068 MFD_CELL_OF("axp20x-battery-power-supply",
1069 NULL, NULL, 0, 0, "x-powers,axp717-battery-power-supply"),
1098 PROPERTY_ENTRY_STRING_ARRAY("supplied-from", axp288_fuel_gauge_suppliers),
1126 .name = "axp221-pek",
1136 .name = "axp221-pek",
1140 .name = "axp20x-gpio",
1141 .of_compatible = "x-powers,axp813-gpio",
1143 .name = "axp813-adc",
1144 .of_compatible = "x-powers,axp813-adc",
1146 .name = "axp20x-battery-power-supply",
1147 .of_compatible = "x-powers,axp813-battery-power-supply",
1149 .name = "axp20x-ac-power-supply",
1150 .of_compatible = "x-powers,axp813-ac-power-supply",
1154 .name = "axp20x-usb-power-supply",
1157 .of_compatible = "x-powers,axp813-usb-power-supply",
1159 { .name = "axp20x-regulator" },
1164 .name = "axp221-pek",
1168 { .name = "axp20x-regulator" },
1174 .name = "axp20x-regulator",
1180 .name = "axp20x-gpio",
1181 .of_compatible = "x-powers,axp221-gpio",
1183 .name = "axp221-pek",
1188 .name = "axp20x-regulator",
1194 .name = "axp221-pek",
1198 .name = "axp20x-regulator",
1200 .name = "axp20x-gpio",
1201 .of_compatible = "x-powers,axp813-gpio",
1203 .name = "axp813-adc",
1204 .of_compatible = "x-powers,axp813-adc",
1206 .name = "axp20x-battery-power-supply",
1207 .of_compatible = "x-powers,axp813-battery-power-supply",
1209 .name = "axp20x-ac-power-supply",
1210 .of_compatible = "x-powers,axp813-ac-power-supply",
1214 .name = "axp20x-usb-power-supply",
1217 .of_compatible = "x-powers,axp813-usb-power-supply",
1223 .name = "axp221-pek",
1227 .name = "axp20x-regulator",
1234 .name = "axp20x-regulator",
1240 struct axp20x_dev *axp20x = data->cb_data;
1243 switch (axp20x->variant) {
1253 regmap_write(axp20x->regmap, shutdown_reg, AXP20X_OFF);
1263 struct device *dev = axp20x->dev;
1267 axp20x->variant = (long)device_get_match_data(dev);
1268 switch (axp20x->variant) {
1270 axp20x->nr_cells = ARRAY_SIZE(axp152_cells);
1271 axp20x->cells = axp152_cells;
1272 axp20x->regmap_cfg = &axp152_regmap_config;
1273 axp20x->regmap_irq_chip = &axp152_regmap_irq_chip;
1276 axp20x->nr_cells = ARRAY_SIZE(axp192_cells);
1277 axp20x->cells = axp192_cells;
1278 axp20x->regmap_cfg = &axp192_regmap_config;
1279 axp20x->regmap_irq_chip = &axp192_regmap_irq_chip;
1283 axp20x->nr_cells = ARRAY_SIZE(axp20x_cells);
1284 axp20x->cells = axp20x_cells;
1285 axp20x->regmap_cfg = &axp20x_regmap_config;
1286 axp20x->regmap_irq_chip = &axp20x_regmap_irq_chip;
1289 axp20x->nr_cells = ARRAY_SIZE(axp221_cells);
1290 axp20x->cells = axp221_cells;
1291 axp20x->regmap_cfg = &axp22x_regmap_config;
1292 axp20x->regmap_irq_chip = &axp22x_regmap_irq_chip;
1295 axp20x->nr_cells = ARRAY_SIZE(axp223_cells);
1296 axp20x->cells = axp223_cells;
1297 axp20x->regmap_cfg = &axp22x_regmap_config;
1298 axp20x->regmap_irq_chip = &axp22x_regmap_irq_chip;
1301 axp20x->cells = axp288_cells;
1302 axp20x->nr_cells = ARRAY_SIZE(axp288_cells);
1303 axp20x->regmap_cfg = &axp288_regmap_config;
1304 axp20x->regmap_irq_chip = &axp288_regmap_irq_chip;
1305 axp20x->irq_flags = IRQF_TRIGGER_LOW;
1308 axp20x->nr_cells = ARRAY_SIZE(axp313a_cells);
1309 axp20x->cells = axp313a_cells;
1310 axp20x->regmap_cfg = &axp313a_regmap_config;
1311 axp20x->regmap_irq_chip = &axp313a_regmap_irq_chip;
1314 axp20x->nr_cells = ARRAY_SIZE(axp313a_cells);
1315 axp20x->cells = axp313a_cells;
1316 axp20x->regmap_cfg = &axp323_regmap_config;
1317 axp20x->regmap_irq_chip = &axp313a_regmap_irq_chip;
1320 axp20x->nr_cells = ARRAY_SIZE(axp717_cells);
1321 axp20x->cells = axp717_cells;
1322 axp20x->regmap_cfg = &axp717_regmap_config;
1323 axp20x->regmap_irq_chip = &axp717_regmap_irq_chip;
1326 axp20x->nr_cells = ARRAY_SIZE(axp803_cells);
1327 axp20x->cells = axp803_cells;
1328 axp20x->regmap_cfg = &axp288_regmap_config;
1329 axp20x->regmap_irq_chip = &axp803_regmap_irq_chip;
1333 * Don't register the power key part if in slave mode or
1336 if (of_property_read_bool(axp20x->dev->of_node,
1337 "x-powers,self-working-mode")) {
1338 axp20x->nr_cells = ARRAY_SIZE(axp806_self_working_cells);
1339 axp20x->cells = axp806_self_working_cells;
1341 axp20x->nr_cells = ARRAY_SIZE(axp806_cells);
1342 axp20x->cells = axp806_cells;
1346 axp20x->regmap_cfg = &axp806_regmap_config;
1347 axp20x->regmap_irq_chip = &axp806_regmap_irq_chip;
1350 axp20x->nr_cells = ARRAY_SIZE(axp809_cells);
1351 axp20x->cells = axp809_cells;
1352 axp20x->regmap_cfg = &axp22x_regmap_config;
1353 axp20x->regmap_irq_chip = &axp809_regmap_irq_chip;
1356 axp20x->nr_cells = ARRAY_SIZE(axp813_cells);
1357 axp20x->cells = axp813_cells;
1358 axp20x->regmap_cfg = &axp288_regmap_config;
1366 axp20x->regmap_irq_chip = &axp803_regmap_irq_chip;
1369 axp20x->nr_cells = ARRAY_SIZE(axp15060_cells);
1370 axp20x->cells = axp15060_cells;
1371 axp20x->regmap_cfg = &axp15060_regmap_config;
1372 axp20x->regmap_irq_chip = &axp15060_regmap_irq_chip;
1375 dev_err(dev, "unsupported AXP20X ID %u\n", axp20x->variant);
1376 return -EINVAL;
1382 * The default is the safe "regulator-only", as this works fine without
1385 if (axp20x->irq <= 0) {
1387 axp20x->nr_cells = nr_cells_no_irq;
1388 axp20x->cells = cells_no_irq;
1390 axp20x->nr_cells = ARRAY_SIZE(axp_regulator_only_cells);
1391 axp20x->cells = axp_regulator_only_cells;
1396 axp20x_model_names[axp20x->variant]);
1413 * AXP806_REG_ADDR_EXT, registers. The former is read-only, with
1422 * property "x-powers,master-mode" to override the default.
1424 if (axp20x->variant == AXP806_ID) {
1425 if (of_property_read_bool(axp20x->dev->of_node,
1426 "x-powers,master-mode") ||
1427 of_property_read_bool(axp20x->dev->of_node,
1428 "x-powers,self-working-mode"))
1429 regmap_write(axp20x->regmap, AXP806_REG_ADDR_EXT,
1432 regmap_write(axp20x->regmap, AXP806_REG_ADDR_EXT,
1437 if (axp20x->irq > 0) {
1438 ret = regmap_add_irq_chip(axp20x->regmap, axp20x->irq,
1439 IRQF_ONESHOT | IRQF_SHARED | axp20x->irq_flags,
1440 -1, axp20x->regmap_irq_chip,
1441 &axp20x->regmap_irqc);
1443 dev_err(axp20x->dev, "failed to add irq chip: %d\n",
1449 ret = mfd_add_devices(axp20x->dev, PLATFORM_DEVID_NONE, axp20x->cells,
1450 axp20x->nr_cells, NULL, 0, NULL);
1453 dev_err(axp20x->dev, "failed to add MFD devices: %d\n", ret);
1454 regmap_del_irq_chip(axp20x->irq, axp20x->regmap_irqc);
1458 if (axp20x->variant != AXP288_ID)
1459 devm_register_power_off_handler(axp20x->dev, axp20x_power_off, axp20x);
1461 dev_info(axp20x->dev, "AXP20X driver loaded\n");
1469 mfd_remove_devices(axp20x->dev);
1470 regmap_del_irq_chip(axp20x->irq, axp20x->regmap_irqc);