pinctrl: introduce PINCTRL_STATE_DEFAULT, define hogs as that state

This provides a single centralized name for the default state.

Update PIN_MAP_* macros to use this state name, instead of requiring the
user to pass a state name in.

With this change, hog entries in the mapping table are defined as those
with state name PINCTRL_STATE_DEFAULT, i.e. all entries have the same
name. This interacts badly with the nested iteration over mapping table
entries in pinctrl_hog_maps() and pinctrl_hog_map() which would now
attempt to claim each hog mapping table entry multiple times. Replacing
the custom hog code with a simple pinctrl_get()/pinctrl_enable().

Update documentation and mapping tables to use this.

Signed-off-by: Stephen Warren <[email protected]>
Acked-by: Dong Aisheng <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
This commit is contained in:
Stephen Warren 2012-03-01 18:48:32 -07:00 • committed by Linus Walleij
commit 46919ae63d
6 changed files with 26 additions and 152 deletions

View file

@ -814,7 +814,7 @@ it even more compact which assumes you want to use pinctrl-foo and position
0 for mapping, for example:
static struct pinctrl_map __initdata mapping[] = {
PIN_MAP("I2CMAP", "pinctrl-foo", "i2c0", "foo-i2c.0"),
PIN_MAP(PINCTRL_STATE_DEFAULT, "pinctrl-foo", "i2c0", "foo-i2c.0"),
};
@ -930,7 +930,7 @@ foo_probe()
/* Allocate a state holder named "state" etc */
struct pinctrl p;
p = pinctrl_get(&device, NULL);
p = pinctrl_get(&device, PINCTRL_STATE_DEFAULT);
if IS_ERR(p)
return PTR_ERR(p);
pinctrl_enable(p);
@ -989,7 +989,7 @@ of the pin controller itself, like this:
{
.dev_name = "pinctrl-foo",
.name = "POWERMAP"
.name = PINCTRL_STATE_DEFAULT,
.ctrl_dev_name = "pinctrl-foo",
.function = "power_func",
},
@ -998,7 +998,7 @@ Since it may be common to request the core to hog a few always-applicable
mux settings on the primary pin controller, there is a convenience macro for
this:
PIN_MAP_PRIMARY_SYS_HOG("POWERMAP", "pinctrl-foo", "power_func")
PIN_MAP_SYS_HOG("pinctrl-foo", "power_func")
This gives the exact same result as the above construction.