1 /* 2 * Copyright (C) 2022 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 #ifndef __DRV_I2C_IOCTL_H__ 19 #define __DRV_I2C_IOCTL_H__ 20 21 #include "drv_i2c_struct.h" 22 23 typedef struct { 24 hi_u32 i2c_num; 25 hi_u8 i2c_dev_addr; 26 hi_u32 i2c_reg_addr; 27 hi_u32 i2c_reg_count; 28 hi_u64 p_data; 29 hi_u32 data_len; 30 } i2c_data; 31 32 typedef struct { 33 hi_u32 i2c_num; 34 hi_u32 i2c_rate; 35 } i2c_rate; 36 37 typedef struct { 38 hi_u32 i2c_num; 39 hi_u32 scl_gpio_no; 40 hi_u32 sda_gpio_no; 41 hi_bool b_used; 42 hi_u32 count; 43 } i2c_gpio; 44 45 /* Ioctl definitions */ 46 #define CMD_I2C_READ _IOW(HI_ID_I2C, 0x1, i2c_data) // 1:check keyup 47 #define CMD_I2C_WRITE _IOW(HI_ID_I2C, 0x2, i2c_data) // 1:check repkey, 0:hardware behave 48 #define CMD_I2C_SET_RATE _IOW(HI_ID_I2C, 0x3, i2c_rate) 49 #define CMD_I2C_CONFIG _IOWR(HI_ID_I2C, 0x4, i2c_gpio) // config gpioi2c 50 #define CMD_I2C_DESTROY _IOW(HI_ID_I2C, 0x5, i2c_gpio) // destroy gpioi2c 51 #define CMD_I2C_READ_DIRECT _IOW(HI_ID_I2C, 0x6, i2c_data) 52 53 #endif /* End of #ifndef __DRV_I2C_IOCTL_H__ */ 54