Debian Codegraph @

drivers/pinctrl/nuvoton/pinctrl-ma35.h

raw
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3 * Copyright (C) 2024 Nuvoton Technology Corp.
4 *
5 * Author: Shan-Chun Hung <[email protected]>
6 * * Jacky Huang <[email protected]>
7 */
8 #ifndef __PINCTRL_MA35_H
9 #define __PINCTRL_MA35_H
10
11 #include <linux/pinctrl/pinconf-generic.h>
12 #include <linux/pinctrl/pinmux.h>
13 #include <linux/platform_device.h>
14
15 struct ma35_mux_desc {
16 const char *name;
17 u32 muxval;
18 };
19
20 struct ma35_pin_data {
21 u32 offset;
22 u32 shift;
23 struct ma35_mux_desc *muxes;
24 };
25
26 struct ma35_pinctrl_soc_info {
27 const struct pinctrl_pin_desc *pins;
28 unsigned int npins;
29 int (*get_pin_num)(int offset, int shift);
30 };
31
32 #define MA35_PIN(num, n, o, s, ...) { \
33 .number = num, \
34 .name = #n, \
35 .drv_data = &(struct ma35_pin_data) { \
36 .offset = o, \
37 .shift = s, \
38 .muxes = (struct ma35_mux_desc[]) { \
39 __VA_ARGS__, { } }, \
40 }, \
41 }
42
43 #define MA35_MUX(_val, _name) { \
44 .name = _name, \
45 .muxval = _val, \
46 }
47
48 int ma35_pinctrl_probe(struct platform_device *pdev, const struct ma35_pinctrl_soc_info *info);
49 int ma35_pinctrl_suspend(struct device *dev);
50 int ma35_pinctrl_resume(struct device *dev);
51
52 #endif /* __PINCTRL_MA35_H */