msm: bam_dmux: handle system wide low memory conditions

When A2 turns on, queue_rx() is first run from the SMSM thread, and
attempts to allocate 32 2kB-buffers with GFP_KERNEL for DMA transactions.
If the system is low on memory, the allocation could put the thread to
sleep while the memory allocator scavenges for enough memory to satisfy
the request.  This is not desired as it stalls a critical system thread
that is communicating with a real-time system.

Instead, use GFP_NOWAIT which will return immediately if no memory is
available for the allocation request so that bam_dmux may handle the
situation gracefully and possibly reschedule the allocations for a later
time.

CRs-Fixed: 406946
Change-Id: Ibff8c2d75c56b41c8d947a49e5a477fea7b31a36
Signed-off-by: Jeffrey Hugo <jhugo@codeaurora.org>
msm_fb: display: Add timeout for waiting on update

Content Adaptive BackLight userspace algo waits on UPDATE_NOTIFY to
get the screen updates. When turning off CABL, this blocking ioctl
causes the CABL threads to wait until next screen update, which may
take indefinite time.

Add timeout value to the wait_for_completion call, to make ioctl
call blocking for at most timeout value.

CRs-Fixed: 384026
Signed-off-by: Kinjal Bhavsar <kbhavsar@codeaurora.org>
(cherry picked from commit 1b6843a3a56e60e73305c66369f8ad806353e22d)

Change-Id: Ie550f650f399ec15eaedb3814aac6a8562b5bd46
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>
msm: bam_dmux: enable disconnect ack feature support by default

The disconnect ack feature is normally turned on by a handshaking
mechanism between bam_dmux and A2, but on some 9615 variants that
mechanism will not exist.  A2 will still expect the disconnect ack to
be active and might crash if it encounters that it is not active.
Enable the disconnect ack feature by default to prevent this.

CRs-Fixed: 372958 382037
Signed-off-by: Jeffrey Hugo <jhugo@codeaurora.org>
(cherry picked from commit b1e7c58c8f7e1495360784929245d30fcd32127e)

Change-Id: I208b55317b8ffe9dc988597b99b855fc9528d341
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>
msm: bam_dmux: update SSR handling to reflect disconnect ack on by default

When subsystem restart of the modem is triggered, the SSR handling function
disables the disconnect ack feature.  Later, when the modem reboots, it
expects the disconnect ack feature to be enabled by default as it was when
the modem first booted.  This causes a problem when the modem times out
waiting for the disconnect ack and asserts.

Fix the issue by changing the SSR code in bam_dmux to reenable the
disconnect ack feature instead of disabling it.

CRs-Fixed: 377493 382037
Signed-off-by: Jeffrey Hugo <jhugo@codeaurora.org>
(cherry picked from commit f62029d1c902342470816ad4920b08ea805a52d6)

Change-Id: I4073885a0148e938966ab5c246bb689063e5840b
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>
msm: bam_dmux: add missing parameter to bam_dmux_log() call

bam_dmux_log() takes a formatted string and a variable argument list
similar to printf() and creates printf() style output to a private kfifo
log.  This change fixes a particular invocation of bam_dmux_log() which has
an invalid variable argument list for the formatted string used.  Depending
on system timing, this invocation could succeed as expected, or it could
cause a null pointer exception.

To prevent further issues, add the __printf() function attribute so that
the gcc compiler will check at compile time the arguments to bam_dmux_log()
for proper number and types according to printf() usage.

CRs-Fixed: 382037
Signed-off-by: Jeffrey Hugo <jhugo@codeaurora.org>
(cherry picked from commit d7d2b0698912348c464e126fe85fa4aca9da0bd5)

Change-Id: Id3c678317412a348f7a1067f5a4fc975af2675a5
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>