platform/x86: touchscreen_dmi: Allow partial (prefix) matches for ACPI names
Subsystems (2)
PATCH 1/2 platform/x86: touchscreen_dmi: Allow partial (prefix) matches for ACPI names
On some devices the ACPI name of the touchscreen is e.g. either MSSL1680:00 or MSSL1680:01 depending on the BIOS version.
This happens for example on the "Chuwi Hi8 Air" tablet where the initial commit's ts_data uses "MSSL1680:00" but the tablets from the github issue and linux-hardware.org probe linked below both use "MSSL1680:01".
Replace the strcmp() match on ts_data->acpi_name with a strstarts() check to allow using a partial match on just the ACPI HID of "MSSL1680" and change the ts_data->acpi_name for the "Chuwi Hi8 Air" accordingly to fix the touchscreen not working on models where it is "MSSL1680:01".
Note this drops the length check for I2C_NAME_SIZE. This never was necessary since the ACPI names used are never more then 11 chars and I2C_NAME_SIZE is 20 so the replaced strncmp() would always stop long before reaching I2C_NAME_SIZE.
--- drivers/platform/x86/touchscreen_dmi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/platform/x86/touchscreen_dmi.c +2 -2
@@ -81,7 +81,7 @@ static const struct property_entry chuwi_hi8_air_props[] = { };static const struct ts_dmi_data chuwi_hi8_air_data = { - .acpi_name ="MSSL1680:00" , + .acpi_name ="MSSL1680" , .properties = chuwi_hi8_air_props, };
@@ -1821,7 +1821,7 @@ static void ts_dmi_add_props(struct i2c_client *client)int error;if (has_acpi_companion (dev) && - !strncmp (ts_data->acpi_name, client->name,I2C_NAME_SIZE )) { +strstarts (client->name, ts_data->acpi_name)) { error =device_create_managed_software_node (dev, ts_data->properties,NULL );if (error)dev_err (dev,"failed to add properties: %d\n" , error);
Signature · 1 line
2.43.0
PATCH 2/2 platform/x86: touchscreen_dmi: Consolidate Goodix upside-down touchscreen data
Now that prefix matches for ACPI names are supported, the ts_dmi_data structs for "GDIX1001:00" and "GDIX1001:01" can be consolidated into a single match matching on "GDIX1001".
For consistency also change gdix1002_00_upside_down_data to match.
--- drivers/platform/x86/touchscreen_dmi.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-)
drivers/platform/x86/touchscreen_dmi.c +10 -15
@@ -415,18 +415,13 @@ static const struct property_entry gdix1001_upside_down_props[] = { { } }; -static const struct ts_dmi_data gdix1001_00_upside_down_data = { - .acpi_name ="GDIX1001:00" , +static const struct ts_dmi_data gdix1001_upside_down_data = { + .acpi_name ="GDIX1001" , .properties = gdix1001_upside_down_props, }; -static const struct ts_dmi_data gdix1001_01_upside_down_data = { - .acpi_name ="GDIX1001:01" , - .properties = gdix1001_upside_down_props, -}; - -static const struct ts_dmi_data gdix1002_00_upside_down_data = { - .acpi_name ="GDIX1002:00" , +static const struct ts_dmi_data gdix1002_upside_down_data = { + .acpi_name ="GDIX1002" , .properties = gdix1001_upside_down_props, };
@@ -1412,7 +1407,7 @@ const struct dmi_system_id touchscreen_dmi_table[] = { }, {/* Juno Tablet */ - .driver_data = (void *)&gdix1002_00_upside_down_data, + .driver_data = (void *)&gdix1002_upside_down_data, .matches = { DMI_MATCH(DMI_SYS_VENDOR, "Default string"),/* Both product- and board-name being "Default string" is somewhat rare */
@@ -1658,7 +1653,7 @@ const struct dmi_system_id touchscreen_dmi_table[] = { }, {/* Teclast X89 (Android version / BIOS) */ - .driver_data = (void *)&gdix1001_00_upside_down_data, + .driver_data = (void *)&gdix1001_upside_down_data, .matches = {DMI_MATCH (DMI_BOARD_VENDOR ,"WISKY" ), DMI_MATCH(DMI_BOARD_NAME, "3G062i"),
@@ -1666,7 +1661,7 @@ const struct dmi_system_id touchscreen_dmi_table[] = { }, {/* Teclast X89 (Windows version / BIOS) */ - .driver_data = (void *)&gdix1001_01_upside_down_data, + .driver_data = (void *)&gdix1001_upside_down_data, .matches = {/* tPAD is too generic, also match on bios date */ DMI_MATCH(DMI_BOARD_VENDOR, "TECLAST"),
@@ -1684,7 +1679,7 @@ const struct dmi_system_id touchscreen_dmi_table[] = { }, {/* Teclast X98 Pro */ - .driver_data = (void *)&gdix1001_00_upside_down_data, + .driver_data = (void *)&gdix1001_upside_down_data, .matches = {/* * Only match BIOS date, because the manufacturers
@@ -1788,7 +1783,7 @@ const struct dmi_system_id touchscreen_dmi_table[] = { }, {/* "WinBook TW100" */ - .driver_data = (void *)&gdix1001_00_upside_down_data, + .driver_data = (void *)&gdix1001_upside_down_data, .matches = {DMI_MATCH (DMI_SYS_VENDOR ,"WinBook" ),DMI_MATCH (DMI_PRODUCT_NAME ,"TW100" )
@@ -1796,7 +1791,7 @@ const struct dmi_system_id touchscreen_dmi_table[] = { }, {/* WinBook TW700 */ - .driver_data = (void *)&gdix1001_00_upside_down_data, + .driver_data = (void *)&gdix1001_upside_down_data, .matches = {DMI_MATCH (DMI_SYS_VENDOR ,"WinBook" ),DMI_MATCH (DMI_PRODUCT_NAME ,"TW700" )
Signature · 1 line
2.43.0
Re: [PATCH 2/2] platform/x86: touchscreen_dmi: Consolidate Goodix upside-down touchscreen data
Quoted 8 lines · Hans de Goede
Now that prefix matches for ACPI names are supported, the
ts_dmi_datastructs for "GDIX1001:00" and "GDIX1001:01" can be consolidated into a single match matching on "GDIX1001".For consistency also change
gdix1002_00_upside_down_datato match.Signed-off-by Hans de Goede <[email protected]>---
Looks good to me.
Quoted 84 lines
drivers/platform/x86/touchscreen_dmi.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-)drivers/platform/x86/touchscreen_dmi.c +10
-15@@ -415,18 +415,13 @@ static const struct property_entry gdix1001_upside_down_props[] = { { } }; -static const struct ts_dmi_data gdix1001_00_upside_down_data = { - .acpi_name ="GDIX1001:00" , +static const struct ts_dmi_data gdix1001_upside_down_data = { + .acpi_name ="GDIX1001" , .properties = gdix1001_upside_down_props, }; -static const struct ts_dmi_data gdix1001_01_upside_down_data = { - .acpi_name ="GDIX1001:01" , - .properties = gdix1001_upside_down_props, -}; - -static const struct ts_dmi_data gdix1002_00_upside_down_data = { - .acpi_name ="GDIX1002:00" , +static const struct ts_dmi_data gdix1002_upside_down_data = { + .acpi_name ="GDIX1002" , .properties = gdix1001_upside_down_props, };@@ -1412,7 +1407,7 @@ const struct dmi_system_id touchscreen_dmi_table[] = { }, {/* Juno Tablet */ - .driver_data = (void *)&gdix1002_00_upside_down_data, + .driver_data = (void *)&gdix1002_upside_down_data, .matches = { DMI_MATCH(DMI_SYS_VENDOR, "Default string"),/* Both product- and board-name being "Default string" is somewhat rare */ @@ -1658,7 +1653,7 @@ const struct dmi_system_id touchscreen_dmi_table[] = { }, {/* Teclast X89 (Android version / BIOS) */ - .driver_data = (void *)&gdix1001_00_upside_down_data, + .driver_data = (void *)&gdix1001_upside_down_data, .matches = {DMI_MATCH (DMI_BOARD_VENDOR ,"WISKY" ), DMI_MATCH(DMI_BOARD_NAME, "3G062i"),@@ -1666,7 +1661,7 @@ const struct dmi_system_id touchscreen_dmi_table[] = { }, {/* Teclast X89 (Windows version / BIOS) */ - .driver_data = (void *)&gdix1001_01_upside_down_data, + .driver_data = (void *)&gdix1001_upside_down_data, .matches = {/* tPAD is too generic, also match on bios date */ DMI_MATCH(DMI_BOARD_VENDOR, "TECLAST"),@@ -1684,7 +1679,7 @@ const struct dmi_system_id touchscreen_dmi_table[] = { }, {/* Teclast X98 Pro */ - .driver_data = (void *)&gdix1001_00_upside_down_data, + .driver_data = (void *)&gdix1001_upside_down_data, .matches = {/* * Only match BIOS date, because the manufacturers @@ -1788,7 +1783,7 @@ const struct dmi_system_id touchscreen_dmi_table[] = { }, {/* "WinBook TW100" */ - .driver_data = (void *)&gdix1001_00_upside_down_data, + .driver_data = (void *)&gdix1001_upside_down_data, .matches = {DMI_MATCH (DMI_SYS_VENDOR ,"WinBook" ),DMI_MATCH (DMI_PRODUCT_NAME ,"TW100" )@@ -1796,7 +1791,7 @@ const struct dmi_system_id touchscreen_dmi_table[] = { }, {/* WinBook TW700 */ - .driver_data = (void *)&gdix1001_00_upside_down_data, + .driver_data = (void *)&gdix1001_upside_down_data, .matches = {DMI_MATCH (DMI_SYS_VENDOR ,"WinBook" ),DMI_MATCH (DMI_PRODUCT_NAME ,"TW700" )
Signature · 2 lines
Sathyanarayanan Kuppuswamy Linux Kernel Developer
Hi,
Quoted 12 lines · Hans de Goede
On some devices the ACPI name of the touchscreen is e.g. either MSSL1680:00 or MSSL1680:01 depending on the BIOS version.
This happens for example on the "Chuwi Hi8 Air" tablet where the initial commit's
ts_datauses "MSSL1680:00" but the tablets from the github issue and linux-hardware.org probe linked below both use "MSSL1680:01".Replace the
strcmp()match onts_data->acpi_namewith astrstarts()check to allow using a partial match on just the ACPI HID of "MSSL1680" and change thets_data->acpi_namefor the "Chuwi Hi8 Air" accordingly to fix the touchscreen not working on models where it is "MSSL1680:01".
Quoted 8 lines
Note this drops the length check for
I2C_NAME_SIZE. This never was necessary since the ACPI names used are never more then 11 chars andI2C_NAME_SIZEis 20 so the replacedstrncmp()would always stop long before reachingI2C_NAME_SIZE.
Note I plan to merge this into fixes sometime this week or next week.
I'll also merge the follow-up patch into fixes since it is trivial and that avoids the need to backmerge fixes into for-next.
Regards,
Hans
Quoted 26 lines
--- drivers/platform/x86/touchscreen_dmi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/platform/x86/touchscreen_dmi.c +2
-2@@ -81,7 +81,7 @@ static const struct property_entry chuwi_hi8_air_props[] = { };static const struct ts_dmi_data chuwi_hi8_air_data = { - .acpi_name ="MSSL1680:00" , + .acpi_name ="MSSL1680" , .properties = chuwi_hi8_air_props, };@@ -1821,7 +1821,7 @@ static void ts_dmi_add_props(struct i2c_client *client)int error;if (has_acpi_companion (dev) && - !strncmp (ts_data->acpi_name, client->name,I2C_NAME_SIZE )) { +strstarts (client->name, ts_data->acpi_name)) { error =device_create_managed_software_node (dev, ts_data->properties,NULL );if (error)dev_err (dev,"failed to add properties: %d\n" , error);
Quoted 4 lines · Hans de Goede
On some devices the ACPI name of the touchscreen is e.g. either MSSL1680:00 or MSSL1680:01 depending on the BIOS version.
Quoted 8 lines
This happens for example on the "Chuwi Hi8 Air" tablet where the initial commit's
ts_datauses "MSSL1680:00" but the tablets from the github issue and linux-hardware.org probe linked below both use "MSSL1680:01".Replace the
strcmp()match onts_data->acpi_namewith astrstarts()check to allow using a partial match on just the ACPI HID of "MSSL1680" and change thets_data->acpi_namefor the "Chuwi Hi8 Air" accordingly to fix the touchscreen not working on models where it is "MSSL1680:01".
This is a good example to show why we shouldn't rely on device instances and be stuck with HID. Ideally I would prefer to see the acpi_dev_get_first_match_dev() / for_each_acpi_dev_match().
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 17 lines · Hans de Goede
On some devices the ACPI name of the touchscreen is e.g. either MSSL1680:00 or MSSL1680:01 depending on the BIOS version.
This happens for example on the "Chuwi Hi8 Air" tablet where the initial commit's
ts_datauses "MSSL1680:00" but the tablets from the github issue and linux-hardware.org probe linked below both use "MSSL1680:01".Replace the
strcmp()match onts_data->acpi_namewith astrstarts()check to allow using a partial match on just the ACPI HID of "MSSL1680" and change thets_data->acpi_namefor the "Chuwi Hi8 Air" accordingly to fix the touchscreen not working on models where it is "MSSL1680:01".Note this drops the length check for
I2C_NAME_SIZE. This never was necessary since the ACPI names used are never more then 11 chars andI2C_NAME_SIZEis 20 so the replacedstrncmp()would always stop long before reachingI2C_NAME_SIZE.
Quoted 4 lines
Signed-off-by Hans de Goede <[email protected]>---
Since this is a bug fix, don't you want to add stable tag?
Otherwise, it looks good.
Quoted 25 lines
drivers/platform/x86/touchscreen_dmi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/platform/x86/touchscreen_dmi.c +2
-2@@ -81,7 +81,7 @@ static const struct property_entry chuwi_hi8_air_props[] = { };static const struct ts_dmi_data chuwi_hi8_air_data = { - .acpi_name ="MSSL1680:00" , + .acpi_name ="MSSL1680" , .properties = chuwi_hi8_air_props, };@@ -1821,7 +1821,7 @@ static void ts_dmi_add_props(struct i2c_client *client)int error;if (has_acpi_companion (dev) && - !strncmp (ts_data->acpi_name, client->name,I2C_NAME_SIZE )) { +strstarts (client->name, ts_data->acpi_name)) { error =device_create_managed_software_node (dev, ts_data->properties,NULL );if (error)dev_err (dev,"failed to add properties: %d\n" , error);
Signature · 2 lines
Sathyanarayanan Kuppuswamy Linux Kernel Developer
Hi,
Quoted 19 lines · Kuppuswamy Sathyanarayanan
Quoted 17 lines · Hans de Goede
On some devices the ACPI name of the touchscreen is e.g. either MSSL1680:00 or MSSL1680:01 depending on the BIOS version.
This happens for example on the "Chuwi Hi8 Air" tablet where the initial commit's
ts_datauses "MSSL1680:00" but the tablets from the github issue and linux-hardware.org probe linked below both use "MSSL1680:01".Replace the
strcmp()match onts_data->acpi_namewith astrstarts()check to allow using a partial match on just the ACPI HID of "MSSL1680" and change thets_data->acpi_namefor the "Chuwi Hi8 Air" accordingly to fix the touchscreen not working on models where it is "MSSL1680:01".Note this drops the length check for
I2C_NAME_SIZE. This never was necessary since the ACPI names used are never more then 11 chars andI2C_NAME_SIZEis 20 so the replacedstrncmp()would always stop long before reachingI2C_NAME_SIZE.
Quoted 6 lines
Quoted 4 lines
Signed-off-by Hans de Goede <[email protected]>---
Since this is a bug fix, don't you want to add stable tag?
Good point, done.
I've added these to my review-hans (soon to be fixes) branch now.
Regards,
Hans
Quoted 31 lines
Otherwise, it looks good.
Reviewed-by Kuppuswamy Sathyanarayanan <[email protected]>Quoted 25 lines
drivers/platform/x86/touchscreen_dmi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/platform/x86/touchscreen_dmi.c +2
-2@@ -81,7 +81,7 @@ static const struct property_entry chuwi_hi8_air_props[] = { };static const struct ts_dmi_data chuwi_hi8_air_data = { - .acpi_name ="MSSL1680:00" , + .acpi_name ="MSSL1680" , .properties = chuwi_hi8_air_props, };@@ -1821,7 +1821,7 @@ static void ts_dmi_add_props(struct i2c_client *client)int error;if (has_acpi_companion (dev) && - !strncmp (ts_data->acpi_name, client->name,I2C_NAME_SIZE )) { +strstarts (client->name, ts_data->acpi_name)) { error =device_create_managed_software_node (dev, ts_data->properties,NULL );if (error)dev_err (dev,"failed to add properties: %d\n" , error);