Lines Matching +full:axp221 +full:- +full:adc
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
41 [AXP221_ID] = "AXP221",
940 .name = "axp192-adc",
941 .of_compatible = "x-powers,axp192-adc",
943 .name = "axp20x-battery-power-supply",
944 .of_compatible = "x-powers,axp192-battery-power-supply",
946 .name = "axp20x-ac-power-supply",
947 .of_compatible = "x-powers,axp202-ac-power-supply",
951 .name = "axp20x-usb-power-supply",
952 .of_compatible = "x-powers,axp192-usb-power-supply",
956 { .name = "axp20x-regulator" },
961 .name = "axp20x-gpio",
962 .of_compatible = "x-powers,axp209-gpio",
964 .name = "axp20x-pek",
968 .name = "axp20x-regulator",
970 .name = "axp20x-adc",
971 .of_compatible = "x-powers,axp209-adc",
973 .name = "axp20x-battery-power-supply",
974 .of_compatible = "x-powers,axp209-battery-power-supply",
976 .name = "axp20x-ac-power-supply",
977 .of_compatible = "x-powers,axp202-ac-power-supply",
981 .name = "axp20x-usb-power-supply",
982 .of_compatible = "x-powers,axp202-usb-power-supply",
990 .name = "axp20x-gpio",
991 .of_compatible = "x-powers,axp221-gpio",
993 .name = "axp221-pek",
997 .name = "axp20x-regulator",
999 .name = "axp22x-adc",
1000 .of_compatible = "x-powers,axp221-adc",
1002 .name = "axp20x-ac-power-supply",
1003 .of_compatible = "x-powers,axp221-ac-power-supply",
1007 .name = "axp20x-battery-power-supply",
1008 .of_compatible = "x-powers,axp221-battery-power-supply",
1010 .name = "axp20x-usb-power-supply",
1011 .of_compatible = "x-powers,axp221-usb-power-supply",
1019 .name = "axp20x-gpio",
1020 .of_compatible = "x-powers,axp221-gpio",
1022 .name = "axp221-pek",
1026 .name = "axp22x-adc",
1027 .of_compatible = "x-powers,axp221-adc",
1029 .name = "axp20x-battery-power-supply",
1030 .of_compatible = "x-powers,axp221-battery-power-supply",
1032 .name = "axp20x-regulator",
1034 .name = "axp20x-ac-power-supply",
1035 .of_compatible = "x-powers,axp221-ac-power-supply",
1039 .name = "axp20x-usb-power-supply",
1040 .of_compatible = "x-powers,axp223-usb-power-supply",
1048 .name = "axp20x-pek",
1055 MFD_CELL_NAME("axp20x-regulator"),
1056 MFD_CELL_RES("axp313a-pek", axp313a_pek_resources),
1060 MFD_CELL_NAME("axp20x-regulator"),
1061 MFD_CELL_RES("axp20x-pek", axp717_pek_resources),
1062 MFD_CELL_OF("axp717-adc",
1063 NULL, NULL, 0, 0, "x-powers,axp717-adc"),
1064 MFD_CELL_OF("axp20x-usb-power-supply",
1066 "x-powers,axp717-usb-power-supply"),
1067 MFD_CELL_OF("axp20x-battery-power-supply",
1068 NULL, NULL, 0, 0, "x-powers,axp717-battery-power-supply"),
1097 PROPERTY_ENTRY_STRING_ARRAY("supplied-from", axp288_fuel_gauge_suppliers),
1125 .name = "axp221-pek",
1135 .name = "axp221-pek",
1139 .name = "axp20x-gpio",
1140 .of_compatible = "x-powers,axp813-gpio",
1142 .name = "axp813-adc",
1143 .of_compatible = "x-powers,axp813-adc",
1145 .name = "axp20x-battery-power-supply",
1146 .of_compatible = "x-powers,axp813-battery-power-supply",
1148 .name = "axp20x-ac-power-supply",
1149 .of_compatible = "x-powers,axp813-ac-power-supply",
1153 .name = "axp20x-usb-power-supply",
1156 .of_compatible = "x-powers,axp813-usb-power-supply",
1158 { .name = "axp20x-regulator" },
1163 .name = "axp221-pek",
1167 { .name = "axp20x-regulator" },
1173 .name = "axp20x-regulator",
1179 .name = "axp20x-gpio",
1180 .of_compatible = "x-powers,axp221-gpio",
1182 .name = "axp221-pek",
1187 .name = "axp20x-regulator",
1193 .name = "axp221-pek",
1197 .name = "axp20x-regulator",
1199 .name = "axp20x-gpio",
1200 .of_compatible = "x-powers,axp813-gpio",
1202 .name = "axp813-adc",
1203 .of_compatible = "x-powers,axp813-adc",
1205 .name = "axp20x-battery-power-supply",
1206 .of_compatible = "x-powers,axp813-battery-power-supply",
1208 .name = "axp20x-ac-power-supply",
1209 .of_compatible = "x-powers,axp813-ac-power-supply",
1213 .name = "axp20x-usb-power-supply",
1216 .of_compatible = "x-powers,axp813-usb-power-supply",
1222 .name = "axp221-pek",
1226 .name = "axp20x-regulator",
1233 .name = "axp20x-regulator",
1239 struct axp20x_dev *axp20x = data->cb_data; in axp20x_power_off()
1242 switch (axp20x->variant) { in axp20x_power_off()
1252 regmap_write(axp20x->regmap, shutdown_reg, AXP20X_OFF); in axp20x_power_off()
1262 struct device *dev = axp20x->dev; in axp20x_match_device()
1266 axp20x->variant = (long)device_get_match_data(dev); in axp20x_match_device()
1267 switch (axp20x->variant) { in axp20x_match_device()
1269 axp20x->nr_cells = ARRAY_SIZE(axp152_cells); in axp20x_match_device()
1270 axp20x->cells = axp152_cells; in axp20x_match_device()
1271 axp20x->regmap_cfg = &axp152_regmap_config; in axp20x_match_device()
1272 axp20x->regmap_irq_chip = &axp152_regmap_irq_chip; in axp20x_match_device()
1275 axp20x->nr_cells = ARRAY_SIZE(axp192_cells); in axp20x_match_device()
1276 axp20x->cells = axp192_cells; in axp20x_match_device()
1277 axp20x->regmap_cfg = &axp192_regmap_config; in axp20x_match_device()
1278 axp20x->regmap_irq_chip = &axp192_regmap_irq_chip; in axp20x_match_device()
1282 axp20x->nr_cells = ARRAY_SIZE(axp20x_cells); in axp20x_match_device()
1283 axp20x->cells = axp20x_cells; in axp20x_match_device()
1284 axp20x->regmap_cfg = &axp20x_regmap_config; in axp20x_match_device()
1285 axp20x->regmap_irq_chip = &axp20x_regmap_irq_chip; in axp20x_match_device()
1288 axp20x->nr_cells = ARRAY_SIZE(axp221_cells); in axp20x_match_device()
1289 axp20x->cells = axp221_cells; in axp20x_match_device()
1290 axp20x->regmap_cfg = &axp22x_regmap_config; in axp20x_match_device()
1291 axp20x->regmap_irq_chip = &axp22x_regmap_irq_chip; in axp20x_match_device()
1294 axp20x->nr_cells = ARRAY_SIZE(axp223_cells); in axp20x_match_device()
1295 axp20x->cells = axp223_cells; in axp20x_match_device()
1296 axp20x->regmap_cfg = &axp22x_regmap_config; in axp20x_match_device()
1297 axp20x->regmap_irq_chip = &axp22x_regmap_irq_chip; in axp20x_match_device()
1300 axp20x->cells = axp288_cells; in axp20x_match_device()
1301 axp20x->nr_cells = ARRAY_SIZE(axp288_cells); in axp20x_match_device()
1302 axp20x->regmap_cfg = &axp288_regmap_config; in axp20x_match_device()
1303 axp20x->regmap_irq_chip = &axp288_regmap_irq_chip; in axp20x_match_device()
1304 axp20x->irq_flags = IRQF_TRIGGER_LOW; in axp20x_match_device()
1307 axp20x->nr_cells = ARRAY_SIZE(axp313a_cells); in axp20x_match_device()
1308 axp20x->cells = axp313a_cells; in axp20x_match_device()
1309 axp20x->regmap_cfg = &axp313a_regmap_config; in axp20x_match_device()
1310 axp20x->regmap_irq_chip = &axp313a_regmap_irq_chip; in axp20x_match_device()
1313 axp20x->nr_cells = ARRAY_SIZE(axp313a_cells); in axp20x_match_device()
1314 axp20x->cells = axp313a_cells; in axp20x_match_device()
1315 axp20x->regmap_cfg = &axp323_regmap_config; in axp20x_match_device()
1316 axp20x->regmap_irq_chip = &axp313a_regmap_irq_chip; in axp20x_match_device()
1319 axp20x->nr_cells = ARRAY_SIZE(axp717_cells); in axp20x_match_device()
1320 axp20x->cells = axp717_cells; in axp20x_match_device()
1321 axp20x->regmap_cfg = &axp717_regmap_config; in axp20x_match_device()
1322 axp20x->regmap_irq_chip = &axp717_regmap_irq_chip; in axp20x_match_device()
1325 axp20x->nr_cells = ARRAY_SIZE(axp803_cells); in axp20x_match_device()
1326 axp20x->cells = axp803_cells; in axp20x_match_device()
1327 axp20x->regmap_cfg = &axp288_regmap_config; in axp20x_match_device()
1328 axp20x->regmap_irq_chip = &axp803_regmap_irq_chip; in axp20x_match_device()
1335 if (of_property_read_bool(axp20x->dev->of_node, in axp20x_match_device()
1336 "x-powers,self-working-mode")) { in axp20x_match_device()
1337 axp20x->nr_cells = ARRAY_SIZE(axp806_self_working_cells); in axp20x_match_device()
1338 axp20x->cells = axp806_self_working_cells; in axp20x_match_device()
1340 axp20x->nr_cells = ARRAY_SIZE(axp806_cells); in axp20x_match_device()
1341 axp20x->cells = axp806_cells; in axp20x_match_device()
1345 axp20x->regmap_cfg = &axp806_regmap_config; in axp20x_match_device()
1346 axp20x->regmap_irq_chip = &axp806_regmap_irq_chip; in axp20x_match_device()
1349 axp20x->nr_cells = ARRAY_SIZE(axp809_cells); in axp20x_match_device()
1350 axp20x->cells = axp809_cells; in axp20x_match_device()
1351 axp20x->regmap_cfg = &axp22x_regmap_config; in axp20x_match_device()
1352 axp20x->regmap_irq_chip = &axp809_regmap_irq_chip; in axp20x_match_device()
1355 axp20x->nr_cells = ARRAY_SIZE(axp813_cells); in axp20x_match_device()
1356 axp20x->cells = axp813_cells; in axp20x_match_device()
1357 axp20x->regmap_cfg = &axp288_regmap_config; in axp20x_match_device()
1365 axp20x->regmap_irq_chip = &axp803_regmap_irq_chip; in axp20x_match_device()
1368 axp20x->nr_cells = ARRAY_SIZE(axp15060_cells); in axp20x_match_device()
1369 axp20x->cells = axp15060_cells; in axp20x_match_device()
1370 axp20x->regmap_cfg = &axp15060_regmap_config; in axp20x_match_device()
1371 axp20x->regmap_irq_chip = &axp15060_regmap_irq_chip; in axp20x_match_device()
1374 dev_err(dev, "unsupported AXP20X ID %u\n", axp20x->variant); in axp20x_match_device()
1375 return -EINVAL; in axp20x_match_device()
1381 * The default is the safe "regulator-only", as this works fine without in axp20x_match_device()
1384 if (axp20x->irq <= 0) { in axp20x_match_device()
1386 axp20x->nr_cells = nr_cells_no_irq; in axp20x_match_device()
1387 axp20x->cells = cells_no_irq; in axp20x_match_device()
1389 axp20x->nr_cells = ARRAY_SIZE(axp_regulator_only_cells); in axp20x_match_device()
1390 axp20x->cells = axp_regulator_only_cells; in axp20x_match_device()
1395 axp20x_model_names[axp20x->variant]); in axp20x_match_device()
1412 * AXP806_REG_ADDR_EXT, registers. The former is read-only, with in axp20x_device_probe()
1421 * property "x-powers,master-mode" to override the default. in axp20x_device_probe()
1423 if (axp20x->variant == AXP806_ID) { in axp20x_device_probe()
1424 if (of_property_read_bool(axp20x->dev->of_node, in axp20x_device_probe()
1425 "x-powers,master-mode") || in axp20x_device_probe()
1426 of_property_read_bool(axp20x->dev->of_node, in axp20x_device_probe()
1427 "x-powers,self-working-mode")) in axp20x_device_probe()
1428 regmap_write(axp20x->regmap, AXP806_REG_ADDR_EXT, in axp20x_device_probe()
1431 regmap_write(axp20x->regmap, AXP806_REG_ADDR_EXT, in axp20x_device_probe()
1436 if (axp20x->irq > 0) { in axp20x_device_probe()
1437 ret = regmap_add_irq_chip(axp20x->regmap, axp20x->irq, in axp20x_device_probe()
1438 IRQF_ONESHOT | IRQF_SHARED | axp20x->irq_flags, in axp20x_device_probe()
1439 -1, axp20x->regmap_irq_chip, in axp20x_device_probe()
1440 &axp20x->regmap_irqc); in axp20x_device_probe()
1442 dev_err(axp20x->dev, "failed to add irq chip: %d\n", in axp20x_device_probe()
1448 ret = mfd_add_devices(axp20x->dev, PLATFORM_DEVID_NONE, axp20x->cells, in axp20x_device_probe()
1449 axp20x->nr_cells, NULL, 0, NULL); in axp20x_device_probe()
1452 dev_err(axp20x->dev, "failed to add MFD devices: %d\n", ret); in axp20x_device_probe()
1453 regmap_del_irq_chip(axp20x->irq, axp20x->regmap_irqc); in axp20x_device_probe()
1457 if (axp20x->variant != AXP288_ID) in axp20x_device_probe()
1458 devm_register_power_off_handler(axp20x->dev, axp20x_power_off, axp20x); in axp20x_device_probe()
1460 dev_info(axp20x->dev, "AXP20X driver loaded\n"); in axp20x_device_probe()
1468 mfd_remove_devices(axp20x->dev); in axp20x_device_remove()
1469 regmap_del_irq_chip(axp20x->irq, axp20x->regmap_irqc); in axp20x_device_remove()