drm/omap: dss: Fix output next device lookup in DT
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Wed, 26 Feb 2020 11:24:45 +0000 (13:24 +0200)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Wed, 26 Feb 2020 11:31:48 +0000 (13:31 +0200)
The DSS core looks up the next device connected to an output by
traversing the OF graph. It currently hardcodes the local port number to
0, which breaks any output with a different port number (SDI on OMAP3
and any DPI output but the first one). Fix this by repurposing the
currently unused of_ports bitmask in omap_dss_device with an of_port
output port number, and use it to traverse the OF graph.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Tested-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200226112514.12455-26-laurent.pinchart@ideasonboard.com
13 files changed:
drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
drivers/gpu/drm/omapdrm/displays/encoder-opa362.c
drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c
drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.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

index 0d20fab605d71d35f96c8ec9ffb57c616cdf2d94..f36aa1885d39a07c9a256d0f995fa90f10207ddf 100644 (file)
@@ -55,7 +55,7 @@ static int tvc_probe(struct platform_device *pdev)
        dssdev->type = OMAP_DISPLAY_TYPE_VENC;
        dssdev->display = true;
        dssdev->owner = THIS_MODULE;
-       dssdev->of_ports = BIT(0);
+       dssdev->of_port = 0;
 
        omapdss_display_init(dssdev);
        omapdss_device_register(dssdev);
index f5d69d810bb81a45a80c8a08fd8761631b75811a..37c212491cd3e7bbce39d70ffc3cad455608e9e2 100644 (file)
@@ -139,7 +139,7 @@ static int hdmic_probe(struct platform_device *pdev)
        dssdev->type = OMAP_DISPLAY_TYPE_HDMI;
        dssdev->display = true;
        dssdev->owner = THIS_MODULE;
-       dssdev->of_ports = BIT(0);
+       dssdev->of_port = 0;
        dssdev->ops_flags = ddata->hpd_gpio
                          ? OMAP_DSS_DEVICE_OP_DETECT | OMAP_DSS_DEVICE_OP_HPD
                          : 0;
index b992387ed67480e00ceaaf0ddf668588e82fd33e..252705222ef1de4642a0f5ddbff6e7434187756f 100644 (file)
@@ -86,7 +86,7 @@ static int opa362_probe(struct platform_device *pdev)
        dssdev->dev = &pdev->dev;
        dssdev->type = OMAP_DISPLAY_TYPE_VENC;
        dssdev->owner = THIS_MODULE;
-       dssdev->of_ports = BIT(1) | BIT(0);
+       dssdev->of_port = 1;
 
        dssdev->next = omapdss_of_find_connected_device(pdev->dev.of_node, 1);
        if (IS_ERR(dssdev->next)) {
index 089105c5aa0a02de04b41456c507228ee699b814..857ae84cd7d17512fa7243a04c0693ce04e67afc 100644 (file)
@@ -165,7 +165,7 @@ static int tpd_probe(struct platform_device *pdev)
        dssdev->dev = &pdev->dev;
        dssdev->type = OMAP_DISPLAY_TYPE_HDMI;
        dssdev->owner = THIS_MODULE;
-       dssdev->of_ports = BIT(1) | BIT(0);
+       dssdev->of_port = 1;
        dssdev->ops_flags = OMAP_DSS_DEVICE_OP_DETECT
                          | OMAP_DSS_DEVICE_OP_HPD;
 
index 3ec6a55e932a59d86654b1243cd9a04905345f28..3484b5d4a91cebd20f129d7a431d4e6c5374bd0a 100644 (file)
@@ -1265,7 +1265,7 @@ static int dsicm_probe(struct platform_device *pdev)
        dssdev->type = OMAP_DISPLAY_TYPE_DSI;
        dssdev->display = true;
        dssdev->owner = THIS_MODULE;
-       dssdev->of_ports = BIT(0);
+       dssdev->of_port = 0;
        dssdev->ops_flags = OMAP_DSS_DEVICE_OP_MODES;
 
        dssdev->caps = OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE |
index 95147437b990a16daa5840db48f315bc96271672..462ed6f3118ab8d315452b73c8727091126e8a2c 100644 (file)
@@ -625,7 +625,7 @@ static int dpi_init_output_port(struct dpi_data *dpi, struct device_node *port)
        out->id = OMAP_DSS_OUTPUT_DPI;
        out->type = OMAP_DISPLAY_TYPE_DPI;
        out->dispc_channel = dpi_get_channel(dpi);
-       out->of_ports = BIT(port_num);
+       out->of_port = port_num;
        out->ops = &dpi_ops;
        out->owner = THIS_MODULE;
 
index da16ea095f13a8747a91e2d4d58a99485c7ac15f..6379eea124d1ba9e8e9421b2857aff76636c572c 100644 (file)
@@ -5116,7 +5116,7 @@ static int dsi_init_output(struct dsi_data *dsi)
        out->dispc_channel = dsi_get_channel(dsi);
        out->ops = &dsi_ops;
        out->owner = THIS_MODULE;
-       out->of_ports = BIT(0);
+       out->of_port = 0;
        out->bus_flags = DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE
                       | DRM_BUS_FLAG_DE_HIGH
                       | DRM_BUS_FLAG_SYNC_DRIVE_NEGEDGE;
index 0f557fad4513fcde267510b1a887bac8192fc3c6..44075718407b38de889d567f668e37677899d9ba 100644 (file)
@@ -673,7 +673,7 @@ static int hdmi4_init_output(struct omap_hdmi *hdmi)
        out->dispc_channel = OMAP_DSS_CHANNEL_DIGIT;
        out->ops = &hdmi_ops;
        out->owner = THIS_MODULE;
-       out->of_ports = BIT(0);
+       out->of_port = 0;
        out->ops_flags = OMAP_DSS_DEVICE_OP_EDID;
 
        r = omapdss_device_init_output(out);
index d9463b332554368f111c549da87751587500bdf9..1b5bd44ee09d04168fc0f66a94ee06808d577f6e 100644 (file)
@@ -657,7 +657,7 @@ static int hdmi5_init_output(struct omap_hdmi *hdmi)
        out->dispc_channel = OMAP_DSS_CHANNEL_DIGIT;
        out->ops = &hdmi_ops;
        out->owner = THIS_MODULE;
-       out->of_ports = BIT(0);
+       out->of_port = 0;
        out->ops_flags = OMAP_DSS_DEVICE_OP_EDID;
 
        r = omapdss_device_init_output(out);
index c5672e5174c56f6c10da2987083ae86cc6058baf..b48a51d113104ea994da7385796307061d4fc430 100644 (file)
@@ -436,8 +436,8 @@ struct omap_dss_device {
        /* output instance */
        enum omap_dss_output_id id;
 
-       /* bitmask of port numbers in DT */
-       unsigned int of_ports;
+       /* port number in DT */
+       unsigned int of_port;
 };
 
 struct omap_dss_driver {
index 99a253a424c148c28f4084b411af0c44140586a0..c1ec9d343e53113ee07a6d75ca9628e7e79fdfe8 100644 (file)
@@ -4,7 +4,6 @@
  * Author: Archit Taneja <archit@ti.com>
  */
 
-#include <linux/bitops.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
@@ -24,7 +23,7 @@ int omapdss_device_init_output(struct omap_dss_device *out)
        int ret;
 
        remote_node = of_graph_get_remote_node(out->dev->of_node,
-                                              ffs(out->of_ports) - 1, 0);
+                                              out->of_port, 0);
        if (!remote_node) {
                dev_dbg(out->dev, "failed to find video sink\n");
                return 0;
index 3b447c01fa2a9999330bc3eb1a9f5c1f9ce4ba4c..9092ed3d0ef150a60b239a59c86ff7c594e29a9c 100644 (file)
@@ -265,7 +265,7 @@ static int sdi_init_output(struct sdi_device *sdi)
        out->name = "sdi.0";
        out->dispc_channel = OMAP_DSS_CHANNEL_LCD;
        /* We have SDI only on OMAP3, where it's on port 1 */
-       out->of_ports = BIT(1);
+       out->of_port = 1;
        out->ops = &sdi_ops;
        out->owner = THIS_MODULE;
        out->bus_flags = DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE     /* 15.5.9.1.2 */
index 596a297d58139f1f186bc93dd99293ed50967e62..e2f480f689b8baad534a149283f1f7e12203dc29 100644 (file)
@@ -754,7 +754,7 @@ static int venc_init_output(struct venc_device *venc)
        out->dispc_channel = OMAP_DSS_CHANNEL_DIGIT;
        out->ops = &venc_ops;
        out->owner = THIS_MODULE;
-       out->of_ports = BIT(0);
+       out->of_port = 0;
        out->ops_flags = OMAP_DSS_DEVICE_OP_MODES;
 
        r = omapdss_device_init_output(out);