From patchwork Sun Jan 15 12:40:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 43848 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp737012wrn; Sun, 15 Jan 2023 05:24:20 -0800 (PST) X-Google-Smtp-Source: AMrXdXtJIiV+TBk3ysZYzxqTYQPwZCOjYVePAhZcHeAISyXR400Lx82dAYS8l9qU5jZJ+sD5St3l X-Received: by 2002:a17:906:fad8:b0:84d:141f:6784 with SMTP id lu24-20020a170906fad800b0084d141f6784mr9345319ejb.29.1673789060270; Sun, 15 Jan 2023 05:24:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673789060; cv=none; d=google.com; s=arc-20160816; b=WBjXWcvVGFnP1OECwtZVTMk1blR9Beso63MNdzJUIoVkOS0oYf71mVXnpVUTi6MBrN VI+ROqmo8ETpEDTdMXKXn6zl5bNQQiku8xhoN+wkjK8E8Ph4gKXL+sLCCZhRzx/wJ1GW C2T0VNQGnKMVO3PnXpKLQaivuEbud94YDFw4E4uLXBDbWByjIlbK+RHh6CNDXnQUGKHb 3/hvgw9IfQfJBcH49JKPz/Fj5BpmYo6sZ+CIYEq/rrYRr6OPAUUEwWr407HdMO2TKgDk 4EgMF0zC5nwdc4Ws+EOrRRWmmomANJWhWl+2kd/JJPOVaOnmMv7dgqVqvolC07BtXsi5 kWqQ== 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=To/5x/vD3z+SeHJukD0AWIxnCQV6qEXV/ROIZpZ9UFU=; b=02aYB493opAvsgVcdJ5a0BX2Xb+46wYY0JxhUac17tN/Q1bT2GaZQBBn4m3CFjiNv6 Nx4Hkwk4AzjApEyoJ0yFo412Cf3RoWzMwww1FNAAHzNGpZW/R1+xzEraYMxcSn4bgtwR Pqu4/UtOhOJmT/mOlJkiwsOU5hSiJNDZpOR7vZGzPZsZhVaHQdHntnVSYBmh9G1lLBXZ 1XLQ/XbSc/SLKpokde7sct1pa82ZWGD+7fxR7J9bSORs+9ME/rK0lIEoWlvR8nCN3b0/ 67lV+ZZiArEeIy4aIhsvAxVFPNBpd+cgsMN4MT0ve4m1RPcRmIoUxSqGilmWoc2LRqxr ogJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=PdTeF4BN; 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 jg20-20020a170907971400b0086e054bfd10si4693882ejc.173.2023.01.15.05.23.56; Sun, 15 Jan 2023 05:24:20 -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=PdTeF4BN; 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 S231374AbjAOMkw (ORCPT + 99 others); Sun, 15 Jan 2023 07:40:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231346AbjAOMku (ORCPT ); Sun, 15 Jan 2023 07:40:50 -0500 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E48A6EC57; Sun, 15 Jan 2023 04:40:49 -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 D717B308; Sun, 15 Jan 2023 13:40:45 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1673786446; bh=Gk1qa6CCnI/c7OGD8JV4Gc+RUJW+6//3P/tTEV+Yl9s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PdTeF4BNzA50MWulZA8sEZCN9t5mKuXIK14ItS3+yfFYymWCgLAchWjF/WkhsolXi pzwQifnHSHzng3GRHUWlAKvULcCaW/yD6/pKpWTxG5A55DGm0wyEJ5dVboOMQBPc04 ajPBWLGSOt0MFemHlZlUun3RlVsKRIVOfaJvBQSg= From: Tomi Valkeinen To: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, sakari.ailus@linux.intel.com, Jacopo Mondi , Laurent Pinchart , niklas.soderlund+renesas@ragnatech.se, Mauro Carvalho Chehab , Hans Verkuil , satish.nagireddy@getcruise.com, Tomasz Figa Cc: Tomi Valkeinen Subject: [PATCH v16.1] media: subdev: Require code change to enable [GS]_ROUTING Date: Sun, 15 Jan 2023 14:40:08 +0200 Message-Id: <20230115124008.293634-1-tomi.valkeinen@ideasonboard.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221215121634.287100-7-tomi.valkeinen@ideasonboard.com> References: <20221215121634.287100-7-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?1752282418679241892?= X-GMAIL-MSGID: =?utf-8?q?1755095037928878733?= Streams API is an experimental feature. To use Streams API, the user needs to change a variable in v4l2-subdev.c and recompile the kernel. This commit should be reverted when the Streams API is deemed ready for production use. Signed-off-by: Tomi Valkeinen Reviewed-by: Laurent Pinchart --- Here's a minor update to the patch: - Fix unused var warning - Don't initialize the static var to 0 drivers/media/v4l2-core/v4l2-subdev.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c index 61b429016a2f..a576b22164b0 100644 --- a/drivers/media/v4l2-core/v4l2-subdev.c +++ b/drivers/media/v4l2-core/v4l2-subdev.c @@ -23,6 +23,15 @@ #include #include +#if defined(CONFIG_VIDEO_V4L2_SUBDEV_API) +/* + * Streams API is an experimental feature. To use Streams API, set + * 'v4l2_subdev_enable_streams_api' to 1 below. + */ + +static bool v4l2_subdev_enable_streams_api; +#endif + /* * Maximum stream ID is 63 for now, as we use u64 bitmask to represent a set * of streams. @@ -751,6 +760,9 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg, struct v4l2_subdev_routing *routing = arg; struct v4l2_subdev_krouting *krouting; + if (!v4l2_subdev_enable_streams_api) + return -ENOIOCTLCMD; + if (!(sd->flags & V4L2_SUBDEV_FL_STREAMS)) return -ENOIOCTLCMD; @@ -778,6 +790,9 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg, struct v4l2_subdev_krouting krouting = {}; unsigned int i; + if (!v4l2_subdev_enable_streams_api) + return -ENOIOCTLCMD; + if (!(sd->flags & V4L2_SUBDEV_FL_STREAMS)) return -ENOIOCTLCMD;