Lines Matching refs:ast
54 static inline void ast_load_palette_index(struct ast_private *ast, in ast_load_palette_index() argument
58 ast_io_write8(ast, AST_IO_DAC_INDEX_WRITE, index); in ast_load_palette_index()
59 ast_io_read8(ast, AST_IO_SEQ_PORT); in ast_load_palette_index()
60 ast_io_write8(ast, AST_IO_DAC_DATA, red); in ast_load_palette_index()
61 ast_io_read8(ast, AST_IO_SEQ_PORT); in ast_load_palette_index()
62 ast_io_write8(ast, AST_IO_DAC_DATA, green); in ast_load_palette_index()
63 ast_io_read8(ast, AST_IO_SEQ_PORT); in ast_load_palette_index()
64 ast_io_write8(ast, AST_IO_DAC_DATA, blue); in ast_load_palette_index()
65 ast_io_read8(ast, AST_IO_SEQ_PORT); in ast_load_palette_index()
70 struct ast_private *ast = crtc->dev->dev_private; in ast_crtc_load_lut() local
82 ast_load_palette_index(ast, i, *r++ >> 8, *g++ >> 8, *b++ >> 8); in ast_crtc_load_lut()
89 struct ast_private *ast = crtc->dev->dev_private; in ast_get_vbios_mode_info() local
209 if (ast->chip == AST1180) { in ast_get_vbios_mode_info()
212 ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x8c, (u8)((color_index & 0xf) << 4)); in ast_get_vbios_mode_info()
213 ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x8d, refresh_rate_index & 0xff); in ast_get_vbios_mode_info()
214 ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x8e, mode_id & 0xff); in ast_get_vbios_mode_info()
216 ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x91, 0x00); in ast_get_vbios_mode_info()
218 ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x91, 0xa8); in ast_get_vbios_mode_info()
219 ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x92, in ast_get_vbios_mode_info()
221 ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x93, adjusted_mode->clock / 1000); in ast_get_vbios_mode_info()
222 ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x94, adjusted_mode->crtc_hdisplay); in ast_get_vbios_mode_info()
223 ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x95, adjusted_mode->crtc_hdisplay >> 8); in ast_get_vbios_mode_info()
225 ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x96, adjusted_mode->crtc_vdisplay); in ast_get_vbios_mode_info()
226 ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x97, adjusted_mode->crtc_vdisplay >> 8); in ast_get_vbios_mode_info()
237 struct ast_private *ast = crtc->dev->dev_private; in ast_set_std_reg() local
245 ast_io_write8(ast, AST_IO_MISC_PORT_WRITE, jreg); in ast_set_std_reg()
248 ast_set_index_reg(ast, AST_IO_SEQ_PORT, 0x00, 0x03); in ast_set_std_reg()
253 ast_set_index_reg(ast, AST_IO_SEQ_PORT, (i + 1) , jreg); in ast_set_std_reg()
257 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x11, 0x7f, 0x00); in ast_set_std_reg()
259 ast_set_index_reg(ast, AST_IO_CRTC_PORT, i, stdtable->crtc[i]); in ast_set_std_reg()
262 jreg = ast_io_read8(ast, AST_IO_INPUT_STATUS1_READ); in ast_set_std_reg()
265 ast_io_write8(ast, AST_IO_AR_PORT_WRITE, (u8)i); in ast_set_std_reg()
266 ast_io_write8(ast, AST_IO_AR_PORT_WRITE, jreg); in ast_set_std_reg()
268 ast_io_write8(ast, AST_IO_AR_PORT_WRITE, 0x14); in ast_set_std_reg()
269 ast_io_write8(ast, AST_IO_AR_PORT_WRITE, 0x00); in ast_set_std_reg()
271 jreg = ast_io_read8(ast, AST_IO_INPUT_STATUS1_READ); in ast_set_std_reg()
272 ast_io_write8(ast, AST_IO_AR_PORT_WRITE, 0x20); in ast_set_std_reg()
276 ast_set_index_reg(ast, AST_IO_GR_PORT, i, stdtable->gr[i]); in ast_set_std_reg()
282 struct ast_private *ast = crtc->dev->dev_private; in ast_set_crtc_reg() local
286 if ((ast->chip == AST2500) && in ast_set_crtc_reg()
290 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x11, 0x7f, 0x00); in ast_set_crtc_reg()
295 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x00, 0x00, temp); in ast_set_crtc_reg()
300 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x01, 0x00, temp); in ast_set_crtc_reg()
305 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x02, 0x00, temp); in ast_set_crtc_reg()
312 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x03, 0xE0, (temp & 0x1f)); in ast_set_crtc_reg()
317 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x04, 0x00, temp); in ast_set_crtc_reg()
322 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x05, 0x60, (u8)((temp & 0x1f) | jreg05)); in ast_set_crtc_reg()
324 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xAC, 0x00, jregAC); in ast_set_crtc_reg()
325 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xAD, 0x00, jregAD); in ast_set_crtc_reg()
335 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x06, 0x00, temp); in ast_set_crtc_reg()
344 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x10, 0x00, temp); in ast_set_crtc_reg()
351 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x11, 0x70, temp & 0xf); in ast_set_crtc_reg()
360 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x12, 0x00, temp); in ast_set_crtc_reg()
369 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x15, 0x00, temp); in ast_set_crtc_reg()
374 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x16, 0x00, temp); in ast_set_crtc_reg()
376 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x07, 0x00, jreg07); in ast_set_crtc_reg()
377 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x09, 0xdf, jreg09); in ast_set_crtc_reg()
378 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xAE, 0x00, (jregAE | 0x80)); in ast_set_crtc_reg()
381 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb6, 0x3f, 0x80); in ast_set_crtc_reg()
383 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb6, 0x3f, 0x00); in ast_set_crtc_reg()
385 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x11, 0x7f, 0x80); in ast_set_crtc_reg()
390 struct ast_private *ast = crtc->dev->dev_private; in ast_set_offset_reg() local
396 ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x13, (offset & 0xff)); in ast_set_offset_reg()
397 ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xb0, (offset >> 8) & 0x3f); in ast_set_offset_reg()
403 struct ast_private *ast = dev->dev_private; in ast_set_dclk_reg() local
406 if (ast->chip == AST2500) in ast_set_dclk_reg()
411 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xc0, 0x00, clk_info->param1); in ast_set_dclk_reg()
412 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xc1, 0x00, clk_info->param2); in ast_set_dclk_reg()
413 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xbb, 0x0f, in ast_set_dclk_reg()
421 struct ast_private *ast = crtc->dev->dev_private; in ast_set_ext_reg() local
444 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xa0, 0x8f, jregA0); in ast_set_ext_reg()
445 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xa3, 0xf0, jregA3); in ast_set_ext_reg()
446 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xa8, 0xfd, jregA8); in ast_set_ext_reg()
449 if (ast->chip == AST2300 || ast->chip == AST2400 || in ast_set_ext_reg()
450 ast->chip == AST2500) { in ast_set_ext_reg()
451 ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa7, 0x78); in ast_set_ext_reg()
452 ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa6, 0x60); in ast_set_ext_reg()
453 } else if (ast->chip == AST2100 || in ast_set_ext_reg()
454 ast->chip == AST1100 || in ast_set_ext_reg()
455 ast->chip == AST2200 || in ast_set_ext_reg()
456 ast->chip == AST2150) { in ast_set_ext_reg()
457 ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa7, 0x3f); in ast_set_ext_reg()
458 ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa6, 0x2f); in ast_set_ext_reg()
460 ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa7, 0x2f); in ast_set_ext_reg()
461 ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa6, 0x1f); in ast_set_ext_reg()
468 struct ast_private *ast = dev->dev_private; in ast_set_sync_reg() local
471 jreg = ast_io_read8(ast, AST_IO_MISC_PORT_READ); in ast_set_sync_reg()
475 ast_io_write8(ast, AST_IO_MISC_PORT_WRITE, jreg); in ast_set_sync_reg()
494 struct ast_private *ast = crtc->dev->dev_private; in ast_set_start_address_crt1() local
498 ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x0d, (u8)(addr & 0xff)); in ast_set_start_address_crt1()
499 ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x0c, (u8)((addr >> 8) & 0xff)); in ast_set_start_address_crt1()
500 ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xaf, (u8)((addr >> 16) & 0xff)); in ast_set_start_address_crt1()
506 struct ast_private *ast = crtc->dev->dev_private; in ast_crtc_dpms() local
508 if (ast->chip == AST1180) in ast_crtc_dpms()
515 ast_set_index_reg_mask(ast, AST_IO_SEQ_PORT, 0x1, 0xdf, 0); in ast_crtc_dpms()
516 if (ast->tx_chip_type == AST_TX_DP501) in ast_crtc_dpms()
521 if (ast->tx_chip_type == AST_TX_DP501) in ast_crtc_dpms()
523 ast_set_index_reg_mask(ast, AST_IO_SEQ_PORT, 0x1, 0xdf, 0x20); in ast_crtc_dpms()
575 struct ast_private *ast = crtc->dev->dev_private; in ast_crtc_mode_set() local
578 if (ast->chip == AST1180) { in ast_crtc_mode_set()
586 ast_open_key(ast); in ast_crtc_mode_set()
588 ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa1, 0x06); in ast_crtc_mode_set()
624 struct ast_private *ast = crtc->dev->dev_private; in ast_crtc_commit() local
625 ast_set_index_reg_mask(ast, AST_IO_SEQ_PORT, 0x1, 0xdf, 0); in ast_crtc_commit()
753 struct ast_private *ast = connector->dev->dev_private; in ast_get_modes() local
757 if (ast->tx_chip_type == AST_TX_DP501) { in ast_get_modes()
758 ast->dp501_maxclk = 0xff; in ast_get_modes()
765 ast->dp501_maxclk = ast_get_dp501_max_clk(connector->dev); in ast_get_modes()
784 struct ast_private *ast = connector->dev->dev_private; in ast_mode_valid() local
788 if (ast->support_wide_screen) { in ast_mode_valid()
800 if ((ast->chip == AST2100) || (ast->chip == AST2200) || in ast_mode_valid()
801 (ast->chip == AST2300) || (ast->chip == AST2400) || in ast_mode_valid()
802 (ast->chip == AST2500) || (ast->chip == AST1180)) { in ast_mode_valid()
807 jtemp = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xd1, 0xff); in ast_mode_valid()
897 struct ast_private *ast = dev->dev_private; in ast_cursor_init() local
928 ast->cursor_cache = obj; in ast_cursor_init()
936 struct ast_private *ast = dev->dev_private; in ast_cursor_fini() local
938 drm_gem_vram_of_gem(ast->cursor_cache); in ast_cursor_fini()
941 drm_gem_object_put_unlocked(ast->cursor_cache); in ast_cursor_fini()
961 struct ast_private *ast = i2c->dev->dev_private; in get_clock() local
966 val = (ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x10) >> 4) & 0x01; in get_clock()
968 val2 = (ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x10) >> 4) & 0x01; in get_clock()
973 val = (ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x10) >> 4) & 0x01; in get_clock()
983 struct ast_private *ast = i2c->dev->dev_private; in get_data() local
988 val = (ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x20) >> 5) & 0x01; in get_data()
990 val2 = (ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x20) >> 5) & 0x01; in get_data()
995 val = (ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x20) >> 5) & 0x01; in get_data()
1005 struct ast_private *ast = i2c->dev->dev_private; in set_clock() local
1011 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0xf4, ujcrb7); in set_clock()
1012 jtemp = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x01); in set_clock()
1021 struct ast_private *ast = i2c->dev->dev_private; in set_data() local
1027 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0xf1, ujcrb7); in set_data()
1028 jtemp = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x04); in set_data()
1081 struct ast_private *ast = crtc->dev->dev_private; in ast_show_cursor() local
1087 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xcb, 0xfc, jreg); in ast_show_cursor()
1092 struct ast_private *ast = crtc->dev->dev_private; in ast_hide_cursor() local
1093 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xcb, 0xfc, 0x00); in ast_hide_cursor()
1158 struct ast_private *ast = crtc->dev->dev_private; in ast_cursor_set() local
1192 dst = drm_gem_vram_kmap(drm_gem_vram_of_gem(ast->cursor_cache), in ast_cursor_set()
1198 dst_gpu = drm_gem_vram_offset(drm_gem_vram_of_gem(ast->cursor_cache)); in ast_cursor_set()
1204 dst += (AST_HWC_SIZE + AST_HWC_SIGNATURE_SIZE)*ast->next_cursor; in ast_cursor_set()
1212 drm_gem_vram_of_gem(ast->cursor_cache); in ast_cursor_set()
1214 dst += (AST_HWC_SIZE + AST_HWC_SIGNATURE_SIZE)*ast->next_cursor + AST_HWC_SIZE; in ast_cursor_set()
1223 gpu_addr += (AST_HWC_SIZE + AST_HWC_SIGNATURE_SIZE)*ast->next_cursor; in ast_cursor_set()
1225 ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xc8, gpu_addr & 0xff); in ast_cursor_set()
1226 ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xc9, (gpu_addr >> 8) & 0xff); in ast_cursor_set()
1227 ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xca, (gpu_addr >> 16) & 0xff); in ast_cursor_set()
1232 ast->next_cursor = (ast->next_cursor + 1) % AST_DEFAULT_HWC_NUM; in ast_cursor_set()
1255 struct ast_private *ast = crtc->dev->dev_private; in ast_cursor_move() local
1259 sig = drm_gem_vram_kmap(drm_gem_vram_of_gem(ast->cursor_cache), in ast_cursor_move()
1261 sig += (AST_HWC_SIZE + AST_HWC_SIGNATURE_SIZE)*ast->next_cursor + AST_HWC_SIZE; in ast_cursor_move()
1276 ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xc2, x_offset); in ast_cursor_move()
1277 ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xc3, y_offset); in ast_cursor_move()
1278 ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xc4, (x & 0xff)); in ast_cursor_move()
1279 ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xc5, ((x >> 8) & 0x0f)); in ast_cursor_move()
1280 ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xc6, (y & 0xff)); in ast_cursor_move()
1281 ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xc7, ((y >> 8) & 0x07)); in ast_cursor_move()