usb: gadget: fix platform driver registration

API expects platform device to be registered before probing.
usb: gadget: reset ci13xxx driver to CAF

Reset ci13xxx driver to CAF ics_chocolate at "Initial Contribution",
commit ID: 3f2bc4d6eb5a4fada842462ba22bb6bbb41d00c7.
USB: gadget: Implement pullup gadget method in ci13xxx_udc

Implement pullup gadget method for providing enumeration control
to function drivers.

Change-Id: I8ed73280646902003888cd9e19959f3b23ed31ed
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
usb: gadget: Do not allow ep request queuing if not configured

USB Host driver can select any configuration that is presented by
peripheral driver to enable certian set of peripheral functions.
Till a particular configuration is selected, all peripheral function
drivers are considered to be disabled and any request to send/recevie
data is rejected. Allow only control endpoint(Ep0) queuing which is
used for advertise configurations and select a particular configuration.

CRs-fixed: 295668
Signed-off-by: Anji jonnala <anjir@codeaurora.org>
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
usb: gadget: Check for pending requests before priming the ep

For any data to be transferred over usb endpoint, USB S/W
configures the data to be transferred in queue heads and transfer
descriptors and requests h/w to process the data by priming the
endpoint. Sometimes it is observed that endpoint priming is
failing when usb requests are being queued back to back. Although
the h/w is recovering later, some unprocessed requests are
pending in ep requests queue. To avoid this issue, check for
stale requests before priming the endpoint and add the current
request at the endpoint of request queue.

Signed-off-by: Vamsi Krishna <vskrishn@codeaurora.org>
USB: gadget: ci13xx_udc: Fix bug in halting a control endpoint

A new setup packet can arrive on the control endpoint exactly when
software tries to halt it.  The halt condition will continue to be
cleared by the hardware.  The current code is ignoring this scenario
and polling for the halt condition to be true.  Return success from
ep_set_halt upon a new setup packet arrival.

CRs-fixed: 299838
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
USB: gadget: Remove spoof disconnect workaround in ci13xxx_msm

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>
USB: gadget: ci13xxx_udc: Fix bug in nuking the control OUT endpoint

ci13xxx_udc controller driver exposes EP0 In as control endpoint to
function drivers.  Function drivers request both IN and OUT control
data transfers on EP0 In.  Controller driver internally uses EP0 Out
for queuing/retiring OUT control endpoint requests by checking the
control transfer direction.  Do the same for nuking and dequeuing.

CRs-Fixed: 305866
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
usb: Add delay before checking request status

USB H/W generates endpoint completion interrupt when data is
received on any endpoint. Upon ep complete interrupt, S/W
checks request status and unlinks the request from h/w queue.
Sometimes h/w is taking around 200us to update ep data after
generating the interrupt which is causing data stall when
there is huge traffic on any endpoint. Delay checking USB
request for 200us after endpoint completion interrupt

Signed-off-by: Vamsi Krishna <vskrishn@codeaurora.org>
Signed-off-by: Zhoulu Luo <zluo@codeaurora.org>
usb: ci13xxx_udc: Add mb() before checking req active status bit

Sometimes it is observed that HW is taking some time to update the dTD
fields even after generating interrupt with ENDPTCOMPLETE bit set.
This is causing hw_dequeue fails due to which request completion
handler not called and eventually leads to USB connection lost.

CRs-fixed: 312854
Change-Id: I23fca063ba77ec86f17f866162fab09ae4251bf7
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
usb: ci13xxx_udc: Add delay upon hardware dequeue failure

A delay is observed between when the HW generates the
ENDPTCOMPLETE interrupt and updating the dTD status bits. This
delay is causing the request ending up in lying in the DCD queue
which leads to data stall on that particular endpoints.

As temporary workaround add 10 micro second delay upon dequeue failure
and make a call to hardware dequeue again which might help this case.

Change-Id: Ic97fa259b2e2f0a5c53cb49106f42960b4514164
Signed-off-by: Anji jonnala <anjir@codeaurora.org>
usb: ci13xxx_udc: stop charging upon reset

USB CV tool may send reset to measure the unconfigure current.
Hence stop charging by reducing the charging current to 0mA to meet the
compliance requirement.

Change-Id: Ia4e0d6471bd21a632625753da99d5f0b3aad9480
CRs-fixed: 313277
Signed-off-by: Anji jonnala <anjir@codeaurora.org>
USB: ci13xxx_udc: Fix runtime PM sleeping bug

Call pm_runtime_get_sync() and pm_runtime_put_sync() functions outside
spin lock to fix "sleeping function called from invalid context" bug.

Change-Id: Ib96797743f40d6f8e33a0c954f096a4afdd86fe3
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
USB: ci13xxx_udc: Decrement runtime PM usage counter correctly

Decrement the runtime PM usage counter in usb_gadget_probe_driver
in VBUS absence and pull-up disable cases.

CRs-Fixed: 323091
Change-Id: If2a601c21b8d221072ff8d2f0ae72781d02ddfd2
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
usb: ci13xxx_udc: unmap req DMA buffers upon cable disconnection

Device controller driver transfers the ownership of usb request buffer
memory to device DMA by making call to dma_map_single. CPU regains the
access only after making call to dma_unmap_single.
Upon request completion USB driver is performing dma_unmap_single and
accessing the memory.
Perform dma_unmap_single upon cable disconnect also while flushing the USB
requests.

Change-Id: Ic180c2b1158c93c5b187607c364f0fd5056cc52f
CRs-fixed: 327466
Signed-off-by: Anji jonnala <anjir@codeaurora.org>
msm: vidc: revert the following commits

This commit is a squashed commit of the following commits which
currently cause video playback issues. This commit should be undone when
these commits will work without issue.

Revert "msm: vidc: Fixes bug in secure enc/dec concurrency"

This reverts commit 8287b099977229af52b4d805c3cdb12941328a1b.

Revert "msm: vidc: Remove memcpy of sequence header"

This reverts commit b0c8e3ce94c7f1acc565c9ca251df4849078144e.

Revert "msm: vidc: Remove vcd restriction of duplicate input buffer queue"

This reverts commit 656de6b3ed74727549df64b50078189e17273056.

Revert "mm_video: vidc: SPS PPS enable for IDR and zero stuff bytes"

This reverts commit 328612e6be305c0f81f6793981064e9815d8213d.