From patchwork Tue May 19 12:43:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Albrieux X-Patchwork-Id: 11557583 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 5DE03912 for ; Tue, 19 May 2020 12:44:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4195D20823 for ; Tue, 19 May 2020 12:44:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="q7Bo0+s9" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728845AbgESMo1 (ORCPT ); Tue, 19 May 2020 08:44:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726991AbgESMo0 (ORCPT ); Tue, 19 May 2020 08:44:26 -0400 Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 608AAC08C5C0; Tue, 19 May 2020 05:44:26 -0700 (PDT) Received: by mail-wr1-x42a.google.com with SMTP id l18so15753381wrn.6; Tue, 19 May 2020 05:44:26 -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=UuE4oeDec9qAyVLiH4N3OcfTsRxRxFlH0npfYHPrt4k=; b=q7Bo0+s9nI4igCOHnkCwb3/zmKf12UlzXFRLoFul8bwBURBO+Ww4b5SG9kghNv8R5L 6R1nMnEqhuMLAQhRvxeaYLG/hw+61CyfitZNyNONEPsEq5TO9B2wC+eQepBGN1948/K3 eWT2AWswdXkDNE73Hr8OWouk2uQX+TvKy2uPwnFoKXJ5oek4qL1CMu8eyNocwhI0RaJX MXj6Va667RlHCYjUmniBOTgIdBfwq1h8z1UthiyOzPpBpsW2riXXOpMB2OQKBnftRxVs 7UyOesvrMn+hoW9EI2K/EUJ98mFlJGu6m2U5hdviRJuwynpOfczohadulnrKNgCwuqXF QbTQ== 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=UuE4oeDec9qAyVLiH4N3OcfTsRxRxFlH0npfYHPrt4k=; b=KXul0WnKk58CJdHM9iTMV5PbFxBj3bkyZiLRQbxBgcziVV2Hy14eSW7DHx9IlRUKsJ 5qi/B2bgAPHUfNB/k3hltye37Y/NvpQCzpVKvzPxVgk12XhYoNIRB6y4eCvbdHy4iy4o +E3qS4QOkdrTs/VntWBCppRt21mLijX7Z1vFT9nlgUknepY1vNee/kcc9ajsYATbTZao 3sLflKY3A3NnuPETzYG3UpDHpL1SE6utIrGmy8dcOmHfxsNv54is7C+Of0KPP2dj+7Dc dCfzAfUJLk0L2Xf6mf5bBSgRzP6L2cOKHybAPIJFGmW9bjqSUVR3wk/DpXy/nEFUnLGC tOTQ== X-Gm-Message-State: AOAM533+gXHlEiclSxsUrubOR2E0SDkdxelyKHLFHenvwysBTuFcUrCO kex3sunCejW2FHehjAovQzt8adA+19655w== X-Google-Smtp-Source: ABdhPJw4Yho/CE6NxkMeZduHovxUmApdpUSgBaaZYQ48k+d/YkBDMkDAA8o1VYnGvoDeR1InX8807Q== X-Received: by 2002:a05:6000:1009:: with SMTP id a9mr27638997wrx.403.1589892264209; Tue, 19 May 2020 05:44:24 -0700 (PDT) Received: from ict14-OptiPlex-980.kataweb.it ([178.23.248.46]) by smtp.googlemail.com with ESMTPSA id b12sm3953870wmj.0.2020.05.19.05.44.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 May 2020 05:44:23 -0700 (PDT) From: Jonathan Albrieux To: linux-kernel@vger.kernel.org Cc: ~postmarketos/upstreaming@lists.sr.ht, Jonathan Albrieux , Andy Shevchenko , devicetree@vger.kernel.org (open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS), Greg Kroah-Hartman , Hartmut Knaack , Jilayne Lovejoy , Jonathan Cameron , Kate Stewart , Lars-Peter Clausen , Linus Walleij , linux-iio@vger.kernel.org (open list:IIO SUBSYSTEM AND DRIVERS), Peter Meerwald-Stadler , Steve Winslow , Thomas Gleixner , Jonathan Cameron , Rob Herring Subject: [PATCH v3 1/4] dt-bindings: iio: magnetometer: ak8975: convert txt format to yaml Date: Tue, 19 May 2020 14:43:51 +0200 Message-Id: <20200519124402.26076-2-jonathan.albrieux@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200519124402.26076-1-jonathan.albrieux@gmail.com> References: <20200519124402.26076-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 --- .../bindings/iio/magnetometer/ak8975.txt | 30 --------- .../bindings/iio/magnetometer/ak8975.yaml | 66 +++++++++++++++++++ 2 files changed, 66 insertions(+), 30 deletions(-) delete mode 100644 Documentation/devicetree/bindings/iio/magnetometer/ak8975.txt create mode 100644 Documentation/devicetree/bindings/iio/magnetometer/ak8975.yaml diff --git a/Documentation/devicetree/bindings/iio/magnetometer/ak8975.txt b/Documentation/devicetree/bindings/iio/magnetometer/ak8975.txt deleted file mode 100644 index aa67ceb0d4e0..000000000000 --- a/Documentation/devicetree/bindings/iio/magnetometer/ak8975.txt +++ /dev/null @@ -1,30 +0,0 @@ -* AsahiKASEI AK8975 magnetometer sensor - -Required properties: - - - compatible : should be "asahi-kasei,ak8975" - - reg : the I2C address of the magnetometer - -Optional properties: - - - gpios : should be device tree identifier of the magnetometer DRDY pin - - vdd-supply: an optional regulator that needs to be on to provide VDD - - mount-matrix: an optional 3x3 mounting rotation matrix - -Example: - -ak8975@c { - compatible = "asahi-kasei,ak8975"; - reg = <0x0c>; - gpios = <&gpj0 7 0>; - vdd-supply = <&ldo_3v3_gnss>; - mount-matrix = "-0.984807753012208", /* x0 */ - "0", /* y0 */ - "-0.173648177666930", /* z0 */ - "0", /* x1 */ - "-1", /* y1 */ - "0", /* z1 */ - "-0.173648177666930", /* x2 */ - "0", /* y2 */ - "0.984807753012208"; /* z2 */ -}; diff --git a/Documentation/devicetree/bindings/iio/magnetometer/ak8975.yaml b/Documentation/devicetree/bindings/iio/magnetometer/ak8975.yaml new file mode 100644 index 000000000000..86e3efa693a8 --- /dev/null +++ b/Documentation/devicetree/bindings/iio/magnetometer/ak8975.yaml @@ -0,0 +1,66 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/iio/magnetometer/ak8975.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: AsahiKASEI AK8975 magnetometer sensor + +maintainers: + - can't find a mantainer, author is Laxman Dewangan + +properties: + compatible: + enum: + - "asahi-kasei,ak8975" + - "ak8975" + - "asahi-kasei,ak8963" + - "ak8963" + - "asahi-kasei,ak09911" + - "ak09911" + - "asahi-kasei,ak09912" + - "ak09912" + + reg: + maxItems: 1 + description: the I2C address of the magnetometer + + gpios: + description: should be device tree identifier of the magnetometer DRDY pin + + vdd-supply: + maxItems: 1 + description: | + an optional regulator that needs to be on to provide VDD power to + the sensor. + + mount-matrix: + description: an optional 3x3 mounting rotation matrix + +required: + - compatible + - reg + +examples: + - | + i2c@78b7000 { + reg = <0x78b6000 0x600>; + #address-cells = <1>; + #size-cells = <0>; + + ak8975@c { + compatible = "asahi-kasei,ak8975"; + reg = <0x0c>; + gpios = <&gpj0 7 0>; + vdd-supply = <&ldo_3v3_gnss>; + mount-matrix = "-0.984807753012208", /* x0 */ + "0", /* y0 */ + "-0.173648177666930", /* z0 */ + "0", /* x1 */ + "-1", /* y1 */ + "0", /* z1 */ + "-0.173648177666930", /* x2 */ + "0", /* y2 */ + "0.984807753012208"; /* z2 */ + }; + }; From patchwork Tue May 19 12:43:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Albrieux X-Patchwork-Id: 11557589 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 55DBF913 for ; Tue, 19 May 2020 12:44:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3E6C6206C3 for ; Tue, 19 May 2020 12:44:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="sETFH7px" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728875AbgESMod (ORCPT ); Tue, 19 May 2020 08:44:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728869AbgESMo3 (ORCPT ); Tue, 19 May 2020 08:44:29 -0400 Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72266C08C5C0; Tue, 19 May 2020 05:44:29 -0700 (PDT) Received: by mail-wm1-x341.google.com with SMTP id f134so2928753wmf.1; Tue, 19 May 2020 05:44:29 -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=jfvT9uA0eu5W3Ndyf2EIIWVhSCqK5/sx7OIEpRxugJ8=; b=sETFH7pxB/VLh576Yx/jY1DlUpiI7RGGUZRgYEzCYCj0VvawGm+v2MgkgtI8jJTudC eG/yvelXn+SCptYFg4vWFRw5WkhRmSIPMy4Z/pfR4k30ll9k9Lk2rkw0e/Zt/Sjy9UB8 JO+1t5AHuShC8siXyFxmN6QoWJcPgczLIAQMIxVRehHbPf1XOa4ki9PNz9HtMc65GMR9 2qbFXyEuqbtxkIgER1Eo7zwmeipeZky1TycC/XcQCNryuH1izp5rLBv+mNHUsG9OGYJI PkVM4ye4rr+vSWPCdzUES4vHzdu2xmD+Qfhb3NfjV4RTvwkw/KX1E8AB/JMg02b4B9f3 XKoA== 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=jfvT9uA0eu5W3Ndyf2EIIWVhSCqK5/sx7OIEpRxugJ8=; b=Lx37EJWGCEv3J9RnakfOy3iE4e/iKbsFUlyPP7Cszgnm1MOeNktVeA9Xc5W42klwAD BOoNa0zCkZPfNYgaorJ0JNsMITODWBZBwyj3h5C5S+O8IavCTnz+OwD6QbE03ZbN2JAr 8444q7bfi4zo6zV2kas4zbcxj5bL5NZIG/lbF/TgIpxUd75eWsR3PriCafjysmEkkPrK VpJWy8KZSaIhtXfuqfQ/1vTVYy5j82NzB2TI/DaFTWU+4dtNupzlr+X6mFb3Oao0KL7n colqwezxuCWF+fnc+d7o6GbvtIfU5NoNFvKCHjhA1Q8zGjbD8+3gkVBTUkxWeDpen3xQ 4Y2Q== X-Gm-Message-State: AOAM532Ti2aEaqdrNKK6PcpeV3MmEjMOPW+evwGXM1VAtMUjkTokbY0r OzUDRuzvGkQNlbEQ8zBDuawyj+Mg0lsZTw== X-Google-Smtp-Source: ABdhPJwPQdgQNqbxNA8WlDoBXfKplt1SdvrG2YJD+XWvLpfyBcQDcjMXKFRcYkvUlROAE2/S1NynKw== X-Received: by 2002:a1c:f211:: with SMTP id s17mr5757742wmc.168.1589892267534; Tue, 19 May 2020 05:44:27 -0700 (PDT) Received: from ict14-OptiPlex-980.kataweb.it ([178.23.248.46]) by smtp.googlemail.com with ESMTPSA id b12sm3953870wmj.0.2020.05.19.05.44.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 May 2020 05:44:26 -0700 (PDT) From: Jonathan Albrieux To: linux-kernel@vger.kernel.org Cc: ~postmarketos/upstreaming@lists.sr.ht, Jonathan Albrieux , Andy Shevchenko , devicetree@vger.kernel.org (open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS), Greg Kroah-Hartman , Hartmut Knaack , Jilayne Lovejoy , Jonathan Cameron , Kate Stewart , Lars-Peter Clausen , Linus Walleij , linux-iio@vger.kernel.org (open list:IIO SUBSYSTEM AND DRIVERS), Peter Meerwald-Stadler , Steve Winslow , Thomas Gleixner , Jonathan Cameron , Rob Herring Subject: [PATCH v3 2/4] dt-bindings: iio: magnetometer: ak8975: add gpio reset support Date: Tue, 19 May 2020 14:43:52 +0200 Message-Id: <20200519124402.26076-3-jonathan.albrieux@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200519124402.26076-1-jonathan.albrieux@gmail.com> References: <20200519124402.26076-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 reset-gpio support. Without reset's deassertion during ak8975_power_on(), driver's probe fails on ak8975_who_i_am() while checking for device identity for AK09911 chip. AK09911 has an active low reset gpio to handle register's reset. AK09911 datasheed says that, if not used, reset pin should be connected to VID. This patch emulates this situation. Signed-off-by: Jonathan Albrieux --- .../devicetree/bindings/iio/magnetometer/ak8975.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Documentation/devicetree/bindings/iio/magnetometer/ak8975.yaml b/Documentation/devicetree/bindings/iio/magnetometer/ak8975.yaml index 86e3efa693a8..a82c0ff5d098 100644 --- a/Documentation/devicetree/bindings/iio/magnetometer/ak8975.yaml +++ b/Documentation/devicetree/bindings/iio/magnetometer/ak8975.yaml @@ -37,6 +37,9 @@ properties: mount-matrix: description: an optional 3x3 mounting rotation matrix + reset-gpio: + description: an optional pin needed for AK09911 to set the reset state + required: - compatible - reg @@ -53,6 +56,7 @@ examples: reg = <0x0c>; gpios = <&gpj0 7 0>; vdd-supply = <&ldo_3v3_gnss>; + reset-gpio = <&msmgpio 111 1>; mount-matrix = "-0.984807753012208", /* x0 */ "0", /* y0 */ "-0.173648177666930", /* z0 */ From patchwork Tue May 19 12:43:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Albrieux X-Patchwork-Id: 11557585 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 19E05912 for ; Tue, 19 May 2020 12:44:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F3D94206C3 for ; Tue, 19 May 2020 12:44:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Y080PQs6" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728887AbgESMoe (ORCPT ); Tue, 19 May 2020 08:44:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726991AbgESMod (ORCPT ); Tue, 19 May 2020 08:44:33 -0400 Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89F1CC08C5C2; Tue, 19 May 2020 05:44:32 -0700 (PDT) Received: by mail-wr1-x443.google.com with SMTP id l18so15753770wrn.6; Tue, 19 May 2020 05:44:32 -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=Nt3Mx2nCd5A0j6CNOFkJnbMZZLSJU9VkhbQdru91GsY=; b=Y080PQs6bwsIcu4HcdRx24Qw2UShJDwEQIqKYzbkbPjo65gQQ8Gcs055FfA2NVyVX1 cYeLYHLL3iKIkhyvuJV+bVANlvxv1jfBNXyqX1PdR/pNoK6VlOfTcShflRbxqMQDrZqD wJuRPg4+iuEpuo5c6npIQqLt2+WPEBJAQddBVTac3CbQ6gwx/17PN+JR2OqvCSqB/wm0 Fjn/6sl1jr/kKZ+cY8XNnWdxu26rFoDLF6IZdcG0Fk2WwkRZtErDzaFEdOTn/QBaqYVv du1gk3fXNVQFOykTT9jFhaHzRD+Qqx37svkHL+WqD4oJxUYcTRf8hD5bW0k0Y57YTMJ/ 4eFg== 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=Nt3Mx2nCd5A0j6CNOFkJnbMZZLSJU9VkhbQdru91GsY=; b=VZD+Z9YXZZmCmqWE+jt9RXX7cqPB7PqzzB/ITSKo2oSWVPQfhsw+wRWRUl3mLhNpIE nLEiPSeIdIfXh+JQGAdiWZF193K1hQtHmKtW9oyxr3vAQFGIhMxbhk4ZP0fX1b8vJRKl zAwbhrGzgXQOAiQpnmur0SpMPYgy8JRumJlICFqw+g/Yr8Z/ZGhYqTvPjMk3Jm59Ohu6 9zoExmgNnaZdNj4Q2ZEX44C3Jb+j3yDYdrE0y3kbdiVDJCXrq+Drm8/KEjraE+bmO+ZM 76YeXRc+oo9FcFQgJ6OViIQINR2cRq2vN8MuQUT5jQnu5EFGjy02ZhvnCba3KnV6SEK3 uSPQ== X-Gm-Message-State: AOAM5336SB09nXiFMK37Z1/YrJsoulhLiAcuC8hs0ZM9zxys6NvJ5zQ+ clbUxPp9EcSEWSdMl5RUuxCnflm609gjhA== X-Google-Smtp-Source: ABdhPJw47dp67aFXdWNdXrhCMDXNnNem0viHkXBIHfdN4yPk3oPZ0WiMaImFUJbcQBgHgpmx5+R8hQ== X-Received: by 2002:a5d:46cf:: with SMTP id g15mr27649709wrs.276.1589892270220; Tue, 19 May 2020 05:44:30 -0700 (PDT) Received: from ict14-OptiPlex-980.kataweb.it ([178.23.248.46]) by smtp.googlemail.com with ESMTPSA id b12sm3953870wmj.0.2020.05.19.05.44.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 May 2020 05:44:29 -0700 (PDT) From: Jonathan Albrieux To: linux-kernel@vger.kernel.org Cc: ~postmarketos/upstreaming@lists.sr.ht, Jonathan Albrieux , Andy Shevchenko , devicetree@vger.kernel.org (open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS), Greg Kroah-Hartman , Hartmut Knaack , Jilayne Lovejoy , Jonathan Cameron , Kate Stewart , Lars-Peter Clausen , Linus Walleij , linux-iio@vger.kernel.org (open list:IIO SUBSYSTEM AND DRIVERS), Peter Meerwald-Stadler , Steve Winslow , Thomas Gleixner , Jonathan Cameron Subject: [PATCH v3 3/4] iio: magnetometer: ak8975: Fix typo, uniform measurement unit style Date: Tue, 19 May 2020 14:43:53 +0200 Message-Id: <20200519124402.26076-4-jonathan.albrieux@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200519124402.26076-1-jonathan.albrieux@gmail.com> References: <20200519124402.26076-1-jonathan.albrieux@gmail.com> Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Minor comment style edits. Signed-off-by: Jonathan Albrieux Reviewed-by: Andy Shevchenko --- drivers/iio/magnetometer/ak8975.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iio/magnetometer/ak8975.c b/drivers/iio/magnetometer/ak8975.c index 3c881541ae72..fd368455cd7b 100644 --- a/drivers/iio/magnetometer/ak8975.c +++ b/drivers/iio/magnetometer/ak8975.c @@ -385,9 +385,9 @@ static int ak8975_power_on(const struct ak8975_data *data) return ret; } /* - * According to the datasheet the power supply rise time i 200us + * According to the datasheet the power supply rise time is 200us * and the minimum wait time before mode setting is 100us, in - * total 300 us. Add some margin and say minimum 500us here. + * total 300us. Add some margin and say minimum 500us here. */ usleep_range(500, 1000); return 0; From patchwork Tue May 19 12:43:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Albrieux X-Patchwork-Id: 11557587 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 DF1C9912 for ; Tue, 19 May 2020 12:44:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C4833206C3 for ; Tue, 19 May 2020 12:44:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="A+sT2Y7V" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728822AbgESMoj (ORCPT ); Tue, 19 May 2020 08:44:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728869AbgESMof (ORCPT ); Tue, 19 May 2020 08:44:35 -0400 Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DDD68C08C5C0; Tue, 19 May 2020 05:44:34 -0700 (PDT) Received: by mail-wr1-x442.google.com with SMTP id w7so15690138wre.13; Tue, 19 May 2020 05:44:34 -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=FM1JmGR/XyNvOFJbZPXQGrpNEzXCNoP8xq4dKDH4+U8=; b=A+sT2Y7VObAjcJNLFNTRvXlYLhshYYP1aKVL3dgMUbjJMkZah81uyVIV0BORb9bJx5 SV9W1fLfpgwPEvF9bk7OpNWl8BsXCMLSbq/wBeborTNW/X44Kw5Cs+rtRG4baePY1KpN RsS8FQ6Wz1coqGXhKROfvAMX+wMzAHEqrw3I2AYAlYOTpY9Rb98DMbcgLM2zfnRYoqZk lhsI2SHwv/4m7wo7szju6g9L1y3vnXrGRHqD1mzSCl+j8mbamFsOo1Wv6rp1NzLbOmGi EPOm/TTgg781bxRn96mH0Qk5LitCkCwDggxGAPxUrf7jz6SnI4ZWI8G0JdEUdUf2XzjP O0Jw== 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=FM1JmGR/XyNvOFJbZPXQGrpNEzXCNoP8xq4dKDH4+U8=; b=jnBcOEDbvbD+sWs1HLibfRNSxLpLgCGky6RvTY+6MV+6FktzCCcNoG1epT0slY+lkX tZ81LYjV4IFY6/p32PuNejAPrwY3hS4B3oF+k5HnrxH7aJOOXPTJWhNbDk84dUVy5RsQ ayBTCWH0geFwZAaZCvPn0Iy5hxaf/FHcQHlKPQSjh2hL1xKKSxKbda2aZOd19B55Hrgq SeVXxd4FWb8grc9/Oc9JBQYYuwr3em6/go04zZ56C2rqP/9181o03DpXXz6yxrGWApvz pzInhtnl/0HHAXmfmZfMYyh+PNwUyxzEKjiSgoj8NlSRw+I8ZNQTuJI5ct0oCd6AC46d Te2g== X-Gm-Message-State: AOAM533hKwnhB5T00sQZCMswIVVdjRz7Ici7W6hIBBROPEhkICYW+DWE fPompCffliETNx/RY9Qf0y0MEHKeFqhziQ== X-Google-Smtp-Source: ABdhPJxHN6++bAS6sIIPL4V8O1yCDlTOnBt1TcBn32R9JK+cLug/0WPY/VXi5Y2DCYQfUBKOmzAlHw== X-Received: by 2002:a5d:6b83:: with SMTP id n3mr27555402wrx.213.1589892272808; Tue, 19 May 2020 05:44:32 -0700 (PDT) Received: from ict14-OptiPlex-980.kataweb.it ([178.23.248.46]) by smtp.googlemail.com with ESMTPSA id b12sm3953870wmj.0.2020.05.19.05.44.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 May 2020 05:44:32 -0700 (PDT) From: Jonathan Albrieux To: linux-kernel@vger.kernel.org Cc: ~postmarketos/upstreaming@lists.sr.ht, Jonathan Albrieux , Andy Shevchenko , devicetree@vger.kernel.org (open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS), Greg Kroah-Hartman , Hartmut Knaack , Jilayne Lovejoy , Jonathan Cameron , Kate Stewart , Lars-Peter Clausen , Linus Walleij , linux-iio@vger.kernel.org (open list:IIO SUBSYSTEM AND DRIVERS), Peter Meerwald-Stadler , Steve Winslow , Thomas Gleixner , Jonathan Cameron , Allison Randal Subject: [PATCH v3 4/4] iio: magnetometer: ak8975: Add gpio reset support Date: Tue, 19 May 2020 14:43:54 +0200 Message-Id: <20200519124402.26076-5-jonathan.albrieux@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200519124402.26076-1-jonathan.albrieux@gmail.com> References: <20200519124402.26076-1-jonathan.albrieux@gmail.com> Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org According to AK09911 datasheet, if reset gpio is provided then deassert reset on ak8975_power_on() and assert reset on ak8975_power_off(). Without reset's deassertion during ak8975_power_on(), driver's probe fails on ak8975_who_i_am while() checking for device identity for AK09911 chip. AK09911 has an active low reset gpio to handle register's reset. AK09911 datasheed says that, if not used, reset pin should be connected to VID. This patch emulates this situation. Signed-off-by: Jonathan Albrieux Reviewed-by: Andy Shevchenko Reviewed-by: Stephan Gerhold --- drivers/iio/magnetometer/ak8975.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/iio/magnetometer/ak8975.c b/drivers/iio/magnetometer/ak8975.c index fd368455cd7b..a23422aad97d 100644 --- a/drivers/iio/magnetometer/ak8975.c +++ b/drivers/iio/magnetometer/ak8975.c @@ -358,6 +358,7 @@ struct ak8975_data { u8 asa[3]; long raw_to_gauss[3]; struct gpio_desc *eoc_gpiod; + struct gpio_desc *reset_gpiod; int eoc_irq; wait_queue_head_t data_ready_queue; unsigned long flags; @@ -384,6 +385,9 @@ static int ak8975_power_on(const struct ak8975_data *data) "Failed to enable specified Vid supply\n"); return ret; } + + gpiod_set_value_cansleep(data->reset_gpiod, 0); + /* * According to the datasheet the power supply rise time is 200us * and the minimum wait time before mode setting is 100us, in @@ -396,6 +400,8 @@ static int ak8975_power_on(const struct ak8975_data *data) /* Disable attached power regulator if any. */ static void ak8975_power_off(const struct ak8975_data *data) { + gpiod_set_value_cansleep(data->reset_gpiod, 1); + regulator_disable(data->vid); regulator_disable(data->vdd); } @@ -839,6 +845,7 @@ static int ak8975_probe(struct i2c_client *client, struct ak8975_data *data; struct iio_dev *indio_dev; struct gpio_desc *eoc_gpiod; + struct gpio_desc *reset_gpiod; const void *match; unsigned int i; int err; @@ -856,6 +863,16 @@ static int ak8975_probe(struct i2c_client *client, if (eoc_gpiod) gpiod_set_consumer_name(eoc_gpiod, "ak_8975"); + /* + * According to AK09911 datasheet, if reset GPIO is provided then + * deassert reset on ak8975_power_on() and assert reset on + * ak8975_power_off(). + */ + reset_gpiod = devm_gpiod_get_optional(&client->dev, + "reset", GPIOD_OUT_HIGH); + if (IS_ERR(reset_gpiod)) + return PTR_ERR(reset_gpiod); + /* Register with IIO */ indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data)); if (indio_dev == NULL) @@ -866,6 +883,7 @@ static int ak8975_probe(struct i2c_client *client, data->client = client; data->eoc_gpiod = eoc_gpiod; + data->reset_gpiod = reset_gpiod; data->eoc_irq = 0; err = iio_read_mount_matrix(&client->dev, "mount-matrix", &data->orientation);