Commit 37116a29 authored by Arnaud Ferraris's avatar Arnaud Ferraris
Browse files

d/patches: cleanup and rebase on 5.11.3

parent cc35fe3e
From 963bf70efcebe4acb331140741273255d3c81bcc Mon Sep 17 00:00:00 2001
From: Paul Cercueil <paul@crapouillou.net>
Date: Tue, 27 Oct 2020 16:41:57 +0000
Subject: [PATCH 162/184] usb: musb: Fix runtime PM race in
musb_queue_resume_work
musb_queue_resume_work() would call the provided callback if the runtime
PM status was 'active'. Otherwise, it would enqueue the request if the
hardware was still suspended (musb->is_runtime_suspended is true).
This causes a race with the runtime PM handlers, as it is possible to be
in the case where the runtime PM status is not yet 'active', but the
hardware has been awaken (PM resume function has been called).
When hitting the race, the resume work was not enqueued, which probably
triggered other bugs further down the stack. For instance, a telnet
connection on Ingenic SoCs would result in a 50/50 chance of a
segmentation fault somewhere in the musb code.
Rework the code so that either we call the callback directly if
(musb->is_runtime_suspended == 0), or enqueue the query otherwise.
Fixes: ea2f35c01d5e ("usb: musb: Fix sleeping function called from invalid context for hdrc glue")
Cc: stable@vger.kernel.org # v4.9
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Reviewed-by: Tony Lindgren <tony@atomide.com>
Tested-by: Tony Lindgren <tony@atomide.com>
---
drivers/usb/musb/musb_core.c | 31 +++++++++++++++++--------------
1 file changed, 17 insertions(+), 14 deletions(-)
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 389c3f64b94c..fc0457db62e1 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -2244,32 +2244,35 @@ int musb_queue_resume_work(struct musb *musb,
{
struct musb_pending_work *w;
unsigned long flags;
+ bool is_suspended;
int error;
if (WARN_ON(!callback))
return -EINVAL;
- if (pm_runtime_active(musb->controller))
- return callback(musb, data);
+ spin_lock_irqsave(&musb->list_lock, flags);
+ is_suspended = musb->is_runtime_suspended;
+
+ if (is_suspended) {
+ w = devm_kzalloc(musb->controller, sizeof(*w), GFP_ATOMIC);
+ if (!w) {
+ error = -ENOMEM;
+ goto out_unlock;
+ }
- w = devm_kzalloc(musb->controller, sizeof(*w), GFP_ATOMIC);
- if (!w)
- return -ENOMEM;
+ w->callback = callback;
+ w->data = data;
- w->callback = callback;
- w->data = data;
- spin_lock_irqsave(&musb->list_lock, flags);
- if (musb->is_runtime_suspended) {
list_add_tail(&w->node, &musb->pending_list);
error = 0;
- } else {
- dev_err(musb->controller, "could not add resume work %p\n",
- callback);
- devm_kfree(musb->controller, w);
- error = -EINPROGRESS;
}
+
+out_unlock:
spin_unlock_irqrestore(&musb->list_lock, flags);
+ if (!is_suspended)
+ error = callback(musb, data);
+
return error;
}
EXPORT_SYMBOL_GPL(musb_queue_resume_work);
--
2.30.0
From e0f1f47e371d452be7d458e5ac461f038c613831 Mon Sep 17 00:00:00 2001
From: Chen-Yu Tsai <wens@csie.org>
Date: Thu, 21 Mar 2019 16:48:44 +0800
Subject: [PATCH 096/184] power: supply: axp20x_usb_power: allow disabling
input current limiting
The AXP PMICs allow the user to disable current limiting on the VBUS
input. While read-out of this setting was already supported by the
driver, it did not allow the user to configure the PMIC to disable
current limiting.
Add support for this.
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
---
drivers/power/supply/axp20x_usb_power.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/power/supply/axp20x_usb_power.c b/drivers/power/supply/axp20x_usb_power.c
index 70b28b699a80..43dc9a38b0a0 100644
--- a/drivers/power/supply/axp20x_usb_power.c
+++ b/drivers/power/supply/axp20x_usb_power.c
@@ -333,6 +333,11 @@ static int axp813_usb_power_set_current_max(struct axp20x_usb_power *power,
return regmap_update_bits(power->regmap,
AXP20X_VBUS_IPSOUT_MGMT,
AXP20X_VBUS_CLIMIT_MASK, val);
+ case -1:
+ return regmap_update_bits(power->regmap,
+ AXP20X_VBUS_IPSOUT_MGMT,
+ AXP20X_VBUS_CLIMIT_MASK,
+ AXP20X_VBUS_CLIMIT_NONE);
default:
return -EINVAL;
}
--
2.30.0
From 8dd54734e47b83fcc017cf8ed14a26ecede7a3ad Mon Sep 17 00:00:00 2001
From: Icenowy Zheng <icenowy@aosc.io>
Date: Fri, 13 Sep 2019 01:46:03 +0800
Subject: [PATCH 097/184] power: supply: axp20x_usb_power: add applied max Vbus
support for AXP813
AXP813 PMIC has two Vbus maximum value settings -- one is the default
value, which is currently the only supported one; the other is the
really applied value, which is set according to the default value if the
BC detection module detected a charging port, or 500mA if no charging
port is detected.
Add support for reading and writing of the really applied Vbus maxmium
value. Interestingly it has a larger range than the default value.
Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
---
drivers/power/supply/axp20x_usb_power.c | 124 +++++++++++++++++++++++-
1 file changed, 122 insertions(+), 2 deletions(-)
diff --git a/drivers/power/supply/axp20x_usb_power.c b/drivers/power/supply/axp20x_usb_power.c
index 43dc9a38b0a0..20817a49110b 100644
--- a/drivers/power/supply/axp20x_usb_power.c
+++ b/drivers/power/supply/axp20x_usb_power.c
@@ -54,6 +54,18 @@
#define AXP813_BC_EN BIT(0)
+#define AXP813_VBUS_CLIMIT_REAL_MASK GENMASK(7, 4)
+#define AXP813_VBUS_CLIMIT_REAL_100mA (0 << 4)
+#define AXP813_VBUS_CLIMIT_REAL_500mA (1 << 4)
+#define AXP813_VBUS_CLIMIT_REAL_900mA (2 << 4)
+#define AXP813_VBUS_CLIMIT_REAL_1500mA (3 << 4)
+#define AXP813_VBUS_CLIMIT_REAL_2000mA (4 << 4)
+#define AXP813_VBUS_CLIMIT_REAL_2500mA (5 << 4)
+#define AXP813_VBUS_CLIMIT_REAL_3000mA (6 << 4)
+#define AXP813_VBUS_CLIMIT_REAL_3500mA (7 << 4)
+#define AXP813_VBUS_CLIMIT_REAL_4000mA (8 << 4)
+/* The remaining values are all 4000mA according to the datasheet */
+
/*
* Note do not raise the debounce time, we must report Vusb high within
* 100ms otherwise we get Vbus errors in musb.
@@ -174,6 +186,47 @@ static int axp813_get_current_max(struct axp20x_usb_power *power, int *val)
return 0;
}
+static int axp813_get_input_current_limit(struct axp20x_usb_power *power, int *val)
+{
+ unsigned int v;
+ int ret = regmap_read(power->regmap, AXP22X_CHRG_CTRL3, &v);
+
+ if (ret)
+ return ret;
+
+ switch (v & AXP813_VBUS_CLIMIT_REAL_MASK) {
+ case AXP813_VBUS_CLIMIT_REAL_100mA:
+ *val = 100000;
+ break;
+ case AXP813_VBUS_CLIMIT_REAL_500mA:
+ *val = 500000;
+ break;
+ case AXP813_VBUS_CLIMIT_REAL_900mA:
+ *val = 900000;
+ break;
+ case AXP813_VBUS_CLIMIT_REAL_1500mA:
+ *val = 1500000;
+ break;
+ case AXP813_VBUS_CLIMIT_REAL_2000mA:
+ *val = 2000000;
+ break;
+ case AXP813_VBUS_CLIMIT_REAL_2500mA:
+ *val = 2500000;
+ break;
+ case AXP813_VBUS_CLIMIT_REAL_3000mA:
+ *val = 3000000;
+ break;
+ case AXP813_VBUS_CLIMIT_REAL_3500mA:
+ *val = 3500000;
+ break;
+ default:
+ /* All other cases are 4000mA */
+ *val = 4000000;
+ break;
+ }
+ return 0;
+}
+
static int axp20x_usb_power_get_property(struct power_supply *psy,
enum power_supply_property psp, union power_supply_propval *val)
{
@@ -215,6 +268,8 @@ static int axp20x_usb_power_get_property(struct power_supply *psy,
if (power->axp20x_id == AXP813_ID)
return axp813_get_current_max(power, &val->intval);
return axp20x_get_current_max(power, &val->intval);
+ case POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT:
+ return axp813_get_input_current_limit(power, &val->intval);
case POWER_SUPPLY_PROP_CURRENT_NOW:
if (IS_ENABLED(CONFIG_AXP20X_ADC)) {
ret = iio_read_channel_processed(power->vbus_i,
@@ -368,6 +423,48 @@ static int axp20x_usb_power_set_current_max(struct axp20x_usb_power *power,
return -EINVAL;
}
+static int axp20x_usb_power_set_input_current_limit(struct axp20x_usb_power *power,
+ int intval)
+{
+ int val;
+
+ switch (intval) {
+ case 100000:
+ val = AXP813_VBUS_CLIMIT_REAL_100mA;
+ break;
+ case 500000:
+ val = AXP813_VBUS_CLIMIT_REAL_500mA;
+ break;
+ case 900000:
+ val = AXP813_VBUS_CLIMIT_REAL_900mA;
+ break;
+ case 1500000:
+ val = AXP813_VBUS_CLIMIT_REAL_1500mA;
+ break;
+ case 2000000:
+ val = AXP813_VBUS_CLIMIT_REAL_2000mA;
+ break;
+ case 2500000:
+ val = AXP813_VBUS_CLIMIT_REAL_2500mA;
+ break;
+ case 3000000:
+ val = AXP813_VBUS_CLIMIT_REAL_3000mA;
+ break;
+ case 3500000:
+ val = AXP813_VBUS_CLIMIT_REAL_3500mA;
+ break;
+ case 4000000:
+ val = AXP813_VBUS_CLIMIT_REAL_4000mA;
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ return regmap_update_bits(power->regmap,
+ AXP22X_CHRG_CTRL3,
+ AXP813_VBUS_CLIMIT_REAL_MASK, val);
+}
+
static int axp20x_usb_power_set_property(struct power_supply *psy,
enum power_supply_property psp,
const union power_supply_propval *val)
@@ -389,6 +486,9 @@ static int axp20x_usb_power_set_property(struct power_supply *psy,
val->intval);
return axp20x_usb_power_set_current_max(power, val->intval);
+ case POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT:
+ return axp20x_usb_power_set_input_current_limit(power, val->intval);
+
default:
return -EINVAL;
}
@@ -412,7 +512,8 @@ static int axp20x_usb_power_prop_writeable(struct power_supply *psy,
return power->axp20x_id == AXP813_ID;
return psp == POWER_SUPPLY_PROP_VOLTAGE_MIN ||
- psp == POWER_SUPPLY_PROP_CURRENT_MAX;
+ psp == POWER_SUPPLY_PROP_CURRENT_MAX ||
+ psp == POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT;
}
static enum power_supply_property axp20x_usb_power_properties[] = {
@@ -433,6 +534,15 @@ static enum power_supply_property axp22x_usb_power_properties[] = {
POWER_SUPPLY_PROP_CURRENT_MAX,
};
+static enum power_supply_property axp813_usb_power_properties[] = {
+ POWER_SUPPLY_PROP_HEALTH,
+ POWER_SUPPLY_PROP_PRESENT,
+ POWER_SUPPLY_PROP_ONLINE,
+ POWER_SUPPLY_PROP_VOLTAGE_MIN,
+ POWER_SUPPLY_PROP_CURRENT_MAX,
+ POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT,
+};
+
static const struct power_supply_desc axp20x_usb_power_desc = {
.name = "axp20x-usb",
.type = POWER_SUPPLY_TYPE_USB,
@@ -453,6 +563,16 @@ static const struct power_supply_desc axp22x_usb_power_desc = {
.set_property = axp20x_usb_power_set_property,
};
+static const struct power_supply_desc axp813_usb_power_desc = {
+ .name = "axp20x-usb",
+ .type = POWER_SUPPLY_TYPE_USB,
+ .properties = axp813_usb_power_properties,
+ .num_properties = ARRAY_SIZE(axp813_usb_power_properties),
+ .property_is_writeable = axp20x_usb_power_prop_writeable,
+ .get_property = axp20x_usb_power_get_property,
+ .set_property = axp20x_usb_power_set_property,
+};
+
static const char * const axp20x_irq_names[] = {
"VBUS_PLUGIN",
"VBUS_REMOVAL",
@@ -494,7 +614,7 @@ static const struct axp_data axp223_data = {
};
static const struct axp_data axp813_data = {
- .power_desc = &axp22x_usb_power_desc,
+ .power_desc = &axp813_usb_power_desc,
.irq_names = axp22x_irq_names,
.num_irq_names = ARRAY_SIZE(axp22x_irq_names),
.axp20x_id = AXP813_ID,
--
2.30.0
From 17ac17cfcaa4c5064a2d537946941c33520d7dfb Mon Sep 17 00:00:00 2001
From: Ondrej Jirman <megous@megous.com>
Date: Mon, 22 Jun 2020 02:28:01 +0200
Subject: [PATCH 101/184] power: supply: Add support for USB_BC_ENABLED and
USB_DCP_INPUT_CURRENT_LIMIT
- USB_BC_ENABLED - enabling/disabling BC 1.2 USB type detection
- USB_DCP_INPUT_CURRENT_LIMIT - setting a default current limit for DCP/CDP
ports
Signed-off-by: Ondrej Jirman <megous@megous.com>
---
drivers/power/supply/power_supply_sysfs.c | 2 ++
include/linux/power_supply.h | 2 ++
2 files changed, 4 insertions(+)
diff --git a/drivers/power/supply/power_supply_sysfs.c b/drivers/power/supply/power_supply_sysfs.c
index 92dd63171193..cf5da57d7d7b 100644
--- a/drivers/power/supply/power_supply_sysfs.c
+++ b/drivers/power/supply/power_supply_sysfs.c
@@ -199,6 +199,8 @@ static struct power_supply_attr power_supply_attrs[] = {
POWER_SUPPLY_ATTR(TIME_TO_FULL_NOW),
POWER_SUPPLY_ATTR(TIME_TO_FULL_AVG),
POWER_SUPPLY_ENUM_ATTR(TYPE),
+ POWER_SUPPLY_ATTR(USB_BC_ENABLED),
+ POWER_SUPPLY_ATTR(USB_DCP_INPUT_CURRENT_LIMIT),
POWER_SUPPLY_ATTR(USB_TYPE),
POWER_SUPPLY_ENUM_ATTR(SCOPE),
POWER_SUPPLY_ATTR(PRECHARGE_CURRENT),
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index 81a55e974feb..5dcaad0fac8c 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -159,6 +159,8 @@ enum power_supply_property {
POWER_SUPPLY_PROP_TIME_TO_FULL_NOW,
POWER_SUPPLY_PROP_TIME_TO_FULL_AVG,
POWER_SUPPLY_PROP_TYPE, /* use power_supply.type instead */
+ POWER_SUPPLY_PROP_USB_BC_ENABLED,
+ POWER_SUPPLY_PROP_USB_DCP_INPUT_CURRENT_LIMIT,
POWER_SUPPLY_PROP_USB_TYPE,
POWER_SUPPLY_PROP_SCOPE,
POWER_SUPPLY_PROP_PRECHARGE_CURRENT,
--
2.30.0
From fe3d8535ccd74c609c7b67de767151c10bf35718 Mon Sep 17 00:00:00 2001
From: Ondrej Jirman <megous@megous.com>
Date: Mon, 22 Jun 2020 02:31:10 +0200
Subject: [PATCH 102/184] power: supply: axp20x: Export usb_type,
usb_bc_enabled, dcp current limit
Rename CURRENT_MAX to USB_DCP_INPUT_CURRENT_LIMIT, since that's what
it is in reality. Also notify power_supply_change on BC detection
interrupts for the consumers to get BC results ASAP.
Signed-off-by: Ondrej Jirman <megous@megous.com>
---
drivers/mfd/axp20x.c | 2 +
drivers/power/supply/axp20x_usb_power.c | 123 ++++++++++++++++++++++--
2 files changed, 116 insertions(+), 9 deletions(-)
diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
index 542f01e347ed..6f4cb6b4f615 100644
--- a/drivers/mfd/axp20x.c
+++ b/drivers/mfd/axp20x.c
@@ -208,6 +208,8 @@ static const struct resource axp22x_usb_power_supply_resources[] = {
static const struct resource axp803_usb_power_supply_resources[] = {
DEFINE_RES_IRQ_NAMED(AXP803_IRQ_VBUS_PLUGIN, "VBUS_PLUGIN"),
DEFINE_RES_IRQ_NAMED(AXP803_IRQ_VBUS_REMOVAL, "VBUS_REMOVAL"),
+ DEFINE_RES_IRQ_NAMED(AXP803_IRQ_BC_USB_CHNG, "BC_USB_CHNG"),
+ DEFINE_RES_IRQ_NAMED(AXP803_IRQ_MV_CHNG, "MV_CHNG"),
};
static const struct resource axp22x_pek_resources[] = {
diff --git a/drivers/power/supply/axp20x_usb_power.c b/drivers/power/supply/axp20x_usb_power.c
index 20817a49110b..f1947e89ff32 100644
--- a/drivers/power/supply/axp20x_usb_power.c
+++ b/drivers/power/supply/axp20x_usb_power.c
@@ -52,6 +52,11 @@
#define AXP20X_VBUS_MON_VBUS_VALID BIT(3)
+#define AXP813_BC_RESULT_MASK GENMASK(7, 5)
+#define AXP813_BC_RESULT_SDP (1 << 5)
+#define AXP813_BC_RESULT_CDP (2 << 5)
+#define AXP813_BC_RESULT_DCP (3 << 5)
+
#define AXP813_BC_EN BIT(0)
#define AXP813_VBUS_CLIMIT_REAL_MASK GENMASK(7, 4)
@@ -227,6 +232,66 @@ static int axp813_get_input_current_limit(struct axp20x_usb_power *power, int *v
return 0;
}
+static int
+axp813_get_usb_bc_enabled(struct axp20x_usb_power *power, int *intval)
+{
+ unsigned int reg;
+ int ret;
+
+ ret = regmap_read(power->regmap, AXP288_BC_GLOBAL, &reg);
+ if (ret)
+ return ret;
+
+ *intval = !!(reg & AXP813_BC_EN);
+ return 0;
+}
+
+static enum power_supply_usb_type axp813_usb_types[] = {
+ POWER_SUPPLY_USB_TYPE_PD,
+ POWER_SUPPLY_USB_TYPE_SDP,
+ POWER_SUPPLY_USB_TYPE_DCP,
+ POWER_SUPPLY_USB_TYPE_CDP,
+ POWER_SUPPLY_USB_TYPE_UNKNOWN,
+};
+
+static int axp813_get_usb_type(struct axp20x_usb_power *power,
+ union power_supply_propval *val)
+{
+ unsigned int reg;
+ int ret;
+
+ ret = regmap_read(power->regmap, AXP288_BC_GLOBAL, &reg);
+ if (ret)
+ return ret;
+
+ if (!(reg & AXP813_BC_EN)) {
+ val->intval = POWER_SUPPLY_USB_TYPE_PD;
+ return 0;
+ }
+
+ ret = regmap_read(power->regmap, AXP288_BC_DET_STAT, &reg);
+ if (ret)
+ return ret;
+
+ switch (reg & AXP813_BC_RESULT_MASK) {
+ case AXP813_BC_RESULT_SDP:
+ val->intval = POWER_SUPPLY_USB_TYPE_SDP;
+ break;
+ case AXP813_BC_RESULT_CDP:
+ val->intval = POWER_SUPPLY_USB_TYPE_CDP;
+ break;
+ case AXP813_BC_RESULT_DCP:
+ val->intval = POWER_SUPPLY_USB_TYPE_DCP;
+ break;
+ default:
+ val->intval = POWER_SUPPLY_USB_TYPE_UNKNOWN;
+ break;
+ }
+
+ return 0;
+}
+
+
static int axp20x_usb_power_get_property(struct power_supply *psy,
enum power_supply_property psp, union power_supply_propval *val)
{
@@ -265,8 +330,6 @@ static int axp20x_usb_power_get_property(struct power_supply *psy,
val->intval = ret * 1700; /* 1 step = 1.7 mV */
return 0;
case POWER_SUPPLY_PROP_CURRENT_MAX:
- if (power->axp20x_id == AXP813_ID)
- return axp813_get_current_max(power, &val->intval);
return axp20x_get_current_max(power, &val->intval);
case POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT:
return axp813_get_input_current_limit(power, &val->intval);
@@ -327,6 +390,18 @@ static int axp20x_usb_power_get_property(struct power_supply *psy,
case POWER_SUPPLY_PROP_ONLINE:
val->intval = !!(input & AXP20X_PWR_STATUS_VBUS_USED);
break;
+ case POWER_SUPPLY_PROP_USB_TYPE:
+ if (power->axp20x_id == AXP813_ID)
+ return axp813_get_usb_type(power, val);
+ return -EINVAL;
+ case POWER_SUPPLY_PROP_USB_BC_ENABLED:
+ if (power->axp20x_id == AXP813_ID)
+ return axp813_get_usb_bc_enabled(power, &val->intval);
+ return -EINVAL;
+ case POWER_SUPPLY_PROP_USB_DCP_INPUT_CURRENT_LIMIT:
+ if (power->axp20x_id == AXP813_ID)
+ return axp813_get_current_max(power, &val->intval);
+ /* fallthrough */
default:
return -EINVAL;
}
@@ -465,6 +540,13 @@ static int axp20x_usb_power_set_input_current_limit(struct axp20x_usb_power *pow
AXP813_VBUS_CLIMIT_REAL_MASK, val);
}
+static int axp813_set_usb_bc_enabled(struct axp20x_usb_power *power, int val)
+{
+ return regmap_update_bits(power->regmap, AXP288_BC_GLOBAL,
+ AXP813_BC_EN,
+ val ? AXP813_BC_EN : 0);
+}
+
static int axp20x_usb_power_set_property(struct power_supply *psy,
enum power_supply_property psp,
const union power_supply_propval *val)
@@ -481,14 +563,24 @@ static int axp20x_usb_power_set_property(struct power_supply *psy,
return axp20x_usb_power_set_voltage_min(power, val->intval);
case POWER_SUPPLY_PROP_CURRENT_MAX:
- if (power->axp20x_id == AXP813_ID)
- return axp813_usb_power_set_current_max(power,
- val->intval);
return axp20x_usb_power_set_current_max(power, val->intval);
case POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT:
return axp20x_usb_power_set_input_current_limit(power, val->intval);
+ case POWER_SUPPLY_PROP_USB_BC_ENABLED:
+ if (power->axp20x_id == AXP813_ID)
+ return axp813_set_usb_bc_enabled(power, val->intval);
+
+ return -EINVAL;
+
+ case POWER_SUPPLY_PROP_USB_DCP_INPUT_CURRENT_LIMIT:
+ if (power->axp20x_id == AXP813_ID)
+ return axp813_usb_power_set_current_max(power,
+ val->intval);
+
+ return -EINVAL;
+
default:
return -EINVAL;
}
@@ -513,7 +605,9 @@ static int axp20x_usb_power_prop_writeable(struct power_supply *psy,
return psp == POWER_SUPPLY_PROP_VOLTAGE_MIN ||
psp == POWER_SUPPLY_PROP_CURRENT_MAX ||
- psp == POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT;
+ psp == POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT ||
+ psp == POWER_SUPPLY_PROP_USB_BC_ENABLED ||
+ psp == POWER_SUPPLY_PROP_USB_DCP_INPUT_CURRENT_LIMIT;
}
static enum power_supply_property axp20x_usb_power_properties[] = {
@@ -539,8 +633,10 @@ static enum power_supply_property axp813_usb_power_properties[] = {
POWER_SUPPLY_PROP_PRESENT,
POWER_SUPPLY_PROP_ONLINE,
POWER_SUPPLY_PROP_VOLTAGE_MIN,
- POWER_SUPPLY_PROP_CURRENT_MAX,
POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT,
+ POWER_SUPPLY_PROP_USB_BC_ENABLED,
+ POWER_SUPPLY_PROP_USB_DCP_INPUT_CURRENT_LIMIT,
+ POWER_SUPPLY_PROP_USB_TYPE,
};
static const struct power_supply_desc axp20x_usb_power_desc = {
@@ -571,6 +667,8 @@ static const struct power_supply_desc axp813_usb_power_desc = {