* [PATCH 01/15] [FB] make viafb work on x86_64
@ 2009-05-20 20:28 Harald Welte
2009-05-20 20:28 ` [PATCH 02/15] [FB] viafb: Add missing break statement in switch Harald Welte
` (2 more replies)
0 siblings, 3 replies; 33+ messages in thread
From: Harald Welte @ 2009-05-20 20:28 UTC (permalink / raw)
To: linux-fbdev-devel; +Cc: Harald Welte
From: Harald Welte <laforge@gnumonks.org>
This patch makes fixes a bug in viafb on x86_64 builds (e.g. for VIA Nano CPU).
You cannot make the assumption that sizeof(unsigned int) == sizeof(unsigned
long), so the parsing of the default mode (640x480) fails, leading to a
division by zero during insmod of the driver.
Signed-off-by: Harald Welte <HaraldWelte@viatech.com>
---
drivers/video/via/viafbdev.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c
index e327b84..a0fec29 100644
--- a/drivers/video/via/viafbdev.c
+++ b/drivers/video/via/viafbdev.c
@@ -2103,7 +2103,7 @@ static void viafb_remove_proc(struct proc_dir_entry *viafb_entry)
static int __devinit via_pci_probe(void)
{
- unsigned int default_xres, default_yres;
+ unsigned long default_xres, default_yres;
char *tmpc, *tmpm;
char *tmpc_sec, *tmpm_sec;
int vmode_index;
@@ -2196,8 +2196,8 @@ static int __devinit via_pci_probe(void)
viafb_FB_MM = viaparinfo->fbmem_virt;
tmpm = viafb_mode;
tmpc = strsep(&tmpm, "x");
- strict_strtoul(tmpc, 0, (unsigned long *)&default_xres);
- strict_strtoul(tmpm, 0, (unsigned long *)&default_yres);
+ strict_strtoul(tmpc, 0, &default_xres);
+ strict_strtoul(tmpm, 0, &default_yres);
vmode_index = viafb_get_mode_index(default_xres, default_yres, 0);
DEBUG_MSG(KERN_INFO "0->index=%d\n", vmode_index);
--
1.6.2.4
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables
unlimited royalty-free distribution of the report engine
for externally facing server and web deployment.
http://p.sf.net/sfu/businessobjects
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [PATCH 02/15] [FB] viafb: Add missing break statement in switch
2009-05-20 20:28 [PATCH 01/15] [FB] make viafb work on x86_64 Harald Welte
@ 2009-05-20 20:28 ` Harald Welte
2009-05-20 20:28 ` [PATCH 03/15] [FB] viafb: Add support for the VX855 chipset Harald Welte
2009-05-23 6:54 ` [PATCH 02/15] [FB] viafb: Add missing break statement in switch Krzysztof Helt
2009-05-21 16:57 ` [PATCH 01/15] [FB] make viafb work on x86_64 Krzysztof Helt
2009-05-23 6:57 ` Krzysztof Helt
2 siblings, 2 replies; 33+ messages in thread
From: Harald Welte @ 2009-05-20 20:28 UTC (permalink / raw)
To: linux-fbdev-devel; +Cc: Harald Welte
From: Harald Welte <laforge@gnumonks.org>
Signed-off-by: Harald Welte <HaraldWelte@viatech.com>
---
drivers/video/via/hw.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/drivers/video/via/hw.c b/drivers/video/via/hw.c
index fcd53ce..59ddf09 100644
--- a/drivers/video/via/hw.c
+++ b/drivers/video/via/hw.c
@@ -2272,6 +2272,7 @@ int viafb_setmode(int vmode_index, int hor_res, int ver_res, int video_bpp,
case UNICHROME_CX700:
viafb_write_regx(CX700_ModeXregs, NUM_TOTAL_CX700_ModeXregs);
+ break;
case UNICHROME_VX800:
viafb_write_regx(VX800_ModeXregs, NUM_TOTAL_VX800_ModeXregs);
--
1.6.2.4
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables
unlimited royalty-free distribution of the report engine
for externally facing server and web deployment.
http://p.sf.net/sfu/businessobjects
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [PATCH 03/15] [FB] viafb: Add support for the VX855 chipset
2009-05-20 20:28 ` [PATCH 02/15] [FB] viafb: Add missing break statement in switch Harald Welte
@ 2009-05-20 20:28 ` Harald Welte
2009-05-20 20:28 ` [PATCH 04/15] [FB] viafb: Fix various resource leaks during module_init() Harald Welte
2009-05-23 6:54 ` [PATCH 03/15] [FB] viafb: Add support for the VX855 chipset Krzysztof Helt
2009-05-23 6:54 ` [PATCH 02/15] [FB] viafb: Add missing break statement in switch Krzysztof Helt
1 sibling, 2 replies; 33+ messages in thread
From: Harald Welte @ 2009-05-20 20:28 UTC (permalink / raw)
To: linux-fbdev-devel; +Cc: HaraldWelte
From: Harald Welte <laforge@gnumonks.org>
This patch adds support for a new VIA integrated graphics chipset, the VX855.
Signed-off-by: HaraldWelte <HaraldWelte@viatech.com>
---
drivers/video/via/chip.h | 3 +
drivers/video/via/hw.c | 207 ++++++++++++++++++++++++++++--------------
drivers/video/via/hw.h | 14 +++
drivers/video/via/share.h | 98 ++++++++++++++++++++
drivers/video/via/viafbdev.c | 7 +-
drivers/video/via/viamode.c | 55 +++++++++++
drivers/video/via/viamode.h | 2 +
7 files changed, 316 insertions(+), 70 deletions(-)
diff --git a/drivers/video/via/chip.h b/drivers/video/via/chip.h
index dde95ed..03e90cf 100644
--- a/drivers/video/via/chip.h
+++ b/drivers/video/via/chip.h
@@ -68,6 +68,9 @@
#define UNICHROME_VX800 11
#define UNICHROME_VX800_DID 0x1122
+#define UNICHROME_VX855 12
+#define UNICHROME_VX855_DID 0x5122
+
/**************************************************/
/* Definition TMDS Trasmitter Information */
/**************************************************/
diff --git a/drivers/video/via/hw.c b/drivers/video/via/hw.c
index 59ddf09..b111b6c 100644
--- a/drivers/video/via/hw.c
+++ b/drivers/video/via/hw.c
@@ -33,6 +33,7 @@ static const struct pci_device_id_info pciidlist[] = {
{PCI_VIA_VENDOR_ID, UNICHROME_P4M900_DID, UNICHROME_P4M900},
{PCI_VIA_VENDOR_ID, UNICHROME_CN750_DID, UNICHROME_CN750},
{PCI_VIA_VENDOR_ID, UNICHROME_VX800_DID, UNICHROME_VX800},
+ {PCI_VIA_VENDOR_ID, UNICHROME_VX855_DID, UNICHROME_VX855},
{0, 0, 0}
};
@@ -44,102 +45,142 @@ struct offset offset_reg = {
};
static struct pll_map pll_value[] = {
- {CLK_25_175M, CLE266_PLL_25_175M, K800_PLL_25_175M, CX700_25_175M},
- {CLK_29_581M, CLE266_PLL_29_581M, K800_PLL_29_581M, CX700_29_581M},
- {CLK_26_880M, CLE266_PLL_26_880M, K800_PLL_26_880M, CX700_26_880M},
- {CLK_31_490M, CLE266_PLL_31_490M, K800_PLL_31_490M, CX700_31_490M},
- {CLK_31_500M, CLE266_PLL_31_500M, K800_PLL_31_500M, CX700_31_500M},
- {CLK_31_728M, CLE266_PLL_31_728M, K800_PLL_31_728M, CX700_31_728M},
- {CLK_32_668M, CLE266_PLL_32_668M, K800_PLL_32_668M, CX700_32_668M},
- {CLK_36_000M, CLE266_PLL_36_000M, K800_PLL_36_000M, CX700_36_000M},
- {CLK_40_000M, CLE266_PLL_40_000M, K800_PLL_40_000M, CX700_40_000M},
- {CLK_41_291M, CLE266_PLL_41_291M, K800_PLL_41_291M, CX700_41_291M},
- {CLK_43_163M, CLE266_PLL_43_163M, K800_PLL_43_163M, CX700_43_163M},
- {CLK_45_250M, CLE266_PLL_45_250M, K800_PLL_45_250M, CX700_45_250M},
- {CLK_46_000M, CLE266_PLL_46_000M, K800_PLL_46_000M, CX700_46_000M},
- {CLK_46_996M, CLE266_PLL_46_996M, K800_PLL_46_996M, CX700_46_996M},
- {CLK_48_000M, CLE266_PLL_48_000M, K800_PLL_48_000M, CX700_48_000M},
- {CLK_48_875M, CLE266_PLL_48_875M, K800_PLL_48_875M, CX700_48_875M},
- {CLK_49_500M, CLE266_PLL_49_500M, K800_PLL_49_500M, CX700_49_500M},
- {CLK_52_406M, CLE266_PLL_52_406M, K800_PLL_52_406M, CX700_52_406M},
- {CLK_52_977M, CLE266_PLL_52_977M, K800_PLL_52_977M, CX700_52_977M},
- {CLK_56_250M, CLE266_PLL_56_250M, K800_PLL_56_250M, CX700_56_250M},
- {CLK_60_466M, CLE266_PLL_60_466M, K800_PLL_60_466M, CX700_60_466M},
- {CLK_61_500M, CLE266_PLL_61_500M, K800_PLL_61_500M, CX700_61_500M},
- {CLK_65_000M, CLE266_PLL_65_000M, K800_PLL_65_000M, CX700_65_000M},
- {CLK_65_178M, CLE266_PLL_65_178M, K800_PLL_65_178M, CX700_65_178M},
- {CLK_66_750M, CLE266_PLL_66_750M, K800_PLL_66_750M, CX700_66_750M},
- {CLK_68_179M, CLE266_PLL_68_179M, K800_PLL_68_179M, CX700_68_179M},
- {CLK_69_924M, CLE266_PLL_69_924M, K800_PLL_69_924M, CX700_69_924M},
- {CLK_70_159M, CLE266_PLL_70_159M, K800_PLL_70_159M, CX700_70_159M},
- {CLK_72_000M, CLE266_PLL_72_000M, K800_PLL_72_000M, CX700_72_000M},
- {CLK_78_750M, CLE266_PLL_78_750M, K800_PLL_78_750M, CX700_78_750M},
- {CLK_80_136M, CLE266_PLL_80_136M, K800_PLL_80_136M, CX700_80_136M},
- {CLK_83_375M, CLE266_PLL_83_375M, K800_PLL_83_375M, CX700_83_375M},
- {CLK_83_950M, CLE266_PLL_83_950M, K800_PLL_83_950M, CX700_83_950M},
- {CLK_84_750M, CLE266_PLL_84_750M, K800_PLL_84_750M, CX700_84_750M},
- {CLK_85_860M, CLE266_PLL_85_860M, K800_PLL_85_860M, CX700_85_860M},
- {CLK_88_750M, CLE266_PLL_88_750M, K800_PLL_88_750M, CX700_88_750M},
- {CLK_94_500M, CLE266_PLL_94_500M, K800_PLL_94_500M, CX700_94_500M},
- {CLK_97_750M, CLE266_PLL_97_750M, K800_PLL_97_750M, CX700_97_750M},
+ {CLK_25_175M, CLE266_PLL_25_175M, K800_PLL_25_175M,
+ CX700_25_175M, VX855_25_175M},
+ {CLK_29_581M, CLE266_PLL_29_581M, K800_PLL_29_581M,
+ CX700_29_581M, VX855_29_581M},
+ {CLK_26_880M, CLE266_PLL_26_880M, K800_PLL_26_880M,
+ CX700_26_880M, VX855_26_880M},
+ {CLK_31_490M, CLE266_PLL_31_490M, K800_PLL_31_490M,
+ CX700_31_490M, VX855_31_490M},
+ {CLK_31_500M, CLE266_PLL_31_500M, K800_PLL_31_500M,
+ CX700_31_500M, VX855_31_500M},
+ {CLK_31_728M, CLE266_PLL_31_728M, K800_PLL_31_728M,
+ CX700_31_728M, VX855_31_728M},
+ {CLK_32_668M, CLE266_PLL_32_668M, K800_PLL_32_668M,
+ CX700_32_668M, VX855_32_668M},
+ {CLK_36_000M, CLE266_PLL_36_000M, K800_PLL_36_000M,
+ CX700_36_000M, VX855_36_000M},
+ {CLK_40_000M, CLE266_PLL_40_000M, K800_PLL_40_000M,
+ CX700_40_000M, VX855_40_000M},
+ {CLK_41_291M, CLE266_PLL_41_291M, K800_PLL_41_291M,
+ CX700_41_291M, VX855_41_291M},
+ {CLK_43_163M, CLE266_PLL_43_163M, K800_PLL_43_163M,
+ CX700_43_163M, VX855_43_163M},
+ {CLK_45_250M, CLE266_PLL_45_250M, K800_PLL_45_250M,
+ CX700_45_250M, VX855_45_250M},
+ {CLK_46_000M, CLE266_PLL_46_000M, K800_PLL_46_000M,
+ CX700_46_000M, VX855_46_000M},
+ {CLK_46_996M, CLE266_PLL_46_996M, K800_PLL_46_996M,
+ CX700_46_996M, VX855_46_996M},
+ {CLK_48_000M, CLE266_PLL_48_000M, K800_PLL_48_000M,
+ CX700_48_000M, VX855_48_000M},
+ {CLK_48_875M, CLE266_PLL_48_875M, K800_PLL_48_875M,
+ CX700_48_875M, VX855_48_875M},
+ {CLK_49_500M, CLE266_PLL_49_500M, K800_PLL_49_500M,
+ CX700_49_500M, VX855_49_500M},
+ {CLK_52_406M, CLE266_PLL_52_406M, K800_PLL_52_406M,
+ CX700_52_406M, VX855_52_406M},
+ {CLK_52_977M, CLE266_PLL_52_977M, K800_PLL_52_977M,
+ CX700_52_977M, VX855_52_977M},
+ {CLK_56_250M, CLE266_PLL_56_250M, K800_PLL_56_250M,
+ CX700_56_250M, VX855_56_250M},
+ {CLK_60_466M, CLE266_PLL_60_466M, K800_PLL_60_466M,
+ CX700_60_466M, VX855_60_466M},
+ {CLK_61_500M, CLE266_PLL_61_500M, K800_PLL_61_500M,
+ CX700_61_500M, VX855_61_500M},
+ {CLK_65_000M, CLE266_PLL_65_000M, K800_PLL_65_000M,
+ CX700_65_000M, VX855_65_000M},
+ {CLK_65_178M, CLE266_PLL_65_178M, K800_PLL_65_178M,
+ CX700_65_178M, VX855_65_178M},
+ {CLK_66_750M, CLE266_PLL_66_750M, K800_PLL_66_750M,
+ CX700_66_750M, VX855_66_750M},
+ {CLK_68_179M, CLE266_PLL_68_179M, K800_PLL_68_179M,
+ CX700_68_179M, VX855_68_179M},
+ {CLK_69_924M, CLE266_PLL_69_924M, K800_PLL_69_924M,
+ CX700_69_924M, VX855_69_924M},
+ {CLK_70_159M, CLE266_PLL_70_159M, K800_PLL_70_159M,
+ CX700_70_159M, VX855_70_159M},
+ {CLK_72_000M, CLE266_PLL_72_000M, K800_PLL_72_000M,
+ CX700_72_000M, VX855_72_000M},
+ {CLK_78_750M, CLE266_PLL_78_750M, K800_PLL_78_750M,
+ CX700_78_750M, VX855_78_750M},
+ {CLK_80_136M, CLE266_PLL_80_136M, K800_PLL_80_136M,
+ CX700_80_136M, VX855_80_136M},
+ {CLK_83_375M, CLE266_PLL_83_375M, K800_PLL_83_375M,
+ CX700_83_375M, VX855_83_375M},
+ {CLK_83_950M, CLE266_PLL_83_950M, K800_PLL_83_950M,
+ CX700_83_950M, VX855_83_950M},
+ {CLK_84_750M, CLE266_PLL_84_750M, K800_PLL_84_750M,
+ CX700_84_750M, VX855_84_750M},
+ {CLK_85_860M, CLE266_PLL_85_860M, K800_PLL_85_860M,
+ CX700_85_860M, VX855_85_860M},
+ {CLK_88_750M, CLE266_PLL_88_750M, K800_PLL_88_750M,
+ CX700_88_750M, VX855_88_750M},
+ {CLK_94_500M, CLE266_PLL_94_500M, K800_PLL_94_500M,
+ CX700_94_500M, VX855_94_500M},
+ {CLK_97_750M, CLE266_PLL_97_750M, K800_PLL_97_750M,
+ CX700_97_750M, VX855_97_750M},
{CLK_101_000M, CLE266_PLL_101_000M, K800_PLL_101_000M,
- CX700_101_000M},
+ CX700_101_000M, VX855_101_000M},
{CLK_106_500M, CLE266_PLL_106_500M, K800_PLL_106_500M,
- CX700_106_500M},
+ CX700_106_500M, VX855_106_500M},
{CLK_108_000M, CLE266_PLL_108_000M, K800_PLL_108_000M,
- CX700_108_000M},
+ CX700_108_000M, VX855_108_000M},
{CLK_113_309M, CLE266_PLL_113_309M, K800_PLL_113_309M,
- CX700_113_309M},
+ CX700_113_309M, VX855_113_309M},
{CLK_118_840M, CLE266_PLL_118_840M, K800_PLL_118_840M,
- CX700_118_840M},
+ CX700_118_840M, VX855_118_840M},
{CLK_119_000M, CLE266_PLL_119_000M, K800_PLL_119_000M,
- CX700_119_000M},
+ CX700_119_000M, VX855_119_000M},
{CLK_121_750M, CLE266_PLL_121_750M, K800_PLL_121_750M,
- CX700_121_750M},
+ CX700_121_750M, 0},
{CLK_125_104M, CLE266_PLL_125_104M, K800_PLL_125_104M,
- CX700_125_104M},
+ CX700_125_104M, 0},
{CLK_133_308M, CLE266_PLL_133_308M, K800_PLL_133_308M,
- CX700_133_308M},
+ CX700_133_308M, 0},
{CLK_135_000M, CLE266_PLL_135_000M, K800_PLL_135_000M,
- CX700_135_000M},
+ CX700_135_000M, VX855_135_000M},
{CLK_136_700M, CLE266_PLL_136_700M, K800_PLL_136_700M,
- CX700_136_700M},
+ CX700_136_700M, VX855_136_700M},
{CLK_138_400M, CLE266_PLL_138_400M, K800_PLL_138_400M,
- CX700_138_400M},
+ CX700_138_400M, VX855_138_400M},
{CLK_146_760M, CLE266_PLL_146_760M, K800_PLL_146_760M,
- CX700_146_760M},
+ CX700_146_760M, VX855_146_760M},
{CLK_153_920M, CLE266_PLL_153_920M, K800_PLL_153_920M,
- CX700_153_920M},
+ CX700_153_920M, VX855_153_920M},
{CLK_156_000M, CLE266_PLL_156_000M, K800_PLL_156_000M,
- CX700_156_000M},
+ CX700_156_000M, VX855_156_000M},
{CLK_157_500M, CLE266_PLL_157_500M, K800_PLL_157_500M,
- CX700_157_500M},
+ CX700_157_500M, VX855_157_500M},
{CLK_162_000M, CLE266_PLL_162_000M, K800_PLL_162_000M,
- CX700_162_000M},
+ CX700_162_000M, VX855_162_000M},
{CLK_187_000M, CLE266_PLL_187_000M, K800_PLL_187_000M,
- CX700_187_000M},
+ CX700_187_000M, VX855_187_000M},
{CLK_193_295M, CLE266_PLL_193_295M, K800_PLL_193_295M,
- CX700_193_295M},
+ CX700_193_295M, VX855_193_295M},
{CLK_202_500M, CLE266_PLL_202_500M, K800_PLL_202_500M,
- CX700_202_500M},
+ CX700_202_500M, VX855_202_500M},
{CLK_204_000M, CLE266_PLL_204_000M, K800_PLL_204_000M,
- CX700_204_000M},
+ CX700_204_000M, VX855_204_000M},
{CLK_218_500M, CLE266_PLL_218_500M, K800_PLL_218_500M,
- CX700_218_500M},
+ CX700_218_500M, VX855_218_500M},
{CLK_234_000M, CLE266_PLL_234_000M, K800_PLL_234_000M,
- CX700_234_000M},
+ CX700_234_000M, VX855_234_000M},
{CLK_267_250M, CLE266_PLL_267_250M, K800_PLL_267_250M,
- CX700_267_250M},
+ CX700_267_250M, VX855_267_250M},
{CLK_297_500M, CLE266_PLL_297_500M, K800_PLL_297_500M,
- CX700_297_500M},
- {CLK_74_481M, CLE266_PLL_74_481M, K800_PLL_74_481M, CX700_74_481M},
+ CX700_297_500M, VX855_297_500M},
+ {CLK_74_481M, CLE266_PLL_74_481M, K800_PLL_74_481M,
+ CX700_74_481M, VX855_74_481M},
{CLK_172_798M, CLE266_PLL_172_798M, K800_PLL_172_798M,
- CX700_172_798M},
+ CX700_172_798M, VX855_172_798M},
{CLK_122_614M, CLE266_PLL_122_614M, K800_PLL_122_614M,
- CX700_122_614M},
- {CLK_74_270M, CLE266_PLL_74_270M, K800_PLL_74_270M, CX700_74_270M},
+ CX700_122_614M, VX855_122_614M},
+ {CLK_74_270M, CLE266_PLL_74_270M, K800_PLL_74_270M,
+ CX700_74_270M, 0},
{CLK_148_500M, CLE266_PLL_148_500M, K800_PLL_148_500M,
- CX700_148_500M}
+ CX700_148_500M, VX855_148_500M}
};
static struct fifo_depth_select display_fifo_depth_reg = {
@@ -1277,6 +1318,15 @@ void viafb_load_FIFO_reg(int set_iga, int hor_active, int ver_active)
VX800_IGA1_DISPLAY_QUEUE_EXPIRE_NUM;
}
+ if (viaparinfo->chip_info->gfx_chip_name == UNICHROME_VX855) {
+ iga1_fifo_max_depth = VX855_IGA1_FIFO_MAX_DEPTH;
+ iga1_fifo_threshold = VX855_IGA1_FIFO_THRESHOLD;
+ iga1_fifo_high_threshold =
+ VX855_IGA1_FIFO_HIGH_THRESHOLD;
+ iga1_display_queue_expire_num =
+ VX855_IGA1_DISPLAY_QUEUE_EXPIRE_NUM;
+ }
+
/* Set Display FIFO Depath Select */
reg_value = IGA1_FIFO_DEPTH_SELECT_FORMULA(iga1_fifo_max_depth);
viafb_load_reg_num =
@@ -1408,6 +1458,15 @@ void viafb_load_FIFO_reg(int set_iga, int hor_active, int ver_active)
VX800_IGA2_DISPLAY_QUEUE_EXPIRE_NUM;
}
+ if (viaparinfo->chip_info->gfx_chip_name == UNICHROME_VX855) {
+ iga2_fifo_max_depth = VX855_IGA2_FIFO_MAX_DEPTH;
+ iga2_fifo_threshold = VX855_IGA2_FIFO_THRESHOLD;
+ iga2_fifo_high_threshold =
+ VX855_IGA2_FIFO_HIGH_THRESHOLD;
+ iga2_display_queue_expire_num =
+ VX855_IGA2_DISPLAY_QUEUE_EXPIRE_NUM;
+ }
+
if (viaparinfo->chip_info->gfx_chip_name == UNICHROME_K800) {
/* Set Display FIFO Depath Select */
reg_value =
@@ -1496,6 +1555,8 @@ u32 viafb_get_clk_value(int clk)
case UNICHROME_P4M900:
case UNICHROME_VX800:
return pll_value[i].cx700_pll;
+ case UNICHROME_VX855:
+ return pll_value[i].vx855_pll;
}
}
}
@@ -1529,6 +1590,7 @@ void viafb_set_vclock(u32 CLK, int set_iga)
case UNICHROME_P4M890:
case UNICHROME_P4M900:
case UNICHROME_VX800:
+ case UNICHROME_VX855:
viafb_write_reg(SR44, VIASR, CLK / 0x10000);
DEBUG_MSG(KERN_INFO "\nSR44=%x", CLK / 0x10000);
viafb_write_reg(SR45, VIASR, (CLK & 0xFFFF) / 0x100);
@@ -1557,6 +1619,7 @@ void viafb_set_vclock(u32 CLK, int set_iga)
case UNICHROME_P4M890:
case UNICHROME_P4M900:
case UNICHROME_VX800:
+ case UNICHROME_VX855:
viafb_write_reg(SR4A, VIASR, CLK / 0x10000);
viafb_write_reg(SR4B, VIASR, (CLK & 0xFFFF) / 0x100);
viafb_write_reg(SR4C, VIASR, CLK % 0x100);
@@ -2276,7 +2339,10 @@ int viafb_setmode(int vmode_index, int hor_res, int ver_res, int video_bpp,
case UNICHROME_VX800:
viafb_write_regx(VX800_ModeXregs, NUM_TOTAL_VX800_ModeXregs);
+ break;
+ case UNICHROME_VX855:
+ viafb_write_regx(VX855_ModeXregs, NUM_TOTAL_VX855_ModeXregs);
break;
}
@@ -2657,6 +2723,7 @@ static int get_fb_size_from_pci(void)
case P4M890_FUNCTION3:
case P4M900_FUNCTION3:
case VX800_FUNCTION3:
+ case VX855_FUNCTION3:
/*case CN750_FUNCTION3: */
outl(configid + 0xA0, (unsigned long)0xCF8);
FBSize = inl((unsigned long)0xCFC);
@@ -2720,6 +2787,10 @@ static int get_fb_size_from_pci(void)
VideoMemSize = (256 << 20); /*256M */
break;
+ case 0x00007000: /* Only on VX855/875 */
+ VideoMemSize = (512 << 20); /*512M */
+ break;
+
default:
VideoMemSize = (32 << 20); /*32M */
break;
diff --git a/drivers/video/via/hw.h b/drivers/video/via/hw.h
index 6ff38fa..22786a5 100644
--- a/drivers/video/via/hw.h
+++ b/drivers/video/via/hw.h
@@ -335,6 +335,17 @@ is reserved, so it may have problem to set 1600x1200 on IGA2. */
/* location: {CR94,0,6} */
#define VX800_IGA2_DISPLAY_QUEUE_EXPIRE_NUM 128
+/* For VT3409 */
+#define VX855_IGA1_FIFO_MAX_DEPTH 400
+#define VX855_IGA1_FIFO_THRESHOLD 320
+#define VX855_IGA1_FIFO_HIGH_THRESHOLD 320
+#define VX855_IGA1_DISPLAY_QUEUE_EXPIRE_NUM 160
+
+#define VX855_IGA2_FIFO_MAX_DEPTH 200
+#define VX855_IGA2_FIFO_THRESHOLD 160
+#define VX855_IGA2_FIFO_HIGH_THRESHOLD 160
+#define VX855_IGA2_DISPLAY_QUEUE_EXPIRE_NUM 320
+
#define IGA1_FIFO_DEPTH_SELECT_REG_NUM 1
#define IGA1_FIFO_THRESHOLD_REG_NUM 2
#define IGA1_FIFO_HIGH_THRESHOLD_REG_NUM 2
@@ -716,6 +727,7 @@ struct pll_map {
u32 cle266_pll;
u32 k800_pll;
u32 cx700_pll;
+ u32 vx855_pll;
};
struct rgbLUT {
@@ -860,6 +872,8 @@ struct iga2_crtc_timing {
#define P4M900_FUNCTION3 0x3364
/* VT3353 chipset*/
#define VX800_FUNCTION3 0x3353
+/* VT3409 chipset*/
+#define VX855_FUNCTION3 0x3409
#define NUM_TOTAL_PLL_TABLE ARRAY_SIZE(pll_value)
diff --git a/drivers/video/via/share.h b/drivers/video/via/share.h
index 2e1254d..1eacd1c 100644
--- a/drivers/video/via/share.h
+++ b/drivers/video/via/share.h
@@ -167,6 +167,10 @@
#define SR4B 0x4B
#define SR4C 0x4C
#define SR52 0x52
+#define SR57 0x57
+#define SR58 0x58
+#define SR59 0x59
+#define SR5D 0x5D
#define SR5E 0x5E
#define SR65 0x65
@@ -966,6 +970,100 @@
#define CX700_297_500M 0x00CE0403
#define CX700_122_614M 0x00870802
+/* PLL for VX855 */
+#define VX855_22_000M 0x007B1005
+#define VX855_25_175M 0x008D1005
+#define VX855_26_719M 0x00961005
+#define VX855_26_880M 0x00961005
+#define VX855_27_000M 0x00971005
+#define VX855_29_581M 0x00A51005
+#define VX855_29_829M 0x00641003
+#define VX855_31_490M 0x00B01005
+#define VX855_31_500M 0x00B01005
+#define VX855_31_728M 0x008E1004
+#define VX855_32_668M 0x00921004
+#define VX855_36_000M 0x00A11004
+#define VX855_40_000M 0x00700C05
+#define VX855_41_291M 0x00730C05
+#define VX855_43_163M 0x00790C05
+#define VX855_45_250M 0x007F0C05 /* 45.46MHz */
+#define VX855_46_000M 0x00670C04
+#define VX855_46_996M 0x00690C04
+#define VX855_48_000M 0x00860C05
+#define VX855_48_875M 0x00890C05
+#define VX855_49_500M 0x00530C03
+#define VX855_52_406M 0x00580C03
+#define VX855_52_977M 0x00940C05
+#define VX855_56_250M 0x009D0C05
+#define VX855_60_466M 0x00A90C05
+#define VX855_61_500M 0x00AC0C05
+#define VX855_65_000M 0x006D0C03
+#define VX855_65_178M 0x00B60C05
+#define VX855_66_750M 0x00700C03 /*67.116MHz */
+#define VX855_67_295M 0x00BC0C05
+#define VX855_68_179M 0x00BF0C05
+#define VX855_68_369M 0x00BF0C05
+#define VX855_69_924M 0x00C30C05
+#define VX855_70_159M 0x00C30C05
+#define VX855_72_000M 0x00A10C04
+#define VX855_73_023M 0x00CC0C05
+#define VX855_74_481M 0x00D10C05
+#define VX855_78_750M 0x006E0805
+#define VX855_79_466M 0x006F0805
+#define VX855_80_136M 0x00700805
+#define VX855_81_627M 0x00720805
+#define VX855_83_375M 0x00750805
+#define VX855_83_527M 0x00750805
+#define VX855_83_950M 0x00750805
+#define VX855_84_537M 0x00760805
+#define VX855_84_750M 0x00760805 /* 84.537Mhz */
+#define VX855_85_500M 0x00760805 /* 85.909080 MHz*/
+#define VX855_85_860M 0x00760805
+#define VX855_85_909M 0x00760805
+#define VX855_88_750M 0x007C0805
+#define VX855_89_489M 0x007D0805
+#define VX855_94_500M 0x00840805
+#define VX855_96_648M 0x00870805
+#define VX855_97_750M 0x00890805
+#define VX855_101_000M 0x008D0805
+#define VX855_106_500M 0x00950805
+#define VX855_108_000M 0x00970805
+#define VX855_110_125M 0x00990805
+#define VX855_112_000M 0x009D0805
+#define VX855_113_309M 0x009F0805
+#define VX855_115_000M 0x00A10805
+#define VX855_118_840M 0x00A60805
+#define VX855_119_000M 0x00A70805
+#define VX855_121_750M 0x00AA0805 /* 121.704MHz */
+#define VX855_122_614M 0x00AC0805
+#define VX855_126_266M 0x00B10805
+#define VX855_130_250M 0x00B60805 /* 130.250 */
+#define VX855_135_000M 0x00BD0805
+#define VX855_136_700M 0x00BF0805
+#define VX855_137_750M 0x00C10805
+#define VX855_138_400M 0x00C20805
+#define VX855_144_300M 0x00CA0805
+#define VX855_146_760M 0x00CE0805
+#define VX855_148_500M 0x00D00805
+#define VX855_153_920M 0x00540402
+#define VX855_156_000M 0x006C0405
+#define VX855_156_867M 0x006E0405
+#define VX855_157_500M 0x006E0405
+#define VX855_162_000M 0x00710405
+#define VX855_172_798M 0x00790405
+#define VX855_187_000M 0x00830405
+#define VX855_193_295M 0x00870405
+#define VX855_202_500M 0x008E0405
+#define VX855_204_000M 0x008F0405
+#define VX855_218_500M 0x00990405
+#define VX855_229_500M 0x00A10405
+#define VX855_234_000M 0x00A40405
+#define VX855_267_250M 0x00BB0405
+#define VX855_297_500M 0x00D00405
+#define VX855_339_500M 0x00770005
+#define VX855_340_772M 0x00770005
+
+
/* Definition CRTC Timing Index */
#define H_TOTAL_INDEX 0
#define H_ADDR_INDEX 1
diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c
index a0fec29..02e7a72 100644
--- a/drivers/video/via/viafbdev.c
+++ b/drivers/video/via/viafbdev.c
@@ -218,7 +218,8 @@ static int viafb_check_var(struct fb_var_screeninfo *var,
if (!info->par)
return -1;
p_viafb_par = (struct viafb_par *)info->par;
- if (p_viafb_par->chip_info->gfx_chip_name == UNICHROME_VX800)
+ if (p_viafb_par->chip_info->gfx_chip_name == UNICHROME_VX800 ||
+ p_viafb_par->chip_info->gfx_chip_name == UNICHROME_VX855)
var->accel_flags = 0;
return 0;
@@ -1162,8 +1163,10 @@ static int viafb_cursor(struct fb_info *info, struct fb_cursor *cursor)
if ((p_viafb_par->chip_info->gfx_chip_name ==
UNICHROME_CX700) ||
+ (p_viafb_par->chip_info->gfx_chip_name ==
+ UNICHROME_VX800) ||
((p_viafb_par->chip_info->gfx_chip_name ==
- UNICHROME_VX800))) {
+ UNICHROME_VX855))) {
bg_col =
(((info->cmap.red)[viacursor.image.bg_color] &
0xFFC0) << 14) |
diff --git a/drivers/video/via/viamode.c b/drivers/video/via/viamode.c
index 6dcf583..209c3af 100644
--- a/drivers/video/via/viamode.c
+++ b/drivers/video/via/viamode.c
@@ -390,6 +390,61 @@ struct io_reg VX800_ModeXregs[] = { {VIASR, SR10, 0xFF, 0x01},
{VIACR, CRD2, 0xFF, 0xFF} /* TMDS/LVDS control register. */
};
+struct io_reg VX855_ModeXregs[] = {
+{VIASR, SR10, 0xFF, 0x01},
+{VIASR, SR15, 0x02, 0x02},
+{VIASR, SR16, 0xBF, 0x08},
+{VIASR, SR17, 0xFF, 0x1F},
+{VIASR, SR18, 0xFF, 0x4E},
+{VIASR, SR1A, 0xFB, 0x08},
+{VIASR, SR1B, 0xFF, 0xF0},
+{VIASR, SR1E, 0x07, 0x01},
+{VIASR, SR2A, 0xF0, 0x00},
+{VIASR, SR58, 0xFF, 0x00},
+{VIASR, SR59, 0xFF, 0x00},
+{VIASR, SR2D, 0xFF, 0xFF}, /* VCK and LCK PLL power on. */
+{VIACR, CR09, 0xFF, 0x00}, /* Initial CR09=0*/
+{VIACR, CR11, 0x8F, 0x00}, /* IGA1 initial Vertical end */
+{VIACR, CR17, 0x7F, 0x00}, /* IGA1 CRT Mode control init */
+{VIACR, CR0A, 0xFF, 0x1E}, /* Cursor Start */
+{VIACR, CR0B, 0xFF, 0x00}, /* Cursor End */
+{VIACR, CR0E, 0xFF, 0x00}, /* Cursor Location High */
+{VIACR, CR0F, 0xFF, 0x00}, /* Cursor Localtion Low */
+{VIACR, CR32, 0xFF, 0x00},
+{VIACR, CR33, 0x7F, 0x00},
+{VIACR, CR34, 0xFF, 0x00},
+{VIACR, CR35, 0xFF, 0x00},
+{VIACR, CR36, 0x08, 0x00},
+{VIACR, CR69, 0xFF, 0x00},
+{VIACR, CR6A, 0xFD, 0x60},
+{VIACR, CR6B, 0xFF, 0x00},
+{VIACR, CR6C, 0xFF, 0x00},
+{VIACR, CR7A, 0xFF, 0x01}, /* LCD Scaling Parameter 1 */
+{VIACR, CR7B, 0xFF, 0x02}, /* LCD Scaling Parameter 2 */
+{VIACR, CR7C, 0xFF, 0x03}, /* LCD Scaling Parameter 3 */
+{VIACR, CR7D, 0xFF, 0x04}, /* LCD Scaling Parameter 4 */
+{VIACR, CR7E, 0xFF, 0x07}, /* LCD Scaling Parameter 5 */
+{VIACR, CR7F, 0xFF, 0x0A}, /* LCD Scaling Parameter 6 */
+{VIACR, CR80, 0xFF, 0x0D}, /* LCD Scaling Parameter 7 */
+{VIACR, CR81, 0xFF, 0x13}, /* LCD Scaling Parameter 8 */
+{VIACR, CR82, 0xFF, 0x16}, /* LCD Scaling Parameter 9 */
+{VIACR, CR83, 0xFF, 0x19}, /* LCD Scaling Parameter 10 */
+{VIACR, CR84, 0xFF, 0x1C}, /* LCD Scaling Parameter 11 */
+{VIACR, CR85, 0xFF, 0x1D}, /* LCD Scaling Parameter 12 */
+{VIACR, CR86, 0xFF, 0x1E}, /* LCD Scaling Parameter 13 */
+{VIACR, CR87, 0xFF, 0x1F}, /* LCD Scaling Parameter 14 */
+{VIACR, CR88, 0xFF, 0x40}, /* LCD Panel Type */
+{VIACR, CR89, 0xFF, 0x00}, /* LCD Timing Control 0 */
+{VIACR, CR8A, 0xFF, 0x88}, /* LCD Timing Control 1 */
+{VIACR, CRD4, 0xFF, 0x81}, /* Second power sequence control */
+{VIACR, CR91, 0xFF, 0x80}, /* 24/12 bit LVDS Data off */
+{VIACR, CR96, 0xFF, 0x00},
+{VIACR, CR97, 0xFF, 0x00},
+{VIACR, CR99, 0xFF, 0x00},
+{VIACR, CR9B, 0xFF, 0x00},
+{VIACR, CRD2, 0xFF, 0xFF} /* TMDS/LVDS control register. */
+};
+
/* Video Mode Table */
/* Common Setting for Video Mode */
struct io_reg CLE266_ModeXregs[] = { {VIASR, SR1E, 0xF0, 0x00},
diff --git a/drivers/video/via/viamode.h b/drivers/video/via/viamode.h
index 1a5de50..3636694 100644
--- a/drivers/video/via/viamode.h
+++ b/drivers/video/via/viamode.h
@@ -57,6 +57,7 @@ struct res_map_refresh {
#define NUM_TOTAL_KM400_ModeXregs ARRAY_SIZE(KM400_ModeXregs)
#define NUM_TOTAL_CX700_ModeXregs ARRAY_SIZE(CX700_ModeXregs)
#define NUM_TOTAL_VX800_ModeXregs ARRAY_SIZE(VX800_ModeXregs)
+#define NUM_TOTAL_VX855_ModeXregs ARRAY_SIZE(VX855_ModeXregs)
#define NUM_TOTAL_CLE266_ModeXregs ARRAY_SIZE(CLE266_ModeXregs)
#define NUM_TOTAL_PATCH_MODE ARRAY_SIZE(res_patch_table)
#define NUM_TOTAL_MODETABLE ARRAY_SIZE(CLE266Modes)
@@ -170,6 +171,7 @@ extern struct io_reg CN700_ModeXregs[66];
extern struct io_reg KM400_ModeXregs[55];
extern struct io_reg CX700_ModeXregs[58];
extern struct io_reg VX800_ModeXregs[58];
+extern struct io_reg VX855_ModeXregs[52];
extern struct io_reg CLE266_ModeXregs[32];
extern struct io_reg PM1024x768[2];
extern struct patch_table res_patch_table[1];
--
1.6.2.4
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables
unlimited royalty-free distribution of the report engine
for externally facing server and web deployment.
http://p.sf.net/sfu/businessobjects
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [PATCH 04/15] [FB] viafb: Fix various resource leaks during module_init()
2009-05-20 20:28 ` [PATCH 03/15] [FB] viafb: Add support for the VX855 chipset Harald Welte
@ 2009-05-20 20:28 ` Harald Welte
2009-05-20 20:28 ` [PATCH 05/15] [FB] viafb: make viafb a first-class citizen using pci_driver Harald Welte
2009-05-23 6:53 ` [PATCH 04/15] [FB] viafb: Fix various resource leaks during module_init() Krzysztof Helt
2009-05-23 6:54 ` [PATCH 03/15] [FB] viafb: Add support for the VX855 chipset Krzysztof Helt
1 sibling, 2 replies; 33+ messages in thread
From: Harald Welte @ 2009-05-20 20:28 UTC (permalink / raw)
To: linux-fbdev-devel; +Cc: Harald Welte
From: Harald Welte <laforge@gnumonks.org>
The current code executed from module_init() in viafb does not have
proper error checking and [partial] resoure release paths in case
an error happens half way through driver initialization.
This patch adresses the most obvious of those issues, such as a
leftover i2c bus if module_init (and thus module load) fails.
Signed-off-by: Harald Welte <HaraldWelte@viatech.com>
---
drivers/video/via/viafbdev.c | 52 ++++++++++++++++++++++++++++++-----------
1 files changed, 38 insertions(+), 14 deletions(-)
diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c
index 02e7a72..72387d4 100644
--- a/drivers/video/via/viafbdev.c
+++ b/drivers/video/via/viafbdev.c
@@ -1,5 +1,5 @@
/*
- * Copyright 1998-2008 VIA Technologies, Inc. All Rights Reserved.
+ * Copyright 1998-2009 VIA Technologies, Inc. All Rights Reserved.
* Copyright 2001-2008 S3 Graphics, Inc. All Rights Reserved.
* This program is free software; you can redistribute it and/or
@@ -2109,7 +2109,7 @@ static int __devinit via_pci_probe(void)
unsigned long default_xres, default_yres;
char *tmpc, *tmpm;
char *tmpc_sec, *tmpm_sec;
- int vmode_index;
+ int rc, vmode_index;
u32 tmds_length, lvds_length, crt_length, chip_length, viafb_par_length;
DEBUG_MSG(KERN_INFO "VIAFB PCI Probe!!\n");
@@ -2130,7 +2130,7 @@ static int __devinit via_pci_probe(void)
tmds_length + crt_length + chip_length, NULL);
if (!viafbinfo) {
printk(KERN_ERR"Could not allocate memory for viafb_info.\n");
- return -ENODEV;
+ return -ENOMEM;
}
viaparinfo = (struct viafb_par *)viafbinfo->par;
@@ -2157,7 +2157,9 @@ static int __devinit via_pci_probe(void)
viafb_dual_fb = 0;
/* Set up I2C bus stuff */
- viafb_create_i2c_bus(viaparinfo);
+ rc = viafb_create_i2c_bus(viaparinfo);
+ if (rc)
+ goto out_fb_release;
viafb_init_chip_info();
viafb_get_fb_info(&viaparinfo->fbmem, &viaparinfo->memsize);
@@ -2169,7 +2171,8 @@ static int __devinit via_pci_probe(void)
if (!viaparinfo->fbmem_virt) {
printk(KERN_INFO "ioremap failed\n");
- return -1;
+ rc = -EIO;
+ goto out_delete_i2c;
}
viafb_get_mmio_info(&viaparinfo->mmio_base, &viaparinfo->mmio_len);
@@ -2281,8 +2284,7 @@ static int __devinit via_pci_probe(void)
if (!viafbinfo1) {
printk(KERN_ERR
"allocate the second framebuffer struct error\n");
- framebuffer_release(viafbinfo);
- return -ENOMEM;
+ goto out_delete_i2c;
}
viaparinfo1 = viafbinfo1->par;
memcpy(viaparinfo1, viaparinfo, viafb_par_length);
@@ -2343,21 +2345,26 @@ static int __devinit via_pci_probe(void)
viafb_update_viafb_par(viafbinfo);
viafb_update_fix(&viafbinfo->fix, viafbinfo);
default_var.activate = FB_ACTIVATE_NOW;
- fb_alloc_cmap(&viafbinfo->cmap, 256, 0);
+ rc = fb_alloc_cmap(&viafbinfo->cmap, 256, 0);
+ if (rc)
+ goto out_fb1_release;
if (viafb_dual_fb && (viafb_primary_dev == LCD_Device)
&& (viaparinfo->chip_info->gfx_chip_name == UNICHROME_CLE266)) {
- if (register_framebuffer(viafbinfo1) < 0)
- return -EINVAL;
+ rc = register_framebuffer(viafbinfo1);
+ if (rc)
+ goto out_dealloc_cmap;
}
- if (register_framebuffer(viafbinfo) < 0)
- return -EINVAL;
+ rc = register_framebuffer(viafbinfo);
+ if (rc)
+ goto out_fb1_unreg_lcd_cle266;
if (viafb_dual_fb && ((viafb_primary_dev != LCD_Device)
|| (viaparinfo->chip_info->gfx_chip_name !=
UNICHROME_CLE266))) {
- if (register_framebuffer(viafbinfo1) < 0)
- return -EINVAL;
+ rc = register_framebuffer(viafbinfo1);
+ if (rc)
+ goto out_fb_unreg;
}
DEBUG_MSG(KERN_INFO "fb%d: %s frame buffer device %dx%d-%dbpp\n",
viafbinfo->node, viafbinfo->fix.id, default_var.xres,
@@ -2366,6 +2373,23 @@ static int __devinit via_pci_probe(void)
viafb_init_proc(&viaparinfo->proc_entry);
viafb_init_dac(IGA2);
return 0;
+
+out_fb_unreg:
+ unregister_framebuffer(viafbinfo);
+out_fb1_unreg_lcd_cle266:
+ if (viafb_dual_fb && (viafb_primary_dev == LCD_Device)
+ && (viaparinfo->chip_info->gfx_chip_name == UNICHROME_CLE266))
+ unregister_framebuffer(viafbinfo1);
+out_dealloc_cmap:
+ fb_dealloc_cmap(&viafbinfo->cmap);
+out_fb1_release:
+ if (viafbinfo1)
+ framebuffer_release(viafbinfo1);
+out_delete_i2c:
+ viafb_delete_i2c_buss(viaparinfo);
+out_fb_release:
+ framebuffer_release(viafbinfo);
+ return rc;
}
static void __devexit via_pci_remove(void)
--
1.6.2.4
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables
unlimited royalty-free distribution of the report engine
for externally facing server and web deployment.
http://p.sf.net/sfu/businessobjects
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [PATCH 05/15] [FB] viafb: make viafb a first-class citizen using pci_driver
2009-05-20 20:28 ` [PATCH 04/15] [FB] viafb: Fix various resource leaks during module_init() Harald Welte
@ 2009-05-20 20:28 ` Harald Welte
2009-05-20 20:28 ` [PATCH 06/15] viafb: pass reference to pci device when calling framebuffer_alloc() Harald Welte
2009-05-23 6:53 ` [PATCH 05/15] [FB] viafb: make viafb a first-class citizen using pci_driver Krzysztof Helt
2009-05-23 6:53 ` [PATCH 04/15] [FB] viafb: Fix various resource leaks during module_init() Krzysztof Helt
1 sibling, 2 replies; 33+ messages in thread
From: Harald Welte @ 2009-05-20 20:28 UTC (permalink / raw)
To: linux-fbdev-devel
From: Harald Welte <laforge@gnumonks.org>
---
drivers/video/via/hw.c | 116 +++--------------------------------------
drivers/video/via/hw.h | 7 +--
drivers/video/via/viafbdev.c | 65 ++++++++++++++++++++---
3 files changed, 68 insertions(+), 120 deletions(-)
diff --git a/drivers/video/via/hw.c b/drivers/video/via/hw.c
index b111b6c..6306c88 100644
--- a/drivers/video/via/hw.c
+++ b/drivers/video/via/hw.c
@@ -21,22 +21,6 @@
#include "global.h"
-static const struct pci_device_id_info pciidlist[] = {
- {PCI_VIA_VENDOR_ID, UNICHROME_CLE266_DID, UNICHROME_CLE266},
- {PCI_VIA_VENDOR_ID, UNICHROME_PM800_DID, UNICHROME_PM800},
- {PCI_VIA_VENDOR_ID, UNICHROME_K400_DID, UNICHROME_K400},
- {PCI_VIA_VENDOR_ID, UNICHROME_K800_DID, UNICHROME_K800},
- {PCI_VIA_VENDOR_ID, UNICHROME_CN700_DID, UNICHROME_CN700},
- {PCI_VIA_VENDOR_ID, UNICHROME_P4M890_DID, UNICHROME_P4M890},
- {PCI_VIA_VENDOR_ID, UNICHROME_K8M890_DID, UNICHROME_K8M890},
- {PCI_VIA_VENDOR_ID, UNICHROME_CX700_DID, UNICHROME_CX700},
- {PCI_VIA_VENDOR_ID, UNICHROME_P4M900_DID, UNICHROME_P4M900},
- {PCI_VIA_VENDOR_ID, UNICHROME_CN750_DID, UNICHROME_CN750},
- {PCI_VIA_VENDOR_ID, UNICHROME_VX800_DID, UNICHROME_VX800},
- {PCI_VIA_VENDOR_ID, UNICHROME_VX855_DID, UNICHROME_VX855},
- {0, 0, 0}
-};
-
struct offset offset_reg = {
/* IGA1 Offset Register */
{IGA1_OFFSET_REG_NUM, {{CR13, 0, 7}, {CR35, 5, 7} } },
@@ -549,7 +533,8 @@ static void set_dvi_output_path(int set_iga, int output_interface);
static void set_lcd_output_path(int set_iga, int output_interface);
static int search_mode_setting(int ModeInfoIndex);
static void load_fix_bit_crtc_reg(void);
-static void init_gfx_chip_info(void);
+static void init_gfx_chip_info(struct pci_dev *pdev,
+ const struct pci_device_id *pdi);
static void init_tmds_chip_info(void);
static void init_lvds_chip_info(void);
static void device_screen_off(void);
@@ -559,7 +544,6 @@ static void device_off(void);
static void device_on(void);
static void enable_second_display_channel(void);
static void disable_second_display_channel(void);
-static int get_fb_size_from_pci(void);
void viafb_write_reg(u8 index, u16 io_port, u8 data)
{
@@ -1996,9 +1980,10 @@ void viafb_fill_crtc_timing(struct crt_mode_table *crt_table,
}
-void viafb_init_chip_info(void)
+void viafb_init_chip_info(struct pci_dev *pdev,
+ const struct pci_device_id *pdi)
{
- init_gfx_chip_info();
+ init_gfx_chip_info(pdev, pdi);
init_tmds_chip_info();
init_lvds_chip_info();
@@ -2071,24 +2056,12 @@ void viafb_update_device_setting(int hres, int vres,
}
}
-static void init_gfx_chip_info(void)
+static void init_gfx_chip_info(struct pci_dev *pdev,
+ const struct pci_device_id *pdi)
{
- struct pci_dev *pdev = NULL;
- u32 i;
u8 tmp;
- /* Indentify GFX Chip Name */
- for (i = 0; pciidlist[i].vendor != 0; i++) {
- pdev = pci_get_device(pciidlist[i].vendor,
- pciidlist[i].device, 0);
- if (pdev)
- break;
- }
-
- if (!pciidlist[i].vendor)
- return ;
-
- viaparinfo->chip_info->gfx_chip_name = pciidlist[i].chip_index;
+ viaparinfo->chip_info->gfx_chip_name = pdi->driver_data;
/* Check revision of CLE266 Chip */
if (viaparinfo->chip_info->gfx_chip_name == UNICHROME_CLE266) {
@@ -2119,8 +2092,6 @@ static void init_gfx_chip_info(void)
CX700_REVISION_700;
}
}
-
- pci_dev_put(pdev);
}
static void init_tmds_chip_info(void)
@@ -2612,38 +2583,6 @@ void viafb_crt_enable(void)
viafb_write_reg_mask(CR36, VIACR, 0x0, BIT5 + BIT4);
}
-void viafb_get_mmio_info(unsigned long *mmio_base,
- unsigned long *mmio_len)
-{
- struct pci_dev *pdev = NULL;
- u32 vendor, device;
- u32 i;
-
- for (i = 0; pciidlist[i].vendor != 0; i++)
- if (viaparinfo->chip_info->gfx_chip_name ==
- pciidlist[i].chip_index)
- break;
-
- if (!pciidlist[i].vendor)
- return ;
-
- vendor = pciidlist[i].vendor;
- device = pciidlist[i].device;
-
- pdev = pci_get_device(vendor, device, NULL);
-
- if (!pdev) {
- *mmio_base = 0;
- *mmio_len = 0;
- return ;
- }
-
- *mmio_base = pci_resource_start(pdev, 1);
- *mmio_len = pci_resource_len(pdev, 1);
-
- pci_dev_put(pdev);
-}
-
static void enable_second_display_channel(void)
{
/* to enable second display channel. */
@@ -2660,44 +2599,7 @@ static void disable_second_display_channel(void)
viafb_write_reg_mask(CR6A, VIACR, BIT6, BIT6);
}
-void viafb_get_fb_info(unsigned int *fb_base, unsigned int *fb_len)
-{
- struct pci_dev *pdev = NULL;
- u32 vendor, device;
- u32 i;
-
- for (i = 0; pciidlist[i].vendor != 0; i++)
- if (viaparinfo->chip_info->gfx_chip_name ==
- pciidlist[i].chip_index)
- break;
-
- if (!pciidlist[i].vendor)
- return ;
-
- vendor = pciidlist[i].vendor;
- device = pciidlist[i].device;
-
- pdev = pci_get_device(vendor, device, NULL);
-
- if (!pdev) {
- *fb_base = viafb_read_reg(VIASR, SR30) << 24;
- *fb_len = viafb_get_memsize();
- DEBUG_MSG(KERN_INFO "Get FB info from SR30!\n");
- DEBUG_MSG(KERN_INFO "fb_base = %08x\n", *fb_base);
- DEBUG_MSG(KERN_INFO "fb_len = %08x\n", *fb_len);
- return ;
- }
-
- *fb_base = (unsigned int)pci_resource_start(pdev, 0);
- *fb_len = get_fb_size_from_pci();
- DEBUG_MSG(KERN_INFO "Get FB info from PCI system!\n");
- DEBUG_MSG(KERN_INFO "fb_base = %08x\n", *fb_base);
- DEBUG_MSG(KERN_INFO "fb_len = %08x\n", *fb_len);
-
- pci_dev_put(pdev);
-}
-
-static int get_fb_size_from_pci(void)
+int viafb_get_fb_size_from_pci(void)
{
unsigned long configid, deviceid, FBSize = 0;
int VideoMemSize;
diff --git a/drivers/video/via/hw.h b/drivers/video/via/hw.h
index 22786a5..1cd0648 100644
--- a/drivers/video/via/hw.h
+++ b/drivers/video/via/hw.h
@@ -931,17 +931,16 @@ void viafb_set_dpa_gfx(int output_interface, struct GFX_DPA_SETTING\
int viafb_setmode(int vmode_index, int hor_res, int ver_res,
int video_bpp, int vmode_index1, int hor_res1,
int ver_res1, int video_bpp1);
-void viafb_init_chip_info(void);
+void viafb_init_chip_info(struct pci_dev *pdev,
+ const struct pci_device_id *pdi);
void viafb_init_dac(int set_iga);
int viafb_get_pixclock(int hres, int vres, int vmode_refresh);
int viafb_get_refresh(int hres, int vres, u32 float_refresh);
void viafb_update_device_setting(int hres, int vres, int bpp,
int vmode_refresh, int flag);
-void viafb_get_mmio_info(unsigned long *mmio_base,
- unsigned long *mmio_len);
+int viafb_get_fb_size_from_pci(void);
void viafb_set_iga_path(void);
void viafb_set_start_addr(void);
-void viafb_get_fb_info(unsigned int *fb_base, unsigned int *fb_len);
#endif /* __HW_H__ */
diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c
index 72387d4..3040dd9 100644
--- a/drivers/video/via/viafbdev.c
+++ b/drivers/video/via/viafbdev.c
@@ -2104,7 +2104,8 @@ static void viafb_remove_proc(struct proc_dir_entry *viafb_entry)
remove_proc_entry("viafb", NULL);
}
-static int __devinit via_pci_probe(void)
+static int __devinit via_pci_probe(struct pci_dev *pdev,
+ const struct pci_device_id *ent)
{
unsigned long default_xres, default_yres;
char *tmpc, *tmpm;
@@ -2161,8 +2162,9 @@ static int __devinit via_pci_probe(void)
if (rc)
goto out_fb_release;
- viafb_init_chip_info();
- viafb_get_fb_info(&viaparinfo->fbmem, &viaparinfo->memsize);
+ viafb_init_chip_info(pdev, ent);
+ viaparinfo->fbmem = pci_resource_start(pdev, 0);
+ viaparinfo->memsize = viafb_get_fb_size_from_pci();
viaparinfo->fbmem_free = viaparinfo->memsize;
viaparinfo->fbmem_used = 0;
viaparinfo->fbmem_virt = ioremap_nocache(viaparinfo->fbmem,
@@ -2170,14 +2172,20 @@ static int __devinit via_pci_probe(void)
viafbinfo->screen_base = (char *)viaparinfo->fbmem_virt;
if (!viaparinfo->fbmem_virt) {
- printk(KERN_INFO "ioremap failed\n");
+ printk(KERN_ERR "ioremap of fbmem failed\n");
rc = -EIO;
goto out_delete_i2c;
}
- viafb_get_mmio_info(&viaparinfo->mmio_base, &viaparinfo->mmio_len);
+ viaparinfo->mmio_base = pci_resource_start(pdev, 1);
+ viaparinfo->mmio_len = pci_resource_len(pdev, 1);
viaparinfo->io_virt = ioremap_nocache(viaparinfo->mmio_base,
viaparinfo->mmio_len);
+ if (!viaparinfo->io_virt) {
+ printk(KERN_ERR "ioremap of MMIO failed\n");
+ rc = -EIO;
+ goto out_unmap_fbmem;
+ }
viafbinfo->node = 0;
viafbinfo->fbops = &viafb_ops;
@@ -2284,7 +2292,8 @@ static int __devinit via_pci_probe(void)
if (!viafbinfo1) {
printk(KERN_ERR
"allocate the second framebuffer struct error\n");
- goto out_delete_i2c;
+ rc = -ENOMEM;
+ goto out_unmap_mmio;
}
viaparinfo1 = viafbinfo1->par;
memcpy(viaparinfo1, viaparinfo, viafb_par_length);
@@ -2385,6 +2394,10 @@ out_dealloc_cmap:
out_fb1_release:
if (viafbinfo1)
framebuffer_release(viafbinfo1);
+out_unmap_mmio:
+ iounmap(viaparinfo->io_virt);
+out_unmap_fbmem:
+ iounmap((void *)viaparinfo->fbmem_virt);
out_delete_i2c:
viafb_delete_i2c_buss(viaparinfo);
out_fb_release:
@@ -2392,7 +2405,7 @@ out_fb_release:
return rc;
}
-static void __devexit via_pci_remove(void)
+static void __devexit via_pci_remove(struct pci_dev *pdev)
{
DEBUG_MSG(KERN_INFO "via_pci_remove!\n");
fb_dealloc_cmap(&viafbinfo->cmap);
@@ -2486,6 +2499,40 @@ static int __init viafb_setup(char *options)
}
#endif
+static struct pci_device_id viafb_pci_table[] __devinitdata = {
+ { PCI_DEVICE(PCI_VENDOR_ID_VIA, UNICHROME_CLE266_DID),
+ .driver_data = UNICHROME_CLE266 },
+ { PCI_DEVICE(PCI_VENDOR_ID_VIA, UNICHROME_PM800_DID),
+ .driver_data = UNICHROME_PM800 },
+ { PCI_DEVICE(PCI_VENDOR_ID_VIA, UNICHROME_K400_DID),
+ .driver_data = UNICHROME_K400 },
+ { PCI_DEVICE(PCI_VENDOR_ID_VIA, UNICHROME_K800_DID),
+ .driver_data = UNICHROME_K800 },
+ { PCI_DEVICE(PCI_VENDOR_ID_VIA, UNICHROME_P4M890_DID),
+ .driver_data = UNICHROME_CN700 },
+ { PCI_DEVICE(PCI_VENDOR_ID_VIA, UNICHROME_K8M890_DID),
+ .driver_data = UNICHROME_K8M890 },
+ { PCI_DEVICE(PCI_VENDOR_ID_VIA, UNICHROME_CX700_DID),
+ .driver_data = UNICHROME_CX700 },
+ { PCI_DEVICE(PCI_VENDOR_ID_VIA, UNICHROME_P4M900_DID),
+ .driver_data = UNICHROME_P4M900 },
+ { PCI_DEVICE(PCI_VENDOR_ID_VIA, UNICHROME_CN750_DID),
+ .driver_data = UNICHROME_CN750 },
+ { PCI_DEVICE(PCI_VENDOR_ID_VIA, UNICHROME_VX800_DID),
+ .driver_data = UNICHROME_VX800 },
+ { PCI_DEVICE(PCI_VENDOR_ID_VIA, UNICHROME_VX855_DID),
+ .driver_data = UNICHROME_VX855 },
+ { }
+};
+MODULE_DEVICE_TABLE(pci, viafb_pci_table);
+
+static struct pci_driver viafb_driver = {
+ .name = "viafb",
+ .id_table = viafb_pci_table,
+ .probe = via_pci_probe,
+ .remove = __devexit_p(via_pci_remove),
+};
+
static int __init viafb_init(void)
{
#ifndef MODULE
@@ -2497,13 +2544,13 @@ static int __init viafb_init(void)
printk(KERN_INFO
"VIA Graphics Intergration Chipset framebuffer %d.%d initializing\n",
VERSION_MAJOR, VERSION_MINOR);
- return via_pci_probe();
+ return pci_register_driver(&viafb_driver);
}
static void __exit viafb_exit(void)
{
DEBUG_MSG(KERN_INFO "viafb_exit!\n");
- via_pci_remove();
+ pci_unregister_driver(&viafb_driver);
}
static struct fb_ops viafb_ops = {
--
1.6.2.4
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables
unlimited royalty-free distribution of the report engine
for externally facing server and web deployment.
http://p.sf.net/sfu/businessobjects
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [PATCH 06/15] viafb: pass reference to pci device when calling framebuffer_alloc()
2009-05-20 20:28 ` [PATCH 05/15] [FB] viafb: make viafb a first-class citizen using pci_driver Harald Welte
@ 2009-05-20 20:28 ` Harald Welte
2009-05-20 20:28 ` [PATCH 07/15] viafb: use proper pci config API Harald Welte
2009-05-23 6:52 ` [PATCH 06/15] viafb: pass reference to pci device when calling framebuffer_alloc() Krzysztof Helt
2009-05-23 6:53 ` [PATCH 05/15] [FB] viafb: make viafb a first-class citizen using pci_driver Krzysztof Helt
1 sibling, 2 replies; 33+ messages in thread
From: Harald Welte @ 2009-05-20 20:28 UTC (permalink / raw)
To: linux-fbdev-devel; +Cc: Harald Welte
From: Harald Welte <laforge@gnumonks.org>
Signed-off-by: Harald Welte <HaraldWelte@viatech.com>
---
drivers/video/via/viafbdev.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c
index 3040dd9..7e8f2f6 100644
--- a/drivers/video/via/viafbdev.c
+++ b/drivers/video/via/viafbdev.c
@@ -2128,7 +2128,8 @@ static int __devinit via_pci_probe(struct pci_dev *pdev,
* variables
*/
viafbinfo = framebuffer_alloc(viafb_par_length + 2 * lvds_length +
- tmds_length + crt_length + chip_length, NULL);
+ tmds_length + crt_length + chip_length,
+ &pdev->dev);
if (!viafbinfo) {
printk(KERN_ERR"Could not allocate memory for viafb_info.\n");
return -ENOMEM;
--
1.6.2.4
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables
unlimited royalty-free distribution of the report engine
for externally facing server and web deployment.
http://p.sf.net/sfu/businessobjects
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [PATCH 07/15] viafb: use proper pci config API
2009-05-20 20:28 ` [PATCH 06/15] viafb: pass reference to pci device when calling framebuffer_alloc() Harald Welte
@ 2009-05-20 20:28 ` Harald Welte
2009-05-20 20:28 ` [PATCH 08/15] viafb: get rid of some duplicated fields in private structure Harald Welte
2009-05-23 6:52 ` [PATCH 07/15] viafb: use proper pci config API Krzysztof Helt
2009-05-23 6:52 ` [PATCH 06/15] viafb: pass reference to pci device when calling framebuffer_alloc() Krzysztof Helt
1 sibling, 2 replies; 33+ messages in thread
From: Harald Welte @ 2009-05-20 20:28 UTC (permalink / raw)
To: linux-fbdev-devel; +Cc: Harald Welte
From: Harald Welte <laforge@gnumonks.org>
This patch alters viafb to use the proper Linux in-kernel API to access
PCI configuration space, rather than poking at I/O ports by itself.
Signed-off-by: Harald Welte <HaraldWelte@viatech.com>
---
drivers/video/via/hw.c | 64 +++++++++++++++++++++++++++++------------------
drivers/video/via/hw.h | 4 +-
2 files changed, 41 insertions(+), 27 deletions(-)
diff --git a/drivers/video/via/hw.c b/drivers/video/via/hw.c
index 6306c88..40b7c0c 100644
--- a/drivers/video/via/hw.c
+++ b/drivers/video/via/hw.c
@@ -2599,24 +2599,37 @@ static void disable_second_display_channel(void)
viafb_write_reg_mask(CR6A, VIACR, BIT6, BIT6);
}
+static u_int16_t via_function3[] = {
+ CLE266_FUNCTION3, KM400_FUNCTION3, CN400_FUNCTION3, CN700_FUNCTION3,
+ CX700_FUNCTION3, KM800_FUNCTION3, KM890_FUNCTION3, P4M890_FUNCTION3,
+ P4M900_FUNCTION3, VX800_FUNCTION3, VX855_FUNCTION3,
+};
+
+/* Get the BIOS-configured framebuffer size from PCI configuration space
+ * of function 3 in the respective chipset */
int viafb_get_fb_size_from_pci(void)
{
- unsigned long configid, deviceid, FBSize = 0;
- int VideoMemSize;
- int DeviceFound = false;
-
- for (configid = 0x80000000; configid < 0x80010800; configid += 0x100) {
- outl(configid, (unsigned long)0xCF8);
- deviceid = (inl((unsigned long)0xCFC) >> 16) & 0xffff;
-
- switch (deviceid) {
- case CLE266:
- case KM400:
- outl(configid + 0xE0, (unsigned long)0xCF8);
- FBSize = inl((unsigned long)0xCFC);
- DeviceFound = true; /* Found device id */
- break;
+ int i;
+ u_int8_t offset = 0;
+ u_int32_t FBSize;
+ u_int32_t VideoMemSize;
+
+ /* search for the "FUNCTION3" device in this chipset */
+ for (i = 0; i < ARRAY_SIZE(via_function3); i++) {
+ struct pci_dev *pdev;
+
+ pdev = pci_get_device(PCI_VENDOR_ID_VIA, via_function3[i],
+ NULL);
+ if (!pdev)
+ continue;
+
+ DEBUG_MSG(KERN_INFO "Device ID = %x\n", pdev->device);
+ switch (pdev->device) {
+ case CLE266_FUNCTION3:
+ case KM400_FUNCTION3:
+ offset = 0xE0;
+ break;
case CN400_FUNCTION3:
case CN700_FUNCTION3:
case CX700_FUNCTION3:
@@ -2626,21 +2639,22 @@ int viafb_get_fb_size_from_pci(void)
case P4M900_FUNCTION3:
case VX800_FUNCTION3:
case VX855_FUNCTION3:
- /*case CN750_FUNCTION3: */
- outl(configid + 0xA0, (unsigned long)0xCF8);
- FBSize = inl((unsigned long)0xCFC);
- DeviceFound = true; /* Found device id */
- break;
-
- default:
+ /*case CN750_FUNCTION3: */
+ offset = 0xA0;
break;
}
-
- if (DeviceFound)
+
+ if (!offset)
break;
+
+ pci_read_config_dword(pdev, offset, &FBSize);
+ pci_dev_put(pdev);
}
- DEBUG_MSG(KERN_INFO "Device ID = %lx\n", deviceid);
+ if (!offset) {
+ printk(KERN_ERR "cannot determine framebuffer size\n");
+ return -EIO;
+ }
FBSize = FBSize & 0x00007000;
DEBUG_MSG(KERN_INFO "FB Size = %x\n", FBSize);
diff --git a/drivers/video/via/hw.h b/drivers/video/via/hw.h
index 1cd0648..a69e907 100644
--- a/drivers/video/via/hw.h
+++ b/drivers/video/via/hw.h
@@ -850,8 +850,8 @@ struct iga2_crtc_timing {
};
/* device ID */
-#define CLE266 0x3123
-#define KM400 0x3205
+#define CLE266_FUNCTION3 0x3123
+#define KM400_FUNCTION3 0x3205
#define CN400_FUNCTION2 0x2259
#define CN400_FUNCTION3 0x3259
/* support VT3314 chipset */
--
1.6.2.4
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables
unlimited royalty-free distribution of the report engine
for externally facing server and web deployment.
http://p.sf.net/sfu/businessobjects
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [PATCH 08/15] viafb: get rid of some duplicated fields in private structure
2009-05-20 20:28 ` [PATCH 07/15] viafb: use proper pci config API Harald Welte
@ 2009-05-20 20:28 ` Harald Welte
2009-05-20 20:28 ` [PATCH 09/15] viafb: Remove MMIO from " Harald Welte
2009-05-23 6:34 ` [PATCH 08/15] viafb: get rid of some duplicated fields in " Krzysztof Helt
2009-05-23 6:52 ` [PATCH 07/15] viafb: use proper pci config API Krzysztof Helt
1 sibling, 2 replies; 33+ messages in thread
From: Harald Welte @ 2009-05-20 20:28 UTC (permalink / raw)
To: linux-fbdev-devel; +Cc: Harald Welte
From: Harald Welte <laforge@gnumonks.org>
Instead of using private structure members, we use the standard ones:
* viapar->fbmem converted to fb_info->fix.smem_start
* viapar->memsize is converted to fb_info->fix.smem_len
* viapar->fbmem_virt is convereted to fb_info->screen_base
Signed-off-by: Harald Welte <HaraldWelte@viatech.com>
---
drivers/video/via/global.c | 1 -
drivers/video/via/hw.c | 2 +-
drivers/video/via/viafbdev.c | 47 +++++++++++++++++++----------------------
drivers/video/via/viafbdev.h | 3 --
4 files changed, 23 insertions(+), 30 deletions(-)
diff --git a/drivers/video/via/global.c b/drivers/video/via/global.c
index 468be24..2b7d0d3 100644
--- a/drivers/video/via/global.c
+++ b/drivers/video/via/global.c
@@ -57,4 +57,3 @@ struct fb_info *viafbinfo;
struct fb_info *viafbinfo1;
struct viafb_par *viaparinfo;
struct viafb_par *viaparinfo1;
-
diff --git a/drivers/video/via/hw.c b/drivers/video/via/hw.c
index 40b7c0c..e06d6b7 100644
--- a/drivers/video/via/hw.c
+++ b/drivers/video/via/hw.c
@@ -680,7 +680,7 @@ void viafb_set_start_addr(void)
size = 8 * 1024 * 1024;
} else {
- size = viaparinfo1->memsize;
+ size = viafbinfo1->fix.smem_len;
}
offset = viafb_second_offset;
DEBUG_MSG(KERN_INFO
diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c
index 7e8f2f6..c420623 100644
--- a/drivers/video/via/viafbdev.c
+++ b/drivers/video/via/viafbdev.c
@@ -119,10 +119,8 @@ static int viafb_update_fix(struct fb_fix_screeninfo *fix, struct fb_info *info)
static void viafb_setup_fixinfo(struct fb_fix_screeninfo *fix,
struct viafb_par *viaparinfo)
{
- memset(fix, 0, sizeof(struct fb_fix_screeninfo));
strcpy(fix->id, viafb_name);
- fix->smem_start = viaparinfo->fbmem;
fix->smem_len = viaparinfo->fbmem_free;
fix->mmio_start = viaparinfo->mmio_base;
fix->mmio_len = viaparinfo->mmio_len;
@@ -196,7 +194,7 @@ static int viafb_check_var(struct fb_var_screeninfo *var,
/*32 pixel alignment */
var->xres_virtual = (var->xres_virtual + 31) & ~31;
if (var->xres_virtual * var->yres_virtual * var->bits_per_pixel / 8 >
- ppar->memsize)
+ info->fix.smem_len)
return -EINVAL;
/* Based on var passed in to calculate the refresh,
@@ -630,13 +628,13 @@ static int viafb_ioctl(struct fb_info *info, u_int cmd, u_long arg)
(viaparinfo->fbmem_free >> 1);
}
}
- u.viasamm.mem_base = viaparinfo->fbmem;
+ u.viasamm.mem_base = viafbinfo->fix.smem_start;
u.viasamm.offset_sec = viafb_second_offset;
} else {
u.viasamm.size_prim =
- viaparinfo->memsize - viaparinfo->fbmem_used;
+ viafbinfo->fix.smem_len - viaparinfo->fbmem_used;
u.viasamm.size_sec = 0;
- u.viasamm.mem_base = viaparinfo->fbmem;
+ u.viasamm.mem_base = viafbinfo->fix.smem_start;
u.viasamm.offset_sec = 0;
}
@@ -1245,7 +1243,7 @@ static int viafb_cursor(struct fb_info *info, struct fb_cursor *cursor)
}
}
- memcpy(((struct viafb_par *)(info->par))->fbmem_virt +
+ memcpy(info->screen_base +
((struct viafb_par *)(info->par))->cursor_start,
cr_data->bak, CURSOR_SIZE);
out:
@@ -2164,15 +2162,14 @@ static int __devinit via_pci_probe(struct pci_dev *pdev,
goto out_fb_release;
viafb_init_chip_info(pdev, ent);
- viaparinfo->fbmem = pci_resource_start(pdev, 0);
- viaparinfo->memsize = viafb_get_fb_size_from_pci();
- viaparinfo->fbmem_free = viaparinfo->memsize;
+ viafbinfo->fix.smem_start = pci_resource_start(pdev, 0);
+ viafbinfo->fix.smem_len = viafb_get_fb_size_from_pci();
+ viaparinfo->fbmem_free = viafbinfo->fix.smem_len;
viaparinfo->fbmem_used = 0;
- viaparinfo->fbmem_virt = ioremap_nocache(viaparinfo->fbmem,
- viaparinfo->memsize);
- viafbinfo->screen_base = (char *)viaparinfo->fbmem_virt;
+ viafbinfo->screen_base = ioremap_nocache(viafbinfo->fix.smem_start,
+ viafbinfo->fix.smem_len);
- if (!viaparinfo->fbmem_virt) {
+ if (!viafbinfo->screen_base) {
printk(KERN_ERR "ioremap of fbmem failed\n");
rc = -EIO;
goto out_delete_i2c;
@@ -2208,7 +2205,7 @@ static int __devinit via_pci_probe(struct pci_dev *pdev,
viafb_second_size * 1024 * 1024;
}
- viafb_FB_MM = viaparinfo->fbmem_virt;
+ viafb_FB_MM = viafbinfo->screen_base;
tmpm = viafb_mode;
tmpc = strsep(&tmpm, "x");
strict_strtoul(tmpc, 0, &default_xres);
@@ -2298,17 +2295,18 @@ static int __devinit via_pci_probe(struct pci_dev *pdev,
}
viaparinfo1 = viafbinfo1->par;
memcpy(viaparinfo1, viaparinfo, viafb_par_length);
- viaparinfo1->memsize = viaparinfo->memsize -
- viafb_second_offset;
- viaparinfo->memsize = viafb_second_offset;
- viaparinfo1->fbmem_virt = viaparinfo->fbmem_virt +
+ viafbinfo1->fix.smem_len = viafbinfo->fix.smem_len -
+ viafb_second_offset;
+ viafbinfo->fix.smem_len = viafb_second_offset;
+ viafbinfo1->screen_base = viafbinfo->screen_base +
viafb_second_offset;
- viaparinfo1->fbmem = viaparinfo->fbmem + viafb_second_offset;
+ viafbinfo1->fix.smem_start = viafbinfo->fix.smem_start +
+ viafb_second_offset;
viaparinfo1->fbmem_used = viaparinfo->fbmem_used;
- viaparinfo1->fbmem_free = viaparinfo1->memsize -
+ viaparinfo1->fbmem_free = viafbinfo1->fix.smem_len -
viaparinfo1->fbmem_used;
- viaparinfo->fbmem_free = viaparinfo->memsize;
+ viaparinfo->fbmem_free = viafbinfo->fix.smem_len;
viaparinfo->fbmem_used = 0;
if (viafb_accel) {
viaparinfo1->cursor_start =
@@ -2322,7 +2320,6 @@ static int __devinit via_pci_probe(struct pci_dev *pdev,
memcpy(viafbinfo1, viafbinfo, sizeof(struct fb_info));
viafbinfo1->screen_base = viafbinfo->screen_base +
viafb_second_offset;
- viafbinfo1->fix.smem_start = viaparinfo1->fbmem;
viafbinfo1->fix.smem_len = viaparinfo1->fbmem_free;
default_var.xres = viafb_second_xres;
@@ -2398,7 +2395,7 @@ out_fb1_release:
out_unmap_mmio:
iounmap(viaparinfo->io_virt);
out_unmap_fbmem:
- iounmap((void *)viaparinfo->fbmem_virt);
+ iounmap((void *)viafbinfo->screen_base);
out_delete_i2c:
viafb_delete_i2c_buss(viaparinfo);
out_fb_release:
@@ -2413,7 +2410,7 @@ static void __devexit via_pci_remove(struct pci_dev *pdev)
unregister_framebuffer(viafbinfo);
if (viafb_dual_fb)
unregister_framebuffer(viafbinfo1);
- iounmap((void *)viaparinfo->fbmem_virt);
+ iounmap((void *)viafbinfo->screen_base);
iounmap(viaparinfo->io_virt);
viafb_delete_i2c_buss(viaparinfo);
diff --git a/drivers/video/via/viafbdev.h b/drivers/video/via/viafbdev.h
index a4158e8..ed4129e 100644
--- a/drivers/video/via/viafbdev.h
+++ b/drivers/video/via/viafbdev.h
@@ -45,10 +45,7 @@ struct viafb_par {
u32 xoffset;
u32 yoffset;
- void __iomem *fbmem_virt; /*framebuffer virtual memory address */
void __iomem *io_virt; /*iospace virtual memory address */
- unsigned int fbmem; /*framebuffer physical memory address */
- unsigned int memsize; /*size of fbmem */
unsigned int io; /*io space address */
unsigned long mmio_base; /*mmio base address */
unsigned long mmio_len; /*mmio base length */
--
1.6.2.4
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables
unlimited royalty-free distribution of the report engine
for externally facing server and web deployment.
http://p.sf.net/sfu/businessobjects
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [PATCH 09/15] viafb: Remove MMIO from private structure
2009-05-20 20:28 ` [PATCH 08/15] viafb: get rid of some duplicated fields in private structure Harald Welte
@ 2009-05-20 20:28 ` Harald Welte
2009-05-20 20:28 ` [PATCH 10/15] viafb: make module parameters visible in sysfs Harald Welte
2009-05-23 6:32 ` [PATCH 09/15] viafb: Remove MMIO from private structure Krzysztof Helt
2009-05-23 6:34 ` [PATCH 08/15] viafb: get rid of some duplicated fields in " Krzysztof Helt
1 sibling, 2 replies; 33+ messages in thread
From: Harald Welte @ 2009-05-20 20:28 UTC (permalink / raw)
To: linux-fbdev-devel; +Cc: Harald Welte
From: Harald Welte <laforge@gnumonks.org>
Rather than using our own private structure members for MMIO base
and length, we use the fb_info->fix ones.
Signed-off-by: Harald Welte <HaraldWelte@viatech.com>
---
drivers/video/via/viafbdev.c | 11 ++++-------
drivers/video/via/viafbdev.h | 2 --
2 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c
index c420623..00f58c8 100644
--- a/drivers/video/via/viafbdev.c
+++ b/drivers/video/via/viafbdev.c
@@ -122,9 +122,6 @@ static void viafb_setup_fixinfo(struct fb_fix_screeninfo *fix,
strcpy(fix->id, viafb_name);
fix->smem_len = viaparinfo->fbmem_free;
- fix->mmio_start = viaparinfo->mmio_base;
- fix->mmio_len = viaparinfo->mmio_len;
-
fix->type = FB_TYPE_PACKED_PIXELS;
fix->type_aux = 0;
@@ -2175,10 +2172,10 @@ static int __devinit via_pci_probe(struct pci_dev *pdev,
goto out_delete_i2c;
}
- viaparinfo->mmio_base = pci_resource_start(pdev, 1);
- viaparinfo->mmio_len = pci_resource_len(pdev, 1);
- viaparinfo->io_virt = ioremap_nocache(viaparinfo->mmio_base,
- viaparinfo->mmio_len);
+ viafbinfo->fix.mmio_start = pci_resource_start(pdev, 1);
+ viafbinfo->fix.mmio_len = pci_resource_len(pdev, 1);
+ viaparinfo->io_virt = ioremap_nocache(viafbinfo->fix.mmio_start,
+ viafbinfo->fix.mmio_len);
if (!viaparinfo->io_virt) {
printk(KERN_ERR "ioremap of MMIO failed\n");
rc = -EIO;
diff --git a/drivers/video/via/viafbdev.h b/drivers/video/via/viafbdev.h
index ed4129e..0c1d734 100644
--- a/drivers/video/via/viafbdev.h
+++ b/drivers/video/via/viafbdev.h
@@ -47,8 +47,6 @@ struct viafb_par {
void __iomem *io_virt; /*iospace virtual memory address */
unsigned int io; /*io space address */
- unsigned long mmio_base; /*mmio base address */
- unsigned long mmio_len; /*mmio base length */
u32 fbmem_free; /* Free FB memory */
u32 fbmem_used; /* Use FB memory size */
u32 cursor_start; /* Cursor Start Address */
--
1.6.2.4
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables
unlimited royalty-free distribution of the report engine
for externally facing server and web deployment.
http://p.sf.net/sfu/businessobjects
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [PATCH 10/15] viafb: make module parameters visible in sysfs
2009-05-20 20:28 ` [PATCH 09/15] viafb: Remove MMIO from " Harald Welte
@ 2009-05-20 20:28 ` Harald Welte
2009-05-20 20:28 ` [PATCH 11/15] viafb: clean up duplicated code from 2D acceleration Harald Welte
2009-05-23 6:32 ` [PATCH 10/15] viafb: make module parameters visible in sysfs Krzysztof Helt
2009-05-23 6:32 ` [PATCH 09/15] viafb: Remove MMIO from private structure Krzysztof Helt
1 sibling, 2 replies; 33+ messages in thread
From: Harald Welte @ 2009-05-20 20:28 UTC (permalink / raw)
To: linux-fbdev-devel; +Cc: Harald Welte
From: Harald Welte <laforge@gnumonks.org>
Signed-off-by: Harald Welte <HaraldWelte@viatech.com>
---
drivers/video/via/viafbdev.c | 45 +++++++++++++++++++++--------------------
1 files changed, 23 insertions(+), 22 deletions(-)
diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c
index 00f58c8..980eab8 100644
--- a/drivers/video/via/viafbdev.c
+++ b/drivers/video/via/viafbdev.c
@@ -20,6 +20,7 @@
*/
#include <linux/module.h>
+#include <linux/stat.h>
#define _MASTER_FILE
#include "global.h"
@@ -2570,82 +2571,82 @@ module_init(viafb_init);
module_exit(viafb_exit);
#ifdef MODULE
-module_param(viafb_memsize, int, 0);
+module_param(viafb_memsize, int, S_IRUSR);
-module_param(viafb_mode, charp, 0);
+module_param(viafb_mode, charp, S_IRUSR);
MODULE_PARM_DESC(viafb_mode, "Set resolution (default=640x480)");
-module_param(viafb_mode1, charp, 0);
+module_param(viafb_mode1, charp, S_IRUSR);
MODULE_PARM_DESC(viafb_mode1, "Set resolution (default=640x480)");
-module_param(viafb_bpp, int, 0);
+module_param(viafb_bpp, int, S_IRUSR);
MODULE_PARM_DESC(viafb_bpp, "Set color depth (default=32bpp)");
-module_param(viafb_bpp1, int, 0);
+module_param(viafb_bpp1, int, S_IRUSR);
MODULE_PARM_DESC(viafb_bpp1, "Set color depth (default=32bpp)");
-module_param(viafb_refresh, int, 0);
+module_param(viafb_refresh, int, S_IRUSR);
MODULE_PARM_DESC(viafb_refresh,
"Set CRT viafb_refresh rate (default = 60)");
-module_param(viafb_refresh1, int, 0);
+module_param(viafb_refresh1, int, S_IRUSR);
MODULE_PARM_DESC(viafb_refresh1,
"Set CRT refresh rate (default = 60)");
-module_param(viafb_lcd_panel_id, int, 0);
+module_param(viafb_lcd_panel_id, int, S_IRUSR);
MODULE_PARM_DESC(viafb_lcd_panel_id,
"Set Flat Panel type(Default=1024x768)");
-module_param(viafb_lcd_dsp_method, int, 0);
+module_param(viafb_lcd_dsp_method, int, S_IRUSR);
MODULE_PARM_DESC(viafb_lcd_dsp_method,
"Set Flat Panel display scaling method.(Default=Expandsion)");
-module_param(viafb_SAMM_ON, int, 0);
+module_param(viafb_SAMM_ON, int, S_IRUSR);
MODULE_PARM_DESC(viafb_SAMM_ON,
"Turn on/off flag of SAMM(Default=OFF)");
-module_param(viafb_accel, int, 0);
+module_param(viafb_accel, int, S_IRUSR);
MODULE_PARM_DESC(viafb_accel,
"Set 2D Hardware Acceleration.(Default = OFF)");
-module_param(viafb_active_dev, charp, 0);
+module_param(viafb_active_dev, charp, S_IRUSR);
MODULE_PARM_DESC(viafb_active_dev, "Specify active devices.");
-module_param(viafb_display_hardware_layout, int, 0);
+module_param(viafb_display_hardware_layout, int, S_IRUSR);
MODULE_PARM_DESC(viafb_display_hardware_layout,
"Display Hardware Layout (LCD Only, DVI Only...,etc)");
-module_param(viafb_second_size, int, 0);
+module_param(viafb_second_size, int, S_IRUSR);
MODULE_PARM_DESC(viafb_second_size,
"Set secondary device memory size");
-module_param(viafb_dual_fb, int, 0);
+module_param(viafb_dual_fb, int, S_IRUSR);
MODULE_PARM_DESC(viafb_dual_fb,
"Turn on/off flag of dual framebuffer devices.(Default = OFF)");
-module_param(viafb_platform_epia_dvi, int, 0);
+module_param(viafb_platform_epia_dvi, int, S_IRUSR);
MODULE_PARM_DESC(viafb_platform_epia_dvi,
"Turn on/off flag of DVI devices on EPIA board.(Default = OFF)");
-module_param(viafb_device_lcd_dualedge, int, 0);
+module_param(viafb_device_lcd_dualedge, int, S_IRUSR);
MODULE_PARM_DESC(viafb_device_lcd_dualedge,
"Turn on/off flag of dual edge panel.(Default = OFF)");
-module_param(viafb_bus_width, int, 0);
+module_param(viafb_bus_width, int, S_IRUSR);
MODULE_PARM_DESC(viafb_bus_width,
"Set bus width of panel.(Default = 12)");
-module_param(viafb_lcd_mode, int, 0);
+module_param(viafb_lcd_mode, int, S_IRUSR);
MODULE_PARM_DESC(viafb_lcd_mode,
"Set Flat Panel mode(Default=OPENLDI)");
-module_param(viafb_video_dev, charp, 0);
+module_param(viafb_video_dev, charp, S_IRUSR);
MODULE_PARM_DESC(viafb_video_dev, "Specify video devices.");
-module_param(viafb_lcd_port, charp, 0);
+module_param(viafb_lcd_port, charp, S_IRUSR);
MODULE_PARM_DESC(viafb_lcd_port, "Specify LCD output port.");
-module_param(viafb_dvi_port, charp, 0);
+module_param(viafb_dvi_port, charp, S_IRUSR);
MODULE_PARM_DESC(viafb_dvi_port, "Specify DVI output port.");
MODULE_LICENSE("GPL");
--
1.6.2.4
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables
unlimited royalty-free distribution of the report engine
for externally facing server and web deployment.
http://p.sf.net/sfu/businessobjects
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [PATCH 11/15] viafb: clean up duplicated code from 2D acceleration
2009-05-20 20:28 ` [PATCH 10/15] viafb: make module parameters visible in sysfs Harald Welte
@ 2009-05-20 20:28 ` Harald Welte
2009-05-20 20:28 ` [PATCH 12/15] viafb: introduce wrapper for 2D engine registers Harald Welte
2009-05-23 6:28 ` [PATCH 11/15] viafb: clean up duplicated code from 2D acceleration Krzysztof Helt
2009-05-23 6:32 ` [PATCH 10/15] viafb: make module parameters visible in sysfs Krzysztof Helt
1 sibling, 2 replies; 33+ messages in thread
From: Harald Welte @ 2009-05-20 20:28 UTC (permalink / raw)
To: linux-fbdev-devel; +Cc: Harald Welte
From: Harald Welte <laforge@gnumonks.org>
There are four parts of the viafb code who initialize the bigtblit
screen base and pitch, some of them actually broken. This patch
unifies them in one function called viafb_set_2d_mode() which
replaces and enhances the old function to just set the bpp.
Signed-off-by: Harald Welte <HaraldWelte@viatech.com>
---
drivers/video/via/accel.c | 35 ++++++++++++-----------
drivers/video/via/accel.h | 2 +-
drivers/video/via/viafbdev.c | 62 +++++-------------------------------------
3 files changed, 26 insertions(+), 73 deletions(-)
diff --git a/drivers/video/via/accel.c b/drivers/video/via/accel.c
index 45c54bf..4a1183f 100644
--- a/drivers/video/via/accel.c
+++ b/drivers/video/via/accel.c
@@ -191,26 +191,18 @@ void viafb_init_2d_engine(void)
}
}
- viafb_set_2d_color_depth(viaparinfo->bpp);
-
- writel(0x0, viaparinfo->io_virt + VIA_REG_SRCBASE);
- writel(0x0, viaparinfo->io_virt + VIA_REG_DSTBASE);
-
- writel(VIA_PITCH_ENABLE |
- (((viaparinfo->hres *
- viaparinfo->bpp >> 3) >> 3) | (((viaparinfo->hres *
- viaparinfo->
- bpp >> 3) >> 3) << 16)),
- viaparinfo->io_virt + VIA_REG_PITCH);
+ viafb_set_2d_mode(viafbinfo);
}
-void viafb_set_2d_color_depth(int bpp)
+/* Set the mode-specific parameters for the 2D acceleration, such as
+ * BPP, source and destination base, as well as pitch */
+void viafb_set_2d_mode(struct fb_info *info)
{
- u32 dwGEMode;
+ u32 dwGEMode, pitch, pitch_reg, base;
+ /* Set BPP */
dwGEMode = readl(viaparinfo->io_virt + 0x04) & 0xFFFFFCFF;
-
- switch (bpp) {
+ switch (viaparinfo->bpp) {
case 16:
dwGEMode |= VIA_GEM_16bpp;
break;
@@ -221,9 +213,18 @@ void viafb_set_2d_color_depth(int bpp)
dwGEMode |= VIA_GEM_8bpp;
break;
}
-
- /* Set BPP and Pitch */
writel(dwGEMode, viaparinfo->io_virt + VIA_REG_GEMODE);
+
+ /* Set source and destination base */
+ base = ((void *)info->screen_base - viafb_FB_MM);
+ writel(base >> 3, viaparinfo->io_virt + VIA_REG_SRCBASE);
+ writel(base >> 3, viaparinfo->io_virt + VIA_REG_DSTBASE);
+
+ /* Set source and destination pitch (128bit aligned) */
+ pitch = (viaparinfo->hres * viaparinfo->bpp >> 3) >> 3;
+ pitch_reg = pitch | (pitch << 16);
+ pitch_reg |= VIA_PITCH_ENABLE;
+ writel(pitch_reg, viaparinfo->io_virt + VIA_REG_PITCH);
}
void viafb_hw_cursor_init(void)
diff --git a/drivers/video/via/accel.h b/drivers/video/via/accel.h
index 29bf854..bef3134 100644
--- a/drivers/video/via/accel.h
+++ b/drivers/video/via/accel.h
@@ -161,7 +161,7 @@
void viafb_init_accel(void);
void viafb_init_2d_engine(void);
-void set_2d_color_depth(int);
+void viafb_set_2d_mode(struct fb_info *info);
void viafb_hw_cursor_init(void);
void viafb_show_hw_cursor(struct fb_info *info, int Status); int
viafb_wait_engine_idle(void); void viafb_set_2d_color_depth(int bpp);
diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c
index 980eab8..af8acfe 100644
--- a/drivers/video/via/viafbdev.c
+++ b/drivers/video/via/viafbdev.c
@@ -264,7 +264,7 @@ static int viafb_set_par(struct fb_info *info)
viafb_accel = info->var.accel_flags;
if (viafb_accel)
- viafb_set_2d_color_depth(info->var.bits_per_pixel);
+ viafb_set_2d_mode(info);
}
return 0;
@@ -865,7 +865,6 @@ static void viafb_fillrect(struct fb_info *info,
const struct fb_fillrect *rect)
{
u32 col = 0, rop = 0;
- int pitch;
if (!viafb_accel) {
cfb_fillrect(info, rect);
@@ -897,22 +896,8 @@ static void viafb_fillrect(struct fb_info *info,
break;
}
- /* BitBlt Source Address */
- writel(0x0, viaparinfo->io_virt + VIA_REG_SRCPOS);
- /* Source Base Address */
- writel(0x0, viaparinfo->io_virt + VIA_REG_SRCBASE);
- /* Destination Base Address */
- writel(((unsigned long) (info->screen_base) -
- (unsigned long) viafb_FB_MM) >> 3,
- viaparinfo->io_virt + VIA_REG_DSTBASE);
- /* Pitch */
- pitch = (info->var.xres_virtual + 7) & ~7;
- writel(VIA_PITCH_ENABLE |
- (((pitch *
- info->var.bits_per_pixel >> 3) >> 3) |
- (((pitch * info->
- var.bits_per_pixel >> 3) >> 3) << 16)),
- viaparinfo->io_virt + VIA_REG_PITCH);
+ viafb_set_2d_mode(info);
+
/* BitBlt Destination Address */
writel(((rect->dy << 16) | rect->dx),
viaparinfo->io_virt + VIA_REG_DSTPOS);
@@ -932,7 +917,6 @@ static void viafb_copyarea(struct fb_info *info,
{
u32 dy = area->dy, sy = area->sy, direction = 0x0;
u32 sx = area->sx, dx = area->dx, width = area->width;
- int pitch;
DEBUG_MSG(KERN_INFO "viafb_copyarea!!\n");
@@ -956,25 +940,8 @@ static void viafb_copyarea(struct fb_info *info,
direction |= 0x8000;
}
- /* Source Base Address */
- writel(((unsigned long) (info->screen_base) -
- (unsigned long) viafb_FB_MM) >> 3,
- viaparinfo->io_virt + VIA_REG_SRCBASE);
- /* Destination Base Address */
- writel(((unsigned long) (info->screen_base) -
- (unsigned long) viafb_FB_MM) >> 3,
- viaparinfo->io_virt + VIA_REG_DSTBASE);
- /* Pitch */
- pitch = (info->var.xres_virtual + 7) & ~7;
- /* VIA_PITCH_ENABLE can be omitted now. */
- writel(VIA_PITCH_ENABLE |
- (((pitch *
- info->var.bits_per_pixel >> 3) >> 3) | (((pitch *
- info->var.
- bits_per_pixel
- >> 3) >> 3)
- << 16)),
- viaparinfo->io_virt + VIA_REG_PITCH);
+ viafb_set_2d_mode(info);
+
/* BitBlt Source Address */
writel(((sy << 16) | sx), viaparinfo->io_virt + VIA_REG_SRCPOS);
/* BitBlt Destination Address */
@@ -993,7 +960,6 @@ static void viafb_imageblit(struct fb_info *info,
{
u32 size, bg_col = 0, fg_col = 0, *udata;
int i;
- int pitch;
if (!viafb_accel) {
cfb_imageblit(info, image);
@@ -1018,22 +984,8 @@ static void viafb_imageblit(struct fb_info *info,
}
size = image->width * image->height;
- /* Source Base Address */
- writel(0x0, viaparinfo->io_virt + VIA_REG_SRCBASE);
- /* Destination Base Address */
- writel(((unsigned long) (info->screen_base) -
- (unsigned long) viafb_FB_MM) >> 3,
- viaparinfo->io_virt + VIA_REG_DSTBASE);
- /* Pitch */
- pitch = (info->var.xres_virtual + 7) & ~7;
- writel(VIA_PITCH_ENABLE |
- (((pitch *
- info->var.bits_per_pixel >> 3) >> 3) | (((pitch *
- info->var.
- bits_per_pixel
- >> 3) >> 3)
- << 16)),
- viaparinfo->io_virt + VIA_REG_PITCH);
+ viafb_set_2d_mode(info);
+
/* BitBlt Source Address */
writel(0x0, viaparinfo->io_virt + VIA_REG_SRCPOS);
/* BitBlt Destination Address */
--
1.6.2.4
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables
unlimited royalty-free distribution of the report engine
for externally facing server and web deployment.
http://p.sf.net/sfu/businessobjects
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [PATCH 12/15] viafb: introduce wrapper for 2D engine registers
2009-05-20 20:28 ` [PATCH 11/15] viafb: clean up duplicated code from 2D acceleration Harald Welte
@ 2009-05-20 20:28 ` Harald Welte
2009-05-20 20:28 ` [PATCH 13/15] viafb: initialize 2D engine registers from loop Harald Welte
2009-05-23 6:28 ` [PATCH 12/15] viafb: introduce wrapper for 2D engine registers Krzysztof Helt
2009-05-23 6:28 ` [PATCH 11/15] viafb: clean up duplicated code from 2D acceleration Krzysztof Helt
1 sibling, 2 replies; 33+ messages in thread
From: Harald Welte @ 2009-05-20 20:28 UTC (permalink / raw)
To: linux-fbdev-devel; +Cc: Harald Welte
From: Harald Welte <laforge@gnumonks.org>
This is required as preparation for supporting the new M1 engine of the
VX800/VX855 which has registers at permutated addresses.
Signed-off-by: Harald Welte <HaraldWelte@viatech.com>
---
drivers/video/via/accel.c | 13 +++++++++----
drivers/video/via/accel.h | 1 +
drivers/video/via/viafbdev.c | 38 +++++++++++++++++---------------------
3 files changed, 27 insertions(+), 25 deletions(-)
diff --git a/drivers/video/via/accel.c b/drivers/video/via/accel.c
index 4a1183f..c3af95f 100644
--- a/drivers/video/via/accel.c
+++ b/drivers/video/via/accel.c
@@ -20,6 +20,11 @@
*/
#include "global.h"
+void viafb_2d_writel(u_int32_t val, u_int32_t reg)
+{
+ writel(val, viaparinfo->io_virt + reg);
+}
+
void viafb_init_accel(void)
{
viaparinfo->fbmem_free -= CURSOR_SIZE;
@@ -213,18 +218,18 @@ void viafb_set_2d_mode(struct fb_info *info)
dwGEMode |= VIA_GEM_8bpp;
break;
}
- writel(dwGEMode, viaparinfo->io_virt + VIA_REG_GEMODE);
+ viafb_2d_writel(dwGEMode, VIA_REG_GEMODE);
/* Set source and destination base */
base = ((void *)info->screen_base - viafb_FB_MM);
- writel(base >> 3, viaparinfo->io_virt + VIA_REG_SRCBASE);
- writel(base >> 3, viaparinfo->io_virt + VIA_REG_DSTBASE);
+ viafb_2d_writel(base >> 3, VIA_REG_SRCBASE);
+ viafb_2d_writel(base >> 3, VIA_REG_DSTBASE);
/* Set source and destination pitch (128bit aligned) */
pitch = (viaparinfo->hres * viaparinfo->bpp >> 3) >> 3;
pitch_reg = pitch | (pitch << 16);
pitch_reg |= VIA_PITCH_ENABLE;
- writel(pitch_reg, viaparinfo->io_virt + VIA_REG_PITCH);
+ viafb_2d_writel(pitch_reg, VIA_REG_PITCH);
}
void viafb_hw_cursor_init(void)
diff --git a/drivers/video/via/accel.h b/drivers/video/via/accel.h
index bef3134..5081ac2 100644
--- a/drivers/video/via/accel.h
+++ b/drivers/video/via/accel.h
@@ -159,6 +159,7 @@
#define MAXLOOP 0xFFFFFF
+void viafb_2d_writel(u_int32_t val, u_int32_t reg);
void viafb_init_accel(void);
void viafb_init_2d_engine(void);
void viafb_set_2d_mode(struct fb_info *info);
diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c
index af8acfe..859827b 100644
--- a/drivers/video/via/viafbdev.c
+++ b/drivers/video/via/viafbdev.c
@@ -899,16 +899,14 @@ static void viafb_fillrect(struct fb_info *info,
viafb_set_2d_mode(info);
/* BitBlt Destination Address */
- writel(((rect->dy << 16) | rect->dx),
- viaparinfo->io_virt + VIA_REG_DSTPOS);
+ viafb_2d_writel(((rect->dy << 16) | rect->dx), VIA_REG_DSTPOS);
/* Dimension: width & height */
- writel((((rect->height - 1) << 16) | (rect->width - 1)),
- viaparinfo->io_virt + VIA_REG_DIMENSION);
+ viafb_2d_writel((((rect->height - 1) << 16) | (rect->width - 1)),
+ VIA_REG_DIMENSION);
/* Forground color or Destination color */
- writel(col, viaparinfo->io_virt + VIA_REG_FGCOLOR);
+ viafb_2d_writel(col, VIA_REG_FGCOLOR);
/* GE Command */
- writel((0x01 | 0x2000 | (rop << 24)),
- viaparinfo->io_virt + VIA_REG_GECMD);
+ viafb_2d_writel((0x01 | 0x2000 | (rop << 24)), VIA_REG_GECMD);
}
@@ -943,15 +941,14 @@ static void viafb_copyarea(struct fb_info *info,
viafb_set_2d_mode(info);
/* BitBlt Source Address */
- writel(((sy << 16) | sx), viaparinfo->io_virt + VIA_REG_SRCPOS);
+ viafb_2d_writel(((sy << 16) | sx), VIA_REG_SRCPOS);
/* BitBlt Destination Address */
- writel(((dy << 16) | dx), viaparinfo->io_virt + VIA_REG_DSTPOS);
+ viafb_2d_writel(((dy << 16) | dx), VIA_REG_DSTPOS);
/* Dimension: width & height */
- writel((((area->height - 1) << 16) | (area->width - 1)),
- viaparinfo->io_virt + VIA_REG_DIMENSION);
+ viafb_2d_writel((((area->height - 1) << 16) | (area->width - 1)),
+ VIA_REG_DIMENSION);
/* GE Command */
- writel((0x01 | direction | (0xCC << 24)),
- viaparinfo->io_virt + VIA_REG_GECMD);
+ viafb_2d_writel((0x01 | direction | (0xCC << 24)), VIA_REG_GECMD);
}
@@ -987,19 +984,18 @@ static void viafb_imageblit(struct fb_info *info,
viafb_set_2d_mode(info);
/* BitBlt Source Address */
- writel(0x0, viaparinfo->io_virt + VIA_REG_SRCPOS);
+ viafb_2d_writel(0x0, VIA_REG_SRCPOS);
/* BitBlt Destination Address */
- writel(((image->dy << 16) | image->dx),
- viaparinfo->io_virt + VIA_REG_DSTPOS);
+ viafb_2d_writel(((image->dy << 16) | image->dx), VIA_REG_DSTPOS);
/* Dimension: width & height */
- writel((((image->height - 1) << 16) | (image->width - 1)),
- viaparinfo->io_virt + VIA_REG_DIMENSION);
+ viafb_2d_writel((((image->height - 1) << 16) | (image->width - 1)),
+ VIA_REG_DIMENSION);
/* fb color */
- writel(fg_col, viaparinfo->io_virt + VIA_REG_FGCOLOR);
+ viafb_2d_writel(fg_col, VIA_REG_FGCOLOR);
/* bg color */
- writel(bg_col, viaparinfo->io_virt + VIA_REG_BGCOLOR);
+ viafb_2d_writel(bg_col, VIA_REG_BGCOLOR);
/* GE Command */
- writel(0xCC020142, viaparinfo->io_virt + VIA_REG_GECMD);
+ viafb_2d_writel(0xCC020142, VIA_REG_GECMD);
for (i = 0; i < size / 4; i++) {
writel(*udata, viaparinfo->io_virt + VIA_MMIO_BLTBASE);
--
1.6.2.4
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables
unlimited royalty-free distribution of the report engine
for externally facing server and web deployment.
http://p.sf.net/sfu/businessobjects
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [PATCH 13/15] viafb: initialize 2D engine registers from loop
2009-05-20 20:28 ` [PATCH 12/15] viafb: introduce wrapper for 2D engine registers Harald Welte
@ 2009-05-20 20:28 ` Harald Welte
2009-05-20 20:28 ` [PATCH 14/15] viafb: Determine type of 2D engine and store it in chip_info Harald Welte
2009-05-23 6:27 ` [PATCH 13/15] viafb: initialize 2D engine registers from loop Krzysztof Helt
2009-05-23 6:28 ` [PATCH 12/15] viafb: introduce wrapper for 2D engine registers Krzysztof Helt
1 sibling, 2 replies; 33+ messages in thread
From: Harald Welte @ 2009-05-20 20:28 UTC (permalink / raw)
To: linux-fbdev-devel; +Cc: Harald Welte
From: Harald Welte <laforge@gnumonks.org>
We don't need to unroll the register initialization routine when
initializing the 2D engine registers
Signed-off-by: Harald Welte <HaraldWelte@viatech.com>
---
drivers/video/via/accel.c | 18 +++---------------
1 files changed, 3 insertions(+), 15 deletions(-)
diff --git a/drivers/video/via/accel.c b/drivers/video/via/accel.c
index c3af95f..b3a414e 100644
--- a/drivers/video/via/accel.c
+++ b/drivers/video/via/accel.c
@@ -41,23 +41,11 @@ void viafb_init_2d_engine(void)
{
u32 dwVQStartAddr, dwVQEndAddr;
u32 dwVQLen, dwVQStartL, dwVQEndL, dwVQStartEndH;
+ int i;
/* init 2D engine regs to reset 2D engine */
- writel(0x0, viaparinfo->io_virt + VIA_REG_GEMODE);
- writel(0x0, viaparinfo->io_virt + VIA_REG_SRCPOS);
- writel(0x0, viaparinfo->io_virt + VIA_REG_DSTPOS);
- writel(0x0, viaparinfo->io_virt + VIA_REG_DIMENSION);
- writel(0x0, viaparinfo->io_virt + VIA_REG_PATADDR);
- writel(0x0, viaparinfo->io_virt + VIA_REG_FGCOLOR);
- writel(0x0, viaparinfo->io_virt + VIA_REG_BGCOLOR);
- writel(0x0, viaparinfo->io_virt + VIA_REG_CLIPTL);
- writel(0x0, viaparinfo->io_virt + VIA_REG_CLIPBR);
- writel(0x0, viaparinfo->io_virt + VIA_REG_OFFSET);
- writel(0x0, viaparinfo->io_virt + VIA_REG_KEYCONTROL);
- writel(0x0, viaparinfo->io_virt + VIA_REG_SRCBASE);
- writel(0x0, viaparinfo->io_virt + VIA_REG_DSTBASE);
- writel(0x0, viaparinfo->io_virt + VIA_REG_PITCH);
- writel(0x0, viaparinfo->io_virt + VIA_REG_MONOPAT1);
+ for (i = 0; i <= 0x40; i+= 4)
+ writel(0x0, viaparinfo->io_virt + i);
/* Init AGP and VQ regs */
switch (viaparinfo->chip_info->gfx_chip_name) {
--
1.6.2.4
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables
unlimited royalty-free distribution of the report engine
for externally facing server and web deployment.
http://p.sf.net/sfu/businessobjects
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [PATCH 14/15] viafb: Determine type of 2D engine and store it in chip_info
2009-05-20 20:28 ` [PATCH 13/15] viafb: initialize 2D engine registers from loop Harald Welte
@ 2009-05-20 20:28 ` Harald Welte
2009-05-20 20:28 ` [PATCH 15/15] viafb: Add support for 2D accelerated framebuffer on VX800/VX855 Harald Welte
2009-05-23 6:29 ` [PATCH 14/15] viafb: Determine type of 2D engine and store it in chip_info Krzysztof Helt
2009-05-23 6:27 ` [PATCH 13/15] viafb: initialize 2D engine registers from loop Krzysztof Helt
1 sibling, 2 replies; 33+ messages in thread
From: Harald Welte @ 2009-05-20 20:28 UTC (permalink / raw)
To: linux-fbdev-devel; +Cc: Harald Welte
From: Harald Welte <laforge@gnumonks.org>
This will help us for the upcoming support for 2D acceleration using
the M1 engine.
Signed-off-by: Harald Welte <HaraldWelte@viatech.com>
---
drivers/video/via/chip.h | 8 ++++++++
drivers/video/via/hw.c | 15 +++++++++++++++
drivers/video/via/viafbdev.c | 3 +--
3 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/drivers/video/via/chip.h b/drivers/video/via/chip.h
index 03e90cf..7f4bf73 100644
--- a/drivers/video/via/chip.h
+++ b/drivers/video/via/chip.h
@@ -122,10 +122,18 @@ struct lvds_chip_information {
int i2c_port;
};
+/* The type of 2D engine */
+enum via_2d_engine {
+ VIA_2D_ENG_H2,
+ VIA_2D_ENG_H5,
+ VIA_2D_ENG_M1,
+};
+
struct chip_information {
int gfx_chip_name;
int gfx_chip_revision;
int chip_on_slot;
+ enum via_2d_engine twod_engine;
struct tmds_chip_information tmds_chip_info;
struct lvds_chip_information lvds_chip_info;
struct lvds_chip_information lvds_chip_info2;
diff --git a/drivers/video/via/hw.c b/drivers/video/via/hw.c
index e06d6b7..e14b852 100644
--- a/drivers/video/via/hw.c
+++ b/drivers/video/via/hw.c
@@ -2092,6 +2092,21 @@ static void init_gfx_chip_info(struct pci_dev *pdev,
CX700_REVISION_700;
}
}
+
+ /* Determine which 2D engine we have */
+ switch (viaparinfo->chip_info->gfx_chip_name) {
+ case UNICHROME_VX800:
+ case UNICHROME_VX855:
+ viaparinfo->chip_info->twod_engine = VIA_2D_ENG_M1;
+ break;
+ case UNICHROME_K8M890:
+ case UNICHROME_P4M900:
+ viaparinfo->chip_info->twod_engine = VIA_2D_ENG_H5;
+ break;
+ default:
+ viaparinfo->chip_info->twod_engine = VIA_2D_ENG_H2;
+ break;
+ }
}
static void init_tmds_chip_info(void)
diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c
index 859827b..d6a38ca 100644
--- a/drivers/video/via/viafbdev.c
+++ b/drivers/video/via/viafbdev.c
@@ -214,8 +214,7 @@ static int viafb_check_var(struct fb_var_screeninfo *var,
if (!info->par)
return -1;
p_viafb_par = (struct viafb_par *)info->par;
- if (p_viafb_par->chip_info->gfx_chip_name == UNICHROME_VX800 ||
- p_viafb_par->chip_info->gfx_chip_name == UNICHROME_VX855)
+ if (p_viafb_par->chip_info->twod_engine == VIA_2D_ENG_M1)
var->accel_flags = 0;
return 0;
--
1.6.2.4
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables
unlimited royalty-free distribution of the report engine
for externally facing server and web deployment.
http://p.sf.net/sfu/businessobjects
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [PATCH 15/15] viafb: Add support for 2D accelerated framebuffer on VX800/VX855
2009-05-20 20:28 ` [PATCH 14/15] viafb: Determine type of 2D engine and store it in chip_info Harald Welte
@ 2009-05-20 20:28 ` Harald Welte
2009-05-23 6:31 ` Krzysztof Helt
2009-05-23 6:29 ` [PATCH 14/15] viafb: Determine type of 2D engine and store it in chip_info Krzysztof Helt
1 sibling, 1 reply; 33+ messages in thread
From: Harald Welte @ 2009-05-20 20:28 UTC (permalink / raw)
To: linux-fbdev-devel; +Cc: Harald Welte
From: Harald Welte <laforge@gnumonks.org>
The VX800/VX820 and the VX855/VX875 chipsets have a different 2D
acceleration engine called "M1". The M1 engine has some subtle
(and some not-so-subtle) differences to the previous engines,
so support for accelerated framebuffer on those chipsets was
disabled so far.
This patch adds full support for the M1 engine to viafb.
Signed-off-by: Harald Welte <HaraldWelte@viatech.com>
---
drivers/video/via/accel.c | 72 ++++++++++++++++++++++++++++++++++++-----
drivers/video/via/accel.h | 40 +++++++++++++++++++++++
drivers/video/via/viafbdev.c | 2 -
3 files changed, 103 insertions(+), 11 deletions(-)
diff --git a/drivers/video/via/accel.c b/drivers/video/via/accel.c
index b3a414e..a4b66be 100644
--- a/drivers/video/via/accel.c
+++ b/drivers/video/via/accel.c
@@ -20,8 +20,34 @@
*/
#include "global.h"
+/* Somehow, the M1 engine has the registers in slightly different
+ * locations than previous 2D acceleration engines */
+static u_int8_t via_m1_eng_reg[] = {
+ [VIA_REG_GECMD] = VIA_REG_GECMD_M1,
+ [VIA_REG_GEMODE] = VIA_REG_GEMODE_M1,
+ [VIA_REG_SRCPOS] = VIA_REG_SRCPOS_M1,
+ [VIA_REG_DSTPOS] = VIA_REG_DSTPOS_M1,
+ [VIA_REG_DIMENSION] = VIA_REG_DIMENSION_M1,
+ [VIA_REG_PATADDR] = VIA_REG_PATADDR_M1,
+ [VIA_REG_FGCOLOR] = VIA_REG_FGCOLOR_M1,
+ [VIA_REG_BGCOLOR] = VIA_REG_BGCOLOR_M1,
+ [VIA_REG_CLIPTL] = VIA_REG_CLIPTL_M1,
+ [VIA_REG_CLIPBR] = VIA_REG_CLIPBR_M1,
+ [VIA_REG_OFFSET] = VIA_REG_OFFSET_M1,
+ [VIA_REG_KEYCONTROL] = VIA_REG_KEYCONTROL_M1,
+ [VIA_REG_SRCBASE] = VIA_REG_SRCBASE_M1,
+ [VIA_REG_DSTBASE] = VIA_REG_DSTBASE_M1,
+ [VIA_REG_PITCH] = VIA_REG_PITCH_M1,
+ [VIA_REG_MONOPAT0] = VIA_REG_MONOPAT0_M1,
+ [VIA_REG_MONOPAT1] = VIA_REG_MONOPAT1_M1,
+};
+
void viafb_2d_writel(u_int32_t val, u_int32_t reg)
{
+ if (viaparinfo->chip_info->twod_engine == VIA_2D_ENG_M1 &&
+ reg < ARRAY_SIZE(via_m1_eng_reg))
+ reg = via_m1_eng_reg[reg];
+
writel(val, viaparinfo->io_virt + reg);
}
@@ -41,16 +67,26 @@ void viafb_init_2d_engine(void)
{
u32 dwVQStartAddr, dwVQEndAddr;
u32 dwVQLen, dwVQStartL, dwVQEndL, dwVQStartEndH;
- int i;
+ int i, highest_reg;
/* init 2D engine regs to reset 2D engine */
- for (i = 0; i <= 0x40; i+= 4)
+ switch (viaparinfo->chip_info->twod_engine) {
+ case VIA_2D_ENG_M1:
+ highest_reg = 0x5c;
+ break;
+ default:
+ highest_reg = 0x40;
+ break;
+ }
+ for (i = 0; i <= highest_reg; i+= 4)
writel(0x0, viaparinfo->io_virt + i);
/* Init AGP and VQ regs */
switch (viaparinfo->chip_info->gfx_chip_name) {
case UNICHROME_K8M890:
case UNICHROME_P4M900:
+ case UNICHROME_VX800:
+ case UNICHROME_VX855:
writel(0x00100000, viaparinfo->io_virt + VIA_REG_CR_TRANSET);
writel(0x680A0000, viaparinfo->io_virt + VIA_REG_CR_TRANSPACE);
writel(0x02000000, viaparinfo->io_virt + VIA_REG_CR_TRANSPACE);
@@ -85,6 +121,8 @@ void viafb_init_2d_engine(void)
switch (viaparinfo->chip_info->gfx_chip_name) {
case UNICHROME_K8M890:
case UNICHROME_P4M900:
+ case UNICHROME_VX800:
+ case UNICHROME_VX855:
dwVQStartL |= 0x20000000;
dwVQEndL |= 0x20000000;
dwVQStartEndH |= 0x20000000;
@@ -97,6 +135,8 @@ void viafb_init_2d_engine(void)
switch (viaparinfo->chip_info->gfx_chip_name) {
case UNICHROME_K8M890:
case UNICHROME_P4M900:
+ case UNICHROME_VX800:
+ case UNICHROME_VX855:
writel(0x00100000,
viaparinfo->io_virt + VIA_REG_CR_TRANSET);
writel(dwVQStartEndH,
@@ -162,6 +202,8 @@ void viafb_init_2d_engine(void)
switch (viaparinfo->chip_info->gfx_chip_name) {
case UNICHROME_K8M890:
case UNICHROME_P4M900:
+ case UNICHROME_VX800:
+ case UNICHROME_VX855:
writel(0x00100000,
viaparinfo->io_virt + VIA_REG_CR_TRANSET);
writel(0x74301000,
@@ -216,7 +258,8 @@ void viafb_set_2d_mode(struct fb_info *info)
/* Set source and destination pitch (128bit aligned) */
pitch = (viaparinfo->hres * viaparinfo->bpp >> 3) >> 3;
pitch_reg = pitch | (pitch << 16);
- pitch_reg |= VIA_PITCH_ENABLE;
+ if (viaparinfo->chip_info->twod_engine != VIA_2D_ENG_M1)
+ pitch_reg |= VIA_PITCH_ENABLE;
viafb_2d_writel(pitch_reg, VIA_REG_PITCH);
}
@@ -259,15 +302,26 @@ void viafb_show_hw_cursor(struct fb_info *info, int Status)
int viafb_wait_engine_idle(void)
{
int loop = 0;
+ u_int32_t status_mask;
- while (!(readl(viaparinfo->io_virt + VIA_REG_STATUS) &
- VIA_VR_QUEUE_BUSY) && (loop < MAXLOOP)) {
- loop++;
- cpu_relax();
+ switch (viaparinfo->chip_info->twod_engine) {
+ case VIA_2D_ENG_H5:
+ case VIA_2D_ENG_M1:
+ status_mask = VIA_CMD_RGTR_BUSY_M1 | VIA_2D_ENG_BUSY_M1 |
+ VIA_3D_ENG_BUSY_M1;
+ break;
+ default:
+ while (!(readl(viaparinfo->io_virt + VIA_REG_STATUS) &
+ VIA_VR_QUEUE_BUSY) && (loop < MAXLOOP)) {
+ loop++;
+ cpu_relax();
+ }
+ status_mask = VIA_CMD_RGTR_BUSY | VIA_2D_ENG_BUSY |
+ VIA_3D_ENG_BUSY;
+ break;
}
- while ((readl(viaparinfo->io_virt + VIA_REG_STATUS) &
- (VIA_CMD_RGTR_BUSY | VIA_2D_ENG_BUSY | VIA_3D_ENG_BUSY)) &&
+ while ((readl(viaparinfo->io_virt + VIA_REG_STATUS) & status_mask) &&
(loop < MAXLOOP)) {
loop++;
cpu_relax();
diff --git a/drivers/video/via/accel.h b/drivers/video/via/accel.h
index 5081ac2..9a39ed1 100644
--- a/drivers/video/via/accel.h
+++ b/drivers/video/via/accel.h
@@ -67,6 +67,34 @@
/* from 0x100 to 0x1ff */
#define VIA_REG_COLORPAT 0x100
+/* defines for VIA 2D registers for vt3353/3409 (M1 engine)*/
+#define VIA_REG_GECMD_M1 0x000
+#define VIA_REG_GEMODE_M1 0x004
+#define VIA_REG_GESTATUS_M1 0x004 /* as same as VIA_REG_GEMODE */
+#define VIA_REG_PITCH_M1 0x008 /* pitch of src and dst */
+#define VIA_REG_DIMENSION_M1 0x00C /* width and height */
+#define VIA_REG_DSTPOS_M1 0x010
+#define VIA_REG_LINE_XY_M1 0x010
+#define VIA_REG_DSTBASE_M1 0x014
+#define VIA_REG_SRCPOS_M1 0x018
+#define VIA_REG_LINE_K1K2_M1 0x018
+#define VIA_REG_SRCBASE_M1 0x01C
+#define VIA_REG_PATADDR_M1 0x020
+#define VIA_REG_MONOPAT0_M1 0x024
+#define VIA_REG_MONOPAT1_M1 0x028
+#define VIA_REG_OFFSET_M1 0x02C
+#define VIA_REG_LINE_ERROR_M1 0x02C
+#define VIA_REG_CLIPTL_M1 0x040 /* top and left of clipping */
+#define VIA_REG_CLIPBR_M1 0x044 /* bottom and right of clipping */
+#define VIA_REG_KEYCONTROL_M1 0x048 /* color key control */
+#define VIA_REG_FGCOLOR_M1 0x04C
+#define VIA_REG_DSTCOLORKEY_M1 0x04C /* as same as VIA_REG_FG */
+#define VIA_REG_BGCOLOR_M1 0x050
+#define VIA_REG_SRCCOLORKEY_M1 0x050 /* as same as VIA_REG_BG */
+#define VIA_REG_MONOPATFGC_M1 0x058 /* Add BG color of Pattern. */
+#define VIA_REG_MONOPATBGC_M1 0x05C /* Add FG color of Pattern. */
+#define VIA_REG_COLORPAT_M1 0x100 /* from 0x100 to 0x1ff */
+
/* VIA_REG_PITCH(0x38): Pitch Setting */
#define VIA_PITCH_ENABLE 0x80000000
@@ -157,6 +185,18 @@
/* Virtual Queue is busy */
#define VIA_VR_QUEUE_BUSY 0x00020000
+/* VIA_REG_STATUS(0x400): Engine Status for H5 */
+#define VIA_CMD_RGTR_BUSY_H5 0x00000010 /* Command Regulator is busy */
+#define VIA_2D_ENG_BUSY_H5 0x00000002 /* 2D Engine is busy */
+#define VIA_3D_ENG_BUSY_H5 0x00001FE1 /* 3D Engine is busy */
+#define VIA_VR_QUEUE_BUSY_H5 0x00000004 /* Virtual Queue is busy */
+
+/* VIA_REG_STATUS(0x400): Engine Status for VT3353/3409 */
+#define VIA_CMD_RGTR_BUSY_M1 0x00000010 /* Command Regulator is busy */
+#define VIA_2D_ENG_BUSY_M1 0x00000002 /* 2D Engine is busy */
+#define VIA_3D_ENG_BUSY_M1 0x00001FE1 /* 3D Engine is busy */
+#define VIA_VR_QUEUE_BUSY_M1 0x00000004 /* Virtual Queue is busy */
+
#define MAXLOOP 0xFFFFFF
void viafb_2d_writel(u_int32_t val, u_int32_t reg);
diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c
index d6a38ca..3a22a3a 100644
--- a/drivers/video/via/viafbdev.c
+++ b/drivers/video/via/viafbdev.c
@@ -214,8 +214,6 @@ static int viafb_check_var(struct fb_var_screeninfo *var,
if (!info->par)
return -1;
p_viafb_par = (struct viafb_par *)info->par;
- if (p_viafb_par->chip_info->twod_engine == VIA_2D_ENG_M1)
- var->accel_flags = 0;
return 0;
}
--
1.6.2.4
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables
unlimited royalty-free distribution of the report engine
for externally facing server and web deployment.
http://p.sf.net/sfu/businessobjects
^ permalink raw reply related [flat|nested] 33+ messages in thread
* Re: [PATCH 01/15] [FB] make viafb work on x86_64
2009-05-20 20:28 [PATCH 01/15] [FB] make viafb work on x86_64 Harald Welte
2009-05-20 20:28 ` [PATCH 02/15] [FB] viafb: Add missing break statement in switch Harald Welte
@ 2009-05-21 16:57 ` Krzysztof Helt
2009-05-23 6:57 ` Krzysztof Helt
2 siblings, 0 replies; 33+ messages in thread
From: Krzysztof Helt @ 2009-05-21 16:57 UTC (permalink / raw)
To: Harald Welte; +Cc: linux-fbdev-devel
On Thu, 21 May 2009 04:28:39 +0800
Harald Welte <HaraldWelte@viatech.com> wrote:
> From: Harald Welte <laforge@gnumonks.org>
>
> This patch makes fixes a bug in viafb on x86_64 builds (e.g. for VIA Nano CPU).
> You cannot make the assumption that sizeof(unsigned int) == sizeof(unsigned
> long), so the parsing of the default mode (640x480) fails, leading to a
> division by zero during insmod of the driver.
>
> Signed-off-by: Harald Welte <HaraldWelte@viatech.com>
> ---
How does this differ from the commit ee1ef82c7e6d073f881952348960bbc639687482?
viafb: make it work on x86_64
Fix a bug in viafb on x86_64 builds (e.g. for VIA Nano CPU).
You cannot make the assumption that sizeof(unsigned int) ==
sizeof(unsigned long), so the parsing of the default mode (640x480) fails,
leading to a division by zero during insmod of the driver.
The commit is already in the main kernel tree (2.6.30-rc6).
Regards,
Krzysztof
> drivers/video/via/viafbdev.c | 6 +++---
> 1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c
> index e327b84..a0fec29 100644
> --- a/drivers/video/via/viafbdev.c
> +++ b/drivers/video/via/viafbdev.c
> @@ -2103,7 +2103,7 @@ static void viafb_remove_proc(struct proc_dir_entry *viafb_entry)
>
> static int __devinit via_pci_probe(void)
> {
> - unsigned int default_xres, default_yres;
> + unsigned long default_xres, default_yres;
> char *tmpc, *tmpm;
> char *tmpc_sec, *tmpm_sec;
> int vmode_index;
> @@ -2196,8 +2196,8 @@ static int __devinit via_pci_probe(void)
> viafb_FB_MM = viaparinfo->fbmem_virt;
> tmpm = viafb_mode;
> tmpc = strsep(&tmpm, "x");
> - strict_strtoul(tmpc, 0, (unsigned long *)&default_xres);
> - strict_strtoul(tmpm, 0, (unsigned long *)&default_yres);
> + strict_strtoul(tmpc, 0, &default_xres);
> + strict_strtoul(tmpm, 0, &default_yres);
>
> vmode_index = viafb_get_mode_index(default_xres, default_yres, 0);
> DEBUG_MSG(KERN_INFO "0->index=%d\n", vmode_index);
> --
> 1.6.2.4
>
>
> ------------------------------------------------------------------------------
> Crystal Reports - New Free Runtime and 30 Day Trial
> Check out the new simplified licensing option that enables
> unlimited royalty-free distribution of the report engine
> for externally facing server and web deployment.
> http://p.sf.net/sfu/businessobjects
> _______________________________________________
> Linux-fbdev-devel mailing list
> Linux-fbdev-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-fbdev-devel
>
----------------------------------------------------------------------
Fantastyczne nagrody do zgarniecia!
Zagraj >> http://link.interia.pl/f2177
------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, &
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://www.creativitycat.com
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH 13/15] viafb: initialize 2D engine registers from loop
2009-05-20 20:28 ` [PATCH 13/15] viafb: initialize 2D engine registers from loop Harald Welte
2009-05-20 20:28 ` [PATCH 14/15] viafb: Determine type of 2D engine and store it in chip_info Harald Welte
@ 2009-05-23 6:27 ` Krzysztof Helt
2009-05-23 9:33 ` Harald Welte
1 sibling, 1 reply; 33+ messages in thread
From: Krzysztof Helt @ 2009-05-23 6:27 UTC (permalink / raw)
To: Harald Welte; +Cc: linux-fbdev-devel
On Thu, 21 May 2009 04:28:51 +0800
Harald Welte <HaraldWelte@viatech.com> wrote:
> From: Harald Welte <laforge@gnumonks.org>
>
> We don't need to unroll the register initialization routine when
> initializing the 2D engine registers
>
> Signed-off-by: Harald Welte <HaraldWelte@viatech.com>
> ---
> drivers/video/via/accel.c | 18 +++---------------
> 1 files changed, 3 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/video/via/accel.c b/drivers/video/via/accel.c
> index c3af95f..b3a414e 100644
> --- a/drivers/video/via/accel.c
> +++ b/drivers/video/via/accel.c
> @@ -41,23 +41,11 @@ void viafb_init_2d_engine(void)
> {
> u32 dwVQStartAddr, dwVQEndAddr;
> u32 dwVQLen, dwVQStartL, dwVQEndL, dwVQStartEndH;
> + int i;
>
> /* init 2D engine regs to reset 2D engine */
> - writel(0x0, viaparinfo->io_virt + VIA_REG_GEMODE);
> - writel(0x0, viaparinfo->io_virt + VIA_REG_SRCPOS);
> - writel(0x0, viaparinfo->io_virt + VIA_REG_DSTPOS);
> - writel(0x0, viaparinfo->io_virt + VIA_REG_DIMENSION);
> - writel(0x0, viaparinfo->io_virt + VIA_REG_PATADDR);
> - writel(0x0, viaparinfo->io_virt + VIA_REG_FGCOLOR);
> - writel(0x0, viaparinfo->io_virt + VIA_REG_BGCOLOR);
> - writel(0x0, viaparinfo->io_virt + VIA_REG_CLIPTL);
> - writel(0x0, viaparinfo->io_virt + VIA_REG_CLIPBR);
> - writel(0x0, viaparinfo->io_virt + VIA_REG_OFFSET);
> - writel(0x0, viaparinfo->io_virt + VIA_REG_KEYCONTROL);
> - writel(0x0, viaparinfo->io_virt + VIA_REG_SRCBASE);
> - writel(0x0, viaparinfo->io_virt + VIA_REG_DSTBASE);
> - writel(0x0, viaparinfo->io_virt + VIA_REG_PITCH);
> - writel(0x0, viaparinfo->io_virt + VIA_REG_MONOPAT1);
> + for (i = 0; i <= 0x40; i+= 4)
> + writel(0x0, viaparinfo->io_virt + i);
>
Use your new viafb_2d_writel() here.
> /* Init AGP and VQ regs */
> switch (viaparinfo->chip_info->gfx_chip_name) {
> --
> 1.6.2.4
>
>
> ------------------------------------------------------------------------------
> Crystal Reports - New Free Runtime and 30 Day Trial
> Check out the new simplified licensing option that enables
> unlimited royalty-free distribution of the report engine
> for externally facing server and web deployment.
> http://p.sf.net/sfu/businessobjects
> _______________________________________________
> Linux-fbdev-devel mailing list
> Linux-fbdev-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-fbdev-devel
>
----------------------------------------------------------------------
Weekend w gorach za 100 PLN!
Sprawdz >>> http://link.interia.pl/f218c
------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, &
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://www.creativitycat.com
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH 11/15] viafb: clean up duplicated code from 2D acceleration
2009-05-20 20:28 ` [PATCH 11/15] viafb: clean up duplicated code from 2D acceleration Harald Welte
2009-05-20 20:28 ` [PATCH 12/15] viafb: introduce wrapper for 2D engine registers Harald Welte
@ 2009-05-23 6:28 ` Krzysztof Helt
1 sibling, 0 replies; 33+ messages in thread
From: Krzysztof Helt @ 2009-05-23 6:28 UTC (permalink / raw)
To: Harald Welte; +Cc: linux-fbdev-devel
On Thu, 21 May 2009 04:28:49 +0800
Harald Welte <HaraldWelte@viatech.com> wrote:
> From: Harald Welte <laforge@gnumonks.org>
>
> There are four parts of the viafb code who initialize the bigtblit
> screen base and pitch, some of them actually broken. This patch
> unifies them in one function called viafb_set_2d_mode() which
> replaces and enhances the old function to just set the bpp.
>
> Signed-off-by: Harald Welte <HaraldWelte@viatech.com>
> ---
Acked-by: Krzysztof Helt <krzysztof.h1@wp.pl>
> drivers/video/via/accel.c | 35 ++++++++++++-----------
> drivers/video/via/accel.h | 2 +-
> drivers/video/via/viafbdev.c | 62 +++++-------------------------------------
> 3 files changed, 26 insertions(+), 73 deletions(-)
>
> diff --git a/drivers/video/via/accel.c b/drivers/video/via/accel.c
> index 45c54bf..4a1183f 100644
> --- a/drivers/video/via/accel.c
> +++ b/drivers/video/via/accel.c
> @@ -191,26 +191,18 @@ void viafb_init_2d_engine(void)
> }
> }
>
> - viafb_set_2d_color_depth(viaparinfo->bpp);
> -
> - writel(0x0, viaparinfo->io_virt + VIA_REG_SRCBASE);
> - writel(0x0, viaparinfo->io_virt + VIA_REG_DSTBASE);
> -
> - writel(VIA_PITCH_ENABLE |
> - (((viaparinfo->hres *
> - viaparinfo->bpp >> 3) >> 3) | (((viaparinfo->hres *
> - viaparinfo->
> - bpp >> 3) >> 3) << 16)),
> - viaparinfo->io_virt + VIA_REG_PITCH);
> + viafb_set_2d_mode(viafbinfo);
> }
>
> -void viafb_set_2d_color_depth(int bpp)
> +/* Set the mode-specific parameters for the 2D acceleration, such as
> + * BPP, source and destination base, as well as pitch */
> +void viafb_set_2d_mode(struct fb_info *info)
> {
> - u32 dwGEMode;
> + u32 dwGEMode, pitch, pitch_reg, base;
>
> + /* Set BPP */
> dwGEMode = readl(viaparinfo->io_virt + 0x04) & 0xFFFFFCFF;
> -
> - switch (bpp) {
> + switch (viaparinfo->bpp) {
> case 16:
> dwGEMode |= VIA_GEM_16bpp;
> break;
> @@ -221,9 +213,18 @@ void viafb_set_2d_color_depth(int bpp)
> dwGEMode |= VIA_GEM_8bpp;
> break;
> }
> -
> - /* Set BPP and Pitch */
> writel(dwGEMode, viaparinfo->io_virt + VIA_REG_GEMODE);
> +
> + /* Set source and destination base */
> + base = ((void *)info->screen_base - viafb_FB_MM);
> + writel(base >> 3, viaparinfo->io_virt + VIA_REG_SRCBASE);
> + writel(base >> 3, viaparinfo->io_virt + VIA_REG_DSTBASE);
> +
> + /* Set source and destination pitch (128bit aligned) */
> + pitch = (viaparinfo->hres * viaparinfo->bpp >> 3) >> 3;
It is (viaparinfo->hres * viaparinfo->bpp) >> 6.
> + pitch_reg = pitch | (pitch << 16);
> + pitch_reg |= VIA_PITCH_ENABLE;
> + writel(pitch_reg, viaparinfo->io_virt + VIA_REG_PITCH);
> }
>
> void viafb_hw_cursor_init(void)
> diff --git a/drivers/video/via/accel.h b/drivers/video/via/accel.h
> index 29bf854..bef3134 100644
> --- a/drivers/video/via/accel.h
> +++ b/drivers/video/via/accel.h
> @@ -161,7 +161,7 @@
>
> void viafb_init_accel(void);
> void viafb_init_2d_engine(void);
> -void set_2d_color_depth(int);
> +void viafb_set_2d_mode(struct fb_info *info);
> void viafb_hw_cursor_init(void);
> void viafb_show_hw_cursor(struct fb_info *info, int Status); int
> viafb_wait_engine_idle(void); void viafb_set_2d_color_depth(int bpp);
> diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c
> index 980eab8..af8acfe 100644
> --- a/drivers/video/via/viafbdev.c
> +++ b/drivers/video/via/viafbdev.c
> @@ -264,7 +264,7 @@ static int viafb_set_par(struct fb_info *info)
> viafb_accel = info->var.accel_flags;
>
> if (viafb_accel)
> - viafb_set_2d_color_depth(info->var.bits_per_pixel);
> + viafb_set_2d_mode(info);
> }
>
> return 0;
> @@ -865,7 +865,6 @@ static void viafb_fillrect(struct fb_info *info,
> const struct fb_fillrect *rect)
> {
> u32 col = 0, rop = 0;
> - int pitch;
>
> if (!viafb_accel) {
> cfb_fillrect(info, rect);
> @@ -897,22 +896,8 @@ static void viafb_fillrect(struct fb_info *info,
> break;
> }
>
> - /* BitBlt Source Address */
> - writel(0x0, viaparinfo->io_virt + VIA_REG_SRCPOS);
> - /* Source Base Address */
> - writel(0x0, viaparinfo->io_virt + VIA_REG_SRCBASE);
> - /* Destination Base Address */
> - writel(((unsigned long) (info->screen_base) -
> - (unsigned long) viafb_FB_MM) >> 3,
> - viaparinfo->io_virt + VIA_REG_DSTBASE);
> - /* Pitch */
> - pitch = (info->var.xres_virtual + 7) & ~7;
> - writel(VIA_PITCH_ENABLE |
> - (((pitch *
> - info->var.bits_per_pixel >> 3) >> 3) |
> - (((pitch * info->
> - var.bits_per_pixel >> 3) >> 3) << 16)),
> - viaparinfo->io_virt + VIA_REG_PITCH);
> + viafb_set_2d_mode(info);
> +
> /* BitBlt Destination Address */
> writel(((rect->dy << 16) | rect->dx),
> viaparinfo->io_virt + VIA_REG_DSTPOS);
> @@ -932,7 +917,6 @@ static void viafb_copyarea(struct fb_info *info,
> {
> u32 dy = area->dy, sy = area->sy, direction = 0x0;
> u32 sx = area->sx, dx = area->dx, width = area->width;
> - int pitch;
>
> DEBUG_MSG(KERN_INFO "viafb_copyarea!!\n");
>
> @@ -956,25 +940,8 @@ static void viafb_copyarea(struct fb_info *info,
> direction |= 0x8000;
> }
>
> - /* Source Base Address */
> - writel(((unsigned long) (info->screen_base) -
> - (unsigned long) viafb_FB_MM) >> 3,
> - viaparinfo->io_virt + VIA_REG_SRCBASE);
> - /* Destination Base Address */
> - writel(((unsigned long) (info->screen_base) -
> - (unsigned long) viafb_FB_MM) >> 3,
> - viaparinfo->io_virt + VIA_REG_DSTBASE);
> - /* Pitch */
> - pitch = (info->var.xres_virtual + 7) & ~7;
> - /* VIA_PITCH_ENABLE can be omitted now. */
> - writel(VIA_PITCH_ENABLE |
> - (((pitch *
> - info->var.bits_per_pixel >> 3) >> 3) | (((pitch *
> - info->var.
> - bits_per_pixel
> - >> 3) >> 3)
> - << 16)),
> - viaparinfo->io_virt + VIA_REG_PITCH);
> + viafb_set_2d_mode(info);
> +
> /* BitBlt Source Address */
> writel(((sy << 16) | sx), viaparinfo->io_virt + VIA_REG_SRCPOS);
> /* BitBlt Destination Address */
> @@ -993,7 +960,6 @@ static void viafb_imageblit(struct fb_info *info,
> {
> u32 size, bg_col = 0, fg_col = 0, *udata;
> int i;
> - int pitch;
>
> if (!viafb_accel) {
> cfb_imageblit(info, image);
> @@ -1018,22 +984,8 @@ static void viafb_imageblit(struct fb_info *info,
> }
> size = image->width * image->height;
>
> - /* Source Base Address */
> - writel(0x0, viaparinfo->io_virt + VIA_REG_SRCBASE);
> - /* Destination Base Address */
> - writel(((unsigned long) (info->screen_base) -
> - (unsigned long) viafb_FB_MM) >> 3,
> - viaparinfo->io_virt + VIA_REG_DSTBASE);
> - /* Pitch */
> - pitch = (info->var.xres_virtual + 7) & ~7;
> - writel(VIA_PITCH_ENABLE |
> - (((pitch *
> - info->var.bits_per_pixel >> 3) >> 3) | (((pitch *
> - info->var.
> - bits_per_pixel
> - >> 3) >> 3)
> - << 16)),
> - viaparinfo->io_virt + VIA_REG_PITCH);
> + viafb_set_2d_mode(info);
> +
> /* BitBlt Source Address */
> writel(0x0, viaparinfo->io_virt + VIA_REG_SRCPOS);
> /* BitBlt Destination Address */
> --
> 1.6.2.4
>
>
> ------------------------------------------------------------------------------
> Crystal Reports - New Free Runtime and 30 Day Trial
> Check out the new simplified licensing option that enables
> unlimited royalty-free distribution of the report engine
> for externally facing server and web deployment.
> http://p.sf.net/sfu/businessobjects
> _______________________________________________
> Linux-fbdev-devel mailing list
> Linux-fbdev-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-fbdev-devel
>
----------------------------------------------------------------------
Chcesz miec nawigacje GPS ?
Zamow lub przedluz umowe na neostrade, a nawigacja bedzie Twoja.
Kliknij na link po szczegoly! http://link.interia.pl/f219a
------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, &
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://www.creativitycat.com
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH 12/15] viafb: introduce wrapper for 2D engine registers
2009-05-20 20:28 ` [PATCH 12/15] viafb: introduce wrapper for 2D engine registers Harald Welte
2009-05-20 20:28 ` [PATCH 13/15] viafb: initialize 2D engine registers from loop Harald Welte
@ 2009-05-23 6:28 ` Krzysztof Helt
1 sibling, 0 replies; 33+ messages in thread
From: Krzysztof Helt @ 2009-05-23 6:28 UTC (permalink / raw)
To: Harald Welte; +Cc: linux-fbdev-devel
On Thu, 21 May 2009 04:28:50 +0800
Harald Welte <HaraldWelte@viatech.com> wrote:
> From: Harald Welte <laforge@gnumonks.org>
>
> This is required as preparation for supporting the new M1 engine of the
> VX800/VX855 which has registers at permutated addresses.
>
> Signed-off-by: Harald Welte <HaraldWelte@viatech.com>
> ---
Acked-by: Krzysztof Helt <krzysztof.h1@wp.pl>
> drivers/video/via/accel.c | 13 +++++++++----
> drivers/video/via/accel.h | 1 +
> drivers/video/via/viafbdev.c | 38 +++++++++++++++++---------------------
> 3 files changed, 27 insertions(+), 25 deletions(-)
>
> diff --git a/drivers/video/via/accel.c b/drivers/video/via/accel.c
> index 4a1183f..c3af95f 100644
> --- a/drivers/video/via/accel.c
> +++ b/drivers/video/via/accel.c
> @@ -20,6 +20,11 @@
> */
> #include "global.h"
>
> +void viafb_2d_writel(u_int32_t val, u_int32_t reg)
> +{
> + writel(val, viaparinfo->io_virt + reg);
> +}
> +
> void viafb_init_accel(void)
> {
> viaparinfo->fbmem_free -= CURSOR_SIZE;
> @@ -213,18 +218,18 @@ void viafb_set_2d_mode(struct fb_info *info)
> dwGEMode |= VIA_GEM_8bpp;
> break;
> }
> - writel(dwGEMode, viaparinfo->io_virt + VIA_REG_GEMODE);
> + viafb_2d_writel(dwGEMode, VIA_REG_GEMODE);
>
> /* Set source and destination base */
> base = ((void *)info->screen_base - viafb_FB_MM);
> - writel(base >> 3, viaparinfo->io_virt + VIA_REG_SRCBASE);
> - writel(base >> 3, viaparinfo->io_virt + VIA_REG_DSTBASE);
> + viafb_2d_writel(base >> 3, VIA_REG_SRCBASE);
> + viafb_2d_writel(base >> 3, VIA_REG_DSTBASE);
>
> /* Set source and destination pitch (128bit aligned) */
> pitch = (viaparinfo->hres * viaparinfo->bpp >> 3) >> 3;
> pitch_reg = pitch | (pitch << 16);
> pitch_reg |= VIA_PITCH_ENABLE;
> - writel(pitch_reg, viaparinfo->io_virt + VIA_REG_PITCH);
> + viafb_2d_writel(pitch_reg, VIA_REG_PITCH);
> }
>
> void viafb_hw_cursor_init(void)
> diff --git a/drivers/video/via/accel.h b/drivers/video/via/accel.h
> index bef3134..5081ac2 100644
> --- a/drivers/video/via/accel.h
> +++ b/drivers/video/via/accel.h
> @@ -159,6 +159,7 @@
>
> #define MAXLOOP 0xFFFFFF
>
> +void viafb_2d_writel(u_int32_t val, u_int32_t reg);
> void viafb_init_accel(void);
> void viafb_init_2d_engine(void);
> void viafb_set_2d_mode(struct fb_info *info);
> diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c
> index af8acfe..859827b 100644
> --- a/drivers/video/via/viafbdev.c
> +++ b/drivers/video/via/viafbdev.c
> @@ -899,16 +899,14 @@ static void viafb_fillrect(struct fb_info *info,
> viafb_set_2d_mode(info);
>
> /* BitBlt Destination Address */
> - writel(((rect->dy << 16) | rect->dx),
> - viaparinfo->io_virt + VIA_REG_DSTPOS);
> + viafb_2d_writel(((rect->dy << 16) | rect->dx), VIA_REG_DSTPOS);
> /* Dimension: width & height */
> - writel((((rect->height - 1) << 16) | (rect->width - 1)),
> - viaparinfo->io_virt + VIA_REG_DIMENSION);
> + viafb_2d_writel((((rect->height - 1) << 16) | (rect->width - 1)),
> + VIA_REG_DIMENSION);
> /* Forground color or Destination color */
> - writel(col, viaparinfo->io_virt + VIA_REG_FGCOLOR);
> + viafb_2d_writel(col, VIA_REG_FGCOLOR);
> /* GE Command */
> - writel((0x01 | 0x2000 | (rop << 24)),
> - viaparinfo->io_virt + VIA_REG_GECMD);
> + viafb_2d_writel((0x01 | 0x2000 | (rop << 24)), VIA_REG_GECMD);
>
> }
>
> @@ -943,15 +941,14 @@ static void viafb_copyarea(struct fb_info *info,
> viafb_set_2d_mode(info);
>
> /* BitBlt Source Address */
> - writel(((sy << 16) | sx), viaparinfo->io_virt + VIA_REG_SRCPOS);
> + viafb_2d_writel(((sy << 16) | sx), VIA_REG_SRCPOS);
> /* BitBlt Destination Address */
> - writel(((dy << 16) | dx), viaparinfo->io_virt + VIA_REG_DSTPOS);
> + viafb_2d_writel(((dy << 16) | dx), VIA_REG_DSTPOS);
> /* Dimension: width & height */
> - writel((((area->height - 1) << 16) | (area->width - 1)),
> - viaparinfo->io_virt + VIA_REG_DIMENSION);
> + viafb_2d_writel((((area->height - 1) << 16) | (area->width - 1)),
> + VIA_REG_DIMENSION);
> /* GE Command */
> - writel((0x01 | direction | (0xCC << 24)),
> - viaparinfo->io_virt + VIA_REG_GECMD);
> + viafb_2d_writel((0x01 | direction | (0xCC << 24)), VIA_REG_GECMD);
>
> }
>
> @@ -987,19 +984,18 @@ static void viafb_imageblit(struct fb_info *info,
> viafb_set_2d_mode(info);
>
> /* BitBlt Source Address */
> - writel(0x0, viaparinfo->io_virt + VIA_REG_SRCPOS);
> + viafb_2d_writel(0x0, VIA_REG_SRCPOS);
> /* BitBlt Destination Address */
> - writel(((image->dy << 16) | image->dx),
> - viaparinfo->io_virt + VIA_REG_DSTPOS);
> + viafb_2d_writel(((image->dy << 16) | image->dx), VIA_REG_DSTPOS);
> /* Dimension: width & height */
> - writel((((image->height - 1) << 16) | (image->width - 1)),
> - viaparinfo->io_virt + VIA_REG_DIMENSION);
> + viafb_2d_writel((((image->height - 1) << 16) | (image->width - 1)),
> + VIA_REG_DIMENSION);
> /* fb color */
> - writel(fg_col, viaparinfo->io_virt + VIA_REG_FGCOLOR);
> + viafb_2d_writel(fg_col, VIA_REG_FGCOLOR);
> /* bg color */
> - writel(bg_col, viaparinfo->io_virt + VIA_REG_BGCOLOR);
> + viafb_2d_writel(bg_col, VIA_REG_BGCOLOR);
> /* GE Command */
> - writel(0xCC020142, viaparinfo->io_virt + VIA_REG_GECMD);
> + viafb_2d_writel(0xCC020142, VIA_REG_GECMD);
>
> for (i = 0; i < size / 4; i++) {
> writel(*udata, viaparinfo->io_virt + VIA_MMIO_BLTBASE);
> --
> 1.6.2.4
>
>
> ------------------------------------------------------------------------------
> Crystal Reports - New Free Runtime and 30 Day Trial
> Check out the new simplified licensing option that enables
> unlimited royalty-free distribution of the report engine
> for externally facing server and web deployment.
> http://p.sf.net/sfu/businessobjects
> _______________________________________________
> Linux-fbdev-devel mailing list
> Linux-fbdev-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-fbdev-devel
>
----------------------------------------------------------------------
Chcesz miec nawigacje GPS ?
Zamow lub przedluz umowe na neostrade, a nawigacja bedzie Twoja.
Kliknij na link po szczegoly! http://link.interia.pl/f219a
------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, &
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://www.creativitycat.com
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH 14/15] viafb: Determine type of 2D engine and store it in chip_info
2009-05-20 20:28 ` [PATCH 14/15] viafb: Determine type of 2D engine and store it in chip_info Harald Welte
2009-05-20 20:28 ` [PATCH 15/15] viafb: Add support for 2D accelerated framebuffer on VX800/VX855 Harald Welte
@ 2009-05-23 6:29 ` Krzysztof Helt
1 sibling, 0 replies; 33+ messages in thread
From: Krzysztof Helt @ 2009-05-23 6:29 UTC (permalink / raw)
To: Harald Welte; +Cc: linux-fbdev-devel
On Thu, 21 May 2009 04:28:52 +0800
Harald Welte <HaraldWelte@viatech.com> wrote:
> From: Harald Welte <laforge@gnumonks.org>
>
> This will help us for the upcoming support for 2D acceleration using
> the M1 engine.
>
> Signed-off-by: Harald Welte <HaraldWelte@viatech.com>
> ---
Acked-by: Krzysztof Helt <krzysztof.h1@wp.pl>
> drivers/video/via/chip.h | 8 ++++++++
> drivers/video/via/hw.c | 15 +++++++++++++++
> drivers/video/via/viafbdev.c | 3 +--
> 3 files changed, 24 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/video/via/chip.h b/drivers/video/via/chip.h
> index 03e90cf..7f4bf73 100644
> --- a/drivers/video/via/chip.h
> +++ b/drivers/video/via/chip.h
> @@ -122,10 +122,18 @@ struct lvds_chip_information {
> int i2c_port;
> };
>
> +/* The type of 2D engine */
> +enum via_2d_engine {
> + VIA_2D_ENG_H2,
> + VIA_2D_ENG_H5,
> + VIA_2D_ENG_M1,
> +};
> +
> struct chip_information {
> int gfx_chip_name;
> int gfx_chip_revision;
> int chip_on_slot;
> + enum via_2d_engine twod_engine;
> struct tmds_chip_information tmds_chip_info;
> struct lvds_chip_information lvds_chip_info;
> struct lvds_chip_information lvds_chip_info2;
> diff --git a/drivers/video/via/hw.c b/drivers/video/via/hw.c
> index e06d6b7..e14b852 100644
> --- a/drivers/video/via/hw.c
> +++ b/drivers/video/via/hw.c
> @@ -2092,6 +2092,21 @@ static void init_gfx_chip_info(struct pci_dev *pdev,
> CX700_REVISION_700;
> }
> }
> +
> + /* Determine which 2D engine we have */
> + switch (viaparinfo->chip_info->gfx_chip_name) {
> + case UNICHROME_VX800:
> + case UNICHROME_VX855:
> + viaparinfo->chip_info->twod_engine = VIA_2D_ENG_M1;
> + break;
> + case UNICHROME_K8M890:
> + case UNICHROME_P4M900:
> + viaparinfo->chip_info->twod_engine = VIA_2D_ENG_H5;
> + break;
> + default:
> + viaparinfo->chip_info->twod_engine = VIA_2D_ENG_H2;
> + break;
> + }
> }
>
> static void init_tmds_chip_info(void)
> diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c
> index 859827b..d6a38ca 100644
> --- a/drivers/video/via/viafbdev.c
> +++ b/drivers/video/via/viafbdev.c
> @@ -214,8 +214,7 @@ static int viafb_check_var(struct fb_var_screeninfo *var,
> if (!info->par)
> return -1;
> p_viafb_par = (struct viafb_par *)info->par;
> - if (p_viafb_par->chip_info->gfx_chip_name == UNICHROME_VX800 ||
> - p_viafb_par->chip_info->gfx_chip_name == UNICHROME_VX855)
> + if (p_viafb_par->chip_info->twod_engine == VIA_2D_ENG_M1)
> var->accel_flags = 0;
>
> return 0;
> --
> 1.6.2.4
>
>
> ------------------------------------------------------------------------------
> Crystal Reports - New Free Runtime and 30 Day Trial
> Check out the new simplified licensing option that enables
> unlimited royalty-free distribution of the report engine
> for externally facing server and web deployment.
> http://p.sf.net/sfu/businessobjects
> _______________________________________________
> Linux-fbdev-devel mailing list
> Linux-fbdev-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-fbdev-devel
>
----------------------------------------------------------------------
Sprawdz pogode na dzis!
Kliknij >>> http://link.interia.pl/f217d
------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, &
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://www.creativitycat.com
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH 15/15] viafb: Add support for 2D accelerated framebuffer on VX800/VX855
2009-05-20 20:28 ` [PATCH 15/15] viafb: Add support for 2D accelerated framebuffer on VX800/VX855 Harald Welte
@ 2009-05-23 6:31 ` Krzysztof Helt
0 siblings, 0 replies; 33+ messages in thread
From: Krzysztof Helt @ 2009-05-23 6:31 UTC (permalink / raw)
To: Harald Welte; +Cc: linux-fbdev-devel
On Thu, 21 May 2009 04:28:53 +0800
Harald Welte <HaraldWelte@viatech.com> wrote:
> From: Harald Welte <laforge@gnumonks.org>
>
> The VX800/VX820 and the VX855/VX875 chipsets have a different 2D
> acceleration engine called "M1". The M1 engine has some subtle
> (and some not-so-subtle) differences to the previous engines,
> so support for accelerated framebuffer on those chipsets was
> disabled so far.
>
> This patch adds full support for the M1 engine to viafb.
>
> Signed-off-by: Harald Welte <HaraldWelte@viatech.com>
> ---
Acked-by: Krzysztof Helt <krzysztof.h1@wp.pl>
You can use more viafb_2d_writel() function in all the code.
> drivers/video/via/accel.c | 72 ++++++++++++++++++++++++++++++++++++-----
> drivers/video/via/accel.h | 40 +++++++++++++++++++++++
> drivers/video/via/viafbdev.c | 2 -
> 3 files changed, 103 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/video/via/accel.c b/drivers/video/via/accel.c
> index b3a414e..a4b66be 100644
> --- a/drivers/video/via/accel.c
> +++ b/drivers/video/via/accel.c
> @@ -20,8 +20,34 @@
> */
> #include "global.h"
>
> +/* Somehow, the M1 engine has the registers in slightly different
> + * locations than previous 2D acceleration engines */
> +static u_int8_t via_m1_eng_reg[] = {
> + [VIA_REG_GECMD] = VIA_REG_GECMD_M1,
> + [VIA_REG_GEMODE] = VIA_REG_GEMODE_M1,
> + [VIA_REG_SRCPOS] = VIA_REG_SRCPOS_M1,
> + [VIA_REG_DSTPOS] = VIA_REG_DSTPOS_M1,
> + [VIA_REG_DIMENSION] = VIA_REG_DIMENSION_M1,
> + [VIA_REG_PATADDR] = VIA_REG_PATADDR_M1,
> + [VIA_REG_FGCOLOR] = VIA_REG_FGCOLOR_M1,
> + [VIA_REG_BGCOLOR] = VIA_REG_BGCOLOR_M1,
> + [VIA_REG_CLIPTL] = VIA_REG_CLIPTL_M1,
> + [VIA_REG_CLIPBR] = VIA_REG_CLIPBR_M1,
> + [VIA_REG_OFFSET] = VIA_REG_OFFSET_M1,
> + [VIA_REG_KEYCONTROL] = VIA_REG_KEYCONTROL_M1,
> + [VIA_REG_SRCBASE] = VIA_REG_SRCBASE_M1,
> + [VIA_REG_DSTBASE] = VIA_REG_DSTBASE_M1,
> + [VIA_REG_PITCH] = VIA_REG_PITCH_M1,
> + [VIA_REG_MONOPAT0] = VIA_REG_MONOPAT0_M1,
> + [VIA_REG_MONOPAT1] = VIA_REG_MONOPAT1_M1,
> +};
> +
> void viafb_2d_writel(u_int32_t val, u_int32_t reg)
> {
> + if (viaparinfo->chip_info->twod_engine == VIA_2D_ENG_M1 &&
> + reg < ARRAY_SIZE(via_m1_eng_reg))
> + reg = via_m1_eng_reg[reg];
> +
> writel(val, viaparinfo->io_virt + reg);
> }
>
> @@ -41,16 +67,26 @@ void viafb_init_2d_engine(void)
> {
> u32 dwVQStartAddr, dwVQEndAddr;
> u32 dwVQLen, dwVQStartL, dwVQEndL, dwVQStartEndH;
> - int i;
> + int i, highest_reg;
>
> /* init 2D engine regs to reset 2D engine */
> - for (i = 0; i <= 0x40; i+= 4)
> + switch (viaparinfo->chip_info->twod_engine) {
> + case VIA_2D_ENG_M1:
> + highest_reg = 0x5c;
> + break;
> + default:
> + highest_reg = 0x40;
> + break;
> + }
> + for (i = 0; i <= highest_reg; i+= 4)
> writel(0x0, viaparinfo->io_virt + i);
>
> /* Init AGP and VQ regs */
> switch (viaparinfo->chip_info->gfx_chip_name) {
> case UNICHROME_K8M890:
> case UNICHROME_P4M900:
> + case UNICHROME_VX800:
> + case UNICHROME_VX855:
> writel(0x00100000, viaparinfo->io_virt + VIA_REG_CR_TRANSET);
> writel(0x680A0000, viaparinfo->io_virt + VIA_REG_CR_TRANSPACE);
> writel(0x02000000, viaparinfo->io_virt + VIA_REG_CR_TRANSPACE);
> @@ -85,6 +121,8 @@ void viafb_init_2d_engine(void)
> switch (viaparinfo->chip_info->gfx_chip_name) {
> case UNICHROME_K8M890:
> case UNICHROME_P4M900:
> + case UNICHROME_VX800:
> + case UNICHROME_VX855:
> dwVQStartL |= 0x20000000;
> dwVQEndL |= 0x20000000;
> dwVQStartEndH |= 0x20000000;
> @@ -97,6 +135,8 @@ void viafb_init_2d_engine(void)
> switch (viaparinfo->chip_info->gfx_chip_name) {
> case UNICHROME_K8M890:
> case UNICHROME_P4M900:
> + case UNICHROME_VX800:
> + case UNICHROME_VX855:
> writel(0x00100000,
> viaparinfo->io_virt + VIA_REG_CR_TRANSET);
You can use more viafb_2d_writel() function in all the code.
> writel(dwVQStartEndH,
> @@ -162,6 +202,8 @@ void viafb_init_2d_engine(void)
> switch (viaparinfo->chip_info->gfx_chip_name) {
> case UNICHROME_K8M890:
> case UNICHROME_P4M900:
> + case UNICHROME_VX800:
> + case UNICHROME_VX855:
> writel(0x00100000,
> viaparinfo->io_virt + VIA_REG_CR_TRANSET);
> writel(0x74301000,
> @@ -216,7 +258,8 @@ void viafb_set_2d_mode(struct fb_info *info)
> /* Set source and destination pitch (128bit aligned) */
> pitch = (viaparinfo->hres * viaparinfo->bpp >> 3) >> 3;
> pitch_reg = pitch | (pitch << 16);
> - pitch_reg |= VIA_PITCH_ENABLE;
> + if (viaparinfo->chip_info->twod_engine != VIA_2D_ENG_M1)
> + pitch_reg |= VIA_PITCH_ENABLE;
> viafb_2d_writel(pitch_reg, VIA_REG_PITCH);
> }
>
> @@ -259,15 +302,26 @@ void viafb_show_hw_cursor(struct fb_info *info, int Status)
> int viafb_wait_engine_idle(void)
> {
> int loop = 0;
> + u_int32_t status_mask;
>
> - while (!(readl(viaparinfo->io_virt + VIA_REG_STATUS) &
> - VIA_VR_QUEUE_BUSY) && (loop < MAXLOOP)) {
> - loop++;
> - cpu_relax();
> + switch (viaparinfo->chip_info->twod_engine) {
> + case VIA_2D_ENG_H5:
> + case VIA_2D_ENG_M1:
> + status_mask = VIA_CMD_RGTR_BUSY_M1 | VIA_2D_ENG_BUSY_M1 |
> + VIA_3D_ENG_BUSY_M1;
> + break;
> + default:
> + while (!(readl(viaparinfo->io_virt + VIA_REG_STATUS) &
> + VIA_VR_QUEUE_BUSY) && (loop < MAXLOOP)) {
> + loop++;
> + cpu_relax();
> + }
> + status_mask = VIA_CMD_RGTR_BUSY | VIA_2D_ENG_BUSY |
> + VIA_3D_ENG_BUSY;
> + break;
> }
>
> - while ((readl(viaparinfo->io_virt + VIA_REG_STATUS) &
> - (VIA_CMD_RGTR_BUSY | VIA_2D_ENG_BUSY | VIA_3D_ENG_BUSY)) &&
> + while ((readl(viaparinfo->io_virt + VIA_REG_STATUS) & status_mask) &&
> (loop < MAXLOOP)) {
> loop++;
> cpu_relax();
> diff --git a/drivers/video/via/accel.h b/drivers/video/via/accel.h
> index 5081ac2..9a39ed1 100644
> --- a/drivers/video/via/accel.h
> +++ b/drivers/video/via/accel.h
> @@ -67,6 +67,34 @@
> /* from 0x100 to 0x1ff */
> #define VIA_REG_COLORPAT 0x100
>
> +/* defines for VIA 2D registers for vt3353/3409 (M1 engine)*/
> +#define VIA_REG_GECMD_M1 0x000
> +#define VIA_REG_GEMODE_M1 0x004
> +#define VIA_REG_GESTATUS_M1 0x004 /* as same as VIA_REG_GEMODE */
> +#define VIA_REG_PITCH_M1 0x008 /* pitch of src and dst */
> +#define VIA_REG_DIMENSION_M1 0x00C /* width and height */
> +#define VIA_REG_DSTPOS_M1 0x010
> +#define VIA_REG_LINE_XY_M1 0x010
> +#define VIA_REG_DSTBASE_M1 0x014
> +#define VIA_REG_SRCPOS_M1 0x018
> +#define VIA_REG_LINE_K1K2_M1 0x018
> +#define VIA_REG_SRCBASE_M1 0x01C
> +#define VIA_REG_PATADDR_M1 0x020
> +#define VIA_REG_MONOPAT0_M1 0x024
> +#define VIA_REG_MONOPAT1_M1 0x028
> +#define VIA_REG_OFFSET_M1 0x02C
> +#define VIA_REG_LINE_ERROR_M1 0x02C
> +#define VIA_REG_CLIPTL_M1 0x040 /* top and left of clipping */
> +#define VIA_REG_CLIPBR_M1 0x044 /* bottom and right of clipping */
> +#define VIA_REG_KEYCONTROL_M1 0x048 /* color key control */
> +#define VIA_REG_FGCOLOR_M1 0x04C
> +#define VIA_REG_DSTCOLORKEY_M1 0x04C /* as same as VIA_REG_FG */
> +#define VIA_REG_BGCOLOR_M1 0x050
> +#define VIA_REG_SRCCOLORKEY_M1 0x050 /* as same as VIA_REG_BG */
> +#define VIA_REG_MONOPATFGC_M1 0x058 /* Add BG color of Pattern. */
> +#define VIA_REG_MONOPATBGC_M1 0x05C /* Add FG color of Pattern. */
> +#define VIA_REG_COLORPAT_M1 0x100 /* from 0x100 to 0x1ff */
> +
> /* VIA_REG_PITCH(0x38): Pitch Setting */
> #define VIA_PITCH_ENABLE 0x80000000
>
> @@ -157,6 +185,18 @@
> /* Virtual Queue is busy */
> #define VIA_VR_QUEUE_BUSY 0x00020000
>
> +/* VIA_REG_STATUS(0x400): Engine Status for H5 */
> +#define VIA_CMD_RGTR_BUSY_H5 0x00000010 /* Command Regulator is busy */
> +#define VIA_2D_ENG_BUSY_H5 0x00000002 /* 2D Engine is busy */
> +#define VIA_3D_ENG_BUSY_H5 0x00001FE1 /* 3D Engine is busy */
> +#define VIA_VR_QUEUE_BUSY_H5 0x00000004 /* Virtual Queue is busy */
> +
> +/* VIA_REG_STATUS(0x400): Engine Status for VT3353/3409 */
> +#define VIA_CMD_RGTR_BUSY_M1 0x00000010 /* Command Regulator is busy */
> +#define VIA_2D_ENG_BUSY_M1 0x00000002 /* 2D Engine is busy */
> +#define VIA_3D_ENG_BUSY_M1 0x00001FE1 /* 3D Engine is busy */
> +#define VIA_VR_QUEUE_BUSY_M1 0x00000004 /* Virtual Queue is busy */
> +
> #define MAXLOOP 0xFFFFFF
>
> void viafb_2d_writel(u_int32_t val, u_int32_t reg);
> diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c
> index d6a38ca..3a22a3a 100644
> --- a/drivers/video/via/viafbdev.c
> +++ b/drivers/video/via/viafbdev.c
> @@ -214,8 +214,6 @@ static int viafb_check_var(struct fb_var_screeninfo *var,
> if (!info->par)
> return -1;
> p_viafb_par = (struct viafb_par *)info->par;
> - if (p_viafb_par->chip_info->twod_engine == VIA_2D_ENG_M1)
> - var->accel_flags = 0;
>
> return 0;
> }
> --
> 1.6.2.4
>
>
> ------------------------------------------------------------------------------
> Crystal Reports - New Free Runtime and 30 Day Trial
> Check out the new simplified licensing option that enables
> unlimited royalty-free distribution of the report engine
> for externally facing server and web deployment.
> http://p.sf.net/sfu/businessobjects
> _______________________________________________
> Linux-fbdev-devel mailing list
> Linux-fbdev-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-fbdev-devel
>
----------------------------------------------------------------------
Weekend w gorach za 100 PLN!
Sprawdz >>> http://link.interia.pl/f218c
------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, &
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://www.creativitycat.com
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH 10/15] viafb: make module parameters visible in sysfs
2009-05-20 20:28 ` [PATCH 10/15] viafb: make module parameters visible in sysfs Harald Welte
2009-05-20 20:28 ` [PATCH 11/15] viafb: clean up duplicated code from 2D acceleration Harald Welte
@ 2009-05-23 6:32 ` Krzysztof Helt
1 sibling, 0 replies; 33+ messages in thread
From: Krzysztof Helt @ 2009-05-23 6:32 UTC (permalink / raw)
To: Harald Welte; +Cc: linux-fbdev-devel
On Thu, 21 May 2009 04:28:48 +0800
Harald Welte <HaraldWelte@viatech.com> wrote:
> From: Harald Welte <laforge@gnumonks.org>
>
> Signed-off-by: Harald Welte <HaraldWelte@viatech.com>
> ---
Acked-by: Krzysztof Helt <krzysztof.h1@wp.pl>
> drivers/video/via/viafbdev.c | 45 +++++++++++++++++++++--------------------
> 1 files changed, 23 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c
> index 00f58c8..980eab8 100644
> --- a/drivers/video/via/viafbdev.c
> +++ b/drivers/video/via/viafbdev.c
> @@ -20,6 +20,7 @@
> */
>
> #include <linux/module.h>
> +#include <linux/stat.h>
> #define _MASTER_FILE
>
> #include "global.h"
> @@ -2570,82 +2571,82 @@ module_init(viafb_init);
> module_exit(viafb_exit);
>
> #ifdef MODULE
> -module_param(viafb_memsize, int, 0);
> +module_param(viafb_memsize, int, S_IRUSR);
>
> -module_param(viafb_mode, charp, 0);
> +module_param(viafb_mode, charp, S_IRUSR);
> MODULE_PARM_DESC(viafb_mode, "Set resolution (default=640x480)");
>
> -module_param(viafb_mode1, charp, 0);
> +module_param(viafb_mode1, charp, S_IRUSR);
> MODULE_PARM_DESC(viafb_mode1, "Set resolution (default=640x480)");
>
> -module_param(viafb_bpp, int, 0);
> +module_param(viafb_bpp, int, S_IRUSR);
> MODULE_PARM_DESC(viafb_bpp, "Set color depth (default=32bpp)");
>
> -module_param(viafb_bpp1, int, 0);
> +module_param(viafb_bpp1, int, S_IRUSR);
> MODULE_PARM_DESC(viafb_bpp1, "Set color depth (default=32bpp)");
>
> -module_param(viafb_refresh, int, 0);
> +module_param(viafb_refresh, int, S_IRUSR);
> MODULE_PARM_DESC(viafb_refresh,
> "Set CRT viafb_refresh rate (default = 60)");
>
> -module_param(viafb_refresh1, int, 0);
> +module_param(viafb_refresh1, int, S_IRUSR);
> MODULE_PARM_DESC(viafb_refresh1,
> "Set CRT refresh rate (default = 60)");
>
> -module_param(viafb_lcd_panel_id, int, 0);
> +module_param(viafb_lcd_panel_id, int, S_IRUSR);
> MODULE_PARM_DESC(viafb_lcd_panel_id,
> "Set Flat Panel type(Default=1024x768)");
>
> -module_param(viafb_lcd_dsp_method, int, 0);
> +module_param(viafb_lcd_dsp_method, int, S_IRUSR);
> MODULE_PARM_DESC(viafb_lcd_dsp_method,
> "Set Flat Panel display scaling method.(Default=Expandsion)");
>
> -module_param(viafb_SAMM_ON, int, 0);
> +module_param(viafb_SAMM_ON, int, S_IRUSR);
> MODULE_PARM_DESC(viafb_SAMM_ON,
> "Turn on/off flag of SAMM(Default=OFF)");
>
> -module_param(viafb_accel, int, 0);
> +module_param(viafb_accel, int, S_IRUSR);
> MODULE_PARM_DESC(viafb_accel,
> "Set 2D Hardware Acceleration.(Default = OFF)");
>
> -module_param(viafb_active_dev, charp, 0);
> +module_param(viafb_active_dev, charp, S_IRUSR);
> MODULE_PARM_DESC(viafb_active_dev, "Specify active devices.");
>
> -module_param(viafb_display_hardware_layout, int, 0);
> +module_param(viafb_display_hardware_layout, int, S_IRUSR);
> MODULE_PARM_DESC(viafb_display_hardware_layout,
> "Display Hardware Layout (LCD Only, DVI Only...,etc)");
>
> -module_param(viafb_second_size, int, 0);
> +module_param(viafb_second_size, int, S_IRUSR);
> MODULE_PARM_DESC(viafb_second_size,
> "Set secondary device memory size");
>
> -module_param(viafb_dual_fb, int, 0);
> +module_param(viafb_dual_fb, int, S_IRUSR);
> MODULE_PARM_DESC(viafb_dual_fb,
> "Turn on/off flag of dual framebuffer devices.(Default = OFF)");
>
> -module_param(viafb_platform_epia_dvi, int, 0);
> +module_param(viafb_platform_epia_dvi, int, S_IRUSR);
> MODULE_PARM_DESC(viafb_platform_epia_dvi,
> "Turn on/off flag of DVI devices on EPIA board.(Default = OFF)");
>
> -module_param(viafb_device_lcd_dualedge, int, 0);
> +module_param(viafb_device_lcd_dualedge, int, S_IRUSR);
> MODULE_PARM_DESC(viafb_device_lcd_dualedge,
> "Turn on/off flag of dual edge panel.(Default = OFF)");
>
> -module_param(viafb_bus_width, int, 0);
> +module_param(viafb_bus_width, int, S_IRUSR);
> MODULE_PARM_DESC(viafb_bus_width,
> "Set bus width of panel.(Default = 12)");
>
> -module_param(viafb_lcd_mode, int, 0);
> +module_param(viafb_lcd_mode, int, S_IRUSR);
> MODULE_PARM_DESC(viafb_lcd_mode,
> "Set Flat Panel mode(Default=OPENLDI)");
>
> -module_param(viafb_video_dev, charp, 0);
> +module_param(viafb_video_dev, charp, S_IRUSR);
> MODULE_PARM_DESC(viafb_video_dev, "Specify video devices.");
>
> -module_param(viafb_lcd_port, charp, 0);
> +module_param(viafb_lcd_port, charp, S_IRUSR);
> MODULE_PARM_DESC(viafb_lcd_port, "Specify LCD output port.");
>
> -module_param(viafb_dvi_port, charp, 0);
> +module_param(viafb_dvi_port, charp, S_IRUSR);
> MODULE_PARM_DESC(viafb_dvi_port, "Specify DVI output port.");
>
> MODULE_LICENSE("GPL");
> --
> 1.6.2.4
>
>
> ------------------------------------------------------------------------------
> Crystal Reports - New Free Runtime and 30 Day Trial
> Check out the new simplified licensing option that enables
> unlimited royalty-free distribution of the report engine
> for externally facing server and web deployment.
> http://p.sf.net/sfu/businessobjects
> _______________________________________________
> Linux-fbdev-devel mailing list
> Linux-fbdev-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-fbdev-devel
>
----------------------------------------------------------------------
Sprawdz pogode na dzis!
Kliknij >>> http://link.interia.pl/f217d
------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, &
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://www.creativitycat.com
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH 09/15] viafb: Remove MMIO from private structure
2009-05-20 20:28 ` [PATCH 09/15] viafb: Remove MMIO from " Harald Welte
2009-05-20 20:28 ` [PATCH 10/15] viafb: make module parameters visible in sysfs Harald Welte
@ 2009-05-23 6:32 ` Krzysztof Helt
1 sibling, 0 replies; 33+ messages in thread
From: Krzysztof Helt @ 2009-05-23 6:32 UTC (permalink / raw)
To: Harald Welte; +Cc: linux-fbdev-devel
On Thu, 21 May 2009 04:28:47 +0800
Harald Welte <HaraldWelte@viatech.com> wrote:
> From: Harald Welte <laforge@gnumonks.org>
>
> Rather than using our own private structure members for MMIO base
> and length, we use the fb_info->fix ones.
>
> Signed-off-by: Harald Welte <HaraldWelte@viatech.com>
> ---
Acked-by: Krzysztof Helt <krzysztof.h1@wp.pl>
> drivers/video/via/viafbdev.c | 11 ++++-------
> drivers/video/via/viafbdev.h | 2 --
> 2 files changed, 4 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c
> index c420623..00f58c8 100644
> --- a/drivers/video/via/viafbdev.c
> +++ b/drivers/video/via/viafbdev.c
> @@ -122,9 +122,6 @@ static void viafb_setup_fixinfo(struct fb_fix_screeninfo *fix,
> strcpy(fix->id, viafb_name);
>
> fix->smem_len = viaparinfo->fbmem_free;
> - fix->mmio_start = viaparinfo->mmio_base;
> - fix->mmio_len = viaparinfo->mmio_len;
> -
> fix->type = FB_TYPE_PACKED_PIXELS;
> fix->type_aux = 0;
>
> @@ -2175,10 +2172,10 @@ static int __devinit via_pci_probe(struct pci_dev *pdev,
> goto out_delete_i2c;
> }
>
> - viaparinfo->mmio_base = pci_resource_start(pdev, 1);
> - viaparinfo->mmio_len = pci_resource_len(pdev, 1);
> - viaparinfo->io_virt = ioremap_nocache(viaparinfo->mmio_base,
> - viaparinfo->mmio_len);
> + viafbinfo->fix.mmio_start = pci_resource_start(pdev, 1);
> + viafbinfo->fix.mmio_len = pci_resource_len(pdev, 1);
> + viaparinfo->io_virt = ioremap_nocache(viafbinfo->fix.mmio_start,
> + viafbinfo->fix.mmio_len);
> if (!viaparinfo->io_virt) {
> printk(KERN_ERR "ioremap of MMIO failed\n");
> rc = -EIO;
> diff --git a/drivers/video/via/viafbdev.h b/drivers/video/via/viafbdev.h
> index ed4129e..0c1d734 100644
> --- a/drivers/video/via/viafbdev.h
> +++ b/drivers/video/via/viafbdev.h
> @@ -47,8 +47,6 @@ struct viafb_par {
>
> void __iomem *io_virt; /*iospace virtual memory address */
> unsigned int io; /*io space address */
> - unsigned long mmio_base; /*mmio base address */
> - unsigned long mmio_len; /*mmio base length */
> u32 fbmem_free; /* Free FB memory */
> u32 fbmem_used; /* Use FB memory size */
> u32 cursor_start; /* Cursor Start Address */
> --
> 1.6.2.4
>
>
> ------------------------------------------------------------------------------
> Crystal Reports - New Free Runtime and 30 Day Trial
> Check out the new simplified licensing option that enables
> unlimited royalty-free distribution of the report engine
> for externally facing server and web deployment.
> http://p.sf.net/sfu/businessobjects
> _______________________________________________
> Linux-fbdev-devel mailing list
> Linux-fbdev-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-fbdev-devel
>
----------------------------------------------------------------------
Chcesz miec nawigacje GPS ?
Zamow lub przedluz umowe na neostrade, a nawigacja bedzie Twoja.
Kliknij na link po szczegoly! http://link.interia.pl/f219a
------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, &
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://www.creativitycat.com
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH 08/15] viafb: get rid of some duplicated fields in private structure
2009-05-20 20:28 ` [PATCH 08/15] viafb: get rid of some duplicated fields in private structure Harald Welte
2009-05-20 20:28 ` [PATCH 09/15] viafb: Remove MMIO from " Harald Welte
@ 2009-05-23 6:34 ` Krzysztof Helt
1 sibling, 0 replies; 33+ messages in thread
From: Krzysztof Helt @ 2009-05-23 6:34 UTC (permalink / raw)
To: Harald Welte; +Cc: linux-fbdev-devel
On Thu, 21 May 2009 04:28:46 +0800
Harald Welte <HaraldWelte@viatech.com> wrote:
> From: Harald Welte <laforge@gnumonks.org>
>
> Instead of using private structure members, we use the standard ones:
> * viapar->fbmem converted to fb_info->fix.smem_start
> * viapar->memsize is converted to fb_info->fix.smem_len
> * viapar->fbmem_virt is convereted to fb_info->screen_base
>
> Signed-off-by: Harald Welte <HaraldWelte@viatech.com>
> ---
> drivers/video/via/global.c | 1 -
> drivers/video/via/hw.c | 2 +-
> drivers/video/via/viafbdev.c | 47 +++++++++++++++++++----------------------
> drivers/video/via/viafbdev.h | 3 --
> 4 files changed, 23 insertions(+), 30 deletions(-)
>
> diff --git a/drivers/video/via/global.c b/drivers/video/via/global.c
> index 468be24..2b7d0d3 100644
> --- a/drivers/video/via/global.c
> +++ b/drivers/video/via/global.c
> @@ -57,4 +57,3 @@ struct fb_info *viafbinfo;
> struct fb_info *viafbinfo1;
> struct viafb_par *viaparinfo;
> struct viafb_par *viaparinfo1;
> -
> diff --git a/drivers/video/via/hw.c b/drivers/video/via/hw.c
> index 40b7c0c..e06d6b7 100644
> --- a/drivers/video/via/hw.c
> +++ b/drivers/video/via/hw.c
> @@ -680,7 +680,7 @@ void viafb_set_start_addr(void)
> size = 8 * 1024 * 1024;
> } else {
>
> - size = viaparinfo1->memsize;
> + size = viafbinfo1->fix.smem_len;
> }
> offset = viafb_second_offset;
> DEBUG_MSG(KERN_INFO
> diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c
> index 7e8f2f6..c420623 100644
> --- a/drivers/video/via/viafbdev.c
> +++ b/drivers/video/via/viafbdev.c
> @@ -119,10 +119,8 @@ static int viafb_update_fix(struct fb_fix_screeninfo *fix, struct fb_info *info)
> static void viafb_setup_fixinfo(struct fb_fix_screeninfo *fix,
> struct viafb_par *viaparinfo)
> {
> - memset(fix, 0, sizeof(struct fb_fix_screeninfo));
> strcpy(fix->id, viafb_name);
>
> - fix->smem_start = viaparinfo->fbmem;
> fix->smem_len = viaparinfo->fbmem_free;
> fix->mmio_start = viaparinfo->mmio_base;
> fix->mmio_len = viaparinfo->mmio_len;
> @@ -196,7 +194,7 @@ static int viafb_check_var(struct fb_var_screeninfo *var,
> /*32 pixel alignment */
> var->xres_virtual = (var->xres_virtual + 31) & ~31;
> if (var->xres_virtual * var->yres_virtual * var->bits_per_pixel / 8 >
> - ppar->memsize)
> + info->fix.smem_len)
> return -EINVAL;
>
> /* Based on var passed in to calculate the refresh,
> @@ -630,13 +628,13 @@ static int viafb_ioctl(struct fb_info *info, u_int cmd, u_long arg)
> (viaparinfo->fbmem_free >> 1);
> }
> }
> - u.viasamm.mem_base = viaparinfo->fbmem;
> + u.viasamm.mem_base = viafbinfo->fix.smem_start;
> u.viasamm.offset_sec = viafb_second_offset;
> } else {
> u.viasamm.size_prim =
> - viaparinfo->memsize - viaparinfo->fbmem_used;
> + viafbinfo->fix.smem_len - viaparinfo->fbmem_used;
> u.viasamm.size_sec = 0;
> - u.viasamm.mem_base = viaparinfo->fbmem;
> + u.viasamm.mem_base = viafbinfo->fix.smem_start;
> u.viasamm.offset_sec = 0;
> }
>
> @@ -1245,7 +1243,7 @@ static int viafb_cursor(struct fb_info *info, struct fb_cursor *cursor)
> }
> }
>
> - memcpy(((struct viafb_par *)(info->par))->fbmem_virt +
> + memcpy(info->screen_base +
> ((struct viafb_par *)(info->par))->cursor_start,
> cr_data->bak, CURSOR_SIZE);
> out:
> @@ -2164,15 +2162,14 @@ static int __devinit via_pci_probe(struct pci_dev *pdev,
> goto out_fb_release;
>
> viafb_init_chip_info(pdev, ent);
> - viaparinfo->fbmem = pci_resource_start(pdev, 0);
> - viaparinfo->memsize = viafb_get_fb_size_from_pci();
> - viaparinfo->fbmem_free = viaparinfo->memsize;
> + viafbinfo->fix.smem_start = pci_resource_start(pdev, 0);
> + viafbinfo->fix.smem_len = viafb_get_fb_size_from_pci();
> + viaparinfo->fbmem_free = viafbinfo->fix.smem_len;
> viaparinfo->fbmem_used = 0;
> - viaparinfo->fbmem_virt = ioremap_nocache(viaparinfo->fbmem,
> - viaparinfo->memsize);
> - viafbinfo->screen_base = (char *)viaparinfo->fbmem_virt;
> + viafbinfo->screen_base = ioremap_nocache(viafbinfo->fix.smem_start,
> + viafbinfo->fix.smem_len);
>
> - if (!viaparinfo->fbmem_virt) {
> + if (!viafbinfo->screen_base) {
> printk(KERN_ERR "ioremap of fbmem failed\n");
> rc = -EIO;
> goto out_delete_i2c;
> @@ -2208,7 +2205,7 @@ static int __devinit via_pci_probe(struct pci_dev *pdev,
> viafb_second_size * 1024 * 1024;
> }
>
> - viafb_FB_MM = viaparinfo->fbmem_virt;
> + viafb_FB_MM = viafbinfo->screen_base;
> tmpm = viafb_mode;
> tmpc = strsep(&tmpm, "x");
> strict_strtoul(tmpc, 0, &default_xres);
> @@ -2298,17 +2295,18 @@ static int __devinit via_pci_probe(struct pci_dev *pdev,
> }
> viaparinfo1 = viafbinfo1->par;
> memcpy(viaparinfo1, viaparinfo, viafb_par_length);
> - viaparinfo1->memsize = viaparinfo->memsize -
> - viafb_second_offset;
> - viaparinfo->memsize = viafb_second_offset;
> - viaparinfo1->fbmem_virt = viaparinfo->fbmem_virt +
> + viafbinfo1->fix.smem_len = viafbinfo->fix.smem_len -
> + viafb_second_offset;
> + viafbinfo->fix.smem_len = viafb_second_offset;
> + viafbinfo1->screen_base = viafbinfo->screen_base +
> viafb_second_offset;
> - viaparinfo1->fbmem = viaparinfo->fbmem + viafb_second_offset;
> + viafbinfo1->fix.smem_start = viafbinfo->fix.smem_start +
> + viafb_second_offset;
>
> viaparinfo1->fbmem_used = viaparinfo->fbmem_used;
> - viaparinfo1->fbmem_free = viaparinfo1->memsize -
> + viaparinfo1->fbmem_free = viafbinfo1->fix.smem_len -
> viaparinfo1->fbmem_used;
> - viaparinfo->fbmem_free = viaparinfo->memsize;
> + viaparinfo->fbmem_free = viafbinfo->fix.smem_len;
> viaparinfo->fbmem_used = 0;
> if (viafb_accel) {
> viaparinfo1->cursor_start =
> @@ -2322,7 +2320,6 @@ static int __devinit via_pci_probe(struct pci_dev *pdev,
> memcpy(viafbinfo1, viafbinfo, sizeof(struct fb_info));
> viafbinfo1->screen_base = viafbinfo->screen_base +
> viafb_second_offset;
> - viafbinfo1->fix.smem_start = viaparinfo1->fbmem;
> viafbinfo1->fix.smem_len = viaparinfo1->fbmem_free;
>
> default_var.xres = viafb_second_xres;
> @@ -2398,7 +2395,7 @@ out_fb1_release:
> out_unmap_mmio:
> iounmap(viaparinfo->io_virt);
> out_unmap_fbmem:
> - iounmap((void *)viaparinfo->fbmem_virt);
> + iounmap((void *)viafbinfo->screen_base);
The cast here and below is not needed.
> out_delete_i2c:
> viafb_delete_i2c_buss(viaparinfo);
> out_fb_release:
> @@ -2413,7 +2410,7 @@ static void __devexit via_pci_remove(struct pci_dev *pdev)
> unregister_framebuffer(viafbinfo);
> if (viafb_dual_fb)
> unregister_framebuffer(viafbinfo1);
> - iounmap((void *)viaparinfo->fbmem_virt);
> + iounmap((void *)viafbinfo->screen_base);
> iounmap(viaparinfo->io_virt);
>
> viafb_delete_i2c_buss(viaparinfo);
> diff --git a/drivers/video/via/viafbdev.h b/drivers/video/via/viafbdev.h
> index a4158e8..ed4129e 100644
> --- a/drivers/video/via/viafbdev.h
> +++ b/drivers/video/via/viafbdev.h
> @@ -45,10 +45,7 @@ struct viafb_par {
> u32 xoffset;
> u32 yoffset;
>
> - void __iomem *fbmem_virt; /*framebuffer virtual memory address */
> void __iomem *io_virt; /*iospace virtual memory address */
> - unsigned int fbmem; /*framebuffer physical memory address */
> - unsigned int memsize; /*size of fbmem */
> unsigned int io; /*io space address */
> unsigned long mmio_base; /*mmio base address */
> unsigned long mmio_len; /*mmio base length */
> --
> 1.6.2.4
>
>
> ------------------------------------------------------------------------------
> Crystal Reports - New Free Runtime and 30 Day Trial
> Check out the new simplified licensing option that enables
> unlimited royalty-free distribution of the report engine
> for externally facing server and web deployment.
> http://p.sf.net/sfu/businessobjects
> _______________________________________________
> Linux-fbdev-devel mailing list
> Linux-fbdev-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-fbdev-devel
>
----------------------------------------------------------------------
Fantastyczne nagrody do zgarniecia!
Zagraj >> http://link.interia.pl/f2177
------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, &
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://www.creativitycat.com
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH 07/15] viafb: use proper pci config API
2009-05-20 20:28 ` [PATCH 07/15] viafb: use proper pci config API Harald Welte
2009-05-20 20:28 ` [PATCH 08/15] viafb: get rid of some duplicated fields in private structure Harald Welte
@ 2009-05-23 6:52 ` Krzysztof Helt
1 sibling, 0 replies; 33+ messages in thread
From: Krzysztof Helt @ 2009-05-23 6:52 UTC (permalink / raw)
To: Harald Welte; +Cc: linux-fbdev-devel
On Thu, 21 May 2009 04:28:45 +0800
Harald Welte <HaraldWelte@viatech.com> wrote:
> From: Harald Welte <laforge@gnumonks.org>
>
> This patch alters viafb to use the proper Linux in-kernel API to access
> PCI configuration space, rather than poking at I/O ports by itself.
>
> Signed-off-by: Harald Welte <HaraldWelte@viatech.com>
> ---
Acked-by: Krzysztof Helt <krzysztof.h1@wp.pl>
> drivers/video/via/hw.c | 64 +++++++++++++++++++++++++++++------------------
> drivers/video/via/hw.h | 4 +-
> 2 files changed, 41 insertions(+), 27 deletions(-)
>
> diff --git a/drivers/video/via/hw.c b/drivers/video/via/hw.c
> index 6306c88..40b7c0c 100644
> --- a/drivers/video/via/hw.c
> +++ b/drivers/video/via/hw.c
> @@ -2599,24 +2599,37 @@ static void disable_second_display_channel(void)
> viafb_write_reg_mask(CR6A, VIACR, BIT6, BIT6);
> }
>
> +static u_int16_t via_function3[] = {
> + CLE266_FUNCTION3, KM400_FUNCTION3, CN400_FUNCTION3, CN700_FUNCTION3,
> + CX700_FUNCTION3, KM800_FUNCTION3, KM890_FUNCTION3, P4M890_FUNCTION3,
> + P4M900_FUNCTION3, VX800_FUNCTION3, VX855_FUNCTION3,
> +};
> +
> +/* Get the BIOS-configured framebuffer size from PCI configuration space
> + * of function 3 in the respective chipset */
> int viafb_get_fb_size_from_pci(void)
> {
> - unsigned long configid, deviceid, FBSize = 0;
> - int VideoMemSize;
> - int DeviceFound = false;
> -
> - for (configid = 0x80000000; configid < 0x80010800; configid += 0x100) {
> - outl(configid, (unsigned long)0xCF8);
> - deviceid = (inl((unsigned long)0xCFC) >> 16) & 0xffff;
> -
> - switch (deviceid) {
> - case CLE266:
> - case KM400:
> - outl(configid + 0xE0, (unsigned long)0xCF8);
> - FBSize = inl((unsigned long)0xCFC);
> - DeviceFound = true; /* Found device id */
> - break;
> + int i;
> + u_int8_t offset = 0;
> + u_int32_t FBSize;
> + u_int32_t VideoMemSize;
> +
> + /* search for the "FUNCTION3" device in this chipset */
> + for (i = 0; i < ARRAY_SIZE(via_function3); i++) {
> + struct pci_dev *pdev;
> +
> + pdev = pci_get_device(PCI_VENDOR_ID_VIA, via_function3[i],
> + NULL);
> + if (!pdev)
> + continue;
> +
> + DEBUG_MSG(KERN_INFO "Device ID = %x\n", pdev->device);
>
> + switch (pdev->device) {
> + case CLE266_FUNCTION3:
> + case KM400_FUNCTION3:
> + offset = 0xE0;
> + break;
> case CN400_FUNCTION3:
> case CN700_FUNCTION3:
> case CX700_FUNCTION3:
> @@ -2626,21 +2639,22 @@ int viafb_get_fb_size_from_pci(void)
> case P4M900_FUNCTION3:
> case VX800_FUNCTION3:
> case VX855_FUNCTION3:
> - /*case CN750_FUNCTION3: */
> - outl(configid + 0xA0, (unsigned long)0xCF8);
> - FBSize = inl((unsigned long)0xCFC);
> - DeviceFound = true; /* Found device id */
> - break;
> -
> - default:
> + /*case CN750_FUNCTION3: */
> + offset = 0xA0;
> break;
> }
> -
> - if (DeviceFound)
> +
> + if (!offset)
> break;
> +
> + pci_read_config_dword(pdev, offset, &FBSize);
> + pci_dev_put(pdev);
> }
>
> - DEBUG_MSG(KERN_INFO "Device ID = %lx\n", deviceid);
> + if (!offset) {
> + printk(KERN_ERR "cannot determine framebuffer size\n");
> + return -EIO;
> + }
>
> FBSize = FBSize & 0x00007000;
> DEBUG_MSG(KERN_INFO "FB Size = %x\n", FBSize);
> diff --git a/drivers/video/via/hw.h b/drivers/video/via/hw.h
> index 1cd0648..a69e907 100644
> --- a/drivers/video/via/hw.h
> +++ b/drivers/video/via/hw.h
> @@ -850,8 +850,8 @@ struct iga2_crtc_timing {
> };
>
> /* device ID */
> -#define CLE266 0x3123
> -#define KM400 0x3205
> +#define CLE266_FUNCTION3 0x3123
> +#define KM400_FUNCTION3 0x3205
> #define CN400_FUNCTION2 0x2259
> #define CN400_FUNCTION3 0x3259
> /* support VT3314 chipset */
> --
> 1.6.2.4
>
>
> ------------------------------------------------------------------------------
> Crystal Reports - New Free Runtime and 30 Day Trial
> Check out the new simplified licensing option that enables
> unlimited royalty-free distribution of the report engine
> for externally facing server and web deployment.
> http://p.sf.net/sfu/businessobjects
> _______________________________________________
> Linux-fbdev-devel mailing list
> Linux-fbdev-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-fbdev-devel
>
----------------------------------------------------------------------
Chcesz miec nawigacje GPS ?
Zamow lub przedluz umowe na neostrade, a nawigacja bedzie Twoja.
Kliknij na link po szczegoly! http://link.interia.pl/f219a
------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, &
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://www.creativitycat.com
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH 06/15] viafb: pass reference to pci device when calling framebuffer_alloc()
2009-05-20 20:28 ` [PATCH 06/15] viafb: pass reference to pci device when calling framebuffer_alloc() Harald Welte
2009-05-20 20:28 ` [PATCH 07/15] viafb: use proper pci config API Harald Welte
@ 2009-05-23 6:52 ` Krzysztof Helt
1 sibling, 0 replies; 33+ messages in thread
From: Krzysztof Helt @ 2009-05-23 6:52 UTC (permalink / raw)
To: Harald Welte; +Cc: linux-fbdev-devel
On Thu, 21 May 2009 04:28:44 +0800
Harald Welte <HaraldWelte@viatech.com> wrote:
> From: Harald Welte <laforge@gnumonks.org>
>
> Signed-off-by: Harald Welte <HaraldWelte@viatech.com>
> ---
Acked-by: Krzysztof Helt <krzysztof.h1@wp.pl>
> drivers/video/via/viafbdev.c | 3 ++-
> 1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c
> index 3040dd9..7e8f2f6 100644
> --- a/drivers/video/via/viafbdev.c
> +++ b/drivers/video/via/viafbdev.c
> @@ -2128,7 +2128,8 @@ static int __devinit via_pci_probe(struct pci_dev *pdev,
> * variables
> */
> viafbinfo = framebuffer_alloc(viafb_par_length + 2 * lvds_length +
> - tmds_length + crt_length + chip_length, NULL);
> + tmds_length + crt_length + chip_length,
> + &pdev->dev);
> if (!viafbinfo) {
> printk(KERN_ERR"Could not allocate memory for viafb_info.\n");
> return -ENOMEM;
> --
> 1.6.2.4
>
>
> ------------------------------------------------------------------------------
> Crystal Reports - New Free Runtime and 30 Day Trial
> Check out the new simplified licensing option that enables
> unlimited royalty-free distribution of the report engine
> for externally facing server and web deployment.
> http://p.sf.net/sfu/businessobjects
> _______________________________________________
> Linux-fbdev-devel mailing list
> Linux-fbdev-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-fbdev-devel
>
----------------------------------------------------------------------
Weekend w gorach za 100 PLN!
Sprawdz >>> http://link.interia.pl/f218c
------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, &
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://www.creativitycat.com
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH 05/15] [FB] viafb: make viafb a first-class citizen using pci_driver
2009-05-20 20:28 ` [PATCH 05/15] [FB] viafb: make viafb a first-class citizen using pci_driver Harald Welte
2009-05-20 20:28 ` [PATCH 06/15] viafb: pass reference to pci device when calling framebuffer_alloc() Harald Welte
@ 2009-05-23 6:53 ` Krzysztof Helt
1 sibling, 0 replies; 33+ messages in thread
From: Krzysztof Helt @ 2009-05-23 6:53 UTC (permalink / raw)
To: Harald Welte; +Cc: linux-fbdev-devel
On Thu, 21 May 2009 04:28:43 +0800
Harald Welte <HaraldWelte@viatech.com> wrote:
> From: Harald Welte <laforge@gnumonks.org>
>
> ---
Acked-by: Krzysztof Helt <krzysztof.h1@wp.pl>
> drivers/video/via/hw.c | 116 +++--------------------------------------
> drivers/video/via/hw.h | 7 +--
> drivers/video/via/viafbdev.c | 65 ++++++++++++++++++++---
> 3 files changed, 68 insertions(+), 120 deletions(-)
>
> diff --git a/drivers/video/via/hw.c b/drivers/video/via/hw.c
> index b111b6c..6306c88 100644
> --- a/drivers/video/via/hw.c
> +++ b/drivers/video/via/hw.c
> @@ -21,22 +21,6 @@
>
> #include "global.h"
>
> -static const struct pci_device_id_info pciidlist[] = {
> - {PCI_VIA_VENDOR_ID, UNICHROME_CLE266_DID, UNICHROME_CLE266},
> - {PCI_VIA_VENDOR_ID, UNICHROME_PM800_DID, UNICHROME_PM800},
> - {PCI_VIA_VENDOR_ID, UNICHROME_K400_DID, UNICHROME_K400},
> - {PCI_VIA_VENDOR_ID, UNICHROME_K800_DID, UNICHROME_K800},
> - {PCI_VIA_VENDOR_ID, UNICHROME_CN700_DID, UNICHROME_CN700},
> - {PCI_VIA_VENDOR_ID, UNICHROME_P4M890_DID, UNICHROME_P4M890},
> - {PCI_VIA_VENDOR_ID, UNICHROME_K8M890_DID, UNICHROME_K8M890},
> - {PCI_VIA_VENDOR_ID, UNICHROME_CX700_DID, UNICHROME_CX700},
> - {PCI_VIA_VENDOR_ID, UNICHROME_P4M900_DID, UNICHROME_P4M900},
> - {PCI_VIA_VENDOR_ID, UNICHROME_CN750_DID, UNICHROME_CN750},
> - {PCI_VIA_VENDOR_ID, UNICHROME_VX800_DID, UNICHROME_VX800},
> - {PCI_VIA_VENDOR_ID, UNICHROME_VX855_DID, UNICHROME_VX855},
> - {0, 0, 0}
> -};
> -
> struct offset offset_reg = {
> /* IGA1 Offset Register */
> {IGA1_OFFSET_REG_NUM, {{CR13, 0, 7}, {CR35, 5, 7} } },
> @@ -549,7 +533,8 @@ static void set_dvi_output_path(int set_iga, int output_interface);
> static void set_lcd_output_path(int set_iga, int output_interface);
> static int search_mode_setting(int ModeInfoIndex);
> static void load_fix_bit_crtc_reg(void);
> -static void init_gfx_chip_info(void);
> +static void init_gfx_chip_info(struct pci_dev *pdev,
> + const struct pci_device_id *pdi);
> static void init_tmds_chip_info(void);
> static void init_lvds_chip_info(void);
> static void device_screen_off(void);
> @@ -559,7 +544,6 @@ static void device_off(void);
> static void device_on(void);
> static void enable_second_display_channel(void);
> static void disable_second_display_channel(void);
> -static int get_fb_size_from_pci(void);
>
> void viafb_write_reg(u8 index, u16 io_port, u8 data)
> {
> @@ -1996,9 +1980,10 @@ void viafb_fill_crtc_timing(struct crt_mode_table *crt_table,
>
> }
>
> -void viafb_init_chip_info(void)
> +void viafb_init_chip_info(struct pci_dev *pdev,
> + const struct pci_device_id *pdi)
> {
> - init_gfx_chip_info();
> + init_gfx_chip_info(pdev, pdi);
> init_tmds_chip_info();
> init_lvds_chip_info();
>
> @@ -2071,24 +2056,12 @@ void viafb_update_device_setting(int hres, int vres,
> }
> }
>
> -static void init_gfx_chip_info(void)
> +static void init_gfx_chip_info(struct pci_dev *pdev,
> + const struct pci_device_id *pdi)
> {
> - struct pci_dev *pdev = NULL;
> - u32 i;
> u8 tmp;
>
> - /* Indentify GFX Chip Name */
> - for (i = 0; pciidlist[i].vendor != 0; i++) {
> - pdev = pci_get_device(pciidlist[i].vendor,
> - pciidlist[i].device, 0);
> - if (pdev)
> - break;
> - }
> -
> - if (!pciidlist[i].vendor)
> - return ;
> -
> - viaparinfo->chip_info->gfx_chip_name = pciidlist[i].chip_index;
> + viaparinfo->chip_info->gfx_chip_name = pdi->driver_data;
>
> /* Check revision of CLE266 Chip */
> if (viaparinfo->chip_info->gfx_chip_name == UNICHROME_CLE266) {
> @@ -2119,8 +2092,6 @@ static void init_gfx_chip_info(void)
> CX700_REVISION_700;
> }
> }
> -
> - pci_dev_put(pdev);
> }
>
> static void init_tmds_chip_info(void)
> @@ -2612,38 +2583,6 @@ void viafb_crt_enable(void)
> viafb_write_reg_mask(CR36, VIACR, 0x0, BIT5 + BIT4);
> }
>
> -void viafb_get_mmio_info(unsigned long *mmio_base,
> - unsigned long *mmio_len)
> -{
> - struct pci_dev *pdev = NULL;
> - u32 vendor, device;
> - u32 i;
> -
> - for (i = 0; pciidlist[i].vendor != 0; i++)
> - if (viaparinfo->chip_info->gfx_chip_name ==
> - pciidlist[i].chip_index)
> - break;
> -
> - if (!pciidlist[i].vendor)
> - return ;
> -
> - vendor = pciidlist[i].vendor;
> - device = pciidlist[i].device;
> -
> - pdev = pci_get_device(vendor, device, NULL);
> -
> - if (!pdev) {
> - *mmio_base = 0;
> - *mmio_len = 0;
> - return ;
> - }
> -
> - *mmio_base = pci_resource_start(pdev, 1);
> - *mmio_len = pci_resource_len(pdev, 1);
> -
> - pci_dev_put(pdev);
> -}
> -
> static void enable_second_display_channel(void)
> {
> /* to enable second display channel. */
> @@ -2660,44 +2599,7 @@ static void disable_second_display_channel(void)
> viafb_write_reg_mask(CR6A, VIACR, BIT6, BIT6);
> }
>
> -void viafb_get_fb_info(unsigned int *fb_base, unsigned int *fb_len)
> -{
> - struct pci_dev *pdev = NULL;
> - u32 vendor, device;
> - u32 i;
> -
> - for (i = 0; pciidlist[i].vendor != 0; i++)
> - if (viaparinfo->chip_info->gfx_chip_name ==
> - pciidlist[i].chip_index)
> - break;
> -
> - if (!pciidlist[i].vendor)
> - return ;
> -
> - vendor = pciidlist[i].vendor;
> - device = pciidlist[i].device;
> -
> - pdev = pci_get_device(vendor, device, NULL);
> -
> - if (!pdev) {
> - *fb_base = viafb_read_reg(VIASR, SR30) << 24;
> - *fb_len = viafb_get_memsize();
> - DEBUG_MSG(KERN_INFO "Get FB info from SR30!\n");
> - DEBUG_MSG(KERN_INFO "fb_base = %08x\n", *fb_base);
> - DEBUG_MSG(KERN_INFO "fb_len = %08x\n", *fb_len);
> - return ;
> - }
> -
> - *fb_base = (unsigned int)pci_resource_start(pdev, 0);
> - *fb_len = get_fb_size_from_pci();
> - DEBUG_MSG(KERN_INFO "Get FB info from PCI system!\n");
> - DEBUG_MSG(KERN_INFO "fb_base = %08x\n", *fb_base);
> - DEBUG_MSG(KERN_INFO "fb_len = %08x\n", *fb_len);
> -
> - pci_dev_put(pdev);
> -}
> -
> -static int get_fb_size_from_pci(void)
> +int viafb_get_fb_size_from_pci(void)
> {
> unsigned long configid, deviceid, FBSize = 0;
> int VideoMemSize;
> diff --git a/drivers/video/via/hw.h b/drivers/video/via/hw.h
> index 22786a5..1cd0648 100644
> --- a/drivers/video/via/hw.h
> +++ b/drivers/video/via/hw.h
> @@ -931,17 +931,16 @@ void viafb_set_dpa_gfx(int output_interface, struct GFX_DPA_SETTING\
> int viafb_setmode(int vmode_index, int hor_res, int ver_res,
> int video_bpp, int vmode_index1, int hor_res1,
> int ver_res1, int video_bpp1);
> -void viafb_init_chip_info(void);
> +void viafb_init_chip_info(struct pci_dev *pdev,
> + const struct pci_device_id *pdi);
> void viafb_init_dac(int set_iga);
> int viafb_get_pixclock(int hres, int vres, int vmode_refresh);
> int viafb_get_refresh(int hres, int vres, u32 float_refresh);
> void viafb_update_device_setting(int hres, int vres, int bpp,
> int vmode_refresh, int flag);
> -void viafb_get_mmio_info(unsigned long *mmio_base,
> - unsigned long *mmio_len);
>
> +int viafb_get_fb_size_from_pci(void);
> void viafb_set_iga_path(void);
> void viafb_set_start_addr(void);
> -void viafb_get_fb_info(unsigned int *fb_base, unsigned int *fb_len);
>
> #endif /* __HW_H__ */
> diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c
> index 72387d4..3040dd9 100644
> --- a/drivers/video/via/viafbdev.c
> +++ b/drivers/video/via/viafbdev.c
> @@ -2104,7 +2104,8 @@ static void viafb_remove_proc(struct proc_dir_entry *viafb_entry)
> remove_proc_entry("viafb", NULL);
> }
>
> -static int __devinit via_pci_probe(void)
> +static int __devinit via_pci_probe(struct pci_dev *pdev,
> + const struct pci_device_id *ent)
> {
> unsigned long default_xres, default_yres;
> char *tmpc, *tmpm;
> @@ -2161,8 +2162,9 @@ static int __devinit via_pci_probe(void)
> if (rc)
> goto out_fb_release;
>
> - viafb_init_chip_info();
> - viafb_get_fb_info(&viaparinfo->fbmem, &viaparinfo->memsize);
> + viafb_init_chip_info(pdev, ent);
> + viaparinfo->fbmem = pci_resource_start(pdev, 0);
> + viaparinfo->memsize = viafb_get_fb_size_from_pci();
> viaparinfo->fbmem_free = viaparinfo->memsize;
> viaparinfo->fbmem_used = 0;
> viaparinfo->fbmem_virt = ioremap_nocache(viaparinfo->fbmem,
> @@ -2170,14 +2172,20 @@ static int __devinit via_pci_probe(void)
> viafbinfo->screen_base = (char *)viaparinfo->fbmem_virt;
>
> if (!viaparinfo->fbmem_virt) {
> - printk(KERN_INFO "ioremap failed\n");
> + printk(KERN_ERR "ioremap of fbmem failed\n");
> rc = -EIO;
> goto out_delete_i2c;
> }
>
> - viafb_get_mmio_info(&viaparinfo->mmio_base, &viaparinfo->mmio_len);
> + viaparinfo->mmio_base = pci_resource_start(pdev, 1);
> + viaparinfo->mmio_len = pci_resource_len(pdev, 1);
> viaparinfo->io_virt = ioremap_nocache(viaparinfo->mmio_base,
> viaparinfo->mmio_len);
> + if (!viaparinfo->io_virt) {
> + printk(KERN_ERR "ioremap of MMIO failed\n");
> + rc = -EIO;
> + goto out_unmap_fbmem;
> + }
>
> viafbinfo->node = 0;
> viafbinfo->fbops = &viafb_ops;
> @@ -2284,7 +2292,8 @@ static int __devinit via_pci_probe(void)
> if (!viafbinfo1) {
> printk(KERN_ERR
> "allocate the second framebuffer struct error\n");
> - goto out_delete_i2c;
> + rc = -ENOMEM;
> + goto out_unmap_mmio;
> }
> viaparinfo1 = viafbinfo1->par;
> memcpy(viaparinfo1, viaparinfo, viafb_par_length);
> @@ -2385,6 +2394,10 @@ out_dealloc_cmap:
> out_fb1_release:
> if (viafbinfo1)
> framebuffer_release(viafbinfo1);
> +out_unmap_mmio:
> + iounmap(viaparinfo->io_virt);
> +out_unmap_fbmem:
> + iounmap((void *)viaparinfo->fbmem_virt);
> out_delete_i2c:
> viafb_delete_i2c_buss(viaparinfo);
> out_fb_release:
> @@ -2392,7 +2405,7 @@ out_fb_release:
> return rc;
> }
>
> -static void __devexit via_pci_remove(void)
> +static void __devexit via_pci_remove(struct pci_dev *pdev)
> {
> DEBUG_MSG(KERN_INFO "via_pci_remove!\n");
> fb_dealloc_cmap(&viafbinfo->cmap);
> @@ -2486,6 +2499,40 @@ static int __init viafb_setup(char *options)
> }
> #endif
>
> +static struct pci_device_id viafb_pci_table[] __devinitdata = {
> + { PCI_DEVICE(PCI_VENDOR_ID_VIA, UNICHROME_CLE266_DID),
> + .driver_data = UNICHROME_CLE266 },
> + { PCI_DEVICE(PCI_VENDOR_ID_VIA, UNICHROME_PM800_DID),
> + .driver_data = UNICHROME_PM800 },
> + { PCI_DEVICE(PCI_VENDOR_ID_VIA, UNICHROME_K400_DID),
> + .driver_data = UNICHROME_K400 },
> + { PCI_DEVICE(PCI_VENDOR_ID_VIA, UNICHROME_K800_DID),
> + .driver_data = UNICHROME_K800 },
> + { PCI_DEVICE(PCI_VENDOR_ID_VIA, UNICHROME_P4M890_DID),
> + .driver_data = UNICHROME_CN700 },
> + { PCI_DEVICE(PCI_VENDOR_ID_VIA, UNICHROME_K8M890_DID),
> + .driver_data = UNICHROME_K8M890 },
> + { PCI_DEVICE(PCI_VENDOR_ID_VIA, UNICHROME_CX700_DID),
> + .driver_data = UNICHROME_CX700 },
> + { PCI_DEVICE(PCI_VENDOR_ID_VIA, UNICHROME_P4M900_DID),
> + .driver_data = UNICHROME_P4M900 },
> + { PCI_DEVICE(PCI_VENDOR_ID_VIA, UNICHROME_CN750_DID),
> + .driver_data = UNICHROME_CN750 },
> + { PCI_DEVICE(PCI_VENDOR_ID_VIA, UNICHROME_VX800_DID),
> + .driver_data = UNICHROME_VX800 },
> + { PCI_DEVICE(PCI_VENDOR_ID_VIA, UNICHROME_VX855_DID),
> + .driver_data = UNICHROME_VX855 },
> + { }
> +};
> +MODULE_DEVICE_TABLE(pci, viafb_pci_table);
> +
> +static struct pci_driver viafb_driver = {
> + .name = "viafb",
> + .id_table = viafb_pci_table,
> + .probe = via_pci_probe,
> + .remove = __devexit_p(via_pci_remove),
> +};
> +
> static int __init viafb_init(void)
> {
> #ifndef MODULE
> @@ -2497,13 +2544,13 @@ static int __init viafb_init(void)
> printk(KERN_INFO
> "VIA Graphics Intergration Chipset framebuffer %d.%d initializing\n",
> VERSION_MAJOR, VERSION_MINOR);
> - return via_pci_probe();
> + return pci_register_driver(&viafb_driver);
> }
>
> static void __exit viafb_exit(void)
> {
> DEBUG_MSG(KERN_INFO "viafb_exit!\n");
> - via_pci_remove();
> + pci_unregister_driver(&viafb_driver);
> }
>
> static struct fb_ops viafb_ops = {
> --
> 1.6.2.4
>
>
> ------------------------------------------------------------------------------
> Crystal Reports - New Free Runtime and 30 Day Trial
> Check out the new simplified licensing option that enables
> unlimited royalty-free distribution of the report engine
> for externally facing server and web deployment.
> http://p.sf.net/sfu/businessobjects
> _______________________________________________
> Linux-fbdev-devel mailing list
> Linux-fbdev-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-fbdev-devel
>
----------------------------------------------------------------------
Sprawdz pogode na dzis!
Kliknij >>> http://link.interia.pl/f217d
------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, &
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://www.creativitycat.com
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH 04/15] [FB] viafb: Fix various resource leaks during module_init()
2009-05-20 20:28 ` [PATCH 04/15] [FB] viafb: Fix various resource leaks during module_init() Harald Welte
2009-05-20 20:28 ` [PATCH 05/15] [FB] viafb: make viafb a first-class citizen using pci_driver Harald Welte
@ 2009-05-23 6:53 ` Krzysztof Helt
1 sibling, 0 replies; 33+ messages in thread
From: Krzysztof Helt @ 2009-05-23 6:53 UTC (permalink / raw)
To: Harald Welte; +Cc: linux-fbdev-devel
On Thu, 21 May 2009 04:28:42 +0800
Harald Welte <HaraldWelte@viatech.com> wrote:
> From: Harald Welte <laforge@gnumonks.org>
>
> The current code executed from module_init() in viafb does not have
> proper error checking and [partial] resoure release paths in case
> an error happens half way through driver initialization.
>
> This patch adresses the most obvious of those issues, such as a
> leftover i2c bus if module_init (and thus module load) fails.
>
> Signed-off-by: Harald Welte <HaraldWelte@viatech.com>
> ---
Acked-by: Krzysztof Helt <krzysztof.h1@wp.pl>
> drivers/video/via/viafbdev.c | 52 ++++++++++++++++++++++++++++++-----------
> 1 files changed, 38 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c
> index 02e7a72..72387d4 100644
> --- a/drivers/video/via/viafbdev.c
> +++ b/drivers/video/via/viafbdev.c
> @@ -1,5 +1,5 @@
> /*
> - * Copyright 1998-2008 VIA Technologies, Inc. All Rights Reserved.
> + * Copyright 1998-2009 VIA Technologies, Inc. All Rights Reserved.
> * Copyright 2001-2008 S3 Graphics, Inc. All Rights Reserved.
>
> * This program is free software; you can redistribute it and/or
> @@ -2109,7 +2109,7 @@ static int __devinit via_pci_probe(void)
> unsigned long default_xres, default_yres;
> char *tmpc, *tmpm;
> char *tmpc_sec, *tmpm_sec;
> - int vmode_index;
> + int rc, vmode_index;
> u32 tmds_length, lvds_length, crt_length, chip_length, viafb_par_length;
>
> DEBUG_MSG(KERN_INFO "VIAFB PCI Probe!!\n");
> @@ -2130,7 +2130,7 @@ static int __devinit via_pci_probe(void)
> tmds_length + crt_length + chip_length, NULL);
> if (!viafbinfo) {
> printk(KERN_ERR"Could not allocate memory for viafb_info.\n");
> - return -ENODEV;
> + return -ENOMEM;
> }
>
> viaparinfo = (struct viafb_par *)viafbinfo->par;
> @@ -2157,7 +2157,9 @@ static int __devinit via_pci_probe(void)
> viafb_dual_fb = 0;
>
> /* Set up I2C bus stuff */
> - viafb_create_i2c_bus(viaparinfo);
> + rc = viafb_create_i2c_bus(viaparinfo);
> + if (rc)
> + goto out_fb_release;
>
> viafb_init_chip_info();
> viafb_get_fb_info(&viaparinfo->fbmem, &viaparinfo->memsize);
> @@ -2169,7 +2171,8 @@ static int __devinit via_pci_probe(void)
>
> if (!viaparinfo->fbmem_virt) {
> printk(KERN_INFO "ioremap failed\n");
> - return -1;
> + rc = -EIO;
> + goto out_delete_i2c;
> }
>
> viafb_get_mmio_info(&viaparinfo->mmio_base, &viaparinfo->mmio_len);
> @@ -2281,8 +2284,7 @@ static int __devinit via_pci_probe(void)
> if (!viafbinfo1) {
> printk(KERN_ERR
> "allocate the second framebuffer struct error\n");
> - framebuffer_release(viafbinfo);
> - return -ENOMEM;
> + goto out_delete_i2c;
> }
> viaparinfo1 = viafbinfo1->par;
> memcpy(viaparinfo1, viaparinfo, viafb_par_length);
> @@ -2343,21 +2345,26 @@ static int __devinit via_pci_probe(void)
> viafb_update_viafb_par(viafbinfo);
> viafb_update_fix(&viafbinfo->fix, viafbinfo);
> default_var.activate = FB_ACTIVATE_NOW;
> - fb_alloc_cmap(&viafbinfo->cmap, 256, 0);
> + rc = fb_alloc_cmap(&viafbinfo->cmap, 256, 0);
> + if (rc)
> + goto out_fb1_release;
>
> if (viafb_dual_fb && (viafb_primary_dev == LCD_Device)
> && (viaparinfo->chip_info->gfx_chip_name == UNICHROME_CLE266)) {
> - if (register_framebuffer(viafbinfo1) < 0)
> - return -EINVAL;
> + rc = register_framebuffer(viafbinfo1);
> + if (rc)
> + goto out_dealloc_cmap;
> }
> - if (register_framebuffer(viafbinfo) < 0)
> - return -EINVAL;
> + rc = register_framebuffer(viafbinfo);
> + if (rc)
> + goto out_fb1_unreg_lcd_cle266;
>
> if (viafb_dual_fb && ((viafb_primary_dev != LCD_Device)
> || (viaparinfo->chip_info->gfx_chip_name !=
> UNICHROME_CLE266))) {
> - if (register_framebuffer(viafbinfo1) < 0)
> - return -EINVAL;
> + rc = register_framebuffer(viafbinfo1);
> + if (rc)
> + goto out_fb_unreg;
> }
> DEBUG_MSG(KERN_INFO "fb%d: %s frame buffer device %dx%d-%dbpp\n",
> viafbinfo->node, viafbinfo->fix.id, default_var.xres,
> @@ -2366,6 +2373,23 @@ static int __devinit via_pci_probe(void)
> viafb_init_proc(&viaparinfo->proc_entry);
> viafb_init_dac(IGA2);
> return 0;
> +
> +out_fb_unreg:
> + unregister_framebuffer(viafbinfo);
> +out_fb1_unreg_lcd_cle266:
> + if (viafb_dual_fb && (viafb_primary_dev == LCD_Device)
> + && (viaparinfo->chip_info->gfx_chip_name == UNICHROME_CLE266))
> + unregister_framebuffer(viafbinfo1);
> +out_dealloc_cmap:
> + fb_dealloc_cmap(&viafbinfo->cmap);
> +out_fb1_release:
> + if (viafbinfo1)
> + framebuffer_release(viafbinfo1);
> +out_delete_i2c:
> + viafb_delete_i2c_buss(viaparinfo);
> +out_fb_release:
> + framebuffer_release(viafbinfo);
> + return rc;
> }
>
> static void __devexit via_pci_remove(void)
> --
> 1.6.2.4
>
>
> ------------------------------------------------------------------------------
> Crystal Reports - New Free Runtime and 30 Day Trial
> Check out the new simplified licensing option that enables
> unlimited royalty-free distribution of the report engine
> for externally facing server and web deployment.
> http://p.sf.net/sfu/businessobjects
> _______________________________________________
> Linux-fbdev-devel mailing list
> Linux-fbdev-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-fbdev-devel
>
----------------------------------------------------------------------
Chcesz miec nawigacje GPS ?
Zamow lub przedluz umowe na neostrade, a nawigacja bedzie Twoja.
Kliknij na link po szczegoly! http://link.interia.pl/f219a
------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, &
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://www.creativitycat.com
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH 03/15] [FB] viafb: Add support for the VX855 chipset
2009-05-20 20:28 ` [PATCH 03/15] [FB] viafb: Add support for the VX855 chipset Harald Welte
2009-05-20 20:28 ` [PATCH 04/15] [FB] viafb: Fix various resource leaks during module_init() Harald Welte
@ 2009-05-23 6:54 ` Krzysztof Helt
1 sibling, 0 replies; 33+ messages in thread
From: Krzysztof Helt @ 2009-05-23 6:54 UTC (permalink / raw)
To: Harald Welte; +Cc: linux-fbdev-devel
On Thu, 21 May 2009 04:28:41 +0800
Harald Welte <HaraldWelte@viatech.com> wrote:
> From: Harald Welte <laforge@gnumonks.org>
>
> This patch adds support for a new VIA integrated graphics chipset, the VX855.
>
> Signed-off-by: HaraldWelte <HaraldWelte@viatech.com>
> ---
Acked-by: Krzysztof Helt <krzysztof.h1@wp.pl>
> drivers/video/via/chip.h | 3 +
> drivers/video/via/hw.c | 207 ++++++++++++++++++++++++++++--------------
> drivers/video/via/hw.h | 14 +++
> drivers/video/via/share.h | 98 ++++++++++++++++++++
> drivers/video/via/viafbdev.c | 7 +-
> drivers/video/via/viamode.c | 55 +++++++++++
> drivers/video/via/viamode.h | 2 +
> 7 files changed, 316 insertions(+), 70 deletions(-)
>
> diff --git a/drivers/video/via/chip.h b/drivers/video/via/chip.h
> index dde95ed..03e90cf 100644
> --- a/drivers/video/via/chip.h
> +++ b/drivers/video/via/chip.h
> @@ -68,6 +68,9 @@
> #define UNICHROME_VX800 11
> #define UNICHROME_VX800_DID 0x1122
>
> +#define UNICHROME_VX855 12
> +#define UNICHROME_VX855_DID 0x5122
> +
> /**************************************************/
> /* Definition TMDS Trasmitter Information */
> /**************************************************/
> diff --git a/drivers/video/via/hw.c b/drivers/video/via/hw.c
> index 59ddf09..b111b6c 100644
> --- a/drivers/video/via/hw.c
> +++ b/drivers/video/via/hw.c
> @@ -33,6 +33,7 @@ static const struct pci_device_id_info pciidlist[] = {
> {PCI_VIA_VENDOR_ID, UNICHROME_P4M900_DID, UNICHROME_P4M900},
> {PCI_VIA_VENDOR_ID, UNICHROME_CN750_DID, UNICHROME_CN750},
> {PCI_VIA_VENDOR_ID, UNICHROME_VX800_DID, UNICHROME_VX800},
> + {PCI_VIA_VENDOR_ID, UNICHROME_VX855_DID, UNICHROME_VX855},
> {0, 0, 0}
> };
>
> @@ -44,102 +45,142 @@ struct offset offset_reg = {
> };
>
> static struct pll_map pll_value[] = {
> - {CLK_25_175M, CLE266_PLL_25_175M, K800_PLL_25_175M, CX700_25_175M},
> - {CLK_29_581M, CLE266_PLL_29_581M, K800_PLL_29_581M, CX700_29_581M},
> - {CLK_26_880M, CLE266_PLL_26_880M, K800_PLL_26_880M, CX700_26_880M},
> - {CLK_31_490M, CLE266_PLL_31_490M, K800_PLL_31_490M, CX700_31_490M},
> - {CLK_31_500M, CLE266_PLL_31_500M, K800_PLL_31_500M, CX700_31_500M},
> - {CLK_31_728M, CLE266_PLL_31_728M, K800_PLL_31_728M, CX700_31_728M},
> - {CLK_32_668M, CLE266_PLL_32_668M, K800_PLL_32_668M, CX700_32_668M},
> - {CLK_36_000M, CLE266_PLL_36_000M, K800_PLL_36_000M, CX700_36_000M},
> - {CLK_40_000M, CLE266_PLL_40_000M, K800_PLL_40_000M, CX700_40_000M},
> - {CLK_41_291M, CLE266_PLL_41_291M, K800_PLL_41_291M, CX700_41_291M},
> - {CLK_43_163M, CLE266_PLL_43_163M, K800_PLL_43_163M, CX700_43_163M},
> - {CLK_45_250M, CLE266_PLL_45_250M, K800_PLL_45_250M, CX700_45_250M},
> - {CLK_46_000M, CLE266_PLL_46_000M, K800_PLL_46_000M, CX700_46_000M},
> - {CLK_46_996M, CLE266_PLL_46_996M, K800_PLL_46_996M, CX700_46_996M},
> - {CLK_48_000M, CLE266_PLL_48_000M, K800_PLL_48_000M, CX700_48_000M},
> - {CLK_48_875M, CLE266_PLL_48_875M, K800_PLL_48_875M, CX700_48_875M},
> - {CLK_49_500M, CLE266_PLL_49_500M, K800_PLL_49_500M, CX700_49_500M},
> - {CLK_52_406M, CLE266_PLL_52_406M, K800_PLL_52_406M, CX700_52_406M},
> - {CLK_52_977M, CLE266_PLL_52_977M, K800_PLL_52_977M, CX700_52_977M},
> - {CLK_56_250M, CLE266_PLL_56_250M, K800_PLL_56_250M, CX700_56_250M},
> - {CLK_60_466M, CLE266_PLL_60_466M, K800_PLL_60_466M, CX700_60_466M},
> - {CLK_61_500M, CLE266_PLL_61_500M, K800_PLL_61_500M, CX700_61_500M},
> - {CLK_65_000M, CLE266_PLL_65_000M, K800_PLL_65_000M, CX700_65_000M},
> - {CLK_65_178M, CLE266_PLL_65_178M, K800_PLL_65_178M, CX700_65_178M},
> - {CLK_66_750M, CLE266_PLL_66_750M, K800_PLL_66_750M, CX700_66_750M},
> - {CLK_68_179M, CLE266_PLL_68_179M, K800_PLL_68_179M, CX700_68_179M},
> - {CLK_69_924M, CLE266_PLL_69_924M, K800_PLL_69_924M, CX700_69_924M},
> - {CLK_70_159M, CLE266_PLL_70_159M, K800_PLL_70_159M, CX700_70_159M},
> - {CLK_72_000M, CLE266_PLL_72_000M, K800_PLL_72_000M, CX700_72_000M},
> - {CLK_78_750M, CLE266_PLL_78_750M, K800_PLL_78_750M, CX700_78_750M},
> - {CLK_80_136M, CLE266_PLL_80_136M, K800_PLL_80_136M, CX700_80_136M},
> - {CLK_83_375M, CLE266_PLL_83_375M, K800_PLL_83_375M, CX700_83_375M},
> - {CLK_83_950M, CLE266_PLL_83_950M, K800_PLL_83_950M, CX700_83_950M},
> - {CLK_84_750M, CLE266_PLL_84_750M, K800_PLL_84_750M, CX700_84_750M},
> - {CLK_85_860M, CLE266_PLL_85_860M, K800_PLL_85_860M, CX700_85_860M},
> - {CLK_88_750M, CLE266_PLL_88_750M, K800_PLL_88_750M, CX700_88_750M},
> - {CLK_94_500M, CLE266_PLL_94_500M, K800_PLL_94_500M, CX700_94_500M},
> - {CLK_97_750M, CLE266_PLL_97_750M, K800_PLL_97_750M, CX700_97_750M},
> + {CLK_25_175M, CLE266_PLL_25_175M, K800_PLL_25_175M,
> + CX700_25_175M, VX855_25_175M},
> + {CLK_29_581M, CLE266_PLL_29_581M, K800_PLL_29_581M,
> + CX700_29_581M, VX855_29_581M},
> + {CLK_26_880M, CLE266_PLL_26_880M, K800_PLL_26_880M,
> + CX700_26_880M, VX855_26_880M},
> + {CLK_31_490M, CLE266_PLL_31_490M, K800_PLL_31_490M,
> + CX700_31_490M, VX855_31_490M},
> + {CLK_31_500M, CLE266_PLL_31_500M, K800_PLL_31_500M,
> + CX700_31_500M, VX855_31_500M},
> + {CLK_31_728M, CLE266_PLL_31_728M, K800_PLL_31_728M,
> + CX700_31_728M, VX855_31_728M},
> + {CLK_32_668M, CLE266_PLL_32_668M, K800_PLL_32_668M,
> + CX700_32_668M, VX855_32_668M},
> + {CLK_36_000M, CLE266_PLL_36_000M, K800_PLL_36_000M,
> + CX700_36_000M, VX855_36_000M},
> + {CLK_40_000M, CLE266_PLL_40_000M, K800_PLL_40_000M,
> + CX700_40_000M, VX855_40_000M},
> + {CLK_41_291M, CLE266_PLL_41_291M, K800_PLL_41_291M,
> + CX700_41_291M, VX855_41_291M},
> + {CLK_43_163M, CLE266_PLL_43_163M, K800_PLL_43_163M,
> + CX700_43_163M, VX855_43_163M},
> + {CLK_45_250M, CLE266_PLL_45_250M, K800_PLL_45_250M,
> + CX700_45_250M, VX855_45_250M},
> + {CLK_46_000M, CLE266_PLL_46_000M, K800_PLL_46_000M,
> + CX700_46_000M, VX855_46_000M},
> + {CLK_46_996M, CLE266_PLL_46_996M, K800_PLL_46_996M,
> + CX700_46_996M, VX855_46_996M},
> + {CLK_48_000M, CLE266_PLL_48_000M, K800_PLL_48_000M,
> + CX700_48_000M, VX855_48_000M},
> + {CLK_48_875M, CLE266_PLL_48_875M, K800_PLL_48_875M,
> + CX700_48_875M, VX855_48_875M},
> + {CLK_49_500M, CLE266_PLL_49_500M, K800_PLL_49_500M,
> + CX700_49_500M, VX855_49_500M},
> + {CLK_52_406M, CLE266_PLL_52_406M, K800_PLL_52_406M,
> + CX700_52_406M, VX855_52_406M},
> + {CLK_52_977M, CLE266_PLL_52_977M, K800_PLL_52_977M,
> + CX700_52_977M, VX855_52_977M},
> + {CLK_56_250M, CLE266_PLL_56_250M, K800_PLL_56_250M,
> + CX700_56_250M, VX855_56_250M},
> + {CLK_60_466M, CLE266_PLL_60_466M, K800_PLL_60_466M,
> + CX700_60_466M, VX855_60_466M},
> + {CLK_61_500M, CLE266_PLL_61_500M, K800_PLL_61_500M,
> + CX700_61_500M, VX855_61_500M},
> + {CLK_65_000M, CLE266_PLL_65_000M, K800_PLL_65_000M,
> + CX700_65_000M, VX855_65_000M},
> + {CLK_65_178M, CLE266_PLL_65_178M, K800_PLL_65_178M,
> + CX700_65_178M, VX855_65_178M},
> + {CLK_66_750M, CLE266_PLL_66_750M, K800_PLL_66_750M,
> + CX700_66_750M, VX855_66_750M},
> + {CLK_68_179M, CLE266_PLL_68_179M, K800_PLL_68_179M,
> + CX700_68_179M, VX855_68_179M},
> + {CLK_69_924M, CLE266_PLL_69_924M, K800_PLL_69_924M,
> + CX700_69_924M, VX855_69_924M},
> + {CLK_70_159M, CLE266_PLL_70_159M, K800_PLL_70_159M,
> + CX700_70_159M, VX855_70_159M},
> + {CLK_72_000M, CLE266_PLL_72_000M, K800_PLL_72_000M,
> + CX700_72_000M, VX855_72_000M},
> + {CLK_78_750M, CLE266_PLL_78_750M, K800_PLL_78_750M,
> + CX700_78_750M, VX855_78_750M},
> + {CLK_80_136M, CLE266_PLL_80_136M, K800_PLL_80_136M,
> + CX700_80_136M, VX855_80_136M},
> + {CLK_83_375M, CLE266_PLL_83_375M, K800_PLL_83_375M,
> + CX700_83_375M, VX855_83_375M},
> + {CLK_83_950M, CLE266_PLL_83_950M, K800_PLL_83_950M,
> + CX700_83_950M, VX855_83_950M},
> + {CLK_84_750M, CLE266_PLL_84_750M, K800_PLL_84_750M,
> + CX700_84_750M, VX855_84_750M},
> + {CLK_85_860M, CLE266_PLL_85_860M, K800_PLL_85_860M,
> + CX700_85_860M, VX855_85_860M},
> + {CLK_88_750M, CLE266_PLL_88_750M, K800_PLL_88_750M,
> + CX700_88_750M, VX855_88_750M},
> + {CLK_94_500M, CLE266_PLL_94_500M, K800_PLL_94_500M,
> + CX700_94_500M, VX855_94_500M},
> + {CLK_97_750M, CLE266_PLL_97_750M, K800_PLL_97_750M,
> + CX700_97_750M, VX855_97_750M},
> {CLK_101_000M, CLE266_PLL_101_000M, K800_PLL_101_000M,
> - CX700_101_000M},
> + CX700_101_000M, VX855_101_000M},
> {CLK_106_500M, CLE266_PLL_106_500M, K800_PLL_106_500M,
> - CX700_106_500M},
> + CX700_106_500M, VX855_106_500M},
> {CLK_108_000M, CLE266_PLL_108_000M, K800_PLL_108_000M,
> - CX700_108_000M},
> + CX700_108_000M, VX855_108_000M},
> {CLK_113_309M, CLE266_PLL_113_309M, K800_PLL_113_309M,
> - CX700_113_309M},
> + CX700_113_309M, VX855_113_309M},
> {CLK_118_840M, CLE266_PLL_118_840M, K800_PLL_118_840M,
> - CX700_118_840M},
> + CX700_118_840M, VX855_118_840M},
> {CLK_119_000M, CLE266_PLL_119_000M, K800_PLL_119_000M,
> - CX700_119_000M},
> + CX700_119_000M, VX855_119_000M},
> {CLK_121_750M, CLE266_PLL_121_750M, K800_PLL_121_750M,
> - CX700_121_750M},
> + CX700_121_750M, 0},
> {CLK_125_104M, CLE266_PLL_125_104M, K800_PLL_125_104M,
> - CX700_125_104M},
> + CX700_125_104M, 0},
> {CLK_133_308M, CLE266_PLL_133_308M, K800_PLL_133_308M,
> - CX700_133_308M},
> + CX700_133_308M, 0},
> {CLK_135_000M, CLE266_PLL_135_000M, K800_PLL_135_000M,
> - CX700_135_000M},
> + CX700_135_000M, VX855_135_000M},
> {CLK_136_700M, CLE266_PLL_136_700M, K800_PLL_136_700M,
> - CX700_136_700M},
> + CX700_136_700M, VX855_136_700M},
> {CLK_138_400M, CLE266_PLL_138_400M, K800_PLL_138_400M,
> - CX700_138_400M},
> + CX700_138_400M, VX855_138_400M},
> {CLK_146_760M, CLE266_PLL_146_760M, K800_PLL_146_760M,
> - CX700_146_760M},
> + CX700_146_760M, VX855_146_760M},
> {CLK_153_920M, CLE266_PLL_153_920M, K800_PLL_153_920M,
> - CX700_153_920M},
> + CX700_153_920M, VX855_153_920M},
> {CLK_156_000M, CLE266_PLL_156_000M, K800_PLL_156_000M,
> - CX700_156_000M},
> + CX700_156_000M, VX855_156_000M},
> {CLK_157_500M, CLE266_PLL_157_500M, K800_PLL_157_500M,
> - CX700_157_500M},
> + CX700_157_500M, VX855_157_500M},
> {CLK_162_000M, CLE266_PLL_162_000M, K800_PLL_162_000M,
> - CX700_162_000M},
> + CX700_162_000M, VX855_162_000M},
> {CLK_187_000M, CLE266_PLL_187_000M, K800_PLL_187_000M,
> - CX700_187_000M},
> + CX700_187_000M, VX855_187_000M},
> {CLK_193_295M, CLE266_PLL_193_295M, K800_PLL_193_295M,
> - CX700_193_295M},
> + CX700_193_295M, VX855_193_295M},
> {CLK_202_500M, CLE266_PLL_202_500M, K800_PLL_202_500M,
> - CX700_202_500M},
> + CX700_202_500M, VX855_202_500M},
> {CLK_204_000M, CLE266_PLL_204_000M, K800_PLL_204_000M,
> - CX700_204_000M},
> + CX700_204_000M, VX855_204_000M},
> {CLK_218_500M, CLE266_PLL_218_500M, K800_PLL_218_500M,
> - CX700_218_500M},
> + CX700_218_500M, VX855_218_500M},
> {CLK_234_000M, CLE266_PLL_234_000M, K800_PLL_234_000M,
> - CX700_234_000M},
> + CX700_234_000M, VX855_234_000M},
> {CLK_267_250M, CLE266_PLL_267_250M, K800_PLL_267_250M,
> - CX700_267_250M},
> + CX700_267_250M, VX855_267_250M},
> {CLK_297_500M, CLE266_PLL_297_500M, K800_PLL_297_500M,
> - CX700_297_500M},
> - {CLK_74_481M, CLE266_PLL_74_481M, K800_PLL_74_481M, CX700_74_481M},
> + CX700_297_500M, VX855_297_500M},
> + {CLK_74_481M, CLE266_PLL_74_481M, K800_PLL_74_481M,
> + CX700_74_481M, VX855_74_481M},
> {CLK_172_798M, CLE266_PLL_172_798M, K800_PLL_172_798M,
> - CX700_172_798M},
> + CX700_172_798M, VX855_172_798M},
> {CLK_122_614M, CLE266_PLL_122_614M, K800_PLL_122_614M,
> - CX700_122_614M},
> - {CLK_74_270M, CLE266_PLL_74_270M, K800_PLL_74_270M, CX700_74_270M},
> + CX700_122_614M, VX855_122_614M},
> + {CLK_74_270M, CLE266_PLL_74_270M, K800_PLL_74_270M,
> + CX700_74_270M, 0},
> {CLK_148_500M, CLE266_PLL_148_500M, K800_PLL_148_500M,
> - CX700_148_500M}
> + CX700_148_500M, VX855_148_500M}
> };
>
> static struct fifo_depth_select display_fifo_depth_reg = {
> @@ -1277,6 +1318,15 @@ void viafb_load_FIFO_reg(int set_iga, int hor_active, int ver_active)
> VX800_IGA1_DISPLAY_QUEUE_EXPIRE_NUM;
> }
>
> + if (viaparinfo->chip_info->gfx_chip_name == UNICHROME_VX855) {
> + iga1_fifo_max_depth = VX855_IGA1_FIFO_MAX_DEPTH;
> + iga1_fifo_threshold = VX855_IGA1_FIFO_THRESHOLD;
> + iga1_fifo_high_threshold =
> + VX855_IGA1_FIFO_HIGH_THRESHOLD;
> + iga1_display_queue_expire_num =
> + VX855_IGA1_DISPLAY_QUEUE_EXPIRE_NUM;
> + }
> +
> /* Set Display FIFO Depath Select */
> reg_value = IGA1_FIFO_DEPTH_SELECT_FORMULA(iga1_fifo_max_depth);
> viafb_load_reg_num =
> @@ -1408,6 +1458,15 @@ void viafb_load_FIFO_reg(int set_iga, int hor_active, int ver_active)
> VX800_IGA2_DISPLAY_QUEUE_EXPIRE_NUM;
> }
>
> + if (viaparinfo->chip_info->gfx_chip_name == UNICHROME_VX855) {
> + iga2_fifo_max_depth = VX855_IGA2_FIFO_MAX_DEPTH;
> + iga2_fifo_threshold = VX855_IGA2_FIFO_THRESHOLD;
> + iga2_fifo_high_threshold =
> + VX855_IGA2_FIFO_HIGH_THRESHOLD;
> + iga2_display_queue_expire_num =
> + VX855_IGA2_DISPLAY_QUEUE_EXPIRE_NUM;
> + }
> +
> if (viaparinfo->chip_info->gfx_chip_name == UNICHROME_K800) {
> /* Set Display FIFO Depath Select */
> reg_value =
> @@ -1496,6 +1555,8 @@ u32 viafb_get_clk_value(int clk)
> case UNICHROME_P4M900:
> case UNICHROME_VX800:
> return pll_value[i].cx700_pll;
> + case UNICHROME_VX855:
> + return pll_value[i].vx855_pll;
> }
> }
> }
> @@ -1529,6 +1590,7 @@ void viafb_set_vclock(u32 CLK, int set_iga)
> case UNICHROME_P4M890:
> case UNICHROME_P4M900:
> case UNICHROME_VX800:
> + case UNICHROME_VX855:
> viafb_write_reg(SR44, VIASR, CLK / 0x10000);
> DEBUG_MSG(KERN_INFO "\nSR44=%x", CLK / 0x10000);
> viafb_write_reg(SR45, VIASR, (CLK & 0xFFFF) / 0x100);
> @@ -1557,6 +1619,7 @@ void viafb_set_vclock(u32 CLK, int set_iga)
> case UNICHROME_P4M890:
> case UNICHROME_P4M900:
> case UNICHROME_VX800:
> + case UNICHROME_VX855:
> viafb_write_reg(SR4A, VIASR, CLK / 0x10000);
> viafb_write_reg(SR4B, VIASR, (CLK & 0xFFFF) / 0x100);
> viafb_write_reg(SR4C, VIASR, CLK % 0x100);
> @@ -2276,7 +2339,10 @@ int viafb_setmode(int vmode_index, int hor_res, int ver_res, int video_bpp,
>
> case UNICHROME_VX800:
> viafb_write_regx(VX800_ModeXregs, NUM_TOTAL_VX800_ModeXregs);
> + break;
>
> + case UNICHROME_VX855:
> + viafb_write_regx(VX855_ModeXregs, NUM_TOTAL_VX855_ModeXregs);
> break;
> }
>
> @@ -2657,6 +2723,7 @@ static int get_fb_size_from_pci(void)
> case P4M890_FUNCTION3:
> case P4M900_FUNCTION3:
> case VX800_FUNCTION3:
> + case VX855_FUNCTION3:
> /*case CN750_FUNCTION3: */
> outl(configid + 0xA0, (unsigned long)0xCF8);
> FBSize = inl((unsigned long)0xCFC);
> @@ -2720,6 +2787,10 @@ static int get_fb_size_from_pci(void)
> VideoMemSize = (256 << 20); /*256M */
> break;
>
> + case 0x00007000: /* Only on VX855/875 */
> + VideoMemSize = (512 << 20); /*512M */
> + break;
> +
> default:
> VideoMemSize = (32 << 20); /*32M */
> break;
> diff --git a/drivers/video/via/hw.h b/drivers/video/via/hw.h
> index 6ff38fa..22786a5 100644
> --- a/drivers/video/via/hw.h
> +++ b/drivers/video/via/hw.h
> @@ -335,6 +335,17 @@ is reserved, so it may have problem to set 1600x1200 on IGA2. */
> /* location: {CR94,0,6} */
> #define VX800_IGA2_DISPLAY_QUEUE_EXPIRE_NUM 128
>
> +/* For VT3409 */
> +#define VX855_IGA1_FIFO_MAX_DEPTH 400
> +#define VX855_IGA1_FIFO_THRESHOLD 320
> +#define VX855_IGA1_FIFO_HIGH_THRESHOLD 320
> +#define VX855_IGA1_DISPLAY_QUEUE_EXPIRE_NUM 160
> +
> +#define VX855_IGA2_FIFO_MAX_DEPTH 200
> +#define VX855_IGA2_FIFO_THRESHOLD 160
> +#define VX855_IGA2_FIFO_HIGH_THRESHOLD 160
> +#define VX855_IGA2_DISPLAY_QUEUE_EXPIRE_NUM 320
> +
> #define IGA1_FIFO_DEPTH_SELECT_REG_NUM 1
> #define IGA1_FIFO_THRESHOLD_REG_NUM 2
> #define IGA1_FIFO_HIGH_THRESHOLD_REG_NUM 2
> @@ -716,6 +727,7 @@ struct pll_map {
> u32 cle266_pll;
> u32 k800_pll;
> u32 cx700_pll;
> + u32 vx855_pll;
> };
>
> struct rgbLUT {
> @@ -860,6 +872,8 @@ struct iga2_crtc_timing {
> #define P4M900_FUNCTION3 0x3364
> /* VT3353 chipset*/
> #define VX800_FUNCTION3 0x3353
> +/* VT3409 chipset*/
> +#define VX855_FUNCTION3 0x3409
>
> #define NUM_TOTAL_PLL_TABLE ARRAY_SIZE(pll_value)
>
> diff --git a/drivers/video/via/share.h b/drivers/video/via/share.h
> index 2e1254d..1eacd1c 100644
> --- a/drivers/video/via/share.h
> +++ b/drivers/video/via/share.h
> @@ -167,6 +167,10 @@
> #define SR4B 0x4B
> #define SR4C 0x4C
> #define SR52 0x52
> +#define SR57 0x57
> +#define SR58 0x58
> +#define SR59 0x59
> +#define SR5D 0x5D
> #define SR5E 0x5E
> #define SR65 0x65
>
> @@ -966,6 +970,100 @@
> #define CX700_297_500M 0x00CE0403
> #define CX700_122_614M 0x00870802
>
> +/* PLL for VX855 */
> +#define VX855_22_000M 0x007B1005
> +#define VX855_25_175M 0x008D1005
> +#define VX855_26_719M 0x00961005
> +#define VX855_26_880M 0x00961005
> +#define VX855_27_000M 0x00971005
> +#define VX855_29_581M 0x00A51005
> +#define VX855_29_829M 0x00641003
> +#define VX855_31_490M 0x00B01005
> +#define VX855_31_500M 0x00B01005
> +#define VX855_31_728M 0x008E1004
> +#define VX855_32_668M 0x00921004
> +#define VX855_36_000M 0x00A11004
> +#define VX855_40_000M 0x00700C05
> +#define VX855_41_291M 0x00730C05
> +#define VX855_43_163M 0x00790C05
> +#define VX855_45_250M 0x007F0C05 /* 45.46MHz */
> +#define VX855_46_000M 0x00670C04
> +#define VX855_46_996M 0x00690C04
> +#define VX855_48_000M 0x00860C05
> +#define VX855_48_875M 0x00890C05
> +#define VX855_49_500M 0x00530C03
> +#define VX855_52_406M 0x00580C03
> +#define VX855_52_977M 0x00940C05
> +#define VX855_56_250M 0x009D0C05
> +#define VX855_60_466M 0x00A90C05
> +#define VX855_61_500M 0x00AC0C05
> +#define VX855_65_000M 0x006D0C03
> +#define VX855_65_178M 0x00B60C05
> +#define VX855_66_750M 0x00700C03 /*67.116MHz */
> +#define VX855_67_295M 0x00BC0C05
> +#define VX855_68_179M 0x00BF0C05
> +#define VX855_68_369M 0x00BF0C05
> +#define VX855_69_924M 0x00C30C05
> +#define VX855_70_159M 0x00C30C05
> +#define VX855_72_000M 0x00A10C04
> +#define VX855_73_023M 0x00CC0C05
> +#define VX855_74_481M 0x00D10C05
> +#define VX855_78_750M 0x006E0805
> +#define VX855_79_466M 0x006F0805
> +#define VX855_80_136M 0x00700805
> +#define VX855_81_627M 0x00720805
> +#define VX855_83_375M 0x00750805
> +#define VX855_83_527M 0x00750805
> +#define VX855_83_950M 0x00750805
> +#define VX855_84_537M 0x00760805
> +#define VX855_84_750M 0x00760805 /* 84.537Mhz */
> +#define VX855_85_500M 0x00760805 /* 85.909080 MHz*/
> +#define VX855_85_860M 0x00760805
> +#define VX855_85_909M 0x00760805
> +#define VX855_88_750M 0x007C0805
> +#define VX855_89_489M 0x007D0805
> +#define VX855_94_500M 0x00840805
> +#define VX855_96_648M 0x00870805
> +#define VX855_97_750M 0x00890805
> +#define VX855_101_000M 0x008D0805
> +#define VX855_106_500M 0x00950805
> +#define VX855_108_000M 0x00970805
> +#define VX855_110_125M 0x00990805
> +#define VX855_112_000M 0x009D0805
> +#define VX855_113_309M 0x009F0805
> +#define VX855_115_000M 0x00A10805
> +#define VX855_118_840M 0x00A60805
> +#define VX855_119_000M 0x00A70805
> +#define VX855_121_750M 0x00AA0805 /* 121.704MHz */
> +#define VX855_122_614M 0x00AC0805
> +#define VX855_126_266M 0x00B10805
> +#define VX855_130_250M 0x00B60805 /* 130.250 */
> +#define VX855_135_000M 0x00BD0805
> +#define VX855_136_700M 0x00BF0805
> +#define VX855_137_750M 0x00C10805
> +#define VX855_138_400M 0x00C20805
> +#define VX855_144_300M 0x00CA0805
> +#define VX855_146_760M 0x00CE0805
> +#define VX855_148_500M 0x00D00805
> +#define VX855_153_920M 0x00540402
> +#define VX855_156_000M 0x006C0405
> +#define VX855_156_867M 0x006E0405
> +#define VX855_157_500M 0x006E0405
> +#define VX855_162_000M 0x00710405
> +#define VX855_172_798M 0x00790405
> +#define VX855_187_000M 0x00830405
> +#define VX855_193_295M 0x00870405
> +#define VX855_202_500M 0x008E0405
> +#define VX855_204_000M 0x008F0405
> +#define VX855_218_500M 0x00990405
> +#define VX855_229_500M 0x00A10405
> +#define VX855_234_000M 0x00A40405
> +#define VX855_267_250M 0x00BB0405
> +#define VX855_297_500M 0x00D00405
> +#define VX855_339_500M 0x00770005
> +#define VX855_340_772M 0x00770005
> +
> +
> /* Definition CRTC Timing Index */
> #define H_TOTAL_INDEX 0
> #define H_ADDR_INDEX 1
> diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c
> index a0fec29..02e7a72 100644
> --- a/drivers/video/via/viafbdev.c
> +++ b/drivers/video/via/viafbdev.c
> @@ -218,7 +218,8 @@ static int viafb_check_var(struct fb_var_screeninfo *var,
> if (!info->par)
> return -1;
> p_viafb_par = (struct viafb_par *)info->par;
> - if (p_viafb_par->chip_info->gfx_chip_name == UNICHROME_VX800)
> + if (p_viafb_par->chip_info->gfx_chip_name == UNICHROME_VX800 ||
> + p_viafb_par->chip_info->gfx_chip_name == UNICHROME_VX855)
> var->accel_flags = 0;
>
> return 0;
> @@ -1162,8 +1163,10 @@ static int viafb_cursor(struct fb_info *info, struct fb_cursor *cursor)
>
> if ((p_viafb_par->chip_info->gfx_chip_name ==
> UNICHROME_CX700) ||
> + (p_viafb_par->chip_info->gfx_chip_name ==
> + UNICHROME_VX800) ||
> ((p_viafb_par->chip_info->gfx_chip_name ==
> - UNICHROME_VX800))) {
> + UNICHROME_VX855))) {
> bg_col =
> (((info->cmap.red)[viacursor.image.bg_color] &
> 0xFFC0) << 14) |
> diff --git a/drivers/video/via/viamode.c b/drivers/video/via/viamode.c
> index 6dcf583..209c3af 100644
> --- a/drivers/video/via/viamode.c
> +++ b/drivers/video/via/viamode.c
> @@ -390,6 +390,61 @@ struct io_reg VX800_ModeXregs[] = { {VIASR, SR10, 0xFF, 0x01},
> {VIACR, CRD2, 0xFF, 0xFF} /* TMDS/LVDS control register. */
> };
>
> +struct io_reg VX855_ModeXregs[] = {
> +{VIASR, SR10, 0xFF, 0x01},
> +{VIASR, SR15, 0x02, 0x02},
> +{VIASR, SR16, 0xBF, 0x08},
> +{VIASR, SR17, 0xFF, 0x1F},
> +{VIASR, SR18, 0xFF, 0x4E},
> +{VIASR, SR1A, 0xFB, 0x08},
> +{VIASR, SR1B, 0xFF, 0xF0},
> +{VIASR, SR1E, 0x07, 0x01},
> +{VIASR, SR2A, 0xF0, 0x00},
> +{VIASR, SR58, 0xFF, 0x00},
> +{VIASR, SR59, 0xFF, 0x00},
> +{VIASR, SR2D, 0xFF, 0xFF}, /* VCK and LCK PLL power on. */
> +{VIACR, CR09, 0xFF, 0x00}, /* Initial CR09=0*/
> +{VIACR, CR11, 0x8F, 0x00}, /* IGA1 initial Vertical end */
> +{VIACR, CR17, 0x7F, 0x00}, /* IGA1 CRT Mode control init */
> +{VIACR, CR0A, 0xFF, 0x1E}, /* Cursor Start */
> +{VIACR, CR0B, 0xFF, 0x00}, /* Cursor End */
> +{VIACR, CR0E, 0xFF, 0x00}, /* Cursor Location High */
> +{VIACR, CR0F, 0xFF, 0x00}, /* Cursor Localtion Low */
> +{VIACR, CR32, 0xFF, 0x00},
> +{VIACR, CR33, 0x7F, 0x00},
> +{VIACR, CR34, 0xFF, 0x00},
> +{VIACR, CR35, 0xFF, 0x00},
> +{VIACR, CR36, 0x08, 0x00},
> +{VIACR, CR69, 0xFF, 0x00},
> +{VIACR, CR6A, 0xFD, 0x60},
> +{VIACR, CR6B, 0xFF, 0x00},
> +{VIACR, CR6C, 0xFF, 0x00},
> +{VIACR, CR7A, 0xFF, 0x01}, /* LCD Scaling Parameter 1 */
> +{VIACR, CR7B, 0xFF, 0x02}, /* LCD Scaling Parameter 2 */
> +{VIACR, CR7C, 0xFF, 0x03}, /* LCD Scaling Parameter 3 */
> +{VIACR, CR7D, 0xFF, 0x04}, /* LCD Scaling Parameter 4 */
> +{VIACR, CR7E, 0xFF, 0x07}, /* LCD Scaling Parameter 5 */
> +{VIACR, CR7F, 0xFF, 0x0A}, /* LCD Scaling Parameter 6 */
> +{VIACR, CR80, 0xFF, 0x0D}, /* LCD Scaling Parameter 7 */
> +{VIACR, CR81, 0xFF, 0x13}, /* LCD Scaling Parameter 8 */
> +{VIACR, CR82, 0xFF, 0x16}, /* LCD Scaling Parameter 9 */
> +{VIACR, CR83, 0xFF, 0x19}, /* LCD Scaling Parameter 10 */
> +{VIACR, CR84, 0xFF, 0x1C}, /* LCD Scaling Parameter 11 */
> +{VIACR, CR85, 0xFF, 0x1D}, /* LCD Scaling Parameter 12 */
> +{VIACR, CR86, 0xFF, 0x1E}, /* LCD Scaling Parameter 13 */
> +{VIACR, CR87, 0xFF, 0x1F}, /* LCD Scaling Parameter 14 */
> +{VIACR, CR88, 0xFF, 0x40}, /* LCD Panel Type */
> +{VIACR, CR89, 0xFF, 0x00}, /* LCD Timing Control 0 */
> +{VIACR, CR8A, 0xFF, 0x88}, /* LCD Timing Control 1 */
> +{VIACR, CRD4, 0xFF, 0x81}, /* Second power sequence control */
> +{VIACR, CR91, 0xFF, 0x80}, /* 24/12 bit LVDS Data off */
> +{VIACR, CR96, 0xFF, 0x00},
> +{VIACR, CR97, 0xFF, 0x00},
> +{VIACR, CR99, 0xFF, 0x00},
> +{VIACR, CR9B, 0xFF, 0x00},
> +{VIACR, CRD2, 0xFF, 0xFF} /* TMDS/LVDS control register. */
> +};
> +
> /* Video Mode Table */
> /* Common Setting for Video Mode */
> struct io_reg CLE266_ModeXregs[] = { {VIASR, SR1E, 0xF0, 0x00},
> diff --git a/drivers/video/via/viamode.h b/drivers/video/via/viamode.h
> index 1a5de50..3636694 100644
> --- a/drivers/video/via/viamode.h
> +++ b/drivers/video/via/viamode.h
> @@ -57,6 +57,7 @@ struct res_map_refresh {
> #define NUM_TOTAL_KM400_ModeXregs ARRAY_SIZE(KM400_ModeXregs)
> #define NUM_TOTAL_CX700_ModeXregs ARRAY_SIZE(CX700_ModeXregs)
> #define NUM_TOTAL_VX800_ModeXregs ARRAY_SIZE(VX800_ModeXregs)
> +#define NUM_TOTAL_VX855_ModeXregs ARRAY_SIZE(VX855_ModeXregs)
> #define NUM_TOTAL_CLE266_ModeXregs ARRAY_SIZE(CLE266_ModeXregs)
> #define NUM_TOTAL_PATCH_MODE ARRAY_SIZE(res_patch_table)
> #define NUM_TOTAL_MODETABLE ARRAY_SIZE(CLE266Modes)
> @@ -170,6 +171,7 @@ extern struct io_reg CN700_ModeXregs[66];
> extern struct io_reg KM400_ModeXregs[55];
> extern struct io_reg CX700_ModeXregs[58];
> extern struct io_reg VX800_ModeXregs[58];
> +extern struct io_reg VX855_ModeXregs[52];
> extern struct io_reg CLE266_ModeXregs[32];
> extern struct io_reg PM1024x768[2];
> extern struct patch_table res_patch_table[1];
> --
> 1.6.2.4
>
>
> ------------------------------------------------------------------------------
> Crystal Reports - New Free Runtime and 30 Day Trial
> Check out the new simplified licensing option that enables
> unlimited royalty-free distribution of the report engine
> for externally facing server and web deployment.
> http://p.sf.net/sfu/businessobjects
> _______________________________________________
> Linux-fbdev-devel mailing list
> Linux-fbdev-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-fbdev-devel
>
----------------------------------------------------------------------
Fantastyczne nagrody do zgarniecia!
Zagraj >> http://link.interia.pl/f2177
------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, &
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://www.creativitycat.com
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH 02/15] [FB] viafb: Add missing break statement in switch
2009-05-20 20:28 ` [PATCH 02/15] [FB] viafb: Add missing break statement in switch Harald Welte
2009-05-20 20:28 ` [PATCH 03/15] [FB] viafb: Add support for the VX855 chipset Harald Welte
@ 2009-05-23 6:54 ` Krzysztof Helt
1 sibling, 0 replies; 33+ messages in thread
From: Krzysztof Helt @ 2009-05-23 6:54 UTC (permalink / raw)
To: Harald Welte; +Cc: linux-fbdev-devel
On Thu, 21 May 2009 04:28:40 +0800
Harald Welte <HaraldWelte@viatech.com> wrote:
> From: Harald Welte <laforge@gnumonks.org>
>
> Signed-off-by: Harald Welte <HaraldWelte@viatech.com>
> ---
Acked-by: Krzysztof Helt <krzysztof.h1@wp.pl>
> drivers/video/via/hw.c | 1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/video/via/hw.c b/drivers/video/via/hw.c
> index fcd53ce..59ddf09 100644
> --- a/drivers/video/via/hw.c
> +++ b/drivers/video/via/hw.c
> @@ -2272,6 +2272,7 @@ int viafb_setmode(int vmode_index, int hor_res, int ver_res, int video_bpp,
>
> case UNICHROME_CX700:
> viafb_write_regx(CX700_ModeXregs, NUM_TOTAL_CX700_ModeXregs);
> + break;
>
> case UNICHROME_VX800:
> viafb_write_regx(VX800_ModeXregs, NUM_TOTAL_VX800_ModeXregs);
> --
> 1.6.2.4
>
>
> ------------------------------------------------------------------------------
> Crystal Reports - New Free Runtime and 30 Day Trial
> Check out the new simplified licensing option that enables
> unlimited royalty-free distribution of the report engine
> for externally facing server and web deployment.
> http://p.sf.net/sfu/businessobjects
> _______________________________________________
> Linux-fbdev-devel mailing list
> Linux-fbdev-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-fbdev-devel
>
----------------------------------------------------------------------
Zrob sobie prezent. Wygraj nagrode!
Sprawdz >> http://link.interia.pl/f2176
------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, &
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://www.creativitycat.com
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH 01/15] [FB] make viafb work on x86_64
2009-05-20 20:28 [PATCH 01/15] [FB] make viafb work on x86_64 Harald Welte
2009-05-20 20:28 ` [PATCH 02/15] [FB] viafb: Add missing break statement in switch Harald Welte
2009-05-21 16:57 ` [PATCH 01/15] [FB] make viafb work on x86_64 Krzysztof Helt
@ 2009-05-23 6:57 ` Krzysztof Helt
2009-05-23 9:06 ` Harald Welte
2 siblings, 1 reply; 33+ messages in thread
From: Krzysztof Helt @ 2009-05-23 6:57 UTC (permalink / raw)
To: Harald Welte; +Cc: linux-fbdev-devel
On Thu, 21 May 2009 04:28:39 +0800
Harald Welte <HaraldWelte@viatech.com> wrote:
> From: Harald Welte <laforge@gnumonks.org>
>
> This patch makes fixes a bug in viafb on x86_64 builds (e.g. for VIA Nano CPU).
> You cannot make the assumption that sizeof(unsigned int) == sizeof(unsigned
> long), so the parsing of the default mode (640x480) fails, leading to a
> division by zero during insmod of the driver.
>
> Signed-off-by: Harald Welte <HaraldWelte@viatech.com>
> ---
This patch seems already merged into Linus' tree.
I have acked most of your patches. Please add the Acked-by:
entry to patches which are already ready for submission.
If a patch has the Acked-by: and a comment it means that
a comment is not that important to stop the patch from being
merged (it is just nice to be fixed).
Please cc: your set of patches to Andrew Morton next time you post
them.
Kind regards,
Krzysztof
----------------------------------------------------------------------
Weekend w gorach za 100 PLN!
Sprawdz >>> http://link.interia.pl/f218c
------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, &
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://www.creativitycat.com
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH 01/15] [FB] make viafb work on x86_64
2009-05-23 6:57 ` Krzysztof Helt
@ 2009-05-23 9:06 ` Harald Welte
0 siblings, 0 replies; 33+ messages in thread
From: Harald Welte @ 2009-05-23 9:06 UTC (permalink / raw)
To: Krzysztof Helt; +Cc: linux-fbdev-devel
Hi Krzysztof,
On Sat, May 23, 2009 at 08:57:25AM +0200, Krzysztof Helt wrote:
> This patch seems already merged into Linus' tree.
yes, sorry for re-posting, I should have rebased on top of latest Linus tree :(
> I have acked most of your patches. Please add the Acked-by:
> entry to patches which are already ready for submission.
> If a patch has the Acked-by: and a comment it means that
> a comment is not that important to stop the patch from being
> merged (it is just nice to be fixed).
ok, thanks for the clarification.
> Please cc: your set of patches to Andrew Morton next time you post
> them.
will do so, probably later tonight.
--
- Harald Welte <HaraldWelte@viatech.com> http://linux.via.com.tw/
============================================================================
VIA Open Source Liaison
------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, &
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://www.creativitycat.com
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH 13/15] viafb: initialize 2D engine registers from loop
2009-05-23 6:27 ` [PATCH 13/15] viafb: initialize 2D engine registers from loop Krzysztof Helt
@ 2009-05-23 9:33 ` Harald Welte
0 siblings, 0 replies; 33+ messages in thread
From: Harald Welte @ 2009-05-23 9:33 UTC (permalink / raw)
To: Krzysztof Helt; +Cc: linux-fbdev-devel
On Sat, May 23, 2009 at 08:27:04AM +0200, Krzysztof Helt wrote:
> On Thu, 21 May 2009 04:28:51 +0800
> Harald Welte <HaraldWelte@viatech.com> wrote:
>
> > From: Harald Welte <laforge@gnumonks.org>
> >
> > We don't need to unroll the register initialization routine when
> > initializing the 2D engine registers
[...]
> > - writel(0x0, viaparinfo->io_virt + VIA_REG_PITCH);
> > - writel(0x0, viaparinfo->io_virt + VIA_REG_MONOPAT1);
> > + for (i = 0; i <= 0x40; i+= 4)
> > + writel(0x0, viaparinfo->io_virt + i);
> >
>
> Use your new viafb_2d_writel() here.
Sorry I have to disagree...
specifically here I do not want to use it. I actually know that all the
registers reside in a contiguous MMIO space, and I want to zero-initialize all
of them from beginning to the end. There is no need in permutating the
addresses in this case, since I don't care about the individual registers
purpose.
--
- Harald Welte <HaraldWelte@viatech.com> http://linux.via.com.tw/
============================================================================
VIA Open Source Liaison
------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, &
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://www.creativitycat.com
^ permalink raw reply [flat|nested] 33+ messages in thread
end of thread, other threads:[~2009-05-23 9:40 UTC | newest]
Thread overview: 33+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-20 20:28 [PATCH 01/15] [FB] make viafb work on x86_64 Harald Welte
2009-05-20 20:28 ` [PATCH 02/15] [FB] viafb: Add missing break statement in switch Harald Welte
2009-05-20 20:28 ` [PATCH 03/15] [FB] viafb: Add support for the VX855 chipset Harald Welte
2009-05-20 20:28 ` [PATCH 04/15] [FB] viafb: Fix various resource leaks during module_init() Harald Welte
2009-05-20 20:28 ` [PATCH 05/15] [FB] viafb: make viafb a first-class citizen using pci_driver Harald Welte
2009-05-20 20:28 ` [PATCH 06/15] viafb: pass reference to pci device when calling framebuffer_alloc() Harald Welte
2009-05-20 20:28 ` [PATCH 07/15] viafb: use proper pci config API Harald Welte
2009-05-20 20:28 ` [PATCH 08/15] viafb: get rid of some duplicated fields in private structure Harald Welte
2009-05-20 20:28 ` [PATCH 09/15] viafb: Remove MMIO from " Harald Welte
2009-05-20 20:28 ` [PATCH 10/15] viafb: make module parameters visible in sysfs Harald Welte
2009-05-20 20:28 ` [PATCH 11/15] viafb: clean up duplicated code from 2D acceleration Harald Welte
2009-05-20 20:28 ` [PATCH 12/15] viafb: introduce wrapper for 2D engine registers Harald Welte
2009-05-20 20:28 ` [PATCH 13/15] viafb: initialize 2D engine registers from loop Harald Welte
2009-05-20 20:28 ` [PATCH 14/15] viafb: Determine type of 2D engine and store it in chip_info Harald Welte
2009-05-20 20:28 ` [PATCH 15/15] viafb: Add support for 2D accelerated framebuffer on VX800/VX855 Harald Welte
2009-05-23 6:31 ` Krzysztof Helt
2009-05-23 6:29 ` [PATCH 14/15] viafb: Determine type of 2D engine and store it in chip_info Krzysztof Helt
2009-05-23 6:27 ` [PATCH 13/15] viafb: initialize 2D engine registers from loop Krzysztof Helt
2009-05-23 9:33 ` Harald Welte
2009-05-23 6:28 ` [PATCH 12/15] viafb: introduce wrapper for 2D engine registers Krzysztof Helt
2009-05-23 6:28 ` [PATCH 11/15] viafb: clean up duplicated code from 2D acceleration Krzysztof Helt
2009-05-23 6:32 ` [PATCH 10/15] viafb: make module parameters visible in sysfs Krzysztof Helt
2009-05-23 6:32 ` [PATCH 09/15] viafb: Remove MMIO from private structure Krzysztof Helt
2009-05-23 6:34 ` [PATCH 08/15] viafb: get rid of some duplicated fields in " Krzysztof Helt
2009-05-23 6:52 ` [PATCH 07/15] viafb: use proper pci config API Krzysztof Helt
2009-05-23 6:52 ` [PATCH 06/15] viafb: pass reference to pci device when calling framebuffer_alloc() Krzysztof Helt
2009-05-23 6:53 ` [PATCH 05/15] [FB] viafb: make viafb a first-class citizen using pci_driver Krzysztof Helt
2009-05-23 6:53 ` [PATCH 04/15] [FB] viafb: Fix various resource leaks during module_init() Krzysztof Helt
2009-05-23 6:54 ` [PATCH 03/15] [FB] viafb: Add support for the VX855 chipset Krzysztof Helt
2009-05-23 6:54 ` [PATCH 02/15] [FB] viafb: Add missing break statement in switch Krzysztof Helt
2009-05-21 16:57 ` [PATCH 01/15] [FB] make viafb work on x86_64 Krzysztof Helt
2009-05-23 6:57 ` Krzysztof Helt
2009-05-23 9:06 ` Harald Welte
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.