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 | |
Jingoo Han | f8bd493 | 2012-01-26 19:32:34 +0900 | [diff] [blame] | 25 | #include <linux/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 | |
Jingoo Han | f8bd493 | 2012-01-26 19:32:34 +0900 | [diff] [blame] | 35 | /* configure GPIO(14, 15) as outputs */ |
| 36 | if (gpio_request_one(14, GPIOF_OUT_INIT_LOW, "lcd_en0")) { |
Emil Medve | 1f7c823 | 2007-10-16 23:29:48 -0700 | [diff] [blame] | 37 | pr_err(MODULE_NAME ": can't request GPIO 14\n"); |
Imre Deak | d64ca86 | 2007-07-17 04:06:06 -0700 | [diff] [blame] | 38 | r = -1; |
| 39 | goto exit; |
| 40 | } |
Jingoo Han | f8bd493 | 2012-01-26 19:32:34 +0900 | [diff] [blame] | 41 | if (gpio_request_one(15, GPIOF_OUT_INIT_LOW, "lcd_en1")) { |
Emil Medve | 1f7c823 | 2007-10-16 23:29:48 -0700 | [diff] [blame] | 42 | pr_err(MODULE_NAME ": can't request GPIO 15\n"); |
David Brownell | 93a22f8 | 2008-10-15 22:03:15 -0700 | [diff] [blame] | 43 | gpio_free(14); |
Imre Deak | d64ca86 | 2007-07-17 04:06:06 -0700 | [diff] [blame] | 44 | r = -1; |
| 45 | goto exit; |
| 46 | } |
Imre Deak | d64ca86 | 2007-07-17 04:06:06 -0700 | [diff] [blame] | 47 | exit: |
| 48 | return r; |
| 49 | } |
| 50 | |
| 51 | static void innovator1610_panel_cleanup(struct lcd_panel *panel) |
| 52 | { |
David Brownell | 93a22f8 | 2008-10-15 22:03:15 -0700 | [diff] [blame] | 53 | gpio_free(15); |
| 54 | gpio_free(14); |
Imre Deak | d64ca86 | 2007-07-17 04:06:06 -0700 | [diff] [blame] | 55 | } |
| 56 | |
| 57 | static int innovator1610_panel_enable(struct lcd_panel *panel) |
| 58 | { |
| 59 | /* set GPIO14 and GPIO15 high */ |
David Brownell | 93a22f8 | 2008-10-15 22:03:15 -0700 | [diff] [blame] | 60 | gpio_set_value(14, 1); |
| 61 | gpio_set_value(15, 1); |
Imre Deak | d64ca86 | 2007-07-17 04:06:06 -0700 | [diff] [blame] | 62 | return 0; |
| 63 | } |
| 64 | |
| 65 | static void innovator1610_panel_disable(struct lcd_panel *panel) |
| 66 | { |
| 67 | /* set GPIO13, GPIO14 and GPIO15 low */ |
David Brownell | 93a22f8 | 2008-10-15 22:03:15 -0700 | [diff] [blame] | 68 | gpio_set_value(14, 0); |
| 69 | gpio_set_value(15, 0); |
Imre Deak | d64ca86 | 2007-07-17 04:06:06 -0700 | [diff] [blame] | 70 | } |
| 71 | |
| 72 | static unsigned long innovator1610_panel_get_caps(struct lcd_panel *panel) |
| 73 | { |
| 74 | return 0; |
| 75 | } |
| 76 | |
| 77 | struct lcd_panel innovator1610_panel = { |
| 78 | .name = "inn1610", |
| 79 | .config = OMAP_LCDC_PANEL_TFT, |
| 80 | |
| 81 | .bpp = 16, |
| 82 | .data_lines = 16, |
| 83 | .x_res = 320, |
| 84 | .y_res = 240, |
| 85 | .pixel_clock = 12500, |
| 86 | .hsw = 40, |
| 87 | .hfp = 40, |
| 88 | .hbp = 72, |
| 89 | .vsw = 1, |
| 90 | .vfp = 1, |
| 91 | .vbp = 0, |
| 92 | .pcd = 12, |
| 93 | |
| 94 | .init = innovator1610_panel_init, |
| 95 | .cleanup = innovator1610_panel_cleanup, |
| 96 | .enable = innovator1610_panel_enable, |
| 97 | .disable = innovator1610_panel_disable, |
| 98 | .get_caps = innovator1610_panel_get_caps, |
| 99 | }; |
| 100 | |
| 101 | static int innovator1610_panel_probe(struct platform_device *pdev) |
| 102 | { |
| 103 | omapfb_register_panel(&innovator1610_panel); |
| 104 | return 0; |
| 105 | } |
| 106 | |
| 107 | static int innovator1610_panel_remove(struct platform_device *pdev) |
| 108 | { |
| 109 | return 0; |
| 110 | } |
| 111 | |
| 112 | static int innovator1610_panel_suspend(struct platform_device *pdev, |
| 113 | pm_message_t mesg) |
| 114 | { |
| 115 | return 0; |
| 116 | } |
| 117 | |
| 118 | static int innovator1610_panel_resume(struct platform_device *pdev) |
| 119 | { |
| 120 | return 0; |
| 121 | } |
| 122 | |
Axel Lin | f990544 | 2011-12-09 09:37:57 +0800 | [diff] [blame] | 123 | static struct platform_driver innovator1610_panel_driver = { |
Imre Deak | d64ca86 | 2007-07-17 04:06:06 -0700 | [diff] [blame] | 124 | .probe = innovator1610_panel_probe, |
| 125 | .remove = innovator1610_panel_remove, |
| 126 | .suspend = innovator1610_panel_suspend, |
| 127 | .resume = innovator1610_panel_resume, |
| 128 | .driver = { |
| 129 | .name = "lcd_inn1610", |
| 130 | .owner = THIS_MODULE, |
| 131 | }, |
| 132 | }; |
| 133 | |
Axel Lin | f806f9b | 2011-12-09 09:59:56 +0800 | [diff] [blame] | 134 | module_platform_driver(innovator1610_panel_driver); |