summaryrefslogtreecommitdiff
path: root/linux/drivers/media/dvb/frontends/lgdt330x.c
diff options
context:
space:
mode:
authorMichael Krufky <devnull@localhost>2005-08-11 04:15:14 +0000
committerMichael Krufky <devnull@localhost>2005-08-11 04:15:14 +0000
commit6052566eae6b0898b0c036c70f75f4bcefd29e0e (patch)
tree6168b62552053675297a498cc693516de3899597 /linux/drivers/media/dvb/frontends/lgdt330x.c
parentabd770a29b452f46cbb39ecab21eaf344c396886 (diff)
downloadmediapointer-dvb-s2-6052566eae6b0898b0c036c70f75f4bcefd29e0e.tar.gz
mediapointer-dvb-s2-6052566eae6b0898b0c036c70f75f4bcefd29e0e.tar.bz2
This patch addresses valid objections to experimental code used to
mute the tda9887 when the tuner is used for digital TV reception. That code is removed and replaced by a better solution, which will be implemented in video4linux tree. Signed-off-by: Mac Michaels <wmichaels1@earthlink.net> Signed-off-by: Michael Krufky <mkrufky@m1k.net>
Diffstat (limited to 'linux/drivers/media/dvb/frontends/lgdt330x.c')
-rw-r--r--linux/drivers/media/dvb/frontends/lgdt330x.c81
1 files changed, 23 insertions, 58 deletions
diff --git a/linux/drivers/media/dvb/frontends/lgdt330x.c b/linux/drivers/media/dvb/frontends/lgdt330x.c
index a7a4bed2a..0e21ef1d2 100644
--- a/linux/drivers/media/dvb/frontends/lgdt330x.c
+++ b/linux/drivers/media/dvb/frontends/lgdt330x.c
@@ -69,8 +69,8 @@ struct lgdt330x_state
};
static int i2c_write_demod_bytes (struct lgdt330x_state* state,
- u8 *buf, /* data bytes to send */
- int len /* number of bytes to send */ )
+ u8 *buf, /* data bytes to send */
+ int len /* number of bytes to send */ )
{
struct i2c_msg msg =
{ .addr = state->config->demod_address,
@@ -129,13 +129,13 @@ static int lgdt3302_SwReset(struct lgdt330x_state* state)
};
ret = i2c_write_demod_bytes(state,
- reset, sizeof(reset));
+ reset, sizeof(reset));
if (ret == 0) {
/* force reset high (inactive) and unmask interrupts */
reset[1] = 0x7f;
ret = i2c_write_demod_bytes(state,
- reset, sizeof(reset));
+ reset, sizeof(reset));
}
return ret;
}
@@ -149,13 +149,13 @@ static int lgdt3303_SwReset(struct lgdt330x_state* state)
};
ret = i2c_write_demod_bytes(state,
- reset, sizeof(reset));
+ reset, sizeof(reset));
if (ret == 0) {
/* force reset high (inactive) */
reset[1] = 0x01;
ret = i2c_write_demod_bytes(state,
- reset, sizeof(reset));
+ reset, sizeof(reset));
}
return ret;
}
@@ -172,39 +172,6 @@ static int lgdt330x_SwReset(struct lgdt330x_state* state)
}
}
-#ifdef MUTE_TDA9887
-static int i2c_write_ntsc_demod (struct lgdt330x_state* state, u8 buf[2])
-{
- struct i2c_msg msg =
- { .addr = 0x43,
- .flags = 0,
- .buf = buf,
- .len = 2 };
- int err;
-
- if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) {
- printk(KERN_WARNING "lgdt330x: %s error (addr %02x <- %02x, err = %i)\n", __FUNCTION__, msg.buf[0], msg.buf[1], err);
- if (err < 0)
- return err;
- else
- return -EREMOTEIO;
- }
- return 0;
-}
-
-static void fiddle_with_ntsc_if_demod(struct lgdt330x_state* state)
-{
- // Experimental code
- u8 buf0[] = {0x00, 0x20};
- u8 buf1[] = {0x01, 0x00};
- u8 buf2[] = {0x02, 0x00};
-
- i2c_write_ntsc_demod(state, buf0);
- i2c_write_ntsc_demod(state, buf1);
- i2c_write_ntsc_demod(state, buf2);
-}
-#endif
-
static int lgdt330x_init(struct dvb_frontend* fe)
{
/* Hardware reset is done using gpio[0] of cx23880x chip.
@@ -261,15 +228,12 @@ static int lgdt330x_init(struct dvb_frontend* fe)
case LGDT3302:
chip_name = "LGDT3302";
err = i2c_write_demod_bytes(state, lgdt3302_init_data,
- sizeof(lgdt3302_init_data));
+ sizeof(lgdt3302_init_data));
break;
case LGDT3303:
chip_name = "LGDT3303";
err = i2c_write_demod_bytes(state, lgdt3303_init_data,
- sizeof(lgdt3303_init_data));
-#ifdef MUTE_TDA9887
- fiddle_with_ntsc_if_demod(state);
-#endif
+ sizeof(lgdt3303_init_data));
break;
default:
chip_name = "undefined";
@@ -293,22 +257,22 @@ static int lgdt330x_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks)
struct lgdt330x_state* state = fe->demodulator_priv;
int err;
u8 buf[2];
-
+
switch (state->config->demod_chip) {
case LGDT3302:
err = i2c_read_demod_bytes(state, LGDT3302_PACKET_ERR_COUNTER1,
- buf, sizeof(buf));
+ buf, sizeof(buf));
break;
case LGDT3303:
err = i2c_read_demod_bytes(state, LGDT3303_PACKET_ERR_COUNTER1,
- buf, sizeof(buf));
+ buf, sizeof(buf));
break;
default:
printk(KERN_WARNING
- "Only LGDT3302 and LGDT3303 are supported chips.\n");
+ "Only LGDT3302 and LGDT3303 are supported chips.\n");
err = -ENODEV;
}
-
+
*ucblocks = (buf[0] << 8) | buf[1];
return 0;
}
@@ -365,7 +329,7 @@ static int lgdt330x_set_parameters(struct dvb_frontend* fe,
if (state->config->demod_chip == LGDT3303) {
err = i2c_write_demod_bytes(state, lgdt3303_8vsb_44_data,
- sizeof(lgdt3303_8vsb_44_data));
+ sizeof(lgdt3303_8vsb_44_data));
}
break;
@@ -413,18 +377,19 @@ static int lgdt330x_set_parameters(struct dvb_frontend* fe,
/* Select the requested mode */
i2c_write_demod_bytes(state, top_ctrl_cfg,
- sizeof(top_ctrl_cfg));
+ sizeof(top_ctrl_cfg));
state->config->set_ts_params(fe, 0);
state->current_modulation = param->u.vsb.modulation;
}
- /* Change only if we are actually changing the channel */
- if (state->current_frequency != param->frequency) {
- /* Tune to the new frequency */
- state->config->pll_set(fe, param);
- /* Keep track of the new frequency */
- state->current_frequency = param->frequency;
- }
+ /* Tune to the specified frequency */
+ state->config->pll_set(fe, param);
+
+ /* Keep track of the new frequency */
+ /* FIXME this is the wrong way to do this... */
+ /* The tuner is shared with the video4linux analog API */
+ state->current_frequency = param->frequency;
+
lgdt330x_SwReset(state);
return 0;
}