2 * Internal interface between the core pin control system and the
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
15 int pinmux_check_ops(struct pinctrl_dev
*pctldev
);
17 int pinmux_validate_map(const struct pinctrl_map
*map
, int i
);
19 int pinmux_request_gpio(struct pinctrl_dev
*pctldev
,
20 struct pinctrl_gpio_range
*range
,
21 unsigned pin
, unsigned gpio
);
22 void pinmux_free_gpio(struct pinctrl_dev
*pctldev
, unsigned pin
,
23 struct pinctrl_gpio_range
*range
);
24 int pinmux_gpio_direction(struct pinctrl_dev
*pctldev
,
25 struct pinctrl_gpio_range
*range
,
26 unsigned pin
, bool input
);
28 int pinmux_map_to_setting(const struct pinctrl_map
*map
,
29 struct pinctrl_setting
*setting
);
30 void pinmux_free_setting(const struct pinctrl_setting
*setting
);
31 int pinmux_enable_setting(const struct pinctrl_setting
*setting
);
32 void pinmux_disable_setting(const struct pinctrl_setting
*setting
);
36 static inline int pinmux_check_ops(struct pinctrl_dev
*pctldev
)
41 static inline int pinmux_validate_map(const struct pinctrl_map
*map
, int i
)
46 static inline int pinmux_request_gpio(struct pinctrl_dev
*pctldev
,
47 struct pinctrl_gpio_range
*range
,
48 unsigned pin
, unsigned gpio
)
53 static inline void pinmux_free_gpio(struct pinctrl_dev
*pctldev
,
55 struct pinctrl_gpio_range
*range
)
59 static inline int pinmux_gpio_direction(struct pinctrl_dev
*pctldev
,
60 struct pinctrl_gpio_range
*range
,
61 unsigned pin
, bool input
)
66 static inline int pinmux_map_to_setting(const struct pinctrl_map
*map
,
67 struct pinctrl_setting
*setting
)
72 static inline void pinmux_free_setting(const struct pinctrl_setting
*setting
)
76 static inline int pinmux_enable_setting(const struct pinctrl_setting
*setting
)
81 static inline void pinmux_disable_setting(const struct pinctrl_setting
*setting
)
87 #if defined(CONFIG_PINMUX) && defined(CONFIG_DEBUG_FS)
89 void pinmux_show_map(struct seq_file
*s
, const struct pinctrl_map
*map
);
90 void pinmux_show_setting(struct seq_file
*s
,
91 const struct pinctrl_setting
*setting
);
92 void pinmux_init_device_debugfs(struct dentry
*devroot
,
93 struct pinctrl_dev
*pctldev
);
97 static inline void pinmux_show_map(struct seq_file
*s
,
98 const struct pinctrl_map
*map
)
102 static inline void pinmux_show_setting(struct seq_file
*s
,
103 const struct pinctrl_setting
*setting
)
107 static inline void pinmux_init_device_debugfs(struct dentry
*devroot
,
108 struct pinctrl_dev
*pctldev
)
114 #ifdef CONFIG_GENERIC_PINMUX_FUNCTIONS
117 * struct function_desc - generic function descriptor
118 * @name: name of the function
119 * @group_names: array of pin group names
120 * @num_group_names: number of pin group names
121 * @data: pin controller driver specific data
123 struct function_desc
{
125 const char **group_names
;
130 int pinmux_generic_get_function_count(struct pinctrl_dev
*pctldev
);
133 pinmux_generic_get_function_name(struct pinctrl_dev
*pctldev
,
134 unsigned int selector
);
136 int pinmux_generic_get_function_groups(struct pinctrl_dev
*pctldev
,
137 unsigned int selector
,
138 const char * const **groups
,
139 unsigned * const num_groups
);
141 struct function_desc
*pinmux_generic_get_function(struct pinctrl_dev
*pctldev
,
142 unsigned int selector
);
144 int pinmux_generic_add_function(struct pinctrl_dev
*pctldev
,
147 unsigned const num_groups
,
150 int pinmux_generic_remove_function(struct pinctrl_dev
*pctldev
,
151 unsigned int selector
);
153 void pinmux_generic_free_functions(struct pinctrl_dev
*pctldev
);
157 static inline void pinmux_generic_free_functions(struct pinctrl_dev
*pctldev
)
161 #endif /* CONFIG_GENERIC_PINMUX_FUNCTIONS */