debug_mm: Only print pr_debug and pr_info if DEBUG.

Greatly reduces the logging of sound messages in the kernel. To enable the
logging, #define DEBUG before including debug_mm.h
msm: pm2: Use different API to get the next timer expiration

Use different API to get the next timer expiration. Replace
the existing API "tick_nohz_get_sleep_length" with
"msm_timer_enter_idle". Sometimes existing APIs giving less
timer expiration than what is required when the system decide
to enter into PC. This time is not sufficient for the system
to enter and coming out of the PC.

Signed-off-by: Murali Nalajala <mnalajal@codeaurora.org>
(cherry picked from commit 8dc6ff4d47fceff2b11ab1de7336b659ee10cb19)

Change-Id: Iae2ede92e06f8a16c8f43558d2766b746c6d453a
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>
msm: pm2: Update SPC LPM stats correctly

Currently StandalonePC stats are updating incorrectly even
for successful cases. After debug found that compiler has
optimized some of the instructions where the return value
from "msm_pm_power_collapse_standalone()" being compared
incorrectly and always log the stats as failed even for
success cases. Change the "exit_stat" variable to "volatile"
to avoid any optimization.

CRs-Fixed: 433578
Signed-off-by: Murali Nalajala <mnalajal@codeaurora.org>
(cherry picked from commit f59048d29fd75a30cac8c294e068178d9d489af3)

Change-Id: If1f9313f7968e93f5dcd9fb33426496f5091d14a
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>
msm: pm2: Restore interrupt subsystem from sleep.

Change-Id: Id5128e47e1e78688d0b608b64454555f26a65043
Signed-off-by: Sridhar Gujje <sgujje@codeaurora.org>
Signed-off-by: Baji Patthan <bpatth@codeaurora.org>
msm_fb: hdmi: update data on resolution change

On changing resolution, all information related to display
needs to be updated which helps in calculating the right mdp
clock for each resolution.

CRs-Fixed: 436151
Change-Id: I1ab6e5859491936a7fa8c62247da9ef5a0ff45ef
Signed-off-by: Ajay Singh Parmar <aparmar@codeaurora.org>
msm_fb: hdmi: Do not turn on HDMI if not ready

At bootup, if HPD is not configured, HDMI is not in
the state of getting turned on. This change makes sure
HDMI is not turned on/off unnecessarily which turns on
clocks as well.

CRs-Fixed: 447511
Change-Id: I074d9c463943770775b060c4a93b9120dfe9bcf0
Signed-off-by: Ajay Singh Parmar <aparmar@codeaurora.org>
msm_fb: display: free borderfill pipe when ref_cnt reach 0

Borderfill pipe need to be kept as baselayer which is not
suppose to be freed at suspend. It only be freed when
ref_cnt reach 0 by "adb stop".

CRs-fixed: 429196
Change-Id: Ibffe7960cc194162d1ba71e8dc8636393938483f
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
msm: vidc: Correct the decoder profile info assignment

Update the profile info in the sequence header with the
info which the core returns in the shared memory register.

(cherry picked from commit 5a60819aeb698b9d27937329bb5559a7a787a06e)

CRs-fixed: 408349

Change-Id: I6db75c907260c9744ec4e0d88db776be9bca8dea
Signed-off-by: Shobhit Pandey <cshopan@codeaurora.org>
Signed-off-by: Neha Pandey <nehap@codeaurora.org>
msm: vidc: Avoid memset of list elements in the buffer entry.

- Due to race condition between free buffer and flush output buffers,
  invalid buffer is getting accessed sometimes.
- Reset all the members in buffer entry except list elements.

(cherry picked from commit 8105df366cf6b9f1ddbc15d561fb6a5f12540416)
CRs-Fixed: 411197

Change-Id: Id95037f57d7fe4bc88b96f187953194ec838d63b
Signed-off-by: Srinu Gorle <sgorle@codeaurora.org>
Signed-off-by: Neha Pandey <nehap@codeaurora.org>
vidc: Free client context in error cases

Video driver should free client context when an error
is encoutered.

Signed-off-by: Gopikrishnaiah Anandan <agopik@codeaurora.org>
(cherry picked from commit 9683019e54e8a8c38b6019b781a9cbdf41b84b29)

Change-Id: I9868afadb01cc63df8e09426a8dd112b08f2bd4e
Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
msm:vidc: Add temporary buffer for MPEG-2 extension and user data.

Support is added to enable temporary buffer for processing
the MPEG-2 extension and user data for the first sequence
done.

Change-Id: Ib7fdc8bfd50bfb0da651e8da6fca26a3542c671e
Signed-off-by: Shobhit Pandey <cshopan@codeaurora.org>
Signed-off-by: Neha Pandey <nehap@codeaurora.org>
msm: vidc: Enable turbo mode based on client request.

- video core is bumped up to turbo mode, if more performance
  level required from multiple clients.

- Enable turbo mode atleast one of client set turbo mode.

Change-Id: Ied777463fdfe54ea6ff3b2a29cbaf0d27a9586cb
CRs-Fixed: 385454
Signed-off-by: Srinu Gorle <sgorle@codeaurora.org>
Signed-off-by: Neha Pandey <nehap@codeaurora.org>
vidc: 1080p: IDR picture type support for H264 format

Read IDR picture type from 1080p core register set
and propagate it to user space using IDR frame type
enumeration in api header file. The IDR frame type
info is used in SYNCFRAME logic for H264 format in
userspace.

Change-Id: I6f87aea9f3c6e26b06effe68f7cb5a6c17d4bb1c
Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>
Signed-off-by: Neha Pandey <nehap@codeaurora.org>
msm:vidc: add support for pause in eos state

This commit will add support for pause command in
eos state along with run state of the video driver.

Change-Id: I7edd064bb68845f63f0a085165e99f60ed0f3bfe
CRs-fixed: 387562
Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>
Signed-off-by: Neha Pandey <nehap@codeaurora.org>
msm:vidc: Add the support for MPEG-2 extension and user data

Support is added for MPEG-2 extension and user data. With this
changes Core returns extension and user data as an extradata.

Change-Id: I66a230aa651dabafa883625ce9f687d5c35b8671
Signed-off-by: Shobhit Pandey <cshopan@codeaurora.org>
Signed-off-by: Neha Pandey <nehap@codeaurora.org>
msm: vidc: enable video core clock to 266Mhz

This change will ensure that video core clock is
set to 266Mhz on supported devices, else fallback
to 228Mhz.

Signed-off-by: Arun Menon <menon@codeaurora.org>
(cherry picked from commit 2cd6f1a77d845c162966b974b0e9dd4db0878020)

Change-Id: Ie9d28b218150f2e21fa95c4d4346251ddab3ee50
Signed-off-by: Dhivya Subramanian <dthiru@codeaurora.org>
Signed-off-by: Neha Pandey <nehap@codeaurora.org>
vidc: Handle EOS with Codec config buffer.

Change will handle codec config buffer with EOS.
Video driver will make sure that the codec config buffer with
EOS will be requeued in case of reconfig and non-reconfig paths.

CRs-fixed: 399347
Signed-off-by: Gopikrishnaiah Anandan <agopik@codeaurora.org>
(cherry picked from commit 43b203869814fe5f0ddcb265a8f859aebdaa652f)

Change-Id: Ib9a41fb842d2295804db86b2e03a62238c29984d
Signed-off-by: Dhivya Subramanian <dthiru@codeaurora.org>
Signed-off-by: Neha Pandey <nehap@codeaurora.org>
msm_fb: HDMI: Add support for hdmi_audio switch node

- Add switch device node for hdmi audio on initialization.
- Final node path will be /devices/virtual/switch/hdmi_audio
- Set the node state to 1 when the HDMI EDID for the sink
  supports audio
- Set the node state to 0 otherwise(DVI)

Signed-off-by: Arun Kumar K.R <akumarkr@codeaurora.org>
msm: display: add delay after taking out the base layer.

During the blank sequence, base layer will be removed if mfd
reference count is 0. Need to add some delay to make sure it
takes effect before turning off panel.

Signed-off-by: Ken Zhang <kenz@codeaurora.org>
msm: vidc: fix buffer pool index

While searching for the available buffer entry in the buffer pool the search
should begin from index 1 as zeroth entry is reserved.

Change-Id: I051b0232bb782f073ba9ad0b757a799703814df3
Signed-off-by: Mohan Kumar Gubbihalli Lachma Naik <mgubbi@codeaurora.org>
Signed-off-by: Iliyan Malchev <malchev@google.com>