Commit f46dbb05 authored by Patrick Boettcher's avatar Patrick Boettcher Committed by Linus Torvalds

[PATCH] dvb: frontend: cx22702: support for cxusb

Add .get_tune_settings callback (min_delay_ms = 1sec) and output_mode-field
(parallel/serial) to support cxusb; minor cleanups.
Signed-off-by: default avatarPatrick Boettcher <pb@linuxtv.org>
Signed-off-by: default avatarJohannes Stezenbach <js@linuxtv.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent f03cbea3
...@@ -76,7 +76,6 @@ static u8 init_tab [] = { ...@@ -76,7 +76,6 @@ static u8 init_tab [] = {
0x49, 0x56, 0x49, 0x56,
0x6b, 0x1e, 0x6b, 0x1e,
0xc8, 0x02, 0xc8, 0x02,
0xf8, 0x02,
0xf9, 0x00, 0xf9, 0x00,
0xfa, 0x00, 0xfa, 0x00,
0xfb, 0x00, 0xfb, 0x00,
...@@ -203,7 +202,7 @@ static int cx22702_set_tps (struct dvb_frontend* fe, struct dvb_frontend_paramet ...@@ -203,7 +202,7 @@ static int cx22702_set_tps (struct dvb_frontend* fe, struct dvb_frontend_paramet
struct cx22702_state* state = fe->demodulator_priv; struct cx22702_state* state = fe->demodulator_priv;
/* set PLL */ /* set PLL */
cx22702_writereg (state, 0x0D, cx22702_readreg(state,0x0D) &0xfe); cx22702_writereg (state, 0x0D, cx22702_readreg(state,0x0D) &0xfe);
if (state->config->pll_set) { if (state->config->pll_set) {
state->config->pll_set(fe, p); state->config->pll_set(fe, p);
} else if (state->config->pll_desc) { } else if (state->config->pll_desc) {
...@@ -217,7 +216,7 @@ static int cx22702_set_tps (struct dvb_frontend* fe, struct dvb_frontend_paramet ...@@ -217,7 +216,7 @@ static int cx22702_set_tps (struct dvb_frontend* fe, struct dvb_frontend_paramet
} else { } else {
BUG(); BUG();
} }
cx22702_writereg (state, 0x0D, cx22702_readreg(state,0x0D) | 1); cx22702_writereg (state, 0x0D, cx22702_readreg(state,0x0D) | 1);
/* set inversion */ /* set inversion */
cx22702_set_inversion (state, p->inversion); cx22702_set_inversion (state, p->inversion);
...@@ -256,7 +255,7 @@ static int cx22702_set_tps (struct dvb_frontend* fe, struct dvb_frontend_paramet ...@@ -256,7 +255,7 @@ static int cx22702_set_tps (struct dvb_frontend* fe, struct dvb_frontend_paramet
cx22702_writereg(state, 0x0B, cx22702_readreg(state, 0x0B) & 0xfc ); cx22702_writereg(state, 0x0B, cx22702_readreg(state, 0x0B) & 0xfc );
cx22702_writereg(state, 0x0C, (cx22702_readreg(state, 0x0C) & 0xBF) | 0x40 ); cx22702_writereg(state, 0x0C, (cx22702_readreg(state, 0x0C) & 0xBF) | 0x40 );
cx22702_writereg(state, 0x00, 0x01); /* Begin aquisition */ cx22702_writereg(state, 0x00, 0x01); /* Begin aquisition */
printk("%s: Autodetecting\n",__FUNCTION__); dprintk("%s: Autodetecting\n",__FUNCTION__);
return 0; return 0;
} }
...@@ -347,10 +346,11 @@ static int cx22702_init (struct dvb_frontend* fe) ...@@ -347,10 +346,11 @@ static int cx22702_init (struct dvb_frontend* fe)
for (i=0; i<sizeof(init_tab); i+=2) for (i=0; i<sizeof(init_tab); i+=2)
cx22702_writereg (state, init_tab[i], init_tab[i+1]); cx22702_writereg (state, init_tab[i], init_tab[i+1]);
cx22702_writereg (state, 0xf8, (state->config->output_mode << 1) & 0x02);
/* init PLL */ /* init PLL */
if (state->config->pll_init) { if (state->config->pll_init) {
cx22702_writereg (state, 0x0D, cx22702_readreg(state,0x0D) &0xfe); cx22702_writereg (state, 0x0D, cx22702_readreg(state,0x0D) & 0xfe);
state->config->pll_init(fe); state->config->pll_init(fe);
cx22702_writereg (state, 0x0D, cx22702_readreg(state,0x0D) | 1); cx22702_writereg (state, 0x0D, cx22702_readreg(state,0x0D) | 1);
} }
...@@ -440,8 +440,10 @@ static int cx22702_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) ...@@ -440,8 +440,10 @@ static int cx22702_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks)
/* RS Uncorrectable Packet Count then reset */ /* RS Uncorrectable Packet Count then reset */
_ucblocks = cx22702_readreg (state, 0xE3); _ucblocks = cx22702_readreg (state, 0xE3);
if (state->prevUCBlocks < _ucblocks) *ucblocks = (_ucblocks - state->prevUCBlocks); if (state->prevUCBlocks < _ucblocks)
else *ucblocks = state->prevUCBlocks - _ucblocks; *ucblocks = (_ucblocks - state->prevUCBlocks);
else
*ucblocks = state->prevUCBlocks - _ucblocks;
state->prevUCBlocks = _ucblocks; state->prevUCBlocks = _ucblocks;
return 0; return 0;
...@@ -457,6 +459,12 @@ static int cx22702_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_par ...@@ -457,6 +459,12 @@ static int cx22702_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_par
return cx22702_get_tps (state, &p->u.ofdm); return cx22702_get_tps (state, &p->u.ofdm);
} }
static int cx22702_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings *tune)
{
tune->min_delay_ms = 1000;
return 0;
}
static void cx22702_release(struct dvb_frontend* fe) static void cx22702_release(struct dvb_frontend* fe)
{ {
struct cx22702_state* state = fe->demodulator_priv; struct cx22702_state* state = fe->demodulator_priv;
...@@ -472,7 +480,8 @@ struct dvb_frontend* cx22702_attach(const struct cx22702_config* config, ...@@ -472,7 +480,8 @@ struct dvb_frontend* cx22702_attach(const struct cx22702_config* config,
/* allocate memory for the internal state */ /* allocate memory for the internal state */
state = kmalloc(sizeof(struct cx22702_state), GFP_KERNEL); state = kmalloc(sizeof(struct cx22702_state), GFP_KERNEL);
if (state == NULL) goto error; if (state == NULL)
goto error;
/* setup the state */ /* setup the state */
state->config = config; state->config = config;
...@@ -481,7 +490,8 @@ struct dvb_frontend* cx22702_attach(const struct cx22702_config* config, ...@@ -481,7 +490,8 @@ struct dvb_frontend* cx22702_attach(const struct cx22702_config* config,
state->prevUCBlocks = 0; state->prevUCBlocks = 0;
/* check if the demod is there */ /* check if the demod is there */
if (cx22702_readreg(state, 0x1f) != 0x3) goto error; if (cx22702_readreg(state, 0x1f) != 0x3)
goto error;
/* create dvb_frontend */ /* create dvb_frontend */
state->frontend.ops = &state->ops; state->frontend.ops = &state->ops;
...@@ -514,6 +524,7 @@ static struct dvb_frontend_ops cx22702_ops = { ...@@ -514,6 +524,7 @@ static struct dvb_frontend_ops cx22702_ops = {
.set_frontend = cx22702_set_tps, .set_frontend = cx22702_set_tps,
.get_frontend = cx22702_get_frontend, .get_frontend = cx22702_get_frontend,
.get_tune_settings = cx22702_get_tune_settings,
.read_status = cx22702_read_status, .read_status = cx22702_read_status,
.read_ber = cx22702_read_ber, .read_ber = cx22702_read_ber,
......
...@@ -35,6 +35,11 @@ struct cx22702_config ...@@ -35,6 +35,11 @@ struct cx22702_config
/* the demodulator's i2c address */ /* the demodulator's i2c address */
u8 demod_address; u8 demod_address;
/* serial/parallel output */
#define CX22702_PARALLEL_OUTPUT 0
#define CX22702_SERIAL_OUTPUT 1
u8 output_mode;
/* PLL maintenance */ /* PLL maintenance */
u8 pll_address; u8 pll_address;
struct dvb_pll_desc *pll_desc; struct dvb_pll_desc *pll_desc;
......
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