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

Configure Feed

Select the types of activity you want to include in your feed.

Input: ili210x - probe even if no resolution information

Probe the touch controller driver even if resolution information is not
available. This can happen e.g. in case the touch controller suffered a
failed firmware update and is stuck in bootloader mode.

Signed-off-by: Marek Vasut <marex@denx.de>
Link: https://lore.kernel.org/r/20230217025200.203833-1-marex@denx.de
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

authored by

Marek Vasut and committed by
Dmitry Torokhov
e1141b0c 5672bd30

+23 -13
+23 -13
drivers/input/touchscreen/ili210x.c
··· 370 370 371 371 /* The firmware update blob might have changed the resolution. */ 372 372 error = priv->chip->read_reg(client, REG_PANEL_INFO, &rs, sizeof(rs)); 373 - if (error) 374 - return error; 373 + if (!error) { 374 + resx = le16_to_cpup((__le16 *)rs); 375 + resy = le16_to_cpup((__le16 *)(rs + 2)); 375 376 376 - resx = le16_to_cpup((__le16 *)rs); 377 - resy = le16_to_cpup((__le16 *)(rs + 2)); 377 + /* The value reported by the firmware is invalid. */ 378 + if (!resx || resx == 0xffff || !resy || resy == 0xffff) 379 + error = -EINVAL; 380 + } 378 381 379 - /* The value reported by the firmware is invalid. */ 380 - if (!resx || resx == 0xffff || !resy || resy == 0xffff) 381 - return -EINVAL; 382 + /* 383 + * In case of error, the firmware might be stuck in bootloader mode, 384 + * e.g. after a failed firmware update. Set maximum resolution, but 385 + * do not fail to probe, so the user can re-trigger the firmware 386 + * update and recover the touch controller. 387 + */ 388 + if (error) { 389 + dev_warn(dev, "Invalid resolution reported by controller.\n"); 390 + resx = 16384; 391 + resy = 16384; 392 + } 382 393 383 394 input_abs_set_max(priv->input, ABS_X, resx - 1); 384 395 input_abs_set_max(priv->input, ABS_Y, resy - 1); 385 396 input_abs_set_max(priv->input, ABS_MT_POSITION_X, resx - 1); 386 397 input_abs_set_max(priv->input, ABS_MT_POSITION_Y, resy - 1); 387 398 388 - return 0; 399 + return error; 389 400 } 390 401 391 402 static ssize_t ili251x_firmware_update_firmware_version(struct device *dev) ··· 988 977 if (priv->chip->has_pressure_reg) 989 978 input_set_abs_params(input, ABS_MT_PRESSURE, 0, 0xa, 0, 0); 990 979 error = ili251x_firmware_update_cached_state(dev); 991 - if (error) { 992 - dev_err(dev, "Unable to cache firmware information, err: %d\n", 993 - error); 994 - return error; 995 - } 980 + if (error) 981 + dev_warn(dev, "Unable to cache firmware information, err: %d\n", 982 + error); 983 + 996 984 touchscreen_parse_properties(input, true, &priv->prop); 997 985 998 986 error = input_mt_init_slots(input, priv->chip->max_touches,