From patchwork Thu Feb 16 14:07:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 58089 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2388:b0:96:219d:e725 with SMTP id i8csp545880dyf; Thu, 16 Feb 2023 06:10:47 -0800 (PST) X-Google-Smtp-Source: AK7set/8x8QJjFs6eBpty1ntY4FNDYUh8a3nzcr6l672YMDl6hsFPAvsxglWs/cskK5XlqQI1Uhf X-Received: by 2002:aa7:cd55:0:b0:4ac:c426:6b44 with SMTP id v21-20020aa7cd55000000b004acc4266b44mr5869820edw.4.1676556646809; Thu, 16 Feb 2023 06:10:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676556646; cv=none; d=google.com; s=arc-20160816; b=uI1tHLAVYMz21aeo2oS+WK9BNh9pwqgKk3f0cDxuyGr/ZXN8HwDgE5z9fblDHBwd9N iBNlGJSwYs1Q4CKi+1kSSq497Fdso9PUt6PViecqhHQsRY6L/x7YBi8fBKrMFSK20rVf ylbZT6AMgEIGiTlJU/p/q/Q/Mdxpe9Ds2Kv6UC4eoHdSYhVOysymXuXjsxucBK+I7hS5 47KpjP+XegyZEKKSHs6AJX89R0GPmM9VQZSDQvePEvMLCDc4UvgR4+UQqt2juwcH7bK7 jpz65S+KNqcx9MNBMIninfVtssB1QWzyktqp5Ub47gqW81HfDpyTLz2tndbnR0mdLVBm PDpQ== 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=LJ2hJ/NnNXfMv3UA55bia0GkJ7ypfcy73/ilQtr8bhs=; b=CjU43o+XrxvN9ODT8jkGBbT1J6B330fwhot39kOVlk5KZsoSQPuUquZ/iz668RYBZo SZO2qXpt0w1yrQbloUHn3yi9deN4qCsE0i5ZJqpZbzDf/l4vz6UKEdRyjyh6ev6hUGL+ YF8rWMWHIYII6tq3bXgnMoWTq9QjQQMFDDzMTNFIzlGDLYOL4UdQLFrJuYj1XKYWLleC SR9od1Rd/gXqxlXgpNkreFE17qxkJJrXmPLn9zigiYlxeU+Wuq8zp6/fBrpsD2Cd1Ux9 iCKPL+DV+ks5Rr0c3FM8RtHr9PFokz+AElIHSnC+Nlr8aPC+9IRidZBJ08e6Czgadxns iYuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=Z4KYURzg; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v7-20020aa7d9c7000000b004ad09c397b1si2111824eds.587.2023.02.16.06.10.23; Thu, 16 Feb 2023 06:10:46 -0800 (PST) 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 (test mode) header.i=@ideasonboard.com header.s=mail header.b=Z4KYURzg; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229941AbjBPOIQ (ORCPT + 99 others); Thu, 16 Feb 2023 09:08:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229853AbjBPOIM (ORCPT ); Thu, 16 Feb 2023 09:08:12 -0500 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3638C2CC41; Thu, 16 Feb 2023 06:08:11 -0800 (PST) Received: from desky.lan (91-154-32-225.elisa-laajakaista.fi [91.154.32.225]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 0664498C; Thu, 16 Feb 2023 15:08:04 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1676556486; bh=TbPvGI7NZtIJIpon+x4zlSgixLL32JJXXqY12n8FdQ4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z4KYURzg/DQTs/pplAPB/blO1j8IUej13ysnasZSxhZtlCmIMYe/v5cp2LKiEvwqr fe42FG7z0DIJNiDhumph+C6YMI3EW1XMR1+WkwrWVmJx/QQ4j2WbIaOUYIE0zJpcUx t4uTb6wDAdnV+0KJTFn8s9Do4kQ7JgG7fhIsb1NY= From: Tomi Valkeinen To: linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, Rob Herring , Krzysztof Kozlowski , Wolfram Sang , Luca Ceresoli , Andy Shevchenko , Matti Vaittinen , Laurent Pinchart Cc: Mauro Carvalho Chehab , Peter Rosin , Liam Girdwood , Mark Brown , Sakari Ailus , Michael Tretter , Shawn Tu , Hans Verkuil , Mike Pagano , =?utf-8?q?Krzysztof_Ha=C5=82asa?= , Marek Vasut , Satish Nagireddy , Tomi Valkeinen Subject: [PATCH v9 2/8] media: subdev: Split V4L2_SUBDEV_ROUTING_NO_STREAM_MIX Date: Thu, 16 Feb 2023 16:07:41 +0200 Message-Id: <20230216140747.445477-3-tomi.valkeinen@ideasonboard.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230216140747.445477-1-tomi.valkeinen@ideasonboard.com> References: <20230216140747.445477-1-tomi.valkeinen@ideasonboard.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757997062067855692?= X-GMAIL-MSGID: =?utf-8?q?1757997062067855692?= V4L2_SUBDEV_ROUTING_NO_STREAM_MIX routing validation flag means that all routes from a sink pad must go to the same source pad and all routes going to the same source pad must originate from the same sink pad. This does not cover all use cases. For example, if a device routes all streams from a single sink pad to any of the source pads, but streams from multiple sink pads can go to the same source pad, the current flag is too restrictive. Split the flag into two parts, V4L2_SUBDEV_ROUTING_NO_SINK_STREAM_MIX and V4L2_SUBDEV_ROUTING_NO_SOURCE_STREAM_MIX, which add the restriction only on one side of the device. Together they mean the same as V4L2_SUBDEV_ROUTING_NO_STREAM_MIX. Signed-off-by: Tomi Valkeinen --- drivers/media/v4l2-core/v4l2-subdev.c | 17 +++++++++++++---- include/media/v4l2-subdev.h | 16 +++++++++++++--- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c index dd3c2d86f96e..e513b859a7df 100644 --- a/drivers/media/v4l2-core/v4l2-subdev.c +++ b/drivers/media/v4l2-core/v4l2-subdev.c @@ -1661,10 +1661,11 @@ int v4l2_subdev_routing_validate(struct v4l2_subdev *sd, } /* - * V4L2_SUBDEV_ROUTING_NO_STREAM_MIX: Streams on the same pad - * may not be routed to streams on different pads. + * V4L2_SUBDEV_ROUTING_NO_SINK_STREAM_MIX: Streams on the same + * sink pad may not be routed to streams on different source + * pads. */ - if (disallow & V4L2_SUBDEV_ROUTING_NO_STREAM_MIX) { + if (disallow & V4L2_SUBDEV_ROUTING_NO_SINK_STREAM_MIX) { if (remote_pads[route->sink_pad] != U32_MAX && remote_pads[route->sink_pad] != route->source_pad) { dev_dbg(sd->dev, @@ -1673,6 +1674,15 @@ int v4l2_subdev_routing_validate(struct v4l2_subdev *sd, goto out; } + remote_pads[route->sink_pad] = route->source_pad; + } + + /* + * V4L2_SUBDEV_ROUTING_NO_SOURCE_STREAM_MIX: Streams on the same + * source pad may not be routed to streams on different sink + * pads. + */ + if (disallow & V4L2_SUBDEV_ROUTING_NO_SOURCE_STREAM_MIX) { if (remote_pads[route->source_pad] != U32_MAX && remote_pads[route->source_pad] != route->sink_pad) { dev_dbg(sd->dev, @@ -1681,7 +1691,6 @@ int v4l2_subdev_routing_validate(struct v4l2_subdev *sd, goto out; } - remote_pads[route->sink_pad] = route->source_pad; remote_pads[route->source_pad] = route->sink_pad; } diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h index 6a77aa9bb1da..f11103122e53 100644 --- a/include/media/v4l2-subdev.h +++ b/include/media/v4l2-subdev.h @@ -1638,19 +1638,29 @@ u64 v4l2_subdev_state_xlate_streams(const struct v4l2_subdev_state *state, * @V4L2_SUBDEV_ROUTING_NO_N_TO_1: * multiple input streams may not be routed to the same output stream * (stream merging) - * @V4L2_SUBDEV_ROUTING_NO_STREAM_MIX: - * streams on the same pad may not be routed to streams on different pads + * @V4L2_SUBDEV_ROUTING_NO_SINK_STREAM_MIX: + * streams on the same sink pad may not be routed to streams on different + * source pads + * @V4L2_SUBDEV_ROUTING_NO_SOURCE_STREAM_MIX: + * streams on the same source pad may not be routed to streams on different + * sink pads * @V4L2_SUBDEV_ROUTING_ONLY_1_TO_1: * only non-overlapping 1-to-1 stream routing is allowed (a combination of * @V4L2_SUBDEV_ROUTING_NO_1_TO_N and @V4L2_SUBDEV_ROUTING_NO_N_TO_1) + * @V4L2_SUBDEV_ROUTING_NO_STREAM_MIX: + * streams on the same pad may not be routed to streams on different pads */ enum v4l2_subdev_routing_restriction { V4L2_SUBDEV_ROUTING_NO_1_TO_N = BIT(0), V4L2_SUBDEV_ROUTING_NO_N_TO_1 = BIT(1), - V4L2_SUBDEV_ROUTING_NO_STREAM_MIX = BIT(2), + V4L2_SUBDEV_ROUTING_NO_SINK_STREAM_MIX = BIT(2), + V4L2_SUBDEV_ROUTING_NO_SOURCE_STREAM_MIX = BIT(3), V4L2_SUBDEV_ROUTING_ONLY_1_TO_1 = V4L2_SUBDEV_ROUTING_NO_1_TO_N | V4L2_SUBDEV_ROUTING_NO_N_TO_1, + V4L2_SUBDEV_ROUTING_NO_STREAM_MIX = + V4L2_SUBDEV_ROUTING_NO_SINK_STREAM_MIX | + V4L2_SUBDEV_ROUTING_NO_SOURCE_STREAM_MIX, }; /**