diff options
author | Harald Welte <laforge@gnumonks.org> | 2009-05-22 12:35:39 -0400 |
---|---|---|
committer | Jonathan Corbet <corbet@lwn.net> | 2010-04-27 15:01:45 -0400 |
commit | 277d32a36cba0b42c9c6836ff07f9b978566e95c (patch) | |
tree | 7161c2ddeb6064a42ba4babe3678a0493ecf6365 /drivers/video/via/vt1636.c | |
parent | c205d932530719d2a6ddb9152650e5bbe80c9400 (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/vt1636.c')
-rw-r--r-- | drivers/video/via/vt1636.c | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/drivers/video/via/vt1636.c b/drivers/video/via/vt1636.c index a6b37494e79a..4589c6e73c5d 100644 --- a/drivers/video/via/vt1636.c +++ b/drivers/video/via/vt1636.c | |||
@@ -27,9 +27,8 @@ u8 viafb_gpio_i2c_read_lvds(struct lvds_setting_information | |||
27 | { | 27 | { |
28 | u8 data; | 28 | u8 data; |
29 | 29 | ||
30 | viaparinfo->shared->i2c_stuff.i2c_port = plvds_chip_info->i2c_port; | 30 | viafb_i2c_readbyte(plvds_chip_info->i2c_port, |
31 | viafb_i2c_readbyte(plvds_chip_info->lvds_chip_slave_addr, index, &data); | 31 | plvds_chip_info->lvds_chip_slave_addr, index, &data); |
32 | |||
33 | return data; | 32 | return data; |
34 | } | 33 | } |
35 | 34 | ||
@@ -39,14 +38,13 @@ void viafb_gpio_i2c_write_mask_lvds(struct lvds_setting_information | |||
39 | { | 38 | { |
40 | int index, data; | 39 | int index, data; |
41 | 40 | ||
42 | viaparinfo->shared->i2c_stuff.i2c_port = plvds_chip_info->i2c_port; | ||
43 | |||
44 | index = io_data.Index; | 41 | index = io_data.Index; |
45 | data = viafb_gpio_i2c_read_lvds(plvds_setting_info, plvds_chip_info, | 42 | data = viafb_gpio_i2c_read_lvds(plvds_setting_info, plvds_chip_info, |
46 | index); | 43 | index); |
47 | data = (data & (~io_data.Mask)) | io_data.Data; | 44 | data = (data & (~io_data.Mask)) | io_data.Data; |
48 | 45 | ||
49 | viafb_i2c_writebyte(plvds_chip_info->lvds_chip_slave_addr, index, data); | 46 | viafb_i2c_writebyte(plvds_chip_info->i2c_port, |
47 | plvds_chip_info->lvds_chip_slave_addr, index, data); | ||
50 | } | 48 | } |
51 | 49 | ||
52 | void viafb_init_lvds_vt1636(struct lvds_setting_information | 50 | void viafb_init_lvds_vt1636(struct lvds_setting_information |
@@ -159,7 +157,7 @@ void viafb_disable_lvds_vt1636(struct lvds_setting_information | |||
159 | } | 157 | } |
160 | } | 158 | } |
161 | 159 | ||
162 | bool viafb_lvds_identify_vt1636(void) | 160 | bool viafb_lvds_identify_vt1636(u8 i2c_adapter) |
163 | { | 161 | { |
164 | u8 Buffer[2]; | 162 | u8 Buffer[2]; |
165 | 163 | ||
@@ -170,23 +168,23 @@ bool viafb_lvds_identify_vt1636(void) | |||
170 | VT1636_LVDS_I2C_ADDR; | 168 | VT1636_LVDS_I2C_ADDR; |
171 | 169 | ||
172 | /* Check vendor ID first: */ | 170 | /* Check vendor ID first: */ |
173 | viafb_i2c_readbyte((u8) viaparinfo->chip_info->lvds_chip_info. | 171 | viafb_i2c_readbyte(i2c_adapter, |
174 | lvds_chip_slave_addr, | 172 | (u8) viaparinfo->chip_info->lvds_chip_info.lvds_chip_slave_addr, |
175 | 0x00, &Buffer[0]); | 173 | 0x00, &Buffer[0]); |
176 | viafb_i2c_readbyte((u8) viaparinfo->chip_info->lvds_chip_info. | 174 | viafb_i2c_readbyte(i2c_adapter, |
177 | lvds_chip_slave_addr, | 175 | (u8) viaparinfo->chip_info->lvds_chip_info.lvds_chip_slave_addr, |
178 | 0x01, &Buffer[1]); | 176 | 0x01, &Buffer[1]); |
179 | 177 | ||
180 | if (!((Buffer[0] == 0x06) && (Buffer[1] == 0x11))) | 178 | if (!((Buffer[0] == 0x06) && (Buffer[1] == 0x11))) |
181 | return false; | 179 | return false; |
182 | 180 | ||
183 | /* Check Chip ID: */ | 181 | /* Check Chip ID: */ |
184 | viafb_i2c_readbyte((u8) viaparinfo->chip_info->lvds_chip_info. | 182 | viafb_i2c_readbyte(i2c_adapter, |
185 | lvds_chip_slave_addr, | 183 | (u8) viaparinfo->chip_info->lvds_chip_info.lvds_chip_slave_addr, |
186 | 0x02, &Buffer[0]); | 184 | 0x02, &Buffer[0]); |
187 | viafb_i2c_readbyte((u8) viaparinfo->chip_info->lvds_chip_info. | 185 | viafb_i2c_readbyte(i2c_adapter, |
188 | lvds_chip_slave_addr, | 186 | (u8) viaparinfo->chip_info->lvds_chip_info.lvds_chip_slave_addr, |
189 | 0x03, &Buffer[1]); | 187 | 0x03, &Buffer[1]); |
190 | if ((Buffer[0] == 0x45) && (Buffer[1] == 0x33)) { | 188 | if ((Buffer[0] == 0x45) && (Buffer[1] == 0x33)) { |
191 | viaparinfo->chip_info->lvds_chip_info.lvds_chip_name = | 189 | viaparinfo->chip_info->lvds_chip_info.lvds_chip_name = |
192 | VT1636_LVDS; | 190 | VT1636_LVDS; |