From ee8f7f4fc96f847d439e2e5eb68e50887dad06da Mon Sep 17 00:00:00 2001 From: Aditya Tewari Date: Tue, 24 Feb 2026 00:32:31 -0600 Subject: [PATCH] Properly get frequency in kernel 6.15 and up From kernel 6.15+, `v4l2_get_link_freq()` supports a pad-based lookup via `struct media_pad *`. The in-kernel IVSC CSI driver also dropped its `V4L2_CID_LINK_FREQ` control in 6.15, so the old ctrl_handler path returns `-ENOENT`. Use the pad instead. Signed-off-by: Aditya Tewari --- drivers/media/pci/intel/ipu-isys-csi2.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/media/pci/intel/ipu-isys-csi2.c b/drivers/media/pci/intel/ipu-isys-csi2.c index 55fb21110904..26bff6795c36 100644 --- a/drivers/media/pci/intel/ipu-isys-csi2.c +++ b/drivers/media/pci/intel/ipu-isys-csi2.c @@ -102,7 +102,17 @@ int ipu_isys_csi2_get_link_freq(struct ipu_isys_csi2 *csi2, s64 *link_freq) bpp = ipu_isys_mbus_code_to_bpp(csi2->asd.ffmt->code); lanes = csi2->nlanes; - ret = v4l2_get_link_freq(ext_sd->ctrl_handler, bpp, lanes * 2); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 15, 0) + /* + * From kernel 6.15+, v4l2_get_link_freq() supports a pad-based + * lookup via struct media_pad *. The IVSC CSI driver dropped its + * V4L2_CID_LINK_FREQ control in 6.15, so the old ctrl_handler path + * returns -ENOENT. Use the pad instead. + */ + ret = v4l2_get_link_freq(pipe->external, bpp, lanes * 2); +#else + ret = v4l2_get_link_freq(ext_sd->ctrl_handler, bpp, lanes * 2); +#endif if (ret < 0) { dev_err(dev, "can't get link frequency (%lld)\n", ret); return ret;