summaryrefslogtreecommitdiff
path: root/src/mainboard/intel/mtlrvp/fw_config.c
diff options
context:
space:
mode:
authorUsha P <usha.p@intel.com>2023-02-13 09:31:06 +0530
committerFelix Held <felix-coreboot@felixheld.de>2023-02-15 13:14:26 +0000
commit65654339f9bf8b8ebc18595c186e7d576eb23991 (patch)
treeeb4afea97f3faeab452a29628cc3af5d97596d8b /src/mainboard/intel/mtlrvp/fw_config.c
parent47f84d3a2401caa48c07bdb75adb73cf448ab2b1 (diff)
mb/intel/mtlrvp: Enable Audio for MTL-P RVP
This patch adds FW_CONFIG and codec support for MTL-P RVP BUG=None TEST=Build and boot MTL-P RVP to Chrome OS. Verify audio codec listed under aplay -l and audio working with the connected audio card. localhost ~ # aplay -l **** List of PLAYBACK Hardware Devices **** card 0: sofrt5682 [sof-rt5682], device 0: Headset (*) []   Subdevices: 1/1   Subdevice #0: subdevice #0 card 0: sofrt5682 [sof-rt5682], device 1: Speakers (*) []   Subdevices: 1/1   Subdevice #0: subdevice #0 card 0: sofrt5682 [sof-rt5682], device 5: HDMI1 (*) []   Subdevices: 1/1   Subdevice #0: subdevice #0 card 0: sofrt5682 [sof-rt5682], device 6: HDMI2 (*) []   Subdevices: 1/1   Subdevice #0: subdevice #0 card 0: sofrt5682 [sof-rt5682], device 7: HDMI3 (*) []   Subdevices: 1/1   Subdevice #0: subdevice #0 card 0: sofrt5682 [sof-rt5682], device 8: HDMI4 (*) []   Subdevices: 1/1   Subdevice #0: subdevice #0 Signed-off-by: Usha P <usha.p@intel.com> Change-Id: Ib29ac3e4105e578e1555076d180b35a8265a99c8 Signed-off-by: Jamie Ryu <jamie.m.ryu@intel.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/73015 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Sridhar Siricilla <sridhar.siricilla@intel.com> Reviewed-by: Eric Lai <eric_lai@quanta.corp-partner.google.com>
Diffstat (limited to 'src/mainboard/intel/mtlrvp/fw_config.c')
-rw-r--r--src/mainboard/intel/mtlrvp/fw_config.c101
1 files changed, 101 insertions, 0 deletions
diff --git a/src/mainboard/intel/mtlrvp/fw_config.c b/src/mainboard/intel/mtlrvp/fw_config.c
new file mode 100644
index 0000000000..d874228bde
--- /dev/null
+++ b/src/mainboard/intel/mtlrvp/fw_config.c
@@ -0,0 +1,101 @@
+#include <bootstate.h>
+#include <console/console.h>
+#include <fw_config.h>
+#include <gpio.h>
+#include <inttypes.h>
+
+static const struct pad_config i2s_enable_pads[] = {
+ /* Audio: I2S */
+ PAD_CFG_NF(GPP_D09, NONE, DEEP, NF2), /* I2S_MCLK1_OUT */
+ PAD_CFG_NF(GPP_D10, NONE, DEEP, NF2), /* I2S0_SCLK_HDR */
+ PAD_CFG_NF(GPP_D11, NONE, DEEP, NF2), /* I2S0_SFRM_HDR */
+ PAD_CFG_NF(GPP_D12, NONE, DEEP, NF2), /* I2S0_TXD_HDR */
+ PAD_CFG_NF(GPP_D13, NONE, DEEP, NF2), /* I2S0_RXD_HDR */
+
+ PAD_CFG_NF(GPP_S00, NONE, DEEP, NF6), /* I2S1_SCLK_HDR */
+ PAD_CFG_NF(GPP_S01, NONE, DEEP, NF6), /* I2S1_SFRM_HDR */
+ PAD_CFG_NF(GPP_S02, NONE, DEEP, NF6), /* I2S1_TXD_HDR */
+ PAD_CFG_NF(GPP_S03, NONE, DEEP, NF6), /* I2S1_RXD_HDR */
+ PAD_CFG_NF(GPP_S06, NONE, DEEP, NF3), /* DMIC_CLK_A1 */
+ PAD_CFG_NF(GPP_S07, NONE, DEEP, NF3), /* DMIC_DATA1 */
+};
+
+static const struct pad_config sndw_enable_pads[] = {
+ /* Soundwire GPIO Config */
+ /* DMIC config pads */
+ PAD_CFG_NF(GPP_D09, NONE, DEEP, NF2),
+ PAD_CFG_NF(GPP_D10, NONE, DEEP, NF2),
+ PAD_CFG_NF(GPP_D11, NONE, DEEP, NF2),
+ PAD_CFG_NF(GPP_D12, NONE, DEEP, NF2),
+ PAD_CFG_NF(GPP_D13, NONE, DEEP, NF2),
+ /* Soundwire - External codec - JE Header */
+ PAD_CFG_NF(GPP_S00, NONE, DEEP, NF1),
+ PAD_CFG_NF(GPP_S01, NONE, DEEP, NF1),
+ PAD_CFG_NF(GPP_S04, NONE, DEEP, NF1),
+ PAD_CFG_NF(GPP_S05, NONE, DEEP, NF1),
+ /* DMIC - JD Header */
+ PAD_CFG_NF(GPP_S02, NONE, DEEP, NF3),
+ PAD_CFG_NF(GPP_S03, NONE, DEEP, NF3),
+ PAD_CFG_NF(GPP_S06, NONE, DEEP, NF3),
+ PAD_CFG_NF(GPP_S07, NONE, DEEP, NF3),
+};
+
+static const struct pad_config sndw_alc711_enable_pads[] = {
+ /* DMIC config pads */
+ PAD_CFG_NF(GPP_D09, NONE, DEEP, NF2),
+ PAD_CFG_NF(GPP_D10, NONE, DEEP, NF2),
+ PAD_CFG_NF(GPP_D11, NONE, DEEP, NF2),
+ PAD_CFG_NF(GPP_D12, NONE, DEEP, NF2),
+ PAD_CFG_NF(GPP_D13, NONE, DEEP, NF2),
+ /* Soundwire GPIO Config */
+ PAD_CFG_NF(GPP_S00, NONE, DEEP, NF1),
+ PAD_CFG_NF(GPP_S01, NONE, DEEP, NF1),
+ /* DMIC - JD Header */
+ PAD_CFG_NF(GPP_S02, NONE, DEEP, NF3),
+ PAD_CFG_NF(GPP_S03, NONE, DEEP, NF3),
+ PAD_CFG_NF(GPP_S06, NONE, DEEP, NF3),
+ PAD_CFG_NF(GPP_S07, NONE, DEEP, NF3),
+};
+
+static const struct pad_config audio_disable_pads[] = {
+ PAD_NC(GPP_S00, NONE),
+ PAD_NC(GPP_S01, NONE),
+ PAD_NC(GPP_S02, NONE),
+ PAD_NC(GPP_S03, NONE),
+ PAD_NC(GPP_S04, NONE),
+ PAD_NC(GPP_S05, NONE),
+ PAD_NC(GPP_S06, NONE),
+ PAD_NC(GPP_S07, NONE),
+ PAD_NC(GPP_D09, NONE),
+ PAD_NC(GPP_D10, NONE),
+ PAD_NC(GPP_D11, NONE),
+ PAD_NC(GPP_D12, NONE),
+ PAD_NC(GPP_D13, NONE),
+};
+
+static void fw_config_handle(void *unused)
+{
+ printk(BIOS_INFO, "FW config 0x%" PRIx64 "\n", fw_config_get());
+ if (fw_config_probe(FW_CONFIG(AUDIO, NONE))) {
+ printk(BIOS_INFO, "Configure GPIOs for no audio.\n");
+ gpio_configure_pads(audio_disable_pads, ARRAY_SIZE(audio_disable_pads));
+ }
+
+ if (fw_config_probe(FW_CONFIG(AUDIO, MTL_ALC1019_ALC5682I_I2S)) ||
+ fw_config_probe(FW_CONFIG(AUDIO, MTL_ALC5682I_MAX9857A_I2S))) {
+ printk(BIOS_INFO, "Configure GPIOs for I2S audio.\n");
+ gpio_configure_pads(i2s_enable_pads, ARRAY_SIZE(i2s_enable_pads));
+ }
+
+ if (fw_config_probe(FW_CONFIG(AUDIO, MTL_MAX98373_ALC5682_SNDW))) {
+ printk(BIOS_INFO, "Configure GPIOs for SoundWire audio (ext codec).\n");
+ gpio_configure_pads(sndw_enable_pads, ARRAY_SIZE(i2s_enable_pads));
+ }
+
+ if (fw_config_probe(FW_CONFIG(AUDIO, MTL_ALC711_SNDW))) {
+ printk(BIOS_INFO, "Configure GPIOs for SoundWire audio (onboard codec).\n");
+ gpio_configure_pads(sndw_alc711_enable_pads, ARRAY_SIZE(i2s_enable_pads));
+ }
+
+}
+BOOT_STATE_INIT_ENTRY(BS_DEV_ENABLE, BS_ON_ENTRY, fw_config_handle, NULL);