From patchwork Tue Feb 20 09:39:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Riesch X-Patchwork-Id: 13563774 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1066FC48BC3 for ; Tue, 20 Feb 2024 09:41:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Cc:To:In-Reply-To: References:Message-Id:Subject:Date:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=JbHyAIfEVYkO0Xk/WzMJBee8ROgp0fIM+dLRLS/ABmQ=; b=Rp1EKf6gbmtTJE92U//SqxS8A0 ILBXXgBJsTYmhTNqP1b+n954uHJmWUUkjnw3ryqm+8qzIS0xlPE6T3uCNkbjVcuS53gGaN+5uqEpu 4GN8KLG0oNrTHbmMXKwg+6H/tinxkztXAAuQGs8Z6Fqx3P0iuocZN9hKdVqUvYtTpc4FCT4CeIU7b w/IVdd8J5CgrXPYg1WvRZRTIjfceZRtEcxK4icIOOrCECvNks+qGA0+E4bUiDZlDakK23vtIra1wB 5G6bvJ742qJnwinOXZzjZ932f+BVuNH5O0TzGOkkHSheCKAx8fXBZVP/5D+7LZTW2DaE+EK8nE0oB Ld/E4phA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rcMct-0000000E31i-04s3; Tue, 20 Feb 2024 09:41:23 +0000 Received: from mail-he1eur04on20700.outbound.protection.outlook.com ([2a01:111:f403:260f::700] helo=EUR04-HE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rcMby-0000000E230-01WL; Tue, 20 Feb 2024 09:40:29 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YIMBx1WolY0Mmn3zYBb35/NEROcPigAlFjtJCYkGmcsREKiZGOOU1Bv0t1VgpaenGgSyT5uue6mbbIxoF6skGzG21GLXqieoCJNWGpWIX1xOZepUINH7NZYVT7P2oJbI/M8fx+pBAF7+yclYcpxn5UvbJIX50I+Q0cyxLcvsLYQ+/fBuJndy2RjVybEmG8+aCxm3WC/r8/5qNc88QqDBp2a795FAkSgSwyJu+cYT6XbHDy2hmryXaLJUsMPCiXpZFkY+Otqk5dpdx7fPv9pqNmBMPKFcfHXCJJ3vWT4iRpNmLyONocNy1KZVCrUFh3DRPvRSTkFecdYjfEiIjfyEpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=CYHmj6K+Yw2I1Wxuq6WyAkSBG52uQ7q3/Hw6yocyE/A=; b=C48DRYD4xXpUjji6HyfqRl4KvK2apkvObqz/yZZeIxVRq1BiLFV/He4GvCSzoEmpjg2KlowpeCo4eXpAqUHm+KmGV0HQaT90I771lKDB+iEnkyjV/OTOcJvd3N+91q7SIKxwpVVUObFKHkUPYfWU8HJQy2foBqy4NLIYIigSOVpJX8lInkOlBuO5ECdcM5azU6w9UafdId/qVFScLHxqx10lEJcr3XToWaFF6FfmzsssgEuyFTRbAjv5MltSOtA/EmuBWic4YHYRKqBYk0bvjMsxfmr0dLrVoBapAUQAYrbRGE4oBufPpmqnZUZaCfGnDt8WGnwuMQfa1hxqv1WnGQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=wolfvision.net; dmarc=pass action=none header.from=wolfvision.net; dkim=pass header.d=wolfvision.net; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wolfvision.net; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CYHmj6K+Yw2I1Wxuq6WyAkSBG52uQ7q3/Hw6yocyE/A=; b=Mht8sSpo+/x8xLAavFwI41IlgCbA9Fe5MABFWvwVJzeoo8oxxdOd2Hz2tQVERIiDub8XLS4vR+gGuz7lI80GEYAL0WH8gcN7UnH7n3RtfFupnsRgOts6+S8yYJvfwq/gFILB8d/Hz87wJQ5uPXXL7GYDoHrmm1c5mqsPX7yyUlo= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=wolfvision.net; Received: from DU0PR08MB9155.eurprd08.prod.outlook.com (2603:10a6:10:416::5) by DB9PR08MB6763.eurprd08.prod.outlook.com (2603:10a6:10:2af::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.39; Tue, 20 Feb 2024 09:40:14 +0000 Received: from DU0PR08MB9155.eurprd08.prod.outlook.com ([fe80::7409:db60:8209:c9f4]) by DU0PR08MB9155.eurprd08.prod.outlook.com ([fe80::7409:db60:8209:c9f4%6]) with mapi id 15.20.7270.043; Tue, 20 Feb 2024 09:40:14 +0000 From: Michael Riesch Date: Tue, 20 Feb 2024 10:39:19 +0100 Subject: [PATCH 09/14] media: rockchip: cif: add support for grf Message-Id: <20240220-v6-8-topic-rk3568-vicap-v1-9-2680a1fa640b@wolfvision.net> References: <20240220-v6-8-topic-rk3568-vicap-v1-0-2680a1fa640b@wolfvision.net> In-Reply-To: <20240220-v6-8-topic-rk3568-vicap-v1-0-2680a1fa640b@wolfvision.net> To: Mehdi Djait , =?utf-8?q?Th=C3=A9o_Lebrun?= , Thomas Petazzoni , Laurent Pinchart , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Heiko Stuebner , Sakari Ailus Cc: linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, Michael Riesch X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1708421995; l=2405; i=michael.riesch@wolfvision.net; s=20230803; h=from:subject:message-id; bh=ou+V5Mg+cQK/+nx6chzqIuN6MNQRuWnEU7n6yunl2Vo=; b=UhFzY5PlVTRDbx2zhAFD/+wl3qGXUYSTlRxtBvmokC5BVMJ/wBk1raT8A+xpQ+9ftwWuDQUIq es5posc4+TUBUXICGo60PEqVWxC2h8GdBb+5JO3+2rPDwdGcCJfqKx6 X-Developer-Key: i=michael.riesch@wolfvision.net; a=ed25519; pk=9ral3sulLe95bLcbaiNXTgUTRiBayRBEFZ5OVIEHp+0= X-ClientProxiedBy: VI1PR04CA0128.eurprd04.prod.outlook.com (2603:10a6:803:f0::26) To DU0PR08MB9155.eurprd08.prod.outlook.com (2603:10a6:10:416::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0PR08MB9155:EE_|DB9PR08MB6763:EE_ X-MS-Office365-Filtering-Correlation-Id: 603c4d07-d2aa-48cf-0fe6-08dc31f7f087 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: IS5Nu/mrRmrS/DanQQNS8u3lBnPujwwqp4e1yNVuDWfRdjJ120kF53yTmjbecyCeiN4Z7VH6TV1DEnRKgxfMwoMyqvbl43E1zH9AXVaIgEqR5w9wPVrC9c9lr8uyEH+vsO8c8W8ItAmIm7e/0THg5HqQAUajW51eyXUtArS+mkS2YKCwnmZPFp4KSQT2ZYKUBK3/GtTmpavghiTvFEn/+K4E/pRuqPhU2up1YqZHfmc9EeGwhO8JNmlnpulDoAv3h5msV6E/dnGs0CI8TU49LXA8VfKb763wtJdj9k+PUBevT43S48vu145+sHYmr+b/+gC3Rlx6fMZWe9dkKISVTthDjD5wyUs4P1t0Tj3/pmGnRYBXzl51LePW1edm8wlIGj0clLMVFdhQAfBwq5J5RNK83F56oHeZesDcWFEpN1a3v7mzQZ/El9T5gYgJK1AUHfg+WALVQcpc3kI3/ZOag5eIuAUH7tHKLYAFj1k+FnaL9qvy6CE10FV43Pw1m1IJN2vc0XLqFlj2lDZqh9/c00hcZ/h6NG+wo4F4HbwS3oRyIsu4pQYAR9ciPZ1V55Hx4eFWcPUQonjn/Ee08tDMlHReWPsOZp9JRBEXK2YpsOo/q8gANloElcpu3w2fILGK8+cpaKqTU+d0v8eszYXwGA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU0PR08MB9155.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(921011)(38350700005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?vH84JnW2Emjp7nXq2sjpmsSzu0Fp?= =?utf-8?q?crENKNyTyg6FaT34niy5d1LrY66RfPm/wuXhXAXKB1bmKn3NXNKj+BSn3RwzvwWFs?= =?utf-8?q?s9T+qsqqb7yCSDvVhWW8LoHBMcqWfVWf21uFLgf15KfRtKpX9ngRwnRsZ7fHUPRm3?= =?utf-8?q?fIZcwYHfkwG2VFhr9Tvlwbn8TsEN2+ysKpy4/F74O1Tvor16PG9KokqYSuWHfdZGK?= =?utf-8?q?xR+M49LmGSHhmVVC0Yo0IwDgBHHwLsYLlVE1LC/eBOPJM34GLyjHg/92MBSMQP2Vm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8?q?GJILd3nlwAp8N9aoNvKql2l4De24jssOzQ6P4u6+HcUzP34XHXVjtOkWZam31J4c6?= =?utf-8?q?QInsBd6+ZV1+tn6LL9g4+mZDZz3+fGDiPu/tRCwULJ7J200pkiuX0suby+hFFhYN0?= =?utf-8?q?lPGQwITmFqsznN9Bn19oSO6S9Cbh9XzusGJwtsBCwsXffAI0xf1ty5IWTTwhSAxID?= =?utf-8?q?vFgjcqhx53CLYGMkVMoVdOESq4gFH3SkK7mEYPZTmS4c0CRUTHXxdnXlvdwjXwGvo?= =?utf-8?q?mD4ybh6ymVYvEc/JKo/wEGntshiWjJ0NTtSdXKnGyrNBmnMzJQVEEJbeOUUkt1aSw?= =?utf-8?q?G2qplgNjvqmMCrMnijMMtamaj8dZz1jIZS/TSa2CUPJ8/a17zSRJRjtJIEWtnrJrL?= =?utf-8?q?wzP7B8doy7aF8FOI3CoyIXEPc1QTZARuhA=3D=3D?= X-OriginatorOrg: wolfvision.net X-MS-Exchange-CrossTenant-Network-Message-Id: 603c4d07-d2aa-48cf-0fe6-08dc31f7f087 X-MS-Exchange-CrossTenant-AuthSource: DU0PR08MB9155.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Feb 2024 09:40:14.2829 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: e94ec9da-9183-471e-83b3-51baa8eb804f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: sjtYwmDdpx0UER9CPusNJeZ77948ImjIjKQQvcGaxGMurQO96mwSIb4Gsaq1dZ49MDGiQiHAcQ0dG5JitktTir3Ren2p+IuUuol0Pr/YXnY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB6763 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240220_014026_245471_331C623A X-CRM114-Status: GOOD ( 12.55 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org Some variants of the Rockchip CIF require the General Register File for video input block control. Signed-off-by: Michael Riesch --- drivers/media/platform/rockchip/cif/cif-common.h | 3 +++ drivers/media/platform/rockchip/cif/cif-dev.c | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/drivers/media/platform/rockchip/cif/cif-common.h b/drivers/media/platform/rockchip/cif/cif-common.h index 34da800a0504..ae8fedeadd1c 100644 --- a/drivers/media/platform/rockchip/cif/cif-common.h +++ b/drivers/media/platform/rockchip/cif/cif-common.h @@ -11,6 +11,7 @@ #include #include +#include #include #include @@ -96,6 +97,7 @@ static inline struct cif_stream *to_cif_stream(struct video_device *vdev) struct cif_match_data { struct clk_bulk_data *clks; int clks_num; + void (*grf_dvp_setup)(struct cif_device *cif_dev); }; struct cif_device { @@ -103,6 +105,7 @@ struct cif_device { int irq; void __iomem *base_addr; struct reset_control *cif_rst; + struct regmap *grf; struct v4l2_device v4l2_dev; struct media_device media_dev; diff --git a/drivers/media/platform/rockchip/cif/cif-dev.c b/drivers/media/platform/rockchip/cif/cif-dev.c index c4282449a93d..b75b76508793 100644 --- a/drivers/media/platform/rockchip/cif/cif-dev.c +++ b/drivers/media/platform/rockchip/cif/cif-dev.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -103,6 +104,9 @@ static int cif_subdev_notifier(struct cif_device *cif_dev) goto complete; } + if (cif_dev->match_data->grf_dvp_setup) + cif_dev->match_data->grf_dvp_setup(cif_dev); + asd = v4l2_async_nf_add_fwnode_remote(ntf, ep, struct v4l2_async_connection); if (IS_ERR(asd)) { @@ -191,6 +195,9 @@ static int cif_plat_probe(struct platform_device *pdev) if (IS_ERR(cif_dev->cif_rst)) return PTR_ERR(cif_dev->cif_rst); + cif_dev->grf = syscon_regmap_lookup_by_phandle(dev->of_node, + "rockchip,grf"); + cif_stream_init(cif_dev); strscpy(cif_dev->media_dev.model, "cif", sizeof(cif_dev->media_dev.model));