summaryrefslogtreecommitdiff
path: root/recipes/linux/linux-omap-pm/dss2/0067-DSS2-OMAP3EVM-Added-DSI-powerup-and-powerdown-func.patch
blob: 5b86244e1fdca8c2582f684a18bd996afa20eab0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
From d82606b114e4bab4f425f0180741bd2b1cd8e04a Mon Sep 17 00:00:00 2001
From: Hardik Shah <hardik.shah@ti.com>
Date: Thu, 14 May 2009 15:04:17 +0530
Subject: [PATCH 067/146] DSS2: OMAP3EVM: Added DSI powerup and powerdown functions

Copied fom 3430sdp implementation.

Signed-off-by: Hardik Shah <hardik.shah@ti.com>
---
 arch/arm/mach-omap2/board-omap3evm.c |   62 +++++++++++++++++++++-------------
 1 files changed, 38 insertions(+), 24 deletions(-)

diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c
index dffb8b9..6c9f11b 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -243,6 +243,38 @@ static int __init omap3_evm_i2c_init(void)
 static int lcd_enabled;
 static int dvi_enabled;
 
+static void enable_vpll2(int enable)
+{
+	u8 ded_val, grp_val;
+
+	if (enable) {
+		ded_val = ENABLE_VPLL2_DEDICATED;
+		grp_val = ENABLE_VPLL2_DEV_GRP;
+	} else {
+		ded_val = 0;
+		grp_val = 0;
+	}
+
+	twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER,
+			ded_val, TWL4030_VPLL2_DEDICATED);
+	twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER,
+			grp_val, TWL4030_VPLL2_DEV_GRP);
+}
+
+static int omap3evm_dsi_power_up(void)
+{
+	if (omap_rev() > OMAP3430_REV_ES1_0)
+		enable_vpll2(1);
+	return 0;
+}
+
+static void omap3evm_dsi_power_down(void)
+{
+	if (omap_rev() > OMAP3430_REV_ES1_0)
+		enable_vpll2(0);
+}
+
+
 static void __init omap3_evm_display_init(void)
 {
 	int r;
@@ -312,12 +344,7 @@ static int omap3_evm_panel_enable_lcd(struct omap_display *display)
 		printk(KERN_ERR "cannot enable LCD, DVI is enabled\n");
 		return -EINVAL;
 	}
-	if (omap_rev() > OMAP3430_REV_ES1_0) {
-		twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER,
-			ENABLE_VPLL2_DEDICATED, TWL4030_VPLL2_DEDICATED);
-		twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER,
-			ENABLE_VPLL2_DEV_GRP, TWL4030_VPLL2_DEV_GRP);
-	}
+	omap3evm_dsi_power_up();
 	gpio_direction_output(LCD_PANEL_ENABLE_GPIO, 0);
 	lcd_enabled = 1;
 	return 0;
@@ -325,12 +352,7 @@ static int omap3_evm_panel_enable_lcd(struct omap_display *display)
 
 static void omap3_evm_panel_disable_lcd(struct omap_display *display)
 {
-	if (omap_rev() > OMAP3430_REV_ES1_0) {
-		twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0x0,
-				TWL4030_VPLL2_DEDICATED);
-		twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0x0,
-				TWL4030_VPLL2_DEV_GRP);
-	}
+	omap3evm_dsi_power_down();
 	gpio_direction_output(LCD_PANEL_ENABLE_GPIO, 1);
 	lcd_enabled = 0;
 }
@@ -376,13 +398,8 @@ static int omap3_evm_panel_enable_dvi(struct omap_display *display)
 		printk(KERN_ERR "cannot enable DVI, LCD is enabled\n");
 		return -EINVAL;
 	}
-	if (omap_rev() > OMAP3430_REV_ES1_0) {
-		twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER,
-			ENABLE_VPLL2_DEDICATED, TWL4030_VPLL2_DEDICATED);
-		twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER,
-			ENABLE_VPLL2_DEV_GRP, TWL4030_VPLL2_DEV_GRP);
-	}
 
+	omap3evm_dsi_power_up();
 	twl4030_i2c_write_u8(TWL4030_MODULE_GPIO, 0x80,
 			TWL4030_GPIODATA_IN3);
 	twl4030_i2c_write_u8(TWL4030_MODULE_GPIO, 0x80,
@@ -394,13 +411,8 @@ static int omap3_evm_panel_enable_dvi(struct omap_display *display)
 
 static void omap3_evm_panel_disable_dvi(struct omap_display *display)
 {
-	if (omap_rev() > OMAP3430_REV_ES1_0) {
-		twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0x0,
-				TWL4030_VPLL2_DEDICATED);
-		twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0x0,
-				TWL4030_VPLL2_DEV_GRP);
-	}
 
+	omap3evm_dsi_power_down();
 	twl4030_i2c_write_u8(TWL4030_MODULE_GPIO, 0x00,
 			TWL4030_GPIODATA_IN3);
 	twl4030_i2c_write_u8(TWL4030_MODULE_GPIO, 0x00,
@@ -419,6 +431,8 @@ static struct omap_dss_display_config omap3_evm_display_data_dvi = {
 };
 
 static struct omap_dss_board_info omap3_evm_dss_data = {
+	.dsi_power_up = omap3evm_dsi_power_up,
+	.dsi_power_down = omap3evm_dsi_power_down,
 	.num_displays = 3,
 	.displays = {
 		&omap3_evm_display_data,
-- 
1.6.2.4