Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp362654ybt; Wed, 24 Jun 2020 00:51:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJySPZ/tR8KG/B5F4e2MsFjPQJ5wHFld9uW6CQkJJF4GNg/pVmNLugIJDvE3aZuqDMhBu2Vv X-Received: by 2002:a17:907:72ca:: with SMTP id du10mr23601952ejc.78.1592985075524; Wed, 24 Jun 2020 00:51:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592985075; cv=none; d=google.com; s=arc-20160816; b=SVPAp+nKK6gVM2vAXKuLOi63RAxsUNsdckUrPOvEaQEkCY6PUw9ABWsmxW3Q2iyN7W tu5mo8Ka/asYyFKdmiFMRo3dzOTVoRtqhQMG7EJuoB7MBOX+2AwZ7HQQUeNv65HjhDJi RCpnmR7lUknhtNBHTbTLPPVpy3HhOkIUrluM1TYULXxccPV9de7bomPkYh1hFsT4e5ZI GJeJg3+GEwvRb3+VfU5a79R3Dv6JjNyElZbCj8WPJ5lSyNsBFW8+sb/m8MaFmteYwnmD dBlJzxUzeDQ51IW/MFfPrr2+xDIR8L7zCf7uJBYOT7XDoQ2shiqjHw/bgGttQUT8TPLn gCTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=Oz9yFAK24Opjsuumn5VKGZmQCiFrpkVdTg4reYIvbko=; b=hlajZZjqjoyJlgJHUQJM25/R6aPfq8aJsKcjbgXWb7yb9DCfk0oGrjGqxrpODZKHjI HeSbUKnGSjiuGi194E9At5tW0i4HOuM1KaWT7QlkeVaIqt8iWzR1TnEJF7KcffsnFUBg 8Mk0Ra0Z7jcgOt9oLtZQAoaRMAUcJD04SwZFuxSs2U7AHyRRtri4L8oKFrNifVvocMAA 1aPUJAgQv0Wck0n7Aamo7R0AaYqJBeF9EYVH3Az0U5HA7zWA4163wS6/v/jB4LN53sDU lVTWUvL8KECJgsHURa+daLwcIBJZd5eLCejaY5Xp7edHBCvAcW//yI5m8I4ukFaIHfgl a3fQ== 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 c94si5863963edf.589.2020.06.24.00.50.51; Wed, 24 Jun 2020 00:51:15 -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 S2390066AbgFXHts (ORCPT + 99 others); Wed, 24 Jun 2020 03:49:48 -0400 Received: from relay8-d.mail.gandi.net ([217.70.183.201]:34891 "EHLO relay8-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390013AbgFXHtq (ORCPT ); Wed, 24 Jun 2020 03:49:46 -0400 X-Originating-IP: 93.34.118.233 Received: from uno.localdomain (93-34-118-233.ip49.fastwebnet.it [93.34.118.233]) (Authenticated sender: jacopo@jmondi.org) by relay8-d.mail.gandi.net (Postfix) with ESMTPSA id 3E14E1BF210; Wed, 24 Jun 2020 07:49:39 +0000 (UTC) Date: Wed, 24 Jun 2020 09:53:07 +0200 From: Jacopo Mondi To: Ramzi BEN MEFTAH , niklas soderlund , Laurent Pinchart Cc: Kieran Bingham , Mauro Carvalho Chehab , Hans Verkuil , Sakari Ailus , Janusz Krzysztofik , Steve Longerbeam , Ezequiel Garcia , Arnd Bergmann , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Michael Rodin , efriedrich@de.adit-jv.com, erosca@de.adit-jv.com Subject: Re: [PATCH 1/3] v4l2-subdev: Add subdev ioctl support for ENUM/GET/SET INPUT Message-ID: <20200624075307.hl6wew7vr5ue225t@uno.localdomain> References: <1592301619-17631-1-git-send-email-rbmeftah@de.adit-jv.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1592301619-17631-1-git-send-email-rbmeftah@de.adit-jv.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello 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 ? Thanks j > 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, > -- > 2.7.4 >