diff options
author | Stephen Warren <swarren@nvidia.com> | 2012-03-02 15:05:47 -0500 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2012-03-05 05:22:59 -0500 |
commit | 6e5e959dde0d92d177f035652aeaa77f9330c9c6 (patch) | |
tree | c2d874df6a1c591b558a17591a1c8fbc2ba7a1e1 /arch/arm/mach-u300 | |
parent | 0e3db173e2b9fd3b82246516e72c17763eb5f98d (diff) |
pinctrl: API changes to support multiple states per device
The API model is changed from:
p = pinctrl_get(dev, "state1");
pinctrl_enable(p);
...
pinctrl_disable(p);
pinctrl_put(p);
p = pinctrl_get(dev, "state2");
pinctrl_enable(p);
...
pinctrl_disable(p);
pinctrl_put(p);
to this:
p = pinctrl_get(dev);
s1 = pinctrl_lookup_state(p, "state1");
s2 = pinctrl_lookup_state(p, "state2");
pinctrl_select_state(p, s1);
...
pinctrl_select_state(p, s2);
...
pinctrl_put(p);
This allows devices to directly transition between states without
disabling the pin controller programming and put()/get()ing the
configuration data each time. This model will also better suit pinconf
programming, which doesn't have a concept of "disable".
The special-case hogging feature of pin controllers is re-written to use
the regular APIs instead of special-case code. Hence, the pinmux-hogs
debugfs file is removed; see the top-level pinctrl-handles files for
equivalent data.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Dong Aisheng <dong.aisheng@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'arch/arm/mach-u300')
-rw-r--r-- | arch/arm/mach-u300/core.c | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/arch/arm/mach-u300/core.c b/arch/arm/mach-u300/core.c index f29565a10e2e..c092cf92e8ea 100644 --- a/arch/arm/mach-u300/core.c +++ b/arch/arm/mach-u300/core.c | |||
@@ -1618,22 +1618,18 @@ static struct pinctrl_map __initdata u300_pinmux_map[] = { | |||
1618 | }; | 1618 | }; |
1619 | 1619 | ||
1620 | struct u300_mux_hog { | 1620 | struct u300_mux_hog { |
1621 | const char *name; | ||
1622 | struct device *dev; | 1621 | struct device *dev; |
1623 | struct pinctrl *p; | 1622 | struct pinctrl *p; |
1624 | }; | 1623 | }; |
1625 | 1624 | ||
1626 | static struct u300_mux_hog u300_mux_hogs[] = { | 1625 | static struct u300_mux_hog u300_mux_hogs[] = { |
1627 | { | 1626 | { |
1628 | .name = "uart0", | ||
1629 | .dev = &uart0_device.dev, | 1627 | .dev = &uart0_device.dev, |
1630 | }, | 1628 | }, |
1631 | { | 1629 | { |
1632 | .name = "spi0", | ||
1633 | .dev = &pl022_device.dev, | 1630 | .dev = &pl022_device.dev, |
1634 | }, | 1631 | }, |
1635 | { | 1632 | { |
1636 | .name = "mmc0", | ||
1637 | .dev = &mmcsd_device.dev, | 1633 | .dev = &mmcsd_device.dev, |
1638 | }, | 1634 | }, |
1639 | }; | 1635 | }; |
@@ -1646,16 +1642,10 @@ static int __init u300_pinctrl_fetch(void) | |||
1646 | struct pinctrl *p; | 1642 | struct pinctrl *p; |
1647 | int ret; | 1643 | int ret; |
1648 | 1644 | ||
1649 | p = pinctrl_get(u300_mux_hogs[i].dev, PINCTRL_STATE_DEFAULT); | 1645 | p = pinctrl_get_select_default(u300_mux_hogs[i].dev); |
1650 | if (IS_ERR(p)) { | 1646 | if (IS_ERR(p)) { |
1651 | pr_err("u300: could not get pinmux hog %s\n", | 1647 | pr_err("u300: could not get pinmux hog for dev %s\n", |
1652 | u300_mux_hogs[i].name); | 1648 | dev_name(u300_mux_hogs[i].dev)); |
1653 | continue; | ||
1654 | } | ||
1655 | ret = pinctrl_enable(p); | ||
1656 | if (ret) { | ||
1657 | pr_err("u300: could enable pinmux hog %s\n", | ||
1658 | u300_mux_hogs[i].name); | ||
1659 | continue; | 1649 | continue; |
1660 | } | 1650 | } |
1661 | u300_mux_hogs[i].p = p; | 1651 | u300_mux_hogs[i].p = p; |