From: "Javier M. Mellid" <[email protected]>
This patchset erases dead code mainly.
Javier M. Mellid (4):
staging: sm7xxfb: dead code removal
staging: sm7xxfb: dead code removal
staging: sm7xxfb: delete unnecessary color map allocation
staging: sm7xxfb: code cleanup on smtcfb_setmode
drivers/staging/sm7xxfb/sm7xx.h | 1 -
drivers/staging/sm7xxfb/sm7xxfb.c | 100 +++++++++++++++----------------------
2 files changed, 40 insertions(+), 61 deletions(-)
--
1.7.10
From: "Javier M. Mellid" <[email protected]>
Code cleanup on smtcfb_setmode.
Tested with SM712.
Signed-off-by: Javier M. Mellid <[email protected]>
---
drivers/staging/sm7xxfb/sm7xxfb.c | 64 +++++++++++++++++--------------------
1 file changed, 29 insertions(+), 35 deletions(-)
diff --git a/drivers/staging/sm7xxfb/sm7xxfb.c b/drivers/staging/sm7xxfb/sm7xxfb.c
index 40e8e0d..08098c6 100644
--- a/drivers/staging/sm7xxfb/sm7xxfb.c
+++ b/drivers/staging/sm7xxfb/sm7xxfb.c
@@ -557,55 +557,49 @@ void smtcfb_setmode(struct smtcfb_info *sfb)
{
switch (sfb->fb.var.bits_per_pixel) {
case 32:
- sfb->fb.fix.visual = FB_VISUAL_TRUECOLOR;
- sfb->fb.fix.line_length = sfb->fb.var.xres * 4;
- sfb->fb.var.red.length = 8;
+ sfb->fb.fix.visual = FB_VISUAL_TRUECOLOR;
+ sfb->fb.fix.line_length = sfb->fb.var.xres * 4;
+ sfb->fb.var.red.length = 8;
sfb->fb.var.green.length = 8;
- sfb->fb.var.blue.length = 8;
- sfb->fb.var.red.offset = 16;
+ sfb->fb.var.blue.length = 8;
+ sfb->fb.var.red.offset = 16;
sfb->fb.var.green.offset = 8;
- sfb->fb.var.blue.offset = 0;
-
- break;
- case 8:
- sfb->fb.fix.visual = FB_VISUAL_PSEUDOCOLOR;
- sfb->fb.fix.line_length = sfb->fb.var.xres;
- sfb->fb.var.red.offset = 5;
- sfb->fb.var.red.length = 3;
- sfb->fb.var.green.offset = 2;
- sfb->fb.var.green.length = 3;
- sfb->fb.var.blue.offset = 0;
- sfb->fb.var.blue.length = 2;
+ sfb->fb.var.blue.offset = 0;
break;
case 24:
- sfb->fb.fix.visual = FB_VISUAL_TRUECOLOR;
- sfb->fb.fix.line_length = sfb->fb.var.xres * 3;
- sfb->fb.var.red.length = 8;
+ sfb->fb.fix.visual = FB_VISUAL_TRUECOLOR;
+ sfb->fb.fix.line_length = sfb->fb.var.xres * 3;
+ sfb->fb.var.red.length = 8;
sfb->fb.var.green.length = 8;
- sfb->fb.var.blue.length = 8;
-
- sfb->fb.var.red.offset = 16;
+ sfb->fb.var.blue.length = 8;
+ sfb->fb.var.red.offset = 16;
sfb->fb.var.green.offset = 8;
- sfb->fb.var.blue.offset = 0;
-
+ sfb->fb.var.blue.offset = 0;
+ break;
+ case 8:
+ sfb->fb.fix.visual = FB_VISUAL_PSEUDOCOLOR;
+ sfb->fb.fix.line_length = sfb->fb.var.xres;
+ sfb->fb.var.red.length = 3;
+ sfb->fb.var.green.length = 3;
+ sfb->fb.var.blue.length = 2;
+ sfb->fb.var.red.offset = 5;
+ sfb->fb.var.green.offset = 2;
+ sfb->fb.var.blue.offset = 0;
break;
case 16:
default:
- sfb->fb.fix.visual = FB_VISUAL_TRUECOLOR;
- sfb->fb.fix.line_length = sfb->fb.var.xres * 2;
-
- sfb->fb.var.red.length = 5;
+ sfb->fb.fix.visual = FB_VISUAL_TRUECOLOR;
+ sfb->fb.fix.line_length = sfb->fb.var.xres * 2;
+ sfb->fb.var.red.length = 5;
sfb->fb.var.green.length = 6;
- sfb->fb.var.blue.length = 5;
-
- sfb->fb.var.red.offset = 11;
+ sfb->fb.var.blue.length = 5;
+ sfb->fb.var.red.offset = 11;
sfb->fb.var.green.offset = 5;
- sfb->fb.var.blue.offset = 0;
-
+ sfb->fb.var.blue.offset = 0;
break;
}
- sfb->width = sfb->fb.var.xres;
+ sfb->width = sfb->fb.var.xres;
sfb->height = sfb->fb.var.yres;
sfb->hz = 60;
smtc_set_timing(sfb);
--
1.7.10
From: "Javier M. Mellid" <[email protected]>
This patchs erases fb_alloc_cmap call in smtc_free_fb_info. In the
future, when needed, the required function to call here should be
fb_dealloc_cmap.
Tested with SM712.
Signed-off-by: Javier M. Mellid <[email protected]>
---
drivers/staging/sm7xxfb/sm7xxfb.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/staging/sm7xxfb/sm7xxfb.c b/drivers/staging/sm7xxfb/sm7xxfb.c
index 4ab149b..40e8e0d 100644
--- a/drivers/staging/sm7xxfb/sm7xxfb.c
+++ b/drivers/staging/sm7xxfb/sm7xxfb.c
@@ -697,6 +697,14 @@ static struct smtcfb_info *smtc_alloc_fb_info(struct pci_dev *pdev, char *name)
}
/*
+ * free struct smtcfb_info
+ */
+static void smtc_free_fb_info(struct smtcfb_info *sfb)
+{
+ kfree(sfb);
+}
+
+/*
* Unmap in the memory mapped IO registers
*/
@@ -755,14 +763,6 @@ static inline void sm7xx_init_hw(void)
outb_p(0x11, 0x3c5);
}
-static void smtc_free_fb_info(struct smtcfb_info *sfb)
-{
- if (sfb) {
- fb_alloc_cmap(&sfb->fb.cmap, 0, 0);
- kfree(sfb);
- }
-}
-
/*
* sm712vga_setup - process command line options, get vga parameter
* @options: string of options
--
1.7.10
From: "Javier M. Mellid" <[email protected]>
This patch removes dead code related to BaseAddressInVRAM. It fixes
comment on RAM control bits too.
Tested with SM712.
Signed-off-by: Javier M. Mellid <[email protected]>
---
drivers/staging/sm7xxfb/sm7xxfb.c | 16 +++-------------
1 file changed, 3 insertions(+), 13 deletions(-)
diff --git a/drivers/staging/sm7xxfb/sm7xxfb.c b/drivers/staging/sm7xxfb/sm7xxfb.c
index a8c5652..4ab149b 100644
--- a/drivers/staging/sm7xxfb/sm7xxfb.c
+++ b/drivers/staging/sm7xxfb/sm7xxfb.c
@@ -53,7 +53,7 @@ struct smtcfb_info {
u_int width;
u_int height;
u_int hz;
- u_long BaseAddressInVRAM;
+
u8 chipRevID;
};
@@ -220,17 +220,9 @@ static void sm712_set_timing(struct smtcfb_info *sfb)
static void sm712_setpalette(int regno, unsigned red, unsigned green,
unsigned blue, struct fb_info *info)
{
- struct smtcfb_info *sfb = info->par;
+ /* set bit 5:4 = 01 (write LCD RAM only) */
+ smtc_seqw(0x66, (smtc_seqr(0x66) & 0xC3) | 0x10);
- if (sfb->BaseAddressInVRAM)
- /*
- * second display palette for dual head. Enable CRT RAM, 6-bit
- * RAM
- */
- smtc_seqw(0x66, (smtc_seqr(0x66) & 0xC3) | 0x20);
- else
- /* primary display palette. Enable LCD RAM only, 6-bit RAM */
- smtc_seqw(0x66, (smtc_seqr(0x66) & 0xC3) | 0x10);
smtc_mmiowb(regno, dac_reg);
smtc_mmiowb(red >> 10, dac_val);
smtc_mmiowb(green >> 10, dac_val);
@@ -932,8 +924,6 @@ static int __devinit smtcfb_pci_probe(struct pci_dev *pdev,
goto failed;
smtcfb_setmode(sfb);
- /* Primary display starting from 0 position */
- sfb->BaseAddressInVRAM = 0;
err = register_framebuffer(&sfb->fb);
if (err < 0)
--
1.7.10
From: "Javier M. Mellid" <[email protected]>
This patch removes dead code.
Tested with SM712.
Signed-off-by: Javier M. Mellid <[email protected]>
---
drivers/staging/sm7xxfb/sm7xx.h | 1 -
drivers/staging/sm7xxfb/sm7xxfb.c | 4 ----
2 files changed, 5 deletions(-)
diff --git a/drivers/staging/sm7xxfb/sm7xx.h b/drivers/staging/sm7xxfb/sm7xx.h
index 43d86f8..333f33c 100644
--- a/drivers/staging/sm7xxfb/sm7xx.h
+++ b/drivers/staging/sm7xxfb/sm7xx.h
@@ -14,7 +14,6 @@
*/
#define NR_PALETTE 256
-#define NR_RGB 2
#define FB_ACCEL_SMI_LYNX 88
diff --git a/drivers/staging/sm7xxfb/sm7xxfb.c b/drivers/staging/sm7xxfb/sm7xxfb.c
index 21dab34..a8c5652 100644
--- a/drivers/staging/sm7xxfb/sm7xxfb.c
+++ b/drivers/staging/sm7xxfb/sm7xxfb.c
@@ -42,10 +42,6 @@ struct screen_info smtc_screen_info;
struct smtcfb_info {
struct fb_info fb;
struct pci_dev *pdev;
- struct {
- u8 red, green, blue;
- } palette[NR_RGB];
- u_int palette_size;
u16 chipID;
unsigned char __iomem *m_pMMIO;
--
1.7.10