Kyösti Mälkki (kyosti.malkki(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/15469
-gerrit
commit 31a10b3207b8759c2aeb5ffc91230ca2ec35acde
Author: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
Date: Mon Jun 27 12:13:48 2016 +0300
intel post-car: Delay ACPI S3 backup until ramstage loader
Change-Id: If0060b9ad8703a3d6524004fb69cb2171f8d89a3
Signed-off-by: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
---
src/mainboard/lenovo/t400/romstage.c | 1 -
src/mainboard/lenovo/x200/romstage.c | 1 -
src/mainboard/lenovo/x201/romstage.c | 1 -
src/mainboard/packardbell/ms2290/romstage.c | 1 -
src/mainboard/roda/rk9/romstage.c | 1 -
src/northbridge/intel/i945/early_init.c | 1 -
src/northbridge/intel/sandybridge/early_init.c | 1 -
7 files changed, 7 deletions(-)
diff --git a/src/mainboard/lenovo/t400/romstage.c b/src/mainboard/lenovo/t400/romstage.c
index f518775..0e7309d 100644
--- a/src/mainboard/lenovo/t400/romstage.c
+++ b/src/mainboard/lenovo/t400/romstage.c
@@ -179,7 +179,6 @@ void mainboard_romstage_entry(unsigned long bist)
* this is not a resume. In that case we just create the cbmem toc.
*/
if (s3resume && cbmem_initted) {
- acpi_prepare_for_resume();
/* Magic for S3 resume */
pci_write_config32(PCI_DEV(0, 0, 0), D0F0_SKPD, SKPAD_ACPI_S3_MAGIC);
diff --git a/src/mainboard/lenovo/x200/romstage.c b/src/mainboard/lenovo/x200/romstage.c
index 1deab65..db1d62f 100644
--- a/src/mainboard/lenovo/x200/romstage.c
+++ b/src/mainboard/lenovo/x200/romstage.c
@@ -179,7 +179,6 @@ void mainboard_romstage_entry(unsigned long bist)
* this is not a resume. In that case we just create the cbmem toc.
*/
if (s3resume && cbmem_initted) {
- acpi_prepare_for_resume();
/* Magic for S3 resume */
pci_write_config32(PCI_DEV(0, 0, 0), D0F0_SKPD, SKPAD_ACPI_S3_MAGIC);
diff --git a/src/mainboard/lenovo/x201/romstage.c b/src/mainboard/lenovo/x201/romstage.c
index 2bfa19c..7b8d7f9 100644
--- a/src/mainboard/lenovo/x201/romstage.c
+++ b/src/mainboard/lenovo/x201/romstage.c
@@ -282,7 +282,6 @@ void mainboard_romstage_entry(unsigned long bist)
* this is not a resume. In that case we just create the cbmem toc.
*/
if (s3resume) {
- acpi_prepare_for_resume();
/* Magic for S3 resume */
pci_write_config32(PCI_DEV(0, 0x00, 0), SKPAD, 0xcafed00d);
diff --git a/src/mainboard/packardbell/ms2290/romstage.c b/src/mainboard/packardbell/ms2290/romstage.c
index 92ee021..04c9513 100644
--- a/src/mainboard/packardbell/ms2290/romstage.c
+++ b/src/mainboard/packardbell/ms2290/romstage.c
@@ -272,7 +272,6 @@ void mainboard_romstage_entry(unsigned long bist)
* this is not a resume. In that case we just create the cbmem toc.
*/
if (s3resume) {
- acpi_prepare_for_resume();
/* Magic for S3 resume */
pci_write_config32(PCI_DEV(0, 0x00, 0), SKPAD, 0xcafed00d);
diff --git a/src/mainboard/roda/rk9/romstage.c b/src/mainboard/roda/rk9/romstage.c
index fc0c8d3..e8bd1e2 100644
--- a/src/mainboard/roda/rk9/romstage.c
+++ b/src/mainboard/roda/rk9/romstage.c
@@ -192,7 +192,6 @@ void mainboard_romstage_entry(unsigned long bist)
* this is not a resume. In that case we just create the cbmem toc.
*/
if (s3resume && cbmem_initted) {
- acpi_prepare_for_resume();
/* Magic for S3 resume */
pci_write_config32(PCI_DEV(0, 0, 0), D0F0_SKPD, SKPAD_ACPI_S3_MAGIC);
diff --git a/src/northbridge/intel/i945/early_init.c b/src/northbridge/intel/i945/early_init.c
index ade120f..3164f25 100644
--- a/src/northbridge/intel/i945/early_init.c
+++ b/src/northbridge/intel/i945/early_init.c
@@ -900,7 +900,6 @@ static void i945_prepare_resume(int s3resume)
* this is not a resume. In that case we just create the cbmem toc.
*/
if (s3resume && cbmem_was_initted) {
- acpi_prepare_for_resume();
/* Magic for S3 resume */
pci_write_config32(PCI_DEV(0, 0x00, 0), SKPAD,
diff --git a/src/northbridge/intel/sandybridge/early_init.c b/src/northbridge/intel/sandybridge/early_init.c
index a013ec3..86d1c00 100644
--- a/src/northbridge/intel/sandybridge/early_init.c
+++ b/src/northbridge/intel/sandybridge/early_init.c
@@ -234,7 +234,6 @@ void northbridge_romstage_finalize(int s3resume)
*/
if (s3resume) {
- acpi_prepare_for_resume();
/* Magic for S3 resume */
pci_write_config32(PCI_DEV(0, 0x00, 0), SKPAD, 0xcafed00d);
Kyösti Mälkki (kyosti.malkki(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/15468
-gerrit
commit cce68820dd9278de8a225b658621910c8b649b9a
Author: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
Date: Mon Jun 27 13:24:11 2016 +0300
intel post-car: Separate romstage ramstack (WIP)
TODO: Need to fix MTRRs before placing stack high.
Change-Id: I221e207bcd0031048876f29100a1770a444d435b
Signed-off-by: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
---
src/cpu/intel/car/romstage.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/src/cpu/intel/car/romstage.c b/src/cpu/intel/car/romstage.c
index c6df446..4892750 100644
--- a/src/cpu/intel/car/romstage.c
+++ b/src/cpu/intel/car/romstage.c
@@ -1,7 +1,21 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
#include <cpu/intel/romstage.h>
+#include <program_loading.h>
void * asmlinkage romstage_main(unsigned long bist)
{
mainboard_romstage_entry(bist);
- return (void*)CONFIG_RAMTOP;
+ return (void*)romstage_ram_stack();
}
Kyösti Mälkki (kyosti.malkki(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/15463
-gerrit
commit da85ad95f13f3a15dcc2c9a2cce35be85a72b2d6
Author: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
Date: Mon Jun 27 14:50:27 2016 +0300
intel post-car: Consolidate choose_top_of_stack()
Change-Id: I2c49d68ea9a8f52737b6064bc4fa703bdb1af1df
Signed-off-by: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
---
src/cpu/Kconfig | 4 +++
src/cpu/intel/haswell/romstage.c | 16 +----------
src/drivers/intel/fsp1_1/Kconfig | 4 ---
src/drivers/intel/fsp1_1/stack.c | 20 ++------------
src/include/program_loading.h | 5 ++++
src/lib/Makefile.inc | 1 +
src/lib/romstage_stack.c | 44 ++++++++++++++++++++++++++++++
src/soc/intel/baytrail/romstage/romstage.c | 16 +----------
src/soc/intel/broadwell/romstage/stack.c | 17 ++----------
9 files changed, 60 insertions(+), 67 deletions(-)
diff --git a/src/cpu/Kconfig b/src/cpu/Kconfig
index a026b28..37d6513 100644
--- a/src/cpu/Kconfig
+++ b/src/cpu/Kconfig
@@ -25,6 +25,10 @@ config DCACHE_BSP_STACK_SLUSH
config DCACHE_AP_STACK_SIZE
hex
+config ROMSTAGE_RAM_STACK_SIZE
+ hex "Size of the romstage RAM stack in bytes"
+ default 0x5000
+
config SMP
bool
default y if MAX_CPUS != 1
diff --git a/src/cpu/intel/haswell/romstage.c b/src/cpu/intel/haswell/romstage.c
index cde9441..8354aeb 100644
--- a/src/cpu/intel/haswell/romstage.c
+++ b/src/cpu/intel/haswell/romstage.c
@@ -65,20 +65,6 @@ static inline u32 *stack_push(u32 *stack, u32 value)
return stack;
}
-/* Romstage needs quite a bit of stack for decompressing images since the lzma
- * lib keeps its state on the stack during romstage. */
-#define ROMSTAGE_RAM_STACK_SIZE 0x5000
-static unsigned long choose_top_of_stack(void)
-{
- unsigned long stack_top;
-
- /* cbmem_add() does a find() before add(). */
- stack_top = (unsigned long)cbmem_add(CBMEM_ID_ROMSTAGE_RAM_STACK,
- ROMSTAGE_RAM_STACK_SIZE);
- stack_top += ROMSTAGE_RAM_STACK_SIZE;
- return stack_top;
-}
-
/* setup_romstage_stack_after_car() determines the stack to use after
* cache-as-ram is torn down as well as the MTRR settings to use. */
static void *setup_romstage_stack_after_car(void)
@@ -90,7 +76,7 @@ static void *setup_romstage_stack_after_car(void)
u32 top_of_ram;
/* Top of stack needs to be aligned to a 4-byte boundary. */
- top_of_stack = choose_top_of_stack() & ~3;
+ top_of_stack = romstage_ram_stack() & ~3;
slot = (void *)top_of_stack;
num_mtrrs = 0;
diff --git a/src/drivers/intel/fsp1_1/Kconfig b/src/drivers/intel/fsp1_1/Kconfig
index 86f6c7b..59b4797 100644
--- a/src/drivers/intel/fsp1_1/Kconfig
+++ b/src/drivers/intel/fsp1_1/Kconfig
@@ -99,10 +99,6 @@ config GOP_SUPPORT
bool "Enable GOP support"
default n
-config ROMSTAGE_RAM_STACK_SIZE
- hex "Size of the romstage RAM stack in bytes"
- default 0x5000
-
config USE_GENERIC_FSP_CAR_INC
bool
default n
diff --git a/src/drivers/intel/fsp1_1/stack.c b/src/drivers/intel/fsp1_1/stack.c
index 65ba235..b0e4992 100644
--- a/src/drivers/intel/fsp1_1/stack.c
+++ b/src/drivers/intel/fsp1_1/stack.c
@@ -21,23 +21,7 @@
#include <fsp/romstage.h>
#include <fsp/stack.h>
#include <stdlib.h>
-
-const unsigned long romstage_ram_stack_size = CONFIG_ROMSTAGE_RAM_STACK_SIZE;
-
-/*
- * Romstage needs quite a bit of stack for decompressing images since the lzma
- * lib keeps its state on the stack during romstage.
- */
-static unsigned long choose_top_of_stack(void)
-{
- unsigned long stack_top;
-
- /* cbmem_add() does a find() before add(). */
- stack_top = (unsigned long)cbmem_add(CBMEM_ID_ROMSTAGE_RAM_STACK,
- romstage_ram_stack_size);
- stack_top += romstage_ram_stack_size;
- return stack_top;
-}
+#include <program_loading.h>
/*
* setup_stack_and_mtrrs() determines the stack to use after
@@ -57,7 +41,7 @@ void *setup_stack_and_mtrrs(void)
soc_display_mtrrs();
/* Top of stack needs to be aligned to a 8-byte boundary. */
- top_of_stack = choose_top_of_stack();
+ top_of_stack = romstage_ram_stack();
slot = (void *)top_of_stack;
num_mtrrs = 0;
max_mtrrs = soc_get_variable_mtrr_count(NULL);
diff --git a/src/include/program_loading.h b/src/include/program_loading.h
index 42addb8..929d60c 100644
--- a/src/include/program_loading.h
+++ b/src/include/program_loading.h
@@ -170,6 +170,11 @@ void run_ramstage(void);
/* Called when the stage cache couldn't load ramstage on resume. */
void ramstage_cache_invalid(void);
+/* Determine where stack for ramstage loader is located. */
+unsigned long romstage_ram_stack_maybe_low(int no_cbmem);
+unsigned long romstage_ram_stack(void);
+extern const unsigned long romstage_ram_stack_size;
+
/***********************
* PAYLOAD LOADING *
***********************/
diff --git a/src/lib/Makefile.inc b/src/lib/Makefile.inc
index 1028917..0c34b75 100644
--- a/src/lib/Makefile.inc
+++ b/src/lib/Makefile.inc
@@ -78,6 +78,7 @@ romstage-$(CONFIG_PRIMITIVE_MEMTEST) += primitive_memtest.c
ramstage-$(CONFIG_PRIMITIVE_MEMTEST) += primitive_memtest.c
romstage-$(CONFIG_CACHE_AS_RAM) += ramtest.c
romstage-$(CONFIG_GENERIC_GPIO_LIB) += gpio.c
+romstage-y += romstage_stack.c
romstage-y += stack.c
ramstage-y += rtc.c
diff --git a/src/lib/romstage_stack.c b/src/lib/romstage_stack.c
new file mode 100644
index 0000000..319d354
--- /dev/null
+++ b/src/lib/romstage_stack.c
@@ -0,0 +1,44 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2013 Google Inc.
+ * Copyright (C) 2015-2016 Intel Corp.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include <program_loading.h>
+#include <cbmem.h>
+
+const unsigned long romstage_ram_stack_size = CONFIG_ROMSTAGE_RAM_STACK_SIZE;
+
+/*
+ * Romstage needs quite a bit of stack for decompressing images since the lzma
+ * lib keeps its state on the stack during romstage.
+ */
+unsigned long romstage_ram_stack_maybe_low(int no_cbmem)
+{
+ unsigned long stack_top;
+
+ if (no_cbmem)
+ return CONFIG_RAMTOP;
+
+ /* cbmem_add() does a find() before add(). */
+ stack_top = (unsigned long)cbmem_add(CBMEM_ID_ROMSTAGE_RAM_STACK,
+ romstage_ram_stack_size);
+ stack_top += romstage_ram_stack_size;
+ return stack_top;
+}
+
+unsigned long romstage_ram_stack(void)
+{
+ int no_cbmem = IS_ENABLED(CONFIG_LATE_CBMEM_INIT);
+ return romstage_ram_stack_maybe_low(no_cbmem);
+}
diff --git a/src/soc/intel/baytrail/romstage/romstage.c b/src/soc/intel/baytrail/romstage/romstage.c
index a167c90..6cf13bc 100644
--- a/src/soc/intel/baytrail/romstage/romstage.c
+++ b/src/soc/intel/baytrail/romstage/romstage.c
@@ -258,20 +258,6 @@ static inline uint32_t *stack_push(u32 *stack, u32 value)
return stack;
}
-/* Romstage needs quite a bit of stack for decompressing images since the lzma
- * lib keeps its state on the stack during romstage. */
-static unsigned long choose_top_of_stack(void)
-{
- unsigned long stack_top;
- const unsigned long romstage_ram_stack_size = 0x5000;
-
- /* cbmem_add() does a find() before add(). */
- stack_top = (unsigned long)cbmem_add(CBMEM_ID_ROMSTAGE_RAM_STACK,
- romstage_ram_stack_size);
- stack_top += romstage_ram_stack_size;
- return stack_top;
-}
-
/* setup_stack_and_mttrs() determines the stack to use after
* cache-as-ram is torn down as well as the MTRR settings to use. */
static void *setup_stack_and_mttrs(void)
@@ -283,7 +269,7 @@ static void *setup_stack_and_mttrs(void)
uint32_t top_of_ram;
/* Top of stack needs to be aligned to a 4-byte boundary. */
- top_of_stack = choose_top_of_stack() & ~3;
+ top_of_stack = romstage_ram_stack() & ~3;
slot = (void *)top_of_stack;
num_mtrrs = 0;
diff --git a/src/soc/intel/broadwell/romstage/stack.c b/src/soc/intel/broadwell/romstage/stack.c
index 6c602a8..87f56ad 100644
--- a/src/soc/intel/broadwell/romstage/stack.c
+++ b/src/soc/intel/broadwell/romstage/stack.c
@@ -21,6 +21,7 @@
#include <cbmem.h>
#include <cpu/x86/mtrr.h>
#include <soc/romstage.h>
+#include <program_loading.h>
static inline uint32_t *stack_push(u32 *stack, u32 value)
{
@@ -29,20 +30,6 @@ static inline uint32_t *stack_push(u32 *stack, u32 value)
return stack;
}
-/* Romstage needs quite a bit of stack for decompressing images since the lzma
- * lib keeps its state on the stack during romstage. */
-static unsigned long choose_top_of_stack(void)
-{
- unsigned long stack_top;
- const unsigned long romstage_ram_stack_size = 0x5000;
-
- /* cbmem_add() does a find() before add(). */
- stack_top = (unsigned long)cbmem_add(CBMEM_ID_ROMSTAGE_RAM_STACK,
- romstage_ram_stack_size);
- stack_top += romstage_ram_stack_size;
- return stack_top;
-}
-
/* setup_stack_and_mttrs() determines the stack to use after
* cache-as-ram is torn down as well as the MTRR settings to use. */
void *setup_stack_and_mttrs(void)
@@ -54,7 +41,7 @@ void *setup_stack_and_mttrs(void)
uint32_t top_of_ram;
/* Top of stack needs to be aligned to a 4-byte boundary. */
- top_of_stack = choose_top_of_stack() & ~3;
+ top_of_stack = romstage_ram_stack() & ~3;
slot = (void *)top_of_stack;
num_mtrrs = 0;
Saurabh Satija (saurabh.satija(a)intel.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/15311
-gerrit
commit ffb230acfb2527dc7ef1fd3b69f02b93dc534baa
Author: Saurabh Satija <saurabh.satija(a)intel.com>
Date: Tue Jun 21 14:22:16 2016 -0700
soc/intel/apollolake: Add NHLT add codec APIs and device/vendor ids
nhlt_add_<codec>_on_ssp uses codec configs, tdm configs and add the
particular codec on a SSP port specified by mainboard.
get_nhlt_link_type() returns a corresponding NHLT link type based on
audio soc hardware interface passed as an argument.
Also define vendor id for NHLT and device ids for NHLT Bluetooth,
DMIC & SSPs. These ids are used to add NHLT endpoints for different
audio codecs. These ids are platform dependent.
Change-Id: Ic9bd26ebe8d6df60af23733e122fd8f3c0432e1f
Signed-off-by: Saurabh Satija <saurabh.satija(a)intel.com>
---
src/soc/intel/apollolake/Makefile.inc | 1 +
src/soc/intel/apollolake/include/soc/nhlt.h | 39 +++++++++
src/soc/intel/apollolake/nhlt.c | 130 ++++++++++++++++++++++++++++
3 files changed, 170 insertions(+)
diff --git a/src/soc/intel/apollolake/Makefile.inc b/src/soc/intel/apollolake/Makefile.inc
index a82dacd..556abbb 100644
--- a/src/soc/intel/apollolake/Makefile.inc
+++ b/src/soc/intel/apollolake/Makefile.inc
@@ -55,6 +55,7 @@ ramstage-y += pmutil.c
ramstage-y += pmc.c
ramstage-y += smi.c
ramstage-y += reset.c
+ramstage-y += nhlt.c
# DSP firmware settings files.
NHLT_BLOB_PATH = 3rdparty/blobs/soc/intel/apollolake/nhlt-blobs
diff --git a/src/soc/intel/apollolake/include/soc/nhlt.h b/src/soc/intel/apollolake/include/soc/nhlt.h
new file mode 100644
index 0000000..cc6486b
--- /dev/null
+++ b/src/soc/intel/apollolake/include/soc/nhlt.h
@@ -0,0 +1,39 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2016 Intel Corp.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef _SOC_APOLLOLAKE_NHLT_H_
+#define _SOC_APOLLOLAKE_NHLT_H_
+
+#define NHLT_VID 0x8086
+#define NHLT_DID_DMIC 0xae20
+#define NHLT_DID_BT 0xae30
+#define NHLT_DID_SSP 0xae34
+
+enum {
+ AUDIO_LINK_SSP0,
+ AUDIO_LINK_SSP1,
+ AUDIO_LINK_SSP2,
+ AUDIO_LINK_SSP3,
+ AUDIO_LINK_SSP4,
+ AUDIO_LINK_SSP5,
+ AUDIO_LINK_DMIC,
+};
+
+int nhlt_soc_add_dmic_array(struct nhlt *nhlt, int num_channels);
+int nhlt_soc_add_max98357(struct nhlt *nhlt, int hwlink);
+int nhlt_soc_add_da7219(struct nhlt *nhlt, int hwlink);
+
+#endif
diff --git a/src/soc/intel/apollolake/nhlt.c b/src/soc/intel/apollolake/nhlt.c
new file mode 100644
index 0000000..87fc65a
--- /dev/null
+++ b/src/soc/intel/apollolake/nhlt.c
@@ -0,0 +1,130 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2016 Intel Corp.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include <console/console.h>
+#include <nhlt.h>
+#include <soc/nhlt.h>
+
+static const struct nhlt_format_config dmic_2ch_cfg[] = {
+ /* 48 KHz 16-bits per sample. */
+ {
+ .num_channels = 2,
+ .sample_freq_khz = 48,
+ .container_bits_per_sample = 16,
+ .valid_bits_per_sample = 16,
+ .settings_file = "dmic-2ch-48khz-16b.bin",
+ },
+};
+
+static const struct nhlt_format_config da7219_cfg[] = {
+ /* 48 KHz 24-bits per sample. */
+ {
+ .num_channels = 2,
+ .sample_freq_khz = 48,
+ .container_bits_per_sample = 32,
+ .valid_bits_per_sample = 24,
+ .settings_file = "dialog-2ch-48khz-24b.bin",
+ },
+};
+
+static const struct nhlt_tdm_config tdm_cfg = {
+ .virtual_slot = 0,
+ .config_type = NHLT_TDM_BASIC,
+};
+
+static const struct nhlt_format_config max98357_cfg[] = {
+ /* 48 KHz 24-bits per sample. */
+ {
+ .num_channels = 2,
+ .sample_freq_khz = 48,
+ .container_bits_per_sample = 32,
+ .valid_bits_per_sample = 24,
+ .settings_file = "max98357-render-2ch-48khz-24b.bin",
+ },
+};
+
+int nhlt_soc_get_link_type(int hwlink, int soc_devtype)
+{
+ int nhlt_link_type;
+
+ switch (hwlink) {
+ case AUDIO_LINK_SSP0:
+ case AUDIO_LINK_SSP1:
+ case AUDIO_LINK_SSP3:
+ case AUDIO_LINK_SSP4:
+ case AUDIO_LINK_SSP5:
+ /* Only I2S devices. */
+ if (soc_devtype != AUDIO_DEV_I2S)
+ return -1;
+ nhlt_link_type = NHLT_LINK_SSP;
+ break;
+ case AUDIO_LINK_SSP2:
+ /* Only Bluetooth devices on SSP2. */
+ if (soc_devtype != AUDIO_DEV_BT)
+ return -1;
+ nhlt_link_type = NHLT_LINK_SSP;
+ break;
+ case AUDIO_LINK_DMIC:
+ // Only DMIC devices on DMIC links.
+ if (soc_devtype != AUDIO_DEV_DMIC)
+ return -1;
+ nhlt_link_type = NHLT_LINK_PDM;
+ break;
+ default:
+ return -1;
+ }
+
+ return nhlt_link_type;
+}
+
+int nhlt_soc_add_dmic_array(struct nhlt *nhlt, int num_channels)
+{
+ if (num_channels != 2) {
+ printk(BIOS_ERR, "APL only supports 2CH DMIC array.\n");
+ return -1;
+ }
+
+ if (nhlt_add_dmic_array(nhlt, num_channels, dmic_2ch_cfg,
+ ARRAY_SIZE(dmic_2ch_cfg))) {
+ printk(BIOS_ERR, "Couldn't add 2CH DMIC array.\n");
+ return -1;
+ }
+
+ return 0;
+}
+
+int nhlt_soc_add_max98357(struct nhlt *nhlt, int hwlink)
+{
+ if (nhlt_add_codec_on_ssp(nhlt, hwlink, max98357_cfg,
+ ARRAY_SIZE(max98357_cfg), NULL, 0, NULL, 0)) {
+ printk(BIOS_ERR, "Couldn't add Maxim_98357 codec.\n");
+ return -1;
+ }
+
+ return 0;
+}
+
+int nhlt_soc_add_da7219(struct nhlt *nhlt, int hwlink)
+{
+ if (nhlt_add_codec_on_ssp(nhlt, hwlink, da7219_cfg,
+ ARRAY_SIZE(da7219_cfg), da7219_cfg, ARRAY_SIZE(da7219_cfg), &tdm_cfg,
+ sizeof(tdm_cfg))) {
+ printk(BIOS_ERR, "Couldn't add Dialog_7219 codec.\n");
+ return -1;
+ }
+
+ return 0;
+}