Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / pinctrl / pinconf.h
1 /*
2 * Internal interface between the core pin control system and the
3 * pin config portions
4 *
5 * Copyright (C) 2011 ST-Ericsson SA
6 * Written on behalf of Linaro for ST-Ericsson
7 * Based on bits of regulator core, gpio core and clk core
8 *
9 * Author: Linus Walleij <linus.walleij@linaro.org>
10 *
11 * License terms: GNU General Public License (GPL) version 2
12 */
13
14 #ifdef CONFIG_PINCONF
15
16 int pinconf_check_ops(struct pinctrl_dev *pctldev);
17 int pinconf_validate_map(struct pinctrl_map const *map, int i);
18 int pinconf_map_to_setting(struct pinctrl_map const *map,
19 struct pinctrl_setting *setting);
20 void pinconf_free_setting(struct pinctrl_setting const *setting);
21 int pinconf_apply_setting(struct pinctrl_setting const *setting);
22
23 /*
24 * You will only be interested in these if you're using PINCONF
25 * so don't supply any stubs for these.
26 */
27 int pin_config_get_for_pin(struct pinctrl_dev *pctldev, unsigned pin,
28 unsigned long *config);
29 int pin_config_group_get(const char *dev_name, const char *pin_group,
30 unsigned long *config);
31
32 #else
33
34 static inline int pinconf_check_ops(struct pinctrl_dev *pctldev)
35 {
36 return 0;
37 }
38
39 static inline int pinconf_validate_map(struct pinctrl_map const *map, int i)
40 {
41 return 0;
42 }
43
44 static inline int pinconf_map_to_setting(struct pinctrl_map const *map,
45 struct pinctrl_setting *setting)
46 {
47 return 0;
48 }
49
50 static inline void pinconf_free_setting(struct pinctrl_setting const *setting)
51 {
52 }
53
54 static inline int pinconf_apply_setting(struct pinctrl_setting const *setting)
55 {
56 return 0;
57 }
58
59 #endif
60
61 #if defined(CONFIG_PINCONF) && defined(CONFIG_DEBUG_FS)
62
63 void pinconf_show_map(struct seq_file *s, struct pinctrl_map const *map);
64 void pinconf_show_setting(struct seq_file *s,
65 struct pinctrl_setting const *setting);
66 void pinconf_init_device_debugfs(struct dentry *devroot,
67 struct pinctrl_dev *pctldev);
68
69 #else
70
71 static inline void pinconf_show_map(struct seq_file *s,
72 struct pinctrl_map const *map)
73 {
74 }
75
76 static inline void pinconf_show_setting(struct seq_file *s,
77 struct pinctrl_setting const *setting)
78 {
79 }
80
81 static inline void pinconf_init_device_debugfs(struct dentry *devroot,
82 struct pinctrl_dev *pctldev)
83 {
84 }
85
86 #endif
87
88 /*
89 * The following functions are available if the driver uses the generic
90 * pin config.
91 */
92
93 #if defined(CONFIG_GENERIC_PINCONF) && defined(CONFIG_DEBUG_FS)
94
95 void pinconf_generic_dump_pin(struct pinctrl_dev *pctldev,
96 struct seq_file *s, unsigned pin);
97
98 void pinconf_generic_dump_group(struct pinctrl_dev *pctldev,
99 struct seq_file *s, const char *gname);
100
101 void pinconf_generic_dump_config(struct pinctrl_dev *pctldev,
102 struct seq_file *s, unsigned long config);
103 #else
104
105 static inline void pinconf_generic_dump_pin(struct pinctrl_dev *pctldev,
106 struct seq_file *s,
107 unsigned pin)
108 {
109 return;
110 }
111
112 static inline void pinconf_generic_dump_group(struct pinctrl_dev *pctldev,
113 struct seq_file *s,
114 const char *gname)
115 {
116 return;
117 }
118
119 static inline void pinconf_generic_dump_config(struct pinctrl_dev *pctldev,
120 struct seq_file *s,
121 unsigned long config)
122 {
123 return;
124 }
125 #endif