1 From 3817f491a41455d4a97f5d86217520816c2b6111 Mon Sep 17 00:00:00 2001
2 From: Harald Welte <laforge@openmoko.org>
3 Date: Wed, 8 Oct 2008 21:35:56 +0100
4 Subject: [PATCH] glamo_fb: Cosmetic cleanup
6 Remove dead code and coding style fixes. Purely cosmetic.
8 Signed-off-by: Harald Welte <laforge@openmoko.org>
10 drivers/mfd/glamo/glamo-fb.c | 78 +++++++++++------------------------------
11 1 files changed, 21 insertions(+), 57 deletions(-)
13 diff --git a/drivers/mfd/glamo/glamo-fb.c b/drivers/mfd/glamo/glamo-fb.c
14 index 7feef32..aa901dd 100644
15 --- a/drivers/mfd/glamo/glamo-fb.c
16 +++ b/drivers/mfd/glamo/glamo-fb.c
18 /* Smedia Glamo 336x/337x driver
20 - * (C) 2007 by Openmoko, Inc.
21 + * (C) 2007-2008 by Openmoko, Inc.
22 * Author: Harald Welte <laforge@openmoko.org>
23 * All rights reserved.
25 @@ -237,11 +237,10 @@ enum orientation {
29 -static void rotate_lcd(struct glamofb_handle *glamo,
31 +/* the caller has to enxure lock_cmd is held and we are in cmd mode */
32 +static void __rotate_lcd(struct glamofb_handle *glamo, __u32 rotation)
35 -/* unsigned long flags; */
39 @@ -261,14 +260,6 @@ static void rotate_lcd(struct glamofb_handle *glamo,
44 - * ha ha we are only called when we are in cmd mode already
45 - * printk(KERN_ERR"rotate_lcd spin_lock_irqsave\n");
46 - * spin_lock_irqsave(&glamo->lock_cmd, flags);
48 - * if (glamofb_cmd_mode(glamo, 1))
51 reg_set_bit_mask(glamo,
53 GLAMO_LCD_ROT_MODE_MASK,
54 @@ -278,12 +269,6 @@ static void rotate_lcd(struct glamofb_handle *glamo,
55 GLAMO_LCD_MODE1_ROTATE_EN,
56 (glamo_rot != GLAMO_LCD_ROT_MODE_0)?
57 GLAMO_LCD_MODE1_ROTATE_EN : 0);
58 -/* glamofb_cmd_mode(glamo, 0);
61 - printk(KERN_ERR"rotate_lcd spin_unlock_irqrestore\n");
62 - spin_unlock_irqrestore(&glamo->lock_cmd, flags);
66 static enum orientation get_orientation(struct fb_var_screeninfo *var)
67 @@ -296,14 +281,17 @@ static enum orientation get_orientation(struct fb_var_screeninfo *var)
69 static int will_orientation_change(struct fb_var_screeninfo *var)
71 - enum orientation orient = get_orientation(var);
72 + enum orientation orient = get_orientation(var);
75 case ORIENTATION_LANDSCAPE:
76 - if (var->rotate == FB_ROTATE_UR || var->rotate == FB_ROTATE_UD)
77 + if (var->rotate == FB_ROTATE_UR ||
78 + var->rotate == FB_ROTATE_UD)
81 case ORIENTATION_PORTRAIT:
82 - if (var->rotate == FB_ROTATE_CW || var->rotate == FB_ROTATE_CCW)
83 + if (var->rotate == FB_ROTATE_CW ||
84 + var->rotate == FB_ROTATE_CCW)
88 @@ -316,8 +304,6 @@ static void glamofb_update_lcd_controller(struct glamofb_handle *glamo,
89 int sync, bp, disp, fp, total, xres, yres, pitch, orientation_changing;
92 -/* GLAMO_LOG("enter: glamo:%#x, var:%#x\n", (unsigned)glamo, (unsigned)var);
97 @@ -333,27 +319,18 @@ static void glamofb_update_lcd_controller(struct glamofb_handle *glamo,
101 -/* GLAMO_LOG("xres:%d, yres:%d, rotate:%d\n", xres, yres, var->rotate);
104 - * figure out if orientation is going to change
107 + /* figure out if orientation is going to change */
108 orientation_changing = will_orientation_change(var);
109 -/* GLAMO_LOG("orientation_changing:%d\n", orientation_changing);
112 - * adjust the pitch according to new orientation to come
115 + /* adjust the pitch according to new orientation to come */
116 if (orientation_changing) {
117 pitch = var->yres * var->bits_per_pixel / 8;
119 pitch = var->xres * var->bits_per_pixel / 8;
121 -/* GLAMO_LOG("pitch:%d\n", pitch);
124 - * set the awaiten LCD geometry
127 + /* set the awaiten LCD geometry */
128 reg_set_bit_mask(glamo,
130 GLAMO_LCD_WIDTH_MASK,
131 @@ -367,16 +344,10 @@ static void glamofb_update_lcd_controller(struct glamofb_handle *glamo,
132 GLAMO_LCD_PITCH_MASK,
135 -/* GLAMO_LOG("mark:\n");*/
137 - * honour the rotation request
139 - rotate_lcd(glamo, var->rotate);
140 + /* honour the rotation request */
141 + __rotate_lcd(glamo, var->rotate);
144 - * update the reported geometry
145 - * of the framebuffer.
147 + /* update the reported geometry of the framebuffer. */
148 if (orientation_changing) {
149 var->xres_virtual = var->xres = yres;
150 var->yres_virtual = var->yres = xres;
151 @@ -385,11 +356,7 @@ static void glamofb_update_lcd_controller(struct glamofb_handle *glamo,
152 var->yres_virtual = var->yres = yres;
155 -/* GLAMO_LOG("reported res:(%d,%d)\n", var->xres, var->yres);
158 - * update scannout timings
160 + /* update scannout timings */
162 bp = sync + var->hsync_len;
163 disp = bp + var->left_margin;
164 @@ -407,8 +374,6 @@ static void glamofb_update_lcd_controller(struct glamofb_handle *glamo,
165 reg_set_bit_mask(glamo, GLAMO_REG_LCD_HORIZ_DISP_END,
166 GLAMO_LCD_HV_RETR_DISP_END_MASK, fp);
168 -/* GLAMO_LOG("mark:\n");
171 bp = sync + var->vsync_len;
172 disp = bp + var->upper_margin;
173 @@ -426,10 +391,8 @@ static void glamofb_update_lcd_controller(struct glamofb_handle *glamo,
174 reg_set_bit_mask(glamo, GLAMO_REG_LCD_VERT_DISP_END,
175 GLAMO_LCD_HV_RETR_DISP_END_MASK, fp);
177 -/* GLAMO_LOG("mark:\n"); */
178 glamofb_cmd_mode(glamo, 0);
180 -/* GLAMO_LOG("leave:\n"); */
182 spin_unlock_irqrestore(&glamo->lock_cmd, flags);
184 @@ -461,7 +424,8 @@ static int glamofb_blank(int blank_mode, struct fb_info *info)
188 -static inline unsigned int chan_to_field(unsigned int chan, struct fb_bitfield *bf)
189 +static inline unsigned int chan_to_field(unsigned int chan,
190 + struct fb_bitfield *bf)
193 chan >>= 16 - bf->length;