diff mbox

[3/3] pinctrl: at91: implement at91_pinconf_dbg_show

Message ID 1386421734-10240-3-git-send-email-alexandre.belloni@free-electrons.com (mailing list archive)
State New, archived
Headers show

Commit Message

Alexandre Belloni Dec. 7, 2013, 1:08 p.m. UTC
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>
---
 drivers/pinctrl/pinctrl-at91.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

Comments

Linus Walleij Dec. 12, 2013, 2:45 p.m. UTC | #1
On Sat, Dec 7, 2013 at 2:08 PM, Alexandre Belloni
<alexandre.belloni@free-electrons.com> wrote:

> 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>

This is a more invasive patch so I prefer if Laurent ACK this before
I apply it.

Yours,
Linus Walleij
Alexandre Belloni Dec. 12, 2013, 3:50 p.m. UTC | #2
On 12/12/2013 15:45, Linus Walleij wrote:
> On Sat, Dec 7, 2013 at 2:08 PM, Alexandre Belloni
> <alexandre.belloni@free-electrons.com> wrote:
>
>> 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>
> This is a more invasive patch so I prefer if Laurent ACK this before
> I apply it.

Hum, just to be clear, this is an Atmel chip and the Atmel maintainers
were already in copy. I believe Laurent already has a lot on his plate
with CDF ;)
Laurent Pinchart Dec. 12, 2013, 4:04 p.m. UTC | #3
On Thursday 12 December 2013 16:50:20 Alexandre Belloni wrote:
> On 12/12/2013 15:45, Linus Walleij wrote:
> > On Sat, Dec 7, 2013 at 2:08 PM, Alexandre Belloni
> > 
> > <alexandre.belloni@free-electrons.com> wrote:
> >> 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>
> > 
> > This is a more invasive patch so I prefer if Laurent ACK this before
> > I apply it.
> 
> Hum, just to be clear, this is an Atmel chip and the Atmel maintainers
> were already in copy. I believe Laurent already has a lot on his plate
> with CDF ;)

Not to mention the rest. I'd love to help with at91 pinctrl, but I think I 
have to draw the line somewhere. I hope it won't come as a shock that I can't 
review the whole kernel :-D
Linus Walleij Dec. 12, 2013, 9:14 p.m. UTC | #4
On Thu, Dec 12, 2013 at 5:04 PM, Laurent Pinchart
<laurent.pinchart@ideasonboard.com> wrote:
> On Thursday 12 December 2013 16:50:20 Alexandre Belloni wrote:
>> On 12/12/2013 15:45, Linus Walleij wrote:
>> > On Sat, Dec 7, 2013 at 2:08 PM, Alexandre Belloni
>> >
>> > <alexandre.belloni@free-electrons.com> wrote:
>> >> 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>
>> >
>> > This is a more invasive patch so I prefer if Laurent ACK this before
>> > I apply it.
>>
>> Hum, just to be clear, this is an Atmel chip and the Atmel maintainers
>> were already in copy. I believe Laurent already has a lot on his plate
>> with CDF ;)
>
> Not to mention the rest. I'd love to help with at91 pinctrl, but I think I
> have to draw the line somewhere. I hope it won't come as a shock that I can't
> review the whole kernel :-D

Sorry about this mess, forget about it, I don't know what is wrong
we me today, probably trying to process too many patches :-)

Yours,
Linus Walleij
Nicolas Ferre Dec. 13, 2013, 8:50 a.m. UTC | #5
On 07/12/2013 14:08, Alexandre Belloni :
> 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>

I am fine with these helpers:

Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>

But still a little disappointed that Laurent announced that he wouldn't 
review the whole kernel ;-)

Bye guys and thanks a lot!

> ---
>   drivers/pinctrl/pinctrl-at91.c | 25 +++++++++++++++++++++++++
>   1 file changed, 25 insertions(+)
>
> 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,
>   	return 0;
>   }
>
> +#define DBG_SHOW_FLAG(flag) do {		\
> +	if (config & flag) {			\
> +		if (num_conf)			\
> +			seq_puts(s, "|");	\
> +		seq_puts(s, #flag);		\
> +		num_conf++;			\
> +	}					\
> +} while (0)
> +
>   static void at91_pinconf_dbg_show(struct pinctrl_dev *pctldev,
>   				   struct seq_file *s, unsigned pin_id)
>   {
> +	unsigned long config;
> +	int ret, val, num_conf = 0;
> +
> +	ret = at91_pinconf_get(pctldev, pin_id, &config);
> +
> +	DBG_SHOW_FLAG(MULTI_DRIVE);
> +	DBG_SHOW_FLAG(PULL_UP);
> +	DBG_SHOW_FLAG(PULL_DOWN);
> +	DBG_SHOW_FLAG(DIS_SCHMIT);
> +	DBG_SHOW_FLAG(DEGLITCH);
> +	DBG_SHOW_FLAG(DEBOUNCE);
> +	if (config & DEBOUNCE) {
> +		val = config >> DEBOUNCE_VAL_SHIFT;
> +		seq_printf(s, "(%d)", val);
> +	}
>
> +	return;
>   }
>
>   static void at91_pinconf_group_dbg_show(struct pinctrl_dev *pctldev,
>
Linus Walleij Dec. 13, 2013, 9:34 a.m. UTC | #6
On Sat, Dec 7, 2013 at 2:08 PM, Alexandre Belloni
<alexandre.belloni@free-electrons.com> wrote:

> 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>

Patch applied with Nicolas' ACK.

Yours,
Linus Walleij
diff mbox

Patch

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,
 	return 0;
 }
 
+#define DBG_SHOW_FLAG(flag) do {		\
+	if (config & flag) {			\
+		if (num_conf)			\
+			seq_puts(s, "|");	\
+		seq_puts(s, #flag);		\
+		num_conf++;			\
+	}					\
+} while (0)
+
 static void at91_pinconf_dbg_show(struct pinctrl_dev *pctldev,
 				   struct seq_file *s, unsigned pin_id)
 {
+	unsigned long config;
+	int ret, val, num_conf = 0;
+
+	ret = at91_pinconf_get(pctldev, pin_id, &config);
+
+	DBG_SHOW_FLAG(MULTI_DRIVE);
+	DBG_SHOW_FLAG(PULL_UP);
+	DBG_SHOW_FLAG(PULL_DOWN);
+	DBG_SHOW_FLAG(DIS_SCHMIT);
+	DBG_SHOW_FLAG(DEGLITCH);
+	DBG_SHOW_FLAG(DEBOUNCE);
+	if (config & DEBOUNCE) {
+		val = config >> DEBOUNCE_VAL_SHIFT;
+		seq_printf(s, "(%d)", val);
+	}
 
+	return;
 }
 
 static void at91_pinconf_group_dbg_show(struct pinctrl_dev *pctldev,