Skip to content

Commit a0a4da4

Browse files
SOF: fix imx8m compilation with IPC4
Signed-off-by: Iuliana Prodan <[email protected]>
1 parent 69d2f4b commit a0a4da4

File tree

11 files changed

+94
-2
lines changed

11 files changed

+94
-2
lines changed

src/audio/base_fw.c

+4
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,13 @@ static int basefw_hw_config(uint32_t *data_offset, char *data)
141141
tlv_value_uint32_set(tuple, IPC4_HP_EBB_COUNT_HW_CFG, PLATFORM_HPSRAM_EBB_COUNT);
142142

143143
tuple = tlv_next(tuple);
144+
#ifdef CONFIG_IMX
145+
value = DAI_NUM_SAI_BASE;
146+
#else
144147
/* 2 DMIC dais */
145148
value = DAI_NUM_SSP_BASE + DAI_NUM_HDA_IN + DAI_NUM_HDA_OUT +
146149
DAI_NUM_ALH_BI_DIR_LINKS + 2;
150+
#endif
147151
tlv_value_uint32_set(tuple, IPC4_GATEWAY_COUNT_HW_CFG, value);
148152

149153
tuple = tlv_next(tuple);

src/audio/copier/copier_dai.c

+2
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ int copier_dai_create(struct comp_dev *dev, struct copier_data *cd,
186186
dai.is_config_blob = true;
187187
type = ipc4_gtw_alh;
188188

189+
#ifndef CONFIG_IMX
189190
/* copier
190191
* {
191192
* gtw_cfg
@@ -225,6 +226,7 @@ int copier_dai_create(struct comp_dev *dev, struct copier_data *cd,
225226
} else {
226227
dai_index[dai_count - 1] = IPC4_ALH_DAI_INDEX(node_id.f.v_index);
227228
}
229+
#endif
228230

229231
break;
230232
case ipc4_dmic_link_input_class:

src/audio/dai-legacy.c

+13
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,19 @@ int dai_assign_group(struct dai_data *dd, struct comp_dev *dev, uint32_t group_i
9090
return 0;
9191
}
9292
#endif
93+
94+
int dai_zephyr_multi_endpoint_copy(struct dai_data **dd, struct comp_dev *dev,
95+
struct comp_buffer *multi_endpoint_buffer,
96+
int num_endpoints)
97+
{
98+
return 0;
99+
}
100+
101+
int dai_zephyr_unbind(struct dai_data *dd, struct comp_dev *dev, void *data)
102+
{
103+
return 0;
104+
}
105+
93106
/* this is called by DMA driver every time descriptor has completed */
94107
static void dai_dma_cb(void *arg, enum notify_id type, void *data)
95108
{

src/include/sof/drivers/alh.h

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
#define __SOF_DRIVERS_ALH__
99

1010
#include <ipc/dai-intel.h>
11-
#include <platform/drivers/alh.h>
1211
#include <sof/lib/dai.h>
1312

1413
struct alh_pdata {

src/ipc/ipc4/dai.c

+18
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include <sof/audio/ipc-config.h>
1212
#include <sof/common.h>
1313
#include <sof/drivers/alh.h>
14+
#include <sof/drivers/edma.h>
1415
#include <rtos/idc.h>
1516
#include <rtos/alloc.h>
1617
#include <sof/lib/dai.h>
@@ -71,6 +72,7 @@ int dai_config_dma_channel(struct dai_data *dd, struct comp_dev *dev, const void
7172
const struct ipc4_copier_module_cfg *copier_cfg = spec_config;
7273
struct ipc_config_dai *dai = &dd->ipc_config;
7374
int channel;
75+
int handshake;
7476

7577
switch (dai->type) {
7678
case SOF_DAI_INTEL_SSP:
@@ -91,6 +93,17 @@ int dai_config_dma_channel(struct dai_data *dd, struct comp_dev *dev, const void
9193
*/
9294
channel = 0;
9395
break;
96+
case SOF_DAI_IMX_SAI:
97+
COMPILER_FALLTHROUGH;
98+
case SOF_DAI_IMX_ESAI:
99+
handshake = dai_get_handshake(dd->dai, dai->direction,
100+
dd->stream_id);
101+
channel = EDMA_HS_GET_CHAN(handshake);
102+
break;
103+
case SOF_DAI_IMX_MICFIL:
104+
channel = dai_get_handshake(dd->dai, dai->direction,
105+
dd->stream_id);
106+
break;
94107
default:
95108
/* other types of DAIs not handled for now */
96109
comp_err(dev, "dai_config_dma_channel(): Unknown dai type %d", dai->type);
@@ -157,6 +170,11 @@ int ipc_dai_data_config(struct dai_data *dd, struct comp_dev *dev)
157170
dev->ipc_config.frame_fmt, dd->stream_id);
158171

159172
break;
173+
case SOF_DAI_IMX_MICFIL:
174+
case SOF_DAI_IMX_SAI:
175+
case SOF_DAI_IMX_ESAI:
176+
dd->config.burst_elems = dai_get_fifo_depth(dd->dai, dai->direction);
177+
break;
160178
default:
161179
/* other types of DAIs not handled for now */
162180
comp_warn(dev, "dai_data_config(): Unknown dai type %d", dai->type);

src/ipc/ipc4/helper.c

+2
Original file line numberDiff line numberDiff line change
@@ -661,10 +661,12 @@ int ipc_comp_disconnect(struct ipc *ipc, ipc_pipe_comp_connect *_connect)
661661
*/
662662
static inline int process_dma_index(uint32_t dma_id, uint32_t *dir, uint32_t *chan)
663663
{
664+
#ifndef CONFIG_IMX
664665
if (dma_id > DAI_NUM_HDA_OUT + DAI_NUM_HDA_IN) {
665666
tr_err(&ipc_tr, "dma id %d is out of range", dma_id);
666667
return IPC4_INVALID_NODE_ID;
667668
}
669+
#endif
668670

669671
if (dma_id >= PLATFORM_MAX_DMA_CHAN) {
670672
*dir = SOF_IPC_STREAM_CAPTURE;

src/platform/imx8m/include/platform/lib/clk.h

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ struct sof;
1818

1919
#define CPU_DEFAULT_IDX 0
2020

21+
#define CPU_LOWEST_FREQ_IDX CPU_DEFAULT_IDX
22+
2123
#define CLK_DEFAULT_CPU_HZ 800000000
2224
#define CLK_MAX_CPU_HZ 800000000
2325

src/platform/imx8m/include/platform/lib/dai.h

+3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
#ifndef __PLATFORM_LIB_DAI_H__
1111
#define __PLATFORM_LIB_DAI_H__
1212

13+
/** \brief Number of 'base' SAI ports available */
14+
#define DAI_NUM_SAI_BASE 6
15+
1316
#endif /* __PLATFORM_LIB_DAI_H__ */
1417

1518
#else

src/platform/imx8m/include/platform/lib/mailbox.h

+38-1
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,11 @@
1414
#include <stddef.h>
1515
#include <stdint.h>
1616

17+
#include <rtos/panic.h>
18+
#include <rtos/string.h>
19+
1720
/*
18-
* The Window Region on i.MX8 SRAM is organised like this :-
21+
* The Window Region on i.MX8 SRAM is organized like this :-
1922
* +--------------------------------------------------------------------------+
2023
* | Offset | Region | Size |
2124
* +---------------------+----------------+-----------------------------------+
@@ -53,6 +56,9 @@
5356
#define MAILBOX_STREAM_BASE SRAM_STREAM_BASE
5457
#define MAILBOX_STREAM_OFFSET SRAM_STREAM_OFFSET
5558

59+
#define MAILBOX_SW_REG_SIZE MAILBOX_DEBUG_SIZE
60+
#define MAILBOX_SW_REG_BASE MAILBOX_DEBUG_BASE
61+
5662
static inline void mailbox_sw_reg_write(size_t offset, uint32_t src)
5763
{
5864
volatile uint32_t *ptr;
@@ -61,6 +67,37 @@ static inline void mailbox_sw_reg_write(size_t offset, uint32_t src)
6167
*ptr = src;
6268
}
6369

70+
static inline uint32_t mailbox_sw_reg_read(size_t offset)
71+
{
72+
volatile uint32_t *ptr;
73+
volatile uint32_t __sparse_cache *ptr_c;
74+
75+
ptr_c = (volatile uint32_t __sparse_cache *)(MAILBOX_SW_REG_BASE + offset);
76+
ptr = cache_to_uncache((uint32_t __sparse_cache *)ptr_c);
77+
78+
return *ptr;
79+
}
80+
81+
static inline uint64_t mailbox_sw_reg_read64(size_t offset)
82+
{
83+
volatile uint64_t *ptr;
84+
volatile uint64_t __sparse_cache *ptr_c;
85+
86+
ptr_c = (volatile uint64_t __sparse_cache *)(MAILBOX_SW_REG_BASE + offset);
87+
ptr = cache_to_uncache((uint64_t __sparse_cache *)ptr_c);
88+
89+
return *ptr;
90+
}
91+
92+
static inline void mailbox_sw_regs_write(size_t offset, const void *src, size_t bytes)
93+
{
94+
int regs_write_err __unused = memcpy_s((void *)(MAILBOX_SW_REG_BASE + offset),
95+
MAILBOX_SW_REG_SIZE - offset, src, bytes);
96+
97+
assert(!regs_write_err);
98+
dcache_writeback_region((__sparse_force void __sparse_cache *)(MAILBOX_SW_REG_BASE +
99+
offset), bytes);
100+
}
64101
#endif /* __PLATFORM_LIB_MAILBOX_H__ */
65102

66103
#else

src/platform/imx8m/include/platform/lib/memory.h

+9
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,15 @@
1515
/* data cache line alignment */
1616
#define PLATFORM_DCACHE_ALIGN 32
1717

18+
/* Size of a single memory bank (EBB) in bytes */
19+
#define SRAM_BANK_SIZE (64 * 1024)
20+
/* Number of memory banks (EBB) */
21+
#define EBB_BANKS_IN_SEGMENT 32
22+
/* Number of High Power SRAM memory banks manageable by DSP */
23+
#define PLATFORM_HPSRAM_EBB_COUNT 0
24+
/* Number of Low Power SRAM memory banks manageable by DSP */
25+
#define PLATFORM_LPSRAM_EBB_COUNT 0
26+
1827
/* physical DSP addresses */
1928

2029
#define IRAM_BASE 0x3b6f8000

src/platform/imx8m/include/platform/platform.h

+3
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
struct ll_schedule_domain;
2121
struct timer;
2222

23+
/* Version of hw implemented by FW (from ROMInfo) */
24+
#define HW_CFG_VERSION 0
25+
2326
#define PLATFORM_DEFAULT_CLOCK CLK_CPU(0)
2427
#define LPSRAM_SIZE 16384
2528

0 commit comments

Comments
 (0)