Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
Ralf Baechle | af690a9 | 2005-09-03 15:56:09 -0700 | [diff] [blame] | 2 | * linux/drivers/video/pmag-ba-fb.c |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3 | * |
Ralf Baechle | af690a9 | 2005-09-03 15:56:09 -0700 | [diff] [blame] | 4 | * PMAG-BA TURBOchannel Color Frame Buffer (CFB) card support, |
| 5 | * derived from: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6 | * "HP300 Topcat framebuffer support (derived from macfb of all things) |
| 7 | * Phil Blundell <philb@gnu.org> 1998", the original code can be |
Ralf Baechle | af690a9 | 2005-09-03 15:56:09 -0700 | [diff] [blame] | 8 | * found in the file hpfb.c in the same directory. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 9 | * |
| 10 | * Based on digital document: |
| 11 | * "PMAG-BA TURBOchannel Color Frame Buffer |
| 12 | * Functional Specification", Revision 1.2, August 27, 1990 |
| 13 | * |
Ralf Baechle | af690a9 | 2005-09-03 15:56:09 -0700 | [diff] [blame] | 14 | * DECstation related code Copyright (C) 1999, 2000, 2001 by |
| 15 | * Michael Engel <engel@unix-ag.org>, |
| 16 | * Karsten Merker <merker@linuxtag.org> and |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17 | * Harald Koerfgen. |
Maciej W. Rozycki | 335dc50c | 2007-02-05 16:28:28 -0800 | [diff] [blame] | 18 | * Copyright (c) 2005, 2006 Maciej W. Rozycki |
| 19 | * Copyright (c) 2005 James Simmons |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20 | * |
Ralf Baechle | af690a9 | 2005-09-03 15:56:09 -0700 | [diff] [blame] | 21 | * This file is subject to the terms and conditions of the GNU General |
| 22 | * Public License. See the file COPYING in the main directory of this |
| 23 | * archive for more details. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 24 | */ |
Ralf Baechle | af690a9 | 2005-09-03 15:56:09 -0700 | [diff] [blame] | 25 | |
| 26 | #include <linux/compiler.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 27 | #include <linux/errno.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 28 | #include <linux/fb.h> |
Ralf Baechle | af690a9 | 2005-09-03 15:56:09 -0700 | [diff] [blame] | 29 | #include <linux/init.h> |
| 30 | #include <linux/kernel.h> |
| 31 | #include <linux/module.h> |
Maciej W. Rozycki | 335dc50c | 2007-02-05 16:28:28 -0800 | [diff] [blame] | 32 | #include <linux/tc.h> |
Ralf Baechle | af690a9 | 2005-09-03 15:56:09 -0700 | [diff] [blame] | 33 | #include <linux/types.h> |
| 34 | |
Ralf Baechle | af690a9 | 2005-09-03 15:56:09 -0700 | [diff] [blame] | 35 | #include <asm/io.h> |
Ralf Baechle | af690a9 | 2005-09-03 15:56:09 -0700 | [diff] [blame] | 36 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 37 | #include <video/pmag-ba-fb.h> |
| 38 | |
Ralf Baechle | af690a9 | 2005-09-03 15:56:09 -0700 | [diff] [blame] | 39 | |
| 40 | struct pmagbafb_par { |
Ralf Baechle | af690a9 | 2005-09-03 15:56:09 -0700 | [diff] [blame] | 41 | volatile void __iomem *mmio; |
| 42 | volatile u32 __iomem *dac; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | }; |
| 44 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 45 | |
Greg Kroah-Hartman | 48c68c4 | 2012-12-21 13:07:39 -0800 | [diff] [blame] | 46 | static struct fb_var_screeninfo pmagbafb_defined = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 47 | .xres = 1024, |
| 48 | .yres = 864, |
| 49 | .xres_virtual = 1024, |
| 50 | .yres_virtual = 864, |
| 51 | .bits_per_pixel = 8, |
| 52 | .red.length = 8, |
| 53 | .green.length = 8, |
| 54 | .blue.length = 8, |
| 55 | .activate = FB_ACTIVATE_NOW, |
Ralf Baechle | af690a9 | 2005-09-03 15:56:09 -0700 | [diff] [blame] | 56 | .height = -1, |
| 57 | .width = -1, |
| 58 | .accel_flags = FB_ACCEL_NONE, |
| 59 | .pixclock = 14452, |
| 60 | .left_margin = 116, |
| 61 | .right_margin = 12, |
| 62 | .upper_margin = 34, |
| 63 | .lower_margin = 12, |
| 64 | .hsync_len = 128, |
| 65 | .vsync_len = 3, |
| 66 | .sync = FB_SYNC_ON_GREEN, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 67 | .vmode = FB_VMODE_NONINTERLACED, |
| 68 | }; |
| 69 | |
Greg Kroah-Hartman | 48c68c4 | 2012-12-21 13:07:39 -0800 | [diff] [blame] | 70 | static struct fb_fix_screeninfo pmagbafb_fix = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 71 | .id = "PMAG-BA", |
Ralf Baechle | af690a9 | 2005-09-03 15:56:09 -0700 | [diff] [blame] | 72 | .smem_len = (1024 * 1024), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 73 | .type = FB_TYPE_PACKED_PIXELS, |
| 74 | .visual = FB_VISUAL_PSEUDOCOLOR, |
| 75 | .line_length = 1024, |
Ralf Baechle | af690a9 | 2005-09-03 15:56:09 -0700 | [diff] [blame] | 76 | .mmio_len = PMAG_BA_SIZE - PMAG_BA_BT459, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 77 | }; |
| 78 | |
Ralf Baechle | af690a9 | 2005-09-03 15:56:09 -0700 | [diff] [blame] | 79 | |
| 80 | static inline void dac_write(struct pmagbafb_par *par, unsigned int reg, u8 v) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 81 | { |
Ralf Baechle | af690a9 | 2005-09-03 15:56:09 -0700 | [diff] [blame] | 82 | writeb(v, par->dac + reg / 4); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 83 | } |
| 84 | |
Ralf Baechle | af690a9 | 2005-09-03 15:56:09 -0700 | [diff] [blame] | 85 | static inline u8 dac_read(struct pmagbafb_par *par, unsigned int reg) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 86 | { |
Ralf Baechle | af690a9 | 2005-09-03 15:56:09 -0700 | [diff] [blame] | 87 | return readb(par->dac + reg / 4); |
| 88 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 89 | |
Ralf Baechle | af690a9 | 2005-09-03 15:56:09 -0700 | [diff] [blame] | 90 | |
| 91 | /* |
| 92 | * Set the palette. |
| 93 | */ |
| 94 | static int pmagbafb_setcolreg(unsigned int regno, unsigned int red, |
| 95 | unsigned int green, unsigned int blue, |
| 96 | unsigned int transp, struct fb_info *info) |
| 97 | { |
| 98 | struct pmagbafb_par *par = info->par; |
| 99 | |
Krzysztof Helt | 2f39038 | 2009-12-15 16:46:25 -0800 | [diff] [blame] | 100 | if (regno >= info->cmap.len) |
| 101 | return 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 102 | |
| 103 | red >>= 8; /* The cmap fields are 16 bits */ |
Ralf Baechle | af690a9 | 2005-09-03 15:56:09 -0700 | [diff] [blame] | 104 | green >>= 8; /* wide, but the hardware colormap */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 105 | blue >>= 8; /* registers are only 8 bits wide */ |
| 106 | |
Ralf Baechle | af690a9 | 2005-09-03 15:56:09 -0700 | [diff] [blame] | 107 | mb(); |
| 108 | dac_write(par, BT459_ADDR_LO, regno); |
| 109 | dac_write(par, BT459_ADDR_HI, 0x00); |
| 110 | wmb(); |
| 111 | dac_write(par, BT459_CMAP, red); |
| 112 | wmb(); |
| 113 | dac_write(par, BT459_CMAP, green); |
| 114 | wmb(); |
| 115 | dac_write(par, BT459_CMAP, blue); |
| 116 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 117 | return 0; |
| 118 | } |
| 119 | |
| 120 | static struct fb_ops pmagbafb_ops = { |
| 121 | .owner = THIS_MODULE, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 122 | .fb_setcolreg = pmagbafb_setcolreg, |
| 123 | .fb_fillrect = cfb_fillrect, |
| 124 | .fb_copyarea = cfb_copyarea, |
| 125 | .fb_imageblit = cfb_imageblit, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 126 | }; |
| 127 | |
Ralf Baechle | af690a9 | 2005-09-03 15:56:09 -0700 | [diff] [blame] | 128 | |
| 129 | /* |
| 130 | * Turn the hardware cursor off. |
| 131 | */ |
| 132 | static void __init pmagbafb_erase_cursor(struct fb_info *info) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 133 | { |
Ralf Baechle | af690a9 | 2005-09-03 15:56:09 -0700 | [diff] [blame] | 134 | struct pmagbafb_par *par = info->par; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 135 | |
Ralf Baechle | af690a9 | 2005-09-03 15:56:09 -0700 | [diff] [blame] | 136 | mb(); |
| 137 | dac_write(par, BT459_ADDR_LO, 0x00); |
| 138 | dac_write(par, BT459_ADDR_HI, 0x03); |
| 139 | wmb(); |
| 140 | dac_write(par, BT459_DATA, 0x00); |
| 141 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 142 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 143 | |
Greg Kroah-Hartman | 48c68c4 | 2012-12-21 13:07:39 -0800 | [diff] [blame] | 144 | static int pmagbafb_probe(struct device *dev) |
Ralf Baechle | af690a9 | 2005-09-03 15:56:09 -0700 | [diff] [blame] | 145 | { |
Maciej W. Rozycki | 335dc50c | 2007-02-05 16:28:28 -0800 | [diff] [blame] | 146 | struct tc_dev *tdev = to_tc_dev(dev); |
| 147 | resource_size_t start, len; |
Ralf Baechle | af690a9 | 2005-09-03 15:56:09 -0700 | [diff] [blame] | 148 | struct fb_info *info; |
| 149 | struct pmagbafb_par *par; |
Maciej W. Rozycki | 53ee1b5 | 2007-10-16 01:29:30 -0700 | [diff] [blame] | 150 | int err; |
Ralf Baechle | af690a9 | 2005-09-03 15:56:09 -0700 | [diff] [blame] | 151 | |
Maciej W. Rozycki | 335dc50c | 2007-02-05 16:28:28 -0800 | [diff] [blame] | 152 | info = framebuffer_alloc(sizeof(struct pmagbafb_par), dev); |
Maciej W. Rozycki | 53ee1b5 | 2007-10-16 01:29:30 -0700 | [diff] [blame] | 153 | if (!info) { |
Kay Sievers | 7ad33e7 | 2009-03-24 16:38:21 -0700 | [diff] [blame] | 154 | printk(KERN_ERR "%s: Cannot allocate memory\n", dev_name(dev)); |
Ralf Baechle | af690a9 | 2005-09-03 15:56:09 -0700 | [diff] [blame] | 155 | return -ENOMEM; |
Maciej W. Rozycki | 53ee1b5 | 2007-10-16 01:29:30 -0700 | [diff] [blame] | 156 | } |
Ralf Baechle | af690a9 | 2005-09-03 15:56:09 -0700 | [diff] [blame] | 157 | |
| 158 | par = info->par; |
Maciej W. Rozycki | 335dc50c | 2007-02-05 16:28:28 -0800 | [diff] [blame] | 159 | dev_set_drvdata(dev, info); |
Ralf Baechle | af690a9 | 2005-09-03 15:56:09 -0700 | [diff] [blame] | 160 | |
Maciej W. Rozycki | 53ee1b5 | 2007-10-16 01:29:30 -0700 | [diff] [blame] | 161 | if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) { |
| 162 | printk(KERN_ERR "%s: Cannot allocate color map\n", |
Kay Sievers | 7ad33e7 | 2009-03-24 16:38:21 -0700 | [diff] [blame] | 163 | dev_name(dev)); |
Maciej W. Rozycki | 53ee1b5 | 2007-10-16 01:29:30 -0700 | [diff] [blame] | 164 | err = -ENOMEM; |
Ralf Baechle | af690a9 | 2005-09-03 15:56:09 -0700 | [diff] [blame] | 165 | goto err_alloc; |
Maciej W. Rozycki | 53ee1b5 | 2007-10-16 01:29:30 -0700 | [diff] [blame] | 166 | } |
Ralf Baechle | af690a9 | 2005-09-03 15:56:09 -0700 | [diff] [blame] | 167 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 168 | info->fbops = &pmagbafb_ops; |
Ralf Baechle | af690a9 | 2005-09-03 15:56:09 -0700 | [diff] [blame] | 169 | info->fix = pmagbafb_fix; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 170 | info->var = pmagbafb_defined; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 171 | info->flags = FBINFO_DEFAULT; |
| 172 | |
Maciej W. Rozycki | 335dc50c | 2007-02-05 16:28:28 -0800 | [diff] [blame] | 173 | /* Request the I/O MEM resource. */ |
| 174 | start = tdev->resource.start; |
| 175 | len = tdev->resource.end - start + 1; |
Kay Sievers | 7ad33e7 | 2009-03-24 16:38:21 -0700 | [diff] [blame] | 176 | if (!request_mem_region(start, len, dev_name(dev))) { |
| 177 | printk(KERN_ERR "%s: Cannot reserve FB region\n", |
| 178 | dev_name(dev)); |
Maciej W. Rozycki | 53ee1b5 | 2007-10-16 01:29:30 -0700 | [diff] [blame] | 179 | err = -EBUSY; |
Maciej W. Rozycki | 335dc50c | 2007-02-05 16:28:28 -0800 | [diff] [blame] | 180 | goto err_cmap; |
Maciej W. Rozycki | 53ee1b5 | 2007-10-16 01:29:30 -0700 | [diff] [blame] | 181 | } |
Maciej W. Rozycki | 335dc50c | 2007-02-05 16:28:28 -0800 | [diff] [blame] | 182 | |
Ralf Baechle | af690a9 | 2005-09-03 15:56:09 -0700 | [diff] [blame] | 183 | /* MMIO mapping setup. */ |
Maciej W. Rozycki | 335dc50c | 2007-02-05 16:28:28 -0800 | [diff] [blame] | 184 | info->fix.mmio_start = start; |
Ralf Baechle | af690a9 | 2005-09-03 15:56:09 -0700 | [diff] [blame] | 185 | par->mmio = ioremap_nocache(info->fix.mmio_start, info->fix.mmio_len); |
Maciej W. Rozycki | 53ee1b5 | 2007-10-16 01:29:30 -0700 | [diff] [blame] | 186 | if (!par->mmio) { |
Kay Sievers | 7ad33e7 | 2009-03-24 16:38:21 -0700 | [diff] [blame] | 187 | printk(KERN_ERR "%s: Cannot map MMIO\n", dev_name(dev)); |
Maciej W. Rozycki | 53ee1b5 | 2007-10-16 01:29:30 -0700 | [diff] [blame] | 188 | err = -ENOMEM; |
Maciej W. Rozycki | 335dc50c | 2007-02-05 16:28:28 -0800 | [diff] [blame] | 189 | goto err_resource; |
Maciej W. Rozycki | 53ee1b5 | 2007-10-16 01:29:30 -0700 | [diff] [blame] | 190 | } |
Ralf Baechle | af690a9 | 2005-09-03 15:56:09 -0700 | [diff] [blame] | 191 | par->dac = par->mmio + PMAG_BA_BT459; |
| 192 | |
| 193 | /* Frame buffer mapping setup. */ |
Maciej W. Rozycki | 335dc50c | 2007-02-05 16:28:28 -0800 | [diff] [blame] | 194 | info->fix.smem_start = start + PMAG_BA_FBMEM; |
Ralf Baechle | af690a9 | 2005-09-03 15:56:09 -0700 | [diff] [blame] | 195 | info->screen_base = ioremap_nocache(info->fix.smem_start, |
| 196 | info->fix.smem_len); |
Maciej W. Rozycki | 53ee1b5 | 2007-10-16 01:29:30 -0700 | [diff] [blame] | 197 | if (!info->screen_base) { |
Kay Sievers | 7ad33e7 | 2009-03-24 16:38:21 -0700 | [diff] [blame] | 198 | printk(KERN_ERR "%s: Cannot map FB\n", dev_name(dev)); |
Maciej W. Rozycki | 53ee1b5 | 2007-10-16 01:29:30 -0700 | [diff] [blame] | 199 | err = -ENOMEM; |
Ralf Baechle | af690a9 | 2005-09-03 15:56:09 -0700 | [diff] [blame] | 200 | goto err_mmio_map; |
Maciej W. Rozycki | 53ee1b5 | 2007-10-16 01:29:30 -0700 | [diff] [blame] | 201 | } |
Ralf Baechle | af690a9 | 2005-09-03 15:56:09 -0700 | [diff] [blame] | 202 | info->screen_size = info->fix.smem_len; |
| 203 | |
| 204 | pmagbafb_erase_cursor(info); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 205 | |
Maciej W. Rozycki | 53ee1b5 | 2007-10-16 01:29:30 -0700 | [diff] [blame] | 206 | err = register_framebuffer(info); |
| 207 | if (err < 0) { |
| 208 | printk(KERN_ERR "%s: Cannot register framebuffer\n", |
Kay Sievers | 7ad33e7 | 2009-03-24 16:38:21 -0700 | [diff] [blame] | 209 | dev_name(dev)); |
Ralf Baechle | af690a9 | 2005-09-03 15:56:09 -0700 | [diff] [blame] | 210 | goto err_smem_map; |
Maciej W. Rozycki | 53ee1b5 | 2007-10-16 01:29:30 -0700 | [diff] [blame] | 211 | } |
Ralf Baechle | af690a9 | 2005-09-03 15:56:09 -0700 | [diff] [blame] | 212 | |
Maciej W. Rozycki | 335dc50c | 2007-02-05 16:28:28 -0800 | [diff] [blame] | 213 | get_device(dev); |
| 214 | |
Joe Perches | 31b6780 | 2013-09-19 18:35:55 -0700 | [diff] [blame] | 215 | fb_info(info, "%s frame buffer device at %s\n", |
| 216 | info->fix.id, dev_name(dev)); |
Ralf Baechle | af690a9 | 2005-09-03 15:56:09 -0700 | [diff] [blame] | 217 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 218 | return 0; |
Ralf Baechle | af690a9 | 2005-09-03 15:56:09 -0700 | [diff] [blame] | 219 | |
| 220 | |
| 221 | err_smem_map: |
| 222 | iounmap(info->screen_base); |
| 223 | |
| 224 | err_mmio_map: |
| 225 | iounmap(par->mmio); |
| 226 | |
Maciej W. Rozycki | 335dc50c | 2007-02-05 16:28:28 -0800 | [diff] [blame] | 227 | err_resource: |
| 228 | release_mem_region(start, len); |
| 229 | |
Ralf Baechle | af690a9 | 2005-09-03 15:56:09 -0700 | [diff] [blame] | 230 | err_cmap: |
| 231 | fb_dealloc_cmap(&info->cmap); |
| 232 | |
| 233 | err_alloc: |
Ralf Baechle | af690a9 | 2005-09-03 15:56:09 -0700 | [diff] [blame] | 234 | framebuffer_release(info); |
Maciej W. Rozycki | 53ee1b5 | 2007-10-16 01:29:30 -0700 | [diff] [blame] | 235 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 236 | } |
| 237 | |
Maciej W. Rozycki | 335dc50c | 2007-02-05 16:28:28 -0800 | [diff] [blame] | 238 | static int __exit pmagbafb_remove(struct device *dev) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 239 | { |
Maciej W. Rozycki | 335dc50c | 2007-02-05 16:28:28 -0800 | [diff] [blame] | 240 | struct tc_dev *tdev = to_tc_dev(dev); |
| 241 | struct fb_info *info = dev_get_drvdata(dev); |
Ralf Baechle | af690a9 | 2005-09-03 15:56:09 -0700 | [diff] [blame] | 242 | struct pmagbafb_par *par = info->par; |
Maciej W. Rozycki | 335dc50c | 2007-02-05 16:28:28 -0800 | [diff] [blame] | 243 | resource_size_t start, len; |
Ralf Baechle | af690a9 | 2005-09-03 15:56:09 -0700 | [diff] [blame] | 244 | |
Maciej W. Rozycki | 335dc50c | 2007-02-05 16:28:28 -0800 | [diff] [blame] | 245 | put_device(dev); |
Ralf Baechle | af690a9 | 2005-09-03 15:56:09 -0700 | [diff] [blame] | 246 | unregister_framebuffer(info); |
| 247 | iounmap(info->screen_base); |
| 248 | iounmap(par->mmio); |
Maciej W. Rozycki | 335dc50c | 2007-02-05 16:28:28 -0800 | [diff] [blame] | 249 | start = tdev->resource.start; |
| 250 | len = tdev->resource.end - start + 1; |
| 251 | release_mem_region(start, len); |
Ralf Baechle | af690a9 | 2005-09-03 15:56:09 -0700 | [diff] [blame] | 252 | fb_dealloc_cmap(&info->cmap); |
Ralf Baechle | af690a9 | 2005-09-03 15:56:09 -0700 | [diff] [blame] | 253 | framebuffer_release(info); |
Maciej W. Rozycki | 335dc50c | 2007-02-05 16:28:28 -0800 | [diff] [blame] | 254 | return 0; |
Ralf Baechle | af690a9 | 2005-09-03 15:56:09 -0700 | [diff] [blame] | 255 | } |
| 256 | |
| 257 | |
| 258 | /* |
Maciej W. Rozycki | 335dc50c | 2007-02-05 16:28:28 -0800 | [diff] [blame] | 259 | * Initialize the framebuffer. |
Ralf Baechle | af690a9 | 2005-09-03 15:56:09 -0700 | [diff] [blame] | 260 | */ |
Maciej W. Rozycki | 335dc50c | 2007-02-05 16:28:28 -0800 | [diff] [blame] | 261 | static const struct tc_device_id pmagbafb_tc_table[] = { |
| 262 | { "DEC ", "PMAG-BA " }, |
| 263 | { } |
| 264 | }; |
| 265 | MODULE_DEVICE_TABLE(tc, pmagbafb_tc_table); |
| 266 | |
| 267 | static struct tc_driver pmagbafb_driver = { |
| 268 | .id_table = pmagbafb_tc_table, |
| 269 | .driver = { |
| 270 | .name = "pmagbafb", |
| 271 | .bus = &tc_bus_type, |
| 272 | .probe = pmagbafb_probe, |
| 273 | .remove = __exit_p(pmagbafb_remove), |
| 274 | }, |
| 275 | }; |
| 276 | |
Ralf Baechle | af690a9 | 2005-09-03 15:56:09 -0700 | [diff] [blame] | 277 | static int __init pmagbafb_init(void) |
| 278 | { |
Maciej W. Rozycki | 335dc50c | 2007-02-05 16:28:28 -0800 | [diff] [blame] | 279 | #ifndef MODULE |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 280 | if (fb_get_options("pmagbafb", NULL)) |
Ralf Baechle | af690a9 | 2005-09-03 15:56:09 -0700 | [diff] [blame] | 281 | return -ENXIO; |
Maciej W. Rozycki | 335dc50c | 2007-02-05 16:28:28 -0800 | [diff] [blame] | 282 | #endif |
| 283 | return tc_register_driver(&pmagbafb_driver); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 284 | } |
| 285 | |
Ralf Baechle | af690a9 | 2005-09-03 15:56:09 -0700 | [diff] [blame] | 286 | static void __exit pmagbafb_exit(void) |
| 287 | { |
Maciej W. Rozycki | 335dc50c | 2007-02-05 16:28:28 -0800 | [diff] [blame] | 288 | tc_unregister_driver(&pmagbafb_driver); |
Ralf Baechle | af690a9 | 2005-09-03 15:56:09 -0700 | [diff] [blame] | 289 | } |
| 290 | |
| 291 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 292 | module_init(pmagbafb_init); |
Ralf Baechle | af690a9 | 2005-09-03 15:56:09 -0700 | [diff] [blame] | 293 | module_exit(pmagbafb_exit); |
| 294 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 295 | MODULE_LICENSE("GPL"); |