msm: Ensure krait pll clamp is always set for CPU0

To turn off droop detectors in glitch free mux, the krait PLL clamp
is set permanently for secondary cores in platsmp secondary boot path.
Set the pll clamp for primary core as well.

Change-Id: I4b18e7781515c3c66ef629c3c8ca3457ca9b2874
Signed-off-by: Jay Chokshi <jchokshi@codeaurora.org>
(cherry picked from commit 8fd644a8f5f4fad013c502a4600f63374a464ccb)

Conflicts:
	arch/arm/mach-msm/msm_cpu_pwrctl.c
msm: acpuclock-8064: Add PVS tables for 1.7 GHz parts

Add all seven PVS bins.

(cherry picked from commit a2a4366a5a438a70a11a48555a5f3b8d3d5e6b29)

(cherry picked from commit e34e255b91e92f72520db6c986a02dccb7efec41)

Change-Id: Ib0dd839ee04b75f26942087bf354cd5bff532eb5
Signed-off-by: Patrick Daly <pdaly@codeaurora.org>

Conflicts:
	arch/arm/mach-msm/acpuclock-8064.c
msm: acpuclock-8064: Enable 25mV boost on A-family

Apply the 25mV boost on 8930ab, 8064v2, and 8960ab.

(cherry picked from commit dec4587a32579056ac8ef385cee98da965bfe0b4)

Conflicts:

	arch/arm/mach-msm/acpuclock-8930ab.c

(cherry picked from commit cd013c7a289340eee8feb4929a1eebc528d134c0)

Change-Id: Ib2b05aa90a976f4fca28bab9a0b9f5ee8a8cdb70
Signed-off-by: Patrick Daly <pdaly@codeaurora.org>
Signed-off-by: Dhivya Subramanian <dthiru@codeaurora.org>
msm: acpuclock-8064: Final PVS Table Data for 8064v2

Update data from preliminary values to final data.

(cherry picked from commit 1e1f4bcbc9b0849c5ec1a564de7911200916842b)

(cherry picked from commit 6d1ebfdebbfe7786e386fedb1bbb80f10d0c6e33)

Change-Id: Iac16e077f583d52393d7e150fdb315ab892e7ea1
Signed-off-by: Patrick Daly <pdaly@codeaurora.org>
msm: acpuclock-8064: Add support for 8064v1.1 FASTER PVS bin

Add updated PVS data.

(cherry picked from commit 400be176d10ce039c9397560fc742e25a8bbf415)

(cherry picked from commit fbfbe45d794eeb7af90e222c75c515aad530945c)

Change-Id: I07c1a8692ca63512537268e876cbc8a99c98ca76
Signed-off-by: Patrick Daly <pdaly@codeaurora.org>
msm: acpuclock-8064: Update L2 voltage table

Characterization data shows that L2 runs up to 667MHz with vdd_cx at 1.05v.
Therefore, update the L2 voltage table to match the new data.

In addition, update acpuclock table to use the updated max L2 frequency
with vdd_cx at 1.05v.

(cherry picked from commit 222732641a6b3a7eb81244c994c7d88435bedb45)

Change-Id: I6aff168685e127a0b92353e3be4c5605f1bfb34e
Signed-off-by: Tianyi Gou <tgou@codeaurora.org>
usb: ks_bridge: Limit write size to 16KB

The user space application writes in 1MB chunks while loading MDM
images.  The current code allocate as many bytes as user space
passed to write system call.  These allocations are failing under
memory fragmentation scenario.  Hence limit write size to 16KB.

CRs-Fixed: 434638
Change-Id: Ibfad0f13c1fb2c30342d2435114001c580143292
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
(cherry picked from commit 7fcc7799af7ace4c4eda229b0eac6448f98d6637)

Conflicts:

	drivers/usb/misc/ks_bridge.c

Signed-off-by: Ram Kumar Chakravarthy Chebathini <rcheba@codeaurora.org>
usb: ks_bridge: Avoid allocating large buffers in atomic context

The current code allocates a new Rx buffer in Rx completion handler.
Rx buffers are freed after user space consumes them.  This results in
allocating larger buffers in atomic context which may fail some times.
Don't queue the Rx buffer immediately. Defer it till user space consumes
it and reuse the same buffer.  The test results indicate no throughput
degradation.  The Rx buffers will be freed when interface is suspended
or disconnected.

CRs-Fixed: 430595
Change-Id: I8e69e27df2e11b38497e0384a8edd87ecedcb24b
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
(cherry picked from commit 5c915c1949b79bc59d2b222bfcce02cd429619b2)

Conflicts:

	drivers/usb/misc/ks_bridge.c

Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
power: pm8921-charger: make usb_max_current configurable

Allow the module parameter to be configurable through the board
files. This gives another option to set the usb_max_current
setting if userspace is not able to set this during
bootup.

Conflicts:

	drivers/power/pm8921-charger.c

(cherry picked from commit 8e67275cb440be560830089fabc0201eb5830c9e)

Change-Id: I96886f8d0f3f03905163d93c4f8f3e637d98127f
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
Signed-off-by: Liam Fernandez <liam@codeaurora.org>

Conflicts:
	drivers/power/pm8921-charger.c
board: 8064: improve touch accuracy

Touch accuracy is offset on MTP devices.  When the user
touches, the point is recorded as down and to the left
of where it should be.  This can be corrected by
modifying boardfile offsets.

(cherry picked from commit 700605eab4c321b2ecd38be6e43305c100392694)

Change-Id: I0c44a60f930ec1db31b8d5b39970b212867dded0
CRs-fixed: 423833
Signed-off-by: Amy Maloche <amaloche@codeaurora.org>
msm: wfd: Clear out stale flags for output buffers

The V4L2 framework doesn't appear to be clearing out vendor specific
flags between each QBUF call.  Hence clear out all flags that we set
explicitly in the driver.

(cherry picked from commit 28796cbd48750c86adec5788f160d1bc1a5d0093)

Change-Id: I894fe859dcc49d79733ea1cad976540d0cdd1b48
Signed-off-by: Deva Ramasubramanian <dramasub@codeaurora.org>
ASoC: wcd9310: Reset OTHR_RESET_CTR before power down

There is a missing step to clear OTHR_RESET_CTR before power down.
It could cause a glitch and power hit without it. It has to be reset.

(cherry picked from commit a8bc5343ddbca60d3419f84d0080bc6bc8ddbc2d)

Change-Id: I9bf890e5c5f058b921048c325c01dc6b5d306d3a
CRs-fixed: 420142
Signed-off-by: Fred Oh <fred@codeaurora.org>
msm_fb: display: Program source address registers correctly

Scale filter FIR uses the adjacent pixels as part of the
processing. Source address registers should be program such that
they point to the first valid pixel so that non-ROI pixels are
ignored. This is done by making source x,y offsets to zero and
adding the computed offset to source address.

(cherry picked from commit 7bcecf0a6a6864accfa1318e33e85ad2cc23f535)

Change-Id: I1ea399eaa088b880e2a847ea438c013225b3b550
CRs-Fixed: 380020
Signed-off-by: Mayank Chopra <makchopra@codeaurora.org>
msm: board-8930: add gpio-controlled backlight function

The function pointer is passed to driver to turn on/off backlight to
avoid garbage display.

(cherry picked from commit a07d78743024144158a7b2cc0c194ae75e9b6bea)

Change-Id: I2dbb7c1ce37ff94a8dcc80999dff0d6ae7a45c9a
CRs-fixed: 408728
Signed-off-by: Huaibin Yang <huaibiny@codeaurora.org>
msm_fb: display: add setting gpio-controlled backlight logic

For the panels which backlight is controlled by gpio, add this logic
in driver to turn on/off backlight, instead of calling board panel
on/off functions, to avoid garbage display due to early backlight
turn-on.

(cherry picked from commit 3eebb2e33570e32d11a757e493e12a8e79e08d6f)

Change-Id: If63b0f8190e9d681feb730c8eeeac8c594304601
CRs-fixed: 408728
Signed-off-by: Huaibin Yang <huaibiny@codeaurora.org>
msm: vidc: Adds AU delimiter support for AVC.

Add new V4L2 control to set AU delimiter for AVC.

(cherry picked from commit efe5bf34b4a98849ab2dcd34945815e218308eaa)

Change-Id: I007d196cedf236b41b993bb26b8f8515449f1d7a
CRs-Fixed: 389030
Signed-off-by: Srinu Gorle <sgorle@codeaurora.org>
msm: vidc: Fix various NULL pointer accesses, memory leaks

This commit fixes various NULL pointer and memory leak bugs.

(cherry picked from commit 636a61f53dbe3cbd327c101d5373f2d876475834)

Change-Id: I8dc1ffc374b7ccdf5b5c1c0b51f1d8347d626c09
Signed-off-by: Deva Ramasubramanian <dramasub@codeaurora.org>
Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>
msm_fb: display: add checking y direction for alpha drop

Alpha is dropped when scaling with non repeat pixel method.
Both x and y direction of scaling need to be cehcked for
alpha dropped.

(cherry picked from commit f0d08071a4e97c9018b8e8def498e07720201da8)

Change-Id: I2a36db6ca78ce67c01dbc076d776e8d078b1d384
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
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)

Change-Id: If746c8c6ded278793a3d7c271a27acd2639b19ec
CRs-Fixed: 392141
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
msm: clock-8960: Merge similar gfx3d_clk freq tables

Remove support for 325 MHz in 8960ab and 8064, and replace with
320 MHz. This allows the targets to share the same freq table with
8930.

Change-Id: I987a636927fa805e350f22607adda0db367a6fb2
Signed-off-by: Patrick Daly <pdaly@codeaurora.org>

Conflicts:

	arch/arm/mach-msm/clock-8960.c

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