Skip to content

Commit

Permalink
drm/exynos: added crtc dpms for disable crtc
Browse files Browse the repository at this point in the history
crtc dpms is called as destroying attached fb so dpms off sould be processed.
crtc dpms also can be called after crtc is detached from encoder so pipe value
of manager is used to find display controller for this case

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
  • Loading branch information
Joonyoung Shim authored and Inki Dae committed Nov 15, 2011
1 parent aa6b2b6 commit d2716c8
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 11 deletions.
29 changes: 25 additions & 4 deletions drivers/gpu/drm/exynos/exynos_drm_crtc.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ static void exynos_drm_crtc_apply(struct drm_crtc *crtc)

exynos_drm_fn_encoder(crtc, overlay,
exynos_drm_encoder_crtc_mode_set);
exynos_drm_fn_encoder(crtc, NULL, exynos_drm_encoder_crtc_commit);
exynos_drm_fn_encoder(crtc, &exynos_crtc->pipe,
exynos_drm_encoder_crtc_commit);
}

static int exynos_drm_overlay_update(struct exynos_drm_overlay *overlay,
Expand Down Expand Up @@ -171,9 +172,26 @@ static int exynos_drm_crtc_update(struct drm_crtc *crtc)

static void exynos_drm_crtc_dpms(struct drm_crtc *crtc, int mode)
{
DRM_DEBUG_KMS("%s\n", __FILE__);
struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);

/* TODO */
DRM_DEBUG_KMS("crtc[%d] mode[%d]\n", crtc->base.id, mode);

switch (mode) {
case DRM_MODE_DPMS_ON:
exynos_drm_fn_encoder(crtc, &exynos_crtc->pipe,
exynos_drm_encoder_crtc_commit);
break;
case DRM_MODE_DPMS_STANDBY:
case DRM_MODE_DPMS_SUSPEND:
case DRM_MODE_DPMS_OFF:
/* TODO */
exynos_drm_fn_encoder(crtc, NULL,
exynos_drm_encoder_crtc_disable);
break;
default:
DRM_DEBUG_KMS("unspecified mode %d\n", mode);
break;
}
}

static void exynos_drm_crtc_prepare(struct drm_crtc *crtc)
Expand All @@ -185,9 +203,12 @@ static void exynos_drm_crtc_prepare(struct drm_crtc *crtc)

static void exynos_drm_crtc_commit(struct drm_crtc *crtc)
{
struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);

DRM_DEBUG_KMS("%s\n", __FILE__);

/* drm framework doesn't check NULL. */
exynos_drm_fn_encoder(crtc, &exynos_crtc->pipe,
exynos_drm_encoder_crtc_commit);
}

static bool
Expand Down
54 changes: 47 additions & 7 deletions drivers/gpu/drm/exynos/exynos_drm_encoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ static void exynos_drm_encoder_dpms(struct drm_encoder *encoder, int mode)
struct exynos_drm_display_ops *display_ops =
manager->display_ops;

DRM_DEBUG_KMS("connector[%d] dpms[%d]\n",
connector->base.id, mode);
if (display_ops && display_ops->power_on)
display_ops->power_on(manager->dev, mode);
}
Expand Down Expand Up @@ -117,15 +119,11 @@ static void exynos_drm_encoder_commit(struct drm_encoder *encoder)
{
struct exynos_drm_manager *manager = exynos_drm_get_manager(encoder);
struct exynos_drm_manager_ops *manager_ops = manager->ops;
struct exynos_drm_overlay_ops *overlay_ops = manager->overlay_ops;

DRM_DEBUG_KMS("%s\n", __FILE__);

if (manager_ops && manager_ops->commit)
manager_ops->commit(manager->dev);

if (overlay_ops && overlay_ops->commit)
overlay_ops->commit(manager->dev);
}

static struct drm_crtc *
Expand Down Expand Up @@ -209,10 +207,23 @@ void exynos_drm_fn_encoder(struct drm_crtc *crtc, void *data,
{
struct drm_device *dev = crtc->dev;
struct drm_encoder *encoder;
struct exynos_drm_private *private = dev->dev_private;
struct exynos_drm_manager *manager;

list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {
if (encoder->crtc != crtc)
continue;
/*
* if crtc is detached from encoder, check pipe,
* otherwise check crtc attached to encoder
*/
if (!encoder->crtc) {
manager = to_exynos_encoder(encoder)->manager;
if (manager->pipe < 0 ||
private->crtc[manager->pipe] != crtc)
continue;
} else {
if (encoder->crtc != crtc)
continue;
}

fn(encoder, data);
}
Expand Down Expand Up @@ -251,8 +262,18 @@ void exynos_drm_encoder_crtc_commit(struct drm_encoder *encoder, void *data)
struct exynos_drm_manager *manager =
to_exynos_encoder(encoder)->manager;
struct exynos_drm_overlay_ops *overlay_ops = manager->overlay_ops;
int crtc = *(int *)data;

DRM_DEBUG_KMS("%s\n", __FILE__);

overlay_ops->commit(manager->dev);
/*
* when crtc is detached from encoder, this pipe is used
* to select manager operation
*/
manager->pipe = crtc;

if (overlay_ops && overlay_ops->commit)
overlay_ops->commit(manager->dev);
}

void exynos_drm_encoder_crtc_mode_set(struct drm_encoder *encoder, void *data)
Expand All @@ -265,6 +286,25 @@ void exynos_drm_encoder_crtc_mode_set(struct drm_encoder *encoder, void *data)
overlay_ops->mode_set(manager->dev, overlay);
}

void exynos_drm_encoder_crtc_disable(struct drm_encoder *encoder, void *data)
{
struct exynos_drm_manager *manager =
to_exynos_encoder(encoder)->manager;
struct exynos_drm_overlay_ops *overlay_ops = manager->overlay_ops;

DRM_DEBUG_KMS("\n");

overlay_ops->disable(manager->dev);

/*
* crtc is already detached from encoder and last
* function for detaching is properly done, so
* clear pipe from manager to prevent repeated call
*/
if (!encoder->crtc)
manager->pipe = -1;
}

MODULE_AUTHOR("Inki Dae <inki.dae@samsung.com>");
MODULE_AUTHOR("Joonyoung Shim <jy0922.shim@samsung.com>");
MODULE_AUTHOR("Seung-Woo Kim <sw0312.kim@samsung.com>");
Expand Down
1 change: 1 addition & 0 deletions drivers/gpu/drm/exynos/exynos_drm_encoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,6 @@ void exynos_drm_enable_vblank(struct drm_encoder *encoder, void *data);
void exynos_drm_disable_vblank(struct drm_encoder *encoder, void *data);
void exynos_drm_encoder_crtc_commit(struct drm_encoder *encoder, void *data);
void exynos_drm_encoder_crtc_mode_set(struct drm_encoder *encoder, void *data);
void exynos_drm_encoder_crtc_disable(struct drm_encoder *encoder, void *data);

#endif

0 comments on commit d2716c8

Please sign in to comment.