Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * BRIEF MODULE DESCRIPTION |
| 3 | * Au1100 LCD Driver. |
| 4 | * |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 5 | * Rewritten for 2.6 by Embedded Alley Solutions |
| 6 | * <source@embeddedalley.com>, based on submissions by |
| 7 | * Karl Lessard <klessard@sunrisetelecom.com> |
| 8 | * <c.pellegrin@exadron.com> |
| 9 | * |
Rodolfo Giometti | f77f50c | 2006-06-26 00:26:49 -0700 | [diff] [blame] | 10 | * PM support added by Rodolfo Giometti <giometti@linux.it> |
Rodolfo Giometti | ca27ac4 | 2006-10-03 01:14:36 -0700 | [diff] [blame] | 11 | * Cursor enable/disable by Rodolfo Giometti <giometti@linux.it> |
Rodolfo Giometti | f77f50c | 2006-06-26 00:26:49 -0700 | [diff] [blame] | 12 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 | * Copyright 2002 MontaVista Software |
| 14 | * Author: MontaVista Software, Inc. |
| 15 | * ppopov@mvista.com or source@mvista.com |
| 16 | * |
| 17 | * Copyright 2002 Alchemy Semiconductor |
| 18 | * Author: Alchemy Semiconductor |
| 19 | * |
| 20 | * Based on: |
| 21 | * linux/drivers/video/skeletonfb.c -- Skeleton for a frame buffer device |
| 22 | * Created 28 Dec 1997 by Geert Uytterhoeven |
| 23 | * |
| 24 | * This program is free software; you can redistribute it and/or modify it |
| 25 | * under the terms of the GNU General Public License as published by the |
| 26 | * Free Software Foundation; either version 2 of the License, or (at your |
| 27 | * option) any later version. |
| 28 | * |
| 29 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED |
| 30 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
| 31 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN |
| 32 | * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 33 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
| 34 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
| 35 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON |
| 36 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 37 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 38 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 39 | * |
| 40 | * You should have received a copy of the GNU General Public License along |
| 41 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 42 | * 675 Mass Ave, Cambridge, MA 02139, USA. |
| 43 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 44 | #include <linux/module.h> |
| 45 | #include <linux/kernel.h> |
| 46 | #include <linux/errno.h> |
| 47 | #include <linux/string.h> |
| 48 | #include <linux/mm.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 49 | #include <linux/fb.h> |
| 50 | #include <linux/init.h> |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 51 | #include <linux/interrupt.h> |
| 52 | #include <linux/ctype.h> |
| 53 | #include <linux/dma-mapping.h> |
Freddy Spierenburg | cacfc8c | 2006-02-24 13:04:17 -0800 | [diff] [blame] | 54 | #include <linux/platform_device.h> |
Tejun Heo | 5a0e3ad | 2010-03-24 17:04:11 +0900 | [diff] [blame] | 55 | #include <linux/slab.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 56 | |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 57 | #include <asm/mach-au1x00/au1000.h> |
| 58 | |
| 59 | #define DEBUG 0 |
| 60 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 61 | #include "au1100fb.h" |
| 62 | |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 63 | #define DRIVER_NAME "au1100fb" |
| 64 | #define DRIVER_DESC "LCD controller driver for AU1100 processors" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 65 | |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 66 | #define to_au1100fb_device(_info) \ |
| 67 | (_info ? container_of(_info, struct au1100fb_device, info) : NULL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 68 | |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 69 | /* Bitfields format supported by the controller. Note that the order of formats |
| 70 | * SHOULD be the same as in the LCD_CONTROL_SBPPF field, so we can retrieve the |
| 71 | * right pixel format by doing rgb_bitfields[LCD_CONTROL_SBPPF_XXX >> LCD_CONTROL_SBPPF] |
| 72 | */ |
| 73 | struct fb_bitfield rgb_bitfields[][4] = |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 74 | { |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 75 | /* Red, Green, Blue, Transp */ |
| 76 | { { 10, 6, 0 }, { 5, 5, 0 }, { 0, 5, 0 }, { 0, 0, 0 } }, |
| 77 | { { 11, 5, 0 }, { 5, 6, 0 }, { 0, 5, 0 }, { 0, 0, 0 } }, |
| 78 | { { 11, 5, 0 }, { 6, 5, 0 }, { 0, 6, 0 }, { 0, 0, 0 } }, |
| 79 | { { 10, 5, 0 }, { 5, 5, 0 }, { 0, 5, 0 }, { 15, 1, 0 } }, |
| 80 | { { 11, 5, 0 }, { 6, 5, 0 }, { 1, 5, 0 }, { 0, 1, 0 } }, |
| 81 | |
| 82 | /* The last is used to describe 12bpp format */ |
| 83 | { { 8, 4, 0 }, { 4, 4, 0 }, { 0, 4, 0 }, { 0, 0, 0 } }, |
| 84 | }; |
| 85 | |
Greg Kroah-Hartman | 48c68c4 | 2012-12-21 13:07:39 -0800 | [diff] [blame] | 86 | static struct fb_fix_screeninfo au1100fb_fix = { |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 87 | .id = "AU1100 FB", |
| 88 | .xpanstep = 1, |
| 89 | .ypanstep = 1, |
| 90 | .type = FB_TYPE_PACKED_PIXELS, |
| 91 | .accel = FB_ACCEL_NONE, |
| 92 | }; |
| 93 | |
Greg Kroah-Hartman | 48c68c4 | 2012-12-21 13:07:39 -0800 | [diff] [blame] | 94 | static struct fb_var_screeninfo au1100fb_var = { |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 95 | .activate = FB_ACTIVATE_NOW, |
| 96 | .height = -1, |
| 97 | .width = -1, |
| 98 | .vmode = FB_VMODE_NONINTERLACED, |
| 99 | }; |
| 100 | |
Yoichi Yuasa | 8e92f21 | 2007-08-22 14:02:03 -0700 | [diff] [blame] | 101 | /* fb_blank |
| 102 | * Blank the screen. Depending on the mode, the screen will be |
| 103 | * activated with the backlight color, or desactivated |
| 104 | */ |
| 105 | static int au1100fb_fb_blank(int blank_mode, struct fb_info *fbi) |
| 106 | { |
| 107 | struct au1100fb_device *fbdev = to_au1100fb_device(fbi); |
| 108 | |
| 109 | print_dbg("fb_blank %d %p", blank_mode, fbi); |
| 110 | |
| 111 | switch (blank_mode) { |
| 112 | |
| 113 | case VESA_NO_BLANKING: |
Paul Bolle | 88564dd | 2013-03-25 20:27:19 +0000 | [diff] [blame] | 114 | /* Turn on panel */ |
| 115 | fbdev->regs->lcd_control |= LCD_CONTROL_GO; |
Yoichi Yuasa | 8e92f21 | 2007-08-22 14:02:03 -0700 | [diff] [blame] | 116 | au_sync(); |
| 117 | break; |
| 118 | |
| 119 | case VESA_VSYNC_SUSPEND: |
| 120 | case VESA_HSYNC_SUSPEND: |
| 121 | case VESA_POWERDOWN: |
Paul Bolle | 88564dd | 2013-03-25 20:27:19 +0000 | [diff] [blame] | 122 | /* Turn off panel */ |
| 123 | fbdev->regs->lcd_control &= ~LCD_CONTROL_GO; |
Yoichi Yuasa | 8e92f21 | 2007-08-22 14:02:03 -0700 | [diff] [blame] | 124 | au_sync(); |
| 125 | break; |
| 126 | default: |
| 127 | break; |
| 128 | |
| 129 | } |
| 130 | return 0; |
| 131 | } |
| 132 | |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 133 | /* |
| 134 | * Set hardware with var settings. This will enable the controller with a specific |
| 135 | * mode, normally validated with the fb_check_var method |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 136 | */ |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 137 | int au1100fb_setmode(struct au1100fb_device *fbdev) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 138 | { |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 139 | struct fb_info *info = &fbdev->info; |
| 140 | u32 words; |
| 141 | int index; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 142 | |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 143 | if (!fbdev) |
| 144 | return -EINVAL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 145 | |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 146 | /* Update var-dependent FB info */ |
| 147 | if (panel_is_active(fbdev->panel) || panel_is_color(fbdev->panel)) { |
| 148 | if (info->var.bits_per_pixel <= 8) { |
| 149 | /* palettized */ |
| 150 | info->var.red.offset = 0; |
| 151 | info->var.red.length = info->var.bits_per_pixel; |
| 152 | info->var.red.msb_right = 0; |
| 153 | |
| 154 | info->var.green.offset = 0; |
| 155 | info->var.green.length = info->var.bits_per_pixel; |
| 156 | info->var.green.msb_right = 0; |
| 157 | |
| 158 | info->var.blue.offset = 0; |
| 159 | info->var.blue.length = info->var.bits_per_pixel; |
| 160 | info->var.blue.msb_right = 0; |
| 161 | |
| 162 | info->var.transp.offset = 0; |
| 163 | info->var.transp.length = 0; |
| 164 | info->var.transp.msb_right = 0; |
| 165 | |
| 166 | info->fix.visual = FB_VISUAL_PSEUDOCOLOR; |
| 167 | info->fix.line_length = info->var.xres_virtual / |
| 168 | (8/info->var.bits_per_pixel); |
| 169 | } else { |
| 170 | /* non-palettized */ |
| 171 | index = (fbdev->panel->control_base & LCD_CONTROL_SBPPF_MASK) >> LCD_CONTROL_SBPPF_BIT; |
| 172 | info->var.red = rgb_bitfields[index][0]; |
| 173 | info->var.green = rgb_bitfields[index][1]; |
| 174 | info->var.blue = rgb_bitfields[index][2]; |
| 175 | info->var.transp = rgb_bitfields[index][3]; |
| 176 | |
| 177 | info->fix.visual = FB_VISUAL_TRUECOLOR; |
| 178 | info->fix.line_length = info->var.xres_virtual << 1; /* depth=16 */ |
Rodolfo Giometti | bb39e41 | 2006-08-05 12:14:22 -0700 | [diff] [blame] | 179 | } |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 180 | } else { |
| 181 | /* mono */ |
| 182 | info->fix.visual = FB_VISUAL_MONO10; |
| 183 | info->fix.line_length = info->var.xres_virtual / 8; |
| 184 | } |
| 185 | |
| 186 | info->screen_size = info->fix.line_length * info->var.yres_virtual; |
Rodolfo Giometti | fd2d543 | 2006-08-05 12:14:19 -0700 | [diff] [blame] | 187 | info->var.rotate = ((fbdev->panel->control_base&LCD_CONTROL_SM_MASK) \ |
| 188 | >> LCD_CONTROL_SM_BIT) * 90; |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 189 | |
| 190 | /* Determine BPP mode and format */ |
Rodolfo Giometti | fd2d543 | 2006-08-05 12:14:19 -0700 | [diff] [blame] | 191 | fbdev->regs->lcd_control = fbdev->panel->control_base; |
Rodolfo Giometti | bb39e41 | 2006-08-05 12:14:22 -0700 | [diff] [blame] | 192 | fbdev->regs->lcd_horztiming = fbdev->panel->horztiming; |
| 193 | fbdev->regs->lcd_verttiming = fbdev->panel->verttiming; |
| 194 | fbdev->regs->lcd_clkcontrol = fbdev->panel->clkcontrol_base; |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 195 | fbdev->regs->lcd_intenable = 0; |
| 196 | fbdev->regs->lcd_intstatus = 0; |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 197 | fbdev->regs->lcd_dmaaddr0 = LCD_DMA_SA_N(fbdev->fb_phys); |
| 198 | |
| 199 | if (panel_is_dual(fbdev->panel)) { |
| 200 | /* Second panel display seconf half of screen if possible, |
| 201 | * otherwise display the same as the first panel */ |
| 202 | if (info->var.yres_virtual >= (info->var.yres << 1)) { |
| 203 | fbdev->regs->lcd_dmaaddr1 = LCD_DMA_SA_N(fbdev->fb_phys + |
| 204 | (info->fix.line_length * |
| 205 | (info->var.yres_virtual >> 1))); |
| 206 | } else { |
| 207 | fbdev->regs->lcd_dmaaddr1 = LCD_DMA_SA_N(fbdev->fb_phys); |
| 208 | } |
| 209 | } |
| 210 | |
| 211 | words = info->fix.line_length / sizeof(u32); |
| 212 | if (!info->var.rotate || (info->var.rotate == 180)) { |
| 213 | words *= info->var.yres_virtual; |
| 214 | if (info->var.rotate /* 180 */) { |
| 215 | words -= (words % 8); /* should be divisable by 8 */ |
| 216 | } |
| 217 | } |
| 218 | fbdev->regs->lcd_words = LCD_WRD_WRDS_N(words); |
| 219 | |
| 220 | fbdev->regs->lcd_pwmdiv = 0; |
| 221 | fbdev->regs->lcd_pwmhi = 0; |
| 222 | |
| 223 | /* Resume controller */ |
| 224 | fbdev->regs->lcd_control |= LCD_CONTROL_GO; |
Rodolfo Giometti | bb39e41 | 2006-08-05 12:14:22 -0700 | [diff] [blame] | 225 | mdelay(10); |
| 226 | au1100fb_fb_blank(VESA_NO_BLANKING, info); |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 227 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 228 | return 0; |
| 229 | } |
| 230 | |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 231 | /* fb_setcolreg |
| 232 | * Set color in LCD palette. |
| 233 | */ |
| 234 | int au1100fb_fb_setcolreg(unsigned regno, unsigned red, unsigned green, unsigned blue, unsigned transp, struct fb_info *fbi) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 235 | { |
Rodolfo Giometti | c05b7f3 | 2006-05-30 21:26:57 -0700 | [diff] [blame] | 236 | struct au1100fb_device *fbdev; |
| 237 | u32 *palette; |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 238 | u32 value; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 239 | |
Rodolfo Giometti | c05b7f3 | 2006-05-30 21:26:57 -0700 | [diff] [blame] | 240 | fbdev = to_au1100fb_device(fbi); |
| 241 | palette = fbdev->regs->lcd_pallettebase; |
| 242 | |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 243 | if (regno > (AU1100_LCD_NBR_PALETTE_ENTRIES - 1)) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 244 | return -EINVAL; |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 245 | |
| 246 | if (fbi->var.grayscale) { |
| 247 | /* Convert color to grayscale */ |
| 248 | red = green = blue = |
| 249 | (19595 * red + 38470 * green + 7471 * blue) >> 16; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 250 | } |
| 251 | |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 252 | if (fbi->fix.visual == FB_VISUAL_TRUECOLOR) { |
| 253 | /* Place color in the pseudopalette */ |
| 254 | if (regno > 16) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 255 | return -EINVAL; |
| 256 | |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 257 | palette = (u32*)fbi->pseudo_palette; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 258 | |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 259 | red >>= (16 - fbi->var.red.length); |
| 260 | green >>= (16 - fbi->var.green.length); |
| 261 | blue >>= (16 - fbi->var.blue.length); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 262 | |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 263 | value = (red << fbi->var.red.offset) | |
| 264 | (green << fbi->var.green.offset)| |
| 265 | (blue << fbi->var.blue.offset); |
| 266 | value &= 0xFFFF; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 267 | |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 268 | } else if (panel_is_active(fbdev->panel)) { |
| 269 | /* COLOR TFT PALLETTIZED (use RGB 565) */ |
| 270 | value = (red & 0xF800)|((green >> 5) & 0x07E0)|((blue >> 11) & 0x001F); |
| 271 | value &= 0xFFFF; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 272 | |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 273 | } else if (panel_is_color(fbdev->panel)) { |
| 274 | /* COLOR STN MODE */ |
| 275 | value = (((panel_swap_rgb(fbdev->panel) ? blue : red) >> 12) & 0x000F) | |
| 276 | ((green >> 8) & 0x00F0) | |
| 277 | (((panel_swap_rgb(fbdev->panel) ? red : blue) >> 4) & 0x0F00); |
| 278 | value &= 0xFFF; |
| 279 | } else { |
| 280 | /* MONOCHROME MODE */ |
| 281 | value = (green >> 12) & 0x000F; |
| 282 | value &= 0xF; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 283 | } |
| 284 | |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 285 | palette[regno] = value; |
| 286 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 287 | return 0; |
| 288 | } |
| 289 | |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 290 | /* fb_pan_display |
| 291 | * Pan display in x and/or y as specified |
| 292 | */ |
| 293 | int au1100fb_fb_pan_display(struct fb_var_screeninfo *var, struct fb_info *fbi) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 294 | { |
Rodolfo Giometti | c05b7f3 | 2006-05-30 21:26:57 -0700 | [diff] [blame] | 295 | struct au1100fb_device *fbdev; |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 296 | int dy; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 297 | |
Rodolfo Giometti | c05b7f3 | 2006-05-30 21:26:57 -0700 | [diff] [blame] | 298 | fbdev = to_au1100fb_device(fbi); |
| 299 | |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 300 | print_dbg("fb_pan_display %p %p", var, fbi); |
| 301 | |
| 302 | if (!var || !fbdev) { |
| 303 | return -EINVAL; |
| 304 | } |
| 305 | |
| 306 | if (var->xoffset - fbi->var.xoffset) { |
| 307 | /* No support for X panning for now! */ |
| 308 | return -EINVAL; |
| 309 | } |
| 310 | |
| 311 | print_dbg("fb_pan_display 2 %p %p", var, fbi); |
| 312 | dy = var->yoffset - fbi->var.yoffset; |
| 313 | if (dy) { |
| 314 | |
| 315 | u32 dmaaddr; |
| 316 | |
| 317 | print_dbg("Panning screen of %d lines", dy); |
| 318 | |
| 319 | dmaaddr = fbdev->regs->lcd_dmaaddr0; |
| 320 | dmaaddr += (fbi->fix.line_length * dy); |
| 321 | |
| 322 | /* TODO: Wait for current frame to finished */ |
| 323 | fbdev->regs->lcd_dmaaddr0 = LCD_DMA_SA_N(dmaaddr); |
| 324 | |
| 325 | if (panel_is_dual(fbdev->panel)) { |
| 326 | dmaaddr = fbdev->regs->lcd_dmaaddr1; |
| 327 | dmaaddr += (fbi->fix.line_length * dy); |
| 328 | fbdev->regs->lcd_dmaaddr0 = LCD_DMA_SA_N(dmaaddr); |
| 329 | } |
| 330 | } |
| 331 | print_dbg("fb_pan_display 3 %p %p", var, fbi); |
| 332 | |
| 333 | return 0; |
| 334 | } |
| 335 | |
| 336 | /* fb_rotate |
| 337 | * Rotate the display of this angle. This doesn't seems to be used by the core, |
| 338 | * but as our hardware supports it, so why not implementing it... |
| 339 | */ |
| 340 | void au1100fb_fb_rotate(struct fb_info *fbi, int angle) |
| 341 | { |
| 342 | struct au1100fb_device *fbdev = to_au1100fb_device(fbi); |
| 343 | |
| 344 | print_dbg("fb_rotate %p %d", fbi, angle); |
| 345 | |
| 346 | if (fbdev && (angle > 0) && !(angle % 90)) { |
| 347 | |
| 348 | fbdev->regs->lcd_control &= ~LCD_CONTROL_GO; |
| 349 | |
| 350 | fbdev->regs->lcd_control &= ~(LCD_CONTROL_SM_MASK); |
| 351 | fbdev->regs->lcd_control |= ((angle/90) << LCD_CONTROL_SM_BIT); |
| 352 | |
| 353 | fbdev->regs->lcd_control |= LCD_CONTROL_GO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 354 | } |
| 355 | } |
| 356 | |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 357 | /* fb_mmap |
| 358 | * Map video memory in user space. We don't use the generic fb_mmap method mainly |
| 359 | * to allow the use of the TLB streaming flag (CCA=6) |
| 360 | */ |
Christoph Hellwig | 216d526 | 2006-01-14 13:21:25 -0800 | [diff] [blame] | 361 | int au1100fb_fb_mmap(struct fb_info *fbi, struct vm_area_struct *vma) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 362 | { |
Rodolfo Giometti | c05b7f3 | 2006-05-30 21:26:57 -0700 | [diff] [blame] | 363 | struct au1100fb_device *fbdev; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 364 | |
Rodolfo Giometti | c05b7f3 | 2006-05-30 21:26:57 -0700 | [diff] [blame] | 365 | fbdev = to_au1100fb_device(fbi); |
| 366 | |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 367 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 368 | pgprot_val(vma->vm_page_prot) |= (6 << 9); //CCA=6 |
| 369 | |
Linus Torvalds | 7314e61 | 2013-10-29 10:21:34 -0700 | [diff] [blame] | 370 | return vm_iomap_memory(vma, fbdev->fb_phys, fbdev->fb_len); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 371 | } |
| 372 | |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 373 | static struct fb_ops au1100fb_ops = |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 374 | { |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 375 | .owner = THIS_MODULE, |
| 376 | .fb_setcolreg = au1100fb_fb_setcolreg, |
| 377 | .fb_blank = au1100fb_fb_blank, |
| 378 | .fb_pan_display = au1100fb_fb_pan_display, |
| 379 | .fb_fillrect = cfb_fillrect, |
| 380 | .fb_copyarea = cfb_copyarea, |
| 381 | .fb_imageblit = cfb_imageblit, |
| 382 | .fb_rotate = au1100fb_fb_rotate, |
| 383 | .fb_mmap = au1100fb_fb_mmap, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 384 | }; |
| 385 | |
| 386 | |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 387 | /*-------------------------------------------------------------------------*/ |
| 388 | |
Manuel Lauss | d121c3f | 2011-09-30 20:49:43 +0200 | [diff] [blame] | 389 | static int au1100fb_setup(struct au1100fb_device *fbdev) |
| 390 | { |
| 391 | char *this_opt, *options; |
| 392 | int num_panels = ARRAY_SIZE(known_lcd_panels); |
| 393 | |
| 394 | if (num_panels <= 0) { |
| 395 | print_err("No LCD panels supported by driver!"); |
| 396 | return -ENODEV; |
| 397 | } |
| 398 | |
| 399 | if (fb_get_options(DRIVER_NAME, &options)) |
| 400 | return -ENODEV; |
| 401 | if (!options) |
| 402 | return -ENODEV; |
| 403 | |
| 404 | while ((this_opt = strsep(&options, ",")) != NULL) { |
| 405 | /* Panel option */ |
| 406 | if (!strncmp(this_opt, "panel:", 6)) { |
| 407 | int i; |
| 408 | this_opt += 6; |
| 409 | for (i = 0; i < num_panels; i++) { |
| 410 | if (!strncmp(this_opt, known_lcd_panels[i].name, |
| 411 | strlen(this_opt))) { |
| 412 | fbdev->panel = &known_lcd_panels[i]; |
| 413 | fbdev->panel_idx = i; |
| 414 | break; |
| 415 | } |
| 416 | } |
| 417 | if (i >= num_panels) { |
| 418 | print_warn("Panel '%s' not supported!", this_opt); |
| 419 | return -ENODEV; |
| 420 | } |
| 421 | } |
| 422 | /* Unsupported option */ |
| 423 | else |
| 424 | print_warn("Unsupported option \"%s\"", this_opt); |
| 425 | } |
| 426 | |
| 427 | print_info("Panel=%s", fbdev->panel->name); |
| 428 | |
| 429 | return 0; |
| 430 | } |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 431 | |
Greg Kroah-Hartman | 48c68c4 | 2012-12-21 13:07:39 -0800 | [diff] [blame] | 432 | static int au1100fb_drv_probe(struct platform_device *dev) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 433 | { |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 434 | struct au1100fb_device *fbdev = NULL; |
| 435 | struct resource *regs_res; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 436 | unsigned long page; |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 437 | u32 sys_clksrc; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 438 | |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 439 | /* Allocate new device private */ |
Julia Lawall | 1c16697 | 2012-01-21 16:01:58 +0100 | [diff] [blame] | 440 | fbdev = devm_kzalloc(&dev->dev, sizeof(struct au1100fb_device), |
| 441 | GFP_KERNEL); |
Manuel Lauss | d121c3f | 2011-09-30 20:49:43 +0200 | [diff] [blame] | 442 | if (!fbdev) { |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 443 | print_err("fail to allocate device private record"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 444 | return -ENOMEM; |
| 445 | } |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 446 | |
Manuel Lauss | d121c3f | 2011-09-30 20:49:43 +0200 | [diff] [blame] | 447 | if (au1100fb_setup(fbdev)) |
| 448 | goto failed; |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 449 | |
Ming Lei | 7a192ec | 2009-02-06 23:40:12 +0800 | [diff] [blame] | 450 | platform_set_drvdata(dev, (void *)fbdev); |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 451 | |
| 452 | /* Allocate region for our registers and map them */ |
Manuel Lauss | d121c3f | 2011-09-30 20:49:43 +0200 | [diff] [blame] | 453 | regs_res = platform_get_resource(dev, IORESOURCE_MEM, 0); |
| 454 | if (!regs_res) { |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 455 | print_err("fail to retrieve registers resource"); |
| 456 | return -EFAULT; |
| 457 | } |
| 458 | |
| 459 | au1100fb_fix.mmio_start = regs_res->start; |
Joe Perches | 28f65c11 | 2011-06-09 09:13:32 -0700 | [diff] [blame] | 460 | au1100fb_fix.mmio_len = resource_size(regs_res); |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 461 | |
Manuel Lauss | 9301973 | 2012-03-24 11:38:02 +0100 | [diff] [blame] | 462 | if (!devm_request_mem_region(&dev->dev, |
| 463 | au1100fb_fix.mmio_start, |
Julia Lawall | 1c16697 | 2012-01-21 16:01:58 +0100 | [diff] [blame] | 464 | au1100fb_fix.mmio_len, |
| 465 | DRIVER_NAME)) { |
Rodolfo Giometti | c05b7f3 | 2006-05-30 21:26:57 -0700 | [diff] [blame] | 466 | print_err("fail to lock memory region at 0x%08lx", |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 467 | au1100fb_fix.mmio_start); |
| 468 | return -EBUSY; |
| 469 | } |
| 470 | |
| 471 | fbdev->regs = (struct au1100fb_regs*)KSEG1ADDR(au1100fb_fix.mmio_start); |
| 472 | |
| 473 | print_dbg("Register memory map at %p", fbdev->regs); |
| 474 | print_dbg("phys=0x%08x, size=%d", fbdev->regs_phys, fbdev->regs_len); |
| 475 | |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 476 | /* Allocate the framebuffer to the maximum screen size * nbr of video buffers */ |
| 477 | fbdev->fb_len = fbdev->panel->xres * fbdev->panel->yres * |
| 478 | (fbdev->panel->bpp >> 3) * AU1100FB_NBR_VIDEO_BUFFERS; |
| 479 | |
Manuel Lauss | 9301973 | 2012-03-24 11:38:02 +0100 | [diff] [blame] | 480 | fbdev->fb_mem = dmam_alloc_coherent(&dev->dev, |
Julia Lawall | 1c16697 | 2012-01-21 16:01:58 +0100 | [diff] [blame] | 481 | PAGE_ALIGN(fbdev->fb_len), |
| 482 | &fbdev->fb_phys, GFP_KERNEL); |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 483 | if (!fbdev->fb_mem) { |
| 484 | print_err("fail to allocate frambuffer (size: %dK))", |
| 485 | fbdev->fb_len / 1024); |
| 486 | return -ENOMEM; |
| 487 | } |
| 488 | |
| 489 | au1100fb_fix.smem_start = fbdev->fb_phys; |
| 490 | au1100fb_fix.smem_len = fbdev->fb_len; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 491 | |
| 492 | /* |
| 493 | * Set page reserved so that mmap will work. This is necessary |
| 494 | * since we'll be remapping normal memory. |
| 495 | */ |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 496 | for (page = (unsigned long)fbdev->fb_mem; |
| 497 | page < PAGE_ALIGN((unsigned long)fbdev->fb_mem + fbdev->fb_len); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 498 | page += PAGE_SIZE) { |
Geert Uytterhoeven | cde0e2cc | 2012-02-19 16:11:59 +0100 | [diff] [blame] | 499 | #ifdef CONFIG_DMA_NONCOHERENT |
Manuel Lauss | d121c3f | 2011-09-30 20:49:43 +0200 | [diff] [blame] | 500 | SetPageReserved(virt_to_page(CAC_ADDR((void *)page))); |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 501 | #else |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 502 | SetPageReserved(virt_to_page(page)); |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 503 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 504 | } |
| 505 | |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 506 | print_dbg("Framebuffer memory map at %p", fbdev->fb_mem); |
| 507 | print_dbg("phys=0x%08x, size=%dK", fbdev->fb_phys, fbdev->fb_len / 1024); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 508 | |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 509 | /* Setup LCD clock to AUX (48 MHz) */ |
| 510 | sys_clksrc = au_readl(SYS_CLKSRC) & ~(SYS_CS_ML_MASK | SYS_CS_DL | SYS_CS_CL); |
| 511 | au_writel((sys_clksrc | (1 << SYS_CS_ML_BIT)), SYS_CLKSRC); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 512 | |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 513 | /* load the panel info into the var struct */ |
| 514 | au1100fb_var.bits_per_pixel = fbdev->panel->bpp; |
| 515 | au1100fb_var.xres = fbdev->panel->xres; |
| 516 | au1100fb_var.xres_virtual = au1100fb_var.xres; |
| 517 | au1100fb_var.yres = fbdev->panel->yres; |
| 518 | au1100fb_var.yres_virtual = au1100fb_var.yres; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 519 | |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 520 | fbdev->info.screen_base = fbdev->fb_mem; |
| 521 | fbdev->info.fbops = &au1100fb_ops; |
| 522 | fbdev->info.fix = au1100fb_fix; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 523 | |
Julia Lawall | 1c16697 | 2012-01-21 16:01:58 +0100 | [diff] [blame] | 524 | fbdev->info.pseudo_palette = |
| 525 | devm_kzalloc(&dev->dev, sizeof(u32) * 16, GFP_KERNEL); |
| 526 | if (!fbdev->info.pseudo_palette) |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 527 | return -ENOMEM; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 528 | |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 529 | if (fb_alloc_cmap(&fbdev->info.cmap, AU1100_LCD_NBR_PALETTE_ENTRIES, 0) < 0) { |
| 530 | print_err("Fail to allocate colormap (%d entries)", |
| 531 | AU1100_LCD_NBR_PALETTE_ENTRIES); |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 532 | return -EFAULT; |
| 533 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 534 | |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 535 | fbdev->info.var = au1100fb_var; |
| 536 | |
| 537 | /* Set h/w registers */ |
| 538 | au1100fb_setmode(fbdev); |
| 539 | |
| 540 | /* Register new framebuffer */ |
| 541 | if (register_framebuffer(&fbdev->info) < 0) { |
| 542 | print_err("cannot register new framebuffer"); |
| 543 | goto failed; |
| 544 | } |
| 545 | |
| 546 | return 0; |
| 547 | |
| 548 | failed: |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 549 | if (fbdev->fb_mem) { |
Manuel Lauss | d121c3f | 2011-09-30 20:49:43 +0200 | [diff] [blame] | 550 | dma_free_noncoherent(&dev->dev, fbdev->fb_len, fbdev->fb_mem, |
| 551 | fbdev->fb_phys); |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 552 | } |
| 553 | if (fbdev->info.cmap.len != 0) { |
| 554 | fb_dealloc_cmap(&fbdev->info.cmap); |
| 555 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 556 | |
Julia Lawall | 1c16697 | 2012-01-21 16:01:58 +0100 | [diff] [blame] | 557 | return -ENODEV; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 558 | } |
| 559 | |
Ming Lei | 7a192ec | 2009-02-06 23:40:12 +0800 | [diff] [blame] | 560 | int au1100fb_drv_remove(struct platform_device *dev) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 561 | { |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 562 | struct au1100fb_device *fbdev = NULL; |
| 563 | |
| 564 | if (!dev) |
| 565 | return -ENODEV; |
| 566 | |
Ming Lei | 7a192ec | 2009-02-06 23:40:12 +0800 | [diff] [blame] | 567 | fbdev = (struct au1100fb_device *) platform_get_drvdata(dev); |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 568 | |
| 569 | #if !defined(CONFIG_FRAMEBUFFER_CONSOLE) && defined(CONFIG_LOGO) |
| 570 | au1100fb_fb_blank(VESA_POWERDOWN, &fbdev->info); |
| 571 | #endif |
| 572 | fbdev->regs->lcd_control &= ~LCD_CONTROL_GO; |
| 573 | |
| 574 | /* Clean up all probe data */ |
| 575 | unregister_framebuffer(&fbdev->info); |
| 576 | |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 577 | fb_dealloc_cmap(&fbdev->info.cmap); |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 578 | |
| 579 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 580 | } |
| 581 | |
Rodolfo Giometti | f77f50c | 2006-06-26 00:26:49 -0700 | [diff] [blame] | 582 | #ifdef CONFIG_PM |
| 583 | static u32 sys_clksrc; |
| 584 | static struct au1100fb_regs fbregs; |
| 585 | |
Ming Lei | 7a192ec | 2009-02-06 23:40:12 +0800 | [diff] [blame] | 586 | int au1100fb_drv_suspend(struct platform_device *dev, pm_message_t state) |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 587 | { |
Ming Lei | 7a192ec | 2009-02-06 23:40:12 +0800 | [diff] [blame] | 588 | struct au1100fb_device *fbdev = platform_get_drvdata(dev); |
Rodolfo Giometti | f77f50c | 2006-06-26 00:26:49 -0700 | [diff] [blame] | 589 | |
| 590 | if (!fbdev) |
| 591 | return 0; |
| 592 | |
| 593 | /* Save the clock source state */ |
| 594 | sys_clksrc = au_readl(SYS_CLKSRC); |
| 595 | |
| 596 | /* Blank the LCD */ |
| 597 | au1100fb_fb_blank(VESA_POWERDOWN, &fbdev->info); |
| 598 | |
| 599 | /* Stop LCD clocking */ |
| 600 | au_writel(sys_clksrc & ~SYS_CS_ML_MASK, SYS_CLKSRC); |
| 601 | |
| 602 | memcpy(&fbregs, fbdev->regs, sizeof(struct au1100fb_regs)); |
| 603 | |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 604 | return 0; |
| 605 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 606 | |
Ming Lei | 7a192ec | 2009-02-06 23:40:12 +0800 | [diff] [blame] | 607 | int au1100fb_drv_resume(struct platform_device *dev) |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 608 | { |
Ming Lei | 7a192ec | 2009-02-06 23:40:12 +0800 | [diff] [blame] | 609 | struct au1100fb_device *fbdev = platform_get_drvdata(dev); |
Rodolfo Giometti | f77f50c | 2006-06-26 00:26:49 -0700 | [diff] [blame] | 610 | |
| 611 | if (!fbdev) |
| 612 | return 0; |
| 613 | |
| 614 | memcpy(fbdev->regs, &fbregs, sizeof(struct au1100fb_regs)); |
| 615 | |
| 616 | /* Restart LCD clocking */ |
| 617 | au_writel(sys_clksrc, SYS_CLKSRC); |
| 618 | |
| 619 | /* Unblank the LCD */ |
| 620 | au1100fb_fb_blank(VESA_NO_BLANKING, &fbdev->info); |
| 621 | |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 622 | return 0; |
| 623 | } |
Rodolfo Giometti | f77f50c | 2006-06-26 00:26:49 -0700 | [diff] [blame] | 624 | #else |
| 625 | #define au1100fb_drv_suspend NULL |
| 626 | #define au1100fb_drv_resume NULL |
| 627 | #endif |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 628 | |
Ming Lei | 7a192ec | 2009-02-06 23:40:12 +0800 | [diff] [blame] | 629 | static struct platform_driver au1100fb_driver = { |
| 630 | .driver = { |
| 631 | .name = "au1100-lcd", |
| 632 | .owner = THIS_MODULE, |
| 633 | }, |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 634 | .probe = au1100fb_drv_probe, |
| 635 | .remove = au1100fb_drv_remove, |
| 636 | .suspend = au1100fb_drv_suspend, |
| 637 | .resume = au1100fb_drv_resume, |
| 638 | }; |
| 639 | |
Manuel Lauss | d121c3f | 2011-09-30 20:49:43 +0200 | [diff] [blame] | 640 | static int __init au1100fb_load(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 641 | { |
Ming Lei | 7a192ec | 2009-02-06 23:40:12 +0800 | [diff] [blame] | 642 | return platform_driver_register(&au1100fb_driver); |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 643 | } |
| 644 | |
Manuel Lauss | d121c3f | 2011-09-30 20:49:43 +0200 | [diff] [blame] | 645 | static void __exit au1100fb_unload(void) |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 646 | { |
Ming Lei | 7a192ec | 2009-02-06 23:40:12 +0800 | [diff] [blame] | 647 | platform_driver_unregister(&au1100fb_driver); |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 648 | } |
| 649 | |
Manuel Lauss | d121c3f | 2011-09-30 20:49:43 +0200 | [diff] [blame] | 650 | module_init(au1100fb_load); |
| 651 | module_exit(au1100fb_unload); |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 652 | |
| 653 | MODULE_DESCRIPTION(DRIVER_DESC); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 654 | MODULE_LICENSE("GPL"); |