1 /*
2  * Copyright (c) 2021 Microchip Technology Inc. and its subsidiaries.
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #ifndef _MEC_KSCAN_H
8 #define _MEC_KSCAN_H
9 
10 #include <stdint.h>
11 #include <stddef.h>
12 
13 /* KSO_SEL */
14 #define MCHP_KSCAN_KSO_SEL_REG_MASK	0xffu
15 #define MCHP_KSCAN_KSO_LINES_POS	0u
16 #define MCHP_KSCAN_KSO_LINES_MASK0	0x1fu
17 #define MCHP_KSCAN_KSO_LINES_MASK	0x1fu
18 #define MCHP_KSCAN_KSO_ALL_POS		5u
19 #define MCHP_KSCAN_KSO_ALL		BIT(5)
20 #define MCHP_KSCAN_KSO_EN_POS		6u
21 #define MCHP_KSCAN_KSO_EN		BIT(6)
22 #define MCHP_KSCAN_KSO_INV_POS		7u
23 #define MCHP_KSCAN_KSO_INV		BIT(7)
24 
25 /* KSI_IN */
26 #define MCHP_KSCAN_KSI_IN_REG_MASK	0xffu
27 
28 /* KSI_STS */
29 #define MCHP_KSCAN_KSI_STS_REG_MASK	0xffu
30 
31 /* KSI_IEN */
32 #define MCHP_KSCAN_KSI_IEN_REG_MASK	0xffu
33 
34 /* EXT_CTRL */
35 #define MCHP_KSCAN_EXT_CTRL_REG_MASK	0x01u
36 #define MCHP_KSCAN_EXT_CTRL_PREDRV_EN	0x01u
37 
38 /** @brief Keyboard scan matrix controller. Size = 24(0x18) */
39 struct kscan_regs {
40 	uint32_t RSVD[1];
41 	volatile uint32_t KSO_SEL;
42 	volatile uint32_t KSI_IN;
43 	volatile uint32_t KSI_STS;
44 	volatile uint32_t KSI_IEN;
45 	volatile uint32_t EXT_CTRL;
46 };
47 
48 #endif	/* #ifndef _MEC_KSCAN_H */
49