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: 142e5f00bd ("media: i2c: add driver for ITE IT6625/IT6626")
Signed-off-by: Hermes Wu <Hermes.wu@ite.com.tw>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
This commit is contained in:
Hermes Wu 2026-09-30 14:41:32 +08:00 committed by Hans Verkuil
parent 7566656c99
commit 2a1247ebf8

View File

@ -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);