Johannes Stezenbach | 2add87a | 2005-05-16 21:54:10 -0700 | [diff] [blame] | 1 | /* |
Uwe Bugla | 1589a99 | 2009-03-29 07:46:58 -0300 | [diff] [blame] | 2 | * Linux driver for digital TV devices equipped with B2C2 FlexcopII(b)/III |
Johannes Stezenbach | 2add87a | 2005-05-16 21:54:10 -0700 | [diff] [blame] | 3 | * flexcop-i2c.c - flexcop internal 2Wire bus (I2C) and dvb i2c initialization |
Uwe Bugla | 1589a99 | 2009-03-29 07:46:58 -0300 | [diff] [blame] | 4 | * see flexcop.c for copyright information |
Johannes Stezenbach | 2add87a | 2005-05-16 21:54:10 -0700 | [diff] [blame] | 5 | */ |
| 6 | #include "flexcop.h" |
| 7 | |
| 8 | #define FC_MAX_I2C_RETRIES 100000 |
| 9 | |
Uwe Bugla | 1589a99 | 2009-03-29 07:46:58 -0300 | [diff] [blame] | 10 | static int flexcop_i2c_operation(struct flexcop_device *fc, |
| 11 | flexcop_ibi_value *r100) |
Johannes Stezenbach | 2add87a | 2005-05-16 21:54:10 -0700 | [diff] [blame] | 12 | { |
Johannes Stezenbach | bdc7800 | 2005-05-16 21:54:18 -0700 | [diff] [blame] | 13 | int i; |
Johannes Stezenbach | 2add87a | 2005-05-16 21:54:10 -0700 | [diff] [blame] | 14 | flexcop_ibi_value r; |
| 15 | |
| 16 | r100->tw_sm_c_100.working_start = 1; |
| 17 | deb_i2c("r100 before: %08x\n",r100->raw); |
| 18 | |
| 19 | fc->write_ibi_reg(fc, tw_sm_c_100, ibi_zero); |
| 20 | fc->write_ibi_reg(fc, tw_sm_c_100, *r100); /* initiating i2c operation */ |
| 21 | |
| 22 | for (i = 0; i < FC_MAX_I2C_RETRIES; i++) { |
| 23 | r = fc->read_ibi_reg(fc, tw_sm_c_100); |
| 24 | |
| 25 | if (!r.tw_sm_c_100.no_base_addr_ack_error) { |
Uwe Bugla | 1589a99 | 2009-03-29 07:46:58 -0300 | [diff] [blame] | 26 | if (r.tw_sm_c_100.st_done) { |
Johannes Stezenbach | 2add87a | 2005-05-16 21:54:10 -0700 | [diff] [blame] | 27 | *r100 = r; |
| 28 | deb_i2c("i2c success\n"); |
| 29 | return 0; |
| 30 | } |
| 31 | } else { |
| 32 | deb_i2c("suffering from an i2c ack_error\n"); |
Johannes Stezenbach | bdc7800 | 2005-05-16 21:54:18 -0700 | [diff] [blame] | 33 | return -EREMOTEIO; |
Johannes Stezenbach | 2add87a | 2005-05-16 21:54:10 -0700 | [diff] [blame] | 34 | } |
| 35 | } |
Uwe Bugla | 1589a99 | 2009-03-29 07:46:58 -0300 | [diff] [blame] | 36 | deb_i2c("tried %d times i2c operation, " |
| 37 | "never finished or too many ack errors.\n", i); |
Johannes Stezenbach | 2add87a | 2005-05-16 21:54:10 -0700 | [diff] [blame] | 38 | return -EREMOTEIO; |
| 39 | } |
| 40 | |
Patrick Boettcher | 6394cf5 | 2008-03-29 20:49:57 -0300 | [diff] [blame] | 41 | static int flexcop_i2c_read4(struct flexcop_i2c_adapter *i2c, |
Uwe Bugla | 1589a99 | 2009-03-29 07:46:58 -0300 | [diff] [blame] | 42 | flexcop_ibi_value r100, u8 *buf) |
Johannes Stezenbach | 2add87a | 2005-05-16 21:54:10 -0700 | [diff] [blame] | 43 | { |
| 44 | flexcop_ibi_value r104; |
Uwe Bugla | 1589a99 | 2009-03-29 07:46:58 -0300 | [diff] [blame] | 45 | int len = r100.tw_sm_c_100.total_bytes, |
| 46 | /* remember total_bytes is buflen-1 */ |
Johannes Stezenbach | 2add87a | 2005-05-16 21:54:10 -0700 | [diff] [blame] | 47 | ret; |
| 48 | |
Patrick Boettcher | 1662070 | 2009-02-28 10:19:30 -0300 | [diff] [blame] | 49 | /* work-around to have CableStar2 and SkyStar2 rev 2.7 work |
| 50 | * correctly: |
| 51 | * |
| 52 | * the ITD1000 is behind an i2c-gate which closes automatically |
| 53 | * after an i2c-transaction the STV0297 needs 2 consecutive reads |
| 54 | * one with no_base_addr = 0 and one with 1 |
| 55 | * |
| 56 | * those two work-arounds are conflictin: we check for the card |
| 57 | * type, it is set when probing the ITD1000 */ |
| 58 | if (i2c->fc->dev_type == FC_SKY_REV27) |
| 59 | r100.tw_sm_c_100.no_base_addr_ack_error = i2c->no_base_addr; |
| 60 | |
Patrick Boettcher | 6394cf5 | 2008-03-29 20:49:57 -0300 | [diff] [blame] | 61 | ret = flexcop_i2c_operation(i2c->fc, &r100); |
| 62 | if (ret != 0) { |
Antti Seppälä | 11c6c7f | 2008-12-01 06:59:37 -0300 | [diff] [blame] | 63 | deb_i2c("Retrying operation\n"); |
| 64 | r100.tw_sm_c_100.no_base_addr_ack_error = i2c->no_base_addr; |
| 65 | ret = flexcop_i2c_operation(i2c->fc, &r100); |
| 66 | } |
| 67 | if (ret != 0) { |
Patrick Boettcher | 6394cf5 | 2008-03-29 20:49:57 -0300 | [diff] [blame] | 68 | deb_i2c("read failed. %d\n", ret); |
| 69 | return ret; |
Johannes Stezenbach | bdc7800 | 2005-05-16 21:54:18 -0700 | [diff] [blame] | 70 | } |
Johannes Stezenbach | 2add87a | 2005-05-16 21:54:10 -0700 | [diff] [blame] | 71 | |
Johannes Stezenbach | 2add87a | 2005-05-16 21:54:10 -0700 | [diff] [blame] | 72 | buf[0] = r100.tw_sm_c_100.data1_reg; |
| 73 | |
Johannes Stezenbach | bdc7800 | 2005-05-16 21:54:18 -0700 | [diff] [blame] | 74 | if (len > 0) { |
Patrick Boettcher | 6394cf5 | 2008-03-29 20:49:57 -0300 | [diff] [blame] | 75 | r104 = i2c->fc->read_ibi_reg(i2c->fc, tw_sm_c_104); |
| 76 | deb_i2c("read: r100: %08x, r104: %08x\n", r100.raw, r104.raw); |
Johannes Stezenbach | bdc7800 | 2005-05-16 21:54:18 -0700 | [diff] [blame] | 77 | |
| 78 | /* there is at least one more byte, otherwise we wouldn't be here */ |
| 79 | buf[1] = r104.tw_sm_c_104.data2_reg; |
| 80 | if (len > 1) buf[2] = r104.tw_sm_c_104.data3_reg; |
| 81 | if (len > 2) buf[3] = r104.tw_sm_c_104.data4_reg; |
| 82 | } |
Johannes Stezenbach | 2add87a | 2005-05-16 21:54:10 -0700 | [diff] [blame] | 83 | return 0; |
| 84 | } |
| 85 | |
Uwe Bugla | 1589a99 | 2009-03-29 07:46:58 -0300 | [diff] [blame] | 86 | static int flexcop_i2c_write4(struct flexcop_device *fc, |
| 87 | flexcop_ibi_value r100, u8 *buf) |
Johannes Stezenbach | 2add87a | 2005-05-16 21:54:10 -0700 | [diff] [blame] | 88 | { |
| 89 | flexcop_ibi_value r104; |
| 90 | int len = r100.tw_sm_c_100.total_bytes; /* remember total_bytes is buflen-1 */ |
| 91 | r104.raw = 0; |
| 92 | |
| 93 | /* there is at least one byte, otherwise we wouldn't be here */ |
| 94 | r100.tw_sm_c_100.data1_reg = buf[0]; |
Johannes Stezenbach | 2add87a | 2005-05-16 21:54:10 -0700 | [diff] [blame] | 95 | r104.tw_sm_c_104.data2_reg = len > 0 ? buf[1] : 0; |
| 96 | r104.tw_sm_c_104.data3_reg = len > 1 ? buf[2] : 0; |
| 97 | r104.tw_sm_c_104.data4_reg = len > 2 ? buf[3] : 0; |
| 98 | |
Patrick Boettcher | 6394cf5 | 2008-03-29 20:49:57 -0300 | [diff] [blame] | 99 | deb_i2c("write: r100: %08x, r104: %08x\n", r100.raw, r104.raw); |
Johannes Stezenbach | 2add87a | 2005-05-16 21:54:10 -0700 | [diff] [blame] | 100 | |
| 101 | /* write the additional i2c data before doing the actual i2c operation */ |
Patrick Boettcher | 6394cf5 | 2008-03-29 20:49:57 -0300 | [diff] [blame] | 102 | fc->write_ibi_reg(fc, tw_sm_c_104, r104); |
| 103 | return flexcop_i2c_operation(fc, &r100); |
Johannes Stezenbach | 2add87a | 2005-05-16 21:54:10 -0700 | [diff] [blame] | 104 | } |
| 105 | |
Patrick Boettcher | 6394cf5 | 2008-03-29 20:49:57 -0300 | [diff] [blame] | 106 | int flexcop_i2c_request(struct flexcop_i2c_adapter *i2c, |
Uwe Bugla | 1589a99 | 2009-03-29 07:46:58 -0300 | [diff] [blame] | 107 | flexcop_access_op_t op, u8 chipaddr, u8 addr, u8 *buf, u16 len) |
Johannes Stezenbach | 2add87a | 2005-05-16 21:54:10 -0700 | [diff] [blame] | 108 | { |
| 109 | int ret; |
Patrick Boettcher | 6394cf5 | 2008-03-29 20:49:57 -0300 | [diff] [blame] | 110 | |
| 111 | #ifdef DUMP_I2C_MESSAGES |
| 112 | int i; |
| 113 | #endif |
| 114 | |
Johannes Stezenbach | 2add87a | 2005-05-16 21:54:10 -0700 | [diff] [blame] | 115 | u16 bytes_to_transfer; |
| 116 | flexcop_ibi_value r100; |
| 117 | |
| 118 | deb_i2c("op = %d\n",op); |
| 119 | r100.raw = 0; |
| 120 | r100.tw_sm_c_100.chipaddr = chipaddr; |
| 121 | r100.tw_sm_c_100.twoWS_rw = op; |
Patrick Boettcher | 6394cf5 | 2008-03-29 20:49:57 -0300 | [diff] [blame] | 122 | r100.tw_sm_c_100.twoWS_port_reg = i2c->port; |
| 123 | |
| 124 | #ifdef DUMP_I2C_MESSAGES |
| 125 | printk(KERN_DEBUG "%d ", i2c->port); |
| 126 | if (op == FC_READ) |
| 127 | printk("rd("); |
| 128 | else |
| 129 | printk("wr("); |
Patrick Boettcher | 6394cf5 | 2008-03-29 20:49:57 -0300 | [diff] [blame] | 130 | printk("%02x): %02x ", chipaddr, addr); |
| 131 | #endif |
| 132 | |
| 133 | /* in that case addr is the only value -> |
| 134 | * we write it twice as baseaddr and val0 |
| 135 | * BBTI is doing it like that for ISL6421 at least */ |
| 136 | if (i2c->no_base_addr && len == 0 && op == FC_WRITE) { |
| 137 | buf = &addr; |
| 138 | len = 1; |
| 139 | } |
Johannes Stezenbach | 2add87a | 2005-05-16 21:54:10 -0700 | [diff] [blame] | 140 | |
| 141 | while (len != 0) { |
| 142 | bytes_to_transfer = len > 4 ? 4 : len; |
| 143 | |
| 144 | r100.tw_sm_c_100.total_bytes = bytes_to_transfer - 1; |
| 145 | r100.tw_sm_c_100.baseaddr = addr; |
| 146 | |
| 147 | if (op == FC_READ) |
Patrick Boettcher | 6394cf5 | 2008-03-29 20:49:57 -0300 | [diff] [blame] | 148 | ret = flexcop_i2c_read4(i2c, r100, buf); |
Johannes Stezenbach | 2add87a | 2005-05-16 21:54:10 -0700 | [diff] [blame] | 149 | else |
Patrick Boettcher | 6394cf5 | 2008-03-29 20:49:57 -0300 | [diff] [blame] | 150 | ret = flexcop_i2c_write4(i2c->fc, r100, buf); |
| 151 | |
| 152 | #ifdef DUMP_I2C_MESSAGES |
| 153 | for (i = 0; i < bytes_to_transfer; i++) |
| 154 | printk("%02x ", buf[i]); |
| 155 | #endif |
Johannes Stezenbach | 2add87a | 2005-05-16 21:54:10 -0700 | [diff] [blame] | 156 | |
| 157 | if (ret < 0) |
| 158 | return ret; |
| 159 | |
| 160 | buf += bytes_to_transfer; |
| 161 | addr += bytes_to_transfer; |
| 162 | len -= bytes_to_transfer; |
Patrick Boettcher | 6394cf5 | 2008-03-29 20:49:57 -0300 | [diff] [blame] | 163 | } |
| 164 | |
| 165 | #ifdef DUMP_I2C_MESSAGES |
| 166 | printk("\n"); |
| 167 | #endif |
Johannes Stezenbach | 2add87a | 2005-05-16 21:54:10 -0700 | [diff] [blame] | 168 | |
| 169 | return 0; |
| 170 | } |
| 171 | /* exported for PCI i2c */ |
| 172 | EXPORT_SYMBOL(flexcop_i2c_request); |
| 173 | |
Johannes Stezenbach | bdc7800 | 2005-05-16 21:54:18 -0700 | [diff] [blame] | 174 | /* master xfer callback for demodulator */ |
Uwe Bugla | 1589a99 | 2009-03-29 07:46:58 -0300 | [diff] [blame] | 175 | static int flexcop_master_xfer(struct i2c_adapter *i2c_adap, |
| 176 | struct i2c_msg msgs[], int num) |
Johannes Stezenbach | bdc7800 | 2005-05-16 21:54:18 -0700 | [diff] [blame] | 177 | { |
Patrick Boettcher | 6394cf5 | 2008-03-29 20:49:57 -0300 | [diff] [blame] | 178 | struct flexcop_i2c_adapter *i2c = i2c_get_adapdata(i2c_adap); |
Johannes Stezenbach | bdc7800 | 2005-05-16 21:54:18 -0700 | [diff] [blame] | 179 | int i, ret = 0; |
| 180 | |
Trent Piepho | 6175e48 | 2007-08-19 05:05:54 -0300 | [diff] [blame] | 181 | /* Some drivers use 1 byte or 0 byte reads as probes, which this |
| 182 | * driver doesn't support. These probes will always fail, so this |
| 183 | * hack makes them always succeed. If one knew how, it would of |
| 184 | * course be better to actually do the read. */ |
| 185 | if (num == 1 && msgs[0].flags == I2C_M_RD && msgs[0].len <= 1) |
| 186 | return 1; |
| 187 | |
Patrick Boettcher | 6394cf5 | 2008-03-29 20:49:57 -0300 | [diff] [blame] | 188 | if (mutex_lock_interruptible(&i2c->fc->i2c_mutex)) |
Johannes Stezenbach | bdc7800 | 2005-05-16 21:54:18 -0700 | [diff] [blame] | 189 | return -ERESTARTSYS; |
| 190 | |
Patrick Boettcher | 6394cf5 | 2008-03-29 20:49:57 -0300 | [diff] [blame] | 191 | for (i = 0; i < num; i++) { |
| 192 | /* reading */ |
| 193 | if (i+1 < num && (msgs[i+1].flags == I2C_M_RD)) { |
| 194 | ret = i2c->fc->i2c_request(i2c, FC_READ, msgs[i].addr, |
Uwe Bugla | 1589a99 | 2009-03-29 07:46:58 -0300 | [diff] [blame] | 195 | msgs[i].buf[0], msgs[i+1].buf, |
| 196 | msgs[i+1].len); |
Patrick Boettcher | 6394cf5 | 2008-03-29 20:49:57 -0300 | [diff] [blame] | 197 | i++; /* skip the following message */ |
| 198 | } else /* writing */ |
| 199 | ret = i2c->fc->i2c_request(i2c, FC_WRITE, msgs[i].addr, |
Uwe Bugla | 1589a99 | 2009-03-29 07:46:58 -0300 | [diff] [blame] | 200 | msgs[i].buf[0], &msgs[i].buf[1], |
| 201 | msgs[i].len - 1); |
Patrick Boettcher | 6394cf5 | 2008-03-29 20:49:57 -0300 | [diff] [blame] | 202 | if (ret < 0) { |
Matthias Schwarzott | 302e8ac | 2009-05-20 04:57:10 -0300 | [diff] [blame] | 203 | deb_i2c("i2c master_xfer failed"); |
Johannes Stezenbach | bdc7800 | 2005-05-16 21:54:18 -0700 | [diff] [blame] | 204 | break; |
| 205 | } |
Johannes Stezenbach | bdc7800 | 2005-05-16 21:54:18 -0700 | [diff] [blame] | 206 | } |
| 207 | |
Patrick Boettcher | 6394cf5 | 2008-03-29 20:49:57 -0300 | [diff] [blame] | 208 | mutex_unlock(&i2c->fc->i2c_mutex); |
| 209 | |
| 210 | if (ret == 0) |
Johannes Stezenbach | bdc7800 | 2005-05-16 21:54:18 -0700 | [diff] [blame] | 211 | ret = num; |
Johannes Stezenbach | bdc7800 | 2005-05-16 21:54:18 -0700 | [diff] [blame] | 212 | return ret; |
| 213 | } |
| 214 | |
Johannes Stezenbach | 2add87a | 2005-05-16 21:54:10 -0700 | [diff] [blame] | 215 | static u32 flexcop_i2c_func(struct i2c_adapter *adapter) |
| 216 | { |
| 217 | return I2C_FUNC_I2C; |
| 218 | } |
| 219 | |
| 220 | static struct i2c_algorithm flexcop_algo = { |
Johannes Stezenbach | 2add87a | 2005-05-16 21:54:10 -0700 | [diff] [blame] | 221 | .master_xfer = flexcop_master_xfer, |
| 222 | .functionality = flexcop_i2c_func, |
| 223 | }; |
| 224 | |
| 225 | int flexcop_i2c_init(struct flexcop_device *fc) |
| 226 | { |
| 227 | int ret; |
Ingo Molnar | 3593cab | 2006-02-07 06:49:14 -0200 | [diff] [blame] | 228 | mutex_init(&fc->i2c_mutex); |
Johannes Stezenbach | 2add87a | 2005-05-16 21:54:10 -0700 | [diff] [blame] | 229 | |
Patrick Boettcher | 6394cf5 | 2008-03-29 20:49:57 -0300 | [diff] [blame] | 230 | fc->fc_i2c_adap[0].fc = fc; |
| 231 | fc->fc_i2c_adap[1].fc = fc; |
| 232 | fc->fc_i2c_adap[2].fc = fc; |
Patrick Boettcher | 6394cf5 | 2008-03-29 20:49:57 -0300 | [diff] [blame] | 233 | fc->fc_i2c_adap[0].port = FC_I2C_PORT_DEMOD; |
| 234 | fc->fc_i2c_adap[1].port = FC_I2C_PORT_EEPROM; |
| 235 | fc->fc_i2c_adap[2].port = FC_I2C_PORT_TUNER; |
Johannes Stezenbach | 2add87a | 2005-05-16 21:54:10 -0700 | [diff] [blame] | 236 | |
Jean Delvare | 1d43401 | 2008-09-03 17:12:23 -0300 | [diff] [blame] | 237 | strlcpy(fc->fc_i2c_adap[0].i2c_adap.name, "B2C2 FlexCop I2C to demod", |
Uwe Bugla | 1589a99 | 2009-03-29 07:46:58 -0300 | [diff] [blame] | 238 | sizeof(fc->fc_i2c_adap[0].i2c_adap.name)); |
Jean Delvare | 1d43401 | 2008-09-03 17:12:23 -0300 | [diff] [blame] | 239 | strlcpy(fc->fc_i2c_adap[1].i2c_adap.name, "B2C2 FlexCop I2C to eeprom", |
Uwe Bugla | 1589a99 | 2009-03-29 07:46:58 -0300 | [diff] [blame] | 240 | sizeof(fc->fc_i2c_adap[1].i2c_adap.name)); |
Jean Delvare | 1d43401 | 2008-09-03 17:12:23 -0300 | [diff] [blame] | 241 | strlcpy(fc->fc_i2c_adap[2].i2c_adap.name, "B2C2 FlexCop I2C to tuner", |
Uwe Bugla | 1589a99 | 2009-03-29 07:46:58 -0300 | [diff] [blame] | 242 | sizeof(fc->fc_i2c_adap[2].i2c_adap.name)); |
Johannes Stezenbach | 2add87a | 2005-05-16 21:54:10 -0700 | [diff] [blame] | 243 | |
Patrick Boettcher | 6394cf5 | 2008-03-29 20:49:57 -0300 | [diff] [blame] | 244 | i2c_set_adapdata(&fc->fc_i2c_adap[0].i2c_adap, &fc->fc_i2c_adap[0]); |
| 245 | i2c_set_adapdata(&fc->fc_i2c_adap[1].i2c_adap, &fc->fc_i2c_adap[1]); |
| 246 | i2c_set_adapdata(&fc->fc_i2c_adap[2].i2c_adap, &fc->fc_i2c_adap[2]); |
| 247 | |
Patrick Boettcher | 6394cf5 | 2008-03-29 20:49:57 -0300 | [diff] [blame] | 248 | fc->fc_i2c_adap[0].i2c_adap.algo = |
| 249 | fc->fc_i2c_adap[1].i2c_adap.algo = |
| 250 | fc->fc_i2c_adap[2].i2c_adap.algo = &flexcop_algo; |
| 251 | fc->fc_i2c_adap[0].i2c_adap.algo_data = |
| 252 | fc->fc_i2c_adap[1].i2c_adap.algo_data = |
| 253 | fc->fc_i2c_adap[2].i2c_adap.algo_data = NULL; |
| 254 | fc->fc_i2c_adap[0].i2c_adap.dev.parent = |
| 255 | fc->fc_i2c_adap[1].i2c_adap.dev.parent = |
| 256 | fc->fc_i2c_adap[2].i2c_adap.dev.parent = fc->dev; |
| 257 | |
| 258 | ret = i2c_add_adapter(&fc->fc_i2c_adap[0].i2c_adap); |
| 259 | if (ret < 0) |
Johannes Stezenbach | 2add87a | 2005-05-16 21:54:10 -0700 | [diff] [blame] | 260 | return ret; |
| 261 | |
Patrick Boettcher | 6394cf5 | 2008-03-29 20:49:57 -0300 | [diff] [blame] | 262 | ret = i2c_add_adapter(&fc->fc_i2c_adap[1].i2c_adap); |
| 263 | if (ret < 0) |
| 264 | goto adap_1_failed; |
| 265 | |
| 266 | ret = i2c_add_adapter(&fc->fc_i2c_adap[2].i2c_adap); |
| 267 | if (ret < 0) |
| 268 | goto adap_2_failed; |
| 269 | |
Johannes Stezenbach | 2add87a | 2005-05-16 21:54:10 -0700 | [diff] [blame] | 270 | fc->init_state |= FC_STATE_I2C_INIT; |
| 271 | return 0; |
Patrick Boettcher | 6394cf5 | 2008-03-29 20:49:57 -0300 | [diff] [blame] | 272 | |
| 273 | adap_2_failed: |
| 274 | i2c_del_adapter(&fc->fc_i2c_adap[1].i2c_adap); |
| 275 | adap_1_failed: |
| 276 | i2c_del_adapter(&fc->fc_i2c_adap[0].i2c_adap); |
Patrick Boettcher | 6394cf5 | 2008-03-29 20:49:57 -0300 | [diff] [blame] | 277 | return ret; |
Johannes Stezenbach | 2add87a | 2005-05-16 21:54:10 -0700 | [diff] [blame] | 278 | } |
| 279 | |
| 280 | void flexcop_i2c_exit(struct flexcop_device *fc) |
| 281 | { |
Patrick Boettcher | 6394cf5 | 2008-03-29 20:49:57 -0300 | [diff] [blame] | 282 | if (fc->init_state & FC_STATE_I2C_INIT) { |
| 283 | i2c_del_adapter(&fc->fc_i2c_adap[2].i2c_adap); |
| 284 | i2c_del_adapter(&fc->fc_i2c_adap[1].i2c_adap); |
| 285 | i2c_del_adapter(&fc->fc_i2c_adap[0].i2c_adap); |
| 286 | } |
Johannes Stezenbach | 2add87a | 2005-05-16 21:54:10 -0700 | [diff] [blame] | 287 | fc->init_state &= ~FC_STATE_I2C_INIT; |
| 288 | } |