arch/x86/acpigen: Add support for interacting with GPIOs

Since reading/toggling of GPIOs is platform-dependent task, provide an
interface with common functions to generate ACPI AML code for
manipulating GPIOs:
1. acpigen_soc_read_rx_gpio
2. acpigen_soc_get_tx_gpio
3. acpigen_soc_set_tx_gpio
4. acpigen_soc_clear_tx_gpio

Provide weak implementations of above functions. These functions are
expected to be implemented by every SoC that uses ACPI. This allows
drivers to easily generate ACPI AML code to interact GPIOs.

BUG=chrome-os-partner:55988

Change-Id: I3564f15a1cb50e6ca6132638447529648589aa0e
Signed-off-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-on: https://review.coreboot.org/17080
Tested-by: build bot (Jenkins)
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
Furquan Shaikh
2016-10-20 07:12:49 -07:00
committed by Furquan Shaikh
parent fcc7a04cc8
commit 0a48aee795
2 changed files with 51 additions and 0 deletions

View File

@@ -992,3 +992,32 @@ void acpigen_write_else(void)
acpigen_emit_byte(ELSE_OP);
acpigen_write_len_f();
}
/* Soc-implemented functions -- weak definitions. */
int __attribute__((weak)) acpigen_soc_read_rx_gpio(unsigned int gpio_num)
{
printk(BIOS_ERR, "ERROR: %s not implemented\n", __func__);
acpigen_write_debug_string("read_rx_gpio not available");
return -1;
}
int __attribute__((weak)) acpigen_soc_get_tx_gpio(unsigned int gpio_num)
{
printk(BIOS_ERR, "ERROR: %s not implemented\n", __func__);
acpigen_write_debug_string("get_tx_gpio not available");
return -1;
}
int __attribute__((weak)) acpigen_soc_set_tx_gpio(unsigned int gpio_num)
{
printk(BIOS_ERR, "ERROR: %s not implemented\n", __func__);
acpigen_write_debug_string("set_tx_gpio not available");
return -1;
}
int __attribute__((weak)) acpigen_soc_clear_tx_gpio(unsigned int gpio_num)
{
printk(BIOS_ERR, "ERROR: %s not implemented\n", __func__);
acpigen_write_debug_string("clear_tx_gpio not available");
return -1;
}