qseecom: Add support for bus scaling

Add support for scaling bus to various level:
LOW, MEDIUM, HIGH.  Expose IOCTL to user space
clients to enable selecting a specific bus bandwidth
setting.

Change-Id: I8ef94b84464e86d3ab1e4c78c502e99ef2e0ec9a
Signed-off-by: Zhen Kong <zkong@codeaurora.org>
msm: kgsl: don't use sscanf()

Friends do not let friends use sscanf().

CRs-Fixed: 563605
Change-Id: Ic0dedbad56af5bbee4fc833701d8bc93b118efa9
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
power: qpnp-charger: request fastchg falling irq

When device is in charging mode, if enable the revert boost regulator
for flash led, smbb will tranfer from fast_chg state to bst_on state,
the charging will stop. But usbin_valid && coarse_det are still valid,
and the battery_status not change to discharging.

Register a fastchg falling irq to update charging status and make the
charging icon consistent with charging status in this situation.

Change-Id: I0ce903f221d7550759b2601864c6a13a6036c494
Signed-off-by: Wu Fenglin <fenglinw@codeaurora.org>
msm: pm: print active clocks before entering into pc

print out all active clocks during idle power collapse
and suspend power collapse using clock debug API

CRs-fixed: 596828
Change-Id: Ie653c02d490b80de001f61fe8320ee851bb139c7
Signed-off-by: Anil kumar mamidala <amami@codeaurora.org>
msm: mpm-of: fix for "cxo_lpm_clk is unbalanced" slowpath warning.

The variable xo_enabled needs protection. It might get called
simultaneously from suspend and mpm worker thread context.
Added a mutex to prevent this.

WARNING: at kernel/arch/arm/mach-msm/clock.c:411 clk_disable+0xc8/0x150()
cxo_lpm_clk is unbalanced
Modules linked in: adsprpc texfat(PO) mwlan_aarp(PO)
[<c010d24c>] (unwind_backtrace+0x0/0x138) from [<c01a0408>]
(warn_slowpath_common+0x4c/0x64)
[<c01a0408>] (warn_slowpath_common+0x4c/0x64) from [<c01a04b4>]
(warn_slowpath_fmt+0x30/0x40)
[<c01a04b4>] (warn_slowpath_fmt+0x30/0x40) from [<c011a068>]
(clk_disable+0xc8/0x150)
[<c011a068>] (clk_disable+0xc8/0x150) from [<c0180568>]
(msm_mpm_sys_low_power_modes+0x28/0x84)
[<c0180568>] (msm_mpm_sys_low_power_modes+0x28/0x84) from [<c0180768>]
(msm_mpm_work_fn+0x1c/0x5c)
[<c0180768>] (msm_mpm_work_fn+0x1c/0x5c) from [<c01b9568>]
(process_one_work+0x128/0x490)
[<c01b9568>] (process_one_work+0x128/0x490) from [<c01b9c14>]
(worker_thread+0x164/0x35c)
[<c01b9c14>] (worker_thread+0x164/0x35c) from [<c01be9a8>]
(kthread+0x88/0x94)
[<c01be9a8>] (kthread+0x88/0x94) from [<c0107a04>]
(kernel_thread_exit+0x0/0x8)
---[ end trace d18a7d72e45b272f ]---
------------[ cut here ]------------
WARNING: at kernel/arch/arm/mach-msm/clock.c:436 clk_unprepare+0xac/0xd4()
cxo_lpm_clk is unbalanced (prepare)
Modules linked in: adsprpc texfat(PO) mwlan_aarp(PO)
[<c010d24c>] (unwind_backtrace+0x0/0x138) from [<c01a0408>]
(warn_slowpath_common+0x4c/0x64)
[<c01a0408>] (warn_slowpath_common+0x4c/0x64) from [<c01a04b4>]
(warn_slowpath_fmt+0x30/0x40)
[<c01a04b4>] (warn_slowpath_fmt+0x30/0x40) from [<c011aa78>]
(clk_unprepare+0xac/0xd4)
[<c011aa78>] (clk_unprepare+0xac/0xd4) from [<c0180570>]
(msm_mpm_sys_low_power_modes+0x30/0x84)
[<c0180570>] (msm_mpm_sys_low_power_modes+0x30/0x84) from [<c0180768>]
(msm_mpm_work_fn+0x1c/0x5c)
[<c0180768>] (msm_mpm_work_fn+0x1c/0x5c) from [<c01b9568>]
(process_one_work+0x128/0x490)
[<c01b9568>] (process_one_work+0x128/0x490) from [<c01b9c14>]
(worker_thread+0x164/0x35c)
[<c01b9c14>] (worker_thread+0x164/0x35c) from [<c01be9a8>]
(kthread+0x88/0x94)
[<c01be9a8>] (kthread+0x88/0x94) from [<c0107a04>]
(kernel_thread_exit+0x0/0x8)
---[ end trace d18a7d72e45b2730 ]---

CRs-fixed: 596765
Change-Id: Ibe685e8f37eb63c4e9e9d3434719985f33c63376
Signed-off-by: Anil kumar mamidala <amami@codeaurora.org>
msm: lpm_levels: return new idle level to cpuidle framework

Need to return the new idle level to cpuidle framework
but just returned input value argument 'index' which is
not used actually at lpm_cpu_power_select().

CRs-fixed: 601636
Change-Id: Iabd182eeb4fbdc67f4e07b40a1b593471cf8cbdf
Signed-off-by: Anil kumar mamidala <amami@codeaurora.org>
ASoC: wcd9xxx: Add INP2, INP3, INP4 for IIR paths

Add INP2, INP3, INP4 for IIR paths to provide client to use
any one of the four different paths for sidetone

CRs-Fixed: 612492
Change-Id: I6087487604edc249c1f2451cb0d9635399ec74ba
Signed-off-by: Sudheer Papothi <spapothi@codeaurora.org>
power: qpnp-bms: qpnp-charger: make logs easier to parse

There are usescases where the BMS and charger kernel logs are being
parsed for real time driver operation updates in performance testing.
There are a few suggested changes to the logging in order to make
getting the relevant information easier.

The precompensated battery current values are very useful for the VI
team to verify the battery current temperature compensation scheme.
Print it along with the final battery current.

Also, add a comma between the bat temperature logs in order to better
distinguish between the adc code value and the degC value.

Change-Id: Ie66eb7ed6e030cf15f0e6ebe3fd23c39deb9ec51
Signed-off-by: Xiaozhe Shi <xiaozhes@codeaurora.org>
power: qpnp-charger: add parallel ovp charge mode

This enables the parallel OVP charge mode for PM8941 devices.
This feature specific to PM8941 allows DC_IN and USB_IN to be
shorted on the device to allowing both input paths to be leveraged
and put more current into the battery.

Note that the feature is only enabled when fast charging
and disabled once fast charging is disabled.

Change-Id: Id76ef10c75eae267149437391f4e9fa6bfede18b
CRs-Fixed: 607941
Signed-off-by: David Keitel <dkeitel@codeaurora.org>
power: qpnp-charger: avoid ARB during JEITA

To avoid a possible accidental reverse boost condition
imposed by setting VDDMAX < VBAT, introduce the following
new flow for JEITA.

Once warm or cool temperature zones are entered, only
adjust VBATDET:

  * If VBAT is less than VBATDET the fast charge interrupt
    will be triggered and subsequently the appropriate
    VDDMAX and IBATMAX adjustments will be made.
  * If VBAT is exceeding VBATDET, charging will be stopped
    and only resumed via the VBATDET_LO threshold. Once
    charging resumes the appropriate VDDMAX IBATMAX adjustments
    will be made.

Signed-off-by: David Keitel <dkeitel@codeaurora.org>
CRs-Fixed: 605333
Change-Id: I13f3bad10f8478efd0ed4ff4c9ae6988ca6baafe
msm_serial_hs: fix unbalanced clock vote during port close

This change fixes the clock voting logic when the port is closed and
prevents the clock votes from going negative. Clocks are voted for when
the port is being closed and the conditional unvote based on the clock
state will always be true if the earlier vote is not downvoted before
this check is done. This change also protects agains erroneous, unbalanced
client votes, leading to instabilities.

CRs-Fixed: 550668
Change-Id: I391ac69601314757821b3ffb931a00647a64c583
Signed-off-by: Naveen Kaje <nkaje@codeaurora.org>
ASoC: msm: change to enable audio for apq8074

Use the soc-compress platform driver APQ8074.

Change-Id: Iab9da993be0c0393df1314b0cfcd5328febf53b8
Signed-off-by: Preetam Singh Ranawat <apranawat@codeaurora.org>
msm: vidc: initialize venus hfi locks during hfi creation

Venus hfi locks were initialized during core init,
which is invoked when the first video instance is
created. If a debugfs command is executed before
starting the first video instance, then video driver
crashes trying to lock an uninitialized mutex.

Change-Id: I472e9de91dada94a2728dd02c747e7fde63e3e4f
Signed-off-by: Arun Menon <avmenon@codeaurora.org>
defconfig: Enable Mobicore feature on msm610

Enable Mobicore feature support on msm8610 target.

Change-Id: I35836edddd9e8d4d53508127d486c5304ebe61b7
Signed-off-by: Hariprasad Dhalinarasimha <hnamgund@codeaurora.org>
msm: clock-8610: add clocks for mobicore driver

Add clocks for mobicore driver (mcd) for this target.

Change-Id: I8838847177f8dbd10e593f443220cfd76e1ffda3
Signed-off-by: Hariprasad Dhalinarasimha <hnamgund@codeaurora.org>
msm: mdss: Make notify update waits interruptible

Wait for completion in notify update call are uninterruptible
causing excessive delay during suspend cases. Making them
interruptible.

Change-Id: I1a4ff6ce3e0add21d4e46a41372b076b277d10f5
Signed-off-by: Krishna Chaitanya Parimi <cparimi@codeaurora.org>
hwmon: qpnp-adc-current: Fix IADC RSENSE trim error

This is a workaround for a RSENSE trim issue that may
affect some of the parts. The RSENSE might be trimmed to a
incorrect value resulting in an incorrect current value.
The workaround will check if the trim values stored in the
registers are valid and if not use a default RSENSE value.

CRs-Fixed: 606553
Change-Id: I8d77a2c6c28e57f2e537d1c5b65d0e08d5fabd90
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
ARM: dts: msm: List all possible BW levels in cpubw for 8974

With the cpubw_hwmon devfreq governor available in Krait based CPUs, it's
important to list all the possible BW levels to get all the benefit from
the cpubw_hwmon governor. Also fix the use of a non-existent BW level in
msm-cpufreq device.

Note that this change has been propagated from msm-3.10 and does not
include the changes made to apq8084.dtsi, since the file was missing
some required changes (e.g. cpufreq and cpubw devices).

Conflicts:
	arch/arm/boot/dts/qcom/apq8084.dtsi
	arch/arm/boot/dts/qcom/msm8974.dtsi

Change-Id: I36f1b2ea59d643106a86b753e5a7a2eed07dab19
Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
mmc: sdhci: finish the request if sdhc is in bad state

In the current code, if sdhci_check_state returns true a tasklet is
scheduled which doesn't complete the request if host->mrq is NULL,
which is the case, if sdhci is in bad state. This would make the
mmcqd thread wait for completion infinitely.
Hence, complete the request if sdhci_check_state returns true instead
of scheduling the tasklet.

CRs-Fixed: 615537
Change-Id: I8e2950c3999ac3806f9d631c52d86f0dc13b992f
Signed-off-by: Asutosh Das <asutoshd@codeaurora.org>
slim_ngd: Handle error flags before handling SENT flag

It's possible that error flags were set alongwith SENT flag for
TX transaction status. In such a scenario, error flag status should
be handled (and SENT flag should be cleared). Move error-flag
handling ahead of SENT flag handling to avoid interrupt being called
twice, and completion being set twice.

Change-Id: I13f28df0a0448790069bd103422dc1cd6c7ac408
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>