blob: 3867231a44700bd7e7457b6cfc0c01b0f83e1d7c [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#include <linux/config.h>
2#define acornfb_valid_pixrate(var) (var->pixclock >= 39325 && var->pixclock <= 40119)
3
4static inline void
5acornfb_vidc20_find_rates(struct vidc_timing *vidc,
6 struct fb_var_screeninfo *var)
7{
8 u_int bandwidth;
9
10 vidc->control |= VIDC20_CTRL_PIX_CK;
11
12 /* Calculate bandwidth */
13 bandwidth = var->pixclock * 8 / var->bits_per_pixel;
14
15 /* Encode bandwidth as VIDC20 setting */
16 if (bandwidth > 16667*2)
17 vidc->control |= VIDC20_CTRL_FIFO_16;
18 else if (bandwidth > 13333*2)
19 vidc->control |= VIDC20_CTRL_FIFO_20;
20 else if (bandwidth > 11111*2)
21 vidc->control |= VIDC20_CTRL_FIFO_24;
22 else
23 vidc->control |= VIDC20_CTRL_FIFO_28;
24
25 vidc->pll_ctl = 0x2020;
26}
27
28#ifdef CONFIG_CHRONTEL_7003
29#define acornfb_default_control() VIDC20_CTRL_PIX_HCLK
30#else
31#define acornfb_default_control() VIDC20_CTRL_PIX_VCLK
32#endif
33
34#define acornfb_default_econtrol() VIDC20_ECTL_DAC | VIDC20_ECTL_REG(3) | VIDC20_ECTL_ECK