[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAPVz0n0b7wAZXQc9inET6+pQUnp-GRVF+ojwSDENmu5yxHgW9w@mail.gmail.com>
Date: Thu, 4 Sep 2025 15:48:36 +0300
From: Svyatoslav Ryhel <clamor95@...il.com>
To: Dmitry Torokhov <dmitry.torokhov@...il.com>
Cc: Rob Herring <robh@...nel.org>, Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>, Thierry Reding <thierry.reding@...il.com>,
Jonathan Hunter <jonathanh@...dia.com>, Jonas Schwöbel <jonasschwoebel@...oo.de>,
devicetree@...r.kernel.org, linux-tegra@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-input@...r.kernel.org
Subject: Re: [PATCH v1 1/2] input: rmi4: fix RMI_2D clipping
чт, 4 вер. 2025 р. о 14:58 Dmitry Torokhov <dmitry.torokhov@...il.com> пише:
>
> Hi Svyatoslav,
>
> On Wed, Sep 03, 2025 at 07:19:45PM +0300, Svyatoslav Ryhel wrote:
> > From: Jonas Schwöbel <jonasschwoebel@...oo.de>
> >
> > The physical max_y value was overridden with a clip_y_max value. This
> > caused problems when inverting/flipping the screen. Further it messed up
> > calculation of resolution.
> >
> > Signed-off-by: Jonas Schwöbel <jonasschwoebel@...oo.de>
> > Signed-off-by: Svyatoslav Ryhel <clamor95@...il.com>
> > ---
> > drivers/input/rmi4/rmi_2d_sensor.c | 5 ++---
> > 1 file changed, 2 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/input/rmi4/rmi_2d_sensor.c b/drivers/input/rmi4/rmi_2d_sensor.c
> > index b7fe6eb35a4e..b4762b3c8b24 100644
> > --- a/drivers/input/rmi4/rmi_2d_sensor.c
> > +++ b/drivers/input/rmi4/rmi_2d_sensor.c
> > @@ -56,7 +56,7 @@ void rmi_2d_sensor_abs_process(struct rmi_2d_sensor *sensor,
> > obj->x = min(sensor->max_x, obj->x);
> >
> > if (axis_align->clip_y_high)
> > - obj->y = min(sensor->max_y, obj->y);
> > + obj->y = min(axis_align->clip_y_high, obj->y);
> >
> > sensor->tracking_pos[slot].x = obj->x;
> > sensor->tracking_pos[slot].y = obj->y;
> > @@ -149,13 +149,12 @@ static void rmi_2d_sensor_set_input_params(struct rmi_2d_sensor *sensor)
> >
> > sensor->min_y = sensor->axis_align.clip_y_low;
> > if (sensor->axis_align.clip_y_high)
> > - sensor->max_y = min(sensor->max_y,
> > + max_y = min(sensor->max_y,
>
> I see that you want to have sensor->max_y to carry maximum coordinate
> the sensor is capable of reporting, so that flipping works properly. If
> this is the case you should also be deleting sensor->min_y and always
> use 0 in its place, otherwise there is inconsistency.
>
> You also need to deal with X coordinate in the similar fashion.
>
> > sensor->axis_align.clip_y_high);
> >
> > set_bit(EV_ABS, input->evbit);
> >
> > max_x = sensor->max_x;
> > - max_y = sensor->max_y;
>
> This makes max_y potentially uninitialized.
>
> > 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);
>
> I am unconvinced that using raw sensor coordinates to calculate
> resolution is a good idea. It has potential to regress existing users.
>
> Thanks.
>
I will take a deeper look, thank you for review.
> --
> Dmitry
Powered by blists - more mailing lists