@@ -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,