[Sound-open-firmware] [PATCH 5/7] [v3]DMIC: Changes to CNL platform
Seppo Ingalsuo
seppo.ingalsuo at linux.intel.com
Fri May 11 16:03:06 CEST 2018
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo at linux.intel.com>
---
src/platform/cannonlake/dai.c | 57 +++++++++++++++++++++++
src/platform/cannonlake/include/platform/memory.h | 8 +++-
src/platform/cannonlake/platform.c | 11 +++++
3 files changed, 74 insertions(+), 2 deletions(-)
diff --git a/src/platform/cannonlake/dai.c b/src/platform/cannonlake/dai.c
index 6949add..f195eca 100644
--- a/src/platform/cannonlake/dai.c
+++ b/src/platform/cannonlake/dai.c
@@ -33,6 +33,7 @@
#include <sof/sof.h>
#include <sof/dai.h>
#include <sof/ssp.h>
+#include <sof/dmic.h>
#include <sof/stream.h>
#include <sof/audio/component.h>
#include <platform/memory.h>
@@ -95,6 +96,53 @@ static struct dai ssp[] = {
.ops = &ssp_ops,
},};
+#if defined CONFIG_DMIC
+static struct dai dmic[2] = {
+ /* Testing idea if DMIC FIFOs A and B to access the same microphones
+ * with two different sample rate and PCM format could be presented
+ * similarly as SSP0..N. The difference however is that the DMIC
+ * programming is global and not per FIFO.
+ */
+
+ /* Primary FIFO A */
+ {
+ .type = SOF_DAI_INTEL_DMIC,
+ .index = 0,
+ .plat_data = {
+ .base = DMIC_BASE,
+ .irq = IRQ_EXT_DMIC_LVL5(0),
+ .fifo[SOF_IPC_STREAM_PLAYBACK] = {
+ .offset = 0, /* No playback */
+ .handshake = 0,
+ },
+ .fifo[SOF_IPC_STREAM_CAPTURE] = {
+ .offset = DMIC_BASE + OUTDATA0,
+ .handshake = DMA_HANDSHAKE_DMIC_CH0,
+ }
+ },
+ .ops = &dmic_ops,
+ },
+ /* Secondary FIFO B */
+ {
+ .type = SOF_DAI_INTEL_DMIC,
+ .index = 1,
+ .plat_data = {
+ .base = DMIC_BASE,
+ .irq = IRQ_EXT_DMIC_LVL5(0),
+ .fifo[SOF_IPC_STREAM_PLAYBACK] = {
+ .offset = 0, /* No playback */
+ .handshake = 0,
+ },
+ .fifo[SOF_IPC_STREAM_CAPTURE] = {
+ .offset = DMIC_BASE + OUTDATA1,
+ .handshake = DMA_HANDSHAKE_DMIC_CH1,
+ }
+ },
+ .ops = &dmic_ops,
+ }
+};
+#endif
+
struct dai *dai_get(uint32_t type, uint32_t index)
{
int i;
@@ -106,5 +154,14 @@ struct dai *dai_get(uint32_t type, uint32_t index)
}
}
+#if defined CONFIG_DMIC
+ if (type == SOF_DAI_INTEL_DMIC) {
+ for (i = 0; i < ARRAY_SIZE(dmic); i++) {
+ if (dmic[i].type == type && dmic[i].index == index)
+ return &dmic[i];
+ }
+ }
+#endif
+
return NULL;
}
diff --git a/src/platform/cannonlake/include/platform/memory.h b/src/platform/cannonlake/include/platform/memory.h
index 67f574a..244dd25 100644
--- a/src/platform/cannonlake/include/platform/memory.h
+++ b/src/platform/cannonlake/include/platform/memory.h
@@ -108,8 +108,8 @@
#define L2_HP_SRAM_TLB_BASE 0x00003000
/* DMICs */
-#define DMIC_BASE 0x00004000
-#define DMIC_SIZE 0x00004000
+#define DMIC_BASE 0x00010000
+#define DMIC_SIZE 0x00008000
/* SSP */
#define SSP_BASE(x) (0x00077000 + x * SSP_SIZE)
@@ -240,7 +240,11 @@
#define SOF_TEXT_SIZE 0x18000
/* initialized data */
+#if defined CONFIG_DMIC
+#define SOF_DATA_SIZE 0x1b000
+#else
#define SOF_DATA_SIZE 0x19000
+#endif
/* bss data */
#define SOF_BSS_DATA_SIZE 0x8000
diff --git a/src/platform/cannonlake/platform.c b/src/platform/cannonlake/platform.c
index 9c56047..2e85088 100644
--- a/src/platform/cannonlake/platform.c
+++ b/src/platform/cannonlake/platform.c
@@ -210,6 +210,7 @@ int platform_init(struct sof *sof)
{
struct dma *dmac;
struct dai *ssp;
+ struct dai *dmic0;
int i;
trace_point(TRACE_BOOT_PLATFORM_ENTRY);
@@ -289,6 +290,16 @@ int platform_init(struct sof *sof)
dai_probe(ssp);
}
+ /* Init DMIC. Note that the two PDM controllers and four microphones
+ * supported max. those are available in platform are handled by dmic0.
+ */
+ trace_point(TRACE_BOOT_PLATFORM_DMIC);
+ dmic0 = dai_get(SOF_DAI_INTEL_DMIC, 0);
+ if (!dmic0)
+ return -ENODEV;
+
+ dai_probe(dmic0);
+
/* Initialize DMA for Trace*/
dma_trace_init_complete(sof->dmat);
--
2.14.1
More information about the Sound-open-firmware
mailing list