Commit 6a7c5a22 authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Tomi Valkeinen

drm/omap: dss: Create global list of all omap_dss_device instances

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: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: default avatarSebastian Reichel <sebastian.reichel@collabora.co.uk>
Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
parent 7e7a0ede
......@@ -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;
......
......@@ -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);
......
......@@ -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)
......
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment