summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/ast
diff options
context:
space:
mode:
authorThomas Zimmermann <tzimmermann@suse.de>2023-06-21 14:53:47 +0200
committerThomas Zimmermann <tzimmermann@suse.de>2023-06-27 14:26:40 +0200
commit546b959ed7aade7a74fe5874adbd89886c5c6d8a (patch)
tree50d2df857236811546c1696be7c1ab3b55befc61 /drivers/gpu/drm/ast
parent52c29330ebdd592483a98f5e46c60af83084cc7f (diff)
downloadlinux-546b959ed7aade7a74fe5874adbd89886c5c6d8a.tar.gz
linux-546b959ed7aade7a74fe5874adbd89886c5c6d8a.tar.bz2
linux-546b959ed7aade7a74fe5874adbd89886c5c6d8a.zip
drm/ast: Move widescreen and tx-chip detection into separate helpers
Split ast_detect_chip() into three functions and call them one by one. The new functions detect the transmitter chip and widescreen support. This will allow for further refactoring. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Sui Jingfeng <suijingfeng@loongson.cn> Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com> Tested-by: Jocelyn Falempe <jfalempe@redhat.com> # AST2600 Tested-by: Sui Jingfeng <suijingfeng@loongson.cn> # AST2400 Link: https://patchwork.freedesktop.org/patch/msgid/20230621130032.3568-14-tzimmermann@suse.de
Diffstat (limited to 'drivers/gpu/drm/ast')
-rw-r--r--drivers/gpu/drm/ast/ast_main.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/drivers/gpu/drm/ast/ast_main.c b/drivers/gpu/drm/ast/ast_main.c
index f2f8a054c52c..7ade96f1f37f 100644
--- a/drivers/gpu/drm/ast/ast_main.c
+++ b/drivers/gpu/drm/ast/ast_main.c
@@ -156,7 +156,6 @@ static int ast_detect_chip(struct drm_device *dev, bool need_post, u32 scu_rev)
{
struct ast_device *ast = to_ast_device(dev);
struct pci_dev *pdev = to_pci_dev(dev->dev);
- uint32_t jreg;
/* Identify chipset */
if (pdev->revision >= 0x50) {
@@ -217,6 +216,13 @@ static int ast_detect_chip(struct drm_device *dev, bool need_post, u32 scu_rev)
drm_info(dev, "AST 2000 detected\n");
}
+ return 0;
+}
+
+static void ast_detect_widescreen(struct ast_device *ast)
+{
+ u8 jreg;
+
/* Check if we support wide screen */
switch (AST_GEN(ast)) {
case 1:
@@ -241,6 +247,12 @@ static int ast_detect_chip(struct drm_device *dev, bool need_post, u32 scu_rev)
}
break;
}
+}
+
+static void ast_detect_tx_chip(struct ast_device *ast, bool need_post)
+{
+ struct drm_device *dev = &ast->base;
+ u8 jreg;
/* Check 3rd Tx option (digital output afaik) */
ast->tx_chip_types |= AST_TX_NONE_BIT;
@@ -300,8 +312,6 @@ static int ast_detect_chip(struct drm_device *dev, bool need_post, u32 scu_rev)
drm_info(dev, "Using DP501 DisplayPort transmitter\n");
if (ast->tx_chip_types & AST_TX_ASTDP_BIT)
drm_info(dev, "Using ASPEED DisplayPort transmitter\n");
-
- return 0;
}
static int ast_get_dram_info(struct drm_device *dev)
@@ -493,6 +503,8 @@ struct ast_device *ast_device_create(const struct drm_driver *drv,
ast_detect_config_mode(dev, &scu_rev);
ast_detect_chip(dev, need_post, scu_rev);
+ ast_detect_widescreen(ast);
+ ast_detect_tx_chip(ast, need_post);
ret = ast_get_dram_info(dev);
if (ret)