diff options
author | Johannes Stezenbach <devnull@localhost> | 2003-09-24 16:59:42 +0000 |
---|---|---|
committer | Johannes Stezenbach <devnull@localhost> | 2003-09-24 16:59:42 +0000 |
commit | 906c0081fc44f4f3ee871e49ece0b35dd1d48fcb (patch) | |
tree | 8e6411808967f5642e7903c645514b700ff07442 | |
parent | 825185ba1ecb3df44a86576df11669a5c8c1cb60 (diff) | |
download | mediapointer-dvb-s2-906c0081fc44f4f3ee871e49ece0b35dd1d48fcb.tar.gz mediapointer-dvb-s2-906c0081fc44f4f3ee871e49ece0b35dd1d48fcb.tar.bz2 |
allow PWM (tuner calibaration) value from EEPROM to be overridden
on command line (based on patch by Peter Bieringer)
New module paramters: "pwm" (max 4 ints, range -1..0xff)
and "verbose" (to print AFC value aftger tuning).
-rw-r--r-- | linux/drivers/media/dvb/frontends/ves1820.c | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/linux/drivers/media/dvb/frontends/ves1820.c b/linux/drivers/media/dvb/frontends/ves1820.c index 3a59fa979..ac1ca02fd 100644 --- a/linux/drivers/media/dvb/frontends/ves1820.c +++ b/linux/drivers/media/dvb/frontends/ves1820.c @@ -36,6 +36,9 @@ #define dprintk(x...) #endif +#define MAX_UNITS 4 +static int pwm[MAX_UNITS] = { -1, -1, -1, -1 }; +static int verbose; /** * since we need only a few bits to store internal state we don't allocate @@ -411,9 +414,10 @@ 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); - dprintk ("DVB: VES1820(%d): AFC (%d) %dHz\n", fe->i2c->adapter->num, afc, - -((s32)(p->u.qam.symbol_rate >> 3) * afc >> 7)); - + if (verbose) + printk ("DVB: VES1820(%d): AFC (%d) %dHz\n", + fe->i2c->adapter->num, afc, + -((s32)(p->u.qam.symbol_rate >> 3) * afc >> 7)); p->inversion = reg0 & 0x20 ? INVERSION_OFF : INVERSION_ON; p->u.qam.modulation = ((reg0 >> 2) & 7) + QAM_16; @@ -475,7 +479,7 @@ static u8 read_pwm (struct dvb_i2c_bus *i2c) i2c->xfer (i2c, msg, 2); - dprintk("DVB: VES1820(%d): pwm=0x%02x\n", i2c->adapter->num, pwm); + printk("DVB: VES1820(%d): pwm=0x%02x\n", i2c->adapter->num, pwm); if (pwm == 0xff) pwm = 0x48; @@ -515,7 +519,13 @@ static int ves1820_attach (struct dvb_i2c_bus *i2c) if ((tuner_type = probe_tuner(i2c)) < 0) return -ENODEV; - SET_PWM(data, read_pwm(i2c)); + if ((i2c->adapter->num < MAX_UNITS) && pwm[i2c->adapter->num] != -1) { + printk("DVB: VES1820(%d): pwm=0x%02x (user specified)\n", + i2c->adapter->num, pwm[i2c->adapter->num]); + SET_PWM(data, pwm[i2c->adapter->num]); + } + else + SET_PWM(data, read_pwm(i2c)); SET_REG0(data, ves1820_inittab[0]); SET_TUNER(data, tuner_type); SET_DEMOD_ADDR(data, demod_addr); @@ -534,7 +544,10 @@ static void ves1820_detach (struct dvb_i2c_bus *i2c) static int __init init_ves1820 (void) { - dprintk("DVB: VES1820: module loaded\n"); + int i; + for (i = 0; i < MAX_UNITS; i++) + if (pwm[i] < -1 || pwm[i] > 255) + return -EINVAL; return dvb_register_i2c_device (THIS_MODULE, ves1820_attach, ves1820_detach); } @@ -549,6 +562,11 @@ static void __exit exit_ves1820 (void) module_init(init_ves1820); module_exit(exit_ves1820); +MODULE_PARM(pwm, "1-" __MODULE_STRING(MAX_UNITS) "i"); +MODULE_PARM_DESC(pwm, "override PWM value stored in EEPROM (tuner calibration)"); +MODULE_PARM(verbose, "i"); +MODULE_PARM_DESC(verbose, "print AFC offset after tuning for debugging the PWM setting"); + MODULE_DESCRIPTION("VES1820 DVB-C frontend driver"); MODULE_AUTHOR("Ralph Metzler, Holger Waechtler"); MODULE_LICENSE("GPL"); |