ASoC: wcd9xxx: Disable RC oscillator after use

Currently RC oscillator is left enabled even after
its use when headset is inserted and then removed.
Disable RC oscillator after headset is removed during
clock block put.

Change-Id: Ic799be15f900b7261455e27c4e6b7b95c049f6e4
Signed-off-by: Phani Kumar Uppalapati <phaniu@codeaurora.org>
USB: phy-msm-usb: Enable USB Interrupt only if ASYNC IRQ is not present

Some USB controllers have different IRQ line to exit from
LPM. This is ASYNC IRQ. If this IRQ is present, we dont
need to enable or disable the USB interrupt during otg
suspend and resume respectively.

There is a new requirement for XO shutdown during idle.
To allow XO in idle CPU states. When CPU is idle, if an
irq is enabled and is not capable of waking up from xo,
the xo shutdown is aborted. Hence non-wakeup capable irq
must be disabled.

Change-Id: I3197a1b413a1bf849db3572442cc8dbc5f264b53
CRs-Fixed: 520531
Signed-off-by: Sujeet Kumar <ksujeet@codeaurora.org>
ARM: dts: apq: remove unnecessary configuration of pmic gpio 36

DragonBoard8074 does not use pmic gpio 36 so removing it.

Change-Id: I5bc6908cda40eb08831afb696fbb2567a462878a
Signed-off-by: Asaf Penso <apenso@codeaurora.org>
power: qpnp-charger: allow charging in host mode

If host mode is enabled, allow the BATFET to be closed
thus that a DC charger is still able to charge the battery.

Change-Id: I3f863db42b028fa51637d3eb02f0931a02311e27
CRs-Fixed: 495760
Signed-off-by: David Keitel <dkeitel@codeaurora.org>
ASoC: msm: q6: check upper bounds when copy ac3 params

Although AC3 maximum param size is fixed, better check upper bounds
when copy user data. It might cause overflow, possibly cause memory
corruption.

Change-Id: I2f7cec8edd9e013de1433ea06480b963ec307196
Signed-off-by: Fred Oh <fred@codeaurora.org>
ASoC: msm: Add argument to config_debug_fs definition

Add argument name missing from config_debug_fs
definition when debugfs not enabled.

Change-Id: Ib955b5fa60228d48ac6a2c73678f0d6cd766c8a1
CRs-fixed: 551711
Signed-off-by: Ben Romberger <bromberg@codeaurora.org>
ARM: dts: msm8226: Add qrd pvt device tree

QRD PVT device will use different pmic version
which have different hardware design that has to
be distinguished with original DVT and EVT.

Change-Id: I770e4bd9e77ac4257762dd7b06b5d8ad334efcfa
Signed-off-by: Maria Yu <aiquny@codeaurora.org>
sdhci: sdhci_stop_request() returns error when no request

There is race between sdhci_tasklet_finish()
and sdhci_stop_request(): when the request is finished before
stop flow called, error returned.

Change-Id: Ic036feae925b2e9e5435e44f97b24a179547bf49
Signed-off-by: Konstantin Dorfman <kdorfman@codeaurora.org>
mmc: core: skip stop flow when current request already done

When mmc_stop_request() has no request to stop, because underlying
host driver reported this, the flow should wait for the mmc done()
callback marking that urgent still pending.

Change-Id: Iacc95591ee76a965916af05a31a67dd8997c233e
CRs-Fixed: 538117
Signed-off-by: Konstantin Dorfman <kdorfman@codeaurora.org>
ARM: dts: msm: Add support for Synaptics touch controller

8x10 MTP with 720p uses Synaptic touch controller. Add dtsi
entry to support this panel.

Change-Id: Ieb43223997a590be3d642946b74e1820df25220e
Signed-off-by: Mohan Pallaka <mpallaka@codeaurora.org>
diag: NRT read wakelocks held for very long time

During on-device logging with '-b' option,
NRT read wakelocks i.e. diag_nrt_modem_read
and diag_nrt_wcnss_read were held for more than
a day's time. This patch releases the wakelocks
even if SMD channel will be closed.

Change-Id: I7d211aaeaeb8d59369a191c5eef54c02a1b4a61d
CRs-Fixed: 513309
Signed-off-by: Mohit Aggarwal <maggarwa@codeaurora.org>
msm: camera: Fix various small issues in vpe driver

Upper and lower bound checks are enforced for num_buff
which is passed from userspace and memset inst_info
to zero to avoid unwanted data passed to userspace

CRs-fixed: 547927
Change-Id: I0d589ef26e57bb26dc006b5927461edcc95e593e
Signed-off-by: Hariram Purushothaman <hpurus@codeaurora.org>
msm: vidc: Add 5.2 level support

4k resolution clips require different level
information. This change adds 5.2 level
support for such high resolution videos.

Change-Id: Ia02ab183f0a879a8f7acab600f1c7e2375933568
Signed-off-by: Rajeshwar Kurapaty <rkurapat@codeaurora.org>
mmc: msm_sdcc: Fix compilation issues

Fix compilation issues when CONFIG_DEBUG_FS is not defined.

CRs-fixed: 555000
Change-Id: Ic7f30ae79450fa9125499352b80db3fa4c27104d
Signed-off-by: Sahitya Tummala <stummala@codeaurora.org>
power_supply: Add voltage_ocv property and use it for max17042 driver

This adds a new sysfs file called 'voltage_ocv' which gives the
Open Circuit Voltage of the battery.

This property can be used for platform shutdown policies and
can be useful for initial capacity estimations.

Note: This patch is generated against linux-next branch.

Change-Id: If39fd1fa32b6d734ec86f2e188dab8fcd9414976
Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
Git-commit: a2ebfe2fc6e088a70d06cd15a5bc9bcb621cc195
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
[xiaozhes@codeaurora.org: merging with msm-specific changes]
Signed-off-by: Xiaozhe Shi <xiaozhes@codeaurora.org>
power: qpnp-charger: save open circuit voltage upon battery insertion

The BMS driver relies on having accurate open circuit voltage (OCV)
readings to estimate the state of charge of a battery. Usually the
BMS hardware takes an OCV reading of the battery upon power-on
because the load on the battery is small so there is very little
voltage drop across the battery.

However when a battery is hotswapped, it is difficult to obtain an
accurate OCV reading. This is because the hardware does not take a
OCV when the battery is inserted in a hotswap.

Work around this issue by forcing the BATFET open when a battery is
removed, and only let it close once a new battery is inserted and
the driver has taken a voltage reading when the BATFET is open.
Report this value through the power supply framework.

Change-Id: I5ee87c795be7ff32e21598f1103a4237283c9dc8
Signed-off-by: Xiaozhe Shi <xiaozhes@codeaurora.org>
power: qpnp-bms: remove misuse of bool

Bools should only hold true or false values. Change a few uses of
the bool datatype to int to avoid this violation.

Change-Id: Ie76a86363ba427f1c261a9308d9ec1142d780d5b
Signed-off-by: Xiaozhe Shi <xiaozhes@codeaurora.org>
power: qpnp-bms: Use charger's battery insertion OCV

Use the charger driver's OCV reading taken upon battery insertion
instead of estimating OCV when the BMS driver detects a new battery.

This drastically improves the accuracy of battery state of charge
when hotswapping.

Change-Id: Iacf17370f0d5d9c422180f08de28730e4bd66d18
Signed-off-by: Xiaozhe Shi <xiaozhes@codeaurora.org>
power: qpnp-bms: fix soc adjustment in high load charging

When the system is under heavy load but still drawing power from the
connected charger and the battery is in constant voltage charging,
the BMS driver never changes back into a constant current charging
state. This can cause random SoC jumps if the system load suddenly
lessens and the BMS driver tries to do constant voltage style SoC
scaling based on battery current.

Fix this by allowing the BMS driver to back out of the constant voltage
charging state.

Change-Id: I61f1d076ca9f623a31aa36960c3fd3ef2b238d78
Signed-off-by: Xiaozhe Shi <xiaozhes@codeaurora.org>
power: qpnp-bms: fix batterydata reverse interpolation

The BMS driver needs to look up open circuit voltages for a given
SoC. However, the current algorithm is a bit flawed. If the battery
profile is not monotonic, there is a risk of going to an infinite
loop.

Fix this by modifying the reverse lookup loop to be bounded, and to
modify the step size so that the OCV will converge instead of
oscillating.

Change-Id: I25ba92de9796c4b89b476a0eff39a542407205f0
Signed-off-by: Xiaozhe Shi <xiaozhes@codeaurora.org>