diff mbox

em28xx: add support for Hauppauge WinTV-dualHD DVB tuner

Message ID 1459782772-21451-1-git-send-email-olli.salonen@iki.fi (mailing list archive)
State New, archived
Headers show

Commit Message

Olli Salonen April 4, 2016, 3:12 p.m. UTC
Hauppauge WinTV-dualHD is a USB 2.0 dual DVB-T/T2/C tuner with
following components:

USB bridge: Empia EM28274 (chip id is the same as EM28174)
Demodulator: 2x Silicon Labs Si2168-B40
Tuner: 2x Silicon Labs Si2157-A30

This patch adds support only for the first tuner.

The demodulator needs firmware, available for example here:
http://palosaari.fi/linux/v4l-dvb/firmware/Si2168/Si2168-B40/4.0.11/

The demodulators sit on the same I2C bus and their addresses
are 0x64 and 0x67. The tuners are behind the demodulators and
their addresses are 0x60 and 0x63.

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
---
 Documentation/video4linux/CARDLIST.em28xx |  1 +
 drivers/media/usb/em28xx/em28xx-cards.c   | 54 ++++++++++++++++++++++++++
 drivers/media/usb/em28xx/em28xx-dvb.c     | 64 +++++++++++++++++++++++++++++++
 drivers/media/usb/em28xx/em28xx-reg.h     | 13 +++++++
 drivers/media/usb/em28xx/em28xx.h         |  2 +
 5 files changed, 134 insertions(+)

Comments

Christian Steiner April 10, 2016, 3:23 p.m. UTC | #1
On 04.04.2016 17:12, Olli Salonen wrote:
> Hauppauge WinTV-dualHD is a USB 2.0 dual DVB-T/T2/C tuner with
> following components:
> 
> USB bridge: Empia EM28274 (chip id is the same as EM28174)
> Demodulator: 2x Silicon Labs Si2168-B40
> Tuner: 2x Silicon Labs Si2157-A30
> 
> This patch adds support only for the first tuner.
> 
> [...]

Thank you very much!
Works fine for me:

> [  419.413188] em28xx: New device HCW dualHD @ 480 Mbps (2040:0265, interface 0, class 0)
> [  419.413195] em28xx: DVB interface 0 found: isoc
> [  419.413265] em28xx: chip ID is em28174
> [  420.529619] em28174 #0: EEPROM ID = 26 00 01 00, EEPROM hash = 0x7addc1c8
> [  420.529626] em28174 #0: EEPROM info:
> [  420.529630] em28174 #0:      microcode start address = 0x0004, boot configuration = 0x01
> [  420.536077] em28174 #0:      AC97 audio (5 sample rates)
> [  420.536084] em28174 #0:      500mA max power
> [  420.536089] em28174 #0:      Table at offset 0x27, strings=0x0e6a, 0x1888, 0x087e
> [  420.536188] em28174 #0: Identified as Hauppauge WinTV-dualHD DVB (card=98)
> [  420.537974] tveeprom 8-0050: Hauppauge model 204109, rev B2I6, serial# 11XXXXXX
> [  420.537981] tveeprom 8-0050: tuner model is SiLabs Si2157 (idx 186, type 4)
> [  420.537986] tveeprom 8-0050: TV standards PAL(B/G) NTSC(M) PAL(I) SECAM(L/L') PAL(D/D1/K) ATSC/DVB Digital (eeprom 0xfc)
> [  420.537989] tveeprom 8-0050: audio processor is None (idx 0)
> [  420.537993] tveeprom 8-0050: has no radio, has IR receiver, has no IR transmitter
> [  420.537997] em28174 #0: dvb set to isoc mode.
> [  420.538056] usbcore: registered new interface driver em28xx
> [  420.541087] em28174 #0: Binding DVB extension
> [  420.544008] i2c i2c-8: Added multiplexed i2c bus 9
> [  420.544016] si2168 8-0064: Silicon Labs Si2168 successfully attached
> [  420.548372] si2157 9-0060: Silicon Labs Si2147/2148/2157/2158 successfully attached
> [  420.548389] DVB: registering new adapter (em28174 #0)
> [  420.548396] usb 2-2: DVB: registering adapter 0 frontend 0 (Silicon Labs Si2168)...
> [  420.549737] em28174 #0: DVB extension successfully initialized
> [  420.549743] em28xx: Registered (Em28xx dvb Extension) extension
> [  435.418798] si2168 8-0064: found a 'Silicon Labs Si2168-B40'
> [  435.418823] si2168 8-0064: downloading firmware from file 'dvb-demod-si2168-b40-01.fw'
> [  435.617181] si2168 8-0064: firmware version: 4.0.11
> [  435.619791] si2157 9-0060: found a 'Silicon Labs Si2157-A30'
> [  435.642006] si2157 9-0060: firmware version: 3.0.5

(I have replaced the last digits of the serial number with X)

Is there any chance to add support for the second tuner, too?
This would be awesome.

Best,
Christian

--
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
Christian Steiner April 10, 2016, 3:23 p.m. UTC | #2
On 04.04.2016 17:12, Olli Salonen wrote:
> Hauppauge WinTV-dualHD is a USB 2.0 dual DVB-T/T2/C tuner with
> following components:
> 
> USB bridge: Empia EM28274 (chip id is the same as EM28174)
> Demodulator: 2x Silicon Labs Si2168-B40
> Tuner: 2x Silicon Labs Si2157-A30
> 
> This patch adds support only for the first tuner.
> 
> [...]

Thank you very much!
Works fine for me:

> [  419.413188] em28xx: New device HCW dualHD @ 480 Mbps (2040:0265, interface 0, class 0)
> [  419.413195] em28xx: DVB interface 0 found: isoc
> [  419.413265] em28xx: chip ID is em28174
> [  420.529619] em28174 #0: EEPROM ID = 26 00 01 00, EEPROM hash = 0x7addc1c8
> [  420.529626] em28174 #0: EEPROM info:
> [  420.529630] em28174 #0:      microcode start address = 0x0004, boot configuration = 0x01
> [  420.536077] em28174 #0:      AC97 audio (5 sample rates)
> [  420.536084] em28174 #0:      500mA max power
> [  420.536089] em28174 #0:      Table at offset 0x27, strings=0x0e6a, 0x1888, 0x087e
> [  420.536188] em28174 #0: Identified as Hauppauge WinTV-dualHD DVB (card=98)
> [  420.537974] tveeprom 8-0050: Hauppauge model 204109, rev B2I6, serial# 11XXXXXX
> [  420.537981] tveeprom 8-0050: tuner model is SiLabs Si2157 (idx 186, type 4)
> [  420.537986] tveeprom 8-0050: TV standards PAL(B/G) NTSC(M) PAL(I) SECAM(L/L') PAL(D/D1/K) ATSC/DVB Digital (eeprom 0xfc)
> [  420.537989] tveeprom 8-0050: audio processor is None (idx 0)
> [  420.537993] tveeprom 8-0050: has no radio, has IR receiver, has no IR transmitter
> [  420.537997] em28174 #0: dvb set to isoc mode.
> [  420.538056] usbcore: registered new interface driver em28xx
> [  420.541087] em28174 #0: Binding DVB extension
> [  420.544008] i2c i2c-8: Added multiplexed i2c bus 9
> [  420.544016] si2168 8-0064: Silicon Labs Si2168 successfully attached
> [  420.548372] si2157 9-0060: Silicon Labs Si2147/2148/2157/2158 successfully attached
> [  420.548389] DVB: registering new adapter (em28174 #0)
> [  420.548396] usb 2-2: DVB: registering adapter 0 frontend 0 (Silicon Labs Si2168)...
> [  420.549737] em28174 #0: DVB extension successfully initialized
> [  420.549743] em28xx: Registered (Em28xx dvb Extension) extension
> [  435.418798] si2168 8-0064: found a 'Silicon Labs Si2168-B40'
> [  435.418823] si2168 8-0064: downloading firmware from file 'dvb-demod-si2168-b40-01.fw'
> [  435.617181] si2168 8-0064: firmware version: 4.0.11
> [  435.619791] si2157 9-0060: found a 'Silicon Labs Si2157-A30'
> [  435.642006] si2157 9-0060: firmware version: 3.0.5

(I have replaced the last digits of the serial number with X)

Is there any chance to add support for the second tuner, too?
This would be awesome.

Best,
Christian
--
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
Olli Salonen April 11, 2016, 9:14 a.m. UTC | #3
Hi Christian,

Thanks for reporting back your experience. Certainly there's a chance
of supporting the second tuner too. There are still two issues that I
have not solved:

1. I haven't gotten the 2nd tuner working yet (alone, without the
first tuner), even if I think all the pieces of the puzzle are there.
2. em28xx driver is built with one tuner in mind and needs significant
structural changes. If there's anyone very familiar with the em28xx
driver here, I'd be happy to hear your idea of what is entailed for
this.

Cheers,
-olli

On 10 April 2016 at 18:23, Christian Steiner
<christian.steiner@outlook.de> wrote:
>
> On 04.04.2016 17:12, Olli Salonen wrote:
> > Hauppauge WinTV-dualHD is a USB 2.0 dual DVB-T/T2/C tuner with
> > following components:
> >
> > USB bridge: Empia EM28274 (chip id is the same as EM28174)
> > Demodulator: 2x Silicon Labs Si2168-B40
> > Tuner: 2x Silicon Labs Si2157-A30
> >
> > This patch adds support only for the first tuner.
> >
> > [...]
>
> Thank you very much!
> Works fine for me:
>
> > [  419.413188] em28xx: New device HCW dualHD @ 480 Mbps (2040:0265, interface 0, class 0)
> > [  419.413195] em28xx: DVB interface 0 found: isoc
> > [  419.413265] em28xx: chip ID is em28174
> > [  420.529619] em28174 #0: EEPROM ID = 26 00 01 00, EEPROM hash = 0x7addc1c8
> > [  420.529626] em28174 #0: EEPROM info:
> > [  420.529630] em28174 #0:      microcode start address = 0x0004, boot configuration = 0x01
> > [  420.536077] em28174 #0:      AC97 audio (5 sample rates)
> > [  420.536084] em28174 #0:      500mA max power
> > [  420.536089] em28174 #0:      Table at offset 0x27, strings=0x0e6a, 0x1888, 0x087e
> > [  420.536188] em28174 #0: Identified as Hauppauge WinTV-dualHD DVB (card=98)
> > [  420.537974] tveeprom 8-0050: Hauppauge model 204109, rev B2I6, serial# 11XXXXXX
> > [  420.537981] tveeprom 8-0050: tuner model is SiLabs Si2157 (idx 186, type 4)
> > [  420.537986] tveeprom 8-0050: TV standards PAL(B/G) NTSC(M) PAL(I) SECAM(L/L') PAL(D/D1/K) ATSC/DVB Digital (eeprom 0xfc)
> > [  420.537989] tveeprom 8-0050: audio processor is None (idx 0)
> > [  420.537993] tveeprom 8-0050: has no radio, has IR receiver, has no IR transmitter
> > [  420.537997] em28174 #0: dvb set to isoc mode.
> > [  420.538056] usbcore: registered new interface driver em28xx
> > [  420.541087] em28174 #0: Binding DVB extension
> > [  420.544008] i2c i2c-8: Added multiplexed i2c bus 9
> > [  420.544016] si2168 8-0064: Silicon Labs Si2168 successfully attached
> > [  420.548372] si2157 9-0060: Silicon Labs Si2147/2148/2157/2158 successfully attached
> > [  420.548389] DVB: registering new adapter (em28174 #0)
> > [  420.548396] usb 2-2: DVB: registering adapter 0 frontend 0 (Silicon Labs Si2168)...
> > [  420.549737] em28174 #0: DVB extension successfully initialized
> > [  420.549743] em28xx: Registered (Em28xx dvb Extension) extension
> > [  435.418798] si2168 8-0064: found a 'Silicon Labs Si2168-B40'
> > [  435.418823] si2168 8-0064: downloading firmware from file 'dvb-demod-si2168-b40-01.fw'
> > [  435.617181] si2168 8-0064: firmware version: 4.0.11
> > [  435.619791] si2157 9-0060: found a 'Silicon Labs Si2157-A30'
> > [  435.642006] si2157 9-0060: firmware version: 3.0.5
>
> (I have replaced the last digits of the serial number with X)
>
> Is there any chance to add support for the second tuner, too?
> This would be awesome.
>
> Best,
> Christian
>
> --
> 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
Christian Steiner May 27, 2017, 3:38 p.m. UTC | #4
Hello,

I have found patches that add support for the second tuner:
https://github.com/b-rad-NDi/Ubuntu-media-tree-kernel-builder/tree/master/patches/ubuntu-zesty-4.10.0/extra

I can confirm that they also work with the latest kernel (4.12.0-rc2).
Would it be possible to integrate these patches into mainline?
Applying 0006-Hauppauge-WinTV-DualHD-DVB-ATSC-second-tuner-support.patch
is sufficient for the second tuner to appear, but I guess we should
include all patches.

Best regards,
Christian


On 11.04.2016 11:14, Olli Salonen wrote:
> Hi Christian,

> 

> Thanks for reporting back your experience. Certainly there's a chance

> of supporting the second tuner too. There are still two issues that I

> have not solved:

> 

> 1. I haven't gotten the 2nd tuner working yet (alone, without the

> first tuner), even if I think all the pieces of the puzzle are there.

> 2. em28xx driver is built with one tuner in mind and needs significant

> structural changes. If there's anyone very familiar with the em28xx

> driver here, I'd be happy to hear your idea of what is entailed for

> this.

> 

> Cheers,

> -olli

> 

> On 10 April 2016 at 18:23, Christian Steiner

> <christian.steiner@outlook.de> wrote:

>>

>> On 04.04.2016 17:12, Olli Salonen wrote:

>>> Hauppauge WinTV-dualHD is a USB 2.0 dual DVB-T/T2/C tuner with

>>> following components:

>>>

>>> USB bridge: Empia EM28274 (chip id is the same as EM28174)

>>> Demodulator: 2x Silicon Labs Si2168-B40

>>> Tuner: 2x Silicon Labs Si2157-A30

>>>

>>> This patch adds support only for the first tuner.

>>>

>>> [...]

>>

>> Thank you very much!

>> Works fine for me:

>>

>>> [  419.413188] em28xx: New device HCW dualHD @ 480 Mbps (2040:0265, interface 0, class 0)

>>> [  419.413195] em28xx: DVB interface 0 found: isoc

>>> [  419.413265] em28xx: chip ID is em28174

>>> [  420.529619] em28174 #0: EEPROM ID = 26 00 01 00, EEPROM hash = 0x7addc1c8

>>> [  420.529626] em28174 #0: EEPROM info:

>>> [  420.529630] em28174 #0:      microcode start address = 0x0004, boot configuration = 0x01

>>> [  420.536077] em28174 #0:      AC97 audio (5 sample rates)

>>> [  420.536084] em28174 #0:      500mA max power

>>> [  420.536089] em28174 #0:      Table at offset 0x27, strings=0x0e6a, 0x1888, 0x087e

>>> [  420.536188] em28174 #0: Identified as Hauppauge WinTV-dualHD DVB (card=98)

>>> [  420.537974] tveeprom 8-0050: Hauppauge model 204109, rev B2I6, serial# 11XXXXXX

>>> [  420.537981] tveeprom 8-0050: tuner model is SiLabs Si2157 (idx 186, type 4)

>>> [  420.537986] tveeprom 8-0050: TV standards PAL(B/G) NTSC(M) PAL(I) SECAM(L/L') PAL(D/D1/K) ATSC/DVB Digital (eeprom 0xfc)

>>> [  420.537989] tveeprom 8-0050: audio processor is None (idx 0)

>>> [  420.537993] tveeprom 8-0050: has no radio, has IR receiver, has no IR transmitter

>>> [  420.537997] em28174 #0: dvb set to isoc mode.

>>> [  420.538056] usbcore: registered new interface driver em28xx

>>> [  420.541087] em28174 #0: Binding DVB extension

>>> [  420.544008] i2c i2c-8: Added multiplexed i2c bus 9

>>> [  420.544016] si2168 8-0064: Silicon Labs Si2168 successfully attached

>>> [  420.548372] si2157 9-0060: Silicon Labs Si2147/2148/2157/2158 successfully attached

>>> [  420.548389] DVB: registering new adapter (em28174 #0)

>>> [  420.548396] usb 2-2: DVB: registering adapter 0 frontend 0 (Silicon Labs Si2168)...

>>> [  420.549737] em28174 #0: DVB extension successfully initialized

>>> [  420.549743] em28xx: Registered (Em28xx dvb Extension) extension

>>> [  435.418798] si2168 8-0064: found a 'Silicon Labs Si2168-B40'

>>> [  435.418823] si2168 8-0064: downloading firmware from file 'dvb-demod-si2168-b40-01.fw'

>>> [  435.617181] si2168 8-0064: firmware version: 4.0.11

>>> [  435.619791] si2157 9-0060: found a 'Silicon Labs Si2157-A30'

>>> [  435.642006] si2157 9-0060: firmware version: 3.0.5

>>

>> (I have replaced the last digits of the serial number with X)

>>

>> Is there any chance to add support for the second tuner, too?

>> This would be awesome.

>>

>> Best,

>> Christian

>>
Brad Love May 31, 2017, 8:01 p.m. UTC | #5
Christian et al,

I am an engineer at Hauppauge. This repo is the staging area for all the
patches I am testing, with the intention of getting them upstreamed. I
will be inaccessible for the next 18 days however, so I will not be able
to put any effort until I get back.

Cheers,

Brad



On 2017-05-27 10:38, Christian Steiner wrote:
> Hello,
>
> I have found patches that add support for the second tuner:
> https://github.com/b-rad-NDi/Ubuntu-media-tree-kernel-builder/tree/master/patches/ubuntu-zesty-4.10.0/extra
>
> I can confirm that they also work with the latest kernel (4.12.0-rc2).
> Would it be possible to integrate these patches into mainline?
> Applying 0006-Hauppauge-WinTV-DualHD-DVB-ATSC-second-tuner-support.patch
> is sufficient for the second tuner to appear, but I guess we should
> include all patches.
>
> Best regards,
> Christian
>
>
> On 11.04.2016 11:14, Olli Salonen wrote:
>> Hi Christian,
>>
>> Thanks for reporting back your experience. Certainly there's a chance
>> of supporting the second tuner too. There are still two issues that I
>> have not solved:
>>
>> 1. I haven't gotten the 2nd tuner working yet (alone, without the
>> first tuner), even if I think all the pieces of the puzzle are there.
>> 2. em28xx driver is built with one tuner in mind and needs significant
>> structural changes. If there's anyone very familiar with the em28xx
>> driver here, I'd be happy to hear your idea of what is entailed for
>> this.
>>
>> Cheers,
>> -olli
>>
>> On 10 April 2016 at 18:23, Christian Steiner
>> <christian.steiner@outlook.de> wrote:
>>> On 04.04.2016 17:12, Olli Salonen wrote:
>>>> Hauppauge WinTV-dualHD is a USB 2.0 dual DVB-T/T2/C tuner with
>>>> following components:
>>>>
>>>> USB bridge: Empia EM28274 (chip id is the same as EM28174)
>>>> Demodulator: 2x Silicon Labs Si2168-B40
>>>> Tuner: 2x Silicon Labs Si2157-A30
>>>>
>>>> This patch adds support only for the first tuner.
>>>>
>>>> [...]
>>> Thank you very much!
>>> Works fine for me:
>>>
>>>> [  419.413188] em28xx: New device HCW dualHD @ 480 Mbps (2040:0265, interface 0, class 0)
>>>> [  419.413195] em28xx: DVB interface 0 found: isoc
>>>> [  419.413265] em28xx: chip ID is em28174
>>>> [  420.529619] em28174 #0: EEPROM ID = 26 00 01 00, EEPROM hash = 0x7addc1c8
>>>> [  420.529626] em28174 #0: EEPROM info:
>>>> [  420.529630] em28174 #0:      microcode start address = 0x0004, boot configuration = 0x01
>>>> [  420.536077] em28174 #0:      AC97 audio (5 sample rates)
>>>> [  420.536084] em28174 #0:      500mA max power
>>>> [  420.536089] em28174 #0:      Table at offset 0x27, strings=0x0e6a, 0x1888, 0x087e
>>>> [  420.536188] em28174 #0: Identified as Hauppauge WinTV-dualHD DVB (card=98)
>>>> [  420.537974] tveeprom 8-0050: Hauppauge model 204109, rev B2I6, serial# 11XXXXXX
>>>> [  420.537981] tveeprom 8-0050: tuner model is SiLabs Si2157 (idx 186, type 4)
>>>> [  420.537986] tveeprom 8-0050: TV standards PAL(B/G) NTSC(M) PAL(I) SECAM(L/L') PAL(D/D1/K) ATSC/DVB Digital (eeprom 0xfc)
>>>> [  420.537989] tveeprom 8-0050: audio processor is None (idx 0)
>>>> [  420.537993] tveeprom 8-0050: has no radio, has IR receiver, has no IR transmitter
>>>> [  420.537997] em28174 #0: dvb set to isoc mode.
>>>> [  420.538056] usbcore: registered new interface driver em28xx
>>>> [  420.541087] em28174 #0: Binding DVB extension
>>>> [  420.544008] i2c i2c-8: Added multiplexed i2c bus 9
>>>> [  420.544016] si2168 8-0064: Silicon Labs Si2168 successfully attached
>>>> [  420.548372] si2157 9-0060: Silicon Labs Si2147/2148/2157/2158 successfully attached
>>>> [  420.548389] DVB: registering new adapter (em28174 #0)
>>>> [  420.548396] usb 2-2: DVB: registering adapter 0 frontend 0 (Silicon Labs Si2168)...
>>>> [  420.549737] em28174 #0: DVB extension successfully initialized
>>>> [  420.549743] em28xx: Registered (Em28xx dvb Extension) extension
>>>> [  435.418798] si2168 8-0064: found a 'Silicon Labs Si2168-B40'
>>>> [  435.418823] si2168 8-0064: downloading firmware from file 'dvb-demod-si2168-b40-01.fw'
>>>> [  435.617181] si2168 8-0064: firmware version: 4.0.11
>>>> [  435.619791] si2157 9-0060: found a 'Silicon Labs Si2157-A30'
>>>> [  435.642006] si2157 9-0060: firmware version: 3.0.5
>>> (I have replaced the last digits of the serial number with X)
>>>
>>> Is there any chance to add support for the second tuner, too?
>>> This would be awesome.
>>>
>>> Best,
>>> Christian
>>>
Mauro Carvalho Chehab Sept. 7, 2017, 2:52 p.m. UTC | #6
Hi Brad,

Em Wed, 31 May 2017 15:01:00 -0500
Brad Love <brad@nextdimension.cc> escreveu:

> Christian et al,
> 
> I am an engineer at Hauppauge. This repo is the staging area for all the
> patches I am testing, with the intention of getting them upstreamed. I
> will be inaccessible for the next 18 days however, so I will not be able
> to put any effort until I get back.

Any news on such patchset?

On a side note, I took a quick look on some of the patches at the
git repository at:

	https://github.com/b-rad-NDi/Ubuntu-media-tree-kernel-builder/tree/master/patches/ubuntu-zesty-4.10.0/extra

I suspect that some of the patches there could have some side effect on
existing drivers, like this one that unconditionally changes the size
of URB:

	https://github.com/b-rad-NDi/Ubuntu-media-tree-kernel-builder/blob/master/patches/ubuntu-zesty-4.10.0/extra/0003-em28xx-usb-packet-size-tweaks.patch

So, it would be good to be able to test this set also with older
em28xx devices that also support bulk transfers.

Thanks,
Mauro
Brad Love Sept. 9, 2017, 2:09 a.m. UTC | #7
Hi Mauro,


On 2017-09-07 09:52, Mauro Carvalho Chehab wrote:
> Hi Brad,
>
> Em Wed, 31 May 2017 15:01:00 -0500
> Brad Love <brad@nextdimension.cc> escreveu:
>
>> Christian et al,
>>
>> I am an engineer at Hauppauge. This repo is the staging area for all the
>> patches I am testing, with the intention of getting them upstreamed. I
>> will be inaccessible for the next 18 days however, so I will not be able
>> to put any effort until I get back.
> Any news on such patchset?
>
> On a side note, I took a quick look on some of the patches at the
> git repository at:
>
> 	https://github.com/b-rad-NDi/Ubuntu-media-tree-kernel-builder/tree/master/patches/ubuntu-zesty-4.10.0/extra
>
> I suspect that some of the patches there could have some side effect on
> existing drivers, like this one that unconditionally changes the size
> of URB:
>
> 	https://github.com/b-rad-NDi/Ubuntu-media-tree-kernel-builder/blob/master/patches/ubuntu-zesty-4.10.0/extra/0003-em28xx-usb-packet-size-tweaks.patch
>
> So, it would be good to be able to test this set also with older
> em28xx devices that also support bulk transfers.
>
> Thanks,
> Mauro

I apologize for delay of action on my growing patchset, summer has been
quite busy for me. I can find time to work on this now though. There is
an initial cluster of the set that I think are ready, but I agree the
unconditional URB size change should be tested against other em28xx
devices. We've found the size changes optimal, but haven't tested
against anyone else's hardware. I will try and source and source some
bulk models from other manufacturers to verify they still operate with
the modification.

Regards,

Brad
diff mbox

Patch

diff --git a/Documentation/video4linux/CARDLIST.em28xx b/Documentation/video4linux/CARDLIST.em28xx
index 6720999..09ff940 100644
--- a/Documentation/video4linux/CARDLIST.em28xx
+++ b/Documentation/video4linux/CARDLIST.em28xx
@@ -96,3 +96,4 @@ 
  95 -> Leadtek VC100                            (em2861)        [0413:6f07]
  96 -> Terratec Cinergy T2 Stick HD             (em28178)
  97 -> Elgato EyeTV Hybrid 2008 INT             (em2884)        [0fd9:0018]
+ 98 -> Hauppauge WinTV-dualHD DVB               (em28174)       [2040:0265]
diff --git a/drivers/media/usb/em28xx/em28xx-cards.c b/drivers/media/usb/em28xx/em28xx-cards.c
index 930e3e3..5a57f75 100644
--- a/drivers/media/usb/em28xx/em28xx-cards.c
+++ b/drivers/media/usb/em28xx/em28xx-cards.c
@@ -492,6 +492,29 @@  static struct em28xx_reg_seq terratec_t2_stick_hd[] = {
 	{-1,                             -1,   -1,     -1},
 };
 
+/* 2040:0265 Hauppauge WinTV-dualHD DVB
+ * reg 0x80/0x84:
+ * GPIO_0: Yellow LED tuner 1, 0=on, 1=off
+ * GPIO_1: Green LED tuner 1, 0=on, 1=off
+ * GPIO_2: Yellow LED tuner 2, 0=on, 1=off
+ * GPIO_3: Green LED tuner 2, 0=on, 1=off
+ * GPIO_5: Reset #2, 0=active
+ * GPIO_6: Reset #1, 0=active
+ */
+static struct em28xx_reg_seq hauppauge_dualhd_dvb[] = {
+	{EM2874_R80_GPIO_P0_CTRL,      0xff, 0xff,      0},
+	{0x0d,                         0xff, 0xff,    200},
+	{0x50,                         0x04, 0xff,    300},
+	{EM2874_R80_GPIO_P0_CTRL,      0xbf, 0xff,    100}, /* demod 1 reset */
+	{EM2874_R80_GPIO_P0_CTRL,      0xff, 0xff,    100},
+	{EM2874_R80_GPIO_P0_CTRL,      0xdf, 0xff,    100}, /* demod 2 reset */
+	{EM2874_R80_GPIO_P0_CTRL,      0xff, 0xff,    100},
+	{EM2874_R5F_TS_ENABLE,         0x44, 0xff,     50},
+	{EM2874_R5D_TS1_PKT_SIZE,      0x05, 0xff,     50},
+	{EM2874_R5E_TS2_PKT_SIZE,      0x05, 0xff,     50},
+	{-1,                             -1,   -1,     -1},
+};
+
 /*
  *  Button definitions
  */
@@ -571,6 +594,22 @@  static struct em28xx_led terratec_grabby_leds[] = {
 	{-1, 0, 0, 0},
 };
 
+static struct em28xx_led hauppauge_dualhd_leds[] = {
+	{
+		.role      = EM28XX_LED_DIGITAL_CAPTURING,
+		.gpio_reg  = EM2874_R80_GPIO_P0_CTRL,
+		.gpio_mask = EM_GPIO_1,
+		.inverted  = 1,
+	},
+	{
+		.role      = EM28XX_LED_DIGITAL_CAPTURING_TS2,
+		.gpio_reg  = EM2874_R80_GPIO_P0_CTRL,
+		.gpio_mask = EM_GPIO_3,
+		.inverted  = 1,
+	},
+	{-1, 0, 0, 0},
+};
+
 /*
  *  Board definitions
  */
@@ -2306,6 +2345,18 @@  struct em28xx_board em28xx_boards[] = {
 		.has_dvb       = 1,
 		.ir_codes      = RC_MAP_TERRATEC_SLIM_2,
 	},
+	/* 2040:0265 Hauppauge WinTV-dualHD (DVB version).
+	 * Empia EM28274, 2x Silicon Labs Si2168, 2x Silicon Labs Si2157 */
+	[EM28174_BOARD_HAUPPAUGE_WINTV_DUALHD_DVB] = {
+		.name          = "Hauppauge WinTV-dualHD DVB",
+		.def_i2c_bus   = 1,
+		.i2c_speed     = EM28XX_I2C_CLK_WAIT_ENABLE | EM28XX_I2C_FREQ_400_KHZ,
+		.tuner_type    = TUNER_ABSENT,
+		.tuner_gpio    = hauppauge_dualhd_dvb,
+		.has_dvb       = 1,
+		.ir_codes      = RC_MAP_HAUPPAUGE,
+		.leds          = hauppauge_dualhd_leds,
+	},
 };
 EXPORT_SYMBOL_GPL(em28xx_boards);
 
@@ -2429,6 +2480,8 @@  struct usb_device_id em28xx_id_table[] = {
 			.driver_info = EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950 },
 	{ USB_DEVICE(0x2040, 0x651f),
 			.driver_info = EM2883_BOARD_HAUPPAUGE_WINTV_HVR_850 },
+	{ USB_DEVICE(0x2040, 0x0265),
+			.driver_info = EM28174_BOARD_HAUPPAUGE_WINTV_DUALHD_DVB },
 	{ USB_DEVICE(0x0438, 0xb002),
 			.driver_info = EM2880_BOARD_AMD_ATI_TV_WONDER_HD_600 },
 	{ USB_DEVICE(0x2001, 0xf112),
@@ -2861,6 +2914,7 @@  static void em28xx_card_setup(struct em28xx *dev)
 	case EM2883_BOARD_HAUPPAUGE_WINTV_HVR_850:
 	case EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950:
 	case EM2884_BOARD_HAUPPAUGE_WINTV_HVR_930C:
+	case EM28174_BOARD_HAUPPAUGE_WINTV_DUALHD_DVB:
 	{
 		struct tveeprom tv;
 
diff --git a/drivers/media/usb/em28xx/em28xx-dvb.c b/drivers/media/usb/em28xx/em28xx-dvb.c
index 5d209c7..94b88f1 100644
--- a/drivers/media/usb/em28xx/em28xx-dvb.c
+++ b/drivers/media/usb/em28xx/em28xx-dvb.c
@@ -1762,6 +1762,70 @@  static int em28xx_dvb_init(struct em28xx *dev)
 			dvb->i2c_client_tuner = client;
 		}
 		break;
+	case EM28174_BOARD_HAUPPAUGE_WINTV_DUALHD_DVB:
+		{
+			struct i2c_adapter *adapter;
+			struct i2c_client *client;
+			struct i2c_board_info info;
+			struct si2168_config si2168_config;
+			struct si2157_config si2157_config;
+
+			/* attach demod */
+			memset(&si2168_config, 0, sizeof(si2168_config));
+			si2168_config.i2c_adapter = &adapter;
+			si2168_config.fe = &dvb->fe[0];
+			si2168_config.ts_mode = SI2168_TS_SERIAL;
+			memset(&info, 0, sizeof(struct i2c_board_info));
+			strlcpy(info.type, "si2168", I2C_NAME_SIZE);
+			info.addr = 0x64;
+			info.platform_data = &si2168_config;
+			request_module(info.type);
+			client = i2c_new_device(&dev->i2c_adap[dev->def_i2c_bus], &info);
+			if (client == NULL || client->dev.driver == NULL) {
+				result = -ENODEV;
+				goto out_free;
+			}
+
+			if (!try_module_get(client->dev.driver->owner)) {
+				i2c_unregister_device(client);
+				result = -ENODEV;
+				goto out_free;
+			}
+
+			dvb->i2c_client_demod = client;
+
+			/* attach tuner */
+			memset(&si2157_config, 0, sizeof(si2157_config));
+			si2157_config.fe = dvb->fe[0];
+			si2157_config.if_port = 1;
+#ifdef CONFIG_MEDIA_CONTROLLER_DVB
+			si2157_config.mdev = dev->media_dev;
+#endif
+			memset(&info, 0, sizeof(struct i2c_board_info));
+			strlcpy(info.type, "si2157", I2C_NAME_SIZE);
+			info.addr = 0x60;
+			info.platform_data = &si2157_config;
+			request_module(info.type);
+			client = i2c_new_device(adapter, &info);
+			if (client == NULL || client->dev.driver == NULL) {
+				module_put(dvb->i2c_client_demod->dev.driver->owner);
+				i2c_unregister_device(dvb->i2c_client_demod);
+				result = -ENODEV;
+				goto out_free;
+			}
+
+			if (!try_module_get(client->dev.driver->owner)) {
+				i2c_unregister_device(client);
+				module_put(dvb->i2c_client_demod->dev.driver->owner);
+				i2c_unregister_device(dvb->i2c_client_demod);
+				result = -ENODEV;
+				goto out_free;
+			}
+
+			dvb->i2c_client_tuner = client;
+
+		}
+		break;
 	default:
 		em28xx_errdev("/2: The frontend of your DVB/ATSC card"
 				" isn't supported yet\n");
diff --git a/drivers/media/usb/em28xx/em28xx-reg.h b/drivers/media/usb/em28xx/em28xx-reg.h
index 13cbb7f..afe7a66 100644
--- a/drivers/media/usb/em28xx/em28xx-reg.h
+++ b/drivers/media/usb/em28xx/em28xx-reg.h
@@ -193,6 +193,19 @@ 
 /* em2874 registers */
 #define EM2874_R50_IR_CONFIG    0x50
 #define EM2874_R51_IR           0x51
+#define EM2874_R5D_TS1_PKT_SIZE 0x5d
+#define EM2874_R5E_TS2_PKT_SIZE 0x5e
+	/*
+	 * For both TS1 and TS2, In isochronous mode:
+	 *  0x01  188 bytes
+	 *  0x02  376 bytes
+	 *  0x03  564 bytes
+	 *  0x04  752 bytes
+	 *  0x05  940 bytes
+	 * In bulk mode:
+	 *  0x01..0xff  total packet count in 188-byte
+	 */
+
 #define EM2874_R5F_TS_ENABLE    0x5f
 
 /* em2874/174/84, em25xx, em276x/7x/8x GPIO registers */
diff --git a/drivers/media/usb/em28xx/em28xx.h b/drivers/media/usb/em28xx/em28xx.h
index 2674449..61f6e6d 100644
--- a/drivers/media/usb/em28xx/em28xx.h
+++ b/drivers/media/usb/em28xx/em28xx.h
@@ -145,6 +145,7 @@ 
 #define EM2861_BOARD_LEADTEK_VC100                95
 #define EM28178_BOARD_TERRATEC_T2_STICK_HD        96
 #define EM2884_BOARD_ELGATO_EYETV_HYBRID_2008     97
+#define EM28174_BOARD_HAUPPAUGE_WINTV_DUALHD_DVB  98
 
 /* Limits minimum and default number of buffers */
 #define EM28XX_MIN_BUF 4
@@ -406,6 +407,7 @@  enum em28xx_adecoder {
 enum em28xx_led_role {
 	EM28XX_LED_ANALOG_CAPTURING = 0,
 	EM28XX_LED_DIGITAL_CAPTURING,
+	EM28XX_LED_DIGITAL_CAPTURING_TS2,
 	EM28XX_LED_ILLUMINATION,
 	EM28XX_NUM_LED_ROLES, /* must be the last */
 };