Lines Matching refs:axp20x
22 #include <linux/mfd/axp20x.h>
538 /* some IRQs are compatible with axp20x models */
827 .name = "axp20x-battery-power-supply",
830 .name = "axp20x-ac-power-supply",
835 .name = "axp20x-usb-power-supply",
840 { .name = "axp20x-regulator" },
845 .name = "axp20x-gpio",
848 .name = "axp20x-pek",
852 .name = "axp20x-regulator",
854 .name = "axp20x-adc",
857 .name = "axp20x-battery-power-supply",
860 .name = "axp20x-ac-power-supply",
865 .name = "axp20x-usb-power-supply",
874 .name = "axp20x-gpio",
881 .name = "axp20x-regulator",
886 .name = "axp20x-ac-power-supply",
891 .name = "axp20x-battery-power-supply",
894 .name = "axp20x-usb-power-supply",
903 .name = "axp20x-gpio",
913 .name = "axp20x-battery-power-supply",
916 .name = "axp20x-regulator",
918 .name = "axp20x-ac-power-supply",
923 .name = "axp20x-usb-power-supply",
932 .name = "axp20x-pek",
939 MFD_CELL_NAME("axp20x-regulator"),
1011 .name = "axp20x-gpio",
1017 .name = "axp20x-battery-power-supply",
1020 .name = "axp20x-ac-power-supply",
1025 .name = "axp20x-usb-power-supply",
1030 { .name = "axp20x-regulator" },
1039 { .name = "axp20x-regulator" },
1045 .name = "axp20x-regulator",
1051 .name = "axp20x-gpio",
1059 .name = "axp20x-regulator",
1069 .name = "axp20x-regulator",
1071 .name = "axp20x-gpio",
1077 .name = "axp20x-battery-power-supply",
1080 .name = "axp20x-ac-power-supply",
1085 .name = "axp20x-usb-power-supply",
1098 .name = "axp20x-regulator",
1105 .name = "axp20x-regulator",
1111 struct axp20x_dev *axp20x = data->cb_data;
1114 switch (axp20x->variant) {
1123 regmap_write(axp20x->regmap, shutdown_reg, AXP20X_OFF);
1131 int axp20x_match_device(struct axp20x_dev *axp20x)
1133 struct device *dev = axp20x->dev;
1143 axp20x->variant = (long)of_id->data;
1150 axp20x->variant = (long)acpi_id->driver_data;
1153 switch (axp20x->variant) {
1155 axp20x->nr_cells = ARRAY_SIZE(axp152_cells);
1156 axp20x->cells = axp152_cells;
1157 axp20x->regmap_cfg = &axp152_regmap_config;
1158 axp20x->regmap_irq_chip = &axp152_regmap_irq_chip;
1161 axp20x->nr_cells = ARRAY_SIZE(axp192_cells);
1162 axp20x->cells = axp192_cells;
1163 axp20x->regmap_cfg = &axp192_regmap_config;
1164 axp20x->regmap_irq_chip = &axp192_regmap_irq_chip;
1168 axp20x->nr_cells = ARRAY_SIZE(axp20x_cells);
1169 axp20x->cells = axp20x_cells;
1170 axp20x->regmap_cfg = &axp20x_regmap_config;
1171 axp20x->regmap_irq_chip = &axp20x_regmap_irq_chip;
1174 axp20x->nr_cells = ARRAY_SIZE(axp221_cells);
1175 axp20x->cells = axp221_cells;
1176 axp20x->regmap_cfg = &axp22x_regmap_config;
1177 axp20x->regmap_irq_chip = &axp22x_regmap_irq_chip;
1180 axp20x->nr_cells = ARRAY_SIZE(axp223_cells);
1181 axp20x->cells = axp223_cells;
1182 axp20x->regmap_cfg = &axp22x_regmap_config;
1183 axp20x->regmap_irq_chip = &axp22x_regmap_irq_chip;
1186 axp20x->cells = axp288_cells;
1187 axp20x->nr_cells = ARRAY_SIZE(axp288_cells);
1188 axp20x->regmap_cfg = &axp288_regmap_config;
1189 axp20x->regmap_irq_chip = &axp288_regmap_irq_chip;
1190 axp20x->irq_flags = IRQF_TRIGGER_LOW;
1193 axp20x->nr_cells = ARRAY_SIZE(axp313a_cells);
1194 axp20x->cells = axp313a_cells;
1195 axp20x->regmap_cfg = &axp313a_regmap_config;
1196 axp20x->regmap_irq_chip = &axp313a_regmap_irq_chip;
1199 axp20x->nr_cells = ARRAY_SIZE(axp803_cells);
1200 axp20x->cells = axp803_cells;
1201 axp20x->regmap_cfg = &axp288_regmap_config;
1202 axp20x->regmap_irq_chip = &axp803_regmap_irq_chip;
1209 if (of_property_read_bool(axp20x->dev->of_node,
1211 axp20x->irq > 0) {
1212 axp20x->nr_cells = ARRAY_SIZE(axp806_self_working_cells);
1213 axp20x->cells = axp806_self_working_cells;
1215 axp20x->nr_cells = ARRAY_SIZE(axp806_cells);
1216 axp20x->cells = axp806_cells;
1218 axp20x->regmap_cfg = &axp806_regmap_config;
1219 axp20x->regmap_irq_chip = &axp806_regmap_irq_chip;
1222 axp20x->nr_cells = ARRAY_SIZE(axp809_cells);
1223 axp20x->cells = axp809_cells;
1224 axp20x->regmap_cfg = &axp22x_regmap_config;
1225 axp20x->regmap_irq_chip = &axp809_regmap_irq_chip;
1228 axp20x->nr_cells = ARRAY_SIZE(axp813_cells);
1229 axp20x->cells = axp813_cells;
1230 axp20x->regmap_cfg = &axp288_regmap_config;
1238 axp20x->regmap_irq_chip = &axp803_regmap_irq_chip;
1252 if (axp20x->irq > 0) {
1253 axp20x->nr_cells = ARRAY_SIZE(axp15060_cells);
1254 axp20x->cells = axp15060_cells;
1256 axp20x->nr_cells = ARRAY_SIZE(axp_regulator_only_cells);
1257 axp20x->cells = axp_regulator_only_cells;
1259 axp20x->regmap_cfg = &axp15060_regmap_config;
1260 axp20x->regmap_irq_chip = &axp15060_regmap_irq_chip;
1263 dev_err(dev, "unsupported AXP20X ID %lu\n", axp20x->variant);
1267 axp20x_model_names[axp20x->variant]);
1273 int axp20x_device_probe(struct axp20x_dev *axp20x)
1295 if (axp20x->variant == AXP806_ID) {
1296 if (of_property_read_bool(axp20x->dev->of_node,
1298 of_property_read_bool(axp20x->dev->of_node,
1300 regmap_write(axp20x->regmap, AXP806_REG_ADDR_EXT,
1303 regmap_write(axp20x->regmap, AXP806_REG_ADDR_EXT,
1308 if (axp20x->irq > 0) {
1309 ret = regmap_add_irq_chip(axp20x->regmap, axp20x->irq,
1310 IRQF_ONESHOT | IRQF_SHARED | axp20x->irq_flags,
1311 -1, axp20x->regmap_irq_chip,
1312 &axp20x->regmap_irqc);
1314 dev_err(axp20x->dev, "failed to add irq chip: %d\n",
1320 ret = mfd_add_devices(axp20x->dev, -1, axp20x->cells,
1321 axp20x->nr_cells, NULL, 0, NULL);
1324 dev_err(axp20x->dev, "failed to add MFD devices: %d\n", ret);
1325 regmap_del_irq_chip(axp20x->irq, axp20x->regmap_irqc);
1329 if (axp20x->variant != AXP288_ID)
1330 devm_register_sys_off_handler(axp20x->dev,
1333 axp20x_power_off, axp20x);
1335 dev_info(axp20x->dev, "AXP20X driver loaded\n");
1341 void axp20x_device_remove(struct axp20x_dev *axp20x)
1343 mfd_remove_devices(axp20x->dev);
1344 regmap_del_irq_chip(axp20x->irq, axp20x->regmap_irqc);