aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb
diff options
context:
space:
mode:
authorHartmut Birr <e9hack@googlemail.com>2007-04-21 18:44:10 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-04-27 14:45:48 -0400
commitdc120b0734fcc6a4c42c73790a02f2fa74a7a326 (patch)
tree37295c365cfa55169056c3e4abe25af3f06a1674 /drivers/media/dvb
parentaa323ac89c5724de89656fcf31590d19e74594ec (diff)
V4L/DVB (5544): Budget-av: Make inversion setting configurable, add KNC ONE V1.0 card
Make the inversion setting configurable. The KNC ONE V1.0 uses non inverted setting for the inversion and add the KNC ONE V1.0 card. Signed-off-by: Hartmut Birr <e9hack@googlemail.com> Signed-off-by: Oliver Endriss <o.endriss@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/dvb')
-rw-r--r--drivers/media/dvb/frontends/tda10021.c26
-rw-r--r--drivers/media/dvb/frontends/tda1002x.h1
-rw-r--r--drivers/media/dvb/ttpci/budget-av.c2
3 files changed, 19 insertions, 10 deletions
diff --git a/drivers/media/dvb/frontends/tda10021.c b/drivers/media/dvb/frontends/tda10021.c
index 304f1f9b8008..110536843e8e 100644
--- a/drivers/media/dvb/frontends/tda10021.c
+++ b/drivers/media/dvb/frontends/tda10021.c
@@ -53,9 +53,6 @@ struct tda10021_state {
53static int verbose; 53static int verbose;
54 54
55#define XIN 57840000UL 55#define XIN 57840000UL
56#define DISABLE_INVERSION(reg0) do { reg0 |= 0x20; } while (0)
57#define ENABLE_INVERSION(reg0) do { reg0 &= ~0x20; } while (0)
58#define HAS_INVERSION(reg0) (!(reg0 & 0x20))
59 56
60#define FIN (XIN >> 4) 57#define FIN (XIN >> 4)
61 58
@@ -97,7 +94,8 @@ static u8 tda10021_readreg (struct tda10021_state* state, u8 reg)
97 int ret; 94 int ret;
98 95
99 ret = i2c_transfer (state->i2c, msg, 2); 96 ret = i2c_transfer (state->i2c, msg, 2);
100 if (ret != 2) 97 // Don't print an error message if the id is read.
98 if (ret != 2 && reg != 0x1a)
101 printk("DVB: TDA10021: %s: readreg error (ret == %i)\n", 99 printk("DVB: TDA10021: %s: readreg error (ret == %i)\n",
102 __FUNCTION__, ret); 100 __FUNCTION__, ret);
103 return b1[0]; 101 return b1[0];
@@ -136,10 +134,10 @@ static int tda10021_setup_reg0 (struct tda10021_state* state, u8 reg0,
136{ 134{
137 reg0 |= state->reg0 & 0x63; 135 reg0 |= state->reg0 & 0x63;
138 136
139 if (INVERSION_ON == inversion) 137 if ((INVERSION_ON == inversion) ^ (state->config->invert == 0))
140 ENABLE_INVERSION(reg0); 138 reg0 &= ~0x20;
141 else if (INVERSION_OFF == inversion) 139 else
142 DISABLE_INVERSION(reg0); 140 reg0 |= 0x20;
143 141
144 _tda10021_writereg (state, 0x00, reg0 & 0xfe); 142 _tda10021_writereg (state, 0x00, reg0 & 0xfe);
145 _tda10021_writereg (state, 0x00, reg0 | 0x01); 143 _tda10021_writereg (state, 0x00, reg0 | 0x01);
@@ -248,6 +246,9 @@ static int tda10021_set_parameters (struct dvb_frontend *fe,
248 if (qam < 0 || qam > 5) 246 if (qam < 0 || qam > 5)
249 return -EINVAL; 247 return -EINVAL;
250 248
249 if (p->inversion != INVERSION_ON && p->inversion != INVERSION_OFF)
250 return -EINVAL;
251
251 //printk("tda10021: set frequency to %d qam=%d symrate=%d\n", p->frequency,qam,p->u.qam.symbol_rate); 252 //printk("tda10021: set frequency to %d qam=%d symrate=%d\n", p->frequency,qam,p->u.qam.symbol_rate);
252 253
253 if (fe->ops.tuner_ops.set_params) { 254 if (fe->ops.tuner_ops.set_params) {
@@ -356,7 +357,7 @@ static int tda10021_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_pa
356 -((s32)p->u.qam.symbol_rate * afc) >> 10); 357 -((s32)p->u.qam.symbol_rate * afc) >> 10);
357 } 358 }
358 359
359 p->inversion = HAS_INVERSION(state->reg0) ? INVERSION_ON : INVERSION_OFF; 360 p->inversion = ((state->reg0 & 0x20) == 0x20) ^ (state->config->invert != 0) ? INVERSION_ON : INVERSION_OFF;
360 p->u.qam.modulation = ((state->reg0 >> 2) & 7) + QAM_16; 361 p->u.qam.modulation = ((state->reg0 >> 2) & 7) + QAM_16;
361 362
362 p->u.qam.fec_inner = FEC_NONE; 363 p->u.qam.fec_inner = FEC_NONE;
@@ -403,6 +404,7 @@ struct dvb_frontend* tda10021_attach(const struct tda1002x_config* config,
403 u8 pwm) 404 u8 pwm)
404{ 405{
405 struct tda10021_state* state = NULL; 406 struct tda10021_state* state = NULL;
407 u8 id;
406 408
407 /* allocate memory for the internal state */ 409 /* allocate memory for the internal state */
408 state = kmalloc(sizeof(struct tda10021_state), GFP_KERNEL); 410 state = kmalloc(sizeof(struct tda10021_state), GFP_KERNEL);
@@ -415,7 +417,11 @@ struct dvb_frontend* tda10021_attach(const struct tda1002x_config* config,
415 state->reg0 = tda10021_inittab[0]; 417 state->reg0 = tda10021_inittab[0];
416 418
417 /* check if the demod is there */ 419 /* check if the demod is there */
418 if ((tda10021_readreg(state, 0x1a) & 0xf0) != 0x70) goto error; 420 id = tda10021_readreg(state, 0x1a);
421 if ((id & 0xf0) != 0x70) goto error;
422
423 printk("TDA10021: i2c-addr = 0x%02x, id = 0x%02x\n",
424 state->config->demod_address, id);
419 425
420 /* create dvb_frontend */ 426 /* create dvb_frontend */
421 memcpy(&state->frontend.ops, &tda10021_ops, sizeof(struct dvb_frontend_ops)); 427 memcpy(&state->frontend.ops, &tda10021_ops, sizeof(struct dvb_frontend_ops));
diff --git a/drivers/media/dvb/frontends/tda1002x.h b/drivers/media/dvb/frontends/tda1002x.h
index 484935986c54..e9094d8123f6 100644
--- a/drivers/media/dvb/frontends/tda1002x.h
+++ b/drivers/media/dvb/frontends/tda1002x.h
@@ -30,6 +30,7 @@ struct tda1002x_config
30{ 30{
31 /* the demodulator's i2c address */ 31 /* the demodulator's i2c address */
32 u8 demod_address; 32 u8 demod_address;
33 u8 invert;
33}; 34};
34 35
35#if defined(CONFIG_DVB_TDA10021) || (defined(CONFIG_DVB_TDA10021_MODULE) && defined(MODULE)) 36#if defined(CONFIG_DVB_TDA10021) || (defined(CONFIG_DVB_TDA10021_MODULE) && defined(MODULE))
diff --git a/drivers/media/dvb/ttpci/budget-av.c b/drivers/media/dvb/ttpci/budget-av.c
index 5680aa57c93e..0e817d6f1ce5 100644
--- a/drivers/media/dvb/ttpci/budget-av.c
+++ b/drivers/media/dvb/ttpci/budget-av.c
@@ -659,10 +659,12 @@ static int philips_cu1216_tuner_set_params(struct dvb_frontend *fe, struct dvb_f
659 659
660static struct tda1002x_config philips_cu1216_config = { 660static struct tda1002x_config philips_cu1216_config = {
661 .demod_address = 0x0c, 661 .demod_address = 0x0c,
662 .invert = 1,
662}; 663};
663 664
664static struct tda1002x_config philips_cu1216_config_altaddress = { 665static struct tda1002x_config philips_cu1216_config_altaddress = {
665 .demod_address = 0x0d, 666 .demod_address = 0x0d,
667 .invert = 0,
666}; 668};
667 669
668static int philips_tu1216_tuner_init(struct dvb_frontend *fe) 670static int philips_tu1216_tuner_init(struct dvb_frontend *fe)