drivers/spi: Add option to generate proper PowerResource _STA
The _STA method of drivers/spi PowerResource currently always returns true. To allow generating _STA that returns the device's actual power state, this CL adds a new boolean option `use_gpio_for_status` to the `drivers_spi_acpi_config` struct, and propagates the value to `acpi_power_res_params` to reuse the feature implemented for acpi/device in [1]. [1] https://review.coreboot.org/c/coreboot/+/55027 BUG=b:428793056 TEST=Dump SSDT on kinmen with use_gpio_for_status=true Scope (\_SB.PCI0.SPI0) { Device (CRFP) { ... ... PowerResource (PR00, 0x00, 0x0000) { Method (_STA, 0, Serialized) // _STA: Status { 0x5D = \_SB.PCI0.GTXS /* External reference */ Local0 If (!Local0) { Return (Zero) } 0x27 = \_SB.PCI0.GTXS /* External reference */ Local0 Local0 ^= One If (Local0) { Return (Zero) } Return (One) } Method (_ON, 0, Serialized) // _ON_: Power On { Local0 = _STA () If ((Local0 == One)) { Return (Zero) } \_SB.PCI0.CTXS (0x27) \_SB.PCI0.STXS (0x5D) Sleep (0x03) \_SB.PCI0.STXS (0x27) } Method (_OFF, 0, Serialized) // _OFF: Power Off { \_SB.PCI0.CTXS (0x27) \_SB.PCI0.CTXS (0x5D) } } } } Change-Id: I9591957f2db66081ffe447f91afd6655835d8feb Signed-off-by: Ivy Jian <ivy.jian@quanta.corp-partner.google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/88337 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Subrata Banik <subratabanik@google.com>
This commit is contained in:
parent
03c331399c
commit
4367daae20
2 changed files with 8 additions and 1 deletions
|
|
@ -166,7 +166,8 @@ static void spi_acpi_fill_ssdt_generator(const struct device *dev)
|
|||
config->enable_off_delay_ms,
|
||||
&config->stop_gpio,
|
||||
config->stop_delay_ms,
|
||||
config->stop_off_delay_ms
|
||||
config->stop_off_delay_ms,
|
||||
config->use_gpio_for_status
|
||||
};
|
||||
acpi_device_add_power_res(&power_res_params);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,6 +47,12 @@ struct drivers_spi_acpi_config {
|
|||
/* Generic properties for exporting device-specific data to the OS */
|
||||
struct acpi_dp property_list[MAX_GENERIC_PROPERTY_LIST];
|
||||
unsigned int property_count;
|
||||
|
||||
/* Write a _STA method that uses the state of the GPIOs to determine if
|
||||
* the PowerResource is ON or OFF. If this is false, the _STA method
|
||||
* will always return ON.
|
||||
*/
|
||||
bool use_gpio_for_status;
|
||||
};
|
||||
|
||||
#endif /* __SPI_ACPI_CHIP_H__ */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue