mb/google/zork: Use dev_nested_path for dmic gpio update
Create function update_dmic_gpio to update DMIC GPIO for ACP machine and use find_dev_nested_path function for consistency. BUG=None BRANCH=None TEST=None Change-Id: I96cf207f24c6117d98ff2bf7e6e5cd282489e805 Signed-off-by: Josie Nordrum <josienordrum@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/44158 Reviewed-by: Furquan Shaikh <furquan@google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
parent
cc72e15c26
commit
55fefbe39d
|
@ -65,34 +65,44 @@ static void update_hp_int_odl(void)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void variant_audio_update(void)
|
static void update_dmic_gpio(void)
|
||||||
{
|
{
|
||||||
const struct device *gpp_a_dev;
|
static const struct device_path acp_machine_path[] = {
|
||||||
const struct device *acp_dev;
|
{
|
||||||
struct device *machine_dev = NULL;
|
.type = DEVICE_PATH_PCI,
|
||||||
|
.pci.devfn = PCIE_GPP_A_DEVFN
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.type = DEVICE_PATH_PCI,
|
||||||
|
.pci.devfn = AUDIO_DEVFN
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.type = DEVICE_PATH_GENERIC,
|
||||||
|
.generic.id = 0,
|
||||||
|
.generic.subid = 0
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const struct device *machine_dev;
|
||||||
|
struct drivers_amd_i2s_machine_dev_config *cfg;
|
||||||
|
struct acpi_gpio *gpio;
|
||||||
|
|
||||||
if (variant_uses_v3_schematics())
|
if (variant_uses_v3_schematics())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
gpp_a_dev = pcidev_path_on_root(PCIE_GPP_A_DEVFN);
|
machine_dev = find_dev_nested_path(
|
||||||
if (gpp_a_dev == NULL)
|
pci_root_bus(), acp_machine_path, ARRAY_SIZE(acp_machine_path));
|
||||||
|
if (!machine_dev) {
|
||||||
|
printk(BIOS_ERR, "%s: Failed to find ACP machine device\n", __func__);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
acp_dev = pcidev_path_behind(gpp_a_dev->link_list, AUDIO_DEVFN);
|
if (machine_dev->chip_ops != &drivers_amd_i2s_machine_dev_ops) {
|
||||||
if (acp_dev == NULL)
|
printk(BIOS_ERR, "%s: Incorrect device found\n", __func__);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
while ((machine_dev = dev_bus_each_child(acp_dev->link_list, machine_dev)) != NULL) {
|
cfg = config_of(machine_dev);
|
||||||
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;
|
gpio = &cfg->dmic_select_gpio;
|
||||||
|
|
||||||
if (CONFIG(BOARD_GOOGLE_BASEBOARD_TREMBYLE))
|
if (CONFIG(BOARD_GOOGLE_BASEBOARD_TREMBYLE))
|
||||||
|
@ -100,9 +110,11 @@ void variant_audio_update(void)
|
||||||
else
|
else
|
||||||
gpio->pins[0] = GPIO_6;
|
gpio->pins[0] = GPIO_6;
|
||||||
|
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
void variant_audio_update(void)
|
||||||
|
{
|
||||||
|
update_dmic_gpio();
|
||||||
update_hp_int_odl();
|
update_hp_int_odl();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue