Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp2195344ybl; Thu, 15 Aug 2019 08:02:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqzw/t++vHehcgO235/B6TAFizn82MKPFdRZPrgcxDXpClDGoy5KRXUMhmx3Vm5sj7SnlXi7 X-Received: by 2002:aa7:93aa:: with SMTP id x10mr5949656pff.83.1565881326885; Thu, 15 Aug 2019 08:02:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565881326; cv=none; d=google.com; s=arc-20160816; b=C7oEoWIxtFMhN7ikyxZv8OTnQ8Izh5YvBA/0hDdLDSzQyWIhYXwccPg6x0kizISS3x MfjIWGF+7+rK5FrbEQbe8/2isyc5HpkWf+ZaF9BUAe2bFIi4/Azbmol4aQ+uxWjSI44z PAsJx1cfVh2Te1z12XEWr3Fbn/mm36dFEkw5ubNlfx6CJkaHm1axzkbDfePK3uAjeBM/ 9MMyAjhwWlbytD8iScfvn4vv9Pzm3bE1PFCMIFvHNUA6hMRS3PtP0NUxnzHIRaP0bBpN 8H99FHhcswTydjGDmxxXxbFU69R3Zkf8hRPpCtziqACz68Ql9Bfmz9eEKBmcTcMhVn0B kifg== 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:from:references:cc:to:subject; bh=Ee+6MrckmqwJcZ3ZaT/JCBlnScp/Q3tNDhNgxFhyP0Q=; b=01wkjxp6sqtBE66wQwXgGaEnL25g+FB2WNiR2xk7q9uIKE0ElPZbetEjXc5XZOYMWe 1SJDzWQrvgyzp4gXMfcJrDL3PWd5I+iFU35fiDSSk9wFFSCIyVpm1fY+QH929cK4ISaA Cz9FEFGyWvEV1xK+3F5BtoB+eHYjskwOeRYGD0iPoDZDEKfeNZI0wT2J0CKoPFFwOc0d UvCAdpdNvKWuzTfWyFiPiQvMuCJCA4rw9CpbDk1jtHrTi8ia6njK2breJPz0zlvlkzek 9XeijWxvP7JZYYD5fdWfi+EbE5uq8yOambU8xm8NgygRPZaIUB9uJKMSPmiTaWMgrjkF nI3Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f8si1964201pgb.566.2019.08.15.08.01.46; Thu, 15 Aug 2019 08:02:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732386AbfHONl7 (ORCPT + 99 others); Thu, 15 Aug 2019 09:41:59 -0400 Received: from lb1-smtp-cloud8.xs4all.net ([194.109.24.21]:52025 "EHLO lb1-smtp-cloud8.xs4all.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729918AbfHONl7 (ORCPT ); Thu, 15 Aug 2019 09:41:59 -0400 Received: from [IPv6:2001:420:44c1:2579:f038:4b04:f67a:276f] ([IPv6:2001:420:44c1:2579:f038:4b04:f67a:276f]) by smtp-cloud8.xs4all.net with ESMTPA id yG0nhw2wxDqPeyG0rhYLfe; Thu, 15 Aug 2019 15:41:57 +0200 Subject: Re: [RFC 3/5] media: v4l2-ctrls: Add support for V4L2_CID_LOCATION To: Jacopo Mondi , Laurent Pinchart Cc: Mauro Carvalho Chehab , Sakari Ailus , "open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB)" , open list References: <20190814202815.32491-1-jacopo@jmondi.org> <20190814202815.32491-4-jacopo@jmondi.org> <20190814225353.GE5015@pendragon.ideasonboard.com> <20190815130245.usat55oqffe4abvi@uno.localdomain> From: Hans Verkuil Message-ID: Date: Thu, 15 Aug 2019 15:41:53 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 MIME-Version: 1.0 In-Reply-To: <20190815130245.usat55oqffe4abvi@uno.localdomain> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-CMAE-Envelope: MS4wfIvVw+YP1TjkGK30wylgD6dnQvfhOlyHaEe0FibFsnIf1SzNCUBu4Lg1dARQ5/qQlNOvjTpyAmCPciO0E4SXdUEVoRyN4ZahzeD7vP64wcCZuuhSwSV9 Ae6m7jUizYjQhmLqQjyMC1CuIg2C6qVe7l3rZ9NP5Fg5tZZRcF2XD3yh2bvA4z0vvN3PE+7KgBStvALUuGBT9LJyTxPVfhB3C6yVlor3zfGxsTuXBaZsmj28 Qb6PYK94zj6tJZwnVz/tqKMjavS2xTetrpHjDav/sKh9E27l4n1jIo6ibi7FuYW2IbBjFl/YoJRcNs1CoWWeND/lTM5y7L6y53wIK1ag/8/z5qQMU9Bs/hQc G5azbalFXNE4PhxNtm7d3PibnyUYuiCf08PCJOeqNDvuJXhSwCcxBo/jTjS3CHjucndFL4B2iNyWZae600eMm523vWoWJSMOlmb+z5KG0sY6OSjWQb0GtdVG n8NUdWgNx5ysbfSP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/15/19 3:02 PM, Jacopo Mondi wrote: > Hi Laurent, > > On Thu, Aug 15, 2019 at 01:53:53AM +0300, Laurent Pinchart wrote: >> Hi Jacopo, >> >> Thank you for the patch. >> >> On Wed, Aug 14, 2019 at 10:28:13PM +0200, Jacopo Mondi wrote: >>> Add support for the newly defined V4L2_CID_LOCATION read-only control >>> used to report the camera device mounting position. >>> >>> Signed-off-by: Jacopo Mondi >>> --- >>> drivers/media/v4l2-core/v4l2-ctrls.c | 7 +++++++ >>> include/uapi/linux/v4l2-controls.h | 4 ++++ >>> 2 files changed, 11 insertions(+) >>> >>> diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c >>> index 7d3a33258748..8ab0857df59a 100644 >>> --- a/drivers/media/v4l2-core/v4l2-ctrls.c >>> +++ b/drivers/media/v4l2-core/v4l2-ctrls.c >>> @@ -943,6 +943,7 @@ const char *v4l2_ctrl_get_name(u32 id) >>> case V4L2_CID_AUTO_FOCUS_RANGE: return "Auto Focus, Range"; >>> case V4L2_CID_PAN_SPEED: return "Pan, Speed"; >>> case V4L2_CID_TILT_SPEED: return "Tilt, Speed"; >>> + case V4L2_CID_LOCATION: return "Location"; >> >> Depending on what we decide to name the control (see review of 2/5), you >> should adjust the description accordingly. >> >>> >>> /* FM Radio Modulator controls */ >>> /* Keep the order of the 'case's the same as in v4l2-controls.h! */ >>> @@ -1300,6 +1301,12 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, >>> break; >>> case V4L2_CID_MPEG_VIDEO_FWHT_PARAMS: >>> *type = V4L2_CTRL_TYPE_FWHT_PARAMS; >>> + case V4L2_CID_LOCATION: >>> + *type = V4L2_CTRL_TYPE_INTEGER; >>> + *flags |= V4L2_CTRL_FLAG_READ_ONLY; >>> + *min = V4L2_LOCATION_FRONT; >>> + *max = V4L2_LOCATION_BACK; >> >> I don't think the control should have a min and a max different than the >> current value, as it's a fully static control. I'd drop those two lines >> here, and drivers will have to set value = min = max = V4L2_LOCATION_xxx >> when creating the control. That why you should be able to collapse this >> with V4L2_CID_MIN_BUFFERS_FOR_OUTPUT. >> > > Ah, I thought min/max should report the actual control values limits. > Anyway, if we move this to be an integer menu control with an helper > to parse the DT property and register the control on behalf of > drivers, this will change. > >>> + *step = 1; >>> break; >>> default: >>> *type = V4L2_CTRL_TYPE_INTEGER; >>> diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h >>> index 37807f23231e..5c4c7b245921 100644 >>> --- a/include/uapi/linux/v4l2-controls.h >>> +++ b/include/uapi/linux/v4l2-controls.h >>> @@ -889,6 +889,10 @@ enum v4l2_auto_focus_range { >>> #define V4L2_CID_PAN_SPEED (V4L2_CID_CAMERA_CLASS_BASE+32) >>> #define V4L2_CID_TILT_SPEED (V4L2_CID_CAMERA_CLASS_BASE+33) >>> >>> +#define V4L2_CID_LOCATION (V4L2_CID_CAMERA_CLASS_BASE+34) >>> +#define V4L2_LOCATION_FRONT (0 << 0) >>> +#define V4L2_LOCATION_BACK (1 << 0) >> >> Why not just 0 and 1 ? > > Or why not BIT(). I saw that the (1 << x) style is the mostly used one in > this header file when defining macros like this one so I went for > consistency with the existing code. Definitely not right. This is an enumeration, so just number from 0, 1, 2, ... Nothing to do with bits/bitmasks. Regards, Hans > >> >>> + >>> /* FM Modulator class control IDs */ >>> >>> #define V4L2_CID_FM_TX_CLASS_BASE (V4L2_CTRL_CLASS_FM_TX | 0x900) >> >> -- >> Regards, >> >> Laurent Pinchart