21 #include <linux/compiler.h>
23 #include <linux/errno.h>
26 #include <linux/kernel.h>
27 #include <linux/module.h>
29 #include <linux/types.h>
62 .smem_len = (2048 * 1024),
98 static int pmagbbfb_setcolreg(
unsigned int regno,
unsigned int red,
104 if (regno >= info->
cmap.len)
124 static struct fb_ops pmagbbfb_ops = {
126 .fb_setcolreg = pmagbbfb_setcolreg,
136 static void __init pmagbbfb_erase_cursor(
struct fb_info *info)
156 info->
var.xres_virtual = info->
var.xres;
159 info->
var.yres_virtual = info->
var.yres;
176 info->
fix.line_length = info->
var.xres;
184 static unsigned int pmagbbfb_freqs[] __devinitdata = {
185 130808, 119843, 104000, 92980, 74370, 72800,
186 69197, 66000, 65000, 50350, 36000, 32000, 25175
190 u32 count0 = 8,
count1 = 8, counttc = 16 * 256 + 8;
191 u32 freq0, freq1, freqtc = tc_get_speed(tbus) / 250;
195 for (j = 0; j < 16; j++) {
199 for (i = 0; i < 100; i++) {
208 for (j = 0; j < 16; j++) {
212 for (i = 0; i < 100; i++) {
220 freq0 = (freqtc * count0 + counttc / 2) / counttc;
222 if (freq0 >= pmagbbfb_freqs[0] - (pmagbbfb_freqs[0] + 32) / 64 &&
223 freq0 <= pmagbbfb_freqs[0] + (pmagbbfb_freqs[0] + 32) / 64)
224 par->
osc0 = pmagbbfb_freqs[0];
226 freq1 = (par->
osc0 *
count1 + count0 / 2) / count0;
228 for (i = 0; i <
ARRAY_SIZE(pmagbbfb_freqs); i++)
229 if (freq1 >= pmagbbfb_freqs[i] -
230 (pmagbbfb_freqs[i] + 128) / 256 &&
231 freq1 <= pmagbbfb_freqs[
i] +
232 (pmagbbfb_freqs[
i] + 128) / 256) {
233 par->
osc1 = pmagbbfb_freqs[
i];
241 gp0_write(par, par->
osc1 != 0);
243 info->
var.pixclock = par->
osc1 ?
244 (1000000000 + par->
osc1 / 2) / par->
osc1 :
245 (1000000000 + par->
osc0 / 2) / par->
osc0;
255 char freq0[12], freq1[12];
275 info->
fbops = &pmagbbfb_ops;
276 info->
fix = pmagbbfb_fix;
277 info->
var = pmagbbfb_defined;
282 len = tdev->
resource.end - start + 1;
313 pmagbbfb_erase_cursor(info);
314 pmagbbfb_screen_setup(info);
315 pmagbbfb_osc_setup(info);
326 snprintf(freq0,
sizeof(freq0),
"%u.%03uMHz",
327 par->
osc0 / 1000, par->
osc0 % 1000);
328 snprintf(freq1,
sizeof(freq1),
"%u.%03uMHz",
329 par->
osc1 / 1000, par->
osc1 % 1000);
331 pr_info(
"fb%d: %s frame buffer device at %s\n",
332 info->
node, info->
fix.id, dev_name(dev));
333 pr_info(
"fb%d: Osc0: %s, Osc1: %s, Osc%u selected\n",
334 info->
node, freq0, par->
osc1 ? freq1 :
"disabled",
369 len = tdev->
resource.end - start + 1;
380 static const struct tc_device_id pmagbbfb_tc_table[] = {
381 {
"DEC ",
"PMAGB-BA" },
386 static struct tc_driver pmagbbfb_driver = {
387 .id_table = pmagbbfb_tc_table,
391 .probe = pmagbbfb_probe,
392 .remove =
__exit_p(pmagbbfb_remove),
396 static int __init pmagbbfb_init(
void)
405 static void __exit pmagbbfb_exit(
void)