v4l2 framework in a multiple thread environment

2014-04-04 Thread m silverstri
Hi, I am writing a driver using v4l2 framework. I want to know does v4l2 framework make my driver thread-safe? What if multiple threads try to * open the driver * enqueue/dequeue buffer * run device_run at the same time. Do I need to add mutex myself? Of all the hooks I provide to v4l2 framework

How to use sparse to check my driver

2014-03-11 Thread m silverstri
I am trying to use sparse to check my driver that I developed. From http://kernelnewbies.org/Sparse, It said 'make C=2 drivers/staging/wlan-ng/', what does it check it I do 'make C=2' and how does it actually call 'spare'? Do I need to modify my Makefile to add a new target or something? Thank

How to check if my kernel driver is leaking memory

2014-03-09 Thread m silverstri
Hi, I am developing a kernel driver. What should I test to make sure my kernel driver is not leaking memory? 1. under normal operation (when applications open and close my driver properly) 2. in error situation (when application open my driver and then it crashes without close my driver property)

How to use pr_debug

2014-02-26 Thread m silverstri
I am using 'pr_debug()' to print debug statements. But I don't see anything in my serial console. But when I use pr_info(), I see the debug statements. Do I need to do anything to see pr_debug()? Thank you. ___ Kernelnewbies mailing list

How to invalidate cache in kernel driver?

2014-02-13 Thread m silverstri
I have an output buffer in my kernel driver. And that share with my hardware, which uses it for output. When I got an interrupt, the kernel driver will copy the data from the output buffer to user space buffer. How can I invalidate cache after my kernel driver copy the output buffer?

cache coherency guidelines for DMA buffer

2014-02-08 Thread m silverstri
Hi, I create DMA buffer in my kernel driver. I would like to know what is cache coherency guidelines for DMA buffer referred by this post? http://stackoverflow.com/questions/5564326/linux-kernel-device-driver-to-dma-into-kernel-space Both my kernel driver and HW writes to the DMA buffer. I wnat

How can I get physical address from a struct dma_buf

2014-02-07 Thread m silverstri
Hi, If I have a struct dma_buf dma buffer, how can I the physical address? ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

Flush cache for memory allocated by kmalloc

2014-02-06 Thread m silverstri
Hi, I allocate memory in my driver and I passed this address to my HW register to write to. My question is when the HW done writing (my driver get notified by an interrupt). How can I flush the cache so that my driver can see what has been written by the HW? Thank you.

16-Byte aligned memory allocated in user space and then

2014-02-05 Thread m silverstri
Hi, If I allocated memory in user space and make it 16 byte aligned memory, and then pass it to kernel and setup DMA for my kernel driver, will my kernel driver still see the memory in 16-Byte aligned memory? The hard that my kernel driver takes to need 16-Byte aligned memory. Thank you.

How to allocate memory and get the physical address in kernel

2014-02-05 Thread m silverstri
Hi, I am developing a kernel driver. I need to allocate buffer in the kernel driver and pass the physical address of the buffer to the Chip register so that it can generate output there. I tried using kmalloc() but I don' get any output from the chip. Is there a better way to achieve what I

How to map more than 1 page of buffer to kernel address?

2014-02-04 Thread m silverstri
Hi, I need to map an buffer object to kernel address. What should I buffer is more than 1 page and I want to map the whole buffer to the kernel address? https://www.kernel.org/doc/htmldocs/device-drivers/API-dma-buf-kmap.html dma_buf_kmap -- Map a page of the buffer object into kernel address

Re: Question about using spinlock to synchronize between kernel driver and an interrupt handler

2014-02-03 Thread m silverstri
AM, Arun KS getaru...@gmail.com wrote: Hi Silverstri, On Sun, Feb 2, 2014 at 1:19 PM, m silverstri michael.j.silvers...@gmail.com wrote: On Sat, Feb 1, 2014 at 5:34 AM, Josh Cartwright jo...@eso.teric.us wrote: On Sat, Feb 01, 2014 at 01:32:49AM -0800, anish singh wrote: On Sat, Feb 1

Re: Question about using spinlock to synchronize between kernel driver and an interrupt handler

2014-02-02 Thread m silverstri
On Sat, Feb 1, 2014 at 5:34 AM, Josh Cartwright jo...@eso.teric.us wrote: On Sat, Feb 01, 2014 at 01:32:49AM -0800, anish singh wrote: On Sat, Feb 1, 2014 at 1:15 AM, m silverstri michael.j.silvers...@gmail.com wrote: By driver code , I mean the code which set the register values and wait

Re: Question about using spinlock to synchronize between kernel driver and an interrupt handler

2014-02-01 Thread m silverstri
On Sat, Feb 1, 2014 at 12:48 AM, anish singh anish198519851...@gmail.com wrote: On Sat, Feb 1, 2014 at 12:32 AM, m silverstri michael.j.silvers...@gmail.com wrote: don't top-post In my driver code, I want to set a bit in a HW Register 1. HW will send an interrupt Yes this is how most

Re: Question about using spinlock to synchronize between kernel driver and an interrupt handler

2014-02-01 Thread m silverstri
By driver code , I mean the code which set the register values and wait till the values is set (via an interrupt handler) before continues doing something else On Sat, Feb 1, 2014 at 1:06 AM, anish singh anish198519851...@gmail.com wrote: On Sat, Feb 1, 2014 at 1:03 AM, m silverstri

malloc memory to be 32 byte aligned in kernel

2014-01-28 Thread m silverstri
Hi, I am writing a kernel driver, can you please tell me how can I allocate a buffer which is 32 byte aligned? Thank you. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

Re: malloc memory to be 32 byte aligned in kernel

2014-01-28 Thread m silverstri
said: On Tue, Jan 28, 2014 at 11:20 AM, m silverstri michael.j.silvers...@gmail.com wrote: Hi, I am writing a kernel driver, can you please tell me how can I allocate a buffer which is 32 byte aligned? malloc already aligns memory for basic data types AFAIK Yes, but even if it allocates

How does request io memory region works

2014-01-28 Thread m silverstri
I am trying to understand the following driver code. In the probe function, i think it tries to map memory region for the driver so that the driver can access the hardware register. Please correct me if I am wrong. My question is where does it specifies the address of the registers for the driver

How to use memcpy in kernel driver

2014-01-27 Thread m silverstri
Hi, How can I use memcoyp in memcpy? I try #include stdio.h and string.h, but .h fails to include during compilation. Can you please help me? Thank you. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org

How about using dma_buf_kmap

2014-01-24 Thread m silverstri
Hi, I need help in using dma_buf_kmap. https://www.kernel.org/doc/htmldocs/device-drivers/API-dma-buf-kmap.html I create a dma buffer in user side, size is 307200 and I want to map that to kernel so that my driver can access it. I have a dma_buf pointer, so I think I need to use dma_buf_kmap.

Question about v4l2 mem2mem driver mem_ops

2014-01-17 Thread m silverstri
Hi, I am working on v4l2 mem2mem driver. I think the sequence of using a V4L2 codec mem2mem driver from user space side is like this: 1. queue buffer for input buffer 2. queue buffer for output buffer 3. Streamon Output plane 4. Streamoff Capture plane 5. dequeue buffer for input buffer 6.

kernel driver access application memory

2014-01-15 Thread m silverstri
Hi, If my application allocate memory for input and output buffers, and pass the pointer to a kernel driver (via v4l2 queue buffer operation), can the kernel driver access it? Do I need to setup DMA before teh kernel driver can read/write to it? Thank you.

Setting config when using 'make menuconfig'

2014-01-10 Thread m silverstri
I create a new config with my Kconfig, like this: config VIDEO_MY_DRIVER bool my driver default y depends on VIDEO_DEV VIDEO_V4L2 select V4L2_MEM2MEM_DEV ---help--- This is a my driver When I run 'make menuconfig' and when I search for 'CONFIG_VIDEO_MY_DRIVER', I See

Re: Setting config when using 'make menuconfig'

2014-01-10 Thread m silverstri
: On 10 Jan 2014 20:52, m silverstri michael.j.silvers...@gmail.com wrote: When I run 'make menuconfig' and when I search for 'CONFIG_VIDEO_MY_DRIVER', I See it. Symbol: VIDEO_MY_DRIVER [=n] │ Type : boolean │ Prompt: my driver │ │ Location: │ - Device Drivers │ (1

Re: Setting config when using 'make menuconfig'

2014-01-10 Thread m silverstri
. no Location in search result) Thanks. On Fri, Jan 10, 2014 at 12:33 PM, Anders Darander anders.daran...@gmail.com wrote: On 10 Jan 2014 21:10, m silverstri michael.j.silvers...@gmail.com wrote: Thanks. Under which menu/sub-menu are there Configuration I should go and enable them? I'm

Re: How does module_init(jpeg_init) get called

2014-01-09 Thread m silverstri
usermodehelper_enable(); 792 do_initcalls(); 793 random_int_secret_init(); 794 } Regards, MH On Thu, Jan 9, 2014 at 10:25 AM, m silverstri michael.j.silvers...@gmail.com wrote: Hi, In a kernel driver code, I see it has 'module_init(jpeg_init)' and 'module_exit(jpeg_exit)'. I would

Need help in enable configuration when compile Kernel module

2014-01-09 Thread m silverstri
I am using 3.10.x kernel tree. My kernel module needs config VIDEOBUF2. That is defined in drivers/media/v4l2-core/Kconfig: # Used by drivers that need Videobuf2 modules config VIDEOBUF2_CORE select DMA_SHARED_BUFFER tristate So I put 'CONFIG_VIDEOBUF2_CORE=y' in my Kernel config file and

Re: Need help in enable configuration when compile Kernel module

2014-01-09 Thread m silverstri
Ashokkumar.G 100 Things can not be taken back. 001. A lost opportunity. 010. A spoken word. 011. A sped arrow. 100. Time spent. On Thu, Jan 9, 2014 at 7:16 PM, m silverstri michael.j.silvers...@gmail.com wrote: I am using 3.10.x kernel tree. My kernel module needs config VIDEOBUF2

Re: Need help in enable configuration when compile Kernel module

2014-01-09 Thread m silverstri
And please help me udnerstand what is the difference between 'y' and 'm' in 'CONFIG_VIDEOBUF2_CORE=y instead of CONFIG_VIDEOBUF2_CORE=m'? On Thu, Jan 9, 2014 at 10:23 PM, m silverstri michael.j.silvers...@gmail.com wrote: Thanks. Can you please help me understand what you mean by 'make

How can I add a new program to 'samples' directory

2014-01-08 Thread m silverstri
I am trying to add a sample 'v4l2-mfc-encoder' program to '{raspberrypi dir}linux/samples/' The 'v4l2-mfc-encoder' program's Makefile is built using 'arm gcc': # Toolchain path TCPATH = arm-linux-gnueabi- KERNELHEADERS = /home/kamil/praca/w1-party/kernel/headers/include CC = ${TCPATH}gcc AR =

How does module_init(jpeg_init) get called

2014-01-08 Thread m silverstri
Hi, In a kernel driver code, I see it has 'module_init(jpeg_init)' and 'module_exit(jpeg_exit)'. I would like how know how will jpeg_init(void) gets call during kernel bring up. As an example: static int __init jpeg_init(void) { printk(KERN_CRIT Initialize JPEG driver\n);

Looking an example to use v4l2 mem2mem codec driver

2013-12-30 Thread m silverstri
Hi, Can you please tell me how to use v4l2 mem2mem codec driver? or where I can find example for it? Thank you. Mike ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

Need help in configuring kernel

2013-12-17 Thread m silverstri
Hi, I am trying to build kernel with v4l2 features enable. I added these in my defconfig file (and necessary dependancy , and compile, CONFIG_VIDEO_DEV=y CONFIG_VIDEO_V4L2=y I see those are included in the generated .config file, which is what I expected: # # Multimedia core support #