]>
Commit | Line | Data |
---|---|---|
1da177e4 | 1 | /* |
de48eebc HH |
2 | |
3 | i2c tv tuner chip device driver | |
4 | controls the philips tda8290+75 tuner chip combo. | |
5 | ||
6 | This program is free software; you can redistribute it and/or modify | |
7 | it under the terms of the GNU General Public License as published by | |
8 | the Free Software Foundation; either version 2 of the License, or | |
9 | (at your option) any later version. | |
10 | ||
11 | This program is distributed in the hope that it will be useful, | |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | GNU General Public License for more details. | |
15 | ||
16 | You should have received a copy of the GNU General Public License | |
17 | along with this program; if not, write to the Free Software | |
18 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |
910bb3e3 MK |
19 | |
20 | This "tda8290" module was split apart from the original "tuner" module. | |
de48eebc HH |
21 | */ |
22 | ||
1da177e4 | 23 | #include <linux/i2c.h> |
5a0e3ad6 | 24 | #include <linux/slab.h> |
1da177e4 | 25 | #include <linux/delay.h> |
7f6adeaf | 26 | #include <linux/videodev2.h> |
ab166050 | 27 | #include "tuner-i2c.h" |
910bb3e3 | 28 | #include "tda8290.h" |
746d9732 | 29 | #include "tda827x.h" |
5bea1cd3 | 30 | #include "tda18271.h" |
910bb3e3 | 31 | |
ab166050 MK |
32 | static int debug; |
33 | module_param(debug, int, 0644); | |
910bb3e3 MK |
34 | MODULE_PARM_DESC(debug, "enable verbose debug messages"); |
35 | ||
9af0ef27 | 36 | static int deemphasis_50; |
b450b92e | 37 | module_param(deemphasis_50, int, 0644); |
9af0ef27 MCC |
38 | MODULE_PARM_DESC(deemphasis_50, "0 - 75us deemphasis; 1 - 50us deemphasis"); |
39 | ||
1da177e4 LT |
40 | /* ---------------------------------------------------------------------- */ |
41 | ||
b2083199 | 42 | struct tda8290_priv { |
db8a6956 MK |
43 | struct tuner_i2c_props i2c_props; |
44 | ||
b2083199 | 45 | unsigned char tda8290_easy_mode; |
746d9732 | 46 | |
b2083199 | 47 | unsigned char tda827x_addr; |
8c125f2c MK |
48 | |
49 | unsigned char ver; | |
50 | #define TDA8290 1 | |
51 | #define TDA8295 2 | |
52 | #define TDA8275 4 | |
53 | #define TDA8275A 8 | |
54 | #define TDA18271 16 | |
1da177e4 | 55 | |
746d9732 | 56 | struct tda827x_config cfg; |
1da177e4 LT |
57 | }; |
58 | ||
de48eebc | 59 | /*---------------------------------------------------------------------*/ |
1da177e4 | 60 | |
a72dd305 | 61 | static int tda8290_i2c_bridge(struct dvb_frontend *fe, int close) |
de48eebc | 62 | { |
4e9154b8 | 63 | struct tda8290_priv *priv = fe->analog_demod_priv; |
db8a6956 | 64 | |
de48eebc | 65 | unsigned char enable[2] = { 0x21, 0xC0 }; |
0157a9cc | 66 | unsigned char disable[2] = { 0x21, 0x00 }; |
de48eebc | 67 | unsigned char *msg; |
a72dd305 MK |
68 | |
69 | if (close) { | |
de48eebc | 70 | msg = enable; |
db8a6956 | 71 | tuner_i2c_xfer_send(&priv->i2c_props, msg, 2); |
de48eebc HH |
72 | /* let the bridge stabilize */ |
73 | msleep(20); | |
74 | } else { | |
75 | msg = disable; | |
db8a6956 | 76 | tuner_i2c_xfer_send(&priv->i2c_props, msg, 2); |
de48eebc | 77 | } |
a72dd305 MK |
78 | |
79 | return 0; | |
1da177e4 LT |
80 | } |
81 | ||
a72dd305 | 82 | static int tda8295_i2c_bridge(struct dvb_frontend *fe, int close) |
5bea1cd3 | 83 | { |
4e9154b8 | 84 | struct tda8290_priv *priv = fe->analog_demod_priv; |
5bea1cd3 MK |
85 | |
86 | unsigned char enable[2] = { 0x45, 0xc1 }; | |
87 | unsigned char disable[2] = { 0x46, 0x00 }; | |
88 | unsigned char buf[3] = { 0x45, 0x01, 0x00 }; | |
89 | unsigned char *msg; | |
a72dd305 | 90 | |
5bea1cd3 MK |
91 | if (close) { |
92 | msg = enable; | |
93 | tuner_i2c_xfer_send(&priv->i2c_props, msg, 2); | |
94 | /* let the bridge stabilize */ | |
95 | msleep(20); | |
96 | } else { | |
97 | msg = disable; | |
98 | tuner_i2c_xfer_send(&priv->i2c_props, msg, 1); | |
99 | tuner_i2c_xfer_recv(&priv->i2c_props, &msg[1], 1); | |
100 | ||
101 | buf[2] = msg[1]; | |
102 | buf[2] &= ~0x04; | |
103 | tuner_i2c_xfer_send(&priv->i2c_props, buf, 3); | |
104 | msleep(5); | |
105 | ||
106 | msg[1] |= 0x04; | |
107 | tuner_i2c_xfer_send(&priv->i2c_props, msg, 2); | |
108 | } | |
a72dd305 MK |
109 | |
110 | return 0; | |
5bea1cd3 MK |
111 | } |
112 | ||
de48eebc HH |
113 | /*---------------------------------------------------------------------*/ |
114 | ||
c7919d52 MK |
115 | static void set_audio(struct dvb_frontend *fe, |
116 | struct analog_parameters *params) | |
1da177e4 | 117 | { |
4e9154b8 | 118 | struct tda8290_priv *priv = fe->analog_demod_priv; |
910bb3e3 MK |
119 | char* mode; |
120 | ||
c7919d52 | 121 | if (params->std & V4L2_STD_MN) { |
910bb3e3 | 122 | priv->tda8290_easy_mode = 0x01; |
910bb3e3 | 123 | mode = "MN"; |
c7919d52 | 124 | } else if (params->std & V4L2_STD_B) { |
910bb3e3 MK |
125 | priv->tda8290_easy_mode = 0x02; |
126 | mode = "B"; | |
c7919d52 | 127 | } else if (params->std & V4L2_STD_GH) { |
910bb3e3 MK |
128 | priv->tda8290_easy_mode = 0x04; |
129 | mode = "GH"; | |
c7919d52 | 130 | } else if (params->std & V4L2_STD_PAL_I) { |
910bb3e3 MK |
131 | priv->tda8290_easy_mode = 0x08; |
132 | mode = "I"; | |
c7919d52 | 133 | } else if (params->std & V4L2_STD_DK) { |
910bb3e3 MK |
134 | priv->tda8290_easy_mode = 0x10; |
135 | mode = "DK"; | |
c7919d52 | 136 | } else if (params->std & V4L2_STD_SECAM_L) { |
910bb3e3 MK |
137 | priv->tda8290_easy_mode = 0x20; |
138 | mode = "L"; | |
c7919d52 | 139 | } else if (params->std & V4L2_STD_SECAM_LC) { |
910bb3e3 MK |
140 | priv->tda8290_easy_mode = 0x40; |
141 | mode = "LC"; | |
142 | } else { | |
910bb3e3 MK |
143 | priv->tda8290_easy_mode = 0x10; |
144 | mode = "xx"; | |
145 | } | |
146 | ||
9af0ef27 | 147 | if (params->mode == V4L2_TUNER_RADIO) { |
3f76cf8c MK |
148 | /* Set TDA8295 to FM radio; Start TDA8290 with MN values */ |
149 | priv->tda8290_easy_mode = (priv->ver & TDA8295) ? 0x80 : 0x01; | |
9af0ef27 MCC |
150 | tuner_dbg("setting to radio FM\n"); |
151 | } else { | |
152 | tuner_dbg("setting tda829x to system %s\n", mode); | |
153 | } | |
910bb3e3 MK |
154 | } |
155 | ||
4c27f1a4 | 156 | static struct { |
9af0ef27 MCC |
157 | unsigned char seq[2]; |
158 | } fm_mode[] = { | |
159 | { { 0x01, 0x81} }, /* Put device into expert mode */ | |
160 | { { 0x03, 0x48} }, /* Disable NOTCH and VIDEO filters */ | |
161 | { { 0x04, 0x04} }, /* Disable color carrier filter (SSIF) */ | |
162 | { { 0x05, 0x04} }, /* ADC headroom */ | |
163 | { { 0x06, 0x10} }, /* group delay flat */ | |
164 | ||
165 | { { 0x07, 0x00} }, /* use the same radio DTO values as a tda8295 */ | |
166 | { { 0x08, 0x00} }, | |
167 | { { 0x09, 0x80} }, | |
168 | { { 0x0a, 0xda} }, | |
169 | { { 0x0b, 0x4b} }, | |
170 | { { 0x0c, 0x68} }, | |
171 | ||
172 | { { 0x0d, 0x00} }, /* PLL off, no video carrier detect */ | |
173 | { { 0x14, 0x00} }, /* disable auto mute if no video */ | |
174 | }; | |
175 | ||
c7919d52 MK |
176 | static void tda8290_set_params(struct dvb_frontend *fe, |
177 | struct analog_parameters *params) | |
910bb3e3 | 178 | { |
4e9154b8 | 179 | struct tda8290_priv *priv = fe->analog_demod_priv; |
4e9154b8 | 180 | |
de48eebc | 181 | unsigned char soft_reset[] = { 0x00, 0x00 }; |
b2083199 | 182 | unsigned char easy_mode[] = { 0x01, priv->tda8290_easy_mode }; |
de48eebc | 183 | unsigned char expert_mode[] = { 0x01, 0x80 }; |
0157a9cc | 184 | unsigned char agc_out_on[] = { 0x02, 0x00 }; |
de48eebc HH |
185 | unsigned char gainset_off[] = { 0x28, 0x14 }; |
186 | unsigned char if_agc_spd[] = { 0x0f, 0x88 }; | |
187 | unsigned char adc_head_6[] = { 0x05, 0x04 }; | |
188 | unsigned char adc_head_9[] = { 0x05, 0x02 }; | |
189 | unsigned char adc_head_12[] = { 0x05, 0x01 }; | |
190 | unsigned char pll_bw_nom[] = { 0x0d, 0x47 }; | |
191 | unsigned char pll_bw_low[] = { 0x0d, 0x27 }; | |
192 | unsigned char gainset_2[] = { 0x28, 0x64 }; | |
193 | unsigned char agc_rst_on[] = { 0x0e, 0x0b }; | |
194 | unsigned char agc_rst_off[] = { 0x0e, 0x09 }; | |
195 | unsigned char if_agc_set[] = { 0x0f, 0x81 }; | |
196 | unsigned char addr_adc_sat = 0x1a; | |
197 | unsigned char addr_agc_stat = 0x1d; | |
198 | unsigned char addr_pll_stat = 0x1b; | |
199 | unsigned char adc_sat, agc_stat, | |
9a741ec9 | 200 | pll_stat; |
58ef4f92 | 201 | int i; |
de48eebc | 202 | |
c7919d52 | 203 | set_audio(fe, params); |
910bb3e3 | 204 | |
ab166050 | 205 | if (priv->cfg.config) |
7bff4b4d | 206 | tuner_dbg("tda827xa config is 0x%02x\n", priv->cfg.config); |
db8a6956 MK |
207 | tuner_i2c_xfer_send(&priv->i2c_props, easy_mode, 2); |
208 | tuner_i2c_xfer_send(&priv->i2c_props, agc_out_on, 2); | |
209 | tuner_i2c_xfer_send(&priv->i2c_props, soft_reset, 2); | |
de48eebc HH |
210 | msleep(1); |
211 | ||
9af0ef27 | 212 | if (params->mode == V4L2_TUNER_RADIO) { |
9af0ef27 MCC |
213 | unsigned char deemphasis[] = { 0x13, 1 }; |
214 | ||
215 | /* FIXME: allow using a different deemphasis */ | |
216 | ||
217 | if (deemphasis_50) | |
218 | deemphasis[1] = 2; | |
219 | ||
220 | for (i = 0; i < ARRAY_SIZE(fm_mode); i++) | |
221 | tuner_i2c_xfer_send(&priv->i2c_props, fm_mode[i].seq, 2); | |
222 | ||
223 | tuner_i2c_xfer_send(&priv->i2c_props, deemphasis, 2); | |
224 | } else { | |
225 | expert_mode[1] = priv->tda8290_easy_mode + 0x80; | |
226 | tuner_i2c_xfer_send(&priv->i2c_props, expert_mode, 2); | |
227 | tuner_i2c_xfer_send(&priv->i2c_props, gainset_off, 2); | |
228 | tuner_i2c_xfer_send(&priv->i2c_props, if_agc_spd, 2); | |
229 | if (priv->tda8290_easy_mode & 0x60) | |
230 | tuner_i2c_xfer_send(&priv->i2c_props, adc_head_9, 2); | |
231 | else | |
232 | tuner_i2c_xfer_send(&priv->i2c_props, adc_head_6, 2); | |
233 | tuner_i2c_xfer_send(&priv->i2c_props, pll_bw_nom, 2); | |
234 | } | |
de48eebc | 235 | |
4e9154b8 | 236 | tda8290_i2c_bridge(fe, 1); |
746d9732 | 237 | |
4e9154b8 | 238 | if (fe->ops.tuner_ops.set_analog_params) |
c7919d52 | 239 | fe->ops.tuner_ops.set_analog_params(fe, params); |
746d9732 | 240 | |
58ef4f92 | 241 | for (i = 0; i < 3; i++) { |
db8a6956 MK |
242 | tuner_i2c_xfer_send(&priv->i2c_props, &addr_pll_stat, 1); |
243 | tuner_i2c_xfer_recv(&priv->i2c_props, &pll_stat, 1); | |
58ef4f92 | 244 | if (pll_stat & 0x80) { |
db8a6956 MK |
245 | tuner_i2c_xfer_send(&priv->i2c_props, &addr_adc_sat, 1); |
246 | tuner_i2c_xfer_recv(&priv->i2c_props, &adc_sat, 1); | |
247 | tuner_i2c_xfer_send(&priv->i2c_props, &addr_agc_stat, 1); | |
248 | tuner_i2c_xfer_recv(&priv->i2c_props, &agc_stat, 1); | |
58ef4f92 HH |
249 | tuner_dbg("tda8290 is locked, AGC: %d\n", agc_stat); |
250 | break; | |
251 | } else { | |
252 | tuner_dbg("tda8290 not locked, no signal?\n"); | |
253 | msleep(100); | |
254 | } | |
255 | } | |
de48eebc | 256 | /* adjust headroom resp. gain */ |
4ac95af9 HH |
257 | if ((agc_stat > 115) || (!(pll_stat & 0x80) && (adc_sat < 20))) { |
258 | tuner_dbg("adjust gain, step 1. Agc: %d, ADC stat: %d, lock: %d\n", | |
259 | agc_stat, adc_sat, pll_stat & 0x80); | |
db8a6956 | 260 | tuner_i2c_xfer_send(&priv->i2c_props, gainset_2, 2); |
de48eebc | 261 | msleep(100); |
db8a6956 MK |
262 | tuner_i2c_xfer_send(&priv->i2c_props, &addr_agc_stat, 1); |
263 | tuner_i2c_xfer_recv(&priv->i2c_props, &agc_stat, 1); | |
264 | tuner_i2c_xfer_send(&priv->i2c_props, &addr_pll_stat, 1); | |
265 | tuner_i2c_xfer_recv(&priv->i2c_props, &pll_stat, 1); | |
de48eebc | 266 | if ((agc_stat > 115) || !(pll_stat & 0x80)) { |
4ac95af9 HH |
267 | tuner_dbg("adjust gain, step 2. Agc: %d, lock: %d\n", |
268 | agc_stat, pll_stat & 0x80); | |
746d9732 | 269 | if (priv->cfg.agcf) |
4e9154b8 | 270 | priv->cfg.agcf(fe); |
de48eebc | 271 | msleep(100); |
db8a6956 MK |
272 | tuner_i2c_xfer_send(&priv->i2c_props, &addr_agc_stat, 1); |
273 | tuner_i2c_xfer_recv(&priv->i2c_props, &agc_stat, 1); | |
274 | tuner_i2c_xfer_send(&priv->i2c_props, &addr_pll_stat, 1); | |
275 | tuner_i2c_xfer_recv(&priv->i2c_props, &pll_stat, 1); | |
de48eebc HH |
276 | if((agc_stat > 115) || !(pll_stat & 0x80)) { |
277 | tuner_dbg("adjust gain, step 3. Agc: %d\n", agc_stat); | |
db8a6956 MK |
278 | tuner_i2c_xfer_send(&priv->i2c_props, adc_head_12, 2); |
279 | tuner_i2c_xfer_send(&priv->i2c_props, pll_bw_low, 2); | |
de48eebc HH |
280 | msleep(100); |
281 | } | |
282 | } | |
283 | } | |
1da177e4 | 284 | |
de48eebc | 285 | /* l/ l' deadlock? */ |
b2083199 | 286 | if(priv->tda8290_easy_mode & 0x60) { |
db8a6956 MK |
287 | tuner_i2c_xfer_send(&priv->i2c_props, &addr_adc_sat, 1); |
288 | tuner_i2c_xfer_recv(&priv->i2c_props, &adc_sat, 1); | |
289 | tuner_i2c_xfer_send(&priv->i2c_props, &addr_pll_stat, 1); | |
290 | tuner_i2c_xfer_recv(&priv->i2c_props, &pll_stat, 1); | |
de48eebc | 291 | if ((adc_sat > 20) || !(pll_stat & 0x80)) { |
4ac95af9 | 292 | tuner_dbg("trying to resolve SECAM L deadlock\n"); |
db8a6956 | 293 | tuner_i2c_xfer_send(&priv->i2c_props, agc_rst_on, 2); |
de48eebc | 294 | msleep(40); |
db8a6956 | 295 | tuner_i2c_xfer_send(&priv->i2c_props, agc_rst_off, 2); |
de48eebc HH |
296 | } |
297 | } | |
586b0cab | 298 | |
4e9154b8 | 299 | tda8290_i2c_bridge(fe, 0); |
db8a6956 | 300 | tuner_i2c_xfer_send(&priv->i2c_props, if_agc_set, 2); |
1da177e4 LT |
301 | } |
302 | ||
de48eebc HH |
303 | /*---------------------------------------------------------------------*/ |
304 | ||
4e9154b8 | 305 | static void tda8295_power(struct dvb_frontend *fe, int enable) |
5bea1cd3 | 306 | { |
4e9154b8 | 307 | struct tda8290_priv *priv = fe->analog_demod_priv; |
5bea1cd3 MK |
308 | unsigned char buf[] = { 0x30, 0x00 }; /* clb_stdbt */ |
309 | ||
310 | tuner_i2c_xfer_send(&priv->i2c_props, &buf[0], 1); | |
311 | tuner_i2c_xfer_recv(&priv->i2c_props, &buf[1], 1); | |
312 | ||
313 | if (enable) | |
314 | buf[1] = 0x01; | |
315 | else | |
316 | buf[1] = 0x03; | |
317 | ||
318 | tuner_i2c_xfer_send(&priv->i2c_props, buf, 2); | |
319 | } | |
320 | ||
4e9154b8 | 321 | static void tda8295_set_easy_mode(struct dvb_frontend *fe, int enable) |
5bea1cd3 | 322 | { |
4e9154b8 | 323 | struct tda8290_priv *priv = fe->analog_demod_priv; |
5bea1cd3 MK |
324 | unsigned char buf[] = { 0x01, 0x00 }; |
325 | ||
326 | tuner_i2c_xfer_send(&priv->i2c_props, &buf[0], 1); | |
327 | tuner_i2c_xfer_recv(&priv->i2c_props, &buf[1], 1); | |
328 | ||
329 | if (enable) | |
330 | buf[1] = 0x01; /* rising edge sets regs 0x02 - 0x23 */ | |
331 | else | |
332 | buf[1] = 0x00; /* reset active bit */ | |
333 | ||
334 | tuner_i2c_xfer_send(&priv->i2c_props, buf, 2); | |
335 | } | |
336 | ||
4e9154b8 | 337 | static void tda8295_set_video_std(struct dvb_frontend *fe) |
5bea1cd3 | 338 | { |
4e9154b8 | 339 | struct tda8290_priv *priv = fe->analog_demod_priv; |
5bea1cd3 MK |
340 | unsigned char buf[] = { 0x00, priv->tda8290_easy_mode }; |
341 | ||
342 | tuner_i2c_xfer_send(&priv->i2c_props, buf, 2); | |
343 | ||
4e9154b8 | 344 | tda8295_set_easy_mode(fe, 1); |
5bea1cd3 | 345 | msleep(20); |
4e9154b8 | 346 | tda8295_set_easy_mode(fe, 0); |
5bea1cd3 MK |
347 | } |
348 | ||
349 | /*---------------------------------------------------------------------*/ | |
350 | ||
4e9154b8 | 351 | static void tda8295_agc1_out(struct dvb_frontend *fe, int enable) |
5bea1cd3 | 352 | { |
4e9154b8 | 353 | struct tda8290_priv *priv = fe->analog_demod_priv; |
5bea1cd3 MK |
354 | unsigned char buf[] = { 0x02, 0x00 }; /* DIV_FUNC */ |
355 | ||
356 | tuner_i2c_xfer_send(&priv->i2c_props, &buf[0], 1); | |
357 | tuner_i2c_xfer_recv(&priv->i2c_props, &buf[1], 1); | |
358 | ||
359 | if (enable) | |
360 | buf[1] &= ~0x40; | |
361 | else | |
362 | buf[1] |= 0x40; | |
363 | ||
364 | tuner_i2c_xfer_send(&priv->i2c_props, buf, 2); | |
365 | } | |
366 | ||
4e9154b8 | 367 | static void tda8295_agc2_out(struct dvb_frontend *fe, int enable) |
5bea1cd3 | 368 | { |
4e9154b8 | 369 | struct tda8290_priv *priv = fe->analog_demod_priv; |
5bea1cd3 MK |
370 | unsigned char set_gpio_cf[] = { 0x44, 0x00 }; |
371 | unsigned char set_gpio_val[] = { 0x46, 0x00 }; | |
372 | ||
373 | tuner_i2c_xfer_send(&priv->i2c_props, &set_gpio_cf[0], 1); | |
374 | tuner_i2c_xfer_recv(&priv->i2c_props, &set_gpio_cf[1], 1); | |
375 | tuner_i2c_xfer_send(&priv->i2c_props, &set_gpio_val[0], 1); | |
376 | tuner_i2c_xfer_recv(&priv->i2c_props, &set_gpio_val[1], 1); | |
377 | ||
378 | set_gpio_cf[1] &= 0xf0; /* clear GPIO_0 bits 3-0 */ | |
379 | ||
380 | if (enable) { | |
381 | set_gpio_cf[1] |= 0x01; /* config GPIO_0 as Open Drain Out */ | |
382 | set_gpio_val[1] &= 0xfe; /* set GPIO_0 pin low */ | |
383 | } | |
384 | tuner_i2c_xfer_send(&priv->i2c_props, set_gpio_cf, 2); | |
385 | tuner_i2c_xfer_send(&priv->i2c_props, set_gpio_val, 2); | |
386 | } | |
387 | ||
4e9154b8 | 388 | static int tda8295_has_signal(struct dvb_frontend *fe) |
5bea1cd3 | 389 | { |
4e9154b8 | 390 | struct tda8290_priv *priv = fe->analog_demod_priv; |
5bea1cd3 MK |
391 | |
392 | unsigned char hvpll_stat = 0x26; | |
393 | unsigned char ret; | |
394 | ||
395 | tuner_i2c_xfer_send(&priv->i2c_props, &hvpll_stat, 1); | |
396 | tuner_i2c_xfer_recv(&priv->i2c_props, &ret, 1); | |
397 | return (ret & 0x01) ? 65535 : 0; | |
398 | } | |
399 | ||
400 | /*---------------------------------------------------------------------*/ | |
401 | ||
c7919d52 MK |
402 | static void tda8295_set_params(struct dvb_frontend *fe, |
403 | struct analog_parameters *params) | |
5bea1cd3 | 404 | { |
4e9154b8 | 405 | struct tda8290_priv *priv = fe->analog_demod_priv; |
5bea1cd3 MK |
406 | |
407 | unsigned char blanking_mode[] = { 0x1d, 0x00 }; | |
408 | ||
c7919d52 | 409 | set_audio(fe, params); |
5bea1cd3 | 410 | |
7e28adb2 | 411 | tuner_dbg("%s: freq = %d\n", __func__, params->frequency); |
5bea1cd3 | 412 | |
4e9154b8 MK |
413 | tda8295_power(fe, 1); |
414 | tda8295_agc1_out(fe, 1); | |
5bea1cd3 MK |
415 | |
416 | tuner_i2c_xfer_send(&priv->i2c_props, &blanking_mode[0], 1); | |
417 | tuner_i2c_xfer_recv(&priv->i2c_props, &blanking_mode[1], 1); | |
418 | ||
4e9154b8 | 419 | tda8295_set_video_std(fe); |
5bea1cd3 MK |
420 | |
421 | blanking_mode[1] = 0x03; | |
422 | tuner_i2c_xfer_send(&priv->i2c_props, blanking_mode, 2); | |
423 | msleep(20); | |
424 | ||
4e9154b8 | 425 | tda8295_i2c_bridge(fe, 1); |
5bea1cd3 | 426 | |
4e9154b8 | 427 | if (fe->ops.tuner_ops.set_analog_params) |
c7919d52 | 428 | fe->ops.tuner_ops.set_analog_params(fe, params); |
5bea1cd3 MK |
429 | |
430 | if (priv->cfg.agcf) | |
4e9154b8 | 431 | priv->cfg.agcf(fe); |
5bea1cd3 | 432 | |
4e9154b8 | 433 | if (tda8295_has_signal(fe)) |
5bea1cd3 MK |
434 | tuner_dbg("tda8295 is locked\n"); |
435 | else | |
436 | tuner_dbg("tda8295 not locked, no signal?\n"); | |
437 | ||
4e9154b8 | 438 | tda8295_i2c_bridge(fe, 0); |
5bea1cd3 MK |
439 | } |
440 | ||
441 | /*---------------------------------------------------------------------*/ | |
442 | ||
4e9154b8 | 443 | static int tda8290_has_signal(struct dvb_frontend *fe) |
1da177e4 | 444 | { |
4e9154b8 | 445 | struct tda8290_priv *priv = fe->analog_demod_priv; |
1da177e4 | 446 | |
910bb3e3 MK |
447 | unsigned char i2c_get_afc[1] = { 0x1B }; |
448 | unsigned char afc = 0; | |
1da177e4 | 449 | |
910bb3e3 MK |
450 | tuner_i2c_xfer_send(&priv->i2c_props, i2c_get_afc, ARRAY_SIZE(i2c_get_afc)); |
451 | tuner_i2c_xfer_recv(&priv->i2c_props, &afc, 1); | |
746d9732 | 452 | return (afc & 0x80)? 65535:0; |
1da177e4 LT |
453 | } |
454 | ||
de48eebc HH |
455 | /*---------------------------------------------------------------------*/ |
456 | ||
4e9154b8 | 457 | static void tda8290_standby(struct dvb_frontend *fe) |
793cf9e6 | 458 | { |
4e9154b8 MK |
459 | struct tda8290_priv *priv = fe->analog_demod_priv; |
460 | ||
de48eebc HH |
461 | unsigned char cb1[] = { 0x30, 0xD0 }; |
462 | unsigned char tda8290_standby[] = { 0x00, 0x02 }; | |
0157a9cc | 463 | unsigned char tda8290_agc_tri[] = { 0x02, 0x20 }; |
b2083199 | 464 | struct i2c_msg msg = {.addr = priv->tda827x_addr, .flags=0, .buf=cb1, .len = 2}; |
de48eebc | 465 | |
4e9154b8 | 466 | tda8290_i2c_bridge(fe, 1); |
8c125f2c | 467 | if (priv->ver & TDA8275A) |
de48eebc | 468 | cb1[1] = 0x90; |
db8a6956 | 469 | i2c_transfer(priv->i2c_props.adap, &msg, 1); |
4e9154b8 | 470 | tda8290_i2c_bridge(fe, 0); |
db8a6956 MK |
471 | tuner_i2c_xfer_send(&priv->i2c_props, tda8290_agc_tri, 2); |
472 | tuner_i2c_xfer_send(&priv->i2c_props, tda8290_standby, 2); | |
793cf9e6 MCC |
473 | } |
474 | ||
4e9154b8 | 475 | static void tda8295_standby(struct dvb_frontend *fe) |
5bea1cd3 | 476 | { |
4e9154b8 | 477 | tda8295_agc1_out(fe, 0); /* Put AGC in tri-state */ |
5bea1cd3 | 478 | |
4e9154b8 | 479 | tda8295_power(fe, 0); |
5bea1cd3 MK |
480 | } |
481 | ||
4e9154b8 | 482 | static void tda8290_init_if(struct dvb_frontend *fe) |
de48eebc | 483 | { |
4e9154b8 | 484 | struct tda8290_priv *priv = fe->analog_demod_priv; |
db8a6956 | 485 | |
de48eebc | 486 | unsigned char set_VS[] = { 0x30, 0x6F }; |
58ef4f92 | 487 | unsigned char set_GP00_CF[] = { 0x20, 0x01 }; |
de48eebc HH |
488 | unsigned char set_GP01_CF[] = { 0x20, 0x0B }; |
489 | ||
7bff4b4d | 490 | if ((priv->cfg.config == 1) || (priv->cfg.config == 2)) |
db8a6956 | 491 | tuner_i2c_xfer_send(&priv->i2c_props, set_GP00_CF, 2); |
58ef4f92 | 492 | else |
db8a6956 MK |
493 | tuner_i2c_xfer_send(&priv->i2c_props, set_GP01_CF, 2); |
494 | tuner_i2c_xfer_send(&priv->i2c_props, set_VS, 2); | |
de48eebc HH |
495 | } |
496 | ||
4e9154b8 | 497 | static void tda8295_init_if(struct dvb_frontend *fe) |
5bea1cd3 | 498 | { |
4e9154b8 | 499 | struct tda8290_priv *priv = fe->analog_demod_priv; |
5bea1cd3 MK |
500 | |
501 | static unsigned char set_adc_ctl[] = { 0x33, 0x14 }; | |
502 | static unsigned char set_adc_ctl2[] = { 0x34, 0x00 }; | |
503 | static unsigned char set_pll_reg6[] = { 0x3e, 0x63 }; | |
504 | static unsigned char set_pll_reg0[] = { 0x38, 0x23 }; | |
505 | static unsigned char set_pll_reg7[] = { 0x3f, 0x01 }; | |
506 | static unsigned char set_pll_reg10[] = { 0x42, 0x61 }; | |
507 | static unsigned char set_gpio_reg0[] = { 0x44, 0x0b }; | |
508 | ||
4e9154b8 | 509 | tda8295_power(fe, 1); |
5bea1cd3 | 510 | |
4e9154b8 MK |
511 | tda8295_set_easy_mode(fe, 0); |
512 | tda8295_set_video_std(fe); | |
5bea1cd3 MK |
513 | |
514 | tuner_i2c_xfer_send(&priv->i2c_props, set_adc_ctl, 2); | |
515 | tuner_i2c_xfer_send(&priv->i2c_props, set_adc_ctl2, 2); | |
516 | tuner_i2c_xfer_send(&priv->i2c_props, set_pll_reg6, 2); | |
517 | tuner_i2c_xfer_send(&priv->i2c_props, set_pll_reg0, 2); | |
518 | tuner_i2c_xfer_send(&priv->i2c_props, set_pll_reg7, 2); | |
519 | tuner_i2c_xfer_send(&priv->i2c_props, set_pll_reg10, 2); | |
520 | tuner_i2c_xfer_send(&priv->i2c_props, set_gpio_reg0, 2); | |
521 | ||
4e9154b8 MK |
522 | tda8295_agc1_out(fe, 0); |
523 | tda8295_agc2_out(fe, 0); | |
5bea1cd3 MK |
524 | } |
525 | ||
4e9154b8 | 526 | static void tda8290_init_tuner(struct dvb_frontend *fe) |
1da177e4 | 527 | { |
4e9154b8 | 528 | struct tda8290_priv *priv = fe->analog_demod_priv; |
de48eebc | 529 | unsigned char tda8275_init[] = { 0x00, 0x00, 0x00, 0x40, 0xdC, 0x04, 0xAf, |
9a741ec9 | 530 | 0x3F, 0x2A, 0x04, 0xFF, 0x00, 0x00, 0x40 }; |
de48eebc | 531 | unsigned char tda8275a_init[] = { 0x00, 0x00, 0x00, 0x00, 0xdC, 0x05, 0x8b, |
9a741ec9 | 532 | 0x0c, 0x04, 0x20, 0xFF, 0x00, 0x00, 0x4b }; |
b2083199 | 533 | struct i2c_msg msg = {.addr = priv->tda827x_addr, .flags=0, |
c2f6f9d8 | 534 | .buf=tda8275_init, .len = 14}; |
8c125f2c | 535 | if (priv->ver & TDA8275A) |
de48eebc HH |
536 | msg.buf = tda8275a_init; |
537 | ||
4e9154b8 | 538 | tda8290_i2c_bridge(fe, 1); |
db8a6956 | 539 | i2c_transfer(priv->i2c_props.adap, &msg, 1); |
4e9154b8 | 540 | tda8290_i2c_bridge(fe, 0); |
de48eebc HH |
541 | } |
542 | ||
543 | /*---------------------------------------------------------------------*/ | |
1da177e4 | 544 | |
4e9154b8 | 545 | static void tda829x_release(struct dvb_frontend *fe) |
024cf530 | 546 | { |
a4f263b5 MK |
547 | struct tda8290_priv *priv = fe->analog_demod_priv; |
548 | ||
006ed1ec MK |
549 | /* only try to release the tuner if we've |
550 | * attached it from within this module */ | |
551 | if (priv->ver & (TDA18271 | TDA8275 | TDA8275A)) | |
a4f263b5 MK |
552 | if (fe->ops.tuner_ops.release) |
553 | fe->ops.tuner_ops.release(fe); | |
024cf530 | 554 | |
4e9154b8 MK |
555 | kfree(fe->analog_demod_priv); |
556 | fe->analog_demod_priv = NULL; | |
910bb3e3 MK |
557 | } |
558 | ||
f21e0d7f MK |
559 | static struct tda18271_config tda829x_tda18271_config = { |
560 | .gate = TDA18271_GATE_ANALOG, | |
561 | }; | |
562 | ||
8c125f2c | 563 | static int tda829x_find_tuner(struct dvb_frontend *fe) |
de48eebc | 564 | { |
8c125f2c | 565 | struct tda8290_priv *priv = fe->analog_demod_priv; |
bc3e5c7f | 566 | struct analog_demod_ops *analog_ops = &fe->ops.analog_ops; |
de48eebc HH |
567 | int i, ret, tuners_found; |
568 | u32 tuner_addrs; | |
8c125f2c MK |
569 | u8 data; |
570 | struct i2c_msg msg = { .flags = I2C_M_RD, .buf = &data, .len = 1 }; | |
de48eebc | 571 | |
31063814 MCC |
572 | if (!analog_ops->i2c_gate_ctrl) { |
573 | printk(KERN_ERR "tda8290: no gate control were provided!\n"); | |
574 | ||
8c125f2c | 575 | return -EINVAL; |
31063814 | 576 | } |
746d9732 | 577 | |
bc3e5c7f | 578 | analog_ops->i2c_gate_ctrl(fe, 1); |
db8a6956 | 579 | |
de48eebc HH |
580 | /* probe for tuner chip */ |
581 | tuners_found = 0; | |
582 | tuner_addrs = 0; | |
8c125f2c | 583 | for (i = 0x60; i <= 0x63; i++) { |
de48eebc | 584 | msg.addr = i; |
db8a6956 | 585 | ret = i2c_transfer(priv->i2c_props.adap, &msg, 1); |
de48eebc HH |
586 | if (ret == 1) { |
587 | tuners_found++; | |
588 | tuner_addrs = (tuner_addrs << 8) + i; | |
589 | } | |
590 | } | |
591 | /* if there is more than one tuner, we expect the right one is | |
592 | behind the bridge and we choose the highest address that doesn't | |
593 | give a response now | |
594 | */ | |
8c125f2c | 595 | |
bc3e5c7f | 596 | analog_ops->i2c_gate_ctrl(fe, 0); |
8c125f2c MK |
597 | |
598 | if (tuners_found > 1) | |
de48eebc HH |
599 | for (i = 0; i < tuners_found; i++) { |
600 | msg.addr = tuner_addrs & 0xff; | |
db8a6956 | 601 | ret = i2c_transfer(priv->i2c_props.adap, &msg, 1); |
8c125f2c | 602 | if (ret == 1) |
de48eebc HH |
603 | tuner_addrs = tuner_addrs >> 8; |
604 | else | |
605 | break; | |
606 | } | |
8c125f2c | 607 | |
de48eebc | 608 | if (tuner_addrs == 0) { |
8c125f2c MK |
609 | tuner_addrs = 0x60; |
610 | tuner_info("could not clearly identify tuner address, " | |
611 | "defaulting to %x\n", tuner_addrs); | |
de48eebc HH |
612 | } else { |
613 | tuner_addrs = tuner_addrs & 0xff; | |
910bb3e3 | 614 | tuner_info("setting tuner address to %x\n", tuner_addrs); |
de48eebc | 615 | } |
b2083199 | 616 | priv->tda827x_addr = tuner_addrs; |
de48eebc HH |
617 | msg.addr = tuner_addrs; |
618 | ||
bc3e5c7f | 619 | analog_ops->i2c_gate_ctrl(fe, 1); |
db8a6956 | 620 | ret = i2c_transfer(priv->i2c_props.adap, &msg, 1); |
910bb3e3 | 621 | |
8c125f2c MK |
622 | if (ret != 1) { |
623 | tuner_warn("tuner access failed!\n"); | |
31063814 | 624 | analog_ops->i2c_gate_ctrl(fe, 0); |
8c125f2c | 625 | return -EREMOTEIO; |
de48eebc | 626 | } |
746d9732 | 627 | |
255b5113 | 628 | if ((data == 0x83) || (data == 0x84)) { |
8c125f2c | 629 | priv->ver |= TDA18271; |
adcc4b3e | 630 | tda829x_tda18271_config.config = priv->cfg.config; |
a07c8779 MK |
631 | dvb_attach(tda18271_attach, fe, priv->tda827x_addr, |
632 | priv->i2c_props.adap, &tda829x_tda18271_config); | |
8c125f2c MK |
633 | } else { |
634 | if ((data & 0x3c) == 0) | |
635 | priv->ver |= TDA8275; | |
636 | else | |
637 | priv->ver |= TDA8275A; | |
7fd8b263 | 638 | |
a07c8779 MK |
639 | dvb_attach(tda827x_attach, fe, priv->tda827x_addr, |
640 | priv->i2c_props.adap, &priv->cfg); | |
7bff4b4d | 641 | priv->cfg.switch_addr = priv->i2c_props.addr; |
8c125f2c | 642 | } |
6881647c MK |
643 | if (fe->ops.tuner_ops.init) |
644 | fe->ops.tuner_ops.init(fe); | |
63c25480 | 645 | |
6881647c MK |
646 | if (fe->ops.tuner_ops.sleep) |
647 | fe->ops.tuner_ops.sleep(fe); | |
63c25480 | 648 | |
bc3e5c7f | 649 | analog_ops->i2c_gate_ctrl(fe, 0); |
746d9732 | 650 | |
746d9732 | 651 | return 0; |
1da177e4 | 652 | } |
5bea1cd3 | 653 | |
f1f32849 MK |
654 | static int tda8290_probe(struct tuner_i2c_props *i2c_props) |
655 | { | |
656 | #define TDA8290_ID 0x89 | |
657 | unsigned char tda8290_id[] = { 0x1f, 0x00 }; | |
658 | ||
659 | /* detect tda8290 */ | |
660 | tuner_i2c_xfer_send(i2c_props, &tda8290_id[0], 1); | |
661 | tuner_i2c_xfer_recv(i2c_props, &tda8290_id[1], 1); | |
662 | ||
663 | if (tda8290_id[1] == TDA8290_ID) { | |
ab166050 | 664 | if (debug) |
f1f32849 | 665 | printk(KERN_DEBUG "%s: tda8290 detected @ %d-%04x\n", |
7e28adb2 | 666 | __func__, i2c_adapter_id(i2c_props->adap), |
f1f32849 MK |
667 | i2c_props->addr); |
668 | return 0; | |
669 | } | |
670 | ||
1f3a4e32 | 671 | return -ENODEV; |
f1f32849 MK |
672 | } |
673 | ||
674 | static int tda8295_probe(struct tuner_i2c_props *i2c_props) | |
675 | { | |
676 | #define TDA8295_ID 0x8a | |
19f8a6c3 | 677 | #define TDA8295C2_ID 0x8b |
f1f32849 MK |
678 | unsigned char tda8295_id[] = { 0x2f, 0x00 }; |
679 | ||
680 | /* detect tda8295 */ | |
681 | tuner_i2c_xfer_send(i2c_props, &tda8295_id[0], 1); | |
682 | tuner_i2c_xfer_recv(i2c_props, &tda8295_id[1], 1); | |
683 | ||
19f8a6c3 | 684 | if ((tda8295_id[1] & 0xfe) == TDA8295_ID) { |
ab166050 | 685 | if (debug) |
19f8a6c3 MK |
686 | printk(KERN_DEBUG "%s: %s detected @ %d-%04x\n", |
687 | __func__, (tda8295_id[1] == TDA8295_ID) ? | |
688 | "tda8295c1" : "tda8295c2", | |
689 | i2c_adapter_id(i2c_props->adap), | |
f1f32849 MK |
690 | i2c_props->addr); |
691 | return 0; | |
692 | } | |
693 | ||
1f3a4e32 | 694 | return -ENODEV; |
f1f32849 MK |
695 | } |
696 | ||
bc3e5c7f | 697 | static struct analog_demod_ops tda8290_ops = { |
c7919d52 | 698 | .set_params = tda8290_set_params, |
8c125f2c MK |
699 | .has_signal = tda8290_has_signal, |
700 | .standby = tda8290_standby, | |
701 | .release = tda829x_release, | |
702 | .i2c_gate_ctrl = tda8290_i2c_bridge, | |
703 | }; | |
704 | ||
bc3e5c7f | 705 | static struct analog_demod_ops tda8295_ops = { |
c7919d52 | 706 | .set_params = tda8295_set_params, |
8c125f2c MK |
707 | .has_signal = tda8295_has_signal, |
708 | .standby = tda8295_standby, | |
709 | .release = tda829x_release, | |
710 | .i2c_gate_ctrl = tda8295_i2c_bridge, | |
711 | }; | |
712 | ||
ab166050 MK |
713 | struct dvb_frontend *tda829x_attach(struct dvb_frontend *fe, |
714 | struct i2c_adapter *i2c_adap, u8 i2c_addr, | |
715 | struct tda829x_config *cfg) | |
5bea1cd3 MK |
716 | { |
717 | struct tda8290_priv *priv = NULL; | |
ab166050 | 718 | char *name; |
8c125f2c | 719 | |
5bea1cd3 MK |
720 | priv = kzalloc(sizeof(struct tda8290_priv), GFP_KERNEL); |
721 | if (priv == NULL) | |
ab166050 | 722 | return NULL; |
8c125f2c | 723 | fe->analog_demod_priv = priv; |
5bea1cd3 | 724 | |
ab166050 MK |
725 | priv->i2c_props.addr = i2c_addr; |
726 | priv->i2c_props.adap = i2c_adap; | |
2756665c | 727 | priv->i2c_props.name = "tda829x"; |
d7cba043 | 728 | if (cfg) |
ab166050 | 729 | priv->cfg.config = cfg->lna_cfg; |
5bea1cd3 | 730 | |
f1f32849 | 731 | if (tda8290_probe(&priv->i2c_props) == 0) { |
8c125f2c | 732 | priv->ver = TDA8290; |
bc3e5c7f MK |
733 | memcpy(&fe->ops.analog_ops, &tda8290_ops, |
734 | sizeof(struct analog_demod_ops)); | |
5bea1cd3 | 735 | } |
8c125f2c | 736 | |
f1f32849 | 737 | if (tda8295_probe(&priv->i2c_props) == 0) { |
8c125f2c | 738 | priv->ver = TDA8295; |
bc3e5c7f MK |
739 | memcpy(&fe->ops.analog_ops, &tda8295_ops, |
740 | sizeof(struct analog_demod_ops)); | |
5bea1cd3 | 741 | } |
5bea1cd3 | 742 | |
c9076279 MK |
743 | if ((!(cfg) || (TDA829X_PROBE_TUNER == cfg->probe_tuner)) && |
744 | (tda829x_find_tuner(fe) < 0)) | |
fa746aee | 745 | goto fail; |
5bea1cd3 | 746 | |
ab166050 | 747 | switch (priv->ver) { |
c9076279 MK |
748 | case TDA8290: |
749 | name = "tda8290"; | |
750 | break; | |
751 | case TDA8295: | |
752 | name = "tda8295"; | |
753 | break; | |
ab166050 MK |
754 | case TDA8290 | TDA8275: |
755 | name = "tda8290+75"; | |
756 | break; | |
757 | case TDA8295 | TDA8275: | |
758 | name = "tda8295+75"; | |
759 | break; | |
760 | case TDA8290 | TDA8275A: | |
761 | name = "tda8290+75a"; | |
762 | break; | |
763 | case TDA8295 | TDA8275A: | |
764 | name = "tda8295+75a"; | |
765 | break; | |
766 | case TDA8290 | TDA18271: | |
767 | name = "tda8290+18271"; | |
768 | break; | |
769 | case TDA8295 | TDA18271: | |
770 | name = "tda8295+18271"; | |
771 | break; | |
772 | default: | |
773 | goto fail; | |
774 | } | |
775 | tuner_info("type set to %s\n", name); | |
776 | ||
0f2ce983 MK |
777 | fe->ops.analog_ops.info.name = name; |
778 | ||
8c125f2c | 779 | if (priv->ver & TDA8290) { |
439b72b6 MK |
780 | if (priv->ver & (TDA8275 | TDA8275A)) |
781 | tda8290_init_tuner(fe); | |
8c125f2c MK |
782 | tda8290_init_if(fe); |
783 | } else if (priv->ver & TDA8295) | |
784 | tda8295_init_if(fe); | |
5bea1cd3 | 785 | |
ab166050 | 786 | return fe; |
fa746aee MK |
787 | |
788 | fail: | |
789 | tda829x_release(fe); | |
ab166050 | 790 | return NULL; |
5bea1cd3 | 791 | } |
8c125f2c | 792 | EXPORT_SYMBOL_GPL(tda829x_attach); |
1da177e4 | 793 | |
ab166050 | 794 | int tda829x_probe(struct i2c_adapter *i2c_adap, u8 i2c_addr) |
95736034 | 795 | { |
910bb3e3 | 796 | struct tuner_i2c_props i2c_props = { |
ab166050 MK |
797 | .adap = i2c_adap, |
798 | .addr = i2c_addr, | |
910bb3e3 | 799 | }; |
db8a6956 | 800 | |
44fd06fa HH |
801 | unsigned char soft_reset[] = { 0x00, 0x00 }; |
802 | unsigned char easy_mode_b[] = { 0x01, 0x02 }; | |
803 | unsigned char easy_mode_g[] = { 0x01, 0x04 }; | |
804 | unsigned char restore_9886[] = { 0x00, 0xd6, 0x30 }; | |
95736034 HH |
805 | unsigned char addr_dto_lsb = 0x07; |
806 | unsigned char data; | |
a818e1c8 MK |
807 | #define PROBE_BUFFER_SIZE 8 |
808 | unsigned char buf[PROBE_BUFFER_SIZE]; | |
809 | int i; | |
810 | ||
811 | /* rule out tda9887, which would return the same byte repeatedly */ | |
812 | tuner_i2c_xfer_send(&i2c_props, soft_reset, 1); | |
813 | tuner_i2c_xfer_recv(&i2c_props, buf, PROBE_BUFFER_SIZE); | |
814 | for (i = 1; i < PROBE_BUFFER_SIZE; i++) { | |
bbe1e0ba MK |
815 | if (buf[i] != buf[0]) |
816 | break; | |
a818e1c8 MK |
817 | } |
818 | ||
819 | /* all bytes are equal, not a tda829x - probably a tda9887 */ | |
820 | if (i == PROBE_BUFFER_SIZE) | |
821 | return -ENODEV; | |
95736034 | 822 | |
f1f32849 MK |
823 | if ((tda8290_probe(&i2c_props) == 0) || |
824 | (tda8295_probe(&i2c_props) == 0)) | |
825 | return 0; | |
826 | ||
827 | /* fall back to old probing method */ | |
910bb3e3 MK |
828 | tuner_i2c_xfer_send(&i2c_props, easy_mode_b, 2); |
829 | tuner_i2c_xfer_send(&i2c_props, soft_reset, 2); | |
830 | tuner_i2c_xfer_send(&i2c_props, &addr_dto_lsb, 1); | |
831 | tuner_i2c_xfer_recv(&i2c_props, &data, 1); | |
95736034 | 832 | if (data == 0) { |
910bb3e3 MK |
833 | tuner_i2c_xfer_send(&i2c_props, easy_mode_g, 2); |
834 | tuner_i2c_xfer_send(&i2c_props, soft_reset, 2); | |
835 | tuner_i2c_xfer_send(&i2c_props, &addr_dto_lsb, 1); | |
836 | tuner_i2c_xfer_recv(&i2c_props, &data, 1); | |
95736034 HH |
837 | if (data == 0x7b) { |
838 | return 0; | |
839 | } | |
840 | } | |
910bb3e3 | 841 | tuner_i2c_xfer_send(&i2c_props, restore_9886, 3); |
1f3a4e32 | 842 | return -ENODEV; |
95736034 | 843 | } |
f1f32849 | 844 | EXPORT_SYMBOL_GPL(tda829x_probe); |
910bb3e3 | 845 | |
8c125f2c | 846 | MODULE_DESCRIPTION("Philips/NXP TDA8290/TDA8295 analog IF demodulator driver"); |
5bea1cd3 | 847 | MODULE_AUTHOR("Gerd Knorr, Hartmut Hackmann, Michael Krufky"); |
910bb3e3 MK |
848 | MODULE_LICENSE("GPL"); |
849 | ||
1da177e4 LT |
850 | /* |
851 | * Overrides for Emacs so that we follow Linus's tabbing style. | |
852 | * --------------------------------------------------------------------------- | |
853 | * Local variables: | |
854 | * c-basic-offset: 8 | |
855 | * End: | |
856 | */ |