From 2a1247ebf80e3156fcbe7df3b3d892fede0fcf6e Mon Sep 17 00:00:00 2001 From: Hermes Wu Date: Wed, 30 Sep 2026 14:41:32 +0800 Subject: [PATCH] media: i2c: it6625: fix link-frequency reporting for one-/two-trio C-PHY it6625_v4l2_init_controls() selected the 2.5 Gsym/s link-frequency menu entry for any C-PHY configuration, but it6625_get_timings_cap() only raises the DV-timings pixel-clock ceiling for three-trio C-PHY, matching the actually-tested hardware capability. A one-/two-trio C-PHY device was reporting an inflated V4L2_CID_LINK_FREQ. Split the shared two-entry array into two single-entry arrays and select between them with the same condition it6625_get_timings_cap() uses (bus_type == V4L2_MBUS_CSI2_CPHY && csi_lanes == 3; C-PHY is only ever set for IT6626, so this is equivalent to that function's chip-type check as well). Name them for what they actually cover rather than for a PHY type alone, since one-/two-trio C-PHY uses the low-rate array too, not a "D-PHY" array. Fixes: 142e5f00bd57 ("media: i2c: add driver for ITE IT6625/IT6626") Signed-off-by: Hermes Wu Signed-off-by: Hans Verkuil --- drivers/media/i2c/it6625.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/drivers/media/i2c/it6625.c b/drivers/media/i2c/it6625.c index dc0b12a6512f..c6fff4fe4983 100644 --- a/drivers/media/i2c/it6625.c +++ b/drivers/media/i2c/it6625.c @@ -317,11 +317,18 @@ struct it6625 { }; /* - * Index 0: D-PHY (4-lane). Index 1: C-PHY (3-trio) -- the confirmed - * hardware max C-PHY capability, tested single-port/three-trio. + * Reported link frequency for every topology except the reference + * exception below: D-PHY (any lane count) and one-/two-trio C-PHY. */ -static const s64 it6625_link_freq[] = { +static const s64 it6625_link_freq_default[] = { 445500000, +}; + +/* + * IT6626 C-PHY, three trios: the confirmed hardware max C-PHY + * capability, tested single-port/three-trio. + */ +static const s64 it6626_cphy_3trio_link_freq[] = { 2500000000LL, }; @@ -1877,6 +1884,8 @@ static int it6625_v4l2_init_controls(struct v4l2_subdev *sd) { struct it6625 *it6625 = sd_to_6625(sd); struct v4l2_ctrl_handler *hdl = &it6625->hdl; + bool cphy_3trio = it6625->bus_type == V4L2_MBUS_CSI2_CPHY && + it6625->csi_lanes == 3; v4l2_ctrl_handler_init(hdl, 4); it6625->ctrl_5v_detect = @@ -1890,10 +1899,9 @@ static int it6625_v4l2_init_controls(struct v4l2_subdev *sd) it6625->ctrl_audio_present = v4l2_ctrl_new_custom(hdl, &it6625_ctrl_audio_present, NULL); it6625->ctrl_link_freq = - v4l2_ctrl_new_int_menu(hdl, NULL, V4L2_CID_LINK_FREQ, - ARRAY_SIZE(it6625_link_freq) - 1, - it6625->bus_type == V4L2_MBUS_CSI2_CPHY ? 1 : 0, - it6625_link_freq); + v4l2_ctrl_new_int_menu(hdl, NULL, V4L2_CID_LINK_FREQ, 0, 0, + cphy_3trio ? it6626_cphy_3trio_link_freq : + it6625_link_freq_default); if (hdl->error) { v4l2_err(sd, "Failed to initialize controls"); v4l2_ctrl_handler_free(hdl);