Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* p9100.c: P9100 frame buffer driver |
| 2 | * |
David S. Miller | 50312ce | 2006-06-29 14:35:52 -0700 | [diff] [blame] | 3 | * Copyright (C) 2003, 2006 David S. Miller (davem@davemloft.net) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4 | * Copyright 1999 Derrick J Brashear (shadow@dementia.org) |
| 5 | * |
| 6 | * Driver layout based loosely on tgafb.c, see that file for credits. |
| 7 | */ |
| 8 | |
| 9 | #include <linux/module.h> |
| 10 | #include <linux/kernel.h> |
| 11 | #include <linux/errno.h> |
| 12 | #include <linux/string.h> |
| 13 | #include <linux/slab.h> |
| 14 | #include <linux/delay.h> |
| 15 | #include <linux/init.h> |
| 16 | #include <linux/fb.h> |
| 17 | #include <linux/mm.h> |
Robert Reif | 6cd5a86 | 2008-05-08 21:37:30 -0700 | [diff] [blame] | 18 | #include <linux/of_device.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19 | |
| 20 | #include <asm/io.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 21 | #include <asm/fbio.h> |
| 22 | |
| 23 | #include "sbuslib.h" |
| 24 | |
| 25 | /* |
| 26 | * Local functions. |
| 27 | */ |
| 28 | |
| 29 | static int p9100_setcolreg(unsigned, unsigned, unsigned, unsigned, |
| 30 | unsigned, struct fb_info *); |
| 31 | static int p9100_blank(int, struct fb_info *); |
| 32 | |
Christoph Hellwig | 216d526 | 2006-01-14 13:21:25 -0800 | [diff] [blame] | 33 | static int p9100_mmap(struct fb_info *, struct vm_area_struct *); |
Christoph Hellwig | 67a6680 | 2006-01-14 13:21:25 -0800 | [diff] [blame] | 34 | static int p9100_ioctl(struct fb_info *, unsigned int, unsigned long); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 35 | |
| 36 | /* |
| 37 | * Frame buffer operations |
| 38 | */ |
| 39 | |
| 40 | static struct fb_ops p9100_ops = { |
| 41 | .owner = THIS_MODULE, |
| 42 | .fb_setcolreg = p9100_setcolreg, |
| 43 | .fb_blank = p9100_blank, |
| 44 | .fb_fillrect = cfb_fillrect, |
| 45 | .fb_copyarea = cfb_copyarea, |
| 46 | .fb_imageblit = cfb_imageblit, |
| 47 | .fb_mmap = p9100_mmap, |
| 48 | .fb_ioctl = p9100_ioctl, |
Christoph Hellwig | 9ffb83b | 2005-11-12 12:11:12 -0800 | [diff] [blame] | 49 | #ifdef CONFIG_COMPAT |
| 50 | .fb_compat_ioctl = sbusfb_compat_ioctl, |
| 51 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 52 | }; |
| 53 | |
| 54 | /* P9100 control registers */ |
| 55 | #define P9100_SYSCTL_OFF 0x0UL |
| 56 | #define P9100_VIDEOCTL_OFF 0x100UL |
| 57 | #define P9100_VRAMCTL_OFF 0x180UL |
| 58 | #define P9100_RAMDAC_OFF 0x200UL |
| 59 | #define P9100_VIDEOCOPROC_OFF 0x400UL |
| 60 | |
| 61 | /* P9100 command registers */ |
| 62 | #define P9100_CMD_OFF 0x0UL |
| 63 | |
| 64 | /* P9100 framebuffer memory */ |
| 65 | #define P9100_FB_OFF 0x0UL |
| 66 | |
| 67 | /* 3 bits: 2=8bpp 3=16bpp 5=32bpp 7=24bpp */ |
| 68 | #define SYS_CONFIG_PIXELSIZE_SHIFT 26 |
| 69 | |
| 70 | #define SCREENPAINT_TIMECTL1_ENABLE_VIDEO 0x20 /* 0 = off, 1 = on */ |
| 71 | |
| 72 | struct p9100_regs { |
| 73 | /* Registers for the system control */ |
David S. Miller | 50312ce | 2006-06-29 14:35:52 -0700 | [diff] [blame] | 74 | u32 sys_base; |
| 75 | u32 sys_config; |
| 76 | u32 sys_intr; |
| 77 | u32 sys_int_ena; |
| 78 | u32 sys_alt_rd; |
| 79 | u32 sys_alt_wr; |
| 80 | u32 sys_xxx[58]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 81 | |
| 82 | /* Registers for the video control */ |
David S. Miller | 50312ce | 2006-06-29 14:35:52 -0700 | [diff] [blame] | 83 | u32 vid_base; |
| 84 | u32 vid_hcnt; |
| 85 | u32 vid_htotal; |
| 86 | u32 vid_hsync_rise; |
| 87 | u32 vid_hblank_rise; |
| 88 | u32 vid_hblank_fall; |
| 89 | u32 vid_hcnt_preload; |
| 90 | u32 vid_vcnt; |
| 91 | u32 vid_vlen; |
| 92 | u32 vid_vsync_rise; |
| 93 | u32 vid_vblank_rise; |
| 94 | u32 vid_vblank_fall; |
| 95 | u32 vid_vcnt_preload; |
| 96 | u32 vid_screenpaint_addr; |
| 97 | u32 vid_screenpaint_timectl1; |
| 98 | u32 vid_screenpaint_qsfcnt; |
| 99 | u32 vid_screenpaint_timectl2; |
| 100 | u32 vid_xxx[15]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 101 | |
| 102 | /* Registers for the video control */ |
David S. Miller | 50312ce | 2006-06-29 14:35:52 -0700 | [diff] [blame] | 103 | u32 vram_base; |
| 104 | u32 vram_memcfg; |
| 105 | u32 vram_refresh_pd; |
| 106 | u32 vram_refresh_cnt; |
| 107 | u32 vram_raslo_max; |
| 108 | u32 vram_raslo_cur; |
| 109 | u32 pwrup_cfg; |
| 110 | u32 vram_xxx[25]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 111 | |
| 112 | /* Registers for IBM RGB528 Palette */ |
David S. Miller | 50312ce | 2006-06-29 14:35:52 -0700 | [diff] [blame] | 113 | u32 ramdac_cmap_wridx; |
| 114 | u32 ramdac_palette_data; |
| 115 | u32 ramdac_pixel_mask; |
| 116 | u32 ramdac_palette_rdaddr; |
| 117 | u32 ramdac_idx_lo; |
| 118 | u32 ramdac_idx_hi; |
| 119 | u32 ramdac_idx_data; |
| 120 | u32 ramdac_idx_ctl; |
| 121 | u32 ramdac_xxx[1784]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 122 | }; |
| 123 | |
| 124 | struct p9100_cmd_parameng { |
David S. Miller | 50312ce | 2006-06-29 14:35:52 -0700 | [diff] [blame] | 125 | u32 parameng_status; |
| 126 | u32 parameng_bltcmd; |
| 127 | u32 parameng_quadcmd; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 128 | }; |
| 129 | |
| 130 | struct p9100_par { |
| 131 | spinlock_t lock; |
| 132 | struct p9100_regs __iomem *regs; |
| 133 | |
| 134 | u32 flags; |
| 135 | #define P9100_FLAG_BLANKED 0x00000001 |
| 136 | |
David S. Miller | 50312ce | 2006-06-29 14:35:52 -0700 | [diff] [blame] | 137 | unsigned long which_io; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 138 | }; |
| 139 | |
| 140 | /** |
| 141 | * p9100_setcolreg - Optional function. Sets a color register. |
| 142 | * @regno: boolean, 0 copy local, 1 get_user() function |
| 143 | * @red: frame buffer colormap structure |
| 144 | * @green: The green value which can be up to 16 bits wide |
| 145 | * @blue: The blue value which can be up to 16 bits wide. |
| 146 | * @transp: If supported the alpha value which can be up to 16 bits wide. |
| 147 | * @info: frame buffer info structure |
| 148 | */ |
| 149 | static int p9100_setcolreg(unsigned regno, |
| 150 | unsigned red, unsigned green, unsigned blue, |
| 151 | unsigned transp, struct fb_info *info) |
| 152 | { |
| 153 | struct p9100_par *par = (struct p9100_par *) info->par; |
| 154 | struct p9100_regs __iomem *regs = par->regs; |
| 155 | unsigned long flags; |
| 156 | |
| 157 | if (regno >= 256) |
| 158 | return 1; |
| 159 | |
| 160 | red >>= 8; |
| 161 | green >>= 8; |
| 162 | blue >>= 8; |
| 163 | |
| 164 | spin_lock_irqsave(&par->lock, flags); |
| 165 | |
| 166 | sbus_writel((regno << 16), ®s->ramdac_cmap_wridx); |
| 167 | sbus_writel((red << 16), ®s->ramdac_palette_data); |
| 168 | sbus_writel((green << 16), ®s->ramdac_palette_data); |
| 169 | sbus_writel((blue << 16), ®s->ramdac_palette_data); |
| 170 | |
| 171 | spin_unlock_irqrestore(&par->lock, flags); |
| 172 | |
| 173 | return 0; |
| 174 | } |
| 175 | |
| 176 | /** |
| 177 | * p9100_blank - Optional function. Blanks the display. |
| 178 | * @blank_mode: the blank mode we want. |
| 179 | * @info: frame buffer structure that represents a single frame buffer |
| 180 | */ |
| 181 | static int |
| 182 | p9100_blank(int blank, struct fb_info *info) |
| 183 | { |
| 184 | struct p9100_par *par = (struct p9100_par *) info->par; |
| 185 | struct p9100_regs __iomem *regs = par->regs; |
| 186 | unsigned long flags; |
| 187 | u32 val; |
| 188 | |
| 189 | spin_lock_irqsave(&par->lock, flags); |
| 190 | |
| 191 | switch (blank) { |
| 192 | case FB_BLANK_UNBLANK: /* Unblanking */ |
| 193 | val = sbus_readl(®s->vid_screenpaint_timectl1); |
| 194 | val |= SCREENPAINT_TIMECTL1_ENABLE_VIDEO; |
| 195 | sbus_writel(val, ®s->vid_screenpaint_timectl1); |
| 196 | par->flags &= ~P9100_FLAG_BLANKED; |
| 197 | break; |
| 198 | |
| 199 | case FB_BLANK_NORMAL: /* Normal blanking */ |
| 200 | case FB_BLANK_VSYNC_SUSPEND: /* VESA blank (vsync off) */ |
| 201 | case FB_BLANK_HSYNC_SUSPEND: /* VESA blank (hsync off) */ |
| 202 | case FB_BLANK_POWERDOWN: /* Poweroff */ |
| 203 | val = sbus_readl(®s->vid_screenpaint_timectl1); |
| 204 | val &= ~SCREENPAINT_TIMECTL1_ENABLE_VIDEO; |
| 205 | sbus_writel(val, ®s->vid_screenpaint_timectl1); |
| 206 | par->flags |= P9100_FLAG_BLANKED; |
| 207 | break; |
| 208 | } |
| 209 | |
| 210 | spin_unlock_irqrestore(&par->lock, flags); |
| 211 | |
| 212 | return 0; |
| 213 | } |
| 214 | |
| 215 | static struct sbus_mmap_map p9100_mmap_map[] = { |
| 216 | { CG3_MMAP_OFFSET, 0, SBUS_MMAP_FBSIZE(1) }, |
| 217 | { 0, 0, 0 } |
| 218 | }; |
| 219 | |
Christoph Hellwig | 216d526 | 2006-01-14 13:21:25 -0800 | [diff] [blame] | 220 | static int p9100_mmap(struct fb_info *info, struct vm_area_struct *vma) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 221 | { |
| 222 | struct p9100_par *par = (struct p9100_par *)info->par; |
| 223 | |
| 224 | return sbusfb_mmap_helper(p9100_mmap_map, |
Krzysztof Helt | 0d76cb2 | 2009-05-04 10:42:57 +0000 | [diff] [blame] | 225 | info->fix.smem_start, info->fix.smem_len, |
David S. Miller | 50312ce | 2006-06-29 14:35:52 -0700 | [diff] [blame] | 226 | par->which_io, vma); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 227 | } |
| 228 | |
Christoph Hellwig | 67a6680 | 2006-01-14 13:21:25 -0800 | [diff] [blame] | 229 | static int p9100_ioctl(struct fb_info *info, unsigned int cmd, |
| 230 | unsigned long arg) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 231 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 232 | /* Make it look like a cg3. */ |
| 233 | return sbusfb_ioctl_helper(cmd, arg, info, |
Krzysztof Helt | 0d76cb2 | 2009-05-04 10:42:57 +0000 | [diff] [blame] | 234 | FBTYPE_SUN3COLOR, 8, info->fix.smem_len); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 235 | } |
| 236 | |
| 237 | /* |
| 238 | * Initialisation |
| 239 | */ |
| 240 | |
David S. Miller | 50312ce | 2006-06-29 14:35:52 -0700 | [diff] [blame] | 241 | static void p9100_init_fix(struct fb_info *info, int linebytes, struct device_node *dp) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 242 | { |
David S. Miller | 50312ce | 2006-06-29 14:35:52 -0700 | [diff] [blame] | 243 | strlcpy(info->fix.id, dp->name, sizeof(info->fix.id)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 244 | |
| 245 | info->fix.type = FB_TYPE_PACKED_PIXELS; |
| 246 | info->fix.visual = FB_VISUAL_PSEUDOCOLOR; |
| 247 | |
| 248 | info->fix.line_length = linebytes; |
| 249 | |
| 250 | info->fix.accel = FB_ACCEL_SUN_CGTHREE; |
| 251 | } |
| 252 | |
David S. Miller | c7f439b | 2007-07-27 22:31:46 -0700 | [diff] [blame] | 253 | static int __devinit p9100_probe(struct of_device *op, const struct of_device_id *match) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 254 | { |
David S. Miller | 50312ce | 2006-06-29 14:35:52 -0700 | [diff] [blame] | 255 | struct device_node *dp = op->node; |
David S. Miller | c7f439b | 2007-07-27 22:31:46 -0700 | [diff] [blame] | 256 | struct fb_info *info; |
| 257 | struct p9100_par *par; |
David S. Miller | 50312ce | 2006-06-29 14:35:52 -0700 | [diff] [blame] | 258 | int linebytes, err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 259 | |
David S. Miller | c7f439b | 2007-07-27 22:31:46 -0700 | [diff] [blame] | 260 | info = framebuffer_alloc(sizeof(struct p9100_par), &op->dev); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 261 | |
David S. Miller | c7f439b | 2007-07-27 22:31:46 -0700 | [diff] [blame] | 262 | err = -ENOMEM; |
| 263 | if (!info) |
| 264 | goto out_err; |
| 265 | par = info->par; |
| 266 | |
| 267 | spin_lock_init(&par->lock); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 268 | |
| 269 | /* This is the framebuffer and the only resource apps can mmap. */ |
Krzysztof Helt | 0d76cb2 | 2009-05-04 10:42:57 +0000 | [diff] [blame] | 270 | info->fix.smem_start = op->resource[2].start; |
David S. Miller | c7f439b | 2007-07-27 22:31:46 -0700 | [diff] [blame] | 271 | par->which_io = op->resource[2].flags & IORESOURCE_BITS; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 272 | |
Robert Reif | 6cd5a86 | 2008-05-08 21:37:30 -0700 | [diff] [blame] | 273 | sbusfb_fill_var(&info->var, dp, 8); |
David S. Miller | c7f439b | 2007-07-27 22:31:46 -0700 | [diff] [blame] | 274 | info->var.red.length = 8; |
| 275 | info->var.green.length = 8; |
| 276 | info->var.blue.length = 8; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 277 | |
David S. Miller | c7f439b | 2007-07-27 22:31:46 -0700 | [diff] [blame] | 278 | linebytes = of_getintprop_default(dp, "linebytes", info->var.xres); |
Krzysztof Helt | 0d76cb2 | 2009-05-04 10:42:57 +0000 | [diff] [blame] | 279 | info->fix.smem_len = PAGE_ALIGN(linebytes * info->var.yres); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 280 | |
David S. Miller | c7f439b | 2007-07-27 22:31:46 -0700 | [diff] [blame] | 281 | par->regs = of_ioremap(&op->resource[0], 0, |
| 282 | sizeof(struct p9100_regs), "p9100 regs"); |
| 283 | if (!par->regs) |
| 284 | goto out_release_fb; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 285 | |
David S. Miller | c7f439b | 2007-07-27 22:31:46 -0700 | [diff] [blame] | 286 | info->flags = FBINFO_DEFAULT; |
| 287 | info->fbops = &p9100_ops; |
| 288 | info->screen_base = of_ioremap(&op->resource[2], 0, |
Krzysztof Helt | 0d76cb2 | 2009-05-04 10:42:57 +0000 | [diff] [blame] | 289 | info->fix.smem_len, "p9100 ram"); |
David S. Miller | c7f439b | 2007-07-27 22:31:46 -0700 | [diff] [blame] | 290 | if (!info->screen_base) |
| 291 | goto out_unmap_regs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 292 | |
Robert Reif | 59f7137 | 2008-05-03 21:12:00 -0700 | [diff] [blame] | 293 | p9100_blank(FB_BLANK_UNBLANK, info); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 294 | |
David S. Miller | c7f439b | 2007-07-27 22:31:46 -0700 | [diff] [blame] | 295 | if (fb_alloc_cmap(&info->cmap, 256, 0)) |
| 296 | goto out_unmap_screen; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 297 | |
David S. Miller | c7f439b | 2007-07-27 22:31:46 -0700 | [diff] [blame] | 298 | p9100_init_fix(info, linebytes, dp); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 299 | |
David S. Miller | c7f439b | 2007-07-27 22:31:46 -0700 | [diff] [blame] | 300 | err = register_framebuffer(info); |
| 301 | if (err < 0) |
| 302 | goto out_dealloc_cmap; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 303 | |
David S. Miller | c7f439b | 2007-07-27 22:31:46 -0700 | [diff] [blame] | 304 | fb_set_cmap(&info->cmap, info); |
| 305 | |
| 306 | dev_set_drvdata(&op->dev, info); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 307 | |
Robert Reif | 194f1a6 | 2008-04-27 15:18:57 -0700 | [diff] [blame] | 308 | printk(KERN_INFO "%s: p9100 at %lx:%lx\n", |
David S. Miller | 50312ce | 2006-06-29 14:35:52 -0700 | [diff] [blame] | 309 | dp->full_name, |
Krzysztof Helt | 0d76cb2 | 2009-05-04 10:42:57 +0000 | [diff] [blame] | 310 | par->which_io, info->fix.smem_start); |
David S. Miller | 50312ce | 2006-06-29 14:35:52 -0700 | [diff] [blame] | 311 | |
| 312 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 313 | |
David S. Miller | c7f439b | 2007-07-27 22:31:46 -0700 | [diff] [blame] | 314 | out_dealloc_cmap: |
| 315 | fb_dealloc_cmap(&info->cmap); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 316 | |
David S. Miller | c7f439b | 2007-07-27 22:31:46 -0700 | [diff] [blame] | 317 | out_unmap_screen: |
Krzysztof Helt | 0d76cb2 | 2009-05-04 10:42:57 +0000 | [diff] [blame] | 318 | of_iounmap(&op->resource[2], info->screen_base, info->fix.smem_len); |
David S. Miller | c7f439b | 2007-07-27 22:31:46 -0700 | [diff] [blame] | 319 | |
| 320 | out_unmap_regs: |
| 321 | of_iounmap(&op->resource[0], par->regs, sizeof(struct p9100_regs)); |
| 322 | |
| 323 | out_release_fb: |
| 324 | framebuffer_release(info); |
| 325 | |
| 326 | out_err: |
| 327 | return err; |
David S. Miller | 50312ce | 2006-06-29 14:35:52 -0700 | [diff] [blame] | 328 | } |
| 329 | |
David S. Miller | e3a411a | 2006-12-28 21:01:32 -0800 | [diff] [blame] | 330 | static int __devexit p9100_remove(struct of_device *op) |
David S. Miller | 50312ce | 2006-06-29 14:35:52 -0700 | [diff] [blame] | 331 | { |
David S. Miller | c7f439b | 2007-07-27 22:31:46 -0700 | [diff] [blame] | 332 | struct fb_info *info = dev_get_drvdata(&op->dev); |
| 333 | struct p9100_par *par = info->par; |
David S. Miller | 50312ce | 2006-06-29 14:35:52 -0700 | [diff] [blame] | 334 | |
David S. Miller | c7f439b | 2007-07-27 22:31:46 -0700 | [diff] [blame] | 335 | unregister_framebuffer(info); |
| 336 | fb_dealloc_cmap(&info->cmap); |
David S. Miller | 50312ce | 2006-06-29 14:35:52 -0700 | [diff] [blame] | 337 | |
David S. Miller | c7f439b | 2007-07-27 22:31:46 -0700 | [diff] [blame] | 338 | of_iounmap(&op->resource[0], par->regs, sizeof(struct p9100_regs)); |
Krzysztof Helt | 0d76cb2 | 2009-05-04 10:42:57 +0000 | [diff] [blame] | 339 | of_iounmap(&op->resource[2], info->screen_base, info->fix.smem_len); |
David S. Miller | 50312ce | 2006-06-29 14:35:52 -0700 | [diff] [blame] | 340 | |
David S. Miller | c7f439b | 2007-07-27 22:31:46 -0700 | [diff] [blame] | 341 | framebuffer_release(info); |
David S. Miller | 50312ce | 2006-06-29 14:35:52 -0700 | [diff] [blame] | 342 | |
David S. Miller | e3a411a | 2006-12-28 21:01:32 -0800 | [diff] [blame] | 343 | dev_set_drvdata(&op->dev, NULL); |
David S. Miller | 50312ce | 2006-06-29 14:35:52 -0700 | [diff] [blame] | 344 | |
| 345 | return 0; |
| 346 | } |
| 347 | |
David S. Miller | fd09831 | 2008-08-31 01:23:17 -0700 | [diff] [blame] | 348 | static const struct of_device_id p9100_match[] = { |
David S. Miller | 50312ce | 2006-06-29 14:35:52 -0700 | [diff] [blame] | 349 | { |
| 350 | .name = "p9100", |
| 351 | }, |
| 352 | {}, |
| 353 | }; |
| 354 | MODULE_DEVICE_TABLE(of, p9100_match); |
| 355 | |
| 356 | static struct of_platform_driver p9100_driver = { |
| 357 | .name = "p9100", |
| 358 | .match_table = p9100_match, |
| 359 | .probe = p9100_probe, |
| 360 | .remove = __devexit_p(p9100_remove), |
| 361 | }; |
| 362 | |
| 363 | static int __init p9100_init(void) |
| 364 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 365 | if (fb_get_options("p9100fb", NULL)) |
| 366 | return -ENODEV; |
| 367 | |
David S. Miller | 50312ce | 2006-06-29 14:35:52 -0700 | [diff] [blame] | 368 | return of_register_driver(&p9100_driver, &of_bus_type); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 369 | } |
| 370 | |
David S. Miller | 50312ce | 2006-06-29 14:35:52 -0700 | [diff] [blame] | 371 | static void __exit p9100_exit(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 372 | { |
David S. Miller | 50312ce | 2006-06-29 14:35:52 -0700 | [diff] [blame] | 373 | of_unregister_driver(&p9100_driver); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 374 | } |
| 375 | |
| 376 | module_init(p9100_init); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 377 | module_exit(p9100_exit); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 378 | |
| 379 | MODULE_DESCRIPTION("framebuffer driver for P9100 chipsets"); |
David S. Miller | 50312ce | 2006-06-29 14:35:52 -0700 | [diff] [blame] | 380 | MODULE_AUTHOR("David S. Miller <davem@davemloft.net>"); |
| 381 | MODULE_VERSION("2.0"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 382 | MODULE_LICENSE("GPL"); |