diff mbox

[13/14] davinci: video: davincifb Added operation in order to turn on/off hw in platform management

Message ID 1276251594-5936-13-git-send-email-lamiaposta71@gmail.com (mailing list archive)
State Changes Requested
Headers show

Commit Message

Raffaele Recalcati June 11, 2010, 10:19 a.m. UTC
None
diff mbox

Patch

diff --git a/drivers/video/davincifb.c b/drivers/video/davincifb.c
index dabee4d..2a7b2c9 100644
--- a/drivers/video/davincifb.c
+++ b/drivers/video/davincifb.c
@@ -904,6 +904,19 @@  static int davincifb_pan_display(struct fb_var_screeninfo *var,
  */
 static int davincifb_blank(int blank_mode, struct fb_info *info)
 {
+	if (blank_mode == 4) {
+		dm->output_device_config(0);
+		dm->ops->davincifb_power(&dm->osd0->info, 0);
+		dm->ops->davincifb_power(&dm->osd1->info, 0);
+		dm->ops->davincifb_power(&dm->vid0->info, 0);
+		dm->ops->davincifb_power(&dm->vid1->info, 0);
+	} else if (!blank_mode) {
+		dm->output_device_config(1);
+		dm->ops->davincifb_power(&dm->osd0->info, 1);
+		dm->ops->davincifb_power(&dm->osd1->info, 1);
+		dm->ops->davincifb_power(&dm->vid0->info, 1);
+		dm->ops->davincifb_power(&dm->vid1->info, 1);
+	}
 	return 0;
 }
 
@@ -1416,6 +1429,10 @@  static int davincifb_remove(struct platform_device *pdev)
 
 	/* Turn OFF the output device */
 	dm->output_device_config(0);
+	dm->ops->davincifb_power(&dm->osd0->info, 0);
+	dm->ops->davincifb_power(&dm->osd1->info, 0);
+	dm->ops->davincifb_power(&dm->vid0->info, 0);
+	dm->ops->davincifb_power(&dm->vid1->info, 0);
 
 	if (dm->mmio_base)
 		iounmap((void *)dm->mmio_base);
@@ -1445,6 +1462,7 @@  static int davincifb_probe(struct platform_device *pdev)
 	}
 
 	pdata = pdev->dev.platform_data;
+	dm->ops = pdata->ops;
 	/* map the regions */
 	dm->mmio_base =
 	    (unsigned long)ioremap(dm->mmio_base_phys, dm->mmio_size);
@@ -1676,6 +1694,10 @@  static int davincifb_probe(struct platform_device *pdev)
 
 	/* Turn ON the output device */
 	dm->output_device_config(1);
+	dm->ops->davincifb_power(&dm->osd0->info, 1);
+	dm->ops->davincifb_power(&dm->osd1->info, 1);
+	dm->ops->davincifb_power(&dm->vid0->info, 1);
+	dm->ops->davincifb_power(&dm->vid1->info, 1);
 
 	return (0);
 
diff --git a/include/video/davincifb.h b/include/video/davincifb.h
index 7e4f216..c3ecdd8 100644
--- a/include/video/davincifb.h
+++ b/include/video/davincifb.h
@@ -439,6 +439,17 @@  struct zoom_params
 };
 #define FBIO_SETZOOM		_IOW('F', 0x24, struct zoom_params)
 
+/*
+ * davincifb operations
+ *
+ * This functions are used in order to manage external hw that is platform
+ * dependent according to what is done on the framebuffer (turn LCD on/off,
+ * manage backlight, ...)
+ */
+
+struct davincifb_ops {
+	int (*davincifb_power)(struct fb_info *info, int on);
+};
 
 struct davincifb_platform_data {
 	u32 xres;