1 /* 2 * Copyright (c) 2013-2015 liming@allwinnertech.com 3 * 4 * This program is free software; you can redistribute it and/or modify it 5 * under the terms of the GNU General Public License version 2 as published by 6 * the Free Software Foundation. 7 */ 8 #ifndef _INIT_INPUT_H 9 #define _INIT_INPUT_H 10 //#include <mach/system.h> 11 12 //#include <mach/hardware.h> 13 14 //this *.h already include in linux/sys_config.h 15 //#include <mach/sys_config.h> 16 17 #include <linux/interrupt.h> 18 #include <linux/regulator/consumer.h> 19 20 typedef u32 (*gpio_int_handle)(void *para); 21 22 struct gpio_config { 23 u32 data; 24 u32 gpio; 25 u32 mul_sel; 26 u32 pull; 27 u32 drv_level; 28 }; 29 30 enum input_sensor_type { 31 CTP_TYPE, 32 GSENSOR_TYPE, 33 GYR_TYPE, 34 COMPASS_TYPE, 35 LS_TYPE, 36 MOTOR_TYPE, 37 }; 38 39 struct sensor_config_info { 40 enum input_sensor_type input_type; 41 int sensor_used; 42 int isI2CClient; 43 __u32 twi_id; 44 const char *np_name; 45 u32 int_number; 46 struct gpio_config irq_gpio; 47 char *ldo; 48 struct device *dev; 49 struct pinctrl *pinctrl; 50 const char *sensor_power; 51 u32 sensor_power_vol; 52 struct device_node *node; 53 struct regulator *sensor_power_ldo; 54 }; 55 56 struct ctp_config_info { 57 enum input_sensor_type input_type; 58 int ctp_used; 59 int isI2CClient; 60 __u32 twi_id; 61 const char *name; 62 const char *np_name; 63 int screen_max_x; 64 int screen_max_y; 65 int revert_x_flag; 66 int revert_y_flag; 67 int exchange_x_y_flag; 68 int ctp_gesture_wakeup; 69 u32 int_number; 70 unsigned char device_detect; 71 const char *ctp_power; 72 u32 ctp_power_vol; 73 struct gpio_config ctp_power_io; 74 struct regulator *ctp_power_ldo; 75 struct gpio_config irq_gpio; 76 struct gpio_config wakeup_gpio; 77 #ifdef TOUCH_KEY_LIGHT_SUPPORT 78 struct gpio_config key_light_gpio; 79 #endif 80 struct device *dev; 81 struct device_node *node; 82 struct pinctrl *pinctrl; 83 int probed; 84 }; 85 86 struct motor_config_info { 87 enum input_sensor_type input_type; 88 int motor_used; 89 int vibe_off; 90 u32 ldo_voltage; 91 const char *ldo; 92 struct regulator *motor_power_ldo; 93 struct device *dev; 94 struct gpio_config motor_gpio; 95 }; 96 97 int input_fetch_sysconfig_para(enum input_sensor_type *input_type); 98 void input_free_platform_resource(enum input_sensor_type *input_type); 99 int input_init_platform_resource(enum input_sensor_type *input_type); 100 int input_request_int(enum input_sensor_type *input_type, irq_handler_t handle, 101 unsigned long trig_type, void *para); 102 int input_free_int(enum input_sensor_type *input_type, void *para); 103 int input_set_int_enable(enum input_sensor_type *input_type, u32 enable); 104 int input_set_int_enable_force(enum input_sensor_type *input_type, u32 enable); 105 int input_set_power_enable(enum input_sensor_type *input_type, u32 enable); 106 int input_sensor_startup(enum input_sensor_type *input_type); 107 int input_sensor_init(enum input_sensor_type *input_type); 108 void input_sensor_free(enum input_sensor_type *input_type); 109 #endif 110