(CR):[Kane]:FPS:modify fingerprint can not wake up device
authorbaitong <baitong@huaqin.com>
Fri, 23 Nov 2018 12:47:56 +0000 (20:47 +0800)
committerxiest1 <xiest1@lenovo.com>
Tue, 5 Nov 2019 09:29:59 +0000 (17:29 +0800)
Change-Id: Id61289415da03d1743d743ade98b4e69d90c23b7
Signed-off-by: baitong <baitong@huaqin.com>
drivers/input/egistec/Makefile
drivers/input/egistec/et320-int.c
drivers/input/egistec/et320.h
drivers/input/egistec/navi_input.c

index b9c0fd2e9782715f0252657e05e645cb7270668c..86370c2dfa8c31cccbe37591accc983afe504d85 100755 (executable)
@@ -5,6 +5,7 @@
 # Each configuration option enables a list of files.
 
 
-obj-$(CONFIG_INPUT_EGISTEC_320) += et320-int.o\r
+obj-$(CONFIG_INPUT_EGISTEC_320) += et320-int.o
+obj-$(CONFIG_INPUT_EGISTEC_320) += navi_input.o\r
 # navi_input.o
 
index 50f36388994964719db3adb7b4cd0787fc08fce9..818a64fb5490acf7a1f40430435ce7157744d32c 100755 (executable)
 #include "et320.h"\r
 #include "navi_input.h"\r
 \r
+#define FP_SPICLK_ENABLE                       0xaa\r
+#define FP_SPICLK_DISABLE                      0xab\r
+\r
 #define EDGE_TRIGGER_FALLING    0x0\r
 #define        EDGE_TRIGGER_RAISING    0x1\r
 #define        LEVEL_TRIGGER_LOW       0x2\r
 #define        LEVEL_TRIGGER_HIGH      0x3\r
-#define EGIS_NAVI_INPUT 0  /* 1:open ; 0:close */\r
+#define EGIS_NAVI_INPUT 1  /* 1:open ; 0:close */\r
 struct wake_lock et320_wake_lock;\r
 \r
 /*\r
  * FPS interrupt table\r
  */\r
+struct clk *fp_spi_clk, *fp_spi_busclk0;\r
 \r
 struct interrupt_desc fps_ints = {0 , 0, "BUT0" , 0};\r
 \r
-unsigned int bufsiz = 4096;\r
+static unsigned int bufsiz = 4096;\r
 \r
-int gpio_irq;\r
-int request_irq_done = 0;\r
+static int gpio_irq;\r
+static int request_irq_done;\r
 /* int t_mode = 255; */\r
 \r
 #define EDGE_TRIGGER_FALLING    0x0\r
@@ -73,13 +77,14 @@ int request_irq_done = 0;
 #define LEVEL_TRIGGER_LOW       0x2\r
 #define LEVEL_TRIGGER_HIGH      0x3\r
 \r
-#define GPIO_LDO1P8_EN (1)
+#define GPIO_LDO1P8_EN (1)\r
 #define GPIO_LDO3P3_EN (1)\r
 \r
 struct ioctl_cmd {\r
 int int_mode;\r
 int detect_period;\r
 int detect_threshold;\r
+int clk_enable;\r
 };\r
 /* To be compatible with fpc driver */\r
 #ifndef CONFIG_SENSORS_FPC_1020\r
@@ -370,8 +375,74 @@ int Interrupt_Free(struct etspi_data *etspi)
        return 0;\r
 }\r
 \r
+static int spi_spp_clk_enable(struct platform_device *pdev, int bonoff)\r
+{\r
+       DEBUG_PRINT("%s line:%d enable spi clk\n", __func__,__LINE__);\r
+       fp_spi_clk = clk_get(&pdev->dev, "spi");\r
+       if (IS_ERR(fp_spi_clk)) {\r
+               DEBUG_PRINT("%s line:%d Can't get fp_spi_clk\n", __func__,__LINE__);\r
+               return -1;\r
+       }\r
+\r
+       fp_spi_busclk0 = clk_get(&pdev->dev, "spi_busclk0");\r
+       if (IS_ERR(fp_spi_busclk0)) {\r
+               DEBUG_PRINT("%s line:%d Can't get fp_spi_busclk0\n", __func__,__LINE__);\r
+               return -1;\r
+       }\r
+\r
+       DEBUG_PRINT("%s line:%d enable spi clk okxxxxx\n", __func__,__LINE__);\r
+       if (bonoff == 1) {\r
+               DEBUG_PRINT("%s line:%d enable spi clk\n", __func__,__LINE__);\r
+               clk_prepare_enable(fp_spi_clk);\r
+               clk_prepare_enable(fp_spi_busclk0);\r
+               clk_set_rate(fp_spi_clk, 10000000*4);\r
+               clk_set_rate(fp_spi_busclk0, 10000000*4);\r
+       } else {\r
+               DEBUG_PRINT("%s line:%d disable spi clk\n", __func__,__LINE__);\r
+               clk_disable_unprepare(fp_spi_clk);\r
+               clk_disable_unprepare(fp_spi_busclk0);\r
+               clk_put(fp_spi_clk);\r
+               clk_put(fp_spi_busclk0);\r
+               fp_spi_clk = NULL;\r
+               fp_spi_busclk0 = NULL;\r
+       }\r
+    return 0;\r
+}\r
+\r
+\r
+static int spi_clk_enable(struct etspi_data *etspi, int bonoff)\r
+{\r
+       DEBUG_PRINT("%s line:%d enable spi clk\n", __func__,__LINE__);\r
+       fp_spi_clk = clk_get(&etspi->spi->dev, "spi");\r
+       if (IS_ERR(fp_spi_clk)) {\r
+               DEBUG_PRINT("%s line:%d Can't get fp_spi_clk\n", __func__,__LINE__);\r
+               return -1;\r
+       }\r
+\r
+       fp_spi_busclk0 = clk_get(&etspi->spi->dev, "spi_busclk0");\r
+       if (IS_ERR(fp_spi_busclk0)) {\r
+               DEBUG_PRINT("%s line:%d Can't get fp_spi_busclk0\n", __func__,__LINE__);\r
+               return -1;\r
+       }\r
 \r
+       if (bonoff == 1) {\r
 \r
+               DEBUG_PRINT("%s line:%d enable spi clk\n", __func__,__LINE__);\r
+               clk_prepare_enable(fp_spi_clk);\r
+               clk_prepare_enable(fp_spi_busclk0);\r
+               clk_set_rate(fp_spi_clk, 10000000*4);\r
+               clk_set_rate(fp_spi_busclk0, 10000000*4);\r
+       } else {\r
+               DEBUG_PRINT("%s line:%d disable spi clk\n", __func__,__LINE__);\r
+               clk_disable_unprepare(fp_spi_clk);\r
+               clk_disable_unprepare(fp_spi_busclk0);\r
+               clk_put(fp_spi_clk);\r
+               clk_put(fp_spi_busclk0);\r
+               fp_spi_clk = NULL;\r
+               fp_spi_busclk0 = NULL;\r
+       }\r
+    return 0;\r
+}\r
 \r
 /*\r
  *     FUNCTION NAME.\r
@@ -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");\r
                fps_interrupt_abort();\r
                goto done;\r
+       case FP_SET_SPI_CLOCK:\r
+       case FP_SPICLK_ENABLE:\r
+       case FP_SPICLK_DISABLE:\r
+               if (copy_from_user(&data, (int __user *)arg, sizeof(data))) {\r
+                       retval = -EFAULT;\r
+                       goto done;\r
+               }\r
+               DEBUG_PRINT("fp_ioctl <<< FP_SPICLK_ENABLE_DISABLE -------  \n");\r
+               DEBUG_PRINT("etspi:fp_ioctl spi_clk_enable = %x\n", data.clk_enable);\r
+               spi_clk_enable(etspi, data.clk_enable);\r
+               goto done;\r
        default:\r
        retval = -ENOTTY;\r
        break;\r
@@ -587,7 +669,7 @@ int etspi_platformInit(struct etspi_data *etspi)
 \r
        if (etspi != NULL) {\r
                /* initial 18V power pin */\r
-#if GPIO_LDO1P8_EN
+#if GPIO_LDO1P8_EN             \r
                status = gpio_request(etspi->vdd_18v_Pin, "fp_18v-gpio");\r
                if (status < 0) {\r
                        pr_err("%s gpio_requset vdd_18v_Pin failed\n",\r
@@ -666,7 +748,7 @@ etspi_platformInit_gpio_init_failed:
 #if GPIO_LDO3P3_EN\r
        gpio_free(etspi->vcc_33v_Pin);\r
 #endif\r
-#if GPIO_LDO1P8_EN
+#if GPIO_LDO1P8_EN \r
        gpio_free(etspi->vdd_18v_Pin);\r
 #endif\r
 etspi_platformInit_irq_failed:\r
@@ -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);\r
        }\r
 #endif\r
-#if GPIO_LDO1P8_EN
+#if GPIO_LDO1P8_EN     \r
        gpio = of_get_named_gpio(np, "egistec,gpio_ldo1p8_en", 0);\r
        if (gpio < 0) {\r
                errorno = gpio;\r
@@ -719,7 +801,7 @@ static int etspi_parse_dt(struct device *dev,
                data->vdd_18v_Pin = gpio;\r
                pr_info("%s: 18v power pin=%d\n", __func__, data->vdd_18v_Pin);\r
        }\r
-#endif
+#endif \r
        DEBUG_PRINT("%s is successful\n", __func__);\r
        return errorno;\r
 dt_exit:\r
@@ -744,6 +826,8 @@ static const struct file_operations etspi_fops = {
 static struct class *etspi_class;\r
 \r
 static int etspi_probe(struct platform_device *pdev);\r
+static int etspi_resume(struct platform_device *pdev);\r
+static int etspi_suspend(struct platform_device *pdev, pm_message_t state);\r
 static int etspi_remove(struct platform_device *pdev);\r
 \r
 #if 0\r
@@ -846,8 +930,10 @@ static struct platform_driver etspi_driver = {
                .owner          = THIS_MODULE,\r
                .of_match_table = etspi_match_table,\r
        },\r
-    .probe =    etspi_probe,\r
-    .remove =   etspi_remove,\r
+    .probe             =   etspi_probe,\r
+    .remove    =   etspi_remove,\r
+    .resume    =       etspi_resume,\r
+    .suspend   =       etspi_suspend,\r
 };\r
 /* remark for dual sensors */\r
 /* module_platform_driver(etspi_driver); */\r
@@ -865,12 +951,27 @@ static int etspi_remove(struct platform_device *pdev)
        return 0;\r
 }\r
 \r
+static int etspi_resume(struct platform_device *pdev)\r
+{\r
+       DEBUG_PRINT("%s(#%d)\n", __func__, __LINE__);\r
+       spi_spp_clk_enable(pdev , 1);\r
+       return 0;\r
+}\r
+\r
+static int etspi_suspend(struct platform_device *pdev, pm_message_t state)\r
+{\r
+       DEBUG_PRINT("%s(#%d)\n", __func__, __LINE__);\r
+       spi_spp_clk_enable(pdev , 0);\r
+       return 0;\r
+}\r
+\r
+\r
+\r
 #define PINCTRL_STATE_DEFAULT "default"\r
 static int etspi_probe(struct platform_device *pdev)\r
 {\r
        struct device *dev = &pdev->dev;\r
        struct etspi_data *etspi;\r
-       struct clk *fp_spi_clk, *fp_spi_busclk0;\r
        struct pinctrl *pinctrlfpc;\r
        struct pinctrl_state *gpioState;\r
        int status = 0;\r
@@ -879,44 +980,42 @@ static int etspi_probe(struct platform_device *pdev)
 \r
        DEBUG_PRINT("%s initial\n", __func__);\r
        pinctrlfpc = devm_pinctrl_get(&pdev->dev);\r
-       if (IS_ERR(pinctrlfpc)) \r
+       if (IS_ERR(pinctrlfpc))\r
        {\r
                status = PTR_ERR(pinctrlfpc);\r
                pr_err("Cannot find pinctrl!\n");\r
                return -1;\r
        }\r
        gpioState =  pinctrl_lookup_state(pinctrlfpc, PINCTRL_STATE_DEFAULT);\r
-       if (IS_ERR(gpioState)) \r
-        {\r
+       if (IS_ERR(gpioState))\r
+       {\r
                status = PTR_ERR(gpioState);\r
                pr_err("%s pinctrl_lookup_state fail %d\n", __func__, status);\r
                return -1;\r
-       } \r
+       }\r
        status =pinctrl_select_state(pinctrlfpc, gpioState);\r
        if (status)\r
        {\r
                pr_err("pinctrl_select_state failed\n");\r
                return -1;\r
        }\r
-       \r
+\r
        fp_spi_clk = clk_get(&pdev->dev, "spi");\r
        if (IS_ERR(fp_spi_clk)) {\r
                pr_err("Can't get fp_spi_clk\n");\r
-               return -1;
-       }
-
+               return -1;\r
+       }\r
+       \r
        fp_spi_busclk0 = clk_get(&pdev->dev, "spi_busclk0");\r
        if (IS_ERR(fp_spi_busclk0)) {\r
                pr_err("Can't get fp_spi_busclk0\n");\r
-               return -1;
-       }
-
+               return -1;\r
+       }\r
+       \r
        clk_prepare_enable(fp_spi_clk);\r
        clk_prepare_enable(fp_spi_busclk0);\r
        clk_set_rate(fp_spi_clk, 10000000*4);\r
        clk_set_rate(fp_spi_busclk0, 10000000*4);\r
-       clk_put(fp_spi_clk);\r
-       clk_put(fp_spi_busclk0);\r
 \r
        BUILD_BUG_ON(N_SPI_MINORS > 256);\r
        status = register_chrdev(ET320_MAJOR, "et320", &etspi_fops);\r
index 1c6d262d3a50f2777de00c722ce33734ed34da6f..17a8d03cf3816f00ba20726f609460afc2beb42b 100755 (executable)
-#ifndef _FP_LINUX_DIRVER_H_
-#define _FP_LINUX_DIRVER_H_
-
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/fs.h>
-#include <linux/init.h>
-#include <linux/delay.h>
-#include <linux/wait.h>
-#include <linux/timer.h>
-#include <linux/jiffies.h>
-#include <linux/poll.h>
-#include <linux/sched.h>
-#include <linux/irq.h>
-#include <asm/irq.h>
-#include <linux/io.h>
-#include <linux/interrupt.h>
-#include <linux/uaccess.h>
-#include <linux/platform_device.h>
-#include <linux/cdev.h>
-#include <linux/miscdevice.h>
-#include <linux/gpio.h>
-
-#include <linux/printk.h>
-#include <linux/module.h>
-#include <linux/spi/spi.h>
-
-
-/*#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_\r
+#define _FP_LINUX_DIRVER_H_\r
+\r
+#include <linux/module.h>\r
+#include <linux/kernel.h>\r
+#include <linux/fs.h>\r
+#include <linux/init.h>\r
+#include <linux/delay.h>\r
+#include <linux/wait.h>\r
+#include <linux/timer.h>\r
+#include <linux/jiffies.h>\r
+#include <linux/poll.h>\r
+#include <linux/sched.h>\r
+#include <linux/irq.h>\r
+#include <asm/irq.h>\r
+#include <linux/io.h>\r
+#include <linux/interrupt.h>\r
+#include <linux/uaccess.h>\r
+#include <linux/platform_device.h>\r
+#include <linux/cdev.h>\r
+#include <linux/miscdevice.h>\r
+#include <linux/gpio.h>\r
+\r
+#include <linux/printk.h>\r
+#include <linux/module.h>\r
+#include <linux/spi/spi.h>\r
+#include <linux/clk.h>\r
+\r
+/*#define FP_SPI_DEBUG*/\r
+#define FP_SPI_DEBUG\r
+\r
+#ifdef FP_SPI_DEBUG\r
+#define DEBUG_PRINT(fmt, args...) pr_err(fmt, ## args)\r
+#else\r
+#define DEBUG_PRINT(fmt, args...)\r
+#endif\r
+\r
+#define ET320_MAJOR                                    100 /* assigned */\r
+#define N_SPI_MINORS                           32  /* ... up to 256 */\r
+\r
+#define FP_ADDRESS_0                           0x00\r
+#define FP_WRITE_ADDRESS                       0xAC\r
+#define FP_READ_DATA                           0xAF\r
+#define FP_WRITE_DATA                          0xAE\r
+\r
+/* ------------------------- Register Definition ------------------------*/\r
+/*\r
+ * Sensor Registers\r
+ */\r
+\r
+#define FDATA_FP_ADDR                          0x00\r
+#define FSTATUS_FP_ADDR                                0x01\r
+/*\r
+ * Detect Define\r
+ */\r
+#define FRAME_READY_MASK                       0x01\r
+\r
+/* ------------------------- Opcode -------------------------------------*/\r
+#define FP_REGISTER_READ                       0x01\r
+#define FP_REGISTER_WRITE                      0x02\r
+#define FP_GET_ONE_IMG                         0x03\r
+#define FP_SENSOR_RESET                                0x04\r
+#define FP_POWER_ONOFF                         0x05\r
+#define FP_SET_SPI_CLOCK                       0x06\r
+#define FP_RESET_SET                           0x07\r
+\r
+/* trigger signal initial routine*/\r
+#define INT_TRIGGER_INIT                       0xa4\r
+/* trigger signal close routine*/\r
+#define INT_TRIGGER_CLOSE                      0xa5\r
+/* read trigger status*/\r
+#define INT_TRIGGER_READ                       0xa6\r
+/* polling trigger status*/\r
+#define INT_TRIGGER_POLLING                    0xa7\r
+/* polling abort*/\r
+#define INT_TRIGGER_ABORT                      0xa8\r
+#define FP_TRANSFER_SYNC                       0xAA\r
+\r
+#define DRDY_IRQ_ENABLE                                1\r
+#define DRDY_IRQ_DISABLE                       0\r
+\r
+/* interrupt polling */\r
+unsigned int fps_interrupt_poll(\r
+       struct file *file,\r
+       struct poll_table_struct *wait\r
+);\r
+struct interrupt_desc {\r
+       int gpio;\r
+       int number;\r
+       char *name;\r
+       int int_count;\r
+       struct timer_list timer;\r
+       bool finger_on;\r
+       int detect_period;\r
+       int detect_threshold;\r
+       bool drdy_irq_flag;\r
+};\r
+\r
+/* ------------------------- Structure ------------------------------*/\r
+struct egis_ioc_transfer {\r
+       u8 *tx_buf;\r
+       u8 *rx_buf;\r
+\r
+       __u32 len;\r
+       __u32 speed_hz;\r
+\r
+       __u16 delay_usecs;\r
+       __u8 bits_per_word;\r
+       __u8 cs_change;\r
+       __u8 opcode;\r
+       __u8 pad[3];\r
+\r
+};\r
+\r
+#define EGIS_IOC_MAGIC                 'k'\r
+#define EGIS_MSGSIZE(N) \\r
+       ((((N)*(sizeof(struct egis_ioc_transfer))) < (1 << _IOC_SIZEBITS)) \\r
+               ? ((N)*(sizeof(struct egis_ioc_transfer))) : 0)\r
+#define EGIS_IOC_MESSAGE(N) _IOW(EGIS_IOC_MAGIC, 0, char[EGIS_MSGSIZE(N)])\r
+\r
+struct etspi_data {\r
+       dev_t devt;\r
+       spinlock_t spi_lock;\r
+//     struct spi_device  *spi;        \r
+       struct platform_device *spi;\r
+       struct list_head device_entry;\r
+\r
+       /* buffer is NULL unless this device is open (users > 0) */\r
+       struct mutex buf_lock;\r
+       unsigned users;\r
+       u8 *buffer;\r
+\r
+       unsigned int irqPin;        /* interrupt GPIO pin number */\r
+       unsigned int rstPin;        /* Reset GPIO pin number */\r
+\r
+       unsigned int vdd_18v_Pin;       /* Reset GPIO pin number */\r
+       unsigned int vcc_33v_Pin;       /* Reset GPIO pin number */\r
+    struct input_dev   *input_dev;\r
+       bool property_navigation_enable;\r
+};\r
+\r
+\r
+/* ------------------------- Interrupt ------------------------------*/\r
+/* interrupt init */\r
+int Interrupt_Init(\r
+       struct etspi_data *etspi,\r
+       int int_mode,\r
+       int detect_period,\r
+       int detect_threshold);\r
+\r
+/* interrupt free */\r
+int Interrupt_Free(struct etspi_data *etspi);\r
+\r
+void fps_interrupt_abort(void);\r
+\r
+/* ------------------------- Data Transfer --------------------------*/\r
+/*[REM] int fp_io_read_register(struct fp_data *fp, u8 *addr, u8 *buf); */\r
+/*[REM] int fp_io_write_register(struct fp_data *fp, u8 *buf);*/\r
+/*[REM] int fp_io_get_one_image(struct fp_data *fp, u8 *buf, u8 *image_buf);*/\r
+/*[REM] int fp_read_register(struct fp_data *fp, u8 addr, u8 *buf);*/\r
+/*[REM] int fp_mass_read(struct fp_data *fp, u8 addr, u8 *buf, int read_len);*/\r
+#endif\r
index c56e2fe2bb0dabc086d6567745213272466eabe9..f645cba92dd325b3ea3fc26b7b06e37d28063905 100755 (executable)
@@ -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");
        }