Naveen Manohar would like Rizwan Qureshi to review this change.

View Change

mb/google/poppy/variants/nautilus: add nhlt support

The use of a NHLT table is required to make audio work
on the kabylake SoCs employing the internal DSP. The table
describes the audo endpoints (render vs capture) along with
their supported formats.

Nautilus board uses Dialog da7219 headset codec,
Select the appropriate NHLT blob to be packaged in CBFS.
Also generate the required ACPI NHLT table for codec
and the supported topology in nautilus.

BUG=b:68686020
TEST=With the required driver support in kernel verify that
the Audio plays on headset and recording on headset mic.

Change-Id: I27356a0f1d27cb2190f1ebd141720f3adca4c602
Signed-off-by: Naveen Manohar <naveen.m@intel.com>
Signed-off-by: Rizwan Qureshi <rizwan.qureshi@intel.com>
Signed-off-by: Shruthi Sudhakar <shruthi.sudhakar@intel.com>
---
M src/mainboard/google/poppy/Kconfig
M src/mainboard/google/poppy/variants/baseboard/nhlt.c
M src/soc/intel/skylake/Kconfig
M src/soc/intel/skylake/include/soc/nhlt.h
M src/soc/intel/skylake/nhlt/Makefile.inc
A src/soc/intel/skylake/nhlt/da7219.c
6 files changed, 93 insertions(+), 0 deletions(-)

git pull ssh://review.coreboot.org:29418/coreboot refs/changes/65/22265/1
diff --git a/src/mainboard/google/poppy/Kconfig b/src/mainboard/google/poppy/Kconfig
index ceaf7eb..96fe2ed 100644
--- a/src/mainboard/google/poppy/Kconfig
+++ b/src/mainboard/google/poppy/Kconfig
@@ -56,8 +56,10 @@

config INCLUDE_NHLT_BLOBS_NAUTILUS
bool "Include blobs for nautilus audio."
+ default y if BOARD_GOOGLE_NAUTILUS
select NHLT_DMIC_2CH
select NHLT_DMIC_4CH
+ select NHLT_DA7219

config MAINBOARD_DIR
string
diff --git a/src/mainboard/google/poppy/variants/baseboard/nhlt.c b/src/mainboard/google/poppy/variants/baseboard/nhlt.c
index 81557e4..9fb6ad9 100644
--- a/src/mainboard/google/poppy/variants/baseboard/nhlt.c
+++ b/src/mainboard/google/poppy/variants/baseboard/nhlt.c
@@ -28,6 +28,10 @@
if (nhlt_soc_add_dmic_array(nhlt, 4))
printk(BIOS_ERR, "Couldn't add 4CH DMIC arrays.\n");

+ /* Dialog DA7219 Headset codec. */
+ if (nhlt_soc_add_da7219(nhlt, AUDIO_LINK_SSP1))
+ printk(BIOS_ERR, "Couldn't add Dialog DA7219.\n");
+
/* Maxim MAX98927 Smart Amps for left and right channel */
if (nhlt_soc_add_max98927(nhlt, AUDIO_LINK_SSP0))
printk(BIOS_ERR, "Couldn't add Maxim MAX98927\n");
diff --git a/src/soc/intel/skylake/Kconfig b/src/soc/intel/skylake/Kconfig
index f830f54..f943170 100644
--- a/src/soc/intel/skylake/Kconfig
+++ b/src/soc/intel/skylake/Kconfig
@@ -272,6 +272,12 @@
help
Include DSP firmware settings for max98927 amplifier.

+config NHLT_DA7219
+ bool
+ default n
+ help
+ Include DSP firmware settings for DA7219 headset codec.
+
choice
prompt "Cache-as-ram implementation"
default CAR_NEM_ENHANCED
diff --git a/src/soc/intel/skylake/include/soc/nhlt.h b/src/soc/intel/skylake/include/soc/nhlt.h
index d3e4568..1af27e8 100644
--- a/src/soc/intel/skylake/include/soc/nhlt.h
+++ b/src/soc/intel/skylake/include/soc/nhlt.h
@@ -77,4 +77,10 @@
*/
int nhlt_soc_add_max98927(struct nhlt *nhlt, int hwlink);

+/*
+ * Add da7219 headset codec on provided SSP link. Return 0 on success, < 0
+ * on error.
+ */
+int nhlt_soc_add_da7219(struct nhlt *nhlt, int hwlink);
+
#endif
diff --git a/src/soc/intel/skylake/nhlt/Makefile.inc b/src/soc/intel/skylake/nhlt/Makefile.inc
index 35b2829..9c9b4c8 100644
--- a/src/soc/intel/skylake/nhlt/Makefile.inc
+++ b/src/soc/intel/skylake/nhlt/Makefile.inc
@@ -5,6 +5,7 @@
ramstage-y += rt5514.c
ramstage-y += rt5663.c
ramstage-y += max98927.c
+ramstage-y += da7219.c

# DSP firmware settings files.
ifeq ($(CONFIG_SOC_INTEL_KABYLAKE),y)
@@ -25,6 +26,7 @@
RT5663 = rt5663-2ch-48khz-24b.bin
SSM4567_RENDER = ssm4567-render-2ch-48khz-24b.bin
SSM4567_CAPTURE = ssm4567-capture-4ch-48khz-32b.bin
+DA7219_RENDER_CAPTURE = dialog-2ch-48khz-24b.bin

cbfs-files-$(CONFIG_NHLT_DMIC_2CH) += $(DMIC_2CH_48KHZ_16B)
$(DMIC_2CH_48KHZ_16B)-file := $(NHLT_BLOB_PATH)/$(DMIC_2CH_48KHZ_16B)
@@ -73,3 +75,7 @@
cbfs-files-$(CONFIG_NHLT_MAX98927) += $(MAX98927_RENDER_24B)
$(MAX98927_RENDER_24B)-file := $(NHLT_BLOB_PATH)/$(MAX98927_RENDER_24B)
$(MAX98927_RENDER_24B)-type := raw
+
+cbfs-files-$(CONFIG_NHLT_DA7219) += $(DA7219_RENDER_CAPTURE)
+$(DA7219_RENDER_CAPTURE)-file := $(NHLT_BLOB_PATH)/$(DA7219_RENDER_CAPTURE)
+$(DA7219_RENDER_CAPTURE)-type := raw
diff --git a/src/soc/intel/skylake/nhlt/da7219.c b/src/soc/intel/skylake/nhlt/da7219.c
new file mode 100644
index 0000000..6aa66c7
--- /dev/null
+++ b/src/soc/intel/skylake/nhlt/da7219.c
@@ -0,0 +1,69 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2017 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_tdm_config tdm_config = {
+ .virtual_slot = 0,
+ .config_type = NHLT_TDM_BASIC,
+};
+
+static const struct nhlt_format_config da7219_formats[] = {
+ /* 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_endp_descriptor da7219_descriptors[] = {
+ /* Render Endpoint */
+ {
+ .link = NHLT_LINK_SSP,
+ .device = NHLT_SSP_DEV_I2S,
+ .direction = NHLT_DIR_RENDER,
+ .vid = NHLT_VID,
+ .did = NHLT_DID_SSP,
+ .cfg = &tdm_config,
+ .cfg_size = sizeof(tdm_config),
+ .formats = da7219_formats,
+ .num_formats = ARRAY_SIZE(da7219_formats),
+ },
+ /* Capture Endpoint */
+ {
+ .link = NHLT_LINK_SSP,
+ .device = NHLT_SSP_DEV_I2S,
+ .direction = NHLT_DIR_CAPTURE,
+ .vid = NHLT_VID,
+ .did = NHLT_DID_SSP,
+ .cfg = &tdm_config,
+ .cfg_size = sizeof(tdm_config),
+ .formats = da7219_formats,
+ .num_formats = ARRAY_SIZE(da7219_formats),
+ },
+};
+
+int nhlt_soc_add_da7219(struct nhlt *nhlt, int hwlink)
+{
+ /* Virtual bus id of SSP links are the hardware port ids proper. */
+ return nhlt_add_ssp_endpoints(nhlt, hwlink, da7219_descriptors,
+ ARRAY_SIZE(da7219_descriptors));
+}

To view, visit change 22265. To unsubscribe, visit settings.

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I27356a0f1d27cb2190f1ebd141720f3adca4c602
Gerrit-Change-Number: 22265
Gerrit-PatchSet: 1
Gerrit-Owner: Naveen Manohar <naveen.m@intel.com>
Gerrit-Reviewer: Rizwan Qureshi <rizwan.qureshi@intel.com>