acpi: Call acpi_gen_writeSTA by status from device tree

The device tree now supports 'hidden' and the status can be found in
`struct device.hidden`. A new acpi_device_status() will return the
expected setting of STA from a `struct device`.

BUG=b:72200466
BRANCH=eve
TEST=Builds and boots properly on device eve

Change-Id: I6dc62aff63cc3cb950739398a4dcac21836c9766
Signed-off-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-on: https://review.coreboot.org/28567
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Hung-Te Lin 2018-09-10 10:55:49 +08:00 committed by Patrick Georgi
parent 936dbe1d06
commit b4be50c9ca
14 changed files with 22 additions and 11 deletions

View File

@ -166,6 +166,15 @@ const char *acpi_device_path_join(struct device *dev, const char *name)
return buf;
}
int acpi_device_status(const struct device *dev)
{
if (!dev->enabled)
return ACPI_STATUS_DEVICE_ALL_OFF;
if (dev->hidden)
return ACPI_STATUS_DEVICE_HIDDEN_ON;
return ACPI_STATUS_DEVICE_ALL_ON;
}
/* ACPI 6.1 section 6.4.3.6: Extended Interrupt Descriptor */
void acpi_device_write_interrupt(const struct acpi_irq *irq)
{

View File

@ -66,6 +66,7 @@ const char *acpi_device_name(struct device *dev);
const char *acpi_device_path(struct device *dev);
const char *acpi_device_scope(struct device *dev);
const char *acpi_device_path_join(struct device *dev, const char *name);
int acpi_device_status(const struct device *dev);
/*
* ACPI Descriptor for extended Interrupt()

View File

@ -43,7 +43,7 @@ static void adau7002_fill_ssdt(struct device *dev)
acpigen_write_name_string("_HID", ADAU7002_ACPI_HID);
acpigen_write_name_integer("_UID", 0);
acpigen_write_name_string("_DDN", dev->chip_ops->name);
acpigen_write_STA(ACPI_STATUS_DEVICE_ALL_ON);
acpigen_write_STA(acpi_device_status(dev));
acpigen_pop_len(); /* Device */
acpigen_pop_len(); /* Scope */

View File

@ -43,7 +43,7 @@ static void max98357a_fill_ssdt(struct device *dev)
acpigen_write_name_string("_HID", MAX98357A_ACPI_HID);
acpigen_write_name_integer("_UID", 0);
acpigen_write_name_string("_DDN", dev->chip_ops->name);
acpigen_write_STA(ACPI_STATUS_DEVICE_ALL_ON);
acpigen_write_STA(acpi_device_status(dev));
/* Resources */
acpigen_write_name("_CRS");

View File

@ -51,7 +51,7 @@ static void da7219_fill_ssdt(struct device *dev)
acpigen_write_name_integer("_UID", 1);
acpigen_write_name_string("_DDN", dev->chip_ops->name);
acpigen_write_name_integer("_S0W", 4);
acpigen_write_STA(ACPI_STATUS_DEVICE_ALL_ON);
acpigen_write_STA(acpi_device_status(dev));
/* Resources */
acpigen_write_name("_CRS");

View File

@ -87,7 +87,7 @@ void i2c_generic_fill_ssdt(struct device *dev,
acpigen_write_name_string("_CID", config->cid);
acpigen_write_name_integer("_UID", config->uid);
acpigen_write_name_string("_DDN", config->desc);
acpigen_write_STA(ACPI_STATUS_DEVICE_ALL_ON);
acpigen_write_STA(acpi_device_status(dev));
/* Resources */
acpigen_write_name("_CRS");

View File

@ -51,7 +51,7 @@ static void max98373_fill_ssdt(struct device *dev)
acpigen_write_name_integer("_UID", config->uid);
if (config->desc)
acpigen_write_name_string("_DDN", config->desc);
acpigen_write_STA(ACPI_STATUS_DEVICE_ALL_ON);
acpigen_write_STA(acpi_device_status(dev));
/* Resources */
acpigen_write_name("_CRS");

View File

@ -49,7 +49,7 @@ static void max98927_fill_ssdt(struct device *dev)
acpigen_write_name_integer("_UID", config->uid);
if (config->desc)
acpigen_write_name_string("_DDN", config->desc);
acpigen_write_STA(ACPI_STATUS_DEVICE_ALL_ON);
acpigen_write_STA(acpi_device_status(dev));
/* Resources */
acpigen_write_name("_CRS");

View File

@ -55,7 +55,7 @@ static void nau8825_fill_ssdt(struct device *dev)
acpigen_write_name_string("_HID", NAU8825_ACPI_HID);
acpigen_write_name_integer("_UID", 0);
acpigen_write_name_string("_DDN", dev->chip_ops->name);
acpigen_write_STA(ACPI_STATUS_DEVICE_ALL_ON);
acpigen_write_STA(acpi_device_status(dev));
/* Resources */
acpigen_write_name("_CRS");

View File

@ -51,7 +51,7 @@ static void rt5663_fill_ssdt(struct device *dev)
acpigen_write_name_string("_HID", RT5663_ACPI_HID);
acpigen_write_name_integer("_UID", config->uid);
acpigen_write_name_string("_DDN", dev->chip_ops->name);
acpigen_write_STA(ACPI_STATUS_DEVICE_ALL_ON);
acpigen_write_STA(acpi_device_status(dev));
/* Resources */
acpigen_write_name("_CRS");

View File

@ -53,7 +53,7 @@ static void i2c_sx9310_fill_ssdt(struct device *dev)
acpigen_write_name_string("_HID", I2C_SX9310_ACPI_ID);
acpigen_write_name_integer("_UID", config->uid);
acpigen_write_name_string("_DDN", config->desc);
acpigen_write_STA(ACPI_STATUS_DEVICE_ALL_ON);
acpigen_write_STA(acpi_device_status(dev));
/* Resources */
acpigen_write_name("_CRS");

View File

@ -49,7 +49,7 @@ static void i2c_tpm_fill_ssdt(struct device *dev)
acpigen_write_name_string("_HID", config->hid);
acpigen_write_name_integer("_UID", config->uid);
acpigen_write_name_string("_DDN", dev->chip_ops->name);
acpigen_write_STA(ACPI_STATUS_DEVICE_ALL_ON);
acpigen_write_STA(acpi_device_status(dev));
/* Resources */
acpigen_write_name("_CRS");

View File

@ -43,7 +43,7 @@ static void camera_fill_ssdt(struct device *dev)
acpigen_write_name_string("_HID", config->acpi_hid);
acpigen_write_name_integer("_UID", config->acpi_uid);
acpigen_write_name_string("_DDN", config->chip_name);
acpigen_write_STA(ACPI_STATUS_DEVICE_ALL_ON);
acpigen_write_STA(acpi_device_status(dev));
/* Resources */
acpigen_write_name("_CRS");

View File

@ -114,6 +114,7 @@ static void spi_acpi_fill_ssdt_generator(struct device *dev)
acpigen_write_name_integer("_UID", config->uid);
if (config->desc)
acpigen_write_name_string("_DDN", config->desc);
acpigen_write_STA(acpi_device_status(dev));
/* Resources */
acpigen_write_name("_CRS");