summaryrefslogtreecommitdiffstats
path: root/drivers/power/supply/sc2731_charger.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/power/supply/sc2731_charger.c')
-rw-r--r--drivers/power/supply/sc2731_charger.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/power/supply/sc2731_charger.c b/drivers/power/supply/sc2731_charger.c
index 393ba9883c4a..a012d6c94bc3 100644
--- a/drivers/power/supply/sc2731_charger.c
+++ b/drivers/power/supply/sc2731_charger.c
@@ -432,6 +432,24 @@ error:
return ret;
}
+static void sc2731_charger_detect_status(struct sc2731_charger_info *info)
+{
+ unsigned int min, max;
+
+ /*
+ * If the USB charger status has been USB_CHARGER_PRESENT before
+ * registering the notifier, we should start to charge with getting
+ * the charge current.
+ */
+ if (info->usb_phy->chg_state != USB_CHARGER_PRESENT)
+ return;
+
+ usb_phy_get_charger_current(info->usb_phy, &min, &max);
+ info->limit = min;
+
+ schedule_work(&info->work);
+}
+
static int sc2731_charger_probe(struct platform_device *pdev)
{
struct device_node *np = pdev->dev.of_node;
@@ -486,6 +504,8 @@ static int sc2731_charger_probe(struct platform_device *pdev)
return ret;
}
+ sc2731_charger_detect_status(info);
+
return 0;
}
OpenPOWER on IntegriCloud