thermal: Add Support for enabling and disabling tsens trip

Add new API to enable or disable the kernel client's trip
threshold request. The enable or disable trip threshold requests
from different kernel clients and userspace client will
activate/deactivate the corresponding clients threshold request.

Modify thermal sys framework to include only the active
thresholds from clients to determine the current trip
thresholds for tsens.

CRs-Fixed: 561775
Change-Id: I5de81b2272de92f19aa79a13d7bdbd58d4012cf3
Signed-off-by: Ram Chandrasekar <rkumbako@codeaurora.org>
ASoC: wcd9xxx: correct hph_status handling

mbhc hph_status status is assigned to 0, if extension cable
feature is enabled.Due to this OCP status bits are cleared
as a result OCP interrupts are masked which were stopping
OCP trigger. So donot set status to 0, instead set it appropriately.

CRs-Fixed: 552734
Change-Id: Ic3356e2f9411954939f28bc46c3b8bfda4cfd34f
Signed-off-by: Yeleswarapu, Nagaradhesh <nagaradh@codeaurora.org>
msm: mdss: Sanitize post processing inputs

Sanitize the inputs to histogram, assertive display, and calibration buffer
so that invalid values cannot be used as feature configuration.

CRs-Fixed: 516710
Change-Id: Ifb585174b1baadbac628f53fe67f3c3b3ae61a54
Signed-off-by: Carl Vanderlip <carlv@codeaurora.org>
msm: pil-msa: Fix authentication error path

Once the Q6 has booted, it is not possible to access
MSS registers. If there is an error during the auth
process, don't attempt to touch those registers.

Also, ensure that MSS_RESTART is re-asserted in the
error path as well.

Change-Id: I1e062f73f1dfdbf60c038c61f5ccd7358e81c702
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
msm: cpp: Support separate input stream identity.

When the input buffer is not native, its identity can be
different from the current stream. This change adds
support to hold identity of input stream.

Change-Id: I95563337482826b9f67b6ffbfd758766f5fb4290
Signed-off-by: Iliya Varadzhakov <ivarad@codeaurora.org>
msm: clock-8610: Add 12 MHz for blsp spi

Add support for a new frequency.

Change-Id: I7512384eb0e49675ce5c536f138cf513aa664961
CRs-Fixed: 562477
Signed-off-by: Patrick Daly <pdaly@codeaurora.org>
ASoC: msm-hdmi-codec-rx: sync state with HDMI core

To keep the state of the HDMI core and HDMI audio
sessions congruent, audio checks the state of the
core on startup, then notifies the core of the
active audio session.  On shutdown, notifies the
core of the event.

Change-Id: I8f90a4610ed9345c1affa67a7fee306e7d388d85
CRs-Fixed: 539309
Signed-off-by: Kenneth Westfield <kwestfie@codeaurora.org>
msm_serial_hs_lite: Handle Tx request during System Suspend

A corner case is occuring, that performing un-clock register
access and leading to Kernel Crash

Corner Case:
When system is in suspend state, Tx operation is getting called
from the client driver by a fflush system call.

To overcome this case, added a conditional check in the driver
while Tx operation. If system is in suspend state, return back
immediately.

CRs-Fixed: 570113
Change-Id: I693693fa9cc3b4b76ed5c7b6c7f4b6f7547e86fa
Signed-off-by: Dilip Kota <c_dkota@codeaurora.org>
mdss: mdp3 driver support for solid fill

This patch adds the support for solid fill from the driver side.
With this support mdp hw can be used for clearing the buffer.

Change-Id: I55da06a8343cd11eeeee361a738c4d72c944fc73
Signed-off-by: Shivaraj Shetty <shivaraj@codeaurora.org>
mdss: support for solid fill with color specified by HAL

This patch provides the support for filling the frame buffer with
any color specified by the HAL.

Change-Id: I9414764f858e309d35967430ef4e6f83d5e42e3e
Signed-off-by: Shivaraj Shetty <shivaraj@codeaurora.org>
uio: msm_sharedmem: Add new device driver for sharedmemory access

Add new device driver to provide a standard interface for its
clients (like RemoteFS and RFSA) to be able to memory map their
respective allotted shared memory address in the client's address space.
The shared memory (a transport buffer) address is unique for each
individual client and is made available to the driver via device tree.

This driver uses the existing UIO framework to facilitate the clients
mmap requirements. Each individual client will be able to use a unique
UIO device for this purpose.

CRs-Fixed: 477427
Change-Id: If07b88086b5f1b87845962818094644575629fcf
Signed-off-by: Pratibhasagar V <pratibha@codeaurora.org>
Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org>
qseecom:  Check for case where listener service is not found

When listerner service is not in the list of registered listeners,
the resulting ptr will a NULL. Check for this case of NULL ptr
to indicate missing listener service.

Change-Id: I0d2c7b01143c40711f71bf434493ac5301314cf2
Signed-off-by: Mona Hossain <mhossain@codeaurora.org>
Signed-off-by: Zhen Kong <zkong@codeaurora.org>
msm: thermal: Clean up msm cpufreq function calls

Remove msm_cpufreq_set_freq_limits and register with
CPUFREQ_POLICY_NOTIFIER to get immediate update on cpu frequencies
as long as a cpufreq_update_policy is called. Ensure that when
cpufreq_update_policy is called, cpu will not be hotplugged by
calling get_online_cpus().

CRs-fixed: 570736
Change-Id: I802d51ad1c352a19d2e456f9f6a89f8d5b89aad8

Signed-off-by: Jennifer Liu <chihning@codeaurora.org>
Signed-off-by: Anji Jonnala <anjir@codeaurora.org>
msm: ipc: Set unsupported protocol operations to default operations

Some of the socket system calls do not check the validity of the
operations supported by the protocol. This in turn leads to NULL
pointer dereferences.

Set the operations that are not supported by IPC Router to default
operations.

CRs-Fixed: 573295
Change-Id: Iba94b1403fa84dbe712255cc10677e9ef0848100
Signed-off-by: Karthikeyan Ramasubramanian <kramasub@codeaurora.org>
mdss: mdp3: request and release clocks for every mdp operation

In the command mode panel, all the clocks can be voted off if
there is no display update.  To support this feature, every
operation which requires h/w access will be guarded with clock
vote on and off.

Change-Id: If56a656b9965a6044c38de5aa85969256d581121
Signed-off-by: Xiaoming Zhou <zhoux@codeaurora.org>
ext4: fix the free blocks calculation for ext3 file systems w/ uninit_bg

Ext3 filesystems that are converted to use as many ext4 file system
features as possible will enable uninit_bg to speed up e2fsck times.
These file systems will have a native ext3 layout of inode tables and
block allocation bitmaps (as opposed to ext4's flex_bg layout).
Unfortunately, in these cases, when first allocating a block in an
uninitialized block group, ext4 would incorrectly calculate the number
of free blocks in that block group, and then errorneously report that
the file system was corrupt:

EXT4-fs error (device vdd): ext4_mb_generate_buddy:741: group 30, 32254 clusters in bitmap, 32258 in gd

This problem can be reproduced via:

    mke2fs -q -t ext4 -O ^flex_bg /dev/vdd 5g
    mount -t ext4 /dev/vdd /mnt
    fallocate -l 4600m /mnt/test

The problem was caused by a bone headed mistake in the check to see if a
particular metadata block was part of the block group.

Many thanks to Kees Cook for finding and bisecting the buggy commit
which introduced this bug (commit fd034a84e1, present since v3.2).

Change-Id: I122951d5528178c8af75e3f7425b5eae9ccdb036
Reported-by: Sander Eikelenboom <linux@eikelenboom.it>
Reported-by: Kees Cook <keescook@chromium.org>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Tested-by: Kees Cook <keescook@chromium.org>
Cc: stable@kernel.org
CRs-Fixed: 576063
Git-commit: b0dd6b70f0fda17ae9762fbb72d98e40a4f66556
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: Matt Wagantall <mattw@codeaurora.org>
msm: acpuclock-krait: Fix HFPLL regulator voting in regulator_init()

Simply incrementing l2_vreg_count is not enough to ensure the
regulators necessary for the L2 HFPLL are enabled. Instead,
enable_l2_regulators() must be called to place votes for the
regulators.

This problem will only result in incorrect behaviour (a missing
vote for the HFPLL regulators) if the L2 rate detected at boot is
not in the frequency table. In all other cases, the vote will be
applied as part of the hfpll_enable call when init_clock_sources()
is called for the L2.

Fix the code so that the voting works correctly even if the initial
L2 rate is not in the frequency table.

Change-Id: I8e84cd81de17a0efcc91281848180cf34ef9bb57
Signed-off-by: Matt Wagantall <mattw@codeaurora.org>
msm: acpuclock-krait: Update 'unknown rate' debug prints to warnings

While not fatal, boot performance will be suboptimal if the L2 or
CPU frequencies at boot are not in the frequency tables. This is
because acpuclock 'plays it safe' by applying the lowest possible
clock rate in such situations to ensure clocks are not set higher
than boot-up voltages can support.

Change-Id: I07fcff70d742b2590fa996ea4ca7a1f1c560eee3
Signed-off-by: Matt Wagantall <mattw@codeaurora.org>
power: qpnp-bms: do not rely on the charger to provide battery presence

Currently the BMS driver relies on the charger to register the battery
power supply before it gets access to the battery presence information.
However, this can cause issues where SoC is reported as 100% before the
power supply is registered and it can cause shutdown SoC loading to
fail.

Since the BMS driver already has read access to the charger bat_if's
battery presence register for detecting battery removal in offmode, fix
the issue with battery presence as well by directly reading from the
register instead of waiting for charger to register. If the register is
not given to the BMS in the device tree, then default back to reading
from the battery power supply.

Change-Id: Ie1faf47a09fc838e856fa7391918611f1139a1af
Signed-off-by: Xiaozhe Shi <xiaozhes@codeaurora.org>
crypto: msm: multiple qce50 support

In some platforms such as fsm9900, multiple instances of qce50 hw
may be supported.  Each qce50 HW has an ndp-bam. Each qce50 HW
can support multiple instances of qce_dev platform device.
Each qce_dev has its own configured pipe set and associated qce50 HW,
defined by crypto-base and bam-pipe-pair fields in the device tree files.
This patch based on io address, it decides to create a new qce50 hw
instance or use the existing known instance at device probe time.

Furthermore, this patch does iomap for only once for each HW BAM instance
to avoid issue with bam driver. If modprobe, and rmmod of qcedev,
and qcrypto are not in first in last out order, kernel may crash in
bam driver in the last rmmod.
This saves virtual space for IO if multiple instances of qcedev
share the same instance of HW BAM.

Change-Id: I1565b1976981b0512832ff793e0adb29c4be3ccc
Acked-by: Chemin Hsieh <cheminh@qti.qualcomm.com>
Signed-off-by: Rohit Vaswani <rvaswani@codeaurora.org>
Signed-off-by: Zhen Kong <zkong@codeaurora.org>