From patchwork Mon May 25 16:46:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Albrieux X-Patchwork-Id: 200064 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2B291C433DF for ; Mon, 25 May 2020 16:47:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0A82E20849 for ; Mon, 25 May 2020 16:47:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="e5MDmmWi" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391212AbgEYQrw (ORCPT ); Mon, 25 May 2020 12:47:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391128AbgEYQrw (ORCPT ); Mon, 25 May 2020 12:47:52 -0400 Received: from mail-qv1-xf32.google.com (mail-qv1-xf32.google.com [IPv6:2607:f8b0:4864:20::f32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CCDF3C061A0E; Mon, 25 May 2020 09:47:50 -0700 (PDT) Received: by mail-qv1-xf32.google.com with SMTP id v15so8257119qvr.8; Mon, 25 May 2020 09:47:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=kYPOBvUz2cZfQlHaw++XU6nzT3LZCLQVWMfDnD7/6D0=; b=e5MDmmWiSAVy0jPTnVmv6jUtKzElCyhCVXrS8KLffM89ZlURNo+5k94jVRaUDOIZIC VnQOUoLtVFl+tWeGP3jjCv3ddXEPq+sY+JyI5G/CUfmFO2/d0B97X352lvqnQGN7q985 GKOrLn6AJOJnYjgRZqrQuj4CzYiEvyilLg5xL77mJIVxxLeBVEs2o4TXdHrENmD9S2na i3sou5INi6tX5gXUx3QVQu/6YDo3jy9fx1wqf7CL3F31XGLF5clb80dgxtDEKE3mx9ay rNQhprDPEkua2dHchW3GF62Ipw6ntSKbVVG74xNBRVZTh+RR4F7OmdMKUngxeVMiMKlx PP3A== 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:in-reply-to :references; bh=kYPOBvUz2cZfQlHaw++XU6nzT3LZCLQVWMfDnD7/6D0=; b=Gbswn+hYtTSzBFP3qUskochRpy1xeXWsNSa8oFezzmCVjAS5G0Q+e0CxzYhTOptDMj FFEydHs0lpthBQfi5o1qDrxPh8erjg4bc+t8AdHBCSXxkGjB3CBjGJ3FzEndfXM5aS2e IUoifCfUjohu0qLI0icsmSYu8/6yrnxpCj0Ev/Y/ydqL0HgDeU06l52xoBJrwpeKyeUh flJ5nMeH1mOaY251P50jmrqM4AuyGQR7/l7q/b8IqFVOtxgR3ipbPbHd3SU1msqkxB1+ v3kTDGvErfZCvpkJJ1uIYJMGVwWemedIwcyUcXLlxsL/606EJmWFZfco+uyHDGfel5Ug N0ow== X-Gm-Message-State: AOAM531rDL75Q9OYuxMaBTVWmT8Fk6QrGLwLO0Ii0/B9sLtwP2cNRvCF Lcf37HEvk0AMzqyh5AS3deq9v49c4hE= X-Google-Smtp-Source: ABdhPJwXzWCFaanpmwp3aILi6QP/uEeXT1/PEY3iToe0bTQogx5UL2Kiz7M46BkF9gtJfb1ho3ZQmg== X-Received: by 2002:a0c:b354:: with SMTP id a20mr16623609qvf.205.1590425269171; Mon, 25 May 2020 09:47:49 -0700 (PDT) Received: from ict14-OptiPlex-980.kataweb.it ([178.23.248.46]) by smtp.googlemail.com with ESMTPSA id g5sm15559618qti.87.2020.05.25.09.47.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 May 2020 09:47:48 -0700 (PDT) From: Jonathan Albrieux To: linux-kernel@vger.kernel.org Cc: ~postmarketos/upstreaming@lists.sr.ht, daniel.baluta@gmail.com, Jonathan Albrieux , devicetree@vger.kernel.org (open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS), Hartmut Knaack , Lars-Peter Clausen , linux-iio@vger.kernel.org (open list:IIO SUBSYSTEM AND DRIVERS), Peter Meerwald-Stadler , Jonathan Cameron , Rob Herring Subject: [PATCH v4 1/5] dt-bindings: iio: imu: bmi160: convert format to yaml, add maintainer Date: Mon, 25 May 2020 18:46:00 +0200 Message-Id: <20200525164615.14962-2-jonathan.albrieux@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200525164615.14962-1-jonathan.albrieux@gmail.com> References: <20200525164615.14962-1-jonathan.albrieux@gmail.com> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Converts documentation from txt format to yaml. Signed-off-by: Jonathan Albrieux --- .../devicetree/bindings/iio/imu/bmi160.txt | 37 --------- .../bindings/iio/imu/bosch,bmi160.yaml | 75 +++++++++++++++++++ 2 files changed, 75 insertions(+), 37 deletions(-) delete mode 100644 Documentation/devicetree/bindings/iio/imu/bmi160.txt create mode 100644 Documentation/devicetree/bindings/iio/imu/bosch,bmi160.yaml diff --git a/Documentation/devicetree/bindings/iio/imu/bmi160.txt b/Documentation/devicetree/bindings/iio/imu/bmi160.txt deleted file mode 100644 index 900c169de00f..000000000000 --- a/Documentation/devicetree/bindings/iio/imu/bmi160.txt +++ /dev/null @@ -1,37 +0,0 @@ -Bosch BMI160 - Inertial Measurement Unit with Accelerometer, Gyroscope -and externally connectable Magnetometer - -https://www.bosch-sensortec.com/bst/products/all_products/bmi160 - -Required properties: - - compatible : should be "bosch,bmi160" - - reg : the I2C address or SPI chip select number of the sensor - - spi-max-frequency : set maximum clock frequency (only for SPI) - -Optional properties: - - interrupts : interrupt mapping for IRQ - - interrupt-names : set to "INT1" if INT1 pin should be used as interrupt - input, set to "INT2" if INT2 pin should be used instead - - drive-open-drain : set if the specified interrupt pin should be configured as - open drain. If not set, defaults to push-pull. - -Examples: - -bmi160@68 { - compatible = "bosch,bmi160"; - reg = <0x68>; - - interrupt-parent = <&gpio4>; - interrupts = <12 IRQ_TYPE_EDGE_RISING>; - interrupt-names = "INT1"; -}; - -bmi160@0 { - compatible = "bosch,bmi160"; - reg = <0>; - spi-max-frequency = <10000000>; - - interrupt-parent = <&gpio2>; - interrupts = <12 IRQ_TYPE_LEVEL_LOW>; - interrupt-names = "INT2"; -}; diff --git a/Documentation/devicetree/bindings/iio/imu/bosch,bmi160.yaml b/Documentation/devicetree/bindings/iio/imu/bosch,bmi160.yaml new file mode 100644 index 000000000000..0d0ef84e22b9 --- /dev/null +++ b/Documentation/devicetree/bindings/iio/imu/bosch,bmi160.yaml @@ -0,0 +1,75 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/iio/imu/bosch,bmi160.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Bosch BMI160 + +maintainers: + - Jonathan Cameron + +description: | + Inertial Measurement Unit with Accelerometer, Gyroscope and externally + connectable Magnetometer + https://www.bosch-sensortec.com/bst/products/all_products/bmi160 + +properties: + compatible: + const: bosch,bmi160 + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + interrupt-names: + enum: + - INT1 + - INT2 + description: | + set to "INT1" if INT1 pin should be used as interrupt input, set + to "INT2" if INT2 pin should be used instead + + drive-open-drain: + description: | + set if the specified interrupt pin should be configured as + open drain. If not set, defaults to push-pull. + +required: + - compatible + - reg + +examples: + - | + // Example for I2C + #include + i2c { + #address-cells = <1>; + #size-cells = <0>; + + bmi160@68 { + compatible = "bosch,bmi160"; + reg = <0x68>; + interrupt-parent = <&gpio4>; + interrupts = <12 IRQ_TYPE_EDGE_RISING>; + interrupt-names = "INT1"; + }; + }; + - | + // Example for SPI + #include + spi { + #address-cells = <1>; + #size-cells = <0>; + + bmi160@0 { + compatible = "bosch,bmi160"; + reg = <0>; + spi-max-frequency = <10000000>; + interrupt-parent = <&gpio2>; + interrupts = <12 IRQ_TYPE_EDGE_RISING>; + interrupt-names = "INT2"; + }; + }; From patchwork Mon May 25 16:46:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Albrieux X-Patchwork-Id: 200063 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7898EC433E1 for ; Mon, 25 May 2020 16:48:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 50C6F20776 for ; Mon, 25 May 2020 16:48:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="JLM4w3ne" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391239AbgEYQrz (ORCPT ); Mon, 25 May 2020 12:47:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391128AbgEYQrz (ORCPT ); Mon, 25 May 2020 12:47:55 -0400 Received: from mail-qt1-x844.google.com (mail-qt1-x844.google.com [IPv6:2607:f8b0:4864:20::844]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4007C061A0E; Mon, 25 May 2020 09:47:54 -0700 (PDT) Received: by mail-qt1-x844.google.com with SMTP id v4so14159797qte.3; Mon, 25 May 2020 09:47:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ePbeLY04LKtJmRX1nqSPn8wvAeyibEffZJ0RrRlFqv0=; b=JLM4w3nepYPrG7RmTb9xQnZgReWbnmg17HkPWokWHv2HzX48rCeI/3gppXQdbPCg+e aPkf3B5ijeYBYA1bhcb+ijlyCGD+Tj+gzNRVeXhv23EFZtmHAyOBMCVVYa9ZXVOQ3KaJ tW4zLkp4nvxJE6MgxDUlUZzBhxi3kMv3R2yjZaB3Muw99X91JhXWGNnJ9kQ3yHHzlbC2 nHWhp/JALH0EKVV80UUsScnj2xPthJ2PQSn4K49awE5WvlPRfFUEBxgakpUDP0jonIr6 cUOxSJQILs3pKs5I9cm0g4GNRboscZnV8BUnrJi6hUh50mW25cbvjNQKmWbyZhPpDdch fHuA== 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:in-reply-to :references; bh=ePbeLY04LKtJmRX1nqSPn8wvAeyibEffZJ0RrRlFqv0=; b=LempSlRFfPF8qn52/KvxSyeJ+Dj5k/ZabwE4ZyodFQw/cS9vHk51sPrXMCWyTdCOy0 0/vuSJyD9mH+GJNf6speQ931DMZ4xVafcE1YwXvJu8EoRsRG+f4Uhtr/JBm9f+RcIPUf nnXoS91GeyxfUQEp7jWtFZrSPxipOj+YlUKYCNqEI9oWOz0JTTzaewh5IHcCsZIVIxyp 7SxPPlXSJPtYFM3Bqj7ZSt4EoKG8yVYkWLpuDELKx9ewosDK2ZD2IT9HNcT0cxsvN9rb oagJMGr42abFKceEDQn24d2JUrYNDja8SBg33kap0oh8ENa1K59STO5PrU8X7j2phMkv mdnQ== X-Gm-Message-State: AOAM531GrTN2Ff95zqXVrHu4NO3w0R3SEQ1dCe1Il52xYlHw3N38kOU4 WOn8YDSwSL9shdf0Yr5e15ADtoedpoo= X-Google-Smtp-Source: ABdhPJx09RC61pGsRIeRpggIaHved1iMZKkjfuZPq9KlRW73cstyRwnAk0AG5hvR7WIUCBV6n2t9gg== X-Received: by 2002:ac8:23d7:: with SMTP id r23mr29469263qtr.111.1590425273694; Mon, 25 May 2020 09:47:53 -0700 (PDT) Received: from ict14-OptiPlex-980.kataweb.it ([178.23.248.46]) by smtp.googlemail.com with ESMTPSA id g5sm15559618qti.87.2020.05.25.09.47.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 May 2020 09:47:53 -0700 (PDT) From: Jonathan Albrieux To: linux-kernel@vger.kernel.org Cc: ~postmarketos/upstreaming@lists.sr.ht, daniel.baluta@gmail.com, Jonathan Albrieux , devicetree@vger.kernel.org (open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS), Hartmut Knaack , Lars-Peter Clausen , linux-iio@vger.kernel.org (open list:IIO SUBSYSTEM AND DRIVERS), Peter Meerwald-Stadler , Jonathan Cameron , Rob Herring Subject: [PATCH v4 2/5] dt-bindings: iio: imu: bmi160: add regulators and mount-matrix Date: Mon, 25 May 2020 18:46:01 +0200 Message-Id: <20200525164615.14962-3-jonathan.albrieux@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200525164615.14962-1-jonathan.albrieux@gmail.com> References: <20200525164615.14962-1-jonathan.albrieux@gmail.com> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Add vdd-supply and vddio-supply support. Add mount-matrix support. Signed-off-by: Jonathan Albrieux --- .../bindings/iio/imu/bosch,bmi160.yaml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Documentation/devicetree/bindings/iio/imu/bosch,bmi160.yaml b/Documentation/devicetree/bindings/iio/imu/bosch,bmi160.yaml index 0d0ef84e22b9..cfe40dbcd723 100644 --- a/Documentation/devicetree/bindings/iio/imu/bosch,bmi160.yaml +++ b/Documentation/devicetree/bindings/iio/imu/bosch,bmi160.yaml @@ -37,6 +37,17 @@ properties: set if the specified interrupt pin should be configured as open drain. If not set, defaults to push-pull. + vdd-supply: + maxItems: 1 + description: provide VDD power to the sensor. + + vddio-supply: + maxItems: 1 + description: provide VDD IO power to the sensor. + + mount-matrix: + description: an optional 3x3 mounting rotation matrix + required: - compatible - reg @@ -52,9 +63,14 @@ examples: bmi160@68 { compatible = "bosch,bmi160"; reg = <0x68>; + vdd-supply = <&pm8916_l17>; + vddio-supply = <&pm8916_l6>; interrupt-parent = <&gpio4>; interrupts = <12 IRQ_TYPE_EDGE_RISING>; interrupt-names = "INT1"; + mount-matrix = "0", "1", "0", + "-1", "0", "0", + "0", "0", "1"; }; }; - | From patchwork Mon May 25 16:46:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Albrieux X-Patchwork-Id: 200062 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A905C433E0 for ; Mon, 25 May 2020 16:48:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1A20620776 for ; Mon, 25 May 2020 16:48:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Z+Qm+xrk" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391264AbgEYQsL (ORCPT ); Mon, 25 May 2020 12:48:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388356AbgEYQsJ (ORCPT ); Mon, 25 May 2020 12:48:09 -0400 Received: from mail-qk1-x741.google.com (mail-qk1-x741.google.com [IPv6:2607:f8b0:4864:20::741]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12AFAC061A0E; Mon, 25 May 2020 09:48:08 -0700 (PDT) Received: by mail-qk1-x741.google.com with SMTP id w3so12434249qkb.6; Mon, 25 May 2020 09:48:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=j9GtLPWP384+mcmNAjX0iJ86SP6E9SyJL2vo8P6h15U=; b=Z+Qm+xrkwzZuSGSlrTKQXiT0twvVcxnq/up4UsvHYhzQ+H9funTn43WfK2/cX1m9ox podQ175SNu3HfQUY513TudhxDaj4xTUMEvNocmT4pc6mfLF9y6sFhCEf0gVF/xqc+J9U 0unBbVn5uJ1uj8i9lqOBbWaCc5HnpYy2wDNYOzhK7laCK6StaSnOZy9W/VXeTGN+csep qt4w/ce/rKnyVJL8TqDL8GCMMylQFjzDZa+PzJgXJf0iuJEGUlECQi4ZvzT4Hn72F9Ib kaR0AjHL+Im9tOhwg3qPuN468biErRC196hR3C9Er6NO9r/xIPoDT4/WdwjO5R+jjPAb jl6w== 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:in-reply-to :references; bh=j9GtLPWP384+mcmNAjX0iJ86SP6E9SyJL2vo8P6h15U=; b=aCjtVYeSub4JBKXTb8LbS9o4+FEWZodsKIrUk4sfPxqwdWAAmJlCAz9BfnfbrMagbU mTUaqaX6SDXJkPBhRjY2HxsE94/8o6pBr0QChPKR2yLFIZ0rpNWlrlvk8HA2asxgntL4 tGKpFSZnFf18Znj+aS1XhSdZi7oMZz95qGSGFBry6vs9OnBqmc0yC2P/s2KWFs3sDkwi wJ7AtYjaoaSTLXHybKznOvazrJb1JxlfXmvK89f+Q2wvKoh4764vVWMCjZWcjB6diPjA DgnVLw/l0ReHwAQy/zNoi+LWRMGs09rEpuBT2yfoZZl0/Ne5Nfc5KOpnB5i1JQmknLQ9 d2fg== X-Gm-Message-State: AOAM530klxw9AX/weG9m2XFPvSXfMKI0NRBkMuM7N3xWAmoDwaO/BiKj wpz6y0si8N6iv+IEjhV1lbSs4snGlBY= X-Google-Smtp-Source: ABdhPJwDgDfKD/77hasok63rccG8G1K9bWVWL3Ikd3yJjTs9h3j1Ri3lL6ZOnLjaHqEH9IjpLocJRA== X-Received: by 2002:a37:5ce:: with SMTP id 197mr9104547qkf.334.1590425286863; Mon, 25 May 2020 09:48:06 -0700 (PDT) Received: from ict14-OptiPlex-980.kataweb.it ([178.23.248.46]) by smtp.googlemail.com with ESMTPSA id g5sm15559618qti.87.2020.05.25.09.48.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 May 2020 09:48:06 -0700 (PDT) From: Jonathan Albrieux To: linux-kernel@vger.kernel.org Cc: ~postmarketos/upstreaming@lists.sr.ht, daniel.baluta@gmail.com, Jonathan Albrieux , devicetree@vger.kernel.org (open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS), Hartmut Knaack , Lars-Peter Clausen , linux-iio@vger.kernel.org (open list:IIO SUBSYSTEM AND DRIVERS), Peter Meerwald-Stadler , Jonathan Cameron Subject: [PATCH v4 5/5] iio: imu: bmi160: added mount-matrix support Date: Mon, 25 May 2020 18:46:04 +0200 Message-Id: <20200525164615.14962-6-jonathan.albrieux@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200525164615.14962-1-jonathan.albrieux@gmail.com> References: <20200525164615.14962-1-jonathan.albrieux@gmail.com> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Add mount-matrix binding support. As chip could have different orientations a mount matrix support is needed to correctly translate these differences. Signed-off-by: Jonathan Albrieux --- drivers/iio/imu/bmi160/bmi160.h | 1 + drivers/iio/imu/bmi160/bmi160_core.c | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/drivers/iio/imu/bmi160/bmi160.h b/drivers/iio/imu/bmi160/bmi160.h index 923c3b274fde..a82e040bd109 100644 --- a/drivers/iio/imu/bmi160/bmi160.h +++ b/drivers/iio/imu/bmi160/bmi160.h @@ -9,6 +9,7 @@ struct bmi160_data { struct regmap *regmap; struct iio_trigger *trig; struct regulator_bulk_data supplies[2]; + struct iio_mount_matrix orientation; }; extern const struct regmap_config bmi160_regmap_config; diff --git a/drivers/iio/imu/bmi160/bmi160_core.c b/drivers/iio/imu/bmi160/bmi160_core.c index d3316ca02fbd..26d586daee26 100644 --- a/drivers/iio/imu/bmi160/bmi160_core.c +++ b/drivers/iio/imu/bmi160/bmi160_core.c @@ -110,6 +110,7 @@ .storagebits = 16, \ .endianness = IIO_LE, \ }, \ + .ext_info = bmi160_ext_info, \ } /* scan indexes follow DATA register order */ @@ -265,6 +266,20 @@ static const struct bmi160_odr_item bmi160_odr_table[] = { }, }; +static const struct iio_mount_matrix * +bmi160_get_mount_matrix(const struct iio_dev *indio_dev, + const struct iio_chan_spec *chan) +{ + struct bmi160_data *data = iio_priv(indio_dev); + + return &data->orientation; +} + +static const struct iio_chan_spec_ext_info bmi160_ext_info[] = { + IIO_MOUNT_MATRIX(IIO_SHARED_BY_DIR, bmi160_get_mount_matrix), + { } +}; + static const struct iio_chan_spec bmi160_channels[] = { BMI160_CHANNEL(IIO_ACCEL, X, BMI160_SCAN_ACCEL_X), BMI160_CHANNEL(IIO_ACCEL, Y, BMI160_SCAN_ACCEL_Y), @@ -839,6 +854,11 @@ int bmi160_core_probe(struct device *dev, struct regmap *regmap, return ret; } + ret = iio_read_mount_matrix(dev, "mount-matrix", + &data->orientation); + if (ret) + return ret; + ret = bmi160_chip_init(data, use_spi); if (ret) return ret;