From patchwork Wed May 20 19:46:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Albrieux X-Patchwork-Id: 11561131 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 EDC8714C0 for ; Wed, 20 May 2020 19:47:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D62D0207D8 for ; Wed, 20 May 2020 19:47:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="o2Z2LRsk" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726862AbgETTr5 (ORCPT ); Wed, 20 May 2020 15:47:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726548AbgETTr5 (ORCPT ); Wed, 20 May 2020 15:47:57 -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 0502DC061A0E; Wed, 20 May 2020 12:47:57 -0700 (PDT) Received: by mail-qt1-x844.google.com with SMTP id i68so3605758qtb.5; Wed, 20 May 2020 12:47:56 -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=WUruQWSj4RCaoTshJ50aKQ9F0pxhc7c3vLi9K6KM9jU=; b=o2Z2LRskwA9Y54wL0tqiwnZtrTAzW+GaqE7/ELryIbQai52qWOruJoQFWcewMCcV3y mFsHkzOfvpq4CvzKj0kyszYbsKpbEHCHxog7Pew6rb4O8VP4btAz80aj9jWrntKd/3Xt 8OshqIBxroSd0Lvy78Yj5by3xJWnZT8Lrm8JaQfce1l5f5WbxqwSVHLgKRPn17mclE7g 8djbk7xjk5I0r15BoJa+UIHYaDQgcmQsOtonjDlzyauB4yrqiEgjv6sALON6tN98APJR siC9jbdDM0QUtfOkdmDqD6sDBzTtZK8KFkbqX/qfesQ8hppiQeaT/CFxWG/xCvYS/mOr 1lAQ== 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=WUruQWSj4RCaoTshJ50aKQ9F0pxhc7c3vLi9K6KM9jU=; b=r0J2yRkwr1ci1j8Gm25E/ApnPZ0Sy93NzJFoft9MmCV009hkJeDyPImuFRNjot5PGg 5V3S4o9Pad8sfjonZTn/cJ+cWww7veKhBF6gNh9Gak2QEK+hTDTCSltjQv1LBbWfTRnT G1jxuAi1Ky9Xvmf2Sqr6QtE/o46HrTOR5ATtvZGXEO280PAugQpIdj/U8zmur1Tnux5i zl6aSWrDYGXAaTsQDpFDC9TfHSz1JqXhtxYfntnF67GUNgk36qmTzCskwOOYzizcWXx1 sGxk20K4971vj9sX2xpfxyYctlRyQZWgbJEhQReFmWEvbNu2x6CghGMaM/TevvCZnWMO h+dQ== X-Gm-Message-State: AOAM530z+zO8Xc04wtyLzBGFzudojcPPnppmYk9JqDNyDyMuAWDLCsv/ YOYB049GKg/iVf5iUcKiTLbrLizY0nLPFQ== X-Google-Smtp-Source: ABdhPJyOOzfjqe7HgDpXu2n2z1XdA8+Vk/4FzjNS/ZTm/br5GPh/9p2k0unuaMSSqmdpDodPfrTQMA== X-Received: by 2002:ac8:a02:: with SMTP id b2mr6559002qti.95.1590004075580; Wed, 20 May 2020 12:47:55 -0700 (PDT) Received: from ict14-OptiPlex-980.kataweb.it ([178.23.248.46]) by smtp.googlemail.com with ESMTPSA id m33sm3158419qte.17.2020.05.20.12.47.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 May 2020 12:47:54 -0700 (PDT) From: Jonathan Albrieux To: linux-kernel@vger.kernel.org Cc: ~postmarketos/upstreaming@lists.sr.ht, daniel.baluta@nxp.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 v3 1/5] dt-bindings: iio: imu: bmi160: convert txt format to yaml Date: Wed, 20 May 2020 21:46:40 +0200 Message-Id: <20200520194656.16218-2-jonathan.albrieux@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200520194656.16218-1-jonathan.albrieux@gmail.com> References: <20200520194656.16218-1-jonathan.albrieux@gmail.com> Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@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 | 76 +++++++++++++++++++ 2 files changed, 76 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..46cb4fde1165 --- /dev/null +++ b/Documentation/devicetree/bindings/iio/imu/bosch,bmi160.yaml @@ -0,0 +1,76 @@ +# 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: + - Daniel Baluta (?) + +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 + + spi-max-frequency: + 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 + i2c { + #address-cells = <1>; + #size-cells = <0>; + + bmi160@68 { + compatible = "bosch,bmi160"; + reg = <0x68>; + interrupt-parent = <&gpio4>; + interrupts = <12 1>; + interrupt-names = "INT1"; + }; + }; + - | + // Example for SPI + spi { + #address-cells = <1>; + #size-cells = <0>; + + bmi160@0 { + compatible = "bosch,bmi160"; + reg = <0>; + spi-max-frequency = <10000000>; + interrupt-parent = <&gpio2>; + interrupts = <12 1>; + interrupt-names = "INT2"; + }; + }; From patchwork Wed May 20 19:46:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Albrieux X-Patchwork-Id: 11561133 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 0FCDA14B7 for ; Wed, 20 May 2020 19:48:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EB02920829 for ; Wed, 20 May 2020 19:48:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="OQeCTQ5X" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727041AbgETTsC (ORCPT ); Wed, 20 May 2020 15:48:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726548AbgETTsB (ORCPT ); Wed, 20 May 2020 15:48:01 -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 75E72C061A0E; Wed, 20 May 2020 12:48:01 -0700 (PDT) Received: by mail-qk1-x741.google.com with SMTP id n14so4854810qke.8; Wed, 20 May 2020 12:48:01 -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=KBlg7ucOOHLspx7oP054kBqMdtZCA7r02bQtA6lAAEk=; b=OQeCTQ5X4XkJWA5Xbvz0WRI+uxOq3cR2EAeUrhsFpc2X95vwZMc3gZOOpxH9TQa43v 7/4xeNlB5i/64R8tv1RJZitclWixf7zhYwTq7oFjTI+WEUzycLcrENKtv3vW5JT4gV4E yOWT+nEkTTTNaOBS3gTOklkRcALQc2yc7QHbkqLpA4WsObiZn3SW+2RQ+4QnW34qiUuI YIbfzP8Fgs7addRpnO5M484UFA/KuRzSGI7tGg1D/Dxv5u3tNPvQ9Ik28j+E/j3TMYSj XQbKc3emuEON0Ny3kkTaBpALPDoVqYgYNuPOBdWNuo/rymXHBwiKnzY/W0NVeIahZ1HE 8flg== 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=KBlg7ucOOHLspx7oP054kBqMdtZCA7r02bQtA6lAAEk=; b=iLuYJVvNM/Nzq7Z/gxi8FWVy2NZCiA7L80SsQPOEaF+u1rlwuwpqI+LrJ8V4LFgwZU RPrUekEho2SNYBk9dR68hfTRIdrY0I3mnPJTZHqtU9D6iuRpSzYe/gM7XdI5orcg7Tbw jiCX96FZhOwpi9aUz0/Pxe1RhVbg/Ov1UowgSB2+RhF465ioJWh2A14eTQ9yxorno5X5 00RZPbNIN3plLoW0etIZ8XijFNGWD6lwVIkUFdh72ZtfaTHqp/CfpRYG6dULADaPtc+S 2Uj/26n2EGjW7qcMK4NdY5/ayOh/tNc7oV+V3zN2CyS/bEuvhR3guHd6j9n8MRgH23MU 1SZA== X-Gm-Message-State: AOAM531Nis/KYCt6O1bfswQoavNlnhjj1XFEhTYpVlpIPjmErdz8EJKV TEPkDWjhwwGogQwz12JQ5ViDg2dujJI11g== X-Google-Smtp-Source: ABdhPJwprs1voZB1XSGzTEyzd8jWNVf+fz+saZc7lAubDV4VQPF8QW+Gs5MIFMaXaUPrZ1e+FfLBsA== X-Received: by 2002:a05:620a:809:: with SMTP id s9mr6252443qks.91.1590004080231; Wed, 20 May 2020 12:48:00 -0700 (PDT) Received: from ict14-OptiPlex-980.kataweb.it ([178.23.248.46]) by smtp.googlemail.com with ESMTPSA id m33sm3158419qte.17.2020.05.20.12.47.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 May 2020 12:47:59 -0700 (PDT) From: Jonathan Albrieux To: linux-kernel@vger.kernel.org Cc: ~postmarketos/upstreaming@lists.sr.ht, daniel.baluta@nxp.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 v3 2/5] dt-bindings: iio: imu: bmi160: add regulators and mount-matrix Date: Wed, 20 May 2020 21:46:41 +0200 Message-Id: <20200520194656.16218-3-jonathan.albrieux@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200520194656.16218-1-jonathan.albrieux@gmail.com> References: <20200520194656.16218-1-jonathan.albrieux@gmail.com> Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@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 46cb4fde1165..1a1b1a14aa2e 100644 --- a/Documentation/devicetree/bindings/iio/imu/bosch,bmi160.yaml +++ b/Documentation/devicetree/bindings/iio/imu/bosch,bmi160.yaml @@ -40,6 +40,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 @@ -54,9 +65,14 @@ examples: bmi160@68 { compatible = "bosch,bmi160"; reg = <0x68>; + vdd-supply = <&pm8916_l17>; + vddio-supply = <&pm8916_l6>; interrupt-parent = <&gpio4>; interrupts = <12 1>; interrupt-names = "INT1"; + mount-matrix = "0", "1", "0", + "-1", "0", "0", + "0", "0", "1"; }; }; - | From patchwork Wed May 20 19:46:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Albrieux X-Patchwork-Id: 11561135 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 B07FE739 for ; Wed, 20 May 2020 19:48:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 96EE0207D8 for ; Wed, 20 May 2020 19:48:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="VHhNNquw" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727065AbgETTsG (ORCPT ); Wed, 20 May 2020 15:48:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726548AbgETTsF (ORCPT ); Wed, 20 May 2020 15:48:05 -0400 Received: from mail-qv1-xf41.google.com (mail-qv1-xf41.google.com [IPv6:2607:f8b0:4864:20::f41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44187C061A0E; Wed, 20 May 2020 12:48:05 -0700 (PDT) Received: by mail-qv1-xf41.google.com with SMTP id l3so1951132qvo.7; Wed, 20 May 2020 12:48:05 -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=f08QCVkXmCuV4hmVQ66aE7hr9gARDnjGT1g+Wtl0yJA=; b=VHhNNquwAk/a7Usf6kujmahG7WWe64TkkdgxddTbEL2SUmyPov1o9vfRewqpN7lltl /YoejAgiqe3hT7tYhWLgy0aiO9pXdWaGtHN7SILIiJXXxYMFT0esW0oB/uGHFjobKQMQ KeDafpbVZ14qFWGhlhGpMZrZNznv27RywTOG+9tLt5pO79K6q/T8orlmw6h7N+T2OVRx 61pRMf42QkaqzzeHABzChlKq9msWesFzueneS5g1YQf0oOMsKAtSgYlHDNK4+c6h3YTL N87REPb/rgQKkmisaUYxrgnvyq8hd093VqF/fg2YtXGxFXRJbuuZeQZtWa4QmvQ+rqIF KzGg== 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=f08QCVkXmCuV4hmVQ66aE7hr9gARDnjGT1g+Wtl0yJA=; b=RWo6cvI4rmWZIoSIQMCZCwnNXG+Vs91aiIIs7hMKTjUy69h7hEfcKtsA/2BGsHFzZQ APkY0ykcPC0mVNlJJ8mbpV/06ZyHkpJNJn7suDLqw4/2osXqPQCvzi16jqf1GNzbkLZK gmEebEO2c8JgNvXvjtYe7z2aNeXjcELyqbpiDGg/icS3VEhYE/ZZa314npM8us10cdtY dRYDlra5UQmqDbSaJN/wSE4WWk+TQaOZKOBGfu6igk3QBE/jzHu0yb7R7W8qM+xxUX9v CA8nl6NEZAZrH44NYHSE0p0uIEnZEtjoTDfOR3E+fnKonTC4PW7RGXnDZ8qZvbIeEehs UI1w== X-Gm-Message-State: AOAM533kcmvxpw483Qt7eXU58cNwiGh/as3U/HZGpXIB2XX17qhau3nl VZ55zdilZaGB1Z5Yetq3WKgetyVjjyc6Xw== X-Google-Smtp-Source: ABdhPJw8TgA1AaDY2H2R1Lt+vM3lgCDO/EE6rPFMSX6YN8NM35i95lEAOuQ7IZN0JeLJQpEgcXU/eQ== X-Received: by 2002:ad4:556a:: with SMTP id w10mr6853745qvy.100.1590004083983; Wed, 20 May 2020 12:48:03 -0700 (PDT) Received: from ict14-OptiPlex-980.kataweb.it ([178.23.248.46]) by smtp.googlemail.com with ESMTPSA id m33sm3158419qte.17.2020.05.20.12.48.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 May 2020 12:48:03 -0700 (PDT) From: Jonathan Albrieux To: linux-kernel@vger.kernel.org Cc: ~postmarketos/upstreaming@lists.sr.ht, daniel.baluta@nxp.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 v3 3/5] iio: imu: bmi160: fix typo Date: Wed, 20 May 2020 21:46:42 +0200 Message-Id: <20200520194656.16218-4-jonathan.albrieux@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200520194656.16218-1-jonathan.albrieux@gmail.com> References: <20200520194656.16218-1-jonathan.albrieux@gmail.com> Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Fix a typo in MODULE_AUTHOR() argument. Signed-off-by: Jonathan Albrieux --- drivers/iio/imu/bmi160/bmi160_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/imu/bmi160/bmi160_core.c b/drivers/iio/imu/bmi160/bmi160_core.c index 6af65d6f1d28..77b05bd4a2b2 100644 --- a/drivers/iio/imu/bmi160/bmi160_core.c +++ b/drivers/iio/imu/bmi160/bmi160_core.c @@ -853,6 +853,6 @@ int bmi160_core_probe(struct device *dev, struct regmap *regmap, } EXPORT_SYMBOL_GPL(bmi160_core_probe); -MODULE_AUTHOR("Daniel Baluta "); MODULE_DESCRIPTION("Bosch BMI160 driver"); MODULE_LICENSE("GPL v2"); From patchwork Wed May 20 19:46:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Albrieux X-Patchwork-Id: 11561137 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 4B78414B7 for ; Wed, 20 May 2020 19:48:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 33990207D8 for ; Wed, 20 May 2020 19:48:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="KZH9PT/P" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727097AbgETTsL (ORCPT ); Wed, 20 May 2020 15:48:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49836 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726958AbgETTsK (ORCPT ); Wed, 20 May 2020 15:48:10 -0400 Received: from mail-qt1-x843.google.com (mail-qt1-x843.google.com [IPv6:2607:f8b0:4864:20::843]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21DBAC061A0E; Wed, 20 May 2020 12:48:10 -0700 (PDT) Received: by mail-qt1-x843.google.com with SMTP id p12so3560949qtn.13; Wed, 20 May 2020 12:48:10 -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=7dEuExu+9nzLFNcGG5lhUu0m/vxx9QxDZgwULvJaokQ=; b=KZH9PT/PGeCGhHyyEfu1A52E/sLv/KbKDoJSVCAnbgC72NRyOILNJ5IkpzAAVDQ3Pt CvqJjk2WRNewK2N1FDZV9ZGG/OJBpbH40O1euLzSIfmL+zvAU2cxVxqPCe6U+Modz8Du P3rNkJJjm40vV+jUfePplExH55BWaP9MZ8HkLkdh93QMg03t8HtYNnsckRsyDGOkfmhp zzS3wN4LLdskZ5tBI94M+Dh3xH1s1XKwvz//ONgQ10HZx1R16+jJqTukkIE//+S2IKTA 4MYxwDQxKK6JZ9Hgz2ZdviQJSmBbYMlbt5d4UN++8eklit7SZzXViQCuzL7lTdWfzrYO p+iQ== 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=7dEuExu+9nzLFNcGG5lhUu0m/vxx9QxDZgwULvJaokQ=; b=erx/dRJOrIXhNgYormbINN4GOy3j07+VEj7NoXtybzqr31FlrZLv8+nPkRndAO7g6s iSxAwgkI3BVJrjoiuj7w930ByLT0MEaNy+jYHJ9n3LpQg9z69wmDuOLhFiuWzsjbyjeZ KxwYrgfqtK1BBKHSzNcTRyF+NzcwFCy3BZnf0o8TZVLxZcx5qqnXLpJb9ZgSk5QwTn47 lYvNtYG9o9ncg1hsRRMq+Y+zDU6k+1RjyrrtWCsF7LVeVm7GPeS0vde93DYUz9NuMkWe nbE4hz94pOkubCiMqpum1Xc1TbVStCTeD9PuzNGVuWpvWHE7K4Qv+G2z5Dq/z+89n2sB MOEQ== X-Gm-Message-State: AOAM532UTmTvArumjtk6zlrh/H6z+XSB6rt42d7tmOzbcOhpIrwx01ap nDfFyNG407nrmwbc7T7soQvshwEiWa9XDw== X-Google-Smtp-Source: ABdhPJxCRf6EBAl3t+4KkcqdCplFla7TOi9pKWVX5O4BufA3M9xnLUzuiXdX/Mlb+CkNJ1FFSnW1Tw== X-Received: by 2002:ac8:1090:: with SMTP id a16mr7277316qtj.181.1590004088836; Wed, 20 May 2020 12:48:08 -0700 (PDT) Received: from ict14-OptiPlex-980.kataweb.it ([178.23.248.46]) by smtp.googlemail.com with ESMTPSA id m33sm3158419qte.17.2020.05.20.12.48.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 May 2020 12:48:08 -0700 (PDT) From: Jonathan Albrieux To: linux-kernel@vger.kernel.org Cc: ~postmarketos/upstreaming@lists.sr.ht, daniel.baluta@nxp.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 v3 4/5] iio: imu: bmi160: added regulator support Date: Wed, 20 May 2020 21:46:43 +0200 Message-Id: <20200520194656.16218-5-jonathan.albrieux@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200520194656.16218-1-jonathan.albrieux@gmail.com> References: <20200520194656.16218-1-jonathan.albrieux@gmail.com> Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Add vdd-supply and vddio-supply support. Signed-off-by: Jonathan Albrieux --- drivers/iio/imu/bmi160/bmi160.h | 2 ++ drivers/iio/imu/bmi160/bmi160_core.c | 24 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/drivers/iio/imu/bmi160/bmi160.h b/drivers/iio/imu/bmi160/bmi160.h index 621f5309d735..923c3b274fde 100644 --- a/drivers/iio/imu/bmi160/bmi160.h +++ b/drivers/iio/imu/bmi160/bmi160.h @@ -3,10 +3,12 @@ #define BMI160_H_ #include +#include struct bmi160_data { struct regmap *regmap; struct iio_trigger *trig; + struct regulator_bulk_data supplies[2]; }; 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 77b05bd4a2b2..d3316ca02fbd 100644 --- a/drivers/iio/imu/bmi160/bmi160_core.c +++ b/drivers/iio/imu/bmi160/bmi160_core.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -709,6 +710,12 @@ static int bmi160_chip_init(struct bmi160_data *data, bool use_spi) unsigned int val; struct device *dev = regmap_get_device(data->regmap); + ret = regulator_bulk_enable(ARRAY_SIZE(data->supplies), data->supplies); + if (ret) { + dev_err(dev, "Failed to enable regulators: %d\n", ret); + return ret; + } + ret = regmap_write(data->regmap, BMI160_REG_CMD, BMI160_CMD_SOFTRESET); if (ret) return ret; @@ -793,9 +800,16 @@ int bmi160_probe_trigger(struct iio_dev *indio_dev, int irq, u32 irq_type) static void bmi160_chip_uninit(void *data) { struct bmi160_data *bmi_data = data; + struct device *dev = regmap_get_device(bmi_data->regmap); + int ret; bmi160_set_mode(bmi_data, BMI160_GYRO, false); bmi160_set_mode(bmi_data, BMI160_ACCEL, false); + + ret = regulator_bulk_disable(ARRAY_SIZE(bmi_data->supplies), + bmi_data->supplies); + if (ret) + dev_err(dev, "Failed to disable regulators: %d\n", ret); } int bmi160_core_probe(struct device *dev, struct regmap *regmap, @@ -815,6 +829,16 @@ int bmi160_core_probe(struct device *dev, struct regmap *regmap, dev_set_drvdata(dev, indio_dev); data->regmap = regmap; + data->supplies[0].supply = "vdd"; + data->supplies[1].supply = "vddio"; + ret = devm_regulator_bulk_get(dev, + ARRAY_SIZE(data->supplies), + data->supplies); + if (ret) { + dev_err(dev, "Failed to get regulators: %d\n", ret); + return ret; + } + ret = bmi160_chip_init(data, use_spi); if (ret) return ret; From patchwork Wed May 20 19:46:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Albrieux X-Patchwork-Id: 11561139 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 2EE8714B7 for ; Wed, 20 May 2020 19:48:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 15721207D8 for ; Wed, 20 May 2020 19:48:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Sl5Q5x/A" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727125AbgETTsP (ORCPT ); Wed, 20 May 2020 15:48:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726837AbgETTsP (ORCPT ); Wed, 20 May 2020 15:48:15 -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 0CD22C061A0E; Wed, 20 May 2020 12:48:15 -0700 (PDT) Received: by mail-qk1-x741.google.com with SMTP id m11so4904293qka.4; Wed, 20 May 2020 12:48:15 -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=Sl5Q5x/AR2Cz1CAvTwZdOUzSDcS1IoQUjBY1fsHBdcZ5ff2iJLVCx4Wpgo6pWMtppo Qg7bibiXvAe0J8B48njqtDUyPxTy4DEiIxugvAX4yguVlx4js6USdh9R6krQ8K0qMkb4 GQXRXRAp7J3Eo4Fjn4o5dxvzoJDqdgAdficdKdEJT+elbKteocf+XSgjeX3HOHQDoilN 5SVI+N1BJpSw+t0v/iI9aHQ468Qb8y4xefOE9hRmHUqdQBziUqAWiRnRv3w81Xr1ZKK6 mxx3q0LJPp3PybZYh+BNcnfZh2oOgvhWX6+t6hIvlO20GBW/Iok4ZqsJe3PccDdaqTAz gM+Q== 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=O7Qt2rvhoc0s51IxfywynxLjjbP8qwyjH9ycjOUKGRXFxmdiCkWLMJOiaqhroP3ibm BZ6kHQznw1FocKAFnJFUizxcRTY5SbU0St0y6c710bbdcAY23AGhqH/FOE08haFIQTbA /62o6D9ztOTdGzGLy93Rrf2yy6EASvxgjPADbT1EWt6dDkZhglaHnBLlXq91klu14sJi iFBgkolHFPFvpMubYuBphpO5AkYpT9mRsjDRXaSoNxADY026FYHAGcmttr8WY24H1wEv 7f9p6P3WFhqPGzGovQqdUJq7/LyiwCG58Q2PRwAZoxSZ998LgPyhavCrJmTNFMDDSlst tJ3g== X-Gm-Message-State: AOAM531XasSpPIIjpQr11kNZEOmS9x1MHvFhZY/P+UrrDVfRE5BzAe5b e753oHku8zGgwRj1wIjeep5R/tQFSH3Z+g== X-Google-Smtp-Source: ABdhPJzmmfjnZ7v5lGiG7IP3kli4Yc3gZcR3wRYRHUJSWq/PIhQlU1MF8BbwpjcxK2O6dG5qUal0DA== X-Received: by 2002:a37:7347:: with SMTP id o68mr5962002qkc.343.1590004093902; Wed, 20 May 2020 12:48:13 -0700 (PDT) Received: from ict14-OptiPlex-980.kataweb.it ([178.23.248.46]) by smtp.googlemail.com with ESMTPSA id m33sm3158419qte.17.2020.05.20.12.48.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 May 2020 12:48:13 -0700 (PDT) From: Jonathan Albrieux To: linux-kernel@vger.kernel.org Cc: ~postmarketos/upstreaming@lists.sr.ht, daniel.baluta@nxp.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 v3 5/5] iio: imu: bmi160: added mount-matrix support Date: Wed, 20 May 2020 21:46:44 +0200 Message-Id: <20200520194656.16218-6-jonathan.albrieux@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200520194656.16218-1-jonathan.albrieux@gmail.com> References: <20200520194656.16218-1-jonathan.albrieux@gmail.com> Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@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;