Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp6886728rwr; Tue, 2 May 2023 06:55:23 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6iq7BsDspJWE2ZaXflxHVF7xj31ySloWhxfd12UgvEXP2V0QU8GEvMMlBUvXaaVIu3ZIgT X-Received: by 2002:a05:6a00:a26:b0:641:3c61:db27 with SMTP id p38-20020a056a000a2600b006413c61db27mr18670907pfh.13.1683035723333; Tue, 02 May 2023 06:55:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683035723; cv=none; d=google.com; s=arc-20160816; b=FcE041qnLLsIizVlLHr3bPqU9dstm5ueTcklFNPrngX4c9e2x8SVgJEWsrMfgphD7/ mUqyjY+RLSWIQcRsxt+Tqi+uU/pBrZ/ZwjBQeTiDi3g1psV9MS+BVq9bfxIxm7Oqy4v0 eOvPkIfoIhKr2tahbT/LOfn+lwM5UjUYZ8aLQ0R9M3jz9iaaCGGLrBS8nXBXDiTkW8R+ 2G7MglQJqssRCsi6TCr8n4bQYxeNNcFfn0SlpJVRC6/8M2ANf9etukEpHRtBvBLyx0tt zAahrAlEv3qaV4UAQlamjgkPNbMuO/l5fnKym3MijzcCPXCXDM4kWVL+cSH0eplzmaju jyvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=p9wwGGRVvswmyZXFhHdJSjPWUvlpeqwsM3jM4gRG6q0=; b=w+qVBgG6+kZgOtfUtWlqTlUz3LW3nnsBPlARyNrZT3iLxeHeEoucGzWKRjsX9uG1AD pXWVMI72zYi/s3BCBLI501VQQZ5WHU9AOhnfjyIYtEMdCFIIrvetNjQm2/XHsOfTH1qs N5uvMnd5oEtwvS6kU1FinZZHFZW8iPJUD4AxnVp3/BzOJD5/xPSFz2EYTGC7efByvBHU jEL3Ami3j0IuzBhejRFyDi6YQFKTzYCNZlsBkIIE96JZZOr8qIml7M1eoMRH31E2yNFl 5Y6XL2nRfjqAIJGUT2pOS0+e3psODCc9ub/WWpY7DAjecltNZclmmFbG53/qzyr+BahZ VbjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nLSh2OvQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q17-20020aa79611000000b005ee01126a92si30961102pfg.120.2023.05.02.06.55.09; Tue, 02 May 2023 06:55:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nLSh2OvQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234393AbjEBNu2 (ORCPT + 99 others); Tue, 2 May 2023 09:50:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234259AbjEBNu1 (ORCPT ); Tue, 2 May 2023 09:50:27 -0400 Received: from mail-yw1-x112b.google.com (mail-yw1-x112b.google.com [IPv6:2607:f8b0:4864:20::112b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5556A44BF for ; Tue, 2 May 2023 06:50:24 -0700 (PDT) Received: by mail-yw1-x112b.google.com with SMTP id 00721157ae682-559f1819c5dso43752917b3.0 for ; Tue, 02 May 2023 06:50:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1683035423; x=1685627423; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=p9wwGGRVvswmyZXFhHdJSjPWUvlpeqwsM3jM4gRG6q0=; b=nLSh2OvQ+WpDV+Oy7A4TaeN5emRPUDiiiB36+3eZjeXWZcZDjenrY1zHyj5lHodSFO YX/Qy3uemWfjKUT/4ePXdePnmz8poLIgYfua/4KO0bf9tYIQo34K4KObr++i3qM9QX8Y ox8mnJs4xE0wakTIsOnkdEDZ0JkEVqRNNNUxwEobtxw6iM6pTvSkZK+DtPttheccSDZJ Noe05zyH3wgIf0DviMbOAtspSpjXjb1qcALP/8m34KSQrwXHbsboGTdoHw4BfMn4bNMm up3yPnZdijj1jwKJo09mnV98WOgIU8MFRNozix9nwUKR/6Qo0VvaEbgu0QtqhB1Vg5/k JiAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683035423; x=1685627423; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=p9wwGGRVvswmyZXFhHdJSjPWUvlpeqwsM3jM4gRG6q0=; b=IhjURxUu6aKmiQjLIu3xYbUFPmMtaVQAlShFOTSGaHJNvi5t6mUGG0jP10wVaULeLn lSFdzd7M/zAaaXbBbtomqT5j8pTg+3quFZpy4YSp22zFNyL4OZB5FL5SlVFqcT62s0rb bfT+QmhCN+mZqoLbYYMkGyZNfLmZzS7FwbhfIy3UAKh4Ag2myzljCi4mk+wDKPyjucwD RXFLvG3ov7z4MbLmLAM2mPvsslzWEoaJjRn3XbvnS7c7ZYXrC3DwrqXGTJsNFQwWEUMt gTMoXYhsifwn8wBpQyoMO8rizLxSn5eeQQ6jI2odavnv1RrGK5jiwIJxR/QiMsWdHhS0 dHXA== X-Gm-Message-State: AC+VfDwhxdKeYS2cW4YIHo7gUKlOpxjRPIEjZcNCPj0GmdFTzCRsZ8vk ef9LMp7BYRD+Cq6d+rS4gawsvDACd33a84kzwuHjSA== X-Received: by 2002:a81:6d09:0:b0:55a:4828:182a with SMTP id i9-20020a816d09000000b0055a4828182amr7480482ywc.36.1683035423468; Tue, 02 May 2023 06:50:23 -0700 (PDT) MIME-Version: 1.0 References: <20230501230517.4491-3-okan.sahin@analog.com> <20230502084406.3529645-1-michael@walle.cc> In-Reply-To: <20230502084406.3529645-1-michael@walle.cc> From: Linus Walleij Date: Tue, 2 May 2023 15:50:11 +0200 Message-ID: Subject: Re: [PATCH v2 2/2] gpio: ds4520: Add ADI DS4520 GPIO Expander Support To: Michael Walle Cc: okan.sahin@analog.com, brgl@bgdev.pl, devicetree@vger.kernel.org, krzysztof.kozlowski+dt@linaro.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, robh+dt@kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 2, 2023 at 10:44=E2=80=AFAM Michael Walle wr= ote: > I'm not sure about the direction though. Technically speaking there is > no direction register. I'm not familiar with how open drain output are > modeled in linux. I'd expect the above is enough. Bartosz/Linus/Andy? Linux has no special concept of open drain/source, it just sees the .set(), .set_multiple() callbacks in gpio_chip to set the output value(s). How that happens physically is an electrical question, Linux just expects it to happen. .get_direction() is however partly a software concept here, so you might need to maintain a state in the driver for this. Linux will emulate open drain when requested by simply putting the line into input (high-impedance) mode for a high output, but only actively drive it low, which in most cases is physically the same as open drain. I imagine the direction would be unknown at probe() and only go into a definitive input/output state after .set_direction() is called so some tri-state enum? .set_config() can be called with the special parameter PIN_CONFIG_DRIVE_OPEN_DRAIN if the driver on the line can be put explicitly into open drain state. If the hardware is permanently like that, there is not much point in implementing it. Yours, Linus Walleij