ACPI / debugger: Fix regression introduced by IS_ERR_VALUE() removal
[linux-2.6-block.git] / drivers / pinctrl / pinconf.h
CommitLineData
ae6b4d85
LW
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
b9130b77 16int pinconf_check_ops(struct pinctrl_dev *pctldev);
1e2082b5 17int pinconf_validate_map(struct pinctrl_map const *map, int i);
1e2082b5
SW
18int pinconf_map_to_setting(struct pinctrl_map const *map,
19 struct pinctrl_setting *setting);
20void pinconf_free_setting(struct pinctrl_setting const *setting);
21int pinconf_apply_setting(struct pinctrl_setting const *setting);
ae6b4d85 22
394349f7
LW
23/*
24 * You will only be interested in these if you're using PINCONF
25 * so don't supply any stubs for these.
26 */
27int pin_config_get_for_pin(struct pinctrl_dev *pctldev, unsigned pin,
28 unsigned long *config);
29int pin_config_group_get(const char *dev_name, const char *pin_group,
30 unsigned long *config);
31
ae6b4d85
LW
32#else
33
b9130b77 34static inline int pinconf_check_ops(struct pinctrl_dev *pctldev)
ae6b4d85
LW
35{
36 return 0;
37}
38
1e2082b5
SW
39static inline int pinconf_validate_map(struct pinctrl_map const *map, int i)
40{
41 return 0;
42}
43
44static inline int pinconf_map_to_setting(struct pinctrl_map const *map,
45 struct pinctrl_setting *setting)
46{
47 return 0;
48}
49
50static inline void pinconf_free_setting(struct pinctrl_setting const *setting)
51{
52}
53
54static inline int pinconf_apply_setting(struct pinctrl_setting const *setting)
55{
56 return 0;
57}
58
c736d73c
SW
59#endif
60
96593afe 61#if defined(CONFIG_PINCONF) && defined(CONFIG_DEBUG_FS)
c736d73c
SW
62
63void pinconf_show_map(struct seq_file *s, struct pinctrl_map const *map);
64void pinconf_show_setting(struct seq_file *s,
65 struct pinctrl_setting const *setting);
66void pinconf_init_device_debugfs(struct dentry *devroot,
67 struct pinctrl_dev *pctldev);
68
69#else
70
1e2082b5
SW
71static inline void pinconf_show_map(struct seq_file *s,
72 struct pinctrl_map const *map)
73{
74}
75
76static inline void pinconf_show_setting(struct seq_file *s,
77 struct pinctrl_setting const *setting)
78{
79}
80
ae6b4d85
LW
81static inline void pinconf_init_device_debugfs(struct dentry *devroot,
82 struct pinctrl_dev *pctldev)
83{
84}
85
86#endif
394349f7
LW
87
88/*
89 * The following functions are available if the driver uses the generic
90 * pin config.
91 */
92
bf4d7be5 93#if defined(CONFIG_GENERIC_PINCONF) && defined(CONFIG_DEBUG_FS)
394349f7 94
dd4d01f7
SB
95void pinconf_generic_dump_pins(struct pinctrl_dev *pctldev,
96 struct seq_file *s, const char *gname,
97 unsigned pin);
394349f7 98
9cfd1724
HZ
99void pinconf_generic_dump_config(struct pinctrl_dev *pctldev,
100 struct seq_file *s, unsigned long config);
394349f7
LW
101#else
102
dd4d01f7
SB
103static inline void pinconf_generic_dump_pins(struct pinctrl_dev *pctldev,
104 struct seq_file *s,
105 const char *gname, unsigned pin)
394349f7
LW
106{
107 return;
108}
109
9cfd1724
HZ
110static inline void pinconf_generic_dump_config(struct pinctrl_dev *pctldev,
111 struct seq_file *s,
112 unsigned long config)
113{
114 return;
115}
394349f7 116#endif
7db9af4b
HS
117
118#if defined(CONFIG_GENERIC_PINCONF) && defined(CONFIG_OF)
119int pinconf_generic_parse_dt_config(struct device_node *np,
dd4d01f7 120 struct pinctrl_dev *pctldev,
7db9af4b
HS
121 unsigned long **configs,
122 unsigned int *nconfigs);
123#endif