diff options
author | Michael Krufky <mkrufky@linuxtv.org> | 2007-05-29 21:54:06 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-07-18 13:23:48 -0400 |
commit | b208319993ceff7ebfcc6bb914fe94d29e48a891 (patch) | |
tree | 0a0697806b221c7711914dbdfe2bd3972c206b23 /drivers/media/video/mt20xx.c | |
parent | 56584c9ea9a6dcd672f97ebfeebc4903e8b903bc (diff) |
V4L/DVB (5719): Tuner: Move device-specific private data out of tuner struct
Create private data struct for device specific private data.
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/mt20xx.c')
-rw-r--r-- | drivers/media/video/mt20xx.c | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/drivers/media/video/mt20xx.c b/drivers/media/video/mt20xx.c index 2987c1685da5..d7e68a639cd8 100644 --- a/drivers/media/video/mt20xx.c +++ b/drivers/media/video/mt20xx.c | |||
@@ -37,6 +37,11 @@ static char *microtune_part[] = { | |||
37 | [ MT2050 ] = "MT2050", | 37 | [ MT2050 ] = "MT2050", |
38 | }; | 38 | }; |
39 | 39 | ||
40 | struct microtune_priv { | ||
41 | unsigned int xogc; | ||
42 | unsigned int radio_if2; | ||
43 | }; | ||
44 | |||
40 | // IsSpurInBand()? | 45 | // IsSpurInBand()? |
41 | static int mt2032_spurcheck(struct i2c_client *c, | 46 | static int mt2032_spurcheck(struct i2c_client *c, |
42 | int f1, int f2, int spectrum_from,int spectrum_to) | 47 | int f1, int f2, int spectrum_from,int spectrum_to) |
@@ -218,6 +223,7 @@ static void mt2032_set_if_freq(struct i2c_client *c, unsigned int rfin, | |||
218 | unsigned char buf[21]; | 223 | unsigned char buf[21]; |
219 | int lint_try,ret,sel,lock=0; | 224 | int lint_try,ret,sel,lock=0; |
220 | struct tuner *t = i2c_get_clientdata(c); | 225 | struct tuner *t = i2c_get_clientdata(c); |
226 | struct microtune_priv *priv = t->priv; | ||
221 | 227 | ||
222 | tuner_dbg("mt2032_set_if_freq rfin=%d if1=%d if2=%d from=%d to=%d\n", | 228 | tuner_dbg("mt2032_set_if_freq rfin=%d if1=%d if2=%d from=%d to=%d\n", |
223 | rfin,if1,if2,from,to); | 229 | rfin,if1,if2,from,to); |
@@ -227,7 +233,7 @@ static void mt2032_set_if_freq(struct i2c_client *c, unsigned int rfin, | |||
227 | i2c_master_recv(c,buf,21); | 233 | i2c_master_recv(c,buf,21); |
228 | 234 | ||
229 | buf[0]=0; | 235 | buf[0]=0; |
230 | ret=mt2032_compute_freq(c,rfin,if1,if2,from,to,&buf[1],&sel,t->xogc); | 236 | ret=mt2032_compute_freq(c,rfin,if1,if2,from,to,&buf[1],&sel,priv->xogc); |
231 | if (ret<0) | 237 | if (ret<0) |
232 | return; | 238 | return; |
233 | 239 | ||
@@ -251,10 +257,10 @@ static void mt2032_set_if_freq(struct i2c_client *c, unsigned int rfin, | |||
251 | 257 | ||
252 | tuner_dbg("mt2032: re-init PLLs by LINT\n"); | 258 | tuner_dbg("mt2032: re-init PLLs by LINT\n"); |
253 | buf[0]=7; | 259 | buf[0]=7; |
254 | buf[1]=0x80 +8+t->xogc; // set LINT to re-init PLLs | 260 | buf[1]=0x80 +8+priv->xogc; // set LINT to re-init PLLs |
255 | i2c_master_send(c,buf,2); | 261 | i2c_master_send(c,buf,2); |
256 | mdelay(10); | 262 | mdelay(10); |
257 | buf[1]=8+t->xogc; | 263 | buf[1]=8+priv->xogc; |
258 | i2c_master_send(c,buf,2); | 264 | i2c_master_send(c,buf,2); |
259 | } | 265 | } |
260 | 266 | ||
@@ -294,7 +300,8 @@ static void mt2032_set_tv_freq(struct i2c_client *c, unsigned int freq) | |||
294 | static void mt2032_set_radio_freq(struct i2c_client *c, unsigned int freq) | 300 | static void mt2032_set_radio_freq(struct i2c_client *c, unsigned int freq) |
295 | { | 301 | { |
296 | struct tuner *t = i2c_get_clientdata(c); | 302 | struct tuner *t = i2c_get_clientdata(c); |
297 | int if2 = t->radio_if2; | 303 | struct microtune_priv *priv = t->priv; |
304 | int if2 = priv->radio_if2; | ||
298 | 305 | ||
299 | // per Manual for FM tuning: first if center freq. 1085 MHz | 306 | // per Manual for FM tuning: first if center freq. 1085 MHz |
300 | mt2032_set_if_freq(c, freq * 1000 / 16, | 307 | mt2032_set_if_freq(c, freq * 1000 / 16, |
@@ -305,6 +312,7 @@ static void mt2032_set_radio_freq(struct i2c_client *c, unsigned int freq) | |||
305 | static int mt2032_init(struct i2c_client *c) | 312 | static int mt2032_init(struct i2c_client *c) |
306 | { | 313 | { |
307 | struct tuner *t = i2c_get_clientdata(c); | 314 | struct tuner *t = i2c_get_clientdata(c); |
315 | struct microtune_priv *priv = t->priv; | ||
308 | unsigned char buf[21]; | 316 | unsigned char buf[21]; |
309 | int ret,xogc,xok=0; | 317 | int ret,xogc,xok=0; |
310 | 318 | ||
@@ -351,7 +359,7 @@ static int mt2032_init(struct i2c_client *c) | |||
351 | if (ret!=2) | 359 | if (ret!=2) |
352 | tuner_warn("i2c i/o error: rc == %d (should be 2)\n",ret); | 360 | tuner_warn("i2c i/o error: rc == %d (should be 2)\n",ret); |
353 | } while (xok != 1 ); | 361 | } while (xok != 1 ); |
354 | t->xogc=xogc; | 362 | priv->xogc=xogc; |
355 | 363 | ||
356 | t->set_tv_freq = mt2032_set_tv_freq; | 364 | t->set_tv_freq = mt2032_set_tv_freq; |
357 | t->set_radio_freq = mt2032_set_radio_freq; | 365 | t->set_radio_freq = mt2032_set_radio_freq; |
@@ -456,7 +464,8 @@ static void mt2050_set_tv_freq(struct i2c_client *c, unsigned int freq) | |||
456 | static void mt2050_set_radio_freq(struct i2c_client *c, unsigned int freq) | 464 | static void mt2050_set_radio_freq(struct i2c_client *c, unsigned int freq) |
457 | { | 465 | { |
458 | struct tuner *t = i2c_get_clientdata(c); | 466 | struct tuner *t = i2c_get_clientdata(c); |
459 | int if2 = t->radio_if2; | 467 | struct microtune_priv *priv = t->priv; |
468 | int if2 = priv->radio_if2; | ||
460 | 469 | ||
461 | mt2050_set_if_freq(c, freq * 1000 / 16, if2); | 470 | mt2050_set_if_freq(c, freq * 1000 / 16, if2); |
462 | mt2050_set_antenna(c, radio_antenna); | 471 | mt2050_set_antenna(c, radio_antenna); |
@@ -488,21 +497,29 @@ static int mt2050_init(struct i2c_client *c) | |||
488 | 497 | ||
489 | int microtune_init(struct i2c_client *c) | 498 | int microtune_init(struct i2c_client *c) |
490 | { | 499 | { |
500 | struct microtune_priv *priv = NULL; | ||
491 | struct tuner *t = i2c_get_clientdata(c); | 501 | struct tuner *t = i2c_get_clientdata(c); |
492 | char *name; | 502 | char *name; |
493 | unsigned char buf[21]; | 503 | unsigned char buf[21]; |
494 | int company_code; | 504 | int company_code; |
495 | 505 | ||
506 | priv = kzalloc(sizeof(struct microtune_priv), GFP_KERNEL); | ||
507 | if (priv == NULL) | ||
508 | return -ENOMEM; | ||
509 | t->priv = priv; | ||
510 | |||
511 | priv->radio_if2 = 10700 * 1000; /* 10.7MHz - FM radio */ | ||
512 | |||
496 | memset(buf,0,sizeof(buf)); | 513 | memset(buf,0,sizeof(buf)); |
497 | t->set_tv_freq = NULL; | 514 | t->set_tv_freq = NULL; |
498 | t->set_radio_freq = NULL; | 515 | t->set_radio_freq = NULL; |
499 | t->standby = NULL; | 516 | t->standby = NULL; |
500 | if (t->std & V4L2_STD_525_60) { | 517 | if (t->std & V4L2_STD_525_60) { |
501 | tuner_dbg("pinnacle ntsc\n"); | 518 | tuner_dbg("pinnacle ntsc\n"); |
502 | t->radio_if2 = 41300 * 1000; | 519 | priv->radio_if2 = 41300 * 1000; |
503 | } else { | 520 | } else { |
504 | tuner_dbg("pinnacle pal\n"); | 521 | tuner_dbg("pinnacle pal\n"); |
505 | t->radio_if2 = 33300 * 1000; | 522 | priv->radio_if2 = 33300 * 1000; |
506 | } | 523 | } |
507 | name = "unknown"; | 524 | name = "unknown"; |
508 | 525 | ||