diag: Fix race condition for HSIC while in MEMORY_DEVICE_MODE

A race condition can occur when in MEMORY_DEVICE_MODE and
there are high amounts of data being read from the HSIC bridge
driver. In MEMORY_DEVICE_MODE, in the first thread the data read
from the HSIC is buffered up and a data ready bit is set. This first
thread runs in interrupt context. Later a second thread will process
the buffered data and clear the ready bit. This second thread runs in
process context. In high data throughput cases, the first thread can
add more data and set the data ready bit inbetween the second thread
processing the buffered data and clearing the data ready bit. In this
case there is data that is buffered and the data ready bit is clear. Make
modifications to protect the setting and clearing of the data ready
bit.

Change-Id: I1dfd52c55b40ab64cbb11fdcf90e5663dbbb3e87
Signed-off-by: Dixon Peterson <dixonp@codeaurora.org>
arm: defconfig: msm8226: Enable THERMAL_QPNP_ADC_TM

Enable THERMAL_QPNP_ADC_TM which QPNP_CHARGER depends on
For charger feature enable support.

Change-Id: I29351b41c4fb3dda28f2f4926f0ace2869187324
Signed-off-by: Fenglin Wu <fenglinw@codeaurora.org>
board: msmzinc: Add memory reservation infrastructure

The memory reservation code requires functions and
data structures to be able to do anything useful.
Add the necessary parts.

Change-Id: Iaabea9d84aee1c1c7fd58af4ad8344a4f8dfc4e4
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
ASoC: wcd9xxx: Enhance OCP reporting logic

CODEC has over current protection(OCP) finite state
machine for both left and right headphone while CODEC
driver tries to delay reporting of OCP event after
CODEC reporting OCP two times. Current CODEC driver
implementation results in unlocking one of headphone
power amplifier when OCP reported on both headphone.
Change the behavior to report OCP event for a give
headphone immediately if OCP already occurs on opposite
headphone.

Change-Id: Icd819737db289a688a993ba5e5f47967ae14a0d8
Signed-off-by: Patrick Lai <plai@codeaurora.org>
ASoC: wcd9320: correct headphone event type

When headphone power amplifier event callback is being called,
wrong headphone event type is passed to CODEC resource manager.
This results in headphone over current protection status not getting
cleared.

Change-Id: I30a949029e0bb38e569aa6984e703dcc0d878c54
Signed-off-by: Patrick Lai <plai@codeaurora.org>
msm: camera: store queued buffers in local list.

Store all queued buffers in a protected local list
in the stream strcuture. All subsequent hardware requests
for buffers are fulfilled from this local list. This was done
becasue there was no staright-forward way to protect the inherent
vb2 queued_list.

Change-Id: Ib4f83d4eab933104a6c0fd45ef02ca8010f3dfe3
Signed-off-by: Ankit Premrajka <ankitp@codeaurora.org>
Signed-off-by: Sunid Wilson <sunidw@codeaurora.org>
ASoC: wcd9xxx: Fix incorrect detection of mbhc plug type

When MBHC detects plug type as headset or headphone, hphl
status should be 1 in all the DCE measurements. Where as
in case of euro headset hphl status should be 0. Declare
invalid plug type if the above conditions are not satisfied.

Change-Id: I1b8d687904942425eba0759785e6625575b1a308
CRs-fixed: 461300
Signed-off-by: Phani Kumar Uppalapati <phanik@codeaurora.org>
coresight: OS unlock for non-krait CPUs using memory mapped access

On CPUs which implement OS lock mechanism, the ETM driver needs to unlock
the OS lock in order to configure ETM registers. Implement OS unlock on
CPUs using a memory mapped access instead of cp14. This is necessary on
CPUs which implement OS lock mechanism and provide only memory mapped
accesss to ETM registers.

Change-Id: I1559cc32e77a5d3cd42badf4f81ca253cd316f5d
Signed-off-by: Pushkar Joshi <pushkarj@codeaurora.org>
msm: mdss: Program DSI regulator config from device tree

Regulators needed for DSI controller can vary based on the
platform and should be specified in the corresponding device
tree node. This change parses power related data from the
device tree and uses the existing power configuration utilities
to configure the regulators.

Change-Id: I7e57fa4b17d540acefba58e050cf8057d05637a3
Signed-off-by: Aravind Venkateswaran <aravindh@codeaurora.org>
arm/dt: msm8226: Update gpio configs used by audio

pmic gpio 1 is used by tapan codec to enable the codec
clock. update entries for this gpio for cdp / mtp and qrd
platforms.

Change-Id: Ia35b83cd9eeb63551491581ee7e62081e49ec953
Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
ASoC: msm8226: Add support to enable codec external MCLK

Add support to enable the clock and the PMIC GPIO needed for
clock used by WCD9306 codec.

Change-Id: Icd50d7b929821f79ad3eca9a02175dd72c27c1ac
Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
arm/dt: msm8226: Add support for low latency audio driver

Add the device for low latency audio support.

Change-Id: I721a91b678b156395bbc3e7d6ec2ab8f344ef41e
Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
ASoC: Add support for low latency audio playback

Add the dai link for low latency audio playback

Change-Id: I757cad36e8db16f9924f59774309d43921371184
Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
msm: wdog_debug: switch to using scm call to disable wdog debug

To enable TZ to lock down (for security reasons) the wdog debug
and boot partition select registers, switch to using scm call to
disable wdog debug and/or clear boot partition select register.

CRs-Fixed: 459479
Change-Id: If09b25d73a25e59b4d6afbfbe7ee2bd07afb83c8
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
msm: Account for unaligned memory hole

The memory hole is required to be section size aligned. The
PMD size internally may be greater than the section size. If the
end of the memory hole is not PMD aligned, we may end up with the
case where the physical address is PMD aligned but not the virtual
address or vice versa. This results in crashes in features such
as CMA that (reasonablly) assume that the virtual address will be PMD
aligned if and only if the physical address is aligned. Account
for this in the memory hole code by aligning the virtual address
up to PMD_SIZE if there is a mismatch with the physical address.
This does result in a loss in virtual address space but the
amount should be small compared to what is gained by by turning
on CONFIG_DONT_MAP_HOLE_AFTER_MEMBANK0. The virtual address loss
will go away if the memory hole is properly aligned to PMD_SIZE.

Change-Id: I985568a7cc6bc22bdd65586111ff078ab61b6c34
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
coresight: 8610: clock support for coresight driver

Add clock support for coresight driver in preparation for
enabling coresight debug support on msm8610

Change-Id: I261d4c4acd366ac9dc7a943785b543434d1017ad
Signed-off-by: Aparna Das <adas@codeaurora.org>
arm/dt: 8226: Add ETM device tree nodes

Embedded Trace Macrocell is part of coresight tracing infrastructure.
ETM processor trace enables instructions and data tracing. Add device
tree entries for ETM on 8226.

Change-Id: I22245b0772517ef66f42bda5507aee9f3d9e65e9
Signed-off-by: Pushkar Joshi <pushkarj@codeaurora.org>
msm: clock-8226: clock entry for Debug, ETM register save-restore

MSM8226 requires the debug and ETM registers to be saved and
restored on each power collapse. This clock enables memory mapped
access to these registers to save and restore them.

Change-Id: I64a2f141ee8a481ff577626cdb58b981b0542019
Signed-off-by: Pushkar Joshi <pushkarj@codeaurora.org>
msm: kgsl: Copy data back to user in case of error

In case of an error, copy back any data that KGSL might
have changed on purpose.  This is to prevent the user from
ignoring the error and using the values that were passed in.
This means that in error cases, KGSL needs to be mindful
and reset certain values (such as a buffer size to 0) before
returning the error to the user

Change-Id: I9201ce4361c9fd1d6477f18c67f5c651e8408bd2
Signed-off-by: Carter Cooper <ccooper@codeaurora.org>
msm: camera: Remove references to CONFIG_ANDROID_PMEM

CONFIG_ANDROID_PMEM is completely deprecated. Remove
all references to it.

Change-Id: I5033f51458d71fe8afcda3faa937c3da1ba31900
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>