0
votes

I am trying to come up to speed on writing device drivers for embedded Linux, specifically a V4L2 Media Controller driver for a video interface.

I can write the device driver using the typical V4L2 model for a non-builtin driver, that is, a module controlled by modprobe. When the module is loaded the __init function for this driver is called, and this then creates a node in the /dev directory showing up as /dev/video0. I can then write user-side programs which starts by opening /dev/video0 and I can now exercise all the driver code I've written. I understand this model and so I have a nice development environment where I can modify the driver code, reload the .ko driver, modify my user-side test code, and basically exercise all my driver functionality.

However, I am still confused about the builtin drivers when using the Media Controller and platform_device model for drivers. (These don't have a specific __init routine and are not loaded dynamically). I can configure my kernel to build my driver as a builtin Media Controller-based driver. I have all of the Kconfig files correct so I can now include my new driver in a kernel build. I know my driver is builtin correctly, because when my kernel boots, I can see my driver in the /sys/bus/platform/drivers directory. This directory has 3 write-only nodes for bind, uevent and unbind.

This is my confusion: How do I open this builtin device driver from user-side code so I can exercise my driver interface?

Since the driver is a builtin Media Controller-based driver, a new device node is not created in /dev when the kernel boots, or at least, I do not know WHAT device to open like I did for the module-based driver.

Do I have to write some udev rules to cause the kernel to create the device node in /dev directory so I can use a user-side open()? or is this driver accessed in a different way?

Thanks, -Andres

1

1 Answers

1
votes

If your driver based on media controller framework, there should be a pipeline (refer) have you implemented that in your driver refer media controller api. Even if your driver is builtin and is based on media controller framework it should still create /dev/video0. The reason I can think of video0 node not being created is missing subdev driver.