arm/dt: msm8610: Use sensor 5 for kernel thermal mitigation

Use TSENS Sensor 5 when kernel thermal mitigation runs. msm8610 only has
2 sensors. Sensor 5 tracks core0-1-2-3.

Change-Id: I0df6facdd0937c59baad4700fc1f2c39cc144ee2
Signed-off-by: Jennifer Liu <chihning@codeaurora.org>
msm: msm_bus: Add checks to avoid Klocwork errors

This patch adds Null pointer checks while getting bus devices
from the kernel tree. This is required to avoid Klocwork errors.

Change-Id: I761a9d177871a42aadfaa6f855be7e9c4c781e8b
Signed-off-by: Gagan Mac <gmac@codeaurora.org>
arm/dt: msm8610: add qpnp-bms device

Enable the battery management system device to provide a fuelgauge.

The BMS will report SOC to the system so it knows the percent charge of
the attached battery.

Change-Id: Ief92561d9dbb81669575ab2b5ef6e650a20bd4bc
Signed-off-by: Xiaozhe Shi <xiaozhes@codeaurora.org>
ASoC: msm: 8974: Fix vifeed dailink fixup function

VI feedback dailink should be configured as stereo
with sampling frequency set to 48 Khz.
This change updates the fixup function of vi feedback
dailink.

Change-Id: Idf60695c3651befa67f7740958c28029a9935eda
Signed-off-by: Gopikrishnaiah Anandan <agopik@codeaurora.org>
qseecom: add integer overflow protection and support to set multiple PIPEs

Add integer overflow protection for qclk->clk_access_cnt;
TZ changes their implementation to support one quest to set
multiple PIPE registers.We use mode operation to indicate
multiple PIPE registers in qseecom set key request.

Change-Id: I216dfdf73a6ecef633e0f5846d65d0648d2d451e
Signed-off-by: Zhen Kong <zkong@codeaurora.org>
msm: pm-8x60: Use on_each_cpu instead of smp_call_function_many

The broadcast timer needs to be setup on all the online cores. As
smp_call_function_many doesn't execute the CPU invoking the call, switch
to using on_each_cpu. Also change the function prototype as it is called
only to turn on broadcast timers.

Change-Id: If7002d787d98b68cb229ebc40f3c817c5aefe1f1
Signed-off-by: Mahesh Sivasubramanian <msivasub@codeaurora.org>
defconfig: 8974: enable coresight hardware event driver

The CoreSight Hardware Event driver enables monitoring and tracing
of upto 32 hardware events across STM hardware event interface.
Enable this Hardware Event driver on MSM8974

Change-Id: I4a7f420d7a839b28a31002c6e68ef68049afe760
Signed-off-by: Aparna Das <adas@codeaurora.org>
defconfig: msm8226: Add separate defconfig

Split the msm8226 and msm8610 defconfigs.

Change-Id: I0551c4a73cc80c8e0c3c92842c778751e93e1d11
Signed-off-by: Hanumant Singh <hanumant@codeaurora.org>
msm: kgsl: Don't access context memory after it's freed

Context memory was potentially accessed after being freed. Fix this
by incrementing the context's refcount at strategic places.

Change-Id: I31049bdd3eb9ac52160ca593619fcc8a32d4ddee
Signed-off-by: Lynus Vaz <lvaz@codeaurora.org>
msm: net: ecm: add driver correct operational mode validation

In order to ensure that the driver APIs are called in the
correct order and each state transition keeps the driver
in a steady state a new mechanism is added.
This mechanism will keep a record of the driver state
and check between state
transition that the intended operation is allowed.
For example, make sure that the driver stop() method
won't be called before the open()/init() function was
called and etc.

Change-Id: Ia9ca67a734e89b008105165479b74c712db09a36
Signed-off-by: Talel Atias <tatias@codeaurora.org>
power: pm8921-bms: fix SOC jumps while entering suspend/resume

The last_soc is being set to -EINVAL when entering suspend. This
causes SOC to jump while coming out of resume.

Instead remember
If we are reporting for the first time after suspend.
The calculated_soc at the time we went to suspend.

Soc should not increase because we cannot suspend while
charging. If the calculated_soc has increased continue reporting
the lower last_soc.

If the calculated soc has dropped check if it has dropped since
suspend. If so decrease the reported soc by the amount it dropped
since suspend.

If the calculated soc has dropped but it has increased since suspend
continue to report the last_soc.

Change-Id: I9040feceaa3e829d11bec0b21e61951f2ed1180b
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
Signed-off-by: Xiaozhe Shi <xiaozhes@codeaurora.org>
power: pm8921-bms: Cancel/schedule work across suspend/resume

Clean up the work before going into suspend to avoid any
race during resume.

While at it, fix the timing comparison during resume
and use the de-referenced chip pointer.

Change-Id: I9e6dbe49e6ad5ebf1cdf9a3cd0ec7f57aa6495c6
Signed-off-by: Anirudh Ghayal <aghayal@codeaurora.org>
power: pm8921-bms: Fine tune SOC reporting during suspend/resume

Report SOC based on the time for which the system was suspended.

Remember -
1. If we recalculated the SOC in resume
2. The last_soc before going into suspend

Two cases arise - if we had a short suspend or if the suspend
was significant to case a drop in SOC. For the former do not
report a change in SOC and for the latter, report the
newly calculated_soc. In either of the cases, soc should not
increase because we cannot suspend while charging.

There is a possibility that the report_soc may be called
before BMS resume (update_power_supply), causing the driver
to report the old SOC. Handle this case by setting state
variables before recalculating the soc in resume.

CRs-Fixed: 482611
Change-Id: Ic21a24a1126800011f5e7e4531c1953436812811
Signed-off-by: Anirudh Ghayal <aghayal@codeaurora.org>
msm: net: ecm: change resource manager feature enable/disable scope

The driver support a feature for enabling and disabling the
resource manager requests that are made prior to data send.
In order to allow this feature to work without the need to restart
the driver (the creation of a resource is done on initialization) the
resource will always be created/destroy regardless of the fact that
the user chooses to enable/disable the resource requests.

Change-Id: I808f87281557a795530598c429ff843fcb388af7
Signed-off-by: Talel Atias <tatias@codeaurora.org>
regulator: qpnp-regulator: Reset OCP count during voltage switch enable

Reset the OCP counter for voltage switches which use the OCP IRQ
in the qpnp_regulator_vs_enable callback function.  Resetting the
counter here ensures that a voltage switch is always able to
reach its final output voltage when a valid load is connected if
only one OCP event occurs while enabling the switch.

Change-Id: Ie5b2d5271c81ef4b3cb9c9d874ca66af5530ddc7
Signed-off-by: David Collins <collinsd@codeaurora.org>
arm/dt: msm8610: Remove virtual key node from SPMI node

Virtual key node is placed as a child node of SPMI node during
Gerrit rebasing change. This patch moves virtual key node to
correct place.

Change-Id: I85c415cfa7bae85704c77bcdd044bb706e3d2628
Signed-off-by: Chun Zhang <chunz@codeaurora.org>
arm/dt: msm8610: Remove GPIO Button node from SPMI node

GPIO button device tree node is placed as a child node of SPMI in
mainlined code. This patch places GPIO button node to the right
place.

Change-Id: Ie87fe7e48983b0c4684c665d80bf5dcb71c998cb
Signed-off-by: Chun Zhang <chunz@codeaurora.org>
msm: ipa: fix for missing tx completion

Due to incorrect SPS end-point connection setting, last TX packet on
data path was not getting TX completed even though BAM has consumed the
descriptor. This commit fixes the connection setting issue.

Change-Id: I2f4642e4fafab491e0627d4fa82f558b53f60774
Signed-off-by: Ravi Gummadidala <rgummadi@codeaurora.org>
msm: camera_v2: Jpeg bus vector based on core clk

Changing values of jpeg bus vector depending on
jpeg clock frequency

Change-Id: I590ffb017bf23a31a56af317434a6b814b0854c8
Signed-off-by: Shwetha Kotekar <skotekar@codeaurora.org>
msm: dcvs: fail gracefully if TZ does not support dcvs

If dcvs attempts to initialize on a system where TZ does not support
dcvs, it will eventually cause a crash. Prevent this by disabling
dcvs if TZ does not successfully initialize its part of dcvs.

Change-Id: Ic9cd361243c03c3832133614c4847a2815b0bbb4
Signed-off-by: Steve Muckle <smuckle@codeaurora.org>