Input: ads7846 - don't set ABS_PRESSURE when min == max
Subsystems (2)
PATCH 1/1 Input: ads7846 - don't set ABS_PRESSURE when min == max
From: Benjamin Bara <[email protected]>
When the optional fields "pressure_min" and "pressure_max" are not set, both fall back to 0, which results to the following libinput error:
ADS7846 Touchscreen: kernel bug: device has min == max on ABS_PRESSURE
Avoid it by only setting ABS_PRESSURE if the values differ.
--- drivers/input/touchscreen/ads7846.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/touchscreen/ads7846.c +1 -1
@@ -1281,7 +1281,7 @@ static int ads7846_probe(struct spi_device *spi) pdata->y_min ? :0 , pdata->y_max ? :MAX_12BIT , 0, 0); -if (ts->model !=7845 ) +if (ts->model !=7845 && pdata->pressure_min != pdata->pressure_max)input_set_abs_params (input_dev,ABS_PRESSURE , pdata->pressure_min, pdata->pressure_max,0 ,0 );
---
base-commit: 451cc82bd11eb6a374f4dbcfc1cf007eafea91ab
change-id: 20230727-ads7846-pressure-05edfb01887f
Best regards,
Signature · 1 line
Benjamin Bara <[email protected]>
Dmitry Torokhov
maintainerHi Benjamin,
Quoted 8 lines · Benjamin Bara
From: Benjamin Bara <[email protected]>
When the optional fields "
pressure_min" and "pressure_max" are not set, both fall back to 0, which results to the following libinput error:ADS7846 Touchscreen: kernel bug: device has min == max on
ABS_PRESSUREAvoid it by only setting
ABS_PRESSUREif the values differ.
What is the benefit of silently continuing without reporting pressure on models that do support pressure readings, vs. using libinput's errors as signal to adjust DT?
Quoted 24 lines
Signed-off-by Benjamin Bara <[email protected]>--- drivers/input/touchscreen/ads7846.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/input/touchscreen/ads7846.c +1
-2@@ -1281,7 +1281,7 @@ static int ads7846_probe(struct spi_device *spi) pdata->y_min ? :0 , pdata->y_max ? :MAX_12BIT , 0, 0); -if (ts->model !=7845 ) +if (ts->model !=7845 && pdata->pressure_min != pdata->pressure_max)input_set_abs_params (input_dev,ABS_PRESSURE , pdata->pressure_min, pdata->pressure_max,0 ,0 ); ---base-commit:
451cc82bd11eb6a374f4dbcfc1cf007eafea91ab
change-id: 20230727-ads7846-pressure-05edfb01887f
Quoted 4 lines
Best regards,
Signature · 1 line
Benjamin Bara <[email protected]>
Thanks.
Signature · 1 line
Dmitry
PATCH 1/1 Input: ads7846 - don't set ABS_PRESSURE when min == max
Hi Dmitry,
thank you for the feedback!
Quoted 6 lines · Dmitry Torokhov
Quoted 5 lines · Benjamin Bara
From: Benjamin Bara <[email protected]>
When the optional fields "
pressure_min" and "pressure_max" are not set, both fall back to 0, which results to the following libinput error:
Quoted 7 lines
Quoted 3 lines
ADS7846 Touchscreen: kernel bug: device has min == max on
ABS_PRESSUREAvoid it by only setting
ABS_PRESSUREif the values differ.What is the benefit of silently continuing without reporting pressure on models that do support pressure readings, vs. using libinput's errors as signal to adjust DT?
With the current implementation, libinput rejects the device [1] when an optional device-tree field is not set, which leads to a "non-functional" device. But you are right, silently continuing might also not be the best option... I could provide a v2 where the maximum is set to a fallback value (~0) and a warning is printed that the pressure is not set and therefore a fallback value is used, to signal the user to adjust the DT.
What do you think about that?
Best regards
Benjamin
[1] https://gitlab.freedesktop.org/libinput/libinput/-/blob/1.23.0/src/evdev.c?ref_type=tags#L1816