tbsdtv / linux_media

TBS linux open source drivers
https://github.com/tbsdtv/linux_media/wiki
Other
169 stars 79 forks source link

[TBS6205] Problems downloading the firmware for the first time. #259

Closed MastaG closed 2 years ago

MastaG commented 2 years ago

Hi there,

I'm running Fedora 34 with the latest drivers. The card works, but it will give the following when TVHheadend starts:

[   26.435137] si2157 17-0060: firmware version: 2.1.9
[   26.447810] TBSECP3 driver 0000:04:00.0: DVB: adapter 3 frontend 0 frequency 0 out of range (48000000..870000000)
[   26.462774] si2168 9-0064: downloading firmware from file 'dvb-demod-si2168-b40-01.fw'
[   26.467906] si2157 17-0060: found a 'Silicon Labs Si2158-A20'
[   26.467950] si2157 17-0060: downloading firmware from file 'dvb-tuner-si2158-a20-01.fw'
[   27.485549] si2157 17-0060: firmware download failed -11
[   28.321734] si2168 9-0064: firmware version: B 4.0.25
[   28.340567] si2157 13-0060: found a 'Silicon Labs Si2158-A20'
[   28.340779] si2157 13-0060: downloading firmware from file 'dvb-tuner-si2158-a20-01.fw'
[   29.572639] si2157 13-0060: firmware version: 2.1.9
[   29.583216] TBSECP3 driver 0000:04:00.0: DVB: adapter 2 frontend 0 frequency 0 out of range (48000000..870000000)
[   29.588696] si2168 8-0064: downloading firmware from file 'dvb-demod-si2168-b40-01.fw'
[   29.600866] si2157 13-0060: found a 'Silicon Labs Si2158-A20'
[   29.600899] si2157 13-0060: downloading firmware from file 'dvb-tuner-si2158-a20-01.fw'
[   30.612368] si2157 13-0060: firmware download failed -11
[   31.416654] si2168 8-0064: firmware version: B 4.0.25
[   31.436056] si2157 12-0060: found a 'Silicon Labs Si2158-A20'
[   31.436084] si2157 12-0060: downloading firmware from file 'dvb-tuner-si2158-a20-01.fw'
[   32.688189] si2157 12-0060: firmware version: 2.1.9
[   32.698764] TBSECP3 driver 0000:04:00.0: DVB: adapter 1 frontend 0 frequency 0 out of range (48000000..870000000)
[   32.704707] si2168 7-0064: downloading firmware from file 'dvb-demod-si2168-b40-01.fw'
[   32.712831] si2157 12-0060: found a 'Silicon Labs Si2158-A20'
[   32.712867] si2157 12-0060: downloading firmware from file 'dvb-tuner-si2158-a20-01.fw'
[   33.717637] si2157 12-0060: firmware download failed -11
[   34.528262] si2168 7-0064: firmware version: B 4.0.25
[   34.547076] si2157 11-0060: found a 'Silicon Labs Si2158-A20'
[   34.547117] si2157 11-0060: downloading firmware from file 'dvb-tuner-si2158-a20-01.fw'
[   35.768751] si2157 11-0060: firmware version: 2.1.9
[   35.779296] TBSECP3 driver 0000:04:00.0: DVB: adapter 0 frontend 0 frequency 0 out of range (48000000..870000000)
[   35.793569] si2157 11-0060: found a 'Silicon Labs Si2158-A20'
[   35.793618] si2157 11-0060: downloading firmware from file 'dvb-tuner-si2158-a20-01.fw'
[   36.837778] si2157 11-0060: firmware download failed -11

I have to go into TV Adapters tab, deactivate and reactivate iets tuner, one by one, before they can successfully load the firmware and initialize. This is bit nasty because I have to do this after every reboot.

Could this be fixed?

OldAVman commented 2 years ago

Hi, I've recently updated the kernel and this driver in my htpc box. I use this driver as I have a TBS satellite card. I also have a Mygica T230 USB tuner for terrestrial TV. This uses the same Si2158 tuner chip as the OP's card and I'm suddenly seeing a similar problem. Typically, following power up the tuner will always load the firmware and correctly tune to the selected channel. If another channel is then selected it will nearly always fail to load the firmware and the 'firmware download failed -11' message will appear in dmesg. Selecting a channel again will then usually work. This fail, work, fail, work sequence then continues making channel selection very hit and miss. If the power is removed and then reinstated the tuner will always work first time. I'm now on kernel 5.14.14 and hadn't updated for some time but the tuner used to work reliably. I can't see anything in the driver that appears to have changed relevant to this particular chip and the firmware doesn't seem to have changed recently so I'm confused as to what's happened. I haven't made any hardware changes to my system. As the OP's card is PCIE and my tuner is USB the firmware loading code must be different so it seems strange we're both seeing a similar symptom. Anybody else seeing this and have any clues?

MastaG commented 2 years ago

Same for me. I also have a few USB dvb sticks using the same tuner chip.

Bus 001 Device 004: ID 0b48:3014 TechnoTrend AG TT-TVStick CT2-4400
Bus 001 Device 003: ID 2040:1605 Hauppauge WinTV-HVR 930C HD
Bus 001 Device 005: ID 2040:1605 Hauppauge WinTV-HVR 930C HD
Bus 001 Device 002: ID 045e:02d5 Microsoft Corp. Xbox One Digital TV Tuner

Here you can see the bootlog, without the TBS drivers being installed:

[    0.814955] usb 1-1: new high-speed USB device number 2 using xhci_hcd
[    0.942602] usb 1-1: New USB device found, idVendor=045e, idProduct=02d5, bcdDevice= 1.10
[    0.942605] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[    0.942606] usb 1-1: Product: Xbox USB Tuner
[    0.942607] usb 1-1: Manufacturer: Microsoft Corp.
[    0.942608] usb 1-1: SerialNumber: 001658260115
[    1.057951] usb 1-4: new high-speed USB device number 3 using xhci_hcd
[    1.185915] usb 1-4: config 1 interface 0 altsetting 1 endpoint 0x82 has invalid wMaxPacketSize 0
[    1.186104] usb 1-4: New USB device found, idVendor=2040, idProduct=1605, bcdDevice= 1.00
[    1.186107] usb 1-4: New USB device strings: Mfr=0, Product=1, SerialNumber=2
[    1.186108] usb 1-4: Product: WinTV HVR-930C
[    1.186110] usb 1-4: SerialNumber: 4035387400
[    1.300957] usb 1-8: new high-speed USB device number 4 using xhci_hcd
[    1.426988] usb 1-8: New USB device found, idVendor=0b48, idProduct=3014, bcdDevice= 0.00
[    1.427000] usb 1-8: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[    1.427005] usb 1-8: Product: TechnoTrend USB-Stick
[    1.427009] usb 1-8: Manufacturer: CityCom GmbH
[    1.427013] usb 1-8: SerialNumber: 20131128
[    3.657134] em28xx 1-4:1.0: New device  WinTV HVR-930C @ 480 Mbps (2040:1605, interface 0, class 0)
[    3.657140] em28xx 1-4:1.0: Audio interface 0 found (Vendor Class)
[    3.657142] em28xx 1-4:1.0: Video interface 0 found: isoc
[    3.657143] em28xx 1-4:1.0: DVB interface 0 found: isoc
[    3.677427] dvb-usb: found a 'Microsoft Xbox One Digital TV Tuner' in cold state, will try to load a firmware
[    3.682532] dvb-usb: downloading firmware from file 'dvb-usb-dib0700-1.20.fw'
[    3.719961] em28xx 1-4:1.0: chip ID is em2884
[    3.760857] dib0700: firmware started successfully.
[    3.780692] em28xx 1-4:1.0: EEPROM ID = 26 00 01 00, EEPROM hash = 0x91f00caa
[    3.780697] em28xx 1-4:1.0: EEPROM info:
[    3.780698] em28xx 1-4:1.0:  microcode start address = 0x0004, boot configuration = 0x01
[    3.787108] em28xx 1-4:1.0:  I2S audio, 5 sample rates
[    3.787110] em28xx 1-4:1.0:  500mA max power
[    3.787110] em28xx 1-4:1.0:  Table at offset 0x24, strings=0x1e82, 0x186a, 0x0000
[    3.791918] usb 1-8: dvb_usb_v2: found a 'TechnoTrend TVStick CT2-4400' in warm state
[    3.791940] usb 1-8: dvb_usb_v2: will pass the complete MPEG2 transport stream to the software demuxer
[    3.791945] dvbdev: DVB: registering new adapter (TechnoTrend TVStick CT2-4400)
[    3.791947] usb 1-8: media controller created
[    3.793138] usb 1-8: dvb_usb_v2: MAC address: bc:ea:2b:44:08:fb
[    3.793231] dvbdev: dvb_create_media_entity: media entity 'dvb-demux' registered.
[    3.801909] si2168 9-0064: Silicon Labs Si2168-B40 successfully identified
[    3.801917] si2168 9-0064: firmware version: B 4.0.2
[    3.818783] si2157 10-0060: Silicon Labs Si2147/2148/2157/2158 successfully attached
[    3.818796] usb 1-8: DVB: registering adapter 0 frontend 0 (Silicon Labs Si2168)...
[    3.818800] dvbdev: dvb_create_media_entity: media entity 'Silicon Labs Si2168' registered.
[    3.839028] em28xx 1-4:1.0: Identified as Hauppauge WinTV HVR 930C (card=81)
[    3.840007] tveeprom: Hauppauge model 16009, rev B1F0, serial# 4035387400
[    3.840010] tveeprom: MAC address is 00:0d:fe:87:20:08
[    3.840012] tveeprom: tuner model is Xceive XC5000 (idx 150, type 76)
[    3.840014] tveeprom: TV standards PAL(B/G) PAL(I) SECAM(L/L') PAL(D/D1/K) ATSC/DVB Digital (eeprom 0xf4)
[    3.840016] tveeprom: audio processor is AVF4910B (idx 45)
[    3.840017] tveeprom: decoder processor is AVF4910B (idx 44)
[    3.840018] tveeprom: has no radio, has IR receiver, has no IR transmitter
[    3.840021] em28xx 1-4:1.0: Currently, V4L2 is not supported on this model
[    3.840023] em28xx 1-4:1.0: dvb set to isoc mode.
[    3.840136] usbcore: registered new interface driver em28xx
[    3.843986] Registered IR keymap rc-tt-1500
[    3.844009] rc rc0: TechnoTrend TVStick CT2-4400 as /devices/pci0000:00/0000:00:14.0/usb1/1-8/rc/rc0
[    3.844158] rc rc0: lirc_dev: driver dvb_usb_dvbsky registered at minor = 0, scancode receiver, no transmitter
[    3.844192] input: TechnoTrend TVStick CT2-4400 as /devices/pci0000:00/0000:00:14.0/usb1/1-8/rc/rc0/input20
[    3.844287] usb 1-8: dvb_usb_v2: schedule remote query interval to 300 msecs
[    3.844290] usb 1-8: dvb_usb_v2: 'TechnoTrend TVStick CT2-4400' successfully initialized and connected
[    3.844309] usbcore: registered new interface driver dvb_usb_dvbsky
[    3.849416] em28xx 1-4:1.0: Binding audio extension
[    3.849418] em28xx 1-4:1.0: em28xx-audio.c: Copyright (C) 2006 Markus Rechberger
[    3.849420] em28xx 1-4:1.0: em28xx-audio.c: Copyright (C) 2007-2016 Mauro Carvalho Chehab
[    3.849431] em28xx 1-4:1.0: Endpoint 0x83 high-speed on intf 0 alt 7 interval = 8, size 196
[    3.849434] em28xx 1-4:1.0: Number of URBs: 1, with 64 packets and 192 size
[    3.849571] em28xx 1-4:1.0: Audio extension successfully initialized
[    3.849572] em28xx: Registered (Em28xx Audio Extension) extension
[    3.854754] em28xx 1-4:1.0: Binding DVB extension
[    4.269178] dvb-usb: found a 'Microsoft Xbox One Digital TV Tuner' in warm state.
[    4.269296] dvb-usb: will pass the complete MPEG2 transport stream to the software demuxer.
[    4.269897] dvbdev: DVB: registering new adapter (Microsoft Xbox One Digital TV Tuner)
[    4.269931] usb 1-1: media controller created
[    4.270322] dvbdev: dvb_create_media_entity: media entity 'dvb-demux' registered.
[    4.441131] mn88472 11-0018: Panasonic MN88472 successfully identified
[    4.444323] tda18250 11-0060: NXP TDA18250BHN/M successfully identified
[    4.446136] usb 1-1: DVB: registering adapter 1 frontend 0 (Panasonic MN88472)...
[    4.446140] dvbdev: dvb_create_media_entity: media entity 'Panasonic MN88472' registered.
[    4.446463] dvb-usb: Microsoft Xbox One Digital TV Tuner successfully initialized and connected.
[    4.446587] usbcore: registered new interface driver dvb_usb_dib0700
[    4.892924] usb 1-3: new high-speed USB device number 5 using xhci_hcd
[    5.020951] usb 1-3: config 1 interface 0 altsetting 1 endpoint 0x82 has invalid wMaxPacketSize 0
[    5.021207] usb 1-3: New USB device found, idVendor=2040, idProduct=1605, bcdDevice= 1.00
[    5.021210] usb 1-3: New USB device strings: Mfr=0, Product=1, SerialNumber=2
[    5.021212] usb 1-3: Product: WinTV HVR-930C
[    5.021213] usb 1-3: SerialNumber: 4035392925
[    5.023014] em28xx 1-3:1.0: New device  WinTV HVR-930C @ 480 Mbps (2040:1605, interface 0, class 0)
[    5.023018] em28xx 1-3:1.0: Audio interface 0 found (Vendor Class)
[    5.023020] em28xx 1-3:1.0: Video interface 0 found: isoc
[    5.023021] em28xx 1-3:1.0: DVB interface 0 found: isoc
[    5.062779] drxk: status = 0x439130d9
[    5.062781] drxk: detected a drx-3913k, spin A2, xtal 20.250 MHz
[    5.074953] em28xx 1-3:1.0: chip ID is em2884
[    5.132891] em28xx 1-3:1.0: EEPROM ID = 26 00 01 00, EEPROM hash = 0xbef005aa
[    5.132894] em28xx 1-3:1.0: EEPROM info:
[    5.132895] em28xx 1-3:1.0:  microcode start address = 0x0004, boot configuration = 0x01
[    5.138971] em28xx 1-3:1.0:  I2S audio, 5 sample rates
[    5.138973] em28xx 1-3:1.0:  500mA max power
[    5.138974] em28xx 1-3:1.0:  Table at offset 0x24, strings=0x1e82, 0x186a, 0x0000
[    5.190915] em28xx 1-3:1.0: Identified as Hauppauge WinTV HVR 930C (card=81)
[    5.191956] tveeprom: Hauppauge model 16009, rev B1F0, serial# 4035392925
[    5.191958] tveeprom: MAC address is 00:0d:fe:87:35:9d
[    5.191959] tveeprom: tuner model is Xceive XC5000 (idx 150, type 76)
[    5.191960] tveeprom: TV standards PAL(B/G) PAL(I) SECAM(L/L') PAL(D/D1/K) ATSC/DVB Digital (eeprom 0xf4)
[    5.191961] tveeprom: audio processor is AVF4910B (idx 45)
[    5.191962] tveeprom: decoder processor is AVF4910B (idx 44)
[    5.191962] tveeprom: has no radio, has IR receiver, has no IR transmitter
[    5.191964] em28xx 1-3:1.0: Currently, V4L2 is not supported on this model
[    5.191965] em28xx 1-3:1.0: dvb set to isoc mode.
[    6.260679] drxk: DRXK driver version 0.9.4300
[    6.273420] drxk: frontend initialized.
[    6.277870] xc5000 8-0061: creating new instance
[    6.278288] xc5000: Successfully identified at address 0x61
[    6.278289] xc5000: Firmware has not been loaded previously
[    6.278291] dvbdev: DVB: registering new adapter (1-4:1.0)
[    6.278292] em28xx 1-4:1.0: DVB: registering adapter 2 frontend 0 (DRXK DVB-C DVB-T)...
[    6.278296] dvbdev: dvb_create_media_entity: media entity 'DRXK DVB-C DVB-T' registered.
[    6.278539] dvbdev: dvb_create_media_entity: media entity 'dvb-demux' registered.
[    6.279908] em28xx 1-4:1.0: DVB extension successfully initialized
[    6.279912] em28xx: Registered (Em28xx dvb Extension) extension
[    6.280203] em28xx 1-3:1.0: Binding audio extension
[    6.280206] em28xx 1-3:1.0: em28xx-audio.c: Copyright (C) 2006 Markus Rechberger
[    6.280207] em28xx 1-3:1.0: em28xx-audio.c: Copyright (C) 2007-2016 Mauro Carvalho Chehab
[    6.280221] em28xx 1-3:1.0: Endpoint 0x83 high-speed on intf 0 alt 7 interval = 8, size 196
[    6.280224] em28xx 1-3:1.0: Number of URBs: 1, with 64 packets and 192 size
[    6.280374] em28xx 1-3:1.0: Audio extension successfully initialized
[    6.280376] em28xx 1-3:1.0: Binding DVB extension
[    7.469301] drxk: status = 0x439130d9
[    7.469309] drxk: detected a drx-3913k, spin A2, xtal 20.250 MHz
[    8.687554] drxk: DRXK driver version 0.9.4300
[    8.697553] drxk: frontend initialized.
[    8.697563] xc5000 13-0061: creating new instance
[    8.698079] xc5000: Successfully identified at address 0x61
[    8.698082] xc5000: Firmware has not been loaded previously
[    8.698085] dvbdev: DVB: registering new adapter (1-3:1.0)
[    8.698089] em28xx 1-3:1.0: DVB: registering adapter 3 frontend 0 (DRXK DVB-C DVB-T)...
[    8.698099] dvbdev: dvb_create_media_entity: media entity 'DRXK DVB-C DVB-T' registered.
[    8.698488] dvbdev: dvb_create_media_entity: media entity 'dvb-demux' registered.
[    8.700180] em28xx 1-3:1.0: DVB extension successfully initialized
[    8.700193] em28xx 1-4:1.0: Registering input extension
[    8.726854] Registered IR keymap rc-hauppauge
[    8.727102] rc rc1: Hauppauge WinTV HVR 930C as /devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4:1.0/rc/rc1
[    8.727226] rc rc1: lirc_dev: driver em28xx registered at minor = 1, scancode receiver, no transmitter
[    8.727259] input: Hauppauge WinTV HVR 930C as /devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4:1.0/rc/rc1/input21
[    8.727356] em28xx 1-4:1.0: Input extension successfully initialized
[    8.727359] em28xx 1-3:1.0: Registering input extension
[    8.727493] Registered IR keymap rc-hauppauge
[    8.727629] rc rc2: Hauppauge WinTV HVR 930C as /devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.0/rc/rc2
[    8.727683] rc rc2: lirc_dev: driver em28xx registered at minor = 2, scancode receiver, no transmitter
[    8.727708] input: Hauppauge WinTV HVR 930C as /devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.0/rc/rc2/input22
[    8.727744] em28xx 1-3:1.0: Input extension successfully initialized
[    8.727745] em28xx: Registered (Em28xx Input Extension) extension
[   33.995979] xc5000: Firmware dvb-fe-xc5000-1.6.114.fw loaded and running.
[   33.996024] em28xx 1-3:1.0: DVB: adapter 3 frontend 0 frequency 0 out of range (47000000..865000000)
[   34.524954] xc5000: Firmware dvb-fe-xc5000-1.6.114.fw loaded and running.
[   34.524969] em28xx 1-4:1.0: DVB: adapter 2 frontend 0 frequency 0 out of range (47000000..865000000)
[   34.529766] mn88472 11-0018: downloading firmware from file 'dvb-demod-mn88472-02.fw'
[   34.684938] usb 1-1: DVB: adapter 1 frontend 0 frequency 0 out of range (42000000..870000000)
[   34.693307] si2168 9-0064: downloading firmware from file 'dvb-demod-si2168-b40-01.fw'
[   36.294654] si2168 9-0064: firmware version: B 4.0.25
[   36.307321] si2157 10-0060: found a 'Silicon Labs Si2157-A30'
[   36.360129] si2157 10-0060: firmware version: 3.0.5
[   36.369588] usb 1-8: DVB: adapter 0 frontend 0 frequency 0 out of range (48000000..870000000)
[   36.379664] si2168 9-0064: downloading firmware from file 'dvb-demod-si2168-b40-01.fw'
[   38.025850] si2168 9-0064: firmware version: B 4.0.25
[   38.039949] si2157 10-0060: found a 'Silicon Labs Si2157-A30'
[   38.066866] si2157 10-0060: firmware version: 3.0.5

However with the TBS drivers, the card seems have trouble loading it's firmware for the first time. Perhaps a hack can be added to TV-headend to set some random delay between 1 and 4 seconds before initializing each tuner.

OldAVman commented 2 years ago

Hi, I don't use TVHheadend myself, I use my own tuner software (based on V4L code) and your problem sounds a little different. For me the firmware download always works first time but fails on alternate channel selections. I've always found the firmware download a bit unreliable for the si2157. After looking through the relevant code I seem to have found a solution which works for me at least. I've never really understood why the firmware has to be repeatedly loaded into the chip, I'm assuming it's stored in non volatile memory and once programmed in should remain intact through power cycles etc. Looking in /media_build/linux/drivers/media/tuners/si2157.h I noticed the struct si2157_config has a member 'dont_load_firmware' which is indeed set to true in a couple of the drivers that use this chip. My dvb stick is handled by the dvbsky driver in /media/drivers/media/usb/dvb-usb-v2/ so I inserted a line 'si2157_config.dont_load_firmware = true' in the dvbsky.c file at line 560 where another member of the struct is initialised. After re-compiling this seems to have worked. The driver no longer attempts to reload the firmware each time the tuner is used and the channels all now select reliably every time. This (highly unofficial) solution of course depends on the firmware having been correctly loaded into the stick at some point in its life, but as far as I can see this should only need to be done once. (if this is incorrect someone please enlighten me!) This bodge has worked for me on three sticks for over a week now through multiple plugs/unplugs. If you find the relevant .c file for your tuner you may be able to try something similar.

crazycat69 commented 2 years ago

Silabs tuner/demods have some on-chip MCU ROM with initial firmware, copied to MCU RAM on reset and possible load firmware patch on init.

OldAVman commented 2 years ago

Crazycat, Thanks for the information. The only datasheet I could find for the si2157 was a short form version which contained no useful operational details at all. I guess a proper datasheet is only available to manufacturers.

crazycat69 commented 2 years ago

Official driver sources for Silabs tuner/demods https://github.com/SiliconLabs/video_si21xx_superset/tree/master/SILABS_SUPERSET

OldAVman commented 2 years ago

Crazycat, Thanks again, very useful, will read.

crazycat69 commented 2 years ago

Fixed 118caba2ee903a0664d4133ceee0ea4229f5cfc4