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 19 #ifndef __DRV_GPIO_IOCTL_H__ 20 #define __DRV_GPIO_IOCTL_H__ 21 22 #include "drv_gpio_struct.h" 23 24 typedef enum { 25 GPIO_OUTPUTTYPE_CMOS, 26 GPIO_OUTPUTTYPE_OD, 27 GPIO_OUTPUTTYPE_BUTT, 28 } gpio_outputtype; 29 30 typedef struct { 31 hi_u32 gpio_no; 32 gpio_outputtype en_output_type; 33 } gpio_output_type; 34 35 typedef struct { 36 hi_u32 gpio_no; 37 hi_bool b_input; 38 } gpio_direct; 39 40 typedef struct { 41 hi_u32 gpio_no; 42 hi_bool b_high_volt; 43 } gpio_value; 44 45 46 /* Ioctl definitions */ 47 #define CMD_GPIO_SET_INT_TYPE _IOW(HI_ID_GPIO, 0x1, gpio_data) /* set interruput condition */ 48 #define CMD_GPIO_SET_INT_ENABLE _IOW(HI_ID_GPIO, 0x2, gpio_data) /* set interruput enable or disable */ 49 #define CMD_GPIO_GET_INT _IOWR(HI_ID_GPIO, 0x3, gpio_int) /* get interruput occur */ 50 #define CMD_GPIO_GET_GPIONUM _IOR(HI_ID_GPIO, 0x4, gpio_get_gpionum) /* get gpio max number and group number */ 51 #define CMD_GPIO_SET_OUTPUTTYPE _IOW(HI_ID_GPIO, 0x5, gpio_output_type) 52 #define CMD_GPIO_GET_OUTPUTTYPE _IOWR(HI_ID_GPIO, 0x6, gpio_output_type) 53 #define CMD_GPIO_SET_DIRECT _IOW(HI_ID_GPIO, 0x7, gpio_direct) 54 #define CMD_GPIO_GET_DIRECT _IOWR(HI_ID_GPIO, 0x8, gpio_direct) 55 #define CMD_GPIO_SET_VALUE _IOW(HI_ID_GPIO, 0x9, gpio_value) 56 #define CMD_GPIO_GET_VALUE _IOWR(HI_ID_GPIO, 0xa, gpio_value) 57 58 #endif /* End of #ifndef __HI_DRV_GPIO_H__ */ 59