From patchwork Tue Feb 20 09:39:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Riesch X-Patchwork-Id: 13563807 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 2B9DEC48BC3 for ; Tue, 20 Feb 2024 09:42:37 +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=+s+5XN+RpPTtCB4u96NSgsunWTLhhrlLDruHFSjY2Co=; b=gkrWKXSt7pPu4XJzdjQixuVqzS AlH1uHIsvXI7FDeQWMZ+TYEOAZQYUQFAV9L03a/XpQncq9sUQkarj07iBIgMFRw5BxAZJwKg+S9RF 1d1JmDWIaXDNXOZh8C7zMElRjQVeDyoL5prclpaY5fcDfndIbjKVt5XJtuBGeW6CykCZnZjL1VrUR KWtNc7DjS8l0D6H/3gwfLw/AdnTaVih4Vy66s7aSDF8zAyvbKjIcpYcepJlBz7mUB2WnlQ7YlhwjK 3FupGizOnR1d+us0HMMH3N0aV2sOhzUuoOHDv0a5JuXSiUIcVGy636wXmkzGrwzdedMZEjOXzl5X+ PLvrHCTQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rcMdt-0000000E3b7-2sLV; Tue, 20 Feb 2024 09:42:25 +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 1rcMbn-0000000E230-2fFi; Tue, 20 Feb 2024 09:40:17 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KKWe6bFh9cAH+94w+AbuhM3iFkn20rYxgbdw6xqEhW1ItLO1sA7o/c2/0cQCFzjw2NdHDRpIAgOtRX2/vBhL39HkNUxY0wdlHOtmM430geHlwtQmlivcLsuASDrEbWRqP4jWLEu0g8o/zCC+D5ZqK+c5l4XKpdZlfr6y4wDZ9YD10UwHNvUzLCW+V4hG3vkWyaITOnSN7WbEJX+dVpG/L1CSxPJEws71lvYCLdABxQUntT/f0+L6w9AUwz5kddcJcHrXc0d6e9I0jfJoKMI1vskqH1hpPVwxdbTsEvO8rmhUx6OB+GEcIHu+QpQoscSqzH97a58TNFzh7BoMmo5k+w== 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=ahXRRa2Auy1r3diPOfLqPhufT0OndywK4ZL0NrIqr/M=; b=ezkkFNgGvwEIExv8PjHIRh9x+JoPlt0d0fMPOlY003DzvKMODbxLY4BDf6eXBWg9vaSeGaP89nIAPh6MzhIr4CoIGe/IW/N8DYO1IFXTLp+cxDGAULHQhI/6zYIYzna/EBab/y3yz3efTjU8As378PzhbkDg57Joss5trRPPNUku1shi0bvrGQQb4O2ItXsCxtfEnJCv7VjsuWlwC8JcsUWAPilNRAeVqglzeB9oKTRt5xLwehj1imbrvC8fpVWftXR9DPgOnbSrAk44edCeOXmeUONizv5hJt4H2bZI0ZhcSR8qWEYtpB8jwE5V+gFGrneJ7MvP5u7KmTLwPIUdsQ== 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=ahXRRa2Auy1r3diPOfLqPhufT0OndywK4ZL0NrIqr/M=; b=mZMDjyegSuDsL0VxrvHBGksdjzKWRdPliEdfVJZEwSaYd/x0BLd1eJNn51SsCqvOdH7InpmhSCTCIlCKnZL1ssk6HkT+WQIDQqT5up8zXr/WKxpbabA6AInz7S0wyM7IXCkx7d1jk0ZLDKyVMvvJ3LK4n3iqk8zvXrlGKiKAkTY= 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:08 +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:08 +0000 From: Michael Riesch Date: Tue, 20 Feb 2024 10:39:16 +0100 Subject: [PATCH 06/14] media: rockchip: cif: store endpoint information in private data Message-Id: <20240220-v6-8-topic-rk3568-vicap-v1-6-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=2185; i=michael.riesch@wolfvision.net; s=20230803; h=from:subject:message-id; bh=WQGjonJHv4SJS+dxX3SFBxVGNyfcDP/0ER7RyY5D3Kw=; b=WXoZn0yvOgKVLCymY/AHQSSrbLy6vL0OWA4pStXSuqLRA7xCxgonAdLk1YFJ6mn8szqHh5Mht eoV/bvgzs2DCcbyK5WhbHufMoN5msIqhi51ISghE87RTdhVwjAl4fsm 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: dbde50d9-4ab0-4f8a-8760-08dc31f7ecef X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JyteNDqjePRcLM2tjdJTUYUs9/Bep2k9YU2xeIFa9vG4E7/Q+WRqzYGhTwfNmHrgHXfDXyvIrisi9KgNB6IBlWHZUDd5zIdCueZCN9kacHGlo0YgN8fOAhBsKjcWaiUBgXFAlABe0k7GRW9LiPHjKOiUXZNr86tYFedlbkmGk8w8aooeVMCaJfREwWtT4S/eM6zhoDQDlPntcsiQm5D4H8NK0XfozHYixDsnn3MfKIf+Qmb6plYpj0rOYbEUSBklNELEpL0uxmRqH5cycfaLUd0DsviUlLh+Naf3IABZsf/2sAjzYsH20u1SxjxPxxkjKbsGeRA9fQ94Zv9AWkR7ut+rpJ6yajM6kIknekyGcfL5vsMwv6UsZw572K6e83R7if61nt9mY1tnb5a5iEoQ+uZf1XlyfxA9CuJ8GPToSHvBMEM3AXjwGPmrWRM4g1+cIxapQn4SyXW4KkyirU0Y5y2vj+dGTe2vauWJrK2+h7nAsItG3XNoZEtT0gSRlj1/z9YV9RVgJo9Ai7u6epydgWsCgNSUxg+7UQaP2EWLGe4nvdfG9rlwofkSpy+ZdRlw/wEPO6bsLZ4tK9rgdetEswuRxBNF9ZYsHZttxixYvlIActpgOhFjFrHMdIKdNx+t6+p9o6iXWM9t3nqjvuzZ5Q== 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?dkOWtNTvjZoslsldB7/YmZRkk2ks?= =?utf-8?q?2a8s3ZqJqeQuvdtVgHQoi0GsXHL+Oy+L+cq8pLsMQ367YfdKNyj9Qu2woM4O7Wyvs?= =?utf-8?q?JKg5mc9yGfxB0ziSfqOnuRvjdSbmRdPBY9zOOuSP/oR3lDuNHS3Cfa6UU6KTSeHgm?= =?utf-8?q?ogbrtlfyHfBOeJRyzPnPPGna8KpIP+Zyeis85Z/YXDKGAQSzIr2c/d2/PnIrjdTqI?= =?utf-8?q?bic9UL7eW1bagp7zffM6csAMzUqaFKlKRiFmMCgqJRoP+T3WSnb9D97G2LXE6C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f-8?q?dymp08LtxSgH6ffWRs5jczfPMo2TWSHSpGU6g3/5Ny7Sgri/eQVDBVRmLaqpv5YyI?= =?utf-8?q?MeMub4EmcVRmITNVSyLyQx38Y20Ns9v/gu1UV8ll378WBY9QHvvNvWzTZVdaSHR8+?= =?utf-8?q?h8tq9HuSpJGg9qEF4SdXuseGr5hhl/SqK38S6e8/q8B6WWmaSd27VxymGczXnrpt9?= =?utf-8?q?ELJFNxqJf1/m6LyMRms/GqHM9sCEia3jjzj3AKtdJ0rDCYASgnXKmb3+Nl3OQCYAH?= =?utf-8?q?elq/dk+nYTRzCh44z0eKa3vF4blh4/T2EKB0vDyg17jLqifqUjho/tB7op5JNYQeC?= =?utf-8?q?cfzKJUFoVWw9W90FHJR+FYmvWK0HlU89dKVL5AFOppRqIro6+TC1wTgvWE0Vtc2A5?= =?utf-8?q?OFa+z9e13tzM0mWLR0jX88AbAD6+J9pNMA=3D=3D?= X-OriginatorOrg: wolfvision.net X-MS-Exchange-CrossTenant-Network-Message-Id: dbde50d9-4ab0-4f8a-8760-08dc31f7ecef 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:08.2511 (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: ugH9ifatd4iBYxTgqqOVJ5pN4NNtoDbBYLlR9e4oYswyTWhrOodBuPv+G9umUwm7+oTPDbs49Xm7ZcH4xxsQMbIn2U5X/HZxduViKxWfwbI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB6763 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240220_014015_714827_8F350E93 X-CRM114-Status: GOOD ( 14.29 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The endpoint information such as bus width or flags are required to set CIF (and on certain variants GRF) registers correctly. Store the information in the private data of the driver in order to make it accessible. Signed-off-by: Michael Riesch --- drivers/media/platform/rockchip/cif/cif-common.h | 1 + drivers/media/platform/rockchip/cif/cif-dev.c | 11 +++++------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/media/platform/rockchip/cif/cif-common.h b/drivers/media/platform/rockchip/cif/cif-common.h index 89ed9dd6f36d..34da800a0504 100644 --- a/drivers/media/platform/rockchip/cif/cif-common.h +++ b/drivers/media/platform/rockchip/cif/cif-common.h @@ -108,6 +108,7 @@ struct cif_device { struct media_device media_dev; struct v4l2_async_notifier notifier; struct v4l2_async_connection asd; + struct v4l2_fwnode_endpoint vep; struct cif_remote remote; struct cif_stream stream; diff --git a/drivers/media/platform/rockchip/cif/cif-dev.c b/drivers/media/platform/rockchip/cif/cif-dev.c index 660e28397916..923831827be4 100644 --- a/drivers/media/platform/rockchip/cif/cif-dev.c +++ b/drivers/media/platform/rockchip/cif/cif-dev.c @@ -79,9 +79,7 @@ static int cif_subdev_notifier(struct cif_device *cif_dev) struct v4l2_async_notifier *ntf = &cif_dev->notifier; struct device *dev = cif_dev->dev; struct v4l2_async_connection *asd; - struct v4l2_fwnode_endpoint vep = { - .bus_type = V4L2_MBUS_UNKNOWN, - }; + struct v4l2_fwnode_endpoint *vep = &cif_dev->vep; struct fwnode_handle *ep; int ret; @@ -92,12 +90,13 @@ static int cif_subdev_notifier(struct cif_device *cif_dev) if (!ep) return -ENODEV; - ret = v4l2_fwnode_endpoint_parse(ep, &vep); + vep->bus_type = V4L2_MBUS_UNKNOWN; + ret = v4l2_fwnode_endpoint_parse(ep, vep); if (ret) goto complete; - if (vep.bus_type != V4L2_MBUS_BT656 && - vep.bus_type != V4L2_MBUS_PARALLEL) { + if (vep->bus_type != V4L2_MBUS_BT656 && + vep->bus_type != V4L2_MBUS_PARALLEL) { v4l2_err(&cif_dev->v4l2_dev, "unsupported bus type\n"); goto complete; }