1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 3 #ifndef _I2C_HID_ACPI_H 4 #define _I2C_HID_ACPI_H 5 6 #include <linux/acpi.h> 7 #include <linux/uuid.h> 8 9 static inline int i2c_hid_acpi_get_descriptor(struct acpi_device *adev) 10 { 11 /* HID I²C Device: 3cdff6f7-4267-4555-ad05-b30a3d8938de */ 12 static const guid_t i2c_hid_guid = 13 GUID_INIT(0x3CDFF6F7, 0x4267, 0x4555, 14 0xAD, 0x05, 0xB3, 0x0A, 0x3D, 0x89, 0x38, 0xDE); 15 16 acpi_handle handle = acpi_device_handle(adev); 17 union acpi_object *obj; 18 u16 addr; 19 20 obj = acpi_evaluate_dsm_typed(handle, &i2c_hid_guid, 21 1, 1, NULL, ACPI_TYPE_INTEGER); 22 if (!obj) { 23 acpi_handle_err(handle, 24 "Error _DSM call to get HID descriptor address failed\n"); 25 return -ENODEV; 26 } 27 28 addr = obj->integer.value; 29 ACPI_FREE(obj); 30 return addr; 31 } 32 33 #endif 34