coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
ast_mode.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: MIT */
2 /*
3  * Copied from Linux drivers/gpu/drm/ast/ast_mode.c
4  * Please try to keep as close as possible to the upstream source.
5  */
6 #include "ast_drv.h"
7 #include "ast_tables.h"
8 
9 static inline void ast_load_palette_index(struct ast_private *ast,
10  u8 index, u8 red, u8 green,
11  u8 blue)
12 {
13  ast_io_write8(ast, AST_IO_DAC_INDEX_WRITE, index);
14  ast_io_read8(ast, AST_IO_SEQ_PORT);
15  ast_io_write8(ast, AST_IO_DAC_DATA, red);
16  ast_io_read8(ast, AST_IO_SEQ_PORT);
17  ast_io_write8(ast, AST_IO_DAC_DATA, green);
18  ast_io_read8(ast, AST_IO_SEQ_PORT);
19  ast_io_write8(ast, AST_IO_DAC_DATA, blue);
20  ast_io_read8(ast, AST_IO_SEQ_PORT);
21 }
22 
23 static void ast_crtc_load_lut(struct drm_crtc *crtc)
24 {
25  struct ast_private *ast = crtc->dev->dev_private;
26  /* FIXME: Gamma cor 2.6 ? */
27  for (int i = 0; i < 256; i++)
28  ast_load_palette_index(ast, i, i, i, i);
29 
30 }
31 
32 static bool ast_get_vbios_mode_info(struct drm_crtc *crtc, struct drm_display_mode *mode,
33  struct drm_display_mode *adjusted_mode,
34  struct ast_vbios_mode_info *vbios_mode)
35 {
36  struct ast_private *ast = crtc->dev->dev_private;
37  const struct drm_framebuffer *fb = crtc->primary->fb;
38  u32 refresh_rate_index = 0, mode_id, color_index, refresh_rate;
39  const struct ast_vbios_enhtable *best = NULL;
40  u32 hborder, vborder;
41  bool check_sync;
42 
43  switch (fb->format->cpp[0] * 8) {
44  case 8:
45  vbios_mode->std_table = &vbios_stdtable[VGAModeIndex];
46  color_index = VGAModeIndex - 1;
47  break;
48  case 16:
49  vbios_mode->std_table = &vbios_stdtable[HiCModeIndex];
50  color_index = HiCModeIndex;
51  break;
52  case 24:
53  case 32:
54  vbios_mode->std_table = &vbios_stdtable[TrueCModeIndex];
55  color_index = TrueCModeIndex;
56  break;
57  default:
58  return false;
59  }
60 
61  switch (crtc->mode.crtc_hdisplay) {
62  case 640:
64  break;
65  case 800:
67  break;
68  case 1024:
70  break;
71  case 1280:
72  if (crtc->mode.crtc_vdisplay == 800)
74  else
76  break;
77  case 1360:
79  break;
80  case 1440:
82  break;
83  case 1600:
84  if (crtc->mode.crtc_vdisplay == 900)
86  else
88  break;
89  case 1680:
91  break;
92  case 1920:
93  if (crtc->mode.crtc_vdisplay == 1080)
95  else
97  break;
98  default:
99  return false;
100  }
101 
102  refresh_rate = mode->vrefresh;
103  check_sync = vbios_mode->enh_table->flags & WideScreenMode;
104  do {
105  const struct ast_vbios_enhtable *loop = vbios_mode->enh_table;
106 
107  while (loop->refresh_rate != 0xff) {
108  if ((check_sync) &&
109  (((mode->flags & DRM_MODE_FLAG_NVSYNC) &&
110  (loop->flags & PVSync)) ||
111  ((mode->flags & DRM_MODE_FLAG_PVSYNC) &&
112  (loop->flags & NVSync)) ||
113  ((mode->flags & DRM_MODE_FLAG_NHSYNC) &&
114  (loop->flags & PHSync)) ||
115  ((mode->flags & DRM_MODE_FLAG_PHSYNC) &&
116  (loop->flags & NHSync)))) {
117  loop++;
118  continue;
119  }
120  if (loop->refresh_rate <= refresh_rate
121  && (!best || loop->refresh_rate > best->refresh_rate))
122  best = loop;
123  loop++;
124  }
125  if (best || !check_sync)
126  break;
127  check_sync = 0;
128  } while (1);
129  if (best)
130  vbios_mode->enh_table = best;
131 
132  hborder = (vbios_mode->enh_table->flags & HBorder) ? 8 : 0;
133  vborder = (vbios_mode->enh_table->flags & VBorder) ? 8 : 0;
134 
135  adjusted_mode->crtc_htotal = vbios_mode->enh_table->ht;
136  adjusted_mode->crtc_hblank_start = vbios_mode->enh_table->hde + hborder;
137  adjusted_mode->crtc_hblank_end = vbios_mode->enh_table->ht - hborder;
138  adjusted_mode->crtc_hsync_start = vbios_mode->enh_table->hde + hborder +
139  vbios_mode->enh_table->hfp;
140  adjusted_mode->crtc_hsync_end = (vbios_mode->enh_table->hde + hborder +
141  vbios_mode->enh_table->hfp +
142  vbios_mode->enh_table->hsync);
143 
144  adjusted_mode->crtc_vtotal = vbios_mode->enh_table->vt;
145  adjusted_mode->crtc_vblank_start = vbios_mode->enh_table->vde + vborder;
146  adjusted_mode->crtc_vblank_end = vbios_mode->enh_table->vt - vborder;
147  adjusted_mode->crtc_vsync_start = vbios_mode->enh_table->vde + vborder +
148  vbios_mode->enh_table->vfp;
149  adjusted_mode->crtc_vsync_end = (vbios_mode->enh_table->vde + vborder +
150  vbios_mode->enh_table->vfp +
151  vbios_mode->enh_table->vsync);
152 
154  mode_id = vbios_mode->enh_table->mode_id;
155 
156  if (ast->chip == AST1180) {
157  /* TODO 1180 */
158  } else {
159  ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x8c, (u8)((color_index & 0xf) << 4));
162 
163  ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x91, 0x00);
164  if (vbios_mode->enh_table->flags & NewModeInfo) {
165  ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x91, 0xa8);
167  fb->format->cpp[0] * 8);
169  adjusted_mode->clock / 1000);
171  adjusted_mode->crtc_hdisplay);
173  adjusted_mode->crtc_hdisplay >> 8);
174 
176  adjusted_mode->crtc_vdisplay);
178  adjusted_mode->crtc_vdisplay >> 8);
179  }
180  }
181 
182  return true;
183 }
184 
185 static void ast_set_std_reg(struct drm_crtc *crtc, struct drm_display_mode *mode,
186  struct ast_vbios_mode_info *vbios_mode)
187 {
188  struct ast_private *ast = crtc->dev->dev_private;
189  const struct drm_framebuffer *fb = crtc->primary->fb;
190  const struct ast_vbios_stdtable *stdtable;
191  u32 i;
192  u8 jreg;
193 
194  switch (fb->format->cpp[0] * 8) {
195  case 8:
196  stdtable = &vbios_stdtable[VGAModeIndex];
197  break;
198  case 16:
199  stdtable = &vbios_stdtable[HiCModeIndex];
200  break;
201  case 24:
202  case 32:
203  stdtable = &vbios_stdtable[TrueCModeIndex];
204  break;
205  default:
206  return;
207  }
208 
209  jreg = stdtable->misc;
210  ast_io_write8(ast, AST_IO_MISC_PORT_WRITE, jreg);
211 
212  /* Set SEQ */
213  ast_set_index_reg(ast, AST_IO_SEQ_PORT, 0x00, 0x03);
214  for (i = 0; i < 4; i++) {
215  jreg = stdtable->seq[i];
216  if (!i)
217  jreg |= 0x20;
218  ast_set_index_reg(ast, AST_IO_SEQ_PORT, (i + 1), jreg);
219  }
220 
221  /* Set CRTC */
222  ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x11, 0x7f, 0x00);
223  for (i = 0; i < 25; i++)
224  ast_set_index_reg(ast, AST_IO_CRTC_PORT, i, stdtable->crtc[i]);
225 
226  /* set AR */
227  jreg = ast_io_read8(ast, AST_IO_INPUT_STATUS1_READ);
228  for (i = 0; i < 20; i++) {
229  jreg = stdtable->ar[i];
230  ast_io_write8(ast, AST_IO_AR_PORT_WRITE, (u8)i);
231  ast_io_write8(ast, AST_IO_AR_PORT_WRITE, jreg);
232  }
233  ast_io_write8(ast, AST_IO_AR_PORT_WRITE, 0x14);
234  ast_io_write8(ast, AST_IO_AR_PORT_WRITE, 0x00);
235 
236  jreg = ast_io_read8(ast, AST_IO_INPUT_STATUS1_READ);
237  ast_io_write8(ast, AST_IO_AR_PORT_WRITE, 0x20);
238 
239  /* Set GR */
240  for (i = 0; i < 9; i++)
241  ast_set_index_reg(ast, AST_IO_GR_PORT, i, stdtable->gr[i]);
242 }
243 
244 static void ast_set_crtc_reg(struct drm_crtc *crtc, struct drm_display_mode *mode,
245  struct ast_vbios_mode_info *vbios_mode)
246 {
247  struct ast_private *ast = crtc->dev->dev_private;
248  u8 jreg05 = 0, jreg07 = 0, jreg09 = 0, jregAC = 0, jregAD = 0, jregAE = 0;
249  u16 temp, precache = 0;
250 
251  if ((ast->chip == AST2500) &&
252  (vbios_mode->enh_table->flags & AST2500PreCatchCRT))
253  precache = 40;
254 
255  ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x11, 0x7f, 0x00);
256 
257  temp = (mode->crtc_htotal >> 3) - 5;
258  if (temp & 0x100)
259  jregAC |= 0x01; /* HT D[8] */
260  ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x00, 0x00, temp);
261 
262  temp = (mode->crtc_hdisplay >> 3) - 1;
263  if (temp & 0x100)
264  jregAC |= 0x04; /* HDE D[8] */
265  ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x01, 0x00, temp);
266 
267  temp = (mode->crtc_hblank_start >> 3) - 1;
268  if (temp & 0x100)
269  jregAC |= 0x10; /* HBS D[8] */
270  ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x02, 0x00, temp);
271 
272  temp = ((mode->crtc_hblank_end >> 3) - 1) & 0x7f;
273  if (temp & 0x20)
274  jreg05 |= 0x80; /* HBE D[5] */
275  if (temp & 0x40)
276  jregAD |= 0x01; /* HBE D[5] */
277  ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x03, 0xE0, (temp & 0x1f));
278 
279  temp = ((mode->crtc_hsync_start-precache) >> 3) - 1;
280  if (temp & 0x100)
281  jregAC |= 0x40; /* HRS D[5] */
282  ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x04, 0x00, temp);
283 
284  temp = (((mode->crtc_hsync_end-precache) >> 3) - 1) & 0x3f;
285  if (temp & 0x20)
286  jregAD |= 0x04; /* HRE D[5] */
287  ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x05, 0x60, (u8)((temp & 0x1f) | jreg05));
288 
289  ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xAC, 0x00, jregAC);
290  ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xAD, 0x00, jregAD);
291 
292  /* vert timings */
293  temp = (mode->crtc_vtotal) - 2;
294  if (temp & 0x100)
295  jreg07 |= 0x01;
296  if (temp & 0x200)
297  jreg07 |= 0x20;
298  if (temp & 0x400)
299  jregAE |= 0x01;
300  ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x06, 0x00, temp);
301 
302  temp = (mode->crtc_vsync_start) - 1;
303  if (temp & 0x100)
304  jreg07 |= 0x04;
305  if (temp & 0x200)
306  jreg07 |= 0x80;
307  if (temp & 0x400)
308  jregAE |= 0x08;
309  ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x10, 0x00, temp);
310 
311  temp = (mode->crtc_vsync_end - 1) & 0x3f;
312  if (temp & 0x10)
313  jregAE |= 0x20;
314  if (temp & 0x20)
315  jregAE |= 0x40;
316  ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x11, 0x70, temp & 0xf);
317 
318  temp = mode->crtc_vdisplay - 1;
319  if (temp & 0x100)
320  jreg07 |= 0x02;
321  if (temp & 0x200)
322  jreg07 |= 0x40;
323  if (temp & 0x400)
324  jregAE |= 0x02;
325  ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x12, 0x00, temp);
326 
327  temp = mode->crtc_vblank_start - 1;
328  if (temp & 0x100)
329  jreg07 |= 0x08;
330  if (temp & 0x200)
331  jreg09 |= 0x20;
332  if (temp & 0x400)
333  jregAE |= 0x04;
334  ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x15, 0x00, temp);
335 
336  temp = mode->crtc_vblank_end - 1;
337  if (temp & 0x100)
338  jregAE |= 0x10;
339  ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x16, 0x00, temp);
340 
341  ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x07, 0x00, jreg07);
342  ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x09, 0xdf, jreg09);
343  ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xAE, 0x00, (jregAE | 0x80));
344 
345  if (precache)
346  ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb6, 0x3f, 0x80);
347  else
348  ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb6, 0x3f, 0x00);
349 
350  ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x11, 0x7f, 0x80);
351 }
352 
353 void ast_set_offset_reg(struct drm_crtc *crtc)
354 {
355  struct ast_private *ast = crtc->dev->dev_private;
356  const struct drm_framebuffer *fb = crtc->primary->fb;
357 
358  u16 offset;
359 
360  offset = fb->pitches[0] >> 3;
361  ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x13, (offset & 0xff));
362  ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xb0, (offset >> 8) & 0x3f);
363 }
364 
365 static void ast_set_dclk_reg(struct drm_device *dev, struct drm_display_mode *mode,
366  struct ast_vbios_mode_info *vbios_mode)
367 {
368  struct ast_private *ast = dev->dev_private;
369  const struct ast_vbios_dclk_info *clk_info;
370 
371  if (ast->chip == AST2500)
372  clk_info = &dclk_table_ast2500[vbios_mode->enh_table->dclk_index];
373  else
374  clk_info = &dclk_table[vbios_mode->enh_table->dclk_index];
375 
376  ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xc0, 0x00, clk_info->param1);
377  ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xc1, 0x00, clk_info->param2);
379  (clk_info->param3 & 0xc0) |
380  ((clk_info->param3 & 0x3) << 4));
381 }
382 
383 static void ast_set_ext_reg(struct drm_crtc *crtc, struct drm_display_mode *mode,
384  struct ast_vbios_mode_info *vbios_mode)
385 {
386  struct ast_private *ast = crtc->dev->dev_private;
387  const struct drm_framebuffer *fb = crtc->primary->fb;
388  u8 jregA0 = 0, jregA3 = 0, jregA8 = 0;
389 
390  switch (fb->format->cpp[0] * 8) {
391  case 8:
392  jregA0 = 0x70;
393  jregA3 = 0x01;
394  jregA8 = 0x00;
395  break;
396  case 15:
397  case 16:
398  jregA0 = 0x70;
399  jregA3 = 0x04;
400  jregA8 = 0x02;
401  break;
402  case 24:
403  case 32:
404  jregA0 = 0x70;
405  jregA3 = 0x08;
406  jregA8 = 0x02;
407  break;
408  }
409 
410  ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xa0, 0x8f, jregA0);
411  ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xa3, 0xf0, jregA3);
412  ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xa8, 0xfd, jregA8);
413 
414  /* Set Threshold */
415  if (ast->chip == AST2300 || ast->chip == AST2400 ||
416  ast->chip == AST2500) {
417  ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa7, 0x78);
418  ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa6, 0x60);
419  } else if (ast->chip == AST2100 ||
420  ast->chip == AST1100 ||
421  ast->chip == AST2200 ||
422  ast->chip == AST2150) {
423  ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa7, 0x3f);
424  ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa6, 0x2f);
425  } else {
426  ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa7, 0x2f);
427  ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa6, 0x1f);
428  }
429 }
430 
431 static void ast_set_sync_reg(struct drm_device *dev, struct drm_display_mode *mode,
432  struct ast_vbios_mode_info *vbios_mode)
433 {
434  struct ast_private *ast = dev->dev_private;
435  u8 jreg;
436 
437  jreg = ast_io_read8(ast, AST_IO_MISC_PORT_READ);
438  jreg &= ~0xC0;
439  if (vbios_mode->enh_table->flags & NVSync)
440  jreg |= 0x80;
441  if (vbios_mode->enh_table->flags & NHSync)
442  jreg |= 0x40;
443  ast_io_write8(ast, AST_IO_MISC_PORT_WRITE, jreg);
444 }
445 
447 {
448  u32 addr;
449 
450  addr = offset >> 2;
451  ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x0d, (u8)(addr & 0xff));
452  ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x0c, (u8)((addr >> 8) & 0xff));
453  ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xaf, (u8)((addr >> 16) & 0xff));
454 }
455 
456 void ast_hide_cursor(struct drm_crtc *crtc)
457 {
458  struct ast_private *ast = crtc->dev->dev_private;
459  ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xcb, 0xfc, 0x00);
460 }
461 
462 int ast_crtc_mode_set(struct drm_crtc *crtc,
463  struct drm_display_mode *mode,
464  struct drm_display_mode *adjusted_mode)
465 {
466  struct drm_device *dev = crtc->dev;
467  struct ast_private *ast = crtc->dev->dev_private;
468  struct ast_vbios_mode_info vbios_mode;
469  bool ret;
470  int err;
471 
472  if (ast->chip == AST1180) {
473  dev_err(dev->pdev, "AST 1180 modesetting not supported\n");
474  return -EINVAL;
475  }
476 
477  /* DPMS, set on */
479  if (ast->tx_chip_type == AST_TX_DP501)
481  ast_crtc_load_lut(crtc);
482 
483  /* Get mode */
484  ret = ast_get_vbios_mode_info(crtc, mode, adjusted_mode, &vbios_mode);
485  if (ret == false) {
486  dev_err(dev->pdev, "Failed to find compatible vbios mode\n");
487  return -EINVAL;
488  }
489  ast_open_key(ast);
490 
491  ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xa1, 0xff, 0x04);
492 
493  ast_set_std_reg(crtc, adjusted_mode, &vbios_mode);
494  ast_set_crtc_reg(crtc, adjusted_mode, &vbios_mode);
495  ast_set_offset_reg(crtc);
496  ast_set_dclk_reg(dev, adjusted_mode, &vbios_mode);
497  ast_set_ext_reg(crtc, adjusted_mode, &vbios_mode);
498  ast_set_sync_reg(dev, adjusted_mode, &vbios_mode);
499 
500  err = ast_crtc_do_set_base(crtc);
501  if (err)
502  return err;
503 
504  /* Commit changes */
505 
507  ast_crtc_load_lut(crtc);
508 
509  return 0;
510 }
511 
512 enum drm_mode_status ast_mode_valid(struct drm_connector *connector,
513  const unsigned int hdisplay, const unsigned int vdisplay)
514 {
515  struct ast_private *ast = connector->dev->dev_private;
516  int flags = MODE_NOMODE;
517  uint32_t jtemp;
518 
519  if (ast->support_wide_screen) {
520  if ((hdisplay == 1680) && (vdisplay == 1050))
521  return MODE_OK;
522  if ((hdisplay == 1280) && (vdisplay == 800))
523  return MODE_OK;
524  if ((hdisplay == 1440) && (vdisplay == 900))
525  return MODE_OK;
526  if ((hdisplay == 1360) && (vdisplay == 768))
527  return MODE_OK;
528  if ((hdisplay == 1600) && (vdisplay == 900))
529  return MODE_OK;
530 
531  if ((ast->chip == AST2100) || (ast->chip == AST2200) ||
532  (ast->chip == AST2300) || (ast->chip == AST2400) ||
533  (ast->chip == AST2500) || (ast->chip == AST1180)) {
534  if ((hdisplay == 1920) && (vdisplay == 1080))
535  return MODE_OK;
536 
537  if ((hdisplay == 1920) && (vdisplay == 1200)) {
539  0xff);
540  if (jtemp & 0x01)
541  return MODE_NOMODE;
542  else
543  return MODE_OK;
544  }
545  }
546  }
547  switch (hdisplay) {
548  case 640:
549  if (vdisplay == 480)
550  flags = MODE_OK;
551  break;
552  case 800:
553  if (vdisplay == 600)
554  flags = MODE_OK;
555  break;
556  case 1024:
557  if (vdisplay == 768)
558  flags = MODE_OK;
559  break;
560  case 1280:
561  if (vdisplay == 1024)
562  flags = MODE_OK;
563  break;
564  case 1600:
565  if (vdisplay == 1200)
566  flags = MODE_OK;
567  break;
568  default:
569  return flags;
570  }
571 
572  return flags;
573 }
#define dev_err(dev, format, arg...)
void ast_set_dp501_video_output(struct drm_device *dev, u8 mode)
Definition: ast_dp501.c:110
uint8_t ast_get_index_reg_mask(struct ast_private *ast, uint32_t base, uint8_t index, uint8_t mask)
Definition: ast_main.c:30
@ AST_TX_DP501
Definition: ast_drv.h:30
#define AST_IO_AR_PORT_WRITE
Definition: ast_drv.h:81
#define AST_IO_DAC_DATA
Definition: ast_drv.h:87
#define AST_IO_DAC_INDEX_WRITE
Definition: ast_drv.h:86
int ast_crtc_do_set_base(struct drm_crtc *crtc)
#define DRM_MODE_FLAG_NVSYNC
Definition: ast_drv.h:223
#define AST_IO_CRTC_PORT
Definition: ast_drv.h:89
void ast_set_index_reg_mask(struct ast_private *ast, uint32_t base, uint8_t index, uint8_t mask, uint8_t val)
Definition: ast_main.c:11
#define AST_IO_INPUT_STATUS1_READ
Definition: ast_drv.h:90
#define AST_IO_MISC_PORT_WRITE
Definition: ast_drv.h:82
#define DRM_MODE_FLAG_NHSYNC
Definition: ast_drv.h:225
#define AST_IO_GR_PORT
Definition: ast_drv.h:88
@ AST2200
Definition: ast_drv.h:18
@ AST2400
Definition: ast_drv.h:21
@ AST2500
Definition: ast_drv.h:22
@ AST2100
Definition: ast_drv.h:16
@ AST1100
Definition: ast_drv.h:17
@ AST2150
Definition: ast_drv.h:19
@ AST1180
Definition: ast_drv.h:23
@ AST2300
Definition: ast_drv.h:20
static void ast_set_index_reg(struct ast_private *ast, uint32_t base, uint8_t index, uint8_t val)
Definition: ast_drv.h:141
#define AST_IO_SEQ_PORT
Definition: ast_drv.h:84
drm_mode_status
Definition: ast_drv.h:275
@ MODE_NOMODE
Definition: ast_drv.h:276
@ MODE_OK
Definition: ast_drv.h:277
#define DRM_MODE_FLAG_PVSYNC
Definition: ast_drv.h:224
#define AST_IO_MISC_PORT_READ
Definition: ast_drv.h:91
static void ast_open_key(struct ast_private *ast)
Definition: ast_drv.h:156
#define DRM_MODE_FLAG_PHSYNC
Definition: ast_drv.h:226
static struct ast_private * ast
Definition: ast_i2c.c:10
void ast_hide_cursor(struct drm_crtc *crtc)
Definition: ast_mode.c:456
void ast_set_offset_reg(struct drm_crtc *crtc)
Definition: ast_mode.c:353
static void ast_load_palette_index(struct ast_private *ast, u8 index, u8 red, u8 green, u8 blue)
Definition: ast_mode.c:9
static bool ast_get_vbios_mode_info(struct drm_crtc *crtc, struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode, struct ast_vbios_mode_info *vbios_mode)
Definition: ast_mode.c:32
static void ast_set_dclk_reg(struct drm_device *dev, struct drm_display_mode *mode, struct ast_vbios_mode_info *vbios_mode)
Definition: ast_mode.c:365
static void ast_crtc_load_lut(struct drm_crtc *crtc)
Definition: ast_mode.c:23
static void ast_set_ext_reg(struct drm_crtc *crtc, struct drm_display_mode *mode, struct ast_vbios_mode_info *vbios_mode)
Definition: ast_mode.c:383
enum drm_mode_status ast_mode_valid(struct drm_connector *connector, const unsigned int hdisplay, const unsigned int vdisplay)
Definition: ast_mode.c:512
void ast_set_start_address_crt1(struct ast_private *ast, u32 offset)
Definition: ast_mode.c:446
static void ast_set_sync_reg(struct drm_device *dev, struct drm_display_mode *mode, struct ast_vbios_mode_info *vbios_mode)
Definition: ast_mode.c:431
static void ast_set_crtc_reg(struct drm_crtc *crtc, struct drm_display_mode *mode, struct ast_vbios_mode_info *vbios_mode)
Definition: ast_mode.c:244
int ast_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode)
Definition: ast_mode.c:462
static void ast_set_std_reg(struct drm_crtc *crtc, struct drm_display_mode *mode, struct ast_vbios_mode_info *vbios_mode)
Definition: ast_mode.c:185
static const struct ast_vbios_enhtable res_1440x900[]
Definition: ast_tables.h:294
static struct ast_vbios_stdtable vbios_stdtable[]
Definition: ast_tables.h:122
#define HiCModeIndex
Definition: ast_tables.h:11
#define NVSync
Definition: ast_tables.h:24
#define AST2500PreCatchCRT
Definition: ast_tables.h:30
#define VGAModeIndex
Definition: ast_tables.h:10
static const struct ast_vbios_enhtable res_800x600[]
Definition: ast_tables.h:208
#define VBorder
Definition: ast_tables.h:19
static const struct ast_vbios_enhtable res_1360x768[]
Definition: ast_tables.h:255
static const struct ast_vbios_enhtable res_1024x768[]
Definition: ast_tables.h:223
static const struct ast_vbios_enhtable res_1280x1024[]
Definition: ast_tables.h:236
static const struct ast_vbios_enhtable res_1600x1200[]
Definition: ast_tables.h:247
#define WideScreenMode
Definition: ast_tables.h:20
#define PVSync
Definition: ast_tables.h:25
#define NHSync
Definition: ast_tables.h:22
#define TrueCModeIndex
Definition: ast_tables.h:12
static const struct ast_vbios_enhtable res_1600x900[]
Definition: ast_tables.h:263
static const struct ast_vbios_dclk_info dclk_table_ast2500[]
Definition: ast_tables.h:92
static const struct ast_vbios_enhtable res_1280x800[]
Definition: ast_tables.h:283
static const struct ast_vbios_enhtable res_1920x1080[]
Definition: ast_tables.h:273
static struct ast_vbios_dclk_info dclk_table[]
Definition: ast_tables.h:62
#define PHSync
Definition: ast_tables.h:23
static const struct ast_vbios_enhtable res_1920x1200[]
Definition: ast_tables.h:314
#define HBorder
Definition: ast_tables.h:18
static const struct ast_vbios_enhtable res_640x480[]
Definition: ast_tables.h:195
#define NewModeInfo
Definition: ast_tables.h:21
static const struct ast_vbios_enhtable res_1680x1050[]
Definition: ast_tables.h:304
static u32 addr
Definition: cirrus.c:14
#define EINVAL
Definition: errno.h:27
static size_t offset
Definition: flashconsole.c:16
#define NULL
Definition: stddef.h:19
unsigned int uint32_t
Definition: stdint.h:14
uint32_t u32
Definition: stdint.h:51
uint16_t u16
Definition: stdint.h:48
uint8_t u8
Definition: stdint.h:45
struct drm_device * dev
Definition: ast_drv.h:44
enum ast_chip chip
Definition: ast_drv.h:50
bool support_wide_screen
Definition: ast_drv.h:65
enum ast_tx_chip tx_chip_type
Definition: ast_drv.h:72
u32 refresh_rate_index
Definition: ast_drv.h:208
const struct ast_vbios_enhtable * enh_table
Definition: ast_drv.h:220
const struct ast_vbios_stdtable * std_table
Definition: ast_drv.h:219
struct drm_device * dev
Definition: ast_drv.h:272
struct drm_display_mode mode
Definition: ast_drv.h:268
struct drm_primary * primary
Definition: ast_drv.h:267
struct drm_device * dev
Definition: ast_drv.h:266
void * dev_private
struct pci_dev * pdev
u16 crtc_hblank_end
Definition: ast_drv.h:240
u16 crtc_hblank_start
Definition: ast_drv.h:239
u16 crtc_hsync_start
Definition: ast_drv.h:241
u16 crtc_vsync_end
Definition: ast_drv.h:245
u16 crtc_hsync_end
Definition: ast_drv.h:242
u16 crtc_vsync_start
Definition: ast_drv.h:244
u16 crtc_vblank_end
Definition: ast_drv.h:248
u16 crtc_vblank_start
Definition: ast_drv.h:247
u32 cpp[1]
Definition: ast_drv.h:252
struct drm_format * format
Definition: ast_drv.h:257
u32 pitches[1]
Definition: ast_drv.h:256
struct drm_framebuffer * fb
Definition: ast_drv.h:262