[PATCH/RFC 15/60] drm/omap: dss: Create global list of all omap_dss_device instances

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The omap_dss_device instances are stored in two separate lists,
depending on whether they are panels or outputs. Create a third list
that stores all omap_dss_device instances to allow generic code to
operate on all instances.

Signed-off-by: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>
---
 drivers/gpu/drm/omapdrm/dss/base.c    | 45 ++++++++++++++++++++++++++++-------
 drivers/gpu/drm/omapdrm/dss/display.c |  4 ++++
 drivers/gpu/drm/omapdrm/dss/omapdss.h |  4 ++++
 drivers/gpu/drm/omapdrm/dss/output.c  |  2 ++
 4 files changed, 46 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/base.c b/drivers/gpu/drm/omapdrm/dss/base.c
index 99e8cb8dc65b..18b72d7c717a 100644
--- a/drivers/gpu/drm/omapdrm/dss/base.c
+++ b/drivers/gpu/drm/omapdrm/dss/base.c
@@ -14,24 +14,17 @@
  */
 
 #include <linux/kernel.h>
+#include <linux/list.h>
 #include <linux/module.h>
+#include <linux/mutex.h>
 #include <linux/of.h>
 #include <linux/of_graph.h>
-#include <linux/list.h>
 
 #include "dss.h"
 #include "omapdss.h"
 
 static struct dss_device *dss_device;
 
-static struct list_head omapdss_comp_list;
-
-struct omapdss_comp_node {
-	struct list_head list;
-	struct device_node *node;
-	bool dss_core_component;
-};
-
 struct dss_device *omapdss_get_dss(void)
 {
 	return dss_device;
@@ -56,6 +49,40 @@ const struct dispc_ops *dispc_get_ops(struct dss_device *dss)
 }
 EXPORT_SYMBOL(dispc_get_ops);
 
+
+/* -----------------------------------------------------------------------------
+ * OMAP DSS Devices Handling
+ */
+
+static LIST_HEAD(omapdss_devices_list);
+static DEFINE_MUTEX(omapdss_devices_lock);
+
+void omapdss_device_register(struct omap_dss_device *dssdev)
+{
+	mutex_lock(&omapdss_devices_lock);
+	list_add_tail(&dssdev->list, &omapdss_devices_list);
+	mutex_unlock(&omapdss_devices_lock);
+}
+
+void omapdss_device_unregister(struct omap_dss_device *dssdev)
+{
+	mutex_lock(&omapdss_devices_lock);
+	list_del(&dssdev->list);
+	mutex_unlock(&omapdss_devices_lock);
+}
+
+/* -----------------------------------------------------------------------------
+ * Components Handling
+ */
+
+static struct list_head omapdss_comp_list;
+
+struct omapdss_comp_node {
+	struct list_head list;
+	struct device_node *node;
+	bool dss_core_component;
+};
+
 static bool omapdss_list_contains(const struct device_node *node)
 {
 	struct omapdss_comp_node *comp;
diff --git a/drivers/gpu/drm/omapdrm/dss/display.c b/drivers/gpu/drm/omapdrm/dss/display.c
index e07e3319d6e0..eacbbf45f737 100644
--- a/drivers/gpu/drm/omapdrm/dss/display.c
+++ b/drivers/gpu/drm/omapdrm/dss/display.c
@@ -56,6 +56,8 @@ int omapdss_register_display(struct omap_dss_device *dssdev)
 	mutex_lock(&panel_list_mutex);
 	list_add_tail(&dssdev->panel_list, &panel_list);
 	mutex_unlock(&panel_list_mutex);
+
+	omapdss_device_register(dssdev);
 	return 0;
 }
 EXPORT_SYMBOL(omapdss_register_display);
@@ -65,6 +67,8 @@ void omapdss_unregister_display(struct omap_dss_device *dssdev)
 	mutex_lock(&panel_list_mutex);
 	list_del(&dssdev->panel_list);
 	mutex_unlock(&panel_list_mutex);
+
+	omapdss_device_register(dssdev);
 }
 EXPORT_SYMBOL(omapdss_unregister_display);
 
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 9f6c0385b7de..ddef6f39ca99 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -448,6 +448,7 @@ struct omap_dss_device {
 
 	struct module *owner;
 
+	struct list_head list;
 	struct list_head panel_list;
 
 	unsigned int alias_id;
@@ -558,6 +559,9 @@ static inline bool omapdss_is_initialized(void)
 int omapdss_register_display(struct omap_dss_device *dssdev);
 void omapdss_unregister_display(struct omap_dss_device *dssdev);
 
+void omapdss_device_register(struct omap_dss_device *dssdev);
+void omapdss_device_unregister(struct omap_dss_device *dssdev);
+
 struct omap_dss_device *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)
diff --git a/drivers/gpu/drm/omapdrm/dss/output.c b/drivers/gpu/drm/omapdrm/dss/output.c
index 0fcd13ea8824..1a2d24906edd 100644
--- a/drivers/gpu/drm/omapdrm/dss/output.c
+++ b/drivers/gpu/drm/omapdrm/dss/output.c
@@ -97,6 +97,7 @@ EXPORT_SYMBOL(omapdss_output_unset_device);
 int omapdss_register_output(struct omap_dss_device *out)
 {
 	list_add_tail(&out->output_list, &output_list);
+	omapdss_device_register(out);
 	return 0;
 }
 EXPORT_SYMBOL(omapdss_register_output);
@@ -104,6 +105,7 @@ EXPORT_SYMBOL(omapdss_register_output);
 void omapdss_unregister_output(struct omap_dss_device *out)
 {
 	list_del(&out->output_list);
+	omapdss_device_unregister(out);
 }
 EXPORT_SYMBOL(omapdss_unregister_output);
 
-- 
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux