blob: 4b01c4e2f3e64c71e8f6a373f31849b7059b4460 [file] [log] [blame]
Dirk Behme107cc642007-07-17 04:06:07 -07001/*
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>
Bjorn Helgaas288e6ea2016-02-02 13:53:23 -060025#include <linux/gpio.h>
Tony Lindgren0adcbaf2013-02-11 14:46:00 -080026
27#include <mach/hardware.h>
Tony Lindgren70c494c2012-09-19 10:46:56 -070028#include <mach/mux.h>
Tony Lindgren0adcbaf2013-02-11 14:46:00 -080029
Tomi Valkeinen91773a02009-08-03 15:06:36 +030030#include "omapfb.h"
Dirk Behme107cc642007-07-17 04:06:07 -070031
32static int osk_panel_init(struct lcd_panel *panel, struct omapfb_device *fbdev)
33{
David Brownell93a22f82008-10-15 22:03:15 -070034 /* gpio2 was allocated in board init */
Dirk Behme107cc642007-07-17 04:06:07 -070035 return 0;
36}
37
38static void osk_panel_cleanup(struct lcd_panel *panel)
39{
40}
41
42static int osk_panel_enable(struct lcd_panel *panel)
43{
44 /* configure PWL pin */
45 omap_cfg_reg(PWL);
46
47 /* Enable PWL unit */
48 omap_writeb(0x01, OMAP_PWL_CLK_ENABLE);
49
50 /* Set PWL level */
51 omap_writeb(0xFF, OMAP_PWL_ENABLE);
52
David Brownell93a22f82008-10-15 22:03:15 -070053 /* set GPIO2 high (lcd power enabled) */
54 gpio_set_value(2, 1);
Dirk Behme107cc642007-07-17 04:06:07 -070055
56 return 0;
57}
58
59static void osk_panel_disable(struct lcd_panel *panel)
60{
61 /* Set PWL level to zero */
62 omap_writeb(0x00, OMAP_PWL_ENABLE);
63
64 /* Disable PWL unit */
65 omap_writeb(0x00, OMAP_PWL_CLK_ENABLE);
66
67 /* set GPIO2 low */
David Brownell93a22f82008-10-15 22:03:15 -070068 gpio_set_value(2, 0);
Dirk Behme107cc642007-07-17 04:06:07 -070069}
70
71static unsigned long osk_panel_get_caps(struct lcd_panel *panel)
72{
73 return 0;
74}
75
Lars-Peter Clausenb2c1e8a2017-01-30 17:39:49 +010076static struct lcd_panel osk_panel = {
Dirk Behme107cc642007-07-17 04:06:07 -070077 .name = "osk",
78 .config = OMAP_LCDC_PANEL_TFT,
79
80 .bpp = 16,
81 .data_lines = 16,
82 .x_res = 240,
83 .y_res = 320,
84 .pixel_clock = 12500,
85 .hsw = 40,
86 .hfp = 40,
87 .hbp = 72,
88 .vsw = 1,
89 .vfp = 1,
90 .vbp = 0,
91 .pcd = 12,
92
93 .init = osk_panel_init,
94 .cleanup = osk_panel_cleanup,
95 .enable = osk_panel_enable,
96 .disable = osk_panel_disable,
97 .get_caps = osk_panel_get_caps,
98};
99
100static int osk_panel_probe(struct platform_device *pdev)
101{
102 omapfb_register_panel(&osk_panel);
103 return 0;
104}
105
Axel Linf9905442011-12-09 09:37:57 +0800106static struct platform_driver osk_panel_driver = {
Dirk Behme107cc642007-07-17 04:06:07 -0700107 .probe = osk_panel_probe,
Dirk Behme107cc642007-07-17 04:06:07 -0700108 .driver = {
109 .name = "lcd_osk",
Dirk Behme107cc642007-07-17 04:06:07 -0700110 },
111};
112
Axel Linf806f9b2011-12-09 09:59:56 +0800113module_platform_driver(osk_panel_driver);