public inbox for linux-input@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 0/2] input: rmi4: fix RMI_2D clipping
@ 2025-09-03 16:19 Svyatoslav Ryhel
  2025-09-03 16:19 ` [PATCH v1 1/2] " Svyatoslav Ryhel
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Svyatoslav Ryhel @ 2025-09-03 16:19 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Thierry Reding,
	Jonathan Hunter, Dmitry Torokhov, Svyatoslav Ryhel,
	Jonas Schwöbel
  Cc: devicetree, linux-tegra, linux-kernel, linux-input

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.

Jonas Schwöbel (2):
  input: rmi4: fix RMI_2D clipping
  ARM: tegra: p880: set correct touchscreen clipping

 arch/arm/boot/dts/nvidia/tegra30-lg-p880.dts | 4 ++--
 drivers/input/rmi4/rmi_2d_sensor.c           | 5 ++---
 2 files changed, 4 insertions(+), 5 deletions(-)

-- 
2.48.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v1 1/2] input: rmi4: fix RMI_2D clipping
  2025-09-03 16:19 [PATCH v1 0/2] input: rmi4: fix RMI_2D clipping Svyatoslav Ryhel
@ 2025-09-03 16:19 ` Svyatoslav Ryhel
  2025-09-04 11:58   ` Dmitry Torokhov
  2025-09-03 16:19 ` [PATCH v1 2/2] ARM: tegra: p880: set correct touchscreen clipping Svyatoslav Ryhel
  2025-09-11 16:03 ` (subset) [PATCH v1 0/2] input: rmi4: fix RMI_2D clipping Thierry Reding
  2 siblings, 1 reply; 6+ messages in thread
From: Svyatoslav Ryhel @ 2025-09-03 16:19 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Thierry Reding,
	Jonathan Hunter, Dmitry Torokhov, Svyatoslav Ryhel,
	Jonas Schwöbel
  Cc: devicetree, linux-tegra, linux-kernel, linux-input

From: Jonas Schwöbel <jonasschwoebel@yahoo.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@yahoo.de>
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.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,
 				sensor->axis_align.clip_y_high);
 
 		set_bit(EV_ABS, input->evbit);
 
 		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);
-- 
2.48.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v1 2/2] ARM: tegra: p880: set correct touchscreen clipping
  2025-09-03 16:19 [PATCH v1 0/2] input: rmi4: fix RMI_2D clipping Svyatoslav Ryhel
  2025-09-03 16:19 ` [PATCH v1 1/2] " Svyatoslav Ryhel
@ 2025-09-03 16:19 ` Svyatoslav Ryhel
  2025-09-11 16:03 ` (subset) [PATCH v1 0/2] input: rmi4: fix RMI_2D clipping Thierry Reding
  2 siblings, 0 replies; 6+ messages in thread
From: Svyatoslav Ryhel @ 2025-09-03 16:19 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Thierry Reding,
	Jonathan Hunter, Dmitry Torokhov, Svyatoslav Ryhel,
	Jonas Schwöbel
  Cc: devicetree, linux-tegra, linux-kernel, linux-input

From: Jonas Schwöbel <jonasschwoebel@yahoo.de>

Existing touchscreen clipping is too small and causes problems with
touchscreen accuracy.

Signed-off-by: Jonas Schwöbel <jonasschwoebel@yahoo.de>
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
---
 arch/arm/boot/dts/nvidia/tegra30-lg-p880.dts | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/nvidia/tegra30-lg-p880.dts b/arch/arm/boot/dts/nvidia/tegra30-lg-p880.dts
index 2f7754fd42a1..c6ef0a20c19f 100644
--- a/arch/arm/boot/dts/nvidia/tegra30-lg-p880.dts
+++ b/arch/arm/boot/dts/nvidia/tegra30-lg-p880.dts
@@ -108,8 +108,8 @@ sub-mic-ldo {
 	i2c@7000c400 {
 		touchscreen@20 {
 			rmi4-f11@11 {
-				syna,clip-x-high = <1110>;
-				syna,clip-y-high = <1973>;
+				syna,clip-x-high = <1440>;
+				syna,clip-y-high = <2560>;
 
 				touchscreen-inverted-y;
 			};
-- 
2.48.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v1 1/2] input: rmi4: fix RMI_2D clipping
  2025-09-03 16:19 ` [PATCH v1 1/2] " Svyatoslav Ryhel
@ 2025-09-04 11:58   ` Dmitry Torokhov
  2025-09-04 12:48     ` Svyatoslav Ryhel
  0 siblings, 1 reply; 6+ messages in thread
From: Dmitry Torokhov @ 2025-09-04 11:58 UTC (permalink / raw)
  To: Svyatoslav Ryhel
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Thierry Reding,
	Jonathan Hunter, Jonas Schwöbel, devicetree, linux-tegra,
	linux-kernel, linux-input

Hi Svyatoslav,

On Wed, Sep 03, 2025 at 07:19:45PM +0300, Svyatoslav Ryhel wrote:
> From: Jonas Schwöbel <jonasschwoebel@yahoo.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@yahoo.de>
> Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.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.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v1 1/2] input: rmi4: fix RMI_2D clipping
  2025-09-04 11:58   ` Dmitry Torokhov
@ 2025-09-04 12:48     ` Svyatoslav Ryhel
  0 siblings, 0 replies; 6+ messages in thread
From: Svyatoslav Ryhel @ 2025-09-04 12:48 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Thierry Reding,
	Jonathan Hunter, Jonas Schwöbel, devicetree, linux-tegra,
	linux-kernel, linux-input

чт, 4 вер. 2025 р. о 14:58 Dmitry Torokhov <dmitry.torokhov@gmail.com> пише:
>
> Hi Svyatoslav,
>
> On Wed, Sep 03, 2025 at 07:19:45PM +0300, Svyatoslav Ryhel wrote:
> > From: Jonas Schwöbel <jonasschwoebel@yahoo.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@yahoo.de>
> > Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: (subset) [PATCH v1 0/2] input: rmi4: fix RMI_2D clipping
  2025-09-03 16:19 [PATCH v1 0/2] input: rmi4: fix RMI_2D clipping Svyatoslav Ryhel
  2025-09-03 16:19 ` [PATCH v1 1/2] " Svyatoslav Ryhel
  2025-09-03 16:19 ` [PATCH v1 2/2] ARM: tegra: p880: set correct touchscreen clipping Svyatoslav Ryhel
@ 2025-09-11 16:03 ` Thierry Reding
  2 siblings, 0 replies; 6+ messages in thread
From: Thierry Reding @ 2025-09-11 16:03 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Thierry Reding,
	Jonathan Hunter, Dmitry Torokhov, Jonas Schwöbel,
	Svyatoslav Ryhel
  Cc: devicetree, linux-tegra, linux-kernel, linux-input

From: Thierry Reding <treding@nvidia.com>


On Wed, 03 Sep 2025 19:19:44 +0300, Svyatoslav Ryhel wrote:
> 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.
> 
> Jonas Schwöbel (2):
>   input: rmi4: fix RMI_2D clipping
>   ARM: tegra: p880: set correct touchscreen clipping
> 
> [...]

Applied, thanks!

[2/2] ARM: tegra: p880: set correct touchscreen clipping
      commit: 2fa1118387295b9fa6d70a48011b30184348abd0

Best regards,
-- 
Thierry Reding <treding@nvidia.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-09-11 16:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-03 16:19 [PATCH v1 0/2] input: rmi4: fix RMI_2D clipping Svyatoslav Ryhel
2025-09-03 16:19 ` [PATCH v1 1/2] " Svyatoslav Ryhel
2025-09-04 11:58   ` Dmitry Torokhov
2025-09-04 12:48     ` Svyatoslav Ryhel
2025-09-03 16:19 ` [PATCH v1 2/2] ARM: tegra: p880: set correct touchscreen clipping Svyatoslav Ryhel
2025-09-11 16:03 ` (subset) [PATCH v1 0/2] input: rmi4: fix RMI_2D clipping Thierry Reding

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox