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",
921 .name = "axp192-adc",
922 .of_compatible = "x-powers,axp192-adc",
924 .name = "axp20x-battery-power-supply",
925 .of_compatible = "x-powers,axp192-battery-power-supply",
927 .name = "axp20x-ac-power-supply",
928 .of_compatible = "x-powers,axp202-ac-power-supply",
932 .name = "axp20x-usb-power-supply",
933 .of_compatible = "x-powers,axp192-usb-power-supply",
937 { .name = "axp20x-regulator" },
942 .name = "axp20x-gpio",
943 .of_compatible = "x-powers,axp209-gpio",
945 .name = "axp20x-pek",
949 .name = "axp20x-regulator",
951 .name = "axp20x-adc",
952 .of_compatible = "x-powers,axp209-adc",
954 .name = "axp20x-battery-power-supply",
955 .of_compatible = "x-powers,axp209-battery-power-supply",
957 .name = "axp20x-ac-power-supply",
958 .of_compatible = "x-powers,axp202-ac-power-supply",
962 .name = "axp20x-usb-power-supply",
963 .of_compatible = "x-powers,axp202-usb-power-supply",
971 .name = "axp20x-gpio",
972 .of_compatible = "x-powers,axp221-gpio",
974 .name = "axp221-pek",
978 .name = "axp20x-regulator",
980 .name = "axp22x-adc",
981 .of_compatible = "x-powers,axp221-adc",
983 .name = "axp20x-ac-power-supply",
984 .of_compatible = "x-powers,axp221-ac-power-supply",
988 .name = "axp20x-battery-power-supply",
989 .of_compatible = "x-powers,axp221-battery-power-supply",
991 .name = "axp20x-usb-power-supply",
992 .of_compatible = "x-powers,axp221-usb-power-supply",
1000 .name = "axp20x-gpio",
1001 .of_compatible = "x-powers,axp221-gpio",
1003 .name = "axp221-pek",
1007 .name = "axp22x-adc",
1008 .of_compatible = "x-powers,axp221-adc",
1010 .name = "axp20x-battery-power-supply",
1011 .of_compatible = "x-powers,axp221-battery-power-supply",
1013 .name = "axp20x-regulator",
1015 .name = "axp20x-ac-power-supply",
1016 .of_compatible = "x-powers,axp221-ac-power-supply",
1020 .name = "axp20x-usb-power-supply",
1021 .of_compatible = "x-powers,axp223-usb-power-supply",
1029 .name = "axp20x-pek",
1036 MFD_CELL_NAME("axp20x-regulator"),
1037 MFD_CELL_RES("axp313a-pek", axp313a_pek_resources),
1041 MFD_CELL_NAME("axp20x-regulator"),
1042 MFD_CELL_RES("axp20x-pek", axp717_pek_resources),
1043 MFD_CELL_OF("axp717-adc",
1044 NULL, NULL, 0, 0, "x-powers,axp717-adc"),
1045 MFD_CELL_OF("axp20x-usb-power-supply",
1047 "x-powers,axp717-usb-power-supply"),
1048 MFD_CELL_OF("axp20x-battery-power-supply",
1049 NULL, NULL, 0, 0, "x-powers,axp717-battery-power-supply"),
1078 PROPERTY_ENTRY_STRING_ARRAY("supplied-from", axp288_fuel_gauge_suppliers),
1106 .name = "axp221-pek",
1116 .name = "axp221-pek",
1120 .name = "axp20x-gpio",
1121 .of_compatible = "x-powers,axp813-gpio",
1123 .name = "axp813-adc",
1124 .of_compatible = "x-powers,axp813-adc",
1126 .name = "axp20x-battery-power-supply",
1127 .of_compatible = "x-powers,axp813-battery-power-supply",
1129 .name = "axp20x-ac-power-supply",
1130 .of_compatible = "x-powers,axp813-ac-power-supply",
1134 .name = "axp20x-usb-power-supply",
1137 .of_compatible = "x-powers,axp813-usb-power-supply",
1139 { .name = "axp20x-regulator" },
1144 .name = "axp221-pek",
1148 { .name = "axp20x-regulator" },
1154 .name = "axp20x-regulator",
1160 .name = "axp20x-gpio",
1161 .of_compatible = "x-powers,axp221-gpio",
1163 .name = "axp221-pek",
1168 .name = "axp20x-regulator",
1174 .name = "axp221-pek",
1178 .name = "axp20x-regulator",
1180 .name = "axp20x-gpio",
1181 .of_compatible = "x-powers,axp813-gpio",
1183 .name = "axp813-adc",
1184 .of_compatible = "x-powers,axp813-adc",
1186 .name = "axp20x-battery-power-supply",
1187 .of_compatible = "x-powers,axp813-battery-power-supply",
1189 .name = "axp20x-ac-power-supply",
1190 .of_compatible = "x-powers,axp813-ac-power-supply",
1194 .name = "axp20x-usb-power-supply",
1197 .of_compatible = "x-powers,axp813-usb-power-supply",
1203 .name = "axp221-pek",
1207 .name = "axp20x-regulator",
1214 .name = "axp20x-regulator",
1220 struct axp20x_dev *axp20x = data->cb_data; in axp20x_power_off()
1223 switch (axp20x->variant) { in axp20x_power_off()
1232 regmap_write(axp20x->regmap, shutdown_reg, AXP20X_OFF); in axp20x_power_off()
1242 struct device *dev = axp20x->dev; in axp20x_match_device()
1246 axp20x->variant = (long)device_get_match_data(dev); in axp20x_match_device()
1247 switch (axp20x->variant) { in axp20x_match_device()
1249 axp20x->nr_cells = ARRAY_SIZE(axp152_cells); in axp20x_match_device()
1250 axp20x->cells = axp152_cells; in axp20x_match_device()
1251 axp20x->regmap_cfg = &axp152_regmap_config; in axp20x_match_device()
1252 axp20x->regmap_irq_chip = &axp152_regmap_irq_chip; in axp20x_match_device()
1255 axp20x->nr_cells = ARRAY_SIZE(axp192_cells); in axp20x_match_device()
1256 axp20x->cells = axp192_cells; in axp20x_match_device()
1257 axp20x->regmap_cfg = &axp192_regmap_config; in axp20x_match_device()
1258 axp20x->regmap_irq_chip = &axp192_regmap_irq_chip; in axp20x_match_device()
1262 axp20x->nr_cells = ARRAY_SIZE(axp20x_cells); in axp20x_match_device()
1263 axp20x->cells = axp20x_cells; in axp20x_match_device()
1264 axp20x->regmap_cfg = &axp20x_regmap_config; in axp20x_match_device()
1265 axp20x->regmap_irq_chip = &axp20x_regmap_irq_chip; in axp20x_match_device()
1268 axp20x->nr_cells = ARRAY_SIZE(axp221_cells); in axp20x_match_device()
1269 axp20x->cells = axp221_cells; in axp20x_match_device()
1270 axp20x->regmap_cfg = &axp22x_regmap_config; in axp20x_match_device()
1271 axp20x->regmap_irq_chip = &axp22x_regmap_irq_chip; in axp20x_match_device()
1274 axp20x->nr_cells = ARRAY_SIZE(axp223_cells); in axp20x_match_device()
1275 axp20x->cells = axp223_cells; in axp20x_match_device()
1276 axp20x->regmap_cfg = &axp22x_regmap_config; in axp20x_match_device()
1277 axp20x->regmap_irq_chip = &axp22x_regmap_irq_chip; in axp20x_match_device()
1280 axp20x->cells = axp288_cells; in axp20x_match_device()
1281 axp20x->nr_cells = ARRAY_SIZE(axp288_cells); in axp20x_match_device()
1282 axp20x->regmap_cfg = &axp288_regmap_config; in axp20x_match_device()
1283 axp20x->regmap_irq_chip = &axp288_regmap_irq_chip; in axp20x_match_device()
1284 axp20x->irq_flags = IRQF_TRIGGER_LOW; in axp20x_match_device()
1287 axp20x->nr_cells = ARRAY_SIZE(axp313a_cells); in axp20x_match_device()
1288 axp20x->cells = axp313a_cells; in axp20x_match_device()
1289 axp20x->regmap_cfg = &axp313a_regmap_config; in axp20x_match_device()
1290 axp20x->regmap_irq_chip = &axp313a_regmap_irq_chip; in axp20x_match_device()
1293 axp20x->nr_cells = ARRAY_SIZE(axp717_cells); in axp20x_match_device()
1294 axp20x->cells = axp717_cells; in axp20x_match_device()
1295 axp20x->regmap_cfg = &axp717_regmap_config; in axp20x_match_device()
1296 axp20x->regmap_irq_chip = &axp717_regmap_irq_chip; in axp20x_match_device()
1299 axp20x->nr_cells = ARRAY_SIZE(axp803_cells); in axp20x_match_device()
1300 axp20x->cells = axp803_cells; in axp20x_match_device()
1301 axp20x->regmap_cfg = &axp288_regmap_config; in axp20x_match_device()
1302 axp20x->regmap_irq_chip = &axp803_regmap_irq_chip; in axp20x_match_device()
1309 if (of_property_read_bool(axp20x->dev->of_node, in axp20x_match_device()
1310 "x-powers,self-working-mode")) { in axp20x_match_device()
1311 axp20x->nr_cells = ARRAY_SIZE(axp806_self_working_cells); in axp20x_match_device()
1312 axp20x->cells = axp806_self_working_cells; in axp20x_match_device()
1314 axp20x->nr_cells = ARRAY_SIZE(axp806_cells); in axp20x_match_device()
1315 axp20x->cells = axp806_cells; in axp20x_match_device()
1319 axp20x->regmap_cfg = &axp806_regmap_config; in axp20x_match_device()
1320 axp20x->regmap_irq_chip = &axp806_regmap_irq_chip; in axp20x_match_device()
1323 axp20x->nr_cells = ARRAY_SIZE(axp809_cells); in axp20x_match_device()
1324 axp20x->cells = axp809_cells; in axp20x_match_device()
1325 axp20x->regmap_cfg = &axp22x_regmap_config; in axp20x_match_device()
1326 axp20x->regmap_irq_chip = &axp809_regmap_irq_chip; in axp20x_match_device()
1329 axp20x->nr_cells = ARRAY_SIZE(axp813_cells); in axp20x_match_device()
1330 axp20x->cells = axp813_cells; in axp20x_match_device()
1331 axp20x->regmap_cfg = &axp288_regmap_config; in axp20x_match_device()
1339 axp20x->regmap_irq_chip = &axp803_regmap_irq_chip; in axp20x_match_device()
1342 axp20x->nr_cells = ARRAY_SIZE(axp15060_cells); in axp20x_match_device()
1343 axp20x->cells = axp15060_cells; in axp20x_match_device()
1344 axp20x->regmap_cfg = &axp15060_regmap_config; in axp20x_match_device()
1345 axp20x->regmap_irq_chip = &axp15060_regmap_irq_chip; in axp20x_match_device()
1348 dev_err(dev, "unsupported AXP20X ID %lu\n", axp20x->variant); in axp20x_match_device()
1349 return -EINVAL; in axp20x_match_device()
1355 * The default is the safe "regulator-only", as this works fine without in axp20x_match_device()
1358 if (axp20x->irq <= 0) { in axp20x_match_device()
1360 axp20x->nr_cells = nr_cells_no_irq; in axp20x_match_device()
1361 axp20x->cells = cells_no_irq; in axp20x_match_device()
1363 axp20x->nr_cells = ARRAY_SIZE(axp_regulator_only_cells); in axp20x_match_device()
1364 axp20x->cells = axp_regulator_only_cells; in axp20x_match_device()
1369 axp20x_model_names[axp20x->variant]); in axp20x_match_device()
1386 * AXP806_REG_ADDR_EXT, registers. The former is read-only, with in axp20x_device_probe()
1395 * property "x-powers,master-mode" to override the default. in axp20x_device_probe()
1397 if (axp20x->variant == AXP806_ID) { in axp20x_device_probe()
1398 if (of_property_read_bool(axp20x->dev->of_node, in axp20x_device_probe()
1399 "x-powers,master-mode") || in axp20x_device_probe()
1400 of_property_read_bool(axp20x->dev->of_node, in axp20x_device_probe()
1401 "x-powers,self-working-mode")) in axp20x_device_probe()
1402 regmap_write(axp20x->regmap, AXP806_REG_ADDR_EXT, in axp20x_device_probe()
1405 regmap_write(axp20x->regmap, AXP806_REG_ADDR_EXT, in axp20x_device_probe()
1410 if (axp20x->irq > 0) { in axp20x_device_probe()
1411 ret = regmap_add_irq_chip(axp20x->regmap, axp20x->irq, in axp20x_device_probe()
1412 IRQF_ONESHOT | IRQF_SHARED | axp20x->irq_flags, in axp20x_device_probe()
1413 -1, axp20x->regmap_irq_chip, in axp20x_device_probe()
1414 &axp20x->regmap_irqc); in axp20x_device_probe()
1416 dev_err(axp20x->dev, "failed to add irq chip: %d\n", in axp20x_device_probe()
1422 ret = mfd_add_devices(axp20x->dev, -1, axp20x->cells, in axp20x_device_probe()
1423 axp20x->nr_cells, NULL, 0, NULL); in axp20x_device_probe()
1426 dev_err(axp20x->dev, "failed to add MFD devices: %d\n", ret); in axp20x_device_probe()
1427 regmap_del_irq_chip(axp20x->irq, axp20x->regmap_irqc); in axp20x_device_probe()
1431 if (axp20x->variant != AXP288_ID) in axp20x_device_probe()
1432 devm_register_sys_off_handler(axp20x->dev, in axp20x_device_probe()
1437 dev_info(axp20x->dev, "AXP20X driver loaded\n"); in axp20x_device_probe()
1445 mfd_remove_devices(axp20x->dev); in axp20x_device_remove()
1446 regmap_del_irq_chip(axp20x->irq, axp20x->regmap_irqc); in axp20x_device_remove()