Skip to content

Commit 7c2d79f

Browse files
committed
drm: renesas: shmobile: Remove internal CRTC state tracking
Now the suspend/resume methods no longer need to look at internal driver state, the dpms and started fields in the shmob_drm_crtc structure can be removed, as well as the shmob_drm_crtc_dpms() wrapper. After this, shmob_drm_crtc_atomic_{en,dis}able() became just wrappers around shmob_drm_crtc_st{art,op}(), so inline the latter. Reviewed-by: Laurent Pinchart <[email protected]> Signed-off-by: Geert Uytterhoeven <[email protected]> Link: https://lore.kernel.org/r/905b9ca72f43d40438c8cb1199cde140eb123204.1694767209.git.geert+renesas@glider.be
1 parent cc2c954 commit 7c2d79f

File tree

2 files changed

+11
-58
lines changed

2 files changed

+11
-58
lines changed

drivers/gpu/drm/renesas/shmobile/shmob_drm_crtc.c

Lines changed: 11 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -191,25 +191,21 @@ static void shmob_drm_crtc_start_stop(struct shmob_drm_crtc *scrtc, bool start)
191191
}
192192
}
193193

194-
/*
195-
* shmob_drm_crtc_start - Configure and start the LCDC
196-
* @scrtc: the SH Mobile CRTC
197-
*
198-
* Configure and start the LCDC device. External devices (clocks, MERAM, panels,
199-
* ...) are not touched by this function.
200-
*/
201-
static void shmob_drm_crtc_start(struct shmob_drm_crtc *scrtc)
194+
static inline struct shmob_drm_crtc *to_shmob_crtc(struct drm_crtc *crtc)
202195
{
203-
struct drm_crtc *crtc = &scrtc->base;
196+
return container_of(crtc, struct shmob_drm_crtc, base);
197+
}
198+
199+
static void shmob_drm_crtc_atomic_enable(struct drm_crtc *crtc,
200+
struct drm_atomic_state *state)
201+
{
202+
struct shmob_drm_crtc *scrtc = to_shmob_crtc(crtc);
204203
struct shmob_drm_device *sdev = to_shmob_device(crtc->dev);
205204
const struct shmob_drm_interface_data *idata = &sdev->pdata->iface;
206205
struct device *dev = sdev->dev;
207206
u32 value;
208207
int ret;
209208

210-
if (scrtc->started)
211-
return;
212-
213209
ret = pm_runtime_resume_and_get(dev);
214210
if (ret)
215211
return;
@@ -256,18 +252,14 @@ static void shmob_drm_crtc_start(struct shmob_drm_crtc *scrtc)
256252

257253
/* Turn vertical blank interrupt reporting back on. */
258254
drm_crtc_vblank_on(crtc);
259-
260-
scrtc->started = true;
261255
}
262256

263-
static void shmob_drm_crtc_stop(struct shmob_drm_crtc *scrtc)
257+
static void shmob_drm_crtc_atomic_disable(struct drm_crtc *crtc,
258+
struct drm_atomic_state *state)
264259
{
265-
struct drm_crtc *crtc = &scrtc->base;
260+
struct shmob_drm_crtc *scrtc = to_shmob_crtc(crtc);
266261
struct shmob_drm_device *sdev = to_shmob_device(crtc->dev);
267262

268-
if (!scrtc->started)
269-
return;
270-
271263
/*
272264
* Disable vertical blank interrupt reporting. We first need to wait
273265
* for page flip completion before stopping the CRTC as userspace
@@ -283,28 +275,6 @@ static void shmob_drm_crtc_stop(struct shmob_drm_crtc *scrtc)
283275
lcdc_write(sdev, LDCNT1R, 0);
284276

285277
pm_runtime_put(sdev->dev);
286-
287-
scrtc->started = false;
288-
}
289-
290-
static inline struct shmob_drm_crtc *to_shmob_crtc(struct drm_crtc *crtc)
291-
{
292-
return container_of(crtc, struct shmob_drm_crtc, base);
293-
}
294-
295-
static void shmob_drm_crtc_dpms(struct drm_crtc *crtc, int mode)
296-
{
297-
struct shmob_drm_crtc *scrtc = to_shmob_crtc(crtc);
298-
299-
if (scrtc->dpms == mode)
300-
return;
301-
302-
if (mode == DRM_MODE_DPMS_ON)
303-
shmob_drm_crtc_start(scrtc);
304-
else
305-
shmob_drm_crtc_stop(scrtc);
306-
307-
scrtc->dpms = mode;
308278
}
309279

310280
static void shmob_drm_crtc_atomic_flush(struct drm_crtc *crtc,
@@ -323,18 +293,6 @@ static void shmob_drm_crtc_atomic_flush(struct drm_crtc *crtc,
323293
}
324294
}
325295

326-
static void shmob_drm_crtc_atomic_enable(struct drm_crtc *crtc,
327-
struct drm_atomic_state *state)
328-
{
329-
shmob_drm_crtc_dpms(crtc, DRM_MODE_DPMS_ON);
330-
}
331-
332-
static void shmob_drm_crtc_atomic_disable(struct drm_crtc *crtc,
333-
struct drm_atomic_state *state)
334-
{
335-
shmob_drm_crtc_dpms(crtc, DRM_MODE_DPMS_OFF);
336-
}
337-
338296
static const struct drm_crtc_helper_funcs crtc_helper_funcs = {
339297
.atomic_flush = shmob_drm_crtc_atomic_flush,
340298
.atomic_enable = shmob_drm_crtc_atomic_enable,
@@ -424,8 +382,6 @@ int shmob_drm_crtc_create(struct shmob_drm_device *sdev)
424382

425383
init_waitqueue_head(&sdev->crtc.flip_wait);
426384

427-
sdev->crtc.dpms = DRM_MODE_DPMS_OFF;
428-
429385
primary = shmob_drm_plane_create(sdev, DRM_PLANE_TYPE_PRIMARY, 0);
430386
if (IS_ERR(primary))
431387
return PTR_ERR(primary);

drivers/gpu/drm/renesas/shmobile/shmob_drm_crtc.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ struct shmob_drm_crtc {
2727

2828
struct drm_pending_vblank_event *event;
2929
wait_queue_head_t flip_wait;
30-
int dpms;
31-
32-
bool started;
3330
};
3431

3532
struct shmob_drm_connector {

0 commit comments

Comments
 (0)