mmc: core: Issue with voltage switch sequence

When a broken UHS-I card is inserted, the voltage switch sequence
fails as expected but the controller is left in bad state due to
which software request timeouts are observed for further commands.
Add mmc_power_cycle() for any failure in voltage switch so it will
also help reset the controller in addition to card.

Signed-off-by: Sahitya Tummala <stummala@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ASoC: msm: Add check for both offset and index variable

-The offset and index variable may leads to array out of
boundary exception.
-Added offset and index overflow check.

Signed-off-by: Mohammad Johny Shaik <mjshai@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ASoC: msm: Add Buffer overflow check

The overflow check is required to ensure that user space data
in kernel may not go beyond buffer boundary.

Signed-off-by: Mohammad Johny Shaik <mjshai@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
media: Init the reserved fields of struct media_link_desc

struct media_link_desc is copy_to_user'ed as the return value of
MEDIA_IOC_ENUM_LINKS. When copying, the driver is omitting to initialise
the reserved fields.  This commit fixes that by initialising the
reserved fields to 0.

Signed-off-by: Rajeshwar Kurapaty <rkurapat@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
rtc: alarm: update power_on alarm setting logic

The previous power_on alarm value should be checked to avoid
cancelling the alarm by mistake.

Signed-off-by: Xiaocheng Li <lix@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: camera_v2: cci: check for NULL pointer

in function "msm_cci_subdev_g_chip_ident"
check for NULL pointer and return error
instead of assert

Signed-off-by: Georgi Hristov <ghristov@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ASoC: dapm: Convert pin switches to use snd_soc_card

Since the addition of the non-CODEC control adds card controls like the
DAPM pin switch have been broken as they are expecting the private data
for the control to be the CODEC but it's now the card. Fix that for the
pin switches, an audit of other drivers is required.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Gopikrishnaiah Anandan <agopik@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ASoC: dapm: Use DAPM mutex for DAPM ops instead of codec mutex

It has now become necessary to use a DAPM mutex instead of the codec
mutex to lock the DAPM operations. This is due to the recent multi
component support and forth coming Dynamic PCM updates.

Currently we lock DAPM operations with the codec mutex of the calling
RTD context. However, DAPM operations can span the whole card context
and all components.

This patch updates the DAPM operations that use the codec mutex to
now use the DAPM mutex PCM subclass for all DAPM ops.

We also add a mutex subclass for DAPM init and PCM operations.

Signed-off-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Gopikrishnaiah Anandan <agopik@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ASoC: dapm: lock mixer & mux update power with DAPM mutex

Both snd_soc_dapm_mux_update_power() and snd_soc_dapm_mixer_update_power() can
be called internally within DAPM core (with DAPM mutex held) and externally.

Provide some wrappers so that external users of both functions do not have to
remember to hold the DAPM mutex.

Signed-off-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Gopikrishnaiah Anandan <agopik@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ASoC: dapm: Change mutex lock subclass in dapm

Address the compilation issue by changing the subclass
enum in mixer/mux power update dapm functions

Signed-off-by: Gopikrishnaiah Anandan <agopik@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ASoC: dapm: Fix race condition in dapm

Dirty widget list can be accessed by multiple
paths in dapm framework. Dirty list is protected by
dapm mutex. Since stream_event function accesses the dirty list,
it should acquire dapm mutex instead of codec mutex.

Signed-off-by: Gopikrishnaiah Anandan <agopik@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: sps: use a new flag for disconnecting pipe

Use a new flag to indicate if BAM client has decided to disconnect
a pipe so that we can avoid BAM IRQ handling for a disconnected
pipe.

Signed-off-by: Yan He <yanhe@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: ultrasound: Add a new input device configuration

Add a new input device configuration in order to
support an external display.

Signed-off-by: Ravit Dennis <rdennis@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: ultrasound: Support side buttons

Add new button notifications in order to be
able to report stylus side button states.

Signed-off-by: Ravit Dennis <rdennis@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: ultrasound: Add Sync Gesture data format

A new Sync Gesture service has been added to userspace and QDSP6.
This service data format should be supported in the ultrasound
related definitions in the kernel.

Signed-off-by: Ravit Dennis <rdennis@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: ultrasound: support multiple devices, conflicting with USF

The USF input device can have a number of devices,
conflicting with it.
The first registered device (primary) is real TSC device.
Optionally, later registered devices are simulated ones.
The input events from the multiple devices should be
controlled by USF.

Signed-off-by: Baruch Eruchimovitch <baruche@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: ultrasound: add verifications of some input parameters

Some security vulnerabilities were found.
To fix them, additional verifications of some input parameters
are required.

Signed-off-by: Baruch Eruchimovitch <baruche@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: ultrasound: Add support for general button events

The side buttons bitmap was expanded to allow sending button
events for tool type buttons (stylus, rubber) and also for a new
button which signals that the hovering icon should be displayed.

The event source field was removed as it was previously used to
set the tool type, which is now done explicitly via the buttons
bitmap.

Signed-off-by: Lior Barenboim <liorb@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
spi_qsd: Add support for bam pipe flush on timeout

BAM pipes must be flushed when a transfer timeout
leaving dangling descriptors.

Signed-off-by: Gilad Avidov <gavidov@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
spi_qsd: Verify pointers prior to redirection

Redirection on a NULL pointer leads to a system crash.
Here we verify pointers which potentially may be NULL
before a redirection.

Signed-off-by: Gilad Avidov <gavidov@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>