drm/ast: Store DRAM clock table in struct ast_device

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
This commit is contained in:
Thomas Zimmermann
2025-10-07 16:54:42 +02:00
parent b076ed3017
commit 4b3374d790
9 changed files with 17 additions and 6 deletions

View File

@@ -230,6 +230,8 @@ struct drm_device *ast_2000_device_create(struct pci_dev *pdev,
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) {

View File

@@ -451,6 +451,8 @@ struct drm_device *ast_2100_device_create(struct pci_dev *pdev,
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) {

View File

@@ -62,6 +62,8 @@ struct drm_device *ast_2200_device_create(struct pci_dev *pdev,
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) {

View File

@@ -1426,6 +1426,8 @@ struct drm_device *ast_2300_device_create(struct pci_dev *pdev,
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) {

View File

@@ -63,6 +63,8 @@ struct drm_device *ast_2400_device_create(struct pci_dev *pdev,
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) {

View File

@@ -637,6 +637,8 @@ struct drm_device *ast_2500_device_create(struct pci_dev *pdev,
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) {

View File

@@ -78,6 +78,8 @@ struct drm_device *ast_2600_device_create(struct pci_dev *pdev,
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) {

View File

@@ -174,6 +174,8 @@ struct ast_device {
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;

View File

@@ -370,12 +370,7 @@ static void ast_set_dclk_reg(struct ast_device *ast,
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);