Hello all,
I working on interfacing own camera chip with iMX8M processor using linux kernel 4.14.78.
I have written the camera driver for chip and it probes successfully as a video subdevice.
In order to program the chip from the user application, i need to define some custom controls in my v4l2 sub-device driver As per the following link 1.7. V4L2 sub-devices — Linux Media Subsystem Documentation documentation , subdevice must get created in /dev/ directory but in my case i am not able to generate the subdevice nodes
Does iMX platforms support v4l2 subdevice creation for the video device...?
Can anoyne help me to create v4l2 subdevice entry for my camera driver...?
Solved! Go to Solution.
In the meantime I figured out that it does work with my 4.14 (and saw you are using the same kernel), so here is what needs to be done:
You initialize your subdevice with your subdev_ops pointer:
Then you can fill up the _HAS_DEVNODE flag, which tells V4L2 that your device wishes to expose the /dev/v4l-subdevX:
And only then, you actually register your subdevice (so the _HAS_DEVNODE can take effect):
After this, if you are using the driver from NXP for MIPI (mxc-mipi-csi2_yav.c), then only after the first streaming command your device will register in the /dev/ folder, because in that driver, they don't have a callback to when the subdevice actually registers, so they have just put it in the s_stream callback (see v4l2_device_register_subdev_nodes()):
Hope that helps.
Hello,
Are you still struggling with this? I noticed that with Kernel 4.9 I was able to create a subdevice, but when upgrading to 4.14, my driver stopped creating it for whatever reason.
Let me know which Kernel you are running, and I can post some snippets here from the working one on 4.9 and I will try to resolve the problem with the 4.14 today, hopefully I will be able to help you.
(as this forum is not entirely helpful at all times :smileyhappy: )
In the meantime I figured out that it does work with my 4.14 (and saw you are using the same kernel), so here is what needs to be done:
You initialize your subdevice with your subdev_ops pointer:
Then you can fill up the _HAS_DEVNODE flag, which tells V4L2 that your device wishes to expose the /dev/v4l-subdevX:
And only then, you actually register your subdevice (so the _HAS_DEVNODE can take effect):
After this, if you are using the driver from NXP for MIPI (mxc-mipi-csi2_yav.c), then only after the first streaming command your device will register in the /dev/ folder, because in that driver, they don't have a callback to when the subdevice actually registers, so they have just put it in the s_stream callback (see v4l2_device_register_subdev_nodes()):
Hope that helps.
I am trying to do the same. But having problem creating the device node. I am using the kernel 5.4.
I have integrated custom camera sensor, and trying to add ioctl calls and access it from user-space.
Got this in dmesg
CSI: Registered sensor subdevice: mxc_mipi-csi.0
Seems like the camera sensor sub-device is registered. I have added a ioctl, can you please tell me which device node I should access to call those IOCTLs? I see /dev/v4l-subdev0 is not being created.
Hi Nikhil
yes sudev supported, for general steps for creating it for new sensor one can check
MIPI RAW12 Configuration for AR0330 on i.mx8mq
Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hello, i am not able to access the link.
Thanks for the reply.
I went through the above link but i have not found information about creating v4l2 subdevices.
unfortunately such documentation for creating v4l2 subdevices is not available.
If you have difficulities, NXP has special service for software porting
NXP Professional Services | NXP
Best regards
igor