^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) * Synaptics touchpad with I2C interface
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * Copyright (C) 2009 Compulab, Ltd.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Mike Rapoport <mike@compulab.co.il>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * Igor Grinberg <grinberg@compulab.co.il>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) * This file is subject to the terms and conditions of the GNU General Public
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) * License. See the file COPYING in the main directory of this archive for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) * more details.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <linux/i2c.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <linux/irq.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include <linux/interrupt.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include <linux/input.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #include <linux/delay.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #include <linux/workqueue.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #include <linux/slab.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #include <linux/pm.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) #define DRIVER_NAME "synaptics_i2c"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) /* maximum product id is 15 characters */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) #define PRODUCT_ID_LENGTH 15
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) #define REGISTER_LENGTH 8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) * after soft reset, we should wait for 1 ms
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) * before the device becomes operational
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) #define SOFT_RESET_DELAY_US 3000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) /* and after hard reset, we should wait for max 500ms */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) #define HARD_RESET_DELAY_MS 500
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) /* Registers by SMBus address */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) #define PAGE_SEL_REG 0xff
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) #define DEVICE_STATUS_REG 0x09
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) /* Registers by RMI address */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) #define DEV_CONTROL_REG 0x0000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) #define INTERRUPT_EN_REG 0x0001
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) #define ERR_STAT_REG 0x0002
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) #define INT_REQ_STAT_REG 0x0003
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) #define DEV_COMMAND_REG 0x0004
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) #define RMI_PROT_VER_REG 0x0200
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) #define MANUFACT_ID_REG 0x0201
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) #define PHYS_INT_VER_REG 0x0202
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) #define PROD_PROPERTY_REG 0x0203
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) #define INFO_QUERY_REG0 0x0204
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) #define INFO_QUERY_REG1 (INFO_QUERY_REG0 + 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) #define INFO_QUERY_REG2 (INFO_QUERY_REG0 + 2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) #define INFO_QUERY_REG3 (INFO_QUERY_REG0 + 3)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) #define PRODUCT_ID_REG0 0x0210
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) #define PRODUCT_ID_REG1 (PRODUCT_ID_REG0 + 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) #define PRODUCT_ID_REG2 (PRODUCT_ID_REG0 + 2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) #define PRODUCT_ID_REG3 (PRODUCT_ID_REG0 + 3)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) #define PRODUCT_ID_REG4 (PRODUCT_ID_REG0 + 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) #define PRODUCT_ID_REG5 (PRODUCT_ID_REG0 + 5)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) #define PRODUCT_ID_REG6 (PRODUCT_ID_REG0 + 6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) #define PRODUCT_ID_REG7 (PRODUCT_ID_REG0 + 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) #define PRODUCT_ID_REG8 (PRODUCT_ID_REG0 + 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) #define PRODUCT_ID_REG9 (PRODUCT_ID_REG0 + 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) #define PRODUCT_ID_REG10 (PRODUCT_ID_REG0 + 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) #define PRODUCT_ID_REG11 (PRODUCT_ID_REG0 + 11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) #define PRODUCT_ID_REG12 (PRODUCT_ID_REG0 + 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) #define PRODUCT_ID_REG13 (PRODUCT_ID_REG0 + 13)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) #define PRODUCT_ID_REG14 (PRODUCT_ID_REG0 + 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) #define PRODUCT_ID_REG15 (PRODUCT_ID_REG0 + 15)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) #define DATA_REG0 0x0400
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) #define ABS_PRESSURE_REG 0x0401
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) #define ABS_MSB_X_REG 0x0402
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) #define ABS_LSB_X_REG (ABS_MSB_X_REG + 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) #define ABS_MSB_Y_REG 0x0404
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) #define ABS_LSB_Y_REG (ABS_MSB_Y_REG + 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) #define REL_X_REG 0x0406
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) #define REL_Y_REG 0x0407
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) #define DEV_QUERY_REG0 0x1000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) #define DEV_QUERY_REG1 (DEV_QUERY_REG0 + 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) #define DEV_QUERY_REG2 (DEV_QUERY_REG0 + 2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) #define DEV_QUERY_REG3 (DEV_QUERY_REG0 + 3)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) #define DEV_QUERY_REG4 (DEV_QUERY_REG0 + 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) #define DEV_QUERY_REG5 (DEV_QUERY_REG0 + 5)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) #define DEV_QUERY_REG6 (DEV_QUERY_REG0 + 6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) #define DEV_QUERY_REG7 (DEV_QUERY_REG0 + 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) #define DEV_QUERY_REG8 (DEV_QUERY_REG0 + 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) #define GENERAL_2D_CONTROL_REG 0x1041
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) #define SENSOR_SENSITIVITY_REG 0x1044
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) #define SENS_MAX_POS_MSB_REG 0x1046
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) #define SENS_MAX_POS_LSB_REG (SENS_MAX_POS_UPPER_REG + 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) /* Register bits */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) /* Device Control Register Bits */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) #define REPORT_RATE_1ST_BIT 6
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) /* Interrupt Enable Register Bits (INTERRUPT_EN_REG) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) #define F10_ABS_INT_ENA 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) #define F10_REL_INT_ENA 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) #define F20_INT_ENA 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) /* Interrupt Request Register Bits (INT_REQ_STAT_REG | DEVICE_STATUS_REG) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) #define F10_ABS_INT_REQ 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) #define F10_REL_INT_REQ 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) #define F20_INT_REQ 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) /* Device Status Register Bits (DEVICE_STATUS_REG) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) #define STAT_CONFIGURED 6
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) #define STAT_ERROR 7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) /* Device Command Register Bits (DEV_COMMAND_REG) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) #define RESET_COMMAND 0x01
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) #define REZERO_COMMAND 0x02
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) /* Data Register 0 Bits (DATA_REG0) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) #define GESTURE 3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) /* Device Query Registers Bits */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) /* DEV_QUERY_REG3 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) #define HAS_PALM_DETECT 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) #define HAS_MULTI_FING 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) #define HAS_SCROLLER 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) #define HAS_2D_SCROLL 5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) /* General 2D Control Register Bits (GENERAL_2D_CONTROL_REG) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) #define NO_DECELERATION 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) #define REDUCE_REPORTING 3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) #define NO_FILTER 5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) /* Function Masks */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) /* Device Control Register Masks (DEV_CONTROL_REG) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) #define REPORT_RATE_MSK 0xc0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) #define SLEEP_MODE_MSK 0x07
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) /* Device Sleep Modes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) #define FULL_AWAKE 0x0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) #define NORMAL_OP 0x1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) #define LOW_PWR_OP 0x2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) #define VERY_LOW_PWR_OP 0x3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) #define SENS_SLEEP 0x4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) #define SLEEP_MOD 0x5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) #define DEEP_SLEEP 0x6
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) #define HIBERNATE 0x7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) /* Interrupt Register Mask */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) /* (INT_REQ_STAT_REG | DEVICE_STATUS_REG | INTERRUPT_EN_REG) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) #define INT_ENA_REQ_MSK 0x07
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) #define INT_ENA_ABS_MSK 0x01
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) #define INT_ENA_REL_MSK 0x02
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) #define INT_ENA_F20_MSK 0x04
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) /* Device Status Register Masks (DEVICE_STATUS_REG) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) #define CONFIGURED_MSK 0x40
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) #define ERROR_MSK 0x80
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) /* Data Register 0 Masks */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) #define FINGER_WIDTH_MSK 0xf0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) #define GESTURE_MSK 0x08
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) #define SENSOR_STATUS_MSK 0x07
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) * MSB Position Register Masks
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) * ABS_MSB_X_REG | ABS_MSB_Y_REG | SENS_MAX_POS_MSB_REG |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) * DEV_QUERY_REG3 | DEV_QUERY_REG5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) #define MSB_POSITION_MSK 0x1f
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) /* Device Query Registers Masks */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) /* DEV_QUERY_REG2 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) #define NUM_EXTRA_POS_MSK 0x07
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) /* When in IRQ mode read the device every THREAD_IRQ_SLEEP_SECS */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) #define THREAD_IRQ_SLEEP_SECS 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) #define THREAD_IRQ_SLEEP_MSECS (THREAD_IRQ_SLEEP_SECS * MSEC_PER_SEC)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) * When in Polling mode and no data received for NO_DATA_THRES msecs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) * reduce the polling rate to NO_DATA_SLEEP_MSECS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) #define NO_DATA_THRES (MSEC_PER_SEC)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) #define NO_DATA_SLEEP_MSECS (MSEC_PER_SEC / 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) /* Control touchpad's No Deceleration option */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) static bool no_decel = true;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) module_param(no_decel, bool, 0644);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) MODULE_PARM_DESC(no_decel, "No Deceleration. Default = 1 (on)");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) /* Control touchpad's Reduced Reporting option */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) static bool reduce_report;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) module_param(reduce_report, bool, 0644);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) MODULE_PARM_DESC(reduce_report, "Reduced Reporting. Default = 0 (off)");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) /* Control touchpad's No Filter option */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) static bool no_filter;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) module_param(no_filter, bool, 0644);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) MODULE_PARM_DESC(no_filter, "No Filter. Default = 0 (off)");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) * touchpad Attention line is Active Low and Open Drain,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) * therefore should be connected to pulled up line
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) * and the irq configuration should be set to Falling Edge Trigger
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) /* Control IRQ / Polling option */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) static bool polling_req;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) module_param(polling_req, bool, 0444);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) MODULE_PARM_DESC(polling_req, "Request Polling. Default = 0 (use irq)");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) /* Control Polling Rate */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) static int scan_rate = 80;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) module_param(scan_rate, int, 0644);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) MODULE_PARM_DESC(scan_rate, "Polling rate in times/sec. Default = 80");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) /* The main device structure */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) struct synaptics_i2c {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) struct i2c_client *client;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) struct input_dev *input;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) struct delayed_work dwork;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) int no_data_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) int no_decel_param;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) int reduce_report_param;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) int no_filter_param;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) int scan_rate_param;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) int scan_ms;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) static inline void set_scan_rate(struct synaptics_i2c *touch, int scan_rate)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) touch->scan_ms = MSEC_PER_SEC / scan_rate;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) touch->scan_rate_param = scan_rate;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) * Driver's initial design makes no race condition possible on i2c bus,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) * so there is no need in any locking.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) * Keep it in mind, while playing with the code.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) static s32 synaptics_i2c_reg_get(struct i2c_client *client, u16 reg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) ret = i2c_smbus_write_byte_data(client, PAGE_SEL_REG, reg >> 8);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) if (ret == 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) ret = i2c_smbus_read_byte_data(client, reg & 0xff);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) static s32 synaptics_i2c_reg_set(struct i2c_client *client, u16 reg, u8 val)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) ret = i2c_smbus_write_byte_data(client, PAGE_SEL_REG, reg >> 8);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) if (ret == 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) ret = i2c_smbus_write_byte_data(client, reg & 0xff, val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) static s32 synaptics_i2c_word_get(struct i2c_client *client, u16 reg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) ret = i2c_smbus_write_byte_data(client, PAGE_SEL_REG, reg >> 8);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) if (ret == 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) ret = i2c_smbus_read_word_data(client, reg & 0xff);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) static int synaptics_i2c_config(struct i2c_client *client)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) int ret, control;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) u8 int_en;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) /* set Report Rate to Device Highest (>=80) and Sleep to normal */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) ret = synaptics_i2c_reg_set(client, DEV_CONTROL_REG, 0xc1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) /* set Interrupt Disable to Func20 / Enable to Func10) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) int_en = (polling_req) ? 0 : INT_ENA_ABS_MSK | INT_ENA_REL_MSK;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) ret = synaptics_i2c_reg_set(client, INTERRUPT_EN_REG, int_en);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) control = synaptics_i2c_reg_get(client, GENERAL_2D_CONTROL_REG);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) /* No Deceleration */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) control |= no_decel ? 1 << NO_DECELERATION : 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) /* Reduced Reporting */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) control |= reduce_report ? 1 << REDUCE_REPORTING : 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) /* No Filter */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) control |= no_filter ? 1 << NO_FILTER : 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) ret = synaptics_i2c_reg_set(client, GENERAL_2D_CONTROL_REG, control);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) static int synaptics_i2c_reset_config(struct i2c_client *client)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) /* Reset the Touchpad */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) ret = synaptics_i2c_reg_set(client, DEV_COMMAND_REG, RESET_COMMAND);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) if (ret) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) dev_err(&client->dev, "Unable to reset device\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) usleep_range(SOFT_RESET_DELAY_US, SOFT_RESET_DELAY_US + 100);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) ret = synaptics_i2c_config(client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) dev_err(&client->dev, "Unable to config device\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) static int synaptics_i2c_check_error(struct i2c_client *client)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) int status, ret = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) status = i2c_smbus_read_byte_data(client, DEVICE_STATUS_REG) &
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) (CONFIGURED_MSK | ERROR_MSK);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) if (status != CONFIGURED_MSK)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) ret = synaptics_i2c_reset_config(client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) static bool synaptics_i2c_get_input(struct synaptics_i2c *touch)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) struct input_dev *input = touch->input;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) int xy_delta, gesture;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) s32 data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) s8 x_delta, y_delta;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) /* Deal with spontaneous resets and errors */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) if (synaptics_i2c_check_error(touch->client))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) return false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) /* Get Gesture Bit */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) data = synaptics_i2c_reg_get(touch->client, DATA_REG0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) gesture = (data >> GESTURE) & 0x1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) * Get Relative axes. we have to get them in one shot,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) * so we get 2 bytes starting from REL_X_REG.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) xy_delta = synaptics_i2c_word_get(touch->client, REL_X_REG) & 0xffff;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) /* Separate X from Y */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) x_delta = xy_delta & 0xff;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) y_delta = (xy_delta >> REGISTER_LENGTH) & 0xff;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) /* Report the button event */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) input_report_key(input, BTN_LEFT, gesture);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) /* Report the deltas */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) input_report_rel(input, REL_X, x_delta);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) input_report_rel(input, REL_Y, -y_delta);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) input_sync(input);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) return xy_delta || gesture;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) static irqreturn_t synaptics_i2c_irq(int irq, void *dev_id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) struct synaptics_i2c *touch = dev_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) mod_delayed_work(system_wq, &touch->dwork, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) return IRQ_HANDLED;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) static void synaptics_i2c_check_params(struct synaptics_i2c *touch)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) bool reset = false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) if (scan_rate != touch->scan_rate_param)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) set_scan_rate(touch, scan_rate);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) if (no_decel != touch->no_decel_param) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) touch->no_decel_param = no_decel;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) reset = true;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) if (no_filter != touch->no_filter_param) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) touch->no_filter_param = no_filter;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) reset = true;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) if (reduce_report != touch->reduce_report_param) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) touch->reduce_report_param = reduce_report;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) reset = true;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) if (reset)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) synaptics_i2c_reset_config(touch->client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) /* Control the Device polling rate / Work Handler sleep time */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) static unsigned long synaptics_i2c_adjust_delay(struct synaptics_i2c *touch,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) bool have_data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) unsigned long delay, nodata_count_thres;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) if (polling_req) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) delay = touch->scan_ms;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) if (have_data) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) touch->no_data_count = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) nodata_count_thres = NO_DATA_THRES / touch->scan_ms;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) if (touch->no_data_count < nodata_count_thres)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) touch->no_data_count++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) delay = NO_DATA_SLEEP_MSECS;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) return msecs_to_jiffies(delay);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) delay = msecs_to_jiffies(THREAD_IRQ_SLEEP_MSECS);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) return round_jiffies_relative(delay);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) /* Work Handler */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) static void synaptics_i2c_work_handler(struct work_struct *work)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) bool have_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) struct synaptics_i2c *touch =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) container_of(work, struct synaptics_i2c, dwork.work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) unsigned long delay;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) synaptics_i2c_check_params(touch);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) have_data = synaptics_i2c_get_input(touch);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) delay = synaptics_i2c_adjust_delay(touch, have_data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) * While interrupt driven, there is no real need to poll the device.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) * But touchpads are very sensitive, so there could be errors
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) * related to physical environment and the attention line isn't
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) * necessarily asserted. In such case we can lose the touchpad.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) * We poll the device once in THREAD_IRQ_SLEEP_SECS and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) * if error is detected, we try to reset and reconfigure the touchpad.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) mod_delayed_work(system_wq, &touch->dwork, delay);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454) static int synaptics_i2c_open(struct input_dev *input)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456) struct synaptics_i2c *touch = input_get_drvdata(input);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457) int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459) ret = synaptics_i2c_reset_config(touch->client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461) return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463) if (polling_req)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464) mod_delayed_work(system_wq, &touch->dwork,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465) msecs_to_jiffies(NO_DATA_SLEEP_MSECS));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470) static void synaptics_i2c_close(struct input_dev *input)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472) struct synaptics_i2c *touch = input_get_drvdata(input);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474) if (!polling_req)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475) synaptics_i2c_reg_set(touch->client, INTERRUPT_EN_REG, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477) cancel_delayed_work_sync(&touch->dwork);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 479) /* Save some power */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 480) synaptics_i2c_reg_set(touch->client, DEV_CONTROL_REG, DEEP_SLEEP);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 481) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 482)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 483) static void synaptics_i2c_set_input_params(struct synaptics_i2c *touch)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 484) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 485) struct input_dev *input = touch->input;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 486)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 487) input->name = touch->client->name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 488) input->phys = touch->client->adapter->name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 489) input->id.bustype = BUS_I2C;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 490) input->id.version = synaptics_i2c_word_get(touch->client,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 491) INFO_QUERY_REG0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 492) input->dev.parent = &touch->client->dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 493) input->open = synaptics_i2c_open;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 494) input->close = synaptics_i2c_close;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 495) input_set_drvdata(input, touch);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 496)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 497) /* Register the device as mouse */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 498) __set_bit(EV_REL, input->evbit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 499) __set_bit(REL_X, input->relbit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 500) __set_bit(REL_Y, input->relbit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 501)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 502) /* Register device's buttons and keys */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 503) __set_bit(EV_KEY, input->evbit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 504) __set_bit(BTN_LEFT, input->keybit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 505) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 506)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 507) static struct synaptics_i2c *synaptics_i2c_touch_create(struct i2c_client *client)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 508) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 509) struct synaptics_i2c *touch;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 510)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 511) touch = kzalloc(sizeof(struct synaptics_i2c), GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 512) if (!touch)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 513) return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 514)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 515) touch->client = client;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 516) touch->no_decel_param = no_decel;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 517) touch->scan_rate_param = scan_rate;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 518) set_scan_rate(touch, scan_rate);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 519) INIT_DELAYED_WORK(&touch->dwork, synaptics_i2c_work_handler);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 520)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 521) return touch;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 522) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 523)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 524) static int synaptics_i2c_probe(struct i2c_client *client,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 525) const struct i2c_device_id *dev_id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 526) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 527) int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 528) struct synaptics_i2c *touch;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 529)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 530) touch = synaptics_i2c_touch_create(client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 531) if (!touch)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 532) return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 533)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 534) ret = synaptics_i2c_reset_config(client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 535) if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 536) goto err_mem_free;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 537)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 538) if (client->irq < 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 539) polling_req = true;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 540)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 541) touch->input = input_allocate_device();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 542) if (!touch->input) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 543) ret = -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 544) goto err_mem_free;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 545) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 546)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 547) synaptics_i2c_set_input_params(touch);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 548)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 549) if (!polling_req) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 550) dev_dbg(&touch->client->dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 551) "Requesting IRQ: %d\n", touch->client->irq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 552)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 553) ret = request_irq(touch->client->irq, synaptics_i2c_irq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 554) IRQ_TYPE_EDGE_FALLING,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 555) DRIVER_NAME, touch);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 556) if (ret) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 557) dev_warn(&touch->client->dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 558) "IRQ request failed: %d, "
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 559) "falling back to polling\n", ret);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 560) polling_req = true;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 561) synaptics_i2c_reg_set(touch->client,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 562) INTERRUPT_EN_REG, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 563) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 564) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 565)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 566) if (polling_req)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 567) dev_dbg(&touch->client->dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 568) "Using polling at rate: %d times/sec\n", scan_rate);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 569)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 570) /* Register the device in input subsystem */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 571) ret = input_register_device(touch->input);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 572) if (ret) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 573) dev_err(&client->dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 574) "Input device register failed: %d\n", ret);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 575) goto err_input_free;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 576) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 577)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 578) i2c_set_clientdata(client, touch);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 579)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 580) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 581)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 582) err_input_free:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 583) input_free_device(touch->input);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 584) err_mem_free:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 585) kfree(touch);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 586)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 587) return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 588) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 589)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 590) static int synaptics_i2c_remove(struct i2c_client *client)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 591) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 592) struct synaptics_i2c *touch = i2c_get_clientdata(client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 593)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 594) if (!polling_req)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 595) free_irq(client->irq, touch);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 596)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 597) input_unregister_device(touch->input);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 598) kfree(touch);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 599)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 600) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 601) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 602)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 603) static int __maybe_unused synaptics_i2c_suspend(struct device *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 604) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 605) struct i2c_client *client = to_i2c_client(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 606) struct synaptics_i2c *touch = i2c_get_clientdata(client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 607)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 608) cancel_delayed_work_sync(&touch->dwork);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 609)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 610) /* Save some power */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 611) synaptics_i2c_reg_set(touch->client, DEV_CONTROL_REG, DEEP_SLEEP);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 612)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 613) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 614) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 615)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 616) static int __maybe_unused synaptics_i2c_resume(struct device *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 617) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 618) int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 619) struct i2c_client *client = to_i2c_client(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 620) struct synaptics_i2c *touch = i2c_get_clientdata(client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 621)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 622) ret = synaptics_i2c_reset_config(client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 623) if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 624) return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 625)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 626) mod_delayed_work(system_wq, &touch->dwork,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 627) msecs_to_jiffies(NO_DATA_SLEEP_MSECS));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 628)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 629) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 630) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 631)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 632) static SIMPLE_DEV_PM_OPS(synaptics_i2c_pm, synaptics_i2c_suspend,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 633) synaptics_i2c_resume);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 634)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 635) static const struct i2c_device_id synaptics_i2c_id_table[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 636) { "synaptics_i2c", 0 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 637) { },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 638) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 639) MODULE_DEVICE_TABLE(i2c, synaptics_i2c_id_table);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 640)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 641) #ifdef CONFIG_OF
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 642) static const struct of_device_id synaptics_i2c_of_match[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 643) { .compatible = "synaptics,synaptics_i2c", },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 644) { },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 645) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 646) MODULE_DEVICE_TABLE(of, synaptics_i2c_of_match);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 647) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 648)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 649) static struct i2c_driver synaptics_i2c_driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 650) .driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 651) .name = DRIVER_NAME,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 652) .of_match_table = of_match_ptr(synaptics_i2c_of_match),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 653) .pm = &synaptics_i2c_pm,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 654) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 655)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 656) .probe = synaptics_i2c_probe,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 657) .remove = synaptics_i2c_remove,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 658)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 659) .id_table = synaptics_i2c_id_table,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 660) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 661)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 662) module_i2c_driver(synaptics_i2c_driver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 663)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 664) MODULE_DESCRIPTION("Synaptics I2C touchpad driver");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 665) MODULE_AUTHOR("Mike Rapoport, Igor Grinberg, Compulab");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 666) MODULE_LICENSE("GPL");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 667)