hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/mfd/axp20x.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * MFD core driver for the X-Powers' Power Management ICs
34 *
....@@ -10,26 +11,23 @@
1011 * Copyright (C) 2014 Carlo Caione
1112 *
1213 * Author: Carlo Caione <carlo@caione.org>
13
- *
14
- * This program is free software; you can redistribute it and/or modify
15
- * it under the terms of the GNU General Public License version 2 as
16
- * published by the Free Software Foundation.
1714 */
1815
19
-#include <linux/err.h>
16
+#include <linux/acpi.h>
17
+#include <linux/bitops.h>
2018 #include <linux/delay.h>
19
+#include <linux/err.h>
2120 #include <linux/interrupt.h>
2221 #include <linux/kernel.h>
22
+#include <linux/mfd/axp20x.h>
23
+#include <linux/mfd/core.h>
2324 #include <linux/module.h>
25
+#include <linux/of_device.h>
2426 #include <linux/pm_runtime.h>
2527 #include <linux/regmap.h>
2628 #include <linux/regulator/consumer.h>
27
-#include <linux/mfd/axp20x.h>
28
-#include <linux/mfd/core.h>
29
-#include <linux/of_device.h>
30
-#include <linux/acpi.h>
3129
32
-#define AXP20X_OFF 0x80
30
+#define AXP20X_OFF BIT(7)
3331
3432 #define AXP806_REG_ADDR_EXT_ADDR_MASTER_MODE 0
3533 #define AXP806_REG_ADDR_EXT_ADDR_SLAVE_MODE BIT(4)
....@@ -196,6 +194,12 @@
196194 static const struct resource axp22x_usb_power_supply_resources[] = {
197195 DEFINE_RES_IRQ_NAMED(AXP22X_IRQ_VBUS_PLUGIN, "VBUS_PLUGIN"),
198196 DEFINE_RES_IRQ_NAMED(AXP22X_IRQ_VBUS_REMOVAL, "VBUS_REMOVAL"),
197
+};
198
+
199
+/* AXP803 and AXP813/AXP818 share the same interrupts */
200
+static const struct resource axp803_usb_power_supply_resources[] = {
201
+ DEFINE_RES_IRQ_NAMED(AXP803_IRQ_VBUS_PLUGIN, "VBUS_PLUGIN"),
202
+ DEFINE_RES_IRQ_NAMED(AXP803_IRQ_VBUS_REMOVAL, "VBUS_REMOVAL"),
199203 };
200204
201205 static const struct resource axp22x_pek_resources[] = {
....@@ -741,6 +745,11 @@
741745 .of_compatible = "x-powers,axp813-ac-power-supply",
742746 .num_resources = ARRAY_SIZE(axp20x_ac_power_supply_resources),
743747 .resources = axp20x_ac_power_supply_resources,
748
+ }, {
749
+ .name = "axp20x-usb-power-supply",
750
+ .num_resources = ARRAY_SIZE(axp803_usb_power_supply_resources),
751
+ .resources = axp803_usb_power_supply_resources,
752
+ .of_compatible = "x-powers,axp813-usb-power-supply",
744753 },
745754 { .name = "axp20x-regulator" },
746755 };
....@@ -793,6 +802,11 @@
793802 .of_compatible = "x-powers,axp813-ac-power-supply",
794803 .num_resources = ARRAY_SIZE(axp20x_ac_power_supply_resources),
795804 .resources = axp20x_ac_power_supply_resources,
805
+ }, {
806
+ .name = "axp20x-usb-power-supply",
807
+ .num_resources = ARRAY_SIZE(axp803_usb_power_supply_resources),
808
+ .resources = axp803_usb_power_supply_resources,
809
+ .of_compatible = "x-powers,axp813-usb-power-supply",
796810 },
797811 };
798812