AF9035/AF9033/TUA9001 => TerraTec Cinergy T Stick [0ccd:0093]
Terve Mauro and all the other hackers,
I did some massive rewrite for my old AF9035/AF9033 driver that was never merged. Anyhow, here it is.
New drivers here are:
Infineon TUA 9001 silicon tuner driver
Afatech AF9033 DVB-T demodulator driver
Afatech AF9035 DVB USB driver
AF9035 integrates AF9033. Both chips are also sold separately. AF9033 will not likely work as a stand-alone since I didn't have hardware to test, but in theory it is quite well split out from the DVB USB interface driver (AF9035).
Tips for cheap AF9035 based dual devices are welcome!
regards
Antti
The following changes since commit 26315a507f6acda933f0d41200de8fec51775867:
em28xx-dvb: stop URBs when stopping the streaming (2012-03-28
15:32:23 +0300)
are available in the git repository at:
git://linuxtv.org/anttip/media_tree.git af9035
Antti Palosaari (3):
Infineon TUA 9001 silicon tuner driver
Afatech AF9033 DVB-T demodulator driver
Afatech AF9035 DVB USB driver
drivers/media/common/tuners/Kconfig | 6 + drivers/media/common/tuners/Makefile | 1 + drivers/media/common/tuners/tua9001.c | 215 ++++++++ drivers/media/common/tuners/tua9001.h | 46 ++ drivers/media/common/tuners/tua9001_priv.h | 34 ++ drivers/media/dvb/dvb-usb/Kconfig | 9 + drivers/media/dvb/dvb-usb/Makefile | 3 + drivers/media/dvb/dvb-usb/af9035.c | 799 ++++++++++++++++++++++++++++ drivers/media/dvb/dvb-usb/af9035.h | 102 ++++ drivers/media/dvb/dvb-usb/dvb-usb-ids.h | 1 + drivers/media/dvb/frontends/Kconfig | 5 + drivers/media/dvb/frontends/Makefile | 1 + drivers/media/dvb/frontends/af9033.c | 706 ++++++++++++++++++++++++ drivers/media/dvb/frontends/af9033.h | 73 +++ drivers/media/dvb/frontends/af9033_priv.h | 242 +++++++++ 15 files changed, 2243 insertions(+), 0 deletions(-) create mode 100644 drivers/media/common/tuners/tua9001.c create mode 100644 drivers/media/common/tuners/tua9001.h create mode 100644 drivers/media/common/tuners/tua9001_priv.h create mode 100644 drivers/media/dvb/dvb-usb/af9035.c create mode 100644 drivers/media/dvb/dvb-usb/af9035.h create mode 100644 drivers/media/dvb/frontends/af9033.c create mode 100644 drivers/media/dvb/frontends/af9033.h create mode 100644 drivers/media/dvb/frontends/af9033_priv.h
Signature · 1 line
http://palosaari.fi/
Quoted 9 lines · On Fri, 30 Mar 2012 15:33:02 +0300 Antti Palosaari <[email protected]> wrote:
Terve Mauro and all the other hackers,
I did some massive rewrite for my old AF9035/AF9033 driver that was never merged. Anyhow, here it is.
New drivers here are:
Infineon TUA 9001 silicon tuner driver
Afatech AF9033 DVB-T demodulator driver
Afatech AF9035 DVB USB driver
This looks pretty nice.
I recently wrote a tuner driver for the fc0011 tuner, which is used in some af9035 sticks:
http://patchwork.linuxtv.org/patch/10503/
It was developed against an af903x driver by Hans-Frieder Vogt.
I'll port it to your AF9035 driver, ASAP, to check whether this works on my DVB USB stick.
Signature · 3 lines
Greetings, Michael. PGP encryption is encouraged / 908D8B0E
Quoted 15 lines · Michael Büsch
Quoted 9 lines · On Fri, 30 Mar 2012 15:33:02 +0300 Antti Palosaari<[email protected]> wrote:
Terve Mauro and all the other hackers,
I did some massive rewrite for my old AF9035/AF9033 driver that was never merged. Anyhow, here it is.
New drivers here are:
Infineon TUA 9001 silicon tuner driver
Afatech AF9033 DVB-T demodulator driver
Afatech AF9035 DVB USB driverThis looks pretty nice.
Quoted 8 lines
I recently wrote a tuner driver for the fc0011 tuner, which is used in some af9035 sticks:
http://patchwork.linuxtv.org/patch/10503/It was developed against an af903x driver by Hans-Frieder Vogt.
I'll port it to your AF9035 driver, ASAP, to check whether this works on my DVB USB stick.
Feel free to do that. Actually, I just tried it about 2 hours ago. But I failed, since there callbacks given as a param for tuner attach and it is wrong. There is frontend callback defined just for that. Look example from some Xceive tuners also hd29l2 demod driver contains one example. Use git grep DVB_FRONTEND_COMPONENT_ drivers/media/ to see all those existing callbacks.
struct dvb_frontend *fc0011_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, u8 i2c_address, int (*tuner_reset)(unsigned long, unsigned long),unsigned long tuner_reset_arg0,unsigned long tuner_reset_arg1)
My short term plans are now
* fix af9033 IF freq control (now Zero-IF only)
* change firmware download to use new firmware syntax
* dual tuner support
* check if IT9035 is enough similar (My personal suspicion is that integrated tuner is only main difference, whilst USB-interface and demod are same. But someone has told that it is quite different design though.)
* implement SNR, BER and USB counters
* implement remote controller
regards
Antti
Signature · 1 line
http://palosaari.fi/
Quoted 6 lines · On Sat, 31 Mar 2012 01:00:21 +0300 Antti Palosaari <[email protected]> wrote:
Feel free to do that. Actually, I just tried it about 2 hours ago. But I failed, since there callbacks given as a param for tuner attach and it is wrong. There is frontend callback defined just for that. Look example from some Xceive tuners also hd29l2 demod driver contains one example. Use git grep
DVB_FRONTEND_COMPONENT_drivers/media/to see all those existing callbacks.
Cool. Thanks for the hint. I'll fix this.
Quoted 9 lines
My short term plans are now
* fix af9033 IF freq control (now Zero-IF only)
* change firmware download to use new firmware syntax
* dual tuner support
* check if IT9035 is enough similar (My personal suspicion is that integrated tuner is only main difference, whilst USB-interface and demod are same. But someone has told that it is quite different design though.)
* implement SNR, BER and USB counters
* implement remote controller
Sounds good.
Signature · 3 lines
Greetings, Michael. PGP encryption is encouraged / 908D8B0E
Quoted 11 lines · On Sat, 31 Mar 2012 00:14:58 +0200 Michael Büsch <[email protected]> wrote:
Quoted 6 lines · On Sat, 31 Mar 2012 01:00:21 +0300 Antti Palosaari <[email protected]> wrote:
Feel free to do that. Actually, I just tried it about 2 hours ago. But I failed, since there callbacks given as a param for tuner attach and it is wrong. There is frontend callback defined just for that. Look example from some Xceive tuners also hd29l2 demod driver contains one example. Use git grep
DVB_FRONTEND_COMPONENT_drivers/media/to see all those existing callbacks.Cool. Thanks for the hint. I'll fix this.
Ok, so I cooked something up here.
I'm wondering where to get the firmware file from, so I can test it.
Signature · 3 lines
Greetings, Michael. PGP encryption is encouraged / 908D8B0E
Quoted 13 lines · Michael Büsch
Quoted 10 lines · On Sat, 31 Mar 2012 00:14:58 +0200 Michael Büsch<[email protected]> wrote:
Quoted 6 lines · On Sat, 31 Mar 2012 01:00:21 +0300 Antti Palosaari<[email protected]> wrote:
Feel free to do that. Actually, I just tried it about 2 hours ago. But I failed, since there callbacks given as a param for tuner attach and it is wrong. There is frontend callback defined just for that. Look example from some Xceive tuners also hd29l2 demod driver contains one example. Use git grep
DVB_FRONTEND_COMPONENT_drivers/media/to see all those existing callbacks.
Quoted 4 lines
Quoted 1 line
Cool. Thanks for the hint. I'll fix this.
Ok, so I cooked something up here.
I'm wondering where to get the firmware file from, so I can test it.
Googling the filename reveals many links, here is one:
http://xgazza.altervista.org/Linux/DVB/dvb-usb-af9035-01.fw
I will try to make new firmware loader during that weekend, now I am busy hacking with it9035 I have. It is rather similar, but for some nasty reason I haven't got lock. If it does not found soon I will jump back for implementing those missing basic features.
regards
Antti
Signature · 1 line
http://palosaari.fi/
Quoted 2 lines · On Sat, 31 Mar 2012 17:28:38 +0300 Antti Palosaari <[email protected]> wrote:
Googling the filename reveals many links, here is one:
http://xgazza.altervista.org/Linux/DVB/dvb-usb-af9035-01.fw
Hm, on tuner register access I get these errors:
[ 9259.080907] af9035_ctrl_msg: command=03 failed fw error=2 [ 9259.080922] i2c i2c-8: I2C write reg failed, reg: 07, val: 0f
Is it possible that this firmware is incompatible with my stick? The firmware that I successfully used with the other af9035 driver seems to be incompatible with your driver, though. It crashes it somewhere on firmware download in one of the USB transfer's memcpy.
Signature · 3 lines
Greetings, Michael. PGP encryption is encouraged / 908D8B0E
Quoted 8 lines · Michael Büsch
Quoted 2 lines · On Sat, 31 Mar 2012 17:28:38 +0300 Antti Palosaari<[email protected]> wrote:
Googling the filename reveals many links, here is one:
http://xgazza.altervista.org/Linux/DVB/dvb-usb-af9035-01.fwHm, on tuner register access I get these errors:
Quoted 7 lines
[ 9259.080907] af9035_ctrl_msg: command=03 failed fw error=2 [ 9259.080922] i2c i2c-8: I2C write reg failed, reg: 07, val: 0fIs it possible that this firmware is incompatible with my stick? The firmware that I successfully used with the other af9035 driver seems to be incompatible with your driver, though. It crashes it somewhere on firmware download in one of the USB transfer's memcpy.
Most likely it is incompatible. It is surely one of the earliest firmwares. I will try to make that new fw downloaded ASAP, likely tomorrow morning it is done.
And good news about IT9035 support - it is working. It was very few changes needed, new initialization tables for af9033 and new firmware uploader for af9035. Of course new tuner drivers is also needed, but it seems to be very simple. yay, AF9035 is basically same as IT9035 + integrated tuner.
regards
Antti
Signature · 1 line
http://palosaari.fi/
I dropped Mauro from cc since he is not likely interested of that development.
Quoted 22 lines · Antti Palosaari
Quoted 8 lines · Michael Büsch
Quoted 2 lines · On Sat, 31 Mar 2012 17:28:38 +0300 Antti Palosaari<[email protected]> wrote:
Googling the filename reveals many links, here is one:
http://xgazza.altervista.org/Linux/DVB/dvb-usb-af9035-01.fwHm, on tuner register access I get these errors:
Quoted 8 lines
[ 9259.080907] af9035_ctrl_msg: command=03 failed fw error=2 [ 9259.080922] i2c i2c-8: I2C write reg failed, reg: 07, val: 0fIs it possible that this firmware is incompatible with my stick? The firmware that I successfully used with the other af9035 driver seems to
be incompatible with your driver, though. It crashes it somewhere on firmware download in one of the USB transfer's memcpy.Most likely it is incompatible. It is surely one of the earliest firmwares. I will try to make that new fw downloaded ASAP, likely tomorrow morning it is done.
Quoted 5 lines
And good news about IT9035 support - it is working. It was very few changes needed, new initialization tables for af9033 and new firmware uploader for af9035. Of course new tuner drivers is also needed, but it seems to be very simple. yay, AF9035 is basically same as IT9035 + integrated tuner.
Ooops, I mean IT9135.
And about the new FW downloader, that supports those new firmwares, feel free to implement it if you wish too. I will now goto out of house and will back during few hours. If you wish to do it just reply during 4 hours, and I will not start working for it. Instead I will continue with IT9135.
regards
Antti
Signature · 1 line
http://palosaari.fi/
Quoted 5 lines · On Sat, 31 Mar 2012 19:48:34 +0300 Antti Palosaari <[email protected]> wrote:
And about the new FW downloader, that supports those new firmwares, feel free to implement it if you wish too. I will now goto out of house and will back during few hours. If you wish to do it just reply during 4 hours, and I will not start working for it. Instead I will continue with IT9135.
I have no clue about the firmware format, so it will probably be easier if you'd dive into that stuff as you already seem to know it.
Signature · 3 lines
Greetings, Michael. PGP encryption is encouraged / 908D8B0E
Quoted 11 lines · Michael Büsch
Quoted 5 lines · On Sat, 31 Mar 2012 19:48:34 +0300 Antti Palosaari<[email protected]> wrote:
And about the new FW downloader, that supports those new firmwares, feel free to implement it if you wish too. I will now goto out of house and will back during few hours. If you wish to do it just reply during 4 hours, and I will not start working for it. Instead I will continue with IT9135.
I have no clue about the firmware format, so it will probably be easier if you'd dive into that stuff as you already seem to know it.
Done. I didn't have neither info, but there was good posting from Daniel Glöckner that documents it! Nice job Daniel, without that info I was surely implemented it differently and surely more wrong way.
I pushed my experimental tree out, patches are welcome top of that.
http://git.linuxtv.org/anttip/media_tree.git/shortlog/refs/heads/af9035_experimental
I extracted three firmwares from windows binaries I have. I will sent those you, Michael, for testing. First, and oldest, is TUA9001, 2nd is from FC0012 device and 3rd no idea.
md5sum f71efe295151ba76cac2280680b69f3f
LINK=11.5.9.0 OFDM=5.17.9.1
md5sum 7cdc1e3aba54f3a9ad052dc6a29603fd
LINK=11.10.10.0 OFDM=5.33.10.0
md5sum 862604ab3fec0c94f4bf22b4cffd0d89
LINK=12.13.15.0 OFDM=6.20.15.0
I need more AF903x hardware, please give links to cheap eBay devices etc. Also I would like to get one device where is AF9033 but no AF9035 at all just for stand-alone demodulator implementation. I know there is few such devices, like AverMedia A336 for example...
regards
Antti
Signature · 1 line
http://palosaari.fi/
Quoted 7 lines · On Sun, 01 Apr 2012 07:51:33 +0300 Antti Palosaari <[email protected]> wrote:
Quoted 2 lines
I have no clue about the firmware format, so it will probably be easier if you'd dive into that stuff as you already seem to know it.
Done. I didn't have neither info, but there was good posting from Daniel Glöckner that documents it! Nice job Daniel, without that info I was surely implemented it differently and surely more wrong way.
Quoted 6 lines
I pushed my experimental tree out, patches are welcome top of that.
http://git.linuxtv.org/anttip/media_tree.git/shortlog/refs/heads/af9035_experimentalI extracted three firmwares from windows binaries I have. I will sent those you, Michael, for testing. First, and oldest, is TUA9001, 2nd is from FC0012 device and 3rd no idea.
Great work. I'll rebase my tree on the new branch and check those firmware files asap.
Quoted 4 lines
I need more AF903x hardware, please give links to cheap eBay devices etc. Also I would like to get one device where is AF9033 but no AF9035 at all just for stand-alone demodulator implementation. I know there is few such devices, like AverMedia A336 for example...
This is my stick. It's a AF9035 with one FC0011 tuner chip:
http://www.amazon.de/Cabstone-DVB-T-Empf%C3%A4nger-Arbeitsspeicher-schwarz/dp/B00307551E/ref=sr_1_1?ie=UTF8&qid=1333268959&sr=8-1
Signature · 3 lines
Greetings, Michael. PGP encryption is encouraged / 908D8B0E
Quoted 9 lines · On Sun, 1 Apr 2012 10:33:15 +0200 Michael Büsch <[email protected]> wrote:
Quoted 7 lines · On Sun, 01 Apr 2012 07:51:33 +0300 Antti Palosaari <[email protected]> wrote:
Quoted 2 lines
I have no clue about the firmware format, so it will probably be easier if you'd dive into that stuff as you already seem to know it.
Done. I didn't have neither info, but there was good posting from Daniel Glöckner that documents it! Nice job Daniel, without that info I was surely implemented it differently and surely more wrong way.
Quoted 8 lines
Quoted 6 lines
I pushed my experimental tree out, patches are welcome top of that.
http://git.linuxtv.org/anttip/media_tree.git/shortlog/refs/heads/af9035_experimentalI extracted three firmwares from windows binaries I have. I will sent those you, Michael, for testing. First, and oldest, is TUA9001, 2nd is from FC0012 device and 3rd no idea.
Great work. I'll rebase my tree on the new branch and check those firmware files asap.
Hm, none of these firmwares fix the problem. Maybe it's not a firmware problem after all, but just incorrectly setup tuner-i2c.
Here's the dmesg log:
[ 131.451556] usb 1-1.1: new high-speed USB device number 5 using ehci_hcd [ 131.550302] usb 1-1.1: New USB device found, idVendor=15a4, idProduct=9035 [ 131.550315] usb 1-1.1: New USB device strings: Mfr=0, Product=0, SerialNumber=0 [ 131.674657] af9035_usb_probe: interface=0 [ 131.675169] af9035_identify_state: reply=00 00 00 00 [ 131.675185] dvb-usb: found a 'Afatech Technologies DVB-T stick' in cold state, will try to load a firmware [ 131.691605] dvb-usb: downloading firmware from file 'dvb-usb-af9035-02.fw' [ 131.691626] af9035_download_firmware: core=1 addr=4100 data_len=3 checksum=fbbe [ 131.692696] af9035_download_firmware: data uploaded=10 [ 131.692716] af9035_download_firmware: core=1 addr=4800 data_len=15014 checksum=587d [ 131.777793] af9035_download_firmware: data uploaded=15031 [ 131.777807] af9035_download_firmware: core=1 addr=83e9 data_len=4 checksum=117c [ 131.778785] af9035_download_firmware: data uploaded=15042 [ 131.778796] af9035_download_firmware: core=2 addr=4100 data_len=3 checksum=fabe [ 131.779785] af9035_download_firmware: data uploaded=15052 [ 131.779799] af9035_download_firmware: core=2 addr=4550 data_len=27252 checksum=3950 [ 131.936162] af9035_download_firmware: data uploaded=42311 [ 131.999412] af9035: firmware version=11.10.10.0 [ 131.999443] dvb-usb: found a 'Afatech Technologies DVB-T stick' in warm state. [ 131.999790] dvb-usb: will pass the complete MPEG2 transport stream to the software demuxer. [ 132.000122] DVB: registering new adapter (Afatech Technologies DVB-T stick) [ 132.000546] af9035_read_mac_address: dual mode=0 [ 132.001027] af9035_read_mac_address: [0]tuner=28 [ 132.002026] af9035_read_mac_address: [0]IF=36125 [ 132.002413] dvb-usb: MAC address: 00:00:00:00:00:00 [ 132.018549] af9033: firmware version: LINK=11.10.10.0 OFDM=5.33.10.0 [ 132.018566] DVB: registering adapter 0 frontend 0 (Afatech AF9033 (DVB-T))... [ 132.028370] i2c i2c-8: Fitipower FC0011 tuner attached [ 132.028388] dvb-usb: Afatech Technologies DVB-T stick successfully initialized and connected. [ 132.028405] af9035_init: USB speed=3 frame_size=0ff9 packet_size=80 [ 132.040019] usbcore: registered new interface driver dvb_usb_af9035 [ 145.407991] af9035_ctrl_msg: command=03 failed fw error=2 [ 145.408008] i2c i2c-8: I2C write reg failed, reg: 07, val: 0f
I also tried the other firmware. Same result.
Signature · 3 lines
Greetings, Michael. PGP encryption is encouraged / 908D8B0E
Quoted 5 lines · Michael Büsch
Quoted 1 line
Great work. I'll rebase my tree on the new branch and check those firmware files asap.
Hm, none of these firmwares fix the problem. Maybe it's not a firmware problem after all, but just incorrectly setup tuner-i2c.
Here's the dmesg log:
[...]
Quoted 10 lines
[ 132.018549] af9033: firmware version: LINK=11.10.10.0 OFDM=5.33.10.0 [ 132.018566] DVB: registering adapter 0 frontend 0 (Afatech AF9033 (DVB-T))... [ 132.028370] i2c i2c-8: Fitipower FC0011 tuner attached [ 132.028388] dvb-usb: Afatech Technologies DVB-T stick successfully initialized and connected. [ 132.028405] af9035_init: USB speed=3 frame_size=0ff9 packet_size=80 [ 132.040019] usbcore: registered new interface driver dvb_usb_af9035 [ 145.407991] af9035_ctrl_msg: command=03 failed fw error=2 [ 145.408008] i2c i2c-8: I2C write reg failed, reg: 07, val: 0fI also tried the other firmware. Same result.
It must then be I2C adapter or I2C client issue.
Adapter code is here, and it known to work with TUA9001. TUA9001 sends 1x byte register and then followed 2xbytes data.
u8 buf[4 + msg[0].len];
struct usb_req req = { CMD_I2C_WR, 0, sizeof(buf), buf, 0, NULL }; buf[0] = msg[0].len;
buf[1] = msg[0].addr << 1;
buf[2] = 0x01;
buf[3] = 0x00;memcpy(&buf[4], msg[0].buf, msg[0].len);
ret = af9035_ctrl_msg(d->udev, &req);
Maybe you have given I2C address as a "8bit" format? Maybe adapter bytes buf[2] and buf[3] are wrong? If you have taken sniffs from windows it is very easy to see what is wrong.
regards
Antti
Signature · 1 line
http://palosaari.fi/
Quoted 2 lines · On Sun, 01 Apr 2012 15:29:07 +0300 Antti Palosaari <[email protected]> wrote:
buf[1] = msg[0].addr << 1;
Maybe you have given I2C address as a "8bit" format?
Uhh, the address is leftshifted by one.
So I changed the i2c address from 0xC0 to 0x60.
The i2c write seems to work now. At least it doesn't complain anymore and it sorta seems to tune to the right frequency.
But i2c read may be broken.
I had to enable the commented read code, but it still fails to read the VCO calibration value:
[ 3101.940765] i2c i2c-8: Failed to read VCO calibration value (got 20)
It doesn't run into this check on the other af903x driver. So I suspect an i2c read issue here.
Attached: The patches.
Signature · 3 lines
Greetings, Michael. PGP encryption is encouraged / 908D8B0E
drivers/media/common/tuners/Kconfig +7 -0
@@ -204,6 +204,13 @@ help NXP TDA18218 silicon tuner driver. +config MEDIA_TUNER_FC0011 + tristate "Fitipower FC0011 silicon tuner" + depends on VIDEO_MEDIA && I2C + default m if MEDIA_TUNER_CUSTOMISE + help + Fitipower FC0011 silicon tuner driver. + config MEDIA_TUNER_TDA18212 tristate "NXP TDA18212 silicon tuner" depends on VIDEO_MEDIA && I2C
drivers/media/common/tuners/Makefile +1 -0
@@ -29,6 +29,7 @@ obj-$(CONFIG_MEDIA_TUNER_TDA18218) += tda18218.o obj-$(CONFIG_MEDIA_TUNER_TDA18212) += tda18212.o obj-$(CONFIG_MEDIA_TUNER_TUA9001) += tua9001.o +obj-$(CONFIG_MEDIA_TUNER_FC0011) += fc0011.o ccflags-y += -I$(srctree)/drivers/media/dvb/dvb-core ccflags-y += -I$(srctree)/drivers/media/dvb/frontends
drivers/media/common/tuners/fc0011.c new file +491 -0
491 lines not on this page · raw message
drivers/media/common/tuners/fc0011.h new file +41 -0
41 lines not on this page · raw message
MAINTAINERS +7 -0
@@ -2697,6 +2697,13 @@ F: Documentation/hwmon/f71805f F: drivers/hwmon/f71805f.c +FC0011 TUNER DRIVER +M: Michael Buesch <[email protected]> +L: [email protected] +S: Maintained +F: drivers/media/common/tuners/fc0011.h +F: drivers/media/common/tuners/fc0011.c + FANOTIFY M: Eric Paris <[email protected]> S: Maintained
drivers/media/dvb/dvb-usb/af9035.c +88 -9
145 lines not on this page · raw message
drivers/media/dvb/frontends/af9033.c +4 -0
@@ -297,6 +297,10 @@ len =ARRAY_SIZE (tuner_init_tua9001); init = tuner_init_tua9001;break ; +case AF9033_TUNER_FC0011 : + len =ARRAY_SIZE (tuner_init_fc0011); + init = tuner_init_fc0011; +break ;default :pr_debug ("%s: unsupported tuner ID=%d\n" , __func__, state->cfg.tuner);
drivers/media/dvb/frontends/af9033_priv.h +61 -0
66 lines not on this page · raw message
Quoted 7 lines · Michael Büsch
Quoted 2 lines · On Sun, 01 Apr 2012 15:29:07 +0300 Antti Palosaari<[email protected]> wrote:
buf[1] = msg[0].addr<< 1;
Maybe you have given I2C address as a "8bit" format?Uhh, the address is leftshifted by one.
So I changed the i2c address from0xC0to0x60.
That's a very common mistake, I2C addresses are 7 bit and LSB is direction. But it is very common to see used it as a "8bit" format, 0xC0 write address and 0xc1 as a read address. Even some data-sheets have that "wrong" naming. There is many drivers that is wrong and causing confusion, even my old AF9015... :]
Quoted 10 lines
The i2c write seems to work now. At least it doesn't complain anymore and it sorta seems to tune to the right frequency.
But i2c read may be broken.
I had to enable the commented read code, but it still fails to read the VCO calibration value:[ 3101.940765] i2c i2c-8: Failed to read VCO calibration value (got 20)It doesn't run into this check on the other af903x driver. So I suspect an i2c read issue here.
That could be I2C adapter issue too, TUA9001 does not use it and thus not tested at all... But for my eyes it looks logically correct still.
Quoted 1 line
Attached: The patches.
Lets see.
regards
Antti
Signature · 1 line
http://palosaari.fi/
Michael,
Am Sonntag, 1. April 2012 schrieb Michael Büsch:
Quoted 15 lines
On Sun, 01 Apr 2012 15:29:07 +0300
Quoted 2 lines · Antti Palosaari
buf[1] = msg[0].addr << 1;
Maybe you have given I2C address as a "8bit" format?Uhh, the address is leftshifted by one.
So I changed the i2c address from0xC0to0x60.The i2c write seems to work now. At least it doesn't complain anymore and it sorta seems to tune to the right frequency.
But i2c read may be broken.
I had to enable the commented read code, but it still fails to read the VCO calibration value:
Quoted 4 lines
[ 3101.940765] i2c i2c-8: Failed to read VCO calibration value (got 20)It doesn't run into this check on the other af903x driver. So I suspect an i2c read issue here.
I would first uncomment the i2c read functionality in Antti's driver!
Quoted 2 lines
Attached: The patches.
Cheers,
Hans-Frieder Vogt e-mail: hfvogt <at> gmx .dot. net
Quoted 6 lines · On Sun, 1 Apr 2012 16:42:34 +0200 "Hans-Frieder Vogt" <[email protected]> wrote:
Quoted 4 lines
[ 3101.940765] i2c i2c-8: Failed to read VCO calibration value (got 20)It doesn't run into this check on the other af903x driver. So I suspect an i2c read issue here.
I would first uncomment the i2c read functionality in Antti's driver!
I did this.
Quoted 1 line
Quoted 1 line
Attached: The patches.
See the patches.
Signature · 3 lines
Greetings, Michael. PGP encryption is encouraged / 908D8B0E
Am Sonntag, 1. April 2012 schrieb Michael Büsch:
Quoted 11 lines
On Sun, 1 Apr 2012 16:42:34 +0200
Quoted 6 lines · Hans-Frieder Vogt
Quoted 4 lines
[ 3101.940765] i2c i2c-8: Failed to read VCO calibration value (got 20)It doesn't run into this check on the other af903x driver. So I suspect an i2c read issue here.
I would first uncomment the i2c read functionality in Antti's driver!
I did this.
sorry. I didn't check your patches. However, I found the problem: the buffer length needs to be msg[1].len, see below. For my mxl5007t based device it worked.
--- old/af9035.c 2012-04-01 16:41:53.694103691 +0200
+++ new/af9035.c 2012-04-01 18:22:25.026930784 +0200
@@ -209,24 +209,15 @@
msg[1].len);
} else {
/* I2C */-#if 0
- /*
- * FIXME: Keep that code. It should work but as it is
- * not tested I left it disabled and return -
EOPNOTSUPP
- * for the sure.
- */
u8 buf[4 + msg[0].len];
struct usb_req req = { CMD_I2C_RD, 0, sizeof(buf),
buf, msg[1].len, msg[1].buf };
- buf[0] = msg[0].len;
+ buf[0] = msg[1].len;
buf[1] = msg[0].addr << 1;
buf[2] = 0x01;
buf[3] = 0x00;
memcpy(&buf[4], msg[0].buf, msg[0].len);
ret = af9035_ctrl_msg(d->udev, &req);
-#endif
- pr_debug("%s: I2C operation not supported\n",
__func__);
- ret = -EOPNOTSUPP;
}
} else if (num == 1 && !(msg[0].flags & I2C_M_RD)) {
if (msg[0].len > 40) {Quoted 3 lines
Quoted 1 line
Quoted 1 line
Attached: The patches.
See the patches.
cheers,
Hans-Frieder Vogt e-mail: hfvogt <at> gmx .dot. net
Quoted 2 lines · On Sun, 1 Apr 2012 18:24:09 +0200 "Hans-Frieder Vogt" <[email protected]> wrote:
However, I found the problem: the buffer
length needs to be msg[1].len, see below.
I spotted this bug, too, but it didn't fix the problem, as len is 1 for both packets in my specific case. So it doesn't make a difference in this case.
But as I said in the previous mail: I did more debugging and I'm pretty sure that the actual i2c reads and writes work as expected. The problem is at another level.
Quoted 30 lines
---
old/af9035.c2012-04-01 16:41:53.694103691 +0200
+++new/af9035.c2012-04-01 18:22:25.026930784 +0200drivers/media/dvb/dvb-usb/af9035.c +0
-4@@ -209,24 +209,15 @@ msg[1].len); }else {/* I2C */ -#if 0 -/* -* FIXME: Keep that code. It should work but as it is -* not tested I left it disabled and return - EOPNOTSUPP
(quoted diff) +1
-5- * for the sure. - */ u8 buf[4 + msg[0].len]; struct usb_req req = { CMD_I2C_RD, 0, sizeof(buf), buf, msg[1].len, msg[1].buf }; - buf[0] = msg[0].len; + buf[0] = msg[1].len; buf[1] = msg[0].addr << 1; buf[2] = 0x01; buf[3] = 0x00; memcpy(&buf[4], msg[0].buf, msg[0].len); ret = af9035_ctrl_msg(d->udev, &req); -#endif - pr_debug("%s: I2C operation not supported\n",
__func__);- ret = -EOPNOTSUPP; } } else if (num == 1 && !(msg[0].flags & I2C_M_RD)) { if (msg[0].len > 40) {
Signature · 3 lines
Greetings, Michael. PGP encryption is encouraged / 908D8B0E
Quoted 1 line · On Sun, 1 Apr 2012 15:11:53 +0200 Michael Büsch <[email protected]> wrote:
[ 3101.940765] i2c i2c-8: Failed to read VCO calibration value (got 20)
Ok, it turns out that it doesn't fail all the time, but only sporadically. So increasing the number of retries fixes (or at least works around) it.
No idea why this behaves differently from fc0011 on Hans' driver, though.
Signature · 3 lines
Greetings, Michael. PGP encryption is encouraged / 908D8B0E
Quoted 7 lines · Michael Büsch
Quoted 1 line · On Sun, 1 Apr 2012 15:11:53 +0200 Michael Büsch<[email protected]> wrote:
[ 3101.940765] i2c i2c-8: Failed to read VCO calibration value (got 20)Ok, it turns out that it doesn't fail all the time, but only sporadically. So increasing the number of retries fixes (or at least works around) it.
OK, feel free to add ~3 retries inside af9035_ctrl_msg() i think.
You didn't mention if error is coming from af9035 firmware or from USB stack. Just for the interest...
Quoted 1 line
No idea why this behaves differently from fc0011 on Hans' driver, though.
Maybe some delay or there is retry on error logic.
regards
Antti
Signature · 1 line
http://palosaari.fi/
Quoted 10 lines · On Sun, 01 Apr 2012 19:20:21 +0300 Antti Palosaari <[email protected]> wrote:
Quoted 7 lines · Michael Büsch
Quoted 1 line · On Sun, 1 Apr 2012 15:11:53 +0200 Michael Büsch<[email protected]> wrote:
[ 3101.940765] i2c i2c-8: Failed to read VCO calibration value (got 20)Ok, it turns out that it doesn't fail all the time, but only sporadically. So increasing the number of retries fixes (or at least works around) it.
OK, feel free to add ~3 retries inside
af9035_ctrl_msg()i think.
Well I didn't retry at that level, but at the fc0011 driver level. It does already retry once in fc0011 (with complete tuner reset). I increased it to 6 times (3 was not enough).
I think we can't retry at af9035_ctrl_msg() level, because the actual i2c/usb transfer does not fail. The received packet checksum even is ok (although we currently don't check it. I'll send a patch for that later).
Quoted 2 lines
You didn't mention if error is coming from af9035 firmware or from USB stack. Just for the interest...
I don't know how much the firmware is involved in this, but _maybe_ this glitch is caused by it.
Signature · 3 lines
Greetings, Michael. PGP encryption is encouraged / 908D8B0E
Quoted 9 lines · Michael Büsch
Quoted 6 lines · On Sun, 01 Apr 2012 19:20:21 +0300 Antti Palosaari<[email protected]> wrote:
Quoted 5 lines · Michael Büsch
Quoted 1 line · On Sun, 1 Apr 2012 15:11:53 +0200 Michael Büsch<[email protected]> wrote:
[ 3101.940765] i2c i2c-8: Failed to read VCO calibration value (got 20)
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Ok, it turns out that it doesn't fail all the time, but only sporadically. So increasing the number of retries fixes (or at least works around) it.
OK, feel free to add ~3 retries inside
af9035_ctrl_msg()i think.Well I didn't retry at that level, but at the fc0011 driver level. It does already retry once in fc0011 (with complete tuner reset). I increased it to 6 times (3 was not enough).
Maybe some delay is needed in order to wait tuner wakes up after the reset. Reason it does not occur the other driver is likely there is some delay somewhere...
Quoted 9 lines
I think we can't retry at
af9035_ctrl_msg()level, because the actual i2c/usb transfer does not fail. The received packet checksum even is ok (although we currently don't check it. I'll send a patch for that later).Quoted 2 lines
You didn't mention if error is coming from af9035 firmware or from USB stack. Just for the interest...
I don't know how much the firmware is involved in this, but _maybe_ this glitch is caused by it.
Indeed, you are correct, no changes for af9035_ctrl_msg() are not wanted as error is not coming from af9035. Likely some small delay for tuner in order to wake up it from the reset.
regards
Antti
Signature · 1 line
http://palosaari.fi/
Quoted 7 lines · On Sun, 01 Apr 2012 19:39:56 +0300 Antti Palosaari <[email protected]> wrote:
Quoted 3 lines
Well I didn't retry at that level, but at the fc0011 driver level. It does already retry once in fc0011 (with complete tuner reset). I increased it to 6 times (3 was not enough).
Maybe some delay is needed in order to wait tuner wakes up after the reset. Reason it does not occur the other driver is likely there is some delay somewhere...
Yep, I suspect that, too. However, I already tried lots of things that didn't really work. Such as adding 100ms delay before and after all i2c reads and writes inside of the fc0011 driver.
I'll investigate further...
Signature · 3 lines
Greetings, Michael. PGP encryption is encouraged / 908D8B0E
Il 01/04/2012 06:51, Antti Palosaari ha scritto:
[snip]
Quoted 7 lines
I need more AF903x hardware, please give links to cheap eBay devices etc. Also I would like to get one device where is AF9033 but no AF9035 at all just for stand-alone demodulator implementation. I know there is few such devices, like AverMedia A336 for example...
regards
Antti
Hi Antti,
here are a couple of links to buy cheap af9035 sticks.
Avermedia A835/B835: af9035 + tda18218, also known ad "Avermedia Volar HD" or "Avermedia Volar HD Pro" or "Avermedia Volar Green HD". The only difference between the models seems to be the presence of the remote controller and the IR sensor. The link is for the cheaper one, without the remote:
Avermedia A867: af9035 + mxl5007t, also known as "Aver Media AVerTV 3D" or "Sky Digital Key with blue led". You can buy them very cheap on Ebay Italia because Sky Italia is giving away them almost for free to its subscribers, to add DVB-T support to the Skyboxes. You can find dozens of link like this:
The A867 and A835 are probably the most common DVB-T sticks here in Italy, as they are very cheap and work pretty well. There is already some support for them (based on your old driver and also on the driver by Hans-Frieder Vogt) so I will look into porting it on the new driver.
Best regards,
Gianluca
Antti,
nice work! I'll try to port the features that I have in my implementation of an af9035 driver into yours.
Am Sonntag, 1. April 2012 schrieb Antti Palosaari:
Quoted 13 lines · Michael Büsch
Quoted 11 lines
On Sat, 31 Mar 2012 19:48:34 +0300
Quoted 5 lines · Antti Palosaari
And about the new FW downloader, that supports those new firmwares, feel free to implement it if you wish too. I will now goto out of house and will back during few hours. If you wish to do it just reply during 4 hours, and I will not start working for it. Instead I will continue with IT9135.
I have no clue about the firmware format, so it will probably be easier if you'd dive into that stuff as you already seem to know it.
Quoted 8 lines
Done. I didn't have neither info, but there was good posting from Daniel Glöckner that documents it! Nice job Daniel, without that info I was surely implemented it differently and surely more wrong way.
I pushed my experimental tree out, patches are welcome top of that.
http://git.linuxtv.org/anttip/media_tree.git/shortlog/refs/heads/af9035_exp
erimental
Your new firmware loader implies that the firmware is available as a type "download firmware". It seems this is indeed the case for most (all?) of the AF9035 devices. If the IT9135 driver should be merged, the "copy firmware" functionality (i.e. scatter write => command code 0x29) would need to be implemented.
Quoted 4 lines
I extracted three firmwares from windows binaries I have. I will sent those you, Michael, for testing. First, and oldest, is TUA9001, 2nd is from FC0012 device and 3rd no idea.
Quoted 9 lines
md5sum
f71efe295151ba76cac2280680b69f3f
LINK=11.5.9.0 OFDM=5.17.9.1md5sum
7cdc1e3aba54f3a9ad052dc6a29603fd
LINK=11.10.10.0 OFDM=5.33.10.0md5sum
862604ab3fec0c94f4bf22b4cffd0d89
LINK=12.13.15.0 OFDM=6.20.15.0
I have got a firmware converted from the linux driver version 1.0.28 for the AVermedia AVerTV A867R (07ca:1867, tuner: MaxLinear Mxl5007t) LINK=10.10.3.0 OFDM=4.21.6.251
(only 2 firmwares each for link and ofdm!)
For the same device the Windows driver verion 8.0.0.60 has a load of firmwares with
LINK=11.15.10.0 OFDM=5.48.10.0
(3 firmwares each for link and ofdm)
Quoted 1 line
From the Terratec T6 dual tuner device (fc0012) Windows driver version
10.09.20.01 I have got (is probably the one that you have got as well) LINK=12.13.15.0 OFDM=6.20.15.0
(3 firmwares each for link and ofdm)
I got an e-mail from Terratec support that they don't see a problem with the distribution of the firmware that I sniffed from the Terratec T6 running under Windows.
The Terratec Windows driver contains 3 firmwares that get selected depending on the available tuner:
firmware 1 for tuners TUA8010, TUA9001, TD1316AFIHP, TDA18271, TDA18291HN, XC3028L, XC4000, FC2580, FC0011, PICTOR, 0x40 (?), 0x43 (?) firmware 2 for tuner MT2266
firmware 3 for tuners FC0012 and 0x37
Quoted 1 line
From this I conclude that there is not a single generic firmware that we could
use for the af9035 devices, but maybe 3 are sufficient.
Quoted 7 lines
I need more AF903x hardware, please give links to cheap eBay devices etc. Also I would like to get one device where is AF9033 but no AF9035 at all just for stand-alone demodulator implementation. I know there is few such devices, like AverMedia A336 for example...
regards
Antti
regards,
Hans-Frieder
Hans-Frieder Vogt e-mail: hfvogt <at> gmx .dot. net
Quoted 2 lines · Hans-Frieder Vogt
nice work! I'll try to port the features that I have in my implementation of an af9035 driver into yours.
You are welcome! But please tell me what you are doing to avoid duplicate work. My today plan was to implement af9033 SNR, BER, UCB, but if you would like to then say it for me and I will jump back to IT9135 support.
regards
Antti
Signature · 1 line
http://palosaari.fi/
Antti,
I could provide the SNR, BER and UCB implementation (simply porting from my draft driver to yours).
But I first need to implement the support for my AverMedia A867R device so that I am able to test the implementation. Therefore it could take a few hours (maybe until tomorrow).
Regards,
Hans-Frieder
Am Sonntag, 1. April 2012 schrieb Antti Palosaari:
Quoted 11 lines · Hans-Frieder Vogt
Quoted 2 lines
nice work! I'll try to port the features that I have in my implementation of an af9035 driver into yours.
You are welcome! But please tell me what you are doing to avoid duplicate work. My today plan was to implement af9033 SNR, BER, UCB, but if you would like to then say it for me and I will jump back to IT9135 support.
regards
Antti
Hans-Frieder Vogt e-mail: hfvogt <at> gmx .dot. net
Quoted 7 lines · Hans-Frieder Vogt
Antti,
I could provide the SNR, BER and UCB implementation (simply porting from my draft driver to yours).
But I first need to implement the support for my AverMedia A867R device so that I am able to test the implementation. Therefore it could take a few hours (maybe until tomorrow).
Aaah, OK, but I was just working with SNR. I see your driver SNR was just register scaled to 0-0xffff whilst we nowadays prefer dBs , most commonly unit of 0.1 dB. So if thats OK for you I will finish that, and you can do BER and UCB, OK?
regards
Antti
Quoted 19 lines
Regards,
Hans-FriederAm Sonntag, 1. April 2012 schrieb Antti Palosaari:
Quoted 11 lines · Hans-Frieder Vogt
Quoted 2 lines
nice work! I'll try to port the features that I have in my implementation of an af9035 driver into yours.
You are welcome! But please tell me what you are doing to avoid duplicate work. My today plan was to implement af9033 SNR, BER, UCB, but if you would like to then say it for me and I will jump back to IT9135 support.
regards
AnttiHans-Frieder Vogt e-mail: hfvogt<at> gmx .dot. net
Signature · 1 line
http://palosaari.fi/
Am Sonntag, 1. April 2012 schrieb Antti Palosaari:
Quoted 9 lines · Hans-Frieder Vogt
Quoted 7 lines
Antti,
I could provide the SNR, BER and UCB implementation (simply porting from my draft driver to yours).
But I first need to implement the support for my AverMedia A867R device so that I am able to test the implementation. Therefore it could take a few hours (maybe until tomorrow).
Quoted 4 lines
Aaah, OK, but I was just working with SNR. I see your driver SNR was just register scaled to 0-0xffff whilst we nowadays prefer dBs , most commonly unit of 0.1 dB. So if thats OK for you I will finish that, and you can do BER and UCB, OK?
OK, I'll focus on these.
Quoted 4 lines
regards
Antti
[...]
cheers,
Hans-Frieder Vogt e-mail: hfvogt <at> gmx .dot. net
Ooops forget to comment these...
Quoted 5 lines · Hans-Frieder Vogt
Your new firmware loader implies that the firmware is available as a type "download firmware". It seems this is indeed the case for most (all?) of the AF9035 devices. If the IT9135 driver should be merged, the "copy firmware" functionality (i.e. scatter write => command code
0x29) would need to be implemented.
Technically correct way is to split out all functionality, I mean USB -interface, demodulator and tuner, as own driver modules and use same modules for all the hardware not caring integration level. Those are just logical entities put to inside same silicon or sold separately.
For the existing IT9135 driver, it is there and surely will not be removed unless it goes unmaintained. Still it is nice to offer modular implementation as a choice for upcoming devices.
I haven't looked so carefully IT9135 FW download process - only thing I noticed it uses totally much smaller firmware than af9035, which is somehow weird since it contains tuner which is main difference between af9035 and it9135 :) Maybe there is done some bug fixing or other improvements in silicon level too.
It is easy to implement 2 or more firmware downloader, one for each firmware type and select correct by driver.
Quoted 6 lines
Quoted 6 lines
I extracted three firmwares from windows binaries I have. I will sent those you, Michael, for testing. First, and oldest, is TUA9001, 2nd is from FC0012 device and 3rd no idea.
md5sum
f71efe295151ba76cac2280680b69f3f
LINK=11.5.9.0 OFDM=5.17.9.1
That was from TerraTec Cinergy T -Stick, the stick which was one of the first af9035 and I originally made driver for.
Quoted 2 lines
Quoted 2 lines
md5sum
7cdc1e3aba54f3a9ad052dc6a29603fd
LINK=11.10.10.0 OFDM=5.33.10.0
Some DealExtreme cheap stick.
Quoted 13 lines
Quoted 3 lines
md5sum
862604ab3fec0c94f4bf22b4cffd0d89
LINK=12.13.15.0 OFDM=6.20.15.0I have got a firmware converted from the linux driver version 1.0.28 for the AVermedia AVerTV A867R (07ca:1867, tuner: MaxLinear Mxl5007t) LINK=10.10.3.0 OFDM=4.21.6.251
(only 2 firmwares each for link and ofdm!)For the same device the Windows driver verion 8.0.0.60 has a load of firmwares with
LINK=11.15.10.0 OFDM=5.48.10.0
(3 firmwares each for link and ofdm)
Quoted 4 lines
From the Terratec T6 dual tuner device (fc0012) Windows driver version
10.09.20.01 I have got (is probably the one that you have got as well) LINK=12.13.15.0 OFDM=6.20.15.0
(3 firmwares each for link and ofdm)
True.
Quoted 4 lines
I got an e-mail from Terratec support that they don't see a problem with the distribution of the firmware that I sniffed from the Terratec T6 running under Windows.
Quoted 8 lines
The Terratec Windows driver contains 3 firmwares that get selected depending on the available tuner:
firmware 1 for tuners TUA8010, TUA9001, TD1316AFIHP, TDA18271, TDA18291HN, XC3028L, XC4000, FC2580, FC0011, PICTOR,0x40(?),0x43(?) firmware 2 for tuner MT2266
firmware 3 for tuners FC0012 and0x37
From this I conclude that there is not a single generic firmware that we could
use for the af9035 devices, but maybe 3 are sufficient.
We should gather enough information to decide used firmware naming. Mainly for that reason I didn't release get_dvb_firmware changes I used to extract those.
So do you have the idea about firmware naming?
Reading tuner ID from eeprom before firmware download is needed as you point out. And then select firmware based of that. Or is it possible to split firmwares even smaller blocks like LINK and OFDM and download those separately. I think it is OFDM version which says if tuner is supported or not.
regards
Antti
Signature · 1 line
http://palosaari.fi/
[PATCH][GIT PULL FOR 3.5] AF9035/AF9033/TUA9001 support for AverTV A867R (mxl5007t tuner)
In reply to Antti PalosaariSupport of AVerMedia AVerTV HD Volar, with tuner MxL5007t (needs the i2c read bug fixed patch send earlier).
drivers/media/dvb/dvb-usb/af9033.c | 36 +++++++++++--- drivers/media/dvb/dvb-usb/af9033.h | 6 ++ drivers/media/dvb/dvb-usb/af9033_priv.h | 35 ++++++++++++++ drivers/media/dvb/dvb-usb/af9035.c | 78 +++++++++++++++++++++++++++++--- drivers/media/dvb/dvb-usb/af9035.h | 31 +++++++----- drivers/media/dvb/dvb-usb/dvb-usb-ids.h | 1 6 files changed, 158 insertions(+), 29 deletions(-)
drivers/media/dvb/dvb-usb/af9033.c +27 -9
@@ -297,6 +297,10 @@ static int af9033_init(struct dvb_fronte len =ARRAY_SIZE (tuner_init_tua9001); init = tuner_init_tua9001;break ; +case AF9033_TUNER_MXL5007T : + len =ARRAY_SIZE (tuner_init_mxl5007t); + init = tuner_init_mxl5007t; +break ;default :pr_debug ("%s: unsupported tuner ID=%d\n" , __func__, state->cfg.tuner);
@@ -387,9 +391,9 @@ static int af9033_set_frontend(struct dv {struct af9033_state *state = fe->demodulator_priv;struct dtv_frontend_properties *c = &fe->dtv_property_cache; -int ret, i; +int ret, i, spec_inv;u8 tmp, buf[3 ], bandwidth_reg_val; -u32 if_frequency, freq_cw; +u32 if_frequency, freq_cw, adc_freq;pr_debug ("%s: frequency=%d bandwidth_hz=%d\n" , __func__, c->frequency, c->bandwidth_hz);
@@ -429,22 +433,36 @@ static int af9033_set_frontend(struct dv/* program frequency control */ if (c->bandwidth_hz != state->bandwidth_hz) { + spec_inv = state->cfg.spec_inv ?-1 :1 ; + adc_freq = state->cfg.adc_clock; +/* get used IF frequency */ if (fe->ops.tuner_ops.get_if_frequency) fe->ops.tuner_ops.get_if_frequency (fe, &if_frequency);else if_frequency =0 ; -/* FIXME: we support only Zero-IF currently */ -if (if_frequency !=0 ) { -pr_debug ("%s: only Zero-IF supported currently\n" , - __func__); +while (if_frequency > (adc_freq /2 )) + if_frequency -= adc_freq; + +if (if_frequency >=0 ) + spec_inv *=-1 ; +else + if_frequency *=-1 ; + + freq_cw =af9033_div (if_frequency, adc_freq,23ul ); + +if (spec_inv ==-1 ) + freq_cw *=-1 ; - ret = -ENODEV ; +/* get adc multiplies */ + ret =af9033_rd_reg (state,0x800045 , &tmp); +if (ret <0 ) goto err; - } - freq_cw =0 ; +if (tmp ==1 ) + freq_cw /=2 ; + buf[0 ] = (freq_cw >>0 ) &0xff ; buf[1 ] = (freq_cw >>8 ) &0xff ; buf[2 ] = (freq_cw >>16 ) &0x7f ;
drivers/media/dvb/dvb-usb/af9033.h +6 -0
@@ -36,10 +36,16 @@ struct af9033_config {u32 clock;/* +* ADC clock Hz +*/ +u32 adc_clock; + +/* * tuner */ #define AF9033_TUNER_TUA9001 0x27/* Infineon TUA 9001 */ #define AF9033_TUNER_FC0011 0x28/* Fitipower FC0011 */ +#define AF9033_TUNER_MXL5007T 0xa0/* MaxLinear MxL5007T */ u8 tuner;/*
drivers/media/dvb/dvb-usb/af9033_priv.h +35 -0
@@ -238,5 +238,40 @@ static const struct reg_val tuner_init_t { 0x80f1e6, 0x00 }, }; +/* MaxLinear MxL5007T tuner init + AF9033_TUNER_MXL5007T = 0xa0 */ +static const struct reg_val tuner_init_mxl5007t[] = { + { 0x800046, 0x1b }, + { 0x800057, 0x01 }, + { 0x800058, 0x01 }, + { 0x80005f, 0x00 }, + { 0x800060, 0x00 }, + { 0x800068, 0x96 }, + { 0x800071, 0x05 }, + { 0x800072, 0x02 }, + { 0x800074, 0x01 }, + { 0x800079, 0x01 }, + { 0x800093, 0x00 }, + { 0x800094, 0x00 }, + { 0x800095, 0x00 }, + { 0x800096, 0x00 }, + { 0x8000b3, 0x01 }, + { 0x8000c1, 0x01 }, + { 0x8000c2, 0x00 }, + { 0x80f007, 0x00 }, + { 0x80f00c, 0x19 }, + { 0x80f00d, 0x1a }, + { 0x80f012, 0xda }, + { 0x80f013, 0x00 }, + { 0x80f014, 0x00 }, + { 0x80f015, 0x02 }, + { 0x80f01f, 0x82 }, + { 0x80f020, 0x00 }, + { 0x80f029, 0x82 }, + { 0x80f02a, 0x00 }, + { 0x80f077, 0x02 }, + { 0x80f1e6, 0x00 }, +}; + #endif /* AF9033_PRIV_H */
drivers/media/dvb/dvb-usb/af9035.c +71 -7
143 lines not on this page · raw message
drivers/media/dvb/dvb-usb/af9035.h +18 -13
@@ -66,19 +66,24 @@ struct fw_header {struct fw_segment segment[SEGMENT_MAX_COUNT ]; }; -u32 clock_lut[] = { -20480000 ,/* FPGA */ -16384000 ,/* 16.38 MHz */ -20480000 ,/* 20.48 MHz */ -36000000 ,/* 36.00 MHz */ -30000000 ,/* 30.00 MHz */ -26000000 ,/* 26.00 MHz */ -28000000 ,/* 28.00 MHz */ -32000000 ,/* 32.00 MHz */ -34000000 ,/* 34.00 MHz */ -24000000 ,/* 24.00 MHz */ -22000000 ,/* 22.00 MHz */ -12000000 ,/* 12.00 MHz */ +struct af9035_clock { +u32 crystal; +u32 adc; +}; + +struct af9035_clock clock_lut[] = { + {20480000 ,20480000 },/* FPGA */ + {16384000 ,20480000 },/* 16.38 MHz */ + {20480000 ,20480000 },/* 20.48 MHz */ + {36000000 ,20250000 },/* 36.00 MHz */ + {30000000 ,20156250 },/* 30.00 MHz */ + {26000000 ,20583333 },/* 26.00 MHz */ + {28000000 ,20416667 },/* 28.00 MHz */ + {32000000 ,20500000 },/* 32.00 MHz */ + {34000000 ,20187500 },/* 34.00 MHz */ + {24000000 ,20500000 },/* 24.00 MHz */ + {22000000 ,20625000 },/* 22.00 MHz */ + {12000000 ,20250000 }/* 12.00 MHz */ };/* EEPROM locations */
drivers/media/dvb/dvb-usb/dvb-usb-ids.h +1 -0
@@ -221,6 +221,7 @@#define USB_PID_AVERMEDIA_A850T 0x850b#define USB_PID_AVERMEDIA_A805 0xa805#define USB_PID_AVERMEDIA_A815M 0x815a +#define USB_PID_AVERMEDIA_1867 0x1867#define USB_PID_TECHNOTREND_CONNECT_S2400 0x3006#define USB_PID_TECHNOTREND_CONNECT_CT3650 0x300d#define USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY 0x005a
Hans-Frieder Vogt e-mail: hfvogt <at> gmx .dot. net
Re: [PATCH][GIT PULL FOR 3.5] AF9035/AF9033/TUA9001 support for AverTV A867R (mxl5007t tuner)
Quoted 1 line · Hans-Frieder Vogt
Support of AVerMedia AVerTV HD Volar, with tuner MxL5007t (needs the i2c read bug fixed patch send earlier).
Could you sent separate patch for I2C read fix?
The only functional comment I has is about ADC frequency. There is Xtal/ADC lookup table already in af9033_priv.h. You could use it instead of adding new configuration parameter. Demodulator driver generally needs only Xtal frequency as a parameter, other can be usually discovered by driver.
But if you would not like to fix it, I will apply that as it is. It is not so important issue after all.
regards
Antti
Signature · 1 line
http://palosaari.fi/
[PATCH][GIT PULL FOR 3.5] AF9035/AF9033/TUA9001 i2c read fix
Antti,
attached is the i2c read fix (necessary e.g. for mxl5007t tuner, because it sends a 2 bytes for a read request, thus msg[0].len != msg[1].len).
Am Sonntag, 1. April 2012 schrieb Antti Palosaari:
Quoted 12 lines · Hans-Frieder Vogt
Quoted 2 lines
Support of AVerMedia AVerTV HD Volar, with tuner MxL5007t (needs the i2c read bug fixed patch send earlier).
Could you sent separate patch for I2C read fix?
The only functional comment I has is about ADC frequency. There is Xtal/ADC lookup table already in
af9033_priv.h. You could use it instead of adding new configuration parameter. Demodulator driver generally needs only Xtal frequency as a parameter, other can be usually discovered by driver.
Quoted 5 lines
But if you would not like to fix it, I will apply that as it is. It is not so important issue after all.
regards
Antti
Enable i2c read requests.
drivers/media/dvb/dvb-usb/af9035.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-)
diff -Nupr a/drivers/media/dvb/dvb-usb/af9035.c b/drivers/media/dvb/dvb- usb/af9035.c
drivers/media/dvb/dvb-usb/af9035.c +1 -10
@@ -209,24 +209,15 @@ static int af9035_i2c_master_xfer(struct msg[1].len); }else {/* I2C */ -#if 0 -/* -* FIXME: Keep that code. It should work but as it is -* not tested I left it disabled and return -EOPNOTSUPP -* for the sure. -*/ u8 buf[4 + msg[0 ].len];struct usb_req req = {CMD_I2C_RD ,0 ,sizeof (buf), buf, msg[1 ].len, msg[1 ].buf }; - buf[0 ] = msg[0 ].len; + buf[0 ] = msg[1 ].len; buf[1 ] = msg[0 ].addr <<1 ; buf[2 ] =0x01 ; buf[3 ] =0x00 ;memcpy (&buf[4 ], msg[0 ].buf, msg[0 ].len); ret =af9035_ctrl_msg (d->udev, &req); -#endif -pr_debug ("%s: I2C operation not supported\n" , __func__); - ret = -EOPNOTSUPP ; } }else if (num ==1 && !(msg[0 ].flags &I2C_M_RD )) {if (msg[0 ].len >40 ) {
Hans-Frieder Vogt e-mail: hfvogt <at> gmx .dot. net
Antti Palosaari
AppliedRe: [PATCH][GIT PULL FOR 3.5] AF9035/AF9033/TUA9001 i2c read fix
Quoted 6 lines · Hans-Frieder Vogt
attached is the i2c read fix (necessary e.g. for mxl5007t tuner, because it sends a 2 bytes for a read request, thus msg[0].len != msg[1].len).
Enable i2c read requests.
Signed-off-by Hans-Frieder Vogt<[email protected]>
Applied, thank you!
http://git.linuxtv.org/anttip/media_tree.git/shortlog/refs/heads/af9035_experimental
regards
Antti
Signature · 1 line
http://palosaari.fi/
[PATCH][GIT PULL FOR 3.5] AF9035/AF9033/TUA9001 support for AverTV A867R (mxl5007t), version 2
In reply to Hans-Frieder VogtSupport of AVerMedia AVerTV HD Volar, with tuner MxL5007t, second version of patch (usage of clock_adc_lut instead of adc config variable)
drivers/media/dvb/dvb-usb/af9033.c | 45 +++++++++++++++---- drivers/media/dvb/dvb-usb/af9033.h | 1 drivers/media/dvb/dvb-usb/af9033_priv.h | 35 ++++++++++++++ drivers/media/dvb/dvb-usb/af9035.c | 75 +++++++++++++++++++++++++++++--- drivers/media/dvb/dvb-usb/dvb-usb-ids.h | 1 5 files changed, 142 insertions(+), 15 deletions(-)
drivers/media/dvb/dvb-usb/af9033.c +36 -9
@@ -297,6 +297,10 @@ static int af9033_init(struct dvb_fronte len =ARRAY_SIZE (tuner_init_tua9001); init = tuner_init_tua9001;break ; +case AF9033_TUNER_MXL5007T : + len =ARRAY_SIZE (tuner_init_mxl5007t); + init = tuner_init_mxl5007t; +break ;default :pr_debug ("%s: unsupported tuner ID=%d\n" , __func__, state->cfg.tuner);
@@ -387,9 +391,9 @@ static int af9033_set_frontend(struct dv {struct af9033_state *state = fe->demodulator_priv;struct dtv_frontend_properties *c = &fe->dtv_property_cache; -int ret, i; +int ret, i, spec_inv;u8 tmp, buf[3 ], bandwidth_reg_val; -u32 if_frequency, freq_cw; +u32 if_frequency, freq_cw, adc_freq;pr_debug ("%s: frequency=%d bandwidth_hz=%d\n" , __func__, c->frequency, c->bandwidth_hz);
@@ -429,22 +433,45 @@ static int af9033_set_frontend(struct dv/* program frequency control */ if (c->bandwidth_hz != state->bandwidth_hz) { + spec_inv = state->cfg.spec_inv ?-1 :1 ; + +for (i =0 ; i <ARRAY_SIZE (clock_adc_lut); i++) { +if (clock_adc_lut[i].clock == state->cfg.clock) +break ; + } +if (i >=ARRAY_SIZE (clock_adc_lut)) { + ret = -EINVAL ; + goto err; + } + adc_freq = clock_adc_lut[i].adc; +/* get used IF frequency */ if (fe->ops.tuner_ops.get_if_frequency) fe->ops.tuner_ops.get_if_frequency (fe, &if_frequency);else if_frequency =0 ; -/* FIXME: we support only Zero-IF currently */ -if (if_frequency !=0 ) { -pr_debug ("%s: only Zero-IF supported currently\n" , - __func__); +while (if_frequency > (adc_freq /2 )) + if_frequency -= adc_freq; - ret = -ENODEV ; +if (if_frequency >=0 ) + spec_inv *=-1 ; +else + if_frequency *=-1 ; + + freq_cw =af9033_div (if_frequency, adc_freq,23ul ); + +if (spec_inv ==-1 ) + freq_cw *=-1 ; + +/* get adc multiplies */ + ret =af9033_rd_reg (state,0x800045 , &tmp); +if (ret <0 ) goto err; - } - freq_cw =0 ; +if (tmp ==1 ) + freq_cw /=2 ; + buf[0 ] = (freq_cw >>0 ) &0xff ; buf[1 ] = (freq_cw >>8 ) &0xff ; buf[2 ] = (freq_cw >>16 ) &0x7f ;
drivers/media/dvb/dvb-usb/af9033.h +1 -0
@@ -40,6 +40,7 @@ struct af9033_config {*/ #define AF9033_TUNER_TUA9001 0x27/* Infineon TUA 9001 */ #define AF9033_TUNER_FC0011 0x28/* Fitipower FC0011 */ +#define AF9033_TUNER_MXL5007T 0xa0/* MaxLinear MxL5007T */ u8 tuner;/*
drivers/media/dvb/dvb-usb/af9033_priv.h +35 -0
@@ -238,5 +238,40 @@ static const struct reg_val tuner_init_t { 0x80f1e6, 0x00 }, }; +/* MaxLinear MxL5007T tuner init + AF9033_TUNER_MXL5007T = 0xa0 */ +static const struct reg_val tuner_init_mxl5007t[] = { + { 0x800046, 0x1b }, + { 0x800057, 0x01 }, + { 0x800058, 0x01 }, + { 0x80005f, 0x00 }, + { 0x800060, 0x00 }, + { 0x800068, 0x96 }, + { 0x800071, 0x05 }, + { 0x800072, 0x02 }, + { 0x800074, 0x01 }, + { 0x800079, 0x01 }, + { 0x800093, 0x00 }, + { 0x800094, 0x00 }, + { 0x800095, 0x00 }, + { 0x800096, 0x00 }, + { 0x8000b3, 0x01 }, + { 0x8000c1, 0x01 }, + { 0x8000c2, 0x00 }, + { 0x80f007, 0x00 }, + { 0x80f00c, 0x19 }, + { 0x80f00d, 0x1a }, + { 0x80f012, 0xda }, + { 0x80f013, 0x00 }, + { 0x80f014, 0x00 }, + { 0x80f015, 0x02 }, + { 0x80f01f, 0x82 }, + { 0x80f020, 0x00 }, + { 0x80f029, 0x82 }, + { 0x80f02a, 0x00 }, + { 0x80f077, 0x02 }, + { 0x80f1e6, 0x00 }, +}; + #endif /* AF9033_PRIV_H */
drivers/media/dvb/dvb-usb/af9035.c +69 -6
141 lines not on this page · raw message
drivers/media/dvb/dvb-usb/dvb-usb-ids.h +1 -0
@@ -221,6 +221,7 @@#define USB_PID_AVERMEDIA_A850T 0x850b#define USB_PID_AVERMEDIA_A805 0xa805#define USB_PID_AVERMEDIA_A815M 0x815a +#define USB_PID_AVERMEDIA_1867 0x1867#define USB_PID_TECHNOTREND_CONNECT_S2400 0x3006#define USB_PID_TECHNOTREND_CONNECT_CT3650 0x300d#define USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY 0x005a
Hans-Frieder Vogt e-mail: hfvogt <at> gmx .dot. net
PATCH 1/1 AF9033 read_ber and read_ucblocks implementation
Implementation of af9033_read_ber and af9033_read_ucblocks functions.
drivers/media/dvb/dvb-usb/af9033.c | 68 +++++++++++++++++++++++++++++++++++-- 1 file changed, 66 insertions(+), 2 deletions(-)
drivers/media/dvb/dvb-usb/af9033.c +66 -2
@@ -29,6 +29,10 @@ struct af9033_state {u32 bandwidth_hz;bool ts_mode_parallel;bool ts_mode_serial; + +u32 ber; +u32 ucb; +unsigned long last_stat_check; };/* write multiple registers */
@@ -594,16 +598,76 @@ err:return ret; } +static int af9033_update_ch_stat (struct af9033_state *state) +{ +int ret =0 ; +u32 post_err_cnt, post_bit_cnt; +u16 abort_cnt; +u8 buf[7 ]; +static u8 sw =0 ; + +/* only update data every half second */ +if (time_after (jiffies, state->last_stat_check +500 *HZ /1000 )) { + ret =af9033_rd_regs (state,0x800032 , buf,sizeof (buf)); +if (ret <0 ) + goto err; + abort_cnt = (buf[1 ] <<8 ) + buf[0 ]; + post_err_cnt = (buf[4 ] <<16 ) + (buf[3 ] <<8 ) + buf[2 ]; + post_bit_cnt = (buf[6 ] <<8 ) + buf[5 ]; +if (post_bit_cnt ==0 ) { + abort_cnt =1000 ; + post_err_cnt =1 ; + post_bit_cnt =2 ; + }else { + post_bit_cnt -= (u32 )abort_cnt; +if (post_bit_cnt ==0 ) { + post_err_cnt =1 ; + post_bit_cnt =2 ; + }else { + post_err_cnt -= (u32 )abort_cnt *8 *8 ; + post_bit_cnt *=204 *8 ; + } + } + state->ber = post_err_cnt * (0xffffffff / post_bit_cnt); +/* reset ucblocks value every second call */ +if (sw) + state->ucb = abort_cnt; +else + state->ucb = +abort_cnt; + sw = ~sw; + state->last_stat_check = jiffies; + } + +return 0 ; +err: +pr_debug ("%s: failed=%d\n" , __func__, ret); +return ret; +} +static int af9033_read_ber (struct dvb_frontend *fe,u32 *ber) { - *ber =0 ; +struct af9033_state *state = fe->demodulator_priv; +int ret; + + ret =af9033_update_ch_stat (state); +if (ret <0 ) +return ret; + + *ber = state->ber;return 0 ; }static int af9033_read_ucblocks (struct dvb_frontend *fe,u32 *ucblocks) { - *ucblocks =0 ; +struct af9033_state *state = fe->demodulator_priv; +int ret; + + ret =af9033_update_ch_stat (state); +if (ret <0 ) +return ret; + + *ucblocks = state->ucb;return 0 ; }
Hans-Frieder Vogt e-mail: hfvogt <at> gmx .dot. net
Re: [PATCH] AF9033 read_ber and read_ucblocks implementation
Quoted 5 lines · Hans-Frieder Vogt
Implementation of
af9033_read_berandaf9033_read_ucblocksfunctions.Signed-off-by Hans-Frieder Vogt<[email protected]>drivers/media/dvb/dvb-usb/af9033.c | 68 +++++++++++++++++++++++++++++++++++--
Same wrong path issue.
drivers/media/dvb/dvb-usb/af9033.c err: · line 610
Quoted 2 lines
drivers/media/dvb/dvb-usb/af9033.c +2
-0+/* only update data every half second */ +if (time_after (jiffies, state->last_stat_check +500 *HZ /1000 )) {
500 * HZ looks odd. I suspect correct way is to use some macros for that. See af9013 example usage of jiffies or explain the reason why 500 * HZ :)
drivers/media/dvb/dvb-usb/af9033.c err: · line 637
Quoted 1 line
drivers/media/dvb/dvb-usb/af9033.c +1
-0+ sw = ~sw;
I don't see any reason for that?
It looked somehow complex, but I trust those calculations are kinda correct.
IMHO it is enough to put random raw number from register to UCB and BER counters. Random numbers are good enough unless you are making measurement equipment. But off-course correct calculations are allowed.
regards
Antti
Signature · 1 line
http://palosaari.fi/
Re: [PATCH] AF9033 read_ber and read_ucblocks implementation
Quoted 5 lines · Antti Palosaari
Quoted 2 lines · Hans-Frieder Vogt
Implementation of
af9033_read_berandaf9033_read_ucblocksfunctions.
+ sw = ~sw;I don't see any reason for that?
Now I see, it is some kind of switch to make operation every second call? As it is defined static:
+ static u8 sw = 0;
[...]
+ if (sw)
+ state->ucb = abort_cnt;
+ else
+ state->ucb = +abort_cnt;
+ sw = ~sw;
Unfortunately I am almost sure it will not work as it should. In my understanding this kind of static variables are shared between driver instances... and if you have device where is two or more af9033 demods it will share it. Also if you have multiple af9033 devices, are are shared. It works only if you have one af9033 demodulator in use.
Instead, this kind of switches should be but to driver private aka state. Also think twice if all that logic is correct and needed.
regards
Antti
Signature · 1 line
http://palosaari.fi/
Re: [PATCH][GIT PULL FOR 3.5] AF9035/AF9033/TUA9001 support for AverTV A867R (mxl5007t), version 2
In reply to Hans-Frieder VogtQuoted 4 lines · Hans-Frieder Vogt
Support of AVerMedia AVerTV HD Volar, with tuner MxL5007t, second version of patch (usage of
clock_adc_lutinstead of adc config variable)Signed-off-by Hans-Frieder Vogt<[email protected]>
Patch does not apply.
wget -O - http://patchwork.linuxtv.org/patch/10536/mbox/ | git am -s [...]
Applying: AF9035/AF9033/TUA9001 support for AverTV A867R (mxl5007t), version 2
error: drivers/media/dvb/dvb-usb/af9033.c: does not exist in index
error: drivers/media/dvb/dvb-usb/af9033.h: does not exist in index
error: drivers/media/dvb/dvb-usb/af9033_priv.h: does not exist in index
How is it possible you have the af9033 demod driver inside dvb-usb directory? Demod drivers are inside drivers/media/dvb/frontends/. DVB USB interface drivers are inside drivers/media/dvb/dvb-usb/.
Now it looks still much better than first version.
Here are still some comments of quick visual review:
drivers/media/dvb/dvb-usb/af9033.c static int af9033_set_frontend(struct dv · line 445
Quoted 8 lines
drivers/media/dvb/dvb-usb/af9033.c +8
-0+for (i =0 ; i<ARRAY_SIZE (clock_adc_lut); i++) { +if (clock_adc_lut[i].clock == state->cfg.clock) +break ; + } +if (i>=ARRAY_SIZE (clock_adc_lut)) { + ret = -EINVAL ; + goto err; + }
That error check is useless in my understanding. It is never taken. Likely some Kernel semantic error checker will report it later...
drivers/media/dvb/dvb-usb/af9035.c static int af9035_read_mac_address(struc · line 511
Quoted 7 lines
drivers/media/dvb/dvb-usb/af9035.c +3
-1+ adc_freq = clock_adc_lut[i].adc; -for (i =0 ; i< af9035_properties[0 ].num_adapters; i++) +for (i =0 ; i< af9035_properties[0 ].num_adapters; i++) { af9035_af9033_config[i].clock = clock_lut[tmp]; + }
No braces allowed here as it is single line. You did not ran checkpatch.pl as it will report those.
Hans-Frieder, fix those findings and remember ran also Kernel checkpatch.pl - it may report some more findings.
You can ran it like that:
git diff drivers/media/dvb/frontends/af9033.c | ./scripts/checkpatch.pl -
Or if you have already added those files as git add then you can:
git diff --cached | ./scripts/checkpatch.pl -
Good work still! Next try should be OK :)
regards
Antti
Signature · 1 line
http://palosaari.fi/
Re: [PATCH][GIT PULL FOR 3.5] AF9035/AF9033/TUA9001 support for AverTV A867R (mxl5007t), version 2
Antti,
I am currently working with a simple standalone test environment and therefore have manually (!) included the paths. Well, this went terribly wrong... Sorry.
Am Sonntag, 1. April 2012 schrieb Antti Palosaari:
Quoted 22 lines · Hans-Frieder Vogt
Quoted 4 lines
Support of AVerMedia AVerTV HD Volar, with tuner MxL5007t, second version of patch (usage of
clock_adc_lutinstead of adc config variable)Signed-off-by Hans-Frieder Vogt<[email protected]>Patch does not apply.
wget -O - http://patchwork.linuxtv.org/patch/10536/mbox/ | git am -s [...]
Applying: AF9035/AF9033/TUA9001 support for AverTV A867R (mxl5007t), version 2
error:drivers/media/dvb/dvb-usb/af9033.c: does not exist in index
error:drivers/media/dvb/dvb-usb/af9033.h: does not exist in index
error:drivers/media/dvb/dvb-usb/af9033_priv.h: does not exist in indexHow is it possible you have the af9033 demod driver inside dvb-usb directory? Demod drivers are inside
drivers/media/dvb/frontends/. DVB USB interface drivers are insidedrivers/media/dvb/dvb-usb/.Now it looks still much better than first version.
Here are still some comments of quick visual review:
Quoted 8 lines
drivers/media/dvb/dvb-usb/af9033.c static int af9033_set_frontend(struct dv · line 445
Quoted 8 lines
drivers/media/dvb/dvb-usb/af9033.c +8
-0+for (i =0 ; i<ARRAY_SIZE (clock_adc_lut); i++) { +if (clock_adc_lut[i].clock == state->cfg.clock) +break ; + } +if (i>=ARRAY_SIZE (clock_adc_lut)) { + ret = -EINVAL ; + goto err; + }
I included this as a sanity check. It should not be needed if it can be ensured that the lookup tables clock_lut (in af9035.h) and clock_adc_lut (in af9033_priv.h) always contain the same Xtal frequencies. Maybe these two tables coule be merged...
Quoted 16 lines
That error check is useless in my understanding. It is never taken. Likely some Kernel semantic error checker will report it later...
Review
Quoted 9 lines
(quoted diff) +3
-1+ adc_freq = clock_adc_lut[i].adc; - for (i = 0; i< af9035_properties[0].num_adapters; i++) + for (i = 0; i< af9035_properties[0].num_adapters; i++) { af9035_af9033_config[i].clock = clock_lut[tmp]; + }No braces allowed here as it is single line. You did not ran checkpatch.pl as it will report those.
Quoted 6 lines
Hans-Frieder, fix those findings and remember ran also Kernel checkpatch.pl - it may report some more findings.
You can ran it like that:
git diffdrivers/media/dvb/frontends/af9033.c|./scripts/checkpatch.pl-
thanks very much. I'll send an updated patch soon...
Quoted 7 lines
Or if you have already added those files as git add then you can:
git diff --cached |./scripts/checkpatch.pl-Good work still! Next try should be OK :)
regards
Antti
regards,
Hans-Frieder Vogt e-mail: hfvogt <at> gmx .dot. net
Quoted 12 lines · On Sat, 31 Mar 2012 19:34:23 +0300 Antti Palosaari <[email protected]> wrote:
Quoted 11 lines · Michael Büsch
Quoted 2 lines · On Sat, 31 Mar 2012 17:28:38 +0300 Antti Palosaari<[email protected]> wrote:
Googling the filename reveals many links, here is one:
http://xgazza.altervista.org/Linux/DVB/dvb-usb-af9035-01.fwHm, on tuner register access I get these errors:
[ 9259.080907] af9035_ctrl_msg: command=03 failed fw error=2 [ 9259.080922] i2c i2c-8: I2C write reg failed, reg: 07, val: 0f
Quoted 8 lines
Quoted 4 lines
Is it possible that this firmware is incompatible with my stick? The firmware that I successfully used with the other af9035 driver seems to be incompatible with your driver, though. It crashes it somewhere on firmware download in one of the USB transfer's memcpy.
Most likely it is incompatible. It is surely one of the earliest firmwares. I will try to make that new fw downloaded ASAP, likely tomorrow morning it is done.
Ok, thanks a lot.
Attached are my current fc0011 patches. Just for reference.
Signature · 3 lines
Greetings, Michael. PGP encryption is encouraged / 908D8B0E
drivers/media/common/tuners/Kconfig +7 -0
@@ -204,6 +204,13 @@ help NXP TDA18218 silicon tuner driver. +config MEDIA_TUNER_FC0011 + tristate "Fitipower FC0011 silicon tuner" + depends on VIDEO_MEDIA && I2C + default m if MEDIA_TUNER_CUSTOMISE + help + Fitipower FC0011 silicon tuner driver. + config MEDIA_TUNER_TDA18212 tristate "NXP TDA18212 silicon tuner" depends on VIDEO_MEDIA && I2C
drivers/media/common/tuners/Makefile +1 -0
@@ -29,6 +29,7 @@ obj-$(CONFIG_MEDIA_TUNER_TDA18218) += tda18218.o obj-$(CONFIG_MEDIA_TUNER_TDA18212) += tda18212.o obj-$(CONFIG_MEDIA_TUNER_TUA9001) += tua9001.o +obj-$(CONFIG_MEDIA_TUNER_FC0011) += fc0011.o ccflags-y += -I$(srctree)/drivers/media/dvb/dvb-core ccflags-y += -I$(srctree)/drivers/media/dvb/frontends
drivers/media/common/tuners/fc0011.c new file +489 -0
489 lines not on this page · raw message
drivers/media/common/tuners/fc0011.h new file +41 -0
41 lines not on this page · raw message
MAINTAINERS +7 -0
@@ -2694,6 +2694,13 @@ F: Documentation/hwmon/f71805f F: drivers/hwmon/f71805f.c +FC0011 TUNER DRIVER +M: Michael Buesch <[email protected]> +L: [email protected] +S: Maintained +F: drivers/media/common/tuners/fc0011.h +F: drivers/media/common/tuners/fc0011.c + FANOTIFY M: Eric Paris <[email protected]> S: Maintained
drivers/media/dvb/dvb-usb/af9035.c +14 -2
@@ -634,11 +634,17 @@enum af9035_id_entry {AF9035_0CCD_0093 , +AF9035_15A4_1001 , +AF9035_15A4_9035 , };static struct usb_device_id af9035_id[] = { [AF9035_0CCD_0093 ] = {USB_DEVICE (USB_VID_TERRATEC ,USB_PID_TERRATEC_CINERGY_T_STICK )}, + [AF9035_15A4_1001 ] = { +USB_DEVICE (0x15A4 ,0x1001 )}, + [AF9035_15A4_9035 ] = { +USB_DEVICE (0x15A4 ,0x9035 )}, {}, };
@@ -681,14 +687,20 @@ .i2c_algo = &af9035_i2c_algo, - .num_device_descs = 1, + .num_device_descs = 2, .devices = { { .name = "TerraTec Cinergy T Stick", .cold_ids = { &af9035_id[AF9035_0CCD_0093], }, - }, + }, { + .name = "Afatech Technologies DVB-T stick", + .cold_ids = { + &af9035_id[AF9035_15A4_1001], + &af9035_id[AF9035_15A4_9035], + }, + } } }, };
drivers/media/dvb/dvb-usb/af9035.c +90 -0
129 lines not on this page · raw message
drivers/media/dvb/frontends/af9033.c +4 -0
@@ -297,6 +297,10 @@ len =ARRAY_SIZE (tuner_init_tua9001); init = tuner_init_tua9001;break ; +case AF9033_TUNER_FC0011 : + len =ARRAY_SIZE (tuner_init_fc0011); + init = tuner_init_fc0011; +break ;default :pr_debug ("%s: unsupported tuner ID=%d\n" , __func__, state->cfg.tuner);
drivers/media/dvb/frontends/af9033_priv.h +61 -0
66 lines not on this page · raw message
PULL-request update.
Quoted 9 lines · Antti Palosaari
Terve Mauro and all the other hackers,
I did some massive rewrite for my old AF9035/AF9033 driver that was never merged. Anyhow, here it is.
New drivers here are:
Infineon TUA 9001 silicon tuner driver
Afatech AF9033 DVB-T demodulator driver
Afatech AF9035 DVB USB driver
Fitipower FC0011 silicon tuner driver
Quoted 4 lines
AF9035 integrates AF9033. Both chips are also sold separately. AF9033 will not likely work as a stand-alone since I didn't have hardware to test, but in theory it is quite well split out from the DVB USB interface driver (AF9035).
The following changes since commit 26315a507f6acda933f0d41200de8fec51775867:
em28xx-dvb: stop URBs when stopping the streaming (2012-03-28
15:32:23 +0300)
are available in the git repository at:
git://linuxtv.org/anttip/media_tree.git af9035
Antti Palosaari (15):
Infineon TUA 9001 silicon tuner driver
Afatech AF9033 DVB-T demodulator driver
Afatech AF9035 DVB USB driver
af9035: enhancement for unknown tuner ID handling
af9035: reimplement firmware downloader
af9035: add missing error check
af9033: correct debug print
af9033: implement .read_snr()
af9035: add log writing if unsupported Xtal freq is given
af9035: fix and enhance I2C adapter
af9035: initial support for IT9135 chip
af9033: do some minor changes for .get_frontend()
af9035: minor changes for af9035_fc0011_tuner_callback()
af9035: reorganise USB ID and device list
af9035: disable frontend0 I2C-gate control
Gianluca Gennari (5):
af9035: add USB id for 07ca:a867
af9035: add support for the tda18218 tuner
af9035: use module_usb_driver macro
af9035: fix warning
af9033: implement get_frontend
Hans-Frieder Vogt (2):
af9035: i2c read fix
af9035: add Avermedia Volar HD (A867R) support
Michael Buesch (7):
af9035: Add USB read checksumming
Add fc0011 tuner driver
af9035: Add fc0011 tuner support
af9035: Add Afatech USB PIDs
fc0011: use usleep_range()
af9035: Use usleep_range() in fc0011 support code
fc0011: Reduce number of retries
Pierangelo Terzulli (1):
af9035: add AVerMedia Twinstar (A825) [07ca:0825]
MAINTAINERS | 7 + drivers/media/common/tuners/Kconfig | 13 + drivers/media/common/tuners/Makefile | 2 + drivers/media/common/tuners/fc0011.c | 524 +++++++++++++ drivers/media/common/tuners/fc0011.h | 41 + drivers/media/common/tuners/tua9001.c | 215 +++++ drivers/media/common/tuners/tua9001.h | 46 ++ drivers/media/common/tuners/tua9001_priv.h | 34 + drivers/media/dvb/dvb-usb/Kconfig | 12 + drivers/media/dvb/dvb-usb/Makefile | 3 + drivers/media/dvb/dvb-usb/af9035.c | 1164 ++++++++++++++++++++++++++++ drivers/media/dvb/dvb-usb/af9035.h | 120 +++ drivers/media/dvb/dvb-usb/dvb-usb-ids.h | 8 + drivers/media/dvb/frontends/Kconfig | 5 + drivers/media/dvb/frontends/Makefile | 1 + drivers/media/dvb/frontends/af9033.c | 919 ++++++++++++++++++++++ drivers/media/dvb/frontends/af9033.h | 75 ++ drivers/media/dvb/frontends/af9033_priv.h | 470 +++++++++++ 18 files changed, 3659 insertions(+), 0 deletions(-) create mode 100644 drivers/media/common/tuners/fc0011.c create mode 100644 drivers/media/common/tuners/fc0011.h create mode 100644 drivers/media/common/tuners/tua9001.c create mode 100644 drivers/media/common/tuners/tua9001.h create mode 100644 drivers/media/common/tuners/tua9001_priv.h create mode 100644 drivers/media/dvb/dvb-usb/af9035.c create mode 100644 drivers/media/dvb/dvb-usb/af9035.h create mode 100644 drivers/media/dvb/frontends/af9033.c create mode 100644 drivers/media/dvb/frontends/af9033.h create mode 100644 drivers/media/dvb/frontends/af9033_priv.h
Signature · 1 line
http://palosaari.fi/
[GIT PULL FOR 3.5] AF9035/AF9033
In reply to Antti PalosaariMoikka Mauro,
Some AF9035/AF9033 changes for the 3.5!
Do you have idea about last date for the 3.5 PULL requests?
regards
Antti
The following changes since commit cd58ef79264198a905367d19b1a110c2f6ac1156:
af9035: disable frontend0 I2C-gate control (2012-04-06 13:09:23 +0300)
are available in the git repository at:
git://linuxtv.org/anttip/media_tree.git af9035
Antti Palosaari (5):
af9035: various small changes for af9035_ctrl_msg()
af9035: remove unused struct
af9035: move device configuration to the state
af9035: remove one config parameter
af9035: add few new reference design USB IDs
Hans-Frieder Vogt (2):
af9035: add remote control support
af9033: implement ber and ucb functions
drivers/media/dvb/dvb-usb/af9035.c | 174 ++++++++++++++++++++++--------- drivers/media/dvb/dvb-usb/af9035.h | 23 ++--- drivers/media/dvb/dvb-usb/dvb-usb-ids.h | 7 +- drivers/media/dvb/frontends/af9033.c | 65 +++++++++++- 4 files changed, 202 insertions(+), 67 deletions(-)
Signature · 1 line
http://palosaari.fi/