Commit Graph

8354 Commits

Author SHA1 Message Date
Jack Pham
261934ea7e usb: diag_bridge: call bridge callbacks even for -EPROTO.
The diagfwd_hsic driver acts as a client of the bridge and must
have its read/write callbacks called so it can properly free its
memory buffers. In the case of the HSIC device being disconnected,
the URB status is -EPROTO but the callback was withheld, which
led to lost buffers when the HSIC device is disconnected. Fix this
by always calling the callbacks, while continuing to treat -EPROTO
as a special case by returning -ENODEV on subsequent reads and
writes. Also fix a major but tiny gotcha in diagfwd's read function
in which the 'err' variable is additionally declared and used in a
local scope but is read outside it.

CRs-fixed: 394401
Signed-off-by: Jack Pham <jackp@codeaurora.org>

Conflicts:

	drivers/usb/misc/diag_bridge.c

Change-Id: Ic40e43555ba557ac0caf3abfd3b8e372eb522003
Signed-off-by: Neha Pandey <nehap@codeaurora.org>
2013-03-07 15:21:41 -08:00
Pavankumar Kondeti
3f6d1669f3 USB: android: Don't disable configuration for every adb close
Certain ADB commands like "adb usb" and "adb root" restart the
adb daemon running on the device.  These commands require USB
bus reset, otherwise adb commands on the host side would stuck
for ever.

USB bus reset can be forced from device side by re-enabling the
same composition.  Earlier, configuration is disabled when adb
daemon closes /dev/android_usb device file.  The configuration
is enabled again after adb daemon opens the device file. This
approach solves the "adb usb" problem with the below side effects.

1. When USB cable is disconnected, the Rx request is flushed and
an error code is returned to user space.  The adb daemon is simply
restarted in this case which cause an unnecessary rebinding of
all functions.
2. The above scenario can happen if host reset the bus when device
is in configured state.  If device disable pull-up during, bus
reset, USB CV CH9 test cases are failing.

The commit d9b1897 (USB: android: Avoid re-enabling the same
configuration) fixed the above side effects. But silently ignores the
original "adb usb" problem.

This commit is another attempt to solve all the above mentioned problems
by forcing re-enumeration only when device is in connected state.  That
means, "adb usb" and "adb root" commands force usb bus reset where as
plugging out a cable does not.

(cherry picked from commit 1aa235a6c0a3d67bff24609766baf5a7d5d8e3e4)

(cherry picked from commit 81fefe664ab6333f05209bed959a599a47baf71f)

Change-Id: Id3a40f62dd51aba6ec690d3326ed67ced32b946a
CRs-Fixed: 407882
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>

Signed-off-by: Neha Pandey <nehap@codeaurora.org>
2013-03-07 15:21:12 -08:00
Vijayavardhan Vennapusa
982a7b99a1 USB: ci13xxx_udc: Fix ENDPOINT PRIME failure issue
while queueing requests to USB HW, waiting till EP PRIME bit
get cleared after setting it leads to wathdog timeout. Fix
this by implementing timer based solution instead of infinite
PRIME check loop.
(cherry picked from commit 9e4a5053b0f25cb18ed394fa517be620db673d44)
(cherry picked from commit dcfe03cd167f1b4916de85ce0a0a5516191741cc)
CRs-Fixed: 397907
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>

Change-Id: Iad7504c77c02870d9fa3b7b9decf13afcf2c9e12
Signed-off-by: Neha Pandey <nehap@codeaurora.org>
2013-03-07 15:21:10 -08:00
Hemant Kumar
2fbb801899 usb: mdm_bridge: Increase the number of rx urbs
Due to higher HSIC interrupt threshold value, sometimes
driver is running short of enough rx urbs queued to HSIC
HW to receive IP packets from mdm device. In this case
driver is busy processing large number of completed rx
urbs and left with fewer pending urbs with HW. This causes
occasional throughput drops on rx data path. Hence increase
number of rx urb from 50 to 100, to keep HSIC HW busy in
pulling data from mdm device while completed urbs are getting
processed.

(cherry picked from commit e8f691f60db39b50951148c3e68ae35c89cdd397)
CRs-Fixed: 397809
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>

Change-Id: I590c203551c5ac83a71b8628d195f2a15840edf1
Signed-off-by: Neha Pandey <nehap@codeaurora.org>
2013-03-07 15:21:09 -08:00
Pavankumar Kondeti
5a30cd21f9 USB: msm_otg: Abort suspend while host mode is activated
ID ground interrupt processing and system suspend can run in parallel.
When Id is grounded, USB is brought out of low power mode(LPM) and state
machine work is run to activate host mode.  While waiting for the VBUS
valid event, device suspend callback is executed from system suspend
context.  The current code put USB in LPM, without activating host mode
completely.  Abort suspend when A_BUS_REQ is asserted which indicate
that host mode is active.

(cherry picked from commit cfe0539e389c52ec6c4d99cf1915d806d42f1abe)

CRs-Fixed: 412841
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>

Change-Id: I9ecd4f55a328d63ddbf0e415a9bcff1158874203
Signed-off-by: Neha Pandey <nehap@codeaurora.org>
2013-03-07 15:21:07 -08:00
Chiranjeevi Velempati
90ae290cfe ehci_msm2: Fix enumeration during PHY suspend failure
PHY suspend fails as part of USB LPM at times. Currently, we are resetting
the PHY and Link during this failure case, but the EHCI stack is not reset
due to which we are seeing device enumeration failure cases. Fix this issue
by removing hcd and adding hcd back during PHY suspend failure.

CRs-Fixed: 382279
Change-Id: I2d69e75409ec2b783dbdd06de4f34fe0356c1c45
Signed-off-by: Chiranjeevi Velempati <cvelempa@codeaurora.org>
(cherry picked from commit ce16958d07cedf2c46c97a9b0088a410c1a464a2)
2013-03-07 15:19:42 -08:00
Pavankumar Kondeti
9e498b8333 EHCI: HSIC: Fail root hub bus suspend when port is not enabled
HSIC controller can not detect HSIC device in low power mode.  Hence
controller suspend is allowed only when port is enabled.  But this
check is done in controller suspend routine.  Controller suspend is
attempted after root hub bus is suspended.  Even if we fail, controller
suspend, root hub bus remains in suspend state.  This would delay
the enumeration of HSIC device as root hub bus resume takes some time.

CRs-Fixed: 396444
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
(cherry picked from commit a723f744025854c7132410fd1699bc0997617fb9)

Change-Id: I30c2117a0a6debfbc98a08610a83b56d5ac75f5b
Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
2013-03-07 15:19:15 -08:00
Eric Holmberg
f0b7c4bc37 u_data_hsuart: Fix high-watermark race condition
If multiple packets are written quickly and the high watermark is
exceeded, then the -EAGAIN return code is returned (A), the return code
is checked and the tx processing is throttled (B) until a low-watermark
notification is received (C).  If the packet queue is drained and the
low-watermark notification is delivered between steps (A) and (B), then
the order of events will be ACB and the tx queue will be permanently
stalled.

To fix this, a spinlock is held to ensure that the sequence is always
ABC.

CRs-Fixed: 404380
Change-Id: I639eda87e115f592a6465f624e611830e6173852
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
(cherry picked from commit e92b15ff084f1aeb9dec2a722c68f3b05f65fffd)
Signed-off-by: Dhivya Subramanian <dthiru@codeaurora.org>
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
(cherry picked from commit 8d0dda8098216754375e994f90fcd1ef5ef36832)

Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
2013-03-07 15:19:13 -08:00
Hemant Kumar
b11f5e3334 EHCI: HSIC: Increase IAA watchdog timeout to 100ms
In order to remove queue heads(QH) from Asynchronous Schedule Interrupt
on Async Advance(IAA) bit is used in USBCMD as doorbell by ehci driver
to handshake with host controller. When the host controller has evicted
all appropriate cached schedule states, then the host controller will
assert an interrupt which indicates ehci driver that it is safe to
modify a removed queue head from the asynchronous list.

EHCI driver walks through the asynchronous schedule list to search for
the QH(say QH1) which needs to be unlinked from HW. It removes QH1 from
the list, sets ehci->reclaim points to QH1 and starts iaa watchdog timer
after setting IAAD bit in USBCMD register. Before getting IAAD interrupt
for QH1, rest of other interface drives can also issue unlinking of their
QHs which get added to the list of QHs to be removed and pointed by
ehci->reclaim. It is possible that IAAD interrupt gets delayed for more
than current watchdog timeout value. This causes watchdog handler to
finish the unlinking process of QH1 with ehci lock held. Unlinking process
ends by setting QH1's next pointer to NULL, ehci->reclaim pointing to next
QH to be unlinked(say QH2) and calling qh_completions() to retire all the
transfer descriptor associated with QH1. qh_completions() releases
ehci->lock in ehci_urb_done(). There is a possibility of controller
asserting IAAD interrupt during this time on other core. After ehci lock
is released, ehci irq handler gets a chance to acquire ehci lock and
execute which results in premature unlinking of QH2, since ehci->reclaim
now points to QH2. QH2 is not yet removed from the asynchronous list and
ehci driver has not initiated IAAD handshake for QH2. Similarly unlinking
ends for QH2 by setting QH2's next qh pointer to NULL, since QH2 is not yet
removed from asynchronous list, this breaks the list. Due to this racing
between IAAD interrupt and watchdog timer interrupt ehci driver loses
track of which IAAD interrupt triggered for which QH. This results in NULL
pointer dereference while searching for subsequent QHs to be unlinked, in
already broken asynchronous list. Hence increase the IAA watchdog timeout
value from 10ms to a higher value of 100ms. Higher timeout value avoids
the race between IAAD interrupt and IAA watchdog handler and allows IAAD
interrupt to finish the unlinking of QH. Watchdog handler is still be
used to take care of scenarios when controller does not generate IAAD
interrupt for some reason (which is rare, but possible).

CRs-Fixed: 396250
Change-Id: Id1deccf834ca1108121c6533e016b9b3f5fc0ff2
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
(cherry picked from commit 8a657de16d301e1bfab7ba69349446720d4a70e3)

Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
2013-03-07 15:19:13 -08:00
Hemant Kumar
d4377caea3 EHCI: HSIC: Handle wakeup interrupt properly during probe
During HSIC probe driver registers the level triggered interrupt
on wakeup gpio. Wakeup irq line is disabled based on the return
status of interrupt registration. There is a possibility that
wakeup gpio is already pulled high after registering the interrupt
which can cause wakeup interrupts to be fired on continuously
without getting chance to disable the irq line. Hence do not
enable wake up interrupt on request irq.

CRs-Fixed: 394540
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
(cherry picked from commit bbcdcbc3f09cc90d4b8fdd607244c3d73c9ae801)

Conflicts:

	drivers/usb/host/ehci-msm-hsic.c

Change-Id: I9b20d54d919333d11201d30513b4111f3fb31df3
Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
2013-03-07 15:19:01 -08:00
Mayank Rana
d7625da37f Rndis: Don't request Host to send aggregated RNDIS packets
Currently MaxPacketsPerTransfer is set to 3 due to which
Windows 7 Host is sending aggregated RNDIS packets. RNDIS driver
is not having de-aggregation support and due to that multi-packet
RNDIS data are not getting decoded properly and those packets are
being discarded. This is leading to degradation in TCP UPLINK
throughput. Hence set MaxPacketsPerTransfer to 1 and accordingly
set MaxTransferSize for accepting 1 RNDIS packet.

CRs-Fixed: 392052
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
(cherry picked from commit e5d2b3da2f8583f7b7625085234309f912a96c14)

Change-Id: I59e5f35084b546d2d72d3f87446f0775f80941b2
Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
2013-03-07 15:18:58 -08:00
Hemant Kumar
14585a7c95 EHCI: HSIC: Add enhancements to debug logging
This change addresses following enhancements to debug
logging:-

1) Add data payload logging which is not currently
supported. This helps to sniff first 32 bytes of data
being sent and received. Data payload logging is
enabled by default. To disable data payload logging:-

echo 0 > /sys/module/ehci_hcd/parameters/enable_payload_log

2) Current urb submission event logging does not cover
root hub submissions, hence move urb submission logging
to hcd driver.

3) Current urb submission event logging does not return
the correct status if submission fails. Hence log the
return status of urb submission.

CRs-Fixed: 393294
Change-Id: Ic7e555e1545ec7d7b0e4042cd35235e0af26fb01
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
(cherry picked from commit 4d50a43dce8645955d8ed739d7a183e62922c721)

Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
2013-03-07 15:18:44 -08:00
Hemant Kumar
83347875ce EHCI: HSIC: Prevent disabling wakeup irq twice
If PM resume and Wakeup irq happen at same time
its possible to disable wakeup irq twice. Prevent
the same by protecting with spinlock

CRs-Fixed: 396895
Change-Id: I3320478d6c770787bc571964f4a38dce6927af63
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
(cherry picked from commit d343c01025fc3bb597fbb60c8fc4369cc17cbf5d)

Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
2013-03-07 15:18:40 -08:00
Pavankumar Kondeti
0b23fad5ab msm: hsic: Disallow processor idle sleep while driving resume signal
HSIC controller should send SOF with in 3 msec after completing
the resume signal.  If processor is in idle sleep state, the timer
interrupt generated by HSIC controller to indicate resume completion
gets delayed.  If the interrupt handler is not run with in 3msec
after resume, the resume sequence is repeated.  Disallow processor
idle sleep to avoid multiple resume cycles.

CRs-Fixed: 397154
Change-Id: Ibc8965ad8bcd94e0b1b1d39b5b2ad8f39cf51095
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
(cherry picked from commit 4f5dc3be7b2b9939bc7a1b9526ccb70d93b53361)

Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
2013-03-07 15:18:39 -08:00
Mayank Rana
30677d03cd Rndis: Add debug support to disable RNDIS Multipacket Feature
This change adds module param which allows to disable RNDIS
Multi-packet Feature (Aggregation support in Downlink path)
as this feature is enabled by default.

To disable use this param before moving to RNDIS Composition:
echo 1 > /sys/module/g_android/parameters/rndis_multipacket_dl_disable

Also counts errors as Rx errors if received RNDIS packets are
not following RNDIS message format as those packets are being
discarded.

Change-Id: I2c99409f689c131cf92c4967235643d001d90773
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
(cherry picked from commit 93df275e337ee68a5561bcf3c8eafdc35d455b81)

Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
2013-03-07 15:18:35 -08:00
Pavankumar Kondeti
fd126d6851 USB: Allow skipping device resume during system resume.
Some buses would like to keep their devices in suspend state during system
resume.  For example HSIC controller driver prevent system suspend when
HSIC device is active.  If this device is resumed, during system resume
HSIC controller acquire wake lock and prevent the subsequent suspend till
HSIC device is auto suspended.

CRs-Fixed: 403975
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
(cherry picked from commit 6f199aa800253a69e5679d1057823039f1bd65c9)

Change-Id: Ic8ab631ec1f15685cc35823aa7c57d699738d5fc
Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
2013-03-07 15:18:22 -08:00
Hemant Kumar
cb803fbbc8 usb: ks_bridge: Fix memory leak in tx data path.
ks bridge is allocating urb to transmit data to mdm.
This urb is not getting freed after transmit completes.
Hence call usb_free_urb() after urb gets submitted
successfully. Urb will eventually be freed after tx
completion.

CRs-Fixed: 401536
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
(cherry picked from commit 1432f6f448bb2231499ef989f9e1ec314e9817d9)

Change-Id: I0ec244b6bff35aa1e59b39735ec867be39c4d221
Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
2013-03-07 15:18:10 -08:00
Hemant Kumar
adc17898aa usb: ks_bridge: Fix bug in partial read on data buffer
If driver copies only partial data buffer to user space
it does not update the buffer pointer. In this case
buffer pointer is still pointing to the already read
buffer and will be copied again in next read request
from user space. This corrupts the contents of the
efs file or ram dump files. Hence update data buffer
pointer with length of memory read completed by user
space.

(cherry picked from commit b48f4737ac62a5c26b59eea59322186179c06ab0)

Change-Id: Ibc2a248394b1fd3ece7cef6a94e99e27dc4f9575
CRs-Fixed: 403250
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
Signed-off-by: Neha Pandey <nehap@codeaurora.org>
2013-03-07 15:17:51 -08:00
Pavankumar Kondeti
1f98b2440e USB: msm_otg: Fix data contact detection issue
Data contact detection (DCD) involves applying small amount of current on
D+ and waiting for it to go low.  The D+ is pulled to low when the data
pins get contacted with the other device data pins.

The current code does not disable D+ pull-down resistor during DCD. If this
resistor is not disabled, the current applied on D+ becomes low immediately
even without connecting to any device.  Fix it.  Remove enable_dcd flag
from platform data as data contact detection is working reliably on all
targets supported by this driver.

(cherry picked from commit 768dcb817554a29b43e269e7cf77785a7f960754)

Change-Id: Idb34508f09dc74983fd2b55bd11f4073ec354e2f
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Signed-off-by: Neha Pandey <nehap@codeaurora.org>
2013-03-07 15:17:50 -08:00
Jack Pham
e752a241b9 usb: msm_otg: schedule state machine only when state changes
While an asynchronous interrupt may wake up the system from low
power mode, the OTG PHY and controller must first be resumed and
then the IRQ enabled. If during this time the state machine is
scheduled, it may prematurely run before the interrupt handler has
a chance to fire and effect a state transition, and may erroneously
lead down the "chg_work cancel" path, which will reset the PHY
right after resuming. After this reset, the system will go back into
suspend thinking nothing happened.

Instead, since the "in LPM" part of the interrupt handler isn't
actually changing state, don't schedule any work just yet. Later,
when the resume callback enables the IRQ, and the interrupt can
occur naturally, any state change that happens as a result will
appropriately schedule the sm_work.

Change-Id: I887546ed18151a303a2efcb16d0c38fd193aa0b2
CRs-Fixed: 387377
Signed-off-by: Jack Pham <jackp@codeaurora.org>
Signed-off-by: Neha Pandey <nehap@codeaurora.org>
2013-03-07 15:17:50 -08:00
Jack Pham
9a9df70ee9 usb: msm_otg: disallow suspend during charging detection
A cable connection could occur as the device is just about to
enter systemwide suspend. This interrupt will kick off the
charging detection algorithm, but the controller could become
suspended and may lead to ULPI timeouts when the PHY is later
resumed. Note that prior to starting charger detection, the
B-session valid state bit is asserted. We can then fix this in
the general case by preventing the controller from suspending
if B_SESS_VLD is set and the bus is not suspended.

Change-Id: I7aa8dc6880b1b3ec0afe7ea0134677bdba1b9e47
CRs-Fixed: 386262
Signed-off-by: Jack Pham <jackp@codeaurora.org>
Signed-off-by: Neha Pandey <nehap@codeaurora.org>
2013-03-07 15:17:49 -08:00
Jack Pham
d3ce7940f2 usb: wwan: Avoid RX URB submission races
Since commit 6f806b8fa362b53f10947c65af2df8d4acb10b61 "usb: serial:
Add flow control between wwan and tty drivers", pushing of received
URB data into TTY has been offloaded into a work queue. Only after
the data is transferred will the URB be resubmitted. This can race
with usb_wwan_resume, which unconditionally submits all the available
IN URBs. Hence the double call to usb_anchor_urb will corrupt the
anchor list, the second submission will fail, and the following
usb_unanchor_urb will result in the list pointing to a now unlinked
URB. Thus portdata->in_urb_list will never be exhausted as it can
never be traversed fully, and the work function will keep attempting
to resubmit the problematic URB over and over again.

Fix this by ensuring that an URB to be submitted is both not already
anchored and its urb_list member is not part of a list, so that it
cannot be submitted multiple times. Also, don't allow the work
queue function to resubmit the URB if the interface is suspended.

Change-Id: Ib660d01a502be917297ba02db90dd0e53e241707
CRs-Fixed: 390847
Signed-off-by: Jack Pham <jackp@codeaurora.org>
Signed-off-by: Neha Pandey <nehap@codeaurora.org>
2013-03-07 15:17:48 -08:00
Jack Pham
f8eb352085 usb: misc: Avoid excessive logging during disconnect
When the device is in the midst of being disconnected, calls to
usb_autopm_get_interface() may fail, and a ERR-level message is
printed. Callers of such I/O functions may repeatedly try calling
again, and could end up flooding the console leading to a watchdog
timeout. Replace these printks with DBG-level messages since the
device disconnection is normal and the errors they indicate are
usually benign.

Change-Id: I03045e866c0b35bd1a698d91c12661c6df660d25
CRs-fixed: 394256
Signed-off-by: Jack Pham <jackp@codeaurora.org>
Signed-off-by: Neha Pandey <nehap@codeaurora.org>
2013-03-07 15:17:48 -08:00
Hemant Kumar
06bc391a32 usb: ks_bridge: Check for received data upon unlinking the urb
There is a possibility of runtime suspend in the middle of
data transfer on the rx data path of driver. This results in
the completion of data transfer on bulk IN endpoint with short
packet or integral multiple of 512 bytes. Hence for -ENOENT
transfer status check for non-zero data length and pass it to
the consumer in the userspace. Also, replace printk with
DBG-level message in driver suspend function and in rx
callback function for -EPROTO urb status.

Change-Id: Id7f9602e61e98f5bbd38c2f2f8121616b5661591
CRs-Fixed: 394954
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
Signed-off-by: Neha Pandey <nehap@codeaurora.org>
2013-03-07 15:17:48 -08:00
Jack Pham
348252e7d9 usb: diag_bridge: Fix NULL pointer crash during disconnect
DIAG I/O could be executing concurrently when the device/interface
is disconnected. In such cases the usb_interface pointer could
become NULL while the read or write functions are about to access
it. Prevent these NULL pointer dereferences by guarding the
pointer with a mutex.

Change-Id: I0e2660dc53dae811e0a8686e69636808281ec53c
CRs-fixed: 393826
Signed-off-by: Jack Pham <jackp@codeaurora.org>
Signed-off-by: Neha Pandey <nehap@codeaurora.org>
2013-03-07 15:17:47 -08:00
Hemant Kumar
f608740082 usb: ks_bridge: Add support for autosuspend
ks bridge driver needs to add support for autosuspend
for 9008 PID. This change allows for the device to be
suspended when there is no active traffic, and USB
remote wakeup is used to signal a resume to the host.

Change-Id: I32d58e441be24fdc2081840de39bd569a2284e20
CRs-Fixed: 397969
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
Signed-off-by: Neha Pandey <nehap@codeaurora.org>
2013-03-07 15:17:47 -08:00
Anh Nguyen
b78236b2d8 use msm8960_defconfig instead of mako_defconfig
Change-Id: I338003dc6cc5127febdbcaa00fc0c8b7e81921cc
Signed-off-by: Anh Nguyen <anguyen@codeaurora.org>
Signed-off-by: Shruthi Krishna <skrish@codeaurora.org>
2013-03-07 15:17:40 -08:00
John Michelau
53b1546ec3 usb: gadget: Multiple ACM gadget instances
- Added multiple ACM instance support in Android gadget
- Fixed multiple instance naming issue in ACM function
- Increased max instances from 4 to 8

Change-Id: I65f1b0be94da859bab7ec0ad7cd804b896c7c4c5
Signed-off-by: John Michelau <john.michelau@motorola.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
2013-03-07 15:17:26 -08:00
Ajay Dudani
49349e96f0 EHCI: Update qTD next pointer in QH overlay region during unlink
There is a possibility of QH overlay region having reference to a stale
qTD pointer during unlink.

Consider an endpoint having two pending qTD before unlink process begins.
The endpoint's QH queue looks like this.

qTD1 --> qTD2 --> Dummy

To unlink qTD2, QH is removed from asynchronous list and Asynchronous
Advance Doorbell is programmed.  The qTD1's next qTD pointer is set to
qTD2'2 next qTD pointer and qTD2 is retired upon controller's doorbell
interrupt.  If QH's current qTD pointer points to qTD1, transfer overlay
region still have reference to qTD2. But qtD2 is just unlinked and freed.
This may cause EHCI system error.  Fix this by updating qTD next pointer
in QH overlay region with the qTD next pointer of the current qTD.

CRs-Fixed: 386914
Change-Id: Idbc41b93674955325c8da445fcb25d189bddddb2
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
2013-03-04 12:48:03 -08:00
Ajay Dudani
1f54f3a174 EHCI: HSIC: Fix race between HSIC runtime resume and remote wakeup
HSIC runtime resume initiated by an interface driver and remote wakeup
gpio interrupt handler can run in parallel. If HSIC runtime resume is
triggered by runtime PM core, pm_runtime_get call will fail in wakeup
interrupt handler.  Check the return code and decrement the PM usage
counter.

CRs-Fixed: 403708
Change-Id: I3108c4aed86723a629a98bdbc461679178727fe5
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
2013-03-04 12:47:54 -08:00
Devin Kim
99073c2147 msm_otg: change the message level about ta_detection
ta detection messages annoy us when device is connected with hdmi.
so change the message level to debug from info.

Change-Id: I31c3e2d082b09be8bf35d8e3ffaea9a5a7fd64e3
2013-03-04 12:47:49 -08:00
Ajay Dudani
a5a1bacb35 USB: ci13xxx_udc: Apply posted writes workaround to control IN endpoint
The controller always does posted writes to transfer descriptors.
A transfer completion interrupt may be generated before dTD is
updated in system memory.  A software workaround is already in
place to give 10usec delay after receiving the completion interrupt
if the first dTD in the queue is still active.  But this delay
is given only for OUT endpoints.  In theory this problem is applicable
to both IN and OUT endpoints. But none of the function drivers indicate
any problem with IN endpoints.  Hence delay is not given for IN
endpoints.

The status phase of a control transfer may get stuck if the above
issue is hit for EP0 IN endpoint.  Hence apply the software workaround
for EP0 IN endpoint.

CRs-fixed: 409573
Change-Id: Ic07a4421c0066645459d2cc566f0df6691084a43
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
2013-03-04 12:47:22 -08:00
taeju.park
18eddfffdd usb: gadget: Handle function control requests before set config
some function drivers receive control requests before configuration is
selected, which are not being handled due to configuratiopn checks in
android gadget driver, which is resulting in stall on control endpoint.
Fix this issue, by removing the configuration checks, so that function
driver control requests are handled properly.

Change-Id: I90975bb6a7c0201de7715932469c603fea6954af
Signed-off-by: Chiranjeevi Velempati <cvelempa@codeaurora.org>
Signed-off-by: Iliyan Malchev <malchev@google.com>
2013-03-04 12:47:06 -08:00
chahee.kim
e82facee16 USB: gadget: f_audio_source: change max ISO packet size
Change it to 256 bytes from 384 bytes.

Most USB-AUDIO devices are limited to 256 byte for max iso buffer size. If a
IN_EP_MAX_PACKET_SIZE is bigger than a USB-AUDIO device's max iso buffer size,
it will cause noise. This patch will prevent this case as possibe by reducing
packet size.  When using 44.1khz, 2ch, 16bit audio data, if max packet size is
bigger than 176 bytes, it's no problem.

Signed-off-by: Iliyan Malchev <malchev@google.com>
2013-03-04 12:47:05 -08:00
Ajay Dudani
d4e24fdbb1 USB: ci13xxx_udc: Set QMULT for ISO endpoints
Currently not setting QMULT for ISO endpoints. Set this
value appropriately  to indicate to the USB controller the
number of transactions to be done in microframe.

Change-Id: If80c003464024f8dfebcda13fefb33744618d043
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>

b/6968587
2013-03-04 12:46:38 -08:00
Ajay Dudani
64e994d018 USB: gadget: f_audio_source: Fix use after free in audio_unbind
When USB was disconnected, we were freeing our audio_dev struct in audio_unbind
before the audio system had cleaned up, resulting in a hang in audio_pcm_close.
We now statically allocate the audio_dev struct to avoid this problem.

Signed-off-by: Mike Lockwood <lockwood@google.com>
Change-Id: I58ad21eaa20dcf4aa74ee614ef3b6ed2c91d52a1
2013-03-04 12:46:37 -08:00
Ajay Dudani
85b68f0e9d USB: gadget: f_audio_source: Fix error handling and increase packet size
Fixes watchdog reset on USB disconnect
Larger packet size fixes performance in fullspeed mode

Signed-off-by: Mike Lockwood <lockwood@google.com>
Change-Id: I495c3c02f965d64538eb8adcd62a12a18a723cef
2013-03-04 12:46:37 -08:00
Ajay Dudani
7e61ab3d1a USB: gadget: f_audio_source: Adjust packet timing to reduce glitches
Increase max packet size and clean up timing logic so we can better
recover from not getting an interrupt in time for a SOF.

Signed-off-by: Mike Lockwood <lockwood@google.com>
Change-Id: Ie0e11853997e7f0c8320e79de3b3de0321c779ca
2013-03-04 12:46:36 -08:00
Ajay Dudani
735f020060 USB: gadget: f_audio_source: New gadget driver for audio output
This driver presents a standard USB audio class interface to the host
and an ALSA PCM device to userspace

Signed-off-by: Mike Lockwood <lockwood@google.com>
Change-Id: Ie20264ac86d21a1b1366491273034b755366d3c3
2013-03-04 12:46:36 -08:00
Ajay Dudani
0b7283e0de USB: gadget: f_accessory: Add support for HID input devices
Signed-off-by: Mike Lockwood <lockwood@google.com>
Change-Id: I4f5722bfa26a0d73419c54709b2f1672491bf56a
2013-03-04 12:46:35 -08:00
Ajay Dudani
c0230fd35b Add ACCESSORY_SET_AUDIO_MODE control request and ioctl
The control request will be used by the host to enable/disable USB audio
and the ioctl will be used by userspace to read the audio mode

Signed-off-by: Mike Lockwood <lockwood@google.com>
Change-Id: I48082ce473eb6577b0bf613be9ec27f2f5c19384
2013-03-04 12:46:34 -08:00
Ajay Dudani
c430f7825c usb: gadget: Initialize non zero ep max packet size to 0xFFFF
usb device controller driver initializes all endpoint's max packet
size to 64 bytes. At the time of function driver bind gadget
framework chooses endpoint by comparing it with endpoint
descriptor of the function driver in ep_matches(). Driver bind
fails for the function driver having isochronous endpoints, as
ep max packet size is less than endpoint descriptor's max packet
size. Hence set ep max packet size to 0xFFFF for non-zero
endpoint which will be set to endpoint descriptor's max packet
size when endpoint is enabled at the time of enumeration.

Change-Id: I9fc0a19bd4502812b8659222d60274ad8b9fef34
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>

b/6968587
2013-03-04 12:46:34 -08:00
taeju.park
9af01d4b75 usb: gadget: prevent change of Host MAC address of 'usb0' interface
On windows 7 platform, previously allocated ip address is maintained.
However, Host MAC address of 'usb0' interface is changed when the
tethering driver re-enumerated. Thus, the tethering network driver
can't be allocated ip address from dhcp. It causes connection delay
between host and phone for usb tethering.

This patch prevents from changing Host MAC address of 'usb0' interface.
In other words, this patch maintains the Host MAC address allocated when
first tethering driver although the driver is re-enumerated. However,
after reboot, the Host MAC address can be changed.

Change-Id: I43add9925e9d6d90c56cffbd3ed999104448f818
2013-03-04 12:46:19 -08:00
taeju.park
a74eef8bc8 usb: gadget: Fix g_ether interface link status
A "usb0" interface that has never been connected to a host has an unknown
operstate, and therefore the IFF_RUNNING flag is (incorrectly) asserted
when queried by ifconfig, ifplugd, etc.  This is a result of calling
netif_carrier_off() too early in the probe function; it should be called
after register_netdev().

Similar problems have been fixed in many other drivers, e.g.:

e826eafa6 (bonding: Call netif_carrier_off after register_netdevice)
0d672e9f8 (drivers/net: Call netif_carrier_off at the end of the probe)
6a3c869a6 (cxgb4: fix reported state of interfaces without link)

Fix is to move netif_carrier_off() to the end of the function.

Change-Id: Idf42a032774d652eeb1acb83df9d90789c10e183

Cc: stable@vger.kernel.org
Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-04 12:46:17 -08:00
Devin Kim
6fab76db75 power: charger: fix for incorrect detection of TA as USB
Change-Id: I81914440b8035e3f376bf75056140197a822d62f
2013-03-04 12:45:52 -08:00
Ajay Dudani
e8cbb4da04 EHCI: HSIC: Pass interrupt threshold value as platform data
Interrupt threshold value is the maximum rate at which HSIC
controller will issue interrupts to processor. Increasing
this value results in fewer interrupts which may save power
as processor has to handle fewer interrupts. Side effect of
increasing this value is higher data latency. For fusion3,
set the ITC(interrupt threshold control) to 5 and default
for other targets. Also, allow ehci stack to set ITC value
per controller basis.

CRs-Fixed: 374661
Change-Id: I0e6bc210679ef211c2850ffbe1dfc80da2f65bf0
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
Signed-off-by: Ajay Dudani <adudani@codeaurora.org>
2013-03-04 12:45:50 -08:00
Devin Kim
3434e4b79a usb: msm_otg: prevent abnormal charging stop when vbus active.
Change-Id: I4525e7a675912066cd3ac8f516ff1c41d7a6243d
2013-03-04 12:45:31 -08:00
jh.koo
222b2e47ee usb: msm_otg: support for slimport charger
msm_otg codes will be used for slimport charger detection.

Change-Id: Ie2179a546366ef24fdd8f738034dae2f00501f28
2013-03-04 12:45:24 -08:00
Devin Kim
469b0bb17c usb: misc: fix that MDM diag not operate after SSR3
This fixes that MDM diag does not operate after SSR3.
HSIC read buffer should be always released even if MDM crashed.

Change-Id: I673117c491507df6b508538e76afe12106d63688
2013-03-04 12:45:20 -08:00
Devin Kim
419c74bd61 power: charger: fix fluctuation between charging and not charging
commit 8126554cf049d13f4dd2d815d86ea289efdc6f3a has fluctuation issue
between charging and not charging. It fixes this issue.

Change-Id: I1cc2f3b51b5c1077b5d317ce324e0ce05a616977
2013-03-04 12:45:01 -08:00