Skip to contentSkip to conversation

cx88-dvb: Fix Oops in case no i2c bus is available

PATCH In review Matthias Schwarzott 1 participant 3 messages Jun 19, 2008 – Jun 24, 2008 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cx88-dvb: Fix Oops in case no i2c bus is available

Hi there!

The attached patch will fix an Oops occurring in cx88-dvb when cx88 core does not have a valid i2c-bus registered.

The reason for me is different and will be handled (and solved I hope) in another thread, but the Oops should not be here and so this is fixed first.

Regards
Matthias

cx88-dvb: Fix Oops in case no i2c bus is available

For me loading i2c_algo_bit with bit_test=1 detects "SDA stuck high" and aborts registering the cx88 i2c-bus. cx88-dvb however does not check the registration success and just uses core->i2c_adap to attach dvb frontend modules leading to an oops in the first i2c_transfer call. Added a check for i2c registration success before attaching a frontend and dvb_register will return -EINVAL in error case.

linux/drivers/media/video/cx88/cx88-dvb.c +5 -0
Index: v4l-dvb/linux/drivers/media/video/cx88/cx88-dvb.c
===================================================================
@@ -533,6 +533,11 @@ static int dvb_register(struct cx8802_de
 	dev->dvb.name = core->name;
 	dev->ts_gen_cntrl = 0x0c;
 
+	if (0 != core->i2c_rc) {
+		printk(KERN_ERR "%s/2: no i2c-bus available, cannot attach dvb drivers\n", core->name);
+		goto frontend_detach;
+	}
+
 	/* init frontend */
 	switch (core->boardnr) {
 	case CX88_BOARD_HAUPPAUGE_DVB_T1:

--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

#1 lore raw
Quoted 8 lines · Matthias Schwarzott

Hi there!

The attached patch will fix an Oops occurring in cx88-dvb when cx88 core does not have a valid i2c-bus registered.

The reason for me is different and will be handled (and solved I hope) in another thread, but the Oops should not be here and so this is fixed first.

The same bug seems to be reported earlier on kernel bugzilla:
http://bugzilla.kernel.org/show_bug.cgi?id=9455

Citing Mauro from the bug:
# 3) some problem at cx88-dvb register routine didn't interpret the error. I

# think this bug were solved, at the tree, for a patch later than
# changeset 7537.

Sadly cx88-dvb still oops with current v4l-dvb hg tree.

Regards
Matthias

--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

#2 lore raw

So trying some stuff:
Having in /etc/modprobe.d/dvb:
options i2c-algo-bit bit_test=1

Now rebooting and running

# modprobe cx88-dvb
cx88/2: cx2388x MPEG-TS Driver Manager version 0.0.6 loaded
cx88[0]: quirk: PCIPCI_NATOMA -- set TBFX
cx88[0]: subsystem: 0070:9202, board: Hauppauge Nova-S-Plus DVB-S 
[card=37,autodetected]
cx88[0]: TV tuner type 4, Radio tuner type -1
cx88[0]: SDA stuck high!
cx88[0]: i2c register FAILED
input: cx88 IR (Hauppauge Nova-S-Plus  as /class/input/input5
cx88[0]/2: cx2388x 8802 Driver Manager
PCI: Enabling device 0000:00:10.2 (0154 -> 0156)
ACPI: PCI Interrupt 0000:00:10.2[A] -> Link [LNKD] -> GSI 9 (level, low) -> 
IRQ 9
cx88[0]/2: found at 0000:00:10.2, rev: 5, irq: 9, latency: 64, mmio: 
0xfb000000
cx88/2: cx2388x dvb driver version 0.0.6 loaded
cx88/2: registering cx8802 driver, type: dvb access: shared
cx88[0]/2: subsystem: 0070:9202, board: Hauppauge Nova-S-Plus DVB-S [card=37]
cx88[0]/2: cx2388x based DVB/ATSC card
cx88[0]/2: no i2c-bus available, cannot attach dvb drivers
cx88[0]/2: dvb_register failed (err = -22)
cx88[0]/2: cx8802 probe failed, err = -22
cx88/2: cx2388x dvb driver version 0.0.6 loaded
cx88/2: registering cx8802 driver, type: dvb access: shared
cx88[0]/2: subsystem: 0070:9202, board: Hauppauge Nova-S-Plus DVB-S [card=37]
cx88[0]/2: cx2388x based DVB/ATSC card
cx88[0]/2: no i2c-bus available, cannot attach dvb drivers
cx88[0]/2: dvb_register failed (err = -22)
cx88[0]/2: cx8802 probe failed, err = -22

So my patch at least stopped the Oops from appearing. Btw. Why do I get the output of cx88[0]/2 twice?

Now trying a different module load order after another reboot as suggested from the referenced bug (http://bugzilla.kernel.org/show_bug.cgi?id=9455)

# modprobe cx8800
# modprobe cx8802

cx88/0: cx2388x v4l2 driver version 0.0.6 loaded
PCI: Enabling device 0000:00:10.0 (0154 -> 0156)
ACPI: PCI Interrupt 0000:00:10.0[A] -> Link [LNKD] -> GSI 9 (level, low) -> IRQ 9
cx88[0]: quirk: PCIPCI_NATOMA -- set TBFX
cx88[0]: subsystem: 0070:9202, board: Hauppauge Nova-S-Plus DVB-S [card=37,autodetected]
cx88[0]: TV tuner type 4, Radio tuner type -1
cx88[0]: Test OK
cx88[0]: eeprom i2c attach [addr=0x50,client=eeprom]
cx88[0]: eeprom i2c attach [addr=0x55,client=eeprom]
cx88[0]: i2c register ok

cx88[0]: i2c scan: found device @ 0x10  [???]
cx88[0]: i2c scan: found device @ 0xa0  [eeprom]
cx88[0]: i2c scan: found device @ 0xaa  [???]

tveeprom 5-0050: Hauppauge model 92001, rev B2B1, serial# 761920 tveeprom 5-0050: MAC address is 00-0D-FE-0B-A0-40
tveeprom 5-0050: tuner model is Conexant_CX24109 (idx 111, type 4) tveeprom 5-0050: TV standards ATSC/DVB Digital (eeprom 0x80) tveeprom 5-0050: audio processor is CX883 (idx 32)
tveeprom 5-0050: decoder processor is CX883 (idx 22)
tveeprom 5-0050: has no radio, has IR receiver, has no IR transmitter cx88[0]: hauppauge eeprom: model=92001
input: cx88 IR (Hauppauge Nova-S-Plus as /class/input/input5 cx88[0]/0: found at 0000:00:10.0, rev: 5, irq: 9, latency: 165, mmio:
0xfd000000
cx88[0]/0: registered device video1 [v4l2]
cx88[0]/0: registered device vbi1
cx88/2: cx2388x MPEG-TS Driver Manager version 0.0.6 loaded cx88[0]/2: cx2388x 8802 Driver Manager
PCI: Enabling device 0000:00:10.2 (0154 -> 0156)
ACPI: PCI Interrupt 0000:00:10.2[A] -> Link [LNKD] -> GSI 9 (level, low) -> IRQ 9
cx88[0]/2: found at 0000:00:10.2, rev: 5, irq: 9, latency: 64, mmio:
0xfb000000
cx88/2: cx2388x dvb driver version 0.0.6 loaded
cx88/2: registering cx8802 driver, type: dvb access: shared cx88[0]/2: subsystem: 0070:9202, board: Hauppauge Nova-S-Plus DVB-S [card=37] cx88[0]/2: cx2388x based DVB/ATSC card
CX24123: detected CX24123
i2c-adapter i2c-6: SMBus Quick command not supported, can't probe for chips
DVB: registering new adapter (cx88[0])
DVB: registering frontend 2 (Conexant CX24123/CX24109)...

This way it works.
So it seems I do need to load cx8800 before anything mpeg/dvb related on my cx88 card.

Regards
Matthias

--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list