defconfig: Enable WCNSS register dump on WCNSS bite

When Apps recieves a WDOG bite from WCNSS, collecting a register
dump of WCNSS is helpful to root cause the failure.

Change-Id: I08987fe6dd0f660607bf6b1edcf32b590f1cccaf
Signed-off-by: Sameer Thalappil <sameert@codeaurora.org>
msm: clock-8610: Allow measurement of clocks in the WCNSS

For debugging reasons, it is required that WLAN drivers
be able to measure clocks in the WCNSS subsystem. It is
assumed that the WCNSS debug mux is already programmed
by the WCNSS firmware.

Change-Id: If3ebbe680347aa62d6c706f1518dda4585b90a74
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
msm: clock-8226: Allow measurement of clocks in the WCNSS

For debugging reasons, it is required that WLAN drivers
be able to measure clocks in the WCNSS subsystem. It is
assumed that the WCNSS debug mux is already programmed
by the WCNSS firmware.

Change-Id: I3e7411021200a96454f37a1d40a17b109be4fc70
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
msm: clock-8974: Allow measurement of clocks in the WCNSS

For debugging reasons, it is required that WLAN drivers
be able to measure clocks in the WCNSS subsystem. It is
assumed that the WCNSS debug mux is already programmed
by the WCNSS firmware.

Change-Id: Ia1bc054f8dd8bd51e62046c9ea71624a22bc890e
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
ASoC: wcd9xxx: Do not acquire codec resource lock to get hph impedance

Acquiring codec resource lock within get impedance function may
cause deadlock when headset inserted/removed repeatedly. Remove
the lock as it is not required to be protected with a mutex.

CRs-fixed: 597226
Change-Id: I245a09eb37ccf44d5fddff73cd279001a22c6a2b
Signed-off-by: Phani Kumar Uppalapati <phaniu@codeaurora.org>
mmc: core: Issue with voltage switch sequence

When a broken UHS-I card is inserted, the voltage switch sequence
fails as expected but the controller is left in bad state due to
which software request timeouts are observed for further commands.
Add mmc_power_cycle() for any failure in voltage switch so it will
also help reset the controller in addition to card.

CRs-fixed: 608192
Change-Id: I332c0717b9310692799b9a4ba6570df67fcf3b6e
Signed-off-by: Sahitya Tummala <stummala@codeaurora.org>
ASoC: msm: Add check for both offset and index variable

-The offset and index variable may leads to array out of
boundary exception.
-Added offset and index overflow check.

Change-Id: I1f71ee595944573e85d77d2001f656bd8ba53806
CRs-fixed: 583931
Signed-off-by: Mohammad Johny Shaik <mjshai@codeaurora.org>
ASoC: msm8x10-wcd: Add gain controls for ADC gains

Add the mixer controls to control the analog gain on the TX path
of the codec. This gain is applies to the ADC on the path. These
mixer controls will be used by higher layer to set desired gain.

Change-Id: Ic255f83238e8e06d31786c149743ec67cdfd6f87
Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
power: qpnp-bms: estimate OCVs based on temperature

The BMS driver will throw out the hardware taken open circuit voltage
(OCV) if there has been a warm reset and the PMIC did not go through
the power on sequence. This is to throw out the stale OCVs from the
last boot.

However, if there is no shutdown SOC stored, the BMS driver must
estimate an OCV. When estimating an OCV, there is no information about
the battery state of charge yet, so the default battery resistance is
used to do the estimation. However, this only works in cases where the
battery temperature is not cold.

When the battery temperature is cold, the real rbatt will be much larger
than the default rbatt. If the default rbatt is used, the estimated OCV
will most likely be much too low, and a faulty SOC will be used. This
issue is exacerbated by the fact that the shutdown SOC is thrown out
when the battery is cold, so this situation can arise much more
frequently.

Fix this by estimating the battery OCV based on temperature and just
using a default rbatt SOC of 50%.

Change-Id: Ibc89fcd74a295bb2196be2d8c977e8b1b8598d7a
Signed-off-by: Xiaozhe Shi <xiaozhes@codeaurora.org>
ion: invalidate buffers before zero'ing

Currently, we invalidate the cache for buffers being zero'd *after* we
zero them. However, this is racey since a dirty cache line from an
earlier mapping could be written out to memory between the zero'ing and
the invalidation. Fix this by invalidating the cache *before* zero'ing
the buffer.

Before this change, I was seeing corruption with:

    $ cat <<EOF | ./memory_prof -e -i -
    simple_alloc,1,ION_SYSTEM_HEAP_ID,ION_FLAG_CACHED,0x100000,1MB
    simple_basic_sanity,1
    simple_profile,1
    simple_free,1
    EOF

After this change, no corruption.

CRs-Fixed: 585524
Change-Id: I1f2603604efc9be4ebf9112b06728e0aeca60ea0
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
msm: cpr-regulator: remove register save and restore for suspend and resume

As CPR hardware register values will be retained during XO shutdown with
VDD_CX minimization, there is no need to save and restore CPR hardware
register values during suspend and resume. Also, there is a race condition
between cpr_resume and cpr_regulator_set_voltage. The
cpr_regulator_set_voltage function might be called after cpr_suspend is
invoked and before cpr_resume is called, this will enable CPR during XO
shutdown.

Hence remove register save and restore operations from cpr_suspend and
cpr_resume functions and add a flag to indicate that CPR has been
suspended.

Change-Id: Ic7c0f639e7e5cedb096d2f2eaaa3e8433ccd44c7
CRs-Fixed: 616385
Signed-off-by: Ke Liu <keliu@codeaurora.org>
msm: msm_bus: Don't program bw regs in dual config

When in dual configuration mode, don't program the bw registers
since they are already programmed at boot up.

Change-Id: I74d559f997b6374df7b68ffd022aa6d36beb7a9d
Signed-off-by: Girish Mahadevan <girishm@codeaurora.org>
ARM: dts: Reintroduce dual config for CPU on msm8974

Reintroduce the dual configuration mode for CPU masters on msm8974.
This will enable throttling of CPU in certain low bandwidth usecases
to alleviate timeline issues for other real time masters in the SOC.

Change-Id: Ic32f217ce40ee6ead4edd191811f9ce9f4e7e7ce
Signed-off-by: Girish Mahadevan <girishm@codeaurora.org>
msm: msm_bus: Changes for QOS computation at BIMC

Modify the computation of dynamic QOS parameters for BIMC. The bandwidth
paramter was incorrectly assumed to be in beats/s, it is infact in bytes/s
so there is no need to take bus width into account.
Also change resolution for statically prgrammed grant period to nano second
from micro second since each tick of the QOS clock is in the nano second
range.

Change-Id: Iad9ebc7837b769f8cd9c4215cb102f6916c0845d
Signed-off-by: Girish Mahadevan <girishm@codeaurora.org>
arm: mach-msm: fix integer overflow in DFE_IOCTL_COMMAND

Added error checks for upper limit of param.num in
DFE_IOCTL_COMMAND

Change-Id: I0143813d38ec7a5dfa7a8307b075daf7d4a4d101
Acked-by: John Nicholas <jnichola@qti.qualcomm.com>
Signed-off-by: Venkatesh Yadav Abbarapu <quicvenkat@codeaurora.org>
ARM: dts: msm: Modify bus vector for RNG client on msm8974

Modify the RNG (Random Number Generator) bus vector to use a different
originating master id, this change helps alleviate some slowdowns in boot
time noticed in targets where CPU is artificially bus throttled below a
threshold frequency.

Change-Id: I238bfda1bc0afcd0b4f85a7da00652deb11e2a1a
Signed-off-by: Girish Mahadevan <girishm@codeaurora.org>
Signed-off-by: Gopal G Goberu <ggober@codeaurora.org>
misc: qfpfuse: Fix overflow condition

Fix potential integer overflow for ioctl command to avoid incorrect
buffer allocation. Use the stack for data buffering to avoid the
small buffer allocation for improved performance. Increase the fuse
blow timeout in the driver to cover all QFPROM implementations.

CRs-Fixed: 550574,550575

Change-Id: Iee3cc1d38aa5dbf8ef693a43a0ca716fc8724c62
Acked-by: Radhakrishna Popuri <c_rpopur@qti.qualcomm.com>
Signed-off-by: Venkatesh Yadav Abbarapu <quicvenkat@codeaurora.org>
crypto: msm: ota: fix possible buffer overflow issue

This patch replaces snprintf with scnprintf to prevent
possible buffer overflow issues

CRs-Fixed: 562347

Change-Id: I56aebd24557dccc547ff86cb8853ace0602b6e50
Acked-by: Radhakrishna Popuri <c_rpopur@qti.qualcomm.com>
Signed-off-by: Venkatesh Yadav Abbarapu <quicvenkat@codeaurora.org>
Merge "power: qpnp-bms: estimate OCVs based on temperature"
msm: msm_bus: Modify IB aggregation at master

The IB aggregation at master assumed that the sel_clk pointers were set
before trying to access them, but there could be clients that register
but don't do any transaction at all which could lead to data aborts during
the IB aggregation. Change this to directly access the allocated pnode
entry instead of relying on sel_clk pointer.

Change-Id: Iefffdd5ff835496fa54d3de97e416a62735154a2
Signed-off-by: Girish Mahadevan <girishm@codeaurora.org>
Signed-off-by: Divya Sharma <c_shard@codeaurora.org>