ljalves / linux_media

TBS linux open source drivers
https://github.com/ljalves/linux_media/wiki
Other
88 stars 153 forks source link

Kernel NULL pointer deref with TBS 6285 #61

Closed ghost closed 9 years ago

ghost commented 9 years ago

Hi,

I'm having problems getting the module working with a TBS 6285 card.

I've built the source successfully and am currently using the firmware from https://github.com/bas-t/media_tree/tree/personal/firmware_extra in my /lib/firmware directory.

When I try to tune in TVHeadend I get:

Dec 31 20:34:27 main tvheadend[4665]: dvb: Adapter "Silicon Labs Si2168" Enabled
Dec 31 20:34:27 main tvheadend[4665]: dvb: Adapter /dev/dvb/adapter0 will run in full mux mode
Dec 31 20:34:28 main kernel: [  783.388828] si2157 3-0062: found a 'Silicon Labs Si2146/2147/2148/2157/2158' in cold state
Dec 31 20:34:28 main kernel: [  783.834723] si2157 3-0062: downloading firmware from file 'dvb-tuner-si2158-a20-01.fw'
Dec 31 20:34:49 main kernel: [  804.682376] BUG: unable to handle kernel NULL pointer dereference at           (null)
Dec 31 20:34:49 main kernel: [  804.682403] IP: [<          (null)>]           (null)

at which point TVHeadend hangs.

I'm using 3.16.5-gentoo kernel and have disabled multimedia support.

$ cat /sys/module/saa716x_budget/parameters/int_type
1

I've also tried powering down the system and leaving it for a while to ensure the firmware can be uploaded.

What am I doing wrong?

JohnFlowerful commented 9 years ago

Make sure you have the correct firmware from the github page you linked. To quote bas-t:

For a TBS 6285, you need dvb-tuner-si2158-a20-01.fw and dvb-demod-si2168-b40-01.fw

ghost commented 9 years ago

Thanks for your quick reply.

I basically just downloaded all of the firmware from that github page and placed it in /lib/firmware. Those firmware images are in the newer format so I'm wondering if that could be causing issues?

JohnFlowerful commented 9 years ago

I'm running the firmware with my TBS 6285. Granted I have only tested DVB-T mode.

My current kernel is 3.17.7-gentoo. Relevant snippet of my dmesg: http://sprunge.us/cHLi And my /lib/firmware dir: http://sprunge.us/jbOa

ghost commented 9 years ago

If I just copy over those two firmware files I see this:

Dec 31 22:27:01 tuxfs kernel: [ 5908.196832] si2168 2-0064: found a 'Silicon Labs Si2168' in cold state
Dec 31 22:27:01 tuxfs kernel: [ 5908.196843] si2168 2-0064: Direct firmware load failed with error -2
Dec 31 22:27:01 tuxfs kernel: [ 5908.196844] si2168 2-0064: Falling back to user helper
Dec 31 22:27:01 tuxfs kernel: [ 5908.197209] si2168 2-0064: firmware file 'dvb-demod-si2168-a20-01.fw' not found
Dec 31 22:27:01 tuxfs kernel: [ 5908.199190] si2157 4-0062: found a 'Silicon Labs Si2146/2147/2148/2157/2158' in cold state
Dec 31 22:27:01 tuxfs kernel: [ 5908.199202] si2157 4-0062: downloading firmware from file 'dvb-tuner-si2158-a20-01.fw'

In this state, I can actually tune the card and don't get a NULL pointer deref - getting a bit closer! However, in TVHeadend I don't actually get any channels.

Has the driver changed so that we need a third file: 'dvb-demod-si2168-a20-01.fw' in addition to: dvb-tuner-si2158-a20-01.fw and dvb-demod-si2168-b40-01.fw?

trsqr commented 9 years ago

Just to clear it up. There are 3 different versions of Si2168 chip: A20, A30 and B40. For A20 and A30 there is only one firmware for each. For B40 there exists firmwares in old format (loaded in 8 bytes per command) and in new format (variable length, 1-16 bytes at a time). Which chip is present on your card? I'd guess it's A20, no?

For Si2158 tuner there is one firmware and that's it.

ghost commented 9 years ago

@trsqr

Ah, thanks - I'd missed that.

How can I tell with chip is present? lscpi -vvv yields nothing of interest it would seem...

trsqr commented 9 years ago

Well, sure way is to take a magnifying glass and read what it says on top of the chip. :)

But really, the Si2168 linux driver autodetects the chip version and tries to load the correct firmware. The message that says firmware dvb-demod-si2168-a20-01.fw is not found would indicate that there is Si2168-A20 on your card and you need that firmware.

ghost commented 9 years ago

Heh, easier said than done when the card in inserted vertically into a 4U rack case :)

I'll try copying only the firmware that is needed over to /lib/firmware and see how far I get.

ghost commented 9 years ago

Making more progress, well it doesn't horribly die now.

But I'm seeing different behaviour.

/lib/firmware:
-rw-r--r-- 1 root root   5015 Dec 31 22:25 dvb-tuner-si2158-a20-01.fw
-rw-r--r-- 1 root root  28656 Dec 31 22:38 dvb-demod-si2168-a20-01.fw

When enabling a tuner in TVHeadend I get:

Dec 31 22:57:49 main tvheadend[4315]: dvb: Adapter "Silicon Labs Si2168" Enabled
Dec 31 22:57:49 main tvheadend[4315]: dvb: Adapter /dev/dvb/adapter1 will run in full mux mode
Dec 31 22:57:50 main kernel: [  376.489314] si2157 4-0060: found a 'Silicon Labs Si2146/2147/2148/2157/2158' in cold state
Dec 31 22:57:50 main kernel: [  376.489330] si2157 4-0060: downloading firmware from file 'dvb-tuner-si2158-a20-01.fw'

and I see it tuning but no channels are found. I'm certain the RF side of things is ok as I've just removed the "official" TBS drivers which previously found channels but were very unstable.

Just to double check, I need both of those firmware files in /lib/firmware yes?

Do I need a more recent version of TVHeadend (I'm currently on 3.4.27) but could quickly knock up an ebuild to pull a later commit from git... I seem to be in the ebuild writing mood today as I've created one for these drivers as well! :)

I also wanted to ask, am I still required to build the source from scratch or is this card now supported in later versions of the Kernel? If so I'll just upgrade.

JohnFlowerful commented 9 years ago

You should have removed the old drivers before installing the new ones >_>

Anyway, it says 'cold state', which from my experience means it isn't working. Why does a TBS 6285 require dvb-demod-si2168-a20-01.fw? Have they changed the components recently? Oh, and there's already a 9999 ebuild in Portage.

ghost commented 9 years ago

@JohnFlowerful

"You should have removed the old drivers before installing the new ones >_>"

I did of course. I made very sure that the ebuild I created for the official drivers installs into /lib/modules//dvb. This directory was removed before I attempted creating the ebuild for these drivers which install into a different directory as well.

ljalves commented 9 years ago

@epon, closing this issue. Feel free to reopen if needed.