? driver/av7110/Root.1.1.2.7 Index: driver/dvb_frontend.c =================================================================== RCS file: /cvs/linuxtv/DVB/driver/dvb_frontend.c,v retrieving revision 1.13 diff -u -r1.13 dvb_frontend.c --- driver/dvb_frontend.c 14 Oct 2002 09:09:02 -0000 1.13 +++ driver/dvb_frontend.c 16 Oct 2002 09:29:51 -0000 @@ -110,7 +110,8 @@ { int err = -EOPNOTSUPP; - dprintk ("%s\n", __FUNCTION__); + dprintk ("%s DIR:%u TYPE:%u NR:%u SIZE:%u\n", __FUNCTION__, + _IOC_DIR(cmd), _IOC_TYPE(cmd), _IOC_NR(cmd), _IOC_SIZE(cmd)); if (frontend->before_ioctl) err = frontend->before_ioctl (frontend, cmd, arg); @@ -363,7 +364,7 @@ init_param = &default_param[fe->info->type-FE_QPSK]; - dvb_frontend_set_parameters (fe, init_param, 1); + // dvb_frontend_set_parameters (fe, init_param, 1); } @@ -417,7 +418,7 @@ /** * let's start a zigzag scan to compensate LNB drift... */ - if (j > HZ/2) { + if (FE_QPSK == fe->info->type && j > HZ/2) { struct dvb_frontend_parameters *p = &fe->parameters; p->frequency -= fe->lnb_drift; @@ -426,7 +427,7 @@ dvb_frontend_set_parameters (fe, &fe->parameters, 0); } - dvb_frontend_internal_ioctl (&fe->frontend, FE_RESET, NULL); + // dvb_frontend_internal_ioctl (&fe->frontend, FE_RESET, NULL); } Index: driver/av7110/Makefile =================================================================== RCS file: /cvs/linuxtv/DVB/driver/av7110/Makefile,v retrieving revision 1.2 diff -u -r1.2 Makefile --- driver/av7110/Makefile 10 Oct 2002 19:22:29 -0000 1.2 +++ driver/av7110/Makefile 16 Oct 2002 09:29:51 -0000 @@ -70,7 +70,9 @@ insmod: insmod input; \ insmod evdev; \ - insmod dvb-ttpci.o init_vpid=0x00a2 init_apid=0x0060; + insmod dvb-ttpci.o + +# init_vpid=0x00a2 init_apid=0x0060; rmmod: rmmod dvb-ttpci; \ Index: driver/frontends/Makefile =================================================================== RCS file: /cvs/linuxtv/DVB/driver/frontends/Makefile,v retrieving revision 1.2 diff -u -r1.2 Makefile --- driver/frontends/Makefile 10 Oct 2002 19:22:30 -0000 1.2 +++ driver/frontends/Makefile 16 Oct 2002 09:29:51 -0000 @@ -18,7 +18,8 @@ ifdef DVB_PACK -obj-m += alps_bsru6.o alps_bsrv2.o grundig_29504-401.o grundig_29504-491.o ves1820.o +obj-m += ves1820.o +#obj-m += alps_bsru6.o alps_bsrv2.o grundig_29504-401.o grundig_29504-491.o ves1820.o EXTRA_CFLAGS = -I ../../include -I . -g -I.. else obj-$(CONFIG_DVB_ALPS_BSRU6) += alps_bsru6.o @@ -54,7 +55,7 @@ -rm -f $(M_OBJS) $(MX_OBJS) *.o .*.o.flags *~ insmod: - $(foreach frontend, $(obj-m), insmod $(frontend); ) + $(foreach frontend, $(obj-m), insmod $(frontend) debug=1; ) rmmod: $(foreach frontend, $(obj-m), rmmod $(frontend:.o=); ) Index: driver/frontends/ves1820.c =================================================================== RCS file: /cvs/linuxtv/DVB/driver/frontends/ves1820.c,v retrieving revision 1.7 diff -u -r1.7 ves1820.c --- driver/frontends/ves1820.c 15 Oct 2002 10:40:36 -0000 1.7 +++ driver/frontends/ves1820.c 16 Oct 2002 09:29:52 -0000 @@ -147,6 +147,23 @@ * set up the downconverter frequency divisor for a * reference clock comparision frequency of 62.5 kHz. */ + +/* + * Tuner Mitel SP5659 (tuner_type==1) + * buf[2]: 1 2^16 2^15 PE R3 R2 R1 R0 + * 1 0 0 0 0 1 0 1 + * PE = prescaler, enables 2.7GHz operation. Not needed, set to 0 + * 2^16, 2^15 = high bits of divider + * R3..0 = division ratio, 0101 = 64, corresponds to comp. freq 62.5kHz + * with 4MHz external reference. + * buf[3]: C1 C0 RE RTS P3 P2/TS2 P1/TS1 P0/TS0 + * 1 0 0 0 0 1 0 0 + * C1,0 = charge pump current, 10 = +-555ľA + * RE = REF/COMP output enable + * RTS = 0=REF output, 1=COMP output. (RE,RTS)=(0,0) = normal operation. + * TS2..0 = test mode control bits + * P3..0 = port P3..0 output, 1000 (<174MHz), 0100 (<470MHz), 0001 (>470MHz) + */ static int tuner_set_tv_freq (struct dvb_frontend *frontend, u32 freq) { @@ -156,7 +173,7 @@ int tuner_type = GET_TUNER(frontend); u8 buf [4]; - div = (freq + 36125000) / 62500; + div = (freq + 36000000) / 62500; buf[0] = (div >> 8) & 0x7f; buf[1] = div & 0xff; buf[2] = byte3[tuner_type]; @@ -170,6 +187,11 @@ freq < 454000000 ? 0x92 : 0x34); } + dprintk ("%s: tuning to %u.%06u MHz\n", + __FILE__, + (div * 62500 - 36000000) / 1000000, + (div * 62500 - 36000000) % 1000000); + return tuner_write (frontend->i2c, addr[tuner_type], buf); } @@ -250,9 +272,7 @@ SET_REG0(frontend, reg0); ves1820_writereg (i2c, 0x00, reg0 & 0xfe); - ves1820_writereg (i2c, 0x00, reg0); - - return 0; + return ves1820_writereg (i2c, 0x00, reg0); } @@ -262,10 +282,9 @@ struct dvb_i2c_bus *i2c = frontend->i2c; u8 reg0 = GET_REG0(frontend); + dprintk ("%s: reset\n", __FILE__); ves1820_writereg (i2c, 0x00, reg0 & 0xfe); - ves1820_writereg (i2c, 0x00, reg0); - - return 0; + return ves1820_writereg (i2c, 0x00, reg0); } @@ -337,11 +356,11 @@ static -void ves1820_reset_pwm (struct dvb_frontend *frontend) +int ves1820_reset_pwm (struct dvb_frontend *frontend) { u8 pwm = GET_PWM(frontend); - ves1820_writereg (frontend->i2c, 0x34, pwm); + return ves1820_writereg (frontend->i2c, 0x34, pwm); } @@ -359,7 +378,7 @@ { QAM_16, 16, 140, 164, 162, 145 }, { QAM_32, 32, 140, 120, 116, 150 }, { QAM_64, 64, 106, 70, 67, 106 }, - { QAM_128, 128, 120, 54, 52, 126 }, + { QAM_128, 128, 84, 48, 46, 154 }, { QAM_256, 256, 92, 38, 35, 107 } }; @@ -390,12 +409,25 @@ ves1820_writereg (i2c, 0x08, QAM_Values[real_qam].Reg8); ves1820_writereg (i2c, 0x09, QAM_Values[real_qam].Reg9); - ves1820_setup_reg0 (frontend, real_qam, p->inversion); - - return 0; + return ves1820_setup_reg0 (frontend, real_qam, p->inversion); } +static +int ves1820_set_qam (struct dvb_frontend *frontend, struct dvb_qam_setting *values) +{ + int ret; + struct dvb_i2c_bus* i2c = frontend->i2c; + + ret = ves1820_writereg (i2c, 0x01, values->Reg1); + if (ret < 0) return ret; + ret = ves1820_writereg (i2c, 0x05, values->Reg5); + if (ret < 0) return ret; + ret = ves1820_writereg (i2c, 0x08, values->Reg8); + if (ret < 0) return ret; + return ves1820_writereg (i2c, 0x09, values->Reg9); +} + static int ves1820_ioctl (struct dvb_frontend *frontend, unsigned int cmd, void *arg) @@ -480,8 +512,16 @@ return ves1820_init (frontend); case FE_RESET: - ves1820_reset (frontend); - break; + return ves1820_reset (frontend); + + case FE_RESET_PWM: + return ves1820_reset_pwm (frontend); + + case FE_SET_FREQ: + return tuner_set_tv_freq (frontend, *(uint32_t *)arg); + + case FE_SET_QAM: + return ves1820_set_qam (frontend, arg); default: return -EINVAL; @@ -533,3 +573,7 @@ MODULE_LICENSE("GPL"); MODULE_PARM(debug,"i"); + +// Local variables: +// c-basic-offset: 8 +// End: Index: include/linux/dvb/frontend.h =================================================================== RCS file: /cvs/linuxtv/DVB/include/linux/dvb/frontend.h,v retrieving revision 1.4 diff -u -r1.4 frontend.h --- include/linux/dvb/frontend.h 10 Oct 2002 20:13:27 -0000 1.4 +++ include/linux/dvb/frontend.h 16 Oct 2002 09:29:52 -0000 @@ -256,6 +256,29 @@ #define FE_GET_FRONTEND _IOR('o', 77, struct dvb_frontend_parameters) #define FE_GET_EVENT _IOR('o', 78, struct dvb_frontend_event) +struct dvb_qam_setting { + fe_modulation_t QAM_Mode; + int NoOfSym; + uint8_t Reg1; + uint8_t Reg5; + uint8_t Reg8; + uint8_t Reg9; +}; + +#define FE_SET_QAM _IOW('o', 79, struct dvb_qam_setting) +#define FE_SET_FREQ _IOW('o', 80, uint32_t) +#define FE_RESET_PWM _IO('o', 81) + +/* dvb_frontend.h has these for private use */ +#ifndef FE_SLEEP +#define FE_SLEEP _IO('v', 80) +#endif +#ifndef FE_INIT +#define FE_INIT _IO('v', 81) +#endif +#ifndef FE_RESET +#define FE_RESET _IO('v', 82) +#endif #endif /*_FRONTEND_H_*/