Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 94150
b: refs/heads/master
c: d1b4cc3
h: refs/heads/master
v: v3
  • Loading branch information
Andres Salomon authored and Linus Torvalds committed Apr 28, 2008
1 parent b2d5e74 commit 1852ade
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 93 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9f1277bd1497858a05a80222a6e98f9c43343491
refs/heads/master: d1b4cc3ec5f8ddbac57ada58cbab36f5a0be38eb
21 changes: 7 additions & 14 deletions trunk/drivers/video/geode/display_gx.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
#include <asm/div64.h>
#include <asm/delay.h>

#include "geodefb.h"
#include "display_gx.h"
#include "gxfb.h"

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

static void gx_set_mode(struct fb_info *info)
void gx_set_mode(struct fb_info *info)
{
struct geodefb_par *par = info->par;
struct gxfb_par *par = info->par;
u32 gcfg, dcfg;
int hactive, hblankstart, hsyncstart, hsyncend, hblankend, htotal;
int vactive, vblankstart, vsyncstart, vsyncend, vblankend, vtotal;
Expand All @@ -69,7 +67,7 @@ static void gx_set_mode(struct fb_info *info)
write_dc(par, DC_GENERAL_CFG, gcfg);

/* Setup DCLK and its divisor. */
par->vid_ops->set_dclk(info);
gx_set_dclk_frequency(info);

/*
* Setup new mode.
Expand Down Expand Up @@ -147,16 +145,16 @@ static void gx_set_mode(struct fb_info *info)
write_dc(par, DC_DISPLAY_CFG, dcfg);
write_dc(par, DC_GENERAL_CFG, gcfg);

par->vid_ops->configure_display(info);
gx_configure_display(info);

/* Relock display controller registers */
write_dc(par, DC_UNLOCK, DC_UNLOCK_LOCK);
}

static void gx_set_hw_palette_reg(struct fb_info *info, unsigned regno,
unsigned red, unsigned green, unsigned blue)
void gx_set_hw_palette_reg(struct fb_info *info, unsigned regno,
unsigned red, unsigned green, unsigned blue)
{
struct geodefb_par *par = info->par;
struct gxfb_par *par = info->par;
int val;

/* Hardware palette is in RGB 8-8-8 format. */
Expand All @@ -167,8 +165,3 @@ static void gx_set_hw_palette_reg(struct fb_info *info, unsigned regno,
write_dc(par, DC_PAL_ADDRESS, regno);
write_dc(par, DC_PAL_DATA, val);
}

struct geode_dc_ops gx_dc_ops = {
.set_mode = gx_set_mode,
.set_palette_reg = gx_set_hw_palette_reg,
};
19 changes: 0 additions & 19 deletions trunk/drivers/video/geode/display_gx.h

This file was deleted.

31 changes: 24 additions & 7 deletions trunk/drivers/video/geode/gxfb.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Copyright (C) 2008 Andres Salomon <dilinger@debian.org>
*
* Geode GX2 register tables
* Geode GX2 header information
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand All @@ -13,6 +13,23 @@

#include <linux/io.h>

struct gxfb_par {
int enable_crt;
void __iomem *dc_regs;
void __iomem *vid_regs;
};

unsigned int gx_frame_buffer_size(void);
int gx_line_delta(int xres, int bpp);
void gx_set_mode(struct fb_info *info);
void gx_set_hw_palette_reg(struct fb_info *info, unsigned regno,
unsigned red, unsigned green, unsigned blue);

void gx_set_dclk_frequency(struct fb_info *info);
void gx_configure_display(struct fb_info *info);
int gx_blank_display(struct fb_info *info, int blank_mode);


/* Display Controller registers (table 6-38 from the data book) */
enum dc_registers {
DC_UNLOCK = 0,
Expand Down Expand Up @@ -221,33 +238,33 @@ enum fp_registers {

/* register access functions */

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

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


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

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

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

static inline void write_fp(struct geodefb_par *par, int reg, uint32_t val)
static inline void write_fp(struct gxfb_par *par, int reg, uint32_t val)
{
writel(val, par->vid_regs + 8*reg + VP_FP_START);
}
Expand Down
32 changes: 10 additions & 22 deletions trunk/drivers/video/geode/gxfb_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@
#include <linux/pci.h>
#include <asm/geode.h>

#include "geodefb.h"
#include "display_gx.h"
#include "video_gx.h"
#include "gxfb.h"

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

static int gxfb_set_par(struct fb_info *info)
{
struct geodefb_par *par = info->par;

if (info->var.bits_per_pixel > 8) {
info->fix.visual = FB_VISUAL_TRUECOLOR;
fb_dealloc_cmap(&info->cmap);
Expand All @@ -154,7 +149,7 @@ static int gxfb_set_par(struct fb_info *info)

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

par->dc_ops->set_mode(info);
gx_set_mode(info);

return 0;
}
Expand All @@ -170,8 +165,6 @@ static int gxfb_setcolreg(unsigned regno, unsigned red, unsigned green,
unsigned blue, unsigned transp,
struct fb_info *info)
{
struct geodefb_par *par = info->par;

if (info->var.grayscale) {
/* grayscale = 0.30*R + 0.59*G + 0.11*B */
red = green = blue = (red * 77 + green * 151 + blue * 28) >> 8;
Expand All @@ -194,22 +187,20 @@ static int gxfb_setcolreg(unsigned regno, unsigned red, unsigned green,
if (regno >= 256)
return -EINVAL;

par->dc_ops->set_palette_reg(info, regno, red, green, blue);
gx_set_hw_palette_reg(info, regno, red, green, blue);
}

return 0;
}

static int gxfb_blank(int blank_mode, struct fb_info *info)
{
struct geodefb_par *par = info->par;

return par->vid_ops->blank_display(info, blank_mode);
return gx_blank_display(info, blank_mode);
}

static int __init gxfb_map_video_memory(struct fb_info *info, struct pci_dev *dev)
{
struct geodefb_par *par = info->par;
struct gxfb_par *par = info->par;
int ret;

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

static struct fb_info * __init gxfb_init_fbinfo(struct device *dev)
{
struct geodefb_par *par;
struct gxfb_par *par;
struct fb_info *info;

/* Alloc enough space for the pseudo palette. */
info = framebuffer_alloc(sizeof(struct geodefb_par) + sizeof(u32) * 16, dev);
info = framebuffer_alloc(sizeof(struct gxfb_par) + sizeof(u32) * 16,
dev);
if (!info)
return NULL;

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

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

info->var.grayscale = 0;

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

static int __init gxfb_probe(struct pci_dev *pdev, const struct pci_device_id *id)
{
struct geodefb_par *par;
struct gxfb_par *par;
struct fb_info *info;
int ret;
unsigned long val;
Expand All @@ -315,10 +307,6 @@ static int __init gxfb_probe(struct pci_dev *pdev, const struct pci_device_id *i
return -ENOMEM;
par = info->par;

/* GX display controller and GX video device. */
par->dc_ops = &gx_dc_ops;
par->vid_ops = &gx_vid_ops;

if ((ret = gxfb_map_video_memory(info, pdev)) < 0) {
dev_err(&pdev->dev, "failed to map frame buffer or controller registers\n");
goto err;
Expand Down Expand Up @@ -378,7 +366,7 @@ static int __init gxfb_probe(struct pci_dev *pdev, const struct pci_device_id *i
static void gxfb_remove(struct pci_dev *pdev)
{
struct fb_info *info = pci_get_drvdata(pdev);
struct geodefb_par *par = info->par;
struct gxfb_par *par = info->par;

unregister_framebuffer(info);

Expand Down
20 changes: 6 additions & 14 deletions trunk/drivers/video/geode/video_gx.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
#include <asm/msr.h>
#include <asm/geode.h>

#include "geodefb.h"
#include "video_gx.h"
#include "gxfb.h"


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

static void gx_set_dclk_frequency(struct fb_info *info)
void gx_set_dclk_frequency(struct fb_info *info)
{
const struct gx_pll_entry *pll_table;
int pll_table_len;
Expand Down Expand Up @@ -180,7 +178,7 @@ static void gx_set_dclk_frequency(struct fb_info *info)
static void
gx_configure_tft(struct fb_info *info)
{
struct geodefb_par *par = info->par;
struct gxfb_par *par = info->par;
unsigned long val;
unsigned long fp;

Expand Down Expand Up @@ -235,9 +233,9 @@ gx_configure_tft(struct fb_info *info)
write_fp(par, FP_PM, fp);
}

static void gx_configure_display(struct fb_info *info)
void gx_configure_display(struct fb_info *info)
{
struct geodefb_par *par = info->par;
struct gxfb_par *par = info->par;
u32 dcfg, misc;

/* Write the display configuration */
Expand Down Expand Up @@ -297,9 +295,9 @@ static void gx_configure_display(struct fb_info *info)
gx_configure_tft(info);
}

static int gx_blank_display(struct fb_info *info, int blank_mode)
int gx_blank_display(struct fb_info *info, int blank_mode)
{
struct geodefb_par *par = info->par;
struct gxfb_par *par = info->par;
u32 dcfg, fp_pm;
int blank, hsync, vsync;

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

return 0;
}

struct geode_vid_ops gx_vid_ops = {
.set_dclk = gx_set_dclk_frequency,
.configure_display = gx_configure_display,
.blank_display = gx_blank_display,
};
16 changes: 0 additions & 16 deletions trunk/drivers/video/geode/video_gx.h

This file was deleted.

0 comments on commit 1852ade

Please sign in to comment.