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