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: 128700 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp2029906vqg; Mon, 31 Jul 2023 06:55:25 -0700 (PDT) X-Google-Smtp-Source: APBJJlFqxv2qQVnEMZ9ELdYmacsCJd6eR5KdIf++jQiknTa5Y70vErOqdaWpOIZvGj3pLTZjawvF X-Received: by 2002:a17:906:319b:b0:99b:c35a:8865 with SMTP id 27-20020a170906319b00b0099bc35a8865mr7298359ejy.1.1690811725037; Mon, 31 Jul 2023 06:55:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690811725; cv=none; d=google.com; s=arc-20160816; b=cic7wOR08WyRn7uKPTuRff/4RqIQNFtuSm+1lA21x26frjqNikvkMRBgcBs3MZ7y/U c25HpmbxKP/QR5cLSBxu7hXsL2RAzgp/+xHHlTVZbTn1iW5IV0CoVtSsQBdb+sPP3bQC CfB56IFJXQUlfaZmSiOuzTGibkVOHx7FyPEem1h2IzupCVVKuvoe9y8Jmm9fniPkdnzq oQY35x8HIfJ99+l0FlXCHCw0Z6r3THuPukc/Bh93f8Jdmu7J6AhfZ71jfLJfw2phPda8 RCUJhX5y+ecydSd92S1q29Q5AtNzScNWS7uDm7JvavHj17AgYskKY1MF+TWLlOMNwyRb 5VNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=0NlLC6DdOpTTuE6J0emuXBGXEucZ+FuaMeF+7beA2X8=; fh=cL8V8cgQpxlbGU1a/BFb9J43s+fdNyaB+cfzJFyBZIE=; b=wczKUSrD4x70a6abe4YakneE8payRHasFd6q0EC7EkzwafrJDh9Ty4N3EXTgQxRx9E VLpANT+6D1Hn/W5y5ik9oLMnGy1KHTGXV8x4ncpkTOF2l/Lyx0KBsoibkEA893WL2DOz ptgfKon1/q+gmAFGi5rRNaDT22ekBA3cKd18Tq3lIyl0sMByL+NCUzbocB3jc7CqNBfC YLR4tJWvFauIftoSBpAeUZBApzhYUGYgLhtfxZABEtXCXZBdgqnPi1DK0R/oViSJEMHA +K4MZucS4iro+t1vtZYx6/hXVEch2NZg7SAtfUqIT4PXQb3jB/Zr4ZeHoEF3DrPXg9/5 CfUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=uj97Fj0A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p26-20020a17090635da00b0098e1627c0e4si3529299ejb.777.2023.07.31.06.55.00; Mon, 31 Jul 2023 06:55:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=uj97Fj0A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232939AbjGaNZb (ORCPT + 99 others); Mon, 31 Jul 2023 09:25:31 -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-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772944595669223831 X-GMAIL-MSGID: 1772944595669223831 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: 128776 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp2096785vqg; Mon, 31 Jul 2023 08:40:06 -0700 (PDT) X-Google-Smtp-Source: APBJJlFIJXTgVH9tiKwbSGKFYyhxu3M3uXMvMHqToPKQObrJvF4HlgIHXJhQ4BQAtCUHHPIMgLYS X-Received: by 2002:a05:6a20:549a:b0:13c:ca8b:7e29 with SMTP id i26-20020a056a20549a00b0013cca8b7e29mr11297382pzk.12.1690818006143; Mon, 31 Jul 2023 08:40:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690818006; cv=none; d=google.com; s=arc-20160816; b=ae9DxgR9bMFa31njM0ctJmmrMvTvXc8ULUtN1NBMj4WKmkLv1+Z9uplrcwPAf1xchi RTOwl5ahTbLujuV2rAbEffFtiTVZljE04LY5YxsrlfJFh/6svgnpFZe6Ko63WaQNSGp9 97k0Ymmr7s0DMt/hnJdVGEPOMPG43JZTIxXDufnfcbGEZxF2RdG9tziYjoTs8sC2fsi+ Ll7ngeD2kAUFYnyFysT23B862JQQQP1GgNdxsPyd4lWUxMPot1N80iXR5McN9V4r9riS 1Jg40MWYqDPfXXcV/yoKiTzgHEO5iiKlqTpWrmDxbPWPIl3wtX726GD7zQmImap6AQ5V 3+wQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=7wpPTFsoeCG09KRj8y7wzcojFCwvYv6XyqvaWK3emyY=; fh=jh+7v3szpfmpm7aeAZBeUyBAgjiSgOnhDPEhaInbk38=; b=k/aEGfdV5P2q4RcFPeDLtriroavpW/MVu24bTHKJXeC4wWiTEa4WQhORaUMB220H5c YeR6iY7LoFfXC82R26gj9o4gt1zINboC/FHOKVF6RJuR0TrXMp1RWnjb4UOy88C4Lm48 e3glTulYvKjdT1GXOIwv7rYU3H5aabVpDCxP9sLtV7oI2KoHQh16zXER91hPH3lkXAjq QDmnA0ixUE0/HmhINsT4+IDMqlxJ1bL9Ngy+JF91p4fV53z5wOOTCEq25XtpwWBFYZWH Bu8D0Y+Wth94KFkJ+Seo60/6Pd6qtSdukiGRdih/NpdkCGoqI3xeBKHJ1Vb+DBeeeMU7 mR/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=jAjqlB7t; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w8-20020a63f508000000b00563e6524951si7314583pgh.30.2023.07.31.08.39.52; Mon, 31 Jul 2023 08:40:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=jAjqlB7t; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232954AbjGaNZe (ORCPT + 99 others); Mon, 31 Jul 2023 09:25:34 -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-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772951181775219523 X-GMAIL-MSGID: 1772951181775219523 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: 128715 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp2038401vqg; Mon, 31 Jul 2023 07:07:36 -0700 (PDT) X-Google-Smtp-Source: APBJJlHBBGxj+ann4T6prxDDLP8fjQp8e7Uz7q9ZMyrKNCE+ZegN+UFJBtJClEyV3iM4c+Fnia4U X-Received: by 2002:a05:6a21:7794:b0:12f:8755:96ba with SMTP id bd20-20020a056a21779400b0012f875596bamr8733808pzc.28.1690812455852; Mon, 31 Jul 2023 07:07:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690812455; cv=none; d=google.com; s=arc-20160816; b=rkXGD5Nz1ZwpugT+IhB1uJRF7zpH51U5YIuLJwM+fji7X7hf9PbpciGVqpMBitKZad MoNPjyVieqKn2oUiwDbJJ5rbG5jMcxPaxDcw5BHBsJv+c3oWTpc+eLqE/FLtVVt1yoDU G3IqFm6XNmiHl/fIvZ5qlwjKfn5o87RXM84ShbLa2Mcar9XFPKdnIFyVoLWwGqRLHKai RLa795/TfC6DW2M4aVuJqTW/4DeMAuGy1wecm2DjxsGlrd0fWt3dkpr5YgBF5/3zGHy6 y2znFpf+lZC5ieUVA0h1i6oNWxyz2OcQtt+s2FASBePXvq7nksm6swVqZH9OA3m84XKy hx9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=/hYPTilCi7w1ULtPy5CUwOB802I6pjasoanaTGDkfBA=; fh=jh+7v3szpfmpm7aeAZBeUyBAgjiSgOnhDPEhaInbk38=; b=0ODLpKxwMZiIMlF5ZF5EhATOgphihfz9enBTdv2PQwBdM4yB+lrf2aS6LNFDP0HIL6 8VDDkS8V4+H+Mpqtti3ZLmGdwUFzryNiTk6xRXxh2uOe71z8DW+HwXr5zp0LxZPOwnWT WI9MCujs0/c2WXZ7ZGc+0RHj5y29JanQBjFC9B21y/qu4OAunJdvZ+wePrfxKXiKR4Yw aHP66x82vRZ05nwXeKmetM9qx1PR+vFZyFtFyYSM84ZGJPAZlxr/MuhwgZ/fHUafBVmA 9MWyB3txB3YWAuknIqcf7Qpu7TeJYDnEIVhONUNEPiUxPoq9CzqRlHw80r+y8AKIt1Tz fIXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=T8CvZFQK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cw3-20020a056a00450300b006872089fa3fsi3408015pfb.283.2023.07.31.07.06.52; Mon, 31 Jul 2023 07:07:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=T8CvZFQK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232974AbjGaNZh (ORCPT + 99 others); Mon, 31 Jul 2023 09:25:37 -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-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772945361726817714 X-GMAIL-MSGID: 1772945361726817714 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: 128722 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp2040261vqg; Mon, 31 Jul 2023 07:09:59 -0700 (PDT) X-Google-Smtp-Source: APBJJlGuzeFqX6rLM/ASEVPBm0UxFKCdgdzvWJ+aDyilDqKijSAG3BpJ0F5iWp9MS9W80stQaH7j X-Received: by 2002:a17:902:ea09:b0:1b8:76ce:9d91 with SMTP id s9-20020a170902ea0900b001b876ce9d91mr11967021plg.1.1690812598573; Mon, 31 Jul 2023 07:09:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690812598; cv=none; d=google.com; s=arc-20160816; b=qMcxXDSAxGuBb+RLe7qYzqCZOwUr+UySqt1cJO3ecqiH9H8ebh3Vj5IgM7iqzL4FAl iUEABY2sC8deXe9oKmvwZ9A3xnEbOrNZOo/jXFomKNo3df9raenk9L6POitVS2zKgExF sFXsjaeVgIrfX52rBIBaXMkx8ywj2F9B4Nc5u6qeZAOjdTiKm2yvpJgBEwqADUNmJUZO fagEvUkXQ5PpRzhophbakQ7MHzDaEV9vSFzXidb0HKJ2zCJnwK2e7hk0Q2rEvCIPHlaC HXu8hV1siJaya2dpzGrsauC5Z9kJEudjgEAJFGcGWqobZc2lVShlXkZVnxyGRz8Qe2rr hURA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=3t0nZZVH8+qe2utI/7pqQwHejtIOJPiA6NoXeVxGc/M=; fh=jh+7v3szpfmpm7aeAZBeUyBAgjiSgOnhDPEhaInbk38=; b=pTit0TMZYaTs1jUKSgw3IRbesCI2aJ965A3CCs3lkXHDBpb87qYBkPeREGWlrZIwoh HSGPO673h/qQjNoyTzizVCYxjC6N+R5oy2A7Psf26D6M0cqgPcQg2Ge4YdMZ4/GDZifq pQBRXCVhQa9BqyYwYpHx+ehTtzxGpePE1gm82WLyAnsLyjU8bVHM9ILZKJPUWdj56xPJ bVuhO76xUpEo6nRvRa23yv94BLlJDTNF7Z3PBJo0UjgsVqXWGtxsuWZu6F0xgLEzxJ7I tf8DLXjomGfQV8RPzoI7PKWIShtTKKQlZ6RpEHf1VH0PvLpPTrgTLZxN6s0Zj94VnHxr IXbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=fpo+n3u2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n18-20020a170902d2d200b001b9c992945fsi2471449plc.555.2023.07.31.07.09.44; Mon, 31 Jul 2023 07:09:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=fpo+n3u2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232965AbjGaNZn (ORCPT + 99 others); Mon, 31 Jul 2023 09:25:43 -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-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772945511210716836 X-GMAIL-MSGID: 1772945511210716836 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: 128754 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp2054880vqg; Mon, 31 Jul 2023 07:32:24 -0700 (PDT) X-Google-Smtp-Source: APBJJlFLglJwzTeLpUxLbStFpAeDtN1IyRqs8zM273Hv+/qttVuHdlFZrysdAa0B89T3DeiahD8b X-Received: by 2002:a17:90a:86c7:b0:268:2b5c:14c with SMTP id y7-20020a17090a86c700b002682b5c014cmr8181349pjv.13.1690813944613; Mon, 31 Jul 2023 07:32:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690813944; cv=none; d=google.com; s=arc-20160816; b=l1ujudCZN7yc2e3hIBn/7GOZ14uxOP+xIrhkdIAg8bV293V7BjLcfUUUxggHK1wmRe a0+Xj1CzSWm43aPDTLskS9lUP6ciUlzMAfE30w5wo63N2jpHjHH+CYQBDVss67CLg6nA SK08d0UZcilpwlM5hNUe/0M1rCg6gAbovFWyEKF9WyDY0exc4sh2WSPeYDRzXSes9Ibt 4lg0sBUOa2oMIQAGWW7h8iOSqDj5MEIVMCS3QR28ttHnTzrcX0gYZwIbwmCd0yXXUxkb CxBdwZM/gQ8tXD8pyV+p1fcy8Y/fqSuNDw5aLhppntuVfr6fdj046UEdRB+dYDHw7+pv ZqTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=Y6bQTUafXgEa4zFFV4ty0ug0iLuBuXi9Le3w7JvUkko=; fh=jh+7v3szpfmpm7aeAZBeUyBAgjiSgOnhDPEhaInbk38=; b=yqHMyAkNbcis1vtus4d2l5Cv6TPzgcMBODDF3Bs2xhENIztdtfbdm18w6kwuEvCHHC 96VX6Bf8ooDbg7R5ZVw2d/5Vc1HP6ujxuEkTDuvdXNEEYH7vFURuVWHpxgjxI5THUsf4 UZuxjYPA3e7smU5YJYYF9AQU7pgL8UO/Rtb/lAVbvbDylZcJ7dGu9M26v3PAj+Fvdchn KAGILI6Qw4NF2OPj7Kct1I815WEqogGVk23yXEtj7GlkR3WM3NG7CDXEMV6vZapHaIUN /sPoUt79pCrXkyt5ud5lZfCn9PqJuNg7iCTqyOE/GoJc3FRl9P5jv6hpKJvWTr1rH8z2 sHAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=lnLKgyue; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c7-20020a17090a558700b00267f33cf006si8849984pji.67.2023.07.31.07.32.11; Mon, 31 Jul 2023 07:32:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=lnLKgyue; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233026AbjGaNZq (ORCPT + 99 others); Mon, 31 Jul 2023 09:25:46 -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-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772946922531777367 X-GMAIL-MSGID: 1772946922531777367 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: 128788 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp2144823vqg; Mon, 31 Jul 2023 10:03:34 -0700 (PDT) X-Google-Smtp-Source: APBJJlHafr2yanwJoEl0B0Mrj3MjySlV3bq/zn+DB0W1ViI1FoSNWqeqnO+OLexOnp8EA7PYIOcl X-Received: by 2002:a17:906:2d0:b0:993:f2c2:750b with SMTP id 16-20020a17090602d000b00993f2c2750bmr318180ejk.17.1690823014346; Mon, 31 Jul 2023 10:03:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690823014; cv=none; d=google.com; s=arc-20160816; b=pTRhIgDra+bESfHIkBbAIK9IeiSUOTbygoJD+Vi6sUnmvng2sN0R9gYCbZPEC76m2I qW/v7ADC3EPLpSS+C7sja3zz0EPZSXpB4qOJh8NWDPhQdfzk/VAj49WMhyD1rtj/aoTe lZkPQE4v6o6x5VAKa9DAWLcr2pib8hEdEEx70LtJ1+D3aSroFfjrQgsBn2XW+n5rTsJg 5jKx9x3UK5MIwhm0xNIqE2uPyiNYKQPhzd84YZ8M6UDhhxy2iTjszsvmuDEzHolrngJG JHu0WVB52E9QU58VoNYrbXElSGGL1p6OWQxeluB0AOnZOFGGPuLQsfF+2gihpDE7xiWh EhzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=+qJWZmvLOqs/h9D8dPoEqOKZK5F0NH5yA76MLay3qYY=; fh=jh+7v3szpfmpm7aeAZBeUyBAgjiSgOnhDPEhaInbk38=; b=BX/E/YL34NzoTWx972lkcWOO6Ujwro/yR/g45BncSqpU4AoLfDepawaUIEPAhP3RVX 4Elon89i9ISLBcKdXL9QgDaWsfrtL3Wh1Tepkng2BzrmHifLoSwJVxtdz09Q2fPF/fis Ii4VnILVYbgs4e21etOJtfclwjTtLXOQTGQHB/3Ps6JTWfS2RIdB8RRAuUrONKwkL/F+ vnm4a9PByAqZAlOUQJbfg07Jht32UKvcnHCWWmAmNHTqsvcYlZQw1/t2rT30o36A0ZLf xSzHJGVlfyetfa6zebIGVnYMmt2Z8KXtR76G8F87+oNxk0qyvsGGwuOR8istffdt3ceT ruuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b="SegS/ito"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e6-20020a1709067e0600b009945658c5b9si6990599ejr.811.2023.07.31.10.03.10; Mon, 31 Jul 2023 10:03:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b="SegS/ito"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231853AbjGaNZt (ORCPT + 99 others); Mon, 31 Jul 2023 09:25:49 -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-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772956432790799899 X-GMAIL-MSGID: 1772956432790799899 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: 128747 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp2049038vqg; Mon, 31 Jul 2023 07:22:37 -0700 (PDT) X-Google-Smtp-Source: APBJJlEEzqR1a5jXbCdz79HZdJwWztAW6iewsTulBUZWqAO8SaErfVB99ZSKoFIg7a+bbJUGBa8U X-Received: by 2002:a05:6a00:18a5:b0:668:6eed:7c12 with SMTP id x37-20020a056a0018a500b006686eed7c12mr10974951pfh.22.1690813357325; Mon, 31 Jul 2023 07:22:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690813357; cv=none; d=google.com; s=arc-20160816; b=Fvam11m7/KO/okNIriha3UVSqn8VxLUrg32MYxgNLrJ4Nhk7+x+HhQ2xgUKNZsj0eH aDdDcxQIa1j0m0NxRKyr3qj9zYIIMJJcqR2J7J33UCcCkc4sPozANJ5pRtZYqu+dNaiD mClkFh58T9fpIZ560YJT+yon6A+m7M9JoZXOfGFdTncRDu1UINOWmBZK98tTFfMd9NZ0 su9vTIKNHYS70wjwXkcvTGvmyH+R7pqbn1bE4v/dvXEbEJ0PjGwVVfKwKWP1qfW50LTx ktw4588eh4G2+BpnT7E/7r/xg6l/ZfSFPESyoAvEbtoIE1JlZKvaJPe8c2I5cgvg9H9S 4ZqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=XsDDMxpdWwX3FvdXxNy5CnN4aXlh7Ty8B09gtC5TYNU=; fh=cL8V8cgQpxlbGU1a/BFb9J43s+fdNyaB+cfzJFyBZIE=; b=A8NkpdFOOAdzh5Ny7ZxEbvD60GXRm5lzNxbCC/JfPctu8ywQB/76ksmsYoJOzSfJ9O x+kRqbOwTPTz4S9ROBUDslh0xMzfqn3w1Shi9t2kB2jaiHL1k0zco8Ec5IcVqlS+Jq6f yzItMXE13SagI+2xY/0WTTa7BwWnwiCQ0vNlYVixt9fA/kOZzMSsMRDqG6HR7J/4bIFM rDB0PtmpDdMoL7hG98ZGRfpr+ThGi8ZPFugHwLiuEhdmgHdkecbTEEC8qsq6yrZUnTBL lEyA722LHGFetBD5xm7MySWAqOrV1Y/VSUHxn+U7b3eHOTd0SJhnEVgWFQc215ZwQDeN Fo2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=haxec1Va; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g8-20020a636b08000000b00563adca207csi7145587pgc.426.2023.07.31.07.22.23; Mon, 31 Jul 2023 07:22:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=haxec1Va; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232968AbjGaNZz (ORCPT + 99 others); Mon, 31 Jul 2023 09:25:55 -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-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772946307001815959 X-GMAIL-MSGID: 1772946307001815959 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: 128783 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp2121476vqg; Mon, 31 Jul 2023 09:21:27 -0700 (PDT) X-Google-Smtp-Source: APBJJlFV8RK48PgO8E67lZpIwCaRzNzSMp9R/9zpoJn2u3AsZWCdYSCgJ6H4BFmA/rKORBa9YqPH X-Received: by 2002:ac2:5b9c:0:b0:4fb:8f79:631 with SMTP id o28-20020ac25b9c000000b004fb8f790631mr214680lfn.46.1690820487020; Mon, 31 Jul 2023 09:21:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690820486; cv=none; d=google.com; s=arc-20160816; b=LhhXaUw5Y1tcHa4agXaYVqu8vNGWku9oB86mbGevmCZRPIyA1hNfiAIKe5dCwSzW7N 5bRMz6oYE4blONiaKhT3c7H7I16Bnp9Fw8AuOaJUMB5abWk8u84RABG34PeuY87NX5sK HEXOL6iUcsLUpNl7uScxNlXcQgPJoazywwZ5z8ARy0YqlBeOQVQBRHBoWEJq6JF0IrSf BWB0OMx3djk8hnhK4CgGZOan5+b6AZ6jTju39Epa0+lwbSXJOlzNeatGAkhK7VQVrp0O 8Re6jES6lHTIoJaDXRoSoitsvVn8szkCBU+f762bEjy8+lGmZ0xEDRJ0WRTdKSZlPNuL XMSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=752lY+0V7UW7gGjEaIVGPTeDkl3GzKXv+5Pc8DeJsOQ=; fh=jh+7v3szpfmpm7aeAZBeUyBAgjiSgOnhDPEhaInbk38=; b=lzSZ+dFbmNCiiusYrkXq08tTp96Np7+xEtPVnBaXdMaHRiS9pxCImzjA49b/DO9BUK s9jUcsxuwVzUr37EzChj3FdksHC+zNwvCrpviSQ1wRSe+K+jmKqGjIDu2YOZUJYWJA/Q 7lzir+tyrGQbSxTP6/hKxp0Upa0wMF+CDVfItT/mMs4xJayWSAP5X2rLL3AH8CCw0MZs g+dDmJ/Ue0zhkkCfPMKL5Pp0UvJnjF5kJQIwr0am3Dmcgvg1QlhmRwsgHkU2VtdIgegj jK3QhnZLfO6rMJUBF3+7bLaMiD/ASqM++nWxxoZj9xEInVxPv1Vj5aAd8yylFARolwcY 622Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=Rtk99JKI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b3-20020a1709062b4300b0098932a90cdasi7199996ejg.255.2023.07.31.09.21.02; Mon, 31 Jul 2023 09:21:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=Rtk99JKI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233038AbjGaNZx (ORCPT + 99 others); Mon, 31 Jul 2023 09:25:53 -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-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772953782784125941 X-GMAIL-MSGID: 1772953782784125941 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: 128713 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp2038190vqg; Mon, 31 Jul 2023 07:07:22 -0700 (PDT) X-Google-Smtp-Source: APBJJlHydNnEXwDMk94iUMBADKiGytYiz15b9PBbRLU4nZ1iljcB46Am6ZqPv31yn+i9raLdGHro X-Received: by 2002:a05:6a20:1596:b0:13d:bd0e:33d9 with SMTP id h22-20020a056a20159600b0013dbd0e33d9mr3042383pzj.47.1690812441882; Mon, 31 Jul 2023 07:07:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690812441; cv=none; d=google.com; s=arc-20160816; b=JM+0xUZULANLrTDfeN4WtQyWB7xQVV27pcI/M3TbD/0xLaESXU2Kd4b2T/M5bnwlKV MTcJsv7Rhsn0AxKclhXR2XFiC/TxpIsttvGvLkCOKtOKqD1Jjbx/rMsyZcE1ir8aKo0t ddsx+Kb8VEjVH+AQobVJ1WFfkLgThLLUCv9VH0yivapBzcw6ARDojFLKYjMhmOLa5BJG WVstqZihm0JIrnbMi4Lm3Xlh5ygueMWYb8uBJk3otp1I6ebOWjspxtNuocvTOUU7rQ2j onBCPEfsqV0nIxmowuweTg49pnZ8n4q2sJPWeHZUX07IpwXdIzaCb3g0lwWyhplGWSfR e/iQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=oDSk2OsIdJtp4w1QizWCplOl9JVG6LcAPGd+dWHt0i0=; fh=jh+7v3szpfmpm7aeAZBeUyBAgjiSgOnhDPEhaInbk38=; b=Np7APmAg7s9gIMka2SajqlGP5C581GzD55NjWcpD10jQ8HVPa97FIO+mv3sBLRFhG2 50kqRhHe9E9BmNTxTxHzPSJ/tu4gPGCUP7aEMO928fq2S4vd2A4+BeVpnFRuGLc+XJsp ZPS1hJoDVxslQoG4shvnjrl4eHoGcmGwjtWxpJqN8YiDz4vaYReXSWR+rHDUZeXLvey+ vbRfdxa8bG4VrZnt+Y6NeV7xvMgkAveOWSCDNqkn/WnaOw42nyrpsfz1yZksdv6LEL3Z Jc4DJNhdEt1CSjtiHP6Qkhy7NpFjhJ28th1S/SEGHftytLlFfbXbQ54KlHAJPWVPiAhq SX4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=IOHjXx6F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id eh11-20020a056a00808b00b00687207bce71si2866658pfb.357.2023.07.31.07.07.05; Mon, 31 Jul 2023 07:07:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=IOHjXx6F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233075AbjGaN0L (ORCPT + 99 others); Mon, 31 Jul 2023 09:26:11 -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-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772945346914677600 X-GMAIL-MSGID: 1772945346914677600 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,