* [PATCH 1/2] Input: rmi4 - report difference between platform data and detected coord in F12
2026-07-31 18:13 [PATCH 0/2] Input: rmi4 - honor touchscreen-{x,y}-mm David Heidelberg via B4 Relay
@ 2026-07-31 18:13 ` David Heidelberg via B4 Relay
2026-07-31 18:13 ` [PATCH 2/2] Input: rmi4 - fallback to platform data for x/y-mm " David Heidelberg via B4 Relay
2026-08-05 5:21 ` [PATCH 0/2] Input: rmi4 - honor touchscreen-{x,y}-mm Dmitry Torokhov
2 siblings, 0 replies; 5+ messages in thread
From: David Heidelberg via B4 Relay @ 2026-07-31 18:13 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: linux-input, linux-kernel, phone-devel, David Heidelberg
From: David Heidelberg <david@ixit.cz>
Platform data may define touchscreen-x-mm and touchscreen-y-mm, but
these are quietly overridden by data provided by sensor.
Warn when detected data doesn't match the device-tree data.
Signed-off-by: David Heidelberg <david@ixit.cz>
---
drivers/input/rmi4/rmi_f12.c | 22 ++++++++++++++++++----
1 file changed, 18 insertions(+), 4 deletions(-)
diff --git a/drivers/input/rmi4/rmi_f12.c b/drivers/input/rmi4/rmi_f12.c
index 88c28089de993..88797556e738c 100644
--- a/drivers/input/rmi4/rmi_f12.c
+++ b/drivers/input/rmi4/rmi_f12.c
@@ -95,16 +95,17 @@ static int rmi_f12_read_sensor_tuning(struct f12_data *f12)
{
const struct rmi_register_desc_item *item;
struct rmi_2d_sensor *sensor = &f12->sensor;
struct rmi_function *fn = sensor->fn;
struct rmi_device *rmi_dev = fn->rmi_dev;
int ret;
int offset;
u8 buf[15];
+ u8 x_mm, y_mm;
int pitch_x = 0;
int pitch_y = 0;
int rx_receivers = 0;
int tx_receivers = 0;
u16 query_dpm_addr = 0;
int dpm_resolution = 0;
item = rmi_get_register_desc_item(&f12->control_reg_desc, 8);
@@ -166,33 +167,46 @@ static int rmi_f12_read_sensor_tuning(struct f12_data *f12)
query_dpm_addr = fn->fd.query_base_addr + offset;
ret = rmi_read(fn->rmi_dev, query_dpm_addr, buf);
if (ret) {
dev_err(&fn->dev, "Failed to read DPM value: %d\n", ret);
return ret;
}
dpm_resolution = buf[0];
- sensor->x_mm = sensor->max_x / dpm_resolution;
- sensor->y_mm = sensor->max_y / dpm_resolution;
+ x_mm = sensor->max_x / dpm_resolution;
+ y_mm = sensor->max_y / dpm_resolution;
} else {
if (rmi_register_desc_has_subpacket(item, 3)) {
rx_receivers = buf[offset];
tx_receivers = buf[offset + 1];
offset += 2;
}
/* Skip over sensor flags */
if (rmi_register_desc_has_subpacket(item, 4))
offset += 1;
- sensor->x_mm = (pitch_x * rx_receivers) >> 12;
- sensor->y_mm = (pitch_y * tx_receivers) >> 12;
+ x_mm = (pitch_x * rx_receivers) >> 12;
+ y_mm = (pitch_y * tx_receivers) >> 12;
}
+ if (sensor->x_mm && sensor->x_mm != x_mm)
+ dev_warn(&fn->dev,
+ "platform data x_mm (%d) != detected x_mm: (%d)\n",
+ sensor->x_mm, x_mm);
+
+ if (sensor->y_mm && sensor->y_mm != y_mm)
+ dev_warn(&fn->dev,
+ "platform data y_mm (%d) != detected y_mm: (%d)\n",
+ sensor->y_mm, y_mm);
+
+ sensor->x_mm = x_mm;
+ sensor->y_mm = y_mm;
+
rmi_dbg(RMI_DEBUG_FN, &fn->dev, "%s: x_mm: %d y_mm: %d\n", __func__,
sensor->x_mm, sensor->y_mm);
return 0;
}
static void rmi_f12_process_objects(struct f12_data *f12, u8 *data1, u32 size)
{
--
2.53.0
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH 2/2] Input: rmi4 - fallback to platform data for x/y-mm in F12
2026-07-31 18:13 [PATCH 0/2] Input: rmi4 - honor touchscreen-{x,y}-mm David Heidelberg via B4 Relay
2026-07-31 18:13 ` [PATCH 1/2] Input: rmi4 - report difference between platform data and detected coord in F12 David Heidelberg via B4 Relay
@ 2026-07-31 18:13 ` David Heidelberg via B4 Relay
2026-08-05 5:21 ` [PATCH 0/2] Input: rmi4 - honor touchscreen-{x,y}-mm Dmitry Torokhov
2 siblings, 0 replies; 5+ messages in thread
From: David Heidelberg via B4 Relay @ 2026-07-31 18:13 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: linux-input, linux-kernel, phone-devel, David Heidelberg
From: David Heidelberg <david@ixit.cz>
When detection for touchscreen-x-mm / y-mm returns 0, fallback to the
platform data, so we get meaningful values.
Signed-off-by: David Heidelberg <david@ixit.cz>
---
drivers/input/rmi4/rmi_f12.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/drivers/input/rmi4/rmi_f12.c b/drivers/input/rmi4/rmi_f12.c
index 88797556e738c..6f2e98c3a3499 100644
--- a/drivers/input/rmi4/rmi_f12.c
+++ b/drivers/input/rmi4/rmi_f12.c
@@ -194,18 +194,29 @@ static int rmi_f12_read_sensor_tuning(struct f12_data *f12)
"platform data x_mm (%d) != detected x_mm: (%d)\n",
sensor->x_mm, x_mm);
if (sensor->y_mm && sensor->y_mm != y_mm)
dev_warn(&fn->dev,
"platform data y_mm (%d) != detected y_mm: (%d)\n",
sensor->y_mm, y_mm);
- sensor->x_mm = x_mm;
- sensor->y_mm = y_mm;
+ if (x_mm)
+ sensor->x_mm = x_mm;
+ else
+ dev_warn(&fn->dev,
+ "x_mm detection returned 0, keeping %d\n",
+ sensor->x_mm);
+
+ if (y_mm)
+ sensor->y_mm = y_mm;
+ else
+ dev_warn(&fn->dev,
+ "y_mm detection returned 0, keeping %d\n",
+ sensor->y_mm);
rmi_dbg(RMI_DEBUG_FN, &fn->dev, "%s: x_mm: %d y_mm: %d\n", __func__,
sensor->x_mm, sensor->y_mm);
return 0;
}
static void rmi_f12_process_objects(struct f12_data *f12, u8 *data1, u32 size)
--
2.53.0
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH 0/2] Input: rmi4 - honor touchscreen-{x,y}-mm
2026-07-31 18:13 [PATCH 0/2] Input: rmi4 - honor touchscreen-{x,y}-mm David Heidelberg via B4 Relay
2026-07-31 18:13 ` [PATCH 1/2] Input: rmi4 - report difference between platform data and detected coord in F12 David Heidelberg via B4 Relay
2026-07-31 18:13 ` [PATCH 2/2] Input: rmi4 - fallback to platform data for x/y-mm " David Heidelberg via B4 Relay
@ 2026-08-05 5:21 ` Dmitry Torokhov
2026-08-06 17:06 ` David Heidelberg
2 siblings, 1 reply; 5+ messages in thread
From: Dmitry Torokhov @ 2026-08-05 5:21 UTC (permalink / raw)
To: david; +Cc: linux-input, linux-kernel, phone-devel
Hi David,
On Fri, Jul 31, 2026 at 08:13:40PM +0200, David Heidelberg via B4 Relay wrote:
> This series ensures, that when invalid value is detected or mismatch
> between value defined in the device-tree and the read from the
> touchscreen is observed, the user is notified and zero is ignored.
This seems very complicated. If board maker specifies these parameters,
they probably want to use them instead of what the firmware reports. So
wouldn't it be simpler to not try to match and report differences but
rather skip querying hardware and use device properties if they are
specified?
Thanks.
--
Dmitry
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH 0/2] Input: rmi4 - honor touchscreen-{x,y}-mm
2026-08-05 5:21 ` [PATCH 0/2] Input: rmi4 - honor touchscreen-{x,y}-mm Dmitry Torokhov
@ 2026-08-06 17:06 ` David Heidelberg
0 siblings, 0 replies; 5+ messages in thread
From: David Heidelberg @ 2026-08-06 17:06 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: linux-input, linux-kernel, phone-devel
On 05/08/2026 07:21, Dmitry Torokhov wrote:
> Hi David,
>
> On Fri, Jul 31, 2026 at 08:13:40PM +0200, David Heidelberg via B4 Relay wrote:
>> This series ensures, that when invalid value is detected or mismatch
>> between value defined in the device-tree and the read from the
>> touchscreen is observed, the user is notified and zero is ignored.
>
> This seems very complicated. If board maker specifies these parameters,
> they probably want to use them instead of what the firmware reports. So
> wouldn't it be simpler to not try to match and report differences but
> rather skip querying hardware and use device properties if they are
> specified?
Hi Dmitry.
Agree, I'll send next version just overriding the HW reported values.
David
>
> Thanks.
>
--
David Heidelberg
^ permalink raw reply [flat|nested] 5+ messages in thread