Commit 0dbfc396 authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Tomi Valkeinen

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: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
Tested-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
parent a4e26525
...@@ -56,6 +56,7 @@ static int tvc_probe(struct platform_device *pdev) ...@@ -56,6 +56,7 @@ static int tvc_probe(struct platform_device *pdev)
dssdev->ops = &tvc_ops; dssdev->ops = &tvc_ops;
dssdev->dev = &pdev->dev; dssdev->dev = &pdev->dev;
dssdev->type = OMAP_DISPLAY_TYPE_VENC; dssdev->type = OMAP_DISPLAY_TYPE_VENC;
dssdev->display = true;
dssdev->owner = THIS_MODULE; dssdev->owner = THIS_MODULE;
dssdev->of_ports = BIT(0); dssdev->of_ports = BIT(0);
......
...@@ -239,6 +239,7 @@ static int dvic_probe(struct platform_device *pdev) ...@@ -239,6 +239,7 @@ static int dvic_probe(struct platform_device *pdev)
dssdev->ops = &dvic_ops; dssdev->ops = &dvic_ops;
dssdev->dev = &pdev->dev; dssdev->dev = &pdev->dev;
dssdev->type = OMAP_DISPLAY_TYPE_DVI; dssdev->type = OMAP_DISPLAY_TYPE_DVI;
dssdev->display = true;
dssdev->owner = THIS_MODULE; dssdev->owner = THIS_MODULE;
dssdev->of_ports = BIT(0); dssdev->of_ports = BIT(0);
......
...@@ -140,6 +140,7 @@ static int hdmic_probe(struct platform_device *pdev) ...@@ -140,6 +140,7 @@ static int hdmic_probe(struct platform_device *pdev)
dssdev->ops = &hdmic_ops; dssdev->ops = &hdmic_ops;
dssdev->dev = &pdev->dev; dssdev->dev = &pdev->dev;
dssdev->type = OMAP_DISPLAY_TYPE_HDMI; dssdev->type = OMAP_DISPLAY_TYPE_HDMI;
dssdev->display = true;
dssdev->owner = THIS_MODULE; dssdev->owner = THIS_MODULE;
dssdev->of_ports = BIT(0); dssdev->of_ports = BIT(0);
dssdev->ops_flags = ddata->hpd_gpio dssdev->ops_flags = ddata->hpd_gpio
......
...@@ -88,7 +88,6 @@ static int opa362_probe(struct platform_device *pdev) ...@@ -88,7 +88,6 @@ static int opa362_probe(struct platform_device *pdev)
dssdev->ops = &opa362_ops; dssdev->ops = &opa362_ops;
dssdev->dev = &pdev->dev; dssdev->dev = &pdev->dev;
dssdev->type = OMAP_DISPLAY_TYPE_VENC; dssdev->type = OMAP_DISPLAY_TYPE_VENC;
dssdev->output_type = OMAP_DISPLAY_TYPE_VENC;
dssdev->owner = THIS_MODULE; dssdev->owner = THIS_MODULE;
dssdev->of_ports = BIT(1) | BIT(0); dssdev->of_ports = BIT(1) | BIT(0);
......
...@@ -84,7 +84,6 @@ static int tfp410_probe(struct platform_device *pdev) ...@@ -84,7 +84,6 @@ static int tfp410_probe(struct platform_device *pdev)
dssdev->ops = &tfp410_ops; dssdev->ops = &tfp410_ops;
dssdev->dev = &pdev->dev; dssdev->dev = &pdev->dev;
dssdev->type = OMAP_DISPLAY_TYPE_DPI; dssdev->type = OMAP_DISPLAY_TYPE_DPI;
dssdev->output_type = OMAP_DISPLAY_TYPE_DVI;
dssdev->owner = THIS_MODULE; dssdev->owner = THIS_MODULE;
dssdev->of_ports = BIT(1) | BIT(0); dssdev->of_ports = BIT(1) | BIT(0);
dssdev->bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_SYNC_POSEDGE dssdev->bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_SYNC_POSEDGE
......
...@@ -167,7 +167,6 @@ static int tpd_probe(struct platform_device *pdev) ...@@ -167,7 +167,6 @@ static int tpd_probe(struct platform_device *pdev)
dssdev->ops = &tpd_ops; dssdev->ops = &tpd_ops;
dssdev->dev = &pdev->dev; dssdev->dev = &pdev->dev;
dssdev->type = OMAP_DISPLAY_TYPE_HDMI; dssdev->type = OMAP_DISPLAY_TYPE_HDMI;
dssdev->output_type = OMAP_DISPLAY_TYPE_HDMI;
dssdev->owner = THIS_MODULE; dssdev->owner = THIS_MODULE;
dssdev->of_ports = BIT(1) | BIT(0); dssdev->of_ports = BIT(1) | BIT(0);
dssdev->ops_flags = OMAP_DSS_DEVICE_OP_DETECT dssdev->ops_flags = OMAP_DSS_DEVICE_OP_DETECT
......
...@@ -150,6 +150,7 @@ static int panel_dpi_probe(struct platform_device *pdev) ...@@ -150,6 +150,7 @@ static int panel_dpi_probe(struct platform_device *pdev)
dssdev->dev = &pdev->dev; dssdev->dev = &pdev->dev;
dssdev->ops = &panel_dpi_ops; dssdev->ops = &panel_dpi_ops;
dssdev->type = OMAP_DISPLAY_TYPE_DPI; dssdev->type = OMAP_DISPLAY_TYPE_DPI;
dssdev->display = true;
dssdev->owner = THIS_MODULE; dssdev->owner = THIS_MODULE;
dssdev->of_ports = BIT(0); dssdev->of_ports = BIT(0);
dssdev->ops_flags = OMAP_DSS_DEVICE_OP_MODES; dssdev->ops_flags = OMAP_DSS_DEVICE_OP_MODES;
......
...@@ -1272,6 +1272,7 @@ static int dsicm_probe(struct platform_device *pdev) ...@@ -1272,6 +1272,7 @@ static int dsicm_probe(struct platform_device *pdev)
dssdev->ops = &dsicm_ops; dssdev->ops = &dsicm_ops;
dssdev->driver = &dsicm_dss_driver; dssdev->driver = &dsicm_dss_driver;
dssdev->type = OMAP_DISPLAY_TYPE_DSI; dssdev->type = OMAP_DISPLAY_TYPE_DSI;
dssdev->display = true;
dssdev->owner = THIS_MODULE; dssdev->owner = THIS_MODULE;
dssdev->of_ports = BIT(0); dssdev->of_ports = BIT(0);
dssdev->ops_flags = OMAP_DSS_DEVICE_OP_MODES; dssdev->ops_flags = OMAP_DSS_DEVICE_OP_MODES;
......
...@@ -197,6 +197,7 @@ static int lb035q02_panel_spi_probe(struct spi_device *spi) ...@@ -197,6 +197,7 @@ static int lb035q02_panel_spi_probe(struct spi_device *spi)
dssdev->dev = &spi->dev; dssdev->dev = &spi->dev;
dssdev->ops = &lb035q02_ops; dssdev->ops = &lb035q02_ops;
dssdev->type = OMAP_DISPLAY_TYPE_DPI; dssdev->type = OMAP_DISPLAY_TYPE_DPI;
dssdev->display = true;
dssdev->owner = THIS_MODULE; dssdev->owner = THIS_MODULE;
dssdev->of_ports = BIT(0); dssdev->of_ports = BIT(0);
dssdev->ops_flags = OMAP_DSS_DEVICE_OP_MODES; dssdev->ops_flags = OMAP_DSS_DEVICE_OP_MODES;
......
...@@ -192,6 +192,7 @@ static int nec_8048_probe(struct spi_device *spi) ...@@ -192,6 +192,7 @@ static int nec_8048_probe(struct spi_device *spi)
dssdev->dev = &spi->dev; dssdev->dev = &spi->dev;
dssdev->ops = &nec_8048_ops; dssdev->ops = &nec_8048_ops;
dssdev->type = OMAP_DISPLAY_TYPE_DPI; dssdev->type = OMAP_DISPLAY_TYPE_DPI;
dssdev->display = true;
dssdev->owner = THIS_MODULE; dssdev->owner = THIS_MODULE;
dssdev->of_ports = BIT(0); dssdev->of_ports = BIT(0);
dssdev->ops_flags = OMAP_DSS_DEVICE_OP_MODES; dssdev->ops_flags = OMAP_DSS_DEVICE_OP_MODES;
......
...@@ -207,6 +207,7 @@ static int sharp_ls_probe(struct platform_device *pdev) ...@@ -207,6 +207,7 @@ static int sharp_ls_probe(struct platform_device *pdev)
dssdev->dev = &pdev->dev; dssdev->dev = &pdev->dev;
dssdev->ops = &sharp_ls_ops; dssdev->ops = &sharp_ls_ops;
dssdev->type = OMAP_DISPLAY_TYPE_DPI; dssdev->type = OMAP_DISPLAY_TYPE_DPI;
dssdev->display = true;
dssdev->owner = THIS_MODULE; dssdev->owner = THIS_MODULE;
dssdev->of_ports = BIT(0); dssdev->of_ports = BIT(0);
dssdev->ops_flags = OMAP_DSS_DEVICE_OP_MODES; dssdev->ops_flags = OMAP_DSS_DEVICE_OP_MODES;
......
...@@ -706,6 +706,7 @@ static int acx565akm_probe(struct spi_device *spi) ...@@ -706,6 +706,7 @@ static int acx565akm_probe(struct spi_device *spi)
dssdev->dev = &spi->dev; dssdev->dev = &spi->dev;
dssdev->ops = &acx565akm_ops; dssdev->ops = &acx565akm_ops;
dssdev->type = OMAP_DISPLAY_TYPE_SDI; dssdev->type = OMAP_DISPLAY_TYPE_SDI;
dssdev->display = true;
dssdev->owner = THIS_MODULE; dssdev->owner = THIS_MODULE;
dssdev->of_ports = BIT(0); dssdev->of_ports = BIT(0);
dssdev->ops_flags = OMAP_DSS_DEVICE_OP_MODES; dssdev->ops_flags = OMAP_DSS_DEVICE_OP_MODES;
......
...@@ -321,6 +321,7 @@ static int td028ttec1_panel_probe(struct spi_device *spi) ...@@ -321,6 +321,7 @@ static int td028ttec1_panel_probe(struct spi_device *spi)
dssdev->dev = &spi->dev; dssdev->dev = &spi->dev;
dssdev->ops = &td028ttec1_ops; dssdev->ops = &td028ttec1_ops;
dssdev->type = OMAP_DISPLAY_TYPE_DPI; dssdev->type = OMAP_DISPLAY_TYPE_DPI;
dssdev->display = true;
dssdev->owner = THIS_MODULE; dssdev->owner = THIS_MODULE;
dssdev->of_ports = BIT(0); dssdev->of_ports = BIT(0);
dssdev->ops_flags = OMAP_DSS_DEVICE_OP_MODES; dssdev->ops_flags = OMAP_DSS_DEVICE_OP_MODES;
......
...@@ -420,6 +420,7 @@ static int tpo_td043_probe(struct spi_device *spi) ...@@ -420,6 +420,7 @@ static int tpo_td043_probe(struct spi_device *spi)
dssdev->dev = &spi->dev; dssdev->dev = &spi->dev;
dssdev->ops = &tpo_td043_ops; dssdev->ops = &tpo_td043_ops;
dssdev->type = OMAP_DISPLAY_TYPE_DPI; dssdev->type = OMAP_DISPLAY_TYPE_DPI;
dssdev->display = true;
dssdev->owner = THIS_MODULE; dssdev->owner = THIS_MODULE;
dssdev->of_ports = BIT(0); dssdev->of_ports = BIT(0);
dssdev->ops_flags = OMAP_DSS_DEVICE_OP_MODES; dssdev->ops_flags = OMAP_DSS_DEVICE_OP_MODES;
......
...@@ -207,7 +207,7 @@ void omapdss_device_disconnect(struct omap_dss_device *src, ...@@ -207,7 +207,7 @@ void omapdss_device_disconnect(struct omap_dss_device *src,
dev_dbg(dst->dev, "disconnect\n"); dev_dbg(dst->dev, "disconnect\n");
if (!dst->id && !omapdss_device_is_connected(dst)) { if (!dst->id && !omapdss_device_is_connected(dst)) {
WARN_ON(dst->output_type); WARN_ON(!dst->display);
return; return;
} }
......
...@@ -634,7 +634,7 @@ static int dpi_init_output_port(struct dpi_data *dpi, struct device_node *port) ...@@ -634,7 +634,7 @@ static int dpi_init_output_port(struct dpi_data *dpi, struct device_node *port)
out->dev = &dpi->pdev->dev; out->dev = &dpi->pdev->dev;
out->id = OMAP_DSS_OUTPUT_DPI; 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->dispc_channel = dpi_get_channel(dpi);
out->of_ports = BIT(port_num); out->of_ports = BIT(port_num);
out->ops = &dpi_ops; out->ops = &dpi_ops;
......
...@@ -5121,7 +5121,7 @@ static int dsi_init_output(struct dsi_data *dsi) ...@@ -5121,7 +5121,7 @@ static int dsi_init_output(struct dsi_data *dsi)
out->id = dsi->module_id == 0 ? out->id = dsi->module_id == 0 ?
OMAP_DSS_OUTPUT_DSI1 : OMAP_DSS_OUTPUT_DSI2; 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->name = dsi->module_id == 0 ? "dsi.0" : "dsi.1";
out->dispc_channel = dsi_get_channel(dsi); out->dispc_channel = dsi_get_channel(dsi);
out->ops = &dsi_ops; out->ops = &dsi_ops;
......
...@@ -679,7 +679,7 @@ static int hdmi4_init_output(struct omap_hdmi *hdmi) ...@@ -679,7 +679,7 @@ static int hdmi4_init_output(struct omap_hdmi *hdmi)
out->dev = &hdmi->pdev->dev; out->dev = &hdmi->pdev->dev;
out->id = OMAP_DSS_OUTPUT_HDMI; out->id = OMAP_DSS_OUTPUT_HDMI;
out->output_type = OMAP_DISPLAY_TYPE_HDMI; out->type = OMAP_DISPLAY_TYPE_HDMI;
out->name = "hdmi.0"; out->name = "hdmi.0";
out->dispc_channel = OMAP_DSS_CHANNEL_DIGIT; out->dispc_channel = OMAP_DSS_CHANNEL_DIGIT;
out->ops = &hdmi_ops; out->ops = &hdmi_ops;
......
...@@ -663,7 +663,7 @@ static int hdmi5_init_output(struct omap_hdmi *hdmi) ...@@ -663,7 +663,7 @@ static int hdmi5_init_output(struct omap_hdmi *hdmi)
out->dev = &hdmi->pdev->dev; out->dev = &hdmi->pdev->dev;
out->id = OMAP_DSS_OUTPUT_HDMI; out->id = OMAP_DSS_OUTPUT_HDMI;
out->output_type = OMAP_DISPLAY_TYPE_HDMI; out->type = OMAP_DISPLAY_TYPE_HDMI;
out->name = "hdmi.0"; out->name = "hdmi.0";
out->dispc_channel = OMAP_DSS_CHANNEL_DIGIT; out->dispc_channel = OMAP_DSS_CHANNEL_DIGIT;
out->ops = &hdmi_ops; out->ops = &hdmi_ops;
......
...@@ -413,14 +413,18 @@ struct omap_dss_device { ...@@ -413,14 +413,18 @@ struct omap_dss_device {
struct list_head list; 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; enum omap_display_type type;
/* /*
* DSS output type that this device generates (for DSS internal devices) * True if the device is a display (panel or connector) at the end of
* or requires (for external encoders). Must be OMAP_DISPLAY_TYPE_NONE * the pipeline, false otherwise.
* for display devices (connectors and panels) and to non-zero value for
* all other devices.
*/ */
enum omap_display_type output_type; bool display;
const char *name; const char *name;
......
...@@ -33,7 +33,7 @@ int omapdss_device_init_output(struct omap_dss_device *out) ...@@ -33,7 +33,7 @@ int omapdss_device_init_output(struct omap_dss_device *out)
return PTR_ERR(out->next); 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"); dev_err(out->dev, "output type and display type don't match\n");
return -EINVAL; return -EINVAL;
} }
......
...@@ -272,7 +272,7 @@ static int sdi_init_output(struct sdi_device *sdi) ...@@ -272,7 +272,7 @@ static int sdi_init_output(struct sdi_device *sdi)
out->dev = &sdi->pdev->dev; out->dev = &sdi->pdev->dev;
out->id = OMAP_DSS_OUTPUT_SDI; out->id = OMAP_DSS_OUTPUT_SDI;
out->output_type = OMAP_DISPLAY_TYPE_SDI; out->type = OMAP_DISPLAY_TYPE_SDI;
out->name = "sdi.0"; out->name = "sdi.0";
out->dispc_channel = OMAP_DSS_CHANNEL_LCD; out->dispc_channel = OMAP_DSS_CHANNEL_LCD;
/* We have SDI only on OMAP3, where it's on port 1 */ /* We have SDI only on OMAP3, where it's on port 1 */
......
...@@ -760,7 +760,7 @@ static int venc_init_output(struct venc_device *venc) ...@@ -760,7 +760,7 @@ static int venc_init_output(struct venc_device *venc)
out->dev = &venc->pdev->dev; out->dev = &venc->pdev->dev;
out->id = OMAP_DSS_OUTPUT_VENC; out->id = OMAP_DSS_OUTPUT_VENC;
out->output_type = OMAP_DISPLAY_TYPE_VENC; out->type = OMAP_DISPLAY_TYPE_VENC;
out->name = "venc.0"; out->name = "venc.0";
out->dispc_channel = OMAP_DSS_CHANNEL_DIGIT; out->dispc_channel = OMAP_DSS_CHANNEL_DIGIT;
out->ops = &venc_ops; out->ops = &venc_ops;
......
...@@ -128,7 +128,7 @@ static void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable) ...@@ -128,7 +128,7 @@ static void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable)
if (WARN_ON(omap_crtc->enabled == enable)) if (WARN_ON(omap_crtc->enabled == enable))
return; 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); priv->dispc_ops->mgr_enable(priv->dispc, channel, enable);
omap_crtc->enabled = enable; omap_crtc->enabled = enable;
return; return;
......
...@@ -138,7 +138,7 @@ static void omap_encoder_mode_set(struct drm_encoder *encoder, ...@@ -138,7 +138,7 @@ static void omap_encoder_mode_set(struct drm_encoder *encoder,
} }
/* Set the HDMI mode and HDMI infoframe if applicable. */ /* 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); omap_encoder_hdmi_mode_set(encoder, adjusted_mode);
} }
...@@ -161,7 +161,7 @@ static void omap_encoder_disable(struct drm_encoder *encoder) ...@@ -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 * DSI is treated as an exception as DSI pipelines still use the legacy
* flow where the pipeline output controls the encoder. * 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->ops->disable(dssdev);
dssdev->state = OMAP_DSS_DISPLAY_DISABLED; dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
} }
...@@ -189,7 +189,7 @@ static void omap_encoder_enable(struct drm_encoder *encoder) ...@@ -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 * DSI is treated as an exception as DSI pipelines still use the legacy
* flow where the pipeline output controls the encoder. * 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->ops->enable(dssdev);
dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment