]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/ast: Store DRAM clock table in struct ast_device
authorThomas Zimmermann <tzimmermann@suse.de>
Tue, 7 Oct 2025 14:54:42 +0000 (16:54 +0200)
committerThomas Zimmermann <tzimmermann@suse.de>
Wed, 15 Oct 2025 07:59:40 +0000 (09:59 +0200)
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
drivers/gpu/drm/ast/ast_2000.c
drivers/gpu/drm/ast/ast_2100.c
drivers/gpu/drm/ast/ast_2200.c
drivers/gpu/drm/ast/ast_2300.c
drivers/gpu/drm/ast/ast_2400.c
drivers/gpu/drm/ast/ast_2500.c
drivers/gpu/drm/ast/ast_2600.c
drivers/gpu/drm/ast/ast_drv.h
drivers/gpu/drm/ast/ast_mode.c

index 03b0dcea43d1ada1dfa9cf3d27968646607ebfe3..74a041e9906123e292928be94aba9c7e9aa37c66 100644 (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) {
index 540972daec52c57fe60c15a6dbec70390955acb8..eb3336c84833b5615e4fd81dceabb17fec3ecf30 100644 (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) {
index 4795966dc2a7c9f171aee3f9693c62177a36ff39..391034d5f4250e24539aa35364230ce90d414761 100644 (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) {
index d1d63e58f3d6abdf14d2460c4560828cc7c3ac06..3c9e1960b90c7245a111e30aa269650aa2f7e8d9 100644 (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) {
index 596338ea22f4f11de503147d57bfdb8a5d9eee20..be866d1cd06afc3820c89fe0222517daa2ac73df 100644 (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) {
index 2c56db644f069d3b11722aed4af242d1bf1680f5..086c74682a55154f6bb27466c6c341de086ac9f3 100644 (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) {
index 30490c473797e875c7f869d0a2a8b08949304edb..1f709486f4918dbbd6e7f139c4af3988b77bb20e 100644 (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) {
index 35c476c85b9adc16a8f9f8c9f5addbdd41e88eb5..b2b30a0e4ffbcfa30456c794d288f570bc7814ba 100644 (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;
index 6b9d510c509dfb9101500dcc91b31e60a7a38728..a9ffda1b1dea25ec5e17150e56f627a690185ff2 100644 (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);