OMAPDSS: add output->dispc_channel
authorTomi Valkeinen <tomi.valkeinen@ti.com>
Wed, 13 Feb 2013 09:23:54 +0000 (11:23 +0200)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Wed, 3 Apr 2013 12:19:01 +0000 (15:19 +0300)
The DISPC channel used for each output is currently passed in panel
platform data from the board files.

To simplify this, and to make the panel drivers less dependent on OMAP,
this patch changes omapdss to resolve the channel independently. The
channel is resolved based on the OMAP version and, in case of DSI, the
DSI module id. This resolved channel is stored into a new field in
output, dispc_channel.

The few places where dssdev->channel was used are changed to use
output->recommended_channel. After this patch, dssdev->channel is
obsolete.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Reviewed-by: Archit Taneja <archit@ti.com>
drivers/video/omap2/dss/dpi.c
drivers/video/omap2/dss/dsi.c
drivers/video/omap2/dss/hdmi.c
drivers/video/omap2/dss/rfbi.c
drivers/video/omap2/dss/sdi.c
drivers/video/omap2/dss/venc.c
drivers/video/omap2/omapfb/omapfb-main.c
include/video/omapdss.h

index e393b6ab60db9cfc0bf4c84d6b38e11d988a5f07..ab6d8b0e94c78fa1a668a617f944d5acf6493b06 100644 (file)
@@ -396,6 +396,36 @@ static int __init dpi_verify_dsi_pll(struct platform_device *dsidev)
        return 0;
 }
 
+/*
+ * Return a hardcoded channel for the DPI output. This should work for
+ * current use cases, but this can be later expanded to either resolve
+ * the channel in some more dynamic manner, or get the channel as a user
+ * parameter.
+ */
+static enum omap_channel dpi_get_channel(void)
+{
+       switch (omapdss_get_version()) {
+       case OMAPDSS_VER_OMAP24xx:
+       case OMAPDSS_VER_OMAP34xx_ES1:
+       case OMAPDSS_VER_OMAP34xx_ES3:
+       case OMAPDSS_VER_OMAP3630:
+       case OMAPDSS_VER_AM35xx:
+               return OMAP_DSS_CHANNEL_LCD;
+
+       case OMAPDSS_VER_OMAP4430_ES1:
+       case OMAPDSS_VER_OMAP4430_ES2:
+       case OMAPDSS_VER_OMAP4:
+               return OMAP_DSS_CHANNEL_LCD2;
+
+       case OMAPDSS_VER_OMAP5:
+               return OMAP_DSS_CHANNEL_LCD3;
+
+       default:
+               DSSWARN("unsupported DSS version\n");
+               return OMAP_DSS_CHANNEL_LCD;
+       }
+}
+
 static int __init dpi_init_display(struct omap_dss_device *dssdev)
 {
        struct platform_device *dsidev;
@@ -416,12 +446,7 @@ static int __init dpi_init_display(struct omap_dss_device *dssdev)
                dpi.vdds_dsi_reg = vdds_dsi;
        }
 
-       /*
-        * XXX We shouldn't need dssdev->channel for this. The dsi pll clock
-        * source for DPI is SoC integration detail, not something that should
-        * be configured in the dssdev
-        */
-       dsidev = dpi_get_dsidev(dssdev->channel);
+       dsidev = dpi_get_dsidev(dpi.output.dispc_channel);
 
        if (dsidev && dpi_verify_dsi_pll(dsidev)) {
                dsidev = NULL;
@@ -513,6 +538,7 @@ static void __init dpi_init_output(struct platform_device *pdev)
        out->id = OMAP_DSS_OUTPUT_DPI;
        out->type = OMAP_DISPLAY_TYPE_DPI;
        out->name = "dpi.0";
+       out->dispc_channel = dpi_get_channel();
 
        dss_register_output(out);
 }
index 294c83299cea46fe9528e1fcbdf94c43764c8035..d13e77c01d7eeb6f39cebc55774637ad19d3c67b 100644 (file)
@@ -4946,6 +4946,55 @@ void omapdss_dsi_set_videomode_timings(struct omap_dss_device *dssdev,
 }
 EXPORT_SYMBOL(omapdss_dsi_set_videomode_timings);
 
+/*
+ * Return a hardcoded channel for the DSI output. This should work for
+ * current use cases, but this can be later expanded to either resolve
+ * the channel in some more dynamic manner, or get the channel as a user
+ * parameter.
+ */
+static enum omap_channel dsi_get_channel(int module_id)
+{
+       switch (omapdss_get_version()) {
+       case OMAPDSS_VER_OMAP24xx:
+               DSSWARN("DSI not supported\n");
+               return OMAP_DSS_CHANNEL_LCD;
+
+       case OMAPDSS_VER_OMAP34xx_ES1:
+       case OMAPDSS_VER_OMAP34xx_ES3:
+       case OMAPDSS_VER_OMAP3630:
+       case OMAPDSS_VER_AM35xx:
+               return OMAP_DSS_CHANNEL_LCD;
+
+       case OMAPDSS_VER_OMAP4430_ES1:
+       case OMAPDSS_VER_OMAP4430_ES2:
+       case OMAPDSS_VER_OMAP4:
+               switch (module_id) {
+               case 0:
+                       return OMAP_DSS_CHANNEL_LCD;
+               case 1:
+                       return OMAP_DSS_CHANNEL_LCD2;
+               default:
+                       DSSWARN("unsupported module id\n");
+                       return OMAP_DSS_CHANNEL_LCD;
+               }
+
+       case OMAPDSS_VER_OMAP5:
+               switch (module_id) {
+               case 0:
+                       return OMAP_DSS_CHANNEL_LCD;
+               case 1:
+                       return OMAP_DSS_CHANNEL_LCD3;
+               default:
+                       DSSWARN("unsupported module id\n");
+                       return OMAP_DSS_CHANNEL_LCD;
+               }
+
+       default:
+               DSSWARN("unsupported DSS version\n");
+               return OMAP_DSS_CHANNEL_LCD;
+       }
+}
+
 static int __init dsi_init_display(struct omap_dss_device *dssdev)
 {
        struct platform_device *dsidev =
@@ -5184,6 +5233,7 @@ static void __init dsi_init_output(struct platform_device *dsidev)
 
        out->type = OMAP_DISPLAY_TYPE_DSI;
        out->name = dsi->module_id == 0 ? "dsi.0" : "dsi.1";
+       out->dispc_channel = dsi_get_channel(dsi->module_id);
 
        dss_register_output(out);
 }
index 9cbca03eff436535661cfb75afbe0ea0d34bd38b..a6f953898d94621530cc7301de482ad9045acdc8 100644 (file)
@@ -1012,8 +1012,6 @@ static void __init hdmi_probe_pdata(struct platform_device *pdev)
        hdmi.ls_oe_gpio = priv->ls_oe_gpio;
        hdmi.hpd_gpio = priv->hpd_gpio;
 
-       dssdev->channel = OMAP_DSS_CHANNEL_DIGIT;
-
        r = hdmi_init_display(dssdev);
        if (r) {
                DSSERR("device %s init failed: %d\n", dssdev->name, r);
@@ -1047,6 +1045,7 @@ static void __init hdmi_init_output(struct platform_device *pdev)
        out->id = OMAP_DSS_OUTPUT_HDMI;
        out->type = OMAP_DISPLAY_TYPE_HDMI;
        out->name = "hdmi.0";
+       out->dispc_channel = OMAP_DSS_CHANNEL_DIGIT;
 
        dss_register_output(out);
 }
index d9d7f3511a7ba1b424602b809ae13aaf1dba2af2..1a691bb27547f3f8c5ebff21cf51063e7053fa0d 100644 (file)
@@ -1026,6 +1026,7 @@ static void __init rfbi_init_output(struct platform_device *pdev)
        out->id = OMAP_DSS_OUTPUT_DBI;
        out->type = OMAP_DISPLAY_TYPE_DBI;
        out->name = "rfbi.0";
+       out->dispc_channel = OMAP_DSS_CHANNEL_LCD;
 
        dss_register_output(out);
 }
index c27b58ad8e4d547887ddec169ce5a064e07bc789..3888cfa0881cdc528a107b7665194e8096fcaf46 100644 (file)
@@ -279,6 +279,7 @@ static void __init sdi_init_output(struct platform_device *pdev)
        out->id = OMAP_DSS_OUTPUT_SDI;
        out->type = OMAP_DISPLAY_TYPE_SDI;
        out->name = "sdi.0";
+       out->dispc_channel = OMAP_DSS_CHANNEL_LCD;
 
        dss_register_output(out);
 }
index 4c07a25d3d9b952285614f12d89dc82dee447294..5cb983e2f1704327ddfb0e462460ba276dd52957 100644 (file)
@@ -786,8 +786,6 @@ static void __init venc_probe_pdata(struct platform_device *vencdev)
 
        dss_copy_device_pdata(dssdev, plat_dssdev);
 
-       dssdev->channel = OMAP_DSS_CHANNEL_DIGIT;
-
        r = venc_init_display(dssdev);
        if (r) {
                DSSERR("device %s init failed: %d\n", dssdev->name, r);
@@ -820,6 +818,7 @@ static void __init venc_init_output(struct platform_device *pdev)
        out->id = OMAP_DSS_OUTPUT_VENC;
        out->type = OMAP_DISPLAY_TYPE_VENC;
        out->name = "venc.0";
+       out->dispc_channel = OMAP_DSS_CHANNEL_DIGIT;
 
        dss_register_output(out);
 }
index ca585ef37f2528d36d0534200a911db95b07baff..f38348ea33757eac5ed3af01e1145e8b246c721a 100644 (file)
@@ -2388,7 +2388,7 @@ static int omapfb_init_connections(struct omapfb2_device *fbdev,
                struct omap_dss_device *dssdev = fbdev->displays[i].dssdev;
                struct omap_dss_output *out = dssdev->output;
 
-               mgr = omap_dss_get_overlay_manager(dssdev->channel);
+               mgr = omap_dss_get_overlay_manager(out->dispc_channel);
 
                if (!mgr || !out)
                        continue;
index fa800b7ef8328d607b12a91ced645ed6ba51de4a..41fb434093e906413e4defd786cd99c8588ff6e5 100644 (file)
@@ -546,6 +546,9 @@ struct omap_dss_output {
        /* display type supported by the output */
        enum omap_display_type type;
 
+       /* DISPC channel for this output */
+       enum omap_channel dispc_channel;
+
        /* output instance */
        enum omap_dss_output_id id;
 
@@ -563,6 +566,7 @@ struct omap_dss_device {
 
        enum omap_display_type type;
 
+       /* obsolete, to be removed */
        enum omap_channel channel;
 
        union {