aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/input/touchscreen/wdt87xx_i2c.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/drivers/input/touchscreen/wdt87xx_i2c.c b/drivers/input/touchscreen/wdt87xx_i2c.c
index 9eb8e8cec17e..fb92ae1c5fae 100644
--- a/drivers/input/touchscreen/wdt87xx_i2c.c
+++ b/drivers/input/touchscreen/wdt87xx_i2c.c
@@ -23,7 +23,7 @@
23#include <asm/unaligned.h> 23#include <asm/unaligned.h>
24 24
25#define WDT87XX_NAME "wdt87xx_i2c" 25#define WDT87XX_NAME "wdt87xx_i2c"
26#define WDT87XX_DRV_VER "0.9.5" 26#define WDT87XX_DRV_VER "0.9.6"
27#define WDT87XX_FW_NAME "wdt87xx_fw.bin" 27#define WDT87XX_FW_NAME "wdt87xx_fw.bin"
28#define WDT87XX_CFG_NAME "wdt87xx_cfg.bin" 28#define WDT87XX_CFG_NAME "wdt87xx_cfg.bin"
29 29
@@ -83,6 +83,7 @@
83#define CTL_PARAM_OFFSET_PHY_Y1 18 83#define CTL_PARAM_OFFSET_PHY_Y1 18
84#define CTL_PARAM_OFFSET_PHY_W 22 84#define CTL_PARAM_OFFSET_PHY_W 22
85#define CTL_PARAM_OFFSET_PHY_H 24 85#define CTL_PARAM_OFFSET_PHY_H 24
86#define CTL_PARAM_OFFSET_FACTOR 32
86 87
87/* Communication commands */ 88/* Communication commands */
88#define PACKET_SIZE 56 89#define PACKET_SIZE 56
@@ -161,6 +162,7 @@ struct wdt87xx_sys_param {
161 u16 phy_ch_y; 162 u16 phy_ch_y;
162 u16 phy_w; 163 u16 phy_w;
163 u16 phy_h; 164 u16 phy_h;
165 u16 scaling_factor;
164 u32 max_x; 166 u32 max_x;
165 u32 max_y; 167 u32 max_y;
166}; 168};
@@ -401,7 +403,7 @@ static int wdt87xx_get_sysparam(struct i2c_client *client,
401 u8 buf[PKT_READ_SIZE]; 403 u8 buf[PKT_READ_SIZE];
402 int error; 404 int error;
403 405
404 error = wdt87xx_get_string(client, STRIDX_PARAMETERS, buf, 32); 406 error = wdt87xx_get_string(client, STRIDX_PARAMETERS, buf, 34);
405 if (error) { 407 if (error) {
406 dev_err(&client->dev, "failed to get parameters\n"); 408 dev_err(&client->dev, "failed to get parameters\n");
407 return error; 409 return error;
@@ -414,6 +416,10 @@ static int wdt87xx_get_sysparam(struct i2c_client *client,
414 param->phy_w = get_unaligned_le16(buf + CTL_PARAM_OFFSET_PHY_W) / 10; 416 param->phy_w = get_unaligned_le16(buf + CTL_PARAM_OFFSET_PHY_W) / 10;
415 param->phy_h = get_unaligned_le16(buf + CTL_PARAM_OFFSET_PHY_H) / 10; 417 param->phy_h = get_unaligned_le16(buf + CTL_PARAM_OFFSET_PHY_H) / 10;
416 418
419 /* Get the scaling factor of pixel to logical coordinate */
420 param->scaling_factor =
421 get_unaligned_le16(buf + CTL_PARAM_OFFSET_FACTOR);
422
417 param->max_x = MAX_UNIT_AXIS; 423 param->max_x = MAX_UNIT_AXIS;
418 param->max_y = DIV_ROUND_CLOSEST(MAX_UNIT_AXIS * param->phy_h, 424 param->max_y = DIV_ROUND_CLOSEST(MAX_UNIT_AXIS * param->phy_h,
419 param->phy_w); 425 param->phy_w);
@@ -905,8 +911,8 @@ static void wdt87xx_report_contact(struct input_dev *input,
905 u8 *buf) 911 u8 *buf)
906{ 912{
907 int finger_id; 913 int finger_id;
908 u32 x, y; 914 u32 x, y, w;
909 u8 w, p; 915 u8 p;
910 916
911 finger_id = (buf[FINGER_EV_V1_OFFSET_ID] >> 3) - 1; 917 finger_id = (buf[FINGER_EV_V1_OFFSET_ID] >> 3) - 1;
912 if (finger_id < 0) 918 if (finger_id < 0)
@@ -917,6 +923,8 @@ static void wdt87xx_report_contact(struct input_dev *input,
917 return; 923 return;
918 924
919 w = buf[FINGER_EV_V1_OFFSET_W]; 925 w = buf[FINGER_EV_V1_OFFSET_W];
926 w *= param->scaling_factor;
927
920 p = buf[FINGER_EV_V1_OFFSET_P]; 928 p = buf[FINGER_EV_V1_OFFSET_P];
921 929
922 x = get_unaligned_le16(buf + FINGER_EV_V1_OFFSET_X); 930 x = get_unaligned_le16(buf + FINGER_EV_V1_OFFSET_X);
@@ -995,7 +1003,8 @@ static int wdt87xx_ts_create_input_device(struct wdt87xx_data *wdt)
995 input_abs_set_res(input, ABS_MT_POSITION_X, res); 1003 input_abs_set_res(input, ABS_MT_POSITION_X, res);
996 input_abs_set_res(input, ABS_MT_POSITION_Y, res); 1004 input_abs_set_res(input, ABS_MT_POSITION_Y, res);
997 1005
998 input_set_abs_params(input, ABS_MT_TOUCH_MAJOR, 0, 0xFF, 0, 0); 1006 input_set_abs_params(input, ABS_MT_TOUCH_MAJOR,
1007 0, wdt->param.max_x, 0, 0);
999 input_set_abs_params(input, ABS_MT_PRESSURE, 0, 0xFF, 0, 0); 1008 input_set_abs_params(input, ABS_MT_PRESSURE, 0, 0xFF, 0, 0);
1000 1009
1001 input_mt_init_slots(input, WDT_MAX_FINGER, 1010 input_mt_init_slots(input, WDT_MAX_FINGER,