diff options
-rw-r--r-- | drivers/video/intelfb/intelfb.h | 12 | ||||
-rw-r--r-- | drivers/video/intelfb/intelfb_i2c.c | 60 | ||||
-rw-r--r-- | drivers/video/intelfb/intelfbdrv.c | 178 | ||||
-rw-r--r-- | drivers/video/intelfb/intelfbhw.c | 190 | ||||
-rw-r--r-- | drivers/video/intelfb/intelfbhw.h | 14 |
5 files changed, 202 insertions, 252 deletions
diff --git a/drivers/video/intelfb/intelfb.h b/drivers/video/intelfb/intelfb.h index 6148300fadd6..7e9d62a83472 100644 --- a/drivers/video/intelfb/intelfb.h +++ b/drivers/video/intelfb/intelfb.h | |||
@@ -231,8 +231,8 @@ struct intelfb_hwstate { | |||
231 | struct intelfb_heap_data { | 231 | struct intelfb_heap_data { |
232 | u32 physical; | 232 | u32 physical; |
233 | u8 __iomem *virtual; | 233 | u8 __iomem *virtual; |
234 | u32 offset; // in GATT pages | 234 | u32 offset; /* in GATT pages */ |
235 | u32 size; // in bytes | 235 | u32 size; /* in bytes */ |
236 | }; | 236 | }; |
237 | 237 | ||
238 | #ifdef CONFIG_FB_INTEL_I2C | 238 | #ifdef CONFIG_FB_INTEL_I2C |
@@ -270,9 +270,9 @@ struct intelfb_info { | |||
270 | struct intelfb_hwstate save_state; | 270 | struct intelfb_hwstate save_state; |
271 | 271 | ||
272 | /* agpgart structs */ | 272 | /* agpgart structs */ |
273 | struct agp_memory *gtt_fb_mem; // use all stolen memory or vram | 273 | struct agp_memory *gtt_fb_mem; /* use all stolen memory or vram */ |
274 | struct agp_memory *gtt_ring_mem; // ring buffer | 274 | struct agp_memory *gtt_ring_mem; /* ring buffer */ |
275 | struct agp_memory *gtt_cursor_mem; // hw cursor | 275 | struct agp_memory *gtt_cursor_mem; /* hw cursor */ |
276 | 276 | ||
277 | /* use a gart reserved fb mem */ | 277 | /* use a gart reserved fb mem */ |
278 | u8 fbmem_gart; | 278 | u8 fbmem_gart; |
@@ -346,7 +346,7 @@ struct intelfb_info { | |||
346 | 346 | ||
347 | /* driver registered */ | 347 | /* driver registered */ |
348 | int registered; | 348 | int registered; |
349 | 349 | ||
350 | /* index into plls */ | 350 | /* index into plls */ |
351 | int pll_index; | 351 | int pll_index; |
352 | 352 | ||
diff --git a/drivers/video/intelfb/intelfb_i2c.c b/drivers/video/intelfb/intelfb_i2c.c index 61e4c8759b23..94c08bb5acf1 100644 --- a/drivers/video/intelfb/intelfb_i2c.c +++ b/drivers/video/intelfb/intelfb_i2c.c | |||
@@ -58,7 +58,8 @@ static void intelfb_gpio_setscl(void *data, int state) | |||
58 | struct intelfb_info *dinfo = chan->dinfo; | 58 | struct intelfb_info *dinfo = chan->dinfo; |
59 | u32 val; | 59 | u32 val; |
60 | 60 | ||
61 | OUTREG(chan->reg, (state ? SCL_VAL_OUT : 0) | SCL_DIR | SCL_DIR_MASK | SCL_VAL_MASK); | 61 | OUTREG(chan->reg, (state ? SCL_VAL_OUT : 0) | |
62 | SCL_DIR | SCL_DIR_MASK | SCL_VAL_MASK); | ||
62 | val = INREG(chan->reg); | 63 | val = INREG(chan->reg); |
63 | } | 64 | } |
64 | 65 | ||
@@ -68,7 +69,8 @@ static void intelfb_gpio_setsda(void *data, int state) | |||
68 | struct intelfb_info *dinfo = chan->dinfo; | 69 | struct intelfb_info *dinfo = chan->dinfo; |
69 | u32 val; | 70 | u32 val; |
70 | 71 | ||
71 | OUTREG(chan->reg, (state ? SDA_VAL_OUT : 0) | SDA_DIR | SDA_DIR_MASK | SDA_VAL_MASK); | 72 | OUTREG(chan->reg, (state ? SDA_VAL_OUT : 0) | |
73 | SDA_DIR | SDA_DIR_MASK | SDA_VAL_MASK); | ||
72 | val = INREG(chan->reg); | 74 | val = INREG(chan->reg); |
73 | } | 75 | } |
74 | 76 | ||
@@ -97,26 +99,26 @@ static int intelfb_gpio_getsda(void *data) | |||
97 | } | 99 | } |
98 | 100 | ||
99 | static int intelfb_setup_i2c_bus(struct intelfb_info *dinfo, | 101 | static int intelfb_setup_i2c_bus(struct intelfb_info *dinfo, |
100 | struct intelfb_i2c_chan *chan, | 102 | struct intelfb_i2c_chan *chan, |
101 | const u32 reg, const char *name) | 103 | const u32 reg, const char *name) |
102 | { | 104 | { |
103 | int rc; | 105 | int rc; |
104 | 106 | ||
105 | chan->dinfo = dinfo; | 107 | chan->dinfo = dinfo; |
106 | chan->reg = reg; | 108 | chan->reg = reg; |
107 | snprintf(chan->adapter.name, sizeof(chan->adapter.name), | 109 | snprintf(chan->adapter.name, sizeof(chan->adapter.name), |
108 | "intelfb %s", name); | 110 | "intelfb %s", name); |
109 | chan->adapter.owner = THIS_MODULE; | 111 | chan->adapter.owner = THIS_MODULE; |
110 | chan->adapter.id = I2C_HW_B_INTELFB; | 112 | chan->adapter.id = I2C_HW_B_INTELFB; |
111 | chan->adapter.algo_data = &chan->algo; | 113 | chan->adapter.algo_data = &chan->algo; |
112 | chan->adapter.dev.parent = &chan->dinfo->pdev->dev; | 114 | chan->adapter.dev.parent = &chan->dinfo->pdev->dev; |
113 | chan->algo.setsda = intelfb_gpio_setsda; | 115 | chan->algo.setsda = intelfb_gpio_setsda; |
114 | chan->algo.setscl = intelfb_gpio_setscl; | 116 | chan->algo.setscl = intelfb_gpio_setscl; |
115 | chan->algo.getsda = intelfb_gpio_getsda; | 117 | chan->algo.getsda = intelfb_gpio_getsda; |
116 | chan->algo.getscl = intelfb_gpio_getscl; | 118 | chan->algo.getscl = intelfb_gpio_getscl; |
117 | chan->algo.udelay = 40; | 119 | chan->algo.udelay = 40; |
118 | chan->algo.timeout = 20; | 120 | chan->algo.timeout = 20; |
119 | chan->algo.data = chan; | 121 | chan->algo.data = chan; |
120 | 122 | ||
121 | i2c_set_adapdata(&chan->adapter, chan); | 123 | i2c_set_adapdata(&chan->adapter, chan); |
122 | 124 | ||
@@ -142,40 +144,44 @@ void intelfb_create_i2c_busses(struct intelfb_info *dinfo) | |||
142 | dinfo->output[i].type = INTELFB_OUTPUT_ANALOG; | 144 | dinfo->output[i].type = INTELFB_OUTPUT_ANALOG; |
143 | 145 | ||
144 | /* setup the DDC bus for analog output */ | 146 | /* setup the DDC bus for analog output */ |
145 | intelfb_setup_i2c_bus(dinfo, &dinfo->output[i].ddc_bus, GPIOA, "CRTDDC_A"); | 147 | intelfb_setup_i2c_bus(dinfo, &dinfo->output[i].ddc_bus, GPIOA, |
148 | "CRTDDC_A"); | ||
146 | i++; | 149 | i++; |
147 | 150 | ||
148 | /* need to add the output busses for each device | 151 | /* need to add the output busses for each device |
149 | - this function is very incomplete | 152 | - this function is very incomplete |
150 | - i915GM has LVDS and TVOUT for example | 153 | - i915GM has LVDS and TVOUT for example |
151 | */ | 154 | */ |
152 | switch(dinfo->chipset) { | 155 | switch(dinfo->chipset) { |
153 | case INTEL_830M: | 156 | case INTEL_830M: |
154 | case INTEL_845G: | 157 | case INTEL_845G: |
155 | case INTEL_855GM: | 158 | case INTEL_855GM: |
156 | case INTEL_865G: | 159 | case INTEL_865G: |
157 | dinfo->output[i].type = INTELFB_OUTPUT_DVO; | 160 | dinfo->output[i].type = INTELFB_OUTPUT_DVO; |
158 | intelfb_setup_i2c_bus(dinfo, &dinfo->output[i].ddc_bus, GPIOD, "DVODDC_D"); | 161 | intelfb_setup_i2c_bus(dinfo, &dinfo->output[i].ddc_bus, |
159 | intelfb_setup_i2c_bus(dinfo, &dinfo->output[i].i2c_bus, GPIOE, "DVOI2C_E"); | 162 | GPIOD, "DVODDC_D"); |
163 | intelfb_setup_i2c_bus(dinfo, &dinfo->output[i].i2c_bus, | ||
164 | GPIOE, "DVOI2C_E"); | ||
160 | i++; | 165 | i++; |
161 | break; | 166 | break; |
162 | case INTEL_915G: | 167 | case INTEL_915G: |
163 | case INTEL_915GM: | 168 | case INTEL_915GM: |
164 | /* has some LVDS + tv-out */ | 169 | /* has some LVDS + tv-out */ |
165 | case INTEL_945G: | 170 | case INTEL_945G: |
166 | case INTEL_945GM: | 171 | case INTEL_945GM: |
167 | /* SDVO ports have a single control bus - 2 devices */ | 172 | /* SDVO ports have a single control bus - 2 devices */ |
168 | dinfo->output[i].type = INTELFB_OUTPUT_SDVO; | 173 | dinfo->output[i].type = INTELFB_OUTPUT_SDVO; |
169 | intelfb_setup_i2c_bus(dinfo, &dinfo->output[i].i2c_bus, GPIOE, "SDVOCTRL_E"); | 174 | intelfb_setup_i2c_bus(dinfo, &dinfo->output[i].i2c_bus, |
175 | GPIOE, "SDVOCTRL_E"); | ||
170 | /* TODO: initialize the SDVO */ | 176 | /* TODO: initialize the SDVO */ |
171 | // I830SDVOInit(pScrn, i, DVOB); | 177 | /* I830SDVOInit(pScrn, i, DVOB); */ |
172 | i++; | 178 | i++; |
173 | 179 | ||
174 | /* set up SDVOC */ | 180 | /* set up SDVOC */ |
175 | dinfo->output[i].type = INTELFB_OUTPUT_SDVO; | 181 | dinfo->output[i].type = INTELFB_OUTPUT_SDVO; |
176 | dinfo->output[i].i2c_bus = dinfo->output[i - 1].i2c_bus; | 182 | dinfo->output[i].i2c_bus = dinfo->output[i - 1].i2c_bus; |
177 | /* TODO: initialize the SDVO */ | 183 | /* TODO: initialize the SDVO */ |
178 | // I830SDVOInit(pScrn, i, DVOC); | 184 | /* I830SDVOInit(pScrn, i, DVOC); */ |
179 | i++; | 185 | i++; |
180 | break; | 186 | break; |
181 | } | 187 | } |
diff --git a/drivers/video/intelfb/intelfbdrv.c b/drivers/video/intelfb/intelfbdrv.c index b75eda84858f..0428f211f192 100644 --- a/drivers/video/intelfb/intelfbdrv.c +++ b/drivers/video/intelfb/intelfbdrv.c | |||
@@ -99,13 +99,6 @@ | |||
99 | * Add vram option to reserve more memory than stolen by BIOS | 99 | * Add vram option to reserve more memory than stolen by BIOS |
100 | * Fix intelfbhw_pan_display typo | 100 | * Fix intelfbhw_pan_display typo |
101 | * Add __initdata annotations | 101 | * Add __initdata annotations |
102 | * | ||
103 | * TODO: | ||
104 | * | ||
105 | * | ||
106 | * Wish List: | ||
107 | * | ||
108 | * | ||
109 | */ | 102 | */ |
110 | 103 | ||
111 | #include <linux/module.h> | 104 | #include <linux/module.h> |
@@ -222,8 +215,8 @@ static struct pci_driver intelfb_driver = { | |||
222 | /* Module description/parameters */ | 215 | /* Module description/parameters */ |
223 | MODULE_AUTHOR("David Dawes <dawes@tungstengraphics.com>, " | 216 | MODULE_AUTHOR("David Dawes <dawes@tungstengraphics.com>, " |
224 | "Sylvain Meyer <sylvain.meyer@worldonline.fr>"); | 217 | "Sylvain Meyer <sylvain.meyer@worldonline.fr>"); |
225 | MODULE_DESCRIPTION( | 218 | MODULE_DESCRIPTION("Framebuffer driver for Intel(R) " SUPPORTED_CHIPSETS |
226 | "Framebuffer driver for Intel(R) " SUPPORTED_CHIPSETS " chipsets"); | 219 | " chipsets"); |
227 | MODULE_LICENSE("Dual BSD/GPL"); | 220 | MODULE_LICENSE("Dual BSD/GPL"); |
228 | MODULE_DEVICE_TABLE(pci, intelfb_pci_table); | 221 | MODULE_DEVICE_TABLE(pci, intelfb_pci_table); |
229 | 222 | ||
@@ -271,8 +264,7 @@ MODULE_PARM_DESC(mode, | |||
271 | #define OPT_INTVAL(opt, name) simple_strtoul(opt + strlen(name) + 1, NULL, 0) | 264 | #define OPT_INTVAL(opt, name) simple_strtoul(opt + strlen(name) + 1, NULL, 0) |
272 | #define OPT_STRVAL(opt, name) (opt + strlen(name)) | 265 | #define OPT_STRVAL(opt, name) (opt + strlen(name)) |
273 | 266 | ||
274 | static __inline__ char * | 267 | static __inline__ char * get_opt_string(const char *this_opt, const char *name) |
275 | get_opt_string(const char *this_opt, const char *name) | ||
276 | { | 268 | { |
277 | const char *p; | 269 | const char *p; |
278 | int i; | 270 | int i; |
@@ -290,8 +282,8 @@ get_opt_string(const char *this_opt, const char *name) | |||
290 | return ret; | 282 | return ret; |
291 | } | 283 | } |
292 | 284 | ||
293 | static __inline__ int | 285 | static __inline__ int get_opt_int(const char *this_opt, const char *name, |
294 | get_opt_int(const char *this_opt, const char *name, int *ret) | 286 | int *ret) |
295 | { | 287 | { |
296 | if (!ret) | 288 | if (!ret) |
297 | return 0; | 289 | return 0; |
@@ -303,8 +295,8 @@ get_opt_int(const char *this_opt, const char *name, int *ret) | |||
303 | return 1; | 295 | return 1; |
304 | } | 296 | } |
305 | 297 | ||
306 | static __inline__ int | 298 | static __inline__ int get_opt_bool(const char *this_opt, const char *name, |
307 | get_opt_bool(const char *this_opt, const char *name, int *ret) | 299 | int *ret) |
308 | { | 300 | { |
309 | if (!ret) | 301 | if (!ret) |
310 | return 0; | 302 | return 0; |
@@ -324,8 +316,7 @@ get_opt_bool(const char *this_opt, const char *name, int *ret) | |||
324 | return 1; | 316 | return 1; |
325 | } | 317 | } |
326 | 318 | ||
327 | static int __init | 319 | static int __init intelfb_setup(char *options) |
328 | intelfb_setup(char *options) | ||
329 | { | 320 | { |
330 | char *this_opt; | 321 | char *this_opt; |
331 | 322 | ||
@@ -355,7 +346,7 @@ intelfb_setup(char *options) | |||
355 | continue; | 346 | continue; |
356 | if (get_opt_bool(this_opt, "accel", &accel)) | 347 | if (get_opt_bool(this_opt, "accel", &accel)) |
357 | ; | 348 | ; |
358 | else if (get_opt_int(this_opt, "vram", &vram)) | 349 | else if (get_opt_int(this_opt, "vram", &vram)) |
359 | ; | 350 | ; |
360 | else if (get_opt_bool(this_opt, "hwcursor", &hwcursor)) | 351 | else if (get_opt_bool(this_opt, "hwcursor", &hwcursor)) |
361 | ; | 352 | ; |
@@ -376,8 +367,7 @@ intelfb_setup(char *options) | |||
376 | 367 | ||
377 | #endif | 368 | #endif |
378 | 369 | ||
379 | static int __init | 370 | static int __init intelfb_init(void) |
380 | intelfb_init(void) | ||
381 | { | 371 | { |
382 | #ifndef MODULE | 372 | #ifndef MODULE |
383 | char *option = NULL; | 373 | char *option = NULL; |
@@ -401,8 +391,7 @@ intelfb_init(void) | |||
401 | return pci_register_driver(&intelfb_driver); | 391 | return pci_register_driver(&intelfb_driver); |
402 | } | 392 | } |
403 | 393 | ||
404 | static void __exit | 394 | static void __exit intelfb_exit(void) |
405 | intelfb_exit(void) | ||
406 | { | 395 | { |
407 | DBG_MSG("intelfb_exit\n"); | 396 | DBG_MSG("intelfb_exit\n"); |
408 | pci_unregister_driver(&intelfb_driver); | 397 | pci_unregister_driver(&intelfb_driver); |
@@ -428,8 +417,8 @@ static inline void __devinit set_mtrr(struct intelfb_info *dinfo) | |||
428 | } | 417 | } |
429 | static inline void unset_mtrr(struct intelfb_info *dinfo) | 418 | static inline void unset_mtrr(struct intelfb_info *dinfo) |
430 | { | 419 | { |
431 | if (dinfo->has_mtrr) | 420 | if (dinfo->has_mtrr) |
432 | mtrr_del(dinfo->mtrr_reg, dinfo->aperture.physical, | 421 | mtrr_del(dinfo->mtrr_reg, dinfo->aperture.physical, |
433 | dinfo->aperture.size); | 422 | dinfo->aperture.size); |
434 | } | 423 | } |
435 | #else | 424 | #else |
@@ -442,8 +431,7 @@ static inline void unset_mtrr(struct intelfb_info *dinfo) | |||
442 | * driver init / cleanup * | 431 | * driver init / cleanup * |
443 | ***************************************************************/ | 432 | ***************************************************************/ |
444 | 433 | ||
445 | static void | 434 | static void cleanup(struct intelfb_info *dinfo) |
446 | cleanup(struct intelfb_info *dinfo) | ||
447 | { | 435 | { |
448 | DBG_MSG("cleanup\n"); | 436 | DBG_MSG("cleanup\n"); |
449 | 437 | ||
@@ -499,8 +487,8 @@ cleanup(struct intelfb_info *dinfo) | |||
499 | } while (0) | 487 | } while (0) |
500 | 488 | ||
501 | 489 | ||
502 | static int __devinit | 490 | static int __devinit intelfb_pci_register(struct pci_dev *pdev, |
503 | intelfb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent) | 491 | const struct pci_device_id *ent) |
504 | { | 492 | { |
505 | struct fb_info *info; | 493 | struct fb_info *info; |
506 | struct intelfb_info *dinfo; | 494 | struct intelfb_info *dinfo; |
@@ -510,8 +498,8 @@ intelfb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
510 | int agp_memtype; | 498 | int agp_memtype; |
511 | const char *s; | 499 | const char *s; |
512 | struct agp_bridge_data *bridge; | 500 | struct agp_bridge_data *bridge; |
513 | int aperture_bar = 0; | 501 | int aperture_bar = 0; |
514 | int mmio_bar = 1; | 502 | int mmio_bar = 1; |
515 | int offset; | 503 | int offset; |
516 | 504 | ||
517 | DBG_MSG("intelfb_pci_register\n"); | 505 | DBG_MSG("intelfb_pci_register\n"); |
@@ -637,9 +625,8 @@ intelfb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
637 | dinfo->ring.size = RINGBUFFER_SIZE; | 625 | dinfo->ring.size = RINGBUFFER_SIZE; |
638 | dinfo->ring_tail_mask = dinfo->ring.size - 1; | 626 | dinfo->ring_tail_mask = dinfo->ring.size - 1; |
639 | } | 627 | } |
640 | if (dinfo->hwcursor) { | 628 | if (dinfo->hwcursor) |
641 | dinfo->cursor.size = HW_CURSOR_SIZE; | 629 | dinfo->cursor.size = HW_CURSOR_SIZE; |
642 | } | ||
643 | 630 | ||
644 | /* Use agpgart to manage the GATT */ | 631 | /* Use agpgart to manage the GATT */ |
645 | if (!(bridge = agp_backend_acquire(pdev))) { | 632 | if (!(bridge = agp_backend_acquire(pdev))) { |
@@ -662,18 +649,15 @@ intelfb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
662 | offset = ROUND_UP_TO_PAGE(MB(voffset))/GTT_PAGE_SIZE; | 649 | offset = ROUND_UP_TO_PAGE(MB(voffset))/GTT_PAGE_SIZE; |
663 | 650 | ||
664 | /* set the mem offsets - set them after the already used pages */ | 651 | /* set the mem offsets - set them after the already used pages */ |
665 | if (dinfo->accel) { | 652 | if (dinfo->accel) |
666 | dinfo->ring.offset = offset + gtt_info.current_memory; | 653 | dinfo->ring.offset = offset + gtt_info.current_memory; |
667 | } | 654 | if (dinfo->hwcursor) |
668 | if (dinfo->hwcursor) { | ||
669 | dinfo->cursor.offset = offset + | 655 | dinfo->cursor.offset = offset + |
670 | + gtt_info.current_memory + (dinfo->ring.size >> 12); | 656 | + gtt_info.current_memory + (dinfo->ring.size >> 12); |
671 | } | 657 | if (dinfo->fbmem_gart) |
672 | if (dinfo->fbmem_gart) { | ||
673 | dinfo->fb.offset = offset + | 658 | dinfo->fb.offset = offset + |
674 | + gtt_info.current_memory + (dinfo->ring.size >> 12) | 659 | + gtt_info.current_memory + (dinfo->ring.size >> 12) |
675 | + (dinfo->cursor.size >> 12); | 660 | + (dinfo->cursor.size >> 12); |
676 | } | ||
677 | 661 | ||
678 | /* Allocate memories (which aren't stolen) */ | 662 | /* Allocate memories (which aren't stolen) */ |
679 | /* Map the fb and MMIO regions */ | 663 | /* Map the fb and MMIO regions */ |
@@ -689,7 +673,7 @@ intelfb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
689 | 673 | ||
690 | dinfo->mmio_base = | 674 | dinfo->mmio_base = |
691 | (u8 __iomem *)ioremap_nocache(dinfo->mmio_base_phys, | 675 | (u8 __iomem *)ioremap_nocache(dinfo->mmio_base_phys, |
692 | INTEL_REG_SIZE); | 676 | INTEL_REG_SIZE); |
693 | if (!dinfo->mmio_base) { | 677 | if (!dinfo->mmio_base) { |
694 | ERR_MSG("Cannot remap MMIO region.\n"); | 678 | ERR_MSG("Cannot remap MMIO region.\n"); |
695 | cleanup(dinfo); | 679 | cleanup(dinfo); |
@@ -837,10 +821,8 @@ intelfb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
837 | if (bailearly == 3) | 821 | if (bailearly == 3) |
838 | bailout(dinfo); | 822 | bailout(dinfo); |
839 | 823 | ||
840 | if (FIXED_MODE(dinfo)) { | 824 | if (FIXED_MODE(dinfo)) /* remap fb address */ |
841 | /* remap fb address */ | ||
842 | update_dinfo(dinfo, &dinfo->initial_var); | 825 | update_dinfo(dinfo, &dinfo->initial_var); |
843 | } | ||
844 | 826 | ||
845 | if (bailearly == 4) | 827 | if (bailearly == 4) |
846 | bailout(dinfo); | 828 | bailout(dinfo); |
@@ -939,8 +921,7 @@ intelfb_pci_unregister(struct pci_dev *pdev) | |||
939 | * helper functions * | 921 | * helper functions * |
940 | ***************************************************************/ | 922 | ***************************************************************/ |
941 | 923 | ||
942 | int __inline__ | 924 | int __inline__ intelfb_var_to_depth(const struct fb_var_screeninfo *var) |
943 | intelfb_var_to_depth(const struct fb_var_screeninfo *var) | ||
944 | { | 925 | { |
945 | DBG_MSG("intelfb_var_to_depth: bpp: %d, green.length is %d\n", | 926 | DBG_MSG("intelfb_var_to_depth: bpp: %d, green.length is %d\n", |
946 | var->bits_per_pixel, var->green.length); | 927 | var->bits_per_pixel, var->green.length); |
@@ -956,8 +937,7 @@ intelfb_var_to_depth(const struct fb_var_screeninfo *var) | |||
956 | } | 937 | } |
957 | 938 | ||
958 | 939 | ||
959 | static __inline__ int | 940 | static __inline__ int var_to_refresh(const struct fb_var_screeninfo *var) |
960 | var_to_refresh(const struct fb_var_screeninfo *var) | ||
961 | { | 941 | { |
962 | int xtot = var->xres + var->left_margin + var->right_margin + | 942 | int xtot = var->xres + var->left_margin + var->right_margin + |
963 | var->hsync_len; | 943 | var->hsync_len; |
@@ -971,8 +951,7 @@ var_to_refresh(const struct fb_var_screeninfo *var) | |||
971 | * Various intialisation functions * | 951 | * Various intialisation functions * |
972 | ***************************************************************/ | 952 | ***************************************************************/ |
973 | 953 | ||
974 | static void __devinit | 954 | static void __devinit get_initial_mode(struct intelfb_info *dinfo) |
975 | get_initial_mode(struct intelfb_info *dinfo) | ||
976 | { | 955 | { |
977 | struct fb_var_screeninfo *var; | 956 | struct fb_var_screeninfo *var; |
978 | int xtot, ytot; | 957 | int xtot, ytot; |
@@ -1039,8 +1018,7 @@ get_initial_mode(struct intelfb_info *dinfo) | |||
1039 | } | 1018 | } |
1040 | } | 1019 | } |
1041 | 1020 | ||
1042 | static int __devinit | 1021 | static int __devinit intelfb_init_var(struct intelfb_info *dinfo) |
1043 | intelfb_init_var(struct intelfb_info *dinfo) | ||
1044 | { | 1022 | { |
1045 | struct fb_var_screeninfo *var; | 1023 | struct fb_var_screeninfo *var; |
1046 | int msrc = 0; | 1024 | int msrc = 0; |
@@ -1087,10 +1065,9 @@ intelfb_init_var(struct intelfb_info *dinfo) | |||
1087 | 1065 | ||
1088 | } | 1066 | } |
1089 | 1067 | ||
1090 | if (!msrc) { | 1068 | if (!msrc) |
1091 | msrc = fb_find_mode(var, dinfo->info, PREFERRED_MODE, | 1069 | msrc = fb_find_mode(var, dinfo->info, PREFERRED_MODE, |
1092 | NULL, 0, NULL, 0); | 1070 | NULL, 0, NULL, 0); |
1093 | } | ||
1094 | } | 1071 | } |
1095 | 1072 | ||
1096 | if (!msrc) { | 1073 | if (!msrc) { |
@@ -1122,8 +1099,7 @@ intelfb_init_var(struct intelfb_info *dinfo) | |||
1122 | return 0; | 1099 | return 0; |
1123 | } | 1100 | } |
1124 | 1101 | ||
1125 | static int __devinit | 1102 | static int __devinit intelfb_set_fbinfo(struct intelfb_info *dinfo) |
1126 | intelfb_set_fbinfo(struct intelfb_info *dinfo) | ||
1127 | { | 1103 | { |
1128 | struct fb_info *info = dinfo->info; | 1104 | struct fb_info *info = dinfo->info; |
1129 | 1105 | ||
@@ -1159,8 +1135,8 @@ intelfb_set_fbinfo(struct intelfb_info *dinfo) | |||
1159 | } | 1135 | } |
1160 | 1136 | ||
1161 | /* Update dinfo to match the active video mode. */ | 1137 | /* Update dinfo to match the active video mode. */ |
1162 | static void | 1138 | static void update_dinfo(struct intelfb_info *dinfo, |
1163 | update_dinfo(struct intelfb_info *dinfo, struct fb_var_screeninfo *var) | 1139 | struct fb_var_screeninfo *var) |
1164 | { | 1140 | { |
1165 | DBG_MSG("update_dinfo\n"); | 1141 | DBG_MSG("update_dinfo\n"); |
1166 | 1142 | ||
@@ -1208,36 +1184,32 @@ update_dinfo(struct intelfb_info *dinfo, struct fb_var_screeninfo *var) | |||
1208 | * fbdev interface * | 1184 | * fbdev interface * |
1209 | ***************************************************************/ | 1185 | ***************************************************************/ |
1210 | 1186 | ||
1211 | static int | 1187 | static int intelfb_open(struct fb_info *info, int user) |
1212 | intelfb_open(struct fb_info *info, int user) | ||
1213 | { | 1188 | { |
1214 | struct intelfb_info *dinfo = GET_DINFO(info); | 1189 | struct intelfb_info *dinfo = GET_DINFO(info); |
1215 | 1190 | ||
1216 | if (user) { | 1191 | if (user) |
1217 | dinfo->open++; | 1192 | dinfo->open++; |
1218 | } | ||
1219 | 1193 | ||
1220 | return 0; | 1194 | return 0; |
1221 | } | 1195 | } |
1222 | 1196 | ||
1223 | static int | 1197 | static int intelfb_release(struct fb_info *info, int user) |
1224 | intelfb_release(struct fb_info *info, int user) | ||
1225 | { | 1198 | { |
1226 | struct intelfb_info *dinfo = GET_DINFO(info); | 1199 | struct intelfb_info *dinfo = GET_DINFO(info); |
1227 | 1200 | ||
1228 | if (user) { | 1201 | if (user) { |
1229 | dinfo->open--; | 1202 | dinfo->open--; |
1230 | msleep(1); | 1203 | msleep(1); |
1231 | if (!dinfo->open) { | 1204 | if (!dinfo->open) |
1232 | intelfbhw_disable_irq(dinfo); | 1205 | intelfbhw_disable_irq(dinfo); |
1233 | } | ||
1234 | } | 1206 | } |
1235 | 1207 | ||
1236 | return 0; | 1208 | return 0; |
1237 | } | 1209 | } |
1238 | 1210 | ||
1239 | static int | 1211 | static int intelfb_check_var(struct fb_var_screeninfo *var, |
1240 | intelfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) | 1212 | struct fb_info *info) |
1241 | { | 1213 | { |
1242 | int change_var = 0; | 1214 | int change_var = 0; |
1243 | struct fb_var_screeninfo v; | 1215 | struct fb_var_screeninfo v; |
@@ -1271,15 +1243,15 @@ intelfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) | |||
1271 | } | 1243 | } |
1272 | 1244 | ||
1273 | /* Check for a supported bpp. */ | 1245 | /* Check for a supported bpp. */ |
1274 | if (v.bits_per_pixel <= 8) { | 1246 | if (v.bits_per_pixel <= 8) |
1275 | v.bits_per_pixel = 8; | 1247 | v.bits_per_pixel = 8; |
1276 | } else if (v.bits_per_pixel <= 16) { | 1248 | else if (v.bits_per_pixel <= 16) { |
1277 | if (v.bits_per_pixel == 16) | 1249 | if (v.bits_per_pixel == 16) |
1278 | v.green.length = 6; | 1250 | v.green.length = 6; |
1279 | v.bits_per_pixel = 16; | 1251 | v.bits_per_pixel = 16; |
1280 | } else if (v.bits_per_pixel <= 32) { | 1252 | } else if (v.bits_per_pixel <= 32) |
1281 | v.bits_per_pixel = 32; | 1253 | v.bits_per_pixel = 32; |
1282 | } else | 1254 | else |
1283 | return -EINVAL; | 1255 | return -EINVAL; |
1284 | 1256 | ||
1285 | change_var = ((info->var.xres != var->xres) || | 1257 | change_var = ((info->var.xres != var->xres) || |
@@ -1361,10 +1333,9 @@ intelfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) | |||
1361 | return 0; | 1333 | return 0; |
1362 | } | 1334 | } |
1363 | 1335 | ||
1364 | static int | 1336 | static int intelfb_set_par(struct fb_info *info) |
1365 | intelfb_set_par(struct fb_info *info) | ||
1366 | { | 1337 | { |
1367 | struct intelfb_hwstate *hw; | 1338 | struct intelfb_hwstate *hw; |
1368 | struct intelfb_info *dinfo = GET_DINFO(info); | 1339 | struct intelfb_info *dinfo = GET_DINFO(info); |
1369 | 1340 | ||
1370 | if (FIXED_MODE(dinfo)) { | 1341 | if (FIXED_MODE(dinfo)) { |
@@ -1372,9 +1343,9 @@ intelfb_set_par(struct fb_info *info) | |||
1372 | return -EINVAL; | 1343 | return -EINVAL; |
1373 | } | 1344 | } |
1374 | 1345 | ||
1375 | hw = kmalloc(sizeof(*hw), GFP_ATOMIC); | 1346 | hw = kmalloc(sizeof(*hw), GFP_ATOMIC); |
1376 | if (!hw) | 1347 | if (!hw) |
1377 | return -ENOMEM; | 1348 | return -ENOMEM; |
1378 | 1349 | ||
1379 | DBG_MSG("intelfb_set_par (%dx%d-%d)\n", info->var.xres, | 1350 | DBG_MSG("intelfb_set_par (%dx%d-%d)\n", info->var.xres, |
1380 | info->var.yres, info->var.bits_per_pixel); | 1351 | info->var.yres, info->var.bits_per_pixel); |
@@ -1384,15 +1355,15 @@ intelfb_set_par(struct fb_info *info) | |||
1384 | if (ACCEL(dinfo, info)) | 1355 | if (ACCEL(dinfo, info)) |
1385 | intelfbhw_2d_stop(dinfo); | 1356 | intelfbhw_2d_stop(dinfo); |
1386 | 1357 | ||
1387 | memcpy(hw, &dinfo->save_state, sizeof(*hw)); | 1358 | memcpy(hw, &dinfo->save_state, sizeof(*hw)); |
1388 | if (intelfbhw_mode_to_hw(dinfo, hw, &info->var)) | 1359 | if (intelfbhw_mode_to_hw(dinfo, hw, &info->var)) |
1389 | goto invalid_mode; | 1360 | goto invalid_mode; |
1390 | if (intelfbhw_program_mode(dinfo, hw, 0)) | 1361 | if (intelfbhw_program_mode(dinfo, hw, 0)) |
1391 | goto invalid_mode; | 1362 | goto invalid_mode; |
1392 | 1363 | ||
1393 | #if REGDUMP > 0 | 1364 | #if REGDUMP > 0 |
1394 | intelfbhw_read_hw_state(dinfo, hw, 0); | 1365 | intelfbhw_read_hw_state(dinfo, hw, 0); |
1395 | intelfbhw_print_hw_state(dinfo, hw); | 1366 | intelfbhw_print_hw_state(dinfo, hw); |
1396 | #endif | 1367 | #endif |
1397 | 1368 | ||
1398 | update_dinfo(dinfo, &info->var); | 1369 | update_dinfo(dinfo, &info->var); |
@@ -1408,9 +1379,9 @@ intelfb_set_par(struct fb_info *info) | |||
1408 | info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN | | 1379 | info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN | |
1409 | FBINFO_HWACCEL_COPYAREA | FBINFO_HWACCEL_FILLRECT | | 1380 | FBINFO_HWACCEL_COPYAREA | FBINFO_HWACCEL_FILLRECT | |
1410 | FBINFO_HWACCEL_IMAGEBLIT; | 1381 | FBINFO_HWACCEL_IMAGEBLIT; |
1411 | } else { | 1382 | } else |
1412 | info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN; | 1383 | info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN; |
1413 | } | 1384 | |
1414 | kfree(hw); | 1385 | kfree(hw); |
1415 | return 0; | 1386 | return 0; |
1416 | invalid_mode: | 1387 | invalid_mode: |
@@ -1418,9 +1389,9 @@ invalid_mode: | |||
1418 | return -EINVAL; | 1389 | return -EINVAL; |
1419 | } | 1390 | } |
1420 | 1391 | ||
1421 | static int | 1392 | static int intelfb_setcolreg(unsigned regno, unsigned red, unsigned green, |
1422 | intelfb_setcolreg(unsigned regno, unsigned red, unsigned green, | 1393 | unsigned blue, unsigned transp, |
1423 | unsigned blue, unsigned transp, struct fb_info *info) | 1394 | struct fb_info *info) |
1424 | { | 1395 | { |
1425 | struct intelfb_info *dinfo = GET_DINFO(info); | 1396 | struct intelfb_info *dinfo = GET_DINFO(info); |
1426 | 1397 | ||
@@ -1463,23 +1434,22 @@ intelfb_setcolreg(unsigned regno, unsigned red, unsigned green, | |||
1463 | return 0; | 1434 | return 0; |
1464 | } | 1435 | } |
1465 | 1436 | ||
1466 | static int | 1437 | static int intelfb_blank(int blank, struct fb_info *info) |
1467 | intelfb_blank(int blank, struct fb_info *info) | ||
1468 | { | 1438 | { |
1469 | intelfbhw_do_blank(blank, info); | 1439 | intelfbhw_do_blank(blank, info); |
1470 | return 0; | 1440 | return 0; |
1471 | } | 1441 | } |
1472 | 1442 | ||
1473 | static int | 1443 | static int intelfb_pan_display(struct fb_var_screeninfo *var, |
1474 | intelfb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info) | 1444 | struct fb_info *info) |
1475 | { | 1445 | { |
1476 | intelfbhw_pan_display(var, info); | 1446 | intelfbhw_pan_display(var, info); |
1477 | return 0; | 1447 | return 0; |
1478 | } | 1448 | } |
1479 | 1449 | ||
1480 | /* When/if we have our own ioctls. */ | 1450 | /* When/if we have our own ioctls. */ |
1481 | static int | 1451 | static int intelfb_ioctl(struct fb_info *info, unsigned int cmd, |
1482 | intelfb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg) | 1452 | unsigned long arg) |
1483 | { | 1453 | { |
1484 | int retval = 0; | 1454 | int retval = 0; |
1485 | struct intelfb_info *dinfo = GET_DINFO(info); | 1455 | struct intelfb_info *dinfo = GET_DINFO(info); |
@@ -1499,8 +1469,8 @@ intelfb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg) | |||
1499 | return retval; | 1469 | return retval; |
1500 | } | 1470 | } |
1501 | 1471 | ||
1502 | static void | 1472 | static void intelfb_fillrect (struct fb_info *info, |
1503 | intelfb_fillrect (struct fb_info *info, const struct fb_fillrect *rect) | 1473 | const struct fb_fillrect *rect) |
1504 | { | 1474 | { |
1505 | struct intelfb_info *dinfo = GET_DINFO(info); | 1475 | struct intelfb_info *dinfo = GET_DINFO(info); |
1506 | u32 rop, color; | 1476 | u32 rop, color; |
@@ -1514,7 +1484,7 @@ intelfb_fillrect (struct fb_info *info, const struct fb_fillrect *rect) | |||
1514 | 1484 | ||
1515 | if (rect->rop == ROP_COPY) | 1485 | if (rect->rop == ROP_COPY) |
1516 | rop = PAT_ROP_GXCOPY; | 1486 | rop = PAT_ROP_GXCOPY; |
1517 | else // ROP_XOR | 1487 | else /* ROP_XOR */ |
1518 | rop = PAT_ROP_GXXOR; | 1488 | rop = PAT_ROP_GXXOR; |
1519 | 1489 | ||
1520 | if (dinfo->depth != 8) | 1490 | if (dinfo->depth != 8) |
@@ -1528,8 +1498,8 @@ intelfb_fillrect (struct fb_info *info, const struct fb_fillrect *rect) | |||
1528 | rop); | 1498 | rop); |
1529 | } | 1499 | } |
1530 | 1500 | ||
1531 | static void | 1501 | static void intelfb_copyarea(struct fb_info *info, |
1532 | intelfb_copyarea(struct fb_info *info, const struct fb_copyarea *region) | 1502 | const struct fb_copyarea *region) |
1533 | { | 1503 | { |
1534 | struct intelfb_info *dinfo = GET_DINFO(info); | 1504 | struct intelfb_info *dinfo = GET_DINFO(info); |
1535 | 1505 | ||
@@ -1545,8 +1515,8 @@ intelfb_copyarea(struct fb_info *info, const struct fb_copyarea *region) | |||
1545 | dinfo->pitch, info->var.bits_per_pixel); | 1515 | dinfo->pitch, info->var.bits_per_pixel); |
1546 | } | 1516 | } |
1547 | 1517 | ||
1548 | static void | 1518 | static void intelfb_imageblit(struct fb_info *info, |
1549 | intelfb_imageblit(struct fb_info *info, const struct fb_image *image) | 1519 | const struct fb_image *image) |
1550 | { | 1520 | { |
1551 | struct intelfb_info *dinfo = GET_DINFO(info); | 1521 | struct intelfb_info *dinfo = GET_DINFO(info); |
1552 | u32 fgcolor, bgcolor; | 1522 | u32 fgcolor, bgcolor; |
@@ -1574,8 +1544,7 @@ intelfb_imageblit(struct fb_info *info, const struct fb_image *image) | |||
1574 | return cfb_imageblit(info, image); | 1544 | return cfb_imageblit(info, image); |
1575 | } | 1545 | } |
1576 | 1546 | ||
1577 | static int | 1547 | static int intelfb_cursor(struct fb_info *info, struct fb_cursor *cursor) |
1578 | intelfb_cursor(struct fb_info *info, struct fb_cursor *cursor) | ||
1579 | { | 1548 | { |
1580 | struct intelfb_info *dinfo = GET_DINFO(info); | 1549 | struct intelfb_info *dinfo = GET_DINFO(info); |
1581 | u32 physical; | 1550 | u32 physical; |
@@ -1689,8 +1658,7 @@ intelfb_cursor(struct fb_info *info, struct fb_cursor *cursor) | |||
1689 | return 0; | 1658 | return 0; |
1690 | } | 1659 | } |
1691 | 1660 | ||
1692 | static int | 1661 | static int intelfb_sync(struct fb_info *info) |
1693 | intelfb_sync(struct fb_info *info) | ||
1694 | { | 1662 | { |
1695 | struct intelfb_info *dinfo = GET_DINFO(info); | 1663 | struct intelfb_info *dinfo = GET_DINFO(info); |
1696 | 1664 | ||
diff --git a/drivers/video/intelfb/intelfbhw.c b/drivers/video/intelfb/intelfbhw.c index 04d0e0fd9bc0..fe38df8e2b6f 100644 --- a/drivers/video/intelfb/intelfbhw.c +++ b/drivers/video/intelfb/intelfbhw.c | |||
@@ -56,17 +56,16 @@ static struct pll_min_max plls[PLLS_MAX] = { | |||
56 | 6, 16, 3, 16, | 56 | 6, 16, 3, 16, |
57 | 4, 128, 0, 31, | 57 | 4, 128, 0, 31, |
58 | 930000, 1400000, 165000, 48000, | 58 | 930000, 1400000, 165000, 48000, |
59 | 4, 2 }, //I8xx | 59 | 4, 2 }, /* I8xx */ |
60 | 60 | ||
61 | { 75, 120, 10, 20, | 61 | { 75, 120, 10, 20, |
62 | 5, 9, 4, 7, | 62 | 5, 9, 4, 7, |
63 | 5, 80, 1, 8, | 63 | 5, 80, 1, 8, |
64 | 1400000, 2800000, 200000, 96000, | 64 | 1400000, 2800000, 200000, 96000, |
65 | 10, 5 } //I9xx | 65 | 10, 5 } /* I9xx */ |
66 | }; | 66 | }; |
67 | 67 | ||
68 | int | 68 | int intelfbhw_get_chipset(struct pci_dev *pdev, struct intelfb_info *dinfo) |
69 | intelfbhw_get_chipset(struct pci_dev *pdev, struct intelfb_info *dinfo) | ||
70 | { | 69 | { |
71 | u32 tmp; | 70 | u32 tmp; |
72 | if (!pdev || !dinfo) | 71 | if (!pdev || !dinfo) |
@@ -149,9 +148,8 @@ intelfbhw_get_chipset(struct pci_dev *pdev, struct intelfb_info *dinfo) | |||
149 | } | 148 | } |
150 | } | 149 | } |
151 | 150 | ||
152 | int | 151 | int intelfbhw_get_memory(struct pci_dev *pdev, int *aperture_size, |
153 | intelfbhw_get_memory(struct pci_dev *pdev, int *aperture_size, | 152 | int *stolen_size) |
154 | int *stolen_size) | ||
155 | { | 153 | { |
156 | struct pci_dev *bridge_dev; | 154 | struct pci_dev *bridge_dev; |
157 | u16 tmp; | 155 | u16 tmp; |
@@ -254,8 +252,7 @@ intelfbhw_get_memory(struct pci_dev *pdev, int *aperture_size, | |||
254 | } | 252 | } |
255 | } | 253 | } |
256 | 254 | ||
257 | int | 255 | int intelfbhw_check_non_crt(struct intelfb_info *dinfo) |
258 | intelfbhw_check_non_crt(struct intelfb_info *dinfo) | ||
259 | { | 256 | { |
260 | int dvo = 0; | 257 | int dvo = 0; |
261 | 258 | ||
@@ -271,8 +268,7 @@ intelfbhw_check_non_crt(struct intelfb_info *dinfo) | |||
271 | return dvo; | 268 | return dvo; |
272 | } | 269 | } |
273 | 270 | ||
274 | const char * | 271 | const char * intelfbhw_dvo_to_string(int dvo) |
275 | intelfbhw_dvo_to_string(int dvo) | ||
276 | { | 272 | { |
277 | if (dvo & DVOA_PORT) | 273 | if (dvo & DVOA_PORT) |
278 | return "DVO port A"; | 274 | return "DVO port A"; |
@@ -287,9 +283,8 @@ intelfbhw_dvo_to_string(int dvo) | |||
287 | } | 283 | } |
288 | 284 | ||
289 | 285 | ||
290 | int | 286 | int intelfbhw_validate_mode(struct intelfb_info *dinfo, |
291 | intelfbhw_validate_mode(struct intelfb_info *dinfo, | 287 | struct fb_var_screeninfo *var) |
292 | struct fb_var_screeninfo *var) | ||
293 | { | 288 | { |
294 | int bytes_per_pixel; | 289 | int bytes_per_pixel; |
295 | int tmp; | 290 | int tmp; |
@@ -345,8 +340,7 @@ intelfbhw_validate_mode(struct intelfb_info *dinfo, | |||
345 | return 0; | 340 | return 0; |
346 | } | 341 | } |
347 | 342 | ||
348 | int | 343 | int intelfbhw_pan_display(struct fb_var_screeninfo *var, struct fb_info *info) |
349 | intelfbhw_pan_display(struct fb_var_screeninfo *var, struct fb_info *info) | ||
350 | { | 344 | { |
351 | struct intelfb_info *dinfo = GET_DINFO(info); | 345 | struct intelfb_info *dinfo = GET_DINFO(info); |
352 | u32 offset, xoffset, yoffset; | 346 | u32 offset, xoffset, yoffset; |
@@ -368,9 +362,10 @@ intelfbhw_pan_display(struct fb_var_screeninfo *var, struct fb_info *info) | |||
368 | offset += dinfo->fb.offset << 12; | 362 | offset += dinfo->fb.offset << 12; |
369 | 363 | ||
370 | dinfo->vsync.pan_offset = offset; | 364 | dinfo->vsync.pan_offset = offset; |
371 | if ((var->activate & FB_ACTIVATE_VBL) && !intelfbhw_enable_irq(dinfo, 0)) { | 365 | if ((var->activate & FB_ACTIVATE_VBL) && |
366 | !intelfbhw_enable_irq(dinfo, 0)) | ||
372 | dinfo->vsync.pan_display = 1; | 367 | dinfo->vsync.pan_display = 1; |
373 | } else { | 368 | else { |
374 | dinfo->vsync.pan_display = 0; | 369 | dinfo->vsync.pan_display = 0; |
375 | OUTREG(DSPABASE, offset); | 370 | OUTREG(DSPABASE, offset); |
376 | } | 371 | } |
@@ -379,8 +374,7 @@ intelfbhw_pan_display(struct fb_var_screeninfo *var, struct fb_info *info) | |||
379 | } | 374 | } |
380 | 375 | ||
381 | /* Blank the screen. */ | 376 | /* Blank the screen. */ |
382 | void | 377 | void intelfbhw_do_blank(int blank, struct fb_info *info) |
383 | intelfbhw_do_blank(int blank, struct fb_info *info) | ||
384 | { | 378 | { |
385 | struct intelfb_info *dinfo = GET_DINFO(info); | 379 | struct intelfb_info *dinfo = GET_DINFO(info); |
386 | u32 tmp; | 380 | u32 tmp; |
@@ -405,11 +399,10 @@ intelfbhw_do_blank(int blank, struct fb_info *info) | |||
405 | DBG_MSG("cursor_on is %d\n", dinfo->cursor_on); | 399 | DBG_MSG("cursor_on is %d\n", dinfo->cursor_on); |
406 | #endif | 400 | #endif |
407 | if (dinfo->cursor_on) { | 401 | if (dinfo->cursor_on) { |
408 | if (blank) { | 402 | if (blank) |
409 | intelfbhw_cursor_hide(dinfo); | 403 | intelfbhw_cursor_hide(dinfo); |
410 | } else { | 404 | else |
411 | intelfbhw_cursor_show(dinfo); | 405 | intelfbhw_cursor_show(dinfo); |
412 | } | ||
413 | dinfo->cursor_on = 1; | 406 | dinfo->cursor_on = 1; |
414 | } | 407 | } |
415 | dinfo->cursor_blanked = blank; | 408 | dinfo->cursor_blanked = blank; |
@@ -437,10 +430,9 @@ intelfbhw_do_blank(int blank, struct fb_info *info) | |||
437 | } | 430 | } |
438 | 431 | ||
439 | 432 | ||
440 | void | 433 | void intelfbhw_setcolreg(struct intelfb_info *dinfo, unsigned regno, |
441 | intelfbhw_setcolreg(struct intelfb_info *dinfo, unsigned regno, | 434 | unsigned red, unsigned green, unsigned blue, |
442 | unsigned red, unsigned green, unsigned blue, | 435 | unsigned transp) |
443 | unsigned transp) | ||
444 | { | 436 | { |
445 | #if VERBOSE > 0 | 437 | #if VERBOSE > 0 |
446 | DBG_MSG("intelfbhw_setcolreg: %d: (%d, %d, %d)\n", | 438 | DBG_MSG("intelfbhw_setcolreg: %d: (%d, %d, %d)\n", |
@@ -457,9 +449,8 @@ intelfbhw_setcolreg(struct intelfb_info *dinfo, unsigned regno, | |||
457 | } | 449 | } |
458 | 450 | ||
459 | 451 | ||
460 | int | 452 | int intelfbhw_read_hw_state(struct intelfb_info *dinfo, |
461 | intelfbhw_read_hw_state(struct intelfb_info *dinfo, struct intelfb_hwstate *hw, | 453 | struct intelfb_hwstate *hw, int flag) |
462 | int flag) | ||
463 | { | 454 | { |
464 | int i; | 455 | int i; |
465 | 456 | ||
@@ -606,7 +597,8 @@ static int calc_vclock3(int index, int m, int n, int p) | |||
606 | return plls[index].ref_clk * m / n / p; | 597 | return plls[index].ref_clk * m / n / p; |
607 | } | 598 | } |
608 | 599 | ||
609 | static int calc_vclock(int index, int m1, int m2, int n, int p1, int p2, int lvds) | 600 | static int calc_vclock(int index, int m1, int m2, int n, int p1, int p2, |
601 | int lvds) | ||
610 | { | 602 | { |
611 | struct pll_min_max *pll = &plls[index]; | 603 | struct pll_min_max *pll = &plls[index]; |
612 | u32 m, vco, p; | 604 | 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 | n += 2; | 607 | n += 2; |
616 | vco = pll->ref_clk * m / n; | 608 | vco = pll->ref_clk * m / n; |
617 | 609 | ||
618 | if (index == PLLS_I8xx) { | 610 | if (index == PLLS_I8xx) |
619 | p = ((p1 + 2) * (1 << (p2 + 1))); | 611 | p = ((p1 + 2) * (1 << (p2 + 1))); |
620 | } else { | 612 | else |
621 | p = ((p1) * (p2 ? 5 : 10)); | 613 | p = ((p1) * (p2 ? 5 : 10)); |
622 | } | ||
623 | return vco / p; | 614 | return vco / p; |
624 | } | 615 | } |
625 | 616 | ||
626 | #if REGDUMP | 617 | #if REGDUMP |
627 | static void | 618 | static void intelfbhw_get_p1p2(struct intelfb_info *dinfo, int dpll, |
628 | intelfbhw_get_p1p2(struct intelfb_info *dinfo, int dpll, int *o_p1, int *o_p2) | 619 | int *o_p1, int *o_p2) |
629 | { | 620 | { |
630 | int p1, p2; | 621 | int p1, p2; |
631 | 622 | ||
@@ -634,7 +625,7 @@ intelfbhw_get_p1p2(struct intelfb_info *dinfo, int dpll, int *o_p1, int *o_p2) | |||
634 | p1 = 1; | 625 | p1 = 1; |
635 | else | 626 | else |
636 | p1 = (dpll >> DPLL_P1_SHIFT) & 0xff; | 627 | p1 = (dpll >> DPLL_P1_SHIFT) & 0xff; |
637 | 628 | ||
638 | p1 = ffs(p1); | 629 | p1 = ffs(p1); |
639 | 630 | ||
640 | p2 = (dpll >> DPLL_I9XX_P2_SHIFT) & DPLL_P2_MASK; | 631 | 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 | #endif | 643 | #endif |
653 | 644 | ||
654 | 645 | ||
655 | void | 646 | void intelfbhw_print_hw_state(struct intelfb_info *dinfo, |
656 | intelfbhw_print_hw_state(struct intelfb_info *dinfo, struct intelfb_hwstate *hw) | 647 | struct intelfb_hwstate *hw) |
657 | { | 648 | { |
658 | #if REGDUMP | 649 | #if REGDUMP |
659 | int i, m1, m2, n, p1, p2; | 650 | int i, m1, m2, n, p1, p2; |
@@ -666,7 +657,7 @@ intelfbhw_print_hw_state(struct intelfb_info *dinfo, struct intelfb_hwstate *hw) | |||
666 | printk("hw state dump start\n"); | 657 | printk("hw state dump start\n"); |
667 | printk(" VGA0_DIVISOR: 0x%08x\n", hw->vga0_divisor); | 658 | printk(" VGA0_DIVISOR: 0x%08x\n", hw->vga0_divisor); |
668 | printk(" VGA1_DIVISOR: 0x%08x\n", hw->vga1_divisor); | 659 | printk(" VGA1_DIVISOR: 0x%08x\n", hw->vga1_divisor); |
669 | printk(" VGAPD: 0x%08x\n", hw->vga_pd); | 660 | printk(" VGAPD: 0x%08x\n", hw->vga_pd); |
670 | n = (hw->vga0_divisor >> FP_N_DIVISOR_SHIFT) & FP_DIVISOR_MASK; | 661 | n = (hw->vga0_divisor >> FP_N_DIVISOR_SHIFT) & FP_DIVISOR_MASK; |
671 | m1 = (hw->vga0_divisor >> FP_M1_DIVISOR_SHIFT) & FP_DIVISOR_MASK; | 662 | m1 = (hw->vga0_divisor >> FP_M1_DIVISOR_SHIFT) & FP_DIVISOR_MASK; |
672 | m2 = (hw->vga0_divisor >> FP_M2_DIVISOR_SHIFT) & FP_DIVISOR_MASK; | 663 | 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 | intelfbhw_get_p1p2(dinfo, hw->vga_pd, &p1, &p2); | 676 | intelfbhw_get_p1p2(dinfo, hw->vga_pd, &p1, &p2); |
686 | printk(" VGA1: (m1, m2, n, p1, p2) = (%d, %d, %d, %d, %d)\n", | 677 | printk(" VGA1: (m1, m2, n, p1, p2) = (%d, %d, %d, %d, %d)\n", |
687 | m1, m2, n, p1, p2); | 678 | m1, m2, n, p1, p2); |
688 | printk(" VGA1: clock is %d\n", calc_vclock(index, m1, m2, n, p1, p2, 0)); | 679 | printk(" VGA1: clock is %d\n", |
680 | calc_vclock(index, m1, m2, n, p1, p2, 0)); | ||
689 | 681 | ||
690 | printk(" DPLL_A: 0x%08x\n", hw->dpll_a); | 682 | printk(" DPLL_A: 0x%08x\n", hw->dpll_a); |
691 | printk(" DPLL_B: 0x%08x\n", hw->dpll_b); | 683 | 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 | 694 | ||
703 | printk(" PLLA0: (m1, m2, n, p1, p2) = (%d, %d, %d, %d, %d)\n", | 695 | printk(" PLLA0: (m1, m2, n, p1, p2) = (%d, %d, %d, %d, %d)\n", |
704 | m1, m2, n, p1, p2); | 696 | m1, m2, n, p1, p2); |
705 | printk(" PLLA0: clock is %d\n", calc_vclock(index, m1, m2, n, p1, p2, 0)); | 697 | printk(" PLLA0: clock is %d\n", |
698 | calc_vclock(index, m1, m2, n, p1, p2, 0)); | ||
706 | 699 | ||
707 | n = (hw->fpa1 >> FP_N_DIVISOR_SHIFT) & FP_DIVISOR_MASK; | 700 | n = (hw->fpa1 >> FP_N_DIVISOR_SHIFT) & FP_DIVISOR_MASK; |
708 | m1 = (hw->fpa1 >> FP_M1_DIVISOR_SHIFT) & FP_DIVISOR_MASK; | 701 | 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 | 705 | ||
713 | printk(" PLLA1: (m1, m2, n, p1, p2) = (%d, %d, %d, %d, %d)\n", | 706 | printk(" PLLA1: (m1, m2, n, p1, p2) = (%d, %d, %d, %d, %d)\n", |
714 | m1, m2, n, p1, p2); | 707 | m1, m2, n, p1, p2); |
715 | printk(" PLLA1: clock is %d\n", calc_vclock(index, m1, m2, n, p1, p2, 0)); | 708 | printk(" PLLA1: clock is %d\n", |
709 | calc_vclock(index, m1, m2, n, p1, p2, 0)); | ||
716 | 710 | ||
717 | #if 0 | 711 | #if 0 |
718 | printk(" PALETTE_A:\n"); | 712 | printk(" PALETTE_A:\n"); |
@@ -817,8 +811,8 @@ intelfbhw_print_hw_state(struct intelfb_info *dinfo, struct intelfb_hwstate *hw) | |||
817 | 811 | ||
818 | 812 | ||
819 | /* Split the M parameter into M1 and M2. */ | 813 | /* Split the M parameter into M1 and M2. */ |
820 | static int | 814 | static int splitm(int index, unsigned int m, unsigned int *retm1, |
821 | splitm(int index, unsigned int m, unsigned int *retm1, unsigned int *retm2) | 815 | unsigned int *retm2) |
822 | { | 816 | { |
823 | int m1, m2; | 817 | int m1, m2; |
824 | int testm; | 818 | int testm; |
@@ -839,8 +833,8 @@ splitm(int index, unsigned int m, unsigned int *retm1, unsigned int *retm2) | |||
839 | } | 833 | } |
840 | 834 | ||
841 | /* Split the P parameter into P1 and P2. */ | 835 | /* Split the P parameter into P1 and P2. */ |
842 | static int | 836 | static int splitp(int index, unsigned int p, unsigned int *retp1, |
843 | splitp(int index, unsigned int p, unsigned int *retp1, unsigned int *retp2) | 837 | unsigned int *retp2) |
844 | { | 838 | { |
845 | int p1, p2; | 839 | int p1, p2; |
846 | struct pll_min_max *pll = &plls[index]; | 840 | struct pll_min_max *pll = &plls[index]; |
@@ -874,9 +868,8 @@ splitp(int index, unsigned int p, unsigned int *retp1, unsigned int *retp2) | |||
874 | } | 868 | } |
875 | } | 869 | } |
876 | 870 | ||
877 | static int | 871 | static int calc_pll_params(int index, int clock, u32 *retm1, u32 *retm2, |
878 | calc_pll_params(int index, int clock, u32 *retm1, u32 *retm2, u32 *retn, u32 *retp1, | 872 | u32 *retn, u32 *retp1, u32 *retp2, u32 *retclock) |
879 | u32 *retp2, u32 *retclock) | ||
880 | { | 873 | { |
881 | u32 m1, m2, n, p1, p2, n1, testm; | 874 | u32 m1, m2, n, p1, p2, n1, testm; |
882 | u32 f_vco, p, p_best = 0, m, f_out = 0; | 875 | 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 | return 0; | 964 | return 0; |
972 | } | 965 | } |
973 | 966 | ||
974 | static __inline__ int | 967 | static __inline__ int check_overflow(u32 value, u32 limit, |
975 | check_overflow(u32 value, u32 limit, const char *description) | 968 | const char *description) |
976 | { | 969 | { |
977 | if (value > limit) { | 970 | if (value > limit) { |
978 | WRN_MSG("%s value %d exceeds limit %d\n", | 971 | WRN_MSG("%s value %d exceeds limit %d\n", |
@@ -983,9 +976,9 @@ check_overflow(u32 value, u32 limit, const char *description) | |||
983 | } | 976 | } |
984 | 977 | ||
985 | /* It is assumed that hw is filled in with the initial state information. */ | 978 | /* It is assumed that hw is filled in with the initial state information. */ |
986 | int | 979 | int intelfbhw_mode_to_hw(struct intelfb_info *dinfo, |
987 | intelfbhw_mode_to_hw(struct intelfb_info *dinfo, struct intelfb_hwstate *hw, | 980 | struct intelfb_hwstate *hw, |
988 | struct fb_var_screeninfo *var) | 981 | struct fb_var_screeninfo *var) |
989 | { | 982 | { |
990 | int pipe = PIPE_A; | 983 | int pipe = PIPE_A; |
991 | u32 *dpll, *fp0, *fp1; | 984 | u32 *dpll, *fp0, *fp1; |
@@ -1089,9 +1082,8 @@ intelfbhw_mode_to_hw(struct intelfb_info *dinfo, struct intelfb_hwstate *hw, | |||
1089 | if (IS_I9XX(dinfo)) { | 1082 | if (IS_I9XX(dinfo)) { |
1090 | *dpll |= (p2 << DPLL_I9XX_P2_SHIFT); | 1083 | *dpll |= (p2 << DPLL_I9XX_P2_SHIFT); |
1091 | *dpll |= (1 << (p1 - 1)) << DPLL_P1_SHIFT; | 1084 | *dpll |= (1 << (p1 - 1)) << DPLL_P1_SHIFT; |
1092 | } else { | 1085 | } else |
1093 | *dpll |= (p2 << DPLL_P2_SHIFT) | (p1 << DPLL_P1_SHIFT); | 1086 | *dpll |= (p2 << DPLL_P2_SHIFT) | (p1 << DPLL_P1_SHIFT); |
1094 | } | ||
1095 | 1087 | ||
1096 | *fp0 = (n << FP_N_DIVISOR_SHIFT) | | 1088 | *fp0 = (n << FP_N_DIVISOR_SHIFT) | |
1097 | (m1 << FP_M1_DIVISOR_SHIFT) | | 1089 | (m1 << FP_M1_DIVISOR_SHIFT) | |
@@ -1226,9 +1218,8 @@ intelfbhw_mode_to_hw(struct intelfb_info *dinfo, struct intelfb_hwstate *hw, | |||
1226 | } | 1218 | } |
1227 | 1219 | ||
1228 | /* Program a (non-VGA) video mode. */ | 1220 | /* Program a (non-VGA) video mode. */ |
1229 | int | 1221 | int intelfbhw_program_mode(struct intelfb_info *dinfo, |
1230 | intelfbhw_program_mode(struct intelfb_info *dinfo, | 1222 | const struct intelfb_hwstate *hw, int blank) |
1231 | const struct intelfb_hwstate *hw, int blank) | ||
1232 | { | 1223 | { |
1233 | int pipe = PIPE_A; | 1224 | int pipe = PIPE_A; |
1234 | u32 tmp; | 1225 | u32 tmp; |
@@ -1324,7 +1315,7 @@ intelfbhw_program_mode(struct intelfb_info *dinfo, | |||
1324 | tmp &= ~PIPECONF_ENABLE; | 1315 | tmp &= ~PIPECONF_ENABLE; |
1325 | OUTREG(pipe_conf_reg, tmp); | 1316 | OUTREG(pipe_conf_reg, tmp); |
1326 | } | 1317 | } |
1327 | } while(count < 2000); | 1318 | } while (count < 2000); |
1328 | 1319 | ||
1329 | OUTREG(ADPA, INREG(ADPA) & ~ADPA_DAC_ENABLE); | 1320 | OUTREG(ADPA, INREG(ADPA) & ~ADPA_DAC_ENABLE); |
1330 | 1321 | ||
@@ -1448,8 +1439,7 @@ static u32 get_ring_space(struct intelfb_info *dinfo) | |||
1448 | return ring_space; | 1439 | return ring_space; |
1449 | } | 1440 | } |
1450 | 1441 | ||
1451 | static int | 1442 | static int wait_ring(struct intelfb_info *dinfo, int n) |
1452 | wait_ring(struct intelfb_info *dinfo, int n) | ||
1453 | { | 1443 | { |
1454 | int i = 0; | 1444 | int i = 0; |
1455 | unsigned long end; | 1445 | unsigned long end; |
@@ -1491,16 +1481,15 @@ wait_ring(struct intelfb_info *dinfo, int n) | |||
1491 | return i; | 1481 | return i; |
1492 | } | 1482 | } |
1493 | 1483 | ||
1494 | static void | 1484 | static void do_flush(struct intelfb_info *dinfo) |
1495 | do_flush(struct intelfb_info *dinfo) { | 1485 | { |
1496 | START_RING(2); | 1486 | START_RING(2); |
1497 | OUT_RING(MI_FLUSH | MI_WRITE_DIRTY_STATE | MI_INVALIDATE_MAP_CACHE); | 1487 | OUT_RING(MI_FLUSH | MI_WRITE_DIRTY_STATE | MI_INVALIDATE_MAP_CACHE); |
1498 | OUT_RING(MI_NOOP); | 1488 | OUT_RING(MI_NOOP); |
1499 | ADVANCE_RING(); | 1489 | ADVANCE_RING(); |
1500 | } | 1490 | } |
1501 | 1491 | ||
1502 | void | 1492 | void intelfbhw_do_sync(struct intelfb_info *dinfo) |
1503 | intelfbhw_do_sync(struct intelfb_info *dinfo) | ||
1504 | { | 1493 | { |
1505 | #if VERBOSE > 0 | 1494 | #if VERBOSE > 0 |
1506 | DBG_MSG("intelfbhw_do_sync\n"); | 1495 | DBG_MSG("intelfbhw_do_sync\n"); |
@@ -1519,8 +1508,7 @@ intelfbhw_do_sync(struct intelfb_info *dinfo) | |||
1519 | dinfo->ring_space = dinfo->ring.size - RING_MIN_FREE; | 1508 | dinfo->ring_space = dinfo->ring.size - RING_MIN_FREE; |
1520 | } | 1509 | } |
1521 | 1510 | ||
1522 | static void | 1511 | static void refresh_ring(struct intelfb_info *dinfo) |
1523 | refresh_ring(struct intelfb_info *dinfo) | ||
1524 | { | 1512 | { |
1525 | #if VERBOSE > 0 | 1513 | #if VERBOSE > 0 |
1526 | DBG_MSG("refresh_ring\n"); | 1514 | DBG_MSG("refresh_ring\n"); |
@@ -1531,8 +1519,7 @@ refresh_ring(struct intelfb_info *dinfo) | |||
1531 | dinfo->ring_space = get_ring_space(dinfo); | 1519 | dinfo->ring_space = get_ring_space(dinfo); |
1532 | } | 1520 | } |
1533 | 1521 | ||
1534 | static void | 1522 | static void reset_state(struct intelfb_info *dinfo) |
1535 | reset_state(struct intelfb_info *dinfo) | ||
1536 | { | 1523 | { |
1537 | int i; | 1524 | int i; |
1538 | u32 tmp; | 1525 | u32 tmp; |
@@ -1562,12 +1549,11 @@ reset_state(struct intelfb_info *dinfo) | |||
1562 | } | 1549 | } |
1563 | 1550 | ||
1564 | /* Stop the 2D engine, and turn off the ring buffer. */ | 1551 | /* Stop the 2D engine, and turn off the ring buffer. */ |
1565 | void | 1552 | void intelfbhw_2d_stop(struct intelfb_info *dinfo) |
1566 | intelfbhw_2d_stop(struct intelfb_info *dinfo) | ||
1567 | { | 1553 | { |
1568 | #if VERBOSE > 0 | 1554 | #if VERBOSE > 0 |
1569 | DBG_MSG("intelfbhw_2d_stop: accel: %d, ring_active: %d\n", dinfo->accel, | 1555 | DBG_MSG("intelfbhw_2d_stop: accel: %d, ring_active: %d\n", |
1570 | dinfo->ring_active); | 1556 | dinfo->accel, dinfo->ring_active); |
1571 | #endif | 1557 | #endif |
1572 | 1558 | ||
1573 | if (!dinfo->accel) | 1559 | if (!dinfo->accel) |
@@ -1582,8 +1568,7 @@ intelfbhw_2d_stop(struct intelfb_info *dinfo) | |||
1582 | * It is assumed that the graphics engine has been stopped by previously | 1568 | * It is assumed that the graphics engine has been stopped by previously |
1583 | * calling intelfb_2d_stop(). | 1569 | * calling intelfb_2d_stop(). |
1584 | */ | 1570 | */ |
1585 | void | 1571 | void intelfbhw_2d_start(struct intelfb_info *dinfo) |
1586 | intelfbhw_2d_start(struct intelfb_info *dinfo) | ||
1587 | { | 1572 | { |
1588 | #if VERBOSE > 0 | 1573 | #if VERBOSE > 0 |
1589 | DBG_MSG("intelfbhw_2d_start: accel: %d, ring_active: %d\n", | 1574 | DBG_MSG("intelfbhw_2d_start: accel: %d, ring_active: %d\n", |
@@ -1607,9 +1592,8 @@ intelfbhw_2d_start(struct intelfb_info *dinfo) | |||
1607 | } | 1592 | } |
1608 | 1593 | ||
1609 | /* 2D fillrect (solid fill or invert) */ | 1594 | /* 2D fillrect (solid fill or invert) */ |
1610 | void | 1595 | void intelfbhw_do_fillrect(struct intelfb_info *dinfo, u32 x, u32 y, u32 w, |
1611 | intelfbhw_do_fillrect(struct intelfb_info *dinfo, u32 x, u32 y, u32 w, u32 h, | 1596 | u32 h, u32 color, u32 pitch, u32 bpp, u32 rop) |
1612 | u32 color, u32 pitch, u32 bpp, u32 rop) | ||
1613 | { | 1597 | { |
1614 | u32 br00, br09, br13, br14, br16; | 1598 | u32 br00, br09, br13, br14, br16; |
1615 | 1599 | ||
@@ -1698,9 +1682,9 @@ intelfbhw_do_bitblt(struct intelfb_info *dinfo, u32 curx, u32 cury, | |||
1698 | ADVANCE_RING(); | 1682 | ADVANCE_RING(); |
1699 | } | 1683 | } |
1700 | 1684 | ||
1701 | int | 1685 | int intelfbhw_do_drawglyph(struct intelfb_info *dinfo, u32 fg, u32 bg, u32 w, |
1702 | intelfbhw_do_drawglyph(struct intelfb_info *dinfo, u32 fg, u32 bg, u32 w, | 1686 | u32 h, const u8* cdat, u32 x, u32 y, u32 pitch, |
1703 | u32 h, const u8* cdat, u32 x, u32 y, u32 pitch, u32 bpp) | 1687 | u32 bpp) |
1704 | { | 1688 | { |
1705 | int nbytes, ndwords, pad, tmp; | 1689 | int nbytes, ndwords, pad, tmp; |
1706 | u32 br00, br09, br13, br18, br19, br22, br23; | 1690 | 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 | } | 1771 | } |
1788 | 1772 | ||
1789 | /* HW cursor functions. */ | 1773 | /* HW cursor functions. */ |
1790 | void | 1774 | void intelfbhw_cursor_init(struct intelfb_info *dinfo) |
1791 | intelfbhw_cursor_init(struct intelfb_info *dinfo) | ||
1792 | { | 1775 | { |
1793 | u32 tmp; | 1776 | u32 tmp; |
1794 | 1777 | ||
@@ -1819,8 +1802,7 @@ intelfbhw_cursor_init(struct intelfb_info *dinfo) | |||
1819 | } | 1802 | } |
1820 | } | 1803 | } |
1821 | 1804 | ||
1822 | void | 1805 | void intelfbhw_cursor_hide(struct intelfb_info *dinfo) |
1823 | intelfbhw_cursor_hide(struct intelfb_info *dinfo) | ||
1824 | { | 1806 | { |
1825 | u32 tmp; | 1807 | u32 tmp; |
1826 | 1808 | ||
@@ -1845,8 +1827,7 @@ intelfbhw_cursor_hide(struct intelfb_info *dinfo) | |||
1845 | } | 1827 | } |
1846 | } | 1828 | } |
1847 | 1829 | ||
1848 | void | 1830 | void intelfbhw_cursor_show(struct intelfb_info *dinfo) |
1849 | intelfbhw_cursor_show(struct intelfb_info *dinfo) | ||
1850 | { | 1831 | { |
1851 | u32 tmp; | 1832 | u32 tmp; |
1852 | 1833 | ||
@@ -1875,8 +1856,7 @@ intelfbhw_cursor_show(struct intelfb_info *dinfo) | |||
1875 | } | 1856 | } |
1876 | } | 1857 | } |
1877 | 1858 | ||
1878 | void | 1859 | void intelfbhw_cursor_setpos(struct intelfb_info *dinfo, int x, int y) |
1879 | intelfbhw_cursor_setpos(struct intelfb_info *dinfo, int x, int y) | ||
1880 | { | 1860 | { |
1881 | u32 tmp; | 1861 | u32 tmp; |
1882 | 1862 | ||
@@ -1894,13 +1874,11 @@ intelfbhw_cursor_setpos(struct intelfb_info *dinfo, int x, int y) | |||
1894 | ((y & CURSOR_POS_MASK) << CURSOR_Y_SHIFT); | 1874 | ((y & CURSOR_POS_MASK) << CURSOR_Y_SHIFT); |
1895 | OUTREG(CURSOR_A_POSITION, tmp); | 1875 | OUTREG(CURSOR_A_POSITION, tmp); |
1896 | 1876 | ||
1897 | if (IS_I9XX(dinfo)) { | 1877 | if (IS_I9XX(dinfo)) |
1898 | OUTREG(CURSOR_A_BASEADDR, dinfo->cursor.physical); | 1878 | OUTREG(CURSOR_A_BASEADDR, dinfo->cursor.physical); |
1899 | } | ||
1900 | } | 1879 | } |
1901 | 1880 | ||
1902 | void | 1881 | void intelfbhw_cursor_setcolor(struct intelfb_info *dinfo, u32 bg, u32 fg) |
1903 | intelfbhw_cursor_setcolor(struct intelfb_info *dinfo, u32 bg, u32 fg) | ||
1904 | { | 1882 | { |
1905 | #if VERBOSE > 0 | 1883 | #if VERBOSE > 0 |
1906 | DBG_MSG("intelfbhw_cursor_setcolor\n"); | 1884 | DBG_MSG("intelfbhw_cursor_setcolor\n"); |
@@ -1912,9 +1890,8 @@ intelfbhw_cursor_setcolor(struct intelfb_info *dinfo, u32 bg, u32 fg) | |||
1912 | OUTREG(CURSOR_A_PALETTE3, bg & CURSOR_PALETTE_MASK); | 1890 | OUTREG(CURSOR_A_PALETTE3, bg & CURSOR_PALETTE_MASK); |
1913 | } | 1891 | } |
1914 | 1892 | ||
1915 | void | 1893 | void intelfbhw_cursor_load(struct intelfb_info *dinfo, int width, int height, |
1916 | intelfbhw_cursor_load(struct intelfb_info *dinfo, int width, int height, | 1894 | u8 *data) |
1917 | u8 *data) | ||
1918 | { | 1895 | { |
1919 | u8 __iomem *addr = (u8 __iomem *)dinfo->cursor.virtual; | 1896 | u8 __iomem *addr = (u8 __iomem *)dinfo->cursor.virtual; |
1920 | int i, j, w = width / 8; | 1897 | int i, j, w = width / 8; |
@@ -1942,8 +1919,8 @@ intelfbhw_cursor_load(struct intelfb_info *dinfo, int width, int height, | |||
1942 | } | 1919 | } |
1943 | } | 1920 | } |
1944 | 1921 | ||
1945 | void | 1922 | void intelfbhw_cursor_reset(struct intelfb_info *dinfo) |
1946 | intelfbhw_cursor_reset(struct intelfb_info *dinfo) { | 1923 | { |
1947 | u8 __iomem *addr = (u8 __iomem *)dinfo->cursor.virtual; | 1924 | u8 __iomem *addr = (u8 __iomem *)dinfo->cursor.virtual; |
1948 | int i, j; | 1925 | int i, j; |
1949 | 1926 | ||
@@ -2047,8 +2024,8 @@ intelfbhw_disable_irq(struct intelfb_info *dinfo) { | |||
2047 | } | 2024 | } |
2048 | } | 2025 | } |
2049 | 2026 | ||
2050 | int | 2027 | int intelfbhw_wait_for_vsync(struct intelfb_info *dinfo, u32 pipe) |
2051 | intelfbhw_wait_for_vsync(struct intelfb_info *dinfo, u32 pipe) { | 2028 | { |
2052 | struct intelfb_vsync *vsync; | 2029 | struct intelfb_vsync *vsync; |
2053 | unsigned int count; | 2030 | unsigned int count; |
2054 | int ret; | 2031 | int ret; |
@@ -2062,15 +2039,14 @@ intelfbhw_wait_for_vsync(struct intelfb_info *dinfo, u32 pipe) { | |||
2062 | } | 2039 | } |
2063 | 2040 | ||
2064 | ret = intelfbhw_enable_irq(dinfo, 0); | 2041 | ret = intelfbhw_enable_irq(dinfo, 0); |
2065 | if (ret) { | 2042 | if (ret) |
2066 | return ret; | 2043 | return ret; |
2067 | } | ||
2068 | 2044 | ||
2069 | count = vsync->count; | 2045 | count = vsync->count; |
2070 | ret = wait_event_interruptible_timeout(vsync->wait, count != vsync->count, HZ/10); | 2046 | ret = wait_event_interruptible_timeout(vsync->wait, |
2071 | if (ret < 0) { | 2047 | count != vsync->count, HZ / 10); |
2048 | if (ret < 0) | ||
2072 | return ret; | 2049 | return ret; |
2073 | } | ||
2074 | if (ret == 0) { | 2050 | if (ret == 0) { |
2075 | intelfbhw_enable_irq(dinfo, 1); | 2051 | intelfbhw_enable_irq(dinfo, 1); |
2076 | DBG_MSG("wait_for_vsync timed out!\n"); | 2052 | DBG_MSG("wait_for_vsync timed out!\n"); |
diff --git a/drivers/video/intelfb/intelfbhw.h b/drivers/video/intelfb/intelfbhw.h index cfcd53749484..1a4df251b540 100644 --- a/drivers/video/intelfb/intelfbhw.h +++ b/drivers/video/intelfb/intelfbhw.h | |||
@@ -83,7 +83,7 @@ | |||
83 | */ | 83 | */ |
84 | #define RING_MIN_FREE 64 | 84 | #define RING_MIN_FREE 64 |
85 | 85 | ||
86 | #define IPEHR 0x2088 | 86 | #define IPEHR 0x2088 |
87 | 87 | ||
88 | #define INSTDONE 0x2090 | 88 | #define INSTDONE 0x2090 |
89 | #define PRI_RING_EMPTY 1 | 89 | #define PRI_RING_EMPTY 1 |
@@ -128,9 +128,9 @@ | |||
128 | 128 | ||
129 | #define GPIOA 0x5010 | 129 | #define GPIOA 0x5010 |
130 | #define GPIOB 0x5014 | 130 | #define GPIOB 0x5014 |
131 | #define GPIOC 0x5018 // this may be external DDC on i830 | 131 | #define GPIOC 0x5018 /* this may be external DDC on i830 */ |
132 | #define GPIOD 0x501C // this is DVO DDC | 132 | #define GPIOD 0x501C /* this is DVO DDC */ |
133 | #define GPIOE 0x5020 // this is DVO i2C | 133 | #define GPIOE 0x5020 /* this is DVO i2C */ |
134 | #define GPIOF 0x5024 | 134 | #define GPIOF 0x5024 |
135 | 135 | ||
136 | /* PLL registers */ | 136 | /* PLL registers */ |
@@ -269,8 +269,8 @@ | |||
269 | #define PORT_ENABLE (1 << 31) | 269 | #define PORT_ENABLE (1 << 31) |
270 | #define PORT_PIPE_SELECT_SHIFT 30 | 270 | #define PORT_PIPE_SELECT_SHIFT 30 |
271 | #define PORT_TV_FLAGS_MASK 0xFF | 271 | #define PORT_TV_FLAGS_MASK 0xFF |
272 | #define PORT_TV_FLAGS 0xC4 // ripped from my BIOS | 272 | #define PORT_TV_FLAGS 0xC4 /* ripped from my BIOS |
273 | // to understand and correct | 273 | to understand and correct */ |
274 | 274 | ||
275 | #define DVOA_SRCDIM 0x61124 | 275 | #define DVOA_SRCDIM 0x61124 |
276 | #define DVOB_SRCDIM 0x61144 | 276 | #define DVOB_SRCDIM 0x61144 |
@@ -369,7 +369,7 @@ | |||
369 | #define DISPPLANE_8BPP (0x2<<26) | 369 | #define DISPPLANE_8BPP (0x2<<26) |
370 | #define DISPPLANE_15_16BPP (0x4<<26) | 370 | #define DISPPLANE_15_16BPP (0x4<<26) |
371 | #define DISPPLANE_16BPP (0x5<<26) | 371 | #define DISPPLANE_16BPP (0x5<<26) |
372 | #define DISPPLANE_32BPP_NO_ALPHA (0x6<<26) | 372 | #define DISPPLANE_32BPP_NO_ALPHA (0x6<<26) |
373 | #define DISPPLANE_32BPP (0x7<<26) | 373 | #define DISPPLANE_32BPP (0x7<<26) |
374 | #define DISPPLANE_STEREO_ENABLE (1<<25) | 374 | #define DISPPLANE_STEREO_ENABLE (1<<25) |
375 | #define DISPPLANE_STEREO_DISABLE 0 | 375 | #define DISPPLANE_STEREO_DISABLE 0 |