aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/mouse/elan_i2c_i2c.c
diff options
context:
space:
mode:
authorduson <dusonlin@emc.com.tw>2015-04-12 16:01:05 -0700
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2015-04-14 10:21:42 -0700
commitb9bced0eecd77067f4659b90d5ab2fb32485c3e2 (patch)
tree3d6ac23419b7eefd8829ae9ae9de03588d6c37ef /drivers/input/mouse/elan_i2c_i2c.c
parentInput: atkbd - document "no new force-release quirks" policy (diff)
downloadlinux-dev-b9bced0eecd77067f4659b90d5ab2fb32485c3e2.tar.xz
linux-dev-b9bced0eecd77067f4659b90d5ab2fb32485c3e2.zip
Input: elan_i2c - adjust for newer firmware pressure reporting
Get pressure format flag from firmware to check if we need to normalize pressure data before reporting it. Signed-off-by: Duson Lin <dusonlin@emc.com.tw> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input/mouse/elan_i2c_i2c.c')
-rw-r--r--drivers/input/mouse/elan_i2c_i2c.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/input/mouse/elan_i2c_i2c.c b/drivers/input/mouse/elan_i2c_i2c.c
index 6cf0def6d35e..df221401c12a 100644
--- a/drivers/input/mouse/elan_i2c_i2c.c
+++ b/drivers/input/mouse/elan_i2c_i2c.c
@@ -41,6 +41,7 @@
#define ETP_I2C_MAX_X_AXIS_CMD 0x0106
#define ETP_I2C_MAX_Y_AXIS_CMD 0x0107
#define ETP_I2C_RESOLUTION_CMD 0x0108
+#define ETP_I2C_PRESSURE_CMD 0x010A
#define ETP_I2C_IAP_VERSION_CMD 0x0110
#define ETP_I2C_SET_CMD 0x0300
#define ETP_I2C_POWER_CMD 0x0307
@@ -370,6 +371,27 @@ static int elan_i2c_get_num_traces(struct i2c_client *client,
return 0;
}
+static int elan_i2c_get_pressure_adjustment(struct i2c_client *client,
+ int *adjustment)
+{
+ int error;
+ u8 val[3];
+
+ error = elan_i2c_read_cmd(client, ETP_I2C_PRESSURE_CMD, val);
+ if (error) {
+ dev_err(&client->dev, "failed to get pressure format: %d\n",
+ error);
+ return error;
+ }
+
+ if ((val[0] >> 4) & 0x1)
+ *adjustment = 0;
+ else
+ *adjustment = ETP_PRESSURE_OFFSET;
+
+ return 0;
+}
+
static int elan_i2c_iap_get_mode(struct i2c_client *client, enum tp_mode *mode)
{
int error;
@@ -602,6 +624,7 @@ const struct elan_transport_ops elan_i2c_ops = {
.get_sm_version = elan_i2c_get_sm_version,
.get_product_id = elan_i2c_get_product_id,
.get_checksum = elan_i2c_get_checksum,
+ .get_pressure_adjustment = elan_i2c_get_pressure_adjustment,
.get_max = elan_i2c_get_max,
.get_resolution = elan_i2c_get_resolution,