Merge branch 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux...
[linux/fpc-iii.git] / drivers / pinctrl / stm32 / pinctrl-stm32.h
blob35ebc94c01e4e7e9bd4fd463ed3c168979acbafc
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
9 #include <linux/pinctrl/pinctrl.h>
10 #include <linux/pinctrl/pinconf-generic.h>
12 #define STM32_PIN_NO(x) ((x) << 8)
13 #define STM32_GET_PIN_NO(x) ((x) >> 8)
14 #define STM32_GET_PIN_FUNC(x) ((x) & 0xff)
16 #define STM32_PIN_GPIO 0
17 #define STM32_PIN_AF(x) ((x) + 1)
18 #define STM32_PIN_ANALOG (STM32_PIN_AF(15) + 1)
20 struct stm32_desc_function {
21 const char *name;
22 const unsigned char num;
25 struct stm32_desc_pin {
26 struct pinctrl_pin_desc pin;
27 const struct stm32_desc_function *functions;
30 #define STM32_PIN(_pin, ...) \
31 { \
32 .pin = _pin, \
33 .functions = (struct stm32_desc_function[]){ \
34 __VA_ARGS__, { } }, \
37 #define STM32_FUNCTION(_num, _name) \
38 { \
39 .num = _num, \
40 .name = _name, \
43 struct stm32_pinctrl_match_data {
44 const struct stm32_desc_pin *pins;
45 const unsigned int npins;
48 int stm32_pctl_probe(struct platform_device *pdev);
50 #endif /* __PINCTRL_STM32_H */