diff mbox

Input: synaptics-rmi4: correctly swap clip values if axes are swapped

Message ID 20170113174324.3393-1-l.stach@pengutronix.de (mailing list archive)
State Accepted
Headers show

Commit Message

Lucas Stach Jan. 13, 2017, 5:43 p.m. UTC
The clip values need the same swapping as the maximium values if the
sensor axes are swapped.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
 drivers/input/rmi4/rmi_2d_sensor.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Dmitry Torokhov Jan. 15, 2017, 11:23 p.m. UTC | #1
On Fri, Jan 13, 2017 at 06:43:24PM +0100, Lucas Stach wrote:
> The clip values need the same swapping as the maximium values if the
> sensor axes are swapped.
> 
> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>

Applied, thank you.

> ---
>  drivers/input/rmi4/rmi_2d_sensor.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/input/rmi4/rmi_2d_sensor.c b/drivers/input/rmi4/rmi_2d_sensor.c
> index 07007ff8e29f..8bb866c7b985 100644
> --- a/drivers/input/rmi4/rmi_2d_sensor.c
> +++ b/drivers/input/rmi4/rmi_2d_sensor.c
> @@ -144,8 +144,13 @@ static void rmi_2d_sensor_set_input_params(struct rmi_2d_sensor *sensor)
>  	int input_flags = 0;
>  
>  	if (sensor->report_abs) {
> -		if (sensor->axis_align.swap_axes)
> +		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)
> -- 
> 2.11.0
>
diff mbox

Patch

diff --git a/drivers/input/rmi4/rmi_2d_sensor.c b/drivers/input/rmi4/rmi_2d_sensor.c
index 07007ff8e29f..8bb866c7b985 100644
--- a/drivers/input/rmi4/rmi_2d_sensor.c
+++ b/drivers/input/rmi4/rmi_2d_sensor.c
@@ -144,8 +144,13 @@  static void rmi_2d_sensor_set_input_params(struct rmi_2d_sensor *sensor)
 	int input_flags = 0;
 
 	if (sensor->report_abs) {
-		if (sensor->axis_align.swap_axes)
+		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)