From patchwork Sun Jun 16 10:18:29 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 17932 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-we0-f200.google.com (mail-we0-f200.google.com [74.125.82.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A1FED2391D for ; Sun, 16 Jun 2013 10:19:23 +0000 (UTC) Received: by mail-we0-f200.google.com with SMTP id p57sf1963870wes.3 for ; Sun, 16 Jun 2013 03:19:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-beenthere:x-forwarded-to:x-forwarded-for:delivered-to:from:to:cc :subject:date:message-id:x-mailer:mime-version:x-gm-message-state :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:x-google-group-id:list-post:list-help :list-archive:list-unsubscribe:content-type; bh=2yCJzEzx5Z95fDpumhhjGVlnKjpoDLZUVw1xsf7sF7s=; b=T95RmN4CIHgbsFns56F7QX3wDYRq4O4a/gqnDWo53jFIs5iwP79dqXKNOWlw8l8oy7 4XWx+/CccxV4/LaIKrUppJD5rr+5UvN3th6i1jS1d2u08ye9PH1D2UhdMiZcnQnxjtCm aI93JkAEVZfVW9JALfTyRX5daRn989csEIwcjJ6yiO7NOQvap8lmypfbH1oPzDgcuwpu XTzfYrPLTmkieZo7n0QdWND9B1v6Pi1uKKOIFhEymUDOmf8leRj6L8CnN/YXKjuvOiDd cRr1KQM8RLMdz52NCOCkvP5q7E1jxcgXFfR8+zv3uW97yPhuvxQ/A8W/NULHVzugQBds BaQQ== X-Received: by 10.180.76.115 with SMTP id j19mr1068053wiw.2.1371377962391; Sun, 16 Jun 2013 03:19:22 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.180.72.211 with SMTP id f19ls193319wiv.6.canary; Sun, 16 Jun 2013 03:19:22 -0700 (PDT) X-Received: by 10.194.19.3 with SMTP id a3mr5546627wje.54.1371377962050; Sun, 16 Jun 2013 03:19:22 -0700 (PDT) Received: from mail-ve0-x22e.google.com (mail-ve0-x22e.google.com [2607:f8b0:400c:c01::22e]) by mx.google.com with ESMTPS id e1si3804049wic.37.2013.06.16.03.19.21 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 16 Jun 2013 03:19:21 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c01::22e is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c01::22e; Received: by mail-ve0-f174.google.com with SMTP id oz10so1428813veb.5 for ; Sun, 16 Jun 2013 03:19:20 -0700 (PDT) X-Received: by 10.220.125.2 with SMTP id w2mr2134410vcr.85.1371377960471; Sun, 16 Jun 2013 03:19:20 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.58.165.8 with SMTP id yu8csp918veb; Sun, 16 Jun 2013 03:19:19 -0700 (PDT) X-Received: by 10.14.106.195 with SMTP id m43mr11617654eeg.60.1371377959108; Sun, 16 Jun 2013 03:19:19 -0700 (PDT) Received: from eu1sys200aog108.obsmtp.com (eu1sys200aog108.obsmtp.com [207.126.144.125]) by mx.google.com with SMTP id g6si456889eem.227.2013.06.16.03.18.49 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Sun, 16 Jun 2013 03:19:18 -0700 (PDT) Received-SPF: neutral (google.com: 207.126.144.125 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) client-ip=207.126.144.125; Received: from beta.dmz-us.st.com ([167.4.1.35]) (using TLSv1) by eu1sys200aob108.postini.com ([207.126.147.11]) with SMTP ID DSNKUb2RCH8jnvrpHZNrayaTCK8tdMiVyR9M@postini.com; Sun, 16 Jun 2013 10:19:18 UTC Received: from zeta.dmz-us.st.com (ns4.st.com [167.4.16.71]) by beta.dmz-us.st.com (STMicroelectronics) with ESMTP id 6A1EC4A; Sun, 16 Jun 2013 10:17:37 +0000 (GMT) Received: from relay2.stm.gmessaging.net (unknown [10.230.100.18]) by zeta.dmz-us.st.com (STMicroelectronics) with ESMTP id 6A8AA3F; Sun, 16 Jun 2013 10:18:37 +0000 (GMT) Received: from exdcvycastm004.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm004", Issuer "exdcvycastm004" (not verified)) by relay2.stm.gmessaging.net (Postfix) with ESMTPS id 83137A8072; Sun, 16 Jun 2013 12:18:32 +0200 (CEST) Received: from steludxu4075.lud.stericsson.com (10.230.100.153) by smtp.stericsson.com (10.230.100.2) with Microsoft SMTP Server (TLS) id 8.3.279.5; Sun, 16 Jun 2013 12:18:36 +0200 From: Linus Walleij To: , Cc: Stephen Warren , Anmar Oueja , Linus Walleij , Christian Ruppert Subject: [PATCH] pinctrl: update GPIO range doc Date: Sun, 16 Jun 2013 12:18:29 +0200 Message-ID: <1371377909-5921-1-git-send-email-linus.walleij@stericsson.com> X-Mailer: git-send-email 1.7.11.3 MIME-Version: 1.0 X-Gm-Message-State: ALoCoQnbwLT8rxEqy/bJY4UjVO8byQqNFa6J4/CdzPqs8Cd9A+i9qCJA4SoDtyTIyzJnBUiO4UTs X-Original-Sender: linus.walleij@stericsson.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c01::22e is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Linus Walleij This updates the GPIO range documentation with the API changes for sparse/random/arbitrary pin-to-GPIO mappings. Cc: Christian Ruppert Signed-off-by: Linus Walleij --- Documentation/pinctrl.txt | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/Documentation/pinctrl.txt b/Documentation/pinctrl.txt index f6e664b..4548743 100644 --- a/Documentation/pinctrl.txt +++ b/Documentation/pinctrl.txt @@ -350,6 +350,23 @@ chip b: - GPIO range : [48 .. 55] - pin range : [64 .. 71] +The above examples assume the mapping between the GPIOs and pins is +linear. If the mapping is sparse or haphazard, an array of arbitrary pin +numbers can be encoded in the range like this: + +static const unsigned range_pins[] = { 14, 1, 22, 17, 10, 8, 6, 2 }; + +static struct pinctrl_gpio_range gpio_range = { + .name = "chip", + .id = 0, + .base = 32, + .pins = &range_pins, + .npins = ARRAY_SIZE(range_pins), + .gc = &chip; +}; + +In this case the pin_base property will be ignored. + When GPIO-specific functions in the pin control subsystem are called, these ranges will be used to look up the appropriate pin controller by inspecting and matching the pin to the pin ranges across all controllers. When a @@ -357,9 +374,9 @@ pin controller handling the matching range is found, GPIO-specific functions will be called on that specific pin controller. For all functionalities dealing with pin biasing, pin muxing etc, the pin -controller subsystem will subtract the range's .base offset from the passed -in gpio number, and add the ranges's .pin_base offset to retrive a pin number. -After that, the subsystem passes it on to the pin control driver, so the driver +controller subsystem will look up the corresponding pin number from the passed +in gpio number, and use the ranges internals to retrive a pin number. After +that, the subsystem passes it on to the pin control driver, so the driver will get an pin number into its handled number range. Further it is also passed the range ID value, so that the pin controller knows which range it should deal with. @@ -368,6 +385,7 @@ Calling pinctrl_add_gpio_range from pinctrl driver is DEPRECATED. Please see section 2.1 of Documentation/devicetree/bindings/gpio/gpio.txt on how to bind pinctrl and gpio drivers. + PINMUX interfaces =================