aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2006-04-13 10:29:13 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2006-05-12 18:55:04 -0400
commitcaf970e09c42843eb3b8456fc0e815f9b5385873 (patch)
tree91b15ba87bb1f1ee84e2568d1034b48125bbf043 /drivers/media/dvb
parenta74b51fca9d9b6774413d700ade1e9ae1f0c0e75 (diff)
V4L/DVB (3796): 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@infradead.org> Signed-off-by: Andrew de Quincey <adq_dvb@lidskialf.net>
Diffstat (limited to 'drivers/media/dvb')
-rw-r--r--drivers/media/dvb/frontends/cx24123.c54
1 files changed, 51 insertions, 3 deletions
diff --git a/drivers/media/dvb/frontends/cx24123.c b/drivers/media/dvb/frontends/cx24123.c
index e430e6a50831..115ec169b641 100644
--- a/drivers/media/dvb/frontends/cx24123.c
+++ b/drivers/media/dvb/frontends/cx24123.c
@@ -225,6 +225,10 @@ static int cx24123_writereg(struct cx24123_state* state, int reg, int data)
225 struct i2c_msg msg = { .addr = state->config->demod_address, .flags = 0, .buf = buf, .len = 2 }; 225 struct i2c_msg msg = { .addr = state->config->demod_address, .flags = 0, .buf = buf, .len = 2 };
226 int err; 226 int err;
227 227
228 if (debug>1)
229 printk("cx24123: %s: write reg 0x%02x, value 0x%02x\n",
230 __FUNCTION__,reg, data);
231
228 if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) { 232 if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) {
229 printk("%s: writereg error(err == %i, reg == 0x%02x," 233 printk("%s: writereg error(err == %i, reg == 0x%02x,"
230 " data == 0x%02x)\n", __FUNCTION__, err, reg, data); 234 " data == 0x%02x)\n", __FUNCTION__, err, reg, data);
@@ -241,6 +245,10 @@ static int cx24123_writelnbreg(struct cx24123_state* state, int reg, int data)
241 struct i2c_msg msg = { .addr = 0x08, .flags = 0, .buf = buf, .len = 2 }; 245 struct i2c_msg msg = { .addr = 0x08, .flags = 0, .buf = buf, .len = 2 };
242 int err; 246 int err;
243 247
248 if (debug>1)
249 printk("cx24123: %s: writeln addr=0x08, reg 0x%02x, value 0x%02x\n",
250 __FUNCTION__,reg, data);
251
244 if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) { 252 if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) {
245 printk("%s: writelnbreg error (err == %i, reg == 0x%02x," 253 printk("%s: writelnbreg error (err == %i, reg == 0x%02x,"
246 " data == 0x%02x)\n", __FUNCTION__, err, reg, data); 254 " data == 0x%02x)\n", __FUNCTION__, err, reg, data);
@@ -270,6 +278,9 @@ static int cx24123_readreg(struct cx24123_state* state, u8 reg)
270 return ret; 278 return ret;
271 } 279 }
272 280
281 if (debug>1)
282 printk("cx24123: read reg 0x%02x, value 0x%02x\n",reg, ret);
283
273 return b1[0]; 284 return b1[0];
274} 285}
275 286
@@ -282,14 +293,17 @@ static int cx24123_set_inversion(struct cx24123_state* state, fe_spectral_invers
282{ 293{
283 switch (inversion) { 294 switch (inversion) {
284 case INVERSION_OFF: 295 case INVERSION_OFF:
296 dprintk("%s: inversion off\n",__FUNCTION__);
285 cx24123_writereg(state, 0x0e, cx24123_readreg(state, 0x0e) & 0x7f); 297 cx24123_writereg(state, 0x0e, cx24123_readreg(state, 0x0e) & 0x7f);
286 cx24123_writereg(state, 0x10, cx24123_readreg(state, 0x10) | 0x80); 298 cx24123_writereg(state, 0x10, cx24123_readreg(state, 0x10) | 0x80);
287 break; 299 break;
288 case INVERSION_ON: 300 case INVERSION_ON:
301 dprintk("%s: inversion on\n",__FUNCTION__);
289 cx24123_writereg(state, 0x0e, cx24123_readreg(state, 0x0e) | 0x80); 302 cx24123_writereg(state, 0x0e, cx24123_readreg(state, 0x0e) | 0x80);
290 cx24123_writereg(state, 0x10, cx24123_readreg(state, 0x10) | 0x80); 303 cx24123_writereg(state, 0x10, cx24123_readreg(state, 0x10) | 0x80);
291 break; 304 break;
292 case INVERSION_AUTO: 305 case INVERSION_AUTO:
306 dprintk("%s: inversion auto\n",__FUNCTION__);
293 cx24123_writereg(state, 0x10, cx24123_readreg(state, 0x10) & 0x7f); 307 cx24123_writereg(state, 0x10, cx24123_readreg(state, 0x10) & 0x7f);
294 break; 308 break;
295 default: 309 default:
@@ -305,10 +319,13 @@ static int cx24123_get_inversion(struct cx24123_state* state, fe_spectral_invers
305 319
306 val = cx24123_readreg(state, 0x1b) >> 7; 320 val = cx24123_readreg(state, 0x1b) >> 7;
307 321
308 if (val == 0) 322 if (val == 0) {
323 dprintk("%s: read inversion off\n",__FUNCTION__);
309 *inversion = INVERSION_OFF; 324 *inversion = INVERSION_OFF;
310 else 325 } else {
326 dprintk("%s: read inversion on\n",__FUNCTION__);
311 *inversion = INVERSION_ON; 327 *inversion = INVERSION_ON;
328 }
312 329
313 return 0; 330 return 0;
314} 331}
@@ -321,18 +338,25 @@ static int cx24123_set_fec(struct cx24123_state* state, fe_code_rate_t fec)
321 /* Hardware has 5/11 and 3/5 but are never unused */ 338 /* Hardware has 5/11 and 3/5 but are never unused */
322 switch (fec) { 339 switch (fec) {
323 case FEC_NONE: 340 case FEC_NONE:
341 dprintk("%s: set FEC to none\n",__FUNCTION__);
324 return cx24123_writereg(state, 0x0f, 0x01); 342 return cx24123_writereg(state, 0x0f, 0x01);
325 case FEC_1_2: 343 case FEC_1_2:
344 dprintk("%s: set FEC to 1/2\n",__FUNCTION__);
326 return cx24123_writereg(state, 0x0f, 0x02); 345 return cx24123_writereg(state, 0x0f, 0x02);
327 case FEC_2_3: 346 case FEC_2_3:
347 dprintk("%s: set FEC to 2/3\n",__FUNCTION__);
328 return cx24123_writereg(state, 0x0f, 0x04); 348 return cx24123_writereg(state, 0x0f, 0x04);
329 case FEC_3_4: 349 case FEC_3_4:
350 dprintk("%s: set FEC to 3/4\n",__FUNCTION__);
330 return cx24123_writereg(state, 0x0f, 0x08); 351 return cx24123_writereg(state, 0x0f, 0x08);
331 case FEC_5_6: 352 case FEC_5_6:
353 dprintk("%s: set FEC to 4/5\n",__FUNCTION__);
332 return cx24123_writereg(state, 0x0f, 0x20); 354 return cx24123_writereg(state, 0x0f, 0x20);
333 case FEC_7_8: 355 case FEC_7_8:
356 dprintk("%s: set FEC to 5/6\n",__FUNCTION__);
334 return cx24123_writereg(state, 0x0f, 0x80); 357 return cx24123_writereg(state, 0x0f, 0x80);
335 case FEC_AUTO: 358 case FEC_AUTO:
359 dprintk("%s: set FEC to auto\n",__FUNCTION__);
336 return cx24123_writereg(state, 0x0f, 0xae); 360 return cx24123_writereg(state, 0x0f, 0xae);
337 default: 361 default:
338 return -EOPNOTSUPP; 362 return -EOPNOTSUPP;
@@ -510,6 +534,8 @@ static int cx24123_pll_writereg(struct dvb_frontend* fe, struct dvb_frontend_par
510 struct cx24123_state *state = fe->demodulator_priv; 534 struct cx24123_state *state = fe->demodulator_priv;
511 unsigned long timeout; 535 unsigned long timeout;
512 536
537 dprintk("%s: pll writereg called, data=0x%08x\n",__FUNCTION__,data);
538
513 /* align the 21 bytes into to bit23 boundary */ 539 /* align the 21 bytes into to bit23 boundary */
514 data = data << 3; 540 data = data << 3;
515 541
@@ -581,6 +607,9 @@ static int cx24123_pll_tune(struct dvb_frontend* fe, struct dvb_frontend_paramet
581 cx24123_writereg(state, 0x27, state->FILTune >> 2); 607 cx24123_writereg(state, 0x27, state->FILTune >> 2);
582 cx24123_writereg(state, 0x28, val | (state->FILTune & 0x3)); 608 cx24123_writereg(state, 0x28, val | (state->FILTune & 0x3));
583 609
610 dprintk("%s: pll tune VCA=%d, band=%d, pll=%d\n",__FUNCTION__,state->VCAarg,
611 state->bandselectarg,state->pllarg);
612
584 return 0; 613 return 0;
585} 614}
586 615
@@ -589,6 +618,8 @@ static int cx24123_initfe(struct dvb_frontend* fe)
589 struct cx24123_state *state = fe->demodulator_priv; 618 struct cx24123_state *state = fe->demodulator_priv;
590 int i; 619 int i;
591 620
621 dprintk("%s: init frontend\n",__FUNCTION__);
622
592 /* Configure the demod to a good set of defaults */ 623 /* Configure the demod to a good set of defaults */
593 for (i = 0; i < sizeof(cx24123_regdata) / sizeof(cx24123_regdata[0]); i++) 624 for (i = 0; i < sizeof(cx24123_regdata) / sizeof(cx24123_regdata[0]); i++)
594 cx24123_writereg(state, cx24123_regdata[i].reg, cx24123_regdata[i].data); 625 cx24123_writereg(state, cx24123_regdata[i].reg, cx24123_regdata[i].data);
@@ -616,10 +647,13 @@ static int cx24123_set_voltage(struct dvb_frontend* fe, fe_sec_voltage_t voltage
616 647
617 switch (voltage) { 648 switch (voltage) {
618 case SEC_VOLTAGE_13: 649 case SEC_VOLTAGE_13:
650 dprintk("%s: isl6421 voltage = 13V\n",__FUNCTION__);
619 return cx24123_writelnbreg(state, 0x0, val & 0x32); /* V 13v */ 651 return cx24123_writelnbreg(state, 0x0, val & 0x32); /* V 13v */
620 case SEC_VOLTAGE_18: 652 case SEC_VOLTAGE_18:
653 dprintk("%s: isl6421 voltage = 18V\n",__FUNCTION__);
621 return cx24123_writelnbreg(state, 0x0, val | 0x04); /* H 18v */ 654 return cx24123_writelnbreg(state, 0x0, val | 0x04); /* H 18v */
622 case SEC_VOLTAGE_OFF: 655 case SEC_VOLTAGE_OFF:
656 dprintk("%s: isl5421 voltage off\n",__FUNCTION__);
623 return cx24123_writelnbreg(state, 0x0, val & 0x30); 657 return cx24123_writelnbreg(state, 0x0, val & 0x30);
624 default: 658 default:
625 return -EINVAL; 659 return -EINVAL;
@@ -780,6 +814,8 @@ static int cx24123_read_ber(struct dvb_frontend* fe, u32* ber)
780 else 814 else
781 state->snr = 0; 815 state->snr = 0;
782 816
817 dprintk("%s: BER = %d, S/N index = %d\n",__FUNCTION__,state->lastber, state->snr);
818
783 *ber = state->lastber; 819 *ber = state->lastber;
784 820
785 return 0; 821 return 0;
@@ -790,6 +826,8 @@ static int cx24123_read_signal_strength(struct dvb_frontend* fe, u16* signal_str
790 struct cx24123_state *state = fe->demodulator_priv; 826 struct cx24123_state *state = fe->demodulator_priv;
791 *signal_strength = cx24123_readreg(state, 0x3b) << 8; /* larger = better */ 827 *signal_strength = cx24123_readreg(state, 0x3b) << 8; /* larger = better */
792 828
829 dprintk("%s: Signal strength = %d\n",__FUNCTION__,*signal_strength);
830
793 return 0; 831 return 0;
794} 832}
795 833
@@ -798,6 +836,8 @@ static int cx24123_read_snr(struct dvb_frontend* fe, u16* snr)
798 struct cx24123_state *state = fe->demodulator_priv; 836 struct cx24123_state *state = fe->demodulator_priv;
799 *snr = state->snr; 837 *snr = state->snr;
800 838
839 dprintk("%s: read S/N index = %d\n",__FUNCTION__,*snr);
840
801 return 0; 841 return 0;
802} 842}
803 843
@@ -806,6 +846,8 @@ static int cx24123_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks)
806 struct cx24123_state *state = fe->demodulator_priv; 846 struct cx24123_state *state = fe->demodulator_priv;
807 *ucblocks = state->lastber; 847 *ucblocks = state->lastber;
808 848
849 dprintk("%s: ucblocks (ber) = %d\n",__FUNCTION__,*ucblocks);
850
809 return 0; 851 return 0;
810} 852}
811 853
@@ -813,6 +855,8 @@ static int cx24123_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_par
813{ 855{
814 struct cx24123_state *state = fe->demodulator_priv; 856 struct cx24123_state *state = fe->demodulator_priv;
815 857
858 dprintk("%s: set_frontend\n",__FUNCTION__);
859
816 if (state->config->set_ts_params) 860 if (state->config->set_ts_params)
817 state->config->set_ts_params(fe, 0); 861 state->config->set_ts_params(fe, 0);
818 862
@@ -836,6 +880,8 @@ static int cx24123_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_par
836{ 880{
837 struct cx24123_state *state = fe->demodulator_priv; 881 struct cx24123_state *state = fe->demodulator_priv;
838 882
883 dprintk("%s: get_frontend\n",__FUNCTION__);
884
839 if (cx24123_get_inversion(state, &p->inversion) != 0) { 885 if (cx24123_get_inversion(state, &p->inversion) != 0) {
840 printk("%s: Failed to get inversion status\n",__FUNCTION__); 886 printk("%s: Failed to get inversion status\n",__FUNCTION__);
841 return -EREMOTEIO; 887 return -EREMOTEIO;
@@ -862,8 +908,10 @@ static int cx24123_set_tone(struct dvb_frontend* fe, fe_sec_tone_mode_t tone)
862 908
863 switch (tone) { 909 switch (tone) {
864 case SEC_TONE_ON: 910 case SEC_TONE_ON:
911 dprintk("%s: isl6421 sec tone on\n",__FUNCTION__);
865 return cx24123_writelnbreg(state, 0x0, val | 0x10); 912 return cx24123_writelnbreg(state, 0x0, val | 0x10);
866 case SEC_TONE_OFF: 913 case SEC_TONE_OFF:
914 dprintk("%s: isl6421 sec tone off\n",__FUNCTION__);
867 return cx24123_writelnbreg(state, 0x0, val & 0x2f); 915 return cx24123_writelnbreg(state, 0x0, val & 0x2f);
868 default: 916 default:
869 printk("%s: CASE reached default with tone=%d\n", __FUNCTION__, tone); 917 printk("%s: CASE reached default with tone=%d\n", __FUNCTION__, tone);
@@ -980,7 +1028,7 @@ static struct dvb_frontend_ops cx24123_ops = {
980}; 1028};
981 1029
982module_param(debug, int, 0644); 1030module_param(debug, int, 0644);
983MODULE_PARM_DESC(debug, "Turn on/off frontend debugging (default:off)."); 1031MODULE_PARM_DESC(debug, "Activates frontend debugging (default:0)");
984 1032
985MODULE_DESCRIPTION("DVB Frontend module for Conexant cx24123/cx24109 hardware"); 1033MODULE_DESCRIPTION("DVB Frontend module for Conexant cx24123/cx24109 hardware");
986MODULE_AUTHOR("Steven Toth"); 1034MODULE_AUTHOR("Steven Toth");