usb: dwc3-msm: Add support for controller power collapse

Starting from msm USB core version 1.2.0, if usb cable is
disconnected controller power collapse is allowed. Hence
add support to vote for Global Distributed Switch
Controller (GDSC) when usb cable is connected and remove
the vote when cable is disconnected to shut down the
controller power.

CRs-Fixed: 498960
Change-Id: Ia1d8bb1b8fb5370a335d28fade72485def68f80c
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
USB: xhci: Add RESET delay quirk for DWC3 controller

In Synopsis DWC3 controller, XHCI RESET takes some time complete.
If PIPE RESET is not complete by the time USBCMD.RUN bit is set
then HC fails to carry out SuperSpeed transfers.
Workaround is to give worst case pipe delay ~350us after resetting
DWC3.

Change-Id: I42a6eb69e5718aafd1d8bb0b32f44a4807a7dc3f
CRs-fixed: 490545
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
USB: msm_otg: Fix host mode suspend bug

Capturing BSV bit before ID test msm_otg_set_vbus_state()
is leading to return suspend call without entering
USB into LPM. In host mode since there is no need for
BSV check, clear the BSV bit so that USB suspend can
go through.

This happens when a target enters host mode with no devices
attached, USB OTG will never enter LPM, as the BSV bit will
always be set.

CRs-Fixed: 493539
Change-Id: I491b7ec058e799ca4e9aa6b34c44ea1908e8dbf0
Signed-off-by: Sujeet Kumar <ksujeet@codeaurora.org>
USB: msm_otg: Allow platforms to vote for BUS bw on cable connect

Some platforms require voting for NOC bandwidth (and PNOC clocks)
when enabling/disabling USB clocks. It is also recommended to have
NOC running when USB is active or in session.
Hence, allow such platforms to specify MIN BUS vote along with NONE
(or inactive) and MAX USB votes. If MIN vote is not specified then
driver treats NONE vote as MIN vote.
Overall platforms should be passing these votes based on that:
NO vote is used when USB cable is not connected or there is no USB
session. MAX vote is used when USB is operating in peripheral mode
and MIN vote is used for any other scenario e.g. host mode or when
turning off USB clocks as part of putting USB in low power state.
MIN vote shouldn't be a significant value to avoid increase in power
numbers.

CRs-Fixed: 494654
Change-Id: Ia4498356b026963f7a6fda8a30ecbd9c1cd98924
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
USB: msm_otg: Add support for configuring MPM interrupt for remote wakeup

On some platforms, DP and DM lines are routed to MPM for detecting
data lines transition during VDD minimization. Hence allow VDD
minimization during host bus suspend and depend on MPM for usb remote
wakeup on platforms where detection of peripherals are supported
through MPM interrupt.

Change-Id: I8d72ebf83cab014e3c4839484982c9ae115757a1
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
USB: msm_otg: Host: Allow XO shutdown only if no session is active

Currently msm_otg driver allows VDD minimization during host bus
suspend and depends on MPM for USB remote wakeup on platforms,
where D+ and D- lines are routed to MPM. As part of VDD minimization,
PHY will be put into retention state in which pull down resistors
are disabled. This scenario could cause issues without HW rework of
connecting pull down resistors on data lines. Hence don't allow
XO shutdown during host bus suspend if session is active.

Change-Id: Ic7274072cc4f266574cf45030bcadc469091c333
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
USB: msm_otg: Add voting for sleep clock

USB PHY is provided sleep clock on few platform which is
required to enable for USB PHY functionality. Hence add
support to vote sleep clock if it exists.

CRs-Fixed: 518353
Change-Id: I67006bfe3fbe9b3ad3e1d1e2ddb0e8e060437bd7
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
ASoC: msm: Add few more Dolby endpoint dependent paramters

While turning Dolby effecrs on and off from its UI app, volume of
levels vary and difference is observed. Dolby requires few more
paramters to be sent based on endpoints for proper tuning.

CRs-Fixed: 503579
Change-Id: Ibae16d417d4df53eb2bf27475ed24fa409af3861
Signed-off-by: Jitendra Singh Naruka <jnaruk@codeaurora.org>
ASoC: msm: update endpoint based DAP table for REMOTE_SUBMIX

Update endpoint parameters table for REMOTE_SUBMIX and FM
endpoints used for Miracast devices in DAP driver.

Change-Id: I9bda1d884f93c131149b3cae0f22a0113020d6e7
Signed-off-by: Jitendra Singh Naruka <jnaruk@codeaurora.org>
ASoC :msm: Increase Proxy buffering

-Proxy buffering can overflow if BT playback setup takes a lot of time
-Fix this by increasing the proxy buffer size so that we will end
 up buffering the additional data that can come in during this time

Change-Id: I3b9acc848e0922bb26c87845fc6164f4266fbfa9
Signed-off-by: Amit Shekhar <ashekhar@codeaurora.org>
ASoC: msm: Add 24 bit support to Primary MI2S TX

Add 24 bit support to Primary MI2S Tx. Add
capability to specify bits per sample to DSP.

Change-Id: I928f37c7b76ffea735365b164d52ceabd88e77e6
Signed-off-by: Damir Didjusto <damird@codeaurora.org>
ASoC: msm: qdsp6: add support to query RMS during recording

Recorder app requires RMS value of the recording when using
tunnel mode AMR-WB encoding. Add mixer control so app can query
the RMS value from DSP

Change-Id: I84127ad35b916d257b0edee260141c34b92742f2
Signed-off-by: Jitendra Singh Naruka <jnaruk@codeaurora.org>
ASoC: msm: q6: check upper bounds when copy ac3 params

Although AC3 maximum param size is fixed, better check upper bounds
when copy user data. It might cause overflow, possibly cause memory
corruption.

Change-Id: I2f7cec8edd9e013de1433ea06480b963ec307196
Signed-off-by: Fred Oh <fred@codeaurora.org>
ASoC: msm: q6: update render flag to NON_DMA for handling underrun

In scenarios where the driver is in underrun state, restart
mechanism triggers when the render flag is in NON_DMA mode. The
compressed driver which is opened in mmap mode runs into underrun
scenarios when the valid buffer length is smaller than the
buffering in the DSP. Update render flag accordingly so that the
restart is trigger when driver is in underrun state.

CRs-Fixed: 487732
Change-Id: Ia4ee5dcf1d079ebef69e9ee627591bc039934add
Signed-off-by: Jitendra Singh Naruka <jnaruk@codeaurora.org>
asoc: es325: Block reads and writes while firmware is loading

 * Performing any operation on the hardware while the firmware is
   still loading will cause an infinite spiral of derp. Stop it.

Change-Id: Ice2f3745ee55e027442045d4f12cbba5039cf8bb