blob: 4e7a9c46e1122a460957e0a3c22f6cf04b9d8961 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
Ralf Baechle7901c792005-09-03 15:56:11 -07002 * linux/drivers/video/pmagb-b-fb.c
Linus Torvalds1da177e2005-04-16 15:20:36 -07003 *
Ralf Baechle7901c792005-09-03 15:56:11 -07004 * PMAGB-B TURBOchannel Smart Frame Buffer (SFB) card support,
5 * derived from:
Linus Torvalds1da177e2005-04-16 15:20:36 -07006 * "HP300 Topcat framebuffer support (derived from macfb of all things)
7 * Phil Blundell <philb@gnu.org> 1998", the original code can be
Ralf Baechle7901c792005-09-03 15:56:11 -07008 * found in the file hpfb.c in the same directory.
Linus Torvalds1da177e2005-04-16 15:20:36 -07009 *
Ralf Baechle7901c792005-09-03 15:56:11 -070010 * DECstation related code Copyright (C) 1999, 2000, 2001 by
11 * Michael Engel <engel@unix-ag.org>,
12 * Karsten Merker <merker@linuxtag.org> and
Linus Torvalds1da177e2005-04-16 15:20:36 -070013 * Harald Koerfgen.
Maciej W. Rozycki9084b002007-02-05 16:28:29 -080014 * Copyright (c) 2005, 2006 Maciej W. Rozycki
Linus Torvalds1da177e2005-04-16 15:20:36 -070015 *
Ralf Baechle7901c792005-09-03 15:56:11 -070016 * This file is subject to the terms and conditions of the GNU General
17 * Public License. See the file COPYING in the main directory of this
18 * archive for more details.
Linus Torvalds1da177e2005-04-16 15:20:36 -070019 */
20
Ralf Baechle7901c792005-09-03 15:56:11 -070021#include <linux/compiler.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070022#include <linux/delay.h>
Ralf Baechle7901c792005-09-03 15:56:11 -070023#include <linux/errno.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070024#include <linux/fb.h>
Ralf Baechle7901c792005-09-03 15:56:11 -070025#include <linux/init.h>
26#include <linux/kernel.h>
27#include <linux/module.h>
Maciej W. Rozycki9084b002007-02-05 16:28:29 -080028#include <linux/tc.h>
Ralf Baechle7901c792005-09-03 15:56:11 -070029#include <linux/types.h>
30
Ralf Baechle7901c792005-09-03 15:56:11 -070031#include <asm/io.h>
Ralf Baechle7901c792005-09-03 15:56:11 -070032
Linus Torvalds1da177e2005-04-16 15:20:36 -070033#include <video/pmagb-b-fb.h>
34
Ralf Baechle7901c792005-09-03 15:56:11 -070035
36struct pmagbbfb_par {
Ralf Baechle7901c792005-09-03 15:56:11 -070037 volatile void __iomem *mmio;
38 volatile void __iomem *smem;
39 volatile u32 __iomem *sfb;
40 volatile u32 __iomem *dac;
41 unsigned int osc0;
42 unsigned int osc1;
43 int slot;
Linus Torvalds1da177e2005-04-16 15:20:36 -070044};
45
Linus Torvalds1da177e2005-04-16 15:20:36 -070046
Ralf Baechle5b1638d2010-07-26 19:08:15 +010047static struct fb_var_screeninfo pmagbbfb_defined __devinitdata = {
Linus Torvalds1da177e2005-04-16 15:20:36 -070048 .bits_per_pixel = 8,
49 .red.length = 8,
50 .green.length = 8,
51 .blue.length = 8,
52 .activate = FB_ACTIVATE_NOW,
Ralf Baechle7901c792005-09-03 15:56:11 -070053 .height = -1,
54 .width = -1,
Linus Torvalds1da177e2005-04-16 15:20:36 -070055 .accel_flags = FB_ACCEL_NONE,
Ralf Baechle7901c792005-09-03 15:56:11 -070056 .sync = FB_SYNC_ON_GREEN,
Linus Torvalds1da177e2005-04-16 15:20:36 -070057 .vmode = FB_VMODE_NONINTERLACED,
58};
59
Ralf Baechle5b1638d2010-07-26 19:08:15 +010060static struct fb_fix_screeninfo pmagbbfb_fix __devinitdata = {
Linus Torvalds1da177e2005-04-16 15:20:36 -070061 .id = "PMAGB-BA",
Ralf Baechle7901c792005-09-03 15:56:11 -070062 .smem_len = (2048 * 1024),
Linus Torvalds1da177e2005-04-16 15:20:36 -070063 .type = FB_TYPE_PACKED_PIXELS,
64 .visual = FB_VISUAL_PSEUDOCOLOR,
Ralf Baechle7901c792005-09-03 15:56:11 -070065 .mmio_len = PMAGB_B_FBMEM,
66};
67
68
69static inline void sfb_write(struct pmagbbfb_par *par, unsigned int reg, u32 v)
70{
71 writel(v, par->sfb + reg / 4);
Linus Torvalds1da177e2005-04-16 15:20:36 -070072}
73
Ralf Baechle7901c792005-09-03 15:56:11 -070074static inline u32 sfb_read(struct pmagbbfb_par *par, unsigned int reg)
Linus Torvalds1da177e2005-04-16 15:20:36 -070075{
Ralf Baechle7901c792005-09-03 15:56:11 -070076 return readl(par->sfb + reg / 4);
Linus Torvalds1da177e2005-04-16 15:20:36 -070077}
78
Ralf Baechle7901c792005-09-03 15:56:11 -070079static inline void dac_write(struct pmagbbfb_par *par, unsigned int reg, u8 v)
Linus Torvalds1da177e2005-04-16 15:20:36 -070080{
Ralf Baechle7901c792005-09-03 15:56:11 -070081 writeb(v, par->dac + reg / 4);
82}
83
84static inline u8 dac_read(struct pmagbbfb_par *par, unsigned int reg)
85{
86 return readb(par->dac + reg / 4);
87}
88
89static inline void gp0_write(struct pmagbbfb_par *par, u32 v)
90{
91 writel(v, par->mmio + PMAGB_B_GP0);
92}
93
94
95/*
96 * Set the palette.
97 */
98static int pmagbbfb_setcolreg(unsigned int regno, unsigned int red,
99 unsigned int green, unsigned int blue,
100 unsigned int transp, struct fb_info *info)
101{
102 struct pmagbbfb_par *par = info->par;
103
Krzysztof Helt2f390382009-12-15 16:46:25 -0800104 if (regno >= info->cmap.len)
105 return 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700106
107 red >>= 8; /* The cmap fields are 16 bits */
Ralf Baechle7901c792005-09-03 15:56:11 -0700108 green >>= 8; /* wide, but the hardware colormap */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700109 blue >>= 8; /* registers are only 8 bits wide */
110
Ralf Baechle7901c792005-09-03 15:56:11 -0700111 mb();
112 dac_write(par, BT459_ADDR_LO, regno);
113 dac_write(par, BT459_ADDR_HI, 0x00);
114 wmb();
115 dac_write(par, BT459_CMAP, red);
116 wmb();
117 dac_write(par, BT459_CMAP, green);
118 wmb();
119 dac_write(par, BT459_CMAP, blue);
120
Linus Torvalds1da177e2005-04-16 15:20:36 -0700121 return 0;
122}
123
124static struct fb_ops pmagbbfb_ops = {
125 .owner = THIS_MODULE,
126 .fb_setcolreg = pmagbbfb_setcolreg,
127 .fb_fillrect = cfb_fillrect,
128 .fb_copyarea = cfb_copyarea,
129 .fb_imageblit = cfb_imageblit,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700130};
131
Ralf Baechle7901c792005-09-03 15:56:11 -0700132
133/*
134 * Turn the hardware cursor off.
135 */
136static void __init pmagbbfb_erase_cursor(struct fb_info *info)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700137{
Ralf Baechle7901c792005-09-03 15:56:11 -0700138 struct pmagbbfb_par *par = info->par;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700139
Ralf Baechle7901c792005-09-03 15:56:11 -0700140 mb();
141 dac_write(par, BT459_ADDR_LO, 0x00);
142 dac_write(par, BT459_ADDR_HI, 0x03);
143 wmb();
144 dac_write(par, BT459_DATA, 0x00);
145}
Linus Torvalds1da177e2005-04-16 15:20:36 -0700146
Ralf Baechle7901c792005-09-03 15:56:11 -0700147/*
148 * Set up screen parameters.
149 */
Ralf Baechle5b1638d2010-07-26 19:08:15 +0100150static void __devinit pmagbbfb_screen_setup(struct fb_info *info)
Ralf Baechle7901c792005-09-03 15:56:11 -0700151{
152 struct pmagbbfb_par *par = info->par;
153
154 info->var.xres = ((sfb_read(par, SFB_REG_VID_HOR) >>
155 SFB_VID_HOR_PIX_SHIFT) & SFB_VID_HOR_PIX_MASK) * 4;
156 info->var.xres_virtual = info->var.xres;
157 info->var.yres = (sfb_read(par, SFB_REG_VID_VER) >>
158 SFB_VID_VER_SL_SHIFT) & SFB_VID_VER_SL_MASK;
159 info->var.yres_virtual = info->var.yres;
160 info->var.left_margin = ((sfb_read(par, SFB_REG_VID_HOR) >>
161 SFB_VID_HOR_BP_SHIFT) &
162 SFB_VID_HOR_BP_MASK) * 4;
163 info->var.right_margin = ((sfb_read(par, SFB_REG_VID_HOR) >>
164 SFB_VID_HOR_FP_SHIFT) &
165 SFB_VID_HOR_FP_MASK) * 4;
166 info->var.upper_margin = (sfb_read(par, SFB_REG_VID_VER) >>
167 SFB_VID_VER_BP_SHIFT) & SFB_VID_VER_BP_MASK;
168 info->var.lower_margin = (sfb_read(par, SFB_REG_VID_VER) >>
169 SFB_VID_VER_FP_SHIFT) & SFB_VID_VER_FP_MASK;
170 info->var.hsync_len = ((sfb_read(par, SFB_REG_VID_HOR) >>
171 SFB_VID_HOR_SYN_SHIFT) &
172 SFB_VID_HOR_SYN_MASK) * 4;
173 info->var.vsync_len = (sfb_read(par, SFB_REG_VID_VER) >>
174 SFB_VID_VER_SYN_SHIFT) & SFB_VID_VER_SYN_MASK;
175
176 info->fix.line_length = info->var.xres;
177};
178
179/*
180 * Determine oscillator configuration.
181 */
Ralf Baechle5b1638d2010-07-26 19:08:15 +0100182static void __devinit pmagbbfb_osc_setup(struct fb_info *info)
Ralf Baechle7901c792005-09-03 15:56:11 -0700183{
Ralf Baechle5b1638d2010-07-26 19:08:15 +0100184 static unsigned int pmagbbfb_freqs[] __devinitdata = {
Maciej W. Rozycki572c04b2006-12-08 02:40:21 -0800185 130808, 119843, 104000, 92980, 74370, 72800,
Ralf Baechle7901c792005-09-03 15:56:11 -0700186 69197, 66000, 65000, 50350, 36000, 32000, 25175
187 };
188 struct pmagbbfb_par *par = info->par;
Maciej W. Rozycki9084b002007-02-05 16:28:29 -0800189 struct tc_bus *tbus = to_tc_dev(info->device)->bus;
Ralf Baechle7901c792005-09-03 15:56:11 -0700190 u32 count0 = 8, count1 = 8, counttc = 16 * 256 + 8;
Maciej W. Rozycki9084b002007-02-05 16:28:29 -0800191 u32 freq0, freq1, freqtc = tc_get_speed(tbus) / 250;
Ralf Baechle7901c792005-09-03 15:56:11 -0700192 int i, j;
193
194 gp0_write(par, 0); /* select Osc0 */
195 for (j = 0; j < 16; j++) {
196 mb();
197 sfb_write(par, SFB_REG_TCCLK_COUNT, 0);
198 mb();
199 for (i = 0; i < 100; i++) { /* nominally max. 20.5us */
200 if (sfb_read(par, SFB_REG_TCCLK_COUNT) == 0)
201 break;
202 udelay(1);
203 }
204 count0 += sfb_read(par, SFB_REG_VIDCLK_COUNT);
205 }
206
207 gp0_write(par, 1); /* select Osc1 */
208 for (j = 0; j < 16; j++) {
209 mb();
210 sfb_write(par, SFB_REG_TCCLK_COUNT, 0);
211
212 for (i = 0; i < 100; i++) { /* nominally max. 20.5us */
213 if (sfb_read(par, SFB_REG_TCCLK_COUNT) == 0)
214 break;
215 udelay(1);
216 }
217 count1 += sfb_read(par, SFB_REG_VIDCLK_COUNT);
218 }
219
220 freq0 = (freqtc * count0 + counttc / 2) / counttc;
221 par->osc0 = freq0;
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];
225
226 freq1 = (par->osc0 * count1 + count0 / 2) / count0;
227 par->osc1 = freq1;
Tobias Klauserd1ae4182006-03-27 01:17:39 -0800228 for (i = 0; i < ARRAY_SIZE(pmagbbfb_freqs); i++)
Ralf Baechle7901c792005-09-03 15:56:11 -0700229 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];
234 break;
235 }
236
237 if (par->osc0 - par->osc1 <= (par->osc0 + par->osc1 + 256) / 512 ||
238 par->osc1 - par->osc0 <= (par->osc0 + par->osc1 + 256) / 512)
239 par->osc1 = 0;
240
241 gp0_write(par, par->osc1 != 0); /* reselect OscX */
242
243 info->var.pixclock = par->osc1 ?
244 (1000000000 + par->osc1 / 2) / par->osc1 :
245 (1000000000 + par->osc0 / 2) / par->osc0;
246};
247
248
Ralf Baechle5b1638d2010-07-26 19:08:15 +0100249static int __devinit pmagbbfb_probe(struct device *dev)
Ralf Baechle7901c792005-09-03 15:56:11 -0700250{
Maciej W. Rozycki9084b002007-02-05 16:28:29 -0800251 struct tc_dev *tdev = to_tc_dev(dev);
252 resource_size_t start, len;
Ralf Baechle7901c792005-09-03 15:56:11 -0700253 struct fb_info *info;
254 struct pmagbbfb_par *par;
Maciej W. Rozycki9084b002007-02-05 16:28:29 -0800255 char freq0[12], freq1[12];
Ralf Baechle7901c792005-09-03 15:56:11 -0700256 u32 vid_base;
Maciej W. Rozycki840bc9b2007-10-16 01:29:36 -0700257 int err;
Ralf Baechle7901c792005-09-03 15:56:11 -0700258
Maciej W. Rozycki9084b002007-02-05 16:28:29 -0800259 info = framebuffer_alloc(sizeof(struct pmagbbfb_par), dev);
Maciej W. Rozycki840bc9b2007-10-16 01:29:36 -0700260 if (!info) {
Kay Sievers7ad33e72009-03-24 16:38:21 -0700261 printk(KERN_ERR "%s: Cannot allocate memory\n", dev_name(dev));
Ralf Baechle7901c792005-09-03 15:56:11 -0700262 return -ENOMEM;
Maciej W. Rozycki840bc9b2007-10-16 01:29:36 -0700263 }
Ralf Baechle7901c792005-09-03 15:56:11 -0700264
265 par = info->par;
Maciej W. Rozycki9084b002007-02-05 16:28:29 -0800266 dev_set_drvdata(dev, info);
Ralf Baechle7901c792005-09-03 15:56:11 -0700267
Maciej W. Rozycki840bc9b2007-10-16 01:29:36 -0700268 if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) {
269 printk(KERN_ERR "%s: Cannot allocate color map\n",
Kay Sievers7ad33e72009-03-24 16:38:21 -0700270 dev_name(dev));
Maciej W. Rozycki840bc9b2007-10-16 01:29:36 -0700271 err = -ENOMEM;
Ralf Baechle7901c792005-09-03 15:56:11 -0700272 goto err_alloc;
Maciej W. Rozycki840bc9b2007-10-16 01:29:36 -0700273 }
Ralf Baechle7901c792005-09-03 15:56:11 -0700274
Linus Torvalds1da177e2005-04-16 15:20:36 -0700275 info->fbops = &pmagbbfb_ops;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700276 info->fix = pmagbbfb_fix;
Ralf Baechle7901c792005-09-03 15:56:11 -0700277 info->var = pmagbbfb_defined;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700278 info->flags = FBINFO_DEFAULT;
279
Maciej W. Rozycki9084b002007-02-05 16:28:29 -0800280 /* Request the I/O MEM resource. */
281 start = tdev->resource.start;
282 len = tdev->resource.end - start + 1;
Kay Sievers7ad33e72009-03-24 16:38:21 -0700283 if (!request_mem_region(start, len, dev_name(dev))) {
284 printk(KERN_ERR "%s: Cannot reserve FB region\n",
285 dev_name(dev));
Maciej W. Rozycki840bc9b2007-10-16 01:29:36 -0700286 err = -EBUSY;
Maciej W. Rozycki9084b002007-02-05 16:28:29 -0800287 goto err_cmap;
Maciej W. Rozycki840bc9b2007-10-16 01:29:36 -0700288 }
Maciej W. Rozycki9084b002007-02-05 16:28:29 -0800289
Ralf Baechle7901c792005-09-03 15:56:11 -0700290 /* MMIO mapping setup. */
Maciej W. Rozycki9084b002007-02-05 16:28:29 -0800291 info->fix.mmio_start = start;
Ralf Baechle7901c792005-09-03 15:56:11 -0700292 par->mmio = ioremap_nocache(info->fix.mmio_start, info->fix.mmio_len);
Maciej W. Rozycki840bc9b2007-10-16 01:29:36 -0700293 if (!par->mmio) {
Kay Sievers7ad33e72009-03-24 16:38:21 -0700294 printk(KERN_ERR "%s: Cannot map MMIO\n", dev_name(dev));
Maciej W. Rozycki840bc9b2007-10-16 01:29:36 -0700295 err = -ENOMEM;
Maciej W. Rozycki9084b002007-02-05 16:28:29 -0800296 goto err_resource;
Maciej W. Rozycki840bc9b2007-10-16 01:29:36 -0700297 }
Ralf Baechle7901c792005-09-03 15:56:11 -0700298 par->sfb = par->mmio + PMAGB_B_SFB;
299 par->dac = par->mmio + PMAGB_B_BT459;
300
301 /* Frame buffer mapping setup. */
Maciej W. Rozycki9084b002007-02-05 16:28:29 -0800302 info->fix.smem_start = start + PMAGB_B_FBMEM;
Ralf Baechle7901c792005-09-03 15:56:11 -0700303 par->smem = ioremap_nocache(info->fix.smem_start, info->fix.smem_len);
Maciej W. Rozycki840bc9b2007-10-16 01:29:36 -0700304 if (!par->smem) {
Kay Sievers7ad33e72009-03-24 16:38:21 -0700305 printk(KERN_ERR "%s: Cannot map FB\n", dev_name(dev));
Maciej W. Rozycki840bc9b2007-10-16 01:29:36 -0700306 err = -ENOMEM;
Ralf Baechle7901c792005-09-03 15:56:11 -0700307 goto err_mmio_map;
Maciej W. Rozycki840bc9b2007-10-16 01:29:36 -0700308 }
Ralf Baechle7901c792005-09-03 15:56:11 -0700309 vid_base = sfb_read(par, SFB_REG_VID_BASE);
310 info->screen_base = (void __iomem *)par->smem + vid_base * 0x1000;
311 info->screen_size = info->fix.smem_len - 2 * vid_base * 0x1000;
312
313 pmagbbfb_erase_cursor(info);
314 pmagbbfb_screen_setup(info);
315 pmagbbfb_osc_setup(info);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700316
Maciej W. Rozycki840bc9b2007-10-16 01:29:36 -0700317 err = register_framebuffer(info);
318 if (err < 0) {
319 printk(KERN_ERR "%s: Cannot register framebuffer\n",
Kay Sievers7ad33e72009-03-24 16:38:21 -0700320 dev_name(dev));
Ralf Baechle7901c792005-09-03 15:56:11 -0700321 goto err_smem_map;
Maciej W. Rozycki840bc9b2007-10-16 01:29:36 -0700322 }
Ralf Baechle7901c792005-09-03 15:56:11 -0700323
Maciej W. Rozycki9084b002007-02-05 16:28:29 -0800324 get_device(dev);
325
Ralf Baechle7901c792005-09-03 15:56:11 -0700326 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);
330
Maciej W. Rozycki9084b002007-02-05 16:28:29 -0800331 pr_info("fb%d: %s frame buffer device at %s\n",
Kay Sievers7ad33e72009-03-24 16:38:21 -0700332 info->node, info->fix.id, dev_name(dev));
Ralf Baechle7901c792005-09-03 15:56:11 -0700333 pr_info("fb%d: Osc0: %s, Osc1: %s, Osc%u selected\n",
334 info->node, freq0, par->osc1 ? freq1 : "disabled",
335 par->osc1 != 0);
336
Linus Torvalds1da177e2005-04-16 15:20:36 -0700337 return 0;
Ralf Baechle7901c792005-09-03 15:56:11 -0700338
339
340err_smem_map:
341 iounmap(par->smem);
342
343err_mmio_map:
344 iounmap(par->mmio);
345
Maciej W. Rozycki9084b002007-02-05 16:28:29 -0800346err_resource:
347 release_mem_region(start, len);
348
Ralf Baechle7901c792005-09-03 15:56:11 -0700349err_cmap:
350 fb_dealloc_cmap(&info->cmap);
351
352err_alloc:
Ralf Baechle7901c792005-09-03 15:56:11 -0700353 framebuffer_release(info);
Maciej W. Rozycki840bc9b2007-10-16 01:29:36 -0700354 return err;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700355}
356
Maciej W. Rozycki9084b002007-02-05 16:28:29 -0800357static int __exit pmagbbfb_remove(struct device *dev)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700358{
Maciej W. Rozycki9084b002007-02-05 16:28:29 -0800359 struct tc_dev *tdev = to_tc_dev(dev);
360 struct fb_info *info = dev_get_drvdata(dev);
Ralf Baechle7901c792005-09-03 15:56:11 -0700361 struct pmagbbfb_par *par = info->par;
Maciej W. Rozycki9084b002007-02-05 16:28:29 -0800362 resource_size_t start, len;
Ralf Baechle7901c792005-09-03 15:56:11 -0700363
Maciej W. Rozycki9084b002007-02-05 16:28:29 -0800364 put_device(dev);
Ralf Baechle7901c792005-09-03 15:56:11 -0700365 unregister_framebuffer(info);
366 iounmap(par->smem);
367 iounmap(par->mmio);
Maciej W. Rozycki9084b002007-02-05 16:28:29 -0800368 start = tdev->resource.start;
369 len = tdev->resource.end - start + 1;
370 release_mem_region(start, len);
Ralf Baechle7901c792005-09-03 15:56:11 -0700371 fb_dealloc_cmap(&info->cmap);
Ralf Baechle7901c792005-09-03 15:56:11 -0700372 framebuffer_release(info);
Maciej W. Rozycki9084b002007-02-05 16:28:29 -0800373 return 0;
Ralf Baechle7901c792005-09-03 15:56:11 -0700374}
375
376
377/*
Maciej W. Rozycki9084b002007-02-05 16:28:29 -0800378 * Initialize the framebuffer.
Ralf Baechle7901c792005-09-03 15:56:11 -0700379 */
Maciej W. Rozycki9084b002007-02-05 16:28:29 -0800380static const struct tc_device_id pmagbbfb_tc_table[] = {
381 { "DEC ", "PMAGB-BA" },
382 { }
383};
384MODULE_DEVICE_TABLE(tc, pmagbbfb_tc_table);
385
386static struct tc_driver pmagbbfb_driver = {
387 .id_table = pmagbbfb_tc_table,
388 .driver = {
389 .name = "pmagbbfb",
390 .bus = &tc_bus_type,
391 .probe = pmagbbfb_probe,
392 .remove = __exit_p(pmagbbfb_remove),
393 },
394};
395
Ralf Baechle7901c792005-09-03 15:56:11 -0700396static int __init pmagbbfb_init(void)
397{
Maciej W. Rozycki9084b002007-02-05 16:28:29 -0800398#ifndef MODULE
Linus Torvalds1da177e2005-04-16 15:20:36 -0700399 if (fb_get_options("pmagbbfb", NULL))
Ralf Baechle7901c792005-09-03 15:56:11 -0700400 return -ENXIO;
Maciej W. Rozycki9084b002007-02-05 16:28:29 -0800401#endif
402 return tc_register_driver(&pmagbbfb_driver);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700403}
404
Ralf Baechle7901c792005-09-03 15:56:11 -0700405static void __exit pmagbbfb_exit(void)
406{
Maciej W. Rozycki9084b002007-02-05 16:28:29 -0800407 tc_unregister_driver(&pmagbbfb_driver);
Ralf Baechle7901c792005-09-03 15:56:11 -0700408}
409
410
Linus Torvalds1da177e2005-04-16 15:20:36 -0700411module_init(pmagbbfb_init);
Ralf Baechle7901c792005-09-03 15:56:11 -0700412module_exit(pmagbbfb_exit);
413
Linus Torvalds1da177e2005-04-16 15:20:36 -0700414MODULE_LICENSE("GPL");