Roger Quadros | 03e1110 | 2010-05-10 10:35:17 +0200 | [diff] [blame] | 1 | /* |
| 2 | * linux/arch/arm/mach-omap2/board-rx51-video.c |
| 3 | * |
| 4 | * Copyright (C) 2010 Nokia |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License version 2 as |
| 8 | * published by the Free Software Foundation. |
| 9 | */ |
| 10 | |
| 11 | #include <linux/kernel.h> |
| 12 | #include <linux/init.h> |
| 13 | #include <linux/platform_device.h> |
| 14 | #include <linux/gpio.h> |
| 15 | #include <linux/spi/spi.h> |
| 16 | #include <linux/mm.h> |
Roger Quadros | 03e1110 | 2010-05-10 10:35:17 +0200 | [diff] [blame] | 17 | #include <asm/mach-types.h> |
Roger Quadros | 03e1110 | 2010-05-10 10:35:17 +0200 | [diff] [blame] | 18 | #include <plat/display.h> |
| 19 | #include <plat/vram.h> |
| 20 | #include <plat/mcspi.h> |
| 21 | |
Manjunath Kondaiah G | 04aeae7 | 2010-10-08 09:58:35 -0700 | [diff] [blame] | 22 | #include <mach/board-rx51.h> |
| 23 | |
Roger Quadros | 03e1110 | 2010-05-10 10:35:17 +0200 | [diff] [blame] | 24 | #include "mux.h" |
| 25 | |
| 26 | #define RX51_LCD_RESET_GPIO 90 |
Srikar | 60d24ee | 2010-12-20 18:48:16 -0800 | [diff] [blame] | 27 | /* REVISIT to verify with rx51.c at sound/soc/omap */ |
| 28 | #define RX51_TVOUT_SEL_GPIO 40 |
| 29 | |
Roger Quadros | 03e1110 | 2010-05-10 10:35:17 +0200 | [diff] [blame] | 30 | |
| 31 | #if defined(CONFIG_FB_OMAP2) || defined(CONFIG_FB_OMAP2_MODULE) |
| 32 | |
| 33 | static int rx51_lcd_enable(struct omap_dss_device *dssdev) |
| 34 | { |
| 35 | gpio_set_value(dssdev->reset_gpio, 1); |
| 36 | return 0; |
| 37 | } |
| 38 | |
| 39 | static void rx51_lcd_disable(struct omap_dss_device *dssdev) |
| 40 | { |
| 41 | gpio_set_value(dssdev->reset_gpio, 0); |
| 42 | } |
| 43 | |
Srikar | 60d24ee | 2010-12-20 18:48:16 -0800 | [diff] [blame] | 44 | static int rx51_tvout_enable(struct omap_dss_device *dssdev) |
| 45 | { |
| 46 | gpio_set_value(dssdev->reset_gpio, 1); |
| 47 | return 0; |
| 48 | } |
| 49 | |
| 50 | static void rx51_tvout_disable(struct omap_dss_device *dssdev) |
| 51 | { |
| 52 | gpio_set_value(dssdev->reset_gpio, 0); |
| 53 | } |
| 54 | |
Roger Quadros | 03e1110 | 2010-05-10 10:35:17 +0200 | [diff] [blame] | 55 | static struct omap_dss_device rx51_lcd_device = { |
| 56 | .name = "lcd", |
| 57 | .driver_name = "panel-acx565akm", |
| 58 | .type = OMAP_DISPLAY_TYPE_SDI, |
| 59 | .phy.sdi.datapairs = 2, |
| 60 | .reset_gpio = RX51_LCD_RESET_GPIO, |
| 61 | .platform_enable = rx51_lcd_enable, |
| 62 | .platform_disable = rx51_lcd_disable, |
| 63 | }; |
| 64 | |
Srikar | 60d24ee | 2010-12-20 18:48:16 -0800 | [diff] [blame] | 65 | static struct omap_dss_device rx51_tv_device = { |
| 66 | .name = "tv", |
| 67 | .type = OMAP_DISPLAY_TYPE_VENC, |
| 68 | .driver_name = "venc", |
| 69 | .phy.venc.type = OMAP_DSS_VENC_TYPE_COMPOSITE, |
| 70 | .reset_gpio = RX51_TVOUT_SEL_GPIO, |
| 71 | .platform_enable = rx51_tvout_enable, |
| 72 | .platform_disable = rx51_tvout_disable, |
| 73 | }; |
| 74 | |
Roger Quadros | 03e1110 | 2010-05-10 10:35:17 +0200 | [diff] [blame] | 75 | static struct omap_dss_device *rx51_dss_devices[] = { |
| 76 | &rx51_lcd_device, |
Srikar | 60d24ee | 2010-12-20 18:48:16 -0800 | [diff] [blame] | 77 | &rx51_tv_device, |
Roger Quadros | 03e1110 | 2010-05-10 10:35:17 +0200 | [diff] [blame] | 78 | }; |
| 79 | |
| 80 | static struct omap_dss_board_info rx51_dss_board_info = { |
| 81 | .num_devices = ARRAY_SIZE(rx51_dss_devices), |
| 82 | .devices = rx51_dss_devices, |
| 83 | .default_device = &rx51_lcd_device, |
| 84 | }; |
| 85 | |
| 86 | struct platform_device rx51_display_device = { |
| 87 | .name = "omapdss", |
| 88 | .id = -1, |
| 89 | .dev = { |
| 90 | .platform_data = &rx51_dss_board_info, |
| 91 | }, |
| 92 | }; |
| 93 | |
| 94 | static struct platform_device *rx51_video_devices[] __initdata = { |
| 95 | &rx51_display_device, |
| 96 | }; |
| 97 | |
| 98 | static int __init rx51_video_init(void) |
| 99 | { |
| 100 | if (!machine_is_nokia_rx51()) |
| 101 | return 0; |
| 102 | |
| 103 | if (omap_mux_init_gpio(RX51_LCD_RESET_GPIO, OMAP_PIN_OUTPUT)) { |
| 104 | pr_err("%s cannot configure MUX for LCD RESET\n", __func__); |
| 105 | return 0; |
| 106 | } |
| 107 | |
| 108 | if (gpio_request(RX51_LCD_RESET_GPIO, "LCD ACX565AKM reset")) { |
| 109 | pr_err("%s failed to get LCD Reset GPIO\n", __func__); |
| 110 | return 0; |
| 111 | } |
| 112 | |
| 113 | gpio_direction_output(RX51_LCD_RESET_GPIO, 1); |
| 114 | |
Srikar | 60d24ee | 2010-12-20 18:48:16 -0800 | [diff] [blame] | 115 | /* REVISIT to verify with rx51.c at sound/soc/omap */ |
| 116 | gpio_direction_output(RX51_TVOUT_SEL_GPIO, 1); |
| 117 | |
Roger Quadros | 03e1110 | 2010-05-10 10:35:17 +0200 | [diff] [blame] | 118 | platform_add_devices(rx51_video_devices, |
| 119 | ARRAY_SIZE(rx51_video_devices)); |
| 120 | return 0; |
| 121 | } |
| 122 | |
| 123 | subsys_initcall(rx51_video_init); |
| 124 | |
| 125 | void __init rx51_video_mem_init(void) |
| 126 | { |
| 127 | /* |
| 128 | * GFX 864x480x32bpp |
| 129 | * VID1/2 1280x720x32bpp double buffered |
| 130 | */ |
| 131 | omap_vram_set_sdram_vram(PAGE_ALIGN(864 * 480 * 4) + |
| 132 | 2 * PAGE_ALIGN(1280 * 720 * 4 * 2), 0); |
| 133 | } |
| 134 | |
| 135 | #else |
| 136 | void __init rx51_video_mem_init(void) { } |
| 137 | #endif /* defined(CONFIG_FB_OMAP2) || defined(CONFIG_FB_OMAP2_MODULE) */ |