提交 77a59883 编写于 作者: L Linus Walleij

pinctrl: changes hog mechanism to be self-referential

Instead of a specific boolean field to indicate if a map entry shall
be hogged, treat self-reference as an indication of desired hogging.
This drops one field off the map struct and has a nice Douglas R.
Hofstadter-feel to it.
Acked-by: NDong Aisheng <dong.aisheng@linaro.org>
Acked-by: NStephen Warren <swarren@nvidia.com>
Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
上级 befe5bdf
...@@ -989,21 +989,21 @@ is registered. This means that the core will attempt to call pinctrl_get() and ...@@ -989,21 +989,21 @@ is registered. This means that the core will attempt to call pinctrl_get() and
pinctrl_enable() on it immediately after the pin control device has been pinctrl_enable() on it immediately after the pin control device has been
registered. registered.
This is enabled by simply setting the .hog_on_boot field in the map to true, This is enabled by simply setting the .dev_name field in the map to the name
like this: of the pin controller itself, like this:
{ {
.name = "POWERMAP" .name = "POWERMAP"
.ctrl_dev_name = "pinctrl-foo", .ctrl_dev_name = "pinctrl-foo",
.function = "power_func", .function = "power_func",
.hog_on_boot = true, .dev_name = "pinctrl-foo",
}, },
Since it may be common to request the core to hog a few always-applicable 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 mux settings on the primary pin controller, there is a convenience macro for
this: this:
PIN_MAP_PRIMARY_SYS_HOG("POWERMAP", "power_func") PIN_MAP_PRIMARY_SYS_HOG("POWERMAP", "pinctrl-foo", "power_func")
This gives the exact same result as the above construction. This gives the exact same result as the above construction.
......
...@@ -793,11 +793,9 @@ int pinctrl_hog_maps(struct pinctrl_dev *pctldev) ...@@ -793,11 +793,9 @@ int pinctrl_hog_maps(struct pinctrl_dev *pctldev)
for (i = 0; i < pinctrl_maps_num; i++) { for (i = 0; i < pinctrl_maps_num; i++) {
struct pinctrl_map const *map = &pinctrl_maps[i]; struct pinctrl_map const *map = &pinctrl_maps[i];
if (!map->hog_on_boot)
continue;
if (map->ctrl_dev_name && if (map->ctrl_dev_name &&
!strcmp(map->ctrl_dev_name, devname)) { !strcmp(map->ctrl_dev_name, devname) &&
!strcmp(map->dev_name, devname)) {
/* OK time to hog! */ /* OK time to hog! */
ret = pinctrl_hog_map(pctldev, map); ret = pinctrl_hog_map(pctldev, map);
if (ret) if (ret)
......
...@@ -26,13 +26,9 @@ ...@@ -26,13 +26,9 @@
* selects a certain specific pin group to activate for the function, if * selects a certain specific pin group to activate for the function, if
* left as NULL, the first applicable group will be used * left as NULL, the first applicable group will be used
* @dev_name: the name of the device using this specific mapping, the name * @dev_name: the name of the device using this specific mapping, the name
* must be the same as in your struct device* * must be the same as in your struct device*. If this name is set to the
* @hog_on_boot: if this is set to true, the pin control subsystem will itself * same name as the pin controllers own dev_name(), the map entry will be
* hog the mappings as the pinmux device drivers are attached, so this is * hogged by the driver itself upon registration
* typically used with system maps (mux mappings without an assigned
* device) that you want to get hogged and enabled by default as soon as
* a pinmux device supporting it is registered. These maps will not be
* disabled and put until the system shuts down.
*/ */
struct pinctrl_map { struct pinctrl_map {
const char *name; const char *name;
...@@ -40,7 +36,6 @@ struct pinctrl_map { ...@@ -40,7 +36,6 @@ struct pinctrl_map {
const char *function; const char *function;
const char *group; const char *group;
const char *dev_name; const char *dev_name;
bool hog_on_boot;
}; };
/* /*
...@@ -62,8 +57,7 @@ struct pinctrl_map { ...@@ -62,8 +57,7 @@ struct pinctrl_map {
* to be hogged by the pin control core until the system shuts down. * to be hogged by the pin control core until the system shuts down.
*/ */
#define PIN_MAP_SYS_HOG(a, b, c) \ #define PIN_MAP_SYS_HOG(a, b, c) \
{ .name = a, .ctrl_dev_name = b, .function = c, \ { .name = a, .ctrl_dev_name = b, .dev_name = b, .function = c, }
.hog_on_boot = true }
/* /*
* Convenience macro to map a system function onto a certain pinctrl device * Convenience macro to map a system function onto a certain pinctrl device
...@@ -71,8 +65,8 @@ struct pinctrl_map { ...@@ -71,8 +65,8 @@ struct pinctrl_map {
* system shuts down. * system shuts down.
*/ */
#define PIN_MAP_SYS_HOG_GROUP(a, b, c, d) \ #define PIN_MAP_SYS_HOG_GROUP(a, b, c, d) \
{ .name = a, .ctrl_dev_name = b, .function = c, .group = d, \ { .name = a, .ctrl_dev_name = b, .dev_name = b, .function = c, \
.hog_on_boot = true } .group = d, }
#ifdef CONFIG_PINMUX #ifdef CONFIG_PINMUX
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册