aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/media/dvb/frontends/tda827x.c61
-rw-r--r--drivers/media/dvb/frontends/tda827x.h3
-rw-r--r--drivers/media/video/tda8290.c20
3 files changed, 57 insertions, 27 deletions
diff --git a/drivers/media/dvb/frontends/tda827x.c b/drivers/media/dvb/frontends/tda827x.c
index 6de1aea02d5..8329d33b517 100644
--- a/drivers/media/dvb/frontends/tda827x.c
+++ b/drivers/media/dvb/frontends/tda827x.c
@@ -38,10 +38,57 @@ struct tda827x_priv {
38 int i2c_addr; 38 int i2c_addr;
39 struct i2c_adapter *i2c_adap; 39 struct i2c_adapter *i2c_adap;
40 struct tda827x_config *cfg; 40 struct tda827x_config *cfg;
41
42 unsigned int sgIF;
43 unsigned char lpsel;
44
41 u32 frequency; 45 u32 frequency;
42 u32 bandwidth; 46 u32 bandwidth;
43}; 47};
44 48
49static void tda827x_set_std(struct dvb_frontend *fe,
50 struct analog_parameters *params)
51{
52 struct tda827x_priv *priv = fe->tuner_priv;
53 char *mode;
54
55 priv->lpsel = 0;
56 if (params->std & V4L2_STD_MN) {
57 priv->sgIF = 92;
58 priv->lpsel = 1;
59 mode = "MN";
60 } else if (params->std & V4L2_STD_B) {
61 priv->sgIF = 108;
62 mode = "B";
63 } else if (params->std & V4L2_STD_GH) {
64 priv->sgIF = 124;
65 mode = "GH";
66 } else if (params->std & V4L2_STD_PAL_I) {
67 priv->sgIF = 124;
68 mode = "I";
69 } else if (params->std & V4L2_STD_DK) {
70 priv->sgIF = 124;
71 mode = "DK";
72 } else if (params->std & V4L2_STD_SECAM_L) {
73 priv->sgIF = 124;
74 mode = "L";
75 } else if (params->std & V4L2_STD_SECAM_LC) {
76 priv->sgIF = 20;
77 mode = "LC";
78 } else {
79 priv->sgIF = 124;
80 mode = "xx";
81 }
82
83 if (params->mode == V4L2_TUNER_RADIO)
84 priv->sgIF = 88; /* if frequency is 5.5 MHz */
85
86 dprintk("setting tda827x to system %s\n", mode);
87}
88
89
90/* ------------------------------------------------------------------ */
91
45struct tda827x_data { 92struct tda827x_data {
46 u32 lomax; 93 u32 lomax;
47 u8 spd; 94 u8 spd;
@@ -189,10 +236,12 @@ static int tda827xo_set_analog_params(struct dvb_frontend *fe,
189 struct i2c_msg msg = { .addr = priv->i2c_addr, .flags = 0 }; 236 struct i2c_msg msg = { .addr = priv->i2c_addr, .flags = 0 };
190 unsigned int freq = params->frequency; 237 unsigned int freq = params->frequency;
191 238
239 tda827x_set_std(fe, params);
240
192 if (params->mode == V4L2_TUNER_RADIO) 241 if (params->mode == V4L2_TUNER_RADIO)
193 freq = freq / 1000; 242 freq = freq / 1000;
194 243
195 N = freq + priv->cfg->sgIF; 244 N = freq + priv->sgIF;
196 245
197 i = 0; 246 i = 0;
198 while (tda827x_table[i].lomax < N * 62500) { 247 while (tda827x_table[i].lomax < N * 62500) {
@@ -207,7 +256,7 @@ static int tda827xo_set_analog_params(struct dvb_frontend *fe,
207 tuner_reg[1] = (unsigned char)(N>>8); 256 tuner_reg[1] = (unsigned char)(N>>8);
208 tuner_reg[2] = (unsigned char) N; 257 tuner_reg[2] = (unsigned char) N;
209 tuner_reg[3] = 0x40; 258 tuner_reg[3] = 0x40;
210 tuner_reg[4] = 0x52 + (priv->cfg->tda827x_lpsel << 5); 259 tuner_reg[4] = 0x52 + (priv->lpsel << 5);
211 tuner_reg[5] = (tda827x_table[i].spd << 6) + 260 tuner_reg[5] = (tda827x_table[i].spd << 6) +
212 (tda827x_table[i].div1p5 << 5) + 261 (tda827x_table[i].div1p5 << 5) +
213 (tda827x_table[i].bs << 3) + tda827x_table[i].bp; 262 (tda827x_table[i].bs << 3) + tda827x_table[i].bp;
@@ -550,13 +599,15 @@ static int tda827xa_set_analog_params(struct dvb_frontend *fe,
550 .buf = tuner_reg, .len = sizeof(tuner_reg) }; 599 .buf = tuner_reg, .len = sizeof(tuner_reg) };
551 unsigned int freq = params->frequency; 600 unsigned int freq = params->frequency;
552 601
602 tda827x_set_std(fe, params);
603
553 tda827xa_lna_gain(fe, 1, params); 604 tda827xa_lna_gain(fe, 1, params);
554 msleep(10); 605 msleep(10);
555 606
556 if (params->mode == V4L2_TUNER_RADIO) 607 if (params->mode == V4L2_TUNER_RADIO)
557 freq = freq / 1000; 608 freq = freq / 1000;
558 609
559 N = freq + priv->cfg->sgIF; 610 N = freq + priv->sgIF;
560 611
561 i = 0; 612 i = 0;
562 while (tda827xa_analog[i].lomax < N * 62500) { 613 while (tda827xa_analog[i].lomax < N * 62500) {
@@ -587,7 +638,7 @@ static int tda827xa_set_analog_params(struct dvb_frontend *fe,
587 tuner_reg[1] = 0xff; 638 tuner_reg[1] = 0xff;
588 tuner_reg[2] = 0xe0; 639 tuner_reg[2] = 0xe0;
589 tuner_reg[3] = 0; 640 tuner_reg[3] = 0;
590 tuner_reg[4] = 0x99 + (priv->cfg->tda827x_lpsel << 1); 641 tuner_reg[4] = 0x99 + (priv->lpsel << 1);
591 msg.len = 5; 642 msg.len = 5;
592 i2c_transfer(priv->i2c_adap, &msg, 1); 643 i2c_transfer(priv->i2c_adap, &msg, 1);
593 644
@@ -627,7 +678,7 @@ static int tda827xa_set_analog_params(struct dvb_frontend *fe,
627 i2c_transfer(priv->i2c_adap, &msg, 1); 678 i2c_transfer(priv->i2c_adap, &msg, 1);
628 679
629 tuner_reg[0] = 0xc0; 680 tuner_reg[0] = 0xc0;
630 tuner_reg[1] = 0x19 + (priv->cfg->tda827x_lpsel << 1); 681 tuner_reg[1] = 0x19 + (priv->lpsel << 1);
631 i2c_transfer(priv->i2c_adap, &msg, 1); 682 i2c_transfer(priv->i2c_adap, &msg, 1);
632 683
633 priv->frequency = freq * 62500; 684 priv->frequency = freq * 62500;
diff --git a/drivers/media/dvb/frontends/tda827x.h b/drivers/media/dvb/frontends/tda827x.h
index 06626f7af61..92eb65b4012 100644
--- a/drivers/media/dvb/frontends/tda827x.h
+++ b/drivers/media/dvb/frontends/tda827x.h
@@ -35,9 +35,6 @@ struct tda827x_config
35 int (*sleep) (struct dvb_frontend *fe); 35 int (*sleep) (struct dvb_frontend *fe);
36 36
37 /* interface to tda829x driver */ 37 /* interface to tda829x driver */
38 unsigned char tda827x_lpsel;
39 unsigned int sgIF;
40
41 unsigned int *config; 38 unsigned int *config;
42 int (*tuner_callback) (void *dev, int command, int arg); 39 int (*tuner_callback) (void *dev, int command, int arg);
43 40
diff --git a/drivers/media/video/tda8290.c b/drivers/media/video/tda8290.c
index 288865c3c71..1b19b93eabe 100644
--- a/drivers/media/video/tda8290.c
+++ b/drivers/media/video/tda8290.c
@@ -104,45 +104,32 @@ static void set_audio(struct dvb_frontend *fe)
104 struct tuner *t = priv->t; 104 struct tuner *t = priv->t;
105 char* mode; 105 char* mode;
106 106
107 priv->cfg.tda827x_lpsel = 0;
108 if (t->std & V4L2_STD_MN) { 107 if (t->std & V4L2_STD_MN) {
109 priv->cfg.sgIF = 92;
110 priv->tda8290_easy_mode = 0x01; 108 priv->tda8290_easy_mode = 0x01;
111 priv->cfg.tda827x_lpsel = 1;
112 mode = "MN"; 109 mode = "MN";
113 } else if (t->std & V4L2_STD_B) { 110 } else if (t->std & V4L2_STD_B) {
114 priv->cfg.sgIF = 108;
115 priv->tda8290_easy_mode = 0x02; 111 priv->tda8290_easy_mode = 0x02;
116 mode = "B"; 112 mode = "B";
117 } else if (t->std & V4L2_STD_GH) { 113 } else if (t->std & V4L2_STD_GH) {
118 priv->cfg.sgIF = 124;
119 priv->tda8290_easy_mode = 0x04; 114 priv->tda8290_easy_mode = 0x04;
120 mode = "GH"; 115 mode = "GH";
121 } else if (t->std & V4L2_STD_PAL_I) { 116 } else if (t->std & V4L2_STD_PAL_I) {
122 priv->cfg.sgIF = 124;
123 priv->tda8290_easy_mode = 0x08; 117 priv->tda8290_easy_mode = 0x08;
124 mode = "I"; 118 mode = "I";
125 } else if (t->std & V4L2_STD_DK) { 119 } else if (t->std & V4L2_STD_DK) {
126 priv->cfg.sgIF = 124;
127 priv->tda8290_easy_mode = 0x10; 120 priv->tda8290_easy_mode = 0x10;
128 mode = "DK"; 121 mode = "DK";
129 } else if (t->std & V4L2_STD_SECAM_L) { 122 } else if (t->std & V4L2_STD_SECAM_L) {
130 priv->cfg.sgIF = 124;
131 priv->tda8290_easy_mode = 0x20; 123 priv->tda8290_easy_mode = 0x20;
132 mode = "L"; 124 mode = "L";
133 } else if (t->std & V4L2_STD_SECAM_LC) { 125 } else if (t->std & V4L2_STD_SECAM_LC) {
134 priv->cfg.sgIF = 20;
135 priv->tda8290_easy_mode = 0x40; 126 priv->tda8290_easy_mode = 0x40;
136 mode = "LC"; 127 mode = "LC";
137 } else { 128 } else {
138 priv->cfg.sgIF = 124;
139 priv->tda8290_easy_mode = 0x10; 129 priv->tda8290_easy_mode = 0x10;
140 mode = "xx"; 130 mode = "xx";
141 } 131 }
142 132
143 if (t->mode == V4L2_TUNER_RADIO)
144 priv->cfg.sgIF = 88; /* if frequency is 5.5 MHz */
145
146 tuner_dbg("setting tda8290 to system %s\n", mode); 133 tuner_dbg("setting tda8290 to system %s\n", mode);
147} 134}
148 135
@@ -368,7 +355,6 @@ static void tda8295_set_freq(struct dvb_frontend *fe, unsigned int freq)
368{ 355{
369 struct tda8290_priv *priv = fe->analog_demod_priv; 356 struct tda8290_priv *priv = fe->analog_demod_priv;
370 struct tuner *t = priv->t; 357 struct tuner *t = priv->t;
371 u16 ifc;
372 358
373 unsigned char blanking_mode[] = { 0x1d, 0x00 }; 359 unsigned char blanking_mode[] = { 0x1d, 0x00 };
374 360
@@ -381,9 +367,7 @@ static void tda8295_set_freq(struct dvb_frontend *fe, unsigned int freq)
381 367
382 set_audio(fe); 368 set_audio(fe);
383 369
384 ifc = priv->cfg.sgIF; /* FIXME */ 370 tuner_dbg("%s: freq = %d\n", __FUNCTION__, freq);
385
386 tuner_dbg("%s: ifc = %u, freq = %d\n", __FUNCTION__, ifc, freq);
387 371
388 tda8295_power(fe, 1); 372 tda8295_power(fe, 1);
389 tda8295_agc1_out(fe, 1); 373 tda8295_agc1_out(fe, 1);
@@ -625,7 +609,6 @@ int tda8290_attach(struct tuner *t)
625 609
626 tuner_info("type set to %s\n", t->i2c.name); 610 tuner_info("type set to %s\n", t->i2c.name);
627 611
628 priv->cfg.tda827x_lpsel = 0;
629 t->mode = V4L2_TUNER_ANALOG_TV; 612 t->mode = V4L2_TUNER_ANALOG_TV;
630 613
631 tda8290_init_tuner(&t->fe); 614 tda8290_init_tuner(&t->fe);
@@ -715,7 +698,6 @@ int tda8295_attach(struct tuner *t)
715 698
716 t->fe.ops.analog_demod_ops = &tda8295_tuner_ops; 699 t->fe.ops.analog_demod_ops = &tda8295_tuner_ops;
717 700
718 priv->cfg.tda827x_lpsel = 0;
719 t->mode = V4L2_TUNER_ANALOG_TV; 701 t->mode = V4L2_TUNER_ANALOG_TV;
720 702
721 tda8295_init_if(&t->fe); 703 tda8295_init_if(&t->fe);