2019-04-01 09:32:34

by Hugues Fruchet

[permalink] [raw]
Subject: [PATCH 0/2] DCMI bridge support

This patch serie allows to connect non-parallel camera sensor to
DCMI thanks to a bridge connected in between such as STMIPID02 [1].

Media controller support is introduced first, then support of
several sub-devices within pipeline with dynamic linking
between them.

[1] https://www.spinics.net/lists/devicetree/msg278002.html

Hugues Fruchet (2):
media: stm32-dcmi: add media controller support
media: stm32-dcmi: add support of several sub-devices

drivers/media/platform/Kconfig | 2 +-
drivers/media/platform/stm32/stm32-dcmi.c | 213 ++++++++++++++++++++++++------
2 files changed, 177 insertions(+), 38 deletions(-)

--
2.7.4


2019-04-01 09:32:40

by Hugues Fruchet

[permalink] [raw]
Subject: [PATCH 2/2] media: stm32-dcmi: add support of several sub-devices

Add support of several sub-devices within pipeline.
This allows support of a CSI-2 camera sensor connected
through a CSI-2 to parallel bridge.

Signed-off-by: Hugues Fruchet <[email protected]>
---
drivers/media/platform/stm32/stm32-dcmi.c | 129 ++++++++++++++++++++++++++----
1 file changed, 113 insertions(+), 16 deletions(-)

diff --git a/drivers/media/platform/stm32/stm32-dcmi.c b/drivers/media/platform/stm32/stm32-dcmi.c
index 488858e..f441721 100644
--- a/drivers/media/platform/stm32/stm32-dcmi.c
+++ b/drivers/media/platform/stm32/stm32-dcmi.c
@@ -175,6 +175,7 @@ struct stm32_dcmi {

struct media_device mdev;
struct media_pad vid_cap_pad;
+ struct media_pipeline pipeline;
};

static inline struct stm32_dcmi *notifier_to_dcmi(struct v4l2_async_notifier *n)
@@ -586,6 +587,51 @@ static void dcmi_buf_queue(struct vb2_buffer *vb)
spin_unlock_irq(&dcmi->irqlock);
}

+static int dcmi_pipeline_start_stop(struct stm32_dcmi *dcmi, bool start)
+{
+ struct media_entity *entity = &dcmi->vdev->entity;
+ struct v4l2_subdev *subdev;
+ struct media_pad *pad;
+ int ret;
+
+ /* Start/stop all entities within pipeline */
+ while (1) {
+ pad = &entity->pads[0];
+ if (!(pad->flags & MEDIA_PAD_FL_SINK))
+ break;
+
+ pad = media_entity_remote_pad(pad);
+ if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
+ break;
+
+ entity = pad->entity;
+ subdev = media_entity_to_v4l2_subdev(entity);
+
+ ret = v4l2_subdev_call(subdev, video, s_stream, start);
+ if (ret < 0 && ret != -ENOIOCTLCMD) {
+ dev_err(dcmi->dev, "%s: Subdev %s failed to %s streaming (%d)\n",
+ __func__, subdev->name,
+ start ? "start" : "stop", ret);
+ return ret;
+ }
+
+ dev_dbg(dcmi->dev, "Subdev %s %s\n",
+ subdev->name, start ? "started" : "stopped");
+ }
+
+ return 0;
+}
+
+static int dcmi_pipeline_start(struct stm32_dcmi *dcmi)
+{
+ return dcmi_pipeline_start_stop(dcmi, true);
+}
+
+static void dcmi_pipeline_stop(struct stm32_dcmi *dcmi)
+{
+ dcmi_pipeline_start_stop(dcmi, false);
+}
+
static int dcmi_start_streaming(struct vb2_queue *vq, unsigned int count)
{
struct stm32_dcmi *dcmi = vb2_get_drv_priv(vq);
@@ -600,14 +646,17 @@ static int dcmi_start_streaming(struct vb2_queue *vq, unsigned int count)
goto err_release_buffers;
}

- /* Enable stream on the sub device */
- ret = v4l2_subdev_call(dcmi->entity.subdev, video, s_stream, 1);
- if (ret && ret != -ENOIOCTLCMD) {
- dev_err(dcmi->dev, "%s: Failed to start streaming, subdev streamon error",
- __func__);
+ ret = media_pipeline_start(&dcmi->vdev->entity, &dcmi->pipeline);
+ if (ret < 0) {
+ dev_err(dcmi->dev, "%s: Failed to start streaming, media pipeline start error (%d)\n",
+ __func__, ret);
goto err_pm_put;
}

+ ret = dcmi_pipeline_start(dcmi);
+ if (ret)
+ goto err_media_pipeline_stop;
+
spin_lock_irq(&dcmi->irqlock);

/* Set bus width */
@@ -702,7 +751,7 @@ static int dcmi_start_streaming(struct vb2_queue *vq, unsigned int count)
if (ret) {
dev_err(dcmi->dev, "%s: Start streaming failed, cannot start capture\n",
__func__);
- goto err_subdev_streamoff;
+ goto err_pipeline_stop;
}

/* Enable interruptions */
@@ -713,8 +762,11 @@ static int dcmi_start_streaming(struct vb2_queue *vq, unsigned int count)

return 0;

-err_subdev_streamoff:
- v4l2_subdev_call(dcmi->entity.subdev, video, s_stream, 0);
+err_pipeline_stop:
+ dcmi_pipeline_stop(dcmi);
+
+err_media_pipeline_stop:
+ media_pipeline_stop(&dcmi->vdev->entity);

err_pm_put:
pm_runtime_put(dcmi->dev);
@@ -739,13 +791,10 @@ static void dcmi_stop_streaming(struct vb2_queue *vq)
{
struct stm32_dcmi *dcmi = vb2_get_drv_priv(vq);
struct dcmi_buf *buf, *node;
- int ret;

- /* Disable stream on the sub device */
- ret = v4l2_subdev_call(dcmi->entity.subdev, video, s_stream, 0);
- if (ret && ret != -ENOIOCTLCMD)
- dev_err(dcmi->dev, "%s: Failed to stop streaming, subdev streamoff error (%d)\n",
- __func__, ret);
+ dcmi_pipeline_stop(dcmi);
+
+ media_pipeline_stop(&dcmi->vdev->entity);

spin_lock_irq(&dcmi->irqlock);

@@ -1554,8 +1603,25 @@ static int dcmi_graph_notify_complete(struct v4l2_async_notifier *notifier)
{
struct stm32_dcmi *dcmi = notifier_to_dcmi(notifier);
int ret;
+ struct media_entity *entity;
+
+ /*
+ * Now that the graph is complete,
+ * we search for the camera sensor subdevice
+ * in order to expose it through V4L2 interface
+ */
+ media_device_for_each_entity(entity, &dcmi->mdev)
+ if (entity->function == MEDIA_ENT_F_CAM_SENSOR)
+ dcmi->entity.subdev =
+ media_entity_to_v4l2_subdev(entity);
+
+ if (!dcmi->entity.subdev) {
+ dev_err(dcmi->dev, "No camera sensor subdevice found\n");
+ return -ENODEV;
+ }

dcmi->vdev->ctrl_handler = dcmi->entity.subdev->ctrl_handler;
+
ret = dcmi_formats_init(dcmi);
if (ret) {
dev_err(dcmi->dev, "No supported mediabus format found\n");
@@ -1599,12 +1665,34 @@ static int dcmi_graph_notify_bound(struct v4l2_async_notifier *notifier,
struct v4l2_async_subdev *asd)
{
struct stm32_dcmi *dcmi = notifier_to_dcmi(notifier);
+ unsigned int ret;
+ int source_pad;

dev_dbg(dcmi->dev, "Subdev %s bound\n", subdev->name);

- dcmi->entity.subdev = subdev;
+ if (subdev->entity.function != MEDIA_ENT_F_CAM_SENSOR &&
+ subdev->entity.function != MEDIA_ENT_F_VID_IF_BRIDGE)
+ return 0;

- return 0;
+ /*
+ * Link this subdevice to DCMI, it could be a
+ * parallel camera sensor directly or a bridge
+ */
+ source_pad = media_entity_get_fwnode_pad(&subdev->entity,
+ subdev->fwnode,
+ MEDIA_PAD_FL_SOURCE);
+
+ ret = media_create_pad_link(&subdev->entity, source_pad,
+ &dcmi->vdev->entity, 0,
+ MEDIA_LNK_FL_IMMUTABLE |
+ MEDIA_LNK_FL_ENABLED);
+ if (ret)
+ dev_err(dcmi->dev, "Failed to create media pad link with subdev %s\n",
+ subdev->name);
+ else
+ dev_dbg(dcmi->dev, "DCMI is now linked to %s\n", subdev->name);
+
+ return ret;
}

static const struct v4l2_async_notifier_operations dcmi_graph_notify_ops = {
@@ -1664,6 +1752,15 @@ static int dcmi_graph_init(struct stm32_dcmi *dcmi)
return ret;
}

+ /* Register all the subdev nodes */
+ ret = v4l2_device_register_subdev_nodes(&dcmi->v4l2_dev);
+ if (ret) {
+ dev_err(dcmi->dev, "Failed to register subdev nodes\n");
+ v4l2_async_notifier_unregister(&dcmi->notifier);
+ of_node_put(dcmi->entity.node);
+ return ret;
+ }
+
return 0;
}

--
2.7.4

2019-04-01 09:32:47

by Hugues Fruchet

[permalink] [raw]
Subject: [PATCH 1/2] media: stm32-dcmi: add media controller support

Add media controller support to dcmi.

Signed-off-by: Hugues Fruchet <[email protected]>
---
drivers/media/platform/Kconfig | 2 +-
drivers/media/platform/stm32/stm32-dcmi.c | 84 +++++++++++++++++++++++--------
2 files changed, 64 insertions(+), 22 deletions(-)

diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig
index 1611ec2..b726c64 100644
--- a/drivers/media/platform/Kconfig
+++ b/drivers/media/platform/Kconfig
@@ -121,7 +121,7 @@ config VIDEO_S3C_CAMIF

config VIDEO_STM32_DCMI
tristate "STM32 Digital Camera Memory Interface (DCMI) support"
- depends on VIDEO_V4L2 && OF
+ depends on VIDEO_V4L2 && OF && MEDIA_CONTROLLER
depends on ARCH_STM32 || COMPILE_TEST
select VIDEOBUF2_DMA_CONTIG
select V4L2_FWNODE
diff --git a/drivers/media/platform/stm32/stm32-dcmi.c b/drivers/media/platform/stm32/stm32-dcmi.c
index 2142883..488858e 100644
--- a/drivers/media/platform/stm32/stm32-dcmi.c
+++ b/drivers/media/platform/stm32/stm32-dcmi.c
@@ -172,6 +172,9 @@ struct stm32_dcmi {

/* Ensure DMA operations atomicity */
struct mutex dma_lock;
+
+ struct media_device mdev;
+ struct media_pad vid_cap_pad;
};

static inline struct stm32_dcmi *notifier_to_dcmi(struct v4l2_async_notifier *n)
@@ -1570,21 +1573,12 @@ static int dcmi_graph_notify_complete(struct v4l2_async_notifier *notifier)
dev_err(dcmi->dev, "Could not get sensor bounds\n");
return ret;
}
-
ret = dcmi_set_default_fmt(dcmi);
if (ret) {
dev_err(dcmi->dev, "Could not set default format\n");
return ret;
}

- ret = video_register_device(dcmi->vdev, VFL_TYPE_GRABBER, -1);
- if (ret) {
- dev_err(dcmi->dev, "Failed to register video device\n");
- return ret;
- }
-
- dev_dbg(dcmi->dev, "Device registered as %s\n",
- video_device_node_name(dcmi->vdev));
return 0;
}

@@ -1673,6 +1667,12 @@ static int dcmi_graph_init(struct stm32_dcmi *dcmi)
return 0;
}

+static void dcmi_graph_deinit(struct stm32_dcmi *dcmi)
+{
+ v4l2_async_notifier_unregister(&dcmi->notifier);
+ v4l2_async_notifier_cleanup(&dcmi->notifier);
+}
+
static int dcmi_probe(struct platform_device *pdev)
{
struct device_node *np = pdev->dev.of_node;
@@ -1775,10 +1775,27 @@ static int dcmi_probe(struct platform_device *pdev)

q = &dcmi->queue;

+ dcmi->v4l2_dev.mdev = &dcmi->mdev;
+
+ /* Initialize media device */
+ strscpy(dcmi->mdev.model, DRV_NAME, sizeof(dcmi->mdev.model));
+ snprintf(dcmi->mdev.bus_info, sizeof(dcmi->mdev.bus_info),
+ "platform:%s", DRV_NAME);
+ dcmi->mdev.dev = &pdev->dev;
+ media_device_init(&dcmi->mdev);
+
+ /* Register the media device */
+ ret = media_device_register(&dcmi->mdev);
+ if (ret) {
+ dev_err(dcmi->dev, "Failed to register media device (%d)\n",
+ ret);
+ goto err_media_device_cleanup;
+ }
+
/* Initialize the top-level structure */
ret = v4l2_device_register(&pdev->dev, &dcmi->v4l2_dev);
if (ret)
- goto err_dma_release;
+ goto err_media_device_unregister;

dcmi->vdev = video_device_alloc();
if (!dcmi->vdev) {
@@ -1798,6 +1815,25 @@ static int dcmi_probe(struct platform_device *pdev)
V4L2_CAP_READWRITE;
video_set_drvdata(dcmi->vdev, dcmi);

+ /* Media entity pads */
+ dcmi->vid_cap_pad.flags = MEDIA_PAD_FL_SINK;
+ ret = media_entity_pads_init(&dcmi->vdev->entity,
+ 1, &dcmi->vid_cap_pad);
+ if (ret) {
+ dev_err(dcmi->dev, "Failed to init media entity pad\n");
+ goto err_device_unregister;
+ }
+ dcmi->vdev->entity.flags |= MEDIA_ENT_FL_DEFAULT;
+
+ ret = video_register_device(dcmi->vdev, VFL_TYPE_GRABBER, -1);
+ if (ret) {
+ dev_err(dcmi->dev, "Failed to register video device\n");
+ goto err_media_entity_cleanup;
+ }
+
+ dev_dbg(dcmi->dev, "Device registered as %s\n",
+ video_device_node_name(dcmi->vdev));
+
/* Buffer queue */
q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
q->io_modes = VB2_MMAP | VB2_READ | VB2_DMABUF;
@@ -1813,18 +1849,18 @@ static int dcmi_probe(struct platform_device *pdev)
ret = vb2_queue_init(q);
if (ret < 0) {
dev_err(&pdev->dev, "Failed to initialize vb2 queue\n");
- goto err_device_release;
+ goto err_media_entity_cleanup;
}

ret = dcmi_graph_init(dcmi);
if (ret < 0)
- goto err_device_release;
+ goto err_media_entity_cleanup;

/* Reset device */
ret = reset_control_assert(dcmi->rstc);
if (ret) {
dev_err(&pdev->dev, "Failed to assert the reset line\n");
- goto err_cleanup;
+ goto err_graph_deinit;
}

usleep_range(3000, 5000);
@@ -1832,7 +1868,7 @@ static int dcmi_probe(struct platform_device *pdev)
ret = reset_control_deassert(dcmi->rstc);
if (ret) {
dev_err(&pdev->dev, "Failed to deassert the reset line\n");
- goto err_cleanup;
+ goto err_graph_deinit;
}

dev_info(&pdev->dev, "Probe done\n");
@@ -1843,13 +1879,17 @@ static int dcmi_probe(struct platform_device *pdev)

return 0;

-err_cleanup:
- v4l2_async_notifier_cleanup(&dcmi->notifier);
-err_device_release:
- video_device_release(dcmi->vdev);
+err_graph_deinit:
+ dcmi_graph_deinit(dcmi);
+err_media_entity_cleanup:
+ media_entity_cleanup(&dcmi->vdev->entity);
err_device_unregister:
v4l2_device_unregister(&dcmi->v4l2_dev);
-err_dma_release:
+err_media_device_unregister:
+ media_device_unregister(&dcmi->mdev);
+err_media_device_cleanup:
+ media_device_cleanup(&dcmi->mdev);
+
dma_release_channel(dcmi->dma_chan);

return ret;
@@ -1861,9 +1901,11 @@ static int dcmi_remove(struct platform_device *pdev)

pm_runtime_disable(&pdev->dev);

- v4l2_async_notifier_unregister(&dcmi->notifier);
- v4l2_async_notifier_cleanup(&dcmi->notifier);
+ dcmi_graph_deinit(dcmi);
+ media_entity_cleanup(&dcmi->vdev->entity);
v4l2_device_unregister(&dcmi->v4l2_dev);
+ media_device_unregister(&dcmi->mdev);
+ media_device_cleanup(&dcmi->mdev);

dma_release_channel(dcmi->dma_chan);

--
2.7.4

2019-04-01 11:11:31

by Hans Verkuil

[permalink] [raw]
Subject: Re: [PATCH 0/2] DCMI bridge support

Hi Hugues,

On 4/1/19 11:31 AM, Hugues Fruchet wrote:
> This patch serie allows to connect non-parallel camera sensor to
> DCMI thanks to a bridge connected in between such as STMIPID02 [1].
>
> Media controller support is introduced first, then support of
> several sub-devices within pipeline with dynamic linking
> between them.

Can you post the output of v4l2-compliance -m /dev/mediaX ?

Thanks!

Hans

>
> [1] https://www.spinics.net/lists/devicetree/msg278002.html
>
> Hugues Fruchet (2):
> media: stm32-dcmi: add media controller support
> media: stm32-dcmi: add support of several sub-devices
>
> drivers/media/platform/Kconfig | 2 +-
> drivers/media/platform/stm32/stm32-dcmi.c | 213 ++++++++++++++++++++++++------
> 2 files changed, 177 insertions(+), 38 deletions(-)
>

2019-04-01 13:09:20

by Hugues Fruchet

[permalink] [raw]
Subject: Re: [PATCH 0/2] DCMI bridge support

Hi Hans,

Here it is.

SHA1 is aa371c995ec2ad70323db00c47b3132002b060b7:

Author: Hans Verkuil <[email protected]> 2019-02-08 16:21:23
Committer: Hans Verkuil <[email protected]> 2019-02-08 16:21:23
Parent: 98d5622551eb6b9a0397464fb52378949f33c364 (v4l2-compliance:
support m2m devices with -f)
Child: 59f9840781aab464c1331dcdb82e63dd0544b5c6 (v4l2-compliance:
remove duplicate MEDIA_IOC_DEVICE_INFO ioctl call)
Branches: master, master2, remotes/origin/master
Follows: v4l-utils-1.16.0
Precedes:

v4l2-compliance: -f bug fixes


Result is below:

root@stm32mp1:~# v4l2-compliance -m /dev/media0
v4l2-compliance SHA: eb8e3b07c9249ff56091ae4bc3ae9b76779db4cd, 32 bits

Compliance test for stm32-dcmi device /dev/media0:

Media Driver Info:
Driver name : stm32-dcmi
Model : stm32-dcmi
Serial :
Bus info : platform:stm32-dcmi
Media version : 5.0.0
Hardware revision: 0x00000000 (0)
Driver version : 5.0.0

Required ioctls:
test MEDIA_IOC_DEVICE_INFO: OK

Allow for multiple opens:
test second /dev/media0 open: OK
test MEDIA_IOC_DEVICE_INFO: OK
test for unlimited opens: OK

Media Controller ioctls:
test MEDIA_IOC_G_TOPOLOGY: OK
Entities: 3 Interfaces: 2 Pads: 4 Links: 4
test MEDIA_IOC_ENUM_ENTITIES/LINKS: OK
test MEDIA_IOC_SETUP_LINK: OK

Total for stm32-dcmi device /dev/media0: 7, Succeeded: 7, Failed: 0,
Warnings: 0
--------------------------------------------------------------------------------
Compliance test for stm32-dcmi device /dev/video0:

Driver Info:
Driver name : stm32-dcmi
Card type : STM32 Camera Memory Interface
Bus info : platform:dcmi
Driver version : 5.0.0
Capabilities : 0x85200001
Video Capture
Read/Write
Streaming
[ 2117.336477] stm32-dcmi 4c006000.dcmi:
================= START STATUS =================
E[ 2117.344647] stm32-dcmi 4c006000.dcmi: White Balance, Automatic: true
[ 2117.350990] stm32-dcmi 4c006000.dcmi: Blue Balance: 0 inactive
x[ 2117.356853] stm32-dcmi 4c006000.dcmi: Red Balance: 0 inactive
[ 2117.362645] stm32-dcmi 4c006000.dcmi: Auto Exposure: Auto Mode
[ 2117.368438] stm32-dcmi 4c006000.dcmi: Exposure: 0 inactive volatile
t[ 2117.374729] stm32-dcmi 4c006000.dcmi: Gain, Automatic: true
[ 2117.380335] stm32-dcmi 4c006000.dcmi: Gain: 0 inactive volatile
e[ 2117.386305] stm32-dcmi 4c006000.dcmi: Saturation: 64
[ 2117.391275] stm32-dcmi 4c006000.dcmi: Hue: 0
n[ 2117.395572] stm32-dcmi 4c006000.dcmi: Contrast: 0
[ 2117.400305] stm32-dcmi 4c006000.dcmi: Test Pattern: Disabled
d[ 2117.405988] stm32-dcmi 4c006000.dcmi: Horizontal Flip: false
[ 2117.411721] stm32-dcmi 4c006000.dcmi: Vertical Flip: false
[ 2117.417148] stm32-dcmi 4c006000.dcmi: Power Line Frequency: 50 Hz
[ 2117.423265] stm32-dcmi 4c006000.dcmi: ================== END STATUS
==================
ed Pix Format
Device Capabilities
Device Caps : 0x05200001
Video Capture
Read/Write
Streaming
Extended Pix Format
Media Driver Info:
Driver name : stm32-dcmi
Model : stm32-dcmi
Serial :
Bus info : platform:stm32-dcmi
Media version : 5.0.0
Hardware revision: 0x00000000 (0)
Driver version : 5.0.0
Interface Info:
ID : 0x03000003
Type : V4L Video
Entity Info:
ID : 0x00000001 (1)
Name : stm32_dcmi
Function : V4L2 I/O
Flags : default
Pad 0x01000002 : 0: Sink
Link 0x02000008: from remote pad 0x1000007 of entity 'mipid02
0-0014': Data, Enabled, Immutable

Required ioctls:
test MC information (see 'Media Driver Info' above): OK
warn:
../../../../../../../../../sources/v4l-utils/utils/v4l2-compliance/v4l2-compliance.cpp(621):
media bus_info 'platform:stm32-dcmi
' differs from V4L2 bus_info 'platform:dcmi'
test VIDIOC_QUERYCAP: OK

Allow for multiple opens:
test second /dev/video0 open: OK
warn:
../../../../../../../../../sources/v4l-utils/utils/v4l2-compliance/v4l2-compliance.cpp(621):
media bus_info 'platform:stm32-dcmi
' differs from V4L2 bus_info 'platform:dcmi'
test VIDIOC_QUERYCAP: OK
test VIDIOC_G/S_PRIORITY: OK
test for unlimited opens: OK

Debug ioctls:
test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported)
test VIDIOC_LOG_STATUS: OK

Input ioctls:
test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported)
test VIDIOC_G/S_FRE[ 2117.564770] mipid02 0-0014:
================= START STATUS =================
Q[ 2117.572042] mipid02 0-0014: ================== END STATUS
==================
UENCY: OK (Not Supported)
test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported)
test VIDIOC_ENUMAUDIO: OK (Not Supported)
test VIDIOC_G/S/ENUMINPUT: OK
test VIDIOC_G/S_AUDIO: OK (Not Supported)
Inputs: 1 Audio Inputs: 0 Tuners: 0

Output ioctls:
test VIDIOC_G/S_MODULATOR: OK (Not Supported)
test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
test VIDIOC_ENUMAUDOUT: OK (Not Supported)
test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported)
test VIDIOC_G/S_AUDOUT: OK (Not Supported)
Outputs: 0 Audio Outputs: 0 Modulators: 0

Input/Output configuration ioctls:
test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported)
test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported)
test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported)
test VIDIOC_G/S_EDID: OK (Not Supported)

Control ioctls (Input 0):
test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK
test VIDIOC_QUERYCTRL: OK
test VIDIOC_G/S_CTRL: OK
test VIDIOC_G/S/TRY_EXT_CTRLS: OK
test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK
test VIDIOC_G/S_JPEGCOMP: OK (Not Supported)
Standard Controls: 17 Private Controls: 0

Format ioctls (Input 0):
test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK
test VIDIOC_G/S_PARM: OK
test VIDIOC_G_FBUF: OK (Not Supported)
test VIDIOC_G_FMT: OK
test VIDIOC_TRY_FMT: OK
test VIDIOC_S_FMT: OK
test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported)
fail:
../../../../../../../../../sources/v4l-utils/utils/v4l2-compliance/v4l2-test-formats.cpp(1338):
node->frmsizes_count[pixfmt] > 1
test Cropping: FAIL
test Composing: OK (Not Supported)
test Scaling: OK (Not Supported)

Codec ioctls (Input 0):
test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported)
test VIDIOC_G_ENC_INDEX: OK (Not Supported)
test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)

Buffer ioctls (Input 0):
test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK
test VIDIOC_EXPBUF: OK
test Requests: OK (Not Supported)

Total for stm32-dcmi device /dev/video0: 45, Succeeded: 44, Failed: 1,
Warnings: 2
--------------------------------------------------------------------------------
Compliance test for device /dev/v4l-subdev0:


Required ioctls:

Allow for multiple opens:
test second /dev/v4l-subdev0 open: OK
test for unlimited opens: OK

Debug ioctls:
test VIDIOC_LOG_STATUS: OK (Not Supported)

Input ioctls:
test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported)
test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported)
test VIDIOC_ENUMAUDIO: OK (Not Supported)
test VIDIOC_G/S/ENUMINPUT: OK (Not Supported)
test VIDIOC_G/S_AUDIO: OK (Not Supported)
Inputs: 0 Audio Inputs: 0 Tuners: 0

Output ioctls:
test VIDIOC_G/S_MODULATOR: OK (Not Supported)
test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
test VIDIOC_ENUMAUDOUT: OK (Not Supported)
test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported)
test VIDIOC_G/S_AUDOUT: OK (Not Supported)
Outputs: 0 Audio Outputs: 0 Modulators: 0

Input/Output configuration ioctls:
test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported)
test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported)
test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported)
test VIDIOC_G/S_EDID: OK (Not Supported)

Control ioctls:
test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK (Not Supported)
test VIDIOC_QUERYCTRL: OK (Not Supported)
test VIDIOC_G/S_CTRL: OK (Not Supported)
test VIDIOC_G/S/TRY_EXT_CTRLS: OK (Not Supported)
test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK (Not Supported)
test VIDIOC_G/S_JPEGCOMP: OK (Not Supported)
Standard Controls: 0 Private Controls: 0

Format ioctls:
test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK (Not Supported)
test VIDIOC_G/S_PARM: OK (Not Supported)
test VIDIOC_G_FBUF: OK (Not Supported)
test VIDIOC_G_FMT: OK (Not Supported)
test VIDIOC_TRY_FMT: OK (Not Supported)
test VIDIOC_S_FMT: OK (Not Supported)
test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported)
test Cropping: OK (Not Supported)
test Composing: OK (Not Supported)
test Scaling: OK (Not Supported)

Codec ioctls:
test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported)
test VIDIOC_G_ENC_INDEX: OK (Not Supported)
test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)

Buffer ioctls:
test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK (Not Supported)
test VIDIOC_EXPBUF: OK (Not Supported)
test Requests: OK (Not Supported)

Total for device /dev/v4l-subdev0: 40, Succeeded: 40, Failed: 0, Warnings: 0

Grand Total for stm32-dcmi device /dev/media0: 92, Succeeded: 91,
Failed: 1, Warnings: 2


BR,
Hugues.

On 4/1/19 1:10 PM, Hans Verkuil wrote:
> Hi Hugues,
>
> On 4/1/19 11:31 AM, Hugues Fruchet wrote:
>> This patch serie allows to connect non-parallel camera sensor to
>> DCMI thanks to a bridge connected in between such as STMIPID02 [1].
>>
>> Media controller support is introduced first, then support of
>> several sub-devices within pipeline with dynamic linking
>> between them.
>
> Can you post the output of v4l2-compliance -m /dev/mediaX ?
>
> Thanks!
>
> Hans
>
>>
>> [1] https://www.spinics.net/lists/devicetree/msg278002.html
>>
>> Hugues Fruchet (2):
>> media: stm32-dcmi: add media controller support
>> media: stm32-dcmi: add support of several sub-devices
>>
>> drivers/media/platform/Kconfig | 2 +-
>> drivers/media/platform/stm32/stm32-dcmi.c | 213 ++++++++++++++++++++++++------
>> 2 files changed, 177 insertions(+), 38 deletions(-)
>>
>

2019-04-01 13:31:11

by Hans Verkuil

[permalink] [raw]
Subject: Re: [PATCH 0/2] DCMI bridge support

On 4/1/19 3:08 PM, Hugues FRUCHET wrote:
> Hi Hans,
>
> Here it is.
>
> SHA1 is aa371c995ec2ad70323db00c47b3132002b060b7:
>
> Author: Hans Verkuil <[email protected]> 2019-02-08 16:21:23
> Committer: Hans Verkuil <[email protected]> 2019-02-08 16:21:23
> Parent: 98d5622551eb6b9a0397464fb52378949f33c364 (v4l2-compliance:
> support m2m devices with -f)
> Child: 59f9840781aab464c1331dcdb82e63dd0544b5c6 (v4l2-compliance:
> remove duplicate MEDIA_IOC_DEVICE_INFO ioctl call)
> Branches: master, master2, remotes/origin/master
> Follows: v4l-utils-1.16.0
> Precedes:
>
> v4l2-compliance: -f bug fixes
>
>
> Result is below:
>
> root@stm32mp1:~# v4l2-compliance -m /dev/media0
> v4l2-compliance SHA: eb8e3b07c9249ff56091ae4bc3ae9b76779db4cd, 32 bits
>
> Compliance test for stm32-dcmi device /dev/media0:
>
> Media Driver Info:
> Driver name : stm32-dcmi
> Model : stm32-dcmi
> Serial :
> Bus info : platform:stm32-dcmi
> Media version : 5.0.0
> Hardware revision: 0x00000000 (0)
> Driver version : 5.0.0
>
> Required ioctls:
> test MEDIA_IOC_DEVICE_INFO: OK
>
> Allow for multiple opens:
> test second /dev/media0 open: OK
> test MEDIA_IOC_DEVICE_INFO: OK
> test for unlimited opens: OK
>
> Media Controller ioctls:
> test MEDIA_IOC_G_TOPOLOGY: OK
> Entities: 3 Interfaces: 2 Pads: 4 Links: 4
> test MEDIA_IOC_ENUM_ENTITIES/LINKS: OK
> test MEDIA_IOC_SETUP_LINK: OK
>
> Total for stm32-dcmi device /dev/media0: 7, Succeeded: 7, Failed: 0,
> Warnings: 0
> --------------------------------------------------------------------------------
> Compliance test for stm32-dcmi device /dev/video0:
>
> Driver Info:
> Driver name : stm32-dcmi
> Card type : STM32 Camera Memory Interface
> Bus info : platform:dcmi
> Driver version : 5.0.0
> Capabilities : 0x85200001
> Video Capture
> Read/Write
> Streaming
> [ 2117.336477] stm32-dcmi 4c006000.dcmi:
> ================= START STATUS =================
> E[ 2117.344647] stm32-dcmi 4c006000.dcmi: White Balance, Automatic: true
> [ 2117.350990] stm32-dcmi 4c006000.dcmi: Blue Balance: 0 inactive
> x[ 2117.356853] stm32-dcmi 4c006000.dcmi: Red Balance: 0 inactive
> [ 2117.362645] stm32-dcmi 4c006000.dcmi: Auto Exposure: Auto Mode
> [ 2117.368438] stm32-dcmi 4c006000.dcmi: Exposure: 0 inactive volatile
> t[ 2117.374729] stm32-dcmi 4c006000.dcmi: Gain, Automatic: true
> [ 2117.380335] stm32-dcmi 4c006000.dcmi: Gain: 0 inactive volatile
> e[ 2117.386305] stm32-dcmi 4c006000.dcmi: Saturation: 64
> [ 2117.391275] stm32-dcmi 4c006000.dcmi: Hue: 0
> n[ 2117.395572] stm32-dcmi 4c006000.dcmi: Contrast: 0
> [ 2117.400305] stm32-dcmi 4c006000.dcmi: Test Pattern: Disabled
> d[ 2117.405988] stm32-dcmi 4c006000.dcmi: Horizontal Flip: false
> [ 2117.411721] stm32-dcmi 4c006000.dcmi: Vertical Flip: false
> [ 2117.417148] stm32-dcmi 4c006000.dcmi: Power Line Frequency: 50 Hz
> [ 2117.423265] stm32-dcmi 4c006000.dcmi: ================== END STATUS
> ==================
> ed Pix Format
> Device Capabilities
> Device Caps : 0x05200001
> Video Capture
> Read/Write
> Streaming
> Extended Pix Format
> Media Driver Info:
> Driver name : stm32-dcmi
> Model : stm32-dcmi
> Serial :
> Bus info : platform:stm32-dcmi
> Media version : 5.0.0
> Hardware revision: 0x00000000 (0)
> Driver version : 5.0.0
> Interface Info:
> ID : 0x03000003
> Type : V4L Video
> Entity Info:
> ID : 0x00000001 (1)
> Name : stm32_dcmi
> Function : V4L2 I/O
> Flags : default
> Pad 0x01000002 : 0: Sink
> Link 0x02000008: from remote pad 0x1000007 of entity 'mipid02
> 0-0014': Data, Enabled, Immutable
>
> Required ioctls:
> test MC information (see 'Media Driver Info' above): OK
> warn:
> ../../../../../../../../../sources/v4l-utils/utils/v4l2-compliance/v4l2-compliance.cpp(621):
> media bus_info 'platform:stm32-dcmi
> ' differs from V4L2 bus_info 'platform:dcmi'
> test VIDIOC_QUERYCAP: OK
>
> Allow for multiple opens:
> test second /dev/video0 open: OK
> warn:
> ../../../../../../../../../sources/v4l-utils/utils/v4l2-compliance/v4l2-compliance.cpp(621):
> media bus_info 'platform:stm32-dcmi
> ' differs from V4L2 bus_info 'platform:dcmi'
> test VIDIOC_QUERYCAP: OK
> test VIDIOC_G/S_PRIORITY: OK
> test for unlimited opens: OK
>
> Debug ioctls:
> test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported)
> test VIDIOC_LOG_STATUS: OK
>
> Input ioctls:
> test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported)
> test VIDIOC_G/S_FRE[ 2117.564770] mipid02 0-0014:
> ================= START STATUS =================
> Q[ 2117.572042] mipid02 0-0014: ================== END STATUS
> ==================
> UENCY: OK (Not Supported)
> test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported)
> test VIDIOC_ENUMAUDIO: OK (Not Supported)
> test VIDIOC_G/S/ENUMINPUT: OK
> test VIDIOC_G/S_AUDIO: OK (Not Supported)
> Inputs: 1 Audio Inputs: 0 Tuners: 0
>
> Output ioctls:
> test VIDIOC_G/S_MODULATOR: OK (Not Supported)
> test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
> test VIDIOC_ENUMAUDOUT: OK (Not Supported)
> test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported)
> test VIDIOC_G/S_AUDOUT: OK (Not Supported)
> Outputs: 0 Audio Outputs: 0 Modulators: 0
>
> Input/Output configuration ioctls:
> test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported)
> test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported)
> test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported)
> test VIDIOC_G/S_EDID: OK (Not Supported)
>
> Control ioctls (Input 0):
> test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK
> test VIDIOC_QUERYCTRL: OK
> test VIDIOC_G/S_CTRL: OK
> test VIDIOC_G/S/TRY_EXT_CTRLS: OK
> test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK
> test VIDIOC_G/S_JPEGCOMP: OK (Not Supported)
> Standard Controls: 17 Private Controls: 0
>
> Format ioctls (Input 0):
> test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK
> test VIDIOC_G/S_PARM: OK
> test VIDIOC_G_FBUF: OK (Not Supported)
> test VIDIOC_G_FMT: OK
> test VIDIOC_TRY_FMT: OK
> test VIDIOC_S_FMT: OK
> test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported)
> fail:
> ../../../../../../../../../sources/v4l-utils/utils/v4l2-compliance/v4l2-test-formats.cpp(1338):
> node->frmsizes_count[pixfmt] > 1
> test Cropping: FAIL
> test Composing: OK (Not Supported)
> test Scaling: OK (Not Supported)
>
> Codec ioctls (Input 0):
> test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported)
> test VIDIOC_G_ENC_INDEX: OK (Not Supported)
> test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)
>
> Buffer ioctls (Input 0):
> test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK
> test VIDIOC_EXPBUF: OK
> test Requests: OK (Not Supported)
>
> Total for stm32-dcmi device /dev/video0: 45, Succeeded: 44, Failed: 1,
> Warnings: 2
> --------------------------------------------------------------------------------
> Compliance test for device /dev/v4l-subdev0:
>
>
> Required ioctls:
>
> Allow for multiple opens:
> test second /dev/v4l-subdev0 open: OK
> test for unlimited opens: OK
>
> Debug ioctls:
> test VIDIOC_LOG_STATUS: OK (Not Supported)
>
> Input ioctls:
> test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported)
> test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
> test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported)
> test VIDIOC_ENUMAUDIO: OK (Not Supported)
> test VIDIOC_G/S/ENUMINPUT: OK (Not Supported)
> test VIDIOC_G/S_AUDIO: OK (Not Supported)
> Inputs: 0 Audio Inputs: 0 Tuners: 0
>
> Output ioctls:
> test VIDIOC_G/S_MODULATOR: OK (Not Supported)
> test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
> test VIDIOC_ENUMAUDOUT: OK (Not Supported)
> test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported)
> test VIDIOC_G/S_AUDOUT: OK (Not Supported)
> Outputs: 0 Audio Outputs: 0 Modulators: 0
>
> Input/Output configuration ioctls:
> test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported)
> test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported)
> test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported)
> test VIDIOC_G/S_EDID: OK (Not Supported)
>
> Control ioctls:
> test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK (Not Supported)
> test VIDIOC_QUERYCTRL: OK (Not Supported)
> test VIDIOC_G/S_CTRL: OK (Not Supported)
> test VIDIOC_G/S/TRY_EXT_CTRLS: OK (Not Supported)
> test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK (Not Supported)
> test VIDIOC_G/S_JPEGCOMP: OK (Not Supported)
> Standard Controls: 0 Private Controls: 0
>
> Format ioctls:
> test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK (Not Supported)
> test VIDIOC_G/S_PARM: OK (Not Supported)
> test VIDIOC_G_FBUF: OK (Not Supported)
> test VIDIOC_G_FMT: OK (Not Supported)
> test VIDIOC_TRY_FMT: OK (Not Supported)
> test VIDIOC_S_FMT: OK (Not Supported)
> test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported)
> test Cropping: OK (Not Supported)
> test Composing: OK (Not Supported)
> test Scaling: OK (Not Supported)
>
> Codec ioctls:
> test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported)
> test VIDIOC_G_ENC_INDEX: OK (Not Supported)
> test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)
>
> Buffer ioctls:
> test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK (Not Supported)
> test VIDIOC_EXPBUF: OK (Not Supported)
> test Requests: OK (Not Supported)
>
> Total for device /dev/v4l-subdev0: 40, Succeeded: 40, Failed: 0, Warnings: 0
>
> Grand Total for stm32-dcmi device /dev/media0: 92, Succeeded: 91,
> Failed: 1, Warnings: 2

The warnings should be fixed (both warnings refer to the same problem).

The fail was present before this patch series.

The core problem there is that if there are multiple possible framesizes,
then crop support is ambiguous: against which framesize do you crop?

I see that dcmi_try_fmt() has a heuristic for that. We really need to fix
this in the API, but this situation rarely occurs.

So for now I don't think there is a need to fix the fail.

Regards,

Hans

>
>
> BR,
> Hugues.
>
> On 4/1/19 1:10 PM, Hans Verkuil wrote:
>> Hi Hugues,
>>
>> On 4/1/19 11:31 AM, Hugues Fruchet wrote:
>>> This patch serie allows to connect non-parallel camera sensor to
>>> DCMI thanks to a bridge connected in between such as STMIPID02 [1].
>>>
>>> Media controller support is introduced first, then support of
>>> several sub-devices within pipeline with dynamic linking
>>> between them.
>>
>> Can you post the output of v4l2-compliance -m /dev/mediaX ?
>>
>> Thanks!
>>
>> Hans
>>
>>>
>>> [1] https://www.spinics.net/lists/devicetree/msg278002.html
>>>
>>> Hugues Fruchet (2):
>>> media: stm32-dcmi: add media controller support
>>> media: stm32-dcmi: add support of several sub-devices
>>>
>>> drivers/media/platform/Kconfig | 2 +-
>>> drivers/media/platform/stm32/stm32-dcmi.c | 213 ++++++++++++++++++++++++------
>>> 2 files changed, 177 insertions(+), 38 deletions(-)
>>>

2019-04-02 09:37:49

by Hugues Fruchet

[permalink] [raw]
Subject: Re: [PATCH 0/2] DCMI bridge support

Thanks Hans,

I've aligned both namings by updating querycap:

@@ -1257,7 +1257,8 @@ static int dcmi_querycap(struct file *file, void
*priv,
strscpy(cap->driver, DRV_NAME, sizeof(cap->driver));
strscpy(cap->card, "STM32 Camera Memory Interface",
sizeof(cap->card));
- strscpy(cap->bus_info, "platform:dcmi", sizeof(cap->bus_info));
+ snprintf(cap->bus_info, sizeof(cap->bus_info),
+ "platform:%s", DRV_NAME);
return 0;
}

so now both V4L2 and MC are returning "platform:stm32-dcmi".

I'll push in v2.

BR,
Hugues.


On 4/1/19 3:30 PM, Hans Verkuil wrote:
> On 4/1/19 3:08 PM, Hugues FRUCHET wrote:
>> Hi Hans,
>>
>> Here it is.
>>
>> SHA1 is aa371c995ec2ad70323db00c47b3132002b060b7:
>>
>> Author: Hans Verkuil <[email protected]> 2019-02-08 16:21:23
>> Committer: Hans Verkuil <[email protected]> 2019-02-08 16:21:23
>> Parent: 98d5622551eb6b9a0397464fb52378949f33c364 (v4l2-compliance:
>> support m2m devices with -f)
>> Child: 59f9840781aab464c1331dcdb82e63dd0544b5c6 (v4l2-compliance:
>> remove duplicate MEDIA_IOC_DEVICE_INFO ioctl call)
>> Branches: master, master2, remotes/origin/master
>> Follows: v4l-utils-1.16.0
>> Precedes:
>>
>> v4l2-compliance: -f bug fixes
>>
>>
>> Result is below:
>>
>> root@stm32mp1:~# v4l2-compliance -m /dev/media0
>> v4l2-compliance SHA: eb8e3b07c9249ff56091ae4bc3ae9b76779db4cd, 32 bits
>>
>> Compliance test for stm32-dcmi device /dev/media0:
>>
>> Media Driver Info:
>> Driver name : stm32-dcmi
>> Model : stm32-dcmi
>> Serial :
>> Bus info : platform:stm32-dcmi
>> Media version : 5.0.0
>> Hardware revision: 0x00000000 (0)
>> Driver version : 5.0.0
>>
>> Required ioctls:
>> test MEDIA_IOC_DEVICE_INFO: OK
>>
>> Allow for multiple opens:
>> test second /dev/media0 open: OK
>> test MEDIA_IOC_DEVICE_INFO: OK
>> test for unlimited opens: OK
>>
>> Media Controller ioctls:
>> test MEDIA_IOC_G_TOPOLOGY: OK
>> Entities: 3 Interfaces: 2 Pads: 4 Links: 4
>> test MEDIA_IOC_ENUM_ENTITIES/LINKS: OK
>> test MEDIA_IOC_SETUP_LINK: OK
>>
>> Total for stm32-dcmi device /dev/media0: 7, Succeeded: 7, Failed: 0,
>> Warnings: 0
>> --------------------------------------------------------------------------------
>> Compliance test for stm32-dcmi device /dev/video0:
>>
>> Driver Info:
>> Driver name : stm32-dcmi
>> Card type : STM32 Camera Memory Interface
>> Bus info : platform:dcmi
>> Driver version : 5.0.0
>> Capabilities : 0x85200001
>> Video Capture
>> Read/Write
>> Streaming
>> [ 2117.336477] stm32-dcmi 4c006000.dcmi:
>> ================= START STATUS =================
>> E[ 2117.344647] stm32-dcmi 4c006000.dcmi: White Balance, Automatic: true
>> [ 2117.350990] stm32-dcmi 4c006000.dcmi: Blue Balance: 0 inactive
>> x[ 2117.356853] stm32-dcmi 4c006000.dcmi: Red Balance: 0 inactive
>> [ 2117.362645] stm32-dcmi 4c006000.dcmi: Auto Exposure: Auto Mode
>> [ 2117.368438] stm32-dcmi 4c006000.dcmi: Exposure: 0 inactive volatile
>> t[ 2117.374729] stm32-dcmi 4c006000.dcmi: Gain, Automatic: true
>> [ 2117.380335] stm32-dcmi 4c006000.dcmi: Gain: 0 inactive volatile
>> e[ 2117.386305] stm32-dcmi 4c006000.dcmi: Saturation: 64
>> [ 2117.391275] stm32-dcmi 4c006000.dcmi: Hue: 0
>> n[ 2117.395572] stm32-dcmi 4c006000.dcmi: Contrast: 0
>> [ 2117.400305] stm32-dcmi 4c006000.dcmi: Test Pattern: Disabled
>> d[ 2117.405988] stm32-dcmi 4c006000.dcmi: Horizontal Flip: false
>> [ 2117.411721] stm32-dcmi 4c006000.dcmi: Vertical Flip: false
>> [ 2117.417148] stm32-dcmi 4c006000.dcmi: Power Line Frequency: 50 Hz
>> [ 2117.423265] stm32-dcmi 4c006000.dcmi: ================== END STATUS
>> ==================
>> ed Pix Format
>> Device Capabilities
>> Device Caps : 0x05200001
>> Video Capture
>> Read/Write
>> Streaming
>> Extended Pix Format
>> Media Driver Info:
>> Driver name : stm32-dcmi
>> Model : stm32-dcmi
>> Serial :
>> Bus info : platform:stm32-dcmi
>> Media version : 5.0.0
>> Hardware revision: 0x00000000 (0)
>> Driver version : 5.0.0
>> Interface Info:
>> ID : 0x03000003
>> Type : V4L Video
>> Entity Info:
>> ID : 0x00000001 (1)
>> Name : stm32_dcmi
>> Function : V4L2 I/O
>> Flags : default
>> Pad 0x01000002 : 0: Sink
>> Link 0x02000008: from remote pad 0x1000007 of entity 'mipid02
>> 0-0014': Data, Enabled, Immutable
>>
>> Required ioctls:
>> test MC information (see 'Media Driver Info' above): OK
>> warn:
>> ../../../../../../../../../sources/v4l-utils/utils/v4l2-compliance/v4l2-compliance.cpp(621):
>> media bus_info 'platform:stm32-dcmi
>> ' differs from V4L2 bus_info 'platform:dcmi'
>> test VIDIOC_QUERYCAP: OK
>>
>> Allow for multiple opens:
>> test second /dev/video0 open: OK
>> warn:
>> ../../../../../../../../../sources/v4l-utils/utils/v4l2-compliance/v4l2-compliance.cpp(621):
>> media bus_info 'platform:stm32-dcmi
>> ' differs from V4L2 bus_info 'platform:dcmi'
>> test VIDIOC_QUERYCAP: OK
>> test VIDIOC_G/S_PRIORITY: OK
>> test for unlimited opens: OK
>>
>> Debug ioctls:
>> test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported)
>> test VIDIOC_LOG_STATUS: OK
>>
>> Input ioctls:
>> test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported)
>> test VIDIOC_G/S_FRE[ 2117.564770] mipid02 0-0014:
>> ================= START STATUS =================
>> Q[ 2117.572042] mipid02 0-0014: ================== END STATUS
>> ==================
>> UENCY: OK (Not Supported)
>> test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported)
>> test VIDIOC_ENUMAUDIO: OK (Not Supported)
>> test VIDIOC_G/S/ENUMINPUT: OK
>> test VIDIOC_G/S_AUDIO: OK (Not Supported)
>> Inputs: 1 Audio Inputs: 0 Tuners: 0
>>
>> Output ioctls:
>> test VIDIOC_G/S_MODULATOR: OK (Not Supported)
>> test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
>> test VIDIOC_ENUMAUDOUT: OK (Not Supported)
>> test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported)
>> test VIDIOC_G/S_AUDOUT: OK (Not Supported)
>> Outputs: 0 Audio Outputs: 0 Modulators: 0
>>
>> Input/Output configuration ioctls:
>> test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported)
>> test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported)
>> test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported)
>> test VIDIOC_G/S_EDID: OK (Not Supported)
>>
>> Control ioctls (Input 0):
>> test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK
>> test VIDIOC_QUERYCTRL: OK
>> test VIDIOC_G/S_CTRL: OK
>> test VIDIOC_G/S/TRY_EXT_CTRLS: OK
>> test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK
>> test VIDIOC_G/S_JPEGCOMP: OK (Not Supported)
>> Standard Controls: 17 Private Controls: 0
>>
>> Format ioctls (Input 0):
>> test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK
>> test VIDIOC_G/S_PARM: OK
>> test VIDIOC_G_FBUF: OK (Not Supported)
>> test VIDIOC_G_FMT: OK
>> test VIDIOC_TRY_FMT: OK
>> test VIDIOC_S_FMT: OK
>> test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported)
>> fail:
>> ../../../../../../../../../sources/v4l-utils/utils/v4l2-compliance/v4l2-test-formats.cpp(1338):
>> node->frmsizes_count[pixfmt] > 1
>> test Cropping: FAIL
>> test Composing: OK (Not Supported)
>> test Scaling: OK (Not Supported)
>>
>> Codec ioctls (Input 0):
>> test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported)
>> test VIDIOC_G_ENC_INDEX: OK (Not Supported)
>> test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)
>>
>> Buffer ioctls (Input 0):
>> test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK
>> test VIDIOC_EXPBUF: OK
>> test Requests: OK (Not Supported)
>>
>> Total for stm32-dcmi device /dev/video0: 45, Succeeded: 44, Failed: 1,
>> Warnings: 2
>> --------------------------------------------------------------------------------
>> Compliance test for device /dev/v4l-subdev0:
>>
>>
>> Required ioctls:
>>
>> Allow for multiple opens:
>> test second /dev/v4l-subdev0 open: OK
>> test for unlimited opens: OK
>>
>> Debug ioctls:
>> test VIDIOC_LOG_STATUS: OK (Not Supported)
>>
>> Input ioctls:
>> test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported)
>> test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
>> test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported)
>> test VIDIOC_ENUMAUDIO: OK (Not Supported)
>> test VIDIOC_G/S/ENUMINPUT: OK (Not Supported)
>> test VIDIOC_G/S_AUDIO: OK (Not Supported)
>> Inputs: 0 Audio Inputs: 0 Tuners: 0
>>
>> Output ioctls:
>> test VIDIOC_G/S_MODULATOR: OK (Not Supported)
>> test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
>> test VIDIOC_ENUMAUDOUT: OK (Not Supported)
>> test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported)
>> test VIDIOC_G/S_AUDOUT: OK (Not Supported)
>> Outputs: 0 Audio Outputs: 0 Modulators: 0
>>
>> Input/Output configuration ioctls:
>> test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported)
>> test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported)
>> test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported)
>> test VIDIOC_G/S_EDID: OK (Not Supported)
>>
>> Control ioctls:
>> test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK (Not Supported)
>> test VIDIOC_QUERYCTRL: OK (Not Supported)
>> test VIDIOC_G/S_CTRL: OK (Not Supported)
>> test VIDIOC_G/S/TRY_EXT_CTRLS: OK (Not Supported)
>> test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK (Not Supported)
>> test VIDIOC_G/S_JPEGCOMP: OK (Not Supported)
>> Standard Controls: 0 Private Controls: 0
>>
>> Format ioctls:
>> test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK (Not Supported)
>> test VIDIOC_G/S_PARM: OK (Not Supported)
>> test VIDIOC_G_FBUF: OK (Not Supported)
>> test VIDIOC_G_FMT: OK (Not Supported)
>> test VIDIOC_TRY_FMT: OK (Not Supported)
>> test VIDIOC_S_FMT: OK (Not Supported)
>> test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported)
>> test Cropping: OK (Not Supported)
>> test Composing: OK (Not Supported)
>> test Scaling: OK (Not Supported)
>>
>> Codec ioctls:
>> test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported)
>> test VIDIOC_G_ENC_INDEX: OK (Not Supported)
>> test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)
>>
>> Buffer ioctls:
>> test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK (Not Supported)
>> test VIDIOC_EXPBUF: OK (Not Supported)
>> test Requests: OK (Not Supported)
>>
>> Total for device /dev/v4l-subdev0: 40, Succeeded: 40, Failed: 0, Warnings: 0
>>
>> Grand Total for stm32-dcmi device /dev/media0: 92, Succeeded: 91,
>> Failed: 1, Warnings: 2
>
> The warnings should be fixed (both warnings refer to the same problem).
>
> The fail was present before this patch series.
>
> The core problem there is that if there are multiple possible framesizes,
> then crop support is ambiguous: against which framesize do you crop?
>
> I see that dcmi_try_fmt() has a heuristic for that. We really need to fix
> this in the API, but this situation rarely occurs.
>
> So for now I don't think there is a need to fix the fail.
>
> Regards,
>
> Hans
>
>>
>>
>> BR,
>> Hugues.
>>
>> On 4/1/19 1:10 PM, Hans Verkuil wrote:
>>> Hi Hugues,
>>>
>>> On 4/1/19 11:31 AM, Hugues Fruchet wrote:
>>>> This patch serie allows to connect non-parallel camera sensor to
>>>> DCMI thanks to a bridge connected in between such as STMIPID02 [1].
>>>>
>>>> Media controller support is introduced first, then support of
>>>> several sub-devices within pipeline with dynamic linking
>>>> between them.
>>>
>>> Can you post the output of v4l2-compliance -m /dev/mediaX ?
>>>
>>> Thanks!
>>>
>>> Hans
>>>
>>>>
>>>> [1] https://www.spinics.net/lists/devicetree/msg278002.html
>>>>
>>>> Hugues Fruchet (2):
>>>> media: stm32-dcmi: add media controller support
>>>> media: stm32-dcmi: add support of several sub-devices
>>>>
>>>> drivers/media/platform/Kconfig | 2 +-
>>>> drivers/media/platform/stm32/stm32-dcmi.c | 213 ++++++++++++++++++++++++------
>>>> 2 files changed, 177 insertions(+), 38 deletions(-)
>>>>
>