qcom: rpm-smd: Mask the interrupt before sending the sleep set.

Sending a sleep set would cause an SMD interrupt to fire. If the
interrupt was previously affine to a different CPU, it could cause a
premature wakeup of that CPU. Prevent this by masking the interrupt
before sending the sleep set.

Signed-off-by: Mahesh Sivasubramanian <msivasub@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ASoC: qcom: qdsp6v2: fix crash due to asynchronous read/write

Whenever an async read command is issued to dsp when
the driver is not enabled, there is a crash in userspace.
The read command is disallowed in the driver and an error
is propagated to userspace which results in the crash.
The driver is re-enabled in a subsequent asynchronous write
command anyway, so the async read command can be allowed.
Ensure that read is allowed by removing a superfluous check.

Signed-off-by: Satya Krishna Pindiproli <satyak@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
i2c_qup: Fix for unhandled IRQ

I2C qup driver handle scenario where runtime
PM is not enabled and enables clocks explicitly.
But it checks runtime PM suspended state in ISR
routine before processing further which can lead to issue
of unhandled valid IRQ sometimes because I2C client
can initiate transaction very early after system
resume and runtime PM is not enabled.

Add atomic flag to synchronize between active transaction
request when clocks are enabled and ISR.

CRs-Fixed: 670480
Change-Id: I175bc29a7b5b6e713ab6ec28deb34b2b0d23fa8a
Signed-off-by: Sana Venkat Raju <c_vsana@codeaurora.org>
Signed-off-by: Alok Chauhan <alokc@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
qup_i2c: Initialize I2C resource before registering.

Due to mismatch in sequence of initializing the
I2C resources  and registering device,  issues seen
while probing clients. This patch corrects the sequence.

CRs-Fixed: 581007
Signed-off-by: Sana Venkat Raju <c_vsana@codeaurora.org>

qup_i2c: Correct free memory call

Correct freeing of memory, which is allocated using
the devm prefixed API, to free it using devm_kfree rather
then kfree.

CRs-Fixed: 582597
Signed-off-by: Gilad Avidov <gavidov@codeaurora.org>

qup_i2c: dump gpio config on error

Dump the configuration of relevant GPIOs
on timeout error.

Signed-off-by: Gilad Avidov <gavidov@codeaurora.org>

qup_i2c: improve PM functionality

Move system-PM functionality to noirq stage. Remove
the incorrect active-only clock path-voting setting.
Resolve synchronization of concurent transition of
system and runtime PM.

Signed-off-by: Gilad Avidov <gavidov@codeaurora.org>

qup_i2c: support for configuarable noise rejection

allow to configure noise rejection value from device tree
which helps filter spikes in the i2c lines.

CRs-Fixed: 626250
Signed-off-by: Ankit Gupta <ankgupta@codeaurora.org>

qup_i2c: Improve recovery from core and slave bad state

Unexpected noise, and/or unexpected behavior from a slave
may put the whole I2C bus in unworkable state. Clear I2C
bus state using HW command instead of bit-banging to avoid
assumption about GPIO recovery config.

Signed-off-by: Gilad Avidov <gavidov@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: msm_bus: Prevent BKE swtich from overwriting other fields

Incorrect bit mask could lead to other register fields getting
overwritten when doing a BKE bit switch.

Signed-off-by: Girish Mahadevan <girishm@codeaurora.org>
Signed-off-by: Sana Venkat Raju <c_vsana@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: msm_bus: Fix inadvertent stomp on BKE_EN register

While setting the QoS mode of fixed mode masters bad masking
operations is causing accidental stomp on the upper nibble of the
BKE_EN register.

Signed-off-by: Girish Mahadevan <girishm@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
crypto: msm: Add support for FIPS complience

FIPS140-2 certification asks to do a Power on Known Answer tests on each
algorithm which is getting certified. This patch implements the self tests
and hardcoded test vectors.  Also, we need to verify the integrity of
kernel as soon as it boots up. This patch also adds an ioctl for
integrity test along with ioctl to query FIPS status (pass / fail) from
user land.
also, The piece of code is added for FIPS compliance DRBG under
drivers/char/hw_random
This change is already merged to KK mainline.

Signed-off-by: Dinesh K Garg <dineshg@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
crypto: msm: Compilation flag in Kconfig For FIPS

Added a FIPS_ENABLE flag under drivers/crypto/Kconfig
which will be enabled/disabled according to defconfig
file selection of CONFIG_FIPS_ENABLE
This change is already merged to KK mainline.

Signed-off-by: Dinesh K Garg <dineshg@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
crypto:msm: Remove excess logging in qce50

During device probe, device tree is called & the
device tree details are logged - these logs
are now truncated.

Signed-off-by: Hariprasad Dhalinarasimha <hnamgund@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
crypto: msm: Fix SHA-1/256 zero length input data issue

Crypto module generating wrong hash value for zero length input data
using SHA1 and SHA256 functions. This patch fixes the issue to generate
proper hash value.

Signed-off-by: AnilKumar Chimata <anilc@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
clock: msm: Add clk support for second qcrypto device

Add clock entry for a second qcrypto instance for 8974.

Signed-off-by: Mona Hossain <mhossain@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
hw_random: msm_rng: fix a null pointer dereference

This change prevents a possible null pointer
dereference in msm_rng.c by moving the function
call under if block.

Acked-by: Saurabh Sabnis <ssabnis@qti.qualcomm.com>
Signed-off-by: Dinesh K Garg <dineshg@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>