radio: iris: Handle force close gracefully

Do not queue the FM disabled event while in OFF state.

Change-Id: I8f8cd31198f8bb1a7521920844e0f0c5c3190b08
CRs-Fixed: 492216
Signed-off-by: Venkateshwarlu Domakonda <Venkateshwarlu@codeaurora.org>
u_hsuart: Fix a bug in opening the SMUX port

commit 9fdf017a (tty: n_smux: add separate close notifications)
implemented SMUX_LOCAL_CLOSED notification for clients to know
when the port is ready for opening again.  Use this notification
and defer opening until the port is ready.  If the port is opened
before this notification is arrived, the open will fail and
rmnet/dun does not work.

CRs-Fixed: 509013
Change-Id: I18bf9f08029fb98d611679d3aa65d13b088da8bc
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
tty: n_smux: fix deadlock between RX and TX workers

smux_handle_rx_open_ack function acquires the channel state spin lock
and tries to add the channel into ready list causing spin lock lockup
between smux_rx_worker thread and smux_tx_worker thread running on
two different CPUs.

Add the channel to ready list after releasing the state spin lock.

CRs-Fixed: 514726
Change-Id: I11729290c5c28a13bed66cf7506b8aaf48a32d2a
Signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
msm: rotator: Wait for the pending commits in finish IOCTL

Due to asynchronuous rotator mechanism, sometimes the
MSM_ROTATOR_IOCTL_FINISH arrives before the previously queued
do_rotate work is completed. This causes fence to be signalled
before the buffer is used by rotator. In case of fast YUV 2 pass
scenario, this causes IOMMU page fault on 2 pass buffers, since
the buffer is unmapped when the rotator is still using it. Hence,
wait for the pending commit works to be finished before releasing
the fence and freeing the 2 pass buffers.

Change-Id: Iec9edd11406d102c7dd102c2ad7935184bbbba93
Signed-off-by: Padmanabhan Komanduru <pkomandu@codeaurora.org>
diag: Command registration not happening properly

Some CM command registrations are not happening properly
on apps side. This could be because some smd events
for control type were getting missed. Make changes
in order to read pending SMD packets for control
type.

Change-Id: I0fe25455275f6169bee91d151d8657330081c104
CRs-Fixed: 516718
Signed-off-by: Mohit Aggarwal <maggarwa@codeaurora.org>
sync: Limit logging to particular fence on timeout and error

Change-Id: I5bd7d62260666cdd2a32212f0e828d2d5d7d7bba
Signed-off-by: Prakash Kamliya <pkamliya@codeaurora.org>
Bluetooth: Disable Sniff on HID ACL(s) if SCO is active

This patch disables sniff support on HID ACL(s) if SCO is active by
updating Link Policy settings. Once SCO is disabled, link policy is
again updated to re-enable Sniff on HID ACL(s). Without this patch
it was seen in presence of SCO, disconnection was observed on HID
ACL(s).

Change-Id: I81e0b3725bdadffe06ddb345afb9de2e042d5f9a
CRs-Fixed: 509616
Signed-off-by: Hemant Gupta <hemantg@codeaurora.org>
spi_qsd: set device's runtime PM status to 'suspended'

Device's runtime PM status is not in suspended state during
system suspend.

CRs-Fixed: 512718
Change-Id: I5c0cb39c0b91782d8686c1b3da81125169ccf9be
Signed-off-by: Alok Chauhan <alokc@codeaurora.org>
ASoC:msm: Increase Proxy buffering

-Proxy buffering can overflow if BT
playback setup takes a lot of time
-Fix this by increasing the proxy
buffer size so that we will end
up buffering the additional data that
can come in during this time

Change-Id: I736937ad03684a3b9aff586b8f676ec60259a442
Signed-off-by: Alexy Joseph <alexyj@codeaurora.org>
Bluetooth: Fix for the l2cap layer crashes while turning OFF BT

-This patch fix a case where while turning OFF BT l2cap channel
 & l2cap conn get deleted in one process context, which preempted
 the another process, where l2cap con was being used while trying to
 disconnect l2cap.  As the result l2cap conn pointer become invalid.
 Later which is leading a crash.  L2cap conn should be guarded by
 spin lock while disconnecting l2cap to avoid preemption which will
 avoid  crash due invalid conn pointer.

-This patch fix list_add crash due to invalid skb pointer.
 & BUG sleep warning as well.

CRs-Fixed: 499732, 504054

Change-Id: I90c5d29cc8728566a420f0dedaf7075846b32d1a
Signed-off-by: Nitin Shivpure <nshivpur@codeaurora.org>
msm: kgsl: Fix the extra draw packet on resume for A305

The extra draw command on resume was missing some state. Add the missing
state registers, to avoid stability issues.

Change-Id: Iad51cbe3be7b2951563c989625a690178491e0c8
Signed-off-by: Lynus Vaz <lvaz@codeaurora.org>
msm: bam_dmux: delay shutdown until DL polling is complete

Bam_dmux assumes that a shutdown event will not occur while downlink (DL)
polling is active. If this assumption does not hold, bam_dmux stops
polling, but does not cleanly switch back to interrupt mode until the next
power-on event. This is a problem because the next power-on event could
occur in the distant future and until that time some resources may be
incorrectly accessed or not released. Instead, if a shutdown event occurs
while DL polling is active, delay processing of that event until polling
completes.

CRs-Fixed: 503046
Change-Id: I67e4216b4820942e6070944557cd13f59600a2aa
Signed-off-by: Brent Hronik <bhronik@codeaurora.org>
wcnss: Do not log CCPU registers

Accessing CCPU registers during WDI timeout can cause timeout issues
when common_ss is power collapsed. So remove the CCPU register dump from
reset intrrupt API.

Change-Id: I4945d827c1840e85e796c276c45f7cf23cbe2b2a
CRs-Fixed: 517940
Signed-off-by: Sameer Thalappil <sameert@codeaurora.org>
EHCI: HSIC: Disable CPU Idle states before resuming the port

The CPU idle states are disabled to reduce the USB GPT interrupt
latency during bus resume.  The pm_qos_update_request() is blocked
until all the online cores are brought out of idle states. If this
call is blocked for longer time than resume signaling, the resume
sequence is repeated again.  Fix it by calling pm_qos_update_request()
before resuming the port.

CRs-Fixed: 515547
Change-Id: I651910bf3ac296914af3642718bca3aa07d0d407
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
usb: u_bam: Fix spinlock leak followed by lockup from workqueue

Driver has missing code to release spinlock while returning from
workqueue in case of memory allocation failures.
Returning from workqueue without releasing spinlock messes up
with worker thread and kernel keeps throwing up warnings like:
"BUG: workqueue leaked lock or atomic: kworker/u" for any
sleeping function called from worker thread afterwards. Later
when driver again tries to acquire same (unreleased) spinlock
it results in spinlock lockup.

CRs-Fixed: 497158
Change-Id: I4eaa7aaa42ed95a9b78a8939e80f4c0694e574b2
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
tspp: Add synchronization between API call and tasklet

The TSPP driver uses a tasklet which is scheduled on BAM transfer
completion to process the data. The tasklet verifies that the
channel had not already been closed. Therefore, it is necessary
to have a synchronization mechanism between the channel_close API
function and the tasklet function. Added acquisition of spinlock
in the channel_close function.

Change-Id: I274298cbc9c83b4b6c1d50ffb709b8c5d8d43231
CRs-Fixed: 477556
Signed-off-by: Liron Kuch <lkuch@codeaurora.org>
vm: convert fb_mmap to vm_iomap_memory() helper

This is my example conversion of a few existing mmap users.  The
fb_mmap() case is a good example because it is a bit more complicated
than some: fb_mmap() mmaps one of two different memory areas depending
on the page offset of the mmap (but happily there is never any mixing of
the two, so the helper function still works).

Change-Id: I291e4392725fda8d54ac045663ade7ffb7598d15
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
msm_fb: display: Add delay kickoff to MDDI

Add delay kickoff mechanism to consolidate multiple kickoffs
into one to avoid unnecessary delay at MDDI interface.
Also the MDP4_NONBLOCKING was removed due to every MDDI kickoff
is blocked until overlay blending completion interrupt is delivered.
This patch also remove unnecessary semaphore at the topmost layer
(fbmem) ioctl to allow multiple msm_fb ioctl calls. Mutex is
provided by individual function to synch between multiple
ioctl calls.

CRs-fixed: 264934
Change-Id: I3aecdd9cb4d7c79f67b641f90e78a6764095a6b2
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
Signed-off-by: David Brown <davidb@codeaurora.org>
vm: add vm_iomap_memory() helper function

commit b4cbb197c7e7a68dbad0d491242e3ca67420c13e upstream.

Various drivers end up replicating the code to mmap() their memory
buffers into user space, and our core memory remapping function may be
very flexible but it is unnecessarily complicated for the common cases
to use.

Our internal VM uses pfn's ("page frame numbers") which simplifies
things for the VM, and allows us to pass physical addresses around in a
denser and more efficient format than passing a "phys_addr_t" around,
and having to shift it up and down by the page size.  But it just means
that drivers end up doing that shifting instead at the interface level.

It also means that drivers end up mucking around with internal VM things
like the vma details (vm_pgoff, vm_start/end) way more than they really
need to.

So this just exports a function to map a certain physical memory range
into user space (using a phys_addr_t based interface that is much more
natural for a driver) and hides all the complexity from the driver.
Some drivers will still end up tweaking the vm_page_prot details for
things like prefetching or cacheability etc, but that's actually
relevant to the driver, rather than caring about what the page offset of
the mapping is into the particular IO memory region.

Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
power: pm8921-bms: fix SOC jumps while entering suspend/resume

The last_soc is being set to -EINVAL when entering suspend. This
causes SOC to jump while coming out of resume.

Instead remember
If we are reporting for the first time after suspend.
The calculated_soc at the time we went to suspend.

Soc should not increase because we cannot suspend while
charging. If the calculated_soc has increased continue reporting
the lower last_soc.

If the calculated soc has dropped check if it has dropped since
suspend. If so decrease the reported soc by the amount it dropped
since suspend.

If the calculated soc has dropped but it has increased since suspend
continue to report the last_soc.

Change-Id: I9040feceaa3e829d11bec0b21e61951f2ed1180b
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
Signed-off-by: Xiaozhe Shi <xiaozhes@codeaurora.org>