hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/gpu/drm/ast/ast_post.c
....@@ -26,17 +26,20 @@
2626 * Authors: Dave Airlie <airlied@redhat.com>
2727 */
2828
29
-#include <drm/drmP.h>
30
-#include "ast_drv.h"
29
+#include <linux/delay.h>
30
+#include <linux/pci.h>
31
+
32
+#include <drm/drm_print.h>
3133
3234 #include "ast_dram_tables.h"
35
+#include "ast_drv.h"
3336
3437 static void ast_post_chip_2300(struct drm_device *dev);
3538 static void ast_post_chip_2500(struct drm_device *dev);
3639
3740 void ast_enable_vga(struct drm_device *dev)
3841 {
39
- struct ast_private *ast = dev->dev_private;
42
+ struct ast_private *ast = to_ast_private(dev);
4043
4144 ast_io_write8(ast, AST_IO_VGA_ENABLE_PORT, 0x01);
4245 ast_io_write8(ast, AST_IO_MISC_PORT_WRITE, 0x01);
....@@ -44,7 +47,7 @@
4447
4548 void ast_enable_mmio(struct drm_device *dev)
4649 {
47
- struct ast_private *ast = dev->dev_private;
50
+ struct ast_private *ast = to_ast_private(dev);
4851
4952 ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa1, 0x06);
5053 }
....@@ -52,16 +55,12 @@
5255
5356 bool ast_is_vga_enabled(struct drm_device *dev)
5457 {
55
- struct ast_private *ast = dev->dev_private;
58
+ struct ast_private *ast = to_ast_private(dev);
5659 u8 ch;
5760
58
- if (ast->chip == AST1180) {
59
- /* TODO 1180 */
60
- } else {
61
- ch = ast_io_read8(ast, AST_IO_VGA_ENABLE_PORT);
62
- return !!(ch & 0x01);
63
- }
64
- return false;
61
+ ch = ast_io_read8(ast, AST_IO_VGA_ENABLE_PORT);
62
+
63
+ return !!(ch & 0x01);
6564 }
6665
6766 static const u8 extreginfo[] = { 0x0f, 0x04, 0x1c, 0xff };
....@@ -71,7 +70,7 @@
7170 static void
7271 ast_set_def_ext_reg(struct drm_device *dev)
7372 {
74
- struct ast_private *ast = dev->dev_private;
73
+ struct ast_private *ast = to_ast_private(dev);
7574 u8 i, index, reg;
7675 const u8 *ext_reg_info;
7776
....@@ -273,7 +272,7 @@
273272
274273 static void ast_init_dram_reg(struct drm_device *dev)
275274 {
276
- struct ast_private *ast = dev->dev_private;
275
+ struct ast_private *ast = to_ast_private(dev);
277276 u8 j;
278277 u32 data, temp, i;
279278 const struct ast_dramstruct *dram_reg_info;
....@@ -366,12 +365,12 @@
366365
367366 void ast_post_gpu(struct drm_device *dev)
368367 {
368
+ struct ast_private *ast = to_ast_private(dev);
369369 u32 reg;
370
- struct ast_private *ast = dev->dev_private;
371370
372
- pci_read_config_dword(ast->dev->pdev, 0x04, &reg);
371
+ pci_read_config_dword(dev->pdev, 0x04, &reg);
373372 reg |= 0x3;
374
- pci_write_config_dword(ast->dev->pdev, 0x04, reg);
373
+ pci_write_config_dword(dev->pdev, 0x04, reg);
375374
376375 ast_enable_vga(dev);
377376 ast_open_key(ast);
....@@ -1597,7 +1596,7 @@
15971596
15981597 static void ast_post_chip_2300(struct drm_device *dev)
15991598 {
1600
- struct ast_private *ast = dev->dev_private;
1599
+ struct ast_private *ast = to_ast_private(dev);
16011600 struct ast2300_dram_param param;
16021601 u32 temp;
16031602 u8 reg;
....@@ -2029,7 +2028,7 @@
20292028
20302029 void ast_post_chip_2500(struct drm_device *dev)
20312030 {
2032
- struct ast_private *ast = dev->dev_private;
2031
+ struct ast_private *ast = to_ast_private(dev);
20332032 u32 temp;
20342033 u8 reg;
20352034
....@@ -2068,7 +2067,7 @@
20682067 }
20692068
20702069 if (!ast_dram_init_2500(ast))
2071
- DRM_ERROR("DRAM init failed !\n");
2070
+ drm_err(dev, "DRAM init failed !\n");
20722071
20732072 temp = ast_mindwm(ast, 0x1e6e2040);
20742073 ast_moutdwm(ast, 0x1e6e2040, temp | 0x40);