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

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input

Pull input fixes from Dmitry Torokhov:
"A fix for the warnings/oops when handling HID devices with "unnamed"
LEDs and couple of other driver fixups""

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
Input: goodix - fix touch coordinates on WinBook TW100 and TW700
Input: LEDs - skip unnamed LEDs
Input: usbtouchscreen - avoid unresponsive TSC-30 touch screen
Input: elantech - force resolution of 31 u/mm
Input: zforce - don't overwrite the stack

+62 -8
+14 -2
drivers/input/input-leds.c
··· 71 71 { 72 72 } 73 73 74 + static int input_leds_get_count(struct input_dev *dev) 75 + { 76 + unsigned int led_code; 77 + int count = 0; 78 + 79 + for_each_set_bit(led_code, dev->ledbit, LED_CNT) 80 + if (input_led_info[led_code].name) 81 + count++; 82 + 83 + return count; 84 + } 85 + 74 86 static int input_leds_connect(struct input_handler *handler, 75 87 struct input_dev *dev, 76 88 const struct input_device_id *id) ··· 93 81 int led_no; 94 82 int error; 95 83 96 - num_leds = bitmap_weight(dev->ledbit, LED_CNT); 84 + num_leds = input_leds_get_count(dev); 97 85 if (!num_leds) 98 86 return -ENXIO; 99 87 ··· 124 112 led->handle = &leds->handle; 125 113 led->code = led_code; 126 114 127 - if (WARN_ON(!input_led_info[led_code].name)) 115 + if (!input_led_info[led_code].name) 128 116 continue; 129 117 130 118 led->cdev.name = kasprintf(GFP_KERNEL, "%s::%s",
+8 -5
drivers/input/mouse/elantech.c
··· 1167 1167 struct input_dev *dev = psmouse->dev; 1168 1168 struct elantech_data *etd = psmouse->private; 1169 1169 unsigned int x_min = 0, y_min = 0, x_max = 0, y_max = 0, width = 0; 1170 - unsigned int x_res = 0, y_res = 0; 1170 + unsigned int x_res = 31, y_res = 31; 1171 1171 1172 1172 if (elantech_set_range(psmouse, &x_min, &y_min, &x_max, &y_max, &width)) 1173 1173 return -1; ··· 1232 1232 /* For X to recognize me as touchpad. */ 1233 1233 input_set_abs_params(dev, ABS_X, x_min, x_max, 0, 0); 1234 1234 input_set_abs_params(dev, ABS_Y, y_min, y_max, 0, 0); 1235 - input_abs_set_res(dev, ABS_X, x_res); 1236 - input_abs_set_res(dev, ABS_Y, y_res); 1237 1235 /* 1238 1236 * range of pressure and width is the same as v2, 1239 1237 * report ABS_PRESSURE, ABS_TOOL_WIDTH for compatibility. ··· 1244 1246 input_mt_init_slots(dev, ETP_MAX_FINGERS, 0); 1245 1247 input_set_abs_params(dev, ABS_MT_POSITION_X, x_min, x_max, 0, 0); 1246 1248 input_set_abs_params(dev, ABS_MT_POSITION_Y, y_min, y_max, 0, 0); 1247 - input_abs_set_res(dev, ABS_MT_POSITION_X, x_res); 1248 - input_abs_set_res(dev, ABS_MT_POSITION_Y, y_res); 1249 1249 input_set_abs_params(dev, ABS_MT_PRESSURE, ETP_PMIN_V2, 1250 1250 ETP_PMAX_V2, 0, 0); 1251 1251 /* ··· 1253 1257 input_set_abs_params(dev, ABS_MT_TOUCH_MAJOR, 0, 1254 1258 ETP_WMAX_V2 * width, 0, 0); 1255 1259 break; 1260 + } 1261 + 1262 + input_abs_set_res(dev, ABS_X, x_res); 1263 + input_abs_set_res(dev, ABS_Y, y_res); 1264 + if (etd->hw_version > 1) { 1265 + input_abs_set_res(dev, ABS_MT_POSITION_X, x_res); 1266 + input_abs_set_res(dev, ABS_MT_POSITION_Y, y_res); 1256 1267 } 1257 1268 1258 1269 etd->y_max = y_max;
+36
drivers/input/touchscreen/goodix.c
··· 15 15 */ 16 16 17 17 #include <linux/kernel.h> 18 + #include <linux/dmi.h> 18 19 #include <linux/i2c.h> 19 20 #include <linux/input.h> 20 21 #include <linux/input/mt.h> ··· 35 34 int abs_y_max; 36 35 unsigned int max_touch_num; 37 36 unsigned int int_trigger_type; 37 + bool rotated_screen; 38 38 }; 39 39 40 40 #define GOODIX_MAX_HEIGHT 4096 ··· 60 58 IRQ_TYPE_EDGE_FALLING, 61 59 IRQ_TYPE_LEVEL_LOW, 62 60 IRQ_TYPE_LEVEL_HIGH, 61 + }; 62 + 63 + /* 64 + * Those tablets have their coordinates origin at the bottom right 65 + * of the tablet, as if rotated 180 degrees 66 + */ 67 + static const struct dmi_system_id rotated_screen[] = { 68 + #if defined(CONFIG_DMI) && defined(CONFIG_X86) 69 + { 70 + .ident = "WinBook TW100", 71 + .matches = { 72 + DMI_MATCH(DMI_SYS_VENDOR, "WinBook"), 73 + DMI_MATCH(DMI_PRODUCT_NAME, "TW100") 74 + } 75 + }, 76 + { 77 + .ident = "WinBook TW700", 78 + .matches = { 79 + DMI_MATCH(DMI_SYS_VENDOR, "WinBook"), 80 + DMI_MATCH(DMI_PRODUCT_NAME, "TW700") 81 + }, 82 + }, 83 + #endif 84 + {} 63 85 }; 64 86 65 87 /** ··· 154 128 int input_x = get_unaligned_le16(&coor_data[1]); 155 129 int input_y = get_unaligned_le16(&coor_data[3]); 156 130 int input_w = get_unaligned_le16(&coor_data[5]); 131 + 132 + if (ts->rotated_screen) { 133 + input_x = ts->abs_x_max - input_x; 134 + input_y = ts->abs_y_max - input_y; 135 + } 157 136 158 137 input_mt_slot(ts->input_dev, id); 159 138 input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, true); ··· 254 223 ts->abs_y_max = GOODIX_MAX_HEIGHT; 255 224 ts->max_touch_num = GOODIX_MAX_CONTACTS; 256 225 } 226 + 227 + ts->rotated_screen = dmi_check_system(rotated_screen); 228 + if (ts->rotated_screen) 229 + dev_dbg(&ts->client->dev, 230 + "Applying '180 degrees rotated screen' quirk\n"); 257 231 } 258 232 259 233 /**
+3
drivers/input/touchscreen/usbtouchscreen.c
··· 627 627 goto err_out; 628 628 } 629 629 630 + /* TSC-25 data sheet specifies a delay after the RESET command */ 631 + msleep(150); 632 + 630 633 /* set coordinate output rate */ 631 634 buf[0] = buf[1] = 0xFF; 632 635 ret = usb_control_msg(dev, usb_rcvctrlpipe (dev, 0),
+1 -1
drivers/input/touchscreen/zforce_ts.c
··· 429 429 goto unlock; 430 430 } 431 431 432 - if (buf[PAYLOAD_LENGTH] == 0) { 432 + if (buf[PAYLOAD_LENGTH] == 0 || buf[PAYLOAD_LENGTH] > FRAME_MAXSIZE) { 433 433 dev_err(&client->dev, "invalid payload length: %d\n", 434 434 buf[PAYLOAD_LENGTH]); 435 435 ret = -EIO;