diff options
author | Furquan Shaikh <furquan@google.com> | 2020-07-16 13:40:28 -0700 |
---|---|---|
committer | Furquan Shaikh <furquan@google.com> | 2020-07-17 23:33:35 +0000 |
commit | 24ec79c39b00ffebf536ce7fb0306fc582440e44 (patch) | |
tree | 10bb55fc6da2e11d2a7bb0c10e4822e3ed5e908a /src/mainboard/google/zork/variants/baseboard/ramstage_common.c | |
parent | de4baffb6b8b9dd9b65779d1a25333986fbaf63f (diff) |
mb/google/zork: Switch to using newly added i2s_machine_dev driver
This change switches zork devices to use the newly added
i2s_machine_dev driver in devicetree rather than passing
dmic_select_gpio in SoC config.
BUG=b:157708581
Change-Id: I76c633694cbfb454c081ab2a4af4765bfbbae16b
Signed-off-by: Furquan Shaikh <furquan@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/43543
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'src/mainboard/google/zork/variants/baseboard/ramstage_common.c')
-rw-r--r-- | src/mainboard/google/zork/variants/baseboard/ramstage_common.c | 41 |
1 files changed, 35 insertions, 6 deletions
diff --git a/src/mainboard/google/zork/variants/baseboard/ramstage_common.c b/src/mainboard/google/zork/variants/baseboard/ramstage_common.c index f7f11b88ea..511d60d0b8 100644 --- a/src/mainboard/google/zork/variants/baseboard/ramstage_common.c +++ b/src/mainboard/google/zork/variants/baseboard/ramstage_common.c @@ -2,19 +2,48 @@ #include <acpi/acpi_device.h> #include <baseboard/variants.h> +#include <drivers/amd/i2s_machine_dev/chip.h> #include <ec/google/chromeec/ec.h> #include <soc/gpio.h> +#include <soc/pci_devs.h> + +extern struct chip_operations drivers_amd_i2s_machine_dev_ops; void variant_audio_update(void) { - struct soc_amd_picasso_config *cfg = config_of_soc(); - struct acpi_gpio *gpio = &cfg->dmic_select_gpio; + const struct device *gpp_a_dev; + const struct device *acp_dev; + struct device *machine_dev = NULL; if (variant_uses_v3_schematics()) return; - if (CONFIG(BOARD_GOOGLE_BASEBOARD_TREMBYLE)) - gpio->pins[0] = GPIO_13; - else - gpio->pins[0] = GPIO_6; + gpp_a_dev = pcidev_path_on_root(PCIE_GPP_A_DEVFN); + if (gpp_a_dev == NULL) + return; + + acp_dev = pcidev_path_behind(gpp_a_dev->link_list, AUDIO_DEVFN); + if (acp_dev == NULL) + return; + + while ((machine_dev = dev_bus_each_child(acp_dev->link_list, machine_dev)) != NULL) { + struct drivers_amd_i2s_machine_dev_config *cfg; + struct acpi_gpio *gpio; + + if (machine_dev->chip_info == NULL) + continue; + + if (machine_dev->chip_ops != &drivers_amd_i2s_machine_dev_ops) + continue; + + cfg = machine_dev->chip_info; + gpio = &cfg->dmic_select_gpio; + + if (CONFIG(BOARD_GOOGLE_BASEBOARD_TREMBYLE)) + gpio->pins[0] = GPIO_13; + else + gpio->pins[0] = GPIO_6; + + break; + } } |