aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl/pinconf.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pinctrl/pinconf.c')
-rw-r--r--drivers/pinctrl/pinconf.c42
1 files changed, 35 insertions, 7 deletions
diff --git a/drivers/pinctrl/pinconf.c b/drivers/pinctrl/pinconf.c
index 7321e860129..14f48c96b20 100644
--- a/drivers/pinctrl/pinconf.c
+++ b/drivers/pinctrl/pinconf.c
@@ -379,8 +379,16 @@ int pinconf_apply_setting(struct pinctrl_setting const *setting)
379 379
380void pinconf_show_map(struct seq_file *s, struct pinctrl_map const *map) 380void pinconf_show_map(struct seq_file *s, struct pinctrl_map const *map)
381{ 381{
382 struct pinctrl_dev *pctldev;
383 const struct pinconf_ops *confops;
382 int i; 384 int i;
383 385
386 pctldev = get_pinctrl_dev_from_devname(map->ctrl_dev_name);
387 if (pctldev)
388 confops = pctldev->desc->confops;
389 else
390 confops = NULL;
391
384 switch (map->type) { 392 switch (map->type) {
385 case PIN_MAP_TYPE_CONFIGS_PIN: 393 case PIN_MAP_TYPE_CONFIGS_PIN:
386 seq_printf(s, "pin "); 394 seq_printf(s, "pin ");
@@ -394,8 +402,15 @@ void pinconf_show_map(struct seq_file *s, struct pinctrl_map const *map)
394 402
395 seq_printf(s, "%s\n", map->data.configs.group_or_pin); 403 seq_printf(s, "%s\n", map->data.configs.group_or_pin);
396 404
397 for (i = 0; i < map->data.configs.num_configs; i++) 405 for (i = 0; i < map->data.configs.num_configs; i++) {
398 seq_printf(s, "config %08lx\n", map->data.configs.configs[i]); 406 seq_printf(s, "config ");
407 if (confops && confops->pin_config_config_dbg_show)
408 confops->pin_config_config_dbg_show(pctldev, s,
409 map->data.configs.configs[i]);
410 else
411 seq_printf(s, "%08lx", map->data.configs.configs[i]);
412 seq_printf(s, "\n");
413 }
399} 414}
400 415
401void pinconf_show_setting(struct seq_file *s, 416void pinconf_show_setting(struct seq_file *s,
@@ -403,6 +418,7 @@ void pinconf_show_setting(struct seq_file *s,
403{ 418{
404 struct pinctrl_dev *pctldev = setting->pctldev; 419 struct pinctrl_dev *pctldev = setting->pctldev;
405 const struct pinctrl_ops *pctlops = pctldev->desc->pctlops; 420 const struct pinctrl_ops *pctlops = pctldev->desc->pctlops;
421 const struct pinconf_ops *confops = pctldev->desc->confops;
406 struct pin_desc *desc; 422 struct pin_desc *desc;
407 int i; 423 int i;
408 424
@@ -428,8 +444,15 @@ void pinconf_show_setting(struct seq_file *s,
428 * FIXME: We should really get the pin controler to dump the config 444 * FIXME: We should really get the pin controler to dump the config
429 * values, so they can be decoded to something meaningful. 445 * values, so they can be decoded to something meaningful.
430 */ 446 */
431 for (i = 0; i < setting->data.configs.num_configs; i++) 447 for (i = 0; i < setting->data.configs.num_configs; i++) {
432 seq_printf(s, " %08lx", setting->data.configs.configs[i]); 448 seq_printf(s, " ");
449 if (confops && confops->pin_config_config_dbg_show)
450 confops->pin_config_config_dbg_show(pctldev, s,
451 setting->data.configs.configs[i]);
452 else
453 seq_printf(s, "%08lx",
454 setting->data.configs.configs[i]);
455 }
433 456
434 seq_printf(s, "\n"); 457 seq_printf(s, "\n");
435} 458}
@@ -448,10 +471,14 @@ static void pinconf_dump_pin(struct pinctrl_dev *pctldev,
448static int pinconf_pins_show(struct seq_file *s, void *what) 471static int pinconf_pins_show(struct seq_file *s, void *what)
449{ 472{
450 struct pinctrl_dev *pctldev = s->private; 473 struct pinctrl_dev *pctldev = s->private;
474 const struct pinconf_ops *ops = pctldev->desc->confops;
451 unsigned i, pin; 475 unsigned i, pin;
452 476
477 if (!ops || !ops->pin_config_get)
478 return 0;
479
453 seq_puts(s, "Pin config settings per pin\n"); 480 seq_puts(s, "Pin config settings per pin\n");
454 seq_puts(s, "Format: pin (name): pinmux setting array\n"); 481 seq_puts(s, "Format: pin (name): configs\n");
455 482
456 mutex_lock(&pinctrl_mutex); 483 mutex_lock(&pinctrl_mutex);
457 484
@@ -495,17 +522,18 @@ static int pinconf_groups_show(struct seq_file *s, void *what)
495 struct pinctrl_dev *pctldev = s->private; 522 struct pinctrl_dev *pctldev = s->private;
496 const struct pinctrl_ops *pctlops = pctldev->desc->pctlops; 523 const struct pinctrl_ops *pctlops = pctldev->desc->pctlops;
497 const struct pinconf_ops *ops = pctldev->desc->confops; 524 const struct pinconf_ops *ops = pctldev->desc->confops;
525 unsigned ngroups = pctlops->get_groups_count(pctldev);
498 unsigned selector = 0; 526 unsigned selector = 0;
499 527
500 if (!ops || !ops->pin_config_group_get) 528 if (!ops || !ops->pin_config_group_get)
501 return 0; 529 return 0;
502 530
503 seq_puts(s, "Pin config settings per pin group\n"); 531 seq_puts(s, "Pin config settings per pin group\n");
504 seq_puts(s, "Format: group (name): pinmux setting array\n"); 532 seq_puts(s, "Format: group (name): configs\n");
505 533
506 mutex_lock(&pinctrl_mutex); 534 mutex_lock(&pinctrl_mutex);
507 535
508 while (pctlops->list_groups(pctldev, selector) >= 0) { 536 while (selector < ngroups) {
509 const char *gname = pctlops->get_group_name(pctldev, selector); 537 const char *gname = pctlops->get_group_name(pctldev, selector);
510 538
511 seq_printf(s, "%u (%s):", selector, gname); 539 seq_printf(s, "%u (%s):", selector, gname);