Dirk Behme | 107cc64 | 2007-07-17 04:06:07 -0700 | [diff] [blame] | 1 | /* |
| 2 | * LCD panel support for the TI OMAP OSK board |
| 3 | * |
| 4 | * Copyright (C) 2004 Nokia Corporation |
| 5 | * Author: Imre Deak <imre.deak@nokia.com> |
| 6 | * Adapted for OSK by <dirk.behme@de.bosch.com> |
| 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 | |
Russell King | 1bc857f | 2011-07-26 10:54:55 +0100 | [diff] [blame] | 26 | #include <asm/gpio.h> |
Tony Lindgren | 0adcbaf | 2013-02-11 14:46:00 -0800 | [diff] [blame] | 27 | |
| 28 | #include <mach/hardware.h> |
Tony Lindgren | 70c494c | 2012-09-19 10:46:56 -0700 | [diff] [blame] | 29 | #include <mach/mux.h> |
Tony Lindgren | 0adcbaf | 2013-02-11 14:46:00 -0800 | [diff] [blame] | 30 | |
Tomi Valkeinen | 91773a0 | 2009-08-03 15:06:36 +0300 | [diff] [blame] | 31 | #include "omapfb.h" |
Dirk Behme | 107cc64 | 2007-07-17 04:06:07 -0700 | [diff] [blame] | 32 | |
| 33 | static int osk_panel_init(struct lcd_panel *panel, struct omapfb_device *fbdev) |
| 34 | { |
David Brownell | 93a22f8 | 2008-10-15 22:03:15 -0700 | [diff] [blame] | 35 | /* gpio2 was allocated in board init */ |
Dirk Behme | 107cc64 | 2007-07-17 04:06:07 -0700 | [diff] [blame] | 36 | return 0; |
| 37 | } |
| 38 | |
| 39 | static void osk_panel_cleanup(struct lcd_panel *panel) |
| 40 | { |
| 41 | } |
| 42 | |
| 43 | static int osk_panel_enable(struct lcd_panel *panel) |
| 44 | { |
| 45 | /* configure PWL pin */ |
| 46 | omap_cfg_reg(PWL); |
| 47 | |
| 48 | /* Enable PWL unit */ |
| 49 | omap_writeb(0x01, OMAP_PWL_CLK_ENABLE); |
| 50 | |
| 51 | /* Set PWL level */ |
| 52 | omap_writeb(0xFF, OMAP_PWL_ENABLE); |
| 53 | |
David Brownell | 93a22f8 | 2008-10-15 22:03:15 -0700 | [diff] [blame] | 54 | /* set GPIO2 high (lcd power enabled) */ |
| 55 | gpio_set_value(2, 1); |
Dirk Behme | 107cc64 | 2007-07-17 04:06:07 -0700 | [diff] [blame] | 56 | |
| 57 | return 0; |
| 58 | } |
| 59 | |
| 60 | static void osk_panel_disable(struct lcd_panel *panel) |
| 61 | { |
| 62 | /* Set PWL level to zero */ |
| 63 | omap_writeb(0x00, OMAP_PWL_ENABLE); |
| 64 | |
| 65 | /* Disable PWL unit */ |
| 66 | omap_writeb(0x00, OMAP_PWL_CLK_ENABLE); |
| 67 | |
| 68 | /* set GPIO2 low */ |
David Brownell | 93a22f8 | 2008-10-15 22:03:15 -0700 | [diff] [blame] | 69 | gpio_set_value(2, 0); |
Dirk Behme | 107cc64 | 2007-07-17 04:06:07 -0700 | [diff] [blame] | 70 | } |
| 71 | |
| 72 | static unsigned long osk_panel_get_caps(struct lcd_panel *panel) |
| 73 | { |
| 74 | return 0; |
| 75 | } |
| 76 | |
| 77 | struct lcd_panel osk_panel = { |
| 78 | .name = "osk", |
| 79 | .config = OMAP_LCDC_PANEL_TFT, |
| 80 | |
| 81 | .bpp = 16, |
| 82 | .data_lines = 16, |
| 83 | .x_res = 240, |
| 84 | .y_res = 320, |
| 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 = osk_panel_init, |
| 95 | .cleanup = osk_panel_cleanup, |
| 96 | .enable = osk_panel_enable, |
| 97 | .disable = osk_panel_disable, |
| 98 | .get_caps = osk_panel_get_caps, |
| 99 | }; |
| 100 | |
| 101 | static int osk_panel_probe(struct platform_device *pdev) |
| 102 | { |
| 103 | omapfb_register_panel(&osk_panel); |
| 104 | return 0; |
| 105 | } |
| 106 | |
| 107 | static int osk_panel_remove(struct platform_device *pdev) |
| 108 | { |
| 109 | return 0; |
| 110 | } |
| 111 | |
| 112 | static int osk_panel_suspend(struct platform_device *pdev, pm_message_t mesg) |
| 113 | { |
| 114 | return 0; |
| 115 | } |
| 116 | |
| 117 | static int osk_panel_resume(struct platform_device *pdev) |
| 118 | { |
| 119 | return 0; |
| 120 | } |
| 121 | |
Axel Lin | f990544 | 2011-12-09 09:37:57 +0800 | [diff] [blame] | 122 | static struct platform_driver osk_panel_driver = { |
Dirk Behme | 107cc64 | 2007-07-17 04:06:07 -0700 | [diff] [blame] | 123 | .probe = osk_panel_probe, |
| 124 | .remove = osk_panel_remove, |
| 125 | .suspend = osk_panel_suspend, |
| 126 | .resume = osk_panel_resume, |
| 127 | .driver = { |
| 128 | .name = "lcd_osk", |
| 129 | .owner = THIS_MODULE, |
| 130 | }, |
| 131 | }; |
| 132 | |
Axel Lin | f806f9b | 2011-12-09 09:59:56 +0800 | [diff] [blame] | 133 | module_platform_driver(osk_panel_driver); |