1
/* Copyright (c) 2010, 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
18
#include <linux/i2c.h>
19
#include <linux/delay.h>
22
#define DEVICE_NAME "sii9022"
23
#define SII9022_DEVICE_ID 0xB0
25
struct sii9022_i2c_addr_data{
31
static u8 video_mode_data[] = {
33
0xF9, 0x1C, 0x70, 0x17, 0x72, 0x06, 0xEE, 0x02,
36
static u8 avi_io_format[] = {
42
static struct sii9022_i2c_addr_data regset0[] = {
48
static u8 video_infoframe[] = {
50
0xF0, 0x00, 0x68, 0x00, 0x04, 0x00, 0x19, 0x00,
51
0xE9, 0x02, 0x04, 0x01, 0x04, 0x06,
55
static struct sii9022_i2c_addr_data regset1[] = {
68
static u8 misc_infoframe[] = {
70
0xC2, 0x84, 0x01, 0x0A, 0x6F, 0x02, 0x00, 0x00,
71
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
74
/* set HDMI, active */
75
static struct sii9022_i2c_addr_data regset2[] = {
80
static int send_i2c_data(struct i2c_client *client,
81
struct sii9022_i2c_addr_data *regset,
87
for (i = 0; i < size; i++) {
88
rc = i2c_smbus_write_byte_data(
90
regset[i].addr, regset[i].data);
97
static int hdmi_sii_enable(struct i2c_client *client)
103
rc = i2c_smbus_write_byte_data(client, 0xC7, 0x00);
109
rc = i2c_smbus_read_byte_data(client, 0x1B);
110
} while ((rc != SII9022_DEVICE_ID) && retries--);
112
if (rc != SII9022_DEVICE_ID)
115
rc = i2c_smbus_write_byte_data(client, 0x1A, 0x11);
119
count = ARRAY_SIZE(video_mode_data);
120
rc = i2c_master_send(client, video_mode_data, count);
126
rc = i2c_smbus_write_byte_data(client, 0x08, 0x20);
129
count = ARRAY_SIZE(avi_io_format);
130
rc = i2c_master_send(client, avi_io_format, count);
136
rc = send_i2c_data(client, regset0, ARRAY_SIZE(regset0));
140
count = ARRAY_SIZE(video_infoframe);
141
rc = i2c_master_send(client, video_infoframe, count);
147
rc = send_i2c_data(client, regset1, ARRAY_SIZE(regset1));
151
count = ARRAY_SIZE(misc_infoframe);
152
rc = i2c_master_send(client, misc_infoframe, count);
158
rc = send_i2c_data(client, regset2, ARRAY_SIZE(regset2));
164
printk(KERN_ERR "%s: exited rc=%d\n", __func__, rc);
168
static const struct i2c_device_id hmdi_sii_id[] = {
173
static int hdmi_sii_probe(struct i2c_client *client,
174
const struct i2c_device_id *id)
178
if (!i2c_check_functionality(client->adapter,
179
I2C_FUNC_SMBUS_BYTE | I2C_FUNC_I2C))
181
rc = hdmi_sii_enable(client);
186
static struct i2c_driver hdmi_sii_i2c_driver = {
189
.owner = THIS_MODULE,
191
.probe = hdmi_sii_probe,
192
.remove = __exit_p(hdmi_sii_remove),
193
.id_table = hmdi_sii_id,
196
static int __init lcdc_st15_init(void)
199
struct msm_panel_info pinfo;
201
if (msm_fb_detect_client("lcdc_st15"))
206
pinfo.type = LCDC_PANEL;
207
pinfo.pdest = DISPLAY_1;
208
pinfo.wait_cycle = 0;
211
pinfo.clk_rate = 74250000;
213
pinfo.lcdc.h_back_porch = 120;
214
pinfo.lcdc.h_front_porch = 20;
215
pinfo.lcdc.h_pulse_width = 40;
216
pinfo.lcdc.v_back_porch = 25;
217
pinfo.lcdc.v_front_porch = 1;
218
pinfo.lcdc.v_pulse_width = 7;
219
pinfo.lcdc.border_clr = 0; /* blk */
220
pinfo.lcdc.underflow_clr = 0xff; /* blue */
221
pinfo.lcdc.hsync_skew = 0;
223
ret = lcdc_device_register(&pinfo);
225
printk(KERN_ERR "%s: failed to register device!\n", __func__);
229
ret = i2c_add_driver(&hdmi_sii_i2c_driver);
231
printk(KERN_ERR "%s: failed to add i2c driver\n", __func__);
237
module_init(lcdc_st15_init);