Skip to content

Commit d1b4cc3

Browse files
dilingertorvalds
authored andcommitted
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>
1 parent 9f1277b commit d1b4cc3

6 files changed

Lines changed: 47 additions & 92 deletions

File tree

‎drivers/video/geode/display_gx.c‎

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
#include <asm/div64.h>
1919
#include <asm/delay.h>
2020

21-
#include "geodefb.h"
22-
#include "display_gx.h"
2321
#include "gxfb.h"
2422

2523
unsigned int gx_frame_buffer_size(void)
@@ -43,9 +41,9 @@ int gx_line_delta(int xres, int bpp)
4341
return (xres * (bpp >> 3) + 7) & ~0x7;
4442
}
4543

46-
static void gx_set_mode(struct fb_info *info)
44+
void gx_set_mode(struct fb_info *info)
4745
{
48-
struct geodefb_par *par = info->par;
46+
struct gxfb_par *par = info->par;
4947
u32 gcfg, dcfg;
5048
int hactive, hblankstart, hsyncstart, hsyncend, hblankend, htotal;
5149
int vactive, vblankstart, vsyncstart, vsyncend, vblankend, vtotal;
@@ -69,7 +67,7 @@ static void gx_set_mode(struct fb_info *info)
6967
write_dc(par, DC_GENERAL_CFG, gcfg);
7068

7169
/* Setup DCLK and its divisor. */
72-
par->vid_ops->set_dclk(info);
70+
gx_set_dclk_frequency(info);
7371

7472
/*
7573
* Setup new mode.
@@ -147,16 +145,16 @@ static void gx_set_mode(struct fb_info *info)
147145
write_dc(par, DC_DISPLAY_CFG, dcfg);
148146
write_dc(par, DC_GENERAL_CFG, gcfg);
149147

150-
par->vid_ops->configure_display(info);
148+
gx_configure_display(info);
151149

152150
/* Relock display controller registers */
153151
write_dc(par, DC_UNLOCK, DC_UNLOCK_LOCK);
154152
}
155153

156-
static void gx_set_hw_palette_reg(struct fb_info *info, unsigned regno,
157-
unsigned red, unsigned green, unsigned blue)
154+
void gx_set_hw_palette_reg(struct fb_info *info, unsigned regno,
155+
unsigned red, unsigned green, unsigned blue)
158156
{
159-
struct geodefb_par *par = info->par;
157+
struct gxfb_par *par = info->par;
160158
int val;
161159

162160
/* 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,
167165
write_dc(par, DC_PAL_ADDRESS, regno);
168166
write_dc(par, DC_PAL_DATA, val);
169167
}
170-
171-
struct geode_dc_ops gx_dc_ops = {
172-
.set_mode = gx_set_mode,
173-
.set_palette_reg = gx_set_hw_palette_reg,
174-
};

‎drivers/video/geode/display_gx.h‎

Lines changed: 0 additions & 19 deletions
This file was deleted.

‎drivers/video/geode/gxfb.h‎

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* Copyright (C) 2008 Andres Salomon <dilinger@debian.org>
33
*
4-
* Geode GX2 register tables
4+
* Geode GX2 header information
55
*
66
* This program is free software; you can redistribute it and/or modify
77
* it under the terms of the GNU General Public License as published by
@@ -13,6 +13,23 @@
1313

1414
#include <linux/io.h>
1515

16+
struct gxfb_par {
17+
int enable_crt;
18+
void __iomem *dc_regs;
19+
void __iomem *vid_regs;
20+
};
21+
22+
unsigned int gx_frame_buffer_size(void);
23+
int gx_line_delta(int xres, int bpp);
24+
void gx_set_mode(struct fb_info *info);
25+
void gx_set_hw_palette_reg(struct fb_info *info, unsigned regno,
26+
unsigned red, unsigned green, unsigned blue);
27+
28+
void gx_set_dclk_frequency(struct fb_info *info);
29+
void gx_configure_display(struct fb_info *info);
30+
int gx_blank_display(struct fb_info *info, int blank_mode);
31+
32+
1633
/* Display Controller registers (table 6-38 from the data book) */
1734
enum dc_registers {
1835
DC_UNLOCK = 0,
@@ -221,33 +238,33 @@ enum fp_registers {
221238

222239
/* register access functions */
223240

224-
static inline uint32_t read_dc(struct geodefb_par *par, int reg)
241+
static inline uint32_t read_dc(struct gxfb_par *par, int reg)
225242
{
226243
return readl(par->dc_regs + 4*reg);
227244
}
228245

229-
static inline void write_dc(struct geodefb_par *par, int reg, uint32_t val)
246+
static inline void write_dc(struct gxfb_par *par, int reg, uint32_t val)
230247
{
231248
writel(val, par->dc_regs + 4*reg);
232249
}
233250

234251

235-
static inline uint32_t read_vp(struct geodefb_par *par, int reg)
252+
static inline uint32_t read_vp(struct gxfb_par *par, int reg)
236253
{
237254
return readl(par->vid_regs + 8*reg);
238255
}
239256

240-
static inline void write_vp(struct geodefb_par *par, int reg, uint32_t val)
257+
static inline void write_vp(struct gxfb_par *par, int reg, uint32_t val)
241258
{
242259
writel(val, par->vid_regs + 8*reg);
243260
}
244261

245-
static inline uint32_t read_fp(struct geodefb_par *par, int reg)
262+
static inline uint32_t read_fp(struct gxfb_par *par, int reg)
246263
{
247264
return readl(par->vid_regs + 8*reg + VP_FP_START);
248265
}
249266

250-
static inline void write_fp(struct geodefb_par *par, int reg, uint32_t val)
267+
static inline void write_fp(struct gxfb_par *par, int reg, uint32_t val)
251268
{
252269
writel(val, par->vid_regs + 8*reg + VP_FP_START);
253270
}

‎drivers/video/geode/gxfb_core.c‎

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@
3232
#include <linux/pci.h>
3333
#include <asm/geode.h>
3434

35-
#include "geodefb.h"
36-
#include "display_gx.h"
37-
#include "video_gx.h"
3835
#include "gxfb.h"
3936

4037
static char *mode_option;
@@ -142,8 +139,6 @@ static int gxfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
142139

143140
static int gxfb_set_par(struct fb_info *info)
144141
{
145-
struct geodefb_par *par = info->par;
146-
147142
if (info->var.bits_per_pixel > 8) {
148143
info->fix.visual = FB_VISUAL_TRUECOLOR;
149144
fb_dealloc_cmap(&info->cmap);
@@ -154,7 +149,7 @@ static int gxfb_set_par(struct fb_info *info)
154149

155150
info->fix.line_length = gx_line_delta(info->var.xres, info->var.bits_per_pixel);
156151

157-
par->dc_ops->set_mode(info);
152+
gx_set_mode(info);
158153

159154
return 0;
160155
}
@@ -170,8 +165,6 @@ static int gxfb_setcolreg(unsigned regno, unsigned red, unsigned green,
170165
unsigned blue, unsigned transp,
171166
struct fb_info *info)
172167
{
173-
struct geodefb_par *par = info->par;
174-
175168
if (info->var.grayscale) {
176169
/* grayscale = 0.30*R + 0.59*G + 0.11*B */
177170
red = green = blue = (red * 77 + green * 151 + blue * 28) >> 8;
@@ -194,22 +187,20 @@ static int gxfb_setcolreg(unsigned regno, unsigned red, unsigned green,
194187
if (regno >= 256)
195188
return -EINVAL;
196189

197-
par->dc_ops->set_palette_reg(info, regno, red, green, blue);
190+
gx_set_hw_palette_reg(info, regno, red, green, blue);
198191
}
199192

200193
return 0;
201194
}
202195

203196
static int gxfb_blank(int blank_mode, struct fb_info *info)
204197
{
205-
struct geodefb_par *par = info->par;
206-
207-
return par->vid_ops->blank_display(info, blank_mode);
198+
return gx_blank_display(info, blank_mode);
208199
}
209200

210201
static int __init gxfb_map_video_memory(struct fb_info *info, struct pci_dev *dev)
211202
{
212-
struct geodefb_par *par = info->par;
203+
struct gxfb_par *par = info->par;
213204
int ret;
214205

215206
ret = pci_enable_device(dev);
@@ -266,11 +257,12 @@ static struct fb_ops gxfb_ops = {
266257

267258
static struct fb_info * __init gxfb_init_fbinfo(struct device *dev)
268259
{
269-
struct geodefb_par *par;
260+
struct gxfb_par *par;
270261
struct fb_info *info;
271262

272263
/* 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);
274266
if (!info)
275267
return NULL;
276268

@@ -296,7 +288,7 @@ static struct fb_info * __init gxfb_init_fbinfo(struct device *dev)
296288
info->flags = FBINFO_DEFAULT;
297289
info->node = -1;
298290

299-
info->pseudo_palette = (void *)par + sizeof(struct geodefb_par);
291+
info->pseudo_palette = (void *)par + sizeof(struct gxfb_par);
300292

301293
info->var.grayscale = 0;
302294

@@ -305,7 +297,7 @@ static struct fb_info * __init gxfb_init_fbinfo(struct device *dev)
305297

306298
static int __init gxfb_probe(struct pci_dev *pdev, const struct pci_device_id *id)
307299
{
308-
struct geodefb_par *par;
300+
struct gxfb_par *par;
309301
struct fb_info *info;
310302
int ret;
311303
unsigned long val;
@@ -315,10 +307,6 @@ static int __init gxfb_probe(struct pci_dev *pdev, const struct pci_device_id *i
315307
return -ENOMEM;
316308
par = info->par;
317309

318-
/* GX display controller and GX video device. */
319-
par->dc_ops = &gx_dc_ops;
320-
par->vid_ops = &gx_vid_ops;
321-
322310
if ((ret = gxfb_map_video_memory(info, pdev)) < 0) {
323311
dev_err(&pdev->dev, "failed to map frame buffer or controller registers\n");
324312
goto err;
@@ -378,7 +366,7 @@ static int __init gxfb_probe(struct pci_dev *pdev, const struct pci_device_id *i
378366
static void gxfb_remove(struct pci_dev *pdev)
379367
{
380368
struct fb_info *info = pci_get_drvdata(pdev);
381-
struct geodefb_par *par = info->par;
369+
struct gxfb_par *par = info->par;
382370

383371
unregister_framebuffer(info);
384372

‎drivers/video/geode/video_gx.c‎

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
#include <asm/msr.h>
1919
#include <asm/geode.h>
2020

21-
#include "geodefb.h"
22-
#include "video_gx.h"
2321
#include "gxfb.h"
2422

2523

@@ -119,7 +117,7 @@ static const struct gx_pll_entry gx_pll_table_14MHz[] = {
119117
{ 4357, 0, 0x0000057D }, /* 229.5000 */
120118
};
121119

122-
static void gx_set_dclk_frequency(struct fb_info *info)
120+
void gx_set_dclk_frequency(struct fb_info *info)
123121
{
124122
const struct gx_pll_entry *pll_table;
125123
int pll_table_len;
@@ -180,7 +178,7 @@ static void gx_set_dclk_frequency(struct fb_info *info)
180178
static void
181179
gx_configure_tft(struct fb_info *info)
182180
{
183-
struct geodefb_par *par = info->par;
181+
struct gxfb_par *par = info->par;
184182
unsigned long val;
185183
unsigned long fp;
186184

@@ -235,9 +233,9 @@ gx_configure_tft(struct fb_info *info)
235233
write_fp(par, FP_PM, fp);
236234
}
237235

238-
static void gx_configure_display(struct fb_info *info)
236+
void gx_configure_display(struct fb_info *info)
239237
{
240-
struct geodefb_par *par = info->par;
238+
struct gxfb_par *par = info->par;
241239
u32 dcfg, misc;
242240

243241
/* Write the display configuration */
@@ -297,9 +295,9 @@ static void gx_configure_display(struct fb_info *info)
297295
gx_configure_tft(info);
298296
}
299297

300-
static int gx_blank_display(struct fb_info *info, int blank_mode)
298+
int gx_blank_display(struct fb_info *info, int blank_mode)
301299
{
302-
struct geodefb_par *par = info->par;
300+
struct gxfb_par *par = info->par;
303301
u32 dcfg, fp_pm;
304302
int blank, hsync, vsync;
305303

@@ -347,9 +345,3 @@ static int gx_blank_display(struct fb_info *info, int blank_mode)
347345

348346
return 0;
349347
}
350-
351-
struct 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-
};

‎drivers/video/geode/video_gx.h‎

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)