/* SPDX-License-Identifier: GPL-2.0 */ /* * Copyright (c) 2019 MediaTek Inc. * Author: Michael Hsiao */ /****************************************************************************** * * * Filename: * --------- * AudDrv_Common.h * * Project: * -------- * Audio Common function header file * * Description: * ------------ * Audio register * * Author: * ------- * Chipeng Chang (MTK02308) * *--------------------------------------------------------------------------- * * **************************************************************************** */ #ifndef AUDIO_GLOBAL_H #define AUDIO_GLOBAL_H #include "mtk-auddrv-afe.h" #include "mtk-auddrv-afe.h" #include "mtk-auddrv-clk.h" #include "mtk-auddrv-def.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /* wakelock is replace by pm_wakeup*/ #include #include //#define DL1_DEBUG_LOG //#define DL2_DEBUG_LOG //#define DL3_DEBUG_LOG //#define AFE_CONTROL_DEBUG_LOG /* TODO: KC: don't declare unnecessary typdef, just use it */ #define DL_ABNORMAL_CONTROL_MAX (5) typedef uint8_t kal_uint8; typedef int8_t kal_int8; typedef uint32_t kal_uint32; typedef int32_t kal_int32; typedef uint64_t kal_uint64; typedef int64_t kal_int64; struct afe_block_t { kal_uint32 pucPhysBufAddr; kal_uint8 *pucVirtBufAddr; kal_int32 u4BufferSize; kal_int32 u4DataRemained; kal_uint32 u4SampleNumMask; /* sample number mask */ kal_uint32 u4SamplesPerInt; /* number of samples to play before * interrupting */ kal_int32 u4WriteIdx; /* Previous Write Index. */ kal_int32 u4DMAReadIdx; /* Previous DMA Read Index. */ kal_uint32 u4MaxCopySize; kal_uint32 u4fsyncflag; kal_uint32 uResetFlag; }; struct substream_list { kal_uint32 u4MaxCopySize; struct snd_pcm_substream *substream; struct substream_list *next; }; struct afe_mem_control_t { struct file *flip; struct substream_list *substreamL; struct afe_block_t rBlock; kal_uint32 MemIfNum; bool interruptTrigger; spinlock_t substream_lock; bool mWaitForIRQ; bool mAssignDRAM; }; struct pcm_afe_info { struct afe_block_t *mAfeBlock; struct snd_pcm_substream *substream; }; struct afe_dl_abnormal_control_t { kal_int32 u4BufferSize[DL_ABNORMAL_CONTROL_MAX]; kal_int32 u4DataRemained[DL_ABNORMAL_CONTROL_MAX]; kal_int32 u4WriteIdx[DL_ABNORMAL_CONTROL_MAX]; /* Previous Write Index. */ kal_int32 u4DMAReadIdx[DL_ABNORMAL_CONTROL_MAX]; /* Previous DMA Read * Index. */ kal_int32 u4ConsumedBytes[DL_ABNORMAL_CONTROL_MAX]; kal_int32 u4HwMemoryIndex[DL_ABNORMAL_CONTROL_MAX]; kal_int32 pucPhysBufAddr[DL_ABNORMAL_CONTROL_MAX]; kal_int32 u4UnderflowCnt; kal_uint32 MemIfNum[DL_ABNORMAL_CONTROL_MAX]; unsigned long long IrqLastTimeNs[DL_ABNORMAL_CONTROL_MAX]; unsigned long long IrqCurrentTimeNs[DL_ABNORMAL_CONTROL_MAX]; unsigned long long IrqIntervalNs[DL_ABNORMAL_CONTROL_MAX]; kal_uint32 IrqIntervalLimitMs[DL_ABNORMAL_CONTROL_MAX]; bool IrqDelayCnt; }; struct mtk_dai { bool enable; uint32_t sample_rate; }; struct afe_dl_isr_copy_t { kal_int8 *pBufferBase; kal_int8 *pBufferIndx; kal_uint32 u4BufferSize; kal_uint32 u4BufferSizeMax; kal_int32 u4IsrConsumeSize; }; struct aud_reg_string { char *regname; unsigned int address; }; #endif