Skip to content

Commit 72877cf

Browse files
pinchartltomba
authored andcommitted
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: Laurent Pinchart <[email protected]> Reviewed-by: Sebastian Reichel <[email protected]>
1 parent 64cb817 commit 72877cf

File tree

5 files changed

+19
-12
lines changed

5 files changed

+19
-12
lines changed

drivers/gpu/drm/omapdrm/dss/base.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#include <linux/list.h>
2121
#include "omapdss.h"
2222

23-
static bool dss_initialized;
23+
static struct dss_device *dss_device;
2424
static const struct dispc_ops *ops;
2525

2626
static struct list_head omapdss_comp_list;
@@ -31,17 +31,17 @@ struct omapdss_comp_node {
3131
bool dss_core_component;
3232
};
3333

34-
void omapdss_set_is_initialized(bool set)
34+
struct dss_device *omapdss_get_dss(void)
3535
{
36-
dss_initialized = set;
36+
return dss_device;
3737
}
38-
EXPORT_SYMBOL(omapdss_set_is_initialized);
38+
EXPORT_SYMBOL(omapdss_get_dss);
3939

40-
bool omapdss_is_initialized(void)
40+
void omapdss_set_dss(struct dss_device *dss)
4141
{
42-
return dss_initialized;
42+
dss_device = dss;
4343
}
44-
EXPORT_SYMBOL(omapdss_is_initialized);
44+
EXPORT_SYMBOL(omapdss_set_dss);
4545

4646
void dispc_set_ops(const struct dispc_ops *o)
4747
{

drivers/gpu/drm/omapdrm/dss/dss.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1316,6 +1316,7 @@ static const struct soc_device_attribute dss_soc_devices[] = {
13161316

13171317
static int dss_bind(struct device *dev)
13181318
{
1319+
struct dss_device *dss = dev_get_drvdata(dev);
13191320
int r;
13201321

13211322
r = component_bind_all(dev, NULL);
@@ -1325,14 +1326,14 @@ static int dss_bind(struct device *dev)
13251326
pm_set_vt_switch(0);
13261327

13271328
omapdss_gather_components(dev);
1328-
omapdss_set_is_initialized(true);
1329+
omapdss_set_dss(dss);
13291330

13301331
return 0;
13311332
}
13321333

13331334
static void dss_unbind(struct device *dev)
13341335
{
1335-
omapdss_set_is_initialized(false);
1336+
omapdss_set_dss(NULL);
13361337

13371338
component_unbind_all(dev, NULL);
13381339
}

drivers/gpu/drm/omapdrm/dss/omapdss.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
#define DISPC_IRQ_ACBIAS_COUNT_STAT3 (1 << 29)
6060
#define DISPC_IRQ_FRAMEDONE3 (1 << 30)
6161

62+
struct dss_device;
6263
struct omap_drm_private;
6364
struct omap_dss_device;
6465
struct dss_lcd_mgr_config;
@@ -586,7 +587,12 @@ struct omap_dss_driver {
586587
const struct hdmi_avi_infoframe *avi);
587588
};
588589

589-
bool omapdss_is_initialized(void);
590+
struct dss_device *omapdss_get_dss(void);
591+
void omapdss_set_dss(struct dss_device *dss);
592+
static inline bool omapdss_is_initialized(void)
593+
{
594+
return !!omapdss_get_dss();
595+
}
590596

591597
int omapdss_register_display(struct omap_dss_device *dssdev);
592598
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)
630636
struct omap_dss_device *
631637
omapdss_of_find_source_for_first_ep(struct device_node *node);
632638

633-
void omapdss_set_is_initialized(bool set);
634-
635639
struct device_node *dss_of_port_get_parent_device(struct device_node *port);
636640
u32 dss_of_port_get_port_number(struct device_node *port);
637641

drivers/gpu/drm/omapdrm/omap_drv.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,7 @@ static int omapdrm_init(struct omap_drm_private *priv, struct device *dev)
527527
if (ret)
528528
goto err_crtc_uninit;
529529

530+
priv->dss = omapdss_get_dss();
530531
priv->dispc_ops = dispc_get_ops();
531532

532533
soc = soc_device_match(omapdrm_soc_devices);

drivers/gpu/drm/omapdrm/omap_drv.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ struct omap_drm_private {
5050
struct device *dev;
5151
u32 omaprev;
5252

53+
struct dss_device *dss;
5354
const struct dispc_ops *dispc_ops;
5455

5556
unsigned int num_crtcs;

0 commit comments

Comments
 (0)