msm: display: clear sec_active when the pipe is not for secure

Make sure usecure memory is unmapped properly

Change-Id: Ie0f2bc586ab4de45ceaaa6834db64ba7b94b2c0b
Signed-off-by: Ken Zhang <kenz@codeaurora.org>
Bluetooth: Handle HCI_SET_CONN_ENCRYPT cmd

HOST will set the encrption flag to true when encrypt_change_event
with Encryption Enable is On. Otherwise it will set to false. This
will avoid sending HCI_SET_CONN_ENCRYPT cmd when encryption is already
set.

CRs-Fixed: 505188
Change-Id: I2b716c3053c0766934f90f1047d805cf88b03a8d
Signed-off-by: Juffin Alex Varghese <jalex@codeaurora.org>
msm_fb: hdmi: mutex for hdmi operation

Add mutex to prevent reentrance for hdmi operation.

Change-Id: I332c99c79b635a8e667fcc2c6b8b7686db87c414
Signed-off-by: Ken Zhang <kenz@codeaurora.org>
msm_fb: hdmi: enable hdcp encrpytion on the fly

Only enable encrption when content is secured.

Change-Id: I90b263442542c4b4c89c7c3b144f551acd300ce9
Signed-off-by: Ken Zhang <kenz@codeaurora.org>
bluetooth: Add debug statements in BT power sequence

Add debug statements in the BT ON/OFF path and reduce the
low power mode debug logs.

Change-Id: Ic0672d81139168d56182adbacb3ded4980bad678
Signed-off-by: Anantha Krishnan <ananthk@codeaurora.org>
bluetooth: Use correct Kernel API for deleting the transport timer

del_timer_sync is the correct Kernel API to be used for deleting
timers on SMP systems, as it deactivates the timer and ensures that
the timer has finished executing on other CPUs.

Change-Id: Ic516850f84d14b2f7000260adfc29adf5ddd18ef
Signed-off-by: Anantha Krishnan <ananthk@codeaurora.org>
msm_fb: hdmi: reset audio dma engine

audio is enabled in bootloader for mpq, need reset the audio engine.

Change-Id: I6cc91fed045492485bcb1b65ab74bc17a383500e
Signed-off-by: Ken Zhang <kenz@codeaurora.org>
msm_fb:hdmi:Add DDC arbitration settings for HDCP.

This code change adds DDC arbitraion settings to enable
queuing of software DDC GO before starting 1st part of
HDCP authentication and then disabling queuing of software
DDC GO just before starting 3rd part of authentication.

Change-Id: I2e71e723a250dd58de97e4921199add0907aa9e8
Signed-off-by: Sandeep Panda <spanda@codeaurora.org>
msm_fb: Set DTV off if EDID read failed in LK

1) If EDID read fails in LK we fall back to default VIC,
as kernel will read again, reconfigure with kernel values

2) If there is a mis match between Vfmt in LK and Kernel,
reconfigure with kernel values

CRs-Fixed: 526727
Change-Id: Idb88274105e72fa34de3f195b9d8107a7ad8912b
Signed-off-by: Kalyan Thota <kalyant@codeaurora.org>
Revert "msm_fb: display: free pipe if blt is detected for the pipe"

This reverts commit e29d1b2e70c3d6d8417b2791f62043bcf084b9bb because
of iommu page faults on some targets.

CRs-Fixed: 526377
Change-Id: Ia9f9c37720fb23da347eea480ffa55e536231c65
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
Signed-off-by: Kalyan Thota <kalyant@codeaurora.org>
Revert "msm_fb: display: don't enable blt mode"

This reverts commit aa980658ac73a347fc94108d4fc886860d0c1714 because
of iommu page faults on some targets

CRs-Fixed: 526377
Change-Id: I2b0f801ab00f473dcb3f3918b30ebf594a5a2058
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
Signed-off-by: Kalyan Thota <kalyant@codeaurora.org>
msm_fb: display: disable mdp blt mode

The switch of blt mode may cause mdp hang on some targets. To avoid
blt switch, we won't allocate the pipe that requires blt
mode. Basically this implies two things: downscaling is done by
rotator and gpu composition is used in case of blt mode is needed.

This implementation is to calculate mdp clk requirement based on the
req data passed from userspace before setting the actural pipe
data. If overlay_set asks for mdp clk that is greater than
mdp_max_clk, meaning blt is needed, overlay_set returns before pipe
allocation or pipe data change, so this way can avoid mdp to work on
wrong pipe data

CRs-Fixed: 526377
Change-Id: I22e73d08bed920b366c18ee21b132339cf2a0347
Signed-off-by: Huaibin Yang <huaibiny@codeaurora.org>
Signed-off-by: Kalyan Thota <kalyant@codeaurora.org>
Merge "msm_fb:hdmi:Add DDC arbitration settings for HDCP."
Merge "msm_fb: Set DTV off if EDID read failed in LK"
Merge "Bluetooth: Handle HCI_SET_CONN_ENCRYPT cmd"
msm_fb: Do not vote for bus during suspend

Do not vote for bus during early suspend from MDP

Change-Id: I2978a7e847797085a4c5ca8ecff655fec7b28e46
Signed-off-by: Kalyan Thota <kalyant@codeaurora.org>
timer: Don't reinitialize the cpu base lock during CPU_UP_PREPARE

An inactive timer's base can refer to a offline cpu's base.

In the current code, cpu_base's lock is blindly reinitialized
each time a CPU is brought up. If a CPU is brought online
during the period that another thread is trying to modify an
inactive timer on that CPU with holding its timer base lock,
then the lock will be reinitialized under its feet. This leads
to following SPIN_BUG().

<0> BUG: spinlock already unlocked on CPU#3, kworker/u:3/1466
<0> lock: 0xe3ebe000, .magic: dead4ead, .owner: kworker/u:3/1466,
 .owner_cpu: 1
<4> [<c0013dc4>] (unwind_backtrace+0x0/0x11c) from [<c026e794>]
(do_raw_spin_unlock+0x40/0xcc)
<4> [<c026e794>] (do_raw_spin_unlock+0x40/0xcc) from [<c076c160>]
(_raw_spin_unlock+0x8/0x30)
<4> [<c076c160>] (_raw_spin_unlock+0x8/0x30) from [<c009b858>]
(mod_timer+0x294/0x310)
<4> [<c009b858>] (mod_timer+0x294/0x310) from [<c00a5e04>]
(queue_delayed_work_on+0x104/0x120)
<4> [<c00a5e04>] (queue_delayed_work_on+0x104/0x120) from [<c04eae00>]
(sdhci_msm_bus_voting+0x88/0x9c)
<4> [<c04eae00>] (sdhci_msm_bus_voting+0x88/0x9c) from [<c04d8780>]
(sdhci_disable+0x40/0x48)
<4> [<c04d8780>] (sdhci_disable+0x40/0x48) from [<c04bf300>]
(mmc_release_host+0x4c/0xb0)
<4> [<c04bf300>] (mmc_release_host+0x4c/0xb0) from [<c04c7aac>]
(mmc_sd_detect+0x90/0xfc)
<4> [<c04c7aac>] (mmc_sd_detect+0x90/0xfc) from [<c04c2504>]
(mmc_rescan+0x7c/0x2c4)
<4> [<c04c2504>] (mmc_rescan+0x7c/0x2c4) from [<c00a6a7c>]
(process_one_work+0x27c/0x484)
<4> [<c00a6a7c>] (process_one_work+0x27c/0x484) from [<c00a6e94>]
(worker_thread+0x210/0x3b0)
<4> [<c00a6e94>] (worker_thread+0x210/0x3b0) from [<c00aad9c>]
(kthread+0x80/0x8c)
<4> [<c00aad9c>] (kthread+0x80/0x8c) from [<c000ea80>]
(kernel_thread_exit+0x0/0x8)

As an example, this particular crash occurred when CPU #3 is executing
mod_timer() on an inactive timer whose base is refered to offlined CPU #2.
The code locked the timer_base corresponding to CPU #2. Before it could
proceed, CPU #2 came online and reinitialized the spinlock corresponding
to its base. Thus now CPU #3 held a lock which was reinitialized. When
CPU #3 finally ended up unlocking the old cpu_base corresponding to CPU #2,
we hit the above SPIN_BUG().

CPU #0			CPU #3				       CPU #2
------			-------				       -------
.....			 ......				      <Offline>
			mod_timer()
			 lock_timer_base
			  spin_lock_irqsave(&base->lock)

cpu_up(2)		 .....				        ......
							 init_timers_cpu()
.....		 	 spin_unlock_irqrestore(&base->lock)     ......
			   <spin_bug>

Allocation of per_cpu timer vector bases is done only once under
"tvec_base_done[]" check. In the current code, spinlock_initialization
of base->lock isn't under this check. When a CPU is up each time the base
lock is reinitialized. Move base spinlock initialization under the check.

CRs-Fixed: 471127
Change-Id: I73b48440fffb227a60af9180e318c851048530dd
Signed-off-by: Tirupathi Reddy <tirupath@codeaurora.org>
Merge "bluetooth: Add debug statements in BT power sequence"
Merge "bluetooth: Use correct Kernel API for deleting the transport timer"
Merge "Revert "msm_fb: display: free pipe if blt is detected for the pipe""