Imre Deak | d64ca86 | 2007-07-17 04:06:06 -0700 | [diff] [blame] | 1 | /* |
| 2 | * LCD panel support for the TI OMAP1610 Innovator board |
| 3 | * |
| 4 | * Copyright (C) 2004 Nokia Corporation |
| 5 | * Author: Imre Deak <imre.deak@nokia.com> |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify it |
| 8 | * under the terms of the GNU General Public License as published by the |
| 9 | * Free Software Foundation; either version 2 of the License, or (at your |
| 10 | * option) any later version. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, but |
| 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 | * General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License along |
| 18 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 19 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 20 | */ |
| 21 | |
| 22 | #include <linux/module.h> |
| 23 | #include <linux/platform_device.h> |
| 24 | |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 25 | #include <mach/gpio.h> |
Tomi Valkeinen | 91773a0 | 2009-08-03 15:06:36 +0300 | [diff] [blame] | 26 | #include "omapfb.h" |
Imre Deak | d64ca86 | 2007-07-17 04:06:06 -0700 | [diff] [blame] | 27 | |
| 28 | #define MODULE_NAME "omapfb-lcd_h3" |
| 29 | |
Imre Deak | d64ca86 | 2007-07-17 04:06:06 -0700 | [diff] [blame] | 30 | static int innovator1610_panel_init(struct lcd_panel *panel, |
| 31 | struct omapfb_device *fbdev) |
| 32 | { |
| 33 | int r = 0; |
| 34 | |
David Brownell | 93a22f8 | 2008-10-15 22:03:15 -0700 | [diff] [blame] | 35 | if (gpio_request(14, "lcd_en0")) { |
Emil Medve | 1f7c823 | 2007-10-16 23:29:48 -0700 | [diff] [blame] | 36 | pr_err(MODULE_NAME ": can't request GPIO 14\n"); |
Imre Deak | d64ca86 | 2007-07-17 04:06:06 -0700 | [diff] [blame] | 37 | r = -1; |
| 38 | goto exit; |
| 39 | } |
David Brownell | 93a22f8 | 2008-10-15 22:03:15 -0700 | [diff] [blame] | 40 | if (gpio_request(15, "lcd_en1")) { |
Emil Medve | 1f7c823 | 2007-10-16 23:29:48 -0700 | [diff] [blame] | 41 | pr_err(MODULE_NAME ": can't request GPIO 15\n"); |
David Brownell | 93a22f8 | 2008-10-15 22:03:15 -0700 | [diff] [blame] | 42 | gpio_free(14); |
Imre Deak | d64ca86 | 2007-07-17 04:06:06 -0700 | [diff] [blame] | 43 | r = -1; |
| 44 | goto exit; |
| 45 | } |
| 46 | /* configure GPIO(14, 15) as outputs */ |
David Brownell | 93a22f8 | 2008-10-15 22:03:15 -0700 | [diff] [blame] | 47 | gpio_direction_output(14, 0); |
| 48 | gpio_direction_output(15, 0); |
Imre Deak | d64ca86 | 2007-07-17 04:06:06 -0700 | [diff] [blame] | 49 | exit: |
| 50 | return r; |
| 51 | } |
| 52 | |
| 53 | static void innovator1610_panel_cleanup(struct lcd_panel *panel) |
| 54 | { |
David Brownell | 93a22f8 | 2008-10-15 22:03:15 -0700 | [diff] [blame] | 55 | gpio_free(15); |
| 56 | gpio_free(14); |
Imre Deak | d64ca86 | 2007-07-17 04:06:06 -0700 | [diff] [blame] | 57 | } |
| 58 | |
| 59 | static int innovator1610_panel_enable(struct lcd_panel *panel) |
| 60 | { |
| 61 | /* set GPIO14 and GPIO15 high */ |
David Brownell | 93a22f8 | 2008-10-15 22:03:15 -0700 | [diff] [blame] | 62 | gpio_set_value(14, 1); |
| 63 | gpio_set_value(15, 1); |
Imre Deak | d64ca86 | 2007-07-17 04:06:06 -0700 | [diff] [blame] | 64 | return 0; |
| 65 | } |
| 66 | |
| 67 | static void innovator1610_panel_disable(struct lcd_panel *panel) |
| 68 | { |
| 69 | /* set GPIO13, GPIO14 and GPIO15 low */ |
David Brownell | 93a22f8 | 2008-10-15 22:03:15 -0700 | [diff] [blame] | 70 | gpio_set_value(14, 0); |
| 71 | gpio_set_value(15, 0); |
Imre Deak | d64ca86 | 2007-07-17 04:06:06 -0700 | [diff] [blame] | 72 | } |
| 73 | |
| 74 | static unsigned long innovator1610_panel_get_caps(struct lcd_panel *panel) |
| 75 | { |
| 76 | return 0; |
| 77 | } |
| 78 | |
| 79 | struct lcd_panel innovator1610_panel = { |
| 80 | .name = "inn1610", |
| 81 | .config = OMAP_LCDC_PANEL_TFT, |
| 82 | |
| 83 | .bpp = 16, |
| 84 | .data_lines = 16, |
| 85 | .x_res = 320, |
| 86 | .y_res = 240, |
| 87 | .pixel_clock = 12500, |
| 88 | .hsw = 40, |
| 89 | .hfp = 40, |
| 90 | .hbp = 72, |
| 91 | .vsw = 1, |
| 92 | .vfp = 1, |
| 93 | .vbp = 0, |
| 94 | .pcd = 12, |
| 95 | |
| 96 | .init = innovator1610_panel_init, |
| 97 | .cleanup = innovator1610_panel_cleanup, |
| 98 | .enable = innovator1610_panel_enable, |
| 99 | .disable = innovator1610_panel_disable, |
| 100 | .get_caps = innovator1610_panel_get_caps, |
| 101 | }; |
| 102 | |
| 103 | static int innovator1610_panel_probe(struct platform_device *pdev) |
| 104 | { |
| 105 | omapfb_register_panel(&innovator1610_panel); |
| 106 | return 0; |
| 107 | } |
| 108 | |
| 109 | static int innovator1610_panel_remove(struct platform_device *pdev) |
| 110 | { |
| 111 | return 0; |
| 112 | } |
| 113 | |
| 114 | static int innovator1610_panel_suspend(struct platform_device *pdev, |
| 115 | pm_message_t mesg) |
| 116 | { |
| 117 | return 0; |
| 118 | } |
| 119 | |
| 120 | static int innovator1610_panel_resume(struct platform_device *pdev) |
| 121 | { |
| 122 | return 0; |
| 123 | } |
| 124 | |
| 125 | struct platform_driver innovator1610_panel_driver = { |
| 126 | .probe = innovator1610_panel_probe, |
| 127 | .remove = innovator1610_panel_remove, |
| 128 | .suspend = innovator1610_panel_suspend, |
| 129 | .resume = innovator1610_panel_resume, |
| 130 | .driver = { |
| 131 | .name = "lcd_inn1610", |
| 132 | .owner = THIS_MODULE, |
| 133 | }, |
| 134 | }; |
| 135 | |
Peter Huewe | 3f6db50 | 2009-07-03 14:39:40 +0200 | [diff] [blame] | 136 | static int __init innovator1610_panel_drv_init(void) |
Imre Deak | d64ca86 | 2007-07-17 04:06:06 -0700 | [diff] [blame] | 137 | { |
| 138 | return platform_driver_register(&innovator1610_panel_driver); |
| 139 | } |
| 140 | |
Peter Huewe | 3f6db50 | 2009-07-03 14:39:40 +0200 | [diff] [blame] | 141 | static void __exit innovator1610_panel_drv_cleanup(void) |
Imre Deak | d64ca86 | 2007-07-17 04:06:06 -0700 | [diff] [blame] | 142 | { |
| 143 | platform_driver_unregister(&innovator1610_panel_driver); |
| 144 | } |
| 145 | |
| 146 | module_init(innovator1610_panel_drv_init); |
| 147 | module_exit(innovator1610_panel_drv_cleanup); |
| 148 | |