sun7i_tvd and cubietruck A20

1,689 views
Skip to first unread message

abel...@rioservice.com

unread,
Nov 7, 2013, 10:46:06 AM11/7/13
to linux...@googlegroups.com
I have successfuly compiled and modprobe'd sun7i_tvd driver into linux-sunxi 3.4 on a cubietruck A20.

I noticed that after load the driver only one video device (/dev/video1) is exposed to the system, but cubietruck A20 has four video inputs (TV0 to TV3).

Is /dev/video1 a single device with four channels or this a limitation of the driver and I will be able to see only one input ?

Regads,
Antonio Belloni

Enrico

unread,
Nov 7, 2013, 1:02:09 PM11/7/13
to linux...@googlegroups.com

You set up the driver with some ioctls to "enable" 1,2, 3 or 4 inputs that will be combined in a single frame, that you will get from video1.

That's what i understood from the sample test program but i couldn't get it to work, i always get a completely blue frame. Did you get any useful video data?

Enrico

abel...@rioservice.com

unread,
Nov 7, 2013, 2:03:03 PM11/7/13
to linux...@googlegroups.com
Enrico,

thank you for your help. Can we detail how to setup the driver ? Do I need to change something on the source code ?

I didn't get any video at all, not even a blue screen. I am testing with V4L2 test programs. What program are you using to test the driver ?

Regards,
Antonio Belloni

Enrico

unread,
Nov 7, 2013, 5:11:32 PM11/7/13
to linux...@googlegroups.com
Il giorno giovedì 7 novembre 2013 20:03:03 UTC+1, abel...@rioservice.com ha scritto:
Enrico,

thank you for your help. Can we detail how to setup the driver ? Do I need to change something on the source code ?

I didn't get any video at all, not even a blue screen. I am testing with V4L2 test programs. What program are you using to test the driver ?



V4L2 test programs will not work, the driver needs an ad-hoc setup (unless you have a better driver than what i found).

Have a look at [1], it's a test program i found on cubieforums. Captures from TVIN and outputs to HDMI.
The "setup" is done with V4L2_BUF_TYPE_PRIVATE ioctl.

Enrico

[1]: https://github.com/ebutera/sunxi-tvin

abel...@rioservice.com

unread,
Nov 8, 2013, 8:23:26 AM11/8/13
to linux...@googlegroups.com
Enrico,

The driver that I have is the same version you have. I copied it from leeche-3.3.

I will download the programs you sent and will let you know if its working.

Thank you for your help.

Regards,
Antonio Belloni

abel...@rioservice.com

unread,
Nov 8, 2013, 12:30:57 PM11/8/13
to linux...@googlegroups.com
Hi Enrico,

I have compile sunxi-tvd and when I run the test program I am getting the error :

(NULL *) dma_alloc_coherent....

I have seen in another post in the forum that you have solved this problem passing the device name to dma_alloc_coherent.  

Did you change the following line at drv_tvd.c and changed the third parameter from NULL to something else :

videobuf_queue_dma_contig_init(&dev->vb_vidq, &video_qops,

                        NULL, &dev->slock, V4L2_BUF_TYPE_VIDEO_CAPTURE,

                        V4L2_FIELD_NONE,

                        sizeof(struct buffer), dev,NULL); */


I have seen in the videobuf_queue_dma_contig_init third parameter should be of type (struct device *), but struct device is defined in several *.h files of the source.


Can you help me with this issue ?


Regards,

Antonio Belloni

abel...@rioservice.com

unread,
Nov 8, 2013, 2:03:01 PM11/8/13
to linux...@googlegroups.com
Well, answering my own question. I changed the third parameter NULL in 

videobuf_queue_dma_contig_init(&dev->vb_vidq, &video_qops,

                        NULL, &dev->slock, V4L2_BUF_TYPE_VIDEO_CAPTURE,

                        V4L2_FIELD_NONE,

                        sizeof(struct buffer), dev,NULL);


to &pdev->dev and now the dma_alloc_coeherent is getting the device name (tvd) correctly. But I am still getting error dma_alloc_coehernet size 2764800 failed when I try to run the test program. I have already resized DEFAULT_CONSISTENT_DMA_SIZE to 4M but it is not working yet. I will resize it to a higher value and see what happens.

Sorry to bother you with my silly questions and thank you for your help.

Regards,
Antonio Belloni

Enrico

unread,
Nov 9, 2013, 7:05:05 AM11/9/13
to linux...@googlegroups.com
Il giorno venerdì 8 novembre 2013 20:03:01 UTC+1, abel...@rioservice.com ha scritto:
Well, answering my own question. I changed the third parameter NULL in 

videobuf_queue_dma_contig_init(&dev->vb_vidq, &video_qops,

                        NULL, &dev->slock, V4L2_BUF_TYPE_VIDEO_CAPTURE,

                        V4L2_FIELD_NONE,

                        sizeof(struct buffer), dev,NULL);


to &pdev->dev and now the dma_alloc_coeherent is getting the device name (tvd) correctly. But I am still getting error dma_alloc_coehernet size 2764800 failed when I try to run the test program. I have already resized DEFAULT_CONSISTENT_DMA_SIZE to 4M but it is not working yet. I will resize it to a higher value and see what happens.



I used 4M too, with 3 buffers it should be enough but for testing you can set it higher just to be sure.

And maybe you need to set the dma mask in drv_tvd.c:

 static struct platform_device tvd_device = {
        .name                   = "tvd",
         .id                    = -1,//??
        .num_resources          = ARRAY_SIZE(tvd_resource),
         .resource              = tvd_resource,
-       .dev                    = {}
+       .dev                    = {
+               .coherent_dma_mask = DMA_BIT_MASK(32),
+}

Enrico

ashwi...@gmail.com

unread,
Nov 11, 2013, 3:47:47 AM11/11/13
to linux...@googlegroups.com

What can you find the sun7i_tvd drive where?

abel...@rioservice.com

unread,
Nov 11, 2013, 1:07:53 PM11/11/13
to linux...@googlegroups.com, ashwi...@gmail.com

abel...@rioservice.com

unread,
Nov 11, 2013, 1:14:43 PM11/11/13
to linux...@googlegroups.com
Hi Enrico,

Any progress with this driver ?

I have fixed all the bugs and now I can load the driver with no errors whatsoever.  But sunxi-tvin only shows a box full of static, like a broken tv, and on the console I can see the error "select timeout", which is raised by the select system call, indicating that there is no input from the file descriptor of /dev/video1.

I have tried with no camera connect to the board and then tried a camera on each one of the four pins (18,20,22 and 24) of CN9, but the results are always the same, only the static-box-broken-tv.

Have you seen something like this ?

Regards,
Antonio Belloni

Enrico

unread,
Nov 12, 2013, 6:48:15 PM11/12/13
to linux...@googlegroups.com
Il giorno lunedì 11 novembre 2013 19:14:43 UTC+1, abel...@rioservice.com ha scritto:
Hi Enrico,

Any progress with this driver ?

I have fixed all the bugs and now I can load the driver with no errors whatsoever.  But sunxi-tvin only shows a box full of static, like a broken tv, and on the console I can see the error "select timeout", which is raised by the select system call, indicating that there is no input from the file descriptor of /dev/video1.

I have tried with no camera connect to the board and then tried a camera on each one of the four pins (18,20,22 and 24) of CN9, but the results are always the same, only the static-box-broken-tv.

Have you seen something like this ?


Yes, it means it's not working! The best i could get was a blue frame instead of "broken tv"....

Anyway the driver needs major reworking, but without a working starting point we don't know if the register settings are ok (bsp_drv.c) so it's useless to clean it up.

If someone has a contact in allwinner it could be useful to ask for some docs about it.

Enrico

abel...@rioservice.com

unread,
Nov 13, 2013, 8:33:14 AM11/13/13
to linux...@googlegroups.com
Hi Enrico,

Thank you for your information.

I found this document http://dl.linux-sunxi.org/A20/A20%20User%20Manual%202013-03-22.pdf on linux-sunxi but it only shows the TV Encoder (CVBS output) information. There is nothing about the TV Decoder (CVBS input).

I will try to contact the Allwinner staff and ask about drivers and tv decoder documentation.

Regards,
Antonio Belloni

za...@mail.ru

unread,
Jan 22, 2014, 11:06:37 PM1/22/14
to linux...@googlegroups.com
Hi masters.
I'd like to ask you about your progress with a sun7i_tvd driver....
I tried but haven't got any answer from A20-boards suppliers.
The strange situations...
( I don't found the driver in ....linux-sunxi-sunxi 3.4, only in ...linux-sunxi-import-lichee-3.3-a20-dev.
What means that in forther release it was removed ?? )
So what do you think is it a chance to get a working TVins in Allwinner (the only interesting feature of this SoC) ?
Best regards, Vladimir.

Olliver Schinagl

unread,
Jan 23, 2014, 4:59:16 AM1/23/14
to linux...@googlegroups.com
Hey vladimir

On 23-01-14 05:06, za...@mail.ru wrote:
> Hi masters.
> I'd like to ask you about your progress with a sun7i_tvd driver....
none, nobody is working on it.
> I tried but haven't got any answer from A20-boards suppliers.
They dont' know, nor care about customers; they just sell you their
crap; and that's that. They rely on Allwinner supplied BBSP.
> The strange situations...
as usual :)
> ( I don't found the driver in ....linux-sunxi-sunxi 3.4, only in ...linux-sunxi-import-lichee-3.3-a20-dev.
sunxi-3.4 is our community maintained driver; lichee-3.3 is allwinner
supplied BSP driver, they have a driver, we don't
> What means that in forther release it was removed ?? )
No, that means, we haven't ported their driver yet. We'll be looking
forward for your patch :)
> So what do you think is it a chance to get a working TVins in Allwinner (the only interesting feature of this SoC) ?
0 - 100 %. If you put in the effort in porting it; we can add it and
it's good. Otherwise, it requires someone interested to port the driver.
> Best regards, Vladimir.

Make sure to check out the community wiki, http://linux-sunxi.org

Oliver

>

Rosimildo DaSilva

unread,
Jan 23, 2014, 10:27:42 AM1/23/14
to linux...@googlegroups.com, olive...@schinagl.nl
As Enrico said earlier in this thread, it is pointless to start any work without a "working setup", even if using blobs from AW drops and using their distro.

All we have are 4 pins that we don't even know if more than a resistor and a connector is required, which TV modes are supported, etc.

Without a proper documentation and a working system, it is hard to start.

The boards providers should at least provide examples of working prototypes, even if crap drivers... but not even that is provided.

R

vova brovkovich

unread,
Jan 27, 2014, 9:33:17 AM1/27/14
to linux...@googlegroups.com, olive...@schinagl.nl, rosi...@gmail.com
Hi masters.
Thanks for reply, even so sad.
Yes information is weak, and one that is available, morely puts questions rather than gets answers.
Had you tried to get more documentation from Allwinner ?
Is it realistic ?
I have wrote them but no reply  ( yet ? ).
Vladimir. 


Четверг, 23 января 2014, 7:27 -08:00 от Rosimildo DaSilva <rosi...@gmail.com>:
--
You received this message because you are subscribed to a topic in the Google Groups "linux-sunxi" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/linux-sunxi/9dAldgInrkw/unsubscribe.
To unsubscribe from this group and all of its topics, send an email to linux-sunxi...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


--
Vova Brovkovich

Rosimildo DaSilva

unread,
Apr 14, 2014, 12:01:19 PM4/14/14
to linux...@googlegroups.com
Hi there,

I am wondering if these is any progress on this. I've got a NTSC Security Camera around, and I am thinking of hooking it up to tvin line, using a 75 ohms resistor to ground. 

It would be nice if we had more info on the manual or even a working driver.....

R

hadi.za...@gmail.com

unread,
Aug 10, 2014, 4:22:35 PM8/10/14
to linux...@googlegroups.com
در دوشنبه 14 آوریل 2014، ساعت 20:31:19 (UTC+4:30)، Rosimildo DaSilva نوشته:
Which means that a company produces a product that does not provide information in detail

hadi.za...@gmail.com

unread,
Nov 9, 2014, 5:48:01 PM11/9/14
to linux...@googlegroups.com
در پنجشنبه 7 نوامبر 2013، ساعت 19:16:06 (UTC+3:30)، abel...@rioservice.com نوشته:
what does it mean?
http://linux-sunxi.org/Linux_mainlining_effort

please see here
TV Decoder
Analog in, no driver, no datasheet


ckc...@gmail.com

unread,
Nov 26, 2015, 3:57:58 AM11/26/15
to linux-sunxi, hadi.za...@gmail.com
If you see the only blue screen, you should check the hardware on video line.
Refer to the follow.
camera ------ pull-down register (75ohm) ----- serial capacitor (1uF) ------ A20

good luck!

milosla...@gmail.com

unread,
Mar 28, 2016, 12:17:09 PM3/28/16
to linux-sunxi, hadi.za...@gmail.com
Nanxi did you get the picture?

marti...@googlemail.com

unread,
May 8, 2016, 3:29:28 AM5/8/16
to linux-sunxi
Hi,

did someone tested it with armbian and a 3.4.112 kernel?

milosla...@gmail.com

unread,
May 9, 2016, 4:39:23 AM5/9/16
to linux-sunxi, marti...@googlemail.com
On Sunday, May 8, 2016 at 9:29:28 AM UTC+2, marti...@googlemail.com wrote:
> Hi,
>
> did someone tested it with armbian and a 3.4.112 kernel?

Hi,
I tested it with kernel 3.4.75 and it works after patch.
You need to patch your version with this patch https://github.com/meantone/sunxi-tvin
And it should work..:)

Good luck!
Milos,

marcus...@gmail.com

unread,
Jul 14, 2016, 4:32:55 AM7/14/16
to linux-sunxi, marti...@googlemail.com, milosla...@gmail.com
Do you think is it possible to A20 to capture simultaneously videos from four analog video cameras through the four analog video inputs, encode them in H.264 and record them on a SDCard ?

milosla...@gmail.com

unread,
Jul 14, 2016, 7:57:15 AM7/14/16
to linux-sunxi, marti...@googlemail.com, milosla...@gmail.com, marcus...@gmail.com
Hi,
i think that it is possible.
Currently in my test app reading from one analog channel and putting it to LCD display with customized window position and resolution load 1-2% of CPU.. so you need to add h264 encoding which because it is HW encoding also load just few CPU percent. Convert it to some container and save to SD card..
For now only restriction is simultaneous cedar encoding decoding..

Best regards,
Milos

Mohammad Efatpanah

unread,
Jul 7, 2018, 11:05:24 AM7/7/18
to linux-sunxi
hi Milos:
How can I compile and run tvin-hdmi.c (ebutera) in android 4.2 cubieboard ?
Thanks...

Mohammad Efatpanah

unread,
Jul 7, 2018, 11:05:24 AM7/7/18
to linux-sunxi
Hi:
how can i compile and modprobe on cubieboard A20 android4.2 ?
Thanks...
Reply all
Reply to author
Forward
0 new messages