Skip to content

Commit a9fb41b

Browse files
committed
drm/ast: Clear preserved bits from register output value
Preserve the I/O register bits in __ast_write8_i_masked() as specified by preserve_mask. Accidentally OR-ing the output value into these will overwrite the register's previous settings. Fixes display output on the AST2300, where the screen can go blank at boot. The driver's original commit 312fec1 ("drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)") already added the broken code. Commit 6f71937 ("drm/ast: Blank with VGACR17 sync enable, always clear VGACRB6 sync off") triggered the bug. Signed-off-by: Thomas Zimmermann <[email protected]> Reported-by: Peter Schneider <[email protected]> Closes: https://lore.kernel.org/dri-devel/[email protected]/ Tested-by: Peter Schneider <[email protected]> Reviewed-by: Jocelyn Falempe <[email protected]> Fixes: 6f71937 ("drm/ast: Blank with VGACR17 sync enable, always clear VGACRB6 sync off") Fixes: 312fec1 ("drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)") Cc: Thomas Zimmermann <[email protected]> Cc: Nick Bowler <[email protected]> Cc: Douglas Anderson <[email protected]> Cc: Dave Airlie <[email protected]> Cc: Jocelyn Falempe <[email protected]> Cc: [email protected] Cc: <[email protected]> # v3.5+ Link: https://patch.msgid.link/[email protected]
1 parent bf7e979 commit a9fb41b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/gpu/drm/ast/ast_drv.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -282,13 +282,13 @@ static inline void __ast_write8_i(void __iomem *addr, u32 reg, u8 index, u8 val)
282282
__ast_write8(addr, reg + 1, val);
283283
}
284284

285-
static inline void __ast_write8_i_masked(void __iomem *addr, u32 reg, u8 index, u8 read_mask,
285+
static inline void __ast_write8_i_masked(void __iomem *addr, u32 reg, u8 index, u8 preserve_mask,
286286
u8 val)
287287
{
288-
u8 tmp = __ast_read8_i_masked(addr, reg, index, read_mask);
288+
u8 tmp = __ast_read8_i_masked(addr, reg, index, preserve_mask);
289289

290-
tmp |= val;
291-
__ast_write8_i(addr, reg, index, tmp);
290+
val &= ~preserve_mask;
291+
__ast_write8_i(addr, reg, index, tmp | val);
292292
}
293293

294294
static inline u32 ast_read32(struct ast_device *ast, u32 reg)

0 commit comments

Comments
 (0)