msm: thermal: Optimize locking in thermal frequency mitigation thread

Optimize locking in thermal frequency mitigation thread
to reduce lock contention with hotplug mitigation thread.
This lock is not explicitly required since the cpu driver
already have a per cluster lock down the freqency mitigation
call path. This would be much optimized since the new changes
will hold the lock for a shorter period and unlike previously
where the lock was for entire cluster, this is per cluster
lock that will further reduce lock contention. This would
help thermal to do mitigation faster.

Signed-off-by: Shiju Mathew <shijum@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
SoC: 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: Asish Bhattacharya <asishb@codeaurora.org>
Signed-off-by: Mohammad Johny Shaik <mjshai@codeaurora.org>
Signed-off-by: Pavan Chikkala <pavanc@codeaurora.org>
Signed-off-by: Pavan Chikkala <pavanc@codeaurora.org>
Signed-off-by: Divya Narayanan Poojary <dnaray@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ASoC: msm: qdsp6v2: add check for NULL dereference

The asm loopback driver during close does not check
for NULL before closing the playback and capture
instances.

The change ensures only the valid playback/capture
instances are closed.

Signed-off-by: Aravind Kumar <akumark@codeaurora.org>
Signed-off-by: Pradosh Das <c_prados@qti.qualcomm.com>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: Increase start voice command timeout

Start voice command timeout is exceeding 300ms
on ADSP.BF.2.2. Increase it to 500ms to avoid
timeout errors.

Signed-off-by: Karthik Reddy Katta <a_katta@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
mm: vmscan: lock page on swap error in pageout

A workaround was added ealier to move a page to active
list if swapping to devices like zram fails. But this
can result in try_to_free_swap being called from
shrink_page_list, without a properly locked page.
Lock the page when we indicate to activate a page
in pageout().
Add a check to ensure that error is on swap, and
clear the error flag before moving the page to
active list.

Signed-off-by: Vinayak Menon <vinmenon@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ASoC: msm: fix bounds checking for ADM get params

Update boundary check in ADM_GET_PARAM response,
the param_size returned from DSP is in number
of bytes, update the same in GET_PARAM_CDM_RSP.

Signed-off-by: Ashish Jain <ashishj@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ngd_slim: Fix return paths in transfer function

* Align with CAF.

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
slim_msm: support non-blocking writes from slimbus MSM controller

Provide non-blocking write support so that clients can queue multiple
writes, or larger transfers without performance implications.
TX buffer is created and descriptors out of this buffer
are submitted to HW to transmit data.
Descriptor is returned to 'available' pool of TX buffer when HW
interrupt for transmission status is recieved.

Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ngd_slim: Ignore pm_runtime_get error when runtime-pm is not enabled

Controller power-up uses different code-path when runtime-pm is not
enabled.

Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
slim_ngd: Use DSP before-shutdown notification for DSP SSR

QMI_SERVER_EXIT notification comes too late (after the DSP has
shutdown). This can result in unclocked access by BAM if there was
in-flight transaction. Use BEFORE_SHUTDOWN notification of SSR
framework instead to make sure in-flight transaction is finished
before DSP turns off its resources.

Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
Signed-off-by: Dilip Kota <c_dkota@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
slim_ngd: Ensure device state consistency with runtime-pm during SSR

During ADSP SSR, client's thread calling runtime-pm resume will
fail since ADSP is unreachable. Make sure such power-up/resume attempt
is blocked until ADSP comes up by using mutex during device-state
transition.

Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>