Commit 4abe9f9d authored by Michael Krufky's avatar Michael Krufky Committed by Mauro Carvalho Chehab

V4L/DVB (5633): Tuv1236d: move rf input switching code into dvb-pll

This patch removes duplicate code from cx88-dvb and saa7134-dvb that handles
rf input switching for the TUV1236d tuner.

The functionality is added to dvb-pll, where all the other code that 
handles the TUV1236d is kept.
Signed-off-by: default avatarMichael Krufky <mkrufky@linuxtv.org>
Signed-off-by: default avatarTrent Piepho <xyzzy@speakeasy.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent 77d67504
...@@ -343,11 +343,25 @@ EXPORT_SYMBOL(dvb_pll_tdhu2); ...@@ -343,11 +343,25 @@ EXPORT_SYMBOL(dvb_pll_tdhu2);
/* Philips TUV1236D /* Philips TUV1236D
* used in ATI HDTV Wonder * used in ATI HDTV Wonder
*/ */
static void tuv1236d_rf(u8 *buf, const struct dvb_frontend_parameters *params)
{
switch (params->u.vsb.modulation) {
case QAM_64:
case QAM_256:
buf[3] |= 0x08;
break;
case VSB_8:
default:
buf[3] &= ~0x08;
}
}
struct dvb_pll_desc dvb_pll_tuv1236d = { struct dvb_pll_desc dvb_pll_tuv1236d = {
.name = "Philips TUV1236D", .name = "Philips TUV1236D",
.min = 54000000, .min = 54000000,
.max = 864000000, .max = 864000000,
.iffreq= 44000000, .iffreq= 44000000,
.set = tuv1236d_rf,
.count = 3, .count = 3,
.entries = { .entries = {
{ 157250000, 62500, 0xc6, 0x41 }, { 157250000, 62500, 0xc6, 0x41 },
......
...@@ -546,11 +546,6 @@ static int nxt200x_setup_frontend_parameters (struct dvb_frontend* fe, ...@@ -546,11 +546,6 @@ static int nxt200x_setup_frontend_parameters (struct dvb_frontend* fe,
nxt200x_writebytes(state, 0x17, buf, 1); nxt200x_writebytes(state, 0x17, buf, 1);
} }
/* get tuning information */
if (fe->ops.tuner_ops.calc_regs) {
fe->ops.tuner_ops.calc_regs(fe, p, buf, 5);
}
/* set additional params */ /* set additional params */
switch (p->u.vsb.modulation) { switch (p->u.vsb.modulation) {
case QAM_64: case QAM_64:
...@@ -559,27 +554,24 @@ static int nxt200x_setup_frontend_parameters (struct dvb_frontend* fe, ...@@ -559,27 +554,24 @@ static int nxt200x_setup_frontend_parameters (struct dvb_frontend* fe,
/* This is just a guess since I am unable to test it */ /* This is just a guess since I am unable to test it */
if (state->config->set_ts_params) if (state->config->set_ts_params)
state->config->set_ts_params(fe, 1); state->config->set_ts_params(fe, 1);
/* set input */
if (state->config->set_pll_input)
state->config->set_pll_input(buf+1, 1);
break; break;
case VSB_8: case VSB_8:
/* Set non-punctured clock for VSB */ /* Set non-punctured clock for VSB */
if (state->config->set_ts_params) if (state->config->set_ts_params)
state->config->set_ts_params(fe, 0); state->config->set_ts_params(fe, 0);
/* set input */
if (state->config->set_pll_input)
state->config->set_pll_input(buf+1, 0);
break; break;
default: default:
return -EINVAL; return -EINVAL;
break; break;
} }
if (fe->ops.tuner_ops.calc_regs) {
/* get tuning information */
fe->ops.tuner_ops.calc_regs(fe, p, buf, 5);
/* write frequency information */ /* write frequency information */
nxt200x_writetuner(state, buf); nxt200x_writetuner(state, buf);
}
/* reset the agc now that tuning has been completed */ /* reset the agc now that tuning has been completed */
nxt200x_agc_reset(state); nxt200x_agc_reset(state);
......
...@@ -38,9 +38,6 @@ struct nxt200x_config ...@@ -38,9 +38,6 @@ struct nxt200x_config
/* the demodulator's i2c address */ /* the demodulator's i2c address */
u8 demod_address; u8 demod_address;
/* used to set pll input */
int (*set_pll_input)(u8* buf, int input);
/* need to set device param for start_dma */ /* need to set device param for start_dma */
int (*set_ts_params)(struct dvb_frontend* fe, int is_punctured); int (*set_ts_params)(struct dvb_frontend* fe, int is_punctured);
}; };
......
...@@ -366,18 +366,8 @@ static int nxt200x_set_ts_param(struct dvb_frontend* fe, int is_punctured) ...@@ -366,18 +366,8 @@ static int nxt200x_set_ts_param(struct dvb_frontend* fe, int is_punctured)
return 0; return 0;
} }
static int nxt200x_set_pll_input(u8* buf, int input)
{
if (input)
buf[3] |= 0x08;
else
buf[3] &= ~0x08;
return 0;
}
static struct nxt200x_config ati_hdtvwonder = { static struct nxt200x_config ati_hdtvwonder = {
.demod_address = 0x0a, .demod_address = 0x0a,
.set_pll_input = nxt200x_set_pll_input,
.set_ts_params = nxt200x_set_ts_param, .set_ts_params = nxt200x_set_ts_param,
}; };
......
...@@ -956,18 +956,8 @@ static struct nxt200x_config avertvhda180 = { ...@@ -956,18 +956,8 @@ static struct nxt200x_config avertvhda180 = {
.demod_address = 0x0a, .demod_address = 0x0a,
}; };
static int nxt200x_set_pll_input(u8 *buf, int input)
{
if (input)
buf[3] |= 0x08;
else
buf[3] &= ~0x08;
return 0;
}
static struct nxt200x_config kworldatsc110 = { static struct nxt200x_config kworldatsc110 = {
.demod_address = 0x0a, .demod_address = 0x0a,
.set_pll_input = nxt200x_set_pll_input,
}; };
/* ================================================================== /* ==================================================================
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment