Skip to content

Commit 64cb817

Browse files
pinchartltomba
authored andcommitted
drm: omapdrm: dss: Pass omap_drm_private pointer to dss_mgr_ops
The dss_mgr_ops operations implemented by the omapdrm side have to look up the omap_crtc objects from global variables as they are only passed a channel number. In order to remove global variables in the omapdrm driver pass the omap_drm_private pointer to the dss_mgr_ops. This requires storing a pointer to the omap_drm_private in a global variable on the DSS side as a temporary measure until the omapdrm and omapdss drivers get merged. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Sebastian Reichel <[email protected]>
1 parent 28d79f3 commit 64cb817

File tree

5 files changed

+64
-40
lines changed

5 files changed

+64
-40
lines changed

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

Lines changed: 26 additions & 15 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 omap_drm_private;
6263
struct omap_dss_device;
6364
struct dss_lcd_mgr_config;
6465
struct snd_aes_iec958;
@@ -635,25 +636,35 @@ struct device_node *dss_of_port_get_parent_device(struct device_node *port);
635636
u32 dss_of_port_get_port_number(struct device_node *port);
636637

637638
struct dss_mgr_ops {
638-
int (*connect)(enum omap_channel channel,
639-
struct omap_dss_device *dst);
640-
void (*disconnect)(enum omap_channel channel,
641-
struct omap_dss_device *dst);
642-
643-
void (*start_update)(enum omap_channel channel);
644-
int (*enable)(enum omap_channel channel);
645-
void (*disable)(enum omap_channel channel);
646-
void (*set_timings)(enum omap_channel channel,
647-
const struct videomode *vm);
648-
void (*set_lcd_config)(enum omap_channel channel,
649-
const struct dss_lcd_mgr_config *config);
650-
int (*register_framedone_handler)(enum omap_channel channel,
639+
int (*connect)(struct omap_drm_private *priv,
640+
enum omap_channel channel,
641+
struct omap_dss_device *dst);
642+
void (*disconnect)(struct omap_drm_private *priv,
643+
enum omap_channel channel,
644+
struct omap_dss_device *dst);
645+
646+
void (*start_update)(struct omap_drm_private *priv,
647+
enum omap_channel channel);
648+
int (*enable)(struct omap_drm_private *priv,
649+
enum omap_channel channel);
650+
void (*disable)(struct omap_drm_private *priv,
651+
enum omap_channel channel);
652+
void (*set_timings)(struct omap_drm_private *priv,
653+
enum omap_channel channel,
654+
const struct videomode *vm);
655+
void (*set_lcd_config)(struct omap_drm_private *priv,
656+
enum omap_channel channel,
657+
const struct dss_lcd_mgr_config *config);
658+
int (*register_framedone_handler)(struct omap_drm_private *priv,
659+
enum omap_channel channel,
651660
void (*handler)(void *), void *data);
652-
void (*unregister_framedone_handler)(enum omap_channel channel,
661+
void (*unregister_framedone_handler)(struct omap_drm_private *priv,
662+
enum omap_channel channel,
653663
void (*handler)(void *), void *data);
654664
};
655665

656-
int dss_install_mgr_ops(const struct dss_mgr_ops *mgr_ops);
666+
int dss_install_mgr_ops(const struct dss_mgr_ops *mgr_ops,
667+
struct omap_drm_private *priv);
657668
void dss_uninstall_mgr_ops(void);
658669

659670
int dss_mgr_connect(struct omap_dss_device *dssdev,

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

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -170,13 +170,16 @@ struct omap_dss_device *omapdss_find_output_from_display(struct omap_dss_device
170170
EXPORT_SYMBOL(omapdss_find_output_from_display);
171171

172172
static const struct dss_mgr_ops *dss_mgr_ops;
173+
static struct omap_drm_private *dss_mgr_ops_priv;
173174

174-
int dss_install_mgr_ops(const struct dss_mgr_ops *mgr_ops)
175+
int dss_install_mgr_ops(const struct dss_mgr_ops *mgr_ops,
176+
struct omap_drm_private *priv)
175177
{
176178
if (dss_mgr_ops)
177179
return -EBUSY;
178180

179181
dss_mgr_ops = mgr_ops;
182+
dss_mgr_ops_priv = priv;
180183

181184
return 0;
182185
}
@@ -185,66 +188,71 @@ EXPORT_SYMBOL(dss_install_mgr_ops);
185188
void dss_uninstall_mgr_ops(void)
186189
{
187190
dss_mgr_ops = NULL;
191+
dss_mgr_ops_priv = NULL;
188192
}
189193
EXPORT_SYMBOL(dss_uninstall_mgr_ops);
190194

191195
int dss_mgr_connect(struct omap_dss_device *dssdev, struct omap_dss_device *dst)
192196
{
193-
return dss_mgr_ops->connect(dssdev->dispc_channel, dst);
197+
return dss_mgr_ops->connect(dss_mgr_ops_priv,
198+
dssdev->dispc_channel, dst);
194199
}
195200
EXPORT_SYMBOL(dss_mgr_connect);
196201

197202
void dss_mgr_disconnect(struct omap_dss_device *dssdev,
198203
struct omap_dss_device *dst)
199204
{
200-
dss_mgr_ops->disconnect(dssdev->dispc_channel, dst);
205+
dss_mgr_ops->disconnect(dss_mgr_ops_priv, dssdev->dispc_channel, dst);
201206
}
202207
EXPORT_SYMBOL(dss_mgr_disconnect);
203208

204209
void dss_mgr_set_timings(struct omap_dss_device *dssdev,
205210
const struct videomode *vm)
206211
{
207-
dss_mgr_ops->set_timings(dssdev->dispc_channel, vm);
212+
dss_mgr_ops->set_timings(dss_mgr_ops_priv, dssdev->dispc_channel, vm);
208213
}
209214
EXPORT_SYMBOL(dss_mgr_set_timings);
210215

211216
void dss_mgr_set_lcd_config(struct omap_dss_device *dssdev,
212217
const struct dss_lcd_mgr_config *config)
213218
{
214-
dss_mgr_ops->set_lcd_config(dssdev->dispc_channel, config);
219+
dss_mgr_ops->set_lcd_config(dss_mgr_ops_priv,
220+
dssdev->dispc_channel, config);
215221
}
216222
EXPORT_SYMBOL(dss_mgr_set_lcd_config);
217223

218224
int dss_mgr_enable(struct omap_dss_device *dssdev)
219225
{
220-
return dss_mgr_ops->enable(dssdev->dispc_channel);
226+
return dss_mgr_ops->enable(dss_mgr_ops_priv, dssdev->dispc_channel);
221227
}
222228
EXPORT_SYMBOL(dss_mgr_enable);
223229

224230
void dss_mgr_disable(struct omap_dss_device *dssdev)
225231
{
226-
dss_mgr_ops->disable(dssdev->dispc_channel);
232+
dss_mgr_ops->disable(dss_mgr_ops_priv, dssdev->dispc_channel);
227233
}
228234
EXPORT_SYMBOL(dss_mgr_disable);
229235

230236
void dss_mgr_start_update(struct omap_dss_device *dssdev)
231237
{
232-
dss_mgr_ops->start_update(dssdev->dispc_channel);
238+
dss_mgr_ops->start_update(dss_mgr_ops_priv, dssdev->dispc_channel);
233239
}
234240
EXPORT_SYMBOL(dss_mgr_start_update);
235241

236242
int dss_mgr_register_framedone_handler(struct omap_dss_device *dssdev,
237243
void (*handler)(void *), void *data)
238244
{
239-
return dss_mgr_ops->register_framedone_handler(dssdev->dispc_channel,
245+
return dss_mgr_ops->register_framedone_handler(dss_mgr_ops_priv,
246+
dssdev->dispc_channel,
240247
handler, data);
241248
}
242249
EXPORT_SYMBOL(dss_mgr_register_framedone_handler);
243250

244251
void dss_mgr_unregister_framedone_handler(struct omap_dss_device *dssdev,
245252
void (*handler)(void *), void *data)
246253
{
247-
dss_mgr_ops->unregister_framedone_handler(dssdev->dispc_channel,
254+
dss_mgr_ops->unregister_framedone_handler(dss_mgr_ops_priv,
255+
dssdev->dispc_channel,
248256
handler, data);
249257
}
250258
EXPORT_SYMBOL(dss_mgr_unregister_framedone_handler);

drivers/gpu/drm/omapdrm/omap_crtc.c

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,8 @@ static struct omap_crtc *omap_crtcs[8];
113113
static struct omap_dss_device *omap_crtc_output[8];
114114

115115
/* we can probably ignore these until we support command-mode panels: */
116-
static int omap_crtc_dss_connect(enum omap_channel channel,
116+
static int omap_crtc_dss_connect(struct omap_drm_private *priv,
117+
enum omap_channel channel,
117118
struct omap_dss_device *dst)
118119
{
119120
const struct dispc_ops *dispc_ops = dispc_get_ops();
@@ -130,14 +131,16 @@ static int omap_crtc_dss_connect(enum omap_channel channel,
130131
return 0;
131132
}
132133

133-
static void omap_crtc_dss_disconnect(enum omap_channel channel,
134+
static void omap_crtc_dss_disconnect(struct omap_drm_private *priv,
135+
enum omap_channel channel,
134136
struct omap_dss_device *dst)
135137
{
136138
omap_crtc_output[channel] = NULL;
137139
dst->dispc_channel_connected = false;
138140
}
139141

140-
static void omap_crtc_dss_start_update(enum omap_channel channel)
142+
static void omap_crtc_dss_start_update(struct omap_drm_private *priv,
143+
enum omap_channel channel)
141144
{
142145
}
143146

@@ -207,51 +210,53 @@ static void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable)
207210
}
208211

209212

210-
static int omap_crtc_dss_enable(enum omap_channel channel)
213+
static int omap_crtc_dss_enable(struct omap_drm_private *priv,
214+
enum omap_channel channel)
211215
{
212216
struct omap_crtc *omap_crtc = omap_crtcs[channel];
213-
struct omap_drm_private *priv = omap_crtc->base.dev->dev_private;
214217

215218
priv->dispc_ops->mgr_set_timings(omap_crtc->channel, &omap_crtc->vm);
216219
omap_crtc_set_enabled(&omap_crtc->base, true);
217220

218221
return 0;
219222
}
220223

221-
static void omap_crtc_dss_disable(enum omap_channel channel)
224+
static void omap_crtc_dss_disable(struct omap_drm_private *priv,
225+
enum omap_channel channel)
222226
{
223227
struct omap_crtc *omap_crtc = omap_crtcs[channel];
224228

225229
omap_crtc_set_enabled(&omap_crtc->base, false);
226230
}
227231

228-
static void omap_crtc_dss_set_timings(enum omap_channel channel,
232+
static void omap_crtc_dss_set_timings(struct omap_drm_private *priv,
233+
enum omap_channel channel,
229234
const struct videomode *vm)
230235
{
231236
struct omap_crtc *omap_crtc = omap_crtcs[channel];
232237
DBG("%s", omap_crtc->name);
233238
omap_crtc->vm = *vm;
234239
}
235240

236-
static void omap_crtc_dss_set_lcd_config(enum omap_channel channel,
241+
static void omap_crtc_dss_set_lcd_config(struct omap_drm_private *priv,
242+
enum omap_channel channel,
237243
const struct dss_lcd_mgr_config *config)
238244
{
239245
struct omap_crtc *omap_crtc = omap_crtcs[channel];
240-
struct omap_drm_private *priv = omap_crtc->base.dev->dev_private;
241246

242247
DBG("%s", omap_crtc->name);
243248
priv->dispc_ops->mgr_set_lcd_config(omap_crtc->channel, config);
244249
}
245250

246251
static int omap_crtc_dss_register_framedone(
247-
enum omap_channel channel,
252+
struct omap_drm_private *priv, enum omap_channel channel,
248253
void (*handler)(void *), void *data)
249254
{
250255
return 0;
251256
}
252257

253258
static void omap_crtc_dss_unregister_framedone(
254-
enum omap_channel channel,
259+
struct omap_drm_private *priv, enum omap_channel channel,
255260
void (*handler)(void *), void *data)
256261
{
257262
}
@@ -669,11 +674,11 @@ static const char *channel_names[] = {
669674
[OMAP_DSS_CHANNEL_LCD3] = "lcd3",
670675
};
671676

672-
void omap_crtc_pre_init(void)
677+
void omap_crtc_pre_init(struct omap_drm_private *priv)
673678
{
674679
memset(omap_crtcs, 0, sizeof(omap_crtcs));
675680

676-
dss_install_mgr_ops(&mgr_ops);
681+
dss_install_mgr_ops(&mgr_ops, priv);
677682
}
678683

679684
void omap_crtc_pre_uninit(void)

drivers/gpu/drm/omapdrm/omap_crtc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ struct videomode;
3232

3333
struct videomode *omap_crtc_timings(struct drm_crtc *crtc);
3434
enum omap_channel omap_crtc_channel(struct drm_crtc *crtc);
35-
void omap_crtc_pre_init(void);
35+
void omap_crtc_pre_init(struct omap_drm_private *priv);
3636
void omap_crtc_pre_uninit(void);
3737
struct drm_crtc *omap_crtc_init(struct drm_device *dev,
3838
struct drm_plane *plane, struct omap_dss_device *dssdev);

drivers/gpu/drm/omapdrm/omap_drv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ static int omapdrm_init(struct omap_drm_private *priv, struct device *dev)
521521

522522
priv->dev = dev;
523523

524-
omap_crtc_pre_init();
524+
omap_crtc_pre_init(priv);
525525

526526
ret = omap_connect_dssdevs();
527527
if (ret)

0 commit comments

Comments
 (0)