aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/feature-removal-schedule.txt3
-rw-r--r--drivers/i2c/algos/Kconfig4
-rw-r--r--drivers/i2c/algos/Makefile1
-rw-r--r--drivers/i2c/algos/i2c-algo-sgi.c179
-rw-r--r--include/linux/i2c-algo-sgi.h26
-rw-r--r--include/linux/i2c-id.h37
-rw-r--r--include/linux/i2c.h4
7 files changed, 4 insertions, 250 deletions
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt
index 39246fc11257..7e2af10e8264 100644
--- a/Documentation/feature-removal-schedule.txt
+++ b/Documentation/feature-removal-schedule.txt
@@ -354,7 +354,8 @@ Who: Krzysztof Piotr Oledzki <ole@ans.pl>
354 354
355--------------------------- 355---------------------------
356 356
357What: i2c_attach_client(), i2c_detach_client(), i2c_driver->detach_client() 357What: i2c_attach_client(), i2c_detach_client(), i2c_driver->detach_client(),
358 i2c_adapter->client_register(), i2c_adapter->client_unregister
358When: 2.6.30 359When: 2.6.30
359Check: i2c_attach_client i2c_detach_client 360Check: i2c_attach_client i2c_detach_client
360Why: Deprecated by the new (standard) device driver binding model. Use 361Why: Deprecated by the new (standard) device driver binding model. Use
diff --git a/drivers/i2c/algos/Kconfig b/drivers/i2c/algos/Kconfig
index b788579b8227..7b2ce4a08524 100644
--- a/drivers/i2c/algos/Kconfig
+++ b/drivers/i2c/algos/Kconfig
@@ -14,8 +14,4 @@ config I2C_ALGOPCF
14config I2C_ALGOPCA 14config I2C_ALGOPCA
15 tristate "I2C PCA 9564 interfaces" 15 tristate "I2C PCA 9564 interfaces"
16 16
17config I2C_ALGO_SGI
18 tristate
19 depends on SGI_IP22 || SGI_IP32 || X86_VISWS
20
21endmenu 17endmenu
diff --git a/drivers/i2c/algos/Makefile b/drivers/i2c/algos/Makefile
index cac1051bd4f1..18b3e962ec09 100644
--- a/drivers/i2c/algos/Makefile
+++ b/drivers/i2c/algos/Makefile
@@ -5,7 +5,6 @@
5obj-$(CONFIG_I2C_ALGOBIT) += i2c-algo-bit.o 5obj-$(CONFIG_I2C_ALGOBIT) += i2c-algo-bit.o
6obj-$(CONFIG_I2C_ALGOPCF) += i2c-algo-pcf.o 6obj-$(CONFIG_I2C_ALGOPCF) += i2c-algo-pcf.o
7obj-$(CONFIG_I2C_ALGOPCA) += i2c-algo-pca.o 7obj-$(CONFIG_I2C_ALGOPCA) += i2c-algo-pca.o
8obj-$(CONFIG_I2C_ALGO_SGI) += i2c-algo-sgi.o
9 8
10ifeq ($(CONFIG_I2C_DEBUG_ALGO),y) 9ifeq ($(CONFIG_I2C_DEBUG_ALGO),y)
11EXTRA_CFLAGS += -DDEBUG 10EXTRA_CFLAGS += -DDEBUG
diff --git a/drivers/i2c/algos/i2c-algo-sgi.c b/drivers/i2c/algos/i2c-algo-sgi.c
deleted file mode 100644
index 6eaf145e1ada..000000000000
--- a/drivers/i2c/algos/i2c-algo-sgi.c
+++ /dev/null
@@ -1,179 +0,0 @@
1/*
2 * i2c-algo-sgi.c: i2c driver algorithm used by the VINO (SGI Indy) and
3 * MACE (SGI O2) chips.
4 *
5 * This file is subject to the terms and conditions of the GNU General Public
6 * License version 2 as published by the Free Software Foundation.
7 *
8 * Copyright (C) 2003 Ladislav Michl <ladis@linux-mips.org>
9 */
10
11#include <linux/kernel.h>
12#include <linux/module.h>
13#include <linux/init.h>
14#include <linux/errno.h>
15#include <linux/delay.h>
16
17#include <linux/i2c.h>
18#include <linux/i2c-algo-sgi.h>
19
20
21#define SGI_I2C_FORCE_IDLE (0 << 0)
22#define SGI_I2C_NOT_IDLE (1 << 0)
23#define SGI_I2C_WRITE (0 << 1)
24#define SGI_I2C_READ (1 << 1)
25#define SGI_I2C_RELEASE_BUS (0 << 2)
26#define SGI_I2C_HOLD_BUS (1 << 2)
27#define SGI_I2C_XFER_DONE (0 << 4)
28#define SGI_I2C_XFER_BUSY (1 << 4)
29#define SGI_I2C_ACK (0 << 5)
30#define SGI_I2C_NACK (1 << 5)
31#define SGI_I2C_BUS_OK (0 << 7)
32#define SGI_I2C_BUS_ERR (1 << 7)
33
34#define get_control() adap->getctrl(adap->data)
35#define set_control(val) adap->setctrl(adap->data, val)
36#define read_data() adap->rdata(adap->data)
37#define write_data(val) adap->wdata(adap->data, val)
38
39
40static int wait_xfer_done(struct i2c_algo_sgi_data *adap)
41{
42 int i;
43
44 for (i = 0; i < adap->xfer_timeout; i++) {
45 if ((get_control() & SGI_I2C_XFER_BUSY) == 0)
46 return 0;
47 udelay(1);
48 }
49
50 return -ETIMEDOUT;
51}
52
53static int wait_ack(struct i2c_algo_sgi_data *adap)
54{
55 int i;
56
57 if (wait_xfer_done(adap))
58 return -ETIMEDOUT;
59 for (i = 0; i < adap->ack_timeout; i++) {
60 if ((get_control() & SGI_I2C_NACK) == 0)
61 return 0;
62 udelay(1);
63 }
64
65 return -ETIMEDOUT;
66}
67
68static int force_idle(struct i2c_algo_sgi_data *adap)
69{
70 int i;
71
72 set_control(SGI_I2C_FORCE_IDLE);
73 for (i = 0; i < adap->xfer_timeout; i++) {
74 if ((get_control() & SGI_I2C_NOT_IDLE) == 0)
75 goto out;
76 udelay(1);
77 }
78 return -ETIMEDOUT;
79out:
80 if (get_control() & SGI_I2C_BUS_ERR)
81 return -EIO;
82 return 0;
83}
84
85static int do_address(struct i2c_algo_sgi_data *adap, unsigned int addr,
86 int rd)
87{
88 if (rd)
89 set_control(SGI_I2C_NOT_IDLE);
90 /* Check if bus is idle, eventually force it to do so */
91 if (get_control() & SGI_I2C_NOT_IDLE)
92 if (force_idle(adap))
93 return -EIO;
94 /* Write out the i2c chip address and specify operation */
95 set_control(SGI_I2C_HOLD_BUS | SGI_I2C_WRITE | SGI_I2C_NOT_IDLE);
96 if (rd)
97 addr |= 1;
98 write_data(addr);
99 if (wait_ack(adap))
100 return -EIO;
101 return 0;
102}
103
104static int i2c_read(struct i2c_algo_sgi_data *adap, unsigned char *buf,
105 unsigned int len)
106{
107 int i;
108
109 set_control(SGI_I2C_HOLD_BUS | SGI_I2C_READ | SGI_I2C_NOT_IDLE);
110 for (i = 0; i < len; i++) {
111 if (wait_xfer_done(adap))
112 return -EIO;
113 buf[i] = read_data();
114 }
115 set_control(SGI_I2C_RELEASE_BUS | SGI_I2C_FORCE_IDLE);
116
117 return 0;
118
119}
120
121static int i2c_write(struct i2c_algo_sgi_data *adap, unsigned char *buf,
122 unsigned int len)
123{
124 int i;
125
126 /* We are already in write state */
127 for (i = 0; i < len; i++) {
128 write_data(buf[i]);
129 if (wait_ack(adap))
130 return -EIO;
131 }
132 return 0;
133}
134
135static int sgi_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs,
136 int num)
137{
138 struct i2c_algo_sgi_data *adap = i2c_adap->algo_data;
139 struct i2c_msg *p;
140 int i, err = 0;
141
142 for (i = 0; !err && i < num; i++) {
143 p = &msgs[i];
144 err = do_address(adap, p->addr, p->flags & I2C_M_RD);
145 if (err || !p->len)
146 continue;
147 if (p->flags & I2C_M_RD)
148 err = i2c_read(adap, p->buf, p->len);
149 else
150 err = i2c_write(adap, p->buf, p->len);
151 }
152
153 return (err < 0) ? err : i;
154}
155
156static u32 sgi_func(struct i2c_adapter *adap)
157{
158 return I2C_FUNC_SMBUS_EMUL;
159}
160
161static const struct i2c_algorithm sgi_algo = {
162 .master_xfer = sgi_xfer,
163 .functionality = sgi_func,
164};
165
166/*
167 * registering functions to load algorithms at runtime
168 */
169int i2c_sgi_add_bus(struct i2c_adapter *adap)
170{
171 adap->algo = &sgi_algo;
172
173 return i2c_add_adapter(adap);
174}
175EXPORT_SYMBOL(i2c_sgi_add_bus);
176
177MODULE_AUTHOR("Ladislav Michl <ladis@linux-mips.org>");
178MODULE_DESCRIPTION("I2C-Bus SGI algorithm");
179MODULE_LICENSE("GPL");
diff --git a/include/linux/i2c-algo-sgi.h b/include/linux/i2c-algo-sgi.h
deleted file mode 100644
index 3b7715024e69..000000000000
--- a/include/linux/i2c-algo-sgi.h
+++ /dev/null
@@ -1,26 +0,0 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License version 2 as published by the Free Software Foundation.
4 *
5 * Copyright (C) 2003 Ladislav Michl <ladis@linux-mips.org>
6 */
7
8#ifndef I2C_ALGO_SGI_H
9#define I2C_ALGO_SGI_H 1
10
11#include <linux/i2c.h>
12
13struct i2c_algo_sgi_data {
14 void *data; /* private data for lowlevel routines */
15 unsigned (*getctrl)(void *data);
16 void (*setctrl)(void *data, unsigned val);
17 unsigned (*rdata)(void *data);
18 void (*wdata)(void *data, unsigned val);
19
20 int xfer_timeout;
21 int ack_timeout;
22};
23
24int i2c_sgi_add_bus(struct i2c_adapter *);
25
26#endif /* I2C_ALGO_SGI_H */
diff --git a/include/linux/i2c-id.h b/include/linux/i2c-id.h
index f27604af8378..ee9fbc172405 100644
--- a/include/linux/i2c-id.h
+++ b/include/linux/i2c-id.h
@@ -33,47 +33,10 @@
33 33
34#define I2C_DRIVERID_MSP3400 1 34#define I2C_DRIVERID_MSP3400 1
35#define I2C_DRIVERID_TUNER 2 35#define I2C_DRIVERID_TUNER 2
36#define I2C_DRIVERID_TEA6420 5 /* audio matrix switch */
37#define I2C_DRIVERID_TEA6415C 6 /* video matrix switch */
38#define I2C_DRIVERID_TDA9840 7 /* stereo sound processor */
39#define I2C_DRIVERID_SAA7111A 8 /* video input processor */
40#define I2C_DRIVERID_SAA7185B 13 /* video encoder */
41#define I2C_DRIVERID_SAA7110 22 /* video decoder */
42#define I2C_DRIVERID_SAA5249 24 /* SAA5249 and compatibles */
43#define I2C_DRIVERID_TDA7432 27 /* Stereo sound processor */ 36#define I2C_DRIVERID_TDA7432 27 /* Stereo sound processor */
44#define I2C_DRIVERID_TVAUDIO 29 /* Generic TV sound driver */ 37#define I2C_DRIVERID_TVAUDIO 29 /* Generic TV sound driver */
45#define I2C_DRIVERID_TDA9875 32 /* TV sound decoder chip */
46#define I2C_DRIVERID_BT819 40 /* video decoder */
47#define I2C_DRIVERID_BT856 41 /* video encoder */
48#define I2C_DRIVERID_VPX3220 42 /* video decoder+vbi/vtxt */
49#define I2C_DRIVERID_ADV7175 48 /* ADV 7175/7176 video encoder */
50#define I2C_DRIVERID_SAA7114 49 /* video decoder */
51#define I2C_DRIVERID_ADV7170 54 /* video encoder */
52#define I2C_DRIVERID_SAA7191 57 /* video decoder */
53#define I2C_DRIVERID_INDYCAM 58 /* SGI IndyCam */
54#define I2C_DRIVERID_OVCAMCHIP 61 /* OmniVision CMOS image sens. */
55#define I2C_DRIVERID_SAA6752HS 67 /* MPEG2 encoder */
56#define I2C_DRIVERID_TVEEPROM 68 /* TV EEPROM */
57#define I2C_DRIVERID_WM8775 69 /* wm8775 audio processor */
58#define I2C_DRIVERID_CS53L32A 70 /* cs53l32a audio processor */
59#define I2C_DRIVERID_CX25840 71 /* cx2584x video encoder */
60#define I2C_DRIVERID_SAA7127 72 /* saa7127 video encoder */
61#define I2C_DRIVERID_SAA711X 73 /* saa711x video encoders */ 38#define I2C_DRIVERID_SAA711X 73 /* saa711x video encoders */
62#define I2C_DRIVERID_INFRARED 75 /* I2C InfraRed on Video boards */ 39#define I2C_DRIVERID_INFRARED 75 /* I2C InfraRed on Video boards */
63#define I2C_DRIVERID_TVP5150 76 /* TVP5150 video decoder */
64#define I2C_DRIVERID_WM8739 77 /* wm8739 audio processor */
65#define I2C_DRIVERID_UPD64083 78 /* upd64083 video processor */
66#define I2C_DRIVERID_UPD64031A 79 /* upd64031a video processor */
67#define I2C_DRIVERID_SAA717X 80 /* saa717x video encoder */
68#define I2C_DRIVERID_BT866 85 /* Conexant bt866 video encoder */
69#define I2C_DRIVERID_KS0127 86 /* Samsung ks0127 video decoder */
70#define I2C_DRIVERID_TLV320AIC23B 87 /* TI TLV320AIC23B audio codec */
71#define I2C_DRIVERID_VP27SMPX 93 /* Panasonic VP27s tuner internal MPX */
72#define I2C_DRIVERID_M52790 95 /* Mitsubishi M52790SP/FP AV switch */
73#define I2C_DRIVERID_CS5345 96 /* cs5345 audio processor */
74#define I2C_DRIVERID_AU8522 97 /* Auvitek au8522 */
75
76#define I2C_DRIVERID_OV7670 1048 /* Omnivision 7670 camera */
77 40
78/* 41/*
79 * ---- Adapter types ---------------------------------------------------- 42 * ---- Adapter types ----------------------------------------------------
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index c86c3b07604c..00ee11eb9092 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -353,8 +353,8 @@ struct i2c_adapter {
353 void *algo_data; 353 void *algo_data;
354 354
355 /* --- administration stuff. */ 355 /* --- administration stuff. */
356 int (*client_register)(struct i2c_client *); 356 int (*client_register)(struct i2c_client *) __deprecated;
357 int (*client_unregister)(struct i2c_client *); 357 int (*client_unregister)(struct i2c_client *) __deprecated;
358 358
359 /* data fields that are valid for all devices */ 359 /* data fields that are valid for all devices */
360 u8 level; /* nesting level for lockdep */ 360 u8 level; /* nesting level for lockdep */