From patchwork Mon May 25 15:10:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Albrieux X-Patchwork-Id: 11568999 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 52E621667 for ; Mon, 25 May 2020 15:13:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3B78F20878 for ; Mon, 25 May 2020 15:13:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Ni4yXWC7" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391089AbgEYPNk (ORCPT ); Mon, 25 May 2020 11:13:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390911AbgEYPNk (ORCPT ); Mon, 25 May 2020 11:13:40 -0400 Received: from mail-qk1-x743.google.com (mail-qk1-x743.google.com [IPv6:2607:f8b0:4864:20::743]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6B20C061A0E; Mon, 25 May 2020 08:13:39 -0700 (PDT) Received: by mail-qk1-x743.google.com with SMTP id q8so1248162qkm.12; Mon, 25 May 2020 08:13:39 -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=+oCV4nRbYNUq3uy56ypQlMlQHdGFj6LYw1i9ejafKrc=; b=Ni4yXWC71m9yWzw6hnlFq8+MoeuGDA+C1jZn2PQK6A1G8OryU4zzvNssJ4Dgm8pJyl FjDWgFcnEa4cIA3uiamrl8Fwi9wGJHSn2knw5vqYeyhiilg55Z89+GCWvEZgeilOQ0o5 Sw10Xp0YaRZ2VPG1v3kOge+ViI5f0/Dldzcpt0jMg/1MycA9cBgfzgXp25C1u/B/ZRNv 7TmSya7XXwCXfE6bnm7vToVC5pbgfieZGg+0o4SOlY/hnA8iJX4HTMqzzL1OLaek2cqR ajtXTj33XT1PEQSGzsDsks4Pf11iP2toVWD83kl6WhU5hJTOIpl2tElGVEeTg4jzxsv1 +orQ== 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=+oCV4nRbYNUq3uy56ypQlMlQHdGFj6LYw1i9ejafKrc=; b=SVLm1rfpkir+nKZDI4CBpbOx1Q/MANC5DBOJeO2x2cS0qAdygnsrREm04G/OhGk1C5 fTOCJnW2Fz1/Lp3rc0hv8rS8POL3l5/NRkZV+DXnYwzZBmwh2t/JTnRssfeNDvEZHCmo r9mClCaMzeLw0wJ7m4mXFcK/4CA2EfceIcoqJ5MptGRiOjruAzXQm1mn2b4uar24xoK8 14eBBtGdZ7eo+krIOCDaKXYLbMX3BtA8egFNYoL7TtBelrUUAqf54jVJ4gphSx1repUU q5ev+u/4Z0c524/huMq2oT6SzskaG6kjeT8aboNpJNy5r2znfWrQ+c7p8pIrs0U/3Reo phnA== X-Gm-Message-State: AOAM530weJVRAsTZW6Em4usBSp+T837rmzWWylXD69Mbph2iC0xvnC2D XQWZE3Dt+cPieu6jlt0lyVud4gF2hMU= X-Google-Smtp-Source: ABdhPJzWpuoqyDq6wmhiJtMAUOFWz15qHfZD5TiuZO4MP7FhOBxmm0ED1lgoAw6vInophDbAFiPZ2g== X-Received: by 2002:a37:4f97:: with SMTP id d145mr7008981qkb.191.1590419618632; Mon, 25 May 2020 08:13:38 -0700 (PDT) Received: from ict14-OptiPlex-980.kataweb.it ([178.23.248.46]) by smtp.googlemail.com with ESMTPSA id m59sm15161709qtd.46.2020.05.25.08.13.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 May 2020 08:13:38 -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), Hartmut Knaack , Jonathan Cameron , Lars-Peter Clausen , Linus Walleij , linux-iio@vger.kernel.org (open list:IIO SUBSYSTEM AND DRIVERS), Peter Meerwald-Stadler , Jonathan Cameron , Rob Herring Subject: [PATCH v6 1/5] dt-bindings: iio: magnetometer: ak8975: reword gpios, add interrupts, fix style Date: Mon, 25 May 2020 17:10:35 +0200 Message-Id: <20200525151117.32540-2-jonathan.albrieux@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200525151117.32540-1-jonathan.albrieux@gmail.com> References: <20200525151117.32540-1-jonathan.albrieux@gmail.com> Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Reword gpios documentation, add interrupt documentation and fix styles. Update example to use interrupts instead of gpios. Signed-off-by: Jonathan Albrieux Reviewed-by: Rob Herring --- .../bindings/iio/magnetometer/ak8975.txt | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/Documentation/devicetree/bindings/iio/magnetometer/ak8975.txt b/Documentation/devicetree/bindings/iio/magnetometer/ak8975.txt index aa67ceb0d4e0..0576b9df0bf2 100644 --- a/Documentation/devicetree/bindings/iio/magnetometer/ak8975.txt +++ b/Documentation/devicetree/bindings/iio/magnetometer/ak8975.txt @@ -2,21 +2,28 @@ Required properties: - - compatible : should be "asahi-kasei,ak8975" - - reg : the I2C address of the magnetometer + - 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 + - gpios : AK8975 has a "Data ready" pin (DRDY) which informs that data + is ready to be read and is possible to listen on it. If used, + this should be active high. Prefer interrupt over this. + + - interrupts : interrupt for DRDY pin. Triggered on rising edge. + + - 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>; + interrupt-parent = <&gpio6>; + interrupts = <15 IRQ_TYPE_EDGE_RISING>; vdd-supply = <&ldo_3v3_gnss>; mount-matrix = "-0.984807753012208", /* x0 */ "0", /* y0 */ From patchwork Mon May 25 15:10:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Albrieux X-Patchwork-Id: 11569001 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 078FF13B4 for ; Mon, 25 May 2020 15:13:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DF63620888 for ; Mon, 25 May 2020 15:13:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="SB8c3hIz" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391100AbgEYPNt (ORCPT ); Mon, 25 May 2020 11:13:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390911AbgEYPNt (ORCPT ); Mon, 25 May 2020 11:13:49 -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 CDB82C061A0E; Mon, 25 May 2020 08:13:47 -0700 (PDT) Received: by mail-qt1-x843.google.com with SMTP id i68so13973069qtb.5; Mon, 25 May 2020 08:13:47 -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=ONUvX5nfhwjam7it4NTQUc8WRuAIpoShkHVzxyWlR1Q=; b=SB8c3hIz52rTP5Bjs6HVmw7oqPBecGfl3+hgPAwD6hbTJ8BEASDakrKZLPmIrFCKDV /shysHxitLQ2WEcsOcgS+6c7kzmNuIrtAbW7h9B2P+HenuAMeVaSrivVu1vUK1lZq4+B uBZ9Mn6XhTGI+Ddqxcqb+pxKDsITzc4MWQRM+hMKnuGvr+lL+kkDQ1HJNbJwiHwOdRWb SIemIqHzQ/5ZvO/ANHOVjp87RstRH/S90oJ5RJqk9d36TdXOv0yT463dIo6dWOyZIlj7 l9ak0F/u6/xahcdPu9DpVhHk9cXkk1oe2z5tWwY0HGf11L/2jDJeYd9sBEYwxzvMadSq d1jw== 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=ONUvX5nfhwjam7it4NTQUc8WRuAIpoShkHVzxyWlR1Q=; b=CZCMktbCPe1qTAWfYdz6EtQi/HuvJED8EWU6oC39FfL5FEa1NsEIMj7ZvvY7DsMNtL AWLJfDGtNZZkMeO6M0fD7li7YfbnEroVmaMXzzPSUKkZHgz2/SVbtudmjfg9jacfDkiL ru6aZamgKkEFdcRTNTRp5GmAWfU0Mx/vhCrRO7JdmIK92h3YQ2sFCXLpeq0UvFLUbp+Z LJMLa1cPN6VgxP8L6dn5Ow69r7fZZcOBK5tXp/4o4/ffHmG7Df6UVSrdcU3iNHslrjaw m3M/fZenUThXL87VYWF8YeBxnOS3SnFTF2mrKk4dH+xgrjBv9vjhq3dhbux0JoLccXWA jiXA== X-Gm-Message-State: AOAM533abVfolYkLXw0YeibDcME2GrR9ZvPHBr9vebTKf9vDC1xBerRc J7XL1NtU9kTKIiPWxRiQv83mFu6mDHM= X-Google-Smtp-Source: ABdhPJw/DXeQ6+lok+kYQFpo2WpjKPnnnlWzcGZMUHSB5ci4aEENUGDhbFvPKD279sNm6Ro4+M2XoA== X-Received: by 2002:ac8:5253:: with SMTP id y19mr6200880qtn.291.1590419625291; Mon, 25 May 2020 08:13:45 -0700 (PDT) Received: from ict14-OptiPlex-980.kataweb.it ([178.23.248.46]) by smtp.googlemail.com with ESMTPSA id m59sm15161709qtd.46.2020.05.25.08.13.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 May 2020 08:13:44 -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), Hartmut Knaack , Jonathan Cameron , Lars-Peter Clausen , Linus Walleij , linux-iio@vger.kernel.org (open list:IIO SUBSYSTEM AND DRIVERS), Peter Meerwald-Stadler , Jonathan Cameron , Rob Herring Subject: [PATCH v6 2/5] dt-bindings: iio: magnetometer: ak8975: convert format to yaml, add maintainer Date: Mon, 25 May 2020 17:10:36 +0200 Message-Id: <20200525151117.32540-3-jonathan.albrieux@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200525151117.32540-1-jonathan.albrieux@gmail.com> References: <20200525151117.32540-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 | 37 --------- .../iio/magnetometer/asahi-kasei,ak8975.yaml | 78 +++++++++++++++++++ 2 files changed, 78 insertions(+), 37 deletions(-) delete mode 100644 Documentation/devicetree/bindings/iio/magnetometer/ak8975.txt create mode 100644 Documentation/devicetree/bindings/iio/magnetometer/asahi-kasei,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 0576b9df0bf2..000000000000 --- a/Documentation/devicetree/bindings/iio/magnetometer/ak8975.txt +++ /dev/null @@ -1,37 +0,0 @@ -* AsahiKASEI AK8975 magnetometer sensor - -Required properties: - - - compatible : should be "asahi-kasei,ak8975". - - reg : the I2C address of the magnetometer. - -Optional properties: - - - gpios : AK8975 has a "Data ready" pin (DRDY) which informs that data - is ready to be read and is possible to listen on it. If used, - this should be active high. Prefer interrupt over this. - - - interrupts : interrupt for DRDY pin. Triggered on rising edge. - - - 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>; - interrupt-parent = <&gpio6>; - interrupts = <15 IRQ_TYPE_EDGE_RISING>; - 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/asahi-kasei,ak8975.yaml b/Documentation/devicetree/bindings/iio/magnetometer/asahi-kasei,ak8975.yaml new file mode 100644 index 000000000000..a603659d5fa5 --- /dev/null +++ b/Documentation/devicetree/bindings/iio/magnetometer/asahi-kasei,ak8975.yaml @@ -0,0 +1,78 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/iio/magnetometer/asahi-kasei,ak8975.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: AsahiKASEI AK8975 magnetometer sensor + +maintainers: + - Jonathan Albrieux + +properties: + compatible: + oneOf: + - const: asahi-kasei,ak8975 + - const: asahi-kasei,ak8963 + - const: asahi-kasei,ak09911 + - const: asahi-kasei,ak09912 + - const: ak8975 + deprecated: true + - const: ak8963 + deprecated: true + - const: ak09911 + deprecated: true + - const: ak09912 + deprecated: true + + reg: + maxItems: 1 + description: the I2C address of the magnetometer. + + gpios: + description: | + AK8975 has a "Data ready" pin (DRDY) which informs that data + is ready to be read and is possible to listen on it. If used, + this should be active high. Prefer interrupt over this. + + interrupts: + maxItems: 1 + description: interrupt for DRDY pin. Triggered on rising edge. + + 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: + - | + #include + i2c { + #address-cells = <1>; + #size-cells = <0>; + + magnetometer@c { + compatible = "asahi-kasei,ak8975"; + reg = <0x0c>; + interrupt-parent = <&gpio6>; + interrupts = <15 IRQ_TYPE_EDGE_RISING>; + 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 Mon May 25 15:10:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Albrieux X-Patchwork-Id: 11569003 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 9BA4213B4 for ; Mon, 25 May 2020 15:13:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 834B120878 for ; Mon, 25 May 2020 15:13:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="PjOUR4I5" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391109AbgEYPNw (ORCPT ); Mon, 25 May 2020 11:13:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390911AbgEYPNv (ORCPT ); Mon, 25 May 2020 11:13:51 -0400 Received: from mail-qv1-xf43.google.com (mail-qv1-xf43.google.com [IPv6:2607:f8b0:4864:20::f43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64D15C061A0E; Mon, 25 May 2020 08:13:51 -0700 (PDT) Received: by mail-qv1-xf43.google.com with SMTP id d1so8146651qvl.6; Mon, 25 May 2020 08:13:51 -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=6S/8PdeZHtD6Dk+IxLUBEW23iujsINDZr8pVo+NGkYA=; b=PjOUR4I5BTBh72jpIl7SBkdAlsUMREWv3tslU3NzCeIQ0n2RFH9G6ha3BCVVZbZxwZ CkmoIZwXdRo8Cp1VcBdu1dcySa9gbkXLzvfnCzHtZAMmbWmAnruCpEa0wM0rGV5pBT+b MIEa2Oj/XJIgFRAbaU8yE2jNAFyHab9WnzXXRE48Zaj5y1rQLW8PZKguGkyIwWVmQfX+ 9ITvYiOWUb961IOYh4u+d0TYiiKmjQhM2ErTxjz22GG2JNk8cXVJDUC3wnH29uOzj720 sQD1TaM8ELkTDfI+VRZKPuWCw+HMFticdu/2uwaE5O64bmnX3uFQnNG5882yqqYtHhsH kNgA== 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=6S/8PdeZHtD6Dk+IxLUBEW23iujsINDZr8pVo+NGkYA=; b=kuP3yQJEOh+AdWbHD7n93pvg84wesSTFB5pgjLW+0WFbcLnjhMSH+kAME9Pn8ovGK5 zEJEXR8aN6e9kgFAmBAqBgE4NCjtRkYlJWj6wVBQlfdfLVFfty784riyygsu0Z4Me96P fI6jPGqZJv/hnW62SwAfV05p6OtNM8AxOWuriycr9QkWb4sYqPrgkWv8/XDFN3w5z1U/ sgAhf7YF14iwTTp3UzXJulR6VHK7MEupb6pt0/xS5z64MfdgkgkSMF3RPvPHhBlzEApS g4lPYyNTLvPX59bqDxv/U3zFLOaToJm/KKFsp/ZVRFnz0MrGhCUMB4xuJEhAVJNXA5mY /Svw== X-Gm-Message-State: AOAM5332UIdsJO1HuNpxjGlDWu+vXVzylSfq/gpTDwrGQzsvtb9W+W2K fQFGUHe6WOfcjjsaRMDTMmzbyJc2fzY= X-Google-Smtp-Source: ABdhPJz6M0H6Vpxr8rBl7mvSWDkpkhIuhZmj3p8Lwc08wHJY1UNVd2P3TkUtUzJ5sz/KBHfKT4+Y4w== X-Received: by 2002:ad4:48c5:: with SMTP id v5mr16329844qvx.203.1590419630217; Mon, 25 May 2020 08:13:50 -0700 (PDT) Received: from ict14-OptiPlex-980.kataweb.it ([178.23.248.46]) by smtp.googlemail.com with ESMTPSA id m59sm15161709qtd.46.2020.05.25.08.13.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 May 2020 08:13:49 -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), Hartmut Knaack , Jonathan Cameron , Lars-Peter Clausen , Linus Walleij , linux-iio@vger.kernel.org (open list:IIO SUBSYSTEM AND DRIVERS), Peter Meerwald-Stadler , Jonathan Cameron , Rob Herring Subject: [PATCH v6 3/5] dt-bindings: iio: magnetometer: ak8975: add gpio reset support Date: Mon, 25 May 2020 17:10:37 +0200 Message-Id: <20200525151117.32540-4-jonathan.albrieux@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200525151117.32540-1-jonathan.albrieux@gmail.com> References: <20200525151117.32540-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 datasheet says that, if not used, reset pin should be connected to VID. This patch emulates this situation. Signed-off-by: Jonathan Albrieux Reviewed-by: Linus Walleij Reviewed-by: Rob Herring --- .../bindings/iio/magnetometer/asahi-kasei,ak8975.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Documentation/devicetree/bindings/iio/magnetometer/asahi-kasei,ak8975.yaml b/Documentation/devicetree/bindings/iio/magnetometer/asahi-kasei,ak8975.yaml index a603659d5fa5..04b895c7143c 100644 --- a/Documentation/devicetree/bindings/iio/magnetometer/asahi-kasei,ak8975.yaml +++ b/Documentation/devicetree/bindings/iio/magnetometer/asahi-kasei,ak8975.yaml @@ -48,6 +48,11 @@ properties: mount-matrix: description: an optional 3x3 mounting rotation matrix. + reset-gpios: + description: | + an optional pin needed for AK09911 to set the reset state. This should + be usually active low + required: - compatible - reg @@ -55,6 +60,7 @@ required: examples: - | #include + #include i2c { #address-cells = <1>; #size-cells = <0>; @@ -65,6 +71,7 @@ examples: interrupt-parent = <&gpio6>; interrupts = <15 IRQ_TYPE_EDGE_RISING>; vdd-supply = <&ldo_3v3_gnss>; + reset-gpios = <&msmgpio 111 GPIO_ACTIVE_LOW>; mount-matrix = "-0.984807753012208", /* x0 */ "0", /* y0 */ "-0.173648177666930", /* z0 */ From patchwork Mon May 25 15:10:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Albrieux X-Patchwork-Id: 11569005 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 96B1F13B4 for ; Mon, 25 May 2020 15:13:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7D15F20888 for ; Mon, 25 May 2020 15:13:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gVXdPXXo" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391042AbgEYPN4 (ORCPT ); Mon, 25 May 2020 11:13:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53416 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390911AbgEYPNz (ORCPT ); Mon, 25 May 2020 11:13:55 -0400 Received: from mail-qv1-xf44.google.com (mail-qv1-xf44.google.com [IPv6:2607:f8b0:4864:20::f44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 27FB4C061A0E; Mon, 25 May 2020 08:13:55 -0700 (PDT) Received: by mail-qv1-xf44.google.com with SMTP id er16so8174814qvb.0; Mon, 25 May 2020 08:13:55 -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=hOveqjYBk1+7IoXrKWjzzpmC29NQEFV/46uICdldkHU=; b=gVXdPXXopF7sZKyfLkpXhnDjmG91BAvZFhit3m4U/Kf7vbUsdS1MaqtyiZCtOFewLu cyZ9abfP/ybjZJ6k7Cb7UGVRZqItL6PSgsDZeEL28hpqGQRjMLUpJxFcpUgHm7cgF0iE /2An10ke44dWaR9GaEhlwpjDJ3f+m/F0by2BDSq6STQ7kFOK4Y2fEwqjCQI5I0pfpc05 TluUqb+JnuYRlkzeJAqbR75TwkwUEmnFBOV0SMpcivO2+/PMhhqUpM5n6o7DaGTpQHMT CRmFDalKkctWb0f7To5RJyVtdY62m1HS73qfVJfNF+OpZ4EtkcVpzf55TP63RejxRlcR RgQw== 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=hOveqjYBk1+7IoXrKWjzzpmC29NQEFV/46uICdldkHU=; b=OaVqg4zBwrNAMCBzaNM0XW+7PnTf3L5WFY4nTtM2WSMn9cEBFXyGMzt/FP3Slp0d/e PrTt0AnoSIXV0iI/O9kgheQP9eHU7TEEx0/WN0PxD5SNT8l3u3/LPehT1xspG4dALusK Pk1MopQRzLC83TDrQXC7oNH77UPkeltQ/iuoErrY+IbHEpK5a+Dj2s702hJziU6lqKeC 3YIDFVn5o5HlpYAuUAXCqkOnIwm3vApbfkHnUba8KZGv7W0ACfMwWOQzefNz3QICzhcb YFIhh/egLqocRDBZXBbjaG28vIprYhdQVXxCfxEm6ibj0fY06nXN4ebC5n+Mv6xBWVA+ u5Gw== X-Gm-Message-State: AOAM532gWDJsLh0KS6AXcCZ90tJtBkXVBhAIInZcFRAhFGOm+YAsBM8Z Sa+ZIBE1WbE7OnXqORispXKo4GzVUao= X-Google-Smtp-Source: ABdhPJylKVKkXL0TB1tXR1ODFqz1l+bqEr0JZSlxih5cY7X7YGhNM19C1ZKnPHu9E4iSU2ZTOSYMmQ== X-Received: by 2002:a05:6214:18e3:: with SMTP id ep3mr15193075qvb.132.1590419634032; Mon, 25 May 2020 08:13:54 -0700 (PDT) Received: from ict14-OptiPlex-980.kataweb.it ([178.23.248.46]) by smtp.googlemail.com with ESMTPSA id m59sm15161709qtd.46.2020.05.25.08.13.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 May 2020 08:13:53 -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), Hartmut Knaack , Jonathan Cameron , Lars-Peter Clausen , Linus Walleij , linux-iio@vger.kernel.org (open list:IIO SUBSYSTEM AND DRIVERS), Peter Meerwald-Stadler , Jonathan Cameron Subject: [PATCH v6 4/5] iio: magnetometer: ak8975: Fix typo, uniform measurement unit style Date: Mon, 25 May 2020 17:10:38 +0200 Message-Id: <20200525151117.32540-5-jonathan.albrieux@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200525151117.32540-1-jonathan.albrieux@gmail.com> References: <20200525151117.32540-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 Mon May 25 15:10:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Albrieux X-Patchwork-Id: 11569007 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 03D7F1667 for ; Mon, 25 May 2020 15:14:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DEA1620888 for ; Mon, 25 May 2020 15:14:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hGkGvRfe" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391133AbgEYPOC (ORCPT ); Mon, 25 May 2020 11:14:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53428 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390911AbgEYPN7 (ORCPT ); Mon, 25 May 2020 11:13:59 -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 2890CC061A0E; Mon, 25 May 2020 08:13:59 -0700 (PDT) Received: by mail-qt1-x841.google.com with SMTP id i68so13973505qtb.5; Mon, 25 May 2020 08:13:59 -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=ru/VedSe7R+1+BFX/X1C1fyozp4gv15sJxfe6kqv7eI=; b=hGkGvRfewXL/XVWCtw/1yM4HGdq4xhSFVnp57d6slIupYO/QR5w7vJivFODHlLHKKi h1CqjJY4dfAhIMj1aYJvLOj1Bj+E5cfR30dEJDBuVpvXGoUjk9mEly+3jgnBdwr44e2i NmWguyEsnH6vor/uPdkzOIPNh5a/fSfnCq8oa7os3Zhu6QOBNwyOyUdeF4X6K4fvyfaw 0VIwvas5sfEsTByqiwKzY9wSSzi5wPg04gWyfoYSzvWZ7Ex4emUV25inzq1Y8GKw6K5j KANBO0YpDh83xUwgZvQDH5lmChv0m91bdBg2YOO6lHfjjot5kQvKGqcGt+GqOIpDmG5i bb4g== 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=ru/VedSe7R+1+BFX/X1C1fyozp4gv15sJxfe6kqv7eI=; b=r3gc+PNhFGt/zfttalcDGTTUB8eGdg1PP2P7kl8r1mT/Gma8/hKdmI/HgFobMVb1ym W1LUn02Kmh8p4D2nDwVRn7TZunZnQmCwIBKCV/7t9ScUaW2OrsbFS3PL2LwmHZJEGX5y qgbJtVXg5juuIOoFsBMPNMBX7i4A/2jlr02Ris5iVJSnGwj2wXrlgo6qsLec6pR7xSQ5 wL/lsqA8fsT7envLn2ZN+EdmVEiU9vIQtSALbrvPE+zZXl4A4BJgjze95iuUe0uwgfgP ruSaNUoXgHCj5o7L4olTGm37uesvegFyjMOa6kJz0d1F6jy05kcLVcudOWIl6AYlfcKi UrVA== X-Gm-Message-State: AOAM530dOFO0gko5ISawoJ4MbYhTlaKWAmPrsMrvqL6QpQf9BN4AtAR1 zv27raH3KGJRI+sPKihJvWsenQTd+xI= X-Google-Smtp-Source: ABdhPJy1vWV3DAXN8xTdYv6MZ+TxlR/V+rZo1l1GwaSal+Gx42Ve0EDaKggl5gGSOvGddZ7GwM8ZuQ== X-Received: by 2002:ac8:7659:: with SMTP id i25mr16544452qtr.270.1590419637841; Mon, 25 May 2020 08:13:57 -0700 (PDT) Received: from ict14-OptiPlex-980.kataweb.it ([178.23.248.46]) by smtp.googlemail.com with ESMTPSA id m59sm15161709qtd.46.2020.05.25.08.13.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 May 2020 08:13:57 -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), Hartmut Knaack , Jonathan Cameron , Lars-Peter Clausen , Linus Walleij , linux-iio@vger.kernel.org (open list:IIO SUBSYSTEM AND DRIVERS), Peter Meerwald-Stadler , Jonathan Cameron Subject: [PATCH v6 5/5] iio: magnetometer: ak8975: Add gpio reset support Date: Mon, 25 May 2020 17:10:39 +0200 Message-Id: <20200525151117.32540-6-jonathan.albrieux@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200525151117.32540-1-jonathan.albrieux@gmail.com> References: <20200525151117.32540-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 datasheet 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);