aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorMark Brown <broonie@linaro.org>2014-04-04 21:39:02 +0100
committerMark Brown <broonie@linaro.org>2014-04-04 21:39:02 +0100
commit270cfc4788befe0e1a16bf1b3a7b80d9f4127c57 (patch)
tree7bde98363eba71811a4e5c10ac04eef1d8d75db2 /drivers
parentbaeae2041e14d5b7a272b9941b88fb56d716f643 (diff)
downloadlinaro-lsk-270cfc4788befe0e1a16bf1b3a7b80d9f4127c57.tar.gz
pinctrl: utils : add support to pass config type in generic util APIs
Add support to pass the config type like GROUP or PIN when using the utils or generic pin configuration APIs. This will make the APIs more generic. Added additional inline APIs such that it can be use directly as callback for the pinctrl_ops. Changes from V1: - Remove separate implementation for pins and group for pinctrl_utils_dt_free_map and improve this function to support both i.e. PINS and GROUPs. [For LSK restore the original API and add a _new() variant of the functions for external consumption instead, maintaining the existing API -- broonie] Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-by: Stephen Warren <swarren@nvidia.com> Tested-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> (cherry-picked from commit 3287c24088abded9f111ca797fdd36f86912d199) Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/pinctrl/pinconf-generic.c19
-rw-r--r--drivers/pinctrl/pinctrl-utils.c12
2 files changed, 19 insertions, 12 deletions
diff --git a/drivers/pinctrl/pinconf-generic.c b/drivers/pinctrl/pinconf-generic.c
index d54b877cb70..872e74a2378 100644
--- a/drivers/pinctrl/pinconf-generic.c
+++ b/drivers/pinctrl/pinconf-generic.c
@@ -242,9 +242,10 @@ out:
return ret;
}
-int pinconf_generic_dt_subnode_to_map(struct pinctrl_dev *pctldev,
+int pinconf_generic_dt_subnode_to_map_new(struct pinctrl_dev *pctldev,
struct device_node *np, struct pinctrl_map **map,
- unsigned *reserved_maps, unsigned *num_maps)
+ unsigned *reserved_maps, unsigned *num_maps,
+ enum pinctrl_map_type type)
{
int ret;
const char *function;
@@ -298,7 +299,7 @@ int pinconf_generic_dt_subnode_to_map(struct pinctrl_dev *pctldev,
if (num_configs) {
ret = pinctrl_utils_add_map_configs(pctldev, map,
reserved_maps, num_maps, group, configs,
- num_configs, PIN_MAP_TYPE_CONFIGS_PIN);
+ num_configs, type);
if (ret < 0)
goto exit;
}
@@ -309,11 +310,11 @@ exit:
kfree(configs);
return ret;
}
-EXPORT_SYMBOL_GPL(pinconf_generic_dt_subnode_to_map);
+EXPORT_SYMBOL_GPL(pinconf_generic_dt_subnode_to_map_new);
-int pinconf_generic_dt_node_to_map(struct pinctrl_dev *pctldev,
+int pinconf_generic_dt_node_to_map_new(struct pinctrl_dev *pctldev,
struct device_node *np_config, struct pinctrl_map **map,
- unsigned *num_maps)
+ unsigned *num_maps, enum pinctrl_map_type type)
{
unsigned reserved_maps;
struct device_node *np;
@@ -324,8 +325,8 @@ int pinconf_generic_dt_node_to_map(struct pinctrl_dev *pctldev,
*num_maps = 0;
for_each_child_of_node(np_config, np) {
- ret = pinconf_generic_dt_subnode_to_map(pctldev, np, map,
- &reserved_maps, num_maps);
+ ret = pinconf_generic_dt_subnode_to_map_new(pctldev, np, map,
+ &reserved_maps, num_maps, type);
if (ret < 0) {
pinctrl_utils_dt_free_map(pctldev, *map, *num_maps);
return ret;
@@ -333,6 +334,6 @@ int pinconf_generic_dt_node_to_map(struct pinctrl_dev *pctldev,
}
return 0;
}
-EXPORT_SYMBOL_GPL(pinconf_generic_dt_node_to_map);
+EXPORT_SYMBOL_GPL(pinconf_generic_dt_node_to_map_new);
#endif
diff --git a/drivers/pinctrl/pinctrl-utils.c b/drivers/pinctrl/pinctrl-utils.c
index b7ac646c43b..48277e025f8 100644
--- a/drivers/pinctrl/pinctrl-utils.c
+++ b/drivers/pinctrl/pinctrl-utils.c
@@ -126,10 +126,16 @@ void pinctrl_utils_dt_free_map(struct pinctrl_dev *pctldev,
{
int i;
- for (i = 0; i < num_maps; i++)
- if (map[i].type == PIN_MAP_TYPE_CONFIGS_GROUP)
+ for (i = 0; i < num_maps; i++) {
+ switch (map[i].type) {
+ case PIN_MAP_TYPE_CONFIGS_GROUP:
+ case PIN_MAP_TYPE_CONFIGS_PIN:
kfree(map[i].data.configs.configs);
-
+ break;
+ default:
+ break;
+ }
+ }
kfree(map);
}
EXPORT_SYMBOL_GPL(pinctrl_utils_dt_free_map);