lin
2025-08-21 57113df3a0e2be01232281fad9a5f2c060567981
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/*
 * Based on drivers/input/keyboard/sunxi-keyboard.h
 *
 * Copyright (C) 2015 Allwinnertech Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
#ifndef SUNXI_KEYBOARD_H
#define SUNXI_KEYBOARD_H
 
#define INPUT_DEV_NAME          ("sunxi-keyboard")
 
#define KEY_MAX_CNT             (13)
 
#define LRADC_CTRL              (0x00)
#define LRADC_INTC              (0x04)
#define LRADC_INT_STA           (0x08)
#define LRADC_DATA0             (0x0c)
#define LRADC_DATA1             (0x10)
 
#define FIRST_CONCERT_DLY       (0<<24)
#define CHAN                    (0x0)
#define ADC_CHAN_SELECT         (CHAN<<22)
#define LRADC_KEY_MODE          (0)
#define KEY_MODE_SELECT         (LRADC_KEY_MODE<<12)
#define LRADC_HOLD_KEY_EN    (0<<7)
#define LRADC_HOLD_EN        (1<<6)
#define LEVELB_VOL              (0<<4)
#define LRADC_SAMPLE_32HZ       (3<<2)
#define LRADC_SAMPLE_62HZ       (2<<2)
#define LRADC_SAMPLE_125HZ      (1<<2)
#define LRADC_SAMPLE_250HZ      (0<<2)
#define LRADC_EN                (1<<0)
 
#define LRADC_ADC1_UP_EN        (1<<12)
#define LRADC_ADC1_DOWN_EN      (1<<9)
#define LRADC_ADC1_DATA_EN      (1<<8)
 
#define LRADC_ADC0_UP_EN        (1<<4)
#define LRADC_ADC0_DOWN_EN      (1<<1)
#define LRADC_ADC0_DATA_EN      (1<<0)
 
#define LRADC_ADC1_UPPEND       (1<<12)
#define LRADC_ADC1_DOWNPEND     (1<<9)
#define LRADC_ADC1_DATAPEND     (1<<8)
 
 
#define LRADC_ADC0_UPPEND       (1<<4)
#define LRADC_ADC0_DOWNPEND     (1<<1)
#define LRADC_ADC0_DATAPEND     (1<<0)
 
#define ONE_CHANNEL
#define MODE_0V2
 
#ifdef MODE_0V2
/* standard of key maping
 * 0.2V mode
 */
#define REPORT_KEY_LOW_LIMIT_COUNT  (1)
 
#endif
 
struct sunxi_adc_disc {
   u32 measure;
   u32 resol;
};
 
enum key_mode {
   CONCERT_DLY_SET = (1<<0),
   ADC_CHAN_SET = (1<<1),
   KEY_MODE_SET = (1<<2),
   LRADC_HOLD_SET = (1<<3),
   LEVELB_VOL_SET = (1<<4),
   LRADC_SAMPLE_SET = (1<<5),
   LRADC_EN_SET = (1<<6),
};
 
enum int_mode {
   ADC0_DOWN_INT_SET = (1<<0),
   ADC0_UP_INT_SET = (1<<1),
   ADC0_DATA_INT_SET = (1<<2),
};
 
#endif