From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DF95CC43334 for ; Mon, 18 Jul 2022 10:44:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233852AbiGRKos (ORCPT ); Mon, 18 Jul 2022 06:44:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52472 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230182AbiGRKor (ORCPT ); Mon, 18 Jul 2022 06:44:47 -0400 Received: from mail-yw1-x1129.google.com (mail-yw1-x1129.google.com [IPv6:2607:f8b0:4864:20::1129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55DD31115C for ; Mon, 18 Jul 2022 03:44:46 -0700 (PDT) Received: by mail-yw1-x1129.google.com with SMTP id 00721157ae682-31cf1adbf92so102334807b3.4 for ; Mon, 18 Jul 2022 03:44:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=Uc6eWbNciWgCyv7c8q11Fg2PzpQWeHdegtWuP/RJosk=; b=hunoSOBK5o/MgbRCfnof4p/yAizCb87IErb0T+TMW5bjsqJf8adSLBxOtskb/3SYq3 v5NHC2GksmyPzVsCugk7JT9c7iWbccDFF8/aL7PWplrqtLLR5NgEh6HvuIszHu2kjnoO RhPU/8A8agWydAQkW8ngj01Y54ZbQDa/XBoBfPm8FgWWSKF/JjImLGXqfpzoR/qhK63R 1PqtpT6VFiVT94nSADhTt6K/8O+9hThPGsWTAsvov3OItqG7tzWDczZbNU811Mem1xGt 5XvvpKj+PA2h/0wc3vM/rkRmzpm1uIdp7q3vgvXk/LmhF6I167bH8PsJ1cXEpkAT75Jx l35g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=Uc6eWbNciWgCyv7c8q11Fg2PzpQWeHdegtWuP/RJosk=; b=EHKvw6vy6ziP+ww/5oLO76bqp2KmG06OkQlRHU2S7L1g8Si7RIVyAUJwu/8Taoeh3b +QuPEacgAKNWUmZ8+WzPDhQPUtNdiefshKwTkDiJmLwkZTYQHReO7wtLnrrjgpQo7qCm 6h63ZO5/OQaRHg3NZUvWERQO9nPrhT+kiHB6C5wCEnco7X9LoauWFvp6NG3tOLtrO5sB XFx53iFdAUgitQg3TUhtqJ4aYN1/tWFO4MmqhA7mNoVoQ0RGyMkl+fhLEOAAVAw/5mQ7 xYJVpP3CO2IVNLJg17nHin/d/ZXBHOt+qPMRaovTqqQt8Xtkyxs1qUEEizv+LNxWbvsc G2lw== X-Gm-Message-State: AJIora/WUBT/Ff63lz+O32Z5/J7z/QaXE321iI53FNltc6zCP+XhKVZm RwY93QhlKWuGPs51AhRBpchGkrhb48uCO6Ek9ik5Bw== X-Google-Smtp-Source: AGRyM1syf04DDcAP3vOqEDAUO6jpt6YyrJga4szmgQ60QMX18LG8E4DK3LxuaI7O0RIvV7k/Ho7WmxevzlUIt1owlhY= X-Received: by 2002:a81:4809:0:b0:31d:848:4b3b with SMTP id v9-20020a814809000000b0031d08484b3bmr29876705ywa.69.1658141085548; Mon, 18 Jul 2022 03:44:45 -0700 (PDT) MIME-Version: 1.0 References: <20220713131421.1527179-1-nuno.sa@analog.com> <20220713131421.1527179-2-nuno.sa@analog.com> In-Reply-To: From: Linus Walleij Date: Mon, 18 Jul 2022 12:44:33 +0200 Message-ID: Subject: Re: [PATCH 1/4] gpiolib: add support for bias pull disable To: Andy Shevchenko Cc: =?UTF-8?B?TnVubyBTw6E=?= , linux-acpi@vger.kernel.org, devicetree@vger.kernel.org, linux-gpio@vger.kernel.org, Krzysztof Kozlowski , Bartosz Golaszewski , Frank Rowand , Mika Westerberg , Rob Herring Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org On Wed, Jul 13, 2022 at 7:37 PM Andy Shevchenko wrote: > On Wed, Jul 13, 2022 at 03:14:18PM +0200, Nuno S=C3=A1 wrote: > > This change prepares the gpio core to look at firmware flags and set > > 'FLAG_BIAS_DISABLE' if necessary. It works in similar way to > > 'GPIO_PULL_DOWN' and 'GPIO_PULL_UP'. > > ... > > > GPIO_PULL_UP =3D (1 << 4), > > GPIO_PULL_DOWN =3D (1 << 5), > > + GPIO_PULL_DISABLE =3D (1 << 6), > > To me it seems superfluous. You have already two flags: > PUp > PDown > When none is set --> Pdisable What happens in the pin control case for some drivers at least is that the machine comes up with some pull up/downs enabled (by power-on default or from the boot loader), and some systems need to explicitly disable these pulls. In these (device tree) cases they set bias-disable; in the device tree, and the driver will actively disable any pull up/down. OK this is maybe not the most elegant system engineering. But some of those users are hobbyists and cannot affect what the ASIC or firmware is doing, because vendors are not really listening. Another semantic reason is that pins can also be set to bias-high-impedance= ; which is what "some people" would assume is the default if you disable both pull up and pull down. (Yeah ... semantics...) Device tree also has bias-pull-pin-default; to make things more complicated= . This should *really* leave it at power-on default. Explicitly. I think for Nuno's usecase (using a random pin from userspace) the state of biasing cannot be assumed, the driver will not change bias to disabled just because neither pull up or down is specified, so the driver needs an explicit kick saying "disable any bias". Yours, Linus Walleij