From patchwork Tue Aug 20 09:40:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda Delgado X-Patchwork-Id: 11103463 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C1026174A for ; Tue, 20 Aug 2019 09:40:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 96A2222DCC for ; Tue, 20 Aug 2019 09:40:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1566294033; bh=uQVsEV87rvpBFU1J/Cofx8lDu0ZRe62qsYfucG0g9uM=; h=From:To:Cc:Subject:Date:List-ID:From; b=I0kq7zLDHWv8G7ViRse2lRsF3iWyRii+GelnrnSBLKPhLqgO3spV6oZ7gMWoRUWsf C9XvDYKsVfC1zKKSXKoeWNMs0Vdf68hsTTl6Eo/5u0AlmQGnlsTdUE74Kyc50cVNM9 UfCNscR0DUH09s0xPFPLvmRZkNlLEmlUqD8kTk0g= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729635AbfHTJkc (ORCPT ); Tue, 20 Aug 2019 05:40:32 -0400 Received: from mail-ed1-f68.google.com ([209.85.208.68]:46598 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728414AbfHTJkc (ORCPT ); Tue, 20 Aug 2019 05:40:32 -0400 Received: by mail-ed1-f68.google.com with SMTP id z51so5550983edz.13; Tue, 20 Aug 2019 02:40:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=k8VTLUSMPpJlERrTrCZkEPzdT4RCL143ZsVe+wpx+3E=; b=smjvbONfMCtWrgRO4aRRdOKmD36mprIOh3qF3Mgr+ca4orIth6foYaBrFCCMGPgdhV jJGArt6MP87/qEPx5brOonKqLmUn1ZL1ePJKlLdonSA8avK6gX7afR9qqvF7bIpjAU98 Pwe90Mx9I/w5F+KbZIOhIbNk0N5umRufyT0mF+FQ85El72Bj4Kr/JFK/mGlvitLg6Ir4 /sda3K3z0mkX7BUMKSIpouqoZsFb/VXHYhrLjnc/hB+E4iSgt0QIObIT06Sv+Cz+gsHg LpBzeudeSks+UE8uqUEgwA0FthodXi7wpNqVM1+4HwZB1vZYYdCgHhI0hF+/ewW8Wb3p H8iQ== X-Gm-Message-State: APjAAAUo9nSSomjc/27GZpYU0wpgCAJWjrhL6Rs2TWxkY7N9BgIDogvp 4I1UngZ9ahBs2PFaHlrK2Xo= X-Google-Smtp-Source: APXvYqxQfc1FHosZmGZPEXyfGaCgaDxmTrJrsE15LSyDty9Eyjf412FvnXCL93RcBHCUH4RbDKGF6A== X-Received: by 2002:aa7:c552:: with SMTP id s18mr17429600edr.0.1566294029934; Tue, 20 Aug 2019 02:40:29 -0700 (PDT) Received: from neopili.qtec.com (cpe.xe-3-0-1-778.vbrnqe10.dk.customer.tdc.net. [80.197.57.18]) by smtp.gmail.com with ESMTPSA id j37sm3354259ede.23.2019.08.20.02.40.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Aug 2019 02:40:28 -0700 (PDT) From: Ricardo Ribalda Delgado To: Philipp Zabel , Mauro Carvalho Chehab , Hans Verkuil , Sakari Ailus , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Ricardo Ribalda Delgado Subject: [PATCH v2 1/3] media: add V4L2_CID_UNIT_CELL_SIZE control Date: Tue, 20 Aug 2019 11:40:25 +0200 Message-Id: <20190820094027.4144-1-ribalda@kernel.org> X-Mailer: git-send-email 2.23.0.rc1 MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org This control returns the unit cell size in nanometres. The struct provides the width and the height in separated fields to take into consideration asymmetric pixels and/or hardware binning. This control is required for automatic calibration of sensors/cameras. Signed-off-by: Ricardo Ribalda Delgado --- drivers/media/v4l2-core/v4l2-ctrls.c | 11 +++++++++++ include/media/v4l2-ctrls.h | 2 ++ include/uapi/linux/v4l2-controls.h | 3 +++ include/uapi/linux/videodev2.h | 11 +++++++++++ 4 files changed, 27 insertions(+) diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c index cd1ae016706f..ec949453a081 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls.c +++ b/drivers/media/v4l2-core/v4l2-ctrls.c @@ -978,6 +978,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_UNIT_CELL_SIZE: return "Unit Cell Size"; /* FM Radio Modulator controls */ /* Keep the order of the 'case's the same as in v4l2-controls.h! */ @@ -1357,6 +1358,9 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, case V4L2_CID_MPEG_VIDEO_VP8_FRAME_HEADER: *type = V4L2_CTRL_TYPE_VP8_FRAME_HEADER; break; + case V4L2_CID_UNIT_CELL_SIZE: + *type = V4L2_CTRL_TYPE_AREA; + break; default: *type = V4L2_CTRL_TYPE_INTEGER; break; @@ -1423,6 +1427,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, case V4L2_CID_RDS_RX_TRAFFIC_ANNOUNCEMENT: case V4L2_CID_RDS_RX_TRAFFIC_PROGRAM: case V4L2_CID_RDS_RX_MUSIC_SPEECH: + case V4L2_CID_UNIT_CELL_SIZE: *flags |= V4L2_CTRL_FLAG_READ_ONLY; break; case V4L2_CID_RF_TUNER_PLL_LOCK: @@ -1705,6 +1710,9 @@ static int std_validate_compound(const struct v4l2_ctrl *ctrl, u32 idx, case V4L2_CTRL_TYPE_FWHT_PARAMS: break; + case V4L2_CTRL_TYPE_AREA: + break; + case V4L2_CTRL_TYPE_H264_SPS: case V4L2_CTRL_TYPE_H264_PPS: case V4L2_CTRL_TYPE_H264_SCALING_MATRIX: @@ -2403,6 +2411,9 @@ static struct v4l2_ctrl *v4l2_ctrl_new(struct v4l2_ctrl_handler *hdl, case V4L2_CTRL_TYPE_VP8_FRAME_HEADER: elem_size = sizeof(struct v4l2_ctrl_vp8_frame_header); break; + case V4L2_CTRL_TYPE_AREA: + elem_size = sizeof(struct v4l2_area); + break; default: if (type < V4L2_CTRL_COMPOUND_TYPES) elem_size = sizeof(s32); diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h index 570ff4b0205a..9a3d11350e67 100644 --- a/include/media/v4l2-ctrls.h +++ b/include/media/v4l2-ctrls.h @@ -50,6 +50,7 @@ struct poll_table_struct; * @p_h264_slice_params: Pointer to a struct v4l2_ctrl_h264_slice_params. * @p_h264_decode_params: Pointer to a struct v4l2_ctrl_h264_decode_params. * @p_vp8_frame_header: Pointer to a VP8 frame header structure. + * @p_area: Pointer to an area. * @p: Pointer to a compound value. */ union v4l2_ctrl_ptr { @@ -68,6 +69,7 @@ union v4l2_ctrl_ptr { struct v4l2_ctrl_h264_slice_params *p_h264_slice_params; struct v4l2_ctrl_h264_decode_params *p_h264_decode_params; struct v4l2_ctrl_vp8_frame_header *p_vp8_frame_header; + struct v4l2_area *p_area; void *p; }; diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h index a2669b79b294..1332eabd27b1 100644 --- a/include/uapi/linux/v4l2-controls.h +++ b/include/uapi/linux/v4l2-controls.h @@ -912,6 +912,9 @@ 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_UNIT_CELL_SIZE (V4L2_CID_CAMERA_CLASS_BASE+34) + + /* FM Modulator class control IDs */ #define V4L2_CID_FM_TX_CLASS_BASE (V4L2_CTRL_CLASS_FM_TX | 0x900) diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index 2427bc4d8eba..751e2065ac02 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -422,6 +422,11 @@ struct v4l2_fract { __u32 denominator; }; +struct v4l2_area { + __u32 width; + __u32 height; +}; + /** * struct v4l2_capability - Describes V4L2 device caps returned by VIDIOC_QUERYCAP * @@ -1718,6 +1723,12 @@ enum v4l2_ctrl_type { V4L2_CTRL_TYPE_U8 = 0x0100, V4L2_CTRL_TYPE_U16 = 0x0101, V4L2_CTRL_TYPE_U32 = 0x0102, + /* + * V4L2_CTRL_TYPE_MPEG2_SLICE_PARAMS = 0x0103, + * V4L2_CTRL_TYPE_MPEG2_QUANTIZATION = 0x0104, + * V4L2_CTRL_TYPE_FWHT_PARAMS = 0x0105, + */ + V4L2_CTRL_TYPE_AREA = 0x0106, }; /* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */