]>
Commit | Line | Data |
---|---|---|
ae6b4d85 LW |
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 */ |