Lines Matching full:axp20x
5 * AXP20x typically comprises an adaptive USB-Compatible PWM charger, BUCK DC-DC
22 #include <linux/mfd/axp20x.h>
523 INIT_REGMAP_IRQ(AXP20X, ACIN_OVER_V, 0, 7),
524 INIT_REGMAP_IRQ(AXP20X, ACIN_PLUGIN, 0, 6),
525 INIT_REGMAP_IRQ(AXP20X, ACIN_REMOVAL, 0, 5),
526 INIT_REGMAP_IRQ(AXP20X, VBUS_OVER_V, 0, 4),
527 INIT_REGMAP_IRQ(AXP20X, VBUS_PLUGIN, 0, 3),
528 INIT_REGMAP_IRQ(AXP20X, VBUS_REMOVAL, 0, 2),
529 INIT_REGMAP_IRQ(AXP20X, VBUS_V_LOW, 0, 1),
530 INIT_REGMAP_IRQ(AXP20X, BATT_PLUGIN, 1, 7),
531 INIT_REGMAP_IRQ(AXP20X, BATT_REMOVAL, 1, 6),
532 INIT_REGMAP_IRQ(AXP20X, BATT_ENT_ACT_MODE, 1, 5),
533 INIT_REGMAP_IRQ(AXP20X, BATT_EXIT_ACT_MODE, 1, 4),
534 INIT_REGMAP_IRQ(AXP20X, CHARG, 1, 3),
535 INIT_REGMAP_IRQ(AXP20X, CHARG_DONE, 1, 2),
536 INIT_REGMAP_IRQ(AXP20X, BATT_TEMP_HIGH, 1, 1),
537 INIT_REGMAP_IRQ(AXP20X, BATT_TEMP_LOW, 1, 0),
538 INIT_REGMAP_IRQ(AXP20X, DIE_TEMP_HIGH, 2, 7),
539 INIT_REGMAP_IRQ(AXP20X, CHARG_I_LOW, 2, 6),
540 INIT_REGMAP_IRQ(AXP20X, DCDC1_V_LONG, 2, 5),
541 INIT_REGMAP_IRQ(AXP20X, DCDC2_V_LONG, 2, 4),
542 INIT_REGMAP_IRQ(AXP20X, DCDC3_V_LONG, 2, 3),
543 INIT_REGMAP_IRQ(AXP20X, PEK_SHORT, 2, 1),
544 INIT_REGMAP_IRQ(AXP20X, PEK_LONG, 2, 0),
545 INIT_REGMAP_IRQ(AXP20X, N_OE_PWR_ON, 3, 7),
546 INIT_REGMAP_IRQ(AXP20X, N_OE_PWR_OFF, 3, 6),
547 INIT_REGMAP_IRQ(AXP20X, VBUS_VALID, 3, 5),
548 INIT_REGMAP_IRQ(AXP20X, VBUS_NOT_VALID, 3, 4),
549 INIT_REGMAP_IRQ(AXP20X, VBUS_SESS_VALID, 3, 3),
550 INIT_REGMAP_IRQ(AXP20X, VBUS_SESS_END, 3, 2),
551 INIT_REGMAP_IRQ(AXP20X, LOW_PWR_LVL1, 3, 1),
552 INIT_REGMAP_IRQ(AXP20X, LOW_PWR_LVL2, 3, 0),
553 INIT_REGMAP_IRQ(AXP20X, TIMER, 4, 7),
554 INIT_REGMAP_IRQ(AXP20X, PEK_RIS_EDGE, 4, 6),
555 INIT_REGMAP_IRQ(AXP20X, PEK_FAL_EDGE, 4, 5),
556 INIT_REGMAP_IRQ(AXP20X, GPIO3_INPUT, 4, 3),
557 INIT_REGMAP_IRQ(AXP20X, GPIO2_INPUT, 4, 2),
558 INIT_REGMAP_IRQ(AXP20X, GPIO1_INPUT, 4, 1),
559 INIT_REGMAP_IRQ(AXP20X, GPIO0_INPUT, 4, 0),
590 /* some IRQs are compatible with axp20x models */
924 .name = "axp20x-battery-power-supply",
927 .name = "axp20x-ac-power-supply",
932 .name = "axp20x-usb-power-supply",
937 { .name = "axp20x-regulator" },
942 .name = "axp20x-gpio",
945 .name = "axp20x-pek",
949 .name = "axp20x-regulator",
951 .name = "axp20x-adc",
954 .name = "axp20x-battery-power-supply",
957 .name = "axp20x-ac-power-supply",
962 .name = "axp20x-usb-power-supply",
971 .name = "axp20x-gpio",
978 .name = "axp20x-regulator",
983 .name = "axp20x-ac-power-supply",
988 .name = "axp20x-battery-power-supply",
991 .name = "axp20x-usb-power-supply",
1000 .name = "axp20x-gpio",
1010 .name = "axp20x-battery-power-supply",
1013 .name = "axp20x-regulator",
1015 .name = "axp20x-ac-power-supply",
1020 .name = "axp20x-usb-power-supply",
1029 .name = "axp20x-pek",
1036 MFD_CELL_NAME("axp20x-regulator"),
1041 MFD_CELL_NAME("axp20x-regulator"),
1042 MFD_CELL_RES("axp20x-pek", axp717_pek_resources),
1045 MFD_CELL_OF("axp20x-usb-power-supply",
1048 MFD_CELL_OF("axp20x-battery-power-supply",
1120 .name = "axp20x-gpio",
1126 .name = "axp20x-battery-power-supply",
1129 .name = "axp20x-ac-power-supply",
1134 .name = "axp20x-usb-power-supply",
1139 { .name = "axp20x-regulator" },
1148 { .name = "axp20x-regulator" },
1154 .name = "axp20x-regulator",
1160 .name = "axp20x-gpio",
1168 .name = "axp20x-regulator",
1178 .name = "axp20x-regulator",
1180 .name = "axp20x-gpio",
1186 .name = "axp20x-battery-power-supply",
1189 .name = "axp20x-ac-power-supply",
1194 .name = "axp20x-usb-power-supply",
1207 .name = "axp20x-regulator",
1214 .name = "axp20x-regulator",
1220 struct axp20x_dev *axp20x = data->cb_data; in axp20x_power_off() local
1223 switch (axp20x->variant) { in axp20x_power_off()
1232 regmap_write(axp20x->regmap, shutdown_reg, AXP20X_OFF); in axp20x_power_off()
1240 int axp20x_match_device(struct axp20x_dev *axp20x) in axp20x_match_device() argument
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()
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()
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()
1368 dev_info(dev, "AXP20x variant %s found\n", in axp20x_match_device()
1369 axp20x_model_names[axp20x->variant]); in axp20x_match_device()
1375 int axp20x_device_probe(struct axp20x_dev *axp20x) in axp20x_device_probe() argument
1397 if (axp20x->variant == AXP806_ID) { in axp20x_device_probe()
1398 if (of_property_read_bool(axp20x->dev->of_node, in axp20x_device_probe()
1400 of_property_read_bool(axp20x->dev->of_node, 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()
1435 axp20x_power_off, axp20x); in axp20x_device_probe()
1437 dev_info(axp20x->dev, "AXP20X driver loaded\n"); in axp20x_device_probe()
1443 void axp20x_device_remove(struct axp20x_dev *axp20x) in axp20x_device_remove() argument
1445 mfd_remove_devices(axp20x->dev); in axp20x_device_remove()
1446 regmap_del_irq_chip(axp20x->irq, axp20x->regmap_irqc); in axp20x_device_remove()
1450 MODULE_DESCRIPTION("PMIC MFD core driver for AXP20X");