From patchwork Thu Dec 15 12:16:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 33591 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp315984wrn; Thu, 15 Dec 2022 04:18:53 -0800 (PST) X-Google-Smtp-Source: AA0mqf7aOG9JndpQITy2Tk50Xf/Sb0fPtwCeOc6NQCo8kr9xEwTONoUIADoxsAdx3qiPo2gG74Hr X-Received: by 2002:a62:5241:0:b0:576:450d:6e68 with SMTP id g62-20020a625241000000b00576450d6e68mr25511470pfb.27.1671106733471; Thu, 15 Dec 2022 04:18:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671106733; cv=none; d=google.com; s=arc-20160816; b=oeztbRfcZYHT9O8fjxYPTmLTaRJ62TZVGYuKvQt2rzs0gVjkCvB8m4ap6viayiUzc8 1G0xO13ROJIgC2t2/7VfTo/AUTBr5jK4KzftyMD7pYNmFmaEVR2mdaoOOmm0Ocha4p7S ++3QYmVScnQ6sRmjdw9osLZESwtqznC122/QbyjbALlSk55UOtUafliewXN+UPuyuOU+ kQgXvsyFIqIPuNj53sytKYnnTVK+RJmacg4d2A5cGN6f1gBefq59tHaTZvoXymwQS9MP DBEQRMSKIc7eACODk07ph6KuN4LA8g5k28m13a2bm6RZiqUiS8G2W/lAh9As5Mx/WXCh T+rw== 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=JzAFGWDgGMniOXi5427TnhS3f7vksKJErbtrXBmZvNY=; b=gpWtzZ5d0A1r6Dh4fRFnCsicjOH75ChozzE45ecqvGmZrwvZiBxqzxpNC00Hlpdb3i GLVPPm7XOAYBA7SmpKmyUAOtnIf0xnS49ytUlIqHnoaxofErd18kR1NL/K+vh+1Ti2U0 87TkVci0hDwYn+MjxHTqGFFxmFlTtRSMJ8z2rcydP+va/86dSvhRqwzmTaw0azMHdvFJ rhfdbUbAe21rD383LvnI0UtMAhuTdqvUbDvDz82RxS8jx+2hofWqc4i7XqsSSzpq8jH4 2fn2yKiAmSM54wWOSmKcotyIKpKOm/zjdsk/OZOaeu07GNSlw7uVYIDDcSUTN2FPJAY0 kYSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=Gk93o5Ha; 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 a8-20020aa78e88000000b00563a0453c55si2520664pfr.268.2022.12.15.04.18.40; Thu, 15 Dec 2022 04:18:53 -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=Gk93o5Ha; 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 S230230AbiLOMRZ (ORCPT + 99 others); Thu, 15 Dec 2022 07:17:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230163AbiLOMRL (ORCPT ); Thu, 15 Dec 2022 07:17:11 -0500 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5C6D2E9DE; Thu, 15 Dec 2022 04:17:10 -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 221221837; Thu, 15 Dec 2022 13:17:08 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1671106628; bh=Cbv0CfEc2onUj77PJDrZ/pV314ETPod9lBOtQKlyLVQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Gk93o5HaH3B0Gl3eR2nsQOB8OJvEkIABaUsx63mMm77J/AToRaA4PctyeezeqZSJh TLHzFxhyu/98HyQcusHJg4ZM2Z5bup1XGiN43KVREhpSLvABiTV6T4REsFOn79djiS Usd6n/uxMRJu0j4wGnKbJP8d/Ps/JfUziZxbC4C8= 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 03/20] media: add V4L2_SUBDEV_CAP_STREAMS Date: Thu, 15 Dec 2022 14:16:17 +0200 Message-Id: <20221215121634.287100-4-tomi.valkeinen@ideasonboard.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221215121634.287100-1-tomi.valkeinen@ideasonboard.com> References: <20221215121634.287100-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?1752282413838691644?= X-GMAIL-MSGID: =?utf-8?q?1752282413838691644?= Add a subdev capability flag to expose to userspace if a subdev supports multiplexed streams. Signed-off-by: Tomi Valkeinen --- drivers/media/v4l2-core/v4l2-subdev.c | 5 ++++- include/uapi/linux/v4l2-subdev.h | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c index ca5b764d796d..8983d33fdb4b 100644 --- a/drivers/media/v4l2-core/v4l2-subdev.c +++ b/drivers/media/v4l2-core/v4l2-subdev.c @@ -431,6 +431,7 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg, struct v4l2_subdev *sd = vdev_to_v4l2_subdev(vdev); struct v4l2_fh *vfh = file->private_data; bool ro_subdev = test_bit(V4L2_FL_SUBDEV_RO_DEVNODE, &vdev->flags); + bool streams_subdev = sd->flags & V4L2_SUBDEV_FL_STREAMS; int rval; switch (cmd) { @@ -439,7 +440,9 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg, memset(cap->reserved, 0, sizeof(cap->reserved)); cap->version = LINUX_VERSION_CODE; - cap->capabilities = ro_subdev ? V4L2_SUBDEV_CAP_RO_SUBDEV : 0; + cap->capabilities = + (ro_subdev ? V4L2_SUBDEV_CAP_RO_SUBDEV : 0) | + (streams_subdev ? V4L2_SUBDEV_CAP_STREAMS : 0); return 0; } diff --git a/include/uapi/linux/v4l2-subdev.h b/include/uapi/linux/v4l2-subdev.h index 658106f5b5dc..89af27f50a41 100644 --- a/include/uapi/linux/v4l2-subdev.h +++ b/include/uapi/linux/v4l2-subdev.h @@ -188,6 +188,9 @@ struct v4l2_subdev_capability { /* The v4l2 sub-device video device node is registered in read-only mode. */ #define V4L2_SUBDEV_CAP_RO_SUBDEV 0x00000001 +/* The v4l2 sub-device supports routing and multiplexed streams. */ +#define V4L2_SUBDEV_CAP_STREAMS 0x00000002 + /* Backwards compatibility define --- to be removed */ #define v4l2_subdev_edid v4l2_edid