All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHv2] pinctrl: samsung: add pin_dbg_show callback for debugfs
@ 2018-03-27 13:58 ` Chanho Park
  0 siblings, 0 replies; 8+ messages in thread
From: Chanho Park @ 2018-03-27 13:58 UTC (permalink / raw)
  To: Tomasz Figa, Krzysztof Kozlowski, Sylwester Nawrocki, Linus Walleij
  Cc: linux-gpio, linux-samsung-soc, linux-arm-kernel, Chanho Park

This patch adds a samsung_pin_dbg_show function to implement the
pin_dbg_show callback function which can be used to show pin
confuration values. Basically, it can show pin setting values by
accessing the "pins" node like below:

$ cat pins
pin 0 (gpy7-0)  CON(0x0) DAT(0x1) PUD(0x1) DRV(0x0) CON_PDN(0x0) PUD_PDN(0x0)

Signed-off-by: Chanho Park <parkch98@gmail.com>
---
Changes from v1:
- use samsung_pinconf_get instead of samsung_pinconf_rw
- use "static const char * const" type declaration of reg_names
- skip condition change

 drivers/pinctrl/samsung/pinctrl-samsung.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/drivers/pinctrl/samsung/pinctrl-samsung.c b/drivers/pinctrl/samsung/pinctrl-samsung.c
index 336e88d7bdb9..618945a0fd38 100644
--- a/drivers/pinctrl/samsung/pinctrl-samsung.c
+++ b/drivers/pinctrl/samsung/pinctrl-samsung.c
@@ -279,6 +279,32 @@ static int samsung_dt_node_to_map(struct pinctrl_dev *pctldev,
 	return 0;
 }
 
+#ifdef CONFIG_DEBUG_FS
+/* Forward declaration which can be used by samsung_pin_dbg_show */
+static int samsung_pinconf_get(struct pinctrl_dev *pctldev, unsigned int pin,
+					unsigned long *config);
+static const char * const reg_names[] = {"CON", "DAT", "PUD", "DRV", "CON_PDN",
+					 "PUD_PDN"};
+
+static void samsung_pin_dbg_show(struct pinctrl_dev *pctldev,
+				struct seq_file *s, unsigned int pin)
+{
+	enum pincfg_type cfg_type;
+	unsigned long config;
+	int ret;
+
+	for (cfg_type = 0; cfg_type < PINCFG_TYPE_NUM; cfg_type++) {
+		config = PINCFG_PACK(cfg_type, 0);
+		ret = samsung_pinconf_get(pctldev, pin, &config);
+		if (ret < 0)
+			continue;
+
+		seq_printf(s, " %s(0x%lx)", reg_names[cfg_type],
+			   PINCFG_UNPACK_VALUE(config));
+	}
+}
+#endif
+
 /* list of pinctrl callbacks for the pinctrl core */
 static const struct pinctrl_ops samsung_pctrl_ops = {
 	.get_groups_count	= samsung_get_group_count,
@@ -286,6 +312,9 @@ static const struct pinctrl_ops samsung_pctrl_ops = {
 	.get_group_pins		= samsung_get_group_pins,
 	.dt_node_to_map		= samsung_dt_node_to_map,
 	.dt_free_map		= samsung_dt_free_map,
+#ifdef CONFIG_DEBUG_FS
+	.pin_dbg_show		= samsung_pin_dbg_show,
+#endif
 };
 
 /* check if the selector is a valid pin function selector */
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCHv2] pinctrl: samsung: add pin_dbg_show callback for debugfs
@ 2018-03-27 13:58 ` Chanho Park
  0 siblings, 0 replies; 8+ messages in thread
From: Chanho Park @ 2018-03-27 13:58 UTC (permalink / raw)
  To: linux-arm-kernel

This patch adds a samsung_pin_dbg_show function to implement the
pin_dbg_show callback function which can be used to show pin
confuration values. Basically, it can show pin setting values by
accessing the "pins" node like below:

$ cat pins
pin 0 (gpy7-0)  CON(0x0) DAT(0x1) PUD(0x1) DRV(0x0) CON_PDN(0x0) PUD_PDN(0x0)

Signed-off-by: Chanho Park <parkch98@gmail.com>
---
Changes from v1:
- use samsung_pinconf_get instead of samsung_pinconf_rw
- use "static const char * const" type declaration of reg_names
- skip condition change

 drivers/pinctrl/samsung/pinctrl-samsung.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/drivers/pinctrl/samsung/pinctrl-samsung.c b/drivers/pinctrl/samsung/pinctrl-samsung.c
index 336e88d7bdb9..618945a0fd38 100644
--- a/drivers/pinctrl/samsung/pinctrl-samsung.c
+++ b/drivers/pinctrl/samsung/pinctrl-samsung.c
@@ -279,6 +279,32 @@ static int samsung_dt_node_to_map(struct pinctrl_dev *pctldev,
 	return 0;
 }
 
+#ifdef CONFIG_DEBUG_FS
+/* Forward declaration which can be used by samsung_pin_dbg_show */
+static int samsung_pinconf_get(struct pinctrl_dev *pctldev, unsigned int pin,
+					unsigned long *config);
+static const char * const reg_names[] = {"CON", "DAT", "PUD", "DRV", "CON_PDN",
+					 "PUD_PDN"};
+
+static void samsung_pin_dbg_show(struct pinctrl_dev *pctldev,
+				struct seq_file *s, unsigned int pin)
+{
+	enum pincfg_type cfg_type;
+	unsigned long config;
+	int ret;
+
+	for (cfg_type = 0; cfg_type < PINCFG_TYPE_NUM; cfg_type++) {
+		config = PINCFG_PACK(cfg_type, 0);
+		ret = samsung_pinconf_get(pctldev, pin, &config);
+		if (ret < 0)
+			continue;
+
+		seq_printf(s, " %s(0x%lx)", reg_names[cfg_type],
+			   PINCFG_UNPACK_VALUE(config));
+	}
+}
+#endif
+
 /* list of pinctrl callbacks for the pinctrl core */
 static const struct pinctrl_ops samsung_pctrl_ops = {
 	.get_groups_count	= samsung_get_group_count,
@@ -286,6 +312,9 @@ static const struct pinctrl_ops samsung_pctrl_ops = {
 	.get_group_pins		= samsung_get_group_pins,
 	.dt_node_to_map		= samsung_dt_node_to_map,
 	.dt_free_map		= samsung_dt_free_map,
+#ifdef CONFIG_DEBUG_FS
+	.pin_dbg_show		= samsung_pin_dbg_show,
+#endif
 };
 
 /* check if the selector is a valid pin function selector */
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCHv2] pinctrl: samsung: add pin_dbg_show callback for debugfs
  2018-03-27 13:58 ` Chanho Park
@ 2018-03-28 10:23   ` Krzysztof Kozlowski
  -1 siblings, 0 replies; 8+ messages in thread
From: Krzysztof Kozlowski @ 2018-03-28 10:23 UTC (permalink / raw)
  To: Chanho Park, Linus Walleij
  Cc: linux-arm-kernel, linux-gpio, linux-samsung-soc, Tomasz Figa,
	Sylwester Nawrocki

On Tue, Mar 27, 2018 at 3:58 PM, Chanho Park <parkch98@gmail.com> wrote:
> This patch adds a samsung_pin_dbg_show function to implement the
> pin_dbg_show callback function which can be used to show pin
> confuration values. Basically, it can show pin setting values by
> accessing the "pins" node like below:
>
> $ cat pins
> pin 0 (gpy7-0)  CON(0x0) DAT(0x1) PUD(0x1) DRV(0x0) CON_PDN(0x0) PUD_PDN(0x0)
>
> Signed-off-by: Chanho Park <parkch98@gmail.com>
> ---
> Changes from v1:
> - use samsung_pinconf_get instead of samsung_pinconf_rw
> - use "static const char * const" type declaration of reg_names
> - skip condition change
>
>  drivers/pinctrl/samsung/pinctrl-samsung.c | 29 +++++++++++++++++++++++++++++
>  1 file changed, 29 insertions(+)

Looks fine, thanks:
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>

Linus,
I do not have anything in my pinctrl queue for you so maybe you can
take it directly? Otherwise, I will apply it after upcoming merge
window.

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCHv2] pinctrl: samsung: add pin_dbg_show callback for debugfs
@ 2018-03-28 10:23   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 8+ messages in thread
From: Krzysztof Kozlowski @ 2018-03-28 10:23 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Mar 27, 2018 at 3:58 PM, Chanho Park <parkch98@gmail.com> wrote:
> This patch adds a samsung_pin_dbg_show function to implement the
> pin_dbg_show callback function which can be used to show pin
> confuration values. Basically, it can show pin setting values by
> accessing the "pins" node like below:
>
> $ cat pins
> pin 0 (gpy7-0)  CON(0x0) DAT(0x1) PUD(0x1) DRV(0x0) CON_PDN(0x0) PUD_PDN(0x0)
>
> Signed-off-by: Chanho Park <parkch98@gmail.com>
> ---
> Changes from v1:
> - use samsung_pinconf_get instead of samsung_pinconf_rw
> - use "static const char * const" type declaration of reg_names
> - skip condition change
>
>  drivers/pinctrl/samsung/pinctrl-samsung.c | 29 +++++++++++++++++++++++++++++
>  1 file changed, 29 insertions(+)

Looks fine, thanks:
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>

Linus,
I do not have anything in my pinctrl queue for you so maybe you can
take it directly? Otherwise, I will apply it after upcoming merge
window.

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCHv2] pinctrl: samsung: add pin_dbg_show callback for debugfs
       [not found] ` <CGME20180328121148epcas2p2a498fce663d34c8c3caf38e15d6e68c3@epcas2p2.samsung.com>
@ 2018-03-28 12:11     ` Sylwester Nawrocki
  0 siblings, 0 replies; 8+ messages in thread
From: Sylwester Nawrocki @ 2018-03-28 12:11 UTC (permalink / raw)
  To: Chanho Park
  Cc: linux-samsung-soc, Linus Walleij, Tomasz Figa,
	Krzysztof Kozlowski, linux-gpio, linux-arm-kernel

On 03/27/2018 03:58 PM, Chanho Park wrote:
> This patch adds a samsung_pin_dbg_show function to implement the
> pin_dbg_show callback function which can be used to show pin
> confuration values. Basically, it can show pin setting values by
> accessing the "pins" node like below:
> 
> $ cat pins
> pin 0 (gpy7-0)  CON(0x0) DAT(0x1) PUD(0x1) DRV(0x0) CON_PDN(0x0) PUD_PDN(0x0)
> 
> Signed-off-by: Chanho Park <parkch98@gmail.com>

Thank you for the patch. On exynos5433-tm2

Tested-by: Sylwester Nawrocki <s.nawrocki@samsung.com>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCHv2] pinctrl: samsung: add pin_dbg_show callback for debugfs
@ 2018-03-28 12:11     ` Sylwester Nawrocki
  0 siblings, 0 replies; 8+ messages in thread
From: Sylwester Nawrocki @ 2018-03-28 12:11 UTC (permalink / raw)
  To: linux-arm-kernel

On 03/27/2018 03:58 PM, Chanho Park wrote:
> This patch adds a samsung_pin_dbg_show function to implement the
> pin_dbg_show callback function which can be used to show pin
> confuration values. Basically, it can show pin setting values by
> accessing the "pins" node like below:
> 
> $ cat pins
> pin 0 (gpy7-0)  CON(0x0) DAT(0x1) PUD(0x1) DRV(0x0) CON_PDN(0x0) PUD_PDN(0x0)
> 
> Signed-off-by: Chanho Park <parkch98@gmail.com>

Thank you for the patch. On exynos5433-tm2

Tested-by: Sylwester Nawrocki <s.nawrocki@samsung.com>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCHv2] pinctrl: samsung: add pin_dbg_show callback for debugfs
  2018-03-27 13:58 ` Chanho Park
@ 2018-04-12  8:14   ` Linus Walleij
  -1 siblings, 0 replies; 8+ messages in thread
From: Linus Walleij @ 2018-04-12  8:14 UTC (permalink / raw)
  To: Chanho Park
  Cc: linux-samsung-soc, Tomasz Figa, Krzysztof Kozlowski,
	open list:GPIO SUBSYSTEM, Sylwester Nawrocki, Linux ARM

On Tue, Mar 27, 2018 at 3:58 PM, Chanho Park <parkch98@gmail.com> wrote:

> This patch adds a samsung_pin_dbg_show function to implement the
> pin_dbg_show callback function which can be used to show pin
> confuration values. Basically, it can show pin setting values by
> accessing the "pins" node like below:
>
> $ cat pins
> pin 0 (gpy7-0)  CON(0x0) DAT(0x1) PUD(0x1) DRV(0x0) CON_PDN(0x0) PUD_PDN(0x0)
>
> Signed-off-by: Chanho Park <parkch98@gmail.com>
> ---
> Changes from v1:
> - use samsung_pinconf_get instead of samsung_pinconf_rw
> - use "static const char * const" type declaration of reg_names
> - skip condition change

Patch applied directly to my tree for v4.18 with the
ACKs!

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCHv2] pinctrl: samsung: add pin_dbg_show callback for debugfs
@ 2018-04-12  8:14   ` Linus Walleij
  0 siblings, 0 replies; 8+ messages in thread
From: Linus Walleij @ 2018-04-12  8:14 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Mar 27, 2018 at 3:58 PM, Chanho Park <parkch98@gmail.com> wrote:

> This patch adds a samsung_pin_dbg_show function to implement the
> pin_dbg_show callback function which can be used to show pin
> confuration values. Basically, it can show pin setting values by
> accessing the "pins" node like below:
>
> $ cat pins
> pin 0 (gpy7-0)  CON(0x0) DAT(0x1) PUD(0x1) DRV(0x0) CON_PDN(0x0) PUD_PDN(0x0)
>
> Signed-off-by: Chanho Park <parkch98@gmail.com>
> ---
> Changes from v1:
> - use samsung_pinconf_get instead of samsung_pinconf_rw
> - use "static const char * const" type declaration of reg_names
> - skip condition change

Patch applied directly to my tree for v4.18 with the
ACKs!

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-04-12  8:14 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-27 13:58 [PATCHv2] pinctrl: samsung: add pin_dbg_show callback for debugfs Chanho Park
2018-03-27 13:58 ` Chanho Park
2018-03-28 10:23 ` Krzysztof Kozlowski
2018-03-28 10:23   ` Krzysztof Kozlowski
     [not found] ` <CGME20180328121148epcas2p2a498fce663d34c8c3caf38e15d6e68c3@epcas2p2.samsung.com>
2018-03-28 12:11   ` Sylwester Nawrocki
2018-03-28 12:11     ` Sylwester Nawrocki
2018-04-12  8:14 ` Linus Walleij
2018-04-12  8:14   ` Linus Walleij

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.