drm/omap: Merge omap_dss_device type and output_type fields
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Mon, 10 Dec 2018 12:00:38 +0000 (14:00 +0200)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Mon, 18 Mar 2019 09:42:13 +0000 (11:42 +0200)
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>
25 files changed:
drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
drivers/gpu/drm/omapdrm/displays/connector-dvi.c
drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
drivers/gpu/drm/omapdrm/displays/encoder-opa362.c
drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c
drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c
drivers/gpu/drm/omapdrm/displays/panel-dpi.c
drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c
drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c
drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c
drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c
drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c
drivers/gpu/drm/omapdrm/displays/panel-tpo-td043mtea1.c
drivers/gpu/drm/omapdrm/dss/base.c
drivers/gpu/drm/omapdrm/dss/dpi.c
drivers/gpu/drm/omapdrm/dss/dsi.c
drivers/gpu/drm/omapdrm/dss/hdmi4.c
drivers/gpu/drm/omapdrm/dss/hdmi5.c
drivers/gpu/drm/omapdrm/dss/omapdss.h
drivers/gpu/drm/omapdrm/dss/output.c
drivers/gpu/drm/omapdrm/dss/sdi.c
drivers/gpu/drm/omapdrm/dss/venc.c
drivers/gpu/drm/omapdrm/omap_crtc.c
drivers/gpu/drm/omapdrm/omap_encoder.c

index 1503563..6c05611 100644 (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);
 
index bf5ee50..fa3a69b 100644 (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);
 
index 797da4a..68d6f6e 100644 (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
index fc5e0c4..29a5a13 100644 (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);
 
index 8203507..fb88537 100644 (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
index ced3671..bc03752 100644 (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
index 897b882..389ae28 100644 (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;
index d9f10f4..741a5e3 100644 (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;
index f37931b..4133351 100644 (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;
index 8f2fb3d..498a883 100644 (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;
index 8d5d7f7..1e68e0d 100644 (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;
index b8360ce..abee0b3 100644 (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;
index 721c5bb..5b4fbcc 100644 (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;
index 5096001..781dc8b 100644 (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;
index d14abde..81ea0f5 100644 (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;
        }
 
index 295bc3e..cc78dfa 100644 (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;
index 4ac325e..2582b56 100644 (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;
index 4337380..6339e27 100644 (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;
index b94f884..2955bba 100644 (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;
index d13a6b5..ab5467a 100644 (file)
@@ -413,14 +413,18 @@ struct omap_dss_device {
 
        struct list_head list;
 
+       /*
+        * 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 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.
+        * True if the device is a display (panel or connector) at the end of
+        * the pipeline, false otherwise.
         */
-       enum omap_display_type output_type;
+       bool display;
 
        const char *name;
 
index 0ac400a..f25ecfd 100644 (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;
        }
index 38b0bf1..e794532 100644 (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 */
index f2cbecf..da43b86 100644 (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;
index ae39943..1353aec 100644 (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;
index 367234d..4274847 100644 (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;
        }