qseecom: Fix issues on key management scheme

The mechanism to update how a user is tied to an existing key is
added. And the app_access_lock mutex is removed in key management
APIs, as there is no need to lock app access while processing a
key related request.

Signed-off-by: Zhen Kong <zkong@codeaurora.org>
qseecom: Add checks for user space buffer pointers

Validate pointers send from user space and pointers
embedded within the mesasge sent from user space.

Change-Id: I1be54924ef3d301908af6e8d4e6506f2aa7f6428
Signed-off-by: Mona Hossain <mhossain@codeaurora.org>
Signed-off-by: Zhen Kong <zkong@codeaurora.org>
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.

Signed-off-by: Mona Hossain <mhossain@codeaurora.org>
Signed-off-by: Zhen Kong <zkong@codeaurora.org>
qseecom: Removal of flags and options to protect listener memory

With the new ION design all memory allocated from secure heaps is
secured already at allocation time. This commit effectively rolls
back a change introduced to secure this memory at runtime.

Change-Id: I94bf0a7f6d477b04da7ad6786111f8c970516842
Acked-by: Christian Bolis <cbolis@qti.qualcomm.com>
Signed-off-by: Hariprasad Dhalinarasimha <hnamgund@codeaurora.org>
qseecom: change key management apis

Remove 2 seconds sleep if create_key or update_key fails, and
this delay is now handled by TZ. change errno when maximum
attempt to input password is reached.

Change-Id: I14350219f43094d280ebc1e3717418285063448d
Signed-off-by: Zhen Kong <zkong@codeaurora.org>
msm: cpufreq: Correct synchronous cpu logic

Fix an incorrect patch conflict resolution which results in failing to
initialize the cpufreq policy correctly when using an old acpuclock driver
version.

Change-Id: If8743a2608e720258ebc710718c3041144c00f10
CRs-fixed: 612226
Signed-off-by: Patrick Daly <pdaly@codeaurora.org>
regulatory: use correct regulatory initiator on wiphy register

The current regdomain was not always set by the core. This causes
cards with a custom regulatory domain to ignore user initiated changes
if done before the card was registered.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Acked-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Git-commit: 23df0b731954502a9391e739b92927cee4360343
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
CRs-Fixed: 569424
Change-Id: Ia5462145a27f5ecdd7a1eb9f4235992f7a801097
[smihir@codeaurora.org: changes to merge cleanly in older kernel]
Signed-off-by: Mihir Shete <smihir@codeaurora.org>
power: qpnp-charger: report trickle charging correctly

When trickle charging the battery FET is off. Fix
the charging report logic to address this and
correctly report the trickle charging status.

Change-Id: I46a13c219e8147e36f8bf3fd749b496c0af9ca11
CRs-Fixed: 587259
Signed-off-by: David Keitel <dkeitel@codeaurora.org>
power: qpnp-charger: enable arb workaround for DC_IN

Accidental reverse boost (ARB) can also cause charger
removal detection issues on DC_IN.

Fix this by also executing the ARB workaround if a
dc charger is connected.

CRs-Fixed: 589210
Change-Id: I4e6d370c31e6184597b609830ad58826b0326bd7
Signed-off-by: David Keitel <dkeitel@codeaurora.org>
power: qpnp-charger: report full when charger is plugged in at 100 SoC

Previously, the full status was only reported by the battery power
supply after charging completes. However, when at end of charge and the
charger is taken out and plugged back in, charging does not begin
because the battery is technically still full. It is confusing for the
battery power supply to report discharging in this state.

Fix this issue by reporting full if the device is:
	1. not charging
	2. has a charger attached
	3. is at 100% battery

Change-Id: Ie8f8029627fe9173b051a90d0c96bbdcc5f17bc5
Signed-off-by: Xiaozhe Shi <xiaozhes@codeaurora.org>
power: qpnp-charger: add vbatdet-maxerr-mv option

To allow trimming the vbatdet resume voltage more
add the optional qcom,vbatdet-maxerr-mv parameter.

If this parameter is not defined in a given
devicetree a default value of 50 mV will be used
by the driver.

CRs-Fixed: 596975
Signed-off-by: David Keitel <dkeitel@codeaurora.org>
Change-Id: I83a309fdd7843f312e1aab1128f32befaa19b67a
power: qpnp-charger: disable ibat_loop when temperature is out of range

When the charger is in the chg_pause state, the ibat regulation loop can
cause the batfet to oscillate due to VCP. This occurs because of an
hardware issue with the IBAT_MAX stepper when the charger is paused.
When charging is paused, the buck accuracy degrades and can cause VPH to
dip below vbat, triggering VCP. The batfet toggling causes faulty IBAT
readings by the BMS.

Fix this by disabling the ibat regulation loop when the battery goes
into the hot or cold state. This will fix the batfet toggling issue as
well as the faulty ibat readings.

Change-Id: I74bab3e6fd0c1be0e83100672262fc504eee3396
Signed-off-by: Xiaozhe Shi <xiaozhes@codeaurora.org>
ASoC: msm: qdsp6v2: Add upper bounds check on index

Add upper bounds check for return value of
q6audio_get_port_index().

CRs-Fixed: 575227
Change-Id: I263fc6d759beffd2c2fecc7794c279939ab25401
Signed-off-by: Kenneth Westfield <kwestfie@codeaurora.org>
ASoC: msm: qdsp6v2: Check for null pointers

Add check for null data pointer in
adm_callback() and log error message if
true.

CRs-Fixed: 575222
Change-Id: I88a4d19cc2e78610249e404bce93831557995fab
Signed-off-by: Kenneth Westfield <kwestfie@codeaurora.org>
msm: mdss: hdmi: parse for resolutions in EDID block 0

If EDID block 1 is not available or video data block is not
available, allow parsing of resolutions from block 0.

CRs-Fixed: 596518
Change-Id: I8574de3f80c817ac764d467e622ded7430c0df86
Signed-off-by: Ajay Singh Parmar <aparmar@codeaurora.org>
ASoC: wcd9xxx: Do not use dapm to power up cdc-vdd-mic-bias

Do not use alsa dapm to power up cdc-vdd-mic-bias power supply.
Due to sound card is not initialized, powering up this dapm widget
would get delayed. This leads to wrong mbhc calibration values.

Change-Id: I4e1f3cf523ea9f771b9993317dfd515def2b0615
Signed-off-by: Phani Kumar Uppalapati <phaniu@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: I20865e0b2bb193f2f8777f2b69e735a0d4997cca
Signed-off-by: Phani Kumar Uppalapati <phaniu@codeaurora.org>
uio: provide vm access to UIO_MEM_PHYS maps

This makes it possible to let gdb access mappings of the process that is
being debugged.

uio_mmap_logical was moved and uio_vm_ops renamed to group related code
and differentiate to new stuff.

CRs-Fixed: 570735
Change-Id: I8a5ff343727cc58fedfeb73f3466cc9a7f153e84
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Git-commit: 7294151d0592e0ff48c61fca9fd7c93d613134da
Git-repo: http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git
Signed-off-by: Pratibhasagar V <pratibha@codeaurora.org>
msm: socinfo: Add support for platform_subtype_id

Add sysfs node to socinfo to read the platform subtype
id. This is meant to deprecate the platform_subtype string
sysfs node.

Change-Id: I4bcb6f9cc6af18fd0cf7ea5aeb6da12a124c9ae1
Signed-off-by: Abhimanyu Kapur <abhimany@codeaurora.org>
USB: msm_otg: Print warning message when not able to turn USB CLKs

This change prints warning message failures with call stack when
not able to turn ON USB core_clk and pclk in msm_otg_resume() and
msm_otg_link_clk_reset()

CRs-Fixed: 612896
Change-Id: I9f53751b9ff0254205231656e01ed84302067bef
Signed-off-by: Saket Saurabh <ssaurabh@codeaurora.org>