summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIcenowy Zheng <icenowy@aosc.io>2019-10-02 19:25:44 +0800
committerSebastian Reichel <sebastian.reichel@collabora.com>2019-10-14 06:19:53 +0200
commitf2e5c49d221bd46c72d363ae595e47268bd1f420 (patch)
tree55304ee5b4acb285fb641db2a9220e3f140440bf
parentb0ac8596edc8b37de90a5ec095a25abbbc24f169 (diff)
power: supply: axp20x_usb_power: enable USB BC detection on AXP813
The AXP813 PMIC has support for detection of USB Battery Charging specification, and it will limit the current to 500mA by default when the detection is not enabled or the detection result is SDP. Enable the BC detection to allow correctly selection of the current. Signed-off-by: Icenowy Zheng <icenowy@aosc.io> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
-rw-r--r--drivers/power/supply/axp20x_usb_power.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/power/supply/axp20x_usb_power.c b/drivers/power/supply/axp20x_usb_power.c
index dc4c316eff81..5f0a5722b19e 100644
--- a/drivers/power/supply/axp20x_usb_power.c
+++ b/drivers/power/supply/axp20x_usb_power.c
@@ -48,6 +48,8 @@
#define AXP20X_VBUS_MON_VBUS_VALID BIT(3)
+#define AXP813_BC_EN BIT(0)
+
/*
* Note do not raise the debounce time, we must report Vusb high within
* 100ms otherwise we get Vbus errors in musb.
@@ -495,6 +497,12 @@ static int axp20x_usb_power_probe(struct platform_device *pdev)
return -EINVAL;
}
+ if (power->axp20x_id == AXP813_ID) {
+ /* Enable USB Battery Charging specification detection */
+ regmap_update_bits(axp20x->regmap, AXP288_BC_GLOBAL,
+ AXP813_BC_EN, AXP813_BC_EN);
+ }
+
psy_cfg.of_node = pdev->dev.of_node;
psy_cfg.drv_data = power;