2 * LCD panel support for the TI OMAP H2 board
4 * Copyright (C) 2004 Nokia Corporation
5 * Author: Imre Deak <imre.deak@nokia.com>
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.
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.
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.
22 #include <linux/module.h>
23 #include <linux/platform_device.h>
24 #include <linux/spi/tsc2101.h>
26 #include <asm/arch/mux.h>
27 #include <asm/arch/omapfb.h>
30 struct platform_device *lcd_dev;
31 struct spi_device *tsc2101_dev;
34 static int h2_panel_init(struct lcd_panel *panel, struct omapfb_device *fbdev)
39 static void h2_panel_cleanup(struct lcd_panel *panel)
43 static int h2_panel_enable(struct lcd_panel *panel)
48 * Assert LCD_EN, BKLIGHT_EN pins on LCD panel
49 * page2, GPIO config reg, GPIO(0,1) to out and asserted
51 r = tsc2101_write_sync(h2_panel_dev.tsc2101_dev, 2, 0x23, 0xcc00);
53 dev_err(&h2_panel_dev.lcd_dev->dev,
54 "failed to enable LCD panel\n");
59 static void h2_panel_disable(struct lcd_panel *panel)
62 * Deassert LCD_EN and BKLIGHT_EN pins on LCD panel
63 * page2, GPIO config reg, GPIO(0,1) to out and deasserted
65 if (tsc2101_write_sync(h2_panel_dev.tsc2101_dev, 2, 0x23, 0x8800))
66 dev_err(&h2_panel_dev.lcd_dev->dev,
67 "failed to disable LCD panel\n");
70 static unsigned long h2_panel_get_caps(struct lcd_panel *panel)
75 struct lcd_panel h2_panel = {
77 .config = OMAP_LCDC_PANEL_TFT,
91 .init = h2_panel_init,
92 .cleanup = h2_panel_cleanup,
93 .enable = h2_panel_enable,
94 .disable = h2_panel_disable,
95 .get_caps = h2_panel_get_caps,
98 static int h2_panel_probe(struct platform_device *pdev)
100 struct spi_device *tsc2101;
102 tsc2101 = pdev->dev.platform_data;
103 if (tsc2101 == NULL) {
104 dev_err(&pdev->dev, "no platform data\n");
107 if (strncmp(tsc2101->modalias, "tsc2101", 8) != 0) {
108 dev_err(&pdev->dev, "tsc2101 not found\n");
111 h2_panel_dev.lcd_dev = pdev;
112 h2_panel_dev.tsc2101_dev = tsc2101;
113 omapfb_register_panel(&h2_panel);
117 static int h2_panel_remove(struct platform_device *pdev)
122 static int h2_panel_suspend(struct platform_device *pdev, pm_message_t mesg)
127 static int h2_panel_resume(struct platform_device *pdev)
132 struct platform_driver h2_panel_driver = {
133 .probe = h2_panel_probe,
134 .remove = h2_panel_remove,
135 .suspend = h2_panel_suspend,
136 .resume = h2_panel_resume,
139 .owner = THIS_MODULE,
143 static int h2_panel_drv_init(void)
145 return platform_driver_register(&h2_panel_driver);
148 static void h2_panel_drv_cleanup(void)
150 platform_driver_unregister(&h2_panel_driver);
153 module_init(h2_panel_drv_init);
154 module_exit(h2_panel_drv_cleanup);