pinctrl: generic: dump pin configuration
authorHaojian Zhuang <haojian.zhuang@linaro.org>
Sun, 17 Feb 2013 11:42:53 +0000 (19:42 +0800)
committerLinus Walleij <linus.walleij@linaro.org>
Thu, 7 Mar 2013 04:27:30 +0000 (05:27 +0100)
Add the support of dumping pin configuration.

Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/pinconf-generic.c
drivers/pinctrl/pinconf.h

index 06c304ac6f7da2794d38e380bdd51a8a91736182..9c436858812cf36517d0d97efa9ce647f79fddb8 100644 (file)
@@ -12,6 +12,7 @@
 #define pr_fmt(fmt) "generic pinconfig core: " fmt
 
 #include <linux/kernel.h>
+#include <linux/module.h>
 #include <linux/init.h>
 #include <linux/device.h>
 #include <linux/slab.h>
@@ -120,4 +121,17 @@ void pinconf_generic_dump_group(struct pinctrl_dev *pctldev,
        }
 }
 
+void pinconf_generic_dump_config(struct pinctrl_dev *pctldev,
+                                struct seq_file *s, unsigned long config)
+{
+       int i;
+
+       for(i = 0; i < ARRAY_SIZE(conf_items); i++) {
+               if (pinconf_to_config_param(config) != conf_items[i].param)
+                       continue;
+               seq_printf(s, "%s: 0x%x", conf_items[i].display,
+                          pinconf_to_config_argument(config));
+       }
+}
+EXPORT_SYMBOL_GPL(pinconf_generic_dump_config);
 #endif
index e3ed8cb072a5a4dd410015c66e3202ded90dd49c..1f7113e40078312bfd30cd77908253603185c05e 100644 (file)
@@ -98,6 +98,8 @@ void pinconf_generic_dump_pin(struct pinctrl_dev *pctldev,
 void pinconf_generic_dump_group(struct pinctrl_dev *pctldev,
                              struct seq_file *s, const char *gname);
 
+void pinconf_generic_dump_config(struct pinctrl_dev *pctldev,
+                                struct seq_file *s, unsigned long config);
 #else
 
 static inline void pinconf_generic_dump_pin(struct pinctrl_dev *pctldev,
@@ -114,4 +116,10 @@ static inline void pinconf_generic_dump_group(struct pinctrl_dev *pctldev,
        return;
 }
 
+static inline void pinconf_generic_dump_config(struct pinctrl_dev *pctldev,
+                                              struct seq_file *s,
+                                              unsigned long config)
+{
+       return;
+}
 #endif