linux-ti335x-psp 3.1: hack in DVI support for beaglebone
[glsdk/meta-ti-glsdk.git] / recipes-kernel / linux / linux-ti33x-psp-3.1 / 0001-ARM-OMAP2-beaglebone-hack-in-DVI-support.patch
1 From 53f68267a95eac46ee91a692ef8a9b144102b3ec Mon Sep 17 00:00:00 2001
2 From: Koen Kooi <koen@dominion.thruhere.net>
3 Date: Mon, 31 Oct 2011 20:14:46 +0100
4 Subject: [PATCH] ARM: OMAP2+: beaglebone: hack in DVI support
6 Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
7 ---
8  arch/arm/mach-omap2/board-am335xevm.c |  124 ++++++++++++++++++++++++++++++---
9  drivers/video/da8xx-fb.c              |   14 ++++
10  2 files changed, 127 insertions(+), 11 deletions(-)
12 diff --git a/arch/arm/mach-omap2/board-am335xevm.c b/arch/arm/mach-omap2/board-am335xevm.c
13 index eb18fb9..3d60530 100644
14 --- a/arch/arm/mach-omap2/board-am335xevm.c
15 +++ b/arch/arm/mach-omap2/board-am335xevm.c
16 @@ -144,6 +144,36 @@ struct da8xx_lcdc_platform_data TFC_S9700RTWV35TR_01B_pdata = {
17         .type                   = "TFC_S9700RTWV35TR_01B",
18  };
19  
20 +static const struct display_panel dvi_panel = {
21 +       WVGA,
22 +       16,
23 +       16,
24 +       COLOR_ACTIVE,
25 +};
26 +
27 +static struct lcd_ctrl_config dvi_cfg = {
28 +       &dvi_panel,
29 +       .ac_bias                = 255,
30 +       .ac_bias_intrpt         = 0,
31 +       .dma_burst_sz           = 16,
32 +       .bpp                    = 16,
33 +       .fdd                    = 0x80,
34 +       .tft_alt_mode           = 0,
35 +       .stn_565_mode           = 0,
36 +       .mono_8bit_mode         = 0,
37 +       .invert_line_clock      = 1,
38 +       .invert_frm_clock       = 1,
39 +       .sync_edge              = 0,
40 +       .sync_ctrl              = 1,
41 +       .raster_order           = 0,
42 +};
43 +
44 +struct da8xx_lcdc_platform_data dvi_pdata = {
45 +       .manu_name              = "BBToys",
46 +       .controller_data        = &dvi_cfg,
47 +       .type                   = "1024x768@60",
48 +};
49 +
50  /* TSc controller */
51  #include <linux/input/ti_tscadc.h>
52  
53 @@ -369,6 +399,50 @@ static struct pinmux_config lcdc_pin_mux[] = {
54         {NULL, 0},
55  };
56  
57 +/* Module pin mux for DVI board */
58 +static struct pinmux_config dvi_pin_mux[] = {
59 +       {"lcd_data0.lcd_data0",         OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT
60 +        | AM33XX_PULL_DISA},
61 +       {"lcd_data1.lcd_data1",         OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT
62 +        | AM33XX_PULL_DISA},
63 +       {"lcd_data2.lcd_data2",         OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT
64 +        | AM33XX_PULL_DISA},
65 +       {"lcd_data3.lcd_data3",         OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT
66 +        | AM33XX_PULL_DISA},
67 +       {"lcd_data4.lcd_data4",         OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT
68 +        | AM33XX_PULL_DISA},
69 +       {"lcd_data5.lcd_data5",         OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT
70 +        | AM33XX_PULL_DISA},
71 +       {"lcd_data6.lcd_data6",         OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT
72 +        | AM33XX_PULL_DISA},
73 +       {"lcd_data7.lcd_data7",         OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT
74 +        | AM33XX_PULL_DISA},
75 +       {"lcd_data8.lcd_data8",         OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT
76 +        | AM33XX_PULL_DISA},
77 +       {"lcd_data9.lcd_data9",         OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT
78 +        | AM33XX_PULL_DISA},
79 +       {"lcd_data10.lcd_data10",       OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT
80 +        | AM33XX_PULL_DISA},
81 +       {"lcd_data11.lcd_data11",       OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT
82 +        | AM33XX_PULL_DISA},
83 +       {"lcd_data12.lcd_data12",       OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT
84 +        | AM33XX_PULL_DISA},
85 +       {"lcd_data13.lcd_data13",       OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT
86 +        | AM33XX_PULL_DISA},
87 +       {"lcd_data14.lcd_data14",       OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT
88 +        | AM33XX_PULL_DISA},
89 +       {"lcd_data15.lcd_data15",       OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT
90 +        | AM33XX_PULL_DISA},
91 +       {"lcd_vsync.lcd_vsync",         OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT},
92 +       {"lcd_hsync.lcd_hsync",         OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT},
93 +       {"lcd_pclk.lcd_pclk",           OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT},
94 +       {"lcd_ac_bias_en.lcd_ac_bias_en", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT}, //DVIEN
95 +       {"gpmc_a2.rgmii2_td3", OMAP_MUX_MODE7 | AM33XX_PIN_OUTPUT}, // USR0 LED
96 +       {"gpmc_a3.rgmii2_td2", OMAP_MUX_MODE7 | AM33XX_PIN_OUTPUT}, // USR1 LED
97 +       {"gpmc_ad7.gpmc_ad7", OMAP_MUX_MODE7 | AM33XX_PIN_OUTPUT}, // DVI PDn
98 +       {NULL, 0},
99 +};
101  static struct pinmux_config tsc_pin_mux[] = {
102         {"ain0.ain0",           OMAP_MUX_MODE0 | AM33XX_INPUT_EN},
103         {"ain1.ain1",           OMAP_MUX_MODE0 | AM33XX_INPUT_EN},
104 @@ -659,6 +733,9 @@ static struct pinmux_config usb1_pin_mux[] = {
105  #define BEAGLEBONE_USR3_LED  GPIO_TO_PIN(1, 23)
106  #define BEAGLEBONE_USR4_LED  GPIO_TO_PIN(1, 24)
107  
108 +#define BEAGLEBONEDVI_USR0_LED  GPIO_TO_PIN(1, 18)
109 +#define BEAGLEBONEDVI_USR1_LED  GPIO_TO_PIN(1, 19)
111  static struct gpio_led gpio_leds[] = {
112         {
113                 .name                   = "beaglebone::usr0",
114 @@ -678,6 +755,16 @@ static struct gpio_led gpio_leds[] = {
115                 .name           = "beaglebone::usr3",
116                 .gpio           = BEAGLEBONE_USR4_LED,
117         },
118 +       {
119 +               .name                   = "dvi::usr0",
120 +               .default_trigger        = "heartbeat",
121 +               .gpio                   = BEAGLEBONEDVI_USR0_LED,
122 +       },
123 +       {
124 +               .name           = "dvi::usr1",
125 +               .default_trigger        = "mmc0",
126 +               .gpio           = BEAGLEBONEDVI_USR1_LED,
127 +       },
128  };
129  
130  static struct gpio_led_platform_data gpio_led_info = {
131 @@ -693,10 +780,6 @@ static struct platform_device leds_gpio = {
132         },
133  };
134  
135 -static struct platform_device *bone_devices[] __initdata = {
136 -                   &leds_gpio,
137 -};
139  static struct pinmux_config bone_pin_mux[] = {
140         /* User LED gpios (gpio1_21 to gpio1_24) */
141      {"gpmc_a5.rgmii2_td0", OMAP_MUX_MODE7 | AM33XX_PIN_OUTPUT},
142 @@ -806,6 +889,26 @@ static void lcdc_init(int evm_id, int profile)
143         return;
144  }
145  
146 +#define BEAGLEBONEDVI_PDn  GPIO_TO_PIN(1, 7)
148 +static void dvi_init(int evm_id, int profile)
149 +{
150 +    setup_pin_mux(dvi_pin_mux);
151 +       gpio_request(BEAGLEBONEDVI_PDn, "DVI_PDn");
152 +       gpio_direction_output(BEAGLEBONEDVI_PDn, 1);
154 +       // we are being stupid and setting pixclock from here instead of da8xx-fb.c
155 +       if (conf_disp_pll(560000000)) {
156 +               pr_info("Failed to set pixclock to 56000000, not attempting to"
157 +                               "register DVI adapter\n");
158 +               return;
159 +       }
160 +       
161 +       if (am33xx_register_lcdc(&dvi_pdata))
162 +               pr_info("Failed to register BeagleBoardToys DVI adapter\n");
163 +       return;
164 +}
166  static void tsc_init(int evm_id, int profile)
167  {
168         int err;
169 @@ -815,16 +918,14 @@ static void tsc_init(int evm_id, int profile)
170                 pr_err("failed to register touchscreen device\n");
171  }
172  
173 -/*
174 - * Initialization of BeagleBone specific devices
175 - */
176 -static void bone_init(int evm_id, int profil )
178 +static void boneleds_init(int evm_id, int profile )
179  {
180         int err;
181         setup_pin_mux(bone_pin_mux);
182 -       err = platform_add_devices(bone_devices, ARRAY_SIZE(bone_devices));
183 +       err = platform_device_register(&leds_gpio);
184         if (err)
185 -               pr_err("failed to register LEDS\n");
186 +               pr_err("failed to register BeagleBone LEDS\n");
187  }
188  
189  static void rgmii1_init(int evm_id, int profile)
190 @@ -1297,10 +1398,11 @@ static struct evm_dev_cfg ip_phn_evm_dev_cfg[] = {
191  /* Beaglebone */
192  static struct evm_dev_cfg beaglebone_dev_cfg[] = {
193         {rmii1_init,    DEV_ON_BASEBOARD, PROFILE_NONE},
194 +       {dvi_init,      DEV_ON_BASEBOARD, PROFILE_ALL},
195         {usb0_init,     DEV_ON_BASEBOARD, PROFILE_NONE},
196         {usb1_init,     DEV_ON_BASEBOARD, PROFILE_NONE},
197         {mmc0_init,     DEV_ON_BASEBOARD, PROFILE_NONE},
198 -       {bone_init,     DEV_ON_BASEBOARD, PROFILE_ALL},
199 +       {boneleds_init, DEV_ON_BASEBOARD, PROFILE_ALL},
200         {NULL, 0, 0},
201  };
202  
203 diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c
204 index 4347421..9619518 100644
205 --- a/drivers/video/da8xx-fb.c
206 +++ b/drivers/video/da8xx-fb.c
207 @@ -266,6 +266,20 @@ static struct da8xx_panel known_lcd_panels[] = {
208                 .pxl_clk = 30000000,
209                 .invert_pxl_clk = 0,
210         },
211 +       [3] = {
212 +                /* 1024 x 768 @ 60 Hz  Reduced blanking VESA CVT 0.79M3-R */ 
213 +               .name = "1024x768@60",
214 +               .width = 1024,
215 +               .height = 768,
216 +               .hfp = 48,
217 +               .hbp = 80,
218 +               .hsw = 32,
219 +               .vfp = 3,
220 +               .vbp = 15,
221 +               .vsw = 4,
222 +               .pxl_clk = 56000000,
223 +               .invert_pxl_clk = 0,
224 +       },
225  };
226  
227  /* Enable the Raster Engine of the LCD Controller */
228 -- 
229 1.6.6.1