2 * File: drivers/video/omap_new/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>
26 #include <asm/arch/mux.h>
30 // #define OMAPFB_DBG 1
33 #include "../drivers/ssi/omap-uwire.h"
35 #define TSC2101_UWIRE_CS 1
37 static int tsc2101_write_reg(int page, int reg, u16 data)
44 cmd = ((page & 3) << 11) | ((reg & 0x3f) << 5);
45 if (omap_uwire_data_transfer(TSC2101_UWIRE_CS, cmd, 16, 0, NULL, 1))
48 r = omap_uwire_data_transfer(TSC2101_UWIRE_CS, data, 16, 0, NULL, 0);
54 static int h2_panel_init(struct lcd_panel *panel)
56 unsigned long uwire_flags;
59 /* Configure N15 pin to be uWire CS1 */
60 omap_cfg_reg(N15_1610_UWIRE_CS1);
61 uwire_flags = UWIRE_READ_RISING_EDGE | UWIRE_WRITE_RISING_EDGE;
62 uwire_flags |= UWIRE_FREQ_DIV_8;
63 omap_uwire_configure_mode(TSC2101_UWIRE_CS, uwire_flags);
69 static void h2_panel_cleanup(struct lcd_panel *panel)
75 static int h2_panel_enable(struct lcd_panel *panel)
81 /* Assert LCD_EN, BKLIGHT_EN pins on LCD panel
82 * page2, GPIO config reg, GPIO(0,1) to out and asserted
84 r = tsc2101_write_reg(2, 0x23, 0xCC00) ? -1 : 0;
90 static void h2_panel_disable(struct lcd_panel *panel)
94 /* Deassert LCD_EN and BKLIGHT_EN pins on LCD panel
95 * page2, GPIO config reg, GPIO(0,1) to out and deasserted
97 if (tsc2101_write_reg(2, 0x23, 0x8800))
98 PRNERR("failed to disable LCD panel\n");
103 static unsigned long h2_panel_get_caps(struct lcd_panel *panel)
108 static struct lcdc_video_mode mode240x320 = {
111 .pixel_clock = 12500,
122 struct lcd_panel h2_panel = {
124 .config = LCD_PANEL_TFT,
125 .video_mode = &mode240x320,
127 .init = h2_panel_init,
128 .cleanup = h2_panel_cleanup,
129 .enable = h2_panel_enable,
130 .disable = h2_panel_disable,
131 .get_caps= h2_panel_get_caps,