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: 11569045 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 1FD7B60D 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 04309207DA 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 S2391174AbgEYQrw (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: 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 Reviewed-by: Rob Herring --- .../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: 11569047 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 85FCC912 for ; Mon, 25 May 2020 16:48:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6E2942070A for ; Mon, 25 May 2020 16:48:00 +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 S2391240AbgEYQrz (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: 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 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:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Albrieux X-Patchwork-Id: 11569049 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 A535D60D for ; Mon, 25 May 2020 16:48:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8C0352070A for ; Mon, 25 May 2020 16:48:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="mtrYLpjg" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391250AbgEYQr7 (ORCPT ); Mon, 25 May 2020 12:47:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391128AbgEYQr6 (ORCPT ); Mon, 25 May 2020 12:47:58 -0400 Received: from mail-qk1-x742.google.com (mail-qk1-x742.google.com [IPv6:2607:f8b0:4864:20::742]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B963C061A0E; Mon, 25 May 2020 09:47:58 -0700 (PDT) Received: by mail-qk1-x742.google.com with SMTP id f83so17874640qke.13; Mon, 25 May 2020 09:47:58 -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=mtrYLpjgJQNVFS8E4zeO5sj75OZJGvwc8onHdvABW/VG1RnE+/feTDefzb/dqcb7WU GzQjwewubJs4x7/SRLbOhO8/twrTo+qOq1DrH9Vuln5zsr2NOdrR2fbrX5zqH0H6CIjg 1jhwagy/0Geas6fvJ/t0I+WfCt3OB0F3pmaNnWYZhD6VFjhjKgqXJWfOg7t/GaKfpEAK i3p/fYjdq1G2Bq/RCdG7rN9UY7OgERsbwV6dGEmuyNa6F5AApHtN2sbvpn4mY47sBrfL m/vDmhNx4i08CSSN4zijny0E6IzdTH8qmI9g0+8py2WQ+xc029ni7MZUGvNZpnUCbcDK jV+w== 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=P0fbhVr5FYngGeWiLWlkvtJCZfr0N8+zAii+0q+uL1rriQMJ0fWypqW40qo0dnYc78 7JC7wizjFBmvqSsE3vh9xl2MPOPAVN5bEHHrZjp2sHLmVy3IXTp+Vbus1zr5SyJi6PRV 7gg9QrDAnj9/1kO6wbQ7ZUoFpliOpzKbcdpGp575mSqK7KLxZ4JWSZDj6Crg/l5eEZYU J5bj9QzlhJHqTTvqjj1Gci0JkzyUyNx0sAnWg/oe7ShqWJodRcqoNbPngQXinHbc4Exz EaSgqDBCIhOvTNADx6SyQ3gEKv2e6i9VBk+5ErhCii/6wX+zOaHTPfxCAVygnsWS4dwy +gTg== X-Gm-Message-State: AOAM533BHLcR1Gv4rH9hGThpvSx69z7jW1jQTAjjRV3UWg/CRyzmbJof ecVMUF/wjjA2Mfrmkq70Q5lEznvV4Oc= X-Google-Smtp-Source: ABdhPJx1v80pnFUvJQ+AGjxvzJ7JmPHZ/DhmR1h84N79yenNOioS305scgXWQswecFCwJ6b8T2ujqQ== X-Received: by 2002:a05:620a:4e2:: with SMTP id b2mr14310528qkh.16.1590425277348; Mon, 25 May 2020 09:47:57 -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.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 May 2020 09:47:56 -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 3/5] iio: imu: bmi160: fix typo Date: Mon, 25 May 2020 18:46:02 +0200 Message-Id: <20200525164615.14962-4-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: 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 Mon May 25 16:46:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Albrieux X-Patchwork-Id: 11569051 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 B0126912 for ; Mon, 25 May 2020 16:48:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 98D9620776 for ; Mon, 25 May 2020 16:48:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="AKB49A/y" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391262AbgEYQsF (ORCPT ); Mon, 25 May 2020 12:48:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388356AbgEYQsD (ORCPT ); Mon, 25 May 2020 12:48:03 -0400 Received: from mail-qt1-x841.google.com (mail-qt1-x841.google.com [IPv6:2607:f8b0:4864:20::841]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A1FEC061A0E; Mon, 25 May 2020 09:48:03 -0700 (PDT) Received: by mail-qt1-x841.google.com with SMTP id z1so2037690qtn.2; Mon, 25 May 2020 09:48:03 -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=xCXlo4z6q8wFTdTTHGR9qbnBVj136ztzEt0J9ce9F0c=; b=AKB49A/ybaEjv3ZjiZLKoft8hKCuF2YoxC0KfSFdFOVp0DlBtTRTFw8rNeHqZC+8aV J729slwtgG+gfJIShBkDaa6xAIjnJSuvs9Z1RylVTIGOOXigYOEXp3/AKA7wNpIRNMI8 /ZESVxhTbommQTNbnolrDcWadOE/OcvxJ4o3SKmx56DYC6RHhI9dQ4NiJOW1B8fCQ1CM 9BjwGqXZedcglScsvPU1hthsm1tnd9w8ugS1zM7T7tibWaVSWdQIi/ndYJcDIdZbqeNc M8lfCpk5MMFTRb3MVEgGW/nsIGL3iFg5YPmveZhkxJcBIhnMASxKw5YG/78Ob1Dk5S7U +FdA== 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=xCXlo4z6q8wFTdTTHGR9qbnBVj136ztzEt0J9ce9F0c=; b=s8vbdjzzwUaSRMAO+4h3USyr/OGMuc6v1au+n9/nBdz/vvf3pXp32cCeilxNatMoUh JBK76kcr0ARoU4zHsAcincqbaPJ8ywgG1xmrycVHfeUr9l9QvO8NAGRqwbt7TcyojUJU PD7gd901yZTZtM5LRrn/FmD0hihlDmkQXgbFp+yiWOLQ++bUpjSQX5BvXWKs5LWqQoGh siWMTsHpxGqt/e8GuiFMeKhFOCkZuVa2gRinAS8A8QOu0tGpcOejl/3ZXZFJq8eQy0ah 01773bIJ5kcXdqE03vMXwFwMeGF88KMTwC/eDM3b/gDnp7ZDQd0z6f/7xu6RDW7SYXRd 4LfA== X-Gm-Message-State: AOAM533vOjracf5VDuj4VDoePLLusALe+C5Li1DKWRwV4LkT8ZV38HN/ stlSyIYMy6gD/Q8D7fK8Ce8iOLvMjWU= X-Google-Smtp-Source: ABdhPJycUE6ab7dcczQP1Vh2PeOatQob4Hr/z14nS7tERErBqyUNAoSSMx4PdRui6tUXgqck2SvEew== X-Received: by 2002:ac8:6b03:: with SMTP id w3mr29640224qts.275.1590425282142; Mon, 25 May 2020 09:48:02 -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.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 May 2020 09:48:01 -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 4/5] iio: imu: bmi160: added regulator support Date: Mon, 25 May 2020 18:46:03 +0200 Message-Id: <20200525164615.14962-5-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: 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. While working on an msm8916 device and having explicit declarations for regulators, without setting these regulators to regulators-always-on it happened those lines weren't ready because they could have been controlled by other components, causing failure in module's probe. This patch aim is to solve this situation by adding regulators control during bmi160_chip_init() and bmi160_chip_uninit(), assuring power to this component. 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 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: 11569053 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 150CB60D 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 EBE0220776 for ; Mon, 25 May 2020 16:48:12 +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 S2404190AbgEYQsL (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: 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;