msm: iommu: Synchronize access to IOMMU cfg port

Add remote spinlock that allows CPU and GPU to
synchronize access to IOMMU hardware.

Add usage of remote spinlock to iommu driver and
add depenency on SFPB hardware mutex being enabled.`

This feature is not using SFPB hardware mutex. However,
SFPB hardware mutex must be enabled since the remote
spinlock implementation is making use of shared memory
that is normally used when SFPB hardware mutex is not enabled.

Change-Id: Iaf278f0f01025b8e754985a87084d875f34b98df
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
msm_fb: hdmi: Do not turn on HDMI if not ready

At bootup, if HPD is not configured, HDMI is not in
the state of getting turned on. This change makes sure
HDMI is not turned on/off unnecessarily which turns on
clocks as well.

CRs-Fixed: 447511
Change-Id: I074d9c463943770775b060c4a93b9120dfe9bcf0
Signed-off-by: Ajay Singh Parmar <aparmar@codeaurora.org>
input: cyttsp-i2c-qc: Add mutex_init call before chip init

Chip initialization routine registers device files to upgrade
firmware. The firmware upgrade routine uses mutex for locking
but as mutex is initialized after chip init we see some random
crashes. Fix this issue by calling mutex_init() before
cyttsp_initialize().

CRs-fixed: 450592
Signed-off-by: Mohan Pallaka <mpallaka@codeaurora.org>
(cherry picked from commit 977afcbbbd92905a6775f540b0848d8f5b6eedb6)

Conflicts:

	drivers/input/touchscreen/cyttsp-i2c-qc.c

Change-Id: I781007eb74f0327d2fd3a51c8de4bbdf4b7fe023
Signed-off-by: Vinod Kumar Pendyala <vpendy@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>
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
msm: 8960ab: Don't add gfx2d footswitches on 8960ab

8960ab doesn't have any gfx2d hardware, so we shouldn't add the
gfx2d footswitches on this device. By not adding them we avoid
probe errors in the kernel logs.

(cherry picked from commit 913c29d9696a86d93705afae14a1169f96d561b0)

Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
(cherry picked from commit a0c627a6066f243045bec212f2d72f657281f21f)

Change-Id: I2d0dd72431eb480cd7ca2707ad6edeef2d3ab2ab
Signed-off-by: Vinod Kumar Pendyala <vpendy@codeaurora.org>
msm: footswitch-8x60: Update bus ports for FS_VED footswitch on MSM8960AB

The video codec's bus ports have changed between 8960 and 8960ab.
Update the footswitch data accordingly, so that the correct ports
are halted and unhalted.

(cherry picked from commit 231cb1b4bec54fbba8210eda28a9622671e0e44f)

CRs-Fixed: 410449
Signed-off-by: Matt Wagantall <mattw@codeaurora.org>
(cherry picked from commit 8af8ba9f40296f09a808cb7c7c8e746cdb6eab56)

Change-Id: Id70090d1202e521ff030653d36019f0613ab447f
Signed-off-by: Vinod Kumar Pendyala <vpendy@codeaurora.org>
msm: kgsl: Fix guilty context logic for GPU hangs

Always mark GPU contexts that have cause a GPU hang as guilty.
If the GPU context recovered successfully, still mark it as guilty.
This will inform applications that something might have
gone wrong and to take actions to ensure everything is correct.

Also, swap out any active context following a hang.  This will
ensure that any new submissions will force the context to be restored
before it is used.

CRs-fixed: 427603
CRs-fixed: 405434
Signed-off-by: Carter Cooper <ccooper@codeaurora.org>

Conflicts:

	drivers/gpu/msm/adreno.c

Change-Id: I980a1a1ca2410a14e61c44b9d43a0734f7340429
Signed-off-by: Vivek Panwar <vpanwa@codeaurora.org>
Signed-off-by: Vinod Kumar Pendyala <vpendy@codeaurora.org>
Merge "input: cyttsp-i2c-qc: Add mutex_init call before chip init"
Merge "usb: mdm_bridge: Fix race between disconnect and I/O completion handler"
Merge "msm: 8960ab: Don't add gfx2d footswitches on 8960ab"
Merge "msm: footswitch-8x60: Update bus ports for FS_VED footswitch on MSM8960AB"
msm: 8960ab: Correct graphics 3d port representation

The graphics 3d ports need to be separately halted/unhalted.
Facilitate this by mapping to separate external IDs.

(cherry picked from commit 620f6f8880ab22d68797cf72dbc4dedd6fe48a48)

Change-Id: I8d1ac9fbda9e9218631a8c86e99e465d60a0cd5e
Signed-off-by: Gagan Mac <gmac@codeaurora.org>
Signed-off-by: Vivek Panwar <vpanwa@codeaurora.org>
Change priority of kernel message to avoid message flooding in logs.

kernel logs are flooded with info message from mdp4_overlay_mdp_perf_upd,
so changed the priority of message to debug.

Change-Id: I66831441b170e6d5970ef582f7c3069b7e124ec6
Signed-off-by: Sangani Suryanarayana Raju <csuryan@codeaurora.org>
msm: 8960ab: Add gfx3d axi clock and port to footswitch data

On 8960ab we need to assert and deassert the resets to the gfx3d
axi clock in addition to the core and interface clocks. Add the
clock to the list so that we reset the gfx core appropriately.

We also need to halt both bus ports, therefore add the second bus
port id.

CRs-Fixed: 428846
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
(cherry picked from commit 9071e51f27a02139a7ea56d839a1d00ca22fa345)

Change-Id: I5e7807f83cd0b299f25ba1200e9902849fedf70b
Signed-off-by: Vinod Kumar Pendyala <vpendy@codeaurora.org>
Merge "msm: 8960ab: Add gfx3d axi clock and port to footswitch data"
Merge "msm: kgsl: Fix guilty context logic for GPU hangs"
Merge "msm: 8960ab: Correct graphics 3d port representation"
msm_fb: display: turn vsync irq off at suspend

Turn off vsycn irq at suspend to prevent vsync irq
firing before vsycn enabled ioctl called at resume.

Change-Id: I2428cdeb5cf7008e50f6d8dabfad52416db2fff7
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
msm_fb: display: empty pending queue during suspend

Overlay_play() adds a pipe into pending queue and pan_display()
will commit those pipes to hardware and empty queue. This patch
will make sure queue is empty at suspend so that no unexpected
pipes will be commited to hardware by pan_display() at resume.
Otherwise, IOMMU page fault may happen.

Change-Id: Iafdf469c6cdbf5d469c9dee114555a8d1adb9c66
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
msm_fb: display: wait for a vsync time before dtv_off

At DTV interface, wait for a vsync time to make sure previous
stage_commit had been kicked in before un-stage pipes and turn
off timing generator. Otherwise iommu page fault may happen after
RGB2 allocated to mixer0 due to RGB2 pipe still hold previous
source address.

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