Skip to content

Commit

Permalink
platform/x86: touchscreen_dmi: Add EFI embedded firmware info support
Browse files Browse the repository at this point in the history
Sofar we have been unable to get permission from the vendors to put the
firmware for touchscreens listed in touchscreen_dmi in linux-firmware.

Some of the tablets with such a touchscreen have a touchscreen driver, and
thus a copy of the firmware, as part of their EFI code.

This commit adds the necessary info for the new EFI embedded-firmware code
to extract these firmwares, making the touchscreen work OOTB without the
user needing to manually add the firmware.

Acked-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
Changes in v6:
-Switch from crc sums to SHA256 hashes for the firmware hashes
  • Loading branch information
jwrdegoede committed Sep 20, 2018
1 parent 2710379 commit 36e3c17
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 1 deletion.
3 changes: 3 additions & 0 deletions drivers/firmware/efi/embedded-firmware.c
Expand Up @@ -24,6 +24,9 @@ struct embedded_fw {
static LIST_HEAD(found_fw_list);

static const struct dmi_system_id * const embedded_fw_table[] = {
#ifdef CONFIG_TOUCHSCREEN_DMI
touchscreen_dmi_table,
#endif
NULL
};

Expand Down
1 change: 1 addition & 0 deletions drivers/platform/x86/Kconfig
Expand Up @@ -1201,6 +1201,7 @@ config INTEL_TURBO_MAX_3
config TOUCHSCREEN_DMI
bool "DMI based touchscreen configuration info"
depends on ACPI && DMI && I2C=y && TOUCHSCREEN_SILEAD
select EFI_EMBEDDED_FIRMWARE if EFI
---help---
Certain ACPI based tablets with e.g. Silead or Chipone touchscreens
do not have enough data in ACPI tables for the touchscreen driver to
Expand Down
35 changes: 34 additions & 1 deletion drivers/platform/x86/touchscreen_dmi.c
Expand Up @@ -15,12 +15,15 @@
#include <linux/acpi.h>
#include <linux/device.h>
#include <linux/dmi.h>
#include <linux/efi_embedded_fw.h>
#include <linux/i2c.h>
#include <linux/notifier.h>
#include <linux/property.h>
#include <linux/string.h>

struct ts_dmi_data {
/* The EFI embedded-fw code expects this to be the first member! */
struct efi_embedded_fw_desc embedded_fw;
const char *acpi_name;
const struct property_entry *properties;
};
Expand All @@ -47,10 +50,20 @@ static const struct property_entry chuwi_hi8_pro_props[] = {
PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
PROPERTY_ENTRY_STRING("firmware-name", "gsl3680-chuwi-hi8-pro.fw"),
PROPERTY_ENTRY_BOOL("silead,home-button"),
PROPERTY_ENTRY_BOOL("efi-embedded-firmware"),
{ }
};

static const struct ts_dmi_data chuwi_hi8_pro_data = {
.embedded_fw = {
.name = "silead/gsl3680-chuwi-hi8-pro.fw",
.prefix = { 0xf0, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00 },
.length = 39864,
.sha256 = { 0xc0, 0x88, 0xc5, 0xef, 0xd1, 0x70, 0x77, 0x59,
0x4e, 0xe9, 0xc4, 0xd8, 0x2e, 0xcd, 0xbf, 0x95,
0x32, 0xd9, 0x03, 0x28, 0x0d, 0x48, 0x9f, 0x92,
0x35, 0x37, 0xf6, 0x8b, 0x2a, 0xe4, 0x73, 0xff },
},
.acpi_name = "MSSL1680:00",
.properties = chuwi_hi8_pro_props,
};
Expand Down Expand Up @@ -109,10 +122,20 @@ static const struct property_entry cube_iwork8_air_props[] = {
PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
PROPERTY_ENTRY_STRING("firmware-name", "gsl3670-cube-iwork8-air.fw"),
PROPERTY_ENTRY_U32("silead,max-fingers", 10),
PROPERTY_ENTRY_BOOL("efi-embedded-firmware"),
{ }
};

static const struct ts_dmi_data cube_iwork8_air_data = {
.embedded_fw = {
.name = "silead/gsl3670-cube-iwork8-air.fw",
.prefix = { 0xf0, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00 },
.length = 38808,
.sha256 = { 0xff, 0x62, 0x2d, 0xd1, 0x8a, 0x78, 0x04, 0x7b,
0x33, 0x06, 0xb0, 0x4f, 0x7f, 0x02, 0x08, 0x9c,
0x96, 0xd4, 0x9f, 0x04, 0xe1, 0x47, 0x25, 0x25,
0x60, 0x77, 0x41, 0x33, 0xeb, 0x12, 0x82, 0xfc },
},
.acpi_name = "MSSL1680:00",
.properties = cube_iwork8_air_props,
};
Expand Down Expand Up @@ -295,10 +318,20 @@ static const struct property_entry pipo_w2s_props[] = {
PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
PROPERTY_ENTRY_STRING("firmware-name",
"gsl1680-pipo-w2s.fw"),
PROPERTY_ENTRY_BOOL("efi-embedded-firmware"),
{ }
};

static const struct ts_dmi_data pipo_w2s_data = {
.embedded_fw = {
.name = "silead/gsl1680-pipo-w2s.fw",
.prefix = { 0xf0, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00 },
.length = 39072,
.sha256 = { 0xd0, 0x58, 0xc4, 0x7d, 0x55, 0x2d, 0x62, 0x18,
0xd1, 0x6a, 0x71, 0x73, 0x0b, 0x3f, 0xbe, 0x60,
0xbb, 0x45, 0x8c, 0x52, 0x27, 0xb7, 0x18, 0xf4,
0x31, 0x00, 0x6a, 0x49, 0x76, 0xd8, 0x7c, 0xd3 },
},
.acpi_name = "MSSL1680:00",
.properties = pipo_w2s_props,
};
Expand Down Expand Up @@ -412,7 +445,7 @@ static const struct ts_dmi_data trekstor_surftab_wintron70_data = {
};

/* NOTE: Please keep this table sorted alphabetically */
static const struct dmi_system_id touchscreen_dmi_table[] = {
const struct dmi_system_id touchscreen_dmi_table[] = {
{
/* Chuwi Hi8 */
.driver_data = (void *)&chuwi_hi8_data,
Expand Down
2 changes: 2 additions & 0 deletions include/linux/efi_embedded_fw.h
Expand Up @@ -20,6 +20,8 @@ struct efi_embedded_fw_desc {
u8 sha256[32];
};

extern const struct dmi_system_id touchscreen_dmi_table[];

int efi_get_embedded_fw(const char *name, void **dat, size_t *sz, size_t msize);

#endif

0 comments on commit 36e3c17

Please sign in to comment.