diff options
author | Olivier Grenie <olivier.grenie@dibcom.fr> | 2011-01-03 13:39:35 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-03-21 19:31:41 -0400 |
commit | b994d19268756b640ccc76f0b0d47ee13c0f8af9 (patch) | |
tree | d139bbbbf8aa16abf86d301ea3519cf45a9fcc73 /drivers/media/dvb | |
parent | 4c70e074f8c496dc06798188d71be13162115d32 (diff) |
[media] DiBx000: add addition i2c-interface names
This patch adds the possibitity to use different I2C-ports to talk to
slave-devices than the standard ones.
Signed-off-by: Olivier Grenie <olivier.grenie@dibcom.fr>
Signed-off-by: Patrick Boettcher <patrick.boettcher@dibcom.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb')
-rw-r--r-- | drivers/media/dvb/frontends/dibx000_common.c | 284 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/dibx000_common.h | 23 |
2 files changed, 285 insertions, 22 deletions
diff --git a/drivers/media/dvb/frontends/dibx000_common.c b/drivers/media/dvb/frontends/dibx000_common.c index 2311c0a3406c..9bd95a978a1c 100644 --- a/drivers/media/dvb/frontends/dibx000_common.c +++ b/drivers/media/dvb/frontends/dibx000_common.c | |||
@@ -17,9 +17,144 @@ static int dibx000_write_word(struct dibx000_i2c_master *mst, u16 reg, u16 val) | |||
17 | struct i2c_msg msg = { | 17 | struct i2c_msg msg = { |
18 | .addr = mst->i2c_addr,.flags = 0,.buf = b,.len = 4 | 18 | .addr = mst->i2c_addr,.flags = 0,.buf = b,.len = 4 |
19 | }; | 19 | }; |
20 | |||
20 | return i2c_transfer(mst->i2c_adap, &msg, 1) != 1 ? -EREMOTEIO : 0; | 21 | return i2c_transfer(mst->i2c_adap, &msg, 1) != 1 ? -EREMOTEIO : 0; |
21 | } | 22 | } |
22 | 23 | ||
24 | static u16 dibx000_read_word(struct dibx000_i2c_master *mst, u16 reg) | ||
25 | { | ||
26 | u8 wb[2] = { reg >> 8, reg & 0xff }; | ||
27 | u8 rb[2]; | ||
28 | struct i2c_msg msg[2] = { | ||
29 | {.addr = mst->i2c_addr,.flags = 0,.buf = wb,.len = 2}, | ||
30 | {.addr = mst->i2c_addr,.flags = I2C_M_RD,.buf = rb,.len = 2}, | ||
31 | }; | ||
32 | |||
33 | if (i2c_transfer(mst->i2c_adap, msg, 2) != 2) | ||
34 | dprintk("i2c read error on %d", reg); | ||
35 | |||
36 | return (rb[0] << 8) | rb[1]; | ||
37 | } | ||
38 | |||
39 | static int dibx000_is_i2c_done(struct dibx000_i2c_master *mst) | ||
40 | { | ||
41 | int i = 100; // max_i2c_polls; | ||
42 | u16 status; | ||
43 | |||
44 | while (((status = dibx000_read_word(mst, mst->base_reg + 2)) & 0x0100) == 0 && --i > 0); | ||
45 | |||
46 | /* i2c timed out */ | ||
47 | if (i == 0) | ||
48 | return -EREMOTEIO; | ||
49 | |||
50 | /* no acknowledge */ | ||
51 | if ((status & 0x0080) == 0) | ||
52 | return -EREMOTEIO; | ||
53 | |||
54 | return 0; | ||
55 | } | ||
56 | |||
57 | static int dibx000_master_i2c_write(struct dibx000_i2c_master *mst, struct i2c_msg *msg, u8 stop) | ||
58 | { | ||
59 | u16 data; | ||
60 | u16 da; | ||
61 | u16 i; | ||
62 | u16 txlen = msg->len, len; | ||
63 | const u8 *b = msg->buf; | ||
64 | |||
65 | while (txlen) { | ||
66 | dibx000_read_word(mst, mst->base_reg + 2); // reset fifo ptr | ||
67 | |||
68 | len = txlen > 8 ? 8 : txlen; | ||
69 | for (i = 0; i < len; i += 2) { | ||
70 | data = *b++ << 8; | ||
71 | if (i+1 < len) | ||
72 | data |= *b++; | ||
73 | dibx000_write_word(mst, mst->base_reg, data); | ||
74 | } | ||
75 | da = (((u8) (msg->addr)) << 9) | // addr | ||
76 | (1 << 8) | // master | ||
77 | (1 << 7) | // rq | ||
78 | (0 << 6) | // stop | ||
79 | (0 << 5) | // start | ||
80 | ((len & 0x7) << 2) | // nb 8 bytes == 0 here | ||
81 | (0 << 1) | // rw | ||
82 | (0 << 0); // irqen | ||
83 | |||
84 | if (txlen == msg->len) | ||
85 | da |= 1 << 5; /* start */ | ||
86 | |||
87 | if (txlen-len == 0 && stop) | ||
88 | da |= 1 << 6; /* stop */ | ||
89 | |||
90 | dibx000_write_word(mst, mst->base_reg+1, da); | ||
91 | |||
92 | if (dibx000_is_i2c_done(mst) != 0) | ||
93 | return -EREMOTEIO; | ||
94 | txlen -= len; | ||
95 | } | ||
96 | |||
97 | return 0; | ||
98 | } | ||
99 | |||
100 | static int dibx000_master_i2c_read(struct dibx000_i2c_master *mst, struct i2c_msg *msg) | ||
101 | { | ||
102 | u16 da; | ||
103 | u8 *b = msg->buf; | ||
104 | u16 rxlen = msg->len, len; | ||
105 | |||
106 | while (rxlen) { | ||
107 | len = rxlen > 8 ? 8 : rxlen; | ||
108 | da = (((u8) (msg->addr)) << 9) | // addr | ||
109 | (1 << 8) | // master | ||
110 | (1 << 7) | // rq | ||
111 | (0 << 6) | // stop | ||
112 | (0 << 5) | // start | ||
113 | ((len & 0x7) << 2) | // nb | ||
114 | (1 << 1) | // rw | ||
115 | (0 << 0); // irqen | ||
116 | |||
117 | if (rxlen == msg->len) | ||
118 | da |= 1 << 5; /* start */ | ||
119 | |||
120 | if (rxlen-len == 0) | ||
121 | da |= 1 << 6; /* stop */ | ||
122 | dibx000_write_word(mst, mst->base_reg+1, da); | ||
123 | |||
124 | if (dibx000_is_i2c_done(mst) != 0) | ||
125 | return -EREMOTEIO; | ||
126 | |||
127 | rxlen -= len; | ||
128 | |||
129 | while (len) { | ||
130 | da = dibx000_read_word(mst, mst->base_reg); | ||
131 | *b++ = (da >> 8) & 0xff; | ||
132 | len--; | ||
133 | if (len >= 1) { | ||
134 | *b++ = da & 0xff; | ||
135 | len--; | ||
136 | } | ||
137 | } | ||
138 | } | ||
139 | |||
140 | return 0; | ||
141 | } | ||
142 | |||
143 | int dibx000_i2c_set_speed(struct i2c_adapter *i2c_adap, u16 speed) | ||
144 | { | ||
145 | struct dibx000_i2c_master *mst = i2c_get_adapdata(i2c_adap); | ||
146 | |||
147 | if (mst->device_rev < DIB7000MC && speed < 235) | ||
148 | speed = 235; | ||
149 | return dibx000_write_word(mst, mst->base_reg + 3, (u16)(60000 / speed)); | ||
150 | |||
151 | } | ||
152 | EXPORT_SYMBOL(dibx000_i2c_set_speed); | ||
153 | |||
154 | static u32 dibx000_i2c_func(struct i2c_adapter *adapter) | ||
155 | { | ||
156 | return I2C_FUNC_I2C; | ||
157 | } | ||
23 | 158 | ||
24 | static int dibx000_i2c_select_interface(struct dibx000_i2c_master *mst, | 159 | static int dibx000_i2c_select_interface(struct dibx000_i2c_master *mst, |
25 | enum dibx000_i2c_interface intf) | 160 | enum dibx000_i2c_interface intf) |
@@ -32,6 +167,66 @@ static int dibx000_i2c_select_interface(struct dibx000_i2c_master *mst, | |||
32 | return 0; | 167 | return 0; |
33 | } | 168 | } |
34 | 169 | ||
170 | static int dibx000_i2c_master_xfer_gpio12(struct i2c_adapter *i2c_adap, struct i2c_msg msg[], int num) | ||
171 | { | ||
172 | struct dibx000_i2c_master *mst = i2c_get_adapdata(i2c_adap); | ||
173 | int msg_index; | ||
174 | int ret = 0; | ||
175 | |||
176 | dibx000_i2c_select_interface(mst, DIBX000_I2C_INTERFACE_GPIO_1_2); | ||
177 | for (msg_index = 0; msg_index<num; msg_index++) { | ||
178 | if (msg[msg_index].flags & I2C_M_RD) | ||
179 | { | ||
180 | ret = dibx000_master_i2c_read(mst, &msg[msg_index]); | ||
181 | if (ret != 0) | ||
182 | return 0; | ||
183 | } | ||
184 | else | ||
185 | { | ||
186 | ret = dibx000_master_i2c_write(mst, &msg[msg_index], 1); | ||
187 | if (ret != 0) | ||
188 | return 0; | ||
189 | } | ||
190 | } | ||
191 | |||
192 | return num; | ||
193 | } | ||
194 | |||
195 | static int dibx000_i2c_master_xfer_gpio34(struct i2c_adapter *i2c_adap, struct i2c_msg msg[], int num) | ||
196 | { | ||
197 | struct dibx000_i2c_master *mst = i2c_get_adapdata(i2c_adap); | ||
198 | int msg_index; | ||
199 | int ret = 0; | ||
200 | |||
201 | dibx000_i2c_select_interface(mst, DIBX000_I2C_INTERFACE_GPIO_3_4); | ||
202 | for (msg_index = 0; msg_index<num; msg_index++) { | ||
203 | if (msg[msg_index].flags & I2C_M_RD) | ||
204 | { | ||
205 | ret = dibx000_master_i2c_read(mst, &msg[msg_index]); | ||
206 | if (ret != 0) | ||
207 | return 0; | ||
208 | } | ||
209 | else | ||
210 | { | ||
211 | ret = dibx000_master_i2c_write(mst, &msg[msg_index], 1); | ||
212 | if (ret != 0) | ||
213 | return 0; | ||
214 | } | ||
215 | } | ||
216 | |||
217 | return num; | ||
218 | } | ||
219 | |||
220 | static struct i2c_algorithm dibx000_i2c_master_gpio12_xfer_algo = { | ||
221 | .master_xfer = dibx000_i2c_master_xfer_gpio12, | ||
222 | .functionality = dibx000_i2c_func, | ||
223 | }; | ||
224 | |||
225 | static struct i2c_algorithm dibx000_i2c_master_gpio34_xfer_algo = { | ||
226 | .master_xfer = dibx000_i2c_master_xfer_gpio34, | ||
227 | .functionality = dibx000_i2c_func, | ||
228 | }; | ||
229 | |||
35 | static int dibx000_i2c_gate_ctrl(struct dibx000_i2c_master *mst, u8 tx[4], | 230 | static int dibx000_i2c_gate_ctrl(struct dibx000_i2c_master *mst, u8 tx[4], |
36 | u8 addr, int onoff) | 231 | u8 addr, int onoff) |
37 | { | 232 | { |
@@ -54,11 +249,37 @@ static int dibx000_i2c_gate_ctrl(struct dibx000_i2c_master *mst, u8 tx[4], | |||
54 | return 0; | 249 | return 0; |
55 | } | 250 | } |
56 | 251 | ||
57 | static u32 dibx000_i2c_func(struct i2c_adapter *adapter) | 252 | static int dibx000_i2c_gated_gpio67_xfer(struct i2c_adapter *i2c_adap, |
253 | struct i2c_msg msg[], int num) | ||
58 | { | 254 | { |
59 | return I2C_FUNC_I2C; | 255 | struct dibx000_i2c_master *mst = i2c_get_adapdata(i2c_adap); |
256 | struct i2c_msg m[2 + num]; | ||
257 | u8 tx_open[4], tx_close[4]; | ||
258 | |||
259 | memset(m, 0, sizeof(struct i2c_msg) * (2 + num)); | ||
260 | |||
261 | dibx000_i2c_select_interface(mst, DIBX000_I2C_INTERFACE_GPIO_6_7); | ||
262 | |||
263 | dibx000_i2c_gate_ctrl(mst, tx_open, msg[0].addr, 1); | ||
264 | m[0].addr = mst->i2c_addr; | ||
265 | m[0].buf = tx_open; | ||
266 | m[0].len = 4; | ||
267 | |||
268 | memcpy(&m[1], msg, sizeof(struct i2c_msg) * num); | ||
269 | |||
270 | dibx000_i2c_gate_ctrl(mst, tx_close, 0, 0); | ||
271 | m[num + 1].addr = mst->i2c_addr; | ||
272 | m[num + 1].buf = tx_close; | ||
273 | m[num + 1].len = 4; | ||
274 | |||
275 | return i2c_transfer(mst->i2c_adap, m, 2 + num) == 2 + num ? num : -EIO; | ||
60 | } | 276 | } |
61 | 277 | ||
278 | static struct i2c_algorithm dibx000_i2c_gated_gpio67_algo = { | ||
279 | .master_xfer = dibx000_i2c_gated_gpio67_xfer, | ||
280 | .functionality = dibx000_i2c_func, | ||
281 | }; | ||
282 | |||
62 | static int dibx000_i2c_gated_tuner_xfer(struct i2c_adapter *i2c_adap, | 283 | static int dibx000_i2c_gated_tuner_xfer(struct i2c_adapter *i2c_adap, |
63 | struct i2c_msg msg[], int num) | 284 | struct i2c_msg msg[], int num) |
64 | { | 285 | { |
@@ -91,8 +312,8 @@ static struct i2c_algorithm dibx000_i2c_gated_tuner_algo = { | |||
91 | }; | 312 | }; |
92 | 313 | ||
93 | struct i2c_adapter *dibx000_get_i2c_adapter(struct dibx000_i2c_master *mst, | 314 | struct i2c_adapter *dibx000_get_i2c_adapter(struct dibx000_i2c_master *mst, |
94 | enum dibx000_i2c_interface intf, | 315 | enum dibx000_i2c_interface intf, |
95 | int gating) | 316 | int gating) |
96 | { | 317 | { |
97 | struct i2c_adapter *i2c = NULL; | 318 | struct i2c_adapter *i2c = NULL; |
98 | 319 | ||
@@ -101,6 +322,18 @@ struct i2c_adapter *dibx000_get_i2c_adapter(struct dibx000_i2c_master *mst, | |||
101 | if (gating) | 322 | if (gating) |
102 | i2c = &mst->gated_tuner_i2c_adap; | 323 | i2c = &mst->gated_tuner_i2c_adap; |
103 | break; | 324 | break; |
325 | case DIBX000_I2C_INTERFACE_GPIO_1_2: | ||
326 | if (!gating) | ||
327 | i2c = &mst->master_i2c_adap_gpio12; | ||
328 | break; | ||
329 | case DIBX000_I2C_INTERFACE_GPIO_3_4: | ||
330 | if (!gating) | ||
331 | i2c = &mst->master_i2c_adap_gpio34; | ||
332 | break; | ||
333 | case DIBX000_I2C_INTERFACE_GPIO_6_7: | ||
334 | if (gating) | ||
335 | i2c = &mst->master_i2c_adap_gpio67; | ||
336 | break; | ||
104 | default: | 337 | default: |
105 | printk(KERN_ERR "DiBX000: incorrect I2C interface selected\n"); | 338 | printk(KERN_ERR "DiBX000: incorrect I2C interface selected\n"); |
106 | break; | 339 | break; |
@@ -126,8 +359,8 @@ void dibx000_reset_i2c_master(struct dibx000_i2c_master *mst) | |||
126 | EXPORT_SYMBOL(dibx000_reset_i2c_master); | 359 | EXPORT_SYMBOL(dibx000_reset_i2c_master); |
127 | 360 | ||
128 | static int i2c_adapter_init(struct i2c_adapter *i2c_adap, | 361 | static int i2c_adapter_init(struct i2c_adapter *i2c_adap, |
129 | struct i2c_algorithm *algo, const char *name, | 362 | struct i2c_algorithm *algo, const char *name, |
130 | struct dibx000_i2c_master *mst) | 363 | struct dibx000_i2c_master *mst) |
131 | { | 364 | { |
132 | strncpy(i2c_adap->name, name, sizeof(i2c_adap->name)); | 365 | strncpy(i2c_adap->name, name, sizeof(i2c_adap->name)); |
133 | i2c_adap->algo = algo; | 366 | i2c_adap->algo = algo; |
@@ -139,7 +372,7 @@ static int i2c_adapter_init(struct i2c_adapter *i2c_adap, | |||
139 | } | 372 | } |
140 | 373 | ||
141 | int dibx000_init_i2c_master(struct dibx000_i2c_master *mst, u16 device_rev, | 374 | int dibx000_init_i2c_master(struct dibx000_i2c_master *mst, u16 device_rev, |
142 | struct i2c_adapter *i2c_adap, u8 i2c_addr) | 375 | struct i2c_adapter *i2c_adap, u8 i2c_addr) |
143 | { | 376 | { |
144 | u8 tx[4]; | 377 | u8 tx[4]; |
145 | struct i2c_msg m = {.addr = i2c_addr >> 1,.buf = tx,.len = 4 }; | 378 | struct i2c_msg m = {.addr = i2c_addr >> 1,.buf = tx,.len = 4 }; |
@@ -153,11 +386,33 @@ int dibx000_init_i2c_master(struct dibx000_i2c_master *mst, u16 device_rev, | |||
153 | else | 386 | else |
154 | mst->base_reg = 768; | 387 | mst->base_reg = 768; |
155 | 388 | ||
389 | mst->gated_tuner_i2c_adap.dev.parent = mst->i2c_adap->dev.parent; | ||
390 | if (i2c_adapter_init | ||
391 | (&mst->gated_tuner_i2c_adap, &dibx000_i2c_gated_tuner_algo, | ||
392 | "DiBX000 tuner I2C bus", mst) != 0) | ||
393 | printk(KERN_ERR | ||
394 | "DiBX000: could not initialize the tuner i2c_adapter\n"); | ||
395 | |||
396 | mst->master_i2c_adap_gpio12.dev.parent = mst->i2c_adap->dev.parent; | ||
397 | if (i2c_adapter_init | ||
398 | (&mst->master_i2c_adap_gpio12, &dibx000_i2c_master_gpio12_xfer_algo, | ||
399 | "DiBX000 master GPIO12 I2C bus", mst) != 0) | ||
400 | printk(KERN_ERR | ||
401 | "DiBX000: could not initialize the master i2c_adapter\n"); | ||
402 | |||
403 | mst->master_i2c_adap_gpio34.dev.parent = mst->i2c_adap->dev.parent; | ||
404 | if (i2c_adapter_init | ||
405 | (&mst->master_i2c_adap_gpio34, &dibx000_i2c_master_gpio34_xfer_algo, | ||
406 | "DiBX000 master GPIO34 I2C bus", mst) != 0) | ||
407 | printk(KERN_ERR | ||
408 | "DiBX000: could not initialize the master i2c_adapter\n"); | ||
409 | |||
410 | mst->master_i2c_adap_gpio67.dev.parent = mst->i2c_adap->dev.parent; | ||
156 | if (i2c_adapter_init | 411 | if (i2c_adapter_init |
157 | (&mst->gated_tuner_i2c_adap, &dibx000_i2c_gated_tuner_algo, | 412 | (&mst->master_i2c_adap_gpio67, &dibx000_i2c_gated_gpio67_algo, |
158 | "DiBX000 tuner I2C bus", mst) != 0) | 413 | "DiBX000 master GPIO67 I2C bus", mst) != 0) |
159 | printk(KERN_ERR | 414 | printk(KERN_ERR |
160 | "DiBX000: could not initialize the tuner i2c_adapter\n"); | 415 | "DiBX000: could not initialize the master i2c_adapter\n"); |
161 | 416 | ||
162 | /* initialize the i2c-master by closing the gate */ | 417 | /* initialize the i2c-master by closing the gate */ |
163 | dibx000_i2c_gate_ctrl(mst, tx, 0, 0); | 418 | dibx000_i2c_gate_ctrl(mst, tx, 0, 0); |
@@ -170,16 +425,19 @@ EXPORT_SYMBOL(dibx000_init_i2c_master); | |||
170 | void dibx000_exit_i2c_master(struct dibx000_i2c_master *mst) | 425 | void dibx000_exit_i2c_master(struct dibx000_i2c_master *mst) |
171 | { | 426 | { |
172 | i2c_del_adapter(&mst->gated_tuner_i2c_adap); | 427 | i2c_del_adapter(&mst->gated_tuner_i2c_adap); |
428 | i2c_del_adapter(&mst->master_i2c_adap_gpio12); | ||
429 | i2c_del_adapter(&mst->master_i2c_adap_gpio34); | ||
430 | i2c_del_adapter(&mst->master_i2c_adap_gpio67); | ||
173 | } | 431 | } |
174 | EXPORT_SYMBOL(dibx000_exit_i2c_master); | 432 | EXPORT_SYMBOL(dibx000_exit_i2c_master); |
175 | 433 | ||
176 | 434 | ||
177 | u32 systime(void) | 435 | u32 systime(void) |
178 | { | 436 | { |
179 | struct timespec t; | 437 | struct timespec t; |
180 | 438 | ||
181 | t = current_kernel_time(); | 439 | t = current_kernel_time(); |
182 | return (t.tv_sec * 10000) + (t.tv_nsec / 100000); | 440 | return (t.tv_sec * 10000) + (t.tv_nsec / 100000); |
183 | } | 441 | } |
184 | EXPORT_SYMBOL(systime); | 442 | EXPORT_SYMBOL(systime); |
185 | 443 | ||
diff --git a/drivers/media/dvb/frontends/dibx000_common.h b/drivers/media/dvb/frontends/dibx000_common.h index 4f5d141a308d..b7ad066b7e52 100644 --- a/drivers/media/dvb/frontends/dibx000_common.h +++ b/drivers/media/dvb/frontends/dibx000_common.h | |||
@@ -4,7 +4,8 @@ | |||
4 | enum dibx000_i2c_interface { | 4 | enum dibx000_i2c_interface { |
5 | DIBX000_I2C_INTERFACE_TUNER = 0, | 5 | DIBX000_I2C_INTERFACE_TUNER = 0, |
6 | DIBX000_I2C_INTERFACE_GPIO_1_2 = 1, | 6 | DIBX000_I2C_INTERFACE_GPIO_1_2 = 1, |
7 | DIBX000_I2C_INTERFACE_GPIO_3_4 = 2 | 7 | DIBX000_I2C_INTERFACE_GPIO_3_4 = 2, |
8 | DIBX000_I2C_INTERFACE_GPIO_6_7 = 3 | ||
8 | }; | 9 | }; |
9 | 10 | ||
10 | struct dibx000_i2c_master { | 11 | struct dibx000_i2c_master { |
@@ -17,8 +18,11 @@ struct dibx000_i2c_master { | |||
17 | 18 | ||
18 | enum dibx000_i2c_interface selected_interface; | 19 | enum dibx000_i2c_interface selected_interface; |
19 | 20 | ||
20 | // struct i2c_adapter tuner_i2c_adap; | 21 | // struct i2c_adapter tuner_i2c_adap; |
21 | struct i2c_adapter gated_tuner_i2c_adap; | 22 | struct i2c_adapter gated_tuner_i2c_adap; |
23 | struct i2c_adapter master_i2c_adap_gpio12; | ||
24 | struct i2c_adapter master_i2c_adap_gpio34; | ||
25 | struct i2c_adapter master_i2c_adap_gpio67; | ||
22 | 26 | ||
23 | struct i2c_adapter *i2c_adap; | 27 | struct i2c_adapter *i2c_adap; |
24 | u8 i2c_addr; | 28 | u8 i2c_addr; |
@@ -27,14 +31,15 @@ struct dibx000_i2c_master { | |||
27 | }; | 31 | }; |
28 | 32 | ||
29 | extern int dibx000_init_i2c_master(struct dibx000_i2c_master *mst, | 33 | extern int dibx000_init_i2c_master(struct dibx000_i2c_master *mst, |
30 | u16 device_rev, struct i2c_adapter *i2c_adap, | 34 | u16 device_rev, struct i2c_adapter *i2c_adap, |
31 | u8 i2c_addr); | 35 | u8 i2c_addr); |
32 | extern struct i2c_adapter *dibx000_get_i2c_adapter(struct dibx000_i2c_master | 36 | extern struct i2c_adapter *dibx000_get_i2c_adapter(struct dibx000_i2c_master |
33 | *mst, | 37 | *mst, |
34 | enum dibx000_i2c_interface | 38 | enum dibx000_i2c_interface |
35 | intf, int gating); | 39 | intf, int gating); |
36 | extern void dibx000_exit_i2c_master(struct dibx000_i2c_master *mst); | 40 | extern void dibx000_exit_i2c_master(struct dibx000_i2c_master *mst); |
37 | extern void dibx000_reset_i2c_master(struct dibx000_i2c_master *mst); | 41 | extern void dibx000_reset_i2c_master(struct dibx000_i2c_master *mst); |
42 | extern int dibx000_i2c_set_speed(struct i2c_adapter *i2c_adap, u16 speed); | ||
38 | 43 | ||
39 | extern u32 systime(void); | 44 | extern u32 systime(void); |
40 | 45 | ||
@@ -42,10 +47,10 @@ extern u32 systime(void); | |||
42 | #define BAND_UHF 0x02 | 47 | #define BAND_UHF 0x02 |
43 | #define BAND_VHF 0x04 | 48 | #define BAND_VHF 0x04 |
44 | #define BAND_SBAND 0x08 | 49 | #define BAND_SBAND 0x08 |
45 | #define BAND_FM 0x10 | 50 | #define BAND_FM 0x10 |
46 | #define BAND_CBAND 0x20 | 51 | #define BAND_CBAND 0x20 |
47 | 52 | ||
48 | #define BAND_OF_FREQUENCY(freq_kHz) ((freq_kHz) <= 170000 ? BAND_CBAND : \ | 53 | #define BAND_OF_FREQUENCY(freq_kHz) ( (freq_kHz) <= 170000 ? BAND_CBAND : \ |
49 | (freq_kHz) <= 115000 ? BAND_FM : \ | 54 | (freq_kHz) <= 115000 ? BAND_FM : \ |
50 | (freq_kHz) <= 250000 ? BAND_VHF : \ | 55 | (freq_kHz) <= 250000 ? BAND_VHF : \ |
51 | (freq_kHz) <= 863000 ? BAND_UHF : \ | 56 | (freq_kHz) <= 863000 ? BAND_UHF : \ |