diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/pinctrl/pinconf.h | 96 | ||||
-rw-r--r-- | include/linux/pinctrl/pinctrl.h | 8 |
2 files changed, 102 insertions, 2 deletions
diff --git a/include/linux/pinctrl/pinconf.h b/include/linux/pinctrl/pinconf.h new file mode 100644 index 000000000000..d5b72e6e261d --- /dev/null +++ b/include/linux/pinctrl/pinconf.h | |||
@@ -0,0 +1,96 @@ | |||
1 | /* | ||
2 | * Interface the pinconfig portions of the pinctrl subsystem | ||
3 | * | ||
4 | * Copyright (C) 2011 ST-Ericsson SA | ||
5 | * Written on behalf of Linaro for ST-Ericsson | ||
6 | * This interface is used in the core to keep track of pins. | ||
7 | * | ||
8 | * Author: Linus Walleij <linus.walleij@linaro.org> | ||
9 | * | ||
10 | * License terms: GNU General Public License (GPL) version 2 | ||
11 | */ | ||
12 | #ifndef __LINUX_PINCTRL_PINCONF_H | ||
13 | #define __LINUX_PINCTRL_PINCONF_H | ||
14 | |||
15 | #ifdef CONFIG_PINCONF | ||
16 | |||
17 | struct pinctrl_dev; | ||
18 | |||
19 | /** | ||
20 | * struct pinconf_ops - pin config operations, to be implemented by | ||
21 | * pin configuration capable drivers. | ||
22 | * @pin_config_get: get the config of a certain pin, if the requested config | ||
23 | * is not available on this controller this should return -ENOTSUPP | ||
24 | * and if it is available but disabled it should return -EINVAL | ||
25 | * @pin_config_get: get the config of a certain pin | ||
26 | * @pin_config_set: configure an individual pin | ||
27 | * @pin_config_group_get: get configurations for an entire pin group | ||
28 | * @pin_config_group_set: configure all pins in a group | ||
29 | * @pin_config_dbg_show: optional debugfs display hook that will provide | ||
30 | * per-device info for a certain pin in debugfs | ||
31 | * @pin_config_group_dbg_show: optional debugfs display hook that will provide | ||
32 | * per-device info for a certain group in debugfs | ||
33 | */ | ||
34 | struct pinconf_ops { | ||
35 | int (*pin_config_get) (struct pinctrl_dev *pctldev, | ||
36 | unsigned pin, | ||
37 | unsigned long *config); | ||
38 | int (*pin_config_set) (struct pinctrl_dev *pctldev, | ||
39 | unsigned pin, | ||
40 | unsigned long config); | ||
41 | int (*pin_config_group_get) (struct pinctrl_dev *pctldev, | ||
42 | unsigned selector, | ||
43 | unsigned long *config); | ||
44 | int (*pin_config_group_set) (struct pinctrl_dev *pctldev, | ||
45 | unsigned selector, | ||
46 | unsigned long config); | ||
47 | void (*pin_config_dbg_show) (struct pinctrl_dev *pctldev, | ||
48 | struct seq_file *s, | ||
49 | unsigned offset); | ||
50 | void (*pin_config_group_dbg_show) (struct pinctrl_dev *pctldev, | ||
51 | struct seq_file *s, | ||
52 | unsigned selector); | ||
53 | }; | ||
54 | |||
55 | extern int pin_config_get(struct pinctrl_dev *pctldev, const char *name, | ||
56 | unsigned long *config); | ||
57 | extern int pin_config_set(struct pinctrl_dev *pctldev, const char *name, | ||
58 | unsigned long config); | ||
59 | extern int pin_config_group_get(struct pinctrl_dev *pctldev, | ||
60 | const char *pin_group, | ||
61 | unsigned long *config); | ||
62 | extern int pin_config_group_set(struct pinctrl_dev *pctldev, | ||
63 | const char *pin_group, | ||
64 | unsigned long config); | ||
65 | |||
66 | #else | ||
67 | |||
68 | static inline int pin_config_get(struct pinctrl_dev *pctldev, const char *name, | ||
69 | unsigned long *config) | ||
70 | { | ||
71 | return 0; | ||
72 | } | ||
73 | |||
74 | static inline int pin_config_set(struct pinctrl_dev *pctldev, const char *name, | ||
75 | unsigned long config) | ||
76 | { | ||
77 | return 0; | ||
78 | } | ||
79 | |||
80 | static inline int pin_config_group_get(struct pinctrl_dev *pctldev, | ||
81 | const char *pin_group, | ||
82 | unsigned long *config) | ||
83 | { | ||
84 | return 0; | ||
85 | } | ||
86 | |||
87 | static inline int pin_config_group_set(struct pinctrl_dev *pctldev, | ||
88 | const char *pin_group, | ||
89 | unsigned long config) | ||
90 | { | ||
91 | return 0; | ||
92 | } | ||
93 | |||
94 | #endif | ||
95 | |||
96 | #endif /* __LINUX_PINCTRL_PINCONF_H */ | ||
diff --git a/include/linux/pinctrl/pinctrl.h b/include/linux/pinctrl/pinctrl.h index f17fac4b51f1..9809a94f151b 100644 --- a/include/linux/pinctrl/pinctrl.h +++ b/include/linux/pinctrl/pinctrl.h | |||
@@ -21,6 +21,7 @@ | |||
21 | 21 | ||
22 | struct pinctrl_dev; | 22 | struct pinctrl_dev; |
23 | struct pinmux_ops; | 23 | struct pinmux_ops; |
24 | struct pinconf_ops; | ||
24 | struct gpio_chip; | 25 | struct gpio_chip; |
25 | 26 | ||
26 | /** | 27 | /** |
@@ -97,7 +98,9 @@ struct pinctrl_ops { | |||
97 | * but may be equal to npins if you have no holes in the pin range. | 98 | * but may be equal to npins if you have no holes in the pin range. |
98 | * @pctlops: pin control operation vtable, to support global concepts like | 99 | * @pctlops: pin control operation vtable, to support global concepts like |
99 | * grouping of pins, this is optional. | 100 | * grouping of pins, this is optional. |
100 | * @pmxops: pinmux operation vtable, if you support pinmuxing in your driver | 101 | * @pmxops: pinmux operations vtable, if you support pinmuxing in your driver |
102 | * @confops: pin config operations vtable, if you support pin configuration in | ||
103 | * your driver | ||
101 | * @owner: module providing the pin controller, used for refcounting | 104 | * @owner: module providing the pin controller, used for refcounting |
102 | */ | 105 | */ |
103 | struct pinctrl_desc { | 106 | struct pinctrl_desc { |
@@ -107,6 +110,7 @@ struct pinctrl_desc { | |||
107 | unsigned int maxpin; | 110 | unsigned int maxpin; |
108 | struct pinctrl_ops *pctlops; | 111 | struct pinctrl_ops *pctlops; |
109 | struct pinmux_ops *pmxops; | 112 | struct pinmux_ops *pmxops; |
113 | struct pinconf_ops *confops; | ||
110 | struct module *owner; | 114 | struct module *owner; |
111 | }; | 115 | }; |
112 | 116 | ||
@@ -125,7 +129,7 @@ extern void *pinctrl_dev_get_drvdata(struct pinctrl_dev *pctldev); | |||
125 | 129 | ||
126 | struct pinctrl_dev; | 130 | struct pinctrl_dev; |
127 | 131 | ||
128 | /* Sufficiently stupid default function when pinctrl is not in use */ | 132 | /* Sufficiently stupid default functions when pinctrl is not in use */ |
129 | static inline bool pin_is_valid(struct pinctrl_dev *pctldev, int pin) | 133 | static inline bool pin_is_valid(struct pinctrl_dev *pctldev, int pin) |
130 | { | 134 | { |
131 | return pin >= 0; | 135 | return pin >= 0; |