From 510f653f55381cb0efa3be157b2a62571cb3d219 Mon Sep 17 00:00:00 2001
From: Takashi Iwai <tiwai@suse.de>
Date: Wed, 21 Apr 2021 13:12:48 +0200
Subject: [PATCH 09/11] drm/ast: Add support for AIP200
Patch-mainline: Never, temporary fixes until upstream resolution
References: bsc#1174416
A code snippet forward-ported from A-Speed downstream driver.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
drivers/gpu/drm/ast/ast_drv.c | 1 +
drivers/gpu/drm/ast/ast_drv.h | 2 ++
drivers/gpu/drm/ast/ast_main.c | 5 +++++
drivers/gpu/drm/ast/ast_mode.c | 5 +++--
drivers/gpu/drm/ast/ast_post.c | 4 ++--
5 files changed, 13 insertions(+), 4 deletions(-)
--- a/drivers/gpu/drm/ast/ast_drv.c
+++ b/drivers/gpu/drm/ast/ast_drv.c
@@ -55,6 +55,7 @@ static struct drm_driver driver;
static const struct pci_device_id pciidlist[] = {
AST_VGA_DEVICE(PCI_CHIP_AST2000, NULL),
AST_VGA_DEVICE(PCI_CHIP_AST2100, NULL),
+ AST_VGA_DEVICE(PCI_CHIP_AIP200, NULL),
/* AST_VGA_DEVICE(PCI_CHIP_AST1180, NULL), - don't bind to 1180 for now */
{0, 0, 0},
};
--- a/drivers/gpu/drm/ast/ast_drv.h
+++ b/drivers/gpu/drm/ast/ast_drv.h
@@ -52,6 +52,7 @@
#define PCI_CHIP_AST2000 0x2000
#define PCI_CHIP_AST2100 0x2010
#define PCI_CHIP_AST1180 0x1180
+#define PCI_CHIP_AIP200 0xA200
enum ast_chip {
@@ -64,6 +65,7 @@ enum ast_chip {
AST2400,
AST2500,
AST1180,
+ AIP200,
};
enum ast_tx_chip {
--- a/drivers/gpu/drm/ast/ast_main.c
+++ b/drivers/gpu/drm/ast/ast_main.c
@@ -157,6 +157,9 @@ static int ast_detect_chip(struct drm_de
if (dev->pdev->device == PCI_CHIP_AST1180) {
ast->chip = AST1100;
DRM_INFO("AST 1180 detected\n");
+ } else if (dev->pdev->device == PCI_CHIP_AIP200) {
+ ast->chip = AIP200;
+ DRM_INFO("AIP 200 detected\n");
} else {
if (dev->pdev->revision >= 0x40) {
ast->chip = AST2500;
@@ -195,6 +198,7 @@ static int ast_detect_chip(struct drm_de
/* Check if we support wide screen */
switch (ast->chip) {
+ case AIP200:
case AST1180:
ast->support_wide_screen = true;
break;
@@ -579,6 +583,7 @@ int ast_driver_load(struct drm_device *d
ast->chip == AST2300 ||
ast->chip == AST2400 ||
ast->chip == AST2500 ||
+ ast->chip == AIP200 ||
ast->chip == AST1180) {
dev->mode_config.max_width = 1920;
dev->mode_config.max_height = 2048;
--- a/drivers/gpu/drm/ast/ast_mode.c
+++ b/drivers/gpu/drm/ast/ast_mode.c
@@ -443,7 +443,7 @@ static void ast_set_ext_reg(struct drm_c
/* Set Threshold */
if (ast->chip == AST2300 || ast->chip == AST2400 ||
- ast->chip == AST2500) {
+ ast->chip == AST2500 || ast->chip == AIP200) {
ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa7, 0x78);
ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa6, 0x60);
} else if (ast->chip == AST2100 ||
@@ -822,7 +822,8 @@ static enum drm_mode_status ast_mode_val
if ((ast->chip == AST2100) || (ast->chip == AST2200) ||
(ast->chip == AST2300) || (ast->chip == AST2400) ||
- (ast->chip == AST2500) || (ast->chip == AST1180)) {
+ (ast->chip == AST2500) || (ast->chip == AST1180) ||
+ (ast->chip == AIP200)) {
if ((mode->hdisplay == 1920) && (mode->vdisplay == 1080))
return MODE_OK;
--- a/drivers/gpu/drm/ast/ast_post.c
+++ b/drivers/gpu/drm/ast/ast_post.c
@@ -82,7 +82,7 @@ ast_set_def_ext_reg(struct drm_device *d
ast_set_index_reg(ast, AST_IO_CRTC_PORT, i, 0x00);
if (ast->chip == AST2300 || ast->chip == AST2400 ||
- ast->chip == AST2500) {
+ ast->chip == AST2500 || ast->chip == AIP200) {
if (dev->pdev->revision >= 0x20)
ext_reg_info = extreginfo_ast2300;
else
@@ -107,7 +107,7 @@ ast_set_def_ext_reg(struct drm_device *d
/* Enable RAMDAC for A1 */
reg = 0x04;
if (ast->chip == AST2300 || ast->chip == AST2400 ||
- ast->chip == AST2500)
+ ast->chip == AST2500 || ast->chip == AIP200)
reg |= 0x20;
ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb6, 0xff, reg);