Commit 72877cf3 authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Tomi Valkeinen

drm: omapdrm: dss: Store DSS device pointer in the omapdrm private data

The dss_device is the top-level component in the omapdss driver. Give
the omapdrm driver access to the dss_device pointer in order to obtain
pointers to all other components from it. This requires a new global
variable in the omapdss driver that will be removed when merging the
omapdrm and omapdss drivers, but will already allow removal of several
other global variables.

As this partly duplicates the omapdss_is_initialized() API, reimplement
it as an inline function wrapping omapdss_get_dss().
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: default avatarSebastian Reichel <sebastian.reichel@collabora.co.uk>
parent 64cb8179
......@@ -20,7 +20,7 @@
#include <linux/list.h>
#include "omapdss.h"
static bool dss_initialized;
static struct dss_device *dss_device;
static const struct dispc_ops *ops;
static struct list_head omapdss_comp_list;
......@@ -31,17 +31,17 @@ struct omapdss_comp_node {
bool dss_core_component;
};
void omapdss_set_is_initialized(bool set)
struct dss_device *omapdss_get_dss(void)
{
dss_initialized = set;
return dss_device;
}
EXPORT_SYMBOL(omapdss_set_is_initialized);
EXPORT_SYMBOL(omapdss_get_dss);
bool omapdss_is_initialized(void)
void omapdss_set_dss(struct dss_device *dss)
{
return dss_initialized;
dss_device = dss;
}
EXPORT_SYMBOL(omapdss_is_initialized);
EXPORT_SYMBOL(omapdss_set_dss);
void dispc_set_ops(const struct dispc_ops *o)
{
......
......@@ -1316,6 +1316,7 @@ static const struct soc_device_attribute dss_soc_devices[] = {
static int dss_bind(struct device *dev)
{
struct dss_device *dss = dev_get_drvdata(dev);
int r;
r = component_bind_all(dev, NULL);
......@@ -1325,14 +1326,14 @@ static int dss_bind(struct device *dev)
pm_set_vt_switch(0);
omapdss_gather_components(dev);
omapdss_set_is_initialized(true);
omapdss_set_dss(dss);
return 0;
}
static void dss_unbind(struct device *dev)
{
omapdss_set_is_initialized(false);
omapdss_set_dss(NULL);
component_unbind_all(dev, NULL);
}
......
......@@ -59,6 +59,7 @@
#define DISPC_IRQ_ACBIAS_COUNT_STAT3 (1 << 29)
#define DISPC_IRQ_FRAMEDONE3 (1 << 30)
struct dss_device;
struct omap_drm_private;
struct omap_dss_device;
struct dss_lcd_mgr_config;
......@@ -586,7 +587,12 @@ struct omap_dss_driver {
const struct hdmi_avi_infoframe *avi);
};
bool omapdss_is_initialized(void);
struct dss_device *omapdss_get_dss(void);
void omapdss_set_dss(struct dss_device *dss);
static inline bool omapdss_is_initialized(void)
{
return !!omapdss_get_dss();
}
int omapdss_register_display(struct omap_dss_device *dssdev);
void omapdss_unregister_display(struct omap_dss_device *dssdev);
......@@ -630,8 +636,6 @@ static inline bool omapdss_device_is_enabled(struct omap_dss_device *dssdev)
struct omap_dss_device *
omapdss_of_find_source_for_first_ep(struct device_node *node);
void omapdss_set_is_initialized(bool set);
struct device_node *dss_of_port_get_parent_device(struct device_node *port);
u32 dss_of_port_get_port_number(struct device_node *port);
......
......@@ -527,6 +527,7 @@ static int omapdrm_init(struct omap_drm_private *priv, struct device *dev)
if (ret)
goto err_crtc_uninit;
priv->dss = omapdss_get_dss();
priv->dispc_ops = dispc_get_ops();
soc = soc_device_match(omapdrm_soc_devices);
......
......@@ -50,6 +50,7 @@ struct omap_drm_private {
struct device *dev;
u32 omaprev;
struct dss_device *dss;
const struct dispc_ops *dispc_ops;
unsigned int num_crtcs;
......
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