diff options
author | Xin Xie <xxie@nvidia.com> | 2012-08-01 16:18:55 -0700 |
---|---|---|
committer | Simone Willett <swillett@nvidia.com> | 2012-08-17 12:13:47 -0700 |
commit | c7f41361bf1ccc58b0e3735f28cf3a8d54602252 (patch) | |
tree | 5f92ed90123fc6e756dbcef70195aaae7940028f /drivers/usb/gadget/tegra_udc.h | |
parent | 1217d0ae77b22e8ac16e4430b020202240a4c788 (diff) |
usb: gadget: tegra_udc: use USB charging spec 1.2
Enable the USB charging based on the USB charging spec 1.2. Now we can
detect:
1. SDP (stanardard downstream port)
2. CDP (charging downstream port)
3. DCP (dedicated charging port)
4. None (no cable connected)
5. Non-standard charger
For some non-standard charger, we cannot detect it as DCP device.
If we find a charger detected as USB device but no EP0 packet recieved
with 1s, we then decided this is 1A charger.
bug 968345
Change-Id: I804f90ea6e4794da8f52b1c3ebd694828d99f40e
Signed-off-by: Xin Xie <xxie@nvidia.com>
Reviewed-on: http://git-master/r/120218
Reviewed-by: Simone Willett <swillett@nvidia.com>
Tested-by: Simone Willett <swillett@nvidia.com>
Diffstat (limited to 'drivers/usb/gadget/tegra_udc.h')
-rw-r--r-- | drivers/usb/gadget/tegra_udc.h | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/drivers/usb/gadget/tegra_udc.h b/drivers/usb/gadget/tegra_udc.h index 50e2a3193648..094e3eb0e458 100644 --- a/drivers/usb/gadget/tegra_udc.h +++ b/drivers/usb/gadget/tegra_udc.h @@ -38,7 +38,11 @@ #define USB_MAX_CTRL_PAYLOAD 64 /* Charger current limit=1800mA, as per the USB charger spec */ -#define USB_CHARGING_CURRENT_LIMIT_MA 1800 +#define USB_CHARGING_DCP_CURRENT_LIMIT_UA 1800000 +#define USB_CHARGING_CDP_CURRENT_LIMIT_UA 900000 +#define USB_CHARGING_SDP_CURRENT_LIMIT_UA 100000 +#define USB_CHARGING_NON_STANDARD_CHARGER_CURRENT_LIMIT_UA 1800000 + /* 1 sec wait time for charger detection after vbus is detected */ #define USB_CHARGER_DETECTION_WAIT_TIME_MS 1000 #define BOOST_TRIGGER_SIZE 4096 @@ -156,6 +160,8 @@ #define PORTSCX_PORT_SUSPEND 0x00000080 #define PORTSCX_PORT_RESET 0x00000100 #define PORTSCX_LINE_STATUS_BITS 0x00000C00 +#define PORTSCX_LINE_STATUS_DP_BIT 0x00000800 +#define PORTSCX_LINE_STATUS_DM_BIT 0x00000400 #define PORTSCX_PORT_POWER 0x00001000 #define PORTSCX_PORT_INDICTOR_CTRL 0x0000C000 #define PORTSCX_PORT_TEST_CTRL 0x000F0000 @@ -397,6 +403,14 @@ struct tegra_ep { unsigned stopped:1; }; +enum tegra_connect_type { + CONNECT_TYPE_NONE, + CONNECT_TYPE_SDP, + CONNECT_TYPE_DCP, + CONNECT_TYPE_CDP, + CONNECT_TYPE_NON_STANDARD_CHARGER +}; + struct tegra_udc { struct usb_gadget gadget; struct usb_gadget_driver *driver; @@ -417,6 +431,7 @@ struct tegra_udc { struct work_struct boost_cpufreq_work; /* irq work for controlling the usb power */ struct work_struct irq_work; + enum tegra_connect_type connect_type; void __iomem *regs; size_t ep_qh_size; /* size after alignment adjustment*/ dma_addr_t ep_qh_dma; /* dma address of QH */ |