diff options
author | Rohith Seelaboyina <rseelaboyina@nvidia.com> | 2013-02-05 16:00:24 +0530 |
---|---|---|
committer | Riham Haidar <rhaidar@nvidia.com> | 2013-02-08 16:55:55 -0800 |
commit | 6dcd17d9bb08984aa4458ba5894a45ed4021c450 (patch) | |
tree | 4d1382bcaaec41681e0d84546f5ed72356a92d6f /drivers | |
parent | 1db44611dc6fcf254e13a092ce7c9fc86b7276c4 (diff) |
usb: gadget: tegra: Add USB NV Charger Support
Add Support for NV charger and set correct current limits
for nv charger and non standard charger.
Bug 1225941
Change-Id: I3e9e6749e6df1929f961133e724602ffa0ded63d
Signed-off-by: Rohith Seelaboyina <rseelaboyina@nvidia.com>
Reviewed-on: http://git-master/r/197382
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Venkat Moganty <vmoganty@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/gadget/tegra_udc.c | 8 | ||||
-rw-r--r-- | drivers/usb/gadget/tegra_udc.h | 2 |
2 files changed, 7 insertions, 3 deletions
diff --git a/drivers/usb/gadget/tegra_udc.c b/drivers/usb/gadget/tegra_udc.c index 6826e0b62ac6..aa910654cc3f 100644 --- a/drivers/usb/gadget/tegra_udc.c +++ b/drivers/usb/gadget/tegra_udc.c @@ -1416,7 +1416,8 @@ static int tegra_vbus_session(struct usb_gadget *gadget, int is_active) } /* start the controller */ dr_controller_run(udc); - tegra_usb_set_charging_current(udc); + if (udc->connect_type != CONNECT_TYPE_SDP) + tegra_usb_set_charging_current(udc); } return 0; @@ -1436,7 +1437,7 @@ static int tegra_vbus_draw(struct usb_gadget *gadget, unsigned mA) udc = container_of(gadget, struct tegra_udc, gadget); /* Do not set current limits for CDP ports */ - if (udc->connect_type != CONNECT_TYPE_CDP) { + if (udc->connect_type == CONNECT_TYPE_SDP) { udc->current_limit = mA; schedule_work(&udc->current_work); } @@ -1796,6 +1797,9 @@ static void setup_received_irq(struct tegra_udc *udc, return; case USB_REQ_SET_ADDRESS: + udc->connect_type = CONNECT_TYPE_SDP; + tegra_vbus_draw(&udc->gadget, + USB_CHARGING_SDP_CURRENT_LIMIT_UA/1000); /* Status phase from udc */ if (setup->bRequestType != (USB_DIR_OUT | USB_TYPE_STANDARD | USB_RECIP_DEVICE)) diff --git a/drivers/usb/gadget/tegra_udc.h b/drivers/usb/gadget/tegra_udc.h index d90d4624e941..a6ff9d4e9777 100644 --- a/drivers/usb/gadget/tegra_udc.h +++ b/drivers/usb/gadget/tegra_udc.h @@ -42,7 +42,7 @@ #define USB_CHARGING_CDP_CURRENT_LIMIT_UA 1500000 #define USB_CHARGING_SDP_CURRENT_LIMIT_UA 100000 #define USB_CHARGING_NV_CHARGER_CURRENT_LIMIT_UA 2000000 -#define USB_CHARGING_NON_STANDARD_CHARGER_CURRENT_LIMIT_UA 1800000 +#define USB_CHARGING_NON_STANDARD_CHARGER_CURRENT_LIMIT_UA 500000 /* 4 sec wait time for charger detection after vbus is detected */ #define USB_CHARGER_DETECTION_WAIT_TIME_MS 4000 |