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
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;\
|
||||
|
||||
Reference in New Issue
Block a user