All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] pinctrl: ifdef CONFIG_DEBUG_FS cleanup
@ 2012-04-11 22:45 Stephen Warren
  2012-04-11 22:45 ` [PATCH 2/2] pinctrl: allow pctldevs to decode pin config in debugfs Stephen Warren
  2012-04-13 12:42 ` [PATCH 1/2] pinctrl: ifdef CONFIG_DEBUG_FS cleanup Linus Walleij
  0 siblings, 2 replies; 4+ messages in thread
From: Stephen Warren @ 2012-04-11 22:45 UTC (permalink / raw)
  To: Linus Walleij; +Cc: linux-kernel, Stephen Warren

From: Stephen Warren <swarren@nvidia.com>

Only provide prototypes for pin{mux,conf}.c debugfs-related functions
when both CONFIG_PIN* /and/ CONFIG_DEBUG_FS are enabled, otherwise
provide static inlines.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
 drivers/pinctrl/pinconf.h |   17 ++++++++++++-----
 drivers/pinctrl/pinmux.h  |   18 ++++++++++++------
 2 files changed, 24 insertions(+), 11 deletions(-)

diff --git a/drivers/pinctrl/pinconf.h b/drivers/pinctrl/pinconf.h
index 54510de..32b8354 100644
--- a/drivers/pinctrl/pinconf.h
+++ b/drivers/pinctrl/pinconf.h
@@ -19,11 +19,6 @@ int pinconf_map_to_setting(struct pinctrl_map const *map,
 			  struct pinctrl_setting *setting);
 void pinconf_free_setting(struct pinctrl_setting const *setting);
 int pinconf_apply_setting(struct pinctrl_setting const *setting);
-void pinconf_show_map(struct seq_file *s, struct pinctrl_map const *map);
-void pinconf_show_setting(struct seq_file *s,
-			  struct pinctrl_setting const *setting);
-void pinconf_init_device_debugfs(struct dentry *devroot,
-				 struct pinctrl_dev *pctldev);
 
 /*
  * You will only be interested in these if you're using PINCONF
@@ -61,6 +56,18 @@ static inline int pinconf_apply_setting(struct pinctrl_setting const *setting)
 	return 0;
 }
 
+#endif
+
+#if defined(CONFIG_PINMUX) && defined(CONFIG_DEBUG_FS)
+
+void pinconf_show_map(struct seq_file *s, struct pinctrl_map const *map);
+void pinconf_show_setting(struct seq_file *s,
+			  struct pinctrl_setting const *setting);
+void pinconf_init_device_debugfs(struct dentry *devroot,
+				 struct pinctrl_dev *pctldev);
+
+#else
+
 static inline void pinconf_show_map(struct seq_file *s,
 				    struct pinctrl_map const *map)
 {
diff --git a/drivers/pinctrl/pinmux.h b/drivers/pinctrl/pinmux.h
index 6fc4700..d1a98b1 100644
--- a/drivers/pinctrl/pinmux.h
+++ b/drivers/pinctrl/pinmux.h
@@ -31,12 +31,6 @@ void pinmux_free_setting(struct pinctrl_setting const *setting);
 int pinmux_enable_setting(struct pinctrl_setting const *setting);
 void pinmux_disable_setting(struct pinctrl_setting const *setting);
 
-void pinmux_show_map(struct seq_file *s, struct pinctrl_map const *map);
-void pinmux_show_setting(struct seq_file *s,
-			 struct pinctrl_setting const *setting);
-void pinmux_init_device_debugfs(struct dentry *devroot,
-				struct pinctrl_dev *pctldev);
-
 #else
 
 static inline int pinmux_check_ops(struct pinctrl_dev *pctldev)
@@ -89,6 +83,18 @@ static inline void pinmux_disable_setting(
 {
 }
 
+#endif
+
+#if defined(CONFIG_PINMUX) && defined(CONFIG_DEBUG_FS)
+
+void pinmux_show_map(struct seq_file *s, struct pinctrl_map const *map);
+void pinmux_show_setting(struct seq_file *s,
+			 struct pinctrl_setting const *setting);
+void pinmux_init_device_debugfs(struct dentry *devroot,
+				struct pinctrl_dev *pctldev);
+
+#else
+
 static inline void pinmux_show_map(struct seq_file *s,
 				   struct pinctrl_map const *map)
 {
-- 
1.7.0.4


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

* [PATCH 2/2] pinctrl: allow pctldevs to decode pin config in debugfs
  2012-04-11 22:45 [PATCH 1/2] pinctrl: ifdef CONFIG_DEBUG_FS cleanup Stephen Warren
@ 2012-04-11 22:45 ` Stephen Warren
  2012-04-13 12:44   ` Linus Walleij
  2012-04-13 12:42 ` [PATCH 1/2] pinctrl: ifdef CONFIG_DEBUG_FS cleanup Linus Walleij
  1 sibling, 1 reply; 4+ messages in thread
From: Stephen Warren @ 2012-04-11 22:45 UTC (permalink / raw)
  To: Linus Walleij; +Cc: linux-kernel, Stephen Warren

From: Stephen Warren <swarren@nvidia.com>

Add a pinconf op so that pin controller drivers can decode their pin
config settings for debugfs.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
 drivers/pinctrl/pinconf.c       |   31 +++++++++++++++++++++++++++----
 include/linux/pinctrl/pinconf.h |    3 +++
 2 files changed, 30 insertions(+), 4 deletions(-)

diff --git a/drivers/pinctrl/pinconf.c b/drivers/pinctrl/pinconf.c
index eb3a14f..b54e025 100644
--- a/drivers/pinctrl/pinconf.c
+++ b/drivers/pinctrl/pinconf.c
@@ -379,8 +379,16 @@ int pinconf_apply_setting(struct pinctrl_setting const *setting)
 
 void pinconf_show_map(struct seq_file *s, struct pinctrl_map const *map)
 {
+	struct pinctrl_dev *pctldev;
+	const struct pinconf_ops *confops;
 	int i;
 
+	pctldev = get_pinctrl_dev_from_devname(map->ctrl_dev_name);
+	if (pctldev)
+		confops = pctldev->desc->confops;
+	else
+		confops = NULL;
+
 	switch (map->type) {
 	case PIN_MAP_TYPE_CONFIGS_PIN:
 		seq_printf(s, "pin ");
@@ -394,8 +402,15 @@ void pinconf_show_map(struct seq_file *s, struct pinctrl_map const *map)
 
 	seq_printf(s, "%s\n", map->data.configs.group_or_pin);
 
-	for (i = 0; i < map->data.configs.num_configs; i++)
-		seq_printf(s, "config %08lx\n", map->data.configs.configs[i]);
+	for (i = 0; i < map->data.configs.num_configs; i++) {
+		seq_printf(s, "config ");
+		if (confops && confops->pin_config_config_dbg_show)
+			confops->pin_config_config_dbg_show(pctldev, s,
+						map->data.configs.configs[i]);
+		else
+			seq_printf(s, "%08lx", map->data.configs.configs[i]);
+		seq_printf(s, "\n");
+	}
 }
 
 void pinconf_show_setting(struct seq_file *s,
@@ -403,6 +418,7 @@ void pinconf_show_setting(struct seq_file *s,
 {
 	struct pinctrl_dev *pctldev = setting->pctldev;
 	const struct pinctrl_ops *pctlops = pctldev->desc->pctlops;
+	const struct pinconf_ops *confops = pctldev->desc->confops;
 	struct pin_desc *desc;
 	int i;
 
@@ -428,8 +444,15 @@ void pinconf_show_setting(struct seq_file *s,
 	 * FIXME: We should really get the pin controler to dump the config
 	 * values, so they can be decoded to something meaningful.
 	 */
-	for (i = 0; i < setting->data.configs.num_configs; i++)
-		seq_printf(s, " %08lx", setting->data.configs.configs[i]);
+	for (i = 0; i < setting->data.configs.num_configs; i++) {
+		seq_printf(s, " ");
+		if (confops && confops->pin_config_config_dbg_show)
+			confops->pin_config_config_dbg_show(pctldev, s,
+				setting->data.configs.configs[i]);
+		else
+			seq_printf(s, "%08lx",
+				   setting->data.configs.configs[i]);
+	}
 
 	seq_printf(s, "\n");
 }
diff --git a/include/linux/pinctrl/pinconf.h b/include/linux/pinctrl/pinconf.h
index ec431f0..5e37de2 100644
--- a/include/linux/pinctrl/pinconf.h
+++ b/include/linux/pinctrl/pinconf.h
@@ -56,6 +56,9 @@ struct pinconf_ops {
 	void (*pin_config_group_dbg_show) (struct pinctrl_dev *pctldev,
 					   struct seq_file *s,
 					   unsigned selector);
+	void (*pin_config_config_dbg_show) (struct pinctrl_dev *pctldev,
+					    struct seq_file *s,
+					    unsigned long config);
 };
 
 #endif
-- 
1.7.0.4


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

* Re: [PATCH 1/2] pinctrl: ifdef CONFIG_DEBUG_FS cleanup
  2012-04-11 22:45 [PATCH 1/2] pinctrl: ifdef CONFIG_DEBUG_FS cleanup Stephen Warren
  2012-04-11 22:45 ` [PATCH 2/2] pinctrl: allow pctldevs to decode pin config in debugfs Stephen Warren
@ 2012-04-13 12:42 ` Linus Walleij
  1 sibling, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2012-04-13 12:42 UTC (permalink / raw)
  To: Stephen Warren; +Cc: linux-kernel, Stephen Warren

On Thu, Apr 12, 2012 at 12:45 AM, Stephen Warren <swarren@wwwdotorg.org> wrote:

> From: Stephen Warren <swarren@nvidia.com>
>
> Only provide prototypes for pin{mux,conf}.c debugfs-related functions
> when both CONFIG_PIN* /and/ CONFIG_DEBUG_FS are enabled, otherwise
> provide static inlines.
>
> Signed-off-by: Stephen Warren <swarren@nvidia.com>

Applied.

Thanks,
Linus Walleij

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

* Re: [PATCH 2/2] pinctrl: allow pctldevs to decode pin config in debugfs
  2012-04-11 22:45 ` [PATCH 2/2] pinctrl: allow pctldevs to decode pin config in debugfs Stephen Warren
@ 2012-04-13 12:44   ` Linus Walleij
  0 siblings, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2012-04-13 12:44 UTC (permalink / raw)
  To: Stephen Warren; +Cc: linux-kernel, Stephen Warren

On Thu, Apr 12, 2012 at 12:45 AM, Stephen Warren <swarren@wwwdotorg.org> wrote:

> diff --git a/include/linux/pinctrl/pinconf.h b/include/linux/pinctrl/pinconf.h
> index ec431f0..5e37de2 100644
> --- a/include/linux/pinctrl/pinconf.h
> +++ b/include/linux/pinctrl/pinconf.h
> @@ -56,6 +56,9 @@ struct pinconf_ops {
>        void (*pin_config_group_dbg_show) (struct pinctrl_dev *pctldev,
>                                           struct seq_file *s,
>                                           unsigned selector);
> +       void (*pin_config_config_dbg_show) (struct pinctrl_dev *pctldev,
> +                                           struct seq_file *s,
> +                                           unsigned long config);
>  };

Please update the kerneldoc for pinconf_ops and I'll apply.

Yours,
Linus Walleij

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

end of thread, other threads:[~2012-04-13 12:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-11 22:45 [PATCH 1/2] pinctrl: ifdef CONFIG_DEBUG_FS cleanup Stephen Warren
2012-04-11 22:45 ` [PATCH 2/2] pinctrl: allow pctldevs to decode pin config in debugfs Stephen Warren
2012-04-13 12:44   ` Linus Walleij
2012-04-13 12:42 ` [PATCH 1/2] pinctrl: ifdef CONFIG_DEBUG_FS cleanup 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.