ARM: dts: imx6qdl-sabrelite: Add HDMI device

Adds hdmi with DDC on i2c2.

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
ARM: dts: imx6qdl-sabreauto: Add HDMI device

Signed-off-by: George G. Davis <george_davis@mentor.com>
ARM: dts: imx6qdl: Create imx-drm crtc nodes

Create imx-drm crtc device nodes. Each crtc node requires the following
parameters:

- parent ipu phandle.
- di number.
- port endpoints.

Optionally the node can specify a "dual-plane" boolean parameter
to configure the crtc device with a foreground plane. If not given,
the crtc will have only a single plane.

The crtc port lists the endpoints to the remote encoder endpoints.
These endpoints were moved out of the ipu nodes, since they more
logically now belong to the crtc nodes.

As a result, the display-subsystem node should enumerate its crtcs
instead of the former ipu ports.

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
ARM: i.MX6: use pll2_pfd0_352m as clock root of ipu_di

AS pll5_video_div has already been used as clock root for ldb_di,
so use pll2_pfd0_352m as clock root of ipu_di for HDMI.

Signed-off-by: Jiada Wang <jiada_wang@mentor.com>
Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
ARM: i.MX6: select pll3_usb_otg for ldb_di for rev 1.0 chip

Select pll3_usb_otg for ldb_di clock for rev 1.0 chips.

Signed-off-by: Jiada Wang <jiada_wang@mentor.com>
Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
gpu: ipu-cpmem: Add ipu_cpmem_set_uv_offset()

Adds ipu_cpmem_set_uv_offset(), to set planar U/V offsets.

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
gpu: ipu-v3: Add ipu_dp_set_chroma_key()

Adds the function ipu_dp_set_chroma_key(), which sets up a color key
value for a DP foreground plane.

ipu_dp_set_chroma_key() accepts a color key value in RGB24 format.
If the combiner unit colorspace is YUV, the key must be converted
to YUV444, using the same CSC coefficients as programmed in the DP.
So pull out the CSC coefficients from ipu_dp_csc_init() to make
them available to rgb24_to_yuv444() that converts to color key.

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
gpu: ipu-v3: Add ipu_dp_set_gamma_correction()

Adds the function ipu_dp_set_gamma_correction(), which programs the
piecewise linear curve that approximates a gamma correction curve.

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
gpu: ipu-v3: Add support for dynamic DC interface pixel maps

Adds support to ipu-dc to dynamically create new display interface
pixel mappings.

The mappings are formally defined by a struct ipu_dc_if_map, which is
passed to ipu_dc_init_sync().

The ipu-dc maintains a list of the currently programmed mappings.
Some mappings are pre-loaded at probe time (RGB24, BGR24, GBR24,
RGB565, BGR666, and "LVDS666").

If the map pointer to ipu_dc_init_sync() is not NULL, a new mapping
is created, otherwise previously loaded mappings will be searched based
on the passed pixel_fmt.

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
gpu: ipu-v3: Add ipu_dc_uninit_sync()

Adds the function ipu_dc_uninit_sync() which tears down
ipu_dc_init_sync().

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Signed-off-by: Muzaffar Mahmood <muzaffar_mahmood@mentor.com>
gpu: ipu-v3: Pass struct ipu_dc to enable/disable

Pass the pointer to DC channel to ipu_dc_enable() and ipu_dc_disable(),
to be more consistent with the other ipu-dc APIs.

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
gpu: ipu-v3: Add ipu_dp_uninit_channel()

Adds the function ipu_dp_uninit_channel() which tears down
ipu_dp_setup_channel().

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Signed-off-by: Muzaffar Mahmood <muzaffar_mahmood@mentor.com>
gpu: ipu-v3: Pass struct ipu_dp to enable/disable

Pass the pointer to DP channel to ipu_dp_enable() and ipu_dp_disable(),
to be more consistent with the other ipu-dp APIs.

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
gpu: ipu-v3: Implement use counter for ipu_dc_enable(), ipu_dc_disable()

The functions ipu_dc_enable() and ipu_dc_disable() enable/disable the DC
globally in the IPU_CONF register, but the DC is used by multiple clients
on different DC channels. So make sure to only disable/enable the DC
globally based on a use counter.

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
gpu: ipu-v3: fix HDMI timing issues

On some monitors, with high resolution(1920x1080), HDMI is not working,
some resolution have pixel column truncation problem
(shows 1280x1022 instead of 1280x1024), which will result in really strange
picture on some monitors.

This Patch aims to fix these HDMI timing issues.

Signed-off-by: Jiada Wang <jiada_wang@mentor.com>
Signed-off-by: Deepak Das <deepak_das@mentor.com>
gpu: ipu-v3: Add DMFC/DP/DC/DI module enable/disable debug

Add debug messages when these modules are globally disabled or enabled
in the IPU_CONF register.

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
gpu: ipu-v3: Add ipu_di_uninit_sync_panel()

Adds ipu_di_uninit_sync_panel() which tears down ipu_di_init_sync_panel().

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
gpu: ipu-v3: Split out DI clock enable/disable

DI clock enable/disable is moved out of ipu_di_enable() and ipu_di_disable()
and into (new) ipu_di_enable_clock() and ipu_di_disable_clock(). So
ipu_di_enable() and ipu_di_disable() are now pure module enable/disable.

The purpose of this change is to more closely emulate the display mode
setting sequence in FSL kernels, which enable and disable the DI
clock as the very last steps during legacy fbdev set_par().

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
gpu: ipu-v3: Protect more CM reg access with IPU lock

Some cm_reg accesses were not being protected by the IPU spin lock.

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
gpu: ipu-v3: Move DI waveform counter enable/disable to ipu-di

Move the DI waveform counter enable/disable out of
ipu_module_enable()/disable(). This should be carried out
when enabling/disabling the DI pixel clock.

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>