11// SPDX-License-Identifier: BSD-3-Clause
22// Copyright(c) 2024 Google LLC. All rights reserved.
33// Author: Andy Ross <andyross@google.com>
4+ #ifndef CONFIG_ZEPHYR_NATIVE_DRIVERS
45#include <sof/lib/dai-legacy.h>
6+ #endif
57#include <ipc/dai.h>
68#include <sof/drivers/afe-drv.h>
9+ #include <stdbool.h>
10+ #include <errno.h>
11+ #include <zephyr/devicetree.h>
712
813/* The legacy driver stores register addresses as an offset from an
914 * arbitrary base address (which is not actually a unified block of
@@ -158,6 +163,7 @@ static struct mtk_base_memif_data afe_memifs[] = {
158163 DT_FOREACH_STATUS_OKAY (mediatek_afe , EMPTY_STRUCT )
159164};
160165
166+ #ifndef CONFIG_ZEPHYR_NATIVE_DRIVERS
161167static struct dai mtk_dais [] = {
162168 DT_FOREACH_STATUS_OKAY (mediatek_afe , EMPTY_STRUCT )
163169};
@@ -210,6 +216,7 @@ static const struct dai_info mtk_dai_info = {
210216 .dai_type_array = mtk_dai_types ,
211217 .num_dai_types = ARRAY_SIZE (mtk_dai_types ),
212218};
219+ #endif /* !CONFIG_ZEPHYR_NATIVE_DRIVERS */
213220
214221#if defined(CONFIG_SOC_SERIES_MT818X ) || defined(CONFIG_SOC_MT8195 )
215222static unsigned int mtk_afe2adsp_addr (unsigned int addr )
@@ -324,7 +331,7 @@ struct mtk_base_afe_platform mtk_afe_platform = {
324331 .memif_32bit_supported = 0 ,
325332 .irq_datas = NULL ,
326333 .irqs_size = 0 ,
327- .dais_size = ARRAY_SIZE (mtk_dais ),
334+ .dais_size = ARRAY_SIZE (afes ),
328335 .afe_fs = mtk_afe_fs ,
329336 .irq_fs = mtk_afe_fs_timing ,
330337#if defined(CONFIG_SOC_SERIES_MT818X ) || defined (CONFIG_SOC_MT8195 )
@@ -342,6 +349,7 @@ int mtk_dai_init(struct sof *sof)
342349 afe_memifs [i ].id = i ;
343350 cfg_convert (& afes [i ], & afe_memifs [i ]);
344351
352+ #ifndef CONFIG_ZEPHYR_NATIVE_DRIVERS
345353 /* Also initialize the dais array */
346354 extern const struct dai_driver afe_dai_driver ;
347355
@@ -362,6 +370,7 @@ int mtk_dai_init(struct sof *sof)
362370 int hs = (i << 16 ) | di ;
363371
364372 mtk_dais [di ].plat_data .fifo [0 ].handshake = hs ;
373+ #endif
365374 }
366375
367376 /* DTS stores the direction as a boolean property, but the
@@ -377,7 +386,9 @@ int mtk_dai_init(struct sof *sof)
377386 for (/**/ ; i < ARRAY_SIZE (afes ); i ++ )
378387 __ASSERT_NO_MSG (!afes [i ].downlink );
379388
389+ #ifndef CONFIG_ZEPHYR_NATIVE_DRIVERS
380390 sof -> dai_info = & mtk_dai_info ;
381391 sof -> dma_info = & mtk_dma_info ;
392+ #endif
382393 return 0 ;
383394}
0 commit comments