Lines Matching +full:x +full:- +full:powers

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
824 .name = "axp192-adc",
825 .of_compatible = "x-powers,axp192-adc",
827 .name = "axp20x-battery-power-supply",
828 .of_compatible = "x-powers,axp192-battery-power-supply",
830 .name = "axp20x-ac-power-supply",
831 .of_compatible = "x-powers,axp202-ac-power-supply",
835 .name = "axp20x-usb-power-supply",
836 .of_compatible = "x-powers,axp192-usb-power-supply",
840 { .name = "axp20x-regulator" },
845 .name = "axp20x-gpio",
846 .of_compatible = "x-powers,axp209-gpio",
848 .name = "axp20x-pek",
852 .name = "axp20x-regulator",
854 .name = "axp20x-adc",
855 .of_compatible = "x-powers,axp209-adc",
857 .name = "axp20x-battery-power-supply",
858 .of_compatible = "x-powers,axp209-battery-power-supply",
860 .name = "axp20x-ac-power-supply",
861 .of_compatible = "x-powers,axp202-ac-power-supply",
865 .name = "axp20x-usb-power-supply",
866 .of_compatible = "x-powers,axp202-usb-power-supply",
874 .name = "axp20x-gpio",
875 .of_compatible = "x-powers,axp221-gpio",
877 .name = "axp221-pek",
881 .name = "axp20x-regulator",
883 .name = "axp22x-adc",
884 .of_compatible = "x-powers,axp221-adc",
886 .name = "axp20x-ac-power-supply",
887 .of_compatible = "x-powers,axp221-ac-power-supply",
891 .name = "axp20x-battery-power-supply",
892 .of_compatible = "x-powers,axp221-battery-power-supply",
894 .name = "axp20x-usb-power-supply",
895 .of_compatible = "x-powers,axp221-usb-power-supply",
903 .name = "axp20x-gpio",
904 .of_compatible = "x-powers,axp221-gpio",
906 .name = "axp221-pek",
910 .name = "axp22x-adc",
911 .of_compatible = "x-powers,axp221-adc",
913 .name = "axp20x-battery-power-supply",
914 .of_compatible = "x-powers,axp221-battery-power-supply",
916 .name = "axp20x-regulator",
918 .name = "axp20x-ac-power-supply",
919 .of_compatible = "x-powers,axp221-ac-power-supply",
923 .name = "axp20x-usb-power-supply",
924 .of_compatible = "x-powers,axp223-usb-power-supply",
932 .name = "axp20x-pek",
939 MFD_CELL_NAME("axp20x-regulator"),
940 MFD_CELL_RES("axp313a-pek", axp313a_pek_resources),
969 PROPERTY_ENTRY_STRING_ARRAY("supplied-from", axp288_fuel_gauge_suppliers),
997 .name = "axp221-pek",
1007 .name = "axp221-pek",
1011 .name = "axp20x-gpio",
1012 .of_compatible = "x-powers,axp813-gpio",
1014 .name = "axp813-adc",
1015 .of_compatible = "x-powers,axp813-adc",
1017 .name = "axp20x-battery-power-supply",
1018 .of_compatible = "x-powers,axp813-battery-power-supply",
1020 .name = "axp20x-ac-power-supply",
1021 .of_compatible = "x-powers,axp813-ac-power-supply",
1025 .name = "axp20x-usb-power-supply",
1028 .of_compatible = "x-powers,axp813-usb-power-supply",
1030 { .name = "axp20x-regulator" },
1035 .name = "axp221-pek",
1039 { .name = "axp20x-regulator" },
1045 .name = "axp20x-regulator",
1051 .name = "axp20x-gpio",
1052 .of_compatible = "x-powers,axp221-gpio",
1054 .name = "axp221-pek",
1059 .name = "axp20x-regulator",
1065 .name = "axp221-pek",
1069 .name = "axp20x-regulator",
1071 .name = "axp20x-gpio",
1072 .of_compatible = "x-powers,axp813-gpio",
1074 .name = "axp813-adc",
1075 .of_compatible = "x-powers,axp813-adc",
1077 .name = "axp20x-battery-power-supply",
1078 .of_compatible = "x-powers,axp813-battery-power-supply",
1080 .name = "axp20x-ac-power-supply",
1081 .of_compatible = "x-powers,axp813-ac-power-supply",
1085 .name = "axp20x-usb-power-supply",
1088 .of_compatible = "x-powers,axp813-usb-power-supply",
1094 .name = "axp221-pek",
1098 .name = "axp20x-regulator",
1105 .name = "axp20x-regulator",
1111 struct axp20x_dev *axp20x = data->cb_data; in axp20x_power_off()
1114 switch (axp20x->variant) { in axp20x_power_off()
1123 regmap_write(axp20x->regmap, shutdown_reg, AXP20X_OFF); in axp20x_power_off()
1133 struct device *dev = axp20x->dev; in axp20x_match_device()
1137 if (dev->of_node) { in axp20x_match_device()
1138 of_id = of_match_device(dev->driver->of_match_table, dev); in axp20x_match_device()
1141 return -ENODEV; in axp20x_match_device()
1143 axp20x->variant = (long)of_id->data; in axp20x_match_device()
1145 acpi_id = acpi_match_device(dev->driver->acpi_match_table, dev); in axp20x_match_device()
1146 if (!acpi_id || !acpi_id->driver_data) { in axp20x_match_device()
1148 return -ENODEV; in axp20x_match_device()
1150 axp20x->variant = (long)acpi_id->driver_data; in axp20x_match_device()
1153 switch (axp20x->variant) { in axp20x_match_device()
1155 axp20x->nr_cells = ARRAY_SIZE(axp152_cells); in axp20x_match_device()
1156 axp20x->cells = axp152_cells; in axp20x_match_device()
1157 axp20x->regmap_cfg = &axp152_regmap_config; in axp20x_match_device()
1158 axp20x->regmap_irq_chip = &axp152_regmap_irq_chip; in axp20x_match_device()
1161 axp20x->nr_cells = ARRAY_SIZE(axp192_cells); in axp20x_match_device()
1162 axp20x->cells = axp192_cells; in axp20x_match_device()
1163 axp20x->regmap_cfg = &axp192_regmap_config; in axp20x_match_device()
1164 axp20x->regmap_irq_chip = &axp192_regmap_irq_chip; in axp20x_match_device()
1168 axp20x->nr_cells = ARRAY_SIZE(axp20x_cells); in axp20x_match_device()
1169 axp20x->cells = axp20x_cells; in axp20x_match_device()
1170 axp20x->regmap_cfg = &axp20x_regmap_config; in axp20x_match_device()
1171 axp20x->regmap_irq_chip = &axp20x_regmap_irq_chip; in axp20x_match_device()
1174 axp20x->nr_cells = ARRAY_SIZE(axp221_cells); in axp20x_match_device()
1175 axp20x->cells = axp221_cells; in axp20x_match_device()
1176 axp20x->regmap_cfg = &axp22x_regmap_config; in axp20x_match_device()
1177 axp20x->regmap_irq_chip = &axp22x_regmap_irq_chip; in axp20x_match_device()
1180 axp20x->nr_cells = ARRAY_SIZE(axp223_cells); in axp20x_match_device()
1181 axp20x->cells = axp223_cells; in axp20x_match_device()
1182 axp20x->regmap_cfg = &axp22x_regmap_config; in axp20x_match_device()
1183 axp20x->regmap_irq_chip = &axp22x_regmap_irq_chip; in axp20x_match_device()
1186 axp20x->cells = axp288_cells; in axp20x_match_device()
1187 axp20x->nr_cells = ARRAY_SIZE(axp288_cells); in axp20x_match_device()
1188 axp20x->regmap_cfg = &axp288_regmap_config; in axp20x_match_device()
1189 axp20x->regmap_irq_chip = &axp288_regmap_irq_chip; in axp20x_match_device()
1190 axp20x->irq_flags = IRQF_TRIGGER_LOW; in axp20x_match_device()
1193 axp20x->nr_cells = ARRAY_SIZE(axp313a_cells); in axp20x_match_device()
1194 axp20x->cells = axp313a_cells; in axp20x_match_device()
1195 axp20x->regmap_cfg = &axp313a_regmap_config; in axp20x_match_device()
1196 axp20x->regmap_irq_chip = &axp313a_regmap_irq_chip; in axp20x_match_device()
1199 axp20x->nr_cells = ARRAY_SIZE(axp803_cells); in axp20x_match_device()
1200 axp20x->cells = axp803_cells; in axp20x_match_device()
1201 axp20x->regmap_cfg = &axp288_regmap_config; in axp20x_match_device()
1202 axp20x->regmap_irq_chip = &axp803_regmap_irq_chip; in axp20x_match_device()
1209 if (of_property_read_bool(axp20x->dev->of_node, in axp20x_match_device()
1210 "x-powers,self-working-mode") && in axp20x_match_device()
1211 axp20x->irq > 0) { in axp20x_match_device()
1212 axp20x->nr_cells = ARRAY_SIZE(axp806_self_working_cells); in axp20x_match_device()
1213 axp20x->cells = axp806_self_working_cells; in axp20x_match_device()
1215 axp20x->nr_cells = ARRAY_SIZE(axp806_cells); in axp20x_match_device()
1216 axp20x->cells = axp806_cells; in axp20x_match_device()
1218 axp20x->regmap_cfg = &axp806_regmap_config; in axp20x_match_device()
1219 axp20x->regmap_irq_chip = &axp806_regmap_irq_chip; in axp20x_match_device()
1222 axp20x->nr_cells = ARRAY_SIZE(axp809_cells); in axp20x_match_device()
1223 axp20x->cells = axp809_cells; in axp20x_match_device()
1224 axp20x->regmap_cfg = &axp22x_regmap_config; in axp20x_match_device()
1225 axp20x->regmap_irq_chip = &axp809_regmap_irq_chip; in axp20x_match_device()
1228 axp20x->nr_cells = ARRAY_SIZE(axp813_cells); in axp20x_match_device()
1229 axp20x->cells = axp813_cells; in axp20x_match_device()
1230 axp20x->regmap_cfg = &axp288_regmap_config; in axp20x_match_device()
1238 axp20x->regmap_irq_chip = &axp803_regmap_irq_chip; in axp20x_match_device()
1252 if (axp20x->irq > 0) { in axp20x_match_device()
1253 axp20x->nr_cells = ARRAY_SIZE(axp15060_cells); in axp20x_match_device()
1254 axp20x->cells = axp15060_cells; in axp20x_match_device()
1256 axp20x->nr_cells = ARRAY_SIZE(axp_regulator_only_cells); in axp20x_match_device()
1257 axp20x->cells = axp_regulator_only_cells; in axp20x_match_device()
1259 axp20x->regmap_cfg = &axp15060_regmap_config; in axp20x_match_device()
1260 axp20x->regmap_irq_chip = &axp15060_regmap_irq_chip; in axp20x_match_device()
1263 dev_err(dev, "unsupported AXP20X ID %lu\n", axp20x->variant); in axp20x_match_device()
1264 return -EINVAL; in axp20x_match_device()
1267 axp20x_model_names[axp20x->variant]); in axp20x_match_device()
1284 * AXP806_REG_ADDR_EXT, registers. The former is read-only, with in axp20x_device_probe()
1293 * property "x-powers,master-mode" to override the default. in axp20x_device_probe()
1295 if (axp20x->variant == AXP806_ID) { in axp20x_device_probe()
1296 if (of_property_read_bool(axp20x->dev->of_node, in axp20x_device_probe()
1297 "x-powers,master-mode") || in axp20x_device_probe()
1298 of_property_read_bool(axp20x->dev->of_node, in axp20x_device_probe()
1299 "x-powers,self-working-mode")) in axp20x_device_probe()
1300 regmap_write(axp20x->regmap, AXP806_REG_ADDR_EXT, in axp20x_device_probe()
1303 regmap_write(axp20x->regmap, AXP806_REG_ADDR_EXT, in axp20x_device_probe()
1308 if (axp20x->irq > 0) { in axp20x_device_probe()
1309 ret = regmap_add_irq_chip(axp20x->regmap, axp20x->irq, in axp20x_device_probe()
1310 IRQF_ONESHOT | IRQF_SHARED | axp20x->irq_flags, in axp20x_device_probe()
1311 -1, axp20x->regmap_irq_chip, in axp20x_device_probe()
1312 &axp20x->regmap_irqc); in axp20x_device_probe()
1314 dev_err(axp20x->dev, "failed to add irq chip: %d\n", in axp20x_device_probe()
1320 ret = mfd_add_devices(axp20x->dev, -1, axp20x->cells, in axp20x_device_probe()
1321 axp20x->nr_cells, NULL, 0, NULL); in axp20x_device_probe()
1324 dev_err(axp20x->dev, "failed to add MFD devices: %d\n", ret); in axp20x_device_probe()
1325 regmap_del_irq_chip(axp20x->irq, axp20x->regmap_irqc); in axp20x_device_probe()
1329 if (axp20x->variant != AXP288_ID) in axp20x_device_probe()
1330 devm_register_sys_off_handler(axp20x->dev, in axp20x_device_probe()
1335 dev_info(axp20x->dev, "AXP20X driver loaded\n"); in axp20x_device_probe()
1343 mfd_remove_devices(axp20x->dev); in axp20x_device_remove()
1344 regmap_del_irq_chip(axp20x->irq, axp20x->regmap_irqc); in axp20x_device_remove()