OMAPDSS: add panel list
authorTomi Valkeinen <tomi.valkeinen@ti.com>
Fri, 16 Nov 2012 13:45:26 +0000 (15:45 +0200)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Mon, 17 Jun 2013 11:00:48 +0000 (14:00 +0300)
We currently use the omapdss bus (which contains all the available
displays) to iterate the displays. As the omapdss bus is on its way out,
this needs to be changed.

Instead of using the dss bus to iterate displays, this patch adds our
own list of displays which we manage. The panels on the dss bus are
automatically added to this new list.

An "alias" field is also added to omap_dss_device. This field is
set to "display%d", the same way as omap_dss_device's dev name is set.
This alias is later used to keep backward compatibility, when the
embedded dev is no longer used.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
drivers/video/omap2/dss/core.c
drivers/video/omap2/dss/display.c
include/video/omapdss.h

index 7b2df2ff5667f833b390169b2ffe75fb97e31a86..17b52343f74caf743356b2b9aa9dad87e318a35d 100644 (file)
@@ -477,6 +477,7 @@ struct omap_dss_device *dss_alloc_and_init_device(struct device *parent)
 
 int dss_add_device(struct omap_dss_device *dssdev)
 {
+       omapdss_register_display(dssdev);
        return device_add(&dssdev->dev);
 }
 
@@ -488,6 +489,7 @@ void dss_put_device(struct omap_dss_device *dssdev)
 void dss_unregister_device(struct omap_dss_device *dssdev)
 {
        device_unregister(&dssdev->dev);
+       omapdss_unregister_display(dssdev);
 }
 
 static int dss_unregister_dss_dev(struct device *dev, void *data)
index 72ac058a56d3ca64617530db73c6ef88ffb9f00c..1c175a4e7f6bf2846d1bc0cb9a1d8ee783648e1a 100644 (file)
@@ -146,6 +146,38 @@ void dss_disable_all_devices(void)
        bus_for_each_dev(bus, NULL, NULL, dss_disable_device);
 }
 
+static LIST_HEAD(panel_list);
+static DEFINE_MUTEX(panel_list_mutex);
+static int disp_num_counter;
+
+int omapdss_register_display(struct omap_dss_device *dssdev)
+{
+       struct omap_dss_driver *drv = dssdev->driver;
+
+       snprintf(dssdev->alias, sizeof(dssdev->alias),
+                       "display%d", disp_num_counter++);
+
+       if (drv && drv->get_resolution == NULL)
+               drv->get_resolution = omapdss_default_get_resolution;
+       if (drv && drv->get_recommended_bpp == NULL)
+               drv->get_recommended_bpp = omapdss_default_get_recommended_bpp;
+       if (drv && drv->get_timings == NULL)
+               drv->get_timings = omapdss_default_get_timings;
+
+       mutex_lock(&panel_list_mutex);
+       list_add_tail(&dssdev->panel_list, &panel_list);
+       mutex_unlock(&panel_list_mutex);
+       return 0;
+}
+EXPORT_SYMBOL(omapdss_register_display);
+
+void omapdss_unregister_display(struct omap_dss_device *dssdev)
+{
+       mutex_lock(&panel_list_mutex);
+       list_del(&dssdev->panel_list);
+       mutex_unlock(&panel_list_mutex);
+}
+EXPORT_SYMBOL(omapdss_unregister_display);
 
 void omap_dss_get_device(struct omap_dss_device *dssdev)
 {
index 0324c7b8a3e06a9d0950cd4e6588393aadbe77a4..ee1645336fc484a9cbaa4eb969ffcb2be516b8e2 100644 (file)
@@ -598,6 +598,11 @@ struct omap_dss_output {
 struct omap_dss_device {
        struct device dev;
 
+       struct list_head panel_list;
+
+       /* alias in the form of "display%d" */
+       char alias[16];
+
        enum omap_display_type type;
 
        /* obsolete, to be removed */
@@ -759,6 +764,9 @@ bool omapdss_is_initialized(void);
 int omap_dss_register_driver(struct omap_dss_driver *);
 void omap_dss_unregister_driver(struct omap_dss_driver *);
 
+int omapdss_register_display(struct omap_dss_device *dssdev);
+void omapdss_unregister_display(struct omap_dss_device *dssdev);
+
 void omap_dss_get_device(struct omap_dss_device *dssdev);
 void omap_dss_put_device(struct omap_dss_device *dssdev);
 #define for_each_dss_dev(d) while ((d = omap_dss_get_next_device(d)) != NULL)