aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/via/dvi.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2009-05-22 12:35:39 -0400
committerJonathan Corbet <corbet@lwn.net>2010-04-27 15:01:45 -0400
commit277d32a36cba0b42c9c6836ff07f9b978566e95c (patch)
tree7161c2ddeb6064a42ba4babe3678a0493ecf6365 /drivers/video/via/dvi.c
parentc205d932530719d2a6ddb9152650e5bbe80c9400 (diff)
viafb: rework the I2C support in the VIA framebuffer driver
This patch changes the way how the various I2C busses are used internally inside the viafb driver: Previosuly, only a single i2c_adapter was created, even though two different hardware I2C busses are accessed: A structure member in a global variable was modified to indicate the bus to be used. Now, all existing hardware busses are registered with the i2c core, and the viafb_i2c_{read,write}byte[s]() function take the adapter number as function call parameter, rather than referring to the global structure member. [jc: even more painful merge with mainline changes ->2.6.34] [jc: painful merge with OLPC changes] Cc: Florian Tobias Schandinat <FlorianSchandinat@gmx.de> Cc: ScottFang@viatech.com.cn Cc: JosephChan@via.com.tw Signed-off-by: Harald Welte <HaraldWelte@viatech.com> Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Diffstat (limited to 'drivers/video/via/dvi.c')
-rw-r--r--drivers/video/via/dvi.c35
1 files changed, 15 insertions, 20 deletions
diff --git a/drivers/video/via/dvi.c b/drivers/video/via/dvi.c
index abe59b8c7a05..be513701e4e6 100644
--- a/drivers/video/via/dvi.c
+++ b/drivers/video/via/dvi.c
@@ -96,7 +96,7 @@ int viafb_tmds_trasmitter_identify(void)
96 viaparinfo->chip_info->tmds_chip_info.tmds_chip_name = VT1632_TMDS; 96 viaparinfo->chip_info->tmds_chip_info.tmds_chip_name = VT1632_TMDS;
97 viaparinfo->chip_info-> 97 viaparinfo->chip_info->
98 tmds_chip_info.tmds_chip_slave_addr = VT1632_TMDS_I2C_ADDR; 98 tmds_chip_info.tmds_chip_slave_addr = VT1632_TMDS_I2C_ADDR;
99 viaparinfo->chip_info->tmds_chip_info.i2c_port = I2CPORTINDEX; 99 viaparinfo->chip_info->tmds_chip_info.i2c_port = VIA_I2C_ADAP_31;
100 if (check_tmds_chip(VT1632_DEVICE_ID_REG, VT1632_DEVICE_ID) != FAIL) { 100 if (check_tmds_chip(VT1632_DEVICE_ID_REG, VT1632_DEVICE_ID) != FAIL) {
101 /* 101 /*
102 * Currently only support 12bits,dual edge,add 24bits mode later 102 * Currently only support 12bits,dual edge,add 24bits mode later
@@ -110,7 +110,7 @@ int viafb_tmds_trasmitter_identify(void)
110 viaparinfo->chip_info->tmds_chip_info.i2c_port); 110 viaparinfo->chip_info->tmds_chip_info.i2c_port);
111 return OK; 111 return OK;
112 } else { 112 } else {
113 viaparinfo->chip_info->tmds_chip_info.i2c_port = GPIOPORTINDEX; 113 viaparinfo->chip_info->tmds_chip_info.i2c_port = VIA_I2C_ADAP_2C;
114 if (check_tmds_chip(VT1632_DEVICE_ID_REG, VT1632_DEVICE_ID) 114 if (check_tmds_chip(VT1632_DEVICE_ID_REG, VT1632_DEVICE_ID)
115 != FAIL) { 115 != FAIL) {
116 tmds_register_write(0x08, 0x3b); 116 tmds_register_write(0x08, 0x3b);
@@ -160,32 +160,26 @@ int viafb_tmds_trasmitter_identify(void)
160 160
161static void tmds_register_write(int index, u8 data) 161static void tmds_register_write(int index, u8 data)
162{ 162{
163 viaparinfo->shared->i2c_stuff.i2c_port = 163 viafb_i2c_writebyte(viaparinfo->chip_info->tmds_chip_info.i2c_port,
164 viaparinfo->chip_info->tmds_chip_info.i2c_port; 164 viaparinfo->chip_info->tmds_chip_info.tmds_chip_slave_addr,
165 165 index, data);
166 viafb_i2c_writebyte(viaparinfo->chip_info->tmds_chip_info.
167 tmds_chip_slave_addr, index,
168 data);
169} 166}
170 167
171static int tmds_register_read(int index) 168static int tmds_register_read(int index)
172{ 169{
173 u8 data; 170 u8 data;
174 171
175 viaparinfo->shared->i2c_stuff.i2c_port = 172 viafb_i2c_readbyte(viaparinfo->chip_info->tmds_chip_info.i2c_port,
176 viaparinfo->chip_info->tmds_chip_info.i2c_port; 173 (u8) viaparinfo->chip_info->tmds_chip_info.tmds_chip_slave_addr,
177 viafb_i2c_readbyte((u8) viaparinfo->chip_info-> 174 (u8) index, &data);
178 tmds_chip_info.tmds_chip_slave_addr,
179 (u8) index, &data);
180 return data; 175 return data;
181} 176}
182 177
183static int tmds_register_read_bytes(int index, u8 *buff, int buff_len) 178static int tmds_register_read_bytes(int index, u8 *buff, int buff_len)
184{ 179{
185 viaparinfo->shared->i2c_stuff.i2c_port = 180 viafb_i2c_readbytes(viaparinfo->chip_info->tmds_chip_info.i2c_port,
186 viaparinfo->chip_info->tmds_chip_info.i2c_port; 181 (u8) viaparinfo->chip_info->tmds_chip_info.tmds_chip_slave_addr,
187 viafb_i2c_readbytes((u8) viaparinfo->chip_info->tmds_chip_info. 182 (u8) index, buff, buff_len);
188 tmds_chip_slave_addr, (u8) index, buff, buff_len);
189 return 0; 183 return 0;
190} 184}
191 185
@@ -541,9 +535,10 @@ void viafb_dvi_enable(void)
541 else 535 else
542 data = 0x37; 536 data = 0x37;
543 viafb_i2c_writebyte(viaparinfo->chip_info-> 537 viafb_i2c_writebyte(viaparinfo->chip_info->
544 tmds_chip_info. 538 tmds_chip_info.i2c_port,
545 tmds_chip_slave_addr, 539 viaparinfo->chip_info->
546 0x08, data); 540 tmds_chip_info.tmds_chip_slave_addr,
541 0x08, data);
547 } 542 }
548 } 543 }
549 } 544 }