arm: msm: qdsp6v2: update to finite loop

The reason why the original code requires infinite loop
cannot be accounted for. However, it seems reasonable to
wait for 10 minutes.

Change-Id: I057f7ac8a83585abbc4ccd63a721df82f71ea045
Signed-off-by: Patrick Lai <plai@codeaurora.org>
msm_fb: display: initialize dmap_comp before wait4dmap

blt_wait flag will be set when both two writeback buffers
are used. In this case, kickoff can not be proceeded until
next dmap_done to release writeback buffer. This patch
initialize dmap_comp before wait4dmap to make sure
wait_for_completion is enforced.

CRs-fixed: 448168
Change-Id: I64f2ad599b18f9d8b346c41a55829c564fcced0b
Signed-off-by: Kuogee Hsieh <khsieh@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>
qseecom: Check if app exists before loading the app

There is a chance of send a request to QSEE to load an app that
is already previously loaded. Requesting QSEE to load an app
that is already loaded will result in a failure.

Issuing a request to QSEE to check if app already exists before
issuing a request to load it, all within the same app_access_lock
mutex, fixes this issue.

CRs-Fixed: 420473
Change-Id: I5dfb02c7b0f0144d142fc70084ec1e096ada0439
Signed-off-by: Mona Hossain <mhossain@codeaurora.org>

Conflicts:
	drivers/misc/qseecom.c
android/lowmemorykiller: Wait for memory to be freed

The memory reclaim code needs to give time to the system to
return the memory from a killed process otherwise the memory
reclaim code could run continuously, in multiple threads,
which could starve both the watchdog thread and the thread
which is responsible for returning the memory from the
killed process.

Change-Id: Ib390dbb021cb6d41e74ac64eca6fef46367daf1e
CRs-fixed: 447740
Signed-off-by: Liam Mark <lmark@codeaurora.org>

Conflicts:
	drivers/staging/android/lowmemorykiller.c
msm: camera: Update bus bandwidth vectors for camera for 8960/8064 targets.

The current bus bandwidth requested for 8960 and 8064 are not sufficient
to cover all the usecases. Increase the bandwidth requested to avoid
bus overflow issues.

Change-Id: Icadec39c32854f086888546314134c8235af0c94
Signed-off-by: Kiran Kumar H N <hurlisal@codeaurora.org>
media: dvb: mpq: Fix initialization of secure-demux resources

When filter is started secure-demux buffers handles
should be initialized with invalid values so that they
are not released if they were not set.

Change-Id: I79c3896130059a5118f4966cc59c80d2f3f83814
Signed-off-by: Hamad Kadmany <hkadmany@codeaurora.org>
cma: fix watermark checking

* Add ALLOC_CMA alloc flag and pass it to [__]zone_watermark_ok()
  (from Minchan Kim).

* During watermark check decrease available free pages number by
  free CMA pages number if necessary (unmovable allocations cannot
  use pages from CMA areas).

CRs-Fixed: 446321
Change-Id: Ibd069b028eb80b70701c1b81cb28a503d8265be0
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Michal Nazarewicz <mina86@mina86.com>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Hugh Dickins <hughd@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
[lauraa@codeaurora.org: context fixups]
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
Bluetooth: Avoid re-authentication for secure high connections

The re-authentication code changes are added to mandate 16 digit
PIN Key for SECURE_HIGH connections. But only SAP profile needs
16 digit key, not all the profiles that register with SECURITY
HIGH. Avoid the code to mandate 16 digit key.

Change-Id: Iffc02841e52b8c0b2f6e2495b27df26869e72999
Signed-off-by: Srinivas Krovvidi <skrovvid@codeaurora.org>
Signed-off-by: Ram Mohan Korukonda <rkorukon@codeaurora.org>
Signed-off-by: Mallikarjuna GB <gbmalli@codeaurora.org>

Conflicts:
	net/bluetooth/hci_event.c
Bluetooth: GAP: Read the clock offset on ACL connection complete

Keep the Clock offset valid for one Hour and read it again after
connection complete so that we have most recent value. This helps
for faster ACL connections.

CRs-fixed: 430132
Change-Id: I1526878a7365f9cc0c654e0af6c4dd214fac4cd8
Signed-off-by: Mallikarjuna GB <gbmalli@codeaurora.org>
Bluetooth: Validate the hci connection before data transfer

Avoid the possible crash due to Bluetooth connection loss while data
trasfer is in progress. Bluetooth connection loss might happen due to
turn off of Bluetooth or reset of device when there is an active data
transfer over Bluetooth.

Change-Id: Ib15a9ac2df3a250d279774d6e45f1e37c9ea1cc0
CRs-fixed: 375238
Signed-off-by: Bhakthavatsala Raghavendra <braghave@codeaurora.org>
Signed-off-by: Mallikarjuna GB <gbmalli@codeaurora.org>
EHCI: HSIC: Handle asynchronous interrupt properly

Runtime PM resume and asynchronous interrupt can run in parallel. When
this happens, there is a possibility of PM usage counter mismatch.
Fix this by checking the return value of pm_runtime_get() and by
disabling the USB interrupt while resuming the HSIC.

Consider asynchronous interrupt case when resuming HSIC during system
resume.

(cherry picked from commit 822fbe6e90d32ec7c7b5d7cee69a8cd36869005f)

Conflicts:

	drivers/usb/host/ehci-msm-hsic.c

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

Conflicts:
	drivers/usb/host/ehci-msm-hsic.c
EHCI: HSIC: Disable asynchronous interrupt when wakeup gpio is present

Controller can generate interrupt asynchronously in low power mode (LPM).
Enable this interrupt in USBCMD register only when wakeup gpio IRQ is
not available.

(cherry picked from commit 0c9f29cff6b8686e9a89a500b545a9f331ab4618)

CRs-Fixed: 444883
Change-Id: I05258feb9476d1373d30645f6c750923589aa1cb
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
EHCI: HSIC: Implement new reset sequence to workaround PHY lockup issue

commit 8e6edcb (usb: ehci: Avoid phy lockup due to SOFs during port
reset) implements a workaround for PHY lockup issue during port reset.
The workaround relies on a hardware debug feature which allows driving
strobe and data lines to reset using ULPI interface.  This is not
working some times for unknown reason.

This patch implements a new reset sequence to workaround the PHY lockup
issue.  The controller drive reset signaling for ~50 msec when reset bit
is set in PORTSC register.  The controller automatically clears this bit
after finishing the reset signaling.  The software can also finish the
reset signaling any time by clearing the reset bit.

According to USB2 spec, Host controller should drive reset signaling for
50 msec for root hub ports.  But HSIC spec allows shorter reset signaling
time (20 msec).  Clear the reset bit in PORTSC register after 20 msec and
start controller immediately to send SOF.  Use controller internal timers
to achieve this.  If reset bit is not cleared in time, perform the sequence
in a loop with interrupts disabled.

CRs-Fixed: 445659
Change-Id: I6b251ced8d47b9ece4a06e58baf15c69a8bb340f
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Revert "usb: msm_otg: add charger notify API"

This reverts commit 99cef213bd94a4398433955d2bc62117c7ee7fe8.
Current code informs charger driver to draw 500ma on detecting
SDP Charger and doesn't revert its vote. With this change, on
not receiving any RESET from Host, device would keep charging
500ma until USB cable is disconnected.

CRs-Fixed: 446955
Change-Id: I1f3ed0005e1fff3595c1b3336e2be7432aeb7348
Signed-off-by: Mayank Rana <mrana@codeaurora.org>

Conflicts:
	drivers/usb/otg/msm_otg.c
media: dvb: Fix handling of multiple PIDs per recording filter

When starting feed fails while the feed is part of a filter that
holds multiple PIDs for recording, the filter's state does not
change and therefore the feeds which were started were not stopped
and de-allocated properly. In addition the dvr-feed count
is per feed basis and should be decremented for each feed that
is stopped part of the recording filter.

Change-Id: I739e6d40596df3c80cd0843f89eb4a8d3d51ddf4
Signed-off-by: Hamad Kadmany <hkadmany@codeaurora.org>
hwmon: epm: Update type for trepn usage

Update type from u8 to uint8_t for trepn daemon usage
from userspace. Also expose the psoc structures for
trepn's use.

Change-Id: I840a480432493303b105396d522ebdcb1cf9079a
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
msm: camera: Coexist composite and non composite RDI

Current code does not support for non composite RDI logic,
Hence adding logic for coexistence of composite and
non composite RDI

Change-Id: I5bb2d59a02955a6723353dcb0663ae4538bdb2c0
Signed-off-by: Lakshmi Narayana Kalavala <lkalaval@codeaurora.org>

Conflicts:
	drivers/media/video/msm/vfe/msm_vfe32.c
	drivers/media/video/msm/vfe/msm_vfe32.h
	include/media/msm_isp.h
msm: mdm: add support for multiple external modems

The mdm driver previously assumed that it would only need to support
one external modem at a time. This is no longer true. The changes now
support a arbitrary number of modems. Each modem must have its own
platform data.

Change-Id: I43918f92935b4b447a46d02721239fed0b5e877e
Signed-off-by: Ameya Thakur <ameyat@codeaurora.org>

Conflicts:
	arch/arm/mach-msm/include/mach/mdm2.h
	arch/arm/mach-msm/mdm2.c
	arch/arm/mach-msm/mdm_common.c
msm: 8064: add platform subtype definition for DSDA2 target

The dsda2 target is differentiated by a new platform subtype
passed to socinfo.

Change-Id: Iee6ab29200798c87ad3dd260a7afd7196d0b1b20
Signed-off-by: Joel King <joelking@codeaurora.org>