msm: vidc: Add instance to instance list prior to CORE_INIT

During CORE_INIT, driver votes for bus only if core->instances list
is not empty. Since the current video instance is added to core->instances
list after core init, driver fails to vote for bus. This causes ion_map to
hang and resets the device.

Signed-off-by: Srinu Gorle <sgorle@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: vidc: Delay firmware unload during session close

Video driver loads and unloads firmware at the start
and end of each session. Firmware download takes up
to 100 msec. When there are many b2b video sessions
e.g. thumbnail generation, this is an unnecessary
overhead. To overcome this problem, video driver will
unload the firmware 10 secs after the session is closed.
If a new session starts during this period, it will not
be required to download the firmware again.

Signed-off-by: Arun Menon <avmenon@codeaurora.org>
Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
mmc: core: Fix null pointer dereference due to race conditions

Fix race condition between mmcqd thread and the mmc_queue_suspend
updating a shared variable mq->flags, which can lead to potential
null pointer dereference as following-

Unable to handle kernel NULL pointer dereference at
virtual address 00000020
pgd = c0004000
[00000020] *pgd=00000000
mmcqd/0:  186] Internal error: Oops: 5 [#1] PREEMPT SMP ARM
CPU: 0    Tainted: G        W     (3.4.0-1251694-eng #1)
PC is at mmc_blk_err_check+0x20c/0x3b8
LR is at mmc_start_req+0x198/0x718

cpu0		|	cpu1
x |= 1		|	x |= 2

final value of x can be x = 1 or x = 2

Change-Id: Ie0fff6d6dba5aebb3584cba9fb98de24515c4cd8
Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
mmc: block: Fix an invalid use of req->cmd_flag in DISCARD operation

When handling a DISCARD operation, the MMC request data structure may be
freed in memory. Therefore, it can't be used to retrieve the cmd_flags
for checking if MMC_REQ_NOREINSERT_MASK is set:
(!(mq->mqrq_cur->req->cmd_flags & MMC_REQ_NOREINSERT_MASK)))).

To prevent the issue we should use the local variable of cmd_flags.

Signed-off-by: Maya Erez <merez@codeaurora.org>
Signed-off-by: Konstantin Dorfman <kdorfman@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
mmc: core: Fix power class config for HS400

Use the correct power class field from the extended CSD register
for HS400 mode as defined in the eMMC5.0 specification.

Signed-off-by: Venkat Gopalakrishnan <venkatg@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>
regulator: Add proxy consumer driver

Add a proxy consumer driver which can be used to ensure that a
given regulator maintains a certain minimum state during bootup.
Enable state, voltage, and current may be forced to specified
levels.

Signed-off-by: David Collins <collinsd@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
regulator: Call proxy-consumer functions for each regulator registered

Add a call to regulator_proxy_consumer_register() at the end of
regulator_register() and a call to
regulator_proxy_consumer_unregister() at the beginning of
regulator_unregister().  These calls ensure that proxy consumer
features may be used by any type of regulator regardless of the
driver supporting it.

Signed-off-by: David Collins <collinsd@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ARM: dts: msm: Add proxy consumer properties for regulators on msm8974

Add regulator proxy consumer properties for the regulators used
by clocks on msm8974 and msm8974pro targets:

     supply     msm8974            msm8974pro
1. vdd_dig    pm8841_s2_corner  pma8084_s2_corner
2. vdd_mem    pm8841_s1_ao      pma8084_s1_ao
3. vdd_hfpll  pm8941_l12        pma8084_l12

Use proxy consumers to ensure that each of these regulators is
kept on during boot-up at the highest allowed voltage.  This
guarantees that any hardware set up by bootloaders at non-minimum
regulator voltage will continue to operate until the driver
responsible for the hardware has initialized and made its own
regulator requests.

Signed-off-by: David Collins <collinsd@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
defconfig: Enable proxy consumer driver

Enable the proxy consumer driver so that regulators may be
kept at a certain minimum level during boot.

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: krait-regulator: add support for auto mode

On certain PMIC the AUTO mode for the ganged regulator operates
within spec. Allow the driver to use the auto mode and skip
controlling  PFM/PWM mode switching.

Enable support for using auto mode configuration.

Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ARM: dts: enable auto mode for MSM8974 based devices

Enable auto mode for MSM8974 based devices. Auto mode is enabled
only in single phase configuration, allows us to switch between
pfm and pwm mode based on the load profile.

Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
dwc3: gadget: Add support for transfer complete events counting

Add counting of USB transfers completion events/interrupts
so that it can be used to determine USB transfers or BUS usage.
This is a simple approach which gives reasonable accuracy to
avoid counting actual bytes that got transferred over USB.

Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
USB: ci13xxx_udc: Add support for UI interrupts counting

Add counting of UI or USB transfers completion interrupts
so that it can be used to determine USB transfers or
BUS usage. This is a simple approach which gives
reasonable accuracy to avoid counting actual bytes
that got transferred over USB.

Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ARM: dts: msm: Update the vifeed back routing

Codec clock should be enabled when vifeedback path for speaker
protection is enabled.
Change adds the routing entries to enable the codec clock for
speaker protection vi capture feedback path for 8974.

Signed-off-by: Gopikrishnaiah Anandan <agopik@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ASoC: msm: Rampup volume on each start

Rampup volume on each trigger start call to compress driver.
This helps in reducing pops heard by the listener after a seek/pause+resume

Signed-off-by: Haynes Mathew George <hgeorge@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
mfd: wcd9xxx: Add support for REPEAT_CHANGE_VALUE

Slimbus supports ability to write upto 16 bytes to the same register as
one transaction on the bus through REPEAT_CHANGE_VALUE slimbus message.
Add support to write codec register with multiple values using
REPEAT_CHANGE_VALUE. Not all sizes from 1 to 16 are supported by such a
message, add support in driver to be able to write all sizes from 1 to
16 by splitting the register writes of unsupported sizes into multiple
writes of supported sizes.

Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
bcmdhd: fix p2p interface and wlan0 assoc race

Do not allow virtual p2p interface creation while the AP
driver status is CONNECTING

Bug 200009241
Bug 200009346
Bug 200009344
Bug 200009328

Signed-off-by: bibhayr <bibhayr@nvidia.com>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: mdss: acquire list_lock before calling free pipe

If unblank call and display thread tries to free pipe
list at the same time; one of the caller might hit the
null free list and leads to crash. Acquire list_lock
before calling the free pipe API.

Signed-off-by: Dhaval Patel <pdhaval@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>