drivers/i2c/generic: Add option to generate proper PowerResource _STA

The _STA method of drivers/i2c/generic 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_i2c_generic_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:397355818
TEST=Dump SSDT on redrix with CB:86749

Change-Id: I5c0a423730788d634a780d1d1d8c87a7007cc150
Signed-off-by: Momoko Hattori <momohatt@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/86759
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
Reviewed-by: Sam McNally <sammc@google.com>
This commit is contained in:
Momoko Hattori 2025-03-07 12:21:33 +09:00 committed by Jon Murphy
commit 68b8565fc4
2 changed files with 8 additions and 1 deletions

View file

@ -110,6 +110,12 @@ struct drivers_i2c_generic_config {
/* Generic properties for exporting device-specific data to the OS */
struct acpi_dp property_list[MAX_GENERIC_PROPERTY_LIST];
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;
};
/*

View file

@ -141,7 +141,8 @@ void i2c_generic_fill_ssdt(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);
}