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>
14 int pinmux_check_ops(struct pinctrl_dev *pctldev);
16 int pinmux_validate_map(const struct pinctrl_map *map, int i);
18 int pinmux_request_gpio(struct pinctrl_dev *pctldev,
19 struct pinctrl_gpio_range *range,
20 unsigned pin, unsigned gpio);
21 void pinmux_free_gpio(struct pinctrl_dev *pctldev, unsigned pin,
22 struct pinctrl_gpio_range *range);
23 int pinmux_gpio_direction(struct pinctrl_dev *pctldev,
24 struct pinctrl_gpio_range *range,
25 unsigned pin, bool input);
27 int pinmux_map_to_setting(const struct pinctrl_map *map,
28 struct pinctrl_setting *setting);
29 void pinmux_free_setting(const struct pinctrl_setting *setting);
30 int pinmux_enable_setting(const struct pinctrl_setting *setting);
31 void pinmux_disable_setting(const struct pinctrl_setting *setting);
35 static inline int pinmux_check_ops(struct pinctrl_dev *pctldev)
40 static inline int pinmux_validate_map(const struct pinctrl_map *map, int i)
45 static inline int pinmux_request_gpio(struct pinctrl_dev *pctldev,
46 struct pinctrl_gpio_range *range,
47 unsigned pin, unsigned gpio)
52 static inline void pinmux_free_gpio(struct pinctrl_dev *pctldev,
54 struct pinctrl_gpio_range *range)
58 static inline int pinmux_gpio_direction(struct pinctrl_dev *pctldev,
59 struct pinctrl_gpio_range *range,
60 unsigned pin, bool input)
65 static inline int pinmux_map_to_setting(const struct pinctrl_map *map,
66 struct pinctrl_setting *setting)
71 static inline void pinmux_free_setting(const struct pinctrl_setting *setting)
75 static inline int pinmux_enable_setting(const struct pinctrl_setting *setting)
80 static inline void pinmux_disable_setting(const struct pinctrl_setting *setting)
86 #if defined(CONFIG_PINMUX) && defined(CONFIG_DEBUG_FS)
88 void pinmux_show_map(struct seq_file *s, const struct pinctrl_map *map);
89 void pinmux_show_setting(struct seq_file *s,
90 const struct pinctrl_setting *setting);
91 void pinmux_init_device_debugfs(struct dentry *devroot,
92 struct pinctrl_dev *pctldev);
96 static inline void pinmux_show_map(struct seq_file *s,
97 const struct pinctrl_map *map)
101 static inline void pinmux_show_setting(struct seq_file *s,
102 const struct pinctrl_setting *setting)
106 static inline void pinmux_init_device_debugfs(struct dentry *devroot,
107 struct pinctrl_dev *pctldev)
113 #ifdef CONFIG_GENERIC_PINMUX_FUNCTIONS
116 * struct function_desc - generic function descriptor
117 * @name: name of the function
118 * @group_names: array of pin group names
119 * @num_group_names: number of pin group names
120 * @data: pin controller driver specific data
122 struct function_desc {
124 const char **group_names;
129 int pinmux_generic_get_function_count(struct pinctrl_dev *pctldev);
132 pinmux_generic_get_function_name(struct pinctrl_dev *pctldev,
133 unsigned int selector);
135 int pinmux_generic_get_function_groups(struct pinctrl_dev *pctldev,
136 unsigned int selector,
137 const char * const **groups,
138 unsigned * const num_groups);
140 struct function_desc *pinmux_generic_get_function(struct pinctrl_dev *pctldev,
141 unsigned int selector);
143 int pinmux_generic_add_function(struct pinctrl_dev *pctldev,
146 unsigned const num_groups,
149 int pinmux_generic_remove_function(struct pinctrl_dev *pctldev,
150 unsigned int selector);
152 void pinmux_generic_free_functions(struct pinctrl_dev *pctldev);
156 static inline void pinmux_generic_free_functions(struct pinctrl_dev *pctldev)
160 #endif /* CONFIG_GENERIC_PINMUX_FUNCTIONS */