remoteproc: disable auto-suspend when entering secure mode

Secure module reads iommu ttbr register in order to make sure that the
iommu is using a firewalled MMU table. The clocks to iommu therefore
cannot be cut during secure play back. The remoteproc auto-suspend
is disabled for ipu processor when entering secure mode, and is
reenabled when switching back to normal mode.

Change-Id: I64b0b3acc7d9526b5b538104f7946d0e8ed0a537
Signed-off-by: Suman Anna <s-anna@ti.com>
remoteproc: add support to use a carveout memory pool

The remoteproc driver relies on device-specific CMA pool for
allocating memory for various firmware image sections. Support
has been added now to let the remoteproc driver choose to use a
carveout pool instead of the CMA pool.

This option is added to allow flexibility and robustness for
allocations within the remoteproc driver. The carveout memory
option is especially beneficial for improving the memory allocation
times and for avoiding any possible remoteproc failures due to
run-time failure of a CMA allocation. This option provides this
reliability at the expense of a static carveout.

The remoteproc driver is self-configured to use a carveout pool
or the CMA pool based on whether a carveout pool data is supplied
or not during the rproc registration. The carveout pool data will
need to be constructed during the remoteproc device creation.

NOTE: The current changes customize the carveout allocations
specifically for the OMAP firmware sections because of its
hardcoded adherence to the CMA assignments, specifically for
the vrings and vring data buffers.

Change-Id: I396314d4e484e3e9f33f4fbf9023764a4ab9684f
Signed-off-by: Angela Stegmaier <angelabaker@ti.com>
Signed-off-by: Suman Anna <s-anna@ti.com>
remoteproc: add .get & .set virtio config ops implementations

The virtio config ops functions for get and set are added through
rproc_virtio_get and rproc_virtio_set functions. These functions
are used in a non-standard way and are overloaded primarily to allow
the virtio rpmsg bus infrastructure to query the remoteproc driver
about it carveout pool configuration and to allocate/free the vring
buffers.

Change-Id: I6fbd6d1cb502b34f556469a5238b4b18128c2171
Signed-off-by: Suman Anna <s-anna@ti.com>
rpmsg: add support for allocating vring buffers from carveout

The current rpmsg code relies and uses the same CMA pool associated
with a rproc device. Support has been added to allocate the vring
buffers from a remoteproc's carveout pool. The virtio rpmsg bus
infrastructure does not have direct access to the remoteproc pool,
so it is extended using the virtio config ops. The remoteproc
carveout configuration is also retrieved to help with the proper
cleanup of the buffers.

The remoteproc carveout allocation returns both the physical address
and a virtual address. The virtual address is an ioremap'd address
and is not exactly the equivalent to the virtual address retrieved
from a dma_alloc_coherent call. Logic is adjusted to make the
underlying virtio publish a direct-mapped kernel address so that
the offsets are identical between the virtual and physical addresses.
This is essential for the remote processor to perform the address
translation properly using address masking.

Change-Id: I55848e9f5f3a4429f968285cddf3efa1feb6b47a
Signed-off-by: Suman Anna <s-anna@ti.com>
ARM: OMAP: remoteproc: add carveout memory pool configuration

The carveout memory pool data information is added to the OMAP
remoteproc platform data. A new configurable menuconfig option
has been added to help choose between the carveout pool or the
rproc device-specific CMA pool. The default option is left to
use the CMA pool.

The carveout memory for remoteproc will still be reserved at board
initialization time, but the allocation mechanism is dictated by
the configuration option. The option controls the configuration
choice for all the remote processors on the SoC, and cannot be
enabled differently for different processors.

Change-Id: Ic14734fbc3d64a9ee1ebf7c4933f588e76f9c8bc
Signed-off-by: Angela Stegmaier <angelabaker@ti.com>
Signed-off-by: Suman Anna <s-anna@ti.com>
Merge remote-tracking branch 'origin/p-linux-omap-3.4' into p-android-omap-3.4

* origin/p-linux-omap-3.4:
  ARM: OMAP: remoteproc: add carveout memory pool configuration
  rpmsg: add support for allocating vring buffers from carveout
  remoteproc: add .get & .set virtio config ops implementations
  remoteproc: add support to use a carveout memory pool
  remoteproc: disable auto-suspend when entering secure mode

Change-Id: Ia07133451df2bd55e3bfe33d5a6170062c0705a4
Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
ARM: android_omap_defconfig: enable rproc to use carveout

The remoteproc configuration to use carveout for memory
allocations is turned on by default in the android_omap
defconfig. This is being done to avoid any CMA allocation
failures during the reload of the remote processor specifically
for secure playback usecase (not seen during regular operation).

Change-Id: I154e8160c782f02ed83964218560957a14039b65
Signed-off-by: Suman Anna <s-anna@ti.com>
OMAPDSS: DISPC: gracefully disable overlay at error

Disable overlay via ovl->disable() interface, which will
properly set flags in cache and GO bits for managers.
This allows overlay user to re-enable it on next frame,
thus recovering from FIFO underflows.

Change-Id: Iafeea91196efae82e81b41c637848accd80c07d6
Signed-off-by: Sergiy Kibrik <sergiy.kibrik@globallogic.com>
Merge remote-tracking branch 'origin/p-linux-omap-3.4' into p-android-omap-3.4

* origin/p-linux-omap-3.4:
  OMAPDSS: DISPC: gracefully disable overlay at error

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
OMAPDSS: DISPC: raise GFX priority in case of TV output

Set arbitration bit on GFX pipeline if it's associated to
TV output, as it always has real-time throughput constraints,
while GFX FIFO is much smaller then FIFOs in video pipes and
often causes underflows on high resolutions.

Change-Id: If349b02dd4c9240378c69acc58eeed62ba695479
Signed-off-by: Sergiy Kibrik <sergiy.kibrik@globallogic.com>

Conflicts:
	drivers/video/omap2/dss/dispc.c
Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Revert "OMAP4:HDMI: Device can't boot with HDMI cable plugged"

This reverts commit a6444f1f83eec320820f4d36506f127db9250d02.

Clocks "dss_fck" should not be enabled directly. HDMI driver
should use pm_runtime_enable/disable to switch on/off dss clocks.
Accessing "dss_fck" causing device misbehaviour such as hangs on
boot when HDMI cable plugged in or fails during enter to suspend.

Change-Id: I27ddc61f65b0d9577016c5ae17f4eefe4e5cf8a8
Signed-off-by: Ruslan Ruslichenko <x0191366@ti.com>
ARM: OMAP44xx: Remove dss_fck clock

As dss_fck should not be used directly, so remove it from
clock data. To manage dss_fck software now should use
omap_hwmod_enable()/omap_hwmod_disable() interface which
will automatically switch on/off required clocks.

Change-Id: I5cbd19a3eec7c2eb90f03cb87167b907db28c546
Signed-off-by: Ruslan Ruslichenko <x0191366@ti.com>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Merge remote-tracking branch 'origin/p-linux-omap-3.4' into p-android-omap-3.4

* origin/p-linux-omap-3.4:
  ARM: OMAP44xx: Remove dss_fck clock

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
OMAPDSS: DSS: enable MFLAG support for 4470.

This patch enables MFLAG support. The underflows on DSS pipes
happens sometimes because DSS works without a high priority on L3.
Now MFLAG is enabled and when MFLAG is asserted - DSS ables to fill
DMA buffers in time without underflows because of priority on L3.

Change-Id: If6cbdab0a2afb490a6d4dbd327dc5c2b0583a274
Signed-off-by: Artem Rudenko <artemrudenko@ti.com>
OMAPDSS:CEC: Unregistration cec keyboard for hdmi suspend

Unregistration cec keyboard for hdmi suspend was added

Change-Id: I79ce9041d45bd601c72be7b9df7989cfec6bbf92
Signed-off-by: Oleksandr Krol <oleksandr.krol@globallogic.com>
OMAPDSS: HDCP: Fix compilation warning

Fix following compilation warning:
...
drivers/video/omap2/dss/hdcp_ddc.c:33: warning: 'hdcp_suspend_resume_auto_ri' defined but not used
...

Change-Id: Icbdc5d4fe85529833d7d83fb17d8c1083fdb6031
Signed-off-by: Victor Kleinik <x0150886@ti.com>
ASoC: TWL6040: ADD VAUX2 regulator for AV switch

An AV switch is used in Blaze/SDP4430 to switch headset jack pin 3
between headset microphone and video output. AV switch is then a
consumer of VAUX2 supply. The corresponding consumer-supply is added
to have VAUX2 supply when headset microphone is in use.

This is considered non-essential, so if the driver is unable to
acquire the VAUX2 supply, it will gracefully continue.

Change-Id: Ie9ff712f9ded2f1e2f7c00867818d8cb499a6fc1
Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com>
Signed-off-by: Gabriel M. Beddingfield <gabrbedd@ti.com>
Signed-off-by: Victor Kleinik <x0150886@ti.com>
staging: omapdrm: Use vmalloc on resume path

Due to memory fragmentation kmalloc sometimes can't do high-order
memory allocation (128k, order 5) on resume path and kernel crashes.
Seems omap_dmm_resume() is only place where such an allocation take
place and therefore it should be fixed.

This patch uses vmalloc instead kmalloc so that phisically
non-contiguous memory can be allocated.

Change-Id: I85569ea4d30996e89725b6984191f38a3b5545ee
Signed-off-by: Semen Protsenko <semen.protsenko@ti.com>
TI-TFW: OMAP44xx: ondie-governor: Add possibility to set platform data

This patch adds possibility to overwrite default governor settings
like thermal_zones for specific boards.

Change-Id: I3f17bb5581f3465cc687e0bc29e1ad572f644379
Signed-off-by: Ruslan Ruslichenko <x0191366@ti.com>
ARM: OMAP4: SDP/Tablet44xx: Add omap_die_governor platform data

As on most of OMAP4460/70 SOM's we have Standard DDR2 which can
operate on temperatures from -25C to +85C, so we need to overwrite
default thermal governor zones to lower temperatures, so that it
won't allow DDR to overheat.
Otherways device will crash during long workload with errors like
this:

"emif emif.1: SDRAM temperature exceeds operating limit.. Needs shut down!!!"

Change-Id: Id9d3e55617c5f6716434a19f539ea1405360e2a7
Signed-off-by: Ruslan Ruslichenko <x0191366@ti.com>