Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 37341
b: refs/heads/master
c: c10d14d
h: refs/heads/master
i:
  37339: 3944e43
v: v3
  • Loading branch information
Andrew de Quincey authored and Mauro Carvalho Chehab committed Sep 26, 2006
1 parent 5069288 commit a20e148
Show file tree
Hide file tree
Showing 15 changed files with 115 additions and 72 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 13fef9335f4fe2a73e1733f8807e69711736faef
refs/heads/master: c10d14d62d7b7596fd5c7bb8aad3f2b56f8640e6
17 changes: 9 additions & 8 deletions trunk/drivers/media/dvb/frontends/cx24110.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
cx24110 - Single Chip Satellite Channel Receiver driver module
Copyright (C) 2002 Peter Hettkamp <peter.hettkamp@htp-tel.de> based on
Expand Down Expand Up @@ -311,16 +311,17 @@ static int cx24110_set_symbolrate (struct cx24110_state* state, u32 srate)

}

int cx24110_pll_write (struct dvb_frontend* fe, u32 data)
static int _cx24110_pll_write (struct dvb_frontend* fe, u8 *buf, int len)
{
struct cx24110_state *state = fe->demodulator_priv;

if (len != 3)
return -EINVAL;

/* tuner data is 21 bits long, must be left-aligned in data */
/* tuner cx24108 is written through a dedicated 3wire interface on the demod chip */
/* FIXME (low): add error handling, avoid infinite loops if HW fails... */

dprintk("cx24110 debug: cx24108_write(%8.8x)\n",data);

cx24110_writereg(state,0x6d,0x30); /* auto mode at 62kHz */
cx24110_writereg(state,0x70,0x15); /* auto mode 21 bits */

Expand All @@ -329,19 +330,19 @@ int cx24110_pll_write (struct dvb_frontend* fe, u32 data)
cx24110_writereg(state,0x72,0);

/* write the topmost 8 bits */
cx24110_writereg(state,0x72,(data>>24)&0xff);
cx24110_writereg(state,0x72,buf[0]);

/* wait for the send to be completed */
while ((cx24110_readreg(state,0x6d)&0xc0)==0x80)
;

/* send another 8 bytes */
cx24110_writereg(state,0x72,(data>>16)&0xff);
cx24110_writereg(state,0x72,buf[1]);
while ((cx24110_readreg(state,0x6d)&0xc0)==0x80)
;

/* and the topmost 5 bits of this byte */
cx24110_writereg(state,0x72,(data>>8)&0xff);
cx24110_writereg(state,0x72,buf[2]);
while ((cx24110_readreg(state,0x6d)&0xc0)==0x80)
;

Expand Down Expand Up @@ -642,6 +643,7 @@ static struct dvb_frontend_ops cx24110_ops = {
.release = cx24110_release,

.init = cx24110_initfe,
.write = _cx24110_pll_write,
.set_frontend = cx24110_set_frontend,
.get_frontend = cx24110_get_frontend,
.read_status = cx24110_read_status,
Expand All @@ -664,4 +666,3 @@ MODULE_AUTHOR("Peter Hettkamp");
MODULE_LICENSE("GPL");

EXPORT_SYMBOL(cx24110_attach);
EXPORT_SYMBOL(cx24110_pll_write);
8 changes: 7 additions & 1 deletion trunk/drivers/media/dvb/frontends/cx24110.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ struct cx24110_config
extern struct dvb_frontend* cx24110_attach(const struct cx24110_config* config,
struct i2c_adapter* i2c);

extern int cx24110_pll_write(struct dvb_frontend* fe, u32 data);
static inline int cx24110_pll_write(struct dvb_frontend *fe, u32 val) {
int r = 0;
u8 buf[] = {(u8) (val>>24), (u8) (val>>16), (u8) (val>>8)};
if (fe->ops.write)
r = fe->ops.write(fe, buf, 3);
return r;
}

#endif // CX24110_H
16 changes: 8 additions & 8 deletions trunk/drivers/media/dvb/frontends/mt352.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ static int mt352_single_write(struct dvb_frontend *fe, u8 reg, u8 val)
return 0;
}

int mt352_write(struct dvb_frontend* fe, u8* ibuf, int ilen)
static int _mt352_write(struct dvb_frontend* fe, u8* ibuf, int ilen)
{
int err,i;
for (i=0; i < ilen-1; i++)
Expand Down Expand Up @@ -107,7 +107,7 @@ static int mt352_sleep(struct dvb_frontend* fe)
{
static u8 mt352_softdown[] = { CLOCK_CTL, 0x20, 0x08 };

mt352_write(fe, mt352_softdown, sizeof(mt352_softdown));
_mt352_write(fe, mt352_softdown, sizeof(mt352_softdown));
return 0;
}

Expand Down Expand Up @@ -293,14 +293,14 @@ static int mt352_set_parameters(struct dvb_frontend* fe,
fe->ops.i2c_gate_ctrl(fe, 0);
}

mt352_write(fe, buf, 8);
mt352_write(fe, fsm_go, 2);
_mt352_write(fe, buf, 8);
_mt352_write(fe, fsm_go, 2);
} else {
if (fe->ops.tuner_ops.calc_regs) {
fe->ops.tuner_ops.calc_regs(fe, param, buf+8, 5);
buf[8] <<= 1;
mt352_write(fe, buf, sizeof(buf));
mt352_write(fe, tuner_go, 2);
_mt352_write(fe, buf, sizeof(buf));
_mt352_write(fe, tuner_go, 2);
}
}

Expand Down Expand Up @@ -522,7 +522,7 @@ static int mt352_init(struct dvb_frontend* fe)
(mt352_read_register(state, CONFIG) & 0x20) == 0) {

/* Do a "hard" reset */
mt352_write(fe, mt352_reset_attach, sizeof(mt352_reset_attach));
_mt352_write(fe, mt352_reset_attach, sizeof(mt352_reset_attach));
return state->config.demod_init(fe);
}

Expand Down Expand Up @@ -585,6 +585,7 @@ static struct dvb_frontend_ops mt352_ops = {

.init = mt352_init,
.sleep = mt352_sleep,
.write = _mt352_write,

.set_frontend = mt352_set_parameters,
.get_frontend = mt352_get_parameters,
Expand All @@ -605,4 +606,3 @@ MODULE_AUTHOR("Holger Waechtler, Daniel Mack, Antonio Mancuso");
MODULE_LICENSE("GPL");

EXPORT_SYMBOL(mt352_attach);
EXPORT_SYMBOL(mt352_write);
7 changes: 6 additions & 1 deletion trunk/drivers/media/dvb/frontends/mt352.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ struct mt352_config
extern struct dvb_frontend* mt352_attach(const struct mt352_config* config,
struct i2c_adapter* i2c);

extern int mt352_write(struct dvb_frontend* fe, u8* ibuf, int ilen);
static inline int mt352_write(struct dvb_frontend *fe, u8 *buf, int len) {
int r = 0;
if (fe->ops.write)
r = fe->ops.write(fe, buf, len);
return r;
}

#endif // MT352_H
9 changes: 6 additions & 3 deletions trunk/drivers/media/dvb/frontends/stv0299.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,14 @@ static int stv0299_writeregI (struct stv0299_state* state, u8 reg, u8 data)
return (ret != 1) ? -EREMOTEIO : 0;
}

int stv0299_writereg (struct dvb_frontend* fe, u8 reg, u8 data)
int stv0299_write(struct dvb_frontend* fe, u8 *buf, int len)
{
struct stv0299_state* state = fe->demodulator_priv;

return stv0299_writeregI(state, reg, data);
if (len != 2)
return -EINVAL;

return stv0299_writeregI(state, buf[0], buf[1]);
}

static u8 stv0299_readreg (struct stv0299_state* state, u8 reg)
Expand Down Expand Up @@ -694,6 +697,7 @@ static struct dvb_frontend_ops stv0299_ops = {

.init = stv0299_init,
.sleep = stv0299_sleep,
.write = stv0299_write,
.i2c_gate_ctrl = stv0299_i2c_gate_ctrl,

.set_frontend = stv0299_set_frontend,
Expand Down Expand Up @@ -724,5 +728,4 @@ MODULE_AUTHOR("Ralph Metzler, Holger Waechtler, Peter Schildmann, Felix Domke, "
"Andreas Oberritter, Andrew de Quincey, Kenneth Aafly");
MODULE_LICENSE("GPL");

EXPORT_SYMBOL(stv0299_writereg);
EXPORT_SYMBOL(stv0299_attach);
10 changes: 8 additions & 2 deletions trunk/drivers/media/dvb/frontends/stv0299.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,15 @@ struct stv0299_config
int (*set_symbol_rate)(struct dvb_frontend* fe, u32 srate, u32 ratio);
};

extern int stv0299_writereg (struct dvb_frontend* fe, u8 reg, u8 data);

extern struct dvb_frontend* stv0299_attach(const struct stv0299_config* config,
struct i2c_adapter* i2c);

static inline int stv0299_writereg(struct dvb_frontend *fe, u8 reg, u8 val) {
int r = 0;
u8 buf[] = {reg, val};
if (fe->ops.write)
r = fe->ops.write(fe, buf, 2);
return r;
}

#endif // STV0299_H
63 changes: 33 additions & 30 deletions trunk/drivers/media/dvb/frontends/tda10021.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ static u8 tda10021_inittab[0x40]=
0x04, 0x2d, 0x2f, 0xff, 0x00, 0x00, 0x00, 0x00,
};

static int tda10021_writereg (struct tda10021_state* state, u8 reg, u8 data)
static int _tda10021_writereg (struct tda10021_state* state, u8 reg, u8 data)
{
u8 buf[] = { reg, data };
struct i2c_msg msg = { .addr = state->config->demod_address, .flags = 0, .buf = buf, .len = 2 };
Expand All @@ -88,14 +88,6 @@ static int tda10021_writereg (struct tda10021_state* state, u8 reg, u8 data)
return (ret != 1) ? -EREMOTEIO : 0;
}

int tda10021_write_byte(struct dvb_frontend* fe, int reg, int data)
{
struct tda10021_state* state = fe->demodulator_priv;

return tda10021_writereg(state, reg, data);
}
EXPORT_SYMBOL(tda10021_write_byte);

static u8 tda10021_readreg (struct tda10021_state* state, u8 reg)
{
u8 b0 [] = { reg };
Expand Down Expand Up @@ -149,8 +141,8 @@ static int tda10021_setup_reg0 (struct tda10021_state* state, u8 reg0,
else if (INVERSION_OFF == inversion)
DISABLE_INVERSION(reg0);

tda10021_writereg (state, 0x00, reg0 & 0xfe);
tda10021_writereg (state, 0x00, reg0 | 0x01);
_tda10021_writereg (state, 0x00, reg0 & 0xfe);
_tda10021_writereg (state, 0x00, reg0 | 0x01);

state->reg0 = reg0;
return 0;
Expand Down Expand Up @@ -198,30 +190,40 @@ static int tda10021_set_symbolrate (struct tda10021_state* state, u32 symbolrate

NDEC = (NDEC << 6) | tda10021_inittab[0x03];

tda10021_writereg (state, 0x03, NDEC);
tda10021_writereg (state, 0x0a, BDR&0xff);
tda10021_writereg (state, 0x0b, (BDR>> 8)&0xff);
tda10021_writereg (state, 0x0c, (BDR>>16)&0x3f);
_tda10021_writereg (state, 0x03, NDEC);
_tda10021_writereg (state, 0x0a, BDR&0xff);
_tda10021_writereg (state, 0x0b, (BDR>> 8)&0xff);
_tda10021_writereg (state, 0x0c, (BDR>>16)&0x3f);

tda10021_writereg (state, 0x0d, BDRI);
tda10021_writereg (state, 0x0e, SFIL);
_tda10021_writereg (state, 0x0d, BDRI);
_tda10021_writereg (state, 0x0e, SFIL);

return 0;
}

int tda10021_write(struct dvb_frontend* fe, u8 *buf, int len)
{
struct tda10021_state* state = fe->demodulator_priv;

if (len != 2)
return -EINVAL;

return _tda10021_writereg(state, buf[0], buf[1]);
}

static int tda10021_init (struct dvb_frontend *fe)
{
struct tda10021_state* state = fe->demodulator_priv;
int i;

dprintk("DVB: TDA10021(%d): init chip\n", fe->adapter->num);

//tda10021_writereg (fe, 0, 0);
//_tda10021_writereg (fe, 0, 0);

for (i=0; i<tda10021_inittab_size; i++)
tda10021_writereg (state, i, tda10021_inittab[i]);
_tda10021_writereg (state, i, tda10021_inittab[i]);

tda10021_writereg (state, 0x34, state->pwm);
_tda10021_writereg (state, 0x34, state->pwm);

//Comment by markus
//0x2A[3-0] == PDIV -> P multiplaying factor (P=PDIV+1)(default 0)
Expand All @@ -230,7 +232,7 @@ static int tda10021_init (struct dvb_frontend *fe)
//0x2A[6] == POLAXIN -> Polarity of the input reference clock (default 0)

//Activate PLL
tda10021_writereg(state, 0x2a, tda10021_inittab[0x2a] & 0xef);
_tda10021_writereg(state, 0x2a, tda10021_inittab[0x2a] & 0xef);
return 0;
}

Expand Down Expand Up @@ -264,12 +266,12 @@ static int tda10021_set_parameters (struct dvb_frontend *fe,
}

tda10021_set_symbolrate (state, p->u.qam.symbol_rate);
tda10021_writereg (state, 0x34, state->pwm);
_tda10021_writereg (state, 0x34, state->pwm);

tda10021_writereg (state, 0x01, reg0x01[qam]);
tda10021_writereg (state, 0x05, reg0x05[qam]);
tda10021_writereg (state, 0x08, reg0x08[qam]);
tda10021_writereg (state, 0x09, reg0x09[qam]);
_tda10021_writereg (state, 0x01, reg0x01[qam]);
_tda10021_writereg (state, 0x05, reg0x05[qam]);
_tda10021_writereg (state, 0x08, reg0x08[qam]);
_tda10021_writereg (state, 0x09, reg0x09[qam]);

tda10021_setup_reg0 (state, reg0x00[qam], p->inversion);

Expand Down Expand Up @@ -342,8 +344,8 @@ static int tda10021_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks)
*ucblocks = 0xffffffff;

/* reset uncorrected block counter */
tda10021_writereg (state, 0x10, tda10021_inittab[0x10] & 0xdf);
tda10021_writereg (state, 0x10, tda10021_inittab[0x10]);
_tda10021_writereg (state, 0x10, tda10021_inittab[0x10] & 0xdf);
_tda10021_writereg (state, 0x10, tda10021_inittab[0x10]);

return 0;
}
Expand Down Expand Up @@ -392,8 +394,8 @@ static int tda10021_sleep(struct dvb_frontend* fe)
{
struct tda10021_state* state = fe->demodulator_priv;

tda10021_writereg (state, 0x1b, 0x02); /* pdown ADC */
tda10021_writereg (state, 0x00, 0x80); /* standby */
_tda10021_writereg (state, 0x1b, 0x02); /* pdown ADC */
_tda10021_writereg (state, 0x00, 0x80); /* standby */

return 0;
}
Expand Down Expand Up @@ -459,6 +461,7 @@ static struct dvb_frontend_ops tda10021_ops = {

.init = tda10021_init,
.sleep = tda10021_sleep,
.write = tda10021_write,
.i2c_gate_ctrl = tda10021_i2c_gate_ctrl,

.set_frontend = tda10021_set_parameters,
Expand Down
8 changes: 7 additions & 1 deletion trunk/drivers/media/dvb/frontends/tda10021.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ struct tda10021_config
extern struct dvb_frontend* tda10021_attach(const struct tda10021_config* config,
struct i2c_adapter* i2c, u8 pwm);

extern int tda10021_write_byte(struct dvb_frontend* fe, int reg, int data);
static inline int tda10021_writereg(struct dvb_frontend *fe, u8 reg, u8 val) {
int r = 0;
u8 buf[] = {reg, val};
if (fe->ops.write)
r = fe->ops.write(fe, buf, 2);
return r;
}

#endif // TDA10021_H
Loading

0 comments on commit a20e148

Please sign in to comment.