Commit Graph

14 Commits

Author SHA1 Message Date
Hemant Kumar
e97cbb3c23 usb: mdm_bridge: Add support for PID 0x904c
Product Id 0x904c includes DIAG, SER3(System monitor), SER4(EFS sync),
DUN, CSVT, NET1, NET2, NET3, NET4 device interfaces.

Change-Id: Ib762ac92d6db0325fc9a40460f01570198240de3
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
2012-03-05 21:01:06 -08:00
Jack Pham
9b0a0e51c5 usb: mdm_bridge: Fix autosuspend for tethered connections
As ctrl_bridge_write() calls usb_autopm_get asynchronously, ensure that
the HSIC MDM device is out of suspend before attempting to write
control packets. Do this by deferring the URBs if the device is still
suspended and submit them in the resume callback.

In ctrl_bridge_start_read(), before submitting the interrupt URB the
device needs to be active. However, since this function may also be
called from the resume callback, it cannot call usb_autopm_get_interface
synchronously, so move the call to ctrl_bridge_open().

Eliminate ctrl_bridge_stop_read() by anchoring the interrupt and control
URBs along with the other write URBs. This simplifies when we need to
cancel them all en masse. Having them anchored also lets us know they
are in flight to avoid resubmitting them.

Finally, fix the suspend/resume callback functions to not rely on the
bridge being open and instead use the data_bridge's ID field to figure
out which ctrl_bridge device to call. This fixes inconsistent suspend
behavior when the bridge is closed, i.e. when the host tethered USB cable
is disconnected.

Change-Id: I9372f9a880639451b8b687dbb630172d7f5ef2d8
Signed-off-by: Jack Pham <jackp@codeaurora.org>
2012-03-01 13:51:39 -08:00
Hemant Kumar
c72ab2b0ba usb: rmnet: Add timestamps for SKB life cycle in UL and DL directions
This change adds support to keep track of total time spent by a SKB in
UL and DL directions. Timestamps are recorded per SKB for the complete
life cycle at following stages:-

1) Creation: At the time of SKB allocation.
2) Submission: While SKB being submitted to HSIC HW by bridge driver/
   HSUSB Core by rmnet gadget driver.
3) Completion: In completion handler of the driver(bridge driver/
   gadget rmnet driver).
4) Sent: While sending SKB to bridge driver/rmnet gadget driver.
5) Queued: While SKB being queued to HSIC HW by bridge driver/
   HSUSB Core by rmnet gadget driver.
6) Done: In completion handler while freeing the SKB.

debugfs node /sys/kernel/debug/data_hsic_bridge/timestamp represents the
listing of timestamp for last 34 SKBs submitted in UL direction.

debugfs node /sys/kernel/debug/ghsic_data_xport/timestamp represents the
listing of timestamp for last 34 SKBs submitted in DL direction.

Recording of the time stamp is controlled by the module parameter in
rmnet bridge driver and rmnet gadget driver.

To enable the recording of timestamp in rmnet bridge driver
echo 1 > /sys/module/mdm_bridge/parameters/record_timestamp
To enable the recording of timestamp in rmnet gadget driver
echo 1 > /sys/module/g_android/parameters/record_timestamp

Change-Id: I10e7c171eec6a01afbd48328ba006f776370ac92
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
2012-01-24 09:34:43 -08:00
Hemant Kumar
73eff1c7c6 usb: mdm_bridge: Reduce number of interrupts in TX Data Path
Rmnet bridge driver sets IOC bit for every URB having IP
packet data in TX direction. This causes the driver to spend
more time in servicing interrupts which degrades the over all
performance of the driver. Hence reduce the number of interrupts
in TX data path by setting URB_NO_INTERRUPT flag for certain number
of urbs submitted.

Change-Id: I784ffca6d97acffd6eed49f68f0b8c30a9b2f0e4
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
2012-01-24 09:34:21 -08:00
Hemant Kumar
06b7e43aa2 usb: mdm_bridge: Do not submit subsequent tx URBs in case of -EPROTO
When a write callback returns -EPROTO, treat it as if the device is
disconnected and disallow further calls to write. This will allow the
caller to gracefully handle the error until a disconnect event finally
comes and is able to notify the caller via a platform_device removal.

Change-Id: Ic780281cb5486cb5177cd642d244d2451fde1d07
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
2012-01-20 15:34:16 -08:00
Hemant Kumar
184765b479 usb: mdm_bridge: Add rx URBs back to idle rx list if submit_rx_urb() fails
mdm_data bridge driver maintains a list of idle rx URBs. Instead of
immediately freeing the URB upon failure in submit_rx_urb(), which
would decrease the number of available requests, put it back in the idle
rx list to allow for later attempts.

Change-Id: I14c42d25e224a40ebd733c94fe3579156d9e5ab8
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
2012-01-07 06:19:18 -07:00
Hemant Kumar
67a4fd023c usb: mdm_bridge: Add support for PID 0x9001 & 0x9034
mdm_bridge driver currently supports PID 0x9048 for DUN and tethered
rmnet interfaces. Add support to handle multiple PIDs (i.e. 0x9001
and 0x9034).

Change-Id: Id6135d1df282f82c4646af4a0435211c62e87ac7
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
2012-01-06 14:42:17 -08:00
Hemant Kumar
7f23683828 usb: Update PID to 9048 for mdm_bridge, diag_bridge, embedded rmnet drivers
mdm9x15 default composition changed from 0x9001 to 0x9048 to include
new serial interfaces and additional rmnet interfaces. Hence update the
PID for mdm_bridge, diag_bridge, embedded rmnet drivers to support new
composition.

Change-Id: I5c3778ef6b8fddd07d1a0789213e4b289ccc7567
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
2012-01-04 18:45:15 -08:00
Hemant Kumar
fd2d5e53d8 usb: mdm_bridge: Make rx_done queue length check independent of rx throttle
rx_done queue length was checked only when rx throttle condition was true.
rx throttle condition is asynchronous because of which sometimes queue
length value becomes much larger than stop_submit_urb_limit when rx
throttled condition is false. Hence check the queue length irrespective of
the rx throttle condition before submitting the rx urb. Also increase the
stop_submit_urb_limit to same as the flow control enable threshold value
in downlink direction.

Change-Id: I3dd915b04bfe7640a98e40809831a7b45c39dfd7
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
2012-01-02 16:02:44 -07:00
Hemant Kumar
c8a3d316ac usb: mdm_bridge: Add NULL pointer check in data_bridge_write()
Change-Id: I23045294b70f5cfd61aa0bb12f525e721aa34fb0
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
2012-01-02 10:29:47 -08:00
Hemant Kumar
46f9f2482c usb: mdm_bridge: Fix probe return value for unsupported interfaces
Bridge driver probe was returning 0 (success) for unsupported
interfaces. This caused probe for other interface drivers
not getting called. Hence return -ENODEV for unsupported interfaces.

Change-Id: I88fef382d378e4c71488983f134b680e7003be77
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
2011-12-16 11:55:21 -08:00
Jack Pham
b1ad7155c6 usb: mdm_bridge: Fix invalid VID/PID registration
The id_table array passed to usb_register was missing a terminating entry.
This caused this driver's probe function to be called whenever any device
was hotplugged.

Change-Id: I290f0e1d609ffc08b740d736dcbe7fcea339fb88
Signed-off-by: Jack Pham <jackp@codeaurora.org>
2011-12-07 11:04:52 -08:00
Jack Pham
a7c9267ba7 usb: mdm_bridge: Fix NULL pointer check logic
Change-Id: I81f88a1c5bd47611e7baca2bf87f9a92f2a276b3
Signed-off-by: Jack Pham <jackp@codeaurora.org>
2011-11-30 13:37:35 -08:00
Hemant Kumar
14401d53af usb: Add network bridge host driver for dun and rmnet
This host driver will be used to communicate with modem devices
with dial up network and RMNET interfaces. This driver works as
a bridge to pass control and data packets between the modem and
peripheral usb gadget driver. Driver currently supports
modem devices (vendor ID 0x05c6) with PIDs 0x9001

Change-Id: Id85b552b39d061528a1c3c90a354d73580c9b631
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
Signed-off-by: Jack Pham <jackp@codeaurora.org>
2011-11-29 14:25:24 -08:00