msm: msm_bus: Fix scaling of ocmem core clock

An optimization in bus driver prevents checking of slave clocks if
the clock of the NoC on which the slave is connected is not
touched.
Since ocmem slave is represented on a virtual NoC, the ocmem core
clock was not being scaled. Fix this by checking for status of
slave clocks.

Signed-off-by: Gagan Mac <gmac@codeaurora.org>
(cherry picked from commit b0295975eb22ef7872680f5da16cea1a3a39795d)

Change-Id: I4518dbadda2010493fcc212b192693eb8557a10e
Signed-off-by: Gopal Goberu <ggober@codeaurora.org>
msm_fb: display: Update mdp clocks based on perf patch

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

Signed-off-by: Siddhartha Agrawal <agrawals@codeaurora.org>
(cherry picked from commit 97452dc0282fd964b4faed8b19000c0109334355)

Change-Id: I7627ac983676d33f80096811e3eb265625ed1eeb
Signed-off-by: Gopal Goberu <ggober@codeaurora.org>
msm_fb : display : Block RGB downscale in MDP 4.0 and 4.1

Downscale is not allowed on RGB pipes in MDP 4.0 and 4.1. Hence,
fail the OVERLAY_SET ioctl for such configurations.

Signed-off-by: Pradeep Jilagam <pjilagam@codeaurora.org>
(cherry picked from commit 3545573720822ce97ec37586f10fdf74a6d4f090)

Change-Id: I8445c18ac21cb7322eb9eb4c802623df5da07eb7
Signed-off-by: Gopal Goberu <ggober@codeaurora.org>
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.

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

Change-Id: I5050a8fd2654e0b6abeb17068e5fe85d756b5b1e
Signed-off-by: Gopal Goberu <ggober@codeaurora.org>
board: msm: Add settling delay for display resume.

This change adds minimal delay to allow for settling time
of MIPI DSI Bridge reset chip after it comes out of the
reset sequence.

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

Change-Id: Ie466c829498cf0690b2c2ca1f8380b59f4661bbf
Signed-off-by: Gopal Goberu <ggober@codeaurora.org>
f_rmnet: Don't register for already registerd SMD platform driver

currently, USB driver is registering for platform driver that is
already registered. Avoid this multiple registrations.

CRs-fixed: 403650
Signed-off-by: Chiranjeevi Velempati <cvelempa@codeaurora.org>
(cherry picked from commit c49315c03a49a703224d0e972da07f5b5acb01e1)

Change-Id: I38a93ec2bf1082b190d4e6e5082e3c06768ea5aa
Signed-off-by: Gopal Goberu <ggober@codeaurora.org>
msm-camera: Enable VFE stop pending

In snapshot mode, vfe drivers sets stop pending flag if the snapshot_done
is not completed and the command will be sent after snapshot done message
from VFE.

CR'S-Fixed:401771

Signed-off-by: Katta Santhisindhu <kattas@codeaurora.org>
(cherry picked from commit 863e6feff9483e68c78f9297cff305541505be64)

Change-Id: I450348c9bde97620c8eb07293172d1f73b3653b4
Signed-off-by: Gopal Goberu <ggober@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.

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

Change-Id: I0dd27c5be093fe009b161618d0f32b402558a508
Signed-off-by: Gopal Goberu <ggober@codeaurora.org>
msm: cpr: Use Consecutive Down to avoid any spurious interrupt

CPR would now route a down interrupt to App only when the
recommendation remains same across 2 successive interrupts
thereby reducing any interrupts resulting from a spike
during sampling.

Signed-off-by: Kaushal Kumar <kaushalk@codeaurora.org>
(cherry picked from commit a6bad692980fe23aebe4692357831ef47b07ec1d)

Change-Id: Ic4568644ad0ad656e81edce636d0051044446d66
Signed-off-by: Gopal Goberu <ggober@codeaurora.org>
msm: cpr: Top up the Quot for 1.2GHz, 1.0GHz MSM

Fused Quot value for 1.2GHz on a 1.2GHz part is lower than
the quot value calculated using the scaling factor formula for
1.2GHz when running on a 1.4GHz part. So, prop up the Quot for
a 1.2GHz part by a chip characterization recommended value.
Ditto for a 1.0GHz part.

Signed-off-by: Kaushal Kumar <kaushalk@codeaurora.org>
(cherry picked from commit bcb46d9c47e944e828a3101c61d8caa50241640e)

Change-Id: I8e41f5a6bd58dbdaef87445fc98923547f4afc06
Signed-off-by: Gopal Goberu <ggober@codeaurora.org>
msm: cpr: Limit down step to avoid sudden drops

It has been observed that CPR could recommend more than 4 steps
down followed by equal steps up in certain load situations. To avoid
breaching the system level Vmin which is around 4 steps below, it
is safe to climb down 2 steps at a time and avoid any breach of
minimum voltage requirement. This allows CPR to re-sample and avoid
sudden drop from where it cannot recover.

Signed-off-by: Kaushal Kumar <kaushalk@codeaurora.org>
(cherry picked from commit 358861e1f596adae060105fbbfcaa10666123ae1)

Change-Id: I719d03407efa19e5a1a49a2a5d25d4da6a024469
Signed-off-by: Gopal Goberu <ggober@codeaurora.org>
msm: cpr: Clear the interrupts on any state change

Clear the interrupts before enabling CPR sampling and before
saving state during suspend

Signed-off-by: Kaushal Kumar <kaushalk@codeaurora.org>
(cherry picked from commit 0aae7433ae51d054bda422f394af92a753eb41ba)

Change-Id: I577c9d34d99805cdf05fc9db89b63834f9196a9b
Signed-off-by: Gopal Goberu <ggober@codeaurora.org>
msm: devices-msm7x27a: Add PVS table values for 8625v2.0 CPR

Based on the characterization data of the 8625v2.0 CPR
it is recommended to use new table with maximum pvs voltage
set to 1.35v.

Signed-off-by: Trilok Soni <tsoni@codeaurora.org>
(cherry picked from commit 9573ce35e024cae752ac65e48f2d582e156a382b)

Change-Id: If4da85bf34a83d480f60a8ea035b0280972c8de4
Signed-off-by: Gopal Goberu <ggober@codeaurora.org>
msm: cpr: Define Vmin based on fused bits in MSM

As per chip charactrization data, it is observed that
minimum voltage requirement is variable and should be
based on the fused bits as per chip characteristics.

Signed-off-by: Kaushal Kumar <kaushalk@codeaurora.org>
(cherry picked from commit 74b62fef69062b32ea67deaafcb473b00140fb54)

Change-Id: If682bf3fbe2333f668d61ced8bb731bbdb992db4
Signed-off-by: Gopal Goberu <ggober@codeaurora.org>
msm: cpr: Use 1.1V as default until floor fuse bits are set

Use 1.1V as nominal and turbo Vmin until devices have their
floor_fuse bits blown with chip charactrization based values

Signed-off-by: Kaushal Kumar <kaushalk@codeaurora.org>
(cherry picked from commit b787afbb6387a0db9c8f0167938a74d5bf9a8fa8)

Change-Id: I30886254b4629a2f278082a01665e4bac5045a9c
Signed-off-by: Gopal Goberu <ggober@codeaurora.org>
msm_fb: hdmi: Soft debouncing logic improvements

Currently, HPD(Hot Plug Detection, a module used for detecting
HDMI cable connection) soft debouncing logic implements around
1 sec mechanism to stabilize HPD event detection. In case of
fast HPD connect/disconnect, it is missing a real HPD event.
This change implements a new debouncing logic in driver which
will make sure the first real HPD event is correctly processed
and at the end of debouncing processing, if there is a change
in HPD state, the changed state is also processed. This way we
always process the change of HPD states.

CRs-Fixed: 384513
Signed-off-by: Ajay Singh Parmar <aparmar@codeaurora.org>
Signed-off-by: Aravind Venkateswaran <aravindh@codeaurora.org>
(cherry picked from commit df6b645836bafcca027bd0820a477e86cf767823)

Change-Id: Icaa444d06107af15d1683db7d3104d7f1f98c7f3
Signed-off-by: Gopal Goberu <ggober@codeaurora.org>
msm: rpc: invalidate data structures during close

When device powers down, RPC Router close can get called from both the
reboot notifier and from the platform driver remove resulting in an
access-after-free bug.

Invalidate internal data structures and check for NULL to gracefully
handle multiple close operations.

CRs-Fixed: 394129
Change-Id: I9d16afdef4962e48e2d45e9523441744b6611b00
Signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
msm_fb: display: log error if pipe still staged during set

Pipe is not un-staged from mixer when it is unset.It
expects a pan_display() to un-stage it from mixer. Log
an error message at overlay_set() if pipe is still
staged at mixer.

Change-Id: Icb256e7feb3ce68baf2f7e9a25cd63b1a21ce270
Signed-off-by: Pradeep Jilagam <pjilagam@codeaurora.org>
(cherry picked from commit 6c7de58326fdccf2f298ec7b9767527b22f2562c)
msm: camera: Fix camcorder hang for 120 fps with aptina 8MP

Increasing the vfe_clk_rate to max in board file for streaming
HFR 120 fps.

CR Fixed:406997
Signed-off-by: Mayank Agarwal <magarw@codeaurora.org>
(cherry picked from commit 038bcce1eff978f4e506becf02f46b7bb9d2b0a3)

Change-Id: Ie3be36b628c9e80448427ee518b66d387ea1f9df
Signed-off-by: Gopal Goberu <ggober@codeaurora.org>
msm: camera: fix bus vectors during client registeration

Initializing correct bus vectors during client registeration

Signed-off-by: Mayank Agarwal <magarw@codeaurora.org>
(cherry picked from commit 973870a517680279c86c2486bd32e61b6a2c4c50)

Change-Id: I2e8aca650640fd9bd0e33194c9ad6bb1fa28df35
Signed-off-by: Gopal Goberu <ggober@codeaurora.org>