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
593 .name = "axp20x-gpio",
594 .of_compatible = "x-powers,axp209-gpio",
596 .name = "axp20x-pek",
600 .name = "axp20x-regulator",
602 .name = "axp20x-adc",
603 .of_compatible = "x-powers,axp209-adc",
605 .name = "axp20x-battery-power-supply",
606 .of_compatible = "x-powers,axp209-battery-power-supply",
608 .name = "axp20x-ac-power-supply",
609 .of_compatible = "x-powers,axp202-ac-power-supply",
613 .name = "axp20x-usb-power-supply",
614 .of_compatible = "x-powers,axp202-usb-power-supply",
622 .name = "axp221-pek",
626 .name = "axp20x-regulator",
628 .name = "axp22x-adc",
629 .of_compatible = "x-powers,axp221-adc",
631 .name = "axp20x-ac-power-supply",
632 .of_compatible = "x-powers,axp221-ac-power-supply",
636 .name = "axp20x-battery-power-supply",
637 .of_compatible = "x-powers,axp221-battery-power-supply",
639 .name = "axp20x-usb-power-supply",
640 .of_compatible = "x-powers,axp221-usb-power-supply",
648 .name = "axp221-pek",
652 .name = "axp22x-adc",
653 .of_compatible = "x-powers,axp221-adc",
655 .name = "axp20x-battery-power-supply",
656 .of_compatible = "x-powers,axp221-battery-power-supply",
658 .name = "axp20x-regulator",
660 .name = "axp20x-ac-power-supply",
661 .of_compatible = "x-powers,axp221-ac-power-supply",
665 .name = "axp20x-usb-power-supply",
666 .of_compatible = "x-powers,axp223-usb-power-supply",
674 .name = "axp20x-pek",
721 .name = "axp221-pek",
731 .name = "axp221-pek",
735 .name = "axp20x-gpio",
736 .of_compatible = "x-powers,axp813-gpio",
738 .name = "axp813-adc",
739 .of_compatible = "x-powers,axp813-adc",
741 .name = "axp20x-battery-power-supply",
742 .of_compatible = "x-powers,axp813-battery-power-supply",
744 .name = "axp20x-ac-power-supply",
745 .of_compatible = "x-powers,axp813-ac-power-supply",
749 .name = "axp20x-usb-power-supply",
752 .of_compatible = "x-powers,axp813-usb-power-supply",
754 { .name = "axp20x-regulator" },
759 .name = "axp221-pek",
763 { .name = "axp20x-regulator" },
769 .name = "axp20x-regulator",
775 .name = "axp221-pek",
780 .name = "axp20x-regulator",
786 .name = "axp221-pek",
790 .name = "axp20x-regulator",
792 .name = "axp20x-gpio",
793 .of_compatible = "x-powers,axp813-gpio",
795 .name = "axp813-adc",
796 .of_compatible = "x-powers,axp813-adc",
798 .name = "axp20x-battery-power-supply",
799 .of_compatible = "x-powers,axp813-battery-power-supply",
801 .name = "axp20x-ac-power-supply",
802 .of_compatible = "x-powers,axp813-ac-power-supply",
806 .name = "axp20x-usb-power-supply",
809 .of_compatible = "x-powers,axp813-usb-power-supply",
816 if (axp20x_pm_power_off->variant == AXP288_ID) in axp20x_power_off()
819 regmap_write(axp20x_pm_power_off->regmap, AXP20X_OFF_CTRL, in axp20x_power_off()
828 struct device *dev = axp20x->dev; in axp20x_match_device()
832 if (dev->of_node) { in axp20x_match_device()
833 of_id = of_match_device(dev->driver->of_match_table, dev); in axp20x_match_device()
836 return -ENODEV; in axp20x_match_device()
838 axp20x->variant = (long)of_id->data; in axp20x_match_device()
840 acpi_id = acpi_match_device(dev->driver->acpi_match_table, dev); in axp20x_match_device()
841 if (!acpi_id || !acpi_id->driver_data) { in axp20x_match_device()
843 return -ENODEV; in axp20x_match_device()
845 axp20x->variant = (long)acpi_id->driver_data; in axp20x_match_device()
848 switch (axp20x->variant) { in axp20x_match_device()
850 axp20x->nr_cells = ARRAY_SIZE(axp152_cells); in axp20x_match_device()
851 axp20x->cells = axp152_cells; in axp20x_match_device()
852 axp20x->regmap_cfg = &axp152_regmap_config; in axp20x_match_device()
853 axp20x->regmap_irq_chip = &axp152_regmap_irq_chip; in axp20x_match_device()
857 axp20x->nr_cells = ARRAY_SIZE(axp20x_cells); in axp20x_match_device()
858 axp20x->cells = axp20x_cells; in axp20x_match_device()
859 axp20x->regmap_cfg = &axp20x_regmap_config; in axp20x_match_device()
860 axp20x->regmap_irq_chip = &axp20x_regmap_irq_chip; in axp20x_match_device()
863 axp20x->nr_cells = ARRAY_SIZE(axp221_cells); in axp20x_match_device()
864 axp20x->cells = axp221_cells; in axp20x_match_device()
865 axp20x->regmap_cfg = &axp22x_regmap_config; in axp20x_match_device()
866 axp20x->regmap_irq_chip = &axp22x_regmap_irq_chip; in axp20x_match_device()
869 axp20x->nr_cells = ARRAY_SIZE(axp223_cells); in axp20x_match_device()
870 axp20x->cells = axp223_cells; in axp20x_match_device()
871 axp20x->regmap_cfg = &axp22x_regmap_config; in axp20x_match_device()
872 axp20x->regmap_irq_chip = &axp22x_regmap_irq_chip; in axp20x_match_device()
875 axp20x->cells = axp288_cells; in axp20x_match_device()
876 axp20x->nr_cells = ARRAY_SIZE(axp288_cells); in axp20x_match_device()
877 axp20x->regmap_cfg = &axp288_regmap_config; in axp20x_match_device()
878 axp20x->regmap_irq_chip = &axp288_regmap_irq_chip; in axp20x_match_device()
879 axp20x->irq_flags = IRQF_TRIGGER_LOW; in axp20x_match_device()
882 axp20x->nr_cells = ARRAY_SIZE(axp803_cells); in axp20x_match_device()
883 axp20x->cells = axp803_cells; in axp20x_match_device()
884 axp20x->regmap_cfg = &axp288_regmap_config; in axp20x_match_device()
885 axp20x->regmap_irq_chip = &axp803_regmap_irq_chip; in axp20x_match_device()
888 if (of_property_read_bool(axp20x->dev->of_node, in axp20x_match_device()
889 "x-powers,self-working-mode")) { in axp20x_match_device()
890 axp20x->nr_cells = ARRAY_SIZE(axp806_self_working_cells); in axp20x_match_device()
891 axp20x->cells = axp806_self_working_cells; in axp20x_match_device()
893 axp20x->nr_cells = ARRAY_SIZE(axp806_cells); in axp20x_match_device()
894 axp20x->cells = axp806_cells; in axp20x_match_device()
896 axp20x->regmap_cfg = &axp806_regmap_config; in axp20x_match_device()
897 axp20x->regmap_irq_chip = &axp806_regmap_irq_chip; in axp20x_match_device()
900 axp20x->nr_cells = ARRAY_SIZE(axp809_cells); in axp20x_match_device()
901 axp20x->cells = axp809_cells; in axp20x_match_device()
902 axp20x->regmap_cfg = &axp22x_regmap_config; in axp20x_match_device()
903 axp20x->regmap_irq_chip = &axp809_regmap_irq_chip; in axp20x_match_device()
906 axp20x->nr_cells = ARRAY_SIZE(axp813_cells); in axp20x_match_device()
907 axp20x->cells = axp813_cells; in axp20x_match_device()
908 axp20x->regmap_cfg = &axp288_regmap_config; in axp20x_match_device()
916 axp20x->regmap_irq_chip = &axp803_regmap_irq_chip; in axp20x_match_device()
919 dev_err(dev, "unsupported AXP20X ID %lu\n", axp20x->variant); in axp20x_match_device()
920 return -EINVAL; in axp20x_match_device()
923 axp20x_model_names[axp20x->variant]); in axp20x_match_device()
940 * AXP806_REG_ADDR_EXT, registers. The former is read-only, with in axp20x_device_probe()
949 * property "x-powers,master-mode" to override the default. in axp20x_device_probe()
951 if (axp20x->variant == AXP806_ID) { in axp20x_device_probe()
952 if (of_property_read_bool(axp20x->dev->of_node, in axp20x_device_probe()
953 "x-powers,master-mode") || in axp20x_device_probe()
954 of_property_read_bool(axp20x->dev->of_node, in axp20x_device_probe()
955 "x-powers,self-working-mode")) in axp20x_device_probe()
956 regmap_write(axp20x->regmap, AXP806_REG_ADDR_EXT, in axp20x_device_probe()
959 regmap_write(axp20x->regmap, AXP806_REG_ADDR_EXT, in axp20x_device_probe()
963 ret = regmap_add_irq_chip(axp20x->regmap, axp20x->irq, in axp20x_device_probe()
964 IRQF_ONESHOT | IRQF_SHARED | axp20x->irq_flags, in axp20x_device_probe()
965 -1, axp20x->regmap_irq_chip, &axp20x->regmap_irqc); in axp20x_device_probe()
967 dev_err(axp20x->dev, "failed to add irq chip: %d\n", ret); in axp20x_device_probe()
971 ret = mfd_add_devices(axp20x->dev, -1, axp20x->cells, in axp20x_device_probe()
972 axp20x->nr_cells, NULL, 0, NULL); in axp20x_device_probe()
975 dev_err(axp20x->dev, "failed to add MFD devices: %d\n", ret); in axp20x_device_probe()
976 regmap_del_irq_chip(axp20x->irq, axp20x->regmap_irqc); in axp20x_device_probe()
985 dev_info(axp20x->dev, "AXP20X driver loaded\n"); in axp20x_device_probe()
998 mfd_remove_devices(axp20x->dev); in axp20x_device_remove()
999 regmap_del_irq_chip(axp20x->irq, axp20x->regmap_irqc); in axp20x_device_remove()