From patchwork Mon Jul 31 08:29:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jai Luthra X-Patchwork-Id: 13334012 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 39AB6C001DF for ; Mon, 31 Jul 2023 08:30:14 +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:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=n3LrKnCXQEtnJueorZ/1H4fE8YlQjm0Rw6UAu7a7T1g=; b=3Aue9/vQJjZTEP FOiwRQ4bERg5nH378aOK4IKczIx00P9F9kmOzfvSlxaXQPa0aDjdc2V0P3BIxQ+BTY+qS50iUQ1kd Jeaxw4PxcX/3VT/703lRAskIuOA7GPgLk/va/Yp/uIGHdvz1FxN4ePCkXYxYdTIYmdK6L7R2dWDTZ uF/6Sbp1fQ8n2ed9jV+VqusA0/ON2X6vuy0Mc+gyGYl6g1wTQ06E2RHNq32bN5OALfDX9l7NZOXBv 4nye37GspzmHuI2xPfaTfrLGY+dkaaOipJWY8Ih5x7tt6NgeWe4B14X3Hq3hoz/uuY4s6b+XlTSyQ X2asHb8cBEO/8+CWrYEw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qQOHl-00EX63-0s; Mon, 31 Jul 2023 08:29:49 +0000 Received: from fllv0015.ext.ti.com ([198.47.19.141]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qQOHg-00EX1I-0x for linux-arm-kernel@lists.infradead.org; Mon, 31 Jul 2023 08:29:47 +0000 Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 36V8TX6d054896; Mon, 31 Jul 2023 03:29:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1690792173; bh=7rJDLj3T8cLCJQRX0eYplE/1TiRzoHqS/jXQuxRZZZ0=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=W5DOHI8QC21ckSbmbrQr7600kMz9WleIB510bR3amjTN9bC2DXoTivNYxqDjxF6RB 9KXfGlZySXy5iYswDpHSI1xsRAxGclJ0qzHJuZ+C1JbLaAdnaM93rzdHGvTpQ8VIB9 GJYgeGijUF+ADA4bzxAunz+6w4MURMIY9ysfQPmo= Received: from DLEE112.ent.ti.com (dlee112.ent.ti.com [157.170.170.23]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 36V8TXeW011880 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 31 Jul 2023 03:29:33 -0500 Received: from DLEE104.ent.ti.com (157.170.170.34) by DLEE112.ent.ti.com (157.170.170.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Mon, 31 Jul 2023 03:29:33 -0500 Received: from fllv0040.itg.ti.com (10.64.41.20) by DLEE104.ent.ti.com (157.170.170.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Mon, 31 Jul 2023 03:29:33 -0500 Received: from localhost (ileaxei01-snat2.itg.ti.com [10.180.69.6]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id 36V8TWhr031919; Mon, 31 Jul 2023 03:29:33 -0500 From: Jai Luthra To: Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Sakari Ailus , Laurent Pinchart , Tomi Valkeinen CC: , , , , Mauro Carvalho Chehab , Maxime Ripard , , Benoit Parrot , Vaishnav Achath , Vignesh Raghavendra , , , Subject: [PATCH v8 01/16] media: subdev: Export get_format helper for link validation Date: Mon, 31 Jul 2023 13:59:19 +0530 Message-ID: <20230731-upstream_csi-v8-1-fb7d3661c2c9@ti.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230731-upstream_csi-v8-0-fb7d3661c2c9@ti.com> References: <20230731-upstream_csi-v8-0-fb7d3661c2c9@ti.com> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2383; i=j-luthra@ti.com; h=from:subject:message-id; bh=hchN4nU1yjfLjYGzib3vC33TVA07NDQjiP16zuMScbI=; b=owEBbQKS/ZANAwAIAUPekfkkmnFFAcsmYgBkx2xjGpyUeOHWpsroGlw9rL7Idjbhfh51R7P8D aptBltinqGJAjMEAAEIAB0WIQRN4NgY5dV16NRar8VD3pH5JJpxRQUCZMdsYwAKCRBD3pH5JJpx RQ/3EADD+iB9qv7H4CMzmtXtjHPb769+6dU4E34lrEfOXjnkPewgGcmXuSZxK0kS4N+Js9YpI0K oOs7ncrYn9PGE8yH59o0HzQv/vh2oHI1h7tlSTbVYNJ47+Naanrlw74QsUhFZtNPBAaVtQJEDAx TUgtdmMe69JSYxlRkiC1VX8Fcj8vWQy1hD9D3j94iOwbb1cdmHYgdHeSFL8yhauMgbqxOm8mP7t K4rpvBFpIitLj4taWYKfF4O7aptCm/sJC0cyyj1/2BLjEaAteOFprBaQwxEPceLoHkVy+EQgj2y BzbjqUO9fhkEJrbwbd2Pj1idWHP6GPkezs1STCRFSJz5JC23Lb+hSZEKUKJY3EO5TUud3+mStkY RAmXxWhe+4HA0VaUDP+ycnHC2+oOGeCb6QYL28DN3kQDRVykm8m7W2k/+a+JpRHuOnql3yV++5e ETqSP020tZA9FjZWBUuDp6h65V8dGA3BVfImvvc+SOybudNjL7oUzNVNmqyH6/zzTYehrpv+Q1v A99tSjMBdO/kkJdHZqQZgjlIaYnMl8t+ESIhckqikTkhoCmMNRxPFUBYv1bMOcE+1iubQsGsdSt qfkZNRwlWTSOrsAGC9cPf5iBMvIylS91MoDuk77BOTDSBW8IqehIzl/mbQ/gdgurEBQqaLlt8kA rY3oy0/TNHxRCjQ== X-Developer-Key: i=j-luthra@ti.com; a=openpgp; fpr=4DE0D818E5D575E8D45AAFC543DE91F9249A7145 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230731_012944_416633_5EE63802 X-CRM114-Status: GOOD ( 14.02 ) 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 For link validation on video device drivers, it may be required to match the formats set on the source subdev with the formats set on the video device. Export the existing v4l2_subdev_link_validate_get_format() helper so it can be reused by such drivers. Suggested-by: Laurent Pinchart Signed-off-by: Jai Luthra --- New in v8 drivers/media/v4l2-core/v4l2-subdev.c | 8 ++++---- include/media/v4l2-subdev.h | 12 ++++++++++++ 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c index 217b8019fb9b..0d3b5ff5cacc 100644 --- a/drivers/media/v4l2-core/v4l2-subdev.c +++ b/drivers/media/v4l2-core/v4l2-subdev.c @@ -1130,10 +1130,9 @@ int v4l2_subdev_link_validate_default(struct v4l2_subdev *sd, } EXPORT_SYMBOL_GPL(v4l2_subdev_link_validate_default); -static int -v4l2_subdev_link_validate_get_format(struct media_pad *pad, u32 stream, - struct v4l2_subdev_format *fmt, - bool states_locked) +int v4l2_subdev_link_validate_get_format(struct media_pad *pad, u32 stream, + struct v4l2_subdev_format *fmt, + bool states_locked) { struct v4l2_subdev_state *state; struct v4l2_subdev *sd; @@ -1165,6 +1164,7 @@ v4l2_subdev_link_validate_get_format(struct media_pad *pad, u32 stream, return ret; } +EXPORT_SYMBOL_GPL(v4l2_subdev_link_validate_get_format); #if defined(CONFIG_VIDEO_V4L2_SUBDEV_API) diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h index a012741cc876..ef7007f46889 100644 --- a/include/media/v4l2-subdev.h +++ b/include/media/v4l2-subdev.h @@ -1301,6 +1301,18 @@ int v4l2_subdev_link_validate_default(struct v4l2_subdev *sd, struct v4l2_subdev_format *source_fmt, struct v4l2_subdev_format *sink_fmt); +/** + * v4l2_subdev_link_validate_get_format - get format for media link validation + * + * @pad: pad id + * @stream: stream id + * @fmt: pointer to &struct v4l2_subdev_format + * @states_locked: is the subdev state already locked + */ +int v4l2_subdev_link_validate_get_format(struct media_pad *pad, u32 stream, + struct v4l2_subdev_format *fmt, + bool states_locked); + /** * v4l2_subdev_link_validate - validates a media link *