INTELLIDEMAND: major clenup after code review! cpu sync is moved!

*cleaned cpu sync it's moved to cpu-boost code long tme ago.
*cleaned white space and fix logic.
*restored dbs call check.
*cleaned all that connects to input event! gov no longer control that!
all input events are in cpu-boot code.

https://github.com/dorimanx/Dorimanx-LG-G2-D802-Kernel/commit/c3c4ede8bca2b6f9fcb8cc8b182478ec9f8c1c45#diff-2fb2ff31b83f32cfa38e7c82f8c8ae78R1300
https://github.com/dorimanx/Dorimanx-LG-G2-D802-Kernel/commit/b2a74a08cd73be75c5cdddea1086b15bb8fb1f49
CPUFREQ ONDEMAND: Add task thread update from IntelliDemand.

*added lost checks
*cleaned code style.
REVERT CPUFREQ ONDEMAND: Add task thread update from IntelliDemand.

After tests, i see high perf reduce on cpu bench.

So clean this code from both Ondemand and IntelliDemand
CPUFREQ: update ONDEMAND + INTELLIDEMAND with new LOAD calc boost.

/*
 * If the CPU had gone completely idle, and a task just woke up
 * on this CPU now, it would be unfair to calculate 'load' the
 * usual way for this elapsed time-window, because it will show
 * near-zero load, irrespective of how CPU intensive the new
 * task is. This is undesirable for latency-sensitive bursty
 * workloads.
 *
 * To avoid this, we reuse the 'load' from the previous
 * time-window and give this task a chance to start with a
 * reasonably high CPU frequency.
 *
 * Detecting this situation is easy: the governor's deferrable
 * timer would not have fired during CPU-idle periods. Hence
 * an unusually large 'wall_time' indicates this scenario.
 */
lpm_levels: Do not allow power collapse when multi cores online

When any core power collapse is not selected, no need to allow
idle power collapse on cpu0 when multi cores online. It may leads to
stability issues.

Signed-off-by: Anji Jonnala <anjir@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ASoC: compress: fix the target not going to TCXO shutdown

The error code propagated from the flush cmd in the trigger stop
is causing the error in the state of the soc compress framework.
This hinders in closing the BE connected to the FE.
If the AFE is not closed it prevents the target to go into TCXO
shutdown.
Fixed by removing the error handling of the flush command in the
trigger stop, since failure in flush doesn't signify the
failure in the stop command.

Signed-off-by: Aviral Gupta <aviralg@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
cpufreq: intellidemand: Cleanup unused sync waitqueue

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
patch-3.4.97-98 using patch -p1 <
CPUFREQ: Clean Ondemand get tit close to LG stock, revert tuning in others.

*Clean the SMART UP its was not allowing max freq and was laggy.
*Revert DEF_SAMPLING_DOWN_FACTOR = 4 as it's make max freq always on core 0.
drivers: bluetooth: Improve use of macros

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>

Also set TX_TIMER_INTERVAL to 10 to save move battery.
THERMAL CONTROL: fix shutdown on bench test.
Disable ARCH_POWER and SLEEPERS

*Power save on suspend was better with ARCH_POWER OFF.
Set all versions of sync_freq to middle range freq to gain high perf.

and not allow to set less than 960000Mhz
as at this point gov start to LAG hard!

LG default hotplug also set sync_freq types to 960000 by default,
and if user select default hotplug he loose performance allot.
Kernel 5.9
ASoC: msm: Fix for USB device switch

Add mutex locks to prevent sending multiple mem map
commands unless the previous one returns, because otherwise
the mem_handle is overwritten.

Signed-off-by: Vicky Sehrawat <vickys@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ASoC: wcd9320: Fix null pointer access for event callback

The ASoC machine driver provides callback to codec driver to setup
certain settings that are specific to the machine. It is possible that
machine driver does not provide this callback when there are no machine
specific settings. In such cases the callback will be NULL. Make sure to
not access the callback if it is NULL to avoid null pointer dereference.

Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ASoC: wcd9xxx: Enable headset in high performance

Invoke class AB sequence for headset path dynamically based on
module parameter. Change enables headset path in high performance
mode when module parameter is set to one.

Signed-off-by: Sudheer Papothi <spapothi@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ASoC: wcd9xxx: Enable headset in high performance

Invoke class AB mode for headset path when sample rate
is set to 192KHz and bit width is set to 24. Change enables
headset path in Ultra High Quality Audio(UHQA)mode.

Signed-off-by: Sudheer Papothi <spapothi@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
drivers: mfd: Cleanup of wcd drivers

Kernel has defined printk format specifiers and typedefs
for datatypes.
Using the format strings will remove need for typecasting.
This change cleans up wcd msm drivers to use the kernel
defined data types and format specifiers for printk.

Signed-off-by: Gopikrishnaiah Anandan <agopik@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ASoC: wcd9xxx: fix the NULL pointer dereference causing the crash

If the probe of the device is unsuccessful then the wcd9xxx
structure is unallocated but is not initialized to NULL.
If some operation like reset comes, it would dereference the wcd9xxx
structure leading to the target crash.
Fix by intializing the client data to NULL after it is unallocated.

Signed-off-by: Aviral Gupta <aviralg@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>