[RFC PATCH 6/6] twl6030: set charger current to be used by battery charging module

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Balaji T K <balajitk@xxxxxx>

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 <balajitk@xxxxxx>
Signed-off-by: Kishon Vijay Abraham I <kishon@xxxxxx>
---
 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 majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux