diff options
author | Harald Welte <laforge@gnumonks.org> | 2009-05-23 00:35:39 +0800 |
---|---|---|
committer | Jonathan Corbet <corbet@lwn.net> | 2010-04-27 13:01:45 -0600 |
commit | 277d32a36cba0b42c9c6836ff07f9b978566e95c (patch) | |
tree | 7161c2ddeb6064a42ba4babe3678a0493ecf6365 /drivers/video/via/via_i2c.h | |
parent | c205d932530719d2a6ddb9152650e5bbe80c9400 (diff) | |
download | lwn-277d32a36cba0b42c9c6836ff07f9b978566e95c.tar.gz lwn-277d32a36cba0b42c9c6836ff07f9b978566e95c.zip |
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/via_i2c.h')
-rw-r--r-- | drivers/video/via/via_i2c.h | 43 |
1 files changed, 29 insertions, 14 deletions
diff --git a/drivers/video/via/via_i2c.h b/drivers/video/via/via_i2c.h index 3a13242a3152..00ed97886842 100644 --- a/drivers/video/via/via_i2c.h +++ b/drivers/video/via/via_i2c.h @@ -1,5 +1,5 @@ /* - * Copyright 1998-2008 VIA Technologies, Inc. All Rights Reserved. + * Copyright 1998-2009 VIA Technologies, Inc. All Rights Reserved. * Copyright 2001-2008 S3 Graphics, Inc. All Rights Reserved. * This program is free software; you can redistribute it and/or @@ -24,23 +24,38 @@ #include <linux/i2c.h> #include <linux/i2c-algo-bit.h> +enum via_i2c_type { + VIA_I2C_NONE, + VIA_I2C_I2C, + VIA_I2C_GPIO, +}; + +/* private data for each adapter */ +struct via_i2c_adap_cfg { + enum via_i2c_type type; + u_int16_t io_port; + u_int8_t ioport_index; +}; + struct via_i2c_stuff { u16 i2c_port; /* GPIO or I2C port */ struct i2c_adapter adapter; struct i2c_algo_bit_data algo; }; -#define I2CPORT 0x3c4 -#define I2CPORTINDEX 0x31 -#define GPIOPORT 0x3C4 -#define GPIOPORTINDEX 0x2C -#define I2C_BUS 1 -#define GPIO_BUS 2 -#define DELAYPORT 0x3C3 - -int viafb_i2c_readbyte(u8 slave_addr, u8 index, u8 *pdata); -int viafb_i2c_writebyte(u8 slave_addr, u8 index, u8 data); -int viafb_i2c_readbytes(u8 slave_addr, u8 index, u8 *buff, int buff_len); -int viafb_create_i2c_bus(void *par); -void viafb_delete_i2c_buss(void *par); +enum viafb_i2c_adap { + VIA_I2C_ADAP_26, + VIA_I2C_ADAP_31, + VIA_I2C_ADAP_25, + VIA_I2C_ADAP_2C, + VIA_I2C_ADAP_3D, +}; + +int viafb_i2c_readbyte(u8 adap, u8 slave_addr, u8 index, u8 *pdata); +int viafb_i2c_writebyte(u8 adap, u8 slave_addr, u8 index, u8 data); +int viafb_i2c_readbytes(u8 adap, u8 slave_addr, u8 index, u8 *buff, int buff_len); + +struct viafb_par; +int viafb_create_i2c_busses(struct viafb_par *par); +void viafb_delete_i2c_busses(struct viafb_par *par); #endif /* __VIA_I2C_H__ */ |