ERROR CameraSensor camera_sensor.cpp:127 No image format found

deva seetharam tagsense at yahoo.com
Tue Mar 19 09:17:13 CET 2024


Thank you so much for your prompt responses.

I rebuilt the rpicam-apps from the source and ran rpicam-still. The good news is that I can clearly see the image (of the cables next to the sensor) on a monitor connected to RPI. 

However, when I store the image, using rpicam-still -o, as a file, all I get is a blank black image.

What am I doing wrong here? Please advise. Thank you!






On Monday, March 18, 2024 at 07:52:01 PM GMT+5:30, Dave Stevenson <dave.stevenson at raspberrypi.com> wrote: 





On Mon, 18 Mar 2024 at 03:26, deva seetharam <tagsense at yahoo.com> wrote:
>
> I built libcamera from source using the instructions available at https://github.com/raspberrypi/libcamera/blob/main/README.rst. When I run
> LIBCAMERA_LOG_LEVELS=*:DEBUG cam -l, the image sensor is listed in the logs (https://pastebin.com/m0KJhmhH).
>
> Available cameras:
> 1: 'xyz123' (/base/soc/i2c0mux/i2c at 1/xyz123 at 36)
>
> However, none of the libcamera-apps are getting installed when I compile and install libcamera from the source.

libcamera-apps (now rename rpicam-apps) are standalone apps that
depend on libcamera, not part of libcamera itself.
https://github.com/raspberrypi/rpicam-apps

Instructions for building libcamera and rpicam-apps are in our
documentation -
https://www.raspberrypi.com/documentation/computers/camera_software.html#building-libcamera-and-rpicam-apps

> so i installed libcamera-apps using apt install.

That is dependent on the packaged libcamera library, so your
self-built version may or may not be invoked. Caution is advised
there.

> When I run libcamera-hello, I get the error messages shown at https://pastebin.com/xL8idEwJ.
>
> Please let me know how I can fix these errors. Thank you.

Something from your xyz123_set_ctrl is managing to return -EACCES.
Looking at the core code, that would largely be down to trying to set
a control which has V4L2_CTRL_FLAG_READ_ONLY set. Based on your
previous pastebin for the driver, I'd suspect it was V4L2_CID_VBLANK.
The error is partly irrelevant - the sensor is streaming and producing
frames, although as you have "Preview window unavailable" in the logs
it hasn't been able to create a renderer to display that preview
frames.

  Dave

> On Sunday, March 17, 2024 at 12:00:16 AM GMT+5:30, deva seetharam <tagsense at yahoo.com> wrote:
>
> thank you, Dave, for the detailed explanation!
> At this point, we are just trying to get a basic image coming from the sensor to be displayed on RPI. That is why I have not implemented any of the controls.
>
> I have a question about the cam_helper.:
> I read the Raspberry Pi Camera Algorithm and Tuning Guide (https://datasheets.raspberrypi.com/camera/raspberry-pi-camera-guide.pdf). I searched the Internet as well.
> But I cannot figure out how to compile the camera helper app or where to place it in the file system. Please advise. Thank you!
>
>
>
>
>
>
> On Friday, March 15, 2024 at 11:03:33 PM GMT+5:30, Dave Stevenson <dave.stevenson at raspberrypi.com> wrote:
>
>
>
>
>
> On Fri, 15 Mar 2024 at 17:05, deva seetharam <tagsense at yahoo.com> wrote:
> >
> > Thank you, Kieran!
> > I made the change you suggested.
> >
> > Now, when I run libcamera-hello, I get the following error messages. Please advise how to resolve these errors.
> >
> > radiostudio at imx:~ $ libcamera-hello
> >
> > [0:03:13.606988987] [1991]  INFO Camera camera_manager.cpp:284 libcamera v0.2.0+46-075b54d5
> >
> > [0:03:13.628537890] [1997]  WARN CameraSensor camera_sensor.cpp:248 'xyz123 10-0036': Recommended V4L2 control 0x009a0922 not supported
> >
> > [0:03:13.628620872] [1997]  WARN CameraSensor camera_sensor.cpp:315 'xyz123 10-0036': The sensor kernel driver needs to be fixed
>
> 0x009a0922 is V4L2_CID_CAMERA_ORIENTATION, and your driver isn't
> implementing it.
>
> >
> > [0:03:13.628650260] [1997]  WARN CameraSensor camera_sensor.cpp:317 'xyz123 10-0036': See Documentation/sensor_driver_requirements.rst in the libcamera sources for more information
> >
> > [0:03:13.629229908] [1997]  WARN CameraSensorProperties camera_sensor_properties.cpp:274 No static properties available for 'xyz123'
> >
> > [0:03:13.629268186] [1997]  WARN CameraSensorProperties camera_sensor_properties.cpp:276 Please consider updating the camera sensor properties database
> >
> > [0:03:13.629299316] [1997]  WARN CameraSensor camera_sensor.cpp:463 'xyz123 10-0036': Failed to retrieve the camera location
> >
> > [0:03:13.629328705] [1997]  WARN CameraSensor camera_sensor.cpp:485 'xyz123 10-0036': Rotation control not available, default to 0 degrees
>
> All of those can be fixed by calling v4l2_ctrl_new_fwnode_properties
> as almost all sensor drivers in the tree do.
>
> > [0:03:13.651220959] [1997] ERROR IPARPI ipa_base.cpp:124 Could not create camera helper for xyz123
>
> That's your main failure. You need to write a camera helper so that
> libcamera knows how to translate generic exposure time and analogue
> gain values into the sensor specific units required.
> Add a suitable file to
> https://git.linuxtv.org/libcamera.git/tree/src/ipa/rpi/cam_helper
>
> > [0:03:13.651336904] [1997] ERROR RPI pipeline_base.cpp:804 Failed to load a suitable IPA library
>
> Probably linked, you'll need a tuning file. You can initially use
> https://git.linuxtv.org/libcamera.git/tree/src/ipa/rpi/vc4/data/uncalibrated.json,
> but you'll need to tune the camera at some point.
>
>  Dave
>
>
> > [0:03:13.651366644] [1997] ERROR RPI vc4.cpp:216 Failed to register camera xyz123 10-0036: -22
> >
> > Made X/EGL preview window
> >
> > ERROR: *** no cameras available ***
> >
> >
> >
> > when I do a dmesg -T | grep -i xyz123, I get the following messages:
> > [Fri Mar 15 21:45:33 2024] xyz123: loading out-of-tree module taints kernel.
> > [Fri Mar 15 21:45:33 2024] xyz123 10-0036: xyz123_probe has been invoked to probe xyz123.
> > [Fri Mar 15 21:45:33 2024] xyz123 10-0036: allocated memory for xyz123.
> > [Fri Mar 15 21:45:33 2024] xyz123 10-0036: xyz123_check_hwcfg has been invoked to check xyz123 hardware config.
> > [Fri Mar 15 21:45:33 2024] xyz123 10-0036: number of csi lanes: 2.
> > [Fri Mar 15 21:45:33 2024] xyz123 10-0036: xyz123_power_on has been invoked to power xyz123 up.
> > [Fri Mar 15 21:45:33 2024] xyz123 10-0036: xyz123_write_registers has been invoked with number of registers set to: 03
> > [Fri Mar 15 21:45:33 2024] xyz123 10-0036: xyz123_write_register has been invoked with address: 0103
> > [Fri Mar 15 21:45:33 2024] xyz123 10-0036: xyz123_write_register has been invoked with address: 3205
> > [Fri Mar 15 21:45:33 2024] xyz123 10-0036: xyz123_write_register has been invoked with address: 0100
> > [Fri Mar 15 21:45:33 2024] xyz123 10-0036: xyz123_write_register has been invoked with address: 3205
> > [Fri Mar 15 21:45:33 2024] xyz123 10-0036: xyz123_identify_module has been invoked to identify xyz123.
> > [Fri Mar 15 21:45:33 2024] xyz123 10-0036: xyz123_read_register has been invoked with address: 0x302A
> > [Fri Mar 15 21:45:33 2024] xyz123 10-0036: xyz123_read_register prepared a I2C write message with: addr: 0x36, flags: 0x00, len: 0x02
> > [Fri Mar 15 21:45:33 2024] xyz123 10-0036: xyz123_read_register prepared a I2C read message with: addr: 0x36, flags: 0x01, len: 0x01
> > [Fri Mar 15 21:45:33 2024] xyz123 10-0036: chip id first byte matches: 4 == 4
> > [Fri Mar 15 21:45:33 2024] xyz123 10-0036: xyz123_read_register has been invoked with address: 0x302B
> > [Fri Mar 15 21:45:33 2024] xyz123 10-0036: xyz123_read_register prepared a I2C write message with: addr: 0x36, flags: 0x00, len: 0x02
> > [Fri Mar 15 21:45:33 2024] xyz123 10-0036: xyz123_read_register prepared a I2C read message with: addr: 0x36, flags: 0x01, len: 0x01
> > [Fri Mar 15 21:45:33 2024] xyz123 10-0036: chip id second byte matches: 28 == 28
> > [Fri Mar 15 21:45:33 2024] xyz123 10-0036: xyz123_init_ctrls has been invoked to initialize controls of xyz123.
> > [Fri Mar 15 21:45:33 2024] xyz123 10-0036: xyz123_init_ctrls succesfully initialized controls
> > [Fri Mar 15 21:45:33 2024] xyz123 10-0036: default pixel rate of xyz123: 10804320.
> > [Fri Mar 15 21:45:33 2024] xyz123 10-0036: current link frequency of xyz123: 192000000.
> > [Fri Mar 15 21:45:33 2024] xyz123 10-0036: default vblank of xyz123: 8.
> > [Fri Mar 15 21:45:33 2024] xyz123 10-0036: default hblank of xyz123: 8.
> > [Fri Mar 15 21:45:33 2024] xyz123 10-0036: Default width specified in device tree: 720
> > [Fri Mar 15 21:45:33 2024] xyz123 10-0036: Default height specified in device tree: 720
> > [Fri Mar 15 21:45:33 2024] xyz123 10-0036: xyz123_set_default_format has been invoked to set default format of xyz123.
> > [Fri Mar 15 21:45:33 2024] xyz123 10-0036: xyz123_set_default_format has set code to 12295.
> > [Fri Mar 15 21:45:33 2024] xyz123 10-0036: xyz123_set_default_format has set colorspace to 8.
> > [Fri Mar 15 21:45:33 2024] xyz123 10-0036: xyz123_set_default_format has set ycbcr_enc to 1.
> > [Fri Mar 15 21:45:33 2024] xyz123 10-0036: xyz123_set_default_format has set quantization to 1.
> > [Fri Mar 15 21:45:33 2024] xyz123 10-0036: xyz123_set_default_format has set xfer_func to 2.
> > [Fri Mar 15 21:45:33 2024] xyz123 10-0036: xyz123_set_default_format has set width to 720.
> > [Fri Mar 15 21:45:33 2024] xyz123 10-0036: xyz123_set_default_format has set height to 720.
> > [Fri Mar 15 21:45:33 2024] xyz123 10-0036: xyz123_set_default_format has set field to 1.
> > [Fri Mar 15 21:45:33 2024] xyz123 10-0036: xyz123_set_default_format has completed.
> > [Fri Mar 15 21:45:33 2024] xyz123 10-0036: xyz123_probe has initialized media entity pads for xyz123 to 0 and 2.
> > [Fri Mar 15 21:45:33 2024] xyz123 10-0036: xyz123_probe has registered the subdevice of xyz123.
> > [Fri Mar 15 21:45:33 2024] xyz123 10-0036: xyz123_probe has completed probing xyz123.
> > [Fri Mar 15 21:45:33 2024] xyz123 10-0036: xyz123_power_off has been invoked to power xyz123 down.
> > [Fri Mar 15 21:45:35 2024] xyz123 10-0036: Consider updating driver xyz123 to match on endpoints
> > [Fri Mar 15 21:45:38 2024] xyz123 10-0036: xyz123_open has been invoked to open xyz123.
> > [Fri Mar 15 21:45:38 2024] xyz123 10-0036: xyz123_get_format_code has been invoked to get format code of xyz123.
> > [Fri Mar 15 21:45:41 2024] xyz123 10-0036: xyz123_open has been invoked to open xyz123.
> > [Fri Mar 15 21:45:41 2024] xyz123 10-0036: xyz123_get_format_code has been invoked to get format code of xyz123.
> > [Fri Mar 15 21:45:41 2024] xyz123 10-0036: xyz123_enum_mbus_code has been invoked.
> > [Fri Mar 15 21:45:41 2024] xyz123 10-0036: xyz123_get_format_code has been invoked to get format code of xyz123.
> > [Fri Mar 15 21:45:41 2024] xyz123 10-0036: xyz123_enum_mbus_code is exiting.
> > [Fri Mar 15 21:45:41 2024] xyz123 10-0036: xyz123_enum_mbus_code has been invoked.
> > [Fri Mar 15 21:45:41 2024] xyz123 10-0036: In xyz123_enum_mbus_code, code-> index has reached limit: 1.
> > [Fri Mar 15 21:45:41 2024] xyz123 10-0036: xyz123_get_format_code has been invoked to get format code of xyz123.
> > [Fri Mar 15 21:45:42 2024] xyz123 10-0036: __xyz123_get_pad_format has been invoked.
> > [Fri Mar 15 21:45:42 2024] xyz123 10-0036: format is NOT V4L2_SUBDEV_FORMAT_TRY.
> >
> >
> >
> >
> > On Friday, March 15, 2024 at 06:24:43 PM GMT+5:30, Kieran Bingham <kieran.bingham at ideasonboard.com> wrote:
> >
> >
> > Quoting deva seetharam (2024-03-15 12:31:14)
> > > Thank you once again, Dave!
> > > I have changed the code to use only the first (and only) entry in codes array as follows. However, as per dmesg, these functions are getting called repeatedly. When I run libcamera-hello or rpicam-hello, it prints one line ([0:41:31.852290414] [10447]  INFO Camera camera_manager.cpp:284 libcamera v0.2.0+46-075b54d5] and hangs. I don't know how to proceed. Please advise.
> > >
> > > As you guessed, I read the codes drivers of image sensors such as imx219 to write this driver.
> > > I read books such as the ones by Rubini and Madieu, and many web pages such as Video for Linux 2 API pages, etc. But, I could not get a clear picture of the structure of a V4L2 driver for an image sensor.
> > >
> > > Could you please recommend any relevant material? Thank you!
> > >
> > >
> > >
> > > static u32 oah0428_get_format_code(struct xyz123 *xyz123, u32 code)
> > > {
> > >    unsigned int i;
> > >    struct i2c_client *client = v4l2_get_subdevdata(&xyz123->sd);
> > >
> > >
> > >
> > >    dev_dbg(&client->dev,
> > >            "%s has been invoked to get format code of xyz123.\n",
> > >            __func__);
> > >
> > >    return codes[0];
> > > }
> > >
> > >
> > > static int xyz123_enum_mbus_code(struct v4l2_subdev *sd,
> > >                  struct v4l2_subdev_state *sd_state,
> > >                  struct v4l2_subdev_mbus_code_enum *code)
> > > {
> > >    struct xyz123 *xyz123 = to_xyz123(sd);
> > >    struct i2c_client *client = v4l2_get_subdevdata(&xyz123->sd);
> > >
> > >
> > >    dev_dbg(&client->dev, "%s has been invoked.\n", __func__);
> > >    mutex_lock(&xyz123->mutex);
> > >    code->code = xyz123_get_format_code(xyz123, codes[0]);
> > >    mutex_unlock(&xyz123->mutex);
> > >
> > >    return 0;
> > > }
> > >
> >
> > If you always return success on these functions the enumeration becomes
> > an infinite loop. You have to check the index and return an error when
> > you have returned all your codes.
> > --
> > Kieran
> >
> >
> >
> > >
> > >
> > >
> > >
> > >
> > > On Wednesday, March 13, 2024 at 04:46:46 PM GMT+5:30, Dave Stevenson <dave.stevenson at raspberrypi.com> wrote:
> > >
> > >
> > >
> > >
> > >
> > > Hi Deva
> > >
> > > On Wed, 13 Mar 2024 at 03:28, deva seetharam <tagsense at yahoo.com> wrote:
> > > >
> > > > Thank you, Dave and Laurent, for your inputs. I am not the decision maker about open sourcing. But, I talked to the client. They are saying they will open source the driver, if this sensor is released as a product. At this stage, it is just a skunk project to check the feasibility.
> > > > Here is the driver prototype source code for your review and advice: https://pastebin.com/nGkJsZP0.
> > > > Looking forward to your advice on fixing the issues. Thank you!
> > >
> > > So it is as I hypothesised - you're not advertising the formats correctly.
> > >
> > > static const u32 codes[] = {MEDIA_BUS_FMT_SBGGR10_1X10};
> > > ...
> > > static int xyz123_enum_mbus_code(struct v4l2_subdev *sd,
> > >                                struct v4l2_subdev_state *sd_state,
> > >                                struct v4l2_subdev_mbus_code_enum *code)
> > > {
> > > ...
> > >    if (code->index >= (ARRAY_SIZE(codes) / 4))
> > >    {
> > >        dev_err(&client->dev, "In %s, code-> index is too large: %d.\n",
> > >                __func__, code->index);
> > >        return -EINVAL;
> > >    }
> > >
> > > ARRAY_SIZE(codes) = 1, so ARRAY_SIZE(codes) / 4 = 0 (integer maths).
> > >
> > > You've presumably copied from imx219 or similar which has an array in
> > > codes due to the Bayer order changing due to flips. You've removed
> > > bits of that, but not here.
> > > I'd confirm whether your sensor does change Bayer order or not with
> > > flips, and either reinstate it or totally remove it.
> > >
> > >
> > >  Dave
> > >
> > > >
> > > >
> > > > On Monday, March 11, 2024 at 07:34:04 PM GMT+5:30, Dave Stevenson <dave.stevenson at raspberrypi.com> wrote:
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > Hi Deva
> > > >
> > > > On Sat, 9 Mar 2024 at 11:00, deva seetharam <tagsense at yahoo.com> wrote:
> > > > >
> > > > > Greetings!!
> > > > >
> > > > > For a new image sensor (due to a restrictive NDA, cannot reveal the manufacturer or the part number), I have to create the device tree source file and the kernel driver. I have compiled and installed the device tree and kernel module. I see the kernel module is getting loaded and the overlay is getting accepted into device tree. However, when I run libcamera, I get the following error:
> > > > >
> > > > > [0:00:41.253567807] [1920] ERROR CameraSensor camera_sensor.cpp:127 'xyz123 10-0036': No image format found
> > > > > [0:00:41.253599677] [1920] ERROR RPI vc4.cpp:216 Failed to register camera xyz123 10-0036: -22
> > > >
> > > > Address 0x36 - that'll likely be Omnivision then.
> > > >
> > > > > Please suggest how this error can be fixed. Thank you!
> > > > >
> > > > > I am also including the dts file, (relevant portions of) lsmod and dmesg outputs.
> > > > >
> > > > >
> > > > > the device tree overlay file is as follows:
> > > > > <pre>
> > > > > /dts-v1/;
> > > > > /plugin/;
> > > > >
> > > > >
> > > > > #include <dt-bindings/gpio/gpio.h>
> > > > >
> > > > >
> > > > > / {
> > > > >    compatible = "brcm,bcm2835";
> > > > >
> > > > >
> > > > >    fragment at 0 {
> > > > >        target = <&i2c0if>;
> > > > >        __overlay__ {
> > > > >            status = "okay";
> > > > >        };
> > > > >    };
> > > > >
> > > > >
> > > > >    clk_frag: fragment at 1 {
> > > > >        target = <&cam1_clk>;
> > > > >        __overlay__ {
> > > > >            status = "okay";
> > > > >            clock-frequency = <24000000>;
> > > > >        };
> > > > >    };
> > > > >
> > > > >
> > > > >    i2c_frag: fragment at 100 {
> > > > >        target = <&i2c_csi_dsi>;
> > > > >        __overlay__ {
> > > > >            #address-cells = <1>;
> > > > >            #size-cells = <0>;
> > > > >            status = "okay";
> > > > >
> > > > >
> > > > >            xyz123: xyz123 at 36 {
> > > > >                compatible = "abc,xyz123";
> > > > >                reg = <0x36>;
> > > > >
> > > > >
> > > > >                clocks = <&cam1_clk>;
> > > > >                clock-names = "xclk";
> > > > >
> > > > >
> > > > >                port {
> > > > >                    cam_endpoint: endpoint {
> > > > >                        clock-lanes = <0>;
> > > > >                        data-lanes = <1 2>;
> > > > >                        clock-noncontinuous;
> > > > >                        link-frequencies = /bits/ 64 <192000000>;
> > > > >                    };
> > > > >                };
> > > > >            };
> > > > >        };
> > > > >    };
> > > > >
> > > > >
> > > > >    csi_frag: fragment at 101 {
> > > > >        target = <&csi1>;
> > > > >        csi: __overlay__ {
> > > > >            status = "okay";
> > > > >            brcm,media-controller;
> > > > >
> > > > >
> > > > >            port {
> > > > >                csi_ep: endpoint {
> > > > >                    remote-endpoint = <&cam_endpoint>;
> > > > >                    clock-lanes = <0>;
> > > > >                    data-lanes = <1 2>;
> > > > >                    clock-noncontinuous;
> > > > >                };
> > > > >            };
> > > > >        };
> > > > >    };
> > > > >
> > > > >
> > > > > };
> > > > >
> > > > >
> > > > > &xyz123 {
> > > > >    status = "okay";
> > > > >    default-width = <720>;
> > > > >    default-height = <720>;
> > > > > };
> > > > >
> > > > >
> > > > > &cam_endpoint {
> > > > >    remote-endpoint = <&csi_ep>;
> > > > > };
> > > > >
> > > > >
> > > > >
> > > > > the output of lsmod is as follows:
> > > > > <pre>
> > > > > xyz123                24576  1
> > > > > v4l2_fwnode            24576  2 xyz123,bcm2835_unicam
> > > > > v4l2_async            24576  3 v4l2_fwnode,xyz123,bcm2835_unicam
> > > > > videodev              278528  10 v4l2_async,bcm2835_codec,xyz123,videobuf2_v4l2,bcm2835_unicam,bcm2835_v4l2,videobuf2_common,rpivid_hevc,v4l2_mem2mem,bcm2835_isp
> > > > > mc                    61440  10 v4l2_async,videodev,bcm2835_codec,xyz123,videobuf2_v4l2,bcm2835_unicam,videobuf2_common,rpivid_hevc,v4l2_mem2mem,bcm2835_isp
> > > > >
> > > > > </pre>
> > > > >
> > > > > the output of dmesg is as follows:
> > > > > [Sat Mar  9 15:58:15 2024] xyz123: loading out-of-tree module taints kernel.
> > > > > [Sat Mar  9 15:58:15 2024] xyz123 10-0036: xyz123_probe has been invoked to probe xyz123.
> > > > > [Sat Mar  9 15:58:15 2024] xyz123 10-0036: allocated memory for xyz123.
> > > > > [Sat Mar  9 15:58:15 2024] xyz123 10-0036: xyz123_check_hwcfg has been invoked to check xyz123 hardware config.
> > > > > [Sat Mar  9 15:58:15 2024] xyz123 10-0036: number of csi lanes: 2.
> > > > > [Sat Mar  9 15:58:15 2024] xyz123 10-0036: xyz123_power_on has been invoked to power xyz123 up.
> > > > > [Sat Mar  9 15:58:15 2024] xyz123 10-0036: xyz123_write_registers has been invoked with number of registers set to: 03
> > > > > [Sat Mar  9 15:58:15 2024] xyz123 10-0036: xyz123_write_register has been invoked with address: 0103
> > > > > [Sat Mar  9 15:58:15 2024] xyz123 10-0036: xyz123_write_register has been invoked with address: 3205
> > > > > [Sat Mar  9 15:58:15 2024] xyz123 10-0036: xyz123_write_register has been invoked with address: 0100
> > > > > [Sat Mar  9 15:58:15 2024] xyz123 10-0036: xyz123_write_register has been invoked with address: 3205
> > > > > [Sat Mar  9 15:58:15 2024] xyz123 10-0036: xyz123_identify_module has been invoked to identify xyz123.
> > > > > [Sat Mar  9 15:58:15 2024] xyz123 10-0036: xyz123_read_register has been invoked with address: 0x302A
> > > > > [Sat Mar  9 15:58:15 2024] xyz123 10-0036: xyz123_read_register prepared a I2C write message with: addr: 0x36, flags: 0x00, len: 0x02
> > > > > [Sat Mar  9 15:58:15 2024] xyz123 10-0036: xyz123_read_register prepared a I2C read message with: addr: 0x36, flags: 0x01, len: 0x01
> > > > > [Sat Mar  9 15:58:15 2024] xyz123 10-0036: chip id first byte matches: 4 == 4
> > > > > [Sat Mar  9 15:58:15 2024] xyz123 10-0036: xyz123_read_register has been invoked with address: 0x302B
> > > > > [Sat Mar  9 15:58:15 2024] xyz123 10-0036: xyz123_read_register prepared a I2C write message with: addr: 0x36, flags: 0x00, len: 0x02
> > > > > [Sat Mar  9 15:58:15 2024] xyz123 10-0036: xyz123_read_register prepared a I2C read message with: addr: 0x36, flags: 0x01, len: 0x01
> > > > > [Sat Mar  9 15:58:15 2024] xyz123 10-0036: chip id second byte matches: 28 == 28
> > > > > [Sat Mar  9 15:58:15 2024] xyz123 10-0036: xyz123_init_ctrls has been invoked to initialize controls of xyz123.
> > > > > [Sat Mar  9 15:58:15 2024] xyz123 10-0036: xyz123_init_ctrls succesfully initialized controls
> > > > > [Sat Mar  9 15:58:15 2024] xyz123 10-0036: default pixel rate of xyz123: 10804320.
> > > > > [Sat Mar  9 15:58:15 2024] xyz123 10-0036: current link frequency of xyz123: 192000000.
> > > > > [Sat Mar  9 15:58:15 2024] xyz123 10-0036: default vblank of xyz123: 8.
> > > > > [Sat Mar  9 15:58:15 2024] xyz123 10-0036: default hblank of xyz123: 8.
> > > > > [Sat Mar  9 15:58:15 2024] xyz123 10-0036: Default width specified in device tree: 720
> > > > > [Sat Mar  9 15:58:15 2024] xyz123 10-0036: Default height specified in device tree: 720
> > > > > [Sat Mar  9 15:58:15 2024] xyz123 10-0036: xyz123_set_default_format has been invoked to set default format of xyz123.
> > > > > [Sat Mar  9 15:58:15 2024] xyz123 10-0036: xyz123_set_default_format has set code to 12295.
> > > > > [Sat Mar  9 15:58:15 2024] xyz123 10-0036: xyz123_set_default_format has set colorspace to 8.
> > > > > [Sat Mar  9 15:58:15 2024] xyz123 10-0036: xyz123_set_default_format has set ycbcr_enc to 1.
> > > > > [Sat Mar  9 15:58:15 2024] xyz123 10-0036: xyz123_set_default_format has set quantization to 1.
> > > > > [Sat Mar  9 15:58:15 2024] xyz123 10-0036: xyz123_set_default_format has set xfer_func to 2.
> > > > > [Sat Mar  9 15:58:15 2024] xyz123 10-0036: xyz123_set_default_format has set width to 720.
> > > > > [Sat Mar  9 15:58:15 2024] xyz123 10-0036: xyz123_set_default_format has set height to 720.
> > > > > [Sat Mar  9 15:58:15 2024] xyz123 10-0036: xyz123_set_default_format has set field to 1.
> > > > > [Sat Mar  9 15:58:15 2024] xyz123 10-0036: xyz123_set_default_format has completed.
> > > > > [Sat Mar  9 15:58:15 2024] xyz123 10-0036: xyz123_probe has initialized media entity pads for xyz123 to 0 and 2.
> > > > > [Sat Mar  9 15:58:15 2024] xyz123 10-0036: xyz123_probe has registered the subdevice of xyz123.
> > > > > [Sat Mar  9 15:58:15 2024] xyz123 10-0036: xyz123_probe has completed probing xyz123.
> > > > > [Sat Mar  9 15:58:15 2024] xyz123 10-0036: xyz123_power_off has been invoked to power xyz123 down.
> > > > > [Sat Mar  9 15:58:17 2024] xyz123 10-0036: Consider updating driver xyz123 to match on endpoints
> > > > > [Sat Mar  9 15:58:19 2024] xyz123 10-0036: xyz123_open has been invoked to open xyz123.
> > > > > [Sat Mar  9 15:58:19 2024] xyz123 10-0036: xyz123_get_format_code has been invoked to get format code of xyz123.
> > > > > [Sat Mar  9 15:58:19 2024] xyz123 10-0036: h_flip: 0, v_flip: 0, code_index: 0 and 12295 of xyz123.
> > > > > [Sat Mar  9 15:58:22 2024] xyz123 10-0036: xyz123_open has been invoked to open xyz123.
> > > > > [Sat Mar  9 15:58:22 2024] xyz123 10-0036: xyz123_get_format_code has been invoked to get format code of xyz123.
> > > > > [Sat Mar  9 15:58:22 2024] xyz123 10-0036: h_flip: 0, v_flip: 0, code_index: 0 and 12295 of xyz123.
> > > > > [Sat Mar  9 15:58:22 2024] xyz123 10-0036: xyz123_enum_mbus_code has been invoked.
> > > > > [Sat Mar  9 15:58:22 2024] xyz123 10-0036: In xyz123_enum_mbus_code, code-> index has reached limit: 0.
> > > >
> > > > That looks like the likely issue if your limit is 0, so you're not
> > > > returning the supported formats via enum_mbus_code.
> > > >
> > > > Confirm what "v4l2-ctl -d /dev/v4l-subdev0  --list-subdev-mbus-codes
> > > > 0" returns. It should be along the lines of:
> > > >
> > > > pi at raspberrypi:~ $ v4l2-ctl -d /dev/v4l-subdev0  --list-subdev-mbus-codes 0
> > > > ioctl: VIDIOC_SUBDEV_ENUM_MBUS_CODE (pad=0)
> > > >    0x3007: MEDIA_BUS_FMT_SBGGR10_1X10
> > > >
> > > > Based on your code of 12295 (0x3007 aka MEDIA_BUS_FMT_SBGGR10_1X10)
> > > > from set_default_format, that should be returned for index 0, and
> > > > -EINVAL otherwise.
> > > >
> > > > As Laurent says, anything more will need reviewing of the driver source.
> > > >
> > > >  Dave
> > > >
> > > >
> > > > > [Sat Mar  9 15:58:24 2024] xyz123 10-0036: xyz123_enum_mbus_code has been invoked.
> > > > > [Sat Mar  9 15:58:24 2024] xyz123 10-0036: In xyz123_enum_mbus_code, code-> index has reached limit: 0.
> > > > > [Sat Mar  9 15:58:24 2024] xyz123 10-0036: xyz123_enum_mbus_code has been invoked.
> > > > > [Sat Mar  9 15:58:24 2024] xyz123 10-0036: In xyz123_enum_mbus_code, code-> index has reached limit: 0.
> > > > > [Sat Mar  9 15:58:32 2024] xyz123 10-0036: xyz123_open has been invoked to open xyz123.
> > > > > [Sat Mar  9 15:58:32 2024] xyz123 10-0036: xyz123_get_format_code has been invoked to get format code of xyz123.
> > > > > [Sat Mar  9 15:58:32 2024] xyz123 10-0036: h_flip: 0, v_flip: 0, code_index: 0 and 12295 of xyz123.
> > > > > [Sat Mar  9 15:58:32 2024] xyz123 10-0036: xyz123_enum_mbus_code has been invoked.
> > > > > [Sat Mar  9 15:58:32 2024] xyz123 10-0036: In xyz123_enum_mbus_code, code-> index has reached limit: 0.
> > > > > [Sat Mar  9 15:58:33 2024] xyz123 10-0036: xyz123_enum_mbus_code has been invoked.
> > > > > [Sat Mar  9 15:58:33 2024] xyz123 10-0036: In xyz123_enum_mbus_code, code-> index has reached limit: 0.
> > > > > [Sat Mar  9 15:58:33 2024] xyz123 10-0036: xyz123_enum_mbus_code has been invoked.
> > > > > [Sat Mar  9 15:58:33 2024] xyz123 10-0036: In xyz123_enum_mbus_code, code-> index has reached limit: 0.
> > > > > [Sat Mar  9 15:58:51 2024] xyz123 10-0036: xyz123_open has been invoked to open xyz123.
> > > > > [Sat Mar  9 15:58:51 2024] xyz123 10-0036: xyz123_get_format_code has been invoked to get format code of xyz123.
> > > > > [Sat Mar  9 15:58:51 2024] xyz123 10-0036: h_flip: 0, v_flip: 0, code_index: 0 and 12295 of xyz123.
> > > > > [Sat Mar  9 15:58:51 2024] xyz123 10-0036: xyz123_enum_mbus_code has been invoked.
> > > > > [Sat Mar  9 15:58:51 2024] xyz123 10-0036: In xyz123_enum_mbus_code, code-> index has reached limit: 0.
> > > > >
> > > > >
> > > > >


More information about the libcamera-devel mailing list