From patchwork Mon Jul 31 13:24:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 93656 X-Patchwork-Delegate: sakari.ailus@iki.fi Received: from vger.kernel.org ([23.128.96.18]) by www.linuxtv.org with esmtp (Exim 4.92) (envelope-from ) id 1qQStv-007u9E-81; Mon, 31 Jul 2023 13:25:31 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232007AbjGaNZ2 (ORCPT + 1 other); Mon, 31 Jul 2023 09:25:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230256AbjGaNZ1 (ORCPT ); Mon, 31 Jul 2023 09:25:27 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA43210F2; Mon, 31 Jul 2023 06:25:24 -0700 (PDT) Received: from [127.0.1.1] (91-154-35-171.elisa-laajakaista.fi [91.154.35.171]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 81B99E79; Mon, 31 Jul 2023 15:24:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1690809861; bh=CWOBqaJNAdPeoqe+d1O2pTibjSWEKIHUROFn5FDzjlc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=uj97Fj0AquY7+dycLBMnUIAsyW/KYOWHfetX+nhMWQVVVcsfbjN+6DcJzGpv/+EF3 dss5/WoW6JJLi7Iu8oeX7pcMEMRJT3hWwi8XYNUqNdpCD7gRMnPOrs1glp9f5sq0qP IIi2DT00KTxCg5Q0AOK2Xe81Vm0mxg/cXphVGH30= From: Tomi Valkeinen Date: Mon, 31 Jul 2023 16:24:35 +0300 Subject: [PATCH v3 1/9] media: i2c: ds90ub9x3: Fix sub-device matching MIME-Version: 1.0 Message-Id: <20230731-fpdlink-additions-v3-1-8acfc49c215a@ideasonboard.com> References: <20230731-fpdlink-additions-v3-0-8acfc49c215a@ideasonboard.com> In-Reply-To: <20230731-fpdlink-additions-v3-0-8acfc49c215a@ideasonboard.com> To: Mauro Carvalho Chehab , Luca Ceresoli , Andy Shevchenko , Laurent Pinchart , Sakari Ailus , Hans Verkuil , Satish Nagireddy , Matti Vaittinen Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Tomi Valkeinen X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=2787; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=CWOBqaJNAdPeoqe+d1O2pTibjSWEKIHUROFn5FDzjlc=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBkx7Y+TUX873kNfc2kqlxacUFaCJCdj0rl0gcBx +XPewlcZkuJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZMe2PgAKCRD6PaqMvJYe 9XmdD/4505K8ecg5yJrvfd8RMFYwdHnvVGDzcBoWm3hXxKtBSZpBYAx5oSEh6AqAUFiq0NDWClh K52xiBqaZaQpUEiNazezljNI/sGcuezkaPPG449gesylTdCv/soXgLBW5POM3bj017D1lyzdLk8 X33fy1Z7j/fVqYntfHwtcV26IulJlo4n9HeOc5i/8RmlBdqX7oK0Voy+3KuAmJ22qmcaV0AlS03 o1XBlULGtvMxARv092nyHLIiduYyQUocQbfrqIrOLYslan5Us9ofmJMKt+q3IDTh3Yr6bG5/hXT xkR5AOI/sUQVd/IdwtvKZZis6YVbi9zeqqvwdyT9nihll5rUZfX2yTyOxYuOQPf2l2KLFjNG9QU dlg65B8UyknkzlU7/YDOh+j6raHl/acxJEihh17T3upXuGGd8xc746NQOSYTAwvSsoMuv61XJZx VT1bN4+0OTOIXIV6nypyAmPmDu3eGpG/obMUZJR0BLKKDVm16uSeSB+ldnUTp2VBh3LmGeIs4Gt P/Hq1j5OpLaXnciQQ8JV4n/xf4wDP8r4EkeE+I8ArYj6cx6f5EaMTfjwmoVX9XpD16fGQTliqGE eeYiBLjq6fFcZ9H+pjac5yHblinte7WJxqQQ64IfyzKkpN4t4j9P5Ipzqeg+q7SqXVpd/+pSkhp 7LFOfw0d6rSSZqQ== X-Developer-Key: i=tomi.valkeinen@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-LSpam-Score: -2.5 (--) X-LSpam-Report: No, score=-2.5 required=5.0 tests=BAYES_00=-1.9,DKIM_SIGNED=0.1,DKIM_VALID=-0.1,DKIM_VALID_AU=-0.1,HEADER_FROM_DIFFERENT_DOMAINS=0.5,MAILING_LIST_MULTI=-1,RCVD_IN_DNSWL_NONE=-0.0001 autolearn=ham autolearn_force=no 1029939b3782 ("media: v4l: async: Simplify async sub-device fwnode matching") recently changed how async sub-device matching works. This breaks the UB9x3 drivers, as they set the subdev.fwnode to an endpoint. Afaiu, the fix is simply to not set subdev.fwnode at all. Fixes: 1029939b3782 ("media: v4l: async: Simplify async sub-device fwnode matching") Signed-off-by: Tomi Valkeinen Cc: Sakari Ailus --- drivers/media/i2c/ds90ub913.c | 14 +------------- drivers/media/i2c/ds90ub953.c | 13 +------------ 2 files changed, 2 insertions(+), 25 deletions(-) diff --git a/drivers/media/i2c/ds90ub913.c b/drivers/media/i2c/ds90ub913.c index 80d9cf6dd945..5410ccb54057 100644 --- a/drivers/media/i2c/ds90ub913.c +++ b/drivers/media/i2c/ds90ub913.c @@ -749,19 +749,9 @@ static int ub913_subdev_init(struct ub913_data *priv) if (ret) return dev_err_probe(dev, ret, "Failed to init pads\n"); - priv->sd.fwnode = fwnode_graph_get_endpoint_by_id(dev_fwnode(dev), - UB913_PAD_SOURCE, 0, - 0); - - if (!priv->sd.fwnode) { - ret = -ENODEV; - dev_err_probe(dev, ret, "Missing TX endpoint\n"); - goto err_entity_cleanup; - } - ret = v4l2_subdev_init_finalize(&priv->sd); if (ret) - goto err_fwnode_put; + goto err_entity_cleanup; ret = ub913_v4l2_notifier_register(priv); if (ret) { @@ -782,8 +772,6 @@ static int ub913_subdev_init(struct ub913_data *priv) ub913_v4l2_nf_unregister(priv); err_subdev_cleanup: v4l2_subdev_cleanup(&priv->sd); -err_fwnode_put: - fwnode_handle_put(priv->sd.fwnode); err_entity_cleanup: media_entity_cleanup(&priv->sd.entity); diff --git a/drivers/media/i2c/ds90ub953.c b/drivers/media/i2c/ds90ub953.c index cadf75eb0773..20b9cf893f74 100644 --- a/drivers/media/i2c/ds90ub953.c +++ b/drivers/media/i2c/ds90ub953.c @@ -1221,18 +1221,9 @@ static int ub953_subdev_init(struct ub953_data *priv) if (ret) return dev_err_probe(dev, ret, "Failed to init pads\n"); - priv->sd.fwnode = fwnode_graph_get_endpoint_by_id(dev_fwnode(dev), - UB953_PAD_SOURCE, 0, - 0); - if (!priv->sd.fwnode) { - ret = -ENODEV; - dev_err_probe(dev, ret, "Missing TX endpoint\n"); - goto err_entity_cleanup; - } - ret = v4l2_subdev_init_finalize(&priv->sd); if (ret) - goto err_fwnode_put; + goto err_entity_cleanup; ret = ub953_v4l2_notifier_register(priv); if (ret) { @@ -1253,8 +1244,6 @@ static int ub953_subdev_init(struct ub953_data *priv) ub953_v4l2_notifier_unregister(priv); err_free_state: v4l2_subdev_cleanup(&priv->sd); -err_fwnode_put: - fwnode_handle_put(priv->sd.fwnode); err_entity_cleanup: media_entity_cleanup(&priv->sd.entity); From patchwork Mon Jul 31 13:24:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 93657 X-Patchwork-Delegate: sakari.ailus@iki.fi Received: from vger.kernel.org ([23.128.96.18]) by www.linuxtv.org with esmtp (Exim 4.92) (envelope-from ) id 1qQStx-007u9E-PM; Mon, 31 Jul 2023 13:25:34 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232946AbjGaNZb (ORCPT + 1 other); Mon, 31 Jul 2023 09:25:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232136AbjGaNZ3 (ORCPT ); Mon, 31 Jul 2023 09:25:29 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8BCD210DF; Mon, 31 Jul 2023 06:25:28 -0700 (PDT) Received: from [127.0.1.1] (91-154-35-171.elisa-laajakaista.fi [91.154.35.171]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 6AA1512B1; Mon, 31 Jul 2023 15:24:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1690809862; bh=jk9Ujzd2lrsBddUBKSdxUek/7PziJpvcJYWomQe7MS8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=jAjqlB7t9qfFOc3nn888kZkpFWLALxNbScyhDNrnl+pTMpVq2glddNpFaV+8b5VjR q+GfLNjOrERjSCVzC3rMaAO93HhT9/ipq6/gzzzzas5SeR/pGuAbgqCvc9poHxCJpZ PpIRV3P+yoIsAHVqX5xrF1+uZQCPaKRHGLUpmiOE= From: Tomi Valkeinen Date: Mon, 31 Jul 2023 16:24:36 +0300 Subject: [PATCH v3 2/9] media: i2c: ds90ub960: Configure CSI-2 continuous clock MIME-Version: 1.0 Message-Id: <20230731-fpdlink-additions-v3-2-8acfc49c215a@ideasonboard.com> References: <20230731-fpdlink-additions-v3-0-8acfc49c215a@ideasonboard.com> In-Reply-To: <20230731-fpdlink-additions-v3-0-8acfc49c215a@ideasonboard.com> To: Mauro Carvalho Chehab , Luca Ceresoli , Andy Shevchenko , Laurent Pinchart , Sakari Ailus , Hans Verkuil , Satish Nagireddy , Matti Vaittinen Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Tomi Valkeinen , Andy Shevchenko X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=1670; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=jk9Ujzd2lrsBddUBKSdxUek/7PziJpvcJYWomQe7MS8=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBkx7Y+jWa/YwmVNqzpIhD3XZCrcIlqRcEy+cc54 Wnvg9w4sSyJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZMe2PgAKCRD6PaqMvJYe 9WyCD/951gROsLfMIsbSUx85DbnAM6Yzhpvo2j4XW8ddS67Fr8QHId1E7c3toNHr6FxrOdhCScK jGA7hRJpL4QrJtVDgv0MyJTZ7gg5anAAFjqWICsV+/aZg8UDSksOj0RxF2q+4DzolN5UQAG9XiQ 74fwRezwjaVtv0z4kx3vEdmQ94z8mvw2IGsJI44iy+Wnsx1vszZUU8khuTInQMpcEtYd5SUNM+P VLXAwVWaviXOcOsY1nvRaS8pW0HPUYPv2r5y/hBoRbHrdaO0/1UvvBbrxss+TZqK7jnm3VqG9Rj 88n9+HvSzMi5MEtL1v5xrUwDeyaf4+cTEYQSEKvQ4d478IDHhwVIJwBQHNB+7E0vBxf8M6MSZI8 /oV3tuRIlUgkgSLVA0KpdUEzeM9PoNwBp0H6eQHvy0DSdIkA0K5911D72EV051+48RJ/kVpnz5f iOdj1C28UZJ2qcXjwes/NcGeGJgsPREwgHL2421IucSWwYeQ/K5Uoc3yEi6L6fMTsUildoBgqBd C8TGf7j2uNf+szo/yMGCNlyQXGOTMEa8IdnrLKf08wJ0pRqZLDw/p8nU1XzTWwb3d5xGoy9NSwV A74ytl/yrHfMSdzrycKJY59LsjvtuubYJR9PXI8a7tYWLVNlQgNeHlgUytiRwUzrczVXZNIhoMc MrJPc9UNVeY0Nhw== X-Developer-Key: i=tomi.valkeinen@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-LSpam-Score: -2.5 (--) X-LSpam-Report: No, score=-2.5 required=5.0 tests=BAYES_00=-1.9,DKIM_SIGNED=0.1,DKIM_VALID=-0.1,DKIM_VALID_AU=-0.1,HEADER_FROM_DIFFERENT_DOMAINS=0.5,MAILING_LIST_MULTI=-1,RCVD_IN_DNSWL_NONE=-0.0001 autolearn=ham autolearn_force=no Use 'clock-noncontinuous' from DT to configure the continuous/non-continuous clock setting for the TX ports. Signed-off-by: Tomi Valkeinen Reviewed-by: Laurent Pinchart Reviewed-by: Andy Shevchenko --- drivers/media/i2c/ds90ub960.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/media/i2c/ds90ub960.c b/drivers/media/i2c/ds90ub960.c index 4833b39b9178..b840c9160bf2 100644 --- a/drivers/media/i2c/ds90ub960.c +++ b/drivers/media/i2c/ds90ub960.c @@ -149,6 +149,7 @@ #define UB960_TR_CSI_CTL 0x33 #define UB960_TR_CSI_CTL_CSI_CAL_EN BIT(6) +#define UB960_TR_CSI_CTL_CSI_CONTS_CLOCK BIT(1) #define UB960_TR_CSI_CTL_CSI_ENABLE BIT(0) #define UB960_TR_CSI_CTL2 0x34 @@ -485,6 +486,7 @@ struct ub960_txport { u8 nport; /* TX port number, and index in priv->txport[] */ u32 num_data_lanes; + bool non_continous_clk; }; struct ub960_data { @@ -1133,6 +1135,9 @@ static int ub960_parse_dt_txport(struct ub960_data *priv, goto err_free_txport; } + txport->non_continous_clk = vep.bus.mipi_csi2.flags & + V4L2_MBUS_CSI2_NONCONTINUOUS_CLOCK; + txport->num_data_lanes = vep.bus.mipi_csi2.num_data_lanes; if (vep.nr_of_link_frequencies != 1) { @@ -1744,6 +1749,9 @@ static void ub960_init_tx_port(struct ub960_data *priv, csi_ctl |= (4 - txport->num_data_lanes) << 4; + if (!txport->non_continous_clk) + csi_ctl |= UB960_TR_CSI_CTL_CSI_CONTS_CLOCK; + ub960_txport_write(priv, nport, UB960_TR_CSI_CTL, csi_ctl); } From patchwork Mon Jul 31 13:24:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 93658 X-Patchwork-Delegate: sakari.ailus@iki.fi Received: from vger.kernel.org ([23.128.96.18]) by www.linuxtv.org with esmtp (Exim 4.92) (envelope-from ) id 1qQSu1-007u9w-Go; Mon, 31 Jul 2023 13:25:37 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232970AbjGaNZf (ORCPT + 1 other); Mon, 31 Jul 2023 09:25:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59662 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232953AbjGaNZc (ORCPT ); Mon, 31 Jul 2023 09:25:32 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 019D610E3; Mon, 31 Jul 2023 06:25:28 -0700 (PDT) Received: from [127.0.1.1] (91-154-35-171.elisa-laajakaista.fi [91.154.35.171]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 59A2513FE; Mon, 31 Jul 2023 15:24:22 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1690809863; bh=UHTTCjc81txTyZ1stxkjLhTvtYVx+6QR6EF8xfykdnk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=T8CvZFQKm88z/unfOPwakpPYl7p6pDIhQhErpR/yXzKh3vz68yVvHBZFguVrcK0hD 5ZGHy2hJCHg8XNu5RUYvO0U0yHeNvt2P5udFrggmSY6pMmYqNMg9nqeFehA6+8d1rW xK2LRQkecVfVjePh8+9jMFGthje34b3D40F/SCl4= From: Tomi Valkeinen Date: Mon, 31 Jul 2023 16:24:37 +0300 Subject: [PATCH v3 3/9] media: i2c: ds90ub953: Use v4l2_fwnode_endpoint_parse() MIME-Version: 1.0 Message-Id: <20230731-fpdlink-additions-v3-3-8acfc49c215a@ideasonboard.com> References: <20230731-fpdlink-additions-v3-0-8acfc49c215a@ideasonboard.com> In-Reply-To: <20230731-fpdlink-additions-v3-0-8acfc49c215a@ideasonboard.com> To: Mauro Carvalho Chehab , Luca Ceresoli , Andy Shevchenko , Laurent Pinchart , Sakari Ailus , Hans Verkuil , Satish Nagireddy , Matti Vaittinen Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Tomi Valkeinen , Andy Shevchenko X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=2107; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=UHTTCjc81txTyZ1stxkjLhTvtYVx+6QR6EF8xfykdnk=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBkx7Y+nhD3vEsFAkA8qcaVl982kop0Y/k0ebnJ8 C0R/JYDBymJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZMe2PgAKCRD6PaqMvJYe 9aWiEACJy1CubZwmtO4AWG9sobMejlxlRAAbX6jt8y4nY0Qi7PbJSqFf8Cgb/D4vSjdEsXcHp89 S5QNgIPbhkXI5A51hkZGnLCxvf17qkp8lojXuIZKRxt0sXgesMDQ2B6eO7RgksMtHGNytxs5PJy B0NxAHSHEWVMlEuPIdpjIJ7mIKc9pJpzOJFc2mRY1ASrWa0lEXYGY65xgHyUgRGatWnExHtPb2V RNlPCzm+d70JdDqPdtJtkbWat8hk6/IE8VEMPJhk1wp6F0217CkoL9sn19eIQc3RS1kxDttQKkc hmiU1//uZHBtUbKqMeGamuZI0ukBaeGDGYpKZL+0rhv9KtdspCH00zuUoa/DGKGb5RmujHXSql4 6cEbgR4KK1NiTnUj8PUmaZprPjBipkk/2f01GvGgJGSaXdCVBPpdUyvaD12QKFnrPY3yPTevmM7 gIOLGu4Ue2GzciUNwyeLqI2TBsXi2uy03wVgn8JHyvdYu4Mll3gX76jRX83Ezf1k08LWDRTfnnV QKHkcwTH3HvplmGRbIgkRtw8WT5OXAKDWfMZwesJwd2L162DU3rnX+VGVNrdtGSWwiIE929SdE+ bElB/4Pf/IlSJ/UY6keRA+/3hHp/U+vV/l1id/32hLKOhCSmmEkCXVVq5oEPz4ABn62f01JBAHs 0aHxfFOx6D0S/CQ== X-Developer-Key: i=tomi.valkeinen@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-LSpam-Score: -2.5 (--) X-LSpam-Report: No, score=-2.5 required=5.0 tests=BAYES_00=-1.9,DKIM_SIGNED=0.1,DKIM_VALID=-0.1,DKIM_VALID_AU=-0.1,HEADER_FROM_DIFFERENT_DOMAINS=0.5,MAILING_LIST_MULTI=-1,RCVD_IN_DNSWL_NONE=-0.0001 autolearn=ham autolearn_force=no Use v4l2_fwnode_endpoint_parse() to parse the sink endpoint parameters. Signed-off-by: Tomi Valkeinen Reviewed-by: Laurent Pinchart Reviewed-by: Andy Shevchenko --- drivers/media/i2c/ds90ub953.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/media/i2c/ds90ub953.c b/drivers/media/i2c/ds90ub953.c index 20b9cf893f74..1032c8633809 100644 --- a/drivers/media/i2c/ds90ub953.c +++ b/drivers/media/i2c/ds90ub953.c @@ -25,6 +25,8 @@ #include #include #include +#include +#include #include #define UB953_PAD_SINK 0 @@ -1111,7 +1113,11 @@ static const struct regmap_config ub953_regmap_config = { static int ub953_parse_dt(struct ub953_data *priv) { struct device *dev = &priv->client->dev; + struct v4l2_fwnode_endpoint vep = { + .bus_type = V4L2_MBUS_CSI2_DPHY, + }; struct fwnode_handle *ep_fwnode; + unsigned char nlanes; int ret; ep_fwnode = fwnode_graph_get_endpoint_by_id(dev_fwnode(dev), @@ -1119,19 +1125,20 @@ static int ub953_parse_dt(struct ub953_data *priv) if (!ep_fwnode) return dev_err_probe(dev, -ENOENT, "no endpoint found\n"); - ret = fwnode_property_count_u32(ep_fwnode, "data-lanes"); + ret = v4l2_fwnode_endpoint_parse(ep_fwnode, &vep); fwnode_handle_put(ep_fwnode); - if (ret < 0) + if (ret) return dev_err_probe(dev, ret, - "failed to parse property 'data-lanes'\n"); + "failed to parse sink endpoint data\n"); - if (ret != 1 && ret != 2 && ret != 4) + nlanes = vep.bus.mipi_csi2.num_data_lanes; + if (nlanes != 1 && nlanes != 2 && nlanes != 4) return dev_err_probe(dev, -EINVAL, - "bad number of data-lanes: %d\n", ret); + "bad number of data-lanes: %u\n", nlanes); - priv->num_data_lanes = ret; + priv->num_data_lanes = nlanes; return 0; } From patchwork Mon Jul 31 13:24:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 93659 X-Patchwork-Delegate: sakari.ailus@iki.fi Received: from vger.kernel.org ([23.128.96.18]) by www.linuxtv.org with esmtp (Exim 4.92) (envelope-from ) id 1qQSu8-007uAG-MZ; Mon, 31 Jul 2023 13:25:45 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232983AbjGaNZm (ORCPT + 1 other); Mon, 31 Jul 2023 09:25:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232956AbjGaNZc (ORCPT ); Mon, 31 Jul 2023 09:25:32 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 982B610F0; Mon, 31 Jul 2023 06:25:30 -0700 (PDT) Received: from [127.0.1.1] (91-154-35-171.elisa-laajakaista.fi [91.154.35.171]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 4C6981536; Mon, 31 Jul 2023 15:24:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1690809864; bh=0yRsXxkV/lQOSYD48MHpa+oMNWDiUXYP+PtboMvfA0g=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=fpo+n3u2nDplkFqME14iiXcqzAeXE6WfnK/3FCUpz9XeLZWhhe8I0TNNGI2RzOpc4 pPuTWYm13aZ1jm2S5QD+bFt0F96sFeemisuJIb00di4ZMvG2IzDwjgEeDkdUMXYHOQ 7WW+OA3UcI1IVgyImGOpiCeCLcjy6afPiYMLhhcg= From: Tomi Valkeinen Date: Mon, 31 Jul 2023 16:24:38 +0300 Subject: [PATCH v3 4/9] media: i2c: ds90ub913: Use v4l2_fwnode_endpoint_parse() MIME-Version: 1.0 Message-Id: <20230731-fpdlink-additions-v3-4-8acfc49c215a@ideasonboard.com> References: <20230731-fpdlink-additions-v3-0-8acfc49c215a@ideasonboard.com> In-Reply-To: <20230731-fpdlink-additions-v3-0-8acfc49c215a@ideasonboard.com> To: Mauro Carvalho Chehab , Luca Ceresoli , Andy Shevchenko , Laurent Pinchart , Sakari Ailus , Hans Verkuil , Satish Nagireddy , Matti Vaittinen Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Tomi Valkeinen , Andy Shevchenko X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=2737; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=0yRsXxkV/lQOSYD48MHpa+oMNWDiUXYP+PtboMvfA0g=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBkx7Y/UkF+aCPnDnU61gZ5W+NDaI/oDWZ3ErtOe FxN+bJF0H6JAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZMe2PwAKCRD6PaqMvJYe 9R10EAClMto+yzFKFHic76uSK/9sKjxdUH7wt+8tedKLXTqQn6WNzQviFcM8LVJAycaBMk6LwZ5 q+520qzpIx4PagGAkHXLFvVXJwwxZdS6/BIoikAns+/3clcQSRclazteVWskCgPSIU1llUQK2Lf 2U0TDkVFzUM4rMyjpT6RXHMUF/DiIKsuuj4RKSPxDbRbozk0kcyPImaAaetMcGYAsGQ/cK7vDf6 54GJxmefhGY3te3ppxhDmjqrfAT4Cd9D9CfIiUHQ+8f9Cb7w6X2nVqkrXnQs7r5EmPfLF7BSjc6 VFL8NeZsVMwXrcTTtz3OLovT+zo5D1GLjqRDZk0liQMuxibYvjrv60GAHkla0qK3P3/rObi7aLz oZQCE12RMhtJ0rNNSdi2nYF1LmuwoYAE9ieLbbJ+PpVs9cu23SHnfXuiqOeX/AAKByfP6Gh/F+s pqfKZ+cNNvdLx1xm8Eoiwztp61m5OPmLFunC4NAA8BQ2y1l7uqi1uVnnbprZ50K1jdwyxe5Dsht nO1o9N0vON9en4g+yzTEygFNtvx4SFri4ORTWkCk05DUdyuyJP7UA9gRuWP1Jney1v0V2NHdVYB 0t4pyPOUJutMDH2rshGeNRWIoE1TEW60maQdLpZBq+NdYExuK/G58iY8ZjDaxMKVrlQrayQEalB mF3F96dTWAdav7A== X-Developer-Key: i=tomi.valkeinen@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-LSpam-Score: -2.5 (--) X-LSpam-Report: No, score=-2.5 required=5.0 tests=BAYES_00=-1.9,DKIM_SIGNED=0.1,DKIM_VALID=-0.1,DKIM_VALID_AU=-0.1,HEADER_FROM_DIFFERENT_DOMAINS=0.5,MAILING_LIST_MULTI=-1,RCVD_IN_DNSWL_NONE=-0.0001 autolearn=ham autolearn_force=no Use v4l2_fwnode_endpoint_parse() to parse the sink endpoint parameters. Signed-off-by: Tomi Valkeinen Reviewed-by: Laurent Pinchart Reviewed-by: Andy Shevchenko --- drivers/media/i2c/ds90ub913.c | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/drivers/media/i2c/ds90ub913.c b/drivers/media/i2c/ds90ub913.c index 5410ccb54057..85b664e33482 100644 --- a/drivers/media/i2c/ds90ub913.c +++ b/drivers/media/i2c/ds90ub913.c @@ -21,6 +21,8 @@ #include #include +#include +#include #include #define UB913_PAD_SINK 0 @@ -83,7 +85,7 @@ struct ub913_data { struct ds90ub9xx_platform_data *plat_data; - u32 pclk_polarity; + bool pclk_polarity_rising; }; static inline struct ub913_data *sd_to_ub913(struct v4l2_subdev *sd) @@ -675,25 +677,32 @@ static int ub913_add_i2c_adapter(struct ub913_data *priv) static int ub913_parse_dt(struct ub913_data *priv) { struct device *dev = &priv->client->dev; + struct v4l2_fwnode_endpoint vep = { + .bus_type = V4L2_MBUS_PARALLEL, + }; struct fwnode_handle *ep_fwnode; int ret; ep_fwnode = fwnode_graph_get_endpoint_by_id(dev_fwnode(dev), UB913_PAD_SINK, 0, 0); - if (!ep_fwnode) { - dev_err_probe(dev, -ENOENT, "No sink endpoint\n"); - return -ENOENT; - } + if (!ep_fwnode) + return dev_err_probe(dev, -ENOENT, "No sink endpoint\n"); - ret = fwnode_property_read_u32(ep_fwnode, "pclk-sample", - &priv->pclk_polarity); + ret = v4l2_fwnode_endpoint_parse(ep_fwnode, &vep); fwnode_handle_put(ep_fwnode); - if (ret) { - dev_err_probe(dev, ret, "failed to parse 'pclk-sample'\n"); - return ret; - } + if (ret) + return dev_err_probe(dev, ret, + "failed to parse sink endpoint data\n"); + + if (vep.bus.parallel.flags & V4L2_MBUS_PCLK_SAMPLE_RISING) + priv->pclk_polarity_rising = true; + else if (vep.bus.parallel.flags & V4L2_MBUS_PCLK_SAMPLE_FALLING) + priv->pclk_polarity_rising = false; + else + return dev_err_probe(dev, -EINVAL, + "bad value for 'pclk-sample'\n"); return 0; } @@ -726,7 +735,7 @@ static int ub913_hw_init(struct ub913_data *priv) ub913_read(priv, UB913_REG_GENERAL_CFG, &v); v &= ~UB913_REG_GENERAL_CFG_PCLK_RISING; - v |= priv->pclk_polarity ? UB913_REG_GENERAL_CFG_PCLK_RISING : 0; + v |= priv->pclk_polarity_rising ? UB913_REG_GENERAL_CFG_PCLK_RISING : 0; ub913_write(priv, UB913_REG_GENERAL_CFG, v); return 0; From patchwork Mon Jul 31 13:24:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 93660 X-Patchwork-Delegate: sakari.ailus@iki.fi Received: from vger.kernel.org ([23.128.96.18]) by www.linuxtv.org with esmtp (Exim 4.92) (envelope-from ) id 1qQSuC-007uAV-0r; Mon, 31 Jul 2023 13:25:48 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233016AbjGaNZp (ORCPT + 1 other); Mon, 31 Jul 2023 09:25:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232261AbjGaNZm (ORCPT ); Mon, 31 Jul 2023 09:25:42 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D55C11705; Mon, 31 Jul 2023 06:25:33 -0700 (PDT) Received: from [127.0.1.1] (91-154-35-171.elisa-laajakaista.fi [91.154.35.171]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 4410B161B; Mon, 31 Jul 2023 15:24:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1690809865; bh=7gviuas7ZdfyKY61RCEJgVKIgwoEQqbPhjAh+fvyoHg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=lnLKgyueyyt0wIeTtf7cyTLqbs5x3uD0tqI4wLgj3uJRzonup6lVL7U8Kgd7e/hmp VCrbocenR6LaBqVW/GcJuDWttdel/V56XcQQLb8llA4wqrajTFix6imyo3Q+T4xjrW lETmMk/sn+PsQ21M4JLzMK9E/kBzxsriAF8UczlU= From: Tomi Valkeinen Date: Mon, 31 Jul 2023 16:24:39 +0300 Subject: [PATCH v3 5/9] media: i2c: ds90ub953: Handle V4L2_MBUS_CSI2_NONCONTINUOUS_CLOCK MIME-Version: 1.0 Message-Id: <20230731-fpdlink-additions-v3-5-8acfc49c215a@ideasonboard.com> References: <20230731-fpdlink-additions-v3-0-8acfc49c215a@ideasonboard.com> In-Reply-To: <20230731-fpdlink-additions-v3-0-8acfc49c215a@ideasonboard.com> To: Mauro Carvalho Chehab , Luca Ceresoli , Andy Shevchenko , Laurent Pinchart , Sakari Ailus , Hans Verkuil , Satish Nagireddy , Matti Vaittinen Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Tomi Valkeinen , Andy Shevchenko X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=1447; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=7gviuas7ZdfyKY61RCEJgVKIgwoEQqbPhjAh+fvyoHg=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBkx7Y/2je2n13dRhzw0CZVjFF7LOM6jin5bGyXe 6/95HEULI6JAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZMe2PwAKCRD6PaqMvJYe 9Q2IEACoHYI6jATHmSR12nv53A+HOov/6c3yLoyjmtJcYhecyaxp0yIoR/d5c/jBWAusoebN8ky CrzKEb3Rj57bTQD1dbUodA4xIeEn3Qy/tJfKa9QpvqWEnpu8w1nxUfCRMI/DploxJrk7aEKusmZ t5PKlFJsX2/aCOKuK6u1BmB+UUD+6BshXr5FVYRxd79N2bUVnm2xeTpn+tsDrg2d3PwOPW2pNG1 tiWUzS1BNTstlj3vDXEGQJH5nJd/Yxl/RdYdSIMpUSX8cpVbybEf0WllH97DfEnZ1nrgquaiAkU wdFRhVq1Pp9p0FGeFKBNrANhcNxK/uBtgaT7uA7TriRNHvAw20HSiEAJTi2FSO074vAwHNPOpGp C/5cNXsC8YJ2fxZM85mhA1DvVSw2X2y4PoI6dodEGnnRAG2tzkpjqEmyUYosyIDcWCAff2Pejon XKDQlrqvLnExRCPPKKpJKJL1MPPr8GgFu8JVnQuWYDW8PgjoB5ybnTrsLmNoNhAWNFRHt7bWal+ ZN9cE72gSK5RDXm5Re9dR3ycr0jOLRHLvHu7hgtaOtOcobn7kpp2CJvdfcDjcM9ZIkZQvMLz2wd 9kvZvZna9cWy6VXsr6U7n+KqDv53fSYziCvDWT0OF4miDEp1MgPxveVOm3c2chM2WG3asJU9wts x8Y0x3PBoZFHUEg== X-Developer-Key: i=tomi.valkeinen@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-LSpam-Score: -2.5 (--) X-LSpam-Report: No, score=-2.5 required=5.0 tests=BAYES_00=-1.9,DKIM_SIGNED=0.1,DKIM_VALID=-0.1,DKIM_VALID_AU=-0.1,HEADER_FROM_DIFFERENT_DOMAINS=0.5,MAILING_LIST_MULTI=-1,RCVD_IN_DNSWL_NONE=-0.0001 autolearn=ham autolearn_force=no Handle V4L2_MBUS_CSI2_NONCONTINUOUS_CLOCK flag to configure the CSI-2 RX continuous/non-continuous clock register. Signed-off-by: Tomi Valkeinen Reviewed-by: Laurent Pinchart Reviewed-by: Andy Shevchenko --- drivers/media/i2c/ds90ub953.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/media/i2c/ds90ub953.c b/drivers/media/i2c/ds90ub953.c index 1032c8633809..eedbca986928 100644 --- a/drivers/media/i2c/ds90ub953.c +++ b/drivers/media/i2c/ds90ub953.c @@ -138,6 +138,7 @@ struct ub953_data { struct regmap *regmap; u32 num_data_lanes; + bool non_continous_clk; struct gpio_chip gpio_chip; @@ -1140,6 +1141,9 @@ static int ub953_parse_dt(struct ub953_data *priv) priv->num_data_lanes = nlanes; + priv->non_continous_clk = vep.bus.mipi_csi2.flags & + V4L2_MBUS_CSI2_NONCONTINUOUS_CLOCK; + return 0; } @@ -1202,7 +1206,7 @@ static int ub953_hw_init(struct ub953_data *priv) return dev_err_probe(dev, ret, "i2c init failed\n"); ub953_write(priv, UB953_REG_GENERAL_CFG, - UB953_REG_GENERAL_CFG_CONT_CLK | + (priv->non_continous_clk ? 0 : UB953_REG_GENERAL_CFG_CONT_CLK) | ((priv->num_data_lanes - 1) << UB953_REG_GENERAL_CFG_CSI_LANE_SEL_SHIFT) | UB953_REG_GENERAL_CFG_CRC_TX_GEN_ENABLE); From patchwork Mon Jul 31 13:24:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 93661 X-Patchwork-Delegate: sakari.ailus@iki.fi Received: from vger.kernel.org ([23.128.96.18]) by www.linuxtv.org with esmtp (Exim 4.92) (envelope-from ) id 1qQSuC-007uAV-Sa; Mon, 31 Jul 2023 13:25:49 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232994AbjGaNZr (ORCPT + 1 other); Mon, 31 Jul 2023 09:25:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232977AbjGaNZm (ORCPT ); Mon, 31 Jul 2023 09:25:42 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E9761707; Mon, 31 Jul 2023 06:25:33 -0700 (PDT) Received: from [127.0.1.1] (91-154-35-171.elisa-laajakaista.fi [91.154.35.171]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 35758162B; Mon, 31 Jul 2023 15:24:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1690809865; bh=f8au6qvF3OZVIkRVMXNUu/SB0ChQK+VTu7qLwWFxelY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=SegS/ito9ajWM4AZfplWG/O0zEN0Kenuwr3Sr47NakELDS0bGtIdm3B7br5bdJUob TtXGiS4iHeQmyT6I3r8clAlxPWzmKwCySRtFmtn/oLOFURBgTd27v74ig93alBI1vz pPmWQ1AhKGke0psVS/GuVEwsk5XaGcUcAfqVmtPY= From: Tomi Valkeinen Date: Mon, 31 Jul 2023 16:24:40 +0300 Subject: [PATCH v3 6/9] media: i2c: ds90ub960: Allow FPD-Link async mode MIME-Version: 1.0 Message-Id: <20230731-fpdlink-additions-v3-6-8acfc49c215a@ideasonboard.com> References: <20230731-fpdlink-additions-v3-0-8acfc49c215a@ideasonboard.com> In-Reply-To: <20230731-fpdlink-additions-v3-0-8acfc49c215a@ideasonboard.com> To: Mauro Carvalho Chehab , Luca Ceresoli , Andy Shevchenko , Laurent Pinchart , Sakari Ailus , Hans Verkuil , Satish Nagireddy , Matti Vaittinen Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Tomi Valkeinen , Andy Shevchenko X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=974; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=f8au6qvF3OZVIkRVMXNUu/SB0ChQK+VTu7qLwWFxelY=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBkx7Y/UbxU7HJAcmhXe8b+jzuAoSAPcpVA31uKN HCUEuOVRGiJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZMe2PwAKCRD6PaqMvJYe 9b7cEAChEf3rWGXsVjID7hGB3eUqavFiFSC1AM873idJTFB9EyKYJ7EOq+iyxMIsGBRn4iOKZw6 O8GKMUIqESsysR98OjpsI+R2M2gyvYPl1DoDSt+MYyrFUR6V/6un4OPT1lBocWRgkkj7tXYNlpn /Yo2/cLAzl/F0Xy2mij6lj+1mQdHiidEvSnlqfS6WBZTy4CpbflhMlGnOTyKbMwdet5NcNPSvM1 coVwW3YsJAnbAJIzsIViFTgdjuvGXIQLMjm7oZmNY36lm7SrRk1019UkU/0dqaxGX37AwdPzUeP hHwfd3RIOqeD9hP01F6cC0zxKyDIi2XtPL2u7dcUX1DKPZ3DuewDhfH8JE7c3p/Du9GM4Mw09V2 rPd4EiFckYZ7hkKrqilGPl+w/oCxozrr7sBmdEb6cEWk6c6NWolw+HADzG/NFNMo9N7FfuHBACH h/ZrTYooOhlzkkE+zHAFSBHEjyUwvgDgFJuSsDy6fNY7rYpY1ZLHNv5S/7tZU/LryEy0ADdwYsF X43f1+7NspgB9aVxKATrf/lJFgVv9RSh3tPLdK4m1Y9A6KL8MXLVVEhGn/sE+9mTZu9JPuUH28E jxznINddda4iipmL3RMGDqbRpdDKS4Drx4+Pl+15W5xDgQGi77VV8+g3NASX0e2vX3LGn66dfRo OPilql58g3+x5IA== X-Developer-Key: i=tomi.valkeinen@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-LSpam-Score: -2.5 (--) X-LSpam-Report: No, score=-2.5 required=5.0 tests=BAYES_00=-1.9,DKIM_SIGNED=0.1,DKIM_VALID=-0.1,DKIM_VALID_AU=-0.1,HEADER_FROM_DIFFERENT_DOMAINS=0.5,MAILING_LIST_MULTI=-1,RCVD_IN_DNSWL_NONE=-0.0001 autolearn=ham autolearn_force=no Allow using FPD-Link in async mode. The driver handles it correctly, but the mode was blocked at probe time as there wasn't HW to test this with. Now the mode has been tested, and it works. Signed-off-by: Tomi Valkeinen Reviewed-by: Andy Shevchenko Reviewed-by: Laurent Pinchart --- drivers/media/i2c/ds90ub960.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/media/i2c/ds90ub960.c b/drivers/media/i2c/ds90ub960.c index b840c9160bf2..c29db59e340b 100644 --- a/drivers/media/i2c/ds90ub960.c +++ b/drivers/media/i2c/ds90ub960.c @@ -3240,7 +3240,6 @@ ub960_parse_dt_rxport_link_properties(struct ub960_data *priv, switch (rx_mode) { case RXPORT_MODE_RAW12_HF: case RXPORT_MODE_RAW12_LF: - case RXPORT_MODE_CSI2_ASYNC: dev_err(dev, "rx%u: unsupported 'ti,rx-mode' %u\n", nport, rx_mode); return -EINVAL; From patchwork Mon Jul 31 13:24:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 93663 X-Patchwork-Delegate: sakari.ailus@iki.fi Received: from vger.kernel.org ([23.128.96.18]) by www.linuxtv.org with esmtp (Exim 4.92) (envelope-from ) id 1qQSuF-007uAv-Bn; Mon, 31 Jul 2023 13:25:51 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233008AbjGaNZt (ORCPT + 1 other); Mon, 31 Jul 2023 09:25:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232988AbjGaNZn (ORCPT ); Mon, 31 Jul 2023 09:25:43 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A497170C; Mon, 31 Jul 2023 06:25:36 -0700 (PDT) Received: from [127.0.1.1] (91-154-35-171.elisa-laajakaista.fi [91.154.35.171]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 299B5E79; Mon, 31 Jul 2023 15:24:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1690809866; bh=YclCu9MWxI1RLNahbDvt0bUIxt4jnTE0SQ6Uw7/PHgk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=haxec1VanzgITfRb+YEitnEb+GWf8YVElPmzQY5poulc/uHyq4INVQAWcUnY0zhQ1 j5rvi+kW0xiCUdT+KtE5vh7v2CprEAqyNyQtGI4wVaIioRsve9bkbdXhSYNUNEiSvM /Kx7jAiXL6fkh4h5Lq4W1jGFabp1VlpuiTxNSwLE= From: Tomi Valkeinen Date: Mon, 31 Jul 2023 16:24:41 +0300 Subject: [PATCH v3 7/9] media: i2c: ds90ub953: Restructure clkout management MIME-Version: 1.0 Message-Id: <20230731-fpdlink-additions-v3-7-8acfc49c215a@ideasonboard.com> References: <20230731-fpdlink-additions-v3-0-8acfc49c215a@ideasonboard.com> In-Reply-To: <20230731-fpdlink-additions-v3-0-8acfc49c215a@ideasonboard.com> To: Mauro Carvalho Chehab , Luca Ceresoli , Andy Shevchenko , Laurent Pinchart , Sakari Ailus , Hans Verkuil , Satish Nagireddy , Matti Vaittinen Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Tomi Valkeinen X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=6404; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=YclCu9MWxI1RLNahbDvt0bUIxt4jnTE0SQ6Uw7/PHgk=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBkx7ZAG3xYVxOm16pm5AQBuD2QxklzuzG6HPmir eLryUajVSuJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZMe2QAAKCRD6PaqMvJYe 9Ur7D/9qZQ5TcwVXsxkQtEkVL35DXgkSPfkSlgEN9YM1LVPtLuTNfQBze5BXybI8EsvNtCr6qln xPJCmUGMSAgfxRkJq26c0F8SwGgdkwQ3j3JY+ZMJjutIVV4GVZpbUJkFPWJtTP8aXmKSfHlsmDB 8WqlxS6Xp3WjIZa1esT3S3CWVYjVGBQOFEooFRs2ZlnrsL1jYulzb0ihYaxZ/v8l+7k2TVhlqdJ Ep5zUCaeooP0dmb0p0U+SbtI/T3B/UAYtECRzFh8K9AYJ96KdloODxdgYelAuUYhe5v/2TxO5vC 1ZmnDVwNJKM6uDtZIg1gjHSjH3KIOY+eBOolY7OFFLlEXOvO3zyCjRw8WE1JejFSjwvB7EeZLGl eu2/bLa0orAuJvkLObHHRzbqtfyUKv5MKV0wGUeVIAeps6OE7nJJGi6VDZ8oSkxAyYFOe6lw3Ti b2RttYQ/bKlJmwIubsq1cwSY1QzsEJArzI9BEz8cDxKSr/126Xh6cAmYHjCA9LUYajbFjlquWHe wuV/0gtjfQs9yXqlPj8sJGzCiAsHlmdG+nEjJjMt1j7Jw7t+AHs/dzKWEqsXYo00/tFqiQh1Txl k8XJZSpb9bpXh3g4s7KWYHPvDgkj6Ho2kMBBNrYUuCAYuTIycLncOGi6o/ALdb1PtIqpibpsdQd S8lExH1fwu/2ToQ== X-Developer-Key: i=tomi.valkeinen@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-LSpam-Score: -2.5 (--) X-LSpam-Report: No, score=-2.5 required=5.0 tests=BAYES_00=-1.9,DKIM_SIGNED=0.1,DKIM_VALID=-0.1,DKIM_VALID_AU=-0.1,HEADER_FROM_DIFFERENT_DOMAINS=0.5,MAILING_LIST_MULTI=-1,RCVD_IN_DNSWL_NONE=-0.0001 autolearn=ham autolearn_force=no Separate clkout calculations and register writes into two functions: ub953_calc_clkout_params and ub953_write_clkout_regs, and add a struct ub953_clkout_data that is used to store the clkout parameters. This simplifies the clkout management. Signed-off-by: Tomi Valkeinen Reviewed-by: Laurent Pinchart --- drivers/media/i2c/ds90ub953.c | 141 +++++++++++++++++++++++------------------- 1 file changed, 76 insertions(+), 65 deletions(-) diff --git a/drivers/media/i2c/ds90ub953.c b/drivers/media/i2c/ds90ub953.c index eedbca986928..e1bd33e91eff 100644 --- a/drivers/media/i2c/ds90ub953.c +++ b/drivers/media/i2c/ds90ub953.c @@ -34,6 +34,8 @@ #define UB953_NUM_GPIOS 4 +#define UB953_DEFAULT_CLKOUT_RATE 25000000UL + #define UB953_REG_RESET_CTL 0x01 #define UB953_REG_RESET_CTL_DIGITAL_RESET_1 BIT(1) #define UB953_REG_RESET_CTL_DIGITAL_RESET_0 BIT(0) @@ -131,6 +133,13 @@ struct ub953_hw_data { bool is_ub971; }; +struct ub953_clkout_data { + u32 hs_div; + u32 m; + u32 n; + unsigned long rate; +}; + struct ub953_data { const struct ub953_hw_data *hw_data; @@ -906,6 +915,62 @@ static unsigned long ub953_calc_clkout_ub971(struct ub953_data *priv, return res; } +static void ub953_calc_clkout_params(struct ub953_data *priv, + unsigned long target_rate, + struct ub953_clkout_data *clkout_data) +{ + struct device *dev = &priv->client->dev; + unsigned long clkout_rate; + u64 fc_rate; + + fc_rate = ub953_get_fc_rate(priv); + + if (priv->hw_data->is_ub971) { + u8 m, n; + + clkout_rate = ub953_calc_clkout_ub971(priv, target_rate, + fc_rate, &m, &n); + + clkout_data->m = m; + clkout_data->n = n; + + dev_dbg(dev, "%s %llu * %u / (8 * %u) = %lu (requested %lu)", + __func__, fc_rate, m, n, clkout_rate, target_rate); + } else { + u8 hs_div, m, n; + + clkout_rate = ub953_calc_clkout_ub953(priv, target_rate, + fc_rate, &hs_div, &m, &n); + + clkout_data->hs_div = hs_div; + clkout_data->m = m; + clkout_data->n = n; + + dev_dbg(dev, "%s %llu / %u * %u / %u = %lu (requested %lu)", + __func__, fc_rate, hs_div, m, n, clkout_rate, + target_rate); + } + + clkout_data->rate = clkout_rate; +} + +static void ub953_write_clkout_regs(struct ub953_data *priv, + const struct ub953_clkout_data *clkout_data) +{ + u8 clkout_ctrl0, clkout_ctrl1; + + if (priv->hw_data->is_ub971) + clkout_ctrl0 = clkout_data->m; + else + clkout_ctrl0 = (__ffs(clkout_data->hs_div) << 5) | + clkout_data->m; + + clkout_ctrl1 = clkout_data->n; + + ub953_write(priv, UB953_REG_CLKOUT_CTRL0, clkout_ctrl0); + ub953_write(priv, UB953_REG_CLKOUT_CTRL1, clkout_ctrl1); +} + static unsigned long ub953_clkout_recalc_rate(struct clk_hw *hw, unsigned long parent_rate) { @@ -965,52 +1030,25 @@ static long ub953_clkout_round_rate(struct clk_hw *hw, unsigned long rate, unsigned long *parent_rate) { struct ub953_data *priv = container_of(hw, struct ub953_data, clkout_clk_hw); - struct device *dev = &priv->client->dev; - unsigned long res; - u64 fc_rate; - u8 hs_div, m, n; - - fc_rate = ub953_get_fc_rate(priv); - - if (priv->hw_data->is_ub971) { - res = ub953_calc_clkout_ub971(priv, rate, fc_rate, &m, &n); + struct ub953_clkout_data clkout_data; - dev_dbg(dev, "%s %llu * %u / (8 * %u) = %lu (requested %lu)", - __func__, fc_rate, m, n, res, rate); - } else { - res = ub953_calc_clkout_ub953(priv, rate, fc_rate, &hs_div, &m, &n); + ub953_calc_clkout_params(priv, rate, &clkout_data); - dev_dbg(dev, "%s %llu / %u * %u / %u = %lu (requested %lu)", - __func__, fc_rate, hs_div, m, n, res, rate); - } - - return res; + return clkout_data.rate; } static int ub953_clkout_set_rate(struct clk_hw *hw, unsigned long rate, unsigned long parent_rate) { struct ub953_data *priv = container_of(hw, struct ub953_data, clkout_clk_hw); - u64 fc_rate; - u8 hs_div, m, n; - unsigned long res; + struct ub953_clkout_data clkout_data; - fc_rate = ub953_get_fc_rate(priv); + ub953_calc_clkout_params(priv, rate, &clkout_data); - if (priv->hw_data->is_ub971) { - res = ub953_calc_clkout_ub971(priv, rate, fc_rate, &m, &n); + dev_dbg(&priv->client->dev, "%s %lu (requested %lu)\n", __func__, + clkout_data.rate, rate); - ub953_write(priv, UB953_REG_CLKOUT_CTRL0, m); - ub953_write(priv, UB953_REG_CLKOUT_CTRL1, n); - } else { - res = ub953_calc_clkout_ub953(priv, rate, fc_rate, &hs_div, &m, &n); - - ub953_write(priv, UB953_REG_CLKOUT_CTRL0, (__ffs(hs_div) << 5) | m); - ub953_write(priv, UB953_REG_CLKOUT_CTRL1, n); - } - - dev_dbg(&priv->client->dev, "%s %lu (requested %lu)\n", __func__, res, - rate); + ub953_write_clkout_regs(priv, &clkout_data); return 0; } @@ -1021,32 +1059,6 @@ static const struct clk_ops ub953_clkout_ops = { .set_rate = ub953_clkout_set_rate, }; -static void ub953_init_clkout_ub953(struct ub953_data *priv) -{ - u64 fc_rate; - u8 hs_div, m, n; - - fc_rate = ub953_get_fc_rate(priv); - - ub953_calc_clkout_ub953(priv, 25000000, fc_rate, &hs_div, &m, &n); - - ub953_write(priv, UB953_REG_CLKOUT_CTRL0, (__ffs(hs_div) << 5) | m); - ub953_write(priv, UB953_REG_CLKOUT_CTRL1, n); -} - -static void ub953_init_clkout_ub971(struct ub953_data *priv) -{ - u64 fc_rate; - u8 m, n; - - fc_rate = ub953_get_fc_rate(priv); - - ub953_calc_clkout_ub971(priv, 25000000, fc_rate, &m, &n); - - ub953_write(priv, UB953_REG_CLKOUT_CTRL0, m); - ub953_write(priv, UB953_REG_CLKOUT_CTRL1, n); -} - static int ub953_register_clkout(struct ub953_data *priv) { struct device *dev = &priv->client->dev; @@ -1055,16 +1067,15 @@ static int ub953_register_clkout(struct ub953_data *priv) priv->hw_data->model, dev_name(dev)), .ops = &ub953_clkout_ops, }; + struct ub953_clkout_data clkout_data; int ret; if (!init.name) return -ENOMEM; /* Initialize clkout to 25MHz by default */ - if (priv->hw_data->is_ub971) - ub953_init_clkout_ub971(priv); - else - ub953_init_clkout_ub953(priv); + ub953_calc_clkout_params(priv, UB953_DEFAULT_CLKOUT_RATE, &clkout_data); + ub953_write_clkout_regs(priv, &clkout_data); priv->clkout_clk_hw.init = &init; From patchwork Mon Jul 31 13:24:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 93662 X-Patchwork-Delegate: sakari.ailus@iki.fi Received: from vger.kernel.org ([23.128.96.18]) by www.linuxtv.org with esmtp (Exim 4.92) (envelope-from ) id 1qQSuE-007uAv-BN; Mon, 31 Jul 2023 13:25:50 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232261AbjGaNZs (ORCPT + 1 other); Mon, 31 Jul 2023 09:25:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232993AbjGaNZn (ORCPT ); Mon, 31 Jul 2023 09:25:43 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12CB21713; Mon, 31 Jul 2023 06:25:37 -0700 (PDT) Received: from [127.0.1.1] (91-154-35-171.elisa-laajakaista.fi [91.154.35.171]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id C94A72E4; Mon, 31 Jul 2023 15:24:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1690809868; bh=vtei7NXd+I1IEzwPdAa7WkQkNRkfuQphMPBcmKMItug=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Rtk99JKIY6VpbmfKxaH8JnhSxvUHMB6WPe9+5CkRVBxS+CfiN+HVmGwfjDNb3vN11 P0PgJZ4IMKfZLZ6Xbha7lTObGQW7Fj8+brwCCRB/8jf33tm/P7MIWX+gkTMiB0bm7C rhug2IknXeRt+g4M+l9JxiOe8Y+FUeI4KkcnmUTU= From: Tomi Valkeinen Date: Mon, 31 Jul 2023 16:24:42 +0300 Subject: [PATCH v3 8/9] media: i2c: ds90ub953: Support non-sync mode MIME-Version: 1.0 Message-Id: <20230731-fpdlink-additions-v3-8-8acfc49c215a@ideasonboard.com> References: <20230731-fpdlink-additions-v3-0-8acfc49c215a@ideasonboard.com> In-Reply-To: <20230731-fpdlink-additions-v3-0-8acfc49c215a@ideasonboard.com> To: Mauro Carvalho Chehab , Luca Ceresoli , Andy Shevchenko , Laurent Pinchart , Sakari Ailus , Hans Verkuil , Satish Nagireddy , Matti Vaittinen Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Tomi Valkeinen , Andy Shevchenko X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=2680; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=vtei7NXd+I1IEzwPdAa7WkQkNRkfuQphMPBcmKMItug=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBkx7ZAM29qGUdd4UIvtZBQzT3jVGP1/rrtTIW/o QrNAwqmC7WJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZMe2QAAKCRD6PaqMvJYe 9baDD/wLAwMWF7BQWC6WfEYlcN5XHzdeBo7/yrl3KbHcIh03HJ8k6EPYbEHrt80hPiNidFmBwjo N2/9i8J/N0lUFbNKoE07hyFztFkkpWu7nQoACikbDBuJoRforoidGYDtVwoCeJ0+hh54ThGqMms DIjeRm4rmuCv5O3BYCkAx8995kCx2bcJsMzuqR/q2DgR5HkhIq47Bt/3XeQXutY4VlFZmYYNDwd ZEF7WdtCbT7jOMFZnVqsLn1NFoTRYP+b0ir9YwfkjVrnZiaCjxQM1n8fpAybGEN5225FK+ryKSd ehyBpK0CSD5vqqs4npcOlIvo5k5ymhFluWH+7Tld23IxKwResMXyRww+J44cMqh6KHmsvFcxp2b cHM87nUHio0LE5OCF5hYLdsSjdEdheKPMlqTFWuj1x+H57Ahtb7j26qDXqX69I1ykuldsAP9Zx/ jtf1gRX4TGIjGmYcLBST0rA+8FWO7sE/PruWjRNR+d1z0heALfqBBOQMmBf/t9kEwWW1zXyH5Eo PKj4RuuUDb5vPH8xphY2EVL0wenLxatSzcjX0s6Ejx1DveIhhOoplG8SJwy82/GgMSfSpatMyE6 a4m63D7xs0fa8oHyKQJwLXj/y5+TIb3LNXhS7k+66rG6iImbirOUPs6Yn0uZZQgf8l1HF1acygS GgiWV7DJaliLdHQ== X-Developer-Key: i=tomi.valkeinen@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-LSpam-Score: -2.5 (--) X-LSpam-Report: No, score=-2.5 required=5.0 tests=BAYES_00=-1.9,DKIM_SIGNED=0.1,DKIM_VALID=-0.1,DKIM_VALID_AU=-0.1,HEADER_FROM_DIFFERENT_DOMAINS=0.5,MAILING_LIST_MULTI=-1,RCVD_IN_DNSWL_NONE=-0.0001 autolearn=ham autolearn_force=no Add support for FPD-Link non-sync mode with external clock. The only thing that needs to be added is the calculation for the clkout. Signed-off-by: Tomi Valkeinen Reviewed-by: Laurent Pinchart Reviewed-by: Andy Shevchenko --- drivers/media/i2c/ds90ub953.c | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/drivers/media/i2c/ds90ub953.c b/drivers/media/i2c/ds90ub953.c index e1bd33e91eff..d56c1dda89b3 100644 --- a/drivers/media/i2c/ds90ub953.c +++ b/drivers/media/i2c/ds90ub953.c @@ -145,6 +145,7 @@ struct ub953_data { struct i2c_client *client; struct regmap *regmap; + struct clk *clkin; u32 num_data_lanes; bool non_continous_clk; @@ -844,15 +845,21 @@ static int ub953_i2c_master_init(struct ub953_data *priv) static u64 ub953_get_fc_rate(struct ub953_data *priv) { - if (priv->mode != UB953_MODE_SYNC) { + switch (priv->mode) { + case UB953_MODE_SYNC: + if (priv->hw_data->is_ub971) + return priv->plat_data->bc_rate * 160ull; + else + return priv->plat_data->bc_rate / 2 * 160ull; + + case UB953_MODE_NONSYNC_EXT: + /* CLKIN_DIV = 1 always */ + return clk_get_rate(priv->clkin) * 80ull; + + default: /* Not supported */ return 0; } - - if (priv->hw_data->is_ub971) - return priv->plat_data->bc_rate * 160ull; - else - return priv->plat_data->bc_rate / 2 * 160ull; } static unsigned long ub953_calc_clkout_ub953(struct ub953_data *priv, @@ -1195,9 +1202,15 @@ static int ub953_hw_init(struct ub953_data *priv) dev_dbg(dev, "mode from %s: %#x\n", mode_override ? "reg" : "strap", priv->mode); - if (priv->mode != UB953_MODE_SYNC) + if (priv->mode != UB953_MODE_SYNC && + priv->mode != UB953_MODE_NONSYNC_EXT) return dev_err_probe(dev, -ENODEV, - "Only synchronous mode supported\n"); + "Unsupported mode selected: %u\n", + priv->mode); + + if (priv->mode == UB953_MODE_NONSYNC_EXT && !priv->clkin) + return dev_err_probe(dev, -EINVAL, + "clkin required for non-sync ext mode\n"); ret = ub953_read(priv, UB953_REG_REV_MASK_ID, &v); if (ret) @@ -1314,6 +1327,13 @@ static int ub953_probe(struct i2c_client *client) goto err_mutex_destroy; } + priv->clkin = devm_clk_get_optional(dev, "clkin"); + if (IS_ERR(priv->clkin)) { + ret = PTR_ERR(priv->clkin); + dev_err_probe(dev, ret, "failed to parse 'clkin'\n"); + goto err_mutex_destroy; + } + ret = ub953_parse_dt(priv); if (ret) goto err_mutex_destroy; From patchwork Mon Jul 31 13:24:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 93664 X-Patchwork-Delegate: sakari.ailus@iki.fi Received: from vger.kernel.org ([23.128.96.18]) by www.linuxtv.org with esmtp (Exim 4.92) (envelope-from ) id 1qQSua-007uC6-QN; Mon, 31 Jul 2023 13:26:13 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233067AbjGaN0K (ORCPT + 1 other); Mon, 31 Jul 2023 09:26:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233014AbjGaNZp (ORCPT ); Mon, 31 Jul 2023 09:25:45 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D69981986; Mon, 31 Jul 2023 06:25:39 -0700 (PDT) Received: from [127.0.1.1] (91-154-35-171.elisa-laajakaista.fi [91.154.35.171]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id BB7A71B59; Mon, 31 Jul 2023 15:24:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1690809869; bh=3+DFmCI8pb7ymXT5ii0dJSIen8bU6FQj2ceug6/EKEE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=IOHjXx6FaXAt7Uu6vbTeGGehhHkcZ9FNUTfZnQBtZKHdSWMbbcybyw9xFJS1OGwKz tS6hsBBEwMLEO7u9Xrt67Sh1StKlkwZ/Q48RL44Xl8h5G9JtysPp0ea2diX9YGceO0 vY90o1EEAFE5Z/E1sdb3JYqXXtblvs+UT00Exn2s= From: Tomi Valkeinen Date: Mon, 31 Jul 2023 16:24:43 +0300 Subject: [PATCH v3 9/9] media: i2c: ds90ub960: Rename RXPORT_MODE_CSI2_ASYNC to RXPORT_MODE_CSI2_NONSYNC MIME-Version: 1.0 Message-Id: <20230731-fpdlink-additions-v3-9-8acfc49c215a@ideasonboard.com> References: <20230731-fpdlink-additions-v3-0-8acfc49c215a@ideasonboard.com> In-Reply-To: <20230731-fpdlink-additions-v3-0-8acfc49c215a@ideasonboard.com> To: Mauro Carvalho Chehab , Luca Ceresoli , Andy Shevchenko , Laurent Pinchart , Sakari Ailus , Hans Verkuil , Satish Nagireddy , Matti Vaittinen Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Tomi Valkeinen , Andy Shevchenko X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=3571; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=3+DFmCI8pb7ymXT5ii0dJSIen8bU6FQj2ceug6/EKEE=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBkx7ZB1/vsEcUF9lkKQC19r/IgwBZXBjt3id2qM l9q6iyPRJGJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZMe2QQAKCRD6PaqMvJYe 9XVvD/40O1Pgk9HsoSDVurU5aSdLuJIDEZlQypyAXxADYQWEHYEXwH1cGg0wZAakHmHBs1VUNUL 5CT4k8JjH6SjeyyP+Vl+sGOSi0nQQERhvIb61GkF3F/LfzgQ9zFt5jldkxncNZgCTmxbbRmvA/7 H8P8ioLQLZR8K0ObhLyFLHOdH6W/LHhYJ0RToB451thZnnSoZfiB+/9io3qo8SXaPoLfcj4vXxL xNMejCwtYclvwjBLOwjWycD65Yl01IzdcpphOyyLZ4yRa6kepd3pjukUnTZ6L01FQu44c43Veto 5kz4xzVbCcRUtzV5vITGN1jOGDwv+xt3VnBFTMHmTZPWoiYG9UTGN/hDDSly2fjHMSwqtwbWGYX Eh0K2hPL8TPPi7WuzXiP9Wszj6BSqNjsxlCjSiXL8aCjgXdTh86GycQ4kG9mqVethowZkasZ6os b7gC61POcDmp4WNw9m1rmAEp4lrOHr4KUDE++APqAg2EdUroVu8hEgBtzbRKbyYiszbKfxPvzeD F6RDHPZE0ZnQr8OH3n8amPPQYwu9PNQDpaG+S+JAAFnq8EKRgaOPeXqnszjl7R9uAkOK/WZn48y 7+WdOHOP5MIDrZeKmXohmTRgVd307lCu4zRO8rbX+sBCg7YGUNAwaOZQKrdVyKaOHD5bJI50vzs +ZBHtzZoJZqQ5pg== X-Developer-Key: i=tomi.valkeinen@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-LSpam-Score: -2.5 (--) X-LSpam-Report: No, score=-2.5 required=5.0 tests=BAYES_00=-1.9,DKIM_SIGNED=0.1,DKIM_VALID=-0.1,DKIM_VALID_AU=-0.1,HEADER_FROM_DIFFERENT_DOMAINS=0.5,MAILING_LIST_MULTI=-1,RCVD_IN_DNSWL_NONE=-0.0001 autolearn=ham autolearn_force=no FPD-Link has an operating mode that used to be called "asynchronous" in the hardware documentation, but that has been changed to non-synchronous already quite a while back. The ub960 driver still had one instance of the old naming, so let's rename it. Signed-off-by: Tomi Valkeinen Reviewed-by: Laurent Pinchart Reviewed-by: Andy Shevchenko --- drivers/media/i2c/ds90ub960.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/media/i2c/ds90ub960.c b/drivers/media/i2c/ds90ub960.c index c29db59e340b..f619c23e084a 100644 --- a/drivers/media/i2c/ds90ub960.c +++ b/drivers/media/i2c/ds90ub960.c @@ -415,8 +415,8 @@ enum ub960_rxport_mode { RXPORT_MODE_RAW12_HF = 1, RXPORT_MODE_RAW12_LF = 2, RXPORT_MODE_CSI2_SYNC = 3, - RXPORT_MODE_CSI2_ASYNC = 4, - RXPORT_MODE_LAST = RXPORT_MODE_CSI2_ASYNC, + RXPORT_MODE_CSI2_NONSYNC = 4, + RXPORT_MODE_LAST = RXPORT_MODE_CSI2_NONSYNC, }; enum ub960_rxport_cdr { @@ -1609,7 +1609,7 @@ static unsigned long ub960_calc_bc_clk_rate_ub960(struct ub960_data *priv, div = 1; break; - case RXPORT_MODE_CSI2_ASYNC: + case RXPORT_MODE_CSI2_NONSYNC: mult = 2; div = 5; break; @@ -1633,7 +1633,7 @@ static unsigned long ub960_calc_bc_clk_rate_ub9702(struct ub960_data *priv, case RXPORT_MODE_CSI2_SYNC: return 47187500; - case RXPORT_MODE_CSI2_ASYNC: + case RXPORT_MODE_CSI2_NONSYNC: return 9437500; default: @@ -1840,7 +1840,7 @@ static void ub960_init_rx_port_ub960(struct ub960_data *priv, bc_freq_val = 0; break; - case RXPORT_MODE_CSI2_ASYNC: + case RXPORT_MODE_CSI2_NONSYNC: bc_freq_val = 2; break; @@ -1878,7 +1878,7 @@ static void ub960_init_rx_port_ub960(struct ub960_data *priv, return; case RXPORT_MODE_CSI2_SYNC: - case RXPORT_MODE_CSI2_ASYNC: + case RXPORT_MODE_CSI2_NONSYNC: /* CSI-2 Mode (DS90UB953-Q1 compatible) */ ub960_rxport_update_bits(priv, nport, UB960_RR_PORT_CONFIG, 0x3, 0x0); @@ -1938,7 +1938,7 @@ static void ub960_init_rx_port_ub9702_fpd3(struct ub960_data *priv, fpd_func_mode = 2; break; - case RXPORT_MODE_CSI2_ASYNC: + case RXPORT_MODE_CSI2_NONSYNC: bc_freq_val = 2; fpd_func_mode = 2; break; @@ -2032,7 +2032,7 @@ static void ub960_init_rx_port_ub9702_fpd4(struct ub960_data *priv, bc_freq_val = 6; break; - case RXPORT_MODE_CSI2_ASYNC: + case RXPORT_MODE_CSI2_NONSYNC: bc_freq_val = 2; break; @@ -2098,7 +2098,7 @@ static void ub960_init_rx_port_ub9702(struct ub960_data *priv, return; case RXPORT_MODE_CSI2_SYNC: - case RXPORT_MODE_CSI2_ASYNC: + case RXPORT_MODE_CSI2_NONSYNC: break; } @@ -2444,7 +2444,7 @@ static int ub960_configure_ports_for_streaming(struct ub960_data *priv, /* For the rest, we are only interested in parallel busses */ if (rxport->rx_mode == RXPORT_MODE_CSI2_SYNC || - rxport->rx_mode == RXPORT_MODE_CSI2_ASYNC) + rxport->rx_mode == RXPORT_MODE_CSI2_NONSYNC) continue; if (rx_data[nport].num_streams > 2) @@ -2508,7 +2508,7 @@ static int ub960_configure_ports_for_streaming(struct ub960_data *priv, break; case RXPORT_MODE_CSI2_SYNC: - case RXPORT_MODE_CSI2_ASYNC: + case RXPORT_MODE_CSI2_NONSYNC: if (!priv->hw_data->is_ub9702) { /* Map all VCs from this port to the same VC */ ub960_rxport_write(priv, nport, UB960_RR_CSI_VC_MAP,