msm_fb: display: HPD rework for cleaner approach

Currently HPD is turned on and off with HDMI turn on and off
and turned on again after HDMI off so as to detect the cable
plugin.
With this change, HPD will be turned on when HDMI drvier is
initialized and turned off and on with suspend - resume. The
HPD handling during HDMI turn on and off has been removed.

CRs-fixed: 368865 360135
Change-Id: I1fb42b4587e58086d643b87a1600ecf09754423d
Signed-off-by: Aravind Venkateswaran <aravindh@codeaurora.org>
Signed-off-by: Ajay Singh Parmar <aparmar@codeaurora.org>
Signed-off-by: Ramakrishna Prasad N <crpn@codeaurora.org>

Conflicts:

	drivers/video/msm/hdmi_msm.c
	drivers/video/msm/msm_fb.c
msm_fb: HDMI: Start HDCP authentication only on device open

Currently HDCP authentication is started for a default resolution
upon HPD connection event. With this change, HDCP authentication
is only triggered after the HDMI interface has been configured for
an appropriate resolution following the call to open the HDMI device.

CRs-fied: 368865 360135
Change-Id: I7b9ce85aed989b78b448bff6a545a194dfed5b1d
Signed-off-by: Aravind Venkateswaran <aravindh@codeaurora.org>
Signed-off-by: Ajay Singh Parmar <aparmar@codeaurora.org>
Signed-off-by: Ramakrishna Prasad N <crpn@codeaurora.org>
msm_fb: HDMI: Do not add HPD state timer during probe

Currently all HDMI timers are initialized in the driver's
probe function with a maximum possible expiration value. However,
the 32-bit jiffies value is initialized in the kernel so as to
wrap 5 minutes after boot. This results in the HPD timer being
fired 5 minutes after boot even though cable  is not
connected. This change fixes this issue by not starting the HPD
timer during probe.

CRs-fixed: 360135
Change-Id: I9eeb8b892be2476e8debdd4ec5897a103cc34665
Signed-off-by: Aravind Venkateswaran <aravindh@codeaurora.org>
Signed-off-by: Abhishek Kharbanda <akharban@codeaurora.org>
Signed-off-by: Manoj Rao <manojraj@codeaurora.org>
Signed-off-by: Ajay Singh Parmar <aparmar@codeaurora.org>
Signed-off-by: Ramakrishna Prasad N <crpn@codeaurora.org>
msm_fb: HDMI: Removing unnecessary HPD detection code.

HPD read work is used to detect HPD at bootup which
is not required as HPD detection is taken care at
bootup by toggling the HPD circuit. So we can safely
remove this redundant code.

CRs-fixed: 368865 360135
Change-Id: I8eed00c4f5af2ed2ca37e86da622ab518e5eb887
Signed-off-by: Aravind Venkateswaran <aravindh@codeaurora.org>
Signed-off-by: Ajay Singh Parmar <aparmar@codeaurora.org>
Signed-off-by: Ramakrishna Prasad N <crpn@codeaurora.org>

Conflicts:

	drivers/video/msm/hdmi_msm.c
msm: display: Add MDP footswitch regulator control for HDMI PLL

Add support for enabling HDMI PLL regulator along with footswitch
enable/disable to avoid PLL lock detection failures during
suspend/resume

CRs-fixed: 360135
Change-Id: I9b161cab50d2b6c39de39b588e326f5ff97cbc65
Signed-off-by: Ravishangar Kalyanam <rkalya@codeaurora.org>
Signed-off-by: Ajay Singh Parmar <aparmar@codeaurora.org>
Signed-off-by: Ramakrishna Prasad N <crpn@codeaurora.org>
msm_fb: display: Set HDMI PLL footswitch regulator to 1.8V after get()

After regulator_get call for HDMI PLL footswitch purpose, set
output voltage to 1.8 V to ensure proper state while enabling and
disabling regulator.

CRs-fixed: 360135
Change-Id: Ia6b130286f50066dc0dc7d3441a909223683b33a
Signed-off-by: Ravishangar Kalyanam <rkalya@codeaurora.org>
Signed-off-by: Ajay Singh Parmar <aparmar@codeaurora.org>
Signed-off-by: Ramakrishna Prasad N <crpn@codeaurora.org>
msm_fb: hdmi: Break infinite loop

Currently, if HDMI PLL lock fails, it will retry. It retries until
the PLL is locked. This may result in infinite loop. This change will
limit the retries to max 10.

CRs-fixed: 360135
Change-Id: I1745643cba7bbc5272f1252208759a83258e9fcb
Signed-off-by: Ajay Singh Parmar <aparmar@codeaurora.org>
Signed-off-by: Ramakrishna Prasad N <crpn@codeaurora.org>
msm: clock-dss-8960: Update HDMI PLL settings

Update the HDMI PLL register settings for all the supported
frequencies to address the issue of HDMI PLL not getting
locked sporadically.

CRs-fixed: 360135
Change-Id: I033f70f11f406a6be0de7e1a2286d9ad17cc0064
Signed-off-by: Aravind Venkateswaran <aravindh@codeaurora.org>
Signed-off-by: Ajay Singh Parmar <aparmar@codeaurora.org>
Signed-off-by: Ramakrishna Prasad N <crpn@codeaurora.org>

Conflicts:

	arch/arm/mach-msm/clock-dss-8960.c
msm_fb: HDMI: Fix handling of HDMI PLL software reset

Whenever a software reset is asserted on the HDMI PLL, we should
wait for short time to wait for the PLL calibration to be
successful before checking to see if the PLL is locked.

CRs-fixed: 378044 360135
Change-Id: I736e2eff4dce778ba3e305d9461cdedc607156ae
Signed-off-by: Aravind Venkateswaran <aravindh@codeaurora.org>
Signed-off-by: Ajay Singh Parmar <aparmar@codeaurora.org>
Signed-off-by: Ramakrishna Prasad N <crpn@codeaurora.org>
msm_fb: hdmi: Proper switching of switch device

Switch device used to tell userspace about HDMI connection
needs to be enabled when:
1. HPD connect
2. Authentication successful

And disable when:
1. HPD disconnect
2. Authentication failed

CRs-fixed: 360135
Change-Id: I8d4529fa2335ec1b2dc1196e57e3c8bad7d6b657
Signed-off-by: Ajay Singh Parmar <aparmar@codeaurora.org>
Signed-off-by: Ramakrishna Prasad N <crpn@codeaurora.org>

Conflicts:

	drivers/video/msm/hdmi_msm.c
msm_fb: HDMI: Fix for high HDMI sleep current

In certain cases, the HPD circuitry is not switched off when the
device goes to suspend state, resulting in high sleep current on
the HDMI power rail. This patch ensures that the HPD circuitry is
always turned off during suspend operation by removing an
unnecessary condition check.

CRs-fixed: 360135
Change-Id: I5846255ff4405ff1f449158f4b2f0d5ed0cd96bb
Signed-off-by: Aravind Venkateswaran <aravindh@codeaurora.org>
Signed-off-by: Ajay Singh Parmar <aparmar@codeaurora.org>
Signed-off-by: Ramakrishna Prasad N <crpn@codeaurora.org>
msm_fb: hdmi: 3D configurations in HDMI

3D configurations using Generic0 packets need to be done
after enabling HDMI Control to take these configurations
into effect.

CRs-fixed: 349578 360135
Change-Id: I8d658ddf4f2ccb2ae47015fe411e8c1a5a55e4df
Signed-off-by: Ajay Singh Parmar <aparmar@codeaurora.org>
Signed-off-by: Ramakrishna Prasad N <crpn@codeaurora.org>
msm_fb: HDMI: HDCP: Start HDCP authentication as a work item

HDCP authentication should be kicked off as a scheduled work
item so as to ensure that MDP is already configured and frames
are being transmitted over the HDMI channel prior to the start
of the HDCP authentication procedure.

CRs-fixed: 384513
Change-Id: I27cab44babfc24d91a318b0641674f85910cc33f
Signed-off-by: Aravind Venkateswaran <aravindh@codeaurora.org>
Signed-off-by: Ramakrishna Prasad N <crpn@codeaurora.org>

Conflicts:

	drivers/video/msm/hdmi_msm.c
msm_fb: display: add mutex on overlay_play to fix iommu page fault

An iommu page fault may heppen When a pipe_commit is executed
in between of frame dropped and pipe_queue during overlay play.
An mutex is necessary to mutual exclusive between pipe_commit
and overlay_play.

Change-Id: I736e821c6c648a6ebd435303a1906a40e9b75791
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
msm_fb: hdmi: Soft debouncing logic improvements

Currently, HPD as a soft debouncing logic to ignore duplicate
HPD events. This sometimes is missing a real HPD event.
This change implements a new debouncing logic in driver which
will make sure the last HPD status is always processed.

CRs-fixed: 386006 384409 384513
Change-Id: I02d9814e4a55b7eec11a8e0d134c9ed9b5747422
Signed-off-by: Ajay Singh Parmar <aparmar@codeaurora.org>
Signed-off-by: Aravind Venkateswaran <aravindh@codeaurora.org>
Signed-off-by: Ramakrishna Prasad N <crpn@codeaurora.org>

Conflicts:

	drivers/video/msm/hdmi_msm.c
msm: QDSP5: audio: Migrate to ION

PMEM is deprecated, switch to ION.

Change-Id: I5da6d11b6cd2d5d6d37694db10ccb7089a47b1c1
Signed-off-by: Sidipotu Ashok <sashok@codeaurora.org>
Signed-off-by: Atul Raut <araut@codeaurora.org>
diag: Fix problem with stopping of logging data

On-Device Logging at very high logging rates can cause
a race condition where the buffers reading in data from
the smd channel are filled with data and are not having
their data logged to userspace.  Detect this condition
and restart the logging process.

CRs-Fixed: 382128
Change-Id: I3bb4cfae1bd72d2575c32e800973fac558beae7c
Signed-off-by: Dixon Peterson <dixonp@codeaurora.org>
(cherry picked from commit 743a11e7821c5118e1dc0eb035b1efb94fccb994)
gpu: ion: Reference count protect/unprotect calls

Reference count the calls to ion_{un}secure_heap. The secure SCM
call will only be made when the count goes from 0 -> 1 and the
unsecure call will only be made when the count goes from 1 -> 0.

Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
(cherry picked from commit f68983eaa0b7b9eb2bb35937e799a43fab5442d5)

Change-Id: I8c24f90ce71481c6b0c5079a3c02c44a120bb376
Signed-off-by: Ramakrishna Prasad N <crpn@codeaurora.org>
msm: audio: qdsp6v2: Change ASM cmd sequence

- Memory map failure observed while music playback.
- Audio driver issuing memory unmap cmd first then issuing
  ASM_CMD_CLOSE, due to which memory map failure observed.
- Issue unnmap cmd after receiving the ack for ASM_CMD_CLOSE.

Change-Id: I454095fcc0eff332ca90cfe3ae6ba9c859f315f4
Signed-off-by: Deepa Madiregama <dmadireg@codeaurora.org>
defconfig: Enable TUN driver support

Enable TUN driver support required in Android VPN service.

CRs-Fixed: 388834
Change-Id: I82235fae091eb8a08bc6420d0e58e90d2929a441
Signed-off-by: Vineela Tummalapalli <vineela@codeaurora.org>