mirror of https://github.com/hak5/openwrt-owl.git
197 lines
5.8 KiB
Diff
197 lines
5.8 KiB
Diff
|
From 3817f491a41455d4a97f5d86217520816c2b6111 Mon Sep 17 00:00:00 2001
|
||
|
From: Harald Welte <laforge@openmoko.org>
|
||
|
Date: Wed, 8 Oct 2008 21:35:56 +0100
|
||
|
Subject: [PATCH] glamo_fb: Cosmetic cleanup
|
||
|
|
||
|
Remove dead code and coding style fixes. Purely cosmetic.
|
||
|
|
||
|
Signed-off-by: Harald Welte <laforge@openmoko.org>
|
||
|
---
|
||
|
drivers/mfd/glamo/glamo-fb.c | 78 +++++++++++------------------------------
|
||
|
1 files changed, 21 insertions(+), 57 deletions(-)
|
||
|
|
||
|
diff --git a/drivers/mfd/glamo/glamo-fb.c b/drivers/mfd/glamo/glamo-fb.c
|
||
|
index 7feef32..aa901dd 100644
|
||
|
--- a/drivers/mfd/glamo/glamo-fb.c
|
||
|
+++ b/drivers/mfd/glamo/glamo-fb.c
|
||
|
@@ -1,6 +1,6 @@
|
||
|
/* Smedia Glamo 336x/337x driver
|
||
|
*
|
||
|
- * (C) 2007 by Openmoko, Inc.
|
||
|
+ * (C) 2007-2008 by Openmoko, Inc.
|
||
|
* Author: Harald Welte <laforge@openmoko.org>
|
||
|
* All rights reserved.
|
||
|
*
|
||
|
@@ -237,11 +237,10 @@ enum orientation {
|
||
|
};
|
||
|
|
||
|
|
||
|
-static void rotate_lcd(struct glamofb_handle *glamo,
|
||
|
- __u32 rotation)
|
||
|
+/* the caller has to enxure lock_cmd is held and we are in cmd mode */
|
||
|
+static void __rotate_lcd(struct glamofb_handle *glamo, __u32 rotation)
|
||
|
{
|
||
|
int glamo_rot;
|
||
|
-/* unsigned long flags; */
|
||
|
|
||
|
switch (rotation) {
|
||
|
case FB_ROTATE_UR:
|
||
|
@@ -261,14 +260,6 @@ static void rotate_lcd(struct glamofb_handle *glamo,
|
||
|
break;
|
||
|
}
|
||
|
|
||
|
- /*
|
||
|
- * ha ha we are only called when we are in cmd mode already
|
||
|
- * printk(KERN_ERR"rotate_lcd spin_lock_irqsave\n");
|
||
|
- * spin_lock_irqsave(&glamo->lock_cmd, flags);
|
||
|
- *
|
||
|
- * if (glamofb_cmd_mode(glamo, 1))
|
||
|
- * goto out_unlock;
|
||
|
- */
|
||
|
reg_set_bit_mask(glamo,
|
||
|
GLAMO_REG_LCD_WIDTH,
|
||
|
GLAMO_LCD_ROT_MODE_MASK,
|
||
|
@@ -278,12 +269,6 @@ static void rotate_lcd(struct glamofb_handle *glamo,
|
||
|
GLAMO_LCD_MODE1_ROTATE_EN,
|
||
|
(glamo_rot != GLAMO_LCD_ROT_MODE_0)?
|
||
|
GLAMO_LCD_MODE1_ROTATE_EN : 0);
|
||
|
-/* glamofb_cmd_mode(glamo, 0);
|
||
|
-
|
||
|
-out_unlock:
|
||
|
- printk(KERN_ERR"rotate_lcd spin_unlock_irqrestore\n");
|
||
|
- spin_unlock_irqrestore(&glamo->lock_cmd, flags);
|
||
|
-*/
|
||
|
}
|
||
|
|
||
|
static enum orientation get_orientation(struct fb_var_screeninfo *var)
|
||
|
@@ -296,14 +281,17 @@ static enum orientation get_orientation(struct fb_var_screeninfo *var)
|
||
|
|
||
|
static int will_orientation_change(struct fb_var_screeninfo *var)
|
||
|
{
|
||
|
- enum orientation orient = get_orientation(var);
|
||
|
+ enum orientation orient = get_orientation(var);
|
||
|
+
|
||
|
switch (orient) {
|
||
|
case ORIENTATION_LANDSCAPE:
|
||
|
- if (var->rotate == FB_ROTATE_UR || var->rotate == FB_ROTATE_UD)
|
||
|
+ if (var->rotate == FB_ROTATE_UR ||
|
||
|
+ var->rotate == FB_ROTATE_UD)
|
||
|
return 1;
|
||
|
break;
|
||
|
case ORIENTATION_PORTRAIT:
|
||
|
- if (var->rotate == FB_ROTATE_CW || var->rotate == FB_ROTATE_CCW)
|
||
|
+ if (var->rotate == FB_ROTATE_CW ||
|
||
|
+ var->rotate == FB_ROTATE_CCW)
|
||
|
return 1;
|
||
|
break;
|
||
|
}
|
||
|
@@ -316,8 +304,6 @@ static void glamofb_update_lcd_controller(struct glamofb_handle *glamo,
|
||
|
int sync, bp, disp, fp, total, xres, yres, pitch, orientation_changing;
|
||
|
unsigned long flags;
|
||
|
|
||
|
-/* GLAMO_LOG("enter: glamo:%#x, var:%#x\n", (unsigned)glamo, (unsigned)var);
|
||
|
-*/
|
||
|
if (!glamo || !var)
|
||
|
return;
|
||
|
|
||
|
@@ -333,27 +319,18 @@ static void glamofb_update_lcd_controller(struct glamofb_handle *glamo,
|
||
|
|
||
|
xres = var->xres;
|
||
|
yres = var->yres;
|
||
|
-/* GLAMO_LOG("xres:%d, yres:%d, rotate:%d\n", xres, yres, var->rotate);
|
||
|
-*/
|
||
|
- /*
|
||
|
- * figure out if orientation is going to change
|
||
|
- */
|
||
|
+
|
||
|
+ /* figure out if orientation is going to change */
|
||
|
orientation_changing = will_orientation_change(var);
|
||
|
-/* GLAMO_LOG("orientation_changing:%d\n", orientation_changing);
|
||
|
-*/
|
||
|
- /*
|
||
|
- * adjust the pitch according to new orientation to come
|
||
|
- */
|
||
|
+
|
||
|
+ /* adjust the pitch according to new orientation to come */
|
||
|
if (orientation_changing) {
|
||
|
pitch = var->yres * var->bits_per_pixel / 8;
|
||
|
} else {
|
||
|
pitch = var->xres * var->bits_per_pixel / 8;
|
||
|
}
|
||
|
-/* GLAMO_LOG("pitch:%d\n", pitch);
|
||
|
-*/
|
||
|
- /*
|
||
|
- * set the awaiten LCD geometry
|
||
|
- */
|
||
|
+
|
||
|
+ /* set the awaiten LCD geometry */
|
||
|
reg_set_bit_mask(glamo,
|
||
|
GLAMO_REG_LCD_WIDTH,
|
||
|
GLAMO_LCD_WIDTH_MASK,
|
||
|
@@ -367,16 +344,10 @@ static void glamofb_update_lcd_controller(struct glamofb_handle *glamo,
|
||
|
GLAMO_LCD_PITCH_MASK,
|
||
|
pitch);
|
||
|
|
||
|
-/* GLAMO_LOG("mark:\n");*/
|
||
|
- /*
|
||
|
- * honour the rotation request
|
||
|
- */
|
||
|
- rotate_lcd(glamo, var->rotate);
|
||
|
+ /* honour the rotation request */
|
||
|
+ __rotate_lcd(glamo, var->rotate);
|
||
|
|
||
|
- /*
|
||
|
- * update the reported geometry
|
||
|
- * of the framebuffer.
|
||
|
- */
|
||
|
+ /* update the reported geometry of the framebuffer. */
|
||
|
if (orientation_changing) {
|
||
|
var->xres_virtual = var->xres = yres;
|
||
|
var->yres_virtual = var->yres = xres;
|
||
|
@@ -385,11 +356,7 @@ static void glamofb_update_lcd_controller(struct glamofb_handle *glamo,
|
||
|
var->yres_virtual = var->yres = yres;
|
||
|
}
|
||
|
|
||
|
-/* GLAMO_LOG("reported res:(%d,%d)\n", var->xres, var->yres);
|
||
|
-*/
|
||
|
- /*
|
||
|
- * update scannout timings
|
||
|
- */
|
||
|
+ /* update scannout timings */
|
||
|
sync = 0;
|
||
|
bp = sync + var->hsync_len;
|
||
|
disp = bp + var->left_margin;
|
||
|
@@ -407,8 +374,6 @@ static void glamofb_update_lcd_controller(struct glamofb_handle *glamo,
|
||
|
reg_set_bit_mask(glamo, GLAMO_REG_LCD_HORIZ_DISP_END,
|
||
|
GLAMO_LCD_HV_RETR_DISP_END_MASK, fp);
|
||
|
|
||
|
-/* GLAMO_LOG("mark:\n");
|
||
|
-*/
|
||
|
sync = 0;
|
||
|
bp = sync + var->vsync_len;
|
||
|
disp = bp + var->upper_margin;
|
||
|
@@ -426,10 +391,8 @@ static void glamofb_update_lcd_controller(struct glamofb_handle *glamo,
|
||
|
reg_set_bit_mask(glamo, GLAMO_REG_LCD_VERT_DISP_END,
|
||
|
GLAMO_LCD_HV_RETR_DISP_END_MASK, fp);
|
||
|
|
||
|
-/* GLAMO_LOG("mark:\n"); */
|
||
|
glamofb_cmd_mode(glamo, 0);
|
||
|
|
||
|
-/* GLAMO_LOG("leave:\n"); */
|
||
|
out_unlock:
|
||
|
spin_unlock_irqrestore(&glamo->lock_cmd, flags);
|
||
|
}
|
||
|
@@ -461,7 +424,8 @@ static int glamofb_blank(int blank_mode, struct fb_info *info)
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
-static inline unsigned int chan_to_field(unsigned int chan, struct fb_bitfield *bf)
|
||
|
+static inline unsigned int chan_to_field(unsigned int chan,
|
||
|
+ struct fb_bitfield *bf)
|
||
|
{
|
||
|
chan &= 0xffff;
|
||
|
chan >>= 16 - bf->length;
|
||
|
--
|
||
|
1.5.6.5
|
||
|
|