media: dvb: Fix invocation of secure-demux when playing from TSIF

secure-demux processing function expects to receive a fixed
start address aligned to 4KB along with a read pointer, the
code provided the current address along with a read pointer
set to 0 as fixed value. This may cause the start address not
to be aligned to 4KB.

Change-Id: Ibd4a4c70c3b874df328de9d3fea0437cbdf53028
Signed-off-by: Hamad Kadmany <hkadmany@codeaurora.org>
media: dvb: mpq: Fix writing data to sdmx

sdmx process should be invoked with the requested
number of bytes rather than with the number of bytes
available in the buffer.

Change-Id: I4541cc4ff15d5c23ca9aad6a85a4d815ece7b21c
Signed-off-by: Hamad Kadmany <hkadmany@codeaurora.org>
qseecom: Enable clocks for the Crypto Engine used by Trustzone.

All interactions with secure applications on TZ by non-secure
apps on HLOS need the crypto clocks on.
Without this, simple operations as loading secure apps in
Trust zone fail.

Change-Id: I37097cb401508f7582de014e502f3709170ca6b2
Signed-off-by: Ramesh Masavarapu <rameshm@codeaurora.org>
qseecom: Add kernel space client support

Add support for kernel space client:
    - add support for starting secure app by kernel client
    - add support for shutting down secure app by kernel client
    - add support for sending command to secure app loaded by
      kernel space client(s)

The above is needed for allowing kernel modules to communicate
with app running in secure domain.

Change-Id: I3ae3a7648714eb7d7f4801b2f8e7cd94b5c64bdf
Signed-off-by: Mona Hossain <mhossain@codeaurora.org>
Signed-off-by: Hariprasad Dhalinarasimha <hnamgund@codeaurora.org>
Signed-off-by: Mona Hossain <mhossain@codeaurora.org>
qseecom: Vote for CE clk before  loading image

Add support for setting the Crypto HW to operate in
high bandwidth mode before issuing a request to load
image.

This is needed for better performance when using crypto
HW to authenticate the image before loading it.

Change-Id: Ib976d8227e605b9aad8191c6fe8f1dcc5d28e90e
Signed-off-by: Mona Hossain <mhossain@codeaurora.org>
qseecom: Add API to set bandwidth for CE HW

Add API to allow kernel space clients to bump up
CE clks for improved performance

Change-Id: Iecd13cf4efe9b2b1415be56d3ec9e4dc040918f8
Signed-off-by: Mona Hossain <mhossain@codeaurora.org>
qseecom: Remove mutex lock in load_fw API

Loading of app is stuck waiting for lock on app_access_lock
being released.  This mutex is already locked prior to invoking
load_fw.
Removing the mutex lock (already called before invoking load_fw),
in load_fw, fixes the issue with the loading getting stuck.

Change-Id: Ia095bf268c6c1c08dfe1544280567ba4bd4661d6
Signed-off-by: Mona Hossain <mhossain@codeaurora.org>
qseecom: Fix the kernel_qseecom_client send_cmd fucntionality

Give the correct address of shared virtual buffer
address to be used during start_app.

Change-Id: Iebe10304c9c295c34eb3e1aeba9255e7c91609cc
CRs-fixed: 434753
Signed-off-by: Hariprasad Dhalinarasimha <hnamgund@codeaurora.org>
Signed-off-by: Mona Hossain <mhossain@codeaurora.org>
qseecom:  Add SFAB clock voting in set_bandwidth request

Vote for SFAB clock when requesting to set to crypto high
performance mode.
The SFAB clock needs to be bumped up to its optimal
value when operating in high bandwidth mode (for max
crypto performance)

Change-Id: Ifea68a15d48f737a855acd05e59ac20d4438a9cd
Signed-off-by: Mona Hossain <mhossain@codeaurora.org>
msm_fb: Check for panel power on after Unblank.

In Overlay_play , panel power on check was at wrong place
it has to be after Unblank.

Change-Id: If910f83ef57499b5f771bc7d3d1bdfa814d5c019
Signed-off-by: Kalyan Thota <kalyant@codeaurora.org>
USB: ks_bridge: Fix PM usage counter mismatch

The runtime PM is disabled for a device during suspend.  It is
enabled again just before resuming  the device.  The resume method
of USB interface drivers are called while resuming a USB device.  As
USB device is the parent of an interface, the interface resume is
blocked till USB device resume is completed.  If interface driver
call any runtime PM API before interface runtime PM is enabled, it
fails with -EACCESS error.

The USB runtime wrapper usb_autopm_get_interface() decrements PM usage
counter when get_sync() is failed.  The current code is decrementing
the PM usage counter even when an error code is returned from
usb_autopm_get_interface().  Due to this double decrementing, the KS
bridge interface PM usage counter is becoming negative after several
suspend and resume cycles.  Once the PM usage counter becomes negative,
the interface runtime PM state will never become active.  That means,
USB device suspend can happen even when a Tx URB is pending from ks
bridge driver.

The fix is trivial.  Don't decrement PM usage counter when error code
is returned from usb_autopm_get_interface().

(cherry picked from commit 361d9af92470ebeeb0a42f73e6eb457ab279b282)

Conflicts:

	drivers/usb/misc/ks_bridge.c

CRs-Fixed: 437214
Change-Id: I96c9e1797c137cd158c424ebf6342f607cee6d78
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
revert "msm: 8064: Add regulator supply for DDR3 memory"

This reverts commit 994ff121f0c2e3ff00fa38ae2f8dfde4bda1b332.
PM8921 MPP7 no longer must be kept high at all times for targets
using PCDDR3 memory because newer hardware ensures that memory is
always powered when necessary.

Change-Id: I4919abceb875b9ea22e6b2c0bd617280deb7e65b
Signed-off-by: David Collins <collinsd@codeaurora.org>
Signed-off-by: Ajay Dudani <adudani@codeaurora.org>
USB: ci13xxx_udc: Avoid flushing endpoint twice during disable

The ep_disable() function nukes all pending requests before
disabling the endpoint in hardware.  The endpoint is flushed
during nuking.  Don't flush the endpoint again.

(cherry picked from commit a89f80f9942e5dc2796ad742f9d01f6aa68e1267)

CRs-Fixed: 445916
Change-Id: I84020dceef751dbdde1233068a414a72d1c1b609
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
USB: ci13xxx_udc: Don't flush inactive endpoints

The endpoint must be flushed prior to retiring pending requests.
This is done during disabling an endpoint.  Don't flush an endpoint
if there are no pending requests.  According databook flushing
endpoint may take large amount of time.  This optimization will
make USB disconnect/reset processing a little bit faster.

(cherry picked from commit 58db2c1f94451d7a352d2ad1a1b1e9732f4f0a11)

CRs-Fixed: 445916
Change-Id: I2a8b185d7f6f295485bc1d1b1794f42471149491
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
USB: ci13xxx_udc: Skip flushing endpoints upon failure

Flushing an endpoint involve polling ENDPTFLUSH and ENDPTSTAT
registers.  The worst case timeout is 100 msec for each endpoint.
The reason for failure is unknown.  When flushing an endpoint
fails, successive flushing of remaining endpoints are also failing.
Hence skip flushing remaining endpoints.  Reset this condition
upon USB bus reset.

(cherry picked from commit 2a630fb9b83b31e607ef61f3b61959cc1b095349)

CRs-Fixed: 445916
Change-Id: I54cf860c0d290ffa3fc0d7e41af32b4be48937ef
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
msm: display: Fix blend configuration for video layer with MDP composition

With video layer in MDP composition, there is no need to apply destination
over blend rule, as z-order of layers take care of proper staging of layers
by default. Apply constant blend to the video layer when in MDP composition

CRs-fixed: 437965
Change-Id: I7476659f12cdf06018bf6ace829a836c86ae97e8
Signed-off-by: Mayank Chopra <makchopra@codeaurora.org>
media: dvb: mpq: Fix mutex release

Mutex should be released only if the function locked it
at the beginning.

Change-Id: If83d615a1777a1ccb2a13d070e1b67d002662cb8
Signed-off-by: Hamad Kadmany <hkadmany@codeaurora.org>
msm: vidc: Fix various NULL pointer accesses, memory leaks.

This commit fixes various NULL pointer and memory leak bugs.

Change-Id: I3b3ac40b5e440b9665858913921a06de14741b6f
Signed-off-by: Rajeshwar Kurapaty <rkurapat@codeaurora.org>
msm: kgsl: Add minimum amount of wait in adreno_waittimestamp

Add minimum amount of wait period in adreno_waittimestamp
to avoid instances of malformed wait period (such as msecs=0)
arguments from userspace and in turn avoid false hang detections.

CRs-fixed: 437738
Change-Id: I5cd40dc7589747e7fffeb6d5cc2001b73d6d845e
Signed-off-by: Harsh Vardhan Dwivedi <hdwivedi@codeaurora.org>
msm: power: update copyright markings

In cherry-picking patches from tip, the LTC charger driver and pm8921
BMS driver header were updated without updating the copyright
marking from "Code Aurora Forum" to "The Linux Foundation".

Fix this by updating the copyrights now

Change-Id: I3a24feaa6af5acbdca4fc6499398205a1c93dcfe
Signed-off-by: Xiaozhe Shi <xiaozhes@codeaurora.org>