acpi: Change device properties to work as a tree
There is a second ACPI _DSD document from the UEFI Forum that details how _DSD style tables can be nested, creating a tree of similarly formatted tables. This document is linked from acpi_device.h. In order to support this the device property interface needs to be more flexible and build up a tree of properties to write all entries at once instead of writing each entry as it is generated. In the end this is a more flexible solution that can support drivers that need child tables like the DA7219 codec, while only requiring minor changes to the existing drivers that use the device property interface. This was tested on reef (apollolake) and chell (skylake) boards to ensure that there was no change in the generated SSDT AML. Change-Id: Ia22e3a5fd3982ffa7c324bee1a8d190d49f853dd Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-on: https://review.coreboot.org/15537 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
committed by
Martin Roth
parent
9217f9def0
commit
ffc9990ece
@ -28,7 +28,9 @@
|
||||
|
||||
#define NAU8825_ACPI_NAME "NAU8"
|
||||
#define NAU8825_ACPI_HID "10508825"
|
||||
#define NAU8825_DP_INT(key,val) acpi_dp_write_integer("nuvoton," key, (val))
|
||||
|
||||
#define NAU8825_DP_INT(key,val) \
|
||||
acpi_dp_add_integer(dp, "nuvoton," key, (val))
|
||||
|
||||
static void nau8825_fill_ssdt(struct device *dev)
|
||||
{
|
||||
@ -40,6 +42,7 @@ static void nau8825_fill_ssdt(struct device *dev)
|
||||
.speed = config->bus_speed ? : I2C_SPEED_FAST,
|
||||
.resource = scope,
|
||||
};
|
||||
struct acpi_dp *dp = NULL;
|
||||
|
||||
if (!dev->enabled || !scope)
|
||||
return;
|
||||
@ -62,7 +65,7 @@ static void nau8825_fill_ssdt(struct device *dev)
|
||||
acpigen_write_resourcetemplate_footer();
|
||||
|
||||
/* Device Properties */
|
||||
acpi_dp_write_header();
|
||||
dp = acpi_dp_new_table("_DSD");
|
||||
NAU8825_DP_INT("jkdet-enable", config->jkdet_enable);
|
||||
NAU8825_DP_INT("jkdet-pull-enable", config->jkdet_pull_enable);
|
||||
NAU8825_DP_INT("jkdet-pull-up", config->jkdet_pull_up);
|
||||
@ -77,10 +80,9 @@ static void nau8825_fill_ssdt(struct device *dev)
|
||||
NAU8825_DP_INT("jack-insert-debounce", config->jack_insert_debounce);
|
||||
NAU8825_DP_INT("jack-eject-deboune", config->jack_eject_debounce);
|
||||
NAU8825_DP_INT("sar-threshold-num", config->sar_threshold_num);
|
||||
acpi_dp_write_integer_array("nuvoton,sar-threshold",
|
||||
config->sar_threshold,
|
||||
config->sar_threshold_num);
|
||||
acpi_dp_write_footer();
|
||||
acpi_dp_add_integer_array(dp, "nuvoton,sar-threshold",
|
||||
config->sar_threshold, config->sar_threshold_num);
|
||||
acpi_dp_write(dp);
|
||||
|
||||
acpigen_pop_len(); /* Device */
|
||||
acpigen_pop_len(); /* Scope */
|
||||
|
Reference in New Issue
Block a user