aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/gpio.txt
diff options
context:
space:
mode:
authorShiraz Hashim <shiraz.hashim@st.com>2012-10-27 05:51:36 -0400
committerLinus Walleij <linus.walleij@linaro.org>2012-11-11 13:06:00 -0500
commitf23f1516b6757c326cc638bed8c402c77e2a596e (patch)
treed1d17f111e57038c7ef6df43e79bb969c5844cd2 /Documentation/gpio.txt
parent7e10ee68f8ccc62e0934ff02f39ce541f3879844 (diff)
gpiolib: provide provision to register pin ranges
pinctrl subsystem needs gpio chip base to prepare set of gpio pin ranges, which a given pinctrl driver can handle. This is important to handle pinctrl gpio request calls in order to program a given pin properly for gpio operation. As gpio base is allocated dynamically during gpiochip registration, presently there exists no clean way to pass this information to the pinctrl subsystem. After few discussions from [1], it was concluded that may be gpio controller reporting the pin range it supports, is a better way than pinctrl subsystem directly registering it. [1] http://comments.gmane.org/gmane.linux.ports.arm.kernel/184816 Cc: Grant Likely <grant.likely@secretlab.ca> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Shiraz Hashim <shiraz.hashim@st.com> [Edited documentation a bit] Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'Documentation/gpio.txt')
-rw-r--r--Documentation/gpio.txt42
1 files changed, 42 insertions, 0 deletions
diff --git a/Documentation/gpio.txt b/Documentation/gpio.txt
index e08a883de36e..77a1d11af723 100644
--- a/Documentation/gpio.txt
+++ b/Documentation/gpio.txt
@@ -439,6 +439,48 @@ slower clock delays the rising edge of SCK, and the I2C master adjusts its
439signaling rate accordingly. 439signaling rate accordingly.
440 440
441 441
442GPIO controllers and the pinctrl subsystem
443------------------------------------------
444
445A GPIO controller on a SOC might be tightly coupled with the pinctrl
446subsystem, in the sense that the pins can be used by other functions
447together with an optional gpio feature. We have already covered the
448case where e.g. a GPIO controller need to reserve a pin or set the
449direction of a pin by calling any of:
450
451pinctrl_request_gpio()
452pinctrl_free_gpio()
453pinctrl_gpio_direction_input()
454pinctrl_gpio_direction_output()
455
456But how does the pin control subsystem cross-correlate the GPIO
457numbers (which are a global business) to a certain pin on a certain
458pin controller?
459
460This is done by registering "ranges" of pins, which are essentially
461cross-reference tables. These are described in
462Documentation/pinctrl.txt
463
464While the pin allocation is totally managed by the pinctrl subsystem,
465gpio (under gpiolib) is still maintained by gpio drivers. It may happen
466that different pin ranges in a SoC is managed by different gpio drivers.
467
468This makes it logical to let gpio drivers announce their pin ranges to
469the pin ctrl subsystem before it will call 'pinctrl_request_gpio' in order
470to request the corresponding pin to be prepared by the pinctrl subsystem
471before any gpio usage.
472
473For this, the gpio controller can register its pin range with pinctrl
474subsystem. There are two ways of doing it currently: with or without DT.
475
476For with DT support refer to Documentation/devicetree/bindings/gpio/gpio.txt.
477
478For non-DT support, user can call gpiochip_add_pin_range() with appropriate
479parameters to register a range of gpio pins with a pinctrl driver. For this
480exact name string of pinctrl device has to be passed as one of the
481argument to this routine.
482
483
442What do these conventions omit? 484What do these conventions omit?
443=============================== 485===============================
444One of the biggest things these conventions omit is pin multiplexing, since 486One of the biggest things these conventions omit is pin multiplexing, since