targets using 2.6.32 should use the latest release
[openwrt.git] / target / linux / omap35xx / patches-2.6.32 / 003-enable_dss2_beagleboard.patch
1 --- a/arch/arm/mach-omap2/board-omap3beagle.c   2009-11-27 02:38:04.000000000 +0100
2 +++ b/arch/arm/mach-omap2/board-omap3beagle.c   2009-11-27 00:36:10.511677848 +0100
3 @@ -23,6 +23,7 @@
4  #include <linux/gpio.h>
5  #include <linux/input.h>
6  #include <linux/gpio_keys.h>
7 +#include <linux/omapfb.h>
8  
9  #include <linux/mtd/mtd.h>
10  #include <linux/mtd/partitions.h>
11 @@ -44,6 +45,7 @@
12  #include <mach/mux.h>
13  #include <mach/usb.h>
14  #include <mach/timer-gp.h>
15 +#include <mach/display.h>
16  
17  #include "mmc-twl4030.h"
18  
19 @@ -106,6 +108,92 @@ static struct platform_device omap3beagl
20         .resource       = &omap3beagle_nand_resource,
21  };
22  
23 +/* DSS */
24 +
25 +static int beagle_enable_dvi(struct omap_dss_device *dssdev)
26 +{
27 +       if (dssdev->reset_gpio != -1)
28 +               gpio_set_value(dssdev->reset_gpio, 1);
29 +
30 +       return 0;
31 +}
32 +
33 +static void beagle_disable_dvi(struct omap_dss_device *dssdev)
34 +{
35 +       if (dssdev->reset_gpio != -1)
36 +               gpio_set_value(dssdev->reset_gpio, 0);
37 +}
38 +
39 +static struct omap_dss_device beagle_dvi_device = {
40 +       .type = OMAP_DISPLAY_TYPE_DPI,
41 +       .name = "dvi",
42 +       .driver_name = "generic_panel",
43 +       .phy.dpi.data_lines = 24,
44 +       .reset_gpio = 170,
45 +       .platform_enable = beagle_enable_dvi,
46 +       .platform_disable = beagle_disable_dvi,
47 +};
48 +
49 +static int beagle_panel_enable_tv(struct omap_dss_device *dssdev)
50 +{
51 +       return 0;
52 +}
53 +
54 +static void beagle_panel_disable_tv(struct omap_dss_device *dssdev)
55 +{
56 +}
57 +
58 +static struct omap_dss_device beagle_tv_device = {
59 +       .name = "tv",
60 +       .driver_name = "venc",
61 +       .type = OMAP_DISPLAY_TYPE_VENC,
62 +       .phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO,
63 +       .platform_enable = beagle_panel_enable_tv,
64 +       .platform_disable = beagle_panel_disable_tv,
65 +};
66 +
67 +static struct omap_dss_device *beagle_dss_devices[] = {
68 +       &beagle_dvi_device,
69 +       &beagle_tv_device,
70 +};
71 +
72 +static struct omap_dss_board_info beagle_dss_data = {
73 +       .num_devices = ARRAY_SIZE(beagle_dss_devices),
74 +       .devices = beagle_dss_devices,
75 +       .default_device = &beagle_dvi_device,
76 +};
77 +
78 +static struct platform_device beagle_dss_device = {
79 +       .name          = "omapdss",
80 +       .id            = -1,
81 +       .dev            = {
82 +               .platform_data = &beagle_dss_data,
83 +       },
84 +};
85 +
86 +static struct regulator_consumer_supply beagle_vdda_dac_supply = {
87 +       .supply         = "vdda_dac",
88 +       .dev            = &beagle_dss_device.dev,
89 +};
90 +
91 +static struct regulator_consumer_supply beagle_vdds_dsi_supply = {
92 +       .supply         = "vdds_dsi",
93 +       .dev            = &beagle_dss_device.dev,
94 +};
95 +
96 +static void __init beagle_display_init(void)
97 +{
98 +       int r;
99 +
100 +       r = gpio_request(beagle_dvi_device.reset_gpio, "DVI reset");
101 +       if (r < 0) {
102 +               printk(KERN_ERR "Unable to get DVI reset GPIO\n");
103 +               return;
104 +       }
105 +
106 +       gpio_direction_output(beagle_dvi_device.reset_gpio, 0);
107 +}
108 +
109  #include "sdram-micron-mt46h32m32lf-6.h"
110  
111  static struct twl4030_hsmmc_info mmc[] = {
112 @@ -117,15 +205,6 @@ static struct twl4030_hsmmc_info mmc[] =
113         {}      /* Terminator */
114  };
115  
116 -static struct platform_device omap3_beagle_lcd_device = {
117 -       .name           = "omap3beagle_lcd",
118 -       .id             = -1,
119 -};
120 -
121 -static struct omap_lcd_config omap3_beagle_lcd_config __initdata = {
122 -       .ctrl_name      = "internal",
123 -};
124 -
125  static struct regulator_consumer_supply beagle_vmmc1_supply = {
126         .supply                 = "vmmc",
127  };
128 @@ -181,15 +260,6 @@ static struct twl4030_gpio_platform_data
129         .setup          = beagle_twl_gpio_setup,
130  };
131  
132 -static struct regulator_consumer_supply beagle_vdac_supply = {
133 -       .supply         = "vdac",
134 -       .dev            = &omap3_beagle_lcd_device.dev,
135 -};
136 -
137 -static struct regulator_consumer_supply beagle_vdvi_supply = {
138 -       .supply         = "vdvi",
139 -       .dev            = &omap3_beagle_lcd_device.dev,
140 -};
141  
142  /* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */
143  static struct regulator_init_data beagle_vmmc1 = {
144 @@ -226,13 +296,14 @@ static struct regulator_init_data beagle
145         .constraints = {
146                 .min_uV                 = 1800000,
147                 .max_uV                 = 1800000,
148 +               .apply_uV       = true,
149                 .valid_modes_mask       = REGULATOR_MODE_NORMAL
150                                         | REGULATOR_MODE_STANDBY,
151                 .valid_ops_mask         = REGULATOR_CHANGE_MODE
152                                         | REGULATOR_CHANGE_STATUS,
153         },
154         .num_consumer_supplies  = 1,
155 -       .consumer_supplies      = &beagle_vdac_supply,
156 +       .consumer_supplies      = &beagle_vdda_dac_supply,
157  };
158  
159  /* VPLL2 for digital video outputs */
160 @@ -247,7 +318,7 @@ static struct regulator_init_data beagle
161                                         | REGULATOR_CHANGE_STATUS,
162         },
163         .num_consumer_supplies  = 1,
164 -       .consumer_supplies      = &beagle_vdvi_supply,
165 +       .consumer_supplies      = &beagle_vdds_dsi_supply,
166  };
167  
168  static struct twl4030_usb_data beagle_usb_data = {
169 @@ -340,7 +411,6 @@ static struct platform_device keys_gpio 
170  };
171  
172  static struct omap_board_config_kernel omap3_beagle_config[] __initdata = {
173 -       { OMAP_TAG_LCD,         &omap3_beagle_lcd_config },
174  };
175  
176  static void __init omap3_beagle_init_irq(void)
177 @@ -357,7 +427,7 @@ static void __init omap3_beagle_init_irq
178  }
179  
180  static struct platform_device *omap3_beagle_devices[] __initdata = {
181 -       &omap3_beagle_lcd_device,
182 +       &beagle_dss_device,
183         &leds_gpio,
184         &keys_gpio,
185  };
186 @@ -420,9 +490,6 @@ static void __init omap3_beagle_init(voi
187         omap_serial_init();
188  
189         omap_cfg_reg(J25_34XX_GPIO170);
190 -       gpio_request(170, "DVI_nPD");
191 -       /* REVISIT leave DVI powered down until it's needed ... */
192 -       gpio_direction_output(170, true);
193  
194         usb_musb_init();
195         usb_ehci_init(&ehci_pdata);