Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 294087
b: refs/heads/master
c: 110e4ec
h: refs/heads/master
i:
  294085: 1d58dc3
  294083: d1d90e0
  294079: 2121bf9
v: v3
  • Loading branch information
Stephen Warren authored and Linus Walleij committed Mar 2, 2012
1 parent 7a408c0 commit f0c182d
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 22 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 46919ae63d4820e76724beb655274ce143f0da0b
refs/heads/master: 110e4ec5a1cfe20190e7f8c2b8b4eef369de3c99
7 changes: 3 additions & 4 deletions trunk/Documentation/pinctrl.txt
Original file line number Diff line number Diff line change
Expand Up @@ -782,16 +782,19 @@ spi on the second function mapping:
static const struct pinctrl_map __initdata mapping[] = {
{
.dev_name = "foo-spi.0",
.name = PINCTRL_STATE_DEFAULT,
.ctrl_dev_name = "pinctrl-foo",
.function = "spi0",
},
{
.dev_name = "foo-i2c.0",
.name = PINCTRL_STATE_DEFAULT,
.ctrl_dev_name = "pinctrl-foo",
.function = "i2c0",
},
{
.dev_name = "foo-mmc.0",
.name = PINCTRL_STATE_DEFAULT,
.ctrl_dev_name = "pinctrl-foo",
.function = "mmc0",
},
Expand Down Expand Up @@ -944,10 +947,6 @@ foo_remove()
pinctrl_put(state->p);
}

If you want to grab a specific control mapping and not just the first one
found for this device you can specify a specific mapping name, for example in
the above example the second i2c0 setting: pinctrl_get(&device, "spi0-pos-B");

This get/enable/disable/put sequence can just as well be handled by bus drivers
if you don't want each and every driver to handle it and you know the
arrangement on your bus.
Expand Down
8 changes: 4 additions & 4 deletions trunk/arch/arm/mach-u300/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1612,9 +1612,9 @@ static struct pinctrl_map __initdata u300_pinmux_map[] = {
PIN_MAP_SYS_HOG("pinctrl-u300", "emif0"),
PIN_MAP_SYS_HOG("pinctrl-u300", "emif1"),
/* per-device maps for MMC/SD, SPI and UART */
PIN_MAP("MMCSD", "pinctrl-u300", "mmc0", "mmci"),
PIN_MAP("SPI", "pinctrl-u300", "spi0", "pl022"),
PIN_MAP("UART0", "pinctrl-u300", "uart0", "uart0"),
PIN_MAP(PINCTRL_STATE_DEFAULT, "pinctrl-u300", "mmc0", "mmci"),
PIN_MAP(PINCTRL_STATE_DEFAULT, "pinctrl-u300", "spi0", "pl022"),
PIN_MAP(PINCTRL_STATE_DEFAULT, "pinctrl-u300", "uart0", "uart0"),
};

struct u300_mux_hog {
Expand Down Expand Up @@ -1646,7 +1646,7 @@ static int __init u300_pinctrl_fetch(void)
struct pinctrl *p;
int ret;

p = pinctrl_get(u300_mux_hogs[i].dev, NULL);
p = pinctrl_get(u300_mux_hogs[i].dev, PINCTRL_STATE_DEFAULT);
if (IS_ERR(p)) {
pr_err("u300: could not get pinmux hog %s\n",
u300_mux_hogs[i].name);
Expand Down
17 changes: 5 additions & 12 deletions trunk/drivers/pinctrl/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -461,8 +461,8 @@ static struct pinctrl *pinctrl_get_locked(struct device *dev, const char *name)
int i;
struct pinctrl_map const *map;

/* We must have a dev name */
if (WARN_ON(!dev))
/* We must have both a dev and state name */
if (WARN_ON(!dev || !name))
return ERR_PTR(-EINVAL);

devname = dev_name(dev);
Expand Down Expand Up @@ -504,16 +504,9 @@ static struct pinctrl *pinctrl_get_locked(struct device *dev, const char *name)
if (strcmp(map->dev_name, devname))
continue;

/*
* If we're looking for a specific named map, this must match,
* else we loop and look for the next.
*/
if (name != NULL) {
if (map->name == NULL)
continue;
if (strcmp(map->name, name))
continue;
}
/* State name must be the one we're looking for */
if (strcmp(map->name, name))
continue;

ret = pinmux_apply_muxmap(pctldev, p, dev, devname, map);
if (ret) {
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/tty/serial/sirfsoc_uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@ int sirfsoc_uart_probe(struct platform_device *pdev)
port->irq = res->start;

if (sirfport->hw_flow_ctrl) {
sirfport->p = pinctrl_get(&pdev->dev, NULL);
sirfport->p = pinctrl_get(&pdev->dev, PINCTRL_STATE_DEFAULT);
ret = IS_ERR(sirfport->p);
if (ret)
goto pin_err;
Expand Down

0 comments on commit f0c182d

Please sign in to comment.