]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm: omapdrm: dss: Store DSS device pointer in the omapdrm private data
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Tue, 13 Feb 2018 12:00:40 +0000 (14:00 +0200)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Thu, 1 Mar 2018 07:18:18 +0000 (09:18 +0200)
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: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
drivers/gpu/drm/omapdrm/dss/base.c
drivers/gpu/drm/omapdrm/dss/dss.c
drivers/gpu/drm/omapdrm/dss/omapdss.h
drivers/gpu/drm/omapdrm/omap_drv.c
drivers/gpu/drm/omapdrm/omap_drv.h

index 67cc87a4f1f6f9ba16d15b7f7ff9e50f7b044245..6346bc967a770fddebe2022ecfca32d6bacb5ace 100644 (file)
@@ -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)
 {
index 14d2f024eb7098b29716fa29dc34cd7807a658c7..ca2efb937d42979e8726e507d9e966c2a2f39345 100644 (file)
@@ -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);
 }
index 318641f5bc245f38dc015b2000fbbbea8d4082b5..312485714703fa15cd22c40dacb39da103c7fba3 100644 (file)
@@ -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);
 
index 39e78f765f7e6c655f104bbe57d8bc9b515815e8..003445b70ee7306eac0234dc4cd2885b3716191a 100644 (file)
@@ -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);
index 49351bb3731e7a100ae782808bd90592bac7f0aa..a7962c14fc7cae65676da99e87be5d91a3dca491 100644 (file)
@@ -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;