All of lore.kernel.org
 help / color / mirror / Atom feed
* RTL28XX driver
@ 2012-04-06  9:11 Thomas Mair
  2012-04-06  9:36 ` Antti Palosaari
                   ` (2 more replies)
  0 siblings, 3 replies; 19+ messages in thread
From: Thomas Mair @ 2012-04-06  9:11 UTC (permalink / raw)
  To: linux-media

Hello everyone,

i own a TerraTec Cinergy T Stick Black device, and was able to find a
working driver for the device. It seems to be, that the driver was
originally written by Realtek and has since been updated by different
Developers to meet DVB API changes. I was wondering what would be the
necessary steps to include the driver into the kernel sources?

The one thing that needs to be solved before even thinking about the
integration, is the licencing of the code. I did find it on two
different locations, but without any licencing information. So
probably Realtek should be contacted. I am willing to deal with that,
but need furter information on under whitch lisence the code has to be
relased.

So far, I put up a Github repository for the driver, which enables me
to compile the proper kernel modue at
https://github.com/tmair/DVB-Realtek-RTL2832U-2.2.2-10tuner-mod_kernel-3.0.0
The modificatioins to the driver where taken from openpli
http://openpli.git.sourceforge.net/git/gitweb.cgi?p=openpli/openembedded;a=blob;f=recipes/linux/linux-etxx00/dvb-usb-rtl2832.patch;h=063114c8ce4a2dbcf8c8dde1b4ab4f8e329a2afa;hb=HEAD

In the driver sources I stumbled accross many different devices
containig the RTL28XX chipset, so I suppose the driver would enably
quite many products to work.

As I am relatively new to the developement of dvb drivers I appreciate
any help in stabilizing the driver and proper integration into the dvb
API.

Greetings
Thomas

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: RTL28XX driver
  2012-04-06  9:11 RTL28XX driver Thomas Mair
@ 2012-04-06  9:36 ` Antti Palosaari
  2012-04-07  7:25 ` poma
  2012-04-07 14:19 ` Gianluca Gennari
  2 siblings, 0 replies; 19+ messages in thread
From: Antti Palosaari @ 2012-04-06  9:36 UTC (permalink / raw)
  To: Thomas Mair; +Cc: linux-media

On 06.04.2012 12:11, Thomas Mair wrote:
> i own a TerraTec Cinergy T Stick Black device, and was able to find a
> working driver for the device. It seems to be, that the driver was
> originally written by Realtek and has since been updated by different
> Developers to meet DVB API changes. I was wondering what would be the
> necessary steps to include the driver into the kernel sources?
>
> The one thing that needs to be solved before even thinking about the
> integration, is the licencing of the code. I did find it on two
> different locations, but without any licencing information. So
> probably Realtek should be contacted. I am willing to deal with that,
> but need furter information on under whitch lisence the code has to be
> relased.
>
> So far, I put up a Github repository for the driver, which enables me
> to compile the proper kernel modue at
> https://github.com/tmair/DVB-Realtek-RTL2832U-2.2.2-10tuner-mod_kernel-3.0.0
> The modificatioins to the driver where taken from openpli
> http://openpli.git.sourceforge.net/git/gitweb.cgi?p=openpli/openembedded;a=blob;f=recipes/linux/linux-etxx00/dvb-usb-rtl2832.patch;h=063114c8ce4a2dbcf8c8dde1b4ab4f8e329a2afa;hb=HEAD
>
> In the driver sources I stumbled accross many different devices
> containig the RTL28XX chipset, so I suppose the driver would enably
> quite many products to work.
>
> As I am relatively new to the developement of dvb drivers I appreciate
> any help in stabilizing the driver and proper integration into the dvb
> API.

Biggest problem here is missing demodulator driver. RTL2832U chip 
integrates demod called RTL2832. DVB USB device contains logically three 
entity: USB-interface, demodulator and tuner. All those needs own Kernel 
driver. In case of RTL2832U there is already RTL28XXU USB -interface 
driver ready as I did it for RTL2831U. Those two chips uses basically 
same USB -interface but demodulator is different. During the RTL2831U 
development I also ran RTL2832U device using same USB -interface driver 
so I know it works.

So look example from RTL2831U (which is Kernel modules: dvb_usb_rtl28xxu 
and rtl2830) and try to implement new demod driver.

You will also need RF-tuner driver, which may or may not exists 
depending your device. There is a lot of existing tuner driver but 
unfortunately RTL2832U designs uses a lot of new tuners and thus no 
existing drivers for all.

There is no developer working for RTL2832U supports currently AFAIK.

regards
Antti
-- 
http://palosaari.fi/

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: RTL28XX driver
  2012-04-06  9:11 RTL28XX driver Thomas Mair
  2012-04-06  9:36 ` Antti Palosaari
@ 2012-04-07  7:25 ` poma
  2012-04-07 14:19 ` Gianluca Gennari
  2 siblings, 0 replies; 19+ messages in thread
From: poma @ 2012-04-07  7:25 UTC (permalink / raw)
  To: linux-media, maximlevitsky

On 04/06/2012 11:11 AM, Thomas Mair wrote:
> Hello everyone,
> 
> i own a TerraTec Cinergy T Stick Black device, and was able to find a
> working driver for the device. It seems to be, that the driver was
> originally written by Realtek and has since been updated by different
> Developers to meet DVB API changes. I was wondering what would be the
> necessary steps to include the driver into the kernel sources?
> 
> The one thing that needs to be solved before even thinking about the
> integration, is the licencing of the code. I did find it on two
> different locations, but without any licencing information. So
> probably Realtek should be contacted. I am willing to deal with that,
> but need furter information on under whitch lisence the code has to be
> relased.
> 
> So far, I put up a Github repository for the driver, which enables me
> to compile the proper kernel modue at
> https://github.com/tmair/DVB-Realtek-RTL2832U-2.2.2-10tuner-mod_kernel-3.0.0
> The modificatioins to the driver where taken from openpli
> http://openpli.git.sourceforge.net/git/gitweb.cgi?p=openpli/openembedded;a=blob;f=recipes/linux/linux-etxx00/dvb-usb-rtl2832.patch;h=063114c8ce4a2dbcf8c8dde1b4ab4f8e329a2afa;hb=HEAD

modinfo dvb_usb_rtl2832
filename:
/lib/modules/3.3.1-2.fc16.x86_64/kernel/drivers/media/dvb/dvb-usb/dvb-usb-rtl2832.ko
license:        GPL
version:        2.2.2
description:    Driver for the RTL2832U DVB-T / RTL2836 DTMB USB2.0 device
author:         Dean Chung<DeanChung@realtek.com>
author:         Chialing Lu <chialing@realtek.com>
author:         Realtek
srcversion:     533BB7E5866E52F63B9ACCB
alias:          usb:v0CCDp00E0d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v0CCDp00D4d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v0CCDp00D3d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v0413p6A03d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v1680pA332d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v185Bp9520d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v185Bp9530d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v185Bp9540d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v185Bp9550d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v185Bp9580d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v185Bp0680d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v185Bp0650d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v185Bp0640d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v185Bp0630d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v185Bp0620d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v1164p3284d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v1164p3280d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v1164p6601d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v0413p6F11d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v0413p6680d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v1F4DpA683d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v1F4Dp0139d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v1F4DpD286d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v1F4DpC280d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v1F4DpD803d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v1F4DpC803d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v1F4DpB803d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v1F4DpA803d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v1F4Dp0837d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v1B80pE41Dd*dc*dsc*dp*ic*isc*ip*
alias:          usb:v1B80pD3A4d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v1B80pD3A1d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v1B80pE77Bd*dc*dsc*dp*ic*isc*ip*
alias:          usb:v1B80pD39Ed*dc*dsc*dp*ic*isc*ip*
alias:          usb:v1B80pD39Cd*dc*dsc*dp*ic*isc*ip*
alias:          usb:v1B80pD39Bd*dc*dsc*dp*ic*isc*ip*
alias:          usb:v1B80pD39Ad*dc*dsc*dp*ic*isc*ip*
alias:          usb:v1B80pD398d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v1B80pD397d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v1B80pD396d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v1B80pD395d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v1B80pD394d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v1B80pD393d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v1554p5026d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v1554p5020d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v1554p5013d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v13D3p3282d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v13D3p3274d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v13D3p3234d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v0CCDp00B3d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v0CCDp00A9d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v1D19p9202d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v1D19p3103d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v1D19p9201d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v1D19p8202d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v1D19p2101d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v1D19p1108d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v1D19p1107d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v1D19p1106d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v1D19p1105d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v1D19p1104d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v1D19p1103d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v1D19p1102d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v1D19p1101d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v0BDAp2825d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v0BDAp2824d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v0BDAp2811d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v0BDAp2810d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v0BDAp2823d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v0BDAp2822d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v0BDAp2821d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v0BDAp2820d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v0BDAp2837d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v0BDAp2834d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v0BDAp2841d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v0BDAp2840d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v0BDAp2839d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v0BDAp2836d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v0BDAp2838d*dc*dsc*dp*ic*isc*ip*
alias:          usb:v0BDAp2832d*dc*dsc*dp*ic*isc*ip*
depends:        dvb-usb
vermagic:       3.3.1-2.fc16.x86_64 SMP mod_unload
parm:           debug:Set debugging level (0=disable, 1=info, 2=xfer,
4=rc (or-able)), default=0 (int)
parm:           demod:Set default demod type (0=dvb-t, 1=dtmb, 2=dvb-c),
default=0 (int)
parm:           dtmb_err_discard:Set error packet discard type (0=not
discard, 1=discard), default=0 (int)
parm:           rtl2832u_rc_mode:Set default rtl2832u_rc_mode (0=rc6,
1=rc5, 2=nec, 3=disable rc), default=3 (int)
parm:           rtl2832u_card_type:Set default rtl2832u_card_type type
(0=dongle, 1=mini card), default=0 (int)
parm:           snrdb:SNR type output (0=16bit, 1=dB decibel), default=0
(int)
parm:           adapter_nr:DVB adapter numbers (array of short)

dmesg
dvb-usb: found a 'DVB-T TV Stick' in warm state.
dvb-usb: will pass the complete MPEG2 transport stream to the software
demuxer.
DVB: registering new adapter (DVB-T TV Stick)
RTL2832U usb_init_bulk_setting : USB2.0 HIGH SPEED (480Mb/s)
RTL2832U check_tuner_type : FC0012 tuner on board...
DVB: registering adapter 2 frontend 0 (Realtek DVB-T RTL2832)...
dvb-usb: DVB-T TV Stick successfully initialized and connected.

btw there is a git repo at https://gitorious.org/rtl2832 by Maxim
tnx for standalone ver, tnx Gianluca for >=3.3 patch

> In the driver sources I stumbled accross many different devices
> containig the RTL28XX chipset, so I suppose the driver would enably
> quite many products to work.
> 
> As I am relatively new to the developement of dvb drivers I appreciate
> any help in stabilizing the driver and proper integration into the dvb
> API.
> 
> Greetings
> Thomas

rgds,
poma

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: RTL28XX driver
  2012-04-06  9:11 RTL28XX driver Thomas Mair
  2012-04-06  9:36 ` Antti Palosaari
  2012-04-07  7:25 ` poma
@ 2012-04-07 14:19 ` Gianluca Gennari
  2012-04-09 12:02   ` Thomas Mair
  2 siblings, 1 reply; 19+ messages in thread
From: Gianluca Gennari @ 2012-04-07 14:19 UTC (permalink / raw)
  To: Thomas Mair; +Cc: linux-media

Il 06/04/2012 11:11, Thomas Mair ha scritto:
> Hello everyone,
> 
> i own a TerraTec Cinergy T Stick Black device, and was able to find a
> working driver for the device. It seems to be, that the driver was
> originally written by Realtek and has since been updated by different
> Developers to meet DVB API changes. I was wondering what would be the
> necessary steps to include the driver into the kernel sources?
> 
> The one thing that needs to be solved before even thinking about the
> integration, is the licencing of the code. I did find it on two
> different locations, but without any licencing information. So
> probably Realtek should be contacted. I am willing to deal with that,
> but need furter information on under whitch lisence the code has to be
> relased.
> 
> So far, I put up a Github repository for the driver, which enables me
> to compile the proper kernel modue at
> https://github.com/tmair/DVB-Realtek-RTL2832U-2.2.2-10tuner-mod_kernel-3.0.0
> The modificatioins to the driver where taken from openpli
> http://openpli.git.sourceforge.net/git/gitweb.cgi?p=openpli/openembedded;a=blob;f=recipes/linux/linux-etxx00/dvb-usb-rtl2832.patch;h=063114c8ce4a2dbcf8c8dde1b4ab4f8e329a2afa;hb=HEAD
> 
> In the driver sources I stumbled accross many different devices
> containig the RTL28XX chipset, so I suppose the driver would enably
> quite many products to work.
> 
> As I am relatively new to the developement of dvb drivers I appreciate
> any help in stabilizing the driver and proper integration into the dvb
> API.
> 

Hi Thomas,
the Realtek driver you mention is the full version, which supports 3
demodulators (2832=DVB-T, 2836=DTMB, 2840=DVB-C) and 10 different tuners.
There is also a simplified version of the driver which supports only
DVB-T and 4 tuners: this is probably a better starting base for your
project.

You can find the simplified driver here:

https://github.com/ambrosa/DVB-Realtek-RTL2832U-2.2.2-4_tuner

My friend Ambrosa got it directly from Realtek. You can mail the 2
driver authors directly:

author:         Dean Chung <DeanChung@realtek.com>
author:         Chialing Lu <chialing@realtek.com>

as they have been quite collaborative last year. I think they can also
provide you some information about the code license.

The rtl2832 devices I've seen so far use either the Fitipower fc0012 or
the Elonics E4000 tuner. For the first one there is a driver from
Hans-Frieder Vogt that is not yet included in the development tree, but
it has been posted recently on this list.

If your stick uses this tuner, then the problem reduces to write the
demodulator driver (as Antti already explained).

Best regards,
Gianluca


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: RTL28XX driver
  2012-04-07 14:19 ` Gianluca Gennari
@ 2012-04-09 12:02   ` Thomas Mair
  2012-04-09 15:09     ` Gianluca Gennari
  2012-04-11 19:12     ` Antti Palosaari
  0 siblings, 2 replies; 19+ messages in thread
From: Thomas Mair @ 2012-04-09 12:02 UTC (permalink / raw)
  To: gennarone; +Cc: linux-media

Hi Gainluca,

thanks for your information. I did get in touch with Realtek and they
provided me with the datasheet for the RTL2832U. So what I will try to
do is write a demodulator driver for the RTL2832 demod chip following
the information of the datasheet and the Realtek driver. I will follow
Antti's RTL2830 driver structure.

For now there is only one question left regarding the testing of the
drivers. What is the best way to test and debug the drivers. Sould I
compile the 3.4 kernel and use it, or is it safer to set up a
structure like the one I already have to test the driver with a stable
kernel?

Greetings
Thomas

2012/4/7 Gianluca Gennari <gennarone@gmail.com>:
> Il 06/04/2012 11:11, Thomas Mair ha scritto:
>> Hello everyone,
>>
>> i own a TerraTec Cinergy T Stick Black device, and was able to find a
>> working driver for the device. It seems to be, that the driver was
>> originally written by Realtek and has since been updated by different
>> Developers to meet DVB API changes. I was wondering what would be the
>> necessary steps to include the driver into the kernel sources?
>>
>> The one thing that needs to be solved before even thinking about the
>> integration, is the licencing of the code. I did find it on two
>> different locations, but without any licencing information. So
>> probably Realtek should be contacted. I am willing to deal with that,
>> but need furter information on under whitch lisence the code has to be
>> relased.
>>
>> So far, I put up a Github repository for the driver, which enables me
>> to compile the proper kernel modue at
>> https://github.com/tmair/DVB-Realtek-RTL2832U-2.2.2-10tuner-mod_kernel-3.0.0
>> The modificatioins to the driver where taken from openpli
>> http://openpli.git.sourceforge.net/git/gitweb.cgi?p=openpli/openembedded;a=blob;f=recipes/linux/linux-etxx00/dvb-usb-rtl2832.patch;h=063114c8ce4a2dbcf8c8dde1b4ab4f8e329a2afa;hb=HEAD
>>
>> In the driver sources I stumbled accross many different devices
>> containig the RTL28XX chipset, so I suppose the driver would enably
>> quite many products to work.
>>
>> As I am relatively new to the developement of dvb drivers I appreciate
>> any help in stabilizing the driver and proper integration into the dvb
>> API.
>>
>
> Hi Thomas,
> the Realtek driver you mention is the full version, which supports 3
> demodulators (2832=DVB-T, 2836=DTMB, 2840=DVB-C) and 10 different tuners.
> There is also a simplified version of the driver which supports only
> DVB-T and 4 tuners: this is probably a better starting base for your
> project.
>
> You can find the simplified driver here:
>
> https://github.com/ambrosa/DVB-Realtek-RTL2832U-2.2.2-4_tuner
>
> My friend Ambrosa got it directly from Realtek. You can mail the 2
> driver authors directly:
>
> author:         Dean Chung <DeanChung@realtek.com>
> author:         Chialing Lu <chialing@realtek.com>
>
> as they have been quite collaborative last year. I think they can also
> provide you some information about the code license.
>
> The rtl2832 devices I've seen so far use either the Fitipower fc0012 or
> the Elonics E4000 tuner. For the first one there is a driver from
> Hans-Frieder Vogt that is not yet included in the development tree, but
> it has been posted recently on this list.
>
> If your stick uses this tuner, then the problem reduces to write the
> demodulator driver (as Antti already explained).
>
> Best regards,
> Gianluca
>

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: RTL28XX driver
  2012-04-09 12:02   ` Thomas Mair
@ 2012-04-09 15:09     ` Gianluca Gennari
  2012-04-11 19:12     ` Antti Palosaari
  1 sibling, 0 replies; 19+ messages in thread
From: Gianluca Gennari @ 2012-04-09 15:09 UTC (permalink / raw)
  To: Thomas Mair; +Cc: linux-media

Hi Thomas,

Il 09/04/2012 14:02, Thomas Mair ha scritto:
> Hi Gainluca,
> 
> thanks for your information. I did get in touch with Realtek and they
> provided me with the datasheet for the RTL2832U. So what I will try to
> do is write a demodulator driver for the RTL2832 demod chip following
> the information of the datasheet and the Realtek driver. I will follow
> Antti's RTL2830 driver structure.

that's very good news.

> For now there is only one question left regarding the testing of the
> drivers. What is the best way to test and debug the drivers. Sould I
> compile the 3.4 kernel and use it, or is it safer to set up a
> structure like the one I already have to test the driver with a stable
> kernel?

I think the best option is to clone the DVB development tree:

http://git.linuxtv.org/media_tree.git

then you can create your branch and base your work on top of it.

Best regards,
Gianluca

> Greetings
> Thomas
> 
> 2012/4/7 Gianluca Gennari <gennarone@gmail.com>:
>> Il 06/04/2012 11:11, Thomas Mair ha scritto:
>>> Hello everyone,
>>>
>>> i own a TerraTec Cinergy T Stick Black device, and was able to find a
>>> working driver for the device. It seems to be, that the driver was
>>> originally written by Realtek and has since been updated by different
>>> Developers to meet DVB API changes. I was wondering what would be the
>>> necessary steps to include the driver into the kernel sources?
>>>
>>> The one thing that needs to be solved before even thinking about the
>>> integration, is the licencing of the code. I did find it on two
>>> different locations, but without any licencing information. So
>>> probably Realtek should be contacted. I am willing to deal with that,
>>> but need furter information on under whitch lisence the code has to be
>>> relased.
>>>
>>> So far, I put up a Github repository for the driver, which enables me
>>> to compile the proper kernel modue at
>>> https://github.com/tmair/DVB-Realtek-RTL2832U-2.2.2-10tuner-mod_kernel-3.0.0
>>> The modificatioins to the driver where taken from openpli
>>> http://openpli.git.sourceforge.net/git/gitweb.cgi?p=openpli/openembedded;a=blob;f=recipes/linux/linux-etxx00/dvb-usb-rtl2832.patch;h=063114c8ce4a2dbcf8c8dde1b4ab4f8e329a2afa;hb=HEAD
>>>
>>> In the driver sources I stumbled accross many different devices
>>> containig the RTL28XX chipset, so I suppose the driver would enably
>>> quite many products to work.
>>>
>>> As I am relatively new to the developement of dvb drivers I appreciate
>>> any help in stabilizing the driver and proper integration into the dvb
>>> API.
>>>
>>
>> Hi Thomas,
>> the Realtek driver you mention is the full version, which supports 3
>> demodulators (2832=DVB-T, 2836=DTMB, 2840=DVB-C) and 10 different tuners.
>> There is also a simplified version of the driver which supports only
>> DVB-T and 4 tuners: this is probably a better starting base for your
>> project.
>>
>> You can find the simplified driver here:
>>
>> https://github.com/ambrosa/DVB-Realtek-RTL2832U-2.2.2-4_tuner
>>
>> My friend Ambrosa got it directly from Realtek. You can mail the 2
>> driver authors directly:
>>
>> author: � � � � Dean Chung <DeanChung@realtek.com>
>> author: � � � � Chialing Lu <chialing@realtek.com>
>>
>> as they have been quite collaborative last year. I think they can also
>> provide you some information about the code license.
>>
>> The rtl2832 devices I've seen so far use either the Fitipower fc0012 or
>> the Elonics E4000 tuner. For the first one there is a driver from
>> Hans-Frieder Vogt that is not yet included in the development tree, but
>> it has been posted recently on this list.
>>
>> If your stick uses this tuner, then the problem reduces to write the
>> demodulator driver (as Antti already explained).
>>
>> Best regards,
>> Gianluca
>>
> 


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: RTL28XX driver
  2012-04-09 12:02   ` Thomas Mair
  2012-04-09 15:09     ` Gianluca Gennari
@ 2012-04-11 19:12     ` Antti Palosaari
  2012-04-11 21:33       ` Oliver Schinagl
  1 sibling, 1 reply; 19+ messages in thread
From: Antti Palosaari @ 2012-04-11 19:12 UTC (permalink / raw)
  To: Thomas Mair; +Cc: gennarone, linux-media

On 09.04.2012 15:02, Thomas Mair wrote:
> thanks for your information. I did get in touch with Realtek and they
> provided me with the datasheet for the RTL2832U. So what I will try to
> do is write a demodulator driver for the RTL2832 demod chip following
> the information of the datasheet and the Realtek driver. I will follow
> Antti's RTL2830 driver structure.
>
> For now there is only one question left regarding the testing of the
> drivers. What is the best way to test and debug the drivers. Sould I
> compile the 3.4 kernel and use it, or is it safer to set up a
> structure like the one I already have to test the driver with a stable
> kernel?

I vote for cloning Mauro's latest staging Kernel 3.5 and use it.
http://git.linuxtv.org/media_tree.git/shortlog/refs/heads/staging/for_v3.5


I have some old stubbed drivers that just works for one frequency using 
combination of RTL2832U + FC2580. Also I have rather well commented USB 
sniff from that device. I can sent those if you wish.

As general instruction try following. It is what I usually do and I 
think many other Linux developers too.

1) take USB sniffs. SniffUSB 2.0.
http://www.pcausa.com/Utilities/UsbSnoop/
2) parse those sniffs using parser.pl script
3) log is still too big due to video stream, remove it
sed -e 's/BULK\[00081\].*$/BULK\[00081\] MPEG2 TS packet data removed/g' 
log.org > log.new
4) now you should have small ~100kB sniff, open it in text editor
5) analyze sniff. find out tuner I2C messages, then demod messages, 
usb-controller messages, etc.
6) make python/perl script to generate C-code like write_regs(0xaa, 
0x12); copy paste that code to driver skeleton until it starts working
7) implement all correctly callback per callback until you are fine with 
code. Most important demod callbacks are .set_frontend() and 
.read_status(). Others are not required, I mean .read_snr(), 
.read_ber(), .read_ucblocks() and .read_signal_strength(). IIRC RTL2830 
.read_status() is similar as RTL2832 and it is already working.

You can copy directly from RTL2830 driver these functions as those are 
similar:
rtl2830_wr()
rtl2830_rd()
rtl2830_wr_regs()
rtl2830_rd_regs()
rtl2830_rd_regs() // oops wrong name
rtl2830_rd_reg()
rtl2830_wr_reg_mask()
rtl2830_rd_reg_mask()

Consider also making making routines for access those "virtual" 
registers as RTL2830/RTL2832 uses "virtual" bit based registers over 
real hardware registers. Some extra work but surely easy many things as 
you don't need to play with bits.
Representation can be made like that or make your own model:
#define REGISTER_NAME <reg page(bank)><physical reg><reg bit MSB><reg 
bit LSB>

regards
Antti
-- 
http://palosaari.fi/

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: RTL28XX driver
  2012-04-11 19:12     ` Antti Palosaari
@ 2012-04-11 21:33       ` Oliver Schinagl
  2012-04-11 21:57         ` Antti Palosaari
  0 siblings, 1 reply; 19+ messages in thread
From: Oliver Schinagl @ 2012-04-11 21:33 UTC (permalink / raw)
  To: Antti Palosaari; +Cc: linux-media

On 04/11/12 21:12, Antti Palosaari wrote:
> On 09.04.2012 15:02, Thomas Mair wrote:
>> thanks for your information. I did get in touch with Realtek and they
>> provided me with the datasheet for the RTL2832U. So what I will try to
>> do is write a demodulator driver for the RTL2832 demod chip following
>> the information of the datasheet and the Realtek driver. I will follow
>> Antti's RTL2830 driver structure.
>>
>> For now there is only one question left regarding the testing of the
>> drivers. What is the best way to test and debug the drivers. Sould I
>> compile the 3.4 kernel and use it, or is it safer to set up a
>> structure like the one I already have to test the driver with a stable
>> kernel?
>
> I vote for cloning Mauro's latest staging Kernel 3.5 and use it.
> http://git.linuxtv.org/media_tree.git/shortlog/refs/heads/staging/for_v3.5
>
>
> I have some old stubbed drivers that just works for one frequency using
> combination of RTL2832U + FC2580. Also I have rather well commented USB
> sniff from that device. I can sent those if you wish.
>
FC2580? Do you have anything for/from that driver? My USB stick as an 
AFA9035 based one, using that specific tuner.

Oliver

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: RTL28XX driver
  2012-04-11 21:33       ` Oliver Schinagl
@ 2012-04-11 21:57         ` Antti Palosaari
  2012-04-12 12:11           ` Oliver Schinagl
  0 siblings, 1 reply; 19+ messages in thread
From: Antti Palosaari @ 2012-04-11 21:57 UTC (permalink / raw)
  To: Oliver Schinagl; +Cc: linux-media

On 12.04.2012 00:33, Oliver Schinagl wrote:
> On 04/11/12 21:12, Antti Palosaari wrote:
>> I have some old stubbed drivers that just works for one frequency using
>> combination of RTL2832U + FC2580. Also I have rather well commented USB
>> sniff from that device. I can sent those if you wish.
>>
> FC2580? Do you have anything for/from that driver? My USB stick as an
> AFA9035 based one, using that specific tuner.

Nothing but stubbed driver that contains static register values taken 
from the sniff and it just tunes to one channel (IIRC 634 MHz / 8 MHz BW).

Feel free to contribute new tuner driver in order to add support for 
your AF9035 device.

regards
Antti
-- 
http://palosaari.fi/

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: RTL28XX driver
  2012-04-11 21:57         ` Antti Palosaari
@ 2012-04-12 12:11           ` Oliver Schinagl
  2012-04-12 12:18             ` Thomas Mair
  0 siblings, 1 reply; 19+ messages in thread
From: Oliver Schinagl @ 2012-04-12 12:11 UTC (permalink / raw)
  To: Antti Palosaari; +Cc: linux-media

Would love to,  even tried a bit, but don't really know how to start, 
what to use as a template. I think I can extract the i2c messages from 
the dreaded ugly af903 driver however, using src or usbsniff.

On 11-04-12 23:57, Antti Palosaari wrote:
> On 12.04.2012 00:33, Oliver Schinagl wrote:
>> On 04/11/12 21:12, Antti Palosaari wrote:
>>> I have some old stubbed drivers that just works for one frequency using
>>> combination of RTL2832U + FC2580. Also I have rather well commented USB
>>> sniff from that device. I can sent those if you wish.
>>>
>> FC2580? Do you have anything for/from that driver? My USB stick as an
>> AFA9035 based one, using that specific tuner.
>
> Nothing but stubbed driver that contains static register values taken 
> from the sniff and it just tunes to one channel (IIRC 634 MHz / 8 MHz 
> BW).
>
> Feel free to contribute new tuner driver in order to add support for 
> your AF9035 device.
>
> regards
> Antti


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: RTL28XX driver
  2012-04-12 12:11           ` Oliver Schinagl
@ 2012-04-12 12:18             ` Thomas Mair
  2012-04-12 12:43               ` Oliver Schinagl
  0 siblings, 1 reply; 19+ messages in thread
From: Thomas Mair @ 2012-04-12 12:18 UTC (permalink / raw)
  To: Oliver Schinagl; +Cc: linux-media

Hi Oliver,

the Realtek driver sources I have also contain a fc2580 driver. Maybe
the source code will help you together with the usb sniff.

2012/4/12 Oliver Schinagl <oliver+list@schinagl.nl>:
> Would love to,  even tried a bit, but don't really know how to start, what
> to use as a template. I think I can extract the i2c messages from the
> dreaded ugly af903 driver however, using src or usbsniff.
>
> On 11-04-12 23:57, Antti Palosaari wrote:
>>
>> On 12.04.2012 00:33, Oliver Schinagl wrote:
>>>
>>> On 04/11/12 21:12, Antti Palosaari wrote:
>>>>
>>>> I have some old stubbed drivers that just works for one frequency using
>>>> combination of RTL2832U + FC2580. Also I have rather well commented USB
>>>> sniff from that device. I can sent those if you wish.
>>>>
>>> FC2580? Do you have anything for/from that driver? My USB stick as an
>>> AFA9035 based one, using that specific tuner.
>>
>>
>> Nothing but stubbed driver that contains static register values taken from
>> the sniff and it just tunes to one channel (IIRC 634 MHz / 8 MHz BW).
>>
>> Feel free to contribute new tuner driver in order to add support for your
>> AF9035 device.
>>

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: RTL28XX driver
  2012-04-12 12:18             ` Thomas Mair
@ 2012-04-12 12:43               ` Oliver Schinagl
  2012-04-12 12:54                 ` Thomas Mair
  0 siblings, 1 reply; 19+ messages in thread
From: Oliver Schinagl @ 2012-04-12 12:43 UTC (permalink / raw)
  To: Thomas Mair; +Cc: linux-media, Antti Palosaari

I accept the challenge :p but where is your fc2580 driver? And in that 
thought, where is antti's stub driver :)

That might help me get started :)

On 12-04-12 14:18, Thomas Mair wrote:
> Hi Oliver,
>
> the Realtek driver sources I have also contain a fc2580 driver. Maybe
> the source code will help you together with the usb sniff.
>
> 2012/4/12 Oliver Schinagl<oliver+list@schinagl.nl>:
>> Would love to,  even tried a bit, but don't really know how to start, what
>> to use as a template. I think I can extract the i2c messages from the
>> dreaded ugly af903 driver however, using src or usbsniff.
>>
>> On 11-04-12 23:57, Antti Palosaari wrote:
>>> On 12.04.2012 00:33, Oliver Schinagl wrote:
>>>> On 04/11/12 21:12, Antti Palosaari wrote:
>>>>> I have some old stubbed drivers that just works for one frequency using
>>>>> combination of RTL2832U + FC2580. Also I have rather well commented USB
>>>>> sniff from that device. I can sent those if you wish.
>>>>>
>>>> FC2580? Do you have anything for/from that driver? My USB stick as an
>>>> AFA9035 based one, using that specific tuner.
>>>
>>> Nothing but stubbed driver that contains static register values taken from
>>> the sniff and it just tunes to one channel (IIRC 634 MHz / 8 MHz BW).
>>>
>>> Feel free to contribute new tuner driver in order to add support for your
>>> AF9035 device.
>>>
> --
> 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


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: RTL28XX driver
  2012-04-12 12:43               ` Oliver Schinagl
@ 2012-04-12 12:54                 ` Thomas Mair
  2012-04-12 13:12                   ` Antti Palosaari
  0 siblings, 1 reply; 19+ messages in thread
From: Thomas Mair @ 2012-04-12 12:54 UTC (permalink / raw)
  To: Oliver Schinagl; +Cc: linux-media, Antti Palosaari

It is not my driver ;) And at the beginning it looks quite scary but
it may help together with the dump. You can find it
here:https://github.com/tmair/DVB-Realtek-RTL2832U-2.2.2-10tuner-mod_kernel-3.0.0/blob/master/RTL2832-2.2.2_kernel-3.0.0/tuner_fc2580.c

2012/4/12 Oliver Schinagl <oliver+list@schinagl.nl>:
> I accept the challenge :p but where is your fc2580 driver? And in that
> thought, where is antti's stub driver :)
>
> That might help me get started :)
>
> On 12-04-12 14:18, Thomas Mair wrote:
>>
>> Hi Oliver,
>>
>> the Realtek driver sources I have also contain a fc2580 driver. Maybe
>> the source code will help you together with the usb sniff.
>>
>> 2012/4/12 Oliver Schinagl<oliver+list@schinagl.nl>:
>>>
>>> Would love to,  even tried a bit, but don't really know how to start,
>>> what
>>> to use as a template. I think I can extract the i2c messages from the
>>> dreaded ugly af903 driver however, using src or usbsniff.
>>>
>>> On 11-04-12 23:57, Antti Palosaari wrote:
>>>>
>>>> On 12.04.2012 00:33, Oliver Schinagl wrote:
>>>>>
>>>>> On 04/11/12 21:12, Antti Palosaari wrote:
>>>>>>
>>>>>> I have some old stubbed drivers that just works for one frequency
>>>>>> using
>>>>>> combination of RTL2832U + FC2580. Also I have rather well commented
>>>>>> USB
>>>>>> sniff from that device. I can sent those if you wish.
>>>>>>
>>>>> FC2580? Do you have anything for/from that driver? My USB stick as an
>>>>> AFA9035 based one, using that specific tuner.
>>>>
>>>>
>>>> Nothing but stubbed driver that contains static register values taken
>>>> from
>>>> the sniff and it just tunes to one channel (IIRC 634 MHz / 8 MHz BW).
>>>>
>>>> Feel free to contribute new tuner driver in order to add support for
>>>> your
>>>> AF9035 device.
>>>>
>> --
>> 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
>
>

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: RTL28XX driver
  2012-04-12 12:54                 ` Thomas Mair
@ 2012-04-12 13:12                   ` Antti Palosaari
  2012-04-18 17:18                     ` Thomas Mair
  0 siblings, 1 reply; 19+ messages in thread
From: Antti Palosaari @ 2012-04-12 13:12 UTC (permalink / raw)
  To: Thomas Mair; +Cc: Oliver Schinagl, linux-media

On 12.04.2012 15:54, Thomas Mair wrote:
> It is not my driver ;) And at the beginning it looks quite scary but
> it may help together with the dump. You can find it
> here:https://github.com/tmair/DVB-Realtek-RTL2832U-2.2.2-10tuner-mod_kernel-3.0.0/blob/master/RTL2832-2.2.2_kernel-3.0.0/tuner_fc2580.c
>
> 2012/4/12 Oliver Schinagl<oliver+list@schinagl.nl>:
>> I accept the challenge :p but where is your fc2580 driver? And in that
>> thought, where is antti's stub driver :)
>>
>> That might help me get started :)
>>
>> On 12-04-12 14:18, Thomas Mair wrote:
>>>
>>> Hi Oliver,
>>>
>>> the Realtek driver sources I have also contain a fc2580 driver. Maybe
>>> the source code will help you together with the usb sniff.
>>>
>>> 2012/4/12 Oliver Schinagl<oliver+list@schinagl.nl>:
>>>>
>>>> Would love to,  even tried a bit, but don't really know how to start,
>>>> what
>>>> to use as a template. I think I can extract the i2c messages from the
>>>> dreaded ugly af903 driver however, using src or usbsniff.
>>>>
>>>> On 11-04-12 23:57, Antti Palosaari wrote:
>>>>>
>>>>> On 12.04.2012 00:33, Oliver Schinagl wrote:
>>>>>>
>>>>>> On 04/11/12 21:12, Antti Palosaari wrote:
>>>>>>>
>>>>>>> I have some old stubbed drivers that just works for one frequency
>>>>>>> using
>>>>>>> combination of RTL2832U + FC2580. Also I have rather well commented
>>>>>>> USB
>>>>>>> sniff from that device. I can sent those if you wish.
>>>>>>>
>>>>>> FC2580? Do you have anything for/from that driver? My USB stick as an
>>>>>> AFA9035 based one, using that specific tuner.
>>>>>
>>>>>
>>>>> Nothing but stubbed driver that contains static register values taken
>>>>> from
>>>>> the sniff and it just tunes to one channel (IIRC 634 MHz / 8 MHz BW).
>>>>>
>>>>> Feel free to contribute new tuner driver in order to add support for
>>>>> your
>>>>> AF9035 device.

Here are my sniffs and stubbed driver etc. what I found from the HD. 
Those well commented sniffs, both RTL2831U and RTL2832U, are surely most 
valuable material.

http://palosaari.fi/linux/v4l-dvb/rtl283xu/

FC2580 can be found from both AF9035 and RTL2832U codes.

Generally, as coding new demod driver for example, you want to use that 
kind of stubbed tuner "driver" for example:


	/* FC0011: 634 MHz / BW 8 MHz */
	struct {
		u8 r[8];
		int len;
	} regs[] = {
		{{ 0x07, 0x0f }, 2 },
		{{ 0x08, 0x3e }, 2 },
		{{ 0x0a, 0xb8 }, 2 },
		{{ 0x0b, 0x80 }, 2 },
		{{ 0x0d, 0x04 }, 2 },
		{{ 0x00, 0x00, 0x05, 0x11, 0xf1, 0xc7, 0x0a, 0x30 }, 8 },
		{{ 0x0e, 0x80 }, 2 },
		{{ 0x0e, 0x00 }, 2 },
		{{ 0x0e, 0x00 }, 2 },
		{{ 0x0e }, 1 },
		{{ 0x06, 0x30 }, 2 },
		{{ 0x0d }, 1 },
		{{ 0x0d, 0x14 }, 2 },
		{{ 0x10, 0x0b }, 2 },
	};

	for (i = 0; i < ARRAY_SIZE(regs); i++) {
		pr_debug("%s: i=%d len=%d data=%02x\n", __func__, i, regs[i].len, 
regs[i].r[0]);
		struct i2c_msg msg[1] = {
			{
				.addr = 0x60,
				.flags = 0,
				.len = regs[i].len,
				.buf = regs[i].r,
			}
		};
		ret = i2c_transfer(state->i2c, msg, 1);
		if (ret != 1)
			pr_debug("%s: I2C write failed i=%d len=%d data=%02x\n", __func__, i, 
regs[i].len, regs[i].r[0]);
	}


regards
Antti
-- 
http://palosaari.fi/

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: RTL28XX driver
  2012-04-12 13:12                   ` Antti Palosaari
@ 2012-04-18 17:18                     ` Thomas Mair
  2012-04-18 17:44                       ` Antti Palosaari
  0 siblings, 1 reply; 19+ messages in thread
From: Thomas Mair @ 2012-04-18 17:18 UTC (permalink / raw)
  To: Antti Palosaari; +Cc: linux-media

I have been working on the driver over the past days and been making
some progress. Right now I am stuck with a small problem that I have
no idea how to deal with.

It seems that the fc0012 tuner supports V-Band and U-Band. To switch
between those modes a GPIO output value needs to be changed. In the
original Realtek driver this is done at the beginning of the
set_parameters callback. Is there a different callback that can be
used for this or is it ok to write a RTL2832u register from the
demodulator code?

Regards
Thomas

2012/4/12 Antti Palosaari <crope@iki.fi>:
> On 12.04.2012 15:54, Thomas Mair wrote:
>>
>> It is not my driver ;) And at the beginning it looks quite scary but
>> it may help together with the dump. You can find it
>>
>> here:https://github.com/tmair/DVB-Realtek-RTL2832U-2.2.2-10tuner-mod_kernel-3.0.0/blob/master/RTL2832-2.2.2_kernel-3.0.0/tuner_fc2580.c
>>
>> 2012/4/12 Oliver Schinagl<oliver+list@schinagl.nl>:
>>>
>>> I accept the challenge :p but where is your fc2580 driver? And in that
>>> thought, where is antti's stub driver :)
>>>
>>> That might help me get started :)
>>>
>>> On 12-04-12 14:18, Thomas Mair wrote:
>>>>
>>>>
>>>> Hi Oliver,
>>>>
>>>> the Realtek driver sources I have also contain a fc2580 driver. Maybe
>>>> the source code will help you together with the usb sniff.
>>>>
>>>> 2012/4/12 Oliver Schinagl<oliver+list@schinagl.nl>:
>>>>>
>>>>>
>>>>> Would love to,  even tried a bit, but don't really know how to start,
>>>>> what
>>>>> to use as a template. I think I can extract the i2c messages from the
>>>>> dreaded ugly af903 driver however, using src or usbsniff.
>>>>>
>>>>> On 11-04-12 23:57, Antti Palosaari wrote:
>>>>>>
>>>>>>
>>>>>> On 12.04.2012 00:33, Oliver Schinagl wrote:
>>>>>>>
>>>>>>>
>>>>>>> On 04/11/12 21:12, Antti Palosaari wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>> I have some old stubbed drivers that just works for one frequency
>>>>>>>> using
>>>>>>>> combination of RTL2832U + FC2580. Also I have rather well commented
>>>>>>>> USB
>>>>>>>> sniff from that device. I can sent those if you wish.
>>>>>>>>
>>>>>>> FC2580? Do you have anything for/from that driver? My USB stick as an
>>>>>>> AFA9035 based one, using that specific tuner.
>>>>>>
>>>>>>
>>>>>>
>>>>>> Nothing but stubbed driver that contains static register values taken
>>>>>> from
>>>>>> the sniff and it just tunes to one channel (IIRC 634 MHz / 8 MHz BW).
>>>>>>
>>>>>> Feel free to contribute new tuner driver in order to add support for
>>>>>> your
>>>>>> AF9035 device.
>
>
> Here are my sniffs and stubbed driver etc. what I found from the HD. Those
> well commented sniffs, both RTL2831U and RTL2832U, are surely most valuable
> material.
>
> http://palosaari.fi/linux/v4l-dvb/rtl283xu/
>
> FC2580 can be found from both AF9035 and RTL2832U codes.
>
> Generally, as coding new demod driver for example, you want to use that kind
> of stubbed tuner "driver" for example:
>
>
>        /* FC0011: 634 MHz / BW 8 MHz */
>        struct {
>                u8 r[8];
>                int len;
>        } regs[] = {
>                {{ 0x07, 0x0f }, 2 },
>                {{ 0x08, 0x3e }, 2 },
>                {{ 0x0a, 0xb8 }, 2 },
>                {{ 0x0b, 0x80 }, 2 },
>                {{ 0x0d, 0x04 }, 2 },
>                {{ 0x00, 0x00, 0x05, 0x11, 0xf1, 0xc7, 0x0a, 0x30 }, 8 },
>                {{ 0x0e, 0x80 }, 2 },
>                {{ 0x0e, 0x00 }, 2 },
>                {{ 0x0e, 0x00 }, 2 },
>                {{ 0x0e }, 1 },
>                {{ 0x06, 0x30 }, 2 },
>                {{ 0x0d }, 1 },
>                {{ 0x0d, 0x14 }, 2 },
>                {{ 0x10, 0x0b }, 2 },
>        };
>
>        for (i = 0; i < ARRAY_SIZE(regs); i++) {
>                pr_debug("%s: i=%d len=%d data=%02x\n", __func__, i,
> regs[i].len, regs[i].r[0]);
>                struct i2c_msg msg[1] = {
>                        {
>                                .addr = 0x60,
>                                .flags = 0,
>                                .len = regs[i].len,
>                                .buf = regs[i].r,
>                        }
>                };
>                ret = i2c_transfer(state->i2c, msg, 1);
>                if (ret != 1)
>                        pr_debug("%s: I2C write failed i=%d len=%d
> data=%02x\n", __func__, i, regs[i].len, regs[i].r[0]);
>        }
>
>
> regards
> Antti
> --
> http://palosaari.fi/

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: RTL28XX driver
  2012-04-18 17:18                     ` Thomas Mair
@ 2012-04-18 17:44                       ` Antti Palosaari
  2012-04-18 18:20                         ` Thomas Mair
  0 siblings, 1 reply; 19+ messages in thread
From: Antti Palosaari @ 2012-04-18 17:44 UTC (permalink / raw)
  To: Thomas Mair; +Cc: linux-media

On 18.04.2012 20:18, Thomas Mair wrote:
> I have been working on the driver over the past days and been making
> some progress. Right now I am stuck with a small problem that I have
> no idea how to deal with.
>
> It seems that the fc0012 tuner supports V-Band and U-Band. To switch
> between those modes a GPIO output value needs to be changed. In the
> original Realtek driver this is done at the beginning of the
> set_parameters callback. Is there a different callback that can be
> used for this or is it ok to write a RTL2832u register from the
> demodulator code?

Aah, I suspect it is antenna switch or LNA GPIO. You don't say what is 
meaning of that GPIO...
If it is FC0012 input, which I think it is not, then you should use FE 
callback (named as callback too) with  DVB_FRONTEND_COMPONENT_TUNER 
param. But I suspect it is not issue.

So lets introduce another solution. It is fe_ioctl_override. Use it.

You will find good examples both cases using following GIT greps
git grep fe_ioctl_override drivers/media
git grep FRONTEND_COMPONENT

Antti
-- 
http://palosaari.fi/

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: RTL28XX driver
  2012-04-18 17:44                       ` Antti Palosaari
@ 2012-04-18 18:20                         ` Thomas Mair
  2012-04-18 18:35                           ` Antti Palosaari
  0 siblings, 1 reply; 19+ messages in thread
From: Thomas Mair @ 2012-04-18 18:20 UTC (permalink / raw)
  To: Antti Palosaari; +Cc: linux-media

I don't know what it really is either but the comments are the following.

if (frequency > 300000000)
{
				
	printk("  %s : Tuner :FC0012 V-band (GPIO6 high)\n", __FUNCTION__);		
}
else
{
	printk("  %s : Tuner :FC0012 U-band (GPIO6 low)\n", __FUNCTION__);	
}

I looked into both mechanisms but can't really decide which one would
be the best one for this. What is the correct ioctl constant to listen
for or do I define an own constant? And how is the ioctl command
issued within the demod driver?

Thomas

2012/4/18 Antti Palosaari <crope@iki.fi>:
> On 18.04.2012 20:18, Thomas Mair wrote:
>>
>> I have been working on the driver over the past days and been making
>> some progress. Right now I am stuck with a small problem that I have
>> no idea how to deal with.
>>
>> It seems that the fc0012 tuner supports V-Band and U-Band. To switch
>> between those modes a GPIO output value needs to be changed. In the
>> original Realtek driver this is done at the beginning of the
>> set_parameters callback. Is there a different callback that can be
>> used for this or is it ok to write a RTL2832u register from the
>> demodulator code?
>
>
> Aah, I suspect it is antenna switch or LNA GPIO. You don't say what is
> meaning of that GPIO...
> If it is FC0012 input, which I think it is not, then you should use FE
> callback (named as callback too) with  DVB_FRONTEND_COMPONENT_TUNER param.
> But I suspect it is not issue.
>
> So lets introduce another solution. It is fe_ioctl_override. Use it.
>
> You will find good examples both cases using following GIT greps
> git grep fe_ioctl_override drivers/media
> git grep FRONTEND_COMPONENT
>
> Antti
> --
> http://palosaari.fi/

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: RTL28XX driver
  2012-04-18 18:20                         ` Thomas Mair
@ 2012-04-18 18:35                           ` Antti Palosaari
  2012-04-18 20:00                             ` Antti Palosaari
  0 siblings, 1 reply; 19+ messages in thread
From: Antti Palosaari @ 2012-04-18 18:35 UTC (permalink / raw)
  To: Thomas Mair; +Cc: linux-media

The method should be selected based of knowledge if GPIO used for 
controlling FC0012 tuner OR controlling some other part (LNA, anatenna 
switch, etc.) So you have to identify meaning first. Look inside FC0012 
driver to see if there is some mention about that GPIO.

UNLESS we cannot identify meaning of GPIO, fe_ioctl_overrid must be used 
(inside rtl28xxu driver). All unknown "hacks" must reside DVB-USB-driver 
(in that case dvb_usb_rtl28xxu) leaving demodulator and tuner drivers clean.

regards
Antti


On 18.04.2012 21:20, Thomas Mair wrote:
> I don't know what it really is either but the comments are the following.
>
> if (frequency>  300000000)
> {
> 				
> 	printk("  %s : Tuner :FC0012 V-band (GPIO6 high)\n", __FUNCTION__);		
> }
> else
> {
> 	printk("  %s : Tuner :FC0012 U-band (GPIO6 low)\n", __FUNCTION__);	
> }
>
> I looked into both mechanisms but can't really decide which one would
> be the best one for this. What is the correct ioctl constant to listen
> for or do I define an own constant? And how is the ioctl command
> issued within the demod driver?
>
> Thomas
>
> 2012/4/18 Antti Palosaari<crope@iki.fi>:
>> On 18.04.2012 20:18, Thomas Mair wrote:
>>>
>>> I have been working on the driver over the past days and been making
>>> some progress. Right now I am stuck with a small problem that I have
>>> no idea how to deal with.
>>>
>>> It seems that the fc0012 tuner supports V-Band and U-Band. To switch
>>> between those modes a GPIO output value needs to be changed. In the
>>> original Realtek driver this is done at the beginning of the
>>> set_parameters callback. Is there a different callback that can be
>>> used for this or is it ok to write a RTL2832u register from the
>>> demodulator code?
>>
>>
>> Aah, I suspect it is antenna switch or LNA GPIO. You don't say what is
>> meaning of that GPIO...
>> If it is FC0012 input, which I think it is not, then you should use FE
>> callback (named as callback too) with  DVB_FRONTEND_COMPONENT_TUNER param.
>> But I suspect it is not issue.
>>
>> So lets introduce another solution. It is fe_ioctl_override. Use it.
>>
>> You will find good examples both cases using following GIT greps
>> git grep fe_ioctl_override drivers/media
>> git grep FRONTEND_COMPONENT
>>
>> Antti
>> --
>> http://palosaari.fi/


-- 
http://palosaari.fi/

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: RTL28XX driver
  2012-04-18 18:35                           ` Antti Palosaari
@ 2012-04-18 20:00                             ` Antti Palosaari
  0 siblings, 0 replies; 19+ messages in thread
From: Antti Palosaari @ 2012-04-18 20:00 UTC (permalink / raw)
  To: Thomas Mair; +Cc: linux-media

On 18.04.2012 21:35, Antti Palosaari wrote:
> The method should be selected based of knowledge if GPIO used for
> controlling FC0012 tuner OR controlling some other part (LNA, anatenna
> switch, etc.) So you have to identify meaning first. Look inside FC0012
> driver to see if there is some mention about that GPIO.

It is tuner VHF/UHF filter(?). You should use frontend callback with 
DVB_FRONTEND_COMPONENT_TUNER and add handler for it. See example from 
FC0011 & AF9035.

regards
Antti
-- 
http://palosaari.fi/

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2012-04-18 20:00 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-06  9:11 RTL28XX driver Thomas Mair
2012-04-06  9:36 ` Antti Palosaari
2012-04-07  7:25 ` poma
2012-04-07 14:19 ` Gianluca Gennari
2012-04-09 12:02   ` Thomas Mair
2012-04-09 15:09     ` Gianluca Gennari
2012-04-11 19:12     ` Antti Palosaari
2012-04-11 21:33       ` Oliver Schinagl
2012-04-11 21:57         ` Antti Palosaari
2012-04-12 12:11           ` Oliver Schinagl
2012-04-12 12:18             ` Thomas Mair
2012-04-12 12:43               ` Oliver Schinagl
2012-04-12 12:54                 ` Thomas Mair
2012-04-12 13:12                   ` Antti Palosaari
2012-04-18 17:18                     ` Thomas Mair
2012-04-18 17:44                       ` Antti Palosaari
2012-04-18 18:20                         ` Thomas Mair
2012-04-18 18:35                           ` Antti Palosaari
2012-04-18 20:00                             ` Antti Palosaari

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.