Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp567161imj; Thu, 7 Feb 2019 08:30:56 -0800 (PST) X-Google-Smtp-Source: AHgI3IYq+soxmbmgX9VcWIzqbE1D384bjpkh6/YnQGWt6uZIuKkr4z886HboDmAr4+PKudCYTynl X-Received: by 2002:a62:6303:: with SMTP id x3mr17438153pfb.110.1549557056008; Thu, 07 Feb 2019 08:30:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549557056; cv=none; d=google.com; s=arc-20160816; b=InvdR4Fsyg5+hUuSq27pKq7dbyZPLsGmfjJh+mcsCOgZZqXt3Lxr0FcvBHbQt+5l0A laA4bZ0DySYcylgW/cImRL2qCiSiOA3ZVmLO1s7K01N/SY9bG989jMTNfoxo2DVLZfrO MAXWIaMmIhhEU7OekDvOLixXFXO/u2hbaivchdBjNkgGTbeW1NyjMY1ZgzS/VHEBcD/M pDd7qEwhpaz7xXiQnilv7jXP5v/saaYsBU5NqN+NHfKL3MFjCTUS9QT2vjPF3vMx/g/y pP8CLufdGIEGLnjdq3/6W5HGbBjh8+8UCZrr+mX0K3UGkQaf/cRXkwVDrfFSrtZ/xc7G FXNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=j2TyCKacnKunl9cQXs2Dpwr31yqUThy7lnJoLl3gPm8=; b=ZL6I6ON+3DZBlplY7h7Fs7JV+PblsFWoqMU/36JoqhT+a13vUPdA/F5S42jsqH3UEW adw5v08jJxFcHo+8nAXYTANIAJy/9b6AEP/6D+8t7LpgFbNd+6xj01P0TszBLqJomVNl 9bYcgUMqzfH2j7SokzAXxT27kEgNySbQLD8Wh6E/WtAhaiU3WH356znpKmIFQnKB5aOP RwaZhHtjMbi6OcxtRNrEgjeSOnMsuYTraJMQMJ791CUBcHXqWqUUK0nkc/h63p/2gKyf ms1k/+WKJZUDFiZT7KgDGACy3ZJW8vkKLGMJ3jjUiA7lQnRDaEwbxafmpABufvhKGEU/ pJTA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f17si8798715pgj.208.2019.02.07.08.30.40; Thu, 07 Feb 2019 08:30:55 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726930AbfBGQ3O (ORCPT + 99 others); Thu, 7 Feb 2019 11:29:14 -0500 Received: from relay8-d.mail.gandi.net ([217.70.183.201]:40233 "EHLO relay8-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726832AbfBGQ3M (ORCPT ); Thu, 7 Feb 2019 11:29:12 -0500 X-Originating-IP: 90.88.22.177 Received: from localhost (aaubervilliers-681-1-80-177.w90-88.abo.wanadoo.fr [90.88.22.177]) (Authenticated sender: thomas.petazzoni@bootlin.com) by relay8-d.mail.gandi.net (Postfix) with ESMTPSA id B4ED81BF217; Thu, 7 Feb 2019 16:29:08 +0000 (UTC) From: Thomas Petazzoni To: Linus Walleij , Bartosz Golaszewski , Rob Herring , Mark Rutland , Frank Rowand Cc: linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, =?UTF-8?q?Jan=20Kundr=C3=A1t?= , Thomas Petazzoni Subject: [PATCH v2 1/5] dt-bindings: gpio: document the new pull-up/pull-down flags Date: Thu, 7 Feb 2019 17:28:55 +0100 Message-Id: <20190207162859.26252-2-thomas.petazzoni@bootlin.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190207162859.26252-1-thomas.petazzoni@bootlin.com> References: <20190207162859.26252-1-thomas.petazzoni@bootlin.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This commit extends the flags that can be used in GPIO specifiers to indicate if a pull-up resistor or pull-down resistor should be enabled. While some pinctrl DT bindings already offer the capability of configuring pull-up/pull-down resistors at the pin level, a number of simple GPIO controllers don't have any pinmuxing capability, and therefore do not rely on the pinctrl DT bindings. Such simple GPIO controllers however sometimes allow to configure pull-up and pull-down resistors on a per-pin basis, and whether such resistors should be enabled or not is a highly board-specific HW characteristic. By using two additional bits of the GPIO flag specifier, we can easily allow the Device Tree to describe which GPIOs should have their pull-up or pull-down resistors enabled. Even though the two options are mutually exclusive, we still need two bits to encode at least three states: no pull-up/pull-down, pull-up, pull-down. Signed-off-by: Thomas Petazzoni --- Documentation/devicetree/bindings/gpio/gpio.txt | 12 ++++++++++++ include/dt-bindings/gpio/gpio.h | 6 ++++++ 2 files changed, 18 insertions(+) diff --git a/Documentation/devicetree/bindings/gpio/gpio.txt b/Documentation/devicetree/bindings/gpio/gpio.txt index f0ba154b5723..a8895d339bfe 100644 --- a/Documentation/devicetree/bindings/gpio/gpio.txt +++ b/Documentation/devicetree/bindings/gpio/gpio.txt @@ -67,6 +67,18 @@ Optional standard bitfield specifiers for the last cell: https://en.wikipedia.org/wiki/Open_collector - Bit 3: 0 means the output should be maintained during sleep/low-power mode 1 means the output state can be lost during sleep/low-power mode +- Bit 4: 0 means no pull-up resistor should be enabled + 1 means a pull-up resistor should be enabled + This setting only applies to hardware with a simple on/off + control for pull-up configuration. If the hardware has more + elaborate pull-up configuration, it should be represented + using a pin control binding. +- Bit 5: 0 means no pull-down resistor should be enabled + 1 means a pull-down resistor should be enabled + This setting only applies to hardware with a simple on/off + control for pull-down configuration. If the hardware has more + elaborate pull-down configuration, it should be represented + using a pin control binding. 1.1) GPIO specifier best practices ---------------------------------- diff --git a/include/dt-bindings/gpio/gpio.h b/include/dt-bindings/gpio/gpio.h index 2cc10ae4bbb7..c029467e828b 100644 --- a/include/dt-bindings/gpio/gpio.h +++ b/include/dt-bindings/gpio/gpio.h @@ -33,4 +33,10 @@ #define GPIO_PERSISTENT 0 #define GPIO_TRANSITORY 8 +/* Bit 4 express pull up */ +#define GPIO_PULL_UP 16 + +/* Bit 5 express pull down */ +#define GPIO_PULL_DOWN 32 + #endif -- 2.20.1