block: blk-merge: don't merge the pages with non-contiguous descriptors

blk_rq_map_sg() function merges the physically contiguous pages to use same
scatter-gather node without checking if their page descriptors are
contiguous or not.

Now when dma_map_sg() is called on the scatter gather list, it would
take the base page pointer from each node (one by one) and iterates
through all of the pages in same sg node by keep incrementing the base
page pointer with the assumption that physically contiguous pages will
have their page descriptor address contiguous which may not be true
if SPARSEMEM config is enabled. So here we may end referring to invalid
page descriptor.

Following table shows the example of physically contiguous pages but
their page descriptor addresses non-contiguous.
-------------------------------------------
| Page Descriptor    |   Physical Address |
------------------------------------------
| 0xc1e43fdc         |   0xdffff000       |
| 0xc2052000         |   0xe0000000       |
-------------------------------------------

With this patch, relevant blk-merge functions will also check if the
physically contiguous pages are having page descriptors address contiguous
or not? If not then, these pages are separated to be in different
scatter-gather nodes.

(cherry picked from commit 6e25ce37a4f5750467f7c741b549687ebbc10667)

CRs-Fixed: 392141
Change-Id: I3601565e5569a69f06fb3af99061c4d4c23af241
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
Revert "power: pm8921-charger: change BOOT_DONE configuration"

This reverts commit b157ff75f967cc72c51f6eae3feaa6ba7a432c87.

Enabling BOOT_TIMER may cause an inadvertent shutdown in the subsequent
boot cycle for certain valid scenarios. Do not enable this bit.

(cherry picked from commit 953e63d6cda58957d5e34ff6c43c651f13bb04bb)

CRs-Fixed: 434578
Change-Id: I0d657c2e0d47af32cc35cd66b902be72952e5438
Signed-off-by: Anirudh Ghayal <aghayal@codeaurora.org>
msm_fb: display: release mdp clk in mdp4_overlay_writeback_on()

mdp clk is not released in mdp4_overlay_writeback_on()

CRs-fixed: 433986

Change-Id: Ida121e03b0f08ca312c60fb8d945fe2011df853f
Signed-off-by: Mayank Goyal <goyalm@codeaurora.org>
ASoC: wcd9310: Correct the mixer controls for Compander switches

- Compander1 never gets enabled though the user space sets the
  corresponding mixer control.
- Compander switch kcontrols are configured wrongly as integer
  type with max value as 0.
- Correct kcontrol creation to fix the issue.

CRs-Fixed: 441091

Change-Id: Iad99b44c9226da3bcc1132e61ea989a0543ae56e
Signed-off-by: Ravi Kumar Alamanda <ralama@codeaurora.org>
msm: acpuclock-8930ab: Update PVS Data for 1.7 GHZ parts

Characterization has been performed for 1.7GHz parts.
Add seven PVS tables and eliminate unused frequencies.

Change-Id: Ic5b738c85ba3032904c7882d7b25e6c0bd557828
Signed-off-by: Uma Maheshwari Bhiram <ubhira@codeaurora.org>
Bluetooth: hidp: safely acquire hci connection

Claim device lock to safely enumerate hci connection list and bump
hci connection proxy device ref count simultaneously.

Also it prevents kernel crash due to null pointer
conn->hdev in deleting conn entry from sysfs.

CRs-Fixed: 446403
Change-Id: I5ec4283d359f95e47711dff171d0619b15263349
Signed-off-by: Sumit Bajpai <sbajpai@codeaurora.org>
Signed-off-by: Mallikarjuna GB <gbmalli@codeaurora.org>
usb: diag_bridge: Support PID 9079

Add support for PID 0x9079 and also designate device IDs per-PID.
9079, having a device ID of 1, is intended to be able to coexist
with another probed device with device ID 0.

Change-Id: Ib8cc52a9277b0013e098baeaafa6fce1c8498c42
Signed-off-by: Jack Pham <jackp@codeaurora.org>
msm_fb: HDMI: Reset HDCP reauth flag when powering off

The software flag used for storing the HDCP reauthentication state
needs to be reset whenever the HDMI device is powered off. This is
needed to avoid a potential reauthentication attempt upon a
subsequent connection which could lead to device hang as a result
of incorrect sequence of register accesses.

CRs-Fixed: 444312
Change-Id: I6b5b08394dd96ccbc08c4ca72b6dc4b2c4dbf6be
Signed-off-by: Aravind Venkateswaran <aravindh@codeaurora.org>
ASoC: wcd9xxx: Support earpiece ANC

Added virtual widgets for enabling and disabling earpiece ANC.

Change-Id: Ia235928c34022de89ec0e66dbe533143f4d56684
Signed-off-by: Damir Didjusto <damird@codeaurora.org>
msm_serial_hs: consider flush buffer request only when DMA is in progress

TTY Core uses flush_buffer to clear out any output data before closing
port, whereas UART application can always request to do flush output data
before starting data transfer using tty supported ioctl().
receive_tty_flush is used to make decision on completion of any DMA Tx
data transfer. Using same approach when there is no DMA Tx transfer is
happening, it is breaking next DMA Tx transfer functionality. Hence
update receive_tty_flush only when there is any DMA TX transfer active.

(cherry picked from commit 53069734628ebce341cf1ef778c91dbcbbcf67db)

Change-Id: I26f4ceece422674e1f7647e5dfadb476cec1ef92
CRs-Fixed: 438057
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
msm: subsystem_restart: Use a CPU intensive workqueue for SSR

Using the default workqueue settings can result in the SSR
work item blocking the watchdog petting function. To avoid
this, schedule the SSR work on a workqueue that has the
WQ_CPU_INTENSIVE flag set. This will prevent any work item
posted to the workqueue from blocking other work items
posted by other drivers in the system, including the watchdog
pet work item.

Change-Id: I159f8c5aba9ff3b40f61bdb101f266436bd2c9bc
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
msm: subsystem_restart: Remove customer specific code

Delete customer specific code in the subsystem restart
driver.

Change-Id: I6654e986dd67f0f578a71c88a142c565985f5183
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
Revert "mako: debug: disable lge_crash_handler"

This reverts commit 04e394381f9ec925d203c541d6dd02c55bae45a3.

Change-Id: I5711385d009b49504e23e592f8e8fdc68261d82c
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
msm: subsystem_restart: Panic on SSR errors

Don't just warn when SSR operations such as powerup
or shutdown fail. Panic the device so that failure-point
analysis is possible.

Change-Id: I09a5ca37d8a7cfaa8fd7ed7025711c6467c20e84
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
diag: Add support for APQ8064AA variant.

Add check for APQ8064AA variant in diag.

Change-Id: I1252618a0fbb409bcf850a26d0d1f9df712d9e73
Signed-off-by: Shashank Mittal <mittals@codeaurora.org>
msm: vidc: Correct the display size of small resolution clips

We change the frame height in the decoder to MDP_MIN_TILE_HEIGHT
for the videos with frame height less than 96. Due to which these
videos were not being displayed properly. This change fixes the
display change.

Change-Id: I7acc74742a8cfbdfc79b02bd20bb9109f4389fa2
Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>
Vidc: Treat Non-IDR frame type error as bit stream error

Hardware error is being generated from driver when video
core returns NON IDR frame type error during thumbnail
decoding. This change handles this error by treating
it as BIT_STREAM_ERR.

Change-Id: I16a19eea679d42a22b336d6ebbd0bd1f57c0a8a4
CRs-fixed: 414858
Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>
usb: mdm_bridge: Fix race between disconnect and I/O completion handler

There is a possibility of race between device disconnect and I/O
completion handler. In this case disconnect frees bridge device
memory in thread context and I/O completion handler uses already
freed bridge device memory in interrupt context. Hence allocate
bridge device memory at the time of driver load and free it
during unload. Also, do not anchor interrupt and read urb and
unlink them synchronously to avoid accessing transfer buffers
associated to these urbs when driver disconnect frees them.

Guard the race condition by:-
1) Adding check for usb device disconnect state in the I/O
completion handler to avoid further processing I/O completion.

2) Unlinking tx urbs synchronously since asynchronous unlinking
results in the same race condition.

CRs-Fixed: 447591
Change-Id: Iae4c2a1920c16fcf3e1728144a7cfe6ca66c7705
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
usb: gadget: Unclaim endpoints upon disconnect

HSIC data driver is not setting endpoint driver data to NULL
upon disconnect. This causes endpoints to remain claimed at
the time of function driver unbind. Endpoints will remain
unusable when driver bind happens later. This can result in
function bind failure due to lack of available(unclaimed)
endpoints if there is a series of driver unbind and bind
happens. Hence after disabling endpoint set driver data of
the endpoint to NULL upon disconnect.

CRs-Fixed: 449814
Change-Id: I8656e15ac26dfc6f4f6679b7ee2bba0bf935f0d6
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
msm: kgsl: Don't change the sglen of the memdesc if allocation fails

If the page_alloc loop fails, we changed the length of the scatterlist
for the memdesc to the last good page so we could have an efficient
loop through kgsl_sharedmem_free.  Unfortunately, we were also using
the sglen to decide between using kmem or vmalloc memory for the sg
list in the first place. There is a chance that one could start out
with a large sg list from vmalloc, but if it failed early, then we
could truncate the size and attempt to kfree it.

Zero the stlist at init time and use a length == 0 as an indicator
that the list might be truncated.
CRs-Fixed: 443441

Change-Id: Ib48a08c69a7bbfc69b92f09e83fc80f9bdedffe0
Signed-off-by: Dhivya Subramanian <dthiru@codeaurora.org>