aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/intelfb/intelfbdrv.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2006-09-30 12:36:56 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-09-30 12:36:56 -0400
commitdb1a19b38f3a85f475b4ad716c71be133d8ca48e (patch)
treecdc0599c20b52a472254720890727a3d9fbde957 /drivers/video/intelfb/intelfbdrv.c
parent369aa8395a5dcc89230f1de5459124c4b0db9fca (diff)
parent4dc3595f5c569021b1bd0109502acfca82036902 (diff)
Merge branch 'intelfb-patches' of master.kernel.org:/pub/scm/linux/kernel/git/airlied/intelfb-2.6
* 'intelfb-patches' of master.kernel.org:/pub/scm/linux/kernel/git/airlied/intelfb-2.6: intelfbhw.c: intelfbhw_get_p1p2 defined but not used intelfb: fix mtrr_reg signedness intelfb: update doc and Kconfig (supported devices) intelfb: add preliminary i2c support intelfb: add preliminary i2c support intelfb: add preliminary i2c support intelfb: add preliminary i2c support intelfb: add preliminary i2c support intelfb: add preliminary i2c support intelfb: add preliminary i2c support intelfb: add preliminary i2c support intelfb: add vsync interrupt support intelfb: add vsync interrupt support intelfb: add vsync interrupt support intelfb: add vsync interrupt support intelfb: add vsync interrupt support
Diffstat (limited to 'drivers/video/intelfb/intelfbdrv.c')
-rw-r--r--drivers/video/intelfb/intelfbdrv.c64
1 files changed, 64 insertions, 0 deletions
diff --git a/drivers/video/intelfb/intelfbdrv.c b/drivers/video/intelfb/intelfbdrv.c
index 06af89d44a0d..6f9de04193d2 100644
--- a/drivers/video/intelfb/intelfbdrv.c
+++ b/drivers/video/intelfb/intelfbdrv.c
@@ -136,6 +136,8 @@
136static void __devinit get_initial_mode(struct intelfb_info *dinfo); 136static void __devinit get_initial_mode(struct intelfb_info *dinfo);
137static void update_dinfo(struct intelfb_info *dinfo, 137static void update_dinfo(struct intelfb_info *dinfo,
138 struct fb_var_screeninfo *var); 138 struct fb_var_screeninfo *var);
139static int intelfb_open(struct fb_info *info, int user);
140static int intelfb_release(struct fb_info *info, int user);
139static int intelfb_check_var(struct fb_var_screeninfo *var, 141static int intelfb_check_var(struct fb_var_screeninfo *var,
140 struct fb_info *info); 142 struct fb_info *info);
141static int intelfb_set_par(struct fb_info *info); 143static int intelfb_set_par(struct fb_info *info);
@@ -194,6 +196,8 @@ static int num_registered = 0;
194/* fb ops */ 196/* fb ops */
195static struct fb_ops intel_fb_ops = { 197static struct fb_ops intel_fb_ops = {
196 .owner = THIS_MODULE, 198 .owner = THIS_MODULE,
199 .fb_open = intelfb_open,
200 .fb_release = intelfb_release,
197 .fb_check_var = intelfb_check_var, 201 .fb_check_var = intelfb_check_var,
198 .fb_set_par = intelfb_set_par, 202 .fb_set_par = intelfb_set_par,
199 .fb_setcolreg = intelfb_setcolreg, 203 .fb_setcolreg = intelfb_setcolreg,
@@ -446,6 +450,8 @@ cleanup(struct intelfb_info *dinfo)
446 if (!dinfo) 450 if (!dinfo)
447 return; 451 return;
448 452
453 intelfbhw_disable_irq(dinfo);
454
449 fb_dealloc_cmap(&dinfo->info->cmap); 455 fb_dealloc_cmap(&dinfo->info->cmap);
450 kfree(dinfo->info->pixmap.addr); 456 kfree(dinfo->info->pixmap.addr);
451 457
@@ -467,6 +473,11 @@ cleanup(struct intelfb_info *dinfo)
467 agp_free_memory(dinfo->gtt_ring_mem); 473 agp_free_memory(dinfo->gtt_ring_mem);
468 } 474 }
469 475
476#ifdef CONFIG_FB_INTEL_I2C
477 /* un-register I2C bus */
478 intelfb_delete_i2c_busses(dinfo);
479#endif
480
470 if (dinfo->mmio_base) 481 if (dinfo->mmio_base)
471 iounmap((void __iomem *)dinfo->mmio_base); 482 iounmap((void __iomem *)dinfo->mmio_base);
472 if (dinfo->aperture.virtual) 483 if (dinfo->aperture.virtual)
@@ -844,6 +855,11 @@ intelfb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent)
844 if (bailearly == 5) 855 if (bailearly == 5)
845 bailout(dinfo); 856 bailout(dinfo);
846 857
858#ifdef CONFIG_FB_INTEL_I2C
859 /* register I2C bus */
860 intelfb_create_i2c_busses(dinfo);
861#endif
862
847 if (bailearly == 6) 863 if (bailearly == 6)
848 bailout(dinfo); 864 bailout(dinfo);
849 865
@@ -888,6 +904,13 @@ intelfb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent)
888 } 904 }
889 905
890 dinfo->registered = 1; 906 dinfo->registered = 1;
907 dinfo->open = 0;
908
909 init_waitqueue_head(&dinfo->vsync.wait);
910 spin_lock_init(&dinfo->int_lock);
911 dinfo->irq_flags = 0;
912 dinfo->vsync.pan_display = 0;
913 dinfo->vsync.pan_offset = 0;
891 914
892 return 0; 915 return 0;
893 916
@@ -1188,6 +1211,34 @@ update_dinfo(struct intelfb_info *dinfo, struct fb_var_screeninfo *var)
1188 ***************************************************************/ 1211 ***************************************************************/
1189 1212
1190static int 1213static int
1214intelfb_open(struct fb_info *info, int user)
1215{
1216 struct intelfb_info *dinfo = GET_DINFO(info);
1217
1218 if (user) {
1219 dinfo->open++;
1220 }
1221
1222 return 0;
1223}
1224
1225static int
1226intelfb_release(struct fb_info *info, int user)
1227{
1228 struct intelfb_info *dinfo = GET_DINFO(info);
1229
1230 if (user) {
1231 dinfo->open--;
1232 msleep(1);
1233 if (!dinfo->open) {
1234 intelfbhw_disable_irq(dinfo);
1235 }
1236 }
1237
1238 return 0;
1239}
1240
1241static int
1191intelfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) 1242intelfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
1192{ 1243{
1193 int change_var = 0; 1244 int change_var = 0;
@@ -1433,6 +1484,19 @@ static int
1433intelfb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg) 1484intelfb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg)
1434{ 1485{
1435 int retval = 0; 1486 int retval = 0;
1487 struct intelfb_info *dinfo = GET_DINFO(info);
1488 u32 pipe = 0;
1489
1490 switch (cmd) {
1491 case FBIO_WAITFORVSYNC:
1492 if (get_user(pipe, (__u32 __user *)arg))
1493 return -EFAULT;
1494
1495 retval = intelfbhw_wait_for_vsync(dinfo, pipe);
1496 break;
1497 default:
1498 break;
1499 }
1436 1500
1437 return retval; 1501 return retval;
1438} 1502}