.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * MFD core driver for the X-Powers' Power Management ICs |
---|
3 | 4 | * |
---|
.. | .. |
---|
10 | 11 | * Copyright (C) 2014 Carlo Caione |
---|
11 | 12 | * |
---|
12 | 13 | * 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. |
---|
17 | 14 | */ |
---|
18 | 15 | |
---|
19 | | -#include <linux/err.h> |
---|
| 16 | +#include <linux/acpi.h> |
---|
| 17 | +#include <linux/bitops.h> |
---|
20 | 18 | #include <linux/delay.h> |
---|
| 19 | +#include <linux/err.h> |
---|
21 | 20 | #include <linux/interrupt.h> |
---|
22 | 21 | #include <linux/kernel.h> |
---|
| 22 | +#include <linux/mfd/axp20x.h> |
---|
| 23 | +#include <linux/mfd/core.h> |
---|
23 | 24 | #include <linux/module.h> |
---|
| 25 | +#include <linux/of_device.h> |
---|
24 | 26 | #include <linux/pm_runtime.h> |
---|
25 | 27 | #include <linux/regmap.h> |
---|
26 | 28 | #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> |
---|
31 | 29 | |
---|
32 | | -#define AXP20X_OFF 0x80 |
---|
| 30 | +#define AXP20X_OFF BIT(7) |
---|
33 | 31 | |
---|
34 | 32 | #define AXP806_REG_ADDR_EXT_ADDR_MASTER_MODE 0 |
---|
35 | 33 | #define AXP806_REG_ADDR_EXT_ADDR_SLAVE_MODE BIT(4) |
---|
.. | .. |
---|
196 | 194 | static const struct resource axp22x_usb_power_supply_resources[] = { |
---|
197 | 195 | DEFINE_RES_IRQ_NAMED(AXP22X_IRQ_VBUS_PLUGIN, "VBUS_PLUGIN"), |
---|
198 | 196 | 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"), |
---|
199 | 203 | }; |
---|
200 | 204 | |
---|
201 | 205 | static const struct resource axp22x_pek_resources[] = { |
---|
.. | .. |
---|
741 | 745 | .of_compatible = "x-powers,axp813-ac-power-supply", |
---|
742 | 746 | .num_resources = ARRAY_SIZE(axp20x_ac_power_supply_resources), |
---|
743 | 747 | .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", |
---|
744 | 753 | }, |
---|
745 | 754 | { .name = "axp20x-regulator" }, |
---|
746 | 755 | }; |
---|
.. | .. |
---|
793 | 802 | .of_compatible = "x-powers,axp813-ac-power-supply", |
---|
794 | 803 | .num_resources = ARRAY_SIZE(axp20x_ac_power_supply_resources), |
---|
795 | 804 | .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", |
---|
796 | 810 | }, |
---|
797 | 811 | }; |
---|
798 | 812 | |
---|