Input: rmi4 - use platform data instead of query, when available

Platform data may define touchscreen-x-mm and touchscreen-y-mm, but
these were quietly overridden by data provided by sensor.

Signed-off-by: David Heidelberg <david@ixit.cz>
Link: https://patch.msgid.link/20260731-respect-x-y-mm-v1-0-3e85a4bec745@ixit.cz
Link: https://patch.msgid.link/20260806-respect-x-y-mm-v2-1-e0681ed3d63c@ixit.cz
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
This commit is contained in:
David Heidelberg 2026-08-06 19:17:46 +02:00 committed by Dmitry Torokhov
parent c91d080c4e
commit 9a29ee801f

View File

@ -155,6 +155,10 @@ static int rmi_f12_read_sensor_tuning(struct f12_data *f12)
offset += 4;
}
/* When platform data are provided, we're done */
if (sensor->x_mm && sensor->y_mm)
return 0;
/*
* Use the Query DPM feature when the resolution query register
* exists.
@ -171,8 +175,10 @@ static int rmi_f12_read_sensor_tuning(struct f12_data *f12)
}
dpm_resolution = buf[0];
sensor->x_mm = sensor->max_x / dpm_resolution;
sensor->y_mm = sensor->max_y / dpm_resolution;
if (!sensor->x_mm)
sensor->x_mm = sensor->max_x / dpm_resolution;
if (!sensor->y_mm)
sensor->y_mm = sensor->max_y / dpm_resolution;
} else {
if (rmi_register_desc_has_subpacket(item, 3)) {
rx_receivers = buf[offset];
@ -184,8 +190,10 @@ static int rmi_f12_read_sensor_tuning(struct f12_data *f12)
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;
if (!sensor->x_mm)
sensor->x_mm = (pitch_x * rx_receivers) >> 12;
if (!sensor->y_mm)
sensor->y_mm = (pitch_y * tx_receivers) >> 12;
}
rmi_dbg(RMI_DEBUG_FN, &fn->dev, "%s: x_mm: %d y_mm: %d\n", __func__,