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>
27 #include <asm/arch/mux.h>
28 #include <asm/arch/omapfb.h>
30 #include "../drivers/ssi/omap-uwire.h"
32 #define MODULE_NAME "omapfb-lcd_h2"
33 #define TSC2101_UWIRE_CS 1
35 #define pr_err(fmt, args...) printk(KERN_ERR MODULE_NAME ": " fmt, ## args)
37 static int tsc2101_write_reg(int page, int reg, u16 data)
42 cmd = ((page & 3) << 11) | ((reg & 0x3f) << 5);
43 if (omap_uwire_data_transfer(TSC2101_UWIRE_CS, cmd, 16, 0, NULL, 1))
46 r = omap_uwire_data_transfer(TSC2101_UWIRE_CS, data, 16, 0,
52 static int h2_panel_init(struct lcd_panel *panel, struct omapfb_device *fbdev)
54 unsigned long uwire_flags;
56 /* Configure N15 pin to be uWire CS1 */
57 omap_cfg_reg(N15_1610_UWIRE_CS1);
58 uwire_flags = UWIRE_READ_RISING_EDGE | UWIRE_WRITE_RISING_EDGE;
59 uwire_flags |= UWIRE_FREQ_DIV_8;
60 omap_uwire_configure_mode(TSC2101_UWIRE_CS, uwire_flags);
65 static void h2_panel_cleanup(struct lcd_panel *panel)
69 static int h2_panel_enable(struct lcd_panel *panel)
73 /* Assert LCD_EN, BKLIGHT_EN pins on LCD panel
74 * page2, GPIO config reg, GPIO(0,1) to out and asserted
76 r = tsc2101_write_reg(2, 0x23, 0xCC00) ? -1 : 0;
81 static void h2_panel_disable(struct lcd_panel *panel)
83 /* Deassert LCD_EN and BKLIGHT_EN pins on LCD panel
84 * page2, GPIO config reg, GPIO(0,1) to out and deasserted
86 if (tsc2101_write_reg(2, 0x23, 0x8800))
87 pr_err("failed to disable LCD panel\n");
90 static unsigned long h2_panel_get_caps(struct lcd_panel *panel)
95 struct lcd_panel h2_panel = {
97 .config = OMAP_LCDC_PANEL_TFT,
111 .init = h2_panel_init,
112 .cleanup = h2_panel_cleanup,
113 .enable = h2_panel_enable,
114 .disable = h2_panel_disable,
115 .get_caps = h2_panel_get_caps,
118 static int h2_panel_probe(struct platform_device *pdev)
120 omapfb_register_panel(&h2_panel);
124 static int h2_panel_remove(struct platform_device *pdev)
129 static int h2_panel_suspend(struct platform_device *pdev, pm_message_t mesg)
134 static int h2_panel_resume(struct platform_device *pdev)
139 struct platform_driver h2_panel_driver = {
140 .probe = h2_panel_probe,
141 .remove = h2_panel_remove,
142 .suspend = h2_panel_suspend,
143 .resume = h2_panel_resume,
146 .owner = THIS_MODULE,
150 static int h2_panel_drv_init(void)
152 return platform_driver_register(&h2_panel_driver);
155 static void h2_panel_drv_cleanup(void)
157 platform_driver_unregister(&h2_panel_driver);
160 module_init(h2_panel_drv_init);
161 module_exit(h2_panel_drv_cleanup);