aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/via/via_i2c.h
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/via_i2c.h
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/via_i2c.h')
-rw-r--r--drivers/video/via/via_i2c.h43
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 @@
1/* 1/*
2 * Copyright 1998-2008 VIA Technologies, Inc. All Rights Reserved. 2 * Copyright 1998-2009 VIA Technologies, Inc. All Rights Reserved.
3 * Copyright 2001-2008 S3 Graphics, Inc. All Rights Reserved. 3 * Copyright 2001-2008 S3 Graphics, Inc. All Rights Reserved.
4 4
5 * This program is free software; you can redistribute it and/or 5 * This program is free software; you can redistribute it and/or
@@ -24,23 +24,38 @@
24#include <linux/i2c.h> 24#include <linux/i2c.h>
25#include <linux/i2c-algo-bit.h> 25#include <linux/i2c-algo-bit.h>
26 26
27enum via_i2c_type {
28 VIA_I2C_NONE,
29 VIA_I2C_I2C,
30 VIA_I2C_GPIO,
31};
32
33/* private data for each adapter */
34struct via_i2c_adap_cfg {
35 enum via_i2c_type type;
36 u_int16_t io_port;
37 u_int8_t ioport_index;
38};
39
27struct via_i2c_stuff { 40struct via_i2c_stuff {
28 u16 i2c_port; /* GPIO or I2C port */ 41 u16 i2c_port; /* GPIO or I2C port */
29 struct i2c_adapter adapter; 42 struct i2c_adapter adapter;
30 struct i2c_algo_bit_data algo; 43 struct i2c_algo_bit_data algo;
31}; 44};
32 45
33#define I2CPORT 0x3c4 46enum viafb_i2c_adap {
34#define I2CPORTINDEX 0x31 47 VIA_I2C_ADAP_26,
35#define GPIOPORT 0x3C4 48 VIA_I2C_ADAP_31,
36#define GPIOPORTINDEX 0x2C 49 VIA_I2C_ADAP_25,
37#define I2C_BUS 1 50 VIA_I2C_ADAP_2C,
38#define GPIO_BUS 2 51 VIA_I2C_ADAP_3D,
39#define DELAYPORT 0x3C3 52};
40 53
41int viafb_i2c_readbyte(u8 slave_addr, u8 index, u8 *pdata); 54int viafb_i2c_readbyte(u8 adap, u8 slave_addr, u8 index, u8 *pdata);
42int viafb_i2c_writebyte(u8 slave_addr, u8 index, u8 data); 55int viafb_i2c_writebyte(u8 adap, u8 slave_addr, u8 index, u8 data);
43int viafb_i2c_readbytes(u8 slave_addr, u8 index, u8 *buff, int buff_len); 56int viafb_i2c_readbytes(u8 adap, u8 slave_addr, u8 index, u8 *buff, int buff_len);
44int viafb_create_i2c_bus(void *par); 57
45void viafb_delete_i2c_buss(void *par); 58struct viafb_par;
59int viafb_create_i2c_busses(struct viafb_par *par);
60void viafb_delete_i2c_busses(struct viafb_par *par);
46#endif /* __VIA_I2C_H__ */ 61#endif /* __VIA_I2C_H__ */