treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / drivers / pinctrl / pinconf.h
blobbe7311373299f7127cfbd661d8c440dc6ed144f9
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3 * Internal interface between the core pin control system and the
4 * pin config portions
6 * Copyright (C) 2011 ST-Ericsson SA
7 * Written on behalf of Linaro for ST-Ericsson
8 * Based on bits of regulator core, gpio core and clk core
10 * Author: Linus Walleij <linus.walleij@linaro.org>
13 #ifdef CONFIG_PINCONF
15 int pinconf_check_ops(struct pinctrl_dev *pctldev);
16 int pinconf_validate_map(const struct pinctrl_map *map, int i);
17 int pinconf_map_to_setting(const struct pinctrl_map *map,
18 struct pinctrl_setting *setting);
19 void pinconf_free_setting(const struct pinctrl_setting *setting);
20 int pinconf_apply_setting(const struct pinctrl_setting *setting);
22 int pinconf_set_config(struct pinctrl_dev *pctldev, unsigned pin,
23 unsigned long *configs, size_t nconfigs);
26 * You will only be interested in these if you're using PINCONF
27 * so don't supply any stubs for these.
29 int pin_config_get_for_pin(struct pinctrl_dev *pctldev, unsigned pin,
30 unsigned long *config);
31 int pin_config_group_get(const char *dev_name, const char *pin_group,
32 unsigned long *config);
34 #else
36 static inline int pinconf_check_ops(struct pinctrl_dev *pctldev)
38 return 0;
41 static inline int pinconf_validate_map(const struct pinctrl_map *map, int i)
43 return 0;
46 static inline int pinconf_map_to_setting(const struct pinctrl_map *map,
47 struct pinctrl_setting *setting)
49 return 0;
52 static inline void pinconf_free_setting(const struct pinctrl_setting *setting)
56 static inline int pinconf_apply_setting(const struct pinctrl_setting *setting)
58 return 0;
61 static inline int pinconf_set_config(struct pinctrl_dev *pctldev, unsigned pin,
62 unsigned long *configs, size_t nconfigs)
64 return -ENOTSUPP;
67 #endif
69 #if defined(CONFIG_PINCONF) && defined(CONFIG_DEBUG_FS)
71 void pinconf_show_map(struct seq_file *s, const struct pinctrl_map *map);
72 void pinconf_show_setting(struct seq_file *s,
73 const struct pinctrl_setting *setting);
74 void pinconf_init_device_debugfs(struct dentry *devroot,
75 struct pinctrl_dev *pctldev);
77 #else
79 static inline void pinconf_show_map(struct seq_file *s,
80 const struct pinctrl_map *map)
84 static inline void pinconf_show_setting(struct seq_file *s,
85 const struct pinctrl_setting *setting)
89 static inline void pinconf_init_device_debugfs(struct dentry *devroot,
90 struct pinctrl_dev *pctldev)
94 #endif
97 * The following functions are available if the driver uses the generic
98 * pin config.
101 #if defined(CONFIG_GENERIC_PINCONF) && defined(CONFIG_DEBUG_FS)
103 void pinconf_generic_dump_pins(struct pinctrl_dev *pctldev,
104 struct seq_file *s, const char *gname,
105 unsigned pin);
107 void pinconf_generic_dump_config(struct pinctrl_dev *pctldev,
108 struct seq_file *s, unsigned long config);
109 #else
111 static inline void pinconf_generic_dump_pins(struct pinctrl_dev *pctldev,
112 struct seq_file *s,
113 const char *gname, unsigned pin)
115 return;
118 static inline void pinconf_generic_dump_config(struct pinctrl_dev *pctldev,
119 struct seq_file *s,
120 unsigned long config)
122 return;
124 #endif
126 #if defined(CONFIG_GENERIC_PINCONF) && defined(CONFIG_OF)
127 int pinconf_generic_parse_dt_config(struct device_node *np,
128 struct pinctrl_dev *pctldev,
129 unsigned long **configs,
130 unsigned int *nconfigs);
131 #endif