From patchwork Thu Sep 24 22:09:15 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 54132 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f198.google.com (mail-wi0-f198.google.com [209.85.212.198]) by patches.linaro.org (Postfix) with ESMTPS id 3056F22B1E for ; Thu, 24 Sep 2015 22:09:38 +0000 (UTC) Received: by wicmn1 with SMTP id mn1sf1016254wic.1 for ; Thu, 24 Sep 2015 15:09:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=t34Efms93Ttu3EJPtzrMdHFR296YjvmNxhpSNW9vZMU=; b=fhKFMXkCMm58ilD40ijJ1SL/MKe+qHScICnFBtvgz5SdZUs8MI5DwaMPlJzAib/01F ccP3eRA1z9Rv1/vum4DvJ+WnMmm47BdinUaFohpK6nL3vV1Mij/6Vg2vBUz4eFS8DwjC umwHDNT79fuGbfWuYl7N/sl6YQTpMjINKn5hhzAr9cKs09ZKoccraVYYK6cDweR1TzNI RxYU1l+nQqVlR/Jr6rLEcvNdx2arOM0a6xwIwczKdB8/Ls4PZNt01zu9AOFV8FKssNT0 5RvsXi7KrUrzrpKPhQayi2JaG5b0ohwaiYXTiqDloFTimWubYSh/ME7Q2PdRZAUDzBy+ yOeA== X-Gm-Message-State: ALoCoQltiY/Tz+/HsN/TUkXmHIeJ+A/BmLfzzpv6BTXa5QjlVckbAGrDJHRLIiyr8XfzSHTqw/tJ X-Received: by 10.112.138.170 with SMTP id qr10mr327542lbb.4.1443132577381; Thu, 24 Sep 2015 15:09:37 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.170.72 with SMTP id t69ls181125lfe.56.gmail; Thu, 24 Sep 2015 15:09:37 -0700 (PDT) X-Received: by 10.152.21.9 with SMTP id r9mr579828lae.1.1443132577250; Thu, 24 Sep 2015 15:09:37 -0700 (PDT) Received: from mail-la0-f48.google.com (mail-la0-f48.google.com. [209.85.215.48]) by mx.google.com with ESMTPS id a6si212455lbs.43.2015.09.24.15.09.37 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 Sep 2015 15:09:37 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.48 as permitted sender) client-ip=209.85.215.48; Received: by lacdq2 with SMTP id dq2so24130056lac.1 for ; Thu, 24 Sep 2015 15:09:37 -0700 (PDT) X-Received: by 10.112.180.230 with SMTP id dr6mr581460lbc.72.1443132577090; Thu, 24 Sep 2015 15:09:37 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp577304lbq; Thu, 24 Sep 2015 15:09:36 -0700 (PDT) X-Received: by 10.107.170.32 with SMTP id t32mr3212300ioe.173.1443132576078; Thu, 24 Sep 2015 15:09:36 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id il7si206499igb.3.2015.09.24.15.09.35; Thu, 24 Sep 2015 15:09:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753468AbbIXWJf (ORCPT + 3 others); Thu, 24 Sep 2015 18:09:35 -0400 Received: from mail-pa0-f46.google.com ([209.85.220.46]:33090 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753301AbbIXWJe (ORCPT ); Thu, 24 Sep 2015 18:09:34 -0400 Received: by pacex6 with SMTP id ex6so84558245pac.0 for ; Thu, 24 Sep 2015 15:09:34 -0700 (PDT) X-Received: by 10.67.30.74 with SMTP id kc10mr2390588pad.147.1443132573952; Thu, 24 Sep 2015 15:09:33 -0700 (PDT) Received: from localhost.localdomain.localdomain ([70.35.39.2]) by smtp.gmail.com with ESMTPSA id fu4sm270001pbb.59.2015.09.24.15.09.31 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 Sep 2015 15:09:33 -0700 (PDT) From: Linus Walleij To: linux-gpio@vger.kernel.org Cc: Alexandre Courbot , Linus Walleij , Tony Lindgren , Grygorii Strashko , "H. Nikolaus Schaller" Subject: [PATCH] gpio: add DT bindings for existing consumer flags Date: Thu, 24 Sep 2015 15:09:15 -0700 Message-Id: <1443132555-8244-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 2.4.3 Sender: linux-gpio-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-gpio@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: linus.walleij@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.48 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , It is customary for GPIO controllers to support open drain/collector and open source/emitter configurations. Add standard GPIO line flags to account for this and augment the documentation to say that these are the most generic bindings. Several people approached me to add new flags to the lines, and this makes sense, but let's first bind up the most common cases before we start to add exotic stuff. Cc: Tony Lindgren Cc: Grygorii Strashko Cc: H. Nikolaus Schaller Signed-off-by: Linus Walleij --- Documentation/devicetree/bindings/gpio/gpio.txt | 15 +++++++++++++-- include/dt-bindings/gpio/gpio.h | 2 ++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/gpio/gpio.txt b/Documentation/devicetree/bindings/gpio/gpio.txt index 5788d5cf1252..7b1c8bc24e2d 100644 --- a/Documentation/devicetree/bindings/gpio/gpio.txt +++ b/Documentation/devicetree/bindings/gpio/gpio.txt @@ -52,9 +52,13 @@ only uses one. gpio-specifier may encode: bank, pin position inside the bank, whether pin is open-drain and whether pin is logically inverted. + Exact meaning of each specifier cell is controller specific, and must -be documented in the device tree binding for the device. Use the macros -defined in include/dt-bindings/gpio/gpio.h whenever possible: +be documented in the device tree binding for the device. + +Most controllers are however specifying a generic flag bitfield +in the last cell, so for these, use the macros defined in +include/dt-bindings/gpio/gpio.h whenever possible: Example of a node using GPIOs: @@ -65,6 +69,13 @@ Example of a node using GPIOs: GPIO_ACTIVE_HIGH is 0, so in this example gpio-specifier is "18 0" and encodes GPIO pin number, and GPIO flags as accepted by the "qe_pio_e" gpio-controller. +Optional standard bitfield specifiers for the last cell: + +- Bit 0: 0 means active high, 1 means active low +- Bit 1: 1 means open drain/open collector, see: + https://en.wikipedia.org/wiki/Open_collector +- Bit 2: 1 means open source/open emitter + 1.1) GPIO specifier best practices ---------------------------------- diff --git a/include/dt-bindings/gpio/gpio.h b/include/dt-bindings/gpio/gpio.h index e6b1e0a808ae..f5ed02e81bf7 100644 --- a/include/dt-bindings/gpio/gpio.h +++ b/include/dt-bindings/gpio/gpio.h @@ -11,5 +11,7 @@ #define GPIO_ACTIVE_HIGH 0 #define GPIO_ACTIVE_LOW 1 +#define GPIO_OPEN_DRAIN 2 +#define GPIO_OPEN_SOURCE 4 #endif