diff options
author | Stephen Warren <swarren@nvidia.com> | 2012-03-02 13:05:46 -0700 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2012-03-05 11:21:46 +0100 |
commit | 0e3db173e2b9fd3b82246516e72c17763eb5f98d (patch) | |
tree | ce00c29c56332c925766f7f793d388b9670d802f /drivers/pinctrl/core.h | |
parent | 7ecdb16fe63e5b356335ebdc236adfb48cef31e1 (diff) |
pinctrl: add usecount to pins for muxing
Multiple mapping table entries could reference the same pin, and hence
"own" it. This would be unusual now that pinctrl_get() represents a single
state for a client device, but in the future when it represents all known
states for a device, this is quite likely. Implement reference counting
for pin ownership to handle this.
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 'drivers/pinctrl/core.h')
-rw-r--r-- | drivers/pinctrl/core.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/pinctrl/core.h b/drivers/pinctrl/core.h index 5f258b79340..0bc52ecaf71 100644 --- a/drivers/pinctrl/core.h +++ b/drivers/pinctrl/core.h @@ -82,7 +82,14 @@ struct pinctrl_setting { * @name: a name for the pin, e.g. the name of the pin/pad/finger on a * datasheet or such * @dynamic_name: if the name of this pin was dynamically allocated - * @owner: the device holding this pin or NULL of no device has claimed it + * @usecount: If zero, the pin is not claimed, and @owner should be NULL. + * If non-zero, this pin is claimed by @owner. This field is an integer + * rather than a boolean, since pinctrl_get() might process multiple + * mapping table entries that refer to, and hence claim, the same group + * or pin, and each of these will increment the @usecount. + * @owner: The name of the entity owning the pin. Typically, this is the name + * of the device that called pinctrl_get(). Alternatively, it may be the + * name of the GPIO passed to pinctrl_request_gpio(). */ struct pin_desc { struct pinctrl_dev *pctldev; @@ -90,6 +97,7 @@ struct pin_desc { bool dynamic_name; /* These fields only added when supporting pinmux drivers */ #ifdef CONFIG_PINMUX + unsigned usecount; const char *owner; #endif }; |