Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp2947357ybk; Mon, 18 May 2020 11:48:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwrmBAf+AS9bhq8OfLiKuStk57FzEo29PIwOZXlfMtpwqHt/Z01YS2P3q2NPannhin/x5bc X-Received: by 2002:a05:6402:17a3:: with SMTP id j3mr15531742edy.137.1589827725394; Mon, 18 May 2020 11:48:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589827725; cv=none; d=google.com; s=arc-20160816; b=LP9vjcKTIE0AuJ0WP+bwtEL8f3myLiJHhHRdJafiHNTd5Da/DQ0eN/2vpLS3GPRsiZ pPvWNNbld8Odhb0z6JGEwGs0neEUHXNumSaM3RoimuPevg71KYmKHf+A2zNbqrKJxSWv n7x2tpy+CexWdsH3qNtge3Zc/T+0NKX2eHYYVrBJCJ/82e9T4b1hVtBtN6vCkPBWhG/u KqL3kKSKcgvGMmhqQvfN7hhPipEvNXF63uP6FJLsWs/nM7DInJfPO+DSJSQb/otTV/Hg p9JjT5mxQtbc8rTTejJMvBzriXGSHGlUXp/cDLZxl2o1BSOQLK9CVWJfgclJoo0jP/WC H7vQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=ajUUjOWwQ0DqJ5ZMnnC6t+z/SimK+2ZbwTZGGdO/CyY=; b=iMboM8le0DiC99wFDd2J91IIJAtpyCvSZneXyt1m5EVSKx67fJm03HYi7cawF5wbtC zDPeV66BkVSzp04bP7UulCm0mzylX7dvHseupZ3cyFyHhpJhPniUrBK4m3v4ftU6s3dq eEi3xut6uuBqYgo5xUCSTCEYOHS0tXdmp8XsGFuHvyOGS+g5WKl015PjbeKxFly2l4+p a+m2p8TB5dPa7eMFTrT4x4+mU7SXzoX6M1WOSeRjth38s2emeptopmkpdcSlYAfiJKxW pg7SjLg4GFY+mf3UFl/KN/2Bx0HdXhyl2b4GU0ni79BV4UxtduluvlG3oV3UBOnzz/TE ryvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=K8f12VYS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id do11si8573930ejc.450.2020.05.18.11.48.21; Mon, 18 May 2020 11:48:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=K8f12VYS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729114AbgERSqy (ORCPT + 99 others); Mon, 18 May 2020 14:46:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727938AbgERSqy (ORCPT ); Mon, 18 May 2020 14:46:54 -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 C3D0CC061A0C; Mon, 18 May 2020 11:46:53 -0700 (PDT) Received: by mail-wr1-x442.google.com with SMTP id l17so13088288wrr.4; Mon, 18 May 2020 11:46:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=ajUUjOWwQ0DqJ5ZMnnC6t+z/SimK+2ZbwTZGGdO/CyY=; b=K8f12VYSqcYyx6phIY6bXX4cN19vPs+9Uv3zg4VH/KQLBDMIpN/gXJkbIqO62vycJm j4tySzxQ4pTnKNepWLErP8Tg/BIQKvFoZsnMB4EHYWT/4D+7NzzHWZ61w3HHKNVMdJjW +96ktIxV7En7owWoDOkgYD9KtTHxtF5aOHj2e86DgYnDR0siDem+KecZ3irdnVPD0OGc MLLznwbf5tGlHLDCcEyp71fOZk8VWrgXXyDCminnWSMaeAYjo2TQ9ze+86Ue+uKewDQo 0LWewLgJQjScPAEXskYZTdLxg7jnfjxXgeaJlcM8yNd4uojxe4nj27etFHAGgYFZ4hRj ZXUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=ajUUjOWwQ0DqJ5ZMnnC6t+z/SimK+2ZbwTZGGdO/CyY=; b=VJmBMnQmhPmcK+KvDMsfMPsDBRiTmZdNdxOFceDn+dmJMKcs4gEUCdUntFw67dioqp mU0PSOGhdGkKldTrCfAmOEzsdISjQTNQdJYlQ0c/oYq849GSSo8OsIFWnNI7nODVogCg dW59kclh/trILf1Cvrr7k76B6udUmPWCAsl42gdIEvPK7xhCFsHnS3OwrHP3ByxCLWep LbnyMhjkRsLwD6Sl5xtXqh7Gp9ctWY9tScyiJq/in+/mAJHX0QrlmfkFEwK+6oUcQ59J cLPSipZp28dhIqKeeqQz46H+G42ym6YDU0+htzQs5gWS2ebpEF2HnfY1TrLOuSespPpk O9tQ== X-Gm-Message-State: AOAM530eFpBYrMvxWp9OmVK2KGbQ3PMiVTc4ZOAawRY0FouWI1iv8o+P QunPAxkRtjHpfO+Ht/UTeJQ= X-Received: by 2002:a5d:6a01:: with SMTP id m1mr22282524wru.64.1589827612345; Mon, 18 May 2020 11:46:52 -0700 (PDT) Received: from jonathan-N53SV ([151.81.99.112]) by smtp.gmail.com with ESMTPSA id l11sm595119wmf.28.2020.05.18.11.46.50 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 May 2020 11:46:50 -0700 (PDT) Date: Mon, 18 May 2020 20:46:47 +0200 From: Jonathan Albrieux To: Andy Shevchenko Cc: Linux Kernel Mailing List , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Greg Kroah-Hartman , Hartmut Knaack , Jonathan Cameron , Lars-Peter Clausen , Linus Walleij , "open list:IIO SUBSYSTEM AND DRIVERS" , Peter Meerwald-Stadler , Steve Winslow , Thomas Gleixner , Jonathan Cameron Subject: Re: [PATCH 3/3] iio: magnetometer: ak8975: Add gpio reset support Message-ID: <20200518184647.GB6392@jonathan-N53SV> References: <20200518133645.19127-1-jonathan.albrieux@gmail.com> <20200518133645.19127-4-jonathan.albrieux@gmail.com> <20200518160120.GA21361@ict14-OptiPlex-980> <20200518164317.GL1634618@smile.fi.intel.com> <20200518174335.GA6392@jonathan-N53SV> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 18, 2020 at 08:51:29PM +0300, Andy Shevchenko wrote: > On Mon, May 18, 2020 at 8:43 PM Jonathan Albrieux > wrote: > > > > On Mon, May 18, 2020 at 07:43:17PM +0300, Andy Shevchenko wrote: > > > On Mon, May 18, 2020 at 06:01:20PM +0200, Jonathan Albrieux wrote: > > > > On Mon, May 18, 2020 at 05:55:51PM +0300, Andy Shevchenko wrote: > > > > > On Mon, May 18, 2020 at 4:38 PM Jonathan Albrieux > > > > > wrote: > > > > > > > > > > > + gpiod_set_value_cansleep(data->reset_gpiod, 1); > > > > > > > > > > (1) > > > > > > > > > > ... > > > > > > > > > > > + /* > > > > > > + * If reset pin is provided then will be set to high on power on > > > > > > + * and to low on power off according to AK09911 datasheet > > > > > > + */ > > > > > > > > > > Wording is confusing, perhaps you have to use 'asserted / deasserted'. > > > > > > > > Thank you for the suggestion, I'll be working on rewording as soon as > > > > possible. > > > > > > > > > Btw, in (1) it's also "high" (asserted). I barely understand how it's > > > > > supposed to work in all cases? > > > > > > > > > > > + reset_gpiod = devm_gpiod_get_optional(&client->dev, > > > > > > + "reset", GPIOD_OUT_HIGH); > > > > > > + if (IS_ERR(reset_gpiod)) > > > > > > + return PTR_ERR(reset_gpiod); > > > > > > > > > > > > > I'm sorry but I'm not sure about what you mean by saying all cases. > > > > Currently I'm testing this driver on a msm8916 device having AK09911 > > > > magnetometer. At the current stage the driver is failing on probe > > > > because reset pin is not connected to VID (as datasheet requires in case > > > > of pin not being used). In case of reset pin not asserted, register's > > > > reset is triggered resulting in empty registers, leading to probe fail. > > > > For this reason pin is asserted during power on in order to have > > > > informations in registers and deasserted before power off triggering > > > > a reset. > > > > > > > > A workaround that gets AK09911 working on device is by setting the > > > > reset pin always high on device tree. This way registers gets reset by > > > > a Power On Reset circuit autonomously and reset pin never triggers the > > > > reset. > > > > > > You need to distinguish electrical level from logical (GPIO flag defines > > > logical). So, I'm talking about active-high vs. active-low case. > > > > > > Now I re-read above, and see that here you assert the reset signal. But where > > > is desertion? > > > > Oh I see, I'll try explaining by points the proposed approach: > > - reset pin is active low > > - during power on gpio is set to 0 so the reset pin is high, thus no reset > > deasserted > > > - during power off gpio is set to 1 so the reset pin becomes low, thus resetting > > asserted > > > this is a possible solution but maybe there are other ways to achieve that, > > do you have suggestions on how to get a better approach for solving this issue? > > I see now, that at requesting reset you wanted to chip be in reset > state (asserted) till driver calls power_on(). > > Seems everything you done is correct. Just correct terminology, please. Will surely do, thank you! > -- > With Best Regards, > Andy Shevchenko Best regards, Jonathan Albrieux