]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
drm/omap: dss: Create global list of all omap_dss_device instances
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Wed, 28 Feb 2018 21:49:24 +0000 (23:49 +0200)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Mon, 3 Sep 2018 13:13:25 +0000 (16:13 +0300)
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@ideasonboard.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
drivers/gpu/drm/omapdrm/dss/base.c
drivers/gpu/drm/omapdrm/dss/display.c
drivers/gpu/drm/omapdrm/dss/omapdss.h
drivers/gpu/drm/omapdrm/dss/output.c

index 99e8cb8dc65bfbbc3c0f516625391b7189176d58..18b72d7c717a7b6e2f37b3e69c9d12be7228a1b6 100644 (file)
  */
 
 #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;
index 752c9811c73a4463bd3b11fa94205bddcd156e43..f0f9239f09d1be6294d2c01f121c948d31328115 100644 (file)
@@ -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);
 
index abf101bb27ea04499b3b62a57ab2832df0a08bd6..e029613509a19218edc6460505e9db99b6d6db63 100644 (file)
@@ -450,6 +450,7 @@ struct omap_dss_device {
 
        struct module *owner;
 
+       struct list_head list;
        struct list_head panel_list;
 
        unsigned int alias_id;
@@ -560,6 +561,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)
index 0fcd13ea8824f87d578ef89f7e27a755f0dc619a..1a2d24906edd5786281af4d7c3f8caef1cb6863e 100644 (file)
@@ -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);