Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2628759rwb; Wed, 30 Nov 2022 08:52:56 -0800 (PST) X-Google-Smtp-Source: AA0mqf5UY16M2nx11pcl5/mNQNcS1QQNsuQbDHjtvrz4g+rJ/h6ZXyeMrzGa20F7YafOnc12khcg X-Received: by 2002:aa7:c844:0:b0:461:a130:ea3c with SMTP id g4-20020aa7c844000000b00461a130ea3cmr54950947edt.272.1669827176070; Wed, 30 Nov 2022 08:52:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669827176; cv=none; d=google.com; s=arc-20160816; b=edjVkYRmYfgM8Kz3g8d3x5oOcnl181cIkw8RCvAtPup5Sx3tPHAKL7anvUgSrhGubH /rXv2j6wf8N4EJZqRYAxXSG0P6BPzVYihA2jpofKl9byOz641GK16JE/c2Ezz+CZI4gy kgLhFd5+dO/2uZj7tODBG2dhvpmGSX7Yd+3We4STERrSgSsYfG2ThN2MyPFBSH1N5J/U 3pAJs9PJKIXSwwEDgV6yOCmpkPl7w/pcd2wP9rXjMSXGPXifrg9NlirX/gPgA0QGhIJy KTtRPYbxbSa2GYHsWdJC7T8TjcuZL4B+VP6nLIDZJKVPCY930VEtRkPX/CMin8vlZgfH GfMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=LLoBfl1E0+vIeU+K/BXuhiSM6Gd48hAohEAtYeYtbVo=; b=Wjh7JTwHHlgc+FD9r068s/oYmeEkNHiUVY6zPCGEkMVGrH9ffjPWIJbkc8s2AAOTvW B7FUNJYFKBz2YB3wRDn9wjHgH/r6lbVAfpXFGPiRw4Z4G0dHOtCKPxEijlszwC4oBvXH UpihsqzC2EnVit3aBSBL7mFPAJsGskIocNFItd30AKNgJN2HePe179PddJBMEDg4oU72 wgm5VyocghaNKxD0tCOsIUhC4hAL0wk9Rq1OfG4QsZvXv1b/4wOUVZhbcXz/7m9x/RYF e4GMjvR3n+gjWf0zCxoXDeuhwpmImx/BAZjIBkDe1qUug+Gyy6f/gQWPpt1pmlLDjbsa cFig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=OyKgCM30; 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=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y1-20020a056402440100b00469c5cc855csi1594350eda.518.2022.11.30.08.52.34; Wed, 30 Nov 2022 08:52:56 -0800 (PST) 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=@intel.com header.s=Intel header.b=OyKgCM30; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229963AbiK3PzE (ORCPT + 83 others); Wed, 30 Nov 2022 10:55:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48602 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229566AbiK3PzC (ORCPT ); Wed, 30 Nov 2022 10:55:02 -0500 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E8212A72C; Wed, 30 Nov 2022 07:55:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669823702; x=1701359702; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=zyte05y+upKDfse9Z8XVDo9E7nJa4Ll5iv0RvnzSuUM=; b=OyKgCM302H4QTJYDajAlaG+QHVr0ipZL2EbhntMfrqn4riMfXgY4jCpR JBQEWgj6Pj/t0nOCUaHeU0eyHVUW6Wxnpp4Wwssrx34UrfJbXuUvkbEvn XZFhX/dkLTnpLRQ8bFEwfB3h/1fxFlcwQKMa9dkYgXO8/e5H+eGJeEguW USMx79sKpiuorxJsuOC7u2tcoR2HJjosqO2Buglf2EBnkvaEXh1EYxyXl Ip0Fk7wmq15BAC5EhP2tNFlz3bBqYsD+fAkGCBrxbPS3r0VAjNix6lxSj lA/dRJsSupbEfsXULWiuil0Sx3N3SlkHU8n2r07Xv/YvfYGSr9dfZygIU Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10547"; a="295126520" X-IronPort-AV: E=Sophos;i="5.96,206,1665471600"; d="scan'208";a="295126520" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Nov 2022 07:55:01 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10547"; a="707693497" X-IronPort-AV: E=Sophos;i="5.96,206,1665471600"; d="scan'208";a="707693497" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga008.fm.intel.com with ESMTP; 30 Nov 2022 07:54:59 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 015CC6A; Wed, 30 Nov 2022 17:55:25 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , Marc Zyngier , linux-gpio@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Linus Walleij , Bartosz Golaszewski , Jonathan Corbet , Hans de Goede Subject: [PATCH v1 2/3] Documentation: gpio: Add a section on what to return in ->get() callback Date: Wed, 30 Nov 2022 17:55:18 +0200 Message-Id: <20221130155519.20362-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221130155519.20362-1-andriy.shevchenko@linux.intel.com> References: <20221130155519.20362-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_PASS, SPF_NONE 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 The ->get() callback depending on other settings and hardware support may return different values, while the line outside the chip is kept in the same state. Let's discuss that in the documentation. Signed-off-by: Andy Shevchenko --- Documentation/driver-api/gpio/driver.rst | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Documentation/driver-api/gpio/driver.rst b/Documentation/driver-api/gpio/driver.rst index bf6319cc531b..3d2f36001a7a 100644 --- a/Documentation/driver-api/gpio/driver.rst +++ b/Documentation/driver-api/gpio/driver.rst @@ -251,6 +251,30 @@ supports more versatile control over electrical properties and can handle different pull-up or pull-down resistance values. +Considerations of the ->get() returned value +-------------------------------------------- + +Due to different possible electrical configurations and software applications +the value that ->get() callback returns may vary depending on the other settings. +This will allow to use pins in the I2C emulation mode or other not so standard +uses. + +The below table gathered the most used cases. + +========== ========== =============== ======================= + Input Output State What value to return? +========== ========== =============== ======================= + Disabled Disabled Hi-Z input buffer + Disabled OS/OD/etc Single ended [cached] output buffer + x Push-Pull Out [cached] output buffer + Enabled Disabled In input buffer + Enabled OS/OD/etc Bidirectional input buffer +========== ========== =============== ======================= + +The [cached] here is used in a broader sense: either pure software cache, or +read back value from the GPIO output buffer (not all hardware support that). + + GPIO drivers providing IRQs =========================== -- 2.35.1