aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorAndres Salomon <dilinger@queued.net>2008-04-28 05:15:01 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-28 11:58:36 -0400
commitd1b4cc3ec5f8ddbac57ada58cbab36f5a0be38eb (patch)
tree76f9fa67cf3f717f22f1a293a4ca2c23cadc975e /drivers/video
parent9f1277bd1497858a05a80222a6e98f9c43343491 (diff)
gxfb: stop sharing code with gx1fb
We want to stop sharing stuff with gx1fb; it makes little sense. There were fields in geodefb_par that weren't being used, there was little point to the DC/VP ops callbacks, etc. This implements the following: - Create gxfb_par (based on geodefb_par), place it in gxfb.h - Drop display_gx.h and video_gx.h. The last few patches moved most stuff into gxfb.h anyways, so there was very little left. - Drop the geode_{dc,vid}_ops stuff. Un-static functions, add declarations to gxfb.h. Signed-off-by: Andres Salomon <dilinger@debian.org> Cc: Jordan Crouse <jordan.crouse@amd.com> Cc: "Antonino A. Daplas" <adaplas@pol.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/geode/display_gx.c21
-rw-r--r--drivers/video/geode/display_gx.h19
-rw-r--r--drivers/video/geode/gxfb.h31
-rw-r--r--drivers/video/geode/gxfb_core.c32
-rw-r--r--drivers/video/geode/video_gx.c20
-rw-r--r--drivers/video/geode/video_gx.h16
6 files changed, 47 insertions, 92 deletions
diff --git a/drivers/video/geode/display_gx.c b/drivers/video/geode/display_gx.c
index acf20bf2d26c..3743c8766a08 100644
--- a/drivers/video/geode/display_gx.c
+++ b/drivers/video/geode/display_gx.c
@@ -18,8 +18,6 @@
18#include <asm/div64.h> 18#include <asm/div64.h>
19#include <asm/delay.h> 19#include <asm/delay.h>
20 20
21#include "geodefb.h"
22#include "display_gx.h"
23#include "gxfb.h" 21#include "gxfb.h"
24 22
25unsigned int gx_frame_buffer_size(void) 23unsigned int gx_frame_buffer_size(void)
@@ -43,9 +41,9 @@ int gx_line_delta(int xres, int bpp)
43 return (xres * (bpp >> 3) + 7) & ~0x7; 41 return (xres * (bpp >> 3) + 7) & ~0x7;
44} 42}
45 43
46static void gx_set_mode(struct fb_info *info) 44void gx_set_mode(struct fb_info *info)
47{ 45{
48 struct geodefb_par *par = info->par; 46 struct gxfb_par *par = info->par;
49 u32 gcfg, dcfg; 47 u32 gcfg, dcfg;
50 int hactive, hblankstart, hsyncstart, hsyncend, hblankend, htotal; 48 int hactive, hblankstart, hsyncstart, hsyncend, hblankend, htotal;
51 int vactive, vblankstart, vsyncstart, vsyncend, vblankend, vtotal; 49 int vactive, vblankstart, vsyncstart, vsyncend, vblankend, vtotal;
@@ -69,7 +67,7 @@ static void gx_set_mode(struct fb_info *info)
69 write_dc(par, DC_GENERAL_CFG, gcfg); 67 write_dc(par, DC_GENERAL_CFG, gcfg);
70 68
71 /* Setup DCLK and its divisor. */ 69 /* Setup DCLK and its divisor. */
72 par->vid_ops->set_dclk(info); 70 gx_set_dclk_frequency(info);
73 71
74 /* 72 /*
75 * Setup new mode. 73 * Setup new mode.
@@ -147,16 +145,16 @@ static void gx_set_mode(struct fb_info *info)
147 write_dc(par, DC_DISPLAY_CFG, dcfg); 145 write_dc(par, DC_DISPLAY_CFG, dcfg);
148 write_dc(par, DC_GENERAL_CFG, gcfg); 146 write_dc(par, DC_GENERAL_CFG, gcfg);
149 147
150 par->vid_ops->configure_display(info); 148 gx_configure_display(info);
151 149
152 /* Relock display controller registers */ 150 /* Relock display controller registers */
153 write_dc(par, DC_UNLOCK, DC_UNLOCK_LOCK); 151 write_dc(par, DC_UNLOCK, DC_UNLOCK_LOCK);
154} 152}
155 153
156static void gx_set_hw_palette_reg(struct fb_info *info, unsigned regno, 154void gx_set_hw_palette_reg(struct fb_info *info, unsigned regno,
157 unsigned red, unsigned green, unsigned blue) 155 unsigned red, unsigned green, unsigned blue)
158{ 156{
159 struct geodefb_par *par = info->par; 157 struct gxfb_par *par = info->par;
160 int val; 158 int val;
161 159
162 /* Hardware palette is in RGB 8-8-8 format. */ 160 /* Hardware palette is in RGB 8-8-8 format. */
@@ -167,8 +165,3 @@ static void gx_set_hw_palette_reg(struct fb_info *info, unsigned regno,
167 write_dc(par, DC_PAL_ADDRESS, regno); 165 write_dc(par, DC_PAL_ADDRESS, regno);
168 write_dc(par, DC_PAL_DATA, val); 166 write_dc(par, DC_PAL_DATA, val);
169} 167}
170
171struct geode_dc_ops gx_dc_ops = {
172 .set_mode = gx_set_mode,
173 .set_palette_reg = gx_set_hw_palette_reg,
174};
diff --git a/drivers/video/geode/display_gx.h b/drivers/video/geode/display_gx.h
deleted file mode 100644
index ad556d39765c..000000000000
--- a/drivers/video/geode/display_gx.h
+++ /dev/null
@@ -1,19 +0,0 @@
1/*
2 * Geode GX display controller
3 *
4 * Copyright (C) 2006 Arcom Control Systems Ltd.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 */
11#ifndef __DISPLAY_GX_H__
12#define __DISPLAY_GX_H__
13
14unsigned int gx_frame_buffer_size(void);
15int gx_line_delta(int xres, int bpp);
16
17extern struct geode_dc_ops gx_dc_ops;
18
19#endif /* !__DISPLAY_GX1_H__ */
diff --git a/drivers/video/geode/gxfb.h b/drivers/video/geode/gxfb.h
index c21f9dc5e0c1..b8db7f82646c 100644
--- a/drivers/video/geode/gxfb.h
+++ b/drivers/video/geode/gxfb.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Copyright (C) 2008 Andres Salomon <dilinger@debian.org> 2 * Copyright (C) 2008 Andres Salomon <dilinger@debian.org>
3 * 3 *
4 * Geode GX2 register tables 4 * Geode GX2 header information
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by 7 * it under the terms of the GNU General Public License as published by
@@ -13,6 +13,23 @@
13 13
14#include <linux/io.h> 14#include <linux/io.h>
15 15
16struct gxfb_par {
17 int enable_crt;
18 void __iomem *dc_regs;
19 void __iomem *vid_regs;
20};
21
22unsigned int gx_frame_buffer_size(void);
23int gx_line_delta(int xres, int bpp);
24void gx_set_mode(struct fb_info *info);
25void gx_set_hw_palette_reg(struct fb_info *info, unsigned regno,
26 unsigned red, unsigned green, unsigned blue);
27
28void gx_set_dclk_frequency(struct fb_info *info);
29void gx_configure_display(struct fb_info *info);
30int gx_blank_display(struct fb_info *info, int blank_mode);
31
32
16/* Display Controller registers (table 6-38 from the data book) */ 33/* Display Controller registers (table 6-38 from the data book) */
17enum dc_registers { 34enum dc_registers {
18 DC_UNLOCK = 0, 35 DC_UNLOCK = 0,
@@ -221,33 +238,33 @@ enum fp_registers {
221 238
222/* register access functions */ 239/* register access functions */
223 240
224static inline uint32_t read_dc(struct geodefb_par *par, int reg) 241static inline uint32_t read_dc(struct gxfb_par *par, int reg)
225{ 242{
226 return readl(par->dc_regs + 4*reg); 243 return readl(par->dc_regs + 4*reg);
227} 244}
228 245
229static inline void write_dc(struct geodefb_par *par, int reg, uint32_t val) 246static inline void write_dc(struct gxfb_par *par, int reg, uint32_t val)
230{ 247{
231 writel(val, par->dc_regs + 4*reg); 248 writel(val, par->dc_regs + 4*reg);
232} 249}
233 250
234 251
235static inline uint32_t read_vp(struct geodefb_par *par, int reg) 252static inline uint32_t read_vp(struct gxfb_par *par, int reg)
236{ 253{
237 return readl(par->vid_regs + 8*reg); 254 return readl(par->vid_regs + 8*reg);
238} 255}
239 256
240static inline void write_vp(struct geodefb_par *par, int reg, uint32_t val) 257static inline void write_vp(struct gxfb_par *par, int reg, uint32_t val)
241{ 258{
242 writel(val, par->vid_regs + 8*reg); 259 writel(val, par->vid_regs + 8*reg);
243} 260}
244 261
245static inline uint32_t read_fp(struct geodefb_par *par, int reg) 262static inline uint32_t read_fp(struct gxfb_par *par, int reg)
246{ 263{
247 return readl(par->vid_regs + 8*reg + VP_FP_START); 264 return readl(par->vid_regs + 8*reg + VP_FP_START);
248} 265}
249 266
250static inline void write_fp(struct geodefb_par *par, int reg, uint32_t val) 267static inline void write_fp(struct gxfb_par *par, int reg, uint32_t val)
251{ 268{
252 writel(val, par->vid_regs + 8*reg + VP_FP_START); 269 writel(val, par->vid_regs + 8*reg + VP_FP_START);
253} 270}
diff --git a/drivers/video/geode/gxfb_core.c b/drivers/video/geode/gxfb_core.c
index 09132513c69a..fc56b8fc1a8b 100644
--- a/drivers/video/geode/gxfb_core.c
+++ b/drivers/video/geode/gxfb_core.c
@@ -32,9 +32,6 @@
32#include <linux/pci.h> 32#include <linux/pci.h>
33#include <asm/geode.h> 33#include <asm/geode.h>
34 34
35#include "geodefb.h"
36#include "display_gx.h"
37#include "video_gx.h"
38#include "gxfb.h" 35#include "gxfb.h"
39 36
40static char *mode_option; 37static char *mode_option;
@@ -142,8 +139,6 @@ static int gxfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
142 139
143static int gxfb_set_par(struct fb_info *info) 140static int gxfb_set_par(struct fb_info *info)
144{ 141{
145 struct geodefb_par *par = info->par;
146
147 if (info->var.bits_per_pixel > 8) { 142 if (info->var.bits_per_pixel > 8) {
148 info->fix.visual = FB_VISUAL_TRUECOLOR; 143 info->fix.visual = FB_VISUAL_TRUECOLOR;
149 fb_dealloc_cmap(&info->cmap); 144 fb_dealloc_cmap(&info->cmap);
@@ -154,7 +149,7 @@ static int gxfb_set_par(struct fb_info *info)
154 149
155 info->fix.line_length = gx_line_delta(info->var.xres, info->var.bits_per_pixel); 150 info->fix.line_length = gx_line_delta(info->var.xres, info->var.bits_per_pixel);
156 151
157 par->dc_ops->set_mode(info); 152 gx_set_mode(info);
158 153
159 return 0; 154 return 0;
160} 155}
@@ -170,8 +165,6 @@ static int gxfb_setcolreg(unsigned regno, unsigned red, unsigned green,
170 unsigned blue, unsigned transp, 165 unsigned blue, unsigned transp,
171 struct fb_info *info) 166 struct fb_info *info)
172{ 167{
173 struct geodefb_par *par = info->par;
174
175 if (info->var.grayscale) { 168 if (info->var.grayscale) {
176 /* grayscale = 0.30*R + 0.59*G + 0.11*B */ 169 /* grayscale = 0.30*R + 0.59*G + 0.11*B */
177 red = green = blue = (red * 77 + green * 151 + blue * 28) >> 8; 170 red = green = blue = (red * 77 + green * 151 + blue * 28) >> 8;
@@ -194,7 +187,7 @@ static int gxfb_setcolreg(unsigned regno, unsigned red, unsigned green,
194 if (regno >= 256) 187 if (regno >= 256)
195 return -EINVAL; 188 return -EINVAL;
196 189
197 par->dc_ops->set_palette_reg(info, regno, red, green, blue); 190 gx_set_hw_palette_reg(info, regno, red, green, blue);
198 } 191 }
199 192
200 return 0; 193 return 0;
@@ -202,14 +195,12 @@ static int gxfb_setcolreg(unsigned regno, unsigned red, unsigned green,
202 195
203static int gxfb_blank(int blank_mode, struct fb_info *info) 196static int gxfb_blank(int blank_mode, struct fb_info *info)
204{ 197{
205 struct geodefb_par *par = info->par; 198 return gx_blank_display(info, blank_mode);
206
207 return par->vid_ops->blank_display(info, blank_mode);
208} 199}
209 200
210static int __init gxfb_map_video_memory(struct fb_info *info, struct pci_dev *dev) 201static int __init gxfb_map_video_memory(struct fb_info *info, struct pci_dev *dev)
211{ 202{
212 struct geodefb_par *par = info->par; 203 struct gxfb_par *par = info->par;
213 int ret; 204 int ret;
214 205
215 ret = pci_enable_device(dev); 206 ret = pci_enable_device(dev);
@@ -266,11 +257,12 @@ static struct fb_ops gxfb_ops = {
266 257
267static struct fb_info * __init gxfb_init_fbinfo(struct device *dev) 258static struct fb_info * __init gxfb_init_fbinfo(struct device *dev)
268{ 259{
269 struct geodefb_par *par; 260 struct gxfb_par *par;
270 struct fb_info *info; 261 struct fb_info *info;
271 262
272 /* Alloc enough space for the pseudo palette. */ 263 /* Alloc enough space for the pseudo palette. */
273 info = framebuffer_alloc(sizeof(struct geodefb_par) + sizeof(u32) * 16, dev); 264 info = framebuffer_alloc(sizeof(struct gxfb_par) + sizeof(u32) * 16,
265 dev);
274 if (!info) 266 if (!info)
275 return NULL; 267 return NULL;
276 268
@@ -296,7 +288,7 @@ static struct fb_info * __init gxfb_init_fbinfo(struct device *dev)
296 info->flags = FBINFO_DEFAULT; 288 info->flags = FBINFO_DEFAULT;
297 info->node = -1; 289 info->node = -1;
298 290
299 info->pseudo_palette = (void *)par + sizeof(struct geodefb_par); 291 info->pseudo_palette = (void *)par + sizeof(struct gxfb_par);
300 292
301 info->var.grayscale = 0; 293 info->var.grayscale = 0;
302 294
@@ -305,7 +297,7 @@ static struct fb_info * __init gxfb_init_fbinfo(struct device *dev)
305 297
306static int __init gxfb_probe(struct pci_dev *pdev, const struct pci_device_id *id) 298static int __init gxfb_probe(struct pci_dev *pdev, const struct pci_device_id *id)
307{ 299{
308 struct geodefb_par *par; 300 struct gxfb_par *par;
309 struct fb_info *info; 301 struct fb_info *info;
310 int ret; 302 int ret;
311 unsigned long val; 303 unsigned long val;
@@ -315,10 +307,6 @@ static int __init gxfb_probe(struct pci_dev *pdev, const struct pci_device_id *i
315 return -ENOMEM; 307 return -ENOMEM;
316 par = info->par; 308 par = info->par;
317 309
318 /* GX display controller and GX video device. */
319 par->dc_ops = &gx_dc_ops;
320 par->vid_ops = &gx_vid_ops;
321
322 if ((ret = gxfb_map_video_memory(info, pdev)) < 0) { 310 if ((ret = gxfb_map_video_memory(info, pdev)) < 0) {
323 dev_err(&pdev->dev, "failed to map frame buffer or controller registers\n"); 311 dev_err(&pdev->dev, "failed to map frame buffer or controller registers\n");
324 goto err; 312 goto err;
@@ -378,7 +366,7 @@ static int __init gxfb_probe(struct pci_dev *pdev, const struct pci_device_id *i
378static void gxfb_remove(struct pci_dev *pdev) 366static void gxfb_remove(struct pci_dev *pdev)
379{ 367{
380 struct fb_info *info = pci_get_drvdata(pdev); 368 struct fb_info *info = pci_get_drvdata(pdev);
381 struct geodefb_par *par = info->par; 369 struct gxfb_par *par = info->par;
382 370
383 unregister_framebuffer(info); 371 unregister_framebuffer(info);
384 372
diff --git a/drivers/video/geode/video_gx.c b/drivers/video/geode/video_gx.c
index 1e26bc422461..0072d9ec2e24 100644
--- a/drivers/video/geode/video_gx.c
+++ b/drivers/video/geode/video_gx.c
@@ -18,8 +18,6 @@
18#include <asm/msr.h> 18#include <asm/msr.h>
19#include <asm/geode.h> 19#include <asm/geode.h>
20 20
21#include "geodefb.h"
22#include "video_gx.h"
23#include "gxfb.h" 21#include "gxfb.h"
24 22
25 23
@@ -119,7 +117,7 @@ static const struct gx_pll_entry gx_pll_table_14MHz[] = {
119 { 4357, 0, 0x0000057D }, /* 229.5000 */ 117 { 4357, 0, 0x0000057D }, /* 229.5000 */
120}; 118};
121 119
122static void gx_set_dclk_frequency(struct fb_info *info) 120void gx_set_dclk_frequency(struct fb_info *info)
123{ 121{
124 const struct gx_pll_entry *pll_table; 122 const struct gx_pll_entry *pll_table;
125 int pll_table_len; 123 int pll_table_len;
@@ -180,7 +178,7 @@ static void gx_set_dclk_frequency(struct fb_info *info)
180static void 178static void
181gx_configure_tft(struct fb_info *info) 179gx_configure_tft(struct fb_info *info)
182{ 180{
183 struct geodefb_par *par = info->par; 181 struct gxfb_par *par = info->par;
184 unsigned long val; 182 unsigned long val;
185 unsigned long fp; 183 unsigned long fp;
186 184
@@ -235,9 +233,9 @@ gx_configure_tft(struct fb_info *info)
235 write_fp(par, FP_PM, fp); 233 write_fp(par, FP_PM, fp);
236} 234}
237 235
238static void gx_configure_display(struct fb_info *info) 236void gx_configure_display(struct fb_info *info)
239{ 237{
240 struct geodefb_par *par = info->par; 238 struct gxfb_par *par = info->par;
241 u32 dcfg, misc; 239 u32 dcfg, misc;
242 240
243 /* Write the display configuration */ 241 /* Write the display configuration */
@@ -297,9 +295,9 @@ static void gx_configure_display(struct fb_info *info)
297 gx_configure_tft(info); 295 gx_configure_tft(info);
298} 296}
299 297
300static int gx_blank_display(struct fb_info *info, int blank_mode) 298int gx_blank_display(struct fb_info *info, int blank_mode)
301{ 299{
302 struct geodefb_par *par = info->par; 300 struct gxfb_par *par = info->par;
303 u32 dcfg, fp_pm; 301 u32 dcfg, fp_pm;
304 int blank, hsync, vsync; 302 int blank, hsync, vsync;
305 303
@@ -347,9 +345,3 @@ static int gx_blank_display(struct fb_info *info, int blank_mode)
347 345
348 return 0; 346 return 0;
349} 347}
350
351struct geode_vid_ops gx_vid_ops = {
352 .set_dclk = gx_set_dclk_frequency,
353 .configure_display = gx_configure_display,
354 .blank_display = gx_blank_display,
355};
diff --git a/drivers/video/geode/video_gx.h b/drivers/video/geode/video_gx.h
deleted file mode 100644
index 79f6e818a6f4..000000000000
--- a/drivers/video/geode/video_gx.h
+++ /dev/null
@@ -1,16 +0,0 @@
1/*
2 * Geode GX video device
3 *
4 * Copyright (C) 2006 Arcom Control Systems Ltd.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 */
11#ifndef __VIDEO_GX_H__
12#define __VIDEO_GX_H__
13
14extern struct geode_vid_ops gx_vid_ops;
15
16#endif /* !__VIDEO_GX_H__ */