Linux 4.1.16
[linux/fpc-iii.git] / drivers / pinctrl / pinconf.h
blob55c75780b3b29e2dbefcefba6c9ff5556e70f21c
1 /*
2 * Internal interface between the core pin control system and the
3 * pin config portions
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
9 * Author: Linus Walleij <linus.walleij@linaro.org>
11 * License terms: GNU General Public License (GPL) version 2
14 #ifdef CONFIG_PINCONF
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);
24 * You will only be interested in these if you're using PINCONF
25 * so don't supply any stubs for these.
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);
32 #else
34 static inline int pinconf_check_ops(struct pinctrl_dev *pctldev)
36 return 0;
39 static inline int pinconf_validate_map(struct pinctrl_map const *map, int i)
41 return 0;
44 static inline int pinconf_map_to_setting(struct pinctrl_map const *map,
45 struct pinctrl_setting *setting)
47 return 0;
50 static inline void pinconf_free_setting(struct pinctrl_setting const *setting)
54 static inline int pinconf_apply_setting(struct pinctrl_setting const *setting)
56 return 0;
59 #endif
61 #if defined(CONFIG_PINCONF) && defined(CONFIG_DEBUG_FS)
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);
69 #else
71 static inline void pinconf_show_map(struct seq_file *s,
72 struct pinctrl_map const *map)
76 static inline void pinconf_show_setting(struct seq_file *s,
77 struct pinctrl_setting const *setting)
81 static inline void pinconf_init_device_debugfs(struct dentry *devroot,
82 struct pinctrl_dev *pctldev)
86 #endif
89 * The following functions are available if the driver uses the generic
90 * pin config.
93 #if defined(CONFIG_GENERIC_PINCONF) && defined(CONFIG_DEBUG_FS)
95 void pinconf_generic_dump_pins(struct pinctrl_dev *pctldev,
96 struct seq_file *s, const char *gname,
97 unsigned pin);
99 void pinconf_generic_dump_config(struct pinctrl_dev *pctldev,
100 struct seq_file *s, unsigned long config);
101 #else
103 static inline void pinconf_generic_dump_pins(struct pinctrl_dev *pctldev,
104 struct seq_file *s,
105 const char *gname, unsigned pin)
107 return;
110 static inline void pinconf_generic_dump_config(struct pinctrl_dev *pctldev,
111 struct seq_file *s,
112 unsigned long config)
114 return;
116 #endif
118 #if defined(CONFIG_GENERIC_PINCONF) && defined(CONFIG_OF)
119 int pinconf_generic_parse_dt_config(struct device_node *np,
120 struct pinctrl_dev *pctldev,
121 unsigned long **configs,
122 unsigned int *nconfigs);
123 #endif