Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C092CC433EF for ; Wed, 6 Apr 2022 12:27:45 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 794A583C08; Wed, 6 Apr 2022 14:27:43 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=konsulko.com header.i=@konsulko.com header.b="SiLEQAnN"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8376183C8E; Wed, 6 Apr 2022 14:27:41 +0200 (CEST) Received: from mail-qt1-x82c.google.com (mail-qt1-x82c.google.com [IPv6:2607:f8b0:4864:20::82c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 0FFA3806B7 for ; Wed, 6 Apr 2022 14:27:35 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=trini@konsulko.com Received: by mail-qt1-x82c.google.com with SMTP id o15so3908633qtv.8 for ; Wed, 06 Apr 2022 05:27:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=mXOj28UCuxmM0n2hnRIxVTNMxh2gaFUd+jR0lHBp0Oc=; b=SiLEQAnNbxdXFws2WTrUXGfyDHetYwoxLOrwgd/duLqWAn1K8LcCzweRPh2zQ8Qy16 F7FnwSNppbTmzOSmPPxdSC3yPFUZFTdgJeN/2VVmgyzHe8axRuMG/7ektjlHEqVAXFyV h8xZF/IWQjsAPfKH9SWBzLah+cL5iu3NdamaA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=mXOj28UCuxmM0n2hnRIxVTNMxh2gaFUd+jR0lHBp0Oc=; b=4iz7c6mamdR1Daexns0R5PwTSBp6vSfz0jkv7PYPzcOk+1H14FVhVNj4G7Wdxbi7es l54JCETDVqmFDh1iCc0GdSboJL/SAbk5CbcZ9enAxiNYis6PFJk/eTz6I8Y8AVYM3u7o 4MrX+hQTw/xqUn/sRR27Y2c5lS33Y2HLpxEVBJIL+Ph6ZTPS2PehNfswZM/leAXA5uA7 BdBI1VOzkVt8IG6/1heqo+AB4xOmGodOJOcNmdl8k2oYE4E29RGDNB53m9TG56Fa9qtU pUP5sUuaInLM4Ss81QHxkj6rPB7oCX47CjuB9uisQh6KZQNq8yfKeig4CerMytqKA1DG gWKA== X-Gm-Message-State: AOAM533OHD85c4i2WZmYzb/beaw97sBQRoBw4IJbeB3I1lqWkCtZAi3R 9UUevYljirB5hnS03UMILUmGVA== X-Google-Smtp-Source: ABdhPJxsdOCWLk+y4bAZZUSplJIUsLmNE39+vfAfc5MK/QJ4w3aGGvBgxzwCGmFMN8tCQDzzEMwDvg== X-Received: by 2002:a05:620a:258e:b0:680:f33c:dbcd with SMTP id x14-20020a05620a258e00b00680f33cdbcdmr5561341qko.542.1649248053870; Wed, 06 Apr 2022 05:27:33 -0700 (PDT) Received: from bill-the-cat (2603-6081-7b01-cbda-2ef0-5dff-fedb-a8ba.res6.spectrum.com. [2603:6081:7b01:cbda:2ef0:5dff:fedb:a8ba]) by smtp.gmail.com with ESMTPSA id z15-20020a05622a060f00b002e2070bf899sm13023688qta.90.2022.04.06.05.27.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 05:27:32 -0700 (PDT) Date: Wed, 6 Apr 2022 08:27:31 -0400 From: Tom Rini To: Tim Harvey Cc: u-boot@lists.denx.de, Sean Anderson Subject: Re: [PATCH] driver: gpio: fix gpio glitch for output-high gpio-hog Message-ID: <20220406122731.GY9042@bill-the-cat> References: <20220303020108.11453-1-tharvey@gateworks.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="c6YcJYqqMhegfX14" Content-Disposition: inline In-Reply-To: <20220303020108.11453-1-tharvey@gateworks.com> X-Clacks-Overhead: GNU Terry Pratchett X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean --c6YcJYqqMhegfX14 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Mar 02, 2022 at 06:01:08PM -0800, Tim Harvey wrote: > A gpio-hog can be specified as output-low, output-high, or input where > output-low means 'de-asserted' and 'output-high' means asserted vs > voltage levels. >=20 > When a hog is probed gpio_request_tail() calls dm_gpio_set_dir_flags() > which ends up setting the GPIO as an output with a driven 'de-asserted' > value prior to setting the desired value the hog was configured for. > While I'm not sure it makes sense to set the output level while simply > 'requesting' a GPIO the result of this is that if the hog is configured > for output-high the request call sets it first as output low before > gpio_hog_probe() sets it to the configured value causing the gpio to > 'glitch' which may be undesired for certain applications. >=20 > Fix this by setting the GPIOD_IS_OUT_ACTIVE flag for hogs configured as > output-high. >=20 > This was tested with the following hogs: >=20 > /* active-high output-low (de-asserted) GPIO should drive 0 */ > gpio1 { > gpio-hog; > output-low; > gpios =3D <1 GPIO_ACTIVE_HIGH>; > line-name =3D "gpio1"; > }; >=20 > /* active-high output-high (asserted) GPIO should drive 1 */ > /* before patch this would first drive 0 then 1 */ > gpio2 { > gpio-hog; > output-high; > gpios =3D <2 GPIO_ACTIVE_HIGH>; > line-name =3D "gpio2"; > }; >=20 > /* active-low output-low (de-asserted) GPIO should drive 1 */ > gpio3 { > gpio-hog; > output-low; > gpios =3D <3 GPIO_ACTIVE_LOW>; > line-name =3D "gpio3#"; > }; >=20 > /* active-low output-high (asserted) GPIO should drive 0 */ > /* before patch this would first drive 0 then 1 */ > gpio4 { > gpio-hog; > output-high; > gpios =3D <4 GPIO_ACTIVE_LOW>; > line-name =3D "gpio4#"; > }; >=20 > Cc: Sean Anderson > Signed-off-by: Tim Harvey This breaks the ut_dm_dm_test_gpio test which I guess needs to be updated. --=20 Tom --c6YcJYqqMhegfX14 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmJNhy8ACgkQFHw5/5Y0 tyyNDAwAhhQ34xQABMmRbfZSqyrjzF9FrHOentNj6NR3BMlHEsTASyINdnMCUSUC kBj5bqiyjOj/nAb2fbJmJZnJziNkNHZ21NjcTKukkToEKgW2ODQwxEQJYGBihyJb ueN0RLxlUFbnILXRkzP9DJdW/VPFIN70Q9eqjVbDNPFMa27R8dStJPMX+KVjc4lM cp6xS8Ny014dusH6FH4DJ73GRXctQf8CXNqUr9K3Z83t38gPlurXt++8oPC21Ra/ 4n0lnCh/zh5VQF9Cq3YQUf4ULeBrRfTFt7kXYCAh15OajdPAKOPz0CPMK9KWwK4o pvpBi24F62Hqfa7+amYb6D2xZ2fEc9Ups62pWViTSjGoRpG7WdOm2eb2F3KP4XDW tBZN6/pXkU5/460HxmQlz/Vc6MBdhJwdGnY5OCb9uyfSF9c+tSnMWJHeLhogk4Po 3c7pxee11YiP8FWj937cJj3+D4//23adrmrSLZopwt6lFsVg+lzwTnQ7gr/N4D+0 rnO0dUTk =MuRv -----END PGP SIGNATURE----- --c6YcJYqqMhegfX14--