All of lore.kernel.org
 help / color / mirror / Atom feed
* Fwd: stk1160 linux driver
       [not found] ` <CALF0-+ViQTmGnAS19kOCZPZAj0ZYZX4Ef-+J7A=k1J2OFhFuVg@mail.gmail.com>
@ 2012-06-22 16:23   ` Ezequiel Garcia
       [not found]     ` <CACK0K0j4mSG=EtU1R-VvvoF_5ZCxrTk4p3niyHBt4tAGVdqLVA@mail.gmail.com>
  0 siblings, 1 reply; 11+ messages in thread
From: Ezequiel Garcia @ 2012-06-22 16:23 UTC (permalink / raw)
  To: Gianluca Bergamo; +Cc: linux-media

Gianluca,

Forwarded to linux-media, since it could be interesting
and/or might get some extra help.

Please, keep linux-media in Cc when you reply.

Ezequiel.

---------- Forwarded message ----------
From: Ezequiel Garcia <elezegarcia@gmail.com>
Date: Fri, Jun 22, 2012 at 1:19 PM
Subject: Re: stk1160 linux driver
To: Gianluca Bergamo <gianluca.bergamo@gmail.com>


Hi!

On Fri, Jun 22, 2012 at 9:00 AM, Gianluca Bergamo
<gianluca.bergamo@gmail.com> wrote:
> Dear Ezequiel,
>
> I've found your driver implementation for stk1160 grabber card:
> http://patchwork.linuxtv.org/patch/11575/
>
> I've patched my kernel 3.0.8 and it compiles without problems.
> I've compiled it NOT as a module but directly built in in the kernel.
>
> Now when I insert my grabber card I see only the USB level messages:
>
> [   83.638497] usb 1-1: new high speed USB device number 2 using usb20_otg
> [   83.849347] usb 1-1: New USB device found, idVendor=05e1, idProduct=0408
> [   83.856077] usb 1-1: New USB device strings: Mfr=1, Product=2,
> SerialNumber=0
> [   83.863258] usb 1-1: Product: USB 2.0 Video Capture Controller
> [   83.869634] usb 1-1: Manufacturer: Syntek Semiconductor
>
> VID and PID are ok.
>
> What am I doing wrong?
>

Glad to see someone is using the driver :-)

Why are you compiling it built-in instead of module?
I can't try it right now, but tomorrow I'll compile built-in myself
with 3.0.8 and let you now.

Anyway, send me full dmesg.

Thanks,
Ezequiel.

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

* Re: stk1160 linux driver
       [not found] <CACK0K0gXr08aNe3gKkWXmKkZ+JA0RBcWtq35aFfNaSqCCWMM1Q@mail.gmail.com>
       [not found] ` <CALF0-+ViQTmGnAS19kOCZPZAj0ZYZX4Ef-+J7A=k1J2OFhFuVg@mail.gmail.com>
@ 2012-06-23 13:31 ` Ezequiel Garcia
  1 sibling, 0 replies; 11+ messages in thread
From: Ezequiel Garcia @ 2012-06-23 13:31 UTC (permalink / raw)
  To: Gianluca Bergamo; +Cc: linux-media

Hi Gianluca,

On Fri, Jun 22, 2012 at 9:00 AM, Gianluca Bergamo
<gianluca.bergamo@gmail.com> wrote:
>
> I've patched my kernel 3.0.8 and it compiles without problems.
> I've compiled it NOT as a module but directly built in in the kernel.
>

I just patched a vanilla 3.0.8 (taken from stable repository) with
stk1160 driver
patch and I believe this kernel is too old.

Are you using stock kernel 3.0.8? Are you sure it compiled without any
warnings and/or errors?
I got some missing symbol warnings here when compiling the driver.
This symbols are needed so the driver won't work.

Is it possible for you to try with a 3.3 (or above) kernel?

Thanks,
Ezequiel.

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

* Re: stk1160 linux driver
       [not found]     ` <CACK0K0j4mSG=EtU1R-VvvoF_5ZCxrTk4p3niyHBt4tAGVdqLVA@mail.gmail.com>
@ 2012-06-23 14:08       ` Ezequiel Garcia
       [not found]         ` <CACK0K0hcrTFfUOoDP6RvS8sOXGHGbbG_DSVs-BsSr4tPUQ4uAA@mail.gmail.com>
  2012-06-23 16:01       ` Ezequiel Garcia
  1 sibling, 1 reply; 11+ messages in thread
From: Ezequiel Garcia @ 2012-06-23 14:08 UTC (permalink / raw)
  To: Gianluca Bergamo; +Cc: linux-media

On Sat, Jun 23, 2012 at 10:51 AM, Gianluca Bergamo
<gianluca.bergamo@gmail.com> wrote:
>
> I've found the problem. Your module is lacking the init and exit module
> functions.
> You are using :
>
> module_usb_driver(stk1160_usb_driver);

Indeed.

>
> That has been introduced in kernel 3.3 and so in my kernel 3.0.8 it does not
> give compiler error (I don't know why) but the probe method is never called.

That's weird, I got a bunch of warnings. Compilers are sometimes crazy :-)

> I've added the init and exit methods by myself and the probe now works.
>

Great! Keep in mind I wrote this driver on newer kernels so I don't know
what other kinds of trouble you may bump into.

> My problem now is that I got out of memory errors when testing it with
> yavta.
> BTW, I'm using this driver on an Android 4 ARM device.

What kind of "out of memory errors"? dmesg?
How many memory do you have on your device?

Currently stk1160 dallocate memory for usb transfer buffers on every stop
and has to reallocate on every start.

This approach is not very smart, as fragments memory without reason.
You can take a look at a similar problem on em28xx driver and a patch proposed:

http://patchwork.linuxtv.org/patch/9875/

I'm not telling you this is your problem, but could be.
Anyway, feel free to:
* provide more info
* ask me questions
* ask for patches

> Now I don't have the patch I've made in my hand...but on monday I will send
> it to you.
>

Okey. I guess I could start a github repo to host a 3.0.8 tree with
the stk1160 driver
if that helps you.

Regards,
Ezequiel.

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

* Re: stk1160 linux driver
       [not found]         ` <CACK0K0hcrTFfUOoDP6RvS8sOXGHGbbG_DSVs-BsSr4tPUQ4uAA@mail.gmail.com>
@ 2012-06-23 14:15           ` Ezequiel Garcia
  0 siblings, 0 replies; 11+ messages in thread
From: Ezequiel Garcia @ 2012-06-23 14:15 UTC (permalink / raw)
  To: Gianluca Bergamo; +Cc: linux-media

On Sat, Jun 23, 2012 at 11:11 AM, Gianluca Bergamo
<gianluca.bergamo@gmail.com> wrote:
> I think you can simply make a patch to make it work also with kernels < 3.3.
> Let's talk about this on monday...now I don't have my development pc with me
> so I can't see the code and the dbg messages.

Okey, let's talk on monday.

Regards,
Ezequiel.

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

* Re: stk1160 linux driver
       [not found]     ` <CACK0K0j4mSG=EtU1R-VvvoF_5ZCxrTk4p3niyHBt4tAGVdqLVA@mail.gmail.com>
  2012-06-23 14:08       ` Ezequiel Garcia
@ 2012-06-23 16:01       ` Ezequiel Garcia
       [not found]         ` <CACK0K0i53VJVCVsJy2YGX_pWab0QVSkew5tJL5MQ7CcLyGvjMg@mail.gmail.com>
  1 sibling, 1 reply; 11+ messages in thread
From: Ezequiel Garcia @ 2012-06-23 16:01 UTC (permalink / raw)
  To: Gianluca Bergamo; +Cc: linux-media

Hi Gianluca,

On Sat, Jun 23, 2012 at 10:51 AM, Gianluca Bergamo
<gianluca.bergamo@gmail.com> wrote:
> You are using :
>
> module_usb_driver(stk1160_usb_driver);
>
> That has been introduced in kernel 3.3 and so in my kernel 3.0.8 it does not
> give compiler error (I don't know why) but the probe method is never called.
> I've added the init and exit methods by myself and the probe now works.
>

I think you might want to take a look to media_build:

http://git.linuxtv.org/media_build.git
http://www.linuxtv.org/wiki/index.php/How_to_Obtain,_Build_and_Install_V4L-DVB_Device_Drivers

This allows latest drivers to be built against old kernels.

A "backward-compatible" solution for stk1160 wouldn't be accepted mainline,
but feel free to use (in a personal fashion)
your patched driver and/or ask me to review your patch.

Unfortunately, you'll have to patch yourself each time I release a new
driver version,
so you may wan to try media_build as I previously suggested.

Hope this helps,
Ezequiel.

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

* Re: stk1160 linux driver
       [not found]         ` <CACK0K0i53VJVCVsJy2YGX_pWab0QVSkew5tJL5MQ7CcLyGvjMg@mail.gmail.com>
@ 2012-06-25 14:06           ` Ezequiel Garcia
       [not found]             ` <CACK0K0gTUWgpgErfMfXtQLN2gCW81RPp5yfGghtpigA0ALrm7w@mail.gmail.com>
  2012-07-06 15:15           ` Ezequiel Garcia
  1 sibling, 1 reply; 11+ messages in thread
From: Ezequiel Garcia @ 2012-06-25 14:06 UTC (permalink / raw)
  To: Gianluca Bergamo; +Cc: linux-media

Hi Gianluca,



On Mon, Jun 25, 2012 at 4:09 AM, Gianluca Bergamo
<gianluca.bergamo@gmail.com> wrote:
> Hi Ezequiel,
>
> No problem in patching each new release you made.


Please note I've just send a v3 of stk1160 driver.
It adds support for controlling ac97 and for selecting video inputs.


>
> In my environment this command line gives only one format supported (UYVY)
> and then yavta freezes.
> I suspect it freezes on an ioctl to the driver. I must check it.
>



Weird. I've just tested with yavta and it works perfectly. You should note that
this command is wrong:

./yavta -f YUYV -s 720x576 -n 4 --capture=4 -F /dev/video1

and it should be:

./yavta -f UYVY -s 720x576 -n 4 --capture=4 -F /dev/video1

Since, as you noted the only supported format is UYVY. Some applications take
advantage of libv4l2 wrapper library to increase the output format set.
For instance, if I do ENUM_FMT using v4l2-ctl I get just one supported format:

$ v4l2-ctl --list-formats
ioctl: VIDIOC_ENUM_FMT
	Index       : 0
	Type        : Video Capture
	Pixel Format: 'UYVY'
	Name        : 16 bpp YUY2, 4:2:2, packed

But if I use wrapper library:

$ v4l2-ctl -w --list-formats
ioctl: VIDIOC_ENUM_FMT
	Index       : 0
	Type        : Video Capture
	Pixel Format: 'UYVY'
	Name        : 16 bpp YUY2, 4:2:2, packed

	Index       : 1
	Type        : Video Capture
	Pixel Format: 'RGB3' (emulated)
	Name        : RGB3

	Index       : 2
	Type        : Video Capture
	Pixel Format: 'BGR3' (emulated)
	Name        : BGR3

	Index       : 3
	Type        : Video Capture
	Pixel Format: 'YU12' (emulated)
	Name        : YU12

	Index       : 4
	Type        : Video Capture
	Pixel Format: 'YV12' (emulated)
	Name        : YV12


In case you need it, here's my yavta output:

$ ./yavta --enum-formats /dev/video0
Device /dev/video0 opened.
Device `stk1160' on `usb-0000:00:13.2-2' is a video capture device.
- Available formats:
	Format 0: UYVY (59565955)
	Type: Video capture (1)
	Name: 16 bpp YUY2, 4:2:2, packed

$ ./yavta -f YUYV -s 720x576 -n 4 --capture=4 -F /dev/video0
Device /dev/video0 opened.
Device `stk1160' on `usb-0000:00:13.2-2' is a video capture device.
Unable to set format: Invalid argument (22).
localhost yavta # ./yavta -f UYVY -s 720x576 -n 4 --capture=4 -F /dev/video0
Device /dev/video0 opened.
Device `stk1160' on `usb-0000:00:13.2-2' is a video capture device.
Video format set: UYVY (59565955) 720x480 (stride 1440) buffer size 691200
Video format: UYVY (59565955) 720x480 (stride 1440) buffer size 691200
8 buffers requested.
length: 691200 offset: 0
Buffer 0 mapped at address 0xb7584000.
length: 691200 offset: 692224
Buffer 1 mapped at address 0xb74db000.
length: 691200 offset: 1384448
Buffer 2 mapped at address 0xb7432000.
length: 691200 offset: 2076672
Buffer 3 mapped at address 0xb7389000.
length: 691200 offset: 2768896
Buffer 4 mapped at address 0xb72e0000.
length: 691200 offset: 3461120
Buffer 5 mapped at address 0xb7237000.
length: 691200 offset: 4153344
Buffer 6 mapped at address 0xb718e000.
length: 691200 offset: 4845568
Buffer 7 mapped at address 0xb70e5000.
0 (0) [-] 0 691200 bytes 1340632305.824287 1826.669365 -0.002 fps
1 (1) [-] 1 691200 bytes 1340632305.856350 1826.709943 31.189 fps
2 (2) [-] 1 691200 bytes 1340632305.896222 1826.741385 25.080 fps
3 (3) [-] 2 691200 bytes 1340632305.928226 1826.773354 31.246 fps
Captured 4 frames in 0.199372 seconds (20.062936 fps, 13867501.311552 B/s).
8 buffers released.

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

* Re: stk1160 linux driver
       [not found]             ` <CACK0K0gTUWgpgErfMfXtQLN2gCW81RPp5yfGghtpigA0ALrm7w@mail.gmail.com>
@ 2012-06-25 14:11               ` Ezequiel Garcia
       [not found]                 ` <CACK0K0iPht7n4oxyR68zzz=Emau7kFNs0b3ooBwMn83_GVZnDw@mail.gmail.com>
  0 siblings, 1 reply; 11+ messages in thread
From: Ezequiel Garcia @ 2012-06-25 14:11 UTC (permalink / raw)
  To: Gianluca Bergamo; +Cc: linux-media

On Mon, Jun 25, 2012 at 11:09 AM, Gianluca Bergamo
<gianluca.bergamo@gmail.com> wrote:
> Hi Ezequiel,
>
> Have you tested with the latest version of your driver? Where can I download
> it?

http://patchwork.linuxtv.org/patch/13043/

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

* Re: stk1160 linux driver
       [not found]                 ` <CACK0K0iPht7n4oxyR68zzz=Emau7kFNs0b3ooBwMn83_GVZnDw@mail.gmail.com>
@ 2012-06-25 14:36                   ` Ezequiel Garcia
  2012-06-25 14:47                     ` Devin Heitmueller
  0 siblings, 1 reply; 11+ messages in thread
From: Ezequiel Garcia @ 2012-06-25 14:36 UTC (permalink / raw)
  To: Gianluca Bergamo; +Cc: linux-media, Devin Heitmueller

On Mon, Jun 25, 2012 at 11:26 AM, Gianluca Bergamo
<gianluca.bergamo@gmail.com> wrote:
> Thank you.
> I'm going to test it as soon as I can.
>
> PS : Are you testing on ARM architecture? I'm starting to think my problems
> could be related to it...as most of the video capture drivers are working
> well on x86...is it possible for you to do a little test on ARM?
>

No :-(
However, if you have a small ARM device you'd like to donate I'll give
it good use :-)

Anyway, this thread suggests there are some issues with analog capture on ARM
devices (using em28xx driver, but it's similar to stk1160):

http://comments.gmane.org/gmane.linux.drivers.video-input-infrastructure/48009

I've added Devin in Cc:
Devin: You said you ran into some issues on em28xx on ARM, what kind
of issues?

Thanks,
Ezequiel.

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

* Re: stk1160 linux driver
  2012-06-25 14:36                   ` Ezequiel Garcia
@ 2012-06-25 14:47                     ` Devin Heitmueller
  2012-06-29 20:12                       ` Ezequiel Garcia
  0 siblings, 1 reply; 11+ messages in thread
From: Devin Heitmueller @ 2012-06-25 14:47 UTC (permalink / raw)
  To: Ezequiel Garcia; +Cc: Gianluca Bergamo, linux-media

On Mon, Jun 25, 2012 at 10:36 AM, Ezequiel Garcia <elezegarcia@gmail.com> wrote:
> I've added Devin in Cc:
> Devin: You said you ran into some issues on em28xx on ARM, what kind
> of issues?

There are a handful of issues, but the big one which everybody runs
into is a typo in a left shift operation that causes capture to be
completely broken on ARM.  I just never got around to sending a patch
upstream for it.

I don't know if this is the original report, but the issue is
summarized well here:

http://www.mail-archive.com/linux-omap@vger.kernel.org/msg28407.html

Others issue related to memory allocation on platforms like ARM with
limited coherent memory (if the device is unplugged/replugged often,
the device won't be able to allocate the URB buffers), as well as
performance problems related to the type of memory used (dependent on
which ARM chip is used).

Most of this stuff is relatively straightforward to fix but I've just
been too busy with other projects.

Devin

-- 
Devin J. Heitmueller - Kernel Labs
http://www.kernellabs.com

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

* Re: stk1160 linux driver
  2012-06-25 14:47                     ` Devin Heitmueller
@ 2012-06-29 20:12                       ` Ezequiel Garcia
  0 siblings, 0 replies; 11+ messages in thread
From: Ezequiel Garcia @ 2012-06-29 20:12 UTC (permalink / raw)
  To: Gianluca Bergamo; +Cc: linux-media, Devin Heitmueller

Hey Gianluca,

On Mon, Jun 25, 2012 at 11:47 AM, Devin Heitmueller
<dheitmueller@kernellabs.com> wrote:
> On Mon, Jun 25, 2012 at 10:36 AM, Ezequiel Garcia <elezegarcia@gmail.com> wrote:
> Others issue related to memory allocation on platforms like ARM with
> limited coherent memory (if the device is unplugged/replugged often,
> the device won't be able to allocate the URB buffers), as well as

As Devin says there maybe some issues with memory allocation I've added a
module parameter for stk1160 named "keep_buffers" that could be used to reduce
memory fragmentation.

You may want to test the latest patch:
http://patchwork.linuxtv.org/patch/13148/

If you have any problems/questions feel free to ask.

Thanks,
Ezequiel.

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

* Re: stk1160 linux driver
       [not found]         ` <CACK0K0i53VJVCVsJy2YGX_pWab0QVSkew5tJL5MQ7CcLyGvjMg@mail.gmail.com>
  2012-06-25 14:06           ` Ezequiel Garcia
@ 2012-07-06 15:15           ` Ezequiel Garcia
  1 sibling, 0 replies; 11+ messages in thread
From: Ezequiel Garcia @ 2012-07-06 15:15 UTC (permalink / raw)
  To: Gianluca Bergamo; +Cc: linux-media, Devin Heitmueller

Gianluca,

On Mon, Jun 25, 2012 at 4:09 AM, Gianluca Bergamo
<gianluca.bergamo@gmail.com> wrote:

> In my environment this command line gives only one format supported (UYVY)
> and then yavta freezes.
> I suspect it freezes on an ioctl to the driver. I must check it.
>

This freezing is actually a dead lock, and I think it's not related to
ARM but to a (now fixed) bug.

The bug was related to differences in locking scheme between v3.2 and
v3.4 kernel,
i.e. to make stk1160 work on v3.2 some fixes are needed, beside your
"module_usb_driver"
patch.

If you (or anyone) wants to use stk1160 on current kernels (3.2 and such) you
can checkout this github tree I've prepared to help user adoption of stk1160.

This is current (beta tested) branch:
https://github.com/ezequielgarcia/stk1160-standalone

And this is with "keep_buffers" parameter:
https://github.com/ezequielgarcia/stk1160-standalone/tree/0.9.4_v3.2

I don't know if you're still interested in using stk1160, but I wanted you to be
aware of this issue. As far as I know, there shouldn't be any issues
with ARM; if you can confirm this we'd appreciate it.

Regards,
Ezequiel.

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

end of thread, other threads:[~2012-07-06 15:15 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CACK0K0gXr08aNe3gKkWXmKkZ+JA0RBcWtq35aFfNaSqCCWMM1Q@mail.gmail.com>
     [not found] ` <CALF0-+ViQTmGnAS19kOCZPZAj0ZYZX4Ef-+J7A=k1J2OFhFuVg@mail.gmail.com>
2012-06-22 16:23   ` Fwd: stk1160 linux driver Ezequiel Garcia
     [not found]     ` <CACK0K0j4mSG=EtU1R-VvvoF_5ZCxrTk4p3niyHBt4tAGVdqLVA@mail.gmail.com>
2012-06-23 14:08       ` Ezequiel Garcia
     [not found]         ` <CACK0K0hcrTFfUOoDP6RvS8sOXGHGbbG_DSVs-BsSr4tPUQ4uAA@mail.gmail.com>
2012-06-23 14:15           ` Ezequiel Garcia
2012-06-23 16:01       ` Ezequiel Garcia
     [not found]         ` <CACK0K0i53VJVCVsJy2YGX_pWab0QVSkew5tJL5MQ7CcLyGvjMg@mail.gmail.com>
2012-06-25 14:06           ` Ezequiel Garcia
     [not found]             ` <CACK0K0gTUWgpgErfMfXtQLN2gCW81RPp5yfGghtpigA0ALrm7w@mail.gmail.com>
2012-06-25 14:11               ` Ezequiel Garcia
     [not found]                 ` <CACK0K0iPht7n4oxyR68zzz=Emau7kFNs0b3ooBwMn83_GVZnDw@mail.gmail.com>
2012-06-25 14:36                   ` Ezequiel Garcia
2012-06-25 14:47                     ` Devin Heitmueller
2012-06-29 20:12                       ` Ezequiel Garcia
2012-07-06 15:15           ` Ezequiel Garcia
2012-06-23 13:31 ` Ezequiel Garcia

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.