diff options
author | Thomas Zimmermann <tzimmermann@suse.de> | 2021-02-09 16:46:23 +0300 |
---|---|---|
committer | Thomas Zimmermann <tzimmermann@suse.de> | 2021-02-17 14:39:29 +0300 |
commit | 4a11bd1e88af130f50a72e0f54391c1c7d268e03 (patch) | |
tree | 309080965dab66de3552a87c9e2c5e8405057394 /drivers/gpu/drm/ast | |
parent | 99e360442f223dd40fc23ae07c7a263836fd27e6 (diff) | |
download | linux-4a11bd1e88af130f50a72e0f54391c1c7d268e03.tar.xz |
drm/ast: Add constants for VGACRCB register bits
Set the bits in VGACRCB with constants. Alo move the rsp code into a
helper function.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210209134632.12157-2-tzimmermann@suse.de
Diffstat (limited to 'drivers/gpu/drm/ast')
-rw-r--r-- | drivers/gpu/drm/ast/ast_cursor.c | 21 | ||||
-rw-r--r-- | drivers/gpu/drm/ast/ast_drv.h | 3 |
2 files changed, 18 insertions, 6 deletions
diff --git a/drivers/gpu/drm/ast/ast_cursor.c b/drivers/gpu/drm/ast/ast_cursor.c index fac1ee79c372..024858371f64 100644 --- a/drivers/gpu/drm/ast/ast_cursor.c +++ b/drivers/gpu/drm/ast/ast_cursor.c @@ -236,6 +236,19 @@ static void ast_cursor_set_location(struct ast_private *ast, u16 x, u16 y, ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xc7, y1); } +static void ast_set_cursor_enabled(struct ast_private *ast, bool enabled) +{ + static const u8 mask = (u8)~(AST_IO_VGACRCB_HWC_16BPP | + AST_IO_VGACRCB_HWC_ENABLED); + + u8 vgacrcb = AST_IO_VGACRCB_HWC_16BPP; + + if (enabled) + vgacrcb |= AST_IO_VGACRCB_HWC_ENABLED; + + ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xcb, mask, vgacrcb); +} + void ast_cursor_show(struct ast_private *ast, int x, int y, unsigned int offset_x, unsigned int offset_y) { @@ -245,7 +258,6 @@ void ast_cursor_show(struct ast_private *ast, int x, int y, u8 x_offset, y_offset; u8 __iomem *dst; u8 __iomem *sig; - u8 jreg; int ret; ret = drm_gem_vram_vmap(gbo, &map); @@ -274,13 +286,10 @@ void ast_cursor_show(struct ast_private *ast, int x, int y, ast_cursor_set_location(ast, x, y, x_offset, y_offset); - /* dummy write to fire HWC */ - jreg = 0x02 | - 0x01; /* enable ARGB4444 cursor */ - ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xcb, 0xfc, jreg); + ast_set_cursor_enabled(ast, true); /* dummy write to fire HWC */ } void ast_cursor_hide(struct ast_private *ast) { - ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xcb, 0xfc, 0x00); + ast_set_cursor_enabled(ast, false); } diff --git a/drivers/gpu/drm/ast/ast_drv.h b/drivers/gpu/drm/ast/ast_drv.h index f871fc36c2f7..1575e8e636d7 100644 --- a/drivers/gpu/drm/ast/ast_drv.h +++ b/drivers/gpu/drm/ast/ast_drv.h @@ -179,6 +179,9 @@ struct ast_private *ast_device_create(const struct drm_driver *drv, #define AST_IO_VGAIR1_VREFRESH BIT(3) +#define AST_IO_VGACRCB_HWC_ENABLED BIT(1) +#define AST_IO_VGACRCB_HWC_16BPP BIT(0) /* set: ARGB4444, cleared: 2bpp palette */ + #define __ast_read(x) \ static inline u##x ast_read##x(struct ast_private *ast, u32 reg) { \ u##x val = 0;\ |