Other Parts Discussed in Thread: TEST2
hw link:
ds954+ds953+SG2-OX03CC-5200-FPDLink(sensor+isp->YUV422_8b)
Some of the issues can be found in the following link
AM62A7: AM62A7-支持ub960-ub953 - 处理器论坛 - 处理器 - E2E 设计支持 (ti.com)
following,we use ,get noting
SK-AM62A-LP: debug about csi2rx - Processors forum - Processors - TI E2E support forums
// SPDX-License-Identifier: GPL-2.0 /* * Dummy driver for IMX390 self streaming cameras * */ #include <linux/i2c.h> #include <linux/module.h> #include <linux/of.h> #include <linux/v4l2-mediabus.h> #include <linux/videodev2.h> #include <media/v4l2-subdev.h> struct imx390_dummy { struct device *dev; struct i2c_client *client; struct v4l2_subdev subdev; struct media_pad pad; }; static inline struct imx390_dummy *to_imx390(struct v4l2_subdev *sd) { return container_of(sd, struct imx390_dummy, subdev); } static void imx390_dummy_init_formats(struct v4l2_subdev_state *state) { struct v4l2_mbus_framefmt *format; format = v4l2_state_get_stream_format(state, 0, 0); format->code = MEDIA_BUS_FMT_UYVY8_2X8; format->width = 1920; format->height = 1080; format->field = V4L2_FIELD_NONE; format->colorspace = V4L2_COLORSPACE_SMPTE170M; } static int _imx390_dummy_set_routing(struct v4l2_subdev *sd, struct v4l2_subdev_state *state) { struct v4l2_subdev_route routes[] = { { .source_pad = 0, .source_stream = 0, .flags = V4L2_SUBDEV_ROUTE_FL_IMMUTABLE | V4L2_SUBDEV_ROUTE_FL_SOURCE | V4L2_SUBDEV_ROUTE_FL_ACTIVE, }, { .source_pad = 0, .source_stream = 1, .flags = V4L2_SUBDEV_ROUTE_FL_IMMUTABLE | V4L2_SUBDEV_ROUTE_FL_SOURCE, } }; struct v4l2_subdev_krouting routing = { .num_routes = ARRAY_SIZE(routes), .routes = routes, }; int ret; ret = v4l2_subdev_set_routing(sd, state, &routing); if (ret < 0) return ret; imx390_dummy_init_formats(state); return 0; } static int imx390_dummy_init_cfg(struct v4l2_subdev *sd, struct v4l2_subdev_state *state) { int ret; v4l2_subdev_lock_state(state); ret = _imx390_dummy_set_routing(sd, state); v4l2_subdev_unlock_state(state); return ret; } static int imx390_dummy_enum_mbus_code(struct v4l2_subdev *sd, struct v4l2_subdev_state *state, struct v4l2_subdev_mbus_code_enum *code) { code->code = MEDIA_BUS_FMT_UYVY8_2X8; return 0; } static int imx390_dummy_enum_frame_sizes(struct v4l2_subdev *sd, struct v4l2_subdev_state *state, struct v4l2_subdev_frame_size_enum *fse) { fse->min_width = 1920; fse->max_width = fse->min_width; fse->max_height = 1080; fse->min_height = fse->max_height; return 0; } static int imx390_dummy_set_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_state *state, struct v4l2_subdev_format *fmt) { struct v4l2_mbus_framefmt *format; u32 code; int ret = 0; code = MEDIA_BUS_FMT_UYVY8_2X8; v4l2_subdev_lock_state(state); /* Update the stored format and return it. */ format = v4l2_state_get_stream_format(state, fmt->pad, fmt->stream); format->code = code; format->width = 1920; format->height = 1080; fmt->format = *format; v4l2_subdev_unlock_state(state); return ret; } static int imx390_dummy_get_frame_desc(struct v4l2_subdev *sd, unsigned int pad, struct v4l2_mbus_frame_desc *fd) { struct v4l2_subdev_state *state; struct v4l2_mbus_framefmt *fmt; u32 bpp; int ret = 0; if (pad != 0) return -EINVAL; state = v4l2_subdev_lock_active_state(sd); fmt = v4l2_state_get_stream_format(state, 0, 0); if (!fmt) { ret = -EPIPE; goto out; } memset(fd, 0, sizeof(*fd)); fd->type = V4L2_MBUS_FRAME_DESC_TYPE_CSI2; /* pixel stream */ bpp = 12; fd->entry[fd->num_entries].stream = 0; fd->entry[fd->num_entries].flags = V4L2_MBUS_FRAME_DESC_FL_LEN_MAX; fd->entry[fd->num_entries].length = fmt->width * fmt->height * bpp / 8; fd->entry[fd->num_entries].pixelcode = fmt->code; fd->entry[fd->num_entries].bus.csi2.vc = 0; fd->entry[fd->num_entries].bus.csi2.dt = 0x2c; /* SRGGB12 */ fd->num_entries++; out: v4l2_subdev_unlock_state(state); return ret; } static int imx390_dummy_set_routing(struct v4l2_subdev *sd, struct v4l2_subdev_state *state, enum v4l2_subdev_format_whence which, struct v4l2_subdev_krouting *routing) { int ret; if (routing->num_routes == 0 || routing->num_routes > 1) return -EINVAL; v4l2_subdev_lock_state(state); ret = _imx390_dummy_set_routing(sd, state); v4l2_subdev_unlock_state(state); return ret; } static int imx390_dummy_get_frame_interval(struct v4l2_subdev *sd, struct v4l2_subdev_frame_interval *fi) { fi->interval.numerator = 1; fi->interval.denominator = 30; return 0; } static int imx390_dummy_set_frame_interval(struct v4l2_subdev *sd, struct v4l2_subdev_frame_interval *fi) { int ret = 0; fi->interval.numerator = 1; fi->interval.denominator = 30; return ret; } static int imx390_dummy_set_stream(struct v4l2_subdev *sd, int enable) { return 0; } static const struct v4l2_subdev_video_ops imx390_dummy_subdev_video_ops = { .g_frame_interval = imx390_dummy_get_frame_interval, .s_frame_interval = imx390_dummy_set_frame_interval, .s_stream = imx390_dummy_set_stream, }; static const struct v4l2_subdev_pad_ops imx390_dummy_subdev_pad_ops = { .init_cfg = imx390_dummy_init_cfg, .enum_mbus_code = imx390_dummy_enum_mbus_code, .enum_frame_size = imx390_dummy_enum_frame_sizes, .get_fmt = v4l2_subdev_get_fmt, .set_fmt = imx390_dummy_set_fmt, .set_routing = imx390_dummy_set_routing, .get_frame_desc = imx390_dummy_get_frame_desc, }; static const struct v4l2_subdev_ops imx390_dummy_subdev_ops = { .video = &imx390_dummy_subdev_video_ops, .pad = &imx390_dummy_subdev_pad_ops, }; static int imx390_dummy_probe(struct i2c_client *client) { struct imx390_dummy *imx390; struct v4l2_subdev *sd; int ret; imx390 = devm_kzalloc(&client->dev, sizeof(*imx390), GFP_KERNEL); if (!imx390) return -ENOMEM; imx390->dev = &client->dev; /* Initialize the subdev and its controls. */ sd = &imx390->subdev; v4l2_i2c_subdev_init(sd, client, &imx390_dummy_subdev_ops); sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE | V4L2_SUBDEV_FL_HAS_EVENTS | V4L2_SUBDEV_FL_MULTIPLEXED; /* Initialize the media entity. */ imx390->pad.flags = MEDIA_PAD_FL_SOURCE; sd->entity.function = MEDIA_ENT_F_CAM_SENSOR; ret = media_entity_pads_init(&sd->entity, 1, &imx390->pad); if (ret < 0) { dev_err(imx390->dev, "%s: media entity init failed %d\n", __func__, ret); return ret; } ret = v4l2_subdev_init_finalize(sd); if (ret < 0) goto err_subdev_cleanup; /* Finally, register the subdev. */ ret = v4l2_async_register_subdev(sd); if (ret < 0) { dev_err(imx390->dev, "%s: v4l2 subdev register failed %d\n", __func__, ret); goto err_subdev_cleanup; } dev_info(imx390->dev, "imx390 dummy probed\n"); return 0; err_subdev_cleanup: v4l2_subdev_cleanup(&imx390->subdev); media_entity_cleanup(&imx390->subdev.entity); return ret; } static int imx390_dummy_remove(struct i2c_client *client) { struct v4l2_subdev *sd = i2c_get_clientdata(client); struct imx390_dummy *imx390 = to_imx390(sd); v4l2_async_unregister_subdev(sd); v4l2_subdev_cleanup(&imx390->subdev); media_entity_cleanup(&sd->entity); return 0; } struct of_device_id imx390_dummy_dt_id[] = { { .compatible = "ottobrite,imx390dummy" }, { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, imx390_dummy_dt_id); static struct i2c_driver imx390_dummy_i2c_driver = { .driver = { .name = "imx390dummy", .of_match_table = of_match_ptr(imx390_dummy_dt_id), }, .probe_new = imx390_dummy_probe, .remove = imx390_dummy_remove, }; module_i2c_driver(imx390_dummy_i2c_driver); MODULE_DESCRIPTION("Dummy Driver for self streaming IMX390"); MODULE_AUTHOR("Vaishnav Achath <vaishnav.a@ti.com>"); MODULE_LICENSE("GPL v2");
sh fmt-dummy.sh root@am62axx-evm:/opt/edgeai-gst-apps# yavta -s 1920x1080 -f UYVY /dev/video2 -c100^C root@am62axx-evm:/opt/edgeai-gst-apps# media-ctl -2023 Feb 27 10:38:50 am62axx-evm Process 1172 (edgeai-gui-app) of user 0 dumped core. 2023 Feb 27 10:38:50 am62axx-evm Process 1172 (edgeai-gui-app) of user 0 dumped core. p Media controller API version 5.10.168 Media device information ------------------------ driver j721e-csi2rx model TI-CSI2RX serial bus info platform:30102000.ticsi2rx hw revision 0x1 driver version 5.10.168 Device topology - entity 1: 30102000.ticsi2rx (7 pads, 7 links, 1 route) type V4L2 subdev subtype Unknown flags 0 device node name /dev/v4l-subdev0 routes: 0/0 -> 1/0 [ACTIVE] pad0: Sink [stream:0 fmt:UYVY8_1X16/640x480 field:none colorspace:srgb xfer:srgb ycbcr:601 quantization:lim-range] <- "cdns_csi2rx.30101000.csi-bridge":1 [ENABLED,IMMUTABLE] pad1: Source [stream:0 fmt:UYVY8_1X16/640x480 field:none colorspace:srgb xfer:srgb ycbcr:601 quantization:lim-range] -> "30102000.ticsi2rx context 0":0 [ENABLED,IMMUTABLE] pad2: Source -> "30102000.ticsi2rx context 1":0 [ENABLED,IMMUTABLE] pad3: Source -> "30102000.ticsi2rx context 2":0 [ENABLED,IMMUTABLE] pad4: Source -> "30102000.ticsi2rx context 3":0 [ENABLED,IMMUTABLE] pad5: Source -> "30102000.ticsi2rx context 4":0 [ENABLED,IMMUTABLE] pad6: Source -> "30102000.ticsi2rx context 5":0 [ENABLED,IMMUTABLE] - entity 9: cdns_csi2rx.30101000.csi-bridge (5 pads, 2 links, 0 route) type V4L2 subdev subtype Unknown flags 0 device node name /dev/v4l-subdev1 pad0: Sink [stream:0 fmt:UYVY8_1X16/640x480 field:none colorspace:srgb xfer:srgb ycbcr:601 quantization:lim-range] <- "ds90ub960 4-003d":4 [ENABLED,IMMUTABLE] pad1: Source [stream:0 fmt:UYVY8_1X16/640x480 field:none colorspace:srgb xfer:srgb ycbcr:601 quantization:lim-range] -> "30102000.ticsi2rx":0 [ENABLED,IMMUTABLE] pad2: Source [stream:0 fmt:UYVY8_1X16/640x480 field:none colorspace:srgb xfer:srgb ycbcr:601 quantization:lim-range] pad3: Source [stream:0 fmt:UYVY8_1X16/640x480 field:none colorspace:srgb xfer:srgb ycbcr:601 quantization:lim-range] pad4: Source [stream:0 fmt:UYVY8_1X16/640x480 field:none colorspace:srgb xfer:srgb ycbcr:601 quantization:lim-range] - entity 15: ds90ub960 4-003d (6 pads, 2 links, 1 route) type V4L2 subdev subtype Unknown flags 0 device node name /dev/v4l-subdev2 routes: 0/0 -> 4/0 [ACTIVE] pad0: Sink [stream:0 fmt:UYVY8_2X8/1920x1080 field:none] <- "ds90ub953 4-0044":1 [ENABLED,IMMUTABLE] pad1: Sink pad2: Sink pad3: Sink pad4: Source [stream:0 fmt:UYVY8_2X8/1920x1080 field:none] -> "cdns_csi2rx.30101000.csi-bridge":0 [ENABLED,IMMUTABLE] pad5: Source - entity 24: ds90ub953 4-0044 (2 pads, 2 links, 1 route) type V4L2 subdev subtype Unknown flags 0 device node name /dev/v4l-subdev3 routes: 0/0 -> 1/0 [ACTIVE] pad0: Sink [stream:0 fmt:UYVY8_2X8/1920x1080 field:none colorspace:smpte170m] <- "imx390dummy 6-001a":0 [ENABLED,IMMUTABLE] pad1: Source [stream:0 fmt:UYVY8_2X8/1920x1080 field:none colorspace:smpte170m] -> "ds90ub960 4-003d":0 [ENABLED,IMMUTABLE] - entity 29: imx390dummy 6-001a (1 pad, 1 link, 2 routes) type V4L2 subdev subtype Sensor flags 0 device node name /dev/v4l-subdev4 routes: 0/0 -> 0/0 [ACTIVE, IMMUTABLE, SOURCE] 0/0 -> 0/1 [INACTIVE, IMMUTABLE, SOURCE] pad0: Source [stream:0 fmt:UYVY8_2X8/1920x1080@1/30 field:none colorspace:smpte170m] -> "ds90ub953 4-0044":0 [ENABLED,IMMUTABLE] - entity 35: 30102000.ticsi2rx context 0 (1 pad, 1 link, 0 route) type Node subtype V4L flags 0 device node name /dev/video2 pad0: Sink <- "30102000.ticsi2rx":1 [ENABLED,IMMUTABLE] - entity 41: 30102000.ticsi2rx context 1 (1 pad, 1 link, 0 route) type Node subtype V4L flags 0 device node name /dev/video3 pad0: Sink <- "30102000.ticsi2rx":2 [ENABLED,IMMUTABLE] - entity 47: 30102000.ticsi2rx context 2 (1 pad, 1 link, 0 route) type Node subtype V4L flags 0 device node name /dev/video4 pad0: Sink <- "30102000.ticsi2rx":3 [ENABLED,IMMUTABLE] - entity 53: 30102000.ticsi2rx context 3 (1 pad, 1 link, 0 route) type Node subtype V4L flags 0 device node name /dev/video5 pad0: Sink <- "30102000.ticsi2rx":4 [ENABLED,IMMUTABLE] - entity 59: 30102000.ticsi2rx context 4 (1 pad, 1 link, 0 route) type Node subtype V4L flags 0 device node name /dev/video6 pad0: Sink <- "30102000.ticsi2rx":5 [ENABLED,IMMUTABLE] - entity 65: 30102000.ticsi2rx context 5 (1 pad, 1 link, 0 route) type Node subtype V4L flags 0 device node name /dev/video7 pad0: Sink <- "30102000.ticsi2rx":6 [ENABLED,IMMUTABLE] root@am62axx-evm:/opt/edgeai-gst-apps# root@am62axx-evm:/opt/edgeai-gst-apps# yavta -s 1920x1080 -f UYVY /dev/video2 -c100 Device /dev/video2 opened. [ 45.194119] zyk ti_csi2rx_queue_setup 823 Device `j721e-csi2rx' on `platform:30102000.ticsi2rx' is a video[ 45.202359] videobuf2_common: [cap-00000000cb995559] __setup_offsets: buffer 0, plane 0 offset 0x00000000 output (without mplanes) device. Video format set: UYVY (59565[ 45.217124] videobuf2_common: [cap-00000000cb995559] __setup_offsets: buffer 1, plane 0 offset 0x003f5000 955) 1920x1080 (stride 3840) field none buffer size 4147200 Vid[ 45.232340] videobuf2_common: [cap-00000000cb995559] __setup_offsets: buffer 2, plane 0 offset 0x007ea000 eo format: UYVY (59565955) 1920x1080 (stride 3840) field none bu[ 45.247598] videobuf2_common: [cap-00000000cb995559] __setup_offsets: buffer 3, plane 0 offset 0x00bdf000 ffer size 4147200 [ 45.262464] videobuf2_common: [cap-00000000cb995559] __setup_offsets: buffer 4, plane 0 offset 0x00fd4000 [ 45.273497] videobuf2_common: [cap-00000000cb995559] __setup_offsets: buffer 5, plane 0 offset 0x013c9000 [ 45.284784] videobuf2_common: [cap-00000000cb995559] __setup_offsets: buffer 6, plane 0 offset 0x017be000 [ 45.296014] videobuf2_common: [cap-00000000cb995559] __setup_offsets: buffer 7, plane 0 offset 0x01bb3000 [ 45.305733] videobuf2_common: [cap-00000000cb995559] __vb2_queue_alloc: allocated 8 buffers, 1 plane(s) each 8 buffers requested. [ 45.315896] videobuf2_common: [cap-00000000cb995559] vb2_mmap: buffer 0, plane 0 successfully mapped length: 4147200 offset: 0 timestamp type/source: mono/EoF [ 45.326905] videobuf2_common: [cap-00000000cb995559] vb2_mmap: buffer 1, plane 0 successfully mapped Buffer 0/0 mapped at address 0xffff90858000. length: 4147200 of[ 45.340994] videobuf2_common: [cap-00000000cb995559] vb2_mmap: buffer 2, plane 0 successfully mapped fset: 4149248 timestamp type/source: mono/EoF Buffer 1/0 mapped[ 45.355768] videobuf2_common: [cap-00000000cb995559] vb2_mmap: buffer 3, plane 0 successfully mapped at address 0xffff90463000. length: 4147200 offset: 8298496 tim[ 45.370292] videobuf2_common: [cap-00000000cb995559] vb2_mmap: buffer 4, plane 0 successfully mapped estamp type/source: mono/EoF Buffer 2/0 mapped at address 0xfff[ 45.385079] videobuf2_common: [cap-00000000cb995559] vb2_mmap: buffer 5, plane 0 successfully mapped f9006e000. length: 4147200 offset: 12447744 timestamp type/sour[ 45.399614] videobuf2_common: [cap-00000000cb995559] vb2_mmap: buffer 6, plane 0 successfully mapped ce: mono/EoF Buffer 3/0 mapped at address 0xffff8fc79000. leng[ 45.414405] videobuf2_common: [cap-00000000cb995559] vb2_mmap: buffer 7, plane 0 successfully mapped th: 4147200 offset: 16596992 timestamp type/source: mono/EoF Bu[ 45.428887] videobuf2_common: [cap-00000000cb995559] vb2_core_qbuf: qbuf of buffer 0 succeeded ffer 4/0 mapped at address 0xffff8f884000. length: 4147200 offs[ 45.443092] videobuf2_common: [cap-00000000cb995559] vb2_core_qbuf: qbuf of buffer 1 succeeded et: 20746240 timestamp type/source: mono/EoF Buffer 5/0 mapped [ 45.457113] videobuf2_common: [cap-00000000cb995559] vb2_core_qbuf: qbuf of buffer 2 succeeded at address 0xffff8f48f000. length: 4147200 offset: 24895488 tim[ 45.471343] videobuf2_common: [cap-00000000cb995559] vb2_core_qbuf: qbuf of buffer 3 succeeded estamp type/source: mono/EoF Buffer 6/0 mapped at address 0xfff[ 45.485408] videobuf2_common: [cap-00000000cb995559] vb2_core_qbuf: qbuf of buffer 4 succeeded f8f09a000. length: 4147200 offset: 29044736 timestamp type/sour[ 45.485418] videobuf2_common: [cap-00000000cb995559] vb2_core_qbuf: qbuf of buffer 5 succeeded ce: mono/EoF Buffer 7/0 mapped at address 0xffff8eca5000. [ 45.513652] videobuf2_common: [cap-00000000cb995559] vb2_core_qbuf: qbuf of buffer 6 succeeded [ 45.513664] videobuf2_common: [cap-00000000cb995559] vb2_core_qbuf: qbuf of buffer 7 succeeded [ 45.536178] zyk ti_csi2rx_buffer_queue 875 [ 45.540487] zyk ti_csi2rx_buffer_queue 875 [ 45.544616] zyk ti_csi2rx_buffer_queue 875 [ 45.544622] zyk ti_csi2rx_buffer_queue 875 [ 45.552954] zyk ti_csi2rx_buffer_queue 875 [ 45.552958] zyk ti_csi2rx_buffer_queue 875 [ 45.552961] zyk ti_csi2rx_buffer_queue 875 [ 45.552963] zyk ti_csi2rx_buffer_queue 875 [ 45.570942] zyk ti_csi2rx_start_dma 771 [ 45.574949] videobuf2_common: [cap-00000000cb995559] vb2_core_streamon: successful [ 45.582596] videobuf2_common: [cap-00000000cb995559] __vb2_wait_for_done_vb: will sleep waiting for buffers ^Z[ 48.565869] videobuf2_common: [cap-00000000cb995559] __vb2_wait_for_done_vb: sleep was interrupted [1]+ Stopped(SIGTSTP) yavta -s 1920x1080 -f UYVY /dev/video2 -c100 root@am62axx-evm:/opt/edgeai-gst-apps# sh C0.sh 953 config 953 end config root@am62axx-evm:/opt/edgeai-gst-apps# root@am62axx-evm:/opt/edgeai-gst-apps# root@am62axx-evm:/opt/edgeai-gst-apps# root@am62axx-evm:/opt/edgeai-gst-apps# root@am62axx-evm:/opt/edgeai-gst-apps# root@am62axx-evm:/opt/edgeai-gst-apps# root@am62axx-evm:/opt/edgeai-gst-apps# root@am62axx-evm:/opt/edgeai-gst-apps# root@am62axx-evm:/opt/edgeai-gst-apps# root@am62axx-evm:/opt/edgeai-gst-apps# root@am62axx-evm:/opt/edgeai-gst-apps# root@am62axx-evm:/opt/edgeai-gst-apps# root@am62axx-evm:/opt/edgeai-gst-apps# root@am62axx-evm:/opt/edgeai-gst-apps# fg yavta -s 1920x1080 -f UYVY /dev/video2 -c100[ 54.197831] videobuf2_common: [cap-00000000cb995559] __vb2_wait_for_done_vb: will sleep waiting for buffers