diff mbox series

Input: goodix: fix touch coordinates on Cube I15-TC

Message ID 8971de4a-74fc-d931-ca18-70e9e8836b35@ya.ru (mailing list archive)
State New, archived
Headers show
Series Input: goodix: fix touch coordinates on Cube I15-TC | expand

Commit Message

Sergei A. Trusov Aug. 30, 2018, 12:46 p.m. UTC
The touchscreen on the Cube I15-TC don't match the default display,
with 0,0 touches being reported when touching at the upper left of
the screen.

Add a quirk to invert the x coordinate.

Reported-and-tested-by: Arkadiy <arkan49@yandex.ru>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sergei A. Trusov <sergei.a.trusov@ya.ru>
---
 drivers/input/touchscreen/goodix.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

Comments

Bastien Nocera Aug. 30, 2018, 1:03 p.m. UTC | #1
On Thu, 2018-08-30 at 22:46 +1000, Sergei A. Trusov wrote:
> The touchscreen on the Cube I15-TC don't match the default display,
> with 0,0 touches being reported when touching at the upper left of
> the screen.

But 0,0 is what's supposed to be at the top-left. Did you mean bottom-
left?

Also a couple of nits.

> 
> Add a quirk to invert the x coordinate.
> 
> Reported-and-tested-by: Arkadiy <arkan49@yandex.ru>
> Cc: Hans de Goede <hdegoede@redhat.com>
> Signed-off-by: Sergei A. Trusov <sergei.a.trusov@ya.ru>
> ---
>  drivers/input/touchscreen/goodix.c | 24 ++++++++++++++++++++++++
>  1 file changed, 24 insertions(+)
> 
> diff --git a/drivers/input/touchscreen/goodix.c
> b/drivers/input/touchscreen/goodix.c
> index f2d9c2c41885..00b6eb09cee3 100644
> --- a/drivers/input/touchscreen/goodix.c
> +++ b/drivers/input/touchscreen/goodix.c
> @@ -145,6 +145,24 @@ static const struct dmi_system_id
> rotated_screen[] = {
>  	{}
>  };
>  
> +

Extra linefeed here.

> +/*
> + * Those tablets have their x coordinate inverted
> + */
> +static const struct dmi_system_id inverted_x_screen[] = {
> +#if defined(CONFIG_DMI) && defined(CONFIG_X86)
> +	{
> +		.ident = "Cube I15-TC",
> +		.matches = {
> +			DMI_MATCH(DMI_SYS_VENDOR, "Cube"),
> +			DMI_MATCH(DMI_PRODUCT_NAME, "I15-TC")
> +		},
> +	},
> +#endif
> +	{}
> +};
> +
> +

And here.

>  /**
>   * goodix_i2c_read - read data from a register of the i2c slave
> device.
>   *
> @@ -709,6 +727,12 @@ static int goodix_configure_dev(struct
> goodix_ts_data *ts)
>  			"Applying '180 degrees rotated screen'
> quirk\n");
>  	}
>  
> +	if (dmi_check_system(inverted_x_screen)) {
> +		ts->prop.invert_x = true;
> +		dev_dbg(&ts->client->dev,
> +			"Applying 'inverted x screen' quirk\n");
> +	}
> +
>  	error = input_mt_init_slots(ts->input_dev, ts->max_touch_num,
>  				    INPUT_MT_DIRECT |
> INPUT_MT_DROP_UNUSED);
>  	if (error) {
Sergei A. Trusov Aug. 30, 2018, 3:56 p.m. UTC | #2
30.08.2018 23:03, Bastien Nocera wrote:
> On Thu, 2018-08-30 at 22:46 +1000, Sergei A. Trusov wrote:
>> The touchscreen on the Cube I15-TC don't match the default display,
>> with 0,0 touches being reported when touching at the upper left of
>> the screen.
> 
> But 0,0 is what's supposed to be at the top-left. Did you mean bottom-
> left?

Oh, my bad. To be exact, we have started with this solution:

xinput set-prop "pointer:Goodix Capacitive TouchScreen" "Evdev Axis Inversion" 1 0

then found an existing quirk for 180 degrees rotated screen and adapted it
for only x coordinate inverted.

So it should be top-right, correct?
 
> Also a couple of nits.

Thank you. I must be precise.
 
>>
>> Add a quirk to invert the x coordinate.
>>
>> Reported-and-tested-by: Arkadiy <arkan49@yandex.ru>
>> Cc: Hans de Goede <hdegoede@redhat.com>
>> Signed-off-by: Sergei A. Trusov <sergei.a.trusov@ya.ru>
>> ---
>>  drivers/input/touchscreen/goodix.c | 24 ++++++++++++++++++++++++
>>  1 file changed, 24 insertions(+)
>>
>> diff --git a/drivers/input/touchscreen/goodix.c
>> b/drivers/input/touchscreen/goodix.c
>> index f2d9c2c41885..00b6eb09cee3 100644
>> --- a/drivers/input/touchscreen/goodix.c
>> +++ b/drivers/input/touchscreen/goodix.c
>> @@ -145,6 +145,24 @@ static const struct dmi_system_id
>> rotated_screen[] = {
>>  	{}
>>  };
>>  
>> +
> 
> Extra linefeed here.
> 
>> +/*
>> + * Those tablets have their x coordinate inverted
>> + */
>> +static const struct dmi_system_id inverted_x_screen[] = {
>> +#if defined(CONFIG_DMI) && defined(CONFIG_X86)
>> +	{
>> +		.ident = "Cube I15-TC",
>> +		.matches = {
>> +			DMI_MATCH(DMI_SYS_VENDOR, "Cube"),
>> +			DMI_MATCH(DMI_PRODUCT_NAME, "I15-TC")
>> +		},
>> +	},
>> +#endif
>> +	{}
>> +};
>> +
>> +
> 
> And here.
> 
>>  /**
>>   * goodix_i2c_read - read data from a register of the i2c slave
>> device.
>>   *
>> @@ -709,6 +727,12 @@ static int goodix_configure_dev(struct
>> goodix_ts_data *ts)
>>  			"Applying '180 degrees rotated screen'
>> quirk\n");
>>  	}
>>  
>> +	if (dmi_check_system(inverted_x_screen)) {
>> +		ts->prop.invert_x = true;
>> +		dev_dbg(&ts->client->dev,
>> +			"Applying 'inverted x screen' quirk\n");
>> +	}
>> +
>>  	error = input_mt_init_slots(ts->input_dev, ts->max_touch_num,
>>  				    INPUT_MT_DIRECT |
>> INPUT_MT_DROP_UNUSED);
>>  	if (error) {
>
Bastien Nocera Aug. 30, 2018, 4:24 p.m. UTC | #3
> On 30 Aug 2018, at 17:56, Sergei A. Trusov <sergei.a.trusov@ya.ru> wrote:
> 
> 30.08.2018 23:03, Bastien Nocera wrote:
>>> On Thu, 2018-08-30 at 22:46 +1000, Sergei A. Trusov wrote:
>>> The touchscreen on the Cube I15-TC don't match the default display,
>>> with 0,0 touches being reported when touching at the upper left of
>>> the screen.
>> 
>> But 0,0 is what's supposed to be at the top-left. Did you mean bottom-
>> left?
> 
> Oh, my bad. To be exact, we have started with this solution:
> 
> xinput set-prop "pointer:Goodix Capacitive TouchScreen" "Evdev Axis Inversion" 1 0
> 
> then found an existing quirk for 180 degrees rotated screen and adapted it
> for only x coordinate inverted.
> 
> So it should be top-right, correct?

Hmm, yes :)

>> Also a couple of nits.
> 
> Thank you. I must be precise.
> 
>>> 
>>> Add a quirk to invert the x coordinate.
>>> 
>>> Reported-and-tested-by: Arkadiy <arkan49@yandex.ru>
>>> Cc: Hans de Goede <hdegoede@redhat.com>
>>> Signed-off-by: Sergei A. Trusov <sergei.a.trusov@ya.ru>
>>> ---
>>> drivers/input/touchscreen/goodix.c | 24 ++++++++++++++++++++++++
>>> 1 file changed, 24 insertions(+)
>>> 
>>> diff --git a/drivers/input/touchscreen/goodix.c
>>> b/drivers/input/touchscreen/goodix.c
>>> index f2d9c2c41885..00b6eb09cee3 100644
>>> --- a/drivers/input/touchscreen/goodix.c
>>> +++ b/drivers/input/touchscreen/goodix.c
>>> @@ -145,6 +145,24 @@ static const struct dmi_system_id
>>> rotated_screen[] = {
>>>    {}
>>> };
>>> 
>>> +
>> 
>> Extra linefeed here.
>> 
>>> +/*
>>> + * Those tablets have their x coordinate inverted
>>> + */
>>> +static const struct dmi_system_id inverted_x_screen[] = {
>>> +#if defined(CONFIG_DMI) && defined(CONFIG_X86)
>>> +    {
>>> +        .ident = "Cube I15-TC",
>>> +        .matches = {
>>> +            DMI_MATCH(DMI_SYS_VENDOR, "Cube"),
>>> +            DMI_MATCH(DMI_PRODUCT_NAME, "I15-TC")
>>> +        },
>>> +    },
>>> +#endif
>>> +    {}
>>> +};
>>> +
>>> +
>> 
>> And here.
>> 
>>> /**
>>>  * goodix_i2c_read - read data from a register of the i2c slave
>>> device.
>>>  *
>>> @@ -709,6 +727,12 @@ static int goodix_configure_dev(struct
>>> goodix_ts_data *ts)
>>>            "Applying '180 degrees rotated screen'
>>> quirk\n");
>>>    }
>>> 
>>> +    if (dmi_check_system(inverted_x_screen)) {
>>> +        ts->prop.invert_x = true;
>>> +        dev_dbg(&ts->client->dev,
>>> +            "Applying 'inverted x screen' quirk\n");
>>> +    }
>>> +
>>>    error = input_mt_init_slots(ts->input_dev, ts->max_touch_num,
>>>                    INPUT_MT_DIRECT |
>>> INPUT_MT_DROP_UNUSED);
>>>    if (error) {
>>
diff mbox series

Patch

diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c
index f2d9c2c41885..00b6eb09cee3 100644
--- a/drivers/input/touchscreen/goodix.c
+++ b/drivers/input/touchscreen/goodix.c
@@ -145,6 +145,24 @@  static const struct dmi_system_id rotated_screen[] = {
 	{}
 };
 
+
+/*
+ * Those tablets have their x coordinate inverted
+ */
+static const struct dmi_system_id inverted_x_screen[] = {
+#if defined(CONFIG_DMI) && defined(CONFIG_X86)
+	{
+		.ident = "Cube I15-TC",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "Cube"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "I15-TC")
+		},
+	},
+#endif
+	{}
+};
+
+
 /**
  * goodix_i2c_read - read data from a register of the i2c slave device.
  *
@@ -709,6 +727,12 @@  static int goodix_configure_dev(struct goodix_ts_data *ts)
 			"Applying '180 degrees rotated screen' quirk\n");
 	}
 
+	if (dmi_check_system(inverted_x_screen)) {
+		ts->prop.invert_x = true;
+		dev_dbg(&ts->client->dev,
+			"Applying 'inverted x screen' quirk\n");
+	}
+
 	error = input_mt_init_slots(ts->input_dev, ts->max_touch_num,
 				    INPUT_MT_DIRECT | INPUT_MT_DROP_UNUSED);
 	if (error) {