{ }}; static const struct soc_device_data soc_device_PNP0C40 = { .button_info = soc_button_PNP0C40,}; static const struct soc_button_info soc_button_INT33D3[] = { { "tablet_mode", 0, EV_SW, SW_TABLET_MODE, false, false, false }, { }}; static const struct soc_device_data soc_device_INT33D3 = { .button_info = soc_button_INT33D3,}; /* * Button info for Microsoft Surface 3 (non pro), this is identical to * the PNP0C40 info except that the home button is active-high. * * The Surface 3 Pro also has a MSHW0028 ACPI device, but that uses a custom * version of the drivers/platform/x86/intel/hid.c 5 button array ACPI API * instead. A check() callback is not necessary though as the Surface 3 Pro * MSHW0028 ACPI device's resource table does not contain any GPIOs. */static const struct soc_button_info soc_button_MSHW0028[] = { { "power", 0, EV_KEY, KEY_POWER, false, true, true }, { "home", 1, EV_KEY, KEY_LEFTMETA, false, true, false }, { "volume_up", 2, EV_KEY, KEY_VOLUMEUP, true, false, true }, { "volume_down", 3, EV_KEY, KEY_VOLUMEDOWN, true, false, true }, { }}; static const struct soc_device_data soc_device_MSHW0028 = { .button_info = soc_button_MSHW0028,}; /* * Special device check for Surface Book 2 and Surface Pro (2017). * Both, the Surface Pro 4 (surfacepro3_button.c) and the above mentioned * devices use MSHW0040 for power and volume buttons, however the way they * have to be addressed differs. Make sure that we only load this drivers * for the correct devices by checking the OEM Platform Revision provided by * the _DSM method. */#define MSHW0040_DSM_REVISION 0x01#define MSHW0040_DSM_GET_OMPR 0x02 // get OEM Platform Revisionstatic const guid_t MSHW0040_DSM_UUID = GUID_INIT(0x6fd05c69, 0xcde3, 0x49f4, 0x95, 0xed, 0xab, 0x16, 0x65, 0x49, 0x80, 0x35); static int soc_device_check_MSHW0040(struct device *dev){ acpi_handle handle = ACPI_HANDLE(dev); union acpi_object *result; u64 oem_platform_rev = 0; // valid revisions are nonzero // get OEM platform revision result = acpi_evaluate_dsm_typed(handle, &MSHW0040_DSM_UUID, MSHW0040_DSM_REVISION, MSHW0040_DSM_GET_OMPR, NULL, ACPI_TYPE_INTEGER); if (result) { oem_platform_rev = result->integer.value; ACPI_FREE(result); } /* * If the revision is zero here, the _DSM evaluation has failed. This * indicates that we have a Pro 4 or Book 1 and this driver should not * be used. */ if (oem_platform_rev == 0) return -ENODEV; dev_dbg(dev, "OEM Platform Revision %llu\n", oem_platform_rev); return 0;} /* * Button infos for Microsoft Surface Book 2 and Surface Pro (2017). * Obtained from DSDT/testing. */static const struct soc_button_info soc_button_MSHW0040[] = { { "power", 0, EV_KEY, KEY_POWER, false, true, true }, { "volume_up", 2, EV_KEY, KEY_VOLUMEUP, true, false, true }, { "volume_down", 4, EV_KEY, KEY_VOLUMEDOWN, true, false, true }, { }}; static const struct soc_device_data soc_device_MSHW0040 = { .button_info = soc_button_MSHW0040, .check = soc_device_check_MSHW0040,}; static const struct acpi_device_id soc_button_acpi_match[] = { { "PNP0C40", (unsigned long)&soc_device_PNP0C40 }, { "INT33D3", (unsigned long)&soc_device_INT33D3 }, { "ID9001", (unsigned long)&soc_device_INT33D3 }, { "ACPI0011", 0 }, /* Microsoft Surface Devices (3th, 5th and 6th generation) */ { "MSHW0028", (unsigned long)&soc_device_MSHW0028 }, { "MSHW0040", (unsigned long)&soc_device_MSHW0040 }, { }}; MODULE_DEVICE_TABLE(acpi, soc_button_acpi_match); static struct platform_driver soc_button_driver = { .probe = soc_button_probe, .remove = soc_button_remove, .driver = { .name = KBUILD_MODNAME, .acpi_match_table = ACPI_PTR(soc_button_acpi_match), },};module_platform_driver(soc_button_driver); MODULE_DESCRIPTION("Windows-compatible SoC Button Array driver");MODULE_LICENSE("GPL");Lines 501–624 of 624. Previous lines
{ } }; static const struct soc_device_data soc_device_PNP0C40 = { .button_info = soc_button_PNP0C40, }; static const struct soc_button_info soc_button_INT33D3[] = { { "tablet_mode", 0, EV_SW, SW_TABLET_MODE, false, false, false }, { } }; static const struct soc_device_data soc_device_INT33D3 = { .button_info = soc_button_INT33D3, }; /* * Button info for Microsoft Surface 3 (non pro), this is identical to * the PNP0C40 info except that the home button is active-high. * * The Surface 3 Pro also has a MSHW0028 ACPI device, but that uses a custom * version of the drivers/platform/x86/intel/hid.c 5 button array ACPI API * instead. A check() callback is not necessary though as the Surface 3 Pro * MSHW0028 ACPI device's resource table does not contain any GPIOs. */ static const struct soc_button_info soc_button_MSHW0028[] = { { "power", 0, EV_KEY, KEY_POWER, false, true, true }, { "home", 1, EV_KEY, KEY_LEFTMETA, false, true, false }, { "volume_up", 2, EV_KEY, KEY_VOLUMEUP, true, false, true }, { "volume_down", 3, EV_KEY, KEY_VOLUMEDOWN, true, false, true }, { } }; static const struct soc_device_data soc_device_MSHW0028 = { .button_info = soc_button_MSHW0028, }; /* * Special device check for Surface Book 2 and Surface Pro (2017). * Both, the Surface Pro 4 (surfacepro3_button.c) and the above mentioned * devices use MSHW0040 for power and volume buttons, however the way they * have to be addressed differs. Make sure that we only load this drivers * for the correct devices by checking the OEM Platform Revision provided by * the _DSM method. */ #define MSHW0040_DSM_REVISION 0x01 #define MSHW0040_DSM_GET_OMPR 0x02 // get OEM Platform Revision static const guid_t MSHW0040_DSM_UUID = GUID_INIT(0x6fd05c69, 0xcde3, 0x49f4, 0x95, 0xed, 0xab, 0x16, 0x65, 0x49, 0x80, 0x35); static int soc_device_check_MSHW0040(struct device *dev) { acpi_handle handle = ACPI_HANDLE(dev); union acpi_object *result; u64 oem_platform_rev = 0; // valid revisions are nonzero // get OEM platform revision result = acpi_evaluate_dsm_typed(handle, &MSHW0040_DSM_UUID, MSHW0040_DSM_REVISION, MSHW0040_DSM_GET_OMPR, NULL, ACPI_TYPE_INTEGER); if (result) { oem_platform_rev = result->integer.value; ACPI_FREE(result); } /* * If the revision is zero here, the _DSM evaluation has failed. This * indicates that we have a Pro 4 or Book 1 and this driver should not * be used. */ if (oem_platform_rev == 0) return -ENODEV; dev_dbg(dev, "OEM Platform Revision %llu\n", oem_platform_rev); return 0; } /* * Button infos for Microsoft Surface Book 2 and Surface Pro (2017). * Obtained from DSDT/testing. */ static const struct soc_button_info soc_button_MSHW0040[] = { { "power", 0, EV_KEY, KEY_POWER, false, true, true }, { "volume_up", 2, EV_KEY, KEY_VOLUMEUP, true, false, true }, { "volume_down", 4, EV_KEY, KEY_VOLUMEDOWN, true, false, true }, { } }; static const struct soc_device_data soc_device_MSHW0040 = { .button_info = soc_button_MSHW0040, .check = soc_device_check_MSHW0040, }; static const struct acpi_device_id soc_button_acpi_match[] = { { "PNP0C40", (unsigned long)&soc_device_PNP0C40 }, { "INT33D3", (unsigned long)&soc_device_INT33D3 }, { "ID9001", (unsigned long)&soc_device_INT33D3 }, { "ACPI0011", 0 }, /* Microsoft Surface Devices (3th, 5th and 6th generation) */ { "MSHW0028", (unsigned long)&soc_device_MSHW0028 }, { "MSHW0040", (unsigned long)&soc_device_MSHW0040 }, { } }; MODULE_DEVICE_TABLE(acpi, soc_button_acpi_match); static struct platform_driver soc_button_driver = { .probe = soc_button_probe, .remove = soc_button_remove, .driver = { .name = KBUILD_MODNAME, .acpi_match_table = ACPI_PTR(soc_button_acpi_match), }, }; module_platform_driver(soc_button_driver); MODULE_DESCRIPTION("Windows-compatible SoC Button Array driver"); MODULE_LICENSE("GPL");