drm/omap: Merge omap_dss_device type and output_type fields

The omap_dss_device type and output_type fields differ mostly for
historical reasons. The output_type field is required for all devices
but the display at the end of the pipeline, and must be set to
OMAP_DISPLAY_TYPE_NONE for the latter. The type field is required for
all devices but the internal encoder, for which it is ignored.

The only reason why the output_type field must be set to
OMAP_DISPLAY_TYPE_NONE for the display at the end of the pipeline is to
identify omap_dss_device instances corresponding to displays. This is
not documented and confusing.

Clean the code by adding a new display field to the omap_dss_device
structure to identify displays, and merge the type and output_type
fields.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Tested-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
This commit is contained in:
Laurent Pinchart 2018-12-10 14:00:38 +02:00 committed by Tomi Valkeinen
parent a4e26525ca
commit 0dbfc39667
25 changed files with 33 additions and 21 deletions

View File

@ -56,6 +56,7 @@ static int tvc_probe(struct platform_device *pdev)
dssdev->ops = &tvc_ops;
dssdev->dev = &pdev->dev;
dssdev->type = OMAP_DISPLAY_TYPE_VENC;
dssdev->display = true;
dssdev->owner = THIS_MODULE;
dssdev->of_ports = BIT(0);

View File

@ -239,6 +239,7 @@ static int dvic_probe(struct platform_device *pdev)
dssdev->ops = &dvic_ops;
dssdev->dev = &pdev->dev;
dssdev->type = OMAP_DISPLAY_TYPE_DVI;
dssdev->display = true;
dssdev->owner = THIS_MODULE;
dssdev->of_ports = BIT(0);

View File

@ -140,6 +140,7 @@ static int hdmic_probe(struct platform_device *pdev)
dssdev->ops = &hdmic_ops;
dssdev->dev = &pdev->dev;
dssdev->type = OMAP_DISPLAY_TYPE_HDMI;
dssdev->display = true;
dssdev->owner = THIS_MODULE;
dssdev->of_ports = BIT(0);
dssdev->ops_flags = ddata->hpd_gpio

View File

@ -88,7 +88,6 @@ static int opa362_probe(struct platform_device *pdev)
dssdev->ops = &opa362_ops;
dssdev->dev = &pdev->dev;
dssdev->type = OMAP_DISPLAY_TYPE_VENC;
dssdev->output_type = OMAP_DISPLAY_TYPE_VENC;
dssdev->owner = THIS_MODULE;
dssdev->of_ports = BIT(1) | BIT(0);

View File

@ -84,7 +84,6 @@ static int tfp410_probe(struct platform_device *pdev)
dssdev->ops = &tfp410_ops;
dssdev->dev = &pdev->dev;
dssdev->type = OMAP_DISPLAY_TYPE_DPI;
dssdev->output_type = OMAP_DISPLAY_TYPE_DVI;
dssdev->owner = THIS_MODULE;
dssdev->of_ports = BIT(1) | BIT(0);
dssdev->bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_SYNC_POSEDGE

View File

@ -167,7 +167,6 @@ static int tpd_probe(struct platform_device *pdev)
dssdev->ops = &tpd_ops;
dssdev->dev = &pdev->dev;
dssdev->type = OMAP_DISPLAY_TYPE_HDMI;
dssdev->output_type = OMAP_DISPLAY_TYPE_HDMI;
dssdev->owner = THIS_MODULE;
dssdev->of_ports = BIT(1) | BIT(0);
dssdev->ops_flags = OMAP_DSS_DEVICE_OP_DETECT

View File

@ -150,6 +150,7 @@ static int panel_dpi_probe(struct platform_device *pdev)
dssdev->dev = &pdev->dev;
dssdev->ops = &panel_dpi_ops;
dssdev->type = OMAP_DISPLAY_TYPE_DPI;
dssdev->display = true;
dssdev->owner = THIS_MODULE;
dssdev->of_ports = BIT(0);
dssdev->ops_flags = OMAP_DSS_DEVICE_OP_MODES;

View File

@ -1272,6 +1272,7 @@ static int dsicm_probe(struct platform_device *pdev)
dssdev->ops = &dsicm_ops;
dssdev->driver = &dsicm_dss_driver;
dssdev->type = OMAP_DISPLAY_TYPE_DSI;
dssdev->display = true;
dssdev->owner = THIS_MODULE;
dssdev->of_ports = BIT(0);
dssdev->ops_flags = OMAP_DSS_DEVICE_OP_MODES;

View File

@ -197,6 +197,7 @@ static int lb035q02_panel_spi_probe(struct spi_device *spi)
dssdev->dev = &spi->dev;
dssdev->ops = &lb035q02_ops;
dssdev->type = OMAP_DISPLAY_TYPE_DPI;
dssdev->display = true;
dssdev->owner = THIS_MODULE;
dssdev->of_ports = BIT(0);
dssdev->ops_flags = OMAP_DSS_DEVICE_OP_MODES;

View File

@ -192,6 +192,7 @@ static int nec_8048_probe(struct spi_device *spi)
dssdev->dev = &spi->dev;
dssdev->ops = &nec_8048_ops;
dssdev->type = OMAP_DISPLAY_TYPE_DPI;
dssdev->display = true;
dssdev->owner = THIS_MODULE;
dssdev->of_ports = BIT(0);
dssdev->ops_flags = OMAP_DSS_DEVICE_OP_MODES;

View File

@ -207,6 +207,7 @@ static int sharp_ls_probe(struct platform_device *pdev)
dssdev->dev = &pdev->dev;
dssdev->ops = &sharp_ls_ops;
dssdev->type = OMAP_DISPLAY_TYPE_DPI;
dssdev->display = true;
dssdev->owner = THIS_MODULE;
dssdev->of_ports = BIT(0);
dssdev->ops_flags = OMAP_DSS_DEVICE_OP_MODES;

View File

@ -706,6 +706,7 @@ static int acx565akm_probe(struct spi_device *spi)
dssdev->dev = &spi->dev;
dssdev->ops = &acx565akm_ops;
dssdev->type = OMAP_DISPLAY_TYPE_SDI;
dssdev->display = true;
dssdev->owner = THIS_MODULE;
dssdev->of_ports = BIT(0);
dssdev->ops_flags = OMAP_DSS_DEVICE_OP_MODES;

View File

@ -321,6 +321,7 @@ static int td028ttec1_panel_probe(struct spi_device *spi)
dssdev->dev = &spi->dev;
dssdev->ops = &td028ttec1_ops;
dssdev->type = OMAP_DISPLAY_TYPE_DPI;
dssdev->display = true;
dssdev->owner = THIS_MODULE;
dssdev->of_ports = BIT(0);
dssdev->ops_flags = OMAP_DSS_DEVICE_OP_MODES;

View File

@ -420,6 +420,7 @@ static int tpo_td043_probe(struct spi_device *spi)
dssdev->dev = &spi->dev;
dssdev->ops = &tpo_td043_ops;
dssdev->type = OMAP_DISPLAY_TYPE_DPI;
dssdev->display = true;
dssdev->owner = THIS_MODULE;
dssdev->of_ports = BIT(0);
dssdev->ops_flags = OMAP_DSS_DEVICE_OP_MODES;

View File

@ -207,7 +207,7 @@ void omapdss_device_disconnect(struct omap_dss_device *src,
dev_dbg(dst->dev, "disconnect\n");
if (!dst->id && !omapdss_device_is_connected(dst)) {
WARN_ON(dst->output_type);
WARN_ON(!dst->display);
return;
}

View File

@ -634,7 +634,7 @@ static int dpi_init_output_port(struct dpi_data *dpi, struct device_node *port)
out->dev = &dpi->pdev->dev;
out->id = OMAP_DSS_OUTPUT_DPI;
out->output_type = OMAP_DISPLAY_TYPE_DPI;
out->type = OMAP_DISPLAY_TYPE_DPI;
out->dispc_channel = dpi_get_channel(dpi);
out->of_ports = BIT(port_num);
out->ops = &dpi_ops;

View File

@ -5121,7 +5121,7 @@ static int dsi_init_output(struct dsi_data *dsi)
out->id = dsi->module_id == 0 ?
OMAP_DSS_OUTPUT_DSI1 : OMAP_DSS_OUTPUT_DSI2;
out->output_type = OMAP_DISPLAY_TYPE_DSI;
out->type = OMAP_DISPLAY_TYPE_DSI;
out->name = dsi->module_id == 0 ? "dsi.0" : "dsi.1";
out->dispc_channel = dsi_get_channel(dsi);
out->ops = &dsi_ops;

View File

@ -679,7 +679,7 @@ static int hdmi4_init_output(struct omap_hdmi *hdmi)
out->dev = &hdmi->pdev->dev;
out->id = OMAP_DSS_OUTPUT_HDMI;
out->output_type = OMAP_DISPLAY_TYPE_HDMI;
out->type = OMAP_DISPLAY_TYPE_HDMI;
out->name = "hdmi.0";
out->dispc_channel = OMAP_DSS_CHANNEL_DIGIT;
out->ops = &hdmi_ops;

View File

@ -663,7 +663,7 @@ static int hdmi5_init_output(struct omap_hdmi *hdmi)
out->dev = &hdmi->pdev->dev;
out->id = OMAP_DSS_OUTPUT_HDMI;
out->output_type = OMAP_DISPLAY_TYPE_HDMI;
out->type = OMAP_DISPLAY_TYPE_HDMI;
out->name = "hdmi.0";
out->dispc_channel = OMAP_DSS_CHANNEL_DIGIT;
out->ops = &hdmi_ops;

View File

@ -413,14 +413,18 @@ struct omap_dss_device {
struct list_head list;
enum omap_display_type type;
/*
* DSS output type that this device generates (for DSS internal devices)
* or requires (for external encoders). Must be OMAP_DISPLAY_TYPE_NONE
* for display devices (connectors and panels) and to non-zero value for
* all other devices.
* DSS type that this device generates (for DSS internal devices) or
* requires (for external encoders, connectors and panels). Must be a
* non-zero (different than OMAP_DISPLAY_TYPE_NONE) value.
*/
enum omap_display_type output_type;
enum omap_display_type type;
/*
* True if the device is a display (panel or connector) at the end of
* the pipeline, false otherwise.
*/
bool display;
const char *name;

View File

@ -33,7 +33,7 @@ int omapdss_device_init_output(struct omap_dss_device *out)
return PTR_ERR(out->next);
}
if (out->next && out->output_type != out->next->type) {
if (out->next && out->type != out->next->type) {
dev_err(out->dev, "output type and display type don't match\n");
return -EINVAL;
}

View File

@ -272,7 +272,7 @@ static int sdi_init_output(struct sdi_device *sdi)
out->dev = &sdi->pdev->dev;
out->id = OMAP_DSS_OUTPUT_SDI;
out->output_type = OMAP_DISPLAY_TYPE_SDI;
out->type = OMAP_DISPLAY_TYPE_SDI;
out->name = "sdi.0";
out->dispc_channel = OMAP_DSS_CHANNEL_LCD;
/* We have SDI only on OMAP3, where it's on port 1 */

View File

@ -760,7 +760,7 @@ static int venc_init_output(struct venc_device *venc)
out->dev = &venc->pdev->dev;
out->id = OMAP_DSS_OUTPUT_VENC;
out->output_type = OMAP_DISPLAY_TYPE_VENC;
out->type = OMAP_DISPLAY_TYPE_VENC;
out->name = "venc.0";
out->dispc_channel = OMAP_DSS_CHANNEL_DIGIT;
out->ops = &venc_ops;

View File

@ -128,7 +128,7 @@ static void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable)
if (WARN_ON(omap_crtc->enabled == enable))
return;
if (omap_crtc->pipe->output->output_type == OMAP_DISPLAY_TYPE_HDMI) {
if (omap_crtc->pipe->output->type == OMAP_DISPLAY_TYPE_HDMI) {
priv->dispc_ops->mgr_enable(priv->dispc, channel, enable);
omap_crtc->enabled = enable;
return;

View File

@ -138,7 +138,7 @@ static void omap_encoder_mode_set(struct drm_encoder *encoder,
}
/* Set the HDMI mode and HDMI infoframe if applicable. */
if (omap_encoder->output->output_type == OMAP_DISPLAY_TYPE_HDMI)
if (omap_encoder->output->type == OMAP_DISPLAY_TYPE_HDMI)
omap_encoder_hdmi_mode_set(encoder, adjusted_mode);
}
@ -161,7 +161,7 @@ static void omap_encoder_disable(struct drm_encoder *encoder)
* DSI is treated as an exception as DSI pipelines still use the legacy
* flow where the pipeline output controls the encoder.
*/
if (dssdev->output_type != OMAP_DISPLAY_TYPE_DSI) {
if (dssdev->type != OMAP_DISPLAY_TYPE_DSI) {
dssdev->ops->disable(dssdev);
dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
}
@ -189,7 +189,7 @@ static void omap_encoder_enable(struct drm_encoder *encoder)
* DSI is treated as an exception as DSI pipelines still use the legacy
* flow where the pipeline output controls the encoder.
*/
if (dssdev->output_type != OMAP_DISPLAY_TYPE_DSI) {
if (dssdev->type != OMAP_DISPLAY_TYPE_DSI) {
dssdev->ops->enable(dssdev);
dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
}