summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Warren <swarren@nvidia.com>2012-02-23 19:04:39 -0500
committerLinus Walleij <linus.walleij@linaro.org>2012-02-29 13:10:55 -0500
commit806d314325812fb8ffe7059bd84a23d334350c21 (patch)
treece904d5ddab97e25b71b547f7b20844d507b9529
parent1cf94c45ca31c0ad563e72b095782346cba26b6c (diff)
pinctrl: re-order struct pinctrl_map
The lookup key in struct pinctrl_map is (.dev_name, .name). Re-order the struct definition to put the lookup key fields first, and the result values afterwards. To me at least, this slightly better reflects the lookup process. Update the documentation in a similar fashion. Note: PIN_MAP*() macros aren't updated; I plan to update this once later when enhancing the mapping table format to support pin config to reduce churn. Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Dong Aisheng <dong.aisheng@linaro.org> [Rebased for cherry-picking] Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r--Documentation/pinctrl.txt24
-rw-r--r--include/linux/pinctrl/machine.h10
2 files changed, 17 insertions, 17 deletions
diff --git a/Documentation/pinctrl.txt b/Documentation/pinctrl.txt
index fa9163af34f6..5e314cecab77 100644
--- a/Documentation/pinctrl.txt
+++ b/Documentation/pinctrl.txt
@@ -781,19 +781,19 @@ spi on the second function mapping:
781 781
782static const struct pinctrl_map __initdata mapping[] = { 782static const struct pinctrl_map __initdata mapping[] = {
783 { 783 {
784 .dev_name = "foo-spi.0",
784 .ctrl_dev_name = "pinctrl-foo", 785 .ctrl_dev_name = "pinctrl-foo",
785 .function = "spi0", 786 .function = "spi0",
786 .dev_name = "foo-spi.0",
787 }, 787 },
788 { 788 {
789 .dev_name = "foo-i2c.0",
789 .ctrl_dev_name = "pinctrl-foo", 790 .ctrl_dev_name = "pinctrl-foo",
790 .function = "i2c0", 791 .function = "i2c0",
791 .dev_name = "foo-i2c.0",
792 }, 792 },
793 { 793 {
794 .dev_name = "foo-mmc.0",
794 .ctrl_dev_name = "pinctrl-foo", 795 .ctrl_dev_name = "pinctrl-foo",
795 .function = "mmc0", 796 .function = "mmc0",
796 .dev_name = "foo-mmc.0",
797 }, 797 },
798}; 798};
799 799
@@ -826,18 +826,18 @@ As it is possible to map a function to different groups of pins an optional
826 826
827... 827...
828{ 828{
829 .dev_name = "foo-spi.0",
829 .name = "spi0-pos-A", 830 .name = "spi0-pos-A",
830 .ctrl_dev_name = "pinctrl-foo", 831 .ctrl_dev_name = "pinctrl-foo",
831 .function = "spi0", 832 .function = "spi0",
832 .group = "spi0_0_grp", 833 .group = "spi0_0_grp",
833 .dev_name = "foo-spi.0",
834}, 834},
835{ 835{
836 .dev_name = "foo-spi.0",
836 .name = "spi0-pos-B", 837 .name = "spi0-pos-B",
837 .ctrl_dev_name = "pinctrl-foo", 838 .ctrl_dev_name = "pinctrl-foo",
838 .function = "spi0", 839 .function = "spi0",
839 .group = "spi0_1_grp", 840 .group = "spi0_1_grp",
840 .dev_name = "foo-spi.0",
841}, 841},
842... 842...
843 843
@@ -852,45 +852,45 @@ case), we define a mapping like this:
852 852
853... 853...
854{ 854{
855 .dev_name = "foo-mmc.0",
855 .name = "2bit" 856 .name = "2bit"
856 .ctrl_dev_name = "pinctrl-foo", 857 .ctrl_dev_name = "pinctrl-foo",
857 .function = "mmc0", 858 .function = "mmc0",
858 .group = "mmc0_1_grp", 859 .group = "mmc0_1_grp",
859 .dev_name = "foo-mmc.0",
860}, 860},
861{ 861{
862 .dev_name = "foo-mmc.0",
862 .name = "4bit" 863 .name = "4bit"
863 .ctrl_dev_name = "pinctrl-foo", 864 .ctrl_dev_name = "pinctrl-foo",
864 .function = "mmc0", 865 .function = "mmc0",
865 .group = "mmc0_1_grp", 866 .group = "mmc0_1_grp",
866 .dev_name = "foo-mmc.0",
867}, 867},
868{ 868{
869 .dev_name = "foo-mmc.0",
869 .name = "4bit" 870 .name = "4bit"
870 .ctrl_dev_name = "pinctrl-foo", 871 .ctrl_dev_name = "pinctrl-foo",
871 .function = "mmc0", 872 .function = "mmc0",
872 .group = "mmc0_2_grp", 873 .group = "mmc0_2_grp",
873 .dev_name = "foo-mmc.0",
874}, 874},
875{ 875{
876 .dev_name = "foo-mmc.0",
876 .name = "8bit" 877 .name = "8bit"
877 .ctrl_dev_name = "pinctrl-foo", 878 .ctrl_dev_name = "pinctrl-foo",
878 .group = "mmc0_1_grp", 879 .group = "mmc0_1_grp",
879 .dev_name = "foo-mmc.0",
880}, 880},
881{ 881{
882 .dev_name = "foo-mmc.0",
882 .name = "8bit" 883 .name = "8bit"
883 .ctrl_dev_name = "pinctrl-foo", 884 .ctrl_dev_name = "pinctrl-foo",
884 .function = "mmc0", 885 .function = "mmc0",
885 .group = "mmc0_2_grp", 886 .group = "mmc0_2_grp",
886 .dev_name = "foo-mmc.0",
887}, 887},
888{ 888{
889 .dev_name = "foo-mmc.0",
889 .name = "8bit" 890 .name = "8bit"
890 .ctrl_dev_name = "pinctrl-foo", 891 .ctrl_dev_name = "pinctrl-foo",
891 .function = "mmc0", 892 .function = "mmc0",
892 .group = "mmc0_3_grp", 893 .group = "mmc0_3_grp",
893 .dev_name = "foo-mmc.0",
894}, 894},
895... 895...
896 896
@@ -988,10 +988,10 @@ This is enabled by simply setting the .dev_name field in the map to the name
988of the pin controller itself, like this: 988of the pin controller itself, like this:
989 989
990{ 990{
991 .dev_name = "pinctrl-foo",
991 .name = "POWERMAP" 992 .name = "POWERMAP"
992 .ctrl_dev_name = "pinctrl-foo", 993 .ctrl_dev_name = "pinctrl-foo",
993 .function = "power_func", 994 .function = "power_func",
994 .dev_name = "pinctrl-foo",
995}, 995},
996 996
997Since it may be common to request the core to hog a few always-applicable 997Since it may be common to request the core to hog a few always-applicable
diff --git a/include/linux/pinctrl/machine.h b/include/linux/pinctrl/machine.h
index 400f1926b234..73fbb2745301 100644
--- a/include/linux/pinctrl/machine.h
+++ b/include/linux/pinctrl/machine.h
@@ -14,6 +14,10 @@
14 14
15/** 15/**
16 * struct pinctrl_map - boards/machines shall provide this map for devices 16 * struct pinctrl_map - boards/machines shall provide this map for devices
17 * @dev_name: the name of the device using this specific mapping, the name
18 * must be the same as in your struct device*. If this name is set to the
19 * same name as the pin controllers own dev_name(), the map entry will be
20 * hogged by the driver itself upon registration
17 * @name: the name of this specific map entry for the particular machine. 21 * @name: the name of this specific map entry for the particular machine.
18 * This is the second parameter passed to pinmux_get() when you want 22 * This is the second parameter passed to pinmux_get() when you want
19 * to have several mappings to the same device 23 * to have several mappings to the same device
@@ -25,17 +29,13 @@
25 * @group: sometimes a function can map to different pin groups, so this 29 * @group: sometimes a function can map to different pin groups, so this
26 * selects a certain specific pin group to activate for the function, if 30 * selects a certain specific pin group to activate for the function, if
27 * left as NULL, the first applicable group will be used 31 * left as NULL, the first applicable group will be used
28 * @dev_name: the name of the device using this specific mapping, the name
29 * must be the same as in your struct device*. If this name is set to the
30 * same name as the pin controllers own dev_name(), the map entry will be
31 * hogged by the driver itself upon registration
32 */ 32 */
33struct pinctrl_map { 33struct pinctrl_map {
34 const char *dev_name;
34 const char *name; 35 const char *name;
35 const char *ctrl_dev_name; 36 const char *ctrl_dev_name;
36 const char *function; 37 const char *function;
37 const char *group; 38 const char *group;
38 const char *dev_name;
39}; 39};
40 40
41/* 41/*