162306a36Sopenharmony_ci/* drivers/video/s1d13xxxfb.c 262306a36Sopenharmony_ci * 362306a36Sopenharmony_ci * (c) 2004 Simtec Electronics 462306a36Sopenharmony_ci * (c) 2005 Thibaut VARENE <varenet@parisc-linux.org> 562306a36Sopenharmony_ci * (c) 2009 Kristoffer Ericson <kristoffer.ericson@gmail.com> 662306a36Sopenharmony_ci * 762306a36Sopenharmony_ci * Driver for Epson S1D13xxx series framebuffer chips 862306a36Sopenharmony_ci * 962306a36Sopenharmony_ci * Adapted from 1062306a36Sopenharmony_ci * linux/drivers/video/skeletonfb.c 1162306a36Sopenharmony_ci * linux/drivers/video/epson1355fb.c 1262306a36Sopenharmony_ci * linux/drivers/video/epson/s1d13xxxfb.c (2.4 driver by Epson) 1362306a36Sopenharmony_ci * 1462306a36Sopenharmony_ci * TODO: - handle dual screen display (CRT and LCD at the same time). 1562306a36Sopenharmony_ci * - check_var(), mode change, etc. 1662306a36Sopenharmony_ci * - probably not SMP safe :) 1762306a36Sopenharmony_ci * - support all bitblt operations on all cards 1862306a36Sopenharmony_ci * 1962306a36Sopenharmony_ci * This file is subject to the terms and conditions of the GNU General Public 2062306a36Sopenharmony_ci * License. See the file COPYING in the main directory of this archive for 2162306a36Sopenharmony_ci * more details. 2262306a36Sopenharmony_ci */ 2362306a36Sopenharmony_ci 2462306a36Sopenharmony_ci#include <linux/module.h> 2562306a36Sopenharmony_ci#include <linux/platform_device.h> 2662306a36Sopenharmony_ci#include <linux/delay.h> 2762306a36Sopenharmony_ci#include <linux/types.h> 2862306a36Sopenharmony_ci#include <linux/errno.h> 2962306a36Sopenharmony_ci#include <linux/mm.h> 3062306a36Sopenharmony_ci#include <linux/mman.h> 3162306a36Sopenharmony_ci#include <linux/fb.h> 3262306a36Sopenharmony_ci#include <linux/spinlock_types.h> 3362306a36Sopenharmony_ci#include <linux/spinlock.h> 3462306a36Sopenharmony_ci#include <linux/slab.h> 3562306a36Sopenharmony_ci#include <linux/io.h> 3662306a36Sopenharmony_ci 3762306a36Sopenharmony_ci#include <video/s1d13xxxfb.h> 3862306a36Sopenharmony_ci 3962306a36Sopenharmony_ci#define PFX "s1d13xxxfb: " 4062306a36Sopenharmony_ci#define BLIT "s1d13xxxfb_bitblt: " 4162306a36Sopenharmony_ci 4262306a36Sopenharmony_ci/* 4362306a36Sopenharmony_ci * set this to enable debugging on general functions 4462306a36Sopenharmony_ci */ 4562306a36Sopenharmony_ci#if 0 4662306a36Sopenharmony_ci#define dbg(fmt, args...) do { printk(KERN_INFO fmt, ## args); } while(0) 4762306a36Sopenharmony_ci#else 4862306a36Sopenharmony_ci#define dbg(fmt, args...) do { no_printk(KERN_INFO fmt, ## args); } while (0) 4962306a36Sopenharmony_ci#endif 5062306a36Sopenharmony_ci 5162306a36Sopenharmony_ci/* 5262306a36Sopenharmony_ci * set this to enable debugging on 2D acceleration 5362306a36Sopenharmony_ci */ 5462306a36Sopenharmony_ci#if 0 5562306a36Sopenharmony_ci#define dbg_blit(fmt, args...) do { printk(KERN_INFO BLIT fmt, ## args); } while (0) 5662306a36Sopenharmony_ci#else 5762306a36Sopenharmony_ci#define dbg_blit(fmt, args...) do { } while (0) 5862306a36Sopenharmony_ci#endif 5962306a36Sopenharmony_ci 6062306a36Sopenharmony_ci/* 6162306a36Sopenharmony_ci * we make sure only one bitblt operation is running 6262306a36Sopenharmony_ci */ 6362306a36Sopenharmony_cistatic DEFINE_SPINLOCK(s1d13xxxfb_bitblt_lock); 6462306a36Sopenharmony_ci 6562306a36Sopenharmony_ci/* 6662306a36Sopenharmony_ci * list of card production ids 6762306a36Sopenharmony_ci */ 6862306a36Sopenharmony_cistatic const int s1d13xxxfb_prod_ids[] = { 6962306a36Sopenharmony_ci S1D13505_PROD_ID, 7062306a36Sopenharmony_ci S1D13506_PROD_ID, 7162306a36Sopenharmony_ci S1D13806_PROD_ID, 7262306a36Sopenharmony_ci}; 7362306a36Sopenharmony_ci 7462306a36Sopenharmony_ci/* 7562306a36Sopenharmony_ci * List of card strings 7662306a36Sopenharmony_ci */ 7762306a36Sopenharmony_cistatic const char *s1d13xxxfb_prod_names[] = { 7862306a36Sopenharmony_ci "S1D13505", 7962306a36Sopenharmony_ci "S1D13506", 8062306a36Sopenharmony_ci "S1D13806", 8162306a36Sopenharmony_ci}; 8262306a36Sopenharmony_ci 8362306a36Sopenharmony_ci/* 8462306a36Sopenharmony_ci * here we define the default struct fb_fix_screeninfo 8562306a36Sopenharmony_ci */ 8662306a36Sopenharmony_cistatic const struct fb_fix_screeninfo s1d13xxxfb_fix = { 8762306a36Sopenharmony_ci .id = S1D_FBID, 8862306a36Sopenharmony_ci .type = FB_TYPE_PACKED_PIXELS, 8962306a36Sopenharmony_ci .visual = FB_VISUAL_PSEUDOCOLOR, 9062306a36Sopenharmony_ci .xpanstep = 0, 9162306a36Sopenharmony_ci .ypanstep = 1, 9262306a36Sopenharmony_ci .ywrapstep = 0, 9362306a36Sopenharmony_ci .accel = FB_ACCEL_NONE, 9462306a36Sopenharmony_ci}; 9562306a36Sopenharmony_ci 9662306a36Sopenharmony_cistatic inline u8 9762306a36Sopenharmony_cis1d13xxxfb_readreg(struct s1d13xxxfb_par *par, u16 regno) 9862306a36Sopenharmony_ci{ 9962306a36Sopenharmony_ci return readb(par->regs + regno); 10062306a36Sopenharmony_ci} 10162306a36Sopenharmony_ci 10262306a36Sopenharmony_cistatic inline void 10362306a36Sopenharmony_cis1d13xxxfb_writereg(struct s1d13xxxfb_par *par, u16 regno, u8 value) 10462306a36Sopenharmony_ci{ 10562306a36Sopenharmony_ci writeb(value, par->regs + regno); 10662306a36Sopenharmony_ci} 10762306a36Sopenharmony_ci 10862306a36Sopenharmony_cistatic inline void 10962306a36Sopenharmony_cis1d13xxxfb_runinit(struct s1d13xxxfb_par *par, 11062306a36Sopenharmony_ci const struct s1d13xxxfb_regval *initregs, 11162306a36Sopenharmony_ci const unsigned int size) 11262306a36Sopenharmony_ci{ 11362306a36Sopenharmony_ci int i; 11462306a36Sopenharmony_ci 11562306a36Sopenharmony_ci for (i = 0; i < size; i++) { 11662306a36Sopenharmony_ci if ((initregs[i].addr == S1DREG_DELAYOFF) || 11762306a36Sopenharmony_ci (initregs[i].addr == S1DREG_DELAYON)) 11862306a36Sopenharmony_ci mdelay((int)initregs[i].value); 11962306a36Sopenharmony_ci else { 12062306a36Sopenharmony_ci s1d13xxxfb_writereg(par, initregs[i].addr, initregs[i].value); 12162306a36Sopenharmony_ci } 12262306a36Sopenharmony_ci } 12362306a36Sopenharmony_ci 12462306a36Sopenharmony_ci /* make sure the hardware can cope with us */ 12562306a36Sopenharmony_ci mdelay(1); 12662306a36Sopenharmony_ci} 12762306a36Sopenharmony_ci 12862306a36Sopenharmony_cistatic inline void 12962306a36Sopenharmony_cilcd_enable(struct s1d13xxxfb_par *par, int enable) 13062306a36Sopenharmony_ci{ 13162306a36Sopenharmony_ci u8 mode = s1d13xxxfb_readreg(par, S1DREG_COM_DISP_MODE); 13262306a36Sopenharmony_ci 13362306a36Sopenharmony_ci if (enable) 13462306a36Sopenharmony_ci mode |= 0x01; 13562306a36Sopenharmony_ci else 13662306a36Sopenharmony_ci mode &= ~0x01; 13762306a36Sopenharmony_ci 13862306a36Sopenharmony_ci s1d13xxxfb_writereg(par, S1DREG_COM_DISP_MODE, mode); 13962306a36Sopenharmony_ci} 14062306a36Sopenharmony_ci 14162306a36Sopenharmony_cistatic inline void 14262306a36Sopenharmony_cicrt_enable(struct s1d13xxxfb_par *par, int enable) 14362306a36Sopenharmony_ci{ 14462306a36Sopenharmony_ci u8 mode = s1d13xxxfb_readreg(par, S1DREG_COM_DISP_MODE); 14562306a36Sopenharmony_ci 14662306a36Sopenharmony_ci if (enable) 14762306a36Sopenharmony_ci mode |= 0x02; 14862306a36Sopenharmony_ci else 14962306a36Sopenharmony_ci mode &= ~0x02; 15062306a36Sopenharmony_ci 15162306a36Sopenharmony_ci s1d13xxxfb_writereg(par, S1DREG_COM_DISP_MODE, mode); 15262306a36Sopenharmony_ci} 15362306a36Sopenharmony_ci 15462306a36Sopenharmony_ci 15562306a36Sopenharmony_ci/************************************************************* 15662306a36Sopenharmony_ci framebuffer control functions 15762306a36Sopenharmony_ci *************************************************************/ 15862306a36Sopenharmony_cistatic inline void 15962306a36Sopenharmony_cis1d13xxxfb_setup_pseudocolour(struct fb_info *info) 16062306a36Sopenharmony_ci{ 16162306a36Sopenharmony_ci info->fix.visual = FB_VISUAL_PSEUDOCOLOR; 16262306a36Sopenharmony_ci 16362306a36Sopenharmony_ci info->var.red.length = 4; 16462306a36Sopenharmony_ci info->var.green.length = 4; 16562306a36Sopenharmony_ci info->var.blue.length = 4; 16662306a36Sopenharmony_ci} 16762306a36Sopenharmony_ci 16862306a36Sopenharmony_cistatic inline void 16962306a36Sopenharmony_cis1d13xxxfb_setup_truecolour(struct fb_info *info) 17062306a36Sopenharmony_ci{ 17162306a36Sopenharmony_ci info->fix.visual = FB_VISUAL_TRUECOLOR; 17262306a36Sopenharmony_ci info->var.bits_per_pixel = 16; 17362306a36Sopenharmony_ci 17462306a36Sopenharmony_ci info->var.red.length = 5; 17562306a36Sopenharmony_ci info->var.red.offset = 11; 17662306a36Sopenharmony_ci 17762306a36Sopenharmony_ci info->var.green.length = 6; 17862306a36Sopenharmony_ci info->var.green.offset = 5; 17962306a36Sopenharmony_ci 18062306a36Sopenharmony_ci info->var.blue.length = 5; 18162306a36Sopenharmony_ci info->var.blue.offset = 0; 18262306a36Sopenharmony_ci} 18362306a36Sopenharmony_ci 18462306a36Sopenharmony_ci/** 18562306a36Sopenharmony_ci * s1d13xxxfb_set_par - Alters the hardware state. 18662306a36Sopenharmony_ci * @info: frame buffer structure 18762306a36Sopenharmony_ci * 18862306a36Sopenharmony_ci * Using the fb_var_screeninfo in fb_info we set the depth of the 18962306a36Sopenharmony_ci * framebuffer. This function alters the par AND the 19062306a36Sopenharmony_ci * fb_fix_screeninfo stored in fb_info. It doesn't not alter var in 19162306a36Sopenharmony_ci * fb_info since we are using that data. This means we depend on the 19262306a36Sopenharmony_ci * data in var inside fb_info to be supported by the hardware. 19362306a36Sopenharmony_ci * xxxfb_check_var is always called before xxxfb_set_par to ensure this. 19462306a36Sopenharmony_ci * 19562306a36Sopenharmony_ci * XXX TODO: write proper s1d13xxxfb_check_var(), without which that 19662306a36Sopenharmony_ci * function is quite useless. 19762306a36Sopenharmony_ci */ 19862306a36Sopenharmony_cistatic int 19962306a36Sopenharmony_cis1d13xxxfb_set_par(struct fb_info *info) 20062306a36Sopenharmony_ci{ 20162306a36Sopenharmony_ci struct s1d13xxxfb_par *s1dfb = info->par; 20262306a36Sopenharmony_ci unsigned int val; 20362306a36Sopenharmony_ci 20462306a36Sopenharmony_ci dbg("s1d13xxxfb_set_par: bpp=%d\n", info->var.bits_per_pixel); 20562306a36Sopenharmony_ci 20662306a36Sopenharmony_ci if ((s1dfb->display & 0x01)) /* LCD */ 20762306a36Sopenharmony_ci val = s1d13xxxfb_readreg(s1dfb, S1DREG_LCD_DISP_MODE); /* read colour control */ 20862306a36Sopenharmony_ci else /* CRT */ 20962306a36Sopenharmony_ci val = s1d13xxxfb_readreg(s1dfb, S1DREG_CRT_DISP_MODE); /* read colour control */ 21062306a36Sopenharmony_ci 21162306a36Sopenharmony_ci val &= ~0x07; 21262306a36Sopenharmony_ci 21362306a36Sopenharmony_ci switch (info->var.bits_per_pixel) { 21462306a36Sopenharmony_ci case 4: 21562306a36Sopenharmony_ci dbg("pseudo colour 4\n"); 21662306a36Sopenharmony_ci s1d13xxxfb_setup_pseudocolour(info); 21762306a36Sopenharmony_ci val |= 2; 21862306a36Sopenharmony_ci break; 21962306a36Sopenharmony_ci case 8: 22062306a36Sopenharmony_ci dbg("pseudo colour 8\n"); 22162306a36Sopenharmony_ci s1d13xxxfb_setup_pseudocolour(info); 22262306a36Sopenharmony_ci val |= 3; 22362306a36Sopenharmony_ci break; 22462306a36Sopenharmony_ci case 16: 22562306a36Sopenharmony_ci dbg("true colour\n"); 22662306a36Sopenharmony_ci s1d13xxxfb_setup_truecolour(info); 22762306a36Sopenharmony_ci val |= 5; 22862306a36Sopenharmony_ci break; 22962306a36Sopenharmony_ci 23062306a36Sopenharmony_ci default: 23162306a36Sopenharmony_ci dbg("bpp not supported!\n"); 23262306a36Sopenharmony_ci return -EINVAL; 23362306a36Sopenharmony_ci } 23462306a36Sopenharmony_ci 23562306a36Sopenharmony_ci dbg("writing %02x to display mode register\n", val); 23662306a36Sopenharmony_ci 23762306a36Sopenharmony_ci if ((s1dfb->display & 0x01)) /* LCD */ 23862306a36Sopenharmony_ci s1d13xxxfb_writereg(s1dfb, S1DREG_LCD_DISP_MODE, val); 23962306a36Sopenharmony_ci else /* CRT */ 24062306a36Sopenharmony_ci s1d13xxxfb_writereg(s1dfb, S1DREG_CRT_DISP_MODE, val); 24162306a36Sopenharmony_ci 24262306a36Sopenharmony_ci info->fix.line_length = info->var.xres * info->var.bits_per_pixel; 24362306a36Sopenharmony_ci info->fix.line_length /= 8; 24462306a36Sopenharmony_ci 24562306a36Sopenharmony_ci dbg("setting line_length to %d\n", info->fix.line_length); 24662306a36Sopenharmony_ci 24762306a36Sopenharmony_ci dbg("done setup\n"); 24862306a36Sopenharmony_ci 24962306a36Sopenharmony_ci return 0; 25062306a36Sopenharmony_ci} 25162306a36Sopenharmony_ci 25262306a36Sopenharmony_ci/** 25362306a36Sopenharmony_ci * s1d13xxxfb_setcolreg - sets a color register. 25462306a36Sopenharmony_ci * @regno: Which register in the CLUT we are programming 25562306a36Sopenharmony_ci * @red: The red value which can be up to 16 bits wide 25662306a36Sopenharmony_ci * @green: The green value which can be up to 16 bits wide 25762306a36Sopenharmony_ci * @blue: The blue value which can be up to 16 bits wide. 25862306a36Sopenharmony_ci * @transp: If supported the alpha value which can be up to 16 bits wide. 25962306a36Sopenharmony_ci * @info: frame buffer info structure 26062306a36Sopenharmony_ci * 26162306a36Sopenharmony_ci * Returns negative errno on error, or zero on success. 26262306a36Sopenharmony_ci */ 26362306a36Sopenharmony_cistatic int 26462306a36Sopenharmony_cis1d13xxxfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, 26562306a36Sopenharmony_ci u_int transp, struct fb_info *info) 26662306a36Sopenharmony_ci{ 26762306a36Sopenharmony_ci struct s1d13xxxfb_par *s1dfb = info->par; 26862306a36Sopenharmony_ci unsigned int pseudo_val; 26962306a36Sopenharmony_ci 27062306a36Sopenharmony_ci if (regno >= S1D_PALETTE_SIZE) 27162306a36Sopenharmony_ci return -EINVAL; 27262306a36Sopenharmony_ci 27362306a36Sopenharmony_ci dbg("s1d13xxxfb_setcolreg: %d: rgb=%d,%d,%d, tr=%d\n", 27462306a36Sopenharmony_ci regno, red, green, blue, transp); 27562306a36Sopenharmony_ci 27662306a36Sopenharmony_ci if (info->var.grayscale) 27762306a36Sopenharmony_ci red = green = blue = (19595*red + 38470*green + 7471*blue) >> 16; 27862306a36Sopenharmony_ci 27962306a36Sopenharmony_ci switch (info->fix.visual) { 28062306a36Sopenharmony_ci case FB_VISUAL_TRUECOLOR: 28162306a36Sopenharmony_ci if (regno >= 16) 28262306a36Sopenharmony_ci return -EINVAL; 28362306a36Sopenharmony_ci 28462306a36Sopenharmony_ci /* deal with creating pseudo-palette entries */ 28562306a36Sopenharmony_ci 28662306a36Sopenharmony_ci pseudo_val = (red >> 11) << info->var.red.offset; 28762306a36Sopenharmony_ci pseudo_val |= (green >> 10) << info->var.green.offset; 28862306a36Sopenharmony_ci pseudo_val |= (blue >> 11) << info->var.blue.offset; 28962306a36Sopenharmony_ci 29062306a36Sopenharmony_ci dbg("s1d13xxxfb_setcolreg: pseudo %d, val %08x\n", 29162306a36Sopenharmony_ci regno, pseudo_val); 29262306a36Sopenharmony_ci 29362306a36Sopenharmony_ci ((u32 *)info->pseudo_palette)[regno] = pseudo_val; 29462306a36Sopenharmony_ci 29562306a36Sopenharmony_ci break; 29662306a36Sopenharmony_ci case FB_VISUAL_PSEUDOCOLOR: 29762306a36Sopenharmony_ci s1d13xxxfb_writereg(s1dfb, S1DREG_LKUP_ADDR, regno); 29862306a36Sopenharmony_ci s1d13xxxfb_writereg(s1dfb, S1DREG_LKUP_DATA, red); 29962306a36Sopenharmony_ci s1d13xxxfb_writereg(s1dfb, S1DREG_LKUP_DATA, green); 30062306a36Sopenharmony_ci s1d13xxxfb_writereg(s1dfb, S1DREG_LKUP_DATA, blue); 30162306a36Sopenharmony_ci 30262306a36Sopenharmony_ci break; 30362306a36Sopenharmony_ci default: 30462306a36Sopenharmony_ci return -ENOSYS; 30562306a36Sopenharmony_ci } 30662306a36Sopenharmony_ci 30762306a36Sopenharmony_ci dbg("s1d13xxxfb_setcolreg: done\n"); 30862306a36Sopenharmony_ci 30962306a36Sopenharmony_ci return 0; 31062306a36Sopenharmony_ci} 31162306a36Sopenharmony_ci 31262306a36Sopenharmony_ci/** 31362306a36Sopenharmony_ci * s1d13xxxfb_blank - blanks the display. 31462306a36Sopenharmony_ci * @blank_mode: the blank mode we want. 31562306a36Sopenharmony_ci * @info: frame buffer structure that represents a single frame buffer 31662306a36Sopenharmony_ci * 31762306a36Sopenharmony_ci * Blank the screen if blank_mode != 0, else unblank. Return 0 if 31862306a36Sopenharmony_ci * blanking succeeded, != 0 if un-/blanking failed due to e.g. a 31962306a36Sopenharmony_ci * video mode which doesn't support it. Implements VESA suspend 32062306a36Sopenharmony_ci * and powerdown modes on hardware that supports disabling hsync/vsync: 32162306a36Sopenharmony_ci * blank_mode == 2: suspend vsync 32262306a36Sopenharmony_ci * blank_mode == 3: suspend hsync 32362306a36Sopenharmony_ci * blank_mode == 4: powerdown 32462306a36Sopenharmony_ci * 32562306a36Sopenharmony_ci * Returns negative errno on error, or zero on success. 32662306a36Sopenharmony_ci */ 32762306a36Sopenharmony_cistatic int 32862306a36Sopenharmony_cis1d13xxxfb_blank(int blank_mode, struct fb_info *info) 32962306a36Sopenharmony_ci{ 33062306a36Sopenharmony_ci struct s1d13xxxfb_par *par = info->par; 33162306a36Sopenharmony_ci 33262306a36Sopenharmony_ci dbg("s1d13xxxfb_blank: blank=%d, info=%p\n", blank_mode, info); 33362306a36Sopenharmony_ci 33462306a36Sopenharmony_ci switch (blank_mode) { 33562306a36Sopenharmony_ci case FB_BLANK_UNBLANK: 33662306a36Sopenharmony_ci case FB_BLANK_NORMAL: 33762306a36Sopenharmony_ci if ((par->display & 0x01) != 0) 33862306a36Sopenharmony_ci lcd_enable(par, 1); 33962306a36Sopenharmony_ci if ((par->display & 0x02) != 0) 34062306a36Sopenharmony_ci crt_enable(par, 1); 34162306a36Sopenharmony_ci break; 34262306a36Sopenharmony_ci case FB_BLANK_VSYNC_SUSPEND: 34362306a36Sopenharmony_ci case FB_BLANK_HSYNC_SUSPEND: 34462306a36Sopenharmony_ci break; 34562306a36Sopenharmony_ci case FB_BLANK_POWERDOWN: 34662306a36Sopenharmony_ci lcd_enable(par, 0); 34762306a36Sopenharmony_ci crt_enable(par, 0); 34862306a36Sopenharmony_ci break; 34962306a36Sopenharmony_ci default: 35062306a36Sopenharmony_ci return -EINVAL; 35162306a36Sopenharmony_ci } 35262306a36Sopenharmony_ci 35362306a36Sopenharmony_ci /* let fbcon do a soft blank for us */ 35462306a36Sopenharmony_ci return ((blank_mode == FB_BLANK_NORMAL) ? 1 : 0); 35562306a36Sopenharmony_ci} 35662306a36Sopenharmony_ci 35762306a36Sopenharmony_ci/** 35862306a36Sopenharmony_ci * s1d13xxxfb_pan_display - Pans the display. 35962306a36Sopenharmony_ci * @var: frame buffer variable screen structure 36062306a36Sopenharmony_ci * @info: frame buffer structure that represents a single frame buffer 36162306a36Sopenharmony_ci * 36262306a36Sopenharmony_ci * Pan (or wrap, depending on the `vmode' field) the display using the 36362306a36Sopenharmony_ci * `yoffset' field of the `var' structure (`xoffset' not yet supported). 36462306a36Sopenharmony_ci * If the values don't fit, return -EINVAL. 36562306a36Sopenharmony_ci * 36662306a36Sopenharmony_ci * Returns negative errno on error, or zero on success. 36762306a36Sopenharmony_ci */ 36862306a36Sopenharmony_cistatic int 36962306a36Sopenharmony_cis1d13xxxfb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info) 37062306a36Sopenharmony_ci{ 37162306a36Sopenharmony_ci struct s1d13xxxfb_par *par = info->par; 37262306a36Sopenharmony_ci u32 start; 37362306a36Sopenharmony_ci 37462306a36Sopenharmony_ci if (var->xoffset != 0) /* not yet ... */ 37562306a36Sopenharmony_ci return -EINVAL; 37662306a36Sopenharmony_ci 37762306a36Sopenharmony_ci if (var->yoffset + info->var.yres > info->var.yres_virtual) 37862306a36Sopenharmony_ci return -EINVAL; 37962306a36Sopenharmony_ci 38062306a36Sopenharmony_ci start = (info->fix.line_length >> 1) * var->yoffset; 38162306a36Sopenharmony_ci 38262306a36Sopenharmony_ci if ((par->display & 0x01)) { 38362306a36Sopenharmony_ci /* LCD */ 38462306a36Sopenharmony_ci s1d13xxxfb_writereg(par, S1DREG_LCD_DISP_START0, (start & 0xff)); 38562306a36Sopenharmony_ci s1d13xxxfb_writereg(par, S1DREG_LCD_DISP_START1, ((start >> 8) & 0xff)); 38662306a36Sopenharmony_ci s1d13xxxfb_writereg(par, S1DREG_LCD_DISP_START2, ((start >> 16) & 0x0f)); 38762306a36Sopenharmony_ci } else { 38862306a36Sopenharmony_ci /* CRT */ 38962306a36Sopenharmony_ci s1d13xxxfb_writereg(par, S1DREG_CRT_DISP_START0, (start & 0xff)); 39062306a36Sopenharmony_ci s1d13xxxfb_writereg(par, S1DREG_CRT_DISP_START1, ((start >> 8) & 0xff)); 39162306a36Sopenharmony_ci s1d13xxxfb_writereg(par, S1DREG_CRT_DISP_START2, ((start >> 16) & 0x0f)); 39262306a36Sopenharmony_ci } 39362306a36Sopenharmony_ci 39462306a36Sopenharmony_ci return 0; 39562306a36Sopenharmony_ci} 39662306a36Sopenharmony_ci 39762306a36Sopenharmony_ci/************************************************************ 39862306a36Sopenharmony_ci functions to handle bitblt acceleration 39962306a36Sopenharmony_ci ************************************************************/ 40062306a36Sopenharmony_ci 40162306a36Sopenharmony_ci/** 40262306a36Sopenharmony_ci * bltbit_wait_bitclear - waits for change in register value 40362306a36Sopenharmony_ci * @info : frambuffer structure 40462306a36Sopenharmony_ci * @bit : value currently in register 40562306a36Sopenharmony_ci * @timeout : ... 40662306a36Sopenharmony_ci * 40762306a36Sopenharmony_ci * waits until value changes FROM bit 40862306a36Sopenharmony_ci * 40962306a36Sopenharmony_ci */ 41062306a36Sopenharmony_cistatic u8 41162306a36Sopenharmony_cibltbit_wait_bitclear(struct fb_info *info, u8 bit, int timeout) 41262306a36Sopenharmony_ci{ 41362306a36Sopenharmony_ci while (s1d13xxxfb_readreg(info->par, S1DREG_BBLT_CTL0) & bit) { 41462306a36Sopenharmony_ci udelay(10); 41562306a36Sopenharmony_ci if (!--timeout) { 41662306a36Sopenharmony_ci dbg_blit("wait_bitclear timeout\n"); 41762306a36Sopenharmony_ci break; 41862306a36Sopenharmony_ci } 41962306a36Sopenharmony_ci } 42062306a36Sopenharmony_ci 42162306a36Sopenharmony_ci return timeout; 42262306a36Sopenharmony_ci} 42362306a36Sopenharmony_ci 42462306a36Sopenharmony_ci/* 42562306a36Sopenharmony_ci * s1d13xxxfb_bitblt_copyarea - accelerated copyarea function 42662306a36Sopenharmony_ci * @info : framebuffer structure 42762306a36Sopenharmony_ci * @area : fb_copyarea structure 42862306a36Sopenharmony_ci * 42962306a36Sopenharmony_ci * supports (atleast) S1D13506 43062306a36Sopenharmony_ci * 43162306a36Sopenharmony_ci */ 43262306a36Sopenharmony_cistatic void 43362306a36Sopenharmony_cis1d13xxxfb_bitblt_copyarea(struct fb_info *info, const struct fb_copyarea *area) 43462306a36Sopenharmony_ci{ 43562306a36Sopenharmony_ci u32 dst, src; 43662306a36Sopenharmony_ci u32 stride; 43762306a36Sopenharmony_ci u16 reverse = 0; 43862306a36Sopenharmony_ci u16 sx = area->sx, sy = area->sy; 43962306a36Sopenharmony_ci u16 dx = area->dx, dy = area->dy; 44062306a36Sopenharmony_ci u16 width = area->width, height = area->height; 44162306a36Sopenharmony_ci u16 bpp; 44262306a36Sopenharmony_ci 44362306a36Sopenharmony_ci spin_lock(&s1d13xxxfb_bitblt_lock); 44462306a36Sopenharmony_ci 44562306a36Sopenharmony_ci /* bytes per xres line */ 44662306a36Sopenharmony_ci bpp = (info->var.bits_per_pixel >> 3); 44762306a36Sopenharmony_ci stride = bpp * info->var.xres; 44862306a36Sopenharmony_ci 44962306a36Sopenharmony_ci /* reverse, calculate the last pixel in rectangle */ 45062306a36Sopenharmony_ci if ((dy > sy) || ((dy == sy) && (dx >= sx))) { 45162306a36Sopenharmony_ci dst = (((dy + height - 1) * stride) + (bpp * (dx + width - 1))); 45262306a36Sopenharmony_ci src = (((sy + height - 1) * stride) + (bpp * (sx + width - 1))); 45362306a36Sopenharmony_ci reverse = 1; 45462306a36Sopenharmony_ci /* not reverse, calculate the first pixel in rectangle */ 45562306a36Sopenharmony_ci } else { /* (y * xres) + (bpp * x) */ 45662306a36Sopenharmony_ci dst = (dy * stride) + (bpp * dx); 45762306a36Sopenharmony_ci src = (sy * stride) + (bpp * sx); 45862306a36Sopenharmony_ci } 45962306a36Sopenharmony_ci 46062306a36Sopenharmony_ci /* set source address */ 46162306a36Sopenharmony_ci s1d13xxxfb_writereg(info->par, S1DREG_BBLT_SRC_START0, (src & 0xff)); 46262306a36Sopenharmony_ci s1d13xxxfb_writereg(info->par, S1DREG_BBLT_SRC_START1, (src >> 8) & 0x00ff); 46362306a36Sopenharmony_ci s1d13xxxfb_writereg(info->par, S1DREG_BBLT_SRC_START2, (src >> 16) & 0x00ff); 46462306a36Sopenharmony_ci 46562306a36Sopenharmony_ci /* set destination address */ 46662306a36Sopenharmony_ci s1d13xxxfb_writereg(info->par, S1DREG_BBLT_DST_START0, (dst & 0xff)); 46762306a36Sopenharmony_ci s1d13xxxfb_writereg(info->par, S1DREG_BBLT_DST_START1, (dst >> 8) & 0x00ff); 46862306a36Sopenharmony_ci s1d13xxxfb_writereg(info->par, S1DREG_BBLT_DST_START2, (dst >> 16) & 0x00ff); 46962306a36Sopenharmony_ci 47062306a36Sopenharmony_ci /* program height and width */ 47162306a36Sopenharmony_ci s1d13xxxfb_writereg(info->par, S1DREG_BBLT_WIDTH0, (width & 0xff) - 1); 47262306a36Sopenharmony_ci s1d13xxxfb_writereg(info->par, S1DREG_BBLT_WIDTH1, (width >> 8)); 47362306a36Sopenharmony_ci 47462306a36Sopenharmony_ci s1d13xxxfb_writereg(info->par, S1DREG_BBLT_HEIGHT0, (height & 0xff) - 1); 47562306a36Sopenharmony_ci s1d13xxxfb_writereg(info->par, S1DREG_BBLT_HEIGHT1, (height >> 8)); 47662306a36Sopenharmony_ci 47762306a36Sopenharmony_ci /* negative direction ROP */ 47862306a36Sopenharmony_ci if (reverse == 1) { 47962306a36Sopenharmony_ci dbg_blit("(copyarea) negative rop\n"); 48062306a36Sopenharmony_ci s1d13xxxfb_writereg(info->par, S1DREG_BBLT_OP, 0x03); 48162306a36Sopenharmony_ci } else /* positive direction ROP */ { 48262306a36Sopenharmony_ci s1d13xxxfb_writereg(info->par, S1DREG_BBLT_OP, 0x02); 48362306a36Sopenharmony_ci dbg_blit("(copyarea) positive rop\n"); 48462306a36Sopenharmony_ci } 48562306a36Sopenharmony_ci 48662306a36Sopenharmony_ci /* set for rectangel mode and not linear */ 48762306a36Sopenharmony_ci s1d13xxxfb_writereg(info->par, S1DREG_BBLT_CTL0, 0x0); 48862306a36Sopenharmony_ci 48962306a36Sopenharmony_ci /* setup the bpp 1 = 16bpp, 0 = 8bpp*/ 49062306a36Sopenharmony_ci s1d13xxxfb_writereg(info->par, S1DREG_BBLT_CTL1, (bpp >> 1)); 49162306a36Sopenharmony_ci 49262306a36Sopenharmony_ci /* set words per xres */ 49362306a36Sopenharmony_ci s1d13xxxfb_writereg(info->par, S1DREG_BBLT_MEM_OFF0, (stride >> 1) & 0xff); 49462306a36Sopenharmony_ci s1d13xxxfb_writereg(info->par, S1DREG_BBLT_MEM_OFF1, (stride >> 9)); 49562306a36Sopenharmony_ci 49662306a36Sopenharmony_ci dbg_blit("(copyarea) dx=%d, dy=%d\n", dx, dy); 49762306a36Sopenharmony_ci dbg_blit("(copyarea) sx=%d, sy=%d\n", sx, sy); 49862306a36Sopenharmony_ci dbg_blit("(copyarea) width=%d, height=%d\n", width - 1, height - 1); 49962306a36Sopenharmony_ci dbg_blit("(copyarea) stride=%d\n", stride); 50062306a36Sopenharmony_ci dbg_blit("(copyarea) bpp=%d=0x0%d, mem_offset1=%d, mem_offset2=%d\n", bpp, (bpp >> 1), 50162306a36Sopenharmony_ci (stride >> 1) & 0xff, stride >> 9); 50262306a36Sopenharmony_ci 50362306a36Sopenharmony_ci s1d13xxxfb_writereg(info->par, S1DREG_BBLT_CC_EXP, 0x0c); 50462306a36Sopenharmony_ci 50562306a36Sopenharmony_ci /* initialize the engine */ 50662306a36Sopenharmony_ci s1d13xxxfb_writereg(info->par, S1DREG_BBLT_CTL0, 0x80); 50762306a36Sopenharmony_ci 50862306a36Sopenharmony_ci /* wait to complete */ 50962306a36Sopenharmony_ci bltbit_wait_bitclear(info, 0x80, 8000); 51062306a36Sopenharmony_ci 51162306a36Sopenharmony_ci spin_unlock(&s1d13xxxfb_bitblt_lock); 51262306a36Sopenharmony_ci} 51362306a36Sopenharmony_ci 51462306a36Sopenharmony_ci/** 51562306a36Sopenharmony_ci * s1d13xxxfb_bitblt_solidfill - accelerated solidfill function 51662306a36Sopenharmony_ci * @info : framebuffer structure 51762306a36Sopenharmony_ci * @rect : fb_fillrect structure 51862306a36Sopenharmony_ci * 51962306a36Sopenharmony_ci * supports (atleast 13506) 52062306a36Sopenharmony_ci * 52162306a36Sopenharmony_ci **/ 52262306a36Sopenharmony_cistatic void 52362306a36Sopenharmony_cis1d13xxxfb_bitblt_solidfill(struct fb_info *info, const struct fb_fillrect *rect) 52462306a36Sopenharmony_ci{ 52562306a36Sopenharmony_ci u32 screen_stride, dest; 52662306a36Sopenharmony_ci u32 fg; 52762306a36Sopenharmony_ci u16 bpp = (info->var.bits_per_pixel >> 3); 52862306a36Sopenharmony_ci 52962306a36Sopenharmony_ci /* grab spinlock */ 53062306a36Sopenharmony_ci spin_lock(&s1d13xxxfb_bitblt_lock); 53162306a36Sopenharmony_ci 53262306a36Sopenharmony_ci /* bytes per x width */ 53362306a36Sopenharmony_ci screen_stride = (bpp * info->var.xres); 53462306a36Sopenharmony_ci 53562306a36Sopenharmony_ci /* bytes to starting point */ 53662306a36Sopenharmony_ci dest = ((rect->dy * screen_stride) + (bpp * rect->dx)); 53762306a36Sopenharmony_ci 53862306a36Sopenharmony_ci dbg_blit("(solidfill) dx=%d, dy=%d, stride=%d, dest=%d\n" 53962306a36Sopenharmony_ci "(solidfill) : rect_width=%d, rect_height=%d\n", 54062306a36Sopenharmony_ci rect->dx, rect->dy, screen_stride, dest, 54162306a36Sopenharmony_ci rect->width - 1, rect->height - 1); 54262306a36Sopenharmony_ci 54362306a36Sopenharmony_ci dbg_blit("(solidfill) : xres=%d, yres=%d, bpp=%d\n", 54462306a36Sopenharmony_ci info->var.xres, info->var.yres, 54562306a36Sopenharmony_ci info->var.bits_per_pixel); 54662306a36Sopenharmony_ci dbg_blit("(solidfill) : rop=%d\n", rect->rop); 54762306a36Sopenharmony_ci 54862306a36Sopenharmony_ci /* We split the destination into the three registers */ 54962306a36Sopenharmony_ci s1d13xxxfb_writereg(info->par, S1DREG_BBLT_DST_START0, (dest & 0x00ff)); 55062306a36Sopenharmony_ci s1d13xxxfb_writereg(info->par, S1DREG_BBLT_DST_START1, ((dest >> 8) & 0x00ff)); 55162306a36Sopenharmony_ci s1d13xxxfb_writereg(info->par, S1DREG_BBLT_DST_START2, ((dest >> 16) & 0x00ff)); 55262306a36Sopenharmony_ci 55362306a36Sopenharmony_ci /* give information regarding rectangel width */ 55462306a36Sopenharmony_ci s1d13xxxfb_writereg(info->par, S1DREG_BBLT_WIDTH0, ((rect->width) & 0x00ff) - 1); 55562306a36Sopenharmony_ci s1d13xxxfb_writereg(info->par, S1DREG_BBLT_WIDTH1, (rect->width >> 8)); 55662306a36Sopenharmony_ci 55762306a36Sopenharmony_ci /* give information regarding rectangel height */ 55862306a36Sopenharmony_ci s1d13xxxfb_writereg(info->par, S1DREG_BBLT_HEIGHT0, ((rect->height) & 0x00ff) - 1); 55962306a36Sopenharmony_ci s1d13xxxfb_writereg(info->par, S1DREG_BBLT_HEIGHT1, (rect->height >> 8)); 56062306a36Sopenharmony_ci 56162306a36Sopenharmony_ci if (info->fix.visual == FB_VISUAL_TRUECOLOR || 56262306a36Sopenharmony_ci info->fix.visual == FB_VISUAL_DIRECTCOLOR) { 56362306a36Sopenharmony_ci fg = ((u32 *)info->pseudo_palette)[rect->color]; 56462306a36Sopenharmony_ci dbg_blit("(solidfill) truecolor/directcolor\n"); 56562306a36Sopenharmony_ci dbg_blit("(solidfill) pseudo_palette[%d] = %d\n", rect->color, fg); 56662306a36Sopenharmony_ci } else { 56762306a36Sopenharmony_ci fg = rect->color; 56862306a36Sopenharmony_ci dbg_blit("(solidfill) color = %d\n", rect->color); 56962306a36Sopenharmony_ci } 57062306a36Sopenharmony_ci 57162306a36Sopenharmony_ci /* set foreground color */ 57262306a36Sopenharmony_ci s1d13xxxfb_writereg(info->par, S1DREG_BBLT_FGC0, (fg & 0xff)); 57362306a36Sopenharmony_ci s1d13xxxfb_writereg(info->par, S1DREG_BBLT_FGC1, (fg >> 8) & 0xff); 57462306a36Sopenharmony_ci 57562306a36Sopenharmony_ci /* set rectangual region of memory (rectangle and not linear) */ 57662306a36Sopenharmony_ci s1d13xxxfb_writereg(info->par, S1DREG_BBLT_CTL0, 0x0); 57762306a36Sopenharmony_ci 57862306a36Sopenharmony_ci /* set operation mode SOLID_FILL */ 57962306a36Sopenharmony_ci s1d13xxxfb_writereg(info->par, S1DREG_BBLT_OP, BBLT_SOLID_FILL); 58062306a36Sopenharmony_ci 58162306a36Sopenharmony_ci /* set bits per pixel (1 = 16bpp, 0 = 8bpp) */ 58262306a36Sopenharmony_ci s1d13xxxfb_writereg(info->par, S1DREG_BBLT_CTL1, (info->var.bits_per_pixel >> 4)); 58362306a36Sopenharmony_ci 58462306a36Sopenharmony_ci /* set the memory offset for the bblt in word sizes */ 58562306a36Sopenharmony_ci s1d13xxxfb_writereg(info->par, S1DREG_BBLT_MEM_OFF0, (screen_stride >> 1) & 0x00ff); 58662306a36Sopenharmony_ci s1d13xxxfb_writereg(info->par, S1DREG_BBLT_MEM_OFF1, (screen_stride >> 9)); 58762306a36Sopenharmony_ci 58862306a36Sopenharmony_ci /* and away we go.... */ 58962306a36Sopenharmony_ci s1d13xxxfb_writereg(info->par, S1DREG_BBLT_CTL0, 0x80); 59062306a36Sopenharmony_ci 59162306a36Sopenharmony_ci /* wait until its done */ 59262306a36Sopenharmony_ci bltbit_wait_bitclear(info, 0x80, 8000); 59362306a36Sopenharmony_ci 59462306a36Sopenharmony_ci /* let others play */ 59562306a36Sopenharmony_ci spin_unlock(&s1d13xxxfb_bitblt_lock); 59662306a36Sopenharmony_ci} 59762306a36Sopenharmony_ci 59862306a36Sopenharmony_ci/* framebuffer information structures */ 59962306a36Sopenharmony_cistatic struct fb_ops s1d13xxxfb_fbops = { 60062306a36Sopenharmony_ci .owner = THIS_MODULE, 60162306a36Sopenharmony_ci .fb_set_par = s1d13xxxfb_set_par, 60262306a36Sopenharmony_ci .fb_setcolreg = s1d13xxxfb_setcolreg, 60362306a36Sopenharmony_ci .fb_blank = s1d13xxxfb_blank, 60462306a36Sopenharmony_ci 60562306a36Sopenharmony_ci .fb_pan_display = s1d13xxxfb_pan_display, 60662306a36Sopenharmony_ci 60762306a36Sopenharmony_ci /* gets replaced at chip detection time */ 60862306a36Sopenharmony_ci .fb_fillrect = cfb_fillrect, 60962306a36Sopenharmony_ci .fb_copyarea = cfb_copyarea, 61062306a36Sopenharmony_ci .fb_imageblit = cfb_imageblit, 61162306a36Sopenharmony_ci}; 61262306a36Sopenharmony_ci 61362306a36Sopenharmony_cistatic int s1d13xxxfb_width_tab[2][4] = { 61462306a36Sopenharmony_ci {4, 8, 16, -1}, 61562306a36Sopenharmony_ci {9, 12, 18, -1}, 61662306a36Sopenharmony_ci}; 61762306a36Sopenharmony_ci 61862306a36Sopenharmony_ci/** 61962306a36Sopenharmony_ci * s1d13xxxfb_fetch_hw_state - Configure the framebuffer according to 62062306a36Sopenharmony_ci * hardware setup. 62162306a36Sopenharmony_ci * @info: frame buffer structure 62262306a36Sopenharmony_ci * 62362306a36Sopenharmony_ci * We setup the framebuffer structures according to the current 62462306a36Sopenharmony_ci * hardware setup. On some machines, the BIOS will have filled 62562306a36Sopenharmony_ci * the chip registers with such info, on others, these values will 62662306a36Sopenharmony_ci * have been written in some init procedure. In any case, the 62762306a36Sopenharmony_ci * software values needs to match the hardware ones. This is what 62862306a36Sopenharmony_ci * this function ensures. 62962306a36Sopenharmony_ci * 63062306a36Sopenharmony_ci * Note: some of the hardcoded values here might need some love to 63162306a36Sopenharmony_ci * work on various chips, and might need to no longer be hardcoded. 63262306a36Sopenharmony_ci */ 63362306a36Sopenharmony_cistatic void s1d13xxxfb_fetch_hw_state(struct fb_info *info) 63462306a36Sopenharmony_ci{ 63562306a36Sopenharmony_ci struct fb_var_screeninfo *var = &info->var; 63662306a36Sopenharmony_ci struct fb_fix_screeninfo *fix = &info->fix; 63762306a36Sopenharmony_ci struct s1d13xxxfb_par *par = info->par; 63862306a36Sopenharmony_ci u8 panel, display; 63962306a36Sopenharmony_ci u16 offset; 64062306a36Sopenharmony_ci u32 xres, yres; 64162306a36Sopenharmony_ci u32 xres_virtual, yres_virtual; 64262306a36Sopenharmony_ci int bpp, lcd_bpp; 64362306a36Sopenharmony_ci int is_color, is_dual, is_tft; 64462306a36Sopenharmony_ci int lcd_enabled, crt_enabled; 64562306a36Sopenharmony_ci 64662306a36Sopenharmony_ci fix->type = FB_TYPE_PACKED_PIXELS; 64762306a36Sopenharmony_ci 64862306a36Sopenharmony_ci /* general info */ 64962306a36Sopenharmony_ci par->display = s1d13xxxfb_readreg(par, S1DREG_COM_DISP_MODE); 65062306a36Sopenharmony_ci crt_enabled = (par->display & 0x02) != 0; 65162306a36Sopenharmony_ci lcd_enabled = (par->display & 0x01) != 0; 65262306a36Sopenharmony_ci 65362306a36Sopenharmony_ci if (lcd_enabled && crt_enabled) 65462306a36Sopenharmony_ci printk(KERN_WARNING PFX "Warning: LCD and CRT detected, using LCD\n"); 65562306a36Sopenharmony_ci 65662306a36Sopenharmony_ci if (lcd_enabled) 65762306a36Sopenharmony_ci display = s1d13xxxfb_readreg(par, S1DREG_LCD_DISP_MODE); 65862306a36Sopenharmony_ci else /* CRT */ 65962306a36Sopenharmony_ci display = s1d13xxxfb_readreg(par, S1DREG_CRT_DISP_MODE); 66062306a36Sopenharmony_ci 66162306a36Sopenharmony_ci bpp = display & 0x07; 66262306a36Sopenharmony_ci 66362306a36Sopenharmony_ci switch (bpp) { 66462306a36Sopenharmony_ci case 2: /* 4 bpp */ 66562306a36Sopenharmony_ci case 3: /* 8 bpp */ 66662306a36Sopenharmony_ci var->bits_per_pixel = 8; 66762306a36Sopenharmony_ci var->red.offset = var->green.offset = var->blue.offset = 0; 66862306a36Sopenharmony_ci var->red.length = var->green.length = var->blue.length = 8; 66962306a36Sopenharmony_ci break; 67062306a36Sopenharmony_ci case 5: /* 16 bpp */ 67162306a36Sopenharmony_ci s1d13xxxfb_setup_truecolour(info); 67262306a36Sopenharmony_ci break; 67362306a36Sopenharmony_ci default: 67462306a36Sopenharmony_ci dbg("bpp: %i\n", bpp); 67562306a36Sopenharmony_ci } 67662306a36Sopenharmony_ci fb_alloc_cmap(&info->cmap, 256, 0); 67762306a36Sopenharmony_ci 67862306a36Sopenharmony_ci /* LCD info */ 67962306a36Sopenharmony_ci panel = s1d13xxxfb_readreg(par, S1DREG_PANEL_TYPE); 68062306a36Sopenharmony_ci is_color = (panel & 0x04) != 0; 68162306a36Sopenharmony_ci is_dual = (panel & 0x02) != 0; 68262306a36Sopenharmony_ci is_tft = (panel & 0x01) != 0; 68362306a36Sopenharmony_ci lcd_bpp = s1d13xxxfb_width_tab[is_tft][(panel >> 4) & 3]; 68462306a36Sopenharmony_ci 68562306a36Sopenharmony_ci if (lcd_enabled) { 68662306a36Sopenharmony_ci xres = (s1d13xxxfb_readreg(par, S1DREG_LCD_DISP_HWIDTH) + 1) * 8; 68762306a36Sopenharmony_ci yres = (s1d13xxxfb_readreg(par, S1DREG_LCD_DISP_VHEIGHT0) + 68862306a36Sopenharmony_ci ((s1d13xxxfb_readreg(par, S1DREG_LCD_DISP_VHEIGHT1) & 0x03) << 8) + 1); 68962306a36Sopenharmony_ci 69062306a36Sopenharmony_ci offset = (s1d13xxxfb_readreg(par, S1DREG_LCD_MEM_OFF0) + 69162306a36Sopenharmony_ci ((s1d13xxxfb_readreg(par, S1DREG_LCD_MEM_OFF1) & 0x7) << 8)); 69262306a36Sopenharmony_ci } else { /* crt */ 69362306a36Sopenharmony_ci xres = (s1d13xxxfb_readreg(par, S1DREG_CRT_DISP_HWIDTH) + 1) * 8; 69462306a36Sopenharmony_ci yres = (s1d13xxxfb_readreg(par, S1DREG_CRT_DISP_VHEIGHT0) + 69562306a36Sopenharmony_ci ((s1d13xxxfb_readreg(par, S1DREG_CRT_DISP_VHEIGHT1) & 0x03) << 8) + 1); 69662306a36Sopenharmony_ci 69762306a36Sopenharmony_ci offset = (s1d13xxxfb_readreg(par, S1DREG_CRT_MEM_OFF0) + 69862306a36Sopenharmony_ci ((s1d13xxxfb_readreg(par, S1DREG_CRT_MEM_OFF1) & 0x7) << 8)); 69962306a36Sopenharmony_ci } 70062306a36Sopenharmony_ci xres_virtual = offset * 16 / var->bits_per_pixel; 70162306a36Sopenharmony_ci yres_virtual = fix->smem_len / (offset * 2); 70262306a36Sopenharmony_ci 70362306a36Sopenharmony_ci var->xres = xres; 70462306a36Sopenharmony_ci var->yres = yres; 70562306a36Sopenharmony_ci var->xres_virtual = xres_virtual; 70662306a36Sopenharmony_ci var->yres_virtual = yres_virtual; 70762306a36Sopenharmony_ci var->xoffset = var->yoffset = 0; 70862306a36Sopenharmony_ci 70962306a36Sopenharmony_ci fix->line_length = offset * 2; 71062306a36Sopenharmony_ci 71162306a36Sopenharmony_ci var->grayscale = !is_color; 71262306a36Sopenharmony_ci 71362306a36Sopenharmony_ci var->activate = FB_ACTIVATE_NOW; 71462306a36Sopenharmony_ci 71562306a36Sopenharmony_ci dbg(PFX "bpp=%d, lcd_bpp=%d, " 71662306a36Sopenharmony_ci "crt_enabled=%d, lcd_enabled=%d\n", 71762306a36Sopenharmony_ci var->bits_per_pixel, lcd_bpp, crt_enabled, lcd_enabled); 71862306a36Sopenharmony_ci dbg(PFX "xres=%d, yres=%d, vxres=%d, vyres=%d " 71962306a36Sopenharmony_ci "is_color=%d, is_dual=%d, is_tft=%d\n", 72062306a36Sopenharmony_ci xres, yres, xres_virtual, yres_virtual, is_color, is_dual, is_tft); 72162306a36Sopenharmony_ci} 72262306a36Sopenharmony_ci 72362306a36Sopenharmony_cistatic void __s1d13xxxfb_remove(struct platform_device *pdev) 72462306a36Sopenharmony_ci{ 72562306a36Sopenharmony_ci struct fb_info *info = platform_get_drvdata(pdev); 72662306a36Sopenharmony_ci struct s1d13xxxfb_par *par = NULL; 72762306a36Sopenharmony_ci 72862306a36Sopenharmony_ci if (info) { 72962306a36Sopenharmony_ci par = info->par; 73062306a36Sopenharmony_ci if (par && par->regs) { 73162306a36Sopenharmony_ci /* disable output & enable powersave */ 73262306a36Sopenharmony_ci s1d13xxxfb_writereg(par, S1DREG_COM_DISP_MODE, 0x00); 73362306a36Sopenharmony_ci s1d13xxxfb_writereg(par, S1DREG_PS_CNF, 0x11); 73462306a36Sopenharmony_ci iounmap(par->regs); 73562306a36Sopenharmony_ci } 73662306a36Sopenharmony_ci 73762306a36Sopenharmony_ci fb_dealloc_cmap(&info->cmap); 73862306a36Sopenharmony_ci 73962306a36Sopenharmony_ci if (info->screen_base) 74062306a36Sopenharmony_ci iounmap(info->screen_base); 74162306a36Sopenharmony_ci 74262306a36Sopenharmony_ci framebuffer_release(info); 74362306a36Sopenharmony_ci } 74462306a36Sopenharmony_ci 74562306a36Sopenharmony_ci release_mem_region(pdev->resource[0].start, 74662306a36Sopenharmony_ci resource_size(&pdev->resource[0])); 74762306a36Sopenharmony_ci release_mem_region(pdev->resource[1].start, 74862306a36Sopenharmony_ci resource_size(&pdev->resource[1])); 74962306a36Sopenharmony_ci} 75062306a36Sopenharmony_ci 75162306a36Sopenharmony_cistatic void s1d13xxxfb_remove(struct platform_device *pdev) 75262306a36Sopenharmony_ci{ 75362306a36Sopenharmony_ci struct fb_info *info = platform_get_drvdata(pdev); 75462306a36Sopenharmony_ci 75562306a36Sopenharmony_ci unregister_framebuffer(info); 75662306a36Sopenharmony_ci __s1d13xxxfb_remove(pdev); 75762306a36Sopenharmony_ci} 75862306a36Sopenharmony_ci 75962306a36Sopenharmony_cistatic int s1d13xxxfb_probe(struct platform_device *pdev) 76062306a36Sopenharmony_ci{ 76162306a36Sopenharmony_ci struct s1d13xxxfb_par *default_par; 76262306a36Sopenharmony_ci struct fb_info *info; 76362306a36Sopenharmony_ci struct s1d13xxxfb_pdata *pdata = NULL; 76462306a36Sopenharmony_ci int ret = 0; 76562306a36Sopenharmony_ci int i; 76662306a36Sopenharmony_ci u8 revision, prod_id; 76762306a36Sopenharmony_ci 76862306a36Sopenharmony_ci dbg("probe called: device is %p\n", pdev); 76962306a36Sopenharmony_ci 77062306a36Sopenharmony_ci printk(KERN_INFO "Epson S1D13XXX FB Driver\n"); 77162306a36Sopenharmony_ci 77262306a36Sopenharmony_ci /* enable platform-dependent hardware glue, if any */ 77362306a36Sopenharmony_ci if (dev_get_platdata(&pdev->dev)) 77462306a36Sopenharmony_ci pdata = dev_get_platdata(&pdev->dev); 77562306a36Sopenharmony_ci 77662306a36Sopenharmony_ci if (pdata && pdata->platform_init_video) 77762306a36Sopenharmony_ci pdata->platform_init_video(); 77862306a36Sopenharmony_ci 77962306a36Sopenharmony_ci if (pdev->num_resources != 2) { 78062306a36Sopenharmony_ci dev_err(&pdev->dev, "invalid num_resources: %i\n", 78162306a36Sopenharmony_ci pdev->num_resources); 78262306a36Sopenharmony_ci ret = -ENODEV; 78362306a36Sopenharmony_ci goto bail; 78462306a36Sopenharmony_ci } 78562306a36Sopenharmony_ci 78662306a36Sopenharmony_ci /* resource[0] is VRAM, resource[1] is registers */ 78762306a36Sopenharmony_ci if (pdev->resource[0].flags != IORESOURCE_MEM 78862306a36Sopenharmony_ci || pdev->resource[1].flags != IORESOURCE_MEM) { 78962306a36Sopenharmony_ci dev_err(&pdev->dev, "invalid resource type\n"); 79062306a36Sopenharmony_ci ret = -ENODEV; 79162306a36Sopenharmony_ci goto bail; 79262306a36Sopenharmony_ci } 79362306a36Sopenharmony_ci 79462306a36Sopenharmony_ci if (!request_mem_region(pdev->resource[0].start, 79562306a36Sopenharmony_ci resource_size(&pdev->resource[0]), "s1d13xxxfb mem")) { 79662306a36Sopenharmony_ci dev_dbg(&pdev->dev, "request_mem_region failed\n"); 79762306a36Sopenharmony_ci ret = -EBUSY; 79862306a36Sopenharmony_ci goto bail; 79962306a36Sopenharmony_ci } 80062306a36Sopenharmony_ci 80162306a36Sopenharmony_ci if (!request_mem_region(pdev->resource[1].start, 80262306a36Sopenharmony_ci resource_size(&pdev->resource[1]), "s1d13xxxfb regs")) { 80362306a36Sopenharmony_ci dev_dbg(&pdev->dev, "request_mem_region failed\n"); 80462306a36Sopenharmony_ci ret = -EBUSY; 80562306a36Sopenharmony_ci goto bail; 80662306a36Sopenharmony_ci } 80762306a36Sopenharmony_ci 80862306a36Sopenharmony_ci info = framebuffer_alloc(sizeof(struct s1d13xxxfb_par) + sizeof(u32) * 256, &pdev->dev); 80962306a36Sopenharmony_ci if (!info) { 81062306a36Sopenharmony_ci ret = -ENOMEM; 81162306a36Sopenharmony_ci goto bail; 81262306a36Sopenharmony_ci } 81362306a36Sopenharmony_ci 81462306a36Sopenharmony_ci platform_set_drvdata(pdev, info); 81562306a36Sopenharmony_ci default_par = info->par; 81662306a36Sopenharmony_ci default_par->regs = ioremap(pdev->resource[1].start, 81762306a36Sopenharmony_ci resource_size(&pdev->resource[1])); 81862306a36Sopenharmony_ci if (!default_par->regs) { 81962306a36Sopenharmony_ci printk(KERN_ERR PFX "unable to map registers\n"); 82062306a36Sopenharmony_ci ret = -ENOMEM; 82162306a36Sopenharmony_ci goto bail; 82262306a36Sopenharmony_ci } 82362306a36Sopenharmony_ci info->pseudo_palette = default_par->pseudo_palette; 82462306a36Sopenharmony_ci 82562306a36Sopenharmony_ci info->screen_base = ioremap(pdev->resource[0].start, 82662306a36Sopenharmony_ci resource_size(&pdev->resource[0])); 82762306a36Sopenharmony_ci 82862306a36Sopenharmony_ci if (!info->screen_base) { 82962306a36Sopenharmony_ci printk(KERN_ERR PFX "unable to map framebuffer\n"); 83062306a36Sopenharmony_ci ret = -ENOMEM; 83162306a36Sopenharmony_ci goto bail; 83262306a36Sopenharmony_ci } 83362306a36Sopenharmony_ci 83462306a36Sopenharmony_ci /* production id is top 6 bits */ 83562306a36Sopenharmony_ci prod_id = s1d13xxxfb_readreg(default_par, S1DREG_REV_CODE) >> 2; 83662306a36Sopenharmony_ci /* revision id is lower 2 bits */ 83762306a36Sopenharmony_ci revision = s1d13xxxfb_readreg(default_par, S1DREG_REV_CODE) & 0x3; 83862306a36Sopenharmony_ci ret = -ENODEV; 83962306a36Sopenharmony_ci 84062306a36Sopenharmony_ci for (i = 0; i < ARRAY_SIZE(s1d13xxxfb_prod_ids); i++) { 84162306a36Sopenharmony_ci if (prod_id == s1d13xxxfb_prod_ids[i]) { 84262306a36Sopenharmony_ci /* looks like we got it in our list */ 84362306a36Sopenharmony_ci default_par->prod_id = prod_id; 84462306a36Sopenharmony_ci default_par->revision = revision; 84562306a36Sopenharmony_ci ret = 0; 84662306a36Sopenharmony_ci break; 84762306a36Sopenharmony_ci } 84862306a36Sopenharmony_ci } 84962306a36Sopenharmony_ci 85062306a36Sopenharmony_ci if (!ret) { 85162306a36Sopenharmony_ci printk(KERN_INFO PFX "chip production id %i = %s\n", 85262306a36Sopenharmony_ci prod_id, s1d13xxxfb_prod_names[i]); 85362306a36Sopenharmony_ci printk(KERN_INFO PFX "chip revision %i\n", revision); 85462306a36Sopenharmony_ci } else { 85562306a36Sopenharmony_ci printk(KERN_INFO PFX 85662306a36Sopenharmony_ci "unknown chip production id %i, revision %i\n", 85762306a36Sopenharmony_ci prod_id, revision); 85862306a36Sopenharmony_ci printk(KERN_INFO PFX "please contact maintainer\n"); 85962306a36Sopenharmony_ci goto bail; 86062306a36Sopenharmony_ci } 86162306a36Sopenharmony_ci 86262306a36Sopenharmony_ci info->fix = s1d13xxxfb_fix; 86362306a36Sopenharmony_ci info->fix.mmio_start = pdev->resource[1].start; 86462306a36Sopenharmony_ci info->fix.mmio_len = resource_size(&pdev->resource[1]); 86562306a36Sopenharmony_ci info->fix.smem_start = pdev->resource[0].start; 86662306a36Sopenharmony_ci info->fix.smem_len = resource_size(&pdev->resource[0]); 86762306a36Sopenharmony_ci 86862306a36Sopenharmony_ci printk(KERN_INFO PFX "regs mapped at 0x%p, fb %d KiB mapped at 0x%p\n", 86962306a36Sopenharmony_ci default_par->regs, info->fix.smem_len / 1024, info->screen_base); 87062306a36Sopenharmony_ci 87162306a36Sopenharmony_ci info->par = default_par; 87262306a36Sopenharmony_ci info->flags = FBINFO_HWACCEL_YPAN; 87362306a36Sopenharmony_ci info->fbops = &s1d13xxxfb_fbops; 87462306a36Sopenharmony_ci 87562306a36Sopenharmony_ci switch(prod_id) { 87662306a36Sopenharmony_ci case S1D13506_PROD_ID: /* activate acceleration */ 87762306a36Sopenharmony_ci s1d13xxxfb_fbops.fb_fillrect = s1d13xxxfb_bitblt_solidfill; 87862306a36Sopenharmony_ci s1d13xxxfb_fbops.fb_copyarea = s1d13xxxfb_bitblt_copyarea; 87962306a36Sopenharmony_ci info->flags = FBINFO_HWACCEL_YPAN | 88062306a36Sopenharmony_ci FBINFO_HWACCEL_FILLRECT | FBINFO_HWACCEL_COPYAREA; 88162306a36Sopenharmony_ci break; 88262306a36Sopenharmony_ci default: 88362306a36Sopenharmony_ci break; 88462306a36Sopenharmony_ci } 88562306a36Sopenharmony_ci 88662306a36Sopenharmony_ci /* perform "manual" chip initialization, if needed */ 88762306a36Sopenharmony_ci if (pdata && pdata->initregs) 88862306a36Sopenharmony_ci s1d13xxxfb_runinit(info->par, pdata->initregs, pdata->initregssize); 88962306a36Sopenharmony_ci 89062306a36Sopenharmony_ci s1d13xxxfb_fetch_hw_state(info); 89162306a36Sopenharmony_ci 89262306a36Sopenharmony_ci if (register_framebuffer(info) < 0) { 89362306a36Sopenharmony_ci ret = -EINVAL; 89462306a36Sopenharmony_ci goto bail; 89562306a36Sopenharmony_ci } 89662306a36Sopenharmony_ci 89762306a36Sopenharmony_ci fb_info(info, "%s frame buffer device\n", info->fix.id); 89862306a36Sopenharmony_ci 89962306a36Sopenharmony_ci return 0; 90062306a36Sopenharmony_ci 90162306a36Sopenharmony_cibail: 90262306a36Sopenharmony_ci __s1d13xxxfb_remove(pdev); 90362306a36Sopenharmony_ci return ret; 90462306a36Sopenharmony_ci 90562306a36Sopenharmony_ci} 90662306a36Sopenharmony_ci 90762306a36Sopenharmony_ci#ifdef CONFIG_PM 90862306a36Sopenharmony_cistatic int s1d13xxxfb_suspend(struct platform_device *dev, pm_message_t state) 90962306a36Sopenharmony_ci{ 91062306a36Sopenharmony_ci struct fb_info *info = platform_get_drvdata(dev); 91162306a36Sopenharmony_ci struct s1d13xxxfb_par *s1dfb = info->par; 91262306a36Sopenharmony_ci struct s1d13xxxfb_pdata *pdata = NULL; 91362306a36Sopenharmony_ci 91462306a36Sopenharmony_ci /* disable display */ 91562306a36Sopenharmony_ci lcd_enable(s1dfb, 0); 91662306a36Sopenharmony_ci crt_enable(s1dfb, 0); 91762306a36Sopenharmony_ci 91862306a36Sopenharmony_ci if (dev_get_platdata(&dev->dev)) 91962306a36Sopenharmony_ci pdata = dev_get_platdata(&dev->dev); 92062306a36Sopenharmony_ci 92162306a36Sopenharmony_ci#if 0 92262306a36Sopenharmony_ci if (!s1dfb->disp_save) 92362306a36Sopenharmony_ci s1dfb->disp_save = kmalloc(info->fix.smem_len, GFP_KERNEL); 92462306a36Sopenharmony_ci 92562306a36Sopenharmony_ci if (!s1dfb->disp_save) { 92662306a36Sopenharmony_ci printk(KERN_ERR PFX "no memory to save screen\n"); 92762306a36Sopenharmony_ci return -ENOMEM; 92862306a36Sopenharmony_ci } 92962306a36Sopenharmony_ci 93062306a36Sopenharmony_ci memcpy_fromio(s1dfb->disp_save, info->screen_base, info->fix.smem_len); 93162306a36Sopenharmony_ci#else 93262306a36Sopenharmony_ci s1dfb->disp_save = NULL; 93362306a36Sopenharmony_ci#endif 93462306a36Sopenharmony_ci 93562306a36Sopenharmony_ci if (!s1dfb->regs_save) 93662306a36Sopenharmony_ci s1dfb->regs_save = kmalloc(info->fix.mmio_len, GFP_KERNEL); 93762306a36Sopenharmony_ci 93862306a36Sopenharmony_ci if (!s1dfb->regs_save) { 93962306a36Sopenharmony_ci printk(KERN_ERR PFX "no memory to save registers"); 94062306a36Sopenharmony_ci return -ENOMEM; 94162306a36Sopenharmony_ci } 94262306a36Sopenharmony_ci 94362306a36Sopenharmony_ci /* backup all registers */ 94462306a36Sopenharmony_ci memcpy_fromio(s1dfb->regs_save, s1dfb->regs, info->fix.mmio_len); 94562306a36Sopenharmony_ci 94662306a36Sopenharmony_ci /* now activate power save mode */ 94762306a36Sopenharmony_ci s1d13xxxfb_writereg(s1dfb, S1DREG_PS_CNF, 0x11); 94862306a36Sopenharmony_ci 94962306a36Sopenharmony_ci if (pdata && pdata->platform_suspend_video) 95062306a36Sopenharmony_ci return pdata->platform_suspend_video(); 95162306a36Sopenharmony_ci else 95262306a36Sopenharmony_ci return 0; 95362306a36Sopenharmony_ci} 95462306a36Sopenharmony_ci 95562306a36Sopenharmony_cistatic int s1d13xxxfb_resume(struct platform_device *dev) 95662306a36Sopenharmony_ci{ 95762306a36Sopenharmony_ci struct fb_info *info = platform_get_drvdata(dev); 95862306a36Sopenharmony_ci struct s1d13xxxfb_par *s1dfb = info->par; 95962306a36Sopenharmony_ci struct s1d13xxxfb_pdata *pdata = NULL; 96062306a36Sopenharmony_ci 96162306a36Sopenharmony_ci /* awaken the chip */ 96262306a36Sopenharmony_ci s1d13xxxfb_writereg(s1dfb, S1DREG_PS_CNF, 0x10); 96362306a36Sopenharmony_ci 96462306a36Sopenharmony_ci /* do not let go until SDRAM "wakes up" */ 96562306a36Sopenharmony_ci while ((s1d13xxxfb_readreg(s1dfb, S1DREG_PS_STATUS) & 0x01)) 96662306a36Sopenharmony_ci udelay(10); 96762306a36Sopenharmony_ci 96862306a36Sopenharmony_ci if (dev_get_platdata(&dev->dev)) 96962306a36Sopenharmony_ci pdata = dev_get_platdata(&dev->dev); 97062306a36Sopenharmony_ci 97162306a36Sopenharmony_ci if (s1dfb->regs_save) { 97262306a36Sopenharmony_ci /* will write RO regs, *should* get away with it :) */ 97362306a36Sopenharmony_ci memcpy_toio(s1dfb->regs, s1dfb->regs_save, info->fix.mmio_len); 97462306a36Sopenharmony_ci kfree(s1dfb->regs_save); 97562306a36Sopenharmony_ci } 97662306a36Sopenharmony_ci 97762306a36Sopenharmony_ci if (s1dfb->disp_save) { 97862306a36Sopenharmony_ci memcpy_toio(info->screen_base, s1dfb->disp_save, 97962306a36Sopenharmony_ci info->fix.smem_len); 98062306a36Sopenharmony_ci kfree(s1dfb->disp_save); /* XXX kmalloc()'d when? */ 98162306a36Sopenharmony_ci } 98262306a36Sopenharmony_ci 98362306a36Sopenharmony_ci if ((s1dfb->display & 0x01) != 0) 98462306a36Sopenharmony_ci lcd_enable(s1dfb, 1); 98562306a36Sopenharmony_ci if ((s1dfb->display & 0x02) != 0) 98662306a36Sopenharmony_ci crt_enable(s1dfb, 1); 98762306a36Sopenharmony_ci 98862306a36Sopenharmony_ci if (pdata && pdata->platform_resume_video) 98962306a36Sopenharmony_ci return pdata->platform_resume_video(); 99062306a36Sopenharmony_ci else 99162306a36Sopenharmony_ci return 0; 99262306a36Sopenharmony_ci} 99362306a36Sopenharmony_ci#endif /* CONFIG_PM */ 99462306a36Sopenharmony_ci 99562306a36Sopenharmony_cistatic struct platform_driver s1d13xxxfb_driver = { 99662306a36Sopenharmony_ci .probe = s1d13xxxfb_probe, 99762306a36Sopenharmony_ci .remove_new = s1d13xxxfb_remove, 99862306a36Sopenharmony_ci#ifdef CONFIG_PM 99962306a36Sopenharmony_ci .suspend = s1d13xxxfb_suspend, 100062306a36Sopenharmony_ci .resume = s1d13xxxfb_resume, 100162306a36Sopenharmony_ci#endif 100262306a36Sopenharmony_ci .driver = { 100362306a36Sopenharmony_ci .name = S1D_DEVICENAME, 100462306a36Sopenharmony_ci }, 100562306a36Sopenharmony_ci}; 100662306a36Sopenharmony_ci 100762306a36Sopenharmony_ci 100862306a36Sopenharmony_cistatic int __init 100962306a36Sopenharmony_cis1d13xxxfb_init(void) 101062306a36Sopenharmony_ci{ 101162306a36Sopenharmony_ci 101262306a36Sopenharmony_ci#ifndef MODULE 101362306a36Sopenharmony_ci if (fb_get_options("s1d13xxxfb", NULL)) 101462306a36Sopenharmony_ci return -ENODEV; 101562306a36Sopenharmony_ci#endif 101662306a36Sopenharmony_ci 101762306a36Sopenharmony_ci return platform_driver_register(&s1d13xxxfb_driver); 101862306a36Sopenharmony_ci} 101962306a36Sopenharmony_ci 102062306a36Sopenharmony_ci 102162306a36Sopenharmony_cistatic void __exit 102262306a36Sopenharmony_cis1d13xxxfb_exit(void) 102362306a36Sopenharmony_ci{ 102462306a36Sopenharmony_ci platform_driver_unregister(&s1d13xxxfb_driver); 102562306a36Sopenharmony_ci} 102662306a36Sopenharmony_ci 102762306a36Sopenharmony_cimodule_init(s1d13xxxfb_init); 102862306a36Sopenharmony_cimodule_exit(s1d13xxxfb_exit); 102962306a36Sopenharmony_ci 103062306a36Sopenharmony_ci 103162306a36Sopenharmony_ciMODULE_LICENSE("GPL"); 103262306a36Sopenharmony_ciMODULE_DESCRIPTION("Framebuffer driver for S1D13xxx devices"); 103362306a36Sopenharmony_ciMODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>, Thibaut VARENE <varenet@parisc-linux.org>"); 1034