mmc: msm_sdcc: Enable AUTO_PROG_DONE for CMD25

With commit (d5d59dc) setting AUTO_PROG_DONE bit for Multi
block write command (CMD25) is broken. Fix this by setting
wait_for_auto_prog_done flag for CMD25 preceded with CMD23.

Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
(cherry picked from commit b8e8369371e351dcc7708ac63cac26dede3a543f)

CRs-Fixed: 383088
Change-Id: Ie71b2c8f40d74dd2042bd00e1e5f47a71a8637e6
Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
Bluetooth: Prevents update of Low Energy connection parameters

The start encryption command fails when the LE update
connection parameters request is pending.
Hence, prevent the update of LE connection parameters during the
bonding process. The update of connection parameters is
not necessary during bonding process.

CRs-fixed: 380257
Signed-off-by: Subramanian Srinivasan <subrsrin@codeaurora.org>
(cherry picked from commit 923e3e66d32f7071fcf8eea87b073aa1966e4e9b)

Change-Id: I9e9607423aae2a0bb2e7469d7cdbebefc3fc664b
Signed-off-by: Ramakrishna Prasad N <crpn@codeaurora.org>

Conflicts:
	net/bluetooth/smp.c
Revert "Revert "msm: gpio-v2: Fix spurious interrupts when gpio-irq is unmasked""

This reverts commit 7dde3a1d9af53f8f25597c2b1ca743c56b80a3ec.

Change-Id: I671ae95eb9c39881fbe415840d9b248b3adb33bb
Signed-off-by: Rohit Vaswani <rvaswani@codeaurora.org>
msm: gpio-v2: Re-arrange the write to RAW_STATUS_EN

Move enabling the RAW_STATUS_EN at the very beginning.
Hardware team clarified that it is better to write to
RAW_STATUS_EN before writing to any other INTR_CFG bits
in order to prevent spurious interrupts.
Removing writing to the GPIO_INTR_CFG_SU register
during every mask/unmask as it could cause spurious
interrupts as well.

Change-Id: Ifbd991364216ef5f163e5211bc35f7f145c75916
CRs-Fixed: 346861
Signed-off-by: Rohit Vaswani <rvaswani@codeaurora.org>
msm: gpio-v2: Clear the interrupt status before unmasking

After the change to keep the RAW_STATUS_EN always on, the
interrupt status bit was latched and could be set during
other (non-interrupt) activity on the GPIO line. This would
end up triggering the interrupt as soon as it was unmasked.
Hence, clear the interrupt status before unmasking the gpio
interrupt.
This keeps the behavior and expectations same as when the
RAW_STATUS_EN was toggled and it prevented the interrupt
status from being updated while the interrupt was masked.

Change-Id: I2bbfa36e4ec0f4a961f05047f4061d7d8fc9fd2f
CRs-Fixed: 346861
Signed-off-by: Rohit Vaswani <rvaswani@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>
USB: ci13xxx_udc: Convert ATDTW loop into finite one

Currently while queueing requests to HW, waiting in infinite
loop till ATDTW bit set for HW semaphore to be released by HW
to avoid race conditions between HW and SW. This could lead to
watchdog timer expiry if bus infrastructure is stuck. Hence
convert this loop into finite loop of 100msec which is atmost
required for USB HW to release HW semaphore as per HW team.

CRs-Fixed: 368769
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
(cherry picked from commit 397a453ef048dde980b321c637d86662adbe077c)

Conflicts:

	drivers/usb/gadget/ci13xxx_udc.c

Change-Id: I7c4a7e16ebbb8d5d0c196674708c72a306098279
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>
wcnss: cancel any pending APPS votes from coldboot before SSR

APPS vote from coldboot may be still pending when SSR is invoked;
so make sure that the APPS votes from coldboot are cancelled before
SSR votes for these Riva regulators.

CRs-fixed: 380434
Signed-off-by: Sameer Thalappil <sameert@codeaurora.org>
(cherry picked from commit 13f45182fcd1756df8526e1be19c1cf4717dec09)

Change-Id: I4b06d8445c9036078c1962280047990621dcdbbb
Signed-off-by: Ramakrishna Prasad N <crpn@codeaurora.org>
wcnss: fix incomplete ramdump for wcnss

SSR3 ramdump API only specifies 3MB wcnss RAM segments. Increase
this to 5MB to specify the complete wcnss RAM segments.

CRs-fixed: 377178
Signed-off-by: Sameer Thalappil <sameert@codeaurora.org>
(cherry picked from commit 84bc89aa4e4ff5508b0b774c74d39f2b4b658bb8)

Change-Id: I9c2139400c6dcec7cfc240ec7822bf30aac4789c
Signed-off-by: Ramakrishna Prasad N <crpn@codeaurora.org>
arm: Don't disable interrupts during WFE fixup

Disabling interrupts during the Krait WFE fixup can result
in deadlock if a thread tries to acquire a spinlock that is
released from an interrupt context. Instead of disabling
interrupts, modify the interrupt handler to reset the fixup
condition to put the processor into a safe state in the
event that the interrupt came in during the fixup window.

CRs-Fixed: 383670
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
(cherry picked from commit 1fd137804b489f7a0b4103d846cda13a07e26cdf)

Change-Id: Ie6d1adc42cc0a68bbbaeaa35f18cdda074d66cd5
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>
Bluetooth: Fix RFCOMM session reference counting issue

There is an imbalance in the rfcomm_session_hold / rfcomm_session_put
operations which causes the following crash:

[  685.010159] BUG: unable to handle kernel paging request at 6b6b6b6b
[  685.010169] IP: [<c149d76d>] rfcomm_process_dlcs+0x1b/0x15e
[  685.010181] *pdpt = 000000002d665001 *pde = 0000000000000000
[  685.010191] Oops: 0000 [#1] PREEMPT SMP
[  685.010247]
[  685.010255] Pid: 947, comm: krfcommd Tainted: G         C  3.0.16-mid8-dirty #44
[  685.010266] EIP: 0060:[<c149d76d>] EFLAGS: 00010246 CPU: 1
[  685.010274] EIP is at rfcomm_process_dlcs+0x1b/0x15e
[  685.010281] EAX: e79f551c EBX: 6b6b6b6b ECX: 00000007 EDX: e79f40b4
[  685.010288] ESI: e79f4060 EDI: ed4e1f70 EBP: ed4e1f68 ESP: ed4e1f50
[  685.010295]  DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068
[  685.010303] Process krfcommd (pid: 947, ti=ed4e0000 task=ed43e5e0 task.ti=ed4e0000)
[  685.010308] Stack:
[  685.010312]  ed4e1f68 c149eb53 e5925150 e79f4060 ed500000 ed4e1f70 ed4e1f80 c149ec10
[  685.010331]  00000000 ed43e5e0 00000000 ed4e1f90 ed4e1f9c c149ec87 0000bf54 00000000
[  685.010348]  00000000 ee03bf54 c149ec37 ed4e1fe4 c104fe01 00000000 00000000 00000000
[  685.010367] Call Trace:
[  685.010376]  [<c149eb53>] ? rfcomm_process_rx+0x6e/0x74
[  685.010387]  [<c149ec10>] rfcomm_process_sessions+0xb7/0xde
[  685.010398]  [<c149ec87>] rfcomm_run+0x50/0x6d
[  685.010409]  [<c149ec37>] ? rfcomm_process_sessions+0xde/0xde
[  685.010419]  [<c104fe01>] kthread+0x63/0x68
[  685.010431]  [<c104fd9e>] ? __init_kthread_worker+0x42/0x42
[  685.010442]  [<c14dae82>] kernel_thread_helper+0x6/0xd

This issue has been brought up earlier here:

https://lkml.org/lkml/2011/5/21/127

The issue appears to be the rfcomm_session_put in rfcomm_recv_ua. This
operation doesn't seem be to required as for the non-initiator case we
have the rfcomm_process_rx doing an explicit put and in the initiator
case the last dlc_unlink will drive the reference counter to 0.

There have been several attempts to fix these issue:

6c2718d Bluetooth: Do not call rfcomm_session_put() for RFCOMM UA on closed socket
683d949 Bluetooth: Never deallocate a session when some DLC points to it

but AFAICS they do not fix the issue just make it harder to reproduce.

Change-Id: I0b8f5b84211a3893c3bac4cce143172c327a7aa2
Signed-off-by: Octavian Purdila <octavian.purdila@intel.com>
Signed-off-by: Gopala Krishna Murala <gopala.krishna.murala@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>

Conflicts:
	net/bluetooth/rfcomm/core.c
msm_fb: Increase PWM granularity to 255 levels for 8960 fluid

Currently 8960 fluid display panel only supports 100 levels for backlight.
Content Adaptive Backlight Control requires 255 levels of backlight for
optimal user experience with CABL turned on.

CRs-fixed: 342485

Signed-off-by: Pravin Tamkhane <pravint@codeaurora.org>
(cherry picked from commit 9f1453ec3eb2b22160d25148a45f1731a23d4c95)

Change-Id: I3941f8dda0bc0e0f3a466b8597a389091a6b22cc
Signed-off-by: Ramakrishna Prasad N <crpn@codeaurora.org>
msm_fb: Increase backlight granularity from 15 to 255 levels

Currently number of backlight levels are set to 15, which causes
noticeable flicker when backlight level is changed from CABL
functionality in userspace. So to improve visual performance,
increase backlight granularity from current 15 levels to 255 levels.

This change is for msm8960 & apq8064 liquids which use Chimei panels.

CRs-fixed: 342485

Signed-off-by: Pravin Tamkhane <pravint@codeaurora.org>
(cherry picked from commit eee66c6ffa18c954fa2583fdda66526f90bad40b)

Conflicts:

	drivers/video/msm/mipi_chimei_wuxga.c
	drivers/video/msm/mipi_tc358764_dsi2lvds.c

Change-Id: I35b5f6a9468d74792d1f90e752750a05e58bb4cd
Signed-off-by: Ramakrishna Prasad N <crpn@codeaurora.org>
ASoC: wcd9310: enhance mbhc button release detection performance

Enhance button release detection performance by adopting dynamic release
threshold adjusting logic.
Button release is now detected more quickly.

Change-Id: Idad06b673599a5dec53b62ffdab9b9217bd9b3ff
Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
ASoC: wcd9310: enhance mbhc button press detection performance

If interrupt handler is not quicker than voltage ramp up by button
release, driver requested measurement won't see stable voltage.
Enhance button press detection performance by comparing voltage
measurements from codec hardware only.

CRs-fixed: 376825
Change-Id: Ie52b8a8cb3be3e2de50b8c60a0d3bcd1067de847
Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
ASoC: wcd9310/9304: Pull down Mic Bias output by default.

If Mic Bias is high Z by default and when the LDOH is enabled,
the Mic Bias output can pull-up to a non-zero voltage if there
is no loading or if the load leakage is very small.  Pulling
down the Mic Bias output so it is not in high Z to eliminate
the floating voltage.

CRs-Fixed: 368898
Signed-off-by: Kuirong Wang <kuirongw@codeaurora.org>
(cherry picked from commit ccb29c6c7e8779ac6574f581d1f930a9a4cf6eb5)

Conflicts:

	sound/soc/codecs/wcd9304.c

Change-Id: I93ab762a9a8b03f003cc23b993fd54dee9b9b886
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>
msm_fb: display: switch blt mode on/off without turning off TG

Turning off dtv TG may cause blink. MDP requires h/w idle to change
blt mode, turning off TG can make sure mdp h/w is idle. If turning off
TG is not desired, one way to do is to check busy bits of overlay and
dmae and once they are both idle, the mode can be changed.

CRs-fixed: 363717
Signed-off-by: Huaibin Yang <huaibiny@codeaurora.org>
Signed-off-by: Ajay Singh Parmar <aparmar@codeaurora.org>
(cherry picked from commit 43da18d00abc2a61834b6650a49bf7edcf4f4df0)

Conflicts:

	drivers/video/msm/mdp4_overlay_dtv.c

Change-Id: I8aeea1439a83b71e5980080a5396cc9c9fa8556b
Signed-off-by: Ramakrishna Prasad N <crpn@codeaurora.org>