SOUND CONTROLS: Move MIC/SPEAKER controls to STweaks. and set correct control!

I have found that camera mic was headset mic! and reverce!
simple test when calling my second phone :)

now all good.
Kernel 5.2
Revert "msm_serial_hs_lite: Add support for uart console enable/disable"

This reverts commit 2c3684be94047ffb776e8c5232ec5cf0fdf3d12c.
Revert "tty: serial: msm_serial_hs: Enable/Disable uart irq over clk on/off"

This reverts commit 8cc81b6fa181d8f7cd88269bb8d7b3bc1d3e4174.
Revert "msm_serial_hs: Programing the TX FIFO watermark level to 4"

This reverts commit 87552eb01630f49e5627419cf0764ab7cb3b1ad6.
Revert "msm_serial_hs: Disable RX PIPE before sps_disconnect"

This reverts commit fb3af9ff0d08ac337a62009e85339a0b51c4865d.
Revert "msm_serial_hs: Initialize tty_flush_recieve while Port Open"

This reverts commit f706b81c8fedeb91a0952eededd7b85ac1e99ff0.
usb: gadget: Ignore the second set_config from the host

Some USB hosts may send SET_CONFIGURATION with same value twice.
The current code implementation of android_work() issues disconnect
event to userspace if SetConfiguration with non-zero value is sent
twice. The Userspace application may disconnect USB and it causes
fail to connect to the USB host.

Fix this by ignoring the second time SET_CONFIGURATION request
from the host only for the same configuration value twice.

CRs-Fixed: 661220
Change-Id: Iec8dd7824fa9f371ea147784cf9137aa88a7128e
Signed-off-by: ChandanaKishori Chiluveru <cchilu@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
USB: android: Add support for USB UICC mass storage

USB UICC cards can support multiple partitions which can be
exposed to the host via USB mass storage function. The number
of partitions of UICC card may vary for each target. Hence
create a device tree property to accept the required luns.

Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
USB: android: release spinlock before queuing work in android_setup

In android_setup we release spinlock after scheduling the work but there
is no need for holding the spinlock during the schedule_work call
is executed this can lead to spinlock timeouts in case where schedule
work takes more time.

So before scheduling work in android_setup we release spinlock to avoid
potential spinlock lockup or timeout.

Signed-off-by: Tarun Gupta <tarung@codeaurora.org>
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
Signed-off-by: ChandanaKishori Chiluveru <cchilu@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
usb: android: Skip the work when set_config arrives with same value twice

Some USB hosts may send SET_CONFIGURATION with same value twice.
The current code implementation processing the 2nd set_config and
schedules the work. The android_work() issues disconnect event to
userspace if SetConfiguration with non-zero value is sent twice.
The userspace applications may disconnect the USB and the device
doesn't connect to the host.

Fix this by avoiding the android_work for the second time SET_CONFIGURATION
request when it receives SetConfiguration request with same configuration
value twice from the host.

Signed-off-by: ChandanaKishori Chiluveru <cchilu@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
usb: ci13xxx_udc: Do not clear ENDPTSETUPSTAT during USB BUS RESET

When the host sends a setup packet immediately after the bus RESET,
it is possible that due to interrupt latency the USB software observe
both USB BUS Reset Interrupt and USB interrupt for SETUP packet(UI) bits
getting set at the same time. The USB Interrupt SW routine handles the
reset interrupt as it has more priority than UI interrupt and clear the
ENDPTSETUPSTAT register. If the software clears this register, it will
not know that a SETUP packet arrived.

Fix the issue by not clearing the ENDPTSETUPSTAT during usb bus reset
processing. When USB HOST sends SETUP Packet, device controller sends ACK
and sets ENDPTSETUPSTAT bit and asserts USB Interrupt so that SETUP packet
can be correctly read by the software.

Signed-off-by: Saket Saurabh <ssaurabh@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
usb: Avoid incorrect memory leaks reported by kmemleak tool.

Certain memory allocations are not properly tracked by the kmemleak
tool, which causes it to incorrectly detect memory leaks. Notify the
tool by using kmemleak_not_leak() to ignore the memory allocation
so that incorrect leak reports are avoided.

Signed-off-by: Saket Saurabh <ssaurabh@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
usb: Fix race between diag_function_disable() and usb_diag_write()

There is a race when diag_function_disable() and usb_diag_write()
executes in parallel.
The diag context attribute is set to NULL in diag_function_disable()
which is later accessed in usb_diag_write() leading to NULL pointer
dereference.
Fix the issue by adding proper synchronization protection
for the diag context attribute in usb_diag_write().

Signed-off-by: Saket Saurabh <ssaurabh@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
usb: gadget: Fix response available notify count usage

The outstanding responses are purged and notify count is reset
during bus suspend. But the notify interrupt endpoint is not flushed.
If a request is pending with the controller, It gets finished during
resume and the notify count is decremented in the completion handler.
As the notify count is reset during the suspend its become negative now.
As the counter is not zero, interrupt notifications are queued even
though there are no responses. This is leading to watchdog bark due to
an error print messages.

Flush the notify endpoint before resetting the notify counter during
suspend. As we are modifying notify counter under spin lock, atomic
variable is not required. Ensure that notify counter never
becomes negative.

Signed-off-by: ChandanaKishori Chiluveru <cchilu@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
usb: f_qc_rndis: set context for encapsulated response

Setting the req->context field for encapsulated responses
as well as for encapsulated commands. This prevents a
corner case where the request is initially used for
a response, prior to using it for a command.

Signed-off-by: Dov Levenglick <dovl@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
usb: storage: enable scsi auto-suspend for USB UICC devices

The USB UICC devices have storage interface along with smart card
interface.  These devices will be always present.  Enable scsi
auto-suspend for these devices.  The smart card class driver
enables the auto-suspend of the USB device.

Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
USB: storage: Allow UICC cards to perform house keeping operations

Some UICC cards needs to perform the flash related operations during idle
time. The idle time is detected by the card by counting the consecutive
TEST_UNIT_READY commands. If the card does not find idle time, it perform
them while processing a WRITE(10) command. If the card is kept busy which
happens during continuous mass storage interfaces, it takes lot of time to
respond to the commands on the CCID interface.

Introduce a quirk called US_FL_TUR_AFTER_WRITE for sending 5 consecutive
TEST_UNIT_READY commands for every 8 WRITE(10) commands. This approach
forces the card to perform house keeping operations during continuous
mass storage transfers. The test result indicate no degradation in
the performance.

Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
cpufreq: Persist cpufreq time in state data across hotplug

Cpufreq time_in_state data for all CPUs is made persistent across
hotplug and exposed to userspace via sysfs file
/sys/devices/system/cpu/cpufreq/all_time_in_state

Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ipc: add sysctl to specify desired next object id

Add 3 new variables and sysctls to tune them (by one "next_id" variable
for messages, semaphores and shared memory respectively).  This variable
can be used to set desired id for next allocated IPC object.  By default
it's equal to -1 and old behaviour is preserved.  If this variable is
non-negative, then desired idr will be extracted from it and used as a
start value to search for free IDR slot.

Notes:

1) this patch doesn't guarantee that the new object will have desired
   id.  So it's up to user space how to handle new object with wrong id.

2) After a sucessful id allocation attempt, "next_id" will be set back
   to -1 (if it was non-negative).

[akpm@linux-foundation.org: checkpatch fixes]
Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Cc: Serge Hallyn <serge.hallyn@canonical.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Pavel Emelyanov <xemul@parallels.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Michael Kerrisk <mtk.manpages@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>