Message ID | 20230731-upstream_csi-v8-1-fb7d3661c2c9@ti.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp1928793vqg; Mon, 31 Jul 2023 03:51:07 -0700 (PDT) X-Google-Smtp-Source: APBJJlGNSaKhuiX2E7Kz8Aikn5np7NwFfeD6277a1wkVolx6Zi2m2XDn3eug8slpqqVD0U+/a2qg X-Received: by 2002:a05:6870:2052:b0:1bb:85c3:929e with SMTP id l18-20020a056870205200b001bb85c3929emr9188863oad.48.1690800667652; Mon, 31 Jul 2023 03:51:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690800667; cv=none; d=google.com; s=arc-20160816; b=VQiN+ySx8GtK0qvit9hvE9etKkAT2/PcxhRXrO9yPAS5MHct0uZIg2CSHTyAuida7K BUfX+5pKGbPstZ61ut01+pnpz5LETXV+12sWbheiiXLEIjhAIMvpLj7f6w8B5NEM2aXz vwd70tqzLdH+rcn1TkrNogCyIOWi7xBjbz3gZobb+LgrT4XJAo2L7DkRPMQcScfeqRWF OjMdGJtpXOJrab4WmggwLDYYxYbmmy8C0JTe8K75JB5gpwR4pv8XWC0jnqT/GNeDhLrQ MebNcH2iK418Z57C39TrFzqVCOF6MibJ4vRB+tB61LWiUQMetO2j3/k8tX48onk2rJeU ZCaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=7rJDLj3T8cLCJQRX0eYplE/1TiRzoHqS/jXQuxRZZZ0=; fh=V3yzwYxt4PgbnoX3kc2m6CeiASFvGUTpa1ANjIQvoCg=; b=WvTHT0xEFyxwPMEBDozv7EbIg8MvBuCTOQLsjCNQxgafrl++1gU4aKOfdbg2sBBJ4U Vh9tjy2zvGXNwZ8WL9sAWfZ6bv+W3f8xbDegUC9O95wHz6nv6PDST6siVTeG/yjAAR0w Vxe6PGkLa3UuGkKjEfgi4476s6b03cXvXN4Vjo8LlizMwN1apC8pZe0s2fXd9ymM7T4q T/7WODzn9y6jS8LiW8W9tCyrUToJmkxP9GCeqFhrwxeOcpSSEh0EAnTM6bCU/1uXBGgU Ucpu3t4RrXHfFNJtYrFf0AzPv8/K0F056vydvSYxnlqXlXtAbVEIO20IQwbq2UP5WuX+ 3rdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=W5DOHI8Q; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w14-20020a63f50e000000b00563ee39a642si6994200pgh.308.2023.07.31.03.50.54; Mon, 31 Jul 2023 03:51:07 -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 header.i=@ti.com header.s=ti-com-17Q1 header.b=W5DOHI8Q; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230044AbjGaI3w (ORCPT <rfc822;dengxinlin2429@gmail.com> + 99 others); Mon, 31 Jul 2023 04:29:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229469AbjGaI3u (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 31 Jul 2023 04:29:50 -0400 Received: from fllv0015.ext.ti.com (fllv0015.ext.ti.com [198.47.19.141]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EDED8F3; Mon, 31 Jul 2023 01:29:48 -0700 (PDT) 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 <j-luthra@ti.com> To: Mauro Carvalho Chehab <mchehab@kernel.org>, Rob Herring <robh+dt@kernel.org>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>, Conor Dooley <conor+dt@kernel.org>, Sakari Ailus <sakari.ailus@linux.intel.com>, Laurent Pinchart <laurent.pinchart@ideasonboard.com>, Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> CC: <linux-media@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <devicetree@vger.kernel.org>, <linux-arm-kernel@lists.infradead.org>, Mauro Carvalho Chehab <mchehab+samsung@kernel.org>, Maxime Ripard <mripard@kernel.org>, <niklas.soderlund+renesas@ragnatech.se>, Benoit Parrot <bparrot@ti.com>, Vaishnav Achath <vaishnav.a@ti.com>, Vignesh Raghavendra <vigneshr@ti.com>, <nm@ti.com>, <devarsht@ti.com>, <j-luthra@ti.com> 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 Content-Type: text/plain; charset="utf-8" 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 Content-Transfer-Encoding: 8bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772933000654602138 X-GMAIL-MSGID: 1772933000654602138 |
Series |
CSI2RX support on J721E and AM62
|
|
Commit Message
Jai Luthra
July 31, 2023, 8:29 a.m. UTC
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 <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jai Luthra <j-luthra@ti.com>
---
New in v8
drivers/media/v4l2-core/v4l2-subdev.c | 8 ++++----
include/media/v4l2-subdev.h | 12 ++++++++++++
2 files changed, 16 insertions(+), 4 deletions(-)
Comments
On 31/07/2023 11:29, Jai Luthra wrote: > 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 <laurent.pinchart@ideasonboard.com> > Signed-off-by: Jai Luthra <j-luthra@ti.com> > --- > 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 > * > I don't know about this one... The v4l2_subdev_link_validate_get_format() is a bit of an internal function, especially with the relatively-new "states_locked" parameter. If it's made public, at least the "states_locked" should be renamed to "state_locked" (well, it could perhaps be renamed anyway). But just looking at the function doc above, I think the developer's question would be "what does this do?". What does "get format for media link validation" mean? Is it similar to v4l2_subdev_state_get_stream_format() or v4l2_subdev_get_pad_format()? What does states_locked do? How do you use this with multi-stream support? Do you lock the source, then validate all streams (with the help of this function), and then unlock? If yes, then all the states_locked stuff is extra, and all the function really does is v4l2_subdev_call(sd, pad, get_fmt, state, fmt). And if so, would it be clearer to just do that, instead of hiding it behind v4l2_subdev_link_validate_get_format()? Tomi
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 *