drivers/amd/i2s_machine_dev: Make DMIC select gpio optional

The selector component in Sound Open Firmware (SOF) can consume all the
mics and use the configuration in the Use Case Manager (UCM) to select
the right channel. Hence dmic select gpio configuration is optional.

BUG=b:182960979
TEST=Build and boot to OS in Guybrush. Ensure that the machine driver
ACPI object is populated without DMIC select GPIO.

Change-Id: Iba00b07c3656c487e33bab184fefee7037745e2d
Signed-off-by: Karthikeyan Ramasubramanian <kramasub@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/52393
Reviewed-by: Furquan Shaikh <furquan@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Karthikeyan Ramasubramanian 2021-04-15 14:43:16 -06:00 committed by Patrick Georgi
parent 90b0701f9a
commit 8c5f3ebbdf
2 changed files with 39 additions and 33 deletions

View file

@ -12,7 +12,10 @@ struct drivers_amd_i2s_machine_dev_config {
/* ACPI _UID */
unsigned int uid;
/* DMIC select GPIO (required) */
/*
* DMIC select GPIO (optional). Needs to be configured if the audio framework cannot use
* all the mics and select the right channel based on the use-case.
*/
struct acpi_gpio dmic_select_gpio;
};

View file

@ -9,40 +9,10 @@
#define AMD_I2S_ACPI_DESC "I2S machine driver"
static void i2s_machine_dev_fill_ssdt(const struct device *dev)
static void i2s_machine_dev_fill_crs_dsd(const char *path,
const struct acpi_gpio *dmic_select_gpio)
{
const char *scope = acpi_device_scope(dev);
struct acpi_dp *dsd;
const struct acpi_gpio *dmic_select_gpio;
const struct drivers_amd_i2s_machine_dev_config *cfg;
const char *path = acpi_device_path(dev);
cfg = config_of(dev);
dmic_select_gpio = &cfg->dmic_select_gpio;
if (scope == NULL) {
printk(BIOS_ERR, "%s: ERROR: ACPI I2S scope not found\n", dev_path(dev));
return;
}
if (cfg->hid == NULL) {
printk(BIOS_ERR, "%s: ERROR: HID required\n", dev_path(dev));
return;
}
if (dmic_select_gpio->pin_count == 0) {
printk(BIOS_ERR, "%s: ERROR: DMIC select GPIO required\n", dev_path(dev));
return;
}
acpigen_write_scope(scope); /* Scope */
acpigen_write_device(acpi_device_name(dev)); /* Device */
acpigen_write_name_string("_HID", cfg->hid);
acpigen_write_name_integer("_UID", cfg->uid);
acpigen_write_name_string("_DDN", AMD_I2S_ACPI_DESC);
acpigen_write_STA(acpi_device_status(dev));
/* Resources */
acpigen_write_name("_CRS");
@ -65,6 +35,39 @@ static void i2s_machine_dev_fill_ssdt(const struct device *dev)
0, /* Pin = 0 (There is a single pin in the GPIO resource). */
0); /* Active low = 0 (Kernel driver does not use active polarity). */
acpi_dp_write(dsd);
}
static void i2s_machine_dev_fill_ssdt(const struct device *dev)
{
const char *scope = acpi_device_scope(dev);
const struct acpi_gpio *dmic_select_gpio;
const struct drivers_amd_i2s_machine_dev_config *cfg;
const char *path = acpi_device_path(dev);
cfg = config_of(dev);
dmic_select_gpio = &cfg->dmic_select_gpio;
if (scope == NULL) {
printk(BIOS_ERR, "%s: ERROR: ACPI I2S scope not found\n", dev_path(dev));
return;
}
if (cfg->hid == NULL) {
printk(BIOS_ERR, "%s: ERROR: HID required\n", dev_path(dev));
return;
}
acpigen_write_scope(scope); /* Scope */
acpigen_write_device(acpi_device_name(dev)); /* Device */
acpigen_write_name_string("_HID", cfg->hid);
acpigen_write_name_integer("_UID", cfg->uid);
acpigen_write_name_string("_DDN", AMD_I2S_ACPI_DESC);
acpigen_write_STA(acpi_device_status(dev));
if (dmic_select_gpio->pin_count)
i2s_machine_dev_fill_crs_dsd(path, dmic_select_gpio);
acpigen_pop_len(); /* Device */
acpigen_pop_len(); /* Scope */