Lines Matching defs:ast

38 static void ast_detect_widescreen(struct ast_device *ast)
43 switch (AST_GEN(ast)) {
45 ast->support_wide_screen = false;
48 jreg = ast_get_index_reg_mask(ast, AST_IO_VGACRI, 0xd0, 0xff);
50 ast->support_wide_screen = true;
52 ast->support_wide_screen = true;
54 ast->support_wide_screen = false;
55 if (ast->chip == AST1300)
56 ast->support_wide_screen = true;
57 if (ast->chip == AST1400)
58 ast->support_wide_screen = true;
59 if (ast->chip == AST2510)
60 ast->support_wide_screen = true;
61 if (IS_AST_GEN7(ast))
62 ast->support_wide_screen = true;
68 static void ast_detect_tx_chip(struct ast_device *ast, bool need_post)
70 struct drm_device *dev = &ast->base;
74 ast->tx_chip_types |= AST_TX_NONE_BIT;
85 jreg = ast_get_index_reg_mask(ast, AST_IO_VGACRI, 0xa3, 0xff);
87 ast->tx_chip_types = AST_TX_SIL164_BIT;
90 if (IS_AST_GEN4(ast) || IS_AST_GEN5(ast) || IS_AST_GEN6(ast)) {
96 jreg = ast_get_index_reg_mask(ast, AST_IO_VGACRI, 0xd1, 0xff);
99 ast->tx_chip_types = AST_TX_SIL164_BIT;
102 ast->dp501_fw_addr = drmm_kzalloc(dev, 32*1024, GFP_KERNEL);
103 if (ast->dp501_fw_addr) {
105 if (ast_backup_fw(dev, ast->dp501_fw_addr, 32*1024)) {
106 drmm_kfree(dev, ast->dp501_fw_addr);
107 ast->dp501_fw_addr = NULL;
112 ast->tx_chip_types = AST_TX_DP501_BIT;
114 } else if (IS_AST_GEN7(ast)) {
115 if (ast_get_index_reg_mask(ast, AST_IO_VGACRI, 0xD1, TX_TYPE_MASK) ==
117 ast->tx_chip_types = AST_TX_ASTDP_BIT;
118 ast_dp_launch(&ast->base);
123 if (ast->tx_chip_types & AST_TX_NONE_BIT)
125 if (ast->tx_chip_types & AST_TX_SIL164_BIT)
127 if (ast->tx_chip_types & AST_TX_DP501_BIT)
129 if (ast->tx_chip_types & AST_TX_ASTDP_BIT)
136 struct ast_device *ast = to_ast_device(dev);
140 switch (ast->config_mode) {
157 ast_write32(ast, 0xf004, 0x1e6e0000);
158 ast_write32(ast, 0xf000, 0x1);
159 mcr_cfg = ast_read32(ast, 0x10004);
160 mcr_scu_mpll = ast_read32(ast, 0x10120);
161 mcr_scu_strap = ast_read32(ast, 0x10170);
165 ast->dram_bus_width = 16;
166 ast->dram_type = AST_DRAM_1Gx16;
167 if (IS_AST_GEN6(ast))
168 ast->mclk = 800;
170 ast->mclk = 396;
175 ast->dram_bus_width = 16;
177 ast->dram_bus_width = 32;
179 if (IS_AST_GEN6(ast)) {
182 ast->dram_type = AST_DRAM_1Gx16;
186 ast->dram_type = AST_DRAM_2Gx16;
189 ast->dram_type = AST_DRAM_4Gx16;
192 ast->dram_type = AST_DRAM_8Gx16;
195 } else if (IS_AST_GEN4(ast) || IS_AST_GEN5(ast)) {
198 ast->dram_type = AST_DRAM_512Mx16;
202 ast->dram_type = AST_DRAM_1Gx16;
205 ast->dram_type = AST_DRAM_2Gx16;
208 ast->dram_type = AST_DRAM_4Gx16;
215 ast->dram_type = AST_DRAM_512Mx16;
219 ast->dram_type = AST_DRAM_1Gx16;
221 ast->dram_type = AST_DRAM_512Mx32;
224 ast->dram_type = AST_DRAM_1Gx32;
249 ast->mclk = ref_pll * (num + 2) / ((denum + 2) * (div * 1000));
262 struct ast_device *ast;
265 ast = devm_drm_dev_alloc(&pdev->dev, drv, struct ast_device, base);
266 if (IS_ERR(ast))
267 return ERR_CAST(ast);
268 dev = &ast->base;
270 ast->chip = chip;
271 ast->config_mode = config_mode;
272 ast->regs = regs;
273 ast->ioregs = ioregs;
275 ast_detect_widescreen(ast);
276 ast_detect_tx_chip(ast, need_post);
283 ast->mclk, ast->dram_type, ast->dram_bus_width);
288 ret = ast_mm_init(ast);
293 ast->dp501_fw_buf = NULL;
294 if (ast->vram_size < pci_resource_len(pdev, 0)) {
295 ast->dp501_fw_buf = pci_iomap_range(pdev, 0, ast->vram_size, 0);
296 if (!ast->dp501_fw_buf)
300 ret = ast_mode_config_init(ast);