Merge tag 'trace-printf-v6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/trace...
[drm/drm-misc.git] / drivers / pinctrl / spacemit / pinctrl-k1.h
blob16143fea469ebc7c9fa65cfa177fa915576c145a
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright (c) 2024 Yixun Lan <dlan@gentoo.org> */
4 #ifndef _PINCTRL_SPACEMIT_K1_H
5 #define _PINCTRL_SPACEMIT_K1_H
7 #include <linux/bits.h>
8 #include <linux/bitfield.h>
9 #include <linux/device.h>
10 #include <linux/mutex.h>
11 #include <linux/spinlock.h>
12 #include <linux/platform_device.h>
13 #include <linux/pinctrl/pinctrl.h>
14 #include <linux/pinctrl/pinconf.h>
16 enum spacemit_pin_io_type {
17 IO_TYPE_NONE = 0,
18 IO_TYPE_1V8,
19 IO_TYPE_3V3,
20 IO_TYPE_EXTERNAL,
23 #define PIN_POWER_STATE_1V8 1800
24 #define PIN_POWER_STATE_3V3 3300
26 #define K1_PIN_IO_TYPE GENMASK(2, 1)
28 #define K1_PIN_CAP_IO_TYPE(type) \
29 FIELD_PREP_CONST(K1_PIN_IO_TYPE, type)
30 #define K1_PIN_GET_IO_TYPE(val) \
31 FIELD_GET(K1_PIN_IO_TYPE, val)
33 #define K1_FUNC_PIN(_id, _gpiofunc, _io) \
34 { \
35 .pin = (_id), \
36 .gpiofunc = (_gpiofunc), \
37 .flags = (K1_PIN_CAP_IO_TYPE(_io)), \
40 #endif /* _PINCTRL_SPACEMIT_K1_H */