On Wed, May 16, 2018 at 08:29:53PM +0100, Nick Dyer wrote: > On Fri, Apr 20, 2018 at 07:10:16PM +0200, Lucas Stach wrote: > > The documentation for the touchscreen-swapped-x-y property states that > > swapping is done after inverting if both are used. RMI4 did it the other > > way around, leading to inconsistent behavior with regard to other > > touchscreens. > > > > Signed-off-by: Lucas Stach <l.stach@xxxxxxxxxxxxxx> > > --- > > This changes DT behavior for systems using both inversion and swapping > > at the same time. The only affected system in mainline is the Zii RDU2 > > board, where we will make sure to land a DT patch fixing this. > > I've tested this on a RMI4 F11 Zii RDU2 unit and it works as expected. I > had to change touchscreen-inverted-y to x in the device tree to get the > same axis behaviour back. > > Tested-by: Nick Dyer <nick@xxxxxxxxxxxxx> Applied, thank you. > > > --- > > drivers/input/rmi4/rmi_2d_sensor.c | 34 ++++++++++++++++------------------ > > 1 file changed, 16 insertions(+), 18 deletions(-) > > > > diff --git a/drivers/input/rmi4/rmi_2d_sensor.c b/drivers/input/rmi4/rmi_2d_sensor.c > > index 8bb866c7b985..8eeffa066022 100644 > > --- a/drivers/input/rmi4/rmi_2d_sensor.c > > +++ b/drivers/input/rmi4/rmi_2d_sensor.c > > @@ -32,15 +32,15 @@ void rmi_2d_sensor_abs_process(struct rmi_2d_sensor *sensor, > > if (obj->type == RMI_2D_OBJECT_NONE) > > return; > > > > - if (axis_align->swap_axes) > > - swap(obj->x, obj->y); > > - > > if (axis_align->flip_x) > > obj->x = sensor->max_x - obj->x; > > > > if (axis_align->flip_y) > > obj->y = sensor->max_y - obj->y; > > > > + if (axis_align->swap_axes) > > + swap(obj->x, obj->y); > > + > > /* > > * Here checking if X offset or y offset are specified is > > * redundant. We just add the offsets or clip the values. > > @@ -120,15 +120,15 @@ void rmi_2d_sensor_rel_report(struct rmi_2d_sensor *sensor, int x, int y) > > x = min(RMI_2D_REL_POS_MAX, max(RMI_2D_REL_POS_MIN, (int)x)); > > y = min(RMI_2D_REL_POS_MAX, max(RMI_2D_REL_POS_MIN, (int)y)); > > > > - if (axis_align->swap_axes) > > - swap(x, y); > > - > > if (axis_align->flip_x) > > x = min(RMI_2D_REL_POS_MAX, -x); > > > > if (axis_align->flip_y) > > y = min(RMI_2D_REL_POS_MAX, -y); > > > > + if (axis_align->swap_axes) > > + swap(x, y); > > + > > if (x || y) { > > input_report_rel(sensor->input, REL_X, x); > > input_report_rel(sensor->input, REL_Y, y); > > @@ -141,17 +141,10 @@ static void rmi_2d_sensor_set_input_params(struct rmi_2d_sensor *sensor) > > struct input_dev *input = sensor->input; > > int res_x; > > int res_y; > > + int max_x, max_y; > > int input_flags = 0; > > > > if (sensor->report_abs) { > > - if (sensor->axis_align.swap_axes) { > > - swap(sensor->max_x, sensor->max_y); > > - swap(sensor->axis_align.clip_x_low, > > - sensor->axis_align.clip_y_low); > > - swap(sensor->axis_align.clip_x_high, > > - sensor->axis_align.clip_y_high); > > - } > > - > > sensor->min_x = sensor->axis_align.clip_x_low; > > if (sensor->axis_align.clip_x_high) > > sensor->max_x = min(sensor->max_x, > > @@ -163,14 +156,19 @@ static void rmi_2d_sensor_set_input_params(struct rmi_2d_sensor *sensor) > > sensor->axis_align.clip_y_high); > > > > set_bit(EV_ABS, input->evbit); > > - input_set_abs_params(input, ABS_MT_POSITION_X, 0, sensor->max_x, > > - 0, 0); > > - input_set_abs_params(input, ABS_MT_POSITION_Y, 0, sensor->max_y, > > - 0, 0); > > + > > + max_x = sensor->max_x; > > + max_y = sensor->max_y; > > + if (sensor->axis_align.swap_axes) > > + swap(max_x, max_y); > > + input_set_abs_params(input, ABS_MT_POSITION_X, 0, max_x, 0, 0); > > + input_set_abs_params(input, ABS_MT_POSITION_Y, 0, max_y, 0, 0); > > > > if (sensor->x_mm && sensor->y_mm) { > > res_x = (sensor->max_x - sensor->min_x) / sensor->x_mm; > > res_y = (sensor->max_y - sensor->min_y) / sensor->y_mm; > > + if (sensor->axis_align.swap_axes) > > + swap(res_x, res_y); > > > > input_abs_set_res(input, ABS_X, res_x); > > input_abs_set_res(input, ABS_Y, res_y); -- Dmitry -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html