msm: wfd: Clean up code in mdp subdevice

Just a general cleanup of code in the mdp5 subdevice.  Also fixed a minor
bug in which we called msm_fb_get_writeback_fb() twice for no good
reason.

Change-Id: I805f5f2e5e04d365cd0d93281a0c835940cea0fe
Signed-off-by: Deva Ramasubramanian <dramasub@codeaurora.org>
arm/dt: msm8974: Add SMBB boost regulator support for flash

Add SMBB boost regulator in flash led node to allow flash LED
to use that regulator.

CRs-Fixed: 473004
Change-Id: I734b9f1ab8ccf33ccc9589fb4ae9ffb50135fb9d
Signed-off-by: Chun Zhang <chunz@codeaurora.org>
leds: leds-qpnp: Utilize SMBB Boost Regulator for flash LED

Enable SMBB boost regulator when flash LED is turned on in flash
mode and disable it when flash LED is turned off. This avoids
losing USB when flash is turned on.

Change-Id: I31f22dc0f127bd4765466621e3c0882e15838d22
Signed-off-by: Chun Zhang <chunz@codeaurora.org>
msm: vidc: Set V4L2_BUF_FLAG_KEYFRAME for IDR frames also

All IDR frames are also KEYFRAMEs, as such set the KEYFRAME flag
whenever we encounter an IDR frame.

Change-Id: Ia36171ba89c792bcdfcf532181d7e577ebdb5fbb
Signed-off-by: Deva Ramasubramanian <dramasub@codeaurora.org>
mdss: display: return proper value at wfd wait4comp

Return 0 at wait4comp to indicate there is no timeout happen.
Otherwise return non 0 to indicate error.

Change-Id: Id801dc49df530830ab691e6b1746741236760d10
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
ASoC: msm: qdsp6v2: fix wait_event_timeout return value check

wait_event_timeout returns 0 when it timed out.  Fix if statement where
checks negative return for timeout.

Change-Id: Ief45e41b4c138a983c14728085e411f6b26566f0
Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
ASoC: msm: qdsp6v2: fix improper usage of atomic operations

There are improper usages of atomic operations that call read decreased
counter with atomic_dec() and atomic_read() while decreament and read
should be atomic.  This is not correct as there is possibility of
preemption between two of operations.
Use atomic_sub_return and coresponding macro to be whole operation is
atomic.

Change-Id: I358bc74c7454c0fd193f284d5358198f14d1d70e
Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
ASoC: msm: qdsp6v2: deliver correct return value

Deliver proper return value by carrying verdict of function calls.

Change-Id: I16f1428d6c1d50e0786ff11af1499b5bd5a298a1
Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
ASoC: msm: qdsp6v2: fix possible race condition

It's possible command callback got called earlier than setting flag.
Set the strobe flag before sending command to make sure it can be cleared.

Change-Id: I550e211c4d1b2a6d2b5d961bee830600a44550ab
Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
ASoC: msm: qdsp6v2: fix broken unmap memory regions

Current adm_memory_unmap_regions() does nothing since the packet size
was filled with zero.  This consequently fixes following memory map error
which was due to double memory mapping.

CRs-fixed: 491669, 487082
Change-Id: I1d1722fd5d10d1cfeb618e3329c84f4e2a71a477
Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
usb: ehci-msm-hsic: fix runtime suspend when IPA not used

Commit aa165c5ce19e06d23b70b2829d555a3a4a09b4cc "ehci: hsic: add
suspend/resume handshake with ipa resource manager" introduced a
bug in which the controller does not enter runtime suspend even
though all its child devices are suspended. This was caused by
an errant call to pm_runtime_get() by the usb_bam driver, which
unless the "consider_ipa_handshake" feature is enabled, has no
other means to decrement the PM counter until the driver's
remove() is called.

As the usb_bam interaction is only used in the case of the new
"consider_ipa_handshake" flag, fix the problem by only calling
msm_bam_set_hsic_host() if the flag is set.

Change-Id: I175ef08118d40d1ccb4b3192fb070701ea80060c
Signed-off-by: Jack Pham <jackp@codeaurora.org>
power: qpnp-charger: check base address in qpnp_chg_write/read

When one of the peripherals is not initialized it may occur
that an incorrect register may be attempted to be written.

Fix this by adding a check for the base address when attempting
a spmi read or write.

CRs-Fixed: 495966
Change-Id: I6d9fd3fe747992e5e601cef210eb19875ce9036c
Signed-off-by: David Keitel <dkeitel@codeaurora.org>
msm: ipc: Load default subsystem under appropriate scenario

Only client and service ports are used for communication with the remote
subsystems. Load the default subsystem only when the clients lookup their
services or when the local services get registered with the IPC Router.

Change-Id: I18729bb849c656a826de4f67f9ffe159dd3cf5f6
Signed-off-by: Karthikeyan Ramasubramanian <kramasub@codeaurora.org>
ARM: dts: msm: Remove power down sequence in L2 memory.

Remove L2 memory array power control from the SPM sequences,
To fix droop issues seen on the memory rails.

Change-Id: I75c1f65f8e33232bcbecc7b3597c8ea9fa4df806
Signed-off-by: Karthik Parsha <kparsha@codeaurora.org>
msm: gdsc: Separate CORE and PERIPH memory retention control

Currently, a single device tree property determines whether core
memory and peripheral memory should be collapsed along with the
core's logic. For greater flexibility, split this into two device
tree properties.  The functionality that was previously part of
'qcom,retain-mems' is split into 'qcom,retain-mem' and
'qcom,retain-periph'.

Current users of 'qcom,retain-mems' are updated accordingly.

Change-Id: I5a77cab5cda5482aa22b9d19b77e4816b0324eca
Signed-off-by: Matt Wagantall <mattw@codeaurora.org>
arm/dt: msm8974: Enable MDSS periph memory retention

For potentially-improved system stability, disable MDSS
peripheral memory collapse.

Change-Id: Ib76f2b9e84f0a13cda8ae5f3309268063229419d
Signed-off-by: Matt Wagantall <mattw@codeaurora.org>
msm8974: mdss: dsi: uncached alloc for dsi buffer

Use uncached allocation for DSI buffers to avoid
cache inconsistency issues introduced with SLUB
DEBUG option enabled. With SLUB_DEBUG, the entries
in cache are somehow polluted which results in incorrect
dsi command values sent to the panel. This change avoids
cached allocation by using dma allocation instead.

Change-Id: Ib769e91d411bf856e7d2e860cff7c1188ff0236e
CRs-Fixed: 488236
Signed-off-by: Manoj Rao <manojraj@codeaurora.org>
msm: vidc: Update the minimum supported bit rate for encoder

Venus FW supports minimum bit rate of 32kbps. This change updates
the kernel driver to allow the clients to configure bit rate from
32kbps to 160mbps.

Change-Id: I1663275a5f8affcdad545d1e7e73ab7c5d229ebe
CRs-Fixed: 494836
Signed-off-by: Praneeth Paladugu <ppaladug@codeaurora.org>
msm: mdss: correctly retrieve panel framerate for command mode

Framerate is populated for DSI panels including video mode and command
mode. Retrieve this framerate for command mode panel.

Change-Id: If005dc9aa8383d2afe5beb1123797460ceba027a
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
msm: vidc: (Re-)Centralise event notifications

kernel_event_queue needs to be woken up each time v4l2_queue_event_fh is
called.  Helper function to facilitate this was private within common.c.
This commit makes it available to rest of the driver.

Change-Id: Ide050d06841857e00ea7f7ecacd6a2101c8a4115
Signed-off-by: Deva Ramasubramanian <dramasub@codeaurora.org>