summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnil Kumar <anil.kumar.k@intel.com>2021-04-09 11:20:17 -0700
committerFelix Held <felix-coreboot@felixheld.de>2021-07-21 15:43:16 +0000
commit881df06124844957fa68fac289f862a5d87a2e86 (patch)
treeebddd3c0de9ce7999b612596dc3c246931994783 /src
parent19a2b84944b5f02def30edcb09add54230cf8191 (diff)
mb/intel/adlrvp: Enable I2S audio codecs on ADL-M RVP
- Add configurability using FW_CONFIG field in CBI, to enable/disable I2S codec support for MAX98373 codecs - AUDIO=ADL_MAX98373_ALC5682I_I2S: enable max98373 codec using expansion board Bug=None Test=With CBI FW_CONFIG set to 0x100, check I2S audio output on expansion card Signed-off-by: Anil Kumar <anil.kumar.k@intel.com> Change-Id: If2649647e58c5f30e2b539d534adf2a4e68f4fda Reviewed-on: https://review.coreboot.org/c/coreboot/+/52221 Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Reviewed-by: Sathyanarayana Nujella <sathyanarayana.nujella@intel.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src')
-rw-r--r--src/mainboard/intel/adlrvp/Kconfig3
-rw-r--r--src/mainboard/intel/adlrvp/Makefile.inc1
-rw-r--r--src/mainboard/intel/adlrvp/devicetree_m.cb44
-rw-r--r--src/mainboard/intel/adlrvp/fw_config.c41
4 files changed, 88 insertions, 1 deletions
diff --git a/src/mainboard/intel/adlrvp/Kconfig b/src/mainboard/intel/adlrvp/Kconfig
index 8ed37ab53a..8510c3831f 100644
--- a/src/mainboard/intel/adlrvp/Kconfig
+++ b/src/mainboard/intel/adlrvp/Kconfig
@@ -19,6 +19,9 @@ config BOARD_SPECIFIC_OPTIONS
select HAVE_SPD_IN_CBFS
select DRIVERS_SOUNDWIRE_ALC711
select SOC_INTEL_CSE_LITE_SKU
+ select DRIVERS_I2C_MAX98373
+ select FW_CONFIG if BOARD_INTEL_ADLRVP_M_EXT_EC
+ select FW_CONFIG_SOURCE_CHROMEEC_CBI if BOARD_INTEL_ADLRVP_M_EXT_EC
config CHROMEOS
select GBB_FLAG_FORCE_DEV_SWITCH_ON
diff --git a/src/mainboard/intel/adlrvp/Makefile.inc b/src/mainboard/intel/adlrvp/Makefile.inc
index 609bed5e5e..ca9ba1445e 100644
--- a/src/mainboard/intel/adlrvp/Makefile.inc
+++ b/src/mainboard/intel/adlrvp/Makefile.inc
@@ -23,6 +23,7 @@ ramstage-$(CONFIG_CHROMEOS) += chromeos.c
ramstage-y += ec.c
ramstage-y += mainboard.c
ramstage-y += board_id.c
+ramstage-$(CONFIG_FW_CONFIG) += fw_config.c
CPPFLAGS_common += -I$(src)/mainboard/$(MAINBOARDDIR)/include
diff --git a/src/mainboard/intel/adlrvp/devicetree_m.cb b/src/mainboard/intel/adlrvp/devicetree_m.cb
index 34aee729ce..b29533662e 100644
--- a/src/mainboard/intel/adlrvp/devicetree_m.cb
+++ b/src/mainboard/intel/adlrvp/devicetree_m.cb
@@ -1,3 +1,9 @@
+fw_config
+ field AUDIO 8 10
+ option NONE 0
+ option ADL_MAX98373_ALC5682I_I2S 1
+ end
+end
chip soc/intel/alderlake
device cpu_cluster 0 on
@@ -211,7 +217,43 @@ chip soc/intel/alderlake
device generic 0 on end
end
end
- device ref i2c0 on end
+ device ref i2c0 on
+ chip drivers/i2c/generic
+ register "hid" = ""10EC5682""
+ register "name" = ""RT58""
+ register "desc" = ""Headset Codec""
+ register "irq" = "ACPI_IRQ_EDGE_HIGH(GPP_H3_IRQ)"
+ # Set the jd_src to RT5668_JD1 for jack detection
+ register "property_count" = "1"
+ register "property_list[0].type" = "ACPI_DP_TYPE_INTEGER"
+ register "property_list[0].name" = ""realtek,jd-src""
+ register "property_list[0].integer" = "1"
+ device i2c 1a on
+ probe AUDIO ADL_MAX98373_ALC5682I_I2S
+ end
+ end
+ chip drivers/i2c/max98373
+ register "vmon_slot_no" = "0"
+ register "imon_slot_no" = "1"
+ register "uid" = "0"
+ register "desc" = ""Right Speaker Amp""
+ register "name" = ""MAXR""
+ device i2c 31 on
+ probe AUDIO ADL_MAX98373_ALC5682I_I2S
+ end
+ end
+ chip drivers/i2c/max98373
+ register "vmon_slot_no" = "2"
+ register "imon_slot_no" = "3"
+ register "uid" = "1"
+ register "desc" = ""Left Speaker Amp""
+ register "name" = ""MAXL""
+ device i2c 32 on
+ probe AUDIO ADL_MAX98373_ALC5682I_I2S
+ end
+ end
+ end
+
device ref i2c1 on
chip drivers/intel/mipi_camera
register "acpi_hid" = ""OVTI5675""
diff --git a/src/mainboard/intel/adlrvp/fw_config.c b/src/mainboard/intel/adlrvp/fw_config.c
new file mode 100644
index 0000000000..8589bd8bdc
--- /dev/null
+++ b/src/mainboard/intel/adlrvp/fw_config.c
@@ -0,0 +1,41 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <bootstate.h>
+#include <console/console.h>
+#include <fw_config.h>
+#include <gpio.h>
+
+static const struct pad_config i2s_enable_pads[] = {
+ /* Audio Codec INT N */
+ PAD_CFG_GPI_APIC(GPP_H3, NONE, PLTRST, EDGE_BOTH, INVERT),
+
+ /* I2S0_SCLK */
+ PAD_CFG_NF(GPP_R0, NONE, DEEP, NF2),
+ /* I2S0_SFRM */
+ PAD_CFG_NF(GPP_R1, NONE, DEEP, NF2),
+ /* I2S0_TXD */
+ PAD_CFG_NF(GPP_R2, NONE, DEEP, NF2),
+ /* I2S0_RXD */
+ PAD_CFG_NF(GPP_R3, NONE, DEEP, NF2),
+
+ /* I2S2_SCLK */
+ PAD_CFG_NF(GPP_R4, NONE, DEEP, NF2),
+ /* I2S2_SFRM */
+ PAD_CFG_NF(GPP_R5, NONE, DEEP, NF2),
+ /* I2S2_TXD */
+ PAD_CFG_NF(GPP_R6, NONE, DEEP, NF2),
+ /* I2S2_RXD */
+ PAD_CFG_NF(GPP_R7, NONE, DEEP, NF2),
+
+ /* I2S_MCLK1_OUT */
+ PAD_CFG_NF(GPP_D19, NONE, DEEP, NF1),
+};
+
+static void fw_config_handle(void *unused)
+{
+ if (fw_config_probe(FW_CONFIG(AUDIO, ADL_MAX98373_ALC5682I_I2S))) {
+ printk(BIOS_INFO, "Configure GPIOs for I2S audio.\n");
+ gpio_configure_pads(i2s_enable_pads, ARRAY_SIZE(i2s_enable_pads));
+ }
+}
+BOOT_STATE_INIT_ENTRY(BS_DEV_ENABLE, BS_ON_ENTRY, fw_config_handle, NULL);