Lines Matching refs:ast
52 static inline void ast_load_palette_index(struct ast_private *ast, in ast_load_palette_index() argument
56 ast_io_write8(ast, AST_IO_DAC_INDEX_WRITE, index); in ast_load_palette_index()
57 ast_io_read8(ast, AST_IO_SEQ_PORT); in ast_load_palette_index()
58 ast_io_write8(ast, AST_IO_DAC_DATA, red); 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, green); 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, blue); in ast_load_palette_index()
63 ast_io_read8(ast, AST_IO_SEQ_PORT); in ast_load_palette_index()
66 static void ast_crtc_load_lut(struct ast_private *ast, struct drm_crtc *crtc) in ast_crtc_load_lut() argument
79 ast_load_palette_index(ast, i, *r++ >> 8, *g++ >> 8, *b++ >> 8); in ast_crtc_load_lut()
204 static void ast_set_vbios_color_reg(struct ast_private *ast, in ast_set_vbios_color_reg() argument
225 ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x8c, (u8)((color_index & 0x0f) << 4)); in ast_set_vbios_color_reg()
227 ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x91, 0x00); in ast_set_vbios_color_reg()
230 ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x91, 0xa8); in ast_set_vbios_color_reg()
231 ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x92, format->cpp[0] * 8); in ast_set_vbios_color_reg()
235 static void ast_set_vbios_mode_reg(struct ast_private *ast, in ast_set_vbios_mode_reg() argument
244 ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x8d, refresh_rate_index & 0xff); in ast_set_vbios_mode_reg()
245 ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x8e, mode_id & 0xff); in ast_set_vbios_mode_reg()
247 ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x91, 0x00); in ast_set_vbios_mode_reg()
250 ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x91, 0xa8); in ast_set_vbios_mode_reg()
251 ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x93, adjusted_mode->clock / 1000); in ast_set_vbios_mode_reg()
252 ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x94, adjusted_mode->crtc_hdisplay); in ast_set_vbios_mode_reg()
253 ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x95, adjusted_mode->crtc_hdisplay >> 8); in ast_set_vbios_mode_reg()
254 ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x96, adjusted_mode->crtc_vdisplay); in ast_set_vbios_mode_reg()
255 ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x97, adjusted_mode->crtc_vdisplay >> 8); in ast_set_vbios_mode_reg()
259 static void ast_set_std_reg(struct ast_private *ast, in ast_set_std_reg() argument
270 ast_io_write8(ast, AST_IO_MISC_PORT_WRITE, jreg); in ast_set_std_reg()
273 ast_set_index_reg(ast, AST_IO_SEQ_PORT, 0x00, 0x03); in ast_set_std_reg()
274 ast_set_index_reg_mask(ast, AST_IO_SEQ_PORT, 0x01, 0xdf, stdtable->seq[0]); in ast_set_std_reg()
277 ast_set_index_reg(ast, AST_IO_SEQ_PORT, (i + 1) , jreg); in ast_set_std_reg()
281 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x11, 0x7f, 0x00); in ast_set_std_reg()
283 ast_set_index_reg(ast, AST_IO_CRTC_PORT, i, stdtable->crtc[i]); in ast_set_std_reg()
285 ast_set_index_reg(ast, AST_IO_CRTC_PORT, i, stdtable->crtc[i]); in ast_set_std_reg()
287 ast_set_index_reg(ast, AST_IO_CRTC_PORT, i, stdtable->crtc[i]); in ast_set_std_reg()
290 jreg = ast_io_read8(ast, AST_IO_INPUT_STATUS1_READ); in ast_set_std_reg()
293 ast_io_write8(ast, AST_IO_AR_PORT_WRITE, (u8)i); in ast_set_std_reg()
294 ast_io_write8(ast, AST_IO_AR_PORT_WRITE, jreg); in ast_set_std_reg()
296 ast_io_write8(ast, AST_IO_AR_PORT_WRITE, 0x14); in ast_set_std_reg()
297 ast_io_write8(ast, AST_IO_AR_PORT_WRITE, 0x00); in ast_set_std_reg()
299 jreg = ast_io_read8(ast, AST_IO_INPUT_STATUS1_READ); in ast_set_std_reg()
300 ast_io_write8(ast, AST_IO_AR_PORT_WRITE, 0x20); in ast_set_std_reg()
304 ast_set_index_reg(ast, AST_IO_GR_PORT, i, stdtable->gr[i]); in ast_set_std_reg()
307 static void ast_set_crtc_reg(struct ast_private *ast, in ast_set_crtc_reg() argument
314 if ((ast->chip == AST2500) && in ast_set_crtc_reg()
318 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x11, 0x7f, 0x00); in ast_set_crtc_reg()
323 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x00, 0x00, temp); in ast_set_crtc_reg()
328 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x01, 0x00, temp); in ast_set_crtc_reg()
333 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x02, 0x00, temp); in ast_set_crtc_reg()
340 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x03, 0xE0, (temp & 0x1f)); in ast_set_crtc_reg()
345 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x04, 0x00, temp); in ast_set_crtc_reg()
350 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x05, 0x60, (u8)((temp & 0x1f) | jreg05)); in ast_set_crtc_reg()
352 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xAC, 0x00, jregAC); in ast_set_crtc_reg()
353 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xAD, 0x00, jregAD); in ast_set_crtc_reg()
363 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x06, 0x00, temp); in ast_set_crtc_reg()
372 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x10, 0x00, temp); in ast_set_crtc_reg()
379 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x11, 0x70, temp & 0xf); in ast_set_crtc_reg()
388 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x12, 0x00, temp); in ast_set_crtc_reg()
397 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x15, 0x00, temp); in ast_set_crtc_reg()
402 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x16, 0x00, temp); in ast_set_crtc_reg()
404 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x07, 0x00, jreg07); in ast_set_crtc_reg()
405 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x09, 0xdf, jreg09); in ast_set_crtc_reg()
406 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xAE, 0x00, (jregAE | 0x80)); in ast_set_crtc_reg()
409 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb6, 0x3f, 0x80); in ast_set_crtc_reg()
411 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb6, 0x3f, 0x00); in ast_set_crtc_reg()
413 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x11, 0x7f, 0x80); in ast_set_crtc_reg()
416 static void ast_set_offset_reg(struct ast_private *ast, in ast_set_offset_reg() argument
422 ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x13, (offset & 0xff)); in ast_set_offset_reg()
423 ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xb0, (offset >> 8) & 0x3f); in ast_set_offset_reg()
426 static void ast_set_dclk_reg(struct ast_private *ast, in ast_set_dclk_reg() argument
432 if (ast->chip == AST2500) in ast_set_dclk_reg()
437 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xc0, 0x00, clk_info->param1); in ast_set_dclk_reg()
438 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xc1, 0x00, clk_info->param2); in ast_set_dclk_reg()
439 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xbb, 0x0f, in ast_set_dclk_reg()
444 static void ast_set_color_reg(struct ast_private *ast, in ast_set_color_reg() argument
468 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xa0, 0x8f, jregA0); in ast_set_color_reg()
469 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xa3, 0xf0, jregA3); in ast_set_color_reg()
470 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xa8, 0xfd, jregA8); in ast_set_color_reg()
473 static void ast_set_crtthd_reg(struct ast_private *ast) in ast_set_crtthd_reg() argument
476 if (ast->chip == AST2300 || ast->chip == AST2400 || in ast_set_crtthd_reg()
477 ast->chip == AST2500) { in ast_set_crtthd_reg()
478 ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa7, 0x78); in ast_set_crtthd_reg()
479 ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa6, 0x60); in ast_set_crtthd_reg()
480 } else if (ast->chip == AST2100 || in ast_set_crtthd_reg()
481 ast->chip == AST1100 || in ast_set_crtthd_reg()
482 ast->chip == AST2200 || in ast_set_crtthd_reg()
483 ast->chip == AST2150) { in ast_set_crtthd_reg()
484 ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa7, 0x3f); in ast_set_crtthd_reg()
485 ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa6, 0x2f); in ast_set_crtthd_reg()
487 ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa7, 0x2f); in ast_set_crtthd_reg()
488 ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa6, 0x1f); in ast_set_crtthd_reg()
492 static void ast_set_sync_reg(struct ast_private *ast, in ast_set_sync_reg() argument
498 jreg = ast_io_read8(ast, AST_IO_MISC_PORT_READ); in ast_set_sync_reg()
502 ast_io_write8(ast, AST_IO_MISC_PORT_WRITE, jreg); in ast_set_sync_reg()
505 static void ast_set_start_address_crt1(struct ast_private *ast, in ast_set_start_address_crt1() argument
511 ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x0d, (u8)(addr & 0xff)); in ast_set_start_address_crt1()
512 ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x0c, (u8)((addr >> 8) & 0xff)); in ast_set_start_address_crt1()
513 ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xaf, (u8)((addr >> 16) & 0xff)); in ast_set_start_address_crt1()
517 static void ast_wait_for_vretrace(struct ast_private *ast) in ast_wait_for_vretrace() argument
523 vgair1 = ast_io_read8(ast, AST_IO_INPUT_STATUS1_READ); in ast_wait_for_vretrace()
571 struct ast_private *ast = to_ast_private(dev); in ast_primary_plane_helper_atomic_update() local
583 ast_set_color_reg(ast, fb->format); in ast_primary_plane_helper_atomic_update()
584 ast_set_vbios_color_reg(ast, fb->format, vbios_mode_info); in ast_primary_plane_helper_atomic_update()
592 ast_set_offset_reg(ast, fb); in ast_primary_plane_helper_atomic_update()
593 ast_set_start_address_crt1(ast, (u32)gpu_addr); in ast_primary_plane_helper_atomic_update()
595 ast_set_index_reg_mask(ast, AST_IO_SEQ_PORT, 0x1, 0xdf, 0x00); in ast_primary_plane_helper_atomic_update()
602 struct ast_private *ast = to_ast_private(plane->dev); in ast_primary_plane_helper_atomic_disable() local
604 ast_set_index_reg_mask(ast, AST_IO_SEQ_PORT, 0x1, 0xdf, 0x20); in ast_primary_plane_helper_atomic_disable()
638 struct ast_private *ast; in ast_cursor_plane_helper_prepare_fb() local
644 ast = to_ast_private(plane->dev); in ast_cursor_plane_helper_prepare_fb()
646 ret = ast_cursor_blit(ast, fb); in ast_cursor_plane_helper_prepare_fb()
687 struct ast_private *ast = to_ast_private(plane->dev); in ast_cursor_plane_helper_atomic_update() local
695 ast_cursor_page_flip(ast); in ast_cursor_plane_helper_atomic_update()
698 ast_cursor_show(ast, state->crtc_x, state->crtc_y, in ast_cursor_plane_helper_atomic_update()
706 struct ast_private *ast = to_ast_private(plane->dev); in ast_cursor_plane_helper_atomic_disable() local
708 ast_cursor_hide(ast); in ast_cursor_plane_helper_atomic_disable()
734 struct ast_private *ast = to_ast_private(crtc->dev); in ast_crtc_dpms() local
743 if (ast->tx_chip_type == AST_TX_DP501) in ast_crtc_dpms()
747 if (ast->tx_chip_type == AST_TX_DP501) in ast_crtc_dpms()
782 struct ast_private *ast = to_ast_private(crtc->dev); in ast_crtc_helper_atomic_flush() local
791 ast_crtc_load_lut(ast, crtc); in ast_crtc_helper_atomic_flush()
799 struct ast_private *ast = to_ast_private(dev); in ast_crtc_helper_atomic_enable() local
806 ast_set_vbios_mode_reg(ast, adjusted_mode, vbios_mode_info); in ast_crtc_helper_atomic_enable()
807 ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa1, 0x06); in ast_crtc_helper_atomic_enable()
808 ast_set_std_reg(ast, adjusted_mode, vbios_mode_info); in ast_crtc_helper_atomic_enable()
809 ast_set_crtc_reg(ast, adjusted_mode, vbios_mode_info); in ast_crtc_helper_atomic_enable()
810 ast_set_dclk_reg(ast, adjusted_mode, vbios_mode_info); in ast_crtc_helper_atomic_enable()
811 ast_set_crtthd_reg(ast); in ast_crtc_helper_atomic_enable()
812 ast_set_sync_reg(ast, adjusted_mode, vbios_mode_info); in ast_crtc_helper_atomic_enable()
822 struct ast_private *ast = to_ast_private(dev); in ast_crtc_helper_atomic_disable() local
842 ast_wait_for_vretrace(ast); in ast_crtc_helper_atomic_disable()
910 struct ast_private *ast = to_ast_private(dev); in ast_crtc_init() local
911 struct drm_crtc *crtc = &ast->crtc; in ast_crtc_init()
914 ret = drm_crtc_init_with_planes(dev, crtc, &ast->primary_plane, in ast_crtc_init()
915 &ast->cursor_plane, &ast_crtc_funcs, in ast_crtc_init()
932 struct ast_private *ast = to_ast_private(dev); in ast_encoder_init() local
933 struct drm_encoder *encoder = &ast->encoder; in ast_encoder_init()
952 struct ast_private *ast = to_ast_private(connector->dev); in ast_get_modes() local
956 if (ast->tx_chip_type == AST_TX_DP501) { in ast_get_modes()
957 ast->dp501_maxclk = 0xff; in ast_get_modes()
964 ast->dp501_maxclk = ast_get_dp501_max_clk(connector->dev); in ast_get_modes()
983 struct ast_private *ast = to_ast_private(connector->dev); in ast_mode_valid() local
987 if (ast->support_wide_screen) { in ast_mode_valid()
999 if ((ast->chip == AST2100) || (ast->chip == AST2200) || in ast_mode_valid()
1000 (ast->chip == AST2300) || (ast->chip == AST2400) || in ast_mode_valid()
1001 (ast->chip == AST2500)) { in ast_mode_valid()
1006 jtemp = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xd1, 0xff); in ast_mode_valid()
1059 struct ast_private *ast = to_ast_private(dev); in ast_connector_init() local
1060 struct ast_connector *ast_connector = &ast->connector; in ast_connector_init()
1062 struct drm_encoder *encoder = &ast->encoder; in ast_connector_init()
1101 int ast_mode_config_init(struct ast_private *ast) in ast_mode_config_init() argument
1103 struct drm_device *dev = &ast->base; in ast_mode_config_init()
1106 ret = ast_cursor_init(ast); in ast_mode_config_init()
1121 if (ast->chip == AST2100 || in ast_mode_config_init()
1122 ast->chip == AST2200 || in ast_mode_config_init()
1123 ast->chip == AST2300 || in ast_mode_config_init()
1124 ast->chip == AST2400 || in ast_mode_config_init()
1125 ast->chip == AST2500) { in ast_mode_config_init()
1135 memset(&ast->primary_plane, 0, sizeof(ast->primary_plane)); in ast_mode_config_init()
1136 ret = drm_universal_plane_init(dev, &ast->primary_plane, 0x01, in ast_mode_config_init()
1145 drm_plane_helper_add(&ast->primary_plane, in ast_mode_config_init()
1148 ret = drm_universal_plane_init(dev, &ast->cursor_plane, 0x01, in ast_mode_config_init()
1157 drm_plane_helper_add(&ast->cursor_plane, in ast_mode_config_init()
1172 struct ast_private *ast = to_ast_private(i2c->dev); in get_clock() local
1177 val = (ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x10) >> 4) & 0x01; in get_clock()
1179 val2 = (ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x10) >> 4) & 0x01; in get_clock()
1184 val = (ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x10) >> 4) & 0x01; in get_clock()
1194 struct ast_private *ast = to_ast_private(i2c->dev); in get_data() local
1199 val = (ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x20) >> 5) & 0x01; in get_data()
1201 val2 = (ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x20) >> 5) & 0x01; in get_data()
1206 val = (ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x20) >> 5) & 0x01; in get_data()
1216 struct ast_private *ast = to_ast_private(i2c->dev); in set_clock() local
1222 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0xf4, ujcrb7); in set_clock()
1223 jtemp = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x01); in set_clock()
1232 struct ast_private *ast = to_ast_private(i2c->dev); in set_data() local
1238 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0xf1, ujcrb7); in set_data()
1239 jtemp = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x04); in set_data()