diff options
author | Chen-Yu Tsai <wens@csie.org> | 2017-03-09 05:05:27 -0500 |
---|---|---|
committer | Maxime Ripard <maxime.ripard@free-electrons.com> | 2017-03-09 05:19:59 -0500 |
commit | 279156a33c33b385a78c1266ddf6ebc2d473193d (patch) | |
tree | 99e73086cd1086680b661030fa00275183de10ba /drivers | |
parent | e4cdcb7cce2949fb36a04b9848f856a107a0a2da (diff) |
drm/sun4i: tv: Get tcon and backend pointers from associated crtc
The drm_encoder structure provides us with a pointer to the crtc
currently tied to the encoder. Subsequently we can extract the
tcon and backend pointers from our crtc structure, instead of
getting it directly from the sun4i_drv structure.
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/drm/sun4i/sun4i_tv.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/drivers/gpu/drm/sun4i/sun4i_tv.c b/drivers/gpu/drm/sun4i/sun4i_tv.c index 32ed5fdf0c4d..49c49431a053 100644 --- a/drivers/gpu/drm/sun4i/sun4i_tv.c +++ b/drivers/gpu/drm/sun4i/sun4i_tv.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <drm/drm_panel.h> | 23 | #include <drm/drm_panel.h> |
24 | 24 | ||
25 | #include "sun4i_backend.h" | 25 | #include "sun4i_backend.h" |
26 | #include "sun4i_crtc.h" | ||
26 | #include "sun4i_drv.h" | 27 | #include "sun4i_drv.h" |
27 | #include "sun4i_tcon.h" | 28 | #include "sun4i_tcon.h" |
28 | 29 | ||
@@ -350,8 +351,9 @@ static int sun4i_tv_atomic_check(struct drm_encoder *encoder, | |||
350 | static void sun4i_tv_disable(struct drm_encoder *encoder) | 351 | static void sun4i_tv_disable(struct drm_encoder *encoder) |
351 | { | 352 | { |
352 | struct sun4i_tv *tv = drm_encoder_to_sun4i_tv(encoder); | 353 | struct sun4i_tv *tv = drm_encoder_to_sun4i_tv(encoder); |
353 | struct sun4i_drv *drv = tv->drv; | 354 | struct sun4i_crtc *crtc = drm_crtc_to_sun4i_crtc(encoder->crtc); |
354 | struct sun4i_tcon *tcon = drv->tcon; | 355 | struct sun4i_tcon *tcon = crtc->tcon; |
356 | struct sun4i_backend *backend = crtc->backend; | ||
355 | 357 | ||
356 | DRM_DEBUG_DRIVER("Disabling the TV Output\n"); | 358 | DRM_DEBUG_DRIVER("Disabling the TV Output\n"); |
357 | 359 | ||
@@ -360,18 +362,19 @@ static void sun4i_tv_disable(struct drm_encoder *encoder) | |||
360 | regmap_update_bits(tv->regs, SUN4I_TVE_EN_REG, | 362 | regmap_update_bits(tv->regs, SUN4I_TVE_EN_REG, |
361 | SUN4I_TVE_EN_ENABLE, | 363 | SUN4I_TVE_EN_ENABLE, |
362 | 0); | 364 | 0); |
363 | sun4i_backend_disable_color_correction(drv->backend); | 365 | sun4i_backend_disable_color_correction(backend); |
364 | } | 366 | } |
365 | 367 | ||
366 | static void sun4i_tv_enable(struct drm_encoder *encoder) | 368 | static void sun4i_tv_enable(struct drm_encoder *encoder) |
367 | { | 369 | { |
368 | struct sun4i_tv *tv = drm_encoder_to_sun4i_tv(encoder); | 370 | struct sun4i_tv *tv = drm_encoder_to_sun4i_tv(encoder); |
369 | struct sun4i_drv *drv = tv->drv; | 371 | struct sun4i_crtc *crtc = drm_crtc_to_sun4i_crtc(encoder->crtc); |
370 | struct sun4i_tcon *tcon = drv->tcon; | 372 | struct sun4i_tcon *tcon = crtc->tcon; |
373 | struct sun4i_backend *backend = crtc->backend; | ||
371 | 374 | ||
372 | DRM_DEBUG_DRIVER("Enabling the TV Output\n"); | 375 | DRM_DEBUG_DRIVER("Enabling the TV Output\n"); |
373 | 376 | ||
374 | sun4i_backend_apply_color_correction(drv->backend); | 377 | sun4i_backend_apply_color_correction(backend); |
375 | 378 | ||
376 | regmap_update_bits(tv->regs, SUN4I_TVE_EN_REG, | 379 | regmap_update_bits(tv->regs, SUN4I_TVE_EN_REG, |
377 | SUN4I_TVE_EN_ENABLE, | 380 | SUN4I_TVE_EN_ENABLE, |
@@ -385,8 +388,8 @@ static void sun4i_tv_mode_set(struct drm_encoder *encoder, | |||
385 | struct drm_display_mode *adjusted_mode) | 388 | struct drm_display_mode *adjusted_mode) |
386 | { | 389 | { |
387 | struct sun4i_tv *tv = drm_encoder_to_sun4i_tv(encoder); | 390 | struct sun4i_tv *tv = drm_encoder_to_sun4i_tv(encoder); |
388 | struct sun4i_drv *drv = tv->drv; | 391 | struct sun4i_crtc *crtc = drm_crtc_to_sun4i_crtc(encoder->crtc); |
389 | struct sun4i_tcon *tcon = drv->tcon; | 392 | struct sun4i_tcon *tcon = crtc->tcon; |
390 | const struct tv_mode *tv_mode = sun4i_tv_find_tv_by_mode(mode); | 393 | const struct tv_mode *tv_mode = sun4i_tv_find_tv_by_mode(mode); |
391 | 394 | ||
392 | sun4i_tcon1_mode_set(tcon, mode); | 395 | sun4i_tcon1_mode_set(tcon, mode); |