aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-01-30 20:06:26 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-01-30 20:06:26 -0500
commit8e2a2880a5c67988104b6f2d5fafac7b78687a9d (patch)
tree7a9a1263462461825b47ff5af02254fdd5c0cbbb
parent27ba234c8dfe86c96675d4ef275d1d3c1f5f7053 (diff)
parentb9130b776ee481acbc27a7e56d98df75680de369 (diff)
Merge branch 'for-torvalds' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl
Here are some fixes to the pin control system that has accumulated since -rc1. Mainly Tony Lindgren fixed the module load/unload logic and the rest are minor fixes and documentation. * 'for-torvalds' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl: pinctrl: add checks for empty function names pinctrl: fix pinmux_hog_maps when ctrl_dev_name is not set pinctrl: fix some pinmux typos pinctrl: free debugfs entries when unloading a pinmux driver pinctrl: unbreak error messages Documentation/pinctrl: fix a few syntax errors in code examples pinctrl: fix pinconf_pins_show iteration
-rw-r--r--Documentation/pinctrl.txt17
-rw-r--r--drivers/pinctrl/core.c50
-rw-r--r--drivers/pinctrl/core.h3
-rw-r--r--drivers/pinctrl/pinconf.c6
-rw-r--r--drivers/pinctrl/pinconf.h4
-rw-r--r--drivers/pinctrl/pinmux.c81
-rw-r--r--drivers/pinctrl/pinmux.h4
7 files changed, 93 insertions, 72 deletions
diff --git a/Documentation/pinctrl.txt b/Documentation/pinctrl.txt
index 6727b92bc2fb..150fd3833d0b 100644
--- a/Documentation/pinctrl.txt
+++ b/Documentation/pinctrl.txt
@@ -857,42 +857,41 @@ case), we define a mapping like this:
857 857
858... 858...
859{ 859{
860 .name "2bit" 860 .name = "2bit"
861 .ctrl_dev_name = "pinctrl-foo", 861 .ctrl_dev_name = "pinctrl-foo",
862 .function = "mmc0", 862 .function = "mmc0",
863 .group = "mmc0_1_grp", 863 .group = "mmc0_1_grp",
864 .dev_name = "foo-mmc.0", 864 .dev_name = "foo-mmc.0",
865}, 865},
866{ 866{
867 .name "4bit" 867 .name = "4bit"
868 .ctrl_dev_name = "pinctrl-foo", 868 .ctrl_dev_name = "pinctrl-foo",
869 .function = "mmc0", 869 .function = "mmc0",
870 .group = "mmc0_1_grp", 870 .group = "mmc0_1_grp",
871 .dev_name = "foo-mmc.0", 871 .dev_name = "foo-mmc.0",
872}, 872},
873{ 873{
874 .name "4bit" 874 .name = "4bit"
875 .ctrl_dev_name = "pinctrl-foo", 875 .ctrl_dev_name = "pinctrl-foo",
876 .function = "mmc0", 876 .function = "mmc0",
877 .group = "mmc0_2_grp", 877 .group = "mmc0_2_grp",
878 .dev_name = "foo-mmc.0", 878 .dev_name = "foo-mmc.0",
879}, 879},
880{ 880{
881 .name "8bit" 881 .name = "8bit"
882 .ctrl_dev_name = "pinctrl-foo", 882 .ctrl_dev_name = "pinctrl-foo",
883 .function = "mmc0",
884 .group = "mmc0_1_grp", 883 .group = "mmc0_1_grp",
885 .dev_name = "foo-mmc.0", 884 .dev_name = "foo-mmc.0",
886}, 885},
887{ 886{
888 .name "8bit" 887 .name = "8bit"
889 .ctrl_dev_name = "pinctrl-foo", 888 .ctrl_dev_name = "pinctrl-foo",
890 .function = "mmc0", 889 .function = "mmc0",
891 .group = "mmc0_2_grp", 890 .group = "mmc0_2_grp",
892 .dev_name = "foo-mmc.0", 891 .dev_name = "foo-mmc.0",
893}, 892},
894{ 893{
895 .name "8bit" 894 .name = "8bit"
896 .ctrl_dev_name = "pinctrl-foo", 895 .ctrl_dev_name = "pinctrl-foo",
897 .function = "mmc0", 896 .function = "mmc0",
898 .group = "mmc0_3_grp", 897 .group = "mmc0_3_grp",
@@ -995,7 +994,7 @@ This is enabled by simply setting the .hog_on_boot field in the map to true,
995like this: 994like this:
996 995
997{ 996{
998 .name "POWERMAP" 997 .name = "POWERMAP"
999 .ctrl_dev_name = "pinctrl-foo", 998 .ctrl_dev_name = "pinctrl-foo",
1000 .function = "power_func", 999 .function = "power_func",
1001 .hog_on_boot = true, 1000 .hog_on_boot = true,
@@ -1025,7 +1024,7 @@ it, disables and releases it, and muxes it in on the pins defined by group B:
1025 1024
1026foo_switch() 1025foo_switch()
1027{ 1026{
1028 struct pinmux pmx; 1027 struct pinmux *pmx;
1029 1028
1030 /* Enable on position A */ 1029 /* Enable on position A */
1031 pmx = pinmux_get(&device, "spi0-pos-A"); 1030 pmx = pinmux_get(&device, "spi0-pos-A");
diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index 569bdb3ef104..8fe15cf15ac8 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -510,10 +510,12 @@ static struct dentry *debugfs_root;
510 510
511static void pinctrl_init_device_debugfs(struct pinctrl_dev *pctldev) 511static void pinctrl_init_device_debugfs(struct pinctrl_dev *pctldev)
512{ 512{
513 static struct dentry *device_root; 513 struct dentry *device_root;
514 514
515 device_root = debugfs_create_dir(dev_name(pctldev->dev), 515 device_root = debugfs_create_dir(dev_name(pctldev->dev),
516 debugfs_root); 516 debugfs_root);
517 pctldev->device_root = device_root;
518
517 if (IS_ERR(device_root) || !device_root) { 519 if (IS_ERR(device_root) || !device_root) {
518 pr_warn("failed to create debugfs directory for %s\n", 520 pr_warn("failed to create debugfs directory for %s\n",
519 dev_name(pctldev->dev)); 521 dev_name(pctldev->dev));
@@ -529,6 +531,11 @@ static void pinctrl_init_device_debugfs(struct pinctrl_dev *pctldev)
529 pinconf_init_device_debugfs(device_root, pctldev); 531 pinconf_init_device_debugfs(device_root, pctldev);
530} 532}
531 533
534static void pinctrl_remove_device_debugfs(struct pinctrl_dev *pctldev)
535{
536 debugfs_remove_recursive(pctldev->device_root);
537}
538
532static void pinctrl_init_debugfs(void) 539static void pinctrl_init_debugfs(void)
533{ 540{
534 debugfs_root = debugfs_create_dir("pinctrl", NULL); 541 debugfs_root = debugfs_create_dir("pinctrl", NULL);
@@ -553,6 +560,10 @@ static void pinctrl_init_debugfs(void)
553{ 560{
554} 561}
555 562
563static void pinctrl_remove_device_debugfs(struct pinctrl_dev *pctldev)
564{
565}
566
556#endif 567#endif
557 568
558/** 569/**
@@ -572,40 +583,40 @@ struct pinctrl_dev *pinctrl_register(struct pinctrl_desc *pctldesc,
572 if (pctldesc->name == NULL) 583 if (pctldesc->name == NULL)
573 return NULL; 584 return NULL;
574 585
586 pctldev = kzalloc(sizeof(struct pinctrl_dev), GFP_KERNEL);
587 if (pctldev == NULL)
588 return NULL;
589
590 /* Initialize pin control device struct */
591 pctldev->owner = pctldesc->owner;
592 pctldev->desc = pctldesc;
593 pctldev->driver_data = driver_data;
594 INIT_RADIX_TREE(&pctldev->pin_desc_tree, GFP_KERNEL);
595 spin_lock_init(&pctldev->pin_desc_tree_lock);
596 INIT_LIST_HEAD(&pctldev->gpio_ranges);
597 mutex_init(&pctldev->gpio_ranges_lock);
598 pctldev->dev = dev;
599
575 /* If we're implementing pinmuxing, check the ops for sanity */ 600 /* If we're implementing pinmuxing, check the ops for sanity */
576 if (pctldesc->pmxops) { 601 if (pctldesc->pmxops) {
577 ret = pinmux_check_ops(pctldesc->pmxops); 602 ret = pinmux_check_ops(pctldev);
578 if (ret) { 603 if (ret) {
579 pr_err("%s pinmux ops lacks necessary functions\n", 604 pr_err("%s pinmux ops lacks necessary functions\n",
580 pctldesc->name); 605 pctldesc->name);
581 return NULL; 606 goto out_err;
582 } 607 }
583 } 608 }
584 609
585 /* If we're implementing pinconfig, check the ops for sanity */ 610 /* If we're implementing pinconfig, check the ops for sanity */
586 if (pctldesc->confops) { 611 if (pctldesc->confops) {
587 ret = pinconf_check_ops(pctldesc->confops); 612 ret = pinconf_check_ops(pctldev);
588 if (ret) { 613 if (ret) {
589 pr_err("%s pin config ops lacks necessary functions\n", 614 pr_err("%s pin config ops lacks necessary functions\n",
590 pctldesc->name); 615 pctldesc->name);
591 return NULL; 616 goto out_err;
592 } 617 }
593 } 618 }
594 619
595 pctldev = kzalloc(sizeof(struct pinctrl_dev), GFP_KERNEL);
596 if (pctldev == NULL)
597 return NULL;
598
599 /* Initialize pin control device struct */
600 pctldev->owner = pctldesc->owner;
601 pctldev->desc = pctldesc;
602 pctldev->driver_data = driver_data;
603 INIT_RADIX_TREE(&pctldev->pin_desc_tree, GFP_KERNEL);
604 spin_lock_init(&pctldev->pin_desc_tree_lock);
605 INIT_LIST_HEAD(&pctldev->gpio_ranges);
606 mutex_init(&pctldev->gpio_ranges_lock);
607 pctldev->dev = dev;
608
609 /* Register all the pins */ 620 /* Register all the pins */
610 pr_debug("try to register %d pins on %s...\n", 621 pr_debug("try to register %d pins on %s...\n",
611 pctldesc->npins, pctldesc->name); 622 pctldesc->npins, pctldesc->name);
@@ -641,6 +652,7 @@ void pinctrl_unregister(struct pinctrl_dev *pctldev)
641 if (pctldev == NULL) 652 if (pctldev == NULL)
642 return; 653 return;
643 654
655 pinctrl_remove_device_debugfs(pctldev);
644 pinmux_unhog_maps(pctldev); 656 pinmux_unhog_maps(pctldev);
645 /* TODO: check that no pinmuxes are still active? */ 657 /* TODO: check that no pinmuxes are still active? */
646 mutex_lock(&pinctrldev_list_mutex); 658 mutex_lock(&pinctrldev_list_mutex);
diff --git a/drivers/pinctrl/core.h b/drivers/pinctrl/core.h
index 177a3310547f..cfa86da6b4b1 100644
--- a/drivers/pinctrl/core.h
+++ b/drivers/pinctrl/core.h
@@ -41,6 +41,9 @@ struct pinctrl_dev {
41 struct device *dev; 41 struct device *dev;
42 struct module *owner; 42 struct module *owner;
43 void *driver_data; 43 void *driver_data;
44#ifdef CONFIG_DEBUG_FS
45 struct dentry *device_root;
46#endif
44#ifdef CONFIG_PINMUX 47#ifdef CONFIG_PINMUX
45 struct mutex pinmux_hogs_lock; 48 struct mutex pinmux_hogs_lock;
46 struct list_head pinmux_hogs; 49 struct list_head pinmux_hogs;
diff --git a/drivers/pinctrl/pinconf.c b/drivers/pinctrl/pinconf.c
index 1259872b0a1d..9fb75456824c 100644
--- a/drivers/pinctrl/pinconf.c
+++ b/drivers/pinctrl/pinconf.c
@@ -205,8 +205,10 @@ int pin_config_group_set(const char *dev_name, const char *pin_group,
205} 205}
206EXPORT_SYMBOL(pin_config_group_set); 206EXPORT_SYMBOL(pin_config_group_set);
207 207
208int pinconf_check_ops(const struct pinconf_ops *ops) 208int pinconf_check_ops(struct pinctrl_dev *pctldev)
209{ 209{
210 const struct pinconf_ops *ops = pctldev->desc->confops;
211
210 /* We must be able to read out pin status */ 212 /* We must be able to read out pin status */
211 if (!ops->pin_config_get && !ops->pin_config_group_get) 213 if (!ops->pin_config_get && !ops->pin_config_group_get)
212 return -EINVAL; 214 return -EINVAL;
@@ -236,7 +238,7 @@ static int pinconf_pins_show(struct seq_file *s, void *what)
236 seq_puts(s, "Format: pin (name): pinmux setting array\n"); 238 seq_puts(s, "Format: pin (name): pinmux setting array\n");
237 239
238 /* The pin number can be retrived from the pin controller descriptor */ 240 /* The pin number can be retrived from the pin controller descriptor */
239 for (i = 0; pin < pctldev->desc->npins; i++) { 241 for (i = 0; i < pctldev->desc->npins; i++) {
240 struct pin_desc *desc; 242 struct pin_desc *desc;
241 243
242 pin = pctldev->desc->pins[i].number; 244 pin = pctldev->desc->pins[i].number;
diff --git a/drivers/pinctrl/pinconf.h b/drivers/pinctrl/pinconf.h
index e7dc6165032a..006b77fa737e 100644
--- a/drivers/pinctrl/pinconf.h
+++ b/drivers/pinctrl/pinconf.h
@@ -13,7 +13,7 @@
13 13
14#ifdef CONFIG_PINCONF 14#ifdef CONFIG_PINCONF
15 15
16int pinconf_check_ops(const struct pinconf_ops *ops); 16int pinconf_check_ops(struct pinctrl_dev *pctldev);
17void pinconf_init_device_debugfs(struct dentry *devroot, 17void pinconf_init_device_debugfs(struct dentry *devroot,
18 struct pinctrl_dev *pctldev); 18 struct pinctrl_dev *pctldev);
19int pin_config_get_for_pin(struct pinctrl_dev *pctldev, unsigned pin, 19int pin_config_get_for_pin(struct pinctrl_dev *pctldev, unsigned pin,
@@ -23,7 +23,7 @@ int pin_config_set_for_pin(struct pinctrl_dev *pctldev, unsigned pin,
23 23
24#else 24#else
25 25
26static inline int pinconf_check_ops(const struct pinconf_ops *ops) 26static inline int pinconf_check_ops(struct pinctrl_dev *pctldev)
27{ 27{
28 return 0; 28 return 0;
29} 29}
diff --git a/drivers/pinctrl/pinmux.c b/drivers/pinctrl/pinmux.c
index a76a348321bb..7c3193f7a044 100644
--- a/drivers/pinctrl/pinmux.c
+++ b/drivers/pinctrl/pinmux.c
@@ -53,11 +53,6 @@ struct pinmux_group {
53 * @dev: the device using this pinmux 53 * @dev: the device using this pinmux
54 * @usecount: the number of active users of this mux setting, used to keep 54 * @usecount: the number of active users of this mux setting, used to keep
55 * track of nested use cases 55 * track of nested use cases
56 * @pins: an array of discrete physical pins used in this mapping, taken
57 * from the global pin enumeration space (copied from pinmux map)
58 * @num_pins: the number of pins in this mapping array, i.e. the number of
59 * elements in .pins so we can iterate over that array (copied from
60 * pinmux map)
61 * @pctldev: pin control device handling this pinmux 56 * @pctldev: pin control device handling this pinmux
62 * @func_selector: the function selector for the pinmux device handling 57 * @func_selector: the function selector for the pinmux device handling
63 * this pinmux 58 * this pinmux
@@ -152,8 +147,7 @@ static int pin_request(struct pinctrl_dev *pctldev,
152 status = 0; 147 status = 0;
153 148
154 if (status) 149 if (status)
155 dev_err(pctldev->dev, "->request on device %s failed " 150 dev_err(pctldev->dev, "->request on device %s failed for pin %d\n",
156 "for pin %d\n",
157 pctldev->desc->name, pin); 151 pctldev->desc->name, pin);
158out_free_pin: 152out_free_pin:
159 if (status) { 153 if (status) {
@@ -355,21 +349,20 @@ int __init pinmux_register_mappings(struct pinmux_map const *maps,
355 /* First sanity check the new mapping */ 349 /* First sanity check the new mapping */
356 for (i = 0; i < num_maps; i++) { 350 for (i = 0; i < num_maps; i++) {
357 if (!maps[i].name) { 351 if (!maps[i].name) {
358 pr_err("failed to register map %d: " 352 pr_err("failed to register map %d: no map name given\n",
359 "no map name given\n", i); 353 i);
360 return -EINVAL; 354 return -EINVAL;
361 } 355 }
362 356
363 if (!maps[i].ctrl_dev && !maps[i].ctrl_dev_name) { 357 if (!maps[i].ctrl_dev && !maps[i].ctrl_dev_name) {
364 pr_err("failed to register map %s (%d): " 358 pr_err("failed to register map %s (%d): no pin control device given\n",
365 "no pin control device given\n",
366 maps[i].name, i); 359 maps[i].name, i);
367 return -EINVAL; 360 return -EINVAL;
368 } 361 }
369 362
370 if (!maps[i].function) { 363 if (!maps[i].function) {
371 pr_err("failed to register map %s (%d): " 364 pr_err("failed to register map %s (%d): no function ID given\n",
372 "no function ID given\n", maps[i].name, i); 365 maps[i].name, i);
373 return -EINVAL; 366 return -EINVAL;
374 } 367 }
375 368
@@ -411,7 +404,7 @@ int __init pinmux_register_mappings(struct pinmux_map const *maps,
411} 404}
412 405
413/** 406/**
414 * acquire_pins() - acquire all the pins for a certain funcion on a pinmux 407 * acquire_pins() - acquire all the pins for a certain function on a pinmux
415 * @pctldev: the device to take the pins on 408 * @pctldev: the device to take the pins on
416 * @func_selector: the function selector to acquire the pins for 409 * @func_selector: the function selector to acquire the pins for
417 * @group_selector: the group selector containing the pins to acquire 410 * @group_selector: the group selector containing the pins to acquire
@@ -442,8 +435,7 @@ static int acquire_pins(struct pinctrl_dev *pctldev,
442 ret = pin_request(pctldev, pins[i], func, NULL); 435 ret = pin_request(pctldev, pins[i], func, NULL);
443 if (ret) { 436 if (ret) {
444 dev_err(pctldev->dev, 437 dev_err(pctldev->dev,
445 "could not get pin %d for function %s " 438 "could not get pin %d for function %s on device %s - conflicting mux mappings?\n",
446 "on device %s - conflicting mux mappings?\n",
447 pins[i], func ? : "(undefined)", 439 pins[i], func ? : "(undefined)",
448 pinctrl_dev_get_name(pctldev)); 440 pinctrl_dev_get_name(pctldev));
449 /* On error release all taken pins */ 441 /* On error release all taken pins */
@@ -458,7 +450,7 @@ static int acquire_pins(struct pinctrl_dev *pctldev,
458 450
459/** 451/**
460 * release_pins() - release pins taken by earlier acquirement 452 * release_pins() - release pins taken by earlier acquirement
461 * @pctldev: the device to free the pinx on 453 * @pctldev: the device to free the pins on
462 * @group_selector: the group selector containing the pins to free 454 * @group_selector: the group selector containing the pins to free
463 */ 455 */
464static void release_pins(struct pinctrl_dev *pctldev, 456static void release_pins(struct pinctrl_dev *pctldev,
@@ -473,8 +465,7 @@ static void release_pins(struct pinctrl_dev *pctldev,
473 ret = pctlops->get_group_pins(pctldev, group_selector, 465 ret = pctlops->get_group_pins(pctldev, group_selector,
474 &pins, &num_pins); 466 &pins, &num_pins);
475 if (ret) { 467 if (ret) {
476 dev_err(pctldev->dev, "could not get pins to release for " 468 dev_err(pctldev->dev, "could not get pins to release for group selector %d\n",
477 "group selector %d\n",
478 group_selector); 469 group_selector);
479 return; 470 return;
480 } 471 }
@@ -526,8 +517,7 @@ static int pinmux_check_pin_group(struct pinctrl_dev *pctldev,
526 ret = pinctrl_get_group_selector(pctldev, groups[0]); 517 ret = pinctrl_get_group_selector(pctldev, groups[0]);
527 if (ret < 0) { 518 if (ret < 0) {
528 dev_err(pctldev->dev, 519 dev_err(pctldev->dev,
529 "function %s wants group %s but the pin " 520 "function %s wants group %s but the pin controller does not seem to have that group\n",
530 "controller does not seem to have that group\n",
531 pmxops->get_function_name(pctldev, func_selector), 521 pmxops->get_function_name(pctldev, func_selector),
532 groups[0]); 522 groups[0]);
533 return ret; 523 return ret;
@@ -535,8 +525,7 @@ static int pinmux_check_pin_group(struct pinctrl_dev *pctldev,
535 525
536 if (num_groups > 1) 526 if (num_groups > 1)
537 dev_dbg(pctldev->dev, 527 dev_dbg(pctldev->dev,
538 "function %s support more than one group, " 528 "function %s support more than one group, default-selecting first group %s (%d)\n",
539 "default-selecting first group %s (%d)\n",
540 pmxops->get_function_name(pctldev, func_selector), 529 pmxops->get_function_name(pctldev, func_selector),
541 groups[0], 530 groups[0],
542 ret); 531 ret);
@@ -628,10 +617,8 @@ static int pinmux_enable_muxmap(struct pinctrl_dev *pctldev,
628 617
629 if (pmx->pctldev && pmx->pctldev != pctldev) { 618 if (pmx->pctldev && pmx->pctldev != pctldev) {
630 dev_err(pctldev->dev, 619 dev_err(pctldev->dev,
631 "different pin control devices given for device %s, " 620 "different pin control devices given for device %s, function %s\n",
632 "function %s\n", 621 devname, map->function);
633 devname,
634 map->function);
635 return -EINVAL; 622 return -EINVAL;
636 } 623 }
637 pmx->dev = dev; 624 pmx->dev = dev;
@@ -695,7 +682,6 @@ static void pinmux_free_groups(struct pinmux *pmx)
695 */ 682 */
696struct pinmux *pinmux_get(struct device *dev, const char *name) 683struct pinmux *pinmux_get(struct device *dev, const char *name)
697{ 684{
698
699 struct pinmux_map const *map = NULL; 685 struct pinmux_map const *map = NULL;
700 struct pinctrl_dev *pctldev = NULL; 686 struct pinctrl_dev *pctldev = NULL;
701 const char *devname = NULL; 687 const char *devname = NULL;
@@ -745,8 +731,7 @@ struct pinmux *pinmux_get(struct device *dev, const char *name)
745 else if (map->ctrl_dev_name) 731 else if (map->ctrl_dev_name)
746 devname = map->ctrl_dev_name; 732 devname = map->ctrl_dev_name;
747 733
748 pr_warning("could not find a pinctrl device for pinmux " 734 pr_warning("could not find a pinctrl device for pinmux function %s, fishy, they shall all have one\n",
749 "function %s, fishy, they shall all have one\n",
750 map->function); 735 map->function);
751 pr_warning("given pinctrl device name: %s", 736 pr_warning("given pinctrl device name: %s",
752 devname ? devname : "UNDEFINED"); 737 devname ? devname : "UNDEFINED");
@@ -904,8 +889,11 @@ void pinmux_disable(struct pinmux *pmx)
904} 889}
905EXPORT_SYMBOL_GPL(pinmux_disable); 890EXPORT_SYMBOL_GPL(pinmux_disable);
906 891
907int pinmux_check_ops(const struct pinmux_ops *ops) 892int pinmux_check_ops(struct pinctrl_dev *pctldev)
908{ 893{
894 const struct pinmux_ops *ops = pctldev->desc->pmxops;
895 unsigned selector = 0;
896
909 /* Check that we implement required operations */ 897 /* Check that we implement required operations */
910 if (!ops->list_functions || 898 if (!ops->list_functions ||
911 !ops->get_function_name || 899 !ops->get_function_name ||
@@ -914,6 +902,18 @@ int pinmux_check_ops(const struct pinmux_ops *ops)
914 !ops->disable) 902 !ops->disable)
915 return -EINVAL; 903 return -EINVAL;
916 904
905 /* Check that all functions registered have names */
906 while (ops->list_functions(pctldev, selector) >= 0) {
907 const char *fname = ops->get_function_name(pctldev,
908 selector);
909 if (!fname) {
910 pr_err("pinmux ops has no name for function%u\n",
911 selector);
912 return -EINVAL;
913 }
914 selector++;
915 }
916
917 return 0; 917 return 0;
918} 918}
919 919
@@ -932,8 +932,8 @@ static int pinmux_hog_map(struct pinctrl_dev *pctldev,
932 * without any problems, so then we can hog pinmuxes for 932 * without any problems, so then we can hog pinmuxes for
933 * all devices that just want a static pin mux at this point. 933 * all devices that just want a static pin mux at this point.
934 */ 934 */
935 dev_err(pctldev->dev, "map %s wants to hog a non-system " 935 dev_err(pctldev->dev, "map %s wants to hog a non-system pinmux, this is not going to work\n",
936 "pinmux, this is not going to work\n", map->name); 936 map->name);
937 return -EINVAL; 937 return -EINVAL;
938 } 938 }
939 939
@@ -993,9 +993,12 @@ int pinmux_hog_maps(struct pinctrl_dev *pctldev)
993 for (i = 0; i < pinmux_maps_num; i++) { 993 for (i = 0; i < pinmux_maps_num; i++) {
994 struct pinmux_map const *map = &pinmux_maps[i]; 994 struct pinmux_map const *map = &pinmux_maps[i];
995 995
996 if (((map->ctrl_dev == dev) || 996 if (!map->hog_on_boot)
997 !strcmp(map->ctrl_dev_name, devname)) && 997 continue;
998 map->hog_on_boot) { 998
999 if ((map->ctrl_dev == dev) ||
1000 (map->ctrl_dev_name &&
1001 !strcmp(map->ctrl_dev_name, devname))) {
999 /* OK time to hog! */ 1002 /* OK time to hog! */
1000 ret = pinmux_hog_map(pctldev, map); 1003 ret = pinmux_hog_map(pctldev, map);
1001 if (ret) 1004 if (ret)
@@ -1122,13 +1125,15 @@ static int pinmux_show(struct seq_file *s, void *what)
1122 1125
1123 seq_printf(s, "device: %s function: %s (%u),", 1126 seq_printf(s, "device: %s function: %s (%u),",
1124 pinctrl_dev_get_name(pmx->pctldev), 1127 pinctrl_dev_get_name(pmx->pctldev),
1125 pmxops->get_function_name(pctldev, pmx->func_selector), 1128 pmxops->get_function_name(pctldev,
1129 pmx->func_selector),
1126 pmx->func_selector); 1130 pmx->func_selector);
1127 1131
1128 seq_printf(s, " groups: ["); 1132 seq_printf(s, " groups: [");
1129 list_for_each_entry(grp, &pmx->groups, node) { 1133 list_for_each_entry(grp, &pmx->groups, node) {
1130 seq_printf(s, " %s (%u)", 1134 seq_printf(s, " %s (%u)",
1131 pctlops->get_group_name(pctldev, grp->group_selector), 1135 pctlops->get_group_name(pctldev,
1136 grp->group_selector),
1132 grp->group_selector); 1137 grp->group_selector);
1133 } 1138 }
1134 seq_printf(s, " ]"); 1139 seq_printf(s, " ]");
diff --git a/drivers/pinctrl/pinmux.h b/drivers/pinctrl/pinmux.h
index 844500b3331b..97f52223fbc2 100644
--- a/drivers/pinctrl/pinmux.h
+++ b/drivers/pinctrl/pinmux.h
@@ -12,7 +12,7 @@
12 */ 12 */
13#ifdef CONFIG_PINMUX 13#ifdef CONFIG_PINMUX
14 14
15int pinmux_check_ops(const struct pinmux_ops *ops); 15int pinmux_check_ops(struct pinctrl_dev *pctldev);
16void pinmux_init_device_debugfs(struct dentry *devroot, 16void pinmux_init_device_debugfs(struct dentry *devroot,
17 struct pinctrl_dev *pctldev); 17 struct pinctrl_dev *pctldev);
18void pinmux_init_debugfs(struct dentry *subsys_root); 18void pinmux_init_debugfs(struct dentry *subsys_root);
@@ -21,7 +21,7 @@ void pinmux_unhog_maps(struct pinctrl_dev *pctldev);
21 21
22#else 22#else
23 23
24static inline int pinmux_check_ops(const struct pinmux_ops *ops) 24static inline int pinmux_check_ops(struct pinctrl_dev *pctldev)
25{ 25{
26 return 0; 26 return 0;
27} 27}