[parisc-linux-cvs] stifb updates
Helge Deller
deller@gmx.de
Fri, 18 May 2001 23:50:53 +0200
some more functions for stifb and a small fix:
Index: stifb.c
===================================================================
RCS file: /home/cvs/parisc/linux/drivers/video/sti/stifb.c,v
retrieving revision 1.9
diff -u -r1.9 stifb.c
--- stifb.c 2001/05/16 17:38:53 1.9
+++ stifb.c 2001/05/18 21:41:23
@@ -108,22 +108,29 @@
#define REG_12 0x01800c
#define REG_13 0x018018
#define REG_14 0x01801c
-#define REG_15 0x200000
+#define REG_15b0 0x200000
#define REG_16b1 0x200005
#define REG_21 0x200218
+#define REG_22 0x0005a0
+#define REG_23 0x0005c0
#define REG_26 0x200118
#define REG_27 0x200308
-
+#define REG_32 0x21003c
+#define REG_33 0x210040
+
#define READ_BYTE(base) gsc_readb(base)
#define READ_WORD(base) gsc_readl(base)
#define WRITE_BYTE(value,base) gsc_writeb(value,base)
#define WRITE_WORD(value,base) gsc_writel(value,base)
+#define ENABLE 1 /* for enabling/disabling screen */
+#define DISABLE 0
+
static void
SETUP_HW(struct stifb_info *fb_info)
{
char stat;
- unsigned long reg15 = fb_info->iobase + REG_15;
+ unsigned long reg15 = fb_info->iobase + REG_15b0;
do {
stat = READ_BYTE(reg15);
if (!stat)
@@ -133,9 +140,10 @@
static void
-SETUP_FB(struct stifb_info *fb_info, int depth)
+SETUP_FB(struct stifb_info *fb_info)
{
unsigned int reg10_value = 0;
+ int depth = fb_info->bpp;
SETUP_HW(fb_info);
switch (fb_info->id)
@@ -147,13 +155,13 @@
case S9000_ID_A1439A:
if (depth == 24)
reg10_value = 0xBBA0A000;
- else /* depth = 8 */
+ else
reg10_value = 0x13601000;
break;
case S9000_ID_HCRX:
if (depth == 24)
reg10_value = 0xBBA0A000;
- else /* depth = 8 */
+ else
reg10_value = 0x13602000;
break;
case S9000_ID_TIMBER:
@@ -169,15 +177,6 @@
}
static void
-SETUP_RAMDAC(struct stifb_info *fb_info)
-{
- unsigned long AuxControlSpace = fb_info->iobase + 0x1000;
- SETUP_HW(fb_info);
- WRITE_WORD(0x0400000, AuxControlSpace + (0x20>>2));
- WRITE_WORD(0xff000000, AuxControlSpace + (0x28>>2));
-}
-
-static void
START_IMAGE_COLORMAP_ACCESS(struct stifb_info *fb_info)
{
SETUP_HW(fb_info);
@@ -187,7 +186,7 @@
}
static void
-WRITE_IMAGE_COLOR(struct stifb_info *fb_info, int index, unsigned int color)
+WRITE_IMAGE_COLOR(struct stifb_info *fb_info, int index, int color)
{
SETUP_HW(fb_info);
WRITE_WORD(((0x100+index)<<2), fb_info->iobase + REG_3);
@@ -195,19 +194,109 @@
}
static void
-FINISH_IMAGE_COLORMAP_ACCESS(struct stifb_info *fb_info, int depth)
+FINISH_IMAGE_COLORMAP_ACCESS(struct stifb_info *fb_info)
{
WRITE_WORD(0x400, fb_info->iobase + REG_2);
- if (depth == 24)
+ if (fb_info->bpp == 24) {
WRITE_WORD(0x83000100, fb_info->iobase + REG_1);
- else /* depth = 8 */
- {
+ } else {
if (fb_info->id == S9000_ID_ARTIST)
WRITE_WORD(0x80000100, fb_info->iobase + REG_26);
else
WRITE_WORD(0x80000100, fb_info->iobase + REG_1);
+ }
+ SETUP_FB(fb_info);
+}
+
+static void
+SETUP_RAMDAC(struct stifb_info *fb_info)
+{
+ unsigned long AuxControlSpace = fb_info->iobase + 0x1000;
+ SETUP_HW(fb_info);
+ WRITE_WORD(0x04000000, AuxControlSpace + (0x20>>2));
+ WRITE_WORD(0xff000000, AuxControlSpace + (0x28>>2));
+}
+
+static void
+CRX24_SETUP_RAMDAC(struct stifb_info *fb_info)
+{
+ unsigned long AuxControlSpace = fb_info->iobase + 0x1000;
+ SETUP_HW(fb_info);
+ WRITE_WORD(0x04000000, AuxControlSpace + 0*sizeof(__u32));
+ WRITE_WORD(0x02000000, AuxControlSpace + 1*sizeof(__u32));
+ WRITE_WORD(0xff000000, AuxControlSpace + 2*sizeof(__u32));
+ WRITE_WORD(0x05000000, AuxControlSpace + 0*sizeof(__u32));
+ WRITE_WORD(0x02000000, AuxControlSpace + 1*sizeof(__u32));
+ WRITE_WORD(0x03000000, AuxControlSpace + 2*sizeof(__u32));
+}
+
+static void
+HCRX_SETUP_RAMDAC(struct stifb_info *fb_info)
+{
+ WRITE_WORD(0xffffffff, fb_info->iobase + REG_32);
+}
+
+static void
+CRX24_SET_OVLY_MASK(struct stifb_info *fb_info)
+{
+ SETUP_HW(fb_info);
+ WRITE_WORD(0x13a02000, fb_info->iobase + REG_11);
+ WRITE_WORD(0x03000300, fb_info->iobase + REG_14);
+ WRITE_WORD(0x000017f0, fb_info->iobase + REG_3);
+ WRITE_WORD(0xffffffff, fb_info->iobase + REG_13);
+ WRITE_WORD(0xffffffff, fb_info->iobase + REG_22);
+ WRITE_WORD(0x00000000, fb_info->iobase + REG_23);
+}
+
+static void
+ENABLE_DISABLE_DISPLAY(struct stifb_info *fb_info, int enable)
+{
+ unsigned long AuxControlSpace = fb_info->iobase + 0x1000;
+ unsigned int value = enable ? 0x43000000 : 0x03000000;
+ SETUP_HW(fb_info);
+ WRITE_WORD(0x06000000, AuxControlSpace + (0x30>>2));
+ WRITE_WORD(value, AuxControlSpace + (0x38>>2));
+}
+
+static void
+CRX24_ENABLE_DISABLE_DISPLAY(struct stifb_info *fb_info, int enable)
+{
+ unsigned long AuxControlSpace = fb_info->iobase + 0x1000;
+ unsigned int value = enable ? 0x10000000 : 0x30000000;
+ SETUP_HW(fb_info);
+ WRITE_WORD(0x01000000, AuxControlSpace + 0*sizeof(__u32));
+ WRITE_WORD(0x02000000, AuxControlSpace + 1*sizeof(__u32));
+ WRITE_WORD(value, AuxControlSpace + 2*sizeof(__u32));
+}
+
+static void
+ARTIST_ENABLE_DISABLE_DISPLAY(struct stifb_info *fb_info, int enable)
+{
+ unsigned long DregsMiscVideo = fb_info->iobase + REG_21;
+ unsigned long DregsMiscCtl = fb_info->iobase + REG_27;
+
+ SETUP_HW(fb_info);
+ if (enable) {
+ WRITE_WORD(READ_WORD(DregsMiscVideo) | 0x0A000000, DregsMiscVideo);
+ WRITE_WORD(READ_WORD(DregsMiscCtl) | 0x00800000, DregsMiscCtl);
+ } else {
+ WRITE_WORD(READ_WORD(DregsMiscVideo) & ~0x0A000000, DregsMiscVideo);
+ WRITE_WORD(READ_WORD(DregsMiscCtl) & ~0x00800000, DregsMiscCtl);
}
- SETUP_FB(fb_info, depth);
+}
+
+static void
+HYPER_ENABLE_DISABLE_DISPLAY(struct stifb_info *fb_info, int enable)
+{
+ unsigned long DregsHypMiscVideo = fb_info->iobase + REG_33;
+ unsigned int value;
+ SETUP_HW(fb_info);
+ value = READ_WORD(DregsHypMiscVideo);
+ if (enable)
+ value |= 0x0A000000;
+ else
+ value &= ~~0x0A000000;
+ WRITE_WORD(value, DregsHypMiscVideo);
}
@@ -249,7 +338,7 @@
elkSetupPlanes(struct stifb_info *fb_info)
{
SETUP_RAMDAC(fb_info);
- SETUP_FB(fb_info, 8 /* depth */);
+ SETUP_FB(fb_info);
}
static void
@@ -259,21 +348,10 @@
SET_ATTR_SIZE(fb_info, current_par.x_virt, current_par.y_virt );
/* XXX: pScreenPriv->screenWidth, pScreenPriv->screenHeight */
FINISH_ATTR_ACCESS(fb_info);
- SETUP_FB(fb_info, 8 /* depth */);
+ SETUP_FB(fb_info);
}
-static void
-ARTIST_ENABLE_DISPLAY(struct stifb_info *fb_info)
-{
- unsigned long DregsMiscVideo = fb_info->iobase + REG_21;
- unsigned long DregsMiscCtl = fb_info->iobase + REG_27;
-
- SETUP_HW(fb_info);
- WRITE_WORD(READ_WORD(DregsMiscVideo) | 0x0A000000, DregsMiscVideo);
- WRITE_WORD(READ_WORD(DregsMiscCtl) | 0x0A000000, DregsMiscCtl);
-}
-
/* ------------------- driver specific functions ---------------------------
*/
@@ -410,7 +488,7 @@
START_IMAGE_COLORMAP_ACCESS(p);
WRITE_IMAGE_COLOR(p, regno, color);
- FINISH_IMAGE_COLORMAP_ACCESS(p, 8);
+ FINISH_IMAGE_COLORMAP_ACCESS(p);
return 0;
}
@@ -430,8 +508,8 @@
// elkSetupPlanes(&fb_info); /* XXX */
ngleSetupAttrPlanes(&fb_info, ARTIST_CMAP0);
// ngleSetupAttrPlanes(&fb_info, BUFF0_CMAP0);
- ARTIST_ENABLE_DISPLAY(&fb_info);
- SETUP_FB(&fb_info, 8 /* depth */);
+ ARTIST_ENABLE_DISABLE_DISPLAY(&fb_info, ENABLE);
+ SETUP_FB(&fb_info);
}
switch(par->bpp) {
@@ -471,7 +549,29 @@
static int
stifb_blank(int blank_mode, struct fb_info_gen *info)
{
- /* TODO */
+ struct stifb_info *fb_info = (struct stifb_info *) info;
+ int enable = (blank_mode == 0) ? ENABLE : DISABLE;
+
+ switch (fb_info->id) {
+ case S9000_ID_A1439A:
+ CRX24_ENABLE_DISABLE_DISPLAY(fb_info, enable);
+ break;
+ case S9000_ID_ARTIST:
+ ARTIST_ENABLE_DISABLE_DISPLAY(fb_info, enable);
+ break;
+ case S9000_ID_HCRX:
+ HYPER_ENABLE_DISABLE_DISPLAY(fb_info, enable);
+ break;
+ case S9000_ID_A1659A:; /* fall through */
+ case S9000_ID_TIMBER:;
+ case CRX24_OVERLAY_PLANES:;
+ default:
+ ENABLE_DISABLE_DISPLAY(fb_info, enable);
+ break;
+ }
+
+ SETUP_FB(fb_info);
+
return 0;
}