Skip to contentSkip to conversation

2.6.39 "tuner-core: remove usage of DIGITAL_TV" breaks saa7134 with mt2050

DISCUSSION Simon Arlott 2 participants 3 messages Jul 12, 2011 – Jul 13, 2011 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

commit ad020dc2fe9039628cf6cef42cd1b76531ee8411

Author: Mauro Carvalho Chehab <[email protected]>
Date:   Tue Feb 15 09:30:50 2011 -0200

[media] tuner-core: remove usage of DIGITAL_TV

tuner-core has no business to do with digital TV. So, don't use T_DIGITAL_TV on it, as it has no code to distinguish between them, and nobody fills T_DIGITAL_TV right.

This breaks my Pinnacle PCTV 300i DVB-T cards as they can no longer tune DVB-T.

[  540.010030] tuner 3-0043: Tuner doesn't support mode 3. Putting tuner to sleep
[  540.011017] tuner 2-0043: Tuner doesn't support mode 3. Putting tuner to sleep
[  540.012012] tuner 3-0060: Tuner doesn't support mode 3. Putting tuner to sleep
[  540.013029] tuner 2-0060: Tuner doesn't support mode 3. Putting tuner to sleep

saa7134 needs to indicate digital TV tuning to mt20xx but it looks like tuner-core no longer has any way to allow a tuner to indicate support for this?

(mt2050_set_tv_freq in mt20xx.c uses V4L2_TUNER_DIGITAL_TV)

Signature · 1 line
Simon Arlott

calling saa7134_init+0x0/0x4a @ 1
saa7130/34: v4l2 driver version 0.2.16 loaded
ACPI: PCI Interrupt Link [LNED] enabled at IRQ 16
saa7134 0000:05:00.0: PCI INT A -> Link[LNED] -> GSI 16 (level, low) -> IRQ 16 saa7134[0]: found at 0000:05:00.0, rev: 1, irq: 16, latency: 64, mmio: 0xfdfffc00 saa7134[0]: subsystem: 11bd:002d, board: Pinnacle PCTV 300i DVB-T + PAL [card=50,autodetected] saa7134[0]: board init: gpio is cc06000
saa7134[0]: i2c eeprom 00: bd 11 2d 00 f8 f8 1c 00 43 43 a9 1c 55 d2 b2 92 saa7134[0]: i2c eeprom 10: 00 f0 04 04 ff 20 ff ff ff ff ff ff ff ff ff ff saa7134[0]: i2c eeprom 20: 01 40 01 02 03 ff 03 01 08 ff 00 25 ff ff ff ff saa7134[0]: i2c eeprom 30: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff saa7134[0]: i2c eeprom 40: ff 16 00 c0 86 3c 01 01 ff ff ff ff ff ff ff ff saa7134[0]: i2c eeprom 50: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff saa7134[0]: i2c eeprom 60: 0c 22 17 44 03 11 e1 a1 ff ff ff ff ff ff ff ff saa7134[0]: i2c eeprom 70: 00 30 8d 18 3b 02 ff ff 74 50 ff ff ff ff ff ff saa7134[0]: i2c eeprom 80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff saa7134[0]: i2c eeprom 90: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff saa7134[0]: i2c eeprom a0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff saa7134[0]: i2c eeprom b0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff saa7134[0]: i2c eeprom c0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff saa7134[0]: i2c eeprom d0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff saa7134[0]: i2c eeprom e0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff saa7134[0]: i2c eeprom f0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
tuner 2-0043: chip found @ 0x86 (saa7134[0])
tda9887 2-0043: creating new instance
tda9887 2-0043: tda988[5/6/7] found
tuner 2-0043: type set to tda9887
tuner 2-0043: tv freq set to 0.00
tuner 2-0043: TV freq (0.00) out of range (44-958)
tuner 2-0043: saa7134[0] tuner I2C addr 0x86 with type 74 used for 0x0e
Chip ID is not zero. It is not a TEA5767
tuner 2-0060: Setting mode_mask to 0x0e
tuner 2-0060: chip found @ 0xc0 (saa7134[0])
tuner 2-0060: tuner 0x60: Tuner type absent
tuner 2-0043: Calling set_type_addr for type=33, addr=0xff, mode=0x0e, config=0x00 tuner 2-0043: set addr discarded for type 74, mask e. Asked to change tuner at addr 0xff, with mask e tuner 2-0060: Calling set_type_addr for type=33, addr=0xff, mode=0x0e, config=0x00 tuner 2-0060: defining GPIO callback
mt20xx 2-0060: microtune: companycode=3cbf part=42 rev=1c
mt20xx 2-0060: microtune MT2050 found, OK
tuner 2-0060: type set to MT2050
tuner 2-0060: tv freq set to 400.00
tuner 2-0060: saa7134[0] tuner I2C addr 0xc0 with type 33 used for 0x0e
tuner 2-0043: switching to v4l2
tuner 2-0060: switching to v4l2
tuner 2-0060: tv freq set to 400.00
tuner 2-0060: tv freq set to 400.00
tuner 2-0043: Putting tuner to sleep
tuner 2-0043: Cmd s_power accepted for analog TV
tuner 2-0060: Putting tuner to sleep
tuner 2-0060: Cmd s_power accepted for analog TV
saa7134[0]: registered device video0 [v4l2]
saa7134[0]: registered device vbi0
saa7134 0000:05:02.0: PCI INT A -> Link[LNEB] -> GSI 18 (level, low) -> IRQ 18 saa7134[1]: found at 0000:05:02.0, rev: 1, irq: 18, latency: 64, mmio: 0xfdfff800 saa7134[1]: subsystem: 11bd:002d, board: Pinnacle PCTV 300i DVB-T + PAL [card=50,autodetected] saa7134[1]: board init: gpio is c806000
saa7134[1]: i2c eeprom 00: bd 11 2d 00 f8 f8 1c 00 43 43 a9 1c 55 d2 b2 92 saa7134[1]: i2c eeprom 10: 00 f0 04 04 ff 20 ff ff ff ff ff ff ff ff ff ff saa7134[1]: i2c eeprom 20: 01 40 01 02 03 ff 03 01 08 ff 00 25 ff ff ff ff saa7134[1]: i2c eeprom 30: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff saa7134[1]: i2c eeprom 40: ff 16 00 c0 86 3c 01 01 ff ff ff ff ff ff ff ff saa7134[1]: i2c eeprom 50: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff saa7134[1]: i2c eeprom 60: 0c 22 17 44 03 27 32 08 ff ff ff ff ff ff ff ff saa7134[1]: i2c eeprom 70: 00 30 8d 18 c8 4b ff ff 34 60 ff ff ff ff ff ff saa7134[1]: i2c eeprom 80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff saa7134[1]: i2c eeprom 90: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff saa7134[1]: i2c eeprom a0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff saa7134[1]: i2c eeprom b0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff saa7134[1]: i2c eeprom c0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff saa7134[1]: i2c eeprom d0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff saa7134[1]: i2c eeprom e0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff saa7134[1]: i2c eeprom f0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
tuner 3-0043: chip found @ 0x86 (saa7134[1])
tda9887 3-0043: creating new instance
tda9887 3-0043: tda988[5/6/7] found
tuner 3-0043: type set to tda9887
tuner 3-0043: tv freq set to 0.00
tuner 3-0043: TV freq (0.00) out of range (44-958)
tuner 3-0043: saa7134[1] tuner I2C addr 0x86 with type 74 used for 0x0e
Chip ID is not zero. It is not a TEA5767
tuner 3-0060: Setting mode_mask to 0x0e
tuner 3-0060: chip found @ 0xc0 (saa7134[1])
tuner 3-0060: tuner 0x60: Tuner type absent
tuner 3-0043: Calling set_type_addr for type=33, addr=0xff, mode=0x0e, config=0x00 tuner 3-0043: set addr discarded for type 74, mask e. Asked to change tuner at addr 0xff, with mask e tuner 3-0060: Calling set_type_addr for type=33, addr=0xff, mode=0x0e, config=0x00 tuner 3-0060: defining GPIO callback
mt20xx 3-0060: microtune: companycode=3cbf part=42 rev=22
mt20xx 3-0060: microtune MT2050 found, OK
tuner 3-0060: type set to MT2050
tuner 3-0060: tv freq set to 400.00
tuner 3-0060: saa7134[1] tuner I2C addr 0xc0 with type 33 used for 0x0e
tuner 3-0043: switching to v4l2
tuner 3-0060: switching to v4l2
tuner 3-0060: tv freq set to 400.00
tuner 3-0060: tv freq set to 400.00
tuner 3-0043: Putting tuner to sleep
tuner 3-0043: Cmd s_power accepted for analog TV
tuner 3-0060: Putting tuner to sleep
tuner 3-0060: Cmd s_power accepted for analog TV
saa7134[1]: registered device video1 [v4l2]
saa7134[1]: registered device vbi1
initcall saa7134_init+0x0/0x4a returned 0 after 372541 usecs

calling saa7134_init+0x0/0x4a @ 1
saa7130/34: v4l2 driver version 0.2.16 loaded
ACPI: PCI Interrupt Link [LNED] enabled at IRQ 16
saa7134 0000:05:00.0: PCI INT A -> Link[LNED] -> GSI 16 (level, low) -> IRQ 16 saa7134[0]: found at 0000:05:00.0, rev: 1, irq: 16, latency: 64, mmio: 0xfdfffc00 saa7134[0]: subsystem: 11bd:002d, board: Pinnacle PCTV 300i DVB-T + PAL [card=50,autodetected] saa7134[0]: board init: gpio is c806000
saa7134[0]: i2c eeprom 00: bd 11 2d 00 f8 f8 1c 00 43 43 a9 1c 55 d2 b2 92 saa7134[0]: i2c eeprom 10: 00 f0 04 04 ff 20 ff ff ff ff ff ff ff ff ff ff saa7134[0]: i2c eeprom 20: 01 40 01 02 03 ff 03 01 08 ff 00 25 ff ff ff ff saa7134[0]: i2c eeprom 30: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff saa7134[0]: i2c eeprom 40: ff 16 00 c0 86 3c 01 01 ff ff ff ff ff ff ff ff saa7134[0]: i2c eeprom 50: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff saa7134[0]: i2c eeprom 60: 0c 22 17 44 03 11 e1 a1 ff ff ff ff ff ff ff ff saa7134[0]: i2c eeprom 70: 00 30 8d 18 3b 02 ff ff 74 50 ff ff ff ff ff ff saa7134[0]: i2c eeprom 80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff saa7134[0]: i2c eeprom 90: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff saa7134[0]: i2c eeprom a0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff saa7134[0]: i2c eeprom b0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff saa7134[0]: i2c eeprom c0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff saa7134[0]: i2c eeprom d0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff saa7134[0]: i2c eeprom e0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff saa7134[0]: i2c eeprom f0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
tda9887 2-0043: creating new instance
tda9887 2-0043: tda988[5/6/7] found
tuner 2-0043: type set to tda9887
tuner 2-0043: tv freq set to 400.00
tuner 2-0043: saa7134[0] tuner I2C addr 0x86 with type 74 used for 0x06
tuner 2-0043: Tuner 74 found with type(s) Radio TV.
Chip ID is not zero. It is not a TEA5767
tuner 2-0060: Setting mode_mask to 0x06
tuner 2-0060: tuner 0x60: Tuner type absent
tuner 2-0060: Tuner -1 found with type(s) Radio TV.
tuner 2-0043: Calling set_type_addr for type=33, addr=0xff, mode=0x06, config=0x00 tuner 2-0043: set addr discarded for type 74, mask 6. Asked to change tuner at addr 0xff, with mask 6 tuner 2-0060: Calling set_type_addr for type=33, addr=0xff, mode=0x06, config=0x00 tuner 2-0060: defining GPIO callback
mt20xx 2-0060: microtune: companycode=3cbf part=42 rev=22
mt20xx 2-0060: microtune MT2050 found, OK
tuner 2-0060: type set to MT2050
tuner 2-0060: tv freq set to 400.00
tuner 2-0060: saa7134[0] tuner I2C addr 0xc0 with type 33 used for 0x06
tuner 2-0043: tv freq set to 400.00
tuner 2-0060: tv freq set to 400.00
tuner 2-0043: tv freq set to 400.00
tuner 2-0060: tv freq set to 400.00
tuner 2-0043: Putting tuner to sleep
tuner 2-0060: Putting tuner to sleep
saa7134[0]: registered device video0 [v4l2]
saa7134[0]: registered device vbi0
saa7134 0000:05:02.0: PCI INT A -> Link[LNEB] -> GSI 18 (level, low) -> IRQ 18 saa7134[1]: found at 0000:05:02.0, rev: 1, irq: 18, latency: 64, mmio: 0xfdfff800 saa7134[1]: subsystem: 11bd:002d, board: Pinnacle PCTV 300i DVB-T + PAL [card=50,autodetected] saa7134[1]: board init: gpio is c806000
saa7134[1]: i2c eeprom 00: bd 11 2d 00 f8 f8 1c 00 43 43 a9 1c 55 d2 b2 92 saa7134[1]: i2c eeprom 10: 00 f0 04 04 ff 20 ff ff ff ff ff ff ff ff ff ff saa7134[1]: i2c eeprom 20: 01 40 01 02 03 ff 03 01 08 ff 00 25 ff ff ff ff saa7134[1]: i2c eeprom 30: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff saa7134[1]: i2c eeprom 40: ff 16 00 c0 86 3c 01 01 ff ff ff ff ff ff ff ff saa7134[1]: i2c eeprom 50: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff saa7134[1]: i2c eeprom 60: 0c 22 17 44 03 27 32 08 ff ff ff ff ff ff ff ff saa7134[1]: i2c eeprom 70: 00 30 8d 18 c8 4b ff ff 34 60 ff ff ff ff ff ff saa7134[1]: i2c eeprom 80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff saa7134[1]: i2c eeprom 90: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff saa7134[1]: i2c eeprom a0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff saa7134[1]: i2c eeprom b0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff saa7134[1]: i2c eeprom c0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff saa7134[1]: i2c eeprom d0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff saa7134[1]: i2c eeprom e0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff saa7134[1]: i2c eeprom f0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
tda9887 3-0043: creating new instance
tda9887 3-0043: tda988[5/6/7] found
tuner 3-0043: type set to tda9887
tuner 3-0043: tv freq set to 400.00
tuner 3-0043: saa7134[1] tuner I2C addr 0x86 with type 74 used for 0x06
tuner 3-0043: Tuner 74 found with type(s) Radio TV.
Chip ID is not zero. It is not a TEA5767
tuner 3-0060: Setting mode_mask to 0x06
tuner 3-0060: tuner 0x60: Tuner type absent
tuner 3-0060: Tuner -1 found with type(s) Radio TV.
tuner 3-0043: Calling set_type_addr for type=33, addr=0xff, mode=0x06, config=0x00 tuner 3-0043: set addr discarded for type 74, mask 6. Asked to change tuner at addr 0xff, with mask 6 tuner 3-0060: Calling set_type_addr for type=33, addr=0xff, mode=0x06, config=0x00 tuner 3-0060: defining GPIO callback
mt20xx 3-0060: microtune: companycode=3cbf part=42 rev=22
mt20xx 3-0060: microtune MT2050 found, OK
tuner 3-0060: type set to MT2050
tuner 3-0060: tv freq set to 400.00
tuner 3-0060: saa7134[1] tuner I2C addr 0xc0 with type 33 used for 0x06
tuner 3-0043: tv freq set to 400.00
tuner 3-0060: tv freq set to 400.00
tuner 3-0043: tv freq set to 400.00
tuner 3-0060: tv freq set to 400.00
tuner 3-0043: Putting tuner to sleep
tuner 3-0060: Putting tuner to sleep
saa7134[1]: registered device video1 [v4l2]
saa7134[1]: registered device vbi1
initcall saa7134_init+0x0/0x4a returned 0 after 380347 usecs

#1 lore raw

Em 12-07-2011 18:21, Simon Arlott escreveu:

Quoted 21 lines

commit ad020dc2fe9039628cf6cef42cd1b76531ee8411

Author: Mauro Carvalho Chehab <[email protected]>
Date:   Tue Feb 15 09:30:50 2011 -0200

[media] tuner-core: remove usage of DIGITAL_TV

tuner-core has no business to do with digital TV. So, don't use T_DIGITAL_TV on it, as it has no code to distinguish between them, and nobody fills T_DIGITAL_TV right.

This breaks my Pinnacle PCTV 300i DVB-T cards as they can no longer tune DVB-T.

[  540.010030] tuner 3-0043: Tuner doesn't support mode 3. Putting tuner to sleep
[  540.011017] tuner 2-0043: Tuner doesn't support mode 3. Putting tuner to sleep
[  540.012012] tuner 3-0060: Tuner doesn't support mode 3. Putting tuner to sleep
[  540.013029] tuner 2-0060: Tuner doesn't support mode 3. Putting tuner to sleep
Quoted 6 lines

saa7134 needs to indicate digital TV tuning to mt20xx but it looks like tuner-core no longer has any way to allow a tuner to indicate support for this?

(mt2050_set_tv_freq in mt20xx.c uses V4L2_TUNER_DIGITAL_TV)

Could you please try the enclosed patch? It should fix the issue. I should probably rename T_ANALOG_TV to just T_TV, but I'll do it on a next patch if this one works ok, as we don't want to send a renaming patch to -stable.

---
[media] Fix Digital TV breakage with mt20xx tuner

The mt20xx tuner passes V4L2_TUNER_DIGITAL_TV to tuner core. However, the check_mode code now doesn't handle it well. Change the logic there to avoid the breakage, and fix a test for analog-only at g_tuner.

drivers/media/video/tuner-core.c +12 -4
index 5748d04..aa45952 100644
@@ -732,10 +732,19 @@ static int tuner_remove(struct i2c_client *client)
  * returns 0.
  * This function is needed for boards that have a separate tuner for
  * radio (like devices with tea5767).
+ * NOTE: mt20xx uses V4L2_TUNER_DIGITAL_TV and calls set_tv_freq to
+ *       select a TV frequency. So, t_mode = T_ANALOG_TV could actually
+ *	 be used to represent a Digital TV too.
  */
 static inline int check_mode(struct tuner *t, enum v4l2_tuner_type mode)
 {
-	if ((1 << mode & t->mode_mask) == 0)
+	int t_mode;
+	if (mode == V4L2_TUNER_RADIO)
+		t_mode = T_RADIO;
+	else
+		t_mode = T_ANALOG_TV;
+
+	if ((t_mode & t->mode_mask) == 0)
 		return -EINVAL;
 
 	return 0;
@@ -1034,7 +1043,7 @@ static void tuner_status(struct dvb_frontend *fe)
 	case V4L2_TUNER_RADIO:
 		p = "radio";
 		break;
-	case V4L2_TUNER_DIGITAL_TV:
+	case V4L2_TUNER_DIGITAL_TV: /* Used by mt20xx */
 		p = "digital TV";
 		break;
 	case V4L2_TUNER_ANALOG_TV:
@@ -1166,9 +1175,8 @@ static int tuner_g_tuner(struct v4l2_subdev *sd, struct v4l2_tuner *vt)
 	vt->type = t->mode;
 	if (analog_ops->get_afc)
 		vt->afc = analog_ops->get_afc(&t->fe);
-	if (t->mode == V4L2_TUNER_ANALOG_TV)
-		vt->capability |= V4L2_TUNER_CAP_NORM;
 	if (t->mode != V4L2_TUNER_RADIO) {
+		vt->capability |= V4L2_TUNER_CAP_NORM;
 		vt->rangelow = tv_range[0] * 16;
 		vt->rangehigh = tv_range[1] * 16;
 		return 0;
#2 lore raw
Quoted 19 lines · Mauro Carvalho Chehab

Em 12-07-2011 18:21, Simon Arlott escreveu:

Quoted 18 lines

commit ad020dc2fe9039628cf6cef42cd1b76531ee8411

Author: Mauro Carvalho Chehab <[email protected]>
Date:   Tue Feb 15 09:30:50 2011 -0200

[media] tuner-core: remove usage of DIGITAL_TV

This breaks my Pinnacle PCTV 300i DVB-T cards as they can no longer tune DVB-T.

[  540.010030] tuner 3-0043: Tuner doesn't support mode 3. Putting tuner to sleep
[  540.011017] tuner 2-0043: Tuner doesn't support mode 3. Putting tuner to sleep
[  540.012012] tuner 3-0060: Tuner doesn't support mode 3. Putting tuner to sleep
[  540.013029] tuner 2-0060: Tuner doesn't support mode 3. Putting tuner to sleep

saa7134 needs to indicate digital TV tuning to mt20xx but it looks like tuner-core no longer has any way to allow a tuner to indicate support for this?

Quoted 6 lines
Quoted 1 line

(mt2050_set_tv_freq in mt20xx.c uses V4L2_TUNER_DIGITAL_TV)

Could you please try the enclosed patch? It should fix the issue. I should probably rename T_ANALOG_TV to just T_TV, but I'll do it on a next patch if this one works ok, as we don't want to send a renaming patch to -stable.

This fixes it. Tuner error messages could do with being error level - I didn't see the message initially as I have the debugging turned off. The -EINVAL never gets passed up to userspace.

Quoted 6 lines

---
[media] Fix Digital TV breakage with mt20xx tuner

The mt20xx tuner passes V4L2_TUNER_DIGITAL_TV to tuner core. However, the check_mode code now doesn't handle it well. Change the logic there to avoid the breakage, and fix a test for analog-only at g_tuner.

Thanks,

Signature · 1 line
Simon Arlott