board-msm7x30: bt: Cleanup not proper when BT chip not detected

As apart of BT power on even if bluetooth chip is not detected,
bluetooth power on sequence is going ahead which is causing a
kernel panic.

Signed-off-by: Ram Mohan Korukonda <rkorukon@codeaurora.org>
(cherry picked from commit 1747cde74a9eaebd3a8794311e0404f60523989a)

Change-Id: I8425f6703595b652358f0399bbec8d8a39c1966d
Signed-off-by: Ramakrishna Prasad N <crpn@codeaurora.org>
msm: audio: qdsp5v2: Switch audio drivers to ION.

PMEM is deprecated, Move drivers to ION.

Change-Id: Ie4c1f676d151f26f983d1ed64038ecd0465e1b52
Signed-off-by: Sidipotu Ashok <sashok@codeaurora.org>
msm_fb: display: Add support vsync driven composition for 7x30

This patch will queue multiple surfaces and commit those
surfaces into mdp at same instance so that surfaces will
be blended and displayed at same time for 7x30. Hardware vsync event
is delivered to the user space frame work via uevent. Both
queue and commit are controlled by frame work and synchonized
with vsync event. Therefore frame rate will match with vsync rate.

Change-Id: I59d672d12f69bd964eb59c78ba0b86ddec57fe74
Signed-off-by: Jeevan Shriram <jshriram@codeaurora.org>

Conflicts:

	drivers/video/msm/mdp.c
	drivers/video/msm/mdp4_overlay.c
	drivers/video/msm/mdp4_overlay_mddi.c
msm: audio: qdsp6v2: Fix the issue of memory unmap

- Target freeze observed during monkey run.
- Memory unmap getting called from interrupt context,
  which is causing scheduling during atomic operation.
- Avoid calling memory unmap from interrupt context.

CRs-fixed: 390582
Signed-off-by: Deepa Madiregama <dmadireg@codeaurora.org>
(cherry picked from commit a64fae9ba272ba2f689f30bc7b33c8a1fe4445e5)

Change-Id: Ibfd73d97c2ea8734385ba5eeb8a009cb55ec7e49
Signed-off-by: Ramakrishna Prasad N <crpn@codeaurora.org>
msm_fb: display: Update mdp clock counter for unsuccessful probes

If a panel probe does not succeed, call mdp_clk_ctrl to maintain
mdp_clk_cnt counter else mismatch in counter results in mdp clock
to never go off in cases like suspend-resume.

CRs-fixed: 385560
Signed-off-by: Mayank Chopra <makchopra@codeaurora.org>
(cherry picked from commit 3c5ae1f883a8b6a7812d936c5f7e5bb4d0d3142b)

Change-Id: Ib508011628ee81a90b29d30f14429cf186c47ebe
Signed-off-by: Ramakrishna Prasad N <crpn@codeaurora.org>
Signed-off-by: Jeevan Shriram <jshriram@codeaurora.org>
msm_fb: display: add support of mdp clocks controlled by vsync

Mdp related clocks are controlled through vsync enable/disable
ioctl from userspace frame work.

Crs-fixed: 384482
CRs-Fixed: 409970
Change-Id: I5999ad17955e0f862f64036a6390016ff3a6782f
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
Signed-off-by: Jeevan Shriram <jshriram@codeaurora.org>

Conflicts:

	drivers/video/msm/mdp.c
	drivers/video/msm/mdp4.h
	drivers/video/msm/mdp4_overlay_dsi_cmd.c
	drivers/video/msm/mdp4_overlay_mddi.c
	drivers/video/msm/mipi_dsi.h
msm_fb: display: Fix blend configuration for MDDI I/F

MDP4.0 blend operation registers are not double buffered and
take effect as soon as they are configured. Configuring these
registers at any place other than between dma and vsync produce
flickers as new blend values would get applied to previous
mixer configurations. Configure blend operation registers just
after dma is over, before vsync.

CRs-Fixed: 410029
Change-Id: I2d04b2edb1e6592ac192fd00d302d8941a56ad69
Signed-off-by: Jeevan Shriram <jshriram@codeaurora.org>
board-msm7x30: display: Increase the camera heap for 720p

There is not enough memory for 720p video play when played
on external interface. Hence increase camera heap by 1 frame
of 720p resolving the playback issue on external interface.

CRs-Fixed: 410088
Change-Id: I40eb108e6d03eb371ad63c03154eaab59760dd2b
Signed-off-by: Jeevan Shriram <jshriram@codeaurora.org>
diag: Fix various issues with IOCTLs

DIAG kernel driver interacts with user space processes using
IOCTLS. Some issues, such as potential integer over/underflow,
incorrect buffer copy etc were identified in these functions.
This change fixes them.

Fix for the following CVE-
CVE#1 CVE-2012-4220
CVE#2 CVE-2012-4221

CRs-Fixed: 385352, 385349
Change-Id: Ie37dbda0acdc63fb440bd81d7f57c146f314b91a
Signed-off-by: Dixon Peterson <dixonp@codeaurora.org>
msm:vidc: Amend error checks on ION API failures

This change will validate the ION API failures
to fix target freeze issues.

CRs-fixed: 412958
Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>
(cherry picked from commit 31bb7dc8e3a4d01262727349b30bb3007fd474bd)

Conflicts:

	drivers/video/msm/vidc/720p/ddl/vcd_ddl_utils.c
	drivers/video/msm/vidc/common/vcd/vcd_sub.c

Change-Id: I6d0dc8afef6ba1513c2ea29753f7df6b1a3d70e9
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>
msm_serial_hs_hwreg.h: Correcting the even parity and odd parity bits

Currently parity bits are defined to be used with UART_DM_MR2
register with PARITY_MODE Bit as below :
EVEN_PARTIY = 1 and ODD_PARITY = 2
With these values, UART functionality doesn't work after enabling parity.
Hence adding correct used PARITY_MODE bits value as
EVEN_PARITY = 2 and ODD_PARITY = 1
after confirming with UART hardware programming guide.

CRs-Fixed: 410377
Signed-off-by: Saket Saurabh <ssaurabh@codeaurora.org>
(cherry picked from commit fd40e5f6313fbc74e8897927be1004faa5d9df08)

Change-Id: Ia7461d1983336b1d965498ede00001cc67c1d925
Signed-off-by: Ramakrishna Prasad N <crpn@codeaurora.org>
msm_fb: Handle vsync interrupt properly on MDP 3.03 targets

Handle enabling/disabling the vsync interrupt and mdp clock
enabling/disabling in a better way on MDP 3.03 targets. This
will avoid target crashes due to unclocked register access.

CRs-fixed: 388751
Change-Id: I5c4a409772464ce7d06869374dcba5ad7e335955
Signed-off-by: Padmanabhan Komanduru <pkomandu@codeaurora.org>

Conflicts:

	drivers/video/msm/mdp.c

Signed-off-by: Mayank Chopra <makchopra@codeaurora.org>

Conflicts:

	drivers/video/msm/mdp.c
	drivers/video/msm/mdp_dma.c
	drivers/video/msm/mdp_dma_dsi_video.c
	drivers/video/msm/mdp_dma_lcdc.c
msm_fb: Return ioctl on vsync interrupt disable

Before the vsync interrupt gets disabled, initialize the completion
structure and then disable the interrupt. This enables the ioctl to
return successfully in all the cases.

Change-Id: I6a7c233f818a773d00497502213d1ecf8fe9dc24
Signed-off-by: Padmanabhan Komanduru <pkomandu@codeaurora.org>

Conflicts:

	drivers/video/msm/mdp_dma_dsi_video.c
msm_fb: Make Vsync IOCTL during disable sequence as NO WAIT

Change to make the vsync IOCTL no wait during the disable sequence.
This is to increase the performance. Handle the synchronization of
vsync interrupt using state variables in drivers from now.

Change-Id: Ia5ec14493f233a95f21d01ea627200a6c278239f
Signed-off-by: Padmanabhan Komanduru <pkomandu@codeaurora.org>

Conflicts:

	drivers/video/msm/mdp_dma_dsi_video.c
msm_fb: Return pan_display call on Vsync interrupt

Till now, the pan_display call returns on DMA_P_DONE interrupt.
For command mode panels, the DMA transfer starts only after the
DMA engine receives a TE signal from the panel. Hence, return
pan_display ioctl on vsync interrupt to improve performance.
We still wait if the previous DMA transfer is not finished at
the beginning of next pan_display.

Change-Id: Ie92bc000a5842aa02a77a08b6bafdc8472bbebbd
Signed-off-by: Padmanabhan Komanduru <pkomandu@codeaurora.org>

Conflicts:

	drivers/video/msm/mdp.c
	drivers/video/msm/mdp_dma.c

Signed-off-by: Mayank Chopra <makchopra@codeaurora.org>

Conflicts:

	drivers/video/msm/mdp.c

Signed-off-by: Mayank Chopra <makchopra@codeaurora.org>

Conflicts:

	drivers/video/msm/mdp_dma.c
msm_fb: display: Send vsync events using sysfs for MDP3 targets

Replace sending of vsync timestamp using uevents with sysfs entry
as uevent result in increase in power numbers due to broadcast in
nature.

Change-Id: I22cfbd68c8bcbe4a47e94074393f1cbf79920c58
Signed-off-by: Mayank Chopra <makchopra@codeaurora.org>
Signed-off-by: Siddhartha Agrawal <agrawals@codeaurora.org>

Conflicts:

	drivers/video/msm/mdp.c

Signed-off-by: Mayank Chopra <makchopra@codeaurora.org>

Conflicts:

	drivers/video/msm/mdp.c
	drivers/video/msm/mdp_dma_dsi_video.c
msm_fb: display: Send vsync events using sysfs for MDP4 targets

Replace sending of vsync timestamp using uevents with sysfs entry
as uevent result in increase in power numbers due to broadcast in
nature. Also, for smart panel, wait4vsync is removed.

Change-Id: I5219e85b837b8bab9d00a9f40c1048d2a2355194
Signed-off-by: Mayank Chopra <makchopra@codeaurora.org>
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
Signed-off-by: Siddhartha Agrawal <agrawals@codeaurora.org>

Conflicts:

	drivers/video/msm/mdp4_overlay_dtv.c

Signed-off-by: Mayank Chopra <makchopra@codeaurora.org>

Conflicts:

	drivers/video/msm/mdp4_overlay_dsi_cmd.c
	drivers/video/msm/mdp4_overlay_dsi_video.c
	drivers/video/msm/mdp4_overlay_dtv.c
	drivers/video/msm/mdp4_overlay_lcdc.c
	drivers/video/msm/msm_fb.c
msm_fb: display: Make sysfs read request interruptible

Change blocking sysfs read request to be interruptible and protect
vsync timestamp value to prevent corruption.

Change-Id: I510d84134b0ab70d17729e8c53c91fa926035142
Signed-off-by: Mayank Chopra <makchopra@codeaurora.org>

Conflicts:

	drivers/video/msm/mdp4_overlay_dsi_video.c
	drivers/video/msm/mdp4_overlay_lcdc.c
msm_fb : Add timeout while waiting for vsync event

Avoid eternal wait for vsync event when client tries to
read the corresponding sysfs entry. This will avoid hangs when
client tries to read in corner cases where the Timing
Generator or the clock or IRQ gets disabled.

CRs-fixed: 406752
Change-Id: I773687220b868823a9e4bfdae74361ee6487c5c6
Signed-off-by: Pradeep Jilagam <pjilagam@codeaurora.org>
Signed-off-by: Siddhartha Agrawal <agrawals@codeaurora.org>

Conflicts:

	drivers/video/msm/mdp4_overlay_dtv.c

Signed-off-by: Mayank Chopra <makchopra@codeaurora.org>
msm_fb: display: Create sysfs entries in mdp_probe for MDP4 targets

vsync sysfs entries should be created in mdp_probe instead of
creating in panel on. This avoids waiting for the first event
control in framework

Change-Id: I983731481ea89bb7666be5f2a9f75a1e04fd963f
Signed-off-by: Mayank Chopra <makchopra@codeaurora.org>

Conflicts:

	drivers/video/msm/mdp4_overlay_dsi_cmd.c
	drivers/video/msm/mdp4_overlay_dtv.c
	drivers/video/msm/msm_fb.h

Signed-off-by: Mayank Chopra <makchopra@codeaurora.org>