aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/pinctrl/pinconf.c31
-rw-r--r--drivers/pinctrl/pinconf.h5
2 files changed, 16 insertions, 20 deletions
diff --git a/drivers/pinctrl/pinconf.c b/drivers/pinctrl/pinconf.c
index b74f64af1923..0c9d08d84694 100644
--- a/drivers/pinctrl/pinconf.c
+++ b/drivers/pinctrl/pinconf.c
@@ -23,7 +23,20 @@
23#include "core.h" 23#include "core.h"
24#include "pinconf.h" 24#include "pinconf.h"
25 25
26int pin_config_get_for_pin(struct pinctrl_dev *pctldev, unsigned pin, 26int pinconf_check_ops(struct pinctrl_dev *pctldev)
27{
28 const struct pinconf_ops *ops = pctldev->desc->confops;
29
30 /* We must be able to read out pin status */
31 if (!ops->pin_config_get && !ops->pin_config_group_get)
32 return -EINVAL;
33 /* We have to be able to config the pins in SOME way */
34 if (!ops->pin_config_set && !ops->pin_config_group_set)
35 return -EINVAL;
36 return 0;
37}
38
39static int pin_config_get_for_pin(struct pinctrl_dev *pctldev, unsigned pin,
27 unsigned long *config) 40 unsigned long *config)
28{ 41{
29 const struct pinconf_ops *ops = pctldev->desc->confops; 42 const struct pinconf_ops *ops = pctldev->desc->confops;
@@ -63,7 +76,7 @@ int pin_config_get(const char *dev_name, const char *name,
63} 76}
64EXPORT_SYMBOL(pin_config_get); 77EXPORT_SYMBOL(pin_config_get);
65 78
66int pin_config_set_for_pin(struct pinctrl_dev *pctldev, unsigned pin, 79static int pin_config_set_for_pin(struct pinctrl_dev *pctldev, unsigned pin,
67 unsigned long config) 80 unsigned long config)
68{ 81{
69 const struct pinconf_ops *ops = pctldev->desc->confops; 82 const struct pinconf_ops *ops = pctldev->desc->confops;
@@ -138,7 +151,6 @@ int pin_config_group_get(const char *dev_name, const char *pin_group,
138} 151}
139EXPORT_SYMBOL(pin_config_group_get); 152EXPORT_SYMBOL(pin_config_group_get);
140 153
141
142int pin_config_group_set(const char *dev_name, const char *pin_group, 154int pin_config_group_set(const char *dev_name, const char *pin_group,
143 unsigned long config) 155 unsigned long config)
144{ 156{
@@ -205,19 +217,6 @@ int pin_config_group_set(const char *dev_name, const char *pin_group,
205} 217}
206EXPORT_SYMBOL(pin_config_group_set); 218EXPORT_SYMBOL(pin_config_group_set);
207 219
208int pinconf_check_ops(struct pinctrl_dev *pctldev)
209{
210 const struct pinconf_ops *ops = pctldev->desc->confops;
211
212 /* We must be able to read out pin status */
213 if (!ops->pin_config_get && !ops->pin_config_group_get)
214 return -EINVAL;
215 /* We have to be able to config the pins in SOME way */
216 if (!ops->pin_config_set && !ops->pin_config_group_set)
217 return -EINVAL;
218 return 0;
219}
220
221#ifdef CONFIG_DEBUG_FS 220#ifdef CONFIG_DEBUG_FS
222 221
223static void pinconf_dump_pin(struct pinctrl_dev *pctldev, 222static void pinconf_dump_pin(struct pinctrl_dev *pctldev,
diff --git a/drivers/pinctrl/pinconf.h b/drivers/pinctrl/pinconf.h
index 006b77fa737e..1d6ea9de75fc 100644
--- a/drivers/pinctrl/pinconf.h
+++ b/drivers/pinctrl/pinconf.h
@@ -14,12 +14,9 @@
14#ifdef CONFIG_PINCONF 14#ifdef CONFIG_PINCONF
15 15
16int pinconf_check_ops(struct pinctrl_dev *pctldev); 16int pinconf_check_ops(struct pinctrl_dev *pctldev);
17
17void pinconf_init_device_debugfs(struct dentry *devroot, 18void pinconf_init_device_debugfs(struct dentry *devroot,
18 struct pinctrl_dev *pctldev); 19 struct pinctrl_dev *pctldev);
19int pin_config_get_for_pin(struct pinctrl_dev *pctldev, unsigned pin,
20 unsigned long *config);
21int pin_config_set_for_pin(struct pinctrl_dev *pctldev, unsigned pin,
22 unsigned long config);
23 20
24#else 21#else
25 22