Starting kernel 3.0, all USB function and transport drivers are
compiled in the kernel and user can enable the required functions/
transports using sysfs attributes. Hence, remove the unused
Kconfig option which is no longer used anywhere.
Change-Id: I9ac9e14c2dd95827f7e0fd48393a24552cd980d1
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
Some USB cores have a separate IRQ line for issuing ASYNC
interrupts in LPM. This interrupt needs to be enabled only
when hardware is put in low power state.
Change-Id: Ie7de237ccbaa90294b20d3fce594ec280cb1641a
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
Since the wakelock was removed, an interrupt coming during the
transition to system suspend relies on pm_stay_awake() to indicate
that the controller's wakeup source is now active. However, this
depends on pm_save_wakeup_count() to be called by the process
that initiated the suspend. The forthcoming autosleep feature will
be doing this.
But until autosleep is implemented, for robustness additionally
introduce a .suspend_noirq callback which checks for pending
interrupts and returns -EBUSY if there are any, which will force
the PM core to unwind its suspend actions.
Change-Id: If286d654b667d00a0130accb7a783258901ff760
Signed-off-by: Jack Pham <jackp@codeaurora.org>
It is observed that sometimes msm_bus voting upate API taking
longer time to return which delays the HSIC resume sequence
which is time critical.
CRs-Fixed: 388430
Change-Id: I5ad93ee4bbea2b83dad8cc5c8ece8b72ee433d9f
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
There is a corner case in the tty driver where the value of
tty->receive_room is not being updated before writing data to
the line discipline. When this happens, data is lost because
of failure to re-submit any remaining data to the ldisc.
This fix is dependent on a new tty flag that is set only when
the tty driver is used for efs sync betweem the mdm modem and
the applications processor.
CRs-Fixed: 358868
Change-Id: I0ba02980504b4d8187b8c83111c2c883d194efa2
Signed-off-by: Joel King <joelking@codeaurora.org>
When notify packet transfer failed, notify_count and cpkt_resp_q
would go out of sync. After the fix the packets are also removed from
the queue.
Change-Id: If33ea5070f460617179a77063a9e58c47ed93167
CRs-Fixed: 383661
Signed-off-by: Anna Perel <aperel@codeaurora.org>
Low power mode is not supported as of now on targets which are
using device tree. Revert this later when support is in place.
Change-Id: I05d6089d037312a0e719f4263093bde730c3a8ad
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
Allow to USB clocks to remain on only for bus suspend case, but turn
off clocks for any other case, such as cable disconnect.
CRs-Fixed: 378955
Change-Id: I4d85b645cfd231126fbc160a0c14273066ce674c
Signed-off-by: Ido Shayevitz <idos@codeaurora.org>
When auto suspend happens in host mode, a_bus_req is dropped to allow
low power mode. This input should be asserted again when the attached
device initiates remote wakeup or resume happens from host side. The
current code is not asserting a_bus_req in case of remote wakeup from
device during system suspend. Fix the issue by asserting it in case of
remote wakup from device.
CRs-Fixed: 380384
Change-Id: I62e6549b777f6525d3f031a3f38a24c6d80e8a97
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
When otg_control is set to OTG_PHY_CONTROL and PMIC interrupts are
not used for VBUS notification, a cable connection will fail to
wake up the device from VDD minimized low power mode. The MPM needs
to be configured to wake up the system when the USB_PHY_OTGSESSVLD
interrupt is triggered. As this interrupt may vary by SoC populate
it in the msm_otg_platform_data->mpm_otgsessvld_int member in the
various board files.
CRs-fixed: 376740
Change-Id: Ia54828f538c695ff6b28f5d7b2b49630a45cc673
Signed-off-by: Jack Pham <jackp@codeaurora.org>
In some cases of system suspend, it's possible a runtime resume
may be called on a device if it's already autosuspended (say, in
order to set a device- or port-specific feature, such as the remote
wakeup setting) just prior to putting it back into low power mode.
In this case, if the controller was also auto-suspended it will also
be temporarily runtime resumed by the fact that it is an ancestor to
said device.
The incoming wakelock re-implementation from Google based on wakeup
sources breaks this driver in the above scenario since now acquiring
a wakelock (which calls __pm_stay_awake) during runtime resume while
a simultaneous asynchronous suspend callback of another device is
called will cause it to abort the entire suspend attempt.
This prompts reconsideration of why a wakelock is needed in this
driver. One apparent use is to ensure this controller's runtime
suspend is called before system suspend is allowed. In other words,
we wish to guarantee the HSIC child devices are suspended before
suspending the controller. This can be done by checking that the root
hub device is suspended, else we can abort the suspend callback by
returning -EBUSY.
To handle the cases of interrupts happening during systemwide suspend
but after the controller was already suspended (and thus its runtime
PM disabled), call the pm_stay_awake() to denote a wakeup event. This
will cause the suspend to abort as well as block it from happening
until the interrupt can be serviced--after the controller resumes.
Change-Id: I4fab47c54f7d57065833d96261de08dcdd7238dc
Signed-off-by: Jack Pham <jackp@codeaurora.org>
QDSS function driver currently works only with DWC3
core which uses DBM APIs for bam2bam mode of opearation.
Allow this driver to work with CI gadget by determining
the type of gadget it is operating with (DWC3 or CI) at
runtime and then submit the usb_request accordingly.
Change-Id: I2f0ce4092e55c6d2cabbfcc74251637a540be61f
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
The QDSS function driver supports high throughput debug information
delivery from the QDSS core to the host via the USB port.
Change-Id: Ia9397944d39d767c1200ad87aac67d5627233282
Signed-off-by: Shimrit Malichi <smalichi@codeaurora.org>
Due to some issue with older USB PHYs, USB h/w requires to be
RESET everytime cable is diconnected. Avoid this on 8974's
USB core which doesn't have this issue.
Change-Id: I918492032de6d65eaba7c9b656c700d4f443aa99
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
Move to the new clk_prepare/unprepare APIs.
Change-Id: I2991eaedab5e3c3dc974d035bd56d510ae026794
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
u_ether driver passes rx data to network layer and resubmits the
request back to usb hardware in interrupt context. Network layer
processes rx data by scheduling tasklet. For high throughput
scenarios on rx data path driver is spending lot of time in interrupt
context due to rx data processing by tasklet and continuous completion
and re-submission of the usb requests which results in watchdog bark.
Hence move the rx data processing and usb request submission to a
workqueue bottom half handler.
CRs-Fixed: 382768
Change-Id: I4788b3d67f7aeeb005655c16b313653e939da79c
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
This feature allows defining more than one configuration to an android
usb gadget. This is important if we want our device to be compatible
with different kinds of host PCs. For example Windows host or Linux host.
Each host can select the configuration it supports from the several
configurations that our device exposes.
In order to define more then one configuration in a composition,
use the functions sysfs attribute of the android gadget, by using
a ':' character to separate between the configurations.
For example: echo "rndis,adb:ecm" > android0/functions
Using this feature there is one restriction, each usb configuration should
include different set of function drivers so a function driver cannot
appear in more then one usb configuration at the same time.
Change-Id: Id8ca2ee3dcc3257bc56cc7b7b8a9ecbbd6316d45
Signed-off-by: Ido Shayevitz <idos@codeaurora.org>
Currently as part of host bus suspend handling, voting for
XO shutdown and VDD minimization due to which devices connected
to HSUSB 3rd instance will not wakeup the system from system suspend.
Add support for USB remote wakeup feature for detecting devices
connected on HSUSB 3rd instance in case of VDD minimization provided
HW rework for routing D+ line to MPM is implemented.
CRs-Fixed: 380386
Change-Id: Ie8560b99c51efc466dfd257747bbf38bec6e6ba0
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
kickstart bridge driver will be used to download boot images
to mdm, ram-dumps and efs sync.
Change-Id: Id35e2da664ebf4a16c84d6fb67fbf38a2855356a
Signed-off-by: Vamsi Krishna <vskrishn@codeaurora.org>
Add USB bam changes to support QDSS in msm-8794.
Main additions:
Support device-tree files.
Add disconnect bam pipe support.
Add new API to retrieve pipe connection: get_bam2bam_connection_info.
Change-Id: I200d44dee319b8a9efda31b238c99202efddaa07
Signed-off-by: Shimrit Malichi <smalichi@codeaurora.org>
After disabling the endpoint need to mark driver_data of that
endpoint as NULL, else cannot claim the same endpoint during
composition switch.
CRs-fixed: 381861
Change-Id: I8b008d288c110d0feee820557aab3fcb869b5972
Signed-off-by: Chiranjeevi Velempati <cvelempa@codeaurora.org>
Currently while queueing requests to HW, waiting in infinite
loop till ATDTW bit set for HW semaphore to be released by HW
to avoid race conditions between HW and SW. This could lead to
watchdog timer expiry if bus infrastructure is stuck. Hence
convert this loop into finite loop of 100msec which is atmost
required for USB HW to release HW semaphore as per HW team.
CRs-Fixed: 368769
Change-Id: Ibb2ab281f22230cf40574554273c3e4faf453b50
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
Currently control port resources are not being freed up as part of
port disconnect due to wrong control port structure name being used.
Fix this issue by using the correct control port structure.
Change-Id: I648e556ca45aeb53d4b2c637bc4f38833c0a4a5b
Signed-off-by: Chiranjeevi Velempati <cvelempa@codeaurora.org>
New function driver to support RNDIS with adaptions to
QCOM chipsets (Data path is over SPS BAM-to-BAM).
CRs-Fixed: 361085
Change-Id: I90dcb52e4a4fe939e2150e89d794aaddac4392f5
Signed-off-by: Ofir Cohen <ofirc@codeaurora.org>
Upon autosuspend-delay expiration for the device, runtime pm thread
initiates run time suspend after checking device's power.last_busy
time. There is a possibility of race condition between this check
and device interface driver updating power.last_busy time which
results in interface suspend in the middle of ongoing transfer
on that interface.
CRs-Fixed: 381765
Change-Id: I1fc4f8d9d9e83ef3ef6c564ee76294a703230fad
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
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.
CRs-Fixed: 382161
Change-Id: I72407e8879b6b3b7a9456c1234eec71970272495
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
The MODEM requires RTS to be cleared for RmNET use case.
The original code clear all SMD tiocm bits upon USB connection.
This fix leaves the RTS bit set, which is the SMD default.
Change-Id: Ie3aaa285c9a1598dfd7408f062ea7af2f391a7dd
CRs-Fixed: 370682
Signed-off-by: Amit Blay <ablay@codeaurora.org>
New function driver to support Standard ECM with adaptions to
QCOM chipsets (Data path is over SPS BAM-to-BAM).
Standard ECM function was added to android gadget.
CRs-Fixed: 358338
Change-Id: Ic1ed2f7ee7ac50601ba5dc43d06c28bffe2c5c23
Signed-off-by: Ofir Cohen <ofirc@codeaurora.org>
This utilities is based on Ethernet-over-USB link layer utilities and
contains QC specific implementation (using SPS BAM-to-BAM for data
channel).
Change-Id: Iec417b4df57c34d1ba9368495c7a489c36ddf6dc
Signed-off-by: Ofir Cohen <ofirc@codeaurora.org>
Updating diag include file to avoid using mach/msm_hsusb.h which is
deprecated, and update u_bam to include this file as well.
Change-Id: Ia61accc65eb86fe750c3be6dcb0726e480becdae
Signed-off-by: Shimrit Malichi <smalichi@codeaurora.org>
To operate correctly, USB core requires to be reset clearing
any initialization settings performed by other components
e.g. bootloader during bootup.
MSM platforms support two kinds of hardware resets:
1. Conventional synchronous reset where clocks to the
blocks must be ON while issuing the reset, and
2. Asynchronous reset which requires clocks to be OFF.
Driver can determine the supported reset methodology on the
platform based on availability of alt_core_clk.
Change-Id: Ia062818ecbf4b0cec44e55f013b762d3ee51b249
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
Queuing a request on a disabled endpoint during composition switch leads
to prime failure. Hence return -EINVAL if a request is queued on a disabled
endpoint.
Also, in f_mtp, block queuing a request in OUT ep in receive_file_work, if
the device state is STATE_OFFLINE.
Change-Id: I0e706d5280a2460baf6ab05dbf97a09c59b642fb
CRs-Fixed: 378207
Signed-off-by: Rajkumar Raghupathy <raghup@codeaurora.org>
Add UASP function to Android supported functions array. UASP
function depend on Target core. Provide empty functions when
Target core is not enabled.
Change-Id: I959f26ebd63e036dae041708d0ad6169213a3cf0
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
The write buffer is allocated twice in bot_send_write_request
function. Fix this by removing additional memory allocation.
Change-Id: I3253c149c3703621be30d0f84499d6af0aff8bc8
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Driver probe is returning 0(success) in case of error
returned by APIs called in msm_otg_probe(). This is causing
NULL pointer exceptions during system wide suspend as
driver data for platform device is not set.
CRs-Fixed: 379532
Change-Id: I194e9386ba8de6d88ab102a467793f8b2f03083a
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
This change enhances the android gadget to support more than one
android device. Implemented in order to support HSIC/HSUSB concurrent
mode.
This feature allows to fully run two compositions concurrently on the
HSUSB and HSIC USB cores, besides the following two restrictions:
1. Cannot run some function driver, for example rmnet, both on HSUSB
and HSIC concurrently. Each composition should have a different set
of function drivers.
2. Mass storage can only run on the primary HSUSB core.
Change-Id: I3f57cd237c0499cb6776c17d660bed82be852697
Signed-off-by: Ido Shayevitz <idos@codeaurora.org>
MHL discovery is initiated upon detecting ID ground state.
This happens via an ID interrupt or charger detection work.
Allow low power mode when MHL cable is connected.
Change-Id: I3565817b53eb444509cf56269103921814147af9
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Signed-off-by: Abhishek Kharbanda <akharban@codeaurora.org>
Signed-off-by: Manoj Rao <manojraj@codeaurora.org>
usb_wwan driver continues pushing rx data buffer to tty node
even if it is removed during device disconnect. This may cause
watchdog bark as driver unnecessarily loops through the list of
rx buffers and tries to push it to tty layer while holding
spin lock with interrupts disabled.
CRs-Fixed: 377066
Change-Id: I5569a4948aba89fd1d0d8ea5e8910ce2e0c8e917
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
An ASYNC interrupt is an indication by hardware that some
activity has happended on USB lines in LPM (low power mode),
and USB software should now bring it out of LPM.
Ideally, hardware should give one more interrupt after coming
out of LPM so that USB driver can process that accordingly.
But, sometimes this interrupt is not generated from h/w for
remote wakeup event in host mode. Hence, resume root hub on
receiving the ASYNC interrupt from hardware in Host mode.
CRs-Fixed: 369298
CRs-Fixed: 368948
Change-Id: Ifb166c1f3c749ab8c615308ab52d85ccdc666733
Signed-off-by: Chiranjeevi Velempati <cvelempa@codeaurora.org>
commit c9cb205f (USB: android: Add a new LUN as CD-ROM in mass-storage)
access platform data without checking for NULL. This causes a kernel
panic on targets which don't have platform data.
Change-Id: I4542b0dce81604706f90b7f6e851ed47c04a941c
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Add runtime power management support in the driver which allows
putting the hardware in low power state, turning off LDOs
and releasing wakelock.
This LPM (aka low power state) support is currently added as part
of USB disconnect and wall-charger connect. LPM support would
later be extended to USB bus suspend as well. Also, support for PHY
retention mode and VDD minimization would be added later.
This commit also adds debugfs nodes that can used to simulate
cable connect and disconnects as A or B device. Following are
the nodes:
-->msm_dwc3/id : Boolean value
-->msm_dwc3/bsv : Boolean value
-->msm_dwc3/connect : can be set to enable/disable
User should first update id/bsv values before enabling 'connect'.
dwc3-msm device is parent of dwc3-core and its runtime PM is managed
by dwc3_otg driver which is responsible for the state transitions
based on notifications from DWC3 h/w or ext_xceiver (using PMIC) for
cable connect and disconnect. This change also allows dwc3 gadget and
host to acquire PM count for the case when dwc3-otg is not present -
e.g. host and device only configurations.
Change-Id: Idd9a59c1ffd46bd98228c9fd4441f668b763534d
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
Proprietary chargers pull D+/- to specific voltages between 2.0-3.3V
(VLGC) for identification. The DM voltage may not exceed VLGC due
to pull-down resistor. Hence a proprietary charger is detected as
a Standard downstream port (SDP). Gadget speed is used to differentiate
between SDP and proprietary charger.
In charger detection work, if the connected charger is not SDP (or) CDP
then re-schedule the work again and if it returns invalid charger, mark
it as proprietary charger.
CRs-Fixed: 377915
Change-Id: I4223c0724c00aea7e755cd07b349c9e597d7960d
Signed-off-by: Chiranjeevi Velempati <cvelempa@codeaurora.org>
Split Target based USB-Gadget driver (tcm_usb_gadget.c) into composite
driver (tcm_usb_gadget.c) and Function driver (f_tcm.c). This is
required for other composite drivers like Android to include Target
based USB function (UASP) along with other functions.
Composite drivers can include f_tcm.c like any other function and
register a callback function. This callback function is called
when Target Fabric is enabled via configfs. This callback can be
used to enable enumeration with host.
Change-Id: I36beea07bb3641a224694c157849ecec347d5943
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
GUSB3PIPECTL[22] bit is for enabling/disabling receiver detection in
either U3 or Rx.Detect states. It should be '0' by default to enable
receiver detection. But it is overridden with '1' on cores revision <
2.30a. Fix this in software.
CRs-Fixed: 377848
Change-Id: I9500f687f386330ed3c686f46365c08b8c8b0d28
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
GUCTL[31:22] indicate the time period (in ns) of the reference clock
that is used to generate Isochronous Timestamp Packets (ITP). This
value should be 8ns (125 MHz) by default. But it is overridden with
0 on cores revision < 2.30a. Fix this in software.
CRs-Fixed: 377846
Change-Id: I827540eb9d2f1ffc65b6f30200b6c0e575bc52d2
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Add a new LUN(lun0) which will be exposed as a CD-ROM having the
attributes ro(read-only) & removable as enabled.
This CD-ROM lun is used for saving read-only files which can be used
for system requirements.
Change-Id: Idff5aea8bce233e8b77a4b689323a2f1eb2523e1
Signed-off-by: Rajkumar Raghupathy <raghup@codeaurora.org>
As this driver communicates over HSUART transport medium
to QSC modem, change the name to hsuart.
Change-Id: I349ef14450ac6b9369dc4183d95fa7e966fc43b9
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
Flush control endpoints from ep_dequeue and set request completion
to NULL once calling completion handler of function driver. This will
make sure that all control endpoint requests are flushed in disconnect.
CRs-Fixed: 373672
Change-Id: I7506c2e53d13f137ae6f222a06fbcc0dee77f68e
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
Currently reading PMIC ID line status immediately once PMIC interrupt
is triggered. This leads to returning wrong ID line state sometimes
and causes not detecting connected devices. Hence add debouncing time
of 5msec for PMIC ID line state to settle down before reading PMIC
ID status.
CRs-Fixed: 371552
Change-Id: I4a5eae1d3759b5cc5c7ab70c4bde900a57ec1bd1
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
After the UDC class conversion, there is no reason to
limit the kernel to have only one UDC controller in the system.
Change-Id: I15d1eef19187e772131ae217452dc22e294f4a78
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Ido Shayevitz <idos@codeaurora.org>