Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp1623486rdb; Tue, 20 Feb 2024 01:43:22 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUE+x/RGtU6G3aflnY9LgcWO4QAeapWJ21xqFn0O5B2uVnNaO78qwE6gihb1e4bfvvCMRyhFfrM5tc8iyRsXEugnqHVtSBdHxD2TmuL0g== X-Google-Smtp-Source: AGHT+IEz5DTGnSLL3KbQZklb/kdA+qoi6OHGA/HI7gUrlJHBxAdvU7171VoViDuzScazMzgmTfWJ X-Received: by 2002:a25:ab2f:0:b0:dcc:aa1f:b418 with SMTP id u44-20020a25ab2f000000b00dccaa1fb418mr14545062ybi.1.1708422202254; Tue, 20 Feb 2024 01:43:22 -0800 (PST) Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id b13-20020a63340d000000b005d8bf0a91besi5740520pga.276.2024.02.20.01.43.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Feb 2024 01:43:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-72717-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@wolfvision.net header.s=selector2 header.b=Mht8sSpo; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-72717-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-72717-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=wolfvision.net Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id E23D5284DE0 for ; Tue, 20 Feb 2024 09:43:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6DE9065BD9; Tue, 20 Feb 2024 09:40:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=wolfvision.net header.i=@wolfvision.net header.b="Mht8sSpo" Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2128.outbound.protection.outlook.com [40.107.21.128]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8863F657CB; Tue, 20 Feb 2024 09:40:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.21.128 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708422019; cv=fail; b=kRVal6aIvWOm2rI0Pj1P4RLgNGtvI0QegvtqPZorDAKkvo5GmSGyt3eWhGmjgYHpl/zBwmFEo4AmPvZkZX4Rj1Oq6e+isqEVVIfcM9b6G7WcsagK+pOYr43YmVafbyrbBfsavW5RvKCwtYEp+gm2Ax1aCBGC43FrHs2eNQcKKM8= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708422019; c=relaxed/simple; bh=ou+V5Mg+cQK/+nx6chzqIuN6MNQRuWnEU7n6yunl2Vo=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=p7TZkIdCZtPozX48cvcpXKteWqNZmKzeNXey8h5MQPoeG1bI27gfgy/djeBA+sJEF0n8pNDkVKjjCjRQKRpWm0NMmtKJIjaiBAK2Pe0xntYKIiHn7E7tegVhGgJPH5tdRYcDdZsA4E0l21ek9zOujdqKatJIPoAlQPl+P4pl5Eo= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wolfvision.net; spf=pass smtp.mailfrom=wolfvision.net; dkim=pass (1024-bit key) header.d=wolfvision.net header.i=@wolfvision.net header.b=Mht8sSpo; arc=fail smtp.client-ip=40.107.21.128 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wolfvision.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wolfvision.net 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit 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) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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?B?dkg4NEpuVzJFbWpwN25YcTJzanBtc1N6dTBGcGNyRU5LTnlUeWc2RmFUMzRu?= =?utf-8?B?aXk1ZDFMclk2NlJmUG0vd3VYaFhBWEtCMWJtS24zTlhOS2orQlNuM1J3enZ3?= =?utf-8?B?V0ZzczlUK3FzcXFiN3lDU0R2VmhXVzhMb0hCTWNxV2ZWV2YyMXVGTGdmMTVL?= =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UQ0eWJoNnltVll2RWMvSktvL3dFR250c2hp?= =?utf-8?B?V2pKME5UdFNkWEtuR3lyTkJtbk16SlFWRUVKYmVPVVVrdDFhU3dHMnFwbGdO?= =?utf-8?B?anZxbU1Dck1uaWpNTXRhbWFqOGRaejFqSVpTL1RTYTJDVVBKOC9hMTd6U1JK?= =?utf-8?B?Ump0SklFV3RuckpyTHd6UDdCOGRveTdhRjhGT0kzQ295SVhFUGMxUVRaQVJ1?= =?utf-8?B?aEE9PQ==?= 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 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)); -- 2.30.2