Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2973961ybt; Mon, 29 Jun 2020 11:52:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyQglpieKkNh7X10aptq2JbwsPAPsm5FDobLO2GlHfXfG46cqdkcKbSbM3enE9ZBwBp70+w X-Received: by 2002:a17:906:60d0:: with SMTP id f16mr11156467ejk.17.1593456752063; Mon, 29 Jun 2020 11:52:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593456752; cv=none; d=google.com; s=arc-20160816; b=Idad1nAWult+ks1jkDhStIu2OJeKKDOxEvrvCwBh8TOzMCvUjp8HRr5PChpgwc7xBI Fy1a4HrvH+a2THLtqNYNk8ab8O6jvlA67Lw/0zBUa0U52G5Gj1Tcd1zOftDAEaUo4qSp dQuiYpOPxdLPgbnWaM+DMi0yb3LHlOgreTDXJ6wdTTlzhCs0D6xzpTDraGJ5nJCdkWIc 26vhk0s0Kp+bCKeek7FzGUaog7XWyyC8fFZE8oABMlmjTSLQFdAuWtp2M3g30lqYJppD UvE16cQJn1OKtVslCDNEGDMZkazTfLAequPXlN/pX7HE2vyZ997I72i+r2bG1b75uGva 9ISA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=bjjIVxTg6VachZ5wFV9w/QK4/y+eAxMMFOqJANmg+lc=; b=k+StNQ53Wq8P2jCMV0FrzUw5tMae2yeGwP1+fqvflIiQB1fRKR2gOqd3tvOXaPZlWL nzYCuK6h60kIuom6pigs+QUjDJz7XOQLg+JQwepAFrocnFX4smzyvtWowSKllWSm7tg2 y/E5vi9NzPKLN7semv0X+MtwlJ3YFrdi7XoXbbz56uIQ1TWdnLXvW6OA0n0s+Wye2BBa M+bB6WMu2ZERNOr4JXDISBn+JWa/hnlShEJ4Y65Y8B1nft8iCCdXQ1bH4Pne9+/DvLA4 cgYtMiksj4fCTLGvEl6dCrLwTwBlQmWjFBbhrw1YVuYH/o67Cej6e7e6Sfa45lmU5F+q jXkw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ok24si283946ejb.491.2020.06.29.11.52.07; Mon, 29 Jun 2020 11:52:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729724AbgF2SwF (ORCPT + 99 others); Mon, 29 Jun 2020 14:52:05 -0400 Received: from smtp1.de.adit-jv.com ([93.241.18.167]:55815 "EHLO smtp1.de.adit-jv.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729716AbgF2Sv7 (ORCPT ); Mon, 29 Jun 2020 14:51:59 -0400 Received: from localhost (smtp1.de.adit-jv.com [127.0.0.1]) by smtp1.de.adit-jv.com (Postfix) with ESMTP id EFC963C0588; Mon, 29 Jun 2020 11:24:22 +0200 (CEST) Received: from smtp1.de.adit-jv.com ([127.0.0.1]) by localhost (smtp1.de.adit-jv.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3LZ3PyHkiLPo; Mon, 29 Jun 2020 11:24:18 +0200 (CEST) Received: from HI2EXCH01.adit-jv.com (hi2exch01.adit-jv.com [10.72.92.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by smtp1.de.adit-jv.com (Postfix) with ESMTPS id 274483C0585; Mon, 29 Jun 2020 11:24:18 +0200 (CEST) Received: from vmlxhi-110.adit-jv.com (10.72.93.196) by HI2EXCH01.adit-jv.com (10.72.92.24) with Microsoft SMTP Server (TLS) id 14.3.487.0; Mon, 29 Jun 2020 11:24:17 +0200 Date: Mon, 29 Jun 2020 11:24:13 +0200 From: Ramzi Ben Meftah To: Laurent Pinchart CC: Steve Longerbeam , Jacopo Mondi , Ramzi BEN MEFTAH , niklas soderlund , Kieran Bingham , Mauro Carvalho Chehab , Hans Verkuil , Sakari Ailus , Janusz Krzysztofik , Ezequiel Garcia , Arnd Bergmann , , , Michael Rodin , , Subject: Re: [PATCH 1/3] v4l2-subdev: Add subdev ioctl support for ENUM/GET/SET INPUT Message-ID: <20200629092413.GA84958@vmlxhi-110.adit-jv.com> References: <1592301619-17631-1-git-send-email-rbmeftah@de.adit-jv.com> <20200624075307.hl6wew7vr5ue225t@uno.localdomain> <20200625020138.GW5980@pendragon.ideasonboard.com> <20200626011251.GP5865@pendragon.ideasonboard.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20200626011251.GP5865@pendragon.ideasonboard.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-Originating-IP: [10.72.93.196] Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Laurent, On Fri, Jun 26, 2020 at 04:12:51AM +0300, Laurent Pinchart wrote: > Hi Steve, > > On Thu, Jun 25, 2020 at 10:41:09AM -0700, Steve Longerbeam wrote: > > On 6/24/20 7:01 PM, Laurent Pinchart wrote: > > > On Wed, Jun 24, 2020 at 09:53:07AM +0200, Jacopo Mondi wrote: > > >> On Tue, Jun 16, 2020 at 12:00:15PM +0200, Ramzi BEN MEFTAH wrote: > > >>> From: Steve Longerbeam > > >> +Niklas, +Laurent > > >> > > >> Niklas, Laurent, how does this play with CAP_IO_MC ? > > > I don't think it's related to CAP_IO_MC, but I don't think it's a good > > > idea either :-) Routing doesn't go through the subdev [gs]_input > > > operations in MC-based drivers. It should be configured through link > > > setup instead. This patch goes in the wrong direction, sorry Steve. > > > > That's OK! :) I didn't submit this patch, and as stated in the commit > > header, I never recommended this patch be submitted to upstream in the > > first place. > > > > Selecting inputs at a subdev should normally make use of media link > > setup. But for selecting analog signal inputs, such as the ADV748x AFE > > standard definition inputs, that would  mean there would need to exist > > source "analog" subdevs that connect to the AFE inputs, if only for the > > purpose of selecting those inputs, which seems silly IMHO. The ADV748x > > AFE subdev defines these inputs as media pads, but have no connections, > > so link setup API can't be used to select those inputs. > > > > So a new subdev pad API is clearly needed, not just to get input status > > at a subdev pad, but to select/make active such analog inputs without > > requiring link setup API. > > There was an attempt to create a subdev ioctl to configure internal > routing. See "[PATCH v4 19/31] media: Documentation: Add GS_ROUTING > documentation" ([1]) and the related patches in the series. > > [1] https://lore.kernel.org/linux-media/20190328200608.9463-20-jacopo+renesas@jmondi.org/ > I was thinking why not just allowing linking pads of the same media entity. This will avoid adding a new control, and will do the same as S_INPUT ioctl. > > >>> This commit enables VIDIOC_ENUMINPUT, VIDIOC_G_INPUT, and VIDIOC_S_INPUT > > >>> ioctls for use via v4l2 subdevice node. > > >>> > > >>> This commit should probably not be pushed upstream, because the (old) > > >>> idea of video inputs conflicts with the newer concept of establishing > > >>> media links between src->sink pads. > > >>> > > >>> However it might make sense for some subdevices to support enum/get/set > > >>> inputs. One example would be the analog front end subdevice for the > > >>> ADV748x. By providing these ioctls, selecting the ADV748x analog inputs > > >>> can be done without requiring the implementation of media entities that > > >>> would define the analog source for which to establish a media link. > > >>> > > >>> Signed-off-by: Steve Longerbeam > > >>> --- > > >>> drivers/media/v4l2-core/v4l2-subdev.c | 9 +++++++++ > > >>> include/media/v4l2-subdev.h | 11 +++++++++++ > > >>> 2 files changed, 20 insertions(+) > > >>> > > >>> diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c > > >>> index 6b989fe..73fbfe9 100644 > > >>> --- a/drivers/media/v4l2-core/v4l2-subdev.c > > >>> +++ b/drivers/media/v4l2-core/v4l2-subdev.c > > >>> @@ -378,6 +378,15 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg) > > >>> return -ENOTTY; > > >>> return v4l2_querymenu(vfh->ctrl_handler, arg); > > >>> > > >>> + case VIDIOC_ENUMINPUT: > > >>> + return v4l2_subdev_call(sd, video, enuminput, arg); > > >>> + > > >>> + case VIDIOC_G_INPUT: > > >>> + return v4l2_subdev_call(sd, video, g_input, arg); > > >>> + > > >>> + case VIDIOC_S_INPUT: > > >>> + return v4l2_subdev_call(sd, video, s_input, *(u32 *)arg); > > >>> + > > >>> case VIDIOC_G_CTRL: > > >>> if (!vfh->ctrl_handler) > > >>> return -ENOTTY; > > >>> diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h > > >>> index f7fe78a..6e1a9cd 100644 > > >>> --- a/include/media/v4l2-subdev.h > > >>> +++ b/include/media/v4l2-subdev.h > > >>> @@ -383,6 +383,14 @@ struct v4l2_mbus_frame_desc { > > >>> * @g_input_status: get input status. Same as the status field in the > > >>> * &struct &v4l2_input > > >>> * > > >>> + * @enuminput: enumerate inputs. Should return the same input status as > > >>> + * @g_input_status if the passed input index is the currently active > > >>> + * input. > > >>> + * > > >>> + * @g_input: returns the currently active input index. > > >>> + * > > >>> + * @s_input: set the active input. > > >>> + * > > >>> * @s_stream: used to notify the driver that a video stream will start or has > > >>> * stopped. > > >>> * > > >>> @@ -423,6 +431,9 @@ struct v4l2_subdev_video_ops { > > >>> int (*g_tvnorms)(struct v4l2_subdev *sd, v4l2_std_id *std); > > >>> int (*g_tvnorms_output)(struct v4l2_subdev *sd, v4l2_std_id *std); > > >>> int (*g_input_status)(struct v4l2_subdev *sd, u32 *status); > > >>> + int (*enuminput)(struct v4l2_subdev *sd, struct v4l2_input *input); > > >>> + int (*g_input)(struct v4l2_subdev *sd, u32 *index); > > >>> + int (*s_input)(struct v4l2_subdev *sd, u32 index); > > >>> int (*s_stream)(struct v4l2_subdev *sd, int enable); > > >>> int (*g_pixelaspect)(struct v4l2_subdev *sd, struct v4l2_fract *aspect); > > >>> int (*g_frame_interval)(struct v4l2_subdev *sd, > > > > -- > Regards, > > Laurent Pinchart -- Best Regards, Ramzi Ben Meftah.