~beagleboard-kernel/+junk/lucid-ti-omap

14 by Robert Nelson
beagle: first pass on enabling dss2
1
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
2
index 231cb4e..8d778cf 100644
3
--- a/arch/arm/mach-omap2/board-omap3beagle.c
4
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
5
@@ -43,6 +43,7 @@
6
 #include <plat/nand.h>
7
 #include <plat/usb.h>
8
 #include <plat/timer-gp.h>
9
+#include <plat/display.h>
10
 
11
 #include "mux.h"
12
 #include "mmc-twl4030.h"
13
@@ -106,6 +107,105 @@ static struct platform_device omap3beagle_nand_device = {
14
 	.resource	= &omap3beagle_nand_resource,
15
 };
16
 
17
+/* DSS */
18
+
19
+static int beagle_enable_dvi(struct omap_dss_device *dssdev)
20
+{
21
+	if (dssdev->reset_gpio != -1)
22
+		gpio_set_value(dssdev->reset_gpio, 1);
23
+
24
+	return 0;
25
+}
26
+
27
+static void beagle_disable_dvi(struct omap_dss_device *dssdev)
28
+{
29
+	if (dssdev->reset_gpio != -1)
30
+		gpio_set_value(dssdev->reset_gpio, 0);
31
+}
32
+
33
+static struct omap_dss_device beagle_dvi_device = {
34
+	.type = OMAP_DISPLAY_TYPE_DPI,
35
+	.name = "dvi",
36
+	.driver_name = "generic_panel",
37
+	.phy.dpi.data_lines = 24,
38
+	.reset_gpio = 170,
39
+	.platform_enable = beagle_enable_dvi,
40
+	.platform_disable = beagle_disable_dvi,
41
+};
42
+
43
+static int beagle_panel_enable_tv(struct omap_dss_device *dssdev)
44
+{
45
+#define ENABLE_VDAC_DEDICATED           0x03
46
+#define ENABLE_VDAC_DEV_GRP             0x20
47
+
48
+	twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER,
49
+			ENABLE_VDAC_DEDICATED,
50
+			TWL4030_VDAC_DEDICATED);
51
+	twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER,
52
+			ENABLE_VDAC_DEV_GRP, TWL4030_VDAC_DEV_GRP);
53
+
54
+	return 0;
55
+}
56
+
57
+static void beagle_panel_disable_tv(struct omap_dss_device *dssdev)
58
+{
59
+	twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0x00,
60
+			TWL4030_VDAC_DEDICATED);
61
+	twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0x00,
62
+			TWL4030_VDAC_DEV_GRP);
63
+}
64
+
65
+static struct omap_dss_device beagle_tv_device = {
66
+	.name = "tv",
67
+	.driver_name = "venc",
68
+	.type = OMAP_DISPLAY_TYPE_VENC,
69
+	.phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO,
70
+	.platform_enable = beagle_panel_enable_tv,
71
+	.platform_disable = beagle_panel_disable_tv,
72
+};
73
+
74
+static struct omap_dss_device *beagle_dss_devices[] = {
75
+	&beagle_dvi_device,
76
+	&beagle_tv_device,
77
+};
78
+
79
+static struct omap_dss_board_info beagle_dss_data = {
80
+	.num_devices = ARRAY_SIZE(beagle_dss_devices),
81
+	.devices = beagle_dss_devices,
82
+	.default_device = &beagle_dvi_device,
83
+};
84
+
85
+static struct platform_device beagle_dss_device = {
86
+	.name          = "omapdss",
87
+	.id            = -1,
88
+	.dev            = {
89
+		.platform_data = &beagle_dss_data,
90
+	},
91
+};
92
+
93
+static struct regulator_consumer_supply beagle_vdac_supply = {
94
+	.supply		= "vdda_dac",
95
+	.dev		= &beagle_dss_device.dev,
96
+};
97
+
98
+static struct regulator_consumer_supply beagle_vdvi_supply = {
99
+	.supply		= "vdds_dsi",
100
+	.dev		= &beagle_dss_device.dev,
101
+};
102
+
103
+static void __init beagle_display_init(void)
104
+{
105
+	int r;
106
+
107
+	r = gpio_request(beagle_dvi_device.reset_gpio, "DVI reset");
108
+	if (r < 0) {
109
+		printk(KERN_ERR "Unable to get DVI reset GPIO\n");
110
+		return;
111
+	}
112
+
113
+	gpio_direction_output(beagle_dvi_device.reset_gpio, 0);
114
+}
115
+
116
 #include "sdram-micron-mt46h32m32lf-6.h"
117
 
118
 static struct twl4030_hsmmc_info mmc[] = {
119
@@ -117,15 +217,6 @@ static struct twl4030_hsmmc_info mmc[] = {
120
 	{}	/* Terminator */
121
 };
122
 
123
-static struct platform_device omap3_beagle_lcd_device = {
124
-	.name		= "omap3beagle_lcd",
125
-	.id		= -1,
126
-};
127
-
128
-static struct omap_lcd_config omap3_beagle_lcd_config __initdata = {
129
-	.ctrl_name	= "internal",
130
-};
131
-
132
 static struct regulator_consumer_supply beagle_vmmc1_supply = {
133
 	.supply			= "vmmc",
134
 };
135
@@ -181,16 +272,6 @@ static struct twl4030_gpio_platform_data beagle_gpio_data = {
136
 	.setup		= beagle_twl_gpio_setup,
137
 };
138
 
139
-static struct regulator_consumer_supply beagle_vdac_supply = {
140
-	.supply		= "vdac",
141
-	.dev		= &omap3_beagle_lcd_device.dev,
142
-};
143
-
144
-static struct regulator_consumer_supply beagle_vdvi_supply = {
145
-	.supply		= "vdvi",
146
-	.dev		= &omap3_beagle_lcd_device.dev,
147
-};
148
-
149
 /* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */
150
 static struct regulator_init_data beagle_vmmc1 = {
151
 	.constraints = {
152
@@ -349,14 +430,8 @@ static struct platform_device keys_gpio = {
153
 	},
154
 };
155
 
156
-static struct omap_board_config_kernel omap3_beagle_config[] __initdata = {
157
-	{ OMAP_TAG_LCD,		&omap3_beagle_lcd_config },
158
-};
159
-
160
 static void __init omap3_beagle_init_irq(void)
161
 {
162
-	omap_board_config = omap3_beagle_config;
163
-	omap_board_config_size = ARRAY_SIZE(omap3_beagle_config);
164
 	omap2_init_common_hw(mt46h32m32lf6_sdrc_params,
165
 			     mt46h32m32lf6_sdrc_params);
166
 	omap_init_irq();
167
@@ -367,9 +442,9 @@ static void __init omap3_beagle_init_irq(void)
168
 }
169
 
170
 static struct platform_device *omap3_beagle_devices[] __initdata = {
171
-	&omap3_beagle_lcd_device,
172
 	&leds_gpio,
173
 	&keys_gpio,
174
+	&beagle_dss_device,
175
 };
176
 
177
 static void __init omap3beagle_flash_init(void)
178
@@ -450,6 +525,8 @@ static void __init omap3_beagle_init(void)
179
 	/* Ensure SDRC pins are mux'd for self-refresh */
180
 	omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT);
181
 	omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT);
182
+
183
+	beagle_display_init();
184
 }
185
 
186
 static void __init omap3_beagle_map_io(void)