From: John Hunter <zhjwpku@gmail.com>
To: dri-devel@lists.freedesktop.org
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>,
Matthew Garrett <mjg59@coreos.com>,
Dave Airlie <airlied@redhat.com>
Subject: [PATCH 6/7] drm/cirrus: atomic dpms support
Date: Wed, 5 Aug 2015 15:22:55 +0800 [thread overview]
Message-ID: <1438759376-4509-7-git-send-email-zhjwpku@gmail.com> (raw)
In-Reply-To: <1438759376-4509-1-git-send-email-zhjwpku@gmail.com>
From: Zhao Junwang <zhjwpku@gmail.com>
Run dpms operations through the atomic interfaces. This basically
removes the .dpms() callback from encoders and crtcs and use .disable
and .enable to turn the crtc on and off.
use drm_atomic_helper_connector_dpms for connector
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Matthew Garrett <mjg59@coreos.com>
Cc: Dave Airlie <airlied@redhat.com>
Signed-off-by: Zhao Junwang <zhjwpku@gmail.com>
---
drivers/gpu/drm/cirrus/cirrus_mode.c | 68 +++++++++++++++++++---------------
1 file changed, 39 insertions(+), 29 deletions(-)
diff --git a/drivers/gpu/drm/cirrus/cirrus_mode.c b/drivers/gpu/drm/cirrus/cirrus_mode.c
index 1775864..e807cf0 100644
--- a/drivers/gpu/drm/cirrus/cirrus_mode.c
+++ b/drivers/gpu/drm/cirrus/cirrus_mode.c
@@ -55,37 +55,40 @@ static void cirrus_crtc_load_lut(struct drm_crtc *crtc)
}
}
-/*
- * The DRM core requires DPMS functions, but they make little sense in our
- * case and so are just stubs
- */
+static void cirrus_crtc_enable(struct drm_crtc *crtc)
+{
+ struct drm_device *dev = crtc->dev;
+ struct cirrus_device *cdev = dev->dev_private;
+ u8 sr01, gr0e;
+
+ if (crtc->enabled)
+ return;
-static void cirrus_crtc_dpms(struct drm_crtc *crtc, int mode)
+ sr01 = 0x00;
+ gr0e = 0x00;
+
+ WREG8(SEQ_INDEX, 0x1);
+ sr01 |= RREG8(SEQ_DATA) & ~0x20;
+ WREG_SEQ(0x1, sr01);
+
+ WREG8(GFX_INDEX, 0xe);
+ gr0e |= RREG8(GFX_DATA) & ~0x06;
+ WREG_GFX(0xe, gr0e);
+
+ crtc->enabled = true;
+}
+
+static void cirrus_crtc_disable(struct drm_crtc *crtc)
{
struct drm_device *dev = crtc->dev;
struct cirrus_device *cdev = dev->dev_private;
u8 sr01, gr0e;
- switch (mode) {
- case DRM_MODE_DPMS_ON:
- sr01 = 0x00;
- gr0e = 0x00;
- break;
- case DRM_MODE_DPMS_STANDBY:
- sr01 = 0x20;
- gr0e = 0x02;
- break;
- case DRM_MODE_DPMS_SUSPEND:
- sr01 = 0x20;
- gr0e = 0x04;
- break;
- case DRM_MODE_DPMS_OFF:
- sr01 = 0x20;
- gr0e = 0x06;
- break;
- default:
+ if (!crtc->enabled)
return;
- }
+
+ sr01 = 0x20;
+ gr0e = 0x06;
WREG8(SEQ_INDEX, 0x1);
sr01 |= RREG8(SEQ_DATA) & ~0x20;
@@ -94,6 +97,8 @@ static void cirrus_crtc_dpms(struct drm_crtc *crtc, int mode)
WREG8(GFX_INDEX, 0xe);
gr0e |= RREG8(GFX_DATA) & ~0x06;
WREG_GFX(0xe, gr0e);
+
+ crtc->enabled = false;
}
/*
@@ -303,7 +308,8 @@ static const struct drm_crtc_funcs cirrus_crtc_funcs = {
};
static const struct drm_crtc_helper_funcs cirrus_helper_funcs = {
- .dpms = cirrus_crtc_dpms,
+ .disable = cirrus_crtc_disable,
+ .enable = cirrus_crtc_enable,
.mode_fixup = cirrus_crtc_mode_fixup,
.mode_set_nofb = cirrus_crtc_mode_set_nofb,
.commit = cirrus_crtc_commit,
@@ -490,9 +496,12 @@ static void cirrus_encoder_mode_set(struct drm_encoder *encoder,
{
}
-static void cirrus_encoder_dpms(struct drm_encoder *encoder, int state)
+static void cirrus_encoder_enable(struct drm_encoder *encoder)
+{
+}
+
+static void cirrus_encoder_disable(struct drm_encoder *encoder)
{
- return;
}
static void cirrus_encoder_commit(struct drm_encoder *encoder)
@@ -507,7 +516,8 @@ static void cirrus_encoder_destroy(struct drm_encoder *encoder)
}
static const struct drm_encoder_helper_funcs cirrus_encoder_helper_funcs = {
- .dpms = cirrus_encoder_dpms,
+ .enable = cirrus_encoder_enable,
+ .disable = cirrus_encoder_disable,
.mode_fixup = cirrus_encoder_mode_fixup,
.mode_set = cirrus_encoder_mode_set,
.commit = cirrus_encoder_commit,
@@ -580,7 +590,7 @@ struct drm_connector_helper_funcs cirrus_vga_connector_helper_funcs = {
};
struct drm_connector_funcs cirrus_vga_connector_funcs = {
- .dpms = drm_helper_connector_dpms,
+ .dpms = drm_atomic_helper_connector_dpms,
.detect = cirrus_vga_detect,
.fill_modes = drm_helper_probe_single_connector_modes,
.destroy = cirrus_connector_destroy,
--
1.7.10.4
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2015-08-05 7:22 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-05 7:22 [PATCH 0/7] drm/cirrus: convert cirrus to atomic mode-setting John Hunter
2015-08-05 7:22 ` [PATCH 1/7] drm/cirrus: phase 1 - use the transitional helpers John Hunter
2015-08-05 7:22 ` [PATCH 2/7] drm/cirrus: phase 2: wire up state reset, duplicate and destroy John Hunter
2015-08-05 7:22 ` [PATCH 3/7] drm/cirrus: phase 3: atomic updates of planes John Hunter
2015-08-05 7:22 ` [PATCH 4/7] drm/cirrus: add return 0 to make sure if (bo->pin_count) early_exit John Hunter
2015-08-05 7:22 ` [PATCH 5/7] drm/cirrus: phase 3: use atomic .set_config helper John Hunter
2015-08-05 7:22 ` John Hunter [this message]
2015-08-05 7:22 ` [PATCH 7/7] drm/cirrus: add DRIVER_ATOMIC to .driver_features John Hunter
-- strict thread matches above, loose matches on Subject: below --
2015-07-30 10:08 [PATCH 0/7] drm/cirrus: convert cirrus to atomic mode-setting John Hunter
2015-07-30 10:08 ` [PATCH 6/7] drm/cirrus: atomic dpms support John Hunter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1438759376-4509-7-git-send-email-zhjwpku@gmail.com \
--to=zhjwpku@gmail.com \
--cc=airlied@redhat.com \
--cc=daniel.vetter@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=mjg59@coreos.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox