* [PATCH 0/4] Input: touchscreen - parse touchscreen-x-mm and touchscreen-y-mm properties
@ 2026-11-03 4:47 Dmitry Torokhov
2026-11-03 4:47 ` [PATCH 1/4] Input: touchscreen - parse touchscreen-x-mm and touchscreen-y-mm Dmitry Torokhov
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Dmitry Torokhov @ 2026-11-03 4:47 UTC (permalink / raw)
To: Hans de Goede, David Heidelberg
Cc: Neil Armstrong, Val Packett, Hendrik Noack, Ferass El Hafidi,
Sasha Finkelstein, Jeff LaBundy, linux-input, asahi,
linux-arm-kernel, linux-kernel
The common touchscreen device tree binding documents touchscreen-x-mm
and touchscreen-y-mm to specify the physical dimensions of the touch
surface, which userspace uses via axis resolution (units/mm) for gesture
scaling and palm rejection. However, touchscreen_parse_properties() has
not been parsing these properties.
This series teaches touchscreen_parse_properties() to read
touchscreen-x-mm and touchscreen-y-mm and calculate the corresponding X
and Y axis resolutions from the configured axis ranges, accompanied by
KUnit tests.
It also updates wacom_w9000 to drop its manual parsing of these
properties, and adjusts goodix-berlin and apple_z2 to set their fallback
resolutions before calling touchscreen_parse_properties() so firmware-
provided dimensions can override the defaults instead of being
clobbered.
Dmitry Torokhov (4):
Input: touchscreen - parse touchscreen-x-mm and touchscreen-y-mm
Input: wacom_w9000 - rely on touchscreen_parse_properties() for
resolution
Input: goodix-berlin - set default resolution before parsing
properties
Input: apple_z2 - set default resolution before parsing properties
drivers/input/tests/Makefile | 1 +
drivers/input/tests/touchscreen_test.c | 209 ++++++++++++++++++
drivers/input/touchscreen.c | 18 +-
drivers/input/touchscreen/apple_z2.c | 2 +-
.../input/touchscreen/goodix_berlin_core.c | 4 +-
drivers/input/touchscreen/wacom_w9000.c | 10 -
6 files changed, 226 insertions(+), 18 deletions(-)
create mode 100644 drivers/input/tests/touchscreen_test.c
--
2.56.0.385.gac671c819a-goog
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/4] Input: touchscreen - parse touchscreen-x-mm and touchscreen-y-mm
2026-11-03 4:47 [PATCH 0/4] Input: touchscreen - parse touchscreen-x-mm and touchscreen-y-mm properties Dmitry Torokhov
@ 2026-11-03 4:47 ` Dmitry Torokhov
2026-11-03 4:47 ` [PATCH 2/4] Input: wacom_w9000 - rely on touchscreen_parse_properties() for resolution Dmitry Torokhov
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Dmitry Torokhov @ 2026-11-03 4:47 UTC (permalink / raw)
To: Hans de Goede, David Heidelberg
Cc: Neil Armstrong, Val Packett, Hendrik Noack, Ferass El Hafidi,
Sasha Finkelstein, Jeff LaBundy, linux-input, asahi,
linux-arm-kernel, linux-kernel
The touchscreen device tree bindings define common touchscreen-x-mm and
touchscreen-y-mm properties specifying the physical dimensions of the
touchscreen in millimeters. However, touchscreen_parse_properties() does
not parse these properties, forcing individual drivers to parse them
manually or fall back to arbitrary resolution values.
Parse touchscreen-x-mm and touchscreen-y-mm in
touchscreen_parse_properties() and calculate axis resolution in units
per millimeter as the coordinate count (maximum - minimum + 1) divided
by the physical dimension, rounded to the nearest integer. Guard against
zero physical size or invalid axis ranges, and preserve pre-existing
resolution settings when the properties are omitted. Apply resolution
before early exit so callers passing a NULL properties pointer still
get axes configured and so coordinate inversion and axis swapping
continue to work seamlessly. Also add KUnit test coverage for resolution
calculation.
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
drivers/input/tests/Makefile | 1 +
drivers/input/tests/touchscreen_test.c | 209 +++++++++++++++++++++++++
drivers/input/touchscreen.c | 18 ++-
3 files changed, 223 insertions(+), 5 deletions(-)
create mode 100644 drivers/input/tests/touchscreen_test.c
diff --git a/drivers/input/tests/Makefile b/drivers/input/tests/Makefile
index 90cf954181bc..b5e769d9f8cc 100644
--- a/drivers/input/tests/Makefile
+++ b/drivers/input/tests/Makefile
@@ -1,3 +1,4 @@
# SPDX-License-Identifier: GPL-2.0
obj-$(CONFIG_INPUT_KUNIT_TEST) += input_test.o
+obj-$(CONFIG_INPUT_KUNIT_TEST) += touchscreen_test.o
diff --git a/drivers/input/tests/touchscreen_test.c b/drivers/input/tests/touchscreen_test.c
new file mode 100644
index 000000000000..f8661c349fcc
--- /dev/null
+++ b/drivers/input/tests/touchscreen_test.c
@@ -0,0 +1,209 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * KUnit test for touchscreen property parsing.
+ */
+
+#include <linux/input.h>
+#include <linux/input/touchscreen.h>
+#include <linux/property.h>
+
+#include <kunit/device.h>
+#include <kunit/test.h>
+
+static struct input_dev *
+touchscreen_test_create_device(struct kunit *test,
+ const struct property_entry *props)
+{
+ struct input_dev *input_dev;
+ struct device *dev;
+
+ dev = kunit_device_register(test, "touchscreen-test-dev");
+ KUNIT_ASSERT_NOT_ERR_OR_NULL(test, dev);
+
+ if (props)
+ KUNIT_ASSERT_EQ(test,
+ device_create_managed_software_node(dev, props, NULL),
+ 0);
+
+ input_dev = devm_input_allocate_device(dev);
+ KUNIT_ASSERT_NOT_ERR_OR_NULL(test, input_dev);
+
+ return input_dev;
+}
+
+static void touchscreen_test_resolution_single(struct kunit *test)
+{
+ const struct property_entry props[] = {
+ PROPERTY_ENTRY_U32("touchscreen-x-mm", 100),
+ PROPERTY_ENTRY_U32("touchscreen-y-mm", 200),
+ { }
+ };
+ struct touchscreen_properties prop;
+ struct input_dev *input_dev;
+
+ input_dev = touchscreen_test_create_device(test, props);
+
+ /* Driver-supplied ranges: 0..999 (1000 units), 0..1999 (2000 units) */
+ input_set_abs_params(input_dev, ABS_X, 0, 999, 0, 0);
+ input_set_abs_params(input_dev, ABS_Y, 0, 1999, 0, 0);
+
+ touchscreen_parse_properties(input_dev, false, &prop);
+
+ KUNIT_EXPECT_EQ(test, input_abs_get_res(input_dev, ABS_X), 10);
+ KUNIT_EXPECT_EQ(test, input_abs_get_res(input_dev, ABS_Y), 10);
+}
+
+static void touchscreen_test_resolution_multitouch(struct kunit *test)
+{
+ const struct property_entry props[] = {
+ PROPERTY_ENTRY_U32("touchscreen-min-x", 10),
+ PROPERTY_ENTRY_U32("touchscreen-size-x", 1010),
+ PROPERTY_ENTRY_U32("touchscreen-x-mm", 50),
+ PROPERTY_ENTRY_U32("touchscreen-min-y", 20),
+ PROPERTY_ENTRY_U32("touchscreen-size-y", 2020),
+ PROPERTY_ENTRY_U32("touchscreen-y-mm", 100),
+ { }
+ };
+ struct touchscreen_properties prop;
+ struct input_dev *input_dev;
+
+ input_dev = touchscreen_test_create_device(test, props);
+
+ /* Multitouch axes setup */
+ input_set_abs_params(input_dev, ABS_MT_POSITION_X, 0, 1, 0, 0);
+ input_set_abs_params(input_dev, ABS_MT_POSITION_Y, 0, 1, 0, 0);
+
+ touchscreen_parse_properties(input_dev, true, &prop);
+
+ /* min=10, max=1009, count=1000, 1000 / 50 = 20 */
+ KUNIT_EXPECT_EQ(test, input_abs_get_res(input_dev, ABS_MT_POSITION_X), 20);
+ /* min=20, max=2019, count=2000, 2000 / 100 = 20 */
+ KUNIT_EXPECT_EQ(test, input_abs_get_res(input_dev, ABS_MT_POSITION_Y), 20);
+}
+
+static void touchscreen_test_resolution_rounding(struct kunit *test)
+{
+ const struct property_entry props[] = {
+ /* 1951 / 100 = 19.51 -> rounds to 20 */
+ PROPERTY_ENTRY_U32("touchscreen-size-x", 1951),
+ PROPERTY_ENTRY_U32("touchscreen-x-mm", 100),
+ /* 1949 / 100 = 19.49 -> rounds to 19 */
+ PROPERTY_ENTRY_U32("touchscreen-size-y", 1949),
+ PROPERTY_ENTRY_U32("touchscreen-y-mm", 100),
+ { }
+ };
+ struct touchscreen_properties prop;
+ struct input_dev *input_dev;
+
+ input_dev = touchscreen_test_create_device(test, props);
+
+ input_set_abs_params(input_dev, ABS_MT_POSITION_X, 0, 1, 0, 0);
+ input_set_abs_params(input_dev, ABS_MT_POSITION_Y, 0, 1, 0, 0);
+
+ touchscreen_parse_properties(input_dev, true, &prop);
+
+ KUNIT_EXPECT_EQ(test, input_abs_get_res(input_dev, ABS_MT_POSITION_X), 20);
+ KUNIT_EXPECT_EQ(test, input_abs_get_res(input_dev, ABS_MT_POSITION_Y), 19);
+}
+
+static void touchscreen_test_resolution_swap_invert(struct kunit *test)
+{
+ const struct property_entry props[] = {
+ PROPERTY_ENTRY_U32("touchscreen-x-mm", 50),
+ PROPERTY_ENTRY_U32("touchscreen-y-mm", 200),
+ PROPERTY_ENTRY_BOOL("touchscreen-inverted-x"),
+ PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
+ { }
+ };
+ struct touchscreen_properties prop;
+ struct input_dev *input_dev;
+
+ input_dev = touchscreen_test_create_device(test, props);
+
+ /* X count = 1000, Y count = 2000 */
+ input_set_abs_params(input_dev, ABS_MT_POSITION_X, 0, 999, 0, 0);
+ input_set_abs_params(input_dev, ABS_MT_POSITION_Y, 0, 1999, 0, 0);
+
+ touchscreen_parse_properties(input_dev, true, &prop);
+
+ /*
+ * Before swap: X res = 1000/50 = 20, Y res = 2000/200 = 10.
+ * After swap: X absinfo receives Y absinfo, Y absinfo receives X absinfo.
+ */
+ KUNIT_EXPECT_EQ(test, input_abs_get_res(input_dev, ABS_MT_POSITION_X), 10);
+ KUNIT_EXPECT_EQ(test, input_abs_get_res(input_dev, ABS_MT_POSITION_Y), 20);
+ KUNIT_EXPECT_TRUE(test, prop.invert_x);
+ KUNIT_EXPECT_TRUE(test, prop.swap_x_y);
+}
+
+static void touchscreen_test_resolution_edge_cases(struct kunit *test)
+{
+ const struct property_entry props[] = {
+ /* Zero x-mm */
+ PROPERTY_ENTRY_U32("touchscreen-x-mm", 0),
+ /* y-mm omitted */
+ { }
+ };
+ struct touchscreen_properties prop;
+ struct input_dev *input_dev;
+
+ input_dev = touchscreen_test_create_device(test, props);
+
+ input_set_abs_params(input_dev, ABS_MT_POSITION_X, 0, 999, 0, 0);
+ input_set_abs_params(input_dev, ABS_MT_POSITION_Y, 0, 1999, 0, 0);
+
+ /* Pre-configure resolutions */
+ input_abs_set_res(input_dev, ABS_MT_POSITION_X, 15);
+ input_abs_set_res(input_dev, ABS_MT_POSITION_Y, 25);
+
+ touchscreen_parse_properties(input_dev, true, &prop);
+
+ /* Zero size and omitted property must preserve pre-existing resolutions */
+ KUNIT_EXPECT_EQ(test, input_abs_get_res(input_dev, ABS_MT_POSITION_X), 15);
+ KUNIT_EXPECT_EQ(test, input_abs_get_res(input_dev, ABS_MT_POSITION_Y), 25);
+}
+
+static void touchscreen_test_resolution_invalid_range_and_null_prop(struct kunit *test)
+{
+ const struct property_entry props[] = {
+ PROPERTY_ENTRY_U32("touchscreen-x-mm", 50),
+ PROPERTY_ENTRY_U32("touchscreen-y-mm", 50),
+ { }
+ };
+ struct input_dev *input_dev;
+
+ input_dev = touchscreen_test_create_device(test, props);
+
+ /* X has valid range 0..999 (1000 units), Y has invalid range 500..500 */
+ input_set_abs_params(input_dev, ABS_MT_POSITION_X, 0, 999, 0, 0);
+ input_set_abs_params(input_dev, ABS_MT_POSITION_Y, 500, 500, 0, 0);
+ input_abs_set_res(input_dev, ABS_MT_POSITION_Y, 42);
+
+ /* NULL prop pointer */
+ touchscreen_parse_properties(input_dev, true, NULL);
+
+ /* Valid X gets resolution computed even with prop == NULL */
+ KUNIT_EXPECT_EQ(test, input_abs_get_res(input_dev, ABS_MT_POSITION_X), 20);
+ /* Invalid Y range (max <= min) preserves pre-configured resolution */
+ KUNIT_EXPECT_EQ(test, input_abs_get_res(input_dev, ABS_MT_POSITION_Y), 42);
+}
+
+static struct kunit_case touchscreen_tests[] = {
+ KUNIT_CASE(touchscreen_test_resolution_single),
+ KUNIT_CASE(touchscreen_test_resolution_multitouch),
+ KUNIT_CASE(touchscreen_test_resolution_rounding),
+ KUNIT_CASE(touchscreen_test_resolution_swap_invert),
+ KUNIT_CASE(touchscreen_test_resolution_edge_cases),
+ KUNIT_CASE(touchscreen_test_resolution_invalid_range_and_null_prop),
+ { /* sentinel */ }
+};
+
+static struct kunit_suite touchscreen_test_suite = {
+ .name = "touchscreen",
+ .test_cases = touchscreen_tests,
+};
+
+kunit_test_suite(touchscreen_test_suite);
+
+MODULE_DESCRIPTION("KUnit test for touchscreen property parsing");
+MODULE_LICENSE("GPL");
diff --git a/drivers/input/touchscreen.c b/drivers/input/touchscreen.c
index d699b24bb548..05ddb2ea7c66 100644
--- a/drivers/input/touchscreen.c
+++ b/drivers/input/touchscreen.c
@@ -7,6 +7,7 @@
*/
#include <linux/export.h>
+#include <linux/math.h>
#include <linux/property.h>
#include <linux/input.h>
#include <linux/input/mt.h>
@@ -33,7 +34,8 @@ static bool touchscreen_get_prop_u32(struct device *dev,
static void touchscreen_set_params(struct input_dev *dev,
unsigned long axis,
- int min, int max, int fuzz)
+ int min, int max, int fuzz,
+ unsigned int size_mm)
{
struct input_absinfo *absinfo;
@@ -48,6 +50,8 @@ static void touchscreen_set_params(struct input_dev *dev,
absinfo->minimum = min;
absinfo->maximum = max;
absinfo->fuzz = fuzz;
+ if (size_mm && min >= 0 && max > min)
+ absinfo->resolution = DIV_ROUND_CLOSEST(max - min + 1, size_mm);
}
/**
@@ -69,7 +73,7 @@ void touchscreen_parse_properties(struct input_dev *input, bool multitouch,
struct device *dev = input->dev.parent;
struct input_absinfo *absinfo;
unsigned int axis, axis_x, axis_y;
- unsigned int minimum, maximum, fuzz;
+ unsigned int minimum, maximum, fuzz, size_mm;
bool data_present;
input_alloc_absinfo(input);
@@ -89,8 +93,10 @@ void touchscreen_parse_properties(struct input_dev *input, bool multitouch,
data_present |= touchscreen_get_prop_u32(dev, "touchscreen-fuzz-x",
input_abs_get_fuzz(input, axis_x),
&fuzz);
+ data_present |= touchscreen_get_prop_u32(dev, "touchscreen-x-mm", 0,
+ &size_mm);
if (data_present)
- touchscreen_set_params(input, axis_x, minimum, maximum - 1, fuzz);
+ touchscreen_set_params(input, axis_x, minimum, maximum - 1, fuzz, size_mm);
data_present = touchscreen_get_prop_u32(dev, "touchscreen-min-y",
input_abs_get_min(input, axis_y),
@@ -102,8 +108,10 @@ void touchscreen_parse_properties(struct input_dev *input, bool multitouch,
data_present |= touchscreen_get_prop_u32(dev, "touchscreen-fuzz-y",
input_abs_get_fuzz(input, axis_y),
&fuzz);
+ data_present |= touchscreen_get_prop_u32(dev, "touchscreen-y-mm", 0,
+ &size_mm);
if (data_present)
- touchscreen_set_params(input, axis_y, minimum, maximum - 1, fuzz);
+ touchscreen_set_params(input, axis_y, minimum, maximum - 1, fuzz, size_mm);
axis = multitouch ? ABS_MT_PRESSURE : ABS_PRESSURE;
data_present = touchscreen_get_prop_u32(dev,
@@ -115,7 +123,7 @@ void touchscreen_parse_properties(struct input_dev *input, bool multitouch,
input_abs_get_fuzz(input, axis),
&fuzz);
if (data_present)
- touchscreen_set_params(input, axis, 0, maximum, fuzz);
+ touchscreen_set_params(input, axis, 0, maximum, fuzz, 0);
if (!prop)
return;
--
2.56.0.385.gac671c819a-goog
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 2/4] Input: wacom_w9000 - rely on touchscreen_parse_properties() for resolution
2026-11-03 4:47 [PATCH 0/4] Input: touchscreen - parse touchscreen-x-mm and touchscreen-y-mm properties Dmitry Torokhov
2026-11-03 4:47 ` [PATCH 1/4] Input: touchscreen - parse touchscreen-x-mm and touchscreen-y-mm Dmitry Torokhov
@ 2026-11-03 4:47 ` Dmitry Torokhov
2026-11-03 4:47 ` [PATCH 3/4] Input: goodix-berlin - set default resolution before parsing properties Dmitry Torokhov
2026-11-03 4:47 ` [PATCH 4/4] Input: apple_z2 " Dmitry Torokhov
3 siblings, 0 replies; 6+ messages in thread
From: Dmitry Torokhov @ 2026-11-03 4:47 UTC (permalink / raw)
To: Hans de Goede, David Heidelberg
Cc: Neil Armstrong, Val Packett, Hendrik Noack, Ferass El Hafidi,
Sasha Finkelstein, Jeff LaBundy, linux-input, asahi,
linux-arm-kernel, linux-kernel
The input core's touchscreen_parse_properties() helper now parses the
touchscreen-x-mm and touchscreen-y-mm properties and calculates axis
resolution in units per millimeter automatically, including handling
axis swapping.
Rely on touchscreen_parse_properties() to configure axis resolutions and
remove the manual property parsing and resolution assignment block in
wacom_w9000_probe(), along with the now-unused local variable.
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
drivers/input/touchscreen/wacom_w9000.c | 10 ----------
1 file changed, 10 deletions(-)
diff --git a/drivers/input/touchscreen/wacom_w9000.c b/drivers/input/touchscreen/wacom_w9000.c
index 4a2629a54167..51c5301262d3 100644
--- a/drivers/input/touchscreen/wacom_w9000.c
+++ b/drivers/input/touchscreen/wacom_w9000.c
@@ -249,7 +249,6 @@ static int wacom_w9000_probe(struct i2c_client *client)
struct wacom_w9000_data *wacom_data;
struct input_dev *input_dev;
int error;
- u32 val;
if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
dev_err(dev, "i2c_check_functionality error\n");
@@ -350,15 +349,6 @@ static int wacom_w9000_probe(struct i2c_client *client)
dev_info(dev, "%s size X%uY%u\n", wacom_data->variant->name,
wacom_data->prop.max_x, wacom_data->prop.max_y);
- error = device_property_read_u32(dev, "touchscreen-x-mm", &val);
- if (!error && val)
- input_abs_set_res(input_dev, wacom_data->prop.swap_x_y ? ABS_Y : ABS_X,
- wacom_data->prop.max_x / val);
- error = device_property_read_u32(dev, "touchscreen-y-mm", &val);
- if (!error && val)
- input_abs_set_res(input_dev, wacom_data->prop.swap_x_y ? ABS_X : ABS_Y,
- wacom_data->prop.max_y / val);
-
error = input_register_device(wacom_data->input_dev);
if (error)
return dev_err_probe(dev, error, "Failed to register input device\n");
--
2.56.0.385.gac671c819a-goog
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 3/4] Input: goodix-berlin - set default resolution before parsing properties
2026-11-03 4:47 [PATCH 0/4] Input: touchscreen - parse touchscreen-x-mm and touchscreen-y-mm properties Dmitry Torokhov
2026-11-03 4:47 ` [PATCH 1/4] Input: touchscreen - parse touchscreen-x-mm and touchscreen-y-mm Dmitry Torokhov
2026-11-03 4:47 ` [PATCH 2/4] Input: wacom_w9000 - rely on touchscreen_parse_properties() for resolution Dmitry Torokhov
@ 2026-11-03 4:47 ` Dmitry Torokhov
2026-11-03 9:58 ` Neil Armstrong
2026-11-03 4:47 ` [PATCH 4/4] Input: apple_z2 " Dmitry Torokhov
3 siblings, 1 reply; 6+ messages in thread
From: Dmitry Torokhov @ 2026-11-03 4:47 UTC (permalink / raw)
To: Hans de Goede, David Heidelberg
Cc: Neil Armstrong, Val Packett, Hendrik Noack, Ferass El Hafidi,
Sasha Finkelstein, Jeff LaBundy, linux-input, asahi,
linux-arm-kernel, linux-kernel
goodix_berlin_input_dev_config() currently configures the default
10 units/mm resolution on ABS_MT_POSITION_X and ABS_MT_POSITION_Y after
calling touchscreen_parse_properties(). This unconditionally overwrites
any axis resolution calculated by touchscreen_parse_properties() from
touchscreen-x-mm and touchscreen-y-mm device properties.
Set the default resolution before calling touchscreen_parse_properties()
so the default resolution remains in place when physical dimensions are
not specified, while allowing touchscreen-x-mm and touchscreen-y-mm to
override it when present.
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
drivers/input/touchscreen/goodix_berlin_core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/input/touchscreen/goodix_berlin_core.c b/drivers/input/touchscreen/goodix_berlin_core.c
index b0938a4f3fec..5cf453427eeb 100644
--- a/drivers/input/touchscreen/goodix_berlin_core.c
+++ b/drivers/input/touchscreen/goodix_berlin_core.c
@@ -626,8 +626,6 @@ static int goodix_berlin_input_dev_config(struct goodix_berlin_core *cd,
0, SZ_64K - 1, 0, 0);
input_set_abs_params(cd->input_dev, ABS_MT_TOUCH_MAJOR, 0, 255, 0, 0);
- touchscreen_parse_properties(cd->input_dev, true, &cd->props);
-
/*
* The resolution of these touchscreens is about 10 units/mm, the actual
* resolution does not matter much since we set INPUT_PROP_DIRECT.
@@ -636,6 +634,8 @@ static int goodix_berlin_input_dev_config(struct goodix_berlin_core *cd,
input_abs_set_res(cd->input_dev, ABS_MT_POSITION_X, 10);
input_abs_set_res(cd->input_dev, ABS_MT_POSITION_Y, 10);
+ touchscreen_parse_properties(cd->input_dev, true, &cd->props);
+
error = input_mt_init_slots(cd->input_dev, GOODIX_BERLIN_MAX_TOUCH,
INPUT_MT_DIRECT | INPUT_MT_DROP_UNUSED);
if (error)
--
2.56.0.385.gac671c819a-goog
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 4/4] Input: apple_z2 - set default resolution before parsing properties
2026-11-03 4:47 [PATCH 0/4] Input: touchscreen - parse touchscreen-x-mm and touchscreen-y-mm properties Dmitry Torokhov
` (2 preceding siblings ...)
2026-11-03 4:47 ` [PATCH 3/4] Input: goodix-berlin - set default resolution before parsing properties Dmitry Torokhov
@ 2026-11-03 4:47 ` Dmitry Torokhov
3 siblings, 0 replies; 6+ messages in thread
From: Dmitry Torokhov @ 2026-11-03 4:47 UTC (permalink / raw)
To: Hans de Goede, David Heidelberg
Cc: Neil Armstrong, Val Packett, Hendrik Noack, Ferass El Hafidi,
Sasha Finkelstein, Jeff LaBundy, linux-input, asahi,
linux-arm-kernel, linux-kernel
apple_z2_probe() currently sets the default 100 units/mm resolution on
ABS_MT_POSITION_X and ABS_MT_POSITION_Y after calling
touchscreen_parse_properties(). This unconditionally overwrites any axis
resolution calculated by touchscreen_parse_properties() from
touchscreen-x-mm and touchscreen-y-mm device properties.
Set the default resolution before calling touchscreen_parse_properties()
so the default resolution remains in place when physical dimensions are
omitted, while allowing touchscreen-x-mm and touchscreen-y-mm to
override it when present.
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
drivers/input/touchscreen/apple_z2.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/input/touchscreen/apple_z2.c b/drivers/input/touchscreen/apple_z2.c
index 271ababf0ad5..e7863f8f1d5a 100644
--- a/drivers/input/touchscreen/apple_z2.c
+++ b/drivers/input/touchscreen/apple_z2.c
@@ -397,9 +397,9 @@ static int apple_z2_probe(struct spi_device *spi)
/* Allocate the axes before setting from DT */
input_set_abs_params(z2->input_dev, ABS_MT_POSITION_X, 0, 0, 0, 0);
input_set_abs_params(z2->input_dev, ABS_MT_POSITION_Y, 0, 0, 0, 0);
- touchscreen_parse_properties(z2->input_dev, true, &z2->props);
input_abs_set_res(z2->input_dev, ABS_MT_POSITION_X, 100);
input_abs_set_res(z2->input_dev, ABS_MT_POSITION_Y, 100);
+ touchscreen_parse_properties(z2->input_dev, true, &z2->props);
input_set_abs_params(z2->input_dev, ABS_MT_WIDTH_MAJOR, 0, 65535, 0, 0);
input_set_abs_params(z2->input_dev, ABS_MT_WIDTH_MINOR, 0, 65535, 0, 0);
input_set_abs_params(z2->input_dev, ABS_MT_TOUCH_MAJOR, 0, 65535, 0, 0);
--
2.56.0.385.gac671c819a-goog
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 3/4] Input: goodix-berlin - set default resolution before parsing properties
2026-11-03 4:47 ` [PATCH 3/4] Input: goodix-berlin - set default resolution before parsing properties Dmitry Torokhov
@ 2026-11-03 9:58 ` Neil Armstrong
0 siblings, 0 replies; 6+ messages in thread
From: Neil Armstrong @ 2026-11-03 9:58 UTC (permalink / raw)
To: Dmitry Torokhov, Hans de Goede, David Heidelberg
Cc: Val Packett, Hendrik Noack, Ferass El Hafidi, Sasha Finkelstein,
Jeff LaBundy, linux-input, asahi, linux-arm-kernel, linux-kernel
On 11/3/26 05:47, Dmitry Torokhov wrote:
> goodix_berlin_input_dev_config() currently configures the default
> 10 units/mm resolution on ABS_MT_POSITION_X and ABS_MT_POSITION_Y after
> calling touchscreen_parse_properties(). This unconditionally overwrites
> any axis resolution calculated by touchscreen_parse_properties() from
> touchscreen-x-mm and touchscreen-y-mm device properties.
>
> Set the default resolution before calling touchscreen_parse_properties()
> so the default resolution remains in place when physical dimensions are
> not specified, while allowing touchscreen-x-mm and touchscreen-y-mm to
> override it when present.
>
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> ---
> drivers/input/touchscreen/goodix_berlin_core.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/input/touchscreen/goodix_berlin_core.c b/drivers/input/touchscreen/goodix_berlin_core.c
> index b0938a4f3fec..5cf453427eeb 100644
> --- a/drivers/input/touchscreen/goodix_berlin_core.c
> +++ b/drivers/input/touchscreen/goodix_berlin_core.c
> @@ -626,8 +626,6 @@ static int goodix_berlin_input_dev_config(struct goodix_berlin_core *cd,
> 0, SZ_64K - 1, 0, 0);
> input_set_abs_params(cd->input_dev, ABS_MT_TOUCH_MAJOR, 0, 255, 0, 0);
>
> - touchscreen_parse_properties(cd->input_dev, true, &cd->props);
> -
> /*
> * The resolution of these touchscreens is about 10 units/mm, the actual
> * resolution does not matter much since we set INPUT_PROP_DIRECT.
> @@ -636,6 +634,8 @@ static int goodix_berlin_input_dev_config(struct goodix_berlin_core *cd,
> input_abs_set_res(cd->input_dev, ABS_MT_POSITION_X, 10);
> input_abs_set_res(cd->input_dev, ABS_MT_POSITION_Y, 10);
>
> + touchscreen_parse_properties(cd->input_dev, true, &cd->props);
> +
> error = input_mt_init_slots(cd->input_dev, GOODIX_BERLIN_MAX_TOUCH,
> INPUT_MT_DIRECT | INPUT_MT_DROP_UNUSED);
> if (error)
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Thanks,
Neil
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-11-03 9:58 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-03 4:47 [PATCH 0/4] Input: touchscreen - parse touchscreen-x-mm and touchscreen-y-mm properties Dmitry Torokhov
2026-11-03 4:47 ` [PATCH 1/4] Input: touchscreen - parse touchscreen-x-mm and touchscreen-y-mm Dmitry Torokhov
2026-11-03 4:47 ` [PATCH 2/4] Input: wacom_w9000 - rely on touchscreen_parse_properties() for resolution Dmitry Torokhov
2026-11-03 4:47 ` [PATCH 3/4] Input: goodix-berlin - set default resolution before parsing properties Dmitry Torokhov
2026-11-03 9:58 ` Neil Armstrong
2026-11-03 4:47 ` [PATCH 4/4] Input: apple_z2 " Dmitry Torokhov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®