diff options
author | Johannes Stezenbach <devnull@localhost> | 2003-09-24 16:12:20 +0000 |
---|---|---|
committer | Johannes Stezenbach <devnull@localhost> | 2003-09-24 16:12:20 +0000 |
commit | 825185ba1ecb3df44a86576df11669a5c8c1cb60 (patch) | |
tree | eea77e8b7b93575527b70658d038aec7641fcdb3 /linux/drivers/media/dvb/frontends/ves1820.c | |
parent | f4966c6d0360ca710d2d5fa52c689d1981369e94 (diff) | |
download | mediapointer-dvb-s2-825185ba1ecb3df44a86576df11669a5c8c1cb60.tar.gz mediapointer-dvb-s2-825185ba1ecb3df44a86576df11669a5c8c1cb60.tar.bz2 |
- patch by Peter Bieringer: nicer log output
- removed whitespace at eol
Diffstat (limited to 'linux/drivers/media/dvb/frontends/ves1820.c')
-rw-r--r-- | linux/drivers/media/dvb/frontends/ves1820.c | 76 |
1 files changed, 39 insertions, 37 deletions
diff --git a/linux/drivers/media/dvb/frontends/ves1820.c b/linux/drivers/media/dvb/frontends/ves1820.c index c6c9bc638..3a59fa979 100644 --- a/linux/drivers/media/dvb/frontends/ves1820.c +++ b/linux/drivers/media/dvb/frontends/ves1820.c @@ -1,4 +1,4 @@ -/* +/* VES1820 - Single Chip Cable Channel Receiver driver module used on the the Siemens DVB-C cards @@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ +*/ #include <linux/errno.h> #include <linux/init.h> @@ -42,23 +42,23 @@ * extra memory but use frontend->data as bitfield */ -#define SET_PWM(data,pwm) do { \ - (long) data &= ~0xff; \ - (long) data |= pwm; \ +#define SET_PWM(data,pwm) do { \ + (long) data &= ~0xff; \ + (long) data |= pwm; \ } while (0) #define SET_REG0(data,reg0) do { \ - (long) data &= ~(0xff << 8); \ - (long) data |= reg0 << 8; \ + (long) data &= ~(0xff << 8); \ + (long) data |= reg0 << 8; \ } while (0) #define SET_TUNER(data,type) do { \ - (long) data &= ~(0xff << 16); \ + (long) data &= ~(0xff << 16); \ (long) data |= type << 16; \ } while (0) #define SET_DEMOD_ADDR(data,type) do { \ - (long) data &= ~(0xff << 24); \ + (long) data &= ~(0xff << 24); \ (long) data |= type << 24; \ } while (0) @@ -86,7 +86,7 @@ static struct dvb_frontend_info ves1820_info = { .notifier_delay = ?, #endif .caps = FE_CAN_QAM_16 | FE_CAN_QAM_32 | FE_CAN_QAM_64 | - FE_CAN_QAM_128 | FE_CAN_QAM_256 | + FE_CAN_QAM_128 | FE_CAN_QAM_256 | FE_CAN_FEC_AUTO | FE_CAN_INVERSION_AUTO | FE_CAN_CLEAN_SETUP | FE_CAN_RECOVER }; @@ -116,9 +116,9 @@ static int ves1820_writereg (struct dvb_frontend *fe, u8 reg, u8 data) ret = i2c->xfer (i2c, &msg, 1); if (ret != 1) - dprintk("%s: writereg error " + printk("DVB: VES1820(%d): %s, writereg error " "(reg == 0x%02x, val == 0x%02x, ret == %i)\n", - __FUNCTION__, reg, data, ret); + fe->i2c->adapter->num, __FUNCTION__, reg, data, ret); dvb_delay(10); return (ret != 1) ? -EREMOTEIO : 0; @@ -138,7 +138,8 @@ static u8 ves1820_readreg (struct dvb_frontend *fe, u8 reg) ret = i2c->xfer (i2c, msg, 2); if (ret != 2) - dprintk("%s: readreg error (ret == %i)\n", __FUNCTION__, ret); + printk("DVB: VES1820(%d): %s: readreg error (ret == %i)\n", + fe->i2c->adapter->num, __FUNCTION__, ret); return b1[0]; } @@ -152,7 +153,8 @@ static int tuner_write (struct dvb_i2c_bus *i2c, u8 addr, u8 data [4]) ret = i2c->xfer (i2c, &msg, 1); if (ret != 1) - printk("%s: i/o error (ret == %i)\n", __FUNCTION__, ret); + printk("DVB: VES1820(%d): %s: i/o error (ret == %i)\n", + i2c->adapter->num, __FUNCTION__, ret); return (ret != 1) ? -EREMOTEIO : 0; } @@ -207,7 +209,7 @@ static int ves1820_setup_reg0 (struct dvb_frontend *fe, u8 reg0, reg0 &= ~0x20; else if (INVERSION_OFF == inversion) reg0 |= 0x20; - + ves1820_writereg (fe, 0x00, reg0 & 0xfe); ves1820_writereg (fe, 0x00, reg0 | 0x01); @@ -219,7 +221,7 @@ static int ves1820_setup_reg0 (struct dvb_frontend *fe, u8 reg0, if (!(ves1820_readreg (fe, 0x11) & 0x08)) { reg0 ^= 0x20; ves1820_writereg (fe, 0x00, reg0 & 0xfe); - ves1820_writereg (fe, 0x00, reg0 | 0x01); + ves1820_writereg (fe, 0x00, reg0 | 0x01); } } @@ -232,15 +234,15 @@ static int ves1820_setup_reg0 (struct dvb_frontend *fe, u8 reg0, static int ves1820_init (struct dvb_frontend *fe) { int i; - - dprintk("VES1820: init chip\n"); + + dprintk("DVB: VES1820(%d): init chip\n", fe->i2c->adapter->num); ves1820_writereg (fe, 0, 0); for (i=0; i<53; i++) ves1820_writereg (fe, i, ves1820_inittab[i]); - ves1820_writereg (fe, 0x34, GET_PWM(fe->data)); + ves1820_writereg (fe, 0x34, GET_PWM(fe->data)); return 0; } @@ -248,13 +250,13 @@ static int ves1820_init (struct dvb_frontend *fe) static int ves1820_set_symbolrate (struct dvb_frontend *fe, u32 symbolrate) { - s32 BDR; + s32 BDR; s32 BDRI; s16 SFIL=0; u16 NDEC = 0; u32 tmp, ratio; - if (symbolrate > XIN/2) + if (symbolrate > XIN/2) symbolrate = XIN/2; if (symbolrate < 500000) @@ -271,22 +273,22 @@ static int ves1820_set_symbolrate (struct dvb_frontend *fe, u32 symbolrate) if (symbolrate < (u32)(XIN/49.2)) SFIL = 1; if (symbolrate < (u32)(XIN/64)) SFIL = 0; if (symbolrate < (u32)(XIN/98.4)) SFIL = 1; - + symbolrate <<= NDEC; ratio = (symbolrate << 4) / FIN; tmp = ((symbolrate << 4) % FIN) << 8; ratio = (ratio << 8) + tmp / FIN; tmp = (tmp % FIN) << 8; ratio = (ratio << 8) + (tmp + FIN/2) / FIN; - + BDR = ratio; BDRI = (((XIN << 5) / symbolrate) + 1) / 2; - - if (BDRI > 0xFF) + + if (BDRI > 0xFF) BDRI = 0xFF; - + SFIL = (SFIL << 4) | ves1820_inittab[0x0E]; - + NDEC = (NDEC << 6) | ves1820_inittab[0x03]; ves1820_writereg (fe, 0x03, NDEC); @@ -354,7 +356,7 @@ static int ves1820_ioctl (struct dvb_frontend *fe, unsigned int cmd, void *arg) if (sync & 2) /* XXX FIXME! */ *status |= FE_HAS_VITERBI; - + if (sync & 4) *status |= FE_HAS_SYNC; @@ -409,7 +411,7 @@ static int ves1820_ioctl (struct dvb_frontend *fe, unsigned int cmd, void *arg) if (sync & 2) /* AFC only valid when carrier has been recovered */ afc = ves1820_readreg(fe, 0x19); - printk ("%s: AFC (%d) %dHz\n", __FILE__, afc, + dprintk ("DVB: VES1820(%d): AFC (%d) %dHz\n", fe->i2c->adapter->num, afc, -((s32)(p->u.qam.symbol_rate >> 3) * afc >> 7)); @@ -437,12 +439,12 @@ static int ves1820_ioctl (struct dvb_frontend *fe, unsigned int cmd, void *arg) } return 0; -} +} static long probe_tuner (struct dvb_i2c_bus *i2c) { - static const struct i2c_msg msg1 = + static const struct i2c_msg msg1 = { .addr = 0x61, .flags = 0, .buf = NULL, .len = 0 }; static const struct i2c_msg msg2 = { .addr = 0x62, .flags = 0, .buf = NULL, .len = 0 }; @@ -450,15 +452,14 @@ static long probe_tuner (struct dvb_i2c_bus *i2c) if (i2c->xfer(i2c, &msg1, 1) == 1) { type = 0; - printk ("%s: setup for tuner spXXXX\n", __FILE__); + printk ("DVB: VES1820(%d): setup for tuner spXXXX\n", i2c->adapter->num); } else if (i2c->xfer(i2c, &msg2, 1) == 1) { type = 1; - printk ("%s: setup for tuner sp5659c\n", __FILE__); + printk ("DVB: VES1820(%d): setup for tuner sp5659c\n", i2c->adapter->num); } else { type = -1; - printk ("%s: unknown PLL, " - "please report to <linuxdvb@linuxtv.org>!!\n", - __FILE__); + printk ("DVB: VES1820(%d): unknown PLL, " + "please report to <linuxdvb@linuxtv.org>!!\n", i2c->adapter->num); } return type; @@ -474,7 +475,7 @@ static u8 read_pwm (struct dvb_i2c_bus *i2c) i2c->xfer (i2c, msg, 2); - dprintk("VES1820: pwm=%02x\n", pwm); + dprintk("DVB: VES1820(%d): pwm=0x%02x\n", i2c->adapter->num, pwm); if (pwm == 0xff) pwm = 0x48; @@ -533,6 +534,7 @@ static void ves1820_detach (struct dvb_i2c_bus *i2c) static int __init init_ves1820 (void) { + dprintk("DVB: VES1820: module loaded\n"); return dvb_register_i2c_device (THIS_MODULE, ves1820_attach, ves1820_detach); } |