Commit 689c9568 authored by Krzysztof Halasa's avatar Krzysztof Halasa Committed by Linus Torvalds

Intel FB: whitespace, bracket and other clean-ups

Intel FB: whitespace, bracket and other clean-ups
Signed-off-by: default avatarKrzysztof Halasa <khc@pm.waw.pl>
Cc: "Antonino A. Daplas" <adaplas@pol.net>
Cc: <sylvain.meyer@worldonline.fr>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 53ee1b5b
...@@ -231,8 +231,8 @@ struct intelfb_hwstate { ...@@ -231,8 +231,8 @@ struct intelfb_hwstate {
struct intelfb_heap_data { struct intelfb_heap_data {
u32 physical; u32 physical;
u8 __iomem *virtual; u8 __iomem *virtual;
u32 offset; // in GATT pages u32 offset; /* in GATT pages */
u32 size; // in bytes u32 size; /* in bytes */
}; };
#ifdef CONFIG_FB_INTEL_I2C #ifdef CONFIG_FB_INTEL_I2C
...@@ -270,9 +270,9 @@ struct intelfb_info { ...@@ -270,9 +270,9 @@ struct intelfb_info {
struct intelfb_hwstate save_state; struct intelfb_hwstate save_state;
/* agpgart structs */ /* agpgart structs */
struct agp_memory *gtt_fb_mem; // use all stolen memory or vram struct agp_memory *gtt_fb_mem; /* use all stolen memory or vram */
struct agp_memory *gtt_ring_mem; // ring buffer struct agp_memory *gtt_ring_mem; /* ring buffer */
struct agp_memory *gtt_cursor_mem; // hw cursor struct agp_memory *gtt_cursor_mem; /* hw cursor */
/* use a gart reserved fb mem */ /* use a gart reserved fb mem */
u8 fbmem_gart; u8 fbmem_gart;
...@@ -346,7 +346,7 @@ struct intelfb_info { ...@@ -346,7 +346,7 @@ struct intelfb_info {
/* driver registered */ /* driver registered */
int registered; int registered;
/* index into plls */ /* index into plls */
int pll_index; int pll_index;
......
...@@ -58,7 +58,8 @@ static void intelfb_gpio_setscl(void *data, int state) ...@@ -58,7 +58,8 @@ static void intelfb_gpio_setscl(void *data, int state)
struct intelfb_info *dinfo = chan->dinfo; struct intelfb_info *dinfo = chan->dinfo;
u32 val; u32 val;
OUTREG(chan->reg, (state ? SCL_VAL_OUT : 0) | SCL_DIR | SCL_DIR_MASK | SCL_VAL_MASK); OUTREG(chan->reg, (state ? SCL_VAL_OUT : 0) |
SCL_DIR | SCL_DIR_MASK | SCL_VAL_MASK);
val = INREG(chan->reg); val = INREG(chan->reg);
} }
...@@ -68,7 +69,8 @@ static void intelfb_gpio_setsda(void *data, int state) ...@@ -68,7 +69,8 @@ static void intelfb_gpio_setsda(void *data, int state)
struct intelfb_info *dinfo = chan->dinfo; struct intelfb_info *dinfo = chan->dinfo;
u32 val; u32 val;
OUTREG(chan->reg, (state ? SDA_VAL_OUT : 0) | SDA_DIR | SDA_DIR_MASK | SDA_VAL_MASK); OUTREG(chan->reg, (state ? SDA_VAL_OUT : 0) |
SDA_DIR | SDA_DIR_MASK | SDA_VAL_MASK);
val = INREG(chan->reg); val = INREG(chan->reg);
} }
...@@ -97,26 +99,26 @@ static int intelfb_gpio_getsda(void *data) ...@@ -97,26 +99,26 @@ static int intelfb_gpio_getsda(void *data)
} }
static int intelfb_setup_i2c_bus(struct intelfb_info *dinfo, static int intelfb_setup_i2c_bus(struct intelfb_info *dinfo,
struct intelfb_i2c_chan *chan, struct intelfb_i2c_chan *chan,
const u32 reg, const char *name) const u32 reg, const char *name)
{ {
int rc; int rc;
chan->dinfo = dinfo; chan->dinfo = dinfo;
chan->reg = reg; chan->reg = reg;
snprintf(chan->adapter.name, sizeof(chan->adapter.name), snprintf(chan->adapter.name, sizeof(chan->adapter.name),
"intelfb %s", name); "intelfb %s", name);
chan->adapter.owner = THIS_MODULE; chan->adapter.owner = THIS_MODULE;
chan->adapter.id = I2C_HW_B_INTELFB; chan->adapter.id = I2C_HW_B_INTELFB;
chan->adapter.algo_data = &chan->algo; chan->adapter.algo_data = &chan->algo;
chan->adapter.dev.parent = &chan->dinfo->pdev->dev; chan->adapter.dev.parent = &chan->dinfo->pdev->dev;
chan->algo.setsda = intelfb_gpio_setsda; chan->algo.setsda = intelfb_gpio_setsda;
chan->algo.setscl = intelfb_gpio_setscl; chan->algo.setscl = intelfb_gpio_setscl;
chan->algo.getsda = intelfb_gpio_getsda; chan->algo.getsda = intelfb_gpio_getsda;
chan->algo.getscl = intelfb_gpio_getscl; chan->algo.getscl = intelfb_gpio_getscl;
chan->algo.udelay = 40; chan->algo.udelay = 40;
chan->algo.timeout = 20; chan->algo.timeout = 20;
chan->algo.data = chan; chan->algo.data = chan;
i2c_set_adapdata(&chan->adapter, chan); i2c_set_adapdata(&chan->adapter, chan);
...@@ -142,40 +144,44 @@ void intelfb_create_i2c_busses(struct intelfb_info *dinfo) ...@@ -142,40 +144,44 @@ void intelfb_create_i2c_busses(struct intelfb_info *dinfo)
dinfo->output[i].type = INTELFB_OUTPUT_ANALOG; dinfo->output[i].type = INTELFB_OUTPUT_ANALOG;
/* setup the DDC bus for analog output */ /* setup the DDC bus for analog output */
intelfb_setup_i2c_bus(dinfo, &dinfo->output[i].ddc_bus, GPIOA, "CRTDDC_A"); intelfb_setup_i2c_bus(dinfo, &dinfo->output[i].ddc_bus, GPIOA,
"CRTDDC_A");
i++; i++;
/* need to add the output busses for each device /* need to add the output busses for each device
- this function is very incomplete - this function is very incomplete
- i915GM has LVDS and TVOUT for example - i915GM has LVDS and TVOUT for example
*/ */
switch(dinfo->chipset) { switch(dinfo->chipset) {
case INTEL_830M: case INTEL_830M:
case INTEL_845G: case INTEL_845G:
case INTEL_855GM: case INTEL_855GM:
case INTEL_865G: case INTEL_865G:
dinfo->output[i].type = INTELFB_OUTPUT_DVO; dinfo->output[i].type = INTELFB_OUTPUT_DVO;
intelfb_setup_i2c_bus(dinfo, &dinfo->output[i].ddc_bus, GPIOD, "DVODDC_D"); intelfb_setup_i2c_bus(dinfo, &dinfo->output[i].ddc_bus,
intelfb_setup_i2c_bus(dinfo, &dinfo->output[i].i2c_bus, GPIOE, "DVOI2C_E"); GPIOD, "DVODDC_D");
intelfb_setup_i2c_bus(dinfo, &dinfo->output[i].i2c_bus,
GPIOE, "DVOI2C_E");
i++; i++;
break; break;
case INTEL_915G: case INTEL_915G:
case INTEL_915GM: case INTEL_915GM:
/* has some LVDS + tv-out */ /* has some LVDS + tv-out */
case INTEL_945G: case INTEL_945G:
case INTEL_945GM: case INTEL_945GM:
/* SDVO ports have a single control bus - 2 devices */ /* SDVO ports have a single control bus - 2 devices */
dinfo->output[i].type = INTELFB_OUTPUT_SDVO; dinfo->output[i].type = INTELFB_OUTPUT_SDVO;
intelfb_setup_i2c_bus(dinfo, &dinfo->output[i].i2c_bus, GPIOE, "SDVOCTRL_E"); intelfb_setup_i2c_bus(dinfo, &dinfo->output[i].i2c_bus,
GPIOE, "SDVOCTRL_E");
/* TODO: initialize the SDVO */ /* TODO: initialize the SDVO */
// I830SDVOInit(pScrn, i, DVOB); /* I830SDVOInit(pScrn, i, DVOB); */
i++; i++;
/* set up SDVOC */ /* set up SDVOC */
dinfo->output[i].type = INTELFB_OUTPUT_SDVO; dinfo->output[i].type = INTELFB_OUTPUT_SDVO;
dinfo->output[i].i2c_bus = dinfo->output[i - 1].i2c_bus; dinfo->output[i].i2c_bus = dinfo->output[i - 1].i2c_bus;
/* TODO: initialize the SDVO */ /* TODO: initialize the SDVO */
// I830SDVOInit(pScrn, i, DVOC); /* I830SDVOInit(pScrn, i, DVOC); */
i++; i++;
break; break;
} }
......
...@@ -99,13 +99,6 @@ ...@@ -99,13 +99,6 @@
* Add vram option to reserve more memory than stolen by BIOS * Add vram option to reserve more memory than stolen by BIOS
* Fix intelfbhw_pan_display typo * Fix intelfbhw_pan_display typo
* Add __initdata annotations * Add __initdata annotations
*
* TODO:
*
*
* Wish List:
*
*
*/ */
#include <linux/module.h> #include <linux/module.h>
...@@ -222,8 +215,8 @@ static struct pci_driver intelfb_driver = { ...@@ -222,8 +215,8 @@ static struct pci_driver intelfb_driver = {
/* Module description/parameters */ /* Module description/parameters */
MODULE_AUTHOR("David Dawes <dawes@tungstengraphics.com>, " MODULE_AUTHOR("David Dawes <dawes@tungstengraphics.com>, "
"Sylvain Meyer <sylvain.meyer@worldonline.fr>"); "Sylvain Meyer <sylvain.meyer@worldonline.fr>");
MODULE_DESCRIPTION( MODULE_DESCRIPTION("Framebuffer driver for Intel(R) " SUPPORTED_CHIPSETS
"Framebuffer driver for Intel(R) " SUPPORTED_CHIPSETS " chipsets"); " chipsets");
MODULE_LICENSE("Dual BSD/GPL"); MODULE_LICENSE("Dual BSD/GPL");
MODULE_DEVICE_TABLE(pci, intelfb_pci_table); MODULE_DEVICE_TABLE(pci, intelfb_pci_table);
...@@ -271,8 +264,7 @@ MODULE_PARM_DESC(mode, ...@@ -271,8 +264,7 @@ MODULE_PARM_DESC(mode,
#define OPT_INTVAL(opt, name) simple_strtoul(opt + strlen(name) + 1, NULL, 0) #define OPT_INTVAL(opt, name) simple_strtoul(opt + strlen(name) + 1, NULL, 0)
#define OPT_STRVAL(opt, name) (opt + strlen(name)) #define OPT_STRVAL(opt, name) (opt + strlen(name))
static __inline__ char * static __inline__ char * get_opt_string(const char *this_opt, const char *name)
get_opt_string(const char *this_opt, const char *name)
{ {
const char *p; const char *p;
int i; int i;
...@@ -290,8 +282,8 @@ get_opt_string(const char *this_opt, const char *name) ...@@ -290,8 +282,8 @@ get_opt_string(const char *this_opt, const char *name)
return ret; return ret;
} }
static __inline__ int static __inline__ int get_opt_int(const char *this_opt, const char *name,
get_opt_int(const char *this_opt, const char *name, int *ret) int *ret)
{ {
if (!ret) if (!ret)
return 0; return 0;
...@@ -303,8 +295,8 @@ get_opt_int(const char *this_opt, const char *name, int *ret) ...@@ -303,8 +295,8 @@ get_opt_int(const char *this_opt, const char *name, int *ret)
return 1; return 1;
} }
static __inline__ int static __inline__ int get_opt_bool(const char *this_opt, const char *name,
get_opt_bool(const char *this_opt, const char *name, int *ret) int *ret)
{ {
if (!ret) if (!ret)
return 0; return 0;
...@@ -324,8 +316,7 @@ get_opt_bool(const char *this_opt, const char *name, int *ret) ...@@ -324,8 +316,7 @@ get_opt_bool(const char *this_opt, const char *name, int *ret)
return 1; return 1;
} }
static int __init static int __init intelfb_setup(char *options)
intelfb_setup(char *options)
{ {
char *this_opt; char *this_opt;
...@@ -355,7 +346,7 @@ intelfb_setup(char *options) ...@@ -355,7 +346,7 @@ intelfb_setup(char *options)
continue; continue;
if (get_opt_bool(this_opt, "accel", &accel)) if (get_opt_bool(this_opt, "accel", &accel))
; ;
else if (get_opt_int(this_opt, "vram", &vram)) else if (get_opt_int(this_opt, "vram", &vram))
; ;
else if (get_opt_bool(this_opt, "hwcursor", &hwcursor)) else if (get_opt_bool(this_opt, "hwcursor", &hwcursor))
; ;
...@@ -376,8 +367,7 @@ intelfb_setup(char *options) ...@@ -376,8 +367,7 @@ intelfb_setup(char *options)
#endif #endif
static int __init static int __init intelfb_init(void)
intelfb_init(void)
{ {
#ifndef MODULE #ifndef MODULE
char *option = NULL; char *option = NULL;
...@@ -401,8 +391,7 @@ intelfb_init(void) ...@@ -401,8 +391,7 @@ intelfb_init(void)
return pci_register_driver(&intelfb_driver); return pci_register_driver(&intelfb_driver);
} }
static void __exit static void __exit intelfb_exit(void)
intelfb_exit(void)
{ {
DBG_MSG("intelfb_exit\n"); DBG_MSG("intelfb_exit\n");
pci_unregister_driver(&intelfb_driver); pci_unregister_driver(&intelfb_driver);
...@@ -428,8 +417,8 @@ static inline void __devinit set_mtrr(struct intelfb_info *dinfo) ...@@ -428,8 +417,8 @@ static inline void __devinit set_mtrr(struct intelfb_info *dinfo)
} }
static inline void unset_mtrr(struct intelfb_info *dinfo) static inline void unset_mtrr(struct intelfb_info *dinfo)
{ {
if (dinfo->has_mtrr) if (dinfo->has_mtrr)
mtrr_del(dinfo->mtrr_reg, dinfo->aperture.physical, mtrr_del(dinfo->mtrr_reg, dinfo->aperture.physical,
dinfo->aperture.size); dinfo->aperture.size);
} }
#else #else
...@@ -442,8 +431,7 @@ static inline void unset_mtrr(struct intelfb_info *dinfo) ...@@ -442,8 +431,7 @@ static inline void unset_mtrr(struct intelfb_info *dinfo)
* driver init / cleanup * * driver init / cleanup *
***************************************************************/ ***************************************************************/
static void static void cleanup(struct intelfb_info *dinfo)
cleanup(struct intelfb_info *dinfo)
{ {
DBG_MSG("cleanup\n"); DBG_MSG("cleanup\n");
...@@ -499,8 +487,8 @@ cleanup(struct intelfb_info *dinfo) ...@@ -499,8 +487,8 @@ cleanup(struct intelfb_info *dinfo)
} while (0) } while (0)
static int __devinit static int __devinit intelfb_pci_register(struct pci_dev *pdev,
intelfb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent) const struct pci_device_id *ent)
{ {
struct fb_info *info; struct fb_info *info;
struct intelfb_info *dinfo; struct intelfb_info *dinfo;
...@@ -510,8 +498,8 @@ intelfb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -510,8 +498,8 @@ intelfb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent)
int agp_memtype; int agp_memtype;
const char *s; const char *s;
struct agp_bridge_data *bridge; struct agp_bridge_data *bridge;
int aperture_bar = 0; int aperture_bar = 0;
int mmio_bar = 1; int mmio_bar = 1;
int offset; int offset;
DBG_MSG("intelfb_pci_register\n"); DBG_MSG("intelfb_pci_register\n");
...@@ -637,9 +625,8 @@ intelfb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -637,9 +625,8 @@ intelfb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent)
dinfo->ring.size = RINGBUFFER_SIZE; dinfo->ring.size = RINGBUFFER_SIZE;
dinfo->ring_tail_mask = dinfo->ring.size - 1; dinfo->ring_tail_mask = dinfo->ring.size - 1;
} }
if (dinfo->hwcursor) { if (dinfo->hwcursor)
dinfo->cursor.size = HW_CURSOR_SIZE; dinfo->cursor.size = HW_CURSOR_SIZE;
}
/* Use agpgart to manage the GATT */ /* Use agpgart to manage the GATT */
if (!(bridge = agp_backend_acquire(pdev))) { if (!(bridge = agp_backend_acquire(pdev))) {
...@@ -662,18 +649,15 @@ intelfb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -662,18 +649,15 @@ intelfb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent)
offset = ROUND_UP_TO_PAGE(MB(voffset))/GTT_PAGE_SIZE; offset = ROUND_UP_TO_PAGE(MB(voffset))/GTT_PAGE_SIZE;
/* set the mem offsets - set them after the already used pages */ /* set the mem offsets - set them after the already used pages */
if (dinfo->accel) { if (dinfo->accel)
dinfo->ring.offset = offset + gtt_info.current_memory; dinfo->ring.offset = offset + gtt_info.current_memory;
} if (dinfo->hwcursor)
if (dinfo->hwcursor) {
dinfo->cursor.offset = offset + dinfo->cursor.offset = offset +
+ gtt_info.current_memory + (dinfo->ring.size >> 12); + gtt_info.current_memory + (dinfo->ring.size >> 12);
} if (dinfo->fbmem_gart)
if (dinfo->fbmem_gart) {
dinfo->fb.offset = offset + dinfo->fb.offset = offset +
+ gtt_info.current_memory + (dinfo->ring.size >> 12) + gtt_info.current_memory + (dinfo->ring.size >> 12)
+ (dinfo->cursor.size >> 12); + (dinfo->cursor.size >> 12);
}
/* Allocate memories (which aren't stolen) */ /* Allocate memories (which aren't stolen) */
/* Map the fb and MMIO regions */ /* Map the fb and MMIO regions */
...@@ -689,7 +673,7 @@ intelfb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -689,7 +673,7 @@ intelfb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent)
dinfo->mmio_base = dinfo->mmio_base =
(u8 __iomem *)ioremap_nocache(dinfo->mmio_base_phys, (u8 __iomem *)ioremap_nocache(dinfo->mmio_base_phys,
INTEL_REG_SIZE); INTEL_REG_SIZE);
if (!dinfo->mmio_base) { if (!dinfo->mmio_base) {
ERR_MSG("Cannot remap MMIO region.\n"); ERR_MSG("Cannot remap MMIO region.\n");
cleanup(dinfo); cleanup(dinfo);
...@@ -837,10 +821,8 @@ intelfb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -837,10 +821,8 @@ intelfb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent)
if (bailearly == 3) if (bailearly == 3)
bailout(dinfo); bailout(dinfo);
if (FIXED_MODE(dinfo)) { if (FIXED_MODE(dinfo)) /* remap fb address */
/* remap fb address */
update_dinfo(dinfo, &dinfo->initial_var); update_dinfo(dinfo, &dinfo->initial_var);
}
if (bailearly == 4) if (bailearly == 4)
bailout(dinfo); bailout(dinfo);
...@@ -939,8 +921,7 @@ intelfb_pci_unregister(struct pci_dev *pdev) ...@@ -939,8 +921,7 @@ intelfb_pci_unregister(struct pci_dev *pdev)
* helper functions * * helper functions *
***************************************************************/ ***************************************************************/
int __inline__ int __inline__ intelfb_var_to_depth(const struct fb_var_screeninfo *var)
intelfb_var_to_depth(const struct fb_var_screeninfo *var)
{ {
DBG_MSG("intelfb_var_to_depth: bpp: %d, green.length is %d\n", DBG_MSG("intelfb_var_to_depth: bpp: %d, green.length is %d\n",
var->bits_per_pixel, var->green.length); var->bits_per_pixel, var->green.length);
...@@ -956,8 +937,7 @@ intelfb_var_to_depth(const struct fb_var_screeninfo *var) ...@@ -956,8 +937,7 @@ intelfb_var_to_depth(const struct fb_var_screeninfo *var)
} }
static __inline__ int static __inline__ int var_to_refresh(const struct fb_var_screeninfo *var)
var_to_refresh(const struct fb_var_screeninfo *var)
{ {
int xtot = var->xres + var->left_margin + var->right_margin + int xtot = var->xres + var->left_margin + var->right_margin +
var->hsync_len; var->hsync_len;
...@@ -971,8 +951,7 @@ var_to_refresh(const struct fb_var_screeninfo *var) ...@@ -971,8 +951,7 @@ var_to_refresh(const struct fb_var_screeninfo *var)
* Various intialisation functions * * Various intialisation functions *
***************************************************************/ ***************************************************************/
static void __devinit static void __devinit get_initial_mode(struct intelfb_info *dinfo)
get_initial_mode(struct intelfb_info *dinfo)
{ {
struct fb_var_screeninfo *var; struct fb_var_screeninfo *var;
int xtot, ytot; int xtot, ytot;
...@@ -1039,8 +1018,7 @@ get_initial_mode(struct intelfb_info *dinfo) ...@@ -1039,8 +1018,7 @@ get_initial_mode(struct intelfb_info *dinfo)
} }
} }
static int __devinit static int __devinit intelfb_init_var(struct intelfb_info *dinfo)
intelfb_init_var(struct intelfb_info *dinfo)
{ {
struct fb_var_screeninfo *var; struct fb_var_screeninfo *var;
int msrc = 0; int msrc = 0;
...@@ -1087,10 +1065,9 @@ intelfb_init_var(struct intelfb_info *dinfo) ...@@ -1087,10 +1065,9 @@ intelfb_init_var(struct intelfb_info *dinfo)
} }
if (!msrc) { if (!msrc)
msrc = fb_find_mode(var, dinfo->info, PREFERRED_MODE, msrc = fb_find_mode(var, dinfo->info, PREFERRED_MODE,
NULL, 0, NULL, 0); NULL, 0, NULL, 0);
}
} }
if (!msrc) { if (!msrc) {
...@@ -1122,8 +1099,7 @@ intelfb_init_var(struct intelfb_info *dinfo) ...@@ -1122,8 +1099,7 @@ intelfb_init_var(struct intelfb_info *dinfo)
return 0; return 0;
} }
static int __devinit static int __devinit intelfb_set_fbinfo(struct intelfb_info *dinfo)
intelfb_set_fbinfo(struct intelfb_info *dinfo)
{ {
struct fb_info *info = dinfo->info; struct fb_info *info = dinfo->info;
...@@ -1159,8 +1135,8 @@ intelfb_set_fbinfo(struct intelfb_info *dinfo) ...@@ -1159,8 +1135,8 @@ intelfb_set_fbinfo(struct intelfb_info *dinfo)
} }
/* Update dinfo to match the active video mode. */ /* Update dinfo to match the active video mode. */
static void static void update_dinfo(struct intelfb_info *dinfo,
update_dinfo(struct intelfb_info *dinfo, struct fb_var_screeninfo *var) struct fb_var_screeninfo *var)
{ {
DBG_MSG("update_dinfo\n"); DBG_MSG("update_dinfo\n");
...@@ -1208,36 +1184,32 @@ update_dinfo(struct intelfb_info *dinfo, struct fb_var_screeninfo *var) ...@@ -1208,36 +1184,32 @@ update_dinfo(struct intelfb_info *dinfo, struct fb_var_screeninfo *var)
* fbdev interface * * fbdev interface *
***************************************************************/ ***************************************************************/
static int static int intelfb_open(struct fb_info *info, int user)
intelfb_open(struct fb_info *info, int user)
{ {
struct intelfb_info *dinfo = GET_DINFO(info); struct intelfb_info *dinfo = GET_DINFO(info);
if (user) { if (user)
dinfo->open++; dinfo->open++;
}
return 0; return 0;
} }
static int static int intelfb_release(struct fb_info *info, int user)
intelfb_release(struct fb_info *info, int user)
{ {
struct intelfb_info *dinfo = GET_DINFO(info); struct intelfb_info *dinfo = GET_DINFO(info);
if (user) { if (user) {
dinfo->open--; dinfo->open--;
msleep(1); msleep(1);
if (!dinfo->open) { if (!dinfo->open)
intelfbhw_disable_irq(dinfo); intelfbhw_disable_irq(dinfo);
}
} }
return 0; return 0;
} }
static int static int intelfb_check_var(struct fb_var_screeninfo *var,
intelfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) struct fb_info *info)
{ {
int change_var = 0; int change_var = 0;
struct fb_var_screeninfo v; struct fb_var_screeninfo v;
...@@ -1271,15 +1243,15 @@ intelfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) ...@@ -1271,15 +1243,15 @@ intelfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
} }
/* Check for a supported bpp. */ /* Check for a supported bpp. */
if (v.bits_per_pixel <= 8) { if (v.bits_per_pixel <= 8)
v.bits_per_pixel = 8; v.bits_per_pixel = 8;
} else if (v.bits_per_pixel <= 16) { else if (v.bits_per_pixel <= 16) {
if (v.bits_per_pixel == 16) if (v.bits_per_pixel == 16)
v.green.length = 6; v.green.length = 6;
v.bits_per_pixel = 16; v.bits_per_pixel = 16;
} else if (v.bits_per_pixel <= 32) { } else if (v.bits_per_pixel <= 32)
v.bits_per_pixel = 32; v.bits_per_pixel = 32;
} else else
return -EINVAL; return -EINVAL;
change_var = ((info->var.xres != var->xres) || change_var = ((info->var.xres != var->xres) ||
...@@ -1361,10 +1333,9 @@ intelfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) ...@@ -1361,10 +1333,9 @@ intelfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
return 0; return 0;
} }
static int static int intelfb_set_par(struct fb_info *info)
intelfb_set_par(struct fb_info *info)
{ {
struct intelfb_hwstate *hw; struct intelfb_hwstate *hw;
struct intelfb_info *dinfo = GET_DINFO(info); struct intelfb_info *dinfo = GET_DINFO(info);
if (FIXED_MODE(dinfo)) { if (FIXED_MODE(dinfo)) {
...@@ -1372,9 +1343,9 @@ intelfb_set_par(struct fb_info *info) ...@@ -1372,9 +1343,9 @@ intelfb_set_par(struct fb_info *info)
return -EINVAL; return -EINVAL;
} }
hw = kmalloc(sizeof(*hw), GFP_ATOMIC); hw = kmalloc(sizeof(*hw), GFP_ATOMIC);
if (!hw) if (!hw)
return -ENOMEM; return -ENOMEM;
DBG_MSG("intelfb_set_par (%dx%d-%d)\n", info->var.xres, DBG_MSG("intelfb_set_par (%dx%d-%d)\n", info->var.xres,
info->var.yres, info->var.bits_per_pixel); info->var.yres, info->var.bits_per_pixel);
...@@ -1384,15 +1355,15 @@ intelfb_set_par(struct fb_info *info) ...@@ -1384,15 +1355,15 @@ intelfb_set_par(struct fb_info *info)
if (ACCEL(dinfo, info)) if (ACCEL(dinfo, info))
intelfbhw_2d_stop(dinfo); intelfbhw_2d_stop(dinfo);
memcpy(hw, &dinfo->save_state, sizeof(*hw)); memcpy(hw, &dinfo->save_state, sizeof(*hw));
if (intelfbhw_mode_to_hw(dinfo, hw, &info->var)) if (intelfbhw_mode_to_hw(dinfo, hw, &info->var))
goto invalid_mode; goto invalid_mode;
if (intelfbhw_program_mode(dinfo, hw, 0)) if (intelfbhw_program_mode(dinfo, hw, 0))
goto invalid_mode; goto invalid_mode;
#if REGDUMP > 0 #if REGDUMP > 0
intelfbhw_read_hw_state(dinfo, hw, 0); intelfbhw_read_hw_state(dinfo, hw, 0);
intelfbhw_print_hw_state(dinfo, hw); intelfbhw_print_hw_state(dinfo, hw);
#endif #endif
update_dinfo(dinfo, &info->var); update_dinfo(dinfo, &info->var);
...@@ -1408,9 +1379,9 @@ intelfb_set_par(struct fb_info *info) ...@@ -1408,9 +1379,9 @@ intelfb_set_par(struct fb_info *info)
info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN | info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN |
FBINFO_HWACCEL_COPYAREA | FBINFO_HWACCEL_FILLRECT | FBINFO_HWACCEL_COPYAREA | FBINFO_HWACCEL_FILLRECT |
FBINFO_HWACCEL_IMAGEBLIT; FBINFO_HWACCEL_IMAGEBLIT;
} else { } else
info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN; info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN;
}
kfree(hw); kfree(hw);
return 0; return 0;
invalid_mode: invalid_mode:
...@@ -1418,9 +1389,9 @@ intelfb_set_par(struct fb_info *info) ...@@ -1418,9 +1389,9 @@ intelfb_set_par(struct fb_info *info)
return -EINVAL; return -EINVAL;
} }
static int static int intelfb_setcolreg(unsigned regno, unsigned red, unsigned green,
intelfb_setcolreg(unsigned regno, unsigned red, unsigned green, unsigned blue, unsigned transp,
unsigned blue, unsigned transp, struct fb_info *info) struct fb_info *info)
{ {
struct intelfb_info *dinfo = GET_DINFO(info); struct intelfb_info *dinfo = GET_DINFO(info);
...@@ -1463,23 +1434,22 @@ intelfb_setcolreg(unsigned regno, unsigned red, unsigned green, ...@@ -1463,23 +1434,22 @@ intelfb_setcolreg(unsigned regno, unsigned red, unsigned green,
return 0; return 0;
} }
static int static int intelfb_blank(int blank, struct fb_info *info)
intelfb_blank(int blank, struct fb_info *info)
{ {
intelfbhw_do_blank(blank, info); intelfbhw_do_blank(blank, info);
return 0; return 0;
} }
static int static int intelfb_pan_display(struct fb_var_screeninfo *var,
intelfb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info) struct fb_info *info)
{ {
intelfbhw_pan_display(var, info); intelfbhw_pan_display(var, info);
return 0; return 0;
} }
/* When/if we have our own ioctls. */ /* When/if we have our own ioctls. */
static int static int intelfb_ioctl(struct fb_info *info, unsigned int cmd,
intelfb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg) unsigned long arg)
{ {
int retval = 0; int retval = 0;
struct intelfb_info *dinfo = GET_DINFO(info); struct intelfb_info *dinfo = GET_DINFO(info);
...@@ -1499,8 +1469,8 @@ intelfb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg) ...@@ -1499,8 +1469,8 @@ intelfb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg)
return retval; return retval;
} }
static void static void intelfb_fillrect (struct fb_info *info,
intelfb_fillrect (struct fb_info *info, const struct fb_fillrect *rect) const struct fb_fillrect *rect)
{ {
struct intelfb_info *dinfo = GET_DINFO(info); struct intelfb_info *dinfo = GET_DINFO(info);
u32 rop, color; u32 rop, color;
...@@ -1514,7 +1484,7 @@ intelfb_fillrect (struct fb_info *info, const struct fb_fillrect *rect) ...@@ -1514,7 +1484,7 @@ intelfb_fillrect (struct fb_info *info, const struct fb_fillrect *rect)
if (rect->rop == ROP_COPY) if (rect->rop == ROP_COPY)
rop = PAT_ROP_GXCOPY; rop = PAT_ROP_GXCOPY;
else // ROP_XOR else /* ROP_XOR */
rop = PAT_ROP_GXXOR; rop = PAT_ROP_GXXOR;
if (dinfo->depth != 8) if (dinfo->depth != 8)
...@@ -1528,8 +1498,8 @@ intelfb_fillrect (struct fb_info *info, const struct fb_fillrect *rect) ...@@ -1528,8 +1498,8 @@ intelfb_fillrect (struct fb_info *info, const struct fb_fillrect *rect)
rop); rop);
} }
static void static void intelfb_copyarea(struct fb_info *info,
intelfb_copyarea(struct fb_info *info, const struct fb_copyarea *region) const struct fb_copyarea *region)
{ {
struct intelfb_info *dinfo = GET_DINFO(info); struct intelfb_info *dinfo = GET_DINFO(info);
...@@ -1545,8 +1515,8 @@ intelfb_copyarea(struct fb_info *info, const struct fb_copyarea *region) ...@@ -1545,8 +1515,8 @@ intelfb_copyarea(struct fb_info *info, const struct fb_copyarea *region)
dinfo->pitch, info->var.bits_per_pixel); dinfo->pitch, info->var.bits_per_pixel);
} }
static void static void intelfb_imageblit(struct fb_info *info,
intelfb_imageblit(struct fb_info *info, const struct fb_image *image) const struct fb_image *image)
{ {
struct intelfb_info *dinfo = GET_DINFO(info); struct intelfb_info *dinfo = GET_DINFO(info);
u32 fgcolor, bgcolor; u32 fgcolor, bgcolor;
...@@ -1574,8 +1544,7 @@ intelfb_imageblit(struct fb_info *info, const struct fb_image *image) ...@@ -1574,8 +1544,7 @@ intelfb_imageblit(struct fb_info *info, const struct fb_image *image)
return cfb_imageblit(info, image); return cfb_imageblit(info, image);
} }
static int static int intelfb_cursor(struct fb_info *info, struct fb_cursor *cursor)
intelfb_cursor(struct fb_info *info, struct fb_cursor *cursor)
{ {
struct intelfb_info *dinfo = GET_DINFO(info); struct intelfb_info *dinfo = GET_DINFO(info);
u32 physical; u32 physical;
...@@ -1689,8 +1658,7 @@ intelfb_cursor(struct fb_info *info, struct fb_cursor *cursor) ...@@ -1689,8 +1658,7 @@ intelfb_cursor(struct fb_info *info, struct fb_cursor *cursor)
return 0; return 0;
} }
static int static int intelfb_sync(struct fb_info *info)
intelfb_sync(struct fb_info *info)
{ {
struct intelfb_info *dinfo = GET_DINFO(info); struct intelfb_info *dinfo = GET_DINFO(info);
......
...@@ -56,17 +56,16 @@ static struct pll_min_max plls[PLLS_MAX] = { ...@@ -56,17 +56,16 @@ static struct pll_min_max plls[PLLS_MAX] = {
6, 16, 3, 16, 6, 16, 3, 16,
4, 128, 0, 31, 4, 128, 0, 31,
930000, 1400000, 165000, 48000, 930000, 1400000, 165000, 48000,
4, 2 }, //I8xx 4, 2 }, /* I8xx */
{ 75, 120, 10, 20, { 75, 120, 10, 20,
5, 9, 4, 7, 5, 9, 4, 7,
5, 80, 1, 8, 5, 80, 1, 8,
1400000, 2800000, 200000, 96000, 1400000, 2800000, 200000, 96000,
10, 5 } //I9xx 10, 5 } /* I9xx */
}; };
int int intelfbhw_get_chipset(struct pci_dev *pdev, struct intelfb_info *dinfo)
intelfbhw_get_chipset(struct pci_dev *pdev, struct intelfb_info *dinfo)
{ {
u32 tmp; u32 tmp;
if (!pdev || !dinfo) if (!pdev || !dinfo)
...@@ -149,9 +148,8 @@ intelfbhw_get_chipset(struct pci_dev *pdev, struct intelfb_info *dinfo) ...@@ -149,9 +148,8 @@ intelfbhw_get_chipset(struct pci_dev *pdev, struct intelfb_info *dinfo)
} }
} }
int int intelfbhw_get_memory(struct pci_dev *pdev, int *aperture_size,
intelfbhw_get_memory(struct pci_dev *pdev, int *aperture_size, int *stolen_size)
int *stolen_size)
{ {
struct pci_dev *bridge_dev; struct pci_dev *bridge_dev;
u16 tmp; u16 tmp;
...@@ -254,8 +252,7 @@ intelfbhw_get_memory(struct pci_dev *pdev, int *aperture_size, ...@@ -254,8 +252,7 @@ intelfbhw_get_memory(struct pci_dev *pdev, int *aperture_size,
} }
} }
int int intelfbhw_check_non_crt(struct intelfb_info *dinfo)
intelfbhw_check_non_crt(struct intelfb_info *dinfo)
{ {
int dvo = 0; int dvo = 0;
...@@ -271,8 +268,7 @@ intelfbhw_check_non_crt(struct intelfb_info *dinfo) ...@@ -271,8 +268,7 @@ intelfbhw_check_non_crt(struct intelfb_info *dinfo)
return dvo; return dvo;
} }
const char * const char * intelfbhw_dvo_to_string(int dvo)
intelfbhw_dvo_to_string(int dvo)
{ {
if (dvo & DVOA_PORT) if (dvo & DVOA_PORT)
return "DVO port A"; return "DVO port A";
...@@ -287,9 +283,8 @@ intelfbhw_dvo_to_string(int dvo) ...@@ -287,9 +283,8 @@ intelfbhw_dvo_to_string(int dvo)
} }
int int intelfbhw_validate_mode(struct intelfb_info *dinfo,
intelfbhw_validate_mode(struct intelfb_info *dinfo, struct fb_var_screeninfo *var)
struct fb_var_screeninfo *var)
{ {
int bytes_per_pixel; int bytes_per_pixel;
int tmp; int tmp;
...@@ -345,8 +340,7 @@ intelfbhw_validate_mode(struct intelfb_info *dinfo, ...@@ -345,8 +340,7 @@ intelfbhw_validate_mode(struct intelfb_info *dinfo,
return 0; return 0;
} }
int int intelfbhw_pan_display(struct fb_var_screeninfo *var, struct fb_info *info)
intelfbhw_pan_display(struct fb_var_screeninfo *var, struct fb_info *info)
{ {
struct intelfb_info *dinfo = GET_DINFO(info); struct intelfb_info *dinfo = GET_DINFO(info);
u32 offset, xoffset, yoffset; u32 offset, xoffset, yoffset;
...@@ -368,9 +362,10 @@ intelfbhw_pan_display(struct fb_var_screeninfo *var, struct fb_info *info) ...@@ -368,9 +362,10 @@ intelfbhw_pan_display(struct fb_var_screeninfo *var, struct fb_info *info)
offset += dinfo->fb.offset << 12; offset += dinfo->fb.offset << 12;
dinfo->vsync.pan_offset = offset; dinfo->vsync.pan_offset = offset;
if ((var->activate & FB_ACTIVATE_VBL) && !intelfbhw_enable_irq(dinfo, 0)) { if ((var->activate & FB_ACTIVATE_VBL) &&
!intelfbhw_enable_irq(dinfo, 0))
dinfo->vsync.pan_display = 1; dinfo->vsync.pan_display = 1;
} else { else {
dinfo->vsync.pan_display = 0; dinfo->vsync.pan_display = 0;
OUTREG(DSPABASE, offset); OUTREG(DSPABASE, offset);
} }
...@@ -379,8 +374,7 @@ intelfbhw_pan_display(struct fb_var_screeninfo *var, struct fb_info *info) ...@@ -379,8 +374,7 @@ intelfbhw_pan_display(struct fb_var_screeninfo *var, struct fb_info *info)
} }
/* Blank the screen. */ /* Blank the screen. */
void void intelfbhw_do_blank(int blank, struct fb_info *info)
intelfbhw_do_blank(int blank, struct fb_info *info)
{ {
struct intelfb_info *dinfo = GET_DINFO(info); struct intelfb_info *dinfo = GET_DINFO(info);
u32 tmp; u32 tmp;
...@@ -405,11 +399,10 @@ intelfbhw_do_blank(int blank, struct fb_info *info) ...@@ -405,11 +399,10 @@ intelfbhw_do_blank(int blank, struct fb_info *info)
DBG_MSG("cursor_on is %d\n", dinfo->cursor_on); DBG_MSG("cursor_on is %d\n", dinfo->cursor_on);
#endif #endif
if (dinfo->cursor_on) { if (dinfo->cursor_on) {
if (blank) { if (blank)
intelfbhw_cursor_hide(dinfo); intelfbhw_cursor_hide(dinfo);
} else { else
intelfbhw_cursor_show(dinfo); intelfbhw_cursor_show(dinfo);
}
dinfo->cursor_on = 1; dinfo->cursor_on = 1;
} }
dinfo->cursor_blanked = blank; dinfo->cursor_blanked = blank;
...@@ -437,10 +430,9 @@ intelfbhw_do_blank(int blank, struct fb_info *info) ...@@ -437,10 +430,9 @@ intelfbhw_do_blank(int blank, struct fb_info *info)
} }
void void intelfbhw_setcolreg(struct intelfb_info *dinfo, unsigned regno,
intelfbhw_setcolreg(struct intelfb_info *dinfo, unsigned regno, unsigned red, unsigned green, unsigned blue,
unsigned red, unsigned green, unsigned blue, unsigned transp)
unsigned transp)
{ {
#if VERBOSE > 0 #if VERBOSE > 0
DBG_MSG("intelfbhw_setcolreg: %d: (%d, %d, %d)\n", DBG_MSG("intelfbhw_setcolreg: %d: (%d, %d, %d)\n",
...@@ -457,9 +449,8 @@ intelfbhw_setcolreg(struct intelfb_info *dinfo, unsigned regno, ...@@ -457,9 +449,8 @@ intelfbhw_setcolreg(struct intelfb_info *dinfo, unsigned regno,
} }
int int intelfbhw_read_hw_state(struct intelfb_info *dinfo,
intelfbhw_read_hw_state(struct intelfb_info *dinfo, struct intelfb_hwstate *hw, struct intelfb_hwstate *hw, int flag)
int flag)
{ {
int i; int i;
...@@ -606,7 +597,8 @@ static int calc_vclock3(int index, int m, int n, int p) ...@@ -606,7 +597,8 @@ static int calc_vclock3(int index, int m, int n, int p)
return plls[index].ref_clk * m / n / p; return plls[index].ref_clk * m / n / p;
} }
static int calc_vclock(int index, int m1, int m2, int n, int p1, int p2, int lvds) static int calc_vclock(int index, int m1, int m2, int n, int p1, int p2,
int lvds)
{ {
struct pll_min_max *pll = &plls[index]; struct pll_min_max *pll = &plls[index];
u32 m, vco, p; u32 m, vco, p;
...@@ -615,17 +607,16 @@ static int calc_vclock(int index, int m1, int m2, int n, int p1, int p2, int lvd ...@@ -615,17 +607,16 @@ static int calc_vclock(int index, int m1, int m2, int n, int p1, int p2, int lvd
n += 2; n += 2;
vco = pll->ref_clk * m / n; vco = pll->ref_clk * m / n;
if (index == PLLS_I8xx) { if (index == PLLS_I8xx)
p = ((p1 + 2) * (1 << (p2 + 1))); p = ((p1 + 2) * (1 << (p2 + 1)));
} else { else
p = ((p1) * (p2 ? 5 : 10)); p = ((p1) * (p2 ? 5 : 10));
}
return vco / p; return vco / p;
} }
#if REGDUMP #if REGDUMP
static void static void intelfbhw_get_p1p2(struct intelfb_info *dinfo, int dpll,
intelfbhw_get_p1p2(struct intelfb_info *dinfo, int dpll, int *o_p1, int *o_p2) int *o_p1, int *o_p2)
{ {
int p1, p2; int p1, p2;
...@@ -634,7 +625,7 @@ intelfbhw_get_p1p2(struct intelfb_info *dinfo, int dpll, int *o_p1, int *o_p2) ...@@ -634,7 +625,7 @@ intelfbhw_get_p1p2(struct intelfb_info *dinfo, int dpll, int *o_p1, int *o_p2)
p1 = 1; p1 = 1;
else else
p1 = (dpll >> DPLL_P1_SHIFT) & 0xff; p1 = (dpll >> DPLL_P1_SHIFT) & 0xff;
p1 = ffs(p1); p1 = ffs(p1);
p2 = (dpll >> DPLL_I9XX_P2_SHIFT) & DPLL_P2_MASK; p2 = (dpll >> DPLL_I9XX_P2_SHIFT) & DPLL_P2_MASK;
...@@ -652,8 +643,8 @@ intelfbhw_get_p1p2(struct intelfb_info *dinfo, int dpll, int *o_p1, int *o_p2) ...@@ -652,8 +643,8 @@ intelfbhw_get_p1p2(struct intelfb_info *dinfo, int dpll, int *o_p1, int *o_p2)
#endif #endif
void void intelfbhw_print_hw_state(struct intelfb_info *dinfo,
intelfbhw_print_hw_state(struct intelfb_info *dinfo, struct intelfb_hwstate *hw) struct intelfb_hwstate *hw)
{ {
#if REGDUMP #if REGDUMP
int i, m1, m2, n, p1, p2; int i, m1, m2, n, p1, p2;
...@@ -666,7 +657,7 @@ intelfbhw_print_hw_state(struct intelfb_info *dinfo, struct intelfb_hwstate *hw) ...@@ -666,7 +657,7 @@ intelfbhw_print_hw_state(struct intelfb_info *dinfo, struct intelfb_hwstate *hw)
printk("hw state dump start\n"); printk("hw state dump start\n");
printk(" VGA0_DIVISOR: 0x%08x\n", hw->vga0_divisor); printk(" VGA0_DIVISOR: 0x%08x\n", hw->vga0_divisor);
printk(" VGA1_DIVISOR: 0x%08x\n", hw->vga1_divisor); printk(" VGA1_DIVISOR: 0x%08x\n", hw->vga1_divisor);
printk(" VGAPD: 0x%08x\n", hw->vga_pd); printk(" VGAPD: 0x%08x\n", hw->vga_pd);
n = (hw->vga0_divisor >> FP_N_DIVISOR_SHIFT) & FP_DIVISOR_MASK; n = (hw->vga0_divisor >> FP_N_DIVISOR_SHIFT) & FP_DIVISOR_MASK;
m1 = (hw->vga0_divisor >> FP_M1_DIVISOR_SHIFT) & FP_DIVISOR_MASK; m1 = (hw->vga0_divisor >> FP_M1_DIVISOR_SHIFT) & FP_DIVISOR_MASK;
m2 = (hw->vga0_divisor >> FP_M2_DIVISOR_SHIFT) & FP_DIVISOR_MASK; m2 = (hw->vga0_divisor >> FP_M2_DIVISOR_SHIFT) & FP_DIVISOR_MASK;
...@@ -685,7 +676,8 @@ intelfbhw_print_hw_state(struct intelfb_info *dinfo, struct intelfb_hwstate *hw) ...@@ -685,7 +676,8 @@ intelfbhw_print_hw_state(struct intelfb_info *dinfo, struct intelfb_hwstate *hw)
intelfbhw_get_p1p2(dinfo, hw->vga_pd, &p1, &p2); intelfbhw_get_p1p2(dinfo, hw->vga_pd, &p1, &p2);
printk(" VGA1: (m1, m2, n, p1, p2) = (%d, %d, %d, %d, %d)\n", printk(" VGA1: (m1, m2, n, p1, p2) = (%d, %d, %d, %d, %d)\n",
m1, m2, n, p1, p2); m1, m2, n, p1, p2);
printk(" VGA1: clock is %d\n", calc_vclock(index, m1, m2, n, p1, p2, 0)); printk(" VGA1: clock is %d\n",
calc_vclock(index, m1, m2, n, p1, p2, 0));
printk(" DPLL_A: 0x%08x\n", hw->dpll_a); printk(" DPLL_A: 0x%08x\n", hw->dpll_a);
printk(" DPLL_B: 0x%08x\n", hw->dpll_b); printk(" DPLL_B: 0x%08x\n", hw->dpll_b);
...@@ -702,7 +694,8 @@ intelfbhw_print_hw_state(struct intelfb_info *dinfo, struct intelfb_hwstate *hw) ...@@ -702,7 +694,8 @@ intelfbhw_print_hw_state(struct intelfb_info *dinfo, struct intelfb_hwstate *hw)
printk(" PLLA0: (m1, m2, n, p1, p2) = (%d, %d, %d, %d, %d)\n", printk(" PLLA0: (m1, m2, n, p1, p2) = (%d, %d, %d, %d, %d)\n",
m1, m2, n, p1, p2); m1, m2, n, p1, p2);
printk(" PLLA0: clock is %d\n", calc_vclock(index, m1, m2, n, p1, p2, 0)); printk(" PLLA0: clock is %d\n",
calc_vclock(index, m1, m2, n, p1, p2, 0));
n = (hw->fpa1 >> FP_N_DIVISOR_SHIFT) & FP_DIVISOR_MASK; n = (hw->fpa1 >> FP_N_DIVISOR_SHIFT) & FP_DIVISOR_MASK;
m1 = (hw->fpa1 >> FP_M1_DIVISOR_SHIFT) & FP_DIVISOR_MASK; m1 = (hw->fpa1 >> FP_M1_DIVISOR_SHIFT) & FP_DIVISOR_MASK;
...@@ -712,7 +705,8 @@ intelfbhw_print_hw_state(struct intelfb_info *dinfo, struct intelfb_hwstate *hw) ...@@ -712,7 +705,8 @@ intelfbhw_print_hw_state(struct intelfb_info *dinfo, struct intelfb_hwstate *hw)
printk(" PLLA1: (m1, m2, n, p1, p2) = (%d, %d, %d, %d, %d)\n", printk(" PLLA1: (m1, m2, n, p1, p2) = (%d, %d, %d, %d, %d)\n",
m1, m2, n, p1, p2); m1, m2, n, p1, p2);
printk(" PLLA1: clock is %d\n", calc_vclock(index, m1, m2, n, p1, p2, 0)); printk(" PLLA1: clock is %d\n",
calc_vclock(index, m1, m2, n, p1, p2, 0));
#if 0 #if 0
printk(" PALETTE_A:\n"); printk(" PALETTE_A:\n");
...@@ -817,8 +811,8 @@ intelfbhw_print_hw_state(struct intelfb_info *dinfo, struct intelfb_hwstate *hw) ...@@ -817,8 +811,8 @@ intelfbhw_print_hw_state(struct intelfb_info *dinfo, struct intelfb_hwstate *hw)
/* Split the M parameter into M1 and M2. */ /* Split the M parameter into M1 and M2. */
static int static int splitm(int index, unsigned int m, unsigned int *retm1,
splitm(int index, unsigned int m, unsigned int *retm1, unsigned int *retm2) unsigned int *retm2)
{ {
int m1, m2; int m1, m2;
int testm; int testm;
...@@ -839,8 +833,8 @@ splitm(int index, unsigned int m, unsigned int *retm1, unsigned int *retm2) ...@@ -839,8 +833,8 @@ splitm(int index, unsigned int m, unsigned int *retm1, unsigned int *retm2)
} }
/* Split the P parameter into P1 and P2. */ /* Split the P parameter into P1 and P2. */
static int static int splitp(int index, unsigned int p, unsigned int *retp1,
splitp(int index, unsigned int p, unsigned int *retp1, unsigned int *retp2) unsigned int *retp2)
{ {
int p1, p2; int p1, p2;
struct pll_min_max *pll = &plls[index]; struct pll_min_max *pll = &plls[index];
...@@ -874,9 +868,8 @@ splitp(int index, unsigned int p, unsigned int *retp1, unsigned int *retp2) ...@@ -874,9 +868,8 @@ splitp(int index, unsigned int p, unsigned int *retp1, unsigned int *retp2)
} }
} }
static int static int calc_pll_params(int index, int clock, u32 *retm1, u32 *retm2,
calc_pll_params(int index, int clock, u32 *retm1, u32 *retm2, u32 *retn, u32 *retp1, u32 *retn, u32 *retp1, u32 *retp2, u32 *retclock)
u32 *retp2, u32 *retclock)
{ {
u32 m1, m2, n, p1, p2, n1, testm; u32 m1, m2, n, p1, p2, n1, testm;
u32 f_vco, p, p_best = 0, m, f_out = 0; u32 f_vco, p, p_best = 0, m, f_out = 0;
...@@ -971,8 +964,8 @@ calc_pll_params(int index, int clock, u32 *retm1, u32 *retm2, u32 *retn, u32 *re ...@@ -971,8 +964,8 @@ calc_pll_params(int index, int clock, u32 *retm1, u32 *retm2, u32 *retn, u32 *re
return 0; return 0;
} }
static __inline__ int static __inline__ int check_overflow(u32 value, u32 limit,
check_overflow(u32 value, u32 limit, const char *description) const char *description)
{ {
if (value > limit) { if (value > limit) {
WRN_MSG("%s value %d exceeds limit %d\n", WRN_MSG("%s value %d exceeds limit %d\n",
...@@ -983,9 +976,9 @@ check_overflow(u32 value, u32 limit, const char *description) ...@@ -983,9 +976,9 @@ check_overflow(u32 value, u32 limit, const char *description)
} }
/* It is assumed that hw is filled in with the initial state information. */ /* It is assumed that hw is filled in with the initial state information. */
int int intelfbhw_mode_to_hw(struct intelfb_info *dinfo,
intelfbhw_mode_to_hw(struct intelfb_info *dinfo, struct intelfb_hwstate *hw, struct intelfb_hwstate *hw,
struct fb_var_screeninfo *var) struct fb_var_screeninfo *var)
{ {
int pipe = PIPE_A; int pipe = PIPE_A;
u32 *dpll, *fp0, *fp1; u32 *dpll, *fp0, *fp1;
...@@ -1089,9 +1082,8 @@ intelfbhw_mode_to_hw(struct intelfb_info *dinfo, struct intelfb_hwstate *hw, ...@@ -1089,9 +1082,8 @@ intelfbhw_mode_to_hw(struct intelfb_info *dinfo, struct intelfb_hwstate *hw,
if (IS_I9XX(dinfo)) { if (IS_I9XX(dinfo)) {
*dpll |= (p2 << DPLL_I9XX_P2_SHIFT); *dpll |= (p2 << DPLL_I9XX_P2_SHIFT);
*dpll |= (1 << (p1 - 1)) << DPLL_P1_SHIFT; *dpll |= (1 << (p1 - 1)) << DPLL_P1_SHIFT;
} else { } else
*dpll |= (p2 << DPLL_P2_SHIFT) | (p1 << DPLL_P1_SHIFT); *dpll |= (p2 << DPLL_P2_SHIFT) | (p1 << DPLL_P1_SHIFT);
}
*fp0 = (n << FP_N_DIVISOR_SHIFT) | *fp0 = (n << FP_N_DIVISOR_SHIFT) |
(m1 << FP_M1_DIVISOR_SHIFT) | (m1 << FP_M1_DIVISOR_SHIFT) |
...@@ -1226,9 +1218,8 @@ intelfbhw_mode_to_hw(struct intelfb_info *dinfo, struct intelfb_hwstate *hw, ...@@ -1226,9 +1218,8 @@ intelfbhw_mode_to_hw(struct intelfb_info *dinfo, struct intelfb_hwstate *hw,
} }
/* Program a (non-VGA) video mode. */ /* Program a (non-VGA) video mode. */
int int intelfbhw_program_mode(struct intelfb_info *dinfo,
intelfbhw_program_mode(struct intelfb_info *dinfo, const struct intelfb_hwstate *hw, int blank)
const struct intelfb_hwstate *hw, int blank)
{ {
int pipe = PIPE_A; int pipe = PIPE_A;
u32 tmp; u32 tmp;
...@@ -1324,7 +1315,7 @@ intelfbhw_program_mode(struct intelfb_info *dinfo, ...@@ -1324,7 +1315,7 @@ intelfbhw_program_mode(struct intelfb_info *dinfo,
tmp &= ~PIPECONF_ENABLE; tmp &= ~PIPECONF_ENABLE;
OUTREG(pipe_conf_reg, tmp); OUTREG(pipe_conf_reg, tmp);
} }
} while(count < 2000); } while (count < 2000);
OUTREG(ADPA, INREG(ADPA) & ~ADPA_DAC_ENABLE); OUTREG(ADPA, INREG(ADPA) & ~ADPA_DAC_ENABLE);
...@@ -1448,8 +1439,7 @@ static u32 get_ring_space(struct intelfb_info *dinfo) ...@@ -1448,8 +1439,7 @@ static u32 get_ring_space(struct intelfb_info *dinfo)
return ring_space; return ring_space;
} }
static int static int wait_ring(struct intelfb_info *dinfo, int n)
wait_ring(struct intelfb_info *dinfo, int n)
{ {
int i = 0; int i = 0;
unsigned long end; unsigned long end;
...@@ -1491,16 +1481,15 @@ wait_ring(struct intelfb_info *dinfo, int n) ...@@ -1491,16 +1481,15 @@ wait_ring(struct intelfb_info *dinfo, int n)
return i; return i;
} }
static void static void do_flush(struct intelfb_info *dinfo)
do_flush(struct intelfb_info *dinfo) { {
START_RING(2); START_RING(2);
OUT_RING(MI_FLUSH | MI_WRITE_DIRTY_STATE | MI_INVALIDATE_MAP_CACHE); OUT_RING(MI_FLUSH | MI_WRITE_DIRTY_STATE | MI_INVALIDATE_MAP_CACHE);
OUT_RING(MI_NOOP); OUT_RING(MI_NOOP);
ADVANCE_RING(); ADVANCE_RING();
} }
void void intelfbhw_do_sync(struct intelfb_info *dinfo)
intelfbhw_do_sync(struct intelfb_info *dinfo)
{ {
#if VERBOSE > 0 #if VERBOSE > 0
DBG_MSG("intelfbhw_do_sync\n"); DBG_MSG("intelfbhw_do_sync\n");
...@@ -1519,8 +1508,7 @@ intelfbhw_do_sync(struct intelfb_info *dinfo) ...@@ -1519,8 +1508,7 @@ intelfbhw_do_sync(struct intelfb_info *dinfo)
dinfo->ring_space = dinfo->ring.size - RING_MIN_FREE; dinfo->ring_space = dinfo->ring.size - RING_MIN_FREE;
} }
static void static void refresh_ring(struct intelfb_info *dinfo)
refresh_ring(struct intelfb_info *dinfo)
{ {
#if VERBOSE > 0 #if VERBOSE > 0
DBG_MSG("refresh_ring\n"); DBG_MSG("refresh_ring\n");
...@@ -1531,8 +1519,7 @@ refresh_ring(struct intelfb_info *dinfo) ...@@ -1531,8 +1519,7 @@ refresh_ring(struct intelfb_info *dinfo)
dinfo->ring_space = get_ring_space(dinfo); dinfo->ring_space = get_ring_space(dinfo);
} }
static void static void reset_state(struct intelfb_info *dinfo)
reset_state(struct intelfb_info *dinfo)
{ {
int i; int i;
u32 tmp; u32 tmp;
...@@ -1562,12 +1549,11 @@ reset_state(struct intelfb_info *dinfo) ...@@ -1562,12 +1549,11 @@ reset_state(struct intelfb_info *dinfo)
} }
/* Stop the 2D engine, and turn off the ring buffer. */ /* Stop the 2D engine, and turn off the ring buffer. */
void void intelfbhw_2d_stop(struct intelfb_info *dinfo)
intelfbhw_2d_stop(struct intelfb_info *dinfo)
{ {
#if VERBOSE > 0 #if VERBOSE > 0
DBG_MSG("intelfbhw_2d_stop: accel: %d, ring_active: %d\n", dinfo->accel, DBG_MSG("intelfbhw_2d_stop: accel: %d, ring_active: %d\n",
dinfo->ring_active); dinfo->accel, dinfo->ring_active);
#endif #endif
if (!dinfo->accel) if (!dinfo->accel)
...@@ -1582,8 +1568,7 @@ intelfbhw_2d_stop(struct intelfb_info *dinfo) ...@@ -1582,8 +1568,7 @@ intelfbhw_2d_stop(struct intelfb_info *dinfo)
* It is assumed that the graphics engine has been stopped by previously * It is assumed that the graphics engine has been stopped by previously
* calling intelfb_2d_stop(). * calling intelfb_2d_stop().
*/ */
void void intelfbhw_2d_start(struct intelfb_info *dinfo)
intelfbhw_2d_start(struct intelfb_info *dinfo)
{ {
#if VERBOSE > 0 #if VERBOSE > 0
DBG_MSG("intelfbhw_2d_start: accel: %d, ring_active: %d\n", DBG_MSG("intelfbhw_2d_start: accel: %d, ring_active: %d\n",
...@@ -1607,9 +1592,8 @@ intelfbhw_2d_start(struct intelfb_info *dinfo) ...@@ -1607,9 +1592,8 @@ intelfbhw_2d_start(struct intelfb_info *dinfo)
} }
/* 2D fillrect (solid fill or invert) */ /* 2D fillrect (solid fill or invert) */
void void intelfbhw_do_fillrect(struct intelfb_info *dinfo, u32 x, u32 y, u32 w,
intelfbhw_do_fillrect(struct intelfb_info *dinfo, u32 x, u32 y, u32 w, u32 h, u32 h, u32 color, u32 pitch, u32 bpp, u32 rop)
u32 color, u32 pitch, u32 bpp, u32 rop)
{ {
u32 br00, br09, br13, br14, br16; u32 br00, br09, br13, br14, br16;
...@@ -1698,9 +1682,9 @@ intelfbhw_do_bitblt(struct intelfb_info *dinfo, u32 curx, u32 cury, ...@@ -1698,9 +1682,9 @@ intelfbhw_do_bitblt(struct intelfb_info *dinfo, u32 curx, u32 cury,
ADVANCE_RING(); ADVANCE_RING();
} }
int int intelfbhw_do_drawglyph(struct intelfb_info *dinfo, u32 fg, u32 bg, u32 w,
intelfbhw_do_drawglyph(struct intelfb_info *dinfo, u32 fg, u32 bg, u32 w, u32 h, const u8* cdat, u32 x, u32 y, u32 pitch,
u32 h, const u8* cdat, u32 x, u32 y, u32 pitch, u32 bpp) u32 bpp)
{ {
int nbytes, ndwords, pad, tmp; int nbytes, ndwords, pad, tmp;
u32 br00, br09, br13, br18, br19, br22, br23; u32 br00, br09, br13, br18, br19, br22, br23;
...@@ -1787,8 +1771,7 @@ intelfbhw_do_drawglyph(struct intelfb_info *dinfo, u32 fg, u32 bg, u32 w, ...@@ -1787,8 +1771,7 @@ intelfbhw_do_drawglyph(struct intelfb_info *dinfo, u32 fg, u32 bg, u32 w,
} }
/* HW cursor functions. */ /* HW cursor functions. */
void void intelfbhw_cursor_init(struct intelfb_info *dinfo)
intelfbhw_cursor_init(struct intelfb_info *dinfo)
{ {
u32 tmp; u32 tmp;
...@@ -1819,8 +1802,7 @@ intelfbhw_cursor_init(struct intelfb_info *dinfo) ...@@ -1819,8 +1802,7 @@ intelfbhw_cursor_init(struct intelfb_info *dinfo)
} }
} }
void void intelfbhw_cursor_hide(struct intelfb_info *dinfo)
intelfbhw_cursor_hide(struct intelfb_info *dinfo)
{ {
u32 tmp; u32 tmp;
...@@ -1845,8 +1827,7 @@ intelfbhw_cursor_hide(struct intelfb_info *dinfo) ...@@ -1845,8 +1827,7 @@ intelfbhw_cursor_hide(struct intelfb_info *dinfo)
} }
} }
void void intelfbhw_cursor_show(struct intelfb_info *dinfo)
intelfbhw_cursor_show(struct intelfb_info *dinfo)
{ {
u32 tmp; u32 tmp;
...@@ -1875,8 +1856,7 @@ intelfbhw_cursor_show(struct intelfb_info *dinfo) ...@@ -1875,8 +1856,7 @@ intelfbhw_cursor_show(struct intelfb_info *dinfo)
} }
} }
void void intelfbhw_cursor_setpos(struct intelfb_info *dinfo, int x, int y)
intelfbhw_cursor_setpos(struct intelfb_info *dinfo, int x, int y)
{ {
u32 tmp; u32 tmp;
...@@ -1894,13 +1874,11 @@ intelfbhw_cursor_setpos(struct intelfb_info *dinfo, int x, int y) ...@@ -1894,13 +1874,11 @@ intelfbhw_cursor_setpos(struct intelfb_info *dinfo, int x, int y)
((y & CURSOR_POS_MASK) << CURSOR_Y_SHIFT); ((y & CURSOR_POS_MASK) << CURSOR_Y_SHIFT);
OUTREG(CURSOR_A_POSITION, tmp); OUTREG(CURSOR_A_POSITION, tmp);
if (IS_I9XX(dinfo)) { if (IS_I9XX(dinfo))
OUTREG(CURSOR_A_BASEADDR, dinfo->cursor.physical); OUTREG(CURSOR_A_BASEADDR, dinfo->cursor.physical);
}
} }
void void intelfbhw_cursor_setcolor(struct intelfb_info *dinfo, u32 bg, u32 fg)
intelfbhw_cursor_setcolor(struct intelfb_info *dinfo, u32 bg, u32 fg)
{ {
#if VERBOSE > 0 #if VERBOSE > 0
DBG_MSG("intelfbhw_cursor_setcolor\n"); DBG_MSG("intelfbhw_cursor_setcolor\n");
...@@ -1912,9 +1890,8 @@ intelfbhw_cursor_setcolor(struct intelfb_info *dinfo, u32 bg, u32 fg) ...@@ -1912,9 +1890,8 @@ intelfbhw_cursor_setcolor(struct intelfb_info *dinfo, u32 bg, u32 fg)
OUTREG(CURSOR_A_PALETTE3, bg & CURSOR_PALETTE_MASK); OUTREG(CURSOR_A_PALETTE3, bg & CURSOR_PALETTE_MASK);
} }
void void intelfbhw_cursor_load(struct intelfb_info *dinfo, int width, int height,
intelfbhw_cursor_load(struct intelfb_info *dinfo, int width, int height, u8 *data)
u8 *data)
{ {
u8 __iomem *addr = (u8 __iomem *)dinfo->cursor.virtual; u8 __iomem *addr = (u8 __iomem *)dinfo->cursor.virtual;
int i, j, w = width / 8; int i, j, w = width / 8;
...@@ -1942,8 +1919,8 @@ intelfbhw_cursor_load(struct intelfb_info *dinfo, int width, int height, ...@@ -1942,8 +1919,8 @@ intelfbhw_cursor_load(struct intelfb_info *dinfo, int width, int height,
} }
} }
void void intelfbhw_cursor_reset(struct intelfb_info *dinfo)
intelfbhw_cursor_reset(struct intelfb_info *dinfo) { {
u8 __iomem *addr = (u8 __iomem *)dinfo->cursor.virtual; u8 __iomem *addr = (u8 __iomem *)dinfo->cursor.virtual;
int i, j; int i, j;
...@@ -2047,8 +2024,8 @@ intelfbhw_disable_irq(struct intelfb_info *dinfo) { ...@@ -2047,8 +2024,8 @@ intelfbhw_disable_irq(struct intelfb_info *dinfo) {
} }
} }
int int intelfbhw_wait_for_vsync(struct intelfb_info *dinfo, u32 pipe)
intelfbhw_wait_for_vsync(struct intelfb_info *dinfo, u32 pipe) { {
struct intelfb_vsync *vsync; struct intelfb_vsync *vsync;
unsigned int count; unsigned int count;
int ret; int ret;
...@@ -2062,15 +2039,14 @@ intelfbhw_wait_for_vsync(struct intelfb_info *dinfo, u32 pipe) { ...@@ -2062,15 +2039,14 @@ intelfbhw_wait_for_vsync(struct intelfb_info *dinfo, u32 pipe) {
} }
ret = intelfbhw_enable_irq(dinfo, 0); ret = intelfbhw_enable_irq(dinfo, 0);
if (ret) { if (ret)
return ret; return ret;
}
count = vsync->count; count = vsync->count;
ret = wait_event_interruptible_timeout(vsync->wait, count != vsync->count, HZ/10); ret = wait_event_interruptible_timeout(vsync->wait,
if (ret < 0) { count != vsync->count, HZ / 10);
if (ret < 0)
return ret; return ret;
}
if (ret == 0) { if (ret == 0) {
intelfbhw_enable_irq(dinfo, 1); intelfbhw_enable_irq(dinfo, 1);
DBG_MSG("wait_for_vsync timed out!\n"); DBG_MSG("wait_for_vsync timed out!\n");
......
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
*/ */
#define RING_MIN_FREE 64 #define RING_MIN_FREE 64
#define IPEHR 0x2088 #define IPEHR 0x2088
#define INSTDONE 0x2090 #define INSTDONE 0x2090
#define PRI_RING_EMPTY 1 #define PRI_RING_EMPTY 1
...@@ -128,9 +128,9 @@ ...@@ -128,9 +128,9 @@
#define GPIOA 0x5010 #define GPIOA 0x5010
#define GPIOB 0x5014 #define GPIOB 0x5014
#define GPIOC 0x5018 // this may be external DDC on i830 #define GPIOC 0x5018 /* this may be external DDC on i830 */
#define GPIOD 0x501C // this is DVO DDC #define GPIOD 0x501C /* this is DVO DDC */
#define GPIOE 0x5020 // this is DVO i2C #define GPIOE 0x5020 /* this is DVO i2C */
#define GPIOF 0x5024 #define GPIOF 0x5024
/* PLL registers */ /* PLL registers */
...@@ -269,8 +269,8 @@ ...@@ -269,8 +269,8 @@
#define PORT_ENABLE (1 << 31) #define PORT_ENABLE (1 << 31)
#define PORT_PIPE_SELECT_SHIFT 30 #define PORT_PIPE_SELECT_SHIFT 30
#define PORT_TV_FLAGS_MASK 0xFF #define PORT_TV_FLAGS_MASK 0xFF
#define PORT_TV_FLAGS 0xC4 // ripped from my BIOS #define PORT_TV_FLAGS 0xC4 /* ripped from my BIOS
// to understand and correct to understand and correct */
#define DVOA_SRCDIM 0x61124 #define DVOA_SRCDIM 0x61124
#define DVOB_SRCDIM 0x61144 #define DVOB_SRCDIM 0x61144
...@@ -369,7 +369,7 @@ ...@@ -369,7 +369,7 @@
#define DISPPLANE_8BPP (0x2<<26) #define DISPPLANE_8BPP (0x2<<26)
#define DISPPLANE_15_16BPP (0x4<<26) #define DISPPLANE_15_16BPP (0x4<<26)
#define DISPPLANE_16BPP (0x5<<26) #define DISPPLANE_16BPP (0x5<<26)
#define DISPPLANE_32BPP_NO_ALPHA (0x6<<26) #define DISPPLANE_32BPP_NO_ALPHA (0x6<<26)
#define DISPPLANE_32BPP (0x7<<26) #define DISPPLANE_32BPP (0x7<<26)
#define DISPPLANE_STEREO_ENABLE (1<<25) #define DISPPLANE_STEREO_ENABLE (1<<25)
#define DISPPLANE_STEREO_DISABLE 0 #define DISPPLANE_STEREO_DISABLE 0
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment