Leroy P Leahy (leroy.p.leahy(a)intel.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/15041
-gerrit
commit da034c0725cc6674c4cf5b69fec63d5c6818e990
Author: Lee Leahy <leroy.p.leahy(a)intel.com>
Date: Tue May 31 08:32:21 2016 -0700
mainboard/intel/galileo: Set board version
Return the correct board version in SMBIOS.
TEST=Build and run on Galileo Gen2
Change-Id: I97ec7bcd475142eb90930152da0244a3c5d09634
Signed-off-by: Lee Leahy <leroy.p.leahy(a)intel.com>
---
src/mainboard/intel/galileo/Makefile.inc | 1 +
src/mainboard/intel/galileo/ramstage.c | 24 ++++++++++++++++++++++++
2 files changed, 25 insertions(+)
diff --git a/src/mainboard/intel/galileo/Makefile.inc b/src/mainboard/intel/galileo/Makefile.inc
index 83fb0db..449392c 100644
--- a/src/mainboard/intel/galileo/Makefile.inc
+++ b/src/mainboard/intel/galileo/Makefile.inc
@@ -21,4 +21,5 @@ romstage-y += gpio.c
romstage-y += reg_access.c
ramstage-y += gpio.c
+ramstage-y += ramstage.c
ramstage-y += reg_access.c
diff --git a/src/mainboard/intel/galileo/ramstage.c b/src/mainboard/intel/galileo/ramstage.c
new file mode 100644
index 0000000..2a8ade7
--- /dev/null
+++ b/src/mainboard/intel/galileo/ramstage.c
@@ -0,0 +1,24 @@
+/*
+ * 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; 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 <smbios.h>
+
+/* Set the board version */
+const char *smbios_mainboard_version(void)
+{
+ if (IS_ENABLED(CONFIG_GALILEO_GEN2))
+ return "Gen 2";
+ return "1.0";
+}
Leroy P Leahy (leroy.p.leahy(a)intel.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/15004
-gerrit
commit 0fe1b2631fa5753eca08a7926f58aa1b3d96fc42
Author: Lee Leahy <leroy.p.leahy(a)intel.com>
Date: Sat May 28 14:34:44 2016 -0700
mainboard/intel/galileo: Add CREATE_BOARD_CHECKLIST
Select CREATE_BOARD_CHECKLIST to create the checklist for the Quark SOC
and Galileo board.
TEST=Build and run on Galileo Gen2.
Change-Id: Ieb3e9a5a4c149cf160e11d44a515591b57fe5c83
Signed-off-by: Lee Leahy <leroy.p.leahy(a)intel.com>
---
src/mainboard/intel/galileo/Kconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/mainboard/intel/galileo/Kconfig b/src/mainboard/intel/galileo/Kconfig
index 96f1a8f..b0c69e4 100644
--- a/src/mainboard/intel/galileo/Kconfig
+++ b/src/mainboard/intel/galileo/Kconfig
@@ -18,6 +18,7 @@ if BOARD_INTEL_GALILEO
config BOARD_SPECIFIC_OPTIONS
def_bool y
select BOARD_ROMSIZE_KB_8192
+ select CREATE_BOARD_CHECKLIST
select ENABLE_BUILTIN_HSUART1
select HAVE_ACPI_TABLES
select SOC_INTEL_QUARK
Saurabh Satija (saurabh.satija(a)intel.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/15026
-gerrit
commit b9ade7edbf3da88205bf6b1987ddcc27c03c9a4f
Author: Saurabh Satija <saurabh.satija(a)intel.com>
Date: Tue Mar 8 17:33:29 2016 -0800
apollolake: Add ACPI device for audio controller
Add the audio controller device to ACPI and define the _DSM handler
to return the address of the NHLT table, if set in NVS.
Change-Id: I619dbfb562b94255e42a3e5d5a3926c28b14db3e
Signed-off-by: Saurabh Satija <saurabh.satija(a)intel.com>
---
src/soc/intel/apollolake/acpi/pch.asl | 23 ++++++++
src/soc/intel/apollolake/acpi/pch_hda.asl | 89 +++++++++++++++++++++++++++++++
2 files changed, 112 insertions(+)
diff --git a/src/soc/intel/apollolake/acpi/pch.asl b/src/soc/intel/apollolake/acpi/pch.asl
new file mode 100644
index 0000000..8bcbfd7
--- /dev/null
+++ b/src/soc/intel/apollolake/acpi/pch.asl
@@ -0,0 +1,23 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2007-2009 coresystems GmbH
+ * Copyright (C) 2015 Google Inc.
+ * Copyright (C) 2015 Intel Corporation.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc.
+ */
+
+/* PCH HDA */
+#include "pch_hda.asl"
diff --git a/src/soc/intel/apollolake/acpi/pch_hda.asl b/src/soc/intel/apollolake/acpi/pch_hda.asl
new file mode 100644
index 0000000..ac027e6
--- /dev/null
+++ b/src/soc/intel/apollolake/acpi/pch_hda.asl
@@ -0,0 +1,89 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2015 Intel Corporation.
+ * Copyright (C) 2015 Google Inc.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc.
+ */
+
+/* Audio Controller - Device 14, Function 0 */
+
+Device (HDAS)
+{
+ Name (_ADR, 0x000E0000)
+ Name (_DDN, "Audio Controller")
+ Name (UUID, ToUUID ("A69F886E-6CEB-4594-A41F-7B5DCE24C553"))
+
+ /* Device is D3 wake capable */
+ Name (_S0W, 3)
+
+ /* NHLT Table Address populated from GNVS values */
+ Name (NBUF, ResourceTemplate () {
+ QWordMemory (ResourceConsumer, PosDecode, MinFixed,
+ MaxFixed, NonCacheable, ReadOnly,
+ 0, 0, 0, 0, 1,,, NHLT, AddressRangeACPI)
+ })
+
+ /*
+ * Device Specific Method
+ * Arg0 - UUID
+ * Arg1 - Revision
+ * Arg2 - Function Index
+ */
+ Method (_DSM, 4)
+ {
+ If (LEqual (Arg0, ^UUID)) {
+ /*
+ * Function 0: Function Support Query
+ * Returns a bitmask of functions supported.
+ */
+ If (LEqual (Arg2, Zero)) {
+ /*
+ * NHLT Query only supported for revision 1 and
+ * if NHLT address and length are set in NVS.
+ */
+ If (LAnd (LEqual (Arg1, One),
+ LAnd (LNotEqual (NHLA, Zero),
+ LNotEqual (NHLL, Zero)))) {
+ Return (Buffer (One) { 0x03 })
+ } Else {
+ Return (Buffer (One) { 0x01 })
+ }
+ }
+
+ /*
+ * Function 1: Query NHLT memory address used by
+ * Intel Offload Engine Driver to discover any non-HDA
+ * devices that are supported by the DSP.
+ *
+ * Returns a pointer to NHLT table in memory.
+ */
+ If (LEqual (Arg2, One)) {
+ CreateQWordField (NBUF, ^NHLT._MIN, NBAS)
+ CreateQWordField (NBUF, ^NHLT._MAX, NMAS)
+ CreateQWordField (NBUF, ^NHLT._LEN, NLEN)
+
+ Store (NHLA, NBAS)
+ Store (NHLA, NMAS)
+ Store (NHLL, NLEN)
+
+ Return (NBUF)
+ }
+ }
+
+ Return (Buffer (One) { 0x00 })
+ }
+}
+
Saurabh Satija (saurabh.satija(a)intel.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/15038
-gerrit
commit ab7f19fd44fb39205607cf43058c1839cb054adf
Author: Saurabh Satija <saurabh.satija(a)intel.com>
Date: Wed Apr 20 15:30:16 2016 -0700
soc/intel/apollolake: Increase heap size to 64 KiB
We run out of heap space (current default is 16 KiB)
when NHLT blobs are loaded.
Change-Id: I5d4872178d6e8700da89bf93e8d48cf46c4cd85b
Signed-off-by: Saurabh Satija <saurabh.satija(a)intel.com>
Reviewed-by: Petrov, Andrey <andrey.petrov(a)intel.com>
---
src/soc/intel/apollolake/Kconfig | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/soc/intel/apollolake/Kconfig b/src/soc/intel/apollolake/Kconfig
index d6c5ffc..0b9c05a 100644
--- a/src/soc/intel/apollolake/Kconfig
+++ b/src/soc/intel/apollolake/Kconfig
@@ -160,4 +160,8 @@ config LBP2_FILE_NAME
help
Name of file to store in the logical boot partition 2 region.
+config HEAP_SIZE
+ hex
+ default 0x10000
+
endif
Saurabh Satija (saurabh.satija(a)intel.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/15023
-gerrit
commit dc432beb0fde7f24f92801c91139a1fcc61c9c73
Author: Saurabh Satija <saurabh.satija(a)intel.com>
Date: Thu May 26 15:53:41 2016 -0700
drivers/intel/audio: Add common NHLT audio for Intel platforms
The use of a NHLT table is required to make audio work
on the intel SoCs employing the internal DSP. The table
describes the audo endpoints (render vs capture) along with
their supported formats. These formats are not only dependent
on the audio peripheral but also hardware interfaces. As such
each format has an associated blob of DSP settings to make
the peripheral work. Lastly, each of these settings are provided
by Intel and need to be generated for each device's hardware
connection plus mode/format it supports. This patch does not
include the dsp setting blobs.
Change-Id: I3c75d3537288c47d29e8949ca253ea8c5c1a387d
Signed-off-by: Saurabh Satija <saurabh.satija(a)intel.com>
---
src/drivers/intel/audio/Kconfig | 48 +++++++++++++
src/drivers/intel/audio/Makefile.inc | 43 +++++++++++
src/drivers/intel/audio/dmic.c | 53 ++++++++++++++
src/drivers/intel/audio/headset.c | 60 ++++++++++++++++
src/drivers/intel/audio/include/drivers/audio.h | 59 +++++++++++++++
src/drivers/intel/audio/nhlt.c | 95 +++++++++++++++++++++++++
src/drivers/intel/audio/speaker.c | 40 +++++++++++
7 files changed, 398 insertions(+)
diff --git a/src/drivers/intel/audio/Kconfig b/src/drivers/intel/audio/Kconfig
new file mode 100644
index 0000000..fdc494c
--- /dev/null
+++ b/src/drivers/intel/audio/Kconfig
@@ -0,0 +1,48 @@
+config USE_COMMON_AUDIO
+ bool
+ default n
+ help
+ Build support for drivers audio code, common to intel
+ platforms that use NHLT.
+
+config AUDIO_DMIC_2CH_16B
+ bool
+ depends on USE_COMMON_AUDIO
+ default n
+ help
+ Include DSP firmware settings for 2 channel 16B DMIC array.
+
+config AUDIO_DMIC_2CH_32B
+ bool
+ depends on USE_COMMON_AUDIO
+ default n
+ help
+ Include DSP firmware settings for 2 channel 32B DMIC array.
+
+config AUDIO_DMIC_4CH_16B
+ bool
+ depends on USE_COMMON_AUDIO
+ default n
+ help
+ Include DSP firmware settings for 4 channel 16B DMIC array.
+
+config AUDIO_DMIC_4CH_32B
+ bool
+ depends on USE_COMMON_AUDIO
+ default n
+ help
+ Include DSP firmware settings for 4 channel 32B DMIC array.
+
+config AUDIO_HEADSET
+ bool
+ depends on USE_COMMON_AUDIO
+ default n
+ help
+ Include DSP firmware settings for headset codec.
+
+config AUDIO_SPEAKER
+ bool
+ depends on USE_COMMON_AUDIO
+ default n
+ help
+ Include DSP firmware settings for speaker amplifier.
diff --git a/src/drivers/intel/audio/Makefile.inc b/src/drivers/intel/audio/Makefile.inc
new file mode 100644
index 0000000..6bea190
--- /dev/null
+++ b/src/drivers/intel/audio/Makefile.inc
@@ -0,0 +1,43 @@
+ifeq ($(CONFIG_USE_COMMON_AUDIO),y)
+ramstage-y += nhlt.c
+ramstage-y += dmic.c
+ramstage-y += headset.c
+ramstage-y += speaker.c
+
+# DSP firmware settings files.
+NHLT_BLOB_PATH = 3rdparty/blobs/soc/intel/apollolake/nhlt-blobs
+DMIC_2CH_48KHZ_16B = dmic-2ch-48khz-16b.bin
+DMIC_2CH_48KHZ_32B = dmic-2ch-48khz-32b.bin
+DMIC_4CH_48KHZ_16B = dmic-4ch-48khz-16b.bin
+DMIC_4CH_48KHZ_32B = dmic-4ch-48khz-32b.bin
+
+HEADSET = headset-2ch-48khz-24b.bin
+
+SPEAKER_RENDER = max98357-render-2ch-48khz-24b.bin
+
+cbfs-files-$(CONFIG_AUDIO_DMIC_2CH_16B) += $(DMIC_2CH_48KHZ_16B)
+$(DMIC_2CH_48KHZ_16B)-file := $(NHLT_BLOB_PATH)/$(DMIC_2CH_48KHZ_16B)
+$(DMIC_2CH_48KHZ_16B)-type := raw
+
+cbfs-files-$(CONFIG_AUDIO_DMIC_2CH_32B) += $(DMIC_2CH_48KHZ_32B)
+$(DMIC_2CH_48KHZ_32B)-file := $(NHLT_BLOB_PATH)/$(DMIC_2CH_48KHZ_32B)
+$(DMIC_2CH_48KHZ_32B)-type := raw
+
+cbfs-files-$(CONFIG_AUDIO_DMIC_4CH_16B) += $(DMIC_4CH_48KHZ_16B)
+$(DMIC_4CH_48KHZ_16B)-file := $(NHLT_BLOB_PATH)/$(DMIC_4CH_48KHZ_16B)
+$(DMIC_4CH_48KHZ_16B)-type := raw
+
+cbfs-files-$(CONFIG_AUDIO_DMIC_4CH_32B) += $(DMIC_4CH_48KHZ_32B)
+$(DMIC_4CH_48KHZ_32B)-file := $(NHLT_BLOB_PATH)/$(DMIC_4CH_48KHZ_32B)
+$(DMIC_4CH_48KHZ_32B)-type := raw
+
+cbfs-files-$(CONFIG_AUDIO_HEADSET) += $(HEADSET)
+$(HEADSET)-file := $(NHLT_BLOB_PATH)/$(HEADSET)
+$(HEADSET)-type := raw
+
+cbfs-files-$(CONFIG_AUDIO_SPEAKER) += $(SPEAKER_RENDER)
+$(SPEAKER_RENDER)-file := $(NHLT_BLOB_PATH)/$(SPEAKER_RENDER)
+$(SPEAKER_RENDER)-type := raw
+endif
+
+CPPFLAGS_common += -I$(src)/drivers/intel/audio/include
diff --git a/src/drivers/intel/audio/dmic.c b/src/drivers/intel/audio/dmic.c
new file mode 100644
index 0000000..fe11d51
--- /dev/null
+++ b/src/drivers/intel/audio/dmic.c
@@ -0,0 +1,53 @@
+ /*
+ * This file is part of the coreboot project.
+ *
+ * Copyright 2016 Google, Inc.
+ *
+ * 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 <drivers/audio.h>
+#include <string.h>
+
+int nhlt_soc_add_dmic_array(struct nhlt *nhlt, const struct nhlt_format_config *dmic_ch_cfg, int fmt_size, int num_channels)
+{
+ struct nhlt_endpoint *endp;
+ struct nhlt_dmic_array_config mic_config;
+ const struct nhlt_format_config *formats;
+
+ if (num_channels != 2 && num_channels != 4)
+ return -1;
+
+ endp = nhlt_soc_add_endpoint(nhlt, AUDIO_LINK_DMIC, AUDIO_DEV_DMIC,
+ NHLT_DIR_CAPTURE);
+
+ if (endp == NULL)
+ return -1;
+
+ memset(&mic_config, 0, sizeof(mic_config));
+ mic_config.tdm_config.config_type = NHLT_TDM_MIC_ARRAY;
+
+ formats = dmic_ch_cfg;
+
+ switch (num_channels) {
+ case 2:
+ mic_config.array_type = NHLT_MIC_ARRAY_2CH_SMALL;
+ break;
+ case 4:
+ mic_config.array_type = NHLT_MIC_ARRAY_4CH_L_SHAPED;
+ break;
+ }
+
+ if (nhlt_endpoint_append_config(endp, &mic_config, sizeof(mic_config)))
+ return -1;
+
+ return nhlt_endpoint_add_formats(endp, formats, fmt_size);
+}
+
diff --git a/src/drivers/intel/audio/headset.c b/src/drivers/intel/audio/headset.c
new file mode 100644
index 0000000..68acee2
--- /dev/null
+++ b/src/drivers/intel/audio/headset.c
@@ -0,0 +1,60 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright 2015 Google, Inc.
+ *
+ * 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 <drivers/audio.h>
+#include <console/console.h>
+
+/* The same DSP firmwware settings are used for both the capture and
+ * render endpoints. */
+int nhlt_soc_add_headset(struct nhlt *nhlt, const struct nhlt_format_config *headset_cfg, int fmt_size, struct nhlt_tdm_config *tdm_config, int hwlink)
+{
+ struct nhlt_endpoint *endp;
+ /* The headphone codec has headphones and a mic. Both the capture and
+ * render endpoints occupy the same virtual slot. */
+ const void *fmt_cfg = headset_cfg;
+ size_t fmt_sz = fmt_size;
+
+ /* Render Endpoint */
+ endp = nhlt_soc_add_endpoint(nhlt, hwlink, AUDIO_DEV_I2S,
+ NHLT_DIR_RENDER);
+ if (endp == NULL)
+ return -1;
+
+ if(tdm_config != NULL){
+ if (nhlt_endpoint_append_config(endp, tdm_config, 1))
+ return -1;
+ }
+
+ if (nhlt_endpoint_add_formats(endp, fmt_cfg, fmt_sz))
+ return -1;
+
+ /* Capture Endpoint */
+ endp = nhlt_soc_add_endpoint(nhlt, hwlink, AUDIO_DEV_I2S,
+ NHLT_DIR_CAPTURE);
+ if (endp == NULL)
+ return -1;
+
+ if(tdm_config != NULL){
+ if (nhlt_endpoint_append_config(endp, &tdm_config, 1))
+ return -1;
+ }
+
+ if (nhlt_endpoint_add_formats(endp, fmt_cfg, fmt_sz))
+ return -1;
+
+ nhlt_next_instance(nhlt, NHLT_LINK_SSP);
+
+ return 0;
+}
diff --git a/src/drivers/intel/audio/include/drivers/audio.h b/src/drivers/intel/audio/include/drivers/audio.h
new file mode 100644
index 0000000..caf1edc
--- /dev/null
+++ b/src/drivers/intel/audio/include/drivers/audio.h
@@ -0,0 +1,59 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright 2015 Google, Inc.
+ *
+ * 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.
+ */
+
+#ifndef _DRIVERS_AUDIO_H_
+#define _DRIVERS_AUDIO_H_
+
+#include <nhlt.h>
+
+/*
+ * Skylake NHLT device and hardware link types. These values are to be used
+ * with nhlt_soc_add_endpoint().
+ */
+
+enum {
+ AUDIO_LINK_SSP0,
+ AUDIO_LINK_SSP1,
+ AUDIO_LINK_SSP2, /* Only Bluetooth supported on SSP2. */
+ AUDIO_LINK_SSP3,
+ AUDIO_LINK_SSP4,
+ AUDIO_LINK_SSP5,
+ AUDIO_LINK_DMIC,
+};
+
+enum {
+ AUDIO_DEV_I2S,
+ AUDIO_DEV_DMIC,
+ AUDIO_DEV_BT,
+};
+
+/*
+ * Add a dmic array composed of the provided number of channels.
+ * Returns 0 on success, < 0 on error.
+ */
+int nhlt_soc_add_dmic_array(struct nhlt *nhlt, const struct nhlt_format_config *dmic_ch_config, int cfg_size, int num_channels);
+
+/*
+ * Add headset codec on provided SSP link. Return 0 on succes, < 0 on error.
+ */
+int nhlt_soc_add_headset(struct nhlt *nhlt, const struct nhlt_format_config *headset_cfg, int cfg_size, struct nhlt_tdm_config *tdm_config, int hwlink);
+
+/*
+ * Add speaker amplifier in stereo configuration on provide SSP link.
+ * Return 0 on success, < 0 on error.
+ */
+int nhlt_soc_add_speaker(struct nhlt *nhlt, const struct nhlt_format_config *speaker_cfg, int cfg_size, struct nhlt_tdm_config *tdm_config, int hwlink);
+
+#endif
diff --git a/src/drivers/intel/audio/nhlt.c b/src/drivers/intel/audio/nhlt.c
new file mode 100644
index 0000000..0f8e6e1
--- /dev/null
+++ b/src/drivers/intel/audio/nhlt.c
@@ -0,0 +1,95 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright 2015 Google, Inc.
+ *
+ * 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 <cbmem.h>
+#include <soc/acpi.h>
+#include <drivers/audio.h>
+
+#define NHLT_VID 0x8086
+#define NHLT_DID_DMIC 0xae20
+#define NHLT_DID_BT 0xae30
+#define NHLT_DID_SSP 0xae34
+
+struct nhlt_endpoint *nhlt_soc_add_endpoint(struct nhlt *nhlt, int soc_hwintf,
+ int soc_devtype, int dir)
+{
+ int nhlt_link_type;
+ int nhlt_dev_type;
+ uint16_t did;
+ struct nhlt_endpoint *endp;
+
+ /* Check link type and device type. */
+ switch (soc_hwintf) {
+ case AUDIO_LINK_SSP0:
+ case AUDIO_LINK_SSP1:
+ case AUDIO_LINK_SSP5:
+ case AUDIO_LINK_SSP2:
+ nhlt_link_type = NHLT_LINK_SSP;
+ break;
+ case AUDIO_LINK_DMIC:
+ /* Only DMIC devices on DMIC links. */
+ if (soc_devtype != AUDIO_DEV_DMIC)
+ return NULL;
+ nhlt_link_type = NHLT_LINK_PDM;
+ break;
+ default:
+ return NULL;
+ }
+
+ switch (soc_devtype) {
+ case AUDIO_DEV_I2S:
+ nhlt_dev_type = NHLT_SSP_DEV_I2S;
+ did = NHLT_DID_SSP;
+ break;
+ case AUDIO_DEV_DMIC:
+ nhlt_dev_type = NHLT_PDM_DEV;
+ did = NHLT_DID_DMIC;
+ break;
+ case AUDIO_DEV_BT:
+ nhlt_dev_type = NHLT_SSP_DEV_BT;
+ did = NHLT_DID_BT;
+ break;
+ default:
+ return NULL;
+ }
+
+ endp = nhlt_add_endpoint(nhlt, nhlt_link_type, nhlt_dev_type, dir,
+ NHLT_VID, did);
+
+ if (endp == NULL)
+ return NULL;
+
+ /* Virtual bus id of SSP links are the hardware port ids proper. */
+ if (nhlt_link_type == NHLT_LINK_SSP)
+ endp->virtual_bus_id = soc_hwintf;
+
+ return endp;
+}
+
+uintptr_t nhlt_soc_serialize(struct nhlt *nhlt, uintptr_t acpi_addr)
+{
+ struct global_nvs_t *gnvs;
+
+ gnvs = cbmem_find(CBMEM_ID_ACPI_GNVS);
+
+ if (gnvs == NULL)
+ return acpi_addr;
+
+ /* Update NHLT GNVS Data */
+ gnvs->nhla = (uintptr_t)acpi_addr;
+ gnvs->nhll = nhlt_current_size(nhlt);
+
+ return nhlt_serialize(nhlt, acpi_addr);
+}
diff --git a/src/drivers/intel/audio/speaker.c b/src/drivers/intel/audio/speaker.c
new file mode 100644
index 0000000..63dba66
--- /dev/null
+++ b/src/drivers/intel/audio/speaker.c
@@ -0,0 +1,40 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright 2015 Google, Inc.
+ *
+ * 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 <drivers/audio.h>
+
+int nhlt_soc_add_speaker(struct nhlt *nhlt, const struct nhlt_format_config *speaker_cfg, int fmt_size, struct nhlt_tdm_config *tdm_config, int hwlink)
+{
+ struct nhlt_endpoint *endp;
+
+ /* Render Endpoint */
+ endp = nhlt_soc_add_endpoint(nhlt, hwlink, AUDIO_DEV_I2S,
+ NHLT_DIR_RENDER);
+
+ if (endp == NULL)
+ return -1;
+
+ if(tdm_config != NULL){
+ if (nhlt_endpoint_append_config(endp, &tdm_config, 1))
+ return -1;
+ }
+
+ if (nhlt_endpoint_add_formats(endp, speaker_cfg, fmt_size))
+ return -1;
+
+ nhlt_next_instance(nhlt, NHLT_LINK_SSP);
+
+ return 0;
+}