Ast's code for detecting the device type and features is convoluted. It mixes up several state fields, chip types and sub-models. Rework the driver into something more understandable. Patches 1 fixes a long-standing bug. The affected code has never worked correctly. Patches 2 to 8 make various changes to the init code, or remove dead and duplicated code paths. Patch 9 introduces chip generations. Until now, ast used the value of enum ast_chip to represent a certain set of related modes, and also used the enum to represent individal models. This makes the driver code hard to understand in certain places. The patch encodes a chip generation in each model enum and converts the driver to use it. Patches 10 to 12 replace duplicated model checks with the correct enum value. Detection of wide-screen functionality and the transmitter chip can then be moved into individual functions in patch 13. Patch 14 merges the detection of the silicon revision and the chip model into a single function. Both need to be done in the same place and affect each other. Tested on AST1100 and AST2300. v2: * use standard 16-bit PCI access (Jingfeng) * various cleanups Thomas Zimmermann (14): drm/ast: Fix DRAM init on AST2200 drm/ast: Remove vga2_clone field drm/ast: Implement register helpers in ast_drv.h drm/ast: Remove dead else branch in POST code drm/ast: Remove device POSTing and config from chip detection drm/ast: Set PCI config before accessing I/O registers drm/ast: Enable and unlock device access early during init drm/ast: Set up release action right after enabling MMIO drm/ast: Distinguish among chip generations drm/ast: Detect AST 1300 model drm/ast: Detect AST 1400 model drm/ast: Detect AST 2510 model drm/ast: Move widescreen and tx-chip detection into separate helpers drm/ast: Merge config and chip detection drivers/gpu/drm/ast/ast_dp501.c | 6 +- drivers/gpu/drm/ast/ast_drv.h | 94 +++++++--- drivers/gpu/drm/ast/ast_main.c | 319 +++++++++++++++++++------------- drivers/gpu/drm/ast/ast_mm.c | 2 - drivers/gpu/drm/ast/ast_mode.c | 35 ++-- drivers/gpu/drm/ast/ast_post.c | 74 ++------ 6 files changed, 290 insertions(+), 240 deletions(-) base-commit: 32e260cd0d16cee6f33e747679f168d63ea54bf6 prerequisite-patch-id: 0aa359f6144c4015c140c8a6750be19099c676fb prerequisite-patch-id: c67e5d886a47b7d0266d81100837557fda34cb24 prerequisite-patch-id: cbc453ee02fae02af22fbfdce56ab732c7a88c36 prerequisite-patch-id: d3145eae4b35a1290199af6ff6cd5abfebc82033 prerequisite-patch-id: 242b6bc45675f1f1a62572542d75c89d4864f15a -- 2.41.0