summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarthikeyan Ramasubramanian <kramasub@google.com>2021-04-15 14:43:16 -0600
committerPatrick Georgi <pgeorgi@google.com>2021-04-18 20:41:55 +0000
commit8c5f3ebbdf4d961dd5b72fa02f5a50bc58aedad6 (patch)
tree6680f9c73ca4ed0f83515f2179a8747537d6ddae
parent90b0701f9a4a7c0e61f08d8b328d7751b4cce4b4 (diff)
downloadcoreboot-8c5f3ebbdf4d961dd5b72fa02f5a50bc58aedad6.tar.xz
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>
-rw-r--r--src/drivers/amd/i2s_machine_dev/chip.h5
-rw-r--r--src/drivers/amd/i2s_machine_dev/i2s_machine_dev.c57
2 files changed, 34 insertions, 28 deletions
diff --git a/src/drivers/amd/i2s_machine_dev/chip.h b/src/drivers/amd/i2s_machine_dev/chip.h
index 5d3a423b43..0ca00a8424 100644
--- a/src/drivers/amd/i2s_machine_dev/chip.h
+++ b/src/drivers/amd/i2s_machine_dev/chip.h
@@ -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;
};
diff --git a/src/drivers/amd/i2s_machine_dev/i2s_machine_dev.c b/src/drivers/amd/i2s_machine_dev/i2s_machine_dev.c
index b5be31d038..7bd256d97b 100644
--- a/src/drivers/amd/i2s_machine_dev/i2s_machine_dev.c
+++ b/src/drivers/amd/i2s_machine_dev/i2s_machine_dev.c
@@ -9,10 +9,37 @@
#define AMD_I2S_ACPI_DESC "I2S machine driver"
+static void i2s_machine_dev_fill_crs_dsd(const char *path,
+ const struct acpi_gpio *dmic_select_gpio)
+{
+ struct acpi_dp *dsd;
+
+ /* Resources */
+ acpigen_write_name("_CRS");
+ acpigen_write_resourcetemplate_header();
+ acpi_device_write_gpio(dmic_select_gpio);
+ acpigen_write_resourcetemplate_footer();
+
+ dsd = acpi_dp_new_table("_DSD");
+ /*
+ * This GPIO is used to select DMIC0 or DMIC1 by the kernel driver. It does not
+ * really have a polarity since low and high control the selection of DMIC and
+ * hence does not have an active polarity.
+ * Kernel driver does not use the polarity field and instead treats the GPIO
+ * selection as follows:
+ * Set low (0) = Select DMIC0
+ * Set high (1) = Select DMIC1
+ */
+ acpi_dp_add_gpio(dsd, "dmic-gpios", path,
+ 0, /* Index = 0 (There is a single GPIO entry in _CRS). */
+ 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);
- 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);
@@ -31,11 +58,6 @@ static void i2s_machine_dev_fill_ssdt(const struct device *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);
@@ -44,27 +66,8 @@ static void i2s_machine_dev_fill_ssdt(const struct device *dev)
acpigen_write_STA(acpi_device_status(dev));
- /* Resources */
- acpigen_write_name("_CRS");
- acpigen_write_resourcetemplate_header();
- acpi_device_write_gpio(dmic_select_gpio);
- acpigen_write_resourcetemplate_footer();
-
- dsd = acpi_dp_new_table("_DSD");
- /*
- * This GPIO is used to select DMIC0 or DMIC1 by the kernel driver. It does not
- * really have a polarity since low and high control the selection of DMIC and
- * hence does not have an active polarity.
- * Kernel driver does not use the polarity field and instead treats the GPIO
- * selection as follows:
- * Set low (0) = Select DMIC0
- * Set high (1) = Select DMIC1
- */
- acpi_dp_add_gpio(dsd, "dmic-gpios", path,
- 0, /* Index = 0 (There is a single GPIO entry in _CRS). */
- 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);
+ if (dmic_select_gpio->pin_count)
+ i2s_machine_dev_fill_crs_dsd(path, dmic_select_gpio);
acpigen_pop_len(); /* Device */
acpigen_pop_len(); /* Scope */