From: Balaji T K <balaj...@ti.com>

Set the current supplied by dedicated charging port to 1800mV(according to
battery charging specification). Also added a callback function for set_power
to dynamically set the current to be supplied based on the state of the system.

Signed-off-by: Balaji T K <balaj...@ti.com>
Signed-off-by: Kishon Vijay Abraham I <kis...@ti.com>
---
 drivers/usb/otg/twl6030-usb.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/otg/twl6030-usb.c b/drivers/usb/otg/twl6030-usb.c
index 6cb28ea..1f22c10 100644
--- a/drivers/usb/otg/twl6030-usb.c
+++ b/drivers/usb/otg/twl6030-usb.c
@@ -102,6 +102,7 @@ struct twl6030_usb {
 
        int                     irq1;
        int                     irq2;
+       unsigned int            usb_cinlimit_mA;
        u8                      linkstat;
        u8                      asleep;
        u8                      prev_vbus;
@@ -305,6 +306,7 @@ static irqreturn_t twl6030_usb_irq(int irq, void *_twl)
                        regulator_disable(twl->usb3v3);
                        status = USB_EVENT_CHARGER;
                        twl->xceiv.last_event = status;
+                       twl->usb_cinlimit_mA = 1800;
                } else {
                        regulator_disable(twl->usb3v3);
                        goto vbus_notify;
@@ -435,6 +437,16 @@ static int twl6030_set_host(struct usb_otg *otg, struct 
usb_bus *host)
        return 0;
 }
 
+static int twl6030_set_power(struct usb_phy *x, unsigned int mA)
+{
+       struct twl6030_usb *twl = xceiv_to_twl(x);
+
+       twl->usb_cinlimit_mA = mA;
+       atomic_notifier_call_chain(&twl->xceiv.notifier, USB_EVENT_ENUMERATED,
+                               &twl->usb_cinlimit_mA);
+       return 0;
+}
+
 static int __devinit twl6030_usb_probe(struct platform_device *pdev)
 {
        struct twl6030_usb      *twl;
@@ -463,6 +475,7 @@ static int __devinit twl6030_usb_probe(struct 
platform_device *pdev)
        twl->xceiv.label        = "twl6030";
        twl->xceiv.otg          = otg;
        twl->xceiv.init         = twl6030_phy_init;
+       twl->xceiv.set_power    = twl6030_set_power;
        twl->xceiv.shutdown     = twl6030_phy_shutdown;
        twl->xceiv.set_suspend  = twl6030_phy_suspend;
 
-- 
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to