Merge tag 'trace-printf-v6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/trace...
[drm/drm-misc.git] / drivers / pinctrl / pinconf.h
bloba14c950bc70041f135b16a17f3747c61bdbf0f84
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 #include <linux/errno.h>
15 struct dentry;
16 struct device_node;
17 struct seq_file;
19 struct pinctrl_dev;
20 struct pinctrl_map;
21 struct pinctrl_setting;
23 #ifdef CONFIG_PINCONF
25 int pinconf_check_ops(struct pinctrl_dev *pctldev);
26 int pinconf_validate_map(const struct pinctrl_map *map, int i);
27 int pinconf_map_to_setting(const struct pinctrl_map *map,
28 struct pinctrl_setting *setting);
29 void pinconf_free_setting(const struct pinctrl_setting *setting);
30 int pinconf_apply_setting(const struct pinctrl_setting *setting);
32 int pinconf_set_config(struct pinctrl_dev *pctldev, unsigned int pin,
33 unsigned long *configs, size_t nconfigs);
36 * You will only be interested in these if you're using PINCONF
37 * so don't supply any stubs for these.
39 int pin_config_get_for_pin(struct pinctrl_dev *pctldev, unsigned int pin,
40 unsigned long *config);
41 int pin_config_group_get(const char *dev_name, const char *pin_group,
42 unsigned long *config);
44 #else
46 static inline int pinconf_check_ops(struct pinctrl_dev *pctldev)
48 return 0;
51 static inline int pinconf_validate_map(const struct pinctrl_map *map, int i)
53 return 0;
56 static inline int pinconf_map_to_setting(const struct pinctrl_map *map,
57 struct pinctrl_setting *setting)
59 return 0;
62 static inline void pinconf_free_setting(const struct pinctrl_setting *setting)
66 static inline int pinconf_apply_setting(const struct pinctrl_setting *setting)
68 return 0;
71 static inline int pinconf_set_config(struct pinctrl_dev *pctldev, unsigned int pin,
72 unsigned long *configs, size_t nconfigs)
74 return -ENOTSUPP;
77 #endif
79 #if defined(CONFIG_PINCONF) && defined(CONFIG_DEBUG_FS)
81 void pinconf_show_map(struct seq_file *s, const struct pinctrl_map *map);
82 void pinconf_show_setting(struct seq_file *s,
83 const struct pinctrl_setting *setting);
84 void pinconf_init_device_debugfs(struct dentry *devroot,
85 struct pinctrl_dev *pctldev);
87 #else
89 static inline void pinconf_show_map(struct seq_file *s,
90 const struct pinctrl_map *map)
94 static inline void pinconf_show_setting(struct seq_file *s,
95 const struct pinctrl_setting *setting)
99 static inline void pinconf_init_device_debugfs(struct dentry *devroot,
100 struct pinctrl_dev *pctldev)
104 #endif
107 * The following functions are available if the driver uses the generic
108 * pin config.
111 #if defined(CONFIG_GENERIC_PINCONF) && defined(CONFIG_DEBUG_FS)
113 void pinconf_generic_dump_pins(struct pinctrl_dev *pctldev,
114 struct seq_file *s, const char *gname,
115 unsigned int pin);
117 void pinconf_generic_dump_config(struct pinctrl_dev *pctldev,
118 struct seq_file *s, unsigned long config);
119 #else
121 static inline void pinconf_generic_dump_pins(struct pinctrl_dev *pctldev,
122 struct seq_file *s,
123 const char *gname, unsigned int pin)
125 return;
128 static inline void pinconf_generic_dump_config(struct pinctrl_dev *pctldev,
129 struct seq_file *s,
130 unsigned long config)
132 return;
134 #endif
136 #if defined(CONFIG_GENERIC_PINCONF) && defined(CONFIG_OF)
137 int pinconf_generic_parse_dt_config(struct device_node *np,
138 struct pinctrl_dev *pctldev,
139 unsigned long **configs,
140 unsigned int *nconfigs);
141 #endif