1 /* 2 * Copyright (C) 2021 HiSilicon (Shanghai) Technologies CO., LIMITED. 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU General Public License 6 * as published by the Free Software Foundation; either version 2 7 * of the License, or (at your option) any later version. 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, write to the Free Software 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 */ 18 19 #ifndef __HI_IR_H__ 20 #define __HI_IR_H__ 21 22 #include <linux/types.h> 23 24 #ifdef __cplusplus 25 extern "C" { 26 #endif /* __cplusplus */ 27 28 #define hi_ir_unused(x) (void)(x) 29 30 /* define device name */ 31 #define HIIR_DEVICE_NAME "Hi_IR" 32 33 /* Ioctl definitions */ 34 #define IR_IOC_SET_BUF 0x01 35 #define IR_IOC_SET_ENABLE_KEYUP 0x02 /* 1:check keyup */ 36 #define IR_IOC_SET_ENABLE_REPKEY 0x03 /* 1:check repkey, 0:hardware behave */ 37 #define IR_IOC_SET_REPKEY_TIMEOUTVAL 0x04 38 39 #define IR_IOC_SET_FORMAT 0x10 40 #define IR_IOC_SET_CODELEN 0x11 41 #define IR_IOC_SET_FREQ 0x12 42 #define IR_IOC_SET_LEADS 0x13 43 #define IR_IOC_SET_LEADE 0x14 44 #define IR_IOC_SET_SLEADE 0x15 45 #define IR_IOC_SET_CNT0_B 0x16 46 #define IR_IOC_SET_CNT1_B 0x17 47 48 #define IR_IOC_GET_CONFIG 0x20 49 50 #define IR_IOC_ENDBG 0x31 51 #define IR_IOC_DISDBG 0x32 52 53 #define HIIR_DEFAULT_FREQ 24 /* 24M */ 54 55 /* DEFINE KEY STATE */ 56 #define HIIR_KEY_DOWN 0x00 57 #define HIIR_KEY_UP 0x01 58 59 #define IR_CLOCK_REG_LENGTH 0x4 60 61 /* device parameter */ 62 typedef struct { 63 unsigned short int leads_min; 64 unsigned short int leads_max; 65 66 unsigned short int leade_min; 67 unsigned short int leade_max; 68 69 unsigned short int cnt0_b_min; 70 unsigned short int cnt0_b_max; 71 72 unsigned short int cnt1_b_min; 73 unsigned short int cnt1_b_max; 74 75 unsigned short int sleade_min; 76 unsigned short int sleade_max; 77 78 unsigned short int code_len; 79 unsigned short int codetype; 80 unsigned short int frequence; 81 } hiir_dev_param; 82 83 typedef struct { 84 unsigned long irkey_datah; 85 unsigned long irkey_datal; 86 unsigned long irkey_state_code; 87 } irkey_info_s; 88 89 int hiir_init(void); 90 void hiir_exit(void); 91 92 #ifdef __cplusplus 93 } 94 #endif /* __cplusplus */ 95 96 #endif /* End of #ifndef __HI_IR_H__ */ 97