[libcamera-devel] Getting libcamera to work on PinePhone

Laurent Pinchart laurent.pinchart at ideasonboard.com
Mon Dec 18 04:09:13 CET 2023


Hi Pavel,

On Sun, Dec 17, 2023 at 10:03:55PM +0100, Pavel Machek via libcamera-devel wrote:
> Hi!
> 
> I'm trying to get libcamera to work on pinephone. I tried updating
> ov5640 driver to latest mainline version, but still no luck. gc2145 is
> out of tree, patches are pending, but lets ignore that one for now.
> 
> mobian at mobian:~/g/libcamera$  build/src/apps/cam/cam -c 1 -I -C -S
> [0:22:38.775678493] [1584]  INFO IPAManager ipa_manager.cpp:143 libcamera is not installed. Adding '/my/libcamera/build/src/ipa' to the IPA search path
> [0:22:38.785258743] [1584]  INFO Camera camera_manager.cpp:284 libcamera v0.1.0+142-1c56d2a2
> [0:22:38.829487310] [1585]  WARN CameraSensor camera_sensor.cpp:248 'ov5640 3-004c': Recommended V4L2 control 0x009a0922 not supported
> [0:22:38.829703110] [1585]  WARN CameraSensor camera_sensor.cpp:315 'ov5640 3-004c': The sensor kernel driver needs to be fixed
> [0:22:38.829761112] [1585]  WARN CameraSensor camera_sensor.cpp:317 'ov5640 3-004c': See Documentation/sensor_driver_requirements.rst in the libcamera sources for more information
> [0:22:38.842159390] [1585]  WARN CameraSensor camera_sensor.cpp:463 'ov5640 3-004c': Failed to retrieve the camera location
> [0:22:38.842311854] [1585]  WARN CameraSensor camera_sensor.cpp:485
> 'ov5640 3-004c': Rotation control not available, default to 0 degrees
> 
> So we don't have location or orientation, should not matter.

I believe this is caused by the missing orientation property in the
device tree. The ov5640 driver from mainline calls
v4l2_fwnode_device_parse(), which should create the rotation control
when the device tree property is present. Could you test that ? It would
then be nice to upstream a patch to add the ov5640 to the pinephone
device tree.

> [0:22:38.846151130] [1585]  WARN CameraSensor camera_sensor.cpp:248 'gc2145 3-003c': Recommended V4L2 control 0x009a0922 not supported
> [0:22:38.846309344] [1585] ERROR V4L2 v4l2_subdevice.cpp:393 'gc2145 3-003c': Unable to get rectangle 2 on pad 0: Inappropriate ioctl for device
> [0:22:38.846419057] [1585]  WARN CameraSensor camera_sensor.cpp:290 'gc2145 3-003c': The PixelArraySize property has been defaulted to 1600x1200
> [0:22:38.846484226] [1585] ERROR V4L2 v4l2_subdevice.cpp:393 'gc2145 3-003c': Unable to get rectangle 1 on pad 0: Inappropriate ioctl for device
> [0:22:38.846543645] [1585]  WARN CameraSensor camera_sensor.cpp:301 'gc2145 3-003c': The PixelArrayActiveAreas property has been defaulted to (0, 0)/1600x1200
> [0:22:38.846612189] [1585] ERROR V4L2 v4l2_subdevice.cpp:393 'gc2145 3-003c': Unable to get rectangle 0 on pad 0: Inappropriate ioctl for device
> [0:22:38.846663983] [1585]  WARN CameraSensor camera_sensor.cpp:309 'gc2145 3-003c': Failed to retrieve the sensor crop rectangle
> [0:22:38.846710735] [1585]  WARN CameraSensor camera_sensor.cpp:315 'gc2145 3-003c': The sensor kernel driver needs to be fixed
> [0:22:38.846755278] [1585]  WARN CameraSensor camera_sensor.cpp:317 'gc2145 3-003c': See Documentation/sensor_driver_requirements.rst in the libcamera sources for more information
> [0:22:38.852065445] [1585]  WARN CameraSensorProperties camera_sensor_properties.cpp:249 No static properties available for 'gc2145'
> [0:22:38.852264952] [1585]  WARN CameraSensorProperties camera_sensor_properties.cpp:251 Please consider updating the camera sensor properties database
> [0:22:38.852621300] [1585]  WARN CameraSensor camera_sensor.cpp:463 'gc2145 3-003c': Failed to retrieve the camera location
> [0:22:38.852685261] [1585]  WARN CameraSensor camera_sensor.cpp:485 'gc2145 3-003c': Rotation control not available, default to 0 degrees
> [0:22:38.852981481] [1585] ERROR V4L2 v4l2_device.cpp:353 'gc2145 3-003c': Unable to set controls: Permission denied
> [0:22:38.853820305] [1585] ERROR SimplePipeline simple.cpp:1441 No
> valid pipeline for sensor 'gc2145 3-003c', skipping
> 
> gc2145... lets ignore that one for now.
> 
> [0:22:38.860444856] [1585] ERROR V4L2 v4l2_videodevice.cpp:1106
> /dev/video0[15:cap]: Media bus code filtering not supported by the
> device
> 
> I guess that's the real error here? It is
> 
>         if (code && !caps_.hasMediaController()) {
> 
> from std::vector<V4L2PixelFormat> V4L2VideoDevice::enumPixelformats(uint32_t code)
>  . I don't see anything relevant in sensor_driver_requirements.rst .
> 
> Rest is more of the same. Any ideas?
> 
> ov5640 does have         .enum_mbus_code = ov5640_enum_mbus_code,
> 
> . Is this in the sensor driver or should I look somewhere else?

It's not about the sensor, it's about the video device side. If I'm not
mistaken, on the pinephone, that would be the sun6i-csi driver. The
driver needs to implement V4L2_CAP_IO_MC, and in particular, update the
.vidioc_enum_fmt_vid_cap() handler accordingly. See
https://docs.kernel.org/userspace-api/media/v4l/vidioc-enum-fmt.html.

> [0:22:38.861528982] [1585] ERROR V4L2 v4l2_videodevice.cpp:1106 /dev/video0[15:cap]: Media bus code filtering not supported by the device
> [0:22:38.862426767] [1585] ERROR V4L2 v4l2_videodevice.cpp:1106 /dev/video0[15:cap]: Media bus code filtering not supported by the device
> [0:22:38.863801238] [1585] ERROR V4L2 v4l2_videodevice.cpp:1106 /dev/video0[15:cap]: Media bus code filtering not supported by the device
> [0:22:38.865101164] [1585] ERROR V4L2 v4l2_videodevice.cpp:1106 /dev/video0[15:cap]: Media bus code filtering not supported by the device
> [0:22:38.866073452] [1585] ERROR V4L2 v4l2_videodevice.cpp:1106 /dev/video0[15:cap]: Media bus code filtering not supported by the device
> [0:22:38.866952528] [1585] ERROR V4L2 v4l2_videodevice.cpp:1106 /dev/video0[15:cap]: Media bus code filtering not supported by the device
> [0:22:38.868436378] [1585] ERROR V4L2 v4l2_videodevice.cpp:1106 /dev/video0[15:cap]: Media bus code filtering not supported by the device
> [0:22:38.869703386] [1585] ERROR V4L2 v4l2_videodevice.cpp:1106 /dev/video0[15:cap]: Media bus code filtering not supported by the device
> [0:22:38.870656215] [1585] ERROR V4L2 v4l2_videodevice.cpp:1106 /dev/video0[15:cap]: Media bus code filtering not supported by the device
> [0:22:38.871702423] [1585] ERROR V4L2 v4l2_videodevice.cpp:1106 /dev/video0[15:cap]: Media bus code filtering not supported by the device
> [0:22:38.872666752] [1585] ERROR V4L2 v4l2_videodevice.cpp:1106 /dev/video0[15:cap]: Media bus code filtering not supported by the device
> [0:22:38.873604914] [1585] ERROR V4L2 v4l2_videodevice.cpp:1106 /dev/video0[15:cap]: Media bus code filtering not supported by the device
> [0:22:38.874497115] [1585] ERROR V4L2 v4l2_videodevice.cpp:1106 /dev/video0[15:cap]: Media bus code filtering not supported by the device
> [0:22:38.875843627] [1585] ERROR V4L2 v4l2_videodevice.cpp:1106 /dev/video0[15:cap]: Media bus code filtering not supported by the device
> [0:22:38.876946503] [1585] ERROR V4L2 v4l2_videodevice.cpp:1106 /dev/video0[15:cap]: Media bus code filtering not supported by the device
> [0:22:38.877880165] [1585] ERROR V4L2 v4l2_videodevice.cpp:1106 /dev/video0[15:cap]: Media bus code filtering not supported by the device
> [0:22:38.878774366] [1585] ERROR V4L2 v4l2_videodevice.cpp:1106 /dev/video0[15:cap]: Media bus code filtering not supported by the device
> [0:22:38.879657526] [1585] ERROR V4L2 v4l2_videodevice.cpp:1106 /dev/video0[15:cap]: Media bus code filtering not supported by the device
> [0:22:38.880625647] [1585] ERROR V4L2 v4l2_videodevice.cpp:1106 /dev/video0[15:cap]: Media bus code filtering not supported by the device
> [0:22:38.882244794] [1585] ERROR V4L2 v4l2_videodevice.cpp:1106 /dev/video0[15:cap]: Media bus code filtering not supported by the device
> [0:22:38.883663433] [1585] ERROR V4L2 v4l2_videodevice.cpp:1106 /dev/video0[15:cap]: Media bus code filtering not supported by the device
> [0:22:38.884972609] [1585] ERROR V4L2 v4l2_videodevice.cpp:1106 /dev/video0[15:cap]: Media bus code filtering not supported by the device
> [0:22:38.886234159] [1585] ERROR V4L2 v4l2_videodevice.cpp:1106 /dev/video0[15:cap]: Media bus code filtering not supported by the device
> [0:22:38.887475249] [1585] ERROR V4L2 v4l2_videodevice.cpp:1106 /dev/video0[15:cap]: Media bus code filtering not supported by the device
> [0:22:38.888756841] [1585] ERROR V4L2 v4l2_videodevice.cpp:1106 /dev/video0[15:cap]: Media bus code filtering not supported by the device
> [0:22:38.890023557] [1585] ERROR V4L2 v4l2_videodevice.cpp:1106 /dev/video0[15:cap]: Media bus code filtering not supported by the device
> [0:22:38.891270398] [1585] ERROR V4L2 v4l2_videodevice.cpp:1106 /dev/video0[15:cap]: Media bus code filtering not supported by the device
> [0:22:38.892327648] [1585] ERROR V4L2 v4l2_videodevice.cpp:1106 /dev/video0[15:cap]: Media bus code filtering not supported by the device
> [0:22:38.893792413] [1585] ERROR V4L2 v4l2_videodevice.cpp:1106 /dev/video0[15:cap]: Media bus code filtering not supported by the device
> [0:22:38.895181968] [1585] ERROR V4L2 v4l2_videodevice.cpp:1106 /dev/video0[15:cap]: Media bus code filtering not supported by the device
> [0:22:38.896584398] [1585] ERROR V4L2 v4l2_videodevice.cpp:1106 /dev/video0[15:cap]: Media bus code filtering not supported by the device
> [0:22:38.897890449] [1585] ERROR V4L2 v4l2_videodevice.cpp:1106 /dev/video0[15:cap]: Media bus code filtering not supported by the device
> [0:22:38.898884071] [1585] ERROR V4L2 v4l2_videodevice.cpp:1106 /dev/video0[15:cap]: Media bus code filtering not supported by the device
> [0:22:38.900396297] [1585] ERROR V4L2 v4l2_videodevice.cpp:1106 /dev/video0[15:cap]: Media bus code filtering not supported by the device
> [0:22:38.901714349] [1585] ERROR V4L2 v4l2_videodevice.cpp:1106 /dev/video0[15:cap]: Media bus code filtering not supported by the device
> [0:22:38.902701887] [1585] ERROR V4L2 v4l2_videodevice.cpp:1106 /dev/video0[15:cap]: Media bus code filtering not supported by the device
> [0:22:38.904076733] [1585] ERROR V4L2 v4l2_videodevice.cpp:1106 /dev/video0[15:cap]: Media bus code filtering not supported by the device
> [0:22:38.905426703] [1585] ERROR V4L2 v4l2_videodevice.cpp:1106 /dev/video0[15:cap]: Media bus code filtering not supported by the device
> [0:22:38.906628458] [1585] ERROR V4L2 v4l2_videodevice.cpp:1106 /dev/video0[15:cap]: Media bus code filtering not supported by the device
> [0:22:38.907674416] [1585] ERROR V4L2 v4l2_videodevice.cpp:1106 /dev/video0[15:cap]: Media bus code filtering not supported by the device
> [0:22:38.908608869] [1585] ERROR V4L2 v4l2_videodevice.cpp:1106 /dev/video0[15:cap]: Media bus code filtering not supported by the device
> [0:22:38.909992465] [1585] ERROR V4L2 v4l2_videodevice.cpp:1106 /dev/video0[15:cap]: Media bus code filtering not supported by the device
> [0:22:38.911480856] [1585] ERROR V4L2 v4l2_videodevice.cpp:1106 /dev/video0[15:cap]: Media bus code filtering not supported by the device
> [0:22:38.912764990] [1585] ERROR V4L2 v4l2_videodevice.cpp:1106 /dev/video0[15:cap]: Media bus code filtering not supported by the device
> [0:22:38.913989663] [1585] ERROR V4L2 v4l2_videodevice.cpp:1106 /dev/video0[15:cap]: Media bus code filtering not supported by the device
> [0:22:38.915293506] [1585] ERROR V4L2 v4l2_videodevice.cpp:1106 /dev/video0[15:cap]: Media bus code filtering not supported by the device
> [0:22:38.916580640] [1585] ERROR V4L2 v4l2_videodevice.cpp:1106 /dev/video0[15:cap]: Media bus code filtering not supported by the device
> [0:22:38.917566678] [1585] ERROR V4L2 v4l2_videodevice.cpp:1106 /dev/video0[15:cap]: Media bus code filtering not supported by the device
> [0:22:38.918538008] [1585] ERROR V4L2 v4l2_videodevice.cpp:1106 /dev/video0[15:cap]: Media bus code filtering not supported by the device
> [0:22:38.919961314] [1585] ERROR V4L2 v4l2_videodevice.cpp:1106 /dev/video0[15:cap]: Media bus code filtering not supported by the device
> [0:22:38.920983021] [1585] ERROR V4L2 v4l2_videodevice.cpp:1106 /dev/video0[15:cap]: Media bus code filtering not supported by the device
> [0:22:38.921967767] [1585] ERROR V4L2 v4l2_videodevice.cpp:1106 /dev/video0[15:cap]: Media bus code filtering not supported by the device
> [0:22:38.922808634] [1585] ERROR V4L2 v4l2_videodevice.cpp:1106 /dev/video0[15:cap]: Media bus code filtering not supported by the device
> [0:22:38.923648875] [1585] ERROR V4L2 v4l2_videodevice.cpp:1106 /dev/video0[15:cap]: Media bus code filtering not supported by the device
> [0:22:38.925238521] [1585] ERROR V4L2 v4l2_videodevice.cpp:1106 /dev/video0[15:cap]: Media bus code filtering not supported by the device
> [0:22:38.926502779] [1585] ERROR V4L2 v4l2_videodevice.cpp:1106 /dev/video0[15:cap]: Media bus code filtering not supported by the device
> [0:22:38.927680783] [1585] ERROR V4L2 v4l2_videodevice.cpp:1106 /dev/video0[15:cap]: Media bus code filtering not supported by the device
> [0:22:38.928937499] [1585] ERROR V4L2 v4l2_videodevice.cpp:1106 /dev/video0[15:cap]: Media bus code filtering not supported by the device
> [0:22:38.930156630] [1585] ERROR V4L2 v4l2_videodevice.cpp:1106 /dev/video0[15:cap]: Media bus code filtering not supported by the device
> [0:22:38.931313300] [1585] ERROR V4L2 v4l2_videodevice.cpp:1106 /dev/video0[15:cap]: Media bus code filtering not supported by the device
> [0:22:38.932583809] [1585] ERROR V4L2 v4l2_videodevice.cpp:1106 /dev/video0[15:cap]: Media bus code filtering not supported by the device
> [0:22:38.932776399] [1585] ERROR SimplePipeline simple.cpp:532 No valid configuration found
> Camera 1 not found
> Failed to create camera session
> mobian at mobian:~/g/libcamera$ 

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list