OMAPDSS: output: Add set/unset device ops for omap_dss_output

An output entity represented by the struct omap_dss_output connects to a
omap_dss_device entity. Add functions to set or unset an output's device. This
is similar to how managers and devices were connected previously. An output can
connect to a device without being connected to a manager. However, the output
needs to eventually connect to a manager so that the connected panel can be
enabled.

Keep the omap_overlay_manager pointer in omap_dss_device for now to prevent
breaking things. This will be removed later when outputs are supported
completely.

Signed-off-by: Archit Taneja <archit@ti.com>
OMAPDSS: APPLY: Add manager set/unset output ops for omap_overlay_manager

Add set_output/unset_output ops for overlay managers, these form links between
managers and outputs. Create a function in dss features which tell all the
output instances that connect to a manager, use it when a manager tries to set
an output. Add a constraint of not unsetting an output when the manager is
enabled.

Keep the omap_dss_device pointer and set/unset_device ops in overlay_manager for
now to not break things. Keep the dss feature function get_supported_displays
as it's used in some places. These will be removed later.

Signed-off-by: Archit Taneja <archit@ti.com>
OMAPDSS: Remove manager->device references

With the introduction of output entities, managers will now connect to outputs.
Create helper ops for overlays and managers named get_device. This will abstract
away the information on how to get the device from an overlay or an overlay
manager. The get_device ops currently retrieve the output via a
ovl->manager->device reference. This will be later replaced by
ovl->manager->output->device references.

Signed-off-by: Archit Taneja <archit@ti.com>
OMAP_VOUT: Remove manager->device references

With the introduction of output entities, managers will now connect to outputs.
Use the helper op for overlays named get_device. This will abstract away the
information on how to get the omap_dss_device pointer from an overlay.

Using the helper function will reduce the number of pointer dereferences a user
of OMAPDSS needs to do and reduce risk of a NULL dereference.

Cc: Vaibhav Hiremath <hvaibhav@ti.com>
Signed-off-by: Archit Taneja <archit@ti.com>
OMAPFB: remove manager->device references

With the introduction of output entities, managers will now connect to outputs.
Use the helper op for overlays named get_device. This will abstract away the
information on how to get the device from an overlay.

Using the helper function will reduce the number of pointer dereferences a user
of OMAPDSS needs to do and reduce risk of a NULL dereference.

Signed-off-by: Archit Taneja <archit@ti.com>
OMAPDRM: Remove manager->device references

With the introduction of output entities, managers will now connect to outputs.
Use the helper op for managers named get_device. This will abstract away the
information on how to get the device from an overlay manager.

Using the helper function will reduce the number of pointer dereferences a user
of OMAPDSS needs to do and reduce risk of a NULL dereference.

Signed-off-by: Archit Taneja <archit@ti.com>
OMAPDSS: Create links between managers, outputs and devices

Links between DSS entities are made in dss_init_connections() when a panel
device is registered, and are removed in dss_uninit_connections() when the
device is unregistered. Modify these functions to incorporate the addition of
outputs.

The fields in omap_dss_device struct gives information on which output and
manager to connect to. The desired manager and output pointers are retrieved and
prepared to form the desired links. The output is linked to the device, and then
the manager to the output.

A helper function omapdss_get_output_from_device() is created to retrieve the
output from the display by checking it's type, and the module id in case of DSI.

Signed-off-by: Archit Taneja <archit@ti.com>
OMAPDSS: DPI: Replace dssdev->manager with dssdev->output->manager references

With addition of output entities, a device connects to an output, and an output
connects to overlay manager. Replace the dssdev->manager references with
dssdev->output->manager to access the manager correctly.

When enabling the DPI output, check whether the output entity connected to
display is not NULL.

Signed-off-by: Archit Taneja <archit@ti.com>
OMAPDSS: DSI: Remove dsi_pdev_map global struct

dsi_pdev_map is a struct visible globally in the DSI driver to get the platform
device pointer of the DSI device corresponding to it's module ID. This was
required because there was no clean way to derive the platform device from
the DSI module instance number or from the connected panel.

With the new output entity, it is possible to retrieve the platform device
pointer if the omap_dss_output pointer is available. Modify the functions
dsi_get_dsidev_from_dssdev() dsi_get_dsidev_from_id() so that they use output
instead of dsi_pdev_map to retrieve the dsi platform device pointer.

Signed-off-by: Archit Taneja <archit@ti.com>
OMAPDSS: DSI: Replace dssdev->manager with dssdev->output->manager references

With addition of output entities, a device connects to an output, and an output
connects to overlay manager. Replace the dssdev->manager references with
dssdev->output->manager to access the manager correctly.

When enabling the DSI output, check whether the output entity connected to
display is not NULL.

In dsi_init_display(), the display won't be connected to the DSI output yet,
that happens later in dss_recheck_connections() in the panel driver's probe. Get
the dsidev platform device pointer using the DSI moudle number provided in the
omap_dss_device struct.

Signed-off-by: Archit Taneja <archit@ti.com>
OMAPDSS: SDI: Replace dssdev->manager with dssdev->output->manager references

With addition of output entities, a device connects to an output, and an output
connects to overlay manager. Replace the dssdev->manager references with
dssdev->output->manager to access the manager correctly.

When enabling the SDI output, check whether the output entity connected to
display is not NULL.

Signed-off-by: Archit Taneja <archit@ti.com>
OMAPDSS: RFBI: Replace dssdev->manager with dssdev->output->manager references

With addition of output entities, a device connects to an output, and an output
connects to overlay manager. Replace the dssdev->manager references with
dssdev->output->manager to access the manager correctly.

When enabling the RFBI output, check whether the output entity connected to
display is not NULL.

Signed-off-by: Archit Taneja <archit@ti.com>
OMAPDSS: VENC: Replace dssdev->manager with dssdev->output->manager references

With addition of output entities, a device connects to an output, and an output
connects to overlay manager. Replace the dssdev->manager references with
dssdev->output->manager to access the manager correctly.

When enabling the VENC output, check whether the output entity connected to
display is not NULL.

Signed-off-by: Archit Taneja <archit@ti.com>
OMAPDSS: HDMI: Replace dssdev->manager with dssdev->output->manager references

With addition of output entities, a device connects to an output, and an output
connects to overlay manager. Replace the dssdev->manager references with
dssdev->output->manager to access the manager correctly.

When enabling the HDMI output, check whether the output entity connected to
display is not NULL.

Signed-off-by: Archit Taneja <archit@ti.com>
OMAPFB: Change dssdev->manager references

To retrieve the manager pointer via a device, we need to now access it via the
output to which the device is connected. Make this change in omapfb_ioctl()
where the WAITFORVSYNC ioctl tries to access the manager's device.

Signed-off-by: Archit Taneja <archit@ti.com>
OMAPDSS: MANAGER: Update display sysfs store

The display sysfs attribute's store function needs to be changed with the
introduction of outputs.

The DSS driver ensures that there is one display per output, and that a
registered omap_dss_device will have an output connected to it. The display
sysfs store function unsets the current output connected to the manager, and
sets it with the output connected to the new display. If the new display doesn't
have an output for some reason, we just bail out. The function doesn't set/unset
output->device links. These remain the same as when the omap_dss_device was
registered.

Signed-off-by: Archit Taneja <archit@ti.com>
OMAPDSS: OVERLAY/MANAGER: Get device via output

A manager is not connected to a device directly any more. It first connects
to an output, and then to the display. Update overlay and manager get_device ops
to return the device via the connected output.

Signed-off-by: Archit Taneja <archit@ti.com>
OMAPDSS: APPLY: Remove omap_dss_device references from dss_ovl_enable/disable

An overlay isn't allowed to be enabled/disabled if it isn't connected to an
omap_dss_device. This requirement isn't needed any more. An overlay can be
enabled/disabled as long as it has an output connected to it. The output may
not be connected to a device, but we can be assured that the connected
manager's output is in use by an output interface.

Signed-off-by: Archit Taneja <archit@ti.com>
OMAPDSS: Remove old way of setting manager and device links

Now that an omap_dss_output can be used to link between managers and devices, we
can remove the old way of setting manager and device links. This involves
removing the device and manager pointers from omap_overlay_manager and
omap_dss_device respectively, and removing the set_device/unset_device ops from
omap_overlay_manager.

Signed-off-by: Archit Taneja <archit@ti.com>
OMAPDSS: DISPC: Constify omap_overlay_info in dispc_ovl_setup()

The struct omap_overlay_info passed to dispc_ovl_setup() is used to configure
DISPC registers. It shouldn't modify the overlay_info structure. The pos_y field
was being changed in dispc_ovl_setup in the case of interlaced displays. Fix
this and const qualifier to the omap_overlay_info argument.

Signed-off-by: Archit Taneja <archit@ti.com>