| 1 |
|
| 2 |
|
| 3 |
#include <acpi/acpigen.h> |
| 4 |
#include <acpi/acpigen_dsm.h> |
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
#define ACPI_DSM_I2C_HID_UUID "3CDFF6F7-4267-4555-AD05-B30A3D8938DE" |
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
static void i2c_hid_func0_cb(void *arg) |
| 18 |
{ |
| 19 |
|
| 20 |
acpigen_write_to_integer(ARG1_OP, LOCAL2_OP); |
| 21 |
|
| 22 |
acpigen_write_if_lequal_op_int(LOCAL2_OP, 0x1); |
| 23 |
|
| 24 |
acpigen_write_return_singleton_buffer(0x3); |
| 25 |
|
| 26 |
acpigen_write_else(); |
| 27 |
|
| 28 |
acpigen_write_return_singleton_buffer(0x0); |
| 29 |
acpigen_pop_len(); |
| 30 |
} |
| 31 |
|
| 32 |
static void i2c_hid_func1_cb(void *arg) |
| 33 |
{ |
| 34 |
struct dsm_i2c_hid_config *config = arg; |
| 35 |
acpigen_write_return_byte(config->hid_desc_reg_offset); |
| 36 |
} |
| 37 |
|
| 38 |
static void (*i2c_hid_callbacks[2])(void *) = { |
| 39 |
i2c_hid_func0_cb, |
| 40 |
i2c_hid_func1_cb, |
| 41 |
}; |
| 42 |
|
| 43 |
void acpigen_write_dsm_i2c_hid(struct dsm_i2c_hid_config *config) |
| 44 |
{ |
| 45 |
acpigen_write_dsm(ACPI_DSM_I2C_HID_UUID, i2c_hid_callbacks, |
| 46 |
ARRAY_SIZE(i2c_hid_callbacks), config); |
| 47 |
} |
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
#define USB_DSM_UUID "CE2EE385-00E6-48CB-9F05-2EDB927C4899" |
| 52 |
|
| 53 |
static void usb_dsm_func5_cb(void *arg) |
| 54 |
{ |
| 55 |
struct dsm_usb_config *config = arg; |
| 56 |
acpigen_write_return_byte(config->usb_lpm_incapable); |
| 57 |
} |
| 58 |
|
| 59 |
static void (*usb_dsm_callbacks[6])(void *) = { |
| 60 |
NULL, |
| 61 |
NULL, |
| 62 |
NULL, |
| 63 |
NULL, |
| 64 |
NULL, |
| 65 |
usb_dsm_func5_cb, |
| 66 |
}; |
| 67 |
|
| 68 |
void acpigen_write_dsm_usb(struct dsm_usb_config *config) |
| 69 |
{ |
| 70 |
acpigen_write_dsm(USB_DSM_UUID, usb_dsm_callbacks, |
| 71 |
ARRAY_SIZE(usb_dsm_callbacks), config); |
| 72 |
} |