[linux-dvb] [PATCH] Add several debug messages to cx24123 code
Mauro Carvalho Chehab
mchehab at infradead.org
Thu Apr 13 15:35:27 CEST 2006
This patch were missed for some time at ML. If somebody is against,
please let me know. Otherwise, I'll commit at master.
-------- Mensagem encaminhada --------
From: Mauro Carvalho Chehab <mchehab at infradead.org>
Add several debug messages to cx24123 code
Current debug messages at cx24123 are next to useless, since they don't
print the values sent/read to registers. With this patch, debug=1 will
show comprehensive messages. debug=2 will show also read/write operations
at I2C bus.
Signed-off-by: Mauro Carvalho Chehab <mchehab at infradead.org>
---
linux/drivers/media/dvb/frontends/cx24123.c | 54 ++++++++++++++++++--
1 files changed, 51 insertions(+), 3 deletions(-)
diff -r 94e5065fcb2c -r 9a811c5ad5a1 linux/drivers/media/dvb/frontends/cx24123.c
--- a/linux/drivers/media/dvb/frontends/cx24123.c Thu Apr 13 02:09:05 2006 -0300
+++ b/linux/drivers/media/dvb/frontends/cx24123.c Thu Apr 13 02:28:28 2006 -0300
@@ -225,6 +225,10 @@ static int cx24123_writereg(struct cx241
struct i2c_msg msg = { .addr = state->config->demod_address, .flags = 0, .buf = buf, .len = 2 };
int err;
+ if (debug>1)
+ printk("cx24123: %s: write reg 0x%02x, value 0x%02x\n",
+ __FUNCTION__,reg, data);
+
if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) {
printk("%s: writereg error(err == %i, reg == 0x%02x,"
" data == 0x%02x)\n", __FUNCTION__, err, reg, data);
@@ -240,6 +244,10 @@ static int cx24123_writelnbreg(struct cx
/* fixme: put the intersil addr int the config */
struct i2c_msg msg = { .addr = 0x08, .flags = 0, .buf = buf, .len = 2 };
int err;
+
+ if (debug>1)
+ printk("cx24123: %s: writeln addr=0x08, reg 0x%02x, value 0x%02x\n",
+ __FUNCTION__,reg, data);
if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) {
printk("%s: writelnbreg error (err == %i, reg == 0x%02x,"
@@ -270,6 +278,9 @@ static int cx24123_readreg(struct cx2412
return ret;
}
+ if (debug>1)
+ printk("cx24123: read reg 0x%02x, value 0x%02x\n",reg, ret);
+
return b1[0];
}
@@ -282,14 +293,17 @@ static int cx24123_set_inversion(struct
{
switch (inversion) {
case INVERSION_OFF:
+ dprintk("%s: inversion off\n",__FUNCTION__);
cx24123_writereg(state, 0x0e, cx24123_readreg(state, 0x0e) & 0x7f);
cx24123_writereg(state, 0x10, cx24123_readreg(state, 0x10) | 0x80);
break;
case INVERSION_ON:
+ dprintk("%s: inversion on\n",__FUNCTION__);
cx24123_writereg(state, 0x0e, cx24123_readreg(state, 0x0e) | 0x80);
cx24123_writereg(state, 0x10, cx24123_readreg(state, 0x10) | 0x80);
break;
case INVERSION_AUTO:
+ dprintk("%s: inversion auto\n",__FUNCTION__);
cx24123_writereg(state, 0x10, cx24123_readreg(state, 0x10) & 0x7f);
break;
default:
@@ -305,10 +319,13 @@ static int cx24123_get_inversion(struct
val = cx24123_readreg(state, 0x1b) >> 7;
- if (val == 0)
+ if (val == 0) {
+ dprintk("%s: read inversion off\n",__FUNCTION__);
*inversion = INVERSION_OFF;
- else
+ } else {
+ dprintk("%s: read inversion on\n",__FUNCTION__);
*inversion = INVERSION_ON;
+ }
return 0;
}
@@ -321,18 +338,25 @@ static int cx24123_set_fec(struct cx2412
/* Hardware has 5/11 and 3/5 but are never unused */
switch (fec) {
case FEC_NONE:
+ dprintk("%s: set FEC to none\n",__FUNCTION__);
return cx24123_writereg(state, 0x0f, 0x01);
case FEC_1_2:
+ dprintk("%s: set FEC to 1/2\n",__FUNCTION__);
return cx24123_writereg(state, 0x0f, 0x02);
case FEC_2_3:
+ dprintk("%s: set FEC to 2/3\n",__FUNCTION__);
return cx24123_writereg(state, 0x0f, 0x04);
case FEC_3_4:
+ dprintk("%s: set FEC to 3/4\n",__FUNCTION__);
return cx24123_writereg(state, 0x0f, 0x08);
case FEC_5_6:
+ dprintk("%s: set FEC to 4/5\n",__FUNCTION__);
return cx24123_writereg(state, 0x0f, 0x20);
case FEC_7_8:
+ dprintk("%s: set FEC to 5/6\n",__FUNCTION__);
return cx24123_writereg(state, 0x0f, 0x80);
case FEC_AUTO:
+ dprintk("%s: set FEC to auto\n",__FUNCTION__);
return cx24123_writereg(state, 0x0f, 0xae);
default:
return -EOPNOTSUPP;
@@ -510,6 +534,8 @@ static int cx24123_pll_writereg(struct d
struct cx24123_state *state = fe->demodulator_priv;
unsigned long timeout;
+ dprintk("%s: pll writereg called, data=0x%08x\n",__FUNCTION__,data);
+
/* align the 21 bytes into to bit23 boundary */
data = data << 3;
@@ -581,6 +607,9 @@ static int cx24123_pll_tune(struct dvb_f
cx24123_writereg(state, 0x27, state->FILTune >> 2);
cx24123_writereg(state, 0x28, val | (state->FILTune & 0x3));
+ dprintk("%s: pll tune VCA=%d, band=%d, pll=%d\n",__FUNCTION__,state->VCAarg,
+ state->bandselectarg,state->pllarg);
+
return 0;
}
@@ -588,6 +617,8 @@ static int cx24123_initfe(struct dvb_fro
{
struct cx24123_state *state = fe->demodulator_priv;
int i;
+
+ dprintk("%s: init frontend\n",__FUNCTION__);
/* Configure the demod to a good set of defaults */
for (i = 0; i < sizeof(cx24123_regdata) / sizeof(cx24123_regdata[0]); i++)
@@ -616,10 +647,13 @@ static int cx24123_set_voltage(struct dv
switch (voltage) {
case SEC_VOLTAGE_13:
+ dprintk("%s: isl6421 voltage = 13V\n",__FUNCTION__);
return cx24123_writelnbreg(state, 0x0, val & 0x32); /* V 13v */
case SEC_VOLTAGE_18:
+ dprintk("%s: isl6421 voltage = 18V\n",__FUNCTION__);
return cx24123_writelnbreg(state, 0x0, val | 0x04); /* H 18v */
case SEC_VOLTAGE_OFF:
+ dprintk("%s: isl5421 voltage off\n",__FUNCTION__);
return cx24123_writelnbreg(state, 0x0, val & 0x30);
default:
return -EINVAL;
@@ -780,6 +814,8 @@ static int cx24123_read_ber(struct dvb_f
else
state->snr = 0;
+ dprintk("%s: BER = %d, S/N index = %d\n",__FUNCTION__,state->lastber, state->snr);
+
*ber = state->lastber;
return 0;
@@ -789,6 +825,8 @@ static int cx24123_read_signal_strength(
{
struct cx24123_state *state = fe->demodulator_priv;
*signal_strength = cx24123_readreg(state, 0x3b) << 8; /* larger = better */
+
+ dprintk("%s: Signal strength = %d\n",__FUNCTION__,*signal_strength);
return 0;
}
@@ -801,6 +839,8 @@ static int cx24123_read_snr(struct dvb_f
*snr = state->snr;
cx24123_read_ber(fe, &ber);
+ dprintk("%s: read S/N index = %d\n",__FUNCTION__,*snr);
+
return 0;
}
@@ -809,12 +849,16 @@ static int cx24123_read_ucblocks(struct
struct cx24123_state *state = fe->demodulator_priv;
*ucblocks = state->lastber;
+ dprintk("%s: ucblocks (ber) = %d\n",__FUNCTION__,*ucblocks);
+
return 0;
}
static int cx24123_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p)
{
struct cx24123_state *state = fe->demodulator_priv;
+
+ dprintk("%s: set_frontend\n",__FUNCTION__);
if (state->config->set_ts_params)
state->config->set_ts_params(fe, 0);
@@ -842,6 +886,8 @@ static int cx24123_get_frontend(struct d
{
struct cx24123_state *state = fe->demodulator_priv;
+ dprintk("%s: get_frontend\n",__FUNCTION__);
+
if (cx24123_get_inversion(state, &p->inversion) != 0) {
printk("%s: Failed to get inversion status\n",__FUNCTION__);
return -EREMOTEIO;
@@ -868,8 +914,10 @@ static int cx24123_set_tone(struct dvb_f
switch (tone) {
case SEC_TONE_ON:
+ dprintk("%s: isl6421 sec tone on\n",__FUNCTION__);
return cx24123_writelnbreg(state, 0x0, val | 0x10);
case SEC_TONE_OFF:
+ dprintk("%s: isl6421 sec tone off\n",__FUNCTION__);
return cx24123_writelnbreg(state, 0x0, val & 0x2f);
default:
printk("%s: CASE reached default with tone=%d\n", __FUNCTION__, tone);
@@ -986,7 +1034,7 @@ static struct dvb_frontend_ops cx24123_o
};
module_param(debug, int, 0644);
-MODULE_PARM_DESC(debug, "Turn on/off frontend debugging (default:off).");
+MODULE_PARM_DESC(debug, "Activates frontend debugging (default:0)");
MODULE_DESCRIPTION("DVB Frontend module for Conexant cx24123/cx24109 hardware");
MODULE_AUTHOR("Steven Toth");
_______________________________________________
video4linux-cvs mailing list
video4linux-cvs at linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/video4linux-cvs
Cheers,
Mauro.
More information about the linux-dvb
mailing list