From bf4845dd3acf3ce9e9c63ce8c35ee7111351aa78 Mon Sep 17 00:00:00 2001 From: Furquan Shaikh Date: Mon, 20 Feb 2017 22:56:25 -0800 Subject: arch/x86/acpigen: Provide helper functions for enabling/disabling GPIO In order to allow GPIOs to be set/clear according to their polarity, provide helper functions that check for polarity and call set/clear SoC functions for generating ACPI code. BUG=None BRANCH=None TEST=Verified that the ACPI code generated remains the same as before for reef. Change-Id: Ie8bdb9dc18e61a4a658f1447d6f1db0b166d9c12 Signed-off-by: Furquan Shaikh Reviewed-on: https://review.coreboot.org/18427 Reviewed-by: Aaron Durbin Tested-by: build bot (Jenkins) --- Documentation/acpi/gpio.md | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'Documentation') diff --git a/Documentation/acpi/gpio.md b/Documentation/acpi/gpio.md index 2c09148164..2fb2d1d5a0 100644 --- a/Documentation/acpi/gpio.md +++ b/Documentation/acpi/gpio.md @@ -3,6 +3,7 @@ # Table of contents # - Introduction - Platform Interface +- Helper routines - Implementation details - Arguments and Local Variables Management @@ -55,6 +56,23 @@ adding them as AML code callbacks for the following reasons: 3. Allows GPIO AML methods to be present under any device scope and gives SoC the flexibility to call them without any restrictions. +# Helper routines # + +In order to relieve drivers of the task of implementing the same code +for enabling/disabling Tx GPIOs based on the GPIO polarity, helper +routines are provided which implement this common code and can be used +directly in the driver routines: +1. Enable Tx GPIO + int acpigen_enable_tx_gpio(struct acpi_gpio gpio) +2. Disable Tx GPIO + int acpigen_disable_tx_gpio(struct acpi_gpio gpio) + +Both the above functions take as input struct acpi_gpio type and +return -1 on error and 0 on success. These helper routines end up +calling the platform specific acpigen_soc_{set,clear}_tx_gpio +functions internally. Thus, all the ACPI AML calling conventions for +the platform functions apply to these helper functions as well. + # Implementation Details # ACPI library in coreboot will provide weak definitions for all the @@ -84,7 +102,6 @@ variables. acpigen_soc_clear_tx_gpio Generate ACPI AML code to Error = -1 set Tx to 0. Success = 0 - Ideally, the operation column in the above table should use one or more functions implemented by the platform in AML code library (like gpiolib.asl). In the example below SPC0 and GPC0 need to be -- cgit v1.2.3