aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/savage/savagefb.h
diff options
context:
space:
mode:
authorAntonino A. Daplas <adaplas@gmail.com>2005-11-07 04:00:41 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-07 10:53:51 -0500
commit1cc650c69f3079ce3c616c998a741bcf6ddf4f4d (patch)
tree643264be86a99d60031a69a33f4f56b0183769d1 /drivers/video/savage/savagefb.h
parent1013d26663199f8c1c31e1fe8e9352da09630d69 (diff)
[PATCH] savagefb: Convert from VGA IO access to MMIO access
Use MMIO registers instead of banging the VGA IO registers. Signed-off-by: Antonino Daplas <adaplas@pol.net> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/video/savage/savagefb.h')
-rw-r--r--drivers/video/savage/savagefb.h206
1 files changed, 126 insertions, 80 deletions
diff --git a/drivers/video/savage/savagefb.h b/drivers/video/savage/savagefb.h
index ea17f7e0482c..58cfdfb41833 100644
--- a/drivers/video/savage/savagefb.h
+++ b/drivers/video/savage/savagefb.h
@@ -169,6 +169,7 @@ struct savagefb_par {
169 struct savagefb_i2c_chan chan; 169 struct savagefb_i2c_chan chan;
170 unsigned char *edid; 170 unsigned char *edid;
171 u32 pseudo_palette[16]; 171 u32 pseudo_palette[16];
172 int paletteEnabled;
172 int pm_state; 173 int pm_state;
173 int display_type; 174 int display_type;
174 int dvi; 175 int dvi;
@@ -244,105 +245,150 @@ struct savagefb_par {
244 245
245 246
246/* IO functions */ 247/* IO functions */
248static inline u8 savage_in8(u32 addr, struct savagefb_par *par)
249{
250 return readb(par->mmio.vbase + addr);
251}
252
253static inline u16 savage_in16(u32 addr, struct savagefb_par *par)
254{
255 return readw(par->mmio.vbase + addr);
256}
257
258static inline u32 savage_in32(u32 addr, struct savagefb_par *par)
259{
260 return readl(par->mmio.vbase + addr);
261}
262
263static inline void savage_out8(u32 addr, u8 val, struct savagefb_par *par)
264{
265 writeb(val, par->mmio.vbase + addr);
266}
267
268static inline void savage_out16(u32 addr, u16 val, struct savagefb_par *par)
269{
270 writew(val, par->mmio.vbase + addr);
271}
272
273static inline void savage_out32(u32 addr, u32 val, struct savagefb_par *par)
274{
275 writel(val, par->mmio.vbase + addr);
276}
277
278static inline u8 vga_in8(int addr, struct savagefb_par *par)
279{
280 return savage_in8(0x8000 + addr, par);
281}
282
283static inline u16 vga_in16(int addr, struct savagefb_par *par)
284{
285 return savage_in16(0x8000 + addr, par);
286}
287
288static inline u8 vga_in32(int addr, struct savagefb_par *par)
289{
290 return savage_in32(0x8000 + addr, par);
291}
292
293static inline void vga_out8(int addr, u8 val, struct savagefb_par *par)
294{
295 savage_out8(0x8000 + addr, val, par);
296}
297
298static inline void vga_out16(int addr, u16 val, struct savagefb_par *par)
299{
300 savage_out16(0x8000 + addr, val, par);
301}
302
303static inline void vga_out32(int addr, u32 val, struct savagefb_par *par)
304{
305 savage_out32(0x8000 + addr, val, par);
306}
247 307
248#define vga_in8(addr) (inb (addr)) 308static inline u8 VGArCR (u8 index, struct savagefb_par *par)
249#define vga_in16(addr) (inw (addr)) 309{
250#define vga_in32(addr) (inl (addr)) 310 vga_out8(0x3d4, index, par);
311 return vga_in8(0x3d5, par);
312}
313
314static inline u8 VGArGR (u8 index, struct savagefb_par *par)
315{
316 vga_out8(0x3ce, index, par);
317 return vga_in8(0x3cf, par);
318}
319
320static inline u8 VGArSEQ (u8 index, struct savagefb_par *par)
321{
322 vga_out8(0x3c4, index, par);
323 return vga_in8(0x3c5, par);
324}
251 325
252#define vga_out8(addr,val) (outb ((val), (addr))) 326static inline void VGAwCR(u8 index, u8 val, struct savagefb_par *par)
253#define vga_out16(addr,val) (outw ((val), (addr))) 327{
254#define vga_out32(addr,val) (outl ((val), (addr))) 328 vga_out8(0x3d4, index, par);
329 vga_out8(0x3d5, val, par);
330}
255 331
256#define savage_in16(addr) readw(par->mmio.vbase + (addr)) 332static inline void VGAwGR(u8 index, u8 val, struct savagefb_par *par)
257#define savage_in32(addr) readl(par->mmio.vbase + (addr)) 333{
334 vga_out8(0x3ce, index, par);
335 vga_out8(0x3cf, val, par);
336}
258 337
259#define savage_out16(addr,val) writew((val), par->mmio.vbase + (addr)) 338static inline void VGAwSEQ(u8 index, u8 val, struct savagefb_par *par)
260#define savage_out32(addr,val) writel((val), par->mmio.vbase + (addr)) 339{
340 vga_out8(0x3c4, index, par);
341 vga_out8 (0x3c5, val, par);
342}
261 343
262static inline u8 VGArCR (u8 index) 344static inline void VGAenablePalette(struct savagefb_par *par)
263{ 345{
264 outb (index, 0x3d4); 346 u8 tmp;
265 return inb (0x3d5); 347
348 tmp = vga_in8(0x3da, par);
349 vga_out8(0x3c0, 0x00, par);
350 par->paletteEnabled = 1;
266} 351}
267 352
268static inline u8 VGArGR (u8 index) 353static inline void VGAdisablePalette(struct savagefb_par *par)
269{ 354{
270 outb (index, 0x3ce); 355 u8 tmp;
271 return inb (0x3cf); 356
357 tmp = vga_in8(0x3da, par);
358 vga_out8(0x3c0, 0x20, par);
359 par->paletteEnabled = 0;
272} 360}
273 361
274static inline u8 VGArSEQ (u8 index) 362static inline void VGAwATTR(u8 index, u8 value, struct savagefb_par *par)
275{ 363{
276 outb (index, 0x3c4); 364 u8 tmp;
277 return inb (0x3c5); 365
366 if (par->paletteEnabled)
367 index &= ~0x20;
368 else
369 index |= 0x20;
370
371 tmp = vga_in8(0x3da, par);
372 vga_out8(0x3c0, index, par);
373 vga_out8 (0x3c0, value, par);
278} 374}
279 375
280#define VGAwCR(index, val) \ 376static inline void VGAwMISC(u8 value, struct savagefb_par *par)
281do { \ 377{
282 vga_out8 (0x3d4, index); \ 378 vga_out8(0x3c2, value, par);
283 vga_out8 (0x3d5, val); \ 379}
284} while (0)
285
286#define VGAwGR(index, val) \
287do { \
288 vga_out8 (0x3ce, index); \
289 vga_out8 (0x3cf, val); \
290} while (0)
291
292#define VGAwSEQ(index, val) \
293do { \
294 vga_out8 (0x3c4, index); \
295 vga_out8 (0x3c5, val); \
296} while (0)
297
298#define VGAenablePalette() \
299do { \
300 u8 tmp; \
301 \
302 tmp = vga_in8 (0x3da); \
303 vga_out8 (0x3c0, 0x00); \
304 paletteEnabled = 1; \
305} while (0)
306
307#define VGAdisablePalette() \
308do { \
309 u8 tmp; \
310 \
311 tmp = vga_in8 (0x3da); \
312 vga_out8 (0x3c0, 0x20); \
313 paletteEnabled = 0; \
314} while (0)
315
316#define VGAwATTR(index, value) \
317do { \
318 u8 tmp; \
319 \
320 if (paletteEnabled) \
321 index &= ~0x20; \
322 else \
323 index |= 0x20; \
324 \
325 tmp = vga_in8 (0x3da); \
326 vga_out8 (0x3c0, index); \
327 vga_out8 (0x3c0, value); \
328} while (0)
329
330#define VGAwMISC(value) \
331do { \
332 vga_out8 (0x3c2, value); \
333} while (0)
334 380
335#ifndef CONFIG_FB_SAVAGE_ACCEL 381#ifndef CONFIG_FB_SAVAGE_ACCEL
336#define savagefb_set_clip(x) 382#define savagefb_set_clip(x)
337#endif 383#endif
338 384
339#define VerticalRetraceWait() \ 385static inline void VerticalRetraceWait(struct savagefb_par *par)
340{ \ 386{
341 vga_out8 (0x3d4, 0x17); \ 387 vga_out8(0x3d4, 0x17, par);
342 if (vga_in8 (0x3d5) & 0x80) { \ 388 if (vga_in8(0x3d5, par) & 0x80) {
343 while ((vga_in8(0x3da) & 0x08) == 0x08) ; \ 389 while ((vga_in8(0x3da, par) & 0x08) == 0x08);
344 while ((vga_in8(0x3da) & 0x08) == 0x00) ; \ 390 while ((vga_in8(0x3da, par) & 0x08) == 0x00);
345 } \ 391 }
346} 392}
347 393
348extern int savagefb_probe_i2c_connector(struct fb_info *info, 394extern int savagefb_probe_i2c_connector(struct fb_info *info,