After this patch OMAP_DSS_BASE module is not including any OMAP2_DSS headers, only the API omapdss.h. "sturct dss_data", the piece of the data structure needed for base.c is defined in omapdss.h and added as a member to struct dss_device, and later to struct dss6_device. The patch is still a bit hackish. The struct dispc_device declaration is currently shared between alternative dss implementations, with different internal definitions. It should be relatively simple to use a similar struct dispc_data as struct dss_data is for dss_device, move some common parts - maybe the dispc_ops itself - there and find the private data with container_of macro. Also the contents of struct dss_data in side dss_device is currently redundant. These should be easy enough to fix, if we decide to take this route. Signed-off-by: Jyri Sarha <jsarha@xxxxxx> --- drivers/gpu/drm/omapdrm/dss/base.c | 11 +++++------ drivers/gpu/drm/omapdrm/dss/dispc.c | 4 ++++ drivers/gpu/drm/omapdrm/dss/dss.c | 2 +- drivers/gpu/drm/omapdrm/dss/dss.h | 2 ++ drivers/gpu/drm/omapdrm/dss/omapdss.h | 13 +++++++++---- drivers/gpu/drm/omapdrm/omap_drv.h | 2 +- 6 files changed, 22 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/dss/base.c b/drivers/gpu/drm/omapdrm/dss/base.c index 99e8cb8..42442f3 100644 --- a/drivers/gpu/drm/omapdrm/dss/base.c +++ b/drivers/gpu/drm/omapdrm/dss/base.c @@ -19,10 +19,9 @@ #include <linux/of_graph.h> #include <linux/list.h> -#include "dss.h" #include "omapdss.h" -static struct dss_device *dss_device; +static struct dss_data *dss_device; static struct list_head omapdss_comp_list; @@ -32,25 +31,25 @@ struct omapdss_comp_node { bool dss_core_component; }; -struct dss_device *omapdss_get_dss(void) +struct dss_data *omapdss_get_dss(void) { return dss_device; } EXPORT_SYMBOL(omapdss_get_dss); -void omapdss_set_dss(struct dss_device *dss) +void omapdss_set_dss(struct dss_data *dss) { dss_device = dss; } EXPORT_SYMBOL(omapdss_set_dss); -struct dispc_device *dispc_get_dispc(struct dss_device *dss) +struct dispc_device *dispc_get_dispc(struct dss_data *dss) { return dss->dispc; } EXPORT_SYMBOL(dispc_get_dispc); -const struct dispc_ops *dispc_get_ops(struct dss_device *dss) +const struct dispc_ops *dispc_get_ops(struct dss_data *dss) { return dss->dispc_ops; } diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c b/drivers/gpu/drm/omapdrm/dss/dispc.c index ce470b5..338490d 100644 --- a/drivers/gpu/drm/omapdrm/dss/dispc.c +++ b/drivers/gpu/drm/omapdrm/dss/dispc.c @@ -4791,6 +4791,10 @@ static int dispc_bind(struct device *dev, struct device *master, void *data) dispc->debugfs = dss_debugfs_create_file(dss, "dispc", dispc_dump_regs, dispc); + // XXX get rid of the above redundant data members + dss->data.dispc = dss->dispc; + dss->data.dispc_ops = dss->dispc_ops; + return 0; err_runtime_get: diff --git a/drivers/gpu/drm/omapdrm/dss/dss.c b/drivers/gpu/drm/omapdrm/dss/dss.c index 4a08bd1..5752328 100644 --- a/drivers/gpu/drm/omapdrm/dss/dss.c +++ b/drivers/gpu/drm/omapdrm/dss/dss.c @@ -1326,7 +1326,7 @@ static int dss_bind(struct device *dev) pm_set_vt_switch(0); omapdss_gather_components(dev); - omapdss_set_dss(dss); + omapdss_set_dss(&dss->data); return 0; } diff --git a/drivers/gpu/drm/omapdrm/dss/dss.h b/drivers/gpu/drm/omapdrm/dss/dss.h index 6f6fd3d..434262a 100644 --- a/drivers/gpu/drm/omapdrm/dss/dss.h +++ b/drivers/gpu/drm/omapdrm/dss/dss.h @@ -273,6 +273,8 @@ struct dss_device { struct dss_pll *video1_pll; struct dss_pll *video2_pll; + struct dss_data data; + // XXX these are redundant, use data instead struct dispc_device *dispc; const struct dispc_ops *dispc_ops; }; diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h index a4f71e0..1299dd6 100644 --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h @@ -589,8 +589,13 @@ struct omap_dss_driver { const struct hdmi_avi_infoframe *avi); }; -struct dss_device *omapdss_get_dss(void); -void omapdss_set_dss(struct dss_device *dss); +struct dss_data { + const struct dispc_ops *dispc_ops; + struct dispc_device *dispc; +}; + +struct dss_data *omapdss_get_dss(void); +void omapdss_set_dss(struct dss_data *dss); static inline bool omapdss_is_initialized(void) { return !!omapdss_get_dss(); @@ -749,8 +754,8 @@ struct dispc_ops { enum omap_plane_id plane); }; -struct dispc_device *dispc_get_dispc(struct dss_device *dss); -const struct dispc_ops *dispc_get_ops(struct dss_device *dss); +struct dispc_device *dispc_get_dispc(struct dss_data *dss); +const struct dispc_ops *dispc_get_ops(struct dss_data *dss); bool omapdss_component_is_display(struct device_node *node); bool omapdss_component_is_output(struct device_node *node); diff --git a/drivers/gpu/drm/omapdrm/omap_drv.h b/drivers/gpu/drm/omapdrm/omap_drv.h index 6eaee4d..3b7ec7e 100644 --- a/drivers/gpu/drm/omapdrm/omap_drv.h +++ b/drivers/gpu/drm/omapdrm/omap_drv.h @@ -50,7 +50,7 @@ struct omap_drm_private { struct device *dev; u32 omaprev; - struct dss_device *dss; + struct dss_data *dss; struct dispc_device *dispc; const struct dispc_ops *dispc_ops; -- Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel