Skip to contentSkip to conversation

Use INTEGER64 type for MEI CSI LINK_FREQ control

PATCH Superseded Sakari Ailus 2 participants 12 messages Feb 20, 2024 – Apr 26, 2024

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Sakari Ailus

author maintainer
#0 lore raw

cover Use INTEGER64 type for MEI CSI LINK_FREQ control

Hi folks,

An integer menu isn't a useful control type for conveying the frequency depending on an external device to the receiver. Instead, in the MEI CSI driver, just obtain the link frequency from the upsteam sub-device and pass it on to the receiver.

The v4l2_get_link_freq() is changed to add support for this and it's documented as well.

Sakari Ailus (3):
media: v4l: Support obtaining link frequency from INTEGER64 controls
media: Documentation: v4l: LINK_FREQ can be an INTEGER64 control
media: ivsc: csi: Fix link frequency control behaviour

 .../media/v4l/ext-ctrls-image-process.rst     |  2 +-
 drivers/media/pci/intel/ivsc/mei_csi.c        | 30 +++++++++----------
 drivers/media/v4l2-core/v4l2-common.c         |  3 ++
 3 files changed, 18 insertions(+), 17 deletions(-)
Signature · 1 line
2.39.2
author maintainer
#1 lore raw

PATCH 1/3 media: v4l: Support obtaining link frequency from INTEGER64 controls

Support INTEGER64 controls in v4l2_get_link_freq().

---
 drivers/media/v4l2-core/v4l2-common.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/media/v4l2-core/v4l2-common.c +3 -0
index 273d83de2a87..8e2fd81b7edf 100644
@@ -473,6 +473,9 @@ s64 v4l2_get_link_freq(struct v4l2_ctrl_handler *handler, unsigned int mul,
 		struct v4l2_querymenu qm = { .id = V4L2_CID_LINK_FREQ };
 		int ret;
 
+		if (ctrl->type == V4L2_CTRL_TYPE_INTEGER64)
+			return v4l2_ctrl_g_ctrl_int64(ctrl);
+
 		qm.index = v4l2_ctrl_g_ctrl(ctrl);
 
 		ret = v4l2_querymenu(handler, &qm);
Signature · 1 line
2.39.2
author maintainer
#2 lore raw

PATCH 2/3 media: Documentation: v4l: LINK_FREQ can be an INTEGER64 control

In reply to Sakari Ailus

When a device passes through the video data while still having its own receiver and transmitter, it can use the same frequency as the upstream link does. The Intel MEI CSI device is an example of this. An integer menu control isn't useful in conveying the actual frequency to the receiver in this case.

Document that the LINK_FREQ control may also be a 64-bit integer control.

---
 .../userspace-api/media/v4l/ext-ctrls-image-process.rst         | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/userspace-api/media/v4l/ext-ctrls-image-process.rst +1 -1
index b1c2ab2854af..7a3ccb100e1d 100644
@@ -22,7 +22,7 @@ Image Process Control IDs
 
 .. _v4l2-cid-link-freq:
 
-``V4L2_CID_LINK_FREQ (integer menu)``
+``V4L2_CID_LINK_FREQ (integer menu or 64-bit integer)``
     The frequency of the data bus (e.g. parallel or CSI-2).
 
 .. _v4l2-cid-pixel-rate:
Signature · 1 line
2.39.2
author maintainer
#9 lore raw

PATCH 3/3 media: ivsc: csi: Fix link frequency control behaviour

In reply to Sakari Ailus

The link frequency control was an integer menu control the value of which was hard-coded in the MEI CSI driver itself. Instead obtain the control value from the upstream sub-device and use a INTEGER64 control type for the purpose.

Fixes 29006e196a56 ("media: pci: intel: ivsc: Add CSI submodule")
---
 drivers/media/pci/intel/ivsc/mei_csi.c | 30 ++++++++++++--------------
 1 file changed, 14 insertions(+), 16 deletions(-)
drivers/media/pci/intel/ivsc/mei_csi.c +14 -16
index 89b582a221ab..eef3b028c58e 100644
@@ -15,6 +15,7 @@
 #include <linux/completion.h>
 #include <linux/delay.h>
 #include <linux/kernel.h>
+#include <linux/limits.h>
 #include <linux/math64.h>
 #include <linux/mei_cl_bus.h>
 #include <linux/module.h>
@@ -35,8 +36,6 @@
 
 #define MEI_CSI_ENTITY_NAME "Intel IVSC CSI"
 
-#define MEI_CSI_LINK_FREQ_400MHZ 400000000ULL
-
 /* the 5s used here is based on experiment */
 #define CSI_CMD_TIMEOUT (5 * HZ)
 /* to setup CSI-2 link an extra delay needed and determined experimentally */
@@ -148,10 +147,6 @@ static const struct v4l2_mbus_framefmt mei_csi_format_mbus_default = {
 	.field = V4L2_FIELD_NONE,
 };
 
-static s64 link_freq_menu_items[] = {
-	MEI_CSI_LINK_FREQ_400MHZ
-};
-
 static inline struct mei_csi *notifier_to_csi(struct v4l2_async_notifier *n)
 {
 	return container_of(n, struct mei_csi, notifier);
@@ -484,8 +479,7 @@ static int mei_csi_g_volatile_ctrl(struct v4l2_ctrl *ctrl)
 			return -EINVAL;
 		}
 
-		link_freq_menu_items[0] = freq;
-		ctrl->val = 0;
+		ctrl->p_new.p_s64[0] = csi->link_freq = freq;
 
 		return 0;
 	}
@@ -554,9 +548,18 @@ static const struct v4l2_async_notifier_operations mei_csi_notify_ops = {
 	.unbind = mei_csi_notify_unbind,
 };
 
+static const struct v4l2_ctrl_config mei_csi_link_freq_ctrl = {
+	.ops = &mei_csi_ctrl_ops,
+	.type = V4L2_CTRL_TYPE_INTEGER64,
+	.id = V4L2_CID_LINK_FREQ,
+	.name = "Link Frequency",
+	.max = S64_MAX,
+	.step = 1,
+	.flags = V4L2_CTRL_FLAG_VOLATILE | V4L2_CTRL_FLAG_READ_ONLY,
+};
+
 static int mei_csi_init_controls(struct mei_csi *csi)
 {
-	u32 max;
 	int ret;
 
 	ret = v4l2_ctrl_handler_init(&csi->ctrl_handler, 2);
@@ -565,13 +568,8 @@ static int mei_csi_init_controls(struct mei_csi *csi)
 
 	csi->ctrl_handler.lock = &csi->lock;
 
-	max = ARRAY_SIZE(link_freq_menu_items) - 1;
-	csi->freq_ctrl = v4l2_ctrl_new_int_menu(&csi->ctrl_handler,
-						&mei_csi_ctrl_ops,
-						V4L2_CID_LINK_FREQ,
-						max,
-						0,
-						link_freq_menu_items);
+	csi->freq_ctrl = v4l2_ctrl_new_custom(&csi->ctrl_handler,
+					      &mei_csi_link_freq_ctrl, NULL);
 	if (csi->freq_ctrl)
 		csi->freq_ctrl->flags |= V4L2_CTRL_FLAG_READ_ONLY |
 					 V4L2_CTRL_FLAG_VOLATILE;
Signature · 1 line
2.39.2
#10 lore raw
In reply to Sakari Ailus

Hi Sakari,

Quoted 7 lines · Sakari Ailus

Hi folks,

An integer menu isn't a useful control type for conveying the frequency depending on an external device to the receiver. Instead, in the MEI CSI driver, just obtain the link frequency from the upsteam sub-device and pass it on to the receiver.

Quoted 6 lines

The v4l2_get_link_freq() is changed to add support for this and it's documented as well.

Sakari Ailus (3):
media: v4l: Support obtaining link frequency from INTEGER64 controls
media: Documentation: v4l: LINK_FREQ can be an INTEGER64 control

I'm not sure if you can do this. This means userspace has to support two different types as well and query what to use. That's an ABI change.

Quoted 1 line

media: ivsc: csi: Fix link frequency control behaviour

And this third patch marks the control as VOLATILE, which is wrong. It is a normal read-only control and you can just update the control's value in the driver whenever it needs changing.

I would comment in the patch itself, but for some reason I never got it.

I am dropping these three patches from the PR you sent.

Regards,

Hans

Quoted 6 lines
 .../media/v4l/ext-ctrls-image-process.rst     |  2 +-
 drivers/media/pci/intel/ivsc/mei_csi.c        | 30 +++++++++----------
 drivers/media/v4l2-core/v4l2-common.c         |  3 ++
 3 files changed, 18 insertions(+), 17 deletions(-)
author maintainer
#11 lore raw

Hi Hans,

Quoted 22 lines · Hans Verkuil

Hi Sakari,

Quoted 7 lines · Sakari Ailus

Hi folks,

An integer menu isn't a useful control type for conveying the frequency depending on an external device to the receiver. Instead, in the MEI CSI driver, just obtain the link frequency from the upsteam sub-device and pass it on to the receiver.

Quoted 6 lines

The v4l2_get_link_freq() is changed to add support for this and it's documented as well.

Sakari Ailus (3):
media: v4l: Support obtaining link frequency from INTEGER64 controls
media: Documentation: v4l: LINK_FREQ can be an INTEGER64 control

I'm not sure if you can do this. This means userspace has to support two different types as well and query what to use. That's an ABI change.

Quoted 1 line

media: ivsc: csi: Fix link frequency control behaviour

Quoted 7 lines

And this third patch marks the control as VOLATILE, which is wrong. It is a normal read-only control and you can just update the control's value in the driver whenever it needs changing.

I would comment in the patch itself, but for some reason I never got it.

I am dropping these three patches from the PR you sent.

Fair enough. The IVSC takes the frequency from the upstream sub-device so it doesn't have a list of frequencies on its own. One alternative might be to use always the highest frequency, assuming this can be found from the upstream sub-device but I don't know whether this would actually work.

Do you know, Wentong?

The current state of using a static value is not an option.

Signature · 3 lines
Regards,

Sakari Ailus
#3 lore raw

Re: [PATCH 2/3] media: Documentation: v4l: LINK_FREQ can be an INTEGER64 control

In reply to Sakari Ailus
Quoted 18 lines · Sakari Ailus

When a device passes through the video data while still having its own receiver and transmitter, it can use the same frequency as the upstream link does. The Intel MEI CSI device is an example of this. An integer menu control isn't useful in conveying the actual frequency to the receiver in this case.

Document that the LINK_FREQ control may also be a 64-bit integer control.

---
 .../userspace-api/media/v4l/ext-ctrls-image-process.rst         | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/userspace-api/media/v4l/ext-ctrls-image-process.rst +0 -0
index b1c2ab2854af..7a3ccb100e1d 100644

Documentation/userspace-api/media/v4l/ext-ctrls-image-process.rst Image Process Control IDs · line 26

Quoted 6 lines
Documentation/userspace-api/media/v4l/ext-ctrls-image-process.rst +1 -1
@@ -22,7 +22,7 @@ Image Process Control IDs
 
 .. _v4l2-cid-link-freq:
 
-``V4L2_CID_LINK_FREQ (integer menu)``
+``V4L2_CID_LINK_FREQ (integer menu or 64-bit integer)``
     The frequency of the data bus (e.g. parallel or CSI-2).

I really think a new control should be created for this.

As I understand it, V4L2_CID_LINK_FREQ gives a set of supported frequencies, and the application has to pick one (I think?). Is it supposed to be a read-only control? Some driver seem to set the READ_ONLY flag, and some do not. The documentation isn't helpful in that respect.

In the case of the Intel MEI CSI and similar devices a new control would be better, I think. Do I understand it correctly that for these devices it would always be a read-only control? I.e. it just reports the frequency, but applications cannot change it?

Regards,

Hans

Quoted 2 lines
Documentation/userspace-api/media/v4l/ext-ctrls-image-process.rst +0 -0
 .. _v4l2-cid-pixel-rate:
author maintainer
#4 lore raw

Re: [PATCH 2/3] media: Documentation: v4l: LINK_FREQ can be an INTEGER64 control

Hi Hans,

Quoted 28 lines · Hans Verkuil
Quoted 18 lines · Sakari Ailus

When a device passes through the video data while still having its own receiver and transmitter, it can use the same frequency as the upstream link does. The Intel MEI CSI device is an example of this. An integer menu control isn't useful in conveying the actual frequency to the receiver in this case.

Document that the LINK_FREQ control may also be a 64-bit integer control.

---
 .../userspace-api/media/v4l/ext-ctrls-image-process.rst         | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/userspace-api/media/v4l/ext-ctrls-image-process.rst +0 -0
index b1c2ab2854af..7a3ccb100e1d 100644

Documentation/userspace-api/media/v4l/ext-ctrls-image-process.rst Image Process Control IDs · line 26

Quoted 6 lines
Documentation/userspace-api/media/v4l/ext-ctrls-image-process.rst +1 -1
@@ -22,7 +22,7 @@ Image Process Control IDs
 
 .. _v4l2-cid-link-freq:
 
-``V4L2_CID_LINK_FREQ (integer menu)``
+``V4L2_CID_LINK_FREQ (integer menu or 64-bit integer)``
     The frequency of the data bus (e.g. parallel or CSI-2).

I really think a new control should be created for this.

Quoted 4 lines

As I understand it, V4L2_CID_LINK_FREQ gives a set of supported frequencies, and the application has to pick one (I think?). Is it supposed to be a read-only control? Some driver seem to set the READ_ONLY flag, and some do not. The documentation isn't helpful in that respect.

This is read-only effectively in current IVSC implementation.

Quoted 5 lines

In the case of the Intel MEI CSI and similar devices a new control would be better, I think. Do I understand it correctly that for these devices it would always be a read-only control? I.e. it just reports the frequency, but applications cannot change it?

How would you call the new control?

V4L2_CID_LINK_FREQ_READ_ONLY?

Originally the reason for changing LINK_FREQ for sensors was be part of changing sensor's configuration to achieve a given frame interval.

Signature · 3 lines
Regards,

Sakari Ailus
#5 lore raw

Re: [PATCH 2/3] media: Documentation: v4l: LINK_FREQ can be an INTEGER64 control

Quoted 44 lines · Sakari Ailus

Hi Hans,

Quoted 28 lines · Hans Verkuil
Quoted 18 lines · Sakari Ailus

When a device passes through the video data while still having its own receiver and transmitter, it can use the same frequency as the upstream link does. The Intel MEI CSI device is an example of this. An integer menu control isn't useful in conveying the actual frequency to the receiver in this case.

Document that the LINK_FREQ control may also be a 64-bit integer control.

---
 .../userspace-api/media/v4l/ext-ctrls-image-process.rst         | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/userspace-api/media/v4l/ext-ctrls-image-process.rst +0 -0
index b1c2ab2854af..7a3ccb100e1d 100644

Documentation/userspace-api/media/v4l/ext-ctrls-image-process.rst Image Process Control IDs · line 26

Quoted 6 lines
Documentation/userspace-api/media/v4l/ext-ctrls-image-process.rst +1 -1
@@ -22,7 +22,7 @@ Image Process Control IDs
 
 .. _v4l2-cid-link-freq:
 
-``V4L2_CID_LINK_FREQ (integer menu)``
+``V4L2_CID_LINK_FREQ (integer menu or 64-bit integer)``
     The frequency of the data bus (e.g. parallel or CSI-2).

I really think a new control should be created for this.

Quoted 4 lines

As I understand it, V4L2_CID_LINK_FREQ gives a set of supported frequencies, and the application has to pick one (I think?). Is it supposed to be a read-only control? Some driver seem to set the READ_ONLY flag, and some do not. The documentation isn't helpful in that respect.

This is read-only effectively in current IVSC implementation.

Quoted 5 lines

In the case of the Intel MEI CSI and similar devices a new control would be better, I think. Do I understand it correctly that for these devices it would always be a read-only control? I.e. it just reports the frequency, but applications cannot change it?

Quoted 6 lines

How would you call the new control?

V4L2_CID_LINK_FREQ_READ_ONLY?

Originally the reason for changing LINK_FREQ for sensors was be part of changing sensor's configuration to achieve a given frame interval.

Will this new variant always be read-only?

How about V4L2_CID_CUR_LINK_FREQ?

I.e., it returns the current link frequency. That way it can also be used by drivers that implement V4L2_CID_LINK_FREQ.

Better ideas are welcome :-)

Regards,

Hans

author maintainer
#6 lore raw

Re: [PATCH 2/3] media: Documentation: v4l: LINK_FREQ can be an INTEGER64 control

Hi Hans,

Quoted 45 lines · Hans Verkuil
Quoted 44 lines · Sakari Ailus

Hi Hans,

Quoted 28 lines · Hans Verkuil
Quoted 18 lines · Sakari Ailus

When a device passes through the video data while still having its own receiver and transmitter, it can use the same frequency as the upstream link does. The Intel MEI CSI device is an example of this. An integer menu control isn't useful in conveying the actual frequency to the receiver in this case.

Document that the LINK_FREQ control may also be a 64-bit integer control.

---
 .../userspace-api/media/v4l/ext-ctrls-image-process.rst         | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/userspace-api/media/v4l/ext-ctrls-image-process.rst +0 -0
index b1c2ab2854af..7a3ccb100e1d 100644

Documentation/userspace-api/media/v4l/ext-ctrls-image-process.rst Image Process Control IDs · line 26

Quoted 6 lines
Documentation/userspace-api/media/v4l/ext-ctrls-image-process.rst +1 -1
@@ -22,7 +22,7 @@ Image Process Control IDs
 
 .. _v4l2-cid-link-freq:
 
-``V4L2_CID_LINK_FREQ (integer menu)``
+``V4L2_CID_LINK_FREQ (integer menu or 64-bit integer)``
     The frequency of the data bus (e.g. parallel or CSI-2).

I really think a new control should be created for this.

Quoted 4 lines

As I understand it, V4L2_CID_LINK_FREQ gives a set of supported frequencies, and the application has to pick one (I think?). Is it supposed to be a read-only control? Some driver seem to set the READ_ONLY flag, and some do not. The documentation isn't helpful in that respect.

This is read-only effectively in current IVSC implementation.

Quoted 5 lines

In the case of the Intel MEI CSI and similar devices a new control would be better, I think. Do I understand it correctly that for these devices it would always be a read-only control? I.e. it just reports the frequency, but applications cannot change it?

Quoted 8 lines
Quoted 6 lines

How would you call the new control?

V4L2_CID_LINK_FREQ_READ_ONLY?

Originally the reason for changing LINK_FREQ for sensors was be part of changing sensor's configuration to achieve a given frame interval.

Will this new variant always be read-only?

At least for this purpose I think so. Apart from the sensor configuration, I'm not aware of another use case for the user to change it.

Quoted 5 lines

How about V4L2_CID_CUR_LINK_FREQ?

I.e., it returns the current link frequency. That way it can also be used by drivers that implement V4L2_CID_LINK_FREQ.

It could, but the drivers already report this using V4L2_CID_LINK_FREQ. It'd be extra driver code for little if any gain.

Quoted 2 lines

Better ideas are welcome :-)

V4L2_CID_LINK_FREQ_VALUE? V4L2_CID_LINK_FREQ2?? :-)

Signature · 3 lines
Regards,

Sakari Ailus
#7 lore raw

Re: [PATCH 2/3] media: Documentation: v4l: LINK_FREQ can be an INTEGER64 control

Quoted 61 lines · Sakari Ailus

Hi Hans,

Quoted 45 lines · Hans Verkuil
Quoted 44 lines · Sakari Ailus

Hi Hans,

Quoted 28 lines · Hans Verkuil
Quoted 18 lines · Sakari Ailus

When a device passes through the video data while still having its own receiver and transmitter, it can use the same frequency as the upstream link does. The Intel MEI CSI device is an example of this. An integer menu control isn't useful in conveying the actual frequency to the receiver in this case.

Document that the LINK_FREQ control may also be a 64-bit integer control.

---
 .../userspace-api/media/v4l/ext-ctrls-image-process.rst         | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/userspace-api/media/v4l/ext-ctrls-image-process.rst +0 -0
index b1c2ab2854af..7a3ccb100e1d 100644

Documentation/userspace-api/media/v4l/ext-ctrls-image-process.rst Image Process Control IDs · line 26

Quoted 6 lines
Documentation/userspace-api/media/v4l/ext-ctrls-image-process.rst +1 -1
@@ -22,7 +22,7 @@ Image Process Control IDs
 
 .. _v4l2-cid-link-freq:
 
-``V4L2_CID_LINK_FREQ (integer menu)``
+``V4L2_CID_LINK_FREQ (integer menu or 64-bit integer)``
     The frequency of the data bus (e.g. parallel or CSI-2).

I really think a new control should be created for this.

Quoted 4 lines

As I understand it, V4L2_CID_LINK_FREQ gives a set of supported frequencies, and the application has to pick one (I think?). Is it supposed to be a read-only control? Some driver seem to set the READ_ONLY flag, and some do not. The documentation isn't helpful in that respect.

This is read-only effectively in current IVSC implementation.

Quoted 5 lines

In the case of the Intel MEI CSI and similar devices a new control would be better, I think. Do I understand it correctly that for these devices it would always be a read-only control? I.e. it just reports the frequency, but applications cannot change it?

Quoted 8 lines
Quoted 6 lines

How would you call the new control?

V4L2_CID_LINK_FREQ_READ_ONLY?

Originally the reason for changing LINK_FREQ for sensors was be part of changing sensor's configuration to achieve a given frame interval.

Will this new variant always be read-only?

At least for this purpose I think so. Apart from the sensor configuration, I'm not aware of another use case for the user to change it.

Quoted 1 line
Quoted 7 lines
Quoted 4 lines

How about V4L2_CID_CUR_LINK_FREQ?

I.e., it returns the current link frequency. That way it can also be used by drivers that implement V4L2_CID_LINK_FREQ.

It could, but the drivers already report this using V4L2_CID_LINK_FREQ. It'd be extra driver code for little if any gain.

It's mainly for if we ever want to have consistent support for this control for all drivers to make life easier for applications.

In other words, supporting both controls (if we'd ever want to) wouldn't cause problems API-wise.

Quoted 6 lines
Quoted 3 lines

Better ideas are welcome :-)

V4L2_CID_LINK_FREQ_VALUE? V4L2_CID_LINK_FREQ2?? :-)

Hmm, I prefer CUR_LINK_FREQ, since that implies that it is a read-only control.

Regards,

Hans

author maintainer
#8 lore raw

Re: [PATCH 2/3] media: Documentation: v4l: LINK_FREQ can be an INTEGER64 control

Hi Hans,

Quoted 67 lines · Hans Verkuil
Quoted 66 lines · Sakari Ailus

Hi Hans,

Quoted 45 lines · Hans Verkuil
Quoted 44 lines · Sakari Ailus

Hi Hans,

Quoted 28 lines · Hans Verkuil
Quoted 18 lines · Sakari Ailus

When a device passes through the video data while still having its own receiver and transmitter, it can use the same frequency as the upstream link does. The Intel MEI CSI device is an example of this. An integer menu control isn't useful in conveying the actual frequency to the receiver in this case.

Document that the LINK_FREQ control may also be a 64-bit integer control.

---
 .../userspace-api/media/v4l/ext-ctrls-image-process.rst         | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/userspace-api/media/v4l/ext-ctrls-image-process.rst +0 -0
index b1c2ab2854af..7a3ccb100e1d 100644

Documentation/userspace-api/media/v4l/ext-ctrls-image-process.rst Image Process Control IDs · line 26

Quoted 6 lines
Documentation/userspace-api/media/v4l/ext-ctrls-image-process.rst +1 -1
@@ -22,7 +22,7 @@ Image Process Control IDs
 
 .. _v4l2-cid-link-freq:
 
-``V4L2_CID_LINK_FREQ (integer menu)``
+``V4L2_CID_LINK_FREQ (integer menu or 64-bit integer)``
     The frequency of the data bus (e.g. parallel or CSI-2).

I really think a new control should be created for this.

Quoted 4 lines

As I understand it, V4L2_CID_LINK_FREQ gives a set of supported frequencies, and the application has to pick one (I think?). Is it supposed to be a read-only control? Some driver seem to set the READ_ONLY flag, and some do not. The documentation isn't helpful in that respect.

This is read-only effectively in current IVSC implementation.

Quoted 5 lines

In the case of the Intel MEI CSI and similar devices a new control would be better, I think. Do I understand it correctly that for these devices it would always be a read-only control? I.e. it just reports the frequency, but applications cannot change it?

Quoted 8 lines
Quoted 6 lines

How would you call the new control?

V4L2_CID_LINK_FREQ_READ_ONLY?

Originally the reason for changing LINK_FREQ for sensors was be part of changing sensor's configuration to achieve a given frame interval.

Will this new variant always be read-only?

At least for this purpose I think so. Apart from the sensor configuration, I'm not aware of another use case for the user to change it.

Quoted 5 lines

How about V4L2_CID_CUR_LINK_FREQ?

I.e., it returns the current link frequency. That way it can also be used by drivers that implement V4L2_CID_LINK_FREQ.

Quoted 8 lines
Quoted 2 lines

It could, but the drivers already report this using V4L2_CID_LINK_FREQ. It'd be extra driver code for little if any gain.

It's mainly for if we ever want to have consistent support for this control for all drivers to make life easier for applications.

In other words, supporting both controls (if we'd ever want to) wouldn't cause problems API-wise.

Apart from the sensor frame interval control, the users generally don't care. It's for the CSI-2 receiver drivers which use a framework function to obtain the value (it was amended in one of the three patches).

Quoted 10 lines
Quoted 7 lines
Quoted 4 lines

Better ideas are welcome :-)

V4L2_CID_LINK_FREQ_VALUE? V4L2_CID_LINK_FREQ2?? :-)

Hmm, I prefer CUR_LINK_FREQ, since that implies that it is a read-only control.

I'd be fine with that.

Signature · 3 lines
Regards,

Sakari Ailus