1 /*
2  * Copyright (C) Maxime Coquelin 2015
3  * Author:  Maxime Coquelin <mcoquelin.stm32@gmail.com>
4  * License terms:  GNU General Public License (GPL), version 2
5  */
6 #ifndef __PINCTRL_STM32_H
7 #define __PINCTRL_STM32_H
8 
9 #include <linux/pinctrl/pinctrl.h>
10 #include <linux/pinctrl/pinconf-generic.h>
11 
12 struct stm32_desc_function {
13 	const char *name;
14 	const unsigned char num;
15 };
16 
17 struct stm32_desc_pin {
18 	struct pinctrl_pin_desc pin;
19 	const struct stm32_desc_function *functions;
20 };
21 
22 #define STM32_PIN(_pin, ...)					\
23 	{							\
24 		.pin = _pin,					\
25 		.functions = (struct stm32_desc_function[]){	\
26 			__VA_ARGS__, { } },			\
27 	}
28 
29 #define STM32_FUNCTION(_num, _name)		\
30 	{							\
31 		.num = _num,					\
32 		.name = _name,					\
33 	}
34 
35 struct stm32_pinctrl_match_data {
36 	const struct stm32_desc_pin *pins;
37 	const unsigned int npins;
38 };
39 
40 int stm32_pctl_probe(struct platform_device *pdev);
41 
42 #endif /* __PINCTRL_STM32_H */
43 
44