diff options
Diffstat (limited to 'arch/arm/mach-omap2/board-ldp.c')
-rw-r--r-- | arch/arm/mach-omap2/board-ldp.c | 123 |
1 files changed, 112 insertions, 11 deletions
diff --git a/arch/arm/mach-omap2/board-ldp.c b/arch/arm/mach-omap2/board-ldp.c index 218764c9377e..689ed499bdfd 100644 --- a/arch/arm/mach-omap2/board-ldp.c +++ b/arch/arm/mach-omap2/board-ldp.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/io.h> | 27 | #include <linux/io.h> |
28 | #include <linux/smsc911x.h> | 28 | #include <linux/smsc911x.h> |
29 | #include <linux/mmc/host.h> | 29 | #include <linux/mmc/host.h> |
30 | #include <linux/gpio.h> | ||
30 | 31 | ||
31 | #include <mach/hardware.h> | 32 | #include <mach/hardware.h> |
32 | #include <asm/mach-types.h> | 33 | #include <asm/mach-types.h> |
@@ -34,7 +35,6 @@ | |||
34 | #include <asm/mach/map.h> | 35 | #include <asm/mach/map.h> |
35 | 36 | ||
36 | #include <plat/mcspi.h> | 37 | #include <plat/mcspi.h> |
37 | #include <mach/gpio.h> | ||
38 | #include <plat/board.h> | 38 | #include <plat/board.h> |
39 | #include <plat/common.h> | 39 | #include <plat/common.h> |
40 | #include <plat/gpmc.h> | 40 | #include <plat/gpmc.h> |
@@ -44,6 +44,9 @@ | |||
44 | #include <plat/usb.h> | 44 | #include <plat/usb.h> |
45 | #include <plat/gpmc-smsc911x.h> | 45 | #include <plat/gpmc-smsc911x.h> |
46 | 46 | ||
47 | #include <video/omapdss.h> | ||
48 | #include <video/omap-panel-generic-dpi.h> | ||
49 | |||
47 | #include "board-flash.h" | 50 | #include "board-flash.h" |
48 | #include "mux.h" | 51 | #include "mux.h" |
49 | #include "hsmmc.h" | 52 | #include "hsmmc.h" |
@@ -180,29 +183,108 @@ static inline void __init ldp_init_smsc911x(void) | |||
180 | gpmc_smsc911x_init(&smsc911x_cfg); | 183 | gpmc_smsc911x_init(&smsc911x_cfg); |
181 | } | 184 | } |
182 | 185 | ||
183 | static struct platform_device ldp_lcd_device = { | 186 | /* LCD */ |
184 | .name = "ldp_lcd", | 187 | |
185 | .id = -1, | 188 | static int ldp_backlight_gpio; |
189 | static int ldp_lcd_enable_gpio; | ||
190 | |||
191 | #define LCD_PANEL_RESET_GPIO 55 | ||
192 | #define LCD_PANEL_QVGA_GPIO 56 | ||
193 | |||
194 | static int ldp_panel_enable_lcd(struct omap_dss_device *dssdev) | ||
195 | { | ||
196 | if (gpio_is_valid(ldp_lcd_enable_gpio)) | ||
197 | gpio_direction_output(ldp_lcd_enable_gpio, 1); | ||
198 | if (gpio_is_valid(ldp_backlight_gpio)) | ||
199 | gpio_direction_output(ldp_backlight_gpio, 1); | ||
200 | |||
201 | return 0; | ||
202 | } | ||
203 | |||
204 | static void ldp_panel_disable_lcd(struct omap_dss_device *dssdev) | ||
205 | { | ||
206 | if (gpio_is_valid(ldp_lcd_enable_gpio)) | ||
207 | gpio_direction_output(ldp_lcd_enable_gpio, 0); | ||
208 | if (gpio_is_valid(ldp_backlight_gpio)) | ||
209 | gpio_direction_output(ldp_backlight_gpio, 0); | ||
210 | } | ||
211 | |||
212 | static struct panel_generic_dpi_data ldp_panel_data = { | ||
213 | .name = "nec_nl2432dr22-11b", | ||
214 | .platform_enable = ldp_panel_enable_lcd, | ||
215 | .platform_disable = ldp_panel_disable_lcd, | ||
186 | }; | 216 | }; |
187 | 217 | ||
188 | static struct omap_lcd_config ldp_lcd_config __initdata = { | 218 | static struct omap_dss_device ldp_lcd_device = { |
189 | .ctrl_name = "internal", | 219 | .name = "lcd", |
220 | .driver_name = "generic_dpi_panel", | ||
221 | .type = OMAP_DISPLAY_TYPE_DPI, | ||
222 | .phy.dpi.data_lines = 18, | ||
223 | .data = &ldp_panel_data, | ||
224 | }; | ||
225 | |||
226 | static struct omap_dss_device *ldp_dss_devices[] = { | ||
227 | &ldp_lcd_device, | ||
190 | }; | 228 | }; |
191 | 229 | ||
192 | static struct omap_board_config_kernel ldp_config[] __initdata = { | 230 | static struct omap_dss_board_info ldp_dss_data = { |
193 | { OMAP_TAG_LCD, &ldp_lcd_config }, | 231 | .num_devices = ARRAY_SIZE(ldp_dss_devices), |
232 | .devices = ldp_dss_devices, | ||
233 | .default_device = &ldp_lcd_device, | ||
194 | }; | 234 | }; |
195 | 235 | ||
236 | static void __init ldp_display_init(void) | ||
237 | { | ||
238 | int r; | ||
239 | |||
240 | static struct gpio gpios[] __initdata = { | ||
241 | {LCD_PANEL_RESET_GPIO, GPIOF_OUT_INIT_HIGH, "LCD RESET"}, | ||
242 | {LCD_PANEL_QVGA_GPIO, GPIOF_OUT_INIT_HIGH, "LCD QVGA"}, | ||
243 | }; | ||
244 | |||
245 | r = gpio_request_array(gpios, ARRAY_SIZE(gpios)); | ||
246 | if (r) { | ||
247 | pr_err("Cannot request LCD GPIOs, error %d\n", r); | ||
248 | return; | ||
249 | } | ||
250 | |||
251 | omap_display_init(&ldp_dss_data); | ||
252 | } | ||
253 | |||
196 | static void __init omap_ldp_init_early(void) | 254 | static void __init omap_ldp_init_early(void) |
197 | { | 255 | { |
198 | omap2_init_common_infrastructure(); | 256 | omap2_init_common_infrastructure(); |
199 | omap2_init_common_devices(NULL, NULL); | 257 | omap2_init_common_devices(NULL, NULL); |
200 | } | 258 | } |
201 | 259 | ||
260 | static int ldp_twl_gpio_setup(struct device *dev, unsigned gpio, unsigned ngpio) | ||
261 | { | ||
262 | int r; | ||
263 | |||
264 | struct gpio gpios[] = { | ||
265 | {gpio + 7 , GPIOF_OUT_INIT_LOW, "LCD ENABLE"}, | ||
266 | {gpio + 15, GPIOF_OUT_INIT_LOW, "LCD BACKLIGHT"}, | ||
267 | }; | ||
268 | |||
269 | r = gpio_request_array(gpios, ARRAY_SIZE(gpios)); | ||
270 | if (r) { | ||
271 | pr_err("Cannot request LCD GPIOs, error %d\n", r); | ||
272 | ldp_backlight_gpio = -EINVAL; | ||
273 | ldp_lcd_enable_gpio = -EINVAL; | ||
274 | return r; | ||
275 | } | ||
276 | |||
277 | ldp_backlight_gpio = gpio + 15; | ||
278 | ldp_lcd_enable_gpio = gpio + 7; | ||
279 | |||
280 | return 0; | ||
281 | } | ||
282 | |||
202 | static struct twl4030_gpio_platform_data ldp_gpio_data = { | 283 | static struct twl4030_gpio_platform_data ldp_gpio_data = { |
203 | .gpio_base = OMAP_MAX_GPIO_LINES, | 284 | .gpio_base = OMAP_MAX_GPIO_LINES, |
204 | .irq_base = TWL4030_GPIO_IRQ_BASE, | 285 | .irq_base = TWL4030_GPIO_IRQ_BASE, |
205 | .irq_end = TWL4030_GPIO_IRQ_END, | 286 | .irq_end = TWL4030_GPIO_IRQ_END, |
287 | .setup = ldp_twl_gpio_setup, | ||
206 | }; | 288 | }; |
207 | 289 | ||
208 | static struct regulator_consumer_supply ldp_vmmc1_supply[] = { | 290 | static struct regulator_consumer_supply ldp_vmmc1_supply[] = { |
@@ -244,10 +326,31 @@ static struct regulator_init_data ldp_vaux1 = { | |||
244 | .consumer_supplies = ldp_vaux1_supplies, | 326 | .consumer_supplies = ldp_vaux1_supplies, |
245 | }; | 327 | }; |
246 | 328 | ||
329 | static struct regulator_consumer_supply ldp_vpll2_supplies[] = { | ||
330 | REGULATOR_SUPPLY("vdds_dsi", "omapdss"), | ||
331 | REGULATOR_SUPPLY("vdds_dsi", "omapdss_dsi1"), | ||
332 | }; | ||
333 | |||
334 | static struct regulator_init_data ldp_vpll2 = { | ||
335 | .constraints = { | ||
336 | .name = "VDVI", | ||
337 | .min_uV = 1800000, | ||
338 | .max_uV = 1800000, | ||
339 | .apply_uV = true, | ||
340 | .valid_modes_mask = REGULATOR_MODE_NORMAL | ||
341 | | REGULATOR_MODE_STANDBY, | ||
342 | .valid_ops_mask = REGULATOR_CHANGE_MODE | ||
343 | | REGULATOR_CHANGE_STATUS, | ||
344 | }, | ||
345 | .num_consumer_supplies = ARRAY_SIZE(ldp_vpll2_supplies), | ||
346 | .consumer_supplies = ldp_vpll2_supplies, | ||
347 | }; | ||
348 | |||
247 | static struct twl4030_platform_data ldp_twldata = { | 349 | static struct twl4030_platform_data ldp_twldata = { |
248 | /* platform_data for children goes here */ | 350 | /* platform_data for children goes here */ |
249 | .vmmc1 = &ldp_vmmc1, | 351 | .vmmc1 = &ldp_vmmc1, |
250 | .vaux1 = &ldp_vaux1, | 352 | .vaux1 = &ldp_vaux1, |
353 | .vpll2 = &ldp_vpll2, | ||
251 | .gpio = &ldp_gpio_data, | 354 | .gpio = &ldp_gpio_data, |
252 | .keypad = &ldp_kp_twl4030_data, | 355 | .keypad = &ldp_kp_twl4030_data, |
253 | }; | 356 | }; |
@@ -273,7 +376,6 @@ static struct omap2_hsmmc_info mmc[] __initdata = { | |||
273 | }; | 376 | }; |
274 | 377 | ||
275 | static struct platform_device *ldp_devices[] __initdata = { | 378 | static struct platform_device *ldp_devices[] __initdata = { |
276 | &ldp_lcd_device, | ||
277 | &ldp_gpio_keys_device, | 379 | &ldp_gpio_keys_device, |
278 | }; | 380 | }; |
279 | 381 | ||
@@ -318,8 +420,6 @@ static struct mtd_partition ldp_nand_partitions[] = { | |||
318 | static void __init omap_ldp_init(void) | 420 | static void __init omap_ldp_init(void) |
319 | { | 421 | { |
320 | omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); | 422 | omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); |
321 | omap_board_config = ldp_config; | ||
322 | omap_board_config_size = ARRAY_SIZE(ldp_config); | ||
323 | ldp_init_smsc911x(); | 423 | ldp_init_smsc911x(); |
324 | omap_i2c_init(); | 424 | omap_i2c_init(); |
325 | platform_add_devices(ldp_devices, ARRAY_SIZE(ldp_devices)); | 425 | platform_add_devices(ldp_devices, ARRAY_SIZE(ldp_devices)); |
@@ -330,6 +430,7 @@ static void __init omap_ldp_init(void) | |||
330 | ARRAY_SIZE(ldp_nand_partitions), ZOOM_NAND_CS, 0); | 430 | ARRAY_SIZE(ldp_nand_partitions), ZOOM_NAND_CS, 0); |
331 | 431 | ||
332 | omap2_hsmmc_init(mmc); | 432 | omap2_hsmmc_init(mmc); |
433 | ldp_display_init(); | ||
333 | } | 434 | } |
334 | 435 | ||
335 | MACHINE_START(OMAP_LDP, "OMAP LDP board") | 436 | MACHINE_START(OMAP_LDP, "OMAP LDP board") |