Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Input: melfas_mip4 - add resolution reporting

Add support for retrieving device resolution (pixels per mm) from firmware
and using it when setting up input device.

Signed-off-by: Sangwon Jee <jeesw@melfas.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

authored by

Sangwon Jee and committed by
Dmitry Torokhov
7a3ed686 564a68de

+22 -4
+22 -4
drivers/input/touchscreen/melfas_mip4.c
··· 33 33 34 34 /***************************************************************** 35 35 * Protocol 36 - * Version : MIP 4.0 Rev 4.4 36 + * Version : MIP 4.0 Rev 4.6 37 37 *****************************************************************/ 38 38 39 39 /* Address */ ··· 52 52 #define MIP4_R1_INFO_NODE_NUM_X 0x14 53 53 #define MIP4_R1_INFO_NODE_NUM_Y 0x15 54 54 #define MIP4_R1_INFO_KEY_NUM 0x16 55 + #define MIP4_R1_INFO_PRESSURE_NUM 0x17 56 + #define MIP4_R1_INFO_LENGTH_X 0x18 57 + #define MIP4_R1_INFO_LENGTH_Y 0x1A 58 + #define MIP4_R1_INFO_PPM_X 0x1C 59 + #define MIP4_R1_INFO_PPM_Y 0x1D 55 60 #define MIP4_R1_INFO_VERSION_BOOT 0x20 56 61 #define MIP4_R1_INFO_VERSION_CORE 0x22 57 62 #define MIP4_R1_INFO_VERSION_APP 0x24 ··· 163 158 u8 node_x; 164 159 u8 node_y; 165 160 u8 node_key; 161 + unsigned int ppm_x; 162 + unsigned int ppm_y; 166 163 167 164 struct mip4_fw_version fw_version; 168 165 ··· 249 242 { 250 243 int error; 251 244 u8 cmd[2]; 252 - u8 buf[8]; 245 + u8 buf[14]; 253 246 254 247 /* Product name */ 255 248 cmd[0] = MIP4_R0_INFO; ··· 276 269 /* Resolution */ 277 270 cmd[0] = MIP4_R0_INFO; 278 271 cmd[1] = MIP4_R1_INFO_RESOLUTION_X; 279 - error = mip4_i2c_xfer(ts, cmd, sizeof(cmd), buf, 7); 272 + error = mip4_i2c_xfer(ts, cmd, sizeof(cmd), buf, 14); 280 273 if (error) { 281 274 dev_warn(&ts->client->dev, 282 275 "Failed to retrieve touchscreen parameters: %d\n", ··· 293 286 dev_dbg(&ts->client->dev, 294 287 "node_x: %d, node_y: %d, node_key: %d\n", 295 288 ts->node_x, ts->node_y, ts->node_key); 289 + 290 + ts->ppm_x = buf[12]; 291 + ts->ppm_y = buf[13]; 292 + dev_dbg(&ts->client->dev, "ppm_x: %d, ppm_y: %d\n", 293 + ts->ppm_x, ts->ppm_y); 296 294 297 295 /* Key ts */ 298 296 if (ts->node_key > 0) ··· 1107 1095 input_set_abs_params(ts->input, ABS_MT_POSITION_Y, 0, ts->max_y, 0, 0); 1108 1096 input_set_abs_params(ts->input, ABS_X, 0, ts->max_x, 0, 0); 1109 1097 input_set_abs_params(ts->input, ABS_Y, 0, ts->max_y, 0, 0); 1098 + input_abs_set_res(ts->input, ABS_MT_POSITION_X, ts->ppm_x); 1099 + input_abs_set_res(ts->input, ABS_MT_POSITION_Y, ts->ppm_y); 1100 + input_abs_set_res(ts->input, ABS_X, ts->ppm_x); 1101 + input_abs_set_res(ts->input, ABS_Y, ts->ppm_y); 1110 1102 1111 1103 return error ? error : 0; 1112 1104 } ··· 1393 1377 MIP4_TOUCH_MAJOR_MIN, MIP4_TOUCH_MAJOR_MAX, 0, 0); 1394 1378 input_set_abs_params(input, ABS_MT_TOUCH_MINOR, 1395 1379 MIP4_TOUCH_MINOR_MIN, MIP4_TOUCH_MINOR_MAX, 0, 0); 1380 + input_abs_set_res(ts->input, ABS_MT_POSITION_X, ts->ppm_x); 1381 + input_abs_set_res(ts->input, ABS_MT_POSITION_Y, ts->ppm_y); 1396 1382 1397 1383 error = input_mt_init_slots(input, MIP4_MAX_FINGERS, INPUT_MT_DIRECT); 1398 1384 if (error) ··· 1512 1494 module_i2c_driver(mip4_driver); 1513 1495 1514 1496 MODULE_DESCRIPTION("MELFAS MIP4 Touchscreen"); 1515 - MODULE_VERSION("2016.01.13"); 1497 + MODULE_VERSION("2016.03.03"); 1516 1498 MODULE_AUTHOR("Sangwon Jee <jeesw@melfas.com>"); 1517 1499 MODULE_LICENSE("GPL");