diff mbox series

[v2,2/3] media: v4l: Support obtaining link frequency from CUR_LINK_FREQ control

Message ID 20240426145538.654212-3-sakari.ailus@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series Use INTEGER64 type for MEI CSI LINK_FREQ control | expand

Commit Message

Sakari Ailus April 26, 2024, 2:55 p.m. UTC
Support V4L2_CID_CUR_LINK_FREQ INTEGER64 control in v4l2_get_link_freq().

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
 drivers/media/v4l2-core/v4l2-common.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-core/v4l2-common.c
index 4165c815faef..bf1923314d15 100644
--- a/drivers/media/v4l2-core/v4l2-common.c
+++ b/drivers/media/v4l2-core/v4l2-common.c
@@ -483,6 +483,10 @@  s64 v4l2_get_link_freq(struct v4l2_ctrl_handler *handler, unsigned int mul,
 
 		freq = qm.value;
 	} else {
+		ctrl = v4l2_ctrl_find(handler, V4L2_CID_CUR_LINK_FREQ);
+		if (ctrl)
+			return v4l2_ctrl_g_ctrl_int64(ctrl);
+
 		if (!mul || !div)
 			return -ENOENT;
 
@@ -494,7 +498,7 @@  s64 v4l2_get_link_freq(struct v4l2_ctrl_handler *handler, unsigned int mul,
 
 		pr_warn("%s: Link frequency estimated using pixel rate: result might be inaccurate\n",
 			__func__);
-		pr_warn("%s: Consider implementing support for V4L2_CID_LINK_FREQ in the transmitter driver\n",
+		pr_warn("%s: Consider implementing support for V4L2_CID_LINK_FREQ or V4L2_CID_CUR_LINK_FREQ in the transmitter driver\n",
 			__func__);
 	}