From patchwork Tue Sep 25 10:14:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 10613841 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 65B366CB for ; Tue, 25 Sep 2018 10:14:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5541229D57 for ; Tue, 25 Sep 2018 10:14:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 48CEB29DA4; Tue, 25 Sep 2018 10:14:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E7AA829D57 for ; Tue, 25 Sep 2018 10:14:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727617AbeIYQVe (ORCPT ); Tue, 25 Sep 2018 12:21:34 -0400 Received: from mga06.intel.com ([134.134.136.31]:59192 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727531AbeIYQVe (ORCPT ); Tue, 25 Sep 2018 12:21:34 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Sep 2018 03:14:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,301,1534834800"; d="scan'208";a="75735268" Received: from paasikivi.fi.intel.com ([10.237.72.42]) by orsmga007.jf.intel.com with ESMTP; 25 Sep 2018 03:14:38 -0700 Received: from punajuuri.localdomain (punajuuri.localdomain [192.168.240.130]) by paasikivi.fi.intel.com (Postfix) with ESMTPS id 91757201D5; Tue, 25 Sep 2018 13:14:37 +0300 (EEST) Received: from sailus by punajuuri.localdomain with local (Exim 4.89) (envelope-from ) id 1g4kMV-0005Ic-3M; Tue, 25 Sep 2018 13:14:35 +0300 From: Sakari Ailus To: linux-media@vger.kernel.org Cc: hverkuil@xs4all.nl, tfiga@chromium.org, bingbu.cao@intel.com, jian.xu.zheng@intel.com, rajmohan.mani@intel.com, tian.shu.qiu@intel.com, ricardo.ribalda@gmail.com, grundler@chromium.org, ping-chung.chen@intel.com, andy.yeh@intel.com, jim.lai@intel.com, helmut.grohne@intenta.de, laurent.pinchart@ideasonboard.com, snawrocki@kernel.org Subject: [PATCH 0/5] Add units to controls Date: Tue, 25 Sep 2018 13:14:29 +0300 Message-Id: <20180925101434.20327-1-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.11.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi all, This set adds a few things to the current control framework in terms of what kind of information the user space may have on controls. It adds support for units and prefixes, exponential base as well as information on whether a control is linear or exponential, to struct v4l2_query_ext_ctrl. The smiapp driver gains support for the feature. In the near term, some controls could also be assigned the unit automatically. The pixel rate, for instance. Fewer driver changes would be needed this way. A driver could override the value if there's a need to. I think I'll merge the undefined and no unit cases. Same for the exponential base actually --- the flag can be removed, too... Regarding Ricardo's suggestion --- I was thinking of adding a control flag (yes, there are a few bits available) to tell how to round the value. The user could use the TRY_EXT_CTRLS IOCTL to figure out the next (or previous) control value by incrementing the current value and setting the appropriate flag. This is out of the scope of this set though. Comments, questions? Sakari Ailus (5): videodev2.h: Use 8 hexadecimals (32 bits) for control flags v4l: controls: Add support for exponential bases, prefixes and units Documentation: media: Document control exponential bases, units, prefixes v4l: controls: QUERY_EXT_CTRL support for base, prefix and unit smiapp: Set control units Documentation/media/uapi/v4l/extended-controls.rst | 2 + Documentation/media/uapi/v4l/vidioc-queryctrl.rst | 174 +++++++++++++++++++-- Documentation/media/videodev2.h.rst.exceptions | 22 +++ drivers/media/i2c/smiapp/smiapp-core.c | 16 +- drivers/media/v4l2-core/v4l2-ctrls.c | 3 + include/media/v4l2-ctrls.h | 2 + include/uapi/linux/videodev2.h | 54 +++++-- 7 files changed, 242 insertions(+), 31 deletions(-)