Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp450763ybt; Wed, 24 Jun 2020 03:19:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwSQ00U3otGbhuOkInto5my86Sq5pGnFuHa6PeSJlxkScRagBsun6+yUw0mgivmojZqoDp4 X-Received: by 2002:a17:906:958f:: with SMTP id r15mr10966783ejx.77.1592993987818; Wed, 24 Jun 2020 03:19:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592993987; cv=none; d=google.com; s=arc-20160816; b=lNxoBjiNrE7x+2qyHU4ZiRonk85+CKeJCRFpXX0fTfb39zaMiWrqEcO4kACzuWFvve HloXK8ud/4DffqnFQ9qqgI0WWVpcl46XcK2wUmcZNzAb28kV6QyLx3FKM8HVwZTfy0d/ DY7d1CS20Itoplf1VQPWiPrknS/Qw7jU1h0T2/o0mkdukUG3yrcfqcr4UJ2hklQA59b9 0jySaMHxRG14wUrMHjhsRJIIWauP6JAktdKMX76TaNi1TtgYt7TUJlVU14c3obcLNMK9 /R5+ebhZ0td/cRc9JX3KvZnwvemt2tMre6R2ME/m07Zbz5cBT/k87scNSzK9siHg4rYq v23Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:references:cc:to:from:subject:dkim-signature; bh=dTrkPOhP9OEblUbJ6sxH+uNo185PXfKyVBQch1+IaBQ=; b=SL1HGVHUgrHfLjfmyFw+SlsRtlpXl4wJYEn4QSnOn460xz6POyyMjmw64APdcXoJ30 TsQB5QByZ7uI4sZ9KQz47AA1Wae6zIxjCz9uty6xID8Du3oX///bsSfVJXTkIg1YptCV 16M5iG5LTsEFrSjufIA//ESv96jwDGEhpU8XxYOZjet35TnAVzczbYmEa3EFUl4b3TNc RqkxuBL9/j8onEaJeZDyoQ1TlltkbjQ5Vd3Eiaq9wNH6LzMCe70f0JKQ8yTCcTkj9SwE c6+CMMrt9JeEzjIJESLovMdcazqqpG6ULyGAvuuNXH0yDDYcxYEUa6BFWPhhMoHO08fR LphQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@xs4all.nl header.s=s1 header.b="TtD0zw/T"; 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 q17si7361329edc.298.2020.06.24.03.19.23; Wed, 24 Jun 2020 03:19:47 -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; dkim=pass header.i=@xs4all.nl header.s=s1 header.b="TtD0zw/T"; 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 S2388532AbgFXKQk (ORCPT + 99 others); Wed, 24 Jun 2020 06:16:40 -0400 Received: from lb3-smtp-cloud7.xs4all.net ([194.109.24.31]:57965 "EHLO lb3-smtp-cloud7.xs4all.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387962AbgFXKQk (ORCPT ); Wed, 24 Jun 2020 06:16:40 -0400 Received: from cust-b5b5937f ([IPv6:fc0c:c16d:66b8:757f:c639:739b:9d66:799d]) by smtp-cloud7.xs4all.net with ESMTPA id o2SHjtNNrx3Ajo2SKjit7o; Wed, 24 Jun 2020 12:16:37 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xs4all.nl; s=s1; t=1592993797; bh=dTrkPOhP9OEblUbJ6sxH+uNo185PXfKyVBQch1+IaBQ=; h=Subject:From:To:Message-ID:Date:MIME-Version:Content-Type:From: Subject; b=TtD0zw/T5kwEbY9lxN3GUUhVYf+JKYycv02PavNAyOZRW7jdpL87368RO++nHs3X+ O9S2xxciPr3Fu6WUHSGGCgoU1cepOJ1TweQkH1LUrq6YLSmpWG1jTm0cQAoVzD9//M nqTAFPaT4sqfTHq230yvBGukXKNNuLrkehKBm1n5tijY3Z8dujz4PYUEl8giHRxdWX K0n1zjf9QKdQupSF1QPTMVtSEZiJH4+r5UVtkXViIiNz35P6A3nw6HQbQs8Jpdddvh tQQHq8vZNEX64bpi3zCuib9rDnCRpWfvWMUQdiYViNiBnvfouLc1nVv/O24x2le5rA cynqHp9m3jZbA== Subject: Re: [PATCH 1/3] v4l2-subdev: Add subdev ioctl support for ENUM/GET/SET INPUT From: Hans Verkuil To: Ramzi BEN MEFTAH , Kieran Bingham , Mauro Carvalho Chehab , Sakari Ailus , Janusz Krzysztofik , Jacopo Mondi , Steve Longerbeam , Ezequiel Garcia , Arnd Bergmann , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Michael Rodin , efriedrich@de.adit-jv.com, erosca@de.adit-jv.com References: <1592301619-17631-1-git-send-email-rbmeftah@de.adit-jv.com> <32cdf1a3-1353-d3e9-66b6-82ced163d8f8@xs4all.nl> Message-ID: Date: Wed, 24 Jun 2020 12:16:33 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: <32cdf1a3-1353-d3e9-66b6-82ced163d8f8@xs4all.nl> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-CMAE-Envelope: MS4wfPD8p6E/bxNdK79QwTZHHOQ4YjMlsjCCwNQ5xIW+7DdpeA++iQUfsI/TsnR+5CtWOQ7ExrSd7etNlEk6wjrc922oI4wo4aGl3QEQIt/v0fD8IicEH1Bp waXXc6Y69bM0CTviLJ2msol4gmQE+lH9cLUghPhP1VWOoowFmYSLT4PhkkTgn4NUuXzFQFFPl6p14XIQFrnfHOLe0slHzOlaj0f1WYlkmbF1XLIFWTpNRJl8 nA+P8J1ne2ZyyRWqzcYg0esieF0ZYf2yAd27lE2tPGb6oHa86EuOcBkYi6hdnwzOLU0voEdnDSPbW36POfXqiFXNdwohOh8cdof/GTWJYSjUnRSa8CtsHZln CVN7VPXrAZuhhMJaaWn4315RrRA9FxqnxRieKEPqlagdEcpV/DnQzctng+6UohX2d4W+1GkG/uCwSlJymIcHqoJ4JsfLa7ZEMsJzfqyw8UtJn13DR+TpoXgX +usbmbJiHAAzMQC47ZuRF/Xb7bDwenlWqwsM2R4MgZcOAlQ+3LA3J84qgahLVcx9DXrT+UyADYfADZHs/ckX4Joe24xjNefuUaV4xyprKeDxcFj4UaTzqog/ hLQvqLs9LPMqITJgQLg6pmXzitOky7s6tLNquiRHwtw9dQ== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 24/06/2020 12:08, Hans Verkuil wrote: > On 16/06/2020 12:00, Ramzi BEN MEFTAH wrote: >> From: Steve Longerbeam >> >> 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 > > Nacked-by: Hans Verkuil > > This doesn't work: these ioctls refer to physical inputs on a backplane > of a device. But subdevices have no idea about that. This is high-level > information that is typically only known to a bridge driver based on > board information. > > For PCI/USB drivers this comes from card definitions in the driver itself. > > For platform drivers this should come from the device tree, but this hasn't > been fully implemented yet. > > So if this is something that you want to implement, then look at: > > Documentation/devicetree/bindings/display/connector/hdmi-connector.txt > > and add this to the DT for your board, and implement code to query this > in the platform driver. Follow-up: in system with a media device and v4l-subdev devices (so MC-centric) this might make sense, provided the connector data is obtained from the DT. An alternative is to expose the connectors in the media topology and use SETUP_LINK to choose which connector to pick. I don't have a strong preference, but in both cases this information should come from the device tree. Regards, Hans > > Regards, > > Hans > >> --- >> 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, >> >