From nobody Fri Sep 25 00:05:15 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6477B4B0C9E; Fri, 18 Sep 2026 08:57:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789721841; cv=none; b=UO8MUfi8Mop9E0+H0xTEtn+8KkF3seayCtc2UbthU7cIaRVbzxOW9dteO7wuwBcLWduO7K3Pr0J7FRvT+qspayQ9UIHfAONRFUzVdGQJjo1yEleeri/3rjPGlpQTb3069WoybZp9j3ah31F8YCPSopK9nhT6HMosX0gRYhjPDe0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789721841; c=relaxed/simple; bh=e+E5iM1FydG87K4LexzdnkRbFFD5Ce6LN1dQg+EYuWk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=s4g6YC+9RLFUdYhJCHWFC+dWmfiL15yv47qdagJXAdxpD5QG+Ce1F+/ulxSqr9TKHe+TQa3bWAC8+CE1VaxkT7CNYgMBNfIUsiZQ1wvuBNthyAsCBICK5AfG1akE0MwDwDox9UsisZzsDwx6qAVYKg6hrxTV9Lm6fHuG2UOi46I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=MFLuQyJz; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="MFLuQyJz" Received: by smtp.kernel.org (Postfix) with ESMTPS id 794D3C2BCB9; Fri, 18 Sep 2026 08:57:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1789721839; bh=e+E5iM1FydG87K4LexzdnkRbFFD5Ce6LN1dQg+EYuWk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=MFLuQyJzXUhyv3Rb1KLRAI9NRf0jHpbR0fBHNX4iUNL12e2ErZpFUODsA0cr8V/8x /oJCRqD+qXyj/qbS6QdlKXKZoz3jLxfkaQUewkSSO/4qu2iRZE4hfkRP6SmuJX4Kgv HJkYf4xf7h5P/MzJiwVgd+9cUw4z+KS4wNviyStuPusEDUiGZ7wDM4Ib/Tv3JEvR8+ L45pyPSWPT1IIZJTSvSmstd4ywFtgocpkTc6JukpUqWRSYJ/hvTipsjN46FjPs62tl fHEbBZegfTRBGQFZh3JSDmWGB+0+tT1wZBRZEviNVhpeMQveFkntDS2jgsLra0RLz7 hg0dK7tgRwHJg== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5919DC88E72; Fri, 18 Sep 2026 08:57:19 +0000 (UTC) From: Hermes Wu via B4 Relay Date: Fri, 18 Sep 2026 16:57:16 +0800 Subject: [PATCH 01/21] media: dt-bindings: ite,it6625: document the default CSI-2 bus type Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260918-upstream-it6625-follow-up-patch-v1-1-78d72d7886a5@ite.com.tw> References: <20260918-upstream-it6625-follow-up-patch-v1-0-78d72d7886a5@ite.com.tw> In-Reply-To: <20260918-upstream-it6625-follow-up-patch-v1-0-78d72d7886a5@ite.com.tw> To: Hermes Wu , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: Sakari Ailus , linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Hermes Wu X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1789721837; l=1548; i=Hermes.wu@ite.com.tw; s=20241230; h=from:subject:message-id; bh=9JG2gnHxv5HEk2OflV4GnhtoGwENcuutmXv8NLZl2zU=; b=2+6GDfh7bjm2quDcWDEExkXG0+2/O5n/T5weM/DqTYqUWm4G/Xgsyr3lIKcXiXqd9AFif6Srj 0RilO9sog2cBrts5V5y1zGd2ZyCA53rP1Ev1FVXxSBCdmrNpuG1EYgp X-Developer-Key: i=Hermes.wu@ite.com.tw; a=ed25519; pk=qho5Dawp2WWj9CGyjtJ6/Y10xH8odjRdS6SXDaDAerU= X-Endpoint-Received: by B4 Relay for Hermes.wu@ite.com.tw/20241230 with auth_id=310 X-Original-From: Hermes Wu Reply-To: Hermes.wu@ite.com.tw From: Hermes Wu bus-type is optional under port@0 and port@1's endpoint for ite,it6625 (the allOf/if/then clause only requires it for ite,it6626, which supports both C-PHY and D-PHY and needs disambiguation). With bus-type omitted, the actual runtime default is D-PHY: v4l2_fwnode_endpoint_parse_csi2_bus() falls back to V4L2_MBUS_CSI2_DPHY whenever data-lanes is present, which this binding already requires. Document that default explicitly instead of leaving it unstated. Signed-off-by: Hermes Wu --- Documentation/devicetree/bindings/media/i2c/ite,it6625.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/media/i2c/ite,it6625.yaml b/= Documentation/devicetree/bindings/media/i2c/ite,it6625.yaml index 756fe655f534f85b23b7741d06710c956f9694d8..9b621f726249189255692da0204= 9ebcbf1d5b43c 100644 --- a/Documentation/devicetree/bindings/media/i2c/ite,it6625.yaml +++ b/Documentation/devicetree/bindings/media/i2c/ite,it6625.yaml @@ -65,6 +65,7 @@ properties: enum: - 1 # MEDIA_BUS_TYPE_CSI2_CPHY - 4 # MEDIA_BUS_TYPE_CSI2_DPHY + default: 4 # MEDIA_BUS_TYPE_CSI2_DPHY =20 required: - data-lanes @@ -88,6 +89,7 @@ properties: enum: - 1 # MEDIA_BUS_TYPE_CSI2_CPHY - 4 # MEDIA_BUS_TYPE_CSI2_DPHY + default: 4 # MEDIA_BUS_TYPE_CSI2_DPHY =20 required: - data-lanes --=20 2.34.1 From nobody Fri Sep 25 00:05:15 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 648A44B1295; Fri, 18 Sep 2026 08:57:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789721841; cv=none; b=UgmWIP5JxClk6j/GIp7YxIKiVuAsWbHVFgNtBr0tNf7U7O0amdDKuI+2O4Oy4FEBAHq57HO5SuHtI6RzA41WHXPzo5JAbrLJT+NIEhZCUHoOnMi+pp6s47tRF/57eqXVpTI6IpMEXt5VLVeANQ+pS09959yAyaLJIlhfnnAFvNM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789721841; c=relaxed/simple; bh=fATAoFphE4zN5/jUqdjLv54m7Qirr58ksJqt/9i/hWk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=tZxB5OM3vnCkjk6idKOaVcNKNEaO031WfNuXuCun96LQSwlwBTYQiTmhmc7IfaC6mT46ixCpHIZS9dpLEC48Qew4vEBRw6YgsyQMxhavHGbvByVVljPrnXh+bzDBnVsUcHXjy8Q0KiFGsWOPdNRFvA0ZMpx1Qj2+iCy3yH2HAIA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=nEnxBOlh; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="nEnxBOlh" Received: by smtp.kernel.org (Postfix) with ESMTPS id 8BA4AC2BCF6; Fri, 18 Sep 2026 08:57:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1789721839; bh=fATAoFphE4zN5/jUqdjLv54m7Qirr58ksJqt/9i/hWk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=nEnxBOlh8pof3SEL6aPEL0vOk6qFPPaKiBJZE0a1VdOtak7uwM0eSF0d8TgDrnwsc AQ1fmyp+BYPirNTNZ/Ukt40A0LSBlstgaI4sTbuGHGLMsInrWPhSv/EX0j57GhWQpf 46ADfFf4gS5txsOfXOVq8qb8s6WRVH2DnvAa9N9OOlavtEnoZVBMGfTpg5xlcFP//Y 0DZSm5G6zsVuBS0bH/p51ghPTfGVcANQhdlYUmXI+jAfCqSHso50fzW0ksNl4QkG/N xgeGBYvpPqopTtif9ekTKVFfszlIgfNT2+0mCcefiQt0UUbJLqiq/e/K4ypUIdjCxA 6pyxDmSYwYUFA== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6DCAAC982D2; Fri, 18 Sep 2026 08:57:19 +0000 (UTC) From: Hermes Wu via B4 Relay Date: Fri, 18 Sep 2026 16:57:17 +0800 Subject: [PATCH 02/21] media: i2c: it6625: propagate control-update errors Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260918-upstream-it6625-follow-up-patch-v1-2-78d72d7886a5@ite.com.tw> References: <20260918-upstream-it6625-follow-up-patch-v1-0-78d72d7886a5@ite.com.tw> In-Reply-To: <20260918-upstream-it6625-follow-up-patch-v1-0-78d72d7886a5@ite.com.tw> To: Hermes Wu , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: Sakari Ailus , linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Hermes Wu X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1789721837; l=2441; i=Hermes.wu@ite.com.tw; s=20241230; h=from:subject:message-id; bh=Wu6oxlWNkGLpHo/RmSh9dUsCuP2b2+83EwxRGB5e1D4=; b=RlU/Qf+rDPlwqR1YBCM1C5YMsX3cf/mJrEpXgdDpTeIMU2UM3G/W4E4NR87Q1woSw7im6Hg6z VTXApez6ku/Di26mH0J4SmYduvp2tCTVtO14bNPANxR9kiduYYbqZnL X-Developer-Key: i=Hermes.wu@ite.com.tw; a=ed25519; pk=qho5Dawp2WWj9CGyjtJ6/Y10xH8odjRdS6SXDaDAerU= X-Endpoint-Received: by B4 Relay for Hermes.wu@ite.com.tw/20241230 with auth_id=310 X-Original-From: Hermes Wu Reply-To: Hermes.wu@ite.com.tw From: Hermes Wu it6625_v4l2_sd_ctrl_update() discarded the return value of all three v4l2_ctrl_s_ctrl() calls it makes. Make it return int, run the updates sequentially, and return the first error; both call sites now check and log it. None of the three controls has a driver .ops, so the only failure path in v4l2_ctrl_s_ctrl() is range validation, and every value this driver passes is always in range -- this is an error-handling correctness fix responsive to review, not a fix for an observed runtime failure. Signed-off-by: Hermes Wu --- drivers/media/i2c/it6625.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/drivers/media/i2c/it6625.c b/drivers/media/i2c/it6625.c index da17e5d5ce9e2dd1060abba1598b0e3f78857e9c..5d267676606e340ad0ee5ad2b78= e5acb50a32980 100644 --- a/drivers/media/i2c/it6625.c +++ b/drivers/media/i2c/it6625.c @@ -889,11 +889,19 @@ static int it6625_s_ctrl_audio_present(struct v4l2_su= bdev *sd) audio_present(it6625)); } =20 -static void it6625_v4l2_sd_ctrl_update(struct v4l2_subdev *sd) +static int it6625_v4l2_sd_ctrl_update(struct v4l2_subdev *sd) { - it6625_s_ctrl_detect_hdmi_5v(sd); - it6625_s_ctrl_audio_sampling_rate(sd); - it6625_s_ctrl_audio_present(sd); + int ret; + + ret =3D it6625_s_ctrl_detect_hdmi_5v(sd); + if (ret) + return ret; + + ret =3D it6625_s_ctrl_audio_sampling_rate(sd); + if (ret) + return ret; + + return it6625_s_ctrl_audio_present(sd); } =20 static void it6625_enable_stream_locked(struct it6625 *it6625, bool enable) @@ -1136,9 +1144,12 @@ static void it6625_clear_timings(struct it6625 *it66= 25) static void it6625_irq_hdmi_5v_change(struct it6625 *it6625) { struct v4l2_subdev *sd =3D &it6625->sd; + int ret; =20 it6625_clear_timings(it6625); - it6625_v4l2_sd_ctrl_update(sd); + ret =3D it6625_v4l2_sd_ctrl_update(sd); + if (ret) + dev_err(it6625->dev, "%s: failed to update controls: %d", __func__, ret); } =20 static void it6625_irq_hdcp_change(struct it6625 *it6625) @@ -2297,7 +2308,9 @@ static int it6625_probe(struct i2c_client *client) it6625_debugfs_init(it6625, client); =20 it6625_initial_setup(it6625); - it6625_v4l2_sd_ctrl_update(sd); + err =3D it6625_v4l2_sd_ctrl_update(sd); + if (err) + dev_err(it6625->dev, "%s: failed to update controls: %d", __func__, err); =20 err =3D v4l2_async_register_subdev(sd); if (err < 0) { --=20 2.34.1 From nobody Fri Sep 25 00:05:15 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 649CD4B2034; Fri, 18 Sep 2026 08:57:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789721841; cv=none; b=SL2TVeoodkbZx1z4DSvcU+V2aKtB65RC6dBzaTGLPVEna20zYCyyDnwzzk6/ErftoL3kuXwk7ALEJhVUomakIkiHwEq5Hhax+18hsKwGysrGjyK5eN9nXqGcRxKYfJIJpMVF3tVMSUYfv2f0u/Y4451sCYIIahfkgOLENckoAv4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789721841; c=relaxed/simple; bh=Y09jJH9K4LAobG30wFGPg8/lf73Of68us5AYvkdSpkg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=sscmoaI/BZO3fnCnKztTrouBGR9b0m8YBKkIsDe6x+eLbfWevN+BqekAA4drJOgqwg2uOp3rgtmtlmrgW1y2xogKk1Mvoxc38uZRYeoCFukivg1wny1Sg7kMokZHv7bWokN6kzAB94JaLNKUobsQQvjFk3NfoeCUeSmSPCQ4tu4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=b41DGEEi; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="b41DGEEi" Received: by smtp.kernel.org (Postfix) with ESMTPS id 99C22C2BCFD; Fri, 18 Sep 2026 08:57:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1789721839; bh=Y09jJH9K4LAobG30wFGPg8/lf73Of68us5AYvkdSpkg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=b41DGEEipKK2ihPevUE2RmdlpmR0ROsJ9E7LmC5LD8t0NSd8jYzuYbJ7YZkJpYXYs RBerr+cj2azdKkYaOiLB69J94bbpSs6ZNkyi2rp/SUfIVpNkwY5ioxw/vtCDg1OGM3 CBe2nqT3AohVvRIu6USKR3GNaoaK79tpx8C9vyXyIl7Q2Ghj+c98FAIGS8aRvTQXje UK09Cy4qzOpfOE1+uxGU6gcKsHpAbMYDb/3v35IreiXXBXlNRbAW8YqWDr5G+hXf6F zFL25FvceuDDJ834RMhi3Gluu7ZQGXcY2L70gJO0SYBASdIEuPM2e/gfoaeS9X9DqP E4IVvg76x3ojQ== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 81029C982D9; Fri, 18 Sep 2026 08:57:19 +0000 (UTC) From: Hermes Wu via B4 Relay Date: Fri, 18 Sep 2026 16:57:18 +0800 Subject: [PATCH 03/21] media: i2c: it6625: default the debug module parameter to 0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260918-upstream-it6625-follow-up-patch-v1-3-78d72d7886a5@ite.com.tw> References: <20260918-upstream-it6625-follow-up-patch-v1-0-78d72d7886a5@ite.com.tw> In-Reply-To: <20260918-upstream-it6625-follow-up-patch-v1-0-78d72d7886a5@ite.com.tw> To: Hermes Wu , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: Sakari Ailus , linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Hermes Wu X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1789721837; l=753; i=Hermes.wu@ite.com.tw; s=20241230; h=from:subject:message-id; bh=4gDgLddPvEaApefdm/VXiVuCA+25zmyLXFpBDuZ557I=; b=Yb7vBS9u+fyUDCkPjWNic/5G/TIqKMye9wdZqZO5rdvuWGRbVA2OOTaTPxihG0Qy16rsCgtaT uTEqkSWiu5/BV7NFk7PqcOZCjQbpzZc9FSFh6flKbMWf/pMjp9+kyWn X-Developer-Key: i=Hermes.wu@ite.com.tw; a=ed25519; pk=qho5Dawp2WWj9CGyjtJ6/Y10xH8odjRdS6SXDaDAerU= X-Endpoint-Received: by B4 Relay for Hermes.wu@ite.com.tw/20241230 with auth_id=310 X-Original-From: Hermes Wu Reply-To: Hermes.wu@ite.com.tw From: Hermes Wu Printing all debug information by default is noisy for a normal boot; default debug to 0 like the module parameter's own description implies. Signed-off-by: Hermes Wu --- drivers/media/i2c/it6625.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/i2c/it6625.c b/drivers/media/i2c/it6625.c index 5d267676606e340ad0ee5ad2b78e5acb50a32980..42bdcc3af326ceb6c529b8da358= 36c49c8c43643 100644 --- a/drivers/media/i2c/it6625.c +++ b/drivers/media/i2c/it6625.c @@ -29,7 +29,7 @@ #include #include =20 -static int debug =3D 3; +static int debug; module_param(debug, int, 0644); MODULE_PARM_DESC(debug, "debug level (0-3)"); =20 --=20 2.34.1 From nobody Fri Sep 25 00:05:15 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 64B984B4053; Fri, 18 Sep 2026 08:57:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789721841; cv=none; b=ngMQsWvb1YyNBDGBFjVVLFYs8MonMKqcd33a/VSy9vjIcdJkzlSZcCwV6bC0lZ+FGXI48DCqgT0bqlzQ2yRYfoeQVxHwe24Rd0b16XJokpxhlPGvUtQOEZAblb0u0b5dT39nLzf1r4T2UrATIltmzbdyeocgvBxWpRNIowThAH0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789721841; c=relaxed/simple; bh=1adET2WNpJ+rq+GkPFRn/9/C7ULGQjYJxl63G3P3Gaw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Adm30WJFE0/zH7DRtHlBEHeezJfv/UBg19tGzvkQwn9rHLWg2Npb0YrL7IN+2KdFdJcBaf2Ge/iBbgyXreRwcrLhh1HXMLjOGr4zDgB4RflfTD5dst0pZOYyzfECx6Uzm+VybA+hg1abxvr4j5XmRPeC8/3M43GSWEUklVgr26I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=UbSlPewY; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="UbSlPewY" Received: by smtp.kernel.org (Postfix) with ESMTPS id A82C9C2BCFB; Fri, 18 Sep 2026 08:57:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1789721839; bh=1adET2WNpJ+rq+GkPFRn/9/C7ULGQjYJxl63G3P3Gaw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=UbSlPewYLBbH5B1+SUvdBRdxFZfgpUD71HViBNQqumBPhKocFcDHb4UuB785pMtED a0RA6KeyuV+FrJQS/cM/PmbS7zeua2oSOazhpytxq0ZRNSEpCyRZEXn3fMjC2ov2U4 ao6ZIjQNm3aSrlOWxuGHSq0mjHqso37oJ+bJvD6Be4ePbcD4iqUoqQejSStAHyIDf3 2LkS1TyNn/PgwNxE0q/EOyFDlqfd4gJVHs298RGM/l9TGBtf+6JsuIJsibpTXxxqN6 zM5hOBLIgmqYgKXIdPjnD/W9HruyICWz9gVT4Fuuky5r3U4wmZILSNp/JKnQi0+EyB yDjlK+w9BWa4Q== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 96D8FC982D7; Fri, 18 Sep 2026 08:57:19 +0000 (UTC) From: Hermes Wu via B4 Relay Date: Fri, 18 Sep 2026 16:57:19 +0800 Subject: [PATCH 04/21] media: i2c: it6625: drop unused bus field from struct it6625 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260918-upstream-it6625-follow-up-patch-v1-4-78d72d7886a5@ite.com.tw> References: <20260918-upstream-it6625-follow-up-patch-v1-0-78d72d7886a5@ite.com.tw> In-Reply-To: <20260918-upstream-it6625-follow-up-patch-v1-0-78d72d7886a5@ite.com.tw> To: Hermes Wu , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: Sakari Ailus , linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Hermes Wu X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1789721837; l=822; i=Hermes.wu@ite.com.tw; s=20241230; h=from:subject:message-id; bh=O0b5O1RyDeNdNNk76taXPqiLok8wVKvLOP3Ji3Cxdyc=; b=EGOUNNXA+j2Zjowbr5YOg5d4qdmcLFrnEvC/b1AIpAh5KMffDz1tfdEryFqej662IUybmQpeX tTWE07/vFVbBYu8dNyNLpLbBn7rXjAgD50+xfHU1V1/D9D11fZllBL/ X-Developer-Key: i=Hermes.wu@ite.com.tw; a=ed25519; pk=qho5Dawp2WWj9CGyjtJ6/Y10xH8odjRdS6SXDaDAerU= X-Endpoint-Received: by B4 Relay for Hermes.wu@ite.com.tw/20241230 with auth_id=310 X-Original-From: Hermes Wu Reply-To: Hermes.wu@ite.com.tw From: Hermes Wu struct it6625::bus has no reader anywhere in the driver -- the mipi_csi2 configuration is produced fresh in it6625_get_mbus_config() and parsed locally in it6625_parse_endpoint(), neither of which touches this field. Signed-off-by: Hermes Wu --- drivers/media/i2c/it6625.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/media/i2c/it6625.c b/drivers/media/i2c/it6625.c index 42bdcc3af326ceb6c529b8da35836c49c8c43643..e18baa6e1a1933f301d9d3057c2= c08411f104077 100644 --- a/drivers/media/i2c/it6625.c +++ b/drivers/media/i2c/it6625.c @@ -268,7 +268,6 @@ struct it6625 { struct mutex if_state_lock; =20 struct v4l2_subdev sd; - struct v4l2_mbus_config_mipi_csi2 bus; struct video_device *vdev; struct media_pad pad; struct v4l2_ctrl_handler hdl; --=20 2.34.1 From nobody Fri Sep 25 00:05:15 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 444B54BF950; Fri, 18 Sep 2026 08:57:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789721842; cv=none; b=ShOz2P5x5vxMfkWfPpOfUuu8RT4ku93MB8PuW+4CssOoS3H2WUYIOhiqlWAGMWNhDNg8H/sdYzwUqrISQxtQHmHcZIt3X5NEsrBJdhgiET3FXCmTM6N++AZNLX5FFbamwDdJ14CNzbnbYaLUP9iUzVLdEKHkX0H5VB0sCFd9kyo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789721842; c=relaxed/simple; bh=CgJLg82lUUFbQ7ioFKanZpxnC/3lV+TxbVrR+6yh7hs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Bqt7/EGoz6KZdbnuviJpLGyN8w2ex2MJJ+OsZEifxpxmcF51/0OOPq41NwoWwZXh359kGBtWGmfzLa4mptOSdlioWWTxPsR2oH3Di/9mJ7eOdjQ0O9XigJRBiA3gOo7yLBmDvK7z94uQrTzT3lO18r/zeHigYbAD5xyYzVsB/1U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=J2pkzLyR; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="J2pkzLyR" Received: by smtp.kernel.org (Postfix) with ESMTPS id BDEFFC2BCFF; Fri, 18 Sep 2026 08:57:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1789721839; bh=CgJLg82lUUFbQ7ioFKanZpxnC/3lV+TxbVrR+6yh7hs=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=J2pkzLyROqSrKRULg1k88rtCMexUSwl2YR88ZLy2MZtva38qI1/B9vNPM3LeMbFSc oLIZB8hb69GyvJcu0Io1tXjUhEy+m+oWtZ1+x7JM5CK8qa6kloDd4E7jabZYuo0p6a d0Me4f1XzwkzLDHf/j3+Pm+lijoY0N3F4mwW1/y35Xwihx8Kz7AVIIU4Q6ppjVjLm7 Z/uvoG1wIltIlotoEx+yDPqXbcA1EYPgM6EifusdgGdrUkNtY9YosgifO4HBYWXb2Q rM2rCB4ngHMTPB5qMIveab3itoushWwzxf4GyDxskyI8LPVoS2lPt/At8PzdRH647m 1MVqXmkaaPBQg== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id AB8C4C982DA; Fri, 18 Sep 2026 08:57:19 +0000 (UTC) From: Hermes Wu via B4 Relay Date: Fri, 18 Sep 2026 16:57:20 +0800 Subject: [PATCH 05/21] media: i2c: it6625: drop stale GCC < 4.4.6 workaround Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260918-upstream-it6625-follow-up-patch-v1-5-78d72d7886a5@ite.com.tw> References: <20260918-upstream-it6625-follow-up-patch-v1-0-78d72d7886a5@ite.com.tw> In-Reply-To: <20260918-upstream-it6625-follow-up-patch-v1-0-78d72d7886a5@ite.com.tw> To: Hermes Wu , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: Sakari Ailus , linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Hermes Wu X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1789721837; l=1310; i=Hermes.wu@ite.com.tw; s=20241230; h=from:subject:message-id; bh=uCKxbO4cn2ZcuI95qXRdJOmSokyqnY0F9Y9utuXNyCY=; b=PNtYAtp+bb2k75Xp7Y8v0EN7G62de3BzpstslhKOi/Me1H4bQi1oNR/mIMwEHjyl+spgDCyvL 0esxiZdSTihCSUzcblYuoxdwwk6EJ7Py0GkQfRmxzldZY9ZstT30zgy X-Developer-Key: i=Hermes.wu@ite.com.tw; a=ed25519; pk=qho5Dawp2WWj9CGyjtJ6/Y10xH8odjRdS6SXDaDAerU= X-Endpoint-Received: by B4 Relay for Hermes.wu@ite.com.tw/20241230 with auth_id=310 X-Original-From: Hermes Wu Reply-To: Hermes.wu@ite.com.tw From: Hermes Wu The kernel-wide minimum GCC version is 8.1 (scripts/min-tool-version.sh), so the explicit .reserved =3D { 0 } initializer kept for GCC < 4.4.6 is no longer needed in either v4l2_dv_timings_cap initializer. Signed-off-by: Hermes Wu --- drivers/media/i2c/it6625.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/media/i2c/it6625.c b/drivers/media/i2c/it6625.c index e18baa6e1a1933f301d9d3057c2c08411f104077..97780c3d2d8fd3567ef18b3d2fc= 46b4e1f0758d7 100644 --- a/drivers/media/i2c/it6625.c +++ b/drivers/media/i2c/it6625.c @@ -331,8 +331,6 @@ static const s64 it6625_link_freq[] =3D { */ static const struct v4l2_dv_timings_cap it6625_timings_cap =3D { .type =3D V4L2_DV_BT_656_1120, - /* keep this initialization for compatibility with GCC < 4.4.6 */ - .reserved =3D { 0 }, =20 V4L2_INIT_BT_TIMINGS(640, 3840, 480, 2160, 27000000, 300000000, V4L2_DV_BT_STD_CEA861 | V4L2_DV_BT_STD_DMT | @@ -347,7 +345,6 @@ static const struct v4l2_dv_timings_cap it6625_timings_= cap =3D { */ static const struct v4l2_dv_timings_cap it6626_cphy_3trio_timings_cap =3D { .type =3D V4L2_DV_BT_656_1120, - .reserved =3D { 0 }, =20 V4L2_INIT_BT_TIMINGS(640, 3840, 480, 2160, 27000000, 594000000, V4L2_DV_BT_STD_CEA861 | V4L2_DV_BT_STD_DMT | --=20 2.34.1 From nobody Fri Sep 25 00:05:15 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3F2774BE432; Fri, 18 Sep 2026 08:57:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789721842; cv=none; b=CJtTvhnG/K8fwh5Amprjsh+0f/5NDpceiHbubEU0GaYhhYNrKuuhl4GLSS3ugQ67vWGoHAM45t9U9EBwF+bOHDiPhLDMnQVg5O1xmIsDg22/zArHO4bFDFR+/KTYyNwETnbmHWjoaiAd6nDxhmMwuYMyMgQIezs4NY6EeQ31OE0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789721842; c=relaxed/simple; bh=gbsjVA9MG1EIAcCdtoq5wj2ddn+k8mHdKgTO1+iB8do=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=UOcndE2cI/39QOyRhpymidScNsweFxWSN7rWtmJS4yEsIwpnwQ/s6FuRuds06wkqLI7pmg3eeKwuOY+TCPn65USc5JJmibGKbDAt/RPK+VzIgG7+DjBtRCsKQKh3s7ikTRidyyCemnLogWnwBujwdh7h0UDij+Wh4dWx/l1G/xA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Mv9fqwP0; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Mv9fqwP0" Received: by smtp.kernel.org (Postfix) with ESMTPS id D3F50C2BD01; Fri, 18 Sep 2026 08:57:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1789721839; bh=gbsjVA9MG1EIAcCdtoq5wj2ddn+k8mHdKgTO1+iB8do=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=Mv9fqwP0LZ/qKS5Ksi/PW6FV+OTHLKjLbdOyOikhSeMEkCzs0Tt0aFNFv60Lt846Y NKhOt56THnM32o7k8aqR0A0iNk2caU3+RItS51KO7jQqM94lqZfydjAi83ULiR2KF0 NWr+vWyASUSGdqNKMRvifSnQzWw9MFnrzwIVqkzQDZUju8aj/CUv5/FfEMJLFyY3Xs qsguRAZWnZO4SeWuqAUJu4BnI4uwIShb41AQUhLB+xxilRoLara3pSt5C6yTitNZKd G63PXvA8x5zgmUESG+TL4xtQBJz5cDkfRRbWPADhPMwOy/qJI6pBiKDTg1LFy2r6j9 Iv3SYx+Qv3qcQ== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id C19CCC982D7; Fri, 18 Sep 2026 08:57:19 +0000 (UTC) From: Hermes Wu via B4 Relay Date: Fri, 18 Sep 2026 16:57:21 +0800 Subject: [PATCH 06/21] media: i2c: it6625: use unsigned int loop indices in table lookups Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260918-upstream-it6625-follow-up-patch-v1-6-78d72d7886a5@ite.com.tw> References: <20260918-upstream-it6625-follow-up-patch-v1-0-78d72d7886a5@ite.com.tw> In-Reply-To: <20260918-upstream-it6625-follow-up-patch-v1-0-78d72d7886a5@ite.com.tw> To: Hermes Wu , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: Sakari Ailus , linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Hermes Wu X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1789721837; l=1788; i=Hermes.wu@ite.com.tw; s=20241230; h=from:subject:message-id; bh=5Ctpnc+LLcR3m3GriRx3vFNF83f7OL4HJpZpnaEfXgE=; b=Bf3iH9gI31vUxKhbt9d5/ViXQWrtvJGccq+I5WKsqNl+vOvtGdr0McRq9Wgs0HCsKqqJ7tfkx cUfShiyMpY2CI6wzGZ8ZdtFmGp+8g+O/uiNhWqFcG4MfT9FupUEHBE1 X-Developer-Key: i=Hermes.wu@ite.com.tw; a=ed25519; pk=qho5Dawp2WWj9CGyjtJ6/Y10xH8odjRdS6SXDaDAerU= X-Endpoint-Received: by B4 Relay for Hermes.wu@ite.com.tw/20241230 with auth_id=310 X-Original-From: Hermes Wu Reply-To: Hermes.wu@ite.com.tw From: Hermes Wu it6625_csi_format_idx(), it6625_csi_mbus_code_idx(), and it6625_regdump_print() iterate with a plain-signed loop index against an unsigned bound. Declare the index as unsigned int directly in the for() statement instead. Signed-off-by: Hermes Wu --- drivers/media/i2c/it6625.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/media/i2c/it6625.c b/drivers/media/i2c/it6625.c index 97780c3d2d8fd3567ef18b3d2fc46b4e1f0758d7..9077f66187c647f85e41e571ff0= d52e5e2ffdfdf 100644 --- a/drivers/media/i2c/it6625.c +++ b/drivers/media/i2c/it6625.c @@ -375,9 +375,7 @@ static const struct it6625_format_info { =20 static inline int it6625_csi_format_idx(u8 csi_format) { - int i; - - for (i =3D 0; i < ARRAY_SIZE(it6625_formats); i++) { + for (unsigned int i =3D 0; i < ARRAY_SIZE(it6625_formats); i++) { if (it6625_formats[i].csi_format =3D=3D csi_format) return i; } @@ -387,9 +385,7 @@ static inline int it6625_csi_format_idx(u8 csi_format) =20 static inline int it6625_csi_mbus_code_idx(u32 mbus_fmt_code) { - int i; - - for (i =3D 0; i < ARRAY_SIZE(it6625_formats); i++) { + for (unsigned int i =3D 0; i < ARRAY_SIZE(it6625_formats); i++) { if (it6625_formats[i].mbus_fmt_code =3D=3D mbus_fmt_code) return i; } @@ -1878,11 +1874,9 @@ static int it6625_v4l2_init_controls(struct v4l2_sub= dev *sd) =20 static void it6625_regdump_print(struct seq_file *s, const u8 *reg_buf) { - int i; - seq_puts(s, " 0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x0A = 0x0B 0x0C 0x0D 0x0E 0x0F\n"); =20 - for (i =3D 0; i < 256; i++) { + for (unsigned int i =3D 0; i < 256; i++) { if (i % 16 =3D=3D 0) seq_printf(s, "[%02X] ", i & 0xF0); seq_printf(s, "0x%02X ", reg_buf[i]); --=20 2.34.1 From nobody Fri Sep 25 00:05:15 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 442D14BF934; Fri, 18 Sep 2026 08:57:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789721842; cv=none; b=ffMVKJFwRuqFs8NJobKWRwWP3xkj4hR4YhsjkbXdcdAOWRGyFdXD24rGJLwbZeUwyEEfsR9QWsdlMfluBTKcsZYQY/RFQGzo91vdhiTLlyEiv2Ad5Lfp7+bNAFiq4WvREQQeYuVWiMB0IjeqMk9q4gpg6bR3sNMMlvY+c3ahlvA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789721842; c=relaxed/simple; bh=vQWgY/YFYLzclsm6KEeaJRu31wu1rdkgKqIQa7G04Rc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=A/MhdBKfj356T0bzJWaeuhXo//iNUwQjKM78zcJ/ky/fS3Xcy8LpJRamm51oZGBLN5T3rfMLg+Mx0c3/Ed2gDBHBfX/sZM46CkqeBLBCvggusFB+mhC7ff/G9eHhPaUME7x1Mo2eCWMKHCPjgmXfrFRL7S/JzKCedqI85fB/fRE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ghB3PMd8; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ghB3PMd8" Received: by smtp.kernel.org (Postfix) with ESMTPS id E702CC2BCFA; Fri, 18 Sep 2026 08:57:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1789721839; bh=vQWgY/YFYLzclsm6KEeaJRu31wu1rdkgKqIQa7G04Rc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=ghB3PMd8JkQNLAoiFg/wgW1gKuzC8WjYCU6QpbwS3qOl51VtoEK7P8/COvUJXaFLn 2BqhXclpcpNRJxPWQSMTgeuGxCztTq2XxMnyYE8bRJhrXgwCExJPOZYGTN/CWwruBW m+lvv7H577y1ZOTfdPIpyLg1NrmC9gcmPu0byzNoxOnw26iRtMrUmF2ci1Svaiyde/ w6MULQQ6jO/LUEi1zIniv6HxYCV/d4BCXS6lytyfh+CeCvXNEhmcPF57AfhhNsBfOL XXSZD3Kwn6euDUBzVfzwbhtFqicaEbVw5Zvfq4o6s7yvjr/Qv1LzJfTil6N/SLdEGi RWfRoltzNItjg== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id D5BE9C982D9; Fri, 18 Sep 2026 08:57:19 +0000 (UTC) From: Hermes Wu via B4 Relay Date: Fri, 18 Sep 2026 16:57:22 +0800 Subject: [PATCH 07/21] media: i2c: it6625: drop redundant parentheses in status helpers Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260918-upstream-it6625-follow-up-patch-v1-7-78d72d7886a5@ite.com.tw> References: <20260918-upstream-it6625-follow-up-patch-v1-0-78d72d7886a5@ite.com.tw> In-Reply-To: <20260918-upstream-it6625-follow-up-patch-v1-0-78d72d7886a5@ite.com.tw> To: Hermes Wu , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: Sakari Ailus , linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Hermes Wu X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1789721837; l=1911; i=Hermes.wu@ite.com.tw; s=20241230; h=from:subject:message-id; bh=+aDCjoF5sVqbtnaUoN2TsLy07b6ldMFq1pFd16oDI2M=; b=2QSZvAH8tBYZg+k3tWili1X17Y2muq02CBmcSVjNDP9t3FK9QHq5hn5ylWPmQLy0lBL2sKE// i3E12ug0aYyCL8f+XPlY7QAY66gh6IBDZoG9E0uXJiRjLu45x8mDd8e X-Developer-Key: i=Hermes.wu@ite.com.tw; a=ed25519; pk=qho5Dawp2WWj9CGyjtJ6/Y10xH8odjRdS6SXDaDAerU= X-Endpoint-Received: by B4 Relay for Hermes.wu@ite.com.tw/20241230 with auth_id=310 X-Original-From: Hermes Wu Reply-To: Hermes.wu@ite.com.tw From: Hermes Wu is_hdmi(), hdmi_5v_power_present(), no_signal(), and audio_present() wrap their ternary condition and true-branch bitwise-AND in parentheses that C's operator precedence already makes unnecessary: '<' binds tighter than '&', and '&' binds tighter than '?:'. Drop them; behavior is unchanged. Signed-off-by: Hermes Wu --- drivers/media/i2c/it6625.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/media/i2c/it6625.c b/drivers/media/i2c/it6625.c index 9077f66187c647f85e41e571ff0d52e5e2ffdfdf..62fabf6169fc24364e484cf573b= 0fc1af174afbb 100644 --- a/drivers/media/i2c/it6625.c +++ b/drivers/media/i2c/it6625.c @@ -554,7 +554,7 @@ static inline bool is_hdmi(struct it6625 *it6625) int val; =20 val =3D it6625_read_byte(it6625, REG_RX_STATUS); - return (val < 0) ? false : (val & B_RX_HDMI); + return val < 0 ? false : val & B_RX_HDMI; } =20 static inline bool hdmi_5v_power_present(struct it6625 *it6625) @@ -562,7 +562,7 @@ static inline bool hdmi_5v_power_present(struct it6625 = *it6625) int val; =20 val =3D it6625_read_byte(it6625, REG_RX_STATUS); - return (val < 0) ? false : (val & B_RX_5V); + return val < 0 ? false : val & B_RX_5V; } =20 static inline bool no_signal(struct it6625 *it6625) @@ -570,7 +570,7 @@ static inline bool no_signal(struct it6625 *it6625) int val; =20 val =3D it6625_read_byte(it6625, REG_RX_STATUS); - return (val < 0) ? true : !(val & B_RX_STABLE); + return val < 0 ? true : !(val & B_RX_STABLE); } =20 static inline bool audio_present(struct it6625 *it6625) @@ -578,7 +578,7 @@ static inline bool audio_present(struct it6625 *it6625) int val; =20 val =3D it6625_read_byte(it6625, REG_RX_STATUS); - return (val < 0) ? false : (val & B_RX_AUD_ON); + return val < 0 ? false : val & B_RX_AUD_ON; } =20 static int get_audio_sampling_rate(struct it6625 *it6625) --=20 2.34.1 From nobody Fri Sep 25 00:05:15 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 445D74BFE61; Fri, 18 Sep 2026 08:57:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789721842; cv=none; b=pkOM5DyNViMCd2zJZrtn5mJs8UUmR3cPU25g0Np4br2gdbTFmUuNt1hfEJAJZIkAdeJGlq23kPs3KfQPuunDMLtGKbQ0XIi4l7uhUS9IyMP5Y4cZ5ucI1GDHCGgmE/TstR1S4o1G3B+g/DqGXA6LfGv9NkcAtb6aS1TN84SujIU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789721842; c=relaxed/simple; bh=YqdWcJwtyS3r/Yw9V015tKcD6fJ16mBb6icZQYhusTY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=mXuKTEgxu0d7BEeg2OOrxuvrxJ7q4FMDQWaWmx56rOe1rnLewFvsQRzD5hIOzrI0E1Lg30Puyt6HyPWui8KJQh9PCWHyU2MWGmGAP91Z2hgQUwxoeO8cro2Exhjb5eefd+xBW4gxoHQzUkLdMWdR9/li3ifEDTbeSGFmuDsMRPM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=G34zXpEL; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="G34zXpEL" Received: by smtp.kernel.org (Postfix) with ESMTPS id 056A6C2BD00; Fri, 18 Sep 2026 08:57:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1789721840; bh=YqdWcJwtyS3r/Yw9V015tKcD6fJ16mBb6icZQYhusTY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=G34zXpELhqh0GhbtXT5fFUB6gBIySLUYO4w5ZP9TxA5AtSTVWssK6xKYNEAfP2x43 l1XbVEJ6VZt5zaukE3IJaF/bt+6jaNvlDszj/UH3BCM1dLt9ZTPhOpcxghRMoTobDs cduiJQ6wFAlU+XFamRl/bAI7smxtBnoQLiFVDHmnVBp0S2ztlEZgfyHnKSa9vAsOJz 2Wuhwt3ksiZ7x1TbBBg6irlC/ciPJ9dH8DXicXrJBGP9XzqnwqjIRQfXsFFW5Yyhfz OjOjJ41Dl5xAOqXTLFD34wWXRrPRJELeH034CSXhXq9WwuAIT/SWfBoFMg1avOakxx bi3WO1I20qVKQ== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id E79DDC88E72; Fri, 18 Sep 2026 08:57:19 +0000 (UTC) From: Hermes Wu via B4 Relay Date: Fri, 18 Sep 2026 16:57:23 +0800 Subject: [PATCH 08/21] media: i2c: it6625: make the audio sampling-rate table static const Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260918-upstream-it6625-follow-up-patch-v1-8-78d72d7886a5@ite.com.tw> References: <20260918-upstream-it6625-follow-up-patch-v1-0-78d72d7886a5@ite.com.tw> In-Reply-To: <20260918-upstream-it6625-follow-up-patch-v1-0-78d72d7886a5@ite.com.tw> To: Hermes Wu , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: Sakari Ailus , linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Hermes Wu X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1789721837; l=1207; i=Hermes.wu@ite.com.tw; s=20241230; h=from:subject:message-id; bh=qGU/O647aZTfqdglQzVk6HPtKDWbKwtWWhBds51Ufxk=; b=TfBXu2AxpWb2bsLyWlvInSsVxazGkyNi7inH3WJ6fG0FNMq3IVSihhPEA4UOiuLk/PDqKom8S cd1DTk9Pm5MAACPnNt3OPgoHDeJhQaVk/4vAW9vTbGw5p4VvIrqTrnw X-Developer-Key: i=Hermes.wu@ite.com.tw; a=ed25519; pk=qho5Dawp2WWj9CGyjtJ6/Y10xH8odjRdS6SXDaDAerU= X-Endpoint-Received: by B4 Relay for Hermes.wu@ite.com.tw/20241230 with auth_id=310 X-Original-From: Hermes Wu Reply-To: Hermes.wu@ite.com.tw From: Hermes Wu s_fsid_map in get_audio_sampling_rate() is a fixed lookup table rebuilt on the stack on every call; make it static const so it's emitted once as read-only data instead. While touching this declaration, move it ahead of the plain int locals per reverse fir-tree ordering. Signed-off-by: Hermes Wu --- drivers/media/i2c/it6625.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/media/i2c/it6625.c b/drivers/media/i2c/it6625.c index 62fabf6169fc24364e484cf573b0fc1af174afbb..9b1d9edca8f383f4f55918bda25= 9a1b053d7f41b 100644 --- a/drivers/media/i2c/it6625.c +++ b/drivers/media/i2c/it6625.c @@ -583,9 +583,7 @@ static inline bool audio_present(struct it6625 *it6625) =20 static int get_audio_sampling_rate(struct it6625 *it6625) { - int fs_id; - int i, freq =3D 0; - const struct fs_id_map { + static const struct fs_id_map { u8 fs_id; u32 freq; } s_fsid_map[] =3D { @@ -610,6 +608,8 @@ static int get_audio_sampling_rate(struct it6625 *it662= 5) { AUD1411K, 1411200 }, { AUD1536K, 1536000 }, }; + int fs_id; + int i, freq =3D 0; =20 if (no_signal(it6625) || !audio_present(it6625)) return 0; --=20 2.34.1 From nobody Fri Sep 25 00:05:15 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 429824BE450; Fri, 18 Sep 2026 08:57:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789721842; cv=none; b=PVMcEhAiiuE0DX3jzFB1SlE/cwo18+FqFj51Z+CU59VNHoOqdJA/TmlSwBk9fTHOpDz0nCI3P01J7XsDdjK4nyIH8Nht3fyFTf4l4LqWrm1qEKHax6l232eGn/PokeIzpyuQFmbPshzzJkpM+0Swd+cKjw5Hjblac++qjlP0AEY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789721842; c=relaxed/simple; bh=x9Ql0bOQJU2VujMLpcb475Eo6gkNPsGLk3Kv6vs/DSc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=YDdlo614I7sRCUgPn1PJDE9OWnuaYcZXSEEWjPphXitaD1e1dTlcrVQIecNX5kEpxVH8Gt2v64WkcAgilSEacr/HOa2QlgSkH0F4utwJi7n8Zsa0oAZuzZ6MURtzxjyH3+yWydkqWq2PcJTg5Y7R8Qb0mz5WjkSyaNtxd06WORs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=BGBn7Aec; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="BGBn7Aec" Received: by smtp.kernel.org (Postfix) with ESMTPS id 176B1C2BD05; Fri, 18 Sep 2026 08:57:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1789721840; bh=x9Ql0bOQJU2VujMLpcb475Eo6gkNPsGLk3Kv6vs/DSc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=BGBn7AecftPSJNxH5kKTqY+ZvkT76tVKf+JHKUseBCiDmxYeOVGc0gDqVIJ3InJfD bArXEZrkaj9/9neZiKQY+zO1fVZwPl4r9oPCcfk99YKk+wdXF+edzi0oCMLKEPboWB wSmEle/b3wH5ER2I1yL2wOGeQZSOE0qRJPNRgQ2+ettk3cP4l3g+pl4tlDJSAKI+vG gsctVZQqq3ZBSL0jQaPXr8xukScTS17wIiDYNZFbxOCXYhWY30gYld+zMTB3AvgCKF HretTMrMPeDzdRbHF674QE0BcspYd1wT8k9r/f01uOGwRCLYY8c54ewCmV4HvYntGU VjhlL88jX60Wg== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 04B79C982DA; Fri, 18 Sep 2026 08:57:20 +0000 (UTC) From: Hermes Wu via B4 Relay Date: Fri, 18 Sep 2026 16:57:24 +0800 Subject: [PATCH 09/21] media: i2c: it6625: tidy CEC buffer init and a continuation line Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260918-upstream-it6625-follow-up-patch-v1-9-78d72d7886a5@ite.com.tw> References: <20260918-upstream-it6625-follow-up-patch-v1-0-78d72d7886a5@ite.com.tw> In-Reply-To: <20260918-upstream-it6625-follow-up-patch-v1-0-78d72d7886a5@ite.com.tw> To: Hermes Wu , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: Sakari Ailus , linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Hermes Wu X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1789721837; l=1973; i=Hermes.wu@ite.com.tw; s=20241230; h=from:subject:message-id; bh=NnYGUJlmTkGxYwl+rsslEcp8n5vm8G5JSLjxvFJvsgU=; b=4kD8/euat28my7nYzQPmlRvoviWk6fzS2lcv8rAEUThn/3yb6V9bA+QKQ62+EAcX821iZbcKa +ku0+nNYZrbCmlQs1LUeTCXFBctn3OL4cMGCiHMttZcbsAqNNXhrHlP X-Developer-Key: i=Hermes.wu@ite.com.tw; a=ed25519; pk=qho5Dawp2WWj9CGyjtJ6/Y10xH8odjRdS6SXDaDAerU= X-Endpoint-Received: by B4 Relay for Hermes.wu@ite.com.tw/20241230 with auth_id=310 X-Original-From: Hermes Wu Reply-To: Hermes.wu@ite.com.tw From: Hermes Wu it6625_hpd_delayed_work(): wrap the container_of() assignment after '=3D' instead of splitting the argument list mid-parenthesis. it6625_cec_adap_enable(): assign the cmds[] buffer at declaration instead of two separate statements, matching the pattern already used elsewhere in this file. it6625_cec_adap_log_addr(): add the missing spaces inside the cmds[] initializer's braces. Signed-off-by: Hermes Wu --- drivers/media/i2c/it6625.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/media/i2c/it6625.c b/drivers/media/i2c/it6625.c index 9b1d9edca8f383f4f55918bda259a1b053d7f41b..bc6b0a9a0bb005b30983a30f8ca= 685f885ab78c6 100644 --- a/drivers/media/i2c/it6625.c +++ b/drivers/media/i2c/it6625.c @@ -757,8 +757,8 @@ static void it6625_enable_hpd(struct it6625 *it6625) =20 static void it6625_hpd_delayed_work(struct work_struct *work) { - struct it6625 *it6625 =3D container_of(work, - struct it6625, hpd_delayed_work.work); + struct it6625 *it6625 =3D + container_of(work, struct it6625, hpd_delayed_work.work); int val =3D 0; =20 guard(mutex)(&it6625->it6625_lock); @@ -980,10 +980,8 @@ static void it6625_initial_setup(struct it6625 *it6625) static int it6625_cec_adap_enable(struct cec_adapter *adap, bool enable) { struct it6625 *it6625 =3D adap->priv; - u8 cmds[2]; + u8 cmds[2] =3D { CMD_SET_CEC_ENABLE, enable ? 1 : 0 }; =20 - cmds[0] =3D CMD_SET_CEC_ENABLE; - cmds[1] =3D enable ? 1 : 0; guard(mutex)(&it6625->it6625_lock); it6625_write_command(it6625, cmds, sizeof(cmds)); =20 @@ -1009,7 +1007,7 @@ static void it6625_cec_reset_la(struct it6625 *it6625= , bool keep_enabled) static int it6625_cec_adap_log_addr(struct cec_adapter *adap, u8 log_addr) { struct it6625 *it6625 =3D adap->priv; - u8 cmds[2] =3D {CMD_SET_CEC_LA, log_addr}; + u8 cmds[2] =3D { CMD_SET_CEC_LA, log_addr }; =20 dev_dbg(it6625->dev, "%s: la=3D%d", __func__, log_addr); =20 --=20 2.34.1 From nobody Fri Sep 25 00:05:15 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4402F4BF930; Fri, 18 Sep 2026 08:57:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789721842; cv=none; b=gW6kXqPrXjtfC08U9dFff/8vF6U09tn6L8yXKve9WdPHXUvmpUDt1H6lONBeakEpOzPllG7NRVrWbEjQ1PFDODdyD3O6nGvBSEN5SgT3y4HgWotasxgU/zv/eQlVdLqsZXIEknHyE8R/T8SWtdk0EvVh5b6hWro6A7wDoDzDtac= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789721842; c=relaxed/simple; bh=0MZfb8YOHcc8fokOMG53lDFB1Qy18zEZ9NRLMlmZKTo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=SzI/iQqfwuZxpoluLygsYdauJhBTLEtKtREr3xFZeEl6tldJkxwC5hMfYP7ogkCrYrWR5e/Nl8/USAsW4U/KYH4TC6W9bp7fCAb3lJZqIMGJYQPAjQ2iehF9KT3s4R9OIsDIfbFhnYOfqMi2YMYyEDw4IoizTmVsQda9NIstzLo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=SPdXFUGn; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="SPdXFUGn" Received: by smtp.kernel.org (Postfix) with ESMTPS id 4D51FC2BCFC; Fri, 18 Sep 2026 08:57:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1789721840; bh=0MZfb8YOHcc8fokOMG53lDFB1Qy18zEZ9NRLMlmZKTo=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=SPdXFUGnc+1kJFe6w289wQtDGDCSdf+RfxgTK3YFBYjobGzDS0iHySZa7x/VA2hp+ hTWU/m8NDcJHLqSup37CBPcKXANbmn6J3Av01s1lBxwrcQuix7vZvHw6Acvezo63Dg bJQa7VvY471uuGH43NhYzIzq7wXsUYT448c28D1x5H4w0tFns1Hs+/uHfx/0sRaZKo bFJTpa6k0B8CewgUi0Y7ullJ3Y3KQ+iG4YADjpVgI/oGv6vSssYrrWsq669jRKCb/4 qGK+I8Oi/tuJ9kUjbMEt92C58fMeQRp1gUDYbV6nGpseiLB03VaUWO97WPDYLADu7k HIP3yAWo5MJ7g== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3C151C982D7; Fri, 18 Sep 2026 08:57:20 +0000 (UTC) From: Hermes Wu via B4 Relay Date: Fri, 18 Sep 2026 16:57:25 +0800 Subject: [PATCH 10/21] media: i2c: it6625: clean up it6625_wait_for_status() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260918-upstream-it6625-follow-up-patch-v1-10-78d72d7886a5@ite.com.tw> References: <20260918-upstream-it6625-follow-up-patch-v1-0-78d72d7886a5@ite.com.tw> In-Reply-To: <20260918-upstream-it6625-follow-up-patch-v1-0-78d72d7886a5@ite.com.tw> To: Hermes Wu , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: Sakari Ailus , linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Hermes Wu X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1789721837; l=1624; i=Hermes.wu@ite.com.tw; s=20241230; h=from:subject:message-id; bh=wL/1qnO+KdUccI1MFOk7guLQMPf4wbF6Anqg/vJGVwo=; b=tJxYICqzS7N37px8uk6EZk33m365tQjLFHq7GLftJv4UbZA2Q/ulp3MixxR1fatb7sXXqWeDx VwbNdQvAVAZAHuJPYmRRe5zj6ge42cUXBNpp/VDFOg3c6Q7gnj4Gcu6 X-Developer-Key: i=Hermes.wu@ite.com.tw; a=ed25519; pk=qho5Dawp2WWj9CGyjtJ6/Y10xH8odjRdS6SXDaDAerU= X-Endpoint-Received: by B4 Relay for Hermes.wu@ite.com.tw/20241230 with auth_id=310 X-Original-From: Hermes Wu Reply-To: Hermes.wu@ite.com.tw From: Hermes Wu Use USEC_PER_MSEC instead of a bare 1000 multiplier for the read_poll_timeout() sleep/timeout arguments, and add the linux/time64.h include it comes from. Drop the needless (int) cast on rval, which is already declared int. Downgrade the unconditional per-call status log from dev_info() to dev_dbg(), since it fires on every call, not just failures. Signed-off-by: Hermes Wu --- drivers/media/i2c/it6625.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/media/i2c/it6625.c b/drivers/media/i2c/it6625.c index bc6b0a9a0bb005b30983a30f8ca685f885ab78c6..b580256d32f51465a620b639fc0= 134366cc6fcc1 100644 --- a/drivers/media/i2c/it6625.c +++ b/drivers/media/i2c/it6625.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -502,11 +503,11 @@ static int it6625_wait_for_status(struct it6625 *it66= 25, u8 reg, u8 val, int timeout_round_ms =3D DIV_ROUND_UP(timeout_ms, sleep_ms) * sleep_ms; =20 status =3D read_poll_timeout(it6625_read_byte, rval, rval =3D=3D val, - sleep_ms * 1000, - timeout_round_ms * 1000, + sleep_ms * USEC_PER_MSEC, + timeout_round_ms * USEC_PER_MSEC, false, it6625, reg); =20 - dev_info(dev, "%s status =3D %d %d", __func__, status, (int)rval); + dev_dbg(dev, "%s status =3D %d %d", __func__, status, rval); if (status < 0) { dev_err(dev, "%s err status =3D %d", __func__, status); return -ETIMEDOUT; --=20 2.34.1 From nobody Fri Sep 25 00:05:15 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 441934BF933; Fri, 18 Sep 2026 08:57:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789721842; cv=none; b=C771IAnxcx/IPM98P6ifGpLRVMyi0nIKXlfKk2MiqA93NNbzMW6YguM2ayEnmgGcKk0fWENmlmXWffg68JfrgXjFIaXVrrnJ24t8jqYh9t1z39olGQgdNY07gcnzb1O+dzt5WYQMviaewez5Db1O2GA2PJIwJ1k3zwse2pukTaQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789721842; c=relaxed/simple; bh=CQO3KyXjcEOh1cJImvayR9pN1O2Gi+6chTdyTr2q23c=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=gdtH3RiFCdRH7qNTXH9rjK2qXi4en9zpC1uheddzBPLRKhnW7jxIx3bs+9RNN+h35fxRct4QAh7KF4zyU4s1WCwug1j70tXnc28ALTkRRbZKjNybPPjnY+N5jHsLv3qSJ9MqRqpVgRGOr6wM4ocF2owg5FKzpSglpngrlDCNlro= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=hiiUXy/M; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="hiiUXy/M" Received: by smtp.kernel.org (Postfix) with ESMTPS id 64D4FC32781; Fri, 18 Sep 2026 08:57:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1789721840; bh=CQO3KyXjcEOh1cJImvayR9pN1O2Gi+6chTdyTr2q23c=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=hiiUXy/MYf+LhIkuAehHEFuDk4Tgy/3F5R9qZalTDIHYogFC8EMY50VhTve5zNM3k 9rtzqbQI5RtK7o6WUDORZjhVpeL9/3T2zjW+vHwYgwLl6KK/bemBxaFQoPm5abeYW8 4KsPbOy3EmGV6g83xH19hxiDaaU3Udx0T+ioWBM21Tm8C0qf1Zj36qiFYssUN2pC1y W+pVyeaxAl4c/oK4BL2gt24Jrnx38CkXRvMUdVS9ztiEHDy5kLQVNMeddJkRY18MMT pWQ5gFjJ/gxE2E/l8YFVz5YgT4RpAEr6sb+/z9NP9FQbgaFSFyUgYmGojAlnD8Cfao NBgGqp0cXmVUQ== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4FEAAC88E72; Fri, 18 Sep 2026 08:57:20 +0000 (UTC) From: Hermes Wu via B4 Relay Date: Fri, 18 Sep 2026 16:57:26 +0800 Subject: [PATCH 11/21] media: i2c: it6625: use unsigned int indices in EDID read/write Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260918-upstream-it6625-follow-up-patch-v1-11-78d72d7886a5@ite.com.tw> References: <20260918-upstream-it6625-follow-up-patch-v1-0-78d72d7886a5@ite.com.tw> In-Reply-To: <20260918-upstream-it6625-follow-up-patch-v1-0-78d72d7886a5@ite.com.tw> To: Hermes Wu , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: Sakari Ailus , linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Hermes Wu X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1789721837; l=1460; i=Hermes.wu@ite.com.tw; s=20241230; h=from:subject:message-id; bh=NqCXYn3xhZ1IIhlAVGE1HXgnu3CsRL/n6ZRVnjAh6nw=; b=jOqA6KM0UKYUdWwV5r7kuGILkpP2dbium/P6VXPD81QNlemTzlveDZvPh0hKIHB27t1EEKvBG 8vCfFbOiyCMDwmL2pH3gvOk3512qvUjzrTQObPOXpHHk4Lr6nu3i9nb X-Developer-Key: i=Hermes.wu@ite.com.tw; a=ed25519; pk=qho5Dawp2WWj9CGyjtJ6/Y10xH8odjRdS6SXDaDAerU= X-Endpoint-Received: by B4 Relay for Hermes.wu@ite.com.tw/20241230 with auth_id=310 X-Original-From: Hermes Wu Reply-To: Hermes.wu@ite.com.tw From: Hermes Wu it6625_read_edid() and it6625_write_edid() iterate their block loop with signed i/bank_ctrl locals holding only non-negative values; make them unsigned int and keep err signed. Reorder the declarations to put the pointer before the scalars while these functions are already being touched. Signed-off-by: Hermes Wu --- drivers/media/i2c/it6625.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/media/i2c/it6625.c b/drivers/media/i2c/it6625.c index b580256d32f51465a620b639fc0134366cc6fcc1..328bd99f27cf84722caa184302c= ddeb9c3e667fb 100644 --- a/drivers/media/i2c/it6625.c +++ b/drivers/media/i2c/it6625.c @@ -660,8 +660,9 @@ static u64 it6625_get_pclk(struct it6625 *it6625) static int it6625_read_edid(struct it6625 *it6625, u8 *edid, int start_blo= ck, int num_blocks) { - int i, bank_ctrl, err =3D 0; struct device *dev =3D it6625->dev; + unsigned int i, bank_ctrl; + int err =3D 0; =20 if (!edid) { dev_err(dev, "edid buffer is NULL"); @@ -699,8 +700,9 @@ static int it6625_read_edid(struct it6625 *it6625, u8 *= edid, int start_block, static int it6625_write_edid(struct it6625 *it6625, u8 *edid, int start_bl= ock, int num_blocks) { - int i, bank_ctrl, err =3D 0; struct device *dev =3D it6625->dev; + unsigned int i, bank_ctrl; + int err =3D 0; =20 if (start_block < 0 || num_blocks <=3D 0 || start_block > EDID_NUM_BLOCKS_MAX || --=20 2.34.1 From nobody Fri Sep 25 00:05:15 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4EF734B53ED; Fri, 18 Sep 2026 08:57:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789721842; cv=none; b=GMMFb0AUfYCKlqYtgFsagPkW2dcYYXjHFr2WEQg+OYl5X6g2nPz2kFb06k4Ulvh+Kngog2pxl/8imzmN2R5oS2qQ1GxwGUmshgdH8Y3quwFtz1QBDKY0LAD+/v+HSQ0Ujg6DnnfqvnYvDMc1tnG0LM1J+2z8akQRQIlDcHDdfbo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789721842; c=relaxed/simple; bh=sDKdo0gc8d3PWFyrq1e60uzS5EwrgXVgOmRd3Hu4Is4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=HhFoH3RP2cV5kBiR6PERNqOHfe+dVhdeaiEx63ihfsVTfnH73ltfp+Eb5UwqLpzHt6pmkdSMNYoDgkYruBdteALVayILFWV9b1cl8jGG7vekb0q6vBt/TuicXJc/ftrMLZ5Q+1mx64w/YT1IEgoOFTPe7Zb1gX0csE+0+10ySvo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=R+tf+sFS; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="R+tf+sFS" Received: by smtp.kernel.org (Postfix) with ESMTPS id 78929C2BD04; Fri, 18 Sep 2026 08:57:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1789721840; bh=sDKdo0gc8d3PWFyrq1e60uzS5EwrgXVgOmRd3Hu4Is4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=R+tf+sFS4MgOEKeXrM9giBwPijqCnuMMd0L2eD5FNeaJn9wnXMeAT0jgFZ7pfbvdS OZXwF0aCmOT+XDkm8awagHwaPZbkKPgtFDWtOeFqbqRn/OnWMR5XjOhNS2JH235oLQ bA4FfZbuY2afcfMd+BVVxeTKTjzMJSWj7S9xzIjLd2Q4mxW+g8k8BD29Flnz31WvOo kV56FIZcwL4riSrCxmgJDj7gXW1GH19OVA/RtwhGXOdRaYptZrkQrU1516BsudrWLS 9CfO5863WG755VF3dakw2CfQ5ZYSNccI7ZmjeqQHlNCNLSKJuDO00FH3vtlVxZsz3a i/j3DDTSWsZ8w== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 67502C982D7; Fri, 18 Sep 2026 08:57:20 +0000 (UTC) From: Hermes Wu via B4 Relay Date: Fri, 18 Sep 2026 16:57:27 +0800 Subject: [PATCH 12/21] media: i2c: it6625: use unaligned/units helpers to decode pixel clock Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260918-upstream-it6625-follow-up-patch-v1-12-78d72d7886a5@ite.com.tw> References: <20260918-upstream-it6625-follow-up-patch-v1-0-78d72d7886a5@ite.com.tw> In-Reply-To: <20260918-upstream-it6625-follow-up-patch-v1-0-78d72d7886a5@ite.com.tw> To: Hermes Wu , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: Sakari Ailus , linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Hermes Wu X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1789721837; l=1862; i=Hermes.wu@ite.com.tw; s=20241230; h=from:subject:message-id; bh=H0QyqjpTAO3GV8uttFyvo38sGjiEsMvEnhEatiqleXI=; b=Mo8ashIx3uYyizXNmTmibJAPfbVEq59ZfhdwnikKCJDCMEt1338wflUnpTmuYDOKDlH8xJesQ 6bStbsymNd7AkXvSryVXYa4jyA4bLL0jszO+DDh0uZZsBjSHtIIiYcd X-Developer-Key: i=Hermes.wu@ite.com.tw; a=ed25519; pk=qho5Dawp2WWj9CGyjtJ6/Y10xH8odjRdS6SXDaDAerU= X-Endpoint-Received: by B4 Relay for Hermes.wu@ite.com.tw/20241230 with auth_id=310 X-Original-From: Hermes Wu Reply-To: Hermes.wu@ite.com.tw From: Hermes Wu it6625_get_pclk() manually assembled a big-endian u32 from a 4-byte buffer with a shift-and-OR sequence, and multiplied by a bare 1000. Read the register range with sizeof(ck), decode it with get_unaligned_be32(), and use the KHZ_PER_MHZ constant. Add the linux/unaligned.h and linux/units.h includes these need. While touching this declaration block, reorder it per reverse fir-tree. Signed-off-by: Hermes Wu --- drivers/media/i2c/it6625.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/media/i2c/it6625.c b/drivers/media/i2c/it6625.c index 328bd99f27cf84722caa184302cddeb9c3e667fb..60c79a2277941621c7aa8318924= 4b706a5505d66 100644 --- a/drivers/media/i2c/it6625.c +++ b/drivers/media/i2c/it6625.c @@ -18,6 +18,8 @@ #include #include #include +#include +#include #include #include #include @@ -633,28 +635,22 @@ static int get_audio_sampling_rate(struct it6625 *it6= 625) =20 static u64 it6625_get_pclk(struct it6625 *it6625) { - u32 pclk; u8 ck[4]; + u32 pclk; int ret; =20 - ret =3D it6625_read_bytes(it6625, REG_VID_PCLK, ck, 4); + ret =3D it6625_read_bytes(it6625, REG_VID_PCLK, ck, sizeof(ck)); if (ret < 0) { dev_err(it6625->dev, "failed to read pixel clock"); return 0; } =20 - pclk =3D ck[0]; - pclk <<=3D 8; - pclk |=3D ck[1]; - pclk <<=3D 8; - pclk |=3D ck[2]; - pclk <<=3D 8; - pclk |=3D ck[3]; + pclk =3D get_unaligned_be32(ck); =20 v4l2_dbg(1, debug, &it6625->sd, "%s: pclk=3D%u (%08x)", __func__, pclk, pclk); =20 - return (u64)pclk * 1000; + return (u64)pclk * KHZ_PER_MHZ; } =20 static int it6625_read_edid(struct it6625 *it6625, u8 *edid, int start_blo= ck, --=20 2.34.1 From nobody Fri Sep 25 00:05:15 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 62DD92BE639; Fri, 18 Sep 2026 08:57:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789721842; cv=none; b=M31yky0BMZj1BfraGzFtWasq2h9RsVYcl7UDYpboH7Z4tWt9Kw2lcium+Wp9MjrA5QNpOxefF8lBpjhazA2IijV/FJOdpb/F9UotVy+8h14WtkldtSpdDEcXDkLU4j4G9WAEC/gxDBUR3jfSLaVCLu/Hc1VG+giiKYLFXU9XkHg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789721842; c=relaxed/simple; bh=aj1z0/G6jXLgEETHdXNHBJTQCPBkbQ/UaIkoWkrS7OY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=l7CBYQmQ5sNN+Irlwk4Vl50BgQISC5hV0f9QC9MNrD+Js7UcQaUiZVQU+BXFXMVtKia6q9CeJS8umRsA1nQaB0QiqK4JkQ35/zwR/Cz6/C/WdoC3dAFCVIjZxt6A7GHn3PF/KFUNuBYeU7L30itI/TRqHsga7W95YTvaDxvzLI4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=HM96EECV; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="HM96EECV" Received: by smtp.kernel.org (Postfix) with ESMTPS id 8A366C32786; Fri, 18 Sep 2026 08:57:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1789721840; bh=aj1z0/G6jXLgEETHdXNHBJTQCPBkbQ/UaIkoWkrS7OY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=HM96EECVr3C19+P1fQR3ul+C3XJy/ZQ6kwpZiFSIYiPOXMH2BiV/4v52zIU/MlGqY m2tO7alSOG/mLFvoWZaUKF1FS0mShFl7B/e7qJ1Y/IA3YzaOR/uYFiHvtwXfAcAd1Q cmtcTBAPO2ViwpO93Dlq9FSegE5/ei8I5pS1todr0GBiew2m9ZoMleeAkUloANzm8Q m1vFabZRdiykjwfTTpNPCc+oDtSnd1QdLZiO64QqoMLLGeYjoeR8PaJ9EG3b3SxtQO Ve1ZbhWNSuYZhjw9KfI5JjoxQV2jGSDJgfsnsqJG9Jnqiy4LNKIkNiQfcQdlnb5a6L lI9WSHiaEqXkA== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7A33BC982DA; Fri, 18 Sep 2026 08:57:20 +0000 (UTC) From: Hermes Wu via B4 Relay Date: Fri, 18 Sep 2026 16:57:28 +0800 Subject: [PATCH 13/21] media: i2c: it6625: decode detected timings via typed register structs Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260918-upstream-it6625-follow-up-patch-v1-13-78d72d7886a5@ite.com.tw> References: <20260918-upstream-it6625-follow-up-patch-v1-0-78d72d7886a5@ite.com.tw> In-Reply-To: <20260918-upstream-it6625-follow-up-patch-v1-0-78d72d7886a5@ite.com.tw> To: Hermes Wu , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: Sakari Ailus , linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Hermes Wu X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1789721837; l=3215; i=Hermes.wu@ite.com.tw; s=20241230; h=from:subject:message-id; bh=5lnagqXC/VlYNEww2tkf1miEftUj9bs+qaABWCI/ZBM=; b=js8dL98lj0eF87rsg4Ox0NbHv+OH1DnkMHuBlo5SQ5dpCVei1YBzBKorMGvoIJIT/S+96ltfd gblkX3Ic9UlC9psDnfVxfTlBNuTKW+aZquOpK0WNQ2/HjmUMVNYcOlO X-Developer-Key: i=Hermes.wu@ite.com.tw; a=ed25519; pk=qho5Dawp2WWj9CGyjtJ6/Y10xH8odjRdS6SXDaDAerU= X-Endpoint-Received: by B4 Relay for Hermes.wu@ite.com.tw/20241230 with auth_id=310 X-Original-From: Hermes Wu Reply-To: Hermes.wu@ite.com.tw From: Hermes Wu it6625_get_detected_timings() manually assembled each 16-bit field from raw byte-buffer offsets with a shift-and-add sequence. Define two local structs of __be16 fields matching the contiguous REG_H_ACTIVE_1.. REG_V_ACTIVE_0 and REG_H_FP_1..REG_V_BP_0 register layouts, read directly into them, and decode each field with be16_to_cpu(). Guard each struct's size with static_assert() against the expected register range width. Every member is 2 bytes wide and naturally aligned, so the struct is laid out with no padding -- this is safe because the struct is the I2C read target itself, not a cast over a pre-existing raw buffer. Signed-off-by: Hermes Wu --- drivers/media/i2c/it6625.c | 41 +++++++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/drivers/media/i2c/it6625.c b/drivers/media/i2c/it6625.c index 60c79a2277941621c7aa83189244b706a5505d66..90b87dbf54fcfc7ad2a1245d459= 4beee24a193ca 100644 --- a/drivers/media/i2c/it6625.c +++ b/drivers/media/i2c/it6625.c @@ -769,10 +769,22 @@ static int it6625_get_detected_timings(struct it6625 = *it6625, struct v4l2_dv_timings *timings) { struct v4l2_bt_timings *bt =3D &timings->bt; + struct { + __be16 h_active; + __be16 v_active; + } active; + struct { + __be16 hfrontporch; + __be16 hsync; + __be16 hbackporch; + __be16 vfrontporch; + __be16 vsync; + __be16 vbackporch; + } porch; int val; - unsigned int width, height; - u8 buffer[4]; - u8 buffer2[12]; + + static_assert(sizeof(active) =3D=3D 4); + static_assert(sizeof(porch) =3D=3D 12); =20 if (no_signal(it6625)) { dev_err(it6625->dev, "no signal detected"); @@ -792,24 +804,21 @@ static int it6625_get_detected_timings(struct it6625 = *it6625, bt->interlaced =3D val & B_INTERLACE ? V4L2_DV_INTERLACED : V4L2_DV_PROGRESSIVE; =20 - if (it6625_read_bytes(it6625, REG_H_ACTIVE_1, buffer, 4) < 0) + if (it6625_read_bytes(it6625, REG_H_ACTIVE_1, (u8 *)&active, sizeof(activ= e)) < 0) return -EIO; =20 - width =3D ((buffer[0] & 0xff) << 8) + buffer[1]; - height =3D ((buffer[2] & 0xff) << 8) + buffer[3]; - - bt->width =3D width; - bt->height =3D height; + bt->width =3D be16_to_cpu(active.h_active); + bt->height =3D be16_to_cpu(active.v_active); =20 - if (it6625_read_bytes(it6625, REG_H_FP_1, buffer2, 12) < 0) + if (it6625_read_bytes(it6625, REG_H_FP_1, (u8 *)&porch, sizeof(porch)) < = 0) return -EIO; =20 - bt->hfrontporch =3D ((buffer2[0] & 0xff) << 8) + buffer2[1]; - bt->hsync =3D ((buffer2[2] & 0xff) << 8) + buffer2[3]; - bt->hbackporch =3D ((buffer2[4] & 0xff) << 8) + buffer2[5]; - bt->vfrontporch =3D ((buffer2[6] & 0xff) << 8) + buffer2[7]; - bt->vsync =3D ((buffer2[8] & 0xff) << 8) + buffer2[9]; - bt->vbackporch =3D ((buffer2[10] & 0xff) << 8) + buffer2[11]; + bt->hfrontporch =3D be16_to_cpu(porch.hfrontporch); + bt->hsync =3D be16_to_cpu(porch.hsync); + bt->hbackporch =3D be16_to_cpu(porch.hbackporch); + bt->vfrontporch =3D be16_to_cpu(porch.vfrontporch); + bt->vsync =3D be16_to_cpu(porch.vsync); + bt->vbackporch =3D be16_to_cpu(porch.vbackporch); =20 bt->pixelclock =3D it6625_get_pclk(it6625); if (bt->interlaced =3D=3D V4L2_DV_INTERLACED) { --=20 2.34.1 From nobody Fri Sep 25 00:05:15 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D80624C10C7; Fri, 18 Sep 2026 08:57:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789721843; cv=none; b=tnzIr2GqSxSfG8M2/zvIPwTymH+HWeLJMY4ZTgUJuGZDARPmkHWhmHdiM5g/ZGVJE2Fz2P1AVYFkBGEZYS5C+bRlb6IhgJv4ZSVthh8w/8Gx5cbrcEYslIFNTnOx8cUXAsfueA5/MiQ9m6zRBelCnIVVvfejjEykPsdpKk87CAw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789721843; c=relaxed/simple; bh=bRrNigDJkW7AZBxFaHxWITPtWA2Rw/thAvAmAhyVF7o=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=FP4y/kp5YnIQAXc9S7m8SRdAV0HBnaEJduUqj0Q+RIE18Z8Kcru2rVxs/m9cb+XDnv3B3J1sCqsTPCbYL27kNOKKNttAH/tZu/gnnUp3mo2jdVLUKDKn7cnTizhvCGQv/Te491xL9VAjC7+uX/JaTrUifaEjHBmGvSlD7iiosHk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=UOO8Bdqf; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="UOO8Bdqf" Received: by smtp.kernel.org (Postfix) with ESMTPS id 9E69BC4AF0C; Fri, 18 Sep 2026 08:57:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1789721840; bh=bRrNigDJkW7AZBxFaHxWITPtWA2Rw/thAvAmAhyVF7o=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=UOO8BdqfHOGSnDnmAk7bl2jqttKyOo5yv0/UIrL63deETX4hjjkGs8Tnlp+9XIxnT zx30HBIeaHKPh2lez8dOfsWh48ht9h11X5y9nU2Jy9xxBSdAT9N1B3tdnztK5tqa+M DwyYcTttXu7Dc9fWAqRoNsiMnvzNoxxafxeR/af+IjpGE4fsfJPkUjcKNe0Whropba ffququtbTFxSAruJRn13q9DMUxZ5QZHjG4kihePI68yoW3zyNKPTzP7rfhN3xU3yih mP8Z9nXD1JlOKl3tgMjcJ4UKz+w3lQrTN7YAIKzJNEhyXCL5JvVig60Bw2uhLku2U+ lf0Nl+xAwC72A== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8C4E4C982D2; Fri, 18 Sep 2026 08:57:20 +0000 (UTC) From: Hermes Wu via B4 Relay Date: Fri, 18 Sep 2026 16:57:29 +0800 Subject: [PATCH 14/21] media: i2c: it6625: fix link-frequency reporting for one-/two-trio C-PHY Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260918-upstream-it6625-follow-up-patch-v1-14-78d72d7886a5@ite.com.tw> References: <20260918-upstream-it6625-follow-up-patch-v1-0-78d72d7886a5@ite.com.tw> In-Reply-To: <20260918-upstream-it6625-follow-up-patch-v1-0-78d72d7886a5@ite.com.tw> To: Hermes Wu , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: Sakari Ailus , linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Hermes Wu X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1789721837; l=2869; i=Hermes.wu@ite.com.tw; s=20241230; h=from:subject:message-id; bh=Glt5rCqFCDYbF0ZgrcqztJES4wgIaxcox5FrgQZ10+8=; b=73roMt8CkxBrRlrslmG5oZj7S7/jyD2u1BiYkgxfhE29Zt2lvBj1Cb2nQd2C9NhxT0nnieF9s tfvoeg1g4NtCzmNCepCs/kG40qR2/r3qE01b+4VZMFgep0TYyHZTY+a X-Developer-Key: i=Hermes.wu@ite.com.tw; a=ed25519; pk=qho5Dawp2WWj9CGyjtJ6/Y10xH8odjRdS6SXDaDAerU= X-Endpoint-Received: by B4 Relay for Hermes.wu@ite.com.tw/20241230 with auth_id=310 X-Original-From: Hermes Wu Reply-To: Hermes.wu@ite.com.tw From: Hermes Wu 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 =3D=3D V4L2_MBUS_CSI2_CPHY && csi_lanes =3D=3D 3; C-PHY is o= nly 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. Signed-off-by: Hermes Wu --- 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 90b87dbf54fcfc7ad2a1245d4594beee24a193ca..882eda8b836d655585ba45b0a33= d1c068bb3a8ee 100644 --- a/drivers/media/i2c/it6625.c +++ b/drivers/media/i2c/it6625.c @@ -317,11 +317,18 @@ struct it6625 { }; =20 /* - * 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[] =3D { +static const s64 it6625_link_freq_default[] =3D { 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[] =3D { 2500000000LL, }; =20 @@ -1850,6 +1857,8 @@ static int it6625_v4l2_init_controls(struct v4l2_subd= ev *sd) { struct it6625 *it6625 =3D sd_to_6625(sd); struct v4l2_ctrl_handler *hdl =3D &it6625->hdl; + bool cphy_3trio =3D it6625->bus_type =3D=3D V4L2_MBUS_CSI2_CPHY && + it6625->csi_lanes =3D=3D 3; =20 v4l2_ctrl_handler_init(hdl, 4); it6625->ctrl_5v_detect =3D @@ -1863,10 +1872,9 @@ static int it6625_v4l2_init_controls(struct v4l2_sub= dev *sd) it6625->ctrl_audio_present =3D v4l2_ctrl_new_custom(hdl, &it6625_ctrl_audio_present, NULL); it6625->ctrl_link_freq =3D - v4l2_ctrl_new_int_menu(hdl, NULL, V4L2_CID_LINK_FREQ, - ARRAY_SIZE(it6625_link_freq) - 1, - it6625->bus_type =3D=3D 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); --=20 2.34.1 From nobody Fri Sep 25 00:05:15 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6A5C34B66E7; Fri, 18 Sep 2026 08:57:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789721842; cv=none; b=uWNIxzv2JYhFvOEKxsl442FqIA2p8NdCpY5ROHG4QcKz4mSF+Ng6dHP/jwloeyvyvWvTEGvhNWfaGgEIWJaCofdHapVclZTMRvJ70lkGS1xXL985rFTQG5VfzLqMR7go6WoZdqWclErDHnSdfKQFeejzBG6QAwBbXdnnL53Gox0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789721842; c=relaxed/simple; bh=lKKBM0Z15+Cg7euZBnlCtVNRM9u1vWlpFXjUS8aHLVc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=rj4Xub/qWjLu55DPSYi7da6uiNQHAR/OKxCQ5UOcc/V1PgXR7YTAxlFETk4grM7m2wTNc0PCDjDiO0QJ5Q5VDAQwX5lS9xpIc9mzcK/+FrRPwjo58oSJ+25LjJS/8M2PdwSWwHHlyRstvI0kes7+hpwaQaD6T0HX7YZLnfpWxAQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=qIItvJXH; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="qIItvJXH" Received: by smtp.kernel.org (Postfix) with ESMTPS id AFEDCC4AF0D; Fri, 18 Sep 2026 08:57:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1789721840; bh=lKKBM0Z15+Cg7euZBnlCtVNRM9u1vWlpFXjUS8aHLVc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=qIItvJXH4xtvGSrsHpURfQ2k16/srqBTbWY7ZBQT6eoLnY4jqaLarf4OcUUkXhHeo THQCOmpddwnxdCbrAbju/SEUevACNtsT0hJKdtxXkp04Rt5N2LDVnDaOJsSxzFEJBV XPSxDX9iryfnVmeyJLlbQLnGqZuBycwFAmF6W/HzVsmA+a/f8o20DUGrEI8uxFWmGg nUCLSYXxraw07p2PXq7I8kY4P3ejIN3XBBNduKemtmrrGtnQYZ7dQKlFo2YjU1yWlo xYubegtVZGLVKVOU2exB0UnQzsfqnat+lSAh59GNwECgYFd1kSRrIoyT8VXB7484sc r2q2j8j1dA3xQ== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9FB66C982D9; Fri, 18 Sep 2026 08:57:20 +0000 (UTC) From: Hermes Wu via B4 Relay Date: Fri, 18 Sep 2026 16:57:30 +0800 Subject: [PATCH 15/21] media: i2c: it6625: use early returns in it6625_update_timings_if_changed() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260918-upstream-it6625-follow-up-patch-v1-15-78d72d7886a5@ite.com.tw> References: <20260918-upstream-it6625-follow-up-patch-v1-0-78d72d7886a5@ite.com.tw> In-Reply-To: <20260918-upstream-it6625-follow-up-patch-v1-0-78d72d7886a5@ite.com.tw> To: Hermes Wu , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: Sakari Ailus , linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Hermes Wu X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1789721837; l=1398; i=Hermes.wu@ite.com.tw; s=20241230; h=from:subject:message-id; bh=nhYLeOnWUfOr4p9kaFWjpJjBGZeXmu4xl/oIvvdqeOc=; b=pVtstrPUw4pFLakci5deW/zW81qVnHiqawNZYO6gByOeaIpB71m9q3FtnfSZy60RhvEFlEMfG kWtmxo6iHePDMlPA3aGscJHYw318ej/jcBQn1cJx6XgSJfcSljadHgO X-Developer-Key: i=Hermes.wu@ite.com.tw; a=ed25519; pk=qho5Dawp2WWj9CGyjtJ6/Y10xH8odjRdS6SXDaDAerU= X-Endpoint-Received: by B4 Relay for Hermes.wu@ite.com.tw/20241230 with auth_id=310 X-Original-From: Hermes Wu Reply-To: Hermes.wu@ite.com.tw From: Hermes Wu Convert the if/else if/else chain that only ever assigns a single ret value to early returns. guard(mutex)(...) is scoped to the whole function body, so an early return still unlocks correctly. Signed-off-by: Hermes Wu --- drivers/media/i2c/it6625.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/drivers/media/i2c/it6625.c b/drivers/media/i2c/it6625.c index 882eda8b836d655585ba45b0a33d1c068bb3a8ee..db962bc100cad9f4d71fa4156b1= 0ff5b4c952a7c 100644 --- a/drivers/media/i2c/it6625.c +++ b/drivers/media/i2c/it6625.c @@ -1431,20 +1431,17 @@ static int it6625_update_timings_if_changed(struct it6625 *it6625, const struct v4l2_dv_timings *timings) { - int ret; - guard(mutex)(&it6625->it6625_lock); - if (v4l2_match_dv_timings(&it6625->timings, timings, 0, false)) { - ret =3D 0; - } else if (!v4l2_valid_dv_timings(timings, it6625_get_timings_cap(it6625), - NULL, NULL)) { - ret =3D -ERANGE; - } else { - it6625->timings =3D *timings; - ret =3D 1; - } =20 - return ret; + if (v4l2_match_dv_timings(&it6625->timings, timings, 0, false)) + return 0; + + if (!v4l2_valid_dv_timings(timings, it6625_get_timings_cap(it6625), NULL,= NULL)) + return -ERANGE; + + it6625->timings =3D *timings; + + return 1; } =20 static int it6625_enum_dv_timings(struct v4l2_subdev *sd, --=20 2.34.1 From nobody Fri Sep 25 00:05:15 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6F3014BFE6F; Fri, 18 Sep 2026 08:57:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789721842; cv=none; b=iZ8esXSA1lDfoFEchy/eng3PV8IQ4KLOYSKg/WSZeKR/lON/IYBMwVFZqjSq2DRHcIw+sYSV+eF/m/aN3ubexxi4Dkkc/SiSHyVzAyibNiS4+jefCgK9utAiMbPIJ0i+nzLqaZXtU6URZ3G91mpfMMQnpCH4nlsULjL+jnRcki8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789721842; c=relaxed/simple; bh=s/ykreRJ0uCDvoPYZfLjy6AF1TwDdHCJ9gJuzoAi3o0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=cvpabsZaVKX10VpwgAAkU5GwgSN8G0a5CMosdNn8jE9/R6VCSJOx+FJEGTHsPX/pCD0qBL2l/AaTwBiiubLp7Om6TpCI+bfawG6+FUr4YxW/mQA0ywnLjlWCDW4cDrz28El1rVy5geDsp9MuUXQfEeeAa6dvWx3TrMSaKfzTV9U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=o+hQyT1t; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="o+hQyT1t" Received: by smtp.kernel.org (Postfix) with ESMTPS id C158CC4AF10; Fri, 18 Sep 2026 08:57:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1789721840; bh=s/ykreRJ0uCDvoPYZfLjy6AF1TwDdHCJ9gJuzoAi3o0=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=o+hQyT1tEVFwSwwljIVdvkWy51GiUfAozhQ9ZYe7yGheduoIZJQjlx9Uw2pRGnZfW aIbeSFG++M6c7bE6pU2osHkX3vqjBvNCT10+KgIK/vRNJGxzFKYVUVf7l3FuDCXlvX qPUJbC2LJhsZlFNHm6QUB0jKBeyHN8feCNiiYoh4dprei/OpRCPdHT+hSKPcb6aUcu 13PUNZqdueFov7n1wYQuKlwdpzCihA/Sszj4cLBQVFw018s5i2E25F6YlsEnYuggXe FwsiN9c1rhzNxUuK+gaOoNJzWcusQWuYcKF9Y23HbYje3M5/MXjwShV7tmDOT0fSYf UCWVX1Plx7E3g== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id B0BCEC982D7; Fri, 18 Sep 2026 08:57:20 +0000 (UTC) From: Hermes Wu via B4 Relay Date: Fri, 18 Sep 2026 16:57:31 +0800 Subject: [PATCH 16/21] media: i2c: it6625: drop the private CSI-format name table Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260918-upstream-it6625-follow-up-patch-v1-16-78d72d7886a5@ite.com.tw> References: <20260918-upstream-it6625-follow-up-patch-v1-0-78d72d7886a5@ite.com.tw> In-Reply-To: <20260918-upstream-it6625-follow-up-patch-v1-0-78d72d7886a5@ite.com.tw> To: Hermes Wu , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: Sakari Ailus , linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Hermes Wu X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1789721837; l=2207; i=Hermes.wu@ite.com.tw; s=20241230; h=from:subject:message-id; bh=1QBeLpweBexpuPT55/o9kOEnsNm6TzwXFO32asay3lk=; b=BKX++v2fjL4HLNPNzaWHrzbk5oo/WTl17NO45uq5t0yu3DmyL11IHTPGWrTYGcy0nnlCaOuJl 0huuaU3kuRmBx9yBQ5154lC6VyHEqIauCgHZbk1pTbtmATRwuKvanXz X-Developer-Key: i=Hermes.wu@ite.com.tw; a=ed25519; pk=qho5Dawp2WWj9CGyjtJ6/Y10xH8odjRdS6SXDaDAerU= X-Endpoint-Received: by B4 Relay for Hermes.wu@ite.com.tw/20241230 with auth_id=310 X-Original-From: Hermes Wu Reply-To: Hermes.wu@ite.com.tw From: Hermes Wu it6625_csi_format_name(), used only by it6625_log_status(), maintains a driver-local name table for a value V4L2 already exposes as a media-bus format code. No in-kernel helper converts MEDIA_BUS_FMT_* codes to printable names, so report the raw media-bus code as %#x instead. it6625_log_status() now snapshots it6625->mbus_fmt_code (the value actually used elsewhere as the driver's representation of the current format) under it6625_lock instead of the separate csi_format field. Signed-off-by: Hermes Wu --- drivers/media/i2c/it6625.c | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/drivers/media/i2c/it6625.c b/drivers/media/i2c/it6625.c index db962bc100cad9f4d71fa4156b10ff5b4c952a7c..4a54de2eb42bba7a6efc84c0b43= cad4d2465d3a7 100644 --- a/drivers/media/i2c/it6625.c +++ b/drivers/media/i2c/it6625.c @@ -1343,26 +1343,12 @@ static void it6625_polling_work(struct work_struct = *work) it6625_interrupt_handler(it6625); } =20 -static const char *it6625_csi_format_name(u8 csi_format) -{ - switch (csi_format) { - case CSI_YUV422_8b: - return "YUV422 8bit"; - case CSI_RGB888: - return "RGB888 8bit"; - case CSI_YUV444_8b: - return "YUV444 8bit"; - default: - return "unknown"; - } -} - static int it6625_log_status(struct v4l2_subdev *sd) { struct it6625 *it6625 =3D sd_to_6625(sd); struct v4l2_dv_timings timings, configured_timings; struct v4l2_bt_timings bt; - u8 csi_format; + u32 mbus_fmt_code; =20 if (it6625_get_detected_timings(it6625, &timings)) v4l2_info(sd, "No video detected"); @@ -1376,13 +1362,11 @@ static int it6625_log_status(struct v4l2_subdev *sd) =20 /* snapshot together so the reported pair was actually configured togethe= r */ scoped_guard(mutex, &it6625->it6625_lock) { - csi_format =3D it6625->csi_format; + mbus_fmt_code =3D it6625->mbus_fmt_code; bt =3D it6625->timings.bt; } =20 - v4l2_info(sd, "CSI format: %s @ %uHz", - it6625_csi_format_name(csi_format), - fps_from_bt_timings(&bt)); + v4l2_info(sd, "CSI format: %#x @ %uHz", mbus_fmt_code, fps_from_bt_timing= s(&bt)); =20 it6625_show_avi_infoframe(it6625); =20 --=20 2.34.1 From nobody Fri Sep 25 00:05:15 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7309C4BFE74; Fri, 18 Sep 2026 08:57:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789721842; cv=none; b=Pb67DSS9BN/7BRU6KMfUODMXBXZkp2RqZAueQ+NgT9TmH3Vs3uqaR0xpvlHYgchsdITzpc4KzMSQNw3dDlTUb/OhJBdQjc8TGEP7nIOZtF5E0llbt1VUCMFe0c0haWbMpeS2Vj2ytVzP6J8nKwjS5u3nQQ/rilbLrIqEey2Pl3Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789721842; c=relaxed/simple; bh=XBl1TJ9lfcPWfQpsaIEhlapcWUOhBvwDxZjR9rkh+70=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=cwRkuFUytUmvtLDL6LLlbycn/WS/DEOV6UtlEDflbQ/R4ZfXtlSsHIqH7XRqQ2m9VkQo2ttEXf3O91kVcLkHy4dVOABqTbfxw8kCJ0cFH20MG5sz8h7+r+h+0nAEXffEtyhcUvwAeb9EZEUm8gWXz8Eo6KpyfQODjdrajVDUeHw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=rBhNPAuv; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="rBhNPAuv" Received: by smtp.kernel.org (Postfix) with ESMTPS id D6279C32782; Fri, 18 Sep 2026 08:57:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1789721840; bh=XBl1TJ9lfcPWfQpsaIEhlapcWUOhBvwDxZjR9rkh+70=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=rBhNPAuvb+MjZr7Z6p2tZe+JFPilwem4CAZK8xez8eEzhOaeD/uPGGNOkP5XW0wXa vikpZO7ixRgNuZMWaD72fWTpCJK8rXXmvqibFxpIF90POC0nKIijHeN+PnElwVuPU+ p350SqC8ZNS0YJS47gQu+C9hHt4RsGpXPZHURvbYWSlDkYQdGZzl3K/fO9G9qZBfkK IE371J2IReUj+7SSTWT8qI1rjuKg987OqhoSklJnB9iTSznK5WSr2reJAgvXfWxHdf w2PtNgHnHqWmtf153GHQubToyOmcK3U6kAGfS6klRO56vmJE20KXjj1WOg5WKV7lSd L/pMITlya4XBg== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id C4BCEC982DC; Fri, 18 Sep 2026 08:57:20 +0000 (UTC) From: Hermes Wu via B4 Relay Date: Fri, 18 Sep 2026 16:57:32 +0800 Subject: [PATCH 17/21] media: i2c: it6625: require a DT endpoint and simplify endpoint parsing Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260918-upstream-it6625-follow-up-patch-v1-17-78d72d7886a5@ite.com.tw> References: <20260918-upstream-it6625-follow-up-patch-v1-0-78d72d7886a5@ite.com.tw> In-Reply-To: <20260918-upstream-it6625-follow-up-patch-v1-0-78d72d7886a5@ite.com.tw> To: Hermes Wu , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: Sakari Ailus , linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Hermes Wu X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1789721837; l=3504; i=Hermes.wu@ite.com.tw; s=20241230; h=from:subject:message-id; bh=MkgaFi0YkzZts+Nod07WKhmRFmBveGro/77MU+eqB+8=; b=55NHn9PbFvUfsc4RiYBDrjDl6wKwG8O7ronfw6KPa+uiUp4YyDfEJZPLQGg1HKKEwU0J9zGqP d0Y6bpO7SO4BmGBkRdBhVZZUKYuO2RhudMoaDeUarN/UAjvVe67XbZ5 X-Developer-Key: i=Hermes.wu@ite.com.tw; a=ed25519; pk=qho5Dawp2WWj9CGyjtJ6/Y10xH8odjRdS6SXDaDAerU= X-Endpoint-Received: by B4 Relay for Hermes.wu@ite.com.tw/20241230 with auth_id=310 X-Original-From: Hermes Wu Reply-To: Hermes.wu@ite.com.tw From: Hermes Wu it6625_init_data() preset csi_lanes/port_num/bus_type before DT parsing ran, and it6625_parse_endpoint() fell back to those hardcoded defaults whenever no CSI-2 endpoint node was found instead of failing. The binding requires port@0, so a missing endpoint should surface as a probe error, not silently apply a hardcoded D-PHY/4-lane configuration. Drop the presets from it6625_init_data() -- these values must come only from DT -- and delete the no-endpoint fallback entirely rather than reshaping it. This is safe: of_fwnode_handle(NULL) returns NULL, and v4l2_fwnode_endpoint_alloc_parse() -> __v4l2_fwnode_endpoint_parse() already returns -EPROBE_DEFER for a NULL fwnode before touching anything else, which is a strictly better result for the no-endpoint case than a driver-local -EINVAL. While here, consolidate the three -EINVAL return sites in it6625_parse_endpoint() through a single error-path label instead of repeating v4l2_fwnode_endpoint_free() at each one. Signed-off-by: Hermes Wu --- drivers/media/i2c/it6625.c | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/drivers/media/i2c/it6625.c b/drivers/media/i2c/it6625.c index 4a54de2eb42bba7a6efc84c0b43cad4d2465d3a7..5fa8441f073691425c64fbd2b4e= 537129a43a2b7 100644 --- a/drivers/media/i2c/it6625.c +++ b/drivers/media/i2c/it6625.c @@ -2050,9 +2050,6 @@ static void it6625_init_data(struct it6625 *it6625) static struct v4l2_dv_timings default_timing =3D V4L2_DV_BT_CEA_1920X1080P60; =20 - it6625->csi_lanes =3D 4; - it6625->port_num =3D 1; - it6625->bus_type =3D V4L2_MBUS_CSI2_DPHY; it6625->csi_format =3D it6625_formats[0].csi_format; it6625->mbus_fmt_code =3D it6625_formats[0].mbus_fmt_code; it6625->timings =3D default_timing; @@ -2098,13 +2095,6 @@ static int it6625_parse_endpoint(struct it6625 *it66= 25) of_node_put(port_ep); } =20 - if (!ep) { - it6625->port_num =3D 1; - dev_dbg(dev, "no CSI-2 endpoint node found, using default %u CSI lanes", - it6625->csi_lanes); - return 0; - } - ret =3D v4l2_fwnode_endpoint_alloc_parse(of_fwnode_handle(ep), &endpoint); of_node_put(ep); if (ret) { @@ -2116,15 +2106,15 @@ static int it6625_parse_endpoint(struct it6625 *it6= 625) endpoint.bus_type !=3D V4L2_MBUS_CSI2_CPHY) { dev_err(dev, "unsupported bus type %d, expected CSI-2 D-PHY or C-PHY", endpoint.bus_type); - v4l2_fwnode_endpoint_free(&endpoint); - return -EINVAL; + ret =3D -EINVAL; + goto out_free_endpoint; } =20 if (endpoint.bus_type =3D=3D V4L2_MBUS_CSI2_CPHY && it6625->chip_type !=3D IT6626_CHIP) { dev_err(dev, "IT6625 does not support C-PHY, only IT6626 does"); - v4l2_fwnode_endpoint_free(&endpoint); - return -EINVAL; + ret =3D -EINVAL; + goto out_free_endpoint; } =20 max_lanes =3D (endpoint.bus_type =3D=3D V4L2_MBUS_CSI2_CPHY) ? 3 : 4; @@ -2134,15 +2124,17 @@ static int it6625_parse_endpoint(struct it6625 *it6= 625) dev_err(dev, "invalid number of CSI data lanes: %u (max %u for this bus type)", endpoint.bus.mipi_csi2.num_data_lanes, max_lanes); - v4l2_fwnode_endpoint_free(&endpoint); - return -EINVAL; + ret =3D -EINVAL; + goto out_free_endpoint; } =20 it6625->csi_lanes =3D endpoint.bus.mipi_csi2.num_data_lanes; it6625->bus_type =3D endpoint.bus_type; + +out_free_endpoint: v4l2_fwnode_endpoint_free(&endpoint); =20 - return 0; + return ret; } =20 static int it6625_parse_dt(struct it6625 *it6625) --=20 2.34.1 From nobody Fri Sep 25 00:05:15 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EE30D4C10C9; Fri, 18 Sep 2026 08:57:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789721843; cv=none; b=gr1w4MErSpZVUnzF0Gv1V/BLhi/K9fZi8cILZHBEzfePUT5iS7EPCFjxPzX1B7MNVFQRobfzIv2cvWzKCNk9juVe9BWGLV2zgvF/6oNR41nn6jGNPPGxCFHw/2xAc/gypqC7JAwMB7FivkGton3UrcTB1V0ecHOouNabvJzpIss= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789721843; c=relaxed/simple; bh=Bc0LLD11JjIidOjB2jemSYaJf2kMPqvLY86w+5ZVT50=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=PtRy+8DUzfMZS8PkiXTVHaXyV5Lk6gTaXpmIqWNEt6amnWq3qhcp973UvfLDZDoeReOvwR6DGC6S2zB48NXE97/VcsMWgrJqZsY08zdVgSX0/QhMFxxVZ7nLRbD7f9eqz9kXJnw4MiLbjla+QSTBlDAvowZ42yaR8HYVdyfSaQM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=uR0y6I8b; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="uR0y6I8b" Received: by smtp.kernel.org (Postfix) with ESMTPS id E8ADEC4AF0F; Fri, 18 Sep 2026 08:57:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1789721841; bh=Bc0LLD11JjIidOjB2jemSYaJf2kMPqvLY86w+5ZVT50=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=uR0y6I8b900YbJKcaeARnjUKZPr8yUB+1QNK2qYh9AW4WgwxK2ZyfJ6lY2aRSB3vr wh6F3V2OGmrHhU1n+tres5jmKdX2xloXocLrzu09b+I373is1OR1sNkBlzAmTq1jqe SXNP9yOiQ8lPRR1Zt+bo457g3Sx6gAtdncz9BB74ecKV3EvFXmKenI2WpgWjhOrKNS gZ8uoGIDWtLSYeOaUCfo4PXoFLRY2s8HqKP90IE2eii5XWUI3Qs/xHOBC4oHaZUaMJ JtsjImDyO3qzmtZwrXQxa/SWKGPZqxSXOg/7mUdS3A0SDjPUxHc2KTIgbpJaMIiAbN iaaX63rYVCZTQ== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id D62E2C982DD; Fri, 18 Sep 2026 08:57:20 +0000 (UTC) From: Hermes Wu via B4 Relay Date: Fri, 18 Sep 2026 16:57:33 +0800 Subject: [PATCH 18/21] media: i2c: it6625: finish reverse fir-tree declaration order Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260918-upstream-it6625-follow-up-patch-v1-18-78d72d7886a5@ite.com.tw> References: <20260918-upstream-it6625-follow-up-patch-v1-0-78d72d7886a5@ite.com.tw> In-Reply-To: <20260918-upstream-it6625-follow-up-patch-v1-0-78d72d7886a5@ite.com.tw> To: Hermes Wu , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: Sakari Ailus , linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Hermes Wu X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1789721837; l=3134; i=Hermes.wu@ite.com.tw; s=20241230; h=from:subject:message-id; bh=h51JBSr7kq0MZnjjXG3L1mkawFYUPIXiUhBmbLr0E/o=; b=podvbG+0wVxXUVGMYWykB2mzzVWPLeh+WDGdKSww5lxBXsDfNiYc6xmlGX4Hyd/hTKGaRqAOb XM0MALxYUO6Apr/qjsoEs8sS6DuCsszfsbiV2HcQBRSzoNZ3BLFHq8y X-Developer-Key: i=Hermes.wu@ite.com.tw; a=ed25519; pk=qho5Dawp2WWj9CGyjtJ6/Y10xH8odjRdS6SXDaDAerU= X-Endpoint-Received: by B4 Relay for Hermes.wu@ite.com.tw/20241230 with auth_id=310 X-Original-From: Hermes Wu Reply-To: Hermes.wu@ite.com.tw From: Hermes Wu Reorder the remaining declarations that don't follow reverse fir-tree order (struct/pointer types before plain scalars): the five register accessor helpers it6625_read_byte()/write_byte()/set_bits()/ read_bytes()/write_bytes(), where a plain int was declared ahead of the struct device *dev pointer, and it6625_set_fmt()/it6625_s_edid(), where an initialized wider-type local was declared after a plain int. Swept the rest of the file for the same pattern; no other functions need it. Signed-off-by: Hermes Wu --- drivers/media/i2c/it6625.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/media/i2c/it6625.c b/drivers/media/i2c/it6625.c index 5fa8441f073691425c64fbd2b4e537129a43a2b7..40cd413e0ed49c118421ce3dec7= 7bb2df08cf042 100644 --- a/drivers/media/i2c/it6625.c +++ b/drivers/media/i2c/it6625.c @@ -433,9 +433,9 @@ static int it6625_regmap_i2c_init(struct i2c_client *cl= ient, =20 static int it6625_read_byte(struct it6625 *it6625, u8 reg) { + struct device *dev =3D it6625->dev; unsigned int val; int err; - struct device *dev =3D it6625->dev; =20 err =3D regmap_read(it6625->it6625_regmap, reg, &val); if (err < 0) { @@ -448,8 +448,8 @@ static int it6625_read_byte(struct it6625 *it6625, u8 r= eg) =20 static int it6625_write_byte(struct it6625 *it6625, u8 reg, u8 val) { - int err; struct device *dev =3D it6625->dev; + int err; =20 err =3D regmap_write(it6625->it6625_regmap, reg, val); if (err < 0) { @@ -462,8 +462,8 @@ static int it6625_write_byte(struct it6625 *it6625, u8 = reg, u8 val) =20 static int it6625_set_bits(struct it6625 *it6625, u8 reg, u8 mask, u8 val) { - int err; struct device *dev =3D it6625->dev; + int err; =20 err =3D regmap_update_bits(it6625->it6625_regmap, reg, mask, val); if (err < 0) { @@ -476,8 +476,8 @@ static int it6625_set_bits(struct it6625 *it6625, u8 re= g, u8 mask, u8 val) =20 static int it6625_read_bytes(struct it6625 *it6625, u8 reg, u8 *buf, int l= en) { - int err; struct device *dev =3D it6625->dev; + int err; =20 err =3D regmap_bulk_read(it6625->it6625_regmap, reg, buf, len); if (err < 0) { @@ -490,8 +490,8 @@ static int it6625_read_bytes(struct it6625 *it6625, u8 = reg, u8 *buf, int len) =20 static int it6625_write_bytes(struct it6625 *it6625, u8 reg, u8 *buf, int = len) { - int err; struct device *dev =3D it6625->dev; + int err; =20 err =3D regmap_bulk_write(it6625->it6625_regmap, reg, buf, len); if (err < 0) { @@ -1624,8 +1624,8 @@ static int it6625_set_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_format *format) { struct it6625 *it6625 =3D sd_to_6625(sd); - int ret; u32 mbus_fmt_code =3D format->format.code; + int ret; =20 ret =3D it6625_get_fmt(sd, sd_state, format); format->format.code =3D mbus_fmt_code; @@ -1705,8 +1705,8 @@ static int it6625_s_edid(struct v4l2_subdev *sd, struct v4l2_subdev_edid *edid) { struct it6625 *it6625 =3D sd_to_6625(sd); - int err; u16 parent_pa =3D CEC_PHYS_ADDR_INVALID; + int err; =20 if (edid->pad !=3D 0) { v4l2_err(sd, "invalid pad %d", edid->pad); --=20 2.34.1 From nobody Fri Sep 25 00:05:15 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D23234C10C6; Fri, 18 Sep 2026 08:57:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789721842; cv=none; b=QYZrJ9W6AF1IjsoB+WkU8Lv497NGNBjCTb/n9kTQ8a0nxU84RMhUC0ZayfVfCE4C0uZ8KzDGQiV+DacjBf4vsMOO38b4LeuIZntDSkjAh2qAJYB8yvhVdzHEEUSJRsY+VRTgQtdf03JciU9o3GgH0ugrPvBK0WTVVjUaVQWPudE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789721842; c=relaxed/simple; bh=zaiIsMVlR0L37K2L49j1FJTCGyIjXcVgMUBYYAGBYCo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Mk/MlLZ3x/r3cFt33SB7Q2D7ONqHShrgPkOq0xd1yfCjLEy3xgI7hgnu8HH2lzmDdc1Nrl9jts+yVJu3NHF13JenzCIgqYmlmqMBu7Pr9Gu1y+OU7znvbF9X0MdaOt6VLpD9iAUlA8eHAcEcaSoX6IiBFmjekPNbgyh6OwHd7Aw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=FlqHb+y8; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="FlqHb+y8" Received: by smtp.kernel.org (Postfix) with ESMTPS id 040F4C4AF0B; Fri, 18 Sep 2026 08:57:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1789721841; bh=zaiIsMVlR0L37K2L49j1FJTCGyIjXcVgMUBYYAGBYCo=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=FlqHb+y86tt3ASUPULshn9tM/kxRAEvElfZtQK7FxK6oxs6F7WrEVgCoitIcguZsE 0t4ETyArBRYYw6qhh70rpIXDT3Juuap2HsDYeauEqPIoYubb4SNxGoIYeZGhlW4Yjv qUmoGNSeaQGopsfn0tODlFUqCk+wCRZszr6QtG0Y/iCZqEXPyP5iE2BqctDZr4nkhf 5V14X0hO3hKb1wj4VUapPTYDH/jqU0njmeCaEHKPVG9YCjCciSDVZrvHcHy9AZ+Mnk hzI7ldox+/2GjCRG2srxwLqbd1tQ0SnRkrG6WM35crHVy58OpSQwiNuTfnW5bw16Zg NbLxIXTkSvIfg== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id E7CBBC982DA; Fri, 18 Sep 2026 08:57:20 +0000 (UTC) From: Hermes Wu via B4 Relay Date: Fri, 18 Sep 2026 16:57:34 +0800 Subject: [PATCH 19/21] media: i2c: it6625: fold subdev initialization into probe Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260918-upstream-it6625-follow-up-patch-v1-19-78d72d7886a5@ite.com.tw> References: <20260918-upstream-it6625-follow-up-patch-v1-0-78d72d7886a5@ite.com.tw> In-Reply-To: <20260918-upstream-it6625-follow-up-patch-v1-0-78d72d7886a5@ite.com.tw> To: Hermes Wu , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: Sakari Ailus , linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Hermes Wu X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1789721837; l=3426; i=Hermes.wu@ite.com.tw; s=20241230; h=from:subject:message-id; bh=ndWi/BQPjYEEQd8U3qZXPlkzWBPSSf2B88726aLj/Qs=; b=j6jfLXguBkYvIZdOU6sVBQl5aVQtz6Act2beWPPbvm68KwgwleULAe6UXFNwGHX5SxDUssOk9 4xPRxLU3jMZDud/a/peu9pvu+nGb/vt3dkrMR36dQZ2q5WnNiWCBMTP X-Developer-Key: i=Hermes.wu@ite.com.tw; a=ed25519; pk=qho5Dawp2WWj9CGyjtJ6/Y10xH8odjRdS6SXDaDAerU= X-Endpoint-Received: by B4 Relay for Hermes.wu@ite.com.tw/20241230 with auth_id=310 X-Original-From: Hermes Wu Reply-To: Hermes.wu@ite.com.tw From: Hermes Wu it6625_init_v4l2_subdev() split subdev/control-handler/media-entity initialization out of probe(), which made error handling harder to follow across the two functions and forced probe() to normalize every init_v4l2_subdev() failure to -ENOMEM regardless of the real error (e.g. a media_entity_pads_init() failure was reported to the caller as -ENOMEM instead of its actual code). Inline it into it6625_probe() so initialization and its unwind path are visible together, and propagate the real error from it6625_v4l2_init_controls() instead of replacing it. Cleanup behavior on each failure path is unchanged: it6625_v4l2_init_controls() already frees the control handler internally before returning an error, and a media_entity_pads_init() failure still frees it explicitly before unwinding, so neither path double-frees it through the later err_clean_hdl label. State finalization (v4l2_subdev_init_finalize()/cleanup()) is deliberately left for a follow-up change, to keep this a pure restructuring and keep the locking-model transition atomic on its own. Signed-off-by: Hermes Wu --- drivers/media/i2c/it6625.c | 46 +++++++++++++++++-------------------------= ---- 1 file changed, 17 insertions(+), 29 deletions(-) diff --git a/drivers/media/i2c/it6625.c b/drivers/media/i2c/it6625.c index 40cd413e0ed49c118421ce3dec77bb2df08cf042..ec6aaa878471ff210264a35e4aa= 66dfb1e63ed3b 100644 --- a/drivers/media/i2c/it6625.c +++ b/drivers/media/i2c/it6625.c @@ -2142,33 +2142,6 @@ static int it6625_parse_dt(struct it6625 *it6625) return it6625_parse_endpoint(it6625); } =20 -static int it6625_init_v4l2_subdev(struct it6625 *it6625) -{ - struct v4l2_subdev *sd =3D &it6625->sd; - int err; - - sd->dev =3D it6625->dev; - - v4l2_i2c_subdev_init(sd, it6625->i2c_client, &it6625_ops); - sd->internal_ops =3D &it6625_internal_ops; - sd->flags |=3D V4L2_SUBDEV_FL_HAS_DEVNODE | V4L2_SUBDEV_FL_HAS_EVENTS; - if (it6625_v4l2_init_controls(sd)) { - dev_err(it6625->dev, "Failed to initialize v4l2 controls"); - return -ENOMEM; - } - - it6625->pad.flags =3D MEDIA_PAD_FL_SOURCE; - sd->entity.function =3D MEDIA_ENT_F_CAM_SENSOR; - err =3D media_entity_pads_init(&sd->entity, 1, &it6625->pad); - if (err < 0) { - dev_err(it6625->dev, "%s %d err=3D%d", __func__, __LINE__, err); - v4l2_ctrl_handler_free(sd->ctrl_handler); - return err; - } - - return 0; -} - static int it6625_check_device(struct it6625 *it6625) { static const u8 chip_ids[][2] =3D { @@ -2254,9 +2227,24 @@ static int it6625_probe(struct i2c_client *client) } =20 sd =3D &it6625->sd; - err =3D it6625_init_v4l2_subdev(it6625); - if (err) + v4l2_i2c_subdev_init(sd, it6625->i2c_client, &it6625_ops); + sd->internal_ops =3D &it6625_internal_ops; + sd->flags |=3D V4L2_SUBDEV_FL_HAS_DEVNODE | V4L2_SUBDEV_FL_HAS_EVENTS; + + err =3D it6625_v4l2_init_controls(sd); + if (err) { + dev_err(it6625->dev, "failed to initialize v4l2 controls: %d", err); goto err_clean_work_queues; + } + + it6625->pad.flags =3D MEDIA_PAD_FL_SOURCE; + sd->entity.function =3D MEDIA_ENT_F_CAM_SENSOR; + err =3D media_entity_pads_init(&sd->entity, 1, &it6625->pad); + if (err < 0) { + dev_err(it6625->dev, "%s %d err=3D%d", __func__, __LINE__, err); + v4l2_ctrl_handler_free(sd->ctrl_handler); + goto err_clean_work_queues; + } =20 err =3D v4l2_ctrl_handler_setup(sd->ctrl_handler); if (err) --=20 2.34.1 From nobody Fri Sep 25 00:05:15 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6DC3F4B7A4B; Fri, 18 Sep 2026 08:57:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789721843; cv=none; b=YEFYFBb8ajdmpE20jQg2/iKbXJi/XrA7bXQH1KZCEJhA+IB4KJJ6fJraW7jodT3iIKMjVP8HuKEOSymmStafwf9Q35DyekuPLRIw62tNcmPCnxynK8risXANyGNoYuGSlPUCZFxW1t+8JBVk8/OGEJy/yD8f345Y78FBHnAIFy8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789721843; c=relaxed/simple; bh=jR0D4mAue1wzQk7uBeokK8acBS3B7Nsl6JYl7H5zEGI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=a5saBxpZruz5oO9uSrOtyj6esVhNCRwCYwZtodBpND25G/URWytM0CpTGE73M47ihSWGrtcwzpGzHGol6XA0oFYrlkfh9hiv+vAGZYvD5Lg1Kf2PNT+x7x7pb1UxJ4DdMwzbOr9IXSD5kyN4bIA1dtDfr3RDSl3zqIZmp0pDhGU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=bYnfwjop; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="bYnfwjop" Received: by smtp.kernel.org (Postfix) with ESMTPS id 19EEFC4AF09; Fri, 18 Sep 2026 08:57:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1789721841; bh=jR0D4mAue1wzQk7uBeokK8acBS3B7Nsl6JYl7H5zEGI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=bYnfwjopchWLvru++e0YnV3Pn6pNI+lpw2jEwX16+8SGhFCQN7TP8W7m7a0Hl313j sKXYx8Isa7RvbLcnO2Kx1TzbZYYsH/QRK26ACmMVOkJD4SiL06isJsN4pGWQXBSbrj wtLyuzGltbGX19Y9Pmz2DK1vF377VLNJ/bDNznUWeHWpZ6a3sMWdZZtnIjcT8/+kOx 89rqXzGsSDddrI21IiiuVmR/AGKPFz+frERkMYqCFARKdSIiW2omMIKGg6uHPFfzQ1 9Jrac5uuj0m1EjPlgw5h5IwajMpdw3C8ZVNq1FDgR1VDXRZVuf/damepX8KYF8Jw96 dOnS15XKGyfqg== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 088F4C982D7; Fri, 18 Sep 2026 08:57:21 +0000 (UTC) From: Hermes Wu via B4 Relay Date: Fri, 18 Sep 2026 16:57:35 +0800 Subject: [PATCH 20/21] media: i2c: it6625: use centrally managed active state Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260918-upstream-it6625-follow-up-patch-v1-20-78d72d7886a5@ite.com.tw> References: <20260918-upstream-it6625-follow-up-patch-v1-0-78d72d7886a5@ite.com.tw> In-Reply-To: <20260918-upstream-it6625-follow-up-patch-v1-0-78d72d7886a5@ite.com.tw> To: Hermes Wu , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: Sakari Ailus , linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Hermes Wu X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1789721837; l=17656; i=Hermes.wu@ite.com.tw; s=20241230; h=from:subject:message-id; bh=Od5HPgJWNyxL2zm0GyyKeYfcet7/wwxFCUyEQT7ygdI=; b=U9Cmn0qvvBsVpAgvc4As2lO7laWc4GfkWk8MdCMozf9qZFf3v9x8K+0rtOsXEZU9z9I1psOpM JBZaPxCmPjOD4QOj1lKIK5ivdZMARbSnKrzzvPhaB69GtiLNHN+iyKG X-Developer-Key: i=Hermes.wu@ite.com.tw; a=ed25519; pk=qho5Dawp2WWj9CGyjtJ6/Y10xH8odjRdS6SXDaDAerU= X-Endpoint-Received: by B4 Relay for Hermes.wu@ite.com.tw/20241230 with auth_id=310 X-Original-From: Hermes Wu Reply-To: Hermes.wu@ite.com.tw From: Hermes Wu Adopt the subdev active-state model instead of a private driver mutex and driver-local format fields: - Share it6625_lock as both sd->state_lock and sd->ctrl_handler->lock (set hdl->lock right after v4l2_ctrl_handler_init(), which resets it, and before any control is created), matching the documented model in Documentation/driver-api/media/v4l2-subdev.rst. Call v4l2_subdev_init_finalize() after media_entity_pads_init() and before any code that touches active state, always before v4l2_async_register_subdev(). - Remove csi_format/mbus_fmt_code from struct it6625 and store the complete format -- code, colorspace, and width/height/field derived from the configured DV timings -- in the pad format of each v4l2_subdev_state instead. it6625_set_fmt() now operates directly on the state the core hands it (already locked, and for ACTIVE already sd->active_state) instead of taking it6625_lock itself. it6625_get_fmt() is deleted; .get_fmt is now the core's v4l2_subdev_get_fmt(). it6625_init_state() seeds a state from the current active format when one exists (later TRY-state allocation) or from driver defaults when it doesn't (the very first, pre- assignment call that becomes the active state itself). - Keep it6625->timings as driver-private DV-timings state, but project its width/height/field onto the active pad format every time it changes (it6625_update_timings_if_changed(), it6625_clear_timings()) so VIDIOC_SUBDEV_G_FMT stays consistent with VIDIOC_SUBDEV_G_DV_TIMINGS. it6625_initial_setup() and it6625_log_status() now read the media-bus code from the locked active format instead of the removed fields. - Make ACTIVE .set_fmt() transactional: return -EBUSY while streaming, and commit the new code/colorspace to active state only after the MIPI register writes that implement it actually succeed. This requires it6625_enable_stream_locked(), it6625_enable_stream(), and it6625_set_mipi_config_locked() to return int and propagate the first register/config-update failure; all existing callers are updated. Every it6625_lock acquisition site was re-audited against the core's actual locking contract (which ioctls the core state-locks, what v4l2_ctrl_handler_init()/_free() and v4l2_subdev_cleanup() actually touch) to confirm none of the driver's own lock-taking helpers are reachable from a path where the core already holds it6625_lock, and that init/teardown ordering keeps hdl->lock valid whenever v4l2_ctrl_handler_free() runs. The full trace is recorded in it6625-follow-up-patch/patch19-lock-audit.md (not part of this commit) for review -- it is static analysis only, since no IT6625/IT6626 hardware is available here to exercise this with lockdep enabled. Signed-off-by: Hermes Wu --- drivers/media/i2c/it6625.c | 220 ++++++++++++++++++++++++++++-------------= ---- 1 file changed, 138 insertions(+), 82 deletions(-) diff --git a/drivers/media/i2c/it6625.c b/drivers/media/i2c/it6625.c index ec6aaa878471ff210264a35e4aa66dfb1e63ed3b..550eb95c6f74a81fc11cc055b45= 90159ac50e969 100644 --- a/drivers/media/i2c/it6625.c +++ b/drivers/media/i2c/it6625.c @@ -255,7 +255,15 @@ struct it6625 { struct regmap *it6625_regmap; enum it6625_chip_type chip_type; =20 - /* protects concurrent access to the chip's registers and state */ + /* + * Protects concurrent access to the chip's registers and state. + * Also shared as sd.state_lock and hdl.lock (see + * Documentation/driver-api/media/v4l2-subdev.rst), so the V4L2 + * core already holds it across .get_fmt/.set_fmt/.enable_streams/ + * .disable_streams and control updates -- callers reached only + * through those paths must use the *_locked() helpers instead of + * taking it again. + */ struct mutex it6625_lock; /* serializes the complete VIDIOC_S_EDID sequence against itself */ struct mutex edid_lock; @@ -291,8 +299,6 @@ struct it6625 { u8 csi_lanes; u8 port_num; enum v4l2_mbus_type bus_type; - u8 csi_format; - u32 mbus_fmt_code; /* number of EDID blocks currently loaded, protected by edid_lock */ u8 edid_blocks; =20 @@ -911,10 +917,11 @@ static int it6625_v4l2_sd_ctrl_update(struct v4l2_sub= dev *sd) return it6625_s_ctrl_audio_present(sd); } =20 -static void it6625_enable_stream_locked(struct it6625 *it6625, bool enable) +static int it6625_enable_stream_locked(struct it6625 *it6625, bool enable) { struct v4l2_subdev *sd =3D &it6625->sd; int val; + int err; =20 lockdep_assert_held(&it6625->it6625_lock); =20 @@ -922,27 +929,34 @@ static void it6625_enable_stream_locked(struct it6625= *it6625, bool enable) __func__, enable ? "en" : "dis"); =20 val =3D enable ? B_MIPI_OUTPUT : 0; - it6625_set_bits(it6625, REG_MIPI_CONTROL, B_MIPI_OUTPUT, val); - it6625_update_config(it6625); + err =3D it6625_set_bits(it6625, REG_MIPI_CONTROL, B_MIPI_OUTPUT, val); + if (err < 0) + return err; + + return it6625_update_config(it6625); } =20 -static void it6625_enable_stream(struct it6625 *it6625, bool enable) +static int it6625_enable_stream(struct it6625 *it6625, bool enable) { guard(mutex)(&it6625->it6625_lock); - it6625_enable_stream_locked(it6625, enable); + return it6625_enable_stream_locked(it6625, enable); } =20 -static void it6625_set_mipi_config_locked(struct it6625 *it6625, u32 cfg_v= al) +static int it6625_set_mipi_config_locked(struct it6625 *it6625, u32 cfg_va= l) { u8 mipi_data_type; + int err; =20 lockdep_assert_held(&it6625->it6625_lock); =20 dev_dbg(it6625->dev, "mipi_data_type =3D 0x%x", cfg_val); =20 mipi_data_type =3D cfg_val & 0xFF; - it6625_write_byte(it6625, REG_MIPI_DATA_TYPE, mipi_data_type); - it6625_update_config(it6625); + err =3D it6625_write_byte(it6625, REG_MIPI_DATA_TYPE, mipi_data_type); + if (err < 0) + return err; + + return it6625_update_config(it6625); } =20 static inline unsigned int fps_from_bt_timings(const struct v4l2_bt_timing= s *t) @@ -957,10 +971,18 @@ static inline unsigned int fps_from_bt_timings(const = struct v4l2_bt_timings *t) =20 static void it6625_initial_setup(struct it6625 *it6625) { + struct v4l2_subdev *sd =3D &it6625->sd; + struct v4l2_mbus_framefmt *fmt; + int idx; int val =3D 0; =20 guard(mutex)(&it6625->it6625_lock); =20 + fmt =3D v4l2_subdev_state_get_format(v4l2_subdev_get_locked_active_state(= sd), 0); + idx =3D it6625_csi_mbus_code_idx(fmt->code); + if (idx < 0) + idx =3D 0; + /* * REG_MIPI_CFG[0:2] lane count field: 1 lane -> 0, 2 lanes -> 1, * 3 lanes (C-PHY only) -> 3, 4 lanes (D-PHY only) -> 3. @@ -984,7 +1006,7 @@ static void it6625_initial_setup(struct it6625 *it6625) val |=3D FIELD_PREP(B_MIPI_SPLIT, 1); =20 it6625_write_byte(it6625, REG_MIPI_CFG, val); - it6625_write_byte(it6625, REG_MIPI_DATA_TYPE, it6625->csi_format); + it6625_write_byte(it6625, REG_MIPI_DATA_TYPE, it6625_formats[idx].csi_for= mat); it6625_write_byte(it6625, REG_MIPI_CONTROL, 0x00); it6625_write_byte(it6625, REG_RX_CFG, 0x00); =20 @@ -1140,10 +1162,29 @@ static void it6625_get_timings(struct it6625 *it662= 5, *timings =3D it6625->timings; } =20 +/* + * Project a DV-timings struct's width/height/field onto an active pad + * format. Caller must hold it6625_lock (=3D=3D the active state's lock). + */ +static void it6625_fill_timings_format(const struct v4l2_dv_timings *timin= gs, + struct v4l2_mbus_framefmt *fmt) +{ + fmt->width =3D timings->bt.width; + fmt->height =3D timings->bt.height; + fmt->field =3D timings->bt.interlaced =3D=3D V4L2_DV_INTERLACED ? + V4L2_FIELD_INTERLACED : V4L2_FIELD_NONE; +} + static void it6625_clear_timings(struct it6625 *it6625) { + struct v4l2_subdev *sd =3D &it6625->sd; + struct v4l2_mbus_framefmt *fmt; + guard(mutex)(&it6625->it6625_lock); memset(&it6625->timings, 0, sizeof(it6625->timings)); + + fmt =3D v4l2_subdev_state_get_format(v4l2_subdev_get_locked_active_state(= sd), 0); + it6625_fill_timings_format(&it6625->timings, fmt); } =20 static void it6625_irq_hdmi_5v_change(struct it6625 *it6625) @@ -1362,7 +1403,10 @@ static int it6625_log_status(struct v4l2_subdev *sd) =20 /* snapshot together so the reported pair was actually configured togethe= r */ scoped_guard(mutex, &it6625->it6625_lock) { - mbus_fmt_code =3D it6625->mbus_fmt_code; + struct v4l2_mbus_framefmt *fmt =3D + v4l2_subdev_state_get_format(v4l2_subdev_get_locked_active_state(sd), 0= ); + + mbus_fmt_code =3D fmt->code; bt =3D it6625->timings.bt; } =20 @@ -1415,6 +1459,9 @@ static int it6625_update_timings_if_changed(struct it6625 *it6625, const struct v4l2_dv_timings *timings) { + struct v4l2_subdev *sd =3D &it6625->sd; + struct v4l2_mbus_framefmt *fmt; + guard(mutex)(&it6625->it6625_lock); =20 if (v4l2_match_dv_timings(&it6625->timings, timings, 0, false)) @@ -1425,6 +1472,9 @@ it6625_update_timings_if_changed(struct it6625 *it662= 5, =20 it6625->timings =3D *timings; =20 + fmt =3D v4l2_subdev_state_get_format(v4l2_subdev_get_locked_active_state(= sd), 0); + it6625_fill_timings_format(&it6625->timings, fmt); + return 1; } =20 @@ -1457,8 +1507,7 @@ static int it6625_s_stream(struct v4l2_subdev *sd, in= t enable) { struct it6625 *it6625 =3D sd_to_6625(sd); =20 - it6625_enable_stream(it6625, enable); - return 0; + return it6625_enable_stream(it6625, enable); } =20 static int it6625_enum_mbus_code(struct v4l2_subdev *sd, @@ -1586,84 +1635,56 @@ static inline u32 format_to_colorspace(u8 csi_forma= t) } } =20 -static int it6625_get_fmt(struct v4l2_subdev *sd, - struct v4l2_subdev_state *sd_state, - struct v4l2_subdev_format *format) -{ - struct it6625 *it6625 =3D sd_to_6625(sd); - struct v4l2_dv_timings timings; - - if (format->pad !=3D 0) - return -EINVAL; - - it6625_get_timings(it6625, &timings); - format->format.width =3D timings.bt.width; - format->format.height =3D timings.bt.height; - format->format.field =3D timings.bt.interlaced =3D=3D V4L2_DV_INTERLACED ? - V4L2_FIELD_INTERLACED : V4L2_FIELD_NONE; - - if (format->which =3D=3D V4L2_SUBDEV_FORMAT_TRY) { - struct v4l2_mbus_framefmt *fmt; - - fmt =3D v4l2_subdev_state_get_format(sd_state, format->pad); - format->format.code =3D fmt->code; - format->format.colorspace =3D fmt->colorspace; - } else { - scoped_guard(mutex, &it6625->it6625_lock) { - format->format.colorspace =3D - format_to_colorspace(it6625->csi_format); - format->format.code =3D it6625->mbus_fmt_code; - } - } - - return 0; -} - static int it6625_set_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_state *sd_state, struct v4l2_subdev_format *format) { struct it6625 *it6625 =3D sd_to_6625(sd); - u32 mbus_fmt_code =3D format->format.code; + struct v4l2_mbus_framefmt *fmt; + u32 colorspace; + int idx; int ret; =20 - ret =3D it6625_get_fmt(sd, sd_state, format); - format->format.code =3D mbus_fmt_code; - - if (ret) - return ret; - - ret =3D it6625_csi_mbus_code_idx(mbus_fmt_code); + if (format->pad !=3D 0) + return -EINVAL; =20 - if (ret < 0) { + idx =3D it6625_csi_mbus_code_idx(format->format.code); + if (idx < 0) { v4l2_dbg(1, debug, sd, "%s: unsupported format code 0x%x, falling back to default", - __func__, mbus_fmt_code); - ret =3D 0; - mbus_fmt_code =3D it6625_formats[ret].mbus_fmt_code; - format->format.code =3D mbus_fmt_code; + __func__, format->format.code); + idx =3D 0; } =20 - if (format->which =3D=3D V4L2_SUBDEV_FORMAT_TRY) { - struct v4l2_mbus_framefmt *fmt; + colorspace =3D format_to_colorspace(it6625_formats[idx].csi_format); =20 - fmt =3D v4l2_subdev_state_get_format(sd_state, format->pad); - fmt->code =3D format->format.code; - fmt->colorspace =3D format_to_colorspace(it6625_formats[ret].csi_format); - format->format.colorspace =3D fmt->colorspace; + /* fmt already carries this state's width/height/field; leave them alone = */ + fmt =3D v4l2_subdev_state_get_format(sd_state, format->pad); + + if (format->which =3D=3D V4L2_SUBDEV_FORMAT_TRY) { + fmt->code =3D it6625_formats[idx].mbus_fmt_code; + fmt->colorspace =3D colorspace; + format->format =3D *fmt; v4l2_dbg(1, debug, sd, "%s: try format code =3D 0x%x", __func__, format->format.code); return 0; } =20 - scoped_guard(mutex, &it6625->it6625_lock) { - it6625->csi_format =3D it6625_formats[ret].csi_format; - it6625->mbus_fmt_code =3D format->format.code; - it6625_enable_stream_locked(it6625, false); - it6625_set_mipi_config_locked(it6625, it6625->csi_format); - } + if (v4l2_subdev_is_streaming(sd)) + return -EBUSY; =20 - format->format.colorspace =3D format_to_colorspace(it6625_formats[ret].cs= i_format); + ret =3D it6625_enable_stream_locked(it6625, false); + if (ret) + return ret; + + ret =3D it6625_set_mipi_config_locked(it6625, it6625_formats[idx].csi_for= mat); + if (ret) + return ret; + + /* commit to active state only after hardware programming succeeded */ + fmt->code =3D it6625_formats[idx].mbus_fmt_code; + fmt->colorspace =3D colorspace; + format->format =3D *fmt; =20 return 0; } @@ -1780,7 +1801,7 @@ static const struct v4l2_subdev_video_ops it6625_vide= o_ops =3D { static const struct v4l2_subdev_pad_ops it6625_pad_ops =3D { .enum_mbus_code =3D it6625_enum_mbus_code, .set_fmt =3D it6625_set_fmt, - .get_fmt =3D it6625_get_fmt, + .get_fmt =3D v4l2_subdev_get_fmt, .get_edid =3D it6625_g_edid, .set_edid =3D it6625_s_edid, .enum_dv_timings =3D it6625_enum_dv_timings, @@ -1800,8 +1821,26 @@ static const struct v4l2_subdev_ops it6625_ops =3D { static int it6625_init_state(struct v4l2_subdev *sd, struct v4l2_subdev_state *sd_state) { + struct it6625 *it6625 =3D sd_to_6625(sd); + struct v4l2_subdev_state *active =3D v4l2_subdev_get_locked_active_state(= sd); struct v4l2_mbus_framefmt *fmt =3D v4l2_subdev_state_get_format(sd_state,= 0); =20 + /* + * The very first call initializes what becomes sd->active_state + * itself, before it's assigned -- active is NULL then, and this + * state gets the driver's own defaults. Every later call (opening + * a new file handle) initializes a fresh TRY state while the + * active state already exists and is locked by the same mutex + * (state->lock is assigned before init_state() runs), so seed it + * from the current active format instead of reverting to boot + * defaults. + */ + if (active) { + *fmt =3D *v4l2_subdev_state_get_format(active, 0); + return 0; + } + + it6625_fill_timings_format(&it6625->timings, fmt); fmt->code =3D it6625_formats[0].mbus_fmt_code; fmt->colorspace =3D format_to_colorspace(it6625_formats[0].csi_format); =20 @@ -1842,6 +1881,8 @@ static int it6625_v4l2_init_controls(struct v4l2_subd= ev *sd) it6625->csi_lanes =3D=3D 3; =20 v4l2_ctrl_handler_init(hdl, 4); + hdl->lock =3D &it6625->it6625_lock; + it6625->ctrl_5v_detect =3D v4l2_ctrl_new_std(hdl, NULL, V4L2_CID_DV_RX_POWER_PRESENT, 0, 1, 0, 0); @@ -2050,8 +2091,6 @@ static void it6625_init_data(struct it6625 *it6625) static struct v4l2_dv_timings default_timing =3D V4L2_DV_BT_CEA_1920X1080P60; =20 - it6625->csi_format =3D it6625_formats[0].csi_format; - it6625->mbus_fmt_code =3D it6625_formats[0].mbus_fmt_code; it6625->timings =3D default_timing; /* firmware ships with a verified 2-block default EDID in EDID RAM */ it6625->edid_blocks =3D 2; @@ -2246,9 +2285,16 @@ static int it6625_probe(struct i2c_client *client) goto err_clean_work_queues; } =20 + sd->state_lock =3D &it6625->it6625_lock; + err =3D v4l2_subdev_init_finalize(sd); + if (err) { + dev_err(it6625->dev, "%s %d err=3D%d", __func__, __LINE__, err); + goto err_clean_hdl; + } + err =3D v4l2_ctrl_handler_setup(sd->ctrl_handler); if (err) - goto err_clean_hdl; + goto err_clean_state; =20 it6625->cec_adap =3D cec_allocate_adapter(&it6625_cec_adap_ops, it6625, dev_name(it6625->dev), @@ -2259,7 +2305,7 @@ static int it6625_probe(struct i2c_client *client) if (IS_ERR(it6625->cec_adap)) { err =3D PTR_ERR(it6625->cec_adap); dev_err(it6625->dev, "%s %d", __func__, __LINE__); - goto err_clean_hdl; + goto err_clean_state; } =20 err =3D cec_register_adapter(it6625->cec_adap, &client->dev); @@ -2267,7 +2313,7 @@ static int it6625_probe(struct i2c_client *client) dev_err(it6625->dev, "%s: failed to register the cec device", __func__); cec_delete_adapter(it6625->cec_adap); it6625->cec_adap =3D NULL; - goto err_clean_hdl; + goto err_clean_state; } =20 it6625_debugfs_init(it6625, client); @@ -2294,6 +2340,8 @@ static int it6625_probe(struct i2c_client *client) v4l2_debugfs_if_free(it6625->infoframes); debugfs_remove_recursive(it6625->debugfs_dir); cec_unregister_adapter(it6625->cec_adap); +err_clean_state: + v4l2_subdev_cleanup(sd); err_clean_hdl: media_entity_cleanup(&sd->entity); v4l2_ctrl_handler_free(&it6625->hdl); @@ -2330,12 +2378,20 @@ static void it6625_remove(struct i2c_client *client) =20 debugfs_remove_recursive(it6625->debugfs_dir); cec_unregister_adapter(it6625->cec_adap); + + /* + * v4l2_subdev_cleanup()/v4l2_ctrl_handler_free() take it6625_lock + * (shared as state_lock/hdl.lock), so they must run before it's + * destroyed. + */ + v4l2_subdev_cleanup(sd); + media_entity_cleanup(&sd->entity); + v4l2_ctrl_handler_free(&it6625->hdl); + mutex_destroy(&it6625->it6625_lock); mutex_destroy(&it6625->edid_lock); mutex_destroy(&it6625->if_read_lock); mutex_destroy(&it6625->if_state_lock); - media_entity_cleanup(&sd->entity); - v4l2_ctrl_handler_free(&it6625->hdl); } =20 static const struct i2c_device_id it6625_id[] =3D { --=20 2.34.1 From nobody Fri Sep 25 00:05:15 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 68A2B4B1D19; Fri, 18 Sep 2026 08:57:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789721842; cv=none; b=XdtfCMZ5+9xDvnRYEvEP2mt5wy698AF3+0UFDTxv7tLFzbFvp/4OPrsFe+DKzm4HLPyYyyls+o+DmVl2NMLvu92lmbEjz6DY25BmqvJ0gYfRtgBeqpkottSL7dMG2PHmhGK+TDiwoD3QEcNJk8VhucgjN54cv/yNoXnLwJqwG0k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789721842; c=relaxed/simple; bh=YpzryN/jqffQtkoAJf0qlEIxY6wpQ4aEFwp/t0r701U=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=P7r6AscdQFLwzOdN7EEJZGrRaKMg8b2q87Q+eOpzDB4NQC1dXvPG9QRxUFAPYT2bKYJbdnJaDiY9QSSv4CIVBZCmJarHtRMedAh5IL1OlcDVxSSmYZu11q9jv8X+q1UAOBtiXepfzJm293m3HvLBtjK4vRD9Ns+VKKiJZUzQbTo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=PPvPGNyU; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="PPvPGNyU" Received: by smtp.kernel.org (Postfix) with ESMTPS id 2A670C4AF11; Fri, 18 Sep 2026 08:57:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1789721841; bh=YpzryN/jqffQtkoAJf0qlEIxY6wpQ4aEFwp/t0r701U=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=PPvPGNyULxOqMMPnE6yvOeXnyKggWMg7EMOY9crTCITikYZCYFSW7tleyhgx7xLuX bCsShiKPl99vkOBrJSLetAEczaTD5Re2SGdo2t+p0kYvmQ13D9Dcmbb9LgbdsYNgJ6 IAuLgmLXDS7XdlwR1wdGWJ0L2MCwzh/rMC19y7BYri2znpPFKpxH5M0jDMtJuOZIxO NGdFtNVvEzqBfb+u3ZxhJZJqf3TnslRHB9qS2zD6PYAEDx2BswN8mC+ADUUxtpEeb8 YrnZzS0f58k+iI7v9Es7PKBu6+fVnRx0qjG/dxK1he3U0zrVUwnFfrTbOlmwyQoJMh 0okSd098FP5Qg== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1B615C982DA; Fri, 18 Sep 2026 08:57:21 +0000 (UTC) From: Hermes Wu via B4 Relay Date: Fri, 18 Sep 2026 16:57:36 +0800 Subject: [PATCH 21/21] media: i2c: it6625: use enable_streams and disable_streams Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260918-upstream-it6625-follow-up-patch-v1-21-78d72d7886a5@ite.com.tw> References: <20260918-upstream-it6625-follow-up-patch-v1-0-78d72d7886a5@ite.com.tw> In-Reply-To: <20260918-upstream-it6625-follow-up-patch-v1-0-78d72d7886a5@ite.com.tw> To: Hermes Wu , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: Sakari Ailus , linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Hermes Wu X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1789721837; l=3281; i=Hermes.wu@ite.com.tw; s=20241230; h=from:subject:message-id; bh=PmFwvFAlIGe8S5KkdJ/0dJSm3Ai5OjykPBxjocuRLS8=; b=pzg0mXTeiUoizaAnBVMTecVitw6D/qbWMbgqWu7RkNbG+vrol9O4e0pUXFH4uag8CLYkMdXvT K27Qx+tvexPAVVABJ4Z5YxusCgmv5j4VfLMGKwesNZacVpQyMQYErWL X-Developer-Key: i=Hermes.wu@ite.com.tw; a=ed25519; pk=qho5Dawp2WWj9CGyjtJ6/Y10xH8odjRdS6SXDaDAerU= X-Endpoint-Received: by B4 Relay for Hermes.wu@ite.com.tw/20241230 with auth_id=310 X-Original-From: Hermes Wu Reply-To: Hermes.wu@ite.com.tw From: Hermes Wu The .s_stream video op is deprecated; add .enable_streams()/ .disable_streams() pad ops instead and keep v4l2_subdev_s_stream_helper for legacy .s_stream callers, matching the same-device-class precedent in lt6911uxe.c. it6625_enable_streams()/it6625_disable_streams() call it6625_enable_stream_locked() directly rather than the removed lock-taking it6625_enable_stream() wrapper: v4l2_subdev_enable_streams()/ disable_streams() already lock the active state -- and hence it6625_lock, shared as sd->state_lock since the previous change -- before calling into these ops. Do not set V4L2_SUBDEV_FL_STREAMS: this device has a single, non-multiplexed source pad, so the core's implicit stream 0 is sufficient and v4l2_subdev_s_stream_helper() already handles that case without it. Error handling is unchanged from the locked helper these ops now call directly, so streaming failures are reported to the core instead of being silently absorbed. Signed-off-by: Hermes Wu --- drivers/media/i2c/it6625.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/drivers/media/i2c/it6625.c b/drivers/media/i2c/it6625.c index 550eb95c6f74a81fc11cc055b4590159ac50e969..680f27a4587eccfb863bb091c1d= ede290e57e909 100644 --- a/drivers/media/i2c/it6625.c +++ b/drivers/media/i2c/it6625.c @@ -936,12 +936,6 @@ static int it6625_enable_stream_locked(struct it6625 *= it6625, bool enable) return it6625_update_config(it6625); } =20 -static int it6625_enable_stream(struct it6625 *it6625, bool enable) -{ - guard(mutex)(&it6625->it6625_lock); - return it6625_enable_stream_locked(it6625, enable); -} - static int it6625_set_mipi_config_locked(struct it6625 *it6625, u32 cfg_va= l) { u8 mipi_data_type; @@ -1503,11 +1497,22 @@ static int it6625_dv_timings_cap(struct v4l2_subdev= *sd, return 0; } =20 -static int it6625_s_stream(struct v4l2_subdev *sd, int enable) +static int it6625_enable_streams(struct v4l2_subdev *sd, + struct v4l2_subdev_state *state, + u32 pad, u64 streams_mask) +{ + struct it6625 *it6625 =3D sd_to_6625(sd); + + return it6625_enable_stream_locked(it6625, true); +} + +static int it6625_disable_streams(struct v4l2_subdev *sd, + struct v4l2_subdev_state *state, + u32 pad, u64 streams_mask) { struct it6625 *it6625 =3D sd_to_6625(sd); =20 - return it6625_enable_stream(it6625, enable); + return it6625_enable_stream_locked(it6625, false); } =20 static int it6625_enum_mbus_code(struct v4l2_subdev *sd, @@ -1795,7 +1800,7 @@ static const struct v4l2_subdev_core_ops it6625_core_= ops =3D { =20 static const struct v4l2_subdev_video_ops it6625_video_ops =3D { .g_input_status =3D it6625_g_input_status, - .s_stream =3D it6625_s_stream, + .s_stream =3D v4l2_subdev_s_stream_helper, }; =20 static const struct v4l2_subdev_pad_ops it6625_pad_ops =3D { @@ -1810,6 +1815,8 @@ static const struct v4l2_subdev_pad_ops it6625_pad_op= s =3D { .s_dv_timings =3D it6625_pad_s_dv_timings, .g_dv_timings =3D it6625_pad_g_dv_timings, .query_dv_timings =3D it6625_pad_query_dv_timings, + .enable_streams =3D it6625_enable_streams, + .disable_streams =3D it6625_disable_streams, }; =20 static const struct v4l2_subdev_ops it6625_ops =3D { --=20 2.34.1