msm: smd: fix legacy DS port registration

Correctly register the DS port for legacy platforms.

For 8660 targets, only the standalone device (platform
subtype 0) uses the legacy DS port.

CRs-Fixed: 327119
Signed-off-by: Angshuman Sarkar <angshuman@codeaurora.org>
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
(cherry picked from commit 4b931ed127737e1cd97c29f576d0606d7f0fb644)

Change-Id: I0e81e9e4ef6949e0a8d3c3960c9fd5f5d2cb0652
Signed-off-by: Ramakrishna Prasad N <crpn@codeaurora.org>
usb: gadget: u_bam: Correct nested locking flags

Previously the driver used the same flags variable to lock two different
spinlocks. This causes interrupts to stay disabled when the function
exits. Correct this by only doing irqsave and irqrestore on the
outermost spinlock.

(Cherrypick from commit: 6f8c5fc32c943dbec71b85f6bad7490ec508ef39)

Change-Id: Ief4c15059a209ab1c3381e39d8e00a6a0c93ffcc
Signed-off-by: Jeff Ohlstein <johlstei@codeaurora.org>
msm_fb: display: Fix incorrect goto call

During the probe for writeback panel, for MDP hardware versions
earlier than 4.3 an incorrect goto call un registers the bus scale handle
that primary panel uses. This is causing the boot failures because the
primary panel turn on sequence triggers the bus scale update request on
already unregistered handle.

(cherry picked from commit 284fc85908c31b7424cc600083c2499d4188bdfd)

Change-Id: Id87d622c83fb5fe9d8776d7c0abaeaedd983013d
Signed-off-by: Rajesh Sastrula <vrajesh@codeaurora.org>
msm: defconfig: Enable writeback panel for wfd

For wifi display, the writeback panel is needed to capture the output of
mdp.  Setting this config enables the writeback panel.

(cherry picked from commit 8f920ae2dc56f4f58bb2f2da64102b53d157cd31)

Change-Id: I24ec5cd6b2e4d1065d096a1fc9e70d66a87eeb37
Signed-off-by: Deva Ramasubramanian <dramasub@codeaurora.org>
msm: board-8064: Port ION from 8960 to 8064

Port ION changes made to 8960 to 8064 board file.

(cherry picked from commit 7c6aa74dbe836c6ac14f718b47925baf6a1e2d16)

Change-Id: I0165ab11b18ac3822818df5f96137950f630b213
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
Merge "msm: board-8064: Port ION from 8960 to 8064" into ics_chocolate
Merge "msm_fb: display: Fix incorrect goto call" into ics_chocolate
Merge "msm: defconfig: Enable writeback panel for wfd" into ics_chocolate
tzcom: Add support for modifying specific fields in cmd_buf

Allow client to send information to replace a specific field of
the cmd buffer with the physical address.  This is done via a new
IOCTL, TZCOM_IOCTL_SEND_CMD_FD_REQ, which is used to import the
ion fd handle. This IOCTL takes in a new send_cmd_fd_op_req
structure that has the same format as send-cmd_op_req with a
new field added: an array of ion handles (ifd_data.fd) and
cmd_buf_offset.

The client sends in an array of ion fd handle along with the
offset to the command buffer field.

This new IOCTL allows a client to send information regarding
which field(s) (at cmd_buf_offset) in the cmd_buf to replace.
These field(s) are replaced with the physical addr of the
buffer addressed by the respective ifd_data.fd handle.

Signed-off-by: Mona Hossain <mhossain@codeaurora.org>
(cherry picked from commit 6e2e26984f11692468c273dc97dc05c317945449)

Change-Id: I3cb495c5dc8f899ea3f15e4a6176e1d1a633c31b
Signed-off-by: Ramakrishna Prasad N <crpn@codeaurora.org>
vidc: Map firmware buffers after memory clocks are ON.

Change will delay mapping of buffers until bus bandwidth is
requested by video driver

Signed-off-by: Gopikrishnaiah Anandan <gopikr@codeaurora.org>
(cherry picked from commit cc5d20d1c1c52cb69fc4bae5bb626fd76bfe730e)

Change-Id: I2118c10ba5b4e774d347a1d8c0934ae5b061bb04
Signed-off-by: Ramakrishna Prasad N <crpn@codeaurora.org>
vidc: Enable clocks required for secure playback.

The video driver should enable iommu clocks for vcodec, mdp and
rotator for content protection playback. Expose clocks to video
driver to enable for secure playback.

Signed-off-by: Gopikrishnaiah Anandan <gopikr@codeaurora.org>
(cherry picked from commit 4d05ed377635f1955412c580d2e925babd0fa122)

Change-Id: I412d6a1370adf2612aa73ec4db94e7b02eecec5a
Signed-off-by: Ramakrishna Prasad N <crpn@codeaurora.org>
vidc: Add support for video playback secure session.

When video driver is opened in secure mode, buffers
are allocated from secure heap.

Change-Id: I3204aa924c9dc02560bf481c529639d159ebc126
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
Signed-off-by: Deva Ramasubramanian <dramasub@codeaurora.org>
Signed-off-by: Rajeshwar Kurapaty <rkurapat@codeaurora.org>
Signed-off-by: Ramakrishna Prasad N <crpn@codeaurora.org>
gpu: ion: Add support for adjacent heaps

ION has to guarantee that two of the heaps are
adjacent to each other. This is due to a limitation
in the hardware. Add code to ensure these heaps
are adjacent.

Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
(cherry picked from commit 42ebe71efc4143580fc210e62b92d7a616bfd91e)

Change-Id: Id5a0dc725a6d9b51eada9cf25531d442f13073fc
Signed-off-by: Ramakrishna Prasad N <crpn@codeaurora.org>
gpu: ion: Fix SCM call message size

The SCM call message size used to protect and
unprotect memory is incorrect. The interface expects
13 bytes but 16 bytes is sent due to padding of the
message struct.

Pack the message structure to force the size of the
structure to 13 bytes.

Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
(cherry picked from commit 41cf3e3363e4c6d5ba79af22db98a1bba329b0dd)

Change-Id: I1cb383396330d16d3c17e46b260e2cc0371d9ad3
Signed-off-by: Ramakrishna Prasad N <crpn@codeaurora.org>
gpu: ion: Clean up logging messages

Remove duplicate logging message for failure to create
a heap. Add logging message with name, base address, and
size of each heap created.

Change-Id: Id3a3706d914ffa72b0ecd84eb98785a678ceda9a
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
(cherry picked from commit 9b2d1c2f8cce407e3f688df8245da969edd6750b)
gpu: ion: Add decrement of mapping count

Add decrement of mapping count when mapping fails
and corresponding SMI release region call.

Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
(cherry picked from commit cb9ad9ead5dd58daa79cb0cd52fd69f7d42f058c)

Change-Id: Ic507948bafb693fddbdc07664db89fd01fd32e2d
Signed-off-by: Ramakrishna Prasad N <crpn@codeaurora.org>
gpu: ion: Fix ion client name allocation

The ion client name used for debugging were being
allocated on the stack for user space clients. This
causes the name to be garbled when later printed.

Instead, allocate the name from the heap.

Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
(cherry picked from commit 63e5f3bc5a7cbbec0654392ce2c7e47540aea6e2)

Change-Id: If471aff864d46715aac02966bf12a2a318e906e3
Signed-off-by: Ramakrishna Prasad N <crpn@codeaurora.org>
gpu: ion: Add error message when allocation fails

Add error message when allocation from ion fails.

Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
(cherry picked from commit 35e2f2f14b70047a758d036c1adf4f110346b93a)

Change-Id: Iec43b6ada8a6c3b948e734b2f30df4c899d8d412
Signed-off-by: Ramakrishna Prasad N <crpn@codeaurora.org>
gpu: ion: Refactor debugfs printing

Printing to debugfs is done from a centralized location for
all the heaps managed by ion. This architecture is not
sustainable in the long run since different heaps have different
requirements for what should be printed.

Refactor the debugfs printing for ion so that each heap is
responsible for printing its information.

Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
(cherry picked from commit 3d4fe1ac86faf189860ed2bfd232a313f2372507)

Change-Id: I93cd724e7a10595d102fdaf516dd940cd95a21d1
Signed-off-by: Ramakrishna Prasad N <crpn@codeaurora.org>
msm: Camera: clear control queue

Clear control queue everytime before entering wait in msm_control as
there might be invalid payloads in the queue and this can lead to
not waiting at all and exit before the valid command completes.

Change-Id: Iee83bc51e0c3568f73c1f900d72df41c63a3ace6
Signed-off-by: Manogna Reddy Alle <cmalle@codeaurora.org>
(cherry picked from commit 008ccc5b4e2b7e05d1dd4d6054c31828ef29d17f)
Signed-off-by: Gopal G Goberu <ggober@codeaurora.org>