gpu: ion: enable the kmalloc heap

There are some Ion clients who would like to use the kmalloc
heap. Enable it.

Change-Id: Ie818be9e1211d52d489ad2cb63d94e2fddfc0f01
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
msm: rotator: sync point support

Add MSM_ROTATOR_IOCTL_BUFFER_SYNC ioctl interface.
Rotator will create a timeline for each session at START, wait for
input fence and create released fence in this ioctl call,
signal the timeline after rotation is done.

Change-Id: I3738f8287d804ccd94e0a16ac0afb8b41b299c75
Signed-off-by: Ken Zhang <kenz@codeaurora.org>

Conflicts:
	drivers/char/msm_rotator.c
msm: rotator: non-blocking rotate

Send request to a work queue and return right away.
Work queue will go through the commit queue to do the
rotation. wait_for_finish can be set to true to make
rotation go back to blocking.

Change-Id: Ifc2e36bd24d9681d42105f4ccbb62a8777af2a6c
Signed-off-by: Ken Zhang <kenz@codeaurora.org>

Conflicts:
	drivers/char/msm_rotator.c
USB: ci13xxx_udc: Don't free dTD immediately after active bit is cleared

USB controller may access the dTD one more time after clearing the active
bit in token field.  There is a possibility of software freeing it in this
window.  When this happens, USB controller may access incorrect memory and
leads to system level issues.

dTDs are freed when requests are freed by function drivers during
disconnect or unbind.  The above race condition will come into effect only
for zero length packets.  dTDs are dynamically created for sending zero
length packets on IN endpoints.  These dTDs are immediately freed after
active bit is cleared.  Defer this to next dTD completion.  It is safe to
assume that hardware will no longer access the previous dTD when the next
dTD is completed.

Don't allocate/free setup status phase and GET_STATUS data phase requests
dynamically.  Use  one request for both cases and allocate it during bind.

CRs-Fixed: 474557
Change-Id: I5d41c310e1bb35d93b5af7d90a24ce5aab24f5f9
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>

Conflicts:
	drivers/usb/gadget/ci13xxx_udc.h
mms_fb: display: init pipe default configure as solidfill

Initialize mdp pipes default config as solid fill so that
there will have no memory fetch if pipe are staged into
mixer while flush bits are left behind and set at next vsync.
This is will prevent mdp iommu page fault from happening
at address 0x00000000 during resume.

Change-Id: Ide944ec1d069629f1ae2ecd0daf49c69ce2af2eb
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
ASoC: wcd9304: Enhance OCP reporting logic

CODEC has over current protection(OCP) finite state
machine for both left and right headphone while CODEC
driver tries to delay reporting of OCP event after
CODEC reporting OCP two times. Current CODEC driver
implementation results in unlocking one of headphone
power amplifier when OCP reported on both headphone.
Change the behavior to report OCP event for a give
headphone immediately if OCP already occurs on opposite
headphone.

Change-Id: I49d062f7c7f1a99390e82660c8f3e538a0a3cd56
CRs-fixed: 471963
Signed-off-by: Patrick Lai <plai@codeaurora.org>
thermal: pm8xxx-tm: Configure temperature alarm for always-on operation

Change the register initialization for the PMIC temperature alarm
module so that it is always on.  This ensures that die
temperature monitoring is active even if CXO is disabled (i.e.
when sleep_b is low).  This is necessary since CXO can be
disabled while the system is still heavily loaded.  Also, using
the alway-on instead of PWM-enabled configuration ensures that
the die temperature can be measured by the PMIC ADC without
reconfiguring the temperature alarm module first.

Change-Id: I4a76c959c81f222fbeca08b6c98b1e4b23653b4e
Signed-off-by: David Collins <collinsd@codeaurora.org>

Conflicts:
	drivers/thermal/pm8xxx-tm.c
spi_qsd: Correction in DMA mode check.

Due to bug in the if() condition msm_use_dm function
is always returning '0' when cs_change is true. Due to
this issue the DMA mode is not bieng used when it has to be.

This patch fixes this issue.

CRs-Fixed: 475841
Change-Id: Ib4d7c4f816c2df71683d0901eb0fab78f441a208
Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
msm: ipc: Add check to avoid integer & buffer overflow

In IPC Router service lookup operation, add check to avoid an integer
overflow and hence a buffer overflow.

CRs-Fixed: 457402
Change-Id: Ibe949fe20aad88b15679bdc96ebc505e4395ac3b
Signed-off-by: Karthikeyan Ramasubramanian <kramasub@codeaurora.org>
msm: msm_bus: Change MDP port interleaved setting

When display driver requests bandwidth on MDP port 0, it was
automatically divided between port 0 and port 1 by the bus driver
as a part of interleaving. Since MDP port 1 was never used,
this did not have any impact.

Now, the display driver needs to use MDP port 1 such that MDP
ports should be able to use the bandwidth non-uniformally.
To enable these ports to use unequal amount of bandwidth,
it is required that bus driver does not divide bandwidth
between port 0 and port 1.
The display team is now responsible for requesting bandwidth
explicitly on both ports.

CRs-Fixed: 474499
Change-Id: I826a4c20a113a32f6d6bcf13f1c6474040f35f46
Signed-off-by: Gagan Mac <gmac@codeaurora.org>
(cherry-pick from Change-Id: I826a4c20a113a32f6d6bcf13f1c6474040f35f46)

Conflicts:
	arch/arm/mach-msm/msm_bus/msm_bus_board_8064.c
	arch/arm/mach-msm/msm_bus/msm_bus_board_8930.c
	arch/arm/mach-msm/msm_bus/msm_bus_board_8960.c
msm_fb: hdmi: change sysfs node permissions

Change the write permissions of sysfs nodes from UGO to USR + GRP

Change-Id: Ided5351669eb0f3cdf9ae1a0c1607ef6e76f6852
Signed-off-by: Ajay Singh Parmar <aparmar@codeaurora.org>

Conflicts:
	drivers/video/msm/external_common.c
arm: Kconfig: Disable CONFIG_OABI_COMPAT feature on SMP targets

When this option is enabled to support Old ABI, it introduces
a race condition in swap-out code on SMP, such that
instruction is available to the instruction stream (SWI
instruction) but not the data stream.

CPU0		CPU1
clears pte
		executes instruction from page,
		already has I-TLB but no D-TLB entry,
		takes SWI exception
		tries to load instruction, data abort
tlb flush

Therefore, disable this feature on SMP targets.

Change-Id: I4cc4e6924cfcffad391fe2e68d5aa62eee613b0e
Signed-off-by: Jay Chokshi <jchokshi@codeaurora.org>
Revert "msm_fb: display: free pipe if blt is detected for the pipe"

This reverts commit e29d1b2e70c3d6d8417b2791f62043bcf084b9bb because
of iommu page faults on some targets.

Change-Id: Ia9f9c37720fb23da347eea480ffa55e536231c65
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>

Conflicts:
	drivers/video/msm/mdp4_overlay.c
Revert "msm_fb: display: don't enable blt mode"

This reverts commit aa980658ac73a347fc94108d4fc886860d0c1714 because
of iommu page faults on some targets.

Change-Id: I2b0f801ab00f473dcb3f3918b30ebf594a5a2058
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>

Conflicts:
	drivers/video/msm/mdp4_overlay.c
msm: msm_fb: remove mmio access through mmap

Disable access to mm io and add
appropriate range checks to ensure valid accesses
through framebuffer mmap. This prevents illegal
access into memory.

CRs-Fixed: 474706
Change-Id: If25166f2732433ef967e99c716440030b567aae9
Signed-off-by: Manoj Rao <manojraj@codeaurora.org>

Conflicts:
	drivers/video/msm/msm_fb.c
msm: vidc: Remove kernel mapping on input/output buffers

This change will remove the kernel mapping of input and
output buffers for both video encoder and decoder to
avoid the errors resulting from ion_map_kernel() for
high resolution video concurrency use cases due to the
limited vmalloc space. It also removed the metadata
processing in kerner video driver as kernel virtual
address is removed. The metadata processing can be
done in user space video component.

Change-Id: I3f2c9b7c13b3e09097ce07ca7b59154b97401052
CRs-fixed: 471135
Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>

Conflicts:
	drivers/video/msm/vidc/1080p/ddl/vcd_ddl_helper.c
	drivers/video/msm/vidc/1080p/ddl/vcd_ddl_metadata.c
	drivers/video/msm/vidc/common/dec/vdec.c
	drivers/video/msm/vidc/common/init/vidc_init.c
	include/linux/msm_vidc_dec.h
msm: Add support for ION Flushing without virtual address

Video has very large buffers to be flushed. Due to lack of
vmalloc space, ion_map_kernel cannot be called on each of
the video buffers. With this change the ion handle can be
flushed without the need of the kernel mapping.

Change-Id: If026f21e44a2cce6c2b8c232fc80a69d0dabcd14
Signed-off-by: Neeti Desai <neetid@codeaurora.org>

Conflicts:

	drivers/gpu/ion/ion_cp_heap.c
	drivers/gpu/ion/msm/msm_ion.c

Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>
msm_fb: display: disable mdp blt mode

The switch of blt mode may cause mdp hang on some targets. To avoid
blt switch, we won't allocate the pipe that requires blt
mode. Basically this implies two things: downscaling is done by
rotator and gpu composition is used in case of blt mode is needed.

This implementation is to calculate mdp clk requirement based on the
req data passed from userspace before setting the actural pipe
data. If overlay_set asks for mdp clk that is greater than
mdp_max_clk, meaning blt is needed, overlay_set returns before pipe
allocation or pipe data change, so this way can avoid mdp to work on
wrong pipe data.

Change-Id: I22e73d08bed920b366c18ee21b132339cf2a0347
Signed-off-by: Huaibin Yang <huaibiny@codeaurora.org>

Conflicts:
	drivers/video/msm/mdp4_overlay.c
diag: Check for build time masks being greater than ssid range

Added a check for build time masks to be lesser than the ssid
range. We would ignore and print a warning otherwise.

CRs-Fixed: 477199

Change-Id: Idf75658cc51d66834fa3c0d9f7a8a954be789efa
Signed-off-by: Ravi Aravamudhan <aravamud@codeaurora.org>

Conflicts:
	drivers/char/diag/diagfwd.c
msm_fb: Fail fb2 open if called during suspend

At present, if msm_fb_open() for fb2 is called during suspend,
we increment the ref_count for fb2 and return success without
turning on the writeback pipeline. This causes the WFD client
think that fb2 is successfully opened whereas fb2_open should
not successful during suspend. Hence, return error if msm_fb_open()
is called for fb2 during suspend.

CRs-fixed: 475310
Change-Id: I73167a120a64ac18c5789ccc9cf7faad14b50b94
Signed-off-by: Padmanabhan Komanduru <pkomandu@codeaurora.org>

Conflicts:
	drivers/video/msm/msm_fb.c