Bluetooth: Send Disconnection reason to Bluez

Send device disconnection reason to bluez on receiving the
diconnection complete event so that low energy profiles
such as proximity can decide to reconnect if the reason
is link loss.

CRs-Fixed: 378240
Signed-off-by: Archana Ramachandran <archanar@codeaurora.org>
(cherry picked from commit da09d26a75ee1c7c1911dcfbe0128fd09f6631f4)

Change-Id: I7aa5ed6685e96c936b9c9513eebe4e16bc10269e
Signed-off-by: Gopal Goberu <ggober@codeaurora.org>
Revert "video: msm: Add support for VSYNC notify via sysfs"

This reverts commit 887b97777005d4c05680bd7833353328036328cc.
msm_fb: display: free base layer pipe at adb stop.

Base layer pipe need to be freed at adb stop so that same
pipe can be allocated at adb start.

CRs-fixed: 390644
Change-Id: I948bb27687cfe1c96cc3b071b7bb9bb84b2c52c6
Signed-off-by: Kalyan Thota <kalyant@codeaurora.org>
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
(cherry picked from commit 7e73b56cb67779bc700938acbb226dd99d361882)
msm_fb: display: Update mdp clocks based on perf patch

MDP clock was not getting updated to the correct values
causing underrun issues.

Change-Id: Ic3efdccc72153d759d2df1dfd3de710b5253e868
Signed-off-by: Siddhartha Agrawal <agrawals@codeaurora.org>
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.

Signed-off-by: Mayank Chopra <makchopra@codeaurora.org>
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
Signed-off-by: Siddhartha Agrawal <agrawals@codeaurora.org>
Signed-off-by: Padmanabhan Komanduru <pkomandu@codeaurora.org>
(cherry picked from commit 48e146f4fa267252550d586565c650352a9091b3)

Change-Id: I0df3c27d1cb4a1b5eab93685dce61aa0f025405b
Signed-off-by: Gopal Goberu <ggober@codeaurora.org>
msm_fb: display: Make sysfs read request interruptible

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

Signed-off-by: Mayank Chopra <makchopra@codeaurora.org>
Signed-off-by: Padmanabhan Komanduru <pkomandu@codeaurora.org>
(cherry picked from commit b7ff5ef4e482d621e3f6bc129c2a52fe379e86a5)

Change-Id: Ia1de744d5852b76be1a3b9d2e759776d0811c0f1
Signed-off-by: Gopal Goberu <ggober@codeaurora.org>
msm_fb: Send vsync events using sysfs for 8x55

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

Signed-off-by: Padmanabhan Komanduru <pkomandu@codeaurora.org>
(cherry picked from commit 3643386f77e31c8c43be4d5bb76314964e2c39af)

Change-Id: I8da728973b475bdd53c66e375580e3f3920aeea4
Signed-off-by: Gopal Goberu <ggober@codeaurora.org>
msm_fb: display: fix division-by-zero bug

Panel v_back_porch could be zero for virtual panels, so the check for
zero is added to fix the bug.

Signed-off-by: Huaibin Yang <huaibiny@codeaurora.org>
(cherry picked from commit d49fe89aa7eb042947a64f1d5b5f12f54d2c033b)

Conflicts:

	drivers/video/msm/mdp4_overlay.c

Change-Id: I48808daf26afd3b10b24f58c10068a7e11da40a5
Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
msm_fb: display: add mdp clk rate calculation for low vbp

For the panels that have low v_back_porch, if h/w FIR scaling is used,
during vbp time, mdp clk should be fast enough to output a line from 4
input lines. MDP rate equation for very small scaling, e.g. 1 or 2
pixels' upscaling or downscaling cannot cover this case, where
underruns are seen on those panels.

Signed-off-by: Huaibin Yang <huaibiny@codeaurora.org>
(cherry picked from commit e9d4bc826ca849b873f9e91bda68004aa7d78b25)

Conflicts:

	drivers/video/msm/mdp4_overlay.c

Change-Id: I63aadf8e322c17fad2019b2c4081b0d13209f504
Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
msm_fb: display: fix the underrun issue when playing interlaced videos

Interlaced videos require higher mdp clk rate and the current code
sets mdp clk to max and return. However mdp clk calculation may still
give a result higher than max mdp clk, for this case the result is
kept and used later to enable blt mode to avoid underrun.

Change-Id: I185d0d15e5b79e94561e790e41713cdb405f8bf4
Signed-off-by: Huaibin Yang <huaibiny@codeaurora.org>
(cherry picked from commit 5dcea9b4522d3bdc1a0fe38406881b264ce074b8)
msm_fb: display: fix division-by-zero bug

Panel v_back_porch could be zero for virtual panels, so the check for
zero is added to fix the bug.

Signed-off-by: Huaibin Yang <huaibiny@codeaurora.org>
(cherry picked from commit d49fe89aa7eb042947a64f1d5b5f12f54d2c033b)

Change-Id: I7da4d37c90f6830335a2d818eaae15c78a19c0b5
Signed-off-by: Gopal Goberu <ggober@codeaurora.org>
msm_fb: display: add pipe commit ioctl

currently, pan display serves as pipe commit. However it
may spend long time pending on cosole_lock() which cause
flickering on HDMI. Add pipe commit ioctl to allow commit
from overlay in addition to pan_display.

CRs-fixed: 391564

Conflicts:

	drivers/video/msm/mdp4_overlay_dsi_video.c
	drivers/video/msm/mdp4_overlay_lcdc.c
	include/linux/msm_mdp.h

Change-Id: Ifdca49007267761bb6b949b3d932a6472e5a6d32
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
Signed-off-by: Jeevan Shriram <jshriram@codeaurora.org>
msm_fb: display: proper mdp core clock selection for 7x30

Add proper calculation for MDP core clocks for MDDI panel.
Also, add 10 % blanking in the case where the panel where
horizontal and vertical porch values are not available.

Change-Id: I63b7ac902f6826dd300e385c42e7eb975d6390c5
Signed-off-by: Jeevan Shriram <jshriram@codeaurora.org>
msm_fb: Calculate mdp core clock during every pan display

Calculate the mdp core clock value for MDDI panel for every pan
display. This helps in setting the clock only to the required
value based on the use case.

Change-Id: I40f8be9835a8993733b94393e363a393b7efb000
Signed-off-by: Jeevan Shriram <jshriram@codeaurora.org>
msm_fb: Avoid race condition for MDDI pan updates

Extend the scope of mutex lock to cover all the actions
for MDDI pan update. This avoids uncontrolled updates for
clocks and other control structures.

Change-Id: I0b3e4366f15bd4fe2da9051a8db58a5e529bca9f
Signed-off-by: Jeevan Shriram <jshriram@codeaurora.org>
msm_fb: display: Fix blend configuration for command mode panels

For command mode panels, do the blend configuration in play call
itself instead of doing in isr.

CRs-Fixed: 410029
CRs-Fixed: 415553
Signed-off-by: Mayank Chopra <makchopra@codeaurora.org>
(cherry picked from commit 9b2be0d1adabacfbe539a4e7f05f6d6e5579c611)

Change-Id: I638b27e445c0c4b6c98ff9bee0a3055e87caead4
Signed-off-by: Gopal Goberu <ggober@codeaurora.org>
msm_fb: display: Avoid MDP clock disable during DMA update

MDP Core clock gets disabled by clock control thread during Idle
screen update with MDDI. But, this thread's action can conflict
with a late frame update call. This change adds safety checks to
avoid this conflict. Also adds a change to avoid the core clock
going below minimum required value for MDDI.

Change-Id: Ia0701994b814c29220a048fa83ed43b60a89a11a
Signed-off-by: Jeevan Shriram <jshriram@codeaurora.org>
msm_fb: display: quick workaround to fix build