Koen Kooi | 27969cc | 2009-09-22 16:46:50 -0700 | [diff] [blame] | 1 | /* |
| 2 | * LCD panel support for the TI OMAP3 Beagle board |
| 3 | * |
| 4 | * Author: Koen Kooi <koen@openembedded.org> |
| 5 | * |
| 6 | * Derived from drivers/video/omap/lcd-omap3evm.c |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify it |
| 9 | * under the terms of the GNU General Public License as published by the |
| 10 | * Free Software Foundation; either version 2 of the License, or (at your |
| 11 | * option) any later version. |
| 12 | * |
| 13 | * This program is distributed in the hope that it will be useful, but |
| 14 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 | * General Public License for more details. |
| 17 | * |
| 18 | * You should have received a copy of the GNU General Public License along |
| 19 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 20 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 21 | */ |
| 22 | |
| 23 | #include <linux/module.h> |
| 24 | #include <linux/platform_device.h> |
| 25 | #include <linux/gpio.h> |
| 26 | #include <linux/i2c/twl4030.h> |
| 27 | |
Tony Lindgren | ce491cf | 2009-10-20 09:40:47 -0700 | [diff] [blame] | 28 | #include <plat/mux.h> |
Tomi Valkeinen | 91773a0 | 2009-08-03 15:06:36 +0300 | [diff] [blame] | 29 | #include <plat/mux.h> |
Koen Kooi | 27969cc | 2009-09-22 16:46:50 -0700 | [diff] [blame] | 30 | #include <asm/mach-types.h> |
| 31 | |
Tomi Valkeinen | 91773a0 | 2009-08-03 15:06:36 +0300 | [diff] [blame] | 32 | #include "omapfb.h" |
| 33 | |
Koen Kooi | 27969cc | 2009-09-22 16:46:50 -0700 | [diff] [blame] | 34 | #define LCD_PANEL_ENABLE_GPIO 170 |
| 35 | |
| 36 | static int omap3beagle_panel_init(struct lcd_panel *panel, |
| 37 | struct omapfb_device *fbdev) |
| 38 | { |
| 39 | gpio_request(LCD_PANEL_ENABLE_GPIO, "LCD enable"); |
| 40 | return 0; |
| 41 | } |
| 42 | |
| 43 | static void omap3beagle_panel_cleanup(struct lcd_panel *panel) |
| 44 | { |
| 45 | gpio_free(LCD_PANEL_ENABLE_GPIO); |
| 46 | } |
| 47 | |
| 48 | static int omap3beagle_panel_enable(struct lcd_panel *panel) |
| 49 | { |
| 50 | gpio_set_value(LCD_PANEL_ENABLE_GPIO, 1); |
| 51 | return 0; |
| 52 | } |
| 53 | |
| 54 | static void omap3beagle_panel_disable(struct lcd_panel *panel) |
| 55 | { |
| 56 | gpio_set_value(LCD_PANEL_ENABLE_GPIO, 0); |
| 57 | } |
| 58 | |
| 59 | static unsigned long omap3beagle_panel_get_caps(struct lcd_panel *panel) |
| 60 | { |
| 61 | return 0; |
| 62 | } |
| 63 | |
| 64 | struct lcd_panel omap3beagle_panel = { |
| 65 | .name = "omap3beagle", |
| 66 | .config = OMAP_LCDC_PANEL_TFT, |
| 67 | |
| 68 | .bpp = 16, |
| 69 | .data_lines = 24, |
| 70 | .x_res = 1024, |
| 71 | .y_res = 768, |
| 72 | .hsw = 3, /* hsync_len (4) - 1 */ |
| 73 | .hfp = 3, /* right_margin (4) - 1 */ |
| 74 | .hbp = 39, /* left_margin (40) - 1 */ |
| 75 | .vsw = 1, /* vsync_len (2) - 1 */ |
| 76 | .vfp = 2, /* lower_margin */ |
| 77 | .vbp = 7, /* upper_margin (8) - 1 */ |
| 78 | |
| 79 | .pixel_clock = 64000, |
| 80 | |
| 81 | .init = omap3beagle_panel_init, |
| 82 | .cleanup = omap3beagle_panel_cleanup, |
| 83 | .enable = omap3beagle_panel_enable, |
| 84 | .disable = omap3beagle_panel_disable, |
| 85 | .get_caps = omap3beagle_panel_get_caps, |
| 86 | }; |
| 87 | |
| 88 | static int omap3beagle_panel_probe(struct platform_device *pdev) |
| 89 | { |
| 90 | omapfb_register_panel(&omap3beagle_panel); |
| 91 | return 0; |
| 92 | } |
| 93 | |
| 94 | static int omap3beagle_panel_remove(struct platform_device *pdev) |
| 95 | { |
| 96 | return 0; |
| 97 | } |
| 98 | |
| 99 | static int omap3beagle_panel_suspend(struct platform_device *pdev, |
| 100 | pm_message_t mesg) |
| 101 | { |
| 102 | return 0; |
| 103 | } |
| 104 | |
| 105 | static int omap3beagle_panel_resume(struct platform_device *pdev) |
| 106 | { |
| 107 | return 0; |
| 108 | } |
| 109 | |
| 110 | struct platform_driver omap3beagle_panel_driver = { |
| 111 | .probe = omap3beagle_panel_probe, |
| 112 | .remove = omap3beagle_panel_remove, |
| 113 | .suspend = omap3beagle_panel_suspend, |
| 114 | .resume = omap3beagle_panel_resume, |
| 115 | .driver = { |
| 116 | .name = "omap3beagle_lcd", |
| 117 | .owner = THIS_MODULE, |
| 118 | }, |
| 119 | }; |
| 120 | |
| 121 | static int __init omap3beagle_panel_drv_init(void) |
| 122 | { |
| 123 | return platform_driver_register(&omap3beagle_panel_driver); |
| 124 | } |
| 125 | |
| 126 | static void __exit omap3beagle_panel_drv_exit(void) |
| 127 | { |
| 128 | platform_driver_unregister(&omap3beagle_panel_driver); |
| 129 | } |
| 130 | |
| 131 | module_init(omap3beagle_panel_drv_init); |
| 132 | module_exit(omap3beagle_panel_drv_exit); |