Init the new field dclk_table in struct ast_device to the per-gen
table of DRAM clock parameters. Use the field during modesetting.
The table is static, so a setup is only required once. Removes the
call to IS_AST_GEN() from the atomic commit's code path.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Link: https://lore.kernel.org/r/20251007150343.273718-2-tzimmermann@suse.de
ast_device_init(ast, chip, config_mode, regs, ioregs);
+ ast->dclk_table = ast_2000_dclk_table;
+
ast_2000_detect_tx_chip(ast, need_post);
if (need_post) {
ast_device_init(ast, chip, config_mode, regs, ioregs);
+ ast->dclk_table = ast_2000_dclk_table;
+
ast_2000_detect_tx_chip(ast, need_post);
if (need_post) {
ast_device_init(ast, chip, config_mode, regs, ioregs);
+ ast->dclk_table = ast_2000_dclk_table;
+
ast_2000_detect_tx_chip(ast, need_post);
if (need_post) {
ast_device_init(ast, chip, config_mode, regs, ioregs);
+ ast->dclk_table = ast_2000_dclk_table;
+
ast_2300_detect_tx_chip(ast);
if (need_post) {
ast_device_init(ast, chip, config_mode, regs, ioregs);
+ ast->dclk_table = ast_2000_dclk_table;
+
ast_2300_detect_tx_chip(ast);
if (need_post) {
ast_device_init(ast, chip, config_mode, regs, ioregs);
+ ast->dclk_table = ast_2500_dclk_table;
+
ast_2300_detect_tx_chip(ast);
if (need_post) {
ast_device_init(ast, chip, config_mode, regs, ioregs);
+ ast->dclk_table = ast_2500_dclk_table;
+
ast_2300_detect_tx_chip(ast);
switch (ast->tx_chip) {
enum ast_config_mode config_mode;
enum ast_chip chip;
+ const struct ast_vbios_dclk_info *dclk_table;
+
void __iomem *vram;
unsigned long vram_base;
unsigned long vram_size;
struct drm_display_mode *mode,
const struct ast_vbios_enhtable *vmode)
{
- const struct ast_vbios_dclk_info *clk_info;
-
- if (IS_AST_GEN6(ast) || IS_AST_GEN7(ast))
- clk_info = &ast_2500_dclk_table[vmode->dclk_index];
- else
- clk_info = &ast_2000_dclk_table[vmode->dclk_index];
+ const struct ast_vbios_dclk_info *clk_info = &ast->dclk_table[vmode->dclk_index];
ast_set_index_reg_mask(ast, AST_IO_VGACRI, 0xc0, 0x00, clk_info->param1);
ast_set_index_reg_mask(ast, AST_IO_VGACRI, 0xc1, 0x00, clk_info->param2);