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