[linux-dvb] [PATCH] AVerMedia AVerTV DVB-T 771
Hi, I created some patches to support the AVerMedia AVerTV DVB-T 771 card. The drivers aren't finished yet (mt352 doesn't support all ioctls, analog settings for the bt878 are wrong, I did only a short test with dvbsnoop). The patches are available here: http://www.frokaschwei.net/avtv771/avermedia.html Wolfram
[linux-dvb] Re: avertv 771
Hi, thx, Wolfgang Joost, the patches seem to work, i have made some small cleanups on the bttv-cards.c. I already send corrected data to bytesex.org: /* card 0x79 -- */ .name = AVerMedia AVerTV DVB-T 771, .video_inputs = 2, .tuner = -1, .svhs = 1, .muxsel = { 3 , 3 }, .no_msp34xx = 1, .no_tda9875 = 1, .no_tda7432 = 1, .pll= PLL_28, .tuner_type = -1, .has_dvb= 1, .no_gpioirq = 1, .has_remote = 1, With these data, svhs and composite work. What did you change? i will test how it works with mythtv. if it works fine i will cleanup the drivers or make some optimizations. I'm still working on the driver. Wait a little bit ;) Wolfram
[linux-dvb] Re: avertv 771
Hi, ok, i have tested now with mythtv, it works perfectly, very special thanks :) to Wolfram Joost, my friend Daniel and JK Jung for their work on the drivers. i think some cleanups maybe should be done for the drivers and Currently working on the *_AUTO-parameters. Ioctls FE_GET_FRONTEND and FE_RESET work. I'll update my patches this evening. then the cvs should be patched. a kernel 2.6.7 release with these would be [EMAIL PROTECTED] wrote me that he added the settings for the card to bttv-cards.c Wolfram
[linux-dvb] Re: [PATCH] mt352 TPS_GIVEN shifts were wrong
Hi, Here's a patch against CVS for the mt352 driver. The TPS_GIVEN fields had the wrong shifts (consistently off by 1) so it wouldn't tune for yeah, I found this bug, too ;) Wolfram
[linux-dvb] Re: V-Stream DVB-T and linux
Hi, Currently we are aware that you use the Connexant cx23883 as the PCI interface and a Samsung tuner Which tuner do they use? Is the mt352 part of the tuner? If yes, its probably the same tuner AVerMedia used for their 771-card... Have a look at http://www.sem.samsung.com/en/products/productOverview.jsp?categoryID=2C9D98F2-A126-B447-E1B3872409AC4242navi=overview Wolfram
[linux-dvb] [PATCH] mt352.c
Hi, here is my final version. The diffs are against the current cvs-version. From my point of view they can be commited. Wolfram --- bt878.c.cvs 2004-06-07 19:51:03.0 +0200 +++ bt878.c 2004-06-07 19:54:02.0 +0200 @@ -293,7 +293,7 @@ (astat BT878_ASCERR) ? SCERR : , (astat BT878_AOCERR) ? OCERR : - , btread(BT878_ARISC_PC)); + , le32_to_cpu(btread(BT878_ARISC_PC))); } } if (astat (BT878_APABORT | BT878_ARIPERR | BT878_APPERR)) { @@ -306,7 +306,7 @@ (astat BT878_ARIPERR) ? RIPERR : , (astat BT878_APPERR) ? PPERR : - , btread(BT878_ARISC_PC)); + , le32_to_cpu(btread(BT878_ARISC_PC))); } } if (astat (BT878_AFDSR | BT878_AFTRGT | BT878_AFBUS)) { @@ -318,7 +318,7 @@ (astat BT878_AFTRGT) ? FTRGT : , (astat BT878_AFBUS) ? FBUS : , - btread(BT878_ARISC_PC)); + le32_to_cpu(btread(BT878_ARISC_PC))); } } if (astat BT878_ARISCI) { --- dvb-bt8xx.c.cvs 2004-06-07 19:51:20.0 +0200 +++ dvb-bt8xx.c 2004-06-07 20:00:14.0 +0200 @@ -55,7 +55,7 @@ { struct dvb_bt8xx_card *card = (struct dvb_bt8xx_card *)data; - //printk(%d , finished_block); + //printk(%d , card-bt-finished_block); while (card-bt-last_block != card-bt-finished_block) { (card-bt-TS_Size ? dvb_dmx_swfilter_204 : dvb_dmx_swfilter)(card-demux, card-bt-buf_cpu[card-bt-last_block * card-bt-block_bytes], card-bt-block_bytes); @@ -427,7 +427,7 @@ dvb_bt8xx_card_match(card_nr, Pinnacle PCTV DVB-S, 0x0400C060, 0, 0); /* 26, 15, 14, 6, 5 - * A_G2X DA_DPM DA_SBR DA_IOM_DA + * A_PWRDN DA_DPM DA_SBR DA_IOM_DA * DA_APP(parallel) */ break; case 0x01010071: @@ -438,11 +438,16 @@ /* A_PWRDN DA_SBR DA_APP (high speed serial) */ break; case 0x07611461: -dvb_bt8xx_card_match(card_nr, Avermedia DVB-T, +dvb_bt8xx_card_match(card_nr, Avermedia DVB-T 761, (1 26) | (1 14) | (1 5), 0, 0); /* A_PWRDN DA_SBR DA_APP (high speed serial) */ break; + case 0x07711461: +dvb_bt8xx_card_match(card_nr, Avermedia DVB-T 771, + 0x0400402B,BT878_RISC_SYNC_MASK,0); +/* A_PWRDN DA_SBR DA_APP[0] PKTP=10 RISC_ENABLE FIFO_ENABLE*/ +break; case 0x0: if (card_type == BT878_NEBULA || card_type == BT878_TWINHAN_DST) --- mt352.c.cvs 2004-06-07 19:44:50.0 +0200 +++ mt352.c 2004-06-07 19:45:32.0 +0200 @@ -1,9 +1,12 @@ -/* +/* * Driver for Zarlink DVB-T MT352 demodulator * - * Written by Holger Waechtler [EMAIL PROTECTED] + * Written by Holger Waechtler [EMAIL PROTECTED] * and Daniel Mack [EMAIL PROTECTED] * + * AVerMedia AVerTV DVB-T 771 support by + * Wolfram Joost [EMAIL PROTECTED] + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -18,7 +21,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/kernel.h #include linux/module.h @@ -30,6 +33,9 @@ #define I2C_MT352_ADDR 0x0f #define I2C_TUNER_ADDR 0xc2 +#define CARD_UNKNOWN 0x00 +#define CARD_AVDVBT771 0x01 + #define mt352_write(ibuf, ilen) \ do { \ struct i2c_msg msg = { .addr = I2C_MT352_ADDR, .flags = 0, \ @@ -46,11 +52,10 @@ #define msb(x) (((x) 8) 0xff) #define lsb(x) ((x) 0xff) - static struct dvb_frontend_info mt352_info = { .name = DVB-T Zarlink MT352 demodulator driver, .type = FE_OFDM, - .frequency_min = 17400, + .frequency_min = 17400, /* NIM of AV771 starts at 50MHz */ .frequency_max = 86200, .frequency_stepsize = 17, /* @@ -60,29 +65,65 @@ .symbol_rate_tolerance = ???, */ .notifier_delay = 0, - .caps = FE_CAN_INVERSION_AUTO | FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | + .caps = FE_CAN_INVERSION_AUTO | FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 | FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 | FE_CAN_FEC_AUTO | FE_CAN_QPSK | FE_CAN_QAM_16 | FE_CAN_QAM_64 | FE_CAN_QAM_AUTO | FE_CAN_TRANSMISSION_MODE_AUTO | FE_CAN_GUARD_INTERVAL_AUTO | - FE_CAN_HIERARCHY_AUTO | FE_CAN_RECOVER | + FE_CAN_HIERARCHY_AUTO | FE_CAN_RECOVER | FE_CAN_MUTE_TS }; +int mt352_detect_avermedia_771(struct dvb_i2c_bus *i2c) +{ + u8 reg; + u8 id[4]; + const u8 pciid[4] = { 0x07, 0x71, 0x14, 0x61 }; + struct i2c_msg msg[2] = + { + { + .addr = 0x50, + .flags = I2C_M_NOSTART, + .buf = reg, + .len = 1 + }, + { + .addr = 0x50, + .flags = I2C_M_RD, + .len = 1 + } +}; + int i; -int mt352_init (struct dvb_i2c_bus *i2c) + for (i = 0; i 4; i++) + { + reg = i + 0xFC; + msg[1].buf = id + i; + if (i2c
[linux-dvb] Autoscanning, was [PATCH] mt352 TPS_GIVEN shifts were wrong
Hi, btw: does anybody of you has an idea how we might make use of the automatic channel scan functionality of the MT352 under Linux, how we might need to extend the LinuxDVB API? I would add two ioctls: - FE_START_SCAN with the lowest and highest frequency to scan as paramters. - FE_CONTINUE_SCAN After the FE_START_SCAN the kernel-thread monitors the fe-status and send an event if the fe locks or an event when the fe finished scanning. Monitoring than stopps. The application then can get more information by requesting some sections and of cause it should get the channel-parameters with a FE_GET_FRONTEND ioctl. Then, the application continues scanning by issueing the FE_CONTINUE_SCAN ioctl. The kernel-thread starts monitoring the fe-status again. The FE_GET_STATUS ioctl should set a new flag to indicate that the scanning-process has finished. Wolfram
[linux-dvb] Re: Autoscanning
Hi, I would add two ioctls: - FE_START_SCAN with the lowest and highest frequency to scan as paramters. - FE_CONTINUE_SCAN After the FE_START_SCAN the kernel-thread monitors the fe-status and send an event if the fe locks or an event when the fe finished scanning. Monitoring than stopps. The application then can get more information by requesting some sections and of cause it should get the channel-parameters with a FE_GET_FRONTEND ioctl. Then, the application continues scanning by issueing the FE_CONTINUE_SCAN ioctl. sounds good so far. The kernel-thread starts monitoring the fe-status again. in well-designed interrupt-driven STBs we don't need any frontend thread at all. It isn't well designed... IIRC the interrupt-pin off the mt352 isn't available at the fe-connector. I would propose a 'scan in progress' flag instead (it maps well to the internal '352 state bit), this allows us to distinguish between weak/instable transponders (lock lost between scan interrupt and FE_GET_STATUS), scan-in-progress (no lock because no signal) and end of scan. Sounds good. :) Are you volunteering to implement this feature? I've only one DVB-T channel here and I'm short on time :(. Wolfram
[linux-dvb] [PATCH] mt352 / AVerMedia DVB-T 771
Hello, I added some enhancements from Clyde Stubbs and Christopher Pascoe and fixed an endianess-bug on powerpc-based machines. The new version is available at http://www.frokaschwei.net/avtv771/avermedia.html. Diffs against the current cvs-version are attached. Wolfram --- bt878.c.cvs 2004-06-07 19:51:03.0 +0200 +++ bt878.c 2004-06-10 20:57:02.0 +0200 @@ -219,7 +219,7 @@ controlreg = ~0x1f; controlreg |= 0x1b; - btwrite(cpu_to_le32(bt-risc_dma), BT878_ARISC_START); + btwrite(bt-risc_dma, BT878_ARISC_START); /* original int mask had : *62840 --- dvb-bt8xx.c.cvs 2004-06-07 19:51:20.0 +0200 +++ dvb-bt8xx.c 2004-06-07 20:00:14.0 +0200 @@ -55,7 +55,7 @@ { struct dvb_bt8xx_card *card = (struct dvb_bt8xx_card *)data; - //printk(%d , finished_block); + //printk(%d , card-bt-finished_block); while (card-bt-last_block != card-bt-finished_block) { (card-bt-TS_Size ? dvb_dmx_swfilter_204 : dvb_dmx_swfilter)(card-demux, card-bt-buf_cpu[card-bt-last_block * card-bt-block_bytes], card-bt-block_bytes); @@ -427,7 +427,7 @@ dvb_bt8xx_card_match(card_nr, Pinnacle PCTV DVB-S, 0x0400C060, 0, 0); /* 26, 15, 14, 6, 5 - * A_G2X DA_DPM DA_SBR DA_IOM_DA + * A_PWRDN DA_DPM DA_SBR DA_IOM_DA * DA_APP(parallel) */ break; case 0x01010071: @@ -438,11 +438,16 @@ /* A_PWRDN DA_SBR DA_APP (high speed serial) */ break; case 0x07611461: -dvb_bt8xx_card_match(card_nr, Avermedia DVB-T, +dvb_bt8xx_card_match(card_nr, Avermedia DVB-T 761, (1 26) | (1 14) | (1 5), 0, 0); /* A_PWRDN DA_SBR DA_APP (high speed serial) */ break; + case 0x07711461: +dvb_bt8xx_card_match(card_nr, Avermedia DVB-T 771, + 0x0400402B,BT878_RISC_SYNC_MASK,0); +/* A_PWRDN DA_SBR DA_APP[0] PKTP=10 RISC_ENABLE FIFO_ENABLE*/ +break; case 0x0: if (card_type == BT878_NEBULA || card_type == BT878_TWINHAN_DST) --- mt352.c.cvs 2004-06-07 19:44:50.0 +0200 +++ mt352.c 2004-06-10 19:35:06.0 +0200 @@ -1,9 +1,12 @@ -/* +/* * Driver for Zarlink DVB-T MT352 demodulator * - * Written by Holger Waechtler [EMAIL PROTECTED] + * Written by Holger Waechtler [EMAIL PROTECTED] * and Daniel Mack [EMAIL PROTECTED] * + * AVerMedia AVerTV DVB-T 771 support by + * Wolfram Joost [EMAIL PROTECTED] + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -18,7 +21,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/kernel.h #include linux/module.h @@ -30,6 +33,9 @@ #define I2C_MT352_ADDR 0x0f #define I2C_TUNER_ADDR 0xc2 +#define CARD_UNKNOWN 0x00 +#define CARD_AVDVBT771 0x01 + #define mt352_write(ibuf, ilen) \ do { \ struct i2c_msg msg = { .addr = I2C_MT352_ADDR, .flags = 0, \ @@ -46,13 +52,12 @@ #define msb(x) (((x) 8) 0xff) #define lsb(x) ((x) 0xff) - static struct dvb_frontend_info mt352_info = { .name = DVB-T Zarlink MT352 demodulator driver, .type = FE_OFDM, - .frequency_min = 17400, + .frequency_min = 17400, /* NIM of AV771 starts at 50MHz */ .frequency_max = 86200, - .frequency_stepsize = 17, + .frequency_stepsize = 8, /* .frequency_tolerance = 0, .symbol_rate_min = 100, @@ -60,29 +65,65 @@ .symbol_rate_tolerance = ???, */ .notifier_delay = 0, - .caps = FE_CAN_INVERSION_AUTO | FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | + .caps = FE_CAN_INVERSION_AUTO | FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 | FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 | FE_CAN_FEC_AUTO | FE_CAN_QPSK | FE_CAN_QAM_16 | FE_CAN_QAM_64 | FE_CAN_QAM_AUTO | FE_CAN_TRANSMISSION_MODE_AUTO | FE_CAN_GUARD_INTERVAL_AUTO | - FE_CAN_HIERARCHY_AUTO | FE_CAN_RECOVER | + FE_CAN_HIERARCHY_AUTO | FE_CAN_RECOVER | FE_CAN_MUTE_TS }; +int mt352_detect_avermedia_771(struct dvb_i2c_bus *i2c) +{ + u8 reg; + u8 id[4]; + const u8 pciid[4] = { 0x07, 0x71, 0x14, 0x61 }; + struct i2c_msg msg[2] = + { + { + .addr = 0x50, + .flags = I2C_M_NOSTART, + .buf = reg, + .len = 1 + }, + { + .addr = 0x50, + .flags = I2C_M_RD, + .len = 1 + } +}; + int i; -int mt352_init (struct dvb_i2c_bus *i2c) + for (i = 0; i 4; i++) + { + reg = i + 0xFC; + msg[1].buf = id + i; + if (i2c-xfer(i2c,msg,2) != 2) + { + return 0; + } + } + + return *((u32 *) id) == *((u32 *) pciid); +} + +int mt352_init (struct dvb_i2c_bus *i2c, u32 card_type) { /** * all register write sequence have the register address of the * first register in the first byte, thenafter the value to write * into this and the following registers
[linux-dvb] Re: AverMedia DVB-T 771 problems
Hi Jolse, I know that the frequency is correct because i noted the frequencies for the channels in windows. Did you check the other paramters, too? AFAIK wrong settings for the bandwidth cannot be corrected automaticaly. the read of register 0x00 returns the same as the read of register 0x7f! I don't know what's going on. If I read the CHIP_ID-register before the status-register, all works well: 0x7F: 13 0x00: 00 0x7F: 13 0x00: 01 0x7F: 13 0x00: 3B 0x7F: 13 0x00: FB And it appears that the snr values from above are actually the value of register 0x03! No idea, either :(. Wolfram
[linux-dvb] Re: AverMedia DVB-T 771 problems
Hi, if i add: r = mt352_read_register (i2c, 0x7f); before: r = mt352_read_register (i2c, 0x00); the read of register 0x00 returns the same as the read of register 0x7f! And it appears that the snr values from above are actually the value of register 0x03! Very strange indeed.. Can anybody shed any light on this problem? I'm running 2.6.7-rc3 with a Pentium4 2.8ghz. are you sure the bt8xx i2c driver is working reliably for this card? Sounds like broken i2c communication to me... Well, I enabled hw_i2c for the card and I never got any problems. I wonder what can go wrong with hardware i2c. The i2c-speed is dependend on the pci-speed. Jolse, do you use overclockling? Can you please check wether you are using hardware-i2c? Another thing: The driver uses 4 values from an i2c-attached eeprom to detect the avermedia-card. Jolse, does the driver recognize the card as an avermedia 771-card? If yes, i2c should work. Wolfram
[linux-dvb] Re: AverMedia DVB-T 771 problems
Hello Jolse, Doesn't the driver set the tuner bandwidth based on the frequency? No, it doesn't. It switches to the right wave band. I mean the 4th parameter in tzap's channels.conf Here's a sample of what I get while tzap is running, this is also with a read of 0x7f at the end of FE_READ_STATUS Reg 00 = 13 13 makes sense. Reg 01 = 00 Makes sense, too. Reg 03 = 7c Can be right. Reg 7f = 13 Must be. as you can see reads of 00, 12,13 09 just return whatever was read before it. I think it would be more usefull if you monitor every ioctl and write out the contents of register 0x00. Maybe you're using wrong parameters and before the mt352 corrected them, the frequency is changed by the kernel-thread. I don't know much about the i2c modules, should I be using a different module other than i2c_algo_bit? Is it dependant on the motherboard? No, it doesn't have to do anythink with the motherboard. The i2c-bus is connected to the bt878. Wolfram
[linux-dvb] Re: AVerMedia 771 problems
Hi, mt352_read_register: readreg error (ret == -14) Do you use the bttv-module-paramter i2c_hw=1? Have a look at http://www.frokaschwei.net/avtv771/bt8xx-2.4.26.diff for the correct values for the card. bttv, bt878, dvb-bt8xx and mt352. I also copied the firmware, but I don't see were it is used. No firmware needed. Wolfram
[linux-dvb] Re: AVerMedia 771 problems [everything solved]
Hi, note to self: read also the mailing list archive from 2004-06, not only 2004-05. It works now. I replaced rt352.c with this version: http://www.linuxtv.org/mailinglists/linux-dvb/2004/06-2004/msg00297.html Can use please find out which difference between the current cvs-version and the version from the mail enables you to use the card? Thanks Wolfram
[linux-dvb] Re: AVerMedia 771 problems [everything solved]
Hi Dirk, thanks for the diff. The important parts are in set_parameters. One diff is a != instead of a = and the return value is not EINVAL. The invalid return breaks it, I think I make the mt352-driver more fault-tolerant regarding the channel-parameters. too. Also a have problems with the sleep. Using the sleep at attach is ok, but when I fill in FE_SLEEP, the card doesn't wake up anymore. I don't have this problem here. After a FE_SLEEP the mt352 needs more time to tune to a channel, but it works. I traced the FE_SLEEP and FE_INIT-ioctls and I cannot find a bug (using linuxtv-dvb-1.1.1.tar.bz2). Maybe it's a bug in the current cvs-version of dvb-core? Does anyone else have an idea? Wolfram
[linux-dvb] Re: AVerMedia 771 problems [everything solved]
Hi, I will try again the next days. BTW, what is FE_SLEEP doing (ok, sleep, I see that, but what is the effect)? It disables most of the internal functions of the mt352. Result: less heat and less power consumption. Wolfram
[linux-dvb] Re: AVerMedia 771 problems [everything solved]
Hello, sounds good. Does it sleep when I unload the driver again? I could only load it when needed. No, but of course you can change this. Wolfram
[linux-dvb] Re: AVerMedia 771 problems [everything solved]
Hi, The problem isn't the sleep itself, the problem is that in the CVS code (at least), the FE_GET_TUNE_SETTINGS internal IOCTL falls through and puts Shit, the classical switch-problem :(. Thanks for hunting that bug. The patch also stops the frontend thread from hunting around for a signal - the MT352 chip has a good capture range and shouldn't really need it. Wolfram, is there any particular reason you think we want that enabled? No, I just didn't change it. In any case, the chip can take 0.5s to re-acquire all parameters so the 50ms min_delay there is a little short... You're right. I can't do many tuning tests because I can only receive one channel here. That's why I left these code-parts/parameters untouched. I think if no one else needs frequency-hunting the patch should be commited to the cvs. Wolfram.
[linux-dvb] Re: mt352 and SkyStar2 (FlexCop IIB) oddities
Hi, data with the tuner), but I simply don't know if those tuner-dependent variables work with the Samsung tuner (don't think so after my If it is the same tuner (network interface module) avermedia uses, then the tuner-paramters should be correct. My question now is: Did you get any information (emailing Samsung or so) for this tuner? I didn't emailed them, I only found the datasheed at http://www.sem.samsung.com/en/products/productOverview.jsp?categoryID=2C9D98F2-A126-B447-E1B3872409AC4242navi=overview However, the datasheed doesn't contain any programing informations. If you program the frontend with the paramters of a working channel does the frontend gets a lock? In mt352.c the read command is contains the following: struct i2c_msg msg [] = { { .addr = I2C_MT352_ADDR, .flags = I2C_M_NOSTART, .buf = b0, .len = 1 }, { .addr = I2C_MT352_ADDR, .flags = I2C_M_RD, .buf = b1, .len = 1 } }; as I2C_M_NOSTART isn't defined as 0 every read_register command will fail too. Changing I2C_M_NOSTART to 0 solves the problem and the module can read the mt352 registers successfully. Don't know enough about i2c to tell whats going wrong there. Wolfram
[linux-dvb] Re: mt352 and SkyStar2 (FlexCop IIB) oddities
Hi, it works on boards with hardware i2c enabled. Changing the I2C_M_NOSTART to 0, as you did, is the right thing to do here. Ahh, OK. Attached is a patch against CVS that makes software I2C work, as well as implementing the second policy. I think that's a good way to handle the parameters. requests. The one change that isn't is a deviation from the recommended settings which should only make a difference if a crystal oscillator in your tuner is out of spec (the buf[7] = 0x06 instead of 0x05 slightly The value 0x06 is used by the windows-driver, but I think 0x05 is correct. Maybe a rounding error. Wolfram
[linux-dvb] Re: mt352 and SkyStar2 (FlexCop IIB) oddities
Hi, Attached is a patch against CVS that makes software I2C work, as well as implementing the second policy. I had a closer look to your patch: + unsigned char acqctl = 0x0B;/* suggest spectral inversion on, force mode, guard */ I think it should be set to 0x5B. If the FE looses the lock it should recover. Maybe one doesn't catch some wrong parameters but I think recovery is more importent. switch (op-code_rate_HP/LP/constellation/hierarchy) { .. case FEC_AUTO: + acqctl |= (15 4);/* all parameters auto */ Hmm, I think (5 4) is a better setting. But setting acqctl to 0x5B makes this unnecessary. Finaly I don't think we should disable all the recovery-functions just to catch some wrong parameters. Wolfram
[linux-dvb] mt352, site updated, diff
Hi, I updated the version on http://www.frokaschwei.net/avtv771/avermedia.html. I changed Christopher Pascoe's patch because I don't want to disable the recovery. Wolfram --- mt352.c.cvs 2004-06-28 20:08:21.0 +0200 +++ mt352.c 2004-06-29 20:57:07.0 +0200 @@ -83,7 +83,7 @@ { { .addr = 0x50, - .flags = I2C_M_NOSTART, + .flags = 0, .buf = reg, .len = 1 }, @@ -168,6 +168,7 @@ struct dvb_ofdm_parameters *op = param-u.ofdm; u32 freq = param-frequency / 1000; uint16_t tmp; + unsigned char acqctl = 0x5B; /* suggest spectral inversion on, force mode, guard, enable recovery */ switch (op-code_rate_HP) { case FEC_2_3: @@ -186,6 +187,7 @@ case FEC_AUTO: break; default: + printk(KERN_WARNING mt352.c: bad code_rate_HP\n); return -EINVAL; } @@ -204,8 +206,10 @@ break; case FEC_1_2: case FEC_AUTO: + case FEC_NONE: break; default: + printk(KERN_WARNING mt352.c: bad code_rate_LP\n); return -EINVAL; } @@ -220,23 +224,26 @@ tps |= (2 13); break; default: + printk(KERN_WARNING mt352.c: bad constellation\n); return -EINVAL; } switch (op-transmission_mode) { case TRANSMISSION_MODE_2K: - case TRANSMISSION_MODE_AUTO: break; case TRANSMISSION_MODE_8K: tps |= (1 0); break; + case TRANSMISSION_MODE_AUTO: + acqctl = ~(1 0); /* unforce mode */ + break; default: + printk(KERN_WARNING mt352.c: bad transmission_mode\n); return -EINVAL; } switch (op-guard_interval) { case GUARD_INTERVAL_1_32: - case GUARD_INTERVAL_AUTO: break; case GUARD_INTERVAL_1_16: tps |= (1 2); @@ -247,7 +254,11 @@ case GUARD_INTERVAL_1_4: tps |= (3 2); break; + case GUARD_INTERVAL_AUTO: + acqctl = ~(1 1); /* unforce guard */ + break; default: + printk(KERN_WARNING mt352.c: bad guard_interval\n); return -EINVAL; } @@ -265,6 +276,7 @@ tps |= (3 10); break; default: + printk(KERN_WARNING mt352.c: bad hierarchy_information\n); return -EINVAL; } @@ -274,7 +286,7 @@ buf[1] = msb(tps); /* TPS_GIVEN_(1|0) */ buf[2] = lsb(tps); - buf[3] = 0x50; + buf[3] = acqctl; /** * these settings assume 20.48MHz f_ADC, for other tuners you might @@ -386,7 +398,7 @@ u8 b0 [] = { reg }; u8 b1 [] = { 0 }; struct i2c_msg msg [] = { { .addr = I2C_MT352_ADDR, -.flags = I2C_M_NOSTART, +.flags = 0, .buf = b0, .len = 1 }, { .addr = I2C_MT352_ADDR, .flags = I2C_M_RD, @@ -578,7 +590,6 @@ case FE_GET_FRONTEND: return mt352_get_parameters (i2c, (struct dvb_frontend_parameters *) arg,card_type); - case FE_GET_TUNE_SETTINGS: fe_tune_settings = (struct dvb_frontend_tune_settings *) arg; fe_tune_settings-min_delay_ms = 800;