Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp1566152rdb; Sat, 2 Dec 2023 00:37:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IGHS9Hf/cDX+DIjMJMw6kwgs5SsI3k3JXAjmGppaVllkEE0p54F3I1Z/3fys1egXmIHisIO X-Received: by 2002:a05:6870:ac92:b0:1fb:75a:de5f with SMTP id ns18-20020a056870ac9200b001fb075ade5fmr1483206oab.77.1701506224650; Sat, 02 Dec 2023 00:37:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701506224; cv=none; d=google.com; s=arc-20160816; b=ygTUDt7Xa8qmAW45Kfr+ehbz5VP3Nv3YVnTbXtbhD/ODSuUdJgyTj2fdtAuDKbKbrx 2v9+STolSR9Y0brUL2rSLMg4P+mwiedUqdTUSj3buQtr846HSopzn5vOWg+/VQf9UBuQ xyGYDAtybYBTzKADR8xqRHeY5bPaLaH7DITYDi+Esrla+kksVhSoz3QkG+RaIgcgyfkC vWi2YqmSIrStYkHAMrFTZwO7eEGQbx2TPMiJJhjocMcVLXCsO7n2CKcs0tDAV523q1q4 05QxIK+LUKE6whVBbsuw50Op9WWaj3QNLcpWa90u2UVytujjn26gL6aoaESKhPSR85V5 apkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id:dkim-signature; bh=W1Cz0Am5xXhDu9ok/VyPf97AG12MnC7CAXjo29WYQyA=; fh=qYjeyHnIJXd7rRF1q1ihcAYOYvI61FIMcv/6IgOItGY=; b=0NefqokrdY6G/tn706qbUMIrX7W1i0OTZMotHW233Ds6Y3qQSR+TQSjzC7kbqYsZLg 0XayF+05QVM4rSKUcKTXRc8BblkmcvoqDVQzAt1AmwV9JdI0hAQFGUrJUk+8pGVyEcDJ MX9NsoDCFb4Uyydh9XIEAPhq5kT7rRggdInJECzG3MgbcghpAMBPTrIBNaz5paCtbW++ m+5m29b19dwyzxXfLU6ie02EYL7tvJAmZn67BP6YPIDMAMTE0dJBJmf1m9Q6fawTb/ZQ BwT8EkUwl9XjeG25eMfiM6Z5XdeAB9QOhHMaI/WZ892gFqoYFSHUduNYFy0ceOeYGpbK 4Q8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=F8GXHgIm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id w3-20020a63c103000000b005c2421e149esi4461829pgf.564.2023.12.02.00.37.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Dec 2023 00:37:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=F8GXHgIm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 1756E82F917A; Sat, 2 Dec 2023 00:37:02 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231223AbjLBIgq (ORCPT + 99 others); Sat, 2 Dec 2023 03:36:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231234AbjLBIgo (ORCPT ); Sat, 2 Dec 2023 03:36:44 -0500 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D957D6C; Sat, 2 Dec 2023 00:36:50 -0800 (PST) Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-33330305372so1261768f8f.3; Sat, 02 Dec 2023 00:36:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701506209; x=1702111009; darn=vger.kernel.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=W1Cz0Am5xXhDu9ok/VyPf97AG12MnC7CAXjo29WYQyA=; b=F8GXHgImotqHhG1331JclfAugip4b6+Hbx2zn+P9NaE6JdfDP/zZJPQGstZd917Awd dZ6NRBn8CfRMU8bkS2xg17M1yHrDY/3yzUR6zNVoNkANcxzjxD5BfFUevNR3VQVZ+pDs Ga30V6peVOhmrbWi9OzXKTOsjtOzzauNvTa7hzstLB50S09kfln0n2aRl5FfPmWaEe/x l1kQJuA2JPIGroxY8/hsUlT86wc2qHjWpQcOWtI0h1LROYGXIM7dwt4BHsFPtNKNEtfI Zp66Dw3B0HZoZMsziuI/eMtyHnvEIuTcdUnpcgIYszaTBqxW93td5XM5sD+cpdzn5vJ/ TyqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701506209; x=1702111009; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=W1Cz0Am5xXhDu9ok/VyPf97AG12MnC7CAXjo29WYQyA=; b=OXM34YHQd7Asf4tSnumT+SwFQd+z20sWQDBfcx+JxzGcKEntoGvVfIeEpdZzFpitkO np05VCALtZggVJtBD0EQfbY6BDj2Ew5Txn2dc0w3w/3tnHG+gaAvzckNuPBOO2qNBenN Unei1kQmJfvj4Dq8GvviWZvlzgiZ4YDWcbhkKnrpB0rJIM1J1YmPXEBm5tNCXHrPwaIT syOxBkxyDWYOgujazs0S+lbcYhUkuXtO1ESfcmb3/ocjwr9qwQPdxeJdIG0IJFufuJgP gCiy5lu0MjP3/qCKzDbVHDeGdx6DsIQi5ny3r2JNoDwTuCcAcMJkr4ssej5MmHpt7uIg 6IbA== X-Gm-Message-State: AOJu0YzC4zcDXqmWcBPSTIB+2E86hXTXKp2a8Yvx57pzvCD3ItuRlTrc 4gjHb1BxGNfWSJtBGL6swd42jKwJiDTh5OYg X-Received: by 2002:a05:6000:8c:b0:332:d504:c138 with SMTP id m12-20020a056000008c00b00332d504c138mr1564309wrx.1.1701506208355; Sat, 02 Dec 2023 00:36:48 -0800 (PST) Received: from ?IPv6:2001:a61:3456:4e01:6ae:b55a:bd1d:57fc? ([2001:a61:3456:4e01:6ae:b55a:bd1d:57fc]) by smtp.gmail.com with ESMTPSA id l7-20020a05600002a700b00332eb16d215sm6278953wry.23.2023.12.02.00.36.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Dec 2023 00:36:47 -0800 (PST) Message-ID: <3925cb4b6453644c889675c20329b3477a06fcd5.camel@gmail.com> Subject: Re: [PATCH 04/12] iio: adc: ad9467: fix reset gpio handling From: Nuno =?ISO-8859-1?Q?S=E1?= To: David Lechner Cc: nuno.sa@analog.com, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-iio@vger.kernel.org, Olivier MOYSAN , Greg Kroah-Hartman , "Rafael J. Wysocki" , Rob Herring , Frank Rowand , Jonathan Cameron , Lars-Peter Clausen , Michael Hennerich Date: Sat, 02 Dec 2023 09:36:47 +0100 In-Reply-To: References: <20231121-dev-iio-backend-v1-0-6a3d542eba35@analog.com> <20231121-dev-iio-backend-v1-4-6a3d542eba35@analog.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.48.4 (3.48.4-1.fc38) MIME-Version: 1.0 X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Sat, 02 Dec 2023 00:37:02 -0800 (PST) On Fri, 2023-12-01 at 11:01 -0600, David Lechner wrote: > On Fri, Dec 1, 2023 at 2:47=E2=80=AFAM Nuno S=C3=A1 wrote: > >=20 > > On Thu, 2023-11-30 at 15:41 -0600, David Lechner wrote: > > > On Tue, Nov 21, 2023 at 4:17=E2=80=AFAM Nuno Sa via B4 Relay > > > wrote: > > > >=20 > > > > From: Nuno Sa > > > >=20 > > > > The reset gpio was being requested with GPIOD_OUT_LOW which means, = not > > > > asserted. Then it was being asserted but never de-asserted which me= ans > > > > the devices was left in reset. Fix it by de-asserting the gpio. > > >=20 > > > It could be helpful to update the devicetree bindings to state the > > > expected active-high or active-low setting for this gpio so it is > > > clear which state means asserted. > > >=20 > >=20 > > You could state that the chip is active low but I don't see that change= that > > important for now. Not sure if this is clear and maybe that's why your = comment. > > GPIOD_OUT_HIGH has nothing to do with active high or low. It just means= , "get me > > the > > pin in the asserted state". > >=20 >=20 > I would assume that this bug happened in the first place because > someone forgot GPIOD_OUT_LOW in the devicetree when they were > developing the driver. So this is why I suggested that updating the > devicetree binding docs so that future users are less likely to make > the same mistake. Currently, the bindings don't even have reset-gpios > in the examples. Hmm, I think you're missing the point... The bug has nothing to do with dev= icetree. This is what was happening: 1) We were calling devm_gpiod_get_optional() with GPIOD_OUT_LOW. What this = means is that you get an output gpio deasserted. Hence the device is out of reset. A= nd here is the important part... what you have in dts does not matter. If you have act= ive low, it means the pin level will be 1. If you have high, the pin level is 0. And= this is all handled by gpiolib for you. 2) Then, we called gpiod_direction_output(..., 1), which means set the dire= ction out (which is actually not needed since it was already done when getting the pi= n) and assert the pin. Hence, reset the device. And we were never de-asserting the= pin so the device would be left in reset. - Nuno S=C3=A1