From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christopher Hoover Subject: Re: [PATCH 2.5.68] Epson 1355 Rewrite for 2.5 Date: Tue, 13 May 2003 18:31:39 -0700 Sender: linux-fbdev-devel-admin@lists.sourceforge.net Message-ID: <20030513183135.A31196@heavens.murgatroid.com> References: Mime-Version: 1.0 Return-path: Received: from 12-234-34-139.client.attbi.com ([12.234.34.139] helo=heavens.murgatroid.com) by sc8-sf-list1.sourceforge.net with esmtp (Exim 3.31-VA-mm2 #1 (Debian)) id 19Fl7S-0004au-00 for ; Tue, 13 May 2003 18:31:46 -0700 Content-Disposition: inline In-Reply-To: ; from jsimmons@infradead.org on Tue, May 13, 2003 at 11:32:39PM +0100 Errors-To: linux-fbdev-devel-admin@lists.sourceforge.net List-Help: List-Post: List-Subscribe: , List-Id: List-Unsubscribe: , List-Archive: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: James Simmons Cc: Geert Uytterhoeven , Linux Frame Buffer Device Development On Tue, May 13, 2003 at 11:32:39PM +0100, James Simmons wrote: > Chris coudl you send me what you have tho. Just merge in your version of > the cfb* functions into your driver for now. > Currently I'm trying to push a bunch to Linus. So I like to push your > driver. Sure. Here it is. Diff'ed off of 2.5.68-rmk1 but I checked that it applies cleanly to 2.5.68. -ch mailto:ch(at)murgatroid.com mailto:ch(at)hpl.hp.com --- linux-2.5.68-rmk1/MAINTAINERS 2003-04-19 19:50:01.000000000 -0700 +++ linux-2.5.68-rmk1-ceiva1/MAINTAINERS 2003-05-13 18:07:06.000000000 -0700 @@ -644,6 +644,11 @@ L: emu10k1-devel@lists.sourceforge.net W: http://sourceforge.net/projects/emu10k1/ S: Maintained +EPSON 1355 FRAMEBUFFER DRIVER +P: Christopher Hoover +M: ch@murgatroid.com, ch@hpl.hp.com +S: Maintained + ETHEREXPRESS-16 NETWORK DRIVER P: Philip Blundell M: Philip.Blundell@pobox.com diff -X dontdiff.txt -Naurp linux-2.5.68-rmk1/include/video/epson1355.h linux-2.5.68-rmk1-ceiva1/include/video/epson1355.h --- linux-2.5.68-rmk1/include/video/epson1355.h 1969-12-31 16:00:00.000000000 -0800 +++ linux-2.5.68-rmk1-ceiva1/include/video/epson1355.h 2003-05-13 18:19:14.000000000 -0700 @@ -0,0 +1,72 @@ +/* + * include/video/epson1355.h + * + * Epson Research S1D13505 Embedded RAMDAC LCD/CRT Controller + * (previously known as SED1355) + * + * Cf. http://www.erd.epson.com/vdc/html/S1D13505.html + * + * Copyright (C) Hewlett-Packard Company. All rights reserved. + * + * Written by Christopher Hoover + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file COPYING in the main directory of this archive for + * more details. + */ + +#ifndef _EPSON1355_H_ +#define _EPSON1355_H_ + +#define REG_REVISION_CODE 0x00 +#define REG_MEMORY_CONFIG 0x01 +#define REG_PANEL_TYPE 0x02 +#define REG_MOD_RATE 0x03 +#define REG_HORZ_DISP_WIDTH 0x04 +#define REG_HORZ_NONDISP_PERIOD 0x05 +#define REG_HRTC_START_POSITION 0x06 +#define REG_HRTC_PULSE_WIDTH 0x07 +#define REG_VERT_DISP_HEIGHT0 0x08 +#define REG_VERT_DISP_HEIGHT1 0x09 +#define REG_VERT_NONDISP_PERIOD 0x0A +#define REG_VRTC_START_POSITION 0x0B +#define REG_VRTC_PULSE_WIDTH 0x0C +#define REG_DISPLAY_MODE 0x0D +#define REG_SCRN1_LINE_COMPARE0 0x0E +#define REG_SCRN1_LINE_COMPARE1 0x0F +#define REG_SCRN1_DISP_START_ADDR0 0x10 +#define REG_SCRN1_DISP_START_ADDR1 0x11 +#define REG_SCRN1_DISP_START_ADDR2 0x12 +#define REG_SCRN2_DISP_START_ADDR0 0x13 +#define REG_SCRN2_DISP_START_ADDR1 0x14 +#define REG_SCRN2_DISP_START_ADDR2 0x15 +#define REG_MEM_ADDR_OFFSET0 0x16 +#define REG_MEM_ADDR_OFFSET1 0x17 +#define REG_PIXEL_PANNING 0x18 +#define REG_CLOCK_CONFIG 0x19 +#define REG_POWER_SAVE_CONFIG 0x1A +#define REG_MISC 0x1B +#define REG_MD_CONFIG_READBACK0 0x1C +#define REG_MD_CONFIG_READBACK1 0x1D +#define REG_GPIO_CONFIG0 0x1E +#define REG_GPIO_CONFIG1 0x1F +#define REG_GPIO_CONTROL0 0x20 +#define REG_GPIO_CONTROL1 0x21 +#define REG_PERF_ENHANCEMENT0 0x22 +#define REG_PERF_ENHANCEMENT1 0x23 +#define REG_LUT_ADDR 0x24 +#define REG_RESERVED_1 0x25 +#define REG_LUT_DATA 0x26 +#define REG_INK_CURSOR_CONTROL 0x27 +#define REG_CURSOR_X_POSITION0 0x28 +#define REG_CURSOR_X_POSITION1 0x29 +#define REG_CURSOR_Y_POSITION0 0x2A +#define REG_CURSOR_Y_POSITION1 0x2B +#define REG_INK_CURSOR_COLOR0_0 0x2C +#define REG_INK_CURSOR_COLOR0_1 0x2D +#define REG_INK_CURSOR_COLOR1_0 0x2E +#define REG_INK_CURSOR_COLOR1_1 0x2F +#define REG_INK_CURSOR_START_ADDR 0x30 +#define REG_ALTERNATE_FRM 0x31 + +#endif diff -X dontdiff.txt -Naurp linux-2.5.68-rmk1/drivers/video/Kconfig linux-2.5.68-rmk1-ceiva1/drivers/video/Kconfig --- linux-2.5.68-rmk1/drivers/video/Kconfig 2003-04-19 19:48:49.000000000 -0700 +++ linux-2.5.68-rmk1-ceiva1/drivers/video/Kconfig 2003-05-13 18:15:28.000000000 -0700 @@ -423,34 +423,14 @@ config FB_PVR2_DEBUG messages. Most people will want to say N here. If unsure, you will also want to say N. -config FB_E1355 +config FB_EPSON1355 bool "Epson 1355 framebuffer support" - depends on FB && SUPERH + depends on FB help - Build in support for the SED1355 Epson Research Embedded RAMDAC - LCD/CRT Controller (since redesignated as the S1D13505) as a - framebuffer. Product specs at - . - -config E1355_REG_BASE - hex "Register Base Address" - depends on FB_E1355 - default "a8000000" - help - Epson SED1355/S1D13505 LCD/CRT controller register base address. - See the manuals at - for - discussion. - -config E1355_FB_BASE - hex "Framebuffer Base Address" - depends on FB_E1355 - default "a8200000" - help - Epson SED1355/S1D13505 LCD/CRT controller memory base address. See - the manuals at - for - discussion. + This drivers supports the Epson Research S1D13505 Embedded RAMDAC + LCD/CRT Controller (previously known as SED1355). Say Y if + you have such a chip. + config FB_RIVA tristate "nVidia Riva support" diff -X dontdiff.txt -Naurp linux-2.5.68-rmk1/drivers/video/Makefile linux-2.5.68-rmk1-ceiva1/drivers/video/Makefile --- linux-2.5.68-rmk1/drivers/video/Makefile 2003-04-19 19:48:51.000000000 -0700 +++ linux-2.5.68-rmk1-ceiva1/drivers/video/Makefile 2003-04-30 16:34:55.000000000 -0700 @@ -68,7 +68,7 @@ obj-$(CONFIG_FB_HGA) += hga obj-$(CONFIG_FB_SA1100) += sa1100fb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o obj-$(CONFIG_FB_VIRTUAL) += vfb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o obj-$(CONFIG_FB_HIT) += hitfb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o -obj-$(CONFIG_FB_E1355) += epson1355fb.o +obj-$(CONFIG_FB_EPSON1355) += epson1355fb.o obj-$(CONFIG_FB_PVR2) += pvr2fb.o obj-$(CONFIG_FB_VOODOO1) += sstfb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o diff -X dontdiff.txt -Naurp linux-2.5.68-rmk1/drivers/video/cfbcopyarea.c linux-2.5.68-rmk1-ceiva1/drivers/video/cfbcopyarea.c --- linux-2.5.68-rmk1/drivers/video/cfbcopyarea.c 2003-04-19 19:50:46.000000000 -0700 +++ linux-2.5.68-rmk1-ceiva1/drivers/video/cfbcopyarea.c 2003-05-13 18:04:44.000000000 -0700 @@ -29,16 +29,30 @@ #include #include +/* this file may be included in your source file, with your own + * fb_{read,write}{l,q} routines, if you define CFB_SOURCE_INCLUDE, + * CFB_COPYAREA_FN, and _FB_{READ|WRITE}{Q|L} */ +#ifndef CFB_SOURCE_INCLUDE +# define CFB_COPYAREA_FN cfb_copyarea +# define CFB_COPYAREA_DECL +# define _FB_WRITEL fb_writel +# define _FB_READL fb_readl +# define _FB_WRITEQ fb_writeq +# define _FB_READQ fb_readq +#else +# define CFB_COPYAREA_DECL static +#endif + #define LONG_MASK (BITS_PER_LONG - 1) #if BITS_PER_LONG == 32 -#define FB_WRITEL fb_writel -#define FB_READL fb_readl +#define FB_WRITEL _FB_WRITEL +#define FB_READL _FB_READL #define SHIFT_PER_LONG 5 #define BYTES_PER_LONG 4 #else -#define FB_WRITEL fb_writeq -#define FB_READL fb_readq +#define FB_WRITEL _FB_WRITEQ +#define FB_READL _FB_READQ #define SHIFT_PER_LONG 6 #define BYTES_PER_LONG 8 #endif @@ -337,7 +351,8 @@ static void bitcpy_rev(unsigned long *ds } } -void cfb_copyarea(struct fb_info *p, const struct fb_copyarea *area) +CFB_COPYAREA_DECL +void CFB_COPYAREA_FN(struct fb_info *p, const struct fb_copyarea *area) { u32 dx = area->dx, dy = area->dy, sx = area->sx, sy = area->sy; u32 height = area->height, width = area->width; @@ -424,9 +439,10 @@ void cfb_copyarea(struct fb_info *p, con } } +#ifndef CFB_SOURCE_INCLUDE EXPORT_SYMBOL(cfb_copyarea); MODULE_AUTHOR("James Simmons "); MODULE_DESCRIPTION("Generic software accelerated copyarea"); MODULE_LICENSE("GPL"); - +#endif diff -X dontdiff.txt -Naurp linux-2.5.68-rmk1/drivers/video/cfbfillrect.c linux-2.5.68-rmk1-ceiva1/drivers/video/cfbfillrect.c --- linux-2.5.68-rmk1/drivers/video/cfbfillrect.c 2003-04-19 19:49:54.000000000 -0700 +++ linux-2.5.68-rmk1-ceiva1/drivers/video/cfbfillrect.c 2003-05-13 18:04:02.000000000 -0700 @@ -23,14 +23,28 @@ #include #include +/* this file may be included in your source file, with your own + * fb_{read,write}{l,q} routines, if you define CFB_SOURCE_INCLUDE, + * CFB_FILLRECT_FN, and _FB_{READ|WRITE}{Q|L} */ +#ifndef CFB_SOURCE_INCLUDE +# define CFB_FILLRECT_FN cfb_fillrect +# define CFB_FILLRECT_DECL +# define _FB_WRITEL fb_writel +# define _FB_READL fb_readl +# define _FB_WRITEQ fb_writeq +# define _FB_READQ fb_readq +#else +# define CFB_FILLRECT_DECL static +#endif + #if BITS_PER_LONG == 32 -#define FB_WRITEL fb_writel -#define FB_READL fb_readl +#define FB_WRITEL _FB_WRITEL +#define FB_READL _FB_READL #define BYTES_PER_LONG 4 #define SHIFT_PER_LONG 5 #else -#define FB_WRITEL fb_writeq -#define FB_READL fb_readq +#define FB_WRITEL _FB_WRITEQ +#define FB_READL _FB_READQ #define BYTES_PER_LONG 8 #define SHIFT_PER_LONG 6 #endif @@ -119,7 +133,7 @@ static inline unsigned long pixel_to_pat * Unaligned 32-bit pattern fill using 32/64-bit memory accesses */ -void bitfill32(unsigned long *dst, int dst_idx, u32 pat, u32 n) +static void bitfill32(unsigned long *dst, int dst_idx, u32 pat, u32 n) { unsigned long val = pat; unsigned long first, last; @@ -178,7 +192,7 @@ void bitfill32(unsigned long *dst, int d * used for the next 32/64-bit word */ -void bitfill(unsigned long *dst, int dst_idx, unsigned long pat, int left, +static void bitfill(unsigned long *dst, int dst_idx, unsigned long pat, int left, int right, u32 n) { unsigned long first, last; @@ -228,7 +242,7 @@ void bitfill(unsigned long *dst, int dst } } -void bitfill32_rev(unsigned long *dst, int dst_idx, u32 pat, u32 n) +static void bitfill32_rev(unsigned long *dst, int dst_idx, u32 pat, u32 n) { unsigned long val = pat, dat; unsigned long first, last; @@ -300,7 +314,7 @@ void bitfill32_rev(unsigned long *dst, i * used for the next 32/64-bit word */ -void bitfill_rev(unsigned long *dst, int dst_idx, unsigned long pat, int left, +static void bitfill_rev(unsigned long *dst, int dst_idx, unsigned long pat, int left, int right, u32 n) { unsigned long first, last, dat; @@ -359,7 +373,8 @@ void bitfill_rev(unsigned long *dst, int } } -void cfb_fillrect(struct fb_info *p, const struct fb_fillrect *rect) +CFB_FILLRECT_DECL +void CFB_FILLRECT_FN(struct fb_info *p, const struct fb_fillrect *rect) { u32 bpp = p->var.bits_per_pixel; unsigned long x2, y2, vxres, vyres; @@ -451,8 +466,10 @@ void cfb_fillrect(struct fb_info *p, con } } +#ifndef CFB_SOURCE_INCLUDE EXPORT_SYMBOL(cfb_fillrect); MODULE_AUTHOR("James Simmons "); MODULE_DESCRIPTION("Generic software accelerated fill rectangle"); MODULE_LICENSE("GPL"); +#endif diff -X dontdiff.txt -Naurp linux-2.5.68-rmk1/drivers/video/cfbimgblt.c linux-2.5.68-rmk1-ceiva1/drivers/video/cfbimgblt.c --- linux-2.5.68-rmk1/drivers/video/cfbimgblt.c 2003-04-19 19:49:54.000000000 -0700 +++ linux-2.5.68-rmk1-ceiva1/drivers/video/cfbimgblt.c 2003-05-13 18:04:10.000000000 -0700 @@ -35,6 +35,20 @@ #include #include +/* this file may be included in your source file, with your own + * fb_{read,write}{l,q} routines, if you define CFB_SOURCE_INCLUDE, + * CFB_IMAGEBLIT_FN, and _FB_{READ|WRITE}{Q|L} */ +#ifndef CFB_SOURCE_INCLUDE +# define CFB_IMAGEBLIT_FN cfb_imageblit +# define CFB_IMAGEBLIT_DECL +# define _FB_WRITEL fb_writel +# define _FB_READL fb_readl +# define _FB_WRITEQ fb_writeq +# define _FB_READQ fb_readq +#else +# define CFB_IMAGEBLIT_DECL static +#endif + #define DEBUG #ifdef DEBUG @@ -84,13 +98,13 @@ static u32 cfb_tab32[] = { #endif #if BITS_PER_LONG == 32 -#define FB_WRITEL fb_writel -#define FB_READL fb_readl +#define FB_WRITEL _FB_WRITEL +#define FB_READL _FB_READL #define INIT_FASTPATH {} -#define FASTPATH fb_writel((end_mask & eorx)^bgx, dst++) +#define FASTPATH _FB_WRITEL((end_mask & eorx)^bgx, dst++) #else -#define FB_WRITEL fb_writeq -#define FB_READL fb_readq +#define FB_WRITEL _FB_WRITEQ +#define FB_READL _FB_READQ #define INIT_FASTPATH unsigned long val = 0, bpl = 0 #define FASTPATH { \ val |= SHIFT_HIGH((end_mask & eorx)^bgx, bpl); \ @@ -290,7 +304,9 @@ static inline void fast_imageblit(const } } -void cfb_imageblit(struct fb_info *p, const struct fb_image *image) + +CFB_IMAGEBLIT_DECL +void CFB_IMAGEBLIT_FN(struct fb_info *p, const struct fb_image *image) { unsigned long fgcolor, bgcolor, start_index, bitstart, pitch_index = 0; unsigned long bpl = sizeof(unsigned long), bpp = p->var.bits_per_pixel; @@ -350,9 +366,10 @@ void cfb_imageblit(struct fb_info *p, co color_imageblit(image, p, dst1, start_index, pitch_index); } +#ifndef CFB_SOURCE_INCLUDE EXPORT_SYMBOL(cfb_imageblit); MODULE_AUTHOR("James Simmons "); MODULE_DESCRIPTION("Generic software accelerated imaging drawing"); MODULE_LICENSE("GPL"); - +#endif diff -X dontdiff.txt -Naurp linux-2.5.68-rmk1/drivers/video/epson1355fb.c linux-2.5.68-rmk1-ceiva1/drivers/video/epson1355fb.c --- linux-2.5.68-rmk1/drivers/video/epson1355fb.c 2003-04-19 19:48:50.000000000 -0700 +++ linux-2.5.68-rmk1-ceiva1/drivers/video/epson1355fb.c 2003-05-13 18:19:24.000000000 -0700 @@ -1,542 +1,726 @@ /* - * linux/drivers/video/epson1355fb.c - * -- Support for the Epson SED1355 LCD/CRT controller + * linux/drivers/video/epson1355fb.c -- Epson S1D13505 frame buffer for 2.5. * - * Copyright (C) 2000 Philipp Rumpf + * Epson Research S1D13505 Embedded RAMDAC LCD/CRT Controller + * (previously known as SED1355) * - * based on linux/drivers/video/skeletonfb.c, which was + * Cf. http://www.erd.epson.com/vdc/html/S1D13505.html + * + * + * Copyright (C) Hewlett-Packard Company. All rights reserved. + * + * Written by Christopher Hoover + * + * Adapted from: + * + * linux/drivers/video/skeletonfb.c + * Modified to new api Jan 2001 by James Simmons (jsimmons@transvirtual.com) * Created 28 Dec 1997 by Geert Uytterhoeven * + * linux/drivers/video/epson1355fb.c (2.4 driver) + * Copyright (C) 2000 Philipp Rumpf + * * This file is subject to the terms and conditions of the GNU General Public - * License. See the file COPYING in the main directory of this archive - * for more details. - */ -/* TODO (roughly in order of priority): - * 16 bpp support - * crt support - * hw cursor support - * SwivelView + * License. See the file COPYING in the main directory of this archive for + * more details. + * + * + * Noteworthy Issues + * ----------------- + * + * This driver is complicated by the fact that this is a 16-bit chip + * and, on at least one platform (ceiva), we can only do 16-bit reads + * and writes to the framebuffer. We hide this from user space + * except in the case of mmap(). + * + * + * To Do + * ----- + * + * - Test 8-bit pseudocolor mode + * - Allow setting bpp, virtual resolution + * - Implement horizontal panning + * - (maybe) Implement hardware cursor */ -#include -#include -#include -#include -#include -#include -#include -#include -#include #include -#include +#include +#include #include +#include #include -#include