From patchwork Fri Dec 2 16:07:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Volodymyr Kharuk X-Patchwork-Id: 630511 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 05C54C47088 for ; Fri, 2 Dec 2022 16:07:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233570AbiLBQHz (ORCPT ); Fri, 2 Dec 2022 11:07:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232678AbiLBQHw (ORCPT ); Fri, 2 Dec 2022 11:07:52 -0500 Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [IPv6:2a00:1450:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A748C192B8 for ; Fri, 2 Dec 2022 08:07:46 -0800 (PST) Received: by mail-ej1-x630.google.com with SMTP id n20so12691504ejh.0 for ; Fri, 02 Dec 2022 08:07:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=melexis.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=CNTO40Ok4F3wT6nUp6jH7yU9/UGuuLve2Grw8oDnk/g=; b=ARkRdYTOiXiipZTE47HPue2MN+UObGHSxr/guZ9T22CLYI8fZvcUWlGs4iMdg6BMjV wJWDrkIscj6W+pHXw4+jU4/qftMwEKN0w75esdlK62rEiICnyaoxpM9Ed60mqsl05I3q eRv7WZfr4Kz1tmYxaUEYTezCsKrKu2EMbKc8ZZqiAgREX7MlOiYyBqTK1FOZ5GGYn7+o rymH4Esoo7ZCfp8ZDuACLoqd5M0OhM8ojPMDXnWlJD3PiG2AtZnG7y6P0mfEByqEB2LP CWZV0fdqxxchAWbnm0pxjbPW9ewvyXnkxK42CurPCw+WOY290/CzPVRi42vCu2H2j8fP ZITA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CNTO40Ok4F3wT6nUp6jH7yU9/UGuuLve2Grw8oDnk/g=; b=J9MLL9Cr08SjLJ7IJpADokx8Kzkvh1HT+NQwmx/nxThYWUZe+dHOV0jXeIWe2ZTtNO VuTCwgFnfa0QKjTeDSDgVv7dQYclkweoQlSLEctpVPc3c42UdcbKdRGPAeP9037gmVjW g7lvSAlOmfTf8Tp9KIvHK4fm1hrSwuf55vUOV7gjnguit73+zKOfjBJRebHDkfD/vG8H dXF7WrwPGVZIsUZsEvE5O123Mwij3qO8apxJbROBXuDm0Wuu2zepUEAl7iO3g1G+Pjcg 37YMCSvbzm/dYACwILFL/2Bk6cXkJUbR1uqhPNyoo8tw0C4vCBZO6XWV8jLcobb2YTnr 98dw== X-Gm-Message-State: ANoB5pl3hmCBu3VGPzM7+IFL6YscQyP8qGPoodP8gxZAFh24AB7ySE7U TWAn2pLo38vLstUJqSFSPqO6pf4A6C6RpQYGHAHOfSV4sAX75ceghI0QTeGzgSNgmrpJPaRMM2e GXQGw8/V1E/EEyA1hHY8N25FIB0fn/7D76p/iRx7jvuDJyLwlu6AaQmxCqFlwLUxiFWrYC5owjz w= X-Google-Smtp-Source: AA0mqf4+eZS/iQUOCNUyH9I+uLK1obE77VOcynm8gb+ynq8oTfHZVGerl+a8pOuYDFD5xXvVSXvi2A== X-Received: by 2002:a17:906:3411:b0:7c0:d3e6:cce with SMTP id c17-20020a170906341100b007c0d3e60ccemr137787ejb.742.1669997265139; Fri, 02 Dec 2022 08:07:45 -0800 (PST) Received: from melexis ([91.192.183.26]) by smtp.gmail.com with ESMTPSA id m11-20020a056402050b00b00467cc919072sm3063885edv.17.2022.12.02.08.07.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Dec 2022 08:07:44 -0800 (PST) From: Volodymyr Kharuk To: Cc: Andrii Kyselov , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Laurent Pinchart , devicetree@vger.kernel.org, Hans Verkuil , Sakari Ailus , Benjamin Mugnier , Volodymyr Kharuk Subject: [PATCH v4 1/8] media: uapi: ctrls: Add Time of Flight class controls Date: Fri, 2 Dec 2022 18:07:31 +0200 Message-Id: <3a4d7724d689b72a5cea89824821f392ded50478.1669978791.git.vkh@melexis.com> X-Mailer: git-send-email 2.38.0 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Define Time of Flight class controls. Also add most common TOF controls: - phase sequence - time integration - frequency modulation Signed-off-by: Volodymyr Kharuk --- include/uapi/linux/v4l2-controls.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h index 410d778c1243..3a6b6231b6f7 100644 --- a/include/uapi/linux/v4l2-controls.h +++ b/include/uapi/linux/v4l2-controls.h @@ -68,6 +68,7 @@ #define V4L2_CTRL_CLASS_DETECT 0x00a30000 /* Detection controls */ #define V4L2_CTRL_CLASS_CODEC_STATELESS 0x00a40000 /* Stateless codecs controls */ #define V4L2_CTRL_CLASS_COLORIMETRY 0x00a50000 /* Colorimetry controls */ +#define V4L2_CTRL_CLASS_TOF 0x00a60000 /* Time of flight camera controls */ /* User-class control IDs */ @@ -2788,6 +2789,13 @@ struct v4l2_ctrl_vp9_compressed_hdr { struct v4l2_vp9_mv_probs mv; }; +#define V4L2_CID_TOF_CLASS_BASE (V4L2_CTRL_CLASS_TOF | 0x900) +#define V4L2_CID_TOF_CLASS (V4L2_CTRL_CLASS_TOF | 1) + +#define V4L2_CID_TOF_PHASE_SEQ (V4L2_CID_TOF_CLASS_BASE + 0) +#define V4L2_CID_TOF_FREQ_MOD (V4L2_CID_TOF_CLASS_BASE + 1) +#define V4L2_CID_TOF_TIME_INTEGRATION (V4L2_CID_TOF_CLASS_BASE + 2) + /* MPEG-compression definitions kept for backwards compatibility */ #ifndef __KERNEL__ #define V4L2_CTRL_CLASS_MPEG V4L2_CTRL_CLASS_CODEC From patchwork Fri Dec 2 16:07:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Volodymyr Kharuk X-Patchwork-Id: 630510 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D5CE7C47090 for ; Fri, 2 Dec 2022 16:07:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233548AbiLBQH7 (ORCPT ); Fri, 2 Dec 2022 11:07:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233546AbiLBQHx (ORCPT ); Fri, 2 Dec 2022 11:07:53 -0500 Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 353BB25E8F for ; Fri, 2 Dec 2022 08:07:51 -0800 (PST) Received: by mail-ed1-x52f.google.com with SMTP id d20so7154002edn.0 for ; Fri, 02 Dec 2022 08:07:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=melexis.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Dwv58T09d/KB7jqX1V9halxszsP4/34vGrJ0OjWbt8U=; b=XxclInnMyqmh/SZshAAbX6onBtcXowCuQsQDyCIc3TWQtz8dO2QiXILEwEIlYnxiOm 4nfeB6WcPIJ3ugF2TXOyJ04Z6QohPQOm0eZ3pH+u6X8PSgsWafJNimkAlFlF7OKotjcc j1KkJE3kEo7veN89HPP2DW+7cSsELKlZJo8XJtOyHOjGxLsyxFJeWDbzMq/YF6aM7c94 EUM55Af2efbwJ1V1w5MzK3mJjJojk6J+p0lVi2PXOJX+RIlCET4iTvBIG3hWQ1x8vTIN uCV+A2VegBgulbTS9GJ2N/vRMQf9C5jO2ifQsfM6BtpQ/IrxXoHrJ0V3WaSCg2Fy2H8b 5AGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Dwv58T09d/KB7jqX1V9halxszsP4/34vGrJ0OjWbt8U=; b=JAwKe09EsdRtSHqp30wIJzntXjiw72PRX5CBiy+fGuyIma2bK1FnBY+d1yqgenzVwi p+8S5LD5hQoP71E3+OGfx41SY3M3yih7+Fryj1f7QByb7h1il+GNulUAY7ggizW2/ymQ umFw9U6k+NOH8/auxBn5n9zhR5Bl6O3AuaGdRIVKAyUKSRhv1fc7D8vkZ5nt1EZrSXiG BLEBm82+JUT2Pcne6Hwpbkr5tFUDndmpWzQSOlvsVTS5pzYSh90zU7n/lKIvgJs6iAtY wpvOlG4rn/AdkSwP0sp0IeXXYNtZfGfIpoxOHJQj51FMZ8jaSA+N1J9zaavoIq50btvf 3Ezg== X-Gm-Message-State: ANoB5pmXW6yukCi5x1NjOoQIIITgnh9nbUwwQYfTwizJyCi6OpnP17og Vr6AYbkOpkkXjTC2Pd98+BC8beGgH6Q196YHa1rwsqRhgfYAj6y2HAvM/sQOA6Y8CXNzr+U5pys PICsQ7oAD5Jrz/9QEDNetqAn/h6T4pprReYTgOTC8ynkLPltMP66Q/2LAEAmOHygjahpc0V/P7L A= X-Google-Smtp-Source: AA0mqf5EByCNdrzRt/dX8oTXLVB71IJRsHwEdQ4zkcRQe7BTn1zMR+m7aS3V2KL5w9YA6WVUcaM0iw== X-Received: by 2002:a05:6402:910:b0:468:74:9668 with SMTP id g16-20020a056402091000b0046800749668mr4642915edz.394.1669997269620; Fri, 02 Dec 2022 08:07:49 -0800 (PST) Received: from melexis ([91.192.183.26]) by smtp.gmail.com with ESMTPSA id v6-20020a170906180600b007c0c679ca2fsm800538eje.26.2022.12.02.08.07.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Dec 2022 08:07:49 -0800 (PST) From: Volodymyr Kharuk To: Cc: Andrii Kyselov , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Laurent Pinchart , devicetree@vger.kernel.org, Hans Verkuil , Sakari Ailus , Benjamin Mugnier , Volodymyr Kharuk Subject: [PATCH v4 3/8] media: Documentation: v4l: Add TOF class controls Date: Fri, 2 Dec 2022 18:07:33 +0200 Message-Id: <73057b03463bbaccc7780418f7b32518fe17a144.1669978791.git.vkh@melexis.com> X-Mailer: git-send-email 2.38.0 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Add description about V4L2_CID_TOF_PHASE_SEQ, V4L2_CID_TOF_FMOD and V4L2_CID_TOF_TINT. Also updated MAINTAINERS with new ext-ctrls-tof file. Signed-off-by: Volodymyr Kharuk --- .../userspace-api/media/v4l/common.rst | 1 + .../userspace-api/media/v4l/ext-ctrls-tof.rst | 56 +++++++++++++++++++ MAINTAINERS | 7 +++ 3 files changed, 64 insertions(+) create mode 100644 Documentation/userspace-api/media/v4l/ext-ctrls-tof.rst diff --git a/Documentation/userspace-api/media/v4l/common.rst b/Documentation/userspace-api/media/v4l/common.rst index ea0435182e44..1ea79e453066 100644 --- a/Documentation/userspace-api/media/v4l/common.rst +++ b/Documentation/userspace-api/media/v4l/common.rst @@ -52,6 +52,7 @@ applicable to all devices. ext-ctrls-fm-rx ext-ctrls-detect ext-ctrls-colorimetry + ext-ctrls-tof fourcc format planar-apis diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-tof.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-tof.rst new file mode 100644 index 000000000000..62a5a316fb77 --- /dev/null +++ b/Documentation/userspace-api/media/v4l/ext-ctrls-tof.rst @@ -0,0 +1,56 @@ +.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later + +.. _tof-controls: + +*************************************** +Time of Flight Camera Control Reference +*************************************** + +The Time of Flight class includes controls for digital features +of the TOF sensor. + +TOF sensor is a receiver chip. Each pixel in the sensor measures the travel time +of light to that pixel and hence the distance to the object seen by that pixel. +There are different types of TOF sensors. Direct TOF sensors (also known +as Lidars) send a single pulse and measure direct time of flight. +Another type of TOF is indirect TOF sensors, which emit continuous wave +(could be radio or infrared) and then measure phase shift of reflected light. +The sensor modulates outgoing light and then collects reflected photons +as an electric charge with modulated pattern. Knowing the frequency of +the pattern you can calculate the real distance. + +For more information about TOF sensors see +`TOF `__ from Wikipedia. +Also, there are other nice explanations from vendors about indirect TOF: +`Microsoft `__, +`Melexis `__, +`TI `__. + +.. _tof-control-id: + +Time of Flight Camera Control IDs +================================= + +``V4L2_CID_TOF_CLASS (class)`` + The TOF class descriptor. Calling :ref:`VIDIOC_QUERYCTRL` for + this control will return a description of this control class. + +``V4L2_CID_TOF_PHASE_SEQ (dynamic array u16)`` + Change the shift between illumination and sampling for each phase + in degrees. The distance / amplitude (confidence) pictures are obtained + by merging 3..8 captures of the same scene using different phase shifts + (some TOF sensors use different frequency modulations). + + The size of dynamic array specify the number of captures. + Also driver may decide whether V4L2_CID_TOF_FREQ_MOD and + V4L2_CID_TOF_TIME_INTEGRATION should change the number + of captures or rely on V4L2_CID_TOF_PHASE_SEQ control. + The maximum size of the array is driver specific. + +``V4L2_CID_TOF_FREQ_MOD (dynamic array u8)`` + The control sets the modulation frequency (in Mhz) for each phase. + The maximum array size is driver specific. + +``V4L2_CID_TOF_TIME_INTEGRATION (dynamic array u16)`` + The control sets the integration time (in us) for each phase. + The maximum array size is driver specific. diff --git a/MAINTAINERS b/MAINTAINERS index 6f4ff0ef4523..6f9072f3b1da 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -13111,6 +13111,13 @@ S: Supported W: http://www.melexis.com F: drivers/iio/temperature/mlx90632.c +MELEXIS MLX7502X DRIVER +M: Volodymyr Kharuk +L: linux-media@vger.kernel.org +S: Supported +W: http://www.melexis.com +F: Documentation/userspace-api/media/v4l/ext-ctrls-tof.rst + MELFAS MIP4 TOUCHSCREEN DRIVER M: Sangwon Jee S: Supported From patchwork Fri Dec 2 16:07:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Volodymyr Kharuk X-Patchwork-Id: 630509 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 97CE1C47088 for ; Fri, 2 Dec 2022 16:08:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233546AbiLBQIA (ORCPT ); Fri, 2 Dec 2022 11:08:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233497AbiLBQHz (ORCPT ); Fri, 2 Dec 2022 11:07:55 -0500 Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [IPv6:2a00:1450:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D10B26AF6 for ; Fri, 2 Dec 2022 08:07:53 -0800 (PST) Received: by mail-ej1-x62e.google.com with SMTP id fc4so5648458ejc.12 for ; Fri, 02 Dec 2022 08:07:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=melexis.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=lN7SLbrO6IRiwLkabai6Yk1jGwDx04yNJ/i+Pt05kbI=; b=ouAx3zIYJo87/9kuuvnJZWrLXDYN/kBd8D+5aRKdCbEd1dmRsXWjsiR3wzgdhXK6Ye DIeWzb6nM1n9s4HS0bVBZVnzMRykDMdu/R5T16y7L2CnknQAlqbInPP0F2ymzdtF/Jdj SM1uDNeAMfGTTJWejfosCvi3BEHw8jmaCVBLCo/2zkJzz1+qiWp3jalmbXTRQ/IrSu25 wDWsS+qD+bcX6qxI2mi1iu4pO05i1aXCYwXvassyXivDC8ZKTHtp/Bbrxte4ans6t61v 6Bx4hf5sS+iyuVGGjYaChvf3aitP4H2aZhsIa85/MwxfmlRUYnNW280P5azwhRS2wFVA Vjgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lN7SLbrO6IRiwLkabai6Yk1jGwDx04yNJ/i+Pt05kbI=; b=53argm6c+nSbE3xUwMtY66HM+dJr8ZDmo3yl2MWpuri0WJ56UTku+nVBrYZcbkvvl/ 08Gu79ukDTlRPbHmiBtd0MAxta3B/SBWlYFffRb9PF2EhvbsiK0d1UipjlgUwlBfO2HF Mpq+1KvJKqnFOimM/TcsYZWtZvK7hc6m5/EBU5ifq1pDKRth0RqUkDRVpfjqgKrY/98P zdBlcsmbH5ud7tjJOja9PqyYyDDRkLegkorVj8ePGG0nk2IrV47ejwUeERvvBVjag8lK nMGUoqgXagB8pBcFZGaj3eKyl74Dr0ntnAmumkygv5HOUYLovekIFy5FEPVc/eO3DxD7 VGBg== X-Gm-Message-State: ANoB5pntVlSAzkKX4djJw++3u4ebtc73akbn+d1uUNGBn6+foE2TujnE vyJwCt39bjohhzIC+lYeXTaKAGKAKfaYTGBKVek2zQperiiyiy3wnMKFWvGusuB7PEcEYDBJXC1 B2cH18r8UwHUzMeWnJEFmxlDhN2oaFgTDqTv+GFZSexs9N5hYXANTm5gYE6Y97mR+n8jn4BwuVe M= X-Google-Smtp-Source: AA0mqf7lH3dyya87BXasWaVfLkxyri8QF91SYPgtl7mldNw+Q68cRubykpXAJ1K8uaie15A9hC8TEw== X-Received: by 2002:a17:906:b108:b0:7b5:dd3e:69c1 with SMTP id u8-20020a170906b10800b007b5dd3e69c1mr44864435ejy.381.1669997272146; Fri, 02 Dec 2022 08:07:52 -0800 (PST) Received: from melexis ([91.192.183.26]) by smtp.gmail.com with ESMTPSA id o7-20020a056402444700b0044dbecdcd29sm1668210edb.12.2022.12.02.08.07.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Dec 2022 08:07:51 -0800 (PST) From: Volodymyr Kharuk To: Cc: Andrii Kyselov , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Laurent Pinchart , devicetree@vger.kernel.org, Hans Verkuil , Sakari Ailus , Benjamin Mugnier , Volodymyr Kharuk Subject: [PATCH v4 4/8] media: v4l: ctrls-api: Allow array update in __v4l2_ctrl_modify_range Date: Fri, 2 Dec 2022 18:07:34 +0200 Message-Id: X-Mailer: git-send-email 2.38.0 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org For V4L2_CID_TOF_TINT, which is dynamic array, it is required to use __v4l2_ctrl_modify_range. So the idea is to use type_ops instead of u64 from union. It will allow to work with any type. Signed-off-by: Volodymyr Kharuk --- drivers/media/v4l2-core/v4l2-ctrls-api.c | 25 ++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-ctrls-api.c b/drivers/media/v4l2-core/v4l2-ctrls-api.c index d0a3aa3806fb..ebe57ec72813 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls-api.c +++ b/drivers/media/v4l2-core/v4l2-ctrls-api.c @@ -933,17 +933,18 @@ int __v4l2_ctrl_modify_range(struct v4l2_ctrl *ctrl, lockdep_assert_held(ctrl->handler->lock); switch (ctrl->type) { + case V4L2_CTRL_TYPE_MENU: + case V4L2_CTRL_TYPE_INTEGER_MENU: + if (ctrl->is_array) + return -EINVAL; + fallthrough; case V4L2_CTRL_TYPE_INTEGER: case V4L2_CTRL_TYPE_INTEGER64: case V4L2_CTRL_TYPE_BOOLEAN: - case V4L2_CTRL_TYPE_MENU: - case V4L2_CTRL_TYPE_INTEGER_MENU: case V4L2_CTRL_TYPE_BITMASK: case V4L2_CTRL_TYPE_U8: case V4L2_CTRL_TYPE_U16: case V4L2_CTRL_TYPE_U32: - if (ctrl->is_array) - return -EINVAL; ret = check_range(ctrl->type, min, max, step, def); if (ret) return ret; @@ -961,16 +962,16 @@ int __v4l2_ctrl_modify_range(struct v4l2_ctrl *ctrl, } cur_to_new(ctrl); if (validate_new(ctrl, ctrl->p_new)) { - if (ctrl->type == V4L2_CTRL_TYPE_INTEGER64) - *ctrl->p_new.p_s64 = def; - else - *ctrl->p_new.p_s32 = def; + WARN_ON(ctrl->is_array); /* This shouldn't happen, as + * INTEGER/Ux/BOOLEAN/BITMASK will not + * return an error. + * In case it happened, all array will + * set to default value + */ + ctrl->type_ops->init(ctrl, 0, ctrl->p_new); } - if (ctrl->type == V4L2_CTRL_TYPE_INTEGER64) - value_changed = *ctrl->p_new.p_s64 != *ctrl->p_cur.p_s64; - else - value_changed = *ctrl->p_new.p_s32 != *ctrl->p_cur.p_s32; + value_changed = !ctrl->type_ops->equal(ctrl, ctrl->p_cur, ctrl->p_new); if (value_changed) ret = set_ctrl(NULL, ctrl, V4L2_EVENT_CTRL_CH_RANGE); else if (range_changed) From patchwork Fri Dec 2 16:07:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Volodymyr Kharuk X-Patchwork-Id: 630508 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 98CBFC4321E for ; Fri, 2 Dec 2022 16:08:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232678AbiLBQIG (ORCPT ); Fri, 2 Dec 2022 11:08:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233715AbiLBQIC (ORCPT ); Fri, 2 Dec 2022 11:08:02 -0500 Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com [IPv6:2a00:1450:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1130A86599 for ; Fri, 2 Dec 2022 08:08:01 -0800 (PST) Received: by mail-ed1-x533.google.com with SMTP id d20so7154700edn.0 for ; Fri, 02 Dec 2022 08:08:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=melexis.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ESMlAkcQVJkP0BymB10mENkYlZia3gW1Hdg9ASnAHxo=; b=aXgQoCwh1oP1lJxsfku1djFDraOEbGrIXO52iwVGzx/GYsDhZjhSZgG6HEqbh9hC+w FSd1odVBl5g/OVG66A2fp9imeLAy1PgL325ecif/6nllrg4YTwZWYobhYf5JKqosTs/v lm/qJJny0bb+fLRY+HVZ2QO0uSOkNPgosfUbTWmcURCLdIgW9Jorwh3wUzRjHsVSD+9g qtiF0XD5qhX6BNltjkiiWaa+DMhwIS9BitN9FfnHN1+8VFzHp7ZUGqgjSrjckkIr2ray oRf/sna4yUf4LhEWXBWJWUeaVuwHS9zOP5VpVxpLn6ycN8woUNjut7KZ9WkCQk8lo3Id B2aw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ESMlAkcQVJkP0BymB10mENkYlZia3gW1Hdg9ASnAHxo=; b=C3H4OHkQ64C2144dMzF7dWk55Of1zDtCldpvDiMEt9Ljv7lk8Hw9PRwfQXxcyxKOlD LrMZVE9tkaEQ6aqBJeBzfzZwkZQ19LJ9Bq9KVohBTUT1k9Dz9/tLktIv9Ud8oxlTMakA 06wGQKOsmq2VA4OOdrysw/2NaCWV9+1rbLd9U1Yr9waXP92MumPZvvSok8xyCEL16hZM 4RX0JUyqUpMLYAsvrFHO+Fq5K0036ZJ3JTOsDCMxdkCI4FZMOXYMyBLchnXv3Iu2E9Tg cF3NEStSBQuK1A8MFGnXsOk01b4q6RmIB2LA5Gulr/gyl7JRkt1t+HjeDeZXwQHWn7G9 wMZQ== X-Gm-Message-State: ANoB5pmDJM4w6jYQBwrrafSqySSqkjHmSDKqKQRojxQXt/+NJQAh7ElW ech1XN4MiPItz+CWYm3ZcLvxZLpCRYxljyDT61G+FvwQ63TwvhRG5p5ZYmArjusGC0BqjJtijpE 4joMjkmk06kdjf1k3Tb8riVvDx5g707/+V3xt6TcO4hETQ6N2eUx5tPmi39KSdzGkQMbRf1T2E4 c= X-Google-Smtp-Source: AA0mqf4tl9h95XDB2edFyitlJ7HBNnhwGzt96tkfDPh8PMkbfcWBN13m9pnEkMwRkyC28kPqncDzew== X-Received: by 2002:aa7:c719:0:b0:46a:bfd0:f816 with SMTP id i25-20020aa7c719000000b0046abfd0f816mr2416122edq.277.1669997279532; Fri, 02 Dec 2022 08:07:59 -0800 (PST) Received: from melexis ([91.192.183.26]) by smtp.gmail.com with ESMTPSA id bm14-20020a0564020b0e00b0046bf4935323sm675963edb.30.2022.12.02.08.07.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Dec 2022 08:07:59 -0800 (PST) From: Volodymyr Kharuk To: Cc: Andrii Kyselov , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Laurent Pinchart , devicetree@vger.kernel.org, Hans Verkuil , Sakari Ailus , Benjamin Mugnier , Volodymyr Kharuk , Krzysztof Kozlowski Subject: [PATCH v4 7/8] media: dt-bindings: Add mlx7502x camera sensor Date: Fri, 2 Dec 2022 18:07:37 +0200 Message-Id: X-Mailer: git-send-email 2.38.0 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Add device tree binding of the mlx7502x and update MAINTAINERS Signed-off-by: Volodymyr Kharuk Reviewed-by: Krzysztof Kozlowski --- .../bindings/media/i2c/melexis,mlx7502x.yaml | 126 ++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 127 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/i2c/melexis,mlx7502x.yaml diff --git a/Documentation/devicetree/bindings/media/i2c/melexis,mlx7502x.yaml b/Documentation/devicetree/bindings/media/i2c/melexis,mlx7502x.yaml new file mode 100644 index 000000000000..7b86b6c5b151 --- /dev/null +++ b/Documentation/devicetree/bindings/media/i2c/melexis,mlx7502x.yaml @@ -0,0 +1,126 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/media/i2c/melexis,mlx7502x.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Melexis ToF 7502x MIPI CSI-2 Sensor + +maintainers: + - Volodymyr Kharuk + +description: |- + Melexis ToF 7502x sensors has a CSI-2 output. It supports 2 and 4 lanes, + and mipi speeds are 300, 600, 704, 800, 904, 960Mbs. Supported format is RAW12. + Sensor 75026 is QVGA, while 75027 is VGA sensor. + +properties: + compatible: + enum: + - melexis,mlx75026 + - melexis,mlx75027 + + reg: + maxItems: 1 + + clocks: + description: Clock frequency 8MHz + maxItems: 1 + + vdda-supply: + description: + Analog power supply(2.7V). + + vddif-supply: + description: + Interface power supply(1.8V). + + vddd-supply: + description: + Digital power supply(1.2V). + + vdmix-supply: + description: + Mixed driver power supply(1.2V). + + reset-gpios: + maxItems: 1 + description: Reset Sensor GPIO Control (active low) + + port: + description: MIPI CSI-2 transmitter port + $ref: /schemas/graph.yaml#/$defs/port-base + + properties: + endpoint: + $ref: /schemas/media/video-interfaces.yaml# + unevaluatedProperties: false + + properties: + data-lanes: + oneOf: + - items: + - const: 1 + - const: 2 + - items: + - const: 1 + - const: 2 + - const: 3 + - const: 4 + + required: + - data-lanes + - link-frequencies + +required: + - compatible + - reg + - clocks + - port + - vdda-supply + - vddif-supply + - vddd-supply + - vdmix-supply + +additionalProperties: false + +examples: + - | + #include + + i2c { + #address-cells = <1>; + #size-cells = <0>; + + mlx7502x: camera@57 { + compatible = "melexis,mlx75027"; + reg = <0x57>; + clocks = <&mlx7502x_clk>; + + assigned-clocks = <&mlx7502x_clk>; + assigned-clock-parents = <&mlx7502x_clk_parent>; + assigned-clock-rates = <8000000>; + + vdda-supply = <®_2v7>; + vddif-supply = <®_1v8>; + vddd-supply = <®_1v2>; + vdmix-supply = <®_1v2>; + + reset-gpios = <&gpio_exp 6 GPIO_ACTIVE_HIGH>; + + port { + mlx7502x_out_mipi_csi2: endpoint { + remote-endpoint = <&mipi_csi2_from_mlx7502x>; + data-lanes = <1 2 3 4>; + link-frequencies = /bits/ 64 < 960000000 + 904000000 + 800000000 + 704000000 + 600000000 + 300000000 >; + }; + }; + }; + }; + +... diff --git a/MAINTAINERS b/MAINTAINERS index 32e49523e9c0..81ff27741d40 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -13116,6 +13116,7 @@ M: Volodymyr Kharuk L: linux-media@vger.kernel.org S: Supported W: http://www.melexis.com +F: Documentation/devicetree/bindings/media/i2c/melexis,mlx7502x.yaml F: Documentation/userspace-api/media/drivers/mlx7502x.rst F: Documentation/userspace-api/media/v4l/ext-ctrls-tof.rst F: include/uapi/linux/mlx7502x.h