From b3d99a0831f8f3cccd996bb55dd96ba008074da6 Mon Sep 17 00:00:00 2001 From: baitong Date: Fri, 23 Nov 2018 20:47:56 +0800 Subject: [PATCH] (CR):[Kane]:FPS:modify fingerprint can not wake up device Change-Id: Id61289415da03d1743d743ade98b4e69d90c23b7 Signed-off-by: baitong --- drivers/input/egistec/Makefile | 3 +- drivers/input/egistec/et320-int.c | 149 ++++++++++--- drivers/input/egistec/et320.h | 325 ++++++++++++++--------------- drivers/input/egistec/navi_input.c | 44 ++-- 4 files changed, 315 insertions(+), 206 deletions(-) diff --git a/drivers/input/egistec/Makefile b/drivers/input/egistec/Makefile index b9c0fd2e9782..86370c2dfa8c 100755 --- a/drivers/input/egistec/Makefile +++ b/drivers/input/egistec/Makefile @@ -5,6 +5,7 @@ # Each configuration option enables a list of files. -obj-$(CONFIG_INPUT_EGISTEC_320) += et320-int.o +obj-$(CONFIG_INPUT_EGISTEC_320) += et320-int.o +obj-$(CONFIG_INPUT_EGISTEC_320) += navi_input.o # navi_input.o diff --git a/drivers/input/egistec/et320-int.c b/drivers/input/egistec/et320-int.c index 50f363889949..818a64fb5490 100755 --- a/drivers/input/egistec/et320-int.c +++ b/drivers/input/egistec/et320-int.c @@ -49,23 +49,27 @@ #include "et320.h" #include "navi_input.h" +#define FP_SPICLK_ENABLE 0xaa +#define FP_SPICLK_DISABLE 0xab + #define EDGE_TRIGGER_FALLING 0x0 #define EDGE_TRIGGER_RAISING 0x1 #define LEVEL_TRIGGER_LOW 0x2 #define LEVEL_TRIGGER_HIGH 0x3 -#define EGIS_NAVI_INPUT 0 /* 1:open ; 0:close */ +#define EGIS_NAVI_INPUT 1 /* 1:open ; 0:close */ struct wake_lock et320_wake_lock; /* * FPS interrupt table */ +struct clk *fp_spi_clk, *fp_spi_busclk0; struct interrupt_desc fps_ints = {0 , 0, "BUT0" , 0}; -unsigned int bufsiz = 4096; +static unsigned int bufsiz = 4096; -int gpio_irq; -int request_irq_done = 0; +static int gpio_irq; +static int request_irq_done; /* int t_mode = 255; */ #define EDGE_TRIGGER_FALLING 0x0 @@ -73,13 +77,14 @@ int request_irq_done = 0; #define LEVEL_TRIGGER_LOW 0x2 #define LEVEL_TRIGGER_HIGH 0x3 -#define GPIO_LDO1P8_EN (1) +#define GPIO_LDO1P8_EN (1) #define GPIO_LDO3P3_EN (1) struct ioctl_cmd { int int_mode; int detect_period; int detect_threshold; +int clk_enable; }; /* To be compatible with fpc driver */ #ifndef CONFIG_SENSORS_FPC_1020 @@ -370,8 +375,74 @@ int Interrupt_Free(struct etspi_data *etspi) return 0; } +static int spi_spp_clk_enable(struct platform_device *pdev, int bonoff) +{ + DEBUG_PRINT("%s line:%d enable spi clk\n", __func__,__LINE__); + fp_spi_clk = clk_get(&pdev->dev, "spi"); + if (IS_ERR(fp_spi_clk)) { + DEBUG_PRINT("%s line:%d Can't get fp_spi_clk\n", __func__,__LINE__); + return -1; + } + + fp_spi_busclk0 = clk_get(&pdev->dev, "spi_busclk0"); + if (IS_ERR(fp_spi_busclk0)) { + DEBUG_PRINT("%s line:%d Can't get fp_spi_busclk0\n", __func__,__LINE__); + return -1; + } + + DEBUG_PRINT("%s line:%d enable spi clk okxxxxx\n", __func__,__LINE__); + if (bonoff == 1) { + DEBUG_PRINT("%s line:%d enable spi clk\n", __func__,__LINE__); + clk_prepare_enable(fp_spi_clk); + clk_prepare_enable(fp_spi_busclk0); + clk_set_rate(fp_spi_clk, 10000000*4); + clk_set_rate(fp_spi_busclk0, 10000000*4); + } else { + DEBUG_PRINT("%s line:%d disable spi clk\n", __func__,__LINE__); + clk_disable_unprepare(fp_spi_clk); + clk_disable_unprepare(fp_spi_busclk0); + clk_put(fp_spi_clk); + clk_put(fp_spi_busclk0); + fp_spi_clk = NULL; + fp_spi_busclk0 = NULL; + } + return 0; +} + + +static int spi_clk_enable(struct etspi_data *etspi, int bonoff) +{ + DEBUG_PRINT("%s line:%d enable spi clk\n", __func__,__LINE__); + fp_spi_clk = clk_get(&etspi->spi->dev, "spi"); + if (IS_ERR(fp_spi_clk)) { + DEBUG_PRINT("%s line:%d Can't get fp_spi_clk\n", __func__,__LINE__); + return -1; + } + + fp_spi_busclk0 = clk_get(&etspi->spi->dev, "spi_busclk0"); + if (IS_ERR(fp_spi_busclk0)) { + DEBUG_PRINT("%s line:%d Can't get fp_spi_busclk0\n", __func__,__LINE__); + return -1; + } + if (bonoff == 1) { + DEBUG_PRINT("%s line:%d enable spi clk\n", __func__,__LINE__); + clk_prepare_enable(fp_spi_clk); + clk_prepare_enable(fp_spi_busclk0); + clk_set_rate(fp_spi_clk, 10000000*4); + clk_set_rate(fp_spi_busclk0, 10000000*4); + } else { + DEBUG_PRINT("%s line:%d disable spi clk\n", __func__,__LINE__); + clk_disable_unprepare(fp_spi_clk); + clk_disable_unprepare(fp_spi_busclk0); + clk_put(fp_spi_clk); + clk_put(fp_spi_busclk0); + fp_spi_clk = NULL; + fp_spi_busclk0 = NULL; + } + return 0; +} /* * FUNCTION NAME. @@ -492,6 +563,17 @@ static long etspi_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) DEBUG_PRINT("etspi:fp_ioctl <<< fp Trigger function abort\n"); fps_interrupt_abort(); goto done; + case FP_SET_SPI_CLOCK: + case FP_SPICLK_ENABLE: + case FP_SPICLK_DISABLE: + if (copy_from_user(&data, (int __user *)arg, sizeof(data))) { + retval = -EFAULT; + goto done; + } + DEBUG_PRINT("fp_ioctl <<< FP_SPICLK_ENABLE_DISABLE ------- \n"); + DEBUG_PRINT("etspi:fp_ioctl spi_clk_enable = %x\n", data.clk_enable); + spi_clk_enable(etspi, data.clk_enable); + goto done; default: retval = -ENOTTY; break; @@ -587,7 +669,7 @@ int etspi_platformInit(struct etspi_data *etspi) if (etspi != NULL) { /* initial 18V power pin */ -#if GPIO_LDO1P8_EN +#if GPIO_LDO1P8_EN status = gpio_request(etspi->vdd_18v_Pin, "fp_18v-gpio"); if (status < 0) { pr_err("%s gpio_requset vdd_18v_Pin failed\n", @@ -666,7 +748,7 @@ etspi_platformInit_gpio_init_failed: #if GPIO_LDO3P3_EN gpio_free(etspi->vcc_33v_Pin); #endif -#if GPIO_LDO1P8_EN +#if GPIO_LDO1P8_EN gpio_free(etspi->vdd_18v_Pin); #endif etspi_platformInit_irq_failed: @@ -710,7 +792,7 @@ static int etspi_parse_dt(struct device *dev, pr_info("%s: 3.3v power pin=%d\n", __func__, data->vcc_33v_Pin); } #endif -#if GPIO_LDO1P8_EN +#if GPIO_LDO1P8_EN gpio = of_get_named_gpio(np, "egistec,gpio_ldo1p8_en", 0); if (gpio < 0) { errorno = gpio; @@ -719,7 +801,7 @@ static int etspi_parse_dt(struct device *dev, data->vdd_18v_Pin = gpio; pr_info("%s: 18v power pin=%d\n", __func__, data->vdd_18v_Pin); } -#endif +#endif DEBUG_PRINT("%s is successful\n", __func__); return errorno; dt_exit: @@ -744,6 +826,8 @@ static const struct file_operations etspi_fops = { static struct class *etspi_class; static int etspi_probe(struct platform_device *pdev); +static int etspi_resume(struct platform_device *pdev); +static int etspi_suspend(struct platform_device *pdev, pm_message_t state); static int etspi_remove(struct platform_device *pdev); #if 0 @@ -846,8 +930,10 @@ static struct platform_driver etspi_driver = { .owner = THIS_MODULE, .of_match_table = etspi_match_table, }, - .probe = etspi_probe, - .remove = etspi_remove, + .probe = etspi_probe, + .remove = etspi_remove, + .resume = etspi_resume, + .suspend = etspi_suspend, }; /* remark for dual sensors */ /* module_platform_driver(etspi_driver); */ @@ -865,12 +951,27 @@ static int etspi_remove(struct platform_device *pdev) return 0; } +static int etspi_resume(struct platform_device *pdev) +{ + DEBUG_PRINT("%s(#%d)\n", __func__, __LINE__); + spi_spp_clk_enable(pdev , 1); + return 0; +} + +static int etspi_suspend(struct platform_device *pdev, pm_message_t state) +{ + DEBUG_PRINT("%s(#%d)\n", __func__, __LINE__); + spi_spp_clk_enable(pdev , 0); + return 0; +} + + + #define PINCTRL_STATE_DEFAULT "default" static int etspi_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct etspi_data *etspi; - struct clk *fp_spi_clk, *fp_spi_busclk0; struct pinctrl *pinctrlfpc; struct pinctrl_state *gpioState; int status = 0; @@ -879,44 +980,42 @@ static int etspi_probe(struct platform_device *pdev) DEBUG_PRINT("%s initial\n", __func__); pinctrlfpc = devm_pinctrl_get(&pdev->dev); - if (IS_ERR(pinctrlfpc)) + if (IS_ERR(pinctrlfpc)) { status = PTR_ERR(pinctrlfpc); pr_err("Cannot find pinctrl!\n"); return -1; } gpioState = pinctrl_lookup_state(pinctrlfpc, PINCTRL_STATE_DEFAULT); - if (IS_ERR(gpioState)) - { + if (IS_ERR(gpioState)) + { status = PTR_ERR(gpioState); pr_err("%s pinctrl_lookup_state fail %d\n", __func__, status); return -1; - } + } status =pinctrl_select_state(pinctrlfpc, gpioState); if (status) { pr_err("pinctrl_select_state failed\n"); return -1; } - + fp_spi_clk = clk_get(&pdev->dev, "spi"); if (IS_ERR(fp_spi_clk)) { pr_err("Can't get fp_spi_clk\n"); - return -1; - } - + return -1; + } + fp_spi_busclk0 = clk_get(&pdev->dev, "spi_busclk0"); if (IS_ERR(fp_spi_busclk0)) { pr_err("Can't get fp_spi_busclk0\n"); - return -1; - } - + return -1; + } + clk_prepare_enable(fp_spi_clk); clk_prepare_enable(fp_spi_busclk0); clk_set_rate(fp_spi_clk, 10000000*4); clk_set_rate(fp_spi_busclk0, 10000000*4); - clk_put(fp_spi_clk); - clk_put(fp_spi_busclk0); BUILD_BUG_ON(N_SPI_MINORS > 256); status = register_chrdev(ET320_MAJOR, "et320", &etspi_fops); diff --git a/drivers/input/egistec/et320.h b/drivers/input/egistec/et320.h index 1c6d262d3a50..17a8d03cf381 100755 --- a/drivers/input/egistec/et320.h +++ b/drivers/input/egistec/et320.h @@ -1,163 +1,162 @@ -#ifndef _FP_LINUX_DIRVER_H_ -#define _FP_LINUX_DIRVER_H_ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - - -/*#define FP_SPI_DEBUG*/ -#define FP_SPI_DEBUG - -#ifdef FP_SPI_DEBUG -#define DEBUG_PRINT(fmt, args...) pr_err(fmt, ## args) -#else -#define DEBUG_PRINT(fmt, args...) -#endif - -#define ET320_MAJOR 100 /* assigned */ -#define N_SPI_MINORS 32 /* ... up to 256 */ - -#define FP_ADDRESS_0 0x00 -#define FP_WRITE_ADDRESS 0xAC -#define FP_READ_DATA 0xAF -#define FP_WRITE_DATA 0xAE - -/* ------------------------- Register Definition ------------------------*/ -/* - * Sensor Registers - */ - -#define FDATA_FP_ADDR 0x00 -#define FSTATUS_FP_ADDR 0x01 -/* - * Detect Define - */ -#define FRAME_READY_MASK 0x01 - -/* ------------------------- Opcode -------------------------------------*/ -#define FP_REGISTER_READ 0x01 -#define FP_REGISTER_WRITE 0x02 -#define FP_GET_ONE_IMG 0x03 -#define FP_SENSOR_RESET 0x04 -#define FP_POWER_ONOFF 0x05 -#define FP_SET_SPI_CLOCK 0x06 -#define FP_RESET_SET 0x07 - -/* trigger signal initial routine*/ -#define INT_TRIGGER_INIT 0xa4 -/* trigger signal close routine*/ -#define INT_TRIGGER_CLOSE 0xa5 -/* read trigger status*/ -#define INT_TRIGGER_READ 0xa6 -/* polling trigger status*/ -#define INT_TRIGGER_POLLING 0xa7 -/* polling abort*/ -#define INT_TRIGGER_ABORT 0xa8 -#define FP_TRANSFER_SYNC 0xAA - -#define DRDY_IRQ_ENABLE 1 -#define DRDY_IRQ_DISABLE 0 - -/* interrupt polling */ -unsigned int fps_interrupt_poll( - struct file *file, - struct poll_table_struct *wait -); -struct interrupt_desc { - int gpio; - int number; - char *name; - int int_count; - struct timer_list timer; - bool finger_on; - int detect_period; - int detect_threshold; - bool drdy_irq_flag; -}; - -/* ------------------------- Structure ------------------------------*/ -struct egis_ioc_transfer { - u8 *tx_buf; - u8 *rx_buf; - - __u32 len; - __u32 speed_hz; - - __u16 delay_usecs; - __u8 bits_per_word; - __u8 cs_change; - __u8 opcode; - __u8 pad[3]; - -}; - -#define EGIS_IOC_MAGIC 'k' -#define EGIS_MSGSIZE(N) \ - ((((N)*(sizeof(struct egis_ioc_transfer))) < (1 << _IOC_SIZEBITS)) \ - ? ((N)*(sizeof(struct egis_ioc_transfer))) : 0) -#define EGIS_IOC_MESSAGE(N) _IOW(EGIS_IOC_MAGIC, 0, char[EGIS_MSGSIZE(N)]) - -struct etspi_data { - dev_t devt; - spinlock_t spi_lock; -// struct spi_device *spi; - struct platform_device *spi; - struct list_head device_entry; - - /* buffer is NULL unless this device is open (users > 0) */ - struct mutex buf_lock; - unsigned users; - u8 *buffer; - - unsigned int irqPin; /* interrupt GPIO pin number */ - unsigned int rstPin; /* Reset GPIO pin number */ - - unsigned int vdd_18v_Pin; /* Reset GPIO pin number */ - unsigned int vcc_33v_Pin; /* Reset GPIO pin number */ - struct input_dev *input_dev; - bool property_navigation_enable; - -}; - - -/* ------------------------- Interrupt ------------------------------*/ -/* interrupt init */ -int Interrupt_Init( - struct etspi_data *etspi, - int int_mode, - int detect_period, - int detect_threshold); - -/* interrupt free */ -int Interrupt_Free(struct etspi_data *etspi); - -void fps_interrupt_abort(void); - -/* ------------------------- Data Transfer --------------------------*/ -/*[REM] int fp_io_read_register(struct fp_data *fp, u8 *addr, u8 *buf); */ -/*[REM] int fp_io_write_register(struct fp_data *fp, u8 *buf);*/ -/*[REM] int fp_io_get_one_image(struct fp_data *fp, u8 *buf, u8 *image_buf);*/ -/*[REM] int fp_read_register(struct fp_data *fp, u8 addr, u8 *buf);*/ -/*[REM] int fp_mass_read(struct fp_data *fp, u8 addr, u8 *buf, int read_len);*/ -#endif +#ifndef _FP_LINUX_DIRVER_H_ +#define _FP_LINUX_DIRVER_H_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +/*#define FP_SPI_DEBUG*/ +#define FP_SPI_DEBUG + +#ifdef FP_SPI_DEBUG +#define DEBUG_PRINT(fmt, args...) pr_err(fmt, ## args) +#else +#define DEBUG_PRINT(fmt, args...) +#endif + +#define ET320_MAJOR 100 /* assigned */ +#define N_SPI_MINORS 32 /* ... up to 256 */ + +#define FP_ADDRESS_0 0x00 +#define FP_WRITE_ADDRESS 0xAC +#define FP_READ_DATA 0xAF +#define FP_WRITE_DATA 0xAE + +/* ------------------------- Register Definition ------------------------*/ +/* + * Sensor Registers + */ + +#define FDATA_FP_ADDR 0x00 +#define FSTATUS_FP_ADDR 0x01 +/* + * Detect Define + */ +#define FRAME_READY_MASK 0x01 + +/* ------------------------- Opcode -------------------------------------*/ +#define FP_REGISTER_READ 0x01 +#define FP_REGISTER_WRITE 0x02 +#define FP_GET_ONE_IMG 0x03 +#define FP_SENSOR_RESET 0x04 +#define FP_POWER_ONOFF 0x05 +#define FP_SET_SPI_CLOCK 0x06 +#define FP_RESET_SET 0x07 + +/* trigger signal initial routine*/ +#define INT_TRIGGER_INIT 0xa4 +/* trigger signal close routine*/ +#define INT_TRIGGER_CLOSE 0xa5 +/* read trigger status*/ +#define INT_TRIGGER_READ 0xa6 +/* polling trigger status*/ +#define INT_TRIGGER_POLLING 0xa7 +/* polling abort*/ +#define INT_TRIGGER_ABORT 0xa8 +#define FP_TRANSFER_SYNC 0xAA + +#define DRDY_IRQ_ENABLE 1 +#define DRDY_IRQ_DISABLE 0 + +/* interrupt polling */ +unsigned int fps_interrupt_poll( + struct file *file, + struct poll_table_struct *wait +); +struct interrupt_desc { + int gpio; + int number; + char *name; + int int_count; + struct timer_list timer; + bool finger_on; + int detect_period; + int detect_threshold; + bool drdy_irq_flag; +}; + +/* ------------------------- Structure ------------------------------*/ +struct egis_ioc_transfer { + u8 *tx_buf; + u8 *rx_buf; + + __u32 len; + __u32 speed_hz; + + __u16 delay_usecs; + __u8 bits_per_word; + __u8 cs_change; + __u8 opcode; + __u8 pad[3]; + +}; + +#define EGIS_IOC_MAGIC 'k' +#define EGIS_MSGSIZE(N) \ + ((((N)*(sizeof(struct egis_ioc_transfer))) < (1 << _IOC_SIZEBITS)) \ + ? ((N)*(sizeof(struct egis_ioc_transfer))) : 0) +#define EGIS_IOC_MESSAGE(N) _IOW(EGIS_IOC_MAGIC, 0, char[EGIS_MSGSIZE(N)]) + +struct etspi_data { + dev_t devt; + spinlock_t spi_lock; +// struct spi_device *spi; + struct platform_device *spi; + struct list_head device_entry; + + /* buffer is NULL unless this device is open (users > 0) */ + struct mutex buf_lock; + unsigned users; + u8 *buffer; + + unsigned int irqPin; /* interrupt GPIO pin number */ + unsigned int rstPin; /* Reset GPIO pin number */ + + unsigned int vdd_18v_Pin; /* Reset GPIO pin number */ + unsigned int vcc_33v_Pin; /* Reset GPIO pin number */ + struct input_dev *input_dev; + bool property_navigation_enable; +}; + + +/* ------------------------- Interrupt ------------------------------*/ +/* interrupt init */ +int Interrupt_Init( + struct etspi_data *etspi, + int int_mode, + int detect_period, + int detect_threshold); + +/* interrupt free */ +int Interrupt_Free(struct etspi_data *etspi); + +void fps_interrupt_abort(void); + +/* ------------------------- Data Transfer --------------------------*/ +/*[REM] int fp_io_read_register(struct fp_data *fp, u8 *addr, u8 *buf); */ +/*[REM] int fp_io_write_register(struct fp_data *fp, u8 *buf);*/ +/*[REM] int fp_io_get_one_image(struct fp_data *fp, u8 *buf, u8 *image_buf);*/ +/*[REM] int fp_read_register(struct fp_data *fp, u8 addr, u8 *buf);*/ +/*[REM] int fp_mass_read(struct fp_data *fp, u8 addr, u8 *buf, int read_len);*/ +#endif diff --git a/drivers/input/egistec/navi_input.c b/drivers/input/egistec/navi_input.c index c56e2fe2bb0d..f645cba92dd3 100755 --- a/drivers/input/egistec/navi_input.c +++ b/drivers/input/egistec/navi_input.c @@ -33,7 +33,7 @@ struct navi_cmd_struct cmd_list; /***************************************************************** * * -* Configuration * +* Configuration * * * *****************************************************************/ @@ -54,8 +54,12 @@ struct navi_cmd_struct cmd_list; * Don't care properties. */ -#define ENABLE_SWIPE_UP_DOWN DISABLE +#define ENABLE_SWIPE_UP_DOWN ENABLE +#ifdef CONFIG_INPUT_EGISTEC_FPS_NAVI_HORIZON +#define ENABLE_SWIPE_LEFT_RIGHT ENABLE +#else #define ENABLE_SWIPE_LEFT_RIGHT DISABLE +#endif #define ENABLE_FINGER_DOWN_UP DISABLE #define KEY_FPS_DOWN 614 #define KEY_FPS_UP 615 @@ -113,7 +117,7 @@ struct navi_cmd_struct cmd_list; #define KEYEVENT_LEFT KEY_FPS_YPLUS /* KEY_LEFT */ #define KEYEVENT_LEFT_ACTION KEY_PRESS_RELEASE #if ENABLE_FINGER_DOWN_UP -unsigned int prev_keycode = 0; +static unsigned int prev_keycode; #endif /* * @ TRANSLATED_COMMAND @@ -144,8 +148,8 @@ unsigned int prev_keycode = 0; * @ ENABLE_TRANSLATED_LONG_TOUCH * ENABLE/DISABLE : enable/disable long-touch event. */ -#define ENABLE_TRANSLATED_SINGLE_CLICK ENABLE -#define ENABLE_TRANSLATED_DOUBLE_CLICK ENABLE +#define ENABLE_TRANSLATED_SINGLE_CLICK DISABLE +#define ENABLE_TRANSLATED_DOUBLE_CLICK DISABLE #define ENABLE_TRANSLATED_LONG_TOUCH DISABLE @@ -176,7 +180,7 @@ unsigned int prev_keycode = 0; * KEY_PRESS_RELEASE : Combined action of press-then-release */ #define LONGTOUCH_INTERVAL 400 -#define SINGLECLICK_INTERVAL 200 +#define SINGLECLICK_INTERVAL 150 #define DOUBLECLICK_INTERVAL 150 @@ -289,7 +293,6 @@ static unsigned long g_SingleClickJiffies; static unsigned int g_SingleClick; - /* Set event bits according to what events we would generate */ void init_event_enable(struct etspi_data *etspi) { @@ -389,18 +392,18 @@ void translated_command_converter(char cmd, struct etspi_data *etspi) g_SingleClick, jiffies_to_msecs(jiffies - g_SingleClickJiffies), jiffies_to_msecs(jiffies - g_DoubleClickJiffies), jiffies_to_msecs(jiffies)); #if ENABLE_TRANSLATED_SINGLE_CLICK - if((jiffies - g_SingleClickJiffies) < (HZ * SINGLECLICK_INTERVAL / 1000)) { + if ((jiffies - g_SingleClickJiffies) < (HZ * SINGLECLICK_INTERVAL / 1000)) { /* Click event */ send_key_event(etspi, KEYEVENT_CLICK, KEYEVENT_CLICK_ACTION); g_SingleClick++; - if(g_SingleClick == 1) { + if (g_SingleClick == 1) { g_DoubleClickJiffies = jiffies; } } #endif #if ENABLE_TRANSLATED_DOUBLE_CLICK - if (g_SingleClick >= 2 ) { - if((jiffies - g_DoubleClickJiffies) < (HZ * (SINGLECLICK_INTERVAL+DOUBLECLICK_INTERVAL) / 1000)) { + if (g_SingleClick >= 2) { + if ((jiffies - g_DoubleClickJiffies) < (HZ * (SINGLECLICK_INTERVAL+DOUBLECLICK_INTERVAL) / 1000)) { /* Double click event */ send_key_event(etspi, KEYEVENT_DOUBLECLICK, KEYEVENT_DOUBLECLICK_ACTION); g_SingleClick = 0; @@ -411,7 +414,7 @@ void translated_command_converter(char cmd, struct etspi_data *etspi) } #endif - + #if ENABLE_FINGER_DOWN_UP send_key_event(etspi, KEYEVENT_OFF, KEYEVENT_OFF_ACTION); #endif @@ -580,15 +583,18 @@ static ssize_t navigation_event_func(struct device *dev, if (etspi->input_dev == NULL) pr_err("Egis navigation driver, etspi->input_dev is NULL\n"); + + tempcmd = kmalloc(sizeof(*tempcmd), GFP_KERNEL); - if (tempcmd != NULL) { + if(tempcmd != NULL) { mutex_lock(&driver_mode_lock); tempcmd->cmd = *buf; + list_add_tail(&tempcmd->list, &cmd_list.list); nav_input_sig = 1; mutex_unlock(&driver_mode_lock); wake_up_interruptible(&nav_input_wait); - } else { + }else { pr_err("navigation_event_func kmalloc failed\n"); } @@ -644,16 +650,20 @@ static int nav_input_thread(void *et_spi) { struct etspi_data *etspi = et_spi; struct navi_cmd_struct *tempcmd, *acmd; - set_user_nice(current, -20); + DEBUG_PRINT("nav_input_thread enter\n"); + while (1) { wait_event_interruptible(nav_input_wait, nav_input_sig || kthread_should_stop()); + mutex_lock(&driver_mode_lock); + list_for_each_entry_safe(acmd, tempcmd, &cmd_list.list, list) { - translated_command_converter(acmd->cmd, etspi); + //access the member from aPerson + translated_command_converter(acmd->cmd,etspi); list_del(&acmd->list); kfree(acmd); } @@ -687,7 +697,7 @@ void uinput_egis_init(struct etspi_data *etspi) INIT_LIST_HEAD(&cmd_list.list); nav_input_sig = 0; - if (!nav_kthread) { + if(!nav_kthread) { nav_kthread = kthread_run(nav_input_thread, (void *)etspi, "nav_thread"); } -- 2.20.1