diff options
author | Alexandre Belloni <alexandre.belloni@free-electrons.com> | 2013-12-07 08:08:54 -0500 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2013-12-13 04:34:07 -0500 |
commit | 4d9b8a8e4657010e3254d2e52e9542c4cedf448d (patch) | |
tree | cdd4e8ed64e81939eb6d7561f5e47b7c2e54dfab /drivers/pinctrl/pinctrl-at91.c | |
parent | 1a16bee6bce39ca31724cf928dce19bd48d78df5 (diff) |
pinctrl: at91: implement at91_pinconf_dbg_show
This allows to get the pin configuration by using debugfs. On my system:
# cat /sys/kernel/debug/pinctrl/pinctrl.3/pinconf-pins
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl/pinctrl-at91.c')
-rw-r--r-- | drivers/pinctrl/pinctrl-at91.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c index b0b78f3468ae..bcfc8a2eebca 100644 --- a/drivers/pinctrl/pinctrl-at91.c +++ b/drivers/pinctrl/pinctrl-at91.c | |||
@@ -784,10 +784,35 @@ static int at91_pinconf_set(struct pinctrl_dev *pctldev, | |||
784 | return 0; | 784 | return 0; |
785 | } | 785 | } |
786 | 786 | ||
787 | #define DBG_SHOW_FLAG(flag) do { \ | ||
788 | if (config & flag) { \ | ||
789 | if (num_conf) \ | ||
790 | seq_puts(s, "|"); \ | ||
791 | seq_puts(s, #flag); \ | ||
792 | num_conf++; \ | ||
793 | } \ | ||
794 | } while (0) | ||
795 | |||
787 | static void at91_pinconf_dbg_show(struct pinctrl_dev *pctldev, | 796 | static void at91_pinconf_dbg_show(struct pinctrl_dev *pctldev, |
788 | struct seq_file *s, unsigned pin_id) | 797 | struct seq_file *s, unsigned pin_id) |
789 | { | 798 | { |
799 | unsigned long config; | ||
800 | int ret, val, num_conf = 0; | ||
801 | |||
802 | ret = at91_pinconf_get(pctldev, pin_id, &config); | ||
803 | |||
804 | DBG_SHOW_FLAG(MULTI_DRIVE); | ||
805 | DBG_SHOW_FLAG(PULL_UP); | ||
806 | DBG_SHOW_FLAG(PULL_DOWN); | ||
807 | DBG_SHOW_FLAG(DIS_SCHMIT); | ||
808 | DBG_SHOW_FLAG(DEGLITCH); | ||
809 | DBG_SHOW_FLAG(DEBOUNCE); | ||
810 | if (config & DEBOUNCE) { | ||
811 | val = config >> DEBOUNCE_VAL_SHIFT; | ||
812 | seq_printf(s, "(%d)", val); | ||
813 | } | ||
790 | 814 | ||
815 | return; | ||
791 | } | 816 | } |
792 | 817 | ||
793 | static void at91_pinconf_group_dbg_show(struct pinctrl_dev *pctldev, | 818 | static void at91_pinconf_group_dbg_show(struct pinctrl_dev *pctldev, |