]> git.openfabrics.org - ~emulex/infiniband.git/commitdiff
OMAPDSS: Create links between managers, outputs and devices
authorArchit Taneja <archit@ti.com>
Mon, 10 Sep 2012 09:04:16 +0000 (14:34 +0530)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Wed, 26 Sep 2012 11:58:33 +0000 (14:58 +0300)
Links between DSS entities are made in dss_init_connections() when a panel
device is registered, and are removed in dss_uninit_connections() when the
device is unregistered. Modify these functions to incorporate the addition of
outputs.

The fields in omap_dss_device struct gives information on which output and
manager to connect to. The desired manager and output pointers are retrieved and
prepared to form the desired links. The output is linked to the device, and then
the manager to the output.

A helper function omapdss_get_output_from_device() is created to retrieve the
output from the display by checking it's type, and the module id in case of DSI.

Signed-off-by: Archit Taneja <archit@ti.com>
drivers/video/omap2/dss/display.c
drivers/video/omap2/dss/dss.h
drivers/video/omap2/dss/output.c

index db83ae81a713820108e3551a3e1dcb37cf06a23e..ccf8550fafdedf5440a5fc6e585b7cf8d02f2b0d 100644 (file)
@@ -327,22 +327,35 @@ EXPORT_SYMBOL(omapdss_default_get_timings);
  */
 static int dss_init_connections(struct omap_dss_device *dssdev, bool force)
 {
+       struct omap_dss_output *out;
        struct omap_overlay_manager *mgr;
        int i, r;
 
-       WARN_ON(dssdev->manager);
+       out = omapdss_get_output_from_dssdev(dssdev);
+
+       WARN_ON(dssdev->output);
+       WARN_ON(out->device);
+
+       r = omapdss_output_set_device(out, dssdev);
+       if (r) {
+               DSSERR("failed to connect output to new device\n");
+               return r;
+       }
 
        mgr = omap_dss_get_overlay_manager(dssdev->channel);
 
-       if (mgr->device && !force)
+       if (mgr->output && !force)
                return 0;
 
-       if (mgr->device)
-               mgr->unset_device(mgr);
+       if (mgr->output)
+               mgr->unset_output(mgr);
 
-       r = mgr->set_device(mgr, dssdev);
+       r = mgr->set_output(mgr, out);
        if (r) {
-               DSSERR("failed to set initial manager\n");
+               DSSERR("failed to connect manager to output of new device\n");
+
+               /* remove the output-device connection we just made */
+               omapdss_output_unset_device(out);
                return r;
        }
 
@@ -366,8 +379,14 @@ static int dss_init_connections(struct omap_dss_device *dssdev, bool force)
 
 static void dss_uninit_connections(struct omap_dss_device *dssdev)
 {
-       if (dssdev->manager)
-               dssdev->manager->unset_device(dssdev->manager);
+       if (dssdev->output) {
+               struct omap_overlay_manager *mgr = dssdev->output->manager;
+
+               if (mgr)
+                       mgr->unset_output(mgr);
+
+               omapdss_output_unset_device(dssdev->output);
+       }
 }
 
 int dss_init_device(struct platform_device *pdev,
index b5c0df43547f49ba289c98c1ce9bb7e9716164a4..a14528bcfeabc45ebe7ea16c1e95975bd7ae42a1 100644 (file)
@@ -232,6 +232,7 @@ int dss_ovl_unset_manager(struct omap_overlay *ovl);
 /* output */
 void dss_register_output(struct omap_dss_output *out);
 void dss_unregister_output(struct omap_dss_output *out);
+struct omap_dss_output *omapdss_get_output_from_dssdev(struct omap_dss_device *dssdev);
 
 /* display */
 int dss_suspend_all_devices(void);
index 1a84b79d5580c1d27e3aeebabf25b556fdbaa281..813f26682b7a836f127449517f9ed82dd2c33dac 100644 (file)
@@ -113,3 +113,36 @@ struct omap_dss_output *omap_dss_get_output(enum omap_dss_output_id id)
 
        return NULL;
 }
+
+struct omap_dss_output *omapdss_get_output_from_dssdev(struct omap_dss_device *dssdev)
+{
+       struct omap_dss_output *out = NULL;
+       enum omap_dss_output_id id;
+
+       switch (dssdev->type) {
+       case OMAP_DISPLAY_TYPE_DPI:
+               out = omap_dss_get_output(OMAP_DSS_OUTPUT_DPI);
+               break;
+       case OMAP_DISPLAY_TYPE_DBI:
+               out = omap_dss_get_output(OMAP_DSS_OUTPUT_DBI);
+               break;
+       case OMAP_DISPLAY_TYPE_SDI:
+               out = omap_dss_get_output(OMAP_DSS_OUTPUT_SDI);
+               break;
+       case OMAP_DISPLAY_TYPE_VENC:
+               out = omap_dss_get_output(OMAP_DSS_OUTPUT_VENC);
+               break;
+       case OMAP_DISPLAY_TYPE_HDMI:
+               out = omap_dss_get_output(OMAP_DSS_OUTPUT_HDMI);
+               break;
+       case OMAP_DISPLAY_TYPE_DSI:
+               id = dssdev->phy.dsi.module == 0 ? OMAP_DSS_OUTPUT_DSI1 :
+                                       OMAP_DSS_OUTPUT_DSI2;
+               out = omap_dss_get_output(id);
+               break;
+       default:
+               break;
+       }
+
+       return out;
+}