Commit 6cb41587 authored by Stephen Warren's avatar Stephen Warren Committed by Linus Walleij

pinctrl: allow pctldevs to decode pin config in debugfs

Add a pinconf op so that pin controller drivers can decode their pin
config settings for debugfs.
Signed-off-by: default avatarStephen Warren <swarren@nvidia.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent c736d73c
...@@ -379,8 +379,16 @@ int pinconf_apply_setting(struct pinctrl_setting const *setting) ...@@ -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) void pinconf_show_map(struct seq_file *s, struct pinctrl_map const *map)
{ {
struct pinctrl_dev *pctldev;
const struct pinconf_ops *confops;
int i; int i;
pctldev = get_pinctrl_dev_from_devname(map->ctrl_dev_name);
if (pctldev)
confops = pctldev->desc->confops;
else
confops = NULL;
switch (map->type) { switch (map->type) {
case PIN_MAP_TYPE_CONFIGS_PIN: case PIN_MAP_TYPE_CONFIGS_PIN:
seq_printf(s, "pin "); seq_printf(s, "pin ");
...@@ -394,8 +402,15 @@ void pinconf_show_map(struct seq_file *s, struct pinctrl_map const *map) ...@@ -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); seq_printf(s, "%s\n", map->data.configs.group_or_pin);
for (i = 0; i < map->data.configs.num_configs; i++) for (i = 0; i < map->data.configs.num_configs; i++) {
seq_printf(s, "config %08lx\n", map->data.configs.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, void pinconf_show_setting(struct seq_file *s,
...@@ -403,6 +418,7 @@ 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; struct pinctrl_dev *pctldev = setting->pctldev;
const struct pinctrl_ops *pctlops = pctldev->desc->pctlops; const struct pinctrl_ops *pctlops = pctldev->desc->pctlops;
const struct pinconf_ops *confops = pctldev->desc->confops;
struct pin_desc *desc; struct pin_desc *desc;
int i; int i;
...@@ -428,8 +444,15 @@ void pinconf_show_setting(struct seq_file *s, ...@@ -428,8 +444,15 @@ void pinconf_show_setting(struct seq_file *s,
* FIXME: We should really get the pin controler to dump the config * FIXME: We should really get the pin controler to dump the config
* values, so they can be decoded to something meaningful. * values, so they can be decoded to something meaningful.
*/ */
for (i = 0; i < setting->data.configs.num_configs; i++) for (i = 0; i < setting->data.configs.num_configs; i++) {
seq_printf(s, " %08lx", setting->data.configs.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"); seq_printf(s, "\n");
} }
......
...@@ -33,6 +33,8 @@ struct seq_file; ...@@ -33,6 +33,8 @@ struct seq_file;
* per-device info for a certain pin in debugfs * per-device info for a certain pin in debugfs
* @pin_config_group_dbg_show: optional debugfs display hook that will provide * @pin_config_group_dbg_show: optional debugfs display hook that will provide
* per-device info for a certain group in debugfs * per-device info for a certain group in debugfs
* @pin_config_config_dbg_show: optional debugfs display hook that will decode
* and display a driver's pin configuration parameter
*/ */
struct pinconf_ops { struct pinconf_ops {
#ifdef CONFIG_GENERIC_PINCONF #ifdef CONFIG_GENERIC_PINCONF
...@@ -56,6 +58,9 @@ struct pinconf_ops { ...@@ -56,6 +58,9 @@ struct pinconf_ops {
void (*pin_config_group_dbg_show) (struct pinctrl_dev *pctldev, void (*pin_config_group_dbg_show) (struct pinctrl_dev *pctldev,
struct seq_file *s, struct seq_file *s,
unsigned selector); unsigned selector);
void (*pin_config_config_dbg_show) (struct pinctrl_dev *pctldev,
struct seq_file *s,
unsigned long config);
}; };
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment