1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <acpi/acpigen.h>
4 #if CONFIG(GENERIC_GPIO_LIB)
9 void chromeos_acpi_gpio_generate(void)
11 const struct cros_gpio
*gpios
;
15 num
= variant_cros_gpio
.count
;
16 gpios
= variant_cros_gpio
.gpios
;
20 acpigen_write_scope("\\");
21 acpigen_write_name("OIPG");
23 acpigen_write_package(num
);
24 for (i
= 0; i
< num
; i
++) {
25 acpigen_write_package(4);
26 acpigen_write_integer(gpios
[i
].type
);
27 acpigen_write_integer(gpios
[i
].polarity
);
28 gpio_num
= gpios
[i
].gpio_num
;
29 #if CONFIG(GENERIC_GPIO_LIB)
30 /* Get ACPI pin from GPIO library if available */
31 if (gpios
[i
].gpio_num
!= CROS_GPIO_VIRTUAL
)
32 gpio_num
= gpio_acpi_pin(gpio_num
);
34 acpigen_write_integer(gpio_num
);
35 acpigen_write_string(gpios
[i
].device
);