1 /* Copyright (c) 2009, Code Aurora Forum. All rights reserved.
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20 #include "mddihosti.h"
21 #include "mddi_toshiba.h"
23 static uint32 read_client_reg(uint32 addr)
26 mddi_queue_register_read(addr, &val, TRUE, 0);
30 static uint32 toshiba_lcd_gpio_read(void)
34 write_client_reg(GPIODIR, 0x0000000C, TRUE);
35 write_client_reg(GPIOSEL, 0x00000000, TRUE);
36 write_client_reg(GPIOSEL, 0x00000000, TRUE);
37 write_client_reg(GPIOPC, 0x03CF00C0, TRUE);
38 val = read_client_reg(GPIODATA) & 0x2C0;
43 static u32 mddi_toshiba_panel_detect(void)
45 mddi_host_type host_idx = MDDI_HOST_PRIM;
47 u32 mddi_toshiba_lcd = LCD_TOSHIBA_2P4_VGA;
49 /* Toshiba display requires larger drive_lo value */
50 mddi_host_reg_out(DRIVE_LO, 0x0050);
52 lcd_gpio = toshiba_lcd_gpio_read();
55 mddi_toshiba_lcd = LCD_SHARP_2P4_VGA;
60 mddi_toshiba_lcd = LCD_TOSHIBA_2P4_VGA;
64 return mddi_toshiba_lcd;
67 static int __init mddi_toshiba_vga_init(void)
70 struct msm_panel_info pinfo;
73 #ifdef CONFIG_FB_MSM_MDDI_AUTO_DETECT
76 ret = msm_fb_detect_client("mddi_toshiba_vga");
81 id = mddi_get_client_id();
82 if ((id >> 16) != 0xD263)
87 panel = mddi_toshiba_panel_detect();
91 pinfo.type = MDDI_PANEL;
92 pinfo.pdest = DISPLAY_1;
93 pinfo.mddi.vdopkt = MDDI_DEFAULT_PRIM_PIX_ATTR;
96 pinfo.lcd.vsync_enable = TRUE;
97 pinfo.lcd.refx100 = 6118;
98 pinfo.lcd.v_back_porch = 6;
99 pinfo.lcd.v_front_porch = 0;
100 pinfo.lcd.v_pulse_width = 0;
101 pinfo.lcd.hw_vsync_mode = FALSE;
102 pinfo.lcd.vsync_notifier_period = (1 * HZ);
105 pinfo.clk_rate = 122880000;
106 pinfo.clk_min = 120000000;
107 pinfo.clk_max = 200000000;
110 ret = mddi_toshiba_device_register(&pinfo, TOSHIBA_VGA_PRIM, panel);
112 printk(KERN_ERR "%s: failed to register device!\n", __func__);
118 pinfo.type = MDDI_PANEL;
119 pinfo.pdest = DISPLAY_2;
120 pinfo.mddi.vdopkt = 0x400;
121 pinfo.wait_cycle = 0;
123 pinfo.clk_rate = 122880000;
124 pinfo.clk_min = 120000000;
125 pinfo.clk_max = 200000000;
128 ret = mddi_toshiba_device_register(&pinfo, TOSHIBA_VGA_SECD, panel);
131 "%s: failed to register device!\n", __func__);
136 module_init(mddi_toshiba_vga_init);