@@ -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;
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") Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> --- drivers/media/pci/intel/ivsc/mei_csi.c | 30 ++++++++++++-------------- 1 file changed, 14 insertions(+), 16 deletions(-)