Skip to content

Commit 633743e

Browse files
committed
drm/ast: Inline ast_crtc_dpms() into callers
The function ast_crtc_dpms() is left over from when the ast driver did not implement atomic modesetting. But DPMS is not supported by atomic modesetting and the helper is only called to enable or disable the CRTC sync pulses. Inline the function into its callers. To disable the CRTC, ast sets (AST_DPMS_VSYNC_OFF | AST_DPMS_HSYNC_OFF) in VGACRB6. Replace the constants with the correct register constants for VGACRB6. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20240627153638.8765-8-tzimmermann@suse.de
1 parent 171b357 commit 633743e

File tree

2 files changed

+13
-32
lines changed

2 files changed

+13
-32
lines changed

drivers/gpu/drm/ast/ast_mode.c

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,29 +1019,6 @@ static int ast_cursor_plane_init(struct ast_device *ast)
10191019
* CRTC
10201020
*/
10211021

1022-
static void ast_crtc_dpms(struct drm_crtc *crtc, int mode)
1023-
{
1024-
struct ast_device *ast = to_ast_device(crtc->dev);
1025-
u8 ch = AST_DPMS_VSYNC_OFF | AST_DPMS_HSYNC_OFF;
1026-
1027-
/* TODO: Maybe control display signal generation with
1028-
* Sync Enable (bit CR17.7).
1029-
*/
1030-
switch (mode) {
1031-
case DRM_MODE_DPMS_ON:
1032-
ast_set_index_reg_mask(ast, AST_IO_VGACRI, 0xb6, 0xfc, 0);
1033-
ast_set_index_reg_mask(ast, AST_IO_VGASRI, 0x01, 0xdf, 0);
1034-
break;
1035-
case DRM_MODE_DPMS_STANDBY:
1036-
case DRM_MODE_DPMS_SUSPEND:
1037-
case DRM_MODE_DPMS_OFF:
1038-
ch = mode;
1039-
ast_set_index_reg_mask(ast, AST_IO_VGASRI, 0x01, 0xdf, AST_IO_VGASR1_SD);
1040-
ast_set_index_reg_mask(ast, AST_IO_VGACRI, 0xb6, 0xfc, ch);
1041-
break;
1042-
}
1043-
}
1044-
10451022
static enum drm_mode_status
10461023
ast_crtc_helper_mode_valid(struct drm_crtc *crtc, const struct drm_display_mode *mode)
10471024
{
@@ -1217,14 +1194,23 @@ ast_crtc_helper_atomic_flush(struct drm_crtc *crtc,
12171194

12181195
static void ast_crtc_helper_atomic_enable(struct drm_crtc *crtc, struct drm_atomic_state *state)
12191196
{
1220-
ast_crtc_dpms(crtc, DRM_MODE_DPMS_ON);
1197+
struct ast_device *ast = to_ast_device(crtc->dev);
1198+
1199+
ast_set_index_reg_mask(ast, AST_IO_VGACRI, 0xb6, 0xfc, 0x00);
1200+
ast_set_index_reg_mask(ast, AST_IO_VGASRI, 0x01, 0xdf, 0x00);
12211201
}
12221202

12231203
static void ast_crtc_helper_atomic_disable(struct drm_crtc *crtc, struct drm_atomic_state *state)
12241204
{
12251205
struct drm_crtc_state *old_crtc_state = drm_atomic_get_old_crtc_state(state, crtc);
1206+
struct ast_device *ast = to_ast_device(crtc->dev);
1207+
u8 vgacrb6;
1208+
1209+
ast_set_index_reg_mask(ast, AST_IO_VGASRI, 0x01, 0xdf, AST_IO_VGASR1_SD);
12261210

1227-
ast_crtc_dpms(crtc, DRM_MODE_DPMS_OFF);
1211+
vgacrb6 = AST_IO_VGACRB6_VSYNC_OFF |
1212+
AST_IO_VGACRB6_HSYNC_OFF;
1213+
ast_set_index_reg_mask(ast, AST_IO_VGACRI, 0xb6, 0xfc, vgacrb6);
12281214

12291215
/*
12301216
* HW cursors require the underlying primary plane and CRTC to

drivers/gpu/drm/ast/ast_reg.h

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
#define AST_IO_VGACR80_PASSWORD (0xa8)
3333
#define AST_IO_VGACRA1_VGAIO_DISABLED BIT(1)
3434
#define AST_IO_VGACRA1_MMIO_ENABLED BIT(2)
35+
#define AST_IO_VGACRB6_HSYNC_OFF BIT(0)
36+
#define AST_IO_VGACRB6_VSYNC_OFF BIT(1)
3537
#define AST_IO_VGACRCB_HWC_16BPP BIT(0) /* set: ARGB4444, cleared: 2bpp palette */
3638
#define AST_IO_VGACRCB_HWC_ENABLED BIT(1)
3739

@@ -76,13 +78,6 @@
7678
#define ASTDP_HOST_EDID_READ_DONE BIT(0)
7779
#define ASTDP_HOST_EDID_READ_DONE_MASK GENMASK(0, 0)
7880

79-
/*
80-
* CRB8[b1]: Enable VSYNC off
81-
* CRB8[b0]: Enable HSYNC off
82-
*/
83-
#define AST_DPMS_VSYNC_OFF BIT(1)
84-
#define AST_DPMS_HSYNC_OFF BIT(0)
85-
8681
/*
8782
* CRDF[b4]: Mirror of AST_DP_VIDEO_ENABLE
8883
* Precondition: A. ~AST_DP_PHY_SLEEP &&

0 commit comments

Comments
 (0)