[6/8] cx231xx: Add digital support for [2040:b131] Hauppauge WinTV 930C-HD (model 1114xx)

Message ID 1406059938-21141-7-git-send-email-zzam@gentoo.org (mailing list archive)
State Accepted, archived
Headers

Commit Message

Matthias Schwarzott July 22, 2014, 8:12 p.m. UTC
  Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
---
 drivers/media/usb/cx231xx/Kconfig         |  1 +
 drivers/media/usb/cx231xx/cx231xx-cards.c | 42 +++++++++++++++++++++
 drivers/media/usb/cx231xx/cx231xx-dvb.c   | 63 +++++++++++++++++++++++++++++++
 drivers/media/usb/cx231xx/cx231xx.h       |  1 +
 4 files changed, 107 insertions(+)
  

Comments

Mauro Carvalho Chehab July 26, 2014, 7:27 p.m. UTC | #1
Em Tue, 22 Jul 2014 22:12:16 +0200
Matthias Schwarzott <zzam@gentoo.org> escreveu:

> Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>

Hi Matthias,

Tried to apply your patch series, but there's something wrong on it.

See the enclosed logs. I suspect that you missed a patch adding the
proper tuner for this device.

Regards,
Mauro

[76183.104385] Linux video capture interface: v2.00
[76183.110508] cx231xx #0: New device Hauppauge Hauppauge Device @ 12 Mbps (2040:b131) with 4 interfaces
[76183.110513] cx231xx #0: registering interface 1
[76183.110602] cx231xx #0: Identified as Hauppauge WinTV 930C-HD (1114xx) / PCTV QuatroStick 522e (card=20)
[76183.211942] cx231xx #0: cx231xx_dif_set_standard: setStandard to ffffffff
[76183.220035] cx231xx #0: can't change interface 5 alt no. to 0 (err=-22)
[76183.220043] cx231xx #0: can't change interface 6 alt no. to 0 (err=-22)
[76183.228875] cx25840 0-0044: cx23102 A/V decoder found @ 0x88 (cx231xx #0)
[76183.247286] cx25840 0-0044:  Firmware download size changed to 16 bytes max length
[76185.302724] cx25840 0-0044: loaded v4l-cx231xx-avcore-01.fw firmware (16382 bytes)
[76185.336362] cx231xx #0: Changing the i2c master port to 1
[76185.368850] cx231xx #0: Changing the i2c master port to 3
[76185.368940] cx231xx #0: i2c eeprom 00: 40 20 31 b1 aa 00 00 01 10 00 50 00 30 00 ff ff
[76185.368944] cx231xx #0: i2c eeprom 10: 14 03 48 00 61 00 75 00 70 00 70 00 61 00 75 00
[76185.368946] cx231xx #0: i2c eeprom 20: 67 00 65 00 00 00 00 00 00 00 00 00 00 00 00 00
[76185.368949] cx231xx #0: i2c eeprom 30: 16 03 34 00 30 00 33 00 35 00 31 00 36 00 39 00
[76185.368951] cx231xx #0: i2c eeprom 40: 31 00 31 00 32 00 00 00 ff ff ff ff ff ff ff ff
[76185.368953] cx231xx #0: i2c eeprom 50: 22 03 48 00 61 00 75 00 70 00 70 00 61 00 75 00
[76185.368956] cx231xx #0: i2c eeprom 60: 67 00 65 00 20 00 44 00 65 00 76 00 69 00 63 00
[76185.368958] cx231xx #0: i2c eeprom 70: 65 00 ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[76185.368960] cx231xx #0: i2c eeprom 80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[76185.368962] cx231xx #0: i2c eeprom 90: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[76185.368964] cx231xx #0: i2c eeprom a0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[76185.368966] cx231xx #0: i2c eeprom b0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[76185.368969] cx231xx #0: i2c eeprom c0: 84 09 00 04 20 77 00 40 58 cb 83 f0 73 05 2f 00
[76185.368971] cx231xx #0: i2c eeprom d0: 84 08 00 06 3b b3 01 00 56 2a 95 72 07 70 73 09
[76185.368973] cx231xx #0: i2c eeprom e0: 2e 7f 73 0a f4 ba 72 0b 13 72 0f 05 72 10 01 72
[76185.368975] cx231xx #0: i2c eeprom f0: 11 1f 73 13 eb 79 79 ea 00 00 00 00 00 00 00 00
[76185.368981] tveeprom 1-0000: Hauppauge model 111419, rev E2I6, serial# 8637272
[76185.368984] tveeprom 1-0000: MAC address is 00:0d:fe:83:cb:58
[76185.368987] tveeprom 1-0000: tuner model is unknown (idx 186, type 4)
[76185.368991] tveeprom 1-0000: TV standards PAL(B/G) PAL(I) SECAM(L/L') PAL(D/D1/K) ATSC/DVB Digital (eeprom 0xf4)
[76185.368993] tveeprom 1-0000: audio processor is unknown (idx 47)
[76185.368995] tveeprom 1-0000: decoder processor is unknown (idx 46)
[76185.368998] tveeprom 1-0000: has no radio, has IR receiver, has no IR transmitter
[76185.370090] cx231xx #0: cx231xx #0: v4l2 driver version 0.0.2
[76185.387866] cx231xx #0: cx231xx_dif_set_standard: setStandard to ffffffff
[76185.431668] Unknown tuner type configuring SIF
[76185.432964] cx231xx #0: video_mux : 0
[76185.432972] cx231xx #0: do_mode_ctrl_overrides : 0xff
[76185.433843] cx231xx #0: do_mode_ctrl_overrides PAL
[76185.463109] cx231xx #0: cx231xx #0/0: registered device video0 [v4l2]
[76185.463321] cx231xx #0: cx231xx #0/0: registered device vbi0
[76185.463325] cx231xx #0: V4L2 device registered as video0 and vbi0
[76185.463331] cx231xx #0: EndPoint Addr 0x84, Alternate settings: 2
[76185.463334] cx231xx #0: Alternate setting 0, max size= 64
[76185.463336] cx231xx #0: Alternate setting 1, max size= 728
[76185.463359] BUG: unable to handle kernel NULL pointer dereference at           (null)
[76185.465295] IP: [<ffffffffa048dec8>] cx231xx_usb_probe+0x5a8/0xb20 [cx231xx]
[76185.465654] cx231xx #0: can't change interface 5 alt no. to 0 (err=-22)
[76185.465705] cx231xx #0: called cx231xx_uninit_vbi_isoc
[76185.465707] cx231xx #0: cx231xx_stop_stream():: ep_mask = 10
[76185.465872] cx231xx #0: can't change interface 5 alt no. to 0 (err=-22)
[76185.474837] PGD 21c0fa067 PUD 2182b4067 PMD 0 
[76185.476593] Oops: 0000 [#1] SMP 
[76185.478285] Modules linked in: cx25840 cx231xx(+) cx2341x tveeprom videobuf_vmalloc videobuf_core rc_core v4l2_common videodev media ip6table_filter ip6_tables bnep nouveau x86_pkg_temp_thermal coretemp i915 binfmt_misc kvm_intel kvm ttm i2c_algo_bit drm_kms_helper vfat fat drm arc4 iwldvm mac80211 snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_codec_generic snd_hda_intel snd_hda_controller snd_hda_codec iwlwifi crct10dif_pclmul snd_hwdep crc32_pclmul cfg80211 snd_seq snd_seq_device snd_pcm crc32c_intel snd_timer btusb bluetooth iTCO_wdt iTCO_vendor_support mxm_wmi ghash_clmulni_intel lpc_ich i2c_i801 snd mei_me soundcore rfkill joydev serio_raw shpchp mei wmi mfd_core i2c_core video microcode r8169 mii [last unloaded: dvb_core]
[76185.487219] CPU: 0 PID: 12079 Comm: modprobe Not tainted 3.16.0-rc6+ #12
[76185.488936] Hardware name: SAMSUNG ELECTRONICS CO., LTD. 550P5C/550P7C/SAMSUNG_NP1234567890, BIOS P05ABI.016.130917.dg 09/17/2013
[76185.490710] task: ffff880211172ee0 ti: ffff88021866c000 task.ti: ffff88021866c000
[76185.492502] RIP: 0010:[<ffffffffa048dec8>]  [<ffffffffa048dec8>] cx231xx_usb_probe+0x5a8/0xb20 [cx231xx]
[76185.494321] RSP: 0018:ffff88021866fb50  EFLAGS: 00010246
[76185.496037] RAX: ffff88021c34fc00 RBX: ffff8800c4f70000 RCX: 0000000000000006
[76185.497781] RDX: 0000000000000004 RSI: ffff8800c4f70000 RDI: ffffffffa04a7508
[76185.499548] RBP: ffff88021866fb90 R08: 0000000000000000 R09: 00000000000011d3
[76185.501323] R10: 0000000000000000 R11: ffff88021866f85e R12: ffff88021bc20800
[76185.503119] R13: ffff88021bc27c00 R14: ffff8800c4f70168 R15: ffff8802229ca000
[76185.504934] FS:  00007f6c13b2e740(0000) GS:ffff88022f200000(0000) knlGS:0000000000000000
[76185.506662] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[76185.508406] CR2: 0000000000000000 CR3: 00000002222b8000 CR4: 00000000001407f0
[76185.510169] Stack:
[76185.511921]  ffff88020000b131 ffffffff00000004 ffff880000000001 ffff8802229ca090
[76185.513725]  ffff8802229ca000 ffffffffa04ab568 ffff88021bc27c30 ffffffffa04ab7a0
[76185.515517]  ffff88021866fbd8 ffffffff814eefcf 000000001866fbb0 ffff88021bc27c00
[76185.517248] Call Trace:
[76185.518963]  [<ffffffff814eefcf>] usb_probe_interface+0x1df/0x330
[76185.520714]  [<ffffffff8146605d>] driver_probe_device+0x12d/0x3d0
[76185.522452]  [<ffffffff814663d3>] __driver_attach+0x93/0xa0
[76185.524203]  [<ffffffff81466340>] ? __device_attach+0x40/0x40
[76185.525959]  [<ffffffff81463f03>] bus_for_each_dev+0x73/0xc0
[76185.527599]  [<ffffffff81465a5e>] driver_attach+0x1e/0x20
[76185.529240]  [<ffffffff81465640>] bus_add_driver+0x180/0x250
[76185.537278]  [<ffffffff81002144>] do_one_initcall+0xd4/0x210
[76185.538809]  [<ffffffff811b5fd4>] ? __vunmap+0x94/0x100
[76185.540330]  [<ffffffff81106767>] load_module+0x1ea7/0x24f0
[76185.541806]  [<ffffffff81102370>] ? store_uevent+0x70/0x70
[76185.543255]  [<ffffffff811f3200>] ? kernel_read+0x50/0x80
[76185.544661]  [<ffffffff81106f66>] SyS_finit_module+0xa6/0xd0
[76185.546047]  [<ffffffff816fc869>] system_call_fastpath+0x16/0x1b
[76185.547354] Code: 1d 00 00 85 ff 0f 8f 94 04 00 00 0f b6 93 bb 21 00 00 49 8b 87 68 03 00 00 48 89 de 48 c7 c7 08 75 4a a0 4c 8b 84 d0 a0 00 00 00 <49> 8b 00 4c 89 45 d0 48 8b 40 18 0f b6 40 02 0f b6 d0 66 89 93 
[76185.550208] RIP  [<ffffffffa048dec8>] cx231xx_usb_probe+0x5a8/0xb20 [cx231xx]
[76185.551613]  RSP <ffff88021866fb50>
[76185.553006] CR2: 0000000000000000
[76185.559997] ---[ end trace 1e58ef345d6b3f24 ]---

$ gdb drivers/media/usb/cx231xx/cx231xx.ko
GNU gdb (GDB) Fedora 7.7.1-15.fc20
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from drivers/media/usb/cx231xx/cx231xx.ko...done.
(gdb) list *cx231xx_usb_driver_init+0x1e
0x1e is in buffer_setup (drivers/media/usb/cx231xx/cx231xx-video.c:664).
659	buffer_setup(struct videobuf_queue *vq, unsigned int *count, unsigned int *size)
660	{
661		struct cx231xx_fh *fh = vq->priv_data;
662		struct cx231xx *dev = fh->dev;
663	
664		*size = (fh->dev->width * fh->dev->height * dev->format->depth + 7)>>3;
665		if (0 == *count)
666			*count = CX231XX_DEF_BUF;
667	
668		if (*count < CX231XX_MIN_BUF)
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
  
Matthias Schwarzott July 27, 2014, 9:32 a.m. UTC | #2
Hi Mauro.

On 26.07.2014 21:27, Mauro Carvalho Chehab wrote:
> Tried to apply your patch series, but there's something wrong on it.
> 
> See the enclosed logs. I suspect that you missed a patch adding the
> proper tuner for this device.

well, tuner_type is set to TUNER_ABSENT, and for me the oops does not
happen.

> [76185.463359] BUG: unable to handle kernel NULL pointer dereference at           (null)
> [76185.465295] IP: [<ffffffffa048dec8>] cx231xx_usb_probe+0x5a8/0xb20 [cx231xx]
> [76185.465654] cx231xx #0: can't change interface 5 alt no. to 0 (err=-22)
> [76185.465705] cx231xx #0: called cx231xx_uninit_vbi_isoc
> [76185.465707] cx231xx #0: cx231xx_stop_stream():: ep_mask = 10
> [76185.465872] cx231xx #0: can't change interface 5 alt no. to 0 (err=-22)
> [76185.474837] PGD 21c0fa067 PUD 2182b4067 PMD 0 
> [76185.476593] Oops: 0000 [#1] SMP 
> [76185.478285] Modules linked in: cx25840 cx231xx(+) cx2341x tveeprom videobuf_vmalloc videobuf_core rc_core v4l2_common videodev media ip6table_filter ip6_tables bnep nouveau x86_pkg_temp_thermal coretemp i915 binfmt_misc kvm_intel kvm ttm i2c_algo_bit drm_kms_helper vfat fat drm arc4 iwldvm mac80211 snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_codec_generic snd_hda_intel snd_hda_controller snd_hda_codec iwlwifi crct10dif_pclmul snd_hwdep crc32_pclmul cfg80211 snd_seq snd_seq_device snd_pcm crc32c_intel snd_timer btusb bluetooth iTCO_wdt iTCO_vendor_support mxm_wmi ghash_clmulni_intel lpc_ich i2c_i801 snd mei_me soundcore rfkill joydev serio_raw shpchp mei wmi mfd_core i2c_core video microcode r8169 mii [last unloaded: dvb_core]
> [76185.487219] CPU: 0 PID: 12079 Comm: modprobe Not tainted 3.16.0-rc6+ #12
> [76185.488936] Hardware name: SAMSUNG ELECTRONICS CO., LTD. 550P5C/550P7C/SAMSUNG_NP1234567890, BIOS P05ABI.016.130917.dg 09/17/2013
> [76185.490710] task: ffff880211172ee0 ti: ffff88021866c000 task.ti: ffff88021866c000
> [76185.492502] RIP: 0010:[<ffffffffa048dec8>]  [<ffffffffa048dec8>] cx231xx_usb_probe+0x5a8/0xb20 [cx231xx]
> [76185.494321] RSP: 0018:ffff88021866fb50  EFLAGS: 00010246
> [76185.496037] RAX: ffff88021c34fc00 RBX: ffff8800c4f70000 RCX: 0000000000000006
> [76185.497781] RDX: 0000000000000004 RSI: ffff8800c4f70000 RDI: ffffffffa04a7508
> [76185.499548] RBP: ffff88021866fb90 R08: 0000000000000000 R09: 00000000000011d3
> [76185.501323] R10: 0000000000000000 R11: ffff88021866f85e R12: ffff88021bc20800
> [76185.503119] R13: ffff88021bc27c00 R14: ffff8800c4f70168 R15: ffff8802229ca000
> [76185.504934] FS:  00007f6c13b2e740(0000) GS:ffff88022f200000(0000) knlGS:0000000000000000
> [76185.506662] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> [76185.508406] CR2: 0000000000000000 CR3: 00000002222b8000 CR4: 00000000001407f0
> [76185.510169] Stack:
> [76185.511921]  ffff88020000b131 ffffffff00000004 ffff880000000001 ffff8802229ca090
> [76185.513725]  ffff8802229ca000 ffffffffa04ab568 ffff88021bc27c30 ffffffffa04ab7a0
> [76185.515517]  ffff88021866fbd8 ffffffff814eefcf 000000001866fbb0 ffff88021bc27c00
> [76185.517248] Call Trace:
> [76185.518963]  [<ffffffff814eefcf>] usb_probe_interface+0x1df/0x330
> [76185.520714]  [<ffffffff8146605d>] driver_probe_device+0x12d/0x3d0
> [76185.522452]  [<ffffffff814663d3>] __driver_attach+0x93/0xa0
> [76185.524203]  [<ffffffff81466340>] ? __device_attach+0x40/0x40
> [76185.525959]  [<ffffffff81463f03>] bus_for_each_dev+0x73/0xc0
> [76185.527599]  [<ffffffff81465a5e>] driver_attach+0x1e/0x20
> [76185.529240]  [<ffffffff81465640>] bus_add_driver+0x180/0x250
> [76185.537278]  [<ffffffff81002144>] do_one_initcall+0xd4/0x210
> [76185.538809]  [<ffffffff811b5fd4>] ? __vunmap+0x94/0x100
> [76185.540330]  [<ffffffff81106767>] load_module+0x1ea7/0x24f0
> [76185.541806]  [<ffffffff81102370>] ? store_uevent+0x70/0x70
> [76185.543255]  [<ffffffff811f3200>] ? kernel_read+0x50/0x80
> [76185.544661]  [<ffffffff81106f66>] SyS_finit_module+0xa6/0xd0
> [76185.546047]  [<ffffffff816fc869>] system_call_fastpath+0x16/0x1b
> [76185.547354] Code: 1d 00 00 85 ff 0f 8f 94 04 00 00 0f b6 93 bb 21 00 00 49 8b 87 68 03 00 00 48 89 de 48 c7 c7 08 75 4a a0 4c 8b 84 d0 a0 00 00 00 <49> 8b 00 4c 89 45 d0 48 8b 40 18 0f b6 40 02 0f b6 d0 66 89 93 
> [76185.550208] RIP  [<ffffffffa048dec8>] cx231xx_usb_probe+0x5a8/0xb20 [cx231xx]
> [76185.551613]  RSP <ffff88021866fb50>
> [76185.553006] CR2: 0000000000000000
> [76185.559997] ---[ end trace 1e58ef345d6b3f24 ]---
> 

Is the order of the printk messages and of the oops message fixed? Are
all messages printed before the oops also before the oops message?

It seems to oops is at cx231xx_usb_probe+0x5a8/0xb20.

> $ gdb drivers/media/usb/cx231xx/cx231xx.ko
> GNU gdb (GDB) Fedora 7.7.1-15.fc20
> Copyright (C) 2014 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
[...]
> Type "apropos word" to search for commands related to "word"...
> Reading symbols from drivers/media/usb/cx231xx/cx231xx.ko...done.
> (gdb) list *cx231xx_usb_driver_init+0x1e

Could you retry this with the offset from above (0x5a8).
I normally use nm to get the base addr of the function, then add the
offset and then run "addr2line -ispf -e cx231xx.ko -a 0x....."

Regards
Matthias

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
  
Mauro Carvalho Chehab July 27, 2014, 1:44 p.m. UTC | #3
Em Sun, 27 Jul 2014 11:32:26 +0200
Matthias Schwarzott <zzam@gentoo.org> escreveu:

> 
> Hi Mauro.
> 
> On 26.07.2014 21:27, Mauro Carvalho Chehab wrote:
> > Tried to apply your patch series, but there's something wrong on it.
> > 
> > See the enclosed logs. I suspect that you missed a patch adding the
> > proper tuner for this device.
> 
> well, tuner_type is set to TUNER_ABSENT, and for me the oops does not
> happen.
> 
> > [76185.463359] BUG: unable to handle kernel NULL pointer dereference at           (null)
> > [76185.465295] IP: [<ffffffffa048dec8>] cx231xx_usb_probe+0x5a8/0xb20 [cx231xx]
> > [76185.465654] cx231xx #0: can't change interface 5 alt no. to 0 (err=-22)
> > [76185.465705] cx231xx #0: called cx231xx_uninit_vbi_isoc
> > [76185.465707] cx231xx #0: cx231xx_stop_stream():: ep_mask = 10
> > [76185.465872] cx231xx #0: can't change interface 5 alt no. to 0 (err=-22)
> > [76185.474837] PGD 21c0fa067 PUD 2182b4067 PMD 0 
> > [76185.476593] Oops: 0000 [#1] SMP 
> > [76185.478285] Modules linked in: cx25840 cx231xx(+) cx2341x tveeprom videobuf_vmalloc videobuf_core rc_core v4l2_common videodev media ip6table_filter ip6_tables bnep nouveau x86_pkg_temp_thermal coretemp i915 binfmt_misc kvm_intel kvm ttm i2c_algo_bit drm_kms_helper vfat fat drm arc4 iwldvm mac80211 snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_codec_generic snd_hda_intel snd_hda_controller snd_hda_codec iwlwifi crct10dif_pclmul snd_hwdep crc32_pclmul cfg80211 snd_seq snd_seq_device snd_pcm crc32c_intel snd_timer btusb bluetooth iTCO_wdt iTCO_vendor_support mxm_wmi ghash_clmulni_intel lpc_ich i2c_i801 snd mei_me soundcore rfkill joydev serio_raw shpchp mei wmi mfd_core i2c_core video microcode r8169 mii [last unloaded: dvb_core]
> > [76185.487219] CPU: 0 PID: 12079 Comm: modprobe Not tainted 3.16.0-rc6+ #12
> > [76185.488936] Hardware name: SAMSUNG ELECTRONICS CO., LTD. 550P5C/550P7C/SAMSUNG_NP1234567890, BIOS P05ABI.016.130917.dg 09/17/2013
> > [76185.490710] task: ffff880211172ee0 ti: ffff88021866c000 task.ti: ffff88021866c000
> > [76185.492502] RIP: 0010:[<ffffffffa048dec8>]  [<ffffffffa048dec8>] cx231xx_usb_probe+0x5a8/0xb20 [cx231xx]
> > [76185.494321] RSP: 0018:ffff88021866fb50  EFLAGS: 00010246
> > [76185.496037] RAX: ffff88021c34fc00 RBX: ffff8800c4f70000 RCX: 0000000000000006
> > [76185.497781] RDX: 0000000000000004 RSI: ffff8800c4f70000 RDI: ffffffffa04a7508
> > [76185.499548] RBP: ffff88021866fb90 R08: 0000000000000000 R09: 00000000000011d3
> > [76185.501323] R10: 0000000000000000 R11: ffff88021866f85e R12: ffff88021bc20800
> > [76185.503119] R13: ffff88021bc27c00 R14: ffff8800c4f70168 R15: ffff8802229ca000
> > [76185.504934] FS:  00007f6c13b2e740(0000) GS:ffff88022f200000(0000) knlGS:0000000000000000
> > [76185.506662] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> > [76185.508406] CR2: 0000000000000000 CR3: 00000002222b8000 CR4: 00000000001407f0
> > [76185.510169] Stack:
> > [76185.511921]  ffff88020000b131 ffffffff00000004 ffff880000000001 ffff8802229ca090
> > [76185.513725]  ffff8802229ca000 ffffffffa04ab568 ffff88021bc27c30 ffffffffa04ab7a0
> > [76185.515517]  ffff88021866fbd8 ffffffff814eefcf 000000001866fbb0 ffff88021bc27c00
> > [76185.517248] Call Trace:
> > [76185.518963]  [<ffffffff814eefcf>] usb_probe_interface+0x1df/0x330
> > [76185.520714]  [<ffffffff8146605d>] driver_probe_device+0x12d/0x3d0
> > [76185.522452]  [<ffffffff814663d3>] __driver_attach+0x93/0xa0
> > [76185.524203]  [<ffffffff81466340>] ? __device_attach+0x40/0x40
> > [76185.525959]  [<ffffffff81463f03>] bus_for_each_dev+0x73/0xc0
> > [76185.527599]  [<ffffffff81465a5e>] driver_attach+0x1e/0x20
> > [76185.529240]  [<ffffffff81465640>] bus_add_driver+0x180/0x250
> > [76185.537278]  [<ffffffff81002144>] do_one_initcall+0xd4/0x210
> > [76185.538809]  [<ffffffff811b5fd4>] ? __vunmap+0x94/0x100
> > [76185.540330]  [<ffffffff81106767>] load_module+0x1ea7/0x24f0
> > [76185.541806]  [<ffffffff81102370>] ? store_uevent+0x70/0x70
> > [76185.543255]  [<ffffffff811f3200>] ? kernel_read+0x50/0x80
> > [76185.544661]  [<ffffffff81106f66>] SyS_finit_module+0xa6/0xd0
> > [76185.546047]  [<ffffffff816fc869>] system_call_fastpath+0x16/0x1b
> > [76185.547354] Code: 1d 00 00 85 ff 0f 8f 94 04 00 00 0f b6 93 bb 21 00 00 49 8b 87 68 03 00 00 48 89 de 48 c7 c7 08 75 4a a0 4c 8b 84 d0 a0 00 00 00 <49> 8b 00 4c 89 45 d0 48 8b 40 18 0f b6 40 02 0f b6 d0 66 89 93 
> > [76185.550208] RIP  [<ffffffffa048dec8>] cx231xx_usb_probe+0x5a8/0xb20 [cx231xx]
> > [76185.551613]  RSP <ffff88021866fb50>
> > [76185.553006] CR2: 0000000000000000
> > [76185.559997] ---[ end trace 1e58ef345d6b3f24 ]---
> > 
> 
> Is the order of the printk messages and of the oops message fixed? Are
> all messages printed before the oops also before the oops message?
> 
> It seems to oops is at cx231xx_usb_probe+0x5a8/0xb20.
> 
> > $ gdb drivers/media/usb/cx231xx/cx231xx.ko
> > GNU gdb (GDB) Fedora 7.7.1-15.fc20
> > Copyright (C) 2014 Free Software Foundation, Inc.
> > License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
> > This is free software: you are free to change and redistribute it.
> > There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
> [...]
> > Type "apropos word" to search for commands related to "word"...
> > Reading symbols from drivers/media/usb/cx231xx/cx231xx.ko...done.
> > (gdb) list *cx231xx_usb_driver_init+0x1e
> 
> Could you retry this with the offset from above (0x5a8).

(gdb) list *cx231xx_usb_probe+0x5a8
0x4ec8 is in cx231xx_usb_probe (drivers/media/usb/cx231xx/cx231xx-cards.c:1432).
1427		uif = udev->actconfig->interface[dev->current_pcb_config.
1428					       hs_config_info[0].interface_info.
1429					       vanc_index + 1];
1430	
1431		dev->vbi_mode.end_point_addr =
1432		    uif->altsetting[0].endpoint[isoc_pipe].desc.
1433				bEndpointAddress;
1434	
1435		dev->vbi_mode.num_alt = uif->num_altsetting;
1436		cx231xx_info("EndPoint Addr 0x%x, Alternate settings: %i\n",

> I normally use nm to get the base addr of the function, then add the
> offset and then run "addr2line -ispf -e cx231xx.ko -a 0x....."

Well, gdb is quicker, as it is just one command ;)

Regards,
Mauro
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
  
Mauro Carvalho Chehab July 27, 2014, 2:32 p.m. UTC | #4
Em Sun, 27 Jul 2014 10:44:53 -0300
Mauro Carvalho Chehab <m.chehab@samsung.com> escreveu:

> Em Sun, 27 Jul 2014 11:32:26 +0200
> Matthias Schwarzott <zzam@gentoo.org> escreveu:
> 
> > 
> > Hi Mauro.
> > 
> > On 26.07.2014 21:27, Mauro Carvalho Chehab wrote:
> > > Tried to apply your patch series, but there's something wrong on it.
> > > 
> > > See the enclosed logs. I suspect that you missed a patch adding the
> > > proper tuner for this device.
> > 
> > well, tuner_type is set to TUNER_ABSENT, and for me the oops does not
> > happen.
> > 
> > > [76185.463359] BUG: unable to handle kernel NULL pointer dereference at           (null)
> > > [76185.465295] IP: [<ffffffffa048dec8>] cx231xx_usb_probe+0x5a8/0xb20 [cx231xx]
> > > [76185.465654] cx231xx #0: can't change interface 5 alt no. to 0 (err=-22)
> > > [76185.465705] cx231xx #0: called cx231xx_uninit_vbi_isoc
> > > [76185.465707] cx231xx #0: cx231xx_stop_stream():: ep_mask = 10
> > > [76185.465872] cx231xx #0: can't change interface 5 alt no. to 0 (err=-22)
> > > [76185.474837] PGD 21c0fa067 PUD 2182b4067 PMD 0 
> > > [76185.476593] Oops: 0000 [#1] SMP 
> > > [76185.478285] Modules linked in: cx25840 cx231xx(+) cx2341x tveeprom videobuf_vmalloc videobuf_core rc_core v4l2_common videodev media ip6table_filter ip6_tables bnep nouveau x86_pkg_temp_thermal coretemp i915 binfmt_misc kvm_intel kvm ttm i2c_algo_bit drm_kms_helper vfat fat drm arc4 iwldvm mac80211 snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_codec_generic snd_hda_intel snd_hda_controller snd_hda_codec iwlwifi crct10dif_pclmul snd_hwdep crc32_pclmul cfg80211 snd_seq snd_seq_device snd_pcm crc32c_intel snd_timer btusb bluetooth iTCO_wdt iTCO_vendor_support mxm_wmi ghash_clmulni_intel lpc_ich i2c_i801 snd mei_me soundcore rfkill joydev serio_raw shpchp mei wmi mfd_core i2c_core video microcode r8169 mii [last unloaded: dvb_core]
> > > [76185.487219] CPU: 0 PID: 12079 Comm: modprobe Not tainted 3.16.0-rc6+ #12
> > > [76185.488936] Hardware name: SAMSUNG ELECTRONICS CO., LTD. 550P5C/550P7C/SAMSUNG_NP1234567890, BIOS P05ABI.016.130917.dg 09/17/2013
> > > [76185.490710] task: ffff880211172ee0 ti: ffff88021866c000 task.ti: ffff88021866c000
> > > [76185.492502] RIP: 0010:[<ffffffffa048dec8>]  [<ffffffffa048dec8>] cx231xx_usb_probe+0x5a8/0xb20 [cx231xx]
> > > [76185.494321] RSP: 0018:ffff88021866fb50  EFLAGS: 00010246
> > > [76185.496037] RAX: ffff88021c34fc00 RBX: ffff8800c4f70000 RCX: 0000000000000006
> > > [76185.497781] RDX: 0000000000000004 RSI: ffff8800c4f70000 RDI: ffffffffa04a7508
> > > [76185.499548] RBP: ffff88021866fb90 R08: 0000000000000000 R09: 00000000000011d3
> > > [76185.501323] R10: 0000000000000000 R11: ffff88021866f85e R12: ffff88021bc20800
> > > [76185.503119] R13: ffff88021bc27c00 R14: ffff8800c4f70168 R15: ffff8802229ca000
> > > [76185.504934] FS:  00007f6c13b2e740(0000) GS:ffff88022f200000(0000) knlGS:0000000000000000
> > > [76185.506662] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> > > [76185.508406] CR2: 0000000000000000 CR3: 00000002222b8000 CR4: 00000000001407f0
> > > [76185.510169] Stack:
> > > [76185.511921]  ffff88020000b131 ffffffff00000004 ffff880000000001 ffff8802229ca090
> > > [76185.513725]  ffff8802229ca000 ffffffffa04ab568 ffff88021bc27c30 ffffffffa04ab7a0
> > > [76185.515517]  ffff88021866fbd8 ffffffff814eefcf 000000001866fbb0 ffff88021bc27c00
> > > [76185.517248] Call Trace:
> > > [76185.518963]  [<ffffffff814eefcf>] usb_probe_interface+0x1df/0x330
> > > [76185.520714]  [<ffffffff8146605d>] driver_probe_device+0x12d/0x3d0
> > > [76185.522452]  [<ffffffff814663d3>] __driver_attach+0x93/0xa0
> > > [76185.524203]  [<ffffffff81466340>] ? __device_attach+0x40/0x40
> > > [76185.525959]  [<ffffffff81463f03>] bus_for_each_dev+0x73/0xc0
> > > [76185.527599]  [<ffffffff81465a5e>] driver_attach+0x1e/0x20
> > > [76185.529240]  [<ffffffff81465640>] bus_add_driver+0x180/0x250
> > > [76185.537278]  [<ffffffff81002144>] do_one_initcall+0xd4/0x210
> > > [76185.538809]  [<ffffffff811b5fd4>] ? __vunmap+0x94/0x100
> > > [76185.540330]  [<ffffffff81106767>] load_module+0x1ea7/0x24f0
> > > [76185.541806]  [<ffffffff81102370>] ? store_uevent+0x70/0x70
> > > [76185.543255]  [<ffffffff811f3200>] ? kernel_read+0x50/0x80
> > > [76185.544661]  [<ffffffff81106f66>] SyS_finit_module+0xa6/0xd0
> > > [76185.546047]  [<ffffffff816fc869>] system_call_fastpath+0x16/0x1b
> > > [76185.547354] Code: 1d 00 00 85 ff 0f 8f 94 04 00 00 0f b6 93 bb 21 00 00 49 8b 87 68 03 00 00 48 89 de 48 c7 c7 08 75 4a a0 4c 8b 84 d0 a0 00 00 00 <49> 8b 00 4c 89 45 d0 48 8b 40 18 0f b6 40 02 0f b6 d0 66 89 93 
> > > [76185.550208] RIP  [<ffffffffa048dec8>] cx231xx_usb_probe+0x5a8/0xb20 [cx231xx]
> > > [76185.551613]  RSP <ffff88021866fb50>
> > > [76185.553006] CR2: 0000000000000000
> > > [76185.559997] ---[ end trace 1e58ef345d6b3f24 ]---
> > > 
> > 
> > Is the order of the printk messages and of the oops message fixed? Are
> > all messages printed before the oops also before the oops message?
> > 
> > It seems to oops is at cx231xx_usb_probe+0x5a8/0xb20.
> > 
> > > $ gdb drivers/media/usb/cx231xx/cx231xx.ko
> > > GNU gdb (GDB) Fedora 7.7.1-15.fc20
> > > Copyright (C) 2014 Free Software Foundation, Inc.
> > > License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
> > > This is free software: you are free to change and redistribute it.
> > > There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
> > [...]
> > > Type "apropos word" to search for commands related to "word"...
> > > Reading symbols from drivers/media/usb/cx231xx/cx231xx.ko...done.
> > > (gdb) list *cx231xx_usb_driver_init+0x1e
> > 
> > Could you retry this with the offset from above (0x5a8).
> 
> (gdb) list *cx231xx_usb_probe+0x5a8
> 0x4ec8 is in cx231xx_usb_probe (drivers/media/usb/cx231xx/cx231xx-cards.c:1432).
> 1427		uif = udev->actconfig->interface[dev->current_pcb_config.
> 1428					       hs_config_info[0].interface_info.
> 1429					       vanc_index + 1];
> 1430	
> 1431		dev->vbi_mode.end_point_addr =
> 1432		    uif->altsetting[0].endpoint[isoc_pipe].desc.
> 1433				bEndpointAddress;
> 1434	
> 1435		dev->vbi_mode.num_alt = uif->num_altsetting;
> 1436		cx231xx_info("EndPoint Addr 0x%x, Alternate settings: %i\n",
> 
> > I normally use nm to get the base addr of the function, then add the
> > offset and then run "addr2line -ispf -e cx231xx.ko -a 0x....."
> 
> Well, gdb is quicker, as it is just one command ;)

I found the issue. there are just two interfaces on this device, but 
vanc_index is equal to 4 for this PCB. So, it tries to set VBI on
interface 5, with obviously fails.

It seems that the code is identifying a wrong PCB for this device.

That's said, the probe logic is doing a crap job by allowing to go
past the array.

Regards,
Mauro
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
  
Mauro Carvalho Chehab July 27, 2014, 2:59 p.m. UTC | #5
Em Sun, 27 Jul 2014 11:32:48 -0300
Mauro Carvalho Chehab <m.chehab@samsung.com> escreveu:

> Em Sun, 27 Jul 2014 10:44:53 -0300
> Mauro Carvalho Chehab <m.chehab@samsung.com> escreveu:
> 
> > Em Sun, 27 Jul 2014 11:32:26 +0200
> > Matthias Schwarzott <zzam@gentoo.org> escreveu:
> > 
> > > 
> > > Hi Mauro.
> > > 
> > > On 26.07.2014 21:27, Mauro Carvalho Chehab wrote:
> > > > Tried to apply your patch series, but there's something wrong on it.
> > > > 
> > > > See the enclosed logs. I suspect that you missed a patch adding the
> > > > proper tuner for this device.
> > > 
> > > well, tuner_type is set to TUNER_ABSENT, and for me the oops does not
> > > happen.
> > > 
> > > > [76185.463359] BUG: unable to handle kernel NULL pointer dereference at           (null)
> > > > [76185.465295] IP: [<ffffffffa048dec8>] cx231xx_usb_probe+0x5a8/0xb20 [cx231xx]
> > > > [76185.465654] cx231xx #0: can't change interface 5 alt no. to 0 (err=-22)
> > > > [76185.465705] cx231xx #0: called cx231xx_uninit_vbi_isoc
> > > > [76185.465707] cx231xx #0: cx231xx_stop_stream():: ep_mask = 10
> > > > [76185.465872] cx231xx #0: can't change interface 5 alt no. to 0 (err=-22)
> > > > [76185.474837] PGD 21c0fa067 PUD 2182b4067 PMD 0 
> > > > [76185.476593] Oops: 0000 [#1] SMP 
> > > > [76185.478285] Modules linked in: cx25840 cx231xx(+) cx2341x tveeprom videobuf_vmalloc videobuf_core rc_core v4l2_common videodev media ip6table_filter ip6_tables bnep nouveau x86_pkg_temp_thermal coretemp i915 binfmt_misc kvm_intel kvm ttm i2c_algo_bit drm_kms_helper vfat fat drm arc4 iwldvm mac80211 snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_codec_generic snd_hda_intel snd_hda_controller snd_hda_codec iwlwifi crct10dif_pclmul snd_hwdep crc32_pclmul cfg80211 snd_seq snd_seq_device snd_pcm crc32c_intel snd_timer btusb bluetooth iTCO_wdt iTCO_vendor_support mxm_wmi ghash_clmulni_intel lpc_ich i2c_i801 snd mei_me soundcore rfkill joydev serio_raw shpchp mei wmi mfd_core i2c_core video microcode r8169 mii [last unloaded: dvb_core]
> > > > [76185.487219] CPU: 0 PID: 12079 Comm: modprobe Not tainted 3.16.0-rc6+ #12
> > > > [76185.488936] Hardware name: SAMSUNG ELECTRONICS CO., LTD. 550P5C/550P7C/SAMSUNG_NP1234567890, BIOS P05ABI.016.130917.dg 09/17/2013
> > > > [76185.490710] task: ffff880211172ee0 ti: ffff88021866c000 task.ti: ffff88021866c000
> > > > [76185.492502] RIP: 0010:[<ffffffffa048dec8>]  [<ffffffffa048dec8>] cx231xx_usb_probe+0x5a8/0xb20 [cx231xx]
> > > > [76185.494321] RSP: 0018:ffff88021866fb50  EFLAGS: 00010246
> > > > [76185.496037] RAX: ffff88021c34fc00 RBX: ffff8800c4f70000 RCX: 0000000000000006
> > > > [76185.497781] RDX: 0000000000000004 RSI: ffff8800c4f70000 RDI: ffffffffa04a7508
> > > > [76185.499548] RBP: ffff88021866fb90 R08: 0000000000000000 R09: 00000000000011d3
> > > > [76185.501323] R10: 0000000000000000 R11: ffff88021866f85e R12: ffff88021bc20800
> > > > [76185.503119] R13: ffff88021bc27c00 R14: ffff8800c4f70168 R15: ffff8802229ca000
> > > > [76185.504934] FS:  00007f6c13b2e740(0000) GS:ffff88022f200000(0000) knlGS:0000000000000000
> > > > [76185.506662] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> > > > [76185.508406] CR2: 0000000000000000 CR3: 00000002222b8000 CR4: 00000000001407f0
> > > > [76185.510169] Stack:
> > > > [76185.511921]  ffff88020000b131 ffffffff00000004 ffff880000000001 ffff8802229ca090
> > > > [76185.513725]  ffff8802229ca000 ffffffffa04ab568 ffff88021bc27c30 ffffffffa04ab7a0
> > > > [76185.515517]  ffff88021866fbd8 ffffffff814eefcf 000000001866fbb0 ffff88021bc27c00
> > > > [76185.517248] Call Trace:
> > > > [76185.518963]  [<ffffffff814eefcf>] usb_probe_interface+0x1df/0x330
> > > > [76185.520714]  [<ffffffff8146605d>] driver_probe_device+0x12d/0x3d0
> > > > [76185.522452]  [<ffffffff814663d3>] __driver_attach+0x93/0xa0
> > > > [76185.524203]  [<ffffffff81466340>] ? __device_attach+0x40/0x40
> > > > [76185.525959]  [<ffffffff81463f03>] bus_for_each_dev+0x73/0xc0
> > > > [76185.527599]  [<ffffffff81465a5e>] driver_attach+0x1e/0x20
> > > > [76185.529240]  [<ffffffff81465640>] bus_add_driver+0x180/0x250
> > > > [76185.537278]  [<ffffffff81002144>] do_one_initcall+0xd4/0x210
> > > > [76185.538809]  [<ffffffff811b5fd4>] ? __vunmap+0x94/0x100
> > > > [76185.540330]  [<ffffffff81106767>] load_module+0x1ea7/0x24f0
> > > > [76185.541806]  [<ffffffff81102370>] ? store_uevent+0x70/0x70
> > > > [76185.543255]  [<ffffffff811f3200>] ? kernel_read+0x50/0x80
> > > > [76185.544661]  [<ffffffff81106f66>] SyS_finit_module+0xa6/0xd0
> > > > [76185.546047]  [<ffffffff816fc869>] system_call_fastpath+0x16/0x1b
> > > > [76185.547354] Code: 1d 00 00 85 ff 0f 8f 94 04 00 00 0f b6 93 bb 21 00 00 49 8b 87 68 03 00 00 48 89 de 48 c7 c7 08 75 4a a0 4c 8b 84 d0 a0 00 00 00 <49> 8b 00 4c 89 45 d0 48 8b 40 18 0f b6 40 02 0f b6 d0 66 89 93 
> > > > [76185.550208] RIP  [<ffffffffa048dec8>] cx231xx_usb_probe+0x5a8/0xb20 [cx231xx]
> > > > [76185.551613]  RSP <ffff88021866fb50>
> > > > [76185.553006] CR2: 0000000000000000
> > > > [76185.559997] ---[ end trace 1e58ef345d6b3f24 ]---
> > > > 
> > > 
> > > Is the order of the printk messages and of the oops message fixed? Are
> > > all messages printed before the oops also before the oops message?
> > > 
> > > It seems to oops is at cx231xx_usb_probe+0x5a8/0xb20.
> > > 
> > > > $ gdb drivers/media/usb/cx231xx/cx231xx.ko
> > > > GNU gdb (GDB) Fedora 7.7.1-15.fc20
> > > > Copyright (C) 2014 Free Software Foundation, Inc.
> > > > License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
> > > > This is free software: you are free to change and redistribute it.
> > > > There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
> > > [...]
> > > > Type "apropos word" to search for commands related to "word"...
> > > > Reading symbols from drivers/media/usb/cx231xx/cx231xx.ko...done.
> > > > (gdb) list *cx231xx_usb_driver_init+0x1e
> > > 
> > > Could you retry this with the offset from above (0x5a8).
> > 
> > (gdb) list *cx231xx_usb_probe+0x5a8
> > 0x4ec8 is in cx231xx_usb_probe (drivers/media/usb/cx231xx/cx231xx-cards.c:1432).
> > 1427		uif = udev->actconfig->interface[dev->current_pcb_config.
> > 1428					       hs_config_info[0].interface_info.
> > 1429					       vanc_index + 1];
> > 1430	
> > 1431		dev->vbi_mode.end_point_addr =
> > 1432		    uif->altsetting[0].endpoint[isoc_pipe].desc.
> > 1433				bEndpointAddress;
> > 1434	
> > 1435		dev->vbi_mode.num_alt = uif->num_altsetting;
> > 1436		cx231xx_info("EndPoint Addr 0x%x, Alternate settings: %i\n",
> > 
> > > I normally use nm to get the base addr of the function, then add the
> > > offset and then run "addr2line -ispf -e cx231xx.ko -a 0x....."
> > 
> > Well, gdb is quicker, as it is just one command ;)
> 
> I found the issue. there are just two interfaces on this device, but 

Actually there are 4 interfaces. Still, 5 is out of the array.

> vanc_index is equal to 4 for this PCB. So, it tries to set VBI on
> interface 5, with obviously fails.
> 
> It seems that the code is identifying a wrong PCB for this device.
> 
> That's said, the probe logic is doing a crap job by allowing to go
> past the array.

Just sent a patch detecting this condition and aborting the probe.
That solved the OOPS, but, of course, the device doesn't work.

See the logs.

[  326.546032] usb 3-4: new full-speed USB device number 2 using xhci_hcd
[  326.710374] usb 3-4: not running at top speed; connect to a high speed hub
[  326.713276] usb 3-4: New USB device found, idVendor=2040, idProduct=b131
[  326.713284] usb 3-4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  326.713288] usb 3-4: Product: Hauppauge Device
[  326.713291] usb 3-4: Manufacturer: Hauppauge
[  326.713294] usb 3-4: SerialNumber: 4035169112
[  326.770414] cx231xx #0: New device Hauppauge Hauppauge Device @ 12 Mbps (2040:b131) with 4 interfaces
[  326.770420] cx231xx #0: registering interface 1
[  326.770499] cx231xx #0: Identified as Hauppauge WinTV 930C-HD (1114xx) / PCTV QuatroStick 522e (card=20)
[  326.871215] cx231xx #0: cx231xx_dif_set_standard: setStandard to ffffffff
[  326.879356] cx231xx #0: can't change interface 5 alt no. to 0 (err=-22)
[  326.879363] cx231xx #0: can't change interface 6 alt no. to 0 (err=-22)
[  326.890080] cx25840 19-0044: cx23102 A/V decoder found @ 0x88 (cx231xx #0)
[  326.909307] cx25840 19-0044:  Firmware download size changed to 16 bytes max length
[  328.991008] cx25840 19-0044: loaded v4l-cx231xx-avcore-01.fw firmware (16382 bytes)
[  329.028463] cx231xx #0: Changing the i2c master port to 1
[  329.060338] cx231xx #0: Changing the i2c master port to 3
[  329.060404] cx231xx #0: i2c eeprom 00: 40 20 31 b1 aa 00 00 01 10 00 50 00 30 00 ff ff
[  329.060410] cx231xx #0: i2c eeprom 10: 14 03 48 00 61 00 75 00 70 00 70 00 61 00 75 00
[  329.060413] cx231xx #0: i2c eeprom 20: 67 00 65 00 00 00 00 00 00 00 00 00 00 00 00 00
[  329.060416] cx231xx #0: i2c eeprom 30: 16 03 34 00 30 00 33 00 35 00 31 00 36 00 39 00
[  329.060419] cx231xx #0: i2c eeprom 40: 31 00 31 00 32 00 00 00 ff ff ff ff ff ff ff ff
[  329.060423] cx231xx #0: i2c eeprom 50: 22 03 48 00 61 00 75 00 70 00 70 00 61 00 75 00
[  329.060426] cx231xx #0: i2c eeprom 60: 67 00 65 00 20 00 44 00 65 00 76 00 69 00 63 00
[  329.060429] cx231xx #0: i2c eeprom 70: 65 00 ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[  329.060433] cx231xx #0: i2c eeprom 80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[  329.060436] cx231xx #0: i2c eeprom 90: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[  329.060440] cx231xx #0: i2c eeprom a0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[  329.060444] cx231xx #0: i2c eeprom b0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[  329.060447] cx231xx #0: i2c eeprom c0: 84 09 00 04 20 77 00 40 58 cb 83 f0 73 05 2f 00
[  329.060450] cx231xx #0: i2c eeprom d0: 84 08 00 06 3b b3 01 00 56 2a 95 72 07 70 73 09
[  329.060453] cx231xx #0: i2c eeprom e0: 2e 7f 73 0a f4 ba 72 0b 13 72 0f 05 72 10 01 72
[  329.060457] cx231xx #0: i2c eeprom f0: 11 1f 73 13 eb 79 79 ea 00 00 00 00 00 00 00 00
[  329.060464] tveeprom 20-0000: Hauppauge model 111419, rev E2I6, serial# 8637272
[  329.060470] tveeprom 20-0000: MAC address is 00:0d:fe:83:cb:58
[  329.060474] tveeprom 20-0000: tuner model is unknown (idx 186, type 4)
[  329.060479] tveeprom 20-0000: TV standards PAL(B/G) PAL(I) SECAM(L/L') PAL(D/D1/K) ATSC/DVB Digital (eeprom 0xf4)
[  329.060483] tveeprom 20-0000: audio processor is unknown (idx 47)
[  329.060486] tveeprom 20-0000: decoder processor is unknown (idx 46)
[  329.060490] tveeprom 20-0000: has no radio, has IR receiver, has no IR transmitter
[  329.061545] cx231xx #0: cx231xx #0: v4l2 driver version 0.0.2
[  329.078247] cx231xx #0: cx231xx_dif_set_standard: setStandard to ffffffff
[  329.116882] Unknown tuner type configuring SIF
[  329.118011] cx231xx #0: video_mux : 0
[  329.118043] cx231xx #0: do_mode_ctrl_overrides : 0xff
[  329.118802] cx231xx #0: do_mode_ctrl_overrides PAL
[  329.145116] cx231xx #0: cx231xx #0/0: registered device video1 [v4l2]
[  329.145290] cx231xx #0: cx231xx #0/0: registered device vbi0
[  329.145294] cx231xx #0: V4L2 device registered as video1 and vbi0
[  329.145296] cx231xx #0: Video PCB interface #4 doesn't exist
[  329.145372] usbcore: registered new interface driver cx231xx
[  329.148408] cx231xx #0:  setPowerMode::mode = 32, No Change req.
[  329.148418] usb 3-4: selecting invalid altsetting 3
[  329.148421] cx231xx #0: cannot change alt number to 3 (error=-22)
[  329.149508] cx231xx #0: can't change interface 5 alt no. to 0 (err=-22)
[  329.149570] cx231xx #0: called cx231xx_uninit_vbi_isoc
[  329.149574] cx231xx #0: cx231xx_stop_stream():: ep_mask = 10
[  329.149721] cx231xx #0: can't change interface 5 alt no. to 0 (err=-22)



> 
> Regards,
> Mauro
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
  
Mauro Carvalho Chehab July 27, 2014, 7:42 p.m. UTC | #6
Em Sun, 27 Jul 2014 11:59:11 -0300
Mauro Carvalho Chehab <m.chehab@samsung.com> escreveu:

> Em Sun, 27 Jul 2014 11:32:48 -0300
> Mauro Carvalho Chehab <m.chehab@samsung.com> escreveu:
> 
> > Em Sun, 27 Jul 2014 10:44:53 -0300
> > Mauro Carvalho Chehab <m.chehab@samsung.com> escreveu:
> > 
> > > Em Sun, 27 Jul 2014 11:32:26 +0200
> > > Matthias Schwarzott <zzam@gentoo.org> escreveu:
> > > 
> > > > 
> > > > Hi Mauro.
> > > > 
> > > > On 26.07.2014 21:27, Mauro Carvalho Chehab wrote:
> > > > > Tried to apply your patch series, but there's something wrong on it.
> > > > > 
> > > > > See the enclosed logs. I suspect that you missed a patch adding the
> > > > > proper tuner for this device.

The hole issue was due to that:
> [  326.770414] cx231xx #0: New device Hauppauge Hauppauge Device @ 12 Mbps (2040:b131) with 4 interfaces

The root cause seems to be a bad USB cable, causing errors at USB
detection.

Just send a patch series that avoids the driver to OOPS in such
case.

Regards,
Mauro
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
  
Matthias Schwarzott July 29, 2014, 5:39 a.m. UTC | #7
On 27.07.2014 21:42, Mauro Carvalho Chehab wrote:
> Em Sun, 27 Jul 2014 11:59:11 -0300
> Mauro Carvalho Chehab <m.chehab@samsung.com> escreveu:
> 
>> Em Sun, 27 Jul 2014 11:32:48 -0300
>> Mauro Carvalho Chehab <m.chehab@samsung.com> escreveu:
>>
>>> Em Sun, 27 Jul 2014 10:44:53 -0300
>>> Mauro Carvalho Chehab <m.chehab@samsung.com> escreveu:
>>>
>>>> Em Sun, 27 Jul 2014 11:32:26 +0200
>>>> Matthias Schwarzott <zzam@gentoo.org> escreveu:
>>>>
>>>>>
>>>>> Hi Mauro.
>>>>>
>>>>> On 26.07.2014 21:27, Mauro Carvalho Chehab wrote:
>>>>>> Tried to apply your patch series, but there's something wrong on it.
>>>>>>
>>>>>> See the enclosed logs. I suspect that you missed a patch adding the
>>>>>> proper tuner for this device.
> 
> The hole issue was due to that:
>> [  326.770414] cx231xx #0: New device Hauppauge Hauppauge Device @ 12 Mbps (2040:b131) with 4 interfaces
> 
> The root cause seems to be a bad USB cable, causing errors at USB
> detection.
> 
> Just send a patch series that avoids the driver to OOPS in such
> case.
> 

Ah, now I understand why this specific device did not work.
Nice errors that can be triggered by faulty hardware.

Regards
Matthias

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
  

Patch

diff --git a/drivers/media/usb/cx231xx/Kconfig b/drivers/media/usb/cx231xx/Kconfig
index 036454e..569aa29 100644
--- a/drivers/media/usb/cx231xx/Kconfig
+++ b/drivers/media/usb/cx231xx/Kconfig
@@ -48,6 +48,7 @@  config VIDEO_CX231XX_DVB
 	select DVB_LGDT3305 if MEDIA_SUBDRV_AUTOSELECT
 	select DVB_TDA18271C2DD if MEDIA_SUBDRV_AUTOSELECT
 	select DVB_SI2165 if MEDIA_SUBDRV_AUTOSELECT
+	select MEDIA_TUNER_SI2157 if MEDIA_SUBDRV_AUTOSELECT
 
 	---help---
 	  This adds support for DVB cards based on the
diff --git a/drivers/media/usb/cx231xx/cx231xx-cards.c b/drivers/media/usb/cx231xx/cx231xx-cards.c
index 8b80f88..8857fdd 100644
--- a/drivers/media/usb/cx231xx/cx231xx-cards.c
+++ b/drivers/media/usb/cx231xx/cx231xx-cards.c
@@ -743,6 +743,45 @@  struct cx231xx_board cx231xx_boards[] = {
 			.gpio = NULL,
 		} },
 	},
+	[CX231XX_BOARD_HAUPPAUGE_930C_HD_1114xx] = {
+		.name = "Hauppauge WinTV 930C-HD (1114xx)",
+		.tuner_type = TUNER_ABSENT,
+		.tuner_addr = 0x60,
+		.tuner_gpio = RDE250_XCV_TUNER,
+		.tuner_sif_gpio = 0x05,
+		.tuner_scl_gpio = 0x1a,
+		.tuner_sda_gpio = 0x1b,
+		.decoder = CX231XX_AVDECODER,
+		.output_mode = OUT_MODE_VIP11,
+		.demod_xfer_mode = 0,
+		.ctl_pin_status_mask = 0xFFFFFFC4,
+		.agc_analog_digital_select_gpio = 0x0c,
+		.gpio_pin_status_mask = 0x4001000,
+		.tuner_i2c_master = 1,
+		.demod_i2c_master = 2,
+		.has_dvb = 1,
+		.demod_addr = 0x0e,
+		.norm = V4L2_STD_PAL,
+
+		.input = {{
+			.type = CX231XX_VMUX_TELEVISION,
+			.vmux = CX231XX_VIN_3_1,
+			.amux = CX231XX_AMUX_VIDEO,
+			.gpio = NULL,
+		}, {
+			.type = CX231XX_VMUX_COMPOSITE1,
+			.vmux = CX231XX_VIN_2_1,
+			.amux = CX231XX_AMUX_LINE_IN,
+			.gpio = NULL,
+		}, {
+			.type = CX231XX_VMUX_SVIDEO,
+			.vmux = CX231XX_VIN_1_1 |
+				(CX231XX_VIN_1_2 << 8) |
+				CX25840_SVIDEO_ON,
+			.amux = CX231XX_AMUX_LINE_IN,
+			.gpio = NULL,
+		} },
+	},
 };
 const unsigned int cx231xx_bcount = ARRAY_SIZE(cx231xx_boards);
 
@@ -774,6 +813,8 @@  struct usb_device_id cx231xx_id_table[] = {
 	 .driver_info = CX231XX_BOARD_HAUPPAUGE_EXETER},
 	{USB_DEVICE(0x2040, 0xb130),
 	 .driver_info = CX231XX_BOARD_HAUPPAUGE_930C_HD_1113xx},
+	{USB_DEVICE(0x2040, 0xb131),
+	 .driver_info = CX231XX_BOARD_HAUPPAUGE_930C_HD_1114xx},
 	{USB_DEVICE(0x2040, 0xb140),
 	 .driver_info = CX231XX_BOARD_HAUPPAUGE_EXETER},
 	{USB_DEVICE(0x2040, 0xc200),
@@ -998,6 +1039,7 @@  void cx231xx_card_setup(struct cx231xx *dev)
 
 	switch (dev->model) {
 	case CX231XX_BOARD_HAUPPAUGE_930C_HD_1113xx:
+	case CX231XX_BOARD_HAUPPAUGE_930C_HD_1114xx:
 		{
 			struct tveeprom tvee;
 			static u8 eeprom[256];
diff --git a/drivers/media/usb/cx231xx/cx231xx-dvb.c b/drivers/media/usb/cx231xx/cx231xx-dvb.c
index 4ff6f7f..1fa7974 100644
--- a/drivers/media/usb/cx231xx/cx231xx-dvb.c
+++ b/drivers/media/usb/cx231xx/cx231xx-dvb.c
@@ -34,6 +34,7 @@ 
 #include "lgdt3305.h"
 #include "si2165.h"
 #include "mb86a20s.h"
+#include "si2157.h"
 
 MODULE_DESCRIPTION("driver for cx231xx based DVB cards");
 MODULE_AUTHOR("Srinivasa Deevi <srinivasa.deevi@conexant.com>");
@@ -159,6 +160,12 @@  static const struct si2165_config hauppauge_930C_HD_1113xx_si2165_config = {
 	.ref_freq_Hz	= 16000000,
 };
 
+static const struct si2165_config pctv_quatro_stick_1114xx_si2165_config = {
+	.i2c_addr	= 0x64,
+	.chip_mode	= SI2165_MODE_PLL_EXT,
+	.ref_freq_Hz	= 24000000,
+};
+
 static inline void print_err_status(struct cx231xx *dev, int packet, int status)
 {
 	char *errmsg = "Unknown";
@@ -746,6 +753,62 @@  static int dvb_init(struct cx231xx *dev)
 		dev->cx231xx_reset_analog_tuner = NULL;
 		break;
 
+	case CX231XX_BOARD_HAUPPAUGE_930C_HD_1114xx:
+	{
+		struct i2c_client *client;
+		struct i2c_board_info info;
+		struct si2157_config si2157_config;
+
+		memset(&info, 0, sizeof(struct i2c_board_info));
+
+		dev->dvb->frontend = dvb_attach(si2165_attach,
+			&pctv_quatro_stick_1114xx_si2165_config,
+			&dev->i2c_bus[dev->board.tuner_i2c_master].i2c_adap
+			);
+
+		if (dev->dvb->frontend == NULL) {
+			printk(DRIVER_NAME
+			       ": Failed to attach SI2165 front end\n");
+			result = -EINVAL;
+			goto out_free;
+		}
+
+		dev->dvb->frontend->ops.i2c_gate_ctrl = 0;
+
+		/* define general-purpose callback pointer */
+		dvb->frontend->callback = cx231xx_tuner_callback;
+
+		/* attach tuner */
+		memset(&si2157_config, 0, sizeof(si2157_config));
+		si2157_config.fe = dev->dvb->frontend;
+		si2157_config.inversion = true;
+		strlcpy(info.type, "si2157", I2C_NAME_SIZE);
+		info.addr = 0x60;
+		info.platform_data = &si2157_config;
+		request_module("si2157");
+
+		client = i2c_new_device(
+			&dev->i2c_bus[dev->board.tuner_i2c_master].i2c_adap,
+			&info);
+		if (client == NULL || client->dev.driver == NULL) {
+			dvb_frontend_detach(dev->dvb->frontend);
+			result = -ENODEV;
+			goto out_free;
+		}
+
+		if (!try_module_get(client->dev.driver->owner)) {
+			i2c_unregister_device(client);
+			dvb_frontend_detach(dev->dvb->frontend);
+			result = -ENODEV;
+			goto out_free;
+		}
+
+		dev->cx231xx_reset_analog_tuner = NULL;
+
+		dev->dvb->i2c_client_tuner = client;
+		break;
+	}
+
 	case CX231XX_BOARD_PV_PLAYTV_USB_HYBRID:
 	case CX231XX_BOARD_KWORLD_UB430_USB_HYBRID:
 
diff --git a/drivers/media/usb/cx231xx/cx231xx.h b/drivers/media/usb/cx231xx/cx231xx.h
index a6373ba..aeb1bf4 100644
--- a/drivers/media/usb/cx231xx/cx231xx.h
+++ b/drivers/media/usb/cx231xx/cx231xx.h
@@ -74,6 +74,7 @@ 
 #define CX231XX_BOARD_OTG102 17
 #define CX231XX_BOARD_KWORLD_UB445_USB_HYBRID 18
 #define CX231XX_BOARD_HAUPPAUGE_930C_HD_1113xx 19
+#define CX231XX_BOARD_HAUPPAUGE_930C_HD_1114xx 20
 
 /* Limits minimum and default number of buffers */
 #define CX231XX_MIN_BUF                 4