1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Internal interface between the core pin control system and the
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>
21 struct pinctrl_setting
;
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
);
46 static inline int pinconf_check_ops(struct pinctrl_dev
*pctldev
)
51 static inline int pinconf_validate_map(const struct pinctrl_map
*map
, int i
)
56 static inline int pinconf_map_to_setting(const struct pinctrl_map
*map
,
57 struct pinctrl_setting
*setting
)
62 static inline void pinconf_free_setting(const struct pinctrl_setting
*setting
)
66 static inline int pinconf_apply_setting(const struct pinctrl_setting
*setting
)
71 static inline int pinconf_set_config(struct pinctrl_dev
*pctldev
, unsigned int pin
,
72 unsigned long *configs
, size_t nconfigs
)
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
);
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
)
107 * The following functions are available if the driver uses the generic
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
,
117 void pinconf_generic_dump_config(struct pinctrl_dev
*pctldev
,
118 struct seq_file
*s
, unsigned long config
);
121 static inline void pinconf_generic_dump_pins(struct pinctrl_dev
*pctldev
,
123 const char *gname
, unsigned int pin
)
128 static inline void pinconf_generic_dump_config(struct pinctrl_dev
*pctldev
,
130 unsigned long config
)
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
);