The spoof disconnect workaround puts PHY in non-driving mode after
pull-up is disabled. Some times pull-up is not getting enabled when
PHY is in non-driving mode. As this workaround is not applicable for
28-nm PHY, remove it.
CRs-Fixed: 302394
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
ITC (Interrupt Threshold Control) field is to set the maximum rate at
which the device controller will issue interrupts. The maximum interrupt
interval is measured in micro frames. Valid values are 0, 1, 2, 4, 8, 16,
32, 64. The default value is 8 micro frames. Set ITC to zero for MSM to
gain performance.
Change-Id: Idc383ffc9bc48b3681304b0f83e17a4cd39fb138
Signed-off-by: Anji jonnala <anjir@codeaurora.org>
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Currently driver supports multiple com ports over single transport
layer. Add support to support multiple com ports over multiple
transport layers
Change-Id: I43f88b3f809eff8f99d73be86ff8bbd550cdff2f
Signed-off-by: Vamsi Krishna <vskrishn@codeaurora.org>
As a part of comp switch serial driver may queue the request
during serial unregistration, since serial unregistration is not
happening in atomic context.
Add variable to maintain serial driver state and verify that
variable before queuing the request.
Signed-off-by: Anji Jonnala <anjir@qualcomm.com>
Add interrupt endpoint support to send modem notifications to USB Host.
Add communication class descriptors to enumerate the function as a modem
Add Communication device class requests to configure modem line
settings.
As a part of call management, device needs to send modem events
(Ring Indicator and Carrier Detect) to host through interrupt
endpoint. Add support for Ring Indicator and Carrier Detect events
in f_serial.
Similarly, route modem control information (DTR and RTS) to upper
layers through TTY tiocmget API in f_serial.
provide CONFIG option to enable generic serial as a part of android
gadget.
provide CONFIG option to include MODEM functionality in the generic
serial driver.
Signed-off-by: Jonnala, Anji <anjir@qualcomm.com>
As part of the USB MSCV testing, the host issues random commands and
expects the device to respond, but the device is not able to respond to
these commands, since the endpoints are not enabled due to the thread
latency and hence the compliance testing is failing.
Hence enabling/disabling the endpoints in interrupt context.
Change-Id: I27ad5875a3bde9a480866173d18cc3292c4af969
Signed-off-by: Chiranjeevi Velempati <cvelempa@codeaurora.org>
nofua flag allows user to control ignore syncing data on to
media during write SCSI command though host has set the FUA bit,
when nofua flag is set.
As part of prevent allow SCSI command, all the data at filesystem
layer is synced to media and this is taking longer time for slow
media(class 2, class 4) and hence usb is re-enumerating. Hence,
avoid syncing data to media if nofua is set.
Change-Id: I562f05d6c0b8046e8a23a4df85385efc23aa364b
Signed-off-by: Rajkumar Raghupathy <raghup@codeaurora.org>
Implementing the csw hack feature & increasing the number of
buffers used in mass storage to 4.
As per the mass storage protocol, csw is sent from the device
after successfully writing the data on to storage media, where
there is a time factor involved. With this csw hack, csw is sent
just after receiving the data & before writing the data on the
storage media. By, any chance, if the write fails, the corresponding
lun is removed to indicate the user of write failure.
Buffers has been increased to 4, so that there is enough space for
the incoming data, which is usually 64KB per CBW.
User has the option of selecting/deselecting this feature from
the kernel config.
Signed-off-by: Velempati Chiranjeevi <c_cvelem@qualcomm.com>
This patch adds support for populating the read/write performance values
for debugging the Mass storage performance numbers at VFS level.
To check the read/write values, user needs to invoke below command
cat /sys/devices/platform/usb_mass_storage/lunX/perf
To reset the read/write values to zero
echo 0 > /sys/devices/platform/usb_mass_storage/lunX/perf
Change-Id: Ied51969ce144a2335d2140259e28e8acbda44635
Signed-off-by: Chiranjeevi Velempati <cvelempa@codeaurora.org>
Signed-off-by: Rajkumar Raghupathy <raghup@codeaurora.org>
For android builds we disable the check for curlun->prevent_medium_removal.
Instead we let the framework manage unmounting policy, as we sometimes need
to unmount after the media has been removed.
This also helps support hosts that do not inform the device when the media
has been unmounted.
Signed-off-by: Mike Lockwood <lockwood@android.com>
OTG drivers that use USB core functions like usb_add_hcd, usb_remove_hcd,
etc can be selected for gadget only mode without selecting CONFIG_USB.
Change-Id: Ie4b0c1703622cc9051ad9f50b8901f0005daeeb6
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Two zero length packets are sent by the target in the current scenario:
1. From the device controller driver (as the req->zero flag is set if
it is the last packet).
2. From the u_serial driver when the length of the packet is zero while
checking for the next packet in the list.
Hence removing the code for the case1, as the zero length packet is
sent via u_serial function driver.
Change-Id: Ifc1bc9cf8435149534c271343ea7ef64b9ed4d4a
CRs-Fixed: 350179
Signed-off-by: Rajkumar Raghupathy <raghup@codeaurora.org>
The usb requests allocated during gs_open() were freed only as a part of
usb disconnect previously. So freeing the usb requests as a part of
gs_close() helps to free the requests on every network disconnect also.
Change-Id: I6edcab3cba94902ea3cb1a043403c93afa8c9d52
Signed-off-by: Rajkumar Raghupathy <raghup@codeaurora.org>
serial driver is dropping the spinlock while queuing the requests and
accessing the port_usb pointer to free the requests upon queue failure.
cable disconnect interrupt can make port_usb NULL which leads to crash
in start_io function while freeing the queue failed requests.
check the port_usb pointer in both RX/TX path and free the queue
failed request immediatly which fixes the crash and traversing the
entire list to free the queue failed requests.
CRs-fixed: 269124
Change-Id: I36eea888d9cf209d181c200255dd1a6a592fc6a7
Signed-off-by: Chiranjeevi Velempati <cvelempa@codeaurora.org>
If low_latency flag is set tty_flip_buffer_push() API push the data
to line discipline in the same context. When line discipline buffer
reaches above/below threshold throttle/unthrottle. TTY use termios
mutext to serialize throttle/unthrottle methods. Replace tasklet
with work queue so that TTY can acquire mutex. A dedicated worker
thread is created for achieving good throughput.
Change-Id: I1ebbe1c9fee5591dace18940fb5c8716829f2dd2
Signed-off-by: Pavankumar Kondeti <pkondeti@qualcomm.com>
Increases Tx/Rx buffers to 8x4k inorder to pump more data
to userspace.
Change-Id: I8d7bf16ab7a0058f001b58b140afd33481bec618
Signed-off-by: Anji Jonnala <anjir@qualcomm.com>
Add support to DIAG and serial functions to send the zlp packet
if the transfer ends with multiple's of maxpacket size
CRs-fixed: 213416
Signed-off-by: Velempati Chiranjeevi <c_cvelem@qualcomm.com>
kernel throws Possbile dead lock at f_serial completion handlers,
if we use plain spinlock which dont disables interrupts.
To avoid this use spinlock_irqsave instead of plain spinlock
which disables interrupts.
Signed-off-by: Anji Jonnala <anjir@qualcomm.com>
The debugfs used in u_serial driver provides the information of the number
of bytes transferred between host and tty and dtr flag status using
the readstatus command.
Change-Id: I761aaedf1693944b8c7bf7e207e1f271d1b48a98
Signed-off-by: Rajkumar Raghupathy <raghup@codeaurora.org>
For dual speed gadget, with current no. of request(10), there is
possibility of corner case occurence where all 10 reuqests are queued
to HW without setting IOC bit, which could lead to data stall in
RNDIS tethering and RNDIS local networking.
With this patch, counter will be incremented before queueing request to
HW and sets IOC bit for every nth request due to which the corner case
of all requests queued to HW without IOC bit set will be avoided.
CRs-Fixed: 340995
Change-Id: I95a252e6f54650fa8c1f263ab820caf5acd949a5
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
gether_disconnect() is always called before gether_connect() by the different
USB ethernet functions, so this warning was firing during normal operation.
Change-Id: I178cc7d1f67e9e87ac2e99c6674c4db8fcddf4a0
Signed-off-by: Mike Lockwood <lockwood@android.com>
Don't reset next_string_id every time the gadget is enabled, this makes
the next strings allocated overwrite strings allocated at probe time.
Instead, fix rndis not to allocate new string ids on every config bind.
Change-Id: Ied28ee416bb6f00c434c34176fe5b7f0dcb2b2d4
Signed-off-by: Benoit Goby <benoit@android.com>
Currently if USB composition switch happens while file transfer is
happening either from/to device, ep_queue fails and sets device state
to ERROR even if device state is already set to OFFLINE in function
disable call.
As part of ioctl call, if the state is not offline, moving the device
state to READY and returning the error. Since the device state is marked
as READY, the next write call tries to queue the request to hardware and
is blocked and due to this, userspace is not calling the release function.
Hence next mtp open fails even after cable reconnection.
CRs-Fixed: 360409
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
Change-Id: Ia8cbd1cd8c81b90389900b83744b2bed89068db5
If the Host sends CANCEL request when an OUT request is queued,
the mtp_driver should dequeue the request and report the userspace about
the request CANCELLATION. As the mtp_read doesn't wakeup from the thread
which is expecting for the read completion, wakeup the thread using the
state change which occurs as a part of CANCEL request.
Also, when the request is dequeued and so mtp receives read completion
status as error, it moves the state to ERROR. Due to this the application
is not reported about the request cancellation for the next IN(mtp_write)
transfer as the state is not updated from STATE_ERROR to STATE_CANCELED.
So mtp_write proceeds queueing the IN requests for the corresponding sync
which are not processed by the Host and so the transfers initiated later
are observed as error in the HOST side.
So dequeue the OUT(mtp_read) request, if the driver receives a REQ_CANCEL
prior to read completion on mtp_read & update the state to STATE_CANCELED.
CRs-Fixed: 337676
Change-Id: I2cd9780f8b3e0ce541472c4d25c8294f11a45d76
Signed-off-by: Rajkumar Raghupathy <raghup@codeaurora.org>
autoconfig of out endpoint is being done twice for mtp driver.
Hence, removing the duplicate code of autoconfig of out endpoint.
CRs-Fixed: 339985
Change-Id: I677462999d0bcc1387aafe4c068e09fda5df15f6
Signed-off-by: Chiranjeevi Velempati <cvelempa@codeaurora.org>
Use atomic operations to read/write online and error flags. Add
SMP barriers for ensuring that online flag is set and accessed only
after endpoints are configured.
Signed-off-by: Pavankumar Kondeti <pkondeti@qualcomm.com>
WARNING: drivers/usb/gadget/g_android.o(.text+0x323e4): Section
mismatch in reference from the function acc_function_bind() to
the function .init.text:T.2968()
The function acc_function_bind() references
the function __init T.2968().
This is often because acc_function_bind lacks a __init
annotation or the annotation of T.2968 is wrong.
Change-Id: Ic93f1dd8fcfdc4d87fe19811122b46c5bb0e1bc2
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Since f_serial is now checking if the endpoint descriptors are
null in the set_alt function, need to set them to null on
ep_disable in case of cable disconnect.
Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Ido Shayevitz <idos@codeaurora.org>
req->legth is set as 0 before calling individual function driver's
setup routines. Hence, check for the buffer length in composite_setup
only.
Also, change max buffer size to 4k to accomodate our descriptors.
Change-Id: Ic96408210e7e5576928a7147d2d8a57fa620d287
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
If gadget is OTG capable, respond to a GetDescriptor(OTG) request
with its OTG descriptor. This patch adds a utility to function
to find and fill the requested descriptor.
Change-Id: I5b3624b1145d46179b0c4737e82a47c68604cab4
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
Add support in HSIC peripheral(device).
Only one USB core can be use - currently
HSUSB is enabled by default.
To enable HSIC core defconfig file should be changed.
Change-Id: I02413658e28f799de2a083db7847fb8b01d04eac
Signed-off-by: Ofir Cohen <ofirc@codeaurora.org>
This field is used by the Gadget drivers to specify
the maximum speed they support, meaning: the maximum
speed they can provide descriptors for.
The driver speed will be set in consideration of this
value.
[ balbi@ti.com : dropped the ifdeffery ]
Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
[idos@codeaurora.org: added max_speed also to android.c]
Signed-off-by: Ido Shayevitz <idos@codeaurora.org>
Free the allocated buffer after an error and remove
unused variables.
CRs-Fixed: 313681
Change-Id: I76ebf946eacac47682a3c510cd7beed3fc3c6437
Signed-off-by: Rajkumar Raghupathy <raghup@codeaurora.org>
Following command needs to be given to enable SERIAL
transports. This has to be done once before selecting serial
function.
For TTY-DUN, TTY-NMEA:
echo tty,tty >
/sys/class/android_usb/android0/f_serial/transports
For SDIO-DUN, TTY-NMEA:
echo sdio,tty >
/sys/class/android_usb/android0/f_serial/transports
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
Conflicts:
arch/arm/mach-msm/include/mach/usb_gadget_fserial.h
This USB CCID function driver will be a transport layer between
the userspace CCID component and the Windows Host. Data and control
commands from the Windows Host will be sent to the userspace component
and vice-versa.
Change-Id: I7f8084bff7c4faa46ef24d7bf2e773ccf5ebe9f3
Signed-off-by: Chiranjeevi Velempati <cvelempa@codeaurora.org>
This driver implements Mobile Broadband Interface Model protocol.
Control messages are transferred through QBI module
running in user space and communicating with mbim
using file operations interface android_mbim.
Data is transferred on SPS, Bam-to-Bam.
Change-Id: Ifc4b3f7e21b1a0dac377af272f9ae922ec9c7e2e
Signed-off-by: Anna Perel <aperel@codeaurora.org>
Include OTG descriptor in configuration when gadget is
capable of OTG. SRP and HNP capablities are exposed for now.
This patch will help to inform USB Host that our device
is OTG capable via configuration descriptor.
Change-Id: Idc72ee8168a478f0124c91b99d3123eab5e71adb
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
The maximum current draw was hard coded to 500 mA. composite.c
has code that uses CONFIG_USB_GADGET_VBUS_DRAW to set the
bMaxPower and to set whether or not the device is self-powered if
they haven't been set. This change removes the code in android.c
to allow composite.c to set them.
Change-Id: I9db37922e91ee86e9e5c0e14519e119e5c41ca48
Signed-off-by: Scott Anderson <saa@google.com>
USB device can specify remote wakeup capability in the configuration
descriptor. Host may select remote wakeup feature before suspending
the device. Remote wakeup capability is disabled by default in
android gadget. Provide sysfs file for enabling remote wakeup capability.
User space can enable/disable this capability based on the selected
composition. This will also allow testing suspend/resume chapter 9 tests
with remote wakeup enabled.
Change-Id: Ib24aa6c05ace697564ebe5940e62e8f65db4d7c3
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Some userspace modules, e.g. MTP, work correctly only if
CONFIGURED uevent is preceded by DISCONNECT uevent. Hence,
explicitly send DISCONNECT uevent if missed out due to
really quick enumeration by USB Host.
Also, wait for some time before sending out CONFIGURED uevent
to give function drivers a chance to wakeup userspace threads
and notify previous disconnect.
Change-Id: I231b8de60b25a05e2316074b8694c9cbc15bb556
CRs-Fixed: 348066
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
To enable better power management and entering CPU idle states while
USB cable is connected and no USB SW involvement is required
(MSM BAM2BAM mode) a new SysFS was added.
This SysFS allow controlling USB voting and gives the ability
to save power consumption while USB is active.
default behavior is high QoS. to change the new SysFS
echo high/low to /sys/class/android_usb/android0/pm_qos
Change-Id: Ia73491cfddc3968e1d04423a1750c89fab5fefeb
Signed-off-by: Ofir Cohen <ofirc@codeaurora.org>