Linux 5.1.15
[linux/fpc-iii.git] / drivers / pinctrl / pinconf.h
blob6c722505f89365ba58069c4d6f0976355f16dbd2
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(const struct pinctrl_map *map, int i);
18 int pinconf_map_to_setting(const struct pinctrl_map *map,
19 struct pinctrl_setting *setting);
20 void pinconf_free_setting(const struct pinctrl_setting *setting);
21 int pinconf_apply_setting(const struct pinctrl_setting *setting);
23 int pinconf_set_config(struct pinctrl_dev *pctldev, unsigned pin,
24 unsigned long *configs, size_t nconfigs);
27 * You will only be interested in these if you're using PINCONF
28 * so don't supply any stubs for these.
30 int pin_config_get_for_pin(struct pinctrl_dev *pctldev, unsigned pin,
31 unsigned long *config);
32 int pin_config_group_get(const char *dev_name, const char *pin_group,
33 unsigned long *config);
35 #else
37 static inline int pinconf_check_ops(struct pinctrl_dev *pctldev)
39 return 0;
42 static inline int pinconf_validate_map(const struct pinctrl_map *map, int i)
44 return 0;
47 static inline int pinconf_map_to_setting(const struct pinctrl_map *map,
48 struct pinctrl_setting *setting)
50 return 0;
53 static inline void pinconf_free_setting(const struct pinctrl_setting *setting)
57 static inline int pinconf_apply_setting(const struct pinctrl_setting *setting)
59 return 0;
62 static inline int pinconf_set_config(struct pinctrl_dev *pctldev, unsigned pin,
63 unsigned long *configs, size_t nconfigs)
65 return -ENOTSUPP;
68 #endif
70 #if defined(CONFIG_PINCONF) && defined(CONFIG_DEBUG_FS)
72 void pinconf_show_map(struct seq_file *s, const struct pinctrl_map *map);
73 void pinconf_show_setting(struct seq_file *s,
74 const struct pinctrl_setting *setting);
75 void pinconf_init_device_debugfs(struct dentry *devroot,
76 struct pinctrl_dev *pctldev);
78 #else
80 static inline void pinconf_show_map(struct seq_file *s,
81 const struct pinctrl_map *map)
85 static inline void pinconf_show_setting(struct seq_file *s,
86 const struct pinctrl_setting *setting)
90 static inline void pinconf_init_device_debugfs(struct dentry *devroot,
91 struct pinctrl_dev *pctldev)
95 #endif
98 * The following functions are available if the driver uses the generic
99 * pin config.
102 #if defined(CONFIG_GENERIC_PINCONF) && defined(CONFIG_DEBUG_FS)
104 void pinconf_generic_dump_pins(struct pinctrl_dev *pctldev,
105 struct seq_file *s, const char *gname,
106 unsigned pin);
108 void pinconf_generic_dump_config(struct pinctrl_dev *pctldev,
109 struct seq_file *s, unsigned long config);
110 #else
112 static inline void pinconf_generic_dump_pins(struct pinctrl_dev *pctldev,
113 struct seq_file *s,
114 const char *gname, unsigned pin)
116 return;
119 static inline void pinconf_generic_dump_config(struct pinctrl_dev *pctldev,
120 struct seq_file *s,
121 unsigned long config)
123 return;
125 #endif
127 #if defined(CONFIG_GENERIC_PINCONF) && defined(CONFIG_OF)
128 int pinconf_generic_parse_dt_config(struct device_node *np,
129 struct pinctrl_dev *pctldev,
130 unsigned long **configs,
131 unsigned int *nconfigs);
132 #endif