2 * File: drivers/video/omap/lcd-h2.c
4 * LCD panel support for the TI OMAP H2 board
6 * Copyright (C) 2004 Nokia Corporation
7 * Author: Imre Deak <imre.deak@nokia.com>
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 #include <linux/module.h>
25 #include <linux/platform_device.h>
26 #include <linux/spi/tsc2101.h>
28 #include <asm/arch/mux.h>
29 #include <asm/arch/omapfb.h>
32 struct platform_device *lcd_dev;
33 struct spi_device *tsc2101_dev;
36 static int h2_panel_init(struct lcd_panel *panel, struct omapfb_device *fbdev)
41 static void h2_panel_cleanup(struct lcd_panel *panel)
45 static int h2_panel_enable(struct lcd_panel *panel)
49 /* Assert LCD_EN, BKLIGHT_EN pins on LCD panel
50 * page2, GPIO config reg, GPIO(0,1) to out and asserted
52 r = tsc2101_write_sync(h2_panel_dev.tsc2101_dev, 2, 0x23, 0xcc00);
54 dev_err(&h2_panel_dev.lcd_dev->dev,
55 "failed to enable LCD panel\n");
60 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);