diff options
author | Inha Song <ideal.song@samsung.com> | 2014-07-11 10:08:43 +0900 |
---|---|---|
committer | Chanho Park <chanho61.park@samsung.com> | 2014-11-18 12:00:20 +0900 |
commit | 3f2823c6dc9fdce0262484b7347b21a4c19d4fa7 (patch) | |
tree | 0eae49592d51e69956983e58c405fd47f6157f7a | |
parent | bf8994cd194d494dfeaf1ffe05d85573d3bf41d8 (diff) | |
download | linux-3.10-3f2823c6dc9fdce0262484b7347b21a4c19d4fa7.tar.gz linux-3.10-3f2823c6dc9fdce0262484b7347b21a4c19d4fa7.tar.bz2 linux-3.10-3f2823c6dc9fdce0262484b7347b21a4c19d4fa7.zip |
ASoC: ymu831: Add Yamaha YMU831 codec support
Signed-off-by: Inha Song <ideal.song@samsung.com>
43 files changed, 71316 insertions, 0 deletions
diff --git a/include/uapi/sound/asound.h b/include/uapi/sound/asound.h index d2fc951ca9b..a595be35d71 100644 --- a/include/uapi/sound/asound.h +++ b/include/uapi/sound/asound.h @@ -94,6 +94,7 @@ enum { SNDRV_HWDEP_IFACE_HDA, /* HD-audio */ SNDRV_HWDEP_IFACE_USB_STREAM, /* direct access to usb stream */ SNDRV_HWDEP_IFACE_MC1N2, /* FIXME */ + SNDRV_HWDEP_IFACE_YAMAHA_YMU831, /* yamaha ymu831 */ /* Don't forget to change the following: */ SNDRV_HWDEP_IFACE_LAST = SNDRV_HWDEP_IFACE_USB_STREAM diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig index 576065fac9e..cb5fa34313c 100644 --- a/sound/soc/codecs/Kconfig +++ b/sound/soc/codecs/Kconfig @@ -125,6 +125,7 @@ config SND_SOC_ALL_CODECS select SND_SOC_WM9705 if SND_SOC_AC97_BUS select SND_SOC_WM9712 if SND_SOC_AC97_BUS select SND_SOC_WM9713 if SND_SOC_AC97_BUS + select SND_SOC_YAMAHA_YMU831 if SPI_MASTER help Normally ASoC codec drivers are only built if a machine driver which uses them is also built since they are only usable with a machine @@ -507,6 +508,7 @@ config SND_SOC_WM9712 config SND_SOC_WM9713 tristate +source "sound/soc/codecs/ymu831/Kconfig" # Amp config SND_SOC_LM4857 tristate diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile index bcbd4a5e746..c656acafba0 100644 --- a/sound/soc/codecs/Makefile +++ b/sound/soc/codecs/Makefile @@ -242,6 +242,7 @@ obj-$(CONFIG_SND_SOC_WM9712) += snd-soc-wm9712.o obj-$(CONFIG_SND_SOC_WM9713) += snd-soc-wm9713.o obj-$(CONFIG_SND_SOC_WM_ADSP) += snd-soc-wm-adsp.o obj-$(CONFIG_SND_SOC_WM_HUBS) += snd-soc-wm-hubs.o +obj-$(CONFIG_SND_SOC_YAMAHA_YMU831) += ymu831/ # Amp obj-$(CONFIG_SND_SOC_MAX9877) += snd-soc-max9877.o diff --git a/sound/soc/codecs/ymu831/Kconfig b/sound/soc/codecs/ymu831/Kconfig new file mode 100644 index 00000000000..0e630511bd7 --- /dev/null +++ b/sound/soc/codecs/ymu831/Kconfig @@ -0,0 +1,9 @@ +config SND_SOC_YAMAHA_YMU831 + tristate "YAMAHA_YMU831 Codec - SPI" + depends on SND_SOC && SPI_MASTER + select SND_HWDEP + +config SND_SOC_YAMAHA_YMU831_DEBUG + bool "YAMAHA_YMU831 verbose debug messages while core driver call" + select SND_DEBUG + depends on SND_SOC_YAMAHA_YMU831 diff --git a/sound/soc/codecs/ymu831/Makefile b/sound/soc/codecs/ymu831/Makefile new file mode 100644 index 00000000000..e56189148f6 --- /dev/null +++ b/sound/soc/codecs/ymu831/Makefile @@ -0,0 +1,17 @@ +snd-soc-yamaha_ymu831-objs := ymu831.o ymu831_dbg.o \ + mcbdspdrv.o \ + mccdspdrv.o \ + mcdevif.o \ + mcdevprof.o \ + mcdriver.o \ + mcedspdrv.o \ + mcfdspdrv.o \ + mcmachdep.o \ + mcpacking.o \ + mcparser.o \ + mcresctrl.o \ + mcservice.o \ + mcdebuglog.o \ + ymu831_dbg_sec.o + +obj-$(CONFIG_SND_SOC_YAMAHA_YMU831) += snd-soc-yamaha_ymu831.o diff --git a/sound/soc/codecs/ymu831/mcbdspdrv.c b/sound/soc/codecs/ymu831/mcbdspdrv.c new file mode 100644 index 00000000000..e362dd6ed6f --- /dev/null +++ b/sound/soc/codecs/ymu831/mcbdspdrv.c @@ -0,0 +1,1965 @@ +/**************************************************************************** + * + * Copyright(c) 2012 Yamaha Corporation. All rights reserved. + * + * Module : mcbdspdrv.c + * + * Description : MC Bdsp Driver + * + * Version : 1.0.0 2012.12.13 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + * + ****************************************************************************/ +#include "mctypedef.h" +#include "mcdevif.h" +#include "mcdefs.h" +#include "mcresctrl.h" +#include "mcbdspdrv.h" +#include "mcservice.h" + + +/* inside definition */ +#define BDSP_STATUS_IDLE (0) +#define BDSP_STATUS_INITED (1) + +#define CHUNK_SIZE (8) + +#define AEC_BDSP_TAG_FWCTRL_B (0x00000C00) +#define FWCTRL_B_SIZE (14) +#define AEC_BDSP_TAG_APP_COEF (0x00000700) +#define APP_COEF_FIX_SIZE (9) +#define AEC_BDSP_TAG_APP_REG (0x00000A00) +#define APP_REG_FIX_SIZE (8) +#define AEC_BDSP_TAG_APP_MASK (0xFFFFFF00) +#define AEC_BDSP_TAG_APPNO_MASK (0x000000FF) + +#define FWCTRL_B_BYPASS (0) +#define FWCTRL_B_AE0_BYP (1) +#define FWCTRL_B_AE1_BYP (2) +#define FWCTRL_B_WIDE (3) +#define FWCTRL_B_HEX (4) +#define FWCTRL_B_EQ3_0A (5) +#define FWCTRL_B_DRC3 (6) +#define FWCTRL_B_DRC_0 (7) +#define FWCTRL_B_EQ3_0B (8) +#define FWCTRL_B_GEN (9) +#define FWCTRL_B_EQ3_1A (10) +#define FWCTRL_B_AGC (11) +#define FWCTRL_B_DRC_1 (12) +#define FWCTRL_B_EQ3_1B (13) + +#define APP_NO_GEN 0 +#define APP_NO_SWAP_0 1 +#define APP_NO_WIDE 2 +#define APP_NO_HEX 3 +#define APP_NO_EQ3_0A 4 +#define APP_NO_DRC3 5 +#define APP_NO_DRC_0 6 +#define APP_NO_EQ3_0B 7 +#define APP_NO_MIX_0 8 +#define APP_NO_SWAP_1 9 +#define APP_NO_EQ3_1A 10 +#define APP_NO_AGC 11 +#define APP_NO_DRC_1 12 +#define APP_NO_EQ3_1B 13 +#define APP_NO_MIX_1 14 + +#define APP_COEF_ADR (0) +#define APP_COEF_SIZE (5) +#define APP_COEF_DATA (9) + +#define APP_REG_FLG (0) +#define APP_REG_FLG_FWCTL0 (0x01) +#define APP_REG_FLG_FWCTL1 (0x02) +#define APP_REG_FLG_FWCTL2 (0x04) +#define APP_REG_FLG_FWCTL3 (0x08) +#define APP_REG_FLG_FWCTL4 (0x10) +#define APP_REG_FLG_FWCTL5 (0x20) +#define APP_REG_FLG_FWCTL6 (0x40) +#define APP_REG_FWCTL0 (1) +#define APP_REG_FWCTL1 (2) +#define APP_REG_FWCTL2 (3) +#define APP_REG_FWCTL3 (4) +#define APP_REG_FWCTL4 (5) +#define APP_REG_FWCTL5 (6) +#define APP_REG_FWCTL6 (7) + +#define COEF_DMA_TRANS (0) +#define COEF_DSP_TRANS (1) +#define COEF_DSP_TRANS_MAX (40) + +#define TARGET_NONE (0x00000000) +#define TARGET_AE0_MASK (0x00003F00) +#define TARGET_AE0_EQ3_0B (0x00002000) +#define TARGET_AE0_DRC_0 (0x00001000) +#define TARGET_AE0_DRC3 (0x00000800) +#define TARGET_AE0_EQ3_0A (0x00000400) +#define TARGET_AE0_HEX (0x00000200) +#define TARGET_AE0_WIDE (0x00000100) +#define TARGET_AE1_MASK (0x0000003C) +#define TARGET_AE1_EQ3_1B (0x00000020) +#define TARGET_AE1_DRC_1 (0x00000010) +#define TARGET_AE1_AGC (0x00000008) +#define TARGET_AE1_EQ3_1A (0x00000004) +#define TARGET_GEN_MASK (0x00008000) +#define TARGET_GEN_GEN (0x00008000) +#define TARGET_BASE_MASK (0xF0000000) +#define TARGET_BASE_SWAP_0 (0x10000000) +#define TARGET_BASE_SWAP_1 (0x20000000) +#define TARGET_BASE_MIX_0 (0x40000000) +#define TARGET_BASE_MIX_1 (0x80000000) + +#define REG_APP_NO_STOP (0) +#define REG_APP_STOP (1) + +#define MULTI_CHUNK_APP_COEF (1) +#define MULTI_CHUNK_APP_REG (2) + +#define RAM_UNIT_SIZE_32 (4UL) +#define RAM_UNIT_SIZE_64 (8UL) +#define DXRAM_RANGE_MIN (0x0UL) +#define DXRAM_RANGE_MAX (0x017FUL) +#define DYRAM_RANGE_MIN (0x0UL) +#define DYRAM_RANGE_MAX (0x01FFUL) + +#define WAIT_NONE (0x00) +#define CROSS_FADE_WAIT (0x01) +#define SIN_OUT_WAIT (0x02) + +#define BDSP_PATH_NORMAL (0) +#define BDSP_PATH_BYPASS (1) +#define BDSP_PATH_DONTCARE (2) + +#define BDSP_BYPASS_FADE_TIME (10000) + +#define BDSP_SIN_CTRL_REG (0) +#define BDSP_SIN_CTRL_GPIO (1) + +#define GEN_SIN_CTL_SEL_ADD (0x001D9) + +/* inside Struct */ + +struct MCDRV_BDSP_AEC_BDSP_INFO { + UINT8 bBDspOnOff; + UINT8 *pbChunkData; + UINT32 dwSize; + UINT8 *pbFwctrlB; + UINT8 bAe0AppOnOff; + UINT8 bAe1AppOnOff; + UINT8 bAppGen; + UINT32 dAppCoefCnt; + UINT8 bCoefTrans; + UINT32 dCoefTarget; + UINT8 bSinCtrlSel; + UINT32 dAppRegCnt; + UINT32 dRegAppStopTarget; + UINT8 bStoppedAppExec0; + UINT8 bStoppedAppExec1; + UINT8 bStoppedSinOut; + UINT8 bStoppedBypass; +}; + +struct MCDRV_BDSP_INFO { + /* state */ + UINT32 dStatus; + UINT8 bDSPBypass; + UINT8 bSinCtrlSel; + /* register */ + UINT8 bDSPCtl; + UINT8 bAppExec0; + UINT8 bAppExec1; + UINT8 bAEBypass; +}; + +static struct MCDRV_BDSP_INFO gsBdspInfo = { + BDSP_STATUS_IDLE, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00 +}; + +/**************************************************************************** + * CreateUINT32 + * + * Description: + * Create UINT32 Value + * Arguments: + * b0 31-24bit value + * b1 23-16bit value + * b2 15-8bit value + * b3 7-0bit value + * Return: + * UINT32 Value + * + ****************************************************************************/ +static UINT32 CreateUINT32(UINT8 b0, UINT8 b1, UINT8 b2, UINT8 b3) +{ + return ((UINT32)b0 << 24) | ((UINT32)b1 << 16) + | ((UINT32)b2 << 8) | (UINT32)b3; +} + +/*************************************************************************** + * GetBDSPChunk + * + * Function: + * Get BDSP chunk + * Arguments: + * pbPrm MCDRV_AEC_INFO structure pointer + * psBdspInfo MCDRV_BDSP_AEC_BDSP_INFO + * structure pointer + * Return: + * none + * + ****************************************************************************/ +static void GetBDSPChunk(struct MCDRV_AEC_INFO *psPrm, + struct MCDRV_BDSP_AEC_BDSP_INFO *psBdspInfo) +{ + psBdspInfo->bBDspOnOff = BDSP_OFF; + psBdspInfo->pbChunkData = NULL; + psBdspInfo->dwSize = 0; + + if (psPrm->sAecAudioengine.bEnable == AEC_AUDIOENGINE_ENABLE) { + psBdspInfo->bBDspOnOff = psPrm->sAecAudioengine.bAEOnOff; + + if (psBdspInfo->bBDspOnOff == BDSP_OFF) + return; + + psBdspInfo->pbChunkData = + psPrm->sAecAudioengine.sAecBDsp.pbChunkData; + psBdspInfo->dwSize = + psPrm->sAecAudioengine.sAecBDsp.dwSize; + } + + if (psBdspInfo->pbChunkData != NULL) + psBdspInfo->pbChunkData = &psBdspInfo->pbChunkData[CHUNK_SIZE]; +} + +/*************************************************************************** + * AppOnOff + * + * Function: + * change decision App On/Off + * Arguments: + * bOnOff On/Off + * bApp App bit + * bAppExec App exec value + * Return: + * App bit + * + ****************************************************************************/ +static UINT8 AppOnOff(UINT8 bOnOff, UINT8 bApp, UINT8 bAppExec) +{ + switch (bOnOff) { + case BDSP_APP_EXEC_STOP: + if ((bAppExec & bApp) == 0) + bApp = 0x00; + break; + + case BDSP_APP_EXEC_START: + if ((bAppExec & bApp) != 0) + bApp = 0x00; + break; + + case BDSP_APP_EXEC_DONTCARE: + default: + bApp = 0x00; + break; + } + + return bApp; +} + +/*************************************************************************** + * CheckAppOnOff + * + * Function: + * + * Arguments: + * psBdspInfo MCDRV_BDSP_AEC_BDSP_INFO + * structure pointer + * Return: + * Target Number + * + ****************************************************************************/ +static void CheckAppOnOff(struct MCDRV_BDSP_AEC_BDSP_INFO *psBdspInfo) +{ + UINT8 *pbPrm; + + pbPrm = psBdspInfo->pbFwctrlB; + + psBdspInfo->bAe0AppOnOff |= AppOnOff(pbPrm[FWCTRL_B_WIDE], + MCB_AEEXEC0_WIDE, gsBdspInfo.bAppExec0); + psBdspInfo->bAe0AppOnOff |= AppOnOff(pbPrm[FWCTRL_B_HEX], + MCB_AEEXEC0_HEX, gsBdspInfo.bAppExec0); + psBdspInfo->bAe0AppOnOff |= AppOnOff(pbPrm[FWCTRL_B_EQ3_0A], + MCB_AEEXEC0_EQ3_0A, gsBdspInfo.bAppExec0); + psBdspInfo->bAe0AppOnOff |= AppOnOff(pbPrm[FWCTRL_B_DRC3], + MCB_AEEXEC0_DRC3, gsBdspInfo.bAppExec0); + psBdspInfo->bAe0AppOnOff |= AppOnOff(pbPrm[FWCTRL_B_DRC_0], + MCB_AEEXEC0_DRC_0, gsBdspInfo.bAppExec0); + psBdspInfo->bAe0AppOnOff |= AppOnOff(pbPrm[FWCTRL_B_EQ3_0B], + MCB_AEEXEC0_EQ3_0B, gsBdspInfo.bAppExec0); + + psBdspInfo->bAe1AppOnOff |= AppOnOff(pbPrm[FWCTRL_B_EQ3_1A], + MCB_AEEXEC1_EQ3_1A, gsBdspInfo.bAppExec1); + psBdspInfo->bAe1AppOnOff |= AppOnOff(pbPrm[FWCTRL_B_AGC], + MCB_AEEXEC1_AGC, gsBdspInfo.bAppExec1); + psBdspInfo->bAe1AppOnOff |= AppOnOff(pbPrm[FWCTRL_B_DRC_1], + MCB_AEEXEC1_DRC_1, gsBdspInfo.bAppExec1); + psBdspInfo->bAe1AppOnOff |= AppOnOff(pbPrm[FWCTRL_B_EQ3_1B], + MCB_AEEXEC1_EQ3_1B, gsBdspInfo.bAppExec1); + + if ((BDSP_APP_EXEC_STOP == pbPrm[FWCTRL_B_GEN]) && + (gsBdspInfo.bAppExec0 & MCB_AEEXEC0_GEN) != 0) + psBdspInfo->bAppGen |= MCB_AEEXEC0_GEN; +} + +/*************************************************************************** + * GetAppNoTarget + * + * Function: + * Get app target + * Arguments: + * dAppNo App Number + * Return: + * Target Number + * + ****************************************************************************/ +static UINT32 GetAppNoTarget(UINT32 dAppNo) +{ + switch (dAppNo) { + case APP_NO_GEN: + return TARGET_GEN_GEN; + case APP_NO_SWAP_0: + return TARGET_BASE_SWAP_0; + case APP_NO_WIDE: + return TARGET_AE0_WIDE; + case APP_NO_HEX: + return TARGET_AE0_HEX; + case APP_NO_EQ3_0A: + return TARGET_AE0_EQ3_0A; + case APP_NO_DRC3: + return TARGET_AE0_DRC3; + case APP_NO_DRC_0: + return TARGET_AE0_DRC_0; + case APP_NO_EQ3_0B: + return TARGET_AE0_EQ3_0B; + case APP_NO_MIX_0: + return TARGET_BASE_MIX_0; + case APP_NO_SWAP_1: + return TARGET_BASE_SWAP_1; + case APP_NO_EQ3_1A: + return TARGET_AE1_EQ3_1A; + case APP_NO_AGC: + return TARGET_AE1_AGC; + case APP_NO_DRC_1: + return TARGET_AE1_DRC_1; + case APP_NO_EQ3_1B: + return TARGET_AE1_EQ3_1B; + case APP_NO_MIX_1: + return TARGET_BASE_MIX_1; + default: + break; + } + + return TARGET_NONE; +} + +/*************************************************************************** + * CheckSinCtrlSel + * + * Function: + * check sin control + * Arguments: + * psBdspInfo MCDRV_BDSP_AEC_BDSP_INFO + * structure pointer + * pbPrm chunk data pointer + * Return: + * none + * + ****************************************************************************/ +static void CheckSinCtrlSel(struct MCDRV_BDSP_AEC_BDSP_INFO *psBdspInfo, + UINT8 *pbPrm) +{ + UINT32 dAdd; + UINT32 dSize; + + dAdd = CreateUINT32(pbPrm[0UL], pbPrm[1UL], pbPrm[2UL], pbPrm[3UL]); + dSize = CreateUINT32(pbPrm[5UL], pbPrm[6UL], pbPrm[7UL], pbPrm[8UL]); + pbPrm = &pbPrm[9UL]; + + if (GEN_SIN_CTL_SEL_ADD < dAdd) + return; + + if ((dAdd + (dSize / 4UL)) < GEN_SIN_CTL_SEL_ADD) + return; + + dAdd = GEN_SIN_CTL_SEL_ADD - dAdd; + + if ((pbPrm[(dAdd * 4) + 3] & BDSP_SIN_CTRL_GPIO) != 0) + psBdspInfo->bSinCtrlSel = BDSP_SIN_CTRL_GPIO; + else + psBdspInfo->bSinCtrlSel = BDSP_SIN_CTRL_REG; +} + +/*************************************************************************** + * AppChunkAnalyze + * + * Function: + * App analysis chunk + * Arguments: + * psBdspInfo MCDRV_BDSP_AEC_BDSP_INFO + * structure pointer + * dChunkId chunk id + * dChunkSize chunk size + * dChunkTop chunk positon + * pbPrm chunk data pointer + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR_ARGUMENT + * + ****************************************************************************/ +static SINT32 AppChunkAnalyze(struct MCDRV_BDSP_AEC_BDSP_INFO *psBdspInfo, + UINT32 dChunkId, UINT32 dChunkSize, + UINT32 dChunkTop, UINT8 *pbPrm) +{ + UINT32 dTag; + UINT32 dAppNo; + UINT32 dTarget; + UINT32 dTemp; + + dTag = (dChunkId & (UINT32)AEC_BDSP_TAG_APP_MASK); + if ((dTag != AEC_BDSP_TAG_APP_COEF) && (dTag != AEC_BDSP_TAG_APP_REG)) + return MCDRV_SUCCESS; + + dAppNo = (dChunkId & (UINT32)AEC_BDSP_TAG_APPNO_MASK); + dTarget = GetAppNoTarget(dAppNo); + + if (dTag == AEC_BDSP_TAG_APP_COEF) { + if (dChunkSize < (UINT32)APP_COEF_FIX_SIZE) + return MCDRV_ERROR_ARGUMENT; + dTemp = CreateUINT32(pbPrm[dChunkTop + 5UL], + pbPrm[dChunkTop + 6UL], + pbPrm[dChunkTop + 7UL], + pbPrm[dChunkTop + 8UL]); + if (dTemp == 0UL) + return MCDRV_SUCCESS; + if ((dTemp & 0x03UL) != 0UL) + return MCDRV_ERROR_ARGUMENT; + if (dChunkSize < (dTemp + (UINT32)APP_COEF_FIX_SIZE)) + return MCDRV_ERROR_ARGUMENT; + + ++(psBdspInfo->dAppCoefCnt); + + if ((COEF_DSP_TRANS != pbPrm[dChunkTop + 4UL]) || + ((UINT32)COEF_DSP_TRANS_MAX < dTemp) || + (1UL < psBdspInfo->dAppCoefCnt)) + psBdspInfo->bCoefTrans = COEF_DMA_TRANS; + + psBdspInfo->dCoefTarget |= dTarget; + + if (dTarget == TARGET_GEN_GEN) + CheckSinCtrlSel(psBdspInfo, &pbPrm[dChunkTop]); + } else { + if (dChunkSize < (UINT32)APP_REG_FIX_SIZE) + return MCDRV_ERROR_ARGUMENT; + + if (TARGET_GEN_GEN != dTarget) + return MCDRV_SUCCESS; + + ++(psBdspInfo->dAppRegCnt); + + if ((pbPrm[dChunkTop + APP_REG_FLG] & APP_REG_FLG_FWCTL4) != 0) + psBdspInfo->dRegAppStopTarget |= TARGET_GEN_GEN; + } + + return MCDRV_SUCCESS; +} + +/*************************************************************************** + * BdspChunkAnalyze + * + * Function: + * Bdsp analysis chunk + * Arguments: + * psBdspInfo MCDRV_BDSP_AEC_BDSP_INFO + * structure pointer + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR_ARGUMENT + * + ****************************************************************************/ +static SINT32 BdspChunkAnalyze(struct MCDRV_BDSP_AEC_BDSP_INFO *psBdspInfo) +{ + UINT32 dChunkTop; + UINT32 dChunkId; + UINT32 dChunkSize; + UINT8 *pbPrm; + UINT32 dSize; + + psBdspInfo->pbFwctrlB = NULL; + psBdspInfo->dAppCoefCnt = 0UL; + psBdspInfo->bCoefTrans = COEF_DSP_TRANS; + psBdspInfo->bAe0AppOnOff = 0; + psBdspInfo->bAe1AppOnOff = 0; + psBdspInfo->bAppGen = 0; + psBdspInfo->dCoefTarget = TARGET_NONE; + psBdspInfo->bSinCtrlSel = gsBdspInfo.bSinCtrlSel; + psBdspInfo->dAppRegCnt = 0UL; + psBdspInfo->dRegAppStopTarget = TARGET_NONE; + psBdspInfo->bStoppedAppExec0 = 0; + psBdspInfo->bStoppedAppExec1 = 0; + psBdspInfo->bStoppedSinOut = 0; + psBdspInfo->bStoppedBypass = 0; + + if ((psBdspInfo->pbChunkData == NULL) || (psBdspInfo->dwSize == 0)) + return MCDRV_SUCCESS; + + pbPrm = psBdspInfo->pbChunkData; + dSize = psBdspInfo->dwSize; + dChunkTop = 0UL; + while (dChunkTop < dSize) { + if (dSize < (dChunkTop + (UINT32)CHUNK_SIZE)) + return MCDRV_ERROR_ARGUMENT; + + dChunkId = CreateUINT32(pbPrm[dChunkTop + 0UL], + pbPrm[dChunkTop + 1UL], + pbPrm[dChunkTop + 2UL], + pbPrm[dChunkTop + 3UL]); + dChunkSize = CreateUINT32(pbPrm[dChunkTop + 4UL], + pbPrm[dChunkTop + 5UL], + pbPrm[dChunkTop + 6UL], + pbPrm[dChunkTop + 7UL]); + if (dSize < (dChunkTop + (UINT32)CHUNK_SIZE + dChunkSize)) + return MCDRV_ERROR_ARGUMENT; + + dChunkTop += (UINT32)CHUNK_SIZE; + switch (dChunkId) { + case AEC_BDSP_TAG_FWCTRL_B: + if (dChunkSize < (UINT32)FWCTRL_B_SIZE) + return MCDRV_ERROR_ARGUMENT; + if (psBdspInfo->pbFwctrlB != NULL) + return MCDRV_ERROR_ARGUMENT; + + psBdspInfo->pbFwctrlB = &pbPrm[dChunkTop]; + + CheckAppOnOff(psBdspInfo); + break; + + default: + if (AppChunkAnalyze(psBdspInfo, + dChunkId, dChunkSize, dChunkTop, pbPrm) + != MCDRV_SUCCESS) + return MCDRV_ERROR_ARGUMENT; + } + dChunkTop += dChunkSize; + } + + return MCDRV_SUCCESS; +} + +/*************************************************************************** + * DSPTransWait + * + * Function: + * Wait for DSP transfer + * Arguments: + * none + * Return: + * 0 SUCCESS + * < 0 ERROR + * + ****************************************************************************/ +static SINT32 DSPTransWait(void) +{ + SINT32 sdResult; + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_EVTWAIT + | MCDRV_EVT_IF_REG_FLAG_RESET + | (((UINT32)MCI_BDSPTREQ) << 8) + | (UINT32)MCB_BDSPTREQ), + 0); + + sdResult = McDevIf_ExecutePacket(); + + return sdResult; +} + +/*************************************************************************** + * CrossFadeWait + * + * Function: + * Cross fade wait + * Arguments: + * none + * Return: + * 0 SUCCESS + * < 0 ERROR + * + ****************************************************************************/ +static SINT32 CrossFadeWait(void) +{ + SINT32 sdResult; + + McSrv_Sleep(BDSP_BYPASS_FADE_TIME); + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_EVTWAIT + | MCDRV_EVT_B_REG_FLAG_RESET + | (((UINT32)MCI_AEFADE) << 8) + | (UINT32)(MCB_AEFADE_AE1 | MCB_AEFADE_AE0)), + 0); + + sdResult = McDevIf_ExecutePacket(); + + return sdResult; +} + +/*************************************************************************** + * SinOutWait + * + * Function: + * Sin out wait + * Arguments: + * none + * Return: + * 0 SUCCESS + * < 0 ERROR + * + ****************************************************************************/ +static SINT32 SinOutWait(void) +{ + SINT32 sdResult; + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_EVTWAIT + | MCDRV_EVT_B_REG_FLAG_RESET + | (((UINT32)MCI_SINOUTFLG) << 8) + | (UINT32)(MCB_SINOFLG)), + 0); + + sdResult = McDevIf_ExecutePacket(); + + return sdResult; +} + +/*************************************************************************** + * BypassPath + * + * Function: + * Bypass configuration path + * Arguments: + * psBdspInfo MCDRV_BDSP_AEC_BDSP_INFO + * structure pointer + * Return: + * Wait info + * + ****************************************************************************/ +static UINT32 BypassPath(struct MCDRV_BDSP_AEC_BDSP_INFO *psBdspInfo) +{ + UINT8 bData; + UINT8 bStopped; + UINT32 dWait; + + bData = gsBdspInfo.bAEBypass; + bStopped = 0; + dWait = WAIT_NONE; + + if (psBdspInfo->bAe0AppOnOff != 0) { + bData |= MCB_AEBYPASS_AE0; + bStopped |= MCB_AEBYPASS_AE0; + } + + if (psBdspInfo->bAe1AppOnOff != 0) { + bData |= MCB_AEBYPASS_AE1; + bStopped |= MCB_AEBYPASS_AE1; + } + + if (psBdspInfo->bCoefTrans == COEF_DMA_TRANS) { + if ((psBdspInfo->dCoefTarget & TARGET_AE0_MASK) != 0) { + bData |= MCB_AEBYPASS_AE0; + bStopped |= MCB_AEBYPASS_AE0; + } + + if ((psBdspInfo->dCoefTarget & TARGET_AE1_MASK) != 0) { + bData |= MCB_AEBYPASS_AE1; + bStopped |= MCB_AEBYPASS_AE1; + } + } + + if (bData != gsBdspInfo.bAEBypass) { + McDevIf_AddPacket((MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_B + | (UINT32)MCI_AEBYPASS), + bData); + McDevIf_ExecutePacket(); + + dWait = CROSS_FADE_WAIT; + psBdspInfo->bStoppedBypass = bStopped; + gsBdspInfo.bAEBypass = bData; + } + + return dWait; +} + +/*************************************************************************** + * SinStop + * + * Function: + * Sin stop + * Arguments: + * psBdspInfo MCDRV_BDSP_AEC_BDSP_INFO + * structure pointer + * Return: + * Wait info + * + ****************************************************************************/ +static UINT32 SinStop(struct MCDRV_BDSP_AEC_BDSP_INFO *psBdspInfo) +{ + UINT8 bData; + UINT32 dWait; + + dWait = WAIT_NONE; + + if (gsBdspInfo.bSinCtrlSel == BDSP_SIN_CTRL_GPIO) + return dWait; + + if ((gsBdspInfo.bAppExec0 & MCB_AEEXEC0_GEN) == 0) + return dWait; + + if (((psBdspInfo->bAppGen != 0) || + (psBdspInfo->dRegAppStopTarget & TARGET_GEN_MASK) != 0) || + ((psBdspInfo->bCoefTrans == COEF_DMA_TRANS) && + ((psBdspInfo->dCoefTarget & TARGET_GEN_MASK) != 0))) { + + dWait = SIN_OUT_WAIT; + + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_B + | (UINT32)MCI_SINOUT), + &bData, 1); + if ((bData & MCB_SINOUT) != 0) { + McDevIf_AddPacket((MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_B + | (UINT32)MCI_SINOUT), + MCI_SINOUT_DEF); + McDevIf_ExecutePacket(); + + psBdspInfo->bStoppedSinOut = MCB_SINOUT; + } + } + + return dWait; +} + +/*************************************************************************** + * AppStop + * + * Function: + * App stop + * Arguments: + * psBdspInfo MCDRV_BDSP_AEC_BDSP_INFO + * structure pointer + * Return: + * none + * + ****************************************************************************/ +static void AppStop(struct MCDRV_BDSP_AEC_BDSP_INFO *psBdspInfo) +{ + UINT8 bAppExec0; + UINT8 bAppExec1; + UINT8 bStoppedAppExec0; + UINT8 bStoppedAppExec1; + + bAppExec0 = gsBdspInfo.bAppExec0; + bAppExec1 = gsBdspInfo.bAppExec1; + bStoppedAppExec0 = 0; + bStoppedAppExec1 = 0; + + if (psBdspInfo->bCoefTrans == COEF_DMA_TRANS) { + if (((psBdspInfo->dCoefTarget & TARGET_AE0_EQ3_0B) != 0) && + ((bAppExec0 & MCB_AEEXEC0_EQ3_0B) != 0)) { + bAppExec0 &= ~MCB_AEEXEC0_EQ3_0B; + bStoppedAppExec0 |= MCB_AEEXEC0_EQ3_0B; + } + if (((psBdspInfo->dCoefTarget & TARGET_AE0_DRC_0) != 0) && + ((bAppExec0 & MCB_AEEXEC0_DRC_0) != 0)) { + bAppExec0 &= ~MCB_AEEXEC0_DRC_0; + bStoppedAppExec0 |= MCB_AEEXEC0_DRC_0; + } + if (((psBdspInfo->dCoefTarget & TARGET_AE0_DRC3) != 0) && + ((bAppExec0 & MCB_AEEXEC0_DRC3) != 0)) { + bAppExec0 &= ~MCB_AEEXEC0_DRC3; + bStoppedAppExec0 |= MCB_AEEXEC0_DRC3; + } + if (((psBdspInfo->dCoefTarget & TARGET_AE0_EQ3_0A) != 0) && + ((bAppExec0 & MCB_AEEXEC0_EQ3_0A) != 0)) { + bAppExec0 &= ~MCB_AEEXEC0_EQ3_0A; + bStoppedAppExec0 |= MCB_AEEXEC0_EQ3_0A; + } + if (((psBdspInfo->dCoefTarget & TARGET_AE0_HEX) != 0) && + ((bAppExec0 & MCB_AEEXEC0_HEX) != 0)) { + bAppExec0 &= ~MCB_AEEXEC0_HEX; + bStoppedAppExec0 |= MCB_AEEXEC0_HEX; + } + if (((psBdspInfo->dCoefTarget & TARGET_AE0_WIDE) != 0) && + ((bAppExec0 & MCB_AEEXEC0_WIDE) != 0)) { + bAppExec0 &= ~MCB_AEEXEC0_WIDE; + bStoppedAppExec0 |= MCB_AEEXEC0_WIDE; + } + + if (((psBdspInfo->dCoefTarget & TARGET_AE1_EQ3_1B) != 0) && + ((bAppExec1 & MCB_AEEXEC1_EQ3_1B) != 0)) { + bAppExec1 &= ~MCB_AEEXEC1_EQ3_1B; + bStoppedAppExec1 |= MCB_AEEXEC1_EQ3_1B; + } + if (((psBdspInfo->dCoefTarget & TARGET_AE1_DRC_1) != 0) && + ((bAppExec1 & MCB_AEEXEC1_DRC_1) != 0)) { + bAppExec1 &= ~MCB_AEEXEC1_DRC_1; + bStoppedAppExec1 |= MCB_AEEXEC1_DRC_1; + } + if (((psBdspInfo->dCoefTarget & TARGET_AE1_AGC) != 0) && + ((bAppExec1 & MCB_AEEXEC1_AGC) != 0)) { + bAppExec1 &= ~MCB_AEEXEC1_AGC; + bStoppedAppExec1 |= MCB_AEEXEC1_AGC; + } + if (((psBdspInfo->dCoefTarget & TARGET_AE1_EQ3_1A) != 0) && + ((bAppExec1 & MCB_AEEXEC1_EQ3_1A) != 0)) { + bAppExec1 &= ~MCB_AEEXEC1_EQ3_1A; + bStoppedAppExec1 |= MCB_AEEXEC1_EQ3_1A; + } + + if (((psBdspInfo->dCoefTarget & TARGET_GEN_GEN) != 0) && + ((bAppExec0 & MCB_AEEXEC0_GEN) != 0)) { + bAppExec0 &= ~MCB_AEEXEC0_GEN; + bStoppedAppExec0 |= MCB_AEEXEC0_GEN; + } + } + + if (((psBdspInfo->dRegAppStopTarget & TARGET_GEN_GEN) != 0) && + ((bAppExec0 & MCB_AEEXEC0_GEN) != 0)) { + bAppExec0 &= ~MCB_AEEXEC0_GEN; + bStoppedAppExec0 |= MCB_AEEXEC0_GEN; + } + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_B + | (UINT32)MCI_AEEXEC0), + bAppExec0); + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_B + | (UINT32)MCI_AEEXEC1), + bAppExec1); + + psBdspInfo->bStoppedAppExec0 = bStoppedAppExec0; + psBdspInfo->bStoppedAppExec1 = bStoppedAppExec1; + + gsBdspInfo.bAppExec0 = bAppExec0; + gsBdspInfo.bAppExec1 = bAppExec1; +} + +/*************************************************************************** + * Stop + * + * Function: + * Stop + * Arguments: + * psBdspInfo MCDRV_BDSP_AEC_BDSP_INFO + * structure pointer + * Return: + * 0 SUCCESS + * < 0 ERROR + * + ****************************************************************************/ +static SINT32 Stop(struct MCDRV_BDSP_AEC_BDSP_INFO *psBdspInfo) +{ + SINT32 sdResult; + UINT32 dWait; + + dWait = WAIT_NONE; + + sdResult = DSPTransWait(); + if (sdResult < (SINT32)MCDRV_SUCCESS) + return sdResult; + + dWait |= BypassPath(psBdspInfo); + + dWait |= SinStop(psBdspInfo); + + if ((dWait & CROSS_FADE_WAIT) != 0) { + sdResult = CrossFadeWait(); + if (sdResult < (SINT32)MCDRV_SUCCESS) + return sdResult; + } + if ((dWait & SIN_OUT_WAIT) != 0) { + sdResult = SinOutWait(); + if (sdResult < (SINT32)MCDRV_SUCCESS) + return sdResult; + } + + /* APP Stop */ + AppStop(psBdspInfo); + + return MCDRV_SUCCESS; +} + +/*************************************************************************** + * EnableAppNo + * + * Function: + * Number determination App + * Arguments: + * dAppNo App Number + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR + * + ****************************************************************************/ +static SINT32 EnableAppNo(UINT32 dAppNo) +{ + switch (dAppNo) { + case APP_NO_GEN: + case APP_NO_SWAP_0: + case APP_NO_WIDE: + case APP_NO_HEX: + case APP_NO_EQ3_0A: + case APP_NO_DRC3: + case APP_NO_DRC_0: + case APP_NO_EQ3_0B: + case APP_NO_MIX_0: + case APP_NO_SWAP_1: + case APP_NO_EQ3_1A: + case APP_NO_AGC: + case APP_NO_DRC_1: + case APP_NO_EQ3_1B: + case APP_NO_MIX_1: + return MCDRV_SUCCESS; + + default: + break; + } + + return MCDRV_ERROR; +} + +/*************************************************************************** + * AppCoefDL + * + * Function: + * Download App coefficient + * Arguments: + * pbAppCoef Coefficient data pointer + * bCoefTrans Transmission mode + * Return: + * none + * + ****************************************************************************/ +static void AppCoefDL(UINT8 *pbAppCoef, UINT8 bCoefTrans) +{ + UINT32 dSize; + UINT32 i; + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_BMAA0), + (UINT8)(pbAppCoef[APP_COEF_ADR + 1] & MCB_BMAA0)); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_BMAA1), + (UINT8)(pbAppCoef[APP_COEF_ADR + 2] & MCB_BMAA1)); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_BMAA2), + (UINT8)(pbAppCoef[APP_COEF_ADR + 3] & MCB_BMAA2)); + + /* BMACtl */ + if (bCoefTrans == COEF_DSP_TRANS) + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_BMACTL), + (UINT8)(MCB_BDSPTINI | MCB_BMAMOD_DSP + | MCB_BMABUS_Y)); + else + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_BMACTL), + MCB_BMABUS_Y); + + McDevIf_ExecutePacket(); + + dSize = CreateUINT32(pbAppCoef[APP_COEF_SIZE + 0], + pbAppCoef[APP_COEF_SIZE + 1], + pbAppCoef[APP_COEF_SIZE + 2], + pbAppCoef[APP_COEF_SIZE + 3]); + + for (i = 0; i < dSize; i++) + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_BMAD), + pbAppCoef[APP_COEF_DATA + i]); + McDevIf_ExecutePacket(); +} + +/*************************************************************************** + * AppRegDL + * + * Function: + * Download App register + * Arguments: + * psBdspInfo MCDRV_BDSP_AEC_BDSP_INFO + * structure pointer + * dTarget Target + * pbAppReg Register data pointer + * Return: + * none + * + ****************************************************************************/ +static void AppRegDL(struct MCDRV_BDSP_AEC_BDSP_INFO *psBdspInfo, + UINT32 dTarget, UINT8 *pbAppReg) +{ + switch (dTarget) { + case TARGET_GEN_GEN: + if ((pbAppReg[APP_REG_FLG] & APP_REG_FLG_FWCTL4) != 0) + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_B + | (UINT32)MCI_F01SEL), + pbAppReg[APP_REG_FWCTL4]); + + if ((pbAppReg[APP_REG_FLG] & APP_REG_FLG_FWCTL5) != 0) { + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_B + | (UINT32)MCI_SINOUT), + pbAppReg[APP_REG_FWCTL5]); + if ((pbAppReg[APP_REG_FWCTL5] & MCB_SINOUT) == 0) + psBdspInfo->bStoppedSinOut = 0; + } + McDevIf_ExecutePacket(); + break; + + default: + break; + } +} + +/*************************************************************************** + * MultiChunkDL + * + * Function: + * Download multiple chunks + * Arguments: + * psBdspInfo MCDRV_BDSP_AEC_BDSP_INFO + * structure pointer + * dTargetChunk Target chunk + * Return: + * none + * + ****************************************************************************/ +static void MultiChunkDL(struct MCDRV_BDSP_AEC_BDSP_INFO *psBdspInfo, + UINT32 dTargetChunk) +{ + UINT32 dChunkTop; + UINT32 dChunkId; + UINT32 dChunkSize; + UINT32 dAppNo; + UINT8 *pbPrm; + UINT32 dSize; + + pbPrm = psBdspInfo->pbChunkData; + dSize = psBdspInfo->dwSize; + + dChunkTop = 0; + while (dChunkTop < dSize) { + dChunkId = CreateUINT32(pbPrm[dChunkTop + 0UL], + pbPrm[dChunkTop + 1UL], + pbPrm[dChunkTop + 2UL], + pbPrm[dChunkTop + 3UL]); + dChunkSize = CreateUINT32(pbPrm[dChunkTop + 4UL], + pbPrm[dChunkTop + 5UL], + pbPrm[dChunkTop + 6UL], + pbPrm[dChunkTop + 7UL]); + + dChunkTop += (UINT32)CHUNK_SIZE; + + dAppNo = (dChunkId & (UINT32)AEC_BDSP_TAG_APPNO_MASK); + switch ((dChunkId & (UINT32)AEC_BDSP_TAG_APP_MASK)) { + case AEC_BDSP_TAG_APP_COEF: + if (dTargetChunk == (UINT32)MULTI_CHUNK_APP_COEF) { + if (EnableAppNo(dAppNo) == MCDRV_SUCCESS) + AppCoefDL(&pbPrm[dChunkTop], + psBdspInfo->bCoefTrans); + + if (dAppNo == APP_NO_GEN) + gsBdspInfo.bSinCtrlSel = + psBdspInfo->bSinCtrlSel; + } + break; + + case AEC_BDSP_TAG_APP_REG: + if (dTargetChunk == (UINT32)MULTI_CHUNK_APP_REG) + AppRegDL(psBdspInfo, GetAppNoTarget(dAppNo), + &pbPrm[dChunkTop]); + break; + + default: + /* unknown */ + break; + } + dChunkTop += dChunkSize; + } +} + +/*************************************************************************** + * Download + * + * Function: + * Download + * Arguments: + * psBdspInfo MCDRV_BDSP_AEC_BDSP_INFO + * structure pointer + * Return: + * none + * + ****************************************************************************/ +static void Download(struct MCDRV_BDSP_AEC_BDSP_INFO *psBdspInfo) +{ + if (psBdspInfo->dAppCoefCnt != 0UL) { + MultiChunkDL(psBdspInfo, MULTI_CHUNK_APP_COEF); + + if (psBdspInfo->bCoefTrans == COEF_DSP_TRANS) { + /* DSPTReq */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_BDSPTREQ), + MCB_BDSPTREQ); + McDevIf_ExecutePacket(); + } + } + + if (psBdspInfo->dAppRegCnt != 0UL) + MultiChunkDL(psBdspInfo, MULTI_CHUNK_APP_REG); +} + +/*************************************************************************** + * CreateAppExec + * + * Function: + * Create App Exec + * Arguments: + * bOnOff On/Off + * bApp App bit + * bAppExec App exec value + * Return: + * App Exec + * + ****************************************************************************/ +static UINT8 CreateAppExec(UINT8 bOnOff, UINT8 bApp, UINT8 bAppExec) +{ + switch (bOnOff) { + case BDSP_APP_EXEC_STOP: + bAppExec &= ~bApp; + break; + + case BDSP_APP_EXEC_START: + bAppExec |= bApp; + break; + + case BDSP_APP_EXEC_DONTCARE: + default: + break; + } + + return bAppExec; +} + +/*************************************************************************** + * NewAppOn + * + * Function: + * Settings App On/Off + * Arguments: + * psBdspInfo MCDRV_BDSP_AEC_BDSP_INFO + * structure pointer + * Return: + * none + * + ****************************************************************************/ +static void NewAppOn(struct MCDRV_BDSP_AEC_BDSP_INFO *psBdspInfo) +{ + UINT8 bAppExec0; + UINT8 bAppExec1; + UINT8 *pbPrm; + + pbPrm = psBdspInfo->pbFwctrlB; + + bAppExec0 = gsBdspInfo.bAppExec0; + bAppExec1 = gsBdspInfo.bAppExec1; + + bAppExec0 |= psBdspInfo->bStoppedAppExec0; + bAppExec1 |= psBdspInfo->bStoppedAppExec1; + + bAppExec0 = CreateAppExec(pbPrm[FWCTRL_B_WIDE], + MCB_AEEXEC0_WIDE, bAppExec0); + bAppExec0 = CreateAppExec(pbPrm[FWCTRL_B_HEX], + MCB_AEEXEC0_HEX, bAppExec0); + bAppExec0 = CreateAppExec(pbPrm[FWCTRL_B_EQ3_0A], + MCB_AEEXEC0_EQ3_0A, bAppExec0); + bAppExec0 = CreateAppExec(pbPrm[FWCTRL_B_DRC3], + MCB_AEEXEC0_DRC3, bAppExec0); + bAppExec0 = CreateAppExec(pbPrm[FWCTRL_B_DRC_0], + MCB_AEEXEC0_DRC_0, bAppExec0); + bAppExec0 = CreateAppExec(pbPrm[FWCTRL_B_EQ3_0B], + MCB_AEEXEC0_EQ3_0B, bAppExec0); + + bAppExec0 = CreateAppExec(pbPrm[FWCTRL_B_GEN], + MCB_AEEXEC0_GEN, bAppExec0); + + bAppExec1 = CreateAppExec(pbPrm[FWCTRL_B_EQ3_1A], + MCB_AEEXEC1_EQ3_1A, bAppExec1); + bAppExec1 = CreateAppExec(pbPrm[FWCTRL_B_AGC], + MCB_AEEXEC1_AGC, bAppExec1); + bAppExec1 = CreateAppExec(pbPrm[FWCTRL_B_DRC_1], + MCB_AEEXEC1_DRC_1, bAppExec1); + bAppExec1 = CreateAppExec(pbPrm[FWCTRL_B_EQ3_1B], + MCB_AEEXEC1_EQ3_1B, bAppExec1); + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_B + | (UINT32)MCI_AEEXEC0), + bAppExec0); + + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_B + | (UINT32)MCI_AEEXEC1), + bAppExec1); + + McDevIf_ExecutePacket(); + + gsBdspInfo.bAppExec0 = bAppExec0; + gsBdspInfo.bAppExec1 = bAppExec1; +} + +/*************************************************************************** + * SinStart + * + * Function: + * Sin start + * Arguments: + * psBdspInfo MCDRV_BDSP_AEC_BDSP_INFO + * structure pointer + * Return: + * none + * + ****************************************************************************/ +static void SinStart(struct MCDRV_BDSP_AEC_BDSP_INFO *psBdspInfo) +{ + if (psBdspInfo->bStoppedSinOut == MCB_SINOUT) { + McDevIf_AddPacket((MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_B + | (UINT32)MCI_SINOUT), + MCB_SINOUT); + McDevIf_ExecutePacket(); + } +} + +/*************************************************************************** + * NewPath + * + * Function: + * Path setting + * Arguments: + * psBdspInfo MCDRV_BDSP_AEC_BDSP_INFO + * structure pointer + * Return: + * none + * + ****************************************************************************/ +static void NewPath(struct MCDRV_BDSP_AEC_BDSP_INFO *psBdspInfo) +{ + UINT8 bAEBypass; + UINT8 *pbPrm; + + pbPrm = psBdspInfo->pbFwctrlB; + if (pbPrm == NULL) + return; + + bAEBypass = gsBdspInfo.bAEBypass; + + switch (pbPrm[FWCTRL_B_AE0_BYP]) { + case BDSP_PATH_NORMAL: + bAEBypass &= ~MCB_AEBYPASS_AE0; + break; + + case BDSP_PATH_BYPASS: + bAEBypass |= MCB_AEBYPASS_AE0; + break; + + case BDSP_PATH_DONTCARE: + default: + break; + } + + switch (pbPrm[FWCTRL_B_AE1_BYP]) { + case BDSP_PATH_NORMAL: + bAEBypass &= ~MCB_AEBYPASS_AE1; + break; + + case BDSP_PATH_BYPASS: + bAEBypass |= MCB_AEBYPASS_AE1; + break; + + case BDSP_PATH_DONTCARE: + default: + break; + } + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_B + | (UINT32)MCI_AEBYPASS), + bAEBypass); + + McDevIf_ExecutePacket(); + + gsBdspInfo.bAEBypass = bAEBypass; +} + +/*************************************************************************** + * AudioIFPath + * + * Function: + * Audio IF path set + * Arguments: + * psBdspInfo MCDRV_BDSP_AEC_BDSP_INFO + * structure pointer + * Return: + * none + * + ****************************************************************************/ +static void AudioIFPath(struct MCDRV_BDSP_AEC_BDSP_INFO *psBdspInfo) +{ + UINT8 bDSPCtl; + + switch (psBdspInfo->pbFwctrlB[FWCTRL_B_BYPASS]) { + case BDSP_PATH_NORMAL: + case BDSP_PATH_BYPASS: + gsBdspInfo.bDSPBypass = + (UINT8)((psBdspInfo->pbFwctrlB[FWCTRL_B_BYPASS] << 7) + & MCB_BDSPBYPASS); + break; + + case BDSP_PATH_DONTCARE: + default: + break; + }; + + bDSPCtl = gsBdspInfo.bDSPCtl; + switch (gsBdspInfo.bDSPBypass & MCB_BDSPBYPASS) { + case MCB_BDSPBYPASS: + if ((bDSPCtl & (UINT8)MCB_BDSPSTART) != 0) + bDSPCtl = MCB_BDSPBYPASS; + break; + + /*case MCI_BDSPCTRL_DEF:*/ + default: + if ((bDSPCtl & (UINT8)MCB_BDSPBYPASS) != 0) + bDSPCtl = MCB_BDSPSTART; + break; + } + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_B + | (UINT32)MCI_BDSPCTRL), + bDSPCtl); + + McDevIf_ExecutePacket(); + + gsBdspInfo.bDSPCtl = bDSPCtl; +} + +/*************************************************************************** + * ResumeAppOn + * + * Function: + * Resume App On + * Arguments: + * psBdspInfo MCDRV_BDSP_AEC_BDSP_INFO + * structure pointer + * Return: + * none + * + ****************************************************************************/ +static void ResumeAppOn(struct MCDRV_BDSP_AEC_BDSP_INFO *psBdspInfo) +{ + UINT8 bAppExec0; + UINT8 bAppExec1; + + bAppExec0 = gsBdspInfo.bAppExec0; + bAppExec1 = gsBdspInfo.bAppExec1; + + bAppExec0 |= psBdspInfo->bStoppedAppExec0; + bAppExec1 |= psBdspInfo->bStoppedAppExec1; + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_B + | (UINT32)MCI_AEEXEC0), + bAppExec0); + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_B + | (UINT32)MCI_AEEXEC1), + bAppExec1); + + McDevIf_ExecutePacket(); + + gsBdspInfo.bAppExec0 = bAppExec0; + gsBdspInfo.bAppExec1 = bAppExec1; +} + +/*************************************************************************** + * ResumePath + * + * Function: + * Resume path + * Arguments: + * psBdspInfo MCDRV_BDSP_AEC_BDSP_INFO + * structure pointer + * Return: + * none + * + ****************************************************************************/ +static void ResumePath(struct MCDRV_BDSP_AEC_BDSP_INFO *psBdspInfo) +{ + UINT8 bData; + + bData = gsBdspInfo.bAEBypass; + bData &= ~psBdspInfo->bStoppedBypass; + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_B + | (UINT32)MCI_AEBYPASS), + bData); + + McDevIf_ExecutePacket(); + + gsBdspInfo.bAEBypass = bData; +} + +/*************************************************************************** + * ReStart + * + * Function: + * Restart + * Arguments: + * psBdspInfo MCDRV_BDSP_AEC_BDSP_INFO + * structure pointer + * Return: + * none + * + ****************************************************************************/ +static void ReStart(struct MCDRV_BDSP_AEC_BDSP_INFO *psBdspInfo) +{ + if (psBdspInfo->pbFwctrlB != NULL) { + NewAppOn(psBdspInfo); + + SinStart(psBdspInfo); + + NewPath(psBdspInfo); + + AudioIFPath(psBdspInfo); + } else { + ResumeAppOn(psBdspInfo); + + SinStart(psBdspInfo); + + ResumePath(psBdspInfo); + } +} + +/*************************************************************************** + * SetAudioEngine + * + * Function: + * AudioEngine setting + * Arguments: + * psBdspInfo MCDRV_BDSP_AEC_BDSP_INFO + * structure pointer + * Return: + * 0 SUCCESS + * < 0 ERROR + * + ****************************************************************************/ +static SINT32 SetAudioEngine(struct MCDRV_BDSP_AEC_BDSP_INFO *psBdspInfo) +{ + SINT32 sdResult; + + if ((gsBdspInfo.bDSPCtl & (UINT8)MCB_BDSPSTART) == 0) { + psBdspInfo->bAe0AppOnOff = 0; + psBdspInfo->bAe1AppOnOff = 0; + psBdspInfo->bAppGen = 0; + psBdspInfo->dCoefTarget = TARGET_NONE; + psBdspInfo->bCoefTrans = COEF_DMA_TRANS; + psBdspInfo->dRegAppStopTarget = TARGET_NONE; + } + + sdResult = Stop(psBdspInfo); + if (sdResult < (SINT32)MCDRV_SUCCESS) + return sdResult; + + Download(psBdspInfo); + + ReStart(psBdspInfo); + + return MCDRV_SUCCESS; +} + +/*************************************************************************** + * Upload + * + * Function: + * upload + * Arguments: + * bAdr0 address0 + * dAddress address + * bBMACtl control register value + * dSize size + * dUnitSize unit size + * pbData Pointer to the data get area + * Return: + * none + * + ****************************************************************************/ +static void Upload(UINT8 bAdr0, UINT32 dAddress, UINT8 bBMACtl, + UINT32 dSize, UINT32 dUnitSize, UINT8 *pbData) +{ + UINT8 bAdr1; + UINT8 bAdr2; + UINT32 i; + + bAdr1 = (UINT8)((dAddress >> 8) & (UINT32)MCB_BMAA1); + bAdr2 = (UINT8)(dAddress & (UINT32)MCB_BMAA2); + + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_BMAA0), + bAdr0); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_BMAA1), + bAdr1); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_BMAA2), + bAdr2); + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_BMACTL), + bBMACtl); + + McDevIf_ExecutePacket(); + + for (i = 0; i < dSize; i++) { + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_BMAD), + &pbData[(i * dUnitSize) + 0], + 1); + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_BMAD), + &pbData[(i * dUnitSize) + 1], + 1); + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_BMAD), + &pbData[(i * dUnitSize) + 2], + 1); + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_BMAD), + &pbData[(i * dUnitSize) + 3], + 1); + } + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_BMAA0), + MCI_BMAA0_DEF); + McDevIf_ExecutePacket(); +} + +/*************************************************************************** + * McBdsp_Init + * + * Function: + * initialize + * Arguments: + * none + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR + * + ****************************************************************************/ +SINT32 McBdsp_Init(void) +{ + static UINT8 abFaderCoef[17] = { + 0x00, 0x00, 0x00, 0x00, /* address */ + 0x00, + 0x00, 0x00, 0x00, 0x08, /* size 8 (4 * 2)*/ + 0xF8, 0x44, 0x41, 0x78, /* CFADE_0 10ms */ + 0xF8, 0x44, 0x41, 0x78 /* CFADE_1 10ms */ + }; + + if (gsBdspInfo.dStatus != (UINT32)BDSP_STATUS_IDLE) + return MCDRV_ERROR; + + gsBdspInfo.bDSPBypass = MCB_BDSPBYPASS; + gsBdspInfo.bSinCtrlSel = BDSP_SIN_CTRL_REG; + + gsBdspInfo.bDSPCtl = MCI_BDSPCTRL_DEF; + gsBdspInfo.bAppExec0 = MCI_AEEXEC0_DEF; + gsBdspInfo.bAppExec1 = MCI_AEEXEC1_DEF; + gsBdspInfo.bAEBypass = MCI_AEBYPASS_DEF; + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_B + | (UINT32)MCI_BDSPCTRL), + gsBdspInfo.bDSPCtl); + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_B + | (UINT32)MCI_AEEXEC0), + gsBdspInfo.bAppExec0); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_B + | (UINT32)MCI_AEEXEC1), + gsBdspInfo.bAppExec1); + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_B + | (UINT32)MCI_AEBYPASS), + gsBdspInfo.bAEBypass); + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_B + | (UINT32)MCI_AEFADE), + MCI_AEFADE_DEF); + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_B + | (UINT32)MCI_F01SEL), + MCI_F01SEL_DEF); + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_B + | (UINT32)MCI_SINOUT), + MCI_SINOUT_DEF); + + McDevIf_ExecutePacket(); + + gsBdspInfo.dStatus = (UINT32)BDSP_STATUS_INITED; + + AppCoefDL(abFaderCoef, COEF_DMA_TRANS); + + return MCDRV_SUCCESS; +} + +/*************************************************************************** + * McBdsp_Term + * + * Function: + * terminate + * Arguments: + * none + * Return: + * MCDRV_SUCCESS + * + ****************************************************************************/ +SINT32 McBdsp_Term(void) +{ + if (gsBdspInfo.dStatus == (UINT32)BDSP_STATUS_IDLE) + return MCDRV_SUCCESS; + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_B + | (UINT32)MCI_BDSPCTRL), + MCI_BDSPCTRL_DEF); + + McDevIf_ExecutePacket(); + + gsBdspInfo.dStatus = (UINT32)BDSP_STATUS_IDLE; + + return MCDRV_SUCCESS; +} + +/*************************************************************************** + * McBdsp_GetTransition + * + * Function: + * Get control state + * Arguments: + * none + * Return: + * state + * + ****************************************************************************/ +SINT32 McBdsp_GetTransition(void) +{ + SINT32 sdResult; + UINT8 bData; + + sdResult = 0; + + if (gsBdspInfo.dStatus == (UINT32)BDSP_STATUS_IDLE) + return sdResult; + + /* AE1FADE,AE0FADE */ + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_B | (UINT32)MCI_AEFADE), + &bData, 1); + + if ((bData & MCB_AEFADE_AE0) != 0) + sdResult |= (SINT32)BDSP_PRC_FADE_AE0; + if ((bData & MCB_AEFADE_AE1) != 0) + sdResult |= (SINT32)BDSP_PRC_FADE_AE1; + + /* SINOFLG */ + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_B | (UINT32)MCI_SINOUTFLG), + &bData, 1); + if ((bData & MCB_SINOFLG) != 0) + sdResult |= (SINT32)BDSP_PRC_SINOUT; + + /* DSP Coef Trance */ + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_BDSPTREQ), + &bData, 1); + if ((bData & MCB_BDSPTREQ) != 0) + sdResult += (SINT32)BDSP_PRC_COEF_TRS; + + return sdResult; +} + +/*************************************************************************** + * McBdsp_GetDSP + * + * Function: + * Get dsp data + * Arguments: + * dTarget target + * dAddress address + * pbData Pointer to the data get area + * dSize data size + * Return: + * + * + ****************************************************************************/ +SINT32 McBdsp_GetDSP(UINT32 dTarget, UINT32 dAddress, + UINT8 *pbData, UINT32 dSize) +{ + UINT8 bBMACtl; + UINT32 dUnitSize; + + if (pbData == NULL) + return MCDRV_ERROR_ARGUMENT; + + bBMACtl = MCB_BMADIR_UL; + dUnitSize = 0; + + switch (dTarget) { + case BDSP_AE_FW_DXRAM: + if (DXRAM_RANGE_MAX < dAddress) + return MCDRV_ERROR_ARGUMENT; + + dUnitSize = RAM_UNIT_SIZE_64; + dSize = (dSize / dUnitSize); + + if ((DXRAM_RANGE_MAX + 1) < dSize) + dSize = DXRAM_RANGE_MAX + 1; + + if ((DXRAM_RANGE_MAX + 1) < (dAddress + dSize)) + dSize -= ((dAddress + dSize) + - (DXRAM_RANGE_MAX + 1)); + bBMACtl |= MCB_BMABUS_X; + break; + + case BDSP_AE_FW_DYRAM: + if (DYRAM_RANGE_MAX < dAddress) + return MCDRV_ERROR_ARGUMENT; + + dUnitSize = RAM_UNIT_SIZE_32; + dSize = (dSize / dUnitSize); + + if ((DYRAM_RANGE_MAX + 1) < dSize) + dSize = (DYRAM_RANGE_MAX + 1); + + if ((DYRAM_RANGE_MAX + 1) < (dAddress + dSize)) + dSize -= ((dAddress + dSize) + - (DYRAM_RANGE_MAX + 1)); + + bBMACtl |= MCB_BMABUS_Y; + break; + + default: + return MCDRV_ERROR_ARGUMENT; + } + + if (dSize == 0) + return 0; + + if (gsBdspInfo.dStatus == (UINT32)BDSP_STATUS_IDLE) + return 0; + + if (dTarget == BDSP_AE_FW_DXRAM) { + Upload(MCB_BMAA0, dAddress, bBMACtl, dSize, dUnitSize, pbData); + + Upload(MCI_BMAA0_DEF, dAddress, bBMACtl, dSize, dUnitSize, + &pbData[4]); + + } else + Upload(MCI_BMAA0_DEF, dAddress, bBMACtl, dSize, dUnitSize, + pbData); + + return (SINT32)(dSize * dUnitSize); +} + +/*************************************************************************** + * McBdsp_SetDSPCheck + * + * Function: + * DSP configuration check + * Arguments: + * psPrm MCDRV_AEC_INFO structure pointer + * Return: + * 0 SUCCESS + * < 0 ERROR + * + ****************************************************************************/ +SINT32 McBdsp_SetDSPCheck(struct MCDRV_AEC_INFO *psPrm) +{ + SINT32 sdResult; + struct MCDRV_BDSP_AEC_BDSP_INFO sBdspInfo; + + if (psPrm == NULL) + return MCDRV_ERROR_ARGUMENT; + + GetBDSPChunk(psPrm, &sBdspInfo); + + sdResult = BdspChunkAnalyze(&sBdspInfo); + if (sdResult < (SINT32)MCDRV_SUCCESS) + return sdResult; + + return MCDRV_SUCCESS; +} + +/*************************************************************************** + * McBdsp_SetDSP + * + * Function: + * DSP settings + * Arguments: + * psPrm MCDRV_AEC_INFO structure pointer + * Return: + * 0 SUCCESS + * < 0 ERROR + * + ****************************************************************************/ +SINT32 McBdsp_SetDSP(struct MCDRV_AEC_INFO *psPrm) +{ + SINT32 sdResult; + struct MCDRV_BDSP_AEC_BDSP_INFO sBdspInfo; + + if (psPrm == NULL) + return MCDRV_ERROR_ARGUMENT; + + GetBDSPChunk(psPrm, &sBdspInfo); + + sdResult = BdspChunkAnalyze(&sBdspInfo); + if (sdResult < (SINT32)MCDRV_SUCCESS) + return sdResult; + + if ((sBdspInfo.pbChunkData == NULL) || (sBdspInfo.dwSize == 0)) + return MCDRV_SUCCESS; + + if (gsBdspInfo.dStatus == (UINT32)BDSP_STATUS_IDLE) + return MCDRV_ERROR; + + sdResult = SetAudioEngine(&sBdspInfo); + + return sdResult; +} + +/*************************************************************************** + * McBdsp_Start + * + * Function: + * Dsp start + * Arguments: + * none + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR + * + ****************************************************************************/ +SINT32 McBdsp_Start(void) +{ + if (gsBdspInfo.dStatus == (UINT32)BDSP_STATUS_IDLE) + return MCDRV_ERROR; + + if ((gsBdspInfo.bDSPBypass & MCB_BDSPBYPASS) != 0) + gsBdspInfo.bDSPCtl = (UINT8)MCB_BDSPBYPASS; + else + gsBdspInfo.bDSPCtl = (UINT8)MCB_BDSPSTART; + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_B + | (UINT32)MCI_BDSPCTRL), + gsBdspInfo.bDSPCtl); + + McDevIf_ExecutePacket(); + + return MCDRV_SUCCESS; +} + +/*************************************************************************** + * McBdsp_Stop + * + * Function: + * Dsp stop + * Arguments: + * none + * Return: + * MCDRV_SUCCESS + * + ****************************************************************************/ +SINT32 McBdsp_Stop(void) +{ + if (gsBdspInfo.dStatus == (UINT32)BDSP_STATUS_IDLE) + return MCDRV_SUCCESS; + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_BDSPTREQ), + MCI_BDSPTREQ_DEF); + + gsBdspInfo.bDSPCtl = (UINT8)MCI_BDSPCTRL_DEF; + McDevIf_AddPacket((MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_B + | (UINT32)MCI_BDSPCTRL), + gsBdspInfo.bDSPCtl); + + McDevIf_ExecutePacket(); + + return MCDRV_SUCCESS; +} + diff --git a/sound/soc/codecs/ymu831/mcbdspdrv.h b/sound/soc/codecs/ymu831/mcbdspdrv.h new file mode 100644 index 00000000000..61c4343fa6a --- /dev/null +++ b/sound/soc/codecs/ymu831/mcbdspdrv.h @@ -0,0 +1,73 @@ +/**************************************************************************** + * + * Copyright(c) 2012 Yamaha Corporation. All rights reserved. + * + * Module : mcbdspdrv.h + * + * Description : MC Bdsp Driver header + * + * Version : 1.0.0 2012.12.13 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + * + ****************************************************************************/ +#ifndef _MCBDSPDRV_H_ +#define _MCBDSPDRV_H_ + +/* outside definition */ + +#define AEC_AUDIOENGINE_ENABLE (1) +#define AEC_AUDIOENGINE_DISABLE (0) + +#define BDSP_OFF (0) +#define BDSP_ON (1) + +#define BDSP_APP_EXEC_STOP (0) +#define BDSP_APP_EXEC_START (1) +#define BDSP_APP_EXEC_DONTCARE (2) + +#define BDSP_PRC_FADE_AE0 (0x01) +#define BDSP_PRC_FADE_AE1 (0x02) +#define BDSP_PRC_SINOUT (0x04) +#define BDSP_PRC_COEF_TRS (0x08) + +#define BDSP_NORMAL (0) +#define BDSP_BYPASS (1) + +#define BDSP_AE_FW_DXRAM (1) +#define BDSP_AE_FW_DYRAM (2) + +/* outside Struct */ +#if defined(__cplusplus) +extern "C" { +#endif + +SINT32 McBdsp_Init(void); +SINT32 McBdsp_Term(void); +SINT32 McBdsp_GetTransition(void); +SINT32 McBdsp_GetDSP(UINT32 dTarget, UINT32 dAddress, + UINT8 *pbData, UINT32 dSize); +SINT32 McBdsp_SetDSPCheck(struct MCDRV_AEC_INFO *pbPrm); +SINT32 McBdsp_SetDSP(struct MCDRV_AEC_INFO *pbPrm); +SINT32 McBdsp_Start(void); +SINT32 McBdsp_Stop(void); + +#if defined(__cplusplus) +} +#endif + +#endif /* _MCBDSPDRV_H_ */ diff --git a/sound/soc/codecs/ymu831/mccdspdrv.c b/sound/soc/codecs/ymu831/mccdspdrv.c new file mode 100644 index 00000000000..838ded47fbf --- /dev/null +++ b/sound/soc/codecs/ymu831/mccdspdrv.c @@ -0,0 +1,8573 @@ +/**************************************************************************** + * + * Copyright(c) 2012-2013 Yamaha Corporation. All rights reserved. + * + * Module : mccdspdrv.c + * + * Description : CDSP Driver + * + * Version : 2.0.1 2013.05.02 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + * + ****************************************************************************/ +#include "mctypedef.h" +#include "mcdevif.h" +#include "mcdefs.h" +#include "mcresctrl.h" +#include "mccdspdrv.h" +#include "mccdspos.h" + + + +/* macro */ + +#ifndef LOBYTE +#define LOBYTE(w) (UINT8)((UINT32)(w) & 0xFFUL) +#endif /* LOBYTE */ +#ifndef HIBYTE +#define HIBYTE(w) (UINT8)((UINT32)(w) >> 8) +#endif /* HIBYTE */ +#ifndef MAKEWORD +#define MAKEWORD(l, h) ((UINT16)((UINT32)(l) & 0xff) \ + | (UINT16)(((UINT32)(h) & 0xff) << 8)) +#endif /* LOBYTE */ +#ifndef MAKEBYTE +#define MAKEBYTE(l, h) (UINT8)(((l) & 0x0f) \ + | (((h) << 4) & 0xf0)) +#endif /* LOBYTE */ + +/* definition */ + +#define AEC_VBOX_DISABLE (0) +#define AEC_VBOX_ENABLE (1) + +#define CDSP_FUNC_OFF (0) +#define CDSP_FUNC_ON (1) + +#define MCDRV_CDSP_EVT_ERROR (11) +#define MCDRV_CDSP_EVT_PARAM (12) +#define MCDRV_CDSP_EVT_END (13) +#define MCDRV_CDSP_EVT_FIFO (14) +#define MCDRV_CDSP_EVT_TIMER (15) + + +#define CODER_DEC (0) /* FuncA */ +#define CODER_ENC (1) /* FuncB */ +#define CODER_NUM (2) + +/* state */ +#define STATE_NOTINIT (0) +#define STATE_INIT (1) +#define STATE_READY_SETUP (2) +#define STATE_READY (3) +#define STATE_PLAYING (4) + +/* call back */ + +#define CALLBACK_HOSTCOMMAND (0) /* Host command */ +#define CALLBACK_END_OF_SEQUENCE (1) /* End */ +#define CALLBACK_DFIFOPOINT (2) /* DEC_FIFO IRQ point */ +#define CALLBACK_RFIFOPOINT (3) /* REC_FIFO IRQ point */ +#define CALLBACK_DFIFOEMPTY (4) /* DEC_FIFO empty */ +#define CALLBACK_RECBUF_OVF (5) /* Record buffer over flow */ +#define CALLBACK_TIMER (6) /* Timer */ +#define CALLBACK_PLAY_ERROR1 (7) /* Play error */ +#define CALLBACK_PLAY_ERROR2 (8) /* Play error */ +#define CALLBACK_HW_ERROR (9) /* Hardware error */ +#define CALLBACK_COUNT (10) +#define CALLBACK_OFF (0) +#define CALLBACK_ON (1) + +/* callback position */ + +#define CBPOS_DFIFO_NONE (-1) +#define CBPOS_DFIFO_DEF (2048) +#define CBPOS_DFIFO_MIN (0) +#define CBPOS_DFIFO_MAX (4096) + +#define CBPOS_RFIFO_NONE (-1) +#define CBPOS_RFIFO_DEF (2048) +#define CBPOS_RFIFO_MIN (0) +#define CBPOS_RFIFO_MAX (4096) + +/* Program download flag */ + +#define PROGRAM_NO_DOWNLOAD (0) +#define PROGRAM_DOWNLOAD (1) + +/* Program parameter */ + +#define PRG_DESC_VENDER_ID (0) +#define PRG_DESC_FUNCTION_ID (2) +#define PRG_DESC_PRG_TYPE (4) +#define PRG_DESC_OUTPUT_TYPE (6) +#define PRG_DESC_PRG_SCRAMBLE (8) +#define PRG_DESC_DATA_SCRAMBLE (10) +#define PRG_DESC_ENTRY_ADR (12) +#define PRG_DESC_PRG_LOAD_ADR (14) +#define PRG_DESC_PRG_SIZE (16) +#define PRG_DESC_DATA_LOAD_ADR (18) +#define PRG_DESC_DATA_SIZE (20) +#define PRG_DESC_WORK_BEGIN_ADR (22) +#define PRG_DESC_WORK_SIZE (24) +#define PRG_DESC_STACK_BEGIN_ADR (26) +#define PRG_DESC_STACK_SIZE (28) +#define PRG_DESC_OUTSTARTMODE (30) +#define PRG_DESC_RESOURCE_FLAG (32) +#define PRG_DESC_MAX_LOAD (34) +#define PRG_DESC_PROGRAM (36) + +/* Program data parameter */ + +#define PRG_PRM_TYPE_TASK0 (0x0001) +#define PRG_PRM_TYPE_TASK1 (0x0002) +#define PRG_PRM_SCRMBL_DISABLE (0x0000) +#define PRG_PRM_SCRMBL_ENABLE (0x0001) +#define PRG_PRM_IOTYPE_IN_MASK (0xFF00) +#define PRG_PRM_IOTYPE_IN_PCM (0x0000) +#define PRG_PRM_IOTYPE_IN_NOPCM (0x0100) +#define PRG_PRM_IOTYPE_OUT_MASK (0x00FF) +#define PRG_PRM_IOTYPE_OUT_PCM (0x0000) +#define PRG_PRM_IOTYPE_OUT_NOPCM (0x0001) + +/* OS parameter */ + +#define ADR_OS_PROG_L (0x00) +#define ADR_OS_PROG_H (0x00) +#define ADR_OS_DATA_L (0x00) +#define ADR_OS_DATA_H (0x00) + +/* CDSP MSEL */ + +#define MSEL_PROG (0x00) +#define MSEL_DATA (0x01) + +/* FIFO size */ + +#define FIFOSIZE_DFIFO (4096) +#define FIFOSIZE_OFIFO (8192) +#define FIFOSIZE_EFIFO (8192) +#define FIFOSIZE_RFIFO (4096) +#define FIFOSIZE_FFIFO (1024) + +#define DFIFO_DUMMY_SPACE (2) + +/* FIFO ID */ + +#define FIFO_NONE (0x00000000L) +#define FIFO_DFIFO_MASK (0x000000FFL) +#define FIFO_DFIFO (0x00000001L) +#define FIFO_EFIFO_MASK (0x0000FF00L) +#define FIFO_EFIFO (0x00000100L) +#define FIFO_OFIFO_MASK (0x00FF0000L) +#define FIFO_OFIFO (0x00010000L) +#define FIFO_RFIFO_MASK (0xFF000000L) +#define FIFO_RFIFO (0x01000000L) + +#define PORT_SEL_NONE (0) +#define PORT_SEL_NORMAL (1) +#define PORT_SEL_REF (2) + +#define RFIFO_CH_NUM (2) +#define RFIFO_BIT_WIDTH (16) + +/* format */ + +#define CODER_FMT_FS_48000 (0) +#define CODER_FMT_FS_44100 (1) +#define CODER_FMT_FS_32000 (2) +#define CODER_FMT_FS_24000 (4) +#define CODER_FMT_FS_22050 (5) +#define CODER_FMT_FS_16000 (6) +#define CODER_FMT_FS_12000 (8) +#define CODER_FMT_FS_11025 (9) +#define CODER_FMT_FS_8000 (10) + +#define CODER_FMT_ETOBUF_LRMIX (0) +#define CODER_FMT_ETOBUF_LCH (1) +#define CODER_FMT_ETOBUF_RCH (2) + +#define CODER_FMT_BUFTOO_NONE (0) +#define CODER_FMT_BUFTOO_CONV (1) + +/* InputDataEnd Command */ + +#define INPUTDATAEND_EMPTY (0) +#define INPUTDATAEND_WRITE (1) + +/* TimerReste Command */ + +#define TIMERRESET_RESET (0) +#define TIMERRESET_OFF (1) + +/* dual mono */ + +#define CODER_DUALMONO_LR (0) +#define CODER_DUALMONO_L (1) +#define CODER_DUALMONO_R (2) + +/* Fs */ + +#define OUTPUT_FS_8000 (8000) +#define OUTPUT_FS_11025 (11025) +#define OUTPUT_FS_12000 (12000) +#define OUTPUT_FS_16000 (16000) +#define OUTPUT_FS_22050 (22050) +#define OUTPUT_FS_24000 (24000) +#define OUTPUT_FS_32000 (32000) +#define OUTPUT_FS_44100 (44100) +#define OUTPUT_FS_48000 (48000) +#define OUTPUT_FS_MIN OUTPUT_FS_8000 +#define OUTPUT_FS_MAX OUTPUT_FS_48000 +#define OUTPUT_FS_DEF OUTPUT_FS_48000 + +/* Start Sample */ + +#define OFIFO_BUF_SAMPLE_MIN (0) +#define OFIFO_BUF_SAMPLE_MAX (1024) +#define OFIFO_BUF_SAMPLE_DEF (500) + +#define RFIFO_BUF_SAMPLE_MIN (0) +#define RFIFO_BUF_SAMPLE_MAX (512) +#define RFIFO_BUF_SAMPLE_DEF (500) + +/* Start Flag */ + +#define OUTPUT_START_OFF (0) +#define OUTPUT_START_ON (1) + +/* data end */ + +#define INPUT_DATAEND_RELEASE (0) +#define INPUT_DATAEND_SET (1) + +/* Stop: verify stop completion */ + +#define MADEVCDSP_VERIFY_COMP_OFF (0) +#define MADEVCDSP_VERIFY_COMP_ON (1) + +#define CHANGE_OUTPUT_FS_OFF (0) +#define CHANGE_OUTPUT_FS_ON (1) + +#define FORMAT_PROPAGATE_OFF (0) +#define FORMAT_PROPAGATE_ON (1) + +/* EVT */ + +#define EVENT_TIMER (0x01) +#define EVENT_CLEAR (0x00) + +/* Error code: CDSP */ + +#define CDSP_ERR_NO_ERROR (0x0000) +#define CDSP_ERR_MEM_PROTECTION (0xFFF1) +#define CDSP_ERR_WDT (0xFFF2) +#define CDSP_ERR_PROG_DOWNLOAD (0xFFFF) + +/* Error code: DEC/ENC */ + +#define DEC_ERR_NO_ERROR (0x00) +#define DEC_ERR_PROG_SPECIFIC_MIN (0x01) +#define DEC_ERR_PROG_SPECIFIC_MAX (0xEF) +#define DEC_ERR_NOT_READY (0xF0) +#define DEC_ERR_MEM_PROTECTION (0xF1) +#define DEC_ERR_WDT (0xF2) + +/* c-dsp chunk */ +#define CHUNK_SIZE (8) + +#define CDSP_FUNC_NUMBER (0) + +#define AEC_CDSP_TAG_PROG (0x00001000) +#define PROG_FIX_SIZE (4) +#define AEC_CDSP_TAG_PRM (0x00001100) +#define PRM_FIX_SIZE (4) +#define PRM_UNIT_SIZE (17) +#define AEC_CDSP_TAG_FIFO (0x00001200) +#define FIFO_FIX_SIZE (26) +#define AEC_CDSP_TAG_EXT (0x00001300) +#define EXT_FIX_SIZE (5) + +#define ROUTE_OUT0L_SEL (0) +#define ROUTE_OUT0R_SEL (1) +#define ROUTE_OUT1L_SEL (2) +#define ROUTE_OUT1R_SEL (3) +#define ROUTE_OUT2L_SEL (4) +#define ROUTE_OUT2R_SEL (5) +#define ROUTE_EFIFO0_SEL (6) +#define ROUTE_EFIFO1_SEL (7) +#define ROUTE_EFIFO2_SEL (8) +#define ROUTE_EFIFO3_SEL (9) +#define CDSP_EFIFO_CH (10) +#define CDSP_EFIFO_BIT_WIDTH (11) +#define CDSP_EFIFO_E2BUF_MODE (12) +#define CDSP_OFIFO_CH (13) +#define CDSP_OFIFO_BIT_WIDTH (14) +#define CDSP_DFIFO_BIT_WIDTH (15) +#define CDSP_RFIFO_BIT_WIDTH (16) +#define CDSP_USE_FIFO (17) +#define CDSP_DFIFO_CB_POINT (18) /* 2Byte */ +#define CDSP_RFIFO_CB_POINT (20) /* 2Byte */ +#define CDSP_OFIFO_BUFFERING (22) /* 2Byte */ +#define CDSP_RFIFO_BUFFERING (24) /* 2Byte */ + +#define OUT_LOOPBACK_L (4) +#define OUT_LOOPBACK_R (5) + +#define CDSP_FIFO_MASK 0x0F +#define CDSP_FIFO_EFIFO_BIT 0x01 +#define CDSP_FIFO_OFIFO_BIT 0x02 +#define CDSP_FIFO_DFIFO_BIT 0x04 +#define CDSP_FIFO_RFIFO_BIT 0x08 +#define CDSP_FIFO_OTHER_MASK 0xF0 +#define CDSP_FIFO_OTHER_OUTBUF_BIT 0x10 +#define CDSP_FIFO_OTHER_INBUF_BIT 0x20 + +#define CDSP_FIFO_DONTCARE 0xFF +#define CDSP_FIFO_DONTCARE_W 0xFFFF +#define CDSP_FIFO_DONTCARE_CB 0xFFFE +#define CDSP_FIFO_NOT_CB 0xFFFF + +#define CDSP_PRM_CMD (0) +#define CDSP_PRM_PRM0 (1) + +#define AEC_FUNC_INFO_A (0) +#define AEC_FUNC_INFO_B (1) +#define AEC_FUNC_INFO_NUM (2) + +#define EXT_COMMAND (0) +#define EXT_COMMAND_CLEAR (1) + +/* struct */ + +struct FSQ_DATA_INFO { + const UINT8 *pbData; + UINT16 wSize; + UINT16 wLoadAddr; + UINT16 wScramble; + UINT8 bMsel; +}; + +struct FIFO_INFO { + SINT32 sdDFifoCbPos; /* DFIFO */ + SINT32 sdRFifoCbPos; /* RFIFO */ + UINT32 dOFifoBufSample; /* OFIFO */ + UINT8 bOFifoOutStart; + UINT32 dDFifoWriteSize; + UINT32 dRFifoBufSample; + UINT8 bRFifoOutStart; + + UINT8 bOut0Sel; + UINT8 bOut1Sel; + UINT8 bOut2Sel; + UINT8 bRDFifoBitSel; + UINT8 bEFifo01Sel; + UINT8 bEFifo23Sel; +}; + +struct VERSION_INFO { + UINT16 wVersionH; + UINT16 wVersionL; +}; + +struct CALLBACK_INFO { + SINT32(*pcbFunc)(SINT32, UINT32, UINT32); /* Callback function */ + UINT8 abCbOn[CALLBACK_COUNT]; + UINT32 adCbExInfo[CALLBACK_COUNT]; +}; + +struct PROGRAM_INFO { + UINT16 wVendorId; + UINT16 wFunctionId; + UINT16 wProgType; + UINT16 wInOutType; + UINT16 wProgScramble; + UINT16 wDataScramble; + UINT16 wEntryAddress; + UINT16 wProgLoadAddr; + UINT16 wProgSize; + UINT16 wDataLoadAddr; + UINT16 wDataSize; + UINT16 wWorkBeginAddr; + UINT16 wWorkSize; + UINT16 wStackBeginAddr; + UINT16 wStackSize; + UINT16 wOutStartMode; + UINT16 wResourceFlag; + UINT16 wMaxLoad; +}; + +struct FORMAT_INFO { + UINT8 bFs; + UINT8 bE2BufMode; +}; + +struct CONNECTION_INFO { + UINT8 bInSource; + UINT8 bOutDest; +}; + +struct CONNECTION_EX_INFO { + UINT8 bEfifoCh; + UINT8 bOfifoCh; +}; + +struct BIT_WIDTH_INFO { + UINT8 bEfifoBit; + UINT8 bOfifoBit; +}; + +struct DEC_INFO { + UINT32 dCoderId; /* ID */ + UINT32 dState; /* State */ + UINT8 bPreInputDataEnd; + UINT8 bInputDataEnd; /* input date end */ + UINT8 bChangeOutputFs; + UINT8 bFmtPropagate; + UINT32 dInPosSup; /* Input Pos */ + UINT16 wErrorCode; /* Task's error code */ + struct CALLBACK_INFO sCbInfo; + struct VERSION_INFO sProgVer; /* Program version */ + struct PROGRAM_INFO sProgInfo; /* Program infor */ + struct FORMAT_INFO sFormat; /* Format */ + struct CONNECTION_INFO sConnect; /* Connection */ + struct CONNECTION_EX_INFO sConnectEx; /* ConnectionEx */ + struct BIT_WIDTH_INFO sBitWidth; /* Bit Width */ + struct MC_CODER_PARAMS sParams; /* C-DSP Cmd Prm */ +}; + +struct CDSP_INFO { + UINT16 wHwErrorCode; /* Hw's error code */ + struct VERSION_INFO sOsVer; /* OS version */ +}; + +struct AEC_CDSP_FUNC_INFO { + UINT32 dCoderId; + UINT8 bFuncOnOff; + UINT8 *pbChunk; + UINT32 dChunkSize; + UINT8 *pbFifo; + UINT8 *pbProg; + UINT32 dProgSize; + UINT8 *pbParam; + UINT32 dParamNum; + UINT8 *pbExt; + + struct FORMAT_INFO sFormat; + struct CONNECTION_INFO sConnect; + struct CONNECTION_EX_INFO sConnectEx; + struct BIT_WIDTH_INFO sBitWidth; + UINT16 wInOutType; +}; + +struct MCDRV_CDSP_AEC_CDSP_INFO { + struct AEC_CDSP_FUNC_INFO asFuncInfo[AEC_FUNC_INFO_NUM]; + + SINT32 sdDFifoCbPos; + SINT32 sdRFifoCbPos; + UINT32 dOFifoBufSample; + UINT32 dRFifoBufSample; + UINT8 bOut0Sel; + UINT8 bOut1Sel; + UINT8 bOut2Sel; + UINT8 bRDFifoBitSel; + UINT8 bEFifo01Sel; + UINT8 bEFifo23Sel; +}; + +static struct CDSP_INFO gsCdspInfo = { + CDSP_ERR_NO_ERROR, /* wHwErrorCode */ + { /* sOsVer */ + 0, /* wVersionH */ + 0 /* wVersionL */ + } +}; + +static struct FIFO_INFO gsFifoInfo = { + 0, /* sdDFifoCbPos */ + 0, /* sdRFifoCbPos */ + 0, /* dOFifoBufSample */ + 0, /* bOFifoOutStart */ + 0, /* dDFifoWriteSize */ + 0, + 0, + 0, + 0, + 0, + 0 +}; + +static struct DEC_INFO gsDecInfo = { + CODER_DEC, /* dCoderId */ + STATE_NOTINIT, /* dState */ + INPUT_DATAEND_RELEASE, /* bPreInputDataEnd */ + INPUT_DATAEND_RELEASE, /* bInputDataEnd */ + CHANGE_OUTPUT_FS_OFF, /* bChangeOutputFs */ + FORMAT_PROPAGATE_OFF, /* bFmtPropagate */ + 0, /* dInPosSup */ + 0, /* wErrorCode */ + { /* sCbInfo */ + NULL, /* pcbFunc */ + { /* abCbOn */ + CALLBACK_OFF, + CALLBACK_OFF, + CALLBACK_OFF, + CALLBACK_OFF, + CALLBACK_OFF, + CALLBACK_OFF, + CALLBACK_OFF, + CALLBACK_OFF, + CALLBACK_OFF, + CALLBACK_OFF + }, + { /* adCbExInfo */ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + }, + }, + { /* sProgVer */ + 0, /* wVersionH */ + 0 /* wVersionL */ + }, + { /* sProgInfo */ + 0, /* wVendorId */ + 0, /* wFunctionId */ + 0, /* wProgType */ + 0, /* wInOutType */ + 0, /* wProgScramble */ + 0, /* wDataScramblev*/ + 0, /* wEntryAddress */ + 0, /* wProgLoadAddr */ + 0, /* wProgSize */ + 0, /* wDataLoadAddr */ + 0, /* wDataSize */ + 0, /* wWorkBeginAddr */ + 0, /* wWorkSize */ + 0, /* wStackBeginAddr */ + 0, /* wStackSize */ + 0, /* wOutStartMode */ + 0, /* wResourceFlag */ + 0 /* wMaxLoad */ + }, + { /* sFormat */ + CODER_FMT_FS_48000, /* bFs */ + CODER_FMT_ETOBUF_LRMIX /* bE2BufMode */ + }, + { /* sConnect */ + CDSP_IN_SOURCE_NONE, /* bInSource */ + CDSP_OUT_DEST_NONE /* bOutDest */ + }, + { /* sConnectEx */ + 2, /* bEfifoCh */ + 2 /* bOfifoCh */ + }, + { /* sBitWidth */ + 16, /* bEfifoBit */ + 16 /* bOfifoBit */ + }, + { /* sParams */ + 0, /* bCommandId */ + { /* abParam */ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + }, + } +}; + +static struct DEC_INFO gsEncInfo = { + CODER_ENC, /* dCoderId */ + STATE_NOTINIT, /* dState */ + INPUT_DATAEND_RELEASE, /* bPreInputDataEnd */ + INPUT_DATAEND_RELEASE, /* bInputDataEnd */ + CHANGE_OUTPUT_FS_OFF, /* bChangeOutputFs */ + FORMAT_PROPAGATE_OFF, /* bFmtPropagate */ + 0, /* dInPosSup */ + 0, /* wErrorCode */ + { /* sCbInfo */ + NULL, /* pcbFunc */ + { /* abCbOn */ + CALLBACK_OFF, + CALLBACK_OFF, + CALLBACK_OFF, + CALLBACK_OFF, + CALLBACK_OFF, + CALLBACK_OFF, + CALLBACK_OFF, + CALLBACK_OFF, + CALLBACK_OFF, + CALLBACK_OFF + }, + { /* adCbExInfo */ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + }, + }, + { /* sProgVer */ + 0, /* wVersionH */ + 0 /* wVersionL */ + }, + { /* sProgInfo */ + 0, /* wVendorId */ + 0, /* wFunctionId */ + 0, /* wProgType */ + 0, /* wInOutType */ + 0, /* wProgScramble */ + 0, /* wDataScramblev*/ + 0, /* wEntryAddress */ + 0, /* wProgLoadAddr */ + 0, /* wProgSize */ + 0, /* wDataLoadAddr */ + 0, /* wDataSize */ + 0, /* wWorkBeginAddr */ + 0, /* wWorkSize */ + 0, /* wStackBeginAddr */ + 0, /* wStackSize */ + 0, /* wOutStartMode */ + 0, /* wResourceFlag */ + 0 /* wMaxLoad */ + }, + { /* sFormat */ + CODER_FMT_FS_48000, /* bFs */ + CODER_FMT_ETOBUF_LRMIX /* bE2BufMode */ + }, + { /* sConnect */ + CDSP_IN_SOURCE_NONE, /* bInSource */ + CDSP_OUT_DEST_NONE /* bOutDest */ + }, + { /* sConnectEx */ + 2, /* bEfifoCh */ + 2 /* bOfifoCh */ + }, + { /* sBitWidth */ + 16, /* bEfifoBit */ + 16 /* bOfifoBit */ + }, + { /* sParams */ + 0, /* bCommandId */ + { /* abParam */ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + }, + } +}; + + +/**************************************************************************** + * CreateUINT32 + * + * Description: + * Create UINT32 Value + * Arguments: + * b0 31-24bit value + * b1 23-16bit value + * b2 15-8bit value + * b3 7-0bit value + * Return: + * UINT32 Value + * + ****************************************************************************/ +static UINT32 CreateUINT32(UINT8 b0, UINT8 b1, UINT8 b2, UINT8 b3) +{ + return ((UINT32)b0 << 24) | ((UINT32)b1 << 16) + | ((UINT32)b2 << 8) | (UINT32)b3; +} + +/*************************************************************************** + * InitializeRegister + * + * Function: + * Initialize CDSP registers. + * Arguments: + * None + * Return: + * None + * + ****************************************************************************/ +static void InitializeRegister(void) +{ + SINT32 i; + + /* CDSP SRST */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_CDSP_RESET), + (MCB_CDSP_DMODE | MCB_CDSP_FSQ_SRST | MCB_CDSP_SRST)); + + /* Disable interrupt */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DEC_ENABLE), + 0x00); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_ENC_ENABLE), + 0x00); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DFIFO_ENABLE), + 0x00); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_OFIFO_ENABLE), + 0x00); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_EFIFO_ENABLE), + 0x00); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_RFIFO_ENABLE), + 0x00); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_FFIFO_ENABLE), + 0x00); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_CDSP_ENABLE), + 0x00); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_ECDSP), + 0x00); + + /* Clear interrupt flag */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DEC_FLG), + MCB_DEC_FLG_ALL); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_ENC_FLG), + MCB_ENC_FLG_ALL); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DFIFO_FLG), + MCB_DFIFO_FLG_ALL); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_OFIFO_FLG), + MCB_OFIFO_FLG_ALL); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_EFIFO_FLG), + MCB_EFIFO_FLG_ALL); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_RFIFO_FLG), + MCB_RFIFO_FLG_ALL); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_FFIFO_FLG), + MCB_FFIFO_FLG_ALL); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_CDSP_FLG), + MCB_CDSP_FLG_ALL); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_CDSP), + MCB_IRQFLAG_CDSP_ALL); + + /* Other registers */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DEC_START), + 0x00); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DEC_START2), + 0x00); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DEC_FIFO_RST), + 0x00); + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_PWM_DIGITAL_CDSP), + 0x00); + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DEC_POS4), + 0x00); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_ENC_POS4), + 0x00); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DFIFO_IRQ_PNT_H), + 0x00); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DFIFO_IRQ_PNT_L), + 0x00); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_OFIFO_IRQ_PNT_H), + 0x00); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_OFIFO_IRQ_PNT_L), + 0x00); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_EFIFO_IRQ_PNT_H), + 0x00); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_EFIFO_IRQ_PNT_L), + 0x00); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_RFIFO_IRQ_PNT_H), + 0x00); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_RFIFO_IRQ_PNT_L), + 0x00); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_FFIFO_IRQ_PNT_H), + 0x00); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_FFIFO_IRQ_PNT_L), + 0x00); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_CDSP_MAR_H), + 0x00); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_CDSP_MAR_L), + 0x00); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DEC_GPR_ENABLE), + 0x00); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DEC_SFR1), + 0x00); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DEC_SFR0), + 0x00); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_ENC_GPR_ENABLE), + 0x00); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_ENC_SFR1), + 0x00); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_ENC_SFR0), + 0x00); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DEC_EVT), + 0x00); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_ENC_EVT), + 0x00); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DEC_FIFO_CH), + 0x00); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_RDFIFO_BIT_SEL), + 0x00); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_OUT0_SEL), + MCI_OUT0_SEL_DEF); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_OUT1_SEL), + MCI_OUT1_SEL_DEF); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_OUT2_SEL), + MCI_OUT2_SEL_DEF); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_EFIFO01_SEL), + MCI_EFIFO01_SEL_DEF); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_EFIFO23_SEL), + MCI_EFIFO23_SEL_DEF); + for (i = 0; i < (SINT32)CDSP_CMD_PARAM_NUM; i++) { + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | ((UINT32)MCI_DEC_GPR15 + (UINT32)i)), + 0x00); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | ((UINT32)MCI_ENC_GPR15 + (UINT32)i)), + 0x00); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | ((UINT32)MCI_DEC_CTL15 + (UINT32)i)), + 0x00); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | ((UINT32)MCI_ENC_CTL15 + (UINT32)i)), + 0x00); + } + McDevIf_ExecutePacket(); +} + +/*************************************************************************** + * DownloadOS + * + * Function: + * Download CDSP OS. + * Arguments: + * pbFirmware OS data + * Return: + * 0 success + * < 0 error code + * + ****************************************************************************/ +static SINT32 DownloadOS(const UINT8 *pbFirmware) +{ + UINT8 bData; + UINT8 abMsel[2]; + UINT8 abAdrH[2]; + UINT8 abAdrL[2]; + UINT16 awOsSize[2]; + SINT32 i; + UINT32 j; + const UINT8 *apbOsProg[2]; + + abMsel[0] = (UINT8)MCB_CDSP_MSEL_PROG; + abAdrH[0] = (UINT8)ADR_OS_PROG_H; + abAdrL[0] = (UINT8)ADR_OS_PROG_L; + awOsSize[0] = MAKEWORD(pbFirmware[0], pbFirmware[1]); + apbOsProg[0] = &pbFirmware[4]; + + abMsel[1] = (UINT8)MCB_CDSP_MSEL_DATA; + abAdrH[1] = (UINT8)ADR_OS_DATA_H; + abAdrL[1] = (UINT8)ADR_OS_DATA_L; + awOsSize[1] = MAKEWORD(pbFirmware[2], pbFirmware[3]); + apbOsProg[1] = &apbOsProg[0][((UINT32)awOsSize[0] * 2UL)]; + + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_CDSP_RESET), + &bData, 1); + + /* CDSP_SRST Set : CDSP OS stop */ + bData &= ~MCB_CDSP_FMODE; + bData |= MCB_CDSP_SRST; + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_CDSP_RESET), + bData); + + /* Program & Data Write */ + for (i = 0; i < 2L; i++) { + /* CDSP_MSEL Set */ + bData &= ~MCB_CDSP_MSEL; + bData |= abMsel[i]; + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_CDSP_RESET), + bData); + + /* CDSP_MAR Set */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_CDSP_MAR_H), + abAdrH[i]); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_CDSP_MAR_L), + abAdrL[i]); + + McDevIf_ExecutePacket(); + + /* FSQ_FIFO Write */ + for (j = 0; j < ((UINT32)awOsSize[i] * 2UL); ++j) + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FSQ_FFIFO), + apbOsProg[i][j]); + + McDevIf_ExecutePacket(); + + } + + /* CDSP_SRST Release : CDSP OS start */ + bData &= ~MCB_CDSP_SRST; + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_CDSP_RESET), + bData); + + /* 100 ns wait */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_TIMWAIT | 1UL), 0x00); + + McDevIf_ExecutePacket(); + + return MCDRV_SUCCESS; +} + +/**************************************************************************** + * CommandWriteComplete + * + * Function: + * The completion of the command is notified. + * Arguments: + * dCoderId Coder ID + * psParam Command ID and result data + * Return: + * None + * + ****************************************************************************/ +static void CommandWriteComplete(UINT32 dCoderId, + struct MC_CODER_PARAMS *psParam) +{ + UINT8 bAddSfr; + UINT8 bAddCtl; + UINT32 dCount; + UINT32 i; + + if (CODER_DEC == dCoderId) { + bAddSfr = MCI_DEC_SFR1; + bAddCtl = MCI_DEC_CTL0; + } else { + bAddSfr = MCI_ENC_SFR1; + bAddCtl = MCI_ENC_CTL0; + } + + /* Write result */ + dCount = (UINT32)(CDSP_CMD_PARAM_RESULT_00 + + CDSP_CMD_PARAM_RESULT_NUM); + for (i = (UINT32)CDSP_CMD_PARAM_RESULT_00; i < dCount; i++) + McDevIf_AddPacket((MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_C + | ((UINT32)bAddCtl - i)), + psParam->abParam[i]); + + /* Write complete command */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)bAddSfr), + (UINT8)(psParam->bCommandId + | CDSP_CMD_OS2HOST_COMPLETION)); + + McDevIf_ExecutePacket(); +} + +/**************************************************************************** + * CommandWaitComplete + * + * Function: + * It waits until the command transmission is completed. + * Arguments: + * dCoderId Coder ID + * Return: + * >= 0 success + * < 0 error code + * + ****************************************************************************/ +static SINT32 CommandWaitComplete(UINT32 dCoderId) +{ + SINT32 sdRet; + UINT8 bAddSfr; + + if (CODER_DEC == dCoderId) + bAddSfr = MCI_DEC_SFR0; + else + bAddSfr = MCI_ENC_SFR0; + + /* Polling */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_EVTWAIT + | MCDRV_EVT_C_REG_FLAG_SET + | (((UINT32)bAddSfr) << 8) + | (UINT32)CDSP_CMD_HOST2OS_COMPLETION), + 0); + + sdRet = McDevIf_ExecutePacket(); + if ((SINT32)MCDRV_SUCCESS > sdRet) { + /* Time out */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)bAddSfr), + CDSP_CMD_HOST2OS_COMPLETION); + + McDevIf_ExecutePacket(); + } + + return sdRet; +} + +/**************************************************************************** + * CommandInitialize + * + * Function: + * Initialize register of command sending and receiving. + * Arguments: + * dCoderId Coder ID + * Return: + * >= 0 success + * < 0 error code + * + ****************************************************************************/ +static SINT32 CommandInitialize(UINT32 dCoderId) +{ + SINT32 sdRet; + struct MC_CODER_PARAMS sParam; + + sParam.bCommandId = (UINT8)CDSP_CMD_OS2HOST_CMN_NONE; + sParam.abParam[CDSP_CMD_PARAM_RESULT_00] = 0; + sParam.abParam[CDSP_CMD_PARAM_RESULT_01] = 0; + sParam.abParam[CDSP_CMD_PARAM_RESULT_02] = 0; + sParam.abParam[CDSP_CMD_PARAM_RESULT_03] = 0; + + CommandWriteComplete(dCoderId, &sParam); + sdRet = CommandWaitComplete(dCoderId); + if ((SINT32)MCDRV_SUCCESS > sdRet) + return sdRet; + + return MCDRV_SUCCESS; +} + +/**************************************************************************** + * CommandWriteHost2Os + * + * Function: + * Write command (Host -> OS). + * Arguments: + * dCoderId Coder ID + * psParam Command ID and parameter data + * Return: + * >= 0 success + * < 0 error code + * + ****************************************************************************/ +static SINT32 CommandWriteHost2Os(UINT32 dCoderId, + struct MC_CODER_PARAMS *psParam) +{ + UINT8 bData; + UINT32 dAddSfr; + UINT32 dAddCtl; + UINT32 dAddGpr; + UINT32 dCount; + UINT32 i; + SINT32 sdRet; + + if (CODER_DEC == dCoderId) { + dAddSfr = MCI_DEC_SFR0; + dAddCtl = MCI_DEC_CTL0; + dAddGpr = MCI_DEC_GPR0; + } else { + dAddSfr = MCI_ENC_SFR0; + dAddCtl = MCI_ENC_CTL0; + dAddGpr = MCI_ENC_GPR0; + } + + /* Polling */ + sdRet = CommandWaitComplete(dCoderId); + if ((SINT32)MCDRV_SUCCESS > sdRet) + return sdRet; + + /* Write parameter */ + switch (psParam->bCommandId) { + case CDSP_CMD_HOST2OS_CMN_NONE: + case CDSP_CMD_HOST2OS_CMN_RESET: + case CDSP_CMD_HOST2OS_CMN_CLEAR: + case CDSP_CMD_HOST2OS_CMN_STANDBY: + case CDSP_CMD_HOST2OS_CMN_GET_PRG_VER: + case CDSP_CMD_HOST2OS_SYS_GET_OS_VER: + case CDSP_CMD_HOST2OS_SYS_VERIFY_STOP_COMP: + case CDSP_CMD_HOST2OS_SYS_CLEAR_INPUT_DATA_END: + case CDSP_CMD_HOST2OS_SYS_TERMINATE: + case CDSP_CMD_HOST2OS_SYS_GET_INPUT_POS: + case CDSP_CMD_HOST2OS_SYS_RESET_INPUT_POS: + case CDSP_CMD_HOST2OS_SYS_HALT: + dCount = 0; + break; + case CDSP_CMD_HOST2OS_SYS_INPUT_DATA_END: + case CDSP_CMD_HOST2OS_SYS_TIMER_RESET: + case CDSP_CMD_HOST2OS_SYS_SET_DUAL_MONO: + case CDSP_CMD_HOST2OS_SYS_SET_CLOCK_SOURCE: + dCount = 1; + break; + case CDSP_CMD_HOST2OS_SYS_SET_PRG_INFO: + dCount = 11; + break; + case CDSP_CMD_HOST2OS_SYS_SET_FORMAT: + dCount = 2; + break; + case CDSP_CMD_HOST2OS_SYS_SET_CONNECTION: + dCount = 2; + break; + case CDSP_CMD_HOST2OS_SYS_SET_TIMER: + dCount = 4; + break; + default: + /* Program dependence command */ + dCount = (UINT32)CDSP_CMD_PARAM_ARGUMENT_NUM; + break; + } + + for (i = 0; i < dCount; i++) + McDevIf_AddPacket((MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_C + | ((UINT32)dAddCtl - i)), + psParam->abParam[i]); + + /* Write command */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)dAddSfr), + psParam->bCommandId); + + McDevIf_ExecutePacket(); + + /* Polling */ + sdRet = CommandWaitComplete(dCoderId); + if ((SINT32)MCDRV_SUCCESS > sdRet) + return sdRet; + + /* Error check */ + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_C | (UINT32)dAddSfr), + &bData, 1); + if (0xF0 <= bData) + switch (bData) { + case 0xF3: + case 0xF4: + case 0xF5: + case 0xF6: + return MCDRV_ERROR_ARGUMENT; + case 0xF7: + return MCDRV_ERROR_STATE; + default: + return MCDRV_ERROR; + } + + /* Get result */ + dCount = (UINT32)(CDSP_CMD_PARAM_RESULT_00 + + CDSP_CMD_PARAM_RESULT_NUM); + for (i = (UINT32)CDSP_CMD_PARAM_RESULT_00; i < dCount; i++) { + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_C + | (UINT32)(dAddGpr - i)), + &bData, + 1); + psParam->abParam[i] = bData; + } + + return (SINT32)bData; +} + +/*************************************************************************** + * InitializeOS + * + * Function: + * Initialize CDSP OS. + * Arguments: + * None + * Return: + * 0 success + * < 0 error code + * + ****************************************************************************/ +static SINT32 InitializeOS(void) +{ + SINT32 sdRet; + struct MC_CODER_PARAMS sParam; + + /* CDSP_ERR/WDT_FLG Flag clear */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_CDSP_FLG), + MCB_CDSP_FLG_ALL); + + /* IRQ Flag clear */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_CDSP), + MCB_IRQFLAG_CDSP_ALL); + + /* ECDSP_ERR/WDT Enable */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_CDSP_ENABLE), + MCB_CDSP_ENABLE_ALL); + + /* IRQ: ECDSP=Enable, other=Disable */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_ECDSP), + MCB_ECDSP); + + McDevIf_ExecutePacket(); + + /* Command register Initialize */ + sdRet = CommandInitialize(CODER_DEC); + if ((SINT32)MCDRV_SUCCESS > sdRet) + return sdRet; + + sdRet = CommandInitialize(CODER_ENC); + if ((SINT32)MCDRV_SUCCESS > sdRet) + return sdRet; + + /* READY Polling */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_EVTWAIT + | MCDRV_EVT_C_REG_FLAG_SET + | (((UINT32)MCI_CDSP_POWER_MODE) << 8) + | (UINT32)MCB_CDSP_SLEEP), + 0); + + sdRet = McDevIf_ExecutePacket(); + if ((SINT32)MCDRV_SUCCESS > sdRet) + return sdRet; + + /* GetOsVersion command */ + sParam.bCommandId = (UINT8)CDSP_CMD_HOST2OS_SYS_GET_OS_VER; + sdRet = CommandWriteHost2Os(CODER_DEC, &sParam); + if ((SINT32)MCDRV_SUCCESS > sdRet) + return sdRet; + + gsCdspInfo.sOsVer.wVersionH = MAKEWORD( + sParam.abParam[CDSP_CMD_PARAM_RESULT_00], + sParam.abParam[CDSP_CMD_PARAM_RESULT_01]); + gsCdspInfo.sOsVer.wVersionL = MAKEWORD( + sParam.abParam[CDSP_CMD_PARAM_RESULT_02], + sParam.abParam[CDSP_CMD_PARAM_RESULT_03]); + + return MCDRV_SUCCESS; +} + +/*************************************************************************** + * InitDecInfo + * + * Function: + * Initialize DEC_INFO + * Arguments: + * psDecInfo Pointer of Dec info + * Return: + * None + * + ****************************************************************************/ +static void InitDecInfo(struct DEC_INFO *psDecInfo) +{ + SINT32 i; + + psDecInfo->dState = STATE_INIT; + psDecInfo->bPreInputDataEnd = INPUT_DATAEND_RELEASE; + psDecInfo->bInputDataEnd = INPUT_DATAEND_RELEASE; + psDecInfo->bChangeOutputFs = CHANGE_OUTPUT_FS_OFF; + psDecInfo->bFmtPropagate = FORMAT_PROPAGATE_OFF; + psDecInfo->dInPosSup = 0; + psDecInfo->wErrorCode = DEC_ERR_NO_ERROR; + psDecInfo->sCbInfo.pcbFunc = NULL; + for (i = 0; i < (SINT32)CALLBACK_COUNT; i++) { + psDecInfo->sCbInfo.abCbOn[i] = CALLBACK_OFF; + psDecInfo->sCbInfo.adCbExInfo[i] = 0; + } + psDecInfo->sProgVer.wVersionH = 0; + psDecInfo->sProgVer.wVersionL = 0; + psDecInfo->sProgInfo.wVendorId = 0; + psDecInfo->sProgInfo.wFunctionId = 0; + psDecInfo->sProgInfo.wProgType = 0; + psDecInfo->sProgInfo.wInOutType = + PRG_PRM_IOTYPE_IN_PCM | PRG_PRM_IOTYPE_OUT_PCM; + psDecInfo->sProgInfo.wProgScramble = 0; + psDecInfo->sProgInfo.wDataScramble = 0; + psDecInfo->sProgInfo.wEntryAddress = 0; + psDecInfo->sProgInfo.wProgLoadAddr = 0; + psDecInfo->sProgInfo.wProgSize = 0; + psDecInfo->sProgInfo.wDataLoadAddr = 0; + psDecInfo->sProgInfo.wDataSize = 0; + psDecInfo->sProgInfo.wWorkBeginAddr = 0; + psDecInfo->sProgInfo.wWorkSize = 0; + psDecInfo->sProgInfo.wStackBeginAddr = 0; + psDecInfo->sProgInfo.wStackSize = 0; + psDecInfo->sProgInfo.wOutStartMode = 0; + psDecInfo->sProgInfo.wResourceFlag = 0; + psDecInfo->sProgInfo.wMaxLoad = 0; + psDecInfo->sFormat.bFs = CODER_FMT_FS_48000; + psDecInfo->sFormat.bE2BufMode = CODER_FMT_ETOBUF_LRMIX; + psDecInfo->sConnect.bInSource = CDSP_IN_SOURCE_NONE; + psDecInfo->sConnect.bOutDest = CDSP_OUT_DEST_NONE; + psDecInfo->sConnectEx.bEfifoCh = 2; + psDecInfo->sConnectEx.bOfifoCh = 2; + psDecInfo->sBitWidth.bEfifoBit = 16; + psDecInfo->sBitWidth.bOfifoBit = 16; + psDecInfo->sParams.bCommandId = 0; + for (i = 0; i < 16L; i++) + psDecInfo->sParams.abParam[i] = 0; +} + +/**************************************************************************** + * Initialize + * + * Function: + * Initialize CDSP and SMW. + * Arguments: + * None + * Return: + * None + * + ****************************************************************************/ +static SINT32 Initialize(void) +{ + const UINT8 *pbFirmware; + + if ((STATE_PLAYING == gsDecInfo.dState) + || (STATE_PLAYING == gsEncInfo.dState)) + return MCDRV_ERROR_STATE; + + /* Global Initialize */ + gsCdspInfo.wHwErrorCode = CDSP_ERR_NO_ERROR; + gsCdspInfo.sOsVer.wVersionH = 0; + gsCdspInfo.sOsVer.wVersionL = 0; + gsFifoInfo.sdDFifoCbPos = CBPOS_DFIFO_DEF; + gsFifoInfo.sdRFifoCbPos = CBPOS_RFIFO_DEF; + gsFifoInfo.dOFifoBufSample = OFIFO_BUF_SAMPLE_DEF; + gsFifoInfo.bOFifoOutStart = OUTPUT_START_OFF; + gsFifoInfo.dDFifoWriteSize = 0; + gsFifoInfo.dRFifoBufSample = RFIFO_BUF_SAMPLE_DEF; + gsFifoInfo.bRFifoOutStart = OUTPUT_START_OFF; + gsFifoInfo.bOut0Sel = MCI_OUT0_SEL_DEF; + gsFifoInfo.bOut1Sel = MCI_OUT1_SEL_DEF; + gsFifoInfo.bOut2Sel = MCI_OUT2_SEL_DEF; + gsFifoInfo.bRDFifoBitSel = 0; + gsFifoInfo.bEFifo01Sel = MCI_EFIFO01_SEL_DEF; + gsFifoInfo.bEFifo23Sel = MCI_EFIFO23_SEL_DEF; + + InitDecInfo(&gsDecInfo); + InitDecInfo(&gsEncInfo); + + InitializeRegister(); + + /* CDSP OS Download */ + pbFirmware = gabCdspOs; + + DownloadOS(pbFirmware); + + /* CDSP OS initialize */ + InitializeOS(); + + return MCDRV_SUCCESS; +} + +/*************************************************************************** + * GetDecInfo + * + * Function: + * Get CDSP decoder/encoder management + * module's information. + * Arguments: + * dCoderId Coder ID + * Return: + * DEC_INFO* + * + ****************************************************************************/ +static struct DEC_INFO *GetDecInfo(UINT32 dCoderId) +{ + if (dCoderId == CODER_DEC) + return &gsDecInfo; + + return &gsEncInfo; +} + +/*************************************************************************** + * GetOtherDecInfo + * + * Function: + * Get CDSP decoder/encoder management + * module's information. + * Arguments: + * dCoderId Coder ID + * Return: + * DEC_INFO* + * + ****************************************************************************/ +static struct DEC_INFO *GetOtherDecInfo(UINT32 dCoderId) +{ + if (dCoderId == CODER_DEC) + return &gsEncInfo; + + return &gsDecInfo; +} + +/**************************************************************************** + * CommandReadOs2Host + * + * Function: + * Read command (Host <- OS). + * Arguments: + * eCoderId Coder ID + * psParam Command ID and parameter data + * Return: + * >= 0 success + * < 0 error code + * + ****************************************************************************/ +static void CommandReadOs2Host(UINT32 dCoderId, + struct MC_CODER_PARAMS *psParam) +{ + UINT8 bAdd; + UINT8 bData; + UINT32 dGpr; + UINT32 dCount; + UINT32 i; + + if (CODER_DEC == dCoderId) { + bAdd = MCI_DEC_SFR1; + dGpr = (UINT32)MCI_DEC_GPR0; + } else { + bAdd = MCI_ENC_SFR1; + dGpr = (UINT32)MCI_ENC_GPR0; + } + + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_C | (UINT32)bAdd), &bData, 1); + psParam->bCommandId = bData; + + switch (psParam->bCommandId) { + case CDSP_CMD_OS2HOST_CMN_NONE: + dCount = 0; + break; + + case CDSP_CMD_OS2HOST_CMN_NOTIFY_OUT_FORMAT: + dCount = 4; + break; + + default: + /* Program dependence command */ + dCount = (UINT32)CDSP_CMD_PARAM_ARGUMENT_NUM; + break; + } + + for (i = 0; i < dCount; i++) { + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_C | (dGpr - i)), + &bData, 1); + psParam->abParam[i] = bData; + } +} + +/**************************************************************************** + * GetRFifoSel + * + * Function: + * RFIFO setting acquisition of sel + * Arguments: + * None + * Return: + * Port/Host + * + ****************************************************************************/ +static UINT8 GetRFifoSel(void) +{ + if ((gsFifoInfo.bRDFifoBitSel & MCB_RFIFO_SEL_HOST) != 0) + return CDSP_FIFO_SEL_HOST; + + return CDSP_FIFO_SEL_PORT; +} + +/**************************************************************************** + * GetDFifoSel + * + * Function: + * DFIFO setting acquisition of sel + * Arguments: + * None + * Return: + * Port/Host + * + ****************************************************************************/ +static UINT8 GetDFifoSel(void) +{ + if ((gsFifoInfo.bRDFifoBitSel & MCB_DFIFO_SEL_HOST) != 0) + return CDSP_FIFO_SEL_HOST; + + return CDSP_FIFO_SEL_PORT; +} + +/*************************************************************************** + * CommandInputDataEnd + * + * Function: + * Set Input data end. + * Arguments: + * dCoderId Coder ID + * Return: + * 0 success + * < 0 error code + * + ****************************************************************************/ +static SINT32 CommandInputDataEnd(UINT32 dCoderId) +{ + UINT8 bInSource; + UINT8 bOutDest; + UINT8 bData; + SINT32 sdRet; + struct DEC_INFO *psDecInfo; + struct MC_CODER_PARAMS sParam; + + psDecInfo = GetDecInfo(dCoderId); + bInSource = psDecInfo->sConnect.bInSource; + + if ((CDSP_IN_SOURCE_DFIFO == bInSource) + || (CDSP_IN_SOURCE_DFIFO_EFIFO == bInSource)) { + if (0x01L == (gsFifoInfo.dDFifoWriteSize & 0x01L)) { + bData = 0x00; + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_DEC_FIFO), + bData); + + gsFifoInfo.dDFifoWriteSize = 0; + } + } + + sParam.abParam[CDSP_CMD_PARAM_ARGUMENT_00] = (UINT8)INPUTDATAEND_EMPTY; + bOutDest = psDecInfo->sConnect.bOutDest; + if ((GetRFifoSel() == CDSP_FIFO_SEL_HOST) + && ((CDSP_OUT_DEST_RFIFO == bOutDest) + || (CDSP_OUT_DEST_OFIFO_RFIFO == bOutDest))) + sParam.abParam[CDSP_CMD_PARAM_ARGUMENT_00] = + (UINT8)INPUTDATAEND_WRITE; + + /* InputDataEnd command */ + sParam.bCommandId = (UINT8)CDSP_CMD_HOST2OS_SYS_INPUT_DATA_END; + sdRet = CommandWriteHost2Os(dCoderId, &sParam); + if ((SINT32)MCDRV_SUCCESS > sdRet) + return sdRet; + + return MCDRV_SUCCESS; +} + +/*************************************************************************** + * OFifoStartReal + * + * Function: + * Start OFIFO. + * Arguments: + * None + * Return: + * None + * + ****************************************************************************/ +static void OFifoStartReal(void) +{ + UINT8 bData; + + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DEC_START), &bData, 1); + + bData |= MCB_DEC_OUT_START; + McDevIf_AddPacket((MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DEC_START), bData); + + McDevIf_ExecutePacket(); +} + +/*************************************************************************** + * RFifoStartReal + * + * Function: + * Start RFIFO. + * Arguments: + * None + * Return: + * None + * + ****************************************************************************/ +static void RFifoStartReal(void) +{ + UINT8 bData; + + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DEC_START2), &bData, 1); + + bData |= MCB_RFIFO_START; + McDevIf_AddPacket((MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DEC_START2), bData); + + McDevIf_ExecutePacket(); +} + +/**************************************************************************** + * GetFifoIdCore + * + * Function: + * Get input/output FIFO ID from path. + * Arguments: + * psConnect CONNECTION_INFO structure pointer + * Return: + * Fifo Id + * + ****************************************************************************/ +static UINT32 GetFifoIdCore(struct CONNECTION_INFO *psConnect) +{ + UINT32 dFifoId; + + dFifoId = 0; + + switch (psConnect->bInSource) { + case CDSP_IN_SOURCE_DFIFO: + dFifoId |= FIFO_DFIFO; + break; + + case CDSP_IN_SOURCE_EFIFO: + dFifoId |= FIFO_EFIFO; + break; + + case CDSP_IN_SOURCE_DFIFO_EFIFO: + dFifoId |= FIFO_DFIFO; + dFifoId |= FIFO_EFIFO; + break; + + case CDSP_IN_SOURCE_OTHER_OUTBUF: + case CDSP_IN_SOURCE_NONE: + default: + break; + } + + switch (psConnect->bOutDest) { + case CDSP_OUT_DEST_OFIFO: + dFifoId |= FIFO_OFIFO; + break; + + case CDSP_OUT_DEST_RFIFO: + dFifoId |= FIFO_RFIFO; + break; + + case CDSP_OUT_DEST_OFIFO_RFIFO: + dFifoId |= FIFO_OFIFO; + dFifoId |= FIFO_RFIFO; + break; + + case CDSP_OUT_DEST_OTHER_INBUF: + case CDSP_OUT_DEST_NONE: + default: + break; + } + + return dFifoId; +} + +/**************************************************************************** + * GetFifoId + * + * Function: + * Get input/output FIFO ID from path. + * Arguments: + * dCoderId Coder ID + * Return: + * Fifo Id + * + ****************************************************************************/ +static UINT32 GetFifoId(UINT32 dCoderId) +{ + UINT32 dFifoId; + struct DEC_INFO *psDecInfo; + + psDecInfo = GetDecInfo(dCoderId); + + dFifoId = GetFifoIdCore(&(psDecInfo->sConnect)); + + return dFifoId; +} + +/**************************************************************************** + * NotifyOutFormatOs2Host + * + * Function: + * Decoder/Encoder SFR Interrupt (NotifyOutputFormat). + * Arguments: + * dCoderId Coder ID + * Return: + * None + * + ****************************************************************************/ +static void NotifyOutFormatOs2Host(UINT32 dCoderId) +{ + UINT32 dFlagOtherFifo; + SINT32 sdRet; + UINT32 dFifoId; + struct DEC_INFO *psDecInfo; + struct DEC_INFO *psOtherDecInfo; + + psDecInfo = GetDecInfo(dCoderId); + psOtherDecInfo = GetOtherDecInfo(dCoderId); + + /* Fs */ + psDecInfo->sFormat.bFs = + psDecInfo->sParams.abParam[CDSP_CMD_PARAM_ARGUMENT_00]; + + dFlagOtherFifo = 0; + if (psDecInfo->sConnect.bOutDest == CDSP_OUT_DEST_OTHER_INBUF) { + dFifoId = GetFifoIdCore(&(psOtherDecInfo->sConnect)); + if ((dFifoId & FIFO_OFIFO_MASK) != 0) + dFlagOtherFifo |= FIFO_OFIFO; + + if (((dFifoId & FIFO_RFIFO_MASK) != 0) + && (GetRFifoSel() == CDSP_FIFO_SEL_PORT)) + dFlagOtherFifo |= FIFO_RFIFO; + } else { + dFifoId = GetFifoIdCore(&(psDecInfo->sConnect)); + dFifoId &= ~(FIFO_DFIFO_MASK | FIFO_EFIFO_MASK); + if (GetRFifoSel() != CDSP_FIFO_SEL_PORT) + dFifoId &= ~FIFO_RFIFO_MASK; + + if (FIFO_NONE != dFifoId) { + if ((dFifoId & FIFO_OFIFO_MASK) != 0) + /* Wait OFIFO_EMPTY */ + McDevIf_AddPacket( + (MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_OFIFO_FLG), + MCB_OFIFO_FLG_OEMP); + + if ((dFifoId & FIFO_RFIFO_MASK) != 0) + /* Wait RFIFO_EMPTY */ + McDevIf_AddPacket( + (MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_RFIFO_FLG), + MCB_RFIFO_FLG_REMP); + + if ((dFifoId & FIFO_OFIFO_MASK) != 0) + McDevIf_AddPacket( + (MCDRV_PACKET_TYPE_EVTWAIT + | MCDRV_EVT_C_REG_FLAG_SET + | (((UINT32)MCI_OFIFO_FLG) << 8) + | (UINT32)MCB_OFIFO_FLG_OEMP), + 0); + + if ((dFifoId & FIFO_RFIFO_MASK) != 0) + McDevIf_AddPacket( + (MCDRV_PACKET_TYPE_EVTWAIT + | MCDRV_EVT_C_REG_FLAG_SET + | (((UINT32)MCI_RFIFO_FLG) << 8) + | (UINT32)MCB_RFIFO_FLG_REMP), + 0); + + sdRet = McDevIf_ExecutePacket(); + + if ((dFifoId & FIFO_OFIFO_MASK) != 0) + /* Clear OFIFO_EMPTY */ + McDevIf_AddPacket( + (MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_OFIFO_FLG), + MCB_OFIFO_FLG_ALL); + + if ((dFifoId & FIFO_RFIFO_MASK) != 0) + /* Clear RFIFO_EMPTY */ + McDevIf_AddPacket( + (MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_RFIFO_FLG), + MCB_RFIFO_FLG_ALL); + + McDevIf_ExecutePacket(); + } + } + + if ((FIFO_NONE != dFlagOtherFifo) + && (psOtherDecInfo->bInputDataEnd == INPUT_DATAEND_RELEASE)) { + psOtherDecInfo->bPreInputDataEnd = INPUT_DATAEND_RELEASE; + + /* InputDataEnd command */ + sdRet = CommandInputDataEnd(psOtherDecInfo->dCoderId); + + /* FormatPropagate state - set */ + psOtherDecInfo->bFmtPropagate = FORMAT_PROPAGATE_ON; + + if ((dFlagOtherFifo & FIFO_OFIFO_MASK) != 0) + /* OUT Start */ + OFifoStartReal(); + + if ((dFlagOtherFifo & FIFO_RFIFO_MASK) != 0) + /* OUT Start */ + RFifoStartReal(); + + } else + /* Callback (HOST COMMAND) */ + psDecInfo->sCbInfo.abCbOn[CALLBACK_HOSTCOMMAND] = CALLBACK_ON; +} + +/**************************************************************************** + * InterruptProcDecSfr + * + * Function: + * Decoder/Encoder SFR Interrupt. + * Arguments: + * dCoderId Coder ID + * Return: + * None + * + ****************************************************************************/ +static void InterruptProcDecSfr(UINT32 dCoderId) +{ + UINT8 bCmdId; + struct DEC_INFO *psDecInfo; + + psDecInfo = GetDecInfo(dCoderId); + + /* Read SFR data */ + CommandReadOs2Host(dCoderId, &psDecInfo->sParams); + bCmdId = psDecInfo->sParams.bCommandId; + + if ((UINT8)CDSP_CMD_OS2HOST_READY_MIN <= bCmdId) + /* Ready */ + return; + + if ((UINT8)CDSP_CMD_OS2HOST_CMN_MAX >= bCmdId) + /* Common Command */ + switch (bCmdId) { + case CDSP_CMD_OS2HOST_CMN_NOTIFY_OUT_FORMAT: + NotifyOutFormatOs2Host(dCoderId); + break; + + default: + /* DEC/ENC_SFR1 Write complete */ + psDecInfo->sParams.abParam[CDSP_CMD_PARAM_RESULT_00] + = 0; + psDecInfo->sParams.abParam[CDSP_CMD_PARAM_RESULT_01] + = 0; + psDecInfo->sParams.abParam[CDSP_CMD_PARAM_RESULT_02] + = 0; + psDecInfo->sParams.abParam[CDSP_CMD_PARAM_RESULT_03] + = 0; + CommandWriteComplete(dCoderId, &psDecInfo->sParams); + break; + } + else if ((UINT8)CDSP_CMD_OS2HOST_PRG_MAX >= bCmdId) + /* Callback (HOST COMMAND) */ + psDecInfo->sCbInfo.abCbOn[CALLBACK_HOSTCOMMAND] = CALLBACK_ON; +} + +/**************************************************************************** + * InterruptProcDecEvt + * + * Function: + * Decoder/Encoder EVT Interrupt. + * Arguments: + * dCoderId Coder ID + * Return: + * None + * + ****************************************************************************/ +static void InterruptProcDecEvt(UINT32 dCoderId) +{ + UINT8 bAdd; + UINT8 bEvtData; + struct DEC_INFO *pDecInfo; + + /* Read EVT data */ + if (CODER_DEC == dCoderId) + bAdd = MCI_DEC_EVT; + else + bAdd = MCI_ENC_EVT; + + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_C + | (UINT32)bAdd), &bEvtData, 1); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)bAdd), + 0x00); + + McDevIf_ExecutePacket(); + + /* Timer Event */ + if (0 != ((UINT8)EVENT_TIMER & bEvtData)) { + /* Callback (TIMER) */ + pDecInfo = GetDecInfo(dCoderId); + pDecInfo->sCbInfo.abCbOn[CALLBACK_TIMER] = CALLBACK_ON; + } +} + +/**************************************************************************** + * DecStop + * + * Function: + * Stop decoder/encoder. + * Arguments: + * dCoderId Coder ID + * bVerifyComp Verify Stop Complete command flag + * Return: + * 0 success + * < 0 error code + * + ****************************************************************************/ +static SINT32 DecStop(UINT32 dCoderId, UINT8 bVerifyComp) +{ + UINT8 bData; + UINT8 bIntData; + UINT8 bAddInt; + UINT32 dFifoId; + SINT32 sdRet; + struct DEC_INFO *psDecInfo; + struct MC_CODER_PARAMS sParam; + + psDecInfo = GetDecInfo(dCoderId); + + /* State check */ + if (STATE_PLAYING != psDecInfo->dState) + return MCDRV_ERROR_STATE; + + dFifoId = GetFifoIdCore(&psDecInfo->sConnect); + if ((FIFO_EFIFO & dFifoId) != FIFO_NONE) { + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DEC_FIFO_CH), &bData, 1); + bData &= ~MCB_DEC_EFIFO_START; + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DEC_FIFO_CH), + bData); + McDevIf_ExecutePacket(); + } + if (((FIFO_DFIFO & dFifoId) != FIFO_NONE) + && (GetDFifoSel() == CDSP_FIFO_SEL_PORT)) { + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_RDFIFO_BIT_SEL), &bData, + 1); + bData &= ~MCB_RDFIFO_DFIFO_START; + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_RDFIFO_BIT_SEL), + bData); + McDevIf_ExecutePacket(); + } + + /* DEC/ENC Stop */ + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DEC_START), &bData, 1); + if (CODER_DEC == dCoderId) { + bData &= ~MCB_DEC_DEC_START; + bAddInt = MCI_DEC_ENABLE; + } else { + bData &= ~MCB_DEC_ENC_START; + bAddInt = MCI_ENC_ENABLE; + } + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DEC_START), bData); + + McDevIf_ExecutePacket(); + + /* VerifyStopCompletion command */ + if (MADEVCDSP_VERIFY_COMP_ON == bVerifyComp) { + sParam.bCommandId = + (UINT8)CDSP_CMD_HOST2OS_SYS_VERIFY_STOP_COMP; + sdRet = CommandWriteHost2Os(dCoderId, &sParam); + if ((SINT32)MCDRV_SUCCESS <= sdRet) + sdRet = MCDRV_SUCCESS; + } else + sdRet = MCDRV_SUCCESS; + + /* DEC/ENC END,ERR Interrupt Disable */ + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_C + | (UINT32)bAddInt), &bIntData, 1); + bIntData &= ~(MCB_EDEC_END | MCB_EDEC_ERR); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)bAddInt), + bIntData); + + McDevIf_ExecutePacket(); + + return sdRet; +} + +/*************************************************************************** + * FifoStop + * + * Function: + * Stop FIFO. + * Arguments: + * dFifoId FIFO ID + * Return: + * 0 success + * < 0 error code + * + ****************************************************************************/ +static SINT32 FifoStop(UINT32 dCoderId) +{ + UINT8 bData; + UINT32 dFifoId; + + dFifoId = GetFifoId(dCoderId); + + if (FIFO_NONE != (FIFO_DFIFO_MASK & dFifoId)) { + /* xFIFO/xPNT/xEMP/xUDF/xOVF Interrupt Disable */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DFIFO_ENABLE), + 0x00); + + McDevIf_ExecutePacket(); + + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_ECDSP), + &bData, 1); + bData &= ~MCB_EDFIFO; + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_ECDSP), + bData); + + McDevIf_ExecutePacket(); + } + + if (FIFO_NONE != (FIFO_EFIFO_MASK & dFifoId)) { + /* xFIFO/xPNT/xEMP/xUDF/xOVF Interrupt Disable */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_EFIFO_ENABLE), + 0x00); + + McDevIf_ExecutePacket(); + + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_ECDSP), + &bData, 1); + bData &= ~MCB_EEFIFO; + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_ECDSP), + bData); + + McDevIf_ExecutePacket(); + } + + if (FIFO_NONE != (FIFO_OFIFO_MASK & dFifoId)) { + /* OUT Stop */ + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DEC_START), + &bData, 1); + + bData &= ~MCB_DEC_OUT_START; + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DEC_START), bData); + + /* xFIFO/xPNT/xEMP/xUDF/xOVF Interrupt Disable */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_OFIFO_ENABLE), + 0x00); + + McDevIf_ExecutePacket(); + + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_ECDSP), + &bData, 1); + bData &= ~MCB_EOFIFO; + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_ECDSP), + bData); + + McDevIf_ExecutePacket(); + } + + if (FIFO_NONE != (FIFO_RFIFO_MASK & dFifoId)) { + if (GetRFifoSel() == CDSP_FIFO_SEL_PORT) { + /* OUT Stop */ + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DEC_START2), + &bData, 1); + + bData &= ~MCB_RFIFO_START; + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DEC_START2), bData); + } + + /* xFIFO/xPNT/xEMP/xUDF/xOVF Interrupt Disable */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_RFIFO_ENABLE), + 0x00); + + McDevIf_ExecutePacket(); + + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_ECDSP), + &bData, 1); + bData &= ~MCB_ERFIFO; + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_ECDSP), + bData); + + McDevIf_ExecutePacket(); + } + + return MCDRV_SUCCESS; +} + +/**************************************************************************** + * ConvertSamplesToTime + * + * Function: + * Convert sample count to milli-second. + * Arguments: + * bFs Fs ID + * dSamples Sample count + * Return: + * milli-second + * + ****************************************************************************/ +static UINT32 ConvertSamplesToTime(UINT8 bFs, UINT32 dSamples) +{ + UINT32 dFs; + UINT32 dTime; + + switch (bFs) { + case CODER_FMT_FS_48000: + dFs = OUTPUT_FS_48000; + break; + + case CODER_FMT_FS_44100: + dFs = OUTPUT_FS_44100; + break; + + case CODER_FMT_FS_32000: + dFs = OUTPUT_FS_32000; + break; + + case CODER_FMT_FS_24000: + dFs = OUTPUT_FS_24000; + break; + + case CODER_FMT_FS_22050: + dFs = OUTPUT_FS_22050; + break; + + case CODER_FMT_FS_16000: + dFs = OUTPUT_FS_16000; + break; + + case CODER_FMT_FS_12000: + dFs = OUTPUT_FS_12000; + break; + + case CODER_FMT_FS_11025: + dFs = OUTPUT_FS_11025; + break; + + case CODER_FMT_FS_8000: + dFs = OUTPUT_FS_8000; + break; + + default: + dFs = OUTPUT_FS_DEF; + break; + } + + dTime = (dSamples / dFs) * 1000UL; + dTime += (((dSamples % dFs) * 1000UL) + (dFs - 1UL)) / dFs; + + return dTime; +} + +/**************************************************************************** + * GetOutputPosition + * + * Function: + * Get present output position (unit of ms). + * Arguments: + * dCoderId Coder ID + * pdPos Pointer of output position + * Return: + * 0 success + * < 0 error code + * + ****************************************************************************/ +static SINT32 GetOutputPosition(UINT32 dCoderId, UINT32 *pdPos) +{ + UINT32 dOutputPos; + UINT8 abOutputPos[4]; + struct DEC_INFO *psDecInfo; + + psDecInfo = GetDecInfo(dCoderId); + + /* Path check */ + switch (psDecInfo->sConnect.bOutDest) { + case CDSP_OUT_DEST_RFIFO: + case CDSP_OUT_DEST_OTHER_INBUF: + case CDSP_OUT_DEST_NONE: + return MCDRV_ERROR; + + default: + break; + } + + /* DEC_POS Read */ + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DEC_POS1), &abOutputPos[3], 1); + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DEC_POS2), &abOutputPos[2], 1); + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DEC_POS3), &abOutputPos[1], 1); + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DEC_POS4), &abOutputPos[0], 1); + + dOutputPos = ((UINT32)abOutputPos[3] << 24) + | ((UINT32)abOutputPos[2] << 16) + | ((UINT32)abOutputPos[1] << 8) + | (UINT32)abOutputPos[0]; + + /* sample -> msec */ + *pdPos = ConvertSamplesToTime(psDecInfo->sFormat.bFs, dOutputPos); + + return MCDRV_SUCCESS; +} + +/**************************************************************************** + * InterruptProcDecErr + * + * Function: + * Decoder/Encoder ERR Interrupt. + * Arguments: + * dCoderId Coder ID + * Return: + * None + * + ****************************************************************************/ +static void InterruptProcDecErr(UINT32 dCoderId) +{ + UINT8 bAdd; + UINT8 bData; + SINT32 sdRet; + UINT32 dPos; + struct DEC_INFO *psDecInfo; + struct DEC_INFO *psOtherDecInfo; + struct MC_CODER_PARAMS sParam; + + psDecInfo = GetDecInfo(dCoderId); + psOtherDecInfo = GetOtherDecInfo(dCoderId); + + /* Read ERR data */ + if (CODER_DEC == dCoderId) + bAdd = MCI_DEC_ERROR; + else + bAdd = MCI_ENC_ERROR; + + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_C | (UINT32)bAdd), &bData, 1); + + psDecInfo->wErrorCode = (UINT16)bData; + + dPos = 0; + GetOutputPosition(dCoderId, &dPos); + + if (DEC_ERR_PROG_SPECIFIC_MAX < psDecInfo->wErrorCode) { + /* Stop */ + FifoStop(dCoderId); + sdRet = DecStop(dCoderId, MADEVCDSP_VERIFY_COMP_OFF); + + /* Reset command */ + sParam.bCommandId = (UINT8)CDSP_CMD_HOST2OS_CMN_RESET; + sdRet = CommandWriteHost2Os(dCoderId, &sParam); + + /* Command register Initialize */ + CommandInitialize(dCoderId); + + /* EDEC/EENC_SFR Disable */ + if (CODER_DEC == dCoderId) { + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DEC_ENABLE), + &bData, 1); + bData &= ~MCB_EDEC_SFR; + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DEC_ENABLE), + bData); + } else { + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_ENC_ENABLE), + &bData, 1); + bData &= ~MCB_EENC_SFR; + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_ENC_ENABLE), + bData); + } + McDevIf_ExecutePacket(); + + /* EDEC/EENC Disable */ + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_ECDSP), + &bData, 1); + if (CODER_DEC == dCoderId) + bData &= ~MCB_EDEC; + else + bData &= ~MCB_EENC; + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_ECDSP), + bData); + McDevIf_ExecutePacket(); + + /* Parameter Initialize */ + psDecInfo->sProgInfo.wVendorId = 0; + psDecInfo->sProgInfo.wFunctionId = 0; + + psDecInfo->dState = STATE_READY_SETUP; + + /* Callback (ERROR) */ + psDecInfo->sCbInfo.abCbOn[CALLBACK_PLAY_ERROR2] = CALLBACK_ON; + psDecInfo->sCbInfo.adCbExInfo[CALLBACK_PLAY_ERROR2] = + (dPos << 8) | (UINT32)(psDecInfo->wErrorCode & 0xFF); + } else { + FifoStop(dCoderId); + DecStop(dCoderId, MADEVCDSP_VERIFY_COMP_OFF); + + psDecInfo->dState = STATE_READY; + + /* Callback (ERROR) */ + psDecInfo->sCbInfo.abCbOn[CALLBACK_PLAY_ERROR1] = CALLBACK_ON; + psDecInfo->sCbInfo.adCbExInfo[CALLBACK_PLAY_ERROR1] = + (dPos << 8) | (UINT32)(psDecInfo->wErrorCode & 0xFF); + } +} + +/*************************************************************************** + * OutputStart + * + * Function: + * Start OFIFO. + * Arguments: + * psDecInfo CDSP decoder/encoder + * management module's information + * Return: + * None + * + ****************************************************************************/ +static void OutputStart(struct DEC_INFO *psDecInfo) +{ + UINT8 bOutDest; + + bOutDest = psDecInfo->sConnect.bOutDest; + switch (bOutDest) { + case CDSP_OUT_DEST_OFIFO: + break; + + case CDSP_OUT_DEST_OFIFO_RFIFO: + if (GetRFifoSel() != CDSP_FIFO_SEL_PORT) + bOutDest = CDSP_OUT_DEST_OFIFO; + break; + + case CDSP_OUT_DEST_RFIFO: + if (GetRFifoSel() != CDSP_FIFO_SEL_PORT) + return; + break; + + default: + return; + } + + if ((psDecInfo->sProgInfo.wOutStartMode != 0) + && (psDecInfo->bChangeOutputFs == CHANGE_OUTPUT_FS_OFF)) + return; + + switch (bOutDest) { + case CDSP_OUT_DEST_OFIFO: + if (gsFifoInfo.bOFifoOutStart != OUTPUT_START_ON) + return; + + OFifoStartReal(); + break; + + case CDSP_OUT_DEST_OFIFO_RFIFO: + if ((gsFifoInfo.bOFifoOutStart != OUTPUT_START_ON) + || (gsFifoInfo.bRFifoOutStart != OUTPUT_START_ON)) + return; + + OFifoStartReal(); + RFifoStartReal(); + break; + + case CDSP_OUT_DEST_RFIFO: + if (gsFifoInfo.bRFifoOutStart != OUTPUT_START_ON) + return; + + RFifoStartReal(); + break; + + default: + break; + } +} + +/**************************************************************************** + * InterruptProcDecEnd + * + * Function: + * Decoder/Encoder END Interrupt. + * Arguments: + * dCoderId Coder ID + * Return: + * None + * + ****************************************************************************/ +static void InterruptProcDecEnd(UINT32 dCoderId) +{ + UINT8 bData; + UINT32 dInputPos; + SINT32 sdRet; + struct DEC_INFO *psDecInfo; + struct DEC_INFO *psOtherDecInfo; + struct MC_CODER_PARAMS sParam; + + psDecInfo = GetDecInfo(dCoderId); + psOtherDecInfo = GetOtherDecInfo(dCoderId); + + if (psDecInfo->bFmtPropagate == FORMAT_PROPAGATE_ON) { + psDecInfo->sFormat.bFs = psOtherDecInfo->sFormat.bFs; + + /* DEC/ENC Stop */ + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DEC_START), &bData, 1); + if (CODER_DEC == psDecInfo->dCoderId) + bData &= ~MCB_DEC_DEC_START; + else + bData &= ~MCB_DEC_ENC_START; + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DEC_START), bData); + McDevIf_ExecutePacket(); + + /* VerifyStopCompletion command */ + sParam.bCommandId = + (UINT8)CDSP_CMD_HOST2OS_SYS_VERIFY_STOP_COMP; + sdRet = CommandWriteHost2Os(dCoderId, &sParam); + + /* GetInputPos command */ + sParam.bCommandId = (UINT8)CDSP_CMD_HOST2OS_SYS_GET_INPUT_POS; + sdRet = CommandWriteHost2Os(dCoderId, &sParam); + + /* InputPos */ + dInputPos = CreateUINT32( + sParam.abParam[CDSP_CMD_PARAM_RESULT_03], + sParam.abParam[CDSP_CMD_PARAM_RESULT_02], + sParam.abParam[CDSP_CMD_PARAM_RESULT_01], + sParam.abParam[CDSP_CMD_PARAM_RESULT_00]); + + psDecInfo->dInPosSup += dInputPos; + + /* Clear command */ + sParam.bCommandId = (UINT8)CDSP_CMD_HOST2OS_CMN_CLEAR; + sdRet = CommandWriteHost2Os(dCoderId, &sParam); + + /* DEC/ENC Start */ + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DEC_START), &bData, 1); + if (CODER_DEC == psDecInfo->dCoderId) + bData |= MCB_DEC_DEC_START; + else + bData |= MCB_DEC_ENC_START; + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DEC_START), + bData); + McDevIf_ExecutePacket(); + + psDecInfo->bFmtPropagate = FORMAT_PROPAGATE_OFF; + + /* Callback (HOST Command) */ + psOtherDecInfo->sCbInfo.abCbOn[CALLBACK_HOSTCOMMAND] = + CALLBACK_ON; + } else { + switch (psOtherDecInfo->dState) { + case STATE_READY_SETUP: + psOtherDecInfo->bPreInputDataEnd = INPUT_DATAEND_SET; + break; + + case STATE_READY: + case STATE_PLAYING: + if (CDSP_IN_SOURCE_OTHER_OUTBUF == + psOtherDecInfo->sConnect.bInSource) { + /* InputDataEnd command */ + CommandInputDataEnd(psOtherDecInfo->dCoderId); + /* Input data end flag - set */ + psOtherDecInfo->bInputDataEnd = + INPUT_DATAEND_SET; + /* OutputStart */ + OutputStart(psOtherDecInfo); + } + break; + + default: + break; + } + + /* ClearInputDataEnd command */ + sParam.bCommandId = + (UINT8)CDSP_CMD_HOST2OS_SYS_CLEAR_INPUT_DATA_END; + sdRet = CommandWriteHost2Os(dCoderId, &sParam); + + /* Input data end flag - release */ + psDecInfo->bInputDataEnd = INPUT_DATAEND_RELEASE; + + FifoStop(dCoderId); + DecStop(dCoderId, MADEVCDSP_VERIFY_COMP_ON); + + psDecInfo->dState = STATE_READY; + + /* Callback (DEC/ENC END) */ + psDecInfo->sCbInfo.abCbOn[CALLBACK_END_OF_SEQUENCE] = + CALLBACK_ON; + } +} + +/**************************************************************************** + * InterruptProcDec + * + * Function: + * Decoder/Encoder interrupt function. + * Arguments: + * dCoderId Coder ID + * Return: + * None + * + ****************************************************************************/ +static void InterruptProcDec(UINT32 dCoderId) +{ + UINT8 bData; + UINT8 bClear; + struct DEC_INFO *psDecInfo; + + psDecInfo = GetDecInfo(dCoderId); + + /* Read interrupt flag */ + if (CODER_DEC == dCoderId) { + McDevIf_ReadDirect(((UINT32)MCI_DEC_FLG + | (UINT32)MCDRV_PACKET_REGTYPE_C), + &bData, 1); + bClear = 0; + if (0 != (MCB_DEC_FLG_SFR & bData)) { + InterruptProcDecSfr(dCoderId); + bClear |= MCB_DEC_FLG_SFR; + } + if (0 != (MCB_DEC_FLG_ERR & bData)) { + InterruptProcDecErr(dCoderId); + bClear |= MCB_DEC_FLG_ERR; + } + if ((0 != (MCB_DEC_FLG_END & bData)) + && (STATE_PLAYING == psDecInfo->dState)) { + InterruptProcDecEnd(dCoderId); + bClear |= MCB_DEC_FLG_END; + } + if (0 != (MCB_DEC_EVT_FLG & bData)) { + InterruptProcDecEvt(dCoderId); + bClear |= MCB_DEC_EVT_FLG; + } + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DEC_FLG), + bClear); + + McDevIf_ExecutePacket(); + } else { + McDevIf_ReadDirect(((UINT32)MCI_ENC_FLG + | (UINT32)MCDRV_PACKET_REGTYPE_C), + &bData, 1); + bClear = 0; + if (0 != (MCB_ENC_FLG_SFR & bData)) { + InterruptProcDecSfr(dCoderId); + bClear |= MCB_ENC_FLG_SFR; + } + if (0 != (MCB_ENC_FLG_ERR & bData)) { + InterruptProcDecErr(dCoderId); + bClear |= MCB_ENC_FLG_ERR; + } + if ((0 != (MCB_ENC_FLG_END & bData)) + && (STATE_PLAYING == psDecInfo->dState)) { + InterruptProcDecEnd(dCoderId); + bClear |= MCB_ENC_FLG_END; + } + if (0 != (MCB_ENC_EVT_FLG & bData)) { + InterruptProcDecEvt(dCoderId); + bClear |= MCB_ENC_EVT_FLG; + } + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_ENC_FLG), + bClear); + + McDevIf_ExecutePacket(); + } +} + +/*************************************************************************** + * InterruptProcDFifo + * + * Function: + * DFIFO interrupt function. + * Arguments: + * None + * Return: + * None + * + ****************************************************************************/ +static void InterruptProcDFifo(void) +{ + UINT8 bIntFlg; + UINT8 bIntCtrl; + UINT32 i; + struct DEC_INFO *psDecInfo; + struct DEC_INFO *pasDecInfo[CODER_NUM]; + + /* Read interrupt flag */ + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DFIFO_FLG), &bIntFlg, 1); + + /* Interrupt process */ + /* EDPNT, EDEMP Read */ + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DFIFO_ENABLE), &bIntCtrl, 1); + + psDecInfo = NULL; + pasDecInfo[CODER_DEC] = &gsDecInfo; + pasDecInfo[CODER_ENC] = &gsEncInfo; + for (i = 0; i < (UINT32)CODER_NUM; i++) { + switch (pasDecInfo[i]->sConnect.bInSource) { + case CDSP_IN_SOURCE_DFIFO: + case CDSP_IN_SOURCE_DFIFO_EFIFO: + if ((UINT32)STATE_INIT < pasDecInfo[i]->dState) + psDecInfo = pasDecInfo[i]; + break; + + default: + break; + } + + if (NULL != psDecInfo) + break; + } + + /* DPNT */ + if ((MCB_DFIFO_FLG_DPNT == (bIntFlg & MCB_DFIFO_FLG_DPNT)) + && (MCB_DFIFO_EDPNT == (bIntCtrl & MCB_DFIFO_EDPNT))) { + /* EDPNT Disable */ + bIntCtrl &= ~MCB_DFIFO_EDPNT; + + /* Callback (DFIFO POINT) */ + if (NULL != psDecInfo) + psDecInfo->sCbInfo.abCbOn[CALLBACK_DFIFOPOINT] = + CALLBACK_ON; + } + + /* DEMP */ + if ((MCB_DFIFO_FLG_DEMP == (bIntFlg & MCB_DFIFO_FLG_DEMP)) + && (MCB_DFIFO_EDEMP == (bIntCtrl & MCB_DFIFO_EDEMP))) { + /* EDEMP Disable */ + bIntCtrl &= ~MCB_DFIFO_EDEMP; + + /* Callback (DFIFO EMPTY) */ + if (NULL != psDecInfo) + psDecInfo->sCbInfo.abCbOn[CALLBACK_DFIFOEMPTY] = + CALLBACK_ON; + } + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DFIFO_ENABLE), + bIntCtrl); + + /* Clear interrupt flag */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DFIFO_FLG), + bIntFlg); + + McDevIf_ExecutePacket(); +} + +/*************************************************************************** + * InterruptProcOFifoCore + * + * Function: + * OFIFO interrupt function Core. + * Arguments: + * None + * Return: + * None + * + ****************************************************************************/ +static void InterruptProcOFifoCore(void) +{ + UINT8 bData; + UINT32 i; + struct DEC_INFO *psDecInfo; + struct DEC_INFO *pasDecInfo[CODER_NUM]; + + /* EOPNT Disable */ + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_OFIFO_ENABLE), &bData, 1); + bData &= ~MCB_OFIFO_EOPNT; + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_OFIFO_ENABLE), + bData); + + /* EOFIFO Disable */ + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_ECDSP), + &bData, 1); + bData &= ~MCB_EOFIFO; + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_ECDSP), + bData); + + McDevIf_ExecutePacket(); + + /* OUT START */ + gsFifoInfo.bOFifoOutStart = OUTPUT_START_ON; + + psDecInfo = NULL; + pasDecInfo[CODER_DEC] = &gsDecInfo; + pasDecInfo[CODER_ENC] = &gsEncInfo; + for (i = 0; i < (UINT32)CODER_NUM; i++) { + switch (pasDecInfo[i]->sConnect.bOutDest) { + case CDSP_OUT_DEST_OFIFO: + case CDSP_OUT_DEST_OFIFO_RFIFO: + if ((UINT32)STATE_INIT < pasDecInfo[i]->dState) + psDecInfo = pasDecInfo[i]; + break; + + default: + break; + } + + if (NULL != psDecInfo) + break; + } + + /* OUT_START Set */ + if (NULL != psDecInfo) + OutputStart(psDecInfo); +} + +/*************************************************************************** + * InterruptProcOFifo + * + * Function: + * OFIFO interrupt function. + * Arguments: + * None + * Return: + * None + * + ****************************************************************************/ +static void InterruptProcOFifo(void) +{ + UINT8 bIntFlg; + + /* Read interrupt flag */ + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_C | (UINT32)MCI_OFIFO_FLG), + &bIntFlg, 1); + + /* Interrupt process */ + if (MCB_OFIFO_FLG_OPNT == (MCB_OFIFO_FLG_OPNT & bIntFlg)) + InterruptProcOFifoCore(); + + /* Clear interrupt flag */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_OFIFO_FLG), + bIntFlg); + + McDevIf_ExecutePacket(); +} + +/*************************************************************************** + * InterruptProcRFifoPortCore + * + * Function: + * RFIFO interrupt function. + * Arguments: + * None + * Return: + * None + * + ****************************************************************************/ +static void InterruptProcRFifoPortCore(void) +{ + UINT8 bData; + UINT32 i; + struct DEC_INFO *psDecInfo; + struct DEC_INFO *pasDecInfo[CODER_NUM]; + + /* ERPNT Disable */ + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_RFIFO_ENABLE), &bData, 1); + bData &= ~MCB_RFIFO_ERPNT; + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_RFIFO_ENABLE), + bData); + + /* ERFIFO Disable */ + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_ECDSP), + &bData, 1); + bData &= ~MCB_ERFIFO; + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_ECDSP), + bData); + + McDevIf_ExecutePacket(); + + /* OUT START */ + gsFifoInfo.bRFifoOutStart = OUTPUT_START_ON; + + psDecInfo = NULL; + pasDecInfo[CODER_DEC] = &gsDecInfo; + pasDecInfo[CODER_ENC] = &gsEncInfo; + for (i = 0; i < (UINT32)CODER_NUM; i++) { + switch (pasDecInfo[i]->sConnect.bOutDest) { + case CDSP_OUT_DEST_RFIFO: + case CDSP_OUT_DEST_OFIFO_RFIFO: + if ((UINT32)STATE_INIT < pasDecInfo[i]->dState) + psDecInfo = pasDecInfo[i]; + break; + + default: + break; + } + + if (NULL != psDecInfo) + break; + } + + /* OUT_START Set */ + if (NULL != psDecInfo) + OutputStart(psDecInfo); +} + +/*************************************************************************** + * InterruptProcRFifoPort + * + * Function: + * RFIFO interrupt function. + * Arguments: + * None + * Return: + * None + * + ****************************************************************************/ +static void InterruptProcRFifoPort(void) +{ + UINT8 bIntFlg; + + /* Read interrupt flag */ + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_C | (UINT32)MCI_RFIFO_FLG), + &bIntFlg, 1); + + /* Interrupt process */ + if (MCB_OFIFO_FLG_OPNT == (MCB_OFIFO_FLG_OPNT & bIntFlg)) + InterruptProcRFifoPortCore(); + + /* Clear interrupt flag */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_RFIFO_FLG), + bIntFlg); + + McDevIf_ExecutePacket(); +} + +/*************************************************************************** + * InterruptProcRFifoHost + * + * Function: + * RFIFO interrupt function. + * Arguments: + * None + * Return: + * None + * + ****************************************************************************/ +static void InterruptProcRFifoHost(void) +{ + UINT8 bIntFlg; + UINT8 bIntCtrl; + UINT32 i; + struct DEC_INFO *psDecInfo; + struct DEC_INFO *pasDecInfo[CODER_NUM]; + + /* Read interrupt flag */ + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_C | (UINT32)MCI_RFIFO_FLG), + &bIntFlg, 1); + + /* Interrupt process */ + + /* ERxxx Read */ + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_C | (UINT32)MCI_RFIFO_ENABLE), + &bIntCtrl, 1); + + if (MCB_RFIFO_FLG_RPNT == (MCB_RFIFO_FLG_RPNT & bIntFlg)) { + psDecInfo = NULL; + pasDecInfo[CODER_DEC] = &gsDecInfo; + pasDecInfo[CODER_ENC] = &gsEncInfo; + + for (i = 0; i < (UINT32)CODER_NUM; i++) { + switch (pasDecInfo[i]->sConnect.bOutDest) { + case CDSP_OUT_DEST_RFIFO: + case CDSP_OUT_DEST_OFIFO_RFIFO: + if ((UINT32)STATE_INIT < pasDecInfo[i]->dState) + psDecInfo = pasDecInfo[i]; + break; + + default: + break; + } + + if (NULL != psDecInfo) + break; + } + + if (MCB_RFIFO_ERPNT == (MCB_RFIFO_ERPNT & bIntCtrl)) { + /* ERPNT Disable */ + bIntCtrl &= ~MCB_RFIFO_ERPNT; + + /* Callback (RFIFO POINT) */ + if (NULL != psDecInfo) + psDecInfo->sCbInfo.abCbOn[CALLBACK_RFIFOPOINT] + = CALLBACK_ON; + } + + if ((MCB_RFIFO_FLG_ROVF == (MCB_RFIFO_FLG_ROVF & bIntFlg)) + && (MCB_RFIFO_EROVF == (MCB_RFIFO_EROVF & bIntCtrl))) { + /* EROVF Disable */ + bIntCtrl &= ~MCB_RFIFO_EROVF; + + /* Callback (RecBuf Overflow) */ + if (NULL != psDecInfo) + psDecInfo->sCbInfo.abCbOn[CALLBACK_RECBUF_OVF] + = CALLBACK_ON; + } + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_RFIFO_ENABLE), bIntCtrl); + } + + /* Clear interrupt flag */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_RFIFO_FLG), bIntFlg); + + McDevIf_ExecutePacket(); +} + +/*************************************************************************** + * InterruptProcRFifo + * + * Function: + * RFIFO interrupt function. + * Arguments: + * None + * Return: + * None + * + ****************************************************************************/ +static void InterruptProcRFifo(void) +{ + if (GetRFifoSel() == CDSP_FIFO_SEL_PORT) + InterruptProcRFifoPort(); + else + InterruptProcRFifoHost(); +} + +/**************************************************************************** + * InterruptProcCDsp + * + * Function: + * CDSP interrupt function. + * Arguments: + * None + * Return: + * None + * + ****************************************************************************/ +static void InterruptProcCDsp(void) +{ + UINT8 bDatErr; + UINT8 bData; + + /* Read interrupt flag */ + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_C | (UINT32)MCI_CDSP_FLG), + &bData, 1); + + /* Interrupt process */ + if (MCB_CDSP_FLG_ERR == (MCB_CDSP_FLG_ERR & bData)) { + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_CDSP_ERR), + &bDatErr, 1); + + gsCdspInfo.wHwErrorCode = (UINT16)bDatErr; + } else if (MCB_CDSP_FLG_WDT == (MCB_CDSP_FLG_WDT & bData)) + gsCdspInfo.wHwErrorCode = CDSP_ERR_WDT; + + /* Interrupt ALL disable */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DEC_ENABLE), + 0x00); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_ENC_ENABLE), + 0x00); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DFIFO_ENABLE), + 0x00); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_OFIFO_ENABLE), + 0x00); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_EFIFO_ENABLE), + 0x00); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_RFIFO_ENABLE), + 0x00); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_FFIFO_ENABLE), + 0x00); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_CDSP_ENABLE), + 0x00); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_ECDSP), + 0x00); + + /* State update */ + gsDecInfo.dState = STATE_NOTINIT; + gsEncInfo.dState = STATE_NOTINIT; + + /* Callback (HW ERROR) */ + gsDecInfo.sCbInfo.abCbOn[CALLBACK_HW_ERROR] = CALLBACK_ON; + gsDecInfo.sCbInfo.adCbExInfo[CALLBACK_HW_ERROR] = + (UINT32)(gsCdspInfo.wHwErrorCode & 0xFF); + gsEncInfo.sCbInfo.abCbOn[CALLBACK_HW_ERROR] = CALLBACK_ON; + gsEncInfo.sCbInfo.adCbExInfo[CALLBACK_HW_ERROR] = + (UINT32)(gsCdspInfo.wHwErrorCode & 0xFF); + + /* Clear interrupt flag */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_CDSP_FLG), + bData); + + McDevIf_ExecutePacket(); +} + +/**************************************************************************** + * CallbackProcCore + * + * Function: + * Callback process. + * Arguments: + * psCbInfo Pointer of Callback info + * sdHd Callback handle + * Return: + * None + * + ****************************************************************************/ +static void CallbackProcCore(struct CALLBACK_INFO *psCbInfo, SINT32 sdHd) +{ + if (psCbInfo->pcbFunc != NULL) { + if (CALLBACK_ON == psCbInfo->abCbOn[CALLBACK_HOSTCOMMAND]) + psCbInfo->pcbFunc(sdHd, MCDRV_CDSP_EVT_PARAM, 0); + if (CALLBACK_ON == psCbInfo->abCbOn[CALLBACK_END_OF_SEQUENCE]) + psCbInfo->pcbFunc(sdHd, MCDRV_CDSP_EVT_END, 0); + if (CALLBACK_ON == psCbInfo->abCbOn[CALLBACK_DFIFOPOINT]) + psCbInfo->pcbFunc(sdHd, MCDRV_CDSP_EVT_FIFO, 0); + if (CALLBACK_ON == psCbInfo->abCbOn[CALLBACK_RFIFOPOINT]) + psCbInfo->pcbFunc(sdHd, MCDRV_CDSP_EVT_FIFO, 1); + if (CALLBACK_ON == psCbInfo->abCbOn[CALLBACK_DFIFOEMPTY]) + psCbInfo->pcbFunc(sdHd, MCDRV_CDSP_EVT_FIFO, 2); + if (CALLBACK_ON == psCbInfo->abCbOn[CALLBACK_RECBUF_OVF]) + psCbInfo->pcbFunc(sdHd, MCDRV_CDSP_EVT_FIFO, 3); + if (CALLBACK_ON == psCbInfo->abCbOn[CALLBACK_TIMER]) + psCbInfo->pcbFunc(sdHd, MCDRV_CDSP_EVT_TIMER, 0); + if (CALLBACK_ON == psCbInfo->abCbOn[CALLBACK_PLAY_ERROR1]) + psCbInfo->pcbFunc(sdHd, MCDRV_CDSP_EVT_ERROR, + psCbInfo->adCbExInfo[CALLBACK_PLAY_ERROR1]); + if (CALLBACK_ON == psCbInfo->abCbOn[CALLBACK_PLAY_ERROR2]) + psCbInfo->pcbFunc(sdHd, MCDRV_CDSP_EVT_ERROR, + psCbInfo->adCbExInfo[CALLBACK_PLAY_ERROR2]); + if (CALLBACK_ON == psCbInfo->abCbOn[CALLBACK_HW_ERROR]) + psCbInfo->pcbFunc(sdHd, MCDRV_CDSP_EVT_ERROR, + psCbInfo->adCbExInfo[CALLBACK_HW_ERROR]); + } + + psCbInfo->abCbOn[CALLBACK_HOSTCOMMAND] = CALLBACK_OFF; + psCbInfo->abCbOn[CALLBACK_END_OF_SEQUENCE] = CALLBACK_OFF; + psCbInfo->abCbOn[CALLBACK_DFIFOPOINT] = CALLBACK_OFF; + psCbInfo->abCbOn[CALLBACK_RFIFOPOINT] = CALLBACK_OFF; + psCbInfo->abCbOn[CALLBACK_DFIFOEMPTY] = CALLBACK_OFF; + psCbInfo->abCbOn[CALLBACK_RECBUF_OVF] = CALLBACK_OFF; + psCbInfo->abCbOn[CALLBACK_TIMER] = CALLBACK_OFF; + psCbInfo->abCbOn[CALLBACK_PLAY_ERROR1] = CALLBACK_OFF; + psCbInfo->adCbExInfo[CALLBACK_PLAY_ERROR1] = 0; + psCbInfo->abCbOn[CALLBACK_PLAY_ERROR2] = CALLBACK_OFF; + psCbInfo->adCbExInfo[CALLBACK_PLAY_ERROR2] = 0; + psCbInfo->abCbOn[CALLBACK_HW_ERROR] = CALLBACK_OFF; + psCbInfo->adCbExInfo[CALLBACK_HW_ERROR] = 0; + +} + +/**************************************************************************** + * CallbackProc + * + * Function: + * Callback process. + * Arguments: + * None + * Return: + * None + * + ****************************************************************************/ +static void CallbackProc(void) +{ + CallbackProcCore(&(gsDecInfo.sCbInfo), 0); + CallbackProcCore(&(gsEncInfo.sCbInfo), 1); +} + +/**************************************************************************** + * GetCDSPChunk + * + * Function: + * Get chunk of CDSP + * Arguments: + * psPrm Pointer of AEC Data + * psCdspInfo Pointer of AEC analyze info + * Return: + * None + * + ****************************************************************************/ +static void GetCDSPChunk(struct MCDRV_AEC_INFO *psPrm, + struct MCDRV_CDSP_AEC_CDSP_INFO *psCdspInfo) +{ + struct AEC_CDSP_FUNC_INFO *psFuncInfoA; + struct AEC_CDSP_FUNC_INFO *psFuncInfoB; + + psFuncInfoA = &psCdspInfo->asFuncInfo[AEC_FUNC_INFO_A]; + psFuncInfoB = &psCdspInfo->asFuncInfo[AEC_FUNC_INFO_B]; + + psFuncInfoA->dCoderId = CODER_DEC; + psFuncInfoA->bFuncOnOff = CDSP_FUNC_OFF; + psFuncInfoA->pbChunk = NULL; + psFuncInfoA->dChunkSize = 0; + + psFuncInfoB->dCoderId = CODER_ENC; + psFuncInfoB->bFuncOnOff = CDSP_FUNC_OFF; + psFuncInfoB->pbChunk = NULL; + psFuncInfoB->dChunkSize = 0; + + if (psPrm->sAecVBox.bEnable == AEC_VBOX_ENABLE) { + psFuncInfoA->bFuncOnOff = psPrm->sAecVBox.bCDspFuncAOnOff; + psFuncInfoB->bFuncOnOff = psPrm->sAecVBox.bCDspFuncBOnOff; + + if ((psFuncInfoA->bFuncOnOff == CDSP_FUNC_OFF) + && (psFuncInfoB->bFuncOnOff == CDSP_FUNC_OFF)) + return; + + if (psFuncInfoA->bFuncOnOff == CDSP_FUNC_ON) { + psFuncInfoA->pbChunk = + psPrm->sAecVBox.sAecCDspA.pbChunkData; + psFuncInfoA->dChunkSize = + psPrm->sAecVBox.sAecCDspA.dwSize; + } + + if (psFuncInfoB->bFuncOnOff == CDSP_FUNC_ON) { + psFuncInfoB->pbChunk = + psPrm->sAecVBox.sAecCDspB.pbChunkData; + psFuncInfoB->dChunkSize = + psPrm->sAecVBox.sAecCDspB.dwSize; + } + } + + if (psFuncInfoA->pbChunk != NULL) + psFuncInfoA->pbChunk = &psFuncInfoA->pbChunk[CHUNK_SIZE]; + + if (psFuncInfoB->pbChunk != NULL) + psFuncInfoB->pbChunk = &psFuncInfoB->pbChunk[CHUNK_SIZE]; + + return; +} + +/**************************************************************************** + * CheckFIFO + * + * Function: + * Check fifo + * Arguments: + * dCoderId Coder ID + * psCdspInfo Pointer of AEC analyze info + * Return: + * = 0 success + * < 0 error code + * + ****************************************************************************/ +static SINT32 CheckFIFO(UINT32 dCoderId, + struct MCDRV_CDSP_AEC_CDSP_INFO *psCdspInfo) +{ + UINT32 dPos; + UINT32 dSamples; + UINT8 bData; + UINT8 bFifo; + UINT8 bInSource; + UINT8 bOutDest; + UINT8 bBit; + UINT8 bCh; + UINT8 bE2BufMode; + UINT8 *pbPrm; + UINT32 dFifoId; + struct AEC_CDSP_FUNC_INFO *psFuncInfo; + + if (dCoderId == CODER_DEC) + psFuncInfo = &psCdspInfo->asFuncInfo[AEC_FUNC_INFO_A]; + else + psFuncInfo = &psCdspInfo->asFuncInfo[AEC_FUNC_INFO_B]; + + pbPrm = psFuncInfo->pbFifo; + + bFifo = pbPrm[CDSP_USE_FIFO]; + if (bFifo != CDSP_FIFO_DONTCARE) { + if ((bFifo & CDSP_FIFO_OTHER_OUTBUF_BIT) != 0) + if (((bFifo & CDSP_FIFO_EFIFO_BIT) != 0) + || ((bFifo & CDSP_FIFO_DFIFO_BIT) != 0)) + return MCDRV_ERROR_ARGUMENT; + + if ((bFifo & CDSP_FIFO_OTHER_INBUF_BIT) != 0) + if (((bFifo & CDSP_FIFO_OFIFO_BIT) != 0) + || ((bFifo & CDSP_FIFO_RFIFO_BIT) != 0)) + return MCDRV_ERROR_ARGUMENT; + + if ((bFifo & CDSP_FIFO_OTHER_OUTBUF_BIT) != 0) + bInSource = CDSP_IN_SOURCE_OTHER_OUTBUF; + else if (((bFifo & CDSP_FIFO_EFIFO_BIT) != 0) + && ((bFifo & CDSP_FIFO_DFIFO_BIT) != 0)) + bInSource = CDSP_IN_SOURCE_DFIFO_EFIFO; + else if ((bFifo & CDSP_FIFO_DFIFO_BIT) != 0) + bInSource = CDSP_IN_SOURCE_DFIFO; + else if ((bFifo & CDSP_FIFO_EFIFO_BIT) != 0) + bInSource = CDSP_IN_SOURCE_EFIFO; + else + bInSource = CDSP_IN_SOURCE_NONE; + + psFuncInfo->sConnect.bInSource = bInSource; + + if ((bFifo & CDSP_FIFO_OTHER_INBUF_BIT) != 0) + bOutDest = CDSP_OUT_DEST_OTHER_INBUF; + else if (((bFifo & CDSP_FIFO_OFIFO_BIT) != 0) + && ((bFifo & CDSP_FIFO_RFIFO_BIT) != 0)) + bOutDest = CDSP_OUT_DEST_OFIFO_RFIFO; + else if ((bFifo & CDSP_FIFO_OFIFO_BIT) != 0) + bOutDest = CDSP_OUT_DEST_OFIFO; + else if ((bFifo & CDSP_FIFO_RFIFO_BIT) != 0) + bOutDest = CDSP_OUT_DEST_RFIFO; + else + bOutDest = CDSP_OUT_DEST_NONE; + + psFuncInfo->sConnect.bOutDest = bOutDest; + } + + dFifoId = GetFifoIdCore(&psFuncInfo->sConnect); + + /* EFIFO */ + if ((dFifoId & FIFO_EFIFO) != 0) { + if (pbPrm[ROUTE_EFIFO0_SEL] != CDSP_FIFO_DONTCARE) { + bData = (psCdspInfo->bEFifo01Sel & ~MCB_EFIFO0_SEL); + bData |= pbPrm[ROUTE_EFIFO0_SEL] & MCB_EFIFO0_SEL; + psCdspInfo->bEFifo01Sel = bData; + } + + if (pbPrm[ROUTE_EFIFO1_SEL] != CDSP_FIFO_DONTCARE) { + bData = (psCdspInfo->bEFifo01Sel & ~MCB_EFIFO1_SEL); + bData |= (pbPrm[ROUTE_EFIFO1_SEL] << 4) & + MCB_EFIFO1_SEL; + psCdspInfo->bEFifo01Sel = bData; + } + + if (pbPrm[ROUTE_EFIFO2_SEL] != CDSP_FIFO_DONTCARE) { + bData = (psCdspInfo->bEFifo23Sel & ~MCB_EFIFO2_SEL); + bData |= pbPrm[ROUTE_EFIFO2_SEL] & MCB_EFIFO2_SEL; + psCdspInfo->bEFifo23Sel = bData; + } + + if (pbPrm[ROUTE_EFIFO3_SEL] != CDSP_FIFO_DONTCARE) { + bData = (psCdspInfo->bEFifo23Sel & ~MCB_EFIFO3_SEL); + bData |= (pbPrm[ROUTE_EFIFO3_SEL] << 4) & + MCB_EFIFO3_SEL; + psCdspInfo->bEFifo23Sel = bData; + } + + /* 0: 2ch 16bit */ + /* 1: 4ch 16bit */ + /* 2: 2ch 32bit */ + /* 3: 4ch 32bit */ + bCh = psFuncInfo->sConnectEx.bEfifoCh; + bBit = psFuncInfo->sBitWidth.bEfifoBit; + bE2BufMode = psFuncInfo->sFormat.bE2BufMode; + + switch (pbPrm[CDSP_EFIFO_CH]) { + case 2: + case 4: + bCh = pbPrm[CDSP_EFIFO_CH]; + break; + + case CDSP_FIFO_DONTCARE: + break; + + default: + return MCDRV_ERROR_ARGUMENT; + } + + switch (pbPrm[CDSP_EFIFO_BIT_WIDTH]) { + case 16: + case 32: + bBit = pbPrm[CDSP_EFIFO_BIT_WIDTH]; + break; + + case CDSP_FIFO_DONTCARE: + break; + + default: + return MCDRV_ERROR_ARGUMENT; + } + + switch (pbPrm[CDSP_EFIFO_E2BUF_MODE]) { + case CODER_FMT_ETOBUF_LRMIX: + case CODER_FMT_ETOBUF_LCH: + case CODER_FMT_ETOBUF_RCH: + bE2BufMode = pbPrm[CDSP_EFIFO_E2BUF_MODE]; + break; + + case CDSP_FIFO_DONTCARE: + break; + + default: + return MCDRV_ERROR_ARGUMENT; + } + + psFuncInfo->sConnectEx.bEfifoCh = bCh; + psFuncInfo->sBitWidth.bEfifoBit = bBit; + psFuncInfo->sFormat.bE2BufMode = bE2BufMode; + } + + /* OFIFO */ + if (pbPrm[ROUTE_OUT0L_SEL] != CDSP_FIFO_DONTCARE) { + if (((dFifoId & FIFO_OFIFO) != 0) || + (pbPrm[ROUTE_OUT0L_SEL] == OUT_LOOPBACK_L) || + (pbPrm[ROUTE_OUT0L_SEL] == OUT_LOOPBACK_R)) { + bData = (psCdspInfo->bOut0Sel & ~MCB_OUT0L_SEL); + bData |= (pbPrm[ROUTE_OUT0L_SEL] & MCB_OUT0L_SEL); + psCdspInfo->bOut0Sel = bData; + } + } + + if (pbPrm[ROUTE_OUT0R_SEL] != CDSP_FIFO_DONTCARE) { + if (((dFifoId & FIFO_OFIFO) != 0) || + (pbPrm[ROUTE_OUT0R_SEL] == OUT_LOOPBACK_L) || + (pbPrm[ROUTE_OUT0R_SEL] == OUT_LOOPBACK_R)) { + bData = (psCdspInfo->bOut0Sel & ~MCB_OUT0R_SEL); + bData |= (pbPrm[ROUTE_OUT0R_SEL] << 4) & MCB_OUT0R_SEL; + psCdspInfo->bOut0Sel = bData; + } + } + + if (pbPrm[ROUTE_OUT1L_SEL] != CDSP_FIFO_DONTCARE) { + if (((dFifoId & FIFO_OFIFO) != 0) || + (pbPrm[ROUTE_OUT1L_SEL] == OUT_LOOPBACK_L) || + (pbPrm[ROUTE_OUT1L_SEL] == OUT_LOOPBACK_R)) { + bData = (psCdspInfo->bOut1Sel & ~MCB_OUT1L_SEL); + bData |= (pbPrm[ROUTE_OUT1L_SEL] & MCB_OUT1L_SEL); + psCdspInfo->bOut1Sel = bData; + } + } + + if (pbPrm[ROUTE_OUT1R_SEL] != CDSP_FIFO_DONTCARE) { + if (((dFifoId & FIFO_OFIFO) != 0) || + (pbPrm[ROUTE_OUT1R_SEL] == OUT_LOOPBACK_L) || + (pbPrm[ROUTE_OUT1R_SEL] == OUT_LOOPBACK_R)) { + bData = (psCdspInfo->bOut1Sel & ~MCB_OUT1R_SEL); + bData |= (pbPrm[ROUTE_OUT1R_SEL] << 4) & MCB_OUT1R_SEL; + psCdspInfo->bOut1Sel = bData; + } + } + + if (pbPrm[ROUTE_OUT2L_SEL] != CDSP_FIFO_DONTCARE) { + if (((dFifoId & FIFO_OFIFO) != 0) || + (pbPrm[ROUTE_OUT2L_SEL] == OUT_LOOPBACK_L) || + (pbPrm[ROUTE_OUT2L_SEL] == OUT_LOOPBACK_R)) { + bData = (psCdspInfo->bOut2Sel & ~MCB_OUT2L_SEL); + bData |= (pbPrm[ROUTE_OUT2L_SEL] & MCB_OUT2L_SEL); + psCdspInfo->bOut2Sel = bData; + } + } + + if (pbPrm[ROUTE_OUT2R_SEL] != CDSP_FIFO_DONTCARE) { + if (((dFifoId & FIFO_OFIFO) != 0) || + (pbPrm[ROUTE_OUT2R_SEL] == OUT_LOOPBACK_L) || + (pbPrm[ROUTE_OUT2R_SEL] == OUT_LOOPBACK_R)) { + bData = (psCdspInfo->bOut2Sel & ~MCB_OUT2R_SEL); + bData |= (pbPrm[ROUTE_OUT2R_SEL] << 4) & MCB_OUT2R_SEL; + psCdspInfo->bOut2Sel = bData; + } + } + + if ((dFifoId & FIFO_OFIFO) != 0) { + /* 0: 2ch 16bit) */ + /* 1: 4ch 16bit */ + /* 2: 2ch 32bit */ + /* 3: 4ch 32bit */ + bCh = psFuncInfo->sConnectEx.bOfifoCh; + bBit = psFuncInfo->sBitWidth.bOfifoBit; + + switch (pbPrm[CDSP_OFIFO_CH]) { + case 2: + case 4: + bCh = pbPrm[CDSP_OFIFO_CH]; + break; + + case CDSP_FIFO_DONTCARE: + break; + + default: + return MCDRV_ERROR_ARGUMENT; + } + + switch (pbPrm[CDSP_OFIFO_BIT_WIDTH]) { + case 16: + case 32: + bBit = pbPrm[CDSP_OFIFO_BIT_WIDTH]; + break; + + case CDSP_FIFO_DONTCARE: + break; + + default: + return MCDRV_ERROR_ARGUMENT; + } + + psFuncInfo->sConnectEx.bOfifoCh = bCh; + psFuncInfo->sBitWidth.bOfifoBit = bBit; + + dSamples = ((UINT32)pbPrm[CDSP_OFIFO_BUFFERING + 0] << 8) | + ((UINT32)pbPrm[CDSP_OFIFO_BUFFERING + 1]); + if (CDSP_FIFO_DONTCARE_W != dSamples) { + if (OFIFO_BUF_SAMPLE_MAX < dSamples) + return MCDRV_ERROR_ARGUMENT; + psCdspInfo->dOFifoBufSample = dSamples; + } + } + + /* DFIFO */ + if ((dFifoId & FIFO_DFIFO) != 0) { + if (pbPrm[CDSP_DFIFO_BIT_WIDTH] != CDSP_FIFO_DONTCARE) { + bData = (psCdspInfo->bRDFifoBitSel & ~MCB_DFIFO_BIT); + switch (pbPrm[CDSP_DFIFO_BIT_WIDTH]) { + case 32: + bData |= MCB_DFIFO_BIT; + break; + + case 16: + default: + break; + } + psCdspInfo->bRDFifoBitSel = bData; + } + + dPos = ((UINT32)pbPrm[CDSP_DFIFO_CB_POINT + 0] << 8) | + ((UINT32)pbPrm[CDSP_DFIFO_CB_POINT + 1]); + switch (dPos) { + case CDSP_FIFO_DONTCARE_CB: + break; + + case CDSP_FIFO_NOT_CB: + psCdspInfo->sdDFifoCbPos = CBPOS_DFIFO_NONE; + break; + + default: + if (((UINT32)CBPOS_DFIFO_MAX < dPos)) + return MCDRV_ERROR_ARGUMENT; + + psCdspInfo->sdDFifoCbPos = (SINT32)dPos; + break; + } + } + + /* RFIFO */ + if ((dFifoId & FIFO_RFIFO) != 0) { + if (pbPrm[CDSP_RFIFO_BIT_WIDTH] != CDSP_FIFO_DONTCARE) { + bData = (psCdspInfo->bRDFifoBitSel & ~MCB_RFIFO_BIT); + switch (pbPrm[CDSP_RFIFO_BIT_WIDTH]) { + case 32: + bData |= MCB_RFIFO_BIT; + break; + + case 16: + default: + break; + } + psCdspInfo->bRDFifoBitSel = bData; + } + + dPos = ((UINT32)pbPrm[CDSP_RFIFO_CB_POINT + 0] << 8) | + ((UINT32)pbPrm[CDSP_RFIFO_CB_POINT + 1]); + switch (dPos) { + case CDSP_FIFO_DONTCARE_CB: + break; + + case CDSP_FIFO_NOT_CB: + psCdspInfo->sdRFifoCbPos = CBPOS_RFIFO_NONE; + break; + + default: + if (((UINT32)CBPOS_RFIFO_MAX < dPos)) + return MCDRV_ERROR_ARGUMENT; + + psCdspInfo->sdRFifoCbPos = (SINT32)dPos; + break; + } + + dSamples = ((UINT32)pbPrm[CDSP_RFIFO_BUFFERING + 0] + << 8) | + ((UINT32)pbPrm[CDSP_RFIFO_BUFFERING + 1]); + if (CDSP_FIFO_DONTCARE_W != dSamples) { + if (RFIFO_BUF_SAMPLE_MAX < dSamples) + return MCDRV_ERROR_ARGUMENT; + psCdspInfo->dRFifoBufSample = dSamples; + } + } + + return MCDRV_SUCCESS; +} + +/**************************************************************************** + * MemoryCheck + * + * Function: + * Check memory use area. + * Arguments: + * wStartAdr1 Program-1 start address + * wSize1 Program-1 size + * wStartAdr2 Program-2 start address + * wSize2 Program-2 size + * Return: + * 0 OK + * < 0 NG + * + ****************************************************************************/ +static SINT32 MemoryCheck(UINT16 wStartAdr1, UINT16 wSize1, + UINT16 wStartAdr2, UINT16 wSize2) +{ + UINT16 wEndAdr1; + UINT16 wEndAdr2; + + wEndAdr1 = wStartAdr1 + wSize1 - 1; + wEndAdr2 = wStartAdr2 + wSize2 - 1; + + if ((wStartAdr1 <= wStartAdr2) && (wStartAdr2 <= wEndAdr1)) + return MCDRV_ERROR_RESOURCEOVER; + + if ((wStartAdr1 <= wEndAdr2) && (wEndAdr2 <= wEndAdr1)) + return MCDRV_ERROR_RESOURCEOVER; + + if ((wStartAdr2 <= wStartAdr1) && (wStartAdr1 <= wEndAdr2)) + return MCDRV_ERROR_RESOURCEOVER; + + if ((wStartAdr2 <= wEndAdr1) && (wEndAdr1 <= wEndAdr2)) + return MCDRV_ERROR_RESOURCEOVER; + + return MCDRV_SUCCESS; +} + +/**************************************************************************** + * CheckProgram + * + * Function: + * Check program. + * Arguments: + * dCoderId Coder ID + * psProgram Program information + * Return: + * 0 success + * < 0 error code + * + ****************************************************************************/ +static SINT32 CheckProgram(UINT32 dCoderId, + const struct MC_CODER_FIRMWARE *psProgram) +{ + UINT16 wProgLoadAddr; + UINT16 wProgSize; + UINT16 wDataLoadAddr; + UINT16 wDataSize; + UINT16 wWorkBeginAddr; + UINT16 wWorkSize; + UINT16 wStackBeginAddr; + UINT16 wStackSize; + UINT16 wProgType; + UINT32 dTotalSize; + SINT32 sdRet; + struct DEC_INFO *psDecInfo; + struct DEC_INFO *psOtherDecInfo; + struct PROGRAM_INFO *psOtherProgInfo; + + psDecInfo = GetDecInfo(dCoderId); + psOtherDecInfo = GetOtherDecInfo(dCoderId); + + + /* Size Check */ + if (psProgram->dSize < (UINT32)PRG_DESC_PROGRAM) + return MCDRV_ERROR_ARGUMENT; + + dTotalSize = (UINT32)MAKEWORD( + psProgram->pbFirmware[PRG_DESC_PRG_SIZE], + psProgram->pbFirmware[PRG_DESC_PRG_SIZE+1]); + dTotalSize += (UINT32)MAKEWORD( + psProgram->pbFirmware[PRG_DESC_DATA_SIZE], + psProgram->pbFirmware[PRG_DESC_DATA_SIZE+1]); + dTotalSize += (UINT32)(PRG_DESC_PROGRAM / 2); + if ((dTotalSize * 2UL) != psProgram->dSize) + return MCDRV_ERROR_ARGUMENT; + + /* Program Type Check */ + wProgType = MAKEWORD( + psProgram->pbFirmware[PRG_DESC_PRG_TYPE], + psProgram->pbFirmware[PRG_DESC_PRG_TYPE+1]); + if ((dCoderId == CODER_DEC) && (wProgType != PRG_PRM_TYPE_TASK0)) + return MCDRV_ERROR_ARGUMENT; + + if ((dCoderId == CODER_ENC) && (wProgType != PRG_PRM_TYPE_TASK1)) + return MCDRV_ERROR_ARGUMENT; + + if ((STATE_NOTINIT == psOtherDecInfo->dState) + || (STATE_INIT == psOtherDecInfo->dState)) + return MCDRV_SUCCESS; + + /* RAM Check */ + wProgLoadAddr = MAKEWORD( + psProgram->pbFirmware[PRG_DESC_PRG_LOAD_ADR], + psProgram->pbFirmware[PRG_DESC_PRG_LOAD_ADR+1]); + wProgSize = MAKEWORD( + psProgram->pbFirmware[PRG_DESC_PRG_SIZE], + psProgram->pbFirmware[PRG_DESC_PRG_SIZE+1]); + wDataLoadAddr = MAKEWORD( + psProgram->pbFirmware[PRG_DESC_DATA_LOAD_ADR], + psProgram->pbFirmware[PRG_DESC_DATA_LOAD_ADR+1]); + wDataSize = MAKEWORD( + psProgram->pbFirmware[PRG_DESC_DATA_SIZE], + psProgram->pbFirmware[PRG_DESC_DATA_SIZE+1]); + wWorkBeginAddr = MAKEWORD( + psProgram->pbFirmware[PRG_DESC_WORK_BEGIN_ADR], + psProgram->pbFirmware[PRG_DESC_WORK_BEGIN_ADR+1]); + wWorkSize = MAKEWORD( + psProgram->pbFirmware[PRG_DESC_WORK_SIZE], + psProgram->pbFirmware[PRG_DESC_WORK_SIZE+1]); + wStackBeginAddr = MAKEWORD( + psProgram->pbFirmware[PRG_DESC_STACK_BEGIN_ADR], + psProgram->pbFirmware[PRG_DESC_STACK_BEGIN_ADR+1]); + wStackSize = MAKEWORD( + psProgram->pbFirmware[PRG_DESC_STACK_SIZE], + psProgram->pbFirmware[PRG_DESC_STACK_SIZE+1]); + psOtherProgInfo = &psOtherDecInfo->sProgInfo; + + /* Program & Program */ + sdRet = MemoryCheck(wProgLoadAddr, wProgSize, + psOtherProgInfo->wProgLoadAddr, + psOtherProgInfo->wProgSize); + if ((SINT32)MCDRV_SUCCESS != sdRet) + return sdRet; + + /* Data & Data */ + sdRet = MemoryCheck(wDataLoadAddr, wDataSize, + psOtherProgInfo->wDataLoadAddr, + psOtherProgInfo->wDataSize); + if ((SINT32)MCDRV_SUCCESS != sdRet) + return sdRet; + + /* Data & Stack */ + sdRet = MemoryCheck(wDataLoadAddr, wDataSize, + psOtherProgInfo->wStackBeginAddr, + psOtherProgInfo->wStackSize); + if ((SINT32)MCDRV_SUCCESS != sdRet) + return sdRet; + + sdRet = MemoryCheck(wStackBeginAddr, wStackSize, + psOtherProgInfo->wDataLoadAddr, + psOtherProgInfo->wDataSize); + if ((SINT32)MCDRV_SUCCESS != sdRet) + return sdRet; + + /* Work & Work */ + sdRet = MemoryCheck(wWorkBeginAddr, wWorkSize, + psOtherProgInfo->wWorkBeginAddr, + psOtherProgInfo->wWorkSize); + if ((SINT32)MCDRV_SUCCESS != sdRet) + return sdRet; + + /* Work & Stack */ + sdRet = MemoryCheck(wWorkBeginAddr, wWorkSize, + psOtherProgInfo->wStackBeginAddr, + psOtherProgInfo->wStackSize); + if ((SINT32)MCDRV_SUCCESS != sdRet) + return sdRet; + + sdRet = MemoryCheck(wStackBeginAddr, wStackSize, + psOtherProgInfo->wWorkBeginAddr, + psOtherProgInfo->wWorkSize); + if ((SINT32)MCDRV_SUCCESS != sdRet) + return sdRet; + + return MCDRV_SUCCESS; +} + +/**************************************************************************** + * CheckProgramAec + * + * Function: + * Check program. + * Arguments: + * psProgramA Program information FuncA + * psProgramB Program information FuncB + * Return: + * 0 success + * < 0 error code + * + ****************************************************************************/ +static SINT32 CheckProgramAec(const struct MC_CODER_FIRMWARE *psProgramA, + const struct MC_CODER_FIRMWARE *psProgramB) +{ + UINT16 wProgLoadAddrA; + UINT16 wProgSizeA; + UINT16 wDataLoadAddrA; + UINT16 wDataSizeA; + UINT16 wWorkBeginAddrA; + UINT16 wWorkSizeA; + UINT16 wStackBeginAddrA; + UINT16 wStackSizeA; + UINT32 dTotalSizeA; + UINT16 wProgLoadAddrB; + UINT16 wProgSizeB; + UINT16 wDataLoadAddrB; + UINT16 wDataSizeB; + UINT16 wWorkBeginAddrB; + UINT16 wWorkSizeB; + UINT16 wStackBeginAddrB; + UINT16 wStackSizeB; + UINT32 dTotalSizeB; + SINT32 sdRet; + + dTotalSizeA = (UINT32)MAKEWORD( + psProgramA->pbFirmware[PRG_DESC_PRG_SIZE], + psProgramA->pbFirmware[PRG_DESC_PRG_SIZE+1]); + dTotalSizeA += (UINT32)MAKEWORD( + psProgramA->pbFirmware[PRG_DESC_DATA_SIZE], + psProgramA->pbFirmware[PRG_DESC_DATA_SIZE+1]); + dTotalSizeA += (UINT32)(PRG_DESC_PROGRAM / 2); + + dTotalSizeB = (UINT32)MAKEWORD( + psProgramB->pbFirmware[PRG_DESC_PRG_SIZE], + psProgramB->pbFirmware[PRG_DESC_PRG_SIZE+1]); + dTotalSizeB += (UINT32)MAKEWORD( + psProgramB->pbFirmware[PRG_DESC_DATA_SIZE], + psProgramB->pbFirmware[PRG_DESC_DATA_SIZE+1]); + dTotalSizeB += (UINT32)(PRG_DESC_PROGRAM / 2); + + + /* RAM Check */ + wProgLoadAddrA = MAKEWORD( + psProgramA->pbFirmware[PRG_DESC_PRG_LOAD_ADR], + psProgramA->pbFirmware[PRG_DESC_PRG_LOAD_ADR+1]); + wProgLoadAddrB = MAKEWORD( + psProgramB->pbFirmware[PRG_DESC_PRG_LOAD_ADR], + psProgramB->pbFirmware[PRG_DESC_PRG_LOAD_ADR+1]); + + wProgSizeA = MAKEWORD( + psProgramA->pbFirmware[PRG_DESC_PRG_SIZE], + psProgramA->pbFirmware[PRG_DESC_PRG_SIZE+1]); + wProgSizeB = MAKEWORD( + psProgramB->pbFirmware[PRG_DESC_PRG_SIZE], + psProgramB->pbFirmware[PRG_DESC_PRG_SIZE+1]); + + wDataLoadAddrA = MAKEWORD( + psProgramA->pbFirmware[PRG_DESC_DATA_LOAD_ADR], + psProgramA->pbFirmware[PRG_DESC_DATA_LOAD_ADR+1]); + wDataLoadAddrB = MAKEWORD( + psProgramB->pbFirmware[PRG_DESC_DATA_LOAD_ADR], + psProgramB->pbFirmware[PRG_DESC_DATA_LOAD_ADR+1]); + + wDataSizeA = MAKEWORD( + psProgramA->pbFirmware[PRG_DESC_DATA_SIZE], + psProgramA->pbFirmware[PRG_DESC_DATA_SIZE+1]); + wDataSizeB = MAKEWORD( + psProgramB->pbFirmware[PRG_DESC_DATA_SIZE], + psProgramB->pbFirmware[PRG_DESC_DATA_SIZE+1]); + + wWorkBeginAddrA = MAKEWORD( + psProgramA->pbFirmware[PRG_DESC_WORK_BEGIN_ADR], + psProgramA->pbFirmware[PRG_DESC_WORK_BEGIN_ADR+1]); + wWorkBeginAddrB = MAKEWORD( + psProgramB->pbFirmware[PRG_DESC_WORK_BEGIN_ADR], + psProgramB->pbFirmware[PRG_DESC_WORK_BEGIN_ADR+1]); + + wWorkSizeA = MAKEWORD( + psProgramA->pbFirmware[PRG_DESC_WORK_SIZE], + psProgramA->pbFirmware[PRG_DESC_WORK_SIZE+1]); + wWorkSizeB = MAKEWORD( + psProgramB->pbFirmware[PRG_DESC_WORK_SIZE], + psProgramB->pbFirmware[PRG_DESC_WORK_SIZE+1]); + + wStackBeginAddrA = MAKEWORD( + psProgramA->pbFirmware[PRG_DESC_STACK_BEGIN_ADR], + psProgramA->pbFirmware[PRG_DESC_STACK_BEGIN_ADR+1]); + wStackBeginAddrB = MAKEWORD( + psProgramB->pbFirmware[PRG_DESC_STACK_BEGIN_ADR], + psProgramB->pbFirmware[PRG_DESC_STACK_BEGIN_ADR+1]); + + wStackSizeA = MAKEWORD( + psProgramA->pbFirmware[PRG_DESC_STACK_SIZE], + psProgramA->pbFirmware[PRG_DESC_STACK_SIZE+1]); + wStackSizeB = MAKEWORD( + psProgramB->pbFirmware[PRG_DESC_STACK_SIZE], + psProgramB->pbFirmware[PRG_DESC_STACK_SIZE+1]); + + /* Program & Program */ + sdRet = MemoryCheck(wProgLoadAddrA, wProgSizeA, + wProgLoadAddrB, wProgSizeB); + if ((SINT32)MCDRV_SUCCESS != sdRet) + return sdRet; + + /* Data & Data */ + sdRet = MemoryCheck(wDataLoadAddrA, wDataSizeA, + wDataLoadAddrB, wDataSizeB); + if ((SINT32)MCDRV_SUCCESS != sdRet) + return sdRet; + + /* Data & Stack */ + sdRet = MemoryCheck(wDataLoadAddrA, wDataSizeA, + wStackBeginAddrB, wStackSizeB); + if ((SINT32)MCDRV_SUCCESS != sdRet) + return sdRet; + + sdRet = MemoryCheck(wStackBeginAddrA, wStackSizeA, + wDataLoadAddrB, wDataSizeB); + if ((SINT32)MCDRV_SUCCESS != sdRet) + return sdRet; + + /* Work & Work */ + sdRet = MemoryCheck(wWorkBeginAddrA, wWorkSizeA, + wWorkBeginAddrB, wWorkSizeB); + if ((SINT32)MCDRV_SUCCESS != sdRet) + return sdRet; + + /* Work & Stack */ + sdRet = MemoryCheck(wWorkBeginAddrA, wWorkSizeA, + wStackBeginAddrB, wStackSizeB); + if ((SINT32)MCDRV_SUCCESS != sdRet) + return sdRet; + + sdRet = MemoryCheck(wStackBeginAddrA, wStackSizeA, + wWorkBeginAddrB, wWorkSizeB); + if ((SINT32)MCDRV_SUCCESS != sdRet) + return sdRet; + + return MCDRV_SUCCESS; +} + +/**************************************************************************** + * CheckInOutPath + * + * Function: + * Check path. + * Arguments: + * psDecConnect Pointer of current Connect. + * psOtherDecConnect Pointer of other Connect. + * Return: + * 0 success + * < 0 error code + * + ****************************************************************************/ +static SINT32 CheckInOutPath(const struct CONNECTION_INFO *psDecConnect, + const struct CONNECTION_INFO *psOtherDecConnect) +{ + /* Input */ + switch (psDecConnect->bInSource) { + case CDSP_IN_SOURCE_OTHER_OUTBUF: + case CDSP_IN_SOURCE_NONE: + break; + + /* DFIFO */ + case CDSP_IN_SOURCE_DFIFO: + switch (psOtherDecConnect->bInSource) { + case CDSP_IN_SOURCE_EFIFO: + case CDSP_IN_SOURCE_OTHER_OUTBUF: + case CDSP_IN_SOURCE_NONE: + break; + + default: + return MCDRV_ERROR_RESOURCEOVER; + } + break; + + /* EFIFO */ + case CDSP_IN_SOURCE_EFIFO: + switch (psOtherDecConnect->bInSource) { + case CDSP_IN_SOURCE_DFIFO: + case CDSP_IN_SOURCE_OTHER_OUTBUF: + case CDSP_IN_SOURCE_NONE: + break; + + default: + return MCDRV_ERROR_RESOURCEOVER; + } + break; + + /* DFIFO & EFIFO */ + case CDSP_IN_SOURCE_DFIFO_EFIFO: + switch (psOtherDecConnect->bInSource) { + case CDSP_IN_SOURCE_OTHER_OUTBUF: + case CDSP_IN_SOURCE_NONE: + break; + + default: + return MCDRV_ERROR_RESOURCEOVER; + } + + default: + return MCDRV_ERROR; + } + + /* output */ + switch (psDecConnect->bOutDest) { + case CDSP_OUT_DEST_OTHER_INBUF: + case CDSP_OUT_DEST_NONE: + break; + + /* RFIFO */ + case CDSP_OUT_DEST_RFIFO: + switch (psOtherDecConnect->bOutDest) { + case CDSP_OUT_DEST_OFIFO: + case CDSP_OUT_DEST_OTHER_INBUF: + case CDSP_OUT_DEST_NONE: + break; + + default: + return MCDRV_ERROR_RESOURCEOVER; + } + break; + + /* OFIFO */ + case CDSP_OUT_DEST_OFIFO: + switch (psOtherDecConnect->bOutDest) { + case CDSP_OUT_DEST_RFIFO: + case CDSP_OUT_DEST_OTHER_INBUF: + case CDSP_OUT_DEST_NONE: + break; + + default: + return MCDRV_ERROR_RESOURCEOVER; + } + break; + + /* RFIFO & OFIFO */ + case CDSP_OUT_DEST_OFIFO_RFIFO: + switch (psOtherDecConnect->bOutDest) { + case CDSP_OUT_DEST_OTHER_INBUF: + case CDSP_OUT_DEST_NONE: + break; + + default: + return MCDRV_ERROR_RESOURCEOVER; + } + break; + + default: + break; + } + + return MCDRV_SUCCESS; +} + +/**************************************************************************** + * CheckInOutType + * + * Function: + * Check input output type. + * Arguments: + * psConnect Pointer of Connect + * wInOutType input output type + * Return: + * 0 success + * < 0 error code + * + ****************************************************************************/ +static SINT32 CheckInOutType(struct CONNECTION_INFO *psConnect, + UINT16 wInOutType) +{ + UINT16 wInType; + UINT16 wOutType; + + wInType = wInOutType & PRG_PRM_IOTYPE_IN_MASK; + wOutType = wInOutType & PRG_PRM_IOTYPE_OUT_MASK; + + /* Input type check */ + if (PRG_PRM_IOTYPE_IN_NOPCM == wInType) { + switch (psConnect->bInSource) { + case CDSP_IN_SOURCE_NONE: + case CDSP_IN_SOURCE_DFIFO: + break; + default: + return MCDRV_ERROR; + } + } + + /* Output type check */ + if (PRG_PRM_IOTYPE_OUT_NOPCM == wOutType) { + switch (psConnect->bOutDest) { + case CDSP_OUT_DEST_NONE: + case CDSP_OUT_DEST_RFIFO: + break; + default: + return MCDRV_ERROR; + } + } + + return MCDRV_SUCCESS; +} + +/**************************************************************************** + * CheckPath + * + * Function: + * Check path. + * Arguments: + * dCoderId Coder ID + * wInOutType input output type + * psConnect Connect information + * Return: + * 0 success + * < 0 error code + * + ****************************************************************************/ +static SINT32 CheckPath(UINT32 dCoderId, UINT16 wInOutType, + struct CONNECTION_INFO *psConnect) +{ + SINT32 sdRet; + struct DEC_INFO *psOtherDecInfo; + + psOtherDecInfo = GetOtherDecInfo(dCoderId); + + switch (psOtherDecInfo->dState) { + case STATE_READY_SETUP: + case STATE_READY: + case STATE_PLAYING: + /* Check Input/Output path */ + sdRet = CheckInOutPath(psConnect, &psOtherDecInfo->sConnect); + if ((SINT32)MCDRV_SUCCESS != sdRet) + return sdRet; + break; + + default: + break; + } + + /* Check Input/Output Type */ + sdRet = CheckInOutType(psConnect, wInOutType); + + return sdRet; +} + +/**************************************************************************** + * CdspChunkAnalyzeFunc + * + * Function: + * Analyze Func chunk + * Arguments: + * dCoderId Coder ID + * psCdspInfo Pointer of AEC analyze info + * Return: + * = 0 success + * < 0 error code + * + ****************************************************************************/ +static SINT32 CdspChunkAnalyzeFunc(UINT32 dCoderId, + struct MCDRV_CDSP_AEC_CDSP_INFO *psCdspInfo) +{ + UINT32 dChunkTop; + UINT32 dChunkId; + UINT32 dChunkSize; + UINT8 *pbPrm; + UINT32 dSize; + UINT32 dTemp; + SINT32 sdRet; + struct MC_CODER_FIRMWARE sProgram; + struct DEC_INFO *psDecInfo; + struct AEC_CDSP_FUNC_INFO *psFuncInfo; + + if (dCoderId == CODER_DEC) + psFuncInfo = &psCdspInfo->asFuncInfo[AEC_FUNC_INFO_A]; + else + psFuncInfo = &psCdspInfo->asFuncInfo[AEC_FUNC_INFO_B]; + + pbPrm = psFuncInfo->pbChunk; + dSize = psFuncInfo->dChunkSize; + psFuncInfo->pbFifo = NULL; + psFuncInfo->pbProg = NULL; + psFuncInfo->dProgSize = 0; + psFuncInfo->pbParam = NULL; + psFuncInfo->dParamNum = 0; + psFuncInfo->pbExt = NULL; + + psDecInfo = GetDecInfo(psFuncInfo->dCoderId); + psFuncInfo->sConnect.bInSource = psDecInfo->sConnect.bInSource; + psFuncInfo->sConnect.bOutDest = psDecInfo->sConnect.bOutDest; + psFuncInfo->sConnectEx.bEfifoCh = psDecInfo->sConnectEx.bEfifoCh; + psFuncInfo->sConnectEx.bOfifoCh = psDecInfo->sConnectEx.bOfifoCh; + psFuncInfo->sBitWidth.bEfifoBit = psDecInfo->sBitWidth.bEfifoBit; + psFuncInfo->sBitWidth.bOfifoBit = psDecInfo->sBitWidth.bOfifoBit; + psFuncInfo->sFormat.bFs = psDecInfo->sFormat.bFs; + psFuncInfo->sFormat.bE2BufMode = psDecInfo->sFormat.bE2BufMode; + psFuncInfo->wInOutType = psDecInfo->sProgInfo.wInOutType; + + if ((pbPrm == NULL) || (dSize == 0)) + return MCDRV_SUCCESS; + + dChunkTop = 0UL; + while (dChunkTop < dSize) { + if (dSize < (dChunkTop + (UINT32)CHUNK_SIZE)) + return MCDRV_ERROR_ARGUMENT; + + dChunkId = CreateUINT32(pbPrm[dChunkTop + 0UL], + pbPrm[dChunkTop + 1UL], + pbPrm[dChunkTop + 2UL], + pbPrm[dChunkTop + 3UL]); + dChunkSize = CreateUINT32(pbPrm[dChunkTop + 4UL], + pbPrm[dChunkTop + 5UL], + pbPrm[dChunkTop + 6UL], + pbPrm[dChunkTop + 7UL]); + if (dSize < (dChunkTop + (UINT32)CHUNK_SIZE + dChunkSize)) + return MCDRV_ERROR_ARGUMENT; + + dChunkTop += (UINT32)CHUNK_SIZE; + switch (dChunkId) { + case AEC_CDSP_TAG_PROG: + if (dChunkSize < (UINT32)PROG_FIX_SIZE) + return MCDRV_ERROR_ARGUMENT; + dTemp = CreateUINT32(pbPrm[dChunkTop + 0UL], + pbPrm[dChunkTop + 1UL], + pbPrm[dChunkTop + 2UL], + pbPrm[dChunkTop + 3UL]); + if (dTemp == 0UL) + return MCDRV_SUCCESS; + if (dChunkSize < (dTemp + (UINT32)PROG_FIX_SIZE)) + return MCDRV_ERROR_ARGUMENT; + if (psFuncInfo->pbProg != NULL) + return MCDRV_ERROR_ARGUMENT; + + psFuncInfo->pbProg = &pbPrm[dChunkTop + PROG_FIX_SIZE]; + psFuncInfo->dProgSize = dTemp; + break; + + case AEC_CDSP_TAG_PRM: + if (dChunkSize < (UINT32)PRM_FIX_SIZE) + return MCDRV_ERROR_ARGUMENT; + dTemp = CreateUINT32(pbPrm[dChunkTop + 0UL], + pbPrm[dChunkTop + 1UL], + pbPrm[dChunkTop + 2UL], + pbPrm[dChunkTop + 3UL]); + if (dTemp == 0UL) + return MCDRV_SUCCESS; + if ((dTemp % PRM_UNIT_SIZE) != 0) + return MCDRV_ERROR_ARGUMENT; + if (dChunkSize < (dTemp + (UINT32)PRM_FIX_SIZE)) + return MCDRV_ERROR_ARGUMENT; + if (psFuncInfo->pbParam != NULL) + return MCDRV_ERROR_ARGUMENT; + + psFuncInfo->pbParam = &pbPrm[dChunkTop + PRM_FIX_SIZE]; + psFuncInfo->dParamNum = (dTemp / PRM_UNIT_SIZE); + break; + + case AEC_CDSP_TAG_FIFO: + if (dChunkSize < (UINT32)FIFO_FIX_SIZE) + return MCDRV_ERROR_ARGUMENT; + + if (psFuncInfo->pbFifo != NULL) + return MCDRV_ERROR_ARGUMENT; + + psFuncInfo->pbFifo = &pbPrm[dChunkTop]; + break; + + case AEC_CDSP_TAG_EXT: + if (dChunkSize < (UINT32)EXT_FIX_SIZE) + return MCDRV_ERROR_ARGUMENT; + + if (psFuncInfo->pbExt != NULL) + return MCDRV_ERROR_ARGUMENT; + + psFuncInfo->pbExt = &pbPrm[dChunkTop]; + break; + + default: + break; + } + dChunkTop += dChunkSize; + } + + /* FIFO Check */ + if (NULL != psFuncInfo->pbFifo) { + sdRet = CheckFIFO(dCoderId, psCdspInfo); + if (sdRet < MCDRV_SUCCESS) + return sdRet; + } + + /* Program Check */ + if ((0UL != psFuncInfo->dProgSize) && (NULL != psFuncInfo->pbProg)) { + sProgram.pbFirmware = psFuncInfo->pbProg; + sProgram.dSize = psFuncInfo->dProgSize; + + sdRet = CheckProgram(psFuncInfo->dCoderId, &sProgram); + if (sdRet < MCDRV_SUCCESS) + return sdRet; + + psFuncInfo->wInOutType = MAKEWORD( + sProgram.pbFirmware[PRG_DESC_OUTPUT_TYPE], + sProgram.pbFirmware[PRG_DESC_OUTPUT_TYPE+1]); + } + + /* Path check */ + sdRet = CheckPath(psFuncInfo->dCoderId, psFuncInfo->wInOutType, + &psFuncInfo->sConnect); + + return sdRet; +} + +/**************************************************************************** + * CdspChunkAnalyze + * + * Function: + * Analyze CDSP chunk + * Arguments: + * psCdspInfo Pointer of AEC analyze info + * Return: + * = 0 success + * < 0 error code + * + ****************************************************************************/ +static SINT32 CdspChunkAnalyze(struct MCDRV_CDSP_AEC_CDSP_INFO *psCdspInfo) +{ + SINT32 sdRet; + struct AEC_CDSP_FUNC_INFO *psFuncInfoA; + struct AEC_CDSP_FUNC_INFO *psFuncInfoB; + struct MC_CODER_FIRMWARE sProgramA; + struct MC_CODER_FIRMWARE sProgramB; + + psFuncInfoA = &psCdspInfo->asFuncInfo[AEC_FUNC_INFO_A]; + psFuncInfoB = &psCdspInfo->asFuncInfo[AEC_FUNC_INFO_B]; + psCdspInfo->sdDFifoCbPos = gsFifoInfo.sdDFifoCbPos; + psCdspInfo->sdRFifoCbPos = gsFifoInfo.sdRFifoCbPos; + psCdspInfo->dOFifoBufSample = gsFifoInfo.dOFifoBufSample; + psCdspInfo->dRFifoBufSample = gsFifoInfo.dRFifoBufSample; + psCdspInfo->bOut0Sel = gsFifoInfo.bOut0Sel; + psCdspInfo->bOut1Sel = gsFifoInfo.bOut1Sel; + psCdspInfo->bOut2Sel = gsFifoInfo.bOut2Sel; + psCdspInfo->bRDFifoBitSel = gsFifoInfo.bRDFifoBitSel; + psCdspInfo->bEFifo01Sel = gsFifoInfo.bEFifo01Sel; + psCdspInfo->bEFifo23Sel = gsFifoInfo.bEFifo23Sel; + + sdRet = CdspChunkAnalyzeFunc(CODER_DEC, psCdspInfo); + if (sdRet < MCDRV_SUCCESS) + return sdRet; + + sdRet = CdspChunkAnalyzeFunc(CODER_ENC, psCdspInfo); + if (sdRet < MCDRV_SUCCESS) + return sdRet; + + if ((NULL != psFuncInfoA->pbFifo) && (NULL != psFuncInfoB->pbFifo)) { + sdRet = CheckInOutPath(&psFuncInfoA->sConnect, + &psFuncInfoB->sConnect); + if (sdRet < MCDRV_SUCCESS) + return sdRet; + } + + if ((0UL != psFuncInfoA->dProgSize) + && (NULL != psFuncInfoA->pbProg) + && (0UL != psFuncInfoB->dProgSize) + && (NULL != psFuncInfoB->pbProg)) { + sProgramA.pbFirmware = psFuncInfoA->pbProg; + sProgramA.dSize = psFuncInfoA->dProgSize; + sProgramB.pbFirmware = psFuncInfoB->pbProg; + sProgramB.dSize = psFuncInfoB->dProgSize; + sdRet = CheckProgramAec(&sProgramA, &sProgramB); + if (sdRet < MCDRV_SUCCESS) + return sdRet; + } + + return MCDRV_SUCCESS; +} + +/*************************************************************************** + * CompleteNotifyOutputFormat + * + * Function: + * Complete Notify Output Format command. + * Arguments: + * dCoderId Coder ID + * Return: + * None + * + ****************************************************************************/ +static void CompleteNotifyOutputFormat(UINT32 dCoderId) +{ + struct DEC_INFO *psOtherDecInfo; + struct MC_CODER_PARAMS sParam; + + psOtherDecInfo = GetOtherDecInfo(dCoderId); + + /* Complete NotifyOutFormat */ + if (FORMAT_PROPAGATE_ON == psOtherDecInfo->bFmtPropagate) { + sParam.bCommandId = + (UINT8)CDSP_CMD_OS2HOST_CMN_NOTIFY_OUT_FORMAT; + sParam.abParam[CDSP_CMD_PARAM_RESULT_00] = 0; + sParam.abParam[CDSP_CMD_PARAM_RESULT_01] = 0; + sParam.abParam[CDSP_CMD_PARAM_RESULT_02] = 0; + sParam.abParam[CDSP_CMD_PARAM_RESULT_03] = 0; + CommandWriteComplete(dCoderId, &sParam); + + psOtherDecInfo->bFmtPropagate = FORMAT_PROPAGATE_OFF; + } +} + +/**************************************************************************** + * DecClose + * + * Function: + * Open resource. + * Arguments: + * dCoderId Coder ID + * Return: + * none + * + ****************************************************************************/ +static void DecClose(UINT32 dCoderId) +{ + UINT8 bAddInt; + UINT8 bAddCtl; + UINT8 bIntData; + UINT8 bCtlData; + SINT32 sdRet; + struct DEC_INFO *psDecInfo; + struct MC_CODER_PARAMS sParam; + + psDecInfo = GetDecInfo(dCoderId); + + /* Complete NotifyOutFormat */ + CompleteNotifyOutputFormat(dCoderId); + + /* Reset command */ + sParam.bCommandId = (UINT8)CDSP_CMD_HOST2OS_CMN_RESET; + sdRet = CommandWriteHost2Os(dCoderId, &sParam); + + /* Command register Initialize */ + CommandInitialize(psDecInfo->dCoderId); + + /* DEC/ENC SFR,EVT Disable */ + if (CODER_DEC == dCoderId) { + bAddInt = MCI_DEC_ENABLE; + bAddCtl = MCB_EDEC; + } else { + bAddInt = MCI_ENC_ENABLE; + bAddCtl = MCB_EENC; + } + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_C + | (UINT32)bAddInt), &bIntData, 1); + + bIntData &= ~(MCB_EDEC_EVT | MCB_EDEC_SFR); + + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_ECDSP), &bCtlData, 1); + bCtlData &= ~bAddCtl; + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_ECDSP), bCtlData); + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)bAddInt), bIntData); + + McDevIf_ExecutePacket(); + + + psDecInfo->sFormat.bFs = CODER_FMT_FS_48000; + +} + +/**************************************************************************** + * TerminateProgram + * + * Function: + * Terminate program. + * Arguments: + * dCoderId Coder ID + * Return: + * none + * + ****************************************************************************/ +static void TerminateProgram(UINT32 dCoderId) +{ + struct DEC_INFO *psDecInfo; + struct MC_CODER_PARAMS sParam; + + psDecInfo = GetDecInfo(dCoderId); + + sParam.bCommandId = (UINT8)CDSP_CMD_HOST2OS_SYS_TERMINATE; + CommandWriteHost2Os(dCoderId, &sParam); + + psDecInfo->sProgInfo.wVendorId = 0; + psDecInfo->sProgInfo.wFunctionId = 0; +} + +/*************************************************************************** + * WriteProgram + * + * Function: + * Write CDSP program to FIFO. + * Arguments: + * psDataInfo Program information + * Return: + * 0 success + * < 0 error code + * + ****************************************************************************/ +static SINT32 WriteProgram(struct FSQ_DATA_INFO *psDataInfo) +{ + UINT8 bData; + UINT16 wFFifoWordSize; + UINT16 wLoadAddr; + UINT16 wWriteSize; + UINT16 wCurrentPos; + UINT16 wRemainSize; + SINT32 sdRet; + UINT32 i; + + sdRet = MCDRV_SUCCESS; + wFFifoWordSize = FIFOSIZE_FFIFO / sizeof(UINT16); + wCurrentPos = 0; + wRemainSize = psDataInfo->wSize; + wLoadAddr = psDataInfo->wLoadAddr; + + /* CDSP_MSEL Set */ + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_CDSP_RESET), &bData, 1); + if (PRG_PRM_SCRMBL_DISABLE == psDataInfo->wScramble) + bData |= MCB_CDSP_FMODE; + else + bData &= ~MCB_CDSP_FMODE; + + bData &= ~MCB_CDSP_MSEL; + if (MSEL_PROG == psDataInfo->bMsel) + bData |= MCB_CDSP_MSEL_PROG; + else + bData |= MCB_CDSP_MSEL_DATA; + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_CDSP_RESET), + bData); + McDevIf_ExecutePacket(); + + while ((wRemainSize > 0) && (sdRet >= (SINT32)MCDRV_SUCCESS)) { + /* CDSP_MAR Set */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_CDSP_MAR_H), + HIBYTE(wLoadAddr)); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_CDSP_MAR_L), + LOBYTE(wLoadAddr)); + McDevIf_ExecutePacket(); + + /* fill FFIFO */ + if (wRemainSize > wFFifoWordSize) + wWriteSize = wFFifoWordSize; + else + wWriteSize = wRemainSize; + for (i = 0; i < ((UINT32)wWriteSize * 2UL); ++i) + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FSQ_FFIFO), + psDataInfo->pbData[ + ((UINT32)wCurrentPos * 2UL)+i]); + + McDevIf_ExecutePacket(); + + wLoadAddr = wLoadAddr + wWriteSize; + wCurrentPos = wCurrentPos + wWriteSize; + wRemainSize = wRemainSize - wWriteSize; + + /* FFIFO_FLG Clear */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_CDSP), + MCB_IRQFLAG_FFIFO); + + /* FSQ_END_FLG Clear */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_FFIFO_FLG), + MCB_FFIFO_FLG_FSQ_END); + McDevIf_ExecutePacket(); + + /* FSQ_START Set */ + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DEC_START), + &bData, + 1); + bData |= MCB_DEC_FSQ_START; + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DEC_START), + bData); + McDevIf_ExecutePacket(); + + /* FSQ_END_FLG Polling */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_EVTWAIT + | MCDRV_EVT_C_REG_FLAG_SET + | (((UINT32)MCI_FFIFO_FLG) << 8) + | (UINT32)MCB_FFIFO_FLG_FSQ_END), + 0); + + sdRet = McDevIf_ExecutePacket(); + if ((SINT32)MCDRV_SUCCESS > sdRet) + return sdRet; + + /* FSQ_START Clear */ + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DEC_START), &bData, 1); + bData &= ~MCB_DEC_FSQ_START; + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DEC_START), bData); + McDevIf_ExecutePacket(); + } + + /* FFIFO_FLG Clear */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_CDSP), + MCB_IRQFLAG_FFIFO); + + /* FSQ_END_FLG Clear */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_FFIFO_FLG), + MCB_FFIFO_FLG_FSQ_END); + McDevIf_ExecutePacket(); + if ((SINT32)MCDRV_SUCCESS > sdRet) + return sdRet; + + return MCDRV_SUCCESS; +} + +/*************************************************************************** + * DownloadProgram + * + * Function: + * Download CDSP program. + * Arguments: + * pbFirmware Program data + * Return: + * 0 success + * < 0 error code + * + ****************************************************************************/ +static SINT32 DownloadProgram(const UINT8 *pbFirmware) +{ + UINT8 bData; + SINT32 sdRet; + struct FSQ_DATA_INFO asDataInfo[2]; + + /* CDSP_SAVEOFF Set */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_PWM_DIGITAL_CDSP), + MCB_PWM_CDSP_SAVEOFF); + McDevIf_ExecutePacket(); + + /* CDSP_HALT_MODE Check */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_EVTWAIT + | MCDRV_EVT_C_REG_FLAG_RESET + | (((UINT32)MCI_CDSP_POWER_MODE) << 8) + | (UINT32)MCB_CDSP_HLT_MODE_SLEEP_HALT) , + 0); + + sdRet = McDevIf_ExecutePacket(); + if (sdRet < (SINT32)MCDRV_SUCCESS) { + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_PWM_DIGITAL_CDSP), + 0x00); + + McDevIf_ExecutePacket(); + + return sdRet; + } + + /* FSQ_SRST */ + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_CDSP_RESET), &bData, 1); + bData |= MCB_CDSP_FSQ_SRST; + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_CDSP_RESET), + bData); + bData &= ~MCB_CDSP_FSQ_SRST; + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_CDSP_RESET), + bData); + + /* 150ns wait */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_TIMWAIT | 1UL), 0x00); + + McDevIf_ExecutePacket(); + + /* FFIFO_RST */ + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DEC_FIFO_RST), + &bData, 1); + bData |= MCB_DEC_FFIFO_RST; + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DEC_FIFO_RST), + bData); + bData &= ~MCB_DEC_FFIFO_RST; + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DEC_FIFO_RST), + bData); + + McDevIf_ExecutePacket(); + + /* Transfer Program & Data */ + asDataInfo[0].pbData = &pbFirmware[PRG_DESC_PROGRAM]; + asDataInfo[0].wSize = MAKEWORD(pbFirmware[PRG_DESC_PRG_SIZE], + pbFirmware[PRG_DESC_PRG_SIZE+1]); + asDataInfo[0].wLoadAddr = MAKEWORD(pbFirmware[PRG_DESC_PRG_LOAD_ADR], + pbFirmware[PRG_DESC_PRG_LOAD_ADR+1]); + asDataInfo[0].wScramble = MAKEWORD(pbFirmware[PRG_DESC_PRG_SCRAMBLE], + pbFirmware[PRG_DESC_PRG_SCRAMBLE+1]); + asDataInfo[0].bMsel = (UINT8)MSEL_PROG; + + + asDataInfo[1].pbData = &asDataInfo[0].pbData[ + ((UINT32)asDataInfo[0].wSize * 2UL)]; + asDataInfo[1].wSize = MAKEWORD(pbFirmware[PRG_DESC_DATA_SIZE], + pbFirmware[PRG_DESC_DATA_SIZE+1]); + asDataInfo[1].wLoadAddr = MAKEWORD(pbFirmware[PRG_DESC_DATA_LOAD_ADR], + pbFirmware[PRG_DESC_DATA_LOAD_ADR+1]); + asDataInfo[1].wScramble = MAKEWORD(pbFirmware[PRG_DESC_DATA_SCRAMBLE], + pbFirmware[PRG_DESC_DATA_SCRAMBLE+1]); + asDataInfo[1].bMsel = (UINT8)MSEL_DATA; + + sdRet = WriteProgram(&asDataInfo[0]); + if ((SINT32)MCDRV_SUCCESS == sdRet) + sdRet = WriteProgram(&asDataInfo[1]); + + /* CDSP_SAVEOFF Clear */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_PWM_DIGITAL_CDSP), + 0x00); + McDevIf_ExecutePacket(); + + return sdRet; +} + +/**************************************************************************** + * InitializeProgram + * + * Function: + * Initialize program. + * Arguments: + * dCoderId Coder ID + * psProgram Program information + * Return: + * 0 success + * < 0 error code + * + ****************************************************************************/ +static SINT32 InitializeProgram(UINT32 dCoderId, + const struct MC_CODER_FIRMWARE *psProgram) +{ + UINT16 wDataLoadAddr; + UINT16 wWorkBeginAddr; + UINT16 wDataAddr; + UINT16 wDataSize; + SINT32 sdRet; + const UINT8 *pbFirmware; + struct DEC_INFO *psDecInfo; + struct MC_CODER_PARAMS sParam; + + pbFirmware = psProgram->pbFirmware; + wDataLoadAddr = MAKEWORD(pbFirmware[PRG_DESC_DATA_LOAD_ADR], + pbFirmware[PRG_DESC_DATA_LOAD_ADR+1]); + wWorkBeginAddr = MAKEWORD(pbFirmware[PRG_DESC_WORK_BEGIN_ADR], + pbFirmware[PRG_DESC_WORK_BEGIN_ADR+1]); + if (wDataLoadAddr < wWorkBeginAddr) + wDataAddr = wDataLoadAddr; + else + wDataAddr = wWorkBeginAddr; + wDataSize = MAKEWORD(pbFirmware[PRG_DESC_DATA_SIZE], + pbFirmware[PRG_DESC_DATA_SIZE+1]); + wDataSize = wDataSize + (UINT16)MAKEWORD( + pbFirmware[PRG_DESC_WORK_SIZE], + pbFirmware[PRG_DESC_WORK_SIZE+1]); + + /* SetProgramInfo command */ + sParam.bCommandId = (UINT8)CDSP_CMD_HOST2OS_SYS_SET_PRG_INFO; + sParam.abParam[CDSP_CMD_PARAM_ARGUMENT_00] = LOBYTE(wDataAddr); + sParam.abParam[CDSP_CMD_PARAM_ARGUMENT_01] = HIBYTE(wDataAddr); + sParam.abParam[CDSP_CMD_PARAM_ARGUMENT_02] = LOBYTE(wDataSize); + sParam.abParam[CDSP_CMD_PARAM_ARGUMENT_03] = HIBYTE(wDataSize); + sParam.abParam[CDSP_CMD_PARAM_ARGUMENT_04] = + pbFirmware[PRG_DESC_ENTRY_ADR]; + sParam.abParam[CDSP_CMD_PARAM_ARGUMENT_05] = + pbFirmware[PRG_DESC_ENTRY_ADR+1]; + sParam.abParam[CDSP_CMD_PARAM_ARGUMENT_06] = + pbFirmware[PRG_DESC_STACK_BEGIN_ADR]; + sParam.abParam[CDSP_CMD_PARAM_ARGUMENT_07] = + pbFirmware[PRG_DESC_STACK_BEGIN_ADR+1]; + sParam.abParam[CDSP_CMD_PARAM_ARGUMENT_08] = + pbFirmware[PRG_DESC_STACK_SIZE]; + sParam.abParam[CDSP_CMD_PARAM_ARGUMENT_09] = + pbFirmware[PRG_DESC_STACK_SIZE+1]; + sParam.abParam[CDSP_CMD_PARAM_ARGUMENT_10] = + pbFirmware[PRG_DESC_RESOURCE_FLAG]; + sdRet = CommandWriteHost2Os(dCoderId, &sParam); + if ((SINT32)MCDRV_SUCCESS > sdRet) + return sdRet; + + /* Reset command */ + sParam.bCommandId = (UINT8)CDSP_CMD_HOST2OS_CMN_RESET; + sdRet = CommandWriteHost2Os(dCoderId, &sParam); + if ((SINT32)MCDRV_SUCCESS > sdRet) + return sdRet; + + /* GetProgramVersion command */ + sParam.bCommandId = (UINT8)CDSP_CMD_HOST2OS_CMN_GET_PRG_VER; + sdRet = CommandWriteHost2Os(dCoderId, &sParam); + if ((SINT32)MCDRV_SUCCESS > sdRet) + return sdRet; + + psDecInfo = GetDecInfo(dCoderId); + psDecInfo->sProgVer.wVersionH = MAKEWORD( + sParam.abParam[CDSP_CMD_PARAM_RESULT_00], + sParam.abParam[CDSP_CMD_PARAM_RESULT_01]); + psDecInfo->sProgVer.wVersionL = MAKEWORD( + sParam.abParam[CDSP_CMD_PARAM_RESULT_02], + sParam.abParam[CDSP_CMD_PARAM_RESULT_03]); + + psDecInfo->sProgInfo.wVendorId = MAKEWORD( + pbFirmware[PRG_DESC_VENDER_ID], + pbFirmware[PRG_DESC_VENDER_ID+1]); + psDecInfo->sProgInfo.wFunctionId = MAKEWORD( + pbFirmware[PRG_DESC_FUNCTION_ID], + pbFirmware[PRG_DESC_FUNCTION_ID+1]); + psDecInfo->sProgInfo.wProgType = MAKEWORD( + pbFirmware[PRG_DESC_PRG_TYPE], + pbFirmware[PRG_DESC_PRG_TYPE+1]); + psDecInfo->sProgInfo.wInOutType = MAKEWORD( + pbFirmware[PRG_DESC_OUTPUT_TYPE], + pbFirmware[PRG_DESC_OUTPUT_TYPE+1]); + psDecInfo->sProgInfo.wProgScramble = MAKEWORD( + pbFirmware[PRG_DESC_PRG_SCRAMBLE], + pbFirmware[PRG_DESC_PRG_SCRAMBLE+1]); + psDecInfo->sProgInfo.wDataScramble = MAKEWORD( + pbFirmware[PRG_DESC_DATA_SCRAMBLE], + pbFirmware[PRG_DESC_DATA_SCRAMBLE+1]); + psDecInfo->sProgInfo.wEntryAddress = MAKEWORD( + pbFirmware[PRG_DESC_ENTRY_ADR], + pbFirmware[PRG_DESC_ENTRY_ADR+1]); + psDecInfo->sProgInfo.wProgLoadAddr = MAKEWORD( + pbFirmware[PRG_DESC_PRG_LOAD_ADR], + pbFirmware[PRG_DESC_PRG_LOAD_ADR+1]); + psDecInfo->sProgInfo.wProgSize = MAKEWORD( + pbFirmware[PRG_DESC_PRG_SIZE], + pbFirmware[PRG_DESC_PRG_SIZE+1]); + psDecInfo->sProgInfo.wDataLoadAddr = MAKEWORD( + pbFirmware[PRG_DESC_DATA_LOAD_ADR], + pbFirmware[PRG_DESC_DATA_LOAD_ADR+1]); + psDecInfo->sProgInfo.wDataSize = MAKEWORD( + pbFirmware[PRG_DESC_DATA_SIZE], + pbFirmware[PRG_DESC_DATA_SIZE+1]); + psDecInfo->sProgInfo.wWorkBeginAddr = MAKEWORD( + pbFirmware[PRG_DESC_WORK_BEGIN_ADR], + pbFirmware[PRG_DESC_WORK_BEGIN_ADR+1]); + psDecInfo->sProgInfo.wWorkSize = MAKEWORD( + pbFirmware[PRG_DESC_WORK_SIZE], + pbFirmware[PRG_DESC_WORK_SIZE+1]); + psDecInfo->sProgInfo.wStackBeginAddr = MAKEWORD( + pbFirmware[PRG_DESC_STACK_BEGIN_ADR], + pbFirmware[PRG_DESC_STACK_BEGIN_ADR+1]); + psDecInfo->sProgInfo.wStackSize = MAKEWORD( + pbFirmware[PRG_DESC_STACK_SIZE], + pbFirmware[PRG_DESC_STACK_SIZE+1]); + psDecInfo->sProgInfo.wOutStartMode = MAKEWORD( + pbFirmware[PRG_DESC_OUTSTARTMODE], + pbFirmware[PRG_DESC_OUTSTARTMODE+1]); + psDecInfo->sProgInfo.wResourceFlag = MAKEWORD( + pbFirmware[PRG_DESC_RESOURCE_FLAG], + pbFirmware[PRG_DESC_RESOURCE_FLAG+1]); + psDecInfo->sProgInfo.wMaxLoad = MAKEWORD( + pbFirmware[PRG_DESC_MAX_LOAD], + pbFirmware[PRG_DESC_MAX_LOAD+1]); + + return MCDRV_SUCCESS; +} + +/*************************************************************************** + * FifoReset + * + * Function: + * Reset FIFO. + * Arguments: + * dFifoId FIFO ID + * dTargetFifo Target FIFO + * Return: + * none + * + ****************************************************************************/ +static void FifoReset(UINT32 dCoderId, UINT32 dTargetFifo) +{ + UINT8 bData; + UINT32 dFifoId; + + dFifoId = GetFifoId(dCoderId); + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DEC_FIFO_RST), &bData, 1); + + if ((FIFO_NONE != (FIFO_DFIFO_MASK & dTargetFifo)) + && (FIFO_NONE != (FIFO_DFIFO_MASK & dFifoId))) { + /* DFIFO Reset */ + bData |= MCB_DEC_DFIFO_RST; + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DEC_FIFO_RST), + bData); + bData &= ~MCB_DEC_DFIFO_RST; + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DEC_FIFO_RST), + bData); + + gsFifoInfo.dDFifoWriteSize = 0; + } + + if ((FIFO_NONE != (FIFO_EFIFO_MASK & dTargetFifo)) + && (FIFO_NONE != (FIFO_EFIFO_MASK & dFifoId))) { + /* EFIFO Reset */ + bData |= MCB_DEC_EFIFO_RST; + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DEC_FIFO_RST), + bData); + bData &= ~MCB_DEC_EFIFO_RST; + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DEC_FIFO_RST), + bData); + } + + if ((FIFO_NONE != (FIFO_OFIFO_MASK & dTargetFifo)) + && (FIFO_NONE != (FIFO_OFIFO_MASK & dFifoId))) { + /* OFIFO Reset */ + bData |= MCB_DEC_OFIFO_RST; + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DEC_FIFO_RST), + bData); + bData &= ~MCB_DEC_OFIFO_RST; + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DEC_FIFO_RST), + bData); + } + + if ((FIFO_NONE != (FIFO_RFIFO_MASK & dTargetFifo)) + && (FIFO_NONE != (FIFO_RFIFO_MASK & dFifoId))) { + /* RFIFO Reset */ + bData |= MCB_DEC_RFIFO_RST; + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DEC_FIFO_RST), + bData); + bData &= ~MCB_DEC_RFIFO_RST; + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DEC_FIFO_RST), + bData); + } + + McDevIf_ExecutePacket(); +} + +/*************************************************************************** + * FifoInit + * + * Function: + * FIFO Init. + * Arguments: + * dFifoId FIFO ID + * dTargetFifo Target FIFO + * Return: + * None + * + ****************************************************************************/ +static void FifoInit(UINT32 dCoderId, UINT32 dTargetFifo) +{ + UINT32 dFifoId; + + dFifoId = GetFifoId(dCoderId); + + if ((FIFO_NONE != (FIFO_DFIFO_MASK & dTargetFifo)) + && (FIFO_NONE != (FIFO_DFIFO_MASK & dFifoId))) { + gsFifoInfo.sdDFifoCbPos = CBPOS_DFIFO_DEF; + gsFifoInfo.dDFifoWriteSize = 0; + } + + if ((FIFO_NONE != (FIFO_OFIFO_MASK & dTargetFifo)) + && (FIFO_NONE != (FIFO_OFIFO_MASK & dFifoId))) + gsFifoInfo.dOFifoBufSample = OFIFO_BUF_SAMPLE_DEF; + + if ((FIFO_NONE != (FIFO_RFIFO_MASK & dTargetFifo)) + && (FIFO_NONE != (FIFO_RFIFO_MASK & dFifoId))) { + gsFifoInfo.sdRFifoCbPos = CBPOS_RFIFO_DEF; + gsFifoInfo.dRFifoBufSample = RFIFO_BUF_SAMPLE_DEF; + } + + FifoReset(dCoderId, dTargetFifo); +} + +/*************************************************************************** + * SetFifoCh + * + * Function: + * Set FIFO SYNC + * Arguments: + * dTargetFifo Target FIFO + * bCh FIFO_CH + * Return: + * old fifo Ch + * + ****************************************************************************/ +static UINT8 SetFifoCh(UINT32 dTargetFifo, UINT8 bCh) +{ + UINT8 bData; + UINT8 bOldCh; + + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DEC_FIFO_CH), &bData, 1); + + bOldCh = 0; + if (FIFO_NONE != (FIFO_EFIFO_MASK & dTargetFifo)) { + bOldCh |= (bData & MCB_DEC_EFIFO_CH); + bData &= ~MCB_DEC_EFIFO_CH; + bData |= (bCh & MCB_DEC_EFIFO_CH); + } + + if (FIFO_NONE != (FIFO_OFIFO_MASK & dTargetFifo)) { + bOldCh |= (bData & MCB_DEC_OFIFO_CH); + bData &= ~MCB_DEC_OFIFO_CH; + bData |= (bCh & MCB_DEC_OFIFO_CH); + } + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DEC_FIFO_CH), bData); + + McDevIf_ExecutePacket(); + + return bOldCh; +} + +/*************************************************************************** + * GetChBit + * + * Function: + * Acquisition channel bit width + * Arguments: + * dTargetFifo Target fifo + * psConnectEx pointer of ext connect info + * psBitWidth pointer of bit width info + * Return: + * ch & bit + * + ****************************************************************************/ +static UINT8 GetChBit(UINT32 dTargetFifo, + struct CONNECTION_EX_INFO *psConnectEx, + struct BIT_WIDTH_INFO *psBitWidth) +{ + UINT8 bData; + + bData = 0x00; + + if (FIFO_NONE != (FIFO_EFIFO_MASK & dTargetFifo)) { + if (psConnectEx->bEfifoCh == 4) { + if (psBitWidth->bEfifoBit == 32) + bData |= MCB_DEC_EFIFO_CH_4_32; + else + bData |= MCB_DEC_EFIFO_CH_4_16; + } else { + if (psBitWidth->bEfifoBit == 32) + bData |= MCB_DEC_EFIFO_CH_2_32; + else + bData |= MCB_DEC_EFIFO_CH_2_16; + } + } + + if (FIFO_NONE != (FIFO_OFIFO_MASK & dTargetFifo)) { + if (psConnectEx->bOfifoCh == 4) { + if (psBitWidth->bOfifoBit == 32) + bData |= MCB_DEC_OFIFO_CH_4_32; + else + bData |= MCB_DEC_OFIFO_CH_4_16; + } else { + if (psBitWidth->bOfifoBit == 32) + bData |= MCB_DEC_OFIFO_CH_2_32; + else + bData |= MCB_DEC_OFIFO_CH_2_16; + } + } + + return bData; +} + +/*************************************************************************** + * ReSetFifoCh + * + * Function: + * Reset fifo ch + * Arguments: + * dCoderId Coder ID + * Return: + * old fifo Ch + * + ****************************************************************************/ +static UINT8 ReSetFifoCh(UINT32 dCoderId) +{ + UINT8 bData; + UINT32 dFifoId; + struct DEC_INFO *psDecInfo; + + psDecInfo = GetDecInfo(dCoderId); + + dFifoId = GetFifoId(dCoderId); + bData = GetChBit(dFifoId, &(psDecInfo->sConnectEx), + &(psDecInfo->sBitWidth)); + + bData = SetFifoCh(dFifoId, bData); + + return bData; +} + +/**************************************************************************** + * ReSetConnection + * + * Function: + * SetConnection setting by saved information + * Arguments: + * dCoderId Coder ID + * Return: + * 0 success + * < 0 error code + * + ****************************************************************************/ +static SINT32 ReSetConnection(UINT32 dCoderId) +{ + SINT32 sdRet; + struct DEC_INFO *psDecInfo; + struct MC_CODER_PARAMS sParam; + + psDecInfo = GetDecInfo(dCoderId); + + sParam.bCommandId = CDSP_CMD_HOST2OS_SYS_SET_CONNECTION; + sParam.abParam[CDSP_CMD_PARAM_ARGUMENT_00] = + psDecInfo->sConnect.bInSource; + sParam.abParam[CDSP_CMD_PARAM_ARGUMENT_01] = + psDecInfo->sConnect.bOutDest; + sdRet = CommandWriteHost2Os(dCoderId, &sParam); + + if ((SINT32)MCDRV_SUCCESS > sdRet) + return sdRet; + + ReSetFifoCh(dCoderId); + + return sdRet; +} + +/**************************************************************************** + * DecOpen + * + * Function: + * Secure resource. + * Arguments: + * dCoderId Coder ID + * Return: + * 0 success + * < 0 error code + * + ****************************************************************************/ +static SINT32 DecOpen(UINT32 dCoderId) +{ + UINT8 bData; + SINT32 i; + SINT32 sdRet; + struct DEC_INFO *psDecInfo; + struct MC_CODER_PARAMS sParam; + + psDecInfo = GetDecInfo(dCoderId); + + /* Command register Initialize */ + CommandInitialize(dCoderId); + + /* TimerReset command (Off) */ + sParam.bCommandId = (UINT8)CDSP_CMD_HOST2OS_SYS_TIMER_RESET; + sParam.abParam[CDSP_CMD_PARAM_ARGUMENT_00] = (UINT8)TIMERRESET_OFF; + sdRet = CommandWriteHost2Os(dCoderId, &sParam); + if ((SINT32)MCDRV_SUCCESS > sdRet) + return sdRet; + + /* DEC/ENC SFR,EVT Interrupt flag clear */ + if (CODER_DEC == dCoderId) { + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DEC_FLG), &bData, 1); + bData |= MCB_ENC_FLG_SFR | MCB_DEC_EVT_FLG; + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DEC_FLG), bData); + } else { + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_ENC_FLG), &bData, 1); + bData |= MCB_ENC_FLG_SFR | MCB_ENC_EVT_FLG; + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_ENC_FLG), bData); + } + McDevIf_ExecutePacket(); + + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_CDSP), + &bData, 1); + if (CODER_DEC == dCoderId) + bData |= MCB_IRQFLAG_DEC; + else + bData |= MCB_IRQFLAG_ENC; + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_CDSP), + bData); + McDevIf_ExecutePacket(); + + /* DEC/ENC SFR,EVT Interrupt Enable */ + if (CODER_DEC == dCoderId) { + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DEC_ENABLE), + &bData, 1); + bData |= MCB_EDEC_SFR | MCB_EDEC_EVT; + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DEC_ENABLE), + bData); + } else { + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_ENC_ENABLE), &bData, 1); + bData |= MCB_EENC_SFR | MCB_EENC_EVT; + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_ENC_ENABLE), + bData); + } + McDevIf_ExecutePacket(); + + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_IF | (UINT32)MCI_ECDSP), + &bData, 1); + if (CODER_DEC == dCoderId) + bData |= MCB_EDEC; + else + bData |= MCB_EENC; + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_ECDSP), + bData); + McDevIf_ExecutePacket(); + + /* Initialize */ + psDecInfo->bChangeOutputFs = CHANGE_OUTPUT_FS_OFF; + psDecInfo->bPreInputDataEnd = INPUT_DATAEND_RELEASE; + psDecInfo->bInputDataEnd = INPUT_DATAEND_RELEASE; + psDecInfo->bFmtPropagate = FORMAT_PROPAGATE_OFF; + psDecInfo->wErrorCode = DEC_ERR_NO_ERROR; + psDecInfo->sFormat.bFs = CODER_FMT_FS_48000; + psDecInfo->sFormat.bE2BufMode = CODER_FMT_ETOBUF_LRMIX; + psDecInfo->sConnect.bInSource = CDSP_IN_SOURCE_NONE; + psDecInfo->sConnect.bOutDest = CDSP_OUT_DEST_NONE; + psDecInfo->sConnectEx.bEfifoCh = 2; + psDecInfo->sConnectEx.bOfifoCh = 2; + psDecInfo->sBitWidth.bEfifoBit = 16; + psDecInfo->sBitWidth.bOfifoBit = 16; + psDecInfo->sParams.bCommandId = 0; + for (i = 0; i < (SINT32)CDSP_CMD_PARAM_ARGUMENT_NUM; i++) + psDecInfo->sParams.abParam[i] = 0; + + FifoInit(dCoderId, + (FIFO_DFIFO | FIFO_EFIFO | FIFO_OFIFO | FIFO_RFIFO)); + + sdRet = ReSetConnection(dCoderId); + + return sdRet; +} + +/**************************************************************************** + * DecReset + * + * Function: + * Reset decoder/encoder. + * Arguments: + * dCoderId Coder ID + * Return: + * 0 success + * < 0 error code + * + ****************************************************************************/ +static SINT32 DecReset(UINT32 dCoderId) +{ + SINT32 sdRet; + struct DEC_INFO *psDecInfo; + struct MC_CODER_PARAMS sParam; + + psDecInfo = GetDecInfo(dCoderId); + + /* Reset command */ + sParam.bCommandId = (UINT8)CDSP_CMD_HOST2OS_CMN_RESET; + sdRet = CommandWriteHost2Os(dCoderId, &sParam); + if ((SINT32)MCDRV_SUCCESS > sdRet) + return sdRet; + + /* Complete NotifyOutFormat */ + CompleteNotifyOutputFormat(dCoderId); + + /* Command register Initialize */ + CommandInitialize(dCoderId); + + /* Input data end flag - release */ + psDecInfo->bPreInputDataEnd = INPUT_DATAEND_RELEASE; + psDecInfo->bInputDataEnd = INPUT_DATAEND_RELEASE; + + psDecInfo->sFormat.bFs = CODER_FMT_FS_48000; + psDecInfo->sFormat.bE2BufMode = CODER_FMT_ETOBUF_LRMIX; + + return MCDRV_SUCCESS; +} + +/**************************************************************************** + * ClearInputPosition + * + * Function: + * Clear the input position. + * Arguments: + * dCoderId Coder ID + * Return: + * none + * + ****************************************************************************/ +static void ClearInputPosition(UINT32 dCoderId) +{ + struct DEC_INFO *psDecInfo; + + psDecInfo = GetDecInfo(dCoderId); + + if ((CDSP_IN_SOURCE_EFIFO != psDecInfo->sConnect.bInSource) && + (CDSP_IN_SOURCE_DFIFO_EFIFO != psDecInfo->sConnect.bInSource)) + return; + + /* ENC_POS Write (Suitable value) */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_ENC_POS4), 0x00); + + McDevIf_ExecutePacket(); + + psDecInfo->dInPosSup = 0; +} + +/**************************************************************************** + * ResetInputPos + * + * Function: + * reset input position + * Arguments: + * dCoderId Coder ID + * Return: + * none + * + ****************************************************************************/ +static void ResetInputPos(UINT32 dCoderId) +{ + SINT32 sdRet; + struct DEC_INFO *psDecInfo; + struct MC_CODER_PARAMS sParam; + + psDecInfo = GetDecInfo(dCoderId); + + if (CDSP_IN_SOURCE_OTHER_OUTBUF != psDecInfo->sConnect.bInSource) + return; + + /* ResetInputPos command */ + sParam.bCommandId = CDSP_CMD_HOST2OS_SYS_RESET_INPUT_POS; + sdRet = CommandWriteHost2Os(dCoderId, &sParam); + + psDecInfo->dInPosSup = 0; +} + +/**************************************************************************** + * ClearOutputPosition + * + * Function: + * Clear the output position. + * Arguments: + * dCoderId Coder ID + * Return: + * none + * + ****************************************************************************/ +static void ClearOutputPosition(UINT32 dCoderId) +{ + struct DEC_INFO *psDecInfo; + + psDecInfo = GetDecInfo(dCoderId); + + if ((CDSP_OUT_DEST_OFIFO != psDecInfo->sConnect.bOutDest) + && (CDSP_OUT_DEST_OFIFO_RFIFO + != psDecInfo->sConnect.bOutDest)) + return; + + /* DEC_POS Write (Suitable value) */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DEC_POS4), 0x00); + + McDevIf_ExecutePacket(); +} + +/**************************************************************************** + * DecClear + * + * Function: + * Reset decoder/encoder + * (Excluding the parameter setting). + * Arguments: + * dCoderId Coder ID + * Return: + * 0 success + * < 0 error code + * + ****************************************************************************/ +static SINT32 DecClear(UINT32 dCoderId) +{ + SINT32 sdRet; + struct DEC_INFO *psDecInfo; + struct MC_CODER_PARAMS sParam; + + psDecInfo = GetDecInfo(dCoderId); + + /* State check */ + switch (psDecInfo->dState) { + case STATE_READY_SETUP: + case STATE_READY: + break; + + default: + return MCDRV_ERROR_STATE; + } + + /* Clear command */ + sParam.bCommandId = (UINT8)CDSP_CMD_HOST2OS_CMN_CLEAR; + sdRet = CommandWriteHost2Os(dCoderId, &sParam); + if ((SINT32)MCDRV_SUCCESS > sdRet) + return sdRet; + + /* Complete NotifyOutFormat */ + CompleteNotifyOutputFormat(dCoderId); + + /* TimerReset command (Reset) */ + sParam.bCommandId = (UINT8)CDSP_CMD_HOST2OS_SYS_TIMER_RESET; + sParam.abParam[CDSP_CMD_PARAM_ARGUMENT_00] = (UINT8)TIMERRESET_RESET; + sdRet = CommandWriteHost2Os(dCoderId, &sParam); + if ((SINT32)MCDRV_SUCCESS > sdRet) + return sdRet; + + /* ChangeOutSamplingRate - Not complete */ + psDecInfo->bChangeOutputFs = CHANGE_OUTPUT_FS_OFF; + + /* Input data end state - release */ + psDecInfo->bPreInputDataEnd = INPUT_DATAEND_RELEASE; + psDecInfo->bInputDataEnd = INPUT_DATAEND_RELEASE; + + /* Output Start - clear */ + switch (psDecInfo->sConnect.bOutDest) { + case CDSP_OUT_DEST_OFIFO: + gsFifoInfo.bOFifoOutStart = OUTPUT_START_OFF; + break; + + case CDSP_OUT_DEST_OFIFO_RFIFO: + gsFifoInfo.bOFifoOutStart = OUTPUT_START_OFF; + gsFifoInfo.bRFifoOutStart = OUTPUT_START_OFF; + break; + + case CDSP_OUT_DEST_RFIFO: + gsFifoInfo.bRFifoOutStart = OUTPUT_START_OFF; + break; + + default: + break; + } + + return MCDRV_SUCCESS; +} + +/**************************************************************************** + * SetFormat + * + * Function: + * Set format. + * Arguments: + * dCoderId Coder ID + * psParam Pointer of send parameter. + * Return: + * 0 success + * < 0 error code + * + ****************************************************************************/ +static SINT32 SetFormat(UINT32 dCoderId, struct MC_CODER_PARAMS *psParam) +{ + SINT32 sdRet; + struct DEC_INFO *psDecInfo; + struct MC_CODER_PARAMS sParam; + + psDecInfo = GetDecInfo(dCoderId); + + /* State check */ + switch (psDecInfo->dState) { + case STATE_READY_SETUP: + break; + + default: + return MCDRV_ERROR_STATE; + } + + /* Argument check */ + switch (psParam->abParam[CDSP_CMD_PARAM_ARGUMENT_00]) { + case CODER_FMT_FS_48000: + case CODER_FMT_FS_44100: + case CODER_FMT_FS_32000: + case CODER_FMT_FS_24000: + case CODER_FMT_FS_22050: + case CODER_FMT_FS_16000: + case CODER_FMT_FS_12000: + case CODER_FMT_FS_11025: + case CODER_FMT_FS_8000: + break; + + default: + return MCDRV_ERROR_ARGUMENT; + } + + switch (psParam->abParam[CDSP_CMD_PARAM_ARGUMENT_01]) { + case CODER_FMT_ETOBUF_LRMIX: + case CODER_FMT_ETOBUF_LCH: + case CODER_FMT_ETOBUF_RCH: + break; + + default: + return MCDRV_ERROR_ARGUMENT; + } + + sParam.bCommandId = psParam->bCommandId; + sParam.abParam[CDSP_CMD_PARAM_ARGUMENT_00] = + psParam->abParam[CDSP_CMD_PARAM_ARGUMENT_00]; + sParam.abParam[CDSP_CMD_PARAM_ARGUMENT_01] = + psParam->abParam[CDSP_CMD_PARAM_ARGUMENT_01]; + sdRet = CommandWriteHost2Os(dCoderId, &sParam); + if ((SINT32)MCDRV_SUCCESS > sdRet) + return sdRet; + + psDecInfo->sFormat.bFs = sParam.abParam[CDSP_CMD_PARAM_ARGUMENT_00]; + psDecInfo->sFormat.bE2BufMode = + sParam.abParam[CDSP_CMD_PARAM_ARGUMENT_01]; + + return sdRet; +} + +/**************************************************************************** + * SetInputDataEnd + * + * Function: + * Set input data end. + * Arguments: + * dCoderId Coder ID + * Return: + * 0 success + * < 0 error code + * + ****************************************************************************/ +static SINT32 SetInputDataEnd(UINT32 dCoderId) +{ + SINT32 sdRet; + UINT8 bInSource; + struct DEC_INFO *psDecInfo; + + psDecInfo = GetDecInfo(dCoderId); + + /* State check */ + switch (psDecInfo->dState) { + case STATE_READY_SETUP: + case STATE_READY: + case STATE_PLAYING: + break; + default: + return MCDRV_ERROR_STATE; + } + + /* Path check */ + bInSource = psDecInfo->sConnect.bInSource; + if ((CDSP_IN_SOURCE_DFIFO != bInSource) + && (CDSP_IN_SOURCE_DFIFO_EFIFO != bInSource)) + return MCDRV_ERROR; + + if (STATE_READY_SETUP == psDecInfo->dState) { + psDecInfo->bPreInputDataEnd = INPUT_DATAEND_SET; + return MCDRV_SUCCESS; + } + psDecInfo->bPreInputDataEnd = INPUT_DATAEND_RELEASE; + + /* FormatPropagate flag clear */ + psDecInfo->bFmtPropagate = FORMAT_PROPAGATE_OFF; + + /* InputDataEnd command */ + sdRet = CommandInputDataEnd(dCoderId); + if ((SINT32)MCDRV_SUCCESS > sdRet) + return sdRet; + + /* Input data end state - set */ + psDecInfo->bInputDataEnd = INPUT_DATAEND_SET; + + /* Output Start */ + OutputStart(psDecInfo); + + return MCDRV_SUCCESS; +} + +/**************************************************************************** + * SetTimer + * + * Function: + * Set timer. (unit: 1ms) + * Arguments: + * dCoderId Coder ID + * psParam Pointer of send parameter. + * Return: + * 0 success + * < 0 error code + * + ****************************************************************************/ +static SINT32 SetTimer(UINT32 dCoderId, struct MC_CODER_PARAMS *psParam) +{ + SINT32 sdRet; + struct DEC_INFO *psDecInfo; + struct MC_CODER_PARAMS sParam; + + psDecInfo = GetDecInfo(dCoderId); + + /* State check */ + switch (psDecInfo->dState) { + case STATE_READY_SETUP: + case STATE_READY: + break; + + default: + return MCDRV_ERROR_STATE; + } + + /* SetTimer command */ + sParam.bCommandId = psParam->bCommandId; + sParam.abParam[CDSP_CMD_PARAM_ARGUMENT_00] = + psParam->abParam[CDSP_CMD_PARAM_ARGUMENT_00]; + sParam.abParam[CDSP_CMD_PARAM_ARGUMENT_01] = + psParam->abParam[CDSP_CMD_PARAM_ARGUMENT_01]; + sParam.abParam[CDSP_CMD_PARAM_ARGUMENT_02] = + psParam->abParam[CDSP_CMD_PARAM_ARGUMENT_02]; + sParam.abParam[CDSP_CMD_PARAM_ARGUMENT_03] = + psParam->abParam[CDSP_CMD_PARAM_ARGUMENT_03]; + sdRet = CommandWriteHost2Os(dCoderId, &sParam); + if ((SINT32)MCDRV_SUCCESS > sdRet) + return sdRet; + + return MCDRV_SUCCESS; +} + +/**************************************************************************** + * SetDualMono + * + * Function: + * Set dual mono playback mode. + * Arguments: + * dCoderId Coder ID + * psParam Pointer of send parameter. + * Return: + * 0 success + * < 0 error code + * + ****************************************************************************/ +static SINT32 SetDualMono(UINT32 dCoderId, struct MC_CODER_PARAMS *psParam) +{ + SINT32 sdRet; + struct DEC_INFO *psDecInfo; + struct MC_CODER_PARAMS sParam; + + psDecInfo = GetDecInfo(dCoderId); + + /* State check */ + switch (psDecInfo->dState) { + case STATE_READY_SETUP: + case STATE_READY: + case STATE_PLAYING: + break; + + default: + return MCDRV_ERROR_STATE; + } + + /* Argument check */ + switch (psParam->abParam[CDSP_CMD_PARAM_ARGUMENT_00]) { + case CODER_DUALMONO_LR: + case CODER_DUALMONO_L: + case CODER_DUALMONO_R: + break; + + default: + return MCDRV_ERROR_ARGUMENT; + } + + /* Path check */ + switch (psDecInfo->sConnect.bOutDest) { + case CDSP_OUT_DEST_OFIFO: + case CDSP_OUT_DEST_OFIFO_RFIFO: + break; + + default: + return MCDRV_ERROR; + } + + /* SetDualMono command */ + sParam.bCommandId = psParam->bCommandId; + sParam.abParam[CDSP_CMD_PARAM_ARGUMENT_00] + = psParam->abParam[CDSP_CMD_PARAM_ARGUMENT_00]; + sdRet = CommandWriteHost2Os(dCoderId, &sParam); + if ((SINT32)MCDRV_SUCCESS > sdRet) + return sdRet; + + return MCDRV_SUCCESS; +} + +/**************************************************************************** + * GetInputPos + * + * Function: + * get input position (unit: sample) + * Arguments: + * dCoderId Coder ID + * psParam Pointer of send parameter. + * Return: + * 0 <= sample + * < 0 error code + * + ****************************************************************************/ +static SINT32 GetInputPos(UINT32 dCoderId, struct MC_CODER_PARAMS *psParam) +{ + UINT32 dInputPos; + SINT32 sdRet; + struct DEC_INFO *psDecInfo; + struct MC_CODER_PARAMS sParam; + + psDecInfo = GetDecInfo(dCoderId); + + /* State check */ + switch (psDecInfo->dState) { + case STATE_READY_SETUP: + case STATE_READY: + case STATE_PLAYING: + break; + + default: + return MCDRV_ERROR_STATE; + } + + /* Path check */ + if (CDSP_IN_SOURCE_OTHER_OUTBUF != psDecInfo->sConnect.bInSource) + return MCDRV_ERROR; + + /* pcm input ? */ + if ((psDecInfo->sProgInfo.wInOutType & PRG_PRM_IOTYPE_IN_MASK) + != PRG_PRM_IOTYPE_IN_PCM) + return MCDRV_ERROR; + + /* GetInputPos command */ + sParam.bCommandId = psParam->bCommandId; + sdRet = CommandWriteHost2Os(dCoderId, &sParam); + if ((SINT32)MCDRV_SUCCESS > sdRet) + return sdRet; + + /* InputPos */ + dInputPos = ((UINT32)sParam.abParam[CDSP_CMD_PARAM_RESULT_03] << 24) + | ((UINT32)sParam.abParam[CDSP_CMD_PARAM_RESULT_02] << 16) + | ((UINT32)sParam.abParam[CDSP_CMD_PARAM_RESULT_01] << 8) + | (UINT32)sParam.abParam[CDSP_CMD_PARAM_RESULT_00]; + + dInputPos += psDecInfo->dInPosSup; + + return (SINT32)dInputPos; +} + +/**************************************************************************** + * DecStandby + * + * Function: + * Standby decoder/encoder process. + * Arguments: + * dCoderId Coder ID + * Return: + * 0 success + * < 0 error code + * + ****************************************************************************/ +static SINT32 DecStandby(UINT32 dCoderId) +{ + UINT32 dFifoId; + SINT32 sdRet; + struct DEC_INFO *psDecInfo; + struct MC_CODER_PARAMS sParam; + + psDecInfo = GetDecInfo(dCoderId); + + /* TimerReset command (Reset) */ + sParam.bCommandId = (UINT8)CDSP_CMD_HOST2OS_SYS_TIMER_RESET; + sParam.abParam[CDSP_CMD_PARAM_ARGUMENT_00] = (UINT8)TIMERRESET_RESET; + sdRet = CommandWriteHost2Os(dCoderId, &sParam); + if ((SINT32)MCDRV_SUCCESS > sdRet) + return sdRet; + + /* Standby command */ + sParam.bCommandId = (UINT8)CDSP_CMD_HOST2OS_CMN_STANDBY; + sdRet = CommandWriteHost2Os(dCoderId, &sParam); + if ((SINT32)MCDRV_SUCCESS > sdRet) + return sdRet; + + /* ChangeOutSamplingRate - Not complete */ + psDecInfo->bChangeOutputFs = CHANGE_OUTPUT_FS_OFF; + + dFifoId = GetFifoId(dCoderId); + if (FIFO_NONE != (FIFO_OFIFO_MASK & dFifoId)) + gsFifoInfo.bOFifoOutStart = OUTPUT_START_OFF; + + if (FIFO_NONE != (FIFO_RFIFO_MASK & dFifoId)) + gsFifoInfo.bRFifoOutStart = OUTPUT_START_OFF; + + return MCDRV_SUCCESS; +} + +/*************************************************************************** + * TermFunction + * + * Function: + * Terminate function + * Arguments: + * dCoderId Coder Id + * Return: + * None + * + ****************************************************************************/ +static void TermFunction(UINT32 dCoderId) +{ + UINT32 dTargetFifo; + struct DEC_INFO *psDecInfo; + + psDecInfo = GetDecInfo(dCoderId); + + /* State check */ + switch (psDecInfo->dState) { + case STATE_PLAYING: + DecStop(dCoderId, MADEVCDSP_VERIFY_COMP_ON); + FifoStop(dCoderId); + + case STATE_READY_SETUP: + case STATE_READY: + DecClose(dCoderId); + + /* Terminate current program */ + TerminateProgram(dCoderId); + break; + + case STATE_NOTINIT: + case STATE_INIT: + default: + return; + } + + dTargetFifo = GetFifoId(dCoderId); + if (FIFO_NONE != (FIFO_DFIFO_MASK & dTargetFifo)) + gsFifoInfo.sdDFifoCbPos = CBPOS_DFIFO_DEF; + + if (FIFO_NONE != (FIFO_OFIFO_MASK & dTargetFifo)) { + gsFifoInfo.dOFifoBufSample = OFIFO_BUF_SAMPLE_DEF; + gsFifoInfo.bOFifoOutStart = OUTPUT_START_OFF; + } + + if (FIFO_NONE != (FIFO_RFIFO_MASK & dTargetFifo)) { + gsFifoInfo.sdRFifoCbPos = CBPOS_RFIFO_DEF; + gsFifoInfo.dRFifoBufSample = RFIFO_BUF_SAMPLE_DEF; + gsFifoInfo.bRFifoOutStart = OUTPUT_START_OFF; + } + + InitDecInfo(psDecInfo); + + return; +} + +/*************************************************************************** + * SetFirmware + * + * Function: + * Set firmware + * Arguments: + * psFuncInfo Pointer of func info + * Return: + * 0 success + * < 0 error code + * + ****************************************************************************/ +static SINT32 SetFirmware(struct AEC_CDSP_FUNC_INFO *psFuncInfo) +{ + UINT8 bDownLoad; + UINT16 wTemp; + UINT32 dNewProgId; + UINT32 dCurProgId; + SINT32 sdRet; + struct DEC_INFO *psDecInfo; + struct MC_CODER_FIRMWARE sProgram; + + if ((0UL == psFuncInfo->dProgSize) || (NULL == psFuncInfo->pbProg)) + return MCDRV_SUCCESS; + + if (CDSP_ERR_NO_ERROR != gsCdspInfo.wHwErrorCode) + return MCDRV_ERROR_STATE; + + sProgram.pbFirmware = psFuncInfo->pbProg; + sProgram.dSize = psFuncInfo->dProgSize; + psDecInfo = GetDecInfo(psFuncInfo->dCoderId); + + /* State check */ + switch (psDecInfo->dState) { + case STATE_INIT: + bDownLoad = PROGRAM_DOWNLOAD; + break; + + case STATE_READY_SETUP: + case STATE_READY: + /* Check Program ID */ + dCurProgId = psDecInfo->sProgInfo.wVendorId; + dCurProgId |= (UINT32)psDecInfo->sProgInfo.wFunctionId << 16; + + wTemp = MAKEWORD(sProgram.pbFirmware[PRG_DESC_VENDER_ID], + sProgram.pbFirmware[PRG_DESC_VENDER_ID+1]); + dNewProgId = (UINT32)wTemp; + + wTemp = MAKEWORD(sProgram.pbFirmware[PRG_DESC_FUNCTION_ID], + sProgram.pbFirmware[PRG_DESC_FUNCTION_ID+1]); + dNewProgId |= (UINT32)wTemp << 16; + if (dNewProgId != dCurProgId) + bDownLoad = PROGRAM_DOWNLOAD; + else + bDownLoad = PROGRAM_NO_DOWNLOAD; + break; + + default: + return MCDRV_ERROR_STATE; + } + + switch (psDecInfo->dState) { + case STATE_READY_SETUP: + case STATE_READY: + DecClose(psFuncInfo->dCoderId); + + /* Terminate current program */ + TerminateProgram(psFuncInfo->dCoderId); + + psDecInfo->dState = STATE_INIT; + break; + default: + break; + } + + if (PROGRAM_DOWNLOAD == bDownLoad) { + /* Download */ + sdRet = DownloadProgram(sProgram.pbFirmware); + if ((SINT32)MCDRV_SUCCESS != sdRet) + return sdRet; + } + + /* Initialize */ + + sdRet = InitializeProgram(psFuncInfo->dCoderId, &sProgram); + if ((SINT32)MCDRV_SUCCESS != sdRet) + return sdRet; + + sdRet = DecOpen(psFuncInfo->dCoderId); + if ((SINT32)MCDRV_SUCCESS != sdRet) { + /* Terminate current program */ + TerminateProgram(psFuncInfo->dCoderId); + return sdRet; + } + + psDecInfo->dState = STATE_READY_SETUP; + + return MCDRV_SUCCESS; +} + +/**************************************************************************** + * SetConnection + * + * Function: + * Connect + * Arguments: + * psFuncInfo Pointer of Func Info + * Return: + * = 0 success + * < 0 error code + * + ****************************************************************************/ +static SINT32 SetConnection(struct AEC_CDSP_FUNC_INFO *psFuncInfo) +{ + UINT8 bData; + SINT32 sdRet; + UINT32 dTargetFifo; + UINT32 dInitFifo; + struct DEC_INFO *psDecInfo; + struct MC_CODER_PARAMS sParam; + struct CONNECTION_INFO sConnect; + struct CONNECTION_EX_INFO sConnectEx; + struct BIT_WIDTH_INFO sBitWidth; + + psDecInfo = GetDecInfo(psFuncInfo->dCoderId); + + sConnect.bInSource = psFuncInfo->sConnect.bInSource; + sConnect.bOutDest = psFuncInfo->sConnect.bOutDest; + + sConnectEx.bEfifoCh = psFuncInfo->sConnectEx.bEfifoCh; + sConnectEx.bOfifoCh = psFuncInfo->sConnectEx.bOfifoCh; + sBitWidth.bEfifoBit = psFuncInfo->sBitWidth.bEfifoBit; + sBitWidth.bOfifoBit = psFuncInfo->sBitWidth.bOfifoBit; + + if ((psDecInfo->sConnect.bInSource == sConnect.bInSource) + && (psDecInfo->sConnect.bOutDest == sConnect.bOutDest) + && (psDecInfo->sBitWidth.bEfifoBit == sBitWidth.bEfifoBit) + && (psDecInfo->sConnectEx.bEfifoCh == sConnectEx.bEfifoCh) + && (psDecInfo->sBitWidth.bOfifoBit == sBitWidth.bOfifoBit) + && (psDecInfo->sConnectEx.bOfifoCh == sConnectEx.bOfifoCh)) + return MCDRV_SUCCESS; + + /* State check */ + switch (psDecInfo->dState) { + case STATE_READY_SETUP: + case STATE_READY: + break; + + default: + return MCDRV_ERROR_STATE; + } + + dInitFifo = FIFO_NONE; + if ((psDecInfo->sConnect.bInSource != sConnect.bInSource) + || (psDecInfo->sConnect.bOutDest != sConnect.bOutDest)) { + + switch (psDecInfo->dState) { + case STATE_READY: + sdRet = DecReset(psFuncInfo->dCoderId); + if ((SINT32)MCDRV_SUCCESS > sdRet) + return sdRet; + + ClearInputPosition(psFuncInfo->dCoderId); + ResetInputPos(psFuncInfo->dCoderId); + ClearOutputPosition(psFuncInfo->dCoderId); + + psDecInfo->dState = STATE_READY_SETUP; + break; + + default: + break; + } + + sParam.bCommandId = CDSP_CMD_HOST2OS_SYS_SET_CONNECTION; + sParam.abParam[CDSP_CMD_PARAM_ARGUMENT_00] = + sConnect.bInSource; + sParam.abParam[CDSP_CMD_PARAM_ARGUMENT_01] = sConnect.bOutDest; + sdRet = CommandWriteHost2Os(psFuncInfo->dCoderId, &sParam); + if ((SINT32)MCDRV_SUCCESS > sdRet) + return sdRet; + + dTargetFifo = 0; + if (psDecInfo->sConnect.bInSource != sConnect.bInSource) { + switch (sConnect.bInSource) { + case CDSP_IN_SOURCE_DFIFO: + if (psDecInfo->sConnect.bInSource + != CDSP_IN_SOURCE_DFIFO_EFIFO) + dTargetFifo |= FIFO_DFIFO; + break; + + case CDSP_IN_SOURCE_EFIFO: + if (psDecInfo->sConnect.bInSource + != CDSP_IN_SOURCE_DFIFO_EFIFO) + dTargetFifo |= FIFO_EFIFO; + break; + + case CDSP_IN_SOURCE_DFIFO_EFIFO: + if (psDecInfo->sConnect.bInSource + != CDSP_IN_SOURCE_DFIFO) + dTargetFifo |= FIFO_DFIFO; + + if (psDecInfo->sConnect.bInSource + != CDSP_IN_SOURCE_EFIFO) + dTargetFifo |= FIFO_EFIFO; + break; + + default: + break; + } + + psDecInfo->sConnect.bInSource = sConnect.bInSource; + } + + if (psDecInfo->sConnect.bOutDest != sConnect.bOutDest) { + switch (sConnect.bOutDest) { + case CDSP_OUT_DEST_OFIFO: + if (psDecInfo->sConnect.bOutDest + != CDSP_OUT_DEST_OFIFO_RFIFO) + dTargetFifo |= FIFO_OFIFO; + break; + + case CDSP_OUT_DEST_RFIFO: + if (psDecInfo->sConnect.bOutDest + != CDSP_OUT_DEST_OFIFO_RFIFO) + dTargetFifo |= FIFO_RFIFO; + break; + + case CDSP_OUT_DEST_OFIFO_RFIFO: + if (psDecInfo->sConnect.bOutDest + != CDSP_OUT_DEST_OFIFO) + dTargetFifo |= FIFO_OFIFO; + + if (psDecInfo->sConnect.bOutDest + != CDSP_OUT_DEST_RFIFO) + dTargetFifo |= FIFO_RFIFO; + break; + + default: + break; + } + + psDecInfo->sConnect.bOutDest = sConnect.bOutDest; + } + + if (dTargetFifo != FIFO_NONE) { + FifoInit(psFuncInfo->dCoderId, dTargetFifo); + dInitFifo = dTargetFifo; + } + } + + + dTargetFifo = GetFifoId(psFuncInfo->dCoderId); + if ((psDecInfo->sBitWidth.bEfifoBit == sBitWidth.bEfifoBit) + && (psDecInfo->sConnectEx.bEfifoCh == sConnectEx.bEfifoCh)) + dTargetFifo &= ~FIFO_EFIFO_MASK; + + if ((psDecInfo->sBitWidth.bOfifoBit == sBitWidth.bOfifoBit) + && (psDecInfo->sConnectEx.bOfifoCh == sConnectEx.bOfifoCh)) + dTargetFifo &= ~FIFO_OFIFO_MASK; + + if (FIFO_NONE != ((FIFO_EFIFO_MASK | FIFO_OFIFO_MASK) & dTargetFifo)) { + bData = GetChBit(dTargetFifo, &sConnectEx, &sBitWidth); + + if (FIFO_NONE != (FIFO_EFIFO_MASK & dTargetFifo)) { + /* Clear position */ + ClearInputPosition(psFuncInfo->dCoderId); + + psDecInfo->sConnectEx.bEfifoCh = sConnectEx.bEfifoCh; + psDecInfo->sBitWidth.bEfifoBit = sBitWidth.bEfifoBit; + } + + if (FIFO_NONE != (FIFO_OFIFO_MASK & dTargetFifo)) { + /* Clear position */ + ClearOutputPosition(psFuncInfo->dCoderId); + + psDecInfo->sConnectEx.bOfifoCh = sConnectEx.bOfifoCh; + psDecInfo->sBitWidth.bOfifoBit = sBitWidth.bOfifoBit; + } + + /* Clear FIFO */ + dInitFifo = (dTargetFifo & ~dInitFifo); + if (FIFO_NONE != dInitFifo) + FifoReset(psFuncInfo->dCoderId, dInitFifo); + + SetFifoCh(dTargetFifo, bData); + } + + return MCDRV_SUCCESS; +} + +/**************************************************************************** + * SetParamCore + * + * Function: + * Set paramter + * Arguments: + * dCoderId Coder ID + * psParam Pointer of parameter + * Return: + * = 0 success + * < 0 error code + * + ****************************************************************************/ +static SINT32 SetParamCore(UINT32 dCoderId, struct MC_CODER_PARAMS *psParam) +{ + SINT32 i; + SINT32 sdRet; + struct DEC_INFO *psDecInfo; + + psDecInfo = GetDecInfo(dCoderId); + /* State check */ + switch (psDecInfo->dState) { + case STATE_INIT: + if (CDSP_CMD_HOST2OS_SYS_SET_CLOCK_SOURCE + != psParam->bCommandId) + return MCDRV_ERROR_STATE; + break; + + case STATE_READY_SETUP: + case STATE_READY: + case STATE_PLAYING: + break; + + default: + return MCDRV_ERROR_STATE; + } + + if ((psParam->bCommandId & (UINT8)CDSP_CMD_HOST2OS_COMPLETION) == 0) { + /* Command check */ + switch (psParam->bCommandId) { + case CDSP_CMD_HOST2OS_CMN_RESET: + /* reset */ + sdRet = DecReset(dCoderId); + if ((SINT32)MCDRV_SUCCESS <= sdRet) { + /* Clear position */ + ClearInputPosition(dCoderId); + ResetInputPos(dCoderId); + ClearOutputPosition(dCoderId); + + /* Clear FIFO */ + FifoReset(dCoderId, + (FIFO_DFIFO | FIFO_EFIFO + | FIFO_OFIFO | FIFO_RFIFO)); + + /* ReSetConnect */ + ReSetConnection(dCoderId); + + psDecInfo->dState = STATE_READY_SETUP; + } + break; + + case CDSP_CMD_HOST2OS_CMN_CLEAR: + sdRet = DecClear(dCoderId); + if ((SINT32)MCDRV_SUCCESS <= sdRet) { + /* Clear position */ + ClearInputPosition(dCoderId); + ResetInputPos(dCoderId); + ClearOutputPosition(dCoderId); + + /* Clear FIFO */ + FifoReset(dCoderId, + (FIFO_DFIFO | FIFO_EFIFO + | FIFO_OFIFO | FIFO_RFIFO)); + } + break; + + case CDSP_CMD_HOST2OS_SYS_INPUT_DATA_END: + sdRet = SetInputDataEnd(dCoderId); + break; + + case CDSP_CMD_HOST2OS_SYS_SET_TIMER: + sdRet = SetTimer(dCoderId, psParam); + break; + + case CDSP_CMD_HOST2OS_SYS_SET_DUAL_MONO: + sdRet = SetDualMono(dCoderId, psParam); + break; + + case CDSP_CMD_HOST2OS_SYS_GET_INPUT_POS: + sdRet = GetInputPos(dCoderId, psParam); + break; + + default: + if ((psParam->bCommandId < CDSP_CMD_HOST2OS_PRG_MIN) + || (psParam->bCommandId + > CDSP_CMD_HOST2OS_PRG_MAX)) + return MCDRV_ERROR_ARGUMENT; + + /* Program dependence command */ + sdRet = CommandWriteHost2Os(dCoderId, psParam); + if ((SINT32)MCDRV_SUCCESS <= sdRet) + sdRet = MCDRV_SUCCESS; + break; + } + } else { + /* Host command notify completion */ + switch (psDecInfo->sParams.bCommandId) { + case CDSP_CMD_OS2HOST_CMN_NONE: + return MCDRV_ERROR; + + case CDSP_CMD_OS2HOST_CMN_NOTIFY_OUT_FORMAT: + psDecInfo->bChangeOutputFs = CHANGE_OUTPUT_FS_ON; + OutputStart(psDecInfo); + break; + + default: + break; + } + + /* Write complete command */ + CommandWriteComplete(dCoderId, psParam); + + /* clear */ + psDecInfo->sParams.bCommandId = + (UINT8)CDSP_CMD_OS2HOST_CMN_NONE; + for (i = 0; i < (SINT32)CDSP_CMD_PARAM_ARGUMENT_NUM; i++) + psDecInfo->sParams.abParam[i] = 0; + + sdRet = MCDRV_SUCCESS; + } + + return sdRet; +} + +/**************************************************************************** + * GetParamCore + * + * Function: + * Get parameter + * Arguments: + * dCoderId Coder ID + * psParam Pointer of get paramter + * Return: + * = 0 success + * < 0 error code + * + ****************************************************************************/ +static SINT32 GetParamCore( + UINT32 dCoderId, struct MC_CODER_PARAMS *psParam) +{ + SINT32 sdCount; + SINT32 i; + struct DEC_INFO *psDecInfo; + + psDecInfo = GetDecInfo(dCoderId); + + /* State check */ + switch (psDecInfo->dState) { + case STATE_READY_SETUP: + case STATE_READY: + case STATE_PLAYING: + break; + + default: + return MCDRV_ERROR_STATE; + } + + /* Command */ + psParam->bCommandId = psDecInfo->sParams.bCommandId; + + /* Argument */ + sdCount = (SINT32)(CDSP_CMD_PARAM_ARGUMENT_00 + + CDSP_CMD_PARAM_ARGUMENT_NUM); + for (i = (SINT32)CDSP_CMD_PARAM_ARGUMENT_00; i < sdCount; i++) + psParam->abParam[i] = psDecInfo->sParams.abParam[i]; + + /* Result */ + sdCount = (SINT32)(CDSP_CMD_PARAM_RESULT_00 + + CDSP_CMD_PARAM_RESULT_NUM); + for (i = (SINT32)CDSP_CMD_PARAM_RESULT_00; i < sdCount; i++) + psParam->abParam[i] = 0; + + return MCDRV_SUCCESS; +} + +/**************************************************************************** + * SetParam + * + * Function: + * Set parameter + * Arguments: + * psFuncInfo + * Return: + * = 0 success + * < 0 error code + * + ****************************************************************************/ +static SINT32 SetParam(struct AEC_CDSP_FUNC_INFO *psFuncInfo) +{ + UINT8 *pbPrm; + UINT32 i; + SINT32 j; + SINT32 sdCount; + SINT32 sdRet; + struct MC_CODER_PARAMS sParam; + + if ((psFuncInfo->pbParam == NULL) || (psFuncInfo->dParamNum == 0)) + return MCDRV_SUCCESS; + + pbPrm = psFuncInfo->pbParam; + + sdCount = (SINT32)(CDSP_CMD_PARAM_ARGUMENT_00 + + CDSP_CMD_PARAM_ARGUMENT_NUM); + + for (i = 0; i < psFuncInfo->dParamNum; i++) { + sParam.bCommandId = pbPrm[CDSP_PRM_CMD]; + + for (j = (SINT32)CDSP_CMD_PARAM_ARGUMENT_00; j < sdCount; j++) + sParam.abParam[j] = pbPrm[CDSP_PRM_PRM0 + j]; + + sdRet = SetParamCore(psFuncInfo->dCoderId, &sParam); + if (sdRet < MCDRV_SUCCESS) + return sdRet; + + pbPrm += PRM_UNIT_SIZE; + } + + return MCDRV_SUCCESS; +} + +/**************************************************************************** + * SetE2BufMode + * + * Function: + * Set E2BufMode + * Arguments: + * dCoderId Coder ID + * psFuncInfo Pointer of func info + * Return: + * None + * + ****************************************************************************/ +static void SetE2BufMode(UINT32 dCoderId, + struct AEC_CDSP_FUNC_INFO *psFuncInfo) +{ + struct DEC_INFO *psDecInfo; + + psDecInfo = GetDecInfo(dCoderId); + psDecInfo->sFormat.bE2BufMode = psFuncInfo->sFormat.bE2BufMode; +} + +/**************************************************************************** + * SetCallbackPos + * + * Function: + * Setting positon of the callback + * Arguments: + * dCoderId Coder ID + * psCdspInfo Pointer of AEC analyze info + * Return: + * None + * + ****************************************************************************/ +static void SetCallbackPos(UINT32 dCoderId, + struct MCDRV_CDSP_AEC_CDSP_INFO *psCdspInfo) +{ + UINT32 dFifoId; + struct DEC_INFO *psDecInfo; + + if ((gsFifoInfo.sdDFifoCbPos == psCdspInfo->sdDFifoCbPos) && + (gsFifoInfo.sdRFifoCbPos == psCdspInfo->sdRFifoCbPos)) + return; + + psDecInfo = GetDecInfo(dCoderId); + dFifoId = GetFifoIdCore(&psDecInfo->sConnect); + + if ((dFifoId & FIFO_DFIFO_MASK) != 0) + gsFifoInfo.sdDFifoCbPos = psCdspInfo->sdDFifoCbPos; + + if ((dFifoId & FIFO_RFIFO_MASK) != 0) + gsFifoInfo.sdRFifoCbPos = psCdspInfo->sdRFifoCbPos; +} + +/**************************************************************************** + * SetBuffering + * + * Function: + * Buffering positon of the callback + * Arguments: + * dCoderId Coder ID + * psCdspInfo Pointer of AEC analyze info + * Return: + * None + * + ****************************************************************************/ +static void SetBuffering(UINT32 dCoderId, + struct MCDRV_CDSP_AEC_CDSP_INFO *psCdspInfo) +{ + UINT32 dFifoId; + struct DEC_INFO *psDecInfo; + + if ((gsFifoInfo.dOFifoBufSample == psCdspInfo->dOFifoBufSample) + && (gsFifoInfo.dRFifoBufSample == psCdspInfo->dRFifoBufSample)) + return; + + psDecInfo = GetDecInfo(dCoderId); + dFifoId = GetFifoIdCore(&psDecInfo->sConnect); + + if ((dFifoId & FIFO_OFIFO_MASK) != 0) + gsFifoInfo.dOFifoBufSample = psCdspInfo->dOFifoBufSample; + + if ((dFifoId & FIFO_RFIFO_MASK) != 0) + gsFifoInfo.dRFifoBufSample = psCdspInfo->dRFifoBufSample; +} + +/*************************************************************************** + * DFifoStart + * + * Function: + * Start DFIFO. + * Arguments: + * None + * Return: + * None + * + ****************************************************************************/ +static void DFifoStart(void) +{ + UINT8 bIrqPntH; + UINT8 bIrqPntL; + UINT8 bIntCtl; + UINT8 bData; + + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DFIFO_ENABLE), &bIntCtl, 1); + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DFIFO_IRQ_PNT_H), &bIrqPntH, 1); + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DFIFO_IRQ_PNT_L), &bIrqPntL, 1); + + if ((GetDFifoSel() == CDSP_FIFO_SEL_PORT) || + ((SINT32)CBPOS_DFIFO_NONE == gsFifoInfo.sdDFifoCbPos)) { + bIrqPntH = 0; + bIrqPntL = 0; + bIntCtl &= ~MCB_DFIFO_EDPNT; + } else { + bIrqPntH = (UINT8)(gsFifoInfo.sdDFifoCbPos >> 8) & + MCB_DFIFO_IRQ_PNT_H; + bIrqPntL = (UINT8)(gsFifoInfo.sdDFifoCbPos) & + MCB_DFIFO_IRQ_PNT_L; + bIntCtl |= MCB_DFIFO_EDPNT; + } + + bIntCtl |= MCB_DFIFO_EDEMP; + + /* xFIFO/xPNT/xEMP/xUDF/xOVF Interrupt flag clear */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DFIFO_FLG), + MCB_DFIFO_FLG_ALL); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_CDSP), + MCB_IRQFLAG_DFIFO); + + /* xFIFO_IRQ_PNT Set */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DFIFO_IRQ_PNT_H), + bIrqPntH); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DFIFO_IRQ_PNT_L), + bIrqPntL); + + /* xFIFO/xPNT/xEMP/xUDF/xOVF Interrupt Enable */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DFIFO_ENABLE), + bIntCtl); + + McDevIf_ExecutePacket(); + + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_ECDSP), + &bData, 1); + bData |= MCB_EDFIFO; + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_ECDSP), + bData); + + McDevIf_ExecutePacket(); +} + +/*************************************************************************** + * EFifoStart + * + * Function: + * Start EFIFO. + * Arguments: + * None + * Return: + * None + * + ****************************************************************************/ +static void EFifoStart(void) +{ + /* xFIFO/xPNT/xEMP/xUDF/xOVF Interrupt flag clear */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_EFIFO_FLG), + MCB_EFIFO_FLG_ALL); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_CDSP), + MCB_IRQFLAG_EFIFO); + + McDevIf_ExecutePacket(); +} + +/*************************************************************************** + * OFifoStart + * + * Function: + * Start OFIFO. + * Arguments: + * dCoderId Coder ID + * Return: + * None + * + ****************************************************************************/ +static void OFifoStart(UINT32 dCoderId) +{ + UINT8 bIrqPntH; + UINT8 bIrqPntL; + UINT8 bData; + UINT32 dBufSample; + struct DEC_INFO *psDecInfo; + + psDecInfo = GetDecInfo(dCoderId); + + /* xFIFO/xPNT/xEMP/xUDF/xOVF Interrupt flag clear */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_OFIFO_FLG), + MCB_OFIFO_FLG_ALL); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_CDSP), + MCB_IRQFLAG_OFIFO); + + /* xFIFO_IRQ_PNT Set */ + dBufSample = (gsFifoInfo.dOFifoBufSample * + (UINT32)psDecInfo->sConnectEx.bOfifoCh * + (UINT32)(psDecInfo->sBitWidth.bOfifoBit / 8)) / 4UL; + bIrqPntH = (UINT8)(dBufSample >> 8) & MCB_OFIFO_IRQ_PNT_H; + bIrqPntL = (UINT8)(dBufSample) & MCB_OFIFO_IRQ_PNT_L; + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_OFIFO_IRQ_PNT_H), + bIrqPntH); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_OFIFO_IRQ_PNT_L), + bIrqPntL); + + /* xFIFO/xPNT Interrupt Enable */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_OFIFO_ENABLE), + MCB_OFIFO_EOPNT); + McDevIf_ExecutePacket(); + + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_ECDSP), + &bData, 1); + bData |= MCB_EOFIFO; + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_ECDSP), + bData); + McDevIf_ExecutePacket(); + + OutputStart(psDecInfo); +} + +/*************************************************************************** + * RFifoStartPort + * + * Function: + * Start RFIFO. + * Arguments: + * dCoderId Coder ID + * Return: + * None + * + ****************************************************************************/ +static void RFifoStartPort(UINT32 dCoderId) +{ + UINT8 bIrqPntH; + UINT8 bIrqPntL; + UINT8 bData; + UINT32 dBufSample; + struct DEC_INFO *psDecInfo; + + psDecInfo = GetDecInfo(dCoderId); + + /* xFIFO/xPNT/xEMP/xUDF/xOVF Interrupt flag clear */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_RFIFO_FLG), + MCB_RFIFO_FLG_ALL); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_CDSP), + MCB_IRQFLAG_RFIFO); + + /* xFIFO_IRQ_PNT Set */ + dBufSample = (gsFifoInfo.dRFifoBufSample * RFIFO_CH_NUM + * RFIFO_BIT_WIDTH/8) / 4UL; + bIrqPntH = (UINT8)(dBufSample >> 8) & MCB_RFIFO_IRQ_PNT_H; + bIrqPntL = (UINT8)(dBufSample) & MCB_RFIFO_IRQ_PNT_L; + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_RFIFO_IRQ_PNT_H), + bIrqPntH); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_RFIFO_IRQ_PNT_L), + bIrqPntL); + + /* xFIFO/xPNT/xOVF Interrupt Enable */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_RFIFO_ENABLE), + MCB_RFIFO_ERPNT); + McDevIf_ExecutePacket(); + + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_ECDSP), + &bData, 1); + bData |= MCB_ERFIFO; + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_ECDSP), + bData); + McDevIf_ExecutePacket(); + + OutputStart(psDecInfo); +} + +/*************************************************************************** + * RFifoStartHost + * + * Function: + * Start RFIFO. + * Arguments: + * None + * Return: + * None + * + ****************************************************************************/ +static void RFifoStartHost(void) +{ + UINT8 bIrqPntH; + UINT8 bIrqPntL; + UINT8 bData; + UINT8 bIntCtrl; + + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_RFIFO_ENABLE), &bIntCtrl, 1); + + bIntCtrl |= MCB_RFIFO_EROVF; + if ((SINT32)CBPOS_RFIFO_NONE != gsFifoInfo.sdRFifoCbPos) { + bIrqPntH = (UINT8)(gsFifoInfo.sdRFifoCbPos >> 8) & + MCB_RFIFO_IRQ_PNT_H; + bIrqPntL = (UINT8)(gsFifoInfo.sdRFifoCbPos) & + MCB_RFIFO_IRQ_PNT_L; + bIntCtrl |= MCB_RFIFO_ERPNT; + } else { + bIrqPntH = 0; + bIrqPntL = 0; + bIntCtrl &= ~MCB_RFIFO_ERPNT; + } + + /* xFIFO/xPNT/xEMP/xUDF/xOVF Interrupt flag clear */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_RFIFO_FLG), + MCB_RFIFO_FLG_ALL); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_CDSP), + MCB_IRQFLAG_RFIFO); + + /* xFIFO_IRQ_PNT Set */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_RFIFO_IRQ_PNT_H), + bIrqPntH); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_RFIFO_IRQ_PNT_L), + bIrqPntL); + + /* xFIFO/xPNT/xOVF Interrupt Enable */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_RFIFO_ENABLE), + bIntCtrl); + + McDevIf_ExecutePacket(); + + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_ECDSP), + &bData, 1); + bData |= MCB_ERFIFO; + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_ECDSP), + bData); + + McDevIf_ExecutePacket(); +} + +/*************************************************************************** + * RFifoStart + * + * Function: + * Start RFIFO. + * Arguments: + * dCoderId Coder ID + * Return: + * None + * + ****************************************************************************/ +static void RFifoStart(UINT32 dCoderId) +{ + if (GetRFifoSel() == CDSP_FIFO_SEL_PORT) + RFifoStartPort(dCoderId); + else + RFifoStartHost(); +} + +/*************************************************************************** + * FifoStart + * + * Function: + * Start FIFO. + * Arguments: + * dCoderId Coder ID + * Return: + * None + * + ****************************************************************************/ +static void FifoStart(UINT32 dCoderId) +{ + UINT32 dFifoId; + + dFifoId = GetFifoId(dCoderId); + if (FIFO_NONE != (FIFO_DFIFO_MASK & dFifoId)) + DFifoStart(); + + if (FIFO_NONE != (FIFO_EFIFO_MASK & dFifoId)) + EFifoStart(); + + if (FIFO_NONE != (FIFO_OFIFO_MASK & dFifoId)) + OFifoStart(dCoderId); + + if (FIFO_NONE != (FIFO_RFIFO_MASK & dFifoId)) + RFifoStart(dCoderId); +} + +/**************************************************************************** + * DecStart + * + * Function: + * Start decoder/encoder. + * Arguments: + * dCoderId Coder ID + * Return: + * 0 success + * < 0 error code + * + ****************************************************************************/ +static SINT32 DecStart(UINT32 dCoderId) +{ + UINT8 bData; + UINT32 dFifoId; + struct DEC_INFO *psDecInfo; + struct DEC_INFO *psOtherDecInfo; + + psDecInfo = GetDecInfo(dCoderId); + + /* Mutual output ? */ + if (CDSP_OUT_DEST_OTHER_INBUF == psDecInfo->sConnect.bOutDest) { + psOtherDecInfo = GetOtherDecInfo(dCoderId); + switch (psOtherDecInfo->dState) { + case STATE_READY_SETUP: + case STATE_READY: + case STATE_PLAYING: + break; + default: + return MCDRV_ERROR; + } + } + + FifoStart(dCoderId); + + /* DEC/ENC ERR,END Interrupt flag clear */ + if (CODER_DEC == dCoderId) { + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DEC_FLG), &bData, 1); + bData |= MCB_DEC_FLG_ERR | MCB_DEC_FLG_END; + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DEC_FLG), bData); + } else { + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_ENC_FLG), &bData, 1); + bData |= MCB_ENC_FLG_ERR | MCB_ENC_FLG_END; + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_ENC_FLG), bData); + } + McDevIf_ExecutePacket(); + + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_CDSP), + &bData, 1); + if (CODER_DEC == dCoderId) + bData |= MCB_IRQFLAG_DEC; + else + bData |= MCB_IRQFLAG_ENC; + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_CDSP), + bData); + McDevIf_ExecutePacket(); + + /* DEC/ENC END,ERR Interrupt Enable */ + if (CODER_DEC == dCoderId) { + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DEC_ENABLE), &bData, 1); + bData |= MCB_EDEC_ERR | MCB_EDEC_END; + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DEC_ENABLE), bData); + } else { + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_ENC_ENABLE), &bData, 1); + bData |= MCB_EENC_ERR | MCB_EENC_END; + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_ENC_ENABLE), bData); + } + McDevIf_ExecutePacket(); + + /* DEC/ENC Start */ + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DEC_START), &bData, 1); + if (CODER_DEC == psDecInfo->dCoderId) + bData |= MCB_DEC_DEC_START; + else + bData |= MCB_DEC_ENC_START; + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DEC_START), + bData); + McDevIf_ExecutePacket(); + + dFifoId = GetFifoIdCore(&psDecInfo->sConnect); + if ((FIFO_EFIFO & dFifoId) != FIFO_NONE) { + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DEC_FIFO_CH), &bData, 1); + bData |= MCB_DEC_EFIFO_START; + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DEC_FIFO_CH), + bData); + McDevIf_ExecutePacket(); + } + if (((FIFO_DFIFO & dFifoId) != FIFO_NONE) + && (GetDFifoSel() == CDSP_FIFO_SEL_PORT)) { + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_RDFIFO_BIT_SEL), &bData, + 1); + bData |= MCB_RDFIFO_DFIFO_START; + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_RDFIFO_BIT_SEL), + bData); + McDevIf_ExecutePacket(); + } + + if (gsFifoInfo.dOFifoBufSample == 0) + if ((FIFO_OFIFO & dFifoId) != FIFO_NONE) + InterruptProcOFifoCore(); + + if (gsFifoInfo.dRFifoBufSample == 0) + if ((FIFO_RFIFO & dFifoId) != FIFO_NONE) + if (GetRFifoSel() == CDSP_FIFO_SEL_PORT) + InterruptProcRFifoPortCore(); + + return MCDRV_SUCCESS; +} + +/**************************************************************************** + * SetExt + * + * Function: + * Expand settings + * Arguments: + * dCoderId Coder ID + * psFuncInfo Pointer of func info + * Return: + * = 0 success + * < 0 error code + * + ****************************************************************************/ +static SINT32 SetExt(UINT32 dCoderId, + struct AEC_CDSP_FUNC_INFO *psFuncInfo) +{ + SINT32 sdRet; + struct DEC_INFO *psDecInfo; + struct MC_CODER_PARAMS sParam; + + sdRet = MCDRV_SUCCESS; + if (psFuncInfo->pbExt == NULL) + return sdRet; + + psDecInfo = GetDecInfo(dCoderId); + + switch (psFuncInfo->pbExt[EXT_COMMAND]) { + case EXT_COMMAND_CLEAR: + sParam.bCommandId = CDSP_CMD_HOST2OS_CMN_CLEAR; + + /* State check */ + switch (psDecInfo->dState) { + case STATE_PLAYING: + sdRet = DecStop(dCoderId, MADEVCDSP_VERIFY_COMP_ON); + if ((SINT32)MCDRV_SUCCESS != sdRet) + return sdRet; + + FifoStop(dCoderId); + psDecInfo->dState = STATE_READY; + + sdRet = SetParamCore(dCoderId, &sParam); + if (sdRet < MCDRV_SUCCESS) + return sdRet; + + sdRet = DecStart(dCoderId); + if ((SINT32)MCDRV_SUCCESS == sdRet) + psDecInfo->dState = STATE_PLAYING; + break; + + case STATE_READY_SETUP: + case STATE_READY: + sdRet = SetParamCore(dCoderId, &sParam); + break; + + default: + break; + } + break; + + default: + break; + } + + return sdRet; +} + +/**************************************************************************** + * SetRoute + * + * Function: + * Setting route + * Arguments: + * psCdspInfo Pointer of AEC analyze info + * Return: + * None + * + ****************************************************************************/ +static void SetRoute(struct MCDRV_CDSP_AEC_CDSP_INFO *psCdspInfo) +{ + if ((psCdspInfo->asFuncInfo[AEC_FUNC_INFO_A].pbFifo == NULL) + && (psCdspInfo->asFuncInfo[AEC_FUNC_INFO_B].pbFifo == NULL)) + return; + + /* OUT*R/L_SEL */ + if (psCdspInfo->bOut0Sel != gsFifoInfo.bOut0Sel) { + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_OUT0_SEL), + psCdspInfo->bOut0Sel); + gsFifoInfo.bOut0Sel = psCdspInfo->bOut0Sel; + } + + if (psCdspInfo->bOut1Sel != gsFifoInfo.bOut1Sel) { + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_OUT1_SEL), + psCdspInfo->bOut1Sel); + gsFifoInfo.bOut1Sel = psCdspInfo->bOut1Sel; + } + + if (psCdspInfo->bOut2Sel != gsFifoInfo.bOut2Sel) { + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_OUT2_SEL), + psCdspInfo->bOut2Sel); + gsFifoInfo.bOut2Sel = psCdspInfo->bOut2Sel; + } + + /* RFIFO_BIT/RFIFO_SEL/DFIFO_BIT/DFIFO_SEL */ + if (psCdspInfo->bRDFifoBitSel != gsFifoInfo.bRDFifoBitSel) { + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_RDFIFO_BIT_SEL), + psCdspInfo->bRDFifoBitSel); + gsFifoInfo.bRDFifoBitSel = psCdspInfo->bRDFifoBitSel; + } + + /* EFIFO0*_SEL */ + if (psCdspInfo->bEFifo01Sel != gsFifoInfo.bEFifo01Sel) { + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_EFIFO01_SEL), + psCdspInfo->bEFifo01Sel); + gsFifoInfo.bEFifo01Sel = psCdspInfo->bEFifo01Sel; + } + + if (psCdspInfo->bEFifo23Sel != gsFifoInfo.bEFifo23Sel) { + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_EFIFO23_SEL), + psCdspInfo->bEFifo23Sel); + gsFifoInfo.bEFifo23Sel = psCdspInfo->bEFifo23Sel; + } + + McDevIf_ExecutePacket(); +} + +/**************************************************************************** + * SetDsp + * + * Function: + * Set dsp + * Arguments: + * psCdspInfo Pointer of AEC analyze info + * Return: + * None + * + ****************************************************************************/ +static SINT32 SetDsp(struct MCDRV_CDSP_AEC_CDSP_INFO *psCdspInfo) +{ + SINT32 sdRet; + struct AEC_CDSP_FUNC_INFO *psFuncInfoA; + struct AEC_CDSP_FUNC_INFO *psFuncInfoB; + + psFuncInfoA = &psCdspInfo->asFuncInfo[AEC_FUNC_INFO_A]; + psFuncInfoB = &psCdspInfo->asFuncInfo[AEC_FUNC_INFO_B]; + + if (psFuncInfoA->bFuncOnOff != CDSP_FUNC_OFF) { + sdRet = SetFirmware(psFuncInfoA); + if (sdRet < MCDRV_SUCCESS) + return sdRet; + + sdRet = SetConnection(psFuncInfoA); + if (sdRet < MCDRV_SUCCESS) + return sdRet; + + sdRet = SetParam(psFuncInfoA); + if (sdRet < MCDRV_SUCCESS) + return sdRet; + + SetE2BufMode(CODER_DEC, psFuncInfoA); + + SetCallbackPos(CODER_DEC, psCdspInfo); + + SetBuffering(CODER_DEC, psCdspInfo); + + sdRet = SetExt(CODER_DEC, psFuncInfoA); + if (sdRet < MCDRV_SUCCESS) + return sdRet; + } + + if (psFuncInfoB->bFuncOnOff != CDSP_FUNC_OFF) { + sdRet = SetFirmware(psFuncInfoB); + if (sdRet < MCDRV_SUCCESS) + return sdRet; + + sdRet = SetConnection(psFuncInfoB); + if (sdRet < MCDRV_SUCCESS) + return sdRet; + + sdRet = SetParam(psFuncInfoB); + if (sdRet < MCDRV_SUCCESS) + return sdRet; + + SetE2BufMode(CODER_ENC, psFuncInfoB); + + SetCallbackPos(CODER_ENC, psCdspInfo); + + SetBuffering(CODER_ENC, psCdspInfo); + + sdRet = SetExt(CODER_ENC, psFuncInfoB); + if (sdRet < MCDRV_SUCCESS) + return sdRet; + } + + SetRoute(psCdspInfo); + + return MCDRV_SUCCESS; +} + +/*************************************************************************** + * GetRFifoRemain + * + * Function: + * Get readable size of output FIFO. + * Arguments: + * pdRemain Pointer of readable size + * Return: + * 0 success + * < 0 error code + * + ****************************************************************************/ +static void GetRFifoRemain(UINT32 *pdRemain) +{ + UINT8 bRFifoPntH; + UINT8 bRFifoPntL; + UINT32 dRemainSize; + + /* Read RFIFO Remain size */ + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_RFIFO_POINTER_H), + &bRFifoPntH, 1); + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_RFIFO_POINTER_L), + &bRFifoPntL, 1); + + dRemainSize = MAKEWORD(bRFifoPntL, bRFifoPntH); + + *pdRemain = dRemainSize; +} + +/*************************************************************************** + * ReadData + * + * Function: + * Read record data. + * Arguments: + * pbData Record data + * dSize Record data size + * Return: + * 0 <= Record data Size + * < 0 error code + * + ****************************************************************************/ +static SINT32 ReadData(UINT8 *pbData, UINT32 dSize) +{ + UINT8 bIntCtrl; + UINT32 dRemainSize; + + /* Read RFIFO Remain size */ + GetRFifoRemain(&dRemainSize); + + /* Read Byte */ + if (dRemainSize > dSize) + dRemainSize = dSize; + + /* Register Information */ + if ((SINT32)CBPOS_RFIFO_NONE != gsFifoInfo.sdRFifoCbPos) + bIntCtrl = MCB_RFIFO_ERPNT; + else + bIntCtrl = 0; + + /* Read */ + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_IF | (UINT32)MCI_DEC_FIFO), + pbData, dRemainSize); + + /* IRQ Flag Clear */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_CDSP), + MCB_IRQFLAG_RFIFO); + + /* RFIFO Flag Clear */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_RFIFO_FLG), + MCB_RFIFO_FLG_ALL); + + /* ERPNT, EROVF Enable */ + bIntCtrl |= MCB_RFIFO_EROVF; + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_RFIFO_ENABLE), + bIntCtrl); + + McDevIf_ExecutePacket(); + + return (SINT32)dRemainSize; +} + +/*************************************************************************** + * GetDFifoRemain + * + * Function: + * Get writable size of input FIFO. + * Arguments: + * pdRemain Pointer of writable size + * Return: + * 0 success + * < 0 error code + * + ****************************************************************************/ +static void GetDFifoRemain(UINT32 *pdRemain) +{ + UINT8 bDFifoPntH; + UINT8 bDFifoPntL; + UINT32 dRemainSize; + + /* Read DFIFO Remain size */ + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DFIFO_POINTER_H), + &bDFifoPntH, 1); + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DFIFO_POINTER_L), + &bDFifoPntL, 1); + dRemainSize = MAKEWORD(bDFifoPntL, bDFifoPntH); + + dRemainSize = (UINT32)(FIFOSIZE_DFIFO - dRemainSize); + + if (dRemainSize < DFIFO_DUMMY_SPACE) + dRemainSize = 0; + else + dRemainSize -= DFIFO_DUMMY_SPACE; + + *pdRemain = dRemainSize; +} + +/*************************************************************************** + * WriteData + * + * Function: + * Write play data to FIFO. + * Arguments: + * pbData Play data + * dSize Play data size + * Return: + * 0 <= Play Data Size + * < 0 error code + * + ****************************************************************************/ +static SINT32 WriteData(const UINT8 *pbData, UINT32 dSize) +{ + UINT8 bIntCtrl; + UINT8 bData; + UINT32 dRemainSize; + UINT32 i; + + /* Read DFIFO Remain size */ + GetDFifoRemain(&dRemainSize); + + /* Write Byte */ + if (dRemainSize < dSize) + dSize = dRemainSize; + + /* Register Information */ + if ((SINT32)CBPOS_DFIFO_NONE != gsFifoInfo.sdDFifoCbPos) + bIntCtrl = MCB_DFIFO_EDPNT; + else + bIntCtrl = 0; + + /* DMODE Set */ + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_CDSP_RESET), &bData, 1); + bData |= MCB_CDSP_DMODE; + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_CDSP_RESET), bData); + + McDevIf_ExecutePacket(); + + /* Write */ + for (i = 0; i < dSize; ++i) + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_DEC_FIFO), + pbData[i]); + + McDevIf_ExecutePacket(); + + /* IRQ Flag Clear */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_CDSP), + MCB_IRQFLAG_DFIFO); + + /* DFIFO Flag Clear */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DFIFO_FLG), + MCB_DFIFO_FLG_ALL); + + /* EDPNT, EDEMP Enable */ + bIntCtrl |= MCB_DFIFO_EDEMP; + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_DFIFO_ENABLE), + bIntCtrl); + + McDevIf_ExecutePacket(); + + gsFifoInfo.dDFifoWriteSize += dSize; + + return (SINT32)dSize; +} + +/**************************************************************************** + * ReadDataCore + * + * Function: + * Read record data + * Arguments: + * dCoderId Coder ID + * pbBuffer Pointer of record data + * dSize Record data size + * Return: + * 0 <= Read Data Size + * < 0 error code + * + ****************************************************************************/ +static SINT32 ReadDataCore(UINT32 dCoderId, UINT8 *pbBuffer, UINT32 dSize) +{ + UINT32 dFifoId; + struct DEC_INFO *psDecInfo; + + psDecInfo = GetDecInfo(dCoderId); + + /* State check */ + switch (psDecInfo->dState) { + case STATE_READY_SETUP: + case STATE_READY: + case STATE_PLAYING: + break; + + default: + return MCDRV_ERROR_STATE; + } + + dFifoId = GetFifoId(dCoderId); + if ((dFifoId & FIFO_RFIFO_MASK) == 0) + return MCDRV_ERROR; + + return ReadData(pbBuffer, dSize); +} + +/**************************************************************************** + * WriteDataCore + * + * Function: + * Write play data to FIFO + * Arguments: + * dCoderId Coder Id + * pbBuffer Play data + * dSize Play data size + * Return: + * 0 <= Play Data Size + * < 0 error code + * + ****************************************************************************/ +static SINT32 WriteDataCore(UINT32 dCoderId, + const UINT8 *pbBuffer, UINT32 dSize) +{ + UINT32 dFifoId; + struct DEC_INFO *psDecInfo; + + psDecInfo = GetDecInfo(dCoderId); + + /* State check */ + switch (psDecInfo->dState) { + case STATE_READY_SETUP: + case STATE_READY: + case STATE_PLAYING: + break; + + default: + return MCDRV_ERROR_STATE; + } + + dFifoId = GetFifoId(dCoderId); + if ((dFifoId & FIFO_DFIFO_MASK) == 0) + return MCDRV_ERROR; + + if (INPUT_DATAEND_RELEASE != psDecInfo->bInputDataEnd) + return MCDRV_ERROR; + + return WriteData(pbBuffer, dSize); +} + +/**************************************************************************** + * GetInputPosition + * + * Function: + * Get present input position (unit of ms). + * Arguments: + * pdPos Pointer of input position + * Return: + * 0 success + * < 0 error code + * + ****************************************************************************/ +static SINT32 GetInputPosition(UINT32 *pdPos) +{ + UINT8 abInputPos[4]; + UINT32 dInputPos; + struct DEC_INFO *psDecInfo; + + psDecInfo = GetDecInfo(CODER_DEC); + /* Path check */ + switch (psDecInfo->sConnect.bInSource) { + case CDSP_IN_SOURCE_DFIFO: + case CDSP_IN_SOURCE_OTHER_OUTBUF: + case CDSP_IN_SOURCE_NONE: + psDecInfo = GetDecInfo(CODER_ENC); + + switch (psDecInfo->sConnect.bInSource) { + case CDSP_IN_SOURCE_DFIFO: + case CDSP_IN_SOURCE_OTHER_OUTBUF: + case CDSP_IN_SOURCE_NONE: + *pdPos = 0; + return sizeof(*pdPos); + } + break; + + default: + break; + } + + /* pcm input ? */ + if ((psDecInfo->sProgInfo.wInOutType & PRG_PRM_IOTYPE_IN_MASK) + != PRG_PRM_IOTYPE_IN_PCM) { + *pdPos = 0; + return sizeof(*pdPos); + } + + /* ENC_POS Read */ + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_ENC_POS1), &abInputPos[3], 1); + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_ENC_POS2), &abInputPos[2], 1); + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_ENC_POS3), &abInputPos[1], 1); + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_ENC_POS4), &abInputPos[0], 1); + dInputPos = ((UINT32)abInputPos[3] << 24) + | ((UINT32)abInputPos[2] << 16) + | ((UINT32)abInputPos[1] << 8) + | (UINT32)abInputPos[0]; + + dInputPos += psDecInfo->dInPosSup; + + /* sample -> msec */ + if ((psDecInfo->sConnectEx.bEfifoCh == 4) + || ((psDecInfo->sConnectEx.bEfifoCh == 2) + && (psDecInfo->sBitWidth.bOfifoBit == 32))) + dInputPos /= 2; + + *pdPos = ConvertSamplesToTime(psDecInfo->sFormat.bFs, dInputPos); + + return sizeof(*pdPos); +} + +/**************************************************************************** + * GetHwErrorCode + * + * Function: + * Get the error code of the error notified + * by the callback. + * Arguments: + * pwErrorCode Pointer in area where error code + * is received. + * Return: + * 0 success + * < 0 error code + * + ****************************************************************************/ +SINT32 GetHwErrorCode(UINT16 *pwErrorCode) +{ + *pwErrorCode = gsCdspInfo.wHwErrorCode; + + return sizeof(*pwErrorCode); +} + +/**************************************************************************** + * McCdsp_GetErrorCode + * + * Function: + * Get the error code of the error notified + * by the callback. + * Arguments: + * ePlayerId Player ID + * pwErrorCode Pointer in area where error code + * is received. + * Return: + * 0 success + * < 0 error code + * + ****************************************************************************/ +SINT32 GetErrorCode(UINT32 dCoderId, UINT16 *pwErrorCode) +{ + struct DEC_INFO *psDecInfo; + + psDecInfo = GetDecInfo(dCoderId); + *pwErrorCode = psDecInfo->wErrorCode; + + return sizeof(*pwErrorCode); +} + +/**************************************************************************** + * GetVersion + * + * Function: + * Get CDSP OS and program version. + * Arguments: + * psVersion Pointer of structure + * that receives version. + * Return: + * 0 success + * < 0 error code + * + ****************************************************************************/ +SINT32 GetVersion(UINT32 dCoderId, struct MC_CODER_VERSION *psVersion) +{ + struct DEC_INFO *psDecInfo; + + psDecInfo = GetDecInfo(dCoderId); + /* State check */ + switch (psDecInfo->dState) { + case STATE_READY_SETUP: + case STATE_READY: + case STATE_PLAYING: + psVersion->dID = (UINT32)psDecInfo->sProgInfo.wVendorId; + psVersion->dID += + (UINT32)psDecInfo->sProgInfo.wFunctionId << 16; + psVersion->wProgVerH = psDecInfo->sProgVer.wVersionH; + psVersion->wProgVerM = 0; + psVersion->wProgVerL = psDecInfo->sProgVer.wVersionL; + psVersion->wOsVerH = gsCdspInfo.sOsVer.wVersionH; + psVersion->wOsVerM = 0; + psVersion->wOsVerL = gsCdspInfo.sOsVer.wVersionL; + break; + + default: + psVersion->dID = 0; + psVersion->wProgVerH = 0; + psVersion->wProgVerM = 0; + psVersion->wProgVerL = 0; + psVersion->wOsVerH = 0; + psVersion->wOsVerM = 0; + psVersion->wOsVerL = 0; + break; + } + + return sizeof(*psVersion); +} + +/**************************************************************************** + * GetHostCommand + * + * Function: + * Get host Command. + * Arguments: + * dCoderId Coder ID + * pbData get command + * Return: + * 0 success + * < 0 error code + * + ****************************************************************************/ +static SINT32 GetHostCommand(UINT32 dCoderId, UINT8 *pbData) +{ + SINT32 i; + SINT32 sdRet; + struct MC_CODER_PARAMS sParam; + + sdRet = GetParamCore(dCoderId, &sParam); + if (sdRet < MCDRV_SUCCESS) + return sdRet; + + pbData[0] = sParam.bCommandId; + for (i = 0; i < CDSP_CMD_PARAM_NUM; i++) + pbData[i + 1] = sParam.abParam[i]; + + sParam.bCommandId |= (UINT8)CDSP_CMD_HOST2OS_COMPLETION; + for (i = 0; i < CDSP_CMD_PARAM_NUM; i++) + sParam.abParam[i] = 0; + + sdRet = SetParamCore(dCoderId, &sParam); + + return sdRet; +} + +/*************************************************************************** + * McCdsp_Init + * + * Function: + * Initialize CDSP. + * Arguments: + * psPrm Pointer of MCDRV_CDSP_INIT + * Return: + * 0 success + * < 0 error code + * + ****************************************************************************/ +SINT32 McCdsp_Init(struct MCDRV_CDSP_INIT *psPrm) +{ + SINT32 sdRet; + + (void)psPrm; + sdRet = Initialize(); + + return sdRet; +} + +/*************************************************************************** + * McCdsp_Term + * + * Function: + * Terminate CDSP. + * Arguments: + * None + * Return: + * 0 success + * + ****************************************************************************/ +SINT32 McCdsp_Term(void) +{ + UINT8 bData; + + /* CDSP stop */ + if ((STATE_NOTINIT != gsDecInfo.dState) + || (STATE_NOTINIT != gsEncInfo.dState)) { + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_CDSP_RESET), + &bData, 1); + bData |= MCB_CDSP_SRST; + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_CDSP_RESET), + bData); + + McDevIf_ExecutePacket(); + } + + gsDecInfo.dState = STATE_NOTINIT; + gsEncInfo.dState = STATE_NOTINIT; + + return MCDRV_SUCCESS; +} + +/**************************************************************************** + * McCdsp_IrqProc + * + * Function: + * It is processed the interrupt generation. + * Arguments: + * None + * Return: + * None + * + ****************************************************************************/ +void McCdsp_IrqProc(void) +{ + UINT8 bData; + + if ((STATE_NOTINIT == gsDecInfo.dState) + || (STATE_NOTINIT == gsEncInfo.dState)) + return; + + /* Get interrupt flag */ + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_CDSP), &bData, 1); + + /* Interrupt */ + if (MCB_IRQFLAG_DEC == (MCB_IRQFLAG_DEC & bData)) + InterruptProcDec(CODER_DEC); + + if (MCB_IRQFLAG_ENC == (MCB_IRQFLAG_ENC & bData)) + InterruptProcDec(CODER_ENC); + + if (MCB_IRQFLAG_DFIFO == (MCB_IRQFLAG_DFIFO & bData)) + InterruptProcDFifo(); + + /*if (MCB_IRQFLAG_EFIFO == (MCB_IRQFLAG_EFIFO & bData))*/ + /* None */ + + if (MCB_IRQFLAG_OFIFO == (MCB_IRQFLAG_OFIFO & bData)) + InterruptProcOFifo(); + + if (MCB_IRQFLAG_RFIFO == (MCB_IRQFLAG_RFIFO & bData)) + InterruptProcRFifo(); + + /* if (MCB_IRQFLAG_FFIFO == (MCB_IRQFLAG_FFIFO & bData))*/ + /* None */ + + if (MCB_IRQFLAG_CDSP == (MCB_IRQFLAG_CDSP & bData)) + InterruptProcCDsp(); + + /* Clear interrupt flag */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_CDSP), + bData); + + McDevIf_ExecutePacket(); + + /* Callback */ + CallbackProc(); +} + +/**************************************************************************** + * McCdsp_SetCallbackFunc + * + * Function: + * Set callback function. + * Arguments: + * ePlayerId Player ID + * pcbfunc Pointer of callback function. + * Return: + * 0 success + * + ****************************************************************************/ +SINT32 McCdsp_SetCBFunc(enum MC_PLAYER_ID ePlayerId, + SINT32 (*pcbfunc)(SINT32, UINT32, UINT32)) +{ + UINT32 dCoderId; + struct DEC_INFO *psDecInfo; + + /* arg check */ + switch (ePlayerId) { + case eMC_PLAYER_CODER_A: + dCoderId = CODER_DEC; + break; + case eMC_PLAYER_CODER_B: + dCoderId = CODER_ENC; + break; + default: + return MCDRV_ERROR_ARGUMENT; + } + + psDecInfo = GetDecInfo(dCoderId); + psDecInfo->sCbInfo.pcbFunc = pcbfunc; + + return MCDRV_SUCCESS; +} + +/**************************************************************************** + * McCdsp_GetDSP + * + * Function: + * Get dsp + * Arguments: + * dTarget Target + * pvData Pointer of data + * dSize Data Size + * Return: + * 0 <= Get data size + * < 0 error code + * + ****************************************************************************/ +SINT32 McCdsp_GetDSP(UINT32 dTarget, void *pvData, UINT32 dSize) +{ + SINT32 sdRet; + + (void)dSize; + if (pvData == NULL) + return MCDRV_ERROR_ARGUMENT; + + switch (dTarget) { + case CDSP_INPOS: + sdRet = GetInputPosition((UINT32 *)pvData); + break; + + case CDSP_OUTPOS: + sdRet = GetOutputPosition(CODER_DEC, (UINT32 *)pvData); + if (sdRet != MCDRV_SUCCESS) + sdRet = GetOutputPosition(CODER_ENC, (UINT32 *)pvData); + + if (sdRet != MCDRV_SUCCESS) + *((UINT32 *)pvData) = 0; + + sdRet = sizeof(UINT32); + break; + + case CDSP_DFIFO_REMAIN: + GetDFifoRemain((UINT32 *)pvData); + sdRet = sizeof(UINT32); + break; + + case CDSP_RFIFO_REMAIN: + GetRFifoRemain((UINT32 *)pvData); + sdRet = sizeof(UINT32); + break; + + case CDSP_HW_ERROR_CODE: + sdRet = GetHwErrorCode((UINT16 *)pvData); + break; + + case CDSP_FUNC_A_ERROR_CODE: + sdRet = GetErrorCode(CODER_DEC, (UINT16 *)pvData); + break; + + case CDSP_FUNC_B_ERROR_CODE: + sdRet = GetErrorCode(CODER_ENC, (UINT16 *)pvData); + break; + + case CDSP_FUNC_A_VERSION: + sdRet = GetVersion(CODER_DEC, + (struct MC_CODER_VERSION *)pvData); + break; + + case CDSP_FUNC_B_VERSION: + sdRet = GetVersion(CODER_ENC, + (struct MC_CODER_VERSION *)pvData); + break; + + case CDSP_FUNC_A_HOST_COMMAND: + sdRet = GetHostCommand(CODER_DEC, (UINT8 *)pvData); + break; + + case CDSP_FUNC_B_HOST_COMMAND: + sdRet = GetHostCommand(CODER_ENC, (UINT8 *)pvData); + break; + + default: + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + + return sdRet; +} + +/**************************************************************************** + * McCdsp_SetDSPCheck + * + * Function: + * Check dsp setting + * Arguments: + * psPrm Pointer of Aec info + * Return: + * 0 success + * < 0 error code + * + ****************************************************************************/ +SINT32 McCdsp_SetDSPCheck(struct MCDRV_AEC_INFO *psPrm) +{ + SINT32 sdResult; + struct MCDRV_CDSP_AEC_CDSP_INFO sCdspInfo; + + if (psPrm == NULL) + return MCDRV_ERROR_ARGUMENT; + + GetCDSPChunk(psPrm, &sCdspInfo); + + sdResult = CdspChunkAnalyze(&sCdspInfo); + if (sdResult < (SINT32)MCDRV_SUCCESS) + return sdResult; + + return MCDRV_SUCCESS; +} + +/**************************************************************************** + * McCdsp_SetDSP + * + * Function: + * Set dsp + * Arguments: + * pbPrm Pointer of Aec info + * Return: + * 0 success + * < 0 error code + * + ****************************************************************************/ +SINT32 McCdsp_SetDSP(struct MCDRV_AEC_INFO *pbPrm) +{ + SINT32 sdResult; + struct MCDRV_CDSP_AEC_CDSP_INFO sCdspInfo; + struct AEC_CDSP_FUNC_INFO *psFuncInfoA; + struct AEC_CDSP_FUNC_INFO *psFuncInfoB; + + psFuncInfoA = &sCdspInfo.asFuncInfo[AEC_FUNC_INFO_A]; + psFuncInfoB = &sCdspInfo.asFuncInfo[AEC_FUNC_INFO_B]; + + if (pbPrm == NULL) + return MCDRV_ERROR_ARGUMENT; + + GetCDSPChunk(pbPrm, &sCdspInfo); + + sdResult = CdspChunkAnalyze(&sCdspInfo); + if (sdResult < (SINT32)MCDRV_SUCCESS) + return sdResult; + + if (pbPrm->sAecVBox.bEnable == AEC_VBOX_ENABLE) { + if (psFuncInfoA->bFuncOnOff == CDSP_FUNC_OFF) + TermFunction(CODER_DEC); + + if (psFuncInfoB->bFuncOnOff == CDSP_FUNC_OFF) + TermFunction(CODER_ENC); + } + + if (((psFuncInfoA->pbChunk == NULL) + || (psFuncInfoA->dChunkSize == 0)) + && ((psFuncInfoB->pbChunk == NULL) + || (psFuncInfoB->dChunkSize == 0))) + return MCDRV_SUCCESS; + + if ((STATE_NOTINIT == gsDecInfo.dState) + || (STATE_NOTINIT == gsEncInfo.dState)) + return MCDRV_ERROR_STATE; + + sdResult = SetDsp(&sCdspInfo); + + return sdResult; +} + +/**************************************************************************** + * McCdsp_SetFs + * + * Function: + * Set fs + * Arguments: + * ePlayerId Player ID + * bFs FS + * Return: + * 0 success + * < 0 error code + * + ****************************************************************************/ +SINT32 McCdsp_SetFs(enum MC_PLAYER_ID ePlayerId, UINT8 bFs) +{ + UINT32 dCoderId; + SINT32 sdRet; + struct DEC_INFO *psDecInfo; + struct MC_CODER_PARAMS sParams; + + if ((STATE_NOTINIT == gsDecInfo.dState) + || (STATE_NOTINIT == gsEncInfo.dState)) + return MCDRV_ERROR_STATE; + + /* arg check */ + switch (ePlayerId) { + case eMC_PLAYER_CODER_A: + dCoderId = CODER_DEC; + break; + case eMC_PLAYER_CODER_B: + dCoderId = CODER_ENC; + break; + default: + return MCDRV_ERROR_ARGUMENT; + } + + psDecInfo = GetDecInfo(dCoderId); + + sParams.bCommandId = CDSP_CMD_HOST2OS_SYS_SET_FORMAT; + sParams.abParam[CDSP_CMD_PARAM_ARGUMENT_00] = bFs; + sParams.abParam[CDSP_CMD_PARAM_ARGUMENT_01] = + psDecInfo->sFormat.bE2BufMode; + + sdRet = SetFormat(dCoderId, &sParams); + + return sdRet; +} + +/**************************************************************************** + * McCdsp_SetDFifoSel + * + * Function: + * Select Port/Host dfifo + * Arguments: + * bSel Select Port/Host + * Return: + * 0 success + * < 0 error code + * + ****************************************************************************/ +SINT32 McCdsp_SetDFifoSel(UINT8 bSel) +{ + UINT8 bRDFifoBitSel; + + if ((bSel != CDSP_FIFO_SEL_PORT) && (bSel != CDSP_FIFO_SEL_HOST)) + return MCDRV_ERROR_ARGUMENT; + + if ((STATE_NOTINIT == gsDecInfo.dState) + || (STATE_NOTINIT == gsEncInfo.dState)) + return MCDRV_ERROR_STATE; + + bRDFifoBitSel = gsFifoInfo.bRDFifoBitSel; + bRDFifoBitSel &= ~MCB_DFIFO_SEL; + if (bSel == CDSP_FIFO_SEL_HOST) + bRDFifoBitSel |= MCB_DFIFO_SEL_HOST; + + /* DFIFO_SEL */ + if (gsFifoInfo.bRDFifoBitSel != bRDFifoBitSel) { + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_RDFIFO_BIT_SEL), + bRDFifoBitSel); + McDevIf_ExecutePacket(); + + gsFifoInfo.bRDFifoBitSel = bRDFifoBitSel; + } + + return MCDRV_SUCCESS; +} + +/**************************************************************************** + * McCdsp_SetRFifoSel + * + * Function: + * Select Port/Host rfifo + * Arguments: + * bSel Select Port/Host + * Return: + * 0 success + * < 0 error code + * + ****************************************************************************/ +SINT32 McCdsp_SetRFifoSel(UINT8 bSel) +{ + UINT8 bRDFifoBitSel; + + if ((bSel != CDSP_FIFO_SEL_PORT) && (bSel != CDSP_FIFO_SEL_HOST)) + return MCDRV_ERROR_ARGUMENT; + + if ((STATE_NOTINIT == gsDecInfo.dState) + || (STATE_NOTINIT == gsEncInfo.dState)) + return MCDRV_ERROR_STATE; + + bRDFifoBitSel = gsFifoInfo.bRDFifoBitSel; + bRDFifoBitSel &= ~MCB_RFIFO_SEL; + if (bSel == CDSP_FIFO_SEL_HOST) + bRDFifoBitSel |= MCB_RFIFO_SEL_HOST; + + /* RFIFO_SEL */ + if (gsFifoInfo.bRDFifoBitSel != bRDFifoBitSel) { + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | (UINT32)MCI_RDFIFO_BIT_SEL), + bRDFifoBitSel); + + McDevIf_ExecutePacket(); + + gsFifoInfo.bRDFifoBitSel = bRDFifoBitSel; + } + + return MCDRV_SUCCESS; +} + +/**************************************************************************** + * McCdsp_Start + * + * Function: + * Begin main process. + * Arguments: + * ePlayerId Player ID + * Return: + * 0 success + * < 0 error code + * + ****************************************************************************/ +SINT32 McCdsp_Start(enum MC_PLAYER_ID ePlayerId) +{ + UINT32 dCoderId; + SINT32 sdRet; + struct DEC_INFO *psDecInfo; + + /* arg check */ + switch (ePlayerId) { + case eMC_PLAYER_CODER_A: + dCoderId = CODER_DEC; + break; + case eMC_PLAYER_CODER_B: + dCoderId = CODER_ENC; + break; + default: + return MCDRV_ERROR_ARGUMENT; + } + + psDecInfo = GetDecInfo(dCoderId); + + switch (psDecInfo->dState) { + case STATE_READY_SETUP: + sdRet = DecStandby(dCoderId); + if ((SINT32)MCDRV_SUCCESS != sdRet) + return sdRet; + + FifoReset(dCoderId, + (FIFO_DFIFO | FIFO_EFIFO | FIFO_OFIFO | FIFO_RFIFO)); + + psDecInfo->dState = STATE_READY; + + if (INPUT_DATAEND_SET == psDecInfo->bPreInputDataEnd) { + sdRet = SetInputDataEnd(dCoderId); + if ((SINT32)MCDRV_SUCCESS != sdRet) + return sdRet; + } + break; + + case STATE_READY: + FifoReset(dCoderId, (FIFO_DFIFO | FIFO_EFIFO)); + break; + + default: + return MCDRV_ERROR_STATE; + } + + + sdRet = DecStart(dCoderId); + if ((SINT32)MCDRV_SUCCESS == sdRet) + psDecInfo->dState = STATE_PLAYING; + + return sdRet; +} + +/**************************************************************************** + * McCdsp_Stop + * + * Function: + * Stop main process. + * Arguments: + * ePlayerId Player ID + * Return: + * 0 success + * < 0 error code + * + ****************************************************************************/ +SINT32 McCdsp_Stop(enum MC_PLAYER_ID ePlayerId) +{ + UINT32 dCoderId; + SINT32 sdRet; + struct DEC_INFO *psDecInfo; + + /* arg check */ + switch (ePlayerId) { + case eMC_PLAYER_CODER_A: + dCoderId = CODER_DEC; + break; + case eMC_PLAYER_CODER_B: + dCoderId = CODER_ENC; + break; + default: + return MCDRV_ERROR_ARGUMENT; + } + + psDecInfo = GetDecInfo(dCoderId); + + /* State check */ + switch (psDecInfo->dState) { + case STATE_PLAYING: + break; + + default: + return MCDRV_ERROR_STATE; + } + + sdRet = DecStop(dCoderId, MADEVCDSP_VERIFY_COMP_ON); + if ((SINT32)MCDRV_SUCCESS != sdRet) + return sdRet; + + FifoStop(dCoderId); + + psDecInfo->dState = STATE_READY; + + return sdRet; +} + +/**************************************************************************** + * McCdsp_GetParam + * + * Function: + * Get the parameter of the HOST command demanded + * by the callback. + * Arguments: + * ePlayerId Player ID + * psParam Pointer of structure + * that receives parameter. + * Return: + * 0 success + * < 0 error code + * + ****************************************************************************/ +SINT32 McCdsp_GetParam(enum MC_PLAYER_ID ePlayerId, + struct MC_CODER_PARAMS *psParam) +{ + UINT32 dCoderId; + SINT32 sdRet; + + /* Argument check */ + switch (ePlayerId) { + case eMC_PLAYER_CODER_A: + dCoderId = CODER_DEC; + break; + case eMC_PLAYER_CODER_B: + dCoderId = CODER_ENC; + break; + default: + return MCDRV_ERROR_ARGUMENT; + } + + if (NULL == psParam) + return MCDRV_ERROR_ARGUMENT; + + sdRet = GetParamCore(dCoderId, psParam); + + return sdRet; +} + +/**************************************************************************** + * McCdsp_SetParam + * + * Function: + * Send command. + * Arguments: + * ePlayerId Player ID + * psParam Pointer of structure + * that sends parameter. + * Return: + * 0 success + * < 0 error code + * + ****************************************************************************/ +SINT32 McCdsp_SetParam(enum MC_PLAYER_ID ePlayerId, + struct MC_CODER_PARAMS *psParam) +{ + UINT32 dCoderId; + SINT32 sdRet; + + /* arg check */ + switch (ePlayerId) { + case eMC_PLAYER_CODER_A: + dCoderId = CODER_DEC; + break; + case eMC_PLAYER_CODER_B: + dCoderId = CODER_ENC; + break; + default: + return MCDRV_ERROR_ARGUMENT; + } + + if (NULL == psParam) + return MCDRV_ERROR_ARGUMENT; + + sdRet = SetParamCore(dCoderId, psParam); + + return sdRet; +} + +/**************************************************************************** + * McCdsp_ReadData + * + * Function: + * Read data from FIFO. + * Arguments: + * pbBuffer Read data buffer. + * dSize Data size (unit: byte) + * Return: + * 0 success + * < 0 error code + * + ****************************************************************************/ +SINT32 McCdsp_ReadData(UINT8 *pbBuffer, UINT32 dSize) +{ + UINT32 dCoderId; + UINT32 dFifoId; + SINT32 sdRet; + + if (NULL == pbBuffer) + return MCDRV_ERROR_ARGUMENT; + + if (0UL == dSize) + return MCDRV_ERROR_ARGUMENT; + + if (GetRFifoSel() != CDSP_FIFO_SEL_HOST) + return 0; + + dCoderId = CODER_DEC; + dFifoId = GetFifoId(dCoderId); + if ((dFifoId & FIFO_RFIFO) == FIFO_NONE) { + dCoderId = CODER_ENC; + dFifoId = GetFifoId(dCoderId); + if ((dFifoId & FIFO_RFIFO) == FIFO_NONE) + return 0; + } + + sdRet = ReadDataCore(dCoderId, pbBuffer, dSize); + + return sdRet; +} + +/**************************************************************************** + * McCdsp_WriteData + * + * Function: + * Write byte-data to FIFO. + * Arguments: + * pbBuffer Write data buffer. + * dSize Data size (unit: byte) + * Return: + * 0 success + * < 0 error code + * + ****************************************************************************/ +SINT32 McCdsp_WriteData(const UINT8 *pbBuffer, UINT32 dSize) +{ + SINT32 sdRet; + UINT32 dFifoId; + UINT32 dCoderId; + + if (NULL == pbBuffer) + return MCDRV_ERROR_ARGUMENT; + + if (0UL == dSize) + return MCDRV_ERROR_ARGUMENT; + + if (GetDFifoSel() != CDSP_FIFO_SEL_HOST) + return 0; + + dCoderId = CODER_DEC; + dFifoId = GetFifoId(dCoderId); + if ((dFifoId & FIFO_DFIFO) == FIFO_NONE) { + dCoderId = CODER_ENC; + dFifoId = GetFifoId(dCoderId); + if ((dFifoId & FIFO_DFIFO) == FIFO_NONE) + return 0; + } + + sdRet = WriteDataCore(dCoderId, pbBuffer, dSize); + + return sdRet; +} + diff --git a/sound/soc/codecs/ymu831/mccdspdrv.h b/sound/soc/codecs/ymu831/mccdspdrv.h new file mode 100644 index 00000000000..93061e1863e --- /dev/null +++ b/sound/soc/codecs/ymu831/mccdspdrv.h @@ -0,0 +1,203 @@ +/**************************************************************************** + * + * Copyright(c) 2012-2013 Yamaha Corporation. All rights reserved. + * + * Module : mccdspdrv.h + * + * Description : CDSP Driver + * + * Version : 2.0.0 2013.04.09 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + * + ****************************************************************************/ +#ifndef _MCCDSPDRV_H_ +#define _MCCDSPDRV_H_ + +/* definition */ + +#define CDSP_FUNC_OFF (0) +#define CDSP_FUNC_ON (1) + +/* callback */ +#define CDSP_EVT_FS_CHG (100) +#define CDSP_EVT_FS_CHG_REF (101) + +/* Command (Host -> OS) */ +#define CDSP_CMD_HOST2OS_CMN_NONE (0x00) +#define CDSP_CMD_HOST2OS_CMN_RESET (0x01) +#define CDSP_CMD_HOST2OS_CMN_CLEAR (0x02) +#define CDSP_CMD_HOST2OS_CMN_STANDBY (0x03) +#define CDSP_CMD_HOST2OS_CMN_GET_PRG_VER (0x04) +#define CDSP_CMD_HOST2OS_SYS_GET_OS_VER (0x20) +#define CDSP_CMD_HOST2OS_SYS_SET_PRG_INFO (0x21) +#define CDSP_CMD_HOST2OS_SYS_SET_FORMAT (0x22) +#define CDSP_CMD_HOST2OS_SYS_SET_CONNECTION (0x23) +#define CDSP_CMD_HOST2OS_SYS_VERIFY_STOP_COMP (0x24) +#define CDSP_CMD_HOST2OS_SYS_INPUT_DATA_END (0x25) +#define CDSP_CMD_HOST2OS_SYS_CLEAR_INPUT_DATA_END (0x26) +#define CDSP_CMD_HOST2OS_SYS_SET_TIMER (0x27) +#define CDSP_CMD_HOST2OS_SYS_TIMER_RESET (0x28) +#define CDSP_CMD_HOST2OS_SYS_TERMINATE (0x29) +#define CDSP_CMD_HOST2OS_SYS_SET_DUAL_MONO (0x2A) +#define CDSP_CMD_HOST2OS_SYS_GET_INPUT_POS (0x2B) +#define CDSP_CMD_HOST2OS_SYS_RESET_INPUT_POS (0x2C) +#define CDSP_CMD_HOST2OS_SYS_HALT (0x2D) +#define CDSP_CMD_HOST2OS_SYS_SET_CLOCK_SOURCE (0x2E) +#define CDSP_CMD_DRV_SYS_SET_CONNECTION_EX (0x3E) +#define CDSP_CMD_DRV_SYS_SET_BIT_WIDTH (0x3F) +#define CDSP_CMD_HOST2OS_PRG_MIN (0x40) +#define CDSP_CMD_HOST2OS_PRG_MAX (0x6F) + +/* Command (OS -> Host) */ +#define CDSP_CMD_OS2HOST_CMN_NONE (0x00) +#define CDSP_CMD_OS2HOST_CMN_MIN (0x01) +#define CDSP_CMD_OS2HOST_CMN_MAX (0x3F) +#define CDSP_CMD_OS2HOST_PRG_MIN (0x40) +#define CDSP_CMD_OS2HOST_PRG_MAX (0x6F) +#define CDSP_CMD_OS2HOST_DISABLE_MIN (0x70) +#define CDSP_CMD_OS2HOST_DISABLE_MAX (0x7F) +#define CDSP_CMD_OS2HOST_READY_MIN (0x80) +#define CDSP_CMD_OS2HOST_READY_MAX (0xFF) +#define CDSP_CMD_OS2HOST_CMN_NOTIFY_OUT_FORMAT (0x01) + +/* Command parameter */ +#define CDSP_CMD_PARAM_ARGUMENT_00 (0) +#define CDSP_CMD_PARAM_ARGUMENT_01 (1) +#define CDSP_CMD_PARAM_ARGUMENT_02 (2) +#define CDSP_CMD_PARAM_ARGUMENT_03 (3) +#define CDSP_CMD_PARAM_ARGUMENT_04 (4) +#define CDSP_CMD_PARAM_ARGUMENT_05 (5) +#define CDSP_CMD_PARAM_ARGUMENT_06 (6) +#define CDSP_CMD_PARAM_ARGUMENT_07 (7) +#define CDSP_CMD_PARAM_ARGUMENT_08 (8) +#define CDSP_CMD_PARAM_ARGUMENT_09 (9) +#define CDSP_CMD_PARAM_ARGUMENT_10 (10) +#define CDSP_CMD_PARAM_ARGUMENT_11 (11) +#define CDSP_CMD_PARAM_ARGUMENT_NUM (12) +#define CDSP_CMD_PARAM_RESULT_00 (12) +#define CDSP_CMD_PARAM_RESULT_01 (13) +#define CDSP_CMD_PARAM_RESULT_02 (14) +#define CDSP_CMD_PARAM_RESULT_03 (15) +#define CDSP_CMD_PARAM_RESULT_NUM (4) +#define CDSP_CMD_PARAM_NUM \ + (CDSP_CMD_PARAM_ARGUMENT_NUM + CDSP_CMD_PARAM_RESULT_NUM) + +/* Command Completion */ +#define CDSP_CMD_HOST2OS_COMPLETION (0x80) +#define CDSP_CMD_OS2HOST_COMPLETION (0x80) + +/* Connect FIFO */ +#define CDSP_IN_SOURCE_DFIFO (0) +#define CDSP_IN_SOURCE_EFIFO (1) +#define CDSP_IN_SOURCE_OTHER_OUTBUF (2) +#define CDSP_IN_SOURCE_NONE (3) +#define CDSP_IN_SOURCE_DFIFO_EFIFO (4) +#define CDSP_OUT_DEST_OFIFO (0) +#define CDSP_OUT_DEST_RFIFO (1) +#define CDSP_OUT_DEST_OTHER_INBUF (2) +#define CDSP_OUT_DEST_NONE (3) +#define CDSP_OUT_DEST_OFIFO_RFIFO (4) + +#define CDSP_INPOS (1) +#define CDSP_OUTPOS (2) +#define CDSP_DFIFO_REMAIN (3) +#define CDSP_RFIFO_REMAIN (4) +#define CDSP_HW_ERROR_CODE (11) +#define CDSP_FUNC_A_ERROR_CODE (12) +#define CDSP_FUNC_B_ERROR_CODE (13) +#define CDSP_FUNC_A_VERSION (14) +#define CDSP_FUNC_B_VERSION (15) +#define CDSP_FUNC_A_HOST_COMMAND (21) +#define CDSP_FUNC_B_HOST_COMMAND (22) + +#define CDSP_FIFO_SEL_PORT (0) +#define CDSP_FIFO_SEL_HOST (1) + +/* Enum */ + +enum MC_PLAYER_ID { + eMC_PLAYER_CODER_A, + eMC_PLAYER_CODER_B +}; + +enum MC_INOUT_ID { + eMC_INPUT, + eMC_OUTPUT +}; + +enum MC_PLAYREC_ID { + eMC_PLAY, + eMC_REC +}; + +/* Struct */ + +struct MCDRV_CDSP_INIT { + UINT8 bJtag; +}; + +struct MC_CODER_FIRMWARE { + const UINT8 *pbFirmware; + UINT32 dSize; + UINT8 bResFlag; +}; + +struct MC_CODER_PARAMS { + UINT8 bCommandId; + UINT8 abParam[16]; +}; + +struct MC_CODER_VERSION { + UINT32 dID; + UINT16 wProgVerH; + UINT16 wProgVerM; + UINT16 wProgVerL; + UINT16 wOsVerH; + UINT16 wOsVerM; + UINT16 wOsVerL; +}; + +#if defined(__cplusplus) +extern "C" { +#endif + +SINT32 McCdsp_Init(struct MCDRV_CDSP_INIT *psPrm); +SINT32 McCdsp_Term(void); +void McCdsp_IrqProc(void); +SINT32 McCdsp_SetCBFunc(enum MC_PLAYER_ID ePlayerId, + SINT32 (*pcbfunc)(SINT32, UINT32, UINT32)); +SINT32 McCdsp_GetDSP(UINT32 dTarget, void *pvData, UINT32 dSize); +SINT32 McCdsp_SetDSPCheck(struct MCDRV_AEC_INFO *pbPrm); +SINT32 McCdsp_SetDSP(struct MCDRV_AEC_INFO *pbPrm); +SINT32 McCdsp_SetFs(enum MC_PLAYER_ID ePlayerId, UINT8 bFs); +SINT32 McCdsp_SetDFifoSel(UINT8 bSel); +SINT32 McCdsp_SetRFifoSel(UINT8 bSel); +SINT32 McCdsp_Start(enum MC_PLAYER_ID ePlayerId); +SINT32 McCdsp_Stop(enum MC_PLAYER_ID ePlayerId); +SINT32 McCdsp_GetParam(enum MC_PLAYER_ID ePlayerId, + struct MC_CODER_PARAMS *psParam); +SINT32 McCdsp_SetParam(enum MC_PLAYER_ID ePlayerId, + struct MC_CODER_PARAMS *psParam); + +SINT32 McCdsp_ReadData(UINT8 *pbBuffer, UINT32 dSize); +SINT32 McCdsp_WriteData(const UINT8 *pbBuffer, UINT32 dSize); +#if defined(__cplusplus) +} +#endif + +#endif /* _MCCDSPDRV_H_ */ diff --git a/sound/soc/codecs/ymu831/mccdspos.h b/sound/soc/codecs/ymu831/mccdspos.h new file mode 100644 index 00000000000..9a7032de5dc --- /dev/null +++ b/sound/soc/codecs/ymu831/mccdspos.h @@ -0,0 +1,3430 @@ +/**************************************************************************** + * + * Copyright (c) 2012 Yamaha Corporation + * + * Module : mccdspos.h + * + * Description : C-DSP Operating System + * + * Version : 1.0.0 2012.12.13 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + * + ****************************************************************************/ + +static const unsigned char gabCdspOs[] = { + 0xE3, 0x33, /* wProgramSize */ + 0x2C, 0x01, /* wDataSize */ +/* abProgram */ + 0x2D, 0x61, 0xAA, 0xAE, 0x2D, 0x61, 0x2D, 0x61, + 0x2D, 0x61, 0x2D, 0x61, 0x2D, 0x61, 0x2D, 0x61, + 0xF3, 0xAF, 0x2D, 0x61, 0x2D, 0x61, 0x2D, 0x61, + 0x2D, 0x61, 0x2D, 0x61, 0x2D, 0x61, 0x2D, 0x61, + 0xA7, 0xAE, 0x2D, 0x61, 0x2D, 0x61, 0x2D, 0x61, + 0x2D, 0x61, 0x2D, 0x61, 0x2D, 0x61, 0x2D, 0x61, + 0xF1, 0xC9, 0x20, 0x83, 0x2D, 0x93, 0xB4, 0xAC, + 0x2D, 0x61, 0x2D, 0x61, 0x2D, 0x61, 0x2D, 0x61, + 0xF1, 0xC9, 0x21, 0x83, 0x2D, 0x93, 0xBC, 0xAC, + 0x2D, 0x61, 0x2D, 0x61, 0x2D, 0x61, 0x2D, 0x61, + 0xF1, 0xC9, 0x26, 0x83, 0x2D, 0x93, 0xA4, 0xAC, + 0x2D, 0x61, 0x2D, 0x61, 0x2D, 0x61, 0x2D,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0xDD, 0x17, + 0x0D, 0x15, 0x2D, 0x61, 0x0F, 0xBE, 0xDD, 0x17, + 0x1D, 0x15, 0x2D, 0x61, 0x0D, 0xBE, 0xDD, 0x17, + 0x6D, 0x15, 0x2D, 0x61, 0x33, 0xBE, 0xDD, 0x17, + 0x7D, 0x15, 0x2D, 0x61, 0x31, 0xBE, 0xDD, 0x17, + 0x4D, 0x15, 0x2D, 0x61, 0x37, 0xBE, 0x2D, 0x61, + 0x34, 0xBE, 0x2D, 0x61, 0x35, 0xBE, 0xDD, 0x17, + 0x3D, 0x15, 0xAD, 0x02, 0xAC, 0x03, 0xAD, 0x01, + 0xD2, 0xEE, 0xAC, 0x02, 0xAD, 0x02, 0xD4, 0x00, + 0xCD, 0x17, 0x2D, 0x06, 0x2C, 0x06, 0xAD, 0x14, + 0xDD, 0x17, 0x0D, 0xAE, 0x2D, 0x61, 0x2D, 0x61, + 0x2D, 0x61, 0x2D, 0x61, 0x2D, 0x61, 0x2D, 0x61, + 0x2D, 0x61, 0x2D, 0x61, 0x2D, 0x61, 0x2D, 0x61, + 0x2D, 0x61, 0x2D, 0x61, 0x2D, 0x61, 0x2D, 0x61, + 0x2D, 0x61, 0x2D, 0x61, 0x2D, 0x61, 0x2D, 0x61, + 0x2D, 0x61, 0x2D, 0x61, 0x2D, 0x61, 0x2D, 0x61, + 0x2D, 0x61, 0x2D, 0x61, 0x2D, 0x61, 0x2D, 0x61, + 0x2D, 0x61, 0x2D, 0x61, 0x2D, 0x61, 0x2D, 0x61, + 0x2D, 0x61, 0x2F, 0x11, 0xAD, 0x02, 0xAC, 0x03, + 0xAD, 0x01, 0xD2, 0xEE, 0xAC, 0x02, 0xAD, 0x02, + 0x2C, 0x11, 0xE2, 0x61, 0xB0, 0x03, 0x2F, 0x11, + 0x7D, 0x0F, 0x3E, 0xEE, 0x2D, 0x98, 0x74, 0x88, + 0x49, 0xCE, 0x2D, 0x98, 0x6C, 0x88, 0x49, 0xCE, + 0x2D, 0x98, 0x60, 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, 0x0E, + 0xAD, 0x14, 0xCC, 0x14, 0x2F, 0x14, 0x01, 0xDA, + 0x31, 0xDB, 0x21, 0xD8, 0xF1, 0xD9, 0x2F, 0x11, + 0x39, 0x17, 0x61, 0xC0, 0x09, 0x16, 0x6D, 0x0F, + 0x2F, 0xEC, 0x02, 0x02, 0x3F, 0x8B, 0xE1, 0x83, + 0x25, 0x9B, 0x1E, 0x93, 0x6D, 0x08, 0x68, 0xCE, + 0xFD, 0x09, 0x7D, 0x08, 0x71, 0xCF, 0x71, 0xDF, + 0x7D, 0x0F, 0x2E, 0xEE, 0x71, 0xDF, 0x7D, 0x09, + 0xED, 0x83, 0x2E, 0x93, 0x08, 0xBE, 0x99, 0x83, + 0x2E, 0x93, 0xFD, 0x09, 0x61, 0xDC, 0xEF, 0x0E, + 0x29, 0x15, 0x2D, 0x61, 0x39, 0x17, 0x93, 0x83, + 0x2E, 0x93, 0x61, 0xC1, 0x33, 0xBE, 0xB3, 0x83, + 0x2E, 0x93, 0xFD, 0x09, 0xB1, 0x83, 0x2E, 0x93, + 0x27, 0xBE, 0x7D, 0x83, 0x2B, 0x93, 0xFD, 0x09, + 0x97, 0x83, 0x1E, 0x93, 0xFD, 0x09, 0xFB, 0x83, + 0x1E, 0x93, 0xFD, 0x09, 0x3F, 0x8B, 0x17, 0x83, + 0x25, 0x9B, 0x2F, 0x93, 0x6C, 0x08, 0x68, 0xCE, + 0x7C, 0xB1, 0x61, 0xDF, 0xEC, 0x0E, 0x29, 0x15, + 0x2C, 0x11, 0xE2, 0x61, 0xDA, 0x03, 0x21, 0x8A, + 0x00, 0x03, 0xD5, 0x9A, 0x79, 0xDE, 0x73, 0x05, + 0x25, 0xEE, 0xDF, 0x8B, 0x2D, 0x9B, 0x79, 0xCA, + 0x2D, 0x8B, 0x6D, 0x9B, 0x79, 0xCE, 0xD2, 0x03, + 0xD4, 0x8B, 0xAA, 0x9B, 0x79, 0xCE, 0x39, 0x8A, + 0x7C, 0x08, 0x79, 0xCE,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, + 0x2D, 0x96, 0x75, 0xD7, 0xE9, 0x83, 0x72, 0x0E, + 0x29, 0x93, 0x68, 0x12, 0x6E, 0x0C, 0x49, 0x12, + 0x48, 0x2E, 0x49, 0x0E, 0xA4, 0x8B, 0x2D, 0x9B, + 0x68, 0x2E, 0xA5, 0x8B, 0x2A, 0x9B, 0x48, 0x2E, + 0x7B, 0xDE, 0x41, 0x0E, 0x7D, 0x06, 0x6B, 0xCC, + 0x6B, 0x12, 0x49, 0x0E, 0x59, 0x12, 0x7B, 0xCE, + 0x7D, 0xBE, 0x6A, 0xDC, 0x69, 0xDE, 0x6C, 0x05, + 0x28, 0xEE, 0xF9, 0x83, 0x6A, 0x12, 0x29, 0x93, + 0x79, 0xBE, 0xB2, 0x0E, 0xF8, 0xED, 0xF3, 0xA1, + 0x0E, 0x8A, 0x22, 0x83, 0x25, 0x9A, 0x2D, 0x93, + 0x69, 0xDE, 0x6D, 0x0F, 0x2F, 0xEF, 0xD2, 0x03, + 0xD2, 0x8B, 0x4D, 0x08, 0x2D, 0x9B, 0x79, 0x26, + 0x2F, 0xEE, 0x29, 0xAE, 0x25, 0x88, 0x65, 0x0D, + 0x2D, 0x98, 0x70, 0x12, 0x79, 0x26, 0x28, 0xEF, + 0x79, 0x12, 0x49, 0x0E, 0x79, 0x0D, 0x70, 0x26, + 0xD2, 0x8A, 0xD2, 0x9A, 0x79, 0x2E, 0x68, 0xDE, + 0x49, 0x2E, 0x4C, 0x0C, 0x09, 0x8A, 0x25, 0x9A, + 0x49, 0x2E, 0x6B, 0xDE, 0x2C, 0x11, 0xE2, 0x61, + 0x2D, 0x88, 0x51, 0xC1, 0xD2, 0x98, 0xA1, 0xC5, + 0x79, 0xDD, 0x09, 0x86, 0x25, 0x96, 0x58, 0x12, + 0x7B, 0x26, 0x55, 0x0D, 0x7D, 0x07, 0x4A, 0x12, + 0x4C, 0x0C, 0x79, 0xCD, 0x45, 0x2E, 0x7C, 0x08, + 0x7A, 0x2C, 0x0E, 0x86,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, 0xB1, 0xDD, + 0xEE, 0x0E, 0x51, 0xDF, 0xEC, 0x0E, 0x28, 0x15, + 0x69, 0x0E, 0x74, 0x08, 0x49, 0xDE, 0x61, 0x0E, + 0x48, 0x26, 0x79, 0xDC, 0x78, 0xDD, 0x69, 0x0E, + 0x75, 0x0C, 0x49, 0xC7, 0x4D, 0x08, 0x49, 0xCE, + 0x66, 0x0E, 0x79, 0xCD, 0x2C, 0x11, 0xE2, 0x61, + 0x38, 0x17, 0x51, 0xC1, 0x79, 0x83, 0xB1, 0xC1, + 0x29, 0x93, 0x71, 0xC1, 0x49, 0xDC, 0x48, 0x0E, + 0x6A, 0x0E, 0x7B, 0xD1, 0x5B, 0xDE, 0x72, 0x0E, + 0x41, 0x0E, 0x7A, 0x2E, 0x5B, 0xDF, 0x58, 0xC1, + 0x63, 0x89, 0x25, 0x99, 0x58, 0xC1, 0x4B, 0xDC, + 0x48, 0xCE, 0x79, 0xC0, 0xAD, 0x8B, 0x2F, 0x9B, + 0x79, 0xCD, 0x66, 0x0E, 0x9E, 0xB1, 0x71, 0xDF, + 0xB1, 0xDC, 0x51, 0xDD, 0xEE, 0x0E, 0x28, 0x15, + 0x39, 0x17, 0x51, 0xC1, 0x69, 0x89, 0x61, 0xC1, + 0x25, 0x99, 0xA9, 0x83, 0x6A, 0xDE, 0x29, 0x93, + 0xE9, 0xB1, 0x6A, 0xDE, 0xE9, 0x83, 0x29, 0x93, + 0xCF, 0xB1, 0x4A, 0xDE, 0x49, 0x0E, 0x7B, 0xDE, + 0x41, 0x0E, 0x7D, 0x05, 0x25, 0xEE, 0x7D, 0x06, + 0x6B, 0x12, 0x49, 0x0E, 0xF9, 0x83, 0x29, 0x93, + 0x7B, 0xCE, 0xFD, 0x09, 0x17, 0x83, 0x2F, 0x93, + 0xB8, 0xB0, 0x61, 0xDF, 0x51, 0xDC, 0xEF, 0x0E, + 0x29, 0x15, 0xE2, 0x61, 0x6C, 0x0C, 0x51, 0xC1, + 0x09, 0x8B, 0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12, 0x70, 0x08, + 0xCD, 0x09, 0x2B, 0x0E, 0x05, 0x83, 0x2D, 0xDE, + 0x33, 0x93, 0x7D, 0xDE, 0x64, 0x12, 0xFD, 0x09, + 0x5D, 0x05, 0x23, 0xEE, 0x09, 0x8F, 0x73, 0x08, + 0x65, 0x12, 0x2D, 0x9F, 0xCD, 0x09, 0x26, 0xDE, + 0x2C, 0x2F, 0x2A, 0xEE, 0xB1, 0x83, 0x7D, 0x12, + 0x30, 0x93, 0x64, 0x12, 0x22, 0xB1, 0x2D, 0x08, + 0x59, 0x05, 0x08, 0xEE, 0xBD, 0x0F, 0x34, 0x12, + 0x2F, 0xEE, 0x3C, 0x08, 0xEF, 0x83, 0x6C, 0x12, + 0x2E, 0x93, 0xFD, 0x09, 0x72, 0x88, 0x9E, 0x8B, + 0x2B, 0x98, 0x2B, 0x9B, 0x74, 0x2E, 0x44, 0x2E, + 0x8B, 0xDE, 0x6D, 0x08, 0x6B, 0xCE, 0x98, 0xDE, + 0x68, 0xCE, 0xC2, 0x8B, 0x65, 0x12, 0xD2, 0x9B, + 0xCD, 0x09, 0xFF, 0x83, 0x6C, 0x12, 0x2E, 0x93, + 0xFD, 0x09, 0x86, 0x2F, 0x2F, 0xEA, 0x20, 0xAE, + 0xCD, 0x83, 0x64, 0x12, 0x06, 0x93, 0x3D, 0x08, + 0x33, 0xB8, 0x3B, 0xAE, 0x5A, 0x05, 0x21, 0xEE, + 0x52, 0x8B, 0x65, 0x12, 0xD2, 0x9B, 0xCD, 0x09, + 0x27, 0x83, 0x7D, 0x08, 0x03, 0x93, 0x64, 0x12, + 0x3D, 0x08, 0xFD, 0x09, 0x24, 0xAE, 0x58, 0x05, + 0x01, 0xEE, 0x7D, 0x08, 0x64, 0x12, 0x8D, 0x09, + 0x6D, 0x0F, 0x03, 0xEF, 0x3C, 0x08, 0x5F, 0x05, + 0x2A, 0xEE, 0x65, 0x12, 0x76, 0x08, 0xCD, 0x09, + 0x64, 0x12, 0x2D, 0x61, 0x84, 0xB1, 0x5E, 0x05, + 0x2A, 0xEE, 0xDA, 0x8B, 0x65, 0x12, 0xD2, 0x9B, + 0xCD, 0x09, 0x64, 0x12, 0xAA, 0xB1, 0x09, 0x8B, + 0x2D, 0x9B, 0x28, 0x2F, 0x28, 0xEF, 0xB1, 0x83, + 0x64, 0x12, 0x30, 0x93, 0xC8, 0xB0, 0x7C, 0x08, + 0x6C, 0x12, 0x71, 0x2E, 0x28, 0xD7, 0xC8, 0xD6, + 0x3D, 0x15, 0x88, 0xD6, 0xA8, 0xD6, 0x58, 0xD7, + 0x28, 0xD6, 0x72, 0x0E, 0xE8, 0x12, 0x2C, 0x11, + 0x5B, 0x05, 0x27, 0xEE, 0x7C, 0x08, 0x64, 0x12, + 0xC5, 0xB8, 0x6D, 0x0F, 0xF9, 0xEE, 0xB2, 0x8B, + 0x65, 0x12, 0xD2, 0x9B, 0xCD, 0x09, 0x3D, 0x08, + 0xE2, 0xA1, 0x2D, 0x61, 0x3D, 0x17, 0x51, 0xC1, + 0x7B, 0x83, 0xB1, 0xC1, 0x24, 0x93, 0x21, 0xC1, + 0xE3, 0x0E, 0x2D, 0x08, 0x31, 0x12, 0x3F, 0x0E, + 0xFD, 0x09, 0x21, 0xCC, 0x45, 0x83, 0x31, 0xCF, + 0x27, 0x93, 0xD2, 0x8B, 0x2D, 0x9B, 0x6E, 0x08, + 0x4C, 0x08, 0xFD, 0x09, 0x6D, 0x0F, 0x2A, 0xEE, + 0x69, 0x83, 0x6E, 0x08, 0x27, 0x93, 0x7D, 0x08, + 0xFD, 0x09, 0xDC, 0xA1, 0x05, 0x83, 0x21, 0x93, + 0xFD, 0x09, 0x71, 0xDC, 0x6C, 0x08, 0x2D, 0x61, + 0xB3, 0xB1, 0x17, 0x83, 0x29, 0x12, 0x21, 0x93, + 0xFD, 0x09, 0x81, 0x83, 0x6D, 0x08, 0x26, 0x93, + 0xFD, 0x09, 0x2C, 0x0F, 0xCD, 0xEF, 0x93, 0x83, + 0x6C, 0x08, 0x25, 0x93, 0xFD, 0x09, 0xF6, 0xA1, + 0x3D, 0x17, 0x51, 0xC1, 0x7B, 0x83, 0xB1, 0xC1, + 0x24, 0x93, 0x21, 0xC1, 0xE3, 0x0E, 0x2D, 0x08, + 0x31, 0x12, 0x3F, 0x0E, 0xFD, 0x09, 0x21, 0xCC, + 0x45, 0x83, 0x31, 0xCF, 0x27, 0x93, 0xD2, 0x8B, + 0x2D, 0x9B, 0x6F, 0x08, 0x4C, 0x08, 0xFD, 0x09, + 0x6D, 0x0F, 0x2A, 0xEE, 0x69, 0x83, 0x6F, 0x08, + 0x27, 0x93, 0x7D, 0x08, 0xFD, 0x09, 0xDC, 0xA1, + 0x05, 0x83, 0x21, 0x93, 0xFD, 0x09, 0x71, 0xDC, + 0x6D, 0x08, 0x2D, 0x61, 0xA8, 0xB1, 0x17, 0x83, + 0x29, 0x12, 0x21, 0x93, 0xFD, 0x09, 0x81, 0x83, + 0x6D, 0x08, 0x26, 0x93, 0xFD, 0x09, 0x2C, 0x0F, + 0xCD, 0xEF, 0x93, 0x83, 0x6C, 0x08, 0x25, 0x93, + 0xFD, 0x09, 0xF6, 0xA1, 0x7B, 0x83, 0x21, 0xC5, + 0x24, 0x93, 0x01, 0xC5, 0x35, 0x8F, 0x51, 0xC1, + 0x4F, 0x89, 0xA1, 0xC5, 0x69, 0x87, 0x81, 0xC5, + 0x3D, 0x17, 0xC1, 0xC5, 0x87, 0x81, 0x21, 0xC1, + 0xE3, 0x0E, 0x27, 0x80, 0xA1, 0x12, 0x27, 0x97, + 0xAF, 0x0E, 0x24, 0x91, 0x2D, 0x90, 0xFD, 0x09, + 0xD5, 0x9F, 0x2B, 0x99, 0x26, 0x8C, 0x0D, 0x8E, + 0x2D, 0x9E, 0xF2, 0x8D, 0x7D, 0x12, 0x2D, 0x9C, + 0x6F, 0x12, 0xD2, 0x9D, 0xDD, 0x09, 0x7D, 0x12, + 0x21, 0x8E, 0x2D, 0x9E, 0x6D, 0x12, 0xDD, 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9C, 0x22, 0x8B, 0x1F, 0x42, 0x2B, 0x9A, + 0x09, 0x2E, 0x7F, 0x2E, 0x08, 0xDE, 0x0D, 0x0F, + 0x22, 0xEF, 0x6D, 0xDE, 0xEB, 0x83, 0x1F, 0x93, + 0x7D, 0x12, 0xFD, 0x09, 0x6D, 0x0F, 0x79, 0x12, + 0x2A, 0xEE, 0x6D, 0xDE, 0xDD, 0x09, 0x29, 0xAE, + 0x7D, 0x08, 0x63, 0x12, 0xBD, 0x09, 0x17, 0x83, + 0x21, 0x93, 0xFD, 0x09, 0x81, 0x83, 0x6D, 0x08, + 0x26, 0x93, 0xFD, 0x09, 0x51, 0xA1, 0x2D, 0x61, + 0x7B, 0x83, 0x21, 0xC5, 0x24, 0x93, 0x01, 0xC5, + 0x3D, 0x17, 0x51, 0xC1, 0xA1, 0xC5, 0xFF, 0x87, + 0x81, 0xC5, 0x69, 0x85, 0xC1, 0xC5, 0x87, 0x81, + 0x21, 0xC1, 0xE3, 0x0E, 0x24, 0x80, 0x81, 0x12, + 0x27, 0x95, 0x8F, 0x0E, 0x24, 0x91, 0x2D, 0x90, + 0xFD, 0x09, 0x28, 0x97, 0x3D, 0x8D, 0x26, 0x8C, + 0x21, 0x8F, 0xC2, 0x8E, 0x2D, 0x9D, 0x2D, 0x9C, + 0x6F, 0x12, 0x7E, 0x12, 0x2D, 0x9F, 0xDD, 0x09, + 0x7E, 0x12, 0x6C, 0x12, 0xD2, 0x9E, 0xDD, 0x09, + 0x45, 0x83, 0x81, 0xCF, 0x74, 0xDE, 0x27, 0x93, + 0x63, 0x12, 0x4D, 0x08, 0xFD, 0x09, 0x59, 0x12, + 0x7D, 0x12, 0x6F, 0x12, 0x9D, 0x09, 0x7D, 0x12, + 0x6C, 0x12, 0x9D, 0x09, 0x5D, 0x0F, 0x28, 0xEE, + 0x63, 0x12, 0x7D, 0x08, 0x9D, 0x09, 0xF2, 0xA1, + 0x05, 0x83, 0x9C, 0x8E, 0x28, 0x9E, 0x21, 0x93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 0x7D, 0x08, 0x6A, 0x08, 0x3D, 0x09, + 0x17, 0x83, 0x21, 0x93, 0xFD, 0x09, 0x81, 0x83, + 0x6D, 0x08, 0x26, 0x93, 0xFD, 0x09, 0x1C, 0xA1, + 0x7B, 0x83, 0x21, 0xC5, 0x3D, 0x17, 0x01, 0xC5, + 0x24, 0x93, 0x51, 0xC1, 0xA1, 0xC5, 0x81, 0xC5, + 0xBD, 0x85, 0xC1, 0xC5, 0x9F, 0x84, 0x21, 0xC1, + 0xE3, 0x0E, 0x3B, 0x8E, 0xD1, 0x12, 0x28, 0x95, + 0xDF, 0x0E, 0xD5, 0x9E, 0xC6, 0x12, 0xFD, 0x09, + 0x2B, 0x94, 0x87, 0x8F, 0x26, 0x89, 0x24, 0x9F, + 0x21, 0x8D, 0x69, 0x8C, 0x2D, 0x99, 0x6A, 0x12, + 0x7F, 0x08, 0x2D, 0x9D, 0x3D, 0x09, 0x6E, 0x12, + 0x7F, 0x08, 0x27, 0x9C, 0x3D, 0x09, 0x45, 0x83, + 0xD1, 0xCF, 0x77, 0xDE, 0x27, 0x93, 0x6B, 0x08, + 0x4D, 0x08, 0xFD, 0x09, 0x39, 0x12, 0x70, 0x08, + 0x6A, 0x12, 0x0D, 0x09, 0x70, 0x08, 0x6E, 0x12, + 0x0D, 0x09, 0x3D, 0x0F, 0x28, 0xEE, 0x6B, 0x08, + 0x7D, 0x08, 0x0D, 0x09, 0xF2, 0xA1, 0x05, 0x83, + 0x21, 0x93, 0xFD, 0x09, 0x36, 0xDE, 0x9A, 0x0E, + 0xB6, 0xDD, 0xBD, 0x0F, 0x93, 0x12, 0x21, 0xEF, + 0x7D, 0x08, 0x6B, 0x08, 0x0D, 0x09, 0x17, 0x83, + 0x21, 0x93, 0xFD, 0x09, 0x81, 0x83, 0x6D, 0x08, + 0x26, 0x93, 0xFD, 0x09, 0xE6, 0xA1, 0x3F, 0x0F, + 0x2F, 0xE7, 0xDE, 0xA1, 0x0B, 0x8D, 0xBB, 0x83, +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 0x86, 0x5F, 0x07, 0x2D, 0x96, 0xC4, 0xA1, + 0x68, 0x0F, 0x24, 0xEE, 0x27, 0x8B, 0x2D, 0x9B, + 0x79, 0x2F, 0x2A, 0xED, 0x51, 0x0C, 0x39, 0xAE, + 0x5B, 0x0C, 0x3F, 0xAE, 0x54, 0x0C, 0x3D, 0xAE, + 0xB0, 0x02, 0x2D, 0x08, 0x21, 0x83, 0x21, 0x8F, + 0xD5, 0x9F, 0x21, 0x93, 0xFD, 0x09, 0x2C, 0xCE, + 0x39, 0x8F, 0x2C, 0xCE, 0x25, 0x8E, 0xD5, 0x9E, + 0xAD, 0xCE, 0xD2, 0x03, 0xD2, 0xA1, 0x5D, 0x0F, + 0x28, 0xEE, 0x27, 0x83, 0x7A, 0x12, 0x24, 0x93, + 0xFD, 0x09, 0xB0, 0x02, 0x7F, 0x08, 0x71, 0x2E, + 0x68, 0xD7, 0xA8, 0xD6, 0x58, 0xDE, 0xE8, 0x0E, + 0x29, 0x15, 0x2D, 0x61, 0x39, 0x17, 0x51, 0xC1, + 0x2D, 0x89, 0xA1, 0xC5, 0x2C, 0x99, 0x81, 0xC5, + 0xDB, 0x85, 0x61, 0xC1, 0x34, 0x8A, 0x24, 0x95, + 0xD5, 0x9A, 0x49, 0xDE, 0x69, 0xD9, 0x69, 0x05, + 0x28, 0xEF, 0x7D, 0x08, 0x6D, 0x05, 0x2A, 0xEF, + 0x27, 0xAE, 0x49, 0x05, 0xD6, 0xEE, 0x69, 0x06, + 0x7A, 0x12, 0xD4, 0xA1, 0x4D, 0x05, 0x2E, 0xEE, + 0x6D, 0x06, 0x75, 0x07, 0x68, 0x05, 0x28, 0xEF, + 0x2D, 0x99, 0x6C, 0x05, 0x2B, 0xEF, 0x24, 0xAE, + 0x48, 0x05, 0xD6, 0xEE, 0x68, 0x06, 0xD7, 0xA1, + 0x4C, 0x05, 0x2E, 0xEE, 0x6C, 0x06, 0x55, 0x07, + 0x65, 0x05, 0x25, 0xEF, 0xAD, 0x08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+ 0xB1, 0xCF, 0x54, 0xDC, 0x6A, 0x0E, 0x69, 0xDE, + 0x4D, 0x08, 0x75, 0x12, 0x5D, 0x09, 0x43, 0x83, + 0x02, 0x93, 0xFD, 0x09, 0x2F, 0x83, 0x65, 0x12, + 0x1F, 0x93, 0x4E, 0x08, 0x7D, 0x08, 0xFD, 0x09, + 0xAA, 0x0E, 0x6D, 0x08, 0x65, 0xCE, 0x7F, 0x08, + 0x71, 0x2E, 0x68, 0xD7, 0xC8, 0xD6, 0x88, 0xD6, + 0xA8, 0xD6, 0x58, 0xDE, 0xE8, 0x12, 0x29, 0x15, + 0x38, 0x17, 0x51, 0xC1, 0x12, 0x89, 0xB1, 0xC1, + 0x2D, 0x99, 0x71, 0xC1, 0x59, 0x2E, 0x4E, 0x08, + 0x79, 0x12, 0x6A, 0xDE, 0x49, 0x26, 0x2F, 0xEF, + 0x0E, 0xAE, 0x7C, 0x88, 0x6D, 0x05, 0xD5, 0x98, + 0x4B, 0xDE, 0x25, 0xEE, 0x5C, 0x0E, 0xB5, 0x08, + 0xBB, 0x26, 0x4A, 0xDE, 0x5A, 0x08, 0x4A, 0x26, + 0x44, 0x27, 0x6C, 0x05, 0x27, 0xEE, 0x49, 0x06, + 0x6D, 0x8A, 0x2D, 0x9A, 0x3D, 0x89, 0x68, 0x2E, + 0x2D, 0x99, 0x69, 0xDE, 0x6A, 0x26, 0x49, 0x27, + 0x12, 0x8A, 0x2F, 0x83, 0x2D, 0x9A, 0x1F, 0x93, + 0x68, 0x2E, 0x7C, 0x8B, 0xD5, 0x9B, 0x48, 0xCE, + 0x4F, 0x08, 0x7D, 0x08, 0x87, 0xBB, 0x61, 0xDF, + 0xB1, 0xDC, 0x51, 0xDD, 0xEE, 0x0E, 0x29, 0x15, + 0x09, 0x83, 0x21, 0xC5, 0x3D, 0x17, 0x51, 0xC1, + 0x1E, 0x89, 0xA1, 0xC5, 0xBB, 0x12, 0x81, 0xC5, + 0x22, 0x84, 0x21, 0xC0, 0x3F,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83, + 0x11, 0xD2, 0xBE, 0x2E, 0xF6, 0x12, 0xC1, 0xD2, + 0x13, 0xD7, 0x7E, 0x12, 0xC1, 0xC2, 0x6E, 0xDE, + 0xFE, 0xBD, 0x6D, 0x0F, 0x29, 0xEE, 0x79, 0x12, + 0x6E, 0xDE, 0xAD, 0x09, 0xFA, 0x12, 0xC1, 0xD2, + 0x13, 0xD7, 0x7E, 0x12, 0xC1, 0xC2, 0x6E, 0xDF, + 0xCE, 0xBD, 0x6D, 0x0F, 0x79, 0x12, 0x2E, 0xEE, + 0x6E, 0xDF, 0xAD, 0x09, 0xB2, 0x0E, 0xCA, 0xEC, + 0x35, 0x8B, 0x6F, 0x12, 0x2D, 0x9B, 0x71, 0x2E, + 0x28, 0xD7, 0xC8, 0xD6, 0x3D, 0x15, 0x88, 0xD6, + 0xA8, 0xD6, 0x58, 0xD7, 0x08, 0xD6, 0x28, 0xD6, + 0x72, 0x0E, 0xE8, 0x12, 0x2C, 0x11, 0x2D, 0x61, + 0x3D, 0x17, 0x51, 0xC1, 0x7B, 0x83, 0xA1, 0xC5, + 0x24, 0x93, 0x21, 0xC1, 0xE3, 0x0E, 0x69, 0x8E, + 0x21, 0x8F, 0xF8, 0x89, 0x11, 0x12, 0x27, 0x9E, + 0x1F, 0x0E, 0x2D, 0x9F, 0x28, 0x99, 0xFD, 0x09, + 0x87, 0x83, 0x6C, 0x12, 0x24, 0x93, 0x7C, 0x08, + 0xFD, 0x09, 0x45, 0x83, 0x11, 0xCF, 0x7A, 0xDE, + 0x27, 0x93, 0x68, 0x08, 0x4D, 0x08, 0xFD, 0x09, + 0x09, 0x12, 0x73, 0x08, 0x6C, 0x12, 0x2D, 0x09, + 0x0D, 0x0F, 0x28, 0xEE, 0x68, 0x08, 0x7D, 0x08, + 0x2D, 0x09, 0xC6, 0xA1, 0x05, 0x83, 0x21, 0x93, + 0xFD, 0x09, 0x6C, 0x08, 0x98, 0xB0, 0x17, 0x83, + 0x09, 0x12, 0x21, 0x93, 0xFD, 0x09, 0x81, 0x83, + 0x6D, 0x08, 0x26, 0x93, 0xFD, 0x09, 0x0C, 0x0F, + 0xF1, 0xEF, 0x93, 0x83, 0x6C, 0x08, 0x25, 0x93, + 0xFD, 0x09, 0xFA, 0xA1, 0x3D, 0x17, 0x51, 0xC1, + 0x7B, 0x83, 0xA1, 0xC5, 0x24, 0x93, 0x21, 0xC1, + 0xE3, 0x0E, 0x69, 0x8E, 0x26, 0x8F, 0xFE, 0x89, + 0x11, 0x12, 0x27, 0x9E, 0x1F, 0x0E, 0x2D, 0x9F, + 0x28, 0x99, 0xFD, 0x09, 0x87, 0x83, 0x6C, 0x12, + 0x24, 0x93, 0x7C, 0x08, 0xFD, 0x09, 0x45, 0x83, + 0x11, 0xCF, 0x7A, 0xDE, 0x27, 0x93, 0x69, 0x08, + 0x4D, 0x08, 0xFD, 0x09, 0x09, 0x12, 0x73, 0x08, + 0x6C, 0x12, 0x2D, 0x09, 0x0D, 0x0F, 0x28, 0xEE, + 0x69, 0x08, 0x7D, 0x08, 0x2D, 0x09, 0xC6, 0xA1, + 0x05, 0x83, 0x21, 0x93, 0xFD, 0x09, 0x6D, 0x08, + 0xB5, 0xB0, 0x17, 0x83, 0x09, 0x12, 0x21, 0x93, + 0xFD, 0x09, 0x81, 0x83, 0x6D, 0x08, 0x26, 0x93, + 0xFD, 0x09, 0x0C, 0x0F, 0xF1, 0xEF, 0x93, 0x83, + 0x6C, 0x08, 0x25, 0x93, 0xFD, 0x09, 0xFA, 0xA1, + 0x21, 0xC5, 0x3D, 0x17, 0x51, 0xC1, 0x59, 0x12, + 0xA1, 0xC5, 0x69, 0x86, 0x81, 0xC5, 0x27, 0x96, + 0xC1, 0xC5, 0x98, 0x80, 0x21, 0xC1, 0x0B, 0x8E, + 0x21, 0x81, 0x2D, 0x9E, 0xE3, 0x0E, 0x6D, 0x4A, + 0x2B, 0x90, 0x2D, 0x91, 0x4E, 0x8A, 0x2B, 0x9A, + 0x29, 0x2E, 0x7D, 0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C1, 0xFD, 0x09, 0x72, 0x08, + 0x68, 0xDE, 0x6D, 0x05, 0x23, 0xEE, 0x74, 0x8A, + 0x2D, 0x9A, 0x68, 0xCE, 0x6C, 0x8A, 0x68, 0xCE, + 0x60, 0x8A, 0x68, 0xCE, 0x6C, 0x8A, 0x68, 0xCE, + 0x65, 0x8A, 0x68, 0xCE, 0x6C, 0x8A, 0x68, 0xCE, + 0x37, 0x83, 0x21, 0x93, 0xFD, 0x09, 0x6D, 0x08, + 0x3D, 0x8B, 0xD5, 0x9B, 0x68, 0xCE, 0x3C, 0x8B, + 0x68, 0xCE, 0x2C, 0x8A, 0x73, 0x08, 0x68, 0xCE, + 0x61, 0xDF, 0xEC, 0x0E, 0x29, 0x15, 0x2D, 0x61, + 0x6D, 0x6E, 0x3B, 0x17, 0xD3, 0x83, 0x41, 0xC1, + 0x43, 0x08, 0x26, 0x93, 0x6B, 0xCE, 0x68, 0xDE, + 0x3D, 0x88, 0xD5, 0x98, 0x6B, 0xCE, 0x68, 0xDF, + 0x3C, 0x8B, 0xD5, 0x9B, 0x68, 0xCE, 0xFD, 0x09, + 0x72, 0x08, 0x68, 0xDE, 0x6D, 0x05, 0x2E, 0xEF, + 0x6C, 0x08, 0x68, 0xCE, 0x37, 0x83, 0x21, 0x93, + 0xFD, 0x09, 0x61, 0xDF, 0xEC, 0x0E, 0x29, 0x15, + 0x38, 0x17, 0x51, 0xC1, 0x27, 0x89, 0xA1, 0xC5, + 0xA9, 0x12, 0x71, 0xC1, 0xBF, 0x8B, 0x03, 0x99, + 0x09, 0x9B, 0x79, 0x26, 0x25, 0xEF, 0x64, 0x8A, + 0xDF, 0x87, 0x3F, 0x9A, 0x2D, 0x97, 0x65, 0x26, + 0x2F, 0xEF, 0x2E, 0xAE, 0xDC, 0x87, 0x2D, 0x97, + 0x09, 0x8A, 0x64, 0x9A, 0x65, 0x26, 0x2F, 0xEE, + 0xDF, 0x87, 0xED, 0x8A, 0x2C, 0x9A, 0x65, 0x26, + 0x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08, + 0x29, 0x14, 0xC9, 0x14, 0x2C, 0x11, 0x2D, 0x61, + 0x05, 0x83, 0x51, 0xC1, 0x38, 0x17, 0x59, 0x12, + 0x21, 0x93, 0x71, 0xC1, 0xFD, 0x09, 0x2D, 0x61, + 0xDA, 0xB1, 0x7A, 0x12, 0x87, 0x83, 0x24, 0x93, + 0x6C, 0x08, 0xFD, 0x09, 0x63, 0x83, 0x25, 0x93, + 0xFD, 0x09, 0x61, 0xDF, 0x51, 0xDC, 0xEF, 0x0E, + 0x29, 0x15, 0x2D, 0x61, 0x38, 0x17, 0x51, 0xC1, + 0x59, 0x12, 0x71, 0xC1, 0x05, 0x83, 0x21, 0x93, + 0xFD, 0x09, 0x2D, 0x61, 0xC1, 0xB1, 0x7A, 0x12, + 0x87, 0x83, 0x24, 0x93, 0x6C, 0x08, 0xFD, 0x09, + 0x63, 0x83, 0x25, 0x93, 0xFD, 0x09, 0x61, 0xDF, + 0x51, 0xDC, 0xEF, 0x0E, 0x29, 0x15, 0x2D, 0x61, + 0x38, 0x17, 0x51, 0xC1, 0x59, 0x12, 0x71, 0xC1, + 0x05, 0x83, 0x21, 0x93, 0xFD, 0x09, 0x2D, 0x61, + 0xCC, 0xB1, 0x7A, 0x12, 0x87, 0x83, 0x24, 0x93, + 0x6C, 0x08, 0xFD, 0x09, 0x63, 0x83, 0x25, 0x93, + 0xFD, 0x09, 0x61, 0xDF, 0x51, 0xDC, 0xEF, 0x0E, + 0x29, 0x15, 0xE2, 0x61, 0x2E, 0x8A, 0x20, 0x8B, + 0xA9, 0x9A, 0xD5, 0x9B, 0x68, 0xCE, 0xB9, 0x02, + 0x09, 0x03, 0x2C, 0x11, 0x20, 0x8B, 0x6D, 0x08, + 0xD5, 0x9B, 0x68, 0xCE, 0x09, 0x02, 0xB9, 0x02, + 0x2C, 0x11, 0x2D, 0x61, 0x39, 0x17, 0x20, 0x8B, + 0xD5, 0x9B, 0x61, 0xC1, 0xE3, 0x0E, 0xBF, 0x83, + 0x68, 0xDE, 0x2A, 0x93, 0x68, 0xCE, 0xB9, 0x02, + 0x09, 0x03, 0xFD, 0x09, 0x6D, 0x0F, 0x23, 0xEC, + 0x95, 0x83, 0x61, 0xCC, 0x51, 0x8A, 0x1E, 0x93, + 0x2D, 0x9A, 0x12, 0x88, 0x2D, 0x98, 0x61, 0xCF, + 0x4F, 0x8B, 0x6D, 0x08, 0x2D, 0x9B, 0xFD, 0x09, + 0xD2, 0x03, 0x61, 0xDD, 0xEE, 0x0E, 0x29, 0x15, + 0x2C, 0x11, 0xE2, 0x61, 0x39, 0x17, 0xCD, 0x83, + 0x2E, 0x93, 0x61, 0xC1, 0xFD, 0x09, 0x53, 0x83, + 0x24, 0x93, 0xFD, 0x09, 0xE7, 0x83, 0x27, 0x93, + 0xFD, 0x09, 0x49, 0x83, 0x21, 0x93, 0xFD, 0x09, + 0x61, 0xDF, 0xEC, 0x0E, 0x29, 0x15, 0x2D, 0x61, + 0x39, 0x17, 0xBF, 0x83, 0x1E, 0x93, 0x61, 0xC1, + 0x6D, 0x08, 0xFD, 0x09, 0x61, 0xDF, 0xEC, 0x0E, + 0x29, 0x15, 0x2D, 0x61, 0x39, 0x17, 0xA7, 0x83, + 0x1E, 0x93, 0x61, 0xC1, 0x6D, 0x08, 0xFD, 0x09, + 0x23, 0x83, 0x6D, 0x08, 0x20, 0x93, 0xFD, 0x09, + 0x61, 0xDF, 0xEC, 0x0E, 0x29, 0x15, +/* abData */ + 0x2D, 0xAE, 0x2C, 0xAE, 0x2D, 0xAE, 0x2F, 0xAE, + 0x2D, 0xAE, 0x2C, 0xAE, 0x2D, 0xAE, 0x2E, 0xAE, + 0x2D, 0xAE, 0x2C, 0xAE, 0x2D, 0xAE, 0x2F, 0xAE, + 0x2D, 0xAE, 0x2C, 0xAE, 0x2D, 0xAE, 0x1D, 0x57, + 0x3D, 0x57, 0x0D, 0x57, 0x2D, 0x57, 0x7D, 0x57, + 0x2D, 0x52, 0x3D, 0x50, 0x0D, 0x50, 0x3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x2C, 0xAE, 0x2D, 0xAE, 0x15, 0x8B, + 0x20, 0xAE, 0x2D, 0xAE, 0x25, 0x8A, 0x2F, 0xAE, + 0x2D, 0xAE, 0xD5, 0x8A, 0x2E, 0xAE, 0x2D, 0xAE, + 0x57, 0x8A, 0x29, 0xAE, 0x2D, 0xAE, 0xB7, 0x9D, + 0x2D, 0xAE, 0x2D, 0x61, 0x4A, 0xEB, 0x0E, 0xAF, +}; diff --git a/sound/soc/codecs/ymu831/mcdebuglog.c b/sound/soc/codecs/ymu831/mcdebuglog.c new file mode 100644 index 00000000000..261662573b4 --- /dev/null +++ b/sound/soc/codecs/ymu831/mcdebuglog.c @@ -0,0 +1,1514 @@ +/**************************************************************************** + * + * Copyright(c) 2012 Yamaha Corporation. All rights reserved. + * + * Module : mcdebuglog.c + * + * Description : MC Driver debug log + * + * Version : 1.0.0 2012.12.13 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + * + ****************************************************************************/ + + +#include "mcdebuglog.h" +#include "mcresctrl.h" + +#if MCDRV_DEBUG_LEVEL + +#include "mcdefs.h" +#include "mcdevprof.h" +#include "mcservice.h" +#include "mcmachdep.h" + + + +#define CHAR char + +static CHAR gsbLogString[8192]; +static CHAR gsbLFCode[] = "\n"; + +static const CHAR gsbCmdName[][20] = { + "init", + "term", + "read_reg", + "write_reg", + "get_clocksw", + "set_clocksw", + "get_path", + "set_path", + "get_volume", + "set_volume", + "get_digitalio", + "set_digitalio", + "get_digitalio_path", + "set_digitalio_path", + "get_swap", + "set_swap", + "set_dsp", + "get_dsp", + "get_dsp_data", + "set_dsp_data", + "register_dsp_cb", + "get_dsp_transition", + "irq", + "get_hsdet", + "set_hsdet", + "config_gp", + "mask_gp", + "getset_gp" +}; + +static void OutputRegDump(void); +static void GetRegDump(CHAR *psbLogString, + UINT8 bSlaveAddr, + UINT8 bADRAddr, + UINT8 bWINDOWAddr, + UINT8 bRegType); + +static void MakeInitInfoLog(const struct MCDRV_INIT_INFO *pvPrm1); +static void MakeRegInfoLog(const struct MCDRV_REG_INFO *pvPrm1); +static void MakeClockSwInfoLog(const struct MCDRV_CLOCKSW_INFO *pvPrm1); +static void MakePathInfoLog(const struct MCDRV_PATH_INFO *pvPrm1); +static void MakeVolInfoLog(const struct MCDRV_VOL_INFO *pvPrm1); +static void MakeDIOInfoLog(const struct MCDRV_DIO_INFO *pvPrm1); +static void MakeDIOPathInfoLog(const struct MCDRV_DIOPATH_INFO *pvPrm1); +static void MakeSwapInfoLog(const struct MCDRV_SWAP_INFO *pvPrm1); +static void MakeDspLog(const UINT8 *pvPrm1, UINT32 dPrm); +static void MakeDspPrmLog(const struct MCDRV_DSP_PARAM *pvPrm1, + const void *pvPrm2, + UINT32 dPrm); +static void MakeHSDETInfoLog(const struct MCDRV_HSDET_INFO *pvPrm1); +static void MakeGPModeLog(const struct MCDRV_GP_MODE *pvPrm1); +static void MakeGPMaskLog(const UINT8 *pvPrm1); +static void MakeGetSetGPLog(const UINT8 *pvPrm1); + +/**************************************************************************** + * McDebugLog_CmdIn + * + * Description: + * Output Function entrance log. + * Arguments: + * dCmd Command ID + * pvPrm1 pointer to parameter + * pvPrm2 pointer to parameter + * dPrm parameter + * Return: + * none + * + ****************************************************************************/ +void McDebugLog_CmdIn( + UINT32 dCmd, + const void *pvPrm1, + const void *pvPrm2, + UINT32 dPrm +) +{ + CHAR sbStr[80]; + UINT8 bLevel = MCDRV_DEBUG_LEVEL; + + if (dCmd >= sizeof(gsbCmdName)/sizeof(gsbCmdName[0])) { + ; + return; + } + + strcpy(gsbLogString, gsbCmdName[dCmd]); + strcat(gsbLogString, " In"); + + if (bLevel < 2) { + strcat(gsbLogString, gsbLFCode); + machdep_DebugPrint((UINT8 *)(void *)gsbLogString); + return; + } + + switch (dCmd) { + case MCDRV_INIT: + MakeInitInfoLog((struct MCDRV_INIT_INFO *)pvPrm1); + break; + case MCDRV_READ_REG: + case MCDRV_WRITE_REG: + MakeRegInfoLog((struct MCDRV_REG_INFO *)pvPrm1); + break; + case MCDRV_SET_CLOCKSW: + MakeClockSwInfoLog((struct MCDRV_CLOCKSW_INFO *)pvPrm1); + break; + case MCDRV_SET_PATH: + MakePathInfoLog((struct MCDRV_PATH_INFO *)pvPrm1); + break; + case MCDRV_SET_VOLUME: + MakeVolInfoLog((struct MCDRV_VOL_INFO *)pvPrm1); + break; + case MCDRV_SET_DIGITALIO: + MakeDIOInfoLog((struct MCDRV_DIO_INFO *)pvPrm1); + sprintf(sbStr, " dPrm=%08lX", dPrm); + strcat(gsbLogString, sbStr); + break; + case MCDRV_SET_DIGITALIO_PATH: + MakeDIOPathInfoLog((struct MCDRV_DIOPATH_INFO *)pvPrm1); + sprintf(sbStr, " dPrm=%08lX", dPrm); + strcat(gsbLogString, sbStr); + break; + case MCDRV_SET_SWAP: + MakeSwapInfoLog((struct MCDRV_SWAP_INFO *)pvPrm1); + sprintf(sbStr, " dPrm=%08lX", dPrm); + strcat(gsbLogString, sbStr); + break; + case MCDRV_SET_DSP: + MakeDspLog((UINT8 *)pvPrm1, dPrm); + break; + case MCDRV_GET_DSP: + sprintf(sbStr, " dType=%08lX", + ((struct MCDRV_DSP_PARAM *)pvPrm1)->dType); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " dInfo=%08lX", + ((struct MCDRV_DSP_PARAM *)pvPrm1)->dInfo); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " pvPrm2=%p", pvPrm2); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " dPrm=%08lX", dPrm); + strcat(gsbLogString, sbStr); + break; + case MCDRV_GET_DSP_DATA: + sprintf(sbStr, " pvPrm1=%p", pvPrm2); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " dPrm=%08lX", dPrm); + strcat(gsbLogString, sbStr); + break; + case MCDRV_SET_DSP_DATA: + MakeDspLog((UINT8 *)pvPrm1, dPrm); + sprintf(sbStr, " dPrm=%08lX", dPrm); + strcat(gsbLogString, sbStr); + break; + case MCDRV_GET_DSP_TRANSITION: + sprintf(sbStr, " dPrm=%08lX", dPrm); + strcat(gsbLogString, sbStr); + break; + case MCDRV_REGISTER_DSP_CB: + sprintf(sbStr, " dPrm=%p", pvPrm1); + strcat(gsbLogString, sbStr); + break; + case MCDRV_SET_HSDET: + MakeHSDETInfoLog((struct MCDRV_HSDET_INFO *)pvPrm1); + sprintf(sbStr, " dPrm=%08lX", dPrm); + strcat(gsbLogString, sbStr); + break; + case MCDRV_CONFIG_GP: + MakeGPModeLog((struct MCDRV_GP_MODE *)pvPrm1); + break; + case MCDRV_MASK_GP: + MakeGPMaskLog((UINT8 *)pvPrm1); + sprintf(sbStr, " dPrm=%08lX", dPrm); + strcat(gsbLogString, sbStr); + break; + case MCDRV_GETSET_GP: + MakeGetSetGPLog((UINT8 *)pvPrm1); + sprintf(sbStr, " dPrm=%08lX", dPrm); + strcat(gsbLogString, sbStr); + break; + + default: + break; + } + + strcat(gsbLogString, gsbLFCode); + machdep_DebugPrint((UINT8 *)(void *)gsbLogString); +} + +/**************************************************************************** + * McDebugLog_CmdOut + * + * Description: + * Output Function exit log. + * Arguments: + * dCmd Command ID + * psdRet retrun value + * pvPrm1 pointer to parameter + * pvPrm2 pointer to parameter + * dPrm parameter + * Return: + * none + * + ****************************************************************************/ +void McDebugLog_CmdOut( + UINT32 dCmd, + const SINT32 *psdRet, + const void *pvPrm1, + const void *pvPrm2, + UINT32 dPrm +) +{ + CHAR sbStr[80]; + UINT8 bLevel = MCDRV_DEBUG_LEVEL; + + if (dCmd >= sizeof(gsbCmdName)/sizeof(gsbCmdName[0])) { + ; + return; + } + + strcpy(gsbLogString, gsbCmdName[dCmd]); + strcat(gsbLogString, " Out"); + if (psdRet != NULL) { + sprintf(sbStr, " ret=%ld", *psdRet); + strcat(gsbLogString, sbStr); + } + + if (bLevel < 2) { + strcat(gsbLogString, gsbLFCode); + machdep_DebugPrint((UINT8 *)(void *)gsbLogString); + return; + } + + switch (dCmd) { + case MCDRV_READ_REG: + MakeRegInfoLog((struct MCDRV_REG_INFO *)pvPrm1); + break; + case MCDRV_GET_CLOCKSW: + MakeClockSwInfoLog((struct MCDRV_CLOCKSW_INFO *)pvPrm1); + break; + case MCDRV_GET_PATH: + MakePathInfoLog((struct MCDRV_PATH_INFO *)pvPrm1); + break; + case MCDRV_GET_VOLUME: + MakeVolInfoLog((struct MCDRV_VOL_INFO *)pvPrm1); + break; + case MCDRV_GET_DIGITALIO: + MakeDIOInfoLog((struct MCDRV_DIO_INFO *)pvPrm1); + break; + case MCDRV_GET_DIGITALIO_PATH: + MakeDIOPathInfoLog((struct MCDRV_DIOPATH_INFO *)pvPrm1); + break; + case MCDRV_GET_SWAP: + MakeSwapInfoLog((struct MCDRV_SWAP_INFO *)pvPrm1); + break; + case MCDRV_GET_DSP: + MakeDspPrmLog((struct MCDRV_DSP_PARAM *)pvPrm1, pvPrm2, dPrm); + break; + case MCDRV_GET_DSP_DATA: + MakeDspLog((UINT8 *)pvPrm1, dPrm); + break; + case MCDRV_GET_HSDET: + MakeHSDETInfoLog((struct MCDRV_HSDET_INFO *)pvPrm1); + break; + case MCDRV_GETSET_GP: + MakeGetSetGPLog((UINT8 *)pvPrm1); + break; + + default: + break; + } + strcat(gsbLogString, gsbLFCode); + machdep_DebugPrint((UINT8 *)(void *)gsbLogString); + + if (bLevel < 3) { + ; + return; + } + + OutputRegDump(); +} + +/**************************************************************************** + * McDebugLog_FuncIn + * + * Description: + * Output Function entrance log. + * Arguments: + * pbFuncName function name + * Return: + * none + * + ****************************************************************************/ +void McDebugLog_FuncIn( + void *pvFuncName +) +{ + strcpy(gsbLogString, (CHAR *)pvFuncName); + strcat(gsbLogString, " In"); + + strcat(gsbLogString, gsbLFCode); + machdep_DebugPrint((UINT8 *)(void *)gsbLogString); +} + +/**************************************************************************** + * McDebugLog_FuncOut + * + * Description: + * Output Function exit log. + * Arguments: + * pbFuncName function name + * psdRet retrun value + * Return: + * none + * + ****************************************************************************/ +void McDebugLog_FuncOut( + void *pvFuncName, + const SINT32 *psdRet +) +{ + CHAR sbStr[80]; + + strcpy(gsbLogString, (CHAR *)pvFuncName); + strcat(gsbLogString, " Out"); + if (psdRet != NULL) { + sprintf(sbStr, " ret=%ld", *psdRet); + strcat(gsbLogString, sbStr); + } + + strcat(gsbLogString, gsbLFCode); + machdep_DebugPrint((UINT8 *)(void *)gsbLogString); +} + + +/**************************************************************************** + * OutputRegDump + * + * Description: + * Output Register dump. + * Arguments: + * none + * Return: + * none + * + ****************************************************************************/ +static void OutputRegDump +( + void +) +{ + UINT16 i; + CHAR sbStr[10]; + UINT8 bSlaveAddr_dig, bSlaveAddr_ana; + struct MCDRV_REG_INFO sRegInfo; + + bSlaveAddr_dig = McDevProf_GetSlaveAddr(eMCDRV_SLAVE_ADDR_DIG); + bSlaveAddr_ana = McDevProf_GetSlaveAddr(eMCDRV_SLAVE_ADDR_ANA); + + /* IF_REG */ + sRegInfo.bRegType = MCDRV_REGTYPE_IF; + strcpy(gsbLogString, "IF_REG:"); + for (i = 0; i < 256UL; i++) { + sRegInfo.bAddress = (UINT8)i; + if ((McResCtrl_GetRegAccess(&sRegInfo) + & eMCDRV_CAN_READ) != 0) { + sprintf(sbStr, "[%d]=%02X", + i, McSrv_ReadReg(bSlaveAddr_dig, i)); + strcat(gsbLogString, sbStr); + if (i < 255UL) { + ; + strcat(gsbLogString, " "); + } + } + } + strcat(gsbLogString, gsbLFCode); + machdep_DebugPrint((UINT8 *)(void *)gsbLogString); + + /* A_REG */ + strcpy(gsbLogString, "A_REG:"); + GetRegDump(gsbLogString, bSlaveAddr_dig, + MCI_A_REG_A, MCI_A_REG_D, MCDRV_REGTYPE_A); + strcat(gsbLogString, gsbLFCode); + machdep_DebugPrint((UINT8 *)(void *)gsbLogString); + + /* MA_REG */ + strcpy(gsbLogString, "MA_REG:"); + GetRegDump(gsbLogString, bSlaveAddr_dig, + MCI_MA_REG_A, MCI_MA_REG_D, MCDRV_REGTYPE_MA); + strcat(gsbLogString, gsbLFCode); + machdep_DebugPrint((UINT8 *)(void *)gsbLogString); + + /* MB_REG */ + strcpy(gsbLogString, "MB_REG:"); + GetRegDump(gsbLogString, bSlaveAddr_dig, + MCI_MB_REG_A, MCI_MB_REG_D, MCDRV_REGTYPE_MB); + strcat(gsbLogString, gsbLFCode); + machdep_DebugPrint((UINT8 *)(void *)gsbLogString); + + /* B_REG */ + strcpy(gsbLogString, "B_REG:"); + GetRegDump(gsbLogString, bSlaveAddr_dig, + MCI_B_REG_A, MCI_B_REG_D, MCDRV_REGTYPE_B); + strcat(gsbLogString, gsbLFCode); + machdep_DebugPrint((UINT8 *)(void *)gsbLogString); + + /* E_REG */ + strcpy(gsbLogString, "E_REG:"); + GetRegDump(gsbLogString, bSlaveAddr_dig, + MCI_E_REG_A, MCI_E_REG_D, MCDRV_REGTYPE_E); + strcat(gsbLogString, gsbLFCode); + machdep_DebugPrint((UINT8 *)(void *)gsbLogString); + + /* C_REG */ + strcpy(gsbLogString, "C_REG:"); + GetRegDump(gsbLogString, bSlaveAddr_dig, + MCI_C_REG_A, MCI_C_REG_D, MCDRV_REGTYPE_C); + strcat(gsbLogString, gsbLFCode); + machdep_DebugPrint((UINT8 *)(void *)gsbLogString); + + /* F_REG */ + strcpy(gsbLogString, "F_REG:"); + GetRegDump(gsbLogString, bSlaveAddr_dig, + MCI_F_REG_A, MCI_F_REG_D, MCDRV_REGTYPE_F); + strcat(gsbLogString, gsbLFCode); + machdep_DebugPrint((UINT8 *)(void *)gsbLogString); + + /* ANA_REG */ + strcpy(gsbLogString, "ANA_REG:"); + GetRegDump(gsbLogString, bSlaveAddr_ana, + MCI_ANA_REG_A, MCI_ANA_REG_D, MCDRV_REGTYPE_ANA); + strcat(gsbLogString, gsbLFCode); + machdep_DebugPrint((UINT8 *)(void *)gsbLogString); + + /* CD_REG */ + strcpy(gsbLogString, "CD_REG:"); + GetRegDump(gsbLogString, bSlaveAddr_ana, + MCI_CD_REG_A, MCI_CD_REG_D, MCDRV_REGTYPE_CD); + strcat(gsbLogString, gsbLFCode); + machdep_DebugPrint((UINT8 *)(void *)gsbLogString); +} + +/**************************************************************************** + * GetRegDump + * + * Description: + * Get Register dump string. + * Arguments: + * psbLogString string buffer + * bSlaveAddr Slave address + * bADRAddr ADR address + * bWINDOWAddr WINDOW address + * bRegType register type + * Return: + * none + * + ****************************************************************************/ +static void GetRegDump +( + CHAR *psbLogString, + UINT8 bSlaveAddr, + UINT8 bADRAddr, + UINT8 bWINDOWAddr, + UINT8 bRegType +) +{ + UINT16 i; + CHAR sbStr[10]; + UINT8 abData[2]; + struct MCDRV_REG_INFO sRegInfo; + + abData[0] = bADRAddr<<1; + sRegInfo.bRegType = bRegType; + + for (i = 0; i < 256UL; i++) { + sRegInfo.bAddress = (UINT8)i; + if ((McResCtrl_GetRegAccess(&sRegInfo) + & eMCDRV_CAN_READ) != 0) { + abData[1] = (UINT8)i; + McSrv_WriteReg(bSlaveAddr, abData, 2); + sprintf(sbStr, "[%d]=%02X", + i, McSrv_ReadReg(bSlaveAddr, bWINDOWAddr)); + strcat(psbLogString, sbStr); + if (i < 255UL) { + ; + strcat(psbLogString, " "); + } + } + } +} + +/**************************************************************************** + * MakeInitInfoLog + * + * Description: + * Make Init Parameter log. + * Arguments: + * pvPrm1 pointer to parameter + * Return: + * none + * + ****************************************************************************/ +static void MakeInitInfoLog +( + const struct MCDRV_INIT_INFO *pvPrm1 +) +{ + CHAR sbStr[80]; + int i; + + if (pvPrm1 == NULL) { + strcat(gsbLogString, " param=NULL"); + return; + } + + sprintf(sbStr, " bCkSel=%02X", pvPrm1->bCkSel); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " bCkInput=%02X", pvPrm1->bCkInput); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " bPllModeA=%02X", pvPrm1->bPllModeA); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " bPllPrevDivA=%02X", pvPrm1->bPllPrevDivA); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " wPllFbDivA=%04X", pvPrm1->wPllFbDivA); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " wPllFracA=%04X", pvPrm1->wPllFracA); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " bPllFreqA=%02X", pvPrm1->bPllFreqA); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " bPllModeB=%02X", pvPrm1->bPllModeB); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " bPllPrevDivB=%02X", pvPrm1->bPllPrevDivB); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " wPllFbDivB=%04X", pvPrm1->wPllFbDivB); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " wPllFracB=%04X", pvPrm1->wPllFracB); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " bPllFreqB=%02X", pvPrm1->bPllFreqB); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " bHsdetClk=%02X", pvPrm1->bHsdetClk); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " bDio0SdoHiz=%02X", pvPrm1->bDio0SdoHiz); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " bDio1SdoHiz=%02X", pvPrm1->bDio1SdoHiz); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " bDio2SdoHiz=%02X", pvPrm1->bDio2SdoHiz); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " bDio0ClkHiz=%02X", pvPrm1->bDio0ClkHiz); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " bDio1ClkHiz=%02X", pvPrm1->bDio1ClkHiz); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " bDio2ClkHiz=%02X", pvPrm1->bDio2ClkHiz); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " bDio0PcmHiz=%02X", pvPrm1->bDio0PcmHiz); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " bDio1PcmHiz=%02X", pvPrm1->bDio1PcmHiz); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " bDio2PcmHiz=%02X", pvPrm1->bDio2PcmHiz); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " bPa0Func=%02X", pvPrm1->bPa0Func); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " bPa1Func=%02X", pvPrm1->bPa1Func); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " bPa2Func=%02X", pvPrm1->bPa2Func); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " bPowerMode=%02X", pvPrm1->bPowerMode); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " bMbSel1=%02X", pvPrm1->bMbSel1); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " bMbSel2=%02X", pvPrm1->bMbSel2); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " bMbSel3=%02X", pvPrm1->bMbSel3); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " bMbSel4=%02X", pvPrm1->bMbSel4); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " bMbsDisch=%02X", pvPrm1->bMbsDisch); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " bNonClip=%02X", pvPrm1->bNonClip); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " bLineIn1Dif=%02X", pvPrm1->bLineIn1Dif); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " bLineOut1Dif=%02X", pvPrm1->bLineOut1Dif); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " bLineOut2Dif=%02X", pvPrm1->bLineOut2Dif); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " bMic1Sng=%02X", pvPrm1->bMic1Sng); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " bMic2Sng=%02X", pvPrm1->bMic2Sng); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " bMic3Sng=%02X", pvPrm1->bMic3Sng); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " bMic4Sng=%02X", pvPrm1->bMic4Sng); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " bZcLineOut1=%02X", pvPrm1->bZcLineOut1); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " bZcLineOut2=%02X", pvPrm1->bZcLineOut2); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " bZcRc=%02X", pvPrm1->bZcRc); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " bZcSp=%02X", pvPrm1->bZcSp); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " bZcHp=%02X", pvPrm1->bZcHp); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " bSvolLineOut1=%02X", pvPrm1->bSvolLineOut1); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " bSvolLineOut2=%02X", pvPrm1->bSvolLineOut2); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " bSvolRc=%02X", pvPrm1->bSvolRc); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " bSvolSp=%02X", pvPrm1->bSvolSp); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " bSvolHp=%02X", pvPrm1->bSvolHp); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " bRcHiz=%02X", pvPrm1->bRcHiz); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " bSpHiz=%02X", pvPrm1->bSpHiz); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " bHpHiz=%02X", pvPrm1->bHpHiz); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " bLineOut1Hiz=%02X", pvPrm1->bLineOut1Hiz); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " bLineOut2Hiz=%02X", pvPrm1->bLineOut2Hiz); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " bCpMod=%02X", pvPrm1->bCpMod); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " bRbSel=%02X", pvPrm1->bRbSel); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " bPlugSel=%02X", pvPrm1->bPlugSel); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " bGndDet=%02X", pvPrm1->bGndDet); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " bPpdRc=%02X", pvPrm1->bPpdRc); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " bPpdSp=%02X", pvPrm1->bPpdSp); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " =bPpdHp%02X", pvPrm1->bPpdHp); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " bPpdLineOut1=%02X", pvPrm1->bPpdLineOut1); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " bPpdLineOut2=%02X", pvPrm1->bPpdLineOut2); + strcat(gsbLogString, sbStr); + + for (i = 0; i < 20; i++) { + sprintf(sbStr, " dWaitTime[%02d]=%lu", + i, pvPrm1->sWaitTime.dWaitTime[i]); + strcat(gsbLogString, sbStr); + } + for (i = 0; i < 20; i++) { + sprintf(sbStr, " dPollInterval[%02d]=%lu", + i, pvPrm1->sWaitTime.dPollInterval[i]); + strcat(gsbLogString, sbStr); + } + for (i = 0; i < 20; i++) { + sprintf(sbStr, " dPollTimeOut[%02d]=%lu", + i, pvPrm1->sWaitTime.dPollTimeOut[i]); + strcat(gsbLogString, sbStr); + } +} + +/**************************************************************************** + * MakeRegInfoLog + * + * Description: + * Make Reg Info Parameter log. + * Arguments: + * pvPrm1 pointer to parameter + * Return: + * none + * + ****************************************************************************/ +static void MakeRegInfoLog +( + const struct MCDRV_REG_INFO *pvPrm1 +) +{ + CHAR sbStr[80]; + + if (pvPrm1 == NULL) { + strcat(gsbLogString, " param=NULL"); + return; + } + + sprintf(sbStr, " bRegType=%02X", pvPrm1->bRegType); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " bAddress=%02X", pvPrm1->bAddress); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " bData=%02X", pvPrm1->bData); + strcat(gsbLogString, sbStr); +} + + +/**************************************************************************** + * MakeClockSwInfoLog + * + * Description: + * Make Clock Switch Info Parameter log. + * Arguments: + * pvPrm1 pointer to parameter + * Return: + * none + * + ****************************************************************************/ +static void MakeClockSwInfoLog +( + const struct MCDRV_CLOCKSW_INFO *pvPrm1 +) +{ + CHAR sbStr[80]; + + if (pvPrm1 == NULL) { + strcat(gsbLogString, " param=NULL"); + return; + } + + sprintf(sbStr, " bClkSrc=%02X", pvPrm1->bClkSrc); + strcat(gsbLogString, sbStr); +} + +/**************************************************************************** + * MakePathInfoLog + * + * Description: + * Make Path Info Parameter log. + * Arguments: + * pvPrm1 pointer to parameter + * Return: + * none + * + ****************************************************************************/ +static void MakePathInfoLog +( + const struct MCDRV_PATH_INFO *pvPrm1 +) +{ + UINT8 bCh; + CHAR sbStr[80]; + + if (pvPrm1 == NULL) { + strcat(gsbLogString, " param=NULL"); + return; + } + + for (bCh = 0; bCh < MUSICOUT_PATH_CHANNELS; bCh++) { + sprintf(sbStr, " asMusicOut[%d].dSrcOnOff=%08lX", + bCh, pvPrm1->asMusicOut[bCh].dSrcOnOff); + strcat(gsbLogString, sbStr); + } + for (bCh = 0; bCh < EXTOUT_PATH_CHANNELS; bCh++) { + sprintf(sbStr, " asExtOut[%d].dSrcOnOff=%08lX", + bCh, pvPrm1->asExtOut[bCh].dSrcOnOff); + strcat(gsbLogString, sbStr); + } + for (bCh = 0; bCh < HIFIOUT_PATH_CHANNELS; bCh++) { + sprintf(sbStr, " asHifiOut[%d].dSrcOnOff=%08lX", + bCh, pvPrm1->asHifiOut[bCh].dSrcOnOff); + strcat(gsbLogString, sbStr); + } + for (bCh = 0; bCh < VBOXMIXIN_PATH_CHANNELS; bCh++) { + sprintf(sbStr, " asVboxMixIn[%d].dSrcOnOff=%08lX", + bCh, pvPrm1->asVboxMixIn[bCh].dSrcOnOff); + strcat(gsbLogString, sbStr); + } + for (bCh = 0; bCh < AE_PATH_CHANNELS; bCh++) { + sprintf(sbStr, " asAe0[%d].dSrcOnOff=%08lX", + bCh, pvPrm1->asAe0[bCh].dSrcOnOff); + strcat(gsbLogString, sbStr); + } + for (bCh = 0; bCh < AE_PATH_CHANNELS; bCh++) { + sprintf(sbStr, " asAe1[%d].dSrcOnOff=%08lX", + bCh, pvPrm1->asAe1[bCh].dSrcOnOff); + strcat(gsbLogString, sbStr); + } + for (bCh = 0; bCh < AE_PATH_CHANNELS; bCh++) { + sprintf(sbStr, " asAe2[%d].dSrcOnOff=%08lX", + bCh, pvPrm1->asAe2[bCh].dSrcOnOff); + strcat(gsbLogString, sbStr); + } + for (bCh = 0; bCh < AE_PATH_CHANNELS; bCh++) { + sprintf(sbStr, " asAe3[%d].dSrcOnOff=%08lX", + bCh, pvPrm1->asAe3[bCh].dSrcOnOff); + strcat(gsbLogString, sbStr); + } + for (bCh = 0; bCh < DAC0_PATH_CHANNELS; bCh++) { + sprintf(sbStr, " asDac0[%d].dSrcOnOff=%08lX", + bCh, pvPrm1->asDac0[bCh].dSrcOnOff); + strcat(gsbLogString, sbStr); + } + for (bCh = 0; bCh < DAC1_PATH_CHANNELS; bCh++) { + sprintf(sbStr, " asDac1[%d].dSrcOnOff=%08lX", + bCh, pvPrm1->asDac1[bCh].dSrcOnOff); + strcat(gsbLogString, sbStr); + } + for (bCh = 0; bCh < VOICEOUT_PATH_CHANNELS; bCh++) { + sprintf(sbStr, " asVoiceOut[%d].dSrcOnOff=%08lX", + bCh, pvPrm1->asVoiceOut[bCh].dSrcOnOff); + strcat(gsbLogString, sbStr); + } + for (bCh = 0; bCh < VBOXIOIN_PATH_CHANNELS; bCh++) { + sprintf(sbStr, " asVboxIoIn[%d].dSrcOnOff=%08lX", + bCh, pvPrm1->asVboxIoIn[bCh].dSrcOnOff); + strcat(gsbLogString, sbStr); + } + for (bCh = 0; bCh < VBOXHOSTIN_PATH_CHANNELS; bCh++) { + sprintf(sbStr, " asVboxHostIn[%d].dSrcOnOff=%08lX", + bCh, pvPrm1->asVboxHostIn[bCh].dSrcOnOff); + strcat(gsbLogString, sbStr); + } + for (bCh = 0; bCh < HOSTOUT_PATH_CHANNELS; bCh++) { + sprintf(sbStr, " asHostOut[%d].dSrcOnOff=%08lX", + bCh, pvPrm1->asHostOut[bCh].dSrcOnOff); + strcat(gsbLogString, sbStr); + } + for (bCh = 0; bCh < ADIF0_PATH_CHANNELS; bCh++) { + sprintf(sbStr, " asAdif0[%d].dSrcOnOff=%08lX", + bCh, pvPrm1->asAdif0[bCh].dSrcOnOff); + strcat(gsbLogString, sbStr); + } + for (bCh = 0; bCh < ADIF1_PATH_CHANNELS; bCh++) { + sprintf(sbStr, " asAdif1[%d].dSrcOnOff=%08lX", + bCh, pvPrm1->asAdif1[bCh].dSrcOnOff); + strcat(gsbLogString, sbStr); + } + for (bCh = 0; bCh < ADIF2_PATH_CHANNELS; bCh++) { + sprintf(sbStr, " asAdif2[%d].dSrcOnOff=%08lX", + bCh, pvPrm1->asAdif2[bCh].dSrcOnOff); + strcat(gsbLogString, sbStr); + } + + for (bCh = 0; bCh < ADC0_PATH_CHANNELS; bCh++) { + sprintf(sbStr, " asAdc0[%d].dSrcOnOff=%08lX", + bCh, pvPrm1->asAdc0[bCh].dSrcOnOff); + strcat(gsbLogString, sbStr); + } + for (bCh = 0; bCh < ADC1_PATH_CHANNELS; bCh++) { + sprintf(sbStr, " asAdc1[%d].dSrcOnOff=%08lX", + bCh, pvPrm1->asAdc1[bCh].dSrcOnOff); + strcat(gsbLogString, sbStr); + } + for (bCh = 0; bCh < SP_PATH_CHANNELS; bCh++) { + sprintf(sbStr, " asSp[%d].dSrcOnOff=%08lX", + bCh, pvPrm1->asSp[bCh].dSrcOnOff); + strcat(gsbLogString, sbStr); + } + for (bCh = 0; bCh < HP_PATH_CHANNELS; bCh++) { + sprintf(sbStr, " asHp[%d].dSrcOnOff=%08lX", + bCh, pvPrm1->asHp[bCh].dSrcOnOff); + strcat(gsbLogString, sbStr); + } + for (bCh = 0; bCh < RC_PATH_CHANNELS; bCh++) { + sprintf(sbStr, " asRc[%d].dSrcOnOff=%08lX", + bCh, pvPrm1->asRc[bCh].dSrcOnOff); + strcat(gsbLogString, sbStr); + } + for (bCh = 0; bCh < LOUT1_PATH_CHANNELS; bCh++) { + sprintf(sbStr, " asLout1[%d].dSrcOnOff=%08lX", + bCh, pvPrm1->asLout1[bCh].dSrcOnOff); + strcat(gsbLogString, sbStr); + } + for (bCh = 0; bCh < LOUT2_PATH_CHANNELS; bCh++) { + sprintf(sbStr, " asLout2[%d].dSrcOnOff=%08lX", + bCh, pvPrm1->asLout2[bCh].dSrcOnOff); + strcat(gsbLogString, sbStr); + } + for (bCh = 0; bCh < BIAS_PATH_CHANNELS; bCh++) { + sprintf(sbStr, " asBias[%d].dSrcOnOff=%08lX", + bCh, pvPrm1->asBias[bCh].dSrcOnOff); + strcat(gsbLogString, sbStr); + } +} + +/**************************************************************************** + * MakeVolInfoLog + * + * Description: + * Make Volume Info Parameter log. + * Arguments: + * pvPrm1 pointer to parameter + * Return: + * none + * + ****************************************************************************/ +static void MakeVolInfoLog +( + const struct MCDRV_VOL_INFO *pvPrm1 +) +{ + UINT8 bCh; + CHAR sbStr[80]; + + if (pvPrm1 == NULL) { + strcat(gsbLogString, " param=NULL"); + return; + } + + for (bCh = 0; bCh < MUSICIN_VOL_CHANNELS; bCh++) { + sprintf(sbStr, " aswD_MusicIn[%d]=%04X", + bCh, (UINT16)pvPrm1->aswD_MusicIn[bCh]); + strcat(gsbLogString, sbStr); + } + for (bCh = 0; bCh < EXTIN_VOL_CHANNELS; bCh++) { + sprintf(sbStr, " aswD_ExtIn[%d]=%04X", + bCh, (UINT16)pvPrm1->aswD_ExtIn[bCh]); + strcat(gsbLogString, sbStr); + } + for (bCh = 0; bCh < VOICEIN_VOL_CHANNELS; bCh++) { + sprintf(sbStr, " aswD_VoiceIn[%d]=%04X", + bCh, (UINT16)pvPrm1->aswD_VoiceIn[bCh]); + strcat(gsbLogString, sbStr); + } + for (bCh = 0; bCh < REFIN_VOL_CHANNELS; bCh++) { + sprintf(sbStr, " aswD_RefIn[%d]=%04X", + bCh, (UINT16)pvPrm1->aswD_RefIn[bCh]); + strcat(gsbLogString, sbStr); + } + for (bCh = 0; bCh < ADIF0IN_VOL_CHANNELS; bCh++) { + sprintf(sbStr, " aswD_Adif0In[%d]=%04X", + bCh, (UINT16)pvPrm1->aswD_Adif0In[bCh]); + strcat(gsbLogString, sbStr); + } + for (bCh = 0; bCh < ADIF1IN_VOL_CHANNELS; bCh++) { + sprintf(sbStr, " aswD_Adif1In[%d]=%04X", + bCh, (UINT16)pvPrm1->aswD_Adif1In[bCh]); + strcat(gsbLogString, sbStr); + } + for (bCh = 0; bCh < ADIF2IN_VOL_CHANNELS; bCh++) { + sprintf(sbStr, " aswD_Adif2In[%d]=%04X", + bCh, (UINT16)pvPrm1->aswD_Adif2In[bCh]); + strcat(gsbLogString, sbStr); + } + for (bCh = 0; bCh < MUSICOUT_VOL_CHANNELS; bCh++) { + sprintf(sbStr, " aswD_MusicOut[%d]=%04X", + bCh, (UINT16)pvPrm1->aswD_MusicOut[bCh]); + strcat(gsbLogString, sbStr); + } + for (bCh = 0; bCh < EXTOUT_VOL_CHANNELS; bCh++) { + sprintf(sbStr, " aswD_ExtOut[%d]=%04X", + bCh, (UINT16)pvPrm1->aswD_ExtOut[bCh]); + strcat(gsbLogString, sbStr); + } + for (bCh = 0; bCh < VOICEOUT_VOL_CHANNELS; bCh++) { + sprintf(sbStr, " aswD_VoiceOut[%d]=%04X", + bCh, (UINT16)pvPrm1->aswD_VoiceOut[bCh]); + strcat(gsbLogString, sbStr); + } + for (bCh = 0; bCh < REFOUT_VOL_CHANNELS; bCh++) { + sprintf(sbStr, " aswD_RefOut[%d]=%04X", + bCh, (UINT16)pvPrm1->aswD_RefOut[bCh]); + strcat(gsbLogString, sbStr); + } + for (bCh = 0; bCh < DAC0OUT_VOL_CHANNELS; bCh++) { + sprintf(sbStr, " aswD_Dac0Out[%d]=%04X", + bCh, (UINT16)pvPrm1->aswD_Dac0Out[bCh]); + strcat(gsbLogString, sbStr); + } + for (bCh = 0; bCh < DAC1OUT_VOL_CHANNELS; bCh++) { + sprintf(sbStr, " aswD_Dac1Out[%d]=%04X", + bCh, (UINT16)pvPrm1->aswD_Dac1Out[bCh]); + strcat(gsbLogString, sbStr); + } + for (bCh = 0; bCh < DPATH_VOL_CHANNELS; bCh++) { + sprintf(sbStr, " aswD_DpathDa[%d]=%04X", + bCh, (UINT16)pvPrm1->aswD_DpathDa[bCh]); + strcat(gsbLogString, sbStr); + } + for (bCh = 0; bCh < DPATH_VOL_CHANNELS; bCh++) { + sprintf(sbStr, " aswD_DpathAd[%d]=%04X", + bCh, (UINT16)pvPrm1->aswD_DpathAd[bCh]); + strcat(gsbLogString, sbStr); + } + for (bCh = 0; bCh < LINEIN1_VOL_CHANNELS; bCh++) { + sprintf(sbStr, " aswA_LineIn1[%d]=%04X", + bCh, (UINT16)pvPrm1->aswA_LineIn1[bCh]); + strcat(gsbLogString, sbStr); + } + for (bCh = 0; bCh < MIC1_VOL_CHANNELS; bCh++) { + sprintf(sbStr, " aswA_Mic1[%d]=%04X", + bCh, (UINT16)pvPrm1->aswA_Mic1[bCh]); + strcat(gsbLogString, sbStr); + } + for (bCh = 0; bCh < MIC2_VOL_CHANNELS; bCh++) { + sprintf(sbStr, " aswA_Mic2[%d]=%04X", + bCh, (UINT16)pvPrm1->aswA_Mic2[bCh]); + strcat(gsbLogString, sbStr); + } + for (bCh = 0; bCh < MIC3_VOL_CHANNELS; bCh++) { + sprintf(sbStr, " aswA_Mic3[%d]=%04X", + bCh, (UINT16)pvPrm1->aswA_Mic3[bCh]); + strcat(gsbLogString, sbStr); + } + for (bCh = 0; bCh < MIC4_VOL_CHANNELS; bCh++) { + sprintf(sbStr, " aswA_Mic4[%d]=%04X", + bCh, (UINT16)pvPrm1->aswA_Mic4[bCh]); + strcat(gsbLogString, sbStr); + } + for (bCh = 0; bCh < HP_VOL_CHANNELS; bCh++) { + sprintf(sbStr, " aswA_Hp[%d]=%04X", + bCh, (UINT16)pvPrm1->aswA_Hp[bCh]); + strcat(gsbLogString, sbStr); + } + for (bCh = 0; bCh < SP_VOL_CHANNELS; bCh++) { + sprintf(sbStr, " aswA_Sp[%d]=%04X", + bCh, (UINT16)pvPrm1->aswA_Sp[bCh]); + strcat(gsbLogString, sbStr); + } + for (bCh = 0; bCh < RC_VOL_CHANNELS; bCh++) { + sprintf(sbStr, " aswA_Rc[%d]=%04X", + bCh, (UINT16)pvPrm1->aswA_Rc[bCh]); + strcat(gsbLogString, sbStr); + } + for (bCh = 0; bCh < LINEOUT1_VOL_CHANNELS; bCh++) { + sprintf(sbStr, " aswA_LineOut1[%d]=%04X", + bCh, (UINT16)pvPrm1->aswA_LineOut1[bCh]); + strcat(gsbLogString, sbStr); + } + for (bCh = 0; bCh < LINEOUT2_VOL_CHANNELS; bCh++) { + sprintf(sbStr, " aswA_LineOut2[%d]=%04X", + bCh, (UINT16)pvPrm1->aswA_LineOut2[bCh]); + strcat(gsbLogString, sbStr); + } + for (bCh = 0; bCh < HPDET_VOL_CHANNELS; bCh++) { + sprintf(sbStr, " aswA_HpDet[%d]=%04X", + bCh, (UINT16)pvPrm1->aswA_HpDet[bCh]); + strcat(gsbLogString, sbStr); + } +} + +/**************************************************************************** + * MakeDIOInfoLog + * + * Description: + * Make Digital I/O Info Parameter log. + * Arguments: + * pvPrm1 pointer to parameter + * Return: + * none + * + ****************************************************************************/ +static void MakeDIOInfoLog +( + const struct MCDRV_DIO_INFO *pvPrm1 +) +{ + CHAR sbStr[80]; + UINT8 bPort; + + if (pvPrm1 == NULL) { + strcat(gsbLogString, " param=NULL"); + return; + } + + for (bPort = 0; bPort < 4; bPort++) { + sprintf(sbStr, " asPortInfo[%d].sDioCommon.bMasterSlave=%02X", + bPort, + pvPrm1->asPortInfo[bPort].sDioCommon.bMasterSlave); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " asPortInfo[%d].sDioCommon.bAutoFs=%02X", + bPort, + pvPrm1->asPortInfo[bPort].sDioCommon.bAutoFs); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " asPortInfo[%d].sDioCommon.bFs=%02X", + bPort, + pvPrm1->asPortInfo[bPort].sDioCommon.bFs); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " asPortInfo[%d].sDioCommon.bBckFs=%02X", + bPort, + pvPrm1->asPortInfo[bPort].sDioCommon.bBckFs); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " asPortInfo[%d].sDioCommon.bInterface=%02X", + bPort, + pvPrm1->asPortInfo[bPort].sDioCommon.bInterface); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " asPortInfo[%d].sDioCommon.bBckInvert=%02X", + bPort, + pvPrm1->asPortInfo[bPort].sDioCommon.bBckInvert); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " asPortInfo[%d].sDioCommon.bSrcThru=%02X", + bPort, + pvPrm1->asPortInfo[bPort].sDioCommon.bSrcThru); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " asPortInfo[%d].sDioCommon.bPcmHizTim=%02X", + bPort, + pvPrm1->asPortInfo[bPort].sDioCommon.bPcmHizTim); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " asPortInfo[%d].sDioCommon.bPcmFrame=%02X", + bPort, + pvPrm1->asPortInfo[bPort].sDioCommon.bPcmFrame); + strcat(gsbLogString, sbStr); + sprintf(sbStr, + " asPortInfo[%d].sDioCommon.bPcmHighPeriod=%02X", + bPort, + pvPrm1->asPortInfo[bPort].sDioCommon.bPcmHighPeriod); + strcat(gsbLogString, sbStr); + + sprintf(sbStr, " asPortInfo[%d].sDir.sDaFormat.bBitSel=%02X", + bPort, + pvPrm1->asPortInfo[bPort].sDir.sDaFormat.bBitSel); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " asPortInfo[%d].sDir.sDaFormat.bMode=%02X", + bPort, pvPrm1->asPortInfo[bPort].sDir.sDaFormat.bMode); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " asPortInfo[%d].sDir.sPcmFormat.bMono=%02X", + bPort, + pvPrm1->asPortInfo[bPort].sDir.sPcmFormat.bMono); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " asPortInfo[%d].sDir.sPcmFormat.bOrder=%02X", + bPort, + pvPrm1->asPortInfo[bPort].sDir.sPcmFormat.bOrder); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " asPortInfo[%d].sDir.sPcmFormat.bLaw=%02X", + bPort, + pvPrm1->asPortInfo[bPort].sDir.sPcmFormat.bLaw); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " asPortInfo[%d].sDir.sPcmFormat.bBitSel=%02X", + bPort, + pvPrm1->asPortInfo[bPort].sDir.sPcmFormat.bBitSel); + strcat(gsbLogString, sbStr); + + sprintf(sbStr, " asPortInfo[%d].sDit.bStMode=%02X", + bPort, + pvPrm1->asPortInfo[bPort].sDit.bStMode); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " asPortInfo[%d].sDit.bEdge=%02X", + bPort, + pvPrm1->asPortInfo[bPort].sDit.bEdge); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " asPortInfo[%d].sDit.sDaFormat.bBitSel=%02X", + bPort, + pvPrm1->asPortInfo[bPort].sDit.sDaFormat.bBitSel); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " asPortInfo[%d].sDit.sDaFormat.bMode=%02X", + bPort, + pvPrm1->asPortInfo[bPort].sDit.sDaFormat.bMode); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " asPortInfo[%d].sDit.sPcmFormat.bMono=%02X", + bPort, + pvPrm1->asPortInfo[bPort].sDit.sPcmFormat.bMono); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " asPortInfo[%d].sDit.sPcmFormat.bOrder=%02X", + bPort, + pvPrm1->asPortInfo[bPort].sDit.sPcmFormat.bOrder); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " asPortInfo[%d].sDit.sPcmFormat.bLaw=%02X", + bPort, + pvPrm1->asPortInfo[bPort].sDit.sPcmFormat.bLaw); + strcat(gsbLogString, sbStr); + sprintf(sbStr, " asPortInfo[%d].sDit.sPcmFormat.bBitSel=%02X", + bPort, + pvPrm1->asPortInfo[bPort].sDit.sPcmFormat.bBitSel); + strcat(gsbLogString, sbStr); + } +} + +/**************************************************************************** + * MakeDIOPathInfoLog + * + * Description: + * Make Digital I/O path Info Parameter log. + * Arguments: + * pvPrm1 pointer to parameter + * Return: + * none + * + ****************************************************************************/ +static void MakeDIOPathInfoLog +( + const struct MCDRV_DIOPATH_INFO *pvPrm1 +) +{ + CHAR sbStr[80]; + UINT8 bPort; + + if (pvPrm1 == NULL) { + strcat(gsbLogString, " param=NULL"); + return; + } + + for (bPort = 0; bPort < 4; bPort++) { + sprintf(sbStr, " abPhysPort[%d]=%02X", + bPort, pvPrm1->abPhysPort[bPort]); + strcat(gsbLogString, sbStr); + } + sprintf(sbStr, " bMusicCh=%02X", pvPrm1->bMusicCh); + strcat(gsbLogString, sbStr); + for (bPort = 0; bPort < 3; bPort++) { + sprintf(sbStr, " abMusicRSlot[%d]=%02X", + bPort, pvPrm1->abMusicRSlot[bPort]); + strcat(gsbLogString, sbStr); + } + for (bPort = 0; bPort < 3; bPort++) { + sprintf(sbStr, " abMusicTSlot[%d]=%02X", + bPort, pvPrm1->abMusicTSlot[bPort]); + strcat(gsbLogString, sbStr); + } +} + +/**************************************************************************** + * MakeSwapInfoLog + * + * Description: + * Make Swap Info Parameter log. + * Arguments: + * pvPrm1 pointer to parameter + * Return: + * none + * + ****************************************************************************/ +static void MakeSwapInfoLog +( + const struct MCDRV_SWAP_INFO *pvPrm1 +) +{ + CHAR sbStr[80]; + + if (pvPrm1 == NULL) { + strcat(gsbLogString, " param=NULL"); + return; + } + + sprintf(sbStr, " bAdif0=%02X", pvPrm1->bAdif0); + sprintf(sbStr, " bAdif1=%02X", pvPrm1->bAdif1); + sprintf(sbStr, " bAdif2=%02X", pvPrm1->bAdif2); + sprintf(sbStr, " bDac0=%02X", pvPrm1->bDac0); + sprintf(sbStr, " bDac1=%02X", pvPrm1->bDac1); + sprintf(sbStr, " bMusicIn0=%02X", pvPrm1->bMusicIn0); + sprintf(sbStr, " bMusicIn1=%02X", pvPrm1->bMusicIn1); + sprintf(sbStr, " bMusicIn2=%02X", pvPrm1->bMusicIn2); + sprintf(sbStr, " bExtIn=%02X", pvPrm1->bExtIn); + sprintf(sbStr, " bVoiceIn=%02X", pvPrm1->bVoiceIn); + sprintf(sbStr, " bHifiIn=%02X", pvPrm1->bHifiIn); + sprintf(sbStr, " bMusicOut0=%02X", pvPrm1->bMusicOut0); + sprintf(sbStr, " bMusicOut1=%02X", pvPrm1->bMusicOut1); + sprintf(sbStr, " bMusicOut2=%02X", pvPrm1->bMusicOut2); + sprintf(sbStr, " bExtOut=%02X", pvPrm1->bExtOut); + sprintf(sbStr, " bVoiceOut=%02X", pvPrm1->bVoiceOut); + sprintf(sbStr, " bHifiOut=%02X", pvPrm1->bHifiOut); + strcat(gsbLogString, sbStr); +} + +/**************************************************************************** + * MakeDspLog + * + * Description: + * Make DSP Parameter log. + * Arguments: + * pvPrm1 pointer to parameter + * Return: + * none + * + ****************************************************************************/ +static void MakeDspLog( + const UINT8 *pvPrm1, + UINT32 dPrm +) +{ + CHAR sbStr[80]; + UINT32 i; + + if (pvPrm1 == NULL) { + strcat(gsbLogString, " param=NULL"); + return; + } + sprintf(sbStr, " param="); + strcat(gsbLogString, sbStr); + for (i = 0; i < dPrm; i++) { + sprintf(sbStr, " %d", pvPrm1[i]); + strcat(gsbLogString, sbStr); + } +} + +/**************************************************************************** + * MakeDspPrmLog + * + * Description: + * Make DSP Param Parameter log. + * Arguments: + * pvPrm1 pointer to parameter + * Return: + * none + * + ****************************************************************************/ +static void MakeDspPrmLog +( + const struct MCDRV_DSP_PARAM *pvPrm1, + const void *pvPrm2, + UINT32 dPrm +) +{ + CHAR sbStr[80]; + UINT32 i; + + if (pvPrm1 == NULL) { + strcat(gsbLogString, " pvPrm1=NULL"); + return; + } + if (pvPrm2 == NULL) { + strcat(gsbLogString, " pvPrm2=NULL"); + return; + } + if ((pvPrm1->dType == MCDRV_DSP_PARAM_CDSP_INPOS) + || (pvPrm1->dType == MCDRV_DSP_PARAM_CDSP_OUTPOS) + || (pvPrm1->dType == MCDRV_DSP_PARAM_CDSP_DFIFO_REMAIN) + || (pvPrm1->dType == MCDRV_DSP_PARAM_CDSP_RFIFO_REMAIN)) { + sprintf(sbStr, " param=%ld", *((UINT32 *)pvPrm2)); + strcat(gsbLogString, sbStr); + } else { + sprintf(sbStr, " param="); + strcat(gsbLogString, sbStr); + for (i = 0; i < dPrm; i++) { + sprintf(sbStr, " %d", ((UINT8 *)pvPrm2)[i]); + strcat(gsbLogString, sbStr); + } + } +} + +/**************************************************************************** + * MakeHSDETInfoLog + * + * Description: + * Make HSDET Info Parameter log. + * Arguments: + * pvPrm1 pointer to parameter + * Return: + * none + * + ****************************************************************************/ +static void MakeHSDETInfoLog +( + const struct MCDRV_HSDET_INFO *pvPrm1 +) +{ + CHAR sbStr[80]; + + if (pvPrm1 == NULL) { + strcat(gsbLogString, " param=NULL"); + return; + } + + sprintf(sbStr, " bEnPlugDet=%02X", pvPrm1->bEnPlugDet); + sprintf(sbStr, " bEnPlugDetDb=%02X", pvPrm1->bEnPlugDetDb); + sprintf(sbStr, " bEnDlyKeyOff=%02X", pvPrm1->bEnDlyKeyOff); + sprintf(sbStr, " bEnDlyKeyOn=%02X", pvPrm1->bEnDlyKeyOn); + sprintf(sbStr, " bEnMicDet=%02X", pvPrm1->bEnMicDet); + sprintf(sbStr, " bEnKeyOff=%02X", pvPrm1->bEnKeyOff); + sprintf(sbStr, " bEnKeyOn=%02X", pvPrm1->bEnKeyOn); + sprintf(sbStr, " bHsDetDbnc=%02X", pvPrm1->bHsDetDbnc); + sprintf(sbStr, " bKeyOffMtim=%02X", pvPrm1->bKeyOffMtim); + sprintf(sbStr, " bKeyOnMtim=%02X", pvPrm1->bKeyOnMtim); + sprintf(sbStr, " bKey0OffDlyTim=%02X", pvPrm1->bKey0OffDlyTim); + sprintf(sbStr, " bKey1OffDlyTim=%02X", pvPrm1->bKey1OffDlyTim); + sprintf(sbStr, " bKey2OffDlyTim=%02X", pvPrm1->bKey2OffDlyTim); + sprintf(sbStr, " bKey0OnDlyTim=%02X", pvPrm1->bKey0OnDlyTim); + sprintf(sbStr, " bKey1OnDlyTim=%02X", pvPrm1->bKey1OnDlyTim); + sprintf(sbStr, " bKey2OnDlyTim=%02X", pvPrm1->bKey2OnDlyTim); + sprintf(sbStr, " bKey0OnDlyTim2=%02X", pvPrm1->bKey0OnDlyTim2); + sprintf(sbStr, " bKey1OnDlyTim2=%02X", pvPrm1->bKey1OnDlyTim2); + sprintf(sbStr, " bKey2OnDlyTim2=%02X", pvPrm1->bKey2OnDlyTim2); + sprintf(sbStr, " bIrqType=%02X", pvPrm1->bIrqType); + sprintf(sbStr, " bDetInInv=%02X", pvPrm1->bDetInInv); + sprintf(sbStr, " bHsDetMode=%02X", pvPrm1->bHsDetMode); + sprintf(sbStr, " bSperiod=%02X", pvPrm1->bSperiod); + sprintf(sbStr, " bLperiod=%02X", pvPrm1->bLperiod); + sprintf(sbStr, " bDbncNumPlug=%02X", pvPrm1->bDbncNumPlug); + sprintf(sbStr, " bDbncNumMic=%02X", pvPrm1->bDbncNumMic); + sprintf(sbStr, " bDbncNumKey=%02X", pvPrm1->bDbncNumKey); + sprintf(sbStr, " bSgnlPeriod=%02X", pvPrm1->bSgnlPeriod); + sprintf(sbStr, " bSgnlNum=%02X", pvPrm1->bSgnlNum); + sprintf(sbStr, " bSgnlPeak=%02X", pvPrm1->bSgnlPeak); + sprintf(sbStr, " bImpSel=%02X", pvPrm1->bImpSel); + sprintf(sbStr, " bDlyIrqStop=%02X", pvPrm1->bDlyIrqStop); + sprintf(sbStr, " cbfunc=%p", pvPrm1->cbfunc); + strcat(gsbLogString, sbStr); +} + +/**************************************************************************** + * MakeGPModeLog + * + * Description: + * Make GPIO mode Info Parameter log. + * Arguments: + * pvPrm1 pointer to parameter + * Return: + * none + * + ****************************************************************************/ +static void MakeGPModeLog +( + const struct MCDRV_GP_MODE *pvPrm1 +) +{ + CHAR sbStr[80]; + UINT8 bPadNo; + + if (pvPrm1 == NULL) { + strcat(gsbLogString, " param=NULL"); + return; + } + + for (bPadNo = 0; bPadNo < 3; bPadNo++) { + sprintf(sbStr, " abGpDdr[%d]=%02X", + bPadNo, pvPrm1->abGpDdr[bPadNo]); + strcat(gsbLogString, sbStr); + } + for (bPadNo = 0; bPadNo < 3; bPadNo++) { + sprintf(sbStr, " abGpHost[%d]=%02X", + bPadNo, pvPrm1->abGpHost[bPadNo]); + strcat(gsbLogString, sbStr); + } + for (bPadNo = 0; bPadNo < 3; bPadNo++) { + sprintf(sbStr, " abGpInvert[%d]=%02X", + bPadNo, pvPrm1->abGpInvert[bPadNo]); + strcat(gsbLogString, sbStr); + } +} + +/**************************************************************************** + * MakeGPMaskLog + * + * Description: + * Make GPIO Mask Info Parameter log. + * Arguments: + * pvPrm1 pointer to parameter + * Return: + * none + * + ****************************************************************************/ +static void MakeGPMaskLog +( + const UINT8 *pvPrm1 +) +{ + CHAR sbStr[80]; + + if (pvPrm1 == NULL) { + strcat(gsbLogString, " param=NULL"); + return; + } + + sprintf(sbStr, " mask=%02X", *pvPrm1); + strcat(gsbLogString, sbStr); +} + +/**************************************************************************** + * MakeGetSetGPLog + * + * Description: + * Make Get/Set GPIO Info Parameter log. + * Arguments: + * pvPrm1 pointer to parameter + * Return: + * none + * + ****************************************************************************/ +static void MakeGetSetGPLog +( + const UINT8 *pvPrm1 +) +{ + CHAR sbStr[80]; + + if (pvPrm1 == NULL) { + strcat(gsbLogString, " param=NULL"); + return; + } + + sprintf(sbStr, " HiLow=%02X", *pvPrm1); + strcat(gsbLogString, sbStr); +} + + + +#endif /* MCDRV_DEBUG_LEVEL */ diff --git a/sound/soc/codecs/ymu831/mcdebuglog.h b/sound/soc/codecs/ymu831/mcdebuglog.h new file mode 100644 index 00000000000..81b3c052c3c --- /dev/null +++ b/sound/soc/codecs/ymu831/mcdebuglog.h @@ -0,0 +1,55 @@ +/**************************************************************************** + * + * Copyright(c) 2012 Yamaha Corporation. All rights reserved. + * + * Module : mcdebuglog.h + * + * Description : MC Driver debug log header + * + * Version : 1.0.0 2012.12.13 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + * + ****************************************************************************/ + +#ifndef _MCDEBUGLOB_H_ +#define _MCDEBUGLOG_H_ + +#include "mcdriver.h" +#include "mcmachdep.h" + +#if MCDRV_DEBUG_LEVEL + + +void McDebugLog_CmdIn(UINT32 dCmd, + const void *pvPrm1, + const void *pvPrm2, + UINT32 dUpdateInfo); +void McDebugLog_CmdOut(UINT32 dCmd, + const SINT32 *sdRet, + const void *pvPrm1, + const void *pvPrm2, + UINT32 dPrm); + +void McDebugLog_FuncIn(void *pvFuncName); +void McDebugLog_FuncOut(void *pvFuncName, + const SINT32 *psdRet); + + +#endif /* MCDRV_DEBUG_LEVEL */ + +#endif /* _MCDEBUGLOG_H_ */ diff --git a/sound/soc/codecs/ymu831/mcdefs.h b/sound/soc/codecs/ymu831/mcdefs.h new file mode 100644 index 00000000000..3f00f368abf --- /dev/null +++ b/sound/soc/codecs/ymu831/mcdefs.h @@ -0,0 +1,4329 @@ +/**************************************************************************** + * + * Copyright(c) 2012-2013 Yamaha Corporation. All rights reserved. + * + * Module : mcdefs.h + * + * Description : MC Device Definitions + * + * Version : 2.0.0 2013.03.06 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + * + ****************************************************************************/ + +#ifndef _MCDEFS_H_ +#define _MCDEFS_H_ + +/* Register Definition + + [Naming Rules] + + MCI_xxx : Registers + MCI_xxx_DEF : Default setting of registers + MCB_xxx : Miscelleneous bit definition +*/ + +/* Registers */ +/* IF_REG */ +#define MCI_A_REG_A (0) +#define MCB_A_REG_AINC (0x80) + +#define MCI_A_REG_D (1) + +#define MCI_RST_A (2) +#define MCB_RST_A (0x01) +#define MCI_RST_A_DEF (MCB_RST_A) + +#define MCI_RST (3) +#define MCB_PSW_S (0x80) +#define MCB_PSW_M (0x40) +#define MCB_PSW_F (0x20) +#define MCB_PSW_C (0x10) +#define MCB_RST_S (0x08) +#define MCB_RST_M (0x04) +#define MCB_RST_F (0x02) +#define MCB_RST_C (0x01) +#define MCI_RST_DEF (MCB_PSW_M|MCB_RST_M \ + |MCB_PSW_F|MCB_RST_F \ + |MCB_PSW_C|MCB_RST_C) + +#define MCI_IRQ (4) +#define MCB_IRQ (0x02) +#define MCB_EIRQ (0x01) + +#define MCI_ANA_REG_A (6) +#define MCB_ANA_REG_AINC (0x80) + +#define MCI_ANA_REG_D (7) + +#define MCI_CD_REG_A (8) +#define MCB_CD_REG_AINC (0x80) + +#define MCI_CD_REG_D (9) + +#define MCI_IRQR (10) +#define MCB_IRQR (0x02) +#define MCB_EIRQR (0x01) + +#define MCI_MA_REG_A (12) +#define MCB_MA_REG_AINC (0x80) + +#define MCI_MA_REG_D (13) + +#define MCI_MB_REG_A (14) +#define MCB_MB_REG_AINC (0x80) + +#define MCI_MB_REG_D (15) + +/* IF_REG = #16: B_REG_A + + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | B_REG | B_REG_A | + | _AINC | | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ + +#define MCI_B_REG_A (16) +#define MCI_B_REG_A_DEF (0x00) +#define MCB_B_REG_AINC (0x80) +#define MCB_B_REG_A (0x7F) + +/* IF_REG = #17: B_REG_D + + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | B_REG_D[7:0] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ + +#define MCI_B_REG_D (17) +#define MCI_B_REG_D_DEF (0x00) +#define MCB_B_REG_D (0xFF) + +/* IF_REG = #18: BMAA0 + + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | "0" | "0" | "0" | "0" | "0" | "0" | "0" | BMAA | + | | | | | | | | [16] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCI_BMAA0 (18) +#define MCI_BMAA0_DEF (0x00) +#define MCB_BMAA0 (0x01) + +/* IF_REG = #19: BMAA1 + + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | BMAA[15:8] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ + +#define MCI_BMAA1 (19) +#define MCI_BMAA1_DEF (0x00) +#define MCB_BMAA1 (0xFF) + +/* IF_REG = #20: BMAA2 + + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | BMAA[7:0] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ + +#define MCI_BMAA2 (20) +#define MCI_BMAA2_DEF (0x00) +#define MCB_BMAA2 (0xFF) + +/* IF_REG = #21: BMACtl + + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | BDSPT | "0" | "0" | "0" | BMAMOD| BMADIR| BMABUS[1:0] | + | INI | | | | | | | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ + +#define MCI_BMACTL (21) +#define MCI_BMACTL_DEF (0x00) +#define MCB_BDSPTINI (0x80) +#define MCB_BMAMOD (0x08) +#define MCB_BMAMOD_DMA (0x00) +#define MCB_BMAMOD_DSP (0x08) +#define MCB_BMADIR (0x04) +#define MCB_BMADIR_DL (0x00) +#define MCB_BMADIR_UL (0x04) +#define MCB_BMABUS (0x03) +#define MCB_BMABUS_I (0x02) +#define MCB_BMABUS_Y (0x01) +#define MCB_BMABUS_X (0x00) + +/* IF_REG = #22: BMADat + + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | BMAD[7:0] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ + +#define MCI_BMAD (22) +#define MCI_BMAD_DEF (0x00) +#define MCB_BMAD (0xFF) + +/* IF_REG = #23: BDSPTReq + + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | BDSP | "0" | "0" | "0" | "0" | "0" | "0" | "0" | + | TREQ | | | | | | | | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ + +#define MCI_BDSPTREQ (23) +#define MCI_BDSPTREQ_DEF (0x00) +#define MCB_BDSPTREQ (0x80) + +/* IF_REG = #24: BDSPTCNT + + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | "0" | "0" | "0" | "0" | BDSPTCNT[3:0] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ + +#define MCI_BDSP_TCNT (24) +#define MCI_BDSP_TCNT_DEF (0x00) +#define MCB_BDSP_TCNT (0x0F) + + +/* IF_REG = #32: E_REG_A + + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | E_REG | E_REG_A[6:0] | + | _AINC | | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ + +#define MCI_E_REG_A (32) +#define MCI_E_REG_A_DEF (0x00) +#define MCB_E_REG_AINC (0x80) +#define MCB_E_REG_A (0x7F) + +/* IF_REG = #33: E_REG_D + + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | E_REG_D[7:0] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ + +#define MCI_E_REG_D (33) +#define MCI_E_REG_D_DEF (0x00) +#define MCB_E_REG_D (0xFF) + +/* IF_REG = #34: EDSP_FW_PAGE + + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | EDSP_FW_PAGE[2:0] | "0" | "0" | "0" |EDSP_FW| + | | | | | _A[8] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ + +#define MCI_EDSP_FW_PAGE (34) +#define MCI_EDSP_FW_PAGE_DEF (0x00) +#define MCB_EDSP_FW_PAGE (0x70) +#define MCB_EDSP_FW_PAGE_E2IMEM (0x10) +#define MCB_EDSP_FW_PAGE_SYSEQ0 (0x20) +#define MCB_EDSP_FW_PAGE_SYSEQ1 (0x30) +#define MCB_EDSP_FW_PAGE_E2YMEM (0x40) +#define MCB_EDSP_FW_PAGE_E2XMEM (0x60) +#define MCB_EDSP_FW_PAGE_SYSEQ0_B0 (0x20) +#define MCB_EDSP_FW_PAGE_SYSEQ1_B0 (0x30) +#define MCB_EDSP_FW_PAGE_SYSEQ0_B1 (0x80) +#define MCB_EDSP_FW_PAGE_SYSEQ1_B1 (0x90) +#define MCB_EDSP_FW_PAGE_SYSEQ0_B2 (0xa0) +#define MCB_EDSP_FW_PAGE_SYSEQ1_B2 (0xb0) +#define MCB_EDSP_FW_A_8 (0x01) + +/* IF_REG = #35: EDSP_FW_A + + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | EDSP_FW_A[7:0] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ + +#define MCI_EDSP_FW_A (35) +#define MCI_EDSP_FW_A_DEF (0x00) +#define MCB_EDSP_FW_A (0xFF) + +/* IF_REG = #36: EDSP_FW_D + + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | EDSP_FW_D[7:0] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ + +#define MCI_EDSP_FW_D (36) +#define MCI_EDSP_FW_D_DEF (0x00) +#define MCB_EDSP_FW_D (0xFF) + +/* IF_REG = #37: EDSP_IRQ_CTRL + + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | "0" | "0" | EE2DSP| EE2DSP| "0" | "0" | EE1DSP| EE1DSP| + | | | _OV | _STA | | | _OV | _STA | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ + +#define MCI_EEDSP (37) +#define MCI_EEDSP_DEF (0x00) +#define MCB_EE2DSP_OV (0x20) +#define MCB_EE2DSP (0x10) +#define MCB_EE1DSP_OV (0x02) +#define MCB_EE1DSP (0x01) + +/* IF_REG = #38: EDSP_IRQ_FLAG + + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | "0" | "0" | E2DSP | E2DSP | "0" | "0" | E1DSP | E1DSP | + | | | _OV | _STA | | | _OV | _STA | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ + +#define MCI_EDSP (38) +#define MCI_EDSP_DEF (0x00) +#define MCB_E2DSP_OV (0x20) +#define MCB_E2DSP_STA (0x10) +#define MCB_E1DSP_OV (0x02) +#define MCB_E1DSP_STA (0x01) + +#define MCI_C_REG_A (40) + +#define MCI_C_REG_D (41) + +#define MCI_DEC_FIFO (42) + +/* IF_ADR = #43: decoder IRQ control register + + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | ECDSP | EFFIFO| ERFIFO| EEFIFO| EOFIFO| EDFIFO| EENC | EDEC | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ + +#define MCI_ECDSP (43) +#define MCB_ECDSP (0x80) +#define MCB_EFFIFO (0x40) +#define MCB_ERFIFO (0x20) +#define MCB_EEFIFO (0x10) +#define MCB_EOFIFO (0x08) +#define MCB_EDFIFO (0x04) +#define MCB_EENC (0x02) +#define MCB_EDEC (0x01) + +/* IF_ADR = #44: decoder IRQ Flag register + + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | CDSP | FFIFO | RFIFO | EFIFO | OFIFO | DFIFO | ENC | DEC | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ + +#define MCI_CDSP (44) +#define MCB_IRQFLAG_CDSP (0x80) +#define MCB_IRQFLAG_FFIFO (0x40) +#define MCB_IRQFLAG_RFIFO (0x20) +#define MCB_IRQFLAG_EFIFO (0x10) +#define MCB_IRQFLAG_OFIFO (0x08) +#define MCB_IRQFLAG_DFIFO (0x04) +#define MCB_IRQFLAG_ENC (0x02) +#define MCB_IRQFLAG_DEC (0x01) +#define MCB_IRQFLAG_CDSP_ALL (0xFF) + +/* IF_ADR = #45: FFIFO register + + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W | FSQ_FIFO[7:0] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ + +#define MCI_FSQ_FFIFO (45) + +/* IF_ADR = #48: F_REG_A register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | F_REG | F_REG_A[6:0] | + | AINC | | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ + +#define MCI_F_REG_A (48) +#define MCI_F_REG_A_DEF (0x00) +#define MCB_F_REG_AINC (0x80) +#define MCB_F_REG_A (0x7F) + +/* IF_ADR = #49: F_REG_D register + + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | F_REG_D[7:0] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ + +#define MCI_F_REG_D (49) +#define MCI_F_REG_D_DEF (0x00) +#define MCB_F_REG_D (0xFF) + +/* IF_ADR = #50: FMAA + + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | "0" | "0" | "0" | "0" | FMAA[19:16] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ + +#define MCI_FMAA_19_16 (50) +#define MCI_FMAA_19_16_DEF (0x00) +#define MCB_FMAA_19_16 (0x0F) + +/* IF_ADR = #51: FMAA + + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | FMAA[15:8] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ + +#define MCI_FMAA_15_8 (51) +#define MCI_FMAA_15_8_DEF (0x00) +#define MCB_FMAA_15_8 (0xFF) + +/* IF_ADR = #52: FMAA + + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | FMAA[7:0] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ + +#define MCI_FMAA_7_0 (52) +#define MCI_FMAA_7_0_DEF (0x00) +#define MCB_FMAA_7_0 (0xFF) + +/* IF_ADR = #53: FDSPTINI + + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R |DSPTINI| "0" | "0" | "0" | FMAMOD| FMADIR| FMABUS[1:0] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ + +#define MCI_FDSPTINI (53) +#define MCI_FDSPTINI_DEF (0x00) +#define MCB_DSPTINI (0x80) +#define MCB_FMAMOD (0x08) +#define MCB_FMAMOD_DMA (0x00) +#define MCB_FMAMOD_DSP (0x08) +#define MCB_FMADIR (0x04) +#define MCB_FMADIR_DL (0x00) +#define MCB_FMADIR_UL (0x04) +#define MCB_FMABUS (0x03) +#define MCB_FMABUS_I (0x02) +#define MCB_FMABUS_Y (0x01) +#define MCB_FMABUS_X (0x00) + +/* IF_ADR = #54: FMAD + + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | FMAD[7:0] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ + +#define MCI_FMAD (54) +#define MCI_FMAD_DEF (0x00) +#define MCB_FMAD (0xFF) + +/* IF_ADR = #55: DSPTReq + + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R |DSPTREQ| "0" | "0" | "0" | "0" | "0" | "0" | "0" | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ + +#define MCI_FDSPTREQ (55) +#define MCI_FDSPTREQ_DEF (0x00) +#define MCB_FDSPTREQ (0x80) + +/* IF_ADR = #57: IENB + + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | IESERR| "0" | IEAMT | IEAMT | IEFW[3:0] | + | | | BEG | END | | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ + +#define MCI_IESERR (57) +#define MCI_IESERR_DEF (0x00) +#define MCB_IESERR (0x80) +#define MCB_IEAMTBEG (0x20) +#define MCB_IEAMTEND (0x10) +#define MCB_IEFW (0x0F) +#define MCB_IEFW_STRT (0x08) +#define MCB_IEFW_TOP (0x04) +#define MCB_IEFW_APP (0x02) +#define MCB_IEFW_DSP (0x01) + +/* A_ADR = #58: IReq + + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | IRSERR| "0" | IRAMT | IRAMT | IRFW[3:0] | + | | | BEG | END | | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ + +#define MCI_IRSERR (58) +#define MCI_IRSERR_DEF (0x00) +#define MCB_IRSERR (0x80) +#define MCB_IRMTBEG (0x20) +#define MCB_IRMTEND (0x10) +#define MCB_IRFW (0x0F) +#define MCB_IRFW_STRT (0x08) +#define MCB_IRFW_TOP (0x04) +#define MCB_IRFW_APP (0x02) +#define MCB_IRFW_DSP (0x01) + + +/* A_REG */ +#define MCI_A_DEV_ID (0) + +#define MCI_CLK_MSK (1) +#define MCB_RTCI_MSK (0x04) +#define MCB_CLKI1_MSK (0x02) +#define MCB_CLKI0_MSK (0x01) +#define MCI_CLK_MSK_DEF (MCB_RTCI_MSK \ + |MCB_CLKI1_MSK \ + |MCB_CLKI0_MSK) + +#define MCI_PD (2) +#define MCB_PLL_PD (0x80) +#define MCB_ANACLK_PD (0x40) +#define MCB_PE_CLK_PD (0x20) +#define MCB_PB_CLK_PD (0x10) +#define MCB_PM_CLK_PD (0x08) +#define MCB_PF_CLK_PD (0x04) +#define MCB_PC_CLK_PD (0x02) +#define MCB_VCOOUT_PD (0x01) +#define MCI_PD_DEF (MCB_PLL_PD \ + |MCB_ANACLK_PD \ + |MCB_PE_CLK_PD \ + |MCB_PB_CLK_PD \ + |MCB_PM_CLK_PD \ + |MCB_PF_CLK_PD \ + |MCB_PC_CLK_PD \ + |MCB_VCOOUT_PD) + +#define MCI_JTAGSEL (3) +#define MCB_JTAGSEL (0x01) + +#define MCI_DO0_DRV (4) +#define MCB_DO0_DRV (0x80) +#define MCB_BCLK0_INV (0x40) +#define MCB_BCLK0_MSK (0x20) +#define MCB_BCLK0_DDR (0x10) +#define MCB_LRCK0_MSK (0x08) +#define MCB_LRCK0_DDR (0x04) +#define MCB_SDIN0_MSK (0x02) +#define MCB_SDO0_DDR (0x01) +#define MCI_DO0_DRV_DEF (MCB_BCLK0_MSK \ + |MCB_LRCK0_MSK \ + |MCB_SDIN0_MSK) + +#define MCI_DO1_DRV (5) +#define MCB_DO1_DRV (0x80) +#define MCB_BCLK1_INV (0x40) +#define MCB_BCLK1_MSK (0x20) +#define MCB_BCLK1_DDR (0x10) +#define MCB_LRCK1_MSK (0x08) +#define MCB_LRCK1_DDR (0x04) +#define MCB_SDIN1_MSK (0x02) +#define MCB_SDO1_DDR (0x01) +#define MCI_DO1_DRV_DEF (MCB_BCLK1_MSK \ + |MCB_LRCK1_MSK \ + |MCB_SDIN1_MSK) + +#define MCI_DO2_DRV (6) +#define MCB_DO2_DRV (0x80) +#define MCB_BCLK2_INV (0x40) +#define MCB_BCLK2_MSK (0x20) +#define MCB_BCLK2_DDR (0x10) +#define MCB_LRCK2_MSK (0x08) +#define MCB_LRCK2_DDR (0x04) +#define MCB_SDIN2_MSK (0x02) +#define MCB_SDO2_DDR (0x01) +#define MCI_DO2_DRV_DEF (MCB_BCLK2_MSK \ + |MCB_LRCK2_MSK \ + |MCB_SDIN2_MSK) + +#define MCI_PCMOUT_HIZ (8) +#define MCB_PDM2_DATA_DELAY (0x40) +#define MCB_PDM1_DATA_DELAY (0x20) +#define MCB_PDM0_DATA_DELAY (0x10) +#define MCB_PCMOUT2_HIZ (0x04) +#define MCB_PCMOUT1_HIZ (0x02) +#define MCB_PCMOUT0_HIZ (0x01) + +#define MCI_PA0 (9) +#define MCB_PA0_OUT (0x80) +#define MCB_PA0_DDR (0x20) +#define MCB_PA0_DATA (0x10) +#define MCB_PA0_OUTSEL (0x04) +#define MCB_PA0_MSK (0x02) +#define MCB_PA0_INV (0x01) +#define MCI_PA0_DEF (MCB_PA0_MSK) + +#define MCI_PA1 (10) +#define MCB_PA1_DDR (0x20) +#define MCB_PA1_DATA (0x10) +#define MCB_PA1_OUTSEL (0x04) +#define MCB_PA1_MSK (0x02) +#define MCB_PA1_INV (0x01) +#define MCI_PA1_DEF (MCB_PA1_MSK) + +#define MCI_PA2 (11) +#define MCB_PA2_DDR (0x20) +#define MCB_PA2_DATA (0x10) +#define MCB_PA2_OUTSEL (0x04) +#define MCB_PA2_MSK (0x02) +#define MCB_PA2_INV (0x01) +#define MCI_PA2_DEF (MCB_PA2_MSK) + +#define MCI_DOA_DRV (12) +#define MCI_DOA_DRV_DEF (0x80) + +#define MCI_LP0_FP (13) +#define MCI_LP0_FP_DEF (0x00) + +#define MCI_LP1_FP (14) +#define MCI_LP1_FP_DEF (0x01) + +#define MCI_LP2_FP (15) +#define MCI_LP2_FP_DEF (0x02) + +#define MCI_LP3_FP (16) +#define MCI_LP3_FP_DEF (0x03) + +#define MCI_CK_TCX0 (17) + +#define MCI_CLKSRC (18) +#define MCB_CLKBUSY (0x80) +#define MCB_CLKSRC (0x20) +#define MCB_CLK_INPUT (0x10) +#define MCI_CLKSRC_DEF (0x04) + +#define MCI_FREQ73M (19) +#define MCI_FREQ73M_DEF (0x00) + +#define MCI_PLL_MODE_A (24) +#define MCI_PLL_MODE_A_DEF (0x04) + +#define MCI_PLL_PREDIV_A (25) + +#define MCI_PLL_FBDIV_A_12_8 (26) +#define MCI_PLL_FBDIV_A_7_0 (27) + +#define MCI_PLL_FRAC_A_15_8 (28) +#define MCI_PLL_FRAC_A_7_0 (29) + +#define MCI_PLL_FOUT_A (30) +#define MCB_PLL_FOUT_A (0x02) + +#define MCI_PLL_MODE_B (40) +#define MCI_PLL_MODE_B_DEF (0x04) + +#define MCI_PLL_PREDIV_B (41) + +#define MCI_PLL_FBDIV_B_12_8 (42) +#define MCI_PLL_FBDIV_B_7_0 (43) + +#define MCI_PLL_FRAC_B_15_8 (44) +#define MCI_PLL_FRAC_B_7_0 (45) + +#define MCI_PLL_FOUT_B (46) +#define MCB_PLL_FOUT_B (0x02) + +#define MCI_SCKMSKON_B (67) + + +/* MA_REG */ +#define MCI_DIFI_VFLAG (0) +#define MCB_DIFI3_VFLAG1 (0x80) +#define MCB_DIFI3_VFLAG0 (0x40) +#define MCB_DIFI2_VFLAG1 (0x20) +#define MCB_DIFI2_VFLAG0 (0x10) +#define MCB_DIFI1_VFLAG1 (0x08) +#define MCB_DIFI1_VFLAG0 (0x04) +#define MCB_DIFI0_VFLAG1 (0x02) +#define MCB_DIFI0_VFLAG0 (0x01) + +#define MCI_ADI_VFLAG (1) +#define MCB_ADI2_VFLAG1 (0x20) +#define MCB_ADI2_VFLAG0 (0x10) +#define MCB_ADI1_VFLAG1 (0x08) +#define MCB_ADI1_VFLAG0 (0x04) +#define MCB_ADI0_VFLAG1 (0x02) +#define MCB_ADI0_VFLAG0 (0x01) + +#define MCI_DIFO_VFLAG (2) +#define MCB_DIFO3_VFLAG1 (0x80) +#define MCB_DIFO3_VFLAG0 (0x40) +#define MCB_DIFO2_VFLAG1 (0x20) +#define MCB_DIFO2_VFLAG0 (0x10) +#define MCB_DIFO1_VFLAG1 (0x08) +#define MCB_DIFO1_VFLAG0 (0x04) +#define MCB_DIFO0_VFLAG1 (0x02) +#define MCB_DIFO0_VFLAG0 (0x01) + +#define MCI_DAO_VFLAG (3) +#define MCB_DAO1_VFLAG1 (0x08) +#define MCB_DAO1_VFLAG0 (0x04) +#define MCB_DAO0_VFLAG1 (0x02) +#define MCB_DAO0_VFLAG0 (0x01) + +#define MCI_I_VINTP (4) +#define MCB_ADI2_VINTP (0x40) +#define MCB_ADI1_VINTP (0x20) +#define MCB_ADI0_VINTP (0x10) +#define MCB_DIFI3_VINTP (0x08) +#define MCB_DIFI2_VINTP (0x04) +#define MCB_DIFI1_VINTP (0x02) +#define MCB_DIFI0_VINTP (0x01) +#define MCI_I_VINTP_DEF (MCB_ADI2_VINTP \ + |MCB_ADI1_VINTP \ + |MCB_ADI0_VINTP \ + |MCB_DIFI3_VINTP \ + |MCB_DIFI2_VINTP \ + |MCB_DIFI1_VINTP \ + |MCB_DIFI0_VINTP) + +#define MCI_O_VINTP (5) +#define MCB_DAO1_VINTP (0x20) +#define MCB_DAOO_VINTP (0x10) +#define MCB_DIFO3_VINTP (0x08) +#define MCB_DIFO2_VINTP (0x04) +#define MCB_DIFO1_VINTP (0x02) +#define MCB_DIFO0_VINTP (0x01) +#define MCI_O_VINTP_DEF (MCB_DAO1_VINTP \ + |MCB_DAOO_VINTP \ + |MCB_DIFO3_VINTP \ + |MCB_DIFO2_VINTP \ + |MCB_DIFO1_VINTP \ + |MCB_DIFO0_VINTP) + +#define MCI_DIFI0_VOL0 (6) +#define MCB_DIFI0_VSEP (0x80) + +#define MCI_DIFI0_VOL1 (7) + +#define MCI_DIFI1_VOL0 (8) +#define MCB_DIFI1_VSEP (0x80) + +#define MCI_DIFI1_VOL1 (9) + +#define MCI_DIFI2_VOL0 (10) +#define MCB_DIFI2_VSEP (0x80) + +#define MCI_DIFI2_VOL1 (11) + +#define MCI_DIFI3_VOL0 (12) +#define MCB_DIFI3_VSEP (0x80) + +#define MCI_DIFI3_VOL1 (13) + +#define MCI_ADI0_VOL0 (14) +#define MCB_ADI0_VSEP (0x80) + +#define MCI_ADI0_VOL1 (15) + +#define MCI_ADI1_VOL0 (16) +#define MCB_ADI1_VSEP (0x80) + +#define MCI_ADI1_VOL1 (17) + +#define MCI_ADI2_VOL0 (18) +#define MCB_ADI2_VSEP (0x80) + +#define MCI_ADI2_VOL1 (19) + +#define MCI_DIFO0_VOL0 (20) +#define MCB_DIFO0_VSEP (0x80) + +#define MCI_DIFO0_VOL1 (21) + +#define MCI_DIFO1_VOL0 (22) +#define MCB_DIFO1_VSEP (0x80) + +#define MCI_DIFO1_VOL1 (23) + +#define MCI_DIFO2_VOL0 (24) +#define MCB_DIFO2_VSEP (0x80) + +#define MCI_DIFO2_VOL1 (25) + +#define MCI_DIFO3_VOL0 (26) +#define MCB_DIFO3_VSEP (0x80) + +#define MCI_DIFO3_VOL1 (27) + +#define MCI_DAO0_VOL0 (28) +#define MCB_DAO0_VSEP (0x80) + +#define MCI_DAO0_VOL1 (29) + +#define MCI_DAO1_VOL0 (30) +#define MCB_DAO1_VSEP (0x80) + +#define MCI_DAO1_VOL1 (31) + +#define MCI_ADI_SWAP (32) + +#define MCI_ADI2_SWAP (33) + +#define MCI_DAO_SWAP (34) + +#define MCI_IN0_MIX0 (35) +#define MCB_IN0_MSEP (0x80) + +#define MCI_IN0_MIX1 (36) + +#define MCI_IN1_MIX0 (37) +#define MCB_IN1_MSEP (0x80) + +#define MCI_IN1_MIX1 (38) + +#define MCI_IN2_MIX0 (39) +#define MCB_IN2_MSEP (0x80) + +#define MCI_IN2_MIX1 (40) + +#define MCI_IN3_MIX0 (41) +#define MCB_IN3_MSEP (0x80) + +#define MCI_IN3_MIX1 (42) + +#define MCI_OUT0_MIX0_10_8 (43) +#define MCB_OUT0_MSEP (0x80) + +#define MCI_OUT0_MIX0_7_0 (44) + +#define MCI_OUT0_MIX1_10_8 (45) + +#define MCI_OUT0_MIX1_7_0 (46) + +#define MCI_OUT1_MIX0_10_8 (47) +#define MCB_OUT1_MSEP (0x80) + +#define MCI_OUT1_MIX0_7_0 (48) + +#define MCI_OUT1_MIX1_10_8 (49) + +#define MCI_OUT1_MIX1_7_0 (50) + +#define MCI_OUT2_MIX0_10_8 (51) +#define MCB_OUT2_MSEP (0x80) + +#define MCI_OUT2_MIX0_7_0 (52) + +#define MCI_OUT2_MIX1_10_8 (53) + +#define MCI_OUT2_MIX1_7_0 (54) + +#define MCI_OUT3_MIX0_10_8 (55) +#define MCB_OUT3_MSEP (0x80) + +#define MCI_OUT3_MIX0_7_0 (56) + +#define MCI_OUT3_MIX1_10_8 (57) + +#define MCI_OUT3_MIX1_7_0 (58) + +#define MCI_OUT4_MIX0_10_8 (59) +#define MCB_OUT4_MSEP (0x80) + +#define MCI_OUT4_MIX0_7_0 (60) + +#define MCI_OUT4_MIX1_10_8 (61) + +#define MCI_OUT4_MIX1_7_0 (62) + +#define MCI_OUT5_MIX0_10_8 (63) +#define MCB_OUT5_MSEP (0x80) + +#define MCI_OUT5_MIX0_7_0 (64) + +#define MCI_OUT5_MIX1_10_8 (65) + +#define MCI_OUT5_MIX1_7_0 (66) + +#define MCI_DSP_START (67) +#define MCB_DSP_START (0x01) + +#define MCI_SPATH_ON (68) +#define MCB_SPATH_ON (0x80) +#define MCB_IN_MIX_ON (0x40) +#define MCB_OUT_MIX_ON_5 (1<<5) +#define MCB_OUT_MIX_ON_4 (1<<4) +#define MCB_OUT_MIX_ON_3 (1<<3) +#define MCB_OUT_MIX_ON_2 (1<<2) +#define MCB_OUT_MIX_ON_1 (1<<1) +#define MCB_OUT_MIX_ON_0 (1<<0) + +#define MCI_CLK_SEL (70) + +#define MCI_LINK_LOCK (71) +#define MCB_LINK_LOCK (0x80) + +#define MCI_FDSP_PI_SOURCE (80) +#define MCB_FDSP_PI_SOURCE_AE (0x00) +#define MCB_FDSP_PI_SOURCE_VDSP (0x07) +#define MCB_FDSP_PI_SOURCE_VDSP_Ex (0xF) +#define MCB_FDSP_EX_SYNC (0x80) + +#define MCI_FDSP_PO_SOURCE (81) +#define MCB_FDSP_PO_SOURCE_AE (0x00) +#define MCB_FDSP_PO_SOURCE_VDSP (0x07) +#define MCB_FDSP_PO_SOURCE_VDSP_Ex (0x3F) +#define MCB_FDSP_PO_SOURCE_MASK (0x3F) + +#define MCI_BDSP_SOURCE (82) + +#define MCI_SRC_VSOURCE (83) + +#define MCI_LPT2_MIX_VOL (84) + + +/* MB_REG */ +#define MCI_LP0_MODE (0) +#define MCB_LP0_STMODE (0x80) +#define MCB_LP0_AUTO_FS (0x40) +#define MCB_LP0_SRC_THRU (0x20) +#define MCB_LPT0_EDGE (0x10) +#define MCB_LP0_MODE (0x01) +#define MCI_LP0_MODE_DEF (MCB_LP0_AUTO_FS) + +#define MCI_LP0_BCK (1) + +#define MCI_LPR0_SLOT (2) +#define MCI_LPR0_SLOT_DEF (0x24) + +#define MCI_LPR0_SWAP (3) + +#define MCI_LPT0_SLOT (4) +#define MCI_LPT0_SLOT_DEF (0x24) + +#define MCI_LPT0_SWAP (5) + +#define MCI_LP0_FMT (6) + +#define MCI_LP0_PCM (7) + +#define MCI_LPR0_PCM (8) +#define MCB_LPR0_PCM_MONO (0x80) +#define MCI_LPR0_PCM_DEF (MCB_LPR0_PCM_MONO) + +#define MCI_LPT0_PCM (9) +#define MCB_LPT0_PCM_MONO (0x80) +#define MCI_LPT0_PCM_DEF (MCB_LPT0_PCM_MONO) + +#define MCI_LP0_START (10) +#define MCB_LP0_TIM_START (0x80) +#define MCB_LPR0_STOP_EN (0x20) +#define MCB_LPT0_STOP_EN (0x10) +#define MCB_LPR0_START_SRC (0x08) +#define MCB_LPR0_START (0x04) +#define MCB_LPT0_START_SRC (0x02) +#define MCB_LPT0_START (0x01) + +#define MCI_LP1_MODE (16) +#define MCB_LP1_STMODE (0x80) +#define MCB_LP1_AUTO_FS (0x40) +#define MCB_LP1_SRC_THRU (0x20) +#define MCB_LP1_MODE (0x01) +#define MCI_LP1_MODE_DEF (MCB_LP1_AUTO_FS) + +#define MCI_LP1_BCK (17) + +#define MCI_LPR1_SWAP (19) + +#define MCI_LPT1_SWAP (21) + +#define MCI_LP1_FMT (22) + +#define MCI_LP1_PCM (23) + +#define MCI_LPR1_PCM (24) +#define MCB_LPR1_PCM_MONO (0x80) +#define MCI_LPR1_PCM_DEF (MCB_LPR1_PCM_MONO) + +#define MCI_LPT1_PCM (25) +#define MCB_LPT1_PCM_MONO (0x80) +#define MCI_LPT1_PCM_DEF (MCB_LPT1_PCM_MONO) + +#define MCI_LP1_START (26) +#define MCB_LP1_TIM_START (0x80) +#define MCB_LPR1_STOP_EN (0x20) +#define MCB_LPT1_STOP_EN (0x10) +#define MCB_LPR1_START_SRC (0x08) +#define MCB_LPR1_START (0x04) +#define MCB_LPT1_START_SRC (0x02) +#define MCB_LPT1_START (0x01) + +#define MCI_LP2_MODE (32) +#define MCB_LP2_STMODE (0x80) +#define MCB_LP2_AUTO_FS (0x40) +#define MCB_LP2_SRC_THRU (0x20) +#define MCB_LP2_MODE (0x01) +#define MCI_LP2_MODE_DEF (MCB_LP2_AUTO_FS) + +#define MCI_LP2_BCK (33) + +#define MCI_LPR2_SWAP (35) + +#define MCI_LPT2_SWAP (37) + +#define MCI_LP2_FMT (38) + +#define MCI_LP2_PCM (39) + +#define MCI_LPR2_PCM (40) +#define MCB_LPR2_PCM_MONO (0x80) +#define MCI_LPR2_PCM_DEF (MCB_LPR2_PCM_MONO) + +#define MCI_LPT2_PCM (41) +#define MCB_LPT2_PCM_MONO (0x80) +#define MCI_LPT2_PCM_DEF (MCB_LPT2_PCM_MONO) + +#define MCI_LP2_START (42) +#define MCB_LP2_TIM_START (0x80) +#define MCB_LPR2_STOP_EN (0x20) +#define MCB_LPT2_STOP_EN (0x10) +#define MCB_LPR2_START_SRC (0x08) +#define MCB_LPR2_START (0x04) +#define MCB_LPT2_START_SRC (0x02) +#define MCB_LPT2_START (0x01) + +#define MCI_SRC3 (43) + +#define MCI_SRC3_START (44) +#define MCB_SRC3_TIM_START (0x80) +#define MCB_ISRC3_START (0x08) +#define MCB_OSRC3_START (0x02) + +#define MCI_LPT3_STMODE (48) + +#define MCI_LP3_BCK (49) + +#define MCI_LPR3_SWAP (51) + +#define MCI_LPT3_SWAP (53) + +#define MCI_LP3_FMT (54) + +#define MCI_LP3_START (58) +#define MCB_LP3_TIM_START (0x80) +#define MCB_LPR3_STOP_EN (0x08) +#define MCB_LPR3_START (0x04) +#define MCB_LPT3_STOP_EN (0x02) +#define MCB_LPT3_START (0x01) + +#define MCI_T_DPLL_FAST (85) +#define MCB_T_DPLL_FAST (0x80) +#define MCB_VOLREL_TIME (0x20) + +/* B_REG */ +/* B_REG = #0: DSPCtl + + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | DSP | "0" | "0" | "0" | "0" | "0" | "0" | DSP | + | BYPASS| | | | | | | START | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ + +#define MCI_BDSPCTRL (0x00) +#define MCI_BDSPCTRL_DEF (0x00) +#define MCB_BDSPBYPASS (0x80) +#define MCB_BDSPSTART (0x01) + +/* B_REG = #1: State0 + + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | OVER | "0" | "0" | "0" | "0" | LOAD[10:8] | + | LOAD | | | | | | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ + +#define MCI_STATE0 (0x01) +#define MCI_STATE0_DEF (0x00) +#define MCB_OVERLOAD (0x80) +#define MCB_LOAD0 (0x07) + +/* B_REG = #2: State1 + + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | LOAD[7:0] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ + +#define MCI_STATE1 (0x02) +#define MCI_STATE1_DEF (0x00) +#define MCB_LOAD1 (0xFF) + +/* B_REG = #64: FWCTRL0 (AEExec0) + + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | GEN | "0" | EQ3_0B| DRC_0 | DRC3 | EQ3_0A| HEX | WIDE | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ + +#define MCI_FWCTL0 (64) +#define MCI_AEEXEC0 MCI_FWCTL0 +#define MCI_AEEXEC0_DEF (0x00) +#define MCB_AEEXEC0_GEN (0x80) +#define MCB_AEEXEC0_EQ3_0B (0x20) +#define MCB_AEEXEC0_DRC_0 (0x10) +#define MCB_AEEXEC0_DRC3 (0x08) +#define MCB_AEEXEC0_EQ3_0A (0x04) +#define MCB_AEEXEC0_HEX (0x02) +#define MCB_AEEXEC0_WIDE (0x01) + +/* B_REG = #65: FWCTRL1 (AEExec1) + + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | "0" | "0" | EQ3_1B| DRC_1 | AGC | EQ3_1A| "0" | "0" | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ + +#define MCI_FWCTL1 (65) +#define MCI_AEEXEC1 MCI_FWCTL1 +#define MCI_AEEXEC1_DEF (0x00) +#define MCB_AEEXEC1_EQ3_1B (0x20) +#define MCB_AEEXEC1_DRC_1 (0x10) +#define MCB_AEEXEC1_AGC (0x08) +#define MCB_AEEXEC1_EQ3_1A (0x04) + + +/* B_REG = #66: FWCTRL2 (AEBypass) + + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | "0" | "0" | "0" | "0" | "0" | "0" | AE1 | AE0 | + | | | | | | | BYPASS| BYPASS| + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ + +#define MCI_FWCTL2 (66) +#define MCI_AEBYPASS MCI_FWCTL2 +#define MCI_AEBYPASS_DEF (0x00) +#define MCB_AEBYPASS_AE1 (0x02) +#define MCB_AEBYPASS_AE0 (0x01) + +/* B_REG = #67: FWCTRL3 (AEFade) + + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ + R | "0" | "0" | "0" | "0" | "0" | "0" | AE1 | AE0 | + | | | | | | | FADE | FADE | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ + +#define MCI_FWCTL3 (67) +#define MCI_AEFADE MCI_FWCTL3 +#define MCI_AEFADE_DEF (0x00) +#define MCB_AEFADE_AE1 (0x02) +#define MCB_AEFADE_AE0 (0x01) + +/* B_REG = #68: FWCTRL4 (F0/1SEL) + + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | "0" | "0" | F1SEL[1:0] | "0" | "0" | F0SEL[1:0] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ + +#define MCI_FWCTL4 (68) +#define MCI_F01SEL MCI_FWCTL4 +#define MCI_F01SEL_DEF (0x00) +#define MCB_F1SEL (0x30) +#define MCB_F0SEL (0x03) + +/* B_REG = #69: FWCTRL5 (SinOut) + + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | "0" | "0" | "0" | "0" | "0" | "0" | "0" | SIN | + | | | | | | | | OUT | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ + +#define MCI_FWCTL5 (69) +#define MCI_SINOUT MCI_FWCTL5 +#define MCI_SINOUT_DEF (0x00) +#define MCB_SINOUT (0x01) + +/* B_REG = #70: FWCTRL6 (SinOutFlg) + + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | "0" | "0" | "0" | "0" | "0" | "0" | "0" | SIN | + | | | | | | | | OFLG | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ + +#define MCI_FWCTL6 (70) +#define MCI_SINOUTFLG MCI_FWCTL6 +#define MCI_SINOUTFLG_DEF (0x00) +#define MCB_SINOFLG (0x01) + +/* B_REG = #71: FWCTRL7 (No Used) + + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | "0" | "0" | "0" | "0" | "0" | "0" | "0" | "0" | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ + +#define MCI_FWCTL7 (71) + +/* E_REG */ +/* E_REG = #0: E1DSP_CTRL + + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | E1DSP | "0" | "0" | "0" | "0" | "0" | "0" | E1DSP | + | _HALT | | | | | | | _RST | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ + +#define MCI_E1DSP_CTRL (0) +#define MCB_E1DSP_HALT (0x80) +#define MCB_E1DSP_RST (0x01) +#define MCI_E1DSP_CTRL_DEF (MCB_E1DSP_RST) + +/* E_REG = #1: E1COMMAND/E1STATUS + + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W | E1COMMAND | + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | E1STATUS | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ + +#define MCI_E1COMMAND (1) +#define MCI_E1STATUS (1) +#define MCI_E1COMMAND_DEF (0x00) +#define MCI_E1STATUS_DEF (0x00) +#define MCB_E1COMMAND (0xFF) +#define MCB_E1STATUS (0xFF) +#define E1COMMAND_RUN_MODE (0x40) +#define E1COMMAND_OFFSET_CANCEL (0x02) +#define E1COMMAND_IMP_SENSE (0x04) +#define E1COMMAND_WAIT (0x08) +#define E1COMMAND_PD (0x10) +#define E1COMMAND_GND_DET (0x20) +#define E1COMMAND_ADDITIONAL (0x80) +#define E1COMMAND_SLEEP_MODE (0x00) + +#define MCI_LPF_THR (2) +#define MCB_LPF1_PST_THR (0x80) +#define MCB_LPF0_PST_THR (0x40) +#define MCB_LPF1_PRE_THR (0x20) +#define MCB_LPF0_PRE_THR (0x10) +#define MCB_OSF1_MN (0x08) +#define MCB_OSF0_MN (0x04) +#define MCB_OSF1_ENB (0x02) +#define MCB_OSF0_ENB (0x01) +#define MCI_LPF_THR_DEF (MCB_LPF0_PST_THR|MCB_LPF0_PRE_THR) + +#define MCI_DAC_DCC_SEL (3) +#define MCI_DAC_DCC_SEL_DEF (0x0A) + +#define MCI_DET_LVL (4) + +#define MCI_ECLK_SEL (6) + +#define MCI_OSF_SEL (8) +#define MCI_OSF_SEL_DEF (0x0F) + +#define MCI_SYSEQ (9) +#define MCB_SYSEQ_SYSEQ1_ENB (0x02) +#define MCB_SYSEQ_SYSEQ0_ENB (0x01) +#define MCB_SYSEQ_SYSEQ1_B2_ENB (0x40) +#define MCB_SYSEQ_SYSEQ1_B1_ENB (0x20) +#define MCB_SYSEQ_SYSEQ1_B0_ENB (0x10) +#define MCB_SYSEQ_SYSEQ0_B2_ENB (0x04) +#define MCB_SYSEQ_SYSEQ0_B1_ENB (0x02) +#define MCB_SYSEQ_SYSEQ0_B0_ENB (0x01) +#define MCI_SYSEQ_DEF (0x00) + +#define MCI_CLIP_MD (10) + +#define MCI_CLIP_ATT (11) + +#define MCI_CLIP_REL (12) + +#define MCI_CLIP_G (13) + +#define MCI_OSF_GAIN0_15_8 (14) +#define MCI_OSF_GAIN0_15_8_DEF (0x40) +#define MCI_OSF_GAIN0_7_0 (15) +#define MCI_OSF_GAIN0_7_0_DEF (0x00) + +#define MCI_OSF_GAIN1_15_8 (16) +#define MCI_OSF_GAIN1_15_8_DEF (0x40) +#define MCI_OSF_GAIN1_7_0 (17) +#define MCI_OSF_GAIN1_7_0_DEF (0x00) + +#define MCI_DCL_GAIN (18) +#define MCB_DCL1_OFF (0x80) +#define MCB_DCL0_OFF (0x08) + +#define MCI_DCL0_LMT_14_8 (19) +#define MCI_DCL0_LMT_14_8_DEF (0x7F) +#define MCI_DCL0_LMT_7_0 (20) +#define MCI_DCL0_LMT_7_0_DEF (0xFF) + +#define MCI_DCL1_LMT_14_8 (21) +#define MCI_DCL1_LMT_14_8_DEF (0x7F) +#define MCI_DCL1_LMT_7_0 (22) +#define MCI_DCL1_LMT_7_0_DEF (0xFF) + +#define MCI_DITHER0 (23) +#define MCI_DITHER0_DEF (0x50) + +#define MCI_DITHER1 (24) +#define MCI_DITHER1_DEF (0x50) + +#define MCI_DNG0_ES1 (25) +#define MCI_DNG0_DEF_ES1 (0xC9) + +#define MCI_DNG1_ES1 (26) +#define MCI_DNG1_DEF_ES1 (0xC9) + +#define MCI_DNG_ON_ES1 (27) + +#define MCI_DIRECTPATH_ENB (28) +#define MCB_DIRECTPATH_ENB (0x01) +#define MCB_DIRECT_ENB_ADC (0x04) +#define MCB_DIRECT_ENB_DAC1 (0x02) +#define MCB_DIRECT_ENB_DAC0 (0x01) + +#define MCI_DPATH_DA_V (29) +#define MCB_DPATH_DA_VFLAG (0x02) +#define MCB_DPATH_DA_VINTP (0x01) +#define MCI_DPATH_DA_V_DEF (MCB_DPATH_DA_VFLAG|MCB_DPATH_DA_VINTP) + +#define MCI_DPATH_DA_VOL_L (30) +#define MCB_DPATH_DA_VSEP (0x80) + +#define MCI_DPATH_DA_VOL_R (31) + +#define MCI_DPATH_AD_V (32) +#define MCB_DPATH_AD_VFLAG (0x02) +#define MCB_DPATH_AD_VINTP (0x01) +#define MCI_DPATH_AD_V_DEF (MCB_DPATH_AD_VFLAG|MCB_DPATH_AD_VINTP) + +#define MCI_DPATH_AD_VOL_L (33) +#define MCB_DPATH_AD_VSEP (0x80) + +#define MCI_DPATH_AD_VOL_R (34) + +#define MCI_ADJ_HOLD (35) + +#define MCI_ADJ_CNT (36) + +#define MCI_ADJ_MAX_15_8 (37) +#define MCI_ADJ_MAX_7_0 (38) + +#define MCI_DSF0_FLT_TYPE (41) +#define MCB_DSF0R_PRE_FLT_TYPE (0x20) +#define MCB_DSF0L_PRE_FLT_TYPE (0x10) +#define MCB_DSF0_MN (0x02) +#define MCB_DSF0ENB (0x01) + +#define MCI_DSF0_PRE_INPUT (42) +#define MCI_DSF0_PRE_INPUT_DEF (0x10) + +#define MCI_DSF1_FLT_TYPE (43) +#define MCB_DSF1R_PRE_FLT_TYPE (0x20) +#define MCB_DSF1L_PRE_FLT_TYPE (0x10) +#define MCB_DSF1_MN (0x02) +#define MCB_DSF1ENB (0x01) +#define MCI_DSF1_FLT_TYPE_DEF (MCB_DSF1_MN) + +#define MCI_DSF1_PRE_INPUT (44) +#define MCI_DSF1_PRE_INPUT_DEF (0x22) + +#define MCI_DSF2_FLT_TYPE (45) +#define MCB_DSF2R_PRE_FLT_TYPE (0x40) +#define MCB_DSF2L_PRE_FLT_TYPE (0x10) +#define MCB_DSF2REFSEL (0x08) +#define MCB_DSF2REFBACK (0x04) +#define MCB_DSF2_MN (0x02) +#define MCB_DSF2ENB (0x01) + +#define MCI_DSF2_PRE_INPUT (46) +#define MCI_DSF2_PRE_INPUT_DEF (0x43) + +#define MCI_DSF_SEL (47) + +#define MCI_ADC_DCC_SEL (48) +#define MCI_ADC_DCC_SEL_DEF_ES1 (0x2A) +#define MCI_ADC_DCC_SEL_DEF (0x15) + +#define MCI_ADC_DNG_ON (49) + +#define MCI_ADC_DNG0_FW (50) +#define MCI_ADC_DNG0_FW_DEF (0x0B) + +#define MCI_ADC_DNG0_TIM (51) + +#define MCI_ADC_DNG0_ZERO_15_8 (52) +#define MCI_ADC_DNG0_ZERO_7_0 (53) + +#define MCI_ADC_DNG0_TGT_15_8 (54) +#define MCI_ADC_DNG0_TGT_7_0 (55) + +#define MCI_ADC_DNG1_FW (56) +#define MCI_ADC_DNG1_FW_DEF (0x0B) + +#define MCI_ADC_DNG1_TIM (57) + +#define MCI_ADC_DNG1_ZERO_15_8 (58) +#define MCI_ADC_DNG1_ZERO_7_0 (59) + +#define MCI_ADC_DNG1_TGT_15_8 (60) +#define MCI_ADC_DNG1_TGT_7_0 (61) + +#define MCI_ADC_DNG2_FW (62) +#define MCI_ADC_DNG2_FW_DEF (0x0B) + +#define MCI_ADC_DNG2_TIM (63) + +#define MCI_ADC_DNG2_ZERO_15_8 (64) +#define MCI_ADC_DNG2_ZERO_7_0 (65) + +#define MCI_ADC_DNG2_TGT_15_8 (66) +#define MCI_ADC_DNG2_TGT_7_0 (67) + +#define MCI_DEPOP0 (68) +#define MCI_DEPOP0_DEF (0x0A) + +#define MCI_DEPOP1 (69) +#define MCI_DEPOP1_DEF (0x0A) + +#define MCI_DEPOP2 (70) +#define MCI_DEPOP2_DEF (0x0A) + +#define MCI_PDM_MODE (71) +#define MCI_PDM_MODE_DEF (0x08) + +#define MCI_PDM_LOAD_TIM (72) +#define MCB_PDM1_START (0x80) +#define MCB_PDM0_START (0x08) + +#define MCI_PDM0L_FINE_DLY (73) +#define MCI_PDM0R_FINE_DLY (74) +#define MCI_PDM1L_FINE_DLY (75) +#define MCI_PDM1R_FINE_DLY (76) + +/* E_REG = #77: E2DSP_CTRL + + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | E2DSP | "0" | "0" | "0" | "0" | "0" | "0" | E2DSP | + | _HALT | | | | | | | _RST | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ + +#define MCI_E2DSP (77) +#define MCB_E2DSP_HALT (0x80) +#define MCB_E2DSP_RST (0x01) +#define MCI_E2DSP_DEF (MCB_E2DSP_RST) + +/* E_REG = #78: E2REQ_0/E2RES_0 + + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W | E2REQ_0 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | E2RES_0 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ + +#define MCI_E2REQ_0 (78) +#define MCI_E2RES_0 MCI_E2REQ_0 +#define MCI_E2REQ_0_DEF (0x00) +#define MCI_E2RES_0_DEF MCI_E2REQ_0_DEF +#define MCB_E2REQ_0 (0xFF) +#define MCB_E2RES_0 MCB_E2REQ_0 + +/* E_REG = #79: E2REQ_1/E2RES_1 + + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W | E2REQ_1 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | E2RES_1 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ + +#define MCI_E2REQ_1 (79) +#define MCI_E2RES_1 MCI_E2REQ_1 +#define MCI_E2REQ_1_DEF (0x00) +#define MCI_E2RES_1_DEF MCI_E2REQ_1_DEF +#define MCB_E2REQ_1 (0xFF) +#define MCB_E2RES_1 MCB_E2REQ_1 + +/* E_REG = #80: E2REQ_2/E2RES_2 + + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W | E2REQ_2 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | E2RES_2 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ + +#define MCI_E2REQ_2 (80) +#define MCI_E2RES_2 MCI_E2REQ_2 +#define MCI_E2REQ_2_DEF (0x00) +#define MCI_E2RES_2_DEF MCI_E2REQ_2_DEF +#define MCB_E2REQ_2 (0xFF) +#define MCB_E2RES_2 MCB_E2REQ_2 + +/* E_REG = #81: E2REQ_3/E2RES_3 + + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W | E2REQ_3 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | E2RES_3 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ + +#define MCI_E2REQ_3 (81) +#define MCI_E2RES_3 MCI_E2REQ_3 +#define MCI_E2REQ_3_DEF (0x00) +#define MCI_E2RES_3_DEF MCI_E2REQ_3_DEF +#define MCB_E2REQ_3 (0xFF) +#define MCB_E2RES_3 MCB_E2REQ_3 + +/* E_REG = #82: E2REQ_4/E2RES_4 + + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W | E2REQ_4 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | E2RES_4 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ + +#define MCI_E2REQ_4 (82) +#define MCI_E2RES_4 MCI_E2REQ_4 +#define MCI_E2REQ_4_DEF (0x00) +#define MCI_E2RES_4_DEF MCI_E2REQ_4_DEF +#define MCB_E2REQ_4 (0xFF) +#define MCB_E2RES_4 MCB_E2REQ_4 + +/* E_REG = #83: E2REQ_5/E2RES_5 + + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W | E2REQ_5 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | E2RES_5 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ + +#define MCI_E2REQ_5 (83) +#define MCI_E2RES_5 MCI_E2REQ_5 +#define MCI_E2REQ_5_DEF (0x00) +#define MCI_E2RES_5_DEF MCI_E2REQ_5_DEF +#define MCB_E2REQ_5 (0xFF) +#define MCB_E2RES_5 MCB_E2REQ_5 + +/* E_REG = #84: E2REQ_6/E2RES_6 + + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W | E2REQ_6 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | E2RES_6 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ + +#define MCI_E2REQ_6 (84) +#define MCI_E2RES_6 MCI_E2REQ_6 +#define MCI_E2REQ_6_DEF (0x00) +#define MCI_E2RES_6_DEF MCI_E2REQ_6_DEF +#define MCB_E2REQ_6 (0xFF) +#define MCB_E2RES_6 MCB_E2REQ_6 + +/* E_REG = #85: E2REQ_7/E2RES_7 + + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W | E2REQ_7 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | E2RES_7 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ + +#define MCI_E2REQ_7 (85) +#define MCI_E2RES_7 MCI_E2REQ_7 +#define MCI_E2REQ_7_DEF (0x00) +#define MCI_E2RES_7_DEF MCI_E2REQ_7_DEF +#define MCB_E2REQ_7 (0xFF) +#define MCB_E2RES_7 MCB_E2REQ_7 + +/* E_REG = #86: E2COMMAND/E2STATUS + + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W | E2COMMAND | + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | E2STATUS | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ + +#define MCI_E2COMMAND (86) +#define MCI_E2STATUS MCI_E2COMMAND +#define MCI_E2COMMAND_DEF (0x00) +#define MCI_E2STATUS_DEF MCI_E2COMMAND_DEF +#define MCB_E2COMMAND (0xFF) +#define MCB_E2STATUS MCB_E2COMMAND + +#define MCI_CH_SEL (87) +#define MCB_I2SOUT_ENB (0x20) + +#define MCI_IMPSEL (90) + +#define MCI_HPIMP_15_8 (91) +#define MCI_HPIMP_7_0 (92) + +#define MCI_PLUG_REV (93) + +#define MCI_E2_SEL (94) + +#define MCI_DNG0 (96) +#define MCI_DNG0_DEF (0xC9) + +#define MCI_DNG1 (97) +#define MCI_DNG1_DEF (0xC9) + +#define MCI_DNG_ON (98) + + +/* C_REG */ +/* C_REG = #0: power management digital (CDSP) register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | CDSP_ | "0" | "0" | "0" | "0" | "0" | "0" | "0" | + |SAVEOFF| | | | | | | | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_PWM_CDSP_SAVEOFF (0x80) +#define MCI_PWM_DIGITAL_CDSP (0) + +/* C_REG = #1: CDSP input/output FIFO level (1) register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | OFIFO_LVL | DFIFO_LVL | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_DEC_OFIFO_LVL (0xF0) +#define MCB_DEC_DFIFO_LVL (0x0F) +#define MCI_DEC_FIFOLEVEL_1 (1) + +/* C_REG = #2: CDSP input/output FIFO level (2) register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | RFIFO_LVL | EFIFO_LVL | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_DEC_RFIFO_LVL (0xF0) +#define MCB_DEC_EFIFO_LVL (0x0F) +#define MCI_DEC_FIFOLEVEL_2 (2) + +/* C_REG = #3: CDSP input/output FIFO level (3) register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | "0" | "0" | "0" | "0" | FFIFO_LVL | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_DEC_FFIFO_LVL (0x0F) +#define MCI_DEC_FIFOLEVEL_3 (3) + +/* C_REG = #4: decoder play position1 register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | DEC_POS[31:24] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_DEC_POS1 (0xFF) +#define MCI_DEC_POS1 (4) + +/* C_REG = #5: decoder play position2 register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | DEC_POS[23:16] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_DEC_POS2 (0xFF) +#define MCI_DEC_POS2 (5) + +/* C_REG = #6: decoder play position3 register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | DEC_POS[15:8] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_DEC_POS3 (0xFF) +#define MCI_DEC_POS3 (6) + +/* C_REG = #7: decoder play position4 register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | DEC_POS[7:0] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_DEC_POS4 (0xFF) +#define MCI_DEC_POS4 (7) + +/* C_REG = #8: encoder play position1 register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | ENC_POS[31:24] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_ENC_POS1 (0xFF) +#define MCI_ENC_POS1 (8) + +/* C_REG = #9: encoder play position2 register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | ENC_POS[23:16] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_ENC_POS2 (0xFF) +#define MCI_ENC_POS2 (9) + +/* C_REG = #10: encoder play position3 register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | ENC_POS[15:8] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_ENC_POS3 (0xFF) +#define MCI_ENC_POS3 (10) + +/* C_REG = #11: encoder play position4 register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | ENC_POS[7:0] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_ENC_POS4 (0xFF) +#define MCI_ENC_POS4 (11) + +/* C_REG = #12: decoder error flag register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | DEC_ERR | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_DEC_ERROR (0xFF) +#define MCI_DEC_ERROR (12) + +/* C_REG = #13: encoder error flag register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | ENC_ERR | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_ENC_ERROR (0xFF) +#define MCI_ENC_ERROR (13) + +/* C_REG = #14: decoder FIFO reset register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | "0" | "0" | "0" | FFIFO | EFIFO | RFIFO | OFIFO | DFIFO | + | | | | _RST | _RST | _RST | _RST | _RST | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_DEC_FFIFO_RST (0x10) +#define MCB_DEC_EFIFO_RST (0x08) +#define MCB_DEC_RFIFO_RST (0x04) +#define MCB_DEC_OFIFO_RST (0x02) +#define MCB_DEC_DFIFO_RST (0x01) +#define MCI_DEC_FIFO_RST (14) + +/* C_REG = #15: decoder start register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R |OUT_STA| "0" | "0" | FSQ_ | ENC_ |CDSP_OU| OUT_ | DEC_ | + | RT_SEL| | | START | START |T_START| START | START | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_DEC_OUT_START_SEL (0x80) +#define MCB_DEC_FSQ_START (0x10) +#define MCB_DEC_ENC_START (0x08) +#define MCB_DEC_CDSP_OUT_START (0x04) +#define MCB_DEC_OUT_START (0x02) +#define MCB_DEC_DEC_START (0x01) +#define MCI_DEC_START (15) + +/* C_REG = #16: decoder FIFO ch setting register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | EFIFO | EFIFO | EFIFO_CH | CDSP | "0" | OFIFO_CH | + | _START| _START| | _EFIFO| | | + | _SEL | | | _START| | | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_DEC_EFIFO_START_SEL (0x80) +#define MCB_DEC_EFIFO_START (0x40) +#define MCB_DEC_EFIFO_CH (0x30) +#define MCB_DEC_EFIFO_CH_2_16 (0x00) +#define MCB_DEC_EFIFO_CH_4_16 (0x10) +#define MCB_DEC_EFIFO_CH_2_32 (0x20) +#define MCB_DEC_EFIFO_CH_4_32 (0x30) +#define MCB_DEC_CDSP_EFIFO_START (0x08) +#define MCB_DEC_OFIFO_CH (0x03) +#define MCB_DEC_OFIFO_CH_2_16 (0x00) +#define MCB_DEC_OFIFO_CH_4_16 (0x01) +#define MCB_DEC_OFIFO_CH_2_32 (0x02) +#define MCB_DEC_OFIFO_CH_4_32 (0x03) +#define MCI_DEC_FIFO_CH (16) + +/* C_REG = #17: decoder start register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R |RFIFO | "0" | "0" | "0" | "0" |CDSP |RFIFO | "0" | + | _START| | | | | _RFIFO| _START| | + | _SEL | | | | | _START| | | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_DEC_RFIFO_START_SEL (0X80) +#define MCB_DEC_CDSP_RFIFO_START (0X04) +#define MCB_RFIFO_START (0X02) +#define MCI_DEC_START2 (17) + +/* C_REG = #19: decoder control setting register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | DEC_CTL15 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_DEC_CTL15 (0xFF) +#define MCI_DEC_CTL15 (19) + +/* C_REG = #20: decoder control setting register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | DEC_CTL14 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_DEC_CTL14 (0xFF) +#define MCI_DEC_CTL14 (20) + +/* C_REG = #21: decoder control setting register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | DEC_CTL13 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_DEC_CTL13 (0xFF) +#define MCI_DEC_CTL13 (21) + +/* C_REG = #22: decoder control setting register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | DEC_CTL12 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_DEC_CTL12 (0xFF) +#define MCI_DEC_CTL12 (22) + +/* C_REG = #23: decoder control setting register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | DEC_CTL11 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_DEC_CTL11 (0xFF) +#define MCI_DEC_CTL11 (23) + +/* C_REG = #24: decoder control setting register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | DEC_CTL10 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_DEC_CTL10 (0xFF) +#define MCI_DEC_CTL10 (24) + +/* C_REG = #25: decoder control setting register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | DEC_CTL9 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_DEC_CTL9 (0xFF) +#define MCI_DEC_CTL9 (25) + +/* C_REG = #26: decoder control setting register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | DEC_CTL8 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_DEC_CTL8 (0xFF) +#define MCI_DEC_CTL8 (26) + +/* C_REG = #27: decoder control setting register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | DEC_CTL7 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_DEC_CTL7 (0xFF) +#define MCI_DEC_CTL7 (27) + +/* C_REG = #28: decoder control setting register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | DEC_CTL6 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_DEC_CTL6 (0xFF) +#define MCI_DEC_CTL6 (28) + +/* C_REG = #29: decoder control setting register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | DEC_CTL5 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_DEC_CTL5 (0xFF) +#define MCI_DEC_CTL5 (29) + +/* C_REG = #30: decoder control setting register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | DEC_CTL4 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_DEC_CTL4 (0xFF) +#define MCI_DEC_CTL4 (30) + +/* C_REG = #31: decoder control setting register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | DEC_CTL3 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_DEC_CTL3 (0xFF) +#define MCI_DEC_CTL3 (31) + +/* C_REG = #32: decoder control setting register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | DEC_CTL2 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_DEC_CTL2 (0xFF) +#define MCI_DEC_CTL2 (32) + +/* C_REG = #33: decoder control setting register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | DEC_CTL1 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_DEC_CTL1 (0xFF) +#define MCI_DEC_CTL1 (33) + +/* C_REG = #34: decoder control setting register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | DEC_CTL0 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_DEC_CTL0 (0xFF) +#define MCI_DEC_CTL0 (34) + +/* C_REG = #35: decoder general purpose register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | DEC_GPR15 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_DEC_GPR15 (0xFF) +#define MCI_DEC_GPR15 (35) + +/* C_REG = #36: decoder general purpose register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | DEC_GPR14 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_DEC_GPR14 (0xFF) +#define MCI_DEC_GPR14 (36) + +/* C_REG = #37: decoder general purpose register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | DEC_GPR13 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_DEC_GPR13 (0xFF) +#define MCI_DEC_GPR13 (37) + +/* C_REG = #38: decoder general purpose register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | DEC_GPR12 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_DEC_GPR12 (0xFF) +#define MCI_DEC_GPR12 (38) + +/* C_REG = #39: decoder general purpose register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | DEC_GPR11 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_DEC_GPR11 (0xFF) +#define MCI_DEC_GPR11 (39) + +/* C_REG = #40: decoder general purpose register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | DEC_GPR10 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_DEC_GPR10 (0xFF) +#define MCI_DEC_GPR10 (40) + +/* C_REG = #41: decoder general purpose register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | DEC_GPR9 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_DEC_GPR9 (0xFF) +#define MCI_DEC_GPR9 (41) + +/* C_REG = #42: decoder general purpose register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | DEC_GPR8 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_DEC_GPR8 (0xFF) +#define MCI_DEC_GPR8 (42) + +/* C_REG = #43: decoder general purpose register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | DEC_GPR7 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_DEC_GPR7 (0xFF) +#define MCI_DEC_GPR7 (43) + +/* C_REG = #44: decoder general purpose register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | DEC_GPR6 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_DEC_GPR6 (0xFF) +#define MCI_DEC_GPR6 (44) + +/* C_REG = #45: decoder general purpose register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | DEC_GPR5 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_DEC_GPR5 (0xFF) +#define MCI_DEC_GPR5 (45) + +/* C_REG = #46: decoder general purpose register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | DEC_GPR4 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_DEC_GPR4 (0xFF) +#define MCI_DEC_GPR4 (46) + +/* C_REG = #47: decoder general purpose register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | DEC_GPR3 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_DEC_GPR3 (0xFF) +#define MCI_DEC_GPR3 (47) + +/* C_REG = #48: decoder general purpose register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | DEC_GPR2 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_DEC_GPR2 (0xFF) +#define MCI_DEC_GPR2 (48) + +/* C_REG = #49: decoder general purpose register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | DEC_GPR1 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_DEC_GPR1 (0xFF) +#define MCI_DEC_GPR1 (49) + +/* C_REG = #50: decoder general purpose register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | DEC_GPR0 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_DEC_GPR0 (0xFF) +#define MCI_DEC_GPR0 (50) + +/* C_REG = #51: decoder special function register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | DEC_SFR1 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_DEC_SFR1 (0xFF) +#define MCI_DEC_SFR1 (51) + +/* C_REG = #52: decoder special function register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | DEC_SFR0 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_DEC_SFR0 (0xFF) +#define MCI_DEC_SFR0 (52) + +/* C_REG = #53: encoder control setting register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | ENC_CTL15 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_ENC_CTL15 (0xFF) +#define MCI_ENC_CTL15 (53) + +/* C_REG = #54: encoder control setting register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | ENC_CTL14 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_ENC_CTL14 (0xFF) +#define MCI_ENC_CTL14 (54) + +/* C_REG = #55: encoder control setting register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | ENC_CTL13 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_ENC_CTL13 (0xFF) +#define MCI_ENC_CTL13 (55) + +/* C_REG = #56: encoder control setting register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | ENC_CTL12 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_ENC_CTL12 (0xFF) +#define MCI_ENC_CTL12 (56) + +/* C_REG = #57: encoder control setting register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | ENC_CTL11 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_ENC_CTL11 (0xFF) +#define MCI_ENC_CTL11 (57) + +/* C_REG = #58: encoder control setting register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | ENC_CTL10 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_ENC_CTL10 (0xFF) +#define MCI_ENC_CTL10 (58) + +/* C_REG = #59: encoder control setting register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | ENC_CTL9 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_ENC_CTL9 (0xFF) +#define MCI_ENC_CTL9 (59) + +/* C_REG = #60: encoder control setting register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | ENC_CTL8 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_ENC_CTL8 (0xFF) +#define MCI_ENC_CTL8 (60) + +/* C_REG = #61: encoder control setting register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | ENC_CTL7 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_ENC_CTL7 (0xFF) +#define MCI_ENC_CTL7 (61) + +/* C_REG = #62: encoder control setting register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | ENC_CTL6 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_ENC_CTL6 (0xFF) +#define MCI_ENC_CTL6 (62) + +/* C_REG = #63: encoder control setting register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | ENC_CTL5 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_ENC_CTL5 (0xFF) +#define MCI_ENC_CTL5 (63) + +/* C_REG = #64: encoder control setting register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | ENC_CTL4 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_ENC_CTL4 (0xFF) +#define MCI_ENC_CTL4 (64) + +/* C_REG = #65: encoder control setting register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | ENC_CTL3 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_ENC_CTL3 (0xFF) +#define MCI_ENC_CTL3 (65) + +/* C_REG = #66: encoder control setting register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | ENC_CTL2 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_ENC_CTL2 (0xFF) +#define MCI_ENC_CTL2 (66) + +/* C_REG = #67: encoder control setting register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | ENC_CTL1 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_ENC_CTL1 (0xFF) +#define MCI_ENC_CTL1 (67) + +/* C_REG = #68: encoder control setting register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | ENC_CTL0 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_ENC_CTL0 (0xFF) +#define MCI_ENC_CTL0 (68) + +/* C_REG = #69: encoder general purpose register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | ENC_GPR15 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_ENC_GPR15 (0xFF) +#define MCI_ENC_GPR15 (69) + +/* C_REG = #70: encoder general purpose register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | ENC_GPR14 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_ENC_GPR14 (0xFF) +#define MCI_ENC_GPR14 (70) + +/* C_REG = #71: encoder general purpose register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | ENC_GPR13 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_ENC_GPR13 (0xFF) +#define MCI_ENC_GPR13 (71) + +/* C_REG = #72: encoder general purpose register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | ENC_GPR12 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_ENC_GPR12 (0xFF) +#define MCI_ENC_GPR12 (72) + +/* C_REG = #73: encoder general purpose register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | ENC_GPR11 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_ENC_GPR11 (0xFF) +#define MCI_ENC_GPR11 (73) + +/* C_REG = #74: encoder general purpose register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | ENC_GPR10 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_ENC_GPR10 (0xFF) +#define MCI_ENC_GPR10 (74) + +/* C_REG = #75: encoder general purpose register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | ENC_GPR9 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_ENC_GPR9 (0xFF) +#define MCI_ENC_GPR9 (75) + +/* C_REG = #76: encoder general purpose register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | ENC_GPR8 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_ENC_GPR8 (0xFF) +#define MCI_ENC_GPR8 (76) + +/* C_REG = #77: encoder general purpose register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | ENC_GPR7 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_ENC_GPR7 (0xFF) +#define MCI_ENC_GPR7 (77) + +/* C_REG = #78: encoder general purpose register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | ENC_GPR6 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_ENC_GPR6 (0xFF) +#define MCI_ENC_GPR6 (78) + +/* C_REG = #79: encoder general purpose register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | ENC_GPR5 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_ENC_GPR5 (0xFF) +#define MCI_ENC_GPR5 (79) + +/* C_REG = #80: encoder general purpose register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | ENC_GPR4 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_ENC_GPR4 (0xFF) +#define MCI_ENC_GPR4 (80) + +/* C_REG = #81: encoder general purpose register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | ENC_GPR3 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_ENC_GPR3 (0xFF) +#define MCI_ENC_GPR3 (81) + +/* C_REG = #82: encoder general purpose register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | ENC_GPR2 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_ENC_GPR2 (0xFF) +#define MCI_ENC_GPR2 (82) + +/* C_REG = #83: encoder general purpose register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | ENC_GPR1 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_ENC_GPR1 (0xFF) +#define MCI_ENC_GPR1 (83) + +/* C_REG = #84: encoder general purpose register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | ENC_GPR0 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_ENC_GPR0 (0xFF) +#define MCI_ENC_GPR0 (84) + +/* C_REG = #85: encoder special function register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | ENC_SFR1 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_ENC_SFR1 (0xFF) +#define MCI_ENC_SFR1 (85) + +/* C_REG = #86: encoder special function register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | ENC_SFR0 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_ENC_SFR0 (0xFF) +#define MCI_ENC_SFR0 (86) + +/* C_REG = #87: CDSP DFIFO pointer (H) register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | "0" | "0" | "0" | DFIFO_POINTER[12:8] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_DFIFO_POINTER_H (0x1F) +#define MCI_DFIFO_POINTER_H (87) + +/* C_REG = #88: CDSP DFIFO pointer (L) register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | DFIFO_POINTER[7:0] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_DFIFO_POINTER_L (0xFF) +#define MCI_DFIFO_POINTER_L (88) + +/* C_REG = #89: CDSP FFIFO pointer (H) register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | "0" | "0" | "0" | "0" | "0" | FFIFO_POINTER[10:8] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_FFIFO_POINTER_H (0x07) +#define MCI_FFIFO_POINTER_H (89) + +/* C_REG = #90: CDSP FFIFO pointer (L) register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | FFIFO_POINTER[7:0] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_FFIFO_POINTER_L (0xFF) +#define MCI_FFIFO_POINTER_L (90) + +/* C_REG = #91: CDSP DFIFO flag register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | JDEMP | JDPNT | "0" | "0" | DOVF | DUDF | DEMP | DPNT | + | | | | | _FLG | _FLG | _FLG | _FLG | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_DFIFO_FLG_JDEMP (0x80) +#define MCB_DFIFO_FLG_JDPNT (0x40) +#define MCB_DFIFO_FLG_DOVF (0x08) +#define MCB_DFIFO_FLG_DUDF (0x04) +#define MCB_DFIFO_FLG_DEMP (0x02) +#define MCB_DFIFO_FLG_DPNT (0x01) +#define MCB_DFIFO_FLG_ALL (0x0F) +#define MCI_DFIFO_FLG (91) + +/* C_REG = #92: CDSP OFIFO flag register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | JOEMP | JOPNT | "0" | "0" | OOVF | OUDF | OEMP | OPNT | + | | | | | _FLG | _FLG | _FLG | _FLG | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_OFIFO_FLG_JOEMP (0x80) +#define MCB_OFIFO_FLG_JOPNT (0x40) +#define MCB_OFIFO_FLG_OOVF (0x08) +#define MCB_OFIFO_FLG_OUDF (0x04) +#define MCB_OFIFO_FLG_OEMP (0x02) +#define MCB_OFIFO_FLG_OPNT (0x01) +#define MCB_OFIFO_FLG_ALL (0x0F) +#define MCI_OFIFO_FLG (92) + +/* C_REG = #93: CDSP EFIFO flag register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | JEEMP | JEPNT | "0" | "0" | EOVF | EUDF | EEMP | EPNT | + | | | | | _FLG | _FLG | _FLG | _FLG | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_EFIFO_FLG_JEEMP (0x80) +#define MCB_EFIFO_FLG_JEPNT (0x40) +#define MCB_EFIFO_FLG_EOVF (0x08) +#define MCB_EFIFO_FLG_EUDF (0x04) +#define MCB_EFIFO_FLG_EEMP (0x02) +#define MCB_EFIFO_FLG_EPNT (0x01) +#define MCB_EFIFO_FLG_ALL (0x0F) +#define MCI_EFIFO_FLG (93) + +/* C_REG = #94: CDSP RFIFO flag register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | JREMP | JRPNT | "0" | "0" | ROVF | RUDF | REMP | RPNT | + | | | | | _FLG | _FLG | _FLG | _FLG | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_RFIFO_FLG_JREMP (0x80) +#define MCB_RFIFO_FLG_JRPNT (0x40) +#define MCB_RFIFO_FLG_ROVF (0x08) +#define MCB_RFIFO_FLG_RUDF (0x04) +#define MCB_RFIFO_FLG_REMP (0x02) +#define MCB_RFIFO_FLG_RPNT (0x01) +#define MCB_RFIFO_FLG_ALL (0x0F) +#define MCI_RFIFO_FLG (94) + +/* C_REG = #95: CDSP FFIFO flag register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | JFEMP | JFPNT |FSQ_END| "0" | FOVF | "0" | FEMP | FPNT | + | | | _FLG | | _FLG | | _FLG | _FLG | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_FFIFO_FLG_JFEMP (0x80) +#define MCB_FFIFO_FLG_JFPNT (0x40) +#define MCB_FFIFO_FLG_FSQ_END (0x20) +#define MCB_FFIFO_FLG_FOVF (0x08) +#define MCB_FFIFO_FLG_FEMP (0x02) +#define MCB_FFIFO_FLG_FPNT (0x01) +#define MCB_FFIFO_FLG_ALL (0x2B) +#define MCI_FFIFO_FLG (95) + +/* C_REG = #96: CDSP decoder flag register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R |DEC_EPARAM_FLG | "0" |DEC_EVT| "0" |DEC_END|DEC_ERR|DEC_SFR| + | | | _FLG | | _FLG | _FLG | _FLG | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_DEC_EPARAM_FLG (0xC0) +#define MCB_DEC_EVT_FLG (0x10) +#define MCB_DEC_FLG_END (0x04) +#define MCB_DEC_FLG_ERR (0x02) +#define MCB_DEC_FLG_SFR (0x01) +#define MCB_DEC_FLG_ALL (0xD7) +#define MCI_DEC_FLG (96) + +/* C_REG = #97: CDSP encoder flag register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R |ENC_EPARAM_FLG | "0" |ENC_EVT| "0" |ENC_END|ENC_ERR|ENC_SFR| + | | | _FLG | | _FLG | _FLG | _FLG | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_ENC_EPARAM_FLG (0xC0) +#define MCB_ENC_EVT_FLG (0x10) +#define MCB_ENC_FLG_END (0x04) +#define MCB_ENC_FLG_ERR (0x02) +#define MCB_ENC_FLG_SFR (0x01) +#define MCB_ENC_FLG_ALL (0xD7) +#define MCI_ENC_FLG (97) + +/* C_REG = #98: CDSP decoder general purpose flag register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | DEC_GPR_FLG | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_DEC_GPR_FLG (0xFF) +#define MCI_DEC_GPR_FLG (98) + +/* C_REG = #99: CDSP encoder general purpose flag register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | ENC_GPR_FLG | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_ENC_GPR_FLG (0xFF) +#define MCI_ENC_GPR_FLG (99) + +/* C_REG = #100: CDSP DFIFO enable register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | "0" | "0" | "0" | "0" | EDOVF | EDUDF | EDEMP | EDPNT | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_DFIFO_EDOVF (0x08) +#define MCB_DFIFO_EDUDF (0x04) +#define MCB_DFIFO_EDEMP (0x02) +#define MCB_DFIFO_EDPNT (0x01) +#define MCI_DFIFO_ENABLE (100) + +/* C_REG = #101: CDSP OFIFO enable register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | "0" | "0" | "0" | "0" | EOOVF | EOUDF | EOEMP | EOPNT | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_OFIFO_EOOVF (0x08) +#define MCB_OFIFO_EOUDF (0x04) +#define MCB_OFIFO_EOEMP (0x02) +#define MCB_OFIFO_EOPNT (0x01) +#define MCI_OFIFO_ENABLE (101) + +/* C_REG = #102: CDSP EFIFO enable register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | "0" | "0" | "0" | "0" | EEOVF | EEUDF | EEEMP | EEPNT | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_EFIFO_EEOVF (0x08) +#define MCB_EFIFO_EEUDF (0x04) +#define MCB_EFIFO_EEEMP (0x02) +#define MCB_EFIFO_EEPNT (0x01) +#define MCI_EFIFO_ENABLE (102) + +/* C_REG = #103: CDSP RFIFO enable register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | "0" | "0" | "0" | "0" | EROVF | ERUDF | EREMP | ERPNT | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_RFIFO_EROVF (0x08) +#define MCB_RFIFO_ERUDF (0x04) +#define MCB_RFIFO_EREMP (0x02) +#define MCB_RFIFO_ERPNT (0x01) +#define MCI_RFIFO_ENABLE (103) + +/* C_REG = #104: CDSP FFIFO enable register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | "0" | "0" | EFSQ | "0" | EFOVF | "0" | EFEMP | EFPNT | + | | | _END | | | | | | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_FFIFO_EFSQ_END (0x20) +#define MCB_FFIFO_EFOVF (0x08) +#define MCB_FFIFO_EFEMP (0x02) +#define MCB_FFIFO_EFPNT (0x01) +#define MCI_FFIFO_ENABLE (104) + +/* C_REG = #105: CDSP decoder enable register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | EDEC_EPARAM | "0" | EDEC | "0" | EDEC | EDEC | EDEC | + | | | _EVT | | _END | _ERR | _SFR | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_EDEC_EPARAM (0xC0) +#define MCB_EDEC_EVT (0x10) +#define MCB_EDEC_END (0x04) +#define MCB_EDEC_ERR (0x02) +#define MCB_EDEC_SFR (0x01) +#define MCI_DEC_ENABLE (105) + +/* C_REG = #106: CDSP encoder enable register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | EENC_EPARAM | "0" | EENC | "0" | EENC | EENC | EENC | + | | | _EVT | | _END | _ERR | _SFR | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_EENC_EPARAM (0xC0) +#define MCB_EENC_EVT (0x10) +#define MCB_EENC_END (0x04) +#define MCB_EENC_ERR (0x02) +#define MCB_EENC_SFR (0x01) +#define MCI_ENC_ENABLE (106) + +/* C_REG = #107: CDSP decoder general purpose enable register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | EDEC_GPR | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_EDEC_GPR (0xFF) +#define MCI_DEC_GPR_ENABLE (107) + +/* C_REG = #108: CDSP encoder general purpose enable register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | EENC_GPR | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_EENC_GPR (0xFF) +#define MCI_ENC_GPR_ENABLE (108) + +/* C_REG = #110: CDSP reset register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | CDSP_MSEL | CDSP_ | CDSP_ | "0" | FSQ_ | "0" | CDSP_ | + | | DMODE | FMODE | | SRST | | SRST | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_CDSP_MSEL (0xC0) +#define MCB_CDSP_MSEL_PROG (0x00) +#define MCB_CDSP_MSEL_DATA (0x40) +#define MCB_CDSP_DMODE (0x20) +#define MCB_CDSP_FMODE (0x10) +#define MCB_CDSP_FSQ_SRST (0x04) +#define MCB_CDSP_SRST (0x01) +#define MCI_CDSP_RESET (110) + +/* C_REG = #112: CDSP power mode register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | SLEEP | "0" | CDSP_HLT_MODE | "0" | "0" | "0" | "0" | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_CDSP_SLEEP (0x80) +#define MCB_CDSP_HLT_MODE (0x30) +#define MCB_CDSP_HLT_MODE_IDLE (0x10) +#define MCB_CDSP_HLT_MODE_SLEEP_HALT (0x20) +#define MCI_CDSP_POWER_MODE (112) + +/* C_REG = #113: CDSP error register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | CDSP_ERR[7:0] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_CDSP_ERR (0xFF) +#define MCI_CDSP_ERR (113) + +/* C_REG = #114: CDSP memory address (H) setting register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | CDSP_MAR[15:8] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_CDSP_MAR_H (0xFF) +#define MCI_CDSP_MAR_H (114) + +/* C_REG = #115: CDSP memory address (L) setting register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | CDSP_MAR[7:0] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_CDSP_MAR_L (0xFF) +#define MCI_CDSP_MAR_L (115) + +/* C_REG = #116: OFIFO irq point (H) setting register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | "0" | "0" | "0" | "0" | OFIFO_IRQ_PNT[11:8] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_OFIFO_IRQ_PNT_H (0x1F) +#define MCI_OFIFO_IRQ_PNT_H (116) + +/* C_REG = #117: OFIFO irq point (L) setting register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | OFIFO_IRQ_PNT[7:0] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_OFIFO_IRQ_PNT_L (0xFF) +#define MCI_OFIFO_IRQ_PNT_L (117) + +/* C_REG = #118: DFIFO irq point (H) setting register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | "0" | "0" | "0" | "0" | DFIFO_IRQ_PNT[14:7] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_DFIFO_IRQ_PNT_H (0x0F) +#define MCI_DFIFO_IRQ_PNT_H (118) + +/* C_REG = #119: dfifo irq point (L) setting register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | DFIFO_IRQ_PNT[7:0] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_DFIFO_IRQ_PNT_L (0xFF) +#define MCI_DFIFO_IRQ_PNT_L (119) + +/* C_REG = #120: RFIFO irq point (H) setting register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | "0" | "0" | "0" | RFIFO_IRQ_PNT[12:8] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_RFIFO_IRQ_PNT_H (0x1F) +#define MCI_RFIFO_IRQ_PNT_H (120) + +/* C_REG = #121: RFIFO irq point (L) setting register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | RFIFO_IRQ_PNT[7:0] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_RFIFO_IRQ_PNT_L (0xFF) +#define MCI_RFIFO_IRQ_PNT_L (121) + +/* C_REG = #122: EFIFO irq point (H) setting register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | "0" | "0" | "0" | "0" | EFIFO_IRQ_PNT[11:8] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_EFIFO_IRQ_PNT_H (0x0F) +#define MCI_EFIFO_IRQ_PNT_H (122) + +/* C_REG = #123: EFIFO irq point (L) setting register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | EFIFO_IRQ_PNT[7:0] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_EFIFO_IRQ_PNT_L (0xFF) +#define MCI_EFIFO_IRQ_PNT_L (123) + +/* C_REG = #124: FFIFO irq point (H) setting register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | "0" | "0" | "0" | "0" | "0" | "0" | FFIFO_IRQ_PNT | + | | | | | | | [9:8] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_FFIFO_IRQ_PNT_H (0x03) +#define MCI_FFIFO_IRQ_PNT_H (124) + +/* C_REG = #125: FFIFO irq point (L) setting register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | FFIFO_IRQ_PNT[7:0] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_FFIFO_IRQ_PNT_L (0xFF) +#define MCI_FFIFO_IRQ_PNT_L (125) + +/* C_REG = #128: CDSP flag register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | "0" | "0" | "0" | "0" | "0" |CDSP_ | "0" |CDSP_ | + | | | | | |ERR_FLG| |WDT_FLG| + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_CDSP_FLG_ERR (0x04) +#define MCB_CDSP_FLG_WDT (0x01) +#define MCB_CDSP_FLG_ALL (0x05) +#define MCI_CDSP_FLG (128) + +/* C_REG = #129: CDSP enable register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | "0" | "0" | "0" | "0" | "0" | ECDSP | "0" | ECDSP | + | | | | | | _ERR | | _WDT | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_CDSP_EERR (0x04) +#define MCB_CDSP_EWDT (0x01) +#define MCB_CDSP_ENABLE_ALL (0x05) +#define MCI_CDSP_ENABLE (129) + +/* C_REG = #130: CDSP RFIFO pointer (H) register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | "0" | "0" | "0" | RFIFO_POINTER[12:8] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_RFIFO_POINTER_H (0x1F) +#define MCI_RFIFO_POINTER_H (130) + +/* C_REG = #131: CDSP RFIFO pointer (L) register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | RFIFO_POINTER[7:0] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_RFIFO_POINTER_L (0xFF) +#define MCI_RFIFO_POINTER_L (131) + +/* C_REG = #144: Decoder event register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | DEC_EVT | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_DEC_EVT (0xFF) +#define MCI_DEC_EVT (144) + +/* C_REG = #145: Decoder event parameter3 register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | DEC_EPARAM3 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_DEC_EPARAM3 (0xFF) +#define MCI_DEC_EPARAM3 (145) + +/* C_REG = #146: Decoder event parameter2 register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | DEC_EPARAM2 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_DEC_EPARAM2 (0xFF) +#define MCI_DEC_EPARAM2 (146) + +/* C_REG = #147: Decoder event parameter1 register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | DEC_EPARAM1 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_DEC_EPARAM1 (0xFF) +#define MCI_DEC_EPARAM1 (147) + +/* C_REG = #148: Decoder event parameter0 register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | DEC_EPARAM0 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_DEC_EPARAM0 (0xFF) +#define MCI_DEC_EPARAM0 (148) + +/* C_REG = #149: OUT0LR_SEL + + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | "0" | OUT0R_SEL[2:0] | "0" | OUT0L_SEL[2:0] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ + +#define MCI_OUT0_SEL_DEF (0x10) +#define MCB_OUT0R_SEL (0x70) +#define MCB_OUT0L_SEL (0x07) +#define MCI_OUT0_SEL (149) + +/* C_REG = #150: OUT1LR_SEL + + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | "0" | OUT1R_SEL[2:0] | "0" | OUT1L_SEL[2:0] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ + +#define MCI_OUT1_SEL_DEF (0x10) +#define MCB_OUT1R_SEL (0x70) +#define MCB_OUT1L_SEL (0x07) +#define MCI_OUT1_SEL (150) + +/* C_REG = #151: OUT2LR_SEL + + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | "0" | OUT2R_SEL[2:0] | "0" | OUT2L_SEL[2:0] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ + +#define MCI_OUT2_SEL_DEF (0x32) +#define MCB_OUT2R_SEL (0x70) +#define MCB_OUT2L_SEL (0x07) +#define MCI_OUT2_SEL (151) + + +/* C_REG = #152: Encoder event register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | ENC_EVT | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_ENC_EVT (0xFF) +#define MCI_ENC_EVT (152) + +/* C_REG = #153: Encoder event parameter3 register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | ENC_EPARAM3 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_ENC_EPARAM3 (0xFF) +#define MCI_ENC_EPARAM3 (153) + +/* C_REG = #154: Encoder event parameter2 register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | ENC_EPARAM2 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_ENC_EPARAM2 (0xFF) +#define MCI_ENC_EPARAM2 (154) + +/* C_REG = #155: Encoder event parameter1 register + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | ENC_EPARAM1 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_ENC_EPARAM1 (0xFF) +#define MCI_ENC_EPARAM1 (155) + +/* C_REG = #156: Encoder event parameter0 register + + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | ENC_EPARAM0 | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCB_ENC_EPARAM0 (0xFF) +#define MCI_ENC_EPARAM0 (156) + + +/* C_REG = #157: RDFIFO_BIT_SEL + + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | DFIFO | DFIFO | CDSP | "0" | RFIFO_| RFIFO_| DFIFO_| DFIFO_| + | _START| _START| _DFIFO| | BIT | SEL | BIT | SEL | + | _SEL | | _START| | | | | | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCI_RDFIFO_BIT_SEL_DEF (0x00) +#define MCB_RDFIFO_DFIFO_START_SEL (0x80) +#define MCB_RDFIFO_DFIFO_START (0x40) +#define MCB_RDFIFO_CDSP_DFIFO_START (0x20) +#define MCB_RFIFO_BIT (0x08) +#define MCB_RFIFO_BIT_16 (0x00) +#define MCB_RFIFO_BIT_32 (0x08) +#define MCB_RFIFO_SEL (0x04) +#define MCB_RFIFO_SEL_SRC (0x00) +#define MCB_RFIFO_SEL_HOST (0x04) +#define MCB_DFIFO_BIT (0x02) +#define MCB_DFIFO_BIT_16 (0x00) +#define MCB_DFIFO_BIT_32 (0x02) +#define MCB_DFIFO_SEL (0x01) +#define MCB_DFIFO_SEL_SRC (0x00) +#define MCB_DFIFO_SEL_HOST (0x01) +#define MCI_RDFIFO_BIT_SEL (157) + + +/* C_REG = #158: EFIFO01_SEL + + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | "0" | EFIFO01_SEL[2:0] | "0" | EFIFO00_SEL[2:0] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ + +#define MCI_EFIFO01_SEL_DEF (0x32) +#define MCB_EFIFO1_SEL (0x70) +#define MCB_EFIFO0_SEL (0x07) +#define MCI_EFIFO01_SEL (158) + +/* C_REG = #159: EFIFO23_SEL + + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | "0" | EFIFO03_SEL[2:0] | "0" | EFIFO02_SEL[2:0] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ + +#define MCI_EFIFO23_SEL_DEF (0x54) +#define MCB_EFIFO3_SEL (0x70) +#define MCB_EFIFO2_SEL (0x07) +#define MCI_EFIFO23_SEL (159) + + +/* F_REG */ + +/* FDSP_ADR = #3: ADIDFmt0 + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | ADI3DFMT[1:0] | ADI2DFMT[1:0] | ADI1DFMT[1:0] | ADI0DFMT[1:0] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCI_ADIDFMT0 (0x03) +#define MCI_ADIDFMT0_DEF (0x00) +#define MCB_ADI3DFMT (0xC0) +#define MCB_ADI2DFMT (0x30) +#define MCB_ADI1DFMT (0x0C) +#define MCB_ADI0DFMT (0x03) + +/* FDSP_ADR = #4: ADIDFmt1 + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | ADI7DFMT[1:0] | ADI6DFMT[1:0] | ADI5DFMT[1:0] | ADI4DFMT[1:0] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCI_ADIDFMT1 (0x04) +#define MCI_ADIDFMT1_DEF (0x00) +#define MCB_ADI7DFMT (0xC0) +#define MCB_ADI6DFMT (0x30) +#define MCB_ADI5DFMT (0x0C) +#define MCB_ADI4DFMT (0x03) + +/* FDSP_ADR = #5: ADIMute0 + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | ADI07 | ADI06 | ADI05 | ADI04 | ADI03 | ADI02 | ADI01 | ADI00 | + | MTN | MTN | MTN | MTN | MTN | MTN | MTN | MTN | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCI_ADIMUTE0 (0x05) +#define MCI_ADIMUTE0_DEF (0x00) +#define MCB_ADI07MTN (0x80) +#define MCB_ADI06MTN (0x40) +#define MCB_ADI05MTN (0x20) +#define MCB_ADI04MTN (0x10) +#define MCB_ADI03MTN (0x08) +#define MCB_ADI02MTN (0x04) +#define MCB_ADI01MTN (0x02) +#define MCB_ADI00MTN (0x01) + +/* FDSP_ADR = #6: ADIMute1 + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | ADI15 | ADI14 | ADI13 | ADI12 | ADI11 | ADI10 | ADI09 | ADI08 | + | MTN | MTN | MTN | MTN | MTN | MTN | MTN | MTN | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCI_ADIMUTE1 (0x06) +#define MCI_ADIMUTE1_DEF (0x00) +#define MCB_ADI15MTN (0x80) +#define MCB_ADI14MTN (0x40) +#define MCB_ADI13MTN (0x20) +#define MCB_ADI12MTN (0x10) +#define MCB_ADI11MTN (0x08) +#define MCB_ADI10MTN (0x04) +#define MCB_ADI09MTN (0x02) +#define MCB_ADI08MTN (0x01) + +/* FDSP_ADR = #7: ADIMute2 + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W | "0" | "0" | "0" | "0" | "0" | "0" | "0" | ADIMT | + | | | | | | | | SET | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCI_ADIMUTE2 (0x07) +#define MCI_ADIMUTE2_DEF (0x00) +#define MCB_ADIMTSET (0x01) + +/* FDSP_ADR = #8: ADICSel0 + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | ADI01CSEL[3:0] | ADI00CSEL[3:0] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCI_ADICSEL0 (0x08) +#define MCI_ADICSEL0_DEF (0x10) +#define MCB_ADI01CSEL (0xF0) +#define MCB_ADI00CSEL (0x0F) + +/* FDSP_ADR = #9: ADICSel1 + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | ADI03CSEL[3:0] | ADI02CSEL[3:0] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ + +#define MCI_ADICSEL1 (0x09) +#define MCI_ADICSEL1_DEF (0x32) +#define MCB_ADI03CSEL (0xF0) +#define MCB_ADI02CSEL (0x0F) + +/* FDSP_ADR = #10: ADICSel2 + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | ADI05CSEL[3:0] | ADI04CSEL[3:0] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCI_ADICSEL2 (0x0A) +#define MCI_ADICSEL2_DEF (0x54) +#define MCB_ADI05CSEL (0xF0) +#define MCB_ADI04CSEL (0x0F) + +/* FDSP_ADR = #11: ADICSel3 + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | ADI07CSEL[3:0] | ADI06CSEL[3:0] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCI_ADICSEL3 (0x0B) +#define MCI_ADICSEL3_DEF (0x76) +#define MCB_ADI07CSEL (0xF0) +#define MCB_ADI06CSEL (0x0F) + +/* FDSP_ADR = #12: ADICSel4 + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | ADI09CSEL[3:0] | ADI08CSEL[3:0] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCI_ADICSEL4 (0x0C) +#define MCI_ADICSEL4_DEF (0x98) +#define MCB_ADI09CSEL (0xF0) +#define MCB_ADI08CSEL (0x0F) + +/* FDSP_ADR = #13: ADICSel5 + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | ADI11CSEL[3:0] | ADI10CSEL[3:0] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCI_ADICSEL5 (0x0D) +#define MCI_ADICSEL5_DEF (0xBA) +#define MCB_ADI11CSEL (0xF0) +#define MCB_ADI10CSEL (0x0F) + +/* FDSP_ADR = #14: ADICSel6 + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | ADI13CSEL[3:0] | ADI12CSEL[3:0] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCI_ADICSEL6 (0x0E) +#define MCI_ADICSEL6_DEF (0xDC) +#define MCB_ADI13CSEL (0xF0) +#define MCB_ADI12CSEL (0x0F) + +/* FDSP_ADR = #15: ADICSel7 + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | ADI15CSEL[3:0] | ADI14CSEL[3:0] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCI_ADICSEL7 (0x0F) +#define MCI_ADICSEL7_DEF (0xFE) +#define MCB_ADI15CSEL (0xF0) +#define MCB_ADI14CSEL (0x0F) + +/* FDSP_ADR = #19: ADODFmt0 + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | ADO3DFMT[1:0] | ADO2DFMT[1:0] | ADO1DFMT[1:0] | ADO0DFMT[1:0] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCI_ADODFMT0 (0x13) +#define MCI_ADODFMT0_DEF (0x00) +#define MCB_ADO3DFMT (0xC0) +#define MCB_ADO2DFMT (0x30) +#define MCB_ADO1DFMT (0x0C) +#define MCB_ADO0DFMT (0x03) + +/* FDSP_ADR = #20: ADODFmt1 + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | ADO7DFMT[1:0] | ADO6DFMT[1:0] | ADO5DFMT[1:0] | ADO4DFMT[1:0] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCI_ADODFMT1 (0x14) +#define MCI_ADODFMT1_DEF (0x00) +#define MCB_ADO7DFMT (0xC0) +#define MCB_ADO6DFMT (0x30) +#define MCB_ADO5DFMT (0x0C) +#define MCB_ADO4DFMT (0x03) + +/* FDSP_ADR = #21: ADOMute0 + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | ADO07 | ADO06 | ADO05 | ADO04 | ADO03 | ADO02 | ADO01 | ADO00 | + | MTN | MTN | MTN | MTN | MTN | MTN | MTN | MTN | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCI_ADOMUTE0 (0x15) +#define MCI_ADOMUTE0_DEF (0x00) +#define MCB_ADO07MTN (0x80) +#define MCB_ADO06MTN (0x40) +#define MCB_ADO05MTN (0x20) +#define MCB_ADO04MTN (0x10) +#define MCB_ADO03MTN (0x08) +#define MCB_ADO02MTN (0x04) +#define MCB_ADO01MTN (0x02) +#define MCB_ADO00MTN (0x01) + +/* FDSP_ADR = #22: ADOMute1 + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | ADO15 | ADO14 | ADO13 | ADO12 | ADO11 | ADO10 | ADO09 | ADO08 | + | MTN | MTN | MTN | MTN | MTN | MTN | MTN | MTN | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCI_ADOMUTE1 (0x16) +#define MCI_ADOMUTE1_DEF (0x00) +#define MCB_ADO15MTN (0x80) +#define MCB_ADO14MTN (0x40) +#define MCB_ADO13MTN (0x20) +#define MCB_ADO12MTN (0x10) +#define MCB_ADO11MTN (0x08) +#define MCB_ADO10MTN (0x04) +#define MCB_ADO09MTN (0x02) +#define MCB_ADO08MTN (0x01) + +/* FDSP_ADR = #23: ADOMute2 + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W | "0" | "0" | "0" | "0" | "0" | "0" | "0" | ADOMT | + | | | | | | | | SET | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCI_ADOMUTE2 (0x17) +#define MCI_ADOMUTE2_DEF (0x00) +#define MCB_ADOMTSET (0x01) + +/* FDSP_ADR = #24: ADOCSel0 + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | ADO01CSEL[3:0] | ADO00CSEL[3:0] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCI_ADOCSEL0 (0x18) +#define MCI_ADOCSEL0_DEF (0x10) +#define MCB_ADO01CSEL (0xF0) +#define MCB_ADO00CSEL (0x0F) + +/* FDSP_ADR = #25: ADOCSel1 + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | ADO03CSEL[3:0] | ADO02CSEL[3:0] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCI_ADOCSEL1 (0x19) +#define MCI_ADOCSEL1_DEF (0x32) +#define MCB_ADO03CSEL (0xF0) +#define MCB_ADO02CSEL (0x0F) + +/* FDSP_ADR = #26: ADOCSel2 + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | ADO05CSEL[3:0] | ADO04CSEL[3:0] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCI_ADOCSEL2 (0x1A) +#define MCI_ADOCSEL2_DEF (0x54) +#define MCB_ADO05CSEL (0xF0) +#define MCB_ADO04CSEL (0x0F) + +/* FDSP_ADR = #27: ADOCSel3 + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | ADO07CSEL[3:0] | ADO06CSEL[3:0] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCI_ADOCSEL3 (0x1B) +#define MCI_ADOCSEL3_DEF (0x76) +#define MCB_ADO07CSEL (0xF0) +#define MCB_ADO06CSEL (0x0F) + +/* FDSP_ADR = #28: ADOCSel4 + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | ADO09CSEL[3:0] | ADO08CSEL[3:0] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCI_ADOCSEL4 (0x1C) +#define MCI_ADOCSEL4_DEF (0x98) +#define MCB_ADO09CSEL (0xF0) +#define MCB_ADO08CSEL (0x0F) + +/* FDSP_ADR = #29: ADOCSel5 + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | ADO11CSEL[3:0] | ADO10CSEL[3:0] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCI_ADOCSEL5 (0x1D) +#define MCI_ADOCSEL5_DEF (0xBA) +#define MCB_ADO11CSEL (0xF0) +#define MCB_ADO10CSEL (0x0F) + +/* FDSP_ADR = #30: ADOCSel6 + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | ADO13CSEL[3:0] | ADO12CSEL[3:0] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCI_ADOCSEL6 (0x1E) +#define MCI_ADOCSEL6_DEF (0xDC) +#define MCB_ADO13CSEL (0xF0) +#define MCB_ADO12CSEL (0x0F) + +/* FDSP_ADR = #31: ADOCSel7 + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | ADO15CSEL[3:0] | ADO14CSEL[3:0] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCI_ADOCSEL7 (0x1F) +#define MCI_ADOCSEL7_DEF (0xFE) +#define MCB_ADO15CSEL (0xF0) +#define MCB_ADO14CSEL (0x0F) + +/* FDSP_ADR = #32: DSPCtl + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | DSP | "0" | "0" | "0" | "0" | "0" | "0" | DSP | + | BYPASS| | | | | | | START | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCI_DSPCTRL (0x20) +#define MCI_DSPCTRL_DEF (0x00) +#define MCB_DSPBYPASS (0x80) +#define MCB_DSPSTART (0x01) + +/* FDSP_ADR = #33: DSPState + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +R |AUTOMTN| "0" | "0" | "0" | "0" | "0" | "0" | DSPACT| + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCI_DSPSTATE (0x21) +#define MCI_DSPSTATE_DEF (0x00) +#define MCB_AUTOMTN (0x80) +#define MCB_DSPACT (0x01) + +/* FDSP_ADR = #34: ADIFs0 + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | ADIFS[15:8] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCI_ADIFS0 (0x22) +#define MCI_ADIFS0_DEF (0x00) +#define MCB_ADIFS0 (0xFF) + +/* FDSP_ADR = #35: ADIFs1 + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | ADIFS[7:0] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCI_ADIFS1 (0x23) +#define MCI_ADIFS1_DEF (0x00) +#define MCB_ADIFS1 (0xFF) + +/* FDSP_ADR = #36: ADOFs0 + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | ADOFS[15:8] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ + +#define MCI_ADOFS0 (0x24) +#define MCI_ADOFS0_DEF (0x00) +#define MCB_ADOFS0 (0xFF) + +/* FDSP_ADR = #37: ADOFs1 + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +R | ADOFS[7:0] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCI_ADOFS1 (0x25) +#define MCI_ADOFS1_DEF (0x00) +#define MCB_ADOFS1 (0xFF) + +/* FDSP_ADR = #38: IReqApp0 + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | IRAPP[23:16] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ + +#define MCI_IREQAPP0 (0x26) +#define MCI_IREQAPP0_DEF (0x00) +#define MCB_IREQAPP0 (0xFF) +#define MCB_IRAPP23 (0x80) +#define MCB_IRAPP22 (0x40) +#define MCB_IRAPP21 (0x20) +#define MCB_IRAPP20 (0x10) +#define MCB_IRAPP19 (0x08) +#define MCB_IRAPP18 (0x04) +#define MCB_IRAPP17 (0x02) +#define MCB_IRAPP16 (0x01) + +/* FDSP_ADR = #39: IReqApp1 + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | IRAPP[15:8] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCI_IREQAPP1 (0x27) +#define MCI_IREQAPP1_DEF (0x00) +#define MCB_IREQAPP1 (0xFF) +#define MCB_IRAPP15 (0x80) +#define MCB_IRAPP14 (0x40) +#define MCB_IRAPP13 (0x20) +#define MCB_IRAPP12 (0x10) +#define MCB_IRAPP11 (0x08) +#define MCB_IRAPP10 (0x04) +#define MCB_IRAPP09 (0x02) +#define MCB_IRAPP08 (0x01) + +/* FDSP_ADR = #40: IReqApp2 + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | IRAPP[7:0] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCI_IREQAPP2 (0x28) +#define MCI_IREQAPP2_DEF (0x00) +#define MCB_IREQAPP2 (0xFF) +#define MCB_IRAPP07 (0x80) +#define MCB_IRAPP06 (0x40) +#define MCB_IRAPP05 (0x20) +#define MCB_IRAPP04 (0x10) +#define MCB_IRAPP03 (0x08) +#define MCB_IRAPP02 (0x04) +#define MCB_IRAPP01 (0x02) +#define MCB_IRAPP00 (0x01) + +/* FDSP_ADR = #41: IReqTop + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | IRTOP[7:0] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ + +#define MCI_IREQTOP (0x29) +#define MCI_IREQTOP_DEF (0x00) +#define MCB_IREQTOP (0x0F) +#define MCB_IREQTOP3 (0x08) +#define MCB_IREQTOP2 (0x04) +#define MCB_IREQTOP1 (0x02) +#define MCB_IREQTOP0 (0x01) + +/* FDSP_ADR = #64: FWMod + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | FWMOD[3:0] | FS[3:0] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCI_FWMOD (0x40) +#define MCI_FWMOD_DEF (0x00) +#define MCB_FWMOD (0xF0) +#define MCB_FS (0x0F) + +/* FDSP_ADR = #65: AppExec0 + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | APPEXEC[23:16] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCI_APPEXEC0 (0x41) +#define MCI_APPEXEC0_DEF (0x00) +#define MCB_APPEXEC0 (0xFF) +#define MCB_APPEXEC23 (0x80) +#define MCB_APPEXEC22 (0x40) +#define MCB_APPEXEC21 (0x20) +#define MCB_APPEXEC20 (0x10) +#define MCB_APPEXEC19 (0x08) +#define MCB_APPEXEC18 (0x04) +#define MCB_APPEXEC17 (0x02) +#define MCB_APPEXEC16 (0x01) + +/* FDSP_ADR = #66: AppExec1 + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | APPEXEC[15:8] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCI_APPEXEC1 (0x42) +#define MCI_APPEXEC1_DEF (0x00) +#define MCB_APPEXEC1 (0xFF) +#define MCB_APPEXEC15 (0x80) +#define MCB_APPEXEC14 (0x40) +#define MCB_APPEXEC13 (0x20) +#define MCB_APPEXEC12 (0x10) +#define MCB_APPEXEC11 (0x08) +#define MCB_APPEXEC10 (0x04) +#define MCB_APPEXEC09 (0x02) +#define MCB_APPEXEC08 (0x01) + +/* FDSP_ADR = #67: AppExec2 + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | APPEXEC[7:0] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCI_APPEXEC2 (0x43) +#define MCI_APPEXEC2_DEF (0x00) +#define MCB_APPEXEC2 (0xFF) +#define MCB_APPEXEC07 (0x80) +#define MCB_APPEXEC06 (0x40) +#define MCB_APPEXEC05 (0x20) +#define MCB_APPEXEC04 (0x10) +#define MCB_APPEXEC03 (0x08) +#define MCB_APPEXEC02 (0x04) +#define MCB_APPEXEC01 (0x02) +#define MCB_APPEXEC00 (0x01) + +/* FDSP_ADR = #68: AppAct0 + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | APPACT[23:16] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCI_APPACT0 (0x44) +#define MCI_APPACT0_DEF (0x00) +#define MCB_APPACT23 (0x80) +#define MCB_APPACT22 (0x40) +#define MCB_APPACT21 (0x20) +#define MCB_APPACT20 (0x10) +#define MCB_APPACT19 (0x08) +#define MCB_APPACT18 (0x04) +#define MCB_APPACT17 (0x02) +#define MCB_APPACT16 (0x01) + +/* FDSP_ADR = #69: AppAct1 + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | APPACT[15:8] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCI_APPACT1 (0x45) +#define MCI_APPACT1_DEF (0x00) +#define MCB_APPACT15 (0x80) +#define MCB_APPACT14 (0x40) +#define MCB_APPACT13 (0x20) +#define MCB_APPACT12 (0x10) +#define MCB_APPACT11 (0x08) +#define MCB_APPACT10 (0x04) +#define MCB_APPACT09 (0x02) +#define MCB_APPACT08 (0x01) + +/* FDSP_ADR = #70: AppAct2 + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | APPACT[7:0] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCI_APPACT2 (0x46) +#define MCI_APPACT2_DEF (0x00) +#define MCB_APPACT07 (0x80) +#define MCB_APPACT06 (0x40) +#define MCB_APPACT05 (0x20) +#define MCB_APPACT04 (0x10) +#define MCB_APPACT03 (0x08) +#define MCB_APPACT02 (0x04) +#define MCB_APPACT01 (0x02) +#define MCB_APPACT00 (0x01) + +/* FDSP_ADR = #71: AppIEnb0 + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | APPIE[23:16] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCI_APPIENB0 (0x47) +#define MCI_APPIENB0_DEF (0x00) +#define MCB_APPIE23 (0x80) +#define MCB_APPIE22 (0x40) +#define MCB_APPIE21 (0x20) +#define MCB_APPIE20 (0x10) +#define MCB_APPIE19 (0x08) +#define MCB_APPIE18 (0x04) +#define MCB_APPIE17 (0x02) +#define MCB_APPIE16 (0x01) + +/* FDSP_ADR = #72: AppIEnb1 + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | APPIE[15:8] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCI_APPIENB1 (0x48) +#define MCI_APPIENB1_DEF (0x00) +#define MCB_APPIE15 (0x80) +#define MCB_APPIE14 (0x40) +#define MCB_APPIE13 (0x20) +#define MCB_APPIE12 (0x10) +#define MCB_APPIE11 (0x08) +#define MCB_APPIE10 (0x04) +#define MCB_APPIE09 (0x02) +#define MCB_APPIE08 (0x01) + +/* FDSP_ADR = #73: AppIEnb2 + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | APPIE[7:0] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ + +#define MCI_APPIENB2 (0x49) +#define MCI_APPIENB2_DEF (0x00) +#define MCB_APPIE07 (0x80) +#define MCB_APPIE06 (0x40) +#define MCB_APPIE05 (0x20) +#define MCB_APPIE04 (0x10) +#define MCB_APPIE03 (0x08) +#define MCB_APPIE02 (0x04) +#define MCB_APPIE01 (0x02) +#define MCB_APPIE00 (0x01) + +/* FDSP_ADR = #74: AppFade0 + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | APPFADE[23:16] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ + +#define MCI_APPFADE0 (0x4A) +#define MCI_APPFADE0_DEF (0x00) +#define MCB_APPFADE23 (0x80) +#define MCB_APPFADE22 (0x40) +#define MCB_APPFADE21 (0x20) +#define MCB_APPFADE20 (0x10) +#define MCB_APPFADE19 (0x08) +#define MCB_APPFADE18 (0x04) +#define MCB_APPFADE17 (0x02) +#define MCB_APPFADE16 (0x01) + +/* FDSP_ADR = #75: AppFade1 + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | APPFADE[15:8] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCI_APPFADE1 (0x4B) +#define MCI_APPFADE1_DEF (0x00) +#define MCB_APPFADE15 (0x80) +#define MCB_APPFADE14 (0x40) +#define MCB_APPFADE13 (0x20) +#define MCB_APPFADE12 (0x10) +#define MCB_APPFADE11 (0x08) +#define MCB_APPFADE10 (0x04) +#define MCB_APPFADE09 (0x02) +#define MCB_APPFADE08 (0x01) + +/* FDSP_ADR = #76: AppFade2 + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | APPFADE[7:0] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCI_APPFADE2 (0x4C) +#define MCI_APPFADE2_DEF (0x00) +#define MCB_APPFADE07 (0x80) +#define MCB_APPFADE06 (0x40) +#define MCB_APPFADE05 (0x20) +#define MCB_APPFADE04 (0x10) +#define MCB_APPFADE03 (0x08) +#define MCB_APPFADE02 (0x04) +#define MCB_APPFADE01 (0x02) +#define MCB_APPFADE00 (0x01) + +/* FDSP_ADR = #77: FadeCode + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | "0" | "0" | "0" | "0" | "0" | "0" | FADECODE[1:0]| + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCI_FADECODE (0x4D) +#define MCI_FADECODE_DEF (0x00) +#define MCB_FADECODE (0x03) + +/* FDSP_ADR = #78: TopIEnb + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | TOPIE[7:0] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCI_TOPIENB (0x4E) +#define MCI_TOPIENB_DEF (0x00) +#define MCB_TOPIENB (0xFF) +#define MCB_TOPIE7 (0x80) +#define MCB_TOPIE6 (0x40) +#define MCB_TOPIE5 (0x20) +#define MCB_TOPIE4 (0x10) +#define MCB_TOPIE3 (0x08) +#define MCB_TOPIE2 (0x04) +#define MCB_TOPIE1 (0x02) +#define MCB_TOPIE0 (0x01) + +/* FDSP_ADR = #119: FWSel + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | "0" | "0" | FWSEL[5:0] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCI_FWSEL (0x77) +#define MCI_FWSEL_DEF (0x00) +#define MCB_FWSEL (0x3F) + +/* FDSP_ADR = #120: FWID + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | FWID[7:0] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCI_FWID (0x78) +#define MCI_FWID_DEF (0x00) +#define MCB_FWID (0xFF) + +/* FDSP_ADR = #121: FWVer0 + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | FWVER[23:16] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCI_FWVER0 (0x79) +#define MCI_FWVER0_DEF (0x00) +#define MCB_FWVER0 (0xFF) + +/* FDSP_ADR = #122: FWVer1 + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | FWVER[15:8] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCI_FWVER1 (0x7A) +#define MCI_FWVER1_DEF (0x00) +#define MCB_FWVER1 (0xFF) + +/* FDSP_ADR = #123: FWVer2 + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | FWVER[7:0] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCI_FWVER2 (0x7B) +#define MCI_FWVER2_DEF (0x00) +#define MCB_FWVER2 (0xFF) + +/* FDSP_ADR = #124: FWState + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | "0" | "0" | "0" | "0" | "0" | FWSTATE[2:0] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCI_FWSTATE (0x7C) +#define MCI_FWSTATE_DEF (0x00) +#define MCB_FWSTATE (0x07) + +/* FDSP_ADR = #125: FWRetVal + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | FWRETVAL[7:0] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCI_FWRETVAL (0x7D) +#define MCI_FWRETVAL_DEF (0x00) +#define MCB_FWRETVAL (0xFF) + +/* FDSP_ADR = #126: FWLoad0 + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | FWLOAD[15:8] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCI_FWLOAD0 (0x7E) +#define MCI_FWLOAD0_DEF (0x00) +#define MCB_FWLOAD0 (0xFF) + +/* FDSP_ADR = #127: FWLoad1 + 7 6 5 4 3 2 1 0 + +-------+-------+-------+-------+-------+-------+-------+-------+ +W/R | FWLOAD[7:0] | + +-------+-------+-------+-------+-------+-------+-------+-------+ +*/ +#define MCI_FWLOAD1 (0x7F) +#define MCI_FWLOAD1_DEF (0x00) +#define MCI_FWLOAD1 (0x7F) + + +/* ANA_REG */ +#define MCI_ANA_ID (0) +#define MCI_ANA_ID_DEF (0x90) + +#define MCI_ANA_RST (1) +#define MCB_ANA_RST (0x01) +#define MCI_ANA_RST_DEF (MCB_ANA_RST) + +#define MCI_AP (2) +#define MCB_AP_HPDET (0x20) +#define MCB_AP_LDOA (0x10) +#define MCB_AP_LDOD (0x08) +#define MCB_AP_BGR (0x04) +#define MCB_AP_CP (0x02) +#define MCB_AP_VR (0x01) +#define MCI_AP_DEF (MCB_AP_VR \ + |MCB_AP_CP \ + |MCB_AP_BGR \ + |MCB_AP_LDOA \ + |MCB_AP_LDOD \ + |MCB_AP_HPDET) + +#define MCI_AP_DA0 (3) +#define MCB_AP_RC (0x40) +#define MCB_AP_HPR (0x20) +#define MCB_AP_HPL (0x10) +#define MCB_AP_LO1R (0x08) +#define MCB_AP_LO1L (0x04) +#define MCB_AP_DA0R (0x02) +#define MCB_AP_DA0L (0x01) +#define MCI_AP_DA0_DEF (MCB_AP_DA0L \ + |MCB_AP_DA0R \ + |MCB_AP_LO1L \ + |MCB_AP_LO1R \ + |MCB_AP_HPL \ + |MCB_AP_HPR \ + |MCB_AP_RC) + +#define MCI_AP_DA1 (4) +#define MCB_AP_SPR2 (0x80) +#define MCB_AP_SPR1 (0x40) +#define MCB_AP_SPL2 (0x20) +#define MCB_AP_SPL1 (0x10) +#define MCB_AP_LO2R (0x08) +#define MCB_AP_LO2L (0x04) +#define MCB_AP_DA1R (0x02) +#define MCB_AP_DA1L (0x01) +#define MCI_AP_DA1_DEF (MCB_AP_DA1L \ + |MCB_AP_DA1R \ + |MCB_AP_LO2L \ + |MCB_AP_LO2R \ + |MCB_AP_SPL1 \ + |MCB_AP_SPL2 \ + |MCB_AP_SPR1 \ + |MCB_AP_SPR2) + +#define MCI_PN_DA (5) +#define MCB_PN_DA1 (0x02) +#define MCB_PN_DA0 (0x01) + +#define MCI_AP_MIC (6) +#define MCB_MC4 (0x80) +#define MCB_MC3 (0x40) +#define MCB_MC2 (0x20) +#define MCB_MC1 (0x10) +#define MCB_MB4 (0x08) +#define MCB_MB3 (0x04) +#define MCB_MB2 (0x02) +#define MCB_MB1 (0x01) +#define MCI_AP_MIC_DEF (MCB_MB1 \ + |MCB_MB2 \ + |MCB_MB3 \ + |MCB_MB4 \ + |MCB_MC1 \ + |MCB_MC2 \ + |MCB_MC3 \ + |MCB_MC4) + +#define MCI_AP_AD (7) +#define MCB_AP_LI (0x80) +#define MCB_AP_ADM (0x04) +#define MCB_AP_ADR (0x02) +#define MCB_AP_ADL (0x01) +#define MCI_AP_AD_DEF (MCB_AP_LI \ + |MCB_AP_ADM \ + |MCB_AP_ADR \ + |MCB_AP_ADL) + +#define MCI_PPD (8) +#define MCB_PPD_RC (0x10) +#define MCB_PPD_HP (0x08) +#define MCB_PPD_SP (0x04) +#define MCB_PPD_LO2 (0x02) +#define MCB_PPD_LO1 (0x01) + +#define MCI_APM (9) +#define MCB_APMOFF (0x01) + +#define MCI_BUSY1 (11) +#define MCB_SPR_BUSY (0x20) +#define MCB_SPL_BUSY (0x10) +#define MCB_HPR_BUSY (0x08) +#define MCB_HPL_BUSY (0x04) + +#define MCI_BUSY2 (12) +#define MCB_LO2R_BUSY (0x80) +#define MCB_LO2L_BUSY (0x40) +#define MCB_LO1R_BUSY (0x20) +#define MCB_LO1L_BUSY (0x10) +#define MCB_RC_BUSY (0x08) + +#define MCI_MBSEL (13) + +#define MCI_KDSET (14) +#define MCB_MBS4_DISCH (0x80) +#define MCB_MBS3_DISCH (0x40) +#define MCB_MBS2_DISCH (0x20) +#define MCB_MBS1_DISCH (0x10) +#define MCB_KDSET2 (0x02) +#define MCB_KDSET1 (0x01) + +#define MCI_NONCLIP (21) +#define MCI_NONCLIP_DEF (0x03) + +#define MCI_DIF (24) + +#define MCI_LIVOL_L (25) +#define MCB_ALAT_LI (0x80) + +#define MCI_LIVOL_R (26) + +#define MCI_MC1VOL (27) +#define MCI_MC2VOL (28) +#define MCI_MC3VOL (29) +#define MCI_MC4VOL (30) + +#define MCI_HPVOL_L (31) +#define MCB_ALAT_HP (0x80) + +#define MCI_HPVOL_R (32) + +#define MCI_SPVOL_L (33) +#define MCB_ALAT_SP (0x80) + +#define MCI_SPVOL_R (34) + +#define MCI_RCVOL (35) + +#define MCI_LO1VOL_L (36) +#define MCB_ALAT_LO1 (0x80) + +#define MCI_LO1VOL_R (37) + +#define MCI_LO2VOL_L (38) +#define MCB_ALAT_LO2 (0x80) + +#define MCI_LO2VOL_R (39) + +#define MCI_HPDETVOL (40) + +#define MCI_SVOL (41) +#define MCB_SVOL_HP (0x80) +#define MCB_SVOL_SP (0x40) +#define MCB_SVOL_RC (0x20) +#define MCB_SVOL_LO2 (0x10) +#define MCB_SVOL_LO1 (0x08) +#define MCB_SVOL_HPDET (0x04) +#define MCI_SVOL_DEF (MCB_SVOL_HP \ + |MCB_SVOL_SP \ + |MCB_SVOL_RC \ + |MCB_SVOL_LO2 \ + |MCB_SVOL_LO1 \ + |MCB_SVOL_HPDET) + +#define MCI_HIZ (42) +#define MCB_HPR_HIZ (0x80) +#define MCB_HPL_HIZ (0x40) +#define MCB_SPR_HIZ (0x20) +#define MCB_SPL_HIZ (0x10) +#define MCB_RC_HIZ (0x08) +#define MCI_HIZ_DEF (0xF8) + +#define MCI_LO_HIZ (43) +#define MCB_LO2R_HIZ (0x80) +#define MCB_LO2L_HIZ (0x40) +#define MCB_LO1R_HIZ (0x20) +#define MCB_LO1L_HIZ (0x10) +#define MCI_LO_HIZ_DEF (0xF0) + +#define MCI_MCSNG (44) +#define MCB_MC4SNG (0x80) +#define MCB_MC3SNG (0x40) +#define MCB_MC2SNG (0x20) +#define MCB_MC1SNG (0x10) + +#define MCI_RDY1 (45) +#define MCB_VREF_RDY (0x40) +#define MCB_SPDY_R (0x20) +#define MCB_SPDY_L (0x10) +#define MCB_HPDY_R (0x08) +#define MCB_HPDY_L (0x04) +#define MCB_CPPDRDY (0x02) +#define MCB_HPDET_RDY (0x01) + +#define MCI_RDY2 (46) +#define MCB_LO2RDY_R (0x80) +#define MCB_LO2RDY_L (0x40) +#define MCB_LO1RDY_R (0x20) +#define MCB_LO1RDY_L (0x10) +#define MCB_RCRDY (0x08) + +#define MCI_ZCOFF (47) +#define MCB_ZCOFF_HP (0x80) +#define MCB_ZCOFF_SP (0x40) +#define MCB_ZCOFF_RC (0x20) +#define MCB_ZCOFF_LO2 (0x10) +#define MCB_ZCOFF_LO1 (0x08) +#define MCI_ZCOFF_DEF_ES1 (MCB_ZCOFF_HP \ + |MCB_ZCOFF_LO2 \ + |MCB_ZCOFF_LO1) + +#define MCI_ADL_MIX (48) +#define MCI_ADR_MIX (49) +#define MCI_ADM_MIX (50) + +#define MCB_AD_M4MIX (0x80) +#define MCB_AD_M3MIX (0x40) +#define MCB_AD_M2MIX (0x20) +#define MCB_AD_M1MIX (0x10) +#define MCB_MONO_AD_LI (0x02) +#define MCB_AD_LIMIX (0x01) + +#define MCI_DCERR (51) +#define MCB_DCERR (0x10) +#define MCB_L_OCPR (0x04) +#define MCB_L_OCPL (0x02) +#define MCB_OTP (0x01) + +#define MCI_CPMOD (53) +#define MCB_HIP_DISABLE (0x08) +#define MCB_CPMOD (0x01) +#define MCI_CPMOD_DEF_ES1 (MCB_CPMOD) +#define MCI_CPMOD_DEF (MCB_HIP_DISABLE|MCB_CPMOD) + +#define MCI_DNG_ES1 (55) +#define MCI_DNG_DEF_ES1 (0x14) + +#define MCI_DNG_HP_ES1 (56) +#define MCI_DNG_HP_DEF_ES1 (0x05) + +#define MCI_DNG_SP_ES1 (57) +#define MCI_DNG_SP_DEF_ES1 (0x05) + +#define MCI_DNG_RC_ES1 (58) +#define MCI_DNG_RC_DEF_ES1 (0x05) + +#define MCI_DNG_LO1_ES1 (59) +#define MCI_DNG_LO1_DEF_ES1 (0x05) + +#define MCI_DNG_LO2_ES1 (60) +#define MCI_DNG_LO2_DEF_ES1 (0x05) + +#define MCI_RBSEL (61) +#define MCB_RBSEL (0x80) +#define MCB_OFC_MAN (0x01) + +#define MCI_DNG (108) +#define MCI_DNG_DEF (0x31) + +#define MCI_DNG_HP (109) +#define MCI_DNG_HP_DEF (0x0F) + +#define MCI_DNG_SP (110) +#define MCI_DNG_SP_DEF (0x0F) + +#define MCI_DNG_RC (111) +#define MCI_DNG_RC_DEF (0x0F) + +#define MCI_DNG_LO1 (112) +#define MCI_DNG_LO1_DEF (0x0F) + +#define MCI_DNG_LO2 (113) +#define MCI_DNG_LO2_DEF (0x0F) + + +/* CD_REG */ +#define MCI_HW_ID (0) +#define MCI_HW_ID_DEF (0x90) + +#define MCI_CD_RST (1) +#define MCI_CD_RST_DEF (0x01) + +#define MCI_DP (2) +#define MCB_DP_ADC (0x40) +#define MCB_DP_DAC1 (0x20) +#define MCB_DP_DAC0 (0x10) +#define MCB_DP_PDMCK (0x04) +#define MCB_DP_PDMADC (0x02) +#define MCB_DP_PDMDAC (0x01) +#define MCI_DP_DEF (MCB_DP_ADC \ + |MCB_DP_DAC1 \ + |MCB_DP_DAC0 \ + |MCB_DP_PDMCK \ + |MCB_DP_PDMADC \ + |MCB_DP_PDMDAC) + +#define MCI_DP_OSC (3) +#define MCB_DP_OSC (0x01) +#define MCI_DP_OSC_DEF (MCB_DP_OSC) + +#define MCI_CKSEL (4) +#define MCB_CKSEL0 (0x10) +#define MCB_CRTC (0x02) +#define MCB_HSDET (0x01) +#define MCI_CKSEL_DEF_ES1 (MCB_HSDET) +#define MCI_CKSEL_DEF (MCB_CRTC|MCB_HSDET) + +#define MCI_SCKMSKON_R (5) + +#define MCI_IRQHS (8) +#define MCB_EIRQHS (0x80) +#define MCB_IRQHS (0x40) + +#define MCI_EPLUGDET (9) +#define MCB_EPLUGDET (0x80) +#define MCB_EPLUGUNDET_DB (0x02) +#define MCB_EPLUGDET_DB (0x01) + +#define MCI_PLUGDET (10) +#define MCB_PLUGDET (0x80) +#define MCB_SPLUGUNDET_DB (0x02) +#define MCB_SPLUGDET_DB (0x01) + +#define MCI_PLUGDET_DB (11) +#define MCB_PLUGUNDET_DB (0x02) +#define MCB_PLUGDET_DB (0x01) + +#define MCI_RPLUGDET (12) +#define MCB_RPLUGDET (0x80) +#define MCB_RPLUGUNDET_DB (0x02) +#define MCB_RPLUGDET_DB (0x01) + +#define MCI_EDLYKEY (13) + +#define MCI_SDLYKEY (14) + +#define MCI_EMICDET (15) + +#define MCI_SMICDET (16) +#define MCB_SMICDET (0x40) + +#define MCI_MICDET (17) +#define MCB_MICDET (0x40) +#define MCI_MICDET_DEF (0x38) + +#define MCI_RMICDET (18) + +#define MCI_KEYCNTCLR0 (19) +#define MCB_KEYCNTCLR0 (0x80) + +#define MCI_KEYCNTCLR1 (20) +#define MCB_KEYCNTCLR1 (0x80) + +#define MCI_KEYCNTCLR2 (21) +#define MCB_KEYCNTCLR2 (0x80) + +#define MCI_HSDETEN (22) +#define MCB_HSDETEN (0x80) +#define MCB_MKDETEN (0x40) +#define MCI_HSDETEN_DEF (0x05) + +#define MCI_IRQTYPE (23) +#define MCI_IRQTYPE_DEF (0xC3) + +#define MCI_DLYIRQSTOP (24) + +#define MCI_DETIN_INV (25) +#define MCI_DETIN_INV_DEF_ES1 (0x01) +#define MCI_DETIN_INV_DEF (0xE3) + +#define MCI_IRQM_KEYOFF (26) + +#define MCI_HSDETMODE (28) +#define MCI_HSDETMODE_DEF (0x04) + +#define MCI_DBNC_PERIOD (29) +#define MCB_DBNC_LPERIOD (0x02) +#define MCI_DBNC_PERIOD_DEF (0x22) + +#define MCI_DBNC_NUM (30) +#define MCI_DBNC_NUM_DEF (0xBF) +#define MCI_DBNC_NUM_DEF_ES1 (0x3F) + +#define MCI_KEY_MTIM (31) +#define MCI_KEY_MTIM_DEF (0x80) + +#define MCI_KEYONDLYTIM_K0 (32) +#define MCI_KEYOFFDLYTIM_K0 (33) + +#define MCI_KEYONDLYTIM_K1 (34) +#define MCI_KEYOFFDLYTIM_K1 (35) + +#define MCI_KEYONDLYTIM_K2 (36) +#define MCI_KEYOFFDLYTIM_K2 (37) + +#define MCI_EIRQSENSE (48) +#define MCB_EIRQSENSE (0x80) +#define MCB_EIRQOFC (0x08) + +#define MCI_SSENSEFIN (49) +#define MCB_SSENSEFIN (0x80) +#define MCB_SENSE_BSY (0x40) +#define MCB_SOFFCANFIN (0x08) +#define MCB_OFFCAN_BSY (0x04) + +#define MCI_STDPLUGSEL (52) +#define MCB_STDPLUGSEL (0x80) + +#endif /* __MCDEFS_H__ */ diff --git a/sound/soc/codecs/ymu831/mcdevif.c b/sound/soc/codecs/ymu831/mcdevif.c new file mode 100644 index 00000000000..5fcd5174831 --- /dev/null +++ b/sound/soc/codecs/ymu831/mcdevif.c @@ -0,0 +1,441 @@ +/**************************************************************************** + * + * Copyright(c) 2012 Yamaha Corporation. All rights reserved. + * + * Module : mcdevif.c + * + * Description : MC Driver device interface + * + * Version : 1.0.0 2012.12.13 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + * + ****************************************************************************/ + + +#include "mcdefs.h" +#include "mcdevif.h" +#include "mcservice.h" +#include "mcresctrl.h" +#include "mcdevprof.h" +#include "mcmachdep.h" +#if MCDRV_DEBUG_LEVEL +#include "mcdebuglog.h" +#endif + + + +static struct MCDRV_PACKET *gpsPacket; +static UINT32 gdPackets; + +/**************************************************************************** + * McDevIf_AllocPacketBuf + * + * Description: + * allocate the buffer for register setting packets. + * Arguments: + * none + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR + * + ****************************************************************************/ +SINT32 McDevIf_AllocPacketBuf( + void +) +{ + SINT32 sdRet = MCDRV_SUCCESS; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McDevIf_AllocPacketBuf"); +#endif + + gpsPacket = McResCtrl_AllocPacketBuf(); + if (gpsPacket == NULL) { + ; + sdRet = MCDRV_ERROR; + } else { + McDevIf_ClearPacket(); + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McDevIf_AllocPacketBuf", &sdRet); +#endif + + return sdRet; +} + +/**************************************************************************** + * McDevIf_ReleasePacketBuf + * + * Description: + * Release the buffer for register setting packets. + * Arguments: + * none + * Return: + * none + * + ****************************************************************************/ +void McDevIf_ReleasePacketBuf( + void +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McDevIf_ReleasePacketBuf"); +#endif + + McResCtrl_ReleasePacketBuf(); + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McDevIf_ReleasePacketBuf", 0); +#endif +} + +/**************************************************************************** + * McDevIf_ClearPacket + * + * Description: + * Clear packets. + * Arguments: + * none + * Return: + * none + * + ****************************************************************************/ +void McDevIf_ClearPacket( + void +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + SINT32 sdRet; + McDebugLog_FuncIn("McDevIf_ClearPacket"); +#endif + + if (gpsPacket == NULL) { +#if (MCDRV_DEBUG_LEVEL >= 4) + sdRet = MCDRV_ERROR; + McDebugLog_FuncOut("McDevIf_ClearPacket", &sdRet); +#endif + return; + } + + gdPackets = 0; + gpsPacket[0].dDesc = MCDRV_PACKET_TYPE_TERMINATE; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McDevIf_ClearPacket", 0); +#endif +} + +/**************************************************************************** + * McDevIf_AddPacket + * + * Description: + * Add a packet. + * Arguments: + * dDesc packet info + * bData packet data + * Return: + * none + * + ****************************************************************************/ +void McDevIf_AddPacket( + UINT32 dDesc, + UINT8 bData +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McDevIf_AddPacket"); +#endif + + if (gpsPacket == NULL) { + ; + } else { + if (gdPackets >= MCDRV_MAX_PACKETS) { + ; + McDevIf_ExecutePacket(); + } + + gpsPacket[gdPackets].dDesc = dDesc; + gpsPacket[gdPackets].bData = bData; + gpsPacket[++gdPackets].dDesc = MCDRV_PACKET_TYPE_TERMINATE; + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McDevIf_AddPacket", 0); +#endif +} + +/**************************************************************************** + * McDevIf_AddPacketRepeat + * + * Description: + * Add packets to set data at same register over agian. + * Arguments: + * dDesc packet info + * pbData poointer to packet data + * dDataCount packet data count + * Return: + * none + * + ****************************************************************************/ +void McDevIf_AddPacketRepeat( + UINT32 dDesc, + const UINT8 *pbData, + UINT32 dDataCount +) +{ + UINT32 dCount; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McDevIf_AddPacketRepeat"); +#endif + + for (dCount = 0; dCount < dDataCount; dCount++) { + ; + McDevIf_AddPacket(dDesc, pbData[dCount]); + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McDevIf_AddPacketRepeat", 0); +#endif +} + +/**************************************************************************** + * McDevIf_ExecutePacket + * + * Description: + * Execute sequence for register setting. + * Arguments: + * none + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR_ARGUMENT + * + ****************************************************************************/ +SINT32 McDevIf_ExecutePacket( + void +) +{ + SINT32 sdRet; + SINT16 swPacketIndex; + UINT32 dPacketType; + UINT32 dParam1; + UINT32 dParam2; + UINT16 wAddress; + UINT16 wRegType; + enum MCDRV_UPDATE_MODE eUpdateMode; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McDevIf_ExecutePacket"); +#endif + + if (gpsPacket == NULL) { + sdRet = MCDRV_ERROR_RESOURCEOVER; + } else { + sdRet = MCDRV_SUCCESS; + + McResCtrl_InitRegUpdate(); + swPacketIndex = 0; + while ((MCDRV_PACKET_TYPE_TERMINATE + != (gpsPacket[swPacketIndex].dDesc + & MCDRV_PACKET_TYPE_MASK)) + && (sdRet == MCDRV_SUCCESS)) { + dPacketType = gpsPacket[swPacketIndex].dDesc + & MCDRV_PACKET_TYPE_MASK; + switch (dPacketType) { + case MCDRV_PACKET_TYPE_WRITE: + case MCDRV_PACKET_TYPE_FORCE_WRITE: + wRegType = + (UINT16)(gpsPacket[swPacketIndex].dDesc + & MCDRV_PACKET_REGTYPE_MASK); + wAddress = + (UINT16)(gpsPacket[swPacketIndex].dDesc + & MCDRV_PACKET_ADR_MASK); + if (MCDRV_PACKET_TYPE_WRITE == dPacketType) { + ; + eUpdateMode = eMCDRV_UPDATE_NORMAL; + } else if (MCDRV_PACKET_TYPE_FORCE_WRITE + == dPacketType) { + eUpdateMode = eMCDRV_UPDATE_FORCE; + } else { + eUpdateMode = eMCDRV_UPDATE_DUMMY; + } + McResCtrl_AddRegUpdate(wRegType, + wAddress, + gpsPacket[swPacketIndex].bData, + eUpdateMode); + break; + + case MCDRV_PACKET_TYPE_TIMWAIT: + McResCtrl_ExecuteRegUpdate(); + McResCtrl_InitRegUpdate(); + dParam1 = gpsPacket[swPacketIndex].dDesc + & MCDRV_PACKET_TIME_MASK; + McSrv_Sleep(dParam1); + break; + + case MCDRV_PACKET_TYPE_EVTWAIT: + McResCtrl_ExecuteRegUpdate(); + McResCtrl_InitRegUpdate(); + dParam1 = gpsPacket[swPacketIndex].dDesc + & MCDRV_PACKET_EVT_MASK; + dParam2 = gpsPacket[swPacketIndex].dDesc + & MCDRV_PACKET_EVTPRM_MASK; + sdRet = McResCtrl_WaitEvent(dParam1, dParam2); + break; + + default: + sdRet = MCDRV_ERROR; + break; + } + + swPacketIndex++; + } + if (sdRet == MCDRV_SUCCESS) { + ; + McResCtrl_ExecuteRegUpdate(); + } + McDevIf_ClearPacket(); + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McDevIf_ExecutePacket", &sdRet); +#endif + + return sdRet; +} + +/**************************************************************************** + * McDevIf_ReadDirect + * + * Description: + * Read data from register directly + * Arguments: + * dDesc register info + * pbData pointer to data buffer + * dSize read count + * Return: + * none + * + ****************************************************************************/ +void McDevIf_ReadDirect( + UINT32 dDesc, + UINT8 *pbData, + UINT32 dSize +) +{ + UINT8 bSlaveAddr; + UINT8 abData[2]; + UINT8 bAddr = (UINT8)(dDesc&MCDRV_PACKET_ADR_MASK); + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McDevIf_ReadDirect"); +#endif + + switch (dDesc&MCDRV_PACKET_REGTYPE_MASK) { + case MCDRV_PACKET_REGTYPE_IF: + if ((bAddr == MCI_ANA_REG_D) + || (bAddr == MCI_CD_REG_D)) + bSlaveAddr = + McDevProf_GetSlaveAddr(eMCDRV_SLAVE_ADDR_ANA); + else + bSlaveAddr = + McDevProf_GetSlaveAddr(eMCDRV_SLAVE_ADDR_DIG); + McSrv_ReadRegN(bSlaveAddr, bAddr, pbData, dSize); + break; + + case MCDRV_PACKET_REGTYPE_B: + bSlaveAddr = McDevProf_GetSlaveAddr(eMCDRV_SLAVE_ADDR_DIG); + abData[0] = MCI_B_REG_A<<1; + abData[1] = bAddr; + McSrv_WriteReg(bSlaveAddr, abData, 2); + bAddr = MCI_B_REG_D; + McSrv_ReadRegN(bSlaveAddr, bAddr, pbData, dSize); + break; + + case MCDRV_PACKET_REGTYPE_E: + bSlaveAddr = McDevProf_GetSlaveAddr(eMCDRV_SLAVE_ADDR_DIG); + abData[0] = MCI_E_REG_A<<1; + abData[1] = bAddr; + McSrv_WriteReg(bSlaveAddr, abData, 2); + bAddr = MCI_E_REG_D; + McSrv_ReadRegN(bSlaveAddr, bAddr, pbData, dSize); + break; + + case MCDRV_PACKET_REGTYPE_C: + bSlaveAddr = McDevProf_GetSlaveAddr(eMCDRV_SLAVE_ADDR_DIG); + abData[0] = MCI_C_REG_A<<1; + abData[1] = bAddr; + McSrv_WriteReg(bSlaveAddr, abData, 2); + bAddr = MCI_C_REG_D; + McSrv_ReadRegN(bSlaveAddr, bAddr, pbData, dSize); + break; + + case MCDRV_PACKET_REGTYPE_F: + bSlaveAddr = McDevProf_GetSlaveAddr(eMCDRV_SLAVE_ADDR_DIG); + abData[0] = MCI_F_REG_A<<1; + abData[1] = bAddr; + McSrv_WriteReg(bSlaveAddr, abData, 2); + bAddr = MCI_F_REG_D; + McSrv_ReadRegN(bSlaveAddr, bAddr, pbData, dSize); + break; + + default: + *pbData = + McResCtrl_GetRegVal((UINT16)(dDesc&MCDRV_PACKET_REGTYPE_MASK), + bAddr); + break; + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McDevIf_ReadDirect", NULL); +#endif +} + +/**************************************************************************** + * McDevIf_WriteDirect + * + * Description: + * Write data to register directly + * Arguments: + * pbData pointer to data buffer + * dSize data count + * Return: + * none + * + ****************************************************************************/ +void McDevIf_WriteDirect( + UINT8 *pbData, + UINT32 dSize +) +{ + UINT8 bSlaveAddr; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McDevIf_WriteDirect"); +#endif + + bSlaveAddr = McDevProf_GetSlaveAddr(eMCDRV_SLAVE_ADDR_DIG); + McSrv_WriteReg(bSlaveAddr, pbData, dSize); + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McDevIf_WriteDirect", NULL); +#endif +} + + diff --git a/sound/soc/codecs/ymu831/mcdevif.h b/sound/soc/codecs/ymu831/mcdevif.h new file mode 100644 index 00000000000..c432da86682 --- /dev/null +++ b/sound/soc/codecs/ymu831/mcdevif.h @@ -0,0 +1,114 @@ +/**************************************************************************** + * + * Copyright(c) 2012 Yamaha Corporation. All rights reserved. + * + * Module : mcdevif.h + * + * Description : MC Driver device interface header + * + * Version : 1.0.0 2012.12.13 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + * + ****************************************************************************/ + +#ifndef _MCDEVIF_H_ +#define _MCDEVIF_H_ + +#include "mctypedef.h" +#include "mcdriver.h" + +/* packet */ +struct MCDRV_PACKET { + UINT32 dDesc; + UINT8 bData; +}; + +#define MCDRV_MAX_PACKETS (255UL) + +/* packet dDesc */ +/* packet type */ +#define MCDRV_PACKET_TYPE_WRITE (0x10000000UL) +#define MCDRV_PACKET_TYPE_FORCE_WRITE (0x20000000UL) +#define MCDRV_PACKET_TYPE_TIMWAIT (0x30000000UL) +#define MCDRV_PACKET_TYPE_EVTWAIT (0x40000000UL) +#define MCDRV_PACKET_TYPE_TERMINATE (0xF0000000UL) + +#define MCDRV_PACKET_TYPE_MASK (0xF0000000UL) + +/* reg type */ +#define MCDRV_PACKET_REGTYPE_IF (0x00000000UL) +#define MCDRV_PACKET_REGTYPE_A (0x00001000UL) +#define MCDRV_PACKET_REGTYPE_MA (0x00002000UL) +#define MCDRV_PACKET_REGTYPE_MB (0x00003000UL) +#define MCDRV_PACKET_REGTYPE_B (0x00004000UL) +#define MCDRV_PACKET_REGTYPE_E (0x00005000UL) +#define MCDRV_PACKET_REGTYPE_C (0x00006000UL) +#define MCDRV_PACKET_REGTYPE_F (0x00007000UL) +#define MCDRV_PACKET_REGTYPE_ANA (0x00008000UL) +#define MCDRV_PACKET_REGTYPE_CD (0x00009000UL) + +#define MCDRV_PACKET_REGTYPE_MASK (0x0000F000UL) +#define MCDRV_PACKET_ADR_MASK (0x00000FFFUL) + +/* event */ +#define MCDRV_EVT_SVOL_DONE (0x00010000UL) +#define MCDRV_EVT_ALLMUTE (0x00020000UL) +#define MCDRV_EVT_DIRMUTE (0x00030000UL) +#define MCDRV_EVT_ADCMUTE (0x00040000UL) +#define MCDRV_EVT_DITMUTE (0x00050000UL) +#define MCDRV_EVT_DACMUTE (0x00060000UL) +#define MCDRV_EVT_PSW_RESET (0x00070000UL) +#define MCDRV_EVT_CLKBUSY_RESET (0x00080000UL) +#define MCDRV_EVT_OFFCAN_BSY_RESET (0x00090000UL) +#define MCDRV_EVT_ANA_RDY (0x000A0000UL) +#define MCDRV_EVT_AP_CP_A_SET (0x000B0000UL) + +#define MCDRV_EVT_IF_REG_FLAG_SET (0x01000000UL) +#define MCDRV_EVT_IF_REG_FLAG_RESET (0x02000000UL) +#define MCDRV_EVT_B_REG_FLAG_SET (0x03000000UL) +#define MCDRV_EVT_B_REG_FLAG_RESET (0x04000000UL) +#define MCDRV_EVT_E_REG_FLAG_SET (0x05000000UL) +#define MCDRV_EVT_E_REG_FLAG_RESET (0x06000000UL) +#define MCDRV_EVT_C_REG_FLAG_SET (0x07000000UL) +#define MCDRV_EVT_C_REG_FLAG_RESET (0x08000000UL) +#define MCDRV_EVT_F_REG_FLAG_SET (0x09000000UL) +#define MCDRV_EVT_F_REG_FLAG_RESET (0x0A000000UL) + +#define MCDRV_PACKET_EVT_MASK (0x0FFF0000UL) +#define MCDRV_PACKET_EVTPRM_MASK (0x0000FFFFUL) + +/* timer */ +#define MCDRV_PACKET_TIME_MASK (0x0FFFFFFFUL) + + + +SINT32 McDevIf_AllocPacketBuf(void); +void McDevIf_ReleasePacketBuf(void); +void McDevIf_ClearPacket(void); +void McDevIf_AddPacket(UINT32 dDesc, UINT8 bData); +void McDevIf_AddPacketRepeat(UINT32 dDesc, + const UINT8 *pbData, + UINT32 dDataCount); +SINT32 McDevIf_ExecutePacket(void); +void McDevIf_ReadDirect(UINT32 dDesc, + UINT8 *pbData, + UINT32 dSize); +void McDevIf_WriteDirect(UINT8 *pbData, UINT32 dSize); + + +#endif /* _MCDEVIF_H_ */ diff --git a/sound/soc/codecs/ymu831/mcdevprof.c b/sound/soc/codecs/ymu831/mcdevprof.c new file mode 100644 index 00000000000..c57129ac5b4 --- /dev/null +++ b/sound/soc/codecs/ymu831/mcdevprof.c @@ -0,0 +1,1237 @@ +/**************************************************************************** + * + * Copyright(c) 2012 Yamaha Corporation. All rights reserved. + * + * Module : mcdevprof.c + * + * Description : MC Driver device profile + * + * Version : 1.0.0 2012.12.13 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + * + ****************************************************************************/ + + +#include "mcdevprof.h" +#include "mcmachdep.h" +#include "mcdefs.h" +#if MCDRV_DEBUG_LEVEL +#include "mcdebuglog.h" +#endif + + + +static enum MCDRV_DEV_ID geDevID = eMCDRV_DEV_ID_80_90H; + +static UINT8 gabSlaveAddr[] = { + 0x11, /* Digital */ + 0x3A, /* Analog */ +}; + +/* register access available */ +static const enum MCDRV_REG_ACCSESS gawRegAccessAvailable_IF[256] = { + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 0 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 2 */ + eMCDRV_READ_WRITE, eMCDRV_ACCESS_DENY, /* 4 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 6 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 8 */ + eMCDRV_READ_WRITE, eMCDRV_ACCESS_DENY, /* 10 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 12 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 14 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 16 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 18 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 20 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 22 */ + eMCDRV_CAN_READ, eMCDRV_ACCESS_DENY, /* 24 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 26 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 28 */ + eMCDRV_CAN_WRITE, eMCDRV_CAN_WRITE, /* 30 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 32 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 34 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 36 */ + eMCDRV_READ_WRITE, eMCDRV_ACCESS_DENY, /* 38 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 40 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 42 */ + eMCDRV_READ_WRITE, eMCDRV_CAN_WRITE, /* 44 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 46 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 48 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 50 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 52 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 54 */ + eMCDRV_CAN_READ, eMCDRV_READ_WRITE, /* 56 */ + eMCDRV_READ_WRITE, eMCDRV_ACCESS_DENY, /* 58 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 60 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 62 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 64 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 66 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 68 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 70 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 72 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 74 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 76 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 78 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 80 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 82 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 84 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 86 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 88 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 90 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 92 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 94 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 96 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 98 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 100 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 102 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 104 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 106 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 108 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 110 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 112 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 114 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 116 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 118 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 120 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 122 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 124 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 126 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 128 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 130 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 132 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 134 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 136 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 138 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 140 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 142 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 144 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 146 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 148 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 150 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 152 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 154 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 156 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 158 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 160 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 162 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 164 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 166 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 168 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 170 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 172 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 174 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 176 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 178 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 180 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 182 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 184 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 186 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 188 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 190 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 192 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 194 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 196 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 198 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 200 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 202 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 204 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 206 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 208 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 210 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 212 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 214 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 216 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 218 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 220 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 222 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 224 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 226 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 228 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 230 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 232 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 234 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 236 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 238 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 240 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 242 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 244 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 246 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 248 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 250 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 252 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY /* 254 */ +}; +static const enum MCDRV_REG_ACCSESS gawRegAccessAvailable_A[256] = { + eMCDRV_CAN_READ, eMCDRV_READ_WRITE, /* 0 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 2 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 4 */ + eMCDRV_READ_WRITE, eMCDRV_ACCESS_DENY, /* 6 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 8 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 10 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 12 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 14 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 16 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 18 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 20 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 22 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 24 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 26 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 28 */ + eMCDRV_READ_WRITE, eMCDRV_ACCESS_DENY, /* 30 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 32 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 34 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 36 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 38 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 40 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 42 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 44 */ + eMCDRV_READ_WRITE, eMCDRV_ACCESS_DENY, /* 46 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 48 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 50 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 52 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 54 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 56 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 58 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 60 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 62 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 64 */ + eMCDRV_ACCESS_DENY, eMCDRV_READ_WRITE, /* 66 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 68 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 70 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 72 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 74 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 76 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 78 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 80 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 82 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 84 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 86 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 88 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 90 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 92 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 94 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 96 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 98 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 100 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 102 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 104 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 106 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 108 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 110 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 112 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 114 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 116 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 118 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 120 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 122 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 124 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 126 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 128 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 130 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 132 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 134 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 136 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 138 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 140 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 142 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 144 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 146 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 148 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 150 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 152 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 154 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 156 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 158 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 160 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 162 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 164 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 166 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 168 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 170 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 172 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 174 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 176 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 178 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 180 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 182 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 184 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 186 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 188 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 190 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 192 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 194 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 196 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 198 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 200 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 202 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 204 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 206 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 208 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 210 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 212 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 214 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 216 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 218 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 220 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 222 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 224 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 226 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 228 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 230 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 232 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 234 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 236 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 238 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 240 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 242 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 244 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 246 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 248 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 250 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 252 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY /* 254 */ +}; +static const enum MCDRV_REG_ACCSESS gawRegAccessAvailable_MA[256] = { + eMCDRV_CAN_READ, eMCDRV_CAN_READ, /* 0 */ + eMCDRV_CAN_READ, eMCDRV_CAN_READ, /* 2 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 4 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 6 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 8 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 10 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 12 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 14 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 16 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 18 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 20 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 22 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 24 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 26 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 28 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 30 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 32 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 34 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 36 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 38 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 40 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 42 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 44 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 46 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 48 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 50 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 52 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 54 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 56 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 58 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 60 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 62 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 64 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 66 */ + eMCDRV_READ_WRITE, eMCDRV_ACCESS_DENY, /* 68 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 70 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 72 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 74 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 76 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 78 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 80 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 82 */ + eMCDRV_READ_WRITE, eMCDRV_ACCESS_DENY, /* 84 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 86 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 88 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 90 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 92 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 94 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 96 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 98 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 100 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 102 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 104 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 106 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 108 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 110 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 112 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 114 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 116 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 118 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 120 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 122 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 124 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 126 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 128 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 130 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 132 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 134 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 136 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 138 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 140 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 142 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 144 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 146 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 148 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 150 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 152 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 154 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 156 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 158 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 160 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 162 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 164 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 166 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 168 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 170 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 172 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 174 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 176 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 178 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 180 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 182 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 184 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 186 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 188 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 190 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 192 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 194 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 196 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 198 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 200 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 202 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 204 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 206 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 208 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 210 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 212 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 214 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 216 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 218 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 220 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 222 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 224 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 226 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 228 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 230 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 232 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 234 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 236 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 238 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 240 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 242 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 244 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 246 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 248 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 250 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 252 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 254 */ +}; +static const enum MCDRV_REG_ACCSESS gawRegAccessAvailable_MB[256] = { + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 0 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 2 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 4 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 6 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 8 */ + eMCDRV_READ_WRITE, eMCDRV_ACCESS_DENY, /* 10 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 12 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 14 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 16 */ + eMCDRV_ACCESS_DENY, eMCDRV_READ_WRITE, /* 18 */ + eMCDRV_ACCESS_DENY, eMCDRV_READ_WRITE, /* 20 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 22 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 24 */ + eMCDRV_READ_WRITE, eMCDRV_ACCESS_DENY, /* 26 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 28 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 30 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 32 */ + eMCDRV_ACCESS_DENY, eMCDRV_READ_WRITE, /* 34 */ + eMCDRV_ACCESS_DENY, eMCDRV_READ_WRITE, /* 36 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 38 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 40 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 42 */ + eMCDRV_READ_WRITE, eMCDRV_ACCESS_DENY, /* 44 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 46 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 48 */ + eMCDRV_ACCESS_DENY, eMCDRV_READ_WRITE, /* 50 */ + eMCDRV_ACCESS_DENY, eMCDRV_READ_WRITE, /* 52 */ + eMCDRV_READ_WRITE, eMCDRV_ACCESS_DENY, /* 54 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 56 */ + eMCDRV_READ_WRITE, eMCDRV_ACCESS_DENY, /* 58 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 60 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 62 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 64 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 66 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 68 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 70 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 72 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 74 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 76 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 78 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 80 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 82 */ + eMCDRV_ACCESS_DENY, eMCDRV_READ_WRITE, /* 84 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 86 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 88 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 90 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 92 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 94 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 96 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 98 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 100 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 102 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 104 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 106 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 108 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 110 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 112 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 114 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 116 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 118 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 120 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 122 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 124 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 126 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 128 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 130 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 132 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 134 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 136 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 138 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 140 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 142 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 144 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 146 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 148 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 150 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 152 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 154 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 156 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 158 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 160 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 162 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 164 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 166 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 168 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 170 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 172 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 174 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 176 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 178 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 180 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 182 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 184 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 186 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 188 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 190 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 192 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 194 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 196 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 198 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 200 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 202 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 204 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 206 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 208 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 210 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 212 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 214 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 216 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 218 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 220 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 222 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 224 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 226 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 228 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 230 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 232 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 234 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 236 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 238 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 240 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 242 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 244 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 246 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 248 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 250 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 252 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 254 */ +}; +static const enum MCDRV_REG_ACCSESS gawRegAccessAvailable_E[256] = { + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 0 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 2 */ + eMCDRV_READ_WRITE, eMCDRV_ACCESS_DENY, /* 4 */ + eMCDRV_READ_WRITE, eMCDRV_ACCESS_DENY, /* 6 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 8 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 10 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 12 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 14 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 16 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 18 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 20 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 22 */ + eMCDRV_READ_WRITE, eMCDRV_ACCESS_DENY, /* 24 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 26 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 28 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 30 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 32 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 34 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 36 */ + eMCDRV_READ_WRITE, eMCDRV_ACCESS_DENY, /* 38 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 40 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 42 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 44 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 46 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 48 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 50 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 52 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 54 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 56 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 58 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 60 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 62 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 64 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 66 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 68 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 70 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 72 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 74 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 76 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 78 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 80 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 82 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 84 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 86 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 88 */ + eMCDRV_READ_WRITE, eMCDRV_CAN_READ, /* 90 */ + eMCDRV_CAN_READ, eMCDRV_CAN_READ, /* 92 */ + eMCDRV_READ_WRITE, eMCDRV_ACCESS_DENY, /* 94 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 96 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 98 */ + eMCDRV_READ_WRITE, eMCDRV_ACCESS_DENY, /* 100 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 102 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 104 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 106 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 108 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 110 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 112 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 114 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 116 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 118 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 120 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 122 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 124 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 126 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 128 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 130 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 132 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 134 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 136 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 138 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 140 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 142 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 144 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 146 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 148 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 150 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 152 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 154 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 156 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 158 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 160 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 162 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 164 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 166 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 168 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 170 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 172 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 174 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 176 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 178 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 180 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 182 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 184 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 186 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 188 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 190 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 192 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 194 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 196 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 198 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 200 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 202 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 204 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 206 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 208 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 210 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 212 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 214 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 216 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 218 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 220 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 222 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 224 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 226 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 228 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 230 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 232 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 234 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 236 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 238 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 240 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 242 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 244 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 246 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 248 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 250 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 252 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 254 */ +}; +static const enum MCDRV_REG_ACCSESS gawRegAccessAvailable_ANA[256] = { + eMCDRV_CAN_READ, eMCDRV_READ_WRITE, /* 0 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 2 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 4 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 6 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 8 */ + eMCDRV_READ_WRITE, eMCDRV_CAN_READ, /* 10 */ + eMCDRV_CAN_READ, eMCDRV_READ_WRITE, /* 12 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 14 */ + eMCDRV_ACCESS_DENY, eMCDRV_READ_WRITE, /* 16 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 18 */ + eMCDRV_ACCESS_DENY, eMCDRV_READ_WRITE, /* 20 */ + eMCDRV_READ_WRITE, eMCDRV_ACCESS_DENY, /* 22 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 24 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 26 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 28 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 30 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 32 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 34 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 36 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 38 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 40 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 42 */ + eMCDRV_READ_WRITE, eMCDRV_CAN_READ, /* 44 */ + eMCDRV_CAN_READ, eMCDRV_READ_WRITE, /* 46 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 48 */ + eMCDRV_READ_WRITE, eMCDRV_CAN_READ, /* 50 */ + eMCDRV_ACCESS_DENY, eMCDRV_READ_WRITE, /* 52 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 54 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 56 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 58 */ + eMCDRV_ACCESS_DENY, eMCDRV_READ_WRITE, /* 60 */ + eMCDRV_READ_WRITE, eMCDRV_ACCESS_DENY, /* 62 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 64 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 66 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 68 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 70 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 72 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 74 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 76 */ + eMCDRV_READ_WRITE, eMCDRV_ACCESS_DENY, /* 78 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 80 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 82 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 84 */ + eMCDRV_ACCESS_DENY, eMCDRV_READ_WRITE, /* 86 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 88 */ + eMCDRV_ACCESS_DENY, eMCDRV_CAN_READ, /* 90 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 92 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 94 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 96 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 98 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 100 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 102 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 104 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 106 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 108 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 110 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 112 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 114 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 116 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 118 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 120 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 122 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 124 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 126 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 128 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 130 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 132 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 134 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 136 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 138 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 140 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 142 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 144 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 146 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 148 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 150 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 152 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 154 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 156 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 158 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 160 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 162 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 164 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 166 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 168 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 170 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 172 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 174 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 176 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 178 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 180 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 182 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 184 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 186 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 188 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 190 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 192 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 194 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 196 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 198 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 200 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 202 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 204 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 206 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 208 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 210 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 212 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 214 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 216 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 218 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 220 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 222 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 224 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 226 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 228 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 230 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 232 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 234 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 236 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 238 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 240 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 242 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 244 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 246 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 248 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 250 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 252 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 254 */ +}; +static const enum MCDRV_REG_ACCSESS gawRegAccessAvailable_CD[256] = { + eMCDRV_CAN_READ, eMCDRV_READ_WRITE, /* 0 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 2 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 4 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 6 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 8 */ + eMCDRV_READ_WRITE, eMCDRV_CAN_READ, /* 10 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 12 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 14 */ + eMCDRV_READ_WRITE, eMCDRV_CAN_READ, /* 16 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 18 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 20 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 22 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 24 */ + eMCDRV_READ_WRITE, eMCDRV_ACCESS_DENY, /* 26 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 28 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 30 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 32 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 34 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 36 */ + eMCDRV_ACCESS_DENY, eMCDRV_READ_WRITE, /* 38 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 40 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 42 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 44 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 46 */ + eMCDRV_READ_WRITE, eMCDRV_READ_WRITE, /* 48 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 50 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 52 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 54 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 56 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 58 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 60 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 62 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 64 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 66 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 68 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 70 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 72 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 74 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 76 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 78 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 80 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 82 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 84 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 86 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 88 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 90 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 92 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 94 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 96 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 98 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 100 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 102 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 104 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 106 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 108 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 110 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 112 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 114 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 116 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 118 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 120 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 122 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 124 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 126 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 128 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 130 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 132 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 134 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 136 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 138 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 140 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 142 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 144 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 146 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 148 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 150 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 152 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 154 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 156 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 158 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 160 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 162 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 164 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 166 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 168 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 170 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 172 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 174 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 176 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 178 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 180 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 182 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 184 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 186 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 188 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 190 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 192 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 194 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 196 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 198 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 200 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 202 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 204 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 206 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 208 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 210 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 212 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 214 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 216 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 218 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 220 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 222 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 224 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 226 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 228 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 230 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 232 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 234 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 236 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 238 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 240 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 242 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 244 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 246 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 248 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 250 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 252 */ + eMCDRV_ACCESS_DENY, eMCDRV_ACCESS_DENY, /* 254 */ +}; + +/**************************************************************************** + * McDevProf_SetDevId + * + * Description: + * Set device ID. + * Arguments: + * eDevId device ID + * Return: + * none + * + ****************************************************************************/ +void McDevProf_SetDevId(enum MCDRV_DEV_ID eDevId) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McDevProf_SetDevId"); +#endif + + geDevID = eDevId; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McDevProf_SetDevId", 0); +#endif +} + +/**************************************************************************** + * McDevProf_GetDevId + * + * Description: + * Get device ID. + * Arguments: + * none + * Return: + * device ID + * + ****************************************************************************/ +enum MCDRV_DEV_ID McDevProf_GetDevId(void) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + SINT32 sdRet = geDevID; + McDebugLog_FuncIn("McDevProf_GetDevId"); +#endif + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McDevProf_GetDevId", &sdRet); +#endif + + return geDevID; +} + +/**************************************************************************** + * McDevProf_GetSlaveAddr + * + * Description: + * get slave address. + * Arguments: + * eSlaveAddrKind slave address kind + * Return: + * slave address + * + ****************************************************************************/ +UINT8 McDevProf_GetSlaveAddr( + enum MCDRV_SLAVE_ADDR_KIND eSlaveAddrKind +) +{ + UINT8 bData = gabSlaveAddr[eSlaveAddrKind]; + +#if (MCDRV_DEBUG_LEVEL >= 4) + SINT32 sdRet; + McDebugLog_FuncIn("McDevProf_GetSlaveAddr"); +#endif + +#if (MCDRV_DEBUG_LEVEL >= 4) + sdRet = (SINT32)bData; + McDebugLog_FuncOut("McDevProf_GetSlaveAddr", &sdRet); +#endif + + return bData; +} + +/**************************************************************************** + * McDevProf_GetRegAccess + * + * Description: + * Get register access availability + * Arguments: + * psRegInfo register information + * Return: + * MCDRV_REG_ACCSESS + * + ****************************************************************************/ +enum MCDRV_REG_ACCSESS McDevProf_GetRegAccess( + const struct MCDRV_REG_INFO *psRegInfo +) +{ + enum MCDRV_REG_ACCSESS eAccess = eMCDRV_ACCESS_DENY; + +#if (MCDRV_DEBUG_LEVEL >= 4) + SINT32 sdRet; + McDebugLog_FuncIn("McDevProf_GetRegAccess"); +#endif + + switch (psRegInfo->bRegType) { + case MCDRV_REGTYPE_IF: +#if 1 /*for FPGA*/ + eAccess = eMCDRV_READ_WRITE; +#else + eAccess = gawRegAccessAvailable_IF[psRegInfo->bAddress]; +#endif + break; + case MCDRV_REGTYPE_A: + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H) { + if ((psRegInfo->bAddress == MCI_DOA_DRV) + || (psRegInfo->bAddress == MCI_SCKMSKON_B)) { + eAccess = eMCDRV_ACCESS_DENY; + break; + } + } + eAccess = gawRegAccessAvailable_A[psRegInfo->bAddress]; + break; + case MCDRV_REGTYPE_MA: + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H) { + if ((psRegInfo->bAddress == MCI_CLK_SEL) + || (psRegInfo->bAddress == MCI_LINK_LOCK)) { + eAccess = eMCDRV_ACCESS_DENY; + break; + } + } + eAccess = gawRegAccessAvailable_MA[psRegInfo->bAddress]; + break; + case MCDRV_REGTYPE_MB: + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H) { + if (psRegInfo->bAddress == MCI_T_DPLL_FAST) { + eAccess = eMCDRV_ACCESS_DENY; + break; + } + } + eAccess = gawRegAccessAvailable_MB[psRegInfo->bAddress]; + break; + case MCDRV_REGTYPE_B: + eAccess = eMCDRV_READ_WRITE; + break; + case MCDRV_REGTYPE_E: + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H) { + switch (psRegInfo->bAddress) { + case MCI_DAC_DCC_SEL: + case MCI_DET_LVL: + case MCI_OSF_SEL: + case MCI_CLIP_MD: + case MCI_CLIP_ATT: + case MCI_CLIP_REL: + case MCI_CLIP_G: + case MCI_OSF_GAIN0_15_8: + case MCI_OSF_GAIN0_7_0: + case MCI_OSF_GAIN1_15_8: + case MCI_OSF_GAIN1_7_0: + case MCI_DNG0_ES1: + case MCI_DNG1_ES1: + case MCI_DNG_ON_ES1: + case MCI_DSF_SEL: + case MCI_ADC_DCC_SEL: + case MCI_ADC_DNG_ON: + case MCI_ADC_DNG0_FW: + case MCI_ADC_DNG0_TIM: + case MCI_ADC_DNG0_ZERO_15_8: + case MCI_ADC_DNG0_ZERO_7_0: + case MCI_ADC_DNG0_TGT_15_8: + case MCI_ADC_DNG0_TGT_7_0: + case MCI_ADC_DNG1_FW: + case MCI_ADC_DNG1_TIM: + case MCI_ADC_DNG1_ZERO_15_8: + case MCI_ADC_DNG1_ZERO_7_0: + case MCI_ADC_DNG1_TGT_15_8: + case MCI_ADC_DNG1_TGT_7_0: + case MCI_ADC_DNG2_FW: + case MCI_ADC_DNG2_TIM: + case MCI_ADC_DNG2_ZERO_15_8: + case MCI_ADC_DNG2_ZERO_7_0: + case MCI_ADC_DNG2_TGT_15_8: + case MCI_ADC_DNG2_TGT_7_0: + case MCI_DEPOP0: + case MCI_DEPOP1: + case MCI_DEPOP2: + case MCI_IMPSEL: + eAccess = eMCDRV_CAN_WRITE; + break; + case MCI_ECLK_SEL: + eAccess = eMCDRV_ACCESS_DENY; + break; + case MCI_SYSEQ: + eAccess = eMCDRV_CAN_WRITE; + break; + case MCI_DITHER0: + case MCI_DITHER1: + eAccess = eMCDRV_READ_WRITE; + break; + case MCI_ADJ_HOLD: + case MCI_ADJ_CNT: + case MCI_ADJ_MAX_15_8: + case MCI_ADJ_MAX_7_0: + eAccess = eMCDRV_CAN_WRITE; + break; + case MCI_DNG0: + case MCI_DNG1: + case MCI_DNG_ON: + eAccess = eMCDRV_ACCESS_DENY; + break; + default: + eAccess = + gawRegAccessAvailable_E[psRegInfo->bAddress]; + break; + } + break; + } + eAccess = gawRegAccessAvailable_E[psRegInfo->bAddress]; + break; + case MCDRV_REGTYPE_C: + eAccess = eMCDRV_READ_WRITE; + break; + case MCDRV_REGTYPE_F: + eAccess = eMCDRV_READ_WRITE; + break; + case MCDRV_REGTYPE_ANA: + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H) { + switch (psRegInfo->bAddress) { + case MCI_RBSEL: + case MCI_DNG_ES1: + case MCI_DNG_HP_ES1: + case MCI_DNG_SP_ES1: + case MCI_DNG_RC_ES1: + case MCI_DNG_LO1_ES1: + case MCI_DNG_LO2_ES1: + eAccess = eMCDRV_READ_WRITE; + break; + case 10: + case 91: + case MCI_DNG: + case MCI_DNG_HP: + case MCI_DNG_SP: + case MCI_DNG_RC: + case MCI_DNG_LO1: + case MCI_DNG_LO2: + eAccess = eMCDRV_ACCESS_DENY; + break; + default: + eAccess = + gawRegAccessAvailable_ANA[psRegInfo->bAddress]; + break; + } + break; + } + eAccess = gawRegAccessAvailable_ANA[psRegInfo->bAddress]; + break; + case MCDRV_REGTYPE_CD: + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H) { + if ((psRegInfo->bAddress == MCI_SCKMSKON_R) + || (psRegInfo->bAddress == MCI_IRQM_KEYOFF)) { + eAccess = eMCDRV_ACCESS_DENY; + break; + } + if (psRegInfo->bAddress == MCI_STDPLUGSEL) { + eAccess = eMCDRV_READ_WRITE; + break; + } + } + eAccess = gawRegAccessAvailable_CD[psRegInfo->bAddress]; + break; + default: + break; + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + sdRet = eAccess; + McDebugLog_FuncOut("McDevProf_GetRegAccess", &sdRet); +#endif + + return eAccess; +} + + + diff --git a/sound/soc/codecs/ymu831/mcdevprof.h b/sound/soc/codecs/ymu831/mcdevprof.h new file mode 100644 index 00000000000..d8e75b5bbfc --- /dev/null +++ b/sound/soc/codecs/ymu831/mcdevprof.h @@ -0,0 +1,60 @@ +/**************************************************************************** + * + * Copyright(c) 2012-2013 Yamaha Corporation. All rights reserved. + * + * Module : mcdevprof.h + * + * Description : MC Driver device profile header + * + * Version : 2.0.0 2013.03.19 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + * + ****************************************************************************/ + +#ifndef _MCDEVPROF_H_ +#define _MCDEVPROF_H_ + +#include "mctypedef.h" +#include "mcdriver.h" +#include "mcresctrl.h" + +enum MCDRV_DEV_ID { + eMCDRV_DEV_ID_80_90H = 0, + eMCDRV_DEV_ID_81_91H, + eMCDRV_DEV_ID_81_92H, + eMCDRV_DEV_ID_89_92H +}; + +enum MCDRV_SLAVE_ADDR_KIND { + eMCDRV_SLAVE_ADDR_DIG = 0, + eMCDRV_SLAVE_ADDR_ANA +}; + + + +void McDevProf_SetDevId(enum MCDRV_DEV_ID eDevId); +enum MCDRV_DEV_ID McDevProf_GetDevId(void); + +UINT8 McDevProf_GetSlaveAddr(enum MCDRV_SLAVE_ADDR_KIND eSlaveAddrKind); + +enum MCDRV_REG_ACCSESS McDevProf_GetRegAccess( + const struct MCDRV_REG_INFO *psRegInfo); + + + +#endif /* _MCDEVPROF_H_ */ diff --git a/sound/soc/codecs/ymu831/mcdriver.c b/sound/soc/codecs/ymu831/mcdriver.c new file mode 100644 index 00000000000..9f1a6fa7bce --- /dev/null +++ b/sound/soc/codecs/ymu831/mcdriver.c @@ -0,0 +1,6315 @@ +/**************************************************************************** + * + * Copyright(c) 2012-2013 Yamaha Corporation. All rights reserved. + * + * Module : mcdriver.c + * + * Description : MC Driver + * + * Version : 2.0.1 2013.06.10 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + * + ****************************************************************************/ + + +#include "mcdriver.h" +#include "mcservice.h" +#include "mcdevif.h" +#include "mcresctrl.h" +#include "mcparser.h" +#include "mcdefs.h" +#include "mcdevprof.h" +#include "mcmachdep.h" +#include "mcbdspdrv.h" +#include "mccdspdrv.h" +#include "mcedspdrv.h" +#include "mcfdspdrv.h" +#if MCDRV_DEBUG_LEVEL +#include "mcdebuglog.h" +#endif + + + + +#define MCDRV_MAX_WAIT_TIME (268435455UL) +#define MCDRV_LDO_WAIT_TIME (1000UL) +#define MCDRV_DAC_MUTE_WAIT_TIME (20000UL) +#define MCDRV_VREF_WAIT_TIME_ES1 (2000UL) +#define MCDRV_VREF_WAIT_TIME (30000UL) +#define MCDRV_MB4_WAIT_TIME (8000UL) +#define MCDRV_SP_WAIT_TIME (200UL) + +#define T_CPMODE_IMPSENSE_BEFORE (0) +#define T_CPMODE_IMPSENSE_AFTER (2) + +static const struct MCDRV_PATH_INFO gsPathInfoAllOff = { + {{0x00AAAAAA}, {0x00AAAAAA} }, /* asMusicOut */ + {{0x00AAAAAA}, {0x00AAAAAA} }, /* asExtOut */ + {{0x00AAAAAA} }, /* asHifiOut */ + {{0x00AAAAAA}, {0x00AAAAAA}, + {0x00AAAAAA}, {0x00AAAAAA} }, /* asVboxMixIn */ + {{0x00AAAAAA}, {0x00AAAAAA} }, /* asAe0 */ + {{0x00AAAAAA}, {0x00AAAAAA} }, /* asAe1 */ + {{0x00AAAAAA}, {0x00AAAAAA} }, /* asAe2 */ + {{0x00AAAAAA}, {0x00AAAAAA} }, /* asAe3 */ + {{0x00AAAAAA}, {0x00AAAAAA} }, /* asDac0 */ + {{0x00AAAAAA}, {0x00AAAAAA} }, /* asDac1 */ + {{0x00AAAAAA} }, /* asVoiceOut */ + {{0x00AAAAAA} }, /* asVboxIoIn */ + {{0x00AAAAAA} }, /* asVboxHostIn */ + {{0x00AAAAAA} }, /* asHostOut */ + {{0x00AAAAAA}, {0x00AAAAAA} }, /* asAdif0 */ + {{0x00AAAAAA}, {0x00AAAAAA} }, /* asAdif1 */ + {{0x00AAAAAA}, {0x00AAAAAA} }, /* asAdif2 */ + {{0x002AAAAA}, {0x002AAAAA} }, /* asAdc0 */ + {{0x002AAAAA} }, /* asAdc1 */ + {{0x002AAAAA}, {0x002AAAAA} }, /* asSp */ + {{0x002AAAAA}, {0x002AAAAA} }, /* asHp */ + {{0x002AAAAA} }, /* asRc */ + {{0x002AAAAA}, {0x002AAAAA} }, /* asLout1 */ + {{0x002AAAAA}, {0x002AAAAA} }, /* asLout2 */ + {{0x002AAAAA}, {0x002AAAAA}, + {0x002AAAAA}, {0x002AAAAA} } /* asBias */ +}; + +static const struct MCDRV_PATH_INFO gsPathInfoAllZero = { + {{0x00000000}, {0x00000000} }, /* asMusicOut */ + {{0x00000000}, {0x00000000} }, /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} }, /* asVboxMixIn */ + {{0x00000000}, {0x00000000} }, /* asAe0 */ + {{0x00000000}, {0x00000000} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{0x00000000}, {0x00000000} }, /* asDac0 */ + {{0x00000000}, {0x00000000} }, /* asDac1 */ + {{0x00000000} }, /* asVoiceOut */ + {{0x00000000} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{0x00000000} }, /* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{0x00000000}, {0x00000000} }, /* asAdif1 */ + {{0x00000000}, {0x00000000} }, /* asAdif2 */ + {{0x00000000}, {0x00000000} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{0x00000000}, {0x00000000} }, /* asSp */ + {{0x00000000}, {0x00000000} }, /* asHp */ + {{0x00000000} }, /* asRc */ + {{0x00000000}, {0x00000000} }, /* asLout1 */ + {{0x00000000}, {0x00000000} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ +}; + +static SINT32 init(const struct MCDRV_INIT_INFO *psInitInfo, + const struct MCDRV_INIT2_INFO *psInit2Info); +static SINT32 term(void); + +static SINT32 read_reg(struct MCDRV_REG_INFO *psRegInfo); +static SINT32 write_reg(const struct MCDRV_REG_INFO *psRegInfo); + +static SINT32 get_clocksw(struct MCDRV_CLOCKSW_INFO *psClockSwInfo); +static SINT32 set_clocksw(const struct MCDRV_CLOCKSW_INFO *psClockSwInfo); + +static SINT32 get_path(struct MCDRV_PATH_INFO *psPathInfo); +static SINT32 set_path(const struct MCDRV_PATH_INFO *psPathInfo); + +static SINT32 get_volume(struct MCDRV_VOL_INFO *psVolInfo); +static SINT32 set_volume(const struct MCDRV_VOL_INFO *psVolInfo); + +static SINT32 get_digitalio(struct MCDRV_DIO_INFO *psDioInfo); +static SINT32 set_digitalio(const struct MCDRV_DIO_INFO *psDioInfo, + UINT32 dUpdateInfo); + +static SINT32 get_digitalio_path(struct MCDRV_DIOPATH_INFO *psDioPathInfo); +static SINT32 set_digitalio_path( + const struct MCDRV_DIOPATH_INFO *psDioPathInfo, + UINT32 dUpdateInfo); + +static SINT32 get_swap(struct MCDRV_SWAP_INFO *psSwapInfo); +static SINT32 set_swap(const struct MCDRV_SWAP_INFO *psSwapInfo, + UINT32 dUpdateInfo); + +static UINT8 IsPathAllOff(void); +static SINT32 set_dsp(const UINT8 *pbPrm, UINT32 dSize); +static SINT32 get_dsp(struct MCDRV_DSP_PARAM *psDspParam, + void *pvData, + UINT32 dSize); +static SINT32 get_dsp_data(UINT8 *pbData, UINT32 dSize); +static SINT32 set_dsp_data(const UINT8 *pbData, UINT32 dSize); +static SINT32 register_dsp_cb(SINT32 (*pcbfunc)(SINT32, UINT32, UINT32)); +static SINT32 get_dsp_transition(UINT32 dDspType); + +static SINT32 get_hsdet(struct MCDRV_HSDET_INFO *psHSDet, + struct MCDRV_HSDET2_INFO *psHSDet2); +static SINT32 set_hsdet(const struct MCDRV_HSDET_INFO *psHSDet, + const struct MCDRV_HSDET2_INFO *psHSDet2, + UINT32 dUpdateInfo); +static SINT32 config_gp(const struct MCDRV_GP_MODE *psGpMode); +static SINT32 mask_gp(UINT8 *pbMask, UINT32 dPadNo); +static SINT32 getset_gp(UINT8 *pbGpio, UINT32 dPadNo); + +static SINT32 irq_proc(void); +static SINT32 BeginImpSense(UINT8 *bOP_DAC); + +static UINT8 IsLDOAOn(void); +static UINT8 IsValidInitParam(const struct MCDRV_INIT_INFO *psInitInfo, + const struct MCDRV_INIT2_INFO *psInit2Info); +static UINT8 IsValidClockSwParam( + const struct MCDRV_CLOCKSW_INFO *psClockSwInfo); +static UINT8 IsValidReadRegParam(const struct MCDRV_REG_INFO *psRegInfo); +static UINT8 IsValidWriteRegParam(const struct MCDRV_REG_INFO *psRegInfo); +static void MaskIrregularPath(struct MCDRV_PATH_INFO *psPathInfo); +static UINT8 IsValidDioParam(const struct MCDRV_DIO_INFO *psDioInfo, + UINT32 dUpdateInfo); +static UINT8 IsValidDioPathParam( + const struct MCDRV_DIOPATH_INFO *psDioPathInfo, + UINT32 dUpdateInfo); +static UINT8 IsValidSwapParam(const struct MCDRV_SWAP_INFO *psSwapInfo, + UINT32 dUpdateInfo); +static UINT8 IsValidDspParam(const struct MCDRV_AEC_INFO *psAECInfo); +static UINT8 IsValidHSDetParam(const struct MCDRV_HSDET_INFO *psHSDetInfo, + const struct MCDRV_HSDET2_INFO *psHSDet2Info, + UINT32 dUpdateInfo); +static UINT8 IsValidGpParam(const struct MCDRV_GP_MODE *psGpMode); +static UINT8 IsValidMaskGp(UINT8 bMask, UINT32 dPadNo); + +static UINT8 CheckDIOCommon(const struct MCDRV_DIO_INFO *psDioInfo, + UINT8 bPort); +static UINT8 CheckDaFormat(const struct MCDRV_DA_FORMAT *psDaFormat); +static UINT8 CheckPcmFormat(const struct MCDRV_PCM_FORMAT *psPcmFormat); +static UINT8 CheckDIODIR(const struct MCDRV_DIO_INFO *psDioInfo, + UINT8 bPort); +static UINT8 CheckDIODIT(const struct MCDRV_DIO_INFO *psDioInfo, + UINT8 bPort); + +static SINT32 SetVol(UINT32 dUpdate, + enum MCDRV_VOLUPDATE_MODE eMode, + UINT32 *pdSVolDoneParam); +static void GetMuteParam(UINT8 *pbDIRMuteParam, + UINT8 *pbADCMuteParam, + UINT8 *pbDITMuteParam, + UINT8 *pbDACMuteParam); +static SINT32 SavePower(void); + +/**************************************************************************** + * init + * + * Description: + * Initialize. + * Arguments: + * psInitInfo initialize information + * psInit2Info initialize information + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR_ARGUMENT + * MCDRV_ERROR_STATE + * + ****************************************************************************/ +static SINT32 init +( + const struct MCDRV_INIT_INFO *psInitInfo, + const struct MCDRV_INIT2_INFO *psInit2Info +) +{ + SINT32 sdRet; + UINT8 abData[4]; + UINT8 bHwId_dig, + bHwId_ana = 0; + UINT8 bAP = MCI_AP_DEF; + enum MCDRV_STATE eState = McResCtrl_GetState(); + struct MCDRV_POWER_INFO sPowerInfo; + struct MCDRV_POWER_UPDATE sPowerUpdate; + + if (NULL == psInitInfo) + return MCDRV_ERROR_ARGUMENT; + + if (eMCDRV_STATE_READY == eState) + return MCDRV_ERROR_STATE; + + McSrv_SystemInit(); + McSrv_Lock(); + McResCtrl_Init(); + + + machdep_PreLDODStart(); + + if (bHwId_ana == 0) { + abData[0] = MCI_ANA_REG_A<<1; + abData[1] = MCI_ANA_ID; + McSrv_WriteReg(MCDRV_SLAVEADDR_ANA, abData, 2); + bHwId_ana = McSrv_ReadReg(MCDRV_SLAVEADDR_ANA, + (UINT32)MCI_ANA_REG_D); + if ((bHwId_ana&MCDRV_DEVID_MASK) == MCDRV_DEVID_ANA) { + abData[0] = MCI_ANA_REG_A<<1; + abData[1] = MCI_ANA_RST; + abData[2] = MCI_ANA_REG_D<<1; + abData[3] = MCI_ANA_RST_DEF; + McSrv_WriteReg(MCDRV_SLAVEADDR_ANA, abData, 4); + abData[3] = 0; + McSrv_WriteReg(MCDRV_SLAVEADDR_ANA, abData, 4); + + if ((bHwId_ana&MCDRV_VERID_MASK) == 0) { + abData[1] = MCI_AP; + abData[3] = MCI_AP_DEF; + abData[3] &= + (UINT8)~MCB_AP_VR; + McSrv_WriteReg(MCDRV_SLAVEADDR_ANA, abData, 4); + McSrv_Sleep(MCDRV_VREF_WAIT_TIME_ES1); + abData[3] &= + (UINT8)~(MCB_AP_LDOA|MCB_AP_BGR); + McSrv_WriteReg(MCDRV_SLAVEADDR_ANA, abData, 4); + McSrv_Sleep(MCDRV_LDO_WAIT_TIME); + bAP = abData[3]; + } else { + abData[1] = MCI_HIZ; + abData[3] = 0; + McSrv_WriteReg(MCDRV_SLAVEADDR_ANA, abData, 4); + abData[1] = MCI_LO_HIZ; + abData[3] = 0; + McSrv_WriteReg(MCDRV_SLAVEADDR_ANA, abData, 4); + abData[1] = MCI_AP; + bAP &= (UINT8)~(MCB_AP_LDOA|MCB_AP_BGR); + abData[3] = bAP; + McSrv_WriteReg(MCDRV_SLAVEADDR_ANA, abData, 4); + McSrv_Sleep(MCDRV_LDO_WAIT_TIME); + abData[1] = 62; + abData[3] = 0x20; + McSrv_WriteReg(MCDRV_SLAVEADDR_ANA, abData, 4); + abData[1] = MCI_AP; + bAP &= (UINT8)~MCB_AP_VR; + abData[3] = bAP; + McSrv_WriteReg(MCDRV_SLAVEADDR_ANA, abData, 4); + McSrv_Sleep(MCDRV_VREF_WAIT_TIME); + abData[1] = 62; + abData[3] = 0; + McSrv_WriteReg(MCDRV_SLAVEADDR_ANA, abData, 4); + } + } + } + if ((bHwId_ana&MCDRV_DEVID_MASK) == MCDRV_DEVID_ANA) { + if ((bHwId_ana&MCDRV_VERID_MASK) == 0) + bHwId_dig = 0x80; + else + bHwId_dig = 0x81; + sdRet = McResCtrl_SetHwId(bHwId_dig, bHwId_ana); + if (sdRet == MCDRV_SUCCESS) { + McResCtrl_SetRegDefault(); + if (IsValidInitParam(psInitInfo, psInit2Info) == 0) + sdRet = MCDRV_ERROR_ARGUMENT; + McResCtrl_SetRegVal(MCDRV_PACKET_REGTYPE_ANA, MCI_AP, + bAP); + } + if (sdRet == MCDRV_SUCCESS) { + McResCtrl_SetInitInfo(psInitInfo, psInit2Info); + sdRet = McDevIf_AllocPacketBuf(); + } + if (sdRet == MCDRV_SUCCESS) { + sdRet = McPacket_AddInit(); + if (sdRet == MCDRV_SUCCESS) { + ; + sdRet = McDevIf_ExecutePacket(); + } + } + + if (sdRet == MCDRV_SUCCESS) { + if (MCDRV_AP_LDOD == 0) { + abData[0] = MCI_ANA_REG_A<<1; + abData[1] = MCI_AP; + abData[2] = MCI_ANA_REG_D<<1; + bAP &= (UINT8)~MCB_AP_LDOD; + abData[3] = bAP; + McSrv_WriteReg(MCDRV_SLAVEADDR_ANA, abData, 4); + McSrv_Sleep(MCDRV_LDO_WAIT_TIME); + McResCtrl_SetRegVal(MCDRV_PACKET_REGTYPE_ANA, + MCI_AP, bAP); + } + abData[0] = MCI_RST_A<<1; + abData[1] = MCI_RST_A_DEF; + McSrv_WriteReg(MCDRV_SLAVEADDR_DIG, abData, 2); + abData[1] = MCI_RST_A_DEF&~MCB_RST_A; + McSrv_WriteReg(MCDRV_SLAVEADDR_DIG, abData, 2); + abData[0] = MCI_A_REG_A<<1; + abData[1] = MCI_A_DEV_ID; + McSrv_WriteReg(MCDRV_SLAVEADDR_DIG, abData, 2); + abData[3] = McSrv_ReadReg(MCDRV_SLAVEADDR_DIG, + (UINT32)MCI_A_REG_D); + sdRet = McResCtrl_SetHwId(abData[3], bHwId_ana); + if (sdRet == MCDRV_SUCCESS) { + if (IsValidInitParam(psInitInfo, psInit2Info) + == 0) { + ; + sdRet = MCDRV_ERROR_ARGUMENT; + } + } + } + + if (sdRet == MCDRV_SUCCESS) { + if (psInitInfo->bPowerMode == MCDRV_POWMODE_CDSPDEBUG) { + McResCtrl_GetPowerInfo(&sPowerInfo); + /* used path power up */ + sPowerUpdate.bDigital = MCDRV_POWUPDATE_D_ALL; + sPowerUpdate.abAnalog[0] = MCB_AP_LDOD; + sPowerUpdate.abAnalog[1] = + sPowerUpdate.abAnalog[2] = + sPowerUpdate.abAnalog[3] = + sPowerUpdate.abAnalog[4] = 0; + sdRet = + McPacket_AddPowerUp(&sPowerInfo, &sPowerUpdate); + } else if ((psInit2Info != NULL) + && (psInit2Info->bOption[19] == 1)) { + /* LDOD always on */ + McResCtrl_GetPowerInfo(&sPowerInfo); + sPowerInfo.bDigital &= + (UINT8)~MCDRV_POWINFO_D_PLL_PD; + sPowerInfo.abAnalog[0] &= + (UINT8)~MCB_AP_LDOD; + sPowerUpdate.bDigital = + MCDRV_POWUPDATE_D_ALL; + sPowerUpdate.abAnalog[0] = + MCB_AP_LDOD; + sPowerUpdate.abAnalog[1] = + sPowerUpdate.abAnalog[2] = + sPowerUpdate.abAnalog[3] = + sPowerUpdate.abAnalog[4] = 0; + sdRet = + McPacket_AddPowerUp(&sPowerInfo, + &sPowerUpdate); + } + if (sdRet == MCDRV_SUCCESS) { + ; + sdRet = McDevIf_ExecutePacket(); + } + } + + if (sdRet == MCDRV_SUCCESS) { + McResCtrl_UpdateState(eMCDRV_STATE_READY); + SavePower(); + } else + McDevIf_ReleasePacketBuf(); + } else + sdRet = MCDRV_ERROR_INIT; + + bAP = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_ANA, MCI_AP); + if ((bAP&MCB_AP_LDOD) != 0) { + ; + machdep_PostLDODStart(); + } + + McSrv_Unlock(); + + if (sdRet != MCDRV_SUCCESS) + McSrv_SystemTerm(); + + return sdRet; +} + +/**************************************************************************** + * term + * + * Description: + * Terminate. + * Arguments: + * none + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR_STATE + * + ****************************************************************************/ +static SINT32 term +( + void +) +{ + SINT32 sdRet = MCDRV_SUCCESS; + struct MCDRV_INIT_INFO sInitInfo; + struct MCDRV_POWER_INFO sPowerInfo; + struct MCDRV_POWER_UPDATE sPowerUpdate; + UINT32 dUpdateFlg; + struct MCDRV_HSDET_INFO sHSDet; + UINT8 bAP; + + if (eMCDRV_STATE_READY != McResCtrl_GetState()) + return MCDRV_ERROR_STATE; + + McSrv_Lock(); + + bAP = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_ANA, MCI_AP); + if ((bAP&MCB_AP_LDOD) != 0) { + ; + machdep_PreLDODStart(); + } + + McResCtrl_GetInitInfo(&sInitInfo, NULL); + sInitInfo.bPowerMode = MCDRV_POWMODE_FULL; + McResCtrl_SetInitInfo(&sInitInfo, NULL); + + sdRet = set_path(&gsPathInfoAllOff); + if (sdRet == MCDRV_SUCCESS) { + sPowerInfo.bDigital = 0xFF; + sPowerInfo.abAnalog[0] = + sPowerInfo.abAnalog[1] = + sPowerInfo.abAnalog[2] = + sPowerInfo.abAnalog[3] = + sPowerInfo.abAnalog[4] = (UINT8)0xFF; + sPowerUpdate.bDigital = MCDRV_POWUPDATE_D_ALL; + sPowerUpdate.abAnalog[0] = + (UINT8)MCDRV_POWUPDATE_AP; + sPowerUpdate.abAnalog[1] = + (UINT8)MCDRV_POWUPDATE_AP_OUT0; + sPowerUpdate.abAnalog[2] = + (UINT8)MCDRV_POWUPDATE_AP_OUT1; + sPowerUpdate.abAnalog[3] = + (UINT8)MCDRV_POWUPDATE_AP_MC; + sPowerUpdate.abAnalog[4] = + (UINT8)MCDRV_POWUPDATE_AP_IN; + sdRet = McPacket_AddPowerDown(&sPowerInfo, &sPowerUpdate); + if (sdRet == MCDRV_SUCCESS) + sdRet = McDevIf_ExecutePacket(); + } + + sHSDet.bEnPlugDet = MCDRV_PLUGDET_DISABLE; + sHSDet.bEnPlugDetDb = MCDRV_PLUGDETDB_DISABLE; + sHSDet.bEnDlyKeyOff = MCDRV_KEYEN_D_D_D; + sHSDet.bEnDlyKeyOn = MCDRV_KEYEN_D_D_D; + sHSDet.bEnMicDet = MCDRV_MICDET_DISABLE; + sHSDet.bEnKeyOff = MCDRV_KEYEN_D_D_D; + sHSDet.bEnKeyOn = MCDRV_KEYEN_D_D_D; + dUpdateFlg = MCDRV_ENPLUGDET_UPDATE_FLAG + |MCDRV_ENPLUGDETDB_UPDATE_FLAG + |MCDRV_ENDLYKEYOFF_UPDATE_FLAG + |MCDRV_ENDLYKEYON_UPDATE_FLAG + |MCDRV_ENMICDET_UPDATE_FLAG + |MCDRV_ENKEYOFF_UPDATE_FLAG + |MCDRV_ENKEYON_UPDATE_FLAG; + sdRet = set_hsdet(&sHSDet, NULL, dUpdateFlg); + + McDevIf_ReleasePacketBuf(); + + McResCtrl_UpdateState(eMCDRV_STATE_NOTINIT); + + bAP = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_ANA, MCI_AP); + if ((bAP&MCB_AP_LDOD) != 0) { + ; + machdep_PostLDODStart(); + } + McSrv_Unlock(); + + McSrv_SystemTerm(); + + return sdRet; +} + +/**************************************************************************** + * read_reg + * + * Description: + * read register. + * Arguments: + * psRegInfo register information + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR_STATE + * MCDRV_ERROR_ARGUMENT + * + ****************************************************************************/ +static SINT32 read_reg +( + struct MCDRV_REG_INFO *psRegInfo +) +{ + SINT32 sdRet = MCDRV_SUCCESS; + UINT8 bSlaveAddr; + UINT8 bAddr; + UINT8 abData[2]; + struct MCDRV_POWER_INFO sPowerInfo; + struct MCDRV_POWER_INFO sCurPowerInfo; + struct MCDRV_POWER_UPDATE sPowerUpdate; + + if (NULL == psRegInfo) + return MCDRV_ERROR_ARGUMENT; + + if (eMCDRV_STATE_READY != McResCtrl_GetState()) + return MCDRV_ERROR_STATE; + + if (IsValidReadRegParam(psRegInfo) == 0) + return MCDRV_ERROR_ARGUMENT; + + /* get current power info */ + McResCtrl_GetCurPowerInfo(&sCurPowerInfo); + + /* power up */ + McResCtrl_GetPowerInfoRegAccess(psRegInfo, &sPowerInfo); + sPowerUpdate.bDigital = MCDRV_POWUPDATE_D_ALL; + sPowerUpdate.abAnalog[0] = (UINT8)MCDRV_POWUPDATE_AP; + sPowerUpdate.abAnalog[1] = (UINT8)MCDRV_POWUPDATE_AP_OUT0; + sPowerUpdate.abAnalog[2] = (UINT8)MCDRV_POWUPDATE_AP_OUT1; + sPowerUpdate.abAnalog[3] = (UINT8)MCDRV_POWUPDATE_AP_MC; + sPowerUpdate.abAnalog[4] = (UINT8)MCDRV_POWUPDATE_AP_IN; + sdRet = McPacket_AddPowerUp(&sPowerInfo, &sPowerUpdate); + if (MCDRV_SUCCESS != sdRet) + return sdRet; + sdRet = McDevIf_ExecutePacket(); + if (MCDRV_SUCCESS != sdRet) + return sdRet; + + bAddr = psRegInfo->bAddress; + + if (psRegInfo->bRegType == MCDRV_REGTYPE_IF) { + if ((psRegInfo->bAddress == MCI_ANA_REG_A) + || (psRegInfo->bAddress == MCI_ANA_REG_D)) + bSlaveAddr = + McDevProf_GetSlaveAddr(eMCDRV_SLAVE_ADDR_ANA); + else + bSlaveAddr = + McDevProf_GetSlaveAddr(eMCDRV_SLAVE_ADDR_DIG); + } else { + switch (psRegInfo->bRegType) { + case MCDRV_REGTYPE_A: + bSlaveAddr = + McDevProf_GetSlaveAddr(eMCDRV_SLAVE_ADDR_DIG); + abData[0] = MCI_A_REG_A<<1; + abData[1] = bAddr; + McSrv_WriteReg(bSlaveAddr, abData, 2); + bAddr = MCI_A_REG_D; + break; + + case MCDRV_REGTYPE_MA: + bSlaveAddr = + McDevProf_GetSlaveAddr(eMCDRV_SLAVE_ADDR_DIG); + abData[0] = MCI_MA_REG_A<<1; + abData[1] = bAddr; + McSrv_WriteReg(bSlaveAddr, abData, 2); + bAddr = MCI_MA_REG_D; + break; + + case MCDRV_REGTYPE_MB: + bSlaveAddr = + McDevProf_GetSlaveAddr(eMCDRV_SLAVE_ADDR_DIG); + abData[0] = MCI_MB_REG_A<<1; + abData[1] = bAddr; + McSrv_WriteReg(bSlaveAddr, abData, 2); + bAddr = MCI_MB_REG_D; + break; + + case MCDRV_REGTYPE_B: + bSlaveAddr = + McDevProf_GetSlaveAddr(eMCDRV_SLAVE_ADDR_DIG); + abData[0] = MCI_B_REG_A<<1; + abData[1] = bAddr; + McSrv_WriteReg(bSlaveAddr, abData, 2); + bAddr = MCI_B_REG_D; + break; + + case MCDRV_REGTYPE_E: + bSlaveAddr = + McDevProf_GetSlaveAddr(eMCDRV_SLAVE_ADDR_DIG); + abData[0] = MCI_E_REG_A<<1; + abData[1] = bAddr; + McSrv_WriteReg(bSlaveAddr, abData, 2); + bAddr = MCI_E_REG_D; + break; + + case MCDRV_REGTYPE_C: + bSlaveAddr = + McDevProf_GetSlaveAddr(eMCDRV_SLAVE_ADDR_DIG); + abData[0] = MCI_C_REG_A<<1; + abData[1] = bAddr; + McSrv_WriteReg(bSlaveAddr, abData, 2); + bAddr = MCI_C_REG_D; + break; + + case MCDRV_REGTYPE_F: + bSlaveAddr = + McDevProf_GetSlaveAddr(eMCDRV_SLAVE_ADDR_DIG); + abData[0] = MCI_F_REG_A<<1; + abData[1] = bAddr; + McSrv_WriteReg(bSlaveAddr, abData, 2); + bAddr = MCI_F_REG_D; + break; + + case MCDRV_REGTYPE_ANA: + bSlaveAddr = + McDevProf_GetSlaveAddr(eMCDRV_SLAVE_ADDR_ANA); + abData[0] = MCI_ANA_REG_A<<1; + abData[1] = bAddr; + McSrv_WriteReg(bSlaveAddr, abData, 2); + bAddr = MCI_ANA_REG_D; + break; + + case MCDRV_REGTYPE_CD: + bSlaveAddr = + McDevProf_GetSlaveAddr(eMCDRV_SLAVE_ADDR_ANA); + abData[0] = MCI_CD_REG_A<<1; + abData[1] = bAddr; + McSrv_WriteReg(bSlaveAddr, abData, 2); + bAddr = MCI_CD_REG_D; + break; + + default: + return MCDRV_ERROR_ARGUMENT; + } + } + + /* read register */ + psRegInfo->bData = McSrv_ReadReg(bSlaveAddr, bAddr); + + /* restore power */ + sdRet = McPacket_AddPowerDown(&sCurPowerInfo, &sPowerUpdate); + if (MCDRV_SUCCESS != sdRet) + return sdRet; + return McDevIf_ExecutePacket(); +} + +/**************************************************************************** + * write_reg + * + * Description: + * Write register. + * Arguments: + * psWR register information + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR_STATE + * MCDRV_ERROR_ARGUMENT + * MCDRV_ERROR_RESOURCEOVER + * + ****************************************************************************/ +static SINT32 write_reg +( + const struct MCDRV_REG_INFO *psRegInfo +) +{ + SINT32 sdRet = MCDRV_SUCCESS; + struct MCDRV_POWER_INFO sPowerInfo; + struct MCDRV_POWER_INFO sCurPowerInfo; + struct MCDRV_POWER_UPDATE sPowerUpdate; + UINT8 abData[2]; + + if (NULL == psRegInfo) + return MCDRV_ERROR_ARGUMENT; + + if (eMCDRV_STATE_READY != McResCtrl_GetState()) + return MCDRV_ERROR_STATE; + + if (IsValidWriteRegParam(psRegInfo) == 0) + return MCDRV_ERROR_ARGUMENT; + + /* get current power info */ + McResCtrl_GetCurPowerInfo(&sCurPowerInfo); + + /* power up */ + McResCtrl_GetPowerInfoRegAccess(psRegInfo, &sPowerInfo); + sPowerUpdate.bDigital = MCDRV_POWUPDATE_D_ALL; + sPowerUpdate.abAnalog[0] = (UINT8)MCDRV_POWUPDATE_AP; + sPowerUpdate.abAnalog[1] = (UINT8)MCDRV_POWUPDATE_AP_OUT0; + sPowerUpdate.abAnalog[2] = (UINT8)MCDRV_POWUPDATE_AP_OUT1; + sPowerUpdate.abAnalog[3] = (UINT8)MCDRV_POWUPDATE_AP_MC; + sPowerUpdate.abAnalog[4] = (UINT8)MCDRV_POWUPDATE_AP_IN; + sdRet = McPacket_AddPowerUp(&sPowerInfo, &sPowerUpdate); + if (sdRet != MCDRV_SUCCESS) + return sdRet; + + switch (psRegInfo->bRegType) { + case MCDRV_REGTYPE_IF: + if ((psRegInfo->bAddress == MCI_ANA_REG_A) + || (psRegInfo->bAddress == MCI_ANA_REG_D) + || (psRegInfo->bAddress == MCI_CD_REG_A) + || (psRegInfo->bAddress == MCI_CD_REG_D)) { + abData[0] = psRegInfo->bAddress<<1; + abData[1] = psRegInfo->bData; + McSrv_WriteReg( + McDevProf_GetSlaveAddr(eMCDRV_SLAVE_ADDR_ANA), + abData, 2); + } else { + ; + McDevIf_AddPacket( + (MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | psRegInfo->bAddress), + psRegInfo->bData); + } + break; + + case MCDRV_REGTYPE_A: + McDevIf_AddPacket( + (MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_A + | psRegInfo->bAddress), + psRegInfo->bData); + break; + + case MCDRV_REGTYPE_MA: + McDevIf_AddPacket( + (MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_MA + | psRegInfo->bAddress), + psRegInfo->bData); + break; + + case MCDRV_REGTYPE_MB: + McDevIf_AddPacket( + (MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_MB + | psRegInfo->bAddress), + psRegInfo->bData); + break; + + case MCDRV_REGTYPE_B: + McDevIf_AddPacket( + (MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_B + | psRegInfo->bAddress), + psRegInfo->bData); + break; + + case MCDRV_REGTYPE_E: + McDevIf_AddPacket( + (MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_E + | psRegInfo->bAddress), + psRegInfo->bData); + break; + + case MCDRV_REGTYPE_C: + McDevIf_AddPacket( + (MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_C + | psRegInfo->bAddress), + psRegInfo->bData); + break; + + case MCDRV_REGTYPE_F: + McDevIf_AddPacket( + (MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_F + | psRegInfo->bAddress), + psRegInfo->bData); + break; + + case MCDRV_REGTYPE_ANA: + McDevIf_AddPacket( + (MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | psRegInfo->bAddress), + psRegInfo->bData); + break; + + case MCDRV_REGTYPE_CD: + McDevIf_AddPacket( + (MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_CD + | psRegInfo->bAddress), + psRegInfo->bData); + break; + + default: + return MCDRV_ERROR_ARGUMENT; + } + + sdRet = McDevIf_ExecutePacket(); + if (sdRet != MCDRV_SUCCESS) + return sdRet; + + /* restore power */ + switch (psRegInfo->bRegType) { + case MCDRV_REGTYPE_A: + sCurPowerInfo.bDigital &= ~MCDRV_POWINFO_D_PLL_PD; + if (psRegInfo->bAddress == MCI_PD) { + if (((psRegInfo->bData&MCB_PE_CLK_PD) == 0) + && (sCurPowerInfo.bDigital&MCDRV_POWINFO_D_PM_CLK_PD) + == 0) + sCurPowerInfo.bDigital + &= ~MCDRV_POWINFO_D_PE_CLK_PD; + if (((psRegInfo->bData&MCB_PB_CLK_PD) == 0) + && (sCurPowerInfo.bDigital&MCDRV_POWINFO_D_PM_CLK_PD) + == 0) + sCurPowerInfo.bDigital + &= ~MCDRV_POWINFO_D_PB_CLK_PD; + } + break; + case MCDRV_REGTYPE_IF: + if (psRegInfo->bAddress == MCI_RST) { + if ((psRegInfo->bData&MCB_PSW_M) == 0) + sCurPowerInfo.bDigital + &= ~MCDRV_POWINFO_D_PM_CLK_PD; + if ((psRegInfo->bData&MCB_PSW_F) == 0) + sCurPowerInfo.bDigital + &= ~MCDRV_POWINFO_D_PF_CLK_PD; + if ((psRegInfo->bData&MCB_PSW_C) == 0) + sCurPowerInfo.bDigital + &= ~MCDRV_POWINFO_D_PC_CLK_PD; + } + break; + + case MCDRV_REGTYPE_ANA: + if (psRegInfo->bAddress == MCI_AP) + sCurPowerInfo.abAnalog[0] = psRegInfo->bData; + else if (psRegInfo->bAddress == MCI_AP_DA0) + sCurPowerInfo.abAnalog[1] = psRegInfo->bData; + else if (psRegInfo->bAddress == MCI_AP_DA1) + sCurPowerInfo.abAnalog[2] = psRegInfo->bData; + else if (psRegInfo->bAddress == MCI_AP_MIC) + sCurPowerInfo.abAnalog[3] = psRegInfo->bData; + else if (psRegInfo->bAddress == MCI_AP_AD) + sCurPowerInfo.abAnalog[4] = psRegInfo->bData; + break; + + default: + break; + } + sdRet = McPacket_AddPowerDown(&sCurPowerInfo, &sPowerUpdate); + if (MCDRV_SUCCESS == sdRet) + return sdRet; + return McDevIf_ExecutePacket(); +} + +/**************************************************************************** + * get_clocksw + * + * Description: + * Get clock switch setting. + * Arguments: + * psClockSwInfo clock switch information + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR_STATE + * + ****************************************************************************/ +static SINT32 get_clocksw +( + struct MCDRV_CLOCKSW_INFO *psClockSwInfo +) +{ + if (NULL == psClockSwInfo) + return MCDRV_ERROR_ARGUMENT; + + if (eMCDRV_STATE_READY != McResCtrl_GetState()) + return MCDRV_ERROR_STATE; + + McResCtrl_GetClockSwInfo(psClockSwInfo); + + return MCDRV_SUCCESS; +} + +/**************************************************************************** + * set_clocksw + * + * Description: + * Set clock switch. + * Arguments: + * psClockSwInfo clock switch information + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR_ARGUMENT + * MCDRV_ERROR_STATE + * + ****************************************************************************/ +static SINT32 set_clocksw +( + const struct MCDRV_CLOCKSW_INFO *psClockSwInfo +) +{ + struct MCDRV_CLOCKSW_INFO sCurClockSwInfo; + + if (NULL == psClockSwInfo) + return MCDRV_ERROR_ARGUMENT; + + if (eMCDRV_STATE_READY != McResCtrl_GetState()) + return MCDRV_ERROR_STATE; + + if (IsValidClockSwParam(psClockSwInfo) == 0) + return MCDRV_ERROR_ARGUMENT; + + McResCtrl_GetClockSwInfo(&sCurClockSwInfo); + if (sCurClockSwInfo.bClkSrc == psClockSwInfo->bClkSrc) + return MCDRV_SUCCESS; + + McResCtrl_SetClockSwInfo(psClockSwInfo); + McPacket_AddClockSw(); + return McDevIf_ExecutePacket(); +} + +/**************************************************************************** + * get_path + * + * Description: + * Get current path setting. + * Arguments: + * psPathInfo path information + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR_STATE + * + ****************************************************************************/ +static SINT32 get_path +( + struct MCDRV_PATH_INFO *psPathInfo +) +{ + if (NULL == psPathInfo) + return MCDRV_ERROR_ARGUMENT; + + if (eMCDRV_STATE_READY != McResCtrl_GetState()) + return MCDRV_ERROR_STATE; + + McResCtrl_GetPathInfoVirtual(psPathInfo); + + return MCDRV_SUCCESS; +} + +/**************************************************************************** + * set_path + * + * Description: + * Set path. + * Arguments: + * psPathInfo path information + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR_ARGUMENT + * MCDRV_ERROR_STATE + * + ****************************************************************************/ +static SINT32 set_path +( + const struct MCDRV_PATH_INFO *psPathInfo +) +{ + SINT32 sdRet = MCDRV_SUCCESS; + UINT32 dSVolDoneParam = 0; + UINT8 bDIRMuteParam = 0; + UINT8 bADCMuteParam = 0; + UINT8 bDITMuteParam = 0; + UINT8 bDACMuteParam = 0; + enum MCDRV_STATE eState = McResCtrl_GetState(); + struct MCDRV_PATH_INFO sPathInfo; + struct MCDRV_POWER_INFO sPowerInfo; + struct MCDRV_POWER_UPDATE sPowerUpdate; + UINT8 bDSPStarted = McResCtrl_GetDspStart(); + UINT8 bHPVolL, bHPVolR; + UINT8 bSPVolL, bSPVolR; + UINT8 bReg; + + if (NULL == psPathInfo) + return MCDRV_ERROR_ARGUMENT; + + if (eMCDRV_STATE_READY != eState) + return MCDRV_ERROR_STATE; + + sPathInfo = *psPathInfo; + MaskIrregularPath(&sPathInfo); + + sdRet = McResCtrl_SetPathInfo(&sPathInfo); + if (sdRet != MCDRV_SUCCESS) + return sdRet; + + bHPVolL = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_ANA, MCI_HPVOL_L); + bHPVolL &= (UINT8)~MCB_ALAT_HP; + bHPVolR = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_ANA, MCI_HPVOL_R); + bSPVolL = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_ANA, MCI_SPVOL_L); + bSPVolL &= (UINT8)~MCB_ALAT_SP; + bSPVolR = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_ANA, MCI_SPVOL_R); + + /* unused analog out volume mute */ + sdRet = SetVol(MCDRV_VOLUPDATE_ANA_OUT, + eMCDRV_VOLUPDATE_MUTE, + &dSVolDoneParam); + if (sdRet != MCDRV_SUCCESS) + return sdRet; + + if (dSVolDoneParam != 0UL) + McDevIf_AddPacket( + MCDRV_PACKET_TYPE_EVTWAIT + | MCDRV_EVT_SVOL_DONE + | dSVolDoneParam, + 0); + sdRet = McDevIf_ExecutePacket(); + if (sdRet != MCDRV_SUCCESS) + return sdRet; + + if ((bSPVolL != 0) + || (bSPVolR != 0)) { + bSPVolL = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_ANA, + MCI_SPVOL_L); + bSPVolL &= (UINT8)~MCB_ALAT_SP; + bSPVolR = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_ANA, + MCI_SPVOL_R); + if ((bSPVolL == 0) + && (bSPVolR == 0)) { + ; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_TIMWAIT + | MCDRV_SP_WAIT_TIME, 0); + } + } + + GetMuteParam(&bDIRMuteParam, + &bADCMuteParam, + &bDITMuteParam, + &bDACMuteParam); + + /* unused volume mute */ + sdRet = SetVol(MCDRV_VOLUPDATE_DIG, + eMCDRV_VOLUPDATE_MUTE, + NULL); + if (sdRet != MCDRV_SUCCESS) + return sdRet; + + /* set volume */ + sdRet = SetVol(MCDRV_VOLUPDATE_ANA_IN, + eMCDRV_VOLUPDATE_ALL, + NULL); + if (sdRet != MCDRV_SUCCESS) + return sdRet; + + /* wait VFLAG */ + if (bDIRMuteParam != 0) + McDevIf_AddPacket( + MCDRV_PACKET_TYPE_EVTWAIT + | MCDRV_EVT_DIRMUTE + | bDIRMuteParam, + 0); + + if (bADCMuteParam != 0) + McDevIf_AddPacket( + MCDRV_PACKET_TYPE_EVTWAIT + | MCDRV_EVT_ADCMUTE + | bADCMuteParam, + 0); + + if (bDITMuteParam != 0) + McDevIf_AddPacket( + MCDRV_PACKET_TYPE_EVTWAIT + | MCDRV_EVT_DITMUTE + | bDITMuteParam, + 0); + + if (bDACMuteParam != 0) + McDevIf_AddPacket( + MCDRV_PACKET_TYPE_EVTWAIT + | MCDRV_EVT_DACMUTE + | bDACMuteParam, + 0); + + /* F-DSP stop */ + McPacket_AddFDSPStop(bDSPStarted); + sdRet = McDevIf_ExecutePacket(); + if (sdRet != MCDRV_SUCCESS) + return sdRet; + + /* stop unused path */ + McPacket_AddStop(); + sdRet = McDevIf_ExecutePacket(); + if (sdRet != MCDRV_SUCCESS) + return sdRet; + + McResCtrl_GetPowerInfo(&sPowerInfo); + + /* unused analog out path power down */ + sPowerUpdate.bDigital = 0; + sPowerUpdate.abAnalog[0] = (UINT8)0; + sPowerUpdate.abAnalog[1] = (UINT8)MCDRV_POWUPDATE_AP_OUT0; + sPowerUpdate.abAnalog[2] = (UINT8)MCDRV_POWUPDATE_AP_OUT1; + sPowerUpdate.abAnalog[3] = (UINT8)0; + sPowerUpdate.abAnalog[4] = (UINT8)0; + sdRet = McPacket_AddPowerDown(&sPowerInfo, &sPowerUpdate); + if (sdRet != MCDRV_SUCCESS) + return sdRet; + sdRet = McDevIf_ExecutePacket(); + if (sdRet != MCDRV_SUCCESS) + return sdRet; + + /* used path power up */ + sPowerUpdate.bDigital = MCDRV_POWUPDATE_D_ALL; + sPowerUpdate.abAnalog[0] = (UINT8)MCDRV_POWUPDATE_AP; + sPowerUpdate.abAnalog[1] = (UINT8)MCDRV_POWUPDATE_AP_OUT0; + sPowerUpdate.abAnalog[2] = (UINT8)MCDRV_POWUPDATE_AP_OUT1; + sPowerUpdate.abAnalog[3] = (UINT8)MCDRV_POWUPDATE_AP_MC; + sPowerUpdate.abAnalog[4] = (UINT8)MCDRV_POWUPDATE_AP_IN; + sdRet = McPacket_AddPowerUp(&sPowerInfo, &sPowerUpdate); + if (sdRet != MCDRV_SUCCESS) + return sdRet; + sdRet = McDevIf_ExecutePacket(); + if (sdRet != MCDRV_SUCCESS) + return sdRet; + + /* set mixer */ + McPacket_AddPathSet(); + sdRet = McDevIf_ExecutePacket(); + if (sdRet != MCDRV_SUCCESS) + return sdRet; + + /* DSP start */ + McPacket_AddDSPStartStop(bDSPStarted); + sdRet = McDevIf_ExecutePacket(); + if (sdRet != MCDRV_SUCCESS) + return sdRet; + + if ((bHPVolL != 0) + || (bHPVolR != 0)) { + if ((bHPVolL == 0) + || ((dSVolDoneParam&(MCB_HPL_BUSY<<8)) != 0)) { + if ((bHPVolR == 0) + || ((dSVolDoneParam&(MCB_HPR_BUSY<<8)) != 0)) { + if ((sPowerInfo.abAnalog[3] & MCB_MB4) != 0) { + bReg = McResCtrl_GetRegVal( + MCDRV_PACKET_REGTYPE_ANA, + MCI_AP_MIC); + if ((bReg&MCB_MB4) == 0) { + ; + McDevIf_AddPacket( + MCDRV_PACKET_TYPE_TIMWAIT + | MCDRV_MB4_WAIT_TIME, + 0); + } + } + } + } + } + + /* unused path power down */ + sPowerUpdate.bDigital = MCDRV_POWUPDATE_D_ALL; + sPowerUpdate.abAnalog[0] = (UINT8)MCDRV_POWUPDATE_AP; + sPowerUpdate.abAnalog[1] = (UINT8)MCDRV_POWUPDATE_AP_OUT0; + sPowerUpdate.abAnalog[2] = (UINT8)MCDRV_POWUPDATE_AP_OUT1; + sPowerUpdate.abAnalog[3] = (UINT8)MCDRV_POWUPDATE_AP_MC; + sPowerUpdate.abAnalog[4] = (UINT8)MCDRV_POWUPDATE_AP_IN; + sdRet = McPacket_AddPowerDown(&sPowerInfo, &sPowerUpdate); + if (sdRet != MCDRV_SUCCESS) + return sdRet; + sdRet = McDevIf_ExecutePacket(); + if (sdRet != MCDRV_SUCCESS) + return sdRet; + + /* start */ + McPacket_AddStart(); + sdRet = McDevIf_ExecutePacket(); + if (sdRet != MCDRV_SUCCESS) + return sdRet; + + /* set volume */ + sdRet = SetVol(MCDRV_VOLUPDATE_DIG, + eMCDRV_VOLUPDATE_ALL, + NULL); + if (sdRet != MCDRV_SUCCESS) + return sdRet; + sdRet = SetVol(MCDRV_VOLUPDATE_ANA_OUT, + eMCDRV_VOLUPDATE_ALL, + &dSVolDoneParam); + if (sdRet != MCDRV_SUCCESS) + return sdRet; + + return sdRet; +} + +/**************************************************************************** + * get_volume + * + * Description: + * Get current volume setting. + * Arguments: + * psVolInfo volume information + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR_ARGUMENT + * + ****************************************************************************/ +static SINT32 get_volume +( + struct MCDRV_VOL_INFO *psVolInfo +) +{ + if (NULL == psVolInfo) + return MCDRV_ERROR_ARGUMENT; + + if (eMCDRV_STATE_READY != McResCtrl_GetState()) + return MCDRV_ERROR_STATE; + + McResCtrl_GetVolInfo(psVolInfo); + + return MCDRV_SUCCESS; +} + +/**************************************************************************** + * set_volume + * + * Description: + * Set volume. + * Arguments: + * psVolInfo volume update information + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR_ARGUMENT + * + ****************************************************************************/ +static SINT32 set_volume +( + const struct MCDRV_VOL_INFO *psVolInfo +) +{ + enum MCDRV_STATE eState = McResCtrl_GetState(); + struct MCDRV_PATH_INFO sPathInfo; + + if (NULL == psVolInfo) + return MCDRV_ERROR_ARGUMENT; + + if (eMCDRV_STATE_READY != eState) + return MCDRV_ERROR_STATE; + + McResCtrl_SetVolInfo(psVolInfo); + + McResCtrl_GetPathInfoVirtual(&sPathInfo); + return set_path(&sPathInfo); +} + +/**************************************************************************** + * get_digitalio + * + * Description: + * Get current digital IO setting. + * Arguments: + * psDioInfo digital IO information + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR_STATE + * + ****************************************************************************/ +static SINT32 get_digitalio +( + struct MCDRV_DIO_INFO *psDioInfo +) +{ + if (NULL == psDioInfo) + return MCDRV_ERROR_ARGUMENT; + + if (eMCDRV_STATE_READY != McResCtrl_GetState()) + return MCDRV_ERROR_STATE; + + McResCtrl_GetDioInfo(psDioInfo); + + return MCDRV_SUCCESS; +} + +/**************************************************************************** + * set_digitalio + * + * Description: + * Update digital IO configuration. + * Arguments: + * psDioInfo digital IO configuration + * dUpdateInfo update information + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR_ARGUMENT + * MCDRV_ERROR_STATE + * + ****************************************************************************/ +static SINT32 set_digitalio +( + const struct MCDRV_DIO_INFO *psDioInfo, + UINT32 dUpdateInfo +) +{ + enum MCDRV_STATE eState = McResCtrl_GetState(); + + if (NULL == psDioInfo) + return MCDRV_ERROR_ARGUMENT; + + if (eMCDRV_STATE_READY != eState) + return MCDRV_ERROR_STATE; + + if (IsValidDioParam(psDioInfo, dUpdateInfo) == 0) + return MCDRV_ERROR_ARGUMENT; + + McResCtrl_SetDioInfo(psDioInfo, dUpdateInfo); + + McPacket_AddDigitalIO(dUpdateInfo); + return McDevIf_ExecutePacket(); +} + +/**************************************************************************** + * get_digitalio_path + * + * Description: + * Get current digital IO path setting. + * Arguments: + * psDioInfoPath digital IO path information + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR_STATE + * + ****************************************************************************/ +static SINT32 get_digitalio_path +( + struct MCDRV_DIOPATH_INFO *psDioPathInfo +) +{ + if (NULL == psDioPathInfo) + return MCDRV_ERROR_ARGUMENT; + + if (eMCDRV_STATE_READY != McResCtrl_GetState()) + return MCDRV_ERROR_STATE; + + McResCtrl_GetDioPathInfo(psDioPathInfo); + + return MCDRV_SUCCESS; +} + +/**************************************************************************** + * set_digitalio_path + * + * Description: + * Update digital IO path configuration. + * Arguments: + * psDioInfoPath digital IO path configuration + * dUpdateInfo update information + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR_ARGUMENT + * MCDRV_ERROR_STATE + * + ****************************************************************************/ +static SINT32 set_digitalio_path +( + const struct MCDRV_DIOPATH_INFO *psDioPathInfo, + UINT32 dUpdateInfo +) +{ + enum MCDRV_STATE eState = McResCtrl_GetState(); + + if (NULL == psDioPathInfo) + return MCDRV_ERROR_ARGUMENT; + + if (eMCDRV_STATE_READY != eState) + return MCDRV_ERROR_STATE; + + if (IsValidDioPathParam(psDioPathInfo, dUpdateInfo) == 0) + return MCDRV_ERROR_ARGUMENT; + + McResCtrl_SetDioPathInfo(psDioPathInfo, dUpdateInfo); + + McPacket_AddDigitalIOPath(); + return McDevIf_ExecutePacket(); +} + +/**************************************************************************** + * get_swap + * + * Description: + * Get Swap setting. + * Arguments: + * psSwapInfo pointer to MCDRV_SWAP_INFO struct + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR_STATE + * MCDRV_ERROR_ARGUMENT +* + ****************************************************************************/ +static SINT32 get_swap +( + struct MCDRV_SWAP_INFO *psSwapInfo +) +{ + enum MCDRV_STATE eState = McResCtrl_GetState(); + + if (eMCDRV_STATE_READY != eState) + return MCDRV_ERROR_STATE; + + if (NULL == psSwapInfo) + return MCDRV_ERROR_ARGUMENT; + + McResCtrl_GetSwap(psSwapInfo); + + return MCDRV_SUCCESS; +} + +/**************************************************************************** + * set_swap + * + * Description: + * Set Swap setting. + * Arguments: + * psSwapInfo pointer to MCDRV_SWAP_INFO struct + * dUpdateInfo update information + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR_STATE + * MCDRV_ERROR_ARGUMENT +* + ****************************************************************************/ +static SINT32 set_swap +( + const struct MCDRV_SWAP_INFO *psSwapInfo, + UINT32 dUpdateInfo +) +{ + enum MCDRV_STATE eState = McResCtrl_GetState(); + + if (eMCDRV_STATE_READY != eState) + return MCDRV_ERROR_STATE; + + if (NULL == psSwapInfo) + return MCDRV_ERROR_ARGUMENT; + + if (IsValidSwapParam(psSwapInfo, dUpdateInfo) == 0) + return MCDRV_ERROR_ARGUMENT; + + McResCtrl_SetSwap(psSwapInfo, dUpdateInfo); + McPacket_AddSwap(dUpdateInfo); + return McDevIf_ExecutePacket(); +} + + +/**************************************************************************** + * IsPathAllOff + * + * Description: + * Is Path All Off. + * Arguments: + * none + * Return: + * 0:not All Off, 1:All Off + * + ****************************************************************************/ +static UINT8 IsPathAllOff +( + void +) +{ + UINT8 bRet = 1; + struct MCDRV_PATH_INFO sCurPathInfo; + +#if (MCDRV_DEBUG_LEVEL >= 4) + SINT32 sdRet; + McDebugLog_FuncIn("IsPathAllOff"); +#endif + McResCtrl_GetPathInfoVirtual(&sCurPathInfo); + if ((sCurPathInfo.asMusicOut[0].dSrcOnOff + != gsPathInfoAllOff.asMusicOut[0].dSrcOnOff) + || (sCurPathInfo.asMusicOut[1].dSrcOnOff + != gsPathInfoAllOff.asMusicOut[1].dSrcOnOff) + || (sCurPathInfo.asExtOut[0].dSrcOnOff + != gsPathInfoAllOff.asExtOut[0].dSrcOnOff) + || (sCurPathInfo.asExtOut[1].dSrcOnOff + != gsPathInfoAllOff.asExtOut[1].dSrcOnOff) + || (sCurPathInfo.asHifiOut[0].dSrcOnOff + != gsPathInfoAllOff.asHifiOut[0].dSrcOnOff) + || (sCurPathInfo.asVboxMixIn[0].dSrcOnOff + != gsPathInfoAllOff.asVboxMixIn[0].dSrcOnOff) + || (sCurPathInfo.asVboxMixIn[1].dSrcOnOff + != gsPathInfoAllOff.asVboxMixIn[1].dSrcOnOff) + || (sCurPathInfo.asVboxMixIn[2].dSrcOnOff + != gsPathInfoAllOff.asVboxMixIn[2].dSrcOnOff) + || (sCurPathInfo.asVboxMixIn[3].dSrcOnOff + != gsPathInfoAllOff.asVboxMixIn[3].dSrcOnOff) + || (sCurPathInfo.asAe0[0].dSrcOnOff + != gsPathInfoAllOff.asAe0[0].dSrcOnOff) + || (sCurPathInfo.asAe0[1].dSrcOnOff + != gsPathInfoAllOff.asAe0[1].dSrcOnOff) + || (sCurPathInfo.asAe1[0].dSrcOnOff + != gsPathInfoAllOff.asAe1[0].dSrcOnOff) + || (sCurPathInfo.asAe1[1].dSrcOnOff + != gsPathInfoAllOff.asAe1[1].dSrcOnOff) + || (sCurPathInfo.asAe2[0].dSrcOnOff + != gsPathInfoAllOff.asAe2[0].dSrcOnOff) + || (sCurPathInfo.asAe2[1].dSrcOnOff + != gsPathInfoAllOff.asAe2[1].dSrcOnOff) + || (sCurPathInfo.asAe3[0].dSrcOnOff + != gsPathInfoAllOff.asAe3[0].dSrcOnOff) + || (sCurPathInfo.asAe3[1].dSrcOnOff + != gsPathInfoAllOff.asAe3[1].dSrcOnOff) + || (sCurPathInfo.asDac0[0].dSrcOnOff + != gsPathInfoAllOff.asDac0[0].dSrcOnOff) + || (sCurPathInfo.asDac0[1].dSrcOnOff + != gsPathInfoAllOff.asDac0[1].dSrcOnOff) + || (sCurPathInfo.asDac1[0].dSrcOnOff + != gsPathInfoAllOff.asDac1[0].dSrcOnOff) + || (sCurPathInfo.asDac1[1].dSrcOnOff + != gsPathInfoAllOff.asDac1[1].dSrcOnOff) + || (sCurPathInfo.asVoiceOut[0].dSrcOnOff + != gsPathInfoAllOff.asVoiceOut[0].dSrcOnOff) + || (sCurPathInfo.asVboxIoIn[0].dSrcOnOff + != gsPathInfoAllOff.asVboxIoIn[0].dSrcOnOff) + || (sCurPathInfo.asVboxHostIn[0].dSrcOnOff + != gsPathInfoAllOff.asVboxHostIn[0].dSrcOnOff) + || (sCurPathInfo.asHostOut[0].dSrcOnOff + != gsPathInfoAllOff.asHostOut[0].dSrcOnOff) + || (sCurPathInfo.asAdif0[0].dSrcOnOff + != gsPathInfoAllOff.asAdif0[0].dSrcOnOff) + || (sCurPathInfo.asAdif0[1].dSrcOnOff + != gsPathInfoAllOff.asAdif0[1].dSrcOnOff) + || (sCurPathInfo.asAdif1[0].dSrcOnOff + != gsPathInfoAllOff.asAdif1[0].dSrcOnOff) + || (sCurPathInfo.asAdif1[1].dSrcOnOff + != gsPathInfoAllOff.asAdif1[1].dSrcOnOff) + || (sCurPathInfo.asAdif2[0].dSrcOnOff + != gsPathInfoAllOff.asAdif2[0].dSrcOnOff) + || (sCurPathInfo.asAdif2[1].dSrcOnOff + != gsPathInfoAllOff.asAdif2[1].dSrcOnOff) + || (sCurPathInfo.asAdc0[0].dSrcOnOff + != gsPathInfoAllOff.asAdc0[0].dSrcOnOff) + || (sCurPathInfo.asAdc0[1].dSrcOnOff + != gsPathInfoAllOff.asAdc0[1].dSrcOnOff) + || (sCurPathInfo.asAdc1[0].dSrcOnOff + != gsPathInfoAllOff.asAdc1[0].dSrcOnOff) + || (sCurPathInfo.asSp[0].dSrcOnOff + != gsPathInfoAllOff.asSp[0].dSrcOnOff) + || (sCurPathInfo.asSp[1].dSrcOnOff + != gsPathInfoAllOff.asSp[1].dSrcOnOff) + || (sCurPathInfo.asHp[0].dSrcOnOff + != gsPathInfoAllOff.asHp[0].dSrcOnOff) + || (sCurPathInfo.asHp[1].dSrcOnOff + != gsPathInfoAllOff.asHp[1].dSrcOnOff) + || (sCurPathInfo.asRc[0].dSrcOnOff + != gsPathInfoAllOff.asRc[0].dSrcOnOff) + || (sCurPathInfo.asLout1[0].dSrcOnOff + != gsPathInfoAllOff.asLout1[0].dSrcOnOff) + || (sCurPathInfo.asLout1[1].dSrcOnOff + != gsPathInfoAllOff.asLout1[1].dSrcOnOff) + || (sCurPathInfo.asLout2[0].dSrcOnOff + != gsPathInfoAllOff.asLout2[0].dSrcOnOff) + || (sCurPathInfo.asLout2[1].dSrcOnOff + != gsPathInfoAllOff.asLout2[1].dSrcOnOff) + || (sCurPathInfo.asBias[0].dSrcOnOff + != gsPathInfoAllOff.asBias[0].dSrcOnOff) + || (sCurPathInfo.asBias[1].dSrcOnOff + != gsPathInfoAllOff.asBias[1].dSrcOnOff) + || (sCurPathInfo.asBias[2].dSrcOnOff + != gsPathInfoAllOff.asBias[2].dSrcOnOff) + || (sCurPathInfo.asBias[3].dSrcOnOff + != gsPathInfoAllOff.asBias[3].dSrcOnOff) + ) + bRet = 0; + +#if (MCDRV_DEBUG_LEVEL >= 4) + sdRet = bRet; + McDebugLog_FuncOut("IsPathAllOff", &sdRet); +#endif + return bRet; +} + +/**************************************************************************** + * set_dsp + * + * Description: + * Set DSP parameter. + * Arguments: + * pbPrm pointer to AEC parameter + * dSize data byte size. + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR_STATE + * MCDRV_ERROR_ARGUMENT +* + ****************************************************************************/ +static SINT32 set_dsp +( + const UINT8 *pbPrm, + UINT32 dSize +) +{ + SINT32 sdRet = MCDRV_SUCCESS; + enum MCDRV_STATE eState = McResCtrl_GetState(); + struct MCDRV_AEC_D7_INFO sD7Info; + struct MCDRV_AEC_INFO sAECInfo, sCurAECInfo; + struct MCDRV_POWER_INFO sPowerInfo; + struct MCDRV_POWER_UPDATE sPowerUpdate; + static struct MCDRV_PATH_INFO sPathInfo; + static UINT8 bLP2_START, bSRC3_START; + UINT32 dSVolDoneParam = 0; + UINT32 dMuteFlg; + UINT8 bReg; + + if (eMCDRV_STATE_READY != eState) + return MCDRV_ERROR_STATE; + + if (NULL == pbPrm) + return MCDRV_ERROR_ARGUMENT; + + if (dSize == 0) + return MCDRV_SUCCESS; + + McResCtrl_GetAecInfo(&sAECInfo); + sCurAECInfo = sAECInfo; + + sdRet = McParser_GetD7Chunk(pbPrm, dSize, &sD7Info); + if (sdRet < MCDRV_SUCCESS) + return sdRet; + + sdRet = McParser_AnalyzeD7Chunk(&sD7Info, &sAECInfo); + if (sdRet < MCDRV_SUCCESS) + return sdRet; + + if (IsValidDspParam(&sAECInfo) == 0) { + sdRet = MCDRV_ERROR_ARGUMENT; + return sdRet; + } + + McResCtrl_SetAecInfo(&sAECInfo); + McResCtrl_GetAecInfo(&sAECInfo); + + sAECInfo.sAecVBox.bCDspFuncAOnOff &= 0x01; + sAECInfo.sAecVBox.bCDspFuncBOnOff &= 0x01; + if (sAECInfo.sControl.bCommand == 1) { + if (sAECInfo.sControl.bParam[0] == 0) { + if (IsPathAllOff() == 0) { + struct MCDRV_PATH_INFO sTmpPathInfo; + McResCtrl_GetPathInfoVirtual(&sPathInfo); + sTmpPathInfo = gsPathInfoAllOff; + sTmpPathInfo.asBias[3] = sPathInfo.asBias[3]; + sdRet = set_path(&sTmpPathInfo); + if (sdRet != MCDRV_SUCCESS) { + ; + goto exit; + } + } + } + } else if (sAECInfo.sControl.bCommand == 2) { + if (sAECInfo.sControl.bParam[0] == 0) { + bLP2_START = + McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_MB, + MCI_LP2_START); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MB + | (UINT32)MCI_LP2_START, + 0); + bSRC3_START = + McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_MB, + MCI_SRC3_START); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MB + | (UINT32)MCI_SRC3_START, + 0); + sdRet = McDevIf_ExecutePacket(); + if (sdRet != MCDRV_SUCCESS) + goto exit; + } + } else if (sAECInfo.sControl.bCommand == 3) { + if (McDevProf_GetDevId() != eMCDRV_DEV_ID_80_90H) { + McPacket_AddDOutMute(); + dMuteFlg = MCB_DIFO3_VFLAG1 + | MCB_DIFO3_VFLAG0 + | MCB_DIFO2_VFLAG1 + | MCB_DIFO2_VFLAG0 + | MCB_DIFO1_VFLAG1 + | MCB_DIFO1_VFLAG0 + | MCB_DIFO0_VFLAG1 + | MCB_DIFO0_VFLAG0; + McDevIf_AddPacket( + MCDRV_PACKET_TYPE_EVTWAIT + | MCDRV_EVT_DITMUTE + | dMuteFlg, + 0); + dMuteFlg = MCB_DAO1_VFLAG1 + | MCB_DAO1_VFLAG0 + | MCB_DAO0_VFLAG1 + | MCB_DAO0_VFLAG0; + McDevIf_AddPacket( + MCDRV_PACKET_TYPE_EVTWAIT + | MCDRV_EVT_DACMUTE + | dMuteFlg, + 0); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MA + | (UINT32)MCI_CLK_SEL, + sAECInfo.sControl.bParam[0]); + McResCtrl_SetClkSel(sAECInfo.sControl.bParam[0]); + sdRet = McDevIf_ExecutePacket(); + if (sdRet != MCDRV_SUCCESS) + goto exit; + sdRet = SetVol(MCDRV_VOLUPDATE_DOUT, + eMCDRV_VOLUPDATE_ALL, + NULL); + if (sdRet != MCDRV_SUCCESS) + goto exit; + } + } else if (sAECInfo.sControl.bCommand == 4) { + if (McDevProf_GetDevId() != eMCDRV_DEV_ID_80_90H) { + McPacket_AddDac0Mute(); + McPacket_AddDac1Mute(); + McPacket_AddAdifMute(); + McPacket_AddDPathDAMute(); + dMuteFlg = MCB_ADI2_VFLAG1 + | MCB_ADI2_VFLAG0 + | MCB_ADI1_VFLAG1 + | MCB_ADI1_VFLAG0 + | MCB_ADI0_VFLAG1 + | MCB_ADI0_VFLAG0; + McDevIf_AddPacket( + MCDRV_PACKET_TYPE_EVTWAIT + | MCDRV_EVT_ADCMUTE + | dMuteFlg, + 0); + dMuteFlg = MCB_SPR_BUSY<<8 + | MCB_SPL_BUSY<<8 + | MCB_HPR_BUSY<<8 + | MCB_HPL_BUSY<<8 + | MCB_LO2R_BUSY + | MCB_LO2L_BUSY + | MCB_LO1R_BUSY + | MCB_LO1L_BUSY + | MCB_RC_BUSY; + McDevIf_AddPacket( + MCDRV_PACKET_TYPE_EVTWAIT + | MCDRV_EVT_SVOL_DONE + | dMuteFlg, + 0); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_ECLK_SEL, + sAECInfo.sControl.bParam[0]); + McResCtrl_SetEClkSel(sAECInfo.sControl.bParam[0]); + sdRet = McDevIf_ExecutePacket(); + if (sdRet != MCDRV_SUCCESS) + goto exit; + sdRet = SetVol(MCDRV_VOLUPDATE_ANA_OUT + | MCDRV_VOLUPDATE_ADIF0 + | MCDRV_VOLUPDATE_ADIF1 + | MCDRV_VOLUPDATE_ADIF2 + | MCDRV_VOLUPDATE_DPATHDA, + eMCDRV_VOLUPDATE_ALL, + &dSVolDoneParam); + if (sdRet != MCDRV_SUCCESS) + goto exit; + } + } else if (sAECInfo.sControl.bCommand == 5) { + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_A, + MCI_FREQ73M); + if ((sAECInfo.sControl.bParam[0] != 0xFF)) { + bReg &= 0xF8; + bReg |= sAECInfo.sControl.bParam[0]; + McResCtrl_SetCClkSel(sAECInfo.sControl.bParam[0]); + } + if ((sAECInfo.sControl.bParam[1] != 0xFF)) { + bReg &= 0x3F; + bReg |= (sAECInfo.sControl.bParam[1]<<6); + McResCtrl_SetFClkSel(sAECInfo.sControl.bParam[1]); + } + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_FREQ73M, + bReg); + sdRet = McDevIf_ExecutePacket(); + if (sdRet != MCDRV_SUCCESS) + goto exit; + } + + sdRet = McBdsp_SetDSPCheck(&sAECInfo); + if (sdRet < MCDRV_SUCCESS) + goto exit; + sdRet = McCdsp_SetDSPCheck(&sAECInfo); + if (sdRet < MCDRV_SUCCESS) + goto exit; + sdRet = McEdsp_SetDSPCheck(&sAECInfo); + if (sdRet < MCDRV_SUCCESS) + goto exit; + sdRet = McFdsp_SetDSPCheck(&sAECInfo); + if (sdRet < MCDRV_SUCCESS) + goto exit; + + McResCtrl_GetPowerInfo(&sPowerInfo); + sPowerUpdate.bDigital = MCDRV_POWUPDATE_D_ALL; + sPowerUpdate.abAnalog[0] = (UINT8)MCDRV_POWUPDATE_AP; + sPowerUpdate.abAnalog[1] = (UINT8)MCDRV_POWUPDATE_AP_OUT0; + sPowerUpdate.abAnalog[2] = (UINT8)MCDRV_POWUPDATE_AP_OUT1; + sPowerUpdate.abAnalog[3] = (UINT8)MCDRV_POWUPDATE_AP_MC; + sPowerUpdate.abAnalog[4] = (UINT8)MCDRV_POWUPDATE_AP_IN; + sdRet = McPacket_AddPowerUp(&sPowerInfo, &sPowerUpdate); + if (sdRet != MCDRV_SUCCESS) + goto exit; + sdRet = McDevIf_ExecutePacket(); + if (sdRet != MCDRV_SUCCESS) + goto exit; + + McPacket_AddAEC(); + sdRet = McDevIf_ExecutePacket(); + if (sdRet != MCDRV_SUCCESS) + goto exit; + + sdRet = McBdsp_SetDSP(&sAECInfo); + if (sdRet < MCDRV_SUCCESS) + goto exit; + sdRet = McCdsp_SetDSP(&sAECInfo); + if (sdRet < MCDRV_SUCCESS) + goto exit; + sdRet = McEdsp_SetDSP(&sAECInfo); + if (sdRet < MCDRV_SUCCESS) + goto exit; + sdRet = McFdsp_SetDSP(&sAECInfo); + if (sdRet < MCDRV_SUCCESS) + goto exit; + + if (sAECInfo.sControl.bCommand == 1) { + if (sAECInfo.sControl.bParam[0] == 1) { + sdRet = set_path(&sPathInfo); + sPathInfo = gsPathInfoAllZero; + if (sdRet != MCDRV_SUCCESS) + goto exit; + } + } else if (sAECInfo.sControl.bCommand == 2) { + if (sAECInfo.sControl.bParam[0] == 1) { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MB + | (UINT32)MCI_LP2_START, + bLP2_START); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MB + | (UINT32)MCI_SRC3_START, + bSRC3_START); + } + } + + McResCtrl_GetPowerInfo(&sPowerInfo); + sdRet = McPacket_AddPowerDown(&sPowerInfo, &sPowerUpdate); + if (sdRet != MCDRV_SUCCESS) + goto exit; + sdRet = McDevIf_ExecutePacket(); + if (sdRet == MCDRV_SUCCESS) + return sdRet; + +exit: + McResCtrl_ReplaceAecInfo(&sCurAECInfo); + SavePower(); + return sdRet; +} + +/**************************************************************************** + * get_dsp + * + * Description: + * Get DSP parameter. + * Arguments: + * psDspParam pointer to parameter + * pvData pointer to read data buffer + * dSize data buffer size + * Return: + * 0<= Get data size + * MCDRV_ERROR_STATE + * MCDRV_ERROR_ARGUMENT +* + ****************************************************************************/ +static SINT32 get_dsp +( + struct MCDRV_DSP_PARAM *psDspParam, + void *pvData, + UINT32 dSize +) +{ + enum MCDRV_STATE eState = McResCtrl_GetState(); + + if (eMCDRV_STATE_READY != eState) + return MCDRV_ERROR_STATE; + + if (NULL == psDspParam) + return MCDRV_ERROR_ARGUMENT; + + if (NULL == pvData) + return MCDRV_ERROR_ARGUMENT; + + switch (psDspParam->dType) { + case MCDRV_DSP_PARAM_CDSP_INPOS: + return McCdsp_GetDSP(CDSP_INPOS, pvData, dSize); + case MCDRV_DSP_PARAM_CDSP_OUTPOS: + return McCdsp_GetDSP(CDSP_OUTPOS, pvData, dSize); + case MCDRV_DSP_PARAM_CDSP_DFIFO_REMAIN: + return McCdsp_GetDSP(CDSP_DFIFO_REMAIN, pvData, dSize); + case MCDRV_DSP_PARAM_CDSP_RFIFO_REMAIN: + return McCdsp_GetDSP(CDSP_RFIFO_REMAIN, pvData, dSize); + case MCDRV_DSP_PARAM_CDSP_FUNCA: + return McCdsp_GetDSP(CDSP_FUNC_A_HOST_COMMAND, pvData, dSize); + case MCDRV_DSP_PARAM_CDSP_FUNCB: + return McCdsp_GetDSP(CDSP_FUNC_B_HOST_COMMAND, pvData, dSize); + case MCDRV_DSP_PARAM_FDSP_DXRAM: + return McFdsp_GetDSP(FDSP_AE_FW_DXRAM, psDspParam->dInfo, + (UINT8 *)pvData, dSize); + case MCDRV_DSP_PARAM_FDSP_DYRAM: + return McFdsp_GetDSP(FDSP_AE_FW_DYRAM, psDspParam->dInfo, + (UINT8 *)pvData, dSize); + case MCDRV_DSP_PARAM_FDSP_IRAM: + return McFdsp_GetDSP(FDSP_AE_FW_IRAM, psDspParam->dInfo, + (UINT8 *)pvData, dSize); + case MCDRV_DSP_PARAM_EDSP_E2RES: + return McEdsp_GetDSP((UINT8 *)pvData); + default: + return MCDRV_ERROR_ARGUMENT; + } +} + +/**************************************************************************** + * get_dsp_data + * + * Description: + * Get DSP data. + * Arguments: + * pbData pointer to data + * dSize data byte size + * Return: + * 0<= size of got data + * MCDRV_ERROR_STATE + * MCDRV_ERROR_ARGUMENT +* + ****************************************************************************/ +static SINT32 get_dsp_data +( + UINT8 *pbData, + UINT32 dSize +) +{ + enum MCDRV_STATE eState = McResCtrl_GetState(); + + if (eMCDRV_STATE_READY != eState) + return MCDRV_ERROR_STATE; + + if (NULL == pbData) + return MCDRV_ERROR_ARGUMENT; + + return McCdsp_ReadData(pbData, dSize); +} + +/**************************************************************************** + * set_dsp_data + * + * Description: + * Write data to DSP. + * Arguments: + * pbData pointer to data + * dSize data byte size + * Return: + * 0<= size of write data + * MCDRV_ERROR_STATE + * MCDRV_ERROR_ARGUMENT +* + ****************************************************************************/ +static SINT32 set_dsp_data +( + const UINT8 *pbData, + UINT32 dSize +) +{ + enum MCDRV_STATE eState = McResCtrl_GetState(); + + if (eMCDRV_STATE_READY != eState) + return MCDRV_ERROR_STATE; + + if (NULL == pbData) + return MCDRV_ERROR_ARGUMENT; + + return McCdsp_WriteData(pbData, dSize); +} + +/**************************************************************************** + * register_dsp_cb + * + * Description: + * Callback function setting + * Arguments: + * pcbfunc Pointer to Callback function + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR_STATE + * + ****************************************************************************/ +static SINT32 register_dsp_cb +( + SINT32 (*pcbfunc)(SINT32, UINT32, UINT32) +) +{ + enum MCDRV_STATE eState = McResCtrl_GetState(); + + if (eMCDRV_STATE_READY != eState) + return MCDRV_ERROR_STATE; + + McResCtrl_SetDSPCBFunc(pcbfunc); + return MCDRV_SUCCESS; +} + +/**************************************************************************** + * get_dsp_transition + * + * Description: + * It judges while processing the DSP control + * Arguments: + * dDspType DSP type + * Return: + * 0 has processed + * 1<= processing + * MCDRV_ERROR_STATE + * + ****************************************************************************/ +static SINT32 get_dsp_transition +( + UINT32 dDspType +) +{ + enum MCDRV_STATE eState = McResCtrl_GetState(); + + if (eMCDRV_STATE_READY != eState) + return MCDRV_ERROR_STATE; + + if (dDspType == MCDRV_DSPTYPE_FDSP) { + ; + return McFdsp_GetTransition(); + } else if (dDspType == MCDRV_DSPTYPE_BDSP) { + return McBdsp_GetTransition(); + } + + return MCDRV_ERROR_ARGUMENT; +} + +/**************************************************************************** + * get_hsdet + * + * Description: + * Get Headset Det. + * Arguments: + * psHSDet pointer to MCDRV_HSDET_INFO struct + * psHSDet pointer to MCDRV_HSDET2_INFO struct + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR_STATE + * MCDRV_ERROR_ARGUMENT +* + ****************************************************************************/ +static SINT32 get_hsdet +( + struct MCDRV_HSDET_INFO *psHSDet, + struct MCDRV_HSDET2_INFO *psHSDet2 +) +{ + enum MCDRV_STATE eState = McResCtrl_GetState(); + + if (eMCDRV_STATE_READY != eState) + return MCDRV_ERROR_STATE; + + if (NULL == psHSDet) + return MCDRV_ERROR_ARGUMENT; + + McResCtrl_GetHSDet(psHSDet, psHSDet2); + psHSDet->bDlyIrqStop = 0; + + return MCDRV_SUCCESS; +} + +/**************************************************************************** + * set_hsdet + * + * Description: + * Set Headset Det. + * Arguments: + * psHSDet pointer to MCDRV_HSDET_INFO struct + * psHSDet pointer to MCDRV_HSDET2_INFO struct + * dUpdateInfo update information + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR_STATE + * MCDRV_ERROR_ARGUMENT +* + ****************************************************************************/ +static SINT32 set_hsdet +( + const struct MCDRV_HSDET_INFO *psHSDet, + const struct MCDRV_HSDET2_INFO *psHSDet2, + UINT32 dUpdateInfo +) +{ + SINT32 sdRet = MCDRV_SUCCESS; + enum MCDRV_STATE eState = McResCtrl_GetState(); + struct MCDRV_HSDET_INFO sHSDetInfo; + UINT8 bReg; + struct MCDRV_PATH_INFO sCurPathInfo, sTmpPathInfo; + UINT8 bPlugDetDB; + struct MCDRV_HSDET_INFO sHSDet; + + if (eMCDRV_STATE_READY != eState) + return MCDRV_ERROR_STATE; + + if (NULL == psHSDet) + return MCDRV_ERROR_ARGUMENT; + + sHSDet = *psHSDet; + if (IsValidHSDetParam(&sHSDet, psHSDet2, dUpdateInfo) == 0) { + ; + return MCDRV_ERROR_ARGUMENT; + } + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H) { + ; + sHSDet.bDetInInv &= 1; + } + + McResCtrl_SetHSDet(&sHSDet, psHSDet2, dUpdateInfo); + McPacket_AddHSDet(); + sdRet = McDevIf_ExecutePacket(); + if (sdRet != MCDRV_SUCCESS) + return sdRet; + + McResCtrl_GetHSDet(&sHSDetInfo, NULL); + if ((sHSDetInfo.bEnPlugDetDb != MCDRV_PLUGDETDB_DISABLE) + || (sHSDetInfo.bEnDlyKeyOff != MCDRV_KEYEN_D_D_D) + || (sHSDetInfo.bEnDlyKeyOn != MCDRV_KEYEN_D_D_D) + || (sHSDetInfo.bEnMicDet != MCDRV_MICDET_DISABLE) + || (sHSDetInfo.bEnKeyOff != MCDRV_KEYEN_D_D_D) + || (sHSDetInfo.bEnKeyOn != MCDRV_KEYEN_D_D_D)) { + bPlugDetDB = McResCtrl_GetPlugDetDB(); + bReg = McResCtrl_GetRegVal( + MCDRV_PACKET_REGTYPE_CD, + MCI_HSDETEN); + if ((bReg&MCB_MKDETEN) == 0) { + McDevIf_AddPacket( + MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_CD + | (UINT32)MCI_HSDETEN, + (UINT8)(MCB_HSDETEN | sHSDetInfo.bHsDetDbnc)); + + if (((bPlugDetDB&MCB_RPLUGDET_DB) != 0) + && ((sHSDetInfo.bEnDlyKeyOff != MCDRV_KEYEN_D_D_D) + || (sHSDetInfo.bEnDlyKeyOn != MCDRV_KEYEN_D_D_D) + || (sHSDetInfo.bEnMicDet != MCDRV_MICDET_DISABLE) + || (sHSDetInfo.bEnKeyOff != MCDRV_KEYEN_D_D_D) + || (sHSDetInfo.bEnKeyOn != MCDRV_KEYEN_D_D_D))) { + if (IsLDOAOn() != 0) { + McResCtrl_GetPathInfoVirtual( + &sCurPathInfo); + sTmpPathInfo = sCurPathInfo; + sTmpPathInfo.asAdc0[0].dSrcOnOff + = 0x00AAAAAA; + sTmpPathInfo.asAdc0[1].dSrcOnOff + = 0x00AAAAAA; + + sTmpPathInfo.asAdc1[0].dSrcOnOff + = 0x00AAAAAA; + + sTmpPathInfo.asSp[0].dSrcOnOff + = 0x002AAAAA; + sTmpPathInfo.asSp[1].dSrcOnOff + = 0x002AAAAA; + sTmpPathInfo.asHp[0].dSrcOnOff + = 0x002AAAAA; + sTmpPathInfo.asHp[1].dSrcOnOff + = 0x002AAAAA; + sTmpPathInfo.asRc[0].dSrcOnOff + = 0x002AAAAA; + sTmpPathInfo.asLout1[0].dSrcOnOff + = 0x002AAAAA; + sTmpPathInfo.asLout1[1].dSrcOnOff + = 0x002AAAAA; + sTmpPathInfo.asLout2[0].dSrcOnOff + = 0x002AAAAA; + sTmpPathInfo.asLout2[1].dSrcOnOff + = 0x002AAAAA; + + sTmpPathInfo.asBias[0].dSrcOnOff + = 0x002AAAAA; + sTmpPathInfo.asBias[1].dSrcOnOff + = 0x002AAAAA; + sTmpPathInfo.asBias[2].dSrcOnOff + = 0x002AAAAA; + sTmpPathInfo.asBias[3].dSrcOnOff + = 0x002AAAAA; + sdRet = set_path(&sTmpPathInfo); + if (sdRet != MCDRV_SUCCESS) + return sdRet; + McPacket_AddMKDetEnable(1); + sdRet = set_path(&sCurPathInfo); + } else { + McPacket_AddMKDetEnable(1); + } + } + } else { + bReg = (UINT8)(MCB_HSDETEN | sHSDetInfo.bHsDetDbnc); + if ((sHSDetInfo.bEnDlyKeyOff != MCDRV_KEYEN_D_D_D) + || (sHSDetInfo.bEnDlyKeyOn != MCDRV_KEYEN_D_D_D) + || (sHSDetInfo.bEnMicDet != MCDRV_MICDET_DISABLE) + || (sHSDetInfo.bEnKeyOff != MCDRV_KEYEN_D_D_D) + || (sHSDetInfo.bEnKeyOn != MCDRV_KEYEN_D_D_D)) { + if ((bPlugDetDB&MCB_RPLUGDET_DB) != 0) { + ; + bReg |= MCB_MKDETEN; + } + } + + McDevIf_AddPacket( + MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_CD + | (UINT32)MCI_HSDETEN, + bReg); + + if ((bReg&MCB_MKDETEN) == 0) { + bReg = + McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_ANA, + MCI_KDSET); + bReg &= (UINT8)~(MCB_KDSET2|MCB_KDSET1); + McDevIf_AddPacket( + MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_KDSET, + bReg); + } + } + } + if (sdRet == MCDRV_SUCCESS) + sdRet = McDevIf_ExecutePacket(); + if (sdRet == MCDRV_SUCCESS) { + ; + sdRet = SavePower(); + } + return sdRet; +} + +/**************************************************************************** + * config_gp + * + * Description: + * Set GPIO mode. + * Arguments: + * psGpMode GPIO mode information + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR_ARGUMENT + * MCDRV_ERROR_STATE +* + ****************************************************************************/ +static SINT32 config_gp +( + const struct MCDRV_GP_MODE *psGpMode +) +{ + enum MCDRV_STATE eState = McResCtrl_GetState(); + + if (NULL == psGpMode) + return MCDRV_ERROR_ARGUMENT; + + if (eMCDRV_STATE_READY != eState) + return MCDRV_ERROR_STATE; + + if (IsValidGpParam(psGpMode) == 0) + return MCDRV_ERROR_ARGUMENT; + + McResCtrl_SetGPMode(psGpMode); + + McPacket_AddGPMode(); + return McDevIf_ExecutePacket(); +} + +/**************************************************************************** + * mask_gp + * + * Description: + * Set GPIO input mask. + * Arguments: + * pbMask mask setting + * dPadNo PAD number + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR_ARGUMENT + * MCDRV_ERROR_STATE + * MCDRV_ERROR +* + ****************************************************************************/ +static SINT32 mask_gp +( + UINT8 *pbMask, + UINT32 dPadNo +) +{ + enum MCDRV_STATE eState = McResCtrl_GetState(); + struct MCDRV_INIT_INFO sInitInfo; + + if (NULL == pbMask) + return MCDRV_ERROR_ARGUMENT; + + if (eMCDRV_STATE_READY != eState) + return MCDRV_ERROR_STATE; + + if (IsValidMaskGp(*pbMask, dPadNo) == 0) + return MCDRV_ERROR_ARGUMENT; + + McResCtrl_GetInitInfo(&sInitInfo, NULL); + if (((dPadNo == 0) && (sInitInfo.bPa0Func != MCDRV_PA_GPIO)) + || ((dPadNo == 1) && (sInitInfo.bPa1Func != MCDRV_PA_GPIO)) + || ((dPadNo == 2) && (sInitInfo.bPa2Func != MCDRV_PA_GPIO))) + return MCDRV_SUCCESS; + + McResCtrl_SetGPMask(*pbMask, dPadNo); + + McPacket_AddGPMask(dPadNo); + return McDevIf_ExecutePacket(); +} + +/**************************************************************************** + * getset_gp + * + * Description: + * Set or get state of GPIO pin. + * Arguments: + * pbGpio pin state + * dPadNo PAD number + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR_ARGUMENT +* + ****************************************************************************/ +static SINT32 getset_gp +( + UINT8 *pbGpio, + UINT32 dPadNo +) +{ + UINT8 bSlaveAddr; + UINT8 abData[2]; + UINT8 bRegData; + enum MCDRV_STATE eState = McResCtrl_GetState(); + struct MCDRV_INIT_INFO sInitInfo; + struct MCDRV_GP_MODE sGPMode; + + if (NULL == pbGpio) + return MCDRV_ERROR_ARGUMENT; + + if (eMCDRV_STATE_READY != eState) + return MCDRV_ERROR_STATE; + + McResCtrl_GetInitInfo(&sInitInfo, NULL); + McResCtrl_GetGPMode(&sGPMode); + + if ((dPadNo != MCDRV_GP_PAD0) + && (dPadNo != MCDRV_GP_PAD1) + && (dPadNo != MCDRV_GP_PAD2)) + return MCDRV_ERROR_ARGUMENT; + + if (((dPadNo == MCDRV_GP_PAD0) + && (sInitInfo.bPa0Func != MCDRV_PA_GPIO)) + || ((dPadNo == MCDRV_GP_PAD1) + && (sInitInfo.bPa1Func != MCDRV_PA_GPIO)) + || ((dPadNo == MCDRV_GP_PAD2) + && (sInitInfo.bPa2Func != MCDRV_PA_GPIO))) + return MCDRV_ERROR; + + if (sGPMode.abGpDdr[dPadNo] == MCDRV_GPDDR_IN) { + bSlaveAddr = + McDevProf_GetSlaveAddr(eMCDRV_SLAVE_ADDR_DIG); + abData[0] = MCI_A_REG_A<<1; + abData[1] = (UINT8)(MCI_PA0+dPadNo); + McSrv_WriteReg(bSlaveAddr, abData, 2); + bRegData = McSrv_ReadReg(bSlaveAddr, MCI_A_REG_D); + *pbGpio = (UINT8)((bRegData & MCB_PA0_DATA) >> 4); + } else { + if (sGPMode.abGpHost[dPadNo] != MCDRV_GPHOST_CDSP) { + if ((*pbGpio != MCDRV_GP_LOW) + && (*pbGpio != MCDRV_GP_HIGH)) + return MCDRV_ERROR_ARGUMENT; + + McResCtrl_SetGPPad(*pbGpio, dPadNo); + McPacket_AddGPSet(dPadNo); + return McDevIf_ExecutePacket(); + } + } + + return MCDRV_SUCCESS; +} + +/**************************************************************************** + * irq_proc + * + * Description: + * Clear interrupt flag. + * Arguments: + * none + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR_STATE + * + ****************************************************************************/ +static SINT32 irq_proc +( + void +) +{ + SINT32 sdRet = MCDRV_SUCCESS; + UINT8 bEIRQ = 0; + UINT8 bSlaveAddrD, bSlaveAddrA; + UINT8 bReg, bSPlugDet, bPlugDet; + struct MCDRV_HSDET_INFO sHSDetInfo; + UINT8 abData[4]; + UINT32 dFlg_DET = 0; + UINT8 bFlg_DLYKEY = 0, + bFlg_KEY = 0; + struct MCDRV_HSDET_RES sHSDetRes; + UINT8 bSENSEFIN; + struct MCDRV_AEC_INFO sAecInfo; + struct MCDRV_PATH_INFO sCurPathInfo; + static UINT8 bOP_DAC; + static UINT8 bHpDet; + UINT32 dCycles, dInterval, dTimeOut; + UINT8 bAP; + + bSlaveAddrD = McDevProf_GetSlaveAddr(eMCDRV_SLAVE_ADDR_DIG); + bSlaveAddrA = McDevProf_GetSlaveAddr(eMCDRV_SLAVE_ADDR_ANA); + + McResCtrl_GetHSDet(&sHSDetInfo, NULL); + + bEIRQ = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_IF, MCI_IRQ); + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_CD, MCI_EIRQSENSE); + if ((bReg & MCB_EIRQSENSE) == 0) { + McSrv_Lock(); + bAP = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_ANA, MCI_AP); + if ((bAP&MCB_AP_LDOD) != 0) { + ; + machdep_PreLDODStart(); + } + } else {/* Sensing */ + /* Disable */ + bAP = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_ANA, MCI_AP); + if ((bAP&MCB_AP_LDOD) != 0) { + ; + machdep_PreLDODStart(); + } + abData[0] = MCI_IRQR<<1; + abData[1] = 0; + McSrv_WriteReg(bSlaveAddrD, abData, 2); + + abData[0] = MCI_CD_REG_A<<1; + abData[1] = MCI_SSENSEFIN; + McSrv_WriteReg(bSlaveAddrA, abData, 2); + bSENSEFIN = McSrv_ReadReg(bSlaveAddrA, MCI_CD_REG_D); + if ((bSENSEFIN&MCB_SSENSEFIN) != 0) { + abData[1] = MCI_EIRQSENSE; + abData[2] = MCI_CD_REG_D<<1; + abData[3] = 0; + McSrv_WriteReg(bSlaveAddrA, abData, 4); + McResCtrl_SetRegVal(MCDRV_PACKET_REGTYPE_CD, + MCI_EIRQSENSE, 0); + abData[1] = MCI_SSENSEFIN; + abData[3] = bReg; + McSrv_WriteReg(bSlaveAddrA, abData, 4); + } else { + /* Enable */ + abData[0] = MCI_IRQR<<1; + abData[1] = MCB_EIRQR; + McSrv_WriteReg(bSlaveAddrD, abData, 2); + bAP = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_ANA, + MCI_AP); + if ((bAP&MCB_AP_LDOD) != 0) { + ; + machdep_PostLDODStart(); + } + return MCDRV_SUCCESS; + } + + /* PLUGDET, PLUGUNDETDB, PLUGDETDB */ + abData[0] = MCI_CD_REG_A<<1; + abData[1] = MCI_PLUGDET; + McSrv_WriteReg(bSlaveAddrA, abData, 2); + dFlg_DET = McSrv_ReadReg(bSlaveAddrA, MCI_CD_REG_D); + /* clear */ + abData[2] = MCI_CD_REG_D<<1; + abData[3] = (UINT8)dFlg_DET; + McSrv_WriteReg(bSlaveAddrA, abData, 4); + + /* set reference */ + abData[1] = MCI_PLUGDET_DB; + McSrv_WriteReg(bSlaveAddrA, abData, 2); + bReg = McSrv_ReadReg(bSlaveAddrA, MCI_CD_REG_D); + McResCtrl_SetPlugDetDB(bReg); + abData[1] = MCI_RPLUGDET; + abData[3] = ((UINT8)dFlg_DET&MCB_PLUGDET) | bReg; + McSrv_WriteReg(bSlaveAddrA, abData, 4); + dFlg_DET = abData[3]; + + abData[1] = MCI_MICDET; + McSrv_WriteReg(bSlaveAddrA, abData, 2); + bReg = McSrv_ReadReg(bSlaveAddrA, MCI_CD_REG_D); + bFlg_KEY = bReg & + (sHSDetInfo.bEnMicDet == MCDRV_MICDET_ENABLE ? + MCB_MICDET : 0); + abData[1] = MCI_RMICDET; + abData[3] = bReg; + McSrv_WriteReg(bSlaveAddrA, abData, 4); + + abData[1] = MCI_SMICDET; + McSrv_WriteReg(bSlaveAddrA, abData, 2); + bReg = McSrv_ReadReg(bSlaveAddrA, MCI_CD_REG_D); + abData[3] = bReg; + McSrv_WriteReg(bSlaveAddrA, abData, 4); + + sHSDetRes.bKeyCnt0 = 0; + sHSDetRes.bKeyCnt1 = 0; + sHSDetRes.bKeyCnt2 = 0; + + abData[0] = MCI_E_REG_A<<1; + abData[1] = MCI_PLUG_REV; + McSrv_WriteReg(bSlaveAddrD, abData, 2); + bReg = McSrv_ReadReg(bSlaveAddrD, MCI_E_REG_D); + sHSDetRes.bPlugRev = bReg>>7; + sHSDetRes.bHpImpClass = bReg&0x07; + abData[1] = MCI_HPIMP_15_8; + McSrv_WriteReg(bSlaveAddrD, abData, 2); + bReg = McSrv_ReadReg(bSlaveAddrD, MCI_E_REG_D); + sHSDetRes.wHpImp = bReg<<8; + abData[1] = MCI_HPIMP_7_0; + McSrv_WriteReg(bSlaveAddrD, abData, 2); + bReg = McSrv_ReadReg(bSlaveAddrD, MCI_E_REG_D); + sHSDetRes.wHpImp |= bReg; + + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_E, + MCI_LPF_THR); + bReg &= (MCB_OSF1_MN|MCB_OSF0_MN|MCB_OSF1_ENB|MCB_OSF0_ENB); + McResCtrl_GetAecInfo(&sAecInfo); + bReg |= (UINT8)(sAecInfo.sOutput.bLpf_Post_Thru[1]<<7); + bReg |= (UINT8)(sAecInfo.sOutput.bLpf_Post_Thru[0]<<6); + bReg |= (UINT8)(sAecInfo.sOutput.bLpf_Pre_Thru[1]<<5); + bReg |= (UINT8)(sAecInfo.sOutput.bLpf_Pre_Thru[0]<<4); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_LPF_THR, + bReg); + bReg = (UINT8)(sAecInfo.sOutput.bDcl_OnOff[1]<<7) + | (UINT8)(sAecInfo.sOutput.bDcl_Gain[1]<<4) + | (UINT8)(sAecInfo.sOutput.bDcl_OnOff[0]<<3) + | sAecInfo.sOutput.bDcl_Gain[0]; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_DCL_GAIN,/*18*/ + bReg); + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H) { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)19, + bOP_DAC); + } + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_HPDETVOL, + bHpDet); + bReg = (sAecInfo.sE2.bE2_Da_Sel<<3) + | sAecInfo.sE2.bE2_Ad_Sel; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_E2_SEL, + bReg); + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H) { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)78, + T_CPMODE_IMPSENSE_AFTER); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)87, + 0); + abData[0] = MCI_ANA_REG_A<<1; + abData[1] = 78; + McSrv_WriteReg(bSlaveAddrA, abData, 2); + bReg = McSrv_ReadReg(bSlaveAddrA, MCI_ANA_REG_D); + } else { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)87, + 0); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)31, + 0); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)30, + 0); + } + + McResCtrl_GetPathInfoVirtual(&sCurPathInfo); + sdRet = set_path(&sCurPathInfo); + bAP = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_ANA, MCI_AP); + if ((bAP&MCB_AP_LDOD) != 0) { + ; + machdep_PostLDODStart(); + } + if (sHSDetInfo.cbfunc != NULL) { + if ((dFlg_DET & MCB_SPLUGUNDET_DB) != 0) { + ; + dFlg_DET = MCB_PLUGUNDET_DB; + } else { + dFlg_DET |= + MCDRV_HSDET_EVT_SENSEFIN_FLAG; + } + McSrv_Unlock(); + (*sHSDetInfo.cbfunc)(dFlg_DET + |((UINT32)bFlg_KEY<<16), + &sHSDetRes); + McSrv_Lock(); + } + /* Enable IRQ */ + bAP = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_ANA, + MCI_AP); + if ((bAP&MCB_AP_LDOD) != 0) { + ; + machdep_PreLDODStart(); + } + abData[0] = MCI_CD_REG_A<<1; + abData[1] = MCI_IRQHS; + abData[2] = MCI_CD_REG_D<<1; + abData[3] = MCB_EIRQHS; + McSrv_WriteReg(bSlaveAddrA, abData, 4); + McResCtrl_SetRegVal(MCDRV_PACKET_REGTYPE_CD, + MCI_IRQHS, MCB_EIRQHS); + abData[0] = MCI_IRQR<<1; + abData[1] = MCB_EIRQR; + McSrv_WriteReg(bSlaveAddrD, abData, 2); + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_IF, + MCI_RST_A); + if (bReg == 0) { + abData[0] = MCI_IRQ<<1; + abData[1] = MCB_EIRQ; + McSrv_WriteReg(bSlaveAddrD, abData, 2); + McResCtrl_SetRegVal(MCDRV_PACKET_REGTYPE_IF, + MCI_IRQ, MCB_EIRQ); + } + bAP = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_ANA, MCI_AP); + if ((bAP&MCB_AP_LDOD) != 0) { + ; + machdep_PostLDODStart(); + } + McSrv_Unlock(); + return MCDRV_SUCCESS; + } + + if (eMCDRV_STATE_READY != McResCtrl_GetState()) { + sdRet = MCDRV_ERROR_STATE; + goto exit; + } + + if ((bEIRQ&MCB_EIRQ) != 0) { + bReg = McSrv_ReadReg(bSlaveAddrD, MCI_EDSP); + if (bReg != 0) { + /* Disable IRQ */ + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_EEDSP, + 0); + sdRet = McDevIf_ExecutePacket(); + if (sdRet != MCDRV_SUCCESS) + goto exit; + + if ((bReg & MCB_E2DSP_STA) != 0) { + ; + McEdsp_IrqProc(); + } + /* Clear IRQ */ + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_EDSP, + bReg); + /* Enable IRQ */ + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_EEDSP, + MCB_EE2DSP); + } + + bReg = McSrv_ReadReg(bSlaveAddrD, MCI_CDSP); + if (bReg != 0) { + /* Disable IRQ */ + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_ECDSP, + 0); + sdRet = McDevIf_ExecutePacket(); + if (sdRet != MCDRV_SUCCESS) + goto exit; + McCdsp_IrqProc(); + /* Clear IRQ */ + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_CDSP, + bReg); + /* Enable IRQ */ + bReg = MCB_ECDSP + | MCB_EFFIFO + | MCB_ERFIFO + | MCB_EEFIFO + | MCB_EOFIFO + | MCB_EDFIFO + | MCB_EENC + | MCB_EDEC; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_ECDSP, + bReg); + } + + bReg = McSrv_ReadReg(bSlaveAddrD, MCI_IRSERR); + if (bReg != 0) { + /* Disable IRQ */ + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_IESERR, + 0); + sdRet = McDevIf_ExecutePacket(); + if (sdRet != MCDRV_SUCCESS) + goto exit; + McFdsp_IrqProc(); + /* Clear IRQ */ + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_IRSERR, + bReg); + /* Enable IRQ */ + bReg = MCB_IESERR + | MCB_IEAMTBEG + | MCB_IEAMTEND + | MCB_IEFW; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_IESERR, + bReg); + } + sdRet = McDevIf_ExecutePacket(); + if (sdRet != MCDRV_SUCCESS) + goto exit; + } + + abData[0] = MCI_CD_REG_A<<1; + abData[1] = MCI_IRQHS; + McSrv_WriteReg(bSlaveAddrA, abData, 2); + bReg = McSrv_ReadReg(bSlaveAddrA, MCI_CD_REG_D); + if (bReg == (MCB_EIRQHS|MCB_IRQHS)) { + /* Disable EIRQHS */ + abData[2] = MCI_CD_REG_D<<1; + abData[3] = 0; + McSrv_WriteReg(bSlaveAddrA, abData, 4); + McResCtrl_SetRegVal(MCDRV_PACKET_REGTYPE_CD, + MCI_IRQHS, 0); + + /* PLUGDET, SPLUGUNDETDB, SPLUGDETDB */ + abData[1] = MCI_PLUGDET;/*10*/ + McSrv_WriteReg(bSlaveAddrA, abData, 2); + bSPlugDet = McSrv_ReadReg(bSlaveAddrA, MCI_CD_REG_D); + dFlg_DET = (bSPlugDet&MCB_PLUGDET); + + abData[1] = MCI_PLUGDET_DB; + McSrv_WriteReg(bSlaveAddrA, abData, 2); + bPlugDet = McSrv_ReadReg(bSlaveAddrA, MCI_CD_REG_D); + dFlg_DET |= bPlugDet; + + if ((dFlg_DET&MCB_PLUGUNDET_DB) != 0) { + ; + McResCtrl_SetPlugDetDB(0); + } + if ((sHSDetInfo.bEnPlugDetDb & MCDRV_PLUGDETDB_DET_ENABLE) != 0 + ) { + if (McDevProf_GetDevId() != eMCDRV_DEV_ID_80_90H) { + abData[1] = MCI_RPLUGDET; + McSrv_WriteReg(bSlaveAddrA, abData, 2); + bReg = (UINT8)~McSrv_ReadReg(bSlaveAddrA, + MCI_CD_REG_D); + bReg &= bPlugDet; + } else { + bReg = bSPlugDet; + } + if ((bReg & MCB_SPLUGDET_DB) != 0) { + McResCtrl_SetPlugDetDB(bReg); + if ((McDevProf_GetDevId() == + eMCDRV_DEV_ID_80_90H) + || (McDevProf_GetDevId() == + eMCDRV_DEV_ID_81_91H)) { + bReg = McResCtrl_GetRegVal( + MCDRV_PACKET_REGTYPE_ANA, + MCI_AP); + bReg &= (UINT8)~MCB_AP_BGR; + McDevIf_AddPacket( + MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_AP, + bReg); + } + McResCtrl_GetPathInfoVirtual(&sCurPathInfo); + sCurPathInfo.asBias[3].dSrcOnOff |= + MCDRV_ASRC_MIC4_ON; + sdRet = set_path(&sCurPathInfo); + if (sdRet != MCDRV_SUCCESS) { + /* Enable IRQ */ + abData[1] = MCI_IRQHS; + abData[3] = MCB_EIRQHS; + McSrv_WriteReg(bSlaveAddrA, abData, 4); + McResCtrl_SetRegVal( + MCDRV_PACKET_REGTYPE_CD, + MCI_IRQHS, MCB_EIRQHS); + goto exit; + } + if ((sHSDetInfo.bEnDlyKeyOff != + MCDRV_KEYEN_D_D_D) + || (sHSDetInfo.bEnDlyKeyOn != + MCDRV_KEYEN_D_D_D) + || (sHSDetInfo.bEnMicDet != + MCDRV_MICDET_DISABLE) + || (sHSDetInfo.bEnKeyOff != + MCDRV_KEYEN_D_D_D) + || (sHSDetInfo.bEnKeyOn != + MCDRV_KEYEN_D_D_D)) { + ; + McPacket_AddMKDetEnable(0); + } + sdRet = McDevIf_ExecutePacket(); + if (sdRet != MCDRV_SUCCESS) { + /* Enable IRQ */ + abData[1] = MCI_IRQHS; + abData[3] = MCB_EIRQHS; + McSrv_WriteReg(bSlaveAddrA, abData, 4); + McResCtrl_SetRegVal( + MCDRV_PACKET_REGTYPE_CD, + MCI_IRQHS, MCB_EIRQHS); + goto exit; + } + if (sHSDetInfo.bSgnlNum != MCDRV_SGNLNUM_NONE + ) { + bHpDet = McResCtrl_GetRegVal( + MCDRV_PACKET_REGTYPE_ANA, + MCI_HPDETVOL); + sdRet = BeginImpSense(&bOP_DAC); + if (sdRet != MCDRV_SUCCESS) { + /* Enable IRQ */ + abData[1] = MCI_IRQHS; + abData[3] = MCB_EIRQHS; + McSrv_WriteReg(bSlaveAddrA, + abData, 4); + McResCtrl_SetRegVal( + MCDRV_PACKET_REGTYPE_CD, + MCI_IRQHS, MCB_EIRQHS); + goto exit; + } + bAP = McResCtrl_GetRegVal( + MCDRV_PACKET_REGTYPE_ANA, + MCI_AP); + if ((bAP&MCB_AP_LDOD) != 0) { + ; + machdep_PostLDODStart(); + } + return sdRet; + } + } + } + + /* clear */ + abData[1] = MCI_PLUGDET;/*10*/ + abData[3] = bSPlugDet; + McSrv_WriteReg(bSlaveAddrA, abData, 4); + + /* set reference */ + abData[1] = MCI_RPLUGDET; + abData[3] = (UINT8)dFlg_DET; + McSrv_WriteReg(bSlaveAddrA, abData, 4); + + /* DLYKEYON, DLYKEYOFF */ + abData[1] = MCI_SDLYKEY; + McSrv_WriteReg(bSlaveAddrA, abData, 2); + bReg = McSrv_ReadReg(bSlaveAddrA, MCI_CD_REG_D); + bFlg_DLYKEY = bReg; + /* clear */ + abData[1] = MCI_SDLYKEY; + abData[3] = bReg; + McSrv_WriteReg(bSlaveAddrA, abData, 4); + + /* MICDET, KEYON, KEYOFF */ + abData[1] = MCI_SMICDET; + McSrv_WriteReg(bSlaveAddrA, abData, 2); + bReg = McSrv_ReadReg(bSlaveAddrA, MCI_CD_REG_D); + bFlg_KEY = bReg & (UINT8)~MCB_SMICDET; + /* clear */ + abData[1] = MCI_SMICDET; + abData[3] = bReg; + McSrv_WriteReg(bSlaveAddrA, abData, 4); + + /* set reference */ + abData[1] = MCI_MICDET; + McSrv_WriteReg(bSlaveAddrA, abData, 2); + if (sHSDetInfo.bSgnlNum == MCDRV_SGNLNUM_NONE) { + if ((dFlg_DET & MCB_PLUGDET_DB) != 0) { + dCycles = 0; + switch (sHSDetInfo.bSperiod) { + default: + case MCDRV_SPERIOD_244: + dInterval = 244; + break; + case MCDRV_SPERIOD_488: + dInterval = 488; + break; + case MCDRV_SPERIOD_977: + dInterval = 977; + break; + case MCDRV_SPERIOD_1953: + dInterval = 1953; + break; + case MCDRV_SPERIOD_3906: + dInterval = 3906; + break; + case MCDRV_SPERIOD_7813: + dInterval = 7813; + break; + case MCDRV_SPERIOD_15625: + dInterval = 15625; + break; + case MCDRV_SPERIOD_31250: + dInterval = 31250; + break; + } + switch (sHSDetInfo.bDbncNumMic) { + default: + case MCDRV_DBNC_NUM_2: + dTimeOut = 1; + break; + case MCDRV_DBNC_NUM_3: + dTimeOut = 4; + break; + case MCDRV_DBNC_NUM_4: + dTimeOut = 5; + break; + case MCDRV_DBNC_NUM_7: + dTimeOut = 8; + break; + } + + while (dCycles < dTimeOut) { + bReg = McSrv_ReadReg(bSlaveAddrA, + MCI_CD_REG_D); + if ((bReg & (MCB_MICDET|0x07)) != 0) { + ; + break; + } + McSrv_Sleep(dInterval); + dCycles++; + } + } + } else { + bReg = McSrv_ReadReg(bSlaveAddrA, MCI_CD_REG_D); + } + bFlg_KEY |= bReg & + (sHSDetInfo.bEnMicDet == MCDRV_MICDET_ENABLE ? + MCB_MICDET : 0); + abData[1] = MCI_RMICDET; + abData[3] = bReg; + McSrv_WriteReg(bSlaveAddrA, abData, 4); + + if (sHSDetInfo.cbfunc != NULL) { + /* KeyCnt0 */ + abData[1] = MCI_KEYCNTCLR0; + McSrv_WriteReg(bSlaveAddrA, abData, 2); + sHSDetRes.bKeyCnt0 = McSrv_ReadReg(bSlaveAddrA, + MCI_CD_REG_D); + abData[1] = MCI_KEYCNTCLR0; + abData[3] = MCB_KEYCNTCLR0; + McSrv_WriteReg(bSlaveAddrA, abData, 4); + + /* KeyCnt1 */ + abData[1] = MCI_KEYCNTCLR1; + McSrv_WriteReg(bSlaveAddrA, abData, 2); + sHSDetRes.bKeyCnt1 = McSrv_ReadReg(bSlaveAddrA, + MCI_CD_REG_D); + abData[1] = MCI_KEYCNTCLR1; + abData[3] = MCB_KEYCNTCLR1; + McSrv_WriteReg(bSlaveAddrA, abData, 4); + + /* KeyCnt2 */ + abData[1] = MCI_KEYCNTCLR2; + McSrv_WriteReg(bSlaveAddrA, abData, 2); + sHSDetRes.bKeyCnt2 = McSrv_ReadReg(bSlaveAddrA, + MCI_CD_REG_D); + abData[1] = MCI_KEYCNTCLR2; + abData[3] = MCB_KEYCNTCLR2; + McSrv_WriteReg(bSlaveAddrA, abData, 4); + + abData[0] = MCI_IRQ<<1; + abData[1] = 0; + McSrv_WriteReg(bSlaveAddrD, abData, 2); + McResCtrl_SetRegVal(MCDRV_PACKET_REGTYPE_IF, MCI_IRQ, + 0); + abData[0] = MCI_IRQR<<1; + abData[1] = 0; + McSrv_WriteReg(bSlaveAddrD, abData, 2); + bAP = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_ANA, + MCI_AP); + if ((bAP&MCB_AP_LDOD) != 0) { + ; + machdep_PostLDODStart(); + } + sHSDetRes.bPlugRev = 0; + sHSDetRes.bHpImpClass = 0; + sHSDetRes.wHpImp = 0; + McSrv_Unlock(); + (*sHSDetInfo.cbfunc)( + dFlg_DET + |((UINT32)bFlg_DLYKEY<<8) + |((UINT32)bFlg_KEY<<16), + &sHSDetRes); + McSrv_Lock(); + bAP = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_ANA, + MCI_AP); + if ((bAP&MCB_AP_LDOD) != 0) { + ; + machdep_PreLDODStart(); + } + abData[0] = MCI_IRQR<<1; + abData[1] = MCB_EIRQR; + McSrv_WriteReg(bSlaveAddrD, abData, 2); + } + /* Enable IRQ */ + abData[0] = MCI_CD_REG_A<<1; + abData[1] = MCI_IRQHS; + abData[2] = MCI_CD_REG_D<<1; + abData[3] = MCB_EIRQHS; + McSrv_WriteReg(bSlaveAddrA, abData, 4); + McResCtrl_SetRegVal(MCDRV_PACKET_REGTYPE_CD, + MCI_IRQHS, MCB_EIRQHS); + } + +exit: + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_IF, MCI_RST_A); + if (bReg == 0) { + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_IF, + MCI_IRQ); + if (bReg != MCB_EIRQ) { + abData[0] = MCI_IRQ<<1; + abData[1] = MCB_EIRQ; + McSrv_WriteReg(bSlaveAddrD, abData, 2); + McResCtrl_SetRegVal(MCDRV_PACKET_REGTYPE_IF, MCI_IRQ, + MCB_EIRQ); + } + } + + bAP = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_ANA, MCI_AP); + if ((bAP&MCB_AP_LDOD) != 0) { + ; + machdep_PostLDODStart(); + } + McSrv_Unlock(); + return sdRet; +} + +#ifndef MCDRV_SKIP_IMPSENSE +/**************************************************************************** + * BeginImpSense + * + * Description: + * Begin Imp Sensing. + * Arguments: + * none + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR_RESOURCEOVER + * MCDRV_ERROR_TIMEOUT + * + ****************************************************************************/ +static SINT32 BeginImpSense +( + UINT8 *bOP_DAC +) +{ + SINT32 sdRet = MCDRV_SUCCESS; + UINT8 bReg; + struct MCDRV_POWER_INFO sPowerInfo; + struct MCDRV_POWER_UPDATE sPowerUpdate; + struct MCDRV_HSDET_INFO sHSDetInfo; + struct MCDRV_INIT_INFO sInitInfo; + struct MCDRV_INIT2_INFO sInit2Info; + UINT8 bSlaveAddrA; + UINT8 abData[2]; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("BeginImpSense"); +#endif + + bSlaveAddrA = McDevProf_GetSlaveAddr(eMCDRV_SLAVE_ADDR_ANA); + McResCtrl_GetCurPowerInfo(&sPowerInfo); + sPowerInfo.bDigital &= ~(MCDRV_POWINFO_D_PM_CLK_PD + |MCDRV_POWINFO_D_PE_CLK_PD + |MCDRV_POWINFO_D_PLL_PD); + sPowerInfo.abAnalog[0] &= + (UINT8)~(MCB_AP_LDOA|MCB_AP_LDOD|MCB_AP_BGR|MCB_AP_VR); + + /* power up */ + sPowerUpdate.bDigital = MCDRV_POWUPDATE_D_ALL; + sPowerUpdate.abAnalog[0] = (UINT8)MCDRV_POWUPDATE_AP; + sPowerUpdate.abAnalog[1] = 0; + sPowerUpdate.abAnalog[2] = 0; + sPowerUpdate.abAnalog[3] = 0; + sPowerUpdate.abAnalog[4] = 0; + sdRet = McPacket_AddPowerUp(&sPowerInfo, &sPowerUpdate); + if (sdRet != MCDRV_SUCCESS) + goto exit; + sdRet = McDevIf_ExecutePacket(); + if (sdRet != MCDRV_SUCCESS) + goto exit; + + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_IRQ, + 0); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_CD + | (UINT32)MCI_IRQHS, + 0); + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_E1DSP_CTRL), + (UINT8)0x00); + + McPacket_AddDac0Mute(); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MA + | (UINT32)MCI_DAO0_VOL0), + MCDRV_REG_MUTE); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MA + | (UINT32)MCI_DAO0_VOL1), + MCDRV_REG_MUTE); + + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_E, + MCI_LPF_THR); + bReg |= (MCB_OSF0_ENB|MCB_LPF0_PST_THR|MCB_LPF0_PRE_THR); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_LPF_THR, + bReg); + + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_CD, MCI_DP); + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H) { + bReg &= (UINT8)~(MCB_DP_ADC|MCB_DP_DAC0| + MCB_DP_PDMCK|MCB_DP_PDMADC|MCB_DP_PDMDAC); + } else { + bReg &= (UINT8)~(MCB_DP_ADC|MCB_DP_DAC1|MCB_DP_DAC0| + MCB_DP_PDMCK|MCB_DP_PDMADC|MCB_DP_PDMDAC); + } + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_CD + | (UINT32)MCI_DP, + bReg); + + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_E, + MCI_DCL_GAIN); + bReg |= MCB_DCL0_OFF; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_DCL_GAIN, + bReg); + + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H) { + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_E, + MCI_DSF0_FLT_TYPE); + bReg |= MCB_DSF0ENB; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_DSF0_FLT_TYPE, + bReg); + } else { + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_E, + MCI_DSF2_FLT_TYPE); + bReg |= MCB_DSF2ENB; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_DSF2_FLT_TYPE, + bReg); + } + + McResCtrl_GetHSDet(&sHSDetInfo, NULL); + bReg = (sHSDetInfo.bSgnlPeak<<4) + | (sHSDetInfo.bSgnlNum<<2) + | sHSDetInfo.bSgnlPeriod; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_IMPSEL, + bReg); + + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_E, MCI_E2_SEL); + bReg &= (UINT8)~0x0C; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_E2_SEL, + 0); + + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_IRQR, + MCB_EIRQR); + + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_CD + | (UINT32)MCI_EIRQSENSE, + MCB_EIRQSENSE); + + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H) { + *bOP_DAC = McResCtrl_GetRegVal( + MCDRV_PACKET_REGTYPE_ANA, 19); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)19, + 0); + } + + McResCtrl_GetInitInfo(&sInitInfo, &sInit2Info); + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H) { + ; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_HPDETVOL, + 0x70); + } else if (McDevProf_GetDevId() == eMCDRV_DEV_ID_81_91H) { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_HPDETVOL, + 0x6B); + } else { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_HPDETVOL, + sInit2Info.bOption[9]); + } + + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H) { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)78, + T_CPMODE_IMPSENSE_BEFORE); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)87, + 0x11); + } else { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)31, + 0xB5); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)30, + 0xD6); + + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)87, + sInit2Info.bOption[10]); + } + sdRet = McDevIf_ExecutePacket(); + if (sdRet != MCDRV_SUCCESS) + goto exit; + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H) { + abData[0] = MCI_ANA_REG_A<<1; + abData[1] = 78; + McSrv_WriteReg(bSlaveAddrA, abData, 2); + bReg = McSrv_ReadReg(bSlaveAddrA, MCI_ANA_REG_D); + if (bReg != T_CPMODE_IMPSENSE_BEFORE) { + sdRet = MCDRV_ERROR; + goto exit; + } + } + + bReg = E1COMMAND_IMP_SENSE; + if (sInitInfo.bGndDet == MCDRV_GNDDET_ON) + bReg |= E1COMMAND_GND_DET; + if ((McResCtrl_IsASrcUsed(MCDRV_ASRC_DAC1_L_ON) != 0) + || (McResCtrl_IsASrcUsed(MCDRV_ASRC_DAC1_R_ON) != 0) + || (McResCtrl_IsD2SrcUsed(MCDRV_D2SRC_ADC0_L_ON) != 0) + || (McResCtrl_IsD2SrcUsed(MCDRV_D2SRC_ADC0_R_ON) != 0) + || (McResCtrl_IsD2SrcUsed(MCDRV_D2SRC_ADC1_ON) != 0) + || (McResCtrl_IsD2SrcUsed(MCDRV_D2SRC_PDM0_L_ON) != 0) + || (McResCtrl_IsD2SrcUsed(MCDRV_D2SRC_PDM0_R_ON) != 0) + || (McResCtrl_IsD2SrcUsed(MCDRV_D2SRC_PDM1_L_ON) != 0) + || (McResCtrl_IsD2SrcUsed(MCDRV_D2SRC_PDM1_R_ON) != 0)) + bReg |= E1COMMAND_ADDITIONAL; + else if ((McResCtrl_IsASrcUsed(MCDRV_ASRC_DAC0_L_ON) != 0) + || (McResCtrl_IsASrcUsed(MCDRV_ASRC_DAC0_R_ON) != 0)) + bReg |= (E1COMMAND_ADDITIONAL|E1COMMAND_PD); + + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H) { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_TIMWAIT + | MCDRV_DAC_MUTE_WAIT_TIME, + 0); + } else { + bReg |= E1COMMAND_WAIT; + } + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_E1COMMAND, + bReg); + + sdRet = McDevIf_ExecutePacket(); + +exit: +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("BeginImpSense", &sdRet); +#endif + return sdRet; +} +#endif + +/**************************************************************************** + * IsLDOAOn + * + * Description: + * Is LDOA used. + * Arguments: + * none + * Return: + * 0:unused, 1:used + * + ****************************************************************************/ +static UINT8 IsLDOAOn +( + void +) +{ + UINT8 bRet = 0; + +#if (MCDRV_DEBUG_LEVEL >= 4) + SINT32 sdRet; + McDebugLog_FuncIn("IsLDOAOn"); +#endif + if ((McResCtrl_HasSrc(eMCDRV_DST_ADC0, eMCDRV_DST_CH0) != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_ADC0, eMCDRV_DST_CH1) != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_ADC1, eMCDRV_DST_CH0) != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_BIAS, eMCDRV_DST_CH0) != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_BIAS, eMCDRV_DST_CH1) != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_BIAS, eMCDRV_DST_CH2) != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_BIAS, eMCDRV_DST_CH3) != 0) + || (McResCtrl_IsASrcUsed(MCDRV_ASRC_DAC0_L_ON) != 0) + || (McResCtrl_IsASrcUsed(MCDRV_ASRC_DAC0_R_ON) != 0) + || (McResCtrl_IsASrcUsed(MCDRV_ASRC_DAC1_L_ON) != 0) + || (McResCtrl_IsASrcUsed(MCDRV_ASRC_DAC1_R_ON) != 0)) + bRet = 1; + +#if (MCDRV_DEBUG_LEVEL >= 4) + sdRet = bRet; + McDebugLog_FuncOut("IsLDOAOn", &sdRet); +#endif + return bRet; +} + +/**************************************************************************** + * IsValidInitParam + * + * Description: + * check init parameters. + * Arguments: + * psInitInfo initialize information + * psInit2Info initialize information + * Return: + * 0:Invalid + * othre:Valid + * + ****************************************************************************/ +static UINT8 IsValidInitParam +( + const struct MCDRV_INIT_INFO *psInitInfo, + const struct MCDRV_INIT2_INFO *psInit2Info +) +{ + UINT8 bRet = 1; + +#if (MCDRV_DEBUG_LEVEL >= 4) + SINT32 sdRet; + McDebugLog_FuncIn("IsValidInitParam"); +#endif + + + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_89_92H) { + if ((MCDRV_CKSEL_CMOS != psInitInfo->bCkSel) + && (MCDRV_CKSEL_TCXO != psInitInfo->bCkSel)) + bRet = 0; + } else { + if ((MCDRV_CKSEL_CMOS_CMOS != psInitInfo->bCkSel) + && (MCDRV_CKSEL_TCXO_TCXO != psInitInfo->bCkSel) + && (MCDRV_CKSEL_CMOS_TCXO != psInitInfo->bCkSel) + && (MCDRV_CKSEL_TCXO_CMOS != psInitInfo->bCkSel)) + bRet = 0; + } + + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_89_92H) { + if ((MCDRV_CKINPUT_CLKI0_RTCK != psInitInfo->bCkInput) + && (MCDRV_CKINPUT_CLKI0_SBCK != psInitInfo->bCkInput) + && (MCDRV_CKINPUT_RTC_CLKI0 != psInitInfo->bCkInput) + && (MCDRV_CKINPUT_RTC_SBCK != psInitInfo->bCkInput) + && (MCDRV_CKINPUT_SBCK_CLKI0 != psInitInfo->bCkInput) + && (MCDRV_CKINPUT_SBCK_RTC != psInitInfo->bCkInput) + && (MCDRV_CKINPUT_CLKI0_CLKI0 != psInitInfo->bCkInput) + && (MCDRV_CKINPUT_RTC_RTC != psInitInfo->bCkInput) + && (MCDRV_CKINPUT_SBCK_SBCK != psInitInfo->bCkInput)) + bRet = 0; + } else { + if ((MCDRV_CKINPUT_CLKI0_CLKI1 != psInitInfo->bCkInput) + && (MCDRV_CKINPUT_CLKI0_RTCK != psInitInfo->bCkInput) + && (MCDRV_CKINPUT_CLKI0_SBCK != psInitInfo->bCkInput) + && (MCDRV_CKINPUT_CLKI1_CLKI0 != psInitInfo->bCkInput) + && (MCDRV_CKINPUT_CLKI1_RTCK != psInitInfo->bCkInput) + && (MCDRV_CKINPUT_CLKI1_SBCK != psInitInfo->bCkInput) + && (MCDRV_CKINPUT_RTC_CLKI0 != psInitInfo->bCkInput) + && (MCDRV_CKINPUT_RTC_CLKI1 != psInitInfo->bCkInput) + && (MCDRV_CKINPUT_RTC_SBCK != psInitInfo->bCkInput) + && (MCDRV_CKINPUT_SBCK_CLKI0 != psInitInfo->bCkInput) + && (MCDRV_CKINPUT_SBCK_CLKI1 != psInitInfo->bCkInput) + && (MCDRV_CKINPUT_SBCK_RTC != psInitInfo->bCkInput) + && (MCDRV_CKINPUT_CLKI0_CLKI0 != psInitInfo->bCkInput) + && (MCDRV_CKINPUT_CLKI1_CLKI1 != psInitInfo->bCkInput) + && (MCDRV_CKINPUT_RTC_RTC != psInitInfo->bCkInput) + && (MCDRV_CKINPUT_SBCK_SBCK != psInitInfo->bCkInput)) + bRet = 0; + } + + if (psInitInfo->bPllModeA > 7) + bRet = 0; + + if (psInitInfo->bPllPrevDivA > 0x3F) + bRet = 0; + + if (psInitInfo->wPllFbDivA > 0x3FFF) + bRet = 0; + + if ((psInitInfo->bPllFreqA != MCDRV_PLLFREQ_73) + && (psInitInfo->bPllFreqA != MCDRV_PLLFREQ_147)) + bRet = 0; + + if (psInitInfo->bPllModeB > 7) + bRet = 0; + + if (psInitInfo->bPllPrevDivB > 0x3F) + bRet = 0; + + if (psInitInfo->wPllFbDivB > 0x3FFF) + bRet = 0; + + if ((psInitInfo->bPllFreqB != MCDRV_PLLFREQ_73) + && (psInitInfo->bPllFreqB != MCDRV_PLLFREQ_147)) + bRet = 0; + + if ((psInitInfo->bHsdetClk != MCDRV_HSDETCLK_RTC) + && (psInitInfo->bHsdetClk != MCDRV_HSDETCLK_OSC)) + bRet = 0; + + if (((MCDRV_DAHIZ_LOW != psInitInfo->bDio0SdoHiz) + && (MCDRV_DAHIZ_HIZ != psInitInfo->bDio0SdoHiz)) + || ((MCDRV_DAHIZ_LOW != psInitInfo->bDio1SdoHiz) + && (MCDRV_DAHIZ_HIZ != psInitInfo->bDio1SdoHiz)) + || ((MCDRV_DAHIZ_LOW != psInitInfo->bDio2SdoHiz) + && (MCDRV_DAHIZ_HIZ != psInitInfo->bDio2SdoHiz))) + bRet = 0; + + if (((MCDRV_DAHIZ_LOW != psInitInfo->bDio0ClkHiz) + && (MCDRV_DAHIZ_HIZ != psInitInfo->bDio0ClkHiz)) + || ((MCDRV_DAHIZ_LOW != psInitInfo->bDio1ClkHiz) + && (MCDRV_DAHIZ_HIZ != psInitInfo->bDio1ClkHiz)) + || ((MCDRV_DAHIZ_LOW != psInitInfo->bDio2ClkHiz) + && (MCDRV_DAHIZ_HIZ != psInitInfo->bDio2ClkHiz))) + bRet = 0; + + if (((MCDRV_PCMHIZ_LOW != psInitInfo->bDio0PcmHiz) + && (MCDRV_PCMHIZ_HIZ != psInitInfo->bDio0PcmHiz)) + || ((MCDRV_PCMHIZ_LOW != psInitInfo->bDio1PcmHiz) + && (MCDRV_PCMHIZ_HIZ != psInitInfo->bDio1PcmHiz)) + || ((MCDRV_PCMHIZ_LOW != psInitInfo->bDio2PcmHiz) + && (MCDRV_PCMHIZ_HIZ != psInitInfo->bDio2PcmHiz))) + bRet = 0; + + if ((MCDRV_PA_GPIO != psInitInfo->bPa0Func) + && (MCDRV_PA_PDMCK != psInitInfo->bPa0Func)) + bRet = 0; + + if ((MCDRV_PA_GPIO != psInitInfo->bPa1Func) + && (MCDRV_PA_PDMDI != psInitInfo->bPa1Func)) + bRet = 0; + + if ((MCDRV_PA_GPIO != psInitInfo->bPa2Func) + && (MCDRV_PA_PDMDI != psInitInfo->bPa2Func)) + bRet = 0; + + if ((MCDRV_POWMODE_FULL != psInitInfo->bPowerMode) + && (MCDRV_POWMODE_CDSPDEBUG != psInitInfo->bPowerMode)) + bRet = 0; + + if ((psInitInfo->bMbSel1 != MCDRV_MBSEL_20) + && (psInitInfo->bMbSel1 != MCDRV_MBSEL_21) + && (psInitInfo->bMbSel1 != MCDRV_MBSEL_22) + && (psInitInfo->bMbSel1 != MCDRV_MBSEL_23)) + bRet = 0; + if ((psInitInfo->bMbSel2 != MCDRV_MBSEL_20) + && (psInitInfo->bMbSel2 != MCDRV_MBSEL_21) + && (psInitInfo->bMbSel2 != MCDRV_MBSEL_22) + && (psInitInfo->bMbSel2 != MCDRV_MBSEL_23)) + bRet = 0; + if ((psInitInfo->bMbSel3 != MCDRV_MBSEL_20) + && (psInitInfo->bMbSel3 != MCDRV_MBSEL_21) + && (psInitInfo->bMbSel3 != MCDRV_MBSEL_22) + && (psInitInfo->bMbSel3 != MCDRV_MBSEL_23)) + bRet = 0; + if ((psInitInfo->bMbSel4 != MCDRV_MBSEL_20) + && (psInitInfo->bMbSel4 != MCDRV_MBSEL_21) + && (psInitInfo->bMbSel4 != MCDRV_MBSEL_22) + && (psInitInfo->bMbSel4 != MCDRV_MBSEL_23)) + bRet = 0; + + if ((psInitInfo->bMbsDisch != MCDRV_MBSDISCH_0000) + && (psInitInfo->bMbsDisch != MCDRV_MBSDISCH_0001) + && (psInitInfo->bMbsDisch != MCDRV_MBSDISCH_0010) + && (psInitInfo->bMbsDisch != MCDRV_MBSDISCH_0011) + && (psInitInfo->bMbsDisch != MCDRV_MBSDISCH_0100) + && (psInitInfo->bMbsDisch != MCDRV_MBSDISCH_0101) + && (psInitInfo->bMbsDisch != MCDRV_MBSDISCH_0110) + && (psInitInfo->bMbsDisch != MCDRV_MBSDISCH_0111) + && (psInitInfo->bMbsDisch != MCDRV_MBSDISCH_1000) + && (psInitInfo->bMbsDisch != MCDRV_MBSDISCH_1001) + && (psInitInfo->bMbsDisch != MCDRV_MBSDISCH_1010) + && (psInitInfo->bMbsDisch != MCDRV_MBSDISCH_1011) + && (psInitInfo->bMbsDisch != MCDRV_MBSDISCH_1100) + && (psInitInfo->bMbsDisch != MCDRV_MBSDISCH_1101) + && (psInitInfo->bMbsDisch != MCDRV_MBSDISCH_1110) + && (psInitInfo->bMbsDisch != MCDRV_MBSDISCH_1111)) + bRet = 0; + + if ((psInitInfo->bNonClip != MCDRV_NONCLIP_OFF) + && (psInitInfo->bNonClip != MCDRV_NONCLIP_ON)) + bRet = 0; + + if ((psInitInfo->bLineIn1Dif != MCDRV_LINE_STEREO) + && (psInitInfo->bLineIn1Dif != MCDRV_LINE_DIF)) + bRet = 0; + + if ((psInitInfo->bLineOut1Dif != MCDRV_LINE_STEREO) + && (psInitInfo->bLineOut1Dif != MCDRV_LINE_DIF)) + bRet = 0; + + if ((psInitInfo->bLineOut2Dif != MCDRV_LINE_STEREO) + && (psInitInfo->bLineOut2Dif != MCDRV_LINE_DIF)) + bRet = 0; + + if ((psInitInfo->bMic1Sng != MCDRV_MIC_DIF) + && (psInitInfo->bMic1Sng != MCDRV_MIC_SINGLE)) + bRet = 0; + if ((psInitInfo->bMic2Sng != MCDRV_MIC_DIF) + && (psInitInfo->bMic2Sng != MCDRV_MIC_SINGLE)) + bRet = 0; + if ((psInitInfo->bMic3Sng != MCDRV_MIC_DIF) + && (psInitInfo->bMic3Sng != MCDRV_MIC_SINGLE)) + bRet = 0; + if ((psInitInfo->bMic4Sng != MCDRV_MIC_DIF) + && (psInitInfo->bMic4Sng != MCDRV_MIC_SINGLE)) + bRet = 0; + + if ((psInitInfo->bZcLineOut1 != MCDRV_ZC_ON) + && (psInitInfo->bZcLineOut1 != MCDRV_ZC_OFF)) + bRet = 0; + + if ((psInitInfo->bZcLineOut2 != MCDRV_ZC_ON) + && (psInitInfo->bZcLineOut2 != MCDRV_ZC_OFF)) + bRet = 0; + + if ((psInitInfo->bZcRc != MCDRV_ZC_ON) + && (psInitInfo->bZcRc != MCDRV_ZC_OFF)) + bRet = 0; + + if ((psInitInfo->bZcSp != MCDRV_ZC_ON) + && (psInitInfo->bZcSp != MCDRV_ZC_OFF)) + bRet = 0; + + if ((psInitInfo->bZcHp != MCDRV_ZC_ON) + && (psInitInfo->bZcHp != MCDRV_ZC_OFF)) + bRet = 0; + + if ((psInitInfo->bSvolLineOut1 != MCDRV_SVOL_OFF) + && (psInitInfo->bSvolLineOut1 != MCDRV_SVOL_ON)) + bRet = 0; + + if ((psInitInfo->bSvolLineOut2 != MCDRV_SVOL_OFF) + && (psInitInfo->bSvolLineOut2 != MCDRV_SVOL_ON)) + bRet = 0; + + if ((psInitInfo->bSvolRc != MCDRV_SVOL_OFF) + && (psInitInfo->bSvolRc != MCDRV_SVOL_ON)) + bRet = 0; + + if ((psInitInfo->bSvolSp != MCDRV_SVOL_OFF) + && (psInitInfo->bSvolSp != MCDRV_SVOL_ON)) + bRet = 0; + + if ((psInitInfo->bSvolHp != MCDRV_SVOL_OFF) + && (psInitInfo->bSvolHp != MCDRV_SVOL_ON)) + bRet = 0; + + if ((psInitInfo->bRcHiz != MCDRV_RCIMP_FIXLOW) + && (psInitInfo->bRcHiz != MCDRV_RCIMP_WL)) + bRet = 0; + + if ((psInitInfo->bSpHiz != MCDRV_WL_LOFF_ROFF) + && (psInitInfo->bSpHiz != MCDRV_WL_LON_ROFF) + && (psInitInfo->bSpHiz != MCDRV_WL_LOFF_RON) + && (psInitInfo->bSpHiz != MCDRV_WL_LON_RON)) + bRet = 0; + + if ((psInitInfo->bHpHiz != MCDRV_IMP_LFIXLOW_RFIXLOW) + && (psInitInfo->bHpHiz != MCDRV_IMP_LWL_RFIXLOW) + && (psInitInfo->bHpHiz != MCDRV_IMP_LFIXLOW_RWL) + && (psInitInfo->bHpHiz != MCDRV_IMP_LWL_RWL)) + bRet = 0; + + if ((psInitInfo->bLineOut1Hiz != MCDRV_IMP_LFIXLOW_RFIXLOW) + && (psInitInfo->bLineOut1Hiz != MCDRV_IMP_LWL_RFIXLOW) + && (psInitInfo->bLineOut1Hiz != MCDRV_IMP_LFIXLOW_RWL) + && (psInitInfo->bLineOut1Hiz != MCDRV_IMP_LWL_RWL)) + bRet = 0; + + if ((psInitInfo->bLineOut2Hiz != MCDRV_IMP_LFIXLOW_RFIXLOW) + && (psInitInfo->bLineOut2Hiz != MCDRV_IMP_LWL_RFIXLOW) + && (psInitInfo->bLineOut2Hiz != MCDRV_IMP_LFIXLOW_RWL) + && (psInitInfo->bLineOut2Hiz != MCDRV_IMP_LWL_RWL)) + bRet = 0; + + if ((psInitInfo->bCpMod != MCDRV_CPMOD_HI) + && (psInitInfo->bCpMod != MCDRV_CPMOD_MID)) + bRet = 0; + + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H) { + if ((psInitInfo->bRbSel != MCDRV_RBSEL_2_2K) + && (psInitInfo->bRbSel != MCDRV_RBSEL_50)) + bRet = 0; + } + + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H) { + if ((psInitInfo->bPlugSel != MCDRV_PLUG_LRGM) + && (psInitInfo->bPlugSel != MCDRV_PLUG_LRMG)) + bRet = 0; + } + + if ((psInitInfo->bGndDet != MCDRV_GNDDET_OFF) + && (psInitInfo->bGndDet != MCDRV_GNDDET_ON)) + bRet = 0; + + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H) { + if ((psInitInfo->bPpdRc != MCDRV_PPD_OFF) + && (psInitInfo->bPpdRc != MCDRV_PPD_ON)) + bRet = 0; + } + + if ((psInitInfo->bPpdSp != MCDRV_PPD_OFF) + && (psInitInfo->bPpdSp != MCDRV_PPD_ON)) + bRet = 0; + + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H) { + if ((psInitInfo->bPpdHp != MCDRV_PPD_OFF) + && (psInitInfo->bPpdHp != MCDRV_PPD_ON)) + bRet = 0; + + if ((psInitInfo->bPpdLineOut1 != MCDRV_PPD_OFF) + && (psInitInfo->bPpdLineOut1 != MCDRV_PPD_ON)) + bRet = 0; + + if ((psInitInfo->bPpdLineOut2 != MCDRV_PPD_OFF) + && (psInitInfo->bPpdLineOut2 != MCDRV_PPD_ON)) + bRet = 0; + } + + if ((psInitInfo->sWaitTime.dWaitTime[0] > MCDRV_MAX_WAIT_TIME) + || (psInitInfo->sWaitTime.dWaitTime[1] > MCDRV_MAX_WAIT_TIME) + || (psInitInfo->sWaitTime.dWaitTime[2] > MCDRV_MAX_WAIT_TIME) + || (psInitInfo->sWaitTime.dWaitTime[3] > MCDRV_MAX_WAIT_TIME) + || (psInitInfo->sWaitTime.dWaitTime[4] > MCDRV_MAX_WAIT_TIME)) + bRet = 0; + + if ((McDevProf_GetDevId() != eMCDRV_DEV_ID_80_90H) + && (psInit2Info != NULL)) { + if ((psInit2Info->bOption[0] != MCDRV_DOA_DRV_LOW) + && (psInit2Info->bOption[0] != MCDRV_DOA_DRV_HIGH)) { + bRet = 0; + goto exit; + } + if ((psInit2Info->bOption[1] != MCDRV_SCKMSK_OFF) + && (psInit2Info->bOption[1] != MCDRV_SCKMSK_ON)) { + bRet = 0; + goto exit; + } + if ((psInit2Info->bOption[2] != MCDRV_SPMN_8_9_10) + && (psInit2Info->bOption[2] != MCDRV_SPMN_5_6_7) + && (psInit2Info->bOption[2] != MCDRV_SPMN_4_5_6) + && (psInit2Info->bOption[2] != MCDRV_SPMN_OFF_9) + && (psInit2Info->bOption[2] != MCDRV_SPMN_OFF_6)) { + bRet = 0; + goto exit; + } + if (psInit2Info->bOption[3] > 0x0F) { + bRet = 0; + goto exit; + } + if (psInit2Info->bOption[4] > 0xF8) { + bRet = 0; + goto exit; + } + if (psInit2Info->bOption[5] > 0xF8) { + bRet = 0; + goto exit; + } + if (psInit2Info->bOption[6] > 0x31) { + bRet = 0; + goto exit; + } + if (psInit2Info->bOption[7] > 0x7F) { + bRet = 0; + goto exit; + } + if (psInit2Info->bOption[9] > 0x7F) { + bRet = 0; + goto exit; + } + if (psInit2Info->bOption[10] > 0x11) { + bRet = 0; + goto exit; + } + if (psInit2Info->bOption[11] > 0xF3) { + bRet = 0; + goto exit; + } + if (psInit2Info->bOption[12] > 0x07) { + bRet = 0; + goto exit; + } + } +exit: +#if (MCDRV_DEBUG_LEVEL >= 4) + sdRet = bRet; + McDebugLog_FuncOut("IsValidInitParam", &sdRet); +#endif + return bRet; +} + +/**************************************************************************** + * IsValidReadRegParam + * + * Description: + * check read reg parameter. + * Arguments: + * psRegInfo register information + * Return: + * 0:Invalid + * other:Valid + * + ****************************************************************************/ +static UINT8 IsValidReadRegParam +( + const struct MCDRV_REG_INFO *psRegInfo +) +{ + UINT8 bRet = 1; + +#if (MCDRV_DEBUG_LEVEL >= 4) + SINT32 sdRet; + McDebugLog_FuncIn("IsValidReadRegParam"); +#endif + + + if ((McResCtrl_GetRegAccess(psRegInfo) & eMCDRV_CAN_READ) == + eMCDRV_ACCESS_DENY) { + bRet = 0; + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + sdRet = bRet; + McDebugLog_FuncOut("IsValidReadRegParam", &sdRet); +#endif + return bRet; +} + +/**************************************************************************** + * IsValidWriteRegParam + * + * Description: + * check write reg parameter. + * Arguments: + * psRegInfo register information + * Return: + * 0:Invalid + * other:Valid + * + ****************************************************************************/ +static UINT8 IsValidWriteRegParam +( + const struct MCDRV_REG_INFO *psRegInfo +) +{ + UINT8 bRet = 1; + +#if (MCDRV_DEBUG_LEVEL >= 4) + SINT32 sdRet; + McDebugLog_FuncIn("IsValidWriteRegParam"); +#endif + + + if ((McResCtrl_GetRegAccess(psRegInfo) & eMCDRV_CAN_WRITE) == + eMCDRV_ACCESS_DENY) { + bRet = 0; + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + sdRet = bRet; + McDebugLog_FuncOut("IsValidWriteRegParam", &sdRet); +#endif + return bRet; +} + +/**************************************************************************** + * IsValidClockSwParam + * + * Description: + * check clock parameters. + * Arguments: + * psClockSwInfo clock switch information + * Return: + * 0:Invalid + * other:Valid + * + ****************************************************************************/ +static UINT8 IsValidClockSwParam +( + const struct MCDRV_CLOCKSW_INFO *psClockSwInfo +) +{ + UINT8 bRet = 1; + +#if (MCDRV_DEBUG_LEVEL >= 4) + SINT32 sdRet; + McDebugLog_FuncIn("IsValidClockSwParam"); +#endif + + + if ((MCDRV_CLKSW_CLKA != psClockSwInfo->bClkSrc) + && (MCDRV_CLKSW_CLKB != psClockSwInfo->bClkSrc)) { + bRet = 0; + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + sdRet = bRet; + McDebugLog_FuncOut("IsValidClockSwParam", &sdRet); +#endif + + return bRet; +} + +/**************************************************************************** + * MaskIrregularPath + * + * Description: + * mask irregular path parameters. + * Arguments: + * psPathInfo path information + * Return: + * none + * + ****************************************************************************/ +static void MaskIrregularPath +( + struct MCDRV_PATH_INFO *psPathInfo +) +{ + UINT8 bCh; +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("MaskIrregularPath"); +#endif + + for (bCh = 0; bCh < MUSICOUT_PATH_CHANNELS; bCh++) + psPathInfo->asMusicOut[bCh].dSrcOnOff &= + ~MCDRV_D1SRC_HIFIIN_ON; + + for (bCh = 0; bCh < EXTOUT_PATH_CHANNELS; bCh++) + psPathInfo->asExtOut[bCh].dSrcOnOff &= + ~MCDRV_D1SRC_HIFIIN_ON; + + for (bCh = 0; bCh < HIFIOUT_PATH_CHANNELS; bCh++) + psPathInfo->asHifiOut[bCh].dSrcOnOff &= + (MCDRV_D1SRC_ADIF0_ON + |MCDRV_D1SRC_ADIF0_OFF); + + for (bCh = 0; bCh < VBOXMIXIN_PATH_CHANNELS; bCh++) + psPathInfo->asVboxMixIn[bCh].dSrcOnOff &= + ~MCDRV_D1SRC_HIFIIN_ON; + + for (bCh = 0; bCh < AE_PATH_CHANNELS; bCh++) { + psPathInfo->asAe0[bCh].dSrcOnOff &= + ~MCDRV_D1SRC_HIFIIN_ON; + psPathInfo->asAe1[bCh].dSrcOnOff &= + ~MCDRV_D1SRC_HIFIIN_ON; + psPathInfo->asAe2[bCh].dSrcOnOff &= + ~MCDRV_D1SRC_HIFIIN_ON; + psPathInfo->asAe3[bCh].dSrcOnOff &= + ~MCDRV_D1SRC_HIFIIN_ON; + } + + for (bCh = 0; bCh < VOICEOUT_PATH_CHANNELS; bCh++) + psPathInfo->asVoiceOut[bCh].dSrcOnOff &= + (MCDRV_D2SRC_VBOXIOOUT_ON|MCDRV_D2SRC_VBOXIOOUT_OFF); + + for (bCh = 0; bCh < VBOXIOIN_PATH_CHANNELS; bCh++) + psPathInfo->asVboxIoIn[bCh].dSrcOnOff &= + (MCDRV_D2SRC_VOICEIN_ON|MCDRV_D2SRC_VOICEIN_OFF); + + for (bCh = 0; bCh < VBOXHOSTIN_PATH_CHANNELS; bCh++) + psPathInfo->asVboxHostIn[bCh].dSrcOnOff &= + (MCDRV_D2SRC_VOICEIN_ON|MCDRV_D2SRC_VOICEIN_OFF); + + for (bCh = 0; bCh < HOSTOUT_PATH_CHANNELS; bCh++) + psPathInfo->asHostOut[bCh].dSrcOnOff &= + (MCDRV_D2SRC_VBOXHOSTOUT_ON + |MCDRV_D2SRC_VBOXHOSTOUT_OFF); + + for (bCh = 0; bCh < ADIF0_PATH_CHANNELS; bCh++) + psPathInfo->asAdif0[bCh].dSrcOnOff &= + (MCDRV_D2SRC_ADC0_L_ON + |MCDRV_D2SRC_ADC0_L_OFF + |MCDRV_D2SRC_ADC0_R_ON + |MCDRV_D2SRC_ADC0_R_OFF + |MCDRV_D2SRC_ADC1_ON + |MCDRV_D2SRC_ADC1_OFF + |MCDRV_D2SRC_PDM0_L_ON + |MCDRV_D2SRC_PDM0_L_OFF + |MCDRV_D2SRC_PDM0_R_ON + |MCDRV_D2SRC_PDM0_R_OFF + |MCDRV_D2SRC_PDM1_L_ON + |MCDRV_D2SRC_PDM1_L_OFF + |MCDRV_D2SRC_PDM1_R_ON + |MCDRV_D2SRC_PDM1_R_OFF); + + for (bCh = 0; bCh < ADIF1_PATH_CHANNELS; bCh++) + psPathInfo->asAdif1[bCh].dSrcOnOff &= + (MCDRV_D2SRC_ADC0_L_ON + |MCDRV_D2SRC_ADC0_L_OFF + |MCDRV_D2SRC_ADC0_R_ON + |MCDRV_D2SRC_ADC0_R_OFF + |MCDRV_D2SRC_ADC1_ON + |MCDRV_D2SRC_ADC1_OFF + |MCDRV_D2SRC_PDM0_L_ON + |MCDRV_D2SRC_PDM0_L_OFF + |MCDRV_D2SRC_PDM0_R_ON + |MCDRV_D2SRC_PDM0_R_OFF + |MCDRV_D2SRC_PDM1_L_ON + |MCDRV_D2SRC_PDM1_L_OFF + |MCDRV_D2SRC_PDM1_R_ON + |MCDRV_D2SRC_PDM1_R_OFF); + + for (bCh = 0; bCh < ADIF2_PATH_CHANNELS; bCh++) + psPathInfo->asAdif2[bCh].dSrcOnOff &= + (MCDRV_D2SRC_ADC0_L_ON + |MCDRV_D2SRC_ADC0_L_OFF + |MCDRV_D2SRC_ADC0_R_ON + |MCDRV_D2SRC_ADC0_R_OFF + |MCDRV_D2SRC_ADC1_ON + |MCDRV_D2SRC_ADC1_OFF + |MCDRV_D2SRC_PDM0_L_ON + |MCDRV_D2SRC_PDM0_L_OFF + |MCDRV_D2SRC_PDM0_R_ON + |MCDRV_D2SRC_PDM0_R_OFF + |MCDRV_D2SRC_PDM1_L_ON + |MCDRV_D2SRC_PDM1_L_OFF + |MCDRV_D2SRC_PDM1_R_ON + |MCDRV_D2SRC_PDM1_R_OFF + |MCDRV_D2SRC_DAC0REF_ON + |MCDRV_D2SRC_DAC0REF_OFF + |MCDRV_D2SRC_DAC1REF_ON + |MCDRV_D2SRC_DAC1REF_OFF); + + psPathInfo->asAdc0[0].dSrcOnOff &= + ~(MCDRV_ASRC_DAC0_L_ON|MCDRV_ASRC_DAC0_R_ON + |MCDRV_ASRC_DAC1_L_ON|MCDRV_ASRC_DAC1_R_ON + |MCDRV_ASRC_LINEIN1_R_ON); + psPathInfo->asAdc0[1].dSrcOnOff &= + ~(MCDRV_ASRC_DAC0_L_ON|MCDRV_ASRC_DAC0_R_ON + |MCDRV_ASRC_DAC1_L_ON|MCDRV_ASRC_DAC1_R_ON + |MCDRV_ASRC_LINEIN1_L_ON); + + for (bCh = 0; bCh < ADC1_PATH_CHANNELS; bCh++) + psPathInfo->asAdc1[bCh].dSrcOnOff &= + ~(MCDRV_ASRC_DAC0_L_ON|MCDRV_ASRC_DAC0_R_ON + |MCDRV_ASRC_DAC1_L_ON|MCDRV_ASRC_DAC1_R_ON + |MCDRV_ASRC_LINEIN1_L_ON|MCDRV_ASRC_LINEIN1_R_ON); + + psPathInfo->asSp[0].dSrcOnOff &= + (MCDRV_ASRC_DAC1_L_ON + |MCDRV_ASRC_DAC1_L_OFF); + psPathInfo->asSp[1].dSrcOnOff &= + (MCDRV_ASRC_DAC1_R_ON + |MCDRV_ASRC_DAC1_R_OFF); + + psPathInfo->asHp[0].dSrcOnOff &= + (MCDRV_ASRC_DAC0_L_ON + |MCDRV_ASRC_DAC0_L_OFF); + psPathInfo->asHp[1].dSrcOnOff &= + (MCDRV_ASRC_DAC0_R_ON + |MCDRV_ASRC_DAC0_R_OFF); + + psPathInfo->asRc[0].dSrcOnOff &= + (MCDRV_ASRC_DAC0_L_ON + |MCDRV_ASRC_DAC0_L_OFF); + + psPathInfo->asLout1[0].dSrcOnOff &= + (MCDRV_ASRC_DAC0_L_ON + |MCDRV_ASRC_DAC0_L_OFF); + psPathInfo->asLout1[1].dSrcOnOff &= + (MCDRV_ASRC_DAC0_R_ON + |MCDRV_ASRC_DAC0_R_OFF); + + psPathInfo->asLout2[0].dSrcOnOff &= + (MCDRV_ASRC_DAC1_L_ON + |MCDRV_ASRC_DAC1_L_OFF); + psPathInfo->asLout2[1].dSrcOnOff &= + (MCDRV_ASRC_DAC1_R_ON + |MCDRV_ASRC_DAC1_R_OFF); + + psPathInfo->asBias[0].dSrcOnOff &= + (MCDRV_ASRC_MIC1_ON + |MCDRV_ASRC_MIC1_OFF); + psPathInfo->asBias[1].dSrcOnOff &= + (MCDRV_ASRC_MIC2_ON + |MCDRV_ASRC_MIC2_OFF); + psPathInfo->asBias[2].dSrcOnOff &= + (MCDRV_ASRC_MIC3_ON + |MCDRV_ASRC_MIC3_OFF); + psPathInfo->asBias[3].dSrcOnOff &= + (MCDRV_ASRC_MIC4_ON + |MCDRV_ASRC_MIC4_OFF); + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("MaskIrregularPath", NULL); +#endif +} + +/**************************************************************************** + * IsValidDioParam + * + * Description: + * validate digital IO parameters. + * Arguments: + * psDioInfo digital IO information + * dUpdateInfo update information + * Return: + * 0:Invalid + * other:Valid + * + ****************************************************************************/ +static UINT8 IsValidDioParam +( + const struct MCDRV_DIO_INFO *psDioInfo, + UINT32 dUpdateInfo +) +{ + UINT8 bRet = 1; + struct MCDRV_DIO_INFO sDioInfo; + UINT8 bRegVal; + UINT8 bLPR0_start = 0, + bLPT0_start = 0, + bLPR1_start = 0, + bLPT1_start = 0, + bLPR2_start = 0, + bLPT2_start = 0, + bLPR3_start = 0, + bLPT3_start = 0; + +#if (MCDRV_DEBUG_LEVEL >= 4) + SINT32 sdRet = MCDRV_SUCCESS; + McDebugLog_FuncIn("IsValidDioParam"); +#endif + + + McResCtrl_GetDioInfo(&sDioInfo); + + bRegVal = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_MB, MCI_LP0_START); + if ((bRegVal & MCB_LPR0_START) != 0) { + ; + bLPR0_start = 1; + } + if ((bRegVal & MCB_LPT0_START) != 0) { + ; + bLPT0_start = 1; + } + bRegVal = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_MB, MCI_LP1_START); + if ((bRegVal & MCB_LPR1_START) != 0) { + ; + bLPR1_start = 1; + } + if ((bRegVal & MCB_LPT1_START) != 0) { + ; + bLPT1_start = 1; + } + bRegVal = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_MB, MCI_LP2_START); + if ((bRegVal & MCB_LPR2_START) != 0) { + ; + bLPR2_start = 1; + } + if ((bRegVal & MCB_LPT2_START) != 0) { + ; + bLPT2_start = 1; + } + bRegVal = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_MB, MCI_LP3_START); + if ((bRegVal & MCB_LPR3_START) != 0) { + ; + bLPR3_start = 1; + } + if ((bRegVal & MCB_LPT3_START) != 0) { + ; + bLPT3_start = 1; + } + + if (((dUpdateInfo & MCDRV_MUSIC_COM_UPDATE_FLAG) != 0UL) + || ((dUpdateInfo & MCDRV_MUSIC_DIR_UPDATE_FLAG) != 0UL)) { + if (bLPR0_start != 0) { + ; + bRet = 0; + } + } + if (((dUpdateInfo & MCDRV_MUSIC_COM_UPDATE_FLAG) != 0UL) + || ((dUpdateInfo & MCDRV_MUSIC_DIT_UPDATE_FLAG) != 0UL)) { + if (bLPT0_start != 0) { + ; + bRet = 0; + } + } + if (((dUpdateInfo & MCDRV_EXT_COM_UPDATE_FLAG) != 0UL) + || ((dUpdateInfo & MCDRV_EXT_DIR_UPDATE_FLAG) != 0UL)) { + if (bLPR1_start != 0) { + ; + bRet = 0; + } + } + if (((dUpdateInfo & MCDRV_EXT_COM_UPDATE_FLAG) != 0UL) + || ((dUpdateInfo & MCDRV_EXT_DIT_UPDATE_FLAG) != 0UL)) { + if (bLPT1_start != 0) { + ; + bRet = 0; + } + } + if (((dUpdateInfo & MCDRV_VOICE_COM_UPDATE_FLAG) != 0UL) + || ((dUpdateInfo & MCDRV_VOICE_DIR_UPDATE_FLAG) != 0UL)) { + if (bLPR2_start != 0) { + ; + bRet = 0; + } + } + if (((dUpdateInfo & MCDRV_VOICE_COM_UPDATE_FLAG) != 0UL) + || ((dUpdateInfo & MCDRV_VOICE_DIT_UPDATE_FLAG) != 0UL)) { + if (bLPT2_start != 0) { + ; + bRet = 0; + } + } + if (((dUpdateInfo & MCDRV_HIFI_COM_UPDATE_FLAG) != 0UL) + || ((dUpdateInfo & MCDRV_HIFI_DIR_UPDATE_FLAG) != 0UL)) { + if (bLPR3_start != 0) { + ; + bRet = 0; + } + } + if (((dUpdateInfo & MCDRV_HIFI_COM_UPDATE_FLAG) != 0UL) + || ((dUpdateInfo & MCDRV_HIFI_DIT_UPDATE_FLAG) != 0UL)) { + if (bLPT3_start != 0) { + ; + bRet = 0; + } + } + + + if ((bRet != 0) + && ((dUpdateInfo & MCDRV_MUSIC_COM_UPDATE_FLAG) != 0UL)) { + bRet = CheckDIOCommon(psDioInfo, 0); + if (bRet != 0) { + ; + sDioInfo.asPortInfo[0].sDioCommon.bInterface = + psDioInfo->asPortInfo[0].sDioCommon.bInterface; + } + } + if ((bRet != 0) + && ((dUpdateInfo & MCDRV_EXT_COM_UPDATE_FLAG) != 0UL)) { + bRet = CheckDIOCommon(psDioInfo, 1); + if (bRet != 0) { + ; + sDioInfo.asPortInfo[1].sDioCommon.bInterface = + psDioInfo->asPortInfo[1].sDioCommon.bInterface; + } + } + if ((bRet != 0) + && ((dUpdateInfo & MCDRV_VOICE_COM_UPDATE_FLAG) != 0UL)) { + bRet = CheckDIOCommon(psDioInfo, 2); + if (bRet != 0) { + ; + sDioInfo.asPortInfo[2].sDioCommon.bInterface = + psDioInfo->asPortInfo[2].sDioCommon.bInterface; + } + } + if ((bRet != 0) + && ((dUpdateInfo & MCDRV_HIFI_COM_UPDATE_FLAG) != 0UL)) { + bRet = CheckDIOCommon(psDioInfo, 3); + if (bRet != 0) { + ; + sDioInfo.asPortInfo[3].sDioCommon.bInterface = + psDioInfo->asPortInfo[3].sDioCommon.bInterface; + } + } + + if ((bRet != 0) + && ((dUpdateInfo & MCDRV_MUSIC_DIR_UPDATE_FLAG) != 0UL)) { + ; + bRet = CheckDIODIR(psDioInfo, 0); + } + if ((bRet != 0) + && ((dUpdateInfo & MCDRV_EXT_DIR_UPDATE_FLAG) != 0UL)) { + ; + bRet = CheckDIODIR(psDioInfo, 1); + } + if ((bRet != 0) + && ((dUpdateInfo & MCDRV_VOICE_DIR_UPDATE_FLAG) != 0UL)) { + ; + bRet = CheckDIODIR(psDioInfo, 2); + } + + if ((bRet != 0) + && ((dUpdateInfo & MCDRV_MUSIC_DIT_UPDATE_FLAG) != 0UL)) { + ; + bRet = CheckDIODIT(psDioInfo, 0); + } + if ((bRet != 0) + && ((dUpdateInfo & MCDRV_EXT_DIT_UPDATE_FLAG) != 0UL)) { + ; + bRet = CheckDIODIT(psDioInfo, 1); + } + if ((bRet != 0) + && ((dUpdateInfo & MCDRV_VOICE_DIT_UPDATE_FLAG) != 0UL)) { + ; + bRet = CheckDIODIT(psDioInfo, 2); + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + sdRet = bRet; + McDebugLog_FuncOut("IsValidDioParam", &sdRet); +#endif + return bRet; +} + +/**************************************************************************** + * IsValidDioPathParam + * + * Description: + * validate digital IO path parameters. + * Arguments: + * psDioPathInfo digital IO path information + * dUpdateInfo update information + * Return: + * 0:Invalid + * other:Valid + * + ****************************************************************************/ +static UINT8 IsValidDioPathParam +( + const struct MCDRV_DIOPATH_INFO *psDioPathInfo, + UINT32 dUpdateInfo +) +{ + UINT8 bRet = 1; + UINT8 bRegVal; + struct MCDRV_DIOPATH_INFO sDioPathInfo; + UINT8 bLP0_start = 0, + bLP1_start = 0, + bLP2_start = 0, + bLP3_start = 0; + +#if (MCDRV_DEBUG_LEVEL >= 4) + SINT32 sdRet = MCDRV_SUCCESS; + McDebugLog_FuncIn("IsValidDioPathParam"); +#endif + + + bRegVal = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_MB, MCI_LP0_START); + if ((bRegVal & MCB_LPR0_START) != 0) + bLP0_start = 1; + else if ((bRegVal & MCB_LPT0_START) != 0) + bLP0_start = 1; + + bRegVal = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_MB, MCI_LP1_START); + if ((bRegVal & MCB_LPR1_START) != 0) + bLP1_start = 1; + else if ((bRegVal & MCB_LPT1_START) != 0) + bLP1_start = 1; + + if ((McResCtrl_HasSrc(eMCDRV_DST_VOICEOUT, eMCDRV_DST_CH0) != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_VBOXIOIN, eMCDRV_DST_CH0) != 0)) + bLP2_start = 1; + + bRegVal = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_MB, MCI_LP3_START); + if ((bRegVal & MCB_LPR3_START) != 0) + bLP3_start = 1; + else if ((bRegVal & MCB_LPT3_START) != 0) + bLP3_start = 1; + + McResCtrl_GetDioPathInfo(&sDioPathInfo); + + if ((dUpdateInfo & MCDRV_MUSICNUM_UPDATE_FLAG) != 0UL) { + if ((psDioPathInfo->bMusicCh != MCDRV_MUSIC_2CH) + && (psDioPathInfo->bMusicCh != MCDRV_MUSIC_4CH) + && (psDioPathInfo->bMusicCh != MCDRV_MUSIC_6CH)) { + bRet = 0; + goto exit; + } else if (psDioPathInfo->bMusicCh != sDioPathInfo.bMusicCh) { + if ((psDioPathInfo->bMusicCh == MCDRV_MUSIC_6CH) + || (sDioPathInfo.bMusicCh == MCDRV_MUSIC_6CH)) { + if (bLP2_start != 0) { + bRet = 0; + goto exit; + } + } else { + if (bLP0_start != 0) { + bRet = 0; + goto exit; + } +#if 0 + if (bLP1_start != 0) { + bRet = 0; + goto exit; + } +#endif + } + } + } + if ((dUpdateInfo & MCDRV_PHYS0_UPDATE_FLAG) != 0UL) { + if ((psDioPathInfo->abPhysPort[0] != MCDRV_PHYSPORT_DIO0) + && (psDioPathInfo->abPhysPort[0] != MCDRV_PHYSPORT_DIO1) + && (psDioPathInfo->abPhysPort[0] != MCDRV_PHYSPORT_DIO2) + && (psDioPathInfo->abPhysPort[0] != MCDRV_PHYSPORT_NONE) + && (psDioPathInfo->abPhysPort[0] != MCDRV_PHYSPORT_SLIM0) + && (psDioPathInfo->abPhysPort[0] != MCDRV_PHYSPORT_SLIM1) + && (psDioPathInfo->abPhysPort[0] != MCDRV_PHYSPORT_SLIM2)) { + bRet = 0; + goto exit; + } else if (psDioPathInfo->abPhysPort[0] != + sDioPathInfo.abPhysPort[0]) { + if (bLP0_start != 0) { + bRet = 0; + goto exit; + } + } + } + if ((dUpdateInfo & MCDRV_PHYS1_UPDATE_FLAG) != 0UL) { + if ((psDioPathInfo->abPhysPort[1] != MCDRV_PHYSPORT_DIO0) + && (psDioPathInfo->abPhysPort[1] != MCDRV_PHYSPORT_DIO1) + && (psDioPathInfo->abPhysPort[1] != MCDRV_PHYSPORT_DIO2) + && (psDioPathInfo->abPhysPort[1] != MCDRV_PHYSPORT_NONE) + && (psDioPathInfo->abPhysPort[1] != MCDRV_PHYSPORT_SLIM0) + && (psDioPathInfo->abPhysPort[1] != MCDRV_PHYSPORT_SLIM1) + && (psDioPathInfo->abPhysPort[1] != MCDRV_PHYSPORT_SLIM2)) { + bRet = 0; + goto exit; + } else if (psDioPathInfo->abPhysPort[1] != + sDioPathInfo.abPhysPort[1]) { + if (bLP1_start != 0) { + bRet = 0; + goto exit; + } + } + } + if ((dUpdateInfo & MCDRV_PHYS2_UPDATE_FLAG) != 0UL) { + if ((psDioPathInfo->abPhysPort[2] != MCDRV_PHYSPORT_DIO0) + && (psDioPathInfo->abPhysPort[2] != MCDRV_PHYSPORT_DIO1) + && (psDioPathInfo->abPhysPort[2] != MCDRV_PHYSPORT_DIO2) + && (psDioPathInfo->abPhysPort[2] != MCDRV_PHYSPORT_NONE) + && (psDioPathInfo->abPhysPort[2] != MCDRV_PHYSPORT_SLIM0) + && (psDioPathInfo->abPhysPort[2] != MCDRV_PHYSPORT_SLIM1) + && (psDioPathInfo->abPhysPort[2] != MCDRV_PHYSPORT_SLIM2)) { + bRet = 0; + goto exit; + } else if (psDioPathInfo->abPhysPort[2] != + sDioPathInfo.abPhysPort[2]) { + if (bLP2_start != 0) { + bRet = 0; + goto exit; + } + } + } + + if ((dUpdateInfo & MCDRV_PHYS3_UPDATE_FLAG) != 0UL) { + if ((psDioPathInfo->abPhysPort[3] != MCDRV_PHYSPORT_DIO0) + && (psDioPathInfo->abPhysPort[3] != MCDRV_PHYSPORT_DIO1) + && (psDioPathInfo->abPhysPort[3] != MCDRV_PHYSPORT_DIO2) + && (psDioPathInfo->abPhysPort[3] != MCDRV_PHYSPORT_NONE) + && (psDioPathInfo->abPhysPort[3] != MCDRV_PHYSPORT_SLIM0) + && (psDioPathInfo->abPhysPort[3] != MCDRV_PHYSPORT_SLIM1) + && (psDioPathInfo->abPhysPort[3] != MCDRV_PHYSPORT_SLIM2)) { + bRet = 0; + goto exit; + } else if (psDioPathInfo->abPhysPort[3] != + sDioPathInfo.abPhysPort[3]) { + if (bLP3_start != 0) { + bRet = 0; + goto exit; + } + } + } + if ((dUpdateInfo & MCDRV_DIR0SLOT_UPDATE_FLAG) != 0UL) { + if ((psDioPathInfo->abMusicRSlot[0] != 0) + && (psDioPathInfo->abMusicRSlot[0] != 1) + && (psDioPathInfo->abMusicRSlot[0] != 2) + && (psDioPathInfo->abMusicRSlot[0] != 3)) { + bRet = 0; + goto exit; + } else if (psDioPathInfo->abMusicRSlot[0] != + sDioPathInfo.abMusicRSlot[0]) { + if (bLP0_start != 0) { + bRet = 0; + goto exit; + } + } + } + if ((dUpdateInfo & MCDRV_DIR1SLOT_UPDATE_FLAG) != 0UL) { + if ((psDioPathInfo->abMusicRSlot[1] != 0) + && (psDioPathInfo->abMusicRSlot[1] != 1) + && (psDioPathInfo->abMusicRSlot[1] != 2) + && (psDioPathInfo->abMusicRSlot[1] != 3)) { + bRet = 0; + } else if (psDioPathInfo->abMusicRSlot[1] != + sDioPathInfo.abMusicRSlot[1]) { + if (bLP0_start != 0) { + bRet = 0; + goto exit; + } + /*if (bLP1_start != 0) { + bRet = 0; + }*/ + } + } + if ((dUpdateInfo & MCDRV_DIR2SLOT_UPDATE_FLAG) != 0UL) { + if ((psDioPathInfo->abMusicRSlot[2] != 0) + && (psDioPathInfo->abMusicRSlot[2] != 1) + && (psDioPathInfo->abMusicRSlot[2] != 2) + && (psDioPathInfo->abMusicRSlot[2] != 3)) { + bRet = 0; + } else if (psDioPathInfo->abMusicRSlot[2] != + sDioPathInfo.abMusicRSlot[2]) { + if (bLP0_start != 0) { + bRet = 0; + goto exit; + } + /*if (bLP2_start != 0) { + bRet = 0; + }*/ + } + } + + if ((dUpdateInfo & MCDRV_DIT0SLOT_UPDATE_FLAG) != 0UL) { + if ((psDioPathInfo->abMusicTSlot[0] != 0) + && (psDioPathInfo->abMusicTSlot[0] != 1) + && (psDioPathInfo->abMusicTSlot[0] != 2) + && (psDioPathInfo->abMusicTSlot[0] != 3)) { + bRet = 0; + } else if (psDioPathInfo->abMusicTSlot[0] != + sDioPathInfo.abMusicTSlot[0]) { + if (bLP0_start != 0) { + bRet = 0; + goto exit; + } + /*if (bLP0_start != 0) { + bRet = 0; + }*/ + } + } + if ((dUpdateInfo & MCDRV_DIT1SLOT_UPDATE_FLAG) != 0UL) { + if ((psDioPathInfo->abMusicTSlot[1] != 0) + && (psDioPathInfo->abMusicTSlot[1] != 1) + && (psDioPathInfo->abMusicTSlot[1] != 2) + && (psDioPathInfo->abMusicTSlot[1] != 3)) { + bRet = 0; + } else if (psDioPathInfo->abMusicTSlot[1] != + sDioPathInfo.abMusicTSlot[1]) { + if (bLP0_start != 0) { + bRet = 0; + goto exit; + } + /*if (bLP1_start != 0) { + bRet = 0; + }*/ + } + } + if ((dUpdateInfo & MCDRV_DIT2SLOT_UPDATE_FLAG) != 0UL) { + if ((psDioPathInfo->abMusicTSlot[2] != 0) + && (psDioPathInfo->abMusicTSlot[2] != 1) + && (psDioPathInfo->abMusicTSlot[2] != 2) + && (psDioPathInfo->abMusicTSlot[2] != 3)) { + bRet = 0; + } else if (psDioPathInfo->abMusicTSlot[2] != + sDioPathInfo.abMusicTSlot[2]) { + if (bLP0_start != 0) { + bRet = 0; + goto exit; + } + /*if (bLP2_start != 0) { + bRet = 0; + }*/ + } + } + +exit: +#if (MCDRV_DEBUG_LEVEL >= 4) + sdRet = bRet; + McDebugLog_FuncOut("IsValidDioPathParam", &sdRet); +#endif + return bRet; +} + +/**************************************************************************** + * IsValidSwapParam + * + * Description: + * check Swap parameters. + * Arguments: + * psSwapInfo Swap information + * dUpdateInfo update information + * Return: + * 0:Invalid + * other:Valid + * + ****************************************************************************/ +static UINT8 IsValidSwapParam +( + const struct MCDRV_SWAP_INFO *psSwapInfo, + UINT32 dUpdateInfo +) +{ + UINT8 bRet = 1; + +#if (MCDRV_DEBUG_LEVEL >= 4) + SINT32 sdRet; + McDebugLog_FuncIn("IsValidSwapParam"); +#endif + + + if ((dUpdateInfo & MCDRV_SWAP_ADIF0_UPDATE_FLAG) != 0UL) { + if ((psSwapInfo->bAdif0 != MCDRV_SWAP_NORMAL) + && (psSwapInfo->bAdif0 != MCDRV_SWAP_SWAP) + && (psSwapInfo->bAdif0 != MCDRV_SWAP_MUTE) + && (psSwapInfo->bAdif0 != MCDRV_SWAP_CENTER) + && (psSwapInfo->bAdif0 != MCDRV_SWAP_MIX) + && (psSwapInfo->bAdif0 != MCDRV_SWAP_MONOMIX) + && (psSwapInfo->bAdif0 != MCDRV_SWAP_BOTHL) + && (psSwapInfo->bAdif0 != MCDRV_SWAP_BOTHR)) + bRet = 0; + } + if ((dUpdateInfo & MCDRV_SWAP_ADIF1_UPDATE_FLAG) != 0UL) { + if ((psSwapInfo->bAdif1 != MCDRV_SWAP_NORMAL) + && (psSwapInfo->bAdif1 != MCDRV_SWAP_SWAP) + && (psSwapInfo->bAdif1 != MCDRV_SWAP_MUTE) + && (psSwapInfo->bAdif1 != MCDRV_SWAP_CENTER) + && (psSwapInfo->bAdif1 != MCDRV_SWAP_MIX) + && (psSwapInfo->bAdif1 != MCDRV_SWAP_MONOMIX) + && (psSwapInfo->bAdif1 != MCDRV_SWAP_BOTHL) + && (psSwapInfo->bAdif1 != MCDRV_SWAP_BOTHR)) + bRet = 0; + } + if ((dUpdateInfo & MCDRV_SWAP_ADIF2_UPDATE_FLAG) != 0UL) { + if ((psSwapInfo->bAdif2 != MCDRV_SWAP_NORMAL) + && (psSwapInfo->bAdif2 != MCDRV_SWAP_SWAP) + && (psSwapInfo->bAdif2 != MCDRV_SWAP_MUTE) + && (psSwapInfo->bAdif2 != MCDRV_SWAP_CENTER) + && (psSwapInfo->bAdif2 != MCDRV_SWAP_MIX) + && (psSwapInfo->bAdif2 != MCDRV_SWAP_MONOMIX) + && (psSwapInfo->bAdif2 != MCDRV_SWAP_BOTHL) + && (psSwapInfo->bAdif2 != MCDRV_SWAP_BOTHR)) + bRet = 0; + } + if ((dUpdateInfo & MCDRV_SWAP_DAC0_UPDATE_FLAG) != 0UL) { + if ((psSwapInfo->bDac0 != MCDRV_SWAP_NORMAL) + && (psSwapInfo->bDac0 != MCDRV_SWAP_SWAP) + && (psSwapInfo->bDac0 != MCDRV_SWAP_MUTE) + && (psSwapInfo->bDac0 != MCDRV_SWAP_CENTER) + && (psSwapInfo->bDac0 != MCDRV_SWAP_MIX) + && (psSwapInfo->bDac0 != MCDRV_SWAP_MONOMIX) + && (psSwapInfo->bDac0 != MCDRV_SWAP_BOTHL) + && (psSwapInfo->bDac0 != MCDRV_SWAP_BOTHR)) + bRet = 0; + } + if ((dUpdateInfo & MCDRV_SWAP_DAC1_UPDATE_FLAG) != 0UL) { + if ((psSwapInfo->bDac1 != MCDRV_SWAP_NORMAL) + && (psSwapInfo->bDac1 != MCDRV_SWAP_SWAP) + && (psSwapInfo->bDac1 != MCDRV_SWAP_MUTE) + && (psSwapInfo->bDac1 != MCDRV_SWAP_CENTER) + && (psSwapInfo->bDac1 != MCDRV_SWAP_MIX) + && (psSwapInfo->bDac1 != MCDRV_SWAP_MONOMIX) + && (psSwapInfo->bDac1 != MCDRV_SWAP_BOTHL) + && (psSwapInfo->bDac1 != MCDRV_SWAP_BOTHR)) + bRet = 0; + } + + if ((dUpdateInfo & MCDRV_SWAP_MUSICIN0_UPDATE_FLAG) != 0UL) { + if ((psSwapInfo->bMusicIn0 != MCDRV_SWSWAP_NORMAL) + && (psSwapInfo->bMusicIn0 != MCDRV_SWSWAP_BOTH1) + && (psSwapInfo->bMusicIn0 != MCDRV_SWSWAP_BOTH0) + && (psSwapInfo->bMusicIn0 != MCDRV_SWSWAP_SWAP)) + bRet = 0; + } + if ((dUpdateInfo & MCDRV_SWAP_MUSICIN1_UPDATE_FLAG) != 0UL) { + if ((psSwapInfo->bMusicIn1 != MCDRV_SWSWAP_NORMAL) + && (psSwapInfo->bMusicIn1 != MCDRV_SWSWAP_BOTH1) + && (psSwapInfo->bMusicIn1 != MCDRV_SWSWAP_BOTH0) + && (psSwapInfo->bMusicIn1 != MCDRV_SWSWAP_SWAP)) + bRet = 0; + } + if ((dUpdateInfo & MCDRV_SWAP_MUSICIN2_UPDATE_FLAG) != 0UL) { + if ((psSwapInfo->bMusicIn2 != MCDRV_SWSWAP_NORMAL) + && (psSwapInfo->bMusicIn2 != MCDRV_SWSWAP_BOTH1) + && (psSwapInfo->bMusicIn2 != MCDRV_SWSWAP_BOTH0) + && (psSwapInfo->bMusicIn2 != MCDRV_SWSWAP_SWAP)) + bRet = 0; + } + if ((dUpdateInfo & MCDRV_SWAP_EXTIN_UPDATE_FLAG) != 0UL) { + if ((psSwapInfo->bExtIn != MCDRV_SWSWAP_NORMAL) + && (psSwapInfo->bExtIn != MCDRV_SWSWAP_BOTH1) + && (psSwapInfo->bExtIn != MCDRV_SWSWAP_BOTH0) + && (psSwapInfo->bExtIn != MCDRV_SWSWAP_SWAP)) + bRet = 0; + } + if ((dUpdateInfo & MCDRV_SWAP_VOICEIN_UPDATE_FLAG) != 0UL) { + if ((psSwapInfo->bVoiceIn != MCDRV_SWSWAP_NORMAL) + && (psSwapInfo->bVoiceIn != MCDRV_SWSWAP_BOTH1) + && (psSwapInfo->bVoiceIn != MCDRV_SWSWAP_BOTH0) + && (psSwapInfo->bVoiceIn != MCDRV_SWSWAP_SWAP)) + bRet = 0; + } + if ((dUpdateInfo & MCDRV_SWAP_HIFIIN_UPDATE_FLAG) != 0UL) { + if ((psSwapInfo->bHifiIn != MCDRV_SWSWAP_NORMAL) + && (psSwapInfo->bHifiIn != MCDRV_SWSWAP_BOTH1) + && (psSwapInfo->bHifiIn != MCDRV_SWSWAP_BOTH0) + && (psSwapInfo->bHifiIn != MCDRV_SWSWAP_SWAP)) + bRet = 0; + } + if ((dUpdateInfo & MCDRV_SWAP_MUSICOUT0_UPDATE_FLAG) != 0UL) { + if ((psSwapInfo->bMusicOut0 != MCDRV_SWAP_NORMAL) + && (psSwapInfo->bMusicOut0 != MCDRV_SWAP_SWAP) + && (psSwapInfo->bMusicOut0 != MCDRV_SWAP_MUTE) + && (psSwapInfo->bMusicOut0 != MCDRV_SWAP_CENTER) + && (psSwapInfo->bMusicOut0 != MCDRV_SWAP_MIX) + && (psSwapInfo->bMusicOut0 != MCDRV_SWAP_MONOMIX) + && (psSwapInfo->bMusicOut0 != MCDRV_SWAP_BOTHL) + && (psSwapInfo->bMusicOut0 != MCDRV_SWAP_BOTHR)) + bRet = 0; + } + if ((dUpdateInfo & MCDRV_SWAP_MUSICOUT1_UPDATE_FLAG) != 0UL) { + if ((psSwapInfo->bMusicOut1 != MCDRV_SWSWAP_NORMAL) + && (psSwapInfo->bMusicOut1 != MCDRV_SWSWAP_BOTH1) + && (psSwapInfo->bMusicOut1 != MCDRV_SWSWAP_BOTH0) + && (psSwapInfo->bMusicOut1 != MCDRV_SWSWAP_SWAP)) + bRet = 0; + } + if ((dUpdateInfo & MCDRV_SWAP_MUSICOUT2_UPDATE_FLAG) != 0UL) { + if ((psSwapInfo->bMusicOut2 != MCDRV_SWSWAP_NORMAL) + && (psSwapInfo->bMusicOut2 != MCDRV_SWSWAP_BOTH1) + && (psSwapInfo->bMusicOut2 != MCDRV_SWSWAP_BOTH0) + && (psSwapInfo->bMusicOut2 != MCDRV_SWSWAP_SWAP)) + bRet = 0; + } + if ((dUpdateInfo & MCDRV_SWAP_EXTOUT_UPDATE_FLAG) != 0UL) { + if ((psSwapInfo->bExtOut != MCDRV_SWSWAP_NORMAL) + && (psSwapInfo->bExtOut != MCDRV_SWSWAP_BOTH1) + && (psSwapInfo->bExtOut != MCDRV_SWSWAP_BOTH0) + && (psSwapInfo->bExtOut != MCDRV_SWSWAP_SWAP)) + bRet = 0; + } + if ((dUpdateInfo & MCDRV_SWAP_VOICEOUT_UPDATE_FLAG) != 0UL) { + if ((psSwapInfo->bVoiceOut != MCDRV_SWSWAP_NORMAL) + && (psSwapInfo->bVoiceOut != MCDRV_SWSWAP_BOTH1) + && (psSwapInfo->bVoiceOut != MCDRV_SWSWAP_BOTH0) + && (psSwapInfo->bVoiceOut != MCDRV_SWSWAP_SWAP)) + bRet = 0; + } + if ((dUpdateInfo & MCDRV_SWAP_HIFIOUT_UPDATE_FLAG) != 0UL) { + if ((psSwapInfo->bHifiOut != MCDRV_SWSWAP_NORMAL) + && (psSwapInfo->bHifiOut != MCDRV_SWSWAP_BOTH1) + && (psSwapInfo->bHifiOut != MCDRV_SWSWAP_BOTH0) + && (psSwapInfo->bHifiOut != MCDRV_SWSWAP_SWAP)) + bRet = 0; + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + sdRet = bRet; + McDebugLog_FuncOut("IsValidSwapParam", &sdRet); +#endif + + return bRet; +} + +/**************************************************************************** + * IsValidDspParam + * + * Description: + * validate DSP parameters. + * Arguments: + * psAECInfo AEC information + * Return: + * 0:Invalid + * other:Valid + * + ****************************************************************************/ +static UINT8 IsValidDspParam +( + const struct MCDRV_AEC_INFO *psAECInfo +) +{ + UINT8 bRet = 1; + UINT8 bBdspUsed = 0, + bCdspUsed = 0, + bFdspUsed = 0; + struct MCDRV_AEC_INFO sCurAECInfo; + +#if (MCDRV_DEBUG_LEVEL >= 4) + SINT32 sdRet; + McDebugLog_FuncIn("IsValidDspParam"); +#endif + + + McResCtrl_GetAecInfo(&sCurAECInfo); + + if (McResCtrl_IsD1SrcUsed(MCDRV_D1SRC_AE0_ON + |MCDRV_D1SRC_AE1_ON + |MCDRV_D1SRC_AE2_ON + |MCDRV_D1SRC_AE3_ON) != 0) { + bBdspUsed = 1; + if (sCurAECInfo.sAecConfig.bFDspLocate == 0) + bFdspUsed = 1; + } + if ((McResCtrl_HasSrc(eMCDRV_DST_VBOXMIXIN, eMCDRV_DST_CH0) != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_VBOXMIXIN, eMCDRV_DST_CH1) != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_VBOXMIXIN, eMCDRV_DST_CH2) != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_VBOXMIXIN, eMCDRV_DST_CH3) != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_VBOXHOSTIN, eMCDRV_DST_CH0) != 0)) { + bCdspUsed = 1; + if (sCurAECInfo.sAecConfig.bFDspLocate == 1) + bFdspUsed = 1; + } + + if ((bBdspUsed != 0) + || (bCdspUsed != 0) + || (bFdspUsed != 0)) + if (psAECInfo->sAecConfig.bFDspLocate != 0xFF) + if (sCurAECInfo.sAecConfig.bFDspLocate != + psAECInfo->sAecConfig.bFDspLocate) { + bRet = 0; + goto exit; + } + + if ((bBdspUsed != 0) + || (bFdspUsed != 0)) + if (psAECInfo->sAecAudioengine.bEnable != 0) { + if ((psAECInfo->sAecAudioengine.bBDspAE0Src != 2) + && (psAECInfo->sAecAudioengine.bBDspAE0Src != + sCurAECInfo.sAecAudioengine.bBDspAE0Src)) { + bRet = 0; + goto exit; + } + if ((psAECInfo->sAecAudioengine.bBDspAE1Src != 2) + && (psAECInfo->sAecAudioengine.bBDspAE1Src != + sCurAECInfo.sAecAudioengine.bBDspAE1Src)) { + bRet = 0; + goto exit; + } + if ((psAECInfo->sAecAudioengine.bMixerIn0Src != 2) + && (psAECInfo->sAecAudioengine.bMixerIn0Src != + sCurAECInfo.sAecAudioengine.bMixerIn0Src)) { + bRet = 0; + goto exit; + } + if ((psAECInfo->sAecAudioengine.bMixerIn1Src != 2) + && (psAECInfo->sAecAudioengine.bMixerIn1Src != + sCurAECInfo.sAecAudioengine.bMixerIn1Src)) { + bRet = 0; + goto exit; + } + if ((psAECInfo->sAecAudioengine.bMixerIn2Src != 2) + && (psAECInfo->sAecAudioengine.bMixerIn2Src != + sCurAECInfo.sAecAudioengine.bMixerIn2Src)) { + bRet = 0; + goto exit; + } + if ((psAECInfo->sAecAudioengine.bMixerIn3Src != 2) + && (psAECInfo->sAecAudioengine.bMixerIn3Src != + sCurAECInfo.sAecAudioengine.bMixerIn3Src)) { + bRet = 0; + goto exit; + } + } + + if ((bCdspUsed != 0) + || (bFdspUsed != 0)) + if (psAECInfo->sAecVBox.bEnable != 0) { + if ((psAECInfo->sAecVBox.bFdsp_Po_Source != 0xFF) + && (psAECInfo->sAecVBox.bFdsp_Po_Source != + sCurAECInfo.sAecVBox.bFdsp_Po_Source)) { + bRet = 0; + goto exit; + } + if ((psAECInfo->sAecVBox.bISrc2_VSource != 0xFF) + && (psAECInfo->sAecVBox.bISrc2_VSource != + sCurAECInfo.sAecVBox.bISrc2_VSource)) { + bRet = 0; + goto exit; + } + if ((psAECInfo->sAecVBox.bISrc2_Ch1_VSource != 0xFF) + && (psAECInfo->sAecVBox.bISrc2_Ch1_VSource != + sCurAECInfo.sAecVBox.bISrc2_Ch1_VSource)) { + bRet = 0; + goto exit; + } + if ((psAECInfo->sAecVBox.bISrc3_VSource != 0xFF) + && (psAECInfo->sAecVBox.bISrc3_VSource != + sCurAECInfo.sAecVBox.bISrc3_VSource)) { + bRet = 0; + goto exit; + } + if ((psAECInfo->sAecVBox.bLPt2_VSource != 0xFF) + && (psAECInfo->sAecVBox.bLPt2_VSource != + sCurAECInfo.sAecVBox.bLPt2_VSource)) { + bRet = 0; + goto exit; + } + } + + if (bCdspUsed != 0) + if (psAECInfo->sAecVBox.bEnable != 0) { + if ((psAECInfo->sAecVBox.bSrc3_Ctrl != 0xFF) + && (psAECInfo->sAecVBox.bSrc3_Ctrl != + sCurAECInfo.sAecVBox.bSrc3_Ctrl)) { + bRet = 0; + goto exit; + } + if ((psAECInfo->sAecVBox.bSrc2_Fs != 0xFF) + && (psAECInfo->sAecVBox.bSrc2_Fs != + sCurAECInfo.sAecVBox.bSrc2_Fs)) { + bRet = 0; + goto exit; + } + if ((psAECInfo->sAecVBox.bSrc2_Thru != 0xFF) + && (psAECInfo->sAecVBox.bSrc2_Thru != + sCurAECInfo.sAecVBox.bSrc2_Thru)) { + bRet = 0; + goto exit; + } + if ((psAECInfo->sAecVBox.bSrc3_Fs != 0xFF) + && (psAECInfo->sAecVBox.bSrc3_Fs != + sCurAECInfo.sAecVBox.bSrc3_Fs)) { + bRet = 0; + goto exit; + } + if ((psAECInfo->sAecVBox.bSrc3_Thru != 0xFF) + && (psAECInfo->sAecVBox.bSrc3_Thru != + sCurAECInfo.sAecVBox.bSrc3_Thru)) { + bRet = 0; + goto exit; + } + } + + if (psAECInfo->sControl.bCommand == 1) { + if ((psAECInfo->sControl.bParam[0] != 0) + && (psAECInfo->sControl.bParam[0] != 1)) { + bRet = 0; + goto exit; + } + } else if (psAECInfo->sControl.bCommand == 2) { + if ((psAECInfo->sControl.bParam[0] != 0) + && (psAECInfo->sControl.bParam[0] != 1)) { + bRet = 0; + goto exit; + } + } else if (psAECInfo->sControl.bCommand == 3) { + if ((psAECInfo->sControl.bParam[0] != 0) + && (psAECInfo->sControl.bParam[0] != 1) + && (psAECInfo->sControl.bParam[0] != 2)) { + bRet = 0; + goto exit; + } + } else if (psAECInfo->sControl.bCommand == 4) { + if ((psAECInfo->sControl.bParam[0] != 0) + && (psAECInfo->sControl.bParam[0] != 1) + && (psAECInfo->sControl.bParam[0] != 3)) { + bRet = 0; + goto exit; + } + } else if (psAECInfo->sControl.bCommand == 5) { + if ((psAECInfo->sControl.bParam[0] > 6) + && (psAECInfo->sControl.bParam[0] < 0xFF)) { + bRet = 0; + goto exit; + } + if ((psAECInfo->sControl.bParam[1] > 3) + && (psAECInfo->sControl.bParam[1] < 0xFF)) { + bRet = 0; + goto exit; + } + } + +exit: +#if (MCDRV_DEBUG_LEVEL >= 4) + sdRet = bRet; + McDebugLog_FuncOut("IsValidDspParam", &sdRet); +#endif + return bRet; +} + +/**************************************************************************** + * IsValidHSDetParam + * + * Description: + * validate HSDet parameters. + * Arguments: + * psHSDetInfo HSDet information + * psHSDet2Info HSDet2 information + * dUpdateInfo update information + * Return: + * 0:Invalid + * other:Valid + * + ****************************************************************************/ +static UINT8 IsValidHSDetParam +( + const struct MCDRV_HSDET_INFO *psHSDetInfo, + const struct MCDRV_HSDET2_INFO *psHSDet2Info, + UINT32 dUpdateInfo +) +{ + UINT8 bRet = 1; + struct MCDRV_HSDET_INFO sHSDetInfo; + +#if (MCDRV_DEBUG_LEVEL >= 4) + SINT32 sdRet; + McDebugLog_FuncIn("IsValidHSDetParam"); +#endif + + + McResCtrl_GetHSDet(&sHSDetInfo, NULL); + + if ((dUpdateInfo & MCDRV_ENPLUGDET_UPDATE_FLAG) != 0UL) { + if ((psHSDetInfo->bEnPlugDet != MCDRV_PLUGDET_DISABLE) + && (psHSDetInfo->bEnPlugDet != MCDRV_PLUGDET_ENABLE)) + bRet = 0; + } + if ((dUpdateInfo & MCDRV_ENPLUGDET_UPDATE_FLAG) != 0UL) { + if ((psHSDetInfo->bEnPlugDetDb != MCDRV_PLUGDETDB_DISABLE) + && (psHSDetInfo->bEnPlugDetDb != MCDRV_PLUGDETDB_DET_ENABLE) + && (psHSDetInfo->bEnPlugDetDb != MCDRV_PLUGDETDB_UNDET_ENABLE) + && (psHSDetInfo->bEnPlugDetDb != MCDRV_PLUGDETDB_BOTH_ENABLE)) + bRet = 0; + } + if ((dUpdateInfo & MCDRV_ENDLYKEYOFF_UPDATE_FLAG) != 0UL) { + if ((psHSDetInfo->bEnDlyKeyOff != MCDRV_KEYEN_D_D_D) + && (psHSDetInfo->bEnDlyKeyOff != MCDRV_KEYEN_D_D_E) + && (psHSDetInfo->bEnDlyKeyOff != MCDRV_KEYEN_D_E_D) + && (psHSDetInfo->bEnDlyKeyOff != MCDRV_KEYEN_D_E_E) + && (psHSDetInfo->bEnDlyKeyOff != MCDRV_KEYEN_E_D_D) + && (psHSDetInfo->bEnDlyKeyOff != MCDRV_KEYEN_E_D_E) + && (psHSDetInfo->bEnDlyKeyOff != MCDRV_KEYEN_E_E_D) + && (psHSDetInfo->bEnDlyKeyOff != MCDRV_KEYEN_E_E_E)) + bRet = 0; + } + if ((dUpdateInfo & MCDRV_ENDLYKEYON_UPDATE_FLAG) != 0UL) { + if ((psHSDetInfo->bEnDlyKeyOn != MCDRV_KEYEN_D_D_D) + && (psHSDetInfo->bEnDlyKeyOn != MCDRV_KEYEN_D_D_E) + && (psHSDetInfo->bEnDlyKeyOn != MCDRV_KEYEN_D_E_D) + && (psHSDetInfo->bEnDlyKeyOn != MCDRV_KEYEN_D_E_E) + && (psHSDetInfo->bEnDlyKeyOn != MCDRV_KEYEN_E_D_D) + && (psHSDetInfo->bEnDlyKeyOn != MCDRV_KEYEN_E_D_E) + && (psHSDetInfo->bEnDlyKeyOn != MCDRV_KEYEN_E_E_D) + && (psHSDetInfo->bEnDlyKeyOn != MCDRV_KEYEN_E_E_E)) + bRet = 0; + } + if ((dUpdateInfo & MCDRV_ENMICDET_UPDATE_FLAG) != 0UL) { + if ((psHSDetInfo->bEnMicDet != MCDRV_MICDET_DISABLE) + && (psHSDetInfo->bEnMicDet != MCDRV_MICDET_ENABLE)) + bRet = 0; + } + if ((dUpdateInfo & MCDRV_ENKEYOFF_UPDATE_FLAG) != 0UL) { + if ((psHSDetInfo->bEnKeyOff != MCDRV_KEYEN_D_D_D) + && (psHSDetInfo->bEnKeyOff != MCDRV_KEYEN_D_D_E) + && (psHSDetInfo->bEnKeyOff != MCDRV_KEYEN_D_E_D) + && (psHSDetInfo->bEnKeyOff != MCDRV_KEYEN_D_E_E) + && (psHSDetInfo->bEnKeyOff != MCDRV_KEYEN_E_D_D) + && (psHSDetInfo->bEnKeyOff != MCDRV_KEYEN_E_D_E) + && (psHSDetInfo->bEnKeyOff != MCDRV_KEYEN_E_E_D) + && (psHSDetInfo->bEnKeyOff != MCDRV_KEYEN_E_E_E)) + bRet = 0; + } + if ((dUpdateInfo & MCDRV_ENKEYON_UPDATE_FLAG) != 0UL) { + if ((psHSDetInfo->bEnKeyOn != MCDRV_KEYEN_D_D_D) + && (psHSDetInfo->bEnKeyOn != MCDRV_KEYEN_D_D_E) + && (psHSDetInfo->bEnKeyOn != MCDRV_KEYEN_D_E_D) + && (psHSDetInfo->bEnKeyOn != MCDRV_KEYEN_D_E_E) + && (psHSDetInfo->bEnKeyOn != MCDRV_KEYEN_E_D_D) + && (psHSDetInfo->bEnKeyOn != MCDRV_KEYEN_E_D_E) + && (psHSDetInfo->bEnKeyOn != MCDRV_KEYEN_E_E_D) + && (psHSDetInfo->bEnKeyOn != MCDRV_KEYEN_E_E_E)) + bRet = 0; + } + if ((dUpdateInfo & MCDRV_HSDETDBNC_UPDATE_FLAG) != 0UL) { + if ((psHSDetInfo->bHsDetDbnc != MCDRV_DETDBNC_27) + && (psHSDetInfo->bHsDetDbnc != MCDRV_DETDBNC_55) + && (psHSDetInfo->bHsDetDbnc != MCDRV_DETDBNC_109) + && (psHSDetInfo->bHsDetDbnc != MCDRV_DETDBNC_219) + && (psHSDetInfo->bHsDetDbnc != MCDRV_DETDBNC_438) + && (psHSDetInfo->bHsDetDbnc != MCDRV_DETDBNC_875) + && (psHSDetInfo->bHsDetDbnc != MCDRV_DETDBNC_1313) + && (psHSDetInfo->bHsDetDbnc != MCDRV_DETDBNC_1750)) + bRet = 0; + } + + if ((dUpdateInfo & MCDRV_KEYOFFMTIM_UPDATE_FLAG) != 0UL) { + if ((psHSDetInfo->bKeyOffMtim == MCDRV_KEYOFF_MTIM_63) + || (psHSDetInfo->bKeyOffMtim == MCDRV_KEYOFF_MTIM_16)) + sHSDetInfo.bKeyOffMtim = psHSDetInfo->bKeyOffMtim; + else + bRet = 0; + } + if ((dUpdateInfo & MCDRV_KEYONMTIM_UPDATE_FLAG) != 0UL) { + if ((psHSDetInfo->bKeyOnMtim == MCDRV_KEYON_MTIM_63) + || (psHSDetInfo->bKeyOnMtim == MCDRV_KEYON_MTIM_250)) + sHSDetInfo.bKeyOnMtim = psHSDetInfo->bKeyOnMtim; + else + bRet = 0; + } + if ((dUpdateInfo & MCDRV_KEY0OFFDLYTIM_UPDATE_FLAG) != 0UL) { + if (psHSDetInfo->bKey0OffDlyTim > MC_DRV_KEYOFFDLYTIM_MAX) + bRet = 0; + else if (sHSDetInfo.bKeyOffMtim == MCDRV_KEYOFF_MTIM_63) { + if (psHSDetInfo->bKey0OffDlyTim == 1) + bRet = 0; + } + } + if ((dUpdateInfo & MCDRV_KEY1OFFDLYTIM_UPDATE_FLAG) != 0UL) { + if (psHSDetInfo->bKey1OffDlyTim > MC_DRV_KEYOFFDLYTIM_MAX) + bRet = 0; + else if (sHSDetInfo.bKeyOffMtim == MCDRV_KEYOFF_MTIM_63) { + if (psHSDetInfo->bKey1OffDlyTim == 1) + bRet = 0; + } + } + if ((dUpdateInfo & MCDRV_KEY2OFFDLYTIM_UPDATE_FLAG) != 0UL) { + if (psHSDetInfo->bKey2OffDlyTim > MC_DRV_KEYOFFDLYTIM_MAX) + bRet = 0; + else if (sHSDetInfo.bKeyOffMtim == MCDRV_KEYOFF_MTIM_63) { + if (psHSDetInfo->bKey2OffDlyTim == 1) + bRet = 0; + } + } + if ((dUpdateInfo & MCDRV_KEY0ONDLYTIM_UPDATE_FLAG) != 0UL) { + if (psHSDetInfo->bKey0OnDlyTim > MC_DRV_KEYONDLYTIM_MAX) + bRet = 0; + else if (sHSDetInfo.bKeyOnMtim == MCDRV_KEYON_MTIM_250) { + if ((psHSDetInfo->bKey0OnDlyTim == 1) + || (psHSDetInfo->bKey0OnDlyTim == 2) + || (psHSDetInfo->bKey0OnDlyTim == 3)) + bRet = 0; + } + } + if ((dUpdateInfo & MCDRV_KEY1ONDLYTIM_UPDATE_FLAG) != 0UL) { + if (psHSDetInfo->bKey1OnDlyTim > MC_DRV_KEYONDLYTIM_MAX) + bRet = 0; + else if (sHSDetInfo.bKeyOnMtim == MCDRV_KEYON_MTIM_250) { + if ((psHSDetInfo->bKey1OnDlyTim == 1) + || (psHSDetInfo->bKey1OnDlyTim == 2) + || (psHSDetInfo->bKey1OnDlyTim == 3)) + bRet = 0; + } + } + if ((dUpdateInfo & MCDRV_KEY2ONDLYTIM_UPDATE_FLAG) != 0UL) { + if (psHSDetInfo->bKey2OnDlyTim > MC_DRV_KEYONDLYTIM_MAX) + bRet = 0; + else if (sHSDetInfo.bKeyOnMtim == MCDRV_KEYON_MTIM_250) { + if ((psHSDetInfo->bKey2OnDlyTim == 1) + || (psHSDetInfo->bKey2OnDlyTim == 2) + || (psHSDetInfo->bKey2OnDlyTim == 3)) + bRet = 0; + } + } + if ((dUpdateInfo & MCDRV_KEY0ONDLYTIM2_UPDATE_FLAG) != 0UL) { + if (psHSDetInfo->bKey0OnDlyTim2 > MC_DRV_KEYONDLYTIM2_MAX) + bRet = 0; + else if (sHSDetInfo.bKeyOnMtim == MCDRV_KEYON_MTIM_250) { + if ((psHSDetInfo->bKey0OnDlyTim2 == 1) + || (psHSDetInfo->bKey0OnDlyTim2 == 2) + || (psHSDetInfo->bKey0OnDlyTim2 == 3)) + bRet = 0; + } + } + if ((dUpdateInfo & MCDRV_KEY1ONDLYTIM2_UPDATE_FLAG) != 0UL) { + if (psHSDetInfo->bKey1OnDlyTim2 > MC_DRV_KEYONDLYTIM2_MAX) + bRet = 0; + else if (sHSDetInfo.bKeyOnMtim == MCDRV_KEYON_MTIM_250) { + if ((psHSDetInfo->bKey1OnDlyTim2 == 1) + || (psHSDetInfo->bKey1OnDlyTim2 == 2) + || (psHSDetInfo->bKey1OnDlyTim2 == 3)) + bRet = 0; + } + } + if ((dUpdateInfo & MCDRV_KEY2ONDLYTIM2_UPDATE_FLAG) != 0UL) { + if (psHSDetInfo->bKey2OnDlyTim2 > MC_DRV_KEYONDLYTIM2_MAX) + bRet = 0; + else if (sHSDetInfo.bKeyOnMtim == MCDRV_KEYON_MTIM_250) { + if ((psHSDetInfo->bKey2OnDlyTim2 == 1) + || (psHSDetInfo->bKey2OnDlyTim2 == 2) + || (psHSDetInfo->bKey2OnDlyTim2 == 3)) + bRet = 0; + } + } + + if ((dUpdateInfo & MCDRV_IRQTYPE_UPDATE_FLAG) != 0UL) { + if ((psHSDetInfo->bIrqType != MCDRV_IRQTYPE_NORMAL) + && (psHSDetInfo->bIrqType != MCDRV_IRQTYPE_REF) + && (psHSDetInfo->bIrqType != MCDRV_IRQTYPE_EX)) { + bRet = 0; + goto exit; + } else if (psHSDetInfo->bIrqType == MCDRV_IRQTYPE_EX) { + if (psHSDet2Info != NULL) { + if ((psHSDet2Info->bPlugDetDbIrqType != + MCDRV_IRQTYPE_NORMAL) + && (psHSDet2Info->bPlugDetDbIrqType != + MCDRV_IRQTYPE_REF)) { + bRet = 0; + goto exit; + } + if ((psHSDet2Info->bPlugUndetDbIrqType != + MCDRV_IRQTYPE_NORMAL) + && (psHSDet2Info->bPlugUndetDbIrqType != + MCDRV_IRQTYPE_REF)) { + bRet = 0; + goto exit; + } + if ((psHSDet2Info->bMicDetIrqType != + MCDRV_IRQTYPE_NORMAL) + && (psHSDet2Info->bMicDetIrqType != + MCDRV_IRQTYPE_REF)) { + bRet = 0; + goto exit; + } + if ((psHSDet2Info->bPlugDetIrqType != + MCDRV_IRQTYPE_NORMAL) + && (psHSDet2Info->bPlugDetIrqType != + MCDRV_IRQTYPE_REF)) { + bRet = 0; + goto exit; + } + if ((psHSDet2Info->bKey0OnIrqType != + MCDRV_IRQTYPE_NORMAL) + && (psHSDet2Info->bKey0OnIrqType != + MCDRV_IRQTYPE_REF)) { + bRet = 0; + goto exit; + } + if ((psHSDet2Info->bKey1OnIrqType != + MCDRV_IRQTYPE_NORMAL) + && (psHSDet2Info->bKey1OnIrqType != + MCDRV_IRQTYPE_REF)) { + bRet = 0; + goto exit; + } + if ((psHSDet2Info->bKey2OnIrqType != + MCDRV_IRQTYPE_NORMAL) + && (psHSDet2Info->bKey2OnIrqType != + MCDRV_IRQTYPE_REF)) { + bRet = 0; + goto exit; + } + if ((psHSDet2Info->bKey0OffIrqType != + MCDRV_IRQTYPE_NORMAL) + && (psHSDet2Info->bKey0OffIrqType != + MCDRV_IRQTYPE_REF)) { + bRet = 0; + goto exit; + } + if ((psHSDet2Info->bKey1OffIrqType != + MCDRV_IRQTYPE_NORMAL) + && (psHSDet2Info->bKey1OffIrqType != + MCDRV_IRQTYPE_REF)) { + bRet = 0; + goto exit; + } + if ((psHSDet2Info->bKey2OffIrqType != + MCDRV_IRQTYPE_NORMAL) + && (psHSDet2Info->bKey2OffIrqType != + MCDRV_IRQTYPE_REF)) { + bRet = 0; + goto exit; + } + } + } + } + if ((dUpdateInfo & MCDRV_DETINV_UPDATE_FLAG) != 0UL) { + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_89_92H) { + if ((psHSDetInfo->bDetInInv != MCDRV_DET_IN_NORMAL) + && (psHSDetInfo->bDetInInv != MCDRV_DET_IN_INV)) + bRet = 0; + } else { + if ((psHSDetInfo->bDetInInv != MCDRV_DET_IN_NORMAL) + && (psHSDetInfo->bDetInInv != MCDRV_DET_IN_INV) + && (psHSDetInfo->bDetInInv != + MCDRV_DET_IN_NORMAL_NORMAL) + && (psHSDetInfo->bDetInInv != MCDRV_DET_IN_INV_NORMAL) + && (psHSDetInfo->bDetInInv != MCDRV_DET_IN_NORMAL_INV) + && (psHSDetInfo->bDetInInv != MCDRV_DET_IN_INV_INV)) + bRet = 0; + } + } + + if ((dUpdateInfo & MCDRV_HSDETMODE_UPDATE_FLAG) != 0UL) { + if ((psHSDetInfo->bHsDetMode != MCDRV_HSDET_MODE_DETIN_A) + && (psHSDetInfo->bHsDetMode != MCDRV_HSDET_MODE_DETIN_B)) + bRet = 0; + } + if ((dUpdateInfo & MCDRV_SPERIOD_UPDATE_FLAG) != 0UL) { + if ((psHSDetInfo->bSperiod != MCDRV_SPERIOD_244) + && (psHSDetInfo->bSperiod != MCDRV_SPERIOD_488) + && (psHSDetInfo->bSperiod != MCDRV_SPERIOD_977) + && (psHSDetInfo->bSperiod != MCDRV_SPERIOD_1953) + && (psHSDetInfo->bSperiod != MCDRV_SPERIOD_3906) + && (psHSDetInfo->bSperiod != MCDRV_SPERIOD_7813) + && (psHSDetInfo->bSperiod != MCDRV_SPERIOD_15625) + && (psHSDetInfo->bSperiod != MCDRV_SPERIOD_31250)) + bRet = 0; + } + if ((dUpdateInfo & MCDRV_DBNCNUMPLUG_UPDATE_FLAG) != 0UL) { + if ((psHSDetInfo->bDbncNumPlug != MCDRV_DBNC_NUM_2) + && (psHSDetInfo->bDbncNumPlug != MCDRV_DBNC_NUM_3) + && (psHSDetInfo->bDbncNumPlug != MCDRV_DBNC_NUM_4) + && (psHSDetInfo->bDbncNumPlug != MCDRV_DBNC_NUM_7)) + bRet = 0; + } + if ((dUpdateInfo & MCDRV_DBNCNUMMIC_UPDATE_FLAG) != 0UL) { + if ((psHSDetInfo->bDbncNumMic != MCDRV_DBNC_NUM_2) + && (psHSDetInfo->bDbncNumMic != MCDRV_DBNC_NUM_3) + && (psHSDetInfo->bDbncNumMic != MCDRV_DBNC_NUM_4) + && (psHSDetInfo->bDbncNumMic != MCDRV_DBNC_NUM_7)) + bRet = 0; + } + if ((dUpdateInfo & MCDRV_DBNCNUMKEY_UPDATE_FLAG) != 0UL) { + if ((psHSDetInfo->bDbncNumKey != MCDRV_DBNC_NUM_2) + && (psHSDetInfo->bDbncNumKey != MCDRV_DBNC_NUM_3) + && (psHSDetInfo->bDbncNumKey != MCDRV_DBNC_NUM_4) + && (psHSDetInfo->bDbncNumKey != MCDRV_DBNC_NUM_7)) + bRet = 0; + } + + if (McDevProf_GetDevId() != eMCDRV_DEV_ID_89_92H) { + if ((dUpdateInfo & MCDRV_SGNL_UPDATE_FLAG) != 0UL) { + if ((psHSDetInfo->bSgnlPeriod != MCDRV_SGNLPERIOD_61) + && (psHSDetInfo->bSgnlPeriod != MCDRV_SGNLPERIOD_79) + && (psHSDetInfo->bSgnlPeriod != MCDRV_SGNLPERIOD_97) + && (psHSDetInfo->bSgnlPeriod != MCDRV_SGNLPERIOD_151)) + bRet = 0; + if ((psHSDetInfo->bSgnlNum != MCDRV_SGNLNUM_1) + && (psHSDetInfo->bSgnlNum != MCDRV_SGNLNUM_4) + && (psHSDetInfo->bSgnlNum != MCDRV_SGNLNUM_6) + && (psHSDetInfo->bSgnlNum != MCDRV_SGNLNUM_8) + && (psHSDetInfo->bSgnlNum != MCDRV_SGNLNUM_NONE)) + bRet = 0; + if ((psHSDetInfo->bSgnlPeak != MCDRV_SGNLPEAK_500) + && (psHSDetInfo->bSgnlPeak != MCDRV_SGNLPEAK_730) + && (psHSDetInfo->bSgnlPeak != MCDRV_SGNLPEAK_960) + && (psHSDetInfo->bSgnlPeak != MCDRV_SGNLPEAK_1182)) + bRet = 0; + } + } + + if ((dUpdateInfo & MCDRV_DLYIRQSTOP_UPDATE_FLAG) != 0UL) { + if ((psHSDetInfo->bDlyIrqStop != MCDRV_DLYIRQ_DONTCARE) + && (psHSDetInfo->bDlyIrqStop != MCDRV_DLYIRQ_STOP)) + bRet = 0; + } + +exit: +#if (MCDRV_DEBUG_LEVEL >= 4) + sdRet = bRet; + McDebugLog_FuncOut("IsValidHSDetParam", &sdRet); +#endif + return bRet; +} + +/**************************************************************************** + * IsValidGpParam + * + * Description: + * validate GP parameters. + * Arguments: + * psGpInfo GP information + * Return: + * 0:Invalid + * other:Valid + * + ****************************************************************************/ +static UINT8 IsValidGpParam +( + const struct MCDRV_GP_MODE *psGpMode +) +{ + UINT8 bRet = 1; + UINT8 bPad; + struct MCDRV_INIT_INFO sInitInfo; + +#if (MCDRV_DEBUG_LEVEL >= 4) + SINT32 sdRet; + McDebugLog_FuncIn("IsValidGpParam"); +#endif + + McResCtrl_GetInitInfo(&sInitInfo, NULL); + + for (bPad = 0; (bPad < 3) && (bRet == 1); bPad++) { + if (((bPad == 0) && (sInitInfo.bPa0Func != MCDRV_PA_GPIO)) + || ((bPad == 1) && (sInitInfo.bPa1Func != MCDRV_PA_GPIO)) + || ((bPad == 2) && (sInitInfo.bPa2Func != MCDRV_PA_GPIO))) + continue; + if ((psGpMode->abGpDdr[bPad] != MCDRV_GPDDR_IN) + && (psGpMode->abGpDdr[bPad] != MCDRV_GPDDR_OUT)) { + bRet = 0; + continue; + } + if ((psGpMode->abGpHost[bPad] != MCDRV_GPHOST_CPU) + && (psGpMode->abGpHost[bPad] != MCDRV_GPHOST_CDSP)) { + bRet = 0; + continue; + } + if ((psGpMode->abGpInvert[bPad] != MCDRV_GPINV_NORMAL) + && (psGpMode->abGpInvert[bPad] != MCDRV_GPINV_INVERT)) + bRet = 0; + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + sdRet = bRet; + McDebugLog_FuncOut("IsValidGpParam", &sdRet); +#endif + return bRet; +} + +/**************************************************************************** + * IsValidMaskGp + * + * Description: + * validate GP parameters. + * Arguments: + * bMask MaskGP information + * dPadNo PAD number + * Return: + * 0:Invalid + * other:Valid + * + ****************************************************************************/ +static UINT8 IsValidMaskGp +( + UINT8 bMask, + UINT32 dPadNo +) +{ + UINT8 bRet = 1; + struct MCDRV_INIT_INFO sInitInfo; + struct MCDRV_GP_MODE sGPMode; + +#if (MCDRV_DEBUG_LEVEL >= 4) + SINT32 sdRet = MCDRV_SUCCESS; + McDebugLog_FuncIn("IsValidMaskGp"); +#endif + + McResCtrl_GetInitInfo(&sInitInfo, NULL); + McResCtrl_GetGPMode(&sGPMode); + + if ((dPadNo != 0) + && (dPadNo != 1) + && (dPadNo != 2)) + bRet = 0; + else if (((dPadNo == 0) && (sInitInfo.bPa0Func != MCDRV_PA_GPIO)) + || ((dPadNo == 1) && (sInitInfo.bPa1Func != MCDRV_PA_GPIO)) + || ((dPadNo == 2) && (sInitInfo.bPa2Func != MCDRV_PA_GPIO))) { + ; + } else { + if (sGPMode.abGpDdr[dPadNo] == MCDRV_GPDDR_OUT) + bRet = 0; + if ((bMask != MCDRV_GPMASK_ON) && (bMask != MCDRV_GPMASK_OFF)) + bRet = 0; + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + sdRet = bRet; + McDebugLog_FuncOut("IsValidMaskGp", &sdRet); +#endif + return bRet; +} + +/**************************************************************************** + * CheckDIOCommon + * + * Description: + * check Digital IO Common parameters. + * Arguments: + * psDioInfo digital IO information + * bPort port number + * Return: + * 0:error + * other:no error + * + ****************************************************************************/ +static UINT8 CheckDIOCommon +( + const struct MCDRV_DIO_INFO *psDioInfo, + UINT8 bPort +) +{ + UINT8 bRet = 1; + +#if (MCDRV_DEBUG_LEVEL >= 4) + SINT32 sdRet = MCDRV_SUCCESS; + McDebugLog_FuncIn("CheckDIOCommon"); +#endif + + + if (bPort == 3) { + if ((psDioInfo->asPortInfo[bPort].sDioCommon.bFs + != MCDRV_FS_48000) + && (psDioInfo->asPortInfo[bPort].sDioCommon.bFs + != MCDRV_FS_192000) + && (psDioInfo->asPortInfo[bPort].sDioCommon.bFs + != MCDRV_FS_96000)) + bRet = 0; + else if ((psDioInfo->asPortInfo[bPort].sDioCommon.bBckFs + != MCDRV_BCKFS_64) + && (psDioInfo->asPortInfo[bPort].sDioCommon.bBckFs + != MCDRV_BCKFS_48) + && (psDioInfo->asPortInfo[bPort].sDioCommon.bBckFs + != MCDRV_BCKFS_32)) + bRet = 0; + else if ((psDioInfo->asPortInfo[bPort].sDioCommon.bBckInvert + != MCDRV_BCLK_NORMAL) + && (psDioInfo->asPortInfo[bPort].sDioCommon.bBckInvert + != MCDRV_BCLK_INVERT)) + bRet = 0; + goto exit; + } + + if ((psDioInfo->asPortInfo[bPort].sDioCommon.bMasterSlave + != MCDRV_DIO_SLAVE) + && (psDioInfo->asPortInfo[bPort].sDioCommon.bMasterSlave + != MCDRV_DIO_MASTER)) + bRet = 0; + else if ((psDioInfo->asPortInfo[bPort].sDioCommon.bAutoFs + != MCDRV_AUTOFS_OFF) + && (psDioInfo->asPortInfo[bPort].sDioCommon.bAutoFs + != MCDRV_AUTOFS_ON)) + bRet = 0; + else if ((psDioInfo->asPortInfo[bPort].sDioCommon.bFs + != MCDRV_FS_48000) + && (psDioInfo->asPortInfo[bPort].sDioCommon.bFs + != MCDRV_FS_44100) + && (psDioInfo->asPortInfo[bPort].sDioCommon.bFs + != MCDRV_FS_32000) + && (psDioInfo->asPortInfo[bPort].sDioCommon.bFs + != MCDRV_FS_24000) + && (psDioInfo->asPortInfo[bPort].sDioCommon.bFs + != MCDRV_FS_22050) + && (psDioInfo->asPortInfo[bPort].sDioCommon.bFs + != MCDRV_FS_16000) + && (psDioInfo->asPortInfo[bPort].sDioCommon.bFs + != MCDRV_FS_12000) + && (psDioInfo->asPortInfo[bPort].sDioCommon.bFs + != MCDRV_FS_11025) + && (psDioInfo->asPortInfo[bPort].sDioCommon.bFs + != MCDRV_FS_8000) + && (psDioInfo->asPortInfo[bPort].sDioCommon.bFs + != MCDRV_FS_192000) + && (psDioInfo->asPortInfo[bPort].sDioCommon.bFs + != MCDRV_FS_96000)) + bRet = 0; + else if ((psDioInfo->asPortInfo[bPort].sDioCommon.bBckFs + != MCDRV_BCKFS_64) + && (psDioInfo->asPortInfo[bPort].sDioCommon.bBckFs + != MCDRV_BCKFS_48) + && (psDioInfo->asPortInfo[bPort].sDioCommon.bBckFs + != MCDRV_BCKFS_32) + && (psDioInfo->asPortInfo[bPort].sDioCommon.bBckFs + != MCDRV_BCKFS_512) + && (psDioInfo->asPortInfo[bPort].sDioCommon.bBckFs + != MCDRV_BCKFS_256) + && (psDioInfo->asPortInfo[bPort].sDioCommon.bBckFs + != MCDRV_BCKFS_192) + && (psDioInfo->asPortInfo[bPort].sDioCommon.bBckFs + != MCDRV_BCKFS_128) + && (psDioInfo->asPortInfo[bPort].sDioCommon.bBckFs + != MCDRV_BCKFS_96) + && (psDioInfo->asPortInfo[bPort].sDioCommon.bBckFs + != MCDRV_BCKFS_24) + && (psDioInfo->asPortInfo[bPort].sDioCommon.bBckFs + != MCDRV_BCKFS_16) + && (psDioInfo->asPortInfo[bPort].sDioCommon.bBckFs + != MCDRV_BCKFS_8) + && (psDioInfo->asPortInfo[bPort].sDioCommon.bBckFs + != MCDRV_BCKFS_SLAVE)) + bRet = 0; + else if ((psDioInfo->asPortInfo[bPort].sDioCommon.bInterface + != MCDRV_DIO_DA) + && (psDioInfo->asPortInfo[bPort].sDioCommon.bInterface + != MCDRV_DIO_PCM)) + bRet = 0; + else if ((psDioInfo->asPortInfo[bPort].sDioCommon.bBckInvert + != MCDRV_BCLK_NORMAL) + && (psDioInfo->asPortInfo[bPort].sDioCommon.bBckInvert + != MCDRV_BCLK_INVERT)) + bRet = 0; + else if ((psDioInfo->asPortInfo[bPort].sDioCommon.bSrcThru + != MCDRV_SRC_NOT_THRU) + && (psDioInfo->asPortInfo[bPort].sDioCommon.bSrcThru + != MCDRV_SRC_THRU)) { + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H) { + ; + bRet = 0; + } + } else { + if ((psDioInfo->asPortInfo[bPort].sDioCommon.bPcmHizTim + != MCDRV_PCMHIZTIM_FALLING) + && (psDioInfo->asPortInfo[bPort].sDioCommon.bPcmHizTim + != MCDRV_PCMHIZTIM_RISING)) + bRet = 0; + else if ((psDioInfo->asPortInfo[bPort].sDioCommon.bPcmFrame + != MCDRV_PCM_SHORTFRAME) + && (psDioInfo->asPortInfo[bPort].sDioCommon.bPcmFrame + != MCDRV_PCM_LONGFRAME)) + bRet = 0; + else if (psDioInfo->asPortInfo[bPort].sDioCommon.bPcmHighPeriod + > 31) + bRet = 0; + } + + if (psDioInfo->asPortInfo[bPort].sDioCommon.bInterface + == MCDRV_DIO_PCM) { + if ((psDioInfo->asPortInfo[bPort].sDioCommon.bFs + != MCDRV_FS_8000) + && (psDioInfo->asPortInfo[bPort].sDioCommon.bFs + != MCDRV_FS_16000)) + bRet = 0; + + if (psDioInfo->asPortInfo[bPort].sDioCommon.bBckFs + == MCDRV_BCKFS_512) { + if (psDioInfo->asPortInfo[bPort].sDioCommon.bFs + != MCDRV_FS_8000) + bRet = 0; + } + if (psDioInfo->asPortInfo[bPort].sDioCommon.bBckFs + == MCDRV_BCKFS_256) { + if ((psDioInfo->asPortInfo[bPort].sDioCommon.bFs + != MCDRV_FS_8000) + && (psDioInfo->asPortInfo[bPort].sDioCommon.bFs + != MCDRV_FS_16000)) + bRet = 0; + } + if (psDioInfo->asPortInfo[bPort].sDioCommon.bMasterSlave + == MCDRV_DIO_MASTER) { + if (psDioInfo->asPortInfo[bPort].sDioCommon.bBckFs + == MCDRV_BCKFS_SLAVE) + bRet = 0; + } + } else { + if ((bPort == 0) + || (bPort == 1)) { + if ((psDioInfo->asPortInfo[bPort].sDioCommon.bFs + == MCDRV_FS_192000) + || (psDioInfo->asPortInfo[bPort].sDioCommon.bFs + == MCDRV_FS_96000)) + bRet = 0; + } + if ((psDioInfo->asPortInfo[bPort].sDioCommon.bBckFs + != MCDRV_BCKFS_64) + && (psDioInfo->asPortInfo[bPort].sDioCommon.bBckFs + != MCDRV_BCKFS_48) + && (psDioInfo->asPortInfo[bPort].sDioCommon.bBckFs + != MCDRV_BCKFS_32)) { + bRet = 0; + } + } + +exit: +#if (MCDRV_DEBUG_LEVEL >= 4) + sdRet = bRet; + McDebugLog_FuncOut("CheckDIOCommon", &sdRet); +#endif + return bRet; +} + +/**************************************************************************** + * CheckDaFormat + * + * Description: + * check sDaFormat parameters. + * Arguments: + * psDaFormat MCDRV_DA_FORMAT information + * Return: + * 0:error + * other:no error + * + ****************************************************************************/ +static UINT8 CheckDaFormat +( + const struct MCDRV_DA_FORMAT *psDaFormat +) +{ + UINT8 bRet = 1; + +#if (MCDRV_DEBUG_LEVEL >= 4) + SINT32 sdRet; + McDebugLog_FuncIn("CheckDaFormat"); +#endif + + + if ((psDaFormat->bBitSel != MCDRV_BITSEL_16) + && (psDaFormat->bBitSel != MCDRV_BITSEL_20) + && (psDaFormat->bBitSel != MCDRV_BITSEL_24) + && (psDaFormat->bBitSel != MCDRV_BITSEL_32)) { + bRet = 0; + } else if ((psDaFormat->bMode != MCDRV_DAMODE_HEADALIGN) + && (psDaFormat->bMode != MCDRV_DAMODE_I2S) + && (psDaFormat->bMode != MCDRV_DAMODE_TAILALIGN)) { + bRet = 0; + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + sdRet = bRet; + McDebugLog_FuncOut("CheckDaFormat", &sdRet); +#endif + return bRet; +} + +/**************************************************************************** + * CheckPcmFormat + * + * Description: + * check sPcmFormat parameters. + * Arguments: + * psPcmFormat MCDRV_PCM_FORMAT information + * Return: + * 0:error + * other:no error + * + ****************************************************************************/ +static UINT8 CheckPcmFormat +( + const struct MCDRV_PCM_FORMAT *psPcmFormat +) +{ + UINT8 bRet = 1; + +#if (MCDRV_DEBUG_LEVEL >= 4) + SINT32 sdRet; + McDebugLog_FuncIn("CheckPcmFormat"); +#endif + + + if ((psPcmFormat->bMono != MCDRV_PCM_STEREO) + && (psPcmFormat->bMono != MCDRV_PCM_MONO)) { + ; + bRet = 0; + } else if ((psPcmFormat->bOrder != MCDRV_PCM_MSB_FIRST) + && (psPcmFormat->bOrder != MCDRV_PCM_LSB_FIRST)) { + ; + bRet = 0; + } else if ((psPcmFormat->bLaw != MCDRV_PCM_LINEAR) + && (psPcmFormat->bLaw != MCDRV_PCM_ALAW) + && (psPcmFormat->bLaw != MCDRV_PCM_MULAW)) { + ; + bRet = 0; + } else if ((psPcmFormat->bBitSel != MCDRV_PCM_BITSEL_8) + && (psPcmFormat->bBitSel != MCDRV_PCM_BITSEL_16) + && (psPcmFormat->bBitSel != MCDRV_PCM_BITSEL_24)) { + ; + bRet = 0; + } else { + if ((psPcmFormat->bLaw == MCDRV_PCM_ALAW) + || (psPcmFormat->bLaw == MCDRV_PCM_MULAW)) { + if (psPcmFormat->bBitSel != MCDRV_PCM_BITSEL_8) { + ; + bRet = 0; + } + } + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + sdRet = bRet; + McDebugLog_FuncOut("CheckPcmFormat", &sdRet); +#endif + return bRet; +} + +/**************************************************************************** + * CheckDIODIR + * + * Description: + * validate Digital IO DIR parameters. + * Arguments: + * psDioInfo digital IO information + * bPort port number + * Return: + * 0:error + * other:no error + * + ****************************************************************************/ +static UINT8 CheckDIODIR +( + const struct MCDRV_DIO_INFO *psDioInfo, + UINT8 bPort +) +{ + UINT8 bRet = 1; + +#if (MCDRV_DEBUG_LEVEL >= 4) + SINT32 sdRet; + McDebugLog_FuncIn("CheckDIODIR"); +#endif + + + bRet = CheckPcmFormat( + &psDioInfo->asPortInfo[bPort].sDir.sPcmFormat); + if (bRet != 0) { + bRet = CheckDaFormat( + &psDioInfo->asPortInfo[bPort].sDir.sDaFormat); + if (psDioInfo->asPortInfo[bPort].sDir.sDaFormat.bBitSel + == MCDRV_BITSEL_32) + bRet = 0; + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + sdRet = bRet; + McDebugLog_FuncOut("CheckDIODIR", &sdRet); +#endif + return bRet; +} + +/**************************************************************************** + * CheckDIODIT + * + * Description: + * validate Digital IO DIT parameters. + * Arguments: + * psDioInfo digital IO information + * bPort port number + * Return: + * 0:error + * other:no error + * + ****************************************************************************/ +static UINT8 CheckDIODIT +( + const struct MCDRV_DIO_INFO *psDioInfo, + UINT8 bPort +) +{ + UINT8 bRet = 1; + +#if (MCDRV_DEBUG_LEVEL >= 4) + SINT32 sdRet; + McDebugLog_FuncIn("CheckDIODIT"); +#endif + + + if ((psDioInfo->asPortInfo[bPort].sDit.bStMode != MCDRV_STMODE_ZERO) + && (psDioInfo->asPortInfo[bPort].sDit.bStMode != MCDRV_STMODE_HOLD)) + bRet = 0; + else if ((psDioInfo->asPortInfo[bPort].sDit.bEdge != MCDRV_SDOUT_NORMAL) + && (psDioInfo->asPortInfo[bPort].sDit.bEdge != MCDRV_SDOUT_AHEAD)) + bRet = 0; + else { + bRet = CheckPcmFormat( + &psDioInfo->asPortInfo[bPort].sDit.sPcmFormat); + if (bRet != 0) { + bRet = CheckDaFormat( + &psDioInfo->asPortInfo[bPort].sDit.sDaFormat); + if (psDioInfo->asPortInfo[bPort].sDit.sDaFormat.bBitSel + == MCDRV_BITSEL_32) + if (bPort != 2) + bRet = 0; + } + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + sdRet = bRet; + McDebugLog_FuncOut("CheckDIODIT", &sdRet); +#endif + return bRet; +} + +/**************************************************************************** + * SetVol + * + * Description: + * set volume. + * Arguments: + * dUpdate target volume items + * eMode update mode + * pdSVolDoneParam wait soft volume complete flag + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR_RESOURCEOVER + * + ****************************************************************************/ +static SINT32 SetVol +( + UINT32 dUpdate, + enum MCDRV_VOLUPDATE_MODE eMode, + UINT32 *pdSVolDoneParam +) +{ + SINT32 sdRet = MCDRV_SUCCESS; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("SetVol"); +#endif + + McPacket_AddVol(dUpdate, eMode, pdSVolDoneParam); + sdRet = McDevIf_ExecutePacket(); + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("SetVol", &sdRet); +#endif + + return sdRet; +} + +/**************************************************************************** + * GetMuteParam + * + * Description: + * Get mute complete flag. + * Arguments: + * pbDIRMuteParam wait DIR mute complete flag + * pbADCMuteParam wait ADC mute complete flag + * pbDITMuteParam wait DIT mute complete flag + * pbDACMuteParam wait DAC mute complete flag + * Return: + * none + * + ****************************************************************************/ +static void GetMuteParam +( + UINT8 *pbDIRMuteParam, + UINT8 *pbADCMuteParam, + UINT8 *pbDITMuteParam, + UINT8 *pbDACMuteParam +) +{ + UINT8 bVol; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("GetMuteParam"); +#endif + + *pbDIRMuteParam = 0; + *pbADCMuteParam = 0; + *pbDITMuteParam = 0; + *pbDACMuteParam = 0; + + if (McResCtrl_IsD1SrcUsed(MCDRV_D1SRC_MUSICIN_ON) == 0) { + bVol = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_MA, + MCI_DIFI0_VOL0); + if ((bVol & (UINT8)~MCB_DIFI0_VSEP) != 0) + *pbDIRMuteParam |= MCB_DIFI0_VFLAG0; + bVol = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_MA, + MCI_DIFI0_VOL1); + if (bVol != 0) + *pbDIRMuteParam |= MCB_DIFI0_VFLAG1; + } + if (McResCtrl_IsD1SrcUsed(MCDRV_D1SRC_EXTIN_ON) == 0) { + bVol = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_MA, + MCI_DIFI1_VOL0); + if ((bVol & (UINT8)~MCB_DIFI1_VSEP) != 0) + *pbDIRMuteParam |= MCB_DIFI1_VFLAG0; + bVol = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_MA, + MCI_DIFI1_VOL1); + if (bVol != 0) + *pbDIRMuteParam |= MCB_DIFI1_VFLAG1; + } + if (McResCtrl_IsD1SrcUsed(MCDRV_D1SRC_VBOXOUT_ON) == 0) { + bVol = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_MA, + MCI_DIFI2_VOL0); + if ((bVol & (UINT8)~MCB_DIFI2_VSEP) != 0) + *pbDIRMuteParam |= MCB_DIFI2_VFLAG0; + bVol = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_MA, + MCI_DIFI2_VOL1); + if (bVol != 0) + *pbDIRMuteParam |= MCB_DIFI2_VFLAG1; + } + if (McResCtrl_IsD1SrcUsed(MCDRV_D1SRC_VBOXREFOUT_ON) == 0) { + bVol = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_MA, + MCI_DIFI3_VOL0); + if ((bVol & (UINT8)~MCB_DIFI3_VSEP) != 0) + *pbDIRMuteParam |= MCB_DIFI3_VFLAG0; + bVol = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_MA, + MCI_DIFI3_VOL1); + if (bVol != 0) + *pbDIRMuteParam |= MCB_DIFI3_VFLAG1; + } + if (McResCtrl_HasSrc(eMCDRV_DST_DAC0, eMCDRV_DST_CH0) == 0) { + bVol = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_MA, + MCI_DAO0_VOL0); + if ((bVol & (UINT8)~MCB_DAO0_VSEP) != 0) + *pbDACMuteParam |= MCB_DAO0_VFLAG0; + } + if (McResCtrl_HasSrc(eMCDRV_DST_DAC0, eMCDRV_DST_CH1) == 0) { + bVol = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_MA, + MCI_DAO0_VOL1); + if (bVol != 0) + *pbDACMuteParam |= MCB_DAO0_VFLAG1; + } + if (McResCtrl_HasSrc(eMCDRV_DST_DAC1, eMCDRV_DST_CH0) == 0) { + bVol = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_MA, + MCI_DAO1_VOL0); + if ((bVol & (UINT8)~MCB_DAO1_VSEP) != 0) + *pbDACMuteParam |= MCB_DAO1_VFLAG0; + } + if (McResCtrl_HasSrc(eMCDRV_DST_DAC1, eMCDRV_DST_CH1) == 0) { + bVol = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_MA, + MCI_DAO1_VOL1); + if (bVol != 0) + *pbDACMuteParam |= MCB_DAO1_VFLAG1; + } + + if (McResCtrl_HasSrc(eMCDRV_DST_MUSICOUT, eMCDRV_DST_CH0) == 0) { + bVol = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_MA, + MCI_DIFO0_VOL0); + if ((bVol & (UINT8)~MCB_DIFO0_VSEP) != 0) + *pbDITMuteParam |= MCB_DIFO0_VFLAG0; + } + if (McResCtrl_HasSrc(eMCDRV_DST_MUSICOUT, eMCDRV_DST_CH1) == 0) { + bVol = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_MA, + MCI_DIFO0_VOL1); + if (bVol != 0) + *pbDITMuteParam |= MCB_DIFO0_VFLAG1; + + } + if (McResCtrl_HasSrc(eMCDRV_DST_EXTOUT, eMCDRV_DST_CH0) == 0) { + bVol = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_MA, + MCI_DIFO1_VOL0); + if ((bVol & (UINT8)~MCB_DIFO1_VSEP) != 0) + *pbDITMuteParam |= MCB_DIFO1_VFLAG0; + } + if (McResCtrl_HasSrc(eMCDRV_DST_EXTOUT, eMCDRV_DST_CH1) == 0) { + bVol = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_MA, + MCI_DIFO1_VOL1); + if (bVol != 0) + *pbDITMuteParam |= MCB_DIFO1_VFLAG1; + } + + if (McResCtrl_HasSrc(eMCDRV_DST_VBOXMIXIN, eMCDRV_DST_CH0) == 0) { + bVol = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_MA, + MCI_DIFO2_VOL0); + if ((bVol & (UINT8)~MCB_DIFO2_VSEP) != 0) + *pbDITMuteParam |= MCB_DIFO2_VFLAG0; + } + if (McResCtrl_HasSrc(eMCDRV_DST_VBOXMIXIN, eMCDRV_DST_CH1) == 0) { + bVol = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_MA, + MCI_DIFO2_VOL1); + if (bVol != 0) + *pbDITMuteParam |= MCB_DIFO2_VFLAG1; + } + if (McResCtrl_HasSrc(eMCDRV_DST_VBOXMIXIN, eMCDRV_DST_CH2) == 0) { + bVol = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_MA, + MCI_DIFO3_VOL0); + if ((bVol & (UINT8)~MCB_DIFO2_VSEP) != 0) + *pbDITMuteParam |= MCB_DIFO3_VFLAG0; + } + if (McResCtrl_HasSrc(eMCDRV_DST_VBOXMIXIN, eMCDRV_DST_CH3) == 0) { + bVol = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_MA, + MCI_DIFO3_VOL1); + if (bVol != 0) + *pbDITMuteParam |= MCB_DIFO3_VFLAG1; + } + + if (McResCtrl_IsD1SrcUsed(MCDRV_D1SRC_ADIF0_ON) == 0) { + bVol = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_MA, + MCI_ADI0_VOL0); + if ((bVol & (UINT8)~MCB_ADI0_VSEP) != 0) + *pbADCMuteParam |= MCB_ADI0_VFLAG0; + bVol = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_MA, + MCI_ADI0_VOL1); + if (bVol != 0) + *pbADCMuteParam |= MCB_ADI0_VFLAG1; + } + if (McResCtrl_IsD1SrcUsed(MCDRV_D1SRC_ADIF1_ON) == 0) { + bVol = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_MA, + MCI_ADI1_VOL1); + if ((bVol & (UINT8)~MCB_ADI1_VSEP) != 0) + *pbADCMuteParam |= MCB_ADI1_VFLAG0; + bVol = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_MA, + MCI_ADI1_VOL1); + if (bVol != 0) + *pbADCMuteParam |= MCB_ADI1_VFLAG1; + } + if (McResCtrl_IsD1SrcUsed(MCDRV_D1SRC_ADIF2_ON) == 0) { + bVol = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_MA, + MCI_ADI2_VOL1); + if ((bVol & (UINT8)~MCB_ADI2_VSEP) != 0) + *pbADCMuteParam |= MCB_ADI2_VFLAG0; + bVol = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_MA, + MCI_ADI2_VOL1); + if (bVol != 0) + *pbADCMuteParam |= MCB_ADI2_VFLAG1; + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("GetMuteParam", NULL); +#endif +} + +/**************************************************************************** + * SavePower + * + * Description: + * Save power. + * Arguments: + * none + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR_RESOURCEOVER + * MCDRV_ERROR_TIMEOUT + * + ****************************************************************************/ +static SINT32 SavePower +( + void +) +{ + SINT32 sdRet = MCDRV_SUCCESS; + struct MCDRV_POWER_INFO sPowerInfo; + struct MCDRV_POWER_UPDATE sPowerUpdate; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("SavePower"); +#endif + + /* unused path power down */ + McResCtrl_GetPowerInfo(&sPowerInfo); + sPowerUpdate.bDigital = MCDRV_POWUPDATE_D_ALL; + sPowerUpdate.abAnalog[0] = (UINT8)MCDRV_POWUPDATE_AP; + sPowerUpdate.abAnalog[1] = (UINT8)MCDRV_POWUPDATE_AP_OUT0; + sPowerUpdate.abAnalog[2] = (UINT8)MCDRV_POWUPDATE_AP_OUT1; + sPowerUpdate.abAnalog[3] = (UINT8)MCDRV_POWUPDATE_AP_MC; + sPowerUpdate.abAnalog[4] = (UINT8)MCDRV_POWUPDATE_AP_IN; + sdRet = McPacket_AddPowerDown(&sPowerInfo, &sPowerUpdate); + if (sdRet == MCDRV_SUCCESS) + sdRet = McDevIf_ExecutePacket(); + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("SavePower", &sdRet); +#endif + return sdRet; +} + +/**************************************************************************** + * McDrv_Ctrl + * + * Description: + * MC Driver I/F function. + * Arguments: + * dCmd command # + * pvPrm1 parameter1 + * pvPrm2 parameter2 + * dPrm update info + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR_ARGUMENT + * MCDRV_ERROR_RESOURCEOVER + * MCDRV_ERROR_STATE + * + ****************************************************************************/ +SINT32 McDrv_Ctrl( + UINT32 dCmd, + void *pvPrm1, + void *pvPrm2, + UINT32 dPrm +) +{ + SINT32 sdRet = MCDRV_ERROR; + UINT8 bAP; + +#if MCDRV_DEBUG_LEVEL + McDebugLog_CmdIn(dCmd, pvPrm1, pvPrm2, dPrm); +#endif + + (void)pvPrm2; + + if ((UINT32)MCDRV_INIT == dCmd) { + sdRet = init((struct MCDRV_INIT_INFO *)pvPrm1, + (struct MCDRV_INIT2_INFO *)pvPrm2); + } else if ((UINT32)MCDRV_TERM == dCmd) { + sdRet = term(); + } else if ((UINT32)MCDRV_IRQ == dCmd) { + sdRet = irq_proc(); + } else { + McSrv_Lock(); + + bAP = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_ANA, MCI_AP); + + switch (dCmd) { + case MCDRV_GET_CLOCKSW: + sdRet = get_clocksw( + (struct MCDRV_CLOCKSW_INFO *)pvPrm1); + break; + case MCDRV_SET_CLOCKSW: + sdRet = set_clocksw( + (struct MCDRV_CLOCKSW_INFO *)pvPrm1); + break; + + case MCDRV_GET_PATH: + sdRet = get_path((struct MCDRV_PATH_INFO *)pvPrm1); + break; + case MCDRV_SET_PATH: + if ((bAP&MCB_AP_LDOD) != 0) { + ; + machdep_PreLDODStart(); + } + sdRet = set_path((struct MCDRV_PATH_INFO *)pvPrm1); + bAP = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_ANA, + MCI_AP); + if ((bAP&MCB_AP_LDOD) != 0) { + ; + machdep_PostLDODStart(); + } + break; + + case MCDRV_GET_VOLUME: + sdRet = get_volume((struct MCDRV_VOL_INFO *)pvPrm1); + break; + case MCDRV_SET_VOLUME: + sdRet = set_volume((struct MCDRV_VOL_INFO *)pvPrm1); + break; + + case MCDRV_GET_DIGITALIO: + sdRet = get_digitalio( + (struct MCDRV_DIO_INFO *)pvPrm1); + break; + case MCDRV_SET_DIGITALIO: + sdRet = set_digitalio( + (struct MCDRV_DIO_INFO *)pvPrm1, dPrm); + break; + + case MCDRV_GET_DIGITALIO_PATH: + sdRet = get_digitalio_path( + (struct MCDRV_DIOPATH_INFO *)pvPrm1); + break; + case MCDRV_SET_DIGITALIO_PATH: + sdRet = set_digitalio_path( + (struct MCDRV_DIOPATH_INFO *)pvPrm1, + dPrm); + break; + + case MCDRV_GET_SWAP: + sdRet = get_swap((struct MCDRV_SWAP_INFO *)pvPrm1); + break; + case MCDRV_SET_SWAP: + sdRet = set_swap((struct MCDRV_SWAP_INFO *)pvPrm1, + dPrm); + break; + + case MCDRV_SET_DSP: + if ((bAP&MCB_AP_LDOD) != 0) { + ; + machdep_PreLDODStart(); + } + sdRet = set_dsp((UINT8 *)pvPrm1, dPrm); + bAP = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_ANA, + MCI_AP); + if ((bAP&MCB_AP_LDOD) != 0) { + ; + machdep_PostLDODStart(); + } + break; + case MCDRV_GET_DSP: + sdRet = get_dsp((struct MCDRV_DSP_PARAM *)pvPrm1, + pvPrm2, dPrm); + break; + case MCDRV_GET_DSP_DATA: + sdRet = get_dsp_data((UINT8 *)pvPrm1, dPrm); + break; + case MCDRV_SET_DSP_DATA: + sdRet = set_dsp_data((const UINT8 *)pvPrm1, dPrm); + break; + case MCDRV_REGISTER_DSP_CB: + sdRet = register_dsp_cb( + (SINT32 (*)(SINT32, UINT32, UINT32)) + pvPrm1); + break; + case MCDRV_GET_DSP_TRANSITION: + sdRet = get_dsp_transition(dPrm); + break; + + case MCDRV_GET_HSDET: + sdRet = get_hsdet((struct MCDRV_HSDET_INFO *)pvPrm1, + (struct MCDRV_HSDET2_INFO *)pvPrm2); + break; + case MCDRV_SET_HSDET: + if ((bAP&MCB_AP_LDOD) != 0) { + ; + machdep_PreLDODStart(); + } + sdRet = set_hsdet((struct MCDRV_HSDET_INFO *)pvPrm1, + (struct MCDRV_HSDET2_INFO *)pvPrm2, + dPrm); + bAP = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_ANA, + MCI_AP); + if ((bAP&MCB_AP_LDOD) != 0) { + ; + machdep_PostLDODStart(); + } + break; + + case MCDRV_CONFIG_GP: + sdRet = config_gp((struct MCDRV_GP_MODE *)pvPrm1); + break; + case MCDRV_MASK_GP: + sdRet = mask_gp((UINT8 *)pvPrm1, dPrm); + break; + case MCDRV_GETSET_GP: + sdRet = getset_gp((UINT8 *)pvPrm1, dPrm); + break; + + case MCDRV_READ_REG: + if ((bAP&MCB_AP_LDOD) != 0) { + ; + machdep_PreLDODStart(); + } + sdRet = read_reg((struct MCDRV_REG_INFO *)pvPrm1); + bAP = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_ANA, + MCI_AP); + if ((bAP&MCB_AP_LDOD) != 0) { + ; + machdep_PostLDODStart(); + } + break; + case MCDRV_WRITE_REG: + if ((bAP&MCB_AP_LDOD) != 0) { + ; + machdep_PreLDODStart(); + } + sdRet = write_reg((struct MCDRV_REG_INFO *)pvPrm1); + bAP = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_ANA, + MCI_AP); + if ((bAP&MCB_AP_LDOD) != 0) { + ; + machdep_PostLDODStart(); + } + break; + + default: + break; + } + + McSrv_Unlock(); + } + +#if MCDRV_DEBUG_LEVEL + McDebugLog_CmdOut(dCmd, &sdRet, pvPrm1, pvPrm2, dPrm); +#endif + + return sdRet; +} + diff --git a/sound/soc/codecs/ymu831/mcdriver.h b/sound/soc/codecs/ymu831/mcdriver.h new file mode 100644 index 00000000000..9a36d90e9e2 --- /dev/null +++ b/sound/soc/codecs/ymu831/mcdriver.h @@ -0,0 +1,1078 @@ +/**************************************************************************** + * + * Copyright(c) 2012-2013 Yamaha Corporation. All rights reserved. + * + * Module : mcdriver.h + * + * Description : MC Driver header + * + * Version : 2.0.0 2013.04.09 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + * + ****************************************************************************/ + +#ifndef _MCDRIVER_H_ +#define _MCDRIVER_H_ + +#include "mctypedef.h" + + + +SINT32 McDrv_Ctrl(UINT32 dCmd, void *pvPrm1, void *pvPrm2, UINT32 dPrm); + + + + +/* return value */ +#define MCDRV_SUCCESS ((SINT32)0) +#define MCDRV_ERROR_ARGUMENT (-1) +#define MCDRV_ERROR_TIMEOUT (-2) +#define MCDRV_ERROR_INIT (-3) +#define MCDRV_ERROR_RESOURCEOVER (-4) +#define MCDRV_ERROR_STATE (-5) + +#define MCDRV_ERROR (-10) + + +/* dCmd */ +#define MCDRV_INIT (0) +#define MCDRV_TERM (1) + +#define MCDRV_READ_REG (2) +#define MCDRV_WRITE_REG (3) + +#define MCDRV_GET_CLOCKSW (4) +#define MCDRV_SET_CLOCKSW (5) + +#define MCDRV_GET_PATH (6) +#define MCDRV_SET_PATH (7) + +#define MCDRV_GET_VOLUME (8) +#define MCDRV_SET_VOLUME (9) + +#define MCDRV_GET_DIGITALIO (10) +#define MCDRV_SET_DIGITALIO (11) + +#define MCDRV_GET_DIGITALIO_PATH (12) +#define MCDRV_SET_DIGITALIO_PATH (13) + +#define MCDRV_GET_SWAP (14) +#define MCDRV_SET_SWAP (15) + +#define MCDRV_SET_DSP (16) +#define MCDRV_GET_DSP (17) +#define MCDRV_GET_DSP_DATA (18) +#define MCDRV_SET_DSP_DATA (19) +#define MCDRV_REGISTER_DSP_CB (20) +#define MCDRV_GET_DSP_TRANSITION (21) + +#define MCDRV_IRQ (22) + +#define MCDRV_GET_HSDET (23) +#define MCDRV_SET_HSDET (24) + +#define MCDRV_CONFIG_GP (25) +#define MCDRV_MASK_GP (26) +#define MCDRV_GETSET_GP (27) + +/* pvPrm */ +/* init */ +/* MCDRV_INIT_INFO bCkSel setting */ +#define MCDRV_CKSEL_CMOS_CMOS (0x00) +#define MCDRV_CKSEL_TCXO_TCXO (0x03) +#define MCDRV_CKSEL_CMOS_TCXO (0x02) +#define MCDRV_CKSEL_TCXO_CMOS (0x01) +#define MCDRV_CKSEL_CMOS (0x00) +#define MCDRV_CKSEL_TCXO (0x01) + +/* MCDRV_INIT_INFO bCkInput setting */ +#define MCDRV_CKINPUT_CLKI0_CLKI1 (0x04) +#define MCDRV_CKINPUT_CLKI0_RTCK (0x08) +#define MCDRV_CKINPUT_CLKI0_SBCK (0x0C) +#define MCDRV_CKINPUT_CLKI1_CLKI0 (0x01) +#define MCDRV_CKINPUT_CLKI1_RTCK (0x09) +#define MCDRV_CKINPUT_CLKI1_SBCK (0x0D) +#define MCDRV_CKINPUT_RTC_CLKI0 (0x02) +#define MCDRV_CKINPUT_RTC_CLKI1 (0x06) +#define MCDRV_CKINPUT_RTC_SBCK (0x0E) +#define MCDRV_CKINPUT_SBCK_CLKI0 (0x03) +#define MCDRV_CKINPUT_SBCK_CLKI1 (0x07) +#define MCDRV_CKINPUT_SBCK_RTC (0x0B) +#define MCDRV_CKINPUT_CLKI0_CLKI0 (0x00) +#define MCDRV_CKINPUT_CLKI1_CLKI1 (0x05) +#define MCDRV_CKINPUT_RTC_RTC (0x0A) +#define MCDRV_CKINPUT_SBCK_SBCK (0x0F) + +/* MCDRV_INIT_INFO bPllFreqX setting */ +#define MCDRV_PLLFREQ_73 (0) +#define MCDRV_PLLFREQ_147 (1) + +/* MCDRV_INIT_INFO bHsdetClk setting */ +#define MCDRV_HSDETCLK_RTC (0) +#define MCDRV_HSDETCLK_OSC (1) + +/* MCDRV_INIT_INFO bXXXHiz setting */ +#define MCDRV_DAHIZ_LOW (0) +#define MCDRV_DAHIZ_HIZ (1) + +/* CDRV_INIT_INFO bPcmHiz setting */ +#define MCDRV_PCMHIZ_LOW (0) +#define MCDRV_PCMHIZ_HIZ (1) + +/* MCDRV_INIT_INFO bPowerMode setting */ +#define MCDRV_POWMODE_FULL (0) +#define MCDRV_POWMODE_CDSPDEBUG (255) + +/* MCDRV_INIT_INFO bPaxFunc setting */ +#define MCDRV_PA_GPIO (0) +#define MCDRV_PA_PDMCK (1) +#define MCDRV_PA_PDMDI (1) + +/* MCDRV_INIT_INFO bMbSel setting */ +#define MCDRV_MBSEL_20 (0) +#define MCDRV_MBSEL_21 (1) +#define MCDRV_MBSEL_22 (2) +#define MCDRV_MBSEL_23 (3) + +/* MCDRV_INIT_INFO bMbsDisch setting */ +#define MCDRV_MBSDISCH_0000 (0) +#define MCDRV_MBSDISCH_0001 (1) +#define MCDRV_MBSDISCH_0010 (2) +#define MCDRV_MBSDISCH_0011 (3) +#define MCDRV_MBSDISCH_0100 (4) +#define MCDRV_MBSDISCH_0101 (5) +#define MCDRV_MBSDISCH_0110 (6) +#define MCDRV_MBSDISCH_0111 (7) +#define MCDRV_MBSDISCH_1000 (8) +#define MCDRV_MBSDISCH_1001 (9) +#define MCDRV_MBSDISCH_1010 (10) +#define MCDRV_MBSDISCH_1011 (11) +#define MCDRV_MBSDISCH_1100 (12) +#define MCDRV_MBSDISCH_1101 (13) +#define MCDRV_MBSDISCH_1110 (14) +#define MCDRV_MBSDISCH_1111 (15) + +/* MCDRV_INIT_INFO bNonClip setting */ +#define MCDRV_NONCLIP_OFF (0) +#define MCDRV_NONCLIP_ON (1) + +/* MCDRV_INIT_INFO bLineIn1Dif/bLineOutxDif setting */ +#define MCDRV_LINE_STEREO (0) +#define MCDRV_LINE_DIF (1) + +/* MCDRV_INIT_INFO bMicxSng setting */ +#define MCDRV_MIC_DIF (0) +#define MCDRV_MIC_SINGLE (1) + +/* MCDRV_INIT_INFO bZcLineOutx/bZcRc/bZcSp/bZcHp setting */ +#define MCDRV_ZC_ON (0) +#define MCDRV_ZC_OFF (1) + +/* MCDRV_INIT_INFO bSvolLineOutx/bSvolRc/bSvolSp/bSvolHp setting */ +#define MCDRV_SVOL_OFF (0) +#define MCDRV_SVOL_ON (1) + +/* MCDRV_INIT_INFO bRcHiz setting */ +#define MCDRV_RCIMP_FIXLOW (0) +#define MCDRV_RCIMP_WL (1) + +/* MCDRV_INIT_INFO bSpHiz setting */ +#define MCDRV_WL_LOFF_ROFF (0) +#define MCDRV_WL_LON_ROFF (1) +#define MCDRV_WL_LOFF_RON (2) +#define MCDRV_WL_LON_RON (3) + +/* MCDRV_INIT_INFO bHpHiz/bLineOutxHiz setting */ +#define MCDRV_IMP_LFIXLOW_RFIXLOW (0) +#define MCDRV_IMP_LWL_RFIXLOW (1) +#define MCDRV_IMP_LFIXLOW_RWL (2) +#define MCDRV_IMP_LWL_RWL (3) + +/* MCDRV_INIT_INFO bCpMod setting */ +#define MCDRV_CPMOD_HI (0) +#define MCDRV_CPMOD_MID (1) + +/* MCDRV_INIT_INFO bRbSel setting */ +#define MCDRV_RBSEL_2_2K (0) +#define MCDRV_RBSEL_50 (1) + +/* MCDRV_INIT_INFO bPlugSel setting */ +#define MCDRV_PLUG_LRGM (0) +#define MCDRV_PLUG_LRMG (1) + +/* MCDRV_INIT_INFO bGndDet setting */ +#define MCDRV_GNDDET_OFF (0) +#define MCDRV_GNDDET_ON (1) + +/* MCDRV_INIT_INFO bPpdRc/bPpdSp/bPpdHp/bPpdLineOut1/bPpdLineOut2 + setting */ +#define MCDRV_PPD_OFF (0) +#define MCDRV_PPD_ON (1) + +struct MCDRV_WAIT_TIME { + UINT32 dWaitTime[20]; + UINT32 dPollInterval[20]; + UINT32 dPollTimeOut[20]; +}; + +struct MCDRV_INIT_INFO { + UINT8 bCkSel; + UINT8 bCkInput; + UINT8 bPllModeA; + UINT8 bPllPrevDivA; + UINT16 wPllFbDivA; + UINT16 wPllFracA; + UINT8 bPllFreqA; + UINT8 bPllModeB; + UINT8 bPllPrevDivB; + UINT16 wPllFbDivB; + UINT16 wPllFracB; + UINT8 bPllFreqB; + UINT8 bHsdetClk; + UINT8 bDio0SdoHiz; + UINT8 bDio1SdoHiz; + UINT8 bDio2SdoHiz; + UINT8 bDio0ClkHiz; + UINT8 bDio1ClkHiz; + UINT8 bDio2ClkHiz; + UINT8 bDio0PcmHiz; + UINT8 bDio1PcmHiz; + UINT8 bDio2PcmHiz; + UINT8 bPa0Func; + UINT8 bPa1Func; + UINT8 bPa2Func; + UINT8 bPowerMode; + UINT8 bMbSel1; + UINT8 bMbSel2; + UINT8 bMbSel3; + UINT8 bMbSel4; + UINT8 bMbsDisch; + UINT8 bNonClip; + UINT8 bLineIn1Dif; + UINT8 bLineOut1Dif; + UINT8 bLineOut2Dif; + UINT8 bMic1Sng; + UINT8 bMic2Sng; + UINT8 bMic3Sng; + UINT8 bMic4Sng; + UINT8 bZcLineOut1; + UINT8 bZcLineOut2; + UINT8 bZcRc; + UINT8 bZcSp; + UINT8 bZcHp; + UINT8 bSvolLineOut1; + UINT8 bSvolLineOut2; + UINT8 bSvolRc; + UINT8 bSvolSp; + UINT8 bSvolHp; + UINT8 bRcHiz; + UINT8 bSpHiz; + UINT8 bHpHiz; + UINT8 bLineOut1Hiz; + UINT8 bLineOut2Hiz; + UINT8 bCpMod; + UINT8 bRbSel; + UINT8 bPlugSel; + UINT8 bGndDet; + UINT8 bPpdRc; + UINT8 bPpdSp; + UINT8 bPpdHp; + UINT8 bPpdLineOut1; + UINT8 bPpdLineOut2; + struct MCDRV_WAIT_TIME sWaitTime; +}; + +/* MCDRV_INIT2_INFO bOption[0] setting */ +#define MCDRV_DOA_DRV_LOW (0) +#define MCDRV_DOA_DRV_HIGH (1) + +/* MCDRV_INIT2_INFO bOption[1] setting */ +#define MCDRV_SCKMSK_OFF (0) +#define MCDRV_SCKMSK_ON (1) + +/* MCDRV_INIT2_INFO bOption[2] setting */ +#define MCDRV_SPMN_8_9_10 (0) +#define MCDRV_SPMN_5_6_7 (1) +#define MCDRV_SPMN_4_5_6 (2) +#define MCDRV_SPMN_OFF_9 (3) +#define MCDRV_SPMN_OFF_6 (4) + +struct MCDRV_INIT2_INFO { + UINT8 bOption[20]; +}; + +/* set/get clock switch */ +/* MCDRV_CLOCKSW_INFO bClkSrc setting */ +#define MCDRV_CLKSW_CLKA (0) +#define MCDRV_CLKSW_CLKB (1) + +struct MCDRV_CLOCKSW_INFO { + UINT8 bClkSrc; +}; + +/* set/get path */ +#define MCDRV_D1SRC_MUSICIN_ON (0x00000001) +#define MCDRV_D1SRC_MUSICIN_OFF (0x00000002) +#define MCDRV_D1SRC_EXTIN_ON (0x00000004) +#define MCDRV_D1SRC_EXTIN_OFF (0x00000008) +#define MCDRV_D1SRC_VBOXOUT_ON (0x00000010) +#define MCDRV_D1SRC_VBOXOUT_OFF (0x00000020) +#define MCDRV_D1SRC_VBOXREFOUT_ON (0x00000040) +#define MCDRV_D1SRC_VBOXREFOUT_OFF (0x00000080) +#define MCDRV_D1SRC_AE0_ON (0x00000100) +#define MCDRV_D1SRC_AE0_OFF (0x00000200) +#define MCDRV_D1SRC_AE1_ON (0x00000400) +#define MCDRV_D1SRC_AE1_OFF (0x00000800) +#define MCDRV_D1SRC_AE2_ON (0x00001000) +#define MCDRV_D1SRC_AE2_OFF (0x00002000) +#define MCDRV_D1SRC_AE3_ON (0x00004000) +#define MCDRV_D1SRC_AE3_OFF (0x00008000) +#define MCDRV_D1SRC_ADIF0_ON (0x00010000) +#define MCDRV_D1SRC_ADIF0_OFF (0x00020000) +#define MCDRV_D1SRC_ADIF1_ON (0x00040000) +#define MCDRV_D1SRC_ADIF1_OFF (0x00080000) +#define MCDRV_D1SRC_ADIF2_ON (0x00100000) +#define MCDRV_D1SRC_ADIF2_OFF (0x00200000) +#define MCDRV_D1SRC_HIFIIN_ON (0x00400000) +#define MCDRV_D1SRC_HIFIIN_OFF (0x00800000) +struct MCDRV_D1_CHANNEL { + UINT32 dSrcOnOff; +}; + +#define MCDRV_D2SRC_VOICEIN_ON (0x00000001) +#define MCDRV_D2SRC_VOICEIN_OFF (0x00000002) +#define MCDRV_D2SRC_VBOXIOOUT_ON (0x00000004) +#define MCDRV_D2SRC_VBOXIOOUT_OFF (0x00000008) +#define MCDRV_D2SRC_VBOXHOSTOUT_ON (0x00000010) +#define MCDRV_D2SRC_VBOXHOSTOUT_OFF (0x00000020) +#define MCDRV_D2SRC_ADC0_L_ON (0x00000040) +#define MCDRV_D2SRC_ADC0_L_OFF (0x00000080) +#define MCDRV_D2SRC_ADC0_R_ON (0x00000100) +#define MCDRV_D2SRC_ADC0_R_OFF (0x00000200) +#define MCDRV_D2SRC_ADC1_ON (0x00000400) +#define MCDRV_D2SRC_ADC1_OFF (0x00000800) +#define MCDRV_D2SRC_PDM0_L_ON (0x00001000) +#define MCDRV_D2SRC_PDM0_L_OFF (0x00002000) +#define MCDRV_D2SRC_PDM0_R_ON (0x00004000) +#define MCDRV_D2SRC_PDM0_R_OFF (0x00008000) +#define MCDRV_D2SRC_PDM1_L_ON (0x00010000) +#define MCDRV_D2SRC_PDM1_L_OFF (0x00020000) +#define MCDRV_D2SRC_PDM1_R_ON (0x00040000) +#define MCDRV_D2SRC_PDM1_R_OFF (0x00080000) +#define MCDRV_D2SRC_DAC0REF_ON (0x00100000) +#define MCDRV_D2SRC_DAC0REF_OFF (0x00200000) +#define MCDRV_D2SRC_DAC1REF_ON (0x00400000) +#define MCDRV_D2SRC_DAC1REF_OFF (0x00800000) + +struct MCDRV_D2_CHANNEL { + UINT32 dSrcOnOff; +}; + +#define MCDRV_ASRC_DAC0_L_ON (0x00000001) +#define MCDRV_ASRC_DAC0_L_OFF (0x00000002) +#define MCDRV_ASRC_DAC0_R_ON (0x00000004) +#define MCDRV_ASRC_DAC0_R_OFF (0x00000008) +#define MCDRV_ASRC_DAC1_L_ON (0x00000010) +#define MCDRV_ASRC_DAC1_L_OFF (0x00000020) +#define MCDRV_ASRC_DAC1_R_ON (0x00000040) +#define MCDRV_ASRC_DAC1_R_OFF (0x00000080) +#define MCDRV_ASRC_MIC1_ON (0x00000100) +#define MCDRV_ASRC_MIC1_OFF (0x00000200) +#define MCDRV_ASRC_MIC2_ON (0x00000400) +#define MCDRV_ASRC_MIC2_OFF (0x00000800) +#define MCDRV_ASRC_MIC3_ON (0x00001000) +#define MCDRV_ASRC_MIC3_OFF (0x00002000) +#define MCDRV_ASRC_MIC4_ON (0x00004000) +#define MCDRV_ASRC_MIC4_OFF (0x00008000) +#define MCDRV_ASRC_LINEIN1_L_ON (0x00010000) +#define MCDRV_ASRC_LINEIN1_L_OFF (0x00020000) +#define MCDRV_ASRC_LINEIN1_R_ON (0x00040000) +#define MCDRV_ASRC_LINEIN1_R_OFF (0x00080000) +#define MCDRV_ASRC_LINEIN1_M_ON (0x00100000) +#define MCDRV_ASRC_LINEIN1_M_OFF (0x00200000) + +struct MCDRV_A_CHANNEL { + UINT32 dSrcOnOff; +}; + +#define MUSICOUT_PATH_CHANNELS (2) +#define EXTOUT_PATH_CHANNELS (2) +#define HIFIOUT_PATH_CHANNELS (1) +#define VBOXMIXIN_PATH_CHANNELS (4) +#define AE_PATH_CHANNELS (2) +#define DAC0_PATH_CHANNELS (2) +#define DAC1_PATH_CHANNELS (2) +#define VOICEOUT_PATH_CHANNELS (1) +#define VBOXIOIN_PATH_CHANNELS (1) +#define VBOXHOSTIN_PATH_CHANNELS (1) +#define HOSTOUT_PATH_CHANNELS (1) +#define ADIF0_PATH_CHANNELS (2) +#define ADIF1_PATH_CHANNELS (2) +#define ADIF2_PATH_CHANNELS (2) +#define ADC0_PATH_CHANNELS (2) +#define ADC1_PATH_CHANNELS (1) +#define SP_PATH_CHANNELS (2) +#define HP_PATH_CHANNELS (2) +#define RC_PATH_CHANNELS (1) +#define LOUT1_PATH_CHANNELS (2) +#define LOUT2_PATH_CHANNELS (2) +#define BIAS_PATH_CHANNELS (4) + +struct MCDRV_PATH_INFO { + struct MCDRV_D1_CHANNEL asMusicOut[MUSICOUT_PATH_CHANNELS]; + struct MCDRV_D1_CHANNEL asExtOut[EXTOUT_PATH_CHANNELS]; + struct MCDRV_D1_CHANNEL asHifiOut[HIFIOUT_PATH_CHANNELS]; + struct MCDRV_D1_CHANNEL asVboxMixIn[VBOXMIXIN_PATH_CHANNELS]; + struct MCDRV_D1_CHANNEL asAe0[AE_PATH_CHANNELS]; + struct MCDRV_D1_CHANNEL asAe1[AE_PATH_CHANNELS]; + struct MCDRV_D1_CHANNEL asAe2[AE_PATH_CHANNELS]; + struct MCDRV_D1_CHANNEL asAe3[AE_PATH_CHANNELS]; + struct MCDRV_D1_CHANNEL asDac0[DAC0_PATH_CHANNELS]; + struct MCDRV_D1_CHANNEL asDac1[DAC1_PATH_CHANNELS]; + struct MCDRV_D2_CHANNEL asVoiceOut[VOICEOUT_PATH_CHANNELS]; + struct MCDRV_D2_CHANNEL asVboxIoIn[VBOXIOIN_PATH_CHANNELS]; + struct MCDRV_D2_CHANNEL asVboxHostIn[VBOXHOSTIN_PATH_CHANNELS]; + struct MCDRV_D2_CHANNEL asHostOut[HOSTOUT_PATH_CHANNELS]; + struct MCDRV_D2_CHANNEL asAdif0[ADIF0_PATH_CHANNELS]; + struct MCDRV_D2_CHANNEL asAdif1[ADIF1_PATH_CHANNELS]; + struct MCDRV_D2_CHANNEL asAdif2[ADIF2_PATH_CHANNELS]; + struct MCDRV_A_CHANNEL asAdc0[ADC0_PATH_CHANNELS]; + struct MCDRV_A_CHANNEL asAdc1[ADC1_PATH_CHANNELS]; + struct MCDRV_A_CHANNEL asSp[SP_PATH_CHANNELS]; + struct MCDRV_A_CHANNEL asHp[HP_PATH_CHANNELS]; + struct MCDRV_A_CHANNEL asRc[RC_PATH_CHANNELS]; + struct MCDRV_A_CHANNEL asLout1[LOUT1_PATH_CHANNELS]; + struct MCDRV_A_CHANNEL asLout2[LOUT2_PATH_CHANNELS]; + struct MCDRV_A_CHANNEL asBias[BIAS_PATH_CHANNELS]; +}; + +/* set/get vol */ +#define MCDRV_VOL_UPDATE (0x0001) + +#define MUSICIN_VOL_CHANNELS (2) +#define EXTIN_VOL_CHANNELS (2) +#define VOICEIN_VOL_CHANNELS (2) +#define REFIN_VOL_CHANNELS (2) +#define ADIF0IN_VOL_CHANNELS (2) +#define ADIF1IN_VOL_CHANNELS (2) +#define ADIF2IN_VOL_CHANNELS (2) +#define MUSICOUT_VOL_CHANNELS (2) +#define EXTOUT_VOL_CHANNELS (2) +#define VOICEOUT_VOL_CHANNELS (2) +#define REFOUT_VOL_CHANNELS (2) +#define DAC0OUT_VOL_CHANNELS (2) +#define DAC1OUT_VOL_CHANNELS (2) +#define DPATH_VOL_CHANNELS (2) +#define LINEIN1_VOL_CHANNELS (2) +#define MIC1_VOL_CHANNELS (1) +#define MIC2_VOL_CHANNELS (1) +#define MIC3_VOL_CHANNELS (1) +#define MIC4_VOL_CHANNELS (1) +#define HP_VOL_CHANNELS (2) +#define SP_VOL_CHANNELS (2) +#define RC_VOL_CHANNELS (1) +#define LINEOUT1_VOL_CHANNELS (2) +#define LINEOUT2_VOL_CHANNELS (2) +#define HPDET_VOL_CHANNELS (1) + +struct MCDRV_VOL_INFO { + SINT16 aswD_MusicIn[MUSICIN_VOL_CHANNELS]; + SINT16 aswD_ExtIn[EXTIN_VOL_CHANNELS]; + SINT16 aswD_VoiceIn[VOICEIN_VOL_CHANNELS]; + SINT16 aswD_RefIn[REFIN_VOL_CHANNELS]; + SINT16 aswD_Adif0In[ADIF0IN_VOL_CHANNELS]; + SINT16 aswD_Adif1In[ADIF1IN_VOL_CHANNELS]; + SINT16 aswD_Adif2In[ADIF2IN_VOL_CHANNELS]; + SINT16 aswD_MusicOut[MUSICOUT_VOL_CHANNELS]; + SINT16 aswD_ExtOut[EXTOUT_VOL_CHANNELS]; + SINT16 aswD_VoiceOut[VOICEOUT_VOL_CHANNELS]; + SINT16 aswD_RefOut[REFOUT_VOL_CHANNELS]; + SINT16 aswD_Dac0Out[DAC0OUT_VOL_CHANNELS]; + SINT16 aswD_Dac1Out[DAC1OUT_VOL_CHANNELS]; + SINT16 aswD_DpathDa[DPATH_VOL_CHANNELS]; + SINT16 aswD_DpathAd[DPATH_VOL_CHANNELS]; + SINT16 aswA_LineIn1[LINEIN1_VOL_CHANNELS]; + SINT16 aswA_Mic1[MIC1_VOL_CHANNELS]; + SINT16 aswA_Mic2[MIC2_VOL_CHANNELS]; + SINT16 aswA_Mic3[MIC3_VOL_CHANNELS]; + SINT16 aswA_Mic4[MIC4_VOL_CHANNELS]; + SINT16 aswA_Hp[HP_VOL_CHANNELS]; + SINT16 aswA_Sp[SP_VOL_CHANNELS]; + SINT16 aswA_Rc[RC_VOL_CHANNELS]; + SINT16 aswA_LineOut1[LINEOUT1_VOL_CHANNELS]; + SINT16 aswA_LineOut2[LINEOUT2_VOL_CHANNELS]; + SINT16 aswA_HpDet[HPDET_VOL_CHANNELS]; +}; + +/* set/get digitalio */ +#define MCDRV_MUSIC_COM_UPDATE_FLAG ((UINT32)0x00000001) +#define MCDRV_MUSIC_DIR_UPDATE_FLAG ((UINT32)0x00000002) +#define MCDRV_MUSIC_DIT_UPDATE_FLAG ((UINT32)0x00000004) +#define MCDRV_EXT_COM_UPDATE_FLAG ((UINT32)0x00000008) +#define MCDRV_EXT_DIR_UPDATE_FLAG ((UINT32)0x00000010) +#define MCDRV_EXT_DIT_UPDATE_FLAG ((UINT32)0x00000020) +#define MCDRV_VOICE_COM_UPDATE_FLAG ((UINT32)0x00000040) +#define MCDRV_VOICE_DIR_UPDATE_FLAG ((UINT32)0x00000080) +#define MCDRV_VOICE_DIT_UPDATE_FLAG ((UINT32)0x00000100) +#define MCDRV_HIFI_COM_UPDATE_FLAG ((UINT32)0x00000200) +#define MCDRV_HIFI_DIR_UPDATE_FLAG ((UINT32)0x00000400) +#define MCDRV_HIFI_DIT_UPDATE_FLAG ((UINT32)0x00000800) + +/* MCDRV_DIO_COMMON bMasterSlave setting */ +#define MCDRV_DIO_SLAVE (0) +#define MCDRV_DIO_MASTER (1) + +/* MCDRV_DIO_COMMON bDigitalAutoFs setting */ +#define MCDRV_AUTOFS_OFF (0) +#define MCDRV_AUTOFS_ON (1) + +/* MCDRV_DIO_COMMON bFs setting */ +#define MCDRV_FS_48000 (0) +#define MCDRV_FS_44100 (1) +#define MCDRV_FS_32000 (2) +#define MCDRV_FS_24000 (4) +#define MCDRV_FS_22050 (5) +#define MCDRV_FS_16000 (6) +#define MCDRV_FS_12000 (8) +#define MCDRV_FS_11025 (9) +#define MCDRV_FS_8000 (10) +#define MCDRV_FS_192000 (12) +#define MCDRV_FS_96000 (13) + +/* MCDRV_DIO_COMMON bBckFs setting */ +#define MCDRV_BCKFS_64 (0) +#define MCDRV_BCKFS_48 (1) +#define MCDRV_BCKFS_32 (2) +#define MCDRV_BCKFS_512 (4) +#define MCDRV_BCKFS_256 (5) +#define MCDRV_BCKFS_192 (6) +#define MCDRV_BCKFS_128 (7) +#define MCDRV_BCKFS_96 (8) +#define MCDRV_BCKFS_24 (9) +#define MCDRV_BCKFS_16 (10) +#define MCDRV_BCKFS_8 (11) +#define MCDRV_BCKFS_SLAVE (15) + +/* MCDRV_DIO_COMMON bInterface setting */ +#define MCDRV_DIO_DA (0) +#define MCDRV_DIO_PCM (1) + +/* MCDRV_DIO_COMMON bBckInvert setting */ +#define MCDRV_BCLK_NORMAL (0) +#define MCDRV_BCLK_INVERT (1) + +/* MCDRV_DIO_COMMON bSrcThru setting */ +#define MCDRV_SRC_NOT_THRU (0) +#define MCDRV_SRC_THRU (1) + +/* MCDRV_DIO_COMMON bPcmHizTim setting */ +#define MCDRV_PCMHIZTIM_FALLING (0) +#define MCDRV_PCMHIZTIM_RISING (1) + +/* MCDRV_DIO_COMMON bPcmFrame setting */ +#define MCDRV_PCM_SHORTFRAME (0) +#define MCDRV_PCM_LONGFRAME (1) + +struct MCDRV_DIO_COMMON { + UINT8 bMasterSlave; + UINT8 bAutoFs; + UINT8 bFs; + UINT8 bBckFs; + UINT8 bInterface; + UINT8 bBckInvert; + UINT8 bSrcThru; + UINT8 bPcmHizTim; + UINT8 bPcmFrame; + UINT8 bPcmHighPeriod; +}; + +/* MCDRV_DA_FORMAT bBitSel setting */ +#define MCDRV_BITSEL_16 (0) +#define MCDRV_BITSEL_20 (1) +#define MCDRV_BITSEL_24 (2) +#define MCDRV_BITSEL_32 (3) + +/* MCDRV_DA_FORMAT bMode setting */ +#define MCDRV_DAMODE_HEADALIGN (0) +#define MCDRV_DAMODE_I2S (1) +#define MCDRV_DAMODE_TAILALIGN (2) + +struct MCDRV_DA_FORMAT { + UINT8 bBitSel; + UINT8 bMode; +}; + +/* MCDRV_PCM_FORMAT bMono setting */ +#define MCDRV_PCM_STEREO (0) +#define MCDRV_PCM_MONO (1) + +/* MCDRV_PCM_FORMAT bOrder setting */ +#define MCDRV_PCM_MSB_FIRST (0) +#define MCDRV_PCM_LSB_FIRST (1) + +/* MCDRV_PCM_FORMAT bLaw setting */ +#define MCDRV_PCM_LINEAR (0) +#define MCDRV_PCM_ALAW (1) +#define MCDRV_PCM_MULAW (2) + +/* MCDRV_PCM_FORMAT bBitSel setting */ +#define MCDRV_PCM_BITSEL_8 (0) +#define MCDRV_PCM_BITSEL_16 (1) +#define MCDRV_PCM_BITSEL_24 (2) + +struct MCDRV_PCM_FORMAT { + UINT8 bMono; + UINT8 bOrder; + UINT8 bLaw; + UINT8 bBitSel; +}; + +struct MCDRV_DIO_DIR { + struct MCDRV_DA_FORMAT sDaFormat; + struct MCDRV_PCM_FORMAT sPcmFormat; +}; + +/* MCDRV_DIO_DIT bStMode setting */ +#define MCDRV_STMODE_ZERO (0) +#define MCDRV_STMODE_HOLD (1) + +/* MCDRV_DIO_DIT bEdge setting */ +#define MCDRV_SDOUT_NORMAL (0) +#define MCDRV_SDOUT_AHEAD (1) + +struct MCDRV_DIO_DIT { + UINT8 bStMode; + UINT8 bEdge; + struct MCDRV_DA_FORMAT sDaFormat; + struct MCDRV_PCM_FORMAT sPcmFormat; +}; + +struct MCDRV_DIO_PORT { + struct MCDRV_DIO_COMMON sDioCommon; + struct MCDRV_DIO_DIR sDir; + struct MCDRV_DIO_DIT sDit; +}; + +struct MCDRV_DIO_INFO { + struct MCDRV_DIO_PORT asPortInfo[4]; +}; + +/* set/get digitalio_path */ +#define MCDRV_PHYS0_UPDATE_FLAG ((UINT32)0x00000001) +#define MCDRV_PHYS1_UPDATE_FLAG ((UINT32)0x00000002) +#define MCDRV_PHYS2_UPDATE_FLAG ((UINT32)0x00000004) +#define MCDRV_PHYS3_UPDATE_FLAG ((UINT32)0x00000008) +#define MCDRV_MUSICNUM_UPDATE_FLAG ((UINT32)0x00000010) +#define MCDRV_DIR0SLOT_UPDATE_FLAG ((UINT32)0x00000020) +#define MCDRV_DIR1SLOT_UPDATE_FLAG ((UINT32)0x00000040) +#define MCDRV_DIR2SLOT_UPDATE_FLAG ((UINT32)0x00000080) +#define MCDRV_DIT0SLOT_UPDATE_FLAG ((UINT32)0x00000100) +#define MCDRV_DIT1SLOT_UPDATE_FLAG ((UINT32)0x00000200) +#define MCDRV_DIT2SLOT_UPDATE_FLAG ((UINT32)0x00000400) + +/* MCDRV_DIOPATH_INFO abPhysPort setting */ +#define MCDRV_PHYSPORT_DIO0 (0) +#define MCDRV_PHYSPORT_DIO1 (1) +#define MCDRV_PHYSPORT_DIO2 (2) +#define MCDRV_PHYSPORT_NONE (3) +#define MCDRV_PHYSPORT_SLIM0 (4) +#define MCDRV_PHYSPORT_SLIM1 (5) +#define MCDRV_PHYSPORT_SLIM2 (6) + +/* MCDRV_DIOPATH_INFO bMusicCh setting */ +#define MCDRV_MUSIC_2CH (0) +#define MCDRV_MUSIC_4CH (1) +#define MCDRV_MUSIC_6CH (2) + +struct MCDRV_DIOPATH_INFO { + UINT8 abPhysPort[4]; + UINT8 bMusicCh; + UINT8 abMusicRSlot[3]; + UINT8 abMusicTSlot[3]; +}; + +/* set/get swap */ +#define MCDRV_SWAP_ADIF0_UPDATE_FLAG ((UINT32)0x00000001) +#define MCDRV_SWAP_ADIF1_UPDATE_FLAG ((UINT32)0x00000002) +#define MCDRV_SWAP_ADIF2_UPDATE_FLAG ((UINT32)0x00000004) +#define MCDRV_SWAP_DAC0_UPDATE_FLAG ((UINT32)0x00000008) +#define MCDRV_SWAP_DAC1_UPDATE_FLAG ((UINT32)0x00000010) +#define MCDRV_SWAP_MUSICIN0_UPDATE_FLAG ((UINT32)0x00000020) +#define MCDRV_SWAP_MUSICIN1_UPDATE_FLAG ((UINT32)0x00000040) +#define MCDRV_SWAP_MUSICIN2_UPDATE_FLAG ((UINT32)0x00000080) +#define MCDRV_SWAP_EXTIN_UPDATE_FLAG ((UINT32)0x00000100) +#define MCDRV_SWAP_VOICEIN_UPDATE_FLAG ((UINT32)0x00000200) +#define MCDRV_SWAP_HIFIIN_UPDATE_FLAG ((UINT32)0x00000400) +#define MCDRV_SWAP_MUSICOUT0_UPDATE_FLAG ((UINT32)0x00000800) +#define MCDRV_SWAP_MUSICOUT1_UPDATE_FLAG ((UINT32)0x00001000) +#define MCDRV_SWAP_MUSICOUT2_UPDATE_FLAG ((UINT32)0x00002000) +#define MCDRV_SWAP_EXTOUT_UPDATE_FLAG ((UINT32)0x00004000) +#define MCDRV_SWAP_VOICEOUT_UPDATE_FLAG ((UINT32)0x00008000) +#define MCDRV_SWAP_HIFIOUT_UPDATE_FLAG ((UINT32)0x00010000) + +/* MCDRV_SWAP_INFO bAdif/bDac setting */ +#define MCDRV_SWAP_NORMAL (0) +#define MCDRV_SWAP_SWAP (1) +#define MCDRV_SWAP_MUTE (2) +#define MCDRV_SWAP_CENTER (3) +#define MCDRV_SWAP_MIX (4) +#define MCDRV_SWAP_MONOMIX (5) +#define MCDRV_SWAP_BOTHL (6) +#define MCDRV_SWAP_BOTHR (7) + +/* MCDRV_SWAP_INFO + bMusicIn/bExtIn/bVoiceIn/bHifiIn/bMusicOut/bExtOut/bVoiceOut/bHifiOut + setting */ +#define MCDRV_SWSWAP_NORMAL (0) +#define MCDRV_SWSWAP_BOTH1 (1) +#define MCDRV_SWSWAP_BOTH0 (2) +#define MCDRV_SWSWAP_SWAP (3) + +struct MCDRV_SWAP_INFO { + UINT8 bAdif0; + UINT8 bAdif1; + UINT8 bAdif2; + UINT8 bDac0; + UINT8 bDac1; + UINT8 bMusicIn0; + UINT8 bMusicIn1; + UINT8 bMusicIn2; + UINT8 bExtIn; + UINT8 bVoiceIn; + UINT8 bHifiIn; + UINT8 bMusicOut0; + UINT8 bMusicOut1; + UINT8 bMusicOut2; + UINT8 bExtOut; + UINT8 bVoiceOut; + UINT8 bHifiOut; +}; + +/* get dsp */ +#define MCDRV_DSP_PARAM_CDSP_INPOS (0x00000001UL) +#define MCDRV_DSP_PARAM_CDSP_OUTPOS (0x00000002UL) +#define MCDRV_DSP_PARAM_CDSP_DFIFO_REMAIN (0x00000003UL) +#define MCDRV_DSP_PARAM_CDSP_RFIFO_REMAIN (0x00000004UL) +#define MCDRV_DSP_PARAM_CDSP_FUNCA (0x00000005UL) +#define MCDRV_DSP_PARAM_CDSP_FUNCB (0x00000006UL) +#define MCDRV_DSP_PARAM_FDSP_DXRAM (0x10000001UL) +#define MCDRV_DSP_PARAM_FDSP_DYRAM (0x10000002UL) +#define MCDRV_DSP_PARAM_FDSP_IRAM (0x10000003UL) +#define MCDRV_DSP_PARAM_EDSP_E2RES (0x20000001UL) + +struct MCDRV_DSP_PARAM { + UINT32 dType; + UINT32 dInfo; +}; + +/* get transition */ +#define MCDRV_DSPTYPE_FDSP (0) +#define MCDRV_DSPTYPE_BDSP (1) + +/* register dsp cb */ +#define MCDRV_AE_EVT_STOP (1) +#define MCDRV_AE_EVT_APPSTOP (2) +#define MCDRV_AE_EVT_APPREQ (3) +#define MCDRV_AE_EVT_COEFDONE (4) +#define MCDRV_AE_EVT_ERROR (5) +#define MCDRV_CDSP_EVT_ERROR (11) +#define MCDRV_CDSP_EVT_PARAM (12) +#define MCDRV_CDSP_ENV_END (13) +#define MCDRV_CDSP_EVT_FIFO (14) +#define MCDRV_EDSP_EVT_E2PARAM (21) + +/* set/get hsdet */ +#define MCDRV_ENPLUGDET_UPDATE_FLAG (0x00000001UL) +#define MCDRV_ENPLUGDETDB_UPDATE_FLAG (0x00000002UL) +#define MCDRV_ENDLYKEYOFF_UPDATE_FLAG (0x00000004UL) +#define MCDRV_ENDLYKEYON_UPDATE_FLAG (0x00000008UL) +#define MCDRV_ENMICDET_UPDATE_FLAG (0x00000010UL) +#define MCDRV_ENKEYOFF_UPDATE_FLAG (0x00000020UL) +#define MCDRV_ENKEYON_UPDATE_FLAG (0x00000040UL) +#define MCDRV_HSDETDBNC_UPDATE_FLAG (0x00000080UL) +#define MCDRV_KEYOFFMTIM_UPDATE_FLAG (0x00000100UL) +#define MCDRV_KEYONMTIM_UPDATE_FLAG (0x00000200UL) +#define MCDRV_KEY0OFFDLYTIM_UPDATE_FLAG (0x00000400UL) +#define MCDRV_KEY1OFFDLYTIM_UPDATE_FLAG (0x00000800UL) +#define MCDRV_KEY2OFFDLYTIM_UPDATE_FLAG (0x00001000UL) +#define MCDRV_KEY0ONDLYTIM_UPDATE_FLAG (0x00002000UL) +#define MCDRV_KEY1ONDLYTIM_UPDATE_FLAG (0x00004000UL) +#define MCDRV_KEY2ONDLYTIM_UPDATE_FLAG (0x00008000UL) +#define MCDRV_KEY0ONDLYTIM2_UPDATE_FLAG (0x00010000UL) +#define MCDRV_KEY1ONDLYTIM2_UPDATE_FLAG (0x00020000UL) +#define MCDRV_KEY2ONDLYTIM2_UPDATE_FLAG (0x00040000UL) +#define MCDRV_IRQTYPE_UPDATE_FLAG (0x00080000UL) +#define MCDRV_DETINV_UPDATE_FLAG (0x00100000UL) +#define MCDRV_HSDETMODE_UPDATE_FLAG (0x00200000UL) +#define MCDRV_SPERIOD_UPDATE_FLAG (0x00400000UL) +#define MCDRV_LPERIOD_UPDATE_FLAG (0x00800000UL) +#define MCDRV_DBNCNUMPLUG_UPDATE_FLAG (0x01000000UL) +#define MCDRV_DBNCNUMMIC_UPDATE_FLAG (0x02000000UL) +#define MCDRV_DBNCNUMKEY_UPDATE_FLAG (0x04000000UL) +#define MCDRV_SGNL_UPDATE_FLAG (0x08000000UL) +#define MCDRV_IMPSEL_UPDATE_FLAG (0x10000000UL) +#define MCDRV_DLYIRQSTOP_UPDATE_FLAG (0x20000000UL) +#define MCDRV_CBFUNC_UPDATE_FLAG (0x40000000UL) + +/* MCDRV_HSDET_INFO bEnPlugDet setting */ +#define MCDRV_PLUGDET_DISABLE (0) +#define MCDRV_PLUGDET_ENABLE (1) + +/* MCDRV_HSDET_INFO bEnPlugDetDb setting */ +#define MCDRV_PLUGDETDB_DISABLE (0) +#define MCDRV_PLUGDETDB_DET_ENABLE (1) +#define MCDRV_PLUGDETDB_UNDET_ENABLE (2) +#define MCDRV_PLUGDETDB_BOTH_ENABLE (3) + +/* MCDRV_HSDET_INFO + bEnDlyKeyOff/bEnDlyKeyOn/bEnKeyOff/bEnKeyOn setting */ +#define MCDRV_KEYEN_D_D_D (0) +#define MCDRV_KEYEN_D_D_E (1) +#define MCDRV_KEYEN_D_E_D (2) +#define MCDRV_KEYEN_D_E_E (3) +#define MCDRV_KEYEN_E_D_D (4) +#define MCDRV_KEYEN_E_D_E (5) +#define MCDRV_KEYEN_E_E_D (6) +#define MCDRV_KEYEN_E_E_E (7) + +/* MCDRV_HSDET_INFO bEnMicDet setting */ +#define MCDRV_MICDET_DISABLE (0) +#define MCDRV_MICDET_ENABLE (1) + +/* MCDRV_HSDET_INFO bHsDetDbnc setting */ +#define MCDRV_DETDBNC_27 (0) +#define MCDRV_DETDBNC_55 (1) +#define MCDRV_DETDBNC_109 (2) +#define MCDRV_DETDBNC_219 (3) +#define MCDRV_DETDBNC_438 (4) +#define MCDRV_DETDBNC_875 (5) +#define MCDRV_DETDBNC_1313 (6) +#define MCDRV_DETDBNC_1750 (7) + +/* MCDRV_HSDET_INFO bKeyOffMtim setting */ +#define MCDRV_KEYOFF_MTIM_63 (0) +#define MCDRV_KEYOFF_MTIM_16 (1) + +/* MCDRV_HSDET_INFO bKeyOnMtim setting */ +#define MCDRV_KEYON_MTIM_63 (0) +#define MCDRV_KEYON_MTIM_250 (1) + +/* MCDRV_HSDET_INFO bKeyOffDlyTim setting */ +#define MC_DRV_KEYOFFDLYTIM_MAX (15) + +/* MCDRV_HSDET_INFO bKeyOnDlyTim setting */ +#define MC_DRV_KEYONDLYTIM_MAX (15) + +/* MCDRV_HSDET_INFO bKeyOnDlyTim2 setting */ +#define MC_DRV_KEYONDLYTIM2_MAX (15) + +/* MCDRV_HSDET_INFO bIrqType setting */ +#define MCDRV_IRQTYPE_NORMAL (0) +#define MCDRV_IRQTYPE_REF (1) +#define MCDRV_IRQTYPE_EX (2) + +/* MCDRV_HSDET_INFO bDetInInv setting */ +#define MCDRV_DET_IN_NORMAL (0) +#define MCDRV_DET_IN_INV (1) +#define MCDRV_DET_IN_NORMAL_NORMAL (4) +#define MCDRV_DET_IN_INV_NORMAL (5) +#define MCDRV_DET_IN_NORMAL_INV (6) +#define MCDRV_DET_IN_INV_INV (7) + +/* MCDRV_HSDET_INFO bHsDetMode setting */ +#define MCDRV_HSDET_MODE_DETIN_A (4) +#define MCDRV_HSDET_MODE_DETIN_B (6) + +/* MCDRV_HSDET_INFO bSperiod setting */ +#define MCDRV_SPERIOD_244 (0) +#define MCDRV_SPERIOD_488 (1) +#define MCDRV_SPERIOD_977 (2) +#define MCDRV_SPERIOD_1953 (3) +#define MCDRV_SPERIOD_3906 (4) +#define MCDRV_SPERIOD_7813 (5) +#define MCDRV_SPERIOD_15625 (6) +#define MCDRV_SPERIOD_31250 (7) + +/* MCDRV_HSDET_INFO bLperiod setting */ +#define MCDRV_LPERIOD_3906 (0) +#define MCDRV_LPERIOD_62500 (1) +#define MCDRV_LPERIOD_125000 (2) +#define MCDRV_LPERIOD_250000 (3) + +/* MCDRV_HSDET_INFO bDbncNum setting */ +#define MCDRV_DBNC_NUM_2 (0) +#define MCDRV_DBNC_NUM_3 (1) +#define MCDRV_DBNC_NUM_4 (2) +#define MCDRV_DBNC_NUM_7 (3) + +/* MCDRV_HSDET_INFO bSgnlPeriod setting */ +#define MCDRV_SGNLPERIOD_61 (0) +#define MCDRV_SGNLPERIOD_79 (1) +#define MCDRV_SGNLPERIOD_97 (2) +#define MCDRV_SGNLPERIOD_151 (3) + +/* MCDRV_HSDET_INFO bSgnlNum setting */ +#define MCDRV_SGNLNUM_1 (0) +#define MCDRV_SGNLNUM_4 (1) +#define MCDRV_SGNLNUM_6 (2) +#define MCDRV_SGNLNUM_8 (3) +#define MCDRV_SGNLNUM_NONE (255) + +/* MCDRV_HSDET_INFO bSgnlPeak setting */ +#define MCDRV_SGNLPEAK_500 (0) +#define MCDRV_SGNLPEAK_730 (1) +#define MCDRV_SGNLPEAK_960 (2) +#define MCDRV_SGNLPEAK_1182 (3) + +/* MCDRV_HSDET_INFO bImpSel setting */ +#define MCDRV_IMPSEL_MOSTFREQ (0) +#define MCDRV_IMPSEL_MIN (1) + +/* MCDRV_HSDET_INFO bDlyIrqStop setting */ +#define MCDRV_DLYIRQ_DONTCARE (0) +#define MCDRV_DLYIRQ_STOP (1) + + +#define MCDRV_HSDET_EVT_PLUGDET_DB_FLAG (0x00000001) +#define MCDRV_HSDET_EVT_PLUGUNDET_DB_FLAG (0x00000002) +#define MCDRV_HSDET_EVT_PLUGDET_FLAG (0x00000080) +#define MCDRV_HSDET_EVT_DLYKEYON0_FLAG (0x00000100) +#define MCDRV_HSDET_EVT_DLYKEYON1_FLAG (0x00000200) +#define MCDRV_HSDET_EVT_DLYKEYON2_FLAG (0x00000400) +#define MCDRV_HSDET_EVT_DLYKEYOFF0_FLAG (0x00000800) +#define MCDRV_HSDET_EVT_DLYKEYOFF1_FLAG (0x00001000) +#define MCDRV_HSDET_EVT_DLYKEYOFF2_FLAG (0x00002000) +#define MCDRV_HSDET_EVT_KEYON0_FLAG (0x00010000) +#define MCDRV_HSDET_EVT_KEYON1_FLAG (0x00020000) +#define MCDRV_HSDET_EVT_KEYON2_FLAG (0x00040000) +#define MCDRV_HSDET_EVT_KEYOFF0_FLAG (0x00080000) +#define MCDRV_HSDET_EVT_KEYOFF1_FLAG (0x00100000) +#define MCDRV_HSDET_EVT_KEYOFF2_FLAG (0x00200000) +#define MCDRV_HSDET_EVT_MICDET_FLAG (0x00400000) +#define MCDRV_HSDET_EVT_SENSEFIN_FLAG (0x80000000) + +struct MCDRV_HSDET_RES { + UINT8 bKeyCnt0; + UINT8 bKeyCnt1; + UINT8 bKeyCnt2; + UINT8 bPlugRev; + UINT8 bHpImpClass; + UINT16 wHpImp; +}; +typedef void (*CBFUNC)(UINT32 dFlags, struct MCDRV_HSDET_RES *psRes); + +struct MCDRV_HSDET_INFO { + UINT8 bEnPlugDet; + UINT8 bEnPlugDetDb; + UINT8 bEnDlyKeyOff; + UINT8 bEnDlyKeyOn; + UINT8 bEnMicDet; + UINT8 bEnKeyOff; + UINT8 bEnKeyOn; + UINT8 bHsDetDbnc; + UINT8 bKeyOffMtim; + UINT8 bKeyOnMtim; + UINT8 bKey0OffDlyTim; + UINT8 bKey1OffDlyTim; + UINT8 bKey2OffDlyTim; + UINT8 bKey0OnDlyTim; + UINT8 bKey1OnDlyTim; + UINT8 bKey2OnDlyTim; + UINT8 bKey0OnDlyTim2; + UINT8 bKey1OnDlyTim2; + UINT8 bKey2OnDlyTim2; + UINT8 bIrqType; + UINT8 bDetInInv; + UINT8 bHsDetMode; + UINT8 bSperiod; + UINT8 bLperiod; + UINT8 bDbncNumPlug; + UINT8 bDbncNumMic; + UINT8 bDbncNumKey; + UINT8 bSgnlPeriod; + UINT8 bSgnlNum; + UINT8 bSgnlPeak; + UINT8 bImpSel; + UINT8 bDlyIrqStop; + CBFUNC cbfunc; +}; + +struct MCDRV_HSDET2_INFO { + UINT8 bPlugDetDbIrqType; + UINT8 bPlugUndetDbIrqType; + UINT8 bMicDetIrqType; + UINT8 bPlugDetIrqType; + UINT8 bKey0OnIrqType; + UINT8 bKey1OnIrqType; + UINT8 bKey2OnIrqType; + UINT8 bKey0OffIrqType; + UINT8 bKey1OffIrqType; + UINT8 bKey2OffIrqType; +}; + +/* config gp */ +/* MCDRV_GP_MODE abGpDdr setting */ +#define MCDRV_GPDDR_IN (0) +#define MCDRV_GPDDR_OUT (1) + +/* MCDRV_GP_MODE abGpHost setting */ +#define MCDRV_GPHOST_CPU (0) +#define MCDRV_GPHOST_CDSP (1) + +/* MCDRV_GP_MODE abGpInvert setting */ +#define MCDRV_GPINV_NORMAL (0) +#define MCDRV_GPINV_INVERT (1) + +struct MCDRV_GP_MODE { + UINT8 abGpDdr[3]; + UINT8 abGpHost[3]; + UINT8 abGpInvert[3]; +}; + +/* mask gp */ +#define MCDRV_GPMASK_OFF (0) +#define MCDRV_GPMASK_ON (1) + +#define MCDRV_GP_PAD0 ((UINT32)0) +#define MCDRV_GP_PAD1 ((UINT32)1) +#define MCDRV_GP_PAD2 ((UINT32)2) + +/* getset gp */ +#define MCDRV_GP_LOW (0) +#define MCDRV_GP_HIGH (1) + +/* read/write reg */ +#define MCDRV_REGTYPE_IF (0) +#define MCDRV_REGTYPE_A (1) +#define MCDRV_REGTYPE_MA (2) +#define MCDRV_REGTYPE_MB (3) +#define MCDRV_REGTYPE_B (4) +#define MCDRV_REGTYPE_E (5) +#define MCDRV_REGTYPE_C (6) +#define MCDRV_REGTYPE_F (7) +#define MCDRV_REGTYPE_ANA (8) +#define MCDRV_REGTYPE_CD (9) + +struct MCDRV_REG_INFO { + UINT8 bRegType; + UINT8 bAddress; + UINT8 bData; +}; + + +#endif /* _MCDRIVER_H_ */ diff --git a/sound/soc/codecs/ymu831/mcedspdrv.c b/sound/soc/codecs/ymu831/mcedspdrv.c new file mode 100644 index 00000000000..dc96e00f9f2 --- /dev/null +++ b/sound/soc/codecs/ymu831/mcedspdrv.c @@ -0,0 +1,1262 @@ +/**************************************************************************** + * + * Copyright(c) 2012 Yamaha Corporation. All rights reserved. + * + * Module : mcedspdrv.c + * + * Description : MC Edsp Driver + * + * Version : 1.0.0 2012.12.13 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + * + ****************************************************************************/ +#include "mctypedef.h" +#include "mcdevif.h" +#include "mcdefs.h" +#include "mcresctrl.h" +#include "mcedspdrv.h" + + +/* inside definition */ +#define EDSP_STATUS_IDLE (0) +#define EDSP_STATUS_INITED (1) + +#define CHUNK_SIZE (8) + +#define AEC_EDSP_TAG_IMEM (0x00002000) +#define AEC_EDSP_TAG_XMEM (0x00002100) +#define AEC_EDSP_TAG_YMEM (0x00002200) +#define AEC_EDSP_TAG_REG (0x00002300) + +#define MEM_FIX_SIZE (4) + +#define REG_UNIT_NUM (9) +#define REG_FIX_SIZE (4) +#define REG_COMMAND (0) +#define REG_REQ_0 (1) +#define REG_REQ_7 (8) +#define REG_REQ_NUM (8) +#define REG_STATUS (0) +#define REG_RES_NUM (8) + +#define E1_COMMAND_RUN_MODE (0x40) +#define E1_COMMAND_SLEEP_MODE (0x00) +#define E1_COMMAND_OFFSET_START (0x02) +#define E1_COMMAND_OFFSET_STOP (0x00) +#define E1_COMMAND_IMPEDANCE_START (0x81) +#define E1_COMMAND_IMPEDANCE_STOP (0x80) +#define OFFSET_START (1) +#define OFFSET_STOP (0) +#define IMPEDANCE_START (1) +#define IMPEDANCE_STOP (0) + +#define SYSEQ_NUM (15) +#define BAND_NUM (3) +#define SYSEQ_MODIFY_0 (1) +#define SYSEQ_MODIFY_1 (2) +#define SYSEQ_MODIFY_2 (4) +#define SYSEQ_NO_MODIFY (0) + +/* inside Typedef Struct */ +struct MCDRV_EDSP_AEC_E_INFO { + UINT8 bOnOff; + UINT8 *pbChunkData; + UINT32 dwSize; + + UINT8 *pbIMem; + UINT32 dIMemSize; + UINT8 *pbXMem; + UINT32 dXMemSize; + UINT8 *pbYMem; + UINT32 dYMemSize; + UINT8 *pbReg; + UINT32 dCmdCount; +}; + +struct MCDRV_EDSP_AEC_EDSP_INFO { + struct MCDRV_EDSP_AEC_E_INFO sE2; +}; + +struct MCDRV_EDSP_INFO { + UINT32 dStatus; + SINT32(*cbfuncE2)(SINT32, UINT32, UINT32); + UINT8 bSysEq0Modify; + UINT8 abSysEq0[SYSEQ_NUM * BAND_NUM]; + UINT8 bSysEq1Modify; + UINT8 abSysEq1[SYSEQ_NUM * BAND_NUM]; +}; + +static struct MCDRV_EDSP_INFO gsEdspInfo = { + EDSP_STATUS_IDLE, + NULL, + (SYSEQ_MODIFY_0 | SYSEQ_MODIFY_1 | SYSEQ_MODIFY_2), + { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + }, + (SYSEQ_MODIFY_0 | SYSEQ_MODIFY_1 | SYSEQ_MODIFY_2), + { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + } +}; + +/**************************************************************************** + * CreateUINT32 + * + * Description: + * Create UINT32 Value + * Arguments: + * b0 31-24bit value + * b1 23-16bit value + * b2 15-8bit value + * b3 7-0bit value + * Return: + * UINT32 Value + * + ****************************************************************************/ +static UINT32 CreateUINT32(UINT8 b0, UINT8 b1, UINT8 b2, UINT8 b3) +{ + return ((UINT32)b0 << 24) | ((UINT32)b1 << 16) + | ((UINT32)b2 << 8) | (UINT32)b3; +} + +/*************************************************************************** + * GetEDSPChunk + * + * Function: + * Get E2 chunk + * Arguments: + * psPrm Pointer of aec info + * psEdspInfo Pointer of aec edsp info + * Return: + * none + * + ****************************************************************************/ +static void GetEDSPChunk(struct MCDRV_AEC_INFO *psPrm, + struct MCDRV_EDSP_AEC_EDSP_INFO *psEdspInfo) +{ + psEdspInfo->sE2.bOnOff = EDSP_E_OFF; + psEdspInfo->sE2.pbChunkData = NULL; + psEdspInfo->sE2.dwSize = 0; + + if (psPrm->sE2.bEnable == AEC_EDSP_ENABLE) { + psEdspInfo->sE2.bOnOff = psPrm->sE2.bE2OnOff; + + if (psEdspInfo->sE2.bOnOff == EDSP_E_OFF) + return; + + psEdspInfo->sE2.pbChunkData = + psPrm->sE2.sE2Config.pbChunkData; + psEdspInfo->sE2.dwSize = psPrm->sE2.sE2Config.dwSize; + } + + if (psEdspInfo->sE2.pbChunkData != NULL) + psEdspInfo->sE2.pbChunkData = + &psEdspInfo->sE2.pbChunkData[CHUNK_SIZE]; + + return; +} + +/*************************************************************************** + * EdspChunkAnalyze + * + * Function: + * Analyze e2 chunk + * Arguments: + * psEdspInfo Pointer of aec info + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR_ARGUMENT + * + ****************************************************************************/ +static SINT32 EdspChunkAnalyze(struct MCDRV_EDSP_AEC_EDSP_INFO *psEdspInfo) +{ + UINT32 dChunkTop; + UINT32 dChunkId; + UINT32 dChunkSize; + UINT8 *pbPrm; + UINT32 dSize; + UINT32 dTemp; + struct MCDRV_EDSP_AEC_E_INFO *psEInfo; + + psEInfo = &psEdspInfo->sE2; + if (psEInfo->bOnOff == EDSP_E_OFF) + return MCDRV_SUCCESS; + + psEInfo->pbIMem = NULL; + psEInfo->dIMemSize = 0; + psEInfo->pbXMem = NULL; + psEInfo->dXMemSize = 0; + psEInfo->pbYMem = NULL; + psEInfo->dYMemSize = 0; + psEInfo->pbReg = NULL; + psEInfo->dCmdCount = 0; + + if ((psEInfo->pbChunkData == NULL) || (psEInfo->dwSize == 0)) + return MCDRV_SUCCESS; + + pbPrm = psEInfo->pbChunkData; + dSize = psEInfo->dwSize; + + dChunkTop = 0UL; + while (dChunkTop < dSize) { + if (dSize < (dChunkTop + (UINT32)CHUNK_SIZE)) + return MCDRV_ERROR_ARGUMENT; + + dChunkId = CreateUINT32(pbPrm[dChunkTop + 0UL], + pbPrm[dChunkTop + 1UL], + pbPrm[dChunkTop + 2UL], + pbPrm[dChunkTop + 3UL]); + dChunkSize = CreateUINT32(pbPrm[dChunkTop + 4UL], + pbPrm[dChunkTop + 5UL], + pbPrm[dChunkTop + 6UL], + pbPrm[dChunkTop + 7UL]); + + if (dSize < (dChunkTop + (UINT32)CHUNK_SIZE + dChunkSize)) + return MCDRV_ERROR_ARGUMENT; + + dChunkTop += (UINT32)CHUNK_SIZE; + switch (dChunkId) { + case AEC_EDSP_TAG_IMEM: + if (dSize < MEM_FIX_SIZE) + return MCDRV_ERROR_ARGUMENT; + + dTemp = CreateUINT32(pbPrm[dChunkTop + 0UL], + pbPrm[dChunkTop + 1UL], + pbPrm[dChunkTop + 2UL], + pbPrm[dChunkTop + 3UL]); + + if (dTemp == 0UL) + break; + if ((dTemp % 3UL) != 0UL) + return MCDRV_ERROR_ARGUMENT; + if (dChunkSize < (dTemp + (UINT32)MEM_FIX_SIZE)) + return MCDRV_ERROR_ARGUMENT; + if (psEInfo->pbIMem != NULL) + return MCDRV_ERROR_ARGUMENT; + + psEInfo->pbIMem = &pbPrm[dChunkTop + MEM_FIX_SIZE]; + psEInfo->dIMemSize = dTemp; + break; + + case AEC_EDSP_TAG_XMEM: + if (dSize < MEM_FIX_SIZE) + return MCDRV_ERROR_ARGUMENT; + + dTemp = CreateUINT32(pbPrm[dChunkTop + 0UL], + pbPrm[dChunkTop + 1UL], + pbPrm[dChunkTop + 2UL], + pbPrm[dChunkTop + 3UL]); + + if (dTemp == 0UL) + break; + if ((dTemp & 0x07UL) != 0UL) + return MCDRV_ERROR_ARGUMENT; + if (dChunkSize < (dTemp + (UINT32)MEM_FIX_SIZE)) + return MCDRV_ERROR_ARGUMENT; + if (psEInfo->pbXMem != NULL) + return MCDRV_ERROR_ARGUMENT; + + psEInfo->pbXMem = &pbPrm[dChunkTop + MEM_FIX_SIZE]; + psEInfo->dXMemSize = dTemp; + break; + + case AEC_EDSP_TAG_YMEM: + if (dSize < MEM_FIX_SIZE) + return MCDRV_ERROR_ARGUMENT; + + dTemp = CreateUINT32(pbPrm[dChunkTop + 0UL], + pbPrm[dChunkTop + 1UL], + pbPrm[dChunkTop + 2UL], + pbPrm[dChunkTop + 3UL]); + + if (dTemp == 0UL) + break; + if ((dTemp % 3UL) != 0UL) + return MCDRV_ERROR_ARGUMENT; + if (dChunkSize < (dTemp + (UINT32)MEM_FIX_SIZE)) + return MCDRV_ERROR_ARGUMENT; + + if (psEInfo->pbYMem != NULL) + return MCDRV_ERROR_ARGUMENT; + + psEInfo->pbYMem = &pbPrm[dChunkTop + MEM_FIX_SIZE]; + psEInfo->dYMemSize = dTemp; + break; + + case AEC_EDSP_TAG_REG: + if (dSize < REG_FIX_SIZE) + return MCDRV_ERROR_ARGUMENT; + + dTemp = CreateUINT32(pbPrm[dChunkTop + 0UL], + pbPrm[dChunkTop + 1UL], + pbPrm[dChunkTop + 2UL], + pbPrm[dChunkTop + 3UL]); + + if (dTemp == 0UL) + break; + if (dTemp != REG_UNIT_NUM) + return MCDRV_ERROR_ARGUMENT; + if (dChunkSize < (dTemp + (UINT32)REG_FIX_SIZE)) + return MCDRV_ERROR_ARGUMENT; + if (psEInfo->pbReg != NULL) + return MCDRV_ERROR_ARGUMENT; + + psEInfo->pbReg = &pbPrm[dChunkTop + MEM_FIX_SIZE]; + psEInfo->dCmdCount = 1; + break; + + default: + break; + } + dChunkTop += dChunkSize; + } + + return MCDRV_SUCCESS; +} + +/*************************************************************************** + * SetFirmware + * + * Function: + * data download + * Arguments: + * psEdspInfo Pointer of aec info + * Return: + * none + * + ****************************************************************************/ +static void SetFirmware(struct MCDRV_EDSP_AEC_EDSP_INFO *psEdspInfo) +{ + UINT8 bData; + UINT32 i; + struct MCDRV_EDSP_AEC_E_INFO *psEInfo; + + psEInfo = &psEdspInfo->sE2; + if (psEInfo->bOnOff == EDSP_E_OFF) + return; + + if ((psEInfo->pbIMem == NULL) && + (psEInfo->pbXMem == NULL) && + (psEInfo->pbYMem == NULL)) + return; + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_E2DSP), + (UINT8)MCB_E2DSP_RST); + + /* E2IMEM */ + if (psEInfo->pbIMem != NULL) { + bData = MCB_EDSP_FW_PAGE_E2IMEM; + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_EDSP_FW_PAGE), + (UINT8)bData); + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_EDSP_FW_A), + (UINT8)0x00); + + for (i = 0; i < psEInfo->dIMemSize; ++i) + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_EDSP_FW_D), + psEInfo->pbIMem[i]); + + McDevIf_ExecutePacket(); + } + + /* E2YMEM */ + if (psEInfo->pbYMem != NULL) { + bData = MCB_EDSP_FW_PAGE_E2YMEM; + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_EDSP_FW_PAGE), + (UINT8)bData); + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_EDSP_FW_A), + (UINT8)0x00); + + for (i = 0; i < psEInfo->dYMemSize; ++i) + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_EDSP_FW_D), + psEInfo->pbYMem[i]); + + McDevIf_ExecutePacket(); + } + + + /* E2XMEM */ + if (psEInfo->pbXMem != NULL) { + bData = MCB_EDSP_FW_PAGE_E2XMEM; + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_EDSP_FW_PAGE), + (UINT8)bData); + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_EDSP_FW_A), + (UINT8)0x00); + + for (i = 0; i < psEInfo->dXMemSize; ++i) + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_EDSP_FW_D), + psEInfo->pbXMem[i]); + + McDevIf_ExecutePacket(); + } + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_EDSP_FW_PAGE), + (UINT8)MCI_EDSP_FW_PAGE_DEF); + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_E2DSP), + (UINT8)0x00); + McDevIf_ExecutePacket(); +} + +/*************************************************************************** + * WriteCommandE2 + * + * Function: + * Write e2 command + * Arguments: + * pbPrm Pointer of e2 command data + * Return: + * none + * + ****************************************************************************/ +static void WriteCommandE2(UINT8 *pbPrm) +{ + UINT32 i; + for (i = 0; i < REG_REQ_NUM; ++i) + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_E + | ((UINT32)MCI_E2REQ_0 + i)), + (UINT8)pbPrm[REG_REQ_0 + i]); + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_E2COMMAND), + (UINT8)pbPrm[REG_COMMAND]); + McDevIf_ExecutePacket(); +} + +/*************************************************************************** + * SetCommand + * + * Function: + * Set command + * Arguments: + * psEdspInfo Pointer of aec info + * Return: + * none + * + ****************************************************************************/ +static void SetCommand(struct MCDRV_EDSP_AEC_EDSP_INFO *psEdspInfo) +{ + UINT8 *pData; + + if ((psEdspInfo->sE2.bOnOff != EDSP_E_OFF) && + (psEdspInfo->sE2.pbReg != NULL) && + (0 < psEdspInfo->sE2.dCmdCount)) { + + pData = psEdspInfo->sE2.pbReg; + WriteCommandE2(&pData[0]); + } +} + +/*************************************************************************** + * SetE + * + * Function: + * Set EDSP + * Arguments: + * psEdspInfo Pointer of aec info + * Return: + * none + * + ****************************************************************************/ +static void SetE(struct MCDRV_EDSP_AEC_EDSP_INFO *psEdspInfo) +{ + SetFirmware(psEdspInfo); + + SetCommand(psEdspInfo); +} + +/*************************************************************************** + * EnableIrq + * + * Function: + * Interrupt enable + * Arguments: + * none + * Return: + * none + * + ****************************************************************************/ +static void EnableIrq(void) +{ + UINT8 bData; + + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_IF | (UINT32)MCI_EEDSP), + &bData, 1); + + bData |= MCB_EE2DSP; + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_EEDSP), + (UINT8)bData); +} + +/*************************************************************************** + * DisableIrq + * + * Function: + * + * Arguments: + * none + * Return: + * none + * + ****************************************************************************/ +static void DisableIrq(void) +{ + UINT8 bData; + + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_IF | (UINT32)MCI_EEDSP), + &bData, 1); + + bData &= ~MCB_EE2DSP; + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_EEDSP), + (UINT8)bData); +} + +/*************************************************************************** + * E1Download1Band + * + * Function: + * E1 SysEq data download + * Arguments: + * pbSysEq0 SysEq0 data + * pbSysEq1 SysEq1 data + * bSysEqEnbReg E-DSP #9 register set + * Return: + * MCDRV_SUCCESS + * + ****************************************************************************/ +SINT32 E1Download1Band(UINT8 *pbSysEq0, UINT8 *pbSysEq1, UINT8 bSysEqEnbReg) +{ + UINT8 bOrgSysEqEnbReg; + UINT32 i; + + bOrgSysEqEnbReg = bSysEqEnbReg; + if (pbSysEq0 != NULL) { + for (i = 0; i < SYSEQ_NUM; ++i) + if (gsEdspInfo.abSysEq0[i] != pbSysEq0[i]) { + gsEdspInfo.abSysEq0[i] = pbSysEq0[i]; + gsEdspInfo.bSysEq0Modify = SYSEQ_MODIFY_0; + } + + if (gsEdspInfo.bSysEq0Modify != SYSEQ_NO_MODIFY) + bSysEqEnbReg &= ~MCB_SYSEQ_SYSEQ0_ENB; + else + pbSysEq0 = NULL; + gsEdspInfo.bSysEq0Modify = SYSEQ_NO_MODIFY; + } + if (pbSysEq1 != NULL) { + for (i = 0; i < SYSEQ_NUM; ++i) + if (gsEdspInfo.abSysEq1[i] != pbSysEq1[i]) { + gsEdspInfo.abSysEq1[i] = pbSysEq1[i]; + gsEdspInfo.bSysEq1Modify = SYSEQ_MODIFY_0; + } + + if (gsEdspInfo.bSysEq1Modify != SYSEQ_NO_MODIFY) + bSysEqEnbReg &= ~MCB_SYSEQ_SYSEQ1_ENB; + else + pbSysEq1 = NULL; + gsEdspInfo.bSysEq1Modify = SYSEQ_NO_MODIFY; + } + + if ((pbSysEq0 == NULL) && (pbSysEq1 == NULL)) + return MCDRV_SUCCESS; + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_SYSEQ), + (UINT8)bSysEqEnbReg); + + /* SYSEQ0 */ + if (pbSysEq0 != NULL) { + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_EDSP_FW_PAGE), + (UINT8)MCB_EDSP_FW_PAGE_SYSEQ0); + + for (i = 0; i < SYSEQ_NUM; ++i) + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_EDSP_FW_D), + pbSysEq0[i]); + + McDevIf_ExecutePacket(); + } + + /* E1YREG[SYSEQ1] */ + if (pbSysEq1 != NULL) { + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_EDSP_FW_PAGE), + (UINT8)MCB_EDSP_FW_PAGE_SYSEQ1); + + for (i = 0; i < SYSEQ_NUM; ++i) + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_EDSP_FW_D), + pbSysEq1[i]); + + McDevIf_ExecutePacket(); + } + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_EDSP_FW_PAGE), + (UINT8)MCI_EDSP_FW_PAGE_DEF); + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_SYSEQ), + (UINT8)bOrgSysEqEnbReg); + + McDevIf_ExecutePacket(); + + return MCDRV_SUCCESS; +} + +/*************************************************************************** + * E1Download3Band + * + * Function: + * E1 SysEq data download + * Arguments: + * pbSysEq0 SysEq0 data + * pbSysEq1 SysEq1 data + * bSysEqEnbReg E-DSP #9 register set + * Return: + * MCDRV_SUCCESS + * + ****************************************************************************/ +SINT32 E1Download3Band(UINT8 *pbSysEq0, UINT8 *pbSysEq1, UINT8 bSysEqEnbReg) +{ + UINT8 bOrgSysEqEnbReg; + UINT8 bSysEq0Modify; + UINT8 bSysEq1Modify; + UINT32 i; + UINT32 j; + UINT32 k; + + bOrgSysEqEnbReg = bSysEqEnbReg; + bSysEq0Modify = SYSEQ_NO_MODIFY; + bSysEq1Modify = SYSEQ_NO_MODIFY; + if (pbSysEq0 != NULL) { + for (i = 0, j = SYSEQ_NUM, k = (SYSEQ_NUM * 2); + i < SYSEQ_NUM; + ++i, ++j, ++k) { + if (gsEdspInfo.abSysEq0[i] != pbSysEq0[i]) { + gsEdspInfo.abSysEq0[i] = pbSysEq0[i]; + gsEdspInfo.bSysEq0Modify |= SYSEQ_MODIFY_0; + } + if (gsEdspInfo.abSysEq0[j] != pbSysEq0[j]) { + gsEdspInfo.abSysEq0[j] = pbSysEq0[j]; + gsEdspInfo.bSysEq0Modify |= SYSEQ_MODIFY_1; + } + if (gsEdspInfo.abSysEq0[k] != pbSysEq0[k]) { + gsEdspInfo.abSysEq0[k] = pbSysEq0[k]; + gsEdspInfo.bSysEq0Modify |= SYSEQ_MODIFY_2; + } + } + + if (gsEdspInfo.bSysEq0Modify != SYSEQ_NO_MODIFY) { + bSysEq0Modify = gsEdspInfo.bSysEq0Modify; + if ((gsEdspInfo.bSysEq0Modify & SYSEQ_MODIFY_0) != 0) + bSysEqEnbReg &= ~MCB_SYSEQ_SYSEQ0_B0_ENB; + if ((gsEdspInfo.bSysEq0Modify & SYSEQ_MODIFY_1) != 0) + bSysEqEnbReg &= ~MCB_SYSEQ_SYSEQ0_B1_ENB; + if ((gsEdspInfo.bSysEq0Modify & SYSEQ_MODIFY_2) != 0) + bSysEqEnbReg &= ~MCB_SYSEQ_SYSEQ0_B2_ENB; + } else + pbSysEq0 = NULL; + gsEdspInfo.bSysEq0Modify = SYSEQ_NO_MODIFY; + } + if (pbSysEq1 != NULL) { + for (i = 0, j = SYSEQ_NUM, k = (SYSEQ_NUM * 2); + i < SYSEQ_NUM; + ++i, ++j, ++k) { + if (gsEdspInfo.abSysEq1[i] != pbSysEq1[i]) { + gsEdspInfo.abSysEq1[i] = pbSysEq1[i]; + gsEdspInfo.bSysEq1Modify |= SYSEQ_MODIFY_0; + } + if (gsEdspInfo.abSysEq1[j] != pbSysEq1[j]) { + gsEdspInfo.abSysEq1[j] = pbSysEq1[j]; + gsEdspInfo.bSysEq1Modify |= SYSEQ_MODIFY_1; + } + if (gsEdspInfo.abSysEq1[k] != pbSysEq1[k]) { + gsEdspInfo.abSysEq1[k] = pbSysEq1[k]; + gsEdspInfo.bSysEq1Modify |= SYSEQ_MODIFY_2; + } + } + + if (gsEdspInfo.bSysEq1Modify != SYSEQ_NO_MODIFY) { + bSysEq1Modify = gsEdspInfo.bSysEq1Modify; + if ((gsEdspInfo.bSysEq1Modify & SYSEQ_MODIFY_0) != 0) + bSysEqEnbReg &= ~MCB_SYSEQ_SYSEQ1_B0_ENB; + if ((gsEdspInfo.bSysEq1Modify & SYSEQ_MODIFY_1) != 0) + bSysEqEnbReg &= ~MCB_SYSEQ_SYSEQ1_B1_ENB; + if ((gsEdspInfo.bSysEq1Modify & SYSEQ_MODIFY_2) != 0) + bSysEqEnbReg &= ~MCB_SYSEQ_SYSEQ1_B2_ENB; + } else + pbSysEq1 = NULL; + gsEdspInfo.bSysEq1Modify = SYSEQ_NO_MODIFY; + } + + if ((pbSysEq0 == NULL) && (pbSysEq1 == NULL)) + return MCDRV_SUCCESS; + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_SYSEQ), + (UINT8)bSysEqEnbReg); + + /* SYSEQ0 */ + if (pbSysEq0 != NULL) { + if ((bSysEq0Modify & SYSEQ_MODIFY_0) != 0) { + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_EDSP_FW_PAGE), + (UINT8)MCB_EDSP_FW_PAGE_SYSEQ0_B0); + + for (i = 0; i < SYSEQ_NUM; ++i) + McDevIf_AddPacket( + (MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_EDSP_FW_D), + pbSysEq0[i]); + } + + if ((bSysEq0Modify & SYSEQ_MODIFY_1) != 0) { + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_EDSP_FW_PAGE), + (UINT8)MCB_EDSP_FW_PAGE_SYSEQ0_B1); + + for (i = SYSEQ_NUM; i < (SYSEQ_NUM * 2); ++i) + McDevIf_AddPacket( + (MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_EDSP_FW_D), + pbSysEq0[i]); + } + + if ((bSysEq0Modify & SYSEQ_MODIFY_2) != 0) { + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_EDSP_FW_PAGE), + (UINT8)MCB_EDSP_FW_PAGE_SYSEQ0_B2); + + for (i = (SYSEQ_NUM * 2); i < (SYSEQ_NUM * 3); ++i) + McDevIf_AddPacket( + (MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_EDSP_FW_D), + pbSysEq0[i]); + } + + McDevIf_ExecutePacket(); + } + + /* E1YREG[SYSEQ1] */ + if (pbSysEq1 != NULL) { + if ((bSysEq1Modify & SYSEQ_MODIFY_0) != 0) { + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_EDSP_FW_PAGE), + (UINT8)MCB_EDSP_FW_PAGE_SYSEQ1_B0); + + for (i = 0; i < SYSEQ_NUM; ++i) + McDevIf_AddPacket( + (MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_EDSP_FW_D), + pbSysEq1[i]); + } + + if ((bSysEq1Modify & SYSEQ_MODIFY_1) != 0) { + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_EDSP_FW_PAGE), + (UINT8)MCB_EDSP_FW_PAGE_SYSEQ1_B1); + + for (i = SYSEQ_NUM; i < (SYSEQ_NUM * 2); ++i) + McDevIf_AddPacket( + (MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_EDSP_FW_D), + pbSysEq1[i]); + } + + if ((bSysEq1Modify & SYSEQ_MODIFY_2) != 0) { + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_EDSP_FW_PAGE), + (UINT8)MCB_EDSP_FW_PAGE_SYSEQ1_B2); + + for (i = (SYSEQ_NUM * 2); i < (SYSEQ_NUM * 3); ++i) + McDevIf_AddPacket( + (MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_EDSP_FW_D), + pbSysEq1[i]); + } + + McDevIf_ExecutePacket(); + } + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_EDSP_FW_PAGE), + (UINT8)MCI_EDSP_FW_PAGE_DEF); + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_SYSEQ), + (UINT8)bOrgSysEqEnbReg); + + McDevIf_ExecutePacket(); + + return MCDRV_SUCCESS; +} + +/*************************************************************************** + * McEdsp_Init + * + * Function: + * Init edsp + * Arguments: + * none + * Return: + * MCDRV_SUCCESS + * + ****************************************************************************/ +SINT32 McEdsp_Init(void) +{ + UINT32 i; + + if (gsEdspInfo.dStatus != (UINT32)EDSP_STATUS_IDLE) + return MCDRV_ERROR; + + gsEdspInfo.cbfuncE2 = NULL; + + gsEdspInfo.dStatus = (UINT32)EDSP_STATUS_INITED; + + gsEdspInfo.bSysEq0Modify = + (SYSEQ_MODIFY_0 | SYSEQ_MODIFY_1 | SYSEQ_MODIFY_2); + gsEdspInfo.bSysEq1Modify = + (SYSEQ_MODIFY_0 | SYSEQ_MODIFY_1 | SYSEQ_MODIFY_2); + for (i = 0; i < (SYSEQ_NUM * BAND_NUM); ++i) + gsEdspInfo.abSysEq0[i] = 0x00; + for (i = 0; i < (SYSEQ_NUM * BAND_NUM); ++i) + gsEdspInfo.abSysEq1[i] = 0x00; + + return MCDRV_SUCCESS; +} + +/*************************************************************************** + * McEdsp_Term + * + * Function: + * Terminate EDSP + * Arguments: + * none + * Return: + * MCDRV_SUCCESS + * + ****************************************************************************/ +SINT32 McEdsp_Term(void) +{ + UINT8 bData; + + if (gsEdspInfo.dStatus == (UINT32)EDSP_STATUS_IDLE) + return MCDRV_SUCCESS; + + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_IF | (UINT32)MCI_EEDSP), + &bData, 1); + bData &= ~(MCB_EE2DSP_OV | MCB_EE2DSP); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_EEDSP), + bData); + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_EDSP), + (UINT8)MCB_E2DSP_STA); + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_E2DSP), + MCI_E2DSP_DEF); + + McDevIf_ExecutePacket(); + + gsEdspInfo.cbfuncE2 = NULL; + gsEdspInfo.dStatus = (UINT32)EDSP_STATUS_IDLE; + + return MCDRV_SUCCESS; +} + +/*************************************************************************** + * McEdsp_IrqProc + * + * Function: + * Interrupt processing + * Arguments: + * none + * Return: + * 0 + * + ****************************************************************************/ +SINT32 McEdsp_IrqProc(void) +{ + UINT8 bIReq; + UINT8 bData; + + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_EDSP), + &bIReq, 1); + + bIReq &= MCB_E2DSP_STA; + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_EDSP), + bIReq); + McDevIf_ExecutePacket(); + + if ((bIReq & MCB_E2DSP_STA) != 0) { + + if (gsEdspInfo.cbfuncE2 != NULL) { + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_E2STATUS), + &bData, 1); + + gsEdspInfo.cbfuncE2(0, + EDSP_CB_CMD_STATUS, + (UINT32)bData); + } + } + + return 0; +} + +/*************************************************************************** + * McEdsp_SetCBFunc + * + * Function: + * Set a callback function + * Arguments: + * cbfunc callback func + * Return: + * MCDRV_SUCCESS + * + ****************************************************************************/ +SINT32 McEdsp_SetCBFunc(SINT32 (*cbfunc)(SINT32, UINT32, UINT32)) +{ + gsEdspInfo.cbfuncE2 = cbfunc; + + return MCDRV_SUCCESS; +} + +/*************************************************************************** + * McEdsp_GetDSP + * + * Function: + * Get result + * Arguments: + * pbData Pointer of data area + * Return: + * MCDRV_ERROR_ARGUMENT + * REG_RES_NUM + * + ****************************************************************************/ +SINT32 McEdsp_GetDSP(UINT8 *pbData) +{ + UINT32 i; + + if (pbData == NULL) + return MCDRV_ERROR_ARGUMENT; + + for (i = 0; i < REG_RES_NUM; ++i) + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_E + | ((UINT32)MCI_E2RES_0 + i)), + &pbData[i], 1); + + return REG_RES_NUM; +} + +/*************************************************************************** + * McEdsp_SetDSPCheck + * + * Function: + * Check dsp configuration + * Arguments: + * psPrm Pointer of aec info + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR_ARGUMENT + * + ****************************************************************************/ +SINT32 McEdsp_SetDSPCheck(struct MCDRV_AEC_INFO *psPrm) +{ + SINT32 sdResult; + struct MCDRV_EDSP_AEC_EDSP_INFO sEdspInfo; + + if (psPrm == NULL) + return MCDRV_ERROR_ARGUMENT; + + GetEDSPChunk(psPrm, &sEdspInfo); + + sdResult = EdspChunkAnalyze(&sEdspInfo); + if (sdResult < (SINT32)MCDRV_SUCCESS) + return sdResult; + + return MCDRV_SUCCESS; +} + +/*************************************************************************** + * McEdsp_SetDSP + * + * Function: + * Set dsp + * Arguments: + * psPrm Pointe of aec info + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR_ARGUMENT + * MCDRV_ERROR + * + ****************************************************************************/ +SINT32 McEdsp_SetDSP(struct MCDRV_AEC_INFO *psPrm) +{ + SINT32 sdResult; + struct MCDRV_EDSP_AEC_EDSP_INFO sEdspInfo; + + if (psPrm == NULL) + return MCDRV_ERROR_ARGUMENT; + + GetEDSPChunk(psPrm, &sEdspInfo); + + sdResult = EdspChunkAnalyze(&sEdspInfo); + if (sdResult < (SINT32)MCDRV_SUCCESS) + return sdResult; + + if (psPrm->sE2.bEnable == AEC_EDSP_ENABLE) { + if (sEdspInfo.sE2.bOnOff == EDSP_E_OFF) { + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_E2DSP), + (UINT8)MCB_E2DSP_RST); + McDevIf_ExecutePacket(); + } + } + + if ((sEdspInfo.sE2.pbChunkData == NULL) || (sEdspInfo.sE2.dwSize == 0)) + return MCDRV_SUCCESS; + + if (gsEdspInfo.dStatus == (UINT32)EDSP_STATUS_IDLE) + return MCDRV_ERROR; + + SetE(&sEdspInfo); + + return MCDRV_SUCCESS; +} + +/*************************************************************************** + * McEdsp_Start + * + * Function: + * Start edsp + * Arguments: + * none + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR + * + ****************************************************************************/ +SINT32 McEdsp_Start(void) +{ + if (gsEdspInfo.dStatus == (UINT32)EDSP_STATUS_IDLE) + return MCDRV_ERROR; + + EnableIrq(); + + return MCDRV_SUCCESS; +} + +/*************************************************************************** + * McEdsp_Stop + * + * Function: + * Stop edsp + * Arguments: + * none + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR + * + ****************************************************************************/ +SINT32 McEdsp_Stop(void) +{ + if (gsEdspInfo.dStatus == (UINT32)EDSP_STATUS_IDLE) + return MCDRV_ERROR; + + DisableIrq(); + + return MCDRV_SUCCESS; +} + +/*************************************************************************** + * McEdsp_E1Download + * + * Function: + * E1 SysEq data download + * Arguments: + * pbSysEq0 SysEq0 data + * pbSysEq1 SysEq1 data + * bSysEqEnbReg E-DSP #9 register set + * Return: + * MCDRV_SUCCESS + * + ****************************************************************************/ +SINT32 McEdsp_E1Download(UINT8 *pbSysEq0, UINT8 *pbSysEq1, UINT8 bSysEqEnbReg) +{ + UINT8 bHwId; + SINT32 sdRet; + + bHwId = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_A, MCI_A_DEV_ID); + if ((bHwId & 0x07) == 0) + sdRet = E1Download1Band(pbSysEq0, pbSysEq1, bSysEqEnbReg); + else + sdRet = E1Download3Band(pbSysEq0, pbSysEq1, bSysEqEnbReg); + + return sdRet; +} + +/*************************************************************************** + * McEdsp_E1WriteCommand + * + * Function: + * E1 write command + * Arguments: + * bCmd command + * Return: + * MCDRV_SUCCESS + * + ****************************************************************************/ +SINT32 McEdsp_E1WriteCommand(UINT8 bCmd) +{ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_E1COMMAND), + bCmd); + McDevIf_ExecutePacket(); + + return MCDRV_SUCCESS; +} + +/*************************************************************************** + * McEdsp_E1OffsetMode + * + * Function: + * Set E1 offset mode + * Arguments: + * bStart Offset Start/Stop + * Return: + * MCDRV_SUCCESS + * + ****************************************************************************/ +SINT32 McEdsp_E1OffsetMode(UINT8 bStart) +{ + UINT8 bCmd; + + if (bStart == OFFSET_START) + bCmd = (E1_COMMAND_OFFSET_START | E1_COMMAND_RUN_MODE); + else + bCmd = (E1_COMMAND_OFFSET_STOP | E1_COMMAND_RUN_MODE); + + McEdsp_E1WriteCommand(bCmd); + + return MCDRV_SUCCESS; +} + +/*************************************************************************** + * McEdsp_E1Impedance + * + * Function: + * E1 Impedance detection + * Arguments: + * bStart Start/stop detection + * Return: + * MCDRV_SUCCESS + * + ****************************************************************************/ +SINT32 McEdsp_E1Impedance(UINT8 bStart) +{ + UINT8 bCmd; + + if (bStart == IMPEDANCE_START) + bCmd = E1_COMMAND_IMPEDANCE_START; + else + bCmd = E1_COMMAND_IMPEDANCE_STOP; + + McEdsp_E1WriteCommand(bCmd); + + return MCDRV_SUCCESS; +} + diff --git a/sound/soc/codecs/ymu831/mcedspdrv.h b/sound/soc/codecs/ymu831/mcedspdrv.h new file mode 100644 index 00000000000..0dcb5095489 --- /dev/null +++ b/sound/soc/codecs/ymu831/mcedspdrv.h @@ -0,0 +1,63 @@ +/**************************************************************************** + * + * Copyright(c) 2012 Yamaha Corporation. All rights reserved. + * + * Module : mcedspdrv.h + * + * Description : MC Edsp Driver header + * + * Version : 1.0.0 2012.12.13 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + * + ****************************************************************************/ +#ifndef _MCEDSPDRV_H_ +#define _MCEDSPDRV_H_ + +/* definition */ + +#define AEC_EDSP_ENABLE (1) +#define AEC_EDSP_DISABLE (0) + +#define EDSP_E_OFF (0) +#define EDSP_E_ON (1) + +#define EDSP_CB_CMD_STATUS (21) + +/* Enum */ + +#if defined(__cplusplus) +extern "C" { +#endif +SINT32 McEdsp_Init(void); +SINT32 McEdsp_Term(void); +SINT32 McEdsp_IrqProc(void); +SINT32 McEdsp_SetCBFunc(SINT32 (*cbfunc)(SINT32, UINT32, UINT32)); +SINT32 McEdsp_GetDSP(UINT8 *pbData); +SINT32 McEdsp_SetDSPCheck(struct MCDRV_AEC_INFO *pbPrm); +SINT32 McEdsp_SetDSP(struct MCDRV_AEC_INFO *pbPrm); +SINT32 McEdsp_Start(void); +SINT32 McEdsp_Stop(void); +SINT32 McEdsp_E1Download(UINT8 *pbSysEq0, UINT8 *pbSysEq1, UINT8 bSysEqEnbReg); +SINT32 McEdsp_E1WriteCommand(UINT8 bCmd); +SINT32 McEdsp_E1OffsetMode(UINT8 bStart); +SINT32 McEdsp_E1Impedance(UINT8 bStart); +#if defined(__cplusplus) +} +#endif + +#endif diff --git a/sound/soc/codecs/ymu831/mcfdspdrv.c b/sound/soc/codecs/ymu831/mcfdspdrv.c new file mode 100644 index 00000000000..052c47a4697 --- /dev/null +++ b/sound/soc/codecs/ymu831/mcfdspdrv.c @@ -0,0 +1,3400 @@ +/**************************************************************************** + * + * Copyright(c) 2012-2013 Yamaha Corporation. All rights reserved. + * + * Module : mcfdspdrv.c + * + * Description : MC Fdsp Driver + * + * Version : 2.0.0 2013.04.01 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + * + ****************************************************************************/ +#include "mctypedef.h" +#include "mcdevif.h" +#include "mcdefs.h" +#include "mcresctrl.h" +#include "mcfdspdrv.h" + + +/* inside definition */ + +#define IRQ_NO_ERROR (0) +#define IRQ_ERROR (1) + +#define FDSP_STATUS_IDLE (0) +#define FDSP_STATUS_INITED (1) + +#define CHUNK_SIZE (8) + +#define AEC_FULL_FW (1) +#define AEC_APP_FW (2) +#define AEC_APP_COEF_FW (3) +#define AEC_APP_REG_FW (4) + +#define COEF_DMA_TRANS (0) +#define COEF_DSP_TRANS (1) +#define COEF_DSP_TRANS_MAX (512) + +#define AEC_FDSP_TAG_FWCTRL (0x00000100) +#define FWCTRL_SIZE (27) +#define AEC_FDSP_TAG_CHSEL (0x00000200) +#define CHSEL_SIZE (33) +#define AEC_FDSP_TAG_TOP_ENV (0x00000300) +#define TOP_ENV_SIZE (29) +#define AEC_FDSP_TAG_TOP_COEF (0x00000400) +#define TOP_COEF_FIX_SIZE (8) +#define AEC_FDSP_TAG_TOP_INS (0x00000500) +#define TOP_INS_FIX_SIZE (8) +#define AEC_FDSP_TAG_APP_MASK (0xFFFFFF00) +#define AEC_FDSP_TAG_APPNO_MASK (0xFF) +#define AEC_FDSP_TAG_APP_ENV (0x00000600) +#define APP_ENV_FIX_SIZE (38) +#define AEC_FDSP_TAG_APP_COEF (0x00000700) +#define APP_COEF_FIX_SIZE (9) +#define AEC_FDSP_TAG_APP_CONST (0x00000800) +#define AEC_FDSP_TAG_APP_INS (0x00000900) +#define APP_INS_FIX_SIZE (8) +#define AEC_FDSP_TAG_APP_REG (0x00000A00) +#define APP_REG_FIX_SIZE (8) +#define AEC_FDSP_TAG_EX_INFO_1 (0x00000B00) +#define EX_INFO_1_SIZE (4) + +#define FWCTL_FWMOD (0) +#define FWCTL_FS (1) +#define FWCTL_APPEXEC (2) +#define FWCTL_FADECODE (26) + +#define CHSEL_BYPASS (0) +#define CHSEL_INFDSPSRC (1) +#define CHSEL_OUTAUDIOSRC (17) + +#define TOP_ENV_ID (0) +#define TOP_ENV_INSTBASE (1) +#define TOP_ENV_MBLKSIZE (5) +#define TOP_ENV_MBUFSIZE (6) +#define TOP_ENV_MOCHCNFG (7) +#define TOP_ENV_MICHCNFG (8) +#define TOP_ENV_SSTARTCH (9) +#define TOP_ENV_SNUMOFOCH (10) +#define TOP_ENV_SNUMOFICH (11) +#define TOP_ENV_SAVEBUFSIZE1 (12) +#define TOP_ENV_SAVEBUFSIZE0 (16) +#define TOP_ENV_LIMITWORKSIZE (20) +#define TOP_ENV_WORKBASE (24) +#define TOP_ENV_TOPBASE0 (28) + +#define TOP_COEF_ADR (0) +#define TOP_COEF_SIZE (4) +#define TOP_COEF_DATA (8) + +#define TOP_INST_ADR (0) +#define TOP_INST_SIZE (4) +#define TOP_INST_DATA (8) + +#define APP_ENV_ID (0) +#define APP_ENV_EXCECPROCESS (1) +#define APP_ENV_INSTBASE (2) +#define APP_ENV_REGBASE (6) +#define APP_ENV_EXECFS (10) +#define APP_ENV_EXECCH (14) +#define APP_ENV_WORKBASE (18) +#define APP_ENV_APPBASE0 (22) +#define APP_ENV_APPBASE1 (26) +#define APP_ENV_APPBASE2 (30) +#define APP_ENV_APPBASE3 (34) +#define APP_ENV_APPFADE (38) +#define APP_ENV_APPIRQ (39) + +#define APP_COEF_ADR (0) +#define APP_COEF_SIZE (5) +#define APP_COEF_DATA (9) + +#define APP_INST_ADR (0) +#define APP_INST_SIZE (4) +#define APP_INST_DATA (8) + +#define APP_REG_ADR (0) +#define APP_REG_SIZE (4) +#define APP_REG_DATA (8) + +#define APP_PARAM_ON (1) + +#define FDSP_FREQ_MIN (1) +#define FDSP_FREQ_MAX (5) + +#define MULTI_CHUNK_TOP_COEF (1) +#define MULTI_CHUNK_APP_COEF (2) +#define MULTI_CHUNK_APP_REG (3) + +#define RAM_UNIT_SIZE (4UL) +#define DXRAM_RANGE_MIN (0x0UL) +#define DXRAM_RANGE_MAX_1 (0x07FFFUL) +#define DXRAM_RANGE_MAX_2 (0x08FFFUL) +#define DYRAM_RANGE_MIN (0x0UL) +#define DYRAM_RANGE_MAX (0x017FFUL) +#define IRAM_RANGE_MIN (0x10000UL) +#define IRAM_RANGE_MAX_1 (0x13FFFUL) +#define IRAM_RANGE_MAX_2 (0x12FFFUL) + +#define STOP_KIND_NONE (0x00) +#define STOP_KIND_FDSP (0x01) +#define STOP_KIND_APP_EXEC (0x02) +#define STOP_KIND_APP (0x04) +#define STOP_KIND_WAIT (0x08) + +#define RESTART_OFF (0) +#define RESTART_ON (1) +#define RESTART_BYPASS (2) + +#define APP_VOL_ID (0x07) +#define FIX_APP_VOL_FREE (0) +#define FIX_APP_VOL_EXIST (1) +#define FIX_APP_VOL_NO (22) +#define FIX_APP_VOL_ACT MCI_APPACT0 +#define FIX_APP_VOL_BIT MCB_APPACT22 +#define FIX_APP_VOL_APPEXEC (0x400000) +#define FIX_APP_VOL_REG_BASE (0x4F) +#define FIX_APP_VOL_REG_FADE_CTRL (FIX_APP_VOL_REG_BASE + 1) +#define FIX_APP_VOL_REG_FADE_CTRL_BIT (0x01) +#define FIX_APP_VOL_REG_FADE_STE (FIX_APP_VOL_REG_BASE + 2) +#define FIX_APP_VOL_REG_FADE_STE_BIT (0x01) +#define FIX_APP_FADE_WAIT_TIME_US (10000) + +#define DEF_FDSP_STOP_WAIT_TIME_US (15000) + +#define FWCTL_SAVE_REG_START (0x4F) +#define FWCTL_SAVE_REG_END (0x76) +#define FWCTL_SAVE_REG_NUM \ + (FWCTL_SAVE_REG_END - FWCTL_SAVE_REG_START + 1) + +struct MCDRV_FDSP_INFO { + /* state */ + UINT32 dStatus; + /* info */ + struct MCDRV_FDSP_INIT sInit; + SINT32(*cbfunc)(SINT32, UINT32, UINT32); + UINT32 dAppStop; + UINT32 dAppIEnb; + UINT32 dAppFade; + UINT8 bDSPBypass; + UINT8 bFixAppVol; + /* register */ + UINT8 bADIMute0; + UINT8 bADIMute1; + UINT8 bADOMute0; + UINT8 bADOMute1; + UINT8 bDSPCtl; + UINT8 bAppExec0; + UINT8 bAppExec1; + UINT8 bAppExec2; + UINT8 bAppIEnb0; + UINT8 bAppIEnb1; + UINT8 bAppIEnb2; + UINT8 abFwctl[FWCTL_SAVE_REG_NUM]; +}; + +struct MCDRV_FDSP_AEC_FDSP_INFO { + UINT8 *pbChunkData; + UINT32 dwSize; + UINT8 bMustStop; + UINT8 *pbFwctrl; + UINT8 *pbChSel; + UINT8 *pbTopEnv; + UINT32 dTopCoefCnt; + UINT8 *pbTopInst; + UINT32 dTargetApp; + UINT32 dAppEnvCnt; + UINT8 *apbAppEnv[FDSP_APP_NUM]; + UINT8 bCoefTrans; + UINT32 dAppCoefCnt; + UINT32 dAppCnstCnt; + UINT32 dAppMaxCoefCnstNum; + UINT32 dAppInstCnt; + UINT8 *apbAppInst[FDSP_APP_NUM]; + UINT32 dAppRegCnt; + UINT8 *pbExInfo1; + UINT32 dAppExec; +}; + +struct MCDRV_FDSP_EXEC_INFO { + UINT32 dAppExec; + UINT8 bRestart; +}; + +static struct MCDRV_FDSP_INFO gsFdspInfo = { + FDSP_STATUS_IDLE, + { + {0}, + {0}, + DEF_FDSP_STOP_WAIT_TIME_US + }, + NULL, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + { /* abFwctl 0x4F-0x76 */ + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0 + }, +}; + +/**************************************************************************** + * LoadCtlReg + * + * Description: + * Set FWControl Register + * Arguments: + * none + * Return: + * none + * + ****************************************************************************/ +static void LoadCtlReg(void) +{ + UINT32 i; + + for (i = FWCTL_SAVE_REG_START; i <= FWCTL_SAVE_REG_END; ++i) + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_F + | i), + gsFdspInfo.abFwctl[i - FWCTL_SAVE_REG_START]); + + McDevIf_ExecutePacket(); +} + +/**************************************************************************** + * SaveCtlReg + * + * Description: + * Save FWControl Register + * Arguments: + * none + * Return: + * none + * + ****************************************************************************/ +static void SaveCtlReg(void) +{ + UINT32 i; + + for (i = FWCTL_SAVE_REG_START; i <= FWCTL_SAVE_REG_END; ++i) + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_F + | i), + &gsFdspInfo.abFwctl[i - FWCTL_SAVE_REG_START], + 1); +} + +/**************************************************************************** + * GetAppAct + * + * Description: + * APP operation state acquisition + * Arguments: + * none + * Return: + * APP State + * + ****************************************************************************/ +static UINT32 GetAppAct(void) +{ + UINT32 dAppAct; + UINT8 bData; + + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_APPACT0), &bData, 1); + dAppAct = ((UINT32)bData << 16); + + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_APPACT1), &bData, 1); + dAppAct |= ((UINT32)bData << 8); + + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_APPACT2), &bData, 1); + dAppAct |= (UINT32)bData; + + return dAppAct; +} + +/**************************************************************************** + * GetChMute + * + * Description: + * Specified channel Mute information acquisition + * Arguments: + * bADMute mute information + * bChMuteBit Specified channel + * Return: + * Mute ON/OFF information + * + ****************************************************************************/ +static UINT8 GetChMute(UINT8 bADMute, UINT8 bChMuteBit) +{ + if ((bADMute & bChMuteBit) == bChMuteBit) + return FDSP_MUTE_OFF; + + return FDSP_MUTE_ON; +} + +/**************************************************************************** + * CreateMuteReg + * + * Description: + * Mute register value making + * Arguments: + * bADMute mute register value + * bMute mute specification + * bChMuteBit specified channel + * Return: + * mute register value + * + ****************************************************************************/ +static UINT8 CreateMuteReg(UINT8 bADMute, UINT8 bMute, UINT8 bChMuteBit) +{ + switch (bMute) { + case FDSP_MUTE_ON: + bADMute &= (UINT8)~bChMuteBit; + break; + + case FDSP_MUTE_OFF: + bADMute |= bChMuteBit; + break; + + default: + break; + } + + return bADMute; +} + +/**************************************************************************** + * CreateUINT32 + * + * Description: + * Create UINT32 Value + * Arguments: + * b0 31-24bit value + * b1 23-16bit value + * b2 15-8bit value + * b3 7-0bit value + * Return: + * UINT32 Value + * + ****************************************************************************/ +static UINT32 CreateUINT32(UINT8 b0, UINT8 b1, UINT8 b2, UINT8 b3) +{ + return ((UINT32)b0 << 24) | ((UINT32)b1 << 16) + | ((UINT32)b2 << 8) | (UINT32)b3; +} + +/**************************************************************************** + * SetAudioIF + * + * Description: + * Setting of Audio I/F + * Arguments: + * psFdspInit MCDRV_FDSP_AUDIO_INIT structure pointer + * Return: + * none + * + ****************************************************************************/ +static void SetAudioIF(struct MCDRV_FDSP_INIT *psFdspInit) +{ + /* ADIDFmt0 */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_ADIDFMT0), + (UINT8)(psFdspInit->sInput.wADDFmt & 0xFF)); + /* ADIDFmt1 */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_ADIDFMT1), + (UINT8)((psFdspInit->sInput.wADDFmt >> 8) & 0xFF)); + + + /* ADODFmt0 */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_ADODFMT0), + (UINT8)(psFdspInit->sOutput.wADDFmt & 0xFF)); + /* ADODFmt1 */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_ADODFMT1), + (UINT8)((psFdspInit->sOutput.wADDFmt >> 8) & 0xFF)); + + McDevIf_ExecutePacket(); +} + +/**************************************************************************** + * InitCore + * + * Description: + * Init F-DSP + * Arguments: + * none + * Return: + * none + * + ****************************************************************************/ +static void InitCore(void) +{ + gsFdspInfo.dAppStop = 0UL; + gsFdspInfo.dAppIEnb = 0UL; + gsFdspInfo.dAppFade = 0UL; + gsFdspInfo.bDSPBypass = 0UL; + gsFdspInfo.bFixAppVol = FIX_APP_VOL_FREE; + + gsFdspInfo.bDSPCtl = MCI_DSPCTRL_DEF; + gsFdspInfo.bAppExec0 = MCI_APPEXEC0_DEF; + gsFdspInfo.bAppExec1 = MCI_APPEXEC1_DEF; + gsFdspInfo.bAppExec2 = MCI_APPEXEC2_DEF; + gsFdspInfo.bAppIEnb0 = MCI_APPIENB0_DEF; + gsFdspInfo.bAppIEnb1 = MCI_APPIENB1_DEF; + gsFdspInfo.bAppIEnb2 = MCI_APPIENB2_DEF; + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_DSPCTRL), + gsFdspInfo.bDSPCtl); + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_APPEXEC0), + gsFdspInfo.bAppExec0); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_APPEXEC1), + gsFdspInfo.bAppExec1); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_APPEXEC2), + gsFdspInfo.bAppExec2); + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_APPIENB0), + gsFdspInfo.bAppIEnb0); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_APPIENB1), + gsFdspInfo.bAppIEnb1); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_APPIENB2), + gsFdspInfo.bAppIEnb2); + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_ADIMUTE0), + gsFdspInfo.bADIMute0); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_ADIMUTE1), + gsFdspInfo.bADIMute1); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_ADIMUTE2), + MCB_ADIMTSET); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_ADOMUTE0), + gsFdspInfo.bADOMute0); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_ADOMUTE1), + gsFdspInfo.bADOMute1); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_ADOMUTE2), + MCB_ADOMTSET); + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_APPFADE0), + 0x00); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_APPFADE1), + 0x00); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_APPFADE2), + 0x00); + McDevIf_ExecutePacket(); + + SetAudioIF(&gsFdspInfo.sInit); +} + +/**************************************************************************** + * GetFDSPChunk + * + * Description: + * Get FDSP chunk + * Arguments: + * psPrm MCDRV_AEC_INFO structure pointer + * psFdspInfo MCDRV_FDSP_AEC_FDSP_INFO + * structure pointer + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR_ARGUMENT + * + ****************************************************************************/ +static SINT32 GetFDSPChunk(struct MCDRV_AEC_INFO *psPrm, + struct MCDRV_FDSP_AEC_FDSP_INFO *psFdspInfo) +{ + psFdspInfo->pbChunkData = NULL; + psFdspInfo->dwSize = 0; + + switch (psPrm->sAecConfig.bFDspLocate) { + case FDSP_LOCATE_AUDIOENGINE: + if (psPrm->sAecAudioengine.bEnable == AEC_AUDIOENGINE_ENABLE) { + + if (psPrm->sAecAudioengine.bFDspOnOff == FDSP_OFF) + return MCDRV_SUCCESS; + + psFdspInfo->pbChunkData = + psPrm->sAecAudioengine.sAecFDsp.pbChunkData; + psFdspInfo->dwSize = + psPrm->sAecAudioengine.sAecFDsp.dwSize; + } + break; + + case FDSP_LOCATE_V_BOX: + if (psPrm->sAecVBox.bEnable == AEC_AUDIOENGINE_ENABLE) { + + if (psPrm->sAecVBox.bFDspOnOff == FDSP_OFF) + return MCDRV_SUCCESS; + + psFdspInfo->pbChunkData = + psPrm->sAecVBox.sAecFDsp.pbChunkData; + psFdspInfo->dwSize = + psPrm->sAecVBox.sAecFDsp.dwSize; + } + break; + + default: + return MCDRV_ERROR_ARGUMENT; + } + + if (psFdspInfo->pbChunkData != NULL) + psFdspInfo->pbChunkData = &psFdspInfo->pbChunkData[CHUNK_SIZE]; + + return MCDRV_SUCCESS; +} + +/**************************************************************************** + * FwctrlChunkAnalyze + * + * Description: + * FWCTRL chunk analysis + * Arguments: + * psFdspInfo MCDRV_FDSP_AEC_FDSP_INFO + * structure pointer + * pbPrm FWCTRL chunk pointer + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR_ARGUMENT + * + ****************************************************************************/ +static SINT32 FwctrlChunkAnalyze(struct MCDRV_FDSP_AEC_FDSP_INFO *psFdspInfo, + UINT8 *pbPrm) +{ + UINT32 i; + + if (pbPrm[FWCTL_FWMOD] != 0x00) + return MCDRV_ERROR_ARGUMENT; + + if ((pbPrm[FWCTL_FS] != 0xFF) || (pbPrm[FWCTL_FADECODE] != 0xFF)) + psFdspInfo->bMustStop |= STOP_KIND_FDSP; + + for (i = 0; i < (UINT32)FDSP_APP_NUM; ++i) + if ((pbPrm[FWCTL_APPEXEC + i] != FDSP_APP_EXEC_DONTCARE) && + (i != FIX_APP_VOL_NO)) { + psFdspInfo->bMustStop |= STOP_KIND_APP_EXEC; + break; + } + + return MCDRV_SUCCESS; +} + +/**************************************************************************** + * FixAppCheck + * + * Description: + * Check Fix APP + * Arguments: + * dAppNo App No + * pbAppEnv App Env pointer + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR_ARGUMENT + * + ****************************************************************************/ +static SINT32 FixAppCheck(UINT32 dAppNo, UINT8 *pbAppEnv) +{ + if (dAppNo != FIX_APP_VOL_NO) + return MCDRV_SUCCESS; + + if (pbAppEnv[APP_ENV_ID] == 0x00) + return MCDRV_SUCCESS; + + if (pbAppEnv[APP_ENV_ID] != APP_VOL_ID) + return MCDRV_ERROR_ARGUMENT; + + if ((UINT8)(pbAppEnv[APP_ENV_REGBASE + 3] & 0x7F) != + FIX_APP_VOL_REG_BASE) + return MCDRV_ERROR_ARGUMENT; + + return MCDRV_SUCCESS; +} + +/**************************************************************************** + * AppChunkAnalyze + * + * Description: + * APP chunk analysis + * Arguments: + * psFdspInfo MCDRV_FDSP_AEC_FDSP_INFO + * structure pointer + * dChunkId chunk id + * dChunkSize chunk size + * dChunkTop chunk top position + * pbPrm chunk pointer + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR_ARGUMENT + * + ****************************************************************************/ +static SINT32 AppChunkAnalyze(struct MCDRV_FDSP_AEC_FDSP_INFO *psFdspInfo, + UINT32 dChunkId, UINT32 dChunkSize, + UINT32 dChunkTop, UINT8 *pbPrm) +{ + UINT32 dAppNo; + UINT32 dTemp; + + switch ((dChunkId & (UINT32)AEC_FDSP_TAG_APP_MASK)) { + case AEC_FDSP_TAG_APP_ENV: + dAppNo = (dChunkId & (UINT32)AEC_FDSP_TAG_APPNO_MASK); + if (dAppNo < (UINT32)FDSP_APP_NUM) { + if (dChunkSize < (UINT32)APP_ENV_FIX_SIZE) + return MCDRV_ERROR_ARGUMENT; + if (psFdspInfo->apbAppEnv[dAppNo] != NULL) + return MCDRV_ERROR_ARGUMENT; + + if (FixAppCheck(dAppNo, &pbPrm[dChunkTop]) + != MCDRV_SUCCESS) + return MCDRV_ERROR_ARGUMENT; + + psFdspInfo->apbAppEnv[dAppNo] = &pbPrm[dChunkTop]; + ++(psFdspInfo->dAppEnvCnt); + psFdspInfo->dTargetApp |= (0x01UL << dAppNo); + psFdspInfo->bCoefTrans = COEF_DMA_TRANS; + + psFdspInfo->bMustStop |= STOP_KIND_APP; + } + break; + + case AEC_FDSP_TAG_APP_COEF: + case AEC_FDSP_TAG_APP_CONST: + dAppNo = (dChunkId & (UINT32)AEC_FDSP_TAG_APPNO_MASK); + if (dAppNo < (UINT32)FDSP_APP_NUM) { + if (dChunkSize < (UINT32)APP_COEF_FIX_SIZE) + return MCDRV_ERROR_ARGUMENT; + dTemp = CreateUINT32(pbPrm[dChunkTop + 5UL], + pbPrm[dChunkTop + 6UL], + pbPrm[dChunkTop + 7UL], + pbPrm[dChunkTop + 8UL]); + if (dTemp == 0UL) + break; + if ((dTemp & 0x03UL) != 0UL) + return MCDRV_ERROR_ARGUMENT; + if (dChunkSize < (dTemp + (UINT32)APP_COEF_FIX_SIZE)) + return MCDRV_ERROR_ARGUMENT; + + if (COEF_DSP_TRANS != pbPrm[dChunkTop + 4UL]) { + psFdspInfo->bCoefTrans = COEF_DMA_TRANS; + psFdspInfo->bMustStop |= STOP_KIND_APP; + } + + if ((UINT32)AEC_FDSP_TAG_APP_COEF == + (dChunkId & (UINT32)AEC_FDSP_TAG_APP_MASK)) + ++(psFdspInfo->dAppCoefCnt); + else + ++(psFdspInfo->dAppCnstCnt); + + psFdspInfo->dTargetApp |= (0x01UL << dAppNo); + if (psFdspInfo->dAppMaxCoefCnstNum < dTemp) + psFdspInfo->dAppMaxCoefCnstNum = dTemp; + + psFdspInfo->bMustStop |= STOP_KIND_WAIT; + } + break; + + case AEC_FDSP_TAG_APP_INS: + dAppNo = (dChunkId & (UINT32)AEC_FDSP_TAG_APPNO_MASK); + if (dAppNo < (UINT32)FDSP_APP_NUM) { + if (dChunkSize < (UINT32)APP_INS_FIX_SIZE) + return MCDRV_ERROR_ARGUMENT; + if (psFdspInfo->apbAppInst[dAppNo] != NULL) + return MCDRV_ERROR_ARGUMENT; + + dTemp = CreateUINT32(pbPrm[dChunkTop + 4UL], + pbPrm[dChunkTop + 5UL], + pbPrm[dChunkTop + 6UL], + pbPrm[dChunkTop + 7UL]); + if (dTemp == 0UL) + break; + if ((dTemp & 0x03UL) != 0UL) + return MCDRV_ERROR_ARGUMENT; + if (dChunkSize < (dTemp + (UINT32)APP_INS_FIX_SIZE)) + return MCDRV_ERROR_ARGUMENT; + + psFdspInfo->apbAppInst[dAppNo] = &pbPrm[dChunkTop]; + ++(psFdspInfo->dAppInstCnt); + psFdspInfo->dTargetApp |= (0x01UL << dAppNo); + psFdspInfo->bCoefTrans = COEF_DMA_TRANS; + + psFdspInfo->bMustStop |= STOP_KIND_APP; + } + break; + + case AEC_FDSP_TAG_APP_REG: + dAppNo = (dChunkId & (UINT32)AEC_FDSP_TAG_APPNO_MASK); + if (dAppNo < (UINT32)FDSP_APP_NUM) { + if (dChunkSize < (UINT32)APP_REG_FIX_SIZE) + return MCDRV_ERROR_ARGUMENT; + dTemp = CreateUINT32(pbPrm[dChunkTop + 4UL], + pbPrm[dChunkTop + 5UL], + pbPrm[dChunkTop + 6UL], + pbPrm[dChunkTop + 7UL]); + if (dTemp == 0UL) + break; + if (dChunkSize < (dTemp + (UINT32)APP_REG_FIX_SIZE)) + return MCDRV_ERROR_ARGUMENT; + ++(psFdspInfo->dAppRegCnt); + + psFdspInfo->bMustStop |= STOP_KIND_WAIT; + } + break; + + default: + /* unknown */ + break; + } + + return MCDRV_SUCCESS; +} + +/**************************************************************************** + * CoefTransCheck + * + * Description: + * Coefficient transfer check + * Arguments: + * psFdspInfo MCDRV_FDSP_AEC_FDSP_INFO + * structure pointer + * Return: + * none + * + ****************************************************************************/ +static void CoefTransCheck(struct MCDRV_FDSP_AEC_FDSP_INFO *psFdspInfo) +{ + if (psFdspInfo->bCoefTrans != COEF_DSP_TRANS) + return; + + if ((psFdspInfo->dAppCoefCnt == 0UL) && + (psFdspInfo->dAppCnstCnt == 0UL)) + return; + + if (((UINT32)COEF_DSP_TRANS_MAX < psFdspInfo->dAppMaxCoefCnstNum) || + (1UL < (psFdspInfo->dAppCoefCnt + psFdspInfo->dAppCnstCnt))) + psFdspInfo->bCoefTrans = COEF_DMA_TRANS; + + if (psFdspInfo->bCoefTrans == COEF_DMA_TRANS) + psFdspInfo->bMustStop |= STOP_KIND_APP; +} + +/**************************************************************************** + * FdspChunkAnalyze + * + * Description: + * FDSP chunk analysis + * Arguments: + * psFdspInfo MCDRV_FDSP_AEC_FDSP_INFO + * structure pointer + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR_ARGUMENT + * + ****************************************************************************/ +static SINT32 FdspChunkAnalyze(struct MCDRV_FDSP_AEC_FDSP_INFO *psFdspInfo) +{ + UINT32 dChunkTop; + UINT32 dChunkId; + UINT32 dChunkSize; + UINT8 *pbPrm; + UINT32 dSize; + UINT32 dTemp; + UINT32 i; + + psFdspInfo->bMustStop = STOP_KIND_NONE; + psFdspInfo->pbFwctrl = NULL; + psFdspInfo->pbChSel = NULL; + psFdspInfo->pbTopEnv = NULL; + psFdspInfo->dTopCoefCnt = 0UL; + psFdspInfo->pbTopInst = NULL; + psFdspInfo->dTargetApp = 0UL; + psFdspInfo->dAppEnvCnt = 0UL; + psFdspInfo->bCoefTrans = COEF_DSP_TRANS; + psFdspInfo->dAppCoefCnt = 0UL; + psFdspInfo->dAppCnstCnt = 0UL; + psFdspInfo->dAppMaxCoefCnstNum = 0UL; + psFdspInfo->dAppInstCnt = 0UL; + psFdspInfo->dAppRegCnt = 0UL; + psFdspInfo->pbExInfo1 = NULL; + for (i = 0UL; i < (UINT32)FDSP_APP_NUM; ++i) { + psFdspInfo->apbAppEnv[i] = NULL; + psFdspInfo->apbAppInst[i] = NULL; + } + + if ((psFdspInfo->pbChunkData == NULL) || (psFdspInfo->dwSize == 0)) + return MCDRV_SUCCESS; + + pbPrm = psFdspInfo->pbChunkData; + dSize = psFdspInfo->dwSize; + dChunkTop = 0UL; + while (dChunkTop < dSize) { + if (dSize < (dChunkTop + (UINT32)CHUNK_SIZE)) + return MCDRV_ERROR_ARGUMENT; + + dChunkId = CreateUINT32(pbPrm[dChunkTop + 0UL], + pbPrm[dChunkTop + 1UL], + pbPrm[dChunkTop + 2UL], + pbPrm[dChunkTop + 3UL]); + dChunkSize = CreateUINT32(pbPrm[dChunkTop + 4UL], + pbPrm[dChunkTop + 5UL], + pbPrm[dChunkTop + 6UL], + pbPrm[dChunkTop + 7UL]); + if (dSize < (dChunkTop + (UINT32)CHUNK_SIZE + dChunkSize)) + return MCDRV_ERROR_ARGUMENT; + + dChunkTop += (UINT32)CHUNK_SIZE; + switch (dChunkId) { + case AEC_FDSP_TAG_FWCTRL: + if (dChunkSize < (UINT32)FWCTRL_SIZE) + return MCDRV_ERROR_ARGUMENT; + if (psFdspInfo->pbFwctrl != NULL) + return MCDRV_ERROR_ARGUMENT; + + if (FwctrlChunkAnalyze(psFdspInfo, + &pbPrm[dChunkTop]) != MCDRV_SUCCESS) + return MCDRV_ERROR_ARGUMENT; + + psFdspInfo->pbFwctrl = &pbPrm[dChunkTop]; + break; + + case AEC_FDSP_TAG_CHSEL: + if (dChunkSize < (UINT32)CHSEL_SIZE) + return MCDRV_ERROR_ARGUMENT; + if (psFdspInfo->pbChSel != NULL) + return MCDRV_ERROR_ARGUMENT; + + psFdspInfo->pbChSel = &pbPrm[dChunkTop]; + psFdspInfo->bMustStop |= STOP_KIND_FDSP; + break; + + case AEC_FDSP_TAG_TOP_ENV: + if (dChunkSize < (UINT32)TOP_ENV_SIZE) + return MCDRV_ERROR_ARGUMENT; + if (psFdspInfo->pbTopEnv != NULL) + return MCDRV_ERROR_ARGUMENT; + + psFdspInfo->pbTopEnv = &pbPrm[dChunkTop]; + psFdspInfo->bMustStop |= STOP_KIND_FDSP; + break; + + case AEC_FDSP_TAG_TOP_COEF: + if (dChunkSize < (UINT32)TOP_COEF_FIX_SIZE) + return MCDRV_ERROR_ARGUMENT; + dTemp = CreateUINT32(pbPrm[dChunkTop + 4UL], + pbPrm[dChunkTop + 5UL], + pbPrm[dChunkTop + 6UL], + pbPrm[dChunkTop + 7UL]); + if ((dTemp & 0x03UL) != 0UL) + return MCDRV_ERROR_ARGUMENT; + if (dChunkSize < (dTemp + (UINT32)TOP_COEF_FIX_SIZE)) + return MCDRV_ERROR_ARGUMENT; + + ++(psFdspInfo->dTopCoefCnt); + psFdspInfo->bMustStop |= STOP_KIND_FDSP; + break; + + case AEC_FDSP_TAG_TOP_INS: + if (dChunkSize < (UINT32)TOP_INS_FIX_SIZE) + return MCDRV_ERROR_ARGUMENT; + if (psFdspInfo->pbTopInst != NULL) + return MCDRV_ERROR_ARGUMENT; + + dTemp = CreateUINT32(pbPrm[dChunkTop + 4UL], + pbPrm[dChunkTop + 5UL], + pbPrm[dChunkTop + 6UL], + pbPrm[dChunkTop + 7UL]); + if (dTemp == 0UL) + break; + if ((dTemp & 0x03UL) != 0UL) + return MCDRV_ERROR_ARGUMENT; + if (dChunkSize < (dTemp + (UINT32)TOP_INS_FIX_SIZE)) + return MCDRV_ERROR_ARGUMENT; + psFdspInfo->pbTopInst = &pbPrm[dChunkTop]; + psFdspInfo->bMustStop |= STOP_KIND_FDSP; + break; + + default: + if (AppChunkAnalyze(psFdspInfo, + dChunkId, dChunkSize, dChunkTop, pbPrm) + != MCDRV_SUCCESS) + return MCDRV_ERROR_ARGUMENT; + } + dChunkTop += dChunkSize; + } + + CoefTransCheck(psFdspInfo); + + return MCDRV_SUCCESS; +} + +/**************************************************************************** + * SetAppIrq + * + * Description: + * App interrupt setting + * Arguments: + * dAppIEnb interrupt setting + * Return: + * none + * + ****************************************************************************/ +static void SetAppIrq(UINT32 dAppIEnb) +{ + UINT8 bAppIEnb0; + UINT8 bAppIEnb1; + UINT8 bAppIEnb2; + UINT8 bData; + + bAppIEnb0 = (UINT8)((dAppIEnb >> 16) & 0xFFUL); + bAppIEnb1 = (UINT8)((dAppIEnb >> 8) & 0xFFUL); + bAppIEnb2 = (UINT8)(dAppIEnb & 0xFFUL); + + if (gsFdspInfo.bAppIEnb0 != bAppIEnb0) { + bData = (UINT8)(bAppIEnb0 & (UINT8)~gsFdspInfo.bAppIEnb0); + if (bData != 0x00) + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_IREQAPP0), + bData); + + gsFdspInfo.bAppIEnb0 = bAppIEnb0; + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_APPIENB0), + gsFdspInfo.bAppIEnb0); + + McDevIf_ExecutePacket(); + } + + if (gsFdspInfo.bAppIEnb1 != bAppIEnb1) { + bData = (UINT8)(bAppIEnb1 & (UINT8)~gsFdspInfo.bAppIEnb1); + if (bData != 0x00) + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_IREQAPP1), + bData); + + gsFdspInfo.bAppIEnb1 = bAppIEnb1; + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_APPIENB1), + gsFdspInfo.bAppIEnb1); + + McDevIf_ExecutePacket(); + } + + if (gsFdspInfo.bAppIEnb2 != bAppIEnb2) { + bData = (UINT8)(bAppIEnb2 & (UINT8)~gsFdspInfo.bAppIEnb2); + if (bData != 0x00) + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_IREQAPP2), + bData); + + gsFdspInfo.bAppIEnb2 = bAppIEnb2; + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_APPIENB2), + gsFdspInfo.bAppIEnb2); + + McDevIf_ExecutePacket(); + } +} + +/**************************************************************************** + * DisableIrq + * + * Description: + * Interrupt disable setting + * Arguments: + * psFdspInfo MCDRV_FDSP_AEC_FDSP_INFO + * structure pointer + * Return: + * none + * + ****************************************************************************/ +static void DisableIrq(struct MCDRV_FDSP_AEC_FDSP_INFO *psFdspInfo) +{ + if ((psFdspInfo->bMustStop & STOP_KIND_FDSP) != 0) { + /* IEnb */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_IESERR), + MCI_IESERR_DEF); + + /* TopIEnb */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_TOPIENB), + MCI_TOPIENB_DEF); + + McDevIf_ExecutePacket(); + + SetAppIrq(0x00); + + } else if ((psFdspInfo->bMustStop & STOP_KIND_APP) != 0) + SetAppIrq((gsFdspInfo.dAppIEnb & ~psFdspInfo->dTargetApp)); +} + +/**************************************************************************** + * FixAppVolFadeOut + * + * Description: + * Fixed VOL fadeout + * Arguments: + * none + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR_TIMEOUT + * + ****************************************************************************/ +static SINT32 FixAppVolFadeOut(void) +{ + UINT8 bAct; + + if (gsFdspInfo.bFixAppVol != FIX_APP_VOL_EXIST) + return MCDRV_SUCCESS; + + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_F + | (UINT32)FIX_APP_VOL_ACT), &bAct, 1); + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_IREQAPP0), + MCB_IRAPP22); + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)FIX_APP_VOL_REG_FADE_CTRL), + 0x00); + + McDevIf_ExecutePacket(); + + if ((bAct & FIX_APP_VOL_BIT) == 0) + return MCDRV_SUCCESS; + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_TIMWAIT + | (UINT32)FIX_APP_FADE_WAIT_TIME_US), + 0x00); + + McDevIf_ExecutePacket(); + + return MCDRV_SUCCESS; +} + +/**************************************************************************** + * DSPTransWait + * + * Description: + * DSP forwarding waiting + * Arguments: + * none + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR_TIMEOUT + * + ****************************************************************************/ +static SINT32 DSPTransWait(void) +{ + SINT32 sdResult; + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_EVTWAIT + | MCDRV_EVT_IF_REG_FLAG_RESET + | (((UINT32)MCI_FDSPTREQ) << 8) + | (UINT32)MCB_FDSPTREQ), + 0); + + sdResult = McDevIf_ExecutePacket(); + + return sdResult; +} + +/**************************************************************************** + * SetFdspCtrl + * + * Description: + * Execution and stop settings of F-DSP + * Arguments: + * bDSPCtl DSPCtl register value + * Return: + * MCDRV_SUCCESS + * FDSP_DRV_SUCCESS_STOPED + * + ****************************************************************************/ +static SINT32 SetFdspCtrl(UINT8 bDSPCtl) +{ + UINT8 bData; + SINT32 sdResult; + + sdResult = MCDRV_SUCCESS; + + if ((bDSPCtl & MCB_DSPSTART) != MCB_DSPSTART) { + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_DSPSTATE), + &bData, 1); + if ((bData & MCB_DSPACT) != MCB_DSPACT) + sdResult = FDSP_DRV_SUCCESS_STOPED; + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FDSPTREQ), + MCI_FDSPTREQ_DEF); + } + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_DSPCTRL), + bDSPCtl); + + McDevIf_ExecutePacket(); + + gsFdspInfo.bDSPCtl = bDSPCtl; + + return sdResult; +} + +/**************************************************************************** + * FdspStop + * + * Description: + * Stop F-DSP + * Arguments: + * none + * Return: + * MCDRV_SUCCESS + * FDSP_DRV_SUCCESS_STOPED + * MCDRV_ERROR_TIMEOUT + * + ****************************************************************************/ +static SINT32 FdspStop(void) +{ + SINT32 sdResult; + + sdResult = SetFdspCtrl(MCI_DSPCTRL_DEF); + if (sdResult != (SINT32)FDSP_DRV_SUCCESS_STOPED) { + McDevIf_AddPacket((MCDRV_PACKET_TYPE_TIMWAIT + | gsFdspInfo.sInit.dWaitTime), + 0x00); + + McDevIf_ExecutePacket(); + + if (gsFdspInfo.cbfunc != NULL) { + gsFdspInfo.cbfunc(0, FDSP_CB_RESET, 0); + InitCore(); + } + } + + return MCDRV_SUCCESS; +} + +/**************************************************************************** + * AppFade + * + * Description: + * APP Fade setting + * Arguments: + * none + * Return: + * none + * + ****************************************************************************/ +static void AppFade(void) +{ + UINT8 bFade0; + UINT8 bFade1; + UINT8 bFade2; + + bFade0 = (UINT8)((gsFdspInfo.dAppFade >> 16) & 0xFFUL); + bFade1 = (UINT8)((gsFdspInfo.dAppFade >> 8) & 0xFFUL); + bFade2 = (UINT8)(gsFdspInfo.dAppFade & 0xFFUL); + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_APPFADE0), bFade0); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_APPFADE1), bFade1); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_APPFADE2), bFade2); + + McDevIf_ExecutePacket(); +} + +/**************************************************************************** + * SetAppExec + * + * Description: + * APP execution setting + * Arguments: + * bAppExec0 App23-16 + * bAppExec1 App15-8 + * bAppExec2 App7-0 + * Return: + * none + * + ****************************************************************************/ +static void SetAppExec(UINT8 bAppExec0, UINT8 bAppExec1, UINT8 bAppExec2) +{ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_APPEXEC0), + bAppExec0); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_APPEXEC1), + bAppExec1); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_APPEXEC2), + bAppExec2); + McDevIf_ExecutePacket(); + + gsFdspInfo.bAppExec0 = bAppExec0; + gsFdspInfo.bAppExec1 = bAppExec1; + gsFdspInfo.bAppExec2 = bAppExec2; +} + +/**************************************************************************** + * AppStop + * + * Description: + * APP Stop + * Arguments: + * dAppStop Stopping APP + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR_TIMEOUT + * + ****************************************************************************/ +static SINT32 AppStop(UINT32 dAppStop) +{ + UINT8 bAppStop0; + UINT8 bAppStop1; + UINT8 bAppStop2; + UINT8 bAppStop0Org; + UINT8 bAppStop1Org; + UINT8 bAppStop2Org; + UINT8 bAppExec0; + UINT8 bAppExec1; + UINT8 bAppExec2; + SINT32 sdResult; + + sdResult = (SINT32)MCDRV_SUCCESS; + + if (dAppStop == 0UL) + return sdResult; + + bAppStop0 = (UINT8)((dAppStop >> 16) & (UINT32)MCB_APPEXEC0); + bAppStop1 = (UINT8)((dAppStop >> 8) & (UINT32)MCB_APPEXEC1); + bAppStop2 = (UINT8)(dAppStop & (UINT32)MCB_APPEXEC2); + bAppStop0Org = bAppStop0; + bAppStop1Org = bAppStop1; + bAppStop2Org = bAppStop2; + + bAppStop0 = (UINT8)(gsFdspInfo.bAppExec0 & bAppStop0); + bAppStop1 = (UINT8)(gsFdspInfo.bAppExec1 & bAppStop1); + bAppStop2 = (UINT8)(gsFdspInfo.bAppExec2 & bAppStop2); + + bAppExec0 = (UINT8)(gsFdspInfo.bAppExec0 & (UINT8)~bAppStop0); + bAppExec1 = (UINT8)(gsFdspInfo.bAppExec1 & (UINT8)~bAppStop1); + bAppExec2 = (UINT8)(gsFdspInfo.bAppExec2 & (UINT8)~bAppStop2); + SetAppExec(bAppExec0, bAppExec1, bAppExec2); + + if (bAppStop0Org != 0) { + McDevIf_AddPacket((MCDRV_PACKET_TYPE_EVTWAIT + | MCDRV_EVT_F_REG_FLAG_RESET + | (((UINT32)MCI_APPACT0) << 8) + | (UINT32)bAppStop0Org), 0); + + sdResult = McDevIf_ExecutePacket(); + if (sdResult < MCDRV_SUCCESS) + return sdResult; + } + if (bAppStop1Org != 0) { + McDevIf_AddPacket((MCDRV_PACKET_TYPE_EVTWAIT + | MCDRV_EVT_F_REG_FLAG_RESET + | (((UINT32)MCI_APPACT1) << 8) + | (UINT32)bAppStop1Org), 0); + + sdResult = McDevIf_ExecutePacket(); + if (sdResult < MCDRV_SUCCESS) + return sdResult; + } + if (bAppStop2Org != 0) { + McDevIf_AddPacket((MCDRV_PACKET_TYPE_EVTWAIT + | MCDRV_EVT_F_REG_FLAG_RESET + | (((UINT32)MCI_APPACT2) << 8) + | (UINT32)bAppStop2Org), 0); + + sdResult = McDevIf_ExecutePacket(); + if (sdResult < MCDRV_SUCCESS) + return sdResult; + } + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_IREQAPP0), bAppStop0Org); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_IREQAPP1), bAppStop1Org); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_IREQAPP2), bAppStop2Org); + + McDevIf_ExecutePacket(); + + return sdResult; +} + +/**************************************************************************** + * Stop + * + * Description: + * Stop of F-DSP and APP + * Arguments: + * psFdspInfo MCDRV_FDSP_AEC_FDSP_INFO + * structure pointer + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR_TIMEOUT + * + ****************************************************************************/ +static SINT32 Stop(struct MCDRV_FDSP_AEC_FDSP_INFO *psFdspInfo) +{ + SINT32 sdResult; + + sdResult = (SINT32)MCDRV_SUCCESS; + + if ((psFdspInfo->bMustStop & STOP_KIND_FDSP) != 0) { + if ((gsFdspInfo.bDSPCtl & (UINT8)MCB_DSPSTART) != 0) { + sdResult = FixAppVolFadeOut(); + if (sdResult < MCDRV_SUCCESS) + return sdResult; + + sdResult = DSPTransWait(); + if (sdResult < MCDRV_SUCCESS) + return sdResult; + + } + sdResult = FdspStop(); + } else if ((psFdspInfo->bMustStop & STOP_KIND_APP) != 0) { + sdResult = DSPTransWait(); + if (sdResult < MCDRV_SUCCESS) + return sdResult; + + AppFade(); + sdResult = AppStop(psFdspInfo->dTargetApp); + + } else if ((psFdspInfo->bMustStop & STOP_KIND_WAIT) != 0) + sdResult = DSPTransWait(); + + return sdResult; +} + +/**************************************************************************** + * FwCtlDL + * + * Description: + * FWCTL Setting + * Arguments: + * psFdspInfo MCDRV_FDSP_AEC_FDSP_INFO + * structure pointer + * Return: + * none + * + ****************************************************************************/ +static void FwCtlDL(struct MCDRV_FDSP_AEC_FDSP_INFO *psFdspInfo) +{ + UINT8 bData; + UINT8 *pbFwCtl; + UINT32 i; + + pbFwCtl = psFdspInfo->pbFwctrl; + + /* AppExec */ + for (i = 0; i < (UINT32)FDSP_APP_NUM; ++i) { + if (i != FIX_APP_VOL_NO) { + switch (pbFwCtl[FWCTL_APPEXEC + i]) { + case FDSP_APP_EXEC_STOP: + psFdspInfo->dAppExec &= ~(0x01UL << i); + break; + + case FDSP_APP_EXEC_START: + psFdspInfo->dAppExec |= (0x01UL << i); + break; + + default: + break; + } + } + } + + if ((psFdspInfo->bMustStop & STOP_KIND_FDSP) == 0) + return; + + /* FWMod */ + bData = (UINT8)((pbFwCtl[FWCTL_FWMOD] << 4) & MCB_FWMOD); + /* Fs */ + if (pbFwCtl[FWCTL_FS] != 0xFF) { + bData |= (UINT8)(pbFwCtl[FWCTL_FS] & MCB_FS); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_FWMOD), + bData); + } + + /* FadeCode */ + if (pbFwCtl[FWCTL_FADECODE] != 0xFF) { + bData = (pbFwCtl[FWCTL_FADECODE] & MCB_FADECODE); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_FADECODE), + bData); + } + + McDevIf_ExecutePacket(); +} + +/**************************************************************************** + * ChSelDL + * + * Description: + * CHSEL Setting + * Arguments: + * pbChSel CHSEL chunk pointer + * Return: + * none + * + ****************************************************************************/ +static void ChSelDL(UINT8 *pbChSel) +{ + UINT8 bData; + + /* Bypass */ + gsFdspInfo.bDSPBypass = + (UINT8)((pbChSel[CHSEL_BYPASS] << 7) & MCB_DSPBYPASS); + + /* InFdspSrc */ + bData = (UINT8)((pbChSel[CHSEL_INFDSPSRC + 1] << 4) & MCB_ADI01CSEL); + bData |= (UINT8)(pbChSel[CHSEL_INFDSPSRC + 0] & MCB_ADI00CSEL); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_ADICSEL0), + bData); + + bData = (UINT8)((pbChSel[CHSEL_INFDSPSRC + 3] << 4) & MCB_ADI03CSEL); + bData |= (UINT8)(pbChSel[CHSEL_INFDSPSRC + 2] & MCB_ADI02CSEL); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_ADICSEL1), + bData); + + bData = (UINT8)((pbChSel[CHSEL_INFDSPSRC + 5] << 4) & MCB_ADI05CSEL); + bData |= (UINT8)(pbChSel[CHSEL_INFDSPSRC + 4] & MCB_ADI04CSEL); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_ADICSEL2), + bData); + + bData = (UINT8)((pbChSel[CHSEL_INFDSPSRC + 7] << 4) & MCB_ADI07CSEL); + bData |= (UINT8)(pbChSel[CHSEL_INFDSPSRC + 6] & MCB_ADI06CSEL); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_ADICSEL3), + bData); + + bData = (UINT8)((pbChSel[CHSEL_INFDSPSRC + 9] << 4) & MCB_ADI09CSEL); + bData |= (UINT8)(pbChSel[CHSEL_INFDSPSRC + 8] & MCB_ADI08CSEL); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_ADICSEL4), + bData); + + bData = (UINT8)((pbChSel[CHSEL_INFDSPSRC + 11] << 4) & MCB_ADI11CSEL); + bData |= (UINT8)(pbChSel[CHSEL_INFDSPSRC + 10] & MCB_ADI10CSEL); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_ADICSEL5), + bData); + + bData = (UINT8)((pbChSel[CHSEL_INFDSPSRC + 13] << 4) & MCB_ADI13CSEL); + bData |= (UINT8)(pbChSel[CHSEL_INFDSPSRC + 12] & MCB_ADI12CSEL); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_ADICSEL6), + bData); + + bData = (UINT8)((pbChSel[CHSEL_INFDSPSRC + 15] << 4) & MCB_ADI15CSEL); + bData |= (UINT8)(pbChSel[CHSEL_INFDSPSRC + 14] & MCB_ADI14CSEL); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_ADICSEL7), + bData); + + /* OutAudioSrc */ + bData = (UINT8)((pbChSel[CHSEL_OUTAUDIOSRC + 1] << 4) & MCB_ADO01CSEL); + bData |= (UINT8)(pbChSel[CHSEL_OUTAUDIOSRC + 0] & MCB_ADO00CSEL); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_ADOCSEL0), + bData); + + bData = (UINT8)((pbChSel[CHSEL_OUTAUDIOSRC + 3] << 4) & MCB_ADO03CSEL); + bData |= (UINT8)(pbChSel[CHSEL_OUTAUDIOSRC + 2] & MCB_ADO02CSEL); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_ADOCSEL1), + bData); + + bData = (UINT8)((pbChSel[CHSEL_OUTAUDIOSRC + 5] << 4) & MCB_ADO05CSEL); + bData |= (UINT8)(pbChSel[CHSEL_OUTAUDIOSRC + 4] & MCB_ADO04CSEL); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_ADOCSEL2), + bData); + + bData = (UINT8)((pbChSel[CHSEL_OUTAUDIOSRC + 7] << 4) & MCB_ADO07CSEL); + bData |= (UINT8)(pbChSel[CHSEL_OUTAUDIOSRC + 6] & MCB_ADO06CSEL); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_ADOCSEL3), + bData); + + bData = (UINT8)((pbChSel[CHSEL_OUTAUDIOSRC + 9] << 4) & MCB_ADO09CSEL); + bData |= (UINT8)(pbChSel[CHSEL_OUTAUDIOSRC + 8] & MCB_ADO08CSEL); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_ADOCSEL4), + bData); + + bData = (UINT8)((pbChSel[CHSEL_OUTAUDIOSRC + 11] << 4) + & MCB_ADO11CSEL); + bData |= (UINT8)(pbChSel[CHSEL_OUTAUDIOSRC + 10] & MCB_ADO10CSEL); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_ADOCSEL5), + bData); + + bData = (UINT8)((pbChSel[CHSEL_OUTAUDIOSRC + 13] << 4) + & MCB_ADO13CSEL); + bData |= (UINT8)(pbChSel[CHSEL_OUTAUDIOSRC + 12] & MCB_ADO12CSEL); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_ADOCSEL6), + bData); + + bData = (UINT8)((pbChSel[CHSEL_OUTAUDIOSRC + 15] << 4) + & MCB_ADO15CSEL); + bData |= (UINT8)(pbChSel[CHSEL_OUTAUDIOSRC + 14] & MCB_ADO14CSEL); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_ADOCSEL7), + bData); + + McDevIf_ExecutePacket(); +} + +/**************************************************************************** + * TopEnvDL + * + * Description: + * TOP environmental setting + * Arguments: + * pbTopEnv TOP environmental chunk pointer + * Return: + * none + * + ****************************************************************************/ +static void TopEnvDL(UINT8 *pbTopEnv) +{ + UINT8 bData; + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAA_19_16), + 0x00); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAA_15_8), + 0x00); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAA_7_0), + 0x08); + + /* OMACtl */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FDSPTINI), MCI_FDSPTINI_DEF); + McDevIf_ExecutePacket(); + + /* 0x00008 */ + /* ID */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF | (UINT32)MCI_FMAD), + pbTopEnv[TOP_ENV_ID]); + /* InstBase */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAD), + (UINT8)(pbTopEnv[TOP_ENV_INSTBASE + 1] & 0x1F)); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAD), + pbTopEnv[TOP_ENV_INSTBASE + 2]); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAD), + pbTopEnv[TOP_ENV_INSTBASE + 3]); + + /* 0x00009 */ + /* MBlkSize */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAD), + (UINT8)(pbTopEnv[TOP_ENV_MBLKSIZE] & 0x1F)); + /* MBufSize */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAD), + (UINT8)(pbTopEnv[TOP_ENV_MBUFSIZE] & 0x1F)); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAD), + 0x00); + /* MOChCnfg */ + bData = ((pbTopEnv[TOP_ENV_MOCHCNFG] << 4) & 0xF0); + /* MIChCnfg */ + bData |= (pbTopEnv[TOP_ENV_MICHCNFG] & 0x0F); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAD), + bData); + + /* 0x0000A */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAD), + 0x00); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAD), + 0x00); + /* SStartCh */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAD), + (UINT8)(pbTopEnv[TOP_ENV_SSTARTCH] & 0x0F)); + /* SNumOfOCh */ + bData = ((pbTopEnv[TOP_ENV_SNUMOFOCH] << 4) & 0xF0); + /* SNumOfICh */ + bData |= (pbTopEnv[TOP_ENV_SNUMOFICH] & 0x0F); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAD), + bData); + + /* 0x0000B */ + /* SaveBufSize1 */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAD), + pbTopEnv[TOP_ENV_SAVEBUFSIZE1 + 2]); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAD), + pbTopEnv[TOP_ENV_SAVEBUFSIZE1 + 3]); + /* SaveBufSize0 */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAD), + pbTopEnv[TOP_ENV_SAVEBUFSIZE0 + 2]); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAD), + pbTopEnv[TOP_ENV_SAVEBUFSIZE0 + 3]); + + /* 0x0000C */ + /* LimitWorkSize */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAD), + 0x00); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAD), + (UINT8)(pbTopEnv[TOP_ENV_LIMITWORKSIZE + 1] & 0x0F)); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAD), + pbTopEnv[TOP_ENV_LIMITWORKSIZE + 2]); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAD), + pbTopEnv[TOP_ENV_LIMITWORKSIZE + 3]); + + /* 0x0000D */ + /* WorkBase */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAD), + 0x00); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAD), + (UINT8)(pbTopEnv[TOP_ENV_WORKBASE + 1] & 0x0F)); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAD), + pbTopEnv[TOP_ENV_WORKBASE + 2]); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAD), + pbTopEnv[TOP_ENV_WORKBASE + 3]); + + /* 0x0000E */ + /* TopBase0 */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAD), + 0x00); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAD), + (UINT8)(pbTopEnv[TOP_ENV_TOPBASE0 + 1] & 0x1F)); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAD), + pbTopEnv[TOP_ENV_TOPBASE0 + 2]); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAD), + pbTopEnv[TOP_ENV_TOPBASE0 + 3]); + + McDevIf_ExecutePacket(); +} + +/**************************************************************************** + * TopCoefDL + * + * Description: + * TOP coefficient setting + * Arguments: + * pbTopCoef TOP coefficient chunk pointer + * Return: + * none + * + ****************************************************************************/ +static void TopCoefDL(UINT8 *pbTopCoef) +{ + UINT32 dSize; + UINT32 i; + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAA_19_16), + (UINT8)(pbTopCoef[TOP_COEF_ADR + 1] & MCB_FMAA_19_16)); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAA_15_8), + (UINT8)(pbTopCoef[TOP_COEF_ADR + 2] & MCB_FMAA_15_8)); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAA_7_0), + (UINT8)(pbTopCoef[TOP_COEF_ADR + 3] & MCB_FMAA_7_0)); + + /* OMACtl */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FDSPTINI), + MCI_FDSPTINI_DEF); + + McDevIf_ExecutePacket(); + + dSize = CreateUINT32(pbTopCoef[TOP_COEF_SIZE + 0], + pbTopCoef[TOP_COEF_SIZE + 1], + pbTopCoef[TOP_COEF_SIZE + 2], + pbTopCoef[TOP_COEF_SIZE + 3]); + + for (i = 0; i < dSize; i++) + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAD), + pbTopCoef[TOP_COEF_DATA + i]); + + McDevIf_ExecutePacket(); +} + +/**************************************************************************** + * AppCoefDL + * + * Description: + * APP coefficient setting + * Arguments: + * pbAppCoef APP coefficient chunk pointer + * bCoefTrans + * Return: + * none + * + ****************************************************************************/ +static void AppCoefDL(UINT8 *pbAppCoef, UINT8 bCoefTrans) +{ + UINT32 dSize; + UINT32 i; + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAA_19_16), + (UINT8)(pbAppCoef[APP_COEF_ADR + 1] & MCB_FMAA_19_16)); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAA_15_8), + (UINT8)(pbAppCoef[APP_COEF_ADR + 2] & MCB_FMAA_15_8)); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAA_7_0), + (UINT8)(pbAppCoef[APP_COEF_ADR + 3] & MCB_FMAA_7_0)); + + /* OMACtl */ + if (bCoefTrans == COEF_DSP_TRANS) + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FDSPTINI), + (UINT8)(MCB_DSPTINI | MCB_FMAMOD_DSP)); + else + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FDSPTINI), + MCI_FDSPTINI_DEF); + + McDevIf_ExecutePacket(); + + dSize = CreateUINT32(pbAppCoef[APP_COEF_SIZE + 0], + pbAppCoef[APP_COEF_SIZE + 1], + pbAppCoef[APP_COEF_SIZE + 2], + pbAppCoef[APP_COEF_SIZE + 3]); + + for (i = 0; i < dSize; i++) + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAD), + pbAppCoef[APP_COEF_DATA + i]); + McDevIf_ExecutePacket(); +} + +/**************************************************************************** + * AppRegDL + * + * Description: + * APP register setting + * Arguments: + * pbAppReg APP register chunk pointer + * Return: + * none + * + ****************************************************************************/ +static void AppRegDL(UINT8 *pbAppReg) +{ + UINT32 dSize; + UINT32 i; + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_F_REG_A), + (UINT8)(pbAppReg[APP_REG_ADR + 3] | MCB_F_REG_AINC)); + + McDevIf_ExecutePacket(); + + dSize = CreateUINT32(pbAppReg[APP_REG_SIZE + 0], + pbAppReg[APP_REG_SIZE + 1], + pbAppReg[APP_REG_SIZE + 2], + pbAppReg[APP_REG_SIZE + 3]); + + for (i = 0; i < dSize; i++) + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_F_REG_D), + pbAppReg[APP_REG_DATA + i]); + McDevIf_ExecutePacket(); +} + +/**************************************************************************** + * MultiChunkDL + * + * Description: + * Download of multidata input possible chunk + * Arguments: + * psFdspInfo MCDRV_FDSP_AEC_FDSP_INFO + * structure pointer + * dTargetChunk target chunk + * Return: + * none + * + ****************************************************************************/ +static void MultiChunkDL(struct MCDRV_FDSP_AEC_FDSP_INFO *psFdspInfo, + UINT32 dTargetChunk) +{ + UINT32 dChunkTop; + UINT32 dChunkId; + UINT32 dChunkSize; + UINT32 dAppNo; + UINT8 *pbPrm; + UINT32 dSize; + + pbPrm = psFdspInfo->pbChunkData; + dSize = psFdspInfo->dwSize; + + dChunkTop = 0; + while (dChunkTop < dSize) { + dChunkId = CreateUINT32(pbPrm[dChunkTop + 0UL], + pbPrm[dChunkTop + 1UL], + pbPrm[dChunkTop + 2UL], + pbPrm[dChunkTop + 3UL]); + dChunkSize = CreateUINT32(pbPrm[dChunkTop + 4UL], + pbPrm[dChunkTop + 5UL], + pbPrm[dChunkTop + 6UL], + pbPrm[dChunkTop + 7UL]); + + dChunkTop += (UINT32)CHUNK_SIZE; + + dAppNo = (dChunkId & (UINT32)AEC_FDSP_TAG_APPNO_MASK); + switch ((dChunkId & (UINT32)AEC_FDSP_TAG_APP_MASK)) { + case AEC_FDSP_TAG_APP_COEF: + case AEC_FDSP_TAG_APP_CONST: + if (dTargetChunk == (UINT32)MULTI_CHUNK_APP_COEF) + if (dAppNo < (UINT32)FDSP_APP_NUM) + AppCoefDL(&pbPrm[dChunkTop], + psFdspInfo->bCoefTrans); + break; + + case AEC_FDSP_TAG_APP_REG: + if (dTargetChunk == (UINT32)MULTI_CHUNK_APP_REG) + if (dAppNo < (UINT32)FDSP_APP_NUM) + AppRegDL(&pbPrm[dChunkTop]); + break; + + default: + if ((dChunkId == AEC_FDSP_TAG_TOP_COEF) && + (dTargetChunk == + (UINT32)MULTI_CHUNK_TOP_COEF)) + TopCoefDL(&pbPrm[dChunkTop]); + break; + } + dChunkTop += dChunkSize; + } +} + +/**************************************************************************** + * TopInstDL + * + * Description: + * TOP instruction setting + * Arguments: + * pbTopInst TOP instruction chunk pointer + * Return: + * none + * + ****************************************************************************/ +static void TopInstDL(UINT8 *pbTopInst) +{ + UINT32 dSize; + UINT32 i; + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAA_19_16), + (UINT8)(pbTopInst[TOP_INST_ADR + 1] & MCB_FMAA_19_16)); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAA_15_8), + (UINT8)(pbTopInst[TOP_INST_ADR + 2] & MCB_FMAA_15_8)); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAA_7_0), + (UINT8)(pbTopInst[TOP_INST_ADR + 3] & MCB_FMAA_7_0)); + + /* OMACtl */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FDSPTINI), + MCB_FMABUS_I); + + McDevIf_ExecutePacket(); + + dSize = CreateUINT32(pbTopInst[TOP_INST_SIZE + 0], + pbTopInst[TOP_INST_SIZE + 1], + pbTopInst[TOP_INST_SIZE + 2], + pbTopInst[TOP_INST_SIZE + 3]); + + for (i = 0; i < dSize; i++) + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAD), + pbTopInst[TOP_INST_DATA + i]); + McDevIf_ExecutePacket(); +} + +/**************************************************************************** + * FixAppEnvDL + * + * Description: + * Fix APP setting + * Arguments: + * dAppNo APP number + * pbAppEnv APP environmental chunk pointer + * Return: + * none + * + ****************************************************************************/ +static void SetFixApp(UINT32 dAppNo, UINT8 *pbAppEnv) +{ + if (dAppNo != FIX_APP_VOL_NO) + return; + + if (pbAppEnv[APP_ENV_ID] == APP_VOL_ID) + gsFdspInfo.bFixAppVol = FIX_APP_VOL_EXIST; + else + gsFdspInfo.bFixAppVol = FIX_APP_VOL_FREE; +} + +/**************************************************************************** + * AppEnvDL + * + * Description: + * APP environmental setting + * Arguments: + * dAppNo APP number + * pbAppEnv APP environmental chunk pointer + * Return: + * none + * + ****************************************************************************/ +static void AppEnvDL(UINT32 dAppNo, UINT8 *pbAppEnv) +{ + UINT32 dBase; + UINT8 bData; + + dBase = 0x00010UL + (dAppNo * 8UL); + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAA_19_16), + (UINT8)((dBase >> 16) + & (UINT32)MCB_FMAA_19_16)); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAA_15_8), + (UINT8)((dBase >> 8) & (UINT32)MCB_FMAA_15_8)); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAA_7_0), + (UINT8)(dBase & (UINT32)MCB_FMAA_7_0)); + + /* OMACtl */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FDSPTINI), + MCI_FDSPTINI_DEF); + + /* Base + 0x00000 */ + /* ID */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAD), + pbAppEnv[APP_ENV_ID]); + /* ExcecProcess */ + bData = ((pbAppEnv[APP_ENV_EXCECPROCESS] << 7) & 0x80); + /* InstBase */ + bData |= (pbAppEnv[APP_ENV_INSTBASE + 1] & 0x1F); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAD), + bData); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAD), + pbAppEnv[APP_ENV_INSTBASE + 2]); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAD), + pbAppEnv[APP_ENV_INSTBASE + 3]); + + /* Base + 0x00001 */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAD), + 0x00); + /* RegBase */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAD), + (UINT8)(pbAppEnv[APP_ENV_REGBASE + 3] & 0x7F)); + /* ExecFs */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAD), + (UINT8)(pbAppEnv[APP_ENV_EXECFS + 2] & 0x7F)); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAD), + pbAppEnv[APP_ENV_EXECFS + 3]); + + /* Base + 0x00002 */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAD), + 0x00); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAD), + 0x00); + /* ExecCh */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAD), + pbAppEnv[APP_ENV_EXECCH + 2]); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAD), + pbAppEnv[APP_ENV_EXECCH + 3]); + + /* Base + 0x00003 */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAD), + 0x00); + /* WorkBase */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAD), + (UINT8)(pbAppEnv[APP_ENV_WORKBASE + 1] & 0x1F)); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAD), + pbAppEnv[APP_ENV_WORKBASE + 2]); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAD), + pbAppEnv[APP_ENV_WORKBASE + 3]); + + /* Base + 0x00004 */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAD), + 0x00); + /* AppBase0 */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAD), + (UINT8)(pbAppEnv[APP_ENV_APPBASE0 + 1] & 0x1F)); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAD), + pbAppEnv[APP_ENV_APPBASE0 + 2]); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAD), + pbAppEnv[APP_ENV_APPBASE0 + 3]); + + /* Base + 0x00005 */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAD), + 0x00); + /* AppBase1 */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAD), + (UINT8)(pbAppEnv[APP_ENV_APPBASE1 + 1] & 0x1F)); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAD), + pbAppEnv[APP_ENV_APPBASE1 + 2]); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAD), + pbAppEnv[APP_ENV_APPBASE1 + 3]); + + /* Base + 0x00006 */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAD), + 0x00); + /* AppBase2 */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAD), + (UINT8)(pbAppEnv[APP_ENV_APPBASE2 + 1] & 0x1F)); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAD), + pbAppEnv[APP_ENV_APPBASE2 + 2]); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAD), + pbAppEnv[APP_ENV_APPBASE2 + 3]); + + /* Base + 0x00007 */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAD), + 0x00); + /* AppBase3 */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAD), + (UINT8)(pbAppEnv[APP_ENV_APPBASE3 + 1] & 0x1F)); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAD), + pbAppEnv[APP_ENV_APPBASE3 + 2]); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAD), + pbAppEnv[APP_ENV_APPBASE3 + 3]); + + McDevIf_ExecutePacket(); + + /* register */ + /* Fade */ + if ((pbAppEnv[APP_ENV_APPFADE] & APP_PARAM_ON) == APP_PARAM_ON) + gsFdspInfo.dAppFade |= (UINT32)(0x01UL << dAppNo); + else + gsFdspInfo.dAppFade &= (UINT32)~(0x01UL << dAppNo); + + /* irq */ + if ((pbAppEnv[APP_ENV_APPIRQ] & APP_PARAM_ON) == APP_PARAM_ON) + gsFdspInfo.dAppIEnb |= (UINT32)(0x01UL << dAppNo); + else + gsFdspInfo.dAppIEnb &= (UINT32)~(0x01UL << dAppNo); +} + +/**************************************************************************** + * AppInstDL + * + * Description: + * APP instruction setting + * Arguments: + * pbAppInst APP instruction chunk pointer + * Return: + * none + * + ****************************************************************************/ +static void AppInstDL(UINT8 *pbAppInst) +{ + UINT32 dSize; + UINT32 i; + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAA_19_16), + (UINT8)(pbAppInst[APP_INST_ADR + 1] & MCB_FMAA_19_16)); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAA_15_8), + (UINT8)(pbAppInst[APP_INST_ADR + 2] & MCB_FMAA_15_8)); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAA_7_0), + (UINT8)(pbAppInst[APP_INST_ADR + 3] & MCB_FMAA_7_0)); + + /* OMACtl */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FDSPTINI), MCB_FMABUS_I); + + McDevIf_ExecutePacket(); + + dSize = CreateUINT32(pbAppInst[APP_INST_SIZE + 0], + pbAppInst[APP_INST_SIZE + 1], + pbAppInst[APP_INST_SIZE + 2], + pbAppInst[APP_INST_SIZE + 3]); + + for (i = 0; i < dSize; i++) + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAD), + pbAppInst[APP_INST_DATA + i]); + McDevIf_ExecutePacket(); +} + +/**************************************************************************** + * Download + * + * Description: + * Download of FW and coefficient to F-DSP + * Arguments: + * psFdspInfo MCDRV_FDSP_AEC_FDSP_INFO + * structure pointer + * Return: + * none + * + ****************************************************************************/ +static void Download(struct MCDRV_FDSP_AEC_FDSP_INFO *psFdspInfo) +{ + UINT32 i; + + if (psFdspInfo->pbFwctrl != NULL) + FwCtlDL(psFdspInfo); + + if (psFdspInfo->pbChSel != NULL) + ChSelDL(psFdspInfo->pbChSel); + + if (psFdspInfo->pbTopEnv != NULL) + TopEnvDL(psFdspInfo->pbTopEnv); + + if (psFdspInfo->dTopCoefCnt != 0UL) + MultiChunkDL(psFdspInfo, MULTI_CHUNK_TOP_COEF); + + if (psFdspInfo->pbTopInst != NULL) + TopInstDL(psFdspInfo->pbTopInst); + + if (psFdspInfo->dTargetApp != 0UL) + for (i = 0; i < (UINT32)FDSP_APP_NUM; ++i) + if (psFdspInfo->apbAppEnv[i] != NULL) { + SetFixApp(i, psFdspInfo->apbAppEnv[i]); + AppEnvDL(i, psFdspInfo->apbAppEnv[i]); + } + + if ((psFdspInfo->dAppCoefCnt != 0UL) || + (psFdspInfo->dAppCnstCnt != 0UL)) { + MultiChunkDL(psFdspInfo, MULTI_CHUNK_APP_COEF); + + if (psFdspInfo->bCoefTrans == COEF_DSP_TRANS) { + /* DSPTReq */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FDSPTREQ), + MCB_FDSPTREQ); + McDevIf_ExecutePacket(); + } + } + + if (psFdspInfo->dAppInstCnt != 0UL) + for (i = 0UL; i < (UINT32)FDSP_APP_NUM; ++i) + if (psFdspInfo->apbAppInst[i] != NULL) + AppInstDL(psFdspInfo->apbAppInst[i]); + + if (psFdspInfo->dAppRegCnt != 0UL) + MultiChunkDL(psFdspInfo, MULTI_CHUNK_APP_REG); +} + +/**************************************************************************** + * EnableIrq + * + * Description: + * Interrupt enable setting + * Arguments: + * psFdspInfo MCDRV_FDSP_AEC_FDSP_INFO + * structure pointer + * psExecInfo MCDRV_FDSP_EXEC_INFO + * structure pointer + * Return: + * none + * + ****************************************************************************/ +static void EnableIrq(struct MCDRV_FDSP_AEC_FDSP_INFO *psFdspInfo, + struct MCDRV_FDSP_EXEC_INFO *psExecInfo) +{ + if ((psFdspInfo->bMustStop & STOP_KIND_FDSP) != 0) { + /* IReqTop */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_IREQTOP), MCB_IREQTOP); + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_IRSERR), + (UINT8)(MCB_IRSERR | MCB_IRFW)); + + McDevIf_ExecutePacket(); + + SetAppIrq((gsFdspInfo.dAppIEnb & psExecInfo->dAppExec)); + + /* TopIEnb */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_TOPIENB), MCB_TOPIENB); + + /* IEnb */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_IESERR), + (UINT8)(MCB_IESERR | MCB_IEFW)); + + McDevIf_ExecutePacket(); + + } else if ((psFdspInfo->bMustStop & STOP_KIND_APP_EXEC) != 0) { + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_IRSERR), + MCB_IRFW_DSP); + + McDevIf_ExecutePacket(); + + SetAppIrq(gsFdspInfo.dAppIEnb & psExecInfo->dAppExec); + + } else if ((psFdspInfo->bMustStop & STOP_KIND_APP) != 0) { + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_IRSERR), + MCB_IRFW_DSP); + + McDevIf_ExecutePacket(); + + SetAppIrq(gsFdspInfo.dAppIEnb & psExecInfo->dAppExec); + + } else if ((psFdspInfo->bMustStop & STOP_KIND_WAIT) != 0) { + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_IRSERR), + MCB_IRFW_DSP); + + McDevIf_ExecutePacket(); + } +} + +/**************************************************************************** + * FixAppVolFadeIn + * + * Description: + * Fixed VOL fadein + * Arguments: + * none + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR_TIMEOUT + * + ****************************************************************************/ +static void FixAppVolFadeIn(void) +{ + if (gsFdspInfo.bFixAppVol != FIX_APP_VOL_EXIST) + return; + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)FIX_APP_VOL_REG_FADE_CTRL), + FIX_APP_VOL_REG_FADE_CTRL_BIT); + McDevIf_ExecutePacket(); +} + +/**************************************************************************** + * ReStart + * + * Description: + * re-execution of stop F-DSP and APP + * Arguments: + * psFdspInfo MCDRV_FDSP_AEC_FDSP_INFO + * structure pointer + * psExecInfo MCDRV_FDSP_EXEC_INFO + * structure pointer + * Return: + * none + * + ****************************************************************************/ +static void ReStart(struct MCDRV_FDSP_AEC_FDSP_INFO *psFdspInfo, + struct MCDRV_FDSP_EXEC_INFO *psExecInfo) +{ + UINT8 bAppExec0; + UINT8 bAppExec1; + UINT8 bAppExec2; + UINT32 dAppStop; + UINT32 dAppAct; + + bAppExec0 = (UINT8)((psExecInfo->dAppExec >> 16) + & (UINT32)MCB_APPEXEC0); + bAppExec1 = (UINT8)((psExecInfo->dAppExec >> 8) + & (UINT32)MCB_APPEXEC1); + bAppExec2 = (UINT8)(psExecInfo->dAppExec & (UINT32)MCB_APPEXEC2); + + if ((psFdspInfo->bMustStop & STOP_KIND_FDSP) != 0) { + SetAppExec(bAppExec0, bAppExec1, bAppExec2); + if (psExecInfo->bRestart == RESTART_ON) { + gsFdspInfo.dAppStop = 0UL; + if ((gsFdspInfo.bDSPBypass & MCB_DSPBYPASS) != 0) + SetFdspCtrl(MCB_DSPBYPASS); + else { + SetFdspCtrl(MCB_DSPSTART); + FixAppVolFadeIn(); + } + } + } else if ((psFdspInfo->bMustStop & STOP_KIND_APP_EXEC) != 0) { + dAppStop = ((UINT32)(gsFdspInfo.bAppExec0 & ~bAppExec0)) << 16; + dAppStop |= ((UINT32)(gsFdspInfo.bAppExec1 & ~bAppExec1)) << 8; + dAppStop |= ((UINT32)(gsFdspInfo.bAppExec2 & ~bAppExec2)); + + AppFade(); + SetAppExec(bAppExec0, bAppExec1, bAppExec2); + FixAppVolFadeIn(); + + dAppAct = GetAppAct(); + if ((dAppStop & dAppAct) != dAppStop) + dAppStop &= dAppAct; + + gsFdspInfo.dAppStop |= dAppStop; + } else if ((psFdspInfo->bMustStop & STOP_KIND_APP) != 0) { + AppFade(); + SetAppExec(bAppExec0, bAppExec1, bAppExec2); + FixAppVolFadeIn(); + } +} + +/**************************************************************************** + * SetAudioEngine + * + * Description: + * FW and the coefficient setting are set to F-DSP + * Arguments: + * psFdspInfo MCDRV_FDSP_AEC_FDSP_INFO + * structure pointer + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR_ARGUMENT + * MCDRV_ERROR_TIMEOUT + * + ****************************************************************************/ +static SINT32 SetAudioEngine(struct MCDRV_FDSP_AEC_FDSP_INFO *psFdspInfo) +{ + UINT8 bData; + SINT32 sdResult; + struct MCDRV_FDSP_EXEC_INFO sExecInfo; + + psFdspInfo->dAppExec = CreateUINT32(0x00, gsFdspInfo.bAppExec0, + gsFdspInfo.bAppExec1, gsFdspInfo.bAppExec2); + + if (gsFdspInfo.bDSPCtl != MCI_DSPCTRL_DEF) + sExecInfo.bRestart = RESTART_ON; + else + sExecInfo.bRestart = RESTART_OFF; + + if ((gsFdspInfo.bDSPCtl & (UINT8)MCB_DSPBYPASS) != 0) + psFdspInfo->bMustStop |= STOP_KIND_FDSP; + else if ((gsFdspInfo.bDSPCtl & (UINT8)MCB_DSPSTART) == 0) { + psFdspInfo->bMustStop |= STOP_KIND_FDSP; + psFdspInfo->bCoefTrans = COEF_DMA_TRANS; + } else { + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_DSPSTATE), + &bData, 1); + if ((bData & MCB_DSPACT) != MCB_DSPACT) + psFdspInfo->bCoefTrans = COEF_DMA_TRANS; + } + + DisableIrq(psFdspInfo); + + sdResult = Stop(psFdspInfo); + if (sdResult < (SINT32)MCDRV_SUCCESS) + return sdResult; + + if ((psFdspInfo->bMustStop & STOP_KIND_FDSP) != 0) { + McDevIf_AddPacket((MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_APPFADE0), + 0x00); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_APPFADE1), + 0x00); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_APPFADE2), + 0x00); + } + + Download(psFdspInfo); + + sExecInfo.dAppExec = psFdspInfo->dAppExec; + if (gsFdspInfo.bFixAppVol == FIX_APP_VOL_EXIST) + sExecInfo.dAppExec |= FIX_APP_VOL_APPEXEC; + else + sExecInfo.dAppExec &= ~FIX_APP_VOL_APPEXEC; + + EnableIrq(psFdspInfo, &sExecInfo); + + ReStart(psFdspInfo, &sExecInfo); + + return MCDRV_SUCCESS; +} + +/**************************************************************************** + * McFdsp_Init + * + * Description: + * Initialize + * Arguments: + * psPrm MCDRV_FDSP_INIT structure pointer + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR_ARGUMENT + * + ****************************************************************************/ +SINT32 McFdsp_Init(struct MCDRV_FDSP_INIT *psPrm) +{ + if (gsFdspInfo.dStatus != (UINT32)FDSP_STATUS_IDLE) + return MCDRV_ERROR; + + if (psPrm == NULL) + return MCDRV_ERROR_ARGUMENT; + + gsFdspInfo.sInit.sInput.wADDFmt = psPrm->sInput.wADDFmt; + gsFdspInfo.sInit.sOutput.wADDFmt = psPrm->sOutput.wADDFmt; + + if (psPrm->dWaitTime != 0) + gsFdspInfo.sInit.dWaitTime = psPrm->dWaitTime; + else + gsFdspInfo.sInit.dWaitTime = DEF_FDSP_STOP_WAIT_TIME_US; + + gsFdspInfo.cbfunc = NULL; + gsFdspInfo.bADIMute0 = MCI_ADIMUTE0_DEF; + gsFdspInfo.bADIMute1 = MCI_ADIMUTE1_DEF; + gsFdspInfo.bADOMute0 = MCI_ADOMUTE0_DEF; + gsFdspInfo.bADOMute1 = MCI_ADOMUTE1_DEF; + + InitCore(); + + LoadCtlReg(); + + gsFdspInfo.dStatus = (UINT32)FDSP_STATUS_INITED; + + return MCDRV_SUCCESS; +} + +/**************************************************************************** + * McFdsp_Term + * + * Description: + * Terminate + * Arguments: + * none + * Return: + * MCDRV_SUCCESS + * + ****************************************************************************/ +SINT32 McFdsp_Term(void) +{ + if (gsFdspInfo.dStatus == (UINT32)FDSP_STATUS_IDLE) + return MCDRV_SUCCESS; + + /* IEnb */ + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_IESERR), + MCI_IESERR_DEF); + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_IRSERR), + (UINT8)(MCB_IRSERR | MCB_IRFW)); + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_DSPCTRL), + MCI_DSPCTRL_DEF); + + McDevIf_ExecutePacket(); + + SaveCtlReg(); + + gsFdspInfo.cbfunc = NULL; + gsFdspInfo.dStatus = (UINT32)FDSP_STATUS_IDLE; + + return MCDRV_SUCCESS; +} + +/**************************************************************************** + * McFdsp_IrqProc + * + * Description: + * Interrupt from F-DSP is processed + * Arguments: + * none + * Return: + * none + * + ****************************************************************************/ +void McFdsp_IrqProc(void) +{ + UINT8 bErr; + UINT8 bIReq; + UINT8 bIReqTop; + UINT8 bIReqApp0; + UINT8 bIReqApp1; + UINT8 bIReqApp2; + UINT32 dAppStop; + UINT32 dData; + + bErr = IRQ_NO_ERROR; + bIReqTop = 0; + bIReqApp0 = 0; + bIReqApp1 = 0; + bIReqApp2 = 0; + dAppStop = 0; + + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_IRSERR), + &bIReq, 1); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_IRSERR), + bIReq); + + McDevIf_ExecutePacket(); + + if (((bIReq & MCB_IRSERR) == MCB_IRSERR) || + ((bIReq & MCB_IRFW_STRT) == MCB_IRFW_STRT)) + bErr = IRQ_ERROR; + + if ((bIReq & MCB_IRFW_TOP) == MCB_IRFW_TOP) { + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_IREQTOP), + &bIReqTop, 1); + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_IREQTOP), + bIReqTop); + + McDevIf_ExecutePacket(); + + if (((bIReqTop & MCB_IREQTOP3) == MCB_IREQTOP3) || + ((bIReqTop & MCB_IREQTOP2) == MCB_IREQTOP2)) + bErr = IRQ_ERROR; + } + + if ((bIReq & MCB_IRFW_APP) == MCB_IRFW_APP) { + if (gsFdspInfo.bAppIEnb0 != 0) { + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_IREQAPP0), + &bIReqApp0, 1); + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_IREQAPP0), + bIReqApp0); + + McDevIf_ExecutePacket(); + + bIReqApp0 = (UINT8)(bIReqApp0 & gsFdspInfo.bAppIEnb0); + } + if (gsFdspInfo.bAppIEnb1 != 0) { + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_IREQAPP1), + &bIReqApp1, 1); + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_IREQAPP1), + bIReqApp1); + + McDevIf_ExecutePacket(); + + bIReqApp2 = (UINT8)(bIReqApp1 & gsFdspInfo.bAppIEnb1); + } + if (gsFdspInfo.bAppIEnb2 != 0) { + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_IREQAPP2), + &bIReqApp2, 1); + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_IREQAPP2), + bIReqApp2); + + McDevIf_ExecutePacket(); + bIReqApp2 = (UINT8)(bIReqApp2 & gsFdspInfo.bAppIEnb2); + } + } + + if ((bIReqTop & MCB_IREQTOP0) == MCB_IREQTOP0) { + dData = GetAppAct(); + dAppStop = (gsFdspInfo.dAppStop & ~dData); + gsFdspInfo.dAppStop &= ~dAppStop; + } + + if (gsFdspInfo.cbfunc != NULL) { + if (bErr == IRQ_ERROR) + gsFdspInfo.cbfunc(0, FDSP_CB_ERR, 0); + + if ((bIReq & MCB_IRFW_DSP) == MCB_IRFW_DSP) + gsFdspInfo.cbfunc(0, FDSP_CB_COEF_DONE, 0); + + dData = CreateUINT32(0x00, bIReqApp0, bIReqApp1, bIReqApp2); + dData &= ~0x400000; + if (dData != 0UL) + gsFdspInfo.cbfunc(0, FDSP_CB_APP_REQ, dData); + + if (dAppStop != 0UL) + gsFdspInfo.cbfunc(0, FDSP_CB_APP_STOP, dAppStop); + + if ((bIReqTop & MCB_IREQTOP1) == MCB_IREQTOP1) + gsFdspInfo.cbfunc(0, FDSP_CB_FDSP_STOP, 0); + } +} + +/**************************************************************************** + * McFdsp_SetCBFunc + * + * Description: + * Callback function setting + * Arguments: + * cbfunc Callback function + * Return: + * MCDRV_SUCCESS + * + ****************************************************************************/ +SINT32 McFdsp_SetCBFunc(SINT32 (*cbfunc)(SINT32, UINT32, UINT32)) +{ + gsFdspInfo.cbfunc = cbfunc; + + return MCDRV_SUCCESS; +} + +/**************************************************************************** + * McFdsp_GetTransition + * + * Description: + * It judges while processing the F-DSP control + * Arguments: + * none + * Return: + * 0 has processed + * 1<= processing + * + ****************************************************************************/ +SINT32 McFdsp_GetTransition(void) +{ + SINT32 sdResult; + UINT32 dApp; + UINT8 bData; + + sdResult = 0; + + if (gsFdspInfo.dStatus == (UINT32)FDSP_STATUS_IDLE) + return sdResult; + + /* DSPSTART,DSPACT */ + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_DSPSTATE), &bData, 1); + if ((gsFdspInfo.bDSPCtl & MCB_DSPSTART) == 0) { + if ((bData & MCB_DSPACT) == MCB_DSPACT) + sdResult += (SINT32)FDSP_PRC_FDSP_STOP; + else + return sdResult; + } + + /* DSP Coef Trance */ + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FDSPTREQ), &bData, 1); + if ((bData & MCB_FDSPTREQ) == MCB_FDSPTREQ) + sdResult += (SINT32)FDSP_PRC_COEF_TRS; + + /* APPEXEC,APPACT */ + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_APPACT0), &bData, 1); + dApp = (UINT32)(bData & (UINT8)~gsFdspInfo.bAppExec0); + dApp = (dApp << 8); + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_APPACT1), &bData, 1); + dApp |= (UINT32)(bData & (UINT8)~gsFdspInfo.bAppExec1); + dApp = (dApp << 8); + McDevIf_ReadDirect((MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_APPACT2), &bData, 1); + dApp |= (UINT32)(bData & (UINT8)~gsFdspInfo.bAppExec2); + sdResult += (SINT32)dApp; + + return sdResult; +} + +/**************************************************************************** + * McFdsp_GetDSP + * + * Description: + * FW and the coefficient setting are acquired from F-DSP + * Arguments: + * psPrm MCDRV_FDSP_AE_FW structure pointer + * Return: + * 0<= Get data size + * MCDRV_ERROR_ARGUMENT + * + ****************************************************************************/ +SINT32 McFdsp_GetDSP(UINT32 dTarget, UINT32 dAddress, + UINT8 *pbData, UINT32 dSize) +{ + UINT8 bOMACtl; + UINT8 bAdr0; + UINT8 bAdr1; + UINT8 bAdr2; + UINT8 bHwId; + UINT32 i; + UINT32 dDxramMax; + UINT32 dIramMax; + + if (pbData == NULL) + return MCDRV_ERROR_ARGUMENT; + + bHwId = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_A, MCI_A_DEV_ID); + if ((bHwId & 0x07) == 0) { + dDxramMax = DXRAM_RANGE_MAX_1; + dIramMax = IRAM_RANGE_MAX_1; + } else { + dDxramMax = DXRAM_RANGE_MAX_2; + dIramMax = IRAM_RANGE_MAX_2; + } + + dSize = (dSize / RAM_UNIT_SIZE); + + bOMACtl = MCB_FMADIR_UL; + switch (dTarget) { + case FDSP_AE_FW_DXRAM: + if (dDxramMax < dAddress) + return MCDRV_ERROR_ARGUMENT; + + if ((dDxramMax + 1) < dSize) + dSize = dDxramMax + 1; + + if ((dDxramMax + 1) < (dAddress + dSize)) + dSize -= ((dAddress + dSize) + - (dDxramMax + 1)); + bOMACtl |= MCB_FMABUS_X; + break; + + case FDSP_AE_FW_DYRAM: + if (DYRAM_RANGE_MAX < dAddress) + return MCDRV_ERROR_ARGUMENT; + + if ((DYRAM_RANGE_MAX + 1) < dSize) + dSize = (DYRAM_RANGE_MAX + 1); + + if ((DYRAM_RANGE_MAX + 1) < (dAddress + dSize)) + dSize -= ((dAddress + dSize) + - (DYRAM_RANGE_MAX + 1)); + bOMACtl |= MCB_FMABUS_Y; + break; + + case FDSP_AE_FW_IRAM: + if ((dAddress < IRAM_RANGE_MIN) || + (dIramMax < dAddress)) + return MCDRV_ERROR_ARGUMENT; + + if ((dIramMax - IRAM_RANGE_MIN + 1) < dSize) + dSize = (dIramMax - IRAM_RANGE_MIN + 1); + + if ((dIramMax + 1) < (dAddress + dSize)) + dSize -= ((dAddress + dSize) + - (dIramMax + 1)); + bOMACtl |= MCB_FMABUS_I; + break; + + default: + return MCDRV_ERROR_ARGUMENT; + } + + if (dSize == 0) + return 0; + + if (gsFdspInfo.dStatus == (UINT32)FDSP_STATUS_IDLE) + return 0; + + bAdr0 = (UINT8)((dAddress >> 16) & (UINT32)MCB_FMAA_19_16); + bAdr1 = (UINT8)((dAddress >> 8) & (UINT32)MCB_FMAA_15_8); + bAdr2 = (UINT8)(dAddress & (UINT32)MCB_FMAA_7_0); + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAA_19_16), + bAdr0); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAA_15_8), + bAdr1); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FMAA_7_0), + bAdr2); + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_FDSPTINI), + bOMACtl); + + McDevIf_ExecutePacket(); + + dSize *= RAM_UNIT_SIZE; + for (i = 0; i < dSize; ++i) + McDevIf_ReadDirect( + (MCDRV_PACKET_REGTYPE_IF | (UINT32)MCI_FMAD), + &pbData[i], 1); + + return (SINT32)dSize; +} + +/**************************************************************************** + * McFdsp_SetDSPCheck + * + * Description: + * Check AEC info + * Arguments: + * psPrm MCDRV_AEC_INFO structure pointer + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR_ARGUMENT + * + ****************************************************************************/ +SINT32 McFdsp_SetDSPCheck(struct MCDRV_AEC_INFO *psPrm) +{ + SINT32 sdResult; + struct MCDRV_FDSP_AEC_FDSP_INFO sFdspInfo; + + if (psPrm == NULL) + return MCDRV_ERROR_ARGUMENT; + + sdResult = GetFDSPChunk(psPrm, &sFdspInfo) ; + if (sdResult < (SINT32)MCDRV_SUCCESS) + return MCDRV_ERROR_ARGUMENT; + + sdResult = FdspChunkAnalyze(&sFdspInfo); + if (sdResult < (SINT32)MCDRV_SUCCESS) + return sdResult; + + return MCDRV_SUCCESS; +} + +/**************************************************************************** + * McFdsp_SetDSP + * + * Description: + * FW and the coefficient setting are set to F-DSP + * Arguments: + * psPrm MCDRV_AEC_INFO structure pointer + * Return: + * MCDRV_SUCCESS + * MCDRV_PROCESSING + * MCDRV_ERROR + * MCDRV_ERROR_ARGUMENT + * + ****************************************************************************/ +SINT32 McFdsp_SetDSP(struct MCDRV_AEC_INFO *psPrm) +{ + SINT32 sdResult; + struct MCDRV_FDSP_AEC_FDSP_INFO sFdspInfo; + + if (psPrm == NULL) + return MCDRV_ERROR_ARGUMENT; + + sdResult = GetFDSPChunk(psPrm, &sFdspInfo) ; + if (sdResult < (SINT32)MCDRV_SUCCESS) + return MCDRV_ERROR_ARGUMENT; + + sdResult = FdspChunkAnalyze(&sFdspInfo); + if (sdResult < (SINT32)MCDRV_SUCCESS) + return sdResult; + + if ((sFdspInfo.pbChunkData == NULL) || + (sFdspInfo.dwSize == 0)) + return MCDRV_SUCCESS; + + if (gsFdspInfo.dStatus == (UINT32)FDSP_STATUS_IDLE) + return MCDRV_ERROR; + + sdResult = SetAudioEngine(&sFdspInfo); + + return sdResult; +} + +/**************************************************************************** + * McFdsp_Start + * + * Function: + * F-DSP start + * Arguments: + * none + * Return: + * MCDRV_SUCCESS + * + ****************************************************************************/ +SINT32 McFdsp_Start(void) +{ + SINT32 sdResult = MCDRV_SUCCESS; + + if (gsFdspInfo.dStatus == (UINT32)FDSP_STATUS_IDLE) + return MCDRV_ERROR; + + if ((gsFdspInfo.bDSPBypass & MCB_DSPBYPASS) != 0) { + gsFdspInfo.dAppStop = 0UL; + sdResult = SetFdspCtrl(MCB_DSPBYPASS); + } else { + if ((gsFdspInfo.bDSPCtl & (UINT8)MCB_DSPSTART) == 0) { + gsFdspInfo.dAppStop = 0UL; + sdResult = SetFdspCtrl(MCB_DSPSTART); + FixAppVolFadeIn(); + } + } + + return sdResult; +} + +/**************************************************************************** + * McFdsp_Stop + * + * Function: + * F-DSP stop + * Arguments: + * none + * Return: + * MCDRV_SUCCESS + * MCDRV_PROCESSING + * + ****************************************************************************/ +SINT32 McFdsp_Stop(void) +{ + SINT32 sdResult; + + if (gsFdspInfo.dStatus == (UINT32)FDSP_STATUS_IDLE) + return MCDRV_SUCCESS; + + if ((gsFdspInfo.bDSPCtl & (UINT8)MCB_DSPSTART) != 0) + FixAppVolFadeOut(); + + sdResult = SetFdspCtrl(MCI_DSPCTRL_DEF); + if (sdResult == FDSP_DRV_SUCCESS_STOPED) + sdResult = MCDRV_SUCCESS; + else + sdResult = MCDRV_PROCESSING; + + return sdResult; +} + +/**************************************************************************** + * McFdsp_GetMute + * + * Description: + * Get Mute Setting + * Arguments: + * psPrm MCDRV_FDSP_MUTE structure pointer + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR + * MCDRV_ERROR_ARGUMENT + * + ****************************************************************************/ +SINT32 McFdsp_GetMute(struct MCDRV_FDSP_MUTE *psPrm) +{ + if (psPrm == NULL) + return MCDRV_ERROR_ARGUMENT; + + if (gsFdspInfo.dStatus == (UINT32)FDSP_STATUS_IDLE) + return MCDRV_ERROR; + + /* get Mute */ + psPrm->abInMute[0] = GetChMute(gsFdspInfo.bADIMute0, + (UINT8)(MCB_ADI01MTN | MCB_ADI00MTN)); + psPrm->abInMute[1] = GetChMute(gsFdspInfo.bADIMute0, + (UINT8)(MCB_ADI03MTN | MCB_ADI02MTN)); + psPrm->abInMute[2] = GetChMute(gsFdspInfo.bADIMute0, + (UINT8)(MCB_ADI05MTN | MCB_ADI04MTN)); + psPrm->abInMute[3] = GetChMute(gsFdspInfo.bADIMute0, + (UINT8)(MCB_ADI07MTN | MCB_ADI06MTN)); + psPrm->abInMute[4] = GetChMute(gsFdspInfo.bADIMute1, + (UINT8)(MCB_ADI09MTN | MCB_ADI08MTN)); + psPrm->abInMute[5] = GetChMute(gsFdspInfo.bADIMute1, + (UINT8)(MCB_ADI11MTN | MCB_ADI10MTN)); + psPrm->abInMute[6] = GetChMute(gsFdspInfo.bADIMute1, + (UINT8)(MCB_ADI13MTN | MCB_ADI12MTN)); + psPrm->abInMute[7] = GetChMute(gsFdspInfo.bADIMute1, + (UINT8)(MCB_ADI15MTN | MCB_ADI14MTN)); + + psPrm->abOutMute[0] = GetChMute(gsFdspInfo.bADOMute0, + (UINT8)(MCB_ADO01MTN | MCB_ADO00MTN)); + psPrm->abOutMute[1] = GetChMute(gsFdspInfo.bADOMute0, + (UINT8)(MCB_ADO03MTN | MCB_ADO02MTN)); + psPrm->abOutMute[2] = GetChMute(gsFdspInfo.bADOMute0, + (UINT8)(MCB_ADO05MTN | MCB_ADO04MTN)); + psPrm->abOutMute[3] = GetChMute(gsFdspInfo.bADOMute0, + (UINT8)(MCB_ADO07MTN | MCB_ADO06MTN)); + psPrm->abOutMute[4] = GetChMute(gsFdspInfo.bADOMute1, + (UINT8)(MCB_ADO09MTN | MCB_ADO08MTN)); + psPrm->abOutMute[5] = GetChMute(gsFdspInfo.bADOMute1, + (UINT8)(MCB_ADO11MTN | MCB_ADO10MTN)); + psPrm->abOutMute[6] = GetChMute(gsFdspInfo.bADOMute1, + (UINT8)(MCB_ADO13MTN | MCB_ADO12MTN)); + psPrm->abOutMute[7] = GetChMute(gsFdspInfo.bADOMute1, + (UINT8)(MCB_ADO15MTN | MCB_ADO14MTN)); + + return MCDRV_SUCCESS; +} + +/**************************************************************************** + * McFdsp_SetMute + * + * Description: + * Set Mute + * Arguments: + * psPrm MCDRV_FDSP_MUTE structure pointer + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR_ARGUMENT + * + ****************************************************************************/ +SINT32 McFdsp_SetMute(struct MCDRV_FDSP_MUTE *psPrm) +{ + UINT8 bADIMute0; + UINT8 bADIMute1; + UINT8 bADOMute0; + UINT8 bADOMute1; + UINT32 i; + + if (psPrm == NULL) + return MCDRV_ERROR_ARGUMENT; + + for (i = 0UL; i < (UINT32)FDSP_MUTE_NUM; ++i) + if ((FDSP_MUTE_OFF < psPrm->abInMute[i]) || + (FDSP_MUTE_OFF < psPrm->abOutMute[i])) + return MCDRV_ERROR_ARGUMENT; + + if (gsFdspInfo.dStatus == (UINT32)FDSP_STATUS_IDLE) + return MCDRV_ERROR; + + /* set Mute */ + bADIMute0 = gsFdspInfo.bADIMute0; + bADIMute0 = CreateMuteReg(bADIMute0, psPrm->abInMute[0], + (UINT8)(MCB_ADI01MTN | MCB_ADI00MTN)); + bADIMute0 = CreateMuteReg(bADIMute0, psPrm->abInMute[1], + (UINT8)(MCB_ADI03MTN | MCB_ADI02MTN)); + bADIMute0 = CreateMuteReg(bADIMute0, psPrm->abInMute[2], + (UINT8)(MCB_ADI05MTN | MCB_ADI04MTN)); + bADIMute0 = CreateMuteReg(bADIMute0, psPrm->abInMute[3], + (UINT8)(MCB_ADI07MTN | MCB_ADI06MTN)); + bADIMute1 = gsFdspInfo.bADIMute1; + bADIMute1 = CreateMuteReg(bADIMute1, psPrm->abInMute[4], + (UINT8)(MCB_ADI09MTN | MCB_ADI08MTN)); + bADIMute1 = CreateMuteReg(bADIMute1, psPrm->abInMute[5], + (UINT8)(MCB_ADI11MTN | MCB_ADI10MTN)); + bADIMute1 = CreateMuteReg(bADIMute1, psPrm->abInMute[6], + (UINT8)(MCB_ADI13MTN | MCB_ADI12MTN)); + bADIMute1 = CreateMuteReg(bADIMute1, psPrm->abInMute[7], + (UINT8)(MCB_ADI15MTN | MCB_ADI14MTN)); + + bADOMute0 = gsFdspInfo.bADOMute0; + bADOMute0 = CreateMuteReg(bADOMute0, psPrm->abOutMute[0], + (UINT8)(MCB_ADO01MTN | MCB_ADO00MTN)); + bADOMute0 = CreateMuteReg(bADOMute0, psPrm->abOutMute[1], + (UINT8)(MCB_ADO03MTN | MCB_ADO02MTN)); + bADOMute0 = CreateMuteReg(bADOMute0, psPrm->abOutMute[2], + (UINT8)(MCB_ADO05MTN | MCB_ADO04MTN)); + bADOMute0 = CreateMuteReg(bADOMute0, psPrm->abOutMute[3], + (UINT8)(MCB_ADO07MTN | MCB_ADO06MTN)); + bADOMute1 = gsFdspInfo.bADOMute1; + bADOMute1 = CreateMuteReg(bADOMute1, psPrm->abOutMute[4], + (UINT8)(MCB_ADO09MTN | MCB_ADO08MTN)); + bADOMute1 = CreateMuteReg(bADOMute1, psPrm->abOutMute[5], + (UINT8)(MCB_ADO11MTN | MCB_ADO10MTN)); + bADOMute1 = CreateMuteReg(bADOMute1, psPrm->abOutMute[6], + (UINT8)(MCB_ADO13MTN | MCB_ADO12MTN)); + bADOMute1 = CreateMuteReg(bADOMute1, psPrm->abOutMute[7], + (UINT8)(MCB_ADO15MTN | MCB_ADO14MTN)); + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_ADIMUTE0), + bADIMute0); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_ADIMUTE1), + bADIMute1); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_ADIMUTE2), + MCB_ADIMTSET); + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_ADOMUTE0), + bADOMute0); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_ADOMUTE1), + bADOMute1); + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_F + | (UINT32)MCI_ADOMUTE2), + MCB_ADOMTSET); + + McDevIf_ExecutePacket(); + + gsFdspInfo.bADIMute0 = bADIMute0; + gsFdspInfo.bADIMute1 = bADIMute1; + gsFdspInfo.bADOMute0 = bADOMute0; + gsFdspInfo.bADOMute1 = bADOMute1; + + return MCDRV_SUCCESS; +} + diff --git a/sound/soc/codecs/ymu831/mcfdspdrv.h b/sound/soc/codecs/ymu831/mcfdspdrv.h new file mode 100644 index 00000000000..9d8117c862b --- /dev/null +++ b/sound/soc/codecs/ymu831/mcfdspdrv.h @@ -0,0 +1,115 @@ +/**************************************************************************** + * + * Copyright(c) 2012 Yamaha Corporation. All rights reserved. + * + * Module : mcfdspdrv.h + * + * Description : MC Fdsp Driver header + * + * Version : 1.0.0 2012.12.13 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + * + ****************************************************************************/ +#ifndef _MCFDSPDRV_H_ +#define _MCFDSPDRV_H_ + +/* definition */ + +#define MCDRV_PROCESSING ((SINT32)1) + +#define AEC_AUDIOENGINE_ENABLE (1) +#define AEC_AUDIOENGINE_DISABLE (0) + +#define FDSP_OFF (0) +#define FDSP_ON (1) + +#define FDSP_LOCATE_AUDIOENGINE (0) +#define FDSP_LOCATE_V_BOX (1) + +#define FDSP_DRV_SUCCESS_STOPED (1) + +#define FDSP_PRC_FDSP_STOP (0x1000000) +#define FDSP_PRC_COEF_TRS (0x2000000) + +#define FDSP_MUTE_NUM (8) +#define FDSP_MUTE_NOTCHANGE (0) +#define FDSP_MUTE_ON (1) +#define FDSP_MUTE_OFF (2) + +#define FDSP_APP_NUM (24) +#define FDSP_APP_EXEC_NOTCHANGE (0) +#define FDSP_APP_EXEC_STOP (0) +#define FDSP_APP_EXEC_START (1) +#define FDSP_APP_EXEC_DONTCARE (2) +#define FDSP_APP_FADE_NON (0) +#define FDSP_APP_FADE_SHRT (1) +#define FDSP_APP_FADE_MID (2) +#define FDSP_APP_FADE_LONG (3) + +#define FDSP_AE_FW_DXRAM (1) +#define FDSP_AE_FW_DYRAM (2) +#define FDSP_AE_FW_IRAM (3) + +#define FDSP_CB_FDSP_STOP (1) +#define FDSP_CB_APP_STOP (2) +#define FDSP_CB_APP_REQ (3) +#define FDSP_CB_COEF_DONE (4) +#define FDSP_CB_ERR (5) +#define FDSP_CB_FREQ (100) +#define FDSP_CB_RESET (101) + +/* outside Typedef Struct */ + +struct MCDRV_FDSP_AUDIO_IO { + UINT16 wADDFmt; +}; + +struct MCDRV_FDSP_INIT { + struct MCDRV_FDSP_AUDIO_IO sInput; + struct MCDRV_FDSP_AUDIO_IO sOutput; + UINT32 dWaitTime; +}; + +struct MCDRV_FDSP_MUTE { + UINT8 abInMute[FDSP_MUTE_NUM]; + UINT8 abOutMute[FDSP_MUTE_NUM]; +}; + +#if defined(__cplusplus) +extern "C" { +#endif + +SINT32 McFdsp_Init(struct MCDRV_FDSP_INIT *psPrm); +SINT32 McFdsp_Term(void); +void McFdsp_IrqProc(void); +SINT32 McFdsp_SetCBFunc(SINT32 (*cbfunc)(SINT32, UINT32, UINT32)); +SINT32 McFdsp_GetTransition(void); +SINT32 McFdsp_GetDSP(UINT32 dTarget, UINT32 dAddress, + UINT8 *pvData, UINT32 dSize); +SINT32 McFdsp_SetDSPCheck(struct MCDRV_AEC_INFO *pbPrm); +SINT32 McFdsp_SetDSP(struct MCDRV_AEC_INFO *pbPrm); +SINT32 McFdsp_Start(void); +SINT32 McFdsp_Stop(void); +SINT32 McFdsp_GetMute(struct MCDRV_FDSP_MUTE *psPrm); +SINT32 McFdsp_SetMute(struct MCDRV_FDSP_MUTE *psPrm); + +#if defined(__cplusplus) +} +#endif + +#endif /* _MCFDSPDRV_H_ */ diff --git a/sound/soc/codecs/ymu831/mcmachdep.c b/sound/soc/codecs/ymu831/mcmachdep.c new file mode 100644 index 00000000000..42d03da213b --- /dev/null +++ b/sound/soc/codecs/ymu831/mcmachdep.c @@ -0,0 +1,406 @@ +/**************************************************************************** + * + * Copyright(c) 2012-2013 Yamaha Corporation. All rights reserved. + * + * Module : mcmachdep.c + * + * Description : machine dependent part for MC Driver + * + * Version : 2.0.0 2013.03.06 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + * + ****************************************************************************/ + +#include <linux/delay.h> +#include <linux/mutex.h> +#include "ymu831_priv.h" + +#include "mcmachdep.h" +#if (MCDRV_DEBUG_LEVEL >= 4) +#include "mcdebuglog.h" +#endif + +static struct mutex McDrv_Mutex; + +/**************************************************************************** + * machdep_SystemInit + * + * Description: + * Initialize the system. + * Arguments: + * none + * Return: + * none + * + ****************************************************************************/ +void machdep_SystemInit( + void +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("machdep_SystemInit"); +#endif + + /* Please implement system initialization procedure if need */ + mutex_init(&McDrv_Mutex); + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("machdep_SystemInit", 0); +#endif +} + +/**************************************************************************** + * machdep_SystemTerm + * + * Description: + * Terminate the system. + * Arguments: + * none + * Return: + * none + * + ****************************************************************************/ +void machdep_SystemTerm( + void +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("machdep_SystemTerm"); +#endif + + /* Please implement system termination procedure if need */ + mutex_destroy(&McDrv_Mutex); + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("machdep_SystemTerm", 0); +#endif +} + +/**************************************************************************** + * machdep_ClockStart + * + * Description: + * Start clock. + * Arguments: + * none + * Return: + * none + * + ****************************************************************************/ +void machdep_ClockStart( + void +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("machdep_ClockStart"); +#endif + + /* Please implement clock start procedure if need */ + mc_asoc_enable_clock(1); + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("machdep_ClockStart", 0); +#endif +} + +/**************************************************************************** + * machdep_ClockStop + * + * Description: + * Stop clock. + * Arguments: + * none + * Return: + * none + * + ****************************************************************************/ +void machdep_ClockStop( + void +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("machdep_ClockStop"); +#endif + + /* Please implement clock stop procedure if need */ + mc_asoc_enable_clock(0); + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("machdep_ClockStop", 0); +#endif +} + +/*************************************************************************** + * machdep_WriteReg + * + * Function: + * Write data to the register. + * Arguments: + * bSlaveAdr slave address + * pbData byte data for write + * dSize byte data length + * Return: + * None + * + ****************************************************************************/ +void machdep_WriteReg( + UINT8 bSlaveAdr, + const UINT8 *pbData, + UINT32 dSize +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("machdep_WriteReg"); +#endif + + /* Please implement register write procedure */ + mc_asoc_write_data(bSlaveAdr, pbData, dSize); + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("machdep_WriteReg", 0); +#endif +} + +/*************************************************************************** + * machdep_ReadReg + * + * Function: + * Read a byte data from the register. + * Arguments: + * bSlaveAdr slave address + * dAddress address of register + * pbData pointer to read data buffer + * dSize read count + * Return: + * none + * + ****************************************************************************/ +void machdep_ReadReg( + UINT8 bSlaveAdr, + UINT32 dAddress, + UINT8 *pbData, + UINT32 dSize +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + SINT32 sdRet; + McDebugLog_FuncIn("machdep_ReadReg"); +#endif + + /* Please implement register read procedure */ + mc_asoc_read_data(bSlaveAdr, dAddress, pbData, dSize); + +#if (MCDRV_DEBUG_LEVEL >= 4) + sdRet = (SINT32)dSize; + McDebugLog_FuncOut("machdep_ReadReg", &sdRet); +#endif +} + +/**************************************************************************** + * machdep_Sleep + * + * Function: + * Sleep for a specified interval. + * Arguments: + * dSleepTime sleep time [us] + * Return: + * None + * + ****************************************************************************/ +void machdep_Sleep( + UINT32 dSleepTime +) +{ + unsigned long ms = dSleepTime / 1000; + unsigned long us = dSleepTime % 1000; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("machdep_Sleep"); +#endif + + /* Please implement sleep procedure */ + if (us) + udelay(us); + if (ms) + msleep(ms); + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("machdep_Sleep", 0); +#endif +} + +/*************************************************************************** + * machdep_Lock + * + * Function: + * Lock a call of the driver. + * Arguments: + * none + * Return: + * none + * + ****************************************************************************/ +void machdep_Lock( + void +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("machdep_Lock"); +#endif + + /* Please implement lock procedure */ + mutex_lock(&McDrv_Mutex); + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("machdep_Lock", 0); +#endif +} + +/*************************************************************************** + * machdep_Unlock + * + * Function: + * Unlock a call of the driver. + * Arguments: + * none + * Return: + * none + * + ****************************************************************************/ +void machdep_Unlock( + void +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("machdep_Unlock"); +#endif + + /* Please implement unlock procedure */ + mutex_unlock(&McDrv_Mutex); + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("machdep_Unlock", 0); +#endif +} + +/*************************************************************************** + * machdep_PreLDODStart + * + * Function: + * . + * Arguments: + * none + * Return: + * none + * + ****************************************************************************/ +void machdep_PreLDODStart( + void +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("machdep_PreLDODStart"); +#endif + + /* Please implement procedure */ + mc_asoc_set_codec_ldod(1); + if (mc_asoc_get_bus_select() == 1) { + UINT8 bData[2]; + bData[0] = 0x04; + bData[1] = 0x01; + mc_asoc_write_data(0, bData, 2); + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("machdep_PreLDODStart", 0); +#endif +} + +/*************************************************************************** + * machdep_PostLDODStart + * + * Function: + * . + * Arguments: + * none + * Return: + * none + * + ****************************************************************************/ +void machdep_PostLDODStart( + void +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("machdep_PostLDODStart"); +#endif + + /* Please implement procedure */ + mc_asoc_set_codec_ldod(0); + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("machdep_PostLDODStart", 0); +#endif +} + +/*************************************************************************** + * machdep_GetBusSelect + * + * Function: + * Get bus kind. + * Arguments: + * none + * Return: + * 0:I2C + * 1:SPI + * 2:SLIMbus + * + ****************************************************************************/ +UINT8 machdep_GetBusSelect( + void +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("machdep_GetBusSelect"); +#endif +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("machdep_GetBusSelect", 0); +#endif + /* Please implement get bus kind procedure */ + return mc_asoc_get_bus_select(); +} + +/*************************************************************************** + * machdep_DebugPrint + * + * Function: + * Output debug log. + * Arguments: + * pbLogString log string buffer pointer + * Return: + * none + * + ****************************************************************************/ +void machdep_DebugPrint( + UINT8 *pbLogString +) +{ + /* Please implement debug output procedure */ + pr_debug("MCDRV: %s\n", pbLogString); +} + diff --git a/sound/soc/codecs/ymu831/mcmachdep.h b/sound/soc/codecs/ymu831/mcmachdep.h new file mode 100644 index 00000000000..807e61d207d --- /dev/null +++ b/sound/soc/codecs/ymu831/mcmachdep.h @@ -0,0 +1,64 @@ +/**************************************************************************** + * + * Copyright(c) 2012-2013 Yamaha Corporation. All rights reserved. + * + * Module : mcmachdep.h + * + * Description : MC Driver machine dependent part header + * + * Version : 2.0.1 2013.06.10 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + * + ****************************************************************************/ + +#ifndef _MCMACHDEP_H_ +#define _MCMACHDEP_H_ + +#include "mctypedef.h" + +#include "linux/string.h" +#include "linux/kernel.h" + +#define MCDRV_BURST_WRITE_ENABLE (1) + +#define MCDRV_AP_LDOD (0x00) + +#define MCDRV_DEBUG_LEVEL (0) + + +void machdep_SystemInit(void); +void machdep_SystemTerm(void); +void machdep_ClockStart(void); +void machdep_ClockStop(void); +void machdep_WriteReg(UINT8 bSlaveAdr, + const UINT8 *pbData, + UINT32 dSize); +void machdep_ReadReg(UINT8 bSlaveAdr, + UINT32 dAddress, + UINT8 *pbData, + UINT32 dSize); +void machdep_Sleep(UINT32 dSleepTime); +void machdep_Lock(void); +void machdep_Unlock(void); +void machdep_PreLDODStart(void); +void machdep_PostLDODStart(void); +UINT8 machdep_GetBusSelect(void); +void machdep_DebugPrint(UINT8 *pbLogString); + + +#endif /* _MCMACHDEP_H_ */ diff --git a/sound/soc/codecs/ymu831/mcpacking.c b/sound/soc/codecs/ymu831/mcpacking.c new file mode 100644 index 00000000000..5de121e5413 --- /dev/null +++ b/sound/soc/codecs/ymu831/mcpacking.c @@ -0,0 +1,7665 @@ +/**************************************************************************** + * + * Copyright(c) 2012-2013 Yamaha Corporation. All rights reserved. + * + * Module : mcpacking.c + * + * Description : MC Driver packet packing control + * + * Version : 2.0.1 2013.06.10 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + * + ****************************************************************************/ + + +#include "mcpacking.h" +#include "mcdevif.h" +#include "mcresctrl.h" +#include "mcdefs.h" +#include "mcdevprof.h" +#include "mcservice.h" +#include "mcmachdep.h" +#include "mccdspdrv.h" +#include "mcbdspdrv.h" +#include "mcedspdrv.h" +#include "mcfdspdrv.h" +#if MCDRV_DEBUG_LEVEL +#include "mcdebuglog.h" +#endif + + + + +#define MCDRV_TCXO_WAIT_TIME ((UINT32)2000) +#define MCDRV_PLL_WAIT_TIME ((UINT32)2000) +#define MCDRV_LDO_WAIT_TIME ((UINT32)1000) +#define MCDRV_VREF_WAIT_TIME_ES1 ((UINT32)2000) +#define MCDRV_OSC_WAIT_TIME ((UINT32)10) +#define MCDRV_CP_WAIT_TIME ((UINT32)2000) +#define MCDRV_WAIT_TIME_500US ((UINT32)500) +#define MCDRV_WAIT_TIME_350US ((UINT32)350) +#define MCDRV_OFC_WAIT_TIME (3000UL) +#define MCDRV_DP_DAC_WAIT_TIME (21UL) + +#define DSF_PRE_INPUT_ADC_L (0) +#define DSF_PRE_INPUT_ADC_R (1) +#define DSF_PRE_INPUT_ADC_M (2) +#define DSF_PRE_INPUT_PDM0_L (3) +#define DSF_PRE_INPUT_PDM0_R (4) +#define DSF_PRE_INPUT_PDM1_L (5) +#define DSF_PRE_INPUT_PDM1_R (6) + +#define IN_MIX_DIFI_0 (1<<0) +#define IN_MIX_DIFI_1 (1<<1) +#define IN_MIX_DIFI_2 (1<<2) +#define IN_MIX_DIFI_3 (1<<3) +#define IN_MIX_ADI_0 (1<<4) +#define IN_MIX_ADI_1 (1<<5) +#define IN_MIX_ADI_2 (1<<6) + +#define OUT_MIX_DIFI_0 (1<<0) +#define OUT_MIX_DIFI_1 (1<<1) +#define OUT_MIX_DIFI_2 (1<<2) +#define OUT_MIX_DIFI_3 (1<<3) +#define OUT_MIX_ADI_0 (1<<4) +#define OUT_MIX_ADI_1 (1<<5) +#define OUT_MIX_ADI_2 (1<<6) +#define OUT_MIX_AEO_0 (1<<7) +#define OUT_MIX_AEO_1 (1<<8) +#define OUT_MIX_AEO_2 (1<<9) +#define OUT_MIX_AEO_3 (1<<10) + +#define DSF_PREINPUT_ADC0_L (0) +#define DSF_PREINPUT_ADC0_R (1<<4) +#define DSF_PREINPUT_ADC1_L (2) +#define DSF_PREINPUT_ADC1_R (2<<4) +#define DSF_PREINPUT_PDM0_L (3) +#define DSF_PREINPUT_PDM0_R (4<<4) +#define DSF_PREINPUT_PDM1_L (5) +#define DSF_PREINPUT_PDM1_R (6<<4) + +#define DTH (3) +#define EN_CP_ILMT_N (1) +#define HP_IDLE (0) +#define HP_IBST (3) +#define HP_MIDBST (1) +#define OP_DAC_HP (0x40) +#define OP_DAC (0x30) +#define CP_88OFF (1) +#define CD_39 (0x21) +#define T_CPMODE_OFFCAN_BEFORE (0) +#define T_CPMODE_OFFCAN_AFTER (2) +#define E_99 (0x9F) +#define E_100 (0x01) +#define ANA_114 (0x31) +#define ANA_115 (0x8A) + +static void AddInitDigtalIO(void); +static void AddInitGPIO(void); +static SINT32 InitMBlock(void); +static void SetupEReg(void); +static SINT32 Offsetcancel(void); + +static void AddDIPad(void); +static void GetDIState(UINT8 bPhysPort, + UINT8 *pbIsUsedDIR, + UINT8 *pbIsUsedDIT, + UINT8 *pbLPort); +static UINT8 GetLPort(UINT8 bPhysPort); +static void AddPAD(void); +static void AddSource(void); +static void AddInMixSource(enum MCDRV_DST_TYPE eDstType, + UINT8 bRegAddr0, + UINT8 bRegAddr1, + UINT8 bSep); +static UINT8 GetPreInput(UINT32 dSrcOnOff); +static UINT8 GetInMixReg(UINT32 dSrcOnOff); +static void AddOutMixSource(enum MCDRV_DST_TYPE eDstType, + UINT8 bRegAddr0, + UINT8 bRegAddr1, + UINT8 bSep); +static void AddOut2MixSource(void); +static UINT16 GetOutMixReg(UINT32 dSrcOnOff); +static void AddMixSet(void); +static UINT8 GetMicMixBit(UINT32 dSrcOnOff); +static void AddDacStop(void); +static UINT8 GetLP2Start(void); +static UINT8 GetLP2Fs(UINT8 *bThru); +static void AddDIStart(void); +static void AddDacStart(void); +static UINT8 GetSPath(void); + +static void AddDigVolPacket(UINT8 bVolL, + UINT8 bVolR, + UINT32 dRegType, + UINT8 bVolLAddr, + UINT8 bVSEP, + UINT8 bVolRAddr, + enum MCDRV_VOLUPDATE_MODE eMode); + +static void AddDIOCommon(enum MCDRV_DIO_PORT_NO ePort); +static void AddDIODIR(enum MCDRV_DIO_PORT_NO ePort); +static void AddDIODIT(enum MCDRV_DIO_PORT_NO ePort); + +#define MCDRV_DPB_KEEP 0 +#define MCDRV_DPB_UP 1 + +static SINT32 DSPCallback(SINT32 sdHd, UINT32 dEvtType, UINT32 dEvtPrm); +static UINT32 GetMaxWait(UINT8 bRegChange); + +/**************************************************************************** + * McPacket_AddInit + * + * Description: + * Add initialize packet. + * Arguments: + * none + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR_RESOURCEOVER + * + ****************************************************************************/ +SINT32 McPacket_AddInit( + void +) +{ + SINT32 sdRet = MCDRV_SUCCESS; + UINT8 bReg; + struct MCDRV_INIT_INFO sInitInfo; + struct MCDRV_INIT2_INFO sInit2Info; + struct MCDRV_AEC_INFO sAecInfo; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McPacket_AddInit"); +#endif + + + /* CD_RST */ + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_CD + | (UINT32)MCI_CD_RST, + MCI_CD_RST_DEF); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_CD + | (UINT32)MCI_CD_RST, + 0); + + McResCtrl_GetInitInfo(&sInitInfo, &sInit2Info); + + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H) { + ; + bReg = sInitInfo.bPpdRc<<4 + | sInitInfo.bPpdHp<<3 + | sInitInfo.bPpdSp<<2 + | sInitInfo.bPpdLineOut2<<1 + | sInitInfo.bPpdLineOut1; + } else { + bReg = sInitInfo.bPpdSp<<2; + } + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_PPD, + bReg); + + if (McResCtrl_GetAPMode() == eMCDRV_APM_OFF) { + bReg = MCB_APMOFF; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_APM, + bReg); + } + + if (McDevProf_GetDevId() != eMCDRV_DEV_ID_80_90H) { + bReg = (UINT8)(sInit2Info.bOption[12]<<4); + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_81_91H) { + ; + bReg |= 0x06; + } else { + bReg |= (sInit2Info.bOption[13] & 0x0F); + } + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)10, + bReg); + } + + bReg = sInitInfo.bMbSel4<<6 + | sInitInfo.bMbSel3<<4 + | sInitInfo.bMbSel2<<2 + | sInitInfo.bMbSel1; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_MBSEL, + bReg); + + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_KDSET, + sInitInfo.bMbsDisch<<4); + + if (McDevProf_GetDevId() != eMCDRV_DEV_ID_80_90H) { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)15, + sInit2Info.bOption[11]); + } + + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H) { + bReg = (UINT8)(sInitInfo.bNonClip<<7); + bReg |= DTH; + } else { + bReg = (UINT8)(sInitInfo.bNonClip<<7); + bReg |= sInit2Info.bOption[3]; + } + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_NONCLIP, + bReg); + + bReg = sInitInfo.bLineOut2Dif<<5 + | sInitInfo.bLineOut1Dif<<4 + | sInitInfo.bLineIn1Dif; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_DIF, + bReg); + + bReg = sInitInfo.bSvolHp<<7 + | sInitInfo.bSvolSp<<6 + | sInitInfo.bSvolRc<<5 + | sInitInfo.bSvolLineOut2<<4 + | sInitInfo.bSvolLineOut1<<3 + | MCB_SVOL_HPDET; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_SVOL, + bReg); + + bReg = sInitInfo.bHpHiz<<6 + | sInitInfo.bSpHiz<<4 + | sInitInfo.bRcHiz<<3; + if (McDevProf_GetDevId() != eMCDRV_DEV_ID_80_90H) { + ; + bReg |= sInit2Info.bOption[2]; + } + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_HIZ, + bReg); + bReg = sInitInfo.bLineOut2Hiz<<6 + | sInitInfo.bLineOut1Hiz<<4; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_LO_HIZ, + bReg); + + bReg = sInitInfo.bMic4Sng<<7 + | sInitInfo.bMic3Sng<<6 + | sInitInfo.bMic2Sng<<5 + | sInitInfo.bMic1Sng<<4; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_MCSNG, + bReg); + + bReg = sInitInfo.bZcHp<<7 + | sInitInfo.bZcSp<<6 + | sInitInfo.bZcRc<<5 + | sInitInfo.bZcLineOut2<<4 + | sInitInfo.bZcLineOut1<<3; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_ZCOFF, + bReg); + + bReg = sInitInfo.bCpMod; + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H) { + ; + bReg |= (UINT8)(EN_CP_ILMT_N<<2); + } else { + bReg |= MCB_HIP_DISABLE; + } + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_CPMOD, + bReg); + + McResCtrl_GetAecInfo(&sAecInfo); + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H) { + bReg = (UINT8)(sAecInfo.sOutput.bDng_Release<<4) + | sAecInfo.sOutput.bDng_Attack; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_DNG_ES1, + bReg); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_DNG_HP_ES1, + sAecInfo.sOutput.bDng_Target[0]); + } else { + bReg = (UINT8)(sAecInfo.sOutput.bDng_Release<<4) + | sAecInfo.sOutput.bDng_Attack; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_DNG, + bReg); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_DNG_HP, + sAecInfo.sOutput.bDng_Target[0]); + } + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H) { + ; + bReg = sInitInfo.bRbSel<<7; + } else { + bReg = 0; + } + if (McResCtrl_GetAPMode() == eMCDRV_APM_OFF) + bReg |= MCB_OFC_MAN; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_RBSEL, + bReg); + + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H) { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_CD + | (UINT32)MCI_STDPLUGSEL, + sInitInfo.bPlugSel<<7); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)18, + 0x20); + } else { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)114, + ANA_114); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)115, + ANA_115); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_CD + | (UINT32)MCI_SCKMSKON_R, + sInit2Info.bOption[1]); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_CD + | (UINT32)39, + sInit2Info.bOption[6]); + } + + McPacket_AddHSDet(); + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McPacket_AddInit", &sdRet); +#endif + return sdRet; +} + +/**************************************************************************** + * AddInitDigtalIO + * + * Description: + * Add ditigal IO initialize packet. + * Arguments: + * none + * Return: + * none + * + ****************************************************************************/ +static void AddInitDigtalIO( + void +) +{ + UINT8 bReg; + struct MCDRV_INIT_INFO sInitInfo; + struct MCDRV_AEC_INFO sAecInfo; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("AddInitDigtalIO"); +#endif + + McResCtrl_GetInitInfo(&sInitInfo, NULL); + McResCtrl_GetAecInfo(&sAecInfo); + + /* DIO0 */ + if ((sInitInfo.bPowerMode == MCDRV_POWMODE_CDSPDEBUG) + || (sAecInfo.sAecVBox.sAecCDspDbg.bJtagOn == 1)) { + bReg = 0x01; + } else { + bReg = MCI_DO0_DRV_DEF; + if (sInitInfo.bDio0SdoHiz == MCDRV_DAHIZ_LOW) + bReg |= MCB_SDO0_DDR; + if (sInitInfo.bDio0ClkHiz == MCDRV_DAHIZ_LOW) { + bReg |= MCB_BCLK0_DDR; + bReg |= MCB_LRCK0_DDR; + } + } + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_DO0_DRV, + bReg); + + /* DIO1 */ + if ((sInitInfo.bPowerMode == MCDRV_POWMODE_CDSPDEBUG) + || (sAecInfo.sAecVBox.sAecCDspDbg.bJtagOn == 1)) { + bReg = 0x2A; + } else { + bReg = MCI_DO1_DRV_DEF; + if (sInitInfo.bDio1SdoHiz == MCDRV_DAHIZ_LOW) + bReg |= MCB_SDO1_DDR; + if (sInitInfo.bDio1ClkHiz == MCDRV_DAHIZ_LOW) { + bReg |= MCB_BCLK1_DDR; + bReg |= MCB_LRCK1_DDR; + } + } + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_DO1_DRV, + bReg); + + /* DIO2 */ + bReg = MCI_DO2_DRV_DEF; + if (sInitInfo.bDio2SdoHiz == MCDRV_DAHIZ_LOW) + bReg |= MCB_SDO2_DDR; + if (sInitInfo.bDio2ClkHiz == MCDRV_DAHIZ_LOW) { + bReg |= MCB_BCLK2_DDR; + bReg |= MCB_LRCK2_DDR; + } + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_DO2_DRV, + bReg); + + bReg = 0; + bReg |= sAecInfo.sPdm.bPdm1_Data_Delay<<5; + bReg |= sAecInfo.sPdm.bPdm0_Data_Delay<<4; + if (sInitInfo.bDio0PcmHiz == MCDRV_PCMHIZ_HIZ) + bReg |= MCB_PCMOUT0_HIZ; + if (sInitInfo.bDio1PcmHiz == MCDRV_PCMHIZ_HIZ) + bReg |= MCB_PCMOUT1_HIZ; + if (sInitInfo.bDio2PcmHiz == MCDRV_PCMHIZ_HIZ) + bReg |= MCB_PCMOUT2_HIZ; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_PCMOUT_HIZ, + bReg); + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("AddInitDigtalIO", NULL); +#endif +} + +/**************************************************************************** + * AddInitGPIO + * + * Description: + * Add GPIO initialize packet. + * Arguments: + * none + * Return: + * none + * + ****************************************************************************/ +static void AddInitGPIO( + void +) +{ + UINT8 bReg; + struct MCDRV_INIT_INFO sInitInfo; + struct MCDRV_GP_MODE sGPMode; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("AddInitGPIO"); +#endif + + McResCtrl_GetInitInfo(&sInitInfo, NULL); + McResCtrl_GetGPMode(&sGPMode); + + bReg = MCI_PA0_DEF; + if (sInitInfo.bPa0Func == MCDRV_PA_PDMCK) { + bReg |= MCB_PA0_OUT; + bReg |= MCB_PA0_DDR; + } else if (sInitInfo.bPa0Func == MCDRV_PA_GPIO) { + if (sGPMode.abGpDdr[MCDRV_GP_PAD0] == MCDRV_GPDDR_IN) + bReg &= (UINT8)~MCB_PA0_DDR; + else + bReg |= MCB_PA0_DDR; + if (sGPMode.abGpHost[MCDRV_GP_PAD0] == MCDRV_GPHOST_CPU) + bReg &= (UINT8)~MCB_PA0_OUTSEL; + else + bReg |= MCB_PA0_OUTSEL; + if (sGPMode.abGpInvert[MCDRV_GP_PAD0] == MCDRV_GPINV_NORMAL) + bReg &= (UINT8)~MCB_PA0_INV; + else + bReg |= MCB_PA0_INV; + } + if (McResCtrl_GetGPMask(MCDRV_GP_PAD0) == MCDRV_GPMASK_OFF) + bReg &= (UINT8)~MCB_PA0_MSK; + else + bReg |= MCB_PA0_MSK; + if ((sInitInfo.bPa0Func == MCDRV_PA_GPIO) + && (sGPMode.abGpDdr[MCDRV_GP_PAD0] == MCDRV_GPDDR_OUT) + && (sGPMode.abGpHost[MCDRV_GP_PAD0] == MCDRV_GPHOST_CPU)) + bReg |= McResCtrl_GetGPPad(MCDRV_GP_PAD0)<<4; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_PA0, + bReg); + + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_A, MCI_PA1); + if (sInitInfo.bPa1Func == MCDRV_PA_GPIO) { + if (sGPMode.abGpDdr[MCDRV_GP_PAD1] == MCDRV_GPDDR_IN) + bReg &= (UINT8)~MCB_PA1_DDR; + else + bReg |= MCB_PA1_DDR; + if (sGPMode.abGpHost[MCDRV_GP_PAD1] == MCDRV_GPHOST_CPU) + bReg &= (UINT8)~MCB_PA1_OUTSEL; + else + bReg |= MCB_PA1_OUTSEL; + if (sGPMode.abGpInvert[MCDRV_GP_PAD1] == MCDRV_GPINV_NORMAL) + bReg &= (UINT8)~MCB_PA1_INV; + else + bReg |= MCB_PA1_INV; + } + if (McResCtrl_GetGPMask(MCDRV_GP_PAD1) == MCDRV_GPMASK_OFF) + bReg &= (UINT8)~MCB_PA1_MSK; + else + bReg |= MCB_PA1_MSK; + if ((sInitInfo.bPa1Func == MCDRV_PA_GPIO) + && (sGPMode.abGpDdr[MCDRV_GP_PAD1] == MCDRV_GPDDR_OUT) + && (sGPMode.abGpHost[MCDRV_GP_PAD1] == MCDRV_GPHOST_CPU)) + bReg |= McResCtrl_GetGPPad(MCDRV_GP_PAD1)<<4; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_PA1, + bReg); + + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_A, MCI_PA2); + if (sInitInfo.bPa2Func == MCDRV_PA_GPIO) { + if (sGPMode.abGpDdr[MCDRV_GP_PAD2] == MCDRV_GPDDR_IN) + bReg &= (UINT8)~MCB_PA2_DDR; + else + bReg |= MCB_PA2_DDR; + if (sGPMode.abGpHost[MCDRV_GP_PAD2] == MCDRV_GPHOST_CPU) + bReg &= (UINT8)~MCB_PA2_OUTSEL; + else + bReg |= MCB_PA2_OUTSEL; + if (sGPMode.abGpInvert[MCDRV_GP_PAD2] == MCDRV_GPINV_NORMAL) + bReg &= (UINT8)~MCB_PA2_INV; + else + bReg |= MCB_PA2_INV; + } + if (McResCtrl_GetGPMask(MCDRV_GP_PAD2) == MCDRV_GPMASK_OFF) + bReg &= (UINT8)~MCB_PA2_MSK; + else + bReg |= MCB_PA2_MSK; + if ((sInitInfo.bPa2Func == MCDRV_PA_GPIO) + && (sGPMode.abGpDdr[MCDRV_GP_PAD2] == MCDRV_GPDDR_OUT) + && (sGPMode.abGpHost[MCDRV_GP_PAD2] == MCDRV_GPHOST_CPU)) + bReg |= McResCtrl_GetGPPad(MCDRV_GP_PAD2)<<4; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_PA2, + bReg); + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("AddInitGPIO", NULL); +#endif +} + +/**************************************************************************** + * InitMBlock + * + * Description: + * Initialize M Block. + * Arguments: + * none + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR_RESOURCEOVER + * + ****************************************************************************/ +static SINT32 InitMBlock( + void +) +{ + SINT32 sdRet = MCDRV_SUCCESS; + UINT32 dUpdateFlg = 0; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("InitMBlock"); +#endif + + if (McDevProf_GetDevId() != eMCDRV_DEV_ID_80_90H) { + ; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MA + | (UINT32)MCI_CLK_SEL, + McResCtrl_GetClkSel()); + } + dUpdateFlg = MCDRV_MUSIC_COM_UPDATE_FLAG + |MCDRV_MUSIC_DIR_UPDATE_FLAG + |MCDRV_MUSIC_DIT_UPDATE_FLAG + |MCDRV_EXT_COM_UPDATE_FLAG + |MCDRV_EXT_DIR_UPDATE_FLAG + |MCDRV_EXT_DIT_UPDATE_FLAG + |MCDRV_VOICE_COM_UPDATE_FLAG + |MCDRV_VOICE_DIR_UPDATE_FLAG + |MCDRV_VOICE_DIT_UPDATE_FLAG + |MCDRV_HIFI_COM_UPDATE_FLAG + |MCDRV_HIFI_DIR_UPDATE_FLAG + |MCDRV_HIFI_DIT_UPDATE_FLAG; + McPacket_AddDigitalIO(dUpdateFlg); + sdRet = McDevIf_ExecutePacket(); + if (sdRet == MCDRV_SUCCESS) { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_LP0_FP, + MCDRV_PHYSPORT_NONE); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_LP1_FP, + MCDRV_PHYSPORT_NONE); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_LP2_FP, + MCDRV_PHYSPORT_NONE); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_LP3_FP, + MCDRV_PHYSPORT_NONE); + McPacket_AddDigitalIOPath(); + sdRet = McDevIf_ExecutePacket(); + } + if (sdRet == MCDRV_SUCCESS) { + dUpdateFlg = MCDRV_SWAP_ADIF0_UPDATE_FLAG + |MCDRV_SWAP_ADIF1_UPDATE_FLAG + |MCDRV_SWAP_ADIF2_UPDATE_FLAG + |MCDRV_SWAP_DAC0_UPDATE_FLAG + |MCDRV_SWAP_DAC1_UPDATE_FLAG + |MCDRV_SWAP_MUSICIN0_UPDATE_FLAG + |MCDRV_SWAP_MUSICIN1_UPDATE_FLAG + |MCDRV_SWAP_MUSICIN2_UPDATE_FLAG + |MCDRV_SWAP_EXTIN_UPDATE_FLAG + |MCDRV_SWAP_VOICEIN_UPDATE_FLAG + |MCDRV_SWAP_MUSICOUT0_UPDATE_FLAG + |MCDRV_SWAP_MUSICOUT1_UPDATE_FLAG + |MCDRV_SWAP_MUSICOUT2_UPDATE_FLAG + |MCDRV_SWAP_EXTOUT_UPDATE_FLAG + |MCDRV_SWAP_VOICEOUT_UPDATE_FLAG; + McPacket_AddSwap(dUpdateFlg); + sdRet = McDevIf_ExecutePacket(); + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("InitMBlock", &sdRet); +#endif + + return sdRet; +} + +/**************************************************************************** + * SetupEReg + * + * Description: + * Setup E_REG. + * Arguments: + * none + * Return: + * none + * + ****************************************************************************/ +static void SetupEReg( + void +) +{ + struct MCDRV_AEC_INFO sInfo; + UINT8 bReg; + UINT8 abSysEq[2][45]; + UINT8 bNonClip; + int i; + UINT8 bMSB, bLSB; + struct MCDRV_INIT_INFO sInitInfo; + struct MCDRV_INIT2_INFO sInit2Info; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("SetupEReg"); +#endif + McResCtrl_GetInitInfo(&sInitInfo, &sInit2Info); + + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_IF, MCI_RST); + if ((bReg & (MCB_PSW_M|MCB_RST_M)) != 0) + goto exit; + + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_A, MCI_PD); + if ((bReg & MCB_PE_CLK_PD) != 0) + goto exit; + + McResCtrl_GetAecInfo(&sInfo); + + if (McDevProf_GetDevId() != eMCDRV_DEV_ID_80_90H) { + ; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_ECLK_SEL, + McResCtrl_GetEClkSel()); + } + + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_E, + MCI_LPF_THR); + bReg &= (MCB_OSF1_MN|MCB_OSF0_MN|MCB_OSF1_ENB|MCB_OSF0_ENB); + bReg |= (UINT8)(sInfo.sOutput.bLpf_Post_Thru[1]<<7); + bReg |= (UINT8)(sInfo.sOutput.bLpf_Post_Thru[0]<<6); + bReg |= (UINT8)(sInfo.sOutput.bLpf_Pre_Thru[1]<<5); + bReg |= (UINT8)(sInfo.sOutput.bLpf_Pre_Thru[0]<<4); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_LPF_THR,/*2*/ + bReg); + + bReg = (UINT8)(sInfo.sOutput.bDcc_Sel[1]<<2) + | sInfo.sOutput.bDcc_Sel[0]; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_DAC_DCC_SEL,/*3*/ + bReg); + + bReg = (UINT8)(sInfo.sOutput.bPow_Det_Lvl[1]<<6) + | (UINT8)(sInfo.sOutput.bPow_Det_Lvl[0]<<4) + | sInfo.sOutput.bSig_Det_Lvl; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_DET_LVL,/*4*/ + bReg); + + bReg = (UINT8)(sInfo.sOutput.bOsf_Sel[1]<<2) + | sInfo.sOutput.bOsf_Sel[0]; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_OSF_SEL,/*8*/ + bReg); + + for (i = 0; i < MCDRV_AEC_OUTPUT_N; i++) { + McSrv_MemCopy(sInfo.sOutput.bSys_Eq_Coef_A0[i], + &abSysEq[i][0], + 3); + McSrv_MemCopy(sInfo.sOutput.bSys_Eq_Coef_A1[i], + &abSysEq[i][3], + 3); + McSrv_MemCopy(sInfo.sOutput.bSys_Eq_Coef_A2[i], + &abSysEq[i][6], + 3); + McSrv_MemCopy(sInfo.sOutput.bSys_Eq_Coef_B1[i], + &abSysEq[i][9], + 3); + McSrv_MemCopy(sInfo.sOutput.bSys_Eq_Coef_B2[i], + &abSysEq[i][12], + 3); + McSrv_MemCopy(sInfo.sOutput.sSysEqEx[i].sBand[0].bCoef_A0, + &abSysEq[i][15], + 3); + McSrv_MemCopy(sInfo.sOutput.sSysEqEx[i].sBand[0].bCoef_A1, + &abSysEq[i][18], + 3); + McSrv_MemCopy(sInfo.sOutput.sSysEqEx[i].sBand[0].bCoef_A2, + &abSysEq[i][21], + 3); + McSrv_MemCopy(sInfo.sOutput.sSysEqEx[i].sBand[0].bCoef_B1, + &abSysEq[i][24], + 3); + McSrv_MemCopy(sInfo.sOutput.sSysEqEx[i].sBand[0].bCoef_B2, + &abSysEq[i][27], + 3); + McSrv_MemCopy(sInfo.sOutput.sSysEqEx[i].sBand[1].bCoef_A0, + &abSysEq[i][30], + 3); + McSrv_MemCopy(sInfo.sOutput.sSysEqEx[i].sBand[1].bCoef_A1, + &abSysEq[i][33], + 3); + McSrv_MemCopy(sInfo.sOutput.sSysEqEx[i].sBand[1].bCoef_A2, + &abSysEq[i][36], + 3); + McSrv_MemCopy(sInfo.sOutput.sSysEqEx[i].sBand[1].bCoef_B1, + &abSysEq[i][39], + 3); + McSrv_MemCopy(sInfo.sOutput.sSysEqEx[i].sBand[1].bCoef_B2, + &abSysEq[i][42], + 3); + } + + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H) { + ; + bReg = (UINT8)(sInfo.sOutput.bSys_Eq_Enb[1]<<1) + | sInfo.sOutput.bSys_Eq_Enb[0]; + } else { + bReg = (UINT8)(sInfo.sOutput.bSys_Eq_Enb[1]<<4) + | sInfo.sOutput.bSys_Eq_Enb[0]; + } + McEdsp_E1Download(abSysEq[0], abSysEq[1], bReg); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_SYSEQ,/*9*/ + bReg); + + bNonClip = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_ANA, + MCI_NONCLIP); + if ((sInfo.sOutput.bClip_Md[1] & 0x6) != 0) + bNonClip |= 1<<7; + else + bNonClip &= 0x7F; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_NONCLIP, + bNonClip); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_CLIP_MD,/*10*/ + sInfo.sOutput.bClip_Md[1]); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_CLIP_ATT,/*11*/ + sInfo.sOutput.bClip_Att[1]); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_CLIP_REL,/*12*/ + sInfo.sOutput.bClip_Rel[1]); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_CLIP_G,/*13*/ + sInfo.sOutput.bClip_G[1]); + + bMSB = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_E, + MCI_OSF_GAIN0_15_8); + bLSB = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_E, + MCI_OSF_GAIN0_7_0); + if ((bMSB != sInfo.sOutput.bOsf_Gain[0][0]) + || (bLSB != sInfo.sOutput.bOsf_Gain[0][1])) { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_OSF_GAIN0_15_8,/*14*/ + sInfo.sOutput.bOsf_Gain[0][0]); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_OSF_GAIN0_7_0, + sInfo.sOutput.bOsf_Gain[0][1]); + } + bMSB = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_E, + MCI_OSF_GAIN1_15_8); + bLSB = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_E, + MCI_OSF_GAIN1_7_0); + if ((bMSB != sInfo.sOutput.bOsf_Gain[1][0]) + || (bLSB != sInfo.sOutput.bOsf_Gain[1][1])) { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_OSF_GAIN1_15_8, + sInfo.sOutput.bOsf_Gain[1][0]); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_OSF_GAIN1_7_0, + sInfo.sOutput.bOsf_Gain[1][1]); + } + + bReg = (UINT8)(sInfo.sOutput.bDcl_OnOff[1]<<7) + | (UINT8)(sInfo.sOutput.bDcl_Gain[1]<<4) + | (UINT8)(sInfo.sOutput.bDcl_OnOff[0]<<3) + | sInfo.sOutput.bDcl_Gain[0]; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_DCL_GAIN,/*18*/ + bReg); + bMSB = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_E, + MCI_DCL0_LMT_14_8); + bLSB = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_E, + MCI_DCL0_LMT_7_0); + if ((bMSB != sInfo.sOutput.bDcl_Limit[0][0]) + || (bLSB != sInfo.sOutput.bDcl_Limit[0][1])) { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_DCL0_LMT_14_8,/*19*/ + sInfo.sOutput.bDcl_Limit[0][0]); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_DCL0_LMT_7_0, + sInfo.sOutput.bDcl_Limit[0][1]); + } + + bMSB = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_E, + MCI_DCL1_LMT_14_8); + bLSB = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_E, + MCI_DCL1_LMT_7_0); + if ((bMSB != sInfo.sOutput.bDcl_Limit[1][0]) + || (bLSB != sInfo.sOutput.bDcl_Limit[1][1])) { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_DCL1_LMT_14_8,/*21*/ + sInfo.sOutput.bDcl_Limit[1][0]); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_DCL1_LMT_7_0, + sInfo.sOutput.bDcl_Limit[1][1]); + } + + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H) { + bReg = (UINT8)(sInfo.sOutput.bDc_Dither_Level[0]<<4) + | (UINT8)(sInfo.sOutput.bRandom_Dither_OnOff[0]<<3) + | (UINT8)(sInfo.sOutput.bRandom_Dither_POS[0]<<2) + | sInfo.sOutput.bRandom_Dither_Level[0]; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_DITHER0,/*23*/ + bReg); + + bReg = (UINT8)(sInfo.sOutput.bDc_Dither_Level[1]<<4) + | (UINT8)(sInfo.sOutput.bRandom_Dither_OnOff[1]<<3) + | (UINT8)(sInfo.sOutput.bRandom_Dither_POS[1]<<2) + | sInfo.sOutput.bRandom_Dither_Level[1]; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_DITHER1, + bReg); + } else { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_DITHER0,/*23*/ + sInit2Info.bOption[4]); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_DITHER1, + sInit2Info.bOption[5]); + } + + bReg = (UINT8)(sInfo.sOutput.bDng_Fw[0]<<7) + | (UINT8)(sInfo.sOutput.bDng_Time[0]<<5) + | sInfo.sOutput.bDng_Zero[0]; + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H) { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_DNG0_ES1,/*25*/ + bReg); + bReg = (UINT8)(sInfo.sOutput.bDng_Fw[1]<<7) + | (UINT8)(sInfo.sOutput.bDng_Time[1]<<5) + | sInfo.sOutput.bDng_Zero[1]; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_DNG1_ES1, + bReg); + + bReg = (UINT8)(sInfo.sOutput.bDng_On[1]<<1) + | sInfo.sOutput.bDng_On[0]; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_DNG_ON_ES1,/*27*/ + bReg); + } else { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_DNG0,/*96*/ + bReg); + bReg = (UINT8)(sInfo.sOutput.bDng_Fw[1]<<7) + | (UINT8)(sInfo.sOutput.bDng_Time[1]<<5) + | sInfo.sOutput.bDng_Zero[1]; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_DNG1, + bReg); + + bReg = (UINT8)(sInfo.sOutput.bDng_On[1]<<1) + | sInfo.sOutput.bDng_On[0]; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_DNG_ON,/*98*/ + bReg); + } + + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_ADJ_HOLD,/*35*/ + sInfo.sAdj.bHold); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_ADJ_CNT, + sInfo.sAdj.bCnt); + bMSB = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_E, + MCI_ADJ_MAX_15_8); + bLSB = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_E, + MCI_ADJ_MAX_7_0); + if ((bMSB != sInfo.sAdj.bMax[0]) + || (bLSB != sInfo.sAdj.bMax[1])) { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_ADJ_MAX_15_8, + sInfo.sAdj.bMax[0]); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_ADJ_MAX_7_0, + sInfo.sAdj.bMax[1]); + } + + bReg = (UINT8)(sInfo.sOutput.bDither_Type[1]<<5) + | (UINT8)(sInfo.sOutput.bDither_Type[0]<<4); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)40,/*40*/ + bReg); + + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_E, + MCI_DSF0_FLT_TYPE); + bReg &= (MCB_DSF0_MN|MCB_DSF0ENB); + bReg |= (UINT8)(sInfo.sInput.bDsf32_R_Type[0]<<6); + bReg |= (UINT8)(sInfo.sInput.bDsf32_L_Type[0]<<4); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_DSF0_FLT_TYPE,/*41*/ + bReg); + + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_E, + MCI_DSF1_FLT_TYPE); + bReg &= (MCB_DSF1_MN|MCB_DSF1ENB); + bReg |= (UINT8)(sInfo.sInput.bDsf32_R_Type[1]<<6); + bReg |= (UINT8)(sInfo.sInput.bDsf32_L_Type[1]<<4); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_DSF1_FLT_TYPE,/*43*/ + bReg); + + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_E, + MCI_DSF2_FLT_TYPE); + bReg &= (MCB_DSF2REFSEL|MCB_DSF2REFBACK|MCB_DSF2_MN|MCB_DSF2ENB); + bReg |= (UINT8)(sInfo.sInput.bDsf32_R_Type[2]<<6); + bReg |= (UINT8)(sInfo.sInput.bDsf32_L_Type[2]<<4); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_DSF2_FLT_TYPE,/*45*/ + bReg); + + bReg = (UINT8)(sInfo.sInput.bDsf4_Sel[2]<<2) + | (UINT8)(sInfo.sInput.bDsf4_Sel[1]<<1) + | (UINT8)(sInfo.sInput.bDsf4_Sel[0]); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_DSF_SEL,/*47*/ + bReg); + bReg = (UINT8)(sInfo.sInput.bDcc_Sel[2]<<4) + | (UINT8)(sInfo.sInput.bDcc_Sel[1]<<2) + | (UINT8)(sInfo.sInput.bDcc_Sel[0]); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_ADC_DCC_SEL,/*48*/ + bReg); + + bReg = (UINT8)(sInfo.sInput.bDng_On[2]<<2) + | (UINT8)(sInfo.sInput.bDng_On[1]<<1) + | (UINT8)(sInfo.sInput.bDng_On[0]); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_ADC_DNG_ON,/*49*/ + bReg); + + bReg = (UINT8)(sInfo.sInput.bDng_Fw[0]<<4) + | (UINT8)(sInfo.sInput.bDng_Rel[0]<<2) + | (UINT8)(sInfo.sInput.bDng_Att[0]); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_ADC_DNG0_FW,/*50*/ + bReg); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_ADC_DNG0_TIM, + sInfo.sInput.bDng_Tim[0]); + bMSB = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_E, + MCI_ADC_DNG0_ZERO_15_8); + bLSB = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_E, + MCI_ADC_DNG0_ZERO_7_0); + if ((bMSB != sInfo.sInput.bDng_Zero[0][0]) + || (bLSB != sInfo.sInput.bDng_Zero[0][1])) { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_ADC_DNG0_ZERO_15_8, + sInfo.sInput.bDng_Zero[0][0]); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_ADC_DNG0_ZERO_7_0, + sInfo.sInput.bDng_Zero[0][1]); + } + bMSB = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_E, + MCI_ADC_DNG0_TGT_15_8); + bLSB = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_E, + MCI_ADC_DNG0_TGT_7_0); + if ((bMSB != sInfo.sInput.bDng_Tgt[0][0]) + || (bLSB != sInfo.sInput.bDng_Tgt[0][1])) { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_ADC_DNG0_TGT_15_8, + sInfo.sInput.bDng_Tgt[0][0]); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_ADC_DNG0_TGT_7_0, + sInfo.sInput.bDng_Tgt[0][1]); + } + + bReg = (UINT8)(sInfo.sInput.bDng_Fw[1]<<4) + | (UINT8)(sInfo.sInput.bDng_Rel[1]<<2) + | (UINT8)(sInfo.sInput.bDng_Att[1]); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_ADC_DNG1_FW,/*56*/ + bReg); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_ADC_DNG1_TIM, + sInfo.sInput.bDng_Tim[1]); + bMSB = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_E, + MCI_ADC_DNG1_ZERO_15_8); + bLSB = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_E, + MCI_ADC_DNG1_ZERO_7_0); + if ((bMSB != sInfo.sInput.bDng_Zero[1][0]) + || (bLSB != sInfo.sInput.bDng_Zero[1][1])) { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_ADC_DNG1_ZERO_15_8, + sInfo.sInput.bDng_Zero[1][0]); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_ADC_DNG1_ZERO_7_0, + sInfo.sInput.bDng_Zero[1][1]); + } + bMSB = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_E, + MCI_ADC_DNG1_TGT_15_8); + bLSB = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_E, + MCI_ADC_DNG1_TGT_7_0); + if ((bMSB != sInfo.sInput.bDng_Tgt[1][0]) + || (bLSB != sInfo.sInput.bDng_Tgt[1][1])) { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_ADC_DNG1_TGT_15_8, + sInfo.sInput.bDng_Tgt[1][0]); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_ADC_DNG1_TGT_7_0, + sInfo.sInput.bDng_Tgt[1][1]); + } + + bReg = (UINT8)(sInfo.sInput.bDng_Fw[2]<<4) + | (UINT8)(sInfo.sInput.bDng_Rel[2]<<2) + | (UINT8)(sInfo.sInput.bDng_Att[2]); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_ADC_DNG2_FW,/*62*/ + bReg); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_ADC_DNG2_TIM, + sInfo.sInput.bDng_Tim[2]); + bMSB = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_E, + MCI_ADC_DNG2_ZERO_15_8); + bLSB = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_E, + MCI_ADC_DNG2_ZERO_7_0); + if ((bMSB != sInfo.sInput.bDng_Zero[2][0]) + || (bLSB != sInfo.sInput.bDng_Zero[2][1])) { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_ADC_DNG2_ZERO_15_8, + sInfo.sInput.bDng_Zero[2][0]); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_ADC_DNG2_ZERO_7_0, + sInfo.sInput.bDng_Zero[2][1]); + } + bMSB = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_E, + MCI_ADC_DNG2_TGT_15_8); + bLSB = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_E, + MCI_ADC_DNG2_TGT_7_0); + if ((bMSB != sInfo.sInput.bDng_Tgt[2][0]) + || (bLSB != sInfo.sInput.bDng_Tgt[2][1])) { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_ADC_DNG2_TGT_15_8, + sInfo.sInput.bDng_Tgt[2][0]); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_ADC_DNG2_TGT_7_0, + sInfo.sInput.bDng_Tgt[2][1]); + } + + bReg = (UINT8)(sInfo.sInput.bDepop_Wait[0]<<2) + | (UINT8)(sInfo.sInput.bDepop_Att[0]); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_DEPOP0,/*68*/ + bReg); + bReg = (UINT8)(sInfo.sInput.bDepop_Wait[1]<<2) + | (UINT8)(sInfo.sInput.bDepop_Att[1]); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_DEPOP1, + bReg); + bReg = (UINT8)(sInfo.sInput.bDepop_Wait[2]<<2) + | (UINT8)(sInfo.sInput.bDepop_Att[2]); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_DEPOP2, + bReg); + + bReg = (UINT8)(sInfo.sPdm.bStWait<<2) + | sInfo.sPdm.bMode; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_PDM_MODE,/*71*/ + bReg); + + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_E, + MCI_PDM_LOAD_TIM); + bReg &= (MCB_PDM1_START|MCB_PDM0_START); + bReg |= (UINT8)(sInfo.sPdm.bPdm1_LoadTim<<4); + bReg |= sInfo.sPdm.bPdm0_LoadTim; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_PDM_LOAD_TIM,/*72*/ + bReg); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_PDM0L_FINE_DLY, + sInfo.sPdm.bPdm0_LFineDly); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_PDM0R_FINE_DLY, + sInfo.sPdm.bPdm0_RFineDly); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_PDM1L_FINE_DLY, + sInfo.sPdm.bPdm1_LFineDly); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_PDM1R_FINE_DLY, + sInfo.sPdm.bPdm1_RFineDly); + + bReg = 0; + bReg |= (UINT8)(sInfo.sEDspMisc.bChSel<<6); + bReg |= (UINT8)(sInfo.sEDspMisc.bI2SOut_Enb<<5); + bReg |= sInfo.sEDspMisc.bLoopBack; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_CH_SEL, + bReg); + + bReg = (sInfo.sE2.bE2_Da_Sel<<3) | sInfo.sE2.bE2_Ad_Sel; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_E2_SEL, + bReg); + + if (McDevProf_GetDevId() != eMCDRV_DEV_ID_80_90H) { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)99, + E_99); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)100, + E_100); + } + +exit:; +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("SetupEReg", NULL); +#endif +} + +/**************************************************************************** + * Offsetcancel + * + * Description: + * do offsetcancel. + * Arguments: + * none + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR_TIMEOUT + * MCDRV_ERROR + * + ****************************************************************************/ +static SINT32 Offsetcancel( + void +) +{ + SINT32 sdRet = MCDRV_SUCCESS; + UINT8 bReg, + bEIRQHS, + bAP, + bAPDA0, + bAPDA1; + struct MCDRV_AEC_INFO sAecInfo; + UINT8 bSlaveAddrA; + UINT8 abData[2]; + UINT8 bMSB, bLSB; + struct MCDRV_INIT_INFO sInitInfo; + struct MCDRV_INIT2_INFO sInit2Info; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("Offsetcancel"); +#endif + bSlaveAddrA = McDevProf_GetSlaveAddr(eMCDRV_SLAVE_ADDR_ANA); +#ifndef _FOR_FPGA + McResCtrl_GetInitInfo(&sInitInfo, &sInit2Info); + McResCtrl_GetAecInfo(&sAecInfo); + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_E1DSP_CTRL), + (UINT8)0x00); + sdRet = McDevIf_ExecutePacket(); + if (sdRet != MCDRV_SUCCESS) + goto exit; + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_LPF_THR), + (UINT8)MCI_LPF_THR_DEF|MCB_OSF1_ENB|MCB_OSF0_ENB); + + McDevIf_AddPacket(MCDRV_PACKET_TYPE_TIMWAIT + | MCDRV_DP_DAC_WAIT_TIME, + 0); + + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_CD + | (UINT32)MCI_DP, + 0); + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_DSF0_FLT_TYPE), + (UINT8)MCB_DSF0ENB); + + bEIRQHS = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_CD, MCI_IRQHS); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_CD + | (UINT32)MCI_IRQHS, + 0); + + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H) { + bReg = (UINT8)(sAecInfo.sOutput.bDc_Dither_Level[0]<<4) + | (UINT8)(sAecInfo.sOutput.bRandom_Dither_OnOff[0]<<3) + | (UINT8)(sAecInfo.sOutput.bRandom_Dither_POS[0]<<2) + | sAecInfo.sOutput.bRandom_Dither_Level[0]; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_DITHER0,/*23*/ + bReg); + bReg = (UINT8)(sAecInfo.sOutput.bDc_Dither_Level[1]<<4) + | (UINT8)(sAecInfo.sOutput.bRandom_Dither_OnOff[1]<<3) + | (UINT8)(sAecInfo.sOutput.bRandom_Dither_POS[1]<<2) + | sAecInfo.sOutput.bRandom_Dither_Level[1]; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_DITHER1, + bReg); + } + + bReg = (UINT8)(sAecInfo.sOutput.bDither_Type[1]<<5) + | (UINT8)(sAecInfo.sOutput.bDither_Type[0]<<4); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)40,/*40*/ + bReg); + + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_ADJ_HOLD,/*35*/ + sAecInfo.sAdj.bHold); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_ADJ_CNT, + sAecInfo.sAdj.bCnt); + bMSB = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_E, + MCI_ADJ_MAX_15_8); + bLSB = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_E, + MCI_ADJ_MAX_7_0); + if ((bMSB != sAecInfo.sAdj.bMax[0]) + || (bLSB != sAecInfo.sAdj.bMax[1])) { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_ADJ_MAX_15_8, + sAecInfo.sAdj.bMax[0]); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_ADJ_MAX_7_0, + sAecInfo.sAdj.bMax[1]); + } + + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H) { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)22, + CP_88OFF<<1); + + if ((McResCtrl_HasSrc(eMCDRV_DST_HP, eMCDRV_DST_CH0) != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_HP, eMCDRV_DST_CH1) != 0)) + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)19, + OP_DAC_HP); + else + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)19, + OP_DAC); + + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)17, + (UINT8)(HP_IBST<<1)|HP_MIDBST); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)15, + (UINT8)(HP_IDLE<<5)); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_CD + | (UINT32)39, + CD_39); + + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)31, + 0xB5); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)30, + 0xD6); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)78, + T_CPMODE_OFFCAN_BEFORE); + } else { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)22, + sInit2Info.bOption[14]); + + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)19, + sInit2Info.bOption[7]); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)62, + sInit2Info.bOption[8]); + } + + bReg = E1COMMAND_OFFSET_CANCEL; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_E1COMMAND, + bReg); + sdRet = McDevIf_ExecutePacket(); + if (sdRet != MCDRV_SUCCESS) + goto exit; + + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H) { + abData[0] = MCI_ANA_REG_A<<1; + abData[1] = 78; + McSrv_WriteReg(bSlaveAddrA, abData, 2); + bReg = McSrv_ReadReg(bSlaveAddrA, MCI_ANA_REG_D); + if (bReg != T_CPMODE_OFFCAN_BEFORE) { + sdRet = MCDRV_ERROR; + goto exit; + } + } + + if (McResCtrl_GetAPMode() == eMCDRV_APM_OFF) { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_TIMWAIT + | MCDRV_OFC_WAIT_TIME, + 0); + + bAP = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_ANA, + MCI_AP); + bAPDA0 = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_ANA, + MCI_AP_DA0); + bAPDA1 = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_ANA, + MCI_AP_DA1); + + bReg = bAPDA1; + bReg &= (UINT8)~(MCB_AP_SPR1|MCB_AP_SPL1); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_AP_DA1, + bReg); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_TIMWAIT + |MCDRV_WAIT_TIME_350US, + 0); + bReg &= (UINT8)~(MCB_AP_SPR2|MCB_AP_SPL2); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_AP_DA1, + bReg); + + bReg = bAPDA0; + bReg &= (UINT8)~MCB_AP_RC; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_AP_DA0, + bReg); + + McDevIf_AddPacket(MCDRV_PACKET_TYPE_EVTWAIT + | MCDRV_EVT_ANA_RDY + | ((UINT32)MCI_RDY1 << 8) + | (UINT32)MCB_SPDY_R|MCB_SPDY_L, + 0); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_EVTWAIT + | MCDRV_EVT_ANA_RDY + | ((UINT32)MCI_RDY2 << 8) + | (UINT32)MCB_RCRDY, + 0); + + bReg = bAP; + bReg &= (UINT8)~MCB_AP_HPDET; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_AP, + bReg); + bReg = bAPDA0; + bReg &= (UINT8)~(MCB_AP_HPR + |MCB_AP_HPL + |MCB_AP_LO1R + |MCB_AP_LO1L); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_AP_DA0, + bReg); + bReg = bAPDA1; + bReg &= (UINT8)~(MCB_AP_LO2R|MCB_AP_LO2L); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_AP_DA1, + bReg); + + McDevIf_AddPacket(MCDRV_PACKET_TYPE_EVTWAIT + | MCDRV_EVT_ANA_RDY + | ((UINT32)MCI_RDY1 << 8) + | (UINT32)MCB_HPDY_R + | MCB_HPDY_L + | MCB_HPDET_RDY, + 0); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_EVTWAIT + | MCDRV_EVT_ANA_RDY + | ((UINT32)MCI_RDY2 << 8) + | (UINT32)MCB_LO2RDY_R + | MCB_LO2RDY_L + | MCB_LO1RDY_R + | MCB_LO1RDY_L, + 0); + + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_AP, + bAP); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_AP_DA0, + bAPDA0); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_AP_DA1, + bAPDA1); + } else { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_EVTWAIT + | MCDRV_EVT_OFFCAN_BSY_RESET, + 0); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_CD + | (UINT32)MCI_SSENSEFIN, + MCB_SOFFCANFIN); + } + + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_DSF0_FLT_TYPE), + 0); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_CD + | (UINT32)MCI_IRQHS, + bEIRQHS); + + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H) { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)78, + T_CPMODE_OFFCAN_AFTER); + } + + sdRet = McDevIf_ExecutePacket(); + if (sdRet != MCDRV_SUCCESS) + goto exit; + + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H) { + abData[0] = MCI_ANA_REG_A<<1; + abData[1] = 78; + McSrv_WriteReg(bSlaveAddrA, abData, 2); + bReg = McSrv_ReadReg(bSlaveAddrA, MCI_ANA_REG_D); + if (bReg != T_CPMODE_OFFCAN_AFTER) { + sdRet = MCDRV_ERROR; + goto exit; + } + } +#endif +exit: +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("Offsetcancel", &sdRet); +#endif + return sdRet; +} + +/**************************************************************************** + * McPacket_AddPowerUp + * + * Description: + * Add powerup packet. + * Arguments: + * psPowerInfo power information + * psPowerUpdate power update information + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR_RESOURCEOVER + * MCDRV_ERROR_TIMEOUT + * + ****************************************************************************/ +SINT32 McPacket_AddPowerUp( + const struct MCDRV_POWER_INFO *psPowerInfo, + const struct MCDRV_POWER_UPDATE *psPowerUpdate +) +{ + SINT32 sdRet = MCDRV_SUCCESS; + UINT8 bReg, + bRegPD, bCurRegPD, + bRegRst, bPSW, bRST, + bAP, + bRegAPDA0, bRegAPDA1, bCurRegAPDA0, bCurRegAPDA1; + UINT8 bRegChange; + UINT8 bDUpdate; + struct MCDRV_INIT_INFO sInitInfo; + struct MCDRV_INIT2_INFO sInit2Info; + struct MCDRV_CLOCKSW_INFO sClockSwInfo; + struct MCDRV_AEC_INFO sAecInfo; + UINT32 dWaitTime = 0; + UINT8 bOfc = 0; + struct MCDRV_FDSP_INIT stFDSPInit; + struct MCDRV_CDSP_INIT stCDSPInit; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McPacket_AddPowerUp"); +#endif + + + McResCtrl_GetInitInfo(&sInitInfo, &sInit2Info); + McResCtrl_GetClockSwInfo(&sClockSwInfo); + McResCtrl_GetAecInfo(&sAecInfo); + + bRegRst = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_IF, MCI_RST); + bPSW = bRegRst & (MCB_PSW_M|MCB_PSW_F|MCB_PSW_C); + bRST = bRegRst & (MCB_RST_M|MCB_RST_F|MCB_RST_C); + bRegPD = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_A, MCI_PD); + bCurRegPD = bRegPD; + bDUpdate = ~psPowerInfo->bDigital & psPowerUpdate->bDigital; + bAP = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_ANA, MCI_AP); + bCurRegAPDA0 = + McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_ANA, MCI_AP_DA0); + bCurRegAPDA1 = + McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_ANA, MCI_AP_DA1); + bRegAPDA0 = + (UINT8)~(bCurRegAPDA0 & psPowerUpdate->abAnalog[1]); + bRegAPDA0 |= psPowerInfo->abAnalog[1]; + bRegAPDA0 &= bCurRegAPDA0; + bRegAPDA1 = + (UINT8)~(bCurRegAPDA1 & psPowerUpdate->abAnalog[2]); + bRegAPDA1 |= psPowerInfo->abAnalog[2]; + bRegAPDA1 &= bCurRegAPDA1; + + if (((bDUpdate & MCDRV_POWINFO_D_PLL_PD) != 0UL) + && ((bRegPD&MCB_PLL_PD) != 0)) { + if ((bAP&MCB_AP_LDOD) != 0) { + bAP &= (UINT8)~(MCB_AP_LDOD|MCB_AP_BGR); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_AP, + bAP|MCDRV_AP_LDOD); + + McDevIf_AddPacket(MCDRV_PACKET_TYPE_TIMWAIT + | MCDRV_LDO_WAIT_TIME, + 0); + } + + /* RSTA */ + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_RST_A, + MCI_RST_A_DEF); + sdRet = McDevIf_ExecutePacket(); + if (sdRet != MCDRV_SUCCESS) + goto exit; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_RST_A, + MCI_RST_A_DEF&~MCB_RST_A); + + McResCtrl_InitABlockReg(); + + /* JTAGSEL */ + if ((sInitInfo.bPowerMode == MCDRV_POWMODE_CDSPDEBUG) + || (sAecInfo.sAecVBox.sAecCDspDbg.bJtagOn == 1)) + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_JTAGSEL, + MCB_JTAGSEL); + + AddInitDigtalIO(); + AddInitGPIO(); + + /* CKSEL */ + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_CK_TCX0, + sInitInfo.bCkSel); + /* PLL */ + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_PLL_MODE_A, + sInitInfo.bPllModeA); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_PLL_PREDIV_A, + sInitInfo.bPllPrevDivA); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_PLL_FBDIV_A_12_8, + (UINT8)(sInitInfo.wPllFbDivA>>8)); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_PLL_FBDIV_A_7_0, + (UINT8)(sInitInfo.wPllFbDivA&0xFF)); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_PLL_FRAC_A_15_8, + (UINT8)(sInitInfo.wPllFracA>>8)); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_PLL_FRAC_A_7_0, + (UINT8)(sInitInfo.wPllFracA&0xFF)); + bReg = (sInitInfo.bPllFreqA<<1); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_PLL_FOUT_A, + bReg); + + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_PLL_MODE_B, + sInitInfo.bPllModeB); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_PLL_PREDIV_B, + sInitInfo.bPllPrevDivB); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_PLL_FBDIV_B_12_8, + (UINT8)(sInitInfo.wPllFbDivB>>8)); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_PLL_FBDIV_B_7_0, + (UINT8)(sInitInfo.wPllFbDivB&0xFF)); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_PLL_FRAC_B_15_8, + (UINT8)(sInitInfo.wPllFracB>>8)); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_PLL_FRAC_B_7_0, + (UINT8)(sInitInfo.wPllFracB&0xFF)); + bReg = (sInitInfo.bPllFreqB<<1); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_PLL_FOUT_B, + bReg); + + bReg = (UINT8)(McResCtrl_GetFClkSel()<<6) + | McResCtrl_GetCClkSel(); + if (sClockSwInfo.bClkSrc == MCDRV_CLKSW_CLKA) + bReg |= (sInitInfo.bPllFreqA<<4); + else + bReg |= (sInitInfo.bPllFreqB<<4); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_FREQ73M, + bReg); + + bReg = sInitInfo.bCkInput; + if (sClockSwInfo.bClkSrc == MCDRV_CLKSW_CLKB) + bReg |= MCB_CLK_INPUT; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_CLKSRC, + bReg); + + if (McDevProf_GetDevId() != eMCDRV_DEV_ID_80_90H) { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_DOA_DRV, + sInit2Info.bOption[0]<<7); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_SCKMSKON_B, + sInit2Info.bOption[1]); + } + + sdRet = McDevIf_ExecutePacket(); + if (sdRet != MCDRV_SUCCESS) + goto exit; + + /* Clock Start */ + McSrv_ClockStart(); + + bReg = MCI_CLK_MSK_DEF; + if (sClockSwInfo.bClkSrc == MCDRV_CLKSW_CLKA) { + if ((sInitInfo.bCkInput == MCDRV_CKINPUT_CLKI0_CLKI1) + || (sInitInfo.bCkInput == MCDRV_CKINPUT_CLKI0_RTCK) + || (sInitInfo.bCkInput == MCDRV_CKINPUT_CLKI0_SBCK) + || (sInitInfo.bCkInput == MCDRV_CKINPUT_CLKI0_CLKI0)) { + bReg &= (UINT8)~MCB_CLKI0_MSK; + } else if ((sInitInfo.bCkInput + == MCDRV_CKINPUT_CLKI1_CLKI0) + || (sInitInfo.bCkInput + == MCDRV_CKINPUT_CLKI1_RTCK) + || (sInitInfo.bCkInput + == MCDRV_CKINPUT_CLKI1_SBCK) + || (sInitInfo.bCkInput + == MCDRV_CKINPUT_CLKI1_CLKI1)) { + bReg &= (UINT8)~MCB_CLKI1_MSK; + } else { + bReg &= (UINT8)~MCB_RTCI_MSK; + } + } else { + if ((sInitInfo.bCkInput == MCDRV_CKINPUT_CLKI1_CLKI0) + || (sInitInfo.bCkInput == MCDRV_CKINPUT_RTC_CLKI0) + || (sInitInfo.bCkInput == MCDRV_CKINPUT_SBCK_CLKI0) + || (sInitInfo.bCkInput == MCDRV_CKINPUT_CLKI0_CLKI0)) { + bReg &= (UINT8)~MCB_CLKI0_MSK; + } else if ((sInitInfo.bCkInput + == MCDRV_CKINPUT_CLKI0_CLKI1) + || (sInitInfo.bCkInput + == MCDRV_CKINPUT_RTC_CLKI1) + || (sInitInfo.bCkInput + == MCDRV_CKINPUT_SBCK_CLKI1) + || (sInitInfo.bCkInput + == MCDRV_CKINPUT_CLKI1_CLKI1)) { + bReg &= (UINT8)~MCB_CLKI1_MSK; + } else { + bReg &= (UINT8)~MCB_RTCI_MSK; + } + } + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_CLK_MSK, + bReg); + if ((bReg & MCB_CLKI0_MSK) == 0) { + if ((sInitInfo.bCkSel == MCDRV_CKSEL_TCXO_TCXO) + || (sInitInfo.bCkSel == MCDRV_CKSEL_TCXO_CMOS)) { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_TIMWAIT + | MCDRV_TCXO_WAIT_TIME, 0); + } + } else if ((bReg & MCB_CLKI1_MSK) == 0) { + if ((sInitInfo.bCkSel == MCDRV_CKSEL_TCXO_TCXO) + || (sInitInfo.bCkSel == MCDRV_CKSEL_CMOS_TCXO)) { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_TIMWAIT + | MCDRV_TCXO_WAIT_TIME, 0); + } + } + if ((bReg&MCB_RTCI_MSK) == 0) { + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_CD, + MCI_CKSEL); + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H) { + ; + bReg &= (UINT8)~MCB_HSDET; + } else { + bReg &= (UINT8)~MCB_CRTC; + } + McDevIf_AddPacket( + MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_CD + | (UINT32)MCI_CKSEL, + bReg); + } + + bRegPD &= (UINT8)~MCB_PLL_PD; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_PD, + bRegPD); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_TIMWAIT + | MCDRV_PLL_WAIT_TIME, 0); + bRegPD &= (UINT8)~MCB_VCOOUT_PD; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_PD, + bRegPD); + + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_IRQ, + MCB_EIRQ); + bOfc = 1; + } + + if (((bDUpdate & MCDRV_POWINFO_D_PE_CLK_PD) != 0UL) + && ((bCurRegPD&MCB_PE_CLK_PD) != 0)) { + ; + bOfc = 1; + } + + /* ANACLK_PD */ + if ((((bDUpdate & MCDRV_POWINFO_D_PLL_PD) != 0UL) + && ((psPowerUpdate->abAnalog[0] & MCB_AP_LDOA) != 0) + && ((psPowerInfo->abAnalog[0] & MCB_AP_LDOA) == 0)) + || (bOfc == 1)) { + bRegPD &= (UINT8)~MCB_ANACLK_PD; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_PD, + bRegPD); + } + + if (bOfc == 1) { + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H) { + if ((McResCtrl_HasSrc(eMCDRV_DST_HP, eMCDRV_DST_CH0) + != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_HP, eMCDRV_DST_CH1) + != 0)) + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)19, + OP_DAC_HP); + else + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)19, + OP_DAC); + } + } + + /* AP_VR */ + if ((bAP & MCB_AP_VR) != 0) { + if (((((psPowerUpdate->abAnalog[0] & MCB_AP_LDOA) != 0) + && ((psPowerInfo->abAnalog[0] & MCB_AP_LDOA) == 0)) + || (bOfc == 1))) { + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H) { + bAP &= (UINT8)~MCB_AP_VR; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_AP, + bAP|MCDRV_AP_LDOD); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_TIMWAIT + | MCDRV_VREF_WAIT_TIME_ES1, + 0); + /* AP_LDOA/AP_BGR */ + bAP &= (UINT8)~(MCB_AP_LDOA|MCB_AP_BGR); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_AP, + bAP|MCDRV_AP_LDOD); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_TIMWAIT + | MCDRV_LDO_WAIT_TIME, + 0); + } else { + /* AP_BGR */ + bAP &= (UINT8)~(MCB_AP_BGR); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_AP, + bAP|MCDRV_AP_LDOD); + + /* AP_LDOA */ + bAP &= (UINT8)~(MCB_AP_LDOA); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_AP, + bAP|MCDRV_AP_LDOD); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_TIMWAIT + | MCDRV_LDO_WAIT_TIME, + 0); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)62, + sInit2Info.bOption[8]|0x20); + bAP &= (UINT8)~MCB_AP_VR; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_AP, + bAP|MCDRV_AP_LDOD); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_TIMWAIT + | sInitInfo.sWaitTime.dWaitTime[6], + 0); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)62, + sInit2Info.bOption[8]); + } + } + } + + if ((bOfc == 1) + || (((bDUpdate & MCDRV_POWINFO_D_PM_CLK_PD) != 0UL) + && ((bRegPD&MCB_PM_CLK_PD) != 0))) { + bPSW &= (UINT8)~MCB_PSW_M; + bRST &= (UINT8)~MCB_RST_M; + bRegPD &= (UINT8)~MCB_PM_CLK_PD; + McResCtrl_InitMBlockReg(); + } + + if (((bDUpdate & MCDRV_POWINFO_D_PB_CLK_PD) != 0UL) + && ((bRegPD&MCB_PB_CLK_PD) != 0)) { + bRegPD &= (UINT8)~MCB_PB_CLK_PD; + } + + if ((bOfc == 1) + || (((bDUpdate & MCDRV_POWINFO_D_PE_CLK_PD) != 0UL) + && ((bRegPD&MCB_PE_CLK_PD) != 0))) { + bRegPD &= (UINT8)~MCB_PE_CLK_PD; + McResCtrl_InitEReg(); + } + + if (((bDUpdate & MCDRV_POWINFO_D_PF_CLK_PD) != 0UL) + && ((bRegPD&MCB_PF_CLK_PD) != 0)) { + bPSW &= (UINT8)~MCB_PSW_F; + bRST &= (UINT8)~MCB_RST_F; + bRegPD &= (UINT8)~MCB_PF_CLK_PD; + } + + if (((bDUpdate & MCDRV_POWINFO_D_PC_CLK_PD) != 0UL) + && ((bRegPD&MCB_PC_CLK_PD) != 0)) { + bPSW &= (UINT8)~MCB_PSW_C; + bRST &= (UINT8)~MCB_RST_C; + bRegPD &= (UINT8)~MCB_PC_CLK_PD; + } + + bRegRst &= (UINT8)~(MCB_PSW_M|MCB_PSW_F|MCB_PSW_C); + bRegRst |= bPSW; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_RST, + bRegRst); + if ((bAP&MCB_AP_LDOD) == 0) + McDevIf_AddPacket(MCDRV_PACKET_TYPE_EVTWAIT + | MCDRV_EVT_PSW_RESET + | (UINT32)MCI_RST<<8 + | (~bPSW&(MCB_PSW_M|MCB_PSW_F|MCB_PSW_C)), + 0); + bRegRst &= (UINT8)~(MCB_RST_M|MCB_RST_F|MCB_RST_C); + bRegRst |= bRST; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_RST, + bRegRst); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_PD, + bRegPD); + + sdRet = McDevIf_ExecutePacket(); + if (sdRet != MCDRV_SUCCESS) + goto exit; + if (((bDUpdate & MCDRV_POWINFO_D_PM_CLK_PD) != 0UL) + && ((bCurRegPD&MCB_PM_CLK_PD) != 0) + && ((bRegPD&MCB_PM_CLK_PD) == 0)) + InitMBlock(); + + if (((bDUpdate & MCDRV_POWINFO_D_PB_CLK_PD) != 0UL) + && ((bCurRegPD&MCB_PB_CLK_PD) != 0) + && ((bRegPD&MCB_PB_CLK_PD) == 0)) { + sdRet = McDevIf_ExecutePacket(); + if (sdRet != MCDRV_SUCCESS) + goto exit; + McBdsp_Init(); + } + + if ((bOfc != 0) + || (((bDUpdate & MCDRV_POWINFO_D_PE_CLK_PD) != 0UL) + && ((bCurRegPD&MCB_PE_CLK_PD) != 0) + && ((bRegPD&MCB_PE_CLK_PD) == 0))) { + sdRet = McDevIf_ExecutePacket(); + if (sdRet != MCDRV_SUCCESS) + goto exit; + McEdsp_Init(); + McEdsp_SetCBFunc(DSPCallback); + SetupEReg(); + sdRet = McDevIf_ExecutePacket(); + if (sdRet != MCDRV_SUCCESS) + goto exit; + if (bOfc != 0) { + sdRet = Offsetcancel(); + if (sdRet != MCDRV_SUCCESS) + goto exit; + SetupEReg(); + sdRet = McDevIf_ExecutePacket(); + if (sdRet != MCDRV_SUCCESS) + goto exit; + } + } + + if (((bDUpdate & MCDRV_POWINFO_D_PF_CLK_PD) != 0UL) + && ((bCurRegPD&MCB_PF_CLK_PD) != 0) + && ((bRegPD&MCB_PF_CLK_PD) == 0)) { + sdRet = McDevIf_ExecutePacket(); + if (sdRet != MCDRV_SUCCESS) + goto exit; + if (sAecInfo.sAecConfig.bFDspLocate == 0) { + stFDSPInit.sInput.wADDFmt = 0xF0FF; + stFDSPInit.sOutput.wADDFmt = 0xF0FF; + } else { + stFDSPInit.sInput.wADDFmt = 0xF000; + stFDSPInit.sOutput.wADDFmt = 0xF000; + } + stFDSPInit.dWaitTime = sInitInfo.sWaitTime.dWaitTime[5]; + McFdsp_Init(&stFDSPInit); + McFdsp_SetCBFunc(DSPCallback); + bReg = MCB_IESERR + | MCB_IEAMTBEG + | MCB_IEAMTEND + | MCB_IEFW; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_IESERR, + bReg); + } + + if (((bDUpdate & MCDRV_POWINFO_D_PC_CLK_PD) != 0UL) + && ((bCurRegPD&MCB_PC_CLK_PD) != 0) + && ((bRegPD&MCB_PC_CLK_PD) == 0)) { + /* JTAGSEL */ + if (sAecInfo.sAecVBox.sAecCDspDbg.bJtagOn == 1) { + ; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_JTAGSEL, + MCB_JTAGSEL); + } + sdRet = McDevIf_ExecutePacket(); + if (sdRet != MCDRV_SUCCESS) + goto exit; + stCDSPInit.bJtag = sAecInfo.sAecVBox.sAecCDspDbg.bJtagOn; + /* JTAGSEL */ + if (sInitInfo.bPowerMode == MCDRV_POWMODE_CDSPDEBUG) { + stCDSPInit.bJtag = 1; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_DO1_DRV, + 0x22); + } + McCdsp_Init(&stCDSPInit); + McCdsp_SetCBFunc(eMC_PLAYER_CODER_A, DSPCallback); + McCdsp_SetCBFunc(eMC_PLAYER_CODER_B, DSPCallback); + bReg = MCB_ECDSP + | MCB_EFFIFO + | MCB_ERFIFO + | MCB_EEFIFO + | MCB_EOFIFO + | MCB_EDFIFO + | MCB_EENC + | MCB_EDEC; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_ECDSP, + bReg); + } + + /* DP_ADC/DP_DAC* */ + AddDacStart(); + if (bOfc == 0) { + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_CD, MCI_DP); + if ((psPowerUpdate->abAnalog[1] & (MCB_AP_DA0R|MCB_AP_DA0L)) + != 0) { + if (((psPowerInfo->abAnalog[1] & MCB_AP_DA0R) == 0) + || ((psPowerInfo->abAnalog[1] & MCB_AP_DA0L) == 0)) { + bReg &= + (UINT8)~(MCB_DP_DAC1|MCB_DP_DAC0| + MCB_DP_PDMCK|MCB_DP_PDMDAC); + if (McDevProf_GetDevId() + == eMCDRV_DEV_ID_80_90H) { + ; + bReg |= MCB_DP_DAC1; + } + } + } + if ((psPowerUpdate->abAnalog[1] & (MCB_AP_DA1R|MCB_AP_DA1L)) + != 0) + if (((psPowerInfo->abAnalog[2] & MCB_AP_DA1R) == 0) + || ((psPowerInfo->abAnalog[2] & MCB_AP_DA1L) == 0)) + bReg &= + (UINT8)~(MCB_DP_DAC1| + MCB_DP_PDMCK|MCB_DP_PDMDAC); + if ((psPowerUpdate->abAnalog[4] & + (MCB_AP_ADM|MCB_AP_ADR|MCB_AP_ADL)) != 0) + if (((psPowerInfo->abAnalog[4] & MCB_AP_ADM) == 0) + || ((psPowerInfo->abAnalog[4] & MCB_AP_ADR) == 0) + || ((psPowerInfo->abAnalog[4] & MCB_AP_ADL) == 0)) + bReg &= + (UINT8)~(MCB_DP_ADC| + MCB_DP_PDMCK|MCB_DP_PDMADC); + if ((bRegAPDA1& + (MCB_AP_SPR2|MCB_AP_SPR1|MCB_AP_SPL2|MCB_AP_SPL1)) + != (MCB_AP_SPR2|MCB_AP_SPR1|MCB_AP_SPL2|MCB_AP_SPL1)) + bReg &= (UINT8)~(MCB_DP_ADC|MCB_DP_PDMADC); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_CD + | (UINT32)MCI_DP, + bReg); + } + + /* AP_MC/AP_MB */ + bReg = + McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_ANA, MCI_AP_MIC); + bRegChange = (UINT8)~(bReg & psPowerUpdate->abAnalog[3]); + bRegChange |= psPowerInfo->abAnalog[3]; + bRegChange &= bReg; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_AP_MIC, + bRegChange); + bRegChange = ~bRegChange & bReg; + dWaitTime = GetMaxWait(bRegChange); + + /* AP_LI/AP_AD */ + bReg = + McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_ANA, MCI_AP_AD); + bRegChange = (UINT8)~(bReg & psPowerUpdate->abAnalog[4]); + bRegChange |= psPowerInfo->abAnalog[4]; + bRegChange &= bReg; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_AP_AD, + bRegChange); + if (((bReg&MCB_AP_LI) != 0) + && ((bRegChange&MCB_AP_LI) == 0)) + dWaitTime = sInitInfo.sWaitTime.dWaitTime[4]; + + if (McResCtrl_GetAPMode() == eMCDRV_APM_OFF) { + if (((psPowerUpdate->abAnalog[0] & MCB_AP_CP) != 0) + && ((psPowerInfo->abAnalog[0] & MCB_AP_CP) == 0)) { + if ((bAP&MCB_AP_CP) != 0) { + bAP &= (UINT8)~MCB_AP_CP; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_AP, + bAP|MCDRV_AP_LDOD); + if (McDevProf_GetDevId() + == eMCDRV_DEV_ID_80_90H) { + if (dWaitTime > MCDRV_CP_WAIT_TIME) { + ; + dWaitTime -= + MCDRV_CP_WAIT_TIME; + } else { + dWaitTime = 0; + } + McDevIf_AddPacket( + MCDRV_PACKET_TYPE_TIMWAIT + | MCDRV_CP_WAIT_TIME, + 0); + } + } + } + if (bRegAPDA0 != bCurRegAPDA0) { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_AP_DA0, + bRegAPDA0); + if (dWaitTime < MCDRV_WAIT_TIME_500US) + dWaitTime = MCDRV_WAIT_TIME_500US; + } + if (bRegAPDA1 != bCurRegAPDA1) { + if ((bRegAPDA1 & + (MCB_AP_SPR2|MCB_AP_SPR1|MCB_AP_SPL2|MCB_AP_SPL1)) + != + (bCurRegAPDA1 & + (MCB_AP_SPR2|MCB_AP_SPR1|MCB_AP_SPL2|MCB_AP_SPL1))) { + bReg = bRegAPDA1 | + (bCurRegAPDA1&(MCB_AP_SPR2|MCB_AP_SPL2)); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_AP_DA1, + bReg); + McDevIf_AddPacket( + MCDRV_PACKET_TYPE_TIMWAIT|MCDRV_WAIT_TIME_350US, + 0); + if (dWaitTime > MCDRV_WAIT_TIME_350US) + dWaitTime -= + MCDRV_WAIT_TIME_350US; + else + dWaitTime = 0; + } + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_AP_DA1, + bRegAPDA1); + if (dWaitTime < MCDRV_WAIT_TIME_500US) + dWaitTime = MCDRV_WAIT_TIME_500US; + } + } else { + McResCtrl_SetRegVal(MCDRV_PACKET_REGTYPE_ANA, MCI_AP_DA0, + bRegAPDA0); + McResCtrl_SetRegVal(MCDRV_PACKET_REGTYPE_ANA, MCI_AP_DA1, + bRegAPDA1); + } + if (dWaitTime > 0) + McDevIf_AddPacket(MCDRV_PACKET_TYPE_TIMWAIT | dWaitTime, 0); + +exit: +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McPacket_AddPowerUp", &sdRet); +#endif + return sdRet; +} + +/**************************************************************************** + * McPacket_AddPowerDown + * + * Description: + * Add powerdown packet. + * Arguments: + * psPowerInfo power information + * psPowerUpdate power update information + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR_RESOURCEOVER + * MCDRV_ERROR_TIMEOUT + * + ****************************************************************************/ +SINT32 McPacket_AddPowerDown( + const struct MCDRV_POWER_INFO *psPowerInfo, + const struct MCDRV_POWER_UPDATE *psPowerUpdate +) +{ + SINT32 sdRet = MCDRV_SUCCESS; + UINT8 bUpdate; + UINT8 bReg; + UINT8 bRegPD, bRegRst, bPSW = 0, bRST = 0, + bAP, + bRegAPDA0, bRegAPDA1; + struct MCDRV_INIT_INFO sInitInfo; + struct MCDRV_INIT2_INFO sInit2Info; + UINT8 bMKDetEn = 0; + UINT8 bAddMKDetEn = 0; + UINT8 bPlugDetDB = 0; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McPacket_AddPowerDown"); +#endif + + + McResCtrl_GetInitInfo(&sInitInfo, &sInit2Info); + + bUpdate = psPowerInfo->bDigital & psPowerUpdate->bDigital; + bRegRst = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_IF, MCI_RST); + bRegPD = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_A, MCI_PD); + bPlugDetDB = McResCtrl_GetPlugDetDB(); + + if (MCDRV_POWMODE_FULL == sInitInfo.bPowerMode) + if (((bUpdate & MCDRV_POWINFO_D_PLL_PD) != 0UL) + && ((bRegPD&(MCB_PLL_PD|MCB_PM_CLK_PD)) == 0)) + McDevIf_AddPacket(MCDRV_PACKET_TYPE_EVTWAIT + | MCDRV_EVT_ALLMUTE, + 0); + + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_ANA, MCI_AP_DA0); + bRegAPDA0 = bReg | + (psPowerInfo->abAnalog[1] & psPowerUpdate->abAnalog[1]); + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_ANA, MCI_AP_DA1); + bRegAPDA1 = bReg | + (psPowerInfo->abAnalog[2] & psPowerUpdate->abAnalog[2]); + if (McResCtrl_GetAPMode() == eMCDRV_APM_OFF) { + /* AP_DA0/AP_DA1 */ + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_AP_DA0, + bRegAPDA0); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_AP_DA1, + bRegAPDA1); + } else { + McResCtrl_SetRegVal(MCDRV_PACKET_REGTYPE_ANA, + MCI_AP_DA0, bRegAPDA0); + McResCtrl_SetRegVal(MCDRV_PACKET_REGTYPE_ANA, + MCI_AP_DA1, bRegAPDA1); + } + + /* AP_MC/AP_MB */ + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_ANA, MCI_AP_MIC); + bReg |= (psPowerInfo->abAnalog[3] & psPowerUpdate->abAnalog[3]); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_AP_MIC, + bReg); + + /* AP_LI/AP_AD */ + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_ANA, MCI_AP_AD); + bReg |= (psPowerInfo->abAnalog[4] & psPowerUpdate->abAnalog[4]); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_AP_AD, + bReg); + + if ((bUpdate & MCDRV_POWINFO_D_PC_CLK_PD) != 0UL) { + if ((bRegPD&MCB_PC_CLK_PD) == 0) { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_ECDSP, + 0); + sdRet = McDevIf_ExecutePacket(); + if (sdRet != MCDRV_SUCCESS) + goto exit; + McCdsp_Term(); + bRegPD |= MCB_PC_CLK_PD; + } + bRST |= MCB_RST_C; + bPSW |= MCB_PSW_C; + } + + if ((bUpdate & MCDRV_POWINFO_D_PF_CLK_PD) != 0UL) { + if ((bRegPD&MCB_PF_CLK_PD) == 0) { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_IESERR, + 0); + sdRet = McDevIf_ExecutePacket(); + if (sdRet != MCDRV_SUCCESS) + goto exit; + McFdsp_Term(); + bRegPD |= MCB_PF_CLK_PD; + } + bRST |= MCB_RST_F; + bPSW |= MCB_PSW_F; + } + + if (((bUpdate & MCDRV_POWINFO_D_PE_CLK_PD) != 0UL) + && ((bRegPD&MCB_PE_CLK_PD) == 0)) { + sdRet = McDevIf_ExecutePacket(); + if (sdRet != MCDRV_SUCCESS) + goto exit; + McEdsp_Term(); + bRegPD |= MCB_PE_CLK_PD; + } + + if (((bUpdate & MCDRV_POWINFO_D_PB_CLK_PD) != 0UL) + && ((bRegPD&MCB_PB_CLK_PD) == 0)) { + sdRet = McDevIf_ExecutePacket(); + if (sdRet != MCDRV_SUCCESS) + goto exit; + McBdsp_Term(); + bRegPD |= MCB_PB_CLK_PD; + } + + if ((bUpdate & MCDRV_POWINFO_D_PM_CLK_PD) != 0UL) { + if ((bRegPD&MCB_PM_CLK_PD) == 0) { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MA + | (UINT32)MCI_DSP_START, + 0); + bRegPD |= MCB_PM_CLK_PD; + } + bRST |= MCB_RST_M; + bPSW |= MCB_PSW_M; + } + + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_PD, + bRegPD); + + bRegRst |= bRST; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_RST, + bRegRst); + bRegRst |= bPSW; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_RST, + bRegRst); + + /* Analog Power Save */ + bAP = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_ANA, MCI_AP); + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_CD, MCI_HSDETEN); + if (((psPowerUpdate->abAnalog[0] & MCB_AP_LDOA) != 0) + && ((psPowerInfo->abAnalog[0] & MCB_AP_LDOA) != 0) + && ((bAP & MCB_AP_LDOA) == 0)) { + if ((bReg & MCB_MKDETEN) != 0) { + bMKDetEn = bReg & MCB_MKDETEN; + /* MKDETEN */ + bReg &= (UINT8)~MCB_MKDETEN; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_CD + | (UINT32)MCI_HSDETEN, + bReg); + } + if ((bRegPD&MCB_ANACLK_PD) == 0) { + if (McDevProf_GetDevId() != eMCDRV_DEV_ID_80_90H) { + ; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_EVTWAIT + | MCDRV_EVT_AP_CP_A_SET + | ((UINT32)91 << 8) + | (UINT32)0x02, + 0); + } + /* ANACLK_PD */ + bRegPD |= MCB_ANACLK_PD; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_PD, + bRegPD); + } + } else if (((bUpdate & MCDRV_POWINFO_D_PLL_PD) != 0UL) + && ((bRegPD&MCB_PLL_PD) == 0) + && ((bAP & MCB_AP_LDOA) == 0)) { + if (McDevProf_GetDevId() != eMCDRV_DEV_ID_80_90H) { + ; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_EVTWAIT + | MCDRV_EVT_AP_CP_A_SET + | ((UINT32)91 << 8) + | (UINT32)0x02, + 0); + } + /* ANACLK_PD */ + bRegPD |= MCB_ANACLK_PD; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_PD, + bRegPD); + } + + /* DP_ADC/DP_DAC* */ + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_CD, MCI_DP); + if ((psPowerUpdate->abAnalog[1] & (MCB_AP_DA0R|MCB_AP_DA0L)) != 0) + if (((psPowerInfo->abAnalog[1] & MCB_AP_DA0R) != 0) + && ((psPowerInfo->abAnalog[1] & MCB_AP_DA0L) != 0)) + bReg |= MCB_DP_DAC0; + if ((psPowerUpdate->abAnalog[1] & (MCB_AP_DA1R|MCB_AP_DA1L)) != 0) { + if (((psPowerInfo->abAnalog[2] & MCB_AP_DA1R) != 0) + && ((psPowerInfo->abAnalog[2] & MCB_AP_DA1L) != 0)) { + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H) { + bReg |= MCB_DP_DAC1; + } else { + if ((bReg&MCB_DP_DAC0) != 0) + bReg |= MCB_DP_DAC1; + } + } + } + if ((psPowerUpdate->abAnalog[4] & (MCB_AP_ADM|MCB_AP_ADR|MCB_AP_ADL)) + != 0) { + ; + if (((psPowerInfo->abAnalog[4] & MCB_AP_ADM) != 0) + && ((psPowerInfo->abAnalog[4] & MCB_AP_ADR) != 0) + && ((psPowerInfo->abAnalog[4] & MCB_AP_ADL) != 0) + && ((bRegAPDA1 + &(MCB_AP_SPR2|MCB_AP_SPR1|MCB_AP_SPL2|MCB_AP_SPL1)) + == (MCB_AP_SPR2|MCB_AP_SPR1|MCB_AP_SPL2|MCB_AP_SPL1))) + bReg |= (MCB_DP_ADC|MCB_DP_PDMADC); + } + if ((bReg&(MCB_DP_DAC0|MCB_DP_DAC1)) == (MCB_DP_DAC0|MCB_DP_DAC1)) { + bReg |= MCB_DP_PDMDAC; + if ((bReg&MCB_DP_PDMADC) != 0) + bReg = MCI_DP_DEF; + } + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_CD + | (UINT32)MCI_DP, + bReg); + AddDacStop(); + + if (MCDRV_POWMODE_FULL == sInitInfo.bPowerMode) { + if (((bUpdate & MCDRV_POWINFO_D_PLL_PD) != 0UL) + && ((bRegPD&MCB_PLL_PD) == 0)) { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_IRQ, + 0); + bRegPD |= MCB_VCOOUT_PD; + bRegPD |= MCB_PLL_PD; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_PD, + bRegPD); + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_A, + MCI_CLK_MSK); + if ((bReg&MCB_RTCI_MSK) == 0) { + bReg = McResCtrl_GetRegVal( + MCDRV_PACKET_REGTYPE_CD, + MCI_CKSEL); + if (McDevProf_GetDevId() + == eMCDRV_DEV_ID_80_90H) { + ; + bReg |= MCB_HSDET; + } else { + bReg |= MCB_CRTC; + } + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_CD + | (UINT32)MCI_CKSEL, + bReg); + } + sdRet = McDevIf_ExecutePacket(); + if (sdRet != MCDRV_SUCCESS) + goto exit; + /* Clock Stop */ + McSrv_ClockStop(); + /* RST_A */ + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_RST_A, + MCI_RST_A_DEF); + McResCtrl_InitABlockReg(); + } + if (sInit2Info.bOption[19] == 0) { + ; + if ((bRegPD&MCB_PLL_PD) != 0) { + ; + bAP |= MCB_AP_LDOD; + } + } + } + + if (((psPowerUpdate->abAnalog[0] & MCB_AP_LDOA) != 0) + && ((psPowerInfo->abAnalog[0] & MCB_AP_LDOA) != 0) + && ((bAP & MCB_AP_LDOA) == 0)) { + bAddMKDetEn = bMKDetEn; + bAP |= (MCB_AP_LDOA|MCB_AP_VR); + } else + bAddMKDetEn = 0; + + if (((psPowerUpdate->abAnalog[0] & MCB_AP_HPDET) != 0) + && ((psPowerInfo->abAnalog[0] & MCB_AP_HPDET) != 0)) + bAP |= MCB_AP_HPDET; + + if ((McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H) + || (McDevProf_GetDevId() == eMCDRV_DEV_ID_81_91H)) { + if ((bAP & (MCB_AP_LDOA|MCB_AP_LDOD)) == + (MCB_AP_LDOA|MCB_AP_LDOD) + && ((bAP & MCB_AP_BGR) == 0) + && ((bPlugDetDB&MCB_RPLUGDET_DB) == 0)) { + if (McDevProf_GetDevId() != eMCDRV_DEV_ID_80_90H) { + bReg = sInitInfo.bHpHiz<<6 + | sInitInfo.bSpHiz<<4 + | sInitInfo.bRcHiz<<3 + | sInit2Info.bOption[2]; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_HIZ, + bReg); + bReg = sInitInfo.bLineOut2Hiz<<6 + | sInitInfo.bLineOut1Hiz<<4; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_LO_HIZ, + bReg); + } + bAP |= MCB_AP_BGR; + } + } else { + if ((bAP & (MCB_AP_LDOA|MCB_AP_LDOD)) == + (MCB_AP_LDOA|MCB_AP_LDOD)) { + bAP |= MCB_AP_BGR; + if ((bPlugDetDB&MCB_RPLUGDET_DB) == 0) { + bReg = sInitInfo.bHpHiz<<6 + | sInitInfo.bSpHiz<<4 + | sInitInfo.bRcHiz<<3 + | sInit2Info.bOption[2]; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_HIZ, + bReg); + } + } + } + + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_ANA, MCI_AP); + if (McResCtrl_GetAPMode() == eMCDRV_APM_OFF) { + if (((psPowerUpdate->abAnalog[0] & MCB_AP_CP) != 0) + && ((psPowerInfo->abAnalog[0] & MCB_AP_CP) != 0)) + bAP |= MCB_AP_CP; + if (((bAP&MCB_AP_CP) != 0) + && ((bReg&MCB_AP_CP) == 0)) { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_EVTWAIT + | MCDRV_EVT_ANA_RDY + | ((UINT32)MCI_RDY1 << 8) + | (UINT32)MCB_CPPDRDY, + 0); + bReg |= MCB_AP_CP; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_AP, + bReg); + } + } + + if (((bAP&MCB_AP_HPDET) != 0) + && ((bReg&MCB_AP_HPDET) == 0)) { + bReg |= MCB_AP_HPDET; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_AP, + bReg); + } + if (((bAP&MCB_AP_LDOA) != 0) + && ((bReg&MCB_AP_LDOA) == 0)) { + bReg |= MCB_AP_LDOA; + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H) + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_AP, + bReg); + bReg |= MCB_AP_VR; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_AP, + bReg); + } + if (((bAP&MCB_AP_LDOD) != 0) + && ((bReg&MCB_AP_LDOD) == 0)) { + bReg |= MCB_AP_LDOD; + if (((bAP&MCB_AP_BGR) != 0) + && ((bReg&MCB_AP_BGR) == 0) + && (bMKDetEn == 0)) + bReg |= MCB_AP_BGR; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_AP, + bReg); + } + if (((bReg&MCB_AP_LDOA) != 0) + && ((bReg&MCB_AP_LDOD) != 0) + && ((bAP&MCB_AP_BGR) != 0) + && ((bReg&MCB_AP_BGR) == 0) + && ((bPlugDetDB&MCB_RPLUGDET_DB) == 0)) + bReg |= MCB_AP_BGR; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_AP, + bReg); + + if (bAddMKDetEn != 0) { + sdRet = McDevIf_ExecutePacket(); + if (sdRet != MCDRV_SUCCESS) + goto exit; + McPacket_AddMKDetEnable(0); + } + +exit: +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McPacket_AddPowerDown", &sdRet); +#endif + return sdRet; +} + +/**************************************************************************** + * McPacket_AddPathSet + * + * Description: + * Add path update packet. + * Arguments: + * none + * Return: + * none + * + ****************************************************************************/ +void McPacket_AddPathSet( + void +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McPacket_AddPathSet"); +#endif + + if ((McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_IF, MCI_RST_A) & + MCB_RST_A) == 0) { + /* DI Pad */ + AddDIPad(); + /* PAD(PDM) */ + AddPAD(); + /* Digital Mixer Source */ + AddSource(); + /* Analog Mixer Source */ + AddMixSet(); + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McPacket_AddPathSet", NULL); +#endif +} + +/**************************************************************************** + * AddDIPad + * + * Description: + * Add DI Pad setup packet. + * Arguments: + * none + * Return: + * none + * + ****************************************************************************/ +static void AddDIPad( + void +) +{ + UINT8 bReg; + UINT8 bIsUsedDIR = 0, + bIsUsedDIT = 0; + UINT8 bLPort; + struct MCDRV_INIT_INFO sInitInfo; + struct MCDRV_PATH_INFO sPathInfo; + struct MCDRV_DIO_INFO sDioInfo; + struct MCDRV_AEC_INFO sAecInfo; + struct MCDRV_DIOPATH_INFO sDioPathInfo; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("AddDIPad"); +#endif + + McResCtrl_GetInitInfo(&sInitInfo, NULL); + McResCtrl_GetPathInfo(&sPathInfo); + McResCtrl_GetDioInfo(&sDioInfo); + McResCtrl_GetAecInfo(&sAecInfo); + McResCtrl_GetDioPathInfo(&sDioPathInfo); + + bReg = 0; + GetDIState(MCDRV_PHYSPORT_DIO0, &bIsUsedDIR, &bIsUsedDIT, &bLPort); + if (bIsUsedDIR == 0) + bReg |= MCB_SDIN0_MSK; + if (bIsUsedDIT == 0) { + if (sInitInfo.bDio0SdoHiz == MCDRV_DAHIZ_LOW) + bReg |= MCB_SDO0_DDR; + } else { + bReg |= MCB_SDO0_DDR; + } + if ((bIsUsedDIR == 0) && (bIsUsedDIT == 0)) { + bReg |= MCB_BCLK0_MSK; + bReg |= MCB_LRCK0_MSK; + if (sInitInfo.bDio0ClkHiz == MCDRV_DAHIZ_LOW) { + bReg |= MCB_BCLK0_DDR; + bReg |= MCB_LRCK0_DDR; + } + } else if ((sDioPathInfo.abPhysPort[0] == MCDRV_PHYSPORT_SLIM0) + || (sDioPathInfo.abPhysPort[1] == MCDRV_PHYSPORT_SLIM0) + || (sDioPathInfo.abPhysPort[2] == MCDRV_PHYSPORT_SLIM0) + || (sDioPathInfo.abPhysPort[3] == MCDRV_PHYSPORT_SLIM0) + || (bLPort == 3) + || ((bLPort <= 2) + && (sDioInfo.asPortInfo[bLPort].sDioCommon.bMasterSlave + == MCDRV_DIO_MASTER))) { + bReg |= MCB_BCLK0_DDR; + bReg |= MCB_LRCK0_DDR; + } + if ((bLPort <= 3) + && (sDioInfo.asPortInfo[bLPort].sDioCommon.bBckInvert + == MCDRV_BCLK_INVERT)) + bReg |= MCB_BCLK0_INV; + if ((sInitInfo.bPowerMode != MCDRV_POWMODE_CDSPDEBUG) + && (sAecInfo.sAecVBox.sAecCDspDbg.bJtagOn != 1)) { + ; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_DO0_DRV, + bReg); + } + + bReg = 0; + GetDIState(MCDRV_PHYSPORT_DIO1, &bIsUsedDIR, &bIsUsedDIT, &bLPort); + if (bIsUsedDIR == 0) + bReg |= MCB_SDIN1_MSK; + if (bIsUsedDIT == 0) { + if (sInitInfo.bDio1SdoHiz == MCDRV_DAHIZ_LOW) + bReg |= MCB_SDO1_DDR; + } else { + bReg |= MCB_SDO1_DDR; + } + if ((bIsUsedDIR == 0) && (bIsUsedDIT == 0)) { + bReg |= MCB_BCLK1_MSK; + bReg |= MCB_LRCK1_MSK; + if (sInitInfo.bDio1ClkHiz == MCDRV_DAHIZ_LOW) { + bReg |= MCB_BCLK1_DDR; + bReg |= MCB_LRCK1_DDR; + } + } else if ((sDioPathInfo.abPhysPort[0] == MCDRV_PHYSPORT_SLIM1) + || (sDioPathInfo.abPhysPort[1] == MCDRV_PHYSPORT_SLIM1) + || (sDioPathInfo.abPhysPort[2] == MCDRV_PHYSPORT_SLIM1) + || (sDioPathInfo.abPhysPort[3] == MCDRV_PHYSPORT_SLIM1) + || (bLPort == 3) + || ((bLPort <= 2) + && (sDioInfo.asPortInfo[bLPort].sDioCommon.bMasterSlave + == MCDRV_DIO_MASTER))) { + bReg |= MCB_BCLK1_DDR; + bReg |= MCB_LRCK1_DDR; + } + if ((bLPort <= 3) + && (sDioInfo.asPortInfo[bLPort].sDioCommon.bBckInvert + == MCDRV_BCLK_INVERT)) + bReg |= MCB_BCLK1_INV; + if ((sInitInfo.bPowerMode != MCDRV_POWMODE_CDSPDEBUG) + && (sAecInfo.sAecVBox.sAecCDspDbg.bJtagOn != 1)) { + ; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_DO1_DRV, + bReg); + } + + bReg = 0; + GetDIState(MCDRV_PHYSPORT_DIO2, &bIsUsedDIR, &bIsUsedDIT, &bLPort); + if (bIsUsedDIR == 0) + bReg |= MCB_SDIN2_MSK; + if (bIsUsedDIT == 0) { + if (sInitInfo.bDio2SdoHiz == MCDRV_DAHIZ_LOW) + bReg |= MCB_SDO2_DDR; + } else { + bReg |= MCB_SDO2_DDR; + } + if ((bIsUsedDIR == 0) + && (bIsUsedDIT == 0) + && (McResCtrl_IsD1SrcUsed(MCDRV_D1SRC_VBOXOUT_ON) == 0) + && (McResCtrl_HasSrc(eMCDRV_DST_VBOXMIXIN, eMCDRV_DST_CH0) == 0) + && (McResCtrl_HasSrc(eMCDRV_DST_VBOXMIXIN, eMCDRV_DST_CH1) == 0)) { + bReg |= MCB_BCLK2_MSK; + bReg |= MCB_LRCK2_MSK; + if (sInitInfo.bDio2ClkHiz == MCDRV_DAHIZ_LOW) { + bReg |= MCB_BCLK2_DDR; + bReg |= MCB_LRCK2_DDR; + } + } else if ((sDioPathInfo.abPhysPort[0] == MCDRV_PHYSPORT_SLIM2) + || (sDioPathInfo.abPhysPort[1] == MCDRV_PHYSPORT_SLIM2) + || (sDioPathInfo.abPhysPort[2] == MCDRV_PHYSPORT_SLIM2) + || (sDioPathInfo.abPhysPort[3] == MCDRV_PHYSPORT_SLIM2) + || (bLPort == 3) + || ((bLPort <= 2) + && (sDioInfo.asPortInfo[bLPort].sDioCommon.bMasterSlave + == MCDRV_DIO_MASTER))) { + bReg |= MCB_BCLK2_DDR; + bReg |= MCB_LRCK2_DDR; + } + if ((bLPort <= 3) + && (sDioInfo.asPortInfo[bLPort].sDioCommon.bBckInvert + == MCDRV_BCLK_INVERT)) + bReg |= MCB_BCLK2_INV; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_DO2_DRV, + bReg); + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("AddDIPad", 0); +#endif +} + +/**************************************************************************** + * GetDIState + * + * Description: + * Get DI Pad state. + * Arguments: + * bPhysPort Physical Port + * pbIsUsedDIR DI Rx State + * pbIsUsedDIT DI Tx State + * pbLPort Logical PortID + * Return: + * none + * + ****************************************************************************/ +static void GetDIState +( + UINT8 bPhysPort, + UINT8 *pbIsUsedDIR, + UINT8 *pbIsUsedDIT, + UINT8 *pbLPort +) +{ + struct MCDRV_DIOPATH_INFO sDioPathInfo; + +#if (MCDRV_DEBUG_LEVEL >= 4) + SINT32 sdRet; + McDebugLog_FuncIn("GetDIState"); +#endif + + McResCtrl_GetDioPathInfo(&sDioPathInfo); + + *pbIsUsedDIR = 0; + *pbIsUsedDIT = 0; + *pbLPort = 0xFF; + + if (sDioPathInfo.abPhysPort[0] == bPhysPort) { + if (McResCtrl_IsD1SrcUsed(MCDRV_D1SRC_MUSICIN_ON) == 0) { + ; + } else { + *pbIsUsedDIR = 1; + *pbLPort = 0; + } + if ((McResCtrl_HasSrc(eMCDRV_DST_MUSICOUT, eMCDRV_DST_CH0) + == 0) + && (McResCtrl_HasSrc(eMCDRV_DST_MUSICOUT, eMCDRV_DST_CH1) + == 0)) { + ; + } else { + *pbIsUsedDIT = 1; + *pbLPort = 0; + } + } + if (sDioPathInfo.abPhysPort[1] == bPhysPort) { + if (McResCtrl_IsD1SrcUsed(MCDRV_D1SRC_EXTIN_ON) == 0) { + ; + } else { + *pbIsUsedDIR = 1; + *pbLPort = 1; + } + if ((McResCtrl_HasSrc(eMCDRV_DST_EXTOUT, eMCDRV_DST_CH0) + == 0) + && (McResCtrl_HasSrc(eMCDRV_DST_EXTOUT, eMCDRV_DST_CH1) + == 0)) { + ; + } else { + *pbIsUsedDIT = 1; + *pbLPort = 1; + } + } + if (sDioPathInfo.abPhysPort[2] == bPhysPort) { + if ((McResCtrl_HasSrc(eMCDRV_DST_VBOXIOIN, eMCDRV_DST_CH0) + == 0) + && (McResCtrl_HasSrc(eMCDRV_DST_VBOXHOSTIN, eMCDRV_DST_CH0) + == 0)) { + ; + } else { + *pbIsUsedDIR = 1; + *pbLPort = 2; + } + if (McResCtrl_HasSrc(eMCDRV_DST_VOICEOUT, eMCDRV_DST_CH0) + == 0) { + ; + } else { + *pbIsUsedDIT = 1; + *pbLPort = 2; + } + } + if (sDioPathInfo.abPhysPort[3] == bPhysPort) { + if (McResCtrl_IsD1SrcUsed(MCDRV_D1SRC_HIFIIN_ON) == 0) { + ; + } else { + *pbIsUsedDIR = 1; + *pbLPort = 3; + } + if (McResCtrl_HasSrc(eMCDRV_DST_HIFIOUT, eMCDRV_DST_CH0) + == 0) { + ; + } else { + *pbIsUsedDIT = 1; + *pbLPort = 3; + } + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + sdRet = *pbIsUsedDIT<<8 | *pbIsUsedDIR; + McDebugLog_FuncOut("GetDIState", &sdRet); +#endif +} + +/**************************************************************************** + * GetLPort + * + * Description: + * Get Logical Port ID. + * Arguments: + * bPhysPort Physical Port + * Return: + * Logical Port ID + * + ****************************************************************************/ +static UINT8 GetLPort( + UINT8 bPhysPort +) +{ + UINT8 bIsUsedDIR, bIsUsedDIT; + UINT8 bLPort = 0xFF; + +#if (MCDRV_DEBUG_LEVEL >= 4) + SINT32 sdRet; + McDebugLog_FuncIn("GetLPort"); +#endif + + GetDIState(bPhysPort, &bIsUsedDIR, &bIsUsedDIT, &bLPort); + +#if (MCDRV_DEBUG_LEVEL >= 4) + sdRet = bLPort; + McDebugLog_FuncOut("GetLPort", &sdRet); +#endif + return bLPort; +} + +/**************************************************************************** + * AddPAD + * + * Description: + * Add PAD setup packet. + * Arguments: + * none + * Return: + * none + * + ****************************************************************************/ +static void AddPAD( + void +) +{ + UINT8 bReg; + UINT32 dHifiSrc; + struct MCDRV_INIT_INFO sInitInfo; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("AddPAD"); +#endif + + McResCtrl_GetInitInfo(&sInitInfo, NULL); + + dHifiSrc = + McResCtrl_GetSource(eMCDRV_DST_HIFIOUT, eMCDRV_DST_CH0); + + if ((McResCtrl_IsD2SrcUsed(MCDRV_D2SRC_PDM0_L_ON) == 0) + && (McResCtrl_IsD2SrcUsed(MCDRV_D2SRC_PDM0_R_ON) == 0) + && (McResCtrl_IsD2SrcUsed(MCDRV_D2SRC_PDM1_L_ON) == 0) + && (McResCtrl_IsD2SrcUsed(MCDRV_D2SRC_PDM1_R_ON) == 0) + && ((dHifiSrc & (MCDRV_D2SRC_PDM0_L_ON|MCDRV_D2SRC_PDM0_R_ON)) == 0) + && ((dHifiSrc & (MCDRV_D2SRC_PDM1_L_ON|MCDRV_D2SRC_PDM1_R_ON)) == 0)) { + if (sInitInfo.bPa0Func == MCDRV_PA_PDMCK) { + bReg = + McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_A, MCI_PA0); + bReg |= MCB_PA0_MSK; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_PA0, + bReg); + } + } + if (sInitInfo.bPa1Func == MCDRV_PA_PDMDI) { + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_A, MCI_PA1); + if ((McResCtrl_IsD2SrcUsed(MCDRV_D2SRC_PDM0_L_ON) == 0) + && (McResCtrl_IsD2SrcUsed(MCDRV_D2SRC_PDM0_R_ON) == 0) + && ((dHifiSrc & (MCDRV_D2SRC_PDM0_L_ON|MCDRV_D2SRC_PDM0_R_ON)) + == 0)) { + ; + bReg |= MCB_PA1_MSK; + } else { + bReg &= (UINT8)~MCB_PA1_MSK; + } + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_PA1, + bReg); + } + if (sInitInfo.bPa2Func == MCDRV_PA_PDMDI) { + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_A, MCI_PA2); + if ((McResCtrl_IsD2SrcUsed(MCDRV_D2SRC_PDM1_L_ON) == 0) + && (McResCtrl_IsD2SrcUsed(MCDRV_D2SRC_PDM1_R_ON) == 0) + && ((dHifiSrc & (MCDRV_D2SRC_PDM1_L_ON|MCDRV_D2SRC_PDM1_R_ON)) + == 0)) { + ; + bReg |= MCB_PA2_MSK; + } else { + bReg &= (UINT8)~MCB_PA2_MSK; + } + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_PA2, + bReg); + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("AddPAD", 0); +#endif +} + +/**************************************************************************** + * AddSource + * + * Description: + * Add source setup packet. + * Arguments: + * none + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR_TIMEOUT + * + ****************************************************************************/ +static void AddSource( + void +) +{ + UINT8 bReg; + UINT8 bDsf0PreInput, bDsf1PreInput, bDsf2PreInput; + UINT32 dHifiSrc; + UINT32 dSrc; + struct MCDRV_AEC_INFO sAecInfo; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("AddSource"); +#endif + + AddInMixSource(eMCDRV_DST_AE0, + MCI_IN0_MIX0, + MCI_IN0_MIX1, + MCB_IN0_MSEP); + AddInMixSource(eMCDRV_DST_AE1, + MCI_IN1_MIX0, + MCI_IN1_MIX1, + MCB_IN1_MSEP); + AddInMixSource(eMCDRV_DST_AE2, + MCI_IN2_MIX0, + MCI_IN2_MIX1, + MCB_IN2_MSEP); + AddInMixSource(eMCDRV_DST_AE3, + MCI_IN3_MIX0, + MCI_IN3_MIX1, + MCB_IN3_MSEP); + + AddOutMixSource(eMCDRV_DST_MUSICOUT, + MCI_OUT0_MIX0_10_8, + MCI_OUT0_MIX1_10_8, + MCB_OUT0_MSEP); + AddOutMixSource(eMCDRV_DST_EXTOUT, + MCI_OUT1_MIX0_10_8, + MCI_OUT1_MIX1_10_8, + MCB_OUT1_MSEP); + AddOut2MixSource(); + AddOutMixSource(eMCDRV_DST_DAC0, + MCI_OUT4_MIX0_10_8, + MCI_OUT4_MIX1_10_8, + MCB_OUT4_MSEP); + AddOutMixSource(eMCDRV_DST_DAC1, + MCI_OUT5_MIX0_10_8, + MCI_OUT5_MIX1_10_8, + MCB_OUT5_MSEP); + + McResCtrl_GetAecInfo(&sAecInfo); + + bDsf0PreInput = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_E, + MCI_DSF0_PRE_INPUT); + bDsf1PreInput = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_E, + MCI_DSF1_PRE_INPUT); + bDsf2PreInput = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_E, + MCI_DSF2_PRE_INPUT); + + dHifiSrc = + McResCtrl_GetSource(eMCDRV_DST_HIFIOUT, eMCDRV_DST_CH0); + + if ((McResCtrl_HasSrc(eMCDRV_DST_ADIF0, eMCDRV_DST_CH0) != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_ADIF0, eMCDRV_DST_CH1) != 0)) { + bReg = bDsf0PreInput; + dSrc = McResCtrl_GetSource(eMCDRV_DST_ADIF0, eMCDRV_DST_CH0); + if (dSrc != 0) { + bReg &= ~0x0F; + bReg |= GetPreInput(dSrc); + } + dSrc = McResCtrl_GetSource(eMCDRV_DST_ADIF0, eMCDRV_DST_CH1); + if (dSrc != 0) { + bReg &= ~0xF0; + bReg |= (UINT8)(GetPreInput(dSrc)<<4); + } + if (bReg != bDsf0PreInput) + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_DSF0_PRE_INPUT, + bReg); + } + + if ((McResCtrl_HasSrc(eMCDRV_DST_ADIF1, eMCDRV_DST_CH0) != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_ADIF1, eMCDRV_DST_CH1) != 0)) { + bReg = bDsf1PreInput; + dSrc = McResCtrl_GetSource(eMCDRV_DST_ADIF1, eMCDRV_DST_CH0); + if (dSrc != 0) { + bReg &= ~0x0F; + bReg |= GetPreInput(dSrc); + } + dSrc = McResCtrl_GetSource(eMCDRV_DST_ADIF1, eMCDRV_DST_CH1); + if (dSrc != 0) { + bReg &= ~0xF0; + bReg |= (UINT8)(GetPreInput(dSrc)<<4); + } + if (bReg != bDsf1PreInput) + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_DSF1_PRE_INPUT, + bReg); + } + + if ((McResCtrl_HasSrc(eMCDRV_DST_ADIF2, eMCDRV_DST_CH0) != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_ADIF2, eMCDRV_DST_CH1) != 0)) { + dSrc = McResCtrl_GetSource(eMCDRV_DST_ADIF2, eMCDRV_DST_CH0); + if ((dSrc != MCDRV_D2SRC_DAC0REF_ON) + && (dSrc != MCDRV_D2SRC_DAC1REF_ON)) { + bReg = bDsf2PreInput; + if (dSrc != 0) { + bReg &= ~0x0F; + bReg |= GetPreInput(dSrc); + } + dSrc = + McResCtrl_GetSource(eMCDRV_DST_ADIF2, eMCDRV_DST_CH1); + if (dSrc != 0) { + bReg &= ~0xF0; + bReg |= (UINT8)(GetPreInput(dSrc)<<4); + } + if (bReg != bDsf2PreInput) + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_DSF2_PRE_INPUT, + bReg); + } + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("AddSource", NULL); +#endif +} + +/**************************************************************************** + * GetPreInput + * + * Description: + * Get DSF*_PRE_INPUT register setting. + * Arguments: + * dSrc source info + * Return: + * register setting + * + ****************************************************************************/ +static UINT8 GetPreInput( + UINT32 dSrcOnOff +) +{ + UINT8 bReg = 0; + +#if (MCDRV_DEBUG_LEVEL >= 4) + SINT32 sdRet; + McDebugLog_FuncIn("GetPreInput"); +#endif + + switch (dSrcOnOff) { + case MCDRV_D2SRC_ADC0_L_ON: + bReg = DSF_PRE_INPUT_ADC_L; + break; + case MCDRV_D2SRC_ADC0_R_ON: + bReg = DSF_PRE_INPUT_ADC_R; + break; + case MCDRV_D2SRC_ADC1_ON: + bReg = DSF_PRE_INPUT_ADC_M; + break; + case MCDRV_D2SRC_PDM0_L_ON: + bReg = DSF_PRE_INPUT_PDM0_L; + break; + case MCDRV_D2SRC_PDM0_R_ON: + bReg = DSF_PRE_INPUT_PDM0_R; + break; + case MCDRV_D2SRC_PDM1_L_ON: + bReg = DSF_PRE_INPUT_PDM1_L; + break; + case MCDRV_D2SRC_PDM1_R_ON: + bReg = DSF_PRE_INPUT_PDM1_R; + break; + default: + break; + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + sdRet = (SINT32)bReg; + McDebugLog_FuncOut("GetPreInput", &sdRet); +#endif + return bReg; +} + +/**************************************************************************** + * AddInMixSource + * + * Description: + * Add INx_MIX source setup packet. + * Arguments: + * eDstType destination type + * bRegAddr0 IN*_MIX0 address + * bRegAddr1 IN*_MIX1 address + * bSep IN*_MSEP bit + * Return: + * none + * + ****************************************************************************/ +static void AddInMixSource( + enum MCDRV_DST_TYPE eDstType, + UINT8 bRegAddr0, + UINT8 bRegAddr1, + UINT8 bSep +) +{ + UINT32 dSrc; + UINT8 bReg0, bReg1, bCurReg0, bCurReg1; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("AddInMixSource"); +#endif + + bCurReg0 + = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_MA, bRegAddr0); + bCurReg0 &= (UINT8)~bSep; + bCurReg1 + = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_MA, bRegAddr1); + dSrc = McResCtrl_GetSource(eDstType, eMCDRV_DST_CH0); + bReg0 = GetInMixReg(dSrc); + dSrc = McResCtrl_GetSource(eDstType, eMCDRV_DST_CH1); + bReg1 = GetInMixReg(dSrc); + if ((bReg0 != bCurReg0) + || (bReg1 != bCurReg1)) { + if (bReg0 == bReg1) { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_MA + | (UINT32)bRegAddr0, + bReg0); + McResCtrl_SetRegVal(MCDRV_PACKET_REGTYPE_MA, + bRegAddr1, bReg1); + } else { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_MA + | (UINT32)bRegAddr0, + bReg0 | bSep); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_MA + | (UINT32)bRegAddr1, + bReg1); + } + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("AddInMixSource", NULL); +#endif +} + +/**************************************************************************** + * GetInMixReg + * + * Description: + * Get IN*_MIX register setting. + * Arguments: + * dSrc source info + * Return: + * IN*_MIX register setting + * + ****************************************************************************/ +static UINT8 GetInMixReg +( + UINT32 dSrcOnOff +) +{ + UINT8 bReg = 0; + +#if (MCDRV_DEBUG_LEVEL >= 4) + SINT32 sdRet; + McDebugLog_FuncIn("GetInMixReg"); +#endif + + if ((dSrcOnOff & MCDRV_D1SRC_MUSICIN_ON) != 0) + bReg |= IN_MIX_DIFI_0; + + if ((dSrcOnOff & MCDRV_D1SRC_EXTIN_ON) != 0) + bReg |= IN_MIX_DIFI_1; + + if ((dSrcOnOff & MCDRV_D1SRC_VBOXOUT_ON) != 0) + bReg |= IN_MIX_DIFI_2; + + if ((dSrcOnOff & MCDRV_D1SRC_VBOXREFOUT_ON) != 0) + bReg |= IN_MIX_DIFI_3; + + if ((dSrcOnOff & MCDRV_D1SRC_ADIF0_ON) != 0) + bReg |= IN_MIX_ADI_0; + + if ((dSrcOnOff & MCDRV_D1SRC_ADIF1_ON) != 0) + bReg |= IN_MIX_ADI_1; + + if ((dSrcOnOff & MCDRV_D1SRC_ADIF2_ON) != 0) + bReg |= IN_MIX_ADI_2; + +#if (MCDRV_DEBUG_LEVEL >= 4) + sdRet = (SINT32)bReg; + McDebugLog_FuncOut("GetInMixReg", &sdRet); +#endif + return bReg; +} + +/**************************************************************************** + * AddOutMixSource + * + * Description: + * Add OUTx_MIX source setup packet. + * Arguments: + * eDstType destination type + * bRegAddr0 IN*_MIX0 address + * bRegAddr1 IN*_MIX1 address + * bSep IN*_MSEP bit + * Return: + * none + * + ****************************************************************************/ +static void AddOutMixSource( + enum MCDRV_DST_TYPE eDstType, + UINT8 bRegAddr0, + UINT8 bRegAddr1, + UINT8 bSep +) +{ + UINT32 dSrc; + UINT16 wReg0, wReg1, wCurReg0, wCurReg1; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("AddOutMixSource"); +#endif + + wCurReg0 + = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_MA, bRegAddr0)<<8 + | McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_MA, bRegAddr0+1); + wCurReg0 &= ~(bSep<<8); + wCurReg1 + = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_MA, bRegAddr1)<<8 + | McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_MA, bRegAddr1+1); + dSrc = McResCtrl_GetSource(eDstType, eMCDRV_DST_CH0); + wReg0 = GetOutMixReg(dSrc); + dSrc = McResCtrl_GetSource(eDstType, eMCDRV_DST_CH1); + wReg1 = GetOutMixReg(dSrc); + if ((wReg0 != wCurReg0) + || (wReg1 != wCurReg1)) { + if (wReg0 == wReg1) { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_MA + | (UINT32)bRegAddr0, + (UINT8)(wReg0>>8)); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_MA + | ((UINT32)bRegAddr0+1), + (UINT8)wReg0); + McResCtrl_SetRegVal(MCDRV_PACKET_REGTYPE_MA, + bRegAddr1, (UINT8)(wReg1>>8)); + McResCtrl_SetRegVal(MCDRV_PACKET_REGTYPE_MA, + bRegAddr1+1, (UINT8)wReg1); + } else { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_MA + | (UINT32)bRegAddr0, + (UINT8)(wReg0>>8) | bSep); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_MA + | ((UINT32)bRegAddr0+1), + (UINT8)wReg0); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_MA + | (UINT32)bRegAddr1, + (UINT8)(wReg1>>8)); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_MA + | ((UINT32)bRegAddr1+1), + (UINT8)wReg1); + } + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("AddOutMixSource", NULL); +#endif +} + +/**************************************************************************** + * AddOut2MixSource + * + * Description: + * Add OUT23_MIX source setup packet. + * Arguments: + * none + * Return: + * none + * + ****************************************************************************/ +static void AddOut2MixSource( + void +) +{ + UINT32 dSrc; + UINT16 wReg0, wReg1, wCurReg0, wCurReg1; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("AddOut2MixSource"); +#endif + + wCurReg0 + = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_MA, + MCI_OUT2_MIX0_10_8)<<8 + | McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_MA, + MCI_OUT2_MIX0_7_0); + wCurReg0 &= ~(MCB_OUT2_MSEP<<8); + wCurReg1 + = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_MA, + MCI_OUT2_MIX1_10_8)<<8 + | McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_MA, + MCI_OUT2_MIX1_7_0); + dSrc = McResCtrl_GetSource(eMCDRV_DST_VBOXMIXIN, eMCDRV_DST_CH0); + wReg0 = GetOutMixReg(dSrc); + dSrc = McResCtrl_GetSource(eMCDRV_DST_VBOXMIXIN, eMCDRV_DST_CH1); + wReg1 = GetOutMixReg(dSrc); + if ((wReg0 != wCurReg0) + || (wReg1 != wCurReg1)) { + if (wReg0 == wReg1) { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_MA + | (UINT32)MCI_OUT2_MIX0_10_8, + (UINT8)(wReg0>>8)); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_MA + | (UINT32)MCI_OUT2_MIX0_7_0, + (UINT8)wReg0); + McResCtrl_SetRegVal(MCDRV_PACKET_REGTYPE_MA, + MCI_OUT2_MIX1_10_8, (UINT8)(wReg1>>8)); + McResCtrl_SetRegVal(MCDRV_PACKET_REGTYPE_MA, + MCI_OUT2_MIX1_7_0, (UINT8)wReg1); + } else { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_MA + | (UINT32)MCI_OUT2_MIX0_10_8, + (UINT8)(wReg0>>8) | MCB_OUT2_MSEP); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_MA + | (UINT32)MCI_OUT2_MIX0_7_0, + (UINT8)wReg0); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_MA + | (UINT32)MCI_OUT2_MIX1_10_8, + (UINT8)(wReg1>>8)); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_MA + | (UINT32)MCI_OUT2_MIX1_7_0, + (UINT8)wReg1); + } + } + + wCurReg0 + = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_MA, + MCI_OUT3_MIX0_10_8)<<8 + | McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_MA, + MCI_OUT3_MIX0_7_0); + wCurReg0 &= ~(MCB_OUT3_MSEP<<8); + wCurReg1 + = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_MA, + MCI_OUT3_MIX1_10_8)<<8 + | McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_MA, + MCI_OUT3_MIX1_7_0); + dSrc = McResCtrl_GetSource(eMCDRV_DST_VBOXMIXIN, eMCDRV_DST_CH2); + wReg0 = GetOutMixReg(dSrc); + dSrc = McResCtrl_GetSource(eMCDRV_DST_VBOXMIXIN, eMCDRV_DST_CH3); + wReg1 = GetOutMixReg(dSrc); + if ((wReg0 != wCurReg0) + || (wReg1 != wCurReg1)) { + if (wReg0 == wReg1) { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_MA + | (UINT32)MCI_OUT3_MIX0_10_8, + (UINT8)(wReg0>>8)); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_MA + | (UINT32)MCI_OUT3_MIX0_7_0, + (UINT8)wReg0); + McResCtrl_SetRegVal(MCDRV_PACKET_REGTYPE_MA, + MCI_OUT3_MIX1_10_8, (UINT8)(wReg1>>8)); + McResCtrl_SetRegVal(MCDRV_PACKET_REGTYPE_MA, + MCI_OUT3_MIX1_7_0, (UINT8)wReg1); + } else { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_MA + | (UINT32)MCI_OUT3_MIX0_10_8, + (UINT8)(wReg0>>8) | MCB_OUT3_MSEP); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_MA + | (UINT32)MCI_OUT3_MIX0_7_0, + (UINT8)wReg0); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_MA + | (UINT32)MCI_OUT3_MIX1_10_8, + (UINT8)(wReg1>>8)); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_MA + | (UINT32)MCI_OUT3_MIX1_7_0, + (UINT8)wReg1); + } + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("AddOut2MixSource", NULL); +#endif +} + +/**************************************************************************** + * GetOutMixReg + * + * Description: + * Get OUT*_MIX register setting. + * Arguments: + * dSrcOnOff source info + * Return: + * OUT*_MIX register setting + * + ****************************************************************************/ +static UINT16 GetOutMixReg( + UINT32 dSrcOnOff +) +{ + UINT16 wReg = 0; + +#if (MCDRV_DEBUG_LEVEL >= 4) + SINT32 sdRet; + McDebugLog_FuncIn("GetOutMixReg"); +#endif + + if ((dSrcOnOff & MCDRV_D1SRC_MUSICIN_ON) != 0) + wReg |= OUT_MIX_DIFI_0; + + if ((dSrcOnOff & MCDRV_D1SRC_EXTIN_ON) != 0) + wReg |= OUT_MIX_DIFI_1; + + if ((dSrcOnOff & MCDRV_D1SRC_VBOXOUT_ON) != 0) + wReg |= OUT_MIX_DIFI_2; + + if ((dSrcOnOff & MCDRV_D1SRC_VBOXREFOUT_ON) != 0) + wReg |= OUT_MIX_DIFI_3; + + if ((dSrcOnOff & MCDRV_D1SRC_AE0_ON) != 0) + wReg |= OUT_MIX_AEO_0; + + if ((dSrcOnOff & MCDRV_D1SRC_AE1_ON) != 0) + wReg |= OUT_MIX_AEO_1; + + if ((dSrcOnOff & MCDRV_D1SRC_AE2_ON) != 0) + wReg |= OUT_MIX_AEO_2; + + if ((dSrcOnOff & MCDRV_D1SRC_AE3_ON) != 0) + wReg |= OUT_MIX_AEO_3; + + if ((dSrcOnOff & MCDRV_D1SRC_ADIF0_ON) != 0) + wReg |= OUT_MIX_ADI_0; + + if ((dSrcOnOff & MCDRV_D1SRC_ADIF1_ON) != 0) + wReg |= OUT_MIX_ADI_1; + + if ((dSrcOnOff & MCDRV_D1SRC_ADIF2_ON) != 0) + wReg |= OUT_MIX_ADI_2; + +#if (MCDRV_DEBUG_LEVEL >= 4) + sdRet = (SINT32)wReg; + McDebugLog_FuncOut("GetOutMixReg", &sdRet); +#endif + return wReg; +} + +/**************************************************************************** + * AddMixSet + * + * Description: + * Add analog mixer set packet. + * Arguments: + * none + * Return: + * MCDRV_SUCCESS + * + ****************************************************************************/ +static void AddMixSet( + void +) +{ + UINT8 bReg; + struct MCDRV_PATH_INFO sPathInfo; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("AddMixSet"); +#endif + + McResCtrl_GetPathInfo(&sPathInfo); + + /* ADL_MIX */ + bReg = GetMicMixBit(sPathInfo.asAdc0[0].dSrcOnOff); + if ((sPathInfo.asAdc0[0].dSrcOnOff & MCDRV_ASRC_LINEIN1_L_ON) != 0) + bReg |= MCB_AD_LIMIX; + if ((sPathInfo.asAdc0[0].dSrcOnOff & MCDRV_ASRC_LINEIN1_M_ON) != 0) + bReg |= (MCB_MONO_AD_LI|MCB_AD_LIMIX); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_ADL_MIX, + bReg); + + /* ADR_MIX */ + bReg = GetMicMixBit(sPathInfo.asAdc0[1].dSrcOnOff); + if ((sPathInfo.asAdc0[1].dSrcOnOff & MCDRV_ASRC_LINEIN1_R_ON) != 0) + bReg |= MCB_AD_LIMIX; + if ((sPathInfo.asAdc0[1].dSrcOnOff & MCDRV_ASRC_LINEIN1_M_ON) != 0) + bReg |= (MCB_MONO_AD_LI|MCB_AD_LIMIX); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_ADR_MIX, + bReg); + + /* ADM_MIX */ + bReg = GetMicMixBit(sPathInfo.asAdc1[0].dSrcOnOff); + if ((sPathInfo.asAdc1[0].dSrcOnOff & MCDRV_ASRC_LINEIN1_M_ON) != 0) + bReg |= MCB_AD_LIMIX; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_ADM_MIX, + bReg); + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("AddMixSet", NULL); +#endif +} + +/**************************************************************************** + * GetMicMixBit + * + * Description: + * Get mic mixer bit. + * Arguments: + * dSrcOnOff source info + * Return: + * mic mixer bit + * + ****************************************************************************/ +static UINT8 GetMicMixBit( + UINT32 dSrcOnOff +) +{ + UINT8 bMicMix = 0; + +#if (MCDRV_DEBUG_LEVEL >= 4) + SINT32 sdRet; + McDebugLog_FuncIn("GetMicMixBit"); +#endif + + if ((dSrcOnOff & MCDRV_ASRC_MIC1_ON) != 0) + bMicMix |= MCB_AD_M1MIX; + + if ((dSrcOnOff & MCDRV_ASRC_MIC2_ON) != 0) + bMicMix |= MCB_AD_M2MIX; + + if ((dSrcOnOff & MCDRV_ASRC_MIC3_ON) != 0) + bMicMix |= MCB_AD_M3MIX; + + if ((dSrcOnOff & MCDRV_ASRC_MIC4_ON) != 0) + bMicMix |= MCB_AD_M4MIX; + +#if (MCDRV_DEBUG_LEVEL >= 4) + sdRet = (SINT32)bMicMix; + McDebugLog_FuncOut("GetMicMixBit", &sdRet); +#endif + return bMicMix; +} + +/**************************************************************************** + * AddDacStop + * + * Description: + * Add DAC stop packet. + * Arguments: + * none + * Return: + * none + * + ****************************************************************************/ +static void AddDacStop( + void +) +{ + UINT8 bReg; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("AddDacStop"); +#endif + /* DAC Stop */ + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_E, + MCI_LPF_THR); + if ((McResCtrl_HasSrc(eMCDRV_DST_DAC0, eMCDRV_DST_CH0) == 0) + && (McResCtrl_HasSrc(eMCDRV_DST_DAC0, eMCDRV_DST_CH1) == 0)) + bReg &= (UINT8)~MCB_OSF0_ENB; + if ((McResCtrl_HasSrc(eMCDRV_DST_DAC1, eMCDRV_DST_CH0) == 0) + && (McResCtrl_HasSrc(eMCDRV_DST_DAC1, eMCDRV_DST_CH1) == 0)) + bReg &= (UINT8)~MCB_OSF1_ENB; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_LPF_THR, + bReg); + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("AddDacStop", 0); +#endif +} + +/**************************************************************************** + * GetLP2Start + * + * Description: + * Get LP2_START register value. + * Arguments: + * none + * Return: + * LP2_START register value + * + ****************************************************************************/ +static UINT8 GetLP2Start( + void +) +{ + UINT8 bStart = 0; + struct MCDRV_DIO_INFO sDioInfo; + struct MCDRV_AEC_INFO sAecInfo; + +#if (MCDRV_DEBUG_LEVEL >= 4) + SINT32 sdRet; + McDebugLog_FuncIn("GetLP2Start"); +#endif + McResCtrl_GetDioInfo(&sDioInfo); + McResCtrl_GetAecInfo(&sAecInfo); + + if (McResCtrl_HasSrc(eMCDRV_DST_VOICEOUT, eMCDRV_DST_CH0) != 0) { + if (sDioInfo.asPortInfo[2].sDioCommon.bMasterSlave + == MCDRV_DIO_MASTER) { + ; + bStart |= MCB_LP2_TIM_START; + } + bStart |= MCB_LPT2_START_SRC; + bStart |= MCB_LPT2_START; + } + if (McResCtrl_HasSrc(eMCDRV_DST_VBOXIOIN, eMCDRV_DST_CH0) != 0) { + if (sDioInfo.asPortInfo[2].sDioCommon.bMasterSlave + == MCDRV_DIO_MASTER) { + ; + bStart |= MCB_LP2_TIM_START; + } + bStart |= MCB_LPR2_START_SRC; + bStart |= MCB_LPR2_START; + } + if (bStart == 0) { /* LP2 not running */ + if ((McResCtrl_HasSrc(eMCDRV_DST_VBOXMIXIN, eMCDRV_DST_CH0) + != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_VBOXMIXIN, eMCDRV_DST_CH1) + != 0)) { + bStart |= MCB_LP2_TIM_START; + bStart |= MCB_LPT2_START_SRC; + bStart |= MCB_LPT2_START; + } + if (McResCtrl_IsD1SrcUsed(MCDRV_D1SRC_VBOXOUT_ON) != 0) { + bStart |= MCB_LP2_TIM_START; + bStart |= MCB_LPR2_START_SRC; + bStart |= MCB_LPR2_START; + } + } else { + if ((McResCtrl_HasSrc(eMCDRV_DST_VBOXMIXIN, eMCDRV_DST_CH0) + != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_VBOXMIXIN, eMCDRV_DST_CH1) + != 0)) { + bStart |= MCB_LPT2_START_SRC; + bStart |= MCB_LPT2_START; + } + if (McResCtrl_IsD1SrcUsed(MCDRV_D1SRC_VBOXOUT_ON) != 0) { + bStart |= MCB_LPR2_START_SRC; + bStart |= MCB_LPR2_START; + } + } + if (bStart == 0) { /* LP2 not running */ + if ((McResCtrl_HasSrc(eMCDRV_DST_VBOXMIXIN, eMCDRV_DST_CH2) + != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_VBOXMIXIN, eMCDRV_DST_CH3) + != 0) + || (McResCtrl_IsD1SrcUsed(MCDRV_D1SRC_VBOXREFOUT_ON) + != 0)) { + if ((sAecInfo.sAecVBox.bSrc3_Ctrl == 1) + || (sAecInfo.sAecVBox.bSrc3_Ctrl == 2)) { + ; + bStart |= MCB_LP2_TIM_START; + } + } + if ((McResCtrl_HasSrc(eMCDRV_DST_VBOXMIXIN, eMCDRV_DST_CH0) + != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_VBOXMIXIN, eMCDRV_DST_CH1) + != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_VBOXMIXIN, eMCDRV_DST_CH2) + != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_VBOXMIXIN, eMCDRV_DST_CH3) + != 0) + || (McResCtrl_IsD1SrcUsed(MCDRV_D1SRC_VBOXOUT_ON) + != 0) + || (McResCtrl_IsD1SrcUsed(MCDRV_D1SRC_VBOXREFOUT_ON) + != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_VBOXHOSTIN, eMCDRV_DST_CH0) + != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_HOSTOUT, eMCDRV_DST_CH0) + != 0)) { + if ((sAecInfo.sAecConfig.bFDspLocate != 0) + && (sAecInfo.sAecVBox.bFDspOnOff == 1)) { + ; + bStart |= MCB_LP2_TIM_START; + } + } + } + if ((McResCtrl_HasSrc(eMCDRV_DST_VBOXMIXIN, eMCDRV_DST_CH2) + != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_VBOXMIXIN, eMCDRV_DST_CH3) + != 0) + || (McResCtrl_IsD1SrcUsed(MCDRV_D1SRC_VBOXREFOUT_ON) + != 0)) { + if ((sAecInfo.sAecVBox.bSrc3_Ctrl == 1) + || (sAecInfo.sAecVBox.bSrc3_Ctrl == 2)) { + bStart |= MCB_LPT2_START_SRC; + bStart |= MCB_LPT2_START; + bStart |= MCB_LPR2_START_SRC; + bStart |= MCB_LPR2_START; + } + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + sdRet = bStart; + McDebugLog_FuncOut("GetLP2Start", &sdRet); +#endif + return bStart; +} + +/**************************************************************************** + * GetLP2Fs + * + * Description: + * Get LP2_FS register value. + * Arguments: + * bThru LP2_SRC_THRU register value + * Return: + * LP2_FS register value + * + ****************************************************************************/ +static UINT8 GetLP2Fs( + UINT8 *bThru +) +{ + UINT8 bFs = 0xFF; + struct MCDRV_DIO_INFO sDioInfo; + struct MCDRV_AEC_INFO sAecInfo; + +#if (MCDRV_DEBUG_LEVEL >= 4) + SINT32 sdRet; + McDebugLog_FuncIn("GetLP2Fs"); +#endif + + McResCtrl_GetDioInfo(&sDioInfo); + McResCtrl_GetAecInfo(&sAecInfo); + + *bThru = 0xFF; + + if ((McResCtrl_HasSrc(eMCDRV_DST_VOICEOUT, eMCDRV_DST_CH0) != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_VBOXIOIN, eMCDRV_DST_CH0) != 0)) { + /* LP2 running */ + *bThru = (sDioInfo.asPortInfo[2].sDioCommon.bSrcThru<<5); + bFs = sDioInfo.asPortInfo[2].sDioCommon.bFs; + } else { + if ((McResCtrl_HasSrc(eMCDRV_DST_VBOXMIXIN, + eMCDRV_DST_CH0) != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_VBOXMIXIN, + eMCDRV_DST_CH1) != 0) + || (McResCtrl_IsD1SrcUsed(MCDRV_D1SRC_VBOXOUT_ON) + != 0)) { + *bThru = (sAecInfo.sAecVBox.bSrc2_Thru<<5); + bFs = sAecInfo.sAecVBox.bSrc2_Fs; + } + } + if (sAecInfo.sAecVBox.bSrc3_Ctrl == 1) { + if (*bThru == 0xFF) { + *bThru = (sAecInfo.sAecVBox.bSrc2_Thru<<5); + bFs = sAecInfo.sAecVBox.bSrc2_Fs; + } + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + sdRet = bFs; + McDebugLog_FuncOut("GetLP2Fs", &sdRet); +#endif + return bFs; +} + +/**************************************************************************** + * McPacket_AddStop + * + * Description: + * Add stop packet. + * Arguments: + * none + * Return: + * none + * + ****************************************************************************/ +void McPacket_AddStop( + void +) +{ + UINT8 bReg, bCurReg; + UINT32 dHifiSrc; + UINT8 bDirect_Enb; + UINT32 dSrc; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McPacket_AddStop"); +#endif + + /* LP*_START */ + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_MB, MCI_LP0_START); + bCurReg = bReg; + if ((McResCtrl_HasSrc(eMCDRV_DST_MUSICOUT, eMCDRV_DST_CH0) == 0) + && (McResCtrl_HasSrc(eMCDRV_DST_MUSICOUT, eMCDRV_DST_CH1) == 0)) { + bReg &= (UINT8)~MCB_LPT0_START_SRC; + bReg &= (UINT8)~MCB_LPT0_START; + } + if ((McResCtrl_IsD1SrcUsed(MCDRV_D1SRC_MUSICIN_ON) == 0)) { + bReg &= (UINT8)~MCB_LPR0_START_SRC; + bReg &= (UINT8)~MCB_LPR0_START; + } + if ((bReg & 0x0F) == 0) + bReg = 0; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MB + | (UINT32)MCI_LP0_START, + bReg); + if ((bReg == 0) + && (bReg != bCurReg)) + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_LP0_FP, + MCDRV_PHYSPORT_NONE); + + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_MB, MCI_LP1_START); + bCurReg = bReg; + if ((McResCtrl_HasSrc(eMCDRV_DST_EXTOUT, eMCDRV_DST_CH0) == 0) + && (McResCtrl_HasSrc(eMCDRV_DST_EXTOUT, eMCDRV_DST_CH1) == 0)) { + bReg &= (UINT8)~MCB_LPT1_START_SRC; + bReg &= (UINT8)~MCB_LPT1_START; + } + if (McResCtrl_IsD1SrcUsed(MCDRV_D1SRC_EXTIN_ON) == 0) { + bReg &= (UINT8)~MCB_LPR1_START_SRC; + bReg &= (UINT8)~MCB_LPR1_START; + } + if ((bReg & 0x0F) == 0) + bReg = 0; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MB + | (UINT32)MCI_LP1_START, + bReg); + if ((bReg == 0) + && (bReg != bCurReg)) + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_LP1_FP, + MCDRV_PHYSPORT_NONE); + + bCurReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_MB, MCI_LP2_START); + bReg = bCurReg & GetLP2Start(); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MB + | (UINT32)MCI_LP2_START, + bReg); + if ((bReg == 0) + && (bReg != bCurReg)) + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_LP2_FP, + MCDRV_PHYSPORT_NONE); + + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_MB, MCI_SRC3_START); + if ((McResCtrl_HasSrc(eMCDRV_DST_VBOXMIXIN, eMCDRV_DST_CH2) == 0) + && (McResCtrl_HasSrc(eMCDRV_DST_VBOXMIXIN, eMCDRV_DST_CH3) == 0)) + bReg &= (UINT8)~MCB_OSRC3_START; + if (McResCtrl_IsD1SrcUsed(MCDRV_D1SRC_VBOXREFOUT_ON) == 0) + bReg &= (UINT8)~MCB_ISRC3_START; + if ((bReg & 0x0F) == 0) + bReg = 0; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MB + | (UINT32)MCI_SRC3_START, + bReg); + + bDirect_Enb = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_E, + MCI_DIRECTPATH_ENB); + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_MB, MCI_LP3_START); + if (McResCtrl_HasSrc(eMCDRV_DST_HIFIOUT, eMCDRV_DST_CH0) == 0) { + bReg &= (UINT8)~MCB_LPT3_START; + bDirect_Enb &= (UINT8)~MCB_DIRECT_ENB_ADC; + } + if (McResCtrl_IsD1SrcUsed(MCDRV_D1SRC_HIFIIN_ON) == 0) { + bReg &= (UINT8)~MCB_LPR3_START; + bDirect_Enb &= (UINT8)~(MCB_DIRECT_ENB_DAC1 + |MCB_DIRECT_ENB_DAC0); + } else { + dSrc = McResCtrl_GetSource(eMCDRV_DST_DAC0, eMCDRV_DST_CH0); + dSrc |= McResCtrl_GetSource(eMCDRV_DST_DAC0, eMCDRV_DST_CH1); + if ((dSrc & MCDRV_D1SRC_HIFIIN_ON) == 0) { + ; + bDirect_Enb &= (UINT8)~MCB_DIRECT_ENB_DAC0; + } + dSrc = McResCtrl_GetSource(eMCDRV_DST_DAC1, eMCDRV_DST_CH0); + dSrc |= McResCtrl_GetSource(eMCDRV_DST_DAC1, eMCDRV_DST_CH1); + if ((dSrc & MCDRV_D1SRC_HIFIIN_ON) == 0) { + ; + bDirect_Enb &= (UINT8)~MCB_DIRECT_ENB_DAC1; + } + } + if ((bReg & (MCB_LPT3_START|MCB_LPR3_START)) == 0) + bReg = 0; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MB + | (UINT32)MCI_LP3_START, + bReg); + if (bReg == 0) { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_DIRECTPATH_ENB, + 0); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_LP3_FP, + MCDRV_PHYSPORT_NONE); + } else { + if (McDevProf_GetDevId() != eMCDRV_DEV_ID_80_90H) { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_DIRECTPATH_ENB, + bDirect_Enb); + } + } + + /* ADC Stop */ + dHifiSrc = + McResCtrl_GetSource(eMCDRV_DST_HIFIOUT, eMCDRV_DST_CH0); + + if ((McResCtrl_HasSrc(eMCDRV_DST_ADIF0, eMCDRV_DST_CH0) == 0) + && (McResCtrl_HasSrc(eMCDRV_DST_ADIF0, eMCDRV_DST_CH1) == 0)) { + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_E, + MCI_DSF0_FLT_TYPE); + bReg &= ~MCB_DSF0ENB; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_DSF0_FLT_TYPE, + bReg); + } + + if ((McResCtrl_HasSrc(eMCDRV_DST_ADIF1, eMCDRV_DST_CH0) == 0) + && (McResCtrl_HasSrc(eMCDRV_DST_ADIF1, eMCDRV_DST_CH1) == 0)) { + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_E, + MCI_DSF1_FLT_TYPE); + bReg &= ~MCB_DSF1ENB; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_DSF1_FLT_TYPE, + bReg); + } + + if ((McResCtrl_HasSrc(eMCDRV_DST_ADIF2, eMCDRV_DST_CH0) == 0) + && (McResCtrl_HasSrc(eMCDRV_DST_ADIF2, eMCDRV_DST_CH1) == 0)) { + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_E, + MCI_DSF2_FLT_TYPE); + bReg &= ~MCB_DSF2ENB; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_DSF2_FLT_TYPE, + bReg); + } + + /* PDM Stop */ + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_E, + MCI_PDM_LOAD_TIM); + if ((McResCtrl_IsD2SrcUsed(MCDRV_D2SRC_PDM0_L_ON) == 0) + && (McResCtrl_IsD2SrcUsed(MCDRV_D2SRC_PDM0_R_ON) == 0) + && ((dHifiSrc & (MCDRV_D2SRC_PDM0_L_ON|MCDRV_D2SRC_PDM0_R_ON)) == 0)) + bReg &= (UINT8)~MCB_PDM0_START; + if ((McResCtrl_IsD2SrcUsed(MCDRV_D2SRC_PDM1_L_ON) == 0) + && (McResCtrl_IsD2SrcUsed(MCDRV_D2SRC_PDM1_R_ON) == 0) + && ((dHifiSrc & (MCDRV_D2SRC_PDM1_L_ON|MCDRV_D2SRC_PDM1_R_ON)) == 0)) + bReg &= (UINT8)~MCB_PDM1_START; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_PDM_LOAD_TIM, + bReg); + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McPacket_AddStop", NULL); +#endif +} + +/**************************************************************************** + * McPacket_AddDSPStartStop + * + * Description: + * Add DSP start/stop packet. + * Arguments: + * bStarted DSP has started + * Return: + * none + * + ****************************************************************************/ +void McPacket_AddDSPStartStop( + UINT8 bStarted +) +{ + UINT8 bStart = McResCtrl_GetDspStart(); + UINT8 bDFifoSel, bRFifoSel; + struct MCDRV_AEC_INFO sAecInfo; + struct MCDRV_DIO_INFO sDioInfo; + int i; + struct MCDRV_FDSP_MUTE sMute; + UINT8 bE1Command = 0; + UINT8 bReg; + UINT8 bLP2Fs; + UINT8 bThru; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McPacket_AddDSPStartStop"); +#endif + + McResCtrl_GetAecInfo(&sAecInfo); + + if ((bStart&MCDRV_DSP_START_E) != 0) { + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_E, + MCI_E1COMMAND); + if ((McResCtrl_HasSrc(eMCDRV_DST_DAC1, eMCDRV_DST_CH0) == 0) + && (McResCtrl_HasSrc(eMCDRV_DST_DAC1, eMCDRV_DST_CH1) == 0) + && (McResCtrl_HasSrc(eMCDRV_DST_ADIF0, eMCDRV_DST_CH0) == 0) + && (McResCtrl_HasSrc(eMCDRV_DST_ADIF0, eMCDRV_DST_CH1) == 0) + && (McResCtrl_HasSrc(eMCDRV_DST_ADIF1, eMCDRV_DST_CH0) == 0) + && (McResCtrl_HasSrc(eMCDRV_DST_ADIF1, eMCDRV_DST_CH1) == 0) + && (McResCtrl_HasSrc(eMCDRV_DST_ADIF2, eMCDRV_DST_CH0) == 0) + && (McResCtrl_HasSrc(eMCDRV_DST_ADIF2, eMCDRV_DST_CH1) == 0)) + bE1Command = E1COMMAND_PD; + else + bE1Command = 0; + if ((bStarted&MCDRV_DSP_START_E) == 0) { + McDevIf_AddPacket((MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_E1DSP_CTRL), + (UINT8)0x00); + bE1Command |= E1COMMAND_RUN_MODE; + McDevIf_AddPacket((MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_E1COMMAND), + bE1Command); + + McEdsp_Start(); + } else if ((bReg&E1COMMAND_PD) != (bE1Command&E1COMMAND_PD)) { + bE1Command |= E1COMMAND_ADDITIONAL; + McDevIf_AddPacket((MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_E1COMMAND), + bE1Command); + } + } else if ((bStarted&MCDRV_DSP_START_E) != 0) { + McDevIf_AddPacket((MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_E1COMMAND), + E1COMMAND_SLEEP_MODE); + McEdsp_Stop(); + } + if ((bStart&MCDRV_DSP_START_B) != 0) { + if ((bStarted&MCDRV_DSP_START_B) == 0) { + ; + McBdsp_Start(); + } + } else if ((bStarted&MCDRV_DSP_START_B) != 0) { + McBdsp_Stop(); + } + if ((bStart&MCDRV_DSP_START_F) != 0) { + if ((bStarted&MCDRV_DSP_START_F) == 0) { + for (i = 0; i < FDSP_MUTE_NUM; i++) { + sMute.abInMute[i] = FDSP_MUTE_OFF; + sMute.abOutMute[i] = FDSP_MUTE_OFF; + } + McFdsp_Start(); + McFdsp_SetMute(&sMute); + } + } + if ((bStart&MCDRV_DSP_START_C) != 0) { + if (McResCtrl_HasSrc(eMCDRV_DST_VBOXHOSTIN, eMCDRV_DST_CH0) + == 0) + bDFifoSel = CDSP_FIFO_SEL_PORT; + else + bDFifoSel = CDSP_FIFO_SEL_HOST; + if (McResCtrl_HasSrc(eMCDRV_DST_HOSTOUT, eMCDRV_DST_CH0) == 0) + bRFifoSel = CDSP_FIFO_SEL_PORT; + else + bRFifoSel = CDSP_FIFO_SEL_HOST; + McCdsp_SetDFifoSel(bDFifoSel); + McCdsp_SetRFifoSel(bRFifoSel); + if ((bStarted&MCDRV_DSP_START_C) == 0) { + McResCtrl_GetDioInfo(&sDioInfo); + bLP2Fs = GetLP2Fs(&bThru); + if (sAecInfo.sAecVBox.bCDspFuncAOnOff != 0) { + if ((sAecInfo.sAecVBox.bSrc3_Ctrl == 3) + && (sAecInfo.sAecVBox.bCDspFuncAOnOff == 0x11)) + bReg = McResCtrl_GetRegVal( + MCDRV_PACKET_REGTYPE_MB, + MCI_SRC3); + else + bReg = bLP2Fs; + McCdsp_SetFs(eMC_PLAYER_CODER_A, + bReg&0x0F); + McCdsp_Start(eMC_PLAYER_CODER_A); + } + if (sAecInfo.sAecVBox.bCDspFuncBOnOff != 0) { + if ((sAecInfo.sAecVBox.bSrc3_Ctrl == 3) + && (sAecInfo.sAecVBox.bCDspFuncBOnOff == 0x11)) + bReg = McResCtrl_GetRegVal( + MCDRV_PACKET_REGTYPE_MB, + MCI_SRC3); + else + bReg = bLP2Fs; + McCdsp_SetFs(eMC_PLAYER_CODER_B, + bReg&0x0F); + McCdsp_Start(eMC_PLAYER_CODER_B); + } + } + } else if ((bStarted&MCDRV_DSP_START_C) != 0) { + if (sAecInfo.sAecVBox.bCDspFuncAOnOff != 0) + McCdsp_Stop(eMC_PLAYER_CODER_A); + if (sAecInfo.sAecVBox.bCDspFuncBOnOff != 0) + McCdsp_Stop(eMC_PLAYER_CODER_B); + } + + if ((bStart&MCDRV_DSP_START_M) != 0) { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MA + | (UINT32)MCI_SPATH_ON, + GetSPath()); + if ((bStarted&MCDRV_DSP_START_M) == 0) { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MA + | (UINT32)MCI_DSP_START, + MCB_DSP_START); + } + } else if ((bStarted&MCDRV_DSP_START_M) != 0) { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MA + | (UINT32)MCI_SPATH_ON, + 0); + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McPacket_AddDSPStartStop", NULL); +#endif +} + +/**************************************************************************** + * McPacket_AddFDSPStop + * + * Description: + * Add F-DSP stop packet. + * Arguments: + * bStarted DSP has started + * Return: + * none + * + ****************************************************************************/ +void McPacket_AddFDSPStop( + UINT8 bStarted +) +{ + UINT8 bStart = McResCtrl_GetDspStart(); + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McPacket_AddFDSPStop"); +#endif + + if (((bStart&MCDRV_DSP_START_F) == 0) + && ((bStarted&MCDRV_DSP_START_F) != 0)) { + McFdsp_Stop(); + } +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McPacket_AddFDSPStop", NULL); +#endif +} + + +/**************************************************************************** + * AddDIStart + * + * Description: + * Add DIStart setup packet. + * Arguments: + * none + * Return: + * none + * + ****************************************************************************/ +static void AddDIStart( + void +) +{ + UINT8 bStart; + UINT8 bReg; + UINT8 bThru = 0xFF, + bFs = 0xFF; + struct MCDRV_DIO_INFO sDioInfo; + struct MCDRV_DIOPATH_INFO sDioPathInfo; + struct MCDRV_AEC_INFO sAecInfo; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("AddDIStart"); +#endif + + McResCtrl_GetDioInfo(&sDioInfo); + McResCtrl_GetAecInfo(&sAecInfo); + McResCtrl_GetDioPathInfo(&sDioPathInfo); + + bStart = 0; + if ((McResCtrl_HasSrc(eMCDRV_DST_MUSICOUT, eMCDRV_DST_CH0) != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_MUSICOUT, eMCDRV_DST_CH1) != 0)) { + if (sDioInfo.asPortInfo[0].sDioCommon.bMasterSlave + == MCDRV_DIO_MASTER) { + bStart |= MCB_LP0_TIM_START; + } + bStart |= MCB_LPT0_START_SRC; + bStart |= MCB_LPT0_START; + } + if ((McResCtrl_IsD1SrcUsed(MCDRV_D1SRC_MUSICIN_ON) != 0)) { + if (sDioInfo.asPortInfo[0].sDioCommon.bMasterSlave + == MCDRV_DIO_MASTER) { + bStart |= MCB_LP0_TIM_START; + } + bStart |= MCB_LPR0_START_SRC; + bStart |= MCB_LPR0_START; + } + if (bStart != 0) { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_LP0_FP, + sDioPathInfo.abPhysPort[0]); + if (sDioPathInfo.abPhysPort[0] >= MCDRV_PHYSPORT_SLIM0) { + bStart |= MCB_LP0_TIM_START; + if ((bStart&MCB_LPR0_START) != 0) { + ; + bStart |= MCB_LPR0_STOP_EN; + } + if ((bStart&MCB_LPT0_START) != 0) { + ; + bStart |= MCB_LPT0_STOP_EN; + } + } + if (McDevProf_GetDevId() != eMCDRV_DEV_ID_80_90H) { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MA + | (UINT32)MCI_LINK_LOCK, + MCB_LINK_LOCK); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MB + | (UINT32)MCI_T_DPLL_FAST, + MCB_T_DPLL_FAST|MCB_VOLREL_TIME); + } + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MB + | (UINT32)MCI_LP0_START, + bStart); + } + + bStart = 0; + if ((McResCtrl_HasSrc(eMCDRV_DST_EXTOUT, eMCDRV_DST_CH0) != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_EXTOUT, eMCDRV_DST_CH1) != 0)) { + if (sDioInfo.asPortInfo[1].sDioCommon.bMasterSlave + == MCDRV_DIO_MASTER) { + bStart |= MCB_LP1_TIM_START; + } + bStart |= MCB_LPT1_START_SRC; + bStart |= MCB_LPT1_START; + } + if (McResCtrl_IsD1SrcUsed(MCDRV_D1SRC_EXTIN_ON) != 0) { + if (sDioInfo.asPortInfo[1].sDioCommon.bMasterSlave + == MCDRV_DIO_MASTER) { + bStart |= MCB_LP1_TIM_START; + } + bStart |= MCB_LPR1_START_SRC; + bStart |= MCB_LPR1_START; + } + if (bStart != 0) { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_LP1_FP, + sDioPathInfo.abPhysPort[1]); + if (sDioPathInfo.abPhysPort[1] >= MCDRV_PHYSPORT_SLIM0) { + bStart |= MCB_LP1_TIM_START; + if ((bStart&MCB_LPR1_START) != 0) { + ; + bStart |= MCB_LPR1_STOP_EN; + } + if ((bStart&MCB_LPT1_START) != 0) { + ; + bStart |= MCB_LPT1_STOP_EN; + } + } + if (McDevProf_GetDevId() != eMCDRV_DEV_ID_80_90H) { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MA + | (UINT32)MCI_LINK_LOCK, + MCB_LINK_LOCK); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MB + | (UINT32)MCI_T_DPLL_FAST, + MCB_T_DPLL_FAST|MCB_VOLREL_TIME); + } + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MB + | (UINT32)MCI_LP1_START, + bStart); + } + + bStart = GetLP2Start(); + if (bStart != 0) { + bThru = 0xFF; + bFs = GetLP2Fs(&bThru); + if (bThru != 0xFF) { + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H) { + bReg = McResCtrl_GetRegVal( + MCDRV_PACKET_REGTYPE_MB, + MCI_LP2_MODE); + if ((bReg&MCB_LP2_SRC_THRU) != bThru) { + McDevIf_AddPacket( + MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MB + | (UINT32)MCI_LP2_START, + 0); + bReg &= (UINT8)~MCB_LP2_SRC_THRU; + bReg |= bThru; + McDevIf_AddPacket( + MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MB + | (UINT32)MCI_LP2_MODE, + bReg); + } + } + + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_MB, + MCI_LP2_BCK); + if ((bReg&0x0F) != bFs) { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MB + | (UINT32)MCI_LP2_START, + 0); + bReg &= 0xF0; + bReg |= bFs; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MB + | (UINT32)MCI_LP2_BCK, + bReg); + } + } + if ((McResCtrl_HasSrc(eMCDRV_DST_VOICEOUT, eMCDRV_DST_CH0) != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_VBOXIOIN, eMCDRV_DST_CH0) != 0) + ) { + ; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_LP2_FP, + sDioPathInfo.abPhysPort[2]); + if (sDioPathInfo.abPhysPort[2] >= MCDRV_PHYSPORT_SLIM0 + ) { + bStart |= MCB_LP2_TIM_START; + if ((bStart&MCB_LPR2_START) != 0) { + ; + bStart |= MCB_LPR2_STOP_EN; + } + if ((bStart&MCB_LPT2_START) != 0) { + ; + bStart |= MCB_LPT2_STOP_EN; + } + } + } else { /* LP2 not running */ + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_MB, + MCI_LP2_START); + if (bReg != 0) { + ; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_LP2_FP, + MCDRV_PHYSPORT_NONE); + } + } + if (McDevProf_GetDevId() != eMCDRV_DEV_ID_80_90H) { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MA + | (UINT32)MCI_LINK_LOCK, + MCB_LINK_LOCK); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MB + | (UINT32)MCI_T_DPLL_FAST, + MCB_T_DPLL_FAST|MCB_VOLREL_TIME); + } + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MB + | (UINT32)MCI_LP2_START, + bStart); + } + + bStart = 0; + bThru = 0xFF; + bFs = 0xFF; + if ((McResCtrl_HasSrc(eMCDRV_DST_VBOXMIXIN, eMCDRV_DST_CH2) != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_VBOXMIXIN, eMCDRV_DST_CH3) != 0)) { + bStart |= MCB_SRC3_TIM_START; + bStart |= MCB_OSRC3_START; + bThru = sAecInfo.sAecVBox.bSrc3_Thru; + bFs = sAecInfo.sAecVBox.bSrc3_Fs; + } + if (McResCtrl_IsD1SrcUsed(MCDRV_D1SRC_VBOXREFOUT_ON) != 0) { + bStart |= MCB_SRC3_TIM_START; + bStart |= MCB_ISRC3_START; + bThru = sAecInfo.sAecVBox.bSrc3_Thru; + bFs = sAecInfo.sAecVBox.bSrc3_Fs; + } + if ((bStart != 0) + && (sAecInfo.sAecVBox.bSrc3_Ctrl) == 3) + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MB + | (UINT32)MCI_SRC3, + (UINT8)(bThru<<4) | bFs); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MB + | (UINT32)MCI_SRC3_START, + bStart); + + bStart = 0; + if (McResCtrl_HasSrc(eMCDRV_DST_HIFIOUT, eMCDRV_DST_CH0) != 0) { + bStart |= MCB_LP3_TIM_START; + bStart |= MCB_LPT3_START; + } + if (McResCtrl_IsD1SrcUsed(MCDRV_D1SRC_HIFIIN_ON) != 0) { + bStart |= MCB_LP3_TIM_START; + bStart |= MCB_LPR3_START; + } + if (bStart != 0) { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_LP3_FP, + sDioPathInfo.abPhysPort[3]); + if (sDioPathInfo.abPhysPort[3] >= MCDRV_PHYSPORT_SLIM0) { + bStart |= MCB_LP3_TIM_START; + if ((bStart&MCB_LPR3_START) != 0) { + ; + bStart |= MCB_LPR3_STOP_EN; + } + if ((bStart&MCB_LPT3_START) != 0) { + ; + bStart |= MCB_LPT3_STOP_EN; + } + } + if (McDevProf_GetDevId() != eMCDRV_DEV_ID_80_90H) { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MA + | (UINT32)MCI_LINK_LOCK, + MCB_LINK_LOCK); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MB + | (UINT32)MCI_T_DPLL_FAST, + MCB_T_DPLL_FAST|MCB_VOLREL_TIME); + } + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MB + | (UINT32)MCI_LP3_START, + bStart); + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("AddDIStart", 0); +#endif +} + +/**************************************************************************** + * AddDacStart + * + * Description: + * Add DAC Start setup packet. + * Arguments: + * none + * Return: + * none + * + ****************************************************************************/ +static void AddDacStart( + void +) +{ + UINT8 bReg; + UINT8 bOsf0_Enb = 0, + bOsf1_Enb = 0; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("AddDacStart"); +#endif + + /* DAC Start */ + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_E, + MCI_LPF_THR); + bOsf0_Enb = bReg & (MCB_OSF0_MN|MCB_OSF0_ENB); + if (McResCtrl_HasSrc(eMCDRV_DST_DAC0, eMCDRV_DST_CH0) != 0) + bOsf0_Enb = MCB_OSF0_ENB | MCB_OSF0_MN; + if (McResCtrl_HasSrc(eMCDRV_DST_DAC0, eMCDRV_DST_CH1) != 0) + bOsf0_Enb = MCB_OSF0_ENB; + bOsf1_Enb = bReg & (MCB_OSF1_MN|MCB_OSF1_ENB); + if (McResCtrl_HasSrc(eMCDRV_DST_DAC1, eMCDRV_DST_CH0) != 0) + bOsf1_Enb = MCB_OSF1_ENB | MCB_OSF1_MN; + if (McResCtrl_HasSrc(eMCDRV_DST_DAC1, eMCDRV_DST_CH1) != 0) + bOsf1_Enb = MCB_OSF1_ENB; + bReg &= (MCB_LPF1_PST_THR|MCB_LPF0_PST_THR + |MCB_LPF1_PRE_THR|MCB_LPF0_PRE_THR); + bReg |= (bOsf1_Enb|bOsf0_Enb); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_LPF_THR, + bReg); + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("AddDacStart", 0); +#endif +} + +/**************************************************************************** + * McPacket_AddStart + * + * Description: + * Add start packet. + * Arguments: + * none + * Return: + * none + * + ****************************************************************************/ +void McPacket_AddStart( + void +) +{ + UINT8 bReg; + UINT32 dHifiSrc; + UINT8 bDsf0_Enb = 0, + bDsf1_Enb = 0, + bDsf2_Enb = 0; + UINT32 dSrc; + UINT8 bDirect_Enb = 0; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McPacket_AddStart"); +#endif + + /* DIR*_START, DIT*_START */ + AddDIStart(); + + /* ADC Start */ + bDsf0_Enb = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_E, + MCI_DSF0_FLT_TYPE); + bDsf1_Enb = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_E, + MCI_DSF1_FLT_TYPE); + bDsf2_Enb = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_E, + MCI_DSF2_FLT_TYPE); + dHifiSrc = + McResCtrl_GetSource(eMCDRV_DST_HIFIOUT, eMCDRV_DST_CH0); + + if ((McResCtrl_HasSrc(eMCDRV_DST_ADIF0, eMCDRV_DST_CH0) != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_ADIF0, eMCDRV_DST_CH1) != 0)) { + bDsf0_Enb |= MCB_DSF0ENB; + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_E, + MCI_DSF0_PRE_INPUT); + if ((bReg>>4) == (bReg&0x0F) + || (McResCtrl_HasSrc(eMCDRV_DST_ADIF0, eMCDRV_DST_CH1) == 0)) + bDsf0_Enb |= MCB_DSF0_MN; + else + bDsf0_Enb &= ~MCB_DSF0_MN; + } + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_DSF0_FLT_TYPE, + bDsf0_Enb); + + if ((McResCtrl_HasSrc(eMCDRV_DST_ADIF1, eMCDRV_DST_CH0) != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_ADIF1, eMCDRV_DST_CH1) != 0)) { + bDsf1_Enb |= MCB_DSF1ENB; + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_E, + MCI_DSF1_PRE_INPUT); + if ((bReg>>4) == (bReg&0x0F) + || (McResCtrl_HasSrc(eMCDRV_DST_ADIF1, eMCDRV_DST_CH1) == 0)) + bDsf1_Enb |= MCB_DSF1_MN; + else + bDsf1_Enb &= ~MCB_DSF1_MN; + } + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_DSF1_FLT_TYPE, + bDsf1_Enb); + + if ((McResCtrl_HasSrc(eMCDRV_DST_ADIF2, eMCDRV_DST_CH0) != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_ADIF2, eMCDRV_DST_CH1) != 0)) { + bDsf2_Enb |= MCB_DSF2ENB; + dSrc = McResCtrl_GetSource(eMCDRV_DST_ADIF2, eMCDRV_DST_CH0); + if (dSrc == MCDRV_D2SRC_DAC0REF_ON) { + bDsf2_Enb |= MCB_DSF2REFBACK; + bDsf2_Enb &= ~MCB_DSF2REFSEL; + bDsf2_Enb &= ~MCB_DSF2_MN; + } else if (dSrc == MCDRV_D2SRC_DAC1REF_ON) { + bDsf2_Enb |= MCB_DSF2REFBACK; + bDsf2_Enb |= MCB_DSF2REFSEL; + bDsf2_Enb &= ~MCB_DSF2_MN; + } else { + bDsf2_Enb &= ~MCB_DSF2REFBACK; + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_E, + MCI_DSF2_PRE_INPUT); + if ((bReg>>4) == (bReg&0x0F) + || (McResCtrl_HasSrc(eMCDRV_DST_ADIF2, eMCDRV_DST_CH1) + == 0)) + bDsf2_Enb |= MCB_DSF2_MN; + else + bDsf2_Enb &= ~MCB_DSF2_MN; + } + } + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_DSF2_FLT_TYPE, + bDsf2_Enb); + + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H) { + if ((McResCtrl_IsD1SrcUsed(MCDRV_D1SRC_HIFIIN_ON) != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_HIFIOUT, eMCDRV_DST_CH0) != 0)) + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_DIRECTPATH_ENB, + MCB_DIRECTPATH_ENB); + } else { + if (McResCtrl_HasSrc(eMCDRV_DST_HIFIOUT, eMCDRV_DST_CH0) != 0) + bDirect_Enb |= MCB_DIRECT_ENB_ADC; + dSrc = McResCtrl_GetSource(eMCDRV_DST_DAC0, eMCDRV_DST_CH0); + dSrc |= McResCtrl_GetSource(eMCDRV_DST_DAC0, eMCDRV_DST_CH1); + if ((dSrc & MCDRV_D1SRC_HIFIIN_ON) != 0) { + ; + bDirect_Enb |= MCB_DIRECT_ENB_DAC0; + } + dSrc = McResCtrl_GetSource(eMCDRV_DST_DAC1, eMCDRV_DST_CH0); + dSrc |= McResCtrl_GetSource(eMCDRV_DST_DAC1, eMCDRV_DST_CH1); + if ((dSrc & MCDRV_D1SRC_HIFIIN_ON) != 0) { + ; + bDirect_Enb |= MCB_DIRECT_ENB_DAC1; + } + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_DIRECTPATH_ENB, + bDirect_Enb); + } + + /* PDM Start */ + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_E, + MCI_PDM_LOAD_TIM); + if ((McResCtrl_IsD2SrcUsed(MCDRV_D2SRC_PDM0_L_ON) != 0) + || (McResCtrl_IsD2SrcUsed(MCDRV_D2SRC_PDM0_R_ON) != 0) + || ((dHifiSrc & (MCDRV_D2SRC_PDM0_L_ON|MCDRV_D2SRC_PDM0_R_ON)) != 0)) + bReg |= MCB_PDM0_START; + if ((McResCtrl_IsD2SrcUsed(MCDRV_D2SRC_PDM1_L_ON) != 0) + || (McResCtrl_IsD2SrcUsed(MCDRV_D2SRC_PDM1_R_ON) != 0) + || ((dHifiSrc & (MCDRV_D2SRC_PDM1_L_ON|MCDRV_D2SRC_PDM1_R_ON)) != 0)) + bReg |= MCB_PDM1_START; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_PDM_LOAD_TIM, + bReg); + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McPacket_AddStart", NULL); +#endif +} + +/**************************************************************************** + * GetSPath + * + * Description: + * Get SPATH_ON register setting + * Arguments: + * none + * Return: + * SPATH_ON register setting + * + ****************************************************************************/ +static UINT8 GetSPath( + void +) +{ + UINT8 bSPath = 0x7F; + UINT32 dSrc; + +#if (MCDRV_DEBUG_LEVEL >= 4) + SINT32 sdRet; + McDebugLog_FuncIn("GetSPath"); +#endif + dSrc = McResCtrl_GetSource(eMCDRV_DST_DAC0, eMCDRV_DST_CH0); + if ((dSrc & MCDRV_D1SRC_MUSICIN_ON) != 0) + bSPath |= MCB_SPATH_ON; + dSrc = McResCtrl_GetSource(eMCDRV_DST_DAC0, eMCDRV_DST_CH1); + if ((dSrc & MCDRV_D1SRC_MUSICIN_ON) != 0) + bSPath |= MCB_SPATH_ON; + dSrc = McResCtrl_GetSource(eMCDRV_DST_MUSICOUT, eMCDRV_DST_CH0); + if ((dSrc & MCDRV_D1SRC_ADIF0_ON) != 0) + bSPath |= MCB_SPATH_ON; + dSrc = McResCtrl_GetSource(eMCDRV_DST_MUSICOUT, eMCDRV_DST_CH1); + if ((dSrc & MCDRV_D1SRC_ADIF0_ON) != 0) + bSPath |= MCB_SPATH_ON; + + if ((McResCtrl_HasSrc(eMCDRV_DST_AE0, eMCDRV_DST_CH0) != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_AE0, eMCDRV_DST_CH1) != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_AE1, eMCDRV_DST_CH0) != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_AE1, eMCDRV_DST_CH1) != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_AE2, eMCDRV_DST_CH0) != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_AE2, eMCDRV_DST_CH1) != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_AE3, eMCDRV_DST_CH0) != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_AE3, eMCDRV_DST_CH1) != 0)) + bSPath &= (UINT8)~MCB_SPATH_ON; + else + bSPath &= (UINT8)~MCB_IN_MIX_ON; + + if ((McResCtrl_HasSrc(eMCDRV_DST_MUSICOUT, eMCDRV_DST_CH0) == 0) + && (McResCtrl_HasSrc(eMCDRV_DST_MUSICOUT, eMCDRV_DST_CH1) == 0)) + bSPath &= (UINT8)~MCB_OUT_MIX_ON_0; + if ((McResCtrl_HasSrc(eMCDRV_DST_EXTOUT, eMCDRV_DST_CH0) == 0) + && (McResCtrl_HasSrc(eMCDRV_DST_EXTOUT, eMCDRV_DST_CH1) == 0)) + bSPath &= (UINT8)~MCB_OUT_MIX_ON_1; + else + bSPath &= (UINT8)~MCB_SPATH_ON; + if ((McResCtrl_HasSrc(eMCDRV_DST_VBOXMIXIN, eMCDRV_DST_CH0) == 0) + && (McResCtrl_HasSrc(eMCDRV_DST_VBOXMIXIN, eMCDRV_DST_CH1) == 0)) + bSPath &= (UINT8)~MCB_OUT_MIX_ON_2; + else + bSPath &= (UINT8)~MCB_SPATH_ON; + if ((McResCtrl_HasSrc(eMCDRV_DST_VBOXMIXIN, eMCDRV_DST_CH2) == 0) + && (McResCtrl_HasSrc(eMCDRV_DST_VBOXMIXIN, eMCDRV_DST_CH3) == 0)) + bSPath &= (UINT8)~MCB_OUT_MIX_ON_3; + else + bSPath &= (UINT8)~MCB_SPATH_ON; + + dSrc = McResCtrl_GetSource(eMCDRV_DST_DAC0, eMCDRV_DST_CH0); + if ((dSrc & ~MCDRV_D1SRC_HIFIIN_ON) == 0) { + dSrc = + McResCtrl_GetSource(eMCDRV_DST_DAC0, eMCDRV_DST_CH1); + if ((dSrc & ~MCDRV_D1SRC_HIFIIN_ON) == 0) + bSPath &= (UINT8)~MCB_OUT_MIX_ON_4; + } + dSrc = McResCtrl_GetSource(eMCDRV_DST_DAC1, eMCDRV_DST_CH0); + if ((dSrc & ~MCDRV_D1SRC_HIFIIN_ON) == 0) { + dSrc = + McResCtrl_GetSource(eMCDRV_DST_DAC1, eMCDRV_DST_CH1); + if ((dSrc & ~MCDRV_D1SRC_HIFIIN_ON) == 0) + bSPath &= (UINT8)~MCB_OUT_MIX_ON_5; + } + + if (((bSPath&(MCB_OUT_MIX_ON_4|MCB_OUT_MIX_ON_0)) == 0) + || ((bSPath&(MCB_IN_MIX_ON|MCB_OUT_MIX_ON_5|MCB_OUT_MIX_ON_3| + MCB_OUT_MIX_ON_2|MCB_OUT_MIX_ON_1)) != 0)) + bSPath &= (UINT8)~MCB_SPATH_ON; + + if ((bSPath&(MCB_SPATH_ON|MCB_OUT_MIX_ON_0)) + == (MCB_SPATH_ON|MCB_OUT_MIX_ON_0)) { + dSrc = McResCtrl_GetSource(eMCDRV_DST_MUSICOUT, + eMCDRV_DST_CH0); + dSrc |= McResCtrl_GetSource(eMCDRV_DST_MUSICOUT, + eMCDRV_DST_CH1); + if (dSrc != MCDRV_D1SRC_ADIF0_ON) { + ; + bSPath &= (UINT8)~MCB_SPATH_ON; + } + } + if ((bSPath&(MCB_SPATH_ON|MCB_OUT_MIX_ON_4)) + == (MCB_SPATH_ON|MCB_OUT_MIX_ON_4)) { + dSrc = McResCtrl_GetSource(eMCDRV_DST_DAC0, + eMCDRV_DST_CH0); + dSrc |= McResCtrl_GetSource(eMCDRV_DST_DAC0, + eMCDRV_DST_CH1); + if (dSrc != MCDRV_D1SRC_MUSICIN_ON) + bSPath &= (UINT8)~MCB_SPATH_ON; + } + + +#if (MCDRV_DEBUG_LEVEL >= 4) + sdRet = bSPath; + McDebugLog_FuncOut("GetSPath", &sdRet); +#endif + return bSPath; +} + +/**************************************************************************** + * McPacket_AddVol + * + * Description: + * Add volume mute packet. + * Arguments: + * dUpdate target volume items + * eMode update mode + * pdSVolDoneParam wait soft volume complete flag + * Return: + * none + * + ****************************************************************************/ +void McPacket_AddVol( + UINT32 dUpdate, + enum MCDRV_VOLUPDATE_MODE eMode, + UINT32 *pdSVolDoneParam +) +{ + struct MCDRV_INIT_INFO sInitInfo; + struct MCDRV_VOL_INFO sVolInfo; + UINT8 bRegL, bRegR; + UINT8 bVolL, bVolR; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McPacket_AddVol"); +#endif + + McResCtrl_GetInitInfo(&sInitInfo, NULL); + McResCtrl_GetVolReg(&sVolInfo); + + if ((dUpdate & MCDRV_VOLUPDATE_ANA_IN) != 0UL) { + bVolL = (UINT8)sVolInfo.aswA_LineIn1[0]; + bVolR = (UINT8)sVolInfo.aswA_LineIn1[1]; + bRegL = + McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_ANA, + MCI_LIVOL_L); + bRegL &= ~MCB_ALAT_LI; + bRegR = + McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_ANA, + MCI_LIVOL_R); + if ((bVolL != bRegL) + && ((eMode != eMCDRV_VOLUPDATE_MUTE) + || (bVolL == MCDRV_REG_MUTE))) { + if ((bVolR != bRegR) + && ((eMode != eMCDRV_VOLUPDATE_MUTE) + || (bVolR == MCDRV_REG_MUTE))) + bVolL |= MCB_ALAT_LI; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_LIVOL_L, + bVolL); + } + if ((bVolR != bRegR) + && ((eMode != eMCDRV_VOLUPDATE_MUTE) + || (bVolR == MCDRV_REG_MUTE))) { + ; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_LIVOL_R, + bVolR); + } + + bVolL = (UINT8)sVolInfo.aswA_Mic1[0]; + bRegL = + McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_ANA, + MCI_MC1VOL); + if ((bVolL != bRegL) + && ((eMode != eMCDRV_VOLUPDATE_MUTE) + || (bVolL == MCDRV_REG_MUTE))) { + ; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_MC1VOL, + (UINT8)bVolL); + } + bVolL = (UINT8)sVolInfo.aswA_Mic2[0]; + bRegL = + McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_ANA, + MCI_MC2VOL); + if ((bVolL != bRegL) + && ((eMode != eMCDRV_VOLUPDATE_MUTE) + || (bVolL == MCDRV_REG_MUTE))) { + ; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_MC2VOL, + (UINT8)bVolL); + } + bVolL = (UINT8)sVolInfo.aswA_Mic3[0]; + bRegL = + McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_ANA, + MCI_MC3VOL); + if ((bVolL != bRegL) + && ((eMode != eMCDRV_VOLUPDATE_MUTE) + || (bVolL == MCDRV_REG_MUTE))) { + ; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_MC3VOL, + (UINT8)bVolL); + } + bVolL = (UINT8)sVolInfo.aswA_Mic4[0]; + bRegL = + McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_ANA, + MCI_MC4VOL); + if ((bVolL != bRegL) + && ((eMode != eMCDRV_VOLUPDATE_MUTE) + || (bVolL == MCDRV_REG_MUTE))) { + ; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_MC4VOL, + (UINT8)bVolL); + } + } + + if ((dUpdate & MCDRV_VOLUPDATE_DIN0) != 0UL) { + /* DIT0_INVOL */ + ; + AddDigVolPacket( + (UINT8)(sVolInfo.aswD_MusicIn[0]&~MCB_DIFI0_VSEP), + (UINT8)sVolInfo.aswD_MusicIn[1], + MCDRV_PACKET_REGTYPE_MA, + MCI_DIFI0_VOL0, + MCB_DIFI0_VSEP, + MCI_DIFI0_VOL1, + eMode); + } + if ((dUpdate & MCDRV_VOLUPDATE_DIN1) != 0UL) { + ; + AddDigVolPacket( + (UINT8)(sVolInfo.aswD_ExtIn[0]&~MCB_DIFI1_VSEP), + (UINT8)sVolInfo.aswD_ExtIn[1], + MCDRV_PACKET_REGTYPE_MA, + MCI_DIFI1_VOL0, + MCB_DIFI1_VSEP, + MCI_DIFI1_VOL1, + eMode); + } + if ((dUpdate & MCDRV_VOLUPDATE_DIN2) != 0UL) { + ; + AddDigVolPacket( + (UINT8)(sVolInfo.aswD_VoiceIn[0]&~MCB_DIFI2_VSEP), + (UINT8)sVolInfo.aswD_VoiceIn[1], + MCDRV_PACKET_REGTYPE_MA, + MCI_DIFI2_VOL0, + MCB_DIFI2_VSEP, + MCI_DIFI2_VOL1, + eMode); + } + if ((dUpdate & MCDRV_VOLUPDATE_DIN3) != 0UL) { + ; + AddDigVolPacket( + (UINT8)(sVolInfo.aswD_RefIn[0]&~MCB_DIFI3_VSEP), + (UINT8)sVolInfo.aswD_RefIn[1], + MCDRV_PACKET_REGTYPE_MA, + MCI_DIFI3_VOL0, + MCB_DIFI3_VSEP, + MCI_DIFI3_VOL1, + eMode); + } + if ((dUpdate & MCDRV_VOLUPDATE_ADIF0) != 0UL) { + ; + AddDigVolPacket( + (UINT8)(sVolInfo.aswD_Adif0In[0]&~MCB_ADI0_VSEP), + (UINT8)sVolInfo.aswD_Adif0In[1], + MCDRV_PACKET_REGTYPE_MA, + MCI_ADI0_VOL0, + MCB_ADI0_VSEP, + MCI_ADI0_VOL1, + eMode); + } + if ((dUpdate & MCDRV_VOLUPDATE_ADIF1) != 0UL) { + ; + AddDigVolPacket( + (UINT8)(sVolInfo.aswD_Adif1In[0]&~MCB_ADI1_VSEP), + (UINT8)sVolInfo.aswD_Adif1In[1], + MCDRV_PACKET_REGTYPE_MA, + MCI_ADI1_VOL0, + MCB_ADI1_VSEP, + MCI_ADI1_VOL1, + eMode); + } + if ((dUpdate & MCDRV_VOLUPDATE_ADIF2) != 0UL) { + ; + AddDigVolPacket( + (UINT8)(sVolInfo.aswD_Adif2In[0]&~MCB_ADI2_VSEP), + (UINT8)sVolInfo.aswD_Adif2In[1], + MCDRV_PACKET_REGTYPE_MA, + MCI_ADI2_VOL0, + MCB_ADI2_VSEP, + MCI_ADI2_VOL1, + eMode); + } + if ((dUpdate & MCDRV_VOLUPDATE_DOUT0) != 0UL) { + ; + AddDigVolPacket( + (UINT8)(sVolInfo.aswD_MusicOut[0]&~MCB_DIFO0_VSEP), + (UINT8)sVolInfo.aswD_MusicOut[1], + MCDRV_PACKET_REGTYPE_MA, + MCI_DIFO0_VOL0, + MCB_DIFO0_VSEP, + MCI_DIFO0_VOL1, + eMode); + } + if ((dUpdate & MCDRV_VOLUPDATE_DOUT1) != 0UL) { + ; + AddDigVolPacket( + (UINT8)(sVolInfo.aswD_ExtOut[0]&~MCB_DIFO1_VSEP), + (UINT8)sVolInfo.aswD_ExtOut[1], + MCDRV_PACKET_REGTYPE_MA, + MCI_DIFO1_VOL0, + MCB_DIFO1_VSEP, + MCI_DIFO1_VOL1, + eMode); + } + if ((dUpdate & MCDRV_VOLUPDATE_DOUT2) != 0UL) { + ; + AddDigVolPacket( + (UINT8)(sVolInfo.aswD_VoiceOut[0]&~MCB_DIFO2_VSEP), + (UINT8)sVolInfo.aswD_VoiceOut[1], + MCDRV_PACKET_REGTYPE_MA, + MCI_DIFO2_VOL0, + MCB_DIFO2_VSEP, + MCI_DIFO2_VOL1, + eMode); + } + if ((dUpdate & MCDRV_VOLUPDATE_DOUT3) != 0UL) { + ; + AddDigVolPacket( + (UINT8)(sVolInfo.aswD_RefOut[0]&~MCB_DIFO3_VSEP), + (UINT8)sVolInfo.aswD_RefOut[1], + MCDRV_PACKET_REGTYPE_MA, + MCI_DIFO3_VOL0, + MCB_DIFO3_VSEP, + MCI_DIFO3_VOL1, + eMode); + } + if ((dUpdate & MCDRV_VOLUPDATE_DAC0) != 0UL) { + ; + AddDigVolPacket( + (UINT8)(sVolInfo.aswD_Dac0Out[0]&~MCB_DAO0_VSEP), + (UINT8)sVolInfo.aswD_Dac0Out[1], + MCDRV_PACKET_REGTYPE_MA, + MCI_DAO0_VOL0, + MCB_DAO0_VSEP, + MCI_DAO0_VOL1, + eMode); + } + if ((dUpdate & MCDRV_VOLUPDATE_DAC1) != 0UL) { + ; + AddDigVolPacket( + (UINT8)(sVolInfo.aswD_Dac1Out[0]&~MCB_DAO1_VSEP), + (UINT8)sVolInfo.aswD_Dac1Out[1], + MCDRV_PACKET_REGTYPE_MA, + MCI_DAO1_VOL0, + MCB_DAO1_VSEP, + MCI_DAO1_VOL1, + eMode); + } + if ((dUpdate & MCDRV_VOLUPDATE_DPATHDA) != 0UL) { + ; + AddDigVolPacket( + (UINT8)(sVolInfo.aswD_DpathDa[0]&~MCB_DPATH_DA_VSEP), + (UINT8)sVolInfo.aswD_DpathDa[1], + MCDRV_PACKET_REGTYPE_E, + MCI_DPATH_DA_VOL_L, + MCB_DPATH_DA_VSEP, + MCI_DPATH_DA_VOL_R, + eMode); + } + if ((dUpdate & MCDRV_VOLUPDATE_DIN) != 0UL) { + ; + AddDigVolPacket( + (UINT8)(sVolInfo.aswD_DpathAd[0]&~MCB_DPATH_AD_VSEP), + (UINT8)sVolInfo.aswD_DpathAd[1], + MCDRV_PACKET_REGTYPE_E, + MCI_DPATH_AD_VOL_L, + MCB_DPATH_AD_VSEP, + MCI_DPATH_AD_VOL_R, + eMode); + } + + if ((dUpdate & MCDRV_VOLUPDATE_ANA_OUT) != 0UL) { + *pdSVolDoneParam = 0; + + bVolL = (UINT8)sVolInfo.aswA_Hp[0]; + bVolR = (UINT8)sVolInfo.aswA_Hp[1]; + bRegL = + McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_ANA, MCI_HPVOL_L); + bRegL &= (UINT8)~MCB_ALAT_HP; + bRegR = + McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_ANA, MCI_HPVOL_R); + if ((bVolL != bRegL) + && ((eMode != eMCDRV_VOLUPDATE_MUTE) + || (bVolL == MCDRV_REG_MUTE))) { + if ((bVolR != bRegR) + && ((eMode != eMCDRV_VOLUPDATE_MUTE) + || (bVolR == MCDRV_REG_MUTE))) + bVolL |= MCB_ALAT_HP; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_HPVOL_L, + bVolL); + if (bVolL == MCDRV_REG_MUTE) + *pdSVolDoneParam |= (MCB_HPL_BUSY<<8); + } + if ((bVolR != bRegR) + && ((eMode != eMCDRV_VOLUPDATE_MUTE) + || (bVolR == MCDRV_REG_MUTE))) { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_HPVOL_R, + bVolR); + if (bVolR == MCDRV_REG_MUTE) + *pdSVolDoneParam |= (MCB_HPR_BUSY<<8); + } + + bVolL = (UINT8)sVolInfo.aswA_Sp[0]; + bVolR = (UINT8)sVolInfo.aswA_Sp[1]; + bRegL = + McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_ANA, MCI_SPVOL_L); + bRegL &= (UINT8)~MCB_ALAT_SP; + bRegR = + McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_ANA, MCI_SPVOL_R); + if ((bVolL != bRegL) + && ((eMode != eMCDRV_VOLUPDATE_MUTE) + || (bVolL == MCDRV_REG_MUTE))) { + if ((bVolR != bRegR) + && ((eMode != eMCDRV_VOLUPDATE_MUTE) + || (bVolR == MCDRV_REG_MUTE))) + bVolL |= MCB_ALAT_SP; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_SPVOL_L, + bVolL); + if (bVolL == MCDRV_REG_MUTE) + *pdSVolDoneParam |= (MCB_SPL_BUSY<<8); + } + if ((bVolR != bRegR) + && ((eMode != eMCDRV_VOLUPDATE_MUTE) + || (bVolR == MCDRV_REG_MUTE))) { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_SPVOL_R, + bVolR); + if (bVolR == MCDRV_REG_MUTE) + *pdSVolDoneParam |= (MCB_SPR_BUSY<<8); + } + + bVolL = (UINT8)sVolInfo.aswA_Rc[0]; + bRegL = + McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_ANA, MCI_RCVOL); + if ((bVolL != bRegL) + && ((eMode != eMCDRV_VOLUPDATE_MUTE) + || (bVolL == MCDRV_REG_MUTE))) { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_RCVOL, + bVolL); + if (bVolL == MCDRV_REG_MUTE) + *pdSVolDoneParam |= MCB_RC_BUSY; + } + + bVolL = (UINT8)sVolInfo.aswA_LineOut1[0]; + bVolR = (UINT8)sVolInfo.aswA_LineOut1[1]; + bRegL = + McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_ANA, MCI_LO1VOL_L); + bRegL &= (UINT8)~MCB_ALAT_LO1; + bRegR = + McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_ANA, MCI_LO1VOL_R); + if ((bVolL != bRegL) + && ((eMode != eMCDRV_VOLUPDATE_MUTE) + || (bVolL == MCDRV_REG_MUTE))) { + if ((bVolR != bRegR) + && ((eMode != eMCDRV_VOLUPDATE_MUTE) + || (bVolR == MCDRV_REG_MUTE))) + bVolL |= MCB_ALAT_LO1; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_LO1VOL_L, + bVolL); + if (bVolL == MCDRV_REG_MUTE) + *pdSVolDoneParam |= MCB_LO1L_BUSY; + } + if ((bVolR != bRegR) + && ((eMode != eMCDRV_VOLUPDATE_MUTE) + || (bVolR == MCDRV_REG_MUTE))) { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_LO1VOL_R, + bVolR); + if (bVolR == MCDRV_REG_MUTE) + *pdSVolDoneParam |= MCB_LO1R_BUSY; + } + + bVolL = (UINT8)sVolInfo.aswA_LineOut2[0]; + bVolR = (UINT8)sVolInfo.aswA_LineOut2[1]; + bRegL = + McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_ANA, MCI_LO2VOL_L); + bRegL &= (UINT8)~MCB_ALAT_LO2; + bRegR = + McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_ANA, MCI_LO2VOL_R); + if ((bVolL != bRegL) + && ((eMode != eMCDRV_VOLUPDATE_MUTE) + || (bVolL == MCDRV_REG_MUTE))) { + if ((bVolR != bRegR) + && ((eMode != eMCDRV_VOLUPDATE_MUTE) + || (bVolR == MCDRV_REG_MUTE))) + bVolL |= MCB_ALAT_LO2; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_LO2VOL_L, + bVolL); + if (bVolL == MCDRV_REG_MUTE) + *pdSVolDoneParam |= MCB_LO2L_BUSY; + } + if ((bVolR != bRegR) + && ((eMode != eMCDRV_VOLUPDATE_MUTE) + || (bVolR == MCDRV_REG_MUTE))) { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_LO2VOL_R, + bVolR); + if (bVolR == MCDRV_REG_MUTE) + *pdSVolDoneParam |= MCB_LO2R_BUSY; + } + + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H) { + bVolL = (UINT8)sVolInfo.aswA_HpDet[0]; + bRegL = + McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_ANA, + MCI_HPDETVOL); + if ((bVolL != bRegL) + && ((eMode != eMCDRV_VOLUPDATE_MUTE) + || (bVolL == MCDRV_REG_MUTE))) + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_HPDETVOL, + bVolL); + } + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McPacket_AddVol", NULL); +#endif +} + +/**************************************************************************** + * AddDigVolPacket + * + * Description: + * Add digital vol setup packet. + * Arguments: + * bVolL Left volume + * bVolR Right volume + * dRegType Register Type + * bVolLAddr Left volume register address + * bVSEP VSEP + * bVolRAddr Right volume register address + * eMode update mode + * Return: + * none + * + ****************************************************************************/ +static void AddDigVolPacket( + UINT8 bVolL, + UINT8 bVolR, + UINT32 dRegType, + UINT8 bVolLAddr, + UINT8 bVSEP, + UINT8 bVolRAddr, + enum MCDRV_VOLUPDATE_MODE eMode +) +{ + UINT8 bRegVolL, bRegVolR; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("AddDigVolPacket"); +#endif + + bRegVolL = McResCtrl_GetRegVal((UINT16)dRegType, bVolLAddr); + bRegVolL &= (UINT8)~bVSEP; + bRegVolR = McResCtrl_GetRegVal((UINT16)dRegType, bVolRAddr); + + if (eMode == eMCDRV_VOLUPDATE_MUTE) { + if (bVolL != MCDRV_REG_MUTE) + bVolL = bRegVolL; + if (bVolR != MCDRV_REG_MUTE) + bVolR = bRegVolR; + } + + if (bVolL == bVolR) { + if ((bVolL != bRegVolL) + || (bVolR != bRegVolR)) { + if ((eMode != eMCDRV_VOLUPDATE_MUTE) + || (bVolL == MCDRV_REG_MUTE)) { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | dRegType + | (UINT32)bVolLAddr, + bVolL); + McResCtrl_SetRegVal((UINT16)dRegType, + bVolRAddr, + bVolR); + } + } + } else { + if (eMode == eMCDRV_VOLUPDATE_MUTE) { + if ((bVolL == MCDRV_REG_MUTE) + && (bVolL != bRegVolL)) { + McDevIf_AddPacket( + MCDRV_PACKET_TYPE_FORCE_WRITE + | dRegType + | (UINT32)bVolLAddr, + bVolL|bVSEP); + McDevIf_AddPacket( + MCDRV_PACKET_TYPE_FORCE_WRITE + | dRegType + | (UINT32)bVolRAddr, + bRegVolR); + } else if ((bVolR == MCDRV_REG_MUTE) + && (bVolR != bRegVolR)) { + McDevIf_AddPacket( + MCDRV_PACKET_TYPE_FORCE_WRITE + | dRegType + | (UINT32)bVolLAddr, + bRegVolL|bVSEP); + McDevIf_AddPacket( + MCDRV_PACKET_TYPE_WRITE + | dRegType + | (UINT32)bVolRAddr, + bVolR); + } + } else { + if (bVolL == bRegVolL) { + if (bVolR != bRegVolR) { + McDevIf_AddPacket( + MCDRV_PACKET_TYPE_FORCE_WRITE + | dRegType + | (UINT32)bVolLAddr, + bRegVolL|bVSEP); + McDevIf_AddPacket( + MCDRV_PACKET_TYPE_WRITE + | dRegType + | (UINT32)bVolRAddr, + bVolR); + } + } else { + McDevIf_AddPacket( + MCDRV_PACKET_TYPE_WRITE + | dRegType + | (UINT32)bVolLAddr, + bVolL|bVSEP); + McDevIf_AddPacket( + MCDRV_PACKET_TYPE_FORCE_WRITE + | dRegType + | (UINT32)bVolRAddr, + bVolR); + } + } + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("AddDigVolPacket", 0); +#endif +} + + +/**************************************************************************** + * McPacket_AddDac0Mute + * + * Description: + * Add Dac0 out path mute packet. + * Arguments: + * none + * Return: + * none + * + ****************************************************************************/ +void McPacket_AddDac0Mute( + void +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McPacket_AddDac0Mute"); +#endif + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_HPVOL_L, + MCDRV_REG_MUTE); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_HPVOL_R, + MCDRV_REG_MUTE); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_RCVOL, + MCDRV_REG_MUTE); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_LO1VOL_L, + MCDRV_REG_MUTE); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_LO1VOL_R, + MCDRV_REG_MUTE); +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McPacket_AddDac0Mute", 0); +#endif +} + +/**************************************************************************** + * McPacket_AddDac1Mute + * + * Description: + * Add Dac1 out path mute packet. + * Arguments: + * none + * Return: + * none + * + ****************************************************************************/ +void McPacket_AddDac1Mute( + void +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McPacket_AddDac1Mute"); +#endif + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_SPVOL_L, + MCDRV_REG_MUTE); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_SPVOL_R, + MCDRV_REG_MUTE); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_LO2VOL_L, + MCDRV_REG_MUTE); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_LO2VOL_R, + MCDRV_REG_MUTE); +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McPacket_AddDac1Mute", 0); +#endif +} + +/**************************************************************************** + * McPacket_AddDOutMute + * + * Description: + * Add Digital out path mute packet. + * Arguments: + * none + * Return: + * none + * + ****************************************************************************/ +void McPacket_AddDOutMute( + void +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McPacket_AddDOutMute"); +#endif + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MA + | (UINT32)MCI_DIFO0_VOL0, + MCDRV_REG_MUTE); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MA + | (UINT32)MCI_DIFO0_VOL1, + MCDRV_REG_MUTE); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MA + | (UINT32)MCI_DIFO1_VOL0, + MCDRV_REG_MUTE); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MA + | (UINT32)MCI_DIFO1_VOL1, + MCDRV_REG_MUTE); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MA + | (UINT32)MCI_DIFO2_VOL0, + MCDRV_REG_MUTE); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MA + | (UINT32)MCI_DIFO2_VOL1, + MCDRV_REG_MUTE); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MA + | (UINT32)MCI_DIFO3_VOL0, + MCDRV_REG_MUTE); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MA + | (UINT32)MCI_DIFO3_VOL1, + MCDRV_REG_MUTE); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MA + | (UINT32)MCI_DAO0_VOL0, + MCDRV_REG_MUTE); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MA + | (UINT32)MCI_DAO0_VOL1, + MCDRV_REG_MUTE); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MA + | (UINT32)MCI_DAO1_VOL0, + MCDRV_REG_MUTE); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MA + | (UINT32)MCI_DAO1_VOL1, + MCDRV_REG_MUTE); + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McPacket_AddDOutMute", 0); +#endif +} + +/**************************************************************************** + * McPacket_AddAdifMute + * + * Description: + * Add Adif path mute packet. + * Arguments: + * none + * Return: + * none + * + ****************************************************************************/ +void McPacket_AddAdifMute( + void +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McPacket_AddAdifMute"); +#endif + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MA + | (UINT32)MCI_ADI0_VOL0, + MCDRV_REG_MUTE); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MA + | (UINT32)MCI_ADI0_VOL1, + MCDRV_REG_MUTE); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MA + | (UINT32)MCI_ADI1_VOL0, + MCDRV_REG_MUTE); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MA + | (UINT32)MCI_ADI1_VOL1, + MCDRV_REG_MUTE); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MA + | (UINT32)MCI_ADI2_VOL0, + MCDRV_REG_MUTE); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MA + | (UINT32)MCI_ADI2_VOL1, + MCDRV_REG_MUTE); + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McPacket_AddAdifMute", 0); +#endif +} + +/**************************************************************************** + * McPacket_AddDPathDAMute + * + * Description: + * Add DirectPath DA mute packet. + * Arguments: + * none + * Return: + * none + * + ****************************************************************************/ +void McPacket_AddDPathDAMute( + void +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McPacket_AddDPathDAMute"); +#endif + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_DPATH_DA_VOL_L, + MCDRV_REG_MUTE); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_E + | (UINT32)MCI_DPATH_DA_VOL_R, + MCDRV_REG_MUTE); + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McPacket_AddDPathDAMute", 0); +#endif +} + +/**************************************************************************** + * McPacket_AddDigitalIO + * + * Description: + * Add DigitalI0 setup packet. + * Arguments: + * dUpdateInfo update information + * Return: + * none + * + ****************************************************************************/ +void McPacket_AddDigitalIO( + UINT32 dUpdateInfo +) +{ + UINT8 bReg; + UINT8 bLPort; + struct MCDRV_DIO_INFO sDioInfo; + struct MCDRV_INIT_INFO sInitInfo; + struct MCDRV_AEC_INFO sAecInfo; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McPacket_AddDigitalIO"); +#endif + McResCtrl_GetInitInfo(&sInitInfo, NULL); + McResCtrl_GetAecInfo(&sAecInfo); + + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_IF, MCI_RST); + if ((bReg & (MCB_PSW_M|MCB_RST_M)) != 0) + return; + + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_A, MCI_PD); + if ((bReg & MCB_PM_CLK_PD) != 0) + return; + + McResCtrl_GetDioInfo(&sDioInfo); + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_A, + MCI_DO0_DRV); + bLPort = GetLPort(MCDRV_PHYSPORT_DIO0); + if (bLPort <= 3) { + if (sDioInfo.asPortInfo[bLPort].sDioCommon.bBckInvert + == MCDRV_BCLK_INVERT) + bReg |= MCB_BCLK0_INV; + else + bReg &= (UINT8)~MCB_BCLK0_INV; + } + if ((sInitInfo.bPowerMode != MCDRV_POWMODE_CDSPDEBUG) + && (sAecInfo.sAecVBox.sAecCDspDbg.bJtagOn != 1)) { + ; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_DO0_DRV, + bReg); + } + + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_A, + MCI_DO1_DRV); + bLPort = GetLPort(MCDRV_PHYSPORT_DIO1); + if (bLPort <= 3) { + if (sDioInfo.asPortInfo[bLPort].sDioCommon.bBckInvert + == MCDRV_BCLK_INVERT) + bReg |= MCB_BCLK1_INV; + else + bReg &= (UINT8)~MCB_BCLK1_INV; + } + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_DO1_DRV, + bReg); + + bLPort = GetLPort(MCDRV_PHYSPORT_DIO2); + if (bLPort <= 3) { + if (sDioInfo.asPortInfo[bLPort].sDioCommon.bBckInvert + == MCDRV_BCLK_INVERT) + bReg |= MCB_BCLK2_INV; + else + bReg &= (UINT8)~MCB_BCLK2_INV; + } + if ((sInitInfo.bPowerMode != MCDRV_POWMODE_CDSPDEBUG) + && (sAecInfo.sAecVBox.sAecCDspDbg.bJtagOn != 1)) { + ; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_DO1_DRV, + bReg); + } + + if ((dUpdateInfo & MCDRV_MUSIC_COM_UPDATE_FLAG) != 0UL) + AddDIOCommon(eMCDRV_DIO_0); + + if ((dUpdateInfo & MCDRV_MUSIC_DIR_UPDATE_FLAG) != 0UL) + AddDIODIR(eMCDRV_DIO_0); + + if ((dUpdateInfo & MCDRV_MUSIC_DIT_UPDATE_FLAG) != 0UL) + AddDIODIT(eMCDRV_DIO_0); + + if ((dUpdateInfo & MCDRV_EXT_COM_UPDATE_FLAG) != 0UL) + AddDIOCommon(eMCDRV_DIO_1); + + if ((dUpdateInfo & MCDRV_EXT_DIR_UPDATE_FLAG) != 0UL) + AddDIODIR(eMCDRV_DIO_1); + + if ((dUpdateInfo & MCDRV_EXT_DIT_UPDATE_FLAG) != 0UL) + AddDIODIT(eMCDRV_DIO_1); + + if ((dUpdateInfo & MCDRV_VOICE_COM_UPDATE_FLAG) != 0UL) + AddDIOCommon(eMCDRV_DIO_2); + + if ((dUpdateInfo & MCDRV_VOICE_DIR_UPDATE_FLAG) != 0UL) + AddDIODIR(eMCDRV_DIO_2); + + if ((dUpdateInfo & MCDRV_VOICE_DIT_UPDATE_FLAG) != 0UL) + AddDIODIT(eMCDRV_DIO_2); + + if (((dUpdateInfo & MCDRV_HIFI_DIR_UPDATE_FLAG) != 0UL) + || ((dUpdateInfo & MCDRV_HIFI_DIT_UPDATE_FLAG) != 0UL)) { + /* LPT*_FMT, LPT*_BIT, LPR*_FMT, LPR*_BIT */ + bReg = (UINT8) + (sDioInfo.asPortInfo[eMCDRV_DIO_3].sDit.bStMode<<7 + |sDioInfo.asPortInfo[eMCDRV_DIO_3].sDit.bEdge<<4); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MB + | (UINT32)MCI_LPT3_STMODE, + bReg); + } + if ((dUpdateInfo & MCDRV_HIFI_COM_UPDATE_FLAG) != 0UL) { + bReg = (UINT8) + (sDioInfo.asPortInfo[eMCDRV_DIO_3].sDioCommon.bBckFs << 4) + | sDioInfo.asPortInfo[eMCDRV_DIO_3].sDioCommon.bFs; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MB + | (UINT32)MCI_LP3_BCK, + bReg); + } + if (((dUpdateInfo & MCDRV_HIFI_DIR_UPDATE_FLAG) != 0UL) + || ((dUpdateInfo & MCDRV_HIFI_DIT_UPDATE_FLAG) != 0UL)) { + /* LPT*_FMT, LPT*_BIT, LPR*_FMT, LPR*_BIT */ + if (sDioInfo.asPortInfo[eMCDRV_DIO_3].sDioCommon.bInterface + == MCDRV_DIO_DA) { + bReg = (UINT8) + (sDioInfo.asPortInfo[eMCDRV_DIO_3].sDit.sDaFormat.bMode << 6) + | (sDioInfo.asPortInfo[eMCDRV_DIO_3].sDit.sDaFormat.bBitSel<<4) + | (sDioInfo.asPortInfo[eMCDRV_DIO_3].sDir.sDaFormat.bMode << 2) + | (sDioInfo.asPortInfo[eMCDRV_DIO_3].sDir.sDaFormat.bBitSel); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MB + | (UINT32)MCI_LP3_FMT, + bReg); + } + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McPacket_AddDigitalIO", NULL); +#endif +} + +/**************************************************************************** + * AddDIOCommon + * + * Description: + * Add DigitalI0 Common setup packet. + * Arguments: + * ePort port number + * Return: + * none + * + ****************************************************************************/ +static void AddDIOCommon( + enum MCDRV_DIO_PORT_NO ePort +) +{ + UINT8 bReg; + UINT8 bRegOffset; + struct MCDRV_DIO_INFO sDioInfo; + +#if (MCDRV_DEBUG_LEVEL >= 4) + SINT32 sdRet; + McDebugLog_FuncIn("AddDIOCommon"); +#endif + + McResCtrl_GetDioInfo(&sDioInfo); + + if (ePort == eMCDRV_DIO_0) { + bRegOffset = 0; + } else if (ePort == eMCDRV_DIO_1) { + bRegOffset = MCI_LP1_MODE - MCI_LP0_MODE; + } else if (ePort == eMCDRV_DIO_2) { + bRegOffset = MCI_LP2_MODE - MCI_LP0_MODE; + } else { +#if (MCDRV_DEBUG_LEVEL >= 4) + sdRet = MCDRV_ERROR; + McDebugLog_FuncOut("AddDIOCommon", &sdRet); +#endif + return; + } + + /* LP*_MODE */ + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_MB, + MCI_LP0_MODE+bRegOffset); + bReg &= 0x0C; + bReg |= sDioInfo.asPortInfo[ePort].sDit.bStMode << 7; + bReg |= (sDioInfo.asPortInfo[ePort].sDioCommon.bAutoFs << 6); + bReg |= sDioInfo.asPortInfo[ePort].sDit.bEdge << 4; + if ((sDioInfo.asPortInfo[ePort].sDioCommon.bMasterSlave + == MCDRV_DIO_MASTER) + && (sDioInfo.asPortInfo[ePort].sDioCommon.bFs == MCDRV_FS_48000)) { + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H) { + ; + bReg |= + (sDioInfo.asPortInfo[ePort].sDioCommon.bSrcThru << 5); + } + } + bReg |= sDioInfo.asPortInfo[ePort].sDioCommon.bInterface; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MB + | (UINT32)(MCI_LP0_MODE+bRegOffset), + bReg); + + /* BCK, FS */ + bReg = (sDioInfo.asPortInfo[ePort].sDioCommon.bBckFs << 4) + | sDioInfo.asPortInfo[ePort].sDioCommon.bFs; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MB + | (UINT32)(MCI_LP0_BCK+bRegOffset), + bReg); + + /* HIZ_REDGE*, PCM_CLKDOWN*, PCM_FRAME*, PCM_HPERIOD* */ + if (sDioInfo.asPortInfo[ePort].sDioCommon.bInterface == MCDRV_DIO_PCM) { + bReg = + (sDioInfo.asPortInfo[ePort].sDioCommon.bPcmHizTim << 7) + | (sDioInfo.asPortInfo[ePort].sDioCommon.bPcmFrame << 5) + | (sDioInfo.asPortInfo[ePort].sDioCommon.bPcmHighPeriod); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MB + | (UINT32)(MCI_LP0_PCM+bRegOffset), + bReg); + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("AddDIOCommon", 0); +#endif +} + +/**************************************************************************** + * AddDIODIR + * + * Description: + * Add DigitalI0 DIR setup packet. + * Arguments: + * ePort port number + * Return: + * none + * + ****************************************************************************/ +static void AddDIODIR( + enum MCDRV_DIO_PORT_NO ePort +) +{ + UINT8 bReg; + UINT8 bRegOffset; + struct MCDRV_DIO_INFO sDioInfo; + +#if (MCDRV_DEBUG_LEVEL >= 4) + SINT32 sdRet; + McDebugLog_FuncIn("AddDIODIR"); +#endif + + McResCtrl_GetDioInfo(&sDioInfo); + + if (ePort == eMCDRV_DIO_0) { + bRegOffset = 0; + } else if (ePort == eMCDRV_DIO_1) { + bRegOffset = MCI_LP1_MODE - MCI_LP0_MODE; + } else if (ePort == eMCDRV_DIO_2) { + bRegOffset = MCI_LP2_MODE - MCI_LP0_MODE; + } else { +#if (MCDRV_DEBUG_LEVEL >= 4) + sdRet = MCDRV_ERROR; + McDebugLog_FuncOut("AddDIODIR", &sdRet); +#endif + return; + } + + /* LPT*_FMT, LPT*_BIT, LPR*_FMT, LPR*_BIT */ + bReg = (sDioInfo.asPortInfo[ePort].sDit.sDaFormat.bMode << 6) + | (sDioInfo.asPortInfo[ePort].sDit.sDaFormat.bBitSel << 4) + | (sDioInfo.asPortInfo[ePort].sDir.sDaFormat.bMode << 2) + | (sDioInfo.asPortInfo[ePort].sDir.sDaFormat.bBitSel); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MB + | (UINT32)(MCI_LP0_FMT+bRegOffset), + bReg); + + /* LPR*_PCM_MONO, LPR*_PCM_EXTEND, LPR*_PCM_LSBON, + LPR*_PCM_LAW, LPR*_PCM_BIT */ + bReg = (sDioInfo.asPortInfo[ePort].sDir.sPcmFormat.bMono << 7) + | (sDioInfo.asPortInfo[ePort].sDir.sPcmFormat.bOrder << 4) + | (sDioInfo.asPortInfo[ePort].sDir.sPcmFormat.bLaw << 2) + | (sDioInfo.asPortInfo[ePort].sDir.sPcmFormat.bBitSel); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MB + | (UINT32)(MCI_LPR0_PCM+bRegOffset), + bReg); + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("AddDIODIR", 0); +#endif +} + +/**************************************************************************** + * AddDIODIT + * + * Description: + * Add DigitalI0 DIT setup packet. + * Arguments: + * ePort port number + * Return: + * none + * + ****************************************************************************/ +static void AddDIODIT( + enum MCDRV_DIO_PORT_NO ePort +) +{ + UINT8 bReg; + UINT8 bRegOffset; + struct MCDRV_DIO_INFO sDioInfo; + +#if (MCDRV_DEBUG_LEVEL >= 4) + SINT32 sdRet; + McDebugLog_FuncIn("AddDIODIT"); +#endif + + McResCtrl_GetDioInfo(&sDioInfo); + + if (ePort == eMCDRV_DIO_0) { + bRegOffset = 0; + } else if (ePort == eMCDRV_DIO_1) { + bRegOffset = MCI_LP1_MODE - MCI_LP0_MODE; + } else if (ePort == eMCDRV_DIO_2) { + bRegOffset = MCI_LP2_MODE - MCI_LP0_MODE; + } else { +#if (MCDRV_DEBUG_LEVEL >= 4) + sdRet = MCDRV_ERROR; + McDebugLog_FuncOut("AddDIODIT", &sdRet); +#endif + return; + } + + /* LPT*_FMT, LPT*_BIT */ + bReg = (sDioInfo.asPortInfo[ePort].sDit.sDaFormat.bMode << 6) + | (sDioInfo.asPortInfo[ePort].sDit.sDaFormat.bBitSel << 4) + | (sDioInfo.asPortInfo[ePort].sDir.sDaFormat.bMode << 2) + | (sDioInfo.asPortInfo[ePort].sDir.sDaFormat.bBitSel); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MB + | (UINT32)(MCI_LP0_FMT+bRegOffset), + bReg); + + /* LPT*_PCM_MONO, LPT*_PCM_EXTEND, LPT*_PCM_LSBON, + LPT*_PCM_LAW, LPT*_PCM_BIT */ + bReg = (sDioInfo.asPortInfo[ePort].sDit.sPcmFormat.bMono << 7) + | (sDioInfo.asPortInfo[ePort].sDit.sPcmFormat.bOrder << 4) + | (sDioInfo.asPortInfo[ePort].sDit.sPcmFormat.bLaw << 2) + | (sDioInfo.asPortInfo[ePort].sDit.sPcmFormat.bBitSel); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MB + | (UINT32)(MCI_LPT0_PCM+bRegOffset), + bReg); + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("AddDIODIT", 0); +#endif +} + +/**************************************************************************** + * McPacket_AddDigitalIOPath + * + * Description: + * Add DigitalI0 path setup packet. + * Arguments: + * dUpdateInfo update information + * Return: + * none + * + ****************************************************************************/ +void McPacket_AddDigitalIOPath( + void +) +{ + UINT8 bReg; + struct MCDRV_DIOPATH_INFO sDioPathInfo; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McPacket_AddDigitalIOPath"); +#endif + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_IF, MCI_RST); + if ((bReg & (MCB_PSW_M|MCB_RST_M)) != 0) + return; + + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_A, MCI_PD); + if ((bReg & MCB_PM_CLK_PD) != 0) + return; + + McResCtrl_GetDioPathInfo(&sDioPathInfo); + + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_MB, MCI_LP0_MODE); + bReg &= (MCB_LP0_STMODE + |MCB_LP0_AUTO_FS + |MCB_LP0_SRC_THRU + |MCB_LPT0_EDGE + |MCB_LP0_MODE); + bReg |= (sDioPathInfo.bMusicCh<<2); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MB + | (UINT32)MCI_LP0_MODE, + bReg); + + bReg = 0; + bReg |= sDioPathInfo.abMusicRSlot[0]; + bReg |= (sDioPathInfo.abMusicRSlot[1]<<2); + bReg |= (sDioPathInfo.abMusicRSlot[2]<<4); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MB + | (UINT32)MCI_LPR0_SLOT, + bReg); + + bReg = 0; + bReg |= sDioPathInfo.abMusicTSlot[0]; + bReg |= (sDioPathInfo.abMusicTSlot[1]<<2); + bReg |= (sDioPathInfo.abMusicTSlot[2]<<4); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MB + | (UINT32)MCI_LPT0_SLOT, + bReg); + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McPacket_AddDigitalIOPath", NULL); +#endif +} + +/**************************************************************************** + * McPacket_AddClockSw + * + * Description: + * Add switch clock packet. + * Arguments: + * none + * Return: + * none + * + ****************************************************************************/ +void McPacket_AddClockSw( + void +) +{ + UINT8 bReg; + struct MCDRV_CLOCKSW_INFO sClockSwInfo; + struct MCDRV_HSDET_INFO sHSDetInfo; + struct MCDRV_INIT_INFO sInitInfo; + UINT8 bClkMsk; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McPacket_AddClockSw"); +#endif + + McResCtrl_GetInitInfo(&sInitInfo, NULL); + McResCtrl_GetClockSwInfo(&sClockSwInfo); + McResCtrl_GetHSDet(&sHSDetInfo, NULL); + + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_A, MCI_PD); + if ((bReg & MCB_PLL_PD) != MCB_PLL_PD) { + /* sync */ + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_A, + MCI_CLK_MSK); + if (sClockSwInfo.bClkSrc == MCDRV_CLKSW_CLKA) { + /* CLKB->CLKA */ + if ((sInitInfo.bCkInput == MCDRV_CKINPUT_CLKI0_CLKI1) + || (sInitInfo.bCkInput == MCDRV_CKINPUT_CLKI0_RTCK) + || (sInitInfo.bCkInput == MCDRV_CKINPUT_CLKI0_SBCK) + || (sInitInfo.bCkInput == MCDRV_CKINPUT_CLKI0_CLKI0)) { + bReg &= (UINT8)~MCB_CLKI0_MSK; + } else if ((sInitInfo.bCkInput + == MCDRV_CKINPUT_CLKI1_CLKI0) + || (sInitInfo.bCkInput + == MCDRV_CKINPUT_CLKI1_RTCK) + || (sInitInfo.bCkInput + == MCDRV_CKINPUT_CLKI1_SBCK) + || (sInitInfo.bCkInput + == MCDRV_CKINPUT_CLKI1_CLKI1)) { + bReg &= (UINT8)~MCB_CLKI1_MSK; + } else { + bReg &= (UINT8)~MCB_RTCI_MSK; + } + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_CLK_MSK, + bReg); + + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_A, + MCI_CLKSRC); + if ((bReg & MCB_CLK_INPUT) != 0) + bReg |= MCB_CLKSRC; + else + bReg &= (UINT8)~MCB_CLKSRC; + + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_CLKSRC, + bReg); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_EVTWAIT + | MCDRV_EVT_CLKBUSY_RESET, + 0); + + bReg = MCI_CLK_MSK_DEF; + if ((sInitInfo.bCkInput == MCDRV_CKINPUT_CLKI0_CLKI1) + || (sInitInfo.bCkInput == MCDRV_CKINPUT_CLKI0_RTCK) + || (sInitInfo.bCkInput == MCDRV_CKINPUT_CLKI0_SBCK) + || (sInitInfo.bCkInput == MCDRV_CKINPUT_CLKI0_CLKI0)) { + bReg &= (UINT8)~MCB_CLKI0_MSK; + } else if ((sInitInfo.bCkInput + == MCDRV_CKINPUT_CLKI1_CLKI0) + || (sInitInfo.bCkInput + == MCDRV_CKINPUT_CLKI1_RTCK) + || (sInitInfo.bCkInput + == MCDRV_CKINPUT_CLKI1_SBCK) + || (sInitInfo.bCkInput + == MCDRV_CKINPUT_CLKI1_CLKI1)) { + bReg &= (UINT8)~MCB_CLKI1_MSK; + } else { + bReg &= (UINT8)~MCB_RTCI_MSK; + } + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_CLK_MSK, + bReg); + bClkMsk = bReg; + } else { + /* CLKA->CLKB */ + if ((sInitInfo.bCkInput == MCDRV_CKINPUT_CLKI1_CLKI0) + || (sInitInfo.bCkInput == MCDRV_CKINPUT_RTC_CLKI0) + || (sInitInfo.bCkInput == MCDRV_CKINPUT_SBCK_CLKI0) + || (sInitInfo.bCkInput == MCDRV_CKINPUT_CLKI0_CLKI0)) { + bReg &= (UINT8)~MCB_CLKI0_MSK; + } else if ((sInitInfo.bCkInput + == MCDRV_CKINPUT_CLKI0_CLKI1) + || (sInitInfo.bCkInput + == MCDRV_CKINPUT_RTC_CLKI1) + || (sInitInfo.bCkInput + == MCDRV_CKINPUT_SBCK_CLKI1) + || (sInitInfo.bCkInput + == MCDRV_CKINPUT_CLKI1_CLKI1)) { + bReg &= (UINT8)~MCB_CLKI1_MSK; + } else { + bReg &= (UINT8)~MCB_RTCI_MSK; + } + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_CLK_MSK, + bReg); + + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_A, + MCI_CLKSRC); + if ((bReg & MCB_CLK_INPUT) == 0) + bReg |= MCB_CLKSRC; + else + bReg &= (UINT8)~MCB_CLKSRC; + + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_CLKSRC, + bReg); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_EVTWAIT + | MCDRV_EVT_CLKBUSY_RESET, + 0); + + bReg = MCI_CLK_MSK_DEF; + if ((sInitInfo.bCkInput == MCDRV_CKINPUT_CLKI1_CLKI0) + || (sInitInfo.bCkInput == MCDRV_CKINPUT_RTC_CLKI0) + || (sInitInfo.bCkInput == MCDRV_CKINPUT_SBCK_CLKI0) + || (sInitInfo.bCkInput == MCDRV_CKINPUT_CLKI0_CLKI0)) { + bReg &= (UINT8)~MCB_CLKI0_MSK; + } else if ((sInitInfo.bCkInput + == MCDRV_CKINPUT_CLKI0_CLKI1) + || (sInitInfo.bCkInput + == MCDRV_CKINPUT_RTC_CLKI1) + || (sInitInfo.bCkInput + == MCDRV_CKINPUT_SBCK_CLKI1) + || (sInitInfo.bCkInput + == MCDRV_CKINPUT_CLKI1_CLKI1)) { + bReg &= (UINT8)~MCB_CLKI1_MSK; + } else { + bReg &= (UINT8)~MCB_RTCI_MSK; + } + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_CLK_MSK, + bReg); + bClkMsk = bReg; + } + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_CD, + MCI_CKSEL); + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H) { + if ((bClkMsk&MCB_RTCI_MSK) == 0) { + ; + bReg &= (UINT8)~MCB_HSDET; + } else if ((sHSDetInfo.bEnPlugDetDb == + MCDRV_PLUGDETDB_DISABLE) + && (sHSDetInfo.bEnDlyKeyOff == MCDRV_KEYEN_D_D_D) + && (sHSDetInfo.bEnDlyKeyOn == MCDRV_KEYEN_D_D_D) + && (sHSDetInfo.bEnMicDet == MCDRV_MICDET_DISABLE) + && (sHSDetInfo.bEnKeyOff == MCDRV_KEYEN_D_D_D) + && (sHSDetInfo.bEnKeyOn == MCDRV_KEYEN_D_D_D)) { + bReg |= MCB_HSDET; + } + } else { + if ((bClkMsk&MCB_RTCI_MSK) == 0) { + ; + bReg &= (UINT8)~MCB_CRTC; + } else { + bReg |= MCB_CRTC; + } + } + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_CD + | (UINT32)MCI_CKSEL, + bReg); + } else { + /* async */ + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_A, + MCI_CLKSRC); + if (sClockSwInfo.bClkSrc == MCDRV_CLKSW_CLKA) { + if ((bReg & MCB_CLKSRC) != 0) { + ; + bReg |= MCB_CLK_INPUT; + } else { + bReg &= (UINT8)~MCB_CLK_INPUT; + } + } else { + if ((bReg & MCB_CLKSRC) == 0) { + ; + bReg |= MCB_CLK_INPUT; + } else { + bReg &= (UINT8)~MCB_CLK_INPUT; + } + } + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_CLKSRC, + bReg); + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McPacket_AddClockSwitch", NULL); +#endif +} + +/**************************************************************************** + * McPacket_AddSwap + * + * Description: + * Add Swap packet. + * Arguments: + * dUpdateInfo update information + * Return: + * none + * + ****************************************************************************/ +void McPacket_AddSwap( + UINT32 dUpdateInfo +) +{ + struct MCDRV_SWAP_INFO sSwapInfo; + UINT8 bReg; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McPacket_AddSwap"); +#endif + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_IF, MCI_RST); + if ((bReg & (MCB_PSW_M|MCB_RST_M)) != 0) + return; + + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_A, MCI_PD); + if ((bReg & MCB_PM_CLK_PD) != 0) + return; + + McResCtrl_GetSwap(&sSwapInfo); + + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_MA, MCI_ADI_SWAP); + if ((dUpdateInfo & MCDRV_SWAP_ADIF0_UPDATE_FLAG) != 0) { + bReg &= 0xF0; + bReg |= sSwapInfo.bAdif0; + } + if ((dUpdateInfo & MCDRV_SWAP_ADIF1_UPDATE_FLAG) != 0) { + bReg &= 0x0F; + bReg |= sSwapInfo.bAdif1<<4; + } + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MA + | (UINT32)MCI_ADI_SWAP, + bReg); + + if ((dUpdateInfo & MCDRV_SWAP_ADIF2_UPDATE_FLAG) != 0) { + ; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MA + | (UINT32)MCI_ADI2_SWAP, + sSwapInfo.bAdif2); + } + + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_MA, MCI_DAO_SWAP); + if ((dUpdateInfo & MCDRV_SWAP_DAC0_UPDATE_FLAG) != 0) { + bReg &= 0xF0; + bReg |= sSwapInfo.bDac0; + } + if ((dUpdateInfo & MCDRV_SWAP_DAC1_UPDATE_FLAG) != 0) { + bReg &= 0x0F; + bReg |= sSwapInfo.bDac1<<4; + } + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MA + | (UINT32)MCI_DAO_SWAP, + bReg); + + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_MB, MCI_LPR0_SWAP); + if ((dUpdateInfo & MCDRV_SWAP_MUSICIN0_UPDATE_FLAG) != 0) { + bReg &= ~0x03; + bReg |= sSwapInfo.bMusicIn0; + } + if ((dUpdateInfo & MCDRV_SWAP_MUSICIN1_UPDATE_FLAG) != 0) { + bReg &= ~0x0C; + bReg |= sSwapInfo.bMusicIn1<<2; + } + if ((dUpdateInfo & MCDRV_SWAP_MUSICIN2_UPDATE_FLAG) != 0) { + bReg &= ~0x30; + bReg |= sSwapInfo.bMusicIn2<<4; + } + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MB + | (UINT32)MCI_LPR0_SWAP, + bReg); + + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_MB, MCI_LPT0_SWAP); + if ((dUpdateInfo & MCDRV_SWAP_MUSICOUT0_UPDATE_FLAG) != 0) { + bReg &= ~0x07; + bReg |= sSwapInfo.bMusicOut0; + } + if ((dUpdateInfo & MCDRV_SWAP_MUSICOUT1_UPDATE_FLAG) != 0) { + bReg &= ~0x18; + bReg |= sSwapInfo.bMusicOut1<<3; + } + if ((dUpdateInfo & MCDRV_SWAP_MUSICOUT2_UPDATE_FLAG) != 0) { + bReg &= ~0x60; + bReg |= sSwapInfo.bMusicOut2<<5; + } + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MB + | (UINT32)MCI_LPT0_SWAP, + bReg); + + if ((dUpdateInfo & MCDRV_SWAP_EXTIN_UPDATE_FLAG) != 0) { + bReg = sSwapInfo.bExtIn; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MB + | (UINT32)MCI_LPR1_SWAP, + bReg); + } + + if ((dUpdateInfo & MCDRV_SWAP_EXTOUT_UPDATE_FLAG) != 0) { + bReg = sSwapInfo.bExtOut; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MB + | (UINT32)MCI_LPT1_SWAP, + bReg); + } + + if ((dUpdateInfo & MCDRV_SWAP_VOICEIN_UPDATE_FLAG) != 0) { + bReg = sSwapInfo.bVoiceIn; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MB + | (UINT32)MCI_LPR2_SWAP, + bReg); + } + + if ((dUpdateInfo & MCDRV_SWAP_VOICEOUT_UPDATE_FLAG) != 0) { + bReg = sSwapInfo.bVoiceOut; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MB + | (UINT32)MCI_LPT2_SWAP, + bReg); + } + + if ((dUpdateInfo & MCDRV_SWAP_HIFIIN_UPDATE_FLAG) != 0) { + bReg = sSwapInfo.bHifiIn; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MB + | (UINT32)MCI_LPR3_SWAP, + bReg); + } + + if ((dUpdateInfo & MCDRV_SWAP_HIFIOUT_UPDATE_FLAG) != 0) { + bReg = sSwapInfo.bHifiOut; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MB + | (UINT32)MCI_LPT3_SWAP, + bReg); + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McPacket_AddSwap", NULL); +#endif +} + +/**************************************************************************** + * McPacket_AddHSDet + * + * Description: + * Add Headset Det packet. + * Arguments: + * none + * Return: + * none + * + ****************************************************************************/ +void McPacket_AddHSDet( + void +) +{ + UINT8 bReg; + struct MCDRV_INIT_INFO sInitInfo; + struct MCDRV_HSDET_INFO sHSDetInfo; + struct MCDRV_HSDET2_INFO sHSDet2Info; + UINT8 bClkMsk; + UINT8 abData[2]; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McPacket_AddHSDet"); +#endif + + McResCtrl_GetInitInfo(&sInitInfo, NULL); + McResCtrl_GetHSDet(&sHSDetInfo, &sHSDet2Info); + + if ((sHSDetInfo.bEnPlugDetDb == MCDRV_PLUGDETDB_DISABLE) + && (sHSDetInfo.bEnDlyKeyOff == MCDRV_KEYEN_D_D_D) + && (sHSDetInfo.bEnDlyKeyOn == MCDRV_KEYEN_D_D_D) + && (sHSDetInfo.bEnMicDet == MCDRV_MICDET_DISABLE) + && (sHSDetInfo.bEnKeyOff == MCDRV_KEYEN_D_D_D) + && (sHSDetInfo.bEnKeyOn == MCDRV_KEYEN_D_D_D)) { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_CD + | (UINT32)MCI_IRQHS, + 0); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_CD + | (UINT32)MCI_EPLUGDET, + (sHSDetInfo.bEnPlugDet<<7)); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_CD + | (UINT32)MCI_EDLYKEY, + 0); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_CD + | (UINT32)MCI_EMICDET, + 0); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_CD + | (UINT32)MCI_HSDETEN, + sHSDetInfo.bHsDetDbnc); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_KDSET, + sInitInfo.bMbsDisch<<4); + + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_CD, + MCI_CKSEL); + bReg &= (UINT8)~MCB_CKSEL0; + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H) { + bClkMsk = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_A, + MCI_CLK_MSK); + if ((bClkMsk&MCB_RTCI_MSK) != 0) { + ; + bReg |= MCB_HSDET; + } + } else { + bReg |= MCB_HSDET; + } + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_CD + | (UINT32)MCI_CKSEL, + bReg); + McDevIf_AddPacket( + MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_CD + | (UINT32)MCI_DP_OSC, + MCB_DP_OSC); + } else { + if ((sHSDetInfo.bEnPlugDetDb != MCDRV_PLUGDETDB_DISABLE) + || (sHSDetInfo.bEnDlyKeyOff != MCDRV_KEYEN_D_D_D) + || (sHSDetInfo.bEnDlyKeyOn != MCDRV_KEYEN_D_D_D) + || (sHSDetInfo.bEnMicDet != MCDRV_MICDET_DISABLE) + || (sHSDetInfo.bEnKeyOff != MCDRV_KEYEN_D_D_D) + || (sHSDetInfo.bEnKeyOn != MCDRV_KEYEN_D_D_D)) { + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_CD, + MCI_HSDETEN); + if ((bReg&MCB_HSDETEN) == 0) { + if (sInitInfo.bHsdetClk == MCDRV_HSDETCLK_OSC) { + McDevIf_AddPacket( + MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_CD + | (UINT32)MCI_DP_OSC, + 0); + McDevIf_AddPacket( + MCDRV_PACKET_TYPE_TIMWAIT + | MCDRV_OSC_WAIT_TIME, 0); + } + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_CD + | (UINT32)MCI_HSDETEN, + sHSDetInfo.bHsDetDbnc); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_CD + | (UINT32)MCI_HSDETMODE, + sHSDetInfo.bHsDetMode); + bReg = (UINT8)(sHSDetInfo.bSperiod<<3) + | MCB_DBNC_LPERIOD; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_CD + | (UINT32)MCI_DBNC_PERIOD, + bReg); + bReg = (UINT8)((sHSDetInfo.bDbncNumPlug<<4) + | (sHSDetInfo.bDbncNumMic<<2) + | sHSDetInfo.bDbncNumKey); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_CD + | (UINT32)MCI_DBNC_NUM, + bReg); + bReg = (UINT8)((sHSDetInfo.bKeyOffMtim<<1) + | sHSDetInfo.bKeyOnMtim); + if (McDevProf_GetDevId() != + eMCDRV_DEV_ID_80_90H) { + ; + bReg |= MCI_KEY_MTIM_DEF; + } + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_CD + | (UINT32)MCI_KEY_MTIM, + bReg); + bReg = (UINT8)((sHSDetInfo.bKey0OnDlyTim2<<4) + | sHSDetInfo.bKey0OnDlyTim); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_CD + | (UINT32)MCI_KEYONDLYTIM_K0, + bReg); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_CD + | (UINT32)MCI_KEYOFFDLYTIM_K0, + sHSDetInfo.bKey0OffDlyTim); + bReg = (UINT8)((sHSDetInfo.bKey1OnDlyTim2<<4) + | sHSDetInfo.bKey1OnDlyTim); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_CD + | (UINT32)MCI_KEYONDLYTIM_K1, + bReg); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_CD + | (UINT32)MCI_KEYOFFDLYTIM_K1, + sHSDetInfo.bKey1OffDlyTim); + bReg = (UINT8)((sHSDetInfo.bKey2OnDlyTim2<<4) + | sHSDetInfo.bKey2OnDlyTim); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_CD + | (UINT32)MCI_KEYONDLYTIM_K2, + bReg); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_CD + | (UINT32)MCI_KEYOFFDLYTIM_K2, + sHSDetInfo.bKey2OffDlyTim); + + bReg = McResCtrl_GetRegVal( + MCDRV_PACKET_REGTYPE_CD, + MCI_CKSEL); + bReg &= (UINT8)~MCB_HSDET; + if (sInitInfo.bHsdetClk == MCDRV_HSDETCLK_OSC + ) { + bReg |= MCB_CKSEL0; + } + McDevIf_AddPacket( + MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_CD + | (UINT32)MCI_CKSEL, + bReg); + } + } + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_CD + | (UINT32)MCI_IRQHS, + MCB_EIRQHS); + bReg = (sHSDetInfo.bEnPlugDet<<7) | sHSDetInfo.bEnPlugDetDb; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_CD + | (UINT32)MCI_EPLUGDET, + bReg); + bReg = (UINT8)((sHSDetInfo.bEnDlyKeyOff<<3) + | sHSDetInfo.bEnDlyKeyOn); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_CD + | (UINT32)MCI_EDLYKEY, + bReg); + bReg = (UINT8)((sHSDetInfo.bEnMicDet<<6) + | (sHSDetInfo.bEnKeyOff<<3) + | sHSDetInfo.bEnKeyOn); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_CD + | (UINT32)MCI_EMICDET, + bReg); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_IRQR, + MCB_EIRQR); + } + + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H) { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_CD + | (UINT32)MCI_IRQTYPE, + sHSDetInfo.bIrqType); + } else { + if (sHSDetInfo.bIrqType == MCDRV_IRQTYPE_NORMAL) { + bReg = 0; + } else if (sHSDetInfo.bIrqType == MCDRV_IRQTYPE_REF) { + bReg = MCI_IRQTYPE_DEF; + } else { + bReg = (UINT8)(sHSDet2Info.bPlugDetIrqType << 7) + | (sHSDet2Info.bMicDetIrqType << 6) + | (sHSDet2Info.bPlugUndetDbIrqType << 1) + | sHSDet2Info.bPlugDetDbIrqType; + } + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_CD + | (UINT32)MCI_IRQTYPE, + bReg); + } + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_CD + | (UINT32)MCI_DLYIRQSTOP, + sHSDetInfo.bDlyIrqStop); + bReg = sHSDetInfo.bDetInInv; + if (McDevProf_GetDevId() != eMCDRV_DEV_ID_80_90H) { + if (sHSDetInfo.bIrqType == MCDRV_IRQTYPE_EX) { + bReg |= (UINT8)(sHSDet2Info.bKey2OnIrqType << 7); + bReg |= (UINT8)(sHSDet2Info.bKey1OnIrqType << 6); + bReg |= (UINT8)(sHSDet2Info.bKey0OnIrqType << 5); + } else { + bReg |= (UINT8)(sHSDetInfo.bIrqType << 7); + bReg |= (UINT8)(sHSDetInfo.bIrqType << 6); + bReg |= (UINT8)(sHSDetInfo.bIrqType << 5); + } + } + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_CD + | (UINT32)MCI_DETIN_INV, + bReg); + if (McDevProf_GetDevId() != eMCDRV_DEV_ID_80_90H) { + abData[0] = MCI_CD_REG_A<<1; + abData[1] = MCI_IRQM_KEYOFF; + McSrv_WriteReg(MCDRV_SLAVEADDR_ANA, abData, 2); + bReg = McSrv_ReadReg(MCDRV_SLAVEADDR_ANA, + (UINT32)MCI_CD_REG_D); + bReg &= 1; + if (sHSDetInfo.bIrqType == MCDRV_IRQTYPE_EX) { + bReg |= (UINT8)(sHSDet2Info.bKey2OffIrqType << 7); + bReg |= (UINT8)(sHSDet2Info.bKey1OffIrqType << 6); + bReg |= (UINT8)(sHSDet2Info.bKey0OffIrqType << 5); + } else { + bReg |= (UINT8)(sHSDetInfo.bIrqType << 7); + bReg |= (UINT8)(sHSDetInfo.bIrqType << 6); + bReg |= (UINT8)(sHSDetInfo.bIrqType << 5); + } + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_CD + | (UINT32)MCI_IRQM_KEYOFF, + bReg); + } + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_CD + | (UINT32)MCI_HSDETMODE, + sHSDetInfo.bHsDetMode); + bReg = (UINT8)(sHSDetInfo.bSperiod<<3) + | MCB_DBNC_LPERIOD; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_CD + | (UINT32)MCI_DBNC_PERIOD, + bReg); + bReg = (UINT8)((sHSDetInfo.bDbncNumPlug<<4) + | (sHSDetInfo.bDbncNumMic<<2) + | sHSDetInfo.bDbncNumKey); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_CD + | (UINT32)MCI_DBNC_NUM, + bReg); + bReg = (UINT8)((sHSDetInfo.bKeyOffMtim<<1) + | sHSDetInfo.bKeyOnMtim); + if (McDevProf_GetDevId() != + eMCDRV_DEV_ID_80_90H) { + ; + bReg |= MCI_KEY_MTIM_DEF; + } + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_CD + | (UINT32)MCI_KEY_MTIM, + bReg); + bReg = (UINT8)((sHSDetInfo.bKey0OnDlyTim2<<4) + | sHSDetInfo.bKey0OnDlyTim); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_CD + | (UINT32)MCI_KEYONDLYTIM_K0, + bReg); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_CD + | (UINT32)MCI_KEYOFFDLYTIM_K0, + sHSDetInfo.bKey0OffDlyTim); + bReg = (UINT8)((sHSDetInfo.bKey1OnDlyTim2<<4) + | sHSDetInfo.bKey1OnDlyTim); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_CD + | (UINT32)MCI_KEYONDLYTIM_K1, + bReg); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_CD + | (UINT32)MCI_KEYOFFDLYTIM_K1, + sHSDetInfo.bKey1OffDlyTim); + bReg = (UINT8)((sHSDetInfo.bKey2OnDlyTim2<<4) + | sHSDetInfo.bKey2OnDlyTim); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_CD + | (UINT32)MCI_KEYONDLYTIM_K2, + bReg); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_CD + | (UINT32)MCI_KEYOFFDLYTIM_K2, + sHSDetInfo.bKey2OffDlyTim); + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McPacket_AddHSDet", NULL); +#endif +} + +/**************************************************************************** + * McPacket_AddMKDetEnable + * + * Description: + * Add Mic/Key Det Enable packet. + * Arguments: + * bCheckPlugDetDB 1:check PlugDetDB + * Return: + * none + * + ****************************************************************************/ +void McPacket_AddMKDetEnable( + UINT8 bCheckPlugDetDB +) +{ + UINT8 bReg; + struct MCDRV_HSDET_INFO sHSDetInfo; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McPacket_AddMKDetEnable"); +#endif + if (bCheckPlugDetDB != 0) { + bReg = McResCtrl_GetPlugDetDB(); + if ((bReg&MCB_RPLUGDET_DB) == 0) { + ; + goto exit; + } + } + + McResCtrl_GetHSDet(&sHSDetInfo, NULL); + + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_ANA, MCI_AP); + bReg &= (UINT8)~MCB_AP_BGR; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_AP, + bReg); + + bReg = + McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_ANA, MCI_KDSET); + bReg &= ~MCB_KDSET2; + bReg |= MCB_KDSET1; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_KDSET, + bReg); + + McDevIf_AddPacket(MCDRV_PACKET_TYPE_TIMWAIT + | 2000UL, + 0); + + bReg &= ~MCB_KDSET1; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_KDSET, + bReg); + + bReg |= MCB_KDSET2; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_KDSET, + bReg); + + McDevIf_AddPacket(MCDRV_PACKET_TYPE_TIMWAIT + | 4000UL, + 0); + + bReg = (UINT8)(MCB_HSDETEN | MCB_MKDETEN | sHSDetInfo.bHsDetDbnc); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_CD + | (UINT32)MCI_HSDETEN, + bReg); + +exit:; +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McPacket_AddMKDetEnable", NULL); +#endif +} + +/**************************************************************************** + * McPacket_AddAEC + * + * Description: + * Add AEC packet. + * Arguments: + * none + * Return: + * none + * + ****************************************************************************/ +void McPacket_AddAEC( + void +) +{ + UINT8 bReg; + struct MCDRV_AEC_INFO sInfo; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McPacket_AddAEC"); +#endif + + McResCtrl_GetAecInfo(&sInfo); + + if (sInfo.sAecVBox.sAecCDspDbg.bJtagOn == 1) { + bReg = 0x01; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_DO0_DRV, + bReg); + bReg = 0x22; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_DO1_DRV, + bReg); + } + + if (sInfo.sAecConfig.bFDspLocate == 0) + bReg = MCB_FDSP_PI_SOURCE_AE; + else + bReg = MCB_FDSP_EX_SYNC | MCB_FDSP_PI_SOURCE_VDSP_Ex; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MA + | (UINT32)MCI_FDSP_PI_SOURCE, + bReg); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MA + | (UINT32)MCI_FDSP_PO_SOURCE, + sInfo.sAecVBox.bFdsp_Po_Source); + + bReg = (UINT8)(sInfo.sAecAudioengine.bMixerIn3Src<<7) + | (UINT8)(sInfo.sAecAudioengine.bMixerIn2Src<<6) + | (UINT8)(sInfo.sAecAudioengine.bMixerIn1Src<<5) + | (UINT8)(sInfo.sAecAudioengine.bMixerIn0Src<<4) + | (UINT8)(sInfo.sAecAudioengine.bBDspAE1Src<<1) + | sInfo.sAecAudioengine.bBDspAE0Src; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MA + | (UINT32)MCI_BDSP_SOURCE, + bReg); + + bReg = (UINT8)(sInfo.sAecVBox.bLPt2_VSource<<5) + | (UINT8)(sInfo.sAecVBox.bISrc3_VSource<<4) + | (UINT8)(sInfo.sAecVBox.bISrc2_Ch1_VSource<<3) + | (UINT8)(sInfo.sAecVBox.bISrc2_VSource<<2) + | sInfo.sAecVBox.bSrc3_Ctrl; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MA + | (UINT32)MCI_SRC_VSOURCE, + bReg); + bReg = (UINT8)(sInfo.sAecVBox.bLPt2_Mix_VolO<<4) + | sInfo.sAecVBox.bLPt2_Mix_VolI; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_MA + | (UINT32)MCI_LPT2_MIX_VOL, + bReg); + + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_A, MCI_PCMOUT_HIZ); + bReg &= (MCB_PCMOUT2_HIZ|MCB_PCMOUT1_HIZ|MCB_PCMOUT0_HIZ); + bReg |= sInfo.sPdm.bPdm1_Data_Delay<<5; + bReg |= sInfo.sPdm.bPdm0_Data_Delay<<4; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_PCMOUT_HIZ, + bReg); + SetupEReg(); + + bReg = (UINT8)(sInfo.sOutput.bDng_Release<<4) + | sInfo.sOutput.bDng_Attack; + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H) { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_DNG_ES1, + bReg); + + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_DNG_HP_ES1, + sInfo.sOutput.bDng_Target[0]); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_DNG_SP_ES1, + sInfo.sOutput.bDng_Target[1]); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_DNG_RC_ES1, + sInfo.sOutput.bDng_Target_Rc); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_DNG_LO1_ES1, + sInfo.sOutput.bDng_Target_LineOut[0]); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_DNG_LO2_ES1, + sInfo.sOutput.bDng_Target_LineOut[1]); + } else { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_DNG, + bReg); + + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_DNG_HP, + sInfo.sOutput.bDng_Target[0]); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_DNG_SP, + sInfo.sOutput.bDng_Target[1]); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_DNG_RC, + sInfo.sOutput.bDng_Target_Rc); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_DNG_LO1, + sInfo.sOutput.bDng_Target_LineOut[0]); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_ANA + | (UINT32)MCI_DNG_LO2, + sInfo.sOutput.bDng_Target_LineOut[1]); + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McPacket_AddAEC", NULL); +#endif +} + + +/**************************************************************************** + * McPacket_AddGPMode + * + * Description: + * Add GP mode setup packet. + * Arguments: + * none + * Return: + * none + * + ****************************************************************************/ +void McPacket_AddGPMode( + void +) +{ + UINT8 bReg; + struct MCDRV_INIT_INFO sInitInfo; + struct MCDRV_GP_MODE sGPMode; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McPacket_AddGPMode"); +#endif + + McResCtrl_GetInitInfo(&sInitInfo, NULL); + McResCtrl_GetGPMode(&sGPMode); + + if (sInitInfo.bPa0Func == MCDRV_PA_GPIO) { + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_A, MCI_PA0); + if (sGPMode.abGpDdr[0] == MCDRV_GPDDR_IN) + bReg &= (UINT8)~MCB_PA0_DDR; + else + bReg |= MCB_PA0_DDR; + if (sGPMode.abGpHost[0] == MCDRV_GPHOST_CPU) + bReg &= (UINT8)~MCB_PA0_OUTSEL; + else + bReg |= MCB_PA0_OUTSEL; + if (sGPMode.abGpInvert[0] == MCDRV_GPINV_NORMAL) + bReg &= (UINT8)~MCB_PA0_INV; + else + bReg |= MCB_PA0_INV; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_PA0, + bReg); + } + if (sInitInfo.bPa1Func == MCDRV_PA_GPIO) { + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_A, MCI_PA1); + if (sGPMode.abGpDdr[1] == MCDRV_GPDDR_IN) + bReg &= (UINT8)~MCB_PA1_DDR; + else + bReg |= MCB_PA1_DDR; + if (sGPMode.abGpHost[1] == MCDRV_GPHOST_CPU) + bReg &= (UINT8)~MCB_PA1_OUTSEL; + else + bReg |= MCB_PA1_OUTSEL; + if (sGPMode.abGpInvert[1] == MCDRV_GPINV_NORMAL) + bReg &= (UINT8)~MCB_PA1_INV; + else + bReg |= MCB_PA1_INV; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_PA1, + bReg); + } + if (sInitInfo.bPa2Func == MCDRV_PA_GPIO) { + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_A, MCI_PA2); + if (sGPMode.abGpDdr[2] == MCDRV_GPDDR_IN) + bReg &= (UINT8)~MCB_PA2_DDR; + else + bReg |= MCB_PA2_DDR; + if (sGPMode.abGpHost[2] == MCDRV_GPHOST_CPU) + bReg &= (UINT8)~MCB_PA2_OUTSEL; + else + bReg |= MCB_PA2_OUTSEL; + if (sGPMode.abGpInvert[2] == MCDRV_GPINV_NORMAL) + bReg &= (UINT8)~MCB_PA2_INV; + else + bReg |= MCB_PA2_INV; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_PA2, + bReg); + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McPacket_AddGPMode", NULL); +#endif +} + +/**************************************************************************** + * McPacket_AddGPMask + * + * Description: + * Add GP mask setup packet. + * Arguments: + * dPadNo PAD Number + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR + * + ****************************************************************************/ +void McPacket_AddGPMask( + UINT32 dPadNo +) +{ + UINT8 bReg; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McPacket_AddGPMask"); +#endif + + switch (dPadNo) { + case 0: + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_A, MCI_PA0); + if (McResCtrl_GetGPMask(dPadNo) == MCDRV_GPMASK_OFF) + bReg &= (UINT8)~MCB_PA0_MSK; + else + bReg |= MCB_PA0_MSK; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_PA0, + bReg); + break; + case 1: + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_A, MCI_PA1); + if (McResCtrl_GetGPMask(dPadNo) == MCDRV_GPMASK_OFF) + bReg &= (UINT8)~MCB_PA1_MSK; + else + bReg |= MCB_PA1_MSK; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_PA1, + bReg); + break; + case 2: + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_A, MCI_PA2); + if (McResCtrl_GetGPMask(dPadNo) == MCDRV_GPMASK_OFF) + bReg &= (UINT8)~MCB_PA2_MSK; + else + bReg |= MCB_PA2_MSK; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_PA2, + bReg); + break; + default: + break; + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McPacket_AddGPMask", NULL); +#endif +} + +/**************************************************************************** + * McPacket_AddGPSet + * + * Description: + * Add GPIO output packet. + * Arguments: + * dPadNo PAD Number + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR + * + ****************************************************************************/ +void McPacket_AddGPSet( + UINT32 dPadNo +) +{ + UINT8 bReg; + struct MCDRV_INIT_INFO sInitInfo; + struct MCDRV_GP_MODE sGPMode; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McPacket_AddGPSet"); +#endif + + McResCtrl_GetInitInfo(&sInitInfo, NULL); + McResCtrl_GetGPMode(&sGPMode); + + switch (dPadNo) { + case 0: + if ((sInitInfo.bPa0Func == MCDRV_PA_GPIO) + && (sGPMode.abGpDdr[0] == MCDRV_GPDDR_OUT) + && (sGPMode.abGpHost[0] == MCDRV_GPHOST_CPU)) { + bReg = + McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_A, MCI_PA0); + bReg &= (UINT8)~MCB_PA0_DATA; + bReg |= McResCtrl_GetGPPad(dPadNo)<<4; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_PA0, + bReg); + } + break; + case 1: + if ((sInitInfo.bPa1Func == MCDRV_PA_GPIO) + && (sGPMode.abGpDdr[1] == MCDRV_GPDDR_OUT) + && (sGPMode.abGpHost[1] == MCDRV_GPHOST_CPU)) { + bReg = + McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_A, MCI_PA1); + bReg &= (UINT8)~MCB_PA1_DATA; + bReg |= McResCtrl_GetGPPad(dPadNo)<<4; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_PA1, + bReg); + } + break; + case 2: + if ((sInitInfo.bPa2Func == MCDRV_PA_GPIO) + && (sGPMode.abGpDdr[2] == MCDRV_GPDDR_OUT) + && (sGPMode.abGpHost[2] == MCDRV_GPHOST_CPU)) { + bReg = + McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_A, MCI_PA2); + bReg &= (UINT8)~MCB_PA2_DATA; + bReg |= McResCtrl_GetGPPad(dPadNo)<<4; + McDevIf_AddPacket(MCDRV_PACKET_TYPE_WRITE + | MCDRV_PACKET_REGTYPE_A + | (UINT32)MCI_PA2, + bReg); + } + break; + default: + break; + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McPacket_AddGPSet", NULL); +#endif +} + +/**************************************************************************** + * DSPCallback + * + * Description: + * DSP callback function. + * Arguments: + * sdHd function no. + * dEvtType event type + * dEvtPrm event param + * Return: + * 0 + * + ****************************************************************************/ +static SINT32 DSPCallback( + SINT32 sdHd, + UINT32 dEvtType, + UINT32 dEvtPrm +) +{ + SINT32 sdRet = MCDRV_ERROR; + UINT8 bReg; + SINT32 (*pcbfunc)(SINT32, UINT32, UINT32); + + McSrv_Unlock(); + if (dEvtType == FDSP_CB_RESET) { + bReg = McResCtrl_GetRegVal(MCDRV_PACKET_REGTYPE_IF, + MCI_RST); + if ((bReg&MCB_PSW_F) == 0) { + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_RST, + (UINT8)(bReg|MCB_RST_F)); + McDevIf_AddPacket(MCDRV_PACKET_TYPE_FORCE_WRITE + | MCDRV_PACKET_REGTYPE_IF + | (UINT32)MCI_RST, + bReg); + sdRet = McDevIf_ExecutePacket(); + } else { + sdRet = MCDRV_SUCCESS; + } + goto exit; + } + + McResCtrl_GetDSPCBFunc(&pcbfunc); + if (pcbfunc != NULL) { + ; + sdRet = (pcbfunc)(sdHd, dEvtType, dEvtPrm); + } +exit: + McSrv_Lock(); + return sdRet; +} + +/**************************************************************************** + * GetMaxWait + * + * Description: + * Get maximum wait time. + * Arguments: + * bRegChange analog power management + * register update information + * Return: + * wait time + * + ****************************************************************************/ +static UINT32 GetMaxWait +( + UINT8 bRegChange +) +{ + UINT32 dWaitTimeMax = 0; + struct MCDRV_INIT_INFO sInitInfo; + +#if (MCDRV_DEBUG_LEVEL >= 4) + SINT32 sdRet; + McDebugLog_FuncIn("GetMaxWait"); +#endif + + McResCtrl_GetInitInfo(&sInitInfo, NULL); + + if (((bRegChange & MCB_MC1) != 0) + || ((bRegChange & MCB_MB1) != 0)) + if (sInitInfo.sWaitTime.dWaitTime[0] > dWaitTimeMax) + dWaitTimeMax = sInitInfo.sWaitTime.dWaitTime[0]; + + if (((bRegChange & MCB_MC2) != 0) + || ((bRegChange & MCB_MB2) != 0)) + if (sInitInfo.sWaitTime.dWaitTime[1] > dWaitTimeMax) + dWaitTimeMax = sInitInfo.sWaitTime.dWaitTime[1]; + + if (((bRegChange & MCB_MC3) != 0) + || ((bRegChange & MCB_MB3) != 0)) + if (sInitInfo.sWaitTime.dWaitTime[2] > dWaitTimeMax) + dWaitTimeMax = sInitInfo.sWaitTime.dWaitTime[2]; + + if (((bRegChange & MCB_MC4) != 0) + || ((bRegChange & MCB_MB4) != 0)) + if (sInitInfo.sWaitTime.dWaitTime[3] > dWaitTimeMax) + dWaitTimeMax = sInitInfo.sWaitTime.dWaitTime[3]; + +#if (MCDRV_DEBUG_LEVEL >= 4) + sdRet = (SINT32)dWaitTimeMax; + McDebugLog_FuncOut("GetMaxWait", &sdRet); +#endif + + return dWaitTimeMax; +} + + diff --git a/sound/soc/codecs/ymu831/mcpacking.h b/sound/soc/codecs/ymu831/mcpacking.h new file mode 100644 index 00000000000..85e99626654 --- /dev/null +++ b/sound/soc/codecs/ymu831/mcpacking.h @@ -0,0 +1,122 @@ +/**************************************************************************** + * + * Copyright(c) 2012 Yamaha Corporation. All rights reserved. + * + * Module : mcpacking.h + * + * Description : MC Driver Packet packing header + * + * Version : 1.0.0 2012.12.13 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + * + ****************************************************************************/ + +#ifndef _MCPACKING_H_ +#define _MCPACKING_H_ + +#include "mctypedef.h" +#include "mcdriver.h" + +/* volume update */ +enum MCDRV_VOLUPDATE_MODE { + eMCDRV_VOLUPDATE_MUTE, + eMCDRV_VOLUPDATE_ALL +}; + +#define MCDRV_VOLUPDATE_ALL (0xFFFFFFFFUL) +#define MCDRV_VOLUPDATE_ANA_OUT (0x00000001UL) +#define MCDRV_VOLUPDATE_ANA_IN (0x00000100UL) +#define MCDRV_VOLUPDATE_DIN0 (0x00010000UL) +#define MCDRV_VOLUPDATE_DIN1 (0x00020000UL) +#define MCDRV_VOLUPDATE_DIN2 (0x00040000UL) +#define MCDRV_VOLUPDATE_DIN3 (0x00080000UL) +#define MCDRV_VOLUPDATE_ADIF0 (0x00100000UL) +#define MCDRV_VOLUPDATE_ADIF1 (0x00200000UL) +#define MCDRV_VOLUPDATE_ADIF2 (0x00400000UL) +#define MCDRV_VOLUPDATE_DIN (0x00FF0000UL) +#define MCDRV_VOLUPDATE_DOUT0 (0x01000000UL) +#define MCDRV_VOLUPDATE_DOUT1 (0x02000000UL) +#define MCDRV_VOLUPDATE_DOUT2 (0x04000000UL) +#define MCDRV_VOLUPDATE_DOUT3 (0x08000000UL) +#define MCDRV_VOLUPDATE_DAC0 (0x10000000UL) +#define MCDRV_VOLUPDATE_DAC1 (0x20000000UL) +#define MCDRV_VOLUPDATE_DPATHDA (0x80000000UL) +#define MCDRV_VOLUPDATE_DOUT (0xFF000000UL) +#define MCDRV_VOLUPDATE_DIG (0xFFFF0000UL) + +/* power setting */ +struct MCDRV_POWER_INFO { + UINT8 bDigital; + UINT8 abAnalog[5]; +}; + +#define MCDRV_POWINFO_D_PLL_PD (0x80) +#define MCDRV_POWINFO_D_PE_CLK_PD (0x20) +#define MCDRV_POWINFO_D_PB_CLK_PD (0x10) +#define MCDRV_POWINFO_D_PM_CLK_PD (0x08) +#define MCDRV_POWINFO_D_PF_CLK_PD (0x04) +#define MCDRV_POWINFO_D_PC_CLK_PD (0x02) + +/* power update */ +struct MCDRV_POWER_UPDATE { + UINT8 bDigital; + UINT8 abAnalog[5]; +}; + +#define MCDRV_POWUPDATE_D_ALL (0xFF) +#define MCDRV_POWUPDATE_AP (0x3F) +#define MCDRV_POWUPDATE_AP_OUT0 (0x7F) +#define MCDRV_POWUPDATE_AP_OUT1 (0xFF) +#define MCDRV_POWUPDATE_AP_MC (0xFF) +#define MCDRV_POWUPDATE_AP_IN (0x87) + + + +SINT32 McPacket_AddInit(void); +void McPacket_AddClockSw(void); +SINT32 McPacket_AddPowerUp(const struct MCDRV_POWER_INFO *psPowerInfo, + const struct MCDRV_POWER_UPDATE *psPowerUpdate + ); +SINT32 McPacket_AddPowerDown(const struct MCDRV_POWER_INFO *psPowerInfo, + const struct MCDRV_POWER_UPDATE *psPowerUpdate + ); +void McPacket_AddPathSet(void); +void McPacket_AddStop(void); +void McPacket_AddDSPStartStop(UINT8 bDSPStarted); +void McPacket_AddFDSPStop(UINT8 bDSPStarted); +void McPacket_AddStart(void); +void McPacket_AddVol(UINT32 dUpdate, + enum MCDRV_VOLUPDATE_MODE eMode, + UINT32 *pdSVolDoneParam); +void McPacket_AddDac0Mute(void); +void McPacket_AddDac1Mute(void); +void McPacket_AddDOutMute(void); +void McPacket_AddAdifMute(void); +void McPacket_AddDPathDAMute(void); +void McPacket_AddDigitalIO(UINT32 dUpdateInfo); +void McPacket_AddDigitalIOPath(void); +void McPacket_AddSwap(UINT32 dUpdateInfo); +void McPacket_AddHSDet(void); +void McPacket_AddMKDetEnable(UINT8 bCheckPlugDetDB); +void McPacket_AddAEC(void); +void McPacket_AddGPMode(void); +void McPacket_AddGPMask(UINT32 dPadNo); +void McPacket_AddGPSet(UINT32 dPadNo); + + +#endif /* _MCPACKING_H_ */ diff --git a/sound/soc/codecs/ymu831/mcparser.c b/sound/soc/codecs/ymu831/mcparser.c new file mode 100644 index 00000000000..1501db57b0f --- /dev/null +++ b/sound/soc/codecs/ymu831/mcparser.c @@ -0,0 +1,1431 @@ +/**************************************************************************** + * + * Copyright(c) 2012-2013 Yamaha Corporation. All rights reserved. + * + * Module : mcparser.c + * + * Description : MC Driver parse control + * + * Version : 2.0.1 2013.04.22 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + * + ****************************************************************************/ + + +#include "mcdriver.h" +#include "mcparser.h" +#include "mcmachdep.h" +#include "mcdevprof.h" +#include "mcbdspdrv.h" +#include "mccdspdrv.h" +#include "mcedspdrv.h" +#include "mcfdspdrv.h" + +#if MCDRV_DEBUG_LEVEL +#include "mcdebuglog.h" +#endif + + + + +#define AEC_MIN_BYTES (12) +#define AEC_REVISION (5) +#define AEC_TARGET (253) +#define AEC_D7_MIN_BYTES (6) +#define AEC_D7_CHUNK_CONFIG (0x01000000) +#define AEC_D7_CHUNK_AE (0x02000000) +#define AEC_D7_CHUNK_BDSP_ES1 (0x00010000) +#define AEC_D7_CHUNK_BDSP (0x00010001) +#define AEC_D7_CHUNK_FDSP_ES1 (0x00020000) +#define AEC_D7_CHUNK_FDSP (0x00020001) +#define AEC_D7_CHUNK_VBOX (0x03000000) +#define AEC_D7_CHUNK_CDSPA (0x00030000) +#define AEC_D7_CHUNK_CDSPB (0x00030001) +#define AEC_D7_CHUNK_CDSP_DEBUG (0x00050000) +#define AEC_D7_CHUNK_OUTPUT0_ES1 (0x04000000) +#define AEC_D7_CHUNK_OUTPUT1_ES1 (0x04000001) +#define AEC_D7_CHUNK_OUTPUT0 (0x04000002) +#define AEC_D7_CHUNK_OUTPUT1 (0x04000003) +#define AEC_D7_CHUNK_SYSEQ_EX (0x00060000) +#define AEC_D7_CHUNK_INPUT0 (0x05000000) +#define AEC_D7_CHUNK_INPUT1 (0x05000001) +#define AEC_D7_CHUNK_INPUT2 (0x05000002) +#define AEC_D7_CHUNK_PDM (0x06000000) +#define AEC_D7_CHUNK_E2 (0x07000000) +#define AEC_D7_CHUNK_E2_CONFIG (0x00040000) +#define AEC_D7_CHUNK_ADJ (0x08000000) +#define AEC_D7_CHUNK_EDSP_MISC (0x09000000) +#define AEC_D7_CHUNK_CONTROL (0x0A000000) + + +static SINT32 AnalyzeAESubChunk( + const UINT8 * pbPrm, + UINT32 *pdPos, + UINT32 *pdSubChunkSize, + struct MCDRV_AEC_INFO *psAECInfo); +static SINT32 AnalyzeVBoxSubChunk( + const UINT8 * pbPrm, + UINT32 *pdPos, + UINT32 *pdSubChunkSize, + struct MCDRV_AEC_INFO *psAECInfo); +static SINT32 AnalyzeSysEqExSubChunk( + const UINT8 * pbPrm, + UINT32 *pdPos, + UINT32 *pdSubChunkSize, + struct MCDRV_AEC_SYSEQ_EX *psSysEqEx); +static SINT32 AnalyzeEDSPSubChunk( + const UINT8 * pbPrm, + UINT32 *pdPos, + UINT32 *pdSubChunkSize, + struct MCDRV_AEC_INFO *psAECInfo); + +/**************************************************************************** + * CreateUINT32 + * + * Description: + * Create UINT32 Value + * Arguments: + * b0 31-24bit value + * b1 23-16bit value + * b2 15-8bit value + * b3 7-0bit value + * Return: + * UINT32 Value + * + ****************************************************************************/ +static UINT32 CreateUINT32(UINT8 b0, UINT8 b1, UINT8 b2, UINT8 b3) +{ + return ((UINT32)b0 << 24) | ((UINT32)b1 << 16) + | ((UINT32)b2 << 8) | (UINT32)b3; +} + +/**************************************************************************** + * McParser_GetD7Chunk + * + * Description: + * D7 chunk acquisition + * Arguments: + * pbPrm AEC data pointer + * dSize data size + * psD7Info MCDRV_AEC_D7_INFO structure pointer + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR_ARGUMENT + * + ****************************************************************************/ +SINT32 McParser_GetD7Chunk( + const UINT8 *pbPrm, + UINT32 dSize, + struct MCDRV_AEC_D7_INFO *psD7Info +) +{ + SINT32 sdRet = MCDRV_SUCCESS; + UINT32 dDataSize; + UINT32 dChunkSize; + UINT32 dPos; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn(""); +#endif + if (dSize < (UINT32)AEC_MIN_BYTES) { + sdRet = MCDRV_ERROR_ARGUMENT; + goto exit; + } + + /* header */ + if ((pbPrm[0] != 0x41) + || (pbPrm[1] != 0x45) + || (pbPrm[2] != 0x43)) { + sdRet = MCDRV_ERROR_ARGUMENT; + goto exit; + } + + /* revision */ + if (pbPrm[3] != AEC_REVISION) { + sdRet = MCDRV_ERROR_ARGUMENT; + goto exit; + } + + /* size */ + dDataSize = CreateUINT32(pbPrm[4], pbPrm[5], pbPrm[6], pbPrm[7]); + if (dSize != (dDataSize + 8)) { + sdRet = MCDRV_ERROR_ARGUMENT; + goto exit; + } + + /* target */ + if (pbPrm[9] != AEC_TARGET) { + sdRet = MCDRV_ERROR_ARGUMENT; + goto exit; + } + + /* Reserved */ + if (pbPrm[11] != 0x00) { + sdRet = MCDRV_ERROR_ARGUMENT; + goto exit; + } + + /* D7 Chunk Search */ + psD7Info->pbChunkTop = NULL; + psD7Info->dChunkSize = 0; + dPos = AEC_MIN_BYTES; + + while ((dPos + AEC_D7_MIN_BYTES) < dSize) { + if ((pbPrm[dPos + 0] == 0x44) + && (pbPrm[dPos + 1] == 0x37)) { + if (psD7Info->pbChunkTop != NULL) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + + dChunkSize = CreateUINT32(pbPrm[dPos + 2], + pbPrm[dPos + 3], + pbPrm[dPos + 4], + pbPrm[dPos + 5]); + if ((dPos + AEC_D7_MIN_BYTES + dChunkSize) > dSize) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psD7Info->pbChunkTop + = &pbPrm[dPos + AEC_D7_MIN_BYTES]; + psD7Info->dChunkSize = dChunkSize; + } else { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + + /* Next Chunk */ + dPos += AEC_D7_MIN_BYTES; + dPos += dChunkSize; + } + + if (psD7Info->pbChunkTop == NULL) + sdRet = MCDRV_ERROR_ARGUMENT; + +exit: +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McParser_GetD7Chunk", &sdRet); +#endif + return sdRet; +} + +/**************************************************************************** + * McParser_AnalyzeD7Chunk + * + * Description: + * D7 chunk analysis + * Arguments: + * psD7Info MCDRV_AEC_D7_INFO structure pointer + * psAECInfo MCDRV_AEC_INFO structure pointer + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR_ARGUMENT + * + ****************************************************************************/ +SINT32 McParser_AnalyzeD7Chunk( + struct MCDRV_AEC_D7_INFO *psD7Info, + struct MCDRV_AEC_INFO *psAECInfo +) +{ + const UINT8 *pbPrm; + UINT32 dChunkEnd; + UINT32 dPos; + UINT32 dChunkId; + UINT32 dSubChunkSize; + SINT32 sdRet = MCDRV_SUCCESS; + int n; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McParser_AnalyzeD7Chunk"); +#endif + pbPrm = psD7Info->pbChunkTop; + dChunkEnd = psD7Info->dChunkSize-1; + + psAECInfo->sAecConfig.bFDspLocate = 0xFF; + psAECInfo->sAecAudioengine.bEnable = 0; + psAECInfo->sAecAudioengine.sAecBDsp.pbChunkData = NULL; + psAECInfo->sAecAudioengine.sAecBDsp.dwSize = 0; + psAECInfo->sAecAudioengine.sAecFDsp.pbChunkData = NULL; + psAECInfo->sAecAudioengine.sAecFDsp.dwSize = 0; + psAECInfo->sAecVBox.bEnable = 0; + psAECInfo->sAecVBox.sAecCDspA.pbChunkData = NULL; + psAECInfo->sAecVBox.sAecCDspA.dwSize = 0; + psAECInfo->sAecVBox.sAecCDspB.pbChunkData = NULL; + psAECInfo->sAecVBox.sAecCDspB.dwSize = 0; + psAECInfo->sAecVBox.sAecFDsp.pbChunkData = NULL; + psAECInfo->sAecVBox.sAecFDsp.dwSize = 0; + psAECInfo->sAecVBox.sAecCDspDbg.bJtagOn = 0xFF; + psAECInfo->sOutput.bLpf_Pre_Thru[0] = 0xFF; + psAECInfo->sOutput.bLpf_Pre_Thru[1] = 0xFF; + psAECInfo->sInput.bDsf32_L_Type[0] = 0xFF; + psAECInfo->sInput.bDsf32_L_Type[1] = 0xFF; + psAECInfo->sInput.bDsf32_L_Type[2] = 0xFF; + psAECInfo->sPdm.bMode = 0xFF; + psAECInfo->sE2.bEnable = 0; + psAECInfo->sE2.sE2Config.pbChunkData = NULL; + psAECInfo->sE2.sE2Config.dwSize = 0; + psAECInfo->sAdj.bHold = 0xFF; + psAECInfo->sEDspMisc.bI2SOut_Enb = 0xFF; + psAECInfo->sControl.bCommand = 0xFF; + + dPos = 0UL; + while (dPos <= dChunkEnd && sdRet == MCDRV_SUCCESS) { + if ((dPos + 8-1) > dChunkEnd) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + + dChunkId = CreateUINT32(pbPrm[dPos], + pbPrm[dPos+1], + pbPrm[dPos+2], + pbPrm[dPos+3]); + dSubChunkSize = CreateUINT32(pbPrm[dPos+4], + pbPrm[dPos+5], + pbPrm[dPos+6], + pbPrm[dPos+7]); + + dPos += 8; + if ((dPos + dSubChunkSize-1) > dChunkEnd) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + + switch (dChunkId) { + case AEC_D7_CHUNK_CONFIG: + if (dSubChunkSize != 1) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + if (psAECInfo->sAecConfig.bFDspLocate != 0xFF) { + /* already done */ + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + if (pbPrm[dPos] > 1) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sAecConfig.bFDspLocate = pbPrm[dPos++]; + dSubChunkSize = 0; + break; + case AEC_D7_CHUNK_AE: + if (dSubChunkSize < 8) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + if (psAECInfo->sAecAudioengine.bEnable != 0) { + /* already done */ + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sAecAudioengine.bEnable = 1; + if (pbPrm[dPos] > 2) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sAecAudioengine.bAEOnOff = pbPrm[dPos++]; + dSubChunkSize--; + if (pbPrm[dPos] > 2) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sAecAudioengine.bFDspOnOff = pbPrm[dPos++]; + dSubChunkSize--; + if (pbPrm[dPos] > 2) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sAecAudioengine.bBDspAE0Src = pbPrm[dPos++]; + dSubChunkSize--; + if (pbPrm[dPos] > 2) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sAecAudioengine.bBDspAE1Src = pbPrm[dPos++]; + dSubChunkSize--; + if (pbPrm[dPos] > 2) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sAecAudioengine.bMixerIn0Src = pbPrm[dPos++]; + dSubChunkSize--; + if (pbPrm[dPos] > 2) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sAecAudioengine.bMixerIn1Src = pbPrm[dPos++]; + dSubChunkSize--; + if (pbPrm[dPos] > 2) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sAecAudioengine.bMixerIn2Src = pbPrm[dPos++]; + dSubChunkSize--; + if (pbPrm[dPos] > 2) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sAecAudioengine.bMixerIn3Src = pbPrm[dPos++]; + dSubChunkSize--; + if (dSubChunkSize > 0) { + sdRet = AnalyzeAESubChunk(pbPrm, + &dPos, + &dSubChunkSize, + psAECInfo); + } + break; + case AEC_D7_CHUNK_VBOX: + if (dSubChunkSize < 15) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + if (psAECInfo->sAecVBox.bEnable != 0) { + /* already done */ + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sAecVBox.bEnable = 1; + if (pbPrm[dPos] > 2) { + if (pbPrm[dPos] != 0x11) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + } + psAECInfo->sAecVBox.bCDspFuncAOnOff = pbPrm[dPos++]; + dSubChunkSize--; + if (pbPrm[dPos] > 2) { + if (pbPrm[dPos] != 0x11) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + } + psAECInfo->sAecVBox.bCDspFuncBOnOff = pbPrm[dPos++]; + dSubChunkSize--; + if (pbPrm[dPos] > 2) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sAecVBox.bFDspOnOff = pbPrm[dPos++]; + dSubChunkSize--; + if ((pbPrm[dPos] > 0x3F) + && (pbPrm[dPos] < 0xFF)) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sAecVBox.bFdsp_Po_Source = pbPrm[dPos++]; + dSubChunkSize--; + if ((pbPrm[dPos] > 1) + && (pbPrm[dPos] < 0xFF)) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sAecVBox.bISrc2_VSource = pbPrm[dPos++]; + dSubChunkSize--; + if ((pbPrm[dPos] > 1) + && (pbPrm[dPos] < 0xFF)) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sAecVBox.bISrc2_Ch1_VSource = pbPrm[dPos++]; + dSubChunkSize--; + if ((pbPrm[dPos] > 1) + && (pbPrm[dPos] < 0xFF)) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sAecVBox.bISrc3_VSource = pbPrm[dPos++]; + dSubChunkSize--; + if ((pbPrm[dPos] > 1) + && (pbPrm[dPos] < 0xFF)) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sAecVBox.bLPt2_VSource = pbPrm[dPos++]; + dSubChunkSize--; + if ((pbPrm[dPos] > 3) + && (pbPrm[dPos] < 0xFF)) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sAecVBox.bLPt2_Mix_VolO = pbPrm[dPos++]; + dSubChunkSize--; + if ((pbPrm[dPos] > 3) + && (pbPrm[dPos] < 0xFF)) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sAecVBox.bLPt2_Mix_VolI = pbPrm[dPos++]; + dSubChunkSize--; + if ((pbPrm[dPos] > 3) + && (pbPrm[dPos] < 0xFF)) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sAecVBox.bSrc3_Ctrl = pbPrm[dPos++]; + dSubChunkSize--; + if ((pbPrm[dPos] == 3) + || (pbPrm[dPos] == 7) + || (pbPrm[dPos] == 11) + || ((pbPrm[dPos] > 13) && (pbPrm[dPos] < 0xFF))) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sAecVBox.bSrc2_Fs = pbPrm[dPos++]; + dSubChunkSize--; + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H) { + if ((pbPrm[dPos] > 1) + && (pbPrm[dPos] < 0xFF)) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sAecVBox.bSrc2_Thru = pbPrm[dPos++]; + } else { + dPos++; + } + dSubChunkSize--; + if ((pbPrm[dPos] == 3) + || (pbPrm[dPos] == 7) + || (pbPrm[dPos] == 11) + || ((pbPrm[dPos] > 13) && (pbPrm[dPos] < 0xFF))) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sAecVBox.bSrc3_Fs = pbPrm[dPos++]; + dSubChunkSize--; + if ((pbPrm[dPos] > 1) + && (pbPrm[dPos] < 0xFF)) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sAecVBox.bSrc3_Thru = pbPrm[dPos++]; + dSubChunkSize--; + if (dSubChunkSize > 0) { + sdRet = AnalyzeVBoxSubChunk(pbPrm, + &dPos, + &dSubChunkSize, + psAECInfo); + } + break; + + case AEC_D7_CHUNK_OUTPUT0_ES1: + case AEC_D7_CHUNK_OUTPUT1_ES1: + case AEC_D7_CHUNK_OUTPUT0: + case AEC_D7_CHUNK_OUTPUT1: + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H) { + if ((dChunkId != AEC_D7_CHUNK_OUTPUT0_ES1) + && (dChunkId != AEC_D7_CHUNK_OUTPUT1_ES1)) { + ; + break; + } + n = dChunkId - AEC_D7_CHUNK_OUTPUT0_ES1; + } else { + if ((dChunkId != AEC_D7_CHUNK_OUTPUT0) + && (dChunkId != AEC_D7_CHUNK_OUTPUT1)) { + ; + break; + } + n = dChunkId - AEC_D7_CHUNK_OUTPUT0; + } + if (dSubChunkSize < 47) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + if (psAECInfo->sOutput.bLpf_Pre_Thru[n] != 0xFF) { + /* already done */ + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + if (pbPrm[dPos] > 1) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sOutput.bLpf_Pre_Thru[n] = pbPrm[dPos++]; + if (pbPrm[dPos] > 1) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sOutput.bLpf_Post_Thru[n] = pbPrm[dPos++]; + if (pbPrm[dPos] > 3) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sOutput.bDcc_Sel[n] = pbPrm[dPos++]; + if (pbPrm[dPos] > 5) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sOutput.bSig_Det_Lvl = pbPrm[dPos++]; + if (pbPrm[dPos] > 3) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sOutput.bPow_Det_Lvl[n] = pbPrm[dPos++]; + if (pbPrm[dPos] > 3) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sOutput.bOsf_Sel[n] = pbPrm[dPos++]; + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H) { + if (pbPrm[dPos] > 1) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + } else { + if (pbPrm[dPos] > 7) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + } + psAECInfo->sOutput.bSys_Eq_Enb[n] = pbPrm[dPos++]; + psAECInfo->sOutput.bSys_Eq_Coef_A0[n][0] + = pbPrm[dPos++]; + psAECInfo->sOutput.bSys_Eq_Coef_A0[n][1] + = pbPrm[dPos++]; + psAECInfo->sOutput.bSys_Eq_Coef_A0[n][2] + = pbPrm[dPos++]; + psAECInfo->sOutput.bSys_Eq_Coef_A1[n][0] + = pbPrm[dPos++]; + psAECInfo->sOutput.bSys_Eq_Coef_A1[n][1] + = pbPrm[dPos++]; + psAECInfo->sOutput.bSys_Eq_Coef_A1[n][2] + = pbPrm[dPos++]; + psAECInfo->sOutput.bSys_Eq_Coef_A2[n][0] + = pbPrm[dPos++]; + psAECInfo->sOutput.bSys_Eq_Coef_A2[n][1] + = pbPrm[dPos++]; + psAECInfo->sOutput.bSys_Eq_Coef_A2[n][2] + = pbPrm[dPos++]; + psAECInfo->sOutput.bSys_Eq_Coef_B1[n][0] + = pbPrm[dPos++]; + psAECInfo->sOutput.bSys_Eq_Coef_B1[n][1] + = pbPrm[dPos++]; + psAECInfo->sOutput.bSys_Eq_Coef_B1[n][2] + = pbPrm[dPos++]; + psAECInfo->sOutput.bSys_Eq_Coef_B2[n][0] + = pbPrm[dPos++]; + psAECInfo->sOutput.bSys_Eq_Coef_B2[n][1] + = pbPrm[dPos++]; + psAECInfo->sOutput.bSys_Eq_Coef_B2[n][2] + = pbPrm[dPos++]; + if (pbPrm[dPos] > 7) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sOutput.bClip_Md[n] = pbPrm[dPos++]; + psAECInfo->sOutput.bClip_Att[n] = pbPrm[dPos++]; + psAECInfo->sOutput.bClip_Rel[n] = pbPrm[dPos++]; + psAECInfo->sOutput.bClip_G[n] = pbPrm[dPos++]; + psAECInfo->sOutput.bOsf_Gain[n][0] = pbPrm[dPos++]; + psAECInfo->sOutput.bOsf_Gain[n][1] = pbPrm[dPos++]; + if (pbPrm[dPos] > 1) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sOutput.bDcl_OnOff[n] = pbPrm[dPos++]; + if (pbPrm[dPos] > 3) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sOutput.bDcl_Gain[n] = pbPrm[dPos++]; + if (pbPrm[dPos] > 0x7F) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sOutput.bDcl_Limit[n][0] = pbPrm[dPos++]; + psAECInfo->sOutput.bDcl_Limit[n][1] = pbPrm[dPos++]; + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H) { + if (pbPrm[dPos] > 1) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sOutput.bRandom_Dither_OnOff[n] + = pbPrm[dPos++]; + } else { + dPos++; + } + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H) { + if (pbPrm[dPos] > 3) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sOutput.bRandom_Dither_Level[n] + = pbPrm[dPos++]; + } else { + dPos++; + } + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H) { + if (pbPrm[dPos] > 1) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sOutput.bRandom_Dither_POS[n] + = pbPrm[dPos++]; + } else { + dPos++; + } + if (pbPrm[dPos] > 1) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sOutput.bDc_Dither_OnOff[n] = pbPrm[dPos++]; + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H) { + if (pbPrm[dPos] > 15) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sOutput.bDc_Dither_Level[n] + = pbPrm[dPos++]; + } else { + dPos++; + } + if (pbPrm[dPos] > 1) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sOutput.bDither_Type[n] = pbPrm[dPos++]; + if (pbPrm[dPos] > 1) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sOutput.bDng_On[n] = pbPrm[dPos++]; + if (pbPrm[dPos] > 31) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sOutput.bDng_Zero[n] = pbPrm[dPos++]; + if (pbPrm[dPos] > 2) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sOutput.bDng_Time[n] = pbPrm[dPos++]; + if (pbPrm[dPos] > 1) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sOutput.bDng_Fw[n] = pbPrm[dPos++]; + psAECInfo->sOutput.bDng_Attack = pbPrm[dPos++]; + psAECInfo->sOutput.bDng_Release = pbPrm[dPos++]; + psAECInfo->sOutput.bDng_Target[n] = pbPrm[dPos++]; + psAECInfo->sOutput.bDng_Target_LineOut[n] + = pbPrm[dPos++]; + if (n == 0) + psAECInfo->sOutput.bDng_Target_Rc + = pbPrm[dPos++]; + else + dPos++; + dSubChunkSize -= 47; + if (dSubChunkSize > 0) { + sdRet = AnalyzeSysEqExSubChunk(pbPrm, + &dPos, + &dSubChunkSize, + &psAECInfo->sOutput.sSysEqEx[n]); + } + break; + + case AEC_D7_CHUNK_INPUT0: + case AEC_D7_CHUNK_INPUT1: + case AEC_D7_CHUNK_INPUT2: + n = dChunkId - AEC_D7_CHUNK_INPUT0; + if (dSubChunkSize < 16) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + if (psAECInfo->sInput.bDsf32_L_Type[n] != 0xFF) { + /* already done */ + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + if (n == 0) { + if (pbPrm[dPos] > 2) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + } else { + if (pbPrm[dPos] > 1) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + } + psAECInfo->sInput.bDsf32_L_Type[n] = pbPrm[dPos++]; + if (n == 0) { + if (pbPrm[dPos] > 2) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + } else { + if (pbPrm[dPos] > 1) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + } + psAECInfo->sInput.bDsf32_R_Type[n] = pbPrm[dPos++]; + if (pbPrm[dPos] > 1) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sInput.bDsf4_Sel[n] = pbPrm[dPos++]; + if (pbPrm[dPos] > 3) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sInput.bDcc_Sel[n] = pbPrm[dPos++]; + if (pbPrm[dPos] > 1) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sInput.bDng_On[n] = pbPrm[dPos++]; + if (pbPrm[dPos] > 3) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sInput.bDng_Att[n] = pbPrm[dPos++]; + if (pbPrm[dPos] > 3) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sInput.bDng_Rel[n] = pbPrm[dPos++]; + if (pbPrm[dPos] > 1) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sInput.bDng_Fw[n] = pbPrm[dPos++]; + if (pbPrm[dPos] > 0x3F) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sInput.bDng_Tim[n] = pbPrm[dPos++]; + psAECInfo->sInput.bDng_Zero[n][0] = pbPrm[dPos++]; + psAECInfo->sInput.bDng_Zero[n][1] = pbPrm[dPos++]; + psAECInfo->sInput.bDng_Tgt[n][0] = pbPrm[dPos++]; + psAECInfo->sInput.bDng_Tgt[n][1] = pbPrm[dPos++]; + if (pbPrm[dPos] > 3) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sInput.bDepop_Att[n] = pbPrm[dPos++]; + if (pbPrm[dPos] > 3) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sInput.bDepop_Wait[n] = pbPrm[dPos++]; + if (n == 2) { + if (pbPrm[dPos] > 1) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sInput.bRef_Sel = pbPrm[dPos++]; + } else { + dPos++; + } + dSubChunkSize = 0; + break; + + case AEC_D7_CHUNK_PDM: + if (dSubChunkSize != 10) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + if (psAECInfo->sPdm.bMode != 0xFF) { + /* already done */ + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + if (pbPrm[dPos] > 3) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sPdm.bMode = pbPrm[dPos++]; + if (pbPrm[dPos] > 3) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sPdm.bStWait = pbPrm[dPos++]; + if (pbPrm[dPos] > 7) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sPdm.bPdm0_LoadTim = pbPrm[dPos++]; + if (pbPrm[dPos] > 63) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sPdm.bPdm0_LFineDly = pbPrm[dPos++]; + if (pbPrm[dPos] > 63) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sPdm.bPdm0_RFineDly = pbPrm[dPos++]; + if (pbPrm[dPos] > 7) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sPdm.bPdm1_LoadTim = pbPrm[dPos++]; + if (pbPrm[dPos] > 63) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sPdm.bPdm1_LFineDly = pbPrm[dPos++]; + if (pbPrm[dPos] > 63) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sPdm.bPdm1_RFineDly = pbPrm[dPos++]; + if (pbPrm[dPos] > 1) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sPdm.bPdm0_Data_Delay = pbPrm[dPos++]; + if (pbPrm[dPos] > 1) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sPdm.bPdm1_Data_Delay = pbPrm[dPos++]; + dSubChunkSize = 0; + break; + + case AEC_D7_CHUNK_E2: + if (dSubChunkSize < 3) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + if (psAECInfo->sE2.bEnable != 0) { + /* already done */ + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sE2.bEnable = 1; + if (pbPrm[dPos] > 4) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sE2.bE2_Da_Sel = pbPrm[dPos++]; + dSubChunkSize--; + if (pbPrm[dPos] > 8) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sE2.bE2_Ad_Sel = pbPrm[dPos++]; + dSubChunkSize--; + if (pbPrm[dPos] > 2) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sE2.bE2OnOff = pbPrm[dPos++]; + dSubChunkSize--; + if (dSubChunkSize > 0) { + sdRet = AnalyzeEDSPSubChunk(pbPrm, + &dPos, + &dSubChunkSize, + psAECInfo); + } + break; + + case AEC_D7_CHUNK_ADJ: + if (dSubChunkSize != 4) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + if (psAECInfo->sAdj.bHold != 0xFF) { + /* already done */ + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + if (pbPrm[dPos] > 0x3F) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sAdj.bHold = pbPrm[dPos++]; + if (pbPrm[dPos] > 0x0F) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sAdj.bCnt = pbPrm[dPos++]; + psAECInfo->sAdj.bMax[0] = pbPrm[dPos++]; + psAECInfo->sAdj.bMax[1] = pbPrm[dPos++]; + dSubChunkSize = 0; + break; + + case AEC_D7_CHUNK_EDSP_MISC: + if (dSubChunkSize != 3) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + if (psAECInfo->sEDspMisc.bI2SOut_Enb != 0xFF) { + /* already done */ + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + if (pbPrm[dPos] > 1) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sEDspMisc.bI2SOut_Enb = pbPrm[dPos++]; + if (pbPrm[dPos] > 1) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sEDspMisc.bChSel = pbPrm[dPos++]; + if (pbPrm[dPos] > 3) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sEDspMisc.bLoopBack = pbPrm[dPos++]; + dSubChunkSize = 0; + break; + + case AEC_D7_CHUNK_CONTROL: + if (dSubChunkSize != 5) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + if (psAECInfo->sControl.bCommand != 0xFF) { + /* already done */ + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H) { + if ((pbPrm[dPos] < 1) + || (pbPrm[dPos] > 2)) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + } else { + if ((pbPrm[dPos] < 1) + || (pbPrm[dPos] > 5)) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + } + psAECInfo->sControl.bCommand = pbPrm[dPos++]; + psAECInfo->sControl.bParam[0] = pbPrm[dPos++]; + psAECInfo->sControl.bParam[1] = pbPrm[dPos++]; + psAECInfo->sControl.bParam[2] = pbPrm[dPos++]; + psAECInfo->sControl.bParam[3] = pbPrm[dPos++]; + dSubChunkSize = 0; + break; + + default: + /* unknown */ + break; + } + dPos += dSubChunkSize; + } + + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McParser_AnalyzeD7Chunk", &sdRet); +#endif + return sdRet; +} + +/**************************************************************************** + * AnalyzeAESubChunk + * + * Description: + * AudioEngine Sub chunk analysis + * Arguments: + * pbPrm AEC data pointer + * pdPos AEC sub chunk start pos + * pdSubChunkSize AEC sub chunk byte size + * psAECInfo MCDRV_AEC_INFO structure pointer + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR_ARGUMENT + * + ****************************************************************************/ +static SINT32 AnalyzeAESubChunk +( + const UINT8 *pbPrm, + UINT32 *pdPos, + UINT32 *pdSubChunkSize, + struct MCDRV_AEC_INFO *psAECInfo +) +{ + SINT32 sdRet = MCDRV_SUCCESS; + UINT32 dChunkId; + UINT32 dChunkSize; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("AnalyzeAESubChunk"); +#endif + + while (*pdSubChunkSize > 0) { + if (*pdSubChunkSize < 8) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + dChunkId = CreateUINT32(pbPrm[*pdPos], + pbPrm[*pdPos+1], + pbPrm[*pdPos+2], + pbPrm[*pdPos+3]); + dChunkSize = CreateUINT32(pbPrm[*pdPos+4], + pbPrm[*pdPos+5], + pbPrm[*pdPos+6], + pbPrm[*pdPos+7]); + *pdSubChunkSize -= 8; + if (*pdSubChunkSize < dChunkSize) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + if ((dChunkId == AEC_D7_CHUNK_BDSP_ES1) + || (dChunkId == AEC_D7_CHUNK_BDSP)) { + if (((dChunkId == AEC_D7_CHUNK_BDSP_ES1) + && (McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H)) + || ((dChunkId == AEC_D7_CHUNK_BDSP) + && (McDevProf_GetDevId() != eMCDRV_DEV_ID_80_90H))) { + if ( + psAECInfo->sAecAudioengine.sAecBDsp.pbChunkData + != NULL) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sAecAudioengine.sAecBDsp.pbChunkData + = (UINT8 *)&pbPrm[*pdPos]; + psAECInfo->sAecAudioengine.sAecBDsp.dwSize + = dChunkSize; + } + } else if ((dChunkId == AEC_D7_CHUNK_FDSP_ES1) + || (dChunkId == AEC_D7_CHUNK_FDSP)) { + if (((dChunkId == AEC_D7_CHUNK_FDSP_ES1) + && (McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H)) + || ((dChunkId == AEC_D7_CHUNK_FDSP) + && (McDevProf_GetDevId() != eMCDRV_DEV_ID_80_90H))) { + if ( + psAECInfo->sAecAudioengine.sAecFDsp.pbChunkData + != NULL) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sAecAudioengine.sAecFDsp.pbChunkData + = (UINT8 *)&pbPrm[*pdPos]; + psAECInfo->sAecAudioengine.sAecFDsp.dwSize + = dChunkSize; + } + } else { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + *pdPos += (dChunkSize+8); + *pdSubChunkSize -= dChunkSize; + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("AnalyzeAESubChunk", &sdRet); +#endif + return sdRet; +} + +/**************************************************************************** + * AnalyzeVBoxSubChunk + * + * Description: + * V-Box Sub chunk analysis + * Arguments: + * pbPrm AEC data pointer + * pdPos AEC sub chunk start pos + * pdSubChunkSize AEC sub chunk byte size + * psAECInfo MCDRV_AEC_INFO structure pointer + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR_ARGUMENT + * + ****************************************************************************/ +static SINT32 AnalyzeVBoxSubChunk( + const UINT8 *pbPrm, + UINT32 *pdPos, + UINT32 *pdSubChunkSize, + struct MCDRV_AEC_INFO *psAECInfo +) +{ + SINT32 sdRet = MCDRV_SUCCESS; + UINT32 dChunkId; + UINT32 dChunkSize; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("AnalyzeVBoxSubChunk"); +#endif + + while (*pdSubChunkSize > 0) { + if (*pdSubChunkSize < 8) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + dChunkId = CreateUINT32(pbPrm[*pdPos], + pbPrm[*pdPos+1], + pbPrm[*pdPos+2], + pbPrm[*pdPos+3]); + dChunkSize = CreateUINT32(pbPrm[*pdPos+4], + pbPrm[*pdPos+5], + pbPrm[*pdPos+6], + pbPrm[*pdPos+7]); + *pdSubChunkSize -= 8; + if (*pdSubChunkSize < dChunkSize) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + if (dChunkId == AEC_D7_CHUNK_CDSPA) { + if (psAECInfo->sAecVBox.sAecCDspA.pbChunkData + != NULL) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sAecVBox.sAecCDspA.pbChunkData + = (UINT8 *)&pbPrm[*pdPos]; + psAECInfo->sAecVBox.sAecCDspA.dwSize + = dChunkSize; + } else if (dChunkId == AEC_D7_CHUNK_CDSPB) { + if (psAECInfo->sAecVBox.sAecCDspB.pbChunkData + != NULL) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sAecVBox.sAecCDspB.pbChunkData + = (UINT8 *)&pbPrm[*pdPos]; + psAECInfo->sAecVBox.sAecCDspB.dwSize + = dChunkSize; + } else if ((dChunkId == AEC_D7_CHUNK_FDSP_ES1) + || (dChunkId == AEC_D7_CHUNK_FDSP)) { + if (((dChunkId == AEC_D7_CHUNK_FDSP_ES1) + && (McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H)) + || ((dChunkId == AEC_D7_CHUNK_FDSP) + && (McDevProf_GetDevId() != eMCDRV_DEV_ID_80_90H))) { + if (psAECInfo->sAecVBox.sAecFDsp.pbChunkData + != NULL) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sAecVBox.sAecFDsp.pbChunkData + = (UINT8 *)&pbPrm[*pdPos]; + psAECInfo->sAecVBox.sAecFDsp.dwSize + = dChunkSize; + } + } else if (dChunkId == AEC_D7_CHUNK_CDSP_DEBUG) { + if (dChunkSize != 1) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + if (psAECInfo->sAecVBox.sAecCDspDbg.bJtagOn + != 0xFF) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + if (pbPrm[*pdPos+8] > 1) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sAecVBox.sAecCDspDbg.bJtagOn + = pbPrm[*pdPos+8]; + } else { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + *pdPos += (dChunkSize+8); + *pdSubChunkSize -= dChunkSize; + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("AnalyzeVBoxSubChunk", &sdRet); +#endif + return sdRet; +} + +/**************************************************************************** + * AnalyzeSysEqExSubChunk + * + * Description: + * SYS EQ EX Sub chunk analysis + * Arguments: + * pbPrm AEC data pointer + * pdPos AEC sub chunk start pos + * pdSubChunkSize AEC sub chunk byte size + * psSysEqEx MCDRV_AEC_SYSEQ_EX structure pointer + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR_ARGUMENT + * + ****************************************************************************/ +static SINT32 AnalyzeSysEqExSubChunk +( + const UINT8 *pbPrm, + UINT32 *pdPos, + UINT32 *pdSubChunkSize, + struct MCDRV_AEC_SYSEQ_EX *psSysEqEx +) +{ + SINT32 sdRet = MCDRV_SUCCESS; + UINT32 dChunkId; + UINT32 dChunkSize; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("AnalyzeSysEqExSubChunk"); +#endif + + while (*pdSubChunkSize > 0) { + if (*pdSubChunkSize < 8) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + dChunkId = CreateUINT32(pbPrm[*pdPos], + pbPrm[*pdPos+1], + pbPrm[*pdPos+2], + pbPrm[*pdPos+3]); + dChunkSize = CreateUINT32(pbPrm[*pdPos+4], + pbPrm[*pdPos+5], + pbPrm[*pdPos+6], + pbPrm[*pdPos+7]); + *pdPos += 8; + *pdSubChunkSize -= 8; + if (*pdSubChunkSize < dChunkSize) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + + switch (dChunkId) { + case AEC_D7_CHUNK_SYSEQ_EX: + if (dChunkSize != 30) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + if (psSysEqEx->bEnable != 0) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psSysEqEx->bEnable = 1; + psSysEqEx->sBand[0].bCoef_A0[0] = pbPrm[*pdPos+0]; + psSysEqEx->sBand[0].bCoef_A0[1] = pbPrm[*pdPos+1]; + psSysEqEx->sBand[0].bCoef_A0[2] = pbPrm[*pdPos+2]; + psSysEqEx->sBand[0].bCoef_A1[0] = pbPrm[*pdPos+3]; + psSysEqEx->sBand[0].bCoef_A1[1] = pbPrm[*pdPos+4]; + psSysEqEx->sBand[0].bCoef_A1[2] = pbPrm[*pdPos+5]; + psSysEqEx->sBand[0].bCoef_A2[0] = pbPrm[*pdPos+6]; + psSysEqEx->sBand[0].bCoef_A2[1] = pbPrm[*pdPos+7]; + psSysEqEx->sBand[0].bCoef_A2[2] = pbPrm[*pdPos+8]; + psSysEqEx->sBand[0].bCoef_B1[0] = pbPrm[*pdPos+9]; + psSysEqEx->sBand[0].bCoef_B1[1] = pbPrm[*pdPos+10]; + psSysEqEx->sBand[0].bCoef_B1[2] = pbPrm[*pdPos+11]; + psSysEqEx->sBand[0].bCoef_B2[0] = pbPrm[*pdPos+12]; + psSysEqEx->sBand[0].bCoef_B2[1] = pbPrm[*pdPos+13]; + psSysEqEx->sBand[0].bCoef_B2[2] = pbPrm[*pdPos+14]; + psSysEqEx->sBand[1].bCoef_A0[0] = pbPrm[*pdPos+15]; + psSysEqEx->sBand[1].bCoef_A0[1] = pbPrm[*pdPos+16]; + psSysEqEx->sBand[1].bCoef_A0[2] = pbPrm[*pdPos+17]; + psSysEqEx->sBand[1].bCoef_A1[0] = pbPrm[*pdPos+18]; + psSysEqEx->sBand[1].bCoef_A1[1] = pbPrm[*pdPos+19]; + psSysEqEx->sBand[1].bCoef_A1[2] = pbPrm[*pdPos+20]; + psSysEqEx->sBand[1].bCoef_A2[0] = pbPrm[*pdPos+21]; + psSysEqEx->sBand[1].bCoef_A2[1] = pbPrm[*pdPos+22]; + psSysEqEx->sBand[1].bCoef_A2[2] = pbPrm[*pdPos+23]; + psSysEqEx->sBand[1].bCoef_B1[0] = pbPrm[*pdPos+24]; + psSysEqEx->sBand[1].bCoef_B1[1] = pbPrm[*pdPos+25]; + psSysEqEx->sBand[1].bCoef_B1[2] = pbPrm[*pdPos+26]; + psSysEqEx->sBand[1].bCoef_B2[0] = pbPrm[*pdPos+27]; + psSysEqEx->sBand[1].bCoef_B2[1] = pbPrm[*pdPos+28]; + psSysEqEx->sBand[1].bCoef_B2[2] = pbPrm[*pdPos+29]; + *pdPos += 30; + *pdSubChunkSize -= dChunkSize; + break; + default: + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("AnalyzeSysEqExSubChunk", &sdRet); +#endif + return sdRet; +} + +/**************************************************************************** + * AnalyzeEDSPSubChunk + * + * Description: + * E-DSP Sub chunk analysis + * Arguments: + * pbPrm AEC data pointer + * pdPos AEC sub chunk start pos + * pdSubChunkSize AEC sub chunk byte size + * psAECInfo MCDRV_AEC_INFO structure pointer + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR_ARGUMENT + * + ****************************************************************************/ +static SINT32 AnalyzeEDSPSubChunk +( + const UINT8 *pbPrm, + UINT32 *pdPos, + UINT32 *pdSubChunkSize, + struct MCDRV_AEC_INFO *psAECInfo +) +{ + SINT32 sdRet = MCDRV_SUCCESS; + UINT32 dChunkId; + UINT32 dChunkSize; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("AnalyzeEDSPSubChunk"); +#endif + + while (*pdSubChunkSize > 0 && sdRet == MCDRV_SUCCESS) { + if (*pdSubChunkSize < 8) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + dChunkId = CreateUINT32(pbPrm[*pdPos], + pbPrm[*pdPos+1], + pbPrm[*pdPos+2], + pbPrm[*pdPos+3]); + dChunkSize = CreateUINT32(pbPrm[*pdPos+4], + pbPrm[*pdPos+5], + pbPrm[*pdPos+6], + pbPrm[*pdPos+7]); + *pdSubChunkSize -= 8; + if (*pdSubChunkSize < dChunkSize) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + + switch (dChunkId) { + case AEC_D7_CHUNK_E2_CONFIG: + if (psAECInfo->sE2.sE2Config.pbChunkData + != NULL) { + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + psAECInfo->sE2.sE2Config.pbChunkData + = (UINT8 *)&pbPrm[*pdPos]; + psAECInfo->sE2.sE2Config.dwSize + = dChunkSize; + *pdPos += (dChunkSize+8); + *pdSubChunkSize -= dChunkSize; + break; + default: + sdRet = MCDRV_ERROR_ARGUMENT; + break; + } + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("AnalyzeEDSPSubChunk", &sdRet); +#endif + return sdRet; +} + + + diff --git a/sound/soc/codecs/ymu831/mcparser.h b/sound/soc/codecs/ymu831/mcparser.h new file mode 100644 index 00000000000..d50d346799e --- /dev/null +++ b/sound/soc/codecs/ymu831/mcparser.h @@ -0,0 +1,49 @@ +/**************************************************************************** + * + * Copyright(c) 2012 Yamaha Corporation. All rights reserved. + * + * Module : mcparser.h + * + * Description : MC Driver parser header + * + * Version : 1.0.0 2012.12.13 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + * + ****************************************************************************/ + +#ifndef _MCPARSER_H_ +#define _MCPARSER_H_ + +#include "mcresctrl.h" + +struct MCDRV_AEC_D7_INFO { + const UINT8 *pbChunkTop; + UINT32 dChunkSize; +}; + + +SINT32 McParser_GetD7Chunk(const UINT8 *pbPrm, + UINT32 dSize, + struct MCDRV_AEC_D7_INFO *psD7Info); +SINT32 McParser_AnalyzeD7Chunk( + struct MCDRV_AEC_D7_INFO *psD7Info, + struct MCDRV_AEC_INFO *psAECInfo); + + + +#endif /* _MCPARSER_H_ */ diff --git a/sound/soc/codecs/ymu831/mcresctrl.c b/sound/soc/codecs/ymu831/mcresctrl.c new file mode 100644 index 00000000000..8cf4cc77725 --- /dev/null +++ b/sound/soc/codecs/ymu831/mcresctrl.c @@ -0,0 +1,7839 @@ +/**************************************************************************** + * + * Copyright(c) 2012-2013 Yamaha Corporation. All rights reserved. + * + * Module : mcresctrl.c + * + * Description : MC Driver resource control + * + * Version : 2.0.1 2013.05.21 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + * + ****************************************************************************/ + + +#include "mcresctrl.h" +#include "mcdevif.h" +#include "mcservice.h" +#include "mcdriver.h" +#include "mcdefs.h" +#include "mcdevprof.h" +#include "mcmachdep.h" +#if MCDRV_DEBUG_LEVEL +#include "mcdebuglog.h" +#endif + + + +#ifndef GET_ARRAY_SIZE +#define GET_ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) +#endif + +#define D1SRC_ALL_OFF (MCDRV_D1SRC_MUSICIN_OFF \ + | MCDRV_D1SRC_EXTIN_OFF \ + | MCDRV_D1SRC_VBOXOUT_OFF \ + | MCDRV_D1SRC_VBOXREFOUT_OFF \ + | MCDRV_D1SRC_AE0_OFF \ + | MCDRV_D1SRC_AE1_OFF \ + | MCDRV_D1SRC_AE2_OFF \ + | MCDRV_D1SRC_AE3_OFF \ + | MCDRV_D1SRC_ADIF0_OFF \ + | MCDRV_D1SRC_ADIF1_OFF \ + | MCDRV_D1SRC_ADIF2_OFF \ + | MCDRV_D1SRC_HIFIIN_OFF) +#define D2SRC_ALL_OFF (MCDRV_D2SRC_VOICEIN_OFF \ + | MCDRV_D2SRC_VBOXIOOUT_OFF \ + | MCDRV_D2SRC_VBOXHOSTOUT_OFF \ + | MCDRV_D2SRC_ADC0_L_OFF \ + | MCDRV_D2SRC_ADC0_R_OFF \ + | MCDRV_D2SRC_ADC1_OFF \ + | MCDRV_D2SRC_PDM0_L_OFF \ + | MCDRV_D2SRC_PDM0_R_OFF \ + | MCDRV_D2SRC_PDM1_L_OFF \ + | MCDRV_D2SRC_PDM1_R_OFF \ + | MCDRV_D2SRC_DAC0REF_OFF \ + | MCDRV_D2SRC_DAC1REF_OFF) + +static enum MCDRV_STATE geState = eMCDRV_STATE_NOTINIT; + +static struct MCDRV_GLOBAL_INFO gsGlobalInfo; +static struct MCDRV_PACKET gasPacket[MCDRV_MAX_PACKETS+1]; + +/* register next address */ +static const UINT16 gawNextAddr[256] = { + 0, 1, 2, 3, 4, 5, 6, 7, + 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 70, 71, + 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, + 88, 89, 90, 91, 92, 93, 94, 95, + 96, 97, 98, 99, 100, 101, 102, 103, + 104, 105, 106, 107, 108, 109, 110, 111, + 112, 113, 114, 115, 116, 117, 118, 119, + 120, 121, 122, 123, 124, 125, 126, 127, + 128, 129, 130, 131, 132, 133, 134, 135, + 136, 137, 138, 139, 140, 141, 142, 143, + 144, 145, 146, 147, 148, 149, 150, 151, + 152, 153, 154, 155, 156, 157, 158, 159, + 160, 161, 162, 163, 164, 165, 166, 167, + 168, 169, 170, 171, 172, 173, 174, 175, + 176, 177, 178, 179, 180, 181, 182, 183, + 184, 185, 186, 187, 188, 189, 190, 191, + 192, 193, 194, 195, 196, 197, 198, 199, + 200, 201, 202, 203, 204, 205, 206, 207, + 208, 209, 210, 211, 212, 213, 214, 215, + 216, 217, 218, 219, 220, 221, 222, 223, + 224, 225, 226, 227, 228, 229, 230, 231, + 232, 233, 234, 235, 236, 237, 238, 239, + 240, 241, 242, 243, 244, 245, 246, 247, + 248, 249, 250, 251, 252, 253, 254, 255 +}; + +static const UINT16 gawNextAddrAInc[256] = { + 1, 2, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, + 33, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, 64, + 65, 66, 67, 68, 69, 70, 71, 72, + 73, 74, 75, 76, 77, 78, 79, 80, + 81, 82, 83, 84, 85, 86, 87, 88, + 89, 90, 91, 92, 93, 94, 95, 96, + 97, 98, 99, 100, 101, 102, 103, 104, + 105, 106, 107, 108, 109, 110, 111, 112, + 113, 114, 115, 116, 117, 118, 119, 120, + 121, 122, 123, 124, 125, 126, 127, 128, + 129, 130, 131, 132, 133, 134, 135, 136, + 137, 138, 139, 140, 141, 142, 143, 144, + 145, 146, 147, 148, 149, 150, 151, 152, + 153, 154, 155, 156, 157, 158, 159, 160, + 161, 162, 163, 164, 165, 166, 167, 168, + 169, 170, 171, 172, 173, 174, 175, 176, + 177, 178, 179, 180, 181, 182, 183, 184, + 185, 186, 187, 188, 189, 190, 191, 192, + 193, 194, 195, 196, 197, 198, 199, 200, + 201, 202, 203, 204, 205, 206, 207, 208, + 209, 210, 211, 212, 213, 214, 215, 216, + 217, 218, 219, 220, 221, 222, 223, 224, + 225, 226, 227, 228, 229, 230, 231, 232, + 233, 234, 235, 236, 237, 238, 239, 240, + 241, 242, 243, 244, 245, 246, 247, 248, + 249, 250, 251, 252, 253, 254, 255, 0xFFFF +}; + +static void InitClockSw(void); +static void InitPathInfo(void); +static void InitVolInfo(void); +static void InitDioInfo(void); +static void InitDioPathInfo(void); +static void InitSwap(void); +static void InitHSDet(void); +static void InitGpMode(void); +static void InitGpMask(void); +static void InitAecInfo(void); + +static SINT32 CheckLpFp(void); +static SINT32 IsValidPath(void); +static UINT8 ValidateADC(void); +static UINT8 ValidateDAC(void); + +static void SetD1SourceOnOff(const struct MCDRV_D1_CHANNEL *psSetDChannel, + struct MCDRV_D1_CHANNEL *psDstDChannel, + UINT8 bChannels); +static void SetD2SourceOnOff(const struct MCDRV_D2_CHANNEL *psSetDChannel, + struct MCDRV_D2_CHANNEL *psDstDChannel, + UINT8 bChannels); +static void SetASourceOnOff(const struct MCDRV_A_CHANNEL *psSetAChannel, + struct MCDRV_A_CHANNEL *psDstAChannel, + UINT8 bChannels); +static void SetBiasSourceOnOff(const struct MCDRV_PATH_INFO *psPathInfo); + +static void ClearD1SourceOnOff(UINT32 *pdSrcOnOff); +static void ClearD2SourceOnOff(UINT32 *pdSrcOnOff); +static void ClearASourceOnOff(UINT32 *pdSrcOnOff); +static void SetSourceOnOff(UINT32 dSrcOnOff, + UINT32 *pdDstOnOff, + UINT32 dOn, + UINT32 dOff); +static UINT32 GetD1Source(struct MCDRV_D1_CHANNEL *psD, + enum MCDRV_DST_CH eCh); +static UINT32 GetD2Source(struct MCDRV_D2_CHANNEL *psD, + enum MCDRV_DST_CH eCh); + +static void SetDIOCommon(const struct MCDRV_DIO_INFO *psDioInfo, + UINT8 bPort); +static void SetDIODIR(const struct MCDRV_DIO_INFO *psDioInfo, + UINT8 bPort); +static void SetDIODIT(const struct MCDRV_DIO_INFO *psDioInfo, + UINT8 bPort); + +static SINT16 GetAnaInVolReg(SINT16 swVol); +static SINT16 GetAnaOutVolReg(SINT16 swVol); +static SINT16 GetSpVolReg(SINT16 swVol); +static SINT16 GetLOutVolReg(SINT16 swVol); +static SINT16 GetHpVolReg(SINT16 swVol); + +static SINT32 WaitBitSet(UINT8 bSlaveAddr, + UINT16 wRegAddr, + UINT8 bBit, + UINT32 dCycleTime, + UINT32 dTimeOut); +static SINT32 WaitBitRelease(UINT8 bSlaveAddr, + UINT16 wRegAddr, + UINT8 bBit, + UINT32 dCycleTime, + UINT32 dTimeOut); +static SINT32 WaitDSPBitSet(UINT8 bSlaveAddr, + UINT8 bRegAddr_A, + UINT8 bRegAddr_D, + UINT16 wRegAddr, + UINT8 bBit, + UINT32 dCycleTime, + UINT32 dTimeOut); +static SINT32 WaitDSPBitRelease(UINT8 bSlaveAddr, + UINT8 bRegAddr_A, + UINT8 bRegAddr_D, + UINT16 wRegAddr, + UINT8 bBit, + UINT32 dCycleTime, + UINT32 dTimeOut); + +/**************************************************************************** + * McResCtrl_SetHwId + * + * Description: + * Set hardware ID. + * Arguments: + * bHwId_dig digital block hardware ID + * bHwId_ana analog block hardware ID + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR_INIT + * + ****************************************************************************/ +SINT32 McResCtrl_SetHwId( + UINT8 bHwId_dig, + UINT8 bHwId_ana +) +{ + SINT32 sdRet = MCDRV_SUCCESS; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McResCtrl_SetHwId"); +#endif + + if (((bHwId_dig&MCDRV_DEVID_MASK) == MCDRV_DEVID_DIG) + && ((bHwId_ana&MCDRV_DEVID_MASK) == MCDRV_DEVID_ANA)) { + if ((bHwId_dig&MCDRV_VERID_MASK) != 0) { + if ((bHwId_dig&0x08) != 0) { + McDevProf_SetDevId(eMCDRV_DEV_ID_89_92H); + gsGlobalInfo.sHSDetInfo.bSgnlNum = + MCDRV_SGNLNUM_NONE; + } else if ((bHwId_ana&MCDRV_VERID_MASK) == 2) { + McDevProf_SetDevId(eMCDRV_DEV_ID_81_92H); + } else { + McDevProf_SetDevId(eMCDRV_DEV_ID_81_91H); + } + } else { + McDevProf_SetDevId(eMCDRV_DEV_ID_80_90H); + } + gsGlobalInfo.bHwId = bHwId_dig; + gsGlobalInfo.abRegValA[MCI_A_DEV_ID] = gsGlobalInfo.bHwId; + } else { + sdRet = MCDRV_ERROR_INIT; + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McResCtrl_SetHwId", &sdRet); +#endif + return sdRet; +} + +/**************************************************************************** + * McResCtrl_Init + * + * Description: + * initialize the resource controller. + * Arguments: + * none + * Return: + * none + * + ****************************************************************************/ +void McResCtrl_Init( + void +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McResCtrl_Init"); +#endif + + InitPathInfo(); + InitVolInfo(); + InitDioInfo(); + InitDioPathInfo(); + InitClockSw(); + InitSwap(); + InitHSDet(); + InitGpMode(); + InitGpMask(); + InitAecInfo(); + + gsGlobalInfo.bClkSel = 0; + gsGlobalInfo.bEClkSel = 0; + gsGlobalInfo.bCClkSel = 0; + gsGlobalInfo.bFClkSel = 0; + gsGlobalInfo.bPlugDetDB = 0; + + gsGlobalInfo.ePacketBufAlloc = eMCDRV_PACKETBUF_FREE; + gsGlobalInfo.pcbfunc = NULL; + + McResCtrl_InitRegUpdate(); + + gsGlobalInfo.eAPMode = eMCDRV_APM_ON; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McResCtrl_Init", 0); +#endif +} + +/**************************************************************************** + * McResCtrl_InitABlockReg + * + * Description: + * Initialize the A Block virtual registers. + * Arguments: + * none + * Return: + * none + * + ****************************************************************************/ +void McResCtrl_InitABlockReg( + void +) +{ + UINT16 i; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McResCtrl_InitABlockReg"); +#endif + + for (i = 0; i < MCDRV_REG_NUM_A; i++) + gsGlobalInfo.abRegValA[i] = 0; + + gsGlobalInfo.abRegValA[MCI_A_DEV_ID] = gsGlobalInfo.bHwId; + gsGlobalInfo.abRegValA[MCI_CLK_MSK] = MCI_CLK_MSK_DEF; + gsGlobalInfo.abRegValA[MCI_PD] = MCI_PD_DEF; + gsGlobalInfo.abRegValA[MCI_DO0_DRV] = MCI_DO0_DRV_DEF; + gsGlobalInfo.abRegValA[MCI_DO1_DRV] = MCI_DO1_DRV_DEF; + gsGlobalInfo.abRegValA[MCI_DO2_DRV] = MCI_DO2_DRV_DEF; + gsGlobalInfo.abRegValA[MCI_PA0] = MCI_PA0_DEF; + gsGlobalInfo.abRegValA[MCI_PA1] = MCI_PA1_DEF; + gsGlobalInfo.abRegValA[MCI_PA2] = MCI_PA2_DEF; + if (McDevProf_GetDevId() != eMCDRV_DEV_ID_80_90H) { + ; + gsGlobalInfo.abRegValA[MCI_DOA_DRV] = MCI_DOA_DRV_DEF; + } + gsGlobalInfo.abRegValA[MCI_LP1_FP] = MCI_LP1_FP_DEF; + gsGlobalInfo.abRegValA[MCI_LP2_FP] = MCI_LP2_FP_DEF; + gsGlobalInfo.abRegValA[MCI_LP3_FP] = MCI_LP3_FP_DEF; + gsGlobalInfo.abRegValA[MCI_CLKSRC] = MCI_CLKSRC_DEF; + gsGlobalInfo.abRegValA[MCI_FREQ73M] = MCI_FREQ73M_DEF; + gsGlobalInfo.abRegValA[MCI_PLL_MODE_A] = MCI_PLL_MODE_A_DEF; + gsGlobalInfo.abRegValA[MCI_PLL_MODE_B] = MCI_PLL_MODE_B_DEF; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McResCtrl_InitABlockReg", 0); +#endif +} + +/**************************************************************************** + * McResCtrl_InitMBlockReg + * + * Description: + * Initialize the Block M virtual registers. + * Arguments: + * none + * Return: + * none + * + ****************************************************************************/ +void McResCtrl_InitMBlockReg( + void +) +{ + UINT16 i; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McResCtrl_InitMBlockReg"); +#endif + + for (i = 0; i < MCDRV_REG_NUM_MA; i++) + gsGlobalInfo.abRegValMA[i] = 0; + + gsGlobalInfo.abRegValMA[MCI_I_VINTP] = MCI_I_VINTP_DEF; + gsGlobalInfo.abRegValMA[MCI_O_VINTP] = MCI_O_VINTP_DEF; + + for (i = 0; i < MCDRV_REG_NUM_MB; i++) + gsGlobalInfo.abRegValMB[i] = 0; + + gsGlobalInfo.abRegValMB[MCI_LP0_MODE] = MCI_LP0_MODE_DEF; + gsGlobalInfo.abRegValMB[MCI_LPR0_SLOT] = MCI_LPR0_SLOT_DEF; + gsGlobalInfo.abRegValMB[MCI_LPT0_SLOT] = MCI_LPT0_SLOT_DEF; + gsGlobalInfo.abRegValMB[MCI_LPR0_PCM] = MCI_LPR0_PCM_DEF; + gsGlobalInfo.abRegValMB[MCI_LPT0_PCM] = MCI_LPT0_PCM_DEF; + gsGlobalInfo.abRegValMB[MCI_LP1_MODE] = MCI_LP1_MODE_DEF; + gsGlobalInfo.abRegValMB[MCI_LPR1_PCM] = MCI_LPR1_PCM_DEF; + gsGlobalInfo.abRegValMB[MCI_LPT1_PCM] = MCI_LPT1_PCM_DEF; + gsGlobalInfo.abRegValMB[MCI_LP2_MODE] = MCI_LP2_MODE_DEF; + gsGlobalInfo.abRegValMB[MCI_LPR2_PCM] = MCI_LPR2_PCM_DEF; + gsGlobalInfo.abRegValMB[MCI_LPT2_PCM] = MCI_LPT2_PCM_DEF; + + for (i = 0; i < MCDRV_REG_NUM_B; i++) + gsGlobalInfo.abRegValB[i] = 0; + + McResCtrl_InitEReg(); + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McResCtrl_InitMBlockReg", 0); +#endif +} + +/**************************************************************************** + * McResCtrl_InitEReg + * + * Description: + * Initialize the E virtual registers. + * Arguments: + * none + * Return: + * none + * + ****************************************************************************/ +void McResCtrl_InitEReg( + void +) +{ + UINT16 i; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McResCtrl_InitEReg"); +#endif + + for (i = 0; i < MCDRV_REG_NUM_E; i++) + gsGlobalInfo.abRegValE[i] = 0; + + gsGlobalInfo.abRegValE[MCI_E1DSP_CTRL] = MCI_E1DSP_CTRL_DEF; + gsGlobalInfo.abRegValE[MCI_LPF_THR] = MCI_LPF_THR_DEF; + gsGlobalInfo.abRegValE[MCI_DAC_DCC_SEL] = MCI_DAC_DCC_SEL_DEF; + if (McDevProf_GetDevId() != eMCDRV_DEV_ID_80_90H) { + ; + gsGlobalInfo.abRegValE[MCI_OSF_SEL] = MCI_OSF_SEL_DEF; + } + gsGlobalInfo.abRegValE[MCI_OSF_GAIN0_15_8] + = MCI_OSF_GAIN0_15_8_DEF; + gsGlobalInfo.abRegValE[MCI_OSF_GAIN0_7_0] + = MCI_OSF_GAIN0_7_0_DEF; + gsGlobalInfo.abRegValE[MCI_OSF_GAIN1_15_8] + = MCI_OSF_GAIN1_15_8_DEF; + gsGlobalInfo.abRegValE[MCI_OSF_GAIN1_7_0] + = MCI_OSF_GAIN1_7_0_DEF; + gsGlobalInfo.abRegValE[MCI_DCL0_LMT_14_8] + = MCI_DCL0_LMT_14_8_DEF; + gsGlobalInfo.abRegValE[MCI_DCL0_LMT_7_0] + = MCI_DCL0_LMT_7_0_DEF; + gsGlobalInfo.abRegValE[MCI_DCL1_LMT_14_8] + = MCI_DCL1_LMT_14_8_DEF; + gsGlobalInfo.abRegValE[MCI_DCL1_LMT_7_0] + = MCI_DCL1_LMT_7_0_DEF; + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H) { + gsGlobalInfo.abRegValE[MCI_DITHER0] = MCI_DITHER0_DEF; + gsGlobalInfo.abRegValE[MCI_DITHER1] = MCI_DITHER1_DEF; + } else { + gsGlobalInfo.abRegValE[MCI_DITHER0] = 0x30; + gsGlobalInfo.abRegValE[MCI_DITHER1] = 0x30; + } + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H) { + gsGlobalInfo.abRegValE[MCI_DNG0_ES1] = MCI_DNG0_DEF_ES1; + gsGlobalInfo.abRegValE[MCI_DNG1_ES1] = MCI_DNG1_DEF_ES1; + } else { + gsGlobalInfo.abRegValE[MCI_DNG0] = MCI_DNG0_DEF; + gsGlobalInfo.abRegValE[MCI_DNG1] = MCI_DNG1_DEF; + } + gsGlobalInfo.abRegValE[MCI_DPATH_DA_V] = MCI_DPATH_DA_V_DEF; + gsGlobalInfo.abRegValE[MCI_DPATH_AD_V] = MCI_DPATH_AD_V_DEF; + if (McDevProf_GetDevId() != eMCDRV_DEV_ID_80_90H) { + ; + gsGlobalInfo.abRegValE[39] = 0xF4; + } + gsGlobalInfo.abRegValE[MCI_DSF0_PRE_INPUT] + = MCI_DSF0_PRE_INPUT_DEF; + gsGlobalInfo.abRegValE[MCI_DSF1_FLT_TYPE] + = MCI_DSF1_FLT_TYPE_DEF; + gsGlobalInfo.abRegValE[MCI_DSF1_PRE_INPUT] + = MCI_DSF1_PRE_INPUT_DEF; + gsGlobalInfo.abRegValE[MCI_DSF2_PRE_INPUT] + = MCI_DSF2_PRE_INPUT_DEF; + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H) { + ; + gsGlobalInfo.abRegValE[MCI_ADC_DCC_SEL] + = MCI_ADC_DCC_SEL_DEF_ES1; + } else { + gsGlobalInfo.abRegValE[MCI_ADC_DCC_SEL] = MCI_ADC_DCC_SEL_DEF; + } + gsGlobalInfo.abRegValE[MCI_ADC_DNG0_FW] = MCI_ADC_DNG0_FW_DEF; + gsGlobalInfo.abRegValE[MCI_ADC_DNG1_FW] = MCI_ADC_DNG1_FW_DEF; + gsGlobalInfo.abRegValE[MCI_ADC_DNG2_FW] = MCI_ADC_DNG2_FW_DEF; + gsGlobalInfo.abRegValE[MCI_DEPOP0] = MCI_DEPOP0_DEF; + gsGlobalInfo.abRegValE[MCI_DEPOP1] = MCI_DEPOP1_DEF; + gsGlobalInfo.abRegValE[MCI_DEPOP2] = MCI_DEPOP2_DEF; + gsGlobalInfo.abRegValE[MCI_PDM_MODE] = MCI_PDM_MODE_DEF; + gsGlobalInfo.abRegValE[MCI_E2DSP] = MCI_E2DSP_DEF; + if (McDevProf_GetDevId() != eMCDRV_DEV_ID_80_90H) { + gsGlobalInfo.abRegValE[99] = 0xC9; + gsGlobalInfo.abRegValE[100] = 0x01; + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McResCtrl_InitEReg", 0); +#endif +} + +/**************************************************************************** + * McResCtrl_SetRegDefault + * + * Description: + * Initialize the virtual registers. + * Arguments: + * none + * Return: + * none + * + ****************************************************************************/ +void McResCtrl_SetRegDefault( + void +) +{ + UINT16 i; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McResCtrl_SetRegDefault"); +#endif + + for (i = 0; i < MCDRV_REG_NUM_IF; i++) + gsGlobalInfo.abRegValIF[i] = 0; + + gsGlobalInfo.abRegValIF[MCI_RST_A] = MCI_RST_A_DEF; + gsGlobalInfo.abRegValIF[MCI_RST] = MCI_RST_DEF; + if (machdep_GetBusSelect() != 2) { + ; + gsGlobalInfo.abRegValIF[MCI_RST] |= + (MCB_PSW_S|MCB_RST_S); + } + + McResCtrl_InitABlockReg(); + + McResCtrl_InitMBlockReg(); + + for (i = 0; i < MCDRV_REG_NUM_C; i++) + gsGlobalInfo.abRegValC[i] = 0; + + for (i = 0; i < MCDRV_REG_NUM_F; i++) + gsGlobalInfo.abRegValF[i] = 0; + + for (i = 0; i < MCDRV_REG_NUM_ANA; i++) + gsGlobalInfo.abRegValANA[i] = 0; + + gsGlobalInfo.abRegValANA[MCI_ANA_ID] = MCI_ANA_ID_DEF; + gsGlobalInfo.abRegValANA[MCI_ANA_RST] = MCI_ANA_RST_DEF; + gsGlobalInfo.abRegValANA[MCI_AP] = MCI_AP_DEF; + gsGlobalInfo.abRegValANA[MCI_AP_DA0] = MCI_AP_DA0_DEF; + gsGlobalInfo.abRegValANA[MCI_AP_DA1] = MCI_AP_DA1_DEF; + gsGlobalInfo.abRegValANA[MCI_AP_MIC] = MCI_AP_MIC_DEF; + gsGlobalInfo.abRegValANA[MCI_AP_AD] = MCI_AP_AD_DEF; + if (McDevProf_GetDevId() != eMCDRV_DEV_ID_80_90H) { + gsGlobalInfo.abRegValANA[10] = 0x06; + gsGlobalInfo.abRegValANA[MCI_NONCLIP] = MCI_NONCLIP_DEF; + } + gsGlobalInfo.abRegValANA[MCI_SVOL] = MCI_SVOL_DEF; + if (McDevProf_GetDevId() != eMCDRV_DEV_ID_80_90H) { + gsGlobalInfo.abRegValANA[MCI_HIZ] = MCI_HIZ_DEF; + gsGlobalInfo.abRegValANA[MCI_LO_HIZ] = MCI_LO_HIZ_DEF; + } + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H) { + ; + gsGlobalInfo.abRegValANA[MCI_ZCOFF] = MCI_ZCOFF_DEF_ES1; + } + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H) { + gsGlobalInfo.abRegValANA[MCI_CPMOD] = MCI_CPMOD_DEF_ES1; + gsGlobalInfo.abRegValANA[MCI_DNG_ES1] = MCI_DNG_DEF_ES1; + gsGlobalInfo.abRegValANA[MCI_DNG_HP_ES1] + = MCI_DNG_HP_DEF_ES1; + gsGlobalInfo.abRegValANA[MCI_DNG_SP_ES1] + = MCI_DNG_SP_DEF_ES1; + gsGlobalInfo.abRegValANA[MCI_DNG_RC_ES1] + = MCI_DNG_RC_DEF_ES1; + gsGlobalInfo.abRegValANA[MCI_DNG_LO1_ES1] + = MCI_DNG_LO1_DEF_ES1; + gsGlobalInfo.abRegValANA[MCI_DNG_LO2_ES1] + = MCI_DNG_LO2_DEF_ES1; + } else { + gsGlobalInfo.abRegValANA[MCI_CPMOD] = MCI_CPMOD_DEF; + gsGlobalInfo.abRegValANA[MCI_DNG] = MCI_DNG_DEF; + gsGlobalInfo.abRegValANA[MCI_DNG_HP] = MCI_DNG_HP_DEF; + gsGlobalInfo.abRegValANA[MCI_DNG_SP] = MCI_DNG_SP_DEF; + gsGlobalInfo.abRegValANA[MCI_DNG_RC] = MCI_DNG_RC_DEF; + gsGlobalInfo.abRegValANA[MCI_DNG_LO1] = MCI_DNG_LO1_DEF; + gsGlobalInfo.abRegValANA[MCI_DNG_LO2] = MCI_DNG_LO2_DEF; + gsGlobalInfo.abRegValANA[114] = 0x31; + gsGlobalInfo.abRegValANA[115] = 0x8B; + } + + for (i = 0; i < MCDRV_REG_NUM_CD; i++) + gsGlobalInfo.abRegValCD[i] = 0; + + gsGlobalInfo.abRegValCD[MCI_HW_ID] = MCI_HW_ID_DEF; + gsGlobalInfo.abRegValCD[MCI_CD_RST] = MCI_CD_RST_DEF; + gsGlobalInfo.abRegValCD[MCI_DP] = MCI_DP_DEF; + gsGlobalInfo.abRegValCD[MCI_DP_OSC] = MCI_DP_OSC_DEF; + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H) { + ; + gsGlobalInfo.abRegValCD[MCI_CKSEL] = MCI_CKSEL_DEF_ES1; + } else { + gsGlobalInfo.abRegValCD[MCI_CKSEL] = MCI_CKSEL_DEF; + } + gsGlobalInfo.abRegValCD[MCI_MICDET] = MCI_MICDET_DEF; + gsGlobalInfo.abRegValCD[MCI_HSDETEN] = MCI_HSDETEN_DEF; + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H) { + gsGlobalInfo.abRegValCD[MCI_DETIN_INV] = MCI_DETIN_INV_DEF_ES1; + } else { + gsGlobalInfo.abRegValCD[MCI_IRQTYPE] = MCI_IRQTYPE_DEF; + gsGlobalInfo.abRegValCD[MCI_DETIN_INV] = MCI_DETIN_INV_DEF; + } + gsGlobalInfo.abRegValCD[MCI_HSDETMODE] = MCI_HSDETMODE_DEF; + gsGlobalInfo.abRegValCD[MCI_DBNC_PERIOD] = MCI_DBNC_PERIOD_DEF; + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H) { + gsGlobalInfo.abRegValCD[MCI_DBNC_NUM] = MCI_DBNC_NUM_DEF_ES1; + } else { + gsGlobalInfo.abRegValCD[MCI_DBNC_NUM] = MCI_DBNC_NUM_DEF; + gsGlobalInfo.abRegValCD[MCI_KEY_MTIM] = MCI_KEY_MTIM_DEF; + } + if (McDevProf_GetDevId() != eMCDRV_DEV_ID_80_90H) { + ; + gsGlobalInfo.abRegValCD[39] = 0x21; + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McResCtrl_SetRegDefault", 0); +#endif +} + +/**************************************************************************** + * InitClockSw + * + * Description: + * Initialize switch clock info. + * Arguments: + * none + * Return: + * none + * + ****************************************************************************/ +static void InitClockSw( + void +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("InitClockSw"); +#endif + + gsGlobalInfo.sClockSwInfo.bClkSrc = MCDRV_CLKSW_CLKA; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("InitClockSw", 0); +#endif +} + +/**************************************************************************** + * InitPathInfo + * + * Description: + * Initialize path info. + * Arguments: + * none + * Return: + * none + * + ****************************************************************************/ +static void InitPathInfo( + void +) +{ + UINT8 bCh; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("InitPathInfo"); +#endif + + for (bCh = 0; bCh < MUSICOUT_PATH_CHANNELS; bCh++) + ClearD1SourceOnOff( + &gsGlobalInfo.sPathInfo.asMusicOut[bCh].dSrcOnOff); + + for (bCh = 0; bCh < EXTOUT_PATH_CHANNELS; bCh++) + ClearD1SourceOnOff( + &gsGlobalInfo.sPathInfo.asExtOut[bCh].dSrcOnOff); + + for (bCh = 0; bCh < HIFIOUT_PATH_CHANNELS; bCh++) + ClearD1SourceOnOff( + &gsGlobalInfo.sPathInfo.asHifiOut[bCh].dSrcOnOff); + + for (bCh = 0; bCh < VBOXMIXIN_PATH_CHANNELS; bCh++) + ClearD1SourceOnOff( + &gsGlobalInfo.sPathInfo.asVboxMixIn[bCh].dSrcOnOff); + + for (bCh = 0; bCh < AE_PATH_CHANNELS; bCh++) { + ClearD1SourceOnOff( + &gsGlobalInfo.sPathInfo.asAe0[bCh].dSrcOnOff); + ClearD1SourceOnOff( + &gsGlobalInfo.sPathInfo.asAe1[bCh].dSrcOnOff); + ClearD1SourceOnOff( + &gsGlobalInfo.sPathInfo.asAe2[bCh].dSrcOnOff); + ClearD1SourceOnOff( + &gsGlobalInfo.sPathInfo.asAe3[bCh].dSrcOnOff); + } + for (bCh = 0; bCh < DAC0_PATH_CHANNELS; bCh++) + ClearD1SourceOnOff( + &gsGlobalInfo.sPathInfo.asDac0[bCh].dSrcOnOff); + + for (bCh = 0; bCh < DAC1_PATH_CHANNELS; bCh++) + ClearD1SourceOnOff( + &gsGlobalInfo.sPathInfo.asDac1[bCh].dSrcOnOff); + + for (bCh = 0; bCh < VOICEOUT_PATH_CHANNELS; bCh++) + ClearD2SourceOnOff( + &gsGlobalInfo.sPathInfo.asVoiceOut[bCh].dSrcOnOff); + + for (bCh = 0; bCh < VBOXIOIN_PATH_CHANNELS; bCh++) + ClearD2SourceOnOff( + &gsGlobalInfo.sPathInfo.asVboxIoIn[bCh].dSrcOnOff); + + for (bCh = 0; bCh < VBOXHOSTIN_PATH_CHANNELS; bCh++) + ClearD2SourceOnOff( + &gsGlobalInfo.sPathInfo.asVboxHostIn[bCh].dSrcOnOff); + + for (bCh = 0; bCh < HOSTOUT_PATH_CHANNELS; bCh++) + ClearD2SourceOnOff( + &gsGlobalInfo.sPathInfo.asHostOut[bCh].dSrcOnOff); + + for (bCh = 0; bCh < ADIF0_PATH_CHANNELS; bCh++) + ClearD2SourceOnOff( + &gsGlobalInfo.sPathInfo.asAdif0[bCh].dSrcOnOff); + + for (bCh = 0; bCh < ADIF1_PATH_CHANNELS; bCh++) + ClearD2SourceOnOff( + &gsGlobalInfo.sPathInfo.asAdif1[bCh].dSrcOnOff); + + for (bCh = 0; bCh < ADIF2_PATH_CHANNELS; bCh++) + ClearD2SourceOnOff( + &gsGlobalInfo.sPathInfo.asAdif2[bCh].dSrcOnOff); + + for (bCh = 0; bCh < ADC0_PATH_CHANNELS; bCh++) + ClearASourceOnOff( + &gsGlobalInfo.sPathInfo.asAdc0[bCh].dSrcOnOff); + + for (bCh = 0; bCh < ADC1_PATH_CHANNELS; bCh++) + ClearASourceOnOff( + &gsGlobalInfo.sPathInfo.asAdc1[bCh].dSrcOnOff); + + for (bCh = 0; bCh < SP_PATH_CHANNELS; bCh++) + ClearASourceOnOff( + &gsGlobalInfo.sPathInfo.asSp[bCh].dSrcOnOff); + + for (bCh = 0; bCh < HP_PATH_CHANNELS; bCh++) + ClearASourceOnOff( + &gsGlobalInfo.sPathInfo.asHp[bCh].dSrcOnOff); + + for (bCh = 0; bCh < RC_PATH_CHANNELS; bCh++) + ClearASourceOnOff( + &gsGlobalInfo.sPathInfo.asRc[bCh].dSrcOnOff); + + for (bCh = 0; bCh < LOUT1_PATH_CHANNELS; bCh++) + ClearASourceOnOff( + &gsGlobalInfo.sPathInfo.asLout1[bCh].dSrcOnOff); + + for (bCh = 0; bCh < LOUT2_PATH_CHANNELS; bCh++) + ClearASourceOnOff( + &gsGlobalInfo.sPathInfo.asLout2[bCh].dSrcOnOff); + + for (bCh = 0; bCh < BIAS_PATH_CHANNELS; bCh++) + ClearASourceOnOff( + &gsGlobalInfo.sPathInfo.asBias[bCh].dSrcOnOff); + + gsGlobalInfo.sPathInfoVirtual = gsGlobalInfo.sPathInfo; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("InitPathInfo", 0); +#endif +} + +/**************************************************************************** + * InitVolInfo + * + * Description: + * Initialize volume info. + * Arguments: + * none + * Return: + * none + * + ****************************************************************************/ +static void InitVolInfo( + void +) +{ + UINT8 bCh; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("InitVolInfo"); +#endif + + for (bCh = 0; bCh < MUSICIN_VOL_CHANNELS; bCh++) + gsGlobalInfo.sVolInfo.aswD_MusicIn[bCh] = + MCDRV_LOGICAL_VOL_MUTE; + + for (bCh = 0; bCh < EXTIN_VOL_CHANNELS; bCh++) + gsGlobalInfo.sVolInfo.aswD_ExtIn[bCh] = + MCDRV_LOGICAL_VOL_MUTE; + + for (bCh = 0; bCh < VOICEIN_VOL_CHANNELS; bCh++) + gsGlobalInfo.sVolInfo.aswD_VoiceIn[bCh] = + MCDRV_LOGICAL_VOL_MUTE; + + for (bCh = 0; bCh < REFIN_VOL_CHANNELS; bCh++) + gsGlobalInfo.sVolInfo.aswD_RefIn[bCh] = + MCDRV_LOGICAL_VOL_MUTE; + + for (bCh = 0; bCh < ADIF0IN_VOL_CHANNELS; bCh++) + gsGlobalInfo.sVolInfo.aswD_Adif0In[bCh] = + MCDRV_LOGICAL_VOL_MUTE; + + for (bCh = 0; bCh < ADIF1IN_VOL_CHANNELS; bCh++) + gsGlobalInfo.sVolInfo.aswD_Adif1In[bCh] = + MCDRV_LOGICAL_VOL_MUTE; + + for (bCh = 0; bCh < ADIF2IN_VOL_CHANNELS; bCh++) + gsGlobalInfo.sVolInfo.aswD_Adif2In[bCh] = + MCDRV_LOGICAL_VOL_MUTE; + + for (bCh = 0; bCh < MUSICOUT_VOL_CHANNELS; bCh++) + gsGlobalInfo.sVolInfo.aswD_MusicOut[bCh] = + MCDRV_LOGICAL_VOL_MUTE; + + for (bCh = 0; bCh < EXTOUT_VOL_CHANNELS; bCh++) + gsGlobalInfo.sVolInfo.aswD_ExtOut[bCh] = + MCDRV_LOGICAL_VOL_MUTE; + + for (bCh = 0; bCh < VOICEOUT_VOL_CHANNELS; bCh++) + gsGlobalInfo.sVolInfo.aswD_VoiceOut[bCh] = + MCDRV_LOGICAL_VOL_MUTE; + + for (bCh = 0; bCh < REFOUT_VOL_CHANNELS; bCh++) + gsGlobalInfo.sVolInfo.aswD_RefOut[bCh] = + MCDRV_LOGICAL_VOL_MUTE; + + for (bCh = 0; bCh < DAC0OUT_VOL_CHANNELS; bCh++) + gsGlobalInfo.sVolInfo.aswD_Dac0Out[bCh] = + MCDRV_LOGICAL_VOL_MUTE; + + for (bCh = 0; bCh < DAC1OUT_VOL_CHANNELS; bCh++) + gsGlobalInfo.sVolInfo.aswD_Dac1Out[bCh] = + MCDRV_LOGICAL_VOL_MUTE; + + for (bCh = 0; bCh < DPATH_VOL_CHANNELS; bCh++) { + gsGlobalInfo.sVolInfo.aswD_DpathDa[bCh] = + MCDRV_LOGICAL_VOL_MUTE; + gsGlobalInfo.sVolInfo.aswD_DpathAd[bCh] = + MCDRV_LOGICAL_VOL_MUTE; + } + + for (bCh = 0; bCh < LINEIN1_VOL_CHANNELS; bCh++) + gsGlobalInfo.sVolInfo.aswA_LineIn1[bCh] = + MCDRV_LOGICAL_VOL_MUTE; + + for (bCh = 0; bCh < MIC1_VOL_CHANNELS; bCh++) + gsGlobalInfo.sVolInfo.aswA_Mic1[bCh] = + MCDRV_LOGICAL_VOL_MUTE; + + for (bCh = 0; bCh < MIC2_VOL_CHANNELS; bCh++) + gsGlobalInfo.sVolInfo.aswA_Mic2[bCh] = + MCDRV_LOGICAL_VOL_MUTE; + + for (bCh = 0; bCh < MIC3_VOL_CHANNELS; bCh++) + gsGlobalInfo.sVolInfo.aswA_Mic3[bCh] = + MCDRV_LOGICAL_VOL_MUTE; + + for (bCh = 0; bCh < MIC4_VOL_CHANNELS; bCh++) + gsGlobalInfo.sVolInfo.aswA_Mic4[bCh] = + MCDRV_LOGICAL_VOL_MUTE; + + for (bCh = 0; bCh < HP_VOL_CHANNELS; bCh++) + gsGlobalInfo.sVolInfo.aswA_Hp[bCh] = + MCDRV_LOGICAL_VOL_MUTE; + + for (bCh = 0; bCh < SP_VOL_CHANNELS; bCh++) + gsGlobalInfo.sVolInfo.aswA_Sp[bCh] = + MCDRV_LOGICAL_VOL_MUTE; + + for (bCh = 0; bCh < RC_VOL_CHANNELS; bCh++) + gsGlobalInfo.sVolInfo.aswA_Rc[bCh] = + MCDRV_LOGICAL_VOL_MUTE; + + for (bCh = 0; bCh < LINEOUT1_VOL_CHANNELS; bCh++) + gsGlobalInfo.sVolInfo.aswA_LineOut1[bCh] = + MCDRV_LOGICAL_VOL_MUTE; + + for (bCh = 0; bCh < LINEOUT2_VOL_CHANNELS; bCh++) + gsGlobalInfo.sVolInfo.aswA_LineOut2[bCh] = + MCDRV_LOGICAL_VOL_MUTE; + + for (bCh = 0; bCh < HPDET_VOL_CHANNELS; bCh++) + gsGlobalInfo.sVolInfo.aswA_HpDet[bCh] = + MCDRV_LOGICAL_VOL_MUTE; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("InitVolInfo", 0); +#endif +} + +/**************************************************************************** + * InitDioInfo + * + * Description: + * Initialize Digital I/O info. + * Arguments: + * none + * Return: + * none + * + ****************************************************************************/ +static void InitDioInfo( + void +) +{ + UINT8 bPort, bPortNum; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("InitDioInfo"); +#endif + bPortNum = GET_ARRAY_SIZE(gsGlobalInfo.sDioInfo.asPortInfo); + + for (bPort = 0; bPort < bPortNum; bPort++) { + gsGlobalInfo.sDioInfo.asPortInfo[bPort].sDioCommon.bMasterSlave + = MCDRV_DIO_SLAVE; + gsGlobalInfo.sDioInfo.asPortInfo[bPort].sDioCommon.bAutoFs + = MCDRV_AUTOFS_ON; + gsGlobalInfo.sDioInfo.asPortInfo[bPort].sDioCommon.bFs + = MCDRV_FS_48000; + gsGlobalInfo.sDioInfo.asPortInfo[bPort].sDioCommon.bBckFs + = MCDRV_BCKFS_64; + gsGlobalInfo.sDioInfo.asPortInfo[bPort].sDioCommon.bInterface + = MCDRV_DIO_DA; + gsGlobalInfo.sDioInfo.asPortInfo[bPort].sDioCommon.bBckInvert + = MCDRV_BCLK_NORMAL; + gsGlobalInfo.sDioInfo.asPortInfo[bPort].sDioCommon.bSrcThru + = MCDRV_SRC_NOT_THRU; + gsGlobalInfo.sDioInfo.asPortInfo[bPort].sDioCommon.bPcmHizTim + = MCDRV_PCMHIZTIM_FALLING; + gsGlobalInfo.sDioInfo.asPortInfo[bPort].sDioCommon.bPcmFrame + = MCDRV_PCM_SHORTFRAME; + gsGlobalInfo.sDioInfo.asPortInfo[ + bPort].sDioCommon.bPcmHighPeriod + = 0; + + gsGlobalInfo.sDioInfo.asPortInfo[bPort].sDir.sDaFormat.bBitSel + = MCDRV_BITSEL_16; + gsGlobalInfo.sDioInfo.asPortInfo[bPort].sDir.sDaFormat.bMode + = MCDRV_DAMODE_HEADALIGN; + gsGlobalInfo.sDioInfo.asPortInfo[bPort].sDir.sPcmFormat.bMono + = MCDRV_PCM_MONO; + gsGlobalInfo.sDioInfo.asPortInfo[bPort].sDir.sPcmFormat.bOrder + = MCDRV_PCM_MSB_FIRST; + gsGlobalInfo.sDioInfo.asPortInfo[bPort].sDir.sPcmFormat.bLaw + = MCDRV_PCM_LINEAR; + gsGlobalInfo.sDioInfo.asPortInfo[bPort].sDir.sPcmFormat.bBitSel + = MCDRV_PCM_BITSEL_8; + + gsGlobalInfo.sDioInfo.asPortInfo[bPort].sDit.bStMode + = MCDRV_STMODE_ZERO; + gsGlobalInfo.sDioInfo.asPortInfo[bPort].sDit.bEdge + = MCDRV_SDOUT_NORMAL; + gsGlobalInfo.sDioInfo.asPortInfo[bPort].sDit.sDaFormat.bBitSel + = MCDRV_BITSEL_16; + gsGlobalInfo.sDioInfo.asPortInfo[bPort].sDit.sDaFormat.bMode + = MCDRV_DAMODE_HEADALIGN; + gsGlobalInfo.sDioInfo.asPortInfo[bPort].sDit.sPcmFormat.bMono + = MCDRV_PCM_MONO; + gsGlobalInfo.sDioInfo.asPortInfo[bPort].sDit.sPcmFormat.bOrder + = MCDRV_PCM_MSB_FIRST; + gsGlobalInfo.sDioInfo.asPortInfo[bPort].sDit.sPcmFormat.bLaw + = MCDRV_PCM_LINEAR; + gsGlobalInfo.sDioInfo.asPortInfo[bPort].sDit.sPcmFormat.bBitSel + = MCDRV_PCM_BITSEL_8; + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("InitDioInfo", 0); +#endif +} + +/**************************************************************************** + * InitDioPathInfo + * + * Description: + * Initialize Digital I/O path info. + * Arguments: + * none + * Return: + * none + * + ****************************************************************************/ +static void InitDioPathInfo( + void +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("InitDioPathInfo"); +#endif + + gsGlobalInfo.sDioPathInfo.abPhysPort[0] = MCDRV_PHYSPORT_DIO0; + gsGlobalInfo.sDioPathInfo.abPhysPort[1] = MCDRV_PHYSPORT_DIO1; + gsGlobalInfo.sDioPathInfo.abPhysPort[2] = MCDRV_PHYSPORT_DIO2; + gsGlobalInfo.sDioPathInfo.abPhysPort[3] = MCDRV_PHYSPORT_NONE; + gsGlobalInfo.sDioPathInfo.bMusicCh = MCDRV_MUSIC_2CH; + gsGlobalInfo.sDioPathInfo.abMusicRSlot[0] = 0; + gsGlobalInfo.sDioPathInfo.abMusicRSlot[1] = 1; + gsGlobalInfo.sDioPathInfo.abMusicRSlot[2] = 2; + gsGlobalInfo.sDioPathInfo.abMusicTSlot[0] = 0; + gsGlobalInfo.sDioPathInfo.abMusicTSlot[1] = 1; + gsGlobalInfo.sDioPathInfo.abMusicTSlot[2] = 2; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("InitDioPathInfo", 0); +#endif +} + +/**************************************************************************** + * InitSwap + * + * Description: + * Initialize Swap info. + * Arguments: + * none + * Return: + * none + * + ****************************************************************************/ +static void InitSwap( + void +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("InitSwap"); +#endif + + gsGlobalInfo.sSwapInfo.bAdif0 = MCDRV_SWAP_NORMAL; + gsGlobalInfo.sSwapInfo.bAdif1 = MCDRV_SWAP_NORMAL; + gsGlobalInfo.sSwapInfo.bAdif2 = MCDRV_SWAP_NORMAL; + gsGlobalInfo.sSwapInfo.bDac0 = MCDRV_SWAP_NORMAL; + gsGlobalInfo.sSwapInfo.bDac1 = MCDRV_SWAP_NORMAL; + + gsGlobalInfo.sSwapInfo.bMusicIn0 = MCDRV_SWSWAP_NORMAL; + gsGlobalInfo.sSwapInfo.bMusicIn1 = MCDRV_SWSWAP_NORMAL; + gsGlobalInfo.sSwapInfo.bMusicIn2 = MCDRV_SWSWAP_NORMAL; + gsGlobalInfo.sSwapInfo.bExtIn = MCDRV_SWSWAP_NORMAL; + gsGlobalInfo.sSwapInfo.bVoiceIn = MCDRV_SWSWAP_NORMAL; + gsGlobalInfo.sSwapInfo.bHifiIn = MCDRV_SWSWAP_NORMAL; + gsGlobalInfo.sSwapInfo.bMusicOut0 = MCDRV_SWSWAP_NORMAL; + gsGlobalInfo.sSwapInfo.bMusicOut1 = MCDRV_SWSWAP_NORMAL; + gsGlobalInfo.sSwapInfo.bMusicOut2 = MCDRV_SWSWAP_NORMAL; + gsGlobalInfo.sSwapInfo.bExtOut = MCDRV_SWSWAP_NORMAL; + gsGlobalInfo.sSwapInfo.bVoiceOut = MCDRV_SWSWAP_NORMAL; + gsGlobalInfo.sSwapInfo.bHifiOut = MCDRV_SWSWAP_NORMAL; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("InitSwap", 0); +#endif +} + +/**************************************************************************** + * InitHSDet + * + * Description: + * Initialize Headset Det info. + * Arguments: + * none + * Return: + * none + * + ****************************************************************************/ +static void InitHSDet( + void +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("InitHSDet"); +#endif + + gsGlobalInfo.sHSDetInfo.bEnPlugDet = MCDRV_PLUGDET_DISABLE; + gsGlobalInfo.sHSDetInfo.bEnPlugDetDb = MCDRV_PLUGDETDB_DISABLE; + gsGlobalInfo.sHSDetInfo.bEnDlyKeyOff = MCDRV_KEYEN_D_D_D; + gsGlobalInfo.sHSDetInfo.bEnDlyKeyOn = MCDRV_KEYEN_D_D_D; + gsGlobalInfo.sHSDetInfo.bEnMicDet = MCDRV_MICDET_DISABLE; + gsGlobalInfo.sHSDetInfo.bEnKeyOff = MCDRV_KEYEN_D_D_D; + gsGlobalInfo.sHSDetInfo.bEnKeyOn = MCDRV_KEYEN_D_D_D; + gsGlobalInfo.sHSDetInfo.bHsDetDbnc = MCDRV_DETDBNC_875; + gsGlobalInfo.sHSDetInfo.bKeyOffMtim = MCDRV_KEYOFF_MTIM_63; + gsGlobalInfo.sHSDetInfo.bKeyOnMtim = MCDRV_KEYON_MTIM_63; + gsGlobalInfo.sHSDetInfo.bKey0OffDlyTim = 0; + gsGlobalInfo.sHSDetInfo.bKey1OffDlyTim = 0; + gsGlobalInfo.sHSDetInfo.bKey2OffDlyTim = 0; + gsGlobalInfo.sHSDetInfo.bKey0OnDlyTim = 0; + gsGlobalInfo.sHSDetInfo.bKey1OnDlyTim = 0; + gsGlobalInfo.sHSDetInfo.bKey2OnDlyTim = 0; + gsGlobalInfo.sHSDetInfo.bKey0OnDlyTim2 = 0; + gsGlobalInfo.sHSDetInfo.bKey1OnDlyTim2 = 0; + gsGlobalInfo.sHSDetInfo.bKey2OnDlyTim2 = 0; + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H) + gsGlobalInfo.sHSDetInfo.bIrqType = MCDRV_IRQTYPE_NORMAL; + else + gsGlobalInfo.sHSDetInfo.bIrqType = MCDRV_IRQTYPE_REF; + gsGlobalInfo.sHSDetInfo.bDetInInv = MCDRV_DET_IN_INV; + gsGlobalInfo.sHSDetInfo.bHsDetMode = MCDRV_HSDET_MODE_DETIN_A; + gsGlobalInfo.sHSDetInfo.bSperiod = MCDRV_SPERIOD_3906; + gsGlobalInfo.sHSDetInfo.bLperiod = MCDRV_LPERIOD_125000; + gsGlobalInfo.sHSDetInfo.bDbncNumPlug = MCDRV_DBNC_NUM_7; + gsGlobalInfo.sHSDetInfo.bDbncNumMic = MCDRV_DBNC_NUM_7; + gsGlobalInfo.sHSDetInfo.bDbncNumKey = MCDRV_DBNC_NUM_7; + gsGlobalInfo.sHSDetInfo.bSgnlPeriod = MCDRV_SGNLPERIOD_97; + gsGlobalInfo.sHSDetInfo.bSgnlNum = MCDRV_SGNLNUM_8; + gsGlobalInfo.sHSDetInfo.bSgnlPeak = MCDRV_SGNLPEAK_1182; + gsGlobalInfo.sHSDetInfo.bImpSel = MCDRV_IMPSEL_MOSTFREQ; + gsGlobalInfo.sHSDetInfo.bDlyIrqStop = MCDRV_DLYIRQ_DONTCARE; + gsGlobalInfo.sHSDetInfo.cbfunc = NULL; + + gsGlobalInfo.sHSDet2Info.bPlugDetDbIrqType = MCDRV_IRQTYPE_REF; + gsGlobalInfo.sHSDet2Info.bPlugUndetDbIrqType = MCDRV_IRQTYPE_REF; + gsGlobalInfo.sHSDet2Info.bMicDetIrqType = MCDRV_IRQTYPE_REF; + gsGlobalInfo.sHSDet2Info.bPlugDetIrqType = MCDRV_IRQTYPE_REF; + gsGlobalInfo.sHSDet2Info.bKey0OnIrqType = MCDRV_IRQTYPE_REF; + gsGlobalInfo.sHSDet2Info.bKey1OnIrqType = MCDRV_IRQTYPE_REF; + gsGlobalInfo.sHSDet2Info.bKey2OnIrqType = MCDRV_IRQTYPE_REF; + gsGlobalInfo.sHSDet2Info.bKey0OffIrqType = MCDRV_IRQTYPE_REF; + gsGlobalInfo.sHSDet2Info.bKey1OffIrqType = MCDRV_IRQTYPE_REF; + gsGlobalInfo.sHSDet2Info.bKey2OffIrqType = MCDRV_IRQTYPE_REF; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("InitHSDet", 0); +#endif +} + + +/**************************************************************************** + * InitGpMode + * + * Description: + * Initialize Gp mode. + * Arguments: + * none + * Return: + * none + * + ****************************************************************************/ +static void InitGpMode( + void +) +{ + UINT8 bGpioIdx; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("InitGpMode"); +#endif + + for (bGpioIdx = 0; bGpioIdx < 3; bGpioIdx++) { + gsGlobalInfo.sGpMode.abGpDdr[bGpioIdx] + = MCDRV_GPDDR_IN; + gsGlobalInfo.sGpMode.abGpHost[bGpioIdx] + = MCDRV_GPHOST_CPU; + gsGlobalInfo.sGpMode.abGpInvert[bGpioIdx] + = MCDRV_GPINV_NORMAL; + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("InitGpMode", 0); +#endif +} + +/**************************************************************************** + * InitGpMask + * + * Description: + * Initialize Gp mask. + * Arguments: + * none + * Return: + * none + * + ****************************************************************************/ +static void InitGpMask( + void +) +{ + UINT8 bGpioIdx; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("InitGpMask"); +#endif + + for (bGpioIdx = 0; bGpioIdx < 3; bGpioIdx++) + gsGlobalInfo.abGpMask[bGpioIdx] = MCDRV_GPMASK_ON; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("InitGpMask", 0); +#endif +} + +/**************************************************************************** + * InitAecInfo + * + * Description: + * Initialize Aec Info. + * Arguments: + * none + * Return: + * none + * + ****************************************************************************/ +static void InitAecInfo( + void +) +{ + UINT8 i; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("InitAecInfo"); +#endif + + gsGlobalInfo.sAecInfo.sAecConfig.bFDspLocate = 0; + + gsGlobalInfo.sAecInfo.sAecAudioengine.bEnable = 0; + gsGlobalInfo.sAecInfo.sAecAudioengine.bAEOnOff = 0; + gsGlobalInfo.sAecInfo.sAecAudioengine.bFDspOnOff = 0; + gsGlobalInfo.sAecInfo.sAecAudioengine.bBDspAE0Src = 0; + gsGlobalInfo.sAecInfo.sAecAudioengine.bBDspAE1Src = 0; + gsGlobalInfo.sAecInfo.sAecAudioengine.bMixerIn0Src = 0; + gsGlobalInfo.sAecInfo.sAecAudioengine.bMixerIn1Src = 0; + gsGlobalInfo.sAecInfo.sAecAudioengine.bMixerIn2Src = 0; + gsGlobalInfo.sAecInfo.sAecAudioengine.bMixerIn3Src = 0; + gsGlobalInfo.sAecInfo.sAecAudioengine.sAecBDsp.pbChunkData = NULL; + gsGlobalInfo.sAecInfo.sAecAudioengine.sAecBDsp.dwSize = 0; + gsGlobalInfo.sAecInfo.sAecAudioengine.sAecFDsp.pbChunkData = NULL; + gsGlobalInfo.sAecInfo.sAecAudioengine.sAecFDsp.dwSize = 0; + + gsGlobalInfo.sAecInfo.sAecVBox.bEnable = 0; + gsGlobalInfo.sAecInfo.sAecVBox.bCDspFuncAOnOff = 0; + gsGlobalInfo.sAecInfo.sAecVBox.bCDspFuncBOnOff = 0; + gsGlobalInfo.sAecInfo.sAecVBox.bFDspOnOff = 0; + gsGlobalInfo.sAecInfo.sAecVBox.bFdsp_Po_Source = 0; + gsGlobalInfo.sAecInfo.sAecVBox.bISrc2_VSource = 0; + gsGlobalInfo.sAecInfo.sAecVBox.bISrc2_Ch1_VSource = 0; + gsGlobalInfo.sAecInfo.sAecVBox.bISrc3_VSource = 0; + gsGlobalInfo.sAecInfo.sAecVBox.bLPt2_VSource = 0; + gsGlobalInfo.sAecInfo.sAecVBox.bLPt2_Mix_VolI = 0; + gsGlobalInfo.sAecInfo.sAecVBox.bLPt2_Mix_VolO = 0; + gsGlobalInfo.sAecInfo.sAecVBox.bSrc3_Ctrl = 0; + gsGlobalInfo.sAecInfo.sAecVBox.bSrc2_Fs = 0; + gsGlobalInfo.sAecInfo.sAecVBox.bSrc2_Thru = 0; + gsGlobalInfo.sAecInfo.sAecVBox.bSrc3_Fs = 0; + gsGlobalInfo.sAecInfo.sAecVBox.bSrc3_Thru = 0; + gsGlobalInfo.sAecInfo.sAecVBox.sAecCDspA.pbChunkData = NULL; + gsGlobalInfo.sAecInfo.sAecVBox.sAecCDspA.dwSize = 0; + gsGlobalInfo.sAecInfo.sAecVBox.sAecCDspB.pbChunkData = NULL; + gsGlobalInfo.sAecInfo.sAecVBox.sAecCDspB.dwSize = 0; + gsGlobalInfo.sAecInfo.sAecVBox.sAecFDsp.pbChunkData = NULL; + gsGlobalInfo.sAecInfo.sAecVBox.sAecFDsp.dwSize = 0; + gsGlobalInfo.sAecInfo.sAecVBox.sAecCDspDbg.bJtagOn = 0; + + gsGlobalInfo.sAecInfo.sOutput.bLpf_Pre_Thru[0] = 1; + gsGlobalInfo.sAecInfo.sOutput.bLpf_Post_Thru[0] = 1; + gsGlobalInfo.sAecInfo.sOutput.bLpf_Pre_Thru[1] = 0; + gsGlobalInfo.sAecInfo.sOutput.bLpf_Post_Thru[1] = 0; + for (i = 0; i < MCDRV_AEC_OUTPUT_N; i++) { + gsGlobalInfo.sAecInfo.sOutput.bDcc_Sel[i] = 2; + gsGlobalInfo.sAecInfo.sOutput.bPow_Det_Lvl[i] = 0; + gsGlobalInfo.sAecInfo.sOutput.bOsf_Sel[i] = 3; + gsGlobalInfo.sAecInfo.sOutput.bSys_Eq_Enb[i] = 0; + gsGlobalInfo.sAecInfo.sOutput.bSys_Eq_Coef_A0[i][0] = 0; + gsGlobalInfo.sAecInfo.sOutput.bSys_Eq_Coef_A0[i][1] = 0; + gsGlobalInfo.sAecInfo.sOutput.bSys_Eq_Coef_A0[i][2] = 0; + gsGlobalInfo.sAecInfo.sOutput.bSys_Eq_Coef_A1[i][0] = 0; + gsGlobalInfo.sAecInfo.sOutput.bSys_Eq_Coef_A1[i][1] = 0; + gsGlobalInfo.sAecInfo.sOutput.bSys_Eq_Coef_A1[i][2] = 0; + gsGlobalInfo.sAecInfo.sOutput.bSys_Eq_Coef_A2[i][0] = 0; + gsGlobalInfo.sAecInfo.sOutput.bSys_Eq_Coef_A2[i][1] = 0; + gsGlobalInfo.sAecInfo.sOutput.bSys_Eq_Coef_A2[i][2] = 0; + gsGlobalInfo.sAecInfo.sOutput.bSys_Eq_Coef_B1[i][0] = 0; + gsGlobalInfo.sAecInfo.sOutput.bSys_Eq_Coef_B1[i][1] = 0; + gsGlobalInfo.sAecInfo.sOutput.bSys_Eq_Coef_B1[i][2] = 0; + gsGlobalInfo.sAecInfo.sOutput.bSys_Eq_Coef_B2[i][0] = 0; + gsGlobalInfo.sAecInfo.sOutput.bSys_Eq_Coef_B2[i][1] = 0; + gsGlobalInfo.sAecInfo.sOutput.bSys_Eq_Coef_B2[i][2] = 0; + gsGlobalInfo.sAecInfo.sOutput.bClip_Md[i] = 0; + gsGlobalInfo.sAecInfo.sOutput.bClip_Att[i] = 0; + gsGlobalInfo.sAecInfo.sOutput.bClip_Rel[i] = 0; + gsGlobalInfo.sAecInfo.sOutput.bClip_G[i] = 0; + gsGlobalInfo.sAecInfo.sOutput.bDcl_OnOff[i] = 0; + gsGlobalInfo.sAecInfo.sOutput.bDcl_Gain[i] = 0; + gsGlobalInfo.sAecInfo.sOutput.bDcl_Limit[i][0] = 0x7F; + gsGlobalInfo.sAecInfo.sOutput.bDcl_Limit[i][1] = 0xFF; + gsGlobalInfo.sAecInfo.sOutput.bRandom_Dither_OnOff[i] = 0; + gsGlobalInfo.sAecInfo.sOutput.bRandom_Dither_Level[i] = 0; + gsGlobalInfo.sAecInfo.sOutput.bRandom_Dither_POS[i] = 0; + gsGlobalInfo.sAecInfo.sOutput.bDc_Dither_OnOff[i] = 0; + gsGlobalInfo.sAecInfo.sOutput.bDc_Dither_Level[i] = 3; + gsGlobalInfo.sAecInfo.sOutput.bDither_Type[i] = 0; + gsGlobalInfo.sAecInfo.sOutput.bDng_On[i] = 0; + gsGlobalInfo.sAecInfo.sOutput.bDng_Fw[i] = 1; + gsGlobalInfo.sAecInfo.sOutput.sSysEqEx[i].sBand[0].bCoef_A0[0] + = 0; + gsGlobalInfo.sAecInfo.sOutput.sSysEqEx[i].sBand[0].bCoef_A0[1] + = 0; + gsGlobalInfo.sAecInfo.sOutput.sSysEqEx[i].sBand[0].bCoef_A0[2] + = 0; + gsGlobalInfo.sAecInfo.sOutput.sSysEqEx[i].sBand[0].bCoef_A1[0] + = 0; + gsGlobalInfo.sAecInfo.sOutput.sSysEqEx[i].sBand[0].bCoef_A1[1] + = 0; + gsGlobalInfo.sAecInfo.sOutput.sSysEqEx[i].sBand[0].bCoef_A1[2] + = 0; + gsGlobalInfo.sAecInfo.sOutput.sSysEqEx[i].sBand[0].bCoef_A2[0] + = 0; + gsGlobalInfo.sAecInfo.sOutput.sSysEqEx[i].sBand[0].bCoef_A2[1] + = 0; + gsGlobalInfo.sAecInfo.sOutput.sSysEqEx[i].sBand[0].bCoef_A2[2] + = 0; + gsGlobalInfo.sAecInfo.sOutput.sSysEqEx[i].sBand[0].bCoef_B1[0] + = 0; + gsGlobalInfo.sAecInfo.sOutput.sSysEqEx[i].sBand[0].bCoef_B1[1] + = 0; + gsGlobalInfo.sAecInfo.sOutput.sSysEqEx[i].sBand[0].bCoef_B1[2] + = 0; + gsGlobalInfo.sAecInfo.sOutput.sSysEqEx[i].sBand[0].bCoef_B2[0] + = 0; + gsGlobalInfo.sAecInfo.sOutput.sSysEqEx[i].sBand[0].bCoef_B2[1] + = 0; + gsGlobalInfo.sAecInfo.sOutput.sSysEqEx[i].sBand[0].bCoef_B2[2] + = 0; + gsGlobalInfo.sAecInfo.sOutput.sSysEqEx[i].sBand[1].bCoef_A0[0] + = 0; + gsGlobalInfo.sAecInfo.sOutput.sSysEqEx[i].sBand[1].bCoef_A0[1] + = 0; + gsGlobalInfo.sAecInfo.sOutput.sSysEqEx[i].sBand[1].bCoef_A0[2] + = 0; + gsGlobalInfo.sAecInfo.sOutput.sSysEqEx[i].sBand[1].bCoef_A1[0] + = 0; + gsGlobalInfo.sAecInfo.sOutput.sSysEqEx[i].sBand[1].bCoef_A1[1] + = 0; + gsGlobalInfo.sAecInfo.sOutput.sSysEqEx[i].sBand[1].bCoef_A1[2] + = 0; + gsGlobalInfo.sAecInfo.sOutput.sSysEqEx[i].sBand[1].bCoef_A2[0] + = 0; + gsGlobalInfo.sAecInfo.sOutput.sSysEqEx[i].sBand[1].bCoef_A2[1] + = 0; + gsGlobalInfo.sAecInfo.sOutput.sSysEqEx[i].sBand[1].bCoef_A2[2] + = 0; + gsGlobalInfo.sAecInfo.sOutput.sSysEqEx[i].sBand[1].bCoef_B1[0] + = 0; + gsGlobalInfo.sAecInfo.sOutput.sSysEqEx[i].sBand[1].bCoef_B1[1] + = 0; + gsGlobalInfo.sAecInfo.sOutput.sSysEqEx[i].sBand[1].bCoef_B1[2] + = 0; + gsGlobalInfo.sAecInfo.sOutput.sSysEqEx[i].sBand[1].bCoef_B2[0] + = 0; + gsGlobalInfo.sAecInfo.sOutput.sSysEqEx[i].sBand[1].bCoef_B2[1] + = 0; + gsGlobalInfo.sAecInfo.sOutput.sSysEqEx[i].sBand[1].bCoef_B2[2] + = 0; + } + gsGlobalInfo.sAecInfo.sOutput.bDng_Zero[0] = 31; + gsGlobalInfo.sAecInfo.sOutput.bDng_Zero[1] = 9; + gsGlobalInfo.sAecInfo.sOutput.bDng_Time[0] = 0; + gsGlobalInfo.sAecInfo.sOutput.bDng_Time[1] = 2; + gsGlobalInfo.sAecInfo.sOutput.bSig_Det_Lvl = 0; + gsGlobalInfo.sAecInfo.sOutput.bOsf_Gain[0][0] = + MCI_OSF_GAIN0_15_8_DEF; + gsGlobalInfo.sAecInfo.sOutput.bOsf_Gain[0][1] = + MCI_OSF_GAIN0_7_0_DEF; + gsGlobalInfo.sAecInfo.sOutput.bOsf_Gain[1][0] = + MCI_OSF_GAIN1_15_8_DEF; + gsGlobalInfo.sAecInfo.sOutput.bOsf_Gain[1][1] = + MCI_OSF_GAIN1_7_0_DEF; + gsGlobalInfo.sAecInfo.sOutput.bDng_Attack = 1; + gsGlobalInfo.sAecInfo.sOutput.bDng_Release = 3; + gsGlobalInfo.sAecInfo.sOutput.bDng_Target[0] = 0x84; + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H) { + gsGlobalInfo.sAecInfo.sOutput.bDng_Target[1] + = MCI_DNG_SP_DEF_ES1; + gsGlobalInfo.sAecInfo.sOutput.bDng_Target_LineOut[0] + = MCI_DNG_LO1_DEF_ES1; + gsGlobalInfo.sAecInfo.sOutput.bDng_Target_LineOut[1] + = MCI_DNG_LO2_DEF_ES1; + gsGlobalInfo.sAecInfo.sOutput.bDng_Target_Rc + = MCI_DNG_RC_DEF_ES1; + } else { + gsGlobalInfo.sAecInfo.sOutput.bDng_Target[1] + = MCI_DNG_SP_DEF; + gsGlobalInfo.sAecInfo.sOutput.bDng_Target_LineOut[0] + = MCI_DNG_LO1_DEF; + gsGlobalInfo.sAecInfo.sOutput.bDng_Target_LineOut[1] + = MCI_DNG_LO2_DEF; + gsGlobalInfo.sAecInfo.sOutput.bDng_Target_Rc + = MCI_DNG_RC_DEF; + } + + for (i = 0; i < MCDRV_AEC_INPUT_N; i++) { + gsGlobalInfo.sAecInfo.sInput.bDsf32_L_Type[i] = 1; + gsGlobalInfo.sAecInfo.sInput.bDsf32_R_Type[i] = 1; + gsGlobalInfo.sAecInfo.sInput.bDsf4_Sel[i] = 1; + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H) { + ; + gsGlobalInfo.sAecInfo.sInput.bDcc_Sel[i] = 2; + } else { + gsGlobalInfo.sAecInfo.sInput.bDcc_Sel[i] = 1; + } + gsGlobalInfo.sAecInfo.sInput.bDng_On[i] = 0; + gsGlobalInfo.sAecInfo.sInput.bDng_Att[i] = 3; + gsGlobalInfo.sAecInfo.sInput.bDng_Rel[i] = 2; + gsGlobalInfo.sAecInfo.sInput.bDng_Fw[i] = 0; + gsGlobalInfo.sAecInfo.sInput.bDng_Tim[i] = 0; + gsGlobalInfo.sAecInfo.sInput.bDng_Zero[i][0] = 0; + gsGlobalInfo.sAecInfo.sInput.bDng_Zero[i][1] = 0; + gsGlobalInfo.sAecInfo.sInput.bDng_Tgt[i][0] = 0; + gsGlobalInfo.sAecInfo.sInput.bDng_Tgt[i][1] = 0; + gsGlobalInfo.sAecInfo.sInput.bDepop_Att[i] = 2; + gsGlobalInfo.sAecInfo.sInput.bDepop_Wait[i] = 2; + } + gsGlobalInfo.sAecInfo.sInput.bRef_Sel = 0; + + gsGlobalInfo.sAecInfo.sPdm.bMode = 0; + gsGlobalInfo.sAecInfo.sPdm.bStWait = 2; + gsGlobalInfo.sAecInfo.sPdm.bPdm0_LoadTim = 0; + gsGlobalInfo.sAecInfo.sPdm.bPdm0_LFineDly = 0; + gsGlobalInfo.sAecInfo.sPdm.bPdm0_RFineDly = 0; + gsGlobalInfo.sAecInfo.sPdm.bPdm1_LoadTim = 0; + gsGlobalInfo.sAecInfo.sPdm.bPdm1_LFineDly = 0; + gsGlobalInfo.sAecInfo.sPdm.bPdm1_RFineDly = 0; + gsGlobalInfo.sAecInfo.sPdm.bPdm0_Data_Delay = 0; + gsGlobalInfo.sAecInfo.sPdm.bPdm1_Data_Delay = 0; + + gsGlobalInfo.sAecInfo.sE2.bEnable = 0; + gsGlobalInfo.sAecInfo.sE2.bE2_Da_Sel = 0; + gsGlobalInfo.sAecInfo.sE2.bE2_Ad_Sel = 0; + gsGlobalInfo.sAecInfo.sE2.bE2OnOff = 0; + gsGlobalInfo.sAecInfo.sE2.sE2Config.pbChunkData = NULL; + gsGlobalInfo.sAecInfo.sE2.sE2Config.dwSize = 0; + + gsGlobalInfo.sAecInfo.sAdj.bHold = 24; + gsGlobalInfo.sAecInfo.sAdj.bCnt = 10; + gsGlobalInfo.sAecInfo.sAdj.bMax[0] = 2; + gsGlobalInfo.sAecInfo.sAdj.bMax[1] = 0; + + gsGlobalInfo.sAecInfo.sEDspMisc.bI2SOut_Enb = 0; + gsGlobalInfo.sAecInfo.sEDspMisc.bChSel = 0; + gsGlobalInfo.sAecInfo.sEDspMisc.bLoopBack = 0; + + gsGlobalInfo.sAecInfo.sControl.bCommand = 0; + gsGlobalInfo.sAecInfo.sControl.bParam[0] = 0; + gsGlobalInfo.sAecInfo.sControl.bParam[1] = 0; + gsGlobalInfo.sAecInfo.sControl.bParam[2] = 0; + gsGlobalInfo.sAecInfo.sControl.bParam[3] = 0; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("InitAecInfo", 0); +#endif +} + +/**************************************************************************** + * McResCtrl_UpdateState + * + * Description: + * update state. + * Arguments: + * eState state + * Return: + * none + * + ****************************************************************************/ +void McResCtrl_UpdateState( + enum MCDRV_STATE eState +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McResCtrl_UpdateState"); +#endif + + geState = eState; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McResCtrl_UpdateState", 0); +#endif +} + +/**************************************************************************** + * McResCtrl_GetState + * + * Description: + * Get state. + * Arguments: + * none + * Return: + * current state + * + ****************************************************************************/ +enum MCDRV_STATE McResCtrl_GetState( + void +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + SINT32 sdRet = geState; + McDebugLog_FuncIn("McResCtrl_GetState"); +#endif + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McResCtrl_GetState", &sdRet); +#endif + + return geState; +} + +/**************************************************************************** + * McResCtrl_GetRegVal + * + * Description: + * Get register value. + * Arguments: + * wRegType register type + * wRegAddr address + * Return: + * register value + * + ****************************************************************************/ +UINT8 McResCtrl_GetRegVal( + UINT16 wRegType, + UINT16 wRegAddr +) +{ + UINT8 bVal = 0; + +#if (MCDRV_DEBUG_LEVEL >= 4) + SINT32 sdRet; + McDebugLog_FuncIn("McResCtrl_GetRegVal"); +#endif + + switch (wRegType) { + case MCDRV_PACKET_REGTYPE_IF: + bVal = gsGlobalInfo.abRegValIF[wRegAddr]; + break; + case MCDRV_PACKET_REGTYPE_A: + bVal = gsGlobalInfo.abRegValA[wRegAddr]; + break; + case MCDRV_PACKET_REGTYPE_MA: + bVal = gsGlobalInfo.abRegValMA[wRegAddr]; + break; + case MCDRV_PACKET_REGTYPE_MB: + bVal = gsGlobalInfo.abRegValMB[wRegAddr]; + break; + case MCDRV_PACKET_REGTYPE_E: + bVal = gsGlobalInfo.abRegValE[wRegAddr]; + break; + case MCDRV_PACKET_REGTYPE_ANA: + bVal = gsGlobalInfo.abRegValANA[wRegAddr]; + break; + case MCDRV_PACKET_REGTYPE_CD: + bVal = gsGlobalInfo.abRegValCD[wRegAddr]; + break; + + default: + break; + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + sdRet = (SINT32)bVal; + McDebugLog_FuncOut("McResCtrl_GetRegVal", &sdRet); +#endif + return bVal; +} + +/**************************************************************************** + * McResCtrl_SetRegVal + * + * Description: + * Set register value. + * Arguments: + * wRegType register type + * wRegAddr address + * bRegVal register value + * Return: + * none + * + ****************************************************************************/ +void McResCtrl_SetRegVal( + UINT16 wRegType, + UINT16 wRegAddr, + UINT8 bRegVal +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McResCtrl_SetRegVal"); +#endif + + switch (wRegType) { + case MCDRV_PACKET_REGTYPE_IF: + gsGlobalInfo.abRegValIF[wRegAddr] = bRegVal; + break; + case MCDRV_PACKET_REGTYPE_A: + gsGlobalInfo.abRegValA[wRegAddr] = bRegVal; + break; + case MCDRV_PACKET_REGTYPE_MA: + gsGlobalInfo.abRegValMA[wRegAddr] = bRegVal; + break; + case MCDRV_PACKET_REGTYPE_MB: + gsGlobalInfo.abRegValMB[wRegAddr] = bRegVal; + break; + case MCDRV_PACKET_REGTYPE_E: + gsGlobalInfo.abRegValE[wRegAddr] = bRegVal; + break; + case MCDRV_PACKET_REGTYPE_ANA: + gsGlobalInfo.abRegValANA[wRegAddr] = bRegVal; + break; + case MCDRV_PACKET_REGTYPE_CD: + gsGlobalInfo.abRegValCD[wRegAddr] = bRegVal; + break; + default: + break; + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McResCtrl_SetRegVal", 0); +#endif +} + +/**************************************************************************** + * McResCtrl_SetInitInfo + * + * Description: + * Set Initialize information. + * Arguments: + * psInitInfo Initialize information + * psInit2Info Initialize information + * Return: + * none + * + ****************************************************************************/ +void McResCtrl_SetInitInfo( + const struct MCDRV_INIT_INFO *psInitInfo, + const struct MCDRV_INIT2_INFO *psInit2Info +) +{ + int i; +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McResCtrl_SetInitInfo"); +#endif + + gsGlobalInfo.sInitInfo = *psInitInfo; + if (psInit2Info != NULL) { + gsGlobalInfo.sInit2Info = *psInit2Info; + } else { + gsGlobalInfo.sInit2Info.bOption[0] = MCDRV_DOA_DRV_HIGH; + gsGlobalInfo.sInit2Info.bOption[1] = MCDRV_SCKMSK_OFF; + gsGlobalInfo.sInit2Info.bOption[2] = MCDRV_SPMN_8_9_10; + for (i = 3; + i < GET_ARRAY_SIZE(gsGlobalInfo.sInit2Info.bOption); i++) { + ; + gsGlobalInfo.sInit2Info.bOption[i] = 0; + } + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McResCtrl_SetInitInfo", 0); +#endif +} + +/**************************************************************************** + * McResCtrl_GetInitInfo + * + * Description: + * Get Initialize information. + * Arguments: + * psInitInfo Initialize information + * psInit2Info Initialize information + * Return: + * none + * + ****************************************************************************/ +void McResCtrl_GetInitInfo( + struct MCDRV_INIT_INFO *psInitInfo, + struct MCDRV_INIT2_INFO *psInit2Info +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McResCtrl_GetInitInfo"); +#endif + + *psInitInfo = gsGlobalInfo.sInitInfo; + if (psInit2Info != NULL) { + ; + *psInit2Info = gsGlobalInfo.sInit2Info; + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McResCtrl_GetInitInfo", 0); +#endif +} + +/**************************************************************************** + * McResCtrl_SetClockSwInfo + * + * Description: + * Set switch clock info. + * Arguments: + * psClockSwInfo pointer to MCDRV_CLOCKSW_INFO struct + * Return: + * none + * + ****************************************************************************/ +void McResCtrl_SetClockSwInfo( + const struct MCDRV_CLOCKSW_INFO *psClockSwInfo +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McResCtrl_SetClockSw"); +#endif + + gsGlobalInfo.sClockSwInfo = *psClockSwInfo; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McResCtrl_SetClockSw", 0); +#endif +} + +/**************************************************************************** + * McResCtrl_GetClockSwInfo + * + * Description: + * Get switch clock info. + * Arguments: + * psClockSwInfo pointer to MCDRV_CLOCKSW_INFO struct + * Return: + * none + * + ****************************************************************************/ +void McResCtrl_GetClockSwInfo( + struct MCDRV_CLOCKSW_INFO *psClockSwInfo +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McResCtrl_GetClockSw"); +#endif + + *psClockSwInfo = gsGlobalInfo.sClockSwInfo; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McResCtrl_GetClockSw", 0); +#endif +} + +/**************************************************************************** + * McResCtrl_SetPathInfo + * + * Description: + * Set path information. + * Arguments: + * psPathInfo path information + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR_ARGUMENT + * + ****************************************************************************/ +SINT32 McResCtrl_SetPathInfo( + const struct MCDRV_PATH_INFO *psPathInfo +) +{ + SINT32 sdRet = MCDRV_SUCCESS; + struct MCDRV_PATH_INFO sCurPathInfo = gsGlobalInfo.sPathInfo; + int i; + UINT8 bDone; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McResCtrl_SetPathInfo"); +#endif + + + gsGlobalInfo.sPathInfo = gsGlobalInfo.sPathInfoVirtual; + + /* MusicOut source on/off */ + SetD1SourceOnOff(psPathInfo->asMusicOut, + gsGlobalInfo.sPathInfo.asMusicOut, + MUSICOUT_PATH_CHANNELS); + /* ExtOut source on/off */ + SetD1SourceOnOff(psPathInfo->asExtOut, + gsGlobalInfo.sPathInfo.asExtOut, + EXTOUT_PATH_CHANNELS); + /* HifiOut source on/off */ + SetD1SourceOnOff(psPathInfo->asHifiOut, + gsGlobalInfo.sPathInfo.asHifiOut, + HIFIOUT_PATH_CHANNELS); + /* V-Box source on/off */ + SetD1SourceOnOff(psPathInfo->asVboxMixIn, + gsGlobalInfo.sPathInfo.asVboxMixIn, + VBOXMIXIN_PATH_CHANNELS); + /* AE source on/off */ + SetD1SourceOnOff(psPathInfo->asAe0, + gsGlobalInfo.sPathInfo.asAe0, + AE_PATH_CHANNELS); + SetD1SourceOnOff(psPathInfo->asAe1, + gsGlobalInfo.sPathInfo.asAe1, + AE_PATH_CHANNELS); + SetD1SourceOnOff(psPathInfo->asAe2, + gsGlobalInfo.sPathInfo.asAe2, + AE_PATH_CHANNELS); + SetD1SourceOnOff(psPathInfo->asAe3, + gsGlobalInfo.sPathInfo.asAe3, + AE_PATH_CHANNELS); + /* DAC source on/off */ + SetD1SourceOnOff(psPathInfo->asDac0, + gsGlobalInfo.sPathInfo.asDac0, + DAC0_PATH_CHANNELS); + SetD1SourceOnOff(psPathInfo->asDac1, + gsGlobalInfo.sPathInfo.asDac1, + DAC1_PATH_CHANNELS); + /* VoiceOut source on/off */ + SetD2SourceOnOff(psPathInfo->asVoiceOut, + gsGlobalInfo.sPathInfo.asVoiceOut, + VOICEOUT_PATH_CHANNELS); + /* VboxIoIn source on/off */ + SetD2SourceOnOff(psPathInfo->asVboxIoIn, + gsGlobalInfo.sPathInfo.asVboxIoIn, + VBOXIOIN_PATH_CHANNELS); + /* VboxHostIn source on/off */ + SetD2SourceOnOff(psPathInfo->asVboxHostIn, + gsGlobalInfo.sPathInfo.asVboxHostIn, + VBOXHOSTIN_PATH_CHANNELS); + /* HostOut source on/off */ + SetD2SourceOnOff(psPathInfo->asHostOut, + gsGlobalInfo.sPathInfo.asHostOut, + HOSTOUT_PATH_CHANNELS); + /* Adif source on/off */ + SetD2SourceOnOff(psPathInfo->asAdif0, + gsGlobalInfo.sPathInfo.asAdif0, + ADIF0_PATH_CHANNELS); + SetD2SourceOnOff(psPathInfo->asAdif1, + gsGlobalInfo.sPathInfo.asAdif1, + ADIF1_PATH_CHANNELS); + SetD2SourceOnOff(psPathInfo->asAdif2, + gsGlobalInfo.sPathInfo.asAdif2, + ADIF2_PATH_CHANNELS); + + /* ADC0 source on/off */ + SetASourceOnOff(psPathInfo->asAdc0, + gsGlobalInfo.sPathInfo.asAdc0, + ADC0_PATH_CHANNELS); + /* ADC1 source on/off */ + SetASourceOnOff(psPathInfo->asAdc1, + gsGlobalInfo.sPathInfo.asAdc1, + ADC1_PATH_CHANNELS); + /* SP source on/off */ + SetASourceOnOff(psPathInfo->asSp, + gsGlobalInfo.sPathInfo.asSp, + SP_PATH_CHANNELS); + /* HP source on/off */ + SetASourceOnOff(psPathInfo->asHp, + gsGlobalInfo.sPathInfo.asHp, + HP_PATH_CHANNELS); + /* RCV source on/off */ + SetASourceOnOff(psPathInfo->asRc, + gsGlobalInfo.sPathInfo.asRc, + RC_PATH_CHANNELS); + /* LOut1 source on/off */ + SetASourceOnOff(psPathInfo->asLout1, + gsGlobalInfo.sPathInfo.asLout1, + LOUT1_PATH_CHANNELS); + /* LOut2 source on/off */ + SetASourceOnOff(psPathInfo->asLout2, + gsGlobalInfo.sPathInfo.asLout2, + LOUT2_PATH_CHANNELS); + /* Bias source on/off */ + SetBiasSourceOnOff(psPathInfo); + + sdRet = IsValidPath(); + if (sdRet != MCDRV_SUCCESS) { + gsGlobalInfo.sPathInfo = sCurPathInfo; + } else { + sdRet = CheckLpFp(); + if (sdRet != MCDRV_SUCCESS) { + gsGlobalInfo.sPathInfo = sCurPathInfo; + } else { + gsGlobalInfo.sPathInfoVirtual + = gsGlobalInfo.sPathInfo; + for (i = 0, bDone = 1; i < 3 && bDone != 0; i++) { + bDone = ValidateADC(); + bDone |= ValidateDAC(); + } + } + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McResCtrl_SetPathInfo", &sdRet); +#endif + return sdRet; +} + +/**************************************************************************** + * CheckLpFp + * + * Description: + * Check port. + * Arguments: + * none + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR_ARGUMENT + * + ****************************************************************************/ +static SINT32 CheckLpFp( + void +) +{ + SINT32 sdRet = MCDRV_SUCCESS; + UINT32 bFP[4]; + int i, j; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("CheckLpFp"); +#endif + + bFP[0] = + bFP[1] = + bFP[2] = + bFP[3] = MCDRV_PHYSPORT_NONE; + + if ((McResCtrl_HasSrc(eMCDRV_DST_MUSICOUT, eMCDRV_DST_CH0) != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_MUSICOUT, eMCDRV_DST_CH1) != 0) + || (McResCtrl_IsD1SrcUsed(MCDRV_D1SRC_MUSICIN_ON) != 0)) { + bFP[0] = gsGlobalInfo.sDioPathInfo.abPhysPort[0]; + if (bFP[0] == MCDRV_PHYSPORT_NONE) { + sdRet = MCDRV_ERROR_ARGUMENT; + goto exit; + } + } + + if ((McResCtrl_HasSrc(eMCDRV_DST_EXTOUT, eMCDRV_DST_CH0) != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_EXTOUT, eMCDRV_DST_CH1) != 0) + || (McResCtrl_IsD1SrcUsed(MCDRV_D1SRC_EXTIN_ON) != 0)) { + bFP[1] = gsGlobalInfo.sDioPathInfo.abPhysPort[1]; + if (bFP[1] == MCDRV_PHYSPORT_NONE) { + sdRet = MCDRV_ERROR_ARGUMENT; + goto exit; + } + } + + if ((McResCtrl_HasSrc(eMCDRV_DST_VOICEOUT, eMCDRV_DST_CH0) != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_VBOXIOIN, eMCDRV_DST_CH0) != 0)) { + bFP[2] = gsGlobalInfo.sDioPathInfo.abPhysPort[2]; + if (bFP[2] == MCDRV_PHYSPORT_NONE) { + sdRet = MCDRV_ERROR_ARGUMENT; + goto exit; + } + } + + if ((McResCtrl_HasSrc(eMCDRV_DST_HIFIOUT, eMCDRV_DST_CH0) != 0) + || (McResCtrl_IsD1SrcUsed(MCDRV_D1SRC_HIFIIN_ON) != 0)) { + bFP[3] = gsGlobalInfo.sDioPathInfo.abPhysPort[3]; + if (bFP[3] == MCDRV_PHYSPORT_NONE) { + sdRet = MCDRV_ERROR_ARGUMENT; + goto exit; + } + } + + for (i = 0; i < 4 && sdRet == MCDRV_SUCCESS; i++) { + if (bFP[i] == MCDRV_PHYSPORT_NONE) + continue; + for (j = i+1; j < 4 && sdRet == MCDRV_SUCCESS; j++) { + if (bFP[i] == bFP[j]) + sdRet = MCDRV_ERROR_ARGUMENT; + } + } +exit: +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("CheckLpFp", &sdRet); +#endif + return sdRet; +} + +/**************************************************************************** + * IsValidPath + * + * Description: + * Check path is valid. + * Arguments: + * none + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR_ARGUMENT + * + ****************************************************************************/ +static SINT32 IsValidPath( + void +) +{ + SINT32 sdRet = MCDRV_SUCCESS; + UINT32 dDacSrc[2]; + UINT8 bCh; + UINT32 dSrc; + UINT32 dAdifSrc[2]; + UINT8 bUsed; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("IsValidPath"); +#endif + + dDacSrc[0] = gsGlobalInfo.sPathInfo.asDac0[0].dSrcOnOff; + dDacSrc[1] = gsGlobalInfo.sPathInfo.asDac0[1].dSrcOnOff; + + if (((dDacSrc[0] & MCDRV_D1SRC_HIFIIN_ON) != 0) + || ((dDacSrc[1] & MCDRV_D1SRC_HIFIIN_ON) != 0)) { + if (((dDacSrc[0] & MCDRV_D1SRC_MUSICIN_ON) != 0) + || ((dDacSrc[0] & MCDRV_D1SRC_EXTIN_ON) != 0) + || ((dDacSrc[0] & MCDRV_D1SRC_VBOXOUT_ON) != 0) + || ((dDacSrc[0] & MCDRV_D1SRC_VBOXREFOUT_ON) != 0) + || ((dDacSrc[0] & MCDRV_D1SRC_AE0_ON) != 0) + || ((dDacSrc[0] & MCDRV_D1SRC_AE1_ON) != 0) + || ((dDacSrc[0] & MCDRV_D1SRC_AE2_ON) != 0) + || ((dDacSrc[0] & MCDRV_D1SRC_AE3_ON) != 0) + || ((dDacSrc[0] & MCDRV_D1SRC_ADIF0_ON) != 0) + || ((dDacSrc[0] & MCDRV_D1SRC_ADIF1_ON) != 0) + || ((dDacSrc[0] & MCDRV_D1SRC_ADIF2_ON) != 0) + || ((dDacSrc[1] & MCDRV_D1SRC_MUSICIN_ON) != 0) + || ((dDacSrc[1] & MCDRV_D1SRC_EXTIN_ON) != 0) + || ((dDacSrc[1] & MCDRV_D1SRC_VBOXOUT_ON) != 0) + || ((dDacSrc[1] & MCDRV_D1SRC_VBOXREFOUT_ON) != 0) + || ((dDacSrc[1] & MCDRV_D1SRC_AE0_ON) != 0) + || ((dDacSrc[1] & MCDRV_D1SRC_AE1_ON) != 0) + || ((dDacSrc[1] & MCDRV_D1SRC_AE2_ON) != 0) + || ((dDacSrc[1] & MCDRV_D1SRC_AE3_ON) != 0) + || ((dDacSrc[1] & MCDRV_D1SRC_ADIF0_ON) != 0) + || ((dDacSrc[1] & MCDRV_D1SRC_ADIF1_ON) != 0) + || ((dDacSrc[1] & MCDRV_D1SRC_ADIF2_ON) != 0)) { + sdRet = MCDRV_ERROR_ARGUMENT; + goto exit; + } + if (McDevProf_GetDevId() == eMCDRV_DEV_ID_80_90H) { + for (bCh = 0; bCh < MUSICOUT_PATH_CHANNELS; bCh++) { + dSrc = + gsGlobalInfo.sPathInfo.asMusicOut[bCh].dSrcOnOff; + if ((dSrc & MCDRV_D1SRC_ADIF0_ON) != 0) { + sdRet = MCDRV_ERROR_ARGUMENT; + goto exit; + } + } + for (bCh = 0; bCh < EXTOUT_PATH_CHANNELS; bCh++) { + dSrc = + gsGlobalInfo.sPathInfo.asExtOut[bCh].dSrcOnOff; + if ((dSrc & MCDRV_D1SRC_ADIF0_ON) != 0) { + sdRet = MCDRV_ERROR_ARGUMENT; + goto exit; + } + } + for (bCh = 0; bCh < VBOXMIXIN_PATH_CHANNELS; bCh++) { + dSrc = + gsGlobalInfo.sPathInfo.asVboxMixIn[bCh].dSrcOnOff; + if ((dSrc & MCDRV_D1SRC_ADIF0_ON) != 0) { + sdRet = MCDRV_ERROR_ARGUMENT; + goto exit; + } + } + for (bCh = 0; bCh < AE_PATH_CHANNELS; bCh++) { + dSrc = + gsGlobalInfo.sPathInfo.asAe0[bCh].dSrcOnOff; + if ((dSrc & MCDRV_D1SRC_ADIF0_ON) != 0) { + sdRet = MCDRV_ERROR_ARGUMENT; + goto exit; + } + dSrc = + gsGlobalInfo.sPathInfo.asAe1[bCh].dSrcOnOff; + if ((dSrc & MCDRV_D1SRC_ADIF0_ON) != 0) { + sdRet = MCDRV_ERROR_ARGUMENT; + goto exit; + } + dSrc = + gsGlobalInfo.sPathInfo.asAe2[bCh].dSrcOnOff; + if ((dSrc & MCDRV_D1SRC_ADIF0_ON) != 0) { + sdRet = MCDRV_ERROR_ARGUMENT; + goto exit; + } + dSrc = + gsGlobalInfo.sPathInfo.asAe3[bCh].dSrcOnOff; + if ((dSrc & MCDRV_D1SRC_ADIF0_ON) != 0) { + sdRet = MCDRV_ERROR_ARGUMENT; + goto exit; + } + } + for (bCh = 0; bCh < DAC1_PATH_CHANNELS; bCh++) { + dSrc = + gsGlobalInfo.sPathInfo.asDac1[bCh].dSrcOnOff; + if ((dSrc & MCDRV_D1SRC_ADIF0_ON) != 0) { + sdRet = MCDRV_ERROR_ARGUMENT; + goto exit; + } + } + } + } + + dDacSrc[0] = gsGlobalInfo.sPathInfo.asDac1[0].dSrcOnOff; + dDacSrc[1] = gsGlobalInfo.sPathInfo.asDac1[1].dSrcOnOff; + if (((dDacSrc[0] & MCDRV_D1SRC_HIFIIN_ON) != 0) + || ((dDacSrc[1] & MCDRV_D1SRC_HIFIIN_ON) != 0)) { + if (((dDacSrc[0] & MCDRV_D1SRC_MUSICIN_ON) != 0) + || ((dDacSrc[0] & MCDRV_D1SRC_EXTIN_ON) != 0) + || ((dDacSrc[0] & MCDRV_D1SRC_VBOXOUT_ON) != 0) + || ((dDacSrc[0] & MCDRV_D1SRC_VBOXREFOUT_ON) != 0) + || ((dDacSrc[0] & MCDRV_D1SRC_AE0_ON) != 0) + || ((dDacSrc[0] & MCDRV_D1SRC_AE1_ON) != 0) + || ((dDacSrc[0] & MCDRV_D1SRC_AE2_ON) != 0) + || ((dDacSrc[0] & MCDRV_D1SRC_AE3_ON) != 0) + || ((dDacSrc[0] & MCDRV_D1SRC_ADIF0_ON) != 0) + || ((dDacSrc[0] & MCDRV_D1SRC_ADIF1_ON) != 0) + || ((dDacSrc[0] & MCDRV_D1SRC_ADIF2_ON) != 0) + || ((dDacSrc[1] & MCDRV_D1SRC_MUSICIN_ON) != 0) + || ((dDacSrc[1] & MCDRV_D1SRC_EXTIN_ON) != 0) + || ((dDacSrc[1] & MCDRV_D1SRC_VBOXOUT_ON) != 0) + || ((dDacSrc[1] & MCDRV_D1SRC_VBOXREFOUT_ON) != 0) + || ((dDacSrc[1] & MCDRV_D1SRC_AE0_ON) != 0) + || ((dDacSrc[1] & MCDRV_D1SRC_AE1_ON) != 0) + || ((dDacSrc[1] & MCDRV_D1SRC_AE2_ON) != 0) + || ((dDacSrc[1] & MCDRV_D1SRC_AE3_ON) != 0) + || ((dDacSrc[1] & MCDRV_D1SRC_ADIF0_ON) != 0) + || ((dDacSrc[1] & MCDRV_D1SRC_ADIF1_ON) != 0) + || ((dDacSrc[1] & MCDRV_D1SRC_ADIF2_ON) != 0)) { + sdRet = MCDRV_ERROR_ARGUMENT; + goto exit; + } + } + + for (bCh = 0; bCh < ADIF0_PATH_CHANNELS; bCh++) { + bUsed = 0; + dAdifSrc[bCh] = gsGlobalInfo.sPathInfo.asAdif0[bCh].dSrcOnOff; + if ((dAdifSrc[bCh] & MCDRV_D2SRC_ADC0_L_ON) != 0) + bUsed++; + if ((dAdifSrc[bCh] & MCDRV_D2SRC_ADC0_R_ON) != 0) + bUsed++; + if ((dAdifSrc[bCh] & MCDRV_D2SRC_ADC1_ON) != 0) + bUsed++; + if ((dAdifSrc[bCh] & MCDRV_D2SRC_PDM0_L_ON) != 0) + bUsed++; + if ((dAdifSrc[bCh] & MCDRV_D2SRC_PDM0_R_ON) != 0) + bUsed++; + if ((dAdifSrc[bCh] & MCDRV_D2SRC_PDM1_L_ON) != 0) + bUsed++; + if ((dAdifSrc[bCh] & MCDRV_D2SRC_PDM1_R_ON) != 0) + bUsed++; + if (bUsed > 1) { + sdRet = MCDRV_ERROR_ARGUMENT; + goto exit; + } + } + if ((dAdifSrc[0] == D2SRC_ALL_OFF) + && (dAdifSrc[1] != D2SRC_ALL_OFF)) { + sdRet = MCDRV_ERROR_ARGUMENT; + goto exit; + } + + for (bCh = 0; bCh < ADIF1_PATH_CHANNELS; bCh++) { + bUsed = 0; + dAdifSrc[bCh] = gsGlobalInfo.sPathInfo.asAdif1[bCh].dSrcOnOff; + if ((dAdifSrc[bCh] & MCDRV_D2SRC_ADC0_L_ON) != 0) + bUsed++; + if ((dAdifSrc[bCh] & MCDRV_D2SRC_ADC0_R_ON) != 0) + bUsed++; + if ((dAdifSrc[bCh] & MCDRV_D2SRC_ADC1_ON) != 0) + bUsed++; + if ((dAdifSrc[bCh] & MCDRV_D2SRC_PDM0_L_ON) != 0) + bUsed++; + if ((dAdifSrc[bCh] & MCDRV_D2SRC_PDM0_R_ON) != 0) + bUsed++; + if ((dAdifSrc[bCh] & MCDRV_D2SRC_PDM1_L_ON) != 0) + bUsed++; + if ((dAdifSrc[bCh] & MCDRV_D2SRC_PDM1_R_ON) != 0) + bUsed++; + if (bUsed > 1) { + sdRet = MCDRV_ERROR_ARGUMENT; + goto exit; + } + } + if ((dAdifSrc[0] == D2SRC_ALL_OFF) + && (dAdifSrc[1] != D2SRC_ALL_OFF)) { + sdRet = MCDRV_ERROR_ARGUMENT; + goto exit; + } + + for (bCh = 0; bCh < ADIF2_PATH_CHANNELS; bCh++) { + bUsed = 0; + if (bCh == 0) + dAdifSrc[bCh] = + McResCtrl_GetSource(eMCDRV_DST_ADIF2, + eMCDRV_DST_CH0); + else + dAdifSrc[bCh] = + McResCtrl_GetSource(eMCDRV_DST_ADIF2, + eMCDRV_DST_CH1); + if ((dAdifSrc[bCh] & MCDRV_D2SRC_ADC0_L_ON) != 0) + bUsed++; + if ((dAdifSrc[bCh] & MCDRV_D2SRC_ADC0_R_ON) != 0) + bUsed++; + if ((dAdifSrc[bCh] & MCDRV_D2SRC_ADC1_ON) != 0) + bUsed++; + if ((dAdifSrc[bCh] & MCDRV_D2SRC_PDM0_L_ON) != 0) + bUsed++; + if ((dAdifSrc[bCh] & MCDRV_D2SRC_PDM0_R_ON) != 0) + bUsed++; + if ((dAdifSrc[bCh] & MCDRV_D2SRC_PDM1_L_ON) != 0) + bUsed++; + if ((dAdifSrc[bCh] & MCDRV_D2SRC_PDM1_R_ON) != 0) + bUsed++; + if ((dAdifSrc[bCh] & MCDRV_D2SRC_DAC0REF_ON) != 0) + bUsed++; + if ((dAdifSrc[bCh] & MCDRV_D2SRC_DAC1REF_ON) != 0) + bUsed++; + if (bUsed > 1) { + sdRet = MCDRV_ERROR_ARGUMENT; + goto exit; + } + } + if (((dAdifSrc[0] & ~D2SRC_ALL_OFF) == 0) + && ((dAdifSrc[1] & ~D2SRC_ALL_OFF) != 0)) { + sdRet = MCDRV_ERROR_ARGUMENT; + goto exit; + } + if (((dAdifSrc[0] & MCDRV_D2SRC_DAC0REF_ON) != 0) + && ((dAdifSrc[1] & ~MCDRV_D2SRC_DAC0REF_ON) != 0)) { + sdRet = MCDRV_ERROR_ARGUMENT; + goto exit; + } + if (((dAdifSrc[1] & MCDRV_D2SRC_DAC0REF_ON) != 0) + && ((dAdifSrc[0] & ~MCDRV_D2SRC_DAC0REF_ON) != 0)) { + sdRet = MCDRV_ERROR_ARGUMENT; + goto exit; + } + if (((dAdifSrc[0] & MCDRV_D2SRC_DAC1REF_ON) != 0) + && ((dAdifSrc[1] & ~MCDRV_D2SRC_DAC1REF_ON) != 0)) { + sdRet = MCDRV_ERROR_ARGUMENT; + goto exit; + } + if (((dAdifSrc[1] & MCDRV_D2SRC_DAC1REF_ON) != 0) + && ((dAdifSrc[0] & ~MCDRV_D2SRC_DAC1REF_ON) != 0)) { + sdRet = MCDRV_ERROR_ARGUMENT; + goto exit; + } + + for (bCh = 0; bCh < ADC0_PATH_CHANNELS; bCh++) { + bUsed = 0; + dSrc = gsGlobalInfo.sPathInfo.asAdc0[bCh].dSrcOnOff; + if ((dSrc & MCDRV_ASRC_LINEIN1_L_ON) != 0) + bUsed++; + if ((dSrc & MCDRV_ASRC_LINEIN1_R_ON) != 0) + bUsed++; + if ((dSrc & MCDRV_ASRC_LINEIN1_M_ON) != 0) + bUsed++; + if (bUsed > 1) { + sdRet = MCDRV_ERROR_ARGUMENT; + goto exit; + } + } +exit: +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("IsValidPath", &sdRet); +#endif + return sdRet; +} + +/**************************************************************************** + * ValidateADC + * + * Description: + * Validate ADC setting. + * Arguments: + * none + * Return: + * 0:not changed, 1:changed + * + ****************************************************************************/ +static UINT8 ValidateADC( + void +) +{ + UINT8 bRet = 0; + UINT8 bCh; + UINT8 bHasSrc = 0; + UINT32 dHifiSrc; + +#if (MCDRV_DEBUG_LEVEL >= 4) + SINT32 sdRet; + McDebugLog_FuncIn("ValidateADC"); +#endif + + if ((McResCtrl_HasSrc(eMCDRV_DST_ADIF0, eMCDRV_DST_CH0) != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_ADIF0, eMCDRV_DST_CH1) != 0)) + bHasSrc = 1; + else + bHasSrc = 0; + + dHifiSrc = gsGlobalInfo.sPathInfo.asHifiOut[0].dSrcOnOff; + + if ((McResCtrl_IsD1SrcUsed(MCDRV_D1SRC_ADIF0_ON) == 0) + && ((dHifiSrc & MCDRV_D1SRC_ADIF0_ON) == 0)) { + ; + } else if (bHasSrc == 0) { + for (bCh = 0; bCh < MUSICOUT_PATH_CHANNELS; bCh++) { + gsGlobalInfo.sPathInfo.asMusicOut[bCh].dSrcOnOff + &= ~MCDRV_D1SRC_ADIF0_ON; + gsGlobalInfo.sPathInfo.asMusicOut[bCh].dSrcOnOff + |= MCDRV_D1SRC_ADIF0_OFF; + } + for (bCh = 0; bCh < EXTOUT_PATH_CHANNELS; bCh++) { + gsGlobalInfo.sPathInfo.asExtOut[bCh].dSrcOnOff + &= ~MCDRV_D1SRC_ADIF0_ON; + gsGlobalInfo.sPathInfo.asExtOut[bCh].dSrcOnOff + |= MCDRV_D1SRC_ADIF0_OFF; + } + for (bCh = 0; bCh < HIFIOUT_PATH_CHANNELS; bCh++) { + gsGlobalInfo.sPathInfo.asHifiOut[bCh].dSrcOnOff + &= ~MCDRV_D1SRC_ADIF0_ON; + gsGlobalInfo.sPathInfo.asHifiOut[bCh].dSrcOnOff + |= MCDRV_D1SRC_ADIF0_OFF; + } + for (bCh = 0; bCh < VBOXMIXIN_PATH_CHANNELS; bCh++) { + gsGlobalInfo.sPathInfo.asVboxMixIn[bCh].dSrcOnOff + &= ~MCDRV_D1SRC_ADIF0_ON; + gsGlobalInfo.sPathInfo.asVboxMixIn[bCh].dSrcOnOff + |= MCDRV_D1SRC_ADIF0_OFF; + } + for (bCh = 0; bCh < AE_PATH_CHANNELS; bCh++) { + gsGlobalInfo.sPathInfo.asAe0[bCh].dSrcOnOff + &= ~MCDRV_D1SRC_ADIF0_ON; + gsGlobalInfo.sPathInfo.asAe0[bCh].dSrcOnOff + |= MCDRV_D1SRC_ADIF0_OFF; + gsGlobalInfo.sPathInfo.asAe1[bCh].dSrcOnOff + &= ~MCDRV_D1SRC_ADIF0_ON; + gsGlobalInfo.sPathInfo.asAe1[bCh].dSrcOnOff + |= MCDRV_D1SRC_ADIF0_OFF; + gsGlobalInfo.sPathInfo.asAe2[bCh].dSrcOnOff + &= ~MCDRV_D1SRC_ADIF0_ON; + gsGlobalInfo.sPathInfo.asAe2[bCh].dSrcOnOff + |= MCDRV_D1SRC_ADIF0_OFF; + gsGlobalInfo.sPathInfo.asAe3[bCh].dSrcOnOff + &= ~MCDRV_D1SRC_ADIF0_ON; + gsGlobalInfo.sPathInfo.asAe3[bCh].dSrcOnOff + |= MCDRV_D1SRC_ADIF0_OFF; + } + for (bCh = 0; bCh < DAC0_PATH_CHANNELS; bCh++) { + gsGlobalInfo.sPathInfo.asDac0[bCh].dSrcOnOff + &= ~MCDRV_D1SRC_ADIF0_ON; + gsGlobalInfo.sPathInfo.asDac0[bCh].dSrcOnOff + |= MCDRV_D1SRC_ADIF0_OFF; + } + for (bCh = 0; bCh < DAC1_PATH_CHANNELS; bCh++) { + gsGlobalInfo.sPathInfo.asDac1[bCh].dSrcOnOff + &= ~MCDRV_D1SRC_ADIF0_ON; + gsGlobalInfo.sPathInfo.asDac1[bCh].dSrcOnOff + |= MCDRV_D1SRC_ADIF0_OFF; + } + bRet = 1; + } + + if ((McResCtrl_HasSrc(eMCDRV_DST_ADIF1, eMCDRV_DST_CH0) != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_ADIF1, eMCDRV_DST_CH1) != 0)) + bHasSrc = 1; + else + bHasSrc = 0; + + if (McResCtrl_IsD1SrcUsed(MCDRV_D1SRC_ADIF1_ON) == 0) { + ; + } else if (bHasSrc == 0) { + for (bCh = 0; bCh < MUSICOUT_PATH_CHANNELS; bCh++) { + gsGlobalInfo.sPathInfo.asMusicOut[bCh].dSrcOnOff + &= ~MCDRV_D1SRC_ADIF1_ON; + gsGlobalInfo.sPathInfo.asMusicOut[bCh].dSrcOnOff + |= MCDRV_D1SRC_ADIF1_OFF; + } + for (bCh = 0; bCh < EXTOUT_PATH_CHANNELS; bCh++) { + gsGlobalInfo.sPathInfo.asExtOut[bCh].dSrcOnOff + &= ~MCDRV_D1SRC_ADIF1_ON; + gsGlobalInfo.sPathInfo.asExtOut[bCh].dSrcOnOff + |= MCDRV_D1SRC_ADIF1_OFF; + } + for (bCh = 0; bCh < HIFIOUT_PATH_CHANNELS; bCh++) { + gsGlobalInfo.sPathInfo.asHifiOut[bCh].dSrcOnOff + &= ~MCDRV_D1SRC_ADIF1_ON; + gsGlobalInfo.sPathInfo.asHifiOut[bCh].dSrcOnOff + |= MCDRV_D1SRC_ADIF1_OFF; + } + for (bCh = 0; bCh < VBOXMIXIN_PATH_CHANNELS; bCh++) { + gsGlobalInfo.sPathInfo.asVboxMixIn[bCh].dSrcOnOff + &= ~MCDRV_D1SRC_ADIF1_ON; + gsGlobalInfo.sPathInfo.asVboxMixIn[bCh].dSrcOnOff + |= MCDRV_D1SRC_ADIF1_OFF; + } + for (bCh = 0; bCh < AE_PATH_CHANNELS; bCh++) { + gsGlobalInfo.sPathInfo.asAe0[bCh].dSrcOnOff + &= ~MCDRV_D1SRC_ADIF1_ON; + gsGlobalInfo.sPathInfo.asAe0[bCh].dSrcOnOff + |= MCDRV_D1SRC_ADIF1_OFF; + gsGlobalInfo.sPathInfo.asAe1[bCh].dSrcOnOff + &= ~MCDRV_D1SRC_ADIF1_ON; + gsGlobalInfo.sPathInfo.asAe1[bCh].dSrcOnOff + |= MCDRV_D1SRC_ADIF1_OFF; + gsGlobalInfo.sPathInfo.asAe2[bCh].dSrcOnOff + &= ~MCDRV_D1SRC_ADIF1_ON; + gsGlobalInfo.sPathInfo.asAe2[bCh].dSrcOnOff + |= MCDRV_D1SRC_ADIF1_OFF; + gsGlobalInfo.sPathInfo.asAe3[bCh].dSrcOnOff + &= ~MCDRV_D1SRC_ADIF1_ON; + gsGlobalInfo.sPathInfo.asAe3[bCh].dSrcOnOff + |= MCDRV_D1SRC_ADIF1_OFF; + } + for (bCh = 0; bCh < DAC0_PATH_CHANNELS; bCh++) { + gsGlobalInfo.sPathInfo.asDac0[bCh].dSrcOnOff + &= ~MCDRV_D1SRC_ADIF1_ON; + gsGlobalInfo.sPathInfo.asDac0[bCh].dSrcOnOff + |= MCDRV_D1SRC_ADIF1_OFF; + } + for (bCh = 0; bCh < DAC1_PATH_CHANNELS; bCh++) { + gsGlobalInfo.sPathInfo.asDac1[bCh].dSrcOnOff + &= ~MCDRV_D1SRC_ADIF1_ON; + gsGlobalInfo.sPathInfo.asDac1[bCh].dSrcOnOff + |= MCDRV_D1SRC_ADIF1_OFF; + } + bRet = 1; + } + + if ((McResCtrl_HasSrc(eMCDRV_DST_ADIF2, eMCDRV_DST_CH0) != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_ADIF2, eMCDRV_DST_CH1) != 0)) + bHasSrc = 1; + else + bHasSrc = 0; + + if (McResCtrl_IsD1SrcUsed(MCDRV_D1SRC_ADIF2_ON) == 0) { + ; + } else if (bHasSrc == 0) { + for (bCh = 0; bCh < MUSICOUT_PATH_CHANNELS; bCh++) { + gsGlobalInfo.sPathInfo.asMusicOut[bCh].dSrcOnOff + &= ~MCDRV_D1SRC_ADIF2_ON; + gsGlobalInfo.sPathInfo.asMusicOut[bCh].dSrcOnOff + |= MCDRV_D1SRC_ADIF2_OFF; + } + for (bCh = 0; bCh < EXTOUT_PATH_CHANNELS; bCh++) { + gsGlobalInfo.sPathInfo.asExtOut[bCh].dSrcOnOff + &= ~MCDRV_D1SRC_ADIF2_ON; + gsGlobalInfo.sPathInfo.asExtOut[bCh].dSrcOnOff + |= MCDRV_D1SRC_ADIF2_OFF; + } + for (bCh = 0; bCh < HIFIOUT_PATH_CHANNELS; bCh++) { + gsGlobalInfo.sPathInfo.asHifiOut[bCh].dSrcOnOff + &= ~MCDRV_D1SRC_ADIF2_ON; + gsGlobalInfo.sPathInfo.asHifiOut[bCh].dSrcOnOff + |= MCDRV_D1SRC_ADIF2_OFF; + } + for (bCh = 0; bCh < VBOXMIXIN_PATH_CHANNELS; bCh++) { + gsGlobalInfo.sPathInfo.asVboxMixIn[bCh].dSrcOnOff + &= ~MCDRV_D1SRC_ADIF2_ON; + gsGlobalInfo.sPathInfo.asVboxMixIn[bCh].dSrcOnOff + |= MCDRV_D1SRC_ADIF2_OFF; + } + for (bCh = 0; bCh < AE_PATH_CHANNELS; bCh++) { + gsGlobalInfo.sPathInfo.asAe0[bCh].dSrcOnOff + &= ~MCDRV_D1SRC_ADIF2_ON; + gsGlobalInfo.sPathInfo.asAe0[bCh].dSrcOnOff + |= MCDRV_D1SRC_ADIF2_OFF; + gsGlobalInfo.sPathInfo.asAe1[bCh].dSrcOnOff + &= ~MCDRV_D1SRC_ADIF2_ON; + gsGlobalInfo.sPathInfo.asAe1[bCh].dSrcOnOff + |= MCDRV_D1SRC_ADIF2_OFF; + gsGlobalInfo.sPathInfo.asAe2[bCh].dSrcOnOff + &= ~MCDRV_D1SRC_ADIF2_ON; + gsGlobalInfo.sPathInfo.asAe2[bCh].dSrcOnOff + |= MCDRV_D1SRC_ADIF2_OFF; + gsGlobalInfo.sPathInfo.asAe3[bCh].dSrcOnOff + &= ~MCDRV_D1SRC_ADIF2_ON; + gsGlobalInfo.sPathInfo.asAe3[bCh].dSrcOnOff + |= MCDRV_D1SRC_ADIF2_OFF; + } + for (bCh = 0; bCh < DAC0_PATH_CHANNELS; bCh++) { + gsGlobalInfo.sPathInfo.asDac0[bCh].dSrcOnOff + &= ~MCDRV_D1SRC_ADIF2_ON; + gsGlobalInfo.sPathInfo.asDac0[bCh].dSrcOnOff + |= MCDRV_D1SRC_ADIF2_OFF; + } + for (bCh = 0; bCh < DAC1_PATH_CHANNELS; bCh++) { + gsGlobalInfo.sPathInfo.asDac1[bCh].dSrcOnOff + &= ~MCDRV_D1SRC_ADIF2_ON; + gsGlobalInfo.sPathInfo.asDac1[bCh].dSrcOnOff + |= MCDRV_D1SRC_ADIF2_OFF; + } + bRet = 1; + } + + if (McResCtrl_HasSrc(eMCDRV_DST_ADC0, eMCDRV_DST_CH0) != 0) + bHasSrc = 1; + else + bHasSrc = 0; + if (McResCtrl_IsD2SrcUsed(MCDRV_D2SRC_ADC0_L_ON) == 0) { + if (bHasSrc != 0) { + gsGlobalInfo.sPathInfo.asAdc0[0].dSrcOnOff + = D2SRC_ALL_OFF; + bRet = 1; + } + } else if (bHasSrc == 0) { + for (bCh = 0; bCh < ADIF0_PATH_CHANNELS; bCh++) { + gsGlobalInfo.sPathInfo.asAdif0[bCh].dSrcOnOff + &= ~MCDRV_D2SRC_ADC0_L_ON; + gsGlobalInfo.sPathInfo.asAdif0[bCh].dSrcOnOff + |= MCDRV_D2SRC_ADC0_L_OFF; + } + for (bCh = 0; bCh < ADIF1_PATH_CHANNELS; bCh++) { + gsGlobalInfo.sPathInfo.asAdif1[bCh].dSrcOnOff + &= ~MCDRV_D2SRC_ADC0_L_ON; + gsGlobalInfo.sPathInfo.asAdif1[bCh].dSrcOnOff + |= MCDRV_D2SRC_ADC0_L_OFF; + } + for (bCh = 0; bCh < ADIF2_PATH_CHANNELS; bCh++) { + gsGlobalInfo.sPathInfo.asAdif2[bCh].dSrcOnOff + &= ~MCDRV_D2SRC_ADC0_L_ON; + gsGlobalInfo.sPathInfo.asAdif2[bCh].dSrcOnOff + |= MCDRV_D2SRC_ADC0_L_OFF; + } + bRet = 1; + } + + if (McResCtrl_HasSrc(eMCDRV_DST_ADC0, eMCDRV_DST_CH1) != 0) + bHasSrc = 1; + else + bHasSrc = 0; + if (McResCtrl_IsD2SrcUsed(MCDRV_D2SRC_ADC0_R_ON) == 0) { + if (bHasSrc != 0) { + gsGlobalInfo.sPathInfo.asAdc0[1].dSrcOnOff + = D2SRC_ALL_OFF; + bRet = 1; + } + } else if (bHasSrc == 0) { + for (bCh = 0; bCh < ADIF0_PATH_CHANNELS; bCh++) { + gsGlobalInfo.sPathInfo.asAdif0[bCh].dSrcOnOff + &= ~MCDRV_D2SRC_ADC0_R_ON; + gsGlobalInfo.sPathInfo.asAdif0[bCh].dSrcOnOff + |= MCDRV_D2SRC_ADC0_R_OFF; + } + for (bCh = 0; bCh < ADIF1_PATH_CHANNELS; bCh++) { + gsGlobalInfo.sPathInfo.asAdif1[bCh].dSrcOnOff + &= ~MCDRV_D2SRC_ADC0_R_ON; + gsGlobalInfo.sPathInfo.asAdif1[bCh].dSrcOnOff + |= MCDRV_D2SRC_ADC0_R_OFF; + } + for (bCh = 0; bCh < ADIF2_PATH_CHANNELS; bCh++) { + gsGlobalInfo.sPathInfo.asAdif2[bCh].dSrcOnOff + &= ~MCDRV_D2SRC_ADC0_R_ON; + gsGlobalInfo.sPathInfo.asAdif2[bCh].dSrcOnOff + |= MCDRV_D2SRC_ADC0_R_OFF; + } + bRet = 1; + } + + if (McResCtrl_HasSrc(eMCDRV_DST_ADC1, eMCDRV_DST_CH0) != 0) + bHasSrc = 1; + else + bHasSrc = 0; + if (McResCtrl_IsD2SrcUsed(MCDRV_D2SRC_ADC1_ON) == 0) { + if (bHasSrc != 0) { + for (bCh = 0; bCh < ADC1_PATH_CHANNELS; bCh++) + gsGlobalInfo.sPathInfo.asAdc1[bCh].dSrcOnOff + = D2SRC_ALL_OFF; + bRet = 1; + } + } else if (bHasSrc == 0) { + bRet = 1; + for (bCh = 0; bCh < ADIF0_PATH_CHANNELS; bCh++) { + gsGlobalInfo.sPathInfo.asAdif0[bCh].dSrcOnOff + &= ~MCDRV_D2SRC_ADC1_ON; + gsGlobalInfo.sPathInfo.asAdif0[bCh].dSrcOnOff + |= MCDRV_D2SRC_ADC1_OFF; + } + for (bCh = 0; bCh < ADIF1_PATH_CHANNELS; bCh++) { + gsGlobalInfo.sPathInfo.asAdif1[bCh].dSrcOnOff + &= ~MCDRV_D2SRC_ADC1_ON; + gsGlobalInfo.sPathInfo.asAdif1[bCh].dSrcOnOff + |= MCDRV_D2SRC_ADC1_OFF; + } + for (bCh = 0; bCh < ADIF2_PATH_CHANNELS; bCh++) { + gsGlobalInfo.sPathInfo.asAdif2[bCh].dSrcOnOff + &= ~MCDRV_D2SRC_ADC1_ON; + gsGlobalInfo.sPathInfo.asAdif2[bCh].dSrcOnOff + |= MCDRV_D2SRC_ADC1_OFF; + } + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + sdRet = bRet; + McDebugLog_FuncOut("ValidateADC", &sdRet); +#endif + return bRet; +} + +/**************************************************************************** + * ValidateDAC + * + * Description: + * Validate DAC setting. + * Arguments: + * none + * Return: + * 0:not changed, 1:changed + * + ****************************************************************************/ +static UINT8 ValidateDAC( + void +) +{ + UINT8 bRet = 0; + UINT8 bCh; + UINT8 bHasSrc = 0; + UINT8 bUsed = 0; + +#if (MCDRV_DEBUG_LEVEL >= 4) + SINT32 sdRet; + McDebugLog_FuncIn("ValidateDAC"); +#endif + + if ((McResCtrl_HasSrc(eMCDRV_DST_DAC1, eMCDRV_DST_CH0) != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_DAC1, eMCDRV_DST_CH1) != 0)) + bHasSrc = 1; + else + bHasSrc = 0; + + if ((McResCtrl_IsASrcUsed(MCDRV_ASRC_DAC1_L_ON) != 0) + || (McResCtrl_IsASrcUsed(MCDRV_ASRC_DAC1_R_ON) != 0)) + bUsed = 1; + else { + bUsed = 0; + for (bCh = 0; bCh < ADIF2_PATH_CHANNELS; bCh++) { + if ((gsGlobalInfo.sPathInfo.asAdif2[bCh].dSrcOnOff + & MCDRV_D2SRC_DAC1REF_ON) != 0) { + bUsed = 1; + } + } + } + + if (bHasSrc == 0) { + if (bUsed == 1) { + bRet = 1; + for (bCh = 0; bCh < SP_PATH_CHANNELS; bCh++) { + gsGlobalInfo.sPathInfo.asSp[bCh].dSrcOnOff + &= ~MCDRV_ASRC_DAC1_L_ON; + gsGlobalInfo.sPathInfo.asSp[bCh].dSrcOnOff + |= MCDRV_ASRC_DAC1_L_OFF; + gsGlobalInfo.sPathInfo.asSp[bCh].dSrcOnOff + &= ~MCDRV_ASRC_DAC1_R_ON; + gsGlobalInfo.sPathInfo.asSp[bCh].dSrcOnOff + |= MCDRV_ASRC_DAC1_R_OFF; + } + for (bCh = 0; bCh < LOUT2_PATH_CHANNELS; bCh++) { + gsGlobalInfo.sPathInfo.asLout2[bCh].dSrcOnOff + &= ~MCDRV_ASRC_DAC1_L_ON; + gsGlobalInfo.sPathInfo.asLout2[bCh].dSrcOnOff + |= MCDRV_ASRC_DAC1_L_OFF; + gsGlobalInfo.sPathInfo.asLout2[bCh].dSrcOnOff + &= ~MCDRV_ASRC_DAC1_R_ON; + gsGlobalInfo.sPathInfo.asLout2[bCh].dSrcOnOff + |= MCDRV_ASRC_DAC1_R_OFF; + } + } + for (bCh = 0; bCh < ADIF2_PATH_CHANNELS; bCh++) { + if ((gsGlobalInfo.sPathInfo.asAdif2[bCh].dSrcOnOff + & MCDRV_D2SRC_DAC1REF_ON) != 0) { + gsGlobalInfo.sPathInfo.asAdif2[bCh].dSrcOnOff + &= ~MCDRV_D2SRC_DAC1REF_ON; + bRet = 1; + } + } + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + sdRet = bRet; + McDebugLog_FuncOut("ValidateDAC", &sdRet); +#endif + return bRet; +} + +/**************************************************************************** + * SetD1SourceOnOff + * + * Description: + * Set digital output source On/Off. + * Arguments: + * psSetDChannel set On/Off info + * psDstDChannel destination On/Off setting + * bChannels number of channels + * Return: + * none + * + ****************************************************************************/ +static void SetD1SourceOnOff( + const struct MCDRV_D1_CHANNEL *psSetDChannel, + struct MCDRV_D1_CHANNEL *psDstDChannel, + UINT8 bChannels +) +{ + UINT8 i, bCh; + UINT32 dOn, dOff; + struct { + UINT32 dOn; + UINT32 dOff; + } sBlockInfo[] = { + {MCDRV_D1SRC_MUSICIN_ON, MCDRV_D1SRC_MUSICIN_OFF}, + {MCDRV_D1SRC_EXTIN_ON, MCDRV_D1SRC_EXTIN_OFF}, + {MCDRV_D1SRC_VBOXOUT_ON, MCDRV_D1SRC_VBOXOUT_OFF}, + {MCDRV_D1SRC_VBOXREFOUT_ON, MCDRV_D1SRC_VBOXREFOUT_OFF}, + {MCDRV_D1SRC_AE0_ON, MCDRV_D1SRC_AE0_OFF}, + {MCDRV_D1SRC_AE1_ON, MCDRV_D1SRC_AE1_OFF}, + {MCDRV_D1SRC_AE2_ON, MCDRV_D1SRC_AE2_OFF}, + {MCDRV_D1SRC_AE3_ON, MCDRV_D1SRC_AE3_OFF}, + {MCDRV_D1SRC_ADIF0_ON, MCDRV_D1SRC_ADIF0_OFF}, + {MCDRV_D1SRC_ADIF1_ON, MCDRV_D1SRC_ADIF1_OFF}, + {MCDRV_D1SRC_ADIF2_ON, MCDRV_D1SRC_ADIF2_OFF}, + {MCDRV_D1SRC_HIFIIN_ON, MCDRV_D1SRC_HIFIIN_OFF}, + }; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("SetD1SourceOnOff"); +#endif + + for (bCh = 0; bCh < bChannels; bCh++) { + for (i = 0; i < GET_ARRAY_SIZE(sBlockInfo); i++) { + dOn = sBlockInfo[i].dOn; + dOff = sBlockInfo[i].dOff; + SetSourceOnOff( + psSetDChannel[bCh].dSrcOnOff, + &psDstDChannel[bCh].dSrcOnOff, + dOn, + dOff); + } + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("SetD1SourceOnOff", 0); +#endif +} + +/**************************************************************************** + * SetD2SourceOnOff + * + * Description: + * Set digital output source On/Off. + * Arguments: + * psSetDChannel set On/Off info + * psDstDChannel destination On/Off setting + * bChannels number of channels + * Return: + * none + * + ****************************************************************************/ +static void SetD2SourceOnOff( + const struct MCDRV_D2_CHANNEL *psSetDChannel, + struct MCDRV_D2_CHANNEL *psDstDChannel, + UINT8 bChannels +) +{ + UINT8 i, bCh; + UINT32 dOn, dOff; + struct { + UINT32 dOn; + UINT32 dOff; + } sBlockInfo[] = { + {MCDRV_D2SRC_VOICEIN_ON, MCDRV_D2SRC_VOICEIN_OFF}, + {MCDRV_D2SRC_VBOXIOOUT_ON, MCDRV_D2SRC_VBOXIOOUT_OFF}, + {MCDRV_D2SRC_VBOXHOSTOUT_ON, MCDRV_D2SRC_VBOXHOSTOUT_OFF}, + {MCDRV_D2SRC_ADC0_L_ON, MCDRV_D2SRC_ADC0_L_OFF}, + {MCDRV_D2SRC_ADC0_R_ON, MCDRV_D2SRC_ADC0_R_OFF}, + {MCDRV_D2SRC_ADC1_ON, MCDRV_D2SRC_ADC1_OFF}, + {MCDRV_D2SRC_PDM0_L_ON, MCDRV_D2SRC_PDM0_L_OFF}, + {MCDRV_D2SRC_PDM0_R_ON, MCDRV_D2SRC_PDM0_R_OFF}, + {MCDRV_D2SRC_PDM1_L_ON, MCDRV_D2SRC_PDM1_L_OFF}, + {MCDRV_D2SRC_PDM1_R_ON, MCDRV_D2SRC_PDM1_R_OFF}, + {MCDRV_D2SRC_DAC0REF_ON, MCDRV_D2SRC_DAC0REF_OFF}, + {MCDRV_D2SRC_DAC1REF_ON, MCDRV_D2SRC_DAC1REF_OFF} + }; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("SetD2SourceOnOff"); +#endif + + for (bCh = 0; bCh < bChannels; bCh++) { + for (i = 0; i < GET_ARRAY_SIZE(sBlockInfo); i++) { + dOn = sBlockInfo[i].dOn; + dOff = sBlockInfo[i].dOff; + if ((psSetDChannel[bCh].dSrcOnOff & dOn) != 0) { + if ((dOn == MCDRV_D2SRC_PDM0_L_ON) + || (dOn == MCDRV_D2SRC_PDM0_R_ON) + || (dOn == MCDRV_D2SRC_PDM1_L_ON) + || (dOn == MCDRV_D2SRC_PDM1_R_ON)) { + if (gsGlobalInfo.sInitInfo.bPa0Func + != MCDRV_PA_PDMCK) { + break; + } + } + } + SetSourceOnOff( + psSetDChannel[bCh].dSrcOnOff, + &psDstDChannel[bCh].dSrcOnOff, + dOn, + dOff); + } + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("SetD2SourceOnOff", 0); +#endif +} + +/**************************************************************************** + * SetASourceOnOff + * + * Description: + * Set analog output source On/Off. + * Arguments: + * psSetDChannel set On/Off info + * psDstDChannel destination On/Off setting + * bChannels number of channels + * Return: + * none + * + ****************************************************************************/ +static void SetASourceOnOff( + const struct MCDRV_A_CHANNEL *psSetAChannel, + struct MCDRV_A_CHANNEL *psDstAChannel, + UINT8 bChannels +) +{ + UINT8 i, bCh; + struct { + UINT32 dOn; + UINT32 dOff; + } sBlockInfo[] = { + {MCDRV_ASRC_DAC0_L_ON, MCDRV_ASRC_DAC0_L_OFF}, + {MCDRV_ASRC_DAC0_R_ON, MCDRV_ASRC_DAC0_R_OFF}, + {MCDRV_ASRC_DAC1_L_ON, MCDRV_ASRC_DAC1_L_OFF}, + {MCDRV_ASRC_DAC1_R_ON, MCDRV_ASRC_DAC1_R_OFF}, + {MCDRV_ASRC_MIC1_ON, MCDRV_ASRC_MIC1_OFF}, + {MCDRV_ASRC_MIC2_ON, MCDRV_ASRC_MIC2_OFF}, + {MCDRV_ASRC_MIC3_ON, MCDRV_ASRC_MIC3_OFF}, + {MCDRV_ASRC_MIC4_ON, MCDRV_ASRC_MIC4_OFF}, + {MCDRV_ASRC_LINEIN1_L_ON, MCDRV_ASRC_LINEIN1_L_OFF}, + {MCDRV_ASRC_LINEIN1_R_ON, MCDRV_ASRC_LINEIN1_R_OFF}, + {MCDRV_ASRC_LINEIN1_M_ON, MCDRV_ASRC_LINEIN1_M_OFF}, + }; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("SetASourceOnOff"); +#endif + + for (bCh = 0; bCh < bChannels; bCh++) { + for (i = 0; i < GET_ARRAY_SIZE(sBlockInfo); i++) { + SetSourceOnOff( + psSetAChannel[bCh].dSrcOnOff, + &psDstAChannel[bCh].dSrcOnOff, + sBlockInfo[i].dOn, + sBlockInfo[i].dOff); + } + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("SetASourceOnOff", 0); +#endif +} + +/**************************************************************************** + * SetBiasSourceOnOff + * + * Description: + * Set Bias source On/Off. + * Arguments: + * psPathInfo path information + * Return: + * none + * + ****************************************************************************/ +static void SetBiasSourceOnOff( + const struct MCDRV_PATH_INFO *psPathInfo +) +{ + UINT8 bBlock, bCh; + struct { + UINT8 bBlock; + UINT32 dOn; + UINT32 dOff; + } sBlockInfo[] = { + {0, MCDRV_ASRC_MIC1_ON, MCDRV_ASRC_MIC1_OFF}, + {0, MCDRV_ASRC_MIC2_ON, MCDRV_ASRC_MIC2_OFF}, + {0, MCDRV_ASRC_MIC3_ON, MCDRV_ASRC_MIC3_OFF}, + {0, MCDRV_ASRC_MIC4_ON, MCDRV_ASRC_MIC4_OFF} + }; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("SetBiasSourceOnOff"); +#endif + + for (bCh = 0; bCh < BIAS_PATH_CHANNELS; bCh++) { + for (bBlock = 0; bBlock < GET_ARRAY_SIZE(sBlockInfo); bBlock++ + ) { + ; + SetSourceOnOff(psPathInfo->asBias[bCh].dSrcOnOff, + &gsGlobalInfo.sPathInfo.asBias[bCh].dSrcOnOff, + sBlockInfo[bBlock].dOn, + sBlockInfo[bBlock].dOff); + } + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("SetBiasSourceOnOff", 0); +#endif +} + +/**************************************************************************** + * ClearD1SourceOnOff + * + * Description: + * Clear digial output source On/Off. + * Arguments: + * pdSrcOnOff source On/Off info + * Return: + * none + * + ****************************************************************************/ +static void ClearD1SourceOnOff( + UINT32 *pdSrcOnOff +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("ClearD1SourceOnOff"); +#endif + + if (pdSrcOnOff == NULL) { + ; + } else { + ; + *pdSrcOnOff = D1SRC_ALL_OFF; + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("ClearD1SourceOnOff", 0); +#endif +} + +/**************************************************************************** + * ClearD2SourceOnOff + * + * Description: + * Clear digial output source On/Off. + * Arguments: + * pdSrcOnOff source On/Off info + * Return: + * none + * + ****************************************************************************/ +static void ClearD2SourceOnOff( + UINT32 *pdSrcOnOff +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("ClearD2SourceOnOff"); +#endif + + if (pdSrcOnOff == NULL) { + ; + } else { + ; + *pdSrcOnOff = D2SRC_ALL_OFF; + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("ClearD2SourceOnOff", 0); +#endif +} + +/**************************************************************************** + * ClearASourceOnOff + * + * Description: + * Clear analog output source On/Off. + * Arguments: + * pdSrcOnOff source On/Off info + * Return: + * none + * + ****************************************************************************/ +static void ClearASourceOnOff( + UINT32 *pdSrcOnOff +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("ClearASourceOnOff"); +#endif + + if (pdSrcOnOff == NULL) { + ; + } else { + ; + pdSrcOnOff[0] = MCDRV_ASRC_DAC0_L_OFF + | MCDRV_ASRC_DAC0_R_OFF + | MCDRV_ASRC_DAC1_L_OFF + | MCDRV_ASRC_DAC1_R_OFF + | MCDRV_ASRC_MIC1_OFF + | MCDRV_ASRC_MIC2_OFF + | MCDRV_ASRC_MIC3_OFF + | MCDRV_ASRC_MIC4_OFF + | MCDRV_ASRC_LINEIN1_L_OFF + | MCDRV_ASRC_LINEIN1_R_OFF + | MCDRV_ASRC_LINEIN1_M_OFF; + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("ClearASourceOnOff", 0); +#endif +} + +/**************************************************************************** + * SetSourceOnOff + * + * Description: + * Set source On/Off. + * Arguments: + * pdSrcOnOff source On/Off info + * pdDstOnOff destination + * bBlock Block + * bOn On bit + * bOff Off bit + * Return: + * none + * + ****************************************************************************/ +static void SetSourceOnOff( + UINT32 dSrcOnOff, + UINT32 *pdDstOnOff, + UINT32 dOn, + UINT32 dOff +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("SetSourceOnOff"); +#endif + + if (pdDstOnOff == NULL) { + ; + } else { + if ((dSrcOnOff & dOn) != 0) { + *pdDstOnOff &= ~dOff; + *pdDstOnOff |= dOn; + } else if ((dSrcOnOff & (dOn|dOff)) == dOff) { + *pdDstOnOff &= ~dOn; + *pdDstOnOff |= dOff; + } + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("SetSourceOnOff", 0); +#endif +} + +/**************************************************************************** + * McResCtrl_GetPathInfo + * + * Description: + * Get path information. + * Arguments: + * psPathInfo path information + * Return: + * none + * + ****************************************************************************/ +void McResCtrl_GetPathInfo( + struct MCDRV_PATH_INFO *psPathInfo +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McResCtrl_GetPathInfo"); +#endif + + *psPathInfo = gsGlobalInfo.sPathInfo; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McResCtrl_GetPathInfo", 0); +#endif +} + +/**************************************************************************** + * McResCtrl_GetPathInfoVirtual + * + * Description: + * Get virtaul path information. + * Arguments: + * psPathInfo virtaul path information + * Return: + * none + * + ****************************************************************************/ +void McResCtrl_GetPathInfoVirtual( + struct MCDRV_PATH_INFO *psPathInfo +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McResCtrl_GetPathInfoVirtual"); +#endif + + *psPathInfo = gsGlobalInfo.sPathInfoVirtual; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McResCtrl_GetPathInfoVirtual", 0); +#endif +} + +/**************************************************************************** + * McResCtrl_SetVolInfo + * + * Description: + * Update volume. + * Arguments: + * psVolInfo volume setting + * Return: + * none + * + ****************************************************************************/ +void McResCtrl_SetVolInfo( + const struct MCDRV_VOL_INFO *psVolInfo +) +{ + UINT8 bCh; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McResCtrl_SetVolInfo"); +#endif + + + for (bCh = 0; bCh < MUSICIN_VOL_CHANNELS; bCh++) { + if (((UINT16)psVolInfo->aswD_MusicIn[bCh] & 0x01) != 0) + gsGlobalInfo.sVolInfo.aswD_MusicIn[bCh] = + (SINT16)((UINT16)psVolInfo->aswD_MusicIn[bCh] + & 0xFFFE); + } + for (bCh = 0; bCh < EXTIN_VOL_CHANNELS; bCh++) { + if (((UINT16)psVolInfo->aswD_ExtIn[bCh] & 0x01) != 0) + gsGlobalInfo.sVolInfo.aswD_ExtIn[bCh] = + (SINT16)((UINT16)psVolInfo->aswD_ExtIn[bCh] + & 0xFFFE); + } + for (bCh = 0; bCh < VOICEIN_VOL_CHANNELS; bCh++) { + if (((UINT16)psVolInfo->aswD_VoiceIn[bCh] & 0x01) != 0) + gsGlobalInfo.sVolInfo.aswD_VoiceIn[bCh] = + (SINT16)((UINT16)psVolInfo->aswD_VoiceIn[bCh] + & 0xFFFE); + } + for (bCh = 0; bCh < REFIN_VOL_CHANNELS; bCh++) { + if (((UINT16)psVolInfo->aswD_RefIn[bCh] & 0x01) != 0) + gsGlobalInfo.sVolInfo.aswD_RefIn[bCh] = + (SINT16)((UINT16)psVolInfo->aswD_RefIn[bCh] + & 0xFFFE); + } + for (bCh = 0; bCh < ADIF0IN_VOL_CHANNELS; bCh++) { + if (((UINT16)psVolInfo->aswD_Adif0In[bCh] & 0x01) != 0) + gsGlobalInfo.sVolInfo.aswD_Adif0In[bCh] = + (SINT16)((UINT16)psVolInfo->aswD_Adif0In[bCh] + & 0xFFFE); + } + for (bCh = 0; bCh < ADIF1IN_VOL_CHANNELS; bCh++) { + if (((UINT16)psVolInfo->aswD_Adif1In[bCh] & 0x01) != 0) + gsGlobalInfo.sVolInfo.aswD_Adif1In[bCh] = + (SINT16)((UINT16)psVolInfo->aswD_Adif1In[bCh] + & 0xFFFE); + } + for (bCh = 0; bCh < ADIF2IN_VOL_CHANNELS; bCh++) { + if (((UINT16)psVolInfo->aswD_Adif2In[bCh] & 0x01) != 0) + gsGlobalInfo.sVolInfo.aswD_Adif2In[bCh] = + (SINT16)((UINT16)psVolInfo->aswD_Adif2In[bCh] + & 0xFFFE); + } + for (bCh = 0; bCh < MUSICOUT_VOL_CHANNELS ; bCh++) { + if (((UINT16)psVolInfo->aswD_MusicOut[bCh] & 0x01) != 0) + gsGlobalInfo.sVolInfo.aswD_MusicOut[bCh] = + (SINT16)((UINT16)psVolInfo->aswD_MusicOut[bCh] + & 0xFFFE); + } + for (bCh = 0; bCh < EXTOUT_VOL_CHANNELS; bCh++) { + if (((UINT16)psVolInfo->aswD_ExtOut[bCh] & 0x01) != 0) + gsGlobalInfo.sVolInfo.aswD_ExtOut[bCh] = + (SINT16)((UINT16)psVolInfo->aswD_ExtOut[bCh] + & 0xFFFE); + } + for (bCh = 0; bCh < VOICEOUT_VOL_CHANNELS; bCh++) { + if (((UINT16)psVolInfo->aswD_VoiceOut[bCh] & 0x01) != 0) + gsGlobalInfo.sVolInfo.aswD_VoiceOut[bCh] = + (SINT16)((UINT16)psVolInfo->aswD_VoiceOut[bCh] + & 0xFFFE); + } + for (bCh = 0; bCh < REFOUT_VOL_CHANNELS; bCh++) { + if (((UINT16)psVolInfo->aswD_RefOut[bCh] & 0x01) != 0) + gsGlobalInfo.sVolInfo.aswD_RefOut[bCh] = + (SINT16)((UINT16)psVolInfo->aswD_RefOut[bCh] + & 0xFFFE); + } + for (bCh = 0; bCh < DAC0OUT_VOL_CHANNELS; bCh++) { + if (((UINT16)psVolInfo->aswD_Dac0Out[bCh] & 0x01) != 0) + gsGlobalInfo.sVolInfo.aswD_Dac0Out[bCh] = + (SINT16)((UINT16)psVolInfo->aswD_Dac0Out[bCh] + & 0xFFFE); + } + for (bCh = 0; bCh < DAC1OUT_VOL_CHANNELS; bCh++) { + if (((UINT16)psVolInfo->aswD_Dac1Out[bCh] & 0x01) != 0) + gsGlobalInfo.sVolInfo.aswD_Dac1Out[bCh] = + (SINT16)((UINT16)psVolInfo->aswD_Dac1Out[bCh] + & 0xFFFE); + } + for (bCh = 0; bCh < DPATH_VOL_CHANNELS; bCh++) { + if (((UINT16)psVolInfo->aswD_DpathDa[bCh] & 0x01) != 0) + gsGlobalInfo.sVolInfo.aswD_DpathDa[bCh] = + (SINT16)((UINT16)psVolInfo->aswD_DpathDa[bCh] + & 0xFFFE); + + if (((UINT16)psVolInfo->aswD_DpathAd[bCh] & 0x01) != 0) + gsGlobalInfo.sVolInfo.aswD_DpathAd[bCh] = + (SINT16)((UINT16)psVolInfo->aswD_DpathAd[bCh] + & 0xFFFE); + } + + for (bCh = 0; bCh < LINEIN1_VOL_CHANNELS; bCh++) { + if (((UINT16)psVolInfo->aswA_LineIn1[bCh] & 0x01) != 0) + gsGlobalInfo.sVolInfo.aswA_LineIn1[bCh] = + (SINT16)((UINT16)psVolInfo->aswA_LineIn1[bCh] + & 0xFFFE); + } + for (bCh = 0; bCh < MIC1_VOL_CHANNELS; bCh++) { + if (((UINT16)psVolInfo->aswA_Mic1[bCh] & 0x01) != 0) + gsGlobalInfo.sVolInfo.aswA_Mic1[bCh] = + (SINT16)((UINT16)psVolInfo->aswA_Mic1[bCh] + & 0xFFFE); + } + for (bCh = 0; bCh < MIC2_VOL_CHANNELS; bCh++) { + if (((UINT16)psVolInfo->aswA_Mic2[bCh] & 0x01) != 0) + gsGlobalInfo.sVolInfo.aswA_Mic2[bCh] = + (SINT16)((UINT16)psVolInfo->aswA_Mic2[bCh] + & 0xFFFE); + } + for (bCh = 0; bCh < MIC3_VOL_CHANNELS; bCh++) { + if (((UINT16)psVolInfo->aswA_Mic3[bCh] & 0x01) != 0) + gsGlobalInfo.sVolInfo.aswA_Mic3[bCh] = + (SINT16)((UINT16)psVolInfo->aswA_Mic3[bCh] + & 0xFFFE); + } + for (bCh = 0; bCh < MIC4_VOL_CHANNELS; bCh++) { + if (((UINT16)psVolInfo->aswA_Mic4[bCh] & 0x01) != 0) + gsGlobalInfo.sVolInfo.aswA_Mic4[bCh] = + (SINT16)((UINT16)psVolInfo->aswA_Mic4[bCh] + & 0xFFFE); + } + for (bCh = 0; bCh < HP_VOL_CHANNELS; bCh++) { + if (((UINT16)psVolInfo->aswA_Hp[bCh] & 0x01) != 0) + gsGlobalInfo.sVolInfo.aswA_Hp[bCh] = + (SINT16)((UINT16)psVolInfo->aswA_Hp[bCh] + & 0xFFFE); + } + for (bCh = 0; bCh < SP_VOL_CHANNELS; bCh++) { + if (((UINT16)psVolInfo->aswA_Sp[bCh] & 0x01) != 0) + gsGlobalInfo.sVolInfo.aswA_Sp[bCh] = + (SINT16)((UINT16)psVolInfo->aswA_Sp[bCh] + & 0xFFFE); + } + for (bCh = 0; bCh < RC_VOL_CHANNELS; bCh++) { + if (((UINT16)psVolInfo->aswA_Rc[bCh] & 0x01) != 0) + gsGlobalInfo.sVolInfo.aswA_Rc[bCh] = + (SINT16)((UINT16)psVolInfo->aswA_Rc[bCh] + & 0xFFFE); + } + for (bCh = 0; bCh < LINEOUT1_VOL_CHANNELS; bCh++) { + if (((UINT16)psVolInfo->aswA_LineOut1[bCh] & 0x01) != 0) + gsGlobalInfo.sVolInfo.aswA_LineOut1[bCh] = + (SINT16)((UINT16)psVolInfo->aswA_LineOut1[bCh] + & 0xFFFE); + } + for (bCh = 0; bCh < LINEOUT2_VOL_CHANNELS; bCh++) { + if (((UINT16)psVolInfo->aswA_LineOut2[bCh] & 0x01) != 0) + gsGlobalInfo.sVolInfo.aswA_LineOut2[bCh] = + (SINT16)((UINT16)psVolInfo->aswA_LineOut2[bCh] + & 0xFFFE); + } + for (bCh = 0; bCh < HPDET_VOL_CHANNELS; bCh++) { + if (((UINT16)psVolInfo->aswA_HpDet[bCh] & 0x01) != 0) + gsGlobalInfo.sVolInfo.aswA_HpDet[bCh] = + (SINT16)((UINT16)psVolInfo->aswA_HpDet[bCh] + & 0xFFFE); + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McResCtrl_SetVolInfo", 0); +#endif +} + +/**************************************************************************** + * McResCtrl_GetVolInfo + * + * Description: + * Get volume setting. + * Arguments: + * psVolInfo volume setting + * Return: + * none + * + ****************************************************************************/ +void McResCtrl_GetVolInfo( + struct MCDRV_VOL_INFO *psVolInfo +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McResCtrl_GetVolInfo"); +#endif + + *psVolInfo = gsGlobalInfo.sVolInfo; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McResCtrl_GetVolInfo", 0); +#endif +} + +/**************************************************************************** + * McResCtrl_SetDioInfo + * + * Description: + * Set digital io information. + * Arguments: + * psDioInfo digital io information + * dUpdateInfo update information + * Return: + * none + * + ****************************************************************************/ +void McResCtrl_SetDioInfo( + const struct MCDRV_DIO_INFO *psDioInfo, + UINT32 dUpdateInfo +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McResCtrl_SetDioInfo"); +#endif + + + if ((dUpdateInfo & MCDRV_MUSIC_COM_UPDATE_FLAG) != 0UL) + SetDIOCommon(psDioInfo, 0); + if ((dUpdateInfo & MCDRV_EXT_COM_UPDATE_FLAG) != 0UL) + SetDIOCommon(psDioInfo, 1); + if ((dUpdateInfo & MCDRV_VOICE_COM_UPDATE_FLAG) != 0UL) + SetDIOCommon(psDioInfo, 2); + if ((dUpdateInfo & MCDRV_HIFI_COM_UPDATE_FLAG) != 0UL) + SetDIOCommon(psDioInfo, 3); + + if ((dUpdateInfo & MCDRV_MUSIC_DIR_UPDATE_FLAG) != 0UL) + SetDIODIR(psDioInfo, 0); + if ((dUpdateInfo & MCDRV_EXT_DIR_UPDATE_FLAG) != 0UL) + SetDIODIR(psDioInfo, 1); + if ((dUpdateInfo & MCDRV_VOICE_DIR_UPDATE_FLAG) != 0UL) + SetDIODIR(psDioInfo, 2); + if ((dUpdateInfo & MCDRV_HIFI_DIR_UPDATE_FLAG) != 0UL) + SetDIODIR(psDioInfo, 3); + + if ((dUpdateInfo & MCDRV_MUSIC_DIT_UPDATE_FLAG) != 0UL) + SetDIODIT(psDioInfo, 0); + if ((dUpdateInfo & MCDRV_EXT_DIT_UPDATE_FLAG) != 0UL) + SetDIODIT(psDioInfo, 1); + if ((dUpdateInfo & MCDRV_VOICE_DIT_UPDATE_FLAG) != 0UL) + SetDIODIT(psDioInfo, 2); + if ((dUpdateInfo & MCDRV_HIFI_DIT_UPDATE_FLAG) != 0UL) + SetDIODIT(psDioInfo, 3); + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McResCtrl_SetDioInfo", 0); +#endif +} + +/**************************************************************************** + * SetDIOCommon + * + * Description: + * Set digital io common information. + * Arguments: + * psDioInfo digital io information + * bPort port number + * Return: + * none + * + ****************************************************************************/ +static void SetDIOCommon( + const struct MCDRV_DIO_INFO *psDioInfo, + UINT8 bPort +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("SetDIOCommon"); +#endif + + gsGlobalInfo.sDioInfo.asPortInfo[bPort].sDioCommon.bMasterSlave + = psDioInfo->asPortInfo[bPort].sDioCommon.bMasterSlave; + gsGlobalInfo.sDioInfo.asPortInfo[bPort].sDioCommon.bAutoFs + = psDioInfo->asPortInfo[bPort].sDioCommon.bAutoFs; + gsGlobalInfo.sDioInfo.asPortInfo[bPort].sDioCommon.bFs + = psDioInfo->asPortInfo[bPort].sDioCommon.bFs; + gsGlobalInfo.sDioInfo.asPortInfo[bPort].sDioCommon.bBckFs + = psDioInfo->asPortInfo[bPort].sDioCommon.bBckFs; + gsGlobalInfo.sDioInfo.asPortInfo[bPort].sDioCommon.bInterface + = psDioInfo->asPortInfo[bPort].sDioCommon.bInterface; + gsGlobalInfo.sDioInfo.asPortInfo[bPort].sDioCommon.bBckInvert + = psDioInfo->asPortInfo[bPort].sDioCommon.bBckInvert; + gsGlobalInfo.sDioInfo.asPortInfo[bPort].sDioCommon.bSrcThru + = psDioInfo->asPortInfo[bPort].sDioCommon.bSrcThru; + + gsGlobalInfo.sDioInfo.asPortInfo[bPort].sDioCommon.bPcmHizTim + = psDioInfo->asPortInfo[bPort].sDioCommon.bPcmHizTim; + gsGlobalInfo.sDioInfo.asPortInfo[bPort].sDioCommon.bPcmFrame + = psDioInfo->asPortInfo[bPort].sDioCommon.bPcmFrame; + gsGlobalInfo.sDioInfo.asPortInfo[bPort].sDioCommon.bPcmHighPeriod + = psDioInfo->asPortInfo[bPort].sDioCommon.bPcmHighPeriod; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("SetDIOCommon", 0); +#endif +} + +/**************************************************************************** + * SetDIODIR + * + * Description: + * Set digital io dir information. + * Arguments: + * psDioInfo digital io information + * bPort port number + * Return: + * none + * + ****************************************************************************/ +static void SetDIODIR( + const struct MCDRV_DIO_INFO *psDioInfo, + UINT8 bPort +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("SetDIODIR"); +#endif + + gsGlobalInfo.sDioInfo.asPortInfo[bPort].sDir.sDaFormat.bBitSel + = psDioInfo->asPortInfo[bPort].sDir.sDaFormat.bBitSel; + gsGlobalInfo.sDioInfo.asPortInfo[bPort].sDir.sDaFormat.bMode + = psDioInfo->asPortInfo[bPort].sDir.sDaFormat.bMode; + + gsGlobalInfo.sDioInfo.asPortInfo[bPort].sDir.sPcmFormat.bMono + = psDioInfo->asPortInfo[bPort].sDir.sPcmFormat.bMono; + gsGlobalInfo.sDioInfo.asPortInfo[bPort].sDir.sPcmFormat.bOrder + = psDioInfo->asPortInfo[bPort].sDir.sPcmFormat.bOrder; + gsGlobalInfo.sDioInfo.asPortInfo[bPort].sDir.sPcmFormat.bLaw + = psDioInfo->asPortInfo[bPort].sDir.sPcmFormat.bLaw; + gsGlobalInfo.sDioInfo.asPortInfo[bPort].sDir.sPcmFormat.bBitSel + = psDioInfo->asPortInfo[bPort].sDir.sPcmFormat.bBitSel; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("SetDIODIR", 0); +#endif +} + +/**************************************************************************** + * SetDIODIT + * + * Description: + * Set digital io dit information. + * Arguments: + * psDioInfo digital io information + * bPort port number + * Return: + * none + * + ****************************************************************************/ +static void SetDIODIT( + const struct MCDRV_DIO_INFO *psDioInfo, + UINT8 bPort +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("SetDIODIT"); +#endif + + gsGlobalInfo.sDioInfo.asPortInfo[bPort].sDit.bStMode + = psDioInfo->asPortInfo[bPort].sDit.bStMode; + gsGlobalInfo.sDioInfo.asPortInfo[bPort].sDit.bEdge + = psDioInfo->asPortInfo[bPort].sDit.bEdge; + + gsGlobalInfo.sDioInfo.asPortInfo[bPort].sDit.sDaFormat.bBitSel + = psDioInfo->asPortInfo[bPort].sDit.sDaFormat.bBitSel; + gsGlobalInfo.sDioInfo.asPortInfo[bPort].sDit.sDaFormat.bMode + = psDioInfo->asPortInfo[bPort].sDit.sDaFormat.bMode; + + gsGlobalInfo.sDioInfo.asPortInfo[bPort].sDit.sPcmFormat.bMono + = psDioInfo->asPortInfo[bPort].sDit.sPcmFormat.bMono; + gsGlobalInfo.sDioInfo.asPortInfo[bPort].sDit.sPcmFormat.bOrder + = psDioInfo->asPortInfo[bPort].sDit.sPcmFormat.bOrder; + gsGlobalInfo.sDioInfo.asPortInfo[bPort].sDit.sPcmFormat.bLaw + = psDioInfo->asPortInfo[bPort].sDit.sPcmFormat.bLaw; + gsGlobalInfo.sDioInfo.asPortInfo[bPort].sDit.sPcmFormat.bBitSel + = psDioInfo->asPortInfo[bPort].sDit.sPcmFormat.bBitSel; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("SetDIODIT", 0); +#endif +} + +/**************************************************************************** + * McResCtrl_GetDioInfo + * + * Description: + * Get digital io information. + * Arguments: + * psDioInfo digital io information + * Return: + * none + * + ****************************************************************************/ +void McResCtrl_GetDioInfo( + struct MCDRV_DIO_INFO *psDioInfo +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McResCtrl_GetDioInfo"); +#endif + + *psDioInfo = gsGlobalInfo.sDioInfo; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McResCtrl_GetDioInfo", 0); +#endif +} + +/**************************************************************************** + * McResCtrl_SetDioPathInfo + * + * Description: + * Set digital io path information. + * Arguments: + * psDioPathInfo digital io path information + * dUpdateInfo update information + * Return: + * none + * + ****************************************************************************/ +void McResCtrl_SetDioPathInfo( + const struct MCDRV_DIOPATH_INFO *psDioPathInfo, + UINT32 dUpdateInfo +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McResCtrl_SetDioPathInfo"); +#endif + + + if ((dUpdateInfo & MCDRV_MUSICNUM_UPDATE_FLAG) != 0UL) + gsGlobalInfo.sDioPathInfo.bMusicCh + = psDioPathInfo->bMusicCh; + + if ((dUpdateInfo & MCDRV_PHYS0_UPDATE_FLAG) != 0UL) + gsGlobalInfo.sDioPathInfo.abPhysPort[0] + = psDioPathInfo->abPhysPort[0]; + + if ((dUpdateInfo & MCDRV_PHYS1_UPDATE_FLAG) != 0UL) + gsGlobalInfo.sDioPathInfo.abPhysPort[1] + = psDioPathInfo->abPhysPort[1]; + + if ((dUpdateInfo & MCDRV_PHYS2_UPDATE_FLAG) != 0UL) + gsGlobalInfo.sDioPathInfo.abPhysPort[2] + = psDioPathInfo->abPhysPort[2]; + + if ((dUpdateInfo & MCDRV_PHYS3_UPDATE_FLAG) != 0UL) + gsGlobalInfo.sDioPathInfo.abPhysPort[3] + = psDioPathInfo->abPhysPort[3]; + + + if ((dUpdateInfo & MCDRV_DIR0SLOT_UPDATE_FLAG) != 0UL) + gsGlobalInfo.sDioPathInfo.abMusicRSlot[0] + = psDioPathInfo->abMusicRSlot[0]; + + if ((dUpdateInfo & MCDRV_DIR1SLOT_UPDATE_FLAG) != 0UL) + gsGlobalInfo.sDioPathInfo.abMusicRSlot[1] + = psDioPathInfo->abMusicRSlot[1]; + + if ((dUpdateInfo & MCDRV_DIR2SLOT_UPDATE_FLAG) != 0UL) + gsGlobalInfo.sDioPathInfo.abMusicRSlot[2] + = psDioPathInfo->abMusicRSlot[2]; + + + if ((dUpdateInfo & MCDRV_DIT0SLOT_UPDATE_FLAG) != 0UL) + gsGlobalInfo.sDioPathInfo.abMusicTSlot[0] + = psDioPathInfo->abMusicTSlot[0]; + + if ((dUpdateInfo & MCDRV_DIT1SLOT_UPDATE_FLAG) != 0UL) + gsGlobalInfo.sDioPathInfo.abMusicTSlot[1] + = psDioPathInfo->abMusicTSlot[1]; + + if ((dUpdateInfo & MCDRV_DIT2SLOT_UPDATE_FLAG) != 0UL) + gsGlobalInfo.sDioPathInfo.abMusicTSlot[2] + = psDioPathInfo->abMusicTSlot[2]; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McResCtrl_SetDioPathInfo", 0); +#endif +} + +/**************************************************************************** + * McResCtrl_GetDioPathInfo + * + * Description: + * Get digital io path information. + * Arguments: + * psDioPathInfo digital io path information + * Return: + * none + * + ****************************************************************************/ +void McResCtrl_GetDioPathInfo( + struct MCDRV_DIOPATH_INFO *psDioPathInfo +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McResCtrl_GetDioPathInfo"); +#endif + + *psDioPathInfo = gsGlobalInfo.sDioPathInfo; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McResCtrl_GetDioPathInfo", 0); +#endif +} + +/**************************************************************************** + * McResCtrl_SetSwap + * + * Description: + * Get Swap info. + * Arguments: + * psSwapInfo pointer to struct MCDRV_SWAP_INFO struct + * dUpdateInfo update information + * Return: + * none + * + ****************************************************************************/ +void McResCtrl_SetSwap( + const struct MCDRV_SWAP_INFO *psSwapInfo, + UINT32 dUpdateInfo +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McResCtrl_SetSwap"); +#endif + + + if ((dUpdateInfo & MCDRV_SWAP_ADIF0_UPDATE_FLAG) != 0UL) + gsGlobalInfo.sSwapInfo.bAdif0 = psSwapInfo->bAdif0; + + if ((dUpdateInfo & MCDRV_SWAP_ADIF1_UPDATE_FLAG) != 0UL) + gsGlobalInfo.sSwapInfo.bAdif1 = psSwapInfo->bAdif1; + + if ((dUpdateInfo & MCDRV_SWAP_ADIF2_UPDATE_FLAG) != 0UL) + gsGlobalInfo.sSwapInfo.bAdif2 = psSwapInfo->bAdif2; + + if ((dUpdateInfo & MCDRV_SWAP_DAC0_UPDATE_FLAG) != 0UL) + gsGlobalInfo.sSwapInfo.bDac0 = psSwapInfo->bDac0; + + if ((dUpdateInfo & MCDRV_SWAP_DAC1_UPDATE_FLAG) != 0UL) + gsGlobalInfo.sSwapInfo.bDac1 = psSwapInfo->bDac1; + + if ((dUpdateInfo & MCDRV_SWAP_MUSICIN0_UPDATE_FLAG) != 0UL) + gsGlobalInfo.sSwapInfo.bMusicIn0 = psSwapInfo->bMusicIn0; + + if ((dUpdateInfo & MCDRV_SWAP_MUSICIN1_UPDATE_FLAG) != 0UL) + gsGlobalInfo.sSwapInfo.bMusicIn1 = psSwapInfo->bMusicIn1; + + if ((dUpdateInfo & MCDRV_SWAP_MUSICIN2_UPDATE_FLAG) != 0UL) + gsGlobalInfo.sSwapInfo.bMusicIn2 = psSwapInfo->bMusicIn2; + + if ((dUpdateInfo & MCDRV_SWAP_EXTIN_UPDATE_FLAG) != 0UL) + gsGlobalInfo.sSwapInfo.bExtIn = psSwapInfo->bExtIn; + + if ((dUpdateInfo & MCDRV_SWAP_VOICEIN_UPDATE_FLAG) != 0UL) + gsGlobalInfo.sSwapInfo.bVoiceIn = psSwapInfo->bVoiceIn; + + if ((dUpdateInfo & MCDRV_SWAP_HIFIIN_UPDATE_FLAG) != 0UL) + gsGlobalInfo.sSwapInfo.bHifiIn = psSwapInfo->bHifiIn; + + if ((dUpdateInfo & MCDRV_SWAP_MUSICOUT0_UPDATE_FLAG) != 0UL) + gsGlobalInfo.sSwapInfo.bMusicOut0 + = psSwapInfo->bMusicOut0; + + if ((dUpdateInfo & MCDRV_SWAP_MUSICOUT1_UPDATE_FLAG) != 0UL) + gsGlobalInfo.sSwapInfo.bMusicOut1 + = psSwapInfo->bMusicOut1; + + if ((dUpdateInfo & MCDRV_SWAP_MUSICOUT2_UPDATE_FLAG) != 0UL) + gsGlobalInfo.sSwapInfo.bMusicOut2 + = psSwapInfo->bMusicOut2; + + if ((dUpdateInfo & MCDRV_SWAP_EXTOUT_UPDATE_FLAG) != 0UL) + gsGlobalInfo.sSwapInfo.bExtOut = psSwapInfo->bExtOut; + + if ((dUpdateInfo & MCDRV_SWAP_VOICEOUT_UPDATE_FLAG) != 0UL) + gsGlobalInfo.sSwapInfo.bVoiceOut = psSwapInfo->bVoiceOut; + + if ((dUpdateInfo & MCDRV_SWAP_HIFIOUT_UPDATE_FLAG) != 0UL) + gsGlobalInfo.sSwapInfo.bHifiOut = psSwapInfo->bHifiOut; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McResCtrl_SetSwap", 0); +#endif +} + +/**************************************************************************** + * McResCtrl_GetSwap + * + * Description: + * Get Swap info. + * Arguments: + * psSwapInfo pointer to struct MCDRV_SWAP_INFO struct + * Return: + * none + * + ****************************************************************************/ +void McResCtrl_GetSwap( + struct MCDRV_SWAP_INFO *psSwapInfo +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McResCtrl_GetSwap"); +#endif + + *psSwapInfo = gsGlobalInfo.sSwapInfo; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McResCtrl_GetSwap", 0); +#endif +} + +/**************************************************************************** + * McResCtrl_SetHSDet + * + * Description: + * Get Headset Det info. + * Arguments: + * psHSDetInfo pointer to MCDRV_HSDET_INFO struct + * psHSDet2Info pointer to MCDRV_HSDET2_INFO struct + * dUpdateInfo update information + * Return: + * none + * + ****************************************************************************/ +void McResCtrl_SetHSDet( + const struct MCDRV_HSDET_INFO *psHSDetInfo, + const struct MCDRV_HSDET2_INFO *psHSDet2Info, + UINT32 dUpdateInfo +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McResCtrl_SetHSDet"); +#endif + + + if ((dUpdateInfo & MCDRV_ENPLUGDET_UPDATE_FLAG) != 0UL) + gsGlobalInfo.sHSDetInfo.bEnPlugDet + = psHSDetInfo->bEnPlugDet; + + if ((dUpdateInfo & MCDRV_ENPLUGDETDB_UPDATE_FLAG) != 0UL) + gsGlobalInfo.sHSDetInfo.bEnPlugDetDb + = psHSDetInfo->bEnPlugDetDb; + + if ((dUpdateInfo & MCDRV_ENDLYKEYOFF_UPDATE_FLAG) != 0UL) + gsGlobalInfo.sHSDetInfo.bEnDlyKeyOff + = psHSDetInfo->bEnDlyKeyOff; + + if ((dUpdateInfo & MCDRV_ENDLYKEYON_UPDATE_FLAG) != 0UL) + gsGlobalInfo.sHSDetInfo.bEnDlyKeyOn + = psHSDetInfo->bEnDlyKeyOn; + + if ((dUpdateInfo & MCDRV_ENMICDET_UPDATE_FLAG) != 0UL) + gsGlobalInfo.sHSDetInfo.bEnMicDet + = psHSDetInfo->bEnMicDet; + + if ((dUpdateInfo & MCDRV_ENKEYOFF_UPDATE_FLAG) != 0UL) + gsGlobalInfo.sHSDetInfo.bEnKeyOff + = psHSDetInfo->bEnKeyOff; + + if ((dUpdateInfo & MCDRV_ENKEYON_UPDATE_FLAG) != 0UL) + gsGlobalInfo.sHSDetInfo.bEnKeyOn + = psHSDetInfo->bEnKeyOn; + + if ((dUpdateInfo & MCDRV_HSDETDBNC_UPDATE_FLAG) != 0UL) + gsGlobalInfo.sHSDetInfo.bHsDetDbnc + = psHSDetInfo->bHsDetDbnc; + + if ((dUpdateInfo & MCDRV_KEYOFFMTIM_UPDATE_FLAG) != 0UL) + gsGlobalInfo.sHSDetInfo.bKeyOffMtim + = psHSDetInfo->bKeyOffMtim; + + if ((dUpdateInfo & MCDRV_KEYONMTIM_UPDATE_FLAG) != 0UL) + gsGlobalInfo.sHSDetInfo.bKeyOnMtim + = psHSDetInfo->bKeyOnMtim; + + if ((dUpdateInfo & MCDRV_KEY0OFFDLYTIM_UPDATE_FLAG) != 0UL) + gsGlobalInfo.sHSDetInfo.bKey0OffDlyTim + = psHSDetInfo->bKey0OffDlyTim; + + if ((dUpdateInfo & MCDRV_KEY1OFFDLYTIM_UPDATE_FLAG) != 0UL) + gsGlobalInfo.sHSDetInfo.bKey1OffDlyTim + = psHSDetInfo->bKey1OffDlyTim; + + if ((dUpdateInfo & MCDRV_KEY2OFFDLYTIM_UPDATE_FLAG) != 0UL) + gsGlobalInfo.sHSDetInfo.bKey2OffDlyTim + = psHSDetInfo->bKey2OffDlyTim; + + if ((dUpdateInfo & MCDRV_KEY0ONDLYTIM_UPDATE_FLAG) != 0UL) + gsGlobalInfo.sHSDetInfo.bKey0OnDlyTim + = psHSDetInfo->bKey0OnDlyTim; + + if ((dUpdateInfo & MCDRV_KEY1ONDLYTIM_UPDATE_FLAG) != 0UL) + gsGlobalInfo.sHSDetInfo.bKey1OnDlyTim + = psHSDetInfo->bKey1OnDlyTim; + + if ((dUpdateInfo & MCDRV_KEY2ONDLYTIM_UPDATE_FLAG) != 0UL) + gsGlobalInfo.sHSDetInfo.bKey2OnDlyTim + = psHSDetInfo->bKey2OnDlyTim; + + if ((dUpdateInfo & MCDRV_KEY0ONDLYTIM2_UPDATE_FLAG) != 0UL) + gsGlobalInfo.sHSDetInfo.bKey0OnDlyTim2 + = psHSDetInfo->bKey0OnDlyTim2; + + if ((dUpdateInfo & MCDRV_KEY1ONDLYTIM2_UPDATE_FLAG) != 0UL) + gsGlobalInfo.sHSDetInfo.bKey1OnDlyTim2 + = psHSDetInfo->bKey1OnDlyTim2; + + if ((dUpdateInfo & MCDRV_KEY2ONDLYTIM2_UPDATE_FLAG) != 0UL) + gsGlobalInfo.sHSDetInfo.bKey2OnDlyTim2 + = psHSDetInfo->bKey2OnDlyTim2; + + if ((dUpdateInfo & MCDRV_IRQTYPE_UPDATE_FLAG) != 0UL) { + gsGlobalInfo.sHSDetInfo.bIrqType + = psHSDetInfo->bIrqType; + if (psHSDet2Info != NULL) { + gsGlobalInfo.sHSDet2Info.bPlugDetDbIrqType + = psHSDet2Info->bPlugDetDbIrqType; + gsGlobalInfo.sHSDet2Info.bPlugUndetDbIrqType + = psHSDet2Info->bPlugUndetDbIrqType; + gsGlobalInfo.sHSDet2Info.bMicDetIrqType + = psHSDet2Info->bMicDetIrqType; + gsGlobalInfo.sHSDet2Info.bPlugDetIrqType + = psHSDet2Info->bPlugDetIrqType; + gsGlobalInfo.sHSDet2Info.bKey0OnIrqType + = psHSDet2Info->bKey0OnIrqType; + gsGlobalInfo.sHSDet2Info.bKey1OnIrqType + = psHSDet2Info->bKey1OnIrqType; + gsGlobalInfo.sHSDet2Info.bKey2OnIrqType + = psHSDet2Info->bKey2OnIrqType; + gsGlobalInfo.sHSDet2Info.bKey0OffIrqType + = psHSDet2Info->bKey0OffIrqType; + gsGlobalInfo.sHSDet2Info.bKey1OffIrqType + = psHSDet2Info->bKey1OffIrqType; + gsGlobalInfo.sHSDet2Info.bKey2OffIrqType + = psHSDet2Info->bKey2OffIrqType; + } + } + + if ((dUpdateInfo & MCDRV_DETINV_UPDATE_FLAG) != 0UL) + gsGlobalInfo.sHSDetInfo.bDetInInv + = psHSDetInfo->bDetInInv; + + if ((dUpdateInfo & MCDRV_HSDETMODE_UPDATE_FLAG) != 0UL) + gsGlobalInfo.sHSDetInfo.bHsDetMode + = psHSDetInfo->bHsDetMode; + + if ((dUpdateInfo & MCDRV_SPERIOD_UPDATE_FLAG) != 0UL) + gsGlobalInfo.sHSDetInfo.bSperiod + = psHSDetInfo->bSperiod; + + if ((dUpdateInfo & MCDRV_LPERIOD_UPDATE_FLAG) != 0UL) + gsGlobalInfo.sHSDetInfo.bLperiod + = psHSDetInfo->bLperiod; + + if ((dUpdateInfo & MCDRV_DBNCNUMPLUG_UPDATE_FLAG) != 0UL) + gsGlobalInfo.sHSDetInfo.bDbncNumPlug + = psHSDetInfo->bDbncNumPlug; + + if ((dUpdateInfo & MCDRV_DBNCNUMMIC_UPDATE_FLAG) != 0UL) + gsGlobalInfo.sHSDetInfo.bDbncNumMic + = psHSDetInfo->bDbncNumMic; + + if ((dUpdateInfo & MCDRV_DBNCNUMKEY_UPDATE_FLAG) != 0UL) + gsGlobalInfo.sHSDetInfo.bDbncNumKey + = psHSDetInfo->bDbncNumKey; + + if (McDevProf_GetDevId() != eMCDRV_DEV_ID_89_92H) { + if ((dUpdateInfo & MCDRV_SGNL_UPDATE_FLAG) != 0UL) { + gsGlobalInfo.sHSDetInfo.bSgnlPeriod + = psHSDetInfo->bSgnlPeriod; + gsGlobalInfo.sHSDetInfo.bSgnlNum + = psHSDetInfo->bSgnlNum; + gsGlobalInfo.sHSDetInfo.bSgnlPeak + = psHSDetInfo->bSgnlPeak; + } + } + + if ((dUpdateInfo & MCDRV_IMPSEL_UPDATE_FLAG) != 0UL) + gsGlobalInfo.sHSDetInfo.bImpSel + = psHSDetInfo->bImpSel; + + if ((dUpdateInfo & MCDRV_DLYIRQSTOP_UPDATE_FLAG) != 0UL) + gsGlobalInfo.sHSDetInfo.bDlyIrqStop + = psHSDetInfo->bDlyIrqStop; + + if ((dUpdateInfo & MCDRV_CBFUNC_UPDATE_FLAG) != 0UL) + gsGlobalInfo.sHSDetInfo.cbfunc + = psHSDetInfo->cbfunc; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McResCtrl_SetHSDet", 0); +#endif +} + +/**************************************************************************** + * McResCtrl_GetHSDet + * + * Description: + * Get Headset Det info. + * Arguments: + * psHSDetInfo pointer to MCDRV_HSDET_INFO struct + * psHSDet2Info pointer to MCDRV_HSDET2_INFO struct + * Return: + * none + * + ****************************************************************************/ +void McResCtrl_GetHSDet( + struct MCDRV_HSDET_INFO *psHSDetInfo, + struct MCDRV_HSDET2_INFO *psHSDet2Info +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McResCtrl_GetHSDet"); +#endif + + *psHSDetInfo = gsGlobalInfo.sHSDetInfo; + if (psHSDet2Info != NULL) { + ; + *psHSDet2Info = gsGlobalInfo.sHSDet2Info; + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McResCtrl_GetHSDet", 0); +#endif +} + +/**************************************************************************** + * McResCtrl_SetAecInfo + * + * Description: + * Set AEC info. + * Arguments: + * psAecInfo pointer to MCDRV_AEC_INFO struct + * Return: + * none + * + ****************************************************************************/ +void McResCtrl_SetAecInfo( + const struct MCDRV_AEC_INFO *psAecInfo +) +{ + int i; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McResCtrl_SetAecInfo"); +#endif + + + if (psAecInfo->sAecConfig.bFDspLocate != 0xFF) + gsGlobalInfo.sAecInfo.sAecConfig + = psAecInfo->sAecConfig; + + gsGlobalInfo.sAecInfo.sAecAudioengine.bEnable + = psAecInfo->sAecAudioengine.bEnable; + if (psAecInfo->sAecAudioengine.bEnable != 0) { + if (psAecInfo->sAecAudioengine.bAEOnOff != 2) + gsGlobalInfo.sAecInfo.sAecAudioengine.bAEOnOff + = psAecInfo->sAecAudioengine.bAEOnOff; + if (psAecInfo->sAecAudioengine.bFDspOnOff != 2) + gsGlobalInfo.sAecInfo.sAecAudioengine.bFDspOnOff + = psAecInfo->sAecAudioengine.bFDspOnOff; + if (psAecInfo->sAecAudioengine.bBDspAE0Src != 2) + gsGlobalInfo.sAecInfo.sAecAudioengine.bBDspAE0Src + = psAecInfo->sAecAudioengine.bBDspAE0Src; + if (psAecInfo->sAecAudioengine.bBDspAE1Src != 2) + gsGlobalInfo.sAecInfo.sAecAudioengine.bBDspAE1Src + = psAecInfo->sAecAudioengine.bBDspAE1Src; + if (psAecInfo->sAecAudioengine.bMixerIn0Src != 2) + gsGlobalInfo.sAecInfo.sAecAudioengine.bMixerIn0Src + = psAecInfo->sAecAudioengine.bMixerIn0Src; + if (psAecInfo->sAecAudioengine.bMixerIn1Src != 2) + gsGlobalInfo.sAecInfo.sAecAudioengine.bMixerIn1Src + = psAecInfo->sAecAudioengine.bMixerIn1Src; + if (psAecInfo->sAecAudioengine.bMixerIn2Src != 2) + gsGlobalInfo.sAecInfo.sAecAudioengine.bMixerIn2Src + = psAecInfo->sAecAudioengine.bMixerIn2Src; + if (psAecInfo->sAecAudioengine.bMixerIn3Src != 2) + gsGlobalInfo.sAecInfo.sAecAudioengine.bMixerIn3Src + = psAecInfo->sAecAudioengine.bMixerIn3Src; + } + gsGlobalInfo.sAecInfo.sAecAudioengine.sAecBDsp + = psAecInfo->sAecAudioengine.sAecBDsp; + gsGlobalInfo.sAecInfo.sAecAudioengine.sAecFDsp + = psAecInfo->sAecAudioengine.sAecFDsp; + + gsGlobalInfo.sAecInfo.sAecVBox.bEnable + = psAecInfo->sAecVBox.bEnable; + if (psAecInfo->sAecVBox.bEnable != 0) { + if (psAecInfo->sAecVBox.bCDspFuncAOnOff != 2) + gsGlobalInfo.sAecInfo.sAecVBox.bCDspFuncAOnOff + = psAecInfo->sAecVBox.bCDspFuncAOnOff; + if (psAecInfo->sAecVBox.bCDspFuncBOnOff != 2) + gsGlobalInfo.sAecInfo.sAecVBox.bCDspFuncBOnOff + = psAecInfo->sAecVBox.bCDspFuncBOnOff; + if (psAecInfo->sAecVBox.bFDspOnOff != 2) + gsGlobalInfo.sAecInfo.sAecVBox.bFDspOnOff + = psAecInfo->sAecVBox.bFDspOnOff; + if (psAecInfo->sAecVBox.bFdsp_Po_Source != 0xFF) + gsGlobalInfo.sAecInfo.sAecVBox.bFdsp_Po_Source + = psAecInfo->sAecVBox.bFdsp_Po_Source; + if (psAecInfo->sAecVBox.bISrc2_VSource != 0xFF) + gsGlobalInfo.sAecInfo.sAecVBox.bISrc2_VSource + = psAecInfo->sAecVBox.bISrc2_VSource; + if (psAecInfo->sAecVBox.bISrc2_Ch1_VSource != 0xFF) + gsGlobalInfo.sAecInfo.sAecVBox.bISrc2_Ch1_VSource + = psAecInfo->sAecVBox.bISrc2_Ch1_VSource; + if (psAecInfo->sAecVBox.bISrc3_VSource != 0xFF) + gsGlobalInfo.sAecInfo.sAecVBox.bISrc3_VSource + = psAecInfo->sAecVBox.bISrc3_VSource; + if (psAecInfo->sAecVBox.bLPt2_VSource != 0xFF) + gsGlobalInfo.sAecInfo.sAecVBox.bLPt2_VSource + = psAecInfo->sAecVBox.bLPt2_VSource; + if (psAecInfo->sAecVBox.bLPt2_Mix_VolO != 0xFF) + gsGlobalInfo.sAecInfo.sAecVBox.bLPt2_Mix_VolO + = psAecInfo->sAecVBox.bLPt2_Mix_VolO; + if (psAecInfo->sAecVBox.bLPt2_Mix_VolI != 0xFF) + gsGlobalInfo.sAecInfo.sAecVBox.bLPt2_Mix_VolI + = psAecInfo->sAecVBox.bLPt2_Mix_VolI; + if (psAecInfo->sAecVBox.bSrc3_Ctrl != 0xFF) + gsGlobalInfo.sAecInfo.sAecVBox.bSrc3_Ctrl + = psAecInfo->sAecVBox.bSrc3_Ctrl; + if (psAecInfo->sAecVBox.bSrc2_Fs != 0xFF) + gsGlobalInfo.sAecInfo.sAecVBox.bSrc2_Fs + = psAecInfo->sAecVBox.bSrc2_Fs; + if (psAecInfo->sAecVBox.bSrc2_Thru != 0xFF) + gsGlobalInfo.sAecInfo.sAecVBox.bSrc2_Thru + = psAecInfo->sAecVBox.bSrc2_Thru; + if (psAecInfo->sAecVBox.bSrc3_Fs != 0xFF) + gsGlobalInfo.sAecInfo.sAecVBox.bSrc3_Fs + = psAecInfo->sAecVBox.bSrc3_Fs; + if (psAecInfo->sAecVBox.bSrc3_Thru != 0xFF) + gsGlobalInfo.sAecInfo.sAecVBox.bSrc3_Thru + = psAecInfo->sAecVBox.bSrc3_Thru; + if (psAecInfo->sAecVBox.sAecCDspDbg.bJtagOn != 0xFF) + gsGlobalInfo.sAecInfo.sAecVBox.sAecCDspDbg.bJtagOn + = psAecInfo->sAecVBox.sAecCDspDbg.bJtagOn; + } + gsGlobalInfo.sAecInfo.sAecVBox.sAecCDspA + = psAecInfo->sAecVBox.sAecCDspA; + gsGlobalInfo.sAecInfo.sAecVBox.sAecCDspB + = psAecInfo->sAecVBox.sAecCDspB; + gsGlobalInfo.sAecInfo.sAecVBox.sAecFDsp + = psAecInfo->sAecVBox.sAecFDsp; + + for (i = 0; i < MCDRV_AEC_OUTPUT_N; i++) { + if (psAecInfo->sOutput.bLpf_Pre_Thru[i] != 0xFF) { + gsGlobalInfo.sAecInfo.sOutput.bLpf_Pre_Thru[i] + = psAecInfo->sOutput.bLpf_Pre_Thru[i]; + gsGlobalInfo.sAecInfo.sOutput.bLpf_Post_Thru[i] + = psAecInfo->sOutput.bLpf_Post_Thru[i]; + gsGlobalInfo.sAecInfo.sOutput.bDcc_Sel[i] + = psAecInfo->sOutput.bDcc_Sel[i]; + gsGlobalInfo.sAecInfo.sOutput.bPow_Det_Lvl[i] + = psAecInfo->sOutput.bPow_Det_Lvl[i]; + gsGlobalInfo.sAecInfo.sOutput.bOsf_Sel[i] + = psAecInfo->sOutput.bOsf_Sel[i]; + gsGlobalInfo.sAecInfo.sOutput.bSys_Eq_Enb[i] + = psAecInfo->sOutput.bSys_Eq_Enb[i]; + gsGlobalInfo.sAecInfo.sOutput.bSys_Eq_Coef_A0[i][0] + = psAecInfo->sOutput.bSys_Eq_Coef_A0[i][0]; + gsGlobalInfo.sAecInfo.sOutput.bSys_Eq_Coef_A0[i][1] + = psAecInfo->sOutput.bSys_Eq_Coef_A0[i][1]; + gsGlobalInfo.sAecInfo.sOutput.bSys_Eq_Coef_A0[i][2] + = psAecInfo->sOutput.bSys_Eq_Coef_A0[i][2]; + gsGlobalInfo.sAecInfo.sOutput.bSys_Eq_Coef_A1[i][0] + = psAecInfo->sOutput.bSys_Eq_Coef_A1[i][0]; + gsGlobalInfo.sAecInfo.sOutput.bSys_Eq_Coef_A1[i][1] + = psAecInfo->sOutput.bSys_Eq_Coef_A1[i][1]; + gsGlobalInfo.sAecInfo.sOutput.bSys_Eq_Coef_A1[i][2] + = psAecInfo->sOutput.bSys_Eq_Coef_A1[i][2]; + gsGlobalInfo.sAecInfo.sOutput.bSys_Eq_Coef_A2[i][0] + = psAecInfo->sOutput.bSys_Eq_Coef_A2[i][0]; + gsGlobalInfo.sAecInfo.sOutput.bSys_Eq_Coef_A2[i][1] + = psAecInfo->sOutput.bSys_Eq_Coef_A2[i][1]; + gsGlobalInfo.sAecInfo.sOutput.bSys_Eq_Coef_A2[i][2] + = psAecInfo->sOutput.bSys_Eq_Coef_A2[i][2]; + gsGlobalInfo.sAecInfo.sOutput.bSys_Eq_Coef_B1[i][0] + = psAecInfo->sOutput.bSys_Eq_Coef_B1[i][0]; + gsGlobalInfo.sAecInfo.sOutput.bSys_Eq_Coef_B1[i][1] + = psAecInfo->sOutput.bSys_Eq_Coef_B1[i][1]; + gsGlobalInfo.sAecInfo.sOutput.bSys_Eq_Coef_B1[i][2] + = psAecInfo->sOutput.bSys_Eq_Coef_B1[i][2]; + gsGlobalInfo.sAecInfo.sOutput.bSys_Eq_Coef_B2[i][0] + = psAecInfo->sOutput.bSys_Eq_Coef_B2[i][0]; + gsGlobalInfo.sAecInfo.sOutput.bSys_Eq_Coef_B2[i][1] + = psAecInfo->sOutput.bSys_Eq_Coef_B2[i][1]; + gsGlobalInfo.sAecInfo.sOutput.bSys_Eq_Coef_B2[i][2] + = psAecInfo->sOutput.bSys_Eq_Coef_B2[i][2]; + gsGlobalInfo.sAecInfo.sOutput.bClip_Md[i] + = psAecInfo->sOutput.bClip_Md[i]; + gsGlobalInfo.sAecInfo.sOutput.bClip_Att[i] + = psAecInfo->sOutput.bClip_Att[i]; + gsGlobalInfo.sAecInfo.sOutput.bClip_Rel[i] + = psAecInfo->sOutput.bClip_Rel[i]; + gsGlobalInfo.sAecInfo.sOutput.bClip_G[i] + = psAecInfo->sOutput.bClip_G[i]; + gsGlobalInfo.sAecInfo.sOutput.bOsf_Gain[i][0] + = psAecInfo->sOutput.bOsf_Gain[i][0]; + gsGlobalInfo.sAecInfo.sOutput.bOsf_Gain[i][1] + = psAecInfo->sOutput.bOsf_Gain[i][1]; + gsGlobalInfo.sAecInfo.sOutput.bDcl_OnOff[i] + = psAecInfo->sOutput.bDcl_OnOff[i]; + gsGlobalInfo.sAecInfo.sOutput.bDcl_Gain[i] + = psAecInfo->sOutput.bDcl_Gain[i]; + gsGlobalInfo.sAecInfo.sOutput.bDcl_Limit[i][0] + = psAecInfo->sOutput.bDcl_Limit[i][0]; + gsGlobalInfo.sAecInfo.sOutput.bDcl_Limit[i][1] + = psAecInfo->sOutput.bDcl_Limit[i][1]; + gsGlobalInfo.sAecInfo.sOutput.bRandom_Dither_OnOff[i] + = psAecInfo->sOutput.bRandom_Dither_OnOff[i]; + gsGlobalInfo.sAecInfo.sOutput.bRandom_Dither_Level[i] + = psAecInfo->sOutput.bRandom_Dither_Level[i]; + gsGlobalInfo.sAecInfo.sOutput.bRandom_Dither_POS[i] + = psAecInfo->sOutput.bRandom_Dither_POS[i]; + gsGlobalInfo.sAecInfo.sOutput.bDc_Dither_OnOff[i] + = psAecInfo->sOutput.bDc_Dither_OnOff[i]; + gsGlobalInfo.sAecInfo.sOutput.bDc_Dither_Level[i] + = psAecInfo->sOutput.bDc_Dither_Level[i]; + gsGlobalInfo.sAecInfo.sOutput.bDither_Type[i] + = psAecInfo->sOutput.bDither_Type[i]; + gsGlobalInfo.sAecInfo.sOutput.bDng_On[i] + = psAecInfo->sOutput.bDng_On[i]; + gsGlobalInfo.sAecInfo.sOutput.bDng_Zero[i] + = psAecInfo->sOutput.bDng_Zero[i]; + gsGlobalInfo.sAecInfo.sOutput.bDng_Time[i] + = psAecInfo->sOutput.bDng_Time[i]; + gsGlobalInfo.sAecInfo.sOutput.bDng_Fw[i] + = psAecInfo->sOutput.bDng_Fw[i]; + gsGlobalInfo.sAecInfo.sOutput.bDng_Target[i] + = psAecInfo->sOutput.bDng_Target[i]; + gsGlobalInfo.sAecInfo.sOutput.bDng_Target_LineOut[i] + = psAecInfo->sOutput.bDng_Target_LineOut[i]; + } + if (psAecInfo->sOutput.sSysEqEx[i].bEnable == 0) + continue; + gsGlobalInfo.sAecInfo.sOutput.sSysEqEx[i].sBand[0].bCoef_A0[0] + = psAecInfo->sOutput.sSysEqEx[i].sBand[0].bCoef_A0[0]; + gsGlobalInfo.sAecInfo.sOutput.sSysEqEx[i].sBand[0].bCoef_A0[1] + = psAecInfo->sOutput.sSysEqEx[i].sBand[0].bCoef_A0[1]; + gsGlobalInfo.sAecInfo.sOutput.sSysEqEx[i].sBand[0].bCoef_A0[2] + = psAecInfo->sOutput.sSysEqEx[i].sBand[0].bCoef_A0[2]; + gsGlobalInfo.sAecInfo.sOutput.sSysEqEx[i].sBand[0].bCoef_A1[0] + = psAecInfo->sOutput.sSysEqEx[i].sBand[0].bCoef_A1[0]; + gsGlobalInfo.sAecInfo.sOutput.sSysEqEx[i].sBand[0].bCoef_A1[1] + = psAecInfo->sOutput.sSysEqEx[i].sBand[0].bCoef_A1[1]; + gsGlobalInfo.sAecInfo.sOutput.sSysEqEx[i].sBand[0].bCoef_A1[2] + = psAecInfo->sOutput.sSysEqEx[i].sBand[0].bCoef_A1[2]; + gsGlobalInfo.sAecInfo.sOutput.sSysEqEx[i].sBand[0].bCoef_A2[0] + = psAecInfo->sOutput.sSysEqEx[i].sBand[0].bCoef_A2[0]; + gsGlobalInfo.sAecInfo.sOutput.sSysEqEx[i].sBand[0].bCoef_A2[1] + = psAecInfo->sOutput.sSysEqEx[i].sBand[0].bCoef_A2[1]; + gsGlobalInfo.sAecInfo.sOutput.sSysEqEx[i].sBand[0].bCoef_A2[2] + = psAecInfo->sOutput.sSysEqEx[i].sBand[0].bCoef_A2[2]; + gsGlobalInfo.sAecInfo.sOutput.sSysEqEx[i].sBand[0].bCoef_B1[0] + = psAecInfo->sOutput.sSysEqEx[i].sBand[0].bCoef_B1[0]; + gsGlobalInfo.sAecInfo.sOutput.sSysEqEx[i].sBand[0].bCoef_B1[1] + = psAecInfo->sOutput.sSysEqEx[i].sBand[0].bCoef_B1[1]; + gsGlobalInfo.sAecInfo.sOutput.sSysEqEx[i].sBand[0].bCoef_B1[2] + = psAecInfo->sOutput.sSysEqEx[i].sBand[0].bCoef_B1[2]; + gsGlobalInfo.sAecInfo.sOutput.sSysEqEx[i].sBand[0].bCoef_B2[0] + = psAecInfo->sOutput.sSysEqEx[i].sBand[0].bCoef_B2[0]; + gsGlobalInfo.sAecInfo.sOutput.sSysEqEx[i].sBand[0].bCoef_B2[1] + = psAecInfo->sOutput.sSysEqEx[i].sBand[0].bCoef_B2[1]; + gsGlobalInfo.sAecInfo.sOutput.sSysEqEx[i].sBand[0].bCoef_B2[2] + = psAecInfo->sOutput.sSysEqEx[i].sBand[0].bCoef_B2[2]; + gsGlobalInfo.sAecInfo.sOutput.sSysEqEx[i].sBand[1].bCoef_A0[0] + = psAecInfo->sOutput.sSysEqEx[i].sBand[1].bCoef_A0[0]; + gsGlobalInfo.sAecInfo.sOutput.sSysEqEx[i].sBand[1].bCoef_A0[1] + = psAecInfo->sOutput.sSysEqEx[i].sBand[1].bCoef_A0[1]; + gsGlobalInfo.sAecInfo.sOutput.sSysEqEx[i].sBand[1].bCoef_A0[2] + = psAecInfo->sOutput.sSysEqEx[i].sBand[1].bCoef_A0[2]; + gsGlobalInfo.sAecInfo.sOutput.sSysEqEx[i].sBand[1].bCoef_A1[0] + = psAecInfo->sOutput.sSysEqEx[i].sBand[1].bCoef_A1[0]; + gsGlobalInfo.sAecInfo.sOutput.sSysEqEx[i].sBand[1].bCoef_A1[1] + = psAecInfo->sOutput.sSysEqEx[i].sBand[1].bCoef_A1[1]; + gsGlobalInfo.sAecInfo.sOutput.sSysEqEx[i].sBand[1].bCoef_A1[2] + = psAecInfo->sOutput.sSysEqEx[i].sBand[1].bCoef_A1[2]; + gsGlobalInfo.sAecInfo.sOutput.sSysEqEx[i].sBand[1].bCoef_A2[0] + = psAecInfo->sOutput.sSysEqEx[i].sBand[1].bCoef_A2[0]; + gsGlobalInfo.sAecInfo.sOutput.sSysEqEx[i].sBand[1].bCoef_A2[1] + = psAecInfo->sOutput.sSysEqEx[i].sBand[1].bCoef_A2[1]; + gsGlobalInfo.sAecInfo.sOutput.sSysEqEx[i].sBand[1].bCoef_A2[2] + = psAecInfo->sOutput.sSysEqEx[i].sBand[1].bCoef_A2[2]; + gsGlobalInfo.sAecInfo.sOutput.sSysEqEx[i].sBand[1].bCoef_B1[0] + = psAecInfo->sOutput.sSysEqEx[i].sBand[1].bCoef_B1[0]; + gsGlobalInfo.sAecInfo.sOutput.sSysEqEx[i].sBand[1].bCoef_B1[1] + = psAecInfo->sOutput.sSysEqEx[i].sBand[1].bCoef_B1[1]; + gsGlobalInfo.sAecInfo.sOutput.sSysEqEx[i].sBand[1].bCoef_B1[2] + = psAecInfo->sOutput.sSysEqEx[i].sBand[1].bCoef_B1[2]; + gsGlobalInfo.sAecInfo.sOutput.sSysEqEx[i].sBand[1].bCoef_B2[0] + = psAecInfo->sOutput.sSysEqEx[i].sBand[1].bCoef_B2[0]; + gsGlobalInfo.sAecInfo.sOutput.sSysEqEx[i].sBand[1].bCoef_B2[1] + = psAecInfo->sOutput.sSysEqEx[i].sBand[1].bCoef_B2[1]; + gsGlobalInfo.sAecInfo.sOutput.sSysEqEx[i].sBand[1].bCoef_B2[2] + = psAecInfo->sOutput.sSysEqEx[i].sBand[1].bCoef_B2[2]; + } + gsGlobalInfo.sAecInfo.sOutput.bSig_Det_Lvl + = psAecInfo->sOutput.bSig_Det_Lvl; + gsGlobalInfo.sAecInfo.sOutput.bDng_Attack + = psAecInfo->sOutput.bDng_Attack; + gsGlobalInfo.sAecInfo.sOutput.bDng_Release + = psAecInfo->sOutput.bDng_Release; + gsGlobalInfo.sAecInfo.sOutput.bDng_Target_Rc + = psAecInfo->sOutput.bDng_Target_Rc; + + for (i = 0; i < MCDRV_AEC_INPUT_N; i++) { + if (psAecInfo->sInput.bDsf32_L_Type[i] != 0xFF) { + gsGlobalInfo.sAecInfo.sInput.bDsf32_L_Type[i] + = psAecInfo->sInput.bDsf32_L_Type[i]; + gsGlobalInfo.sAecInfo.sInput.bDsf32_R_Type[i] + = psAecInfo->sInput.bDsf32_R_Type[i]; + gsGlobalInfo.sAecInfo.sInput.bDsf4_Sel[i] + = psAecInfo->sInput.bDsf4_Sel[i]; + gsGlobalInfo.sAecInfo.sInput.bDcc_Sel[i] + = psAecInfo->sInput.bDcc_Sel[i]; + gsGlobalInfo.sAecInfo.sInput.bDng_On[i] + = psAecInfo->sInput.bDng_On[i]; + gsGlobalInfo.sAecInfo.sInput.bDng_Att[i] + = psAecInfo->sInput.bDng_Att[i]; + gsGlobalInfo.sAecInfo.sInput.bDng_Rel[i] + = psAecInfo->sInput.bDng_Rel[i]; + gsGlobalInfo.sAecInfo.sInput.bDng_Fw[i] + = psAecInfo->sInput.bDng_Fw[i]; + gsGlobalInfo.sAecInfo.sInput.bDng_Tim[i] + = psAecInfo->sInput.bDng_Tim[i]; + gsGlobalInfo.sAecInfo.sInput.bDng_Zero[i][0] + = psAecInfo->sInput.bDng_Zero[i][0]; + gsGlobalInfo.sAecInfo.sInput.bDng_Zero[i][1] + = psAecInfo->sInput.bDng_Zero[i][1]; + gsGlobalInfo.sAecInfo.sInput.bDng_Tgt[i][0] + = psAecInfo->sInput.bDng_Tgt[i][0]; + gsGlobalInfo.sAecInfo.sInput.bDng_Tgt[i][1] + = psAecInfo->sInput.bDng_Tgt[i][1]; + gsGlobalInfo.sAecInfo.sInput.bDepop_Att[i] + = psAecInfo->sInput.bDepop_Att[i]; + gsGlobalInfo.sAecInfo.sInput.bDepop_Wait[i] + = psAecInfo->sInput.bDepop_Wait[i]; + } + } + gsGlobalInfo.sAecInfo.sInput.bRef_Sel = psAecInfo->sInput.bRef_Sel; + + if (psAecInfo->sPdm.bMode != 0xFF) + gsGlobalInfo.sAecInfo.sPdm = psAecInfo->sPdm; + + gsGlobalInfo.sAecInfo.sE2.bEnable + = psAecInfo->sE2.bEnable; + if (psAecInfo->sE2.bEnable != 0) { + if (psAecInfo->sE2.bE2_Da_Sel != 4) + gsGlobalInfo.sAecInfo.sE2.bE2_Da_Sel + = psAecInfo->sE2.bE2_Da_Sel; + if (psAecInfo->sE2.bE2_Ad_Sel != 8) + gsGlobalInfo.sAecInfo.sE2.bE2_Ad_Sel + = psAecInfo->sE2.bE2_Ad_Sel; + if (psAecInfo->sE2.bE2OnOff != 2) + gsGlobalInfo.sAecInfo.sE2.bE2OnOff + = psAecInfo->sE2.bE2OnOff; + } + gsGlobalInfo.sAecInfo.sE2.sE2Config + = psAecInfo->sE2.sE2Config; + + if (psAecInfo->sAdj.bHold != 0xFF) + gsGlobalInfo.sAecInfo.sAdj + = psAecInfo->sAdj; + + if (psAecInfo->sEDspMisc.bI2SOut_Enb != 0xFF) + gsGlobalInfo.sAecInfo.sEDspMisc + = psAecInfo->sEDspMisc; + + if (psAecInfo->sControl.bCommand == 0xFF) { + gsGlobalInfo.sAecInfo.sControl.bCommand = 0; + gsGlobalInfo.sAecInfo.sControl.bParam[0] = 0; + gsGlobalInfo.sAecInfo.sControl.bParam[1] = 0; + gsGlobalInfo.sAecInfo.sControl.bParam[2] = 0; + gsGlobalInfo.sAecInfo.sControl.bParam[3] = 0; + } else { + gsGlobalInfo.sAecInfo.sControl + = psAecInfo->sControl; + } + + if (gsGlobalInfo.sAecInfo.sAecConfig.bFDspLocate == 0) + gsGlobalInfo.sAecInfo.sAecVBox.bFDspOnOff = 0; + else + gsGlobalInfo.sAecInfo.sAecAudioengine.bFDspOnOff = 0; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McResCtrl_SetAecInfo", 0); +#endif +} + +/**************************************************************************** + * McResCtrl_ReplaceAecInfo + * + * Description: + * Replace AEC info. + * Arguments: + * psAecInfo pointer to MCDRV_AEC_INFO struct + * Return: + * none + * + ****************************************************************************/ +void McResCtrl_ReplaceAecInfo( + const struct MCDRV_AEC_INFO *psAecInfo +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McResCtrl_ReplaceAecInfo"); +#endif + + + gsGlobalInfo.sAecInfo = *psAecInfo; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McResCtrl_ReplaceAecInfo", 0); +#endif +} + +/**************************************************************************** + * McResCtrl_GetAecInfo + * + * Description: + * Get AEC info. + * Arguments: + * psAecInfo pointer to MCDRV_AEC_INFO struct + * Return: + * none + * + ****************************************************************************/ +void McResCtrl_GetAecInfo( + struct MCDRV_AEC_INFO *psAecInfo +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McResCtrl_GetAecInfo"); +#endif + + + *psAecInfo = gsGlobalInfo.sAecInfo; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McResCtrl_GetAec", 0); +#endif +} + +/**************************************************************************** + * McResCtrl_SetDSPCBFunc + * + * Description: + * Set DSP callback function. + * Arguments: + * pcbfunc pointer to callback function + * Return: + * none + * + ****************************************************************************/ +void McResCtrl_SetDSPCBFunc( + SINT32 (*pcbfunc)(SINT32, UINT32, UINT32) +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McResCtrl_SetDSPCBFunc"); +#endif + gsGlobalInfo.pcbfunc = pcbfunc; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McResCtrl_SetDSPCBFunc", 0); +#endif +} + +/**************************************************************************** + * McResCtrl_GetDSPCBFunc + * + * Description: + * Get DSP callback function. + * Arguments: + * pcbfunc pointer to callback function + * Return: + * none + * + ****************************************************************************/ +void McResCtrl_GetDSPCBFunc( + SINT32 (**pcbfunc)(SINT32, UINT32, UINT32) +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McResCtrl_GetDSPCBFunc"); +#endif + *pcbfunc = gsGlobalInfo.pcbfunc; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McResCtrl_GetDSPCBFunc", 0); +#endif +} + +/**************************************************************************** + * McResCtrl_SetGPMode + * + * Description: + * Set GP mode. + * Arguments: + * psGpMode GP mode + * Return: + * none + * + ****************************************************************************/ +void McResCtrl_SetGPMode( + const struct MCDRV_GP_MODE *psGpMode +) +{ + UINT8 bPad; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McResCtrl_SetGPMode"); +#endif + + + for (bPad = 0; bPad < 3; bPad++) { + if ((psGpMode->abGpDdr[bPad] == MCDRV_GPDDR_IN) + || (psGpMode->abGpDdr[bPad] == MCDRV_GPDDR_OUT)) { + gsGlobalInfo.sGpMode.abGpDdr[bPad] + = psGpMode->abGpDdr[bPad]; + if (psGpMode->abGpDdr[bPad] == MCDRV_GPDDR_IN) + gsGlobalInfo.abGpPad[bPad] + = 0; + } + if ((psGpMode->abGpHost[bPad] == MCDRV_GPHOST_CPU) + || (psGpMode->abGpHost[bPad] == MCDRV_GPHOST_CDSP)) + gsGlobalInfo.sGpMode.abGpHost[bPad] + = psGpMode->abGpHost[bPad]; + + if ((psGpMode->abGpInvert[bPad] == MCDRV_GPINV_NORMAL) + || (psGpMode->abGpInvert[bPad] == MCDRV_GPINV_INVERT)) + gsGlobalInfo.sGpMode.abGpInvert[bPad] + = psGpMode->abGpInvert[bPad]; + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McResCtrl_SetGPMode", 0); +#endif +} + +/**************************************************************************** + * McResCtrl_GetGPMode + * + * Description: + * Get GP mode. + * Arguments: + * psGpMode GP mode + * Return: + * none + * + ****************************************************************************/ +void McResCtrl_GetGPMode( + struct MCDRV_GP_MODE *psGpMode +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McResCtrl_GetGPMode"); +#endif + + *psGpMode = gsGlobalInfo.sGpMode; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McResCtrl_GetGPMode", 0); +#endif +} + +/**************************************************************************** + * McResCtrl_SetGPMask + * + * Description: + * Set GP mask. + * Arguments: + * bMask GP mask + * dPadNo PAD Number + * Return: + * none + * + ****************************************************************************/ +void McResCtrl_SetGPMask( + UINT8 bMask, + UINT32 dPadNo +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McResCtrl_SetGPMask"); +#endif + + gsGlobalInfo.abGpMask[dPadNo] = bMask; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McResCtrl_SetGPMask", 0); +#endif +} + +/**************************************************************************** + * McResCtrl_GetGPMask + * + * Description: + * Get GP mask. + * Arguments: + * dPadNo PAD Number + * Return: + * GP mask + * + ****************************************************************************/ +UINT8 McResCtrl_GetGPMask( + UINT32 dPadNo +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + SINT32 sdRet = gsGlobalInfo.abGpMask[dPadNo]; + McDebugLog_FuncIn("McResCtrl_GetGPMask"); + McDebugLog_FuncOut("McResCtrl_GetGPMask", &sdRet); +#endif + return gsGlobalInfo.abGpMask[dPadNo]; +} + +/**************************************************************************** + * McResCtrl_SetGPPad + * + * Description: + * Set GP pad. + * Arguments: + * bPad GP pad value + * dPadNo PAD Number + * Return: + * none + * + ****************************************************************************/ +void McResCtrl_SetGPPad( + UINT8 bPad, + UINT32 dPadNo +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McResCtrl_SetGPPad"); +#endif + + gsGlobalInfo.abGpPad[dPadNo] = bPad; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McResCtrl_SetGPPad", 0); +#endif +} + +/**************************************************************************** + * McResCtrl_GetGPPad + * + * Description: + * Get GP pad value. + * Arguments: + * dPadNo PAD Number + * Return: + * GP pad value + * + ****************************************************************************/ +UINT8 McResCtrl_GetGPPad( + UINT32 dPadNo +) +{ + UINT8 bRet; + +#if (MCDRV_DEBUG_LEVEL >= 4) + SINT32 sdRet; + McDebugLog_FuncIn("McResCtrl_GetGPPad"); +#endif + + bRet = gsGlobalInfo.abGpPad[dPadNo]; + +#if (MCDRV_DEBUG_LEVEL >= 4) + sdRet = bRet; + McDebugLog_FuncOut("McResCtrl_GetGPPad", &sdRet); +#endif + return bRet; +} + +/**************************************************************************** + * McResCtrl_SetClkSel + * + * Description: + * Set CLK_SEL. + * Arguments: + * bClkSel CLK_SEL + * Return: + * none + * + ****************************************************************************/ +void McResCtrl_SetClkSel( + UINT8 bClkSel +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McResCtrl_SetClkSel"); +#endif + + gsGlobalInfo.bClkSel = bClkSel; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McResCtrl_SetClkSel", 0); +#endif +} +/**************************************************************************** + * McResCtrl_GetClkSel + * + * Description: + * Get CLK_SEL. + * Arguments: + * none + * Return: + * CLK_SEL + * + ****************************************************************************/ +UINT8 McResCtrl_GetClkSel( + void +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + SINT32 sdRet; + McDebugLog_FuncIn("McResCtrl_GetClkSel"); +#endif + +#if (MCDRV_DEBUG_LEVEL >= 4) + sdRet = gsGlobalInfo.bClkSel; + McDebugLog_FuncOut("McResCtrl_SetClkSel", &sdRet); +#endif + return gsGlobalInfo.bClkSel; +} +/**************************************************************************** + * McResCtrl_SetEClkSel + * + * Description: + * Set ECLK_SEL. + * Arguments: + * bEClkSel ECLK_SEL + * Return: + * none + * + ****************************************************************************/ +void McResCtrl_SetEClkSel( + UINT8 bEClkSel +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McResCtrl_SetEClkSel"); +#endif + + gsGlobalInfo.bEClkSel = bEClkSel; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McResCtrl_SetEClkSel", 0); +#endif +} +/**************************************************************************** + * McResCtrl_GetEClkSel + * + * Description: + * Get ECLK_SEL. + * Arguments: + * none + * Return: + * ECLK_SEL + * + ****************************************************************************/ +UINT8 McResCtrl_GetEClkSel( + void +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + SINT32 sdRet; + McDebugLog_FuncIn("McResCtrl_GetEClkSel"); +#endif + +#if (MCDRV_DEBUG_LEVEL >= 4) + sdRet = gsGlobalInfo.bEClkSel; + McDebugLog_FuncOut("McResCtrl_GetEClkSel", &sdRet); +#endif + return gsGlobalInfo.bEClkSel; +} + +/**************************************************************************** + * McResCtrl_SetCClkSel + * + * Description: + * Set CDSP_DIVR. + * Arguments: + * bCClkSel CDSP_DIVR + * Return: + * none + * + ****************************************************************************/ +void McResCtrl_SetCClkSel( + UINT8 bCClkSel +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McResCtrl_SetCClkSel"); +#endif + + gsGlobalInfo.bCClkSel = bCClkSel; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McResCtrl_SetCClkSel", 0); +#endif +} +/**************************************************************************** + * McResCtrl_GetCClkSel + * + * Description: + * Get CDSP_DIVR. + * Arguments: + * none + * Return: + * CDSP_DIVR + * + ****************************************************************************/ +UINT8 McResCtrl_GetCClkSel( + void +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + SINT32 sdRet; + McDebugLog_FuncIn("McResCtrl_GetCClkSel"); +#endif + +#if (MCDRV_DEBUG_LEVEL >= 4) + sdRet = gsGlobalInfo.bCClkSel; + McDebugLog_FuncOut("McResCtrl_GetCClkSel", &sdRet); +#endif + return gsGlobalInfo.bCClkSel; +} +/**************************************************************************** + * McResCtrl_SetFClkSel + * + * Description: + * Set FDSP_DIVR. + * Arguments: + * bFClkSel FDSP_DIVR + * Return: + * none + * + ****************************************************************************/ +void McResCtrl_SetFClkSel( + UINT8 bFClkSel +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McResCtrl_SetFClkSel"); +#endif + + gsGlobalInfo.bFClkSel = bFClkSel; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McResCtrl_SetFClkSel", 0); +#endif +} +/**************************************************************************** + * McResCtrl_GetFClkSel + * + * Description: + * Get FDSP_DIVR. + * Arguments: + * none + * Return: + * FDSP_DIVR + * + ****************************************************************************/ +UINT8 McResCtrl_GetFClkSel( + void +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + SINT32 sdRet; + McDebugLog_FuncIn("McResCtrl_GetFClkSel"); +#endif + +#if (MCDRV_DEBUG_LEVEL >= 4) + sdRet = gsGlobalInfo.bFClkSel; + McDebugLog_FuncOut("McResCtrl_GetFClkSel", &sdRet); +#endif + return gsGlobalInfo.bFClkSel; +} + + +/**************************************************************************** + * McResCtrl_SetPlugDetDB + * + * Description: + * Set PlugDetDB. + * Arguments: + * bPlugDetDB PlugDetDB + * Return: + * none + * + ****************************************************************************/ +void McResCtrl_SetPlugDetDB( + UINT8 bPlugDetDB +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McResCtrl_SetPlugDetDB"); +#endif + + gsGlobalInfo.bPlugDetDB = bPlugDetDB; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McResCtrl_SetPlugDetDB", 0); +#endif +} +/**************************************************************************** + * McResCtrl_GetPlugDetDB + * + * Description: + * Get bPlugDetDB. + * Arguments: + * none + * Return: + * bPlugDetDB + * + ****************************************************************************/ +UINT8 McResCtrl_GetPlugDetDB( + void +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + SINT32 sdRet; + McDebugLog_FuncIn("McResCtrl_GetPlugDetDB"); +#endif + +#if (MCDRV_DEBUG_LEVEL >= 4) + sdRet = gsGlobalInfo.bPlugDetDB; + McDebugLog_FuncOut("McResCtrl_GetPlugDetDB", &sdRet); +#endif + return gsGlobalInfo.bPlugDetDB; +} + + +/**************************************************************************** + * McResCtrl_GetVolReg + * + * Description: + * Get value of volume registers. + * Arguments: + * psVolInfo volume information + * Return: + * none + * + ****************************************************************************/ +void McResCtrl_GetVolReg( + struct MCDRV_VOL_INFO *psVolInfo +) +{ + int iSrc; + UINT8 bCh; + enum MCDRV_DST_CH abDSTCh[] = { + eMCDRV_DST_CH0, eMCDRV_DST_CH1}; + SINT16 aswD_DpathDa[DPATH_VOL_CHANNELS]; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McResCtrl_GetVolReg"); +#endif + + + *psVolInfo = gsGlobalInfo.sVolInfo; + aswD_DpathDa[0] = gsGlobalInfo.sVolInfo.aswD_DpathDa[0]; + aswD_DpathDa[1] = gsGlobalInfo.sVolInfo.aswD_DpathDa[1]; + + if (McResCtrl_IsD1SrcUsed(MCDRV_D1SRC_MUSICIN_ON) == 0) { + psVolInfo->aswD_MusicIn[0] = MCDRV_REG_MUTE; + psVolInfo->aswD_MusicIn[1] = MCDRV_REG_MUTE; + } else { + psVolInfo->aswD_MusicIn[0] + = McResCtrl_GetDigitalVolReg(psVolInfo->aswD_MusicIn[0]); + psVolInfo->aswD_MusicIn[1] + = McResCtrl_GetDigitalVolReg(psVolInfo->aswD_MusicIn[1]); + } + if (McResCtrl_IsD1SrcUsed(MCDRV_D1SRC_EXTIN_ON) == 0) { + psVolInfo->aswD_ExtIn[0] = MCDRV_REG_MUTE; + psVolInfo->aswD_ExtIn[1] = MCDRV_REG_MUTE; + } else { + psVolInfo->aswD_ExtIn[0] + = McResCtrl_GetDigitalVolReg(psVolInfo->aswD_ExtIn[0]); + psVolInfo->aswD_ExtIn[1] + = McResCtrl_GetDigitalVolReg(psVolInfo->aswD_ExtIn[1]); + } + if (McResCtrl_IsD1SrcUsed(MCDRV_D1SRC_VBOXOUT_ON) == 0) { + psVolInfo->aswD_VoiceIn[0] = MCDRV_REG_MUTE; + psVolInfo->aswD_VoiceIn[1] = MCDRV_REG_MUTE; + } else { + psVolInfo->aswD_VoiceIn[0] + = McResCtrl_GetDigitalVolReg(psVolInfo->aswD_VoiceIn[0]); + psVolInfo->aswD_VoiceIn[1] + = McResCtrl_GetDigitalVolReg(psVolInfo->aswD_VoiceIn[1]); + } + + if (McResCtrl_IsD1SrcUsed(MCDRV_D1SRC_VBOXREFOUT_ON) == 0) { + psVolInfo->aswD_RefIn[0] = MCDRV_REG_MUTE; + psVolInfo->aswD_RefIn[1] = MCDRV_REG_MUTE; + } else { + psVolInfo->aswD_RefIn[0] + = McResCtrl_GetDigitalVolReg(psVolInfo->aswD_RefIn[0]); + psVolInfo->aswD_RefIn[1] + = McResCtrl_GetDigitalVolReg(psVolInfo->aswD_RefIn[1]); + } + + if (McResCtrl_IsD1SrcUsed(MCDRV_D1SRC_ADIF0_ON) == 0) { + psVolInfo->aswD_Adif0In[0] = MCDRV_REG_MUTE; + psVolInfo->aswD_Adif0In[1] = MCDRV_REG_MUTE; + } else { + psVolInfo->aswD_Adif0In[0] + = McResCtrl_GetDigitalVolReg(psVolInfo->aswD_Adif0In[0]); + psVolInfo->aswD_Adif0In[1] + = McResCtrl_GetDigitalVolReg(psVolInfo->aswD_Adif0In[1]); + } + + if (McResCtrl_IsD1SrcUsed(MCDRV_D1SRC_ADIF1_ON) == 0) { + psVolInfo->aswD_Adif1In[0] = MCDRV_REG_MUTE; + psVolInfo->aswD_Adif1In[1] = MCDRV_REG_MUTE; + } else { + psVolInfo->aswD_Adif1In[0] + = McResCtrl_GetDigitalVolReg(psVolInfo->aswD_Adif1In[0]); + psVolInfo->aswD_Adif1In[1] + = McResCtrl_GetDigitalVolReg(psVolInfo->aswD_Adif1In[1]); + } + + if (McResCtrl_IsD1SrcUsed(MCDRV_D1SRC_ADIF2_ON) == 0) { + psVolInfo->aswD_Adif2In[0] = MCDRV_REG_MUTE; + psVolInfo->aswD_Adif2In[1] = MCDRV_REG_MUTE; + } else { + psVolInfo->aswD_Adif2In[0] + = McResCtrl_GetDigitalVolReg(psVolInfo->aswD_Adif2In[0]); + psVolInfo->aswD_Adif2In[1] + = McResCtrl_GetDigitalVolReg(psVolInfo->aswD_Adif2In[1]); + } + + for (bCh = 0; bCh < GET_ARRAY_SIZE(abDSTCh); bCh++) { + if (McResCtrl_HasSrc(eMCDRV_DST_MUSICOUT, abDSTCh[bCh]) == 0) + psVolInfo->aswD_MusicOut[bCh] = MCDRV_REG_MUTE; + else + psVolInfo->aswD_MusicOut[bCh] = + McResCtrl_GetDigitalVolReg(psVolInfo->aswD_MusicOut[bCh]); + + if (McResCtrl_HasSrc(eMCDRV_DST_EXTOUT, abDSTCh[bCh]) == 0) + psVolInfo->aswD_ExtOut[bCh] = MCDRV_REG_MUTE; + else + psVolInfo->aswD_ExtOut[bCh] = + McResCtrl_GetDigitalVolReg(psVolInfo->aswD_ExtOut[bCh]); + } + + if (McResCtrl_HasSrc(eMCDRV_DST_VBOXMIXIN, eMCDRV_DST_CH0) == 0) + psVolInfo->aswD_VoiceOut[0] = MCDRV_REG_MUTE; + else + psVolInfo->aswD_VoiceOut[0] + = McResCtrl_GetDigitalVolReg(psVolInfo->aswD_VoiceOut[0]); + + if (McResCtrl_HasSrc(eMCDRV_DST_VBOXMIXIN, eMCDRV_DST_CH1) == 0) + psVolInfo->aswD_VoiceOut[1] = MCDRV_REG_MUTE; + else + psVolInfo->aswD_VoiceOut[1] + = McResCtrl_GetDigitalVolReg(psVolInfo->aswD_VoiceOut[1]); + + if (McResCtrl_HasSrc(eMCDRV_DST_VBOXMIXIN, eMCDRV_DST_CH2) == 0) + psVolInfo->aswD_RefOut[0] = MCDRV_REG_MUTE; + else + psVolInfo->aswD_RefOut[0] + = McResCtrl_GetDigitalVolReg(psVolInfo->aswD_RefOut[0]); + + if (McResCtrl_HasSrc(eMCDRV_DST_VBOXMIXIN, eMCDRV_DST_CH3) == 0) + psVolInfo->aswD_RefOut[1] = MCDRV_REG_MUTE; + else + psVolInfo->aswD_RefOut[1] + = McResCtrl_GetDigitalVolReg(psVolInfo->aswD_RefOut[1]); + + if (McResCtrl_IsD1SrcUsed(MCDRV_D1SRC_HIFIIN_ON) == 0) { + psVolInfo->aswD_DpathDa[0] = MCDRV_REG_MUTE; + psVolInfo->aswD_DpathDa[1] = MCDRV_REG_MUTE; + } + + iSrc = GetD1Source(gsGlobalInfo.sPathInfo.asDac0, eMCDRV_DST_CH0); + if ((iSrc & ~MCDRV_D1SRC_HIFIIN_ON) == 0) + psVolInfo->aswD_Dac0Out[0] = MCDRV_REG_MUTE; + else + psVolInfo->aswD_Dac0Out[0] + = McResCtrl_GetDigitalVolReg(psVolInfo->aswD_Dac0Out[0]); + if ((iSrc & MCDRV_D1SRC_HIFIIN_ON) != 0) + psVolInfo->aswD_DpathDa[0] + = McResCtrl_GetDigitalVolReg(aswD_DpathDa[0]); + + iSrc = GetD1Source(gsGlobalInfo.sPathInfo.asDac0, eMCDRV_DST_CH1); + if ((iSrc & ~MCDRV_D1SRC_HIFIIN_ON) == 0) + psVolInfo->aswD_Dac0Out[1] = MCDRV_REG_MUTE; + else + psVolInfo->aswD_Dac0Out[1] + = McResCtrl_GetDigitalVolReg(psVolInfo->aswD_Dac0Out[1]); + if ((iSrc & MCDRV_D1SRC_HIFIIN_ON) != 0) + psVolInfo->aswD_DpathDa[1] + = McResCtrl_GetDigitalVolReg(aswD_DpathDa[1]); + + iSrc = GetD1Source(gsGlobalInfo.sPathInfo.asDac1, eMCDRV_DST_CH0); + if ((iSrc & ~MCDRV_D1SRC_HIFIIN_ON) == 0) + psVolInfo->aswD_Dac1Out[0] = MCDRV_REG_MUTE; + else + psVolInfo->aswD_Dac1Out[0] + = McResCtrl_GetDigitalVolReg(psVolInfo->aswD_Dac1Out[0]); + if ((iSrc & MCDRV_D1SRC_HIFIIN_ON) != 0) + psVolInfo->aswD_DpathDa[0] + = McResCtrl_GetDigitalVolReg(aswD_DpathDa[0]); + + iSrc = GetD1Source(gsGlobalInfo.sPathInfo.asDac1, eMCDRV_DST_CH1); + if ((iSrc & ~MCDRV_D1SRC_HIFIIN_ON) == 0) + psVolInfo->aswD_Dac1Out[1] = MCDRV_REG_MUTE; + else + psVolInfo->aswD_Dac1Out[1] + = McResCtrl_GetDigitalVolReg(psVolInfo->aswD_Dac1Out[1]); + if ((iSrc & MCDRV_D1SRC_HIFIIN_ON) != 0) + psVolInfo->aswD_DpathDa[1] + = McResCtrl_GetDigitalVolReg(aswD_DpathDa[1]); + + iSrc = + GetD1Source(gsGlobalInfo.sPathInfo.asHifiOut, eMCDRV_DST_CH0); + if (iSrc == 0) { + psVolInfo->aswD_DpathAd[0] = MCDRV_REG_MUTE; + psVolInfo->aswD_DpathAd[1] = MCDRV_REG_MUTE; + } else { + if (((iSrc&(MCDRV_D2SRC_PDM0_L_ON|MCDRV_D2SRC_PDM0_R_ON)) != 0) + || ((iSrc&(MCDRV_D2SRC_PDM1_L_ON|MCDRV_D2SRC_PDM1_R_ON)) != 0) + ) { + psVolInfo->aswD_DpathAd[0] = + McResCtrl_GetDigitalVolReg(psVolInfo->aswD_DpathAd[0]); + psVolInfo->aswD_DpathAd[1] = + McResCtrl_GetDigitalVolReg(psVolInfo->aswD_DpathAd[1]); + } else { + if (((iSrc&MCDRV_D2SRC_ADC1_ON) != 0) + || + (McResCtrl_HasSrc(eMCDRV_DST_ADC0, eMCDRV_DST_CH0) + != 0)) + psVolInfo->aswD_DpathAd[0] = + McResCtrl_GetDigitalVolReg(psVolInfo->aswD_DpathAd[0]); + else + psVolInfo->aswD_DpathAd[0] = + MCDRV_REG_MUTE; + + if (((iSrc& + (MCDRV_D2SRC_ADC0_L_ON|MCDRV_D2SRC_ADC0_R_ON)) + != 0) + && + (McResCtrl_HasSrc(eMCDRV_DST_ADC0, eMCDRV_DST_CH1) + != 0)) + psVolInfo->aswD_DpathAd[1] = + McResCtrl_GetDigitalVolReg(psVolInfo->aswD_DpathAd[1]); + else + psVolInfo->aswD_DpathAd[1] = + MCDRV_REG_MUTE; + } + } + + if ((McResCtrl_IsASrcUsed(MCDRV_ASRC_LINEIN1_L_ON) != 0) + || (McResCtrl_IsASrcUsed(MCDRV_ASRC_LINEIN1_M_ON) != 0)) + psVolInfo->aswA_LineIn1[0] = + GetAnaInVolReg(gsGlobalInfo.sVolInfo.aswA_LineIn1[0]); + else + psVolInfo->aswA_LineIn1[0] = MCDRV_REG_MUTE; + if ((McResCtrl_IsASrcUsed(MCDRV_ASRC_LINEIN1_R_ON) != 0) + || (McResCtrl_IsASrcUsed(MCDRV_ASRC_LINEIN1_M_ON) != 0)) + psVolInfo->aswA_LineIn1[1] = + GetAnaInVolReg(gsGlobalInfo.sVolInfo.aswA_LineIn1[1]); + else + psVolInfo->aswA_LineIn1[1] = MCDRV_REG_MUTE; + if (McResCtrl_IsASrcUsed(MCDRV_ASRC_MIC1_ON) != 0) + psVolInfo->aswA_Mic1[0] = + GetAnaInVolReg(gsGlobalInfo.sVolInfo.aswA_Mic1[0]); + else + psVolInfo->aswA_Mic1[0] = MCDRV_REG_MUTE; + if (McResCtrl_IsASrcUsed(MCDRV_ASRC_MIC2_ON) != 0) + psVolInfo->aswA_Mic2[0] = + GetAnaInVolReg(gsGlobalInfo.sVolInfo.aswA_Mic2[0]); + else + psVolInfo->aswA_Mic2[0] = MCDRV_REG_MUTE; + if (McResCtrl_IsASrcUsed(MCDRV_ASRC_MIC3_ON) != 0) + psVolInfo->aswA_Mic3[0] = + GetAnaInVolReg(gsGlobalInfo.sVolInfo.aswA_Mic3[0]); + else + psVolInfo->aswA_Mic3[0] = MCDRV_REG_MUTE; + if (McResCtrl_IsASrcUsed(MCDRV_ASRC_MIC4_ON) != 0) + psVolInfo->aswA_Mic4[0] = + GetAnaInVolReg(gsGlobalInfo.sVolInfo.aswA_Mic4[0]); + else + psVolInfo->aswA_Mic4[0] = MCDRV_REG_MUTE; + + for (bCh = 0; bCh < GET_ARRAY_SIZE(abDSTCh); bCh++) { + if (McResCtrl_HasSrc(eMCDRV_DST_HP, abDSTCh[bCh]) == 0) + psVolInfo->aswA_Hp[bCh] = MCDRV_REG_MUTE; + else + psVolInfo->aswA_Hp[bCh] = + GetHpVolReg( + gsGlobalInfo.sVolInfo.aswA_Hp[bCh]); + + if (McResCtrl_HasSrc(eMCDRV_DST_SP, abDSTCh[bCh]) == 0) + psVolInfo->aswA_Sp[bCh] = MCDRV_REG_MUTE; + else + psVolInfo->aswA_Sp[bCh] = + GetSpVolReg( + gsGlobalInfo.sVolInfo.aswA_Sp[bCh]); + + if (McResCtrl_HasSrc(eMCDRV_DST_LOUT1, abDSTCh[bCh]) == 0) + psVolInfo->aswA_LineOut1[bCh] = MCDRV_REG_MUTE; + else + psVolInfo->aswA_LineOut1[bCh] = + GetLOutVolReg( + gsGlobalInfo.sVolInfo.aswA_LineOut1[bCh]); + + if (McResCtrl_HasSrc(eMCDRV_DST_LOUT2, abDSTCh[bCh]) == 0) + psVolInfo->aswA_LineOut2[bCh] = MCDRV_REG_MUTE; + else + psVolInfo->aswA_LineOut2[bCh] = + GetLOutVolReg( + gsGlobalInfo.sVolInfo.aswA_LineOut2[bCh]); + } + + if (McResCtrl_HasSrc(eMCDRV_DST_RCV, eMCDRV_DST_CH0) == 0) + psVolInfo->aswA_Rc[0] = MCDRV_REG_MUTE; + else + psVolInfo->aswA_Rc[0] = + GetAnaOutVolReg(gsGlobalInfo.sVolInfo.aswA_Rc[0]); + + psVolInfo->aswA_HpDet[0] = + GetAnaOutVolReg(gsGlobalInfo.sVolInfo.aswA_HpDet[0]); + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McResCtrl_GetVolReg", 0); +#endif +} + +/**************************************************************************** + * McResCtrl_GetDigitalVolReg + * + * Description: + * Get value of digital volume registers. + * Arguments: + * sdVol volume(dB value*256) + * Return: + * value of registers + * + ****************************************************************************/ +SINT16 McResCtrl_GetDigitalVolReg( + SINT32 sdVol +) +{ + SINT32 sdRet; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McResCtrl_GetDigitalVolReg"); +#endif + + if (sdVol < (-95*256)) + sdRet = 0; + else if (sdVol < 0L) + sdRet = 96L + (sdVol-128L)/256L; + else + sdRet = 96L + (sdVol+128L)/256L; + + if (sdRet > 114L) + sdRet = 114; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McResCtrl_GetDigitalVolReg", &sdRet); +#endif + + return (SINT16)sdRet; +} + + +/**************************************************************************** + * GetAnaInVolReg + * + * Description: + * Get update value of analog input volume registers. + * Arguments: + * swVol volume(dB value*256) + * Return: + * value of registers + * + ****************************************************************************/ +static SINT16 GetAnaInVolReg( + SINT16 swVol +) +{ + SINT16 swRet; + +#if (MCDRV_DEBUG_LEVEL >= 4) + SINT32 sdRet; + McDebugLog_FuncIn("GetAnaInVolReg"); +#endif + + if (swVol < (-30*256)) + swRet = 0; + else if (swVol < 0) + swRet = 0x21 + (swVol-128) / 256; + else if (swVol <= (21*256)) + swRet = 0x21 + (swVol+128) / 256; + else if (swVol < (6080)) /* 6080:23.75*256 */ + swRet = 0x36 + ((swVol+64) / 128 - (21*2)); + else + swRet = 0x3C + (swVol/256 - 23) / 2; + + if (swRet < 0) + swRet = 0; + else if (swRet > 0x3F) + swRet = 0x3F; + +#if (MCDRV_DEBUG_LEVEL >= 4) + sdRet = swRet; + McDebugLog_FuncOut("GetAnaInVolReg", &sdRet); +#endif + return swRet; +} + +/**************************************************************************** + * GetAnaOutVolReg + * + * Description: + * Get update value of analog output volume registers. + * Arguments: + * swVol volume(dB value*256) + * Return: + * value of registers + * + ****************************************************************************/ +static SINT16 GetAnaOutVolReg( + SINT16 swVol +) +{ + SINT16 swRet; + +#if (MCDRV_DEBUG_LEVEL >= 4) + SINT32 sdRet; + McDebugLog_FuncIn("GetAnaOutVolReg"); +#endif + + if (swVol < (-36*256)) + swRet = 0; + else if (swVol < (-4032)) /* -4032:-15.75*256 */ + swRet = 0x42 + (swVol-128) / 256 + 17; + else if (swVol < (-1504)) /* -1504:-5.875*256 */ + swRet = 0x57 + ((swVol-64) / 128 + 6*2); + else + swRet = 0x6F + ((swVol-32) / 64); + + if (swRet < 0) + swRet = 0; + else if (swRet > 0x6F) + swRet = 0x6F; + +#if (MCDRV_DEBUG_LEVEL >= 4) + sdRet = swRet; + McDebugLog_FuncOut("GetAnaOutVolReg", &sdRet); +#endif + return swRet; +} + +/**************************************************************************** + * GetSpVolReg + * + * Description: + * Get update value of analog output volume registers. + * Arguments: + * swVol volume(dB value*256) + * Return: + * value of registers + * + ****************************************************************************/ +static SINT16 GetSpVolReg( + SINT16 swVol +) +{ + SINT16 swRet; + +#if (MCDRV_DEBUG_LEVEL >= 4) + SINT32 sdRet; + McDebugLog_FuncIn("GetSpVolReg"); +#endif + + if (swVol < (-36*256)) + swRet = 0; + else if (swVol < (-4032)) /* -4032:-15.75*256 */ + swRet = 0x42 + (swVol-128) / 256 + 17; + else if (swVol < (-1504)) /* -1504:-5.875*256 */ + swRet = 0x57 + ((swVol-64) / 128 + 6*2); + else if (swVol < 32) + swRet = 0x6F + ((swVol-32) / 64); + else + swRet = 0x70 + ((swVol-32) / 64); + + if (swRet < 0) + swRet = 0; + else if (swRet > 0x7F) + swRet = 0x7F; + +#if (MCDRV_DEBUG_LEVEL >= 4) + sdRet = swRet; + McDebugLog_FuncOut("GetSpVolReg", &sdRet); +#endif + return swRet; +} + +/**************************************************************************** + * GetLOutVolReg + * + * Description: + * Get update value of analog output volume registers. + * Arguments: + * swVol volume(dB value*256) + * Return: + * value of registers + * + ****************************************************************************/ +static SINT16 GetLOutVolReg( + SINT16 swVol +) +{ + SINT16 swRet; + +#if (MCDRV_DEBUG_LEVEL >= 4) + SINT32 sdRet; + McDebugLog_FuncIn("GetLOutVolReg"); +#endif + + if (swVol < (-38*256)) + swRet = 0; + else if (swVol < -9344) /* -9344:-36.5*256 */ + swRet = 0x2E; + else if (swVol < -4032) /* -4032:-15.75*256 */ + swRet = 0x42 + (swVol-128) / 256 + 17; + else if (swVol < -1504) /* -1504:-5.875*256 */ + swRet = 0x57 + ((swVol-64) / 128 + 6*2); + else if (swVol < 32) + swRet = 0x6F + ((swVol-32) / 64); + else + swRet = 0x70 + ((swVol-32) / 64); + + if (swRet < 0) + swRet = 0; + else if (swRet > 0x77) + swRet = 0x77; + +#if (MCDRV_DEBUG_LEVEL >= 4) + sdRet = swRet; + McDebugLog_FuncOut("GetLOutVolReg", &sdRet); +#endif + return swRet; +} + +/**************************************************************************** + * GetHpVolReg + * + * Description: + * Get update value of analog Hp volume registers. + * Arguments: + * swVol volume(dB value*256) + * Return: + * value of registers + * + ****************************************************************************/ +static SINT16 GetHpVolReg( + SINT16 swVol +) +{ + SINT16 swRet; + +#if (MCDRV_DEBUG_LEVEL >= 4) + SINT32 sdRet; + McDebugLog_FuncIn("GetHpVolReg"); +#endif + + if (swVol < (-36*256)) + swRet = 0; + else if (swVol < (-4032)) /* -4032:-15.75*256 */ + swRet = 0x43 + (swVol-128) / 256 + 16; + else if (swVol < (-1504)) /* -1504:-5.875*256 */ + swRet = 0x43 + ((swVol-64) / 128 + 16*2); + else if (swVol < 0) + swRet = 0x57 + ((swVol-32) / 64 + 6*4); + else + swRet = 0x6F + ((swVol+32) / 64); + + if (swRet < 0) + swRet = 0; + else if (swRet > 0x7F) + swRet = 0x7F; + + + +#if (MCDRV_DEBUG_LEVEL >= 4) + sdRet = swRet; + McDebugLog_FuncOut("GetHpVolReg", &sdRet); +#endif + + return swRet; +} + +/**************************************************************************** + * McResCtrl_GetPowerInfo + * + * Description: + * Get power information. + * Arguments: + * psPowerInfo power information + * Return: + * none + * + ****************************************************************************/ +void McResCtrl_GetPowerInfo( + struct MCDRV_POWER_INFO *psPowerInfo +) +{ + UINT32 dHifiSrc; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McResCtrl_GetPowerInfo"); +#endif + + + psPowerInfo->bDigital = MCDRV_POWINFO_D_PLL_PD + | MCDRV_POWINFO_D_PE_CLK_PD + | MCDRV_POWINFO_D_PB_CLK_PD + | MCDRV_POWINFO_D_PM_CLK_PD + | MCDRV_POWINFO_D_PF_CLK_PD + | MCDRV_POWINFO_D_PC_CLK_PD; + + dHifiSrc = gsGlobalInfo.sPathInfo.asHifiOut[0].dSrcOnOff; + + if ((gsGlobalInfo.sAecInfo.sE2.bE2OnOff == 1) + || (McResCtrl_IsD2SrcUsed(MCDRV_D2SRC_ADC0_L_ON|MCDRV_D2SRC_ADC0_R_ON) + != 0) + || ((dHifiSrc & MCDRV_D1SRC_ADIF0_ON) != 0) + || (McResCtrl_IsD2SrcUsed(MCDRV_D2SRC_ADC1_ON) != 0) + || (McResCtrl_IsD2SrcUsed(MCDRV_D2SRC_PDM0_L_ON|MCDRV_D2SRC_PDM0_R_ON) + != 0) + || (McResCtrl_IsD2SrcUsed(MCDRV_D2SRC_PDM1_L_ON|MCDRV_D2SRC_PDM1_R_ON) + != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_DAC0, eMCDRV_DST_CH0) != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_DAC0, eMCDRV_DST_CH1) != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_DAC1, eMCDRV_DST_CH0) != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_DAC1, eMCDRV_DST_CH1) != 0)) { + psPowerInfo->bDigital &= (UINT8)~MCDRV_POWINFO_D_PE_CLK_PD; + psPowerInfo->bDigital &= (UINT8)~MCDRV_POWINFO_D_PM_CLK_PD; + psPowerInfo->bDigital &= (UINT8)~MCDRV_POWINFO_D_PLL_PD; + } + + if ((gsGlobalInfo.sAecInfo.sAecAudioengine.bAEOnOff == 1) + || (McResCtrl_IsD1SrcUsed(MCDRV_D1SRC_AE0_ON + |MCDRV_D1SRC_AE1_ON + |MCDRV_D1SRC_AE2_ON + |MCDRV_D1SRC_AE3_ON) != 0)) { + psPowerInfo->bDigital &= (UINT8)~MCDRV_POWINFO_D_PB_CLK_PD; + psPowerInfo->bDigital &= (UINT8)~MCDRV_POWINFO_D_PE_CLK_PD; + psPowerInfo->bDigital &= (UINT8)~MCDRV_POWINFO_D_PM_CLK_PD; + psPowerInfo->bDigital &= (UINT8)~MCDRV_POWINFO_D_PLL_PD; + } + + if ((gsGlobalInfo.sInitInfo.bPowerMode == MCDRV_POWMODE_CDSPDEBUG) + || (gsGlobalInfo.sAecInfo.sAecVBox.sAecCDspDbg.bJtagOn != 0) + || (gsGlobalInfo.sAecInfo.sAecVBox.bCDspFuncAOnOff != 0) + || (gsGlobalInfo.sAecInfo.sAecVBox.bCDspFuncBOnOff != 0)) { + psPowerInfo->bDigital &= (UINT8)~MCDRV_POWINFO_D_PC_CLK_PD; + psPowerInfo->bDigital &= (UINT8)~MCDRV_POWINFO_D_PE_CLK_PD; + psPowerInfo->bDigital &= (UINT8)~MCDRV_POWINFO_D_PM_CLK_PD; + psPowerInfo->bDigital &= (UINT8)~MCDRV_POWINFO_D_PLL_PD; + } + + if ((gsGlobalInfo.sAecInfo.sAecConfig.bFDspLocate == 0) + && (gsGlobalInfo.sAecInfo.sAecAudioengine.bFDspOnOff == 1)) { + psPowerInfo->bDigital &= (UINT8)~MCDRV_POWINFO_D_PE_CLK_PD; + psPowerInfo->bDigital &= (UINT8)~MCDRV_POWINFO_D_PF_CLK_PD; + psPowerInfo->bDigital &= (UINT8)~MCDRV_POWINFO_D_PM_CLK_PD; + psPowerInfo->bDigital &= (UINT8)~MCDRV_POWINFO_D_PLL_PD; + } + + if ((gsGlobalInfo.sAecInfo.sAecConfig.bFDspLocate != 0) + && (gsGlobalInfo.sAecInfo.sAecVBox.bFDspOnOff == 1)) { + psPowerInfo->bDigital &= (UINT8)~MCDRV_POWINFO_D_PE_CLK_PD; + psPowerInfo->bDigital &= (UINT8)~MCDRV_POWINFO_D_PF_CLK_PD; + psPowerInfo->bDigital &= (UINT8)~MCDRV_POWINFO_D_PM_CLK_PD; + psPowerInfo->bDigital &= (UINT8)~MCDRV_POWINFO_D_PLL_PD; + } + + if ((psPowerInfo->bDigital & MCDRV_POWINFO_D_PM_CLK_PD) != 0) { + if ((McResCtrl_IsD1SrcUsed(MCDRV_D1SRC_MUSICIN_ON) != 0) + || (McResCtrl_IsD1SrcUsed(MCDRV_D1SRC_EXTIN_ON) != 0) + || (McResCtrl_IsD1SrcUsed(MCDRV_D1SRC_VBOXOUT_ON) != 0) + || (McResCtrl_IsD1SrcUsed(MCDRV_D1SRC_VBOXREFOUT_ON) != 0) + || (McResCtrl_IsD2SrcUsed(MCDRV_D2SRC_VOICEIN_ON) != 0) + || (McResCtrl_IsD2SrcUsed(MCDRV_D2SRC_VBOXIOOUT_ON) != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_MUSICOUT, eMCDRV_DST_CH0) != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_MUSICOUT, eMCDRV_DST_CH1) != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_EXTOUT, eMCDRV_DST_CH0) != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_EXTOUT, eMCDRV_DST_CH1) != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_VBOXMIXIN, eMCDRV_DST_CH0) != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_VBOXMIXIN, eMCDRV_DST_CH1) != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_VBOXMIXIN, eMCDRV_DST_CH2) != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_VBOXMIXIN, eMCDRV_DST_CH3) != 0) + ) { + psPowerInfo->bDigital &= + (UINT8)~MCDRV_POWINFO_D_PE_CLK_PD; + psPowerInfo->bDigital &= + (UINT8)~MCDRV_POWINFO_D_PM_CLK_PD; + psPowerInfo->bDigital &= + (UINT8)~MCDRV_POWINFO_D_PLL_PD; + } + } + + /* Analog power */ + psPowerInfo->abAnalog[0] = MCI_AP_DEF; + psPowerInfo->abAnalog[1] = MCI_AP_DA0_DEF; + psPowerInfo->abAnalog[2] = MCI_AP_DA1_DEF; + psPowerInfo->abAnalog[3] = MCI_AP_MIC_DEF; + psPowerInfo->abAnalog[4] = MCI_AP_AD_DEF; + + if (McResCtrl_IsASrcUsed(MCDRV_ASRC_DAC0_L_ON) != 0) { + ; + psPowerInfo->abAnalog[1] &= (UINT8)~MCB_AP_DA0L; + } + if (McResCtrl_IsASrcUsed(MCDRV_ASRC_DAC0_R_ON) != 0) { + ; + psPowerInfo->abAnalog[1] &= (UINT8)~MCB_AP_DA0R; + } + + if (McResCtrl_HasSrc(eMCDRV_DST_HP, eMCDRV_DST_CH0) != 0) { + if (gsGlobalInfo.eAPMode == eMCDRV_APM_OFF) + psPowerInfo->abAnalog[0] &= (UINT8)~MCB_AP_CP; + psPowerInfo->abAnalog[1] &= (UINT8)~MCB_AP_HPL; + } + if (McResCtrl_HasSrc(eMCDRV_DST_HP, eMCDRV_DST_CH1) != 0) { + if (gsGlobalInfo.eAPMode == eMCDRV_APM_OFF) + psPowerInfo->abAnalog[0] &= (UINT8)~MCB_AP_CP; + psPowerInfo->abAnalog[1] &= (UINT8)~MCB_AP_HPR; + } + + if (McResCtrl_HasSrc(eMCDRV_DST_RCV, eMCDRV_DST_CH0) != 0) { + if (gsGlobalInfo.eAPMode == eMCDRV_APM_OFF) + psPowerInfo->abAnalog[0] &= (UINT8)~MCB_AP_CP; + psPowerInfo->abAnalog[1] &= (UINT8)~MCB_AP_RC; + } + + if (McResCtrl_HasSrc(eMCDRV_DST_LOUT1, eMCDRV_DST_CH0) != 0) { + if (gsGlobalInfo.eAPMode == eMCDRV_APM_OFF) + psPowerInfo->abAnalog[0] &= (UINT8)~MCB_AP_CP; + psPowerInfo->abAnalog[1] &= (UINT8)~MCB_AP_LO1L; + } + if (McResCtrl_HasSrc(eMCDRV_DST_LOUT1, eMCDRV_DST_CH1) != 0) { + if (gsGlobalInfo.eAPMode == eMCDRV_APM_OFF) + psPowerInfo->abAnalog[0] &= (UINT8)~MCB_AP_CP; + psPowerInfo->abAnalog[1] &= (UINT8)~MCB_AP_LO1R; + } + + if (McResCtrl_IsASrcUsed(MCDRV_ASRC_DAC1_L_ON) != 0) { + ; + psPowerInfo->abAnalog[2] &= (UINT8)~MCB_AP_DA1L; + } + if (McResCtrl_IsASrcUsed(MCDRV_ASRC_DAC1_R_ON) != 0) { + ; + psPowerInfo->abAnalog[2] &= (UINT8)~MCB_AP_DA1R; + } + + if (McResCtrl_HasSrc(eMCDRV_DST_SP, eMCDRV_DST_CH0) != 0) { + if (gsGlobalInfo.eAPMode == eMCDRV_APM_OFF) + psPowerInfo->abAnalog[0] &= (UINT8)~MCB_AP_CP; + psPowerInfo->abAnalog[2] &= + (UINT8)~(MCB_AP_SPL2|MCB_AP_SPL1); + } + if (McResCtrl_HasSrc(eMCDRV_DST_SP, eMCDRV_DST_CH1) != 0) { + if (gsGlobalInfo.eAPMode == eMCDRV_APM_OFF) + psPowerInfo->abAnalog[0] &= (UINT8)~MCB_AP_CP; + psPowerInfo->abAnalog[2] &= + (UINT8)~(MCB_AP_SPR2|MCB_AP_SPR1); + } + + if (McResCtrl_HasSrc(eMCDRV_DST_LOUT2, eMCDRV_DST_CH0) != 0) { + if (gsGlobalInfo.eAPMode == eMCDRV_APM_OFF) + psPowerInfo->abAnalog[0] &= (UINT8)~MCB_AP_CP; + psPowerInfo->abAnalog[2] &= (UINT8)~MCB_AP_LO2L; + } + if (McResCtrl_HasSrc(eMCDRV_DST_LOUT2, eMCDRV_DST_CH1) != 0) { + if (gsGlobalInfo.eAPMode == eMCDRV_APM_OFF) + psPowerInfo->abAnalog[0] &= (UINT8)~MCB_AP_CP; + psPowerInfo->abAnalog[2] &= (UINT8)~MCB_AP_LO2R; + } + + if (McResCtrl_IsASrcUsed(MCDRV_ASRC_MIC1_ON) != 0) + psPowerInfo->abAnalog[3] &= (UINT8)~MCB_MC1; + if (McResCtrl_IsASrcUsed(MCDRV_ASRC_MIC2_ON) != 0) + psPowerInfo->abAnalog[3] &= (UINT8)~MCB_MC2; + if (McResCtrl_IsASrcUsed(MCDRV_ASRC_MIC3_ON) != 0) + psPowerInfo->abAnalog[3] &= (UINT8)~MCB_MC3; + if (McResCtrl_IsASrcUsed(MCDRV_ASRC_MIC4_ON) != 0) + psPowerInfo->abAnalog[3] &= (UINT8)~MCB_MC4; + + if ((gsGlobalInfo.sPathInfo.asBias[0].dSrcOnOff & MCDRV_ASRC_MIC1_ON) + != 0) + psPowerInfo->abAnalog[3] &= (UINT8)~MCB_MB1; + if ((gsGlobalInfo.sPathInfo.asBias[1].dSrcOnOff & MCDRV_ASRC_MIC2_ON) + != 0) + psPowerInfo->abAnalog[3] &= (UINT8)~MCB_MB2; + if ((gsGlobalInfo.sPathInfo.asBias[2].dSrcOnOff & MCDRV_ASRC_MIC3_ON) + != 0) + psPowerInfo->abAnalog[3] &= (UINT8)~MCB_MB3; + if ((gsGlobalInfo.sPathInfo.asBias[3].dSrcOnOff & MCDRV_ASRC_MIC4_ON) + != 0) + psPowerInfo->abAnalog[3] &= (UINT8)~MCB_MB4; + + if (McResCtrl_HasSrc(eMCDRV_DST_ADC0, eMCDRV_DST_CH0) != 0) + psPowerInfo->abAnalog[4] &= (UINT8)~MCB_AP_ADL; + if (McResCtrl_HasSrc(eMCDRV_DST_ADC0, eMCDRV_DST_CH1) != 0) + psPowerInfo->abAnalog[4] &= (UINT8)~MCB_AP_ADR; + if (McResCtrl_HasSrc(eMCDRV_DST_ADC1, eMCDRV_DST_CH0) != 0) + psPowerInfo->abAnalog[4] &= (UINT8)~MCB_AP_ADM; + + if ((McResCtrl_IsASrcUsed(MCDRV_ASRC_LINEIN1_L_ON) != 0) + || (McResCtrl_IsASrcUsed(MCDRV_ASRC_LINEIN1_M_ON) != 0) + || (McResCtrl_IsASrcUsed(MCDRV_ASRC_LINEIN1_R_ON) != 0)) + psPowerInfo->abAnalog[4] &= (UINT8)~MCB_AP_LI; + + if ((psPowerInfo->abAnalog[1] != MCI_AP_DA0_DEF) + || (psPowerInfo->abAnalog[2] != MCI_AP_DA1_DEF) + || (psPowerInfo->abAnalog[4] != MCI_AP_AD_DEF)) { + psPowerInfo->abAnalog[0] &= + (UINT8)~(MCB_AP_LDOA|MCB_AP_BGR|MCB_AP_VR); + psPowerInfo->bDigital &= (UINT8)~MCDRV_POWINFO_D_PLL_PD; + } + if (psPowerInfo->abAnalog[3] != MCI_AP_MIC_DEF) { + psPowerInfo->abAnalog[0] &= + (UINT8)~(MCB_AP_LDOA|MCB_AP_BGR|MCB_AP_VR); + if ((psPowerInfo->abAnalog[3]&0xF0) != (MCI_AP_MIC_DEF&0xF0)) { + ; + psPowerInfo->bDigital &= + (UINT8)~MCDRV_POWINFO_D_PLL_PD; + } + } + + if ((psPowerInfo->bDigital&MCDRV_POWINFO_D_PLL_PD) == 0) { + ; + psPowerInfo->abAnalog[0] &= (UINT8)~(MCB_AP_LDOD|MCB_AP_BGR); + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McResCtrl_GetPowerInfo", 0); +#endif +} + +/**************************************************************************** + * McResCtrl_GetPowerInfoRegAccess + * + * Description: + * Get power information to access register. + * Arguments: + * psRegInfo register information + * psPowerInfo power information + * Return: + * none + * + ****************************************************************************/ +void McResCtrl_GetPowerInfoRegAccess( + const struct MCDRV_REG_INFO *psRegInfo, + struct MCDRV_POWER_INFO *psPowerInfo +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McResCtrl_GetPowerInfoRegAccess"); +#endif + + + McResCtrl_GetPowerInfo(psPowerInfo); + switch (psRegInfo->bRegType) { + case MCDRV_REGTYPE_IF: + case MCDRV_REGTYPE_A: + case MCDRV_REGTYPE_MA: + case MCDRV_REGTYPE_MB: + case MCDRV_REGTYPE_B: + case MCDRV_REGTYPE_E: + case MCDRV_REGTYPE_C: + case MCDRV_REGTYPE_F: + case MCDRV_REGTYPE_ANA: + case MCDRV_REGTYPE_CD: + default: + break; + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McResCtrl_GetPowerInfoRegAccess", 0); +#endif +} + +/**************************************************************************** + * McResCtrl_GetCurPowerInfo + * + * Description: + * Get current power setting. + * Arguments: + * psPowerInfo power information + * Return: + * none + * + ****************************************************************************/ +void McResCtrl_GetCurPowerInfo( + struct MCDRV_POWER_INFO *psPowerInfo +) +{ + UINT8 bReg; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McResCtrl_GetCurPowerInfo"); +#endif + + + psPowerInfo->bDigital = 0; + bReg = gsGlobalInfo.abRegValA[MCI_PD]; + if ((bReg & MCB_PLL_PD) != 0) + psPowerInfo->bDigital |= MCDRV_POWINFO_D_PLL_PD; + if ((bReg & MCB_PE_CLK_PD) != 0) + psPowerInfo->bDigital |= MCDRV_POWINFO_D_PE_CLK_PD; + if ((bReg & MCB_PB_CLK_PD) != 0) + psPowerInfo->bDigital |= MCDRV_POWINFO_D_PB_CLK_PD; + if ((bReg & MCB_PM_CLK_PD) != 0) + psPowerInfo->bDigital |= MCDRV_POWINFO_D_PM_CLK_PD; + if ((bReg & MCB_PF_CLK_PD) != 0) + psPowerInfo->bDigital |= MCDRV_POWINFO_D_PF_CLK_PD; + if ((bReg & MCB_PC_CLK_PD) != 0) + psPowerInfo->bDigital |= MCDRV_POWINFO_D_PC_CLK_PD; + + psPowerInfo->abAnalog[0] = gsGlobalInfo.abRegValANA[MCI_AP]; + psPowerInfo->abAnalog[1] = gsGlobalInfo.abRegValANA[MCI_AP_DA0]; + psPowerInfo->abAnalog[2] = gsGlobalInfo.abRegValANA[MCI_AP_DA1]; + psPowerInfo->abAnalog[3] = gsGlobalInfo.abRegValANA[MCI_AP_MIC]; + psPowerInfo->abAnalog[4] = gsGlobalInfo.abRegValANA[MCI_AP_AD]; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McResCtrl_GetCurPowerInfo", 0); +#endif +} + +/**************************************************************************** + * GetD1Source + * + * Description: + * Get digital source information. + * Arguments: + * pasDChannel digital source setting + * eCh channel + * Return: + * path source + * + ****************************************************************************/ +static UINT32 GetD1Source( + struct MCDRV_D1_CHANNEL *pasD, + enum MCDRV_DST_CH eCh +) +{ + UINT32 dSrc = 0; + +#if (MCDRV_DEBUG_LEVEL >= 4) + SINT32 sdRet; + McDebugLog_FuncIn("GetD1Source"); +#endif + + if (pasD != NULL) { + if ((pasD[eCh].dSrcOnOff & MCDRV_D1SRC_MUSICIN_ON) != 0) + dSrc |= MCDRV_D1SRC_MUSICIN_ON; + if ((pasD[eCh].dSrcOnOff & MCDRV_D1SRC_EXTIN_ON) != 0) + dSrc |= MCDRV_D1SRC_EXTIN_ON; + if ((pasD[eCh].dSrcOnOff & MCDRV_D1SRC_VBOXOUT_ON) != 0) + dSrc |= MCDRV_D1SRC_VBOXOUT_ON; + if ((pasD[eCh].dSrcOnOff & MCDRV_D1SRC_VBOXREFOUT_ON) != 0) + dSrc |= MCDRV_D1SRC_VBOXREFOUT_ON; + if ((pasD[eCh].dSrcOnOff & MCDRV_D1SRC_AE0_ON) != 0) + dSrc |= MCDRV_D1SRC_AE0_ON; + if ((pasD[eCh].dSrcOnOff & MCDRV_D1SRC_AE1_ON) != 0) + dSrc |= MCDRV_D1SRC_AE1_ON; + if ((pasD[eCh].dSrcOnOff & MCDRV_D1SRC_AE2_ON) != 0) + dSrc |= MCDRV_D1SRC_AE2_ON; + if ((pasD[eCh].dSrcOnOff & MCDRV_D1SRC_AE3_ON) != 0) + dSrc |= MCDRV_D1SRC_AE3_ON; + if ((pasD[eCh].dSrcOnOff & MCDRV_D1SRC_ADIF0_ON) != 0) + dSrc |= MCDRV_D1SRC_ADIF0_ON; + if ((pasD[eCh].dSrcOnOff & MCDRV_D1SRC_ADIF1_ON) != 0) + dSrc |= MCDRV_D1SRC_ADIF1_ON; + if ((pasD[eCh].dSrcOnOff & MCDRV_D1SRC_ADIF2_ON) != 0) + dSrc |= MCDRV_D1SRC_ADIF2_ON; + if ((pasD[eCh].dSrcOnOff & MCDRV_D1SRC_HIFIIN_ON) != 0) + dSrc |= MCDRV_D1SRC_HIFIIN_ON; + } +#if (MCDRV_DEBUG_LEVEL >= 4) + sdRet = dSrc; + McDebugLog_FuncOut("GetD1Source", &sdRet); +#endif + + return dSrc; +} + +/**************************************************************************** + * GetD2Source + * + * Description: + * Get digital source information. + * Arguments: + * pasDChannel digital source setting + * eCh channel + * Return: + * path source + * + ****************************************************************************/ +static UINT32 GetD2Source( + struct MCDRV_D2_CHANNEL *pasD, + enum MCDRV_DST_CH eCh +) +{ + UINT32 dSrc = 0; + +#if (MCDRV_DEBUG_LEVEL >= 4) + SINT32 sdRet; + McDebugLog_FuncIn("GetD2Source"); +#endif + + if (pasD != NULL) { + if ((pasD[eCh].dSrcOnOff & MCDRV_D2SRC_VOICEIN_ON) != 0) + dSrc |= MCDRV_D2SRC_VOICEIN_ON; + if ((pasD[eCh].dSrcOnOff & MCDRV_D2SRC_VBOXIOOUT_ON) != 0) + dSrc |= MCDRV_D2SRC_VBOXIOOUT_ON; + if ((pasD[eCh].dSrcOnOff & MCDRV_D2SRC_VBOXHOSTOUT_ON) != 0) + dSrc |= MCDRV_D2SRC_VBOXHOSTOUT_ON; + if ((pasD[eCh].dSrcOnOff & MCDRV_D2SRC_ADC0_L_ON) != 0) + dSrc |= MCDRV_D2SRC_ADC0_L_ON; + if ((pasD[eCh].dSrcOnOff & MCDRV_D2SRC_ADC0_R_ON) != 0) + dSrc |= MCDRV_D2SRC_ADC0_R_ON; + if ((pasD[eCh].dSrcOnOff & MCDRV_D2SRC_ADC1_ON) != 0) + dSrc |= MCDRV_D2SRC_ADC1_ON; + if ((pasD[eCh].dSrcOnOff & MCDRV_D2SRC_PDM0_L_ON) != 0) + dSrc |= MCDRV_D2SRC_PDM0_L_ON; + if ((pasD[eCh].dSrcOnOff & MCDRV_D2SRC_PDM0_R_ON) != 0) + dSrc |= MCDRV_D2SRC_PDM0_R_ON; + if ((pasD[eCh].dSrcOnOff & MCDRV_D2SRC_PDM1_L_ON) != 0) + dSrc |= MCDRV_D2SRC_PDM1_L_ON; + if ((pasD[eCh].dSrcOnOff & MCDRV_D2SRC_PDM1_R_ON) != 0) + dSrc |= MCDRV_D2SRC_PDM1_R_ON; + if ((pasD[eCh].dSrcOnOff & MCDRV_D2SRC_DAC0REF_ON) != 0) + dSrc |= MCDRV_D2SRC_DAC0REF_ON; + if ((pasD[eCh].dSrcOnOff & MCDRV_D2SRC_DAC1REF_ON) != 0) + dSrc |= MCDRV_D2SRC_DAC1REF_ON; + } +#if (MCDRV_DEBUG_LEVEL >= 4) + sdRet = dSrc; + McDebugLog_FuncOut("GetD2Source", &sdRet); +#endif + + return dSrc; +} + +/**************************************************************************** + * McResCtrl_IsD1SrcUsed + * + * Description: + * Is Src used + * Arguments: + * dSrcOnOff path src type + * Return: + * 0:unused/1:used + * + ****************************************************************************/ +UINT8 McResCtrl_IsD1SrcUsed( + UINT32 dSrcOnOff +) +{ + UINT8 bUsed = 0; + UINT8 bCh; + +#if (MCDRV_DEBUG_LEVEL >= 4) + SINT32 sdRet; + McDebugLog_FuncIn("IsD1SrcUsed"); +#endif + + for (bCh = 0; bCh < MUSICOUT_PATH_CHANNELS && bUsed == 0; bCh++) { + if ((gsGlobalInfo.sPathInfo.asMusicOut[bCh].dSrcOnOff + & dSrcOnOff) != 0) + bUsed = 1; + } + for (bCh = 0; bCh < EXTOUT_PATH_CHANNELS && bUsed == 0; bCh++) { + if ((gsGlobalInfo.sPathInfo.asExtOut[bCh].dSrcOnOff + & dSrcOnOff) != 0) + bUsed = 1; + } + for (bCh = 0; bCh < VBOXMIXIN_PATH_CHANNELS && bUsed == 0; bCh++) { + if ((gsGlobalInfo.sPathInfo.asVboxMixIn[bCh].dSrcOnOff + & dSrcOnOff) != 0) + bUsed = 1; + } + for (bCh = 0; bCh < AE_PATH_CHANNELS && bUsed == 0; bCh++) { + if ((gsGlobalInfo.sPathInfo.asAe0[bCh].dSrcOnOff + & dSrcOnOff) != 0) + bUsed = 1; + if ((gsGlobalInfo.sPathInfo.asAe1[bCh].dSrcOnOff + & dSrcOnOff) != 0) + bUsed = 1; + if ((gsGlobalInfo.sPathInfo.asAe2[bCh].dSrcOnOff + & dSrcOnOff) != 0) + bUsed = 1; + if ((gsGlobalInfo.sPathInfo.asAe3[bCh].dSrcOnOff + & dSrcOnOff) != 0) + bUsed = 1; + } + for (bCh = 0; bCh < DAC0_PATH_CHANNELS && bUsed == 0; bCh++) { + if ((gsGlobalInfo.sPathInfo.asDac0[bCh].dSrcOnOff + & dSrcOnOff) != 0) + bUsed = 1; + } + for (bCh = 0; bCh < DAC1_PATH_CHANNELS && bUsed == 0; bCh++) { + if ((gsGlobalInfo.sPathInfo.asDac1[bCh].dSrcOnOff + & dSrcOnOff) != 0) + bUsed = 1; + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + sdRet = (SINT32)bUsed; + McDebugLog_FuncOut("IsD1SrcUsed", &sdRet); +#endif + + return bUsed; +} + +/**************************************************************************** + * McResCtrl_IsD2SrcUsed + * + * Description: + * Is Src used + * Arguments: + * dSrcOnOff path src type + * Return: + * 0:unused/1:used + * + ****************************************************************************/ +UINT8 McResCtrl_IsD2SrcUsed( + UINT32 dSrcOnOff +) +{ + UINT8 bUsed = 0; + UINT8 bCh; + +#if (MCDRV_DEBUG_LEVEL >= 4) + SINT32 sdRet; + McDebugLog_FuncIn("IsD2SrcUsed"); +#endif + + for (bCh = 0; bCh < VOICEOUT_PATH_CHANNELS && bUsed == 0; bCh++) { + if ((gsGlobalInfo.sPathInfo.asVoiceOut[bCh].dSrcOnOff + & dSrcOnOff) != 0) + bUsed = 1; + } + for (bCh = 0; bCh < VBOXIOIN_PATH_CHANNELS && bUsed == 0; bCh++) { + if ((gsGlobalInfo.sPathInfo.asVboxIoIn[bCh].dSrcOnOff + & dSrcOnOff) != 0) + bUsed = 1; + } + for (bCh = 0; bCh < VBOXHOSTIN_PATH_CHANNELS && bUsed == 0; bCh++) { + if ((gsGlobalInfo.sPathInfo.asVboxHostIn[bCh].dSrcOnOff + & dSrcOnOff) != 0) + bUsed = 1; + } + for (bCh = 0; bCh < HOSTOUT_PATH_CHANNELS && bUsed == 0; bCh++) { + if ((gsGlobalInfo.sPathInfo.asHostOut[bCh].dSrcOnOff + & dSrcOnOff) != 0) + bUsed = 1; + } + for (bCh = 0; bCh < ADIF0_PATH_CHANNELS && bUsed == 0; bCh++) { + if ((gsGlobalInfo.sPathInfo.asAdif0[bCh].dSrcOnOff + & dSrcOnOff) != 0) + bUsed = 1; + } + for (bCh = 0; bCh < ADIF1_PATH_CHANNELS && bUsed == 0; bCh++) { + if ((gsGlobalInfo.sPathInfo.asAdif1[bCh].dSrcOnOff + & dSrcOnOff) != 0) + bUsed = 1; + } + for (bCh = 0; bCh < ADIF2_PATH_CHANNELS && bUsed == 0; bCh++) { + if ((gsGlobalInfo.sPathInfo.asAdif2[bCh].dSrcOnOff + & dSrcOnOff) != 0) + bUsed = 1; + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + sdRet = (SINT32)bUsed; + McDebugLog_FuncOut("IsD2SrcUsed", &sdRet); +#endif + + return bUsed; +} + +/**************************************************************************** + * McResCtrl_IsASrcUsed + * + * Description: + * Is Src used + * Arguments: + * dSrcOnOff path src type + * Return: + * 0:unused/1:used + * + ****************************************************************************/ +UINT8 McResCtrl_IsASrcUsed( + UINT32 dSrcOnOff +) +{ + UINT8 bUsed = 0; + UINT8 bCh; + +#if (MCDRV_DEBUG_LEVEL >= 4) + SINT32 sdRet; + McDebugLog_FuncIn("IsASrcUsed"); +#endif + + for (bCh = 0; bCh < ADC0_PATH_CHANNELS && bUsed == 0; bCh++) { + if ((gsGlobalInfo.sPathInfo.asAdc0[bCh].dSrcOnOff + & dSrcOnOff) != 0) + bUsed = 1; + } + for (bCh = 0; bCh < ADC1_PATH_CHANNELS && bUsed == 0; bCh++) { + if ((gsGlobalInfo.sPathInfo.asAdc1[bCh].dSrcOnOff + & dSrcOnOff) != 0) + bUsed = 1; + } + for (bCh = 0; bCh < SP_PATH_CHANNELS && bUsed == 0; bCh++) { + if ((gsGlobalInfo.sPathInfo.asSp[bCh].dSrcOnOff + & dSrcOnOff) != 0) + bUsed = 1; + } + for (bCh = 0; bCh < HP_PATH_CHANNELS && bUsed == 0; bCh++) { + if ((gsGlobalInfo.sPathInfo.asHp[bCh].dSrcOnOff + & dSrcOnOff) != 0) + bUsed = 1; + } + for (bCh = 0; bCh < RC_PATH_CHANNELS && bUsed == 0; bCh++) { + if ((gsGlobalInfo.sPathInfo.asRc[bCh].dSrcOnOff + & dSrcOnOff) != 0) + bUsed = 1; + } + for (bCh = 0; bCh < LOUT1_PATH_CHANNELS && bUsed == 0; bCh++) { + if ((gsGlobalInfo.sPathInfo.asLout1[bCh].dSrcOnOff + & dSrcOnOff) != 0) + bUsed = 1; + } + for (bCh = 0; bCh < LOUT2_PATH_CHANNELS && bUsed == 0; bCh++) { + if ((gsGlobalInfo.sPathInfo.asLout2[bCh].dSrcOnOff + & dSrcOnOff) != 0) + bUsed = 1; + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + sdRet = (SINT32)bUsed; + McDebugLog_FuncOut("IsASrcUsed", &sdRet); +#endif + + return bUsed; +} + +/**************************************************************************** + * McResCtrl_HasSrc + * + * Description: + * Is Destination used + * Arguments: + * eType path destination + * eCh channel + * Return: + * 0:unused/1:used + * + ****************************************************************************/ +UINT8 McResCtrl_HasSrc( + enum MCDRV_DST_TYPE eType, + enum MCDRV_DST_CH eCh +) +{ + UINT8 bUsed = 0; + struct MCDRV_PATH_INFO *psPathInfo = &gsGlobalInfo.sPathInfo; + UINT32 dSrcOnOff; + +#if (MCDRV_DEBUG_LEVEL >= 4) + SINT32 sdRet; + McDebugLog_FuncIn("McResCtrl_HasSrc"); +#endif + + switch (eType) { + case eMCDRV_DST_MUSICOUT: + if (eCh > eMCDRV_DST_CH1) { + ; + break; + } + if (GetD1Source(psPathInfo->asMusicOut, eCh) != 0) { + ; + bUsed = 1; + } + break; + case eMCDRV_DST_EXTOUT: + if (eCh > eMCDRV_DST_CH1) { + ; + break; + } + if (GetD1Source(psPathInfo->asExtOut, eCh) != 0) { + ; + bUsed = 1; + } + break; + case eMCDRV_DST_HIFIOUT: + if (eCh > eMCDRV_DST_CH0) { + ; + break; + } + if (GetD1Source(psPathInfo->asHifiOut, eCh) != 0) { + ; + bUsed = 1; + } + break; + case eMCDRV_DST_VBOXMIXIN: + if (GetD1Source(psPathInfo->asVboxMixIn, eCh) != 0) { + ; + bUsed = 1; + } + break; + case eMCDRV_DST_AE0: + if (eCh > eMCDRV_DST_CH1) { + ; + break; + } + if (GetD1Source(psPathInfo->asAe0, eCh) != 0) { + ; + bUsed = 1; + } + break; + case eMCDRV_DST_AE1: + if (eCh > eMCDRV_DST_CH1) { + ; + break; + } + if (GetD1Source(psPathInfo->asAe1, eCh) != 0) { + ; + bUsed = 1; + } + break; + case eMCDRV_DST_AE2: + if (eCh > eMCDRV_DST_CH1) { + ; + break; + } + if (GetD1Source(psPathInfo->asAe2, eCh) != 0) { + ; + bUsed = 1; + } + break; + case eMCDRV_DST_AE3: + if (eCh > eMCDRV_DST_CH1) { + ; + break; + } + if (GetD1Source(psPathInfo->asAe3, eCh) != 0) { + ; + bUsed = 1; + } + break; + case eMCDRV_DST_DAC0: + if (eCh > eMCDRV_DST_CH1) { + ; + break; + } + if (GetD1Source(psPathInfo->asDac0, eCh) != 0) { + ; + bUsed = 1; + } + break; + case eMCDRV_DST_DAC1: + if (eCh > eMCDRV_DST_CH1) { + ; + break; + } + if (GetD1Source(psPathInfo->asDac1, eCh) != 0) { + ; + bUsed = 1; + } + break; + case eMCDRV_DST_VOICEOUT: + if (eCh > eMCDRV_DST_CH0) { + ; + break; + } + if (GetD2Source(psPathInfo->asVoiceOut, eCh) != 0) + bUsed = 1; + break; + case eMCDRV_DST_VBOXIOIN: + if (eCh > eMCDRV_DST_CH0) { + ; + break; + } + if (GetD2Source(psPathInfo->asVboxIoIn, eCh) != 0) + bUsed = 1; + break; + case eMCDRV_DST_VBOXHOSTIN: + if (eCh > eMCDRV_DST_CH0) { + ; + break; + } + if (GetD2Source(psPathInfo->asVboxHostIn, eCh) != 0) + bUsed = 1; + break; + case eMCDRV_DST_HOSTOUT: + if (eCh > eMCDRV_DST_CH0) { + ; + break; + } + if (GetD2Source(psPathInfo->asHostOut, eCh) != 0) + bUsed = 1; + break; + + case eMCDRV_DST_ADIF0: + if (eCh > eMCDRV_DST_CH1) { + ; + break; + } + if (GetD2Source(psPathInfo->asAdif0, eCh) != 0) + bUsed = 1; + break; + + case eMCDRV_DST_ADIF1: + if (eCh > eMCDRV_DST_CH1) { + ; + break; + } + if (GetD2Source(psPathInfo->asAdif1, eCh) != 0) + bUsed = 1; + break; + + case eMCDRV_DST_ADIF2: + if (eCh > eMCDRV_DST_CH1) { + ; + break; + } + if (GetD2Source(psPathInfo->asAdif2, eCh) != 0) + bUsed = 1; + break; + + case eMCDRV_DST_ADC0: + if (eCh > eMCDRV_DST_CH1) { + ; + break; + } + dSrcOnOff = psPathInfo->asAdc0[eCh].dSrcOnOff; + if (((dSrcOnOff & MCDRV_ASRC_MIC1_ON) != 0) + || ((dSrcOnOff & MCDRV_ASRC_MIC2_ON) != 0) + || ((dSrcOnOff & MCDRV_ASRC_MIC3_ON) != 0) + || ((dSrcOnOff & MCDRV_ASRC_MIC4_ON) != 0) + || ((dSrcOnOff & MCDRV_ASRC_LINEIN1_L_ON) != 0) + || ((dSrcOnOff & MCDRV_ASRC_LINEIN1_R_ON) != 0) + || ((dSrcOnOff & MCDRV_ASRC_LINEIN1_M_ON) != 0)) { + bUsed = 1; + } + break; + + case eMCDRV_DST_ADC1: + if (eCh > eMCDRV_DST_CH0) { + ; + break; + } + dSrcOnOff = psPathInfo->asAdc1[eCh].dSrcOnOff; + if (((dSrcOnOff & MCDRV_ASRC_MIC1_ON) != 0) + || ((dSrcOnOff & MCDRV_ASRC_MIC2_ON) != 0) + || ((dSrcOnOff & MCDRV_ASRC_MIC3_ON) != 0) + || ((dSrcOnOff & MCDRV_ASRC_MIC4_ON) != 0) + || ((dSrcOnOff & MCDRV_ASRC_LINEIN1_L_ON) != 0) + || ((dSrcOnOff & MCDRV_ASRC_LINEIN1_R_ON) != 0) + || ((dSrcOnOff & MCDRV_ASRC_LINEIN1_M_ON) != 0)) { + bUsed = 1; + } + break; + + case eMCDRV_DST_SP: + if (eCh > eMCDRV_DST_CH1) { + ; + break; + } + dSrcOnOff = psPathInfo->asSp[eCh].dSrcOnOff; + if (((dSrcOnOff & MCDRV_ASRC_DAC1_L_ON) != 0) + || ((dSrcOnOff & MCDRV_ASRC_DAC1_R_ON) != 0)) { + bUsed = 1; + } + break; + + case eMCDRV_DST_HP: + if (eCh > eMCDRV_DST_CH1) { + ; + break; + } + dSrcOnOff = psPathInfo->asHp[eCh].dSrcOnOff; + if (((dSrcOnOff & MCDRV_ASRC_DAC0_L_ON) != 0) + || ((dSrcOnOff & MCDRV_ASRC_DAC0_R_ON) != 0)) { + bUsed = 1; + } + break; + + case eMCDRV_DST_RCV: + if (eCh > eMCDRV_DST_CH0) { + ; + break; + } + dSrcOnOff = psPathInfo->asRc[eCh].dSrcOnOff; + if (((dSrcOnOff & MCDRV_ASRC_DAC0_L_ON) != 0) + || ((dSrcOnOff & MCDRV_ASRC_DAC0_R_ON) != 0)) { + bUsed = 1; + } + break; + + case eMCDRV_DST_LOUT1: + if (eCh > eMCDRV_DST_CH1) { + ; + break; + } + dSrcOnOff = psPathInfo->asLout1[eCh].dSrcOnOff; + if (((dSrcOnOff & MCDRV_ASRC_DAC0_L_ON) != 0) + || ((dSrcOnOff & MCDRV_ASRC_DAC0_R_ON) != 0)) { + bUsed = 1; + } + break; + + case eMCDRV_DST_LOUT2: + if (eCh > eMCDRV_DST_CH1) { + ; + break; + } + dSrcOnOff = psPathInfo->asLout2[eCh].dSrcOnOff; + if (((dSrcOnOff & MCDRV_ASRC_DAC1_L_ON) != 0) + || ((dSrcOnOff & MCDRV_ASRC_DAC1_R_ON) != 0)) { + bUsed = 1; + } + break; + + case eMCDRV_DST_BIAS: + if (eCh > eMCDRV_DST_CH3) { + ; + break; + } + dSrcOnOff = psPathInfo->asBias[eCh].dSrcOnOff; + if (((dSrcOnOff & MCDRV_ASRC_MIC1_ON) != 0) + || ((dSrcOnOff & MCDRV_ASRC_MIC2_ON) != 0) + || ((dSrcOnOff & MCDRV_ASRC_MIC3_ON) != 0) + || ((dSrcOnOff & MCDRV_ASRC_MIC4_ON) != 0)) { + ; + bUsed = 1; + } + break; + + default: + break; + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + sdRet = (SINT32)bUsed; + McDebugLog_FuncOut("McResCtrl_HasSrc", &sdRet); +#endif + + return bUsed; +} + +/**************************************************************************** + * McResCtrl_GetSource + * + * Description: + * Get source information. + * Arguments: + * eType path destination + * eCh channel + * Return: + * path source + * + ****************************************************************************/ +UINT32 McResCtrl_GetSource( + enum MCDRV_DST_TYPE eType, + enum MCDRV_DST_CH eCh +) +{ + UINT32 dSrc = 0; + struct MCDRV_PATH_INFO *psPathInfo = &gsGlobalInfo.sPathInfo; + +#if (MCDRV_DEBUG_LEVEL >= 4) + SINT32 sdRet; + McDebugLog_FuncIn("McResCtrl_GetSource"); +#endif + + switch (eType) { + case eMCDRV_DST_MUSICOUT: + if (eCh > eMCDRV_DST_CH1) { + ; + break; + } + dSrc = GetD1Source(psPathInfo->asMusicOut, eCh); + break; + case eMCDRV_DST_EXTOUT: + if (eCh > eMCDRV_DST_CH1) { + ; + break; + } + dSrc = GetD1Source(psPathInfo->asExtOut, eCh); + break; + case eMCDRV_DST_HIFIOUT: + if (eCh > eMCDRV_DST_CH0) { + ; + break; + } + dSrc = GetD1Source(psPathInfo->asHifiOut, eCh); + break; + case eMCDRV_DST_VBOXMIXIN: + dSrc = GetD1Source(psPathInfo->asVboxMixIn, eCh); + break; + case eMCDRV_DST_AE0: + if (eCh > eMCDRV_DST_CH1) { + ; + break; + } + dSrc = GetD1Source(psPathInfo->asAe0, eCh); + break; + case eMCDRV_DST_AE1: + if (eCh > eMCDRV_DST_CH1) { + ; + break; + } + dSrc = GetD1Source(psPathInfo->asAe1, eCh); + break; + case eMCDRV_DST_AE2: + if (eCh > eMCDRV_DST_CH1) { + ; + break; + } + dSrc = GetD1Source(psPathInfo->asAe2, eCh); + break; + case eMCDRV_DST_AE3: + if (eCh > eMCDRV_DST_CH1) { + ; + break; + } + dSrc = GetD1Source(psPathInfo->asAe3, eCh); + break; + case eMCDRV_DST_DAC0: + if (eCh > eMCDRV_DST_CH1) { + ; + break; + } + dSrc = GetD1Source(psPathInfo->asDac0, eCh); + break; + case eMCDRV_DST_DAC1: + if (eCh > eMCDRV_DST_CH1) { + ; + break; + } + dSrc = GetD1Source(psPathInfo->asDac1, eCh); + break; + case eMCDRV_DST_VOICEOUT: + if (eCh > eMCDRV_DST_CH0) { + ; + break; + } + dSrc = GetD2Source(psPathInfo->asVoiceOut, eCh); + break; + case eMCDRV_DST_VBOXIOIN: + if (eCh > eMCDRV_DST_CH0) { + ; + break; + } + dSrc = GetD2Source(psPathInfo->asVboxIoIn, eCh); + break; + case eMCDRV_DST_VBOXHOSTIN: + if (eCh > eMCDRV_DST_CH0) { + ; + break; + } + dSrc = GetD2Source(psPathInfo->asVboxHostIn, eCh); + break; + case eMCDRV_DST_HOSTOUT: + if (eCh > eMCDRV_DST_CH0) { + ; + break; + } + dSrc = GetD2Source(psPathInfo->asHostOut, eCh); + break; + case eMCDRV_DST_ADIF0: + if (eCh > eMCDRV_DST_CH1) { + ; + break; + } + dSrc = GetD2Source(psPathInfo->asAdif0, eCh); + break; + case eMCDRV_DST_ADIF1: + if (eCh > eMCDRV_DST_CH1) { + ; + break; + } + dSrc = GetD2Source(psPathInfo->asAdif1, eCh); + break; + case eMCDRV_DST_ADIF2: + if (eCh > eMCDRV_DST_CH1) { + ; + break; + } + dSrc = GetD2Source(psPathInfo->asAdif2, eCh); + break; + + default: + break; + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + sdRet = dSrc; + McDebugLog_FuncOut("McResCtrl_GetSource", &sdRet); +#endif + + return dSrc; +} + +/**************************************************************************** + * McResCtrl_GetDspStart + * + * Description: + * Get DSP Start/Stop setting. + * Arguments: + * none + * Return: + * bit on:DSP Start + * + ****************************************************************************/ +UINT8 McResCtrl_GetDspStart( + void +) +{ + UINT8 bStart = 0; + UINT32 dHifiSrc; +#if (MCDRV_DEBUG_LEVEL >= 4) + SINT32 sdRet; + McDebugLog_FuncIn("McResCtrl_GetDspStart"); +#endif + + dHifiSrc = gsGlobalInfo.sPathInfo.asHifiOut[0].dSrcOnOff; + + if (((dHifiSrc & MCDRV_D1SRC_ADIF0_ON) != 0) + || (McResCtrl_IsD2SrcUsed(MCDRV_D2SRC_ADC0_L_ON|MCDRV_D2SRC_ADC0_R_ON) + != 0) + || (McResCtrl_IsD2SrcUsed(MCDRV_D2SRC_ADC1_ON) != 0) + || (McResCtrl_IsD2SrcUsed(MCDRV_D2SRC_PDM0_L_ON|MCDRV_D2SRC_PDM0_R_ON) + != 0) + || (McResCtrl_IsD2SrcUsed(MCDRV_D2SRC_PDM1_L_ON|MCDRV_D2SRC_PDM1_R_ON) + != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_DAC0, eMCDRV_DST_CH0) != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_DAC0, eMCDRV_DST_CH1) != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_DAC1, eMCDRV_DST_CH0) != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_DAC1, eMCDRV_DST_CH1) != 0)) { + bStart |= MCDRV_DSP_START_E; + bStart |= MCDRV_DSP_START_M; + } + + if (McResCtrl_IsD1SrcUsed(MCDRV_D1SRC_AE0_ON + |MCDRV_D1SRC_AE1_ON + |MCDRV_D1SRC_AE2_ON + |MCDRV_D1SRC_AE3_ON) != 0) { + bStart |= MCDRV_DSP_START_M; + bStart |= MCDRV_DSP_START_B; + if ((gsGlobalInfo.sAecInfo.sAecConfig.bFDspLocate == 0) + && (gsGlobalInfo.sAecInfo.sAecAudioengine.bFDspOnOff == 1)) { + bStart |= MCDRV_DSP_START_F; + bStart |= MCDRV_DSP_START_E; + } + } + + if ((McResCtrl_HasSrc(eMCDRV_DST_VBOXMIXIN, eMCDRV_DST_CH2) != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_VBOXMIXIN, eMCDRV_DST_CH3) != 0) + || (McResCtrl_IsD1SrcUsed(MCDRV_D1SRC_VBOXREFOUT_ON) != 0)) { + bStart |= MCDRV_DSP_START_M; + if ((gsGlobalInfo.sAecInfo.sAecVBox.bCDspFuncAOnOff != 0) + || (gsGlobalInfo.sAecInfo.sAecVBox.bCDspFuncBOnOff != 0)) + bStart |= MCDRV_DSP_START_C; + if ((gsGlobalInfo.sAecInfo.sAecConfig.bFDspLocate != 0) + && (gsGlobalInfo.sAecInfo.sAecVBox.bFDspOnOff == 1)) + bStart |= MCDRV_DSP_START_F; + } else { + if ((McResCtrl_HasSrc(eMCDRV_DST_VBOXMIXIN, eMCDRV_DST_CH0) + != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_VBOXMIXIN, eMCDRV_DST_CH1) + != 0)) { + bStart |= MCDRV_DSP_START_M; + if (gsGlobalInfo.sAecInfo.sAecVBox.bLPt2_VSource == 1 + ) { + if ( + (gsGlobalInfo.sAecInfo.sAecVBox.bCDspFuncAOnOff + != 0) + || + (gsGlobalInfo.sAecInfo.sAecVBox.bCDspFuncBOnOff + != 0)) + bStart |= MCDRV_DSP_START_C; + if ( + (gsGlobalInfo.sAecInfo.sAecConfig.bFDspLocate + != 0) + && + (gsGlobalInfo.sAecInfo.sAecVBox.bFDspOnOff + == 1)) + bStart |= MCDRV_DSP_START_F; + } + } + if (McResCtrl_IsD1SrcUsed(MCDRV_D1SRC_VBOXOUT_ON) != 0) { + bStart |= MCDRV_DSP_START_M; + if (gsGlobalInfo.sAecInfo.sAecVBox.bISrc2_VSource + == 1) { + if ( + (gsGlobalInfo.sAecInfo.sAecVBox.bCDspFuncAOnOff + != 0) + || + (gsGlobalInfo.sAecInfo.sAecVBox.bCDspFuncBOnOff + != 0)) + bStart |= MCDRV_DSP_START_C; + if ( + (gsGlobalInfo.sAecInfo.sAecConfig.bFDspLocate + != 0) + && + (gsGlobalInfo.sAecInfo.sAecVBox.bFDspOnOff + == 1)) + bStart |= MCDRV_DSP_START_F; + } + } + if ((McResCtrl_HasSrc(eMCDRV_DST_VBOXHOSTIN, eMCDRV_DST_CH0) + != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_HOSTOUT, eMCDRV_DST_CH0) + != 0)) { + if ( + (gsGlobalInfo.sAecInfo.sAecVBox.bCDspFuncAOnOff != 0) + || + (gsGlobalInfo.sAecInfo.sAecVBox.bCDspFuncBOnOff != 0)) + bStart |= MCDRV_DSP_START_C; + if ((gsGlobalInfo.sAecInfo.sAecConfig.bFDspLocate != 0) + && (gsGlobalInfo.sAecInfo.sAecVBox.bFDspOnOff == 1)) + bStart |= MCDRV_DSP_START_F; + } + if (McResCtrl_HasSrc(eMCDRV_DST_VOICEOUT, eMCDRV_DST_CH0) + != 0) { + if (gsGlobalInfo.sAecInfo.sAecVBox.bLPt2_VSource + == 1) { + if ( + (gsGlobalInfo.sAecInfo.sAecVBox.bCDspFuncAOnOff + != 0) + || + (gsGlobalInfo.sAecInfo.sAecVBox.bCDspFuncBOnOff + != 0)) + bStart |= MCDRV_DSP_START_C; + if ( + (gsGlobalInfo.sAecInfo.sAecConfig.bFDspLocate + != 0) + && + (gsGlobalInfo.sAecInfo.sAecVBox.bFDspOnOff + == 1)) + bStart |= MCDRV_DSP_START_F; + } + } + } + + if ((McResCtrl_IsD1SrcUsed(MCDRV_D1SRC_MUSICIN_ON) != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_MUSICOUT, eMCDRV_DST_CH0) != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_MUSICOUT, eMCDRV_DST_CH1) != 0) + || (McResCtrl_IsD1SrcUsed(MCDRV_D1SRC_EXTIN_ON) != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_EXTOUT, eMCDRV_DST_CH0) != 0) + || (McResCtrl_HasSrc(eMCDRV_DST_EXTOUT, eMCDRV_DST_CH1) != 0)) + bStart |= MCDRV_DSP_START_M; + +#if (MCDRV_DEBUG_LEVEL >= 4) + sdRet = bStart; + McDebugLog_FuncOut("McResCtrl_GetDspStart", &sdRet); +#endif + + return bStart; +} + +/**************************************************************************** + * McResCtrl_GetRegAccess + * + * Description: + * Get register access availability + * Arguments: + * psRegInfo register information + * Return: + * MCDRV_REG_ACCSESS + * + ****************************************************************************/ +enum MCDRV_REG_ACCSESS McResCtrl_GetRegAccess( + const struct MCDRV_REG_INFO *psRegInfo +) +{ + enum MCDRV_REG_ACCSESS eAccess = eMCDRV_ACCESS_DENY; + +#if (MCDRV_DEBUG_LEVEL >= 4) + SINT32 sdRet; + McDebugLog_FuncIn("McResCtrl_GetRegAccess"); +#endif + + eAccess = McDevProf_GetRegAccess(psRegInfo); + +#if (MCDRV_DEBUG_LEVEL >= 4) + sdRet = eAccess; + McDebugLog_FuncOut("McResCtrl_GetRegAccess", &sdRet); +#endif + + return eAccess; +} + +/**************************************************************************** + * McResCtrl_GetAPMode + * + * Description: + * get auto power management mode. + * Arguments: + * none + * Return: + * eMCDRV_APM_ON + * eMCDRV_APM_OFF + * + ****************************************************************************/ +enum MCDRV_PMODE McResCtrl_GetAPMode( + void +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + SINT32 sdRet = gsGlobalInfo.eAPMode; + McDebugLog_FuncIn("McResCtrl_GetAPMode"); +#endif + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McResCtrl_GetAPMode", &sdRet); +#endif + + return gsGlobalInfo.eAPMode; +} + + +/**************************************************************************** + * McResCtrl_AllocPacketBuf + * + * Description: + * allocate the buffer for register setting packets. + * Arguments: + * none + * Return: + * pointer to the area to store packets + * + ****************************************************************************/ +struct MCDRV_PACKET *McResCtrl_AllocPacketBuf( + void +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + SINT32 sdRet; + McDebugLog_FuncIn("McResCtrl_AllocPacketBuf"); +#endif + + if (eMCDRV_PACKETBUF_ALLOCATED == gsGlobalInfo.ePacketBufAlloc) { +#if (MCDRV_DEBUG_LEVEL >= 4) + sdRet = 0; + McDebugLog_FuncOut("McResCtrl_AllocPacketBuf", &sdRet); +#endif + return NULL; + } + + gsGlobalInfo.ePacketBufAlloc = eMCDRV_PACKETBUF_ALLOCATED; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McResCtrl_AllocPacketBuf", 0); +#endif + return gasPacket; +} + +/**************************************************************************** + * McResCtrl_ReleasePacketBuf + * + * Description: + * Release the buffer for register setting packets. + * Arguments: + * none + * Return: + * none + * + ****************************************************************************/ +void McResCtrl_ReleasePacketBuf( + void +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McResCtrl_ReleasePacketBuf"); +#endif + + gsGlobalInfo.ePacketBufAlloc = eMCDRV_PACKETBUF_FREE; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McResCtrl_ReleasePacketBuf", 0); +#endif +} + +/**************************************************************************** + * McResCtrl_InitRegUpdate + * + * Description: + * Initialize the process of register update. + * Arguments: + * none + * Return: + * none + * + ****************************************************************************/ +void McResCtrl_InitRegUpdate( + void +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McResCtrl_InitRegUpdate"); +#endif + + gsGlobalInfo.sCtrlPacket.wDataNum = 0; + gsGlobalInfo.wCurSlaveAddr = 0xFFFF; + gsGlobalInfo.wCurRegType = 0xFFFF; + gsGlobalInfo.wCurRegAddr = 0xFFFF; + gsGlobalInfo.wDataContinueCount = 0; + gsGlobalInfo.wPrevAddrIndex = 0; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McResCtrl_InitRegUpdate", 0); +#endif +} + +/**************************************************************************** + * McResCtrl_AddRegUpdate + * + * Description: + * Add register update packet and save register value. + * Arguments: + * wRegType register type + * wAddress address + * bData write data + * eUpdateMode updete mode + * Return: + * none + * + ****************************************************************************/ +void McResCtrl_AddRegUpdate( + UINT16 wRegType, + UINT16 wAddr, + UINT8 bData, + enum MCDRV_UPDATE_MODE eUpdateMode +) +{ + UINT8 *pbRegVal; + UINT8 bAddrADR; + UINT8 bAddrWINDOW; + UINT8 bAInc; + UINT8 bAIncReg; + UINT8 *pbCtrlData; + UINT16 *pwCtrlDataNum; + const UINT16 *pwNextAddr; + UINT16 wNextAddr; + UINT16 wSlaveAddr; + struct MCDRV_REG_INFO sRegInfo; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McResCtrl_AddRegUpdate"); +#endif + + switch (wRegType) { + case MCDRV_PACKET_REGTYPE_IF: + wSlaveAddr = McDevProf_GetSlaveAddr(eMCDRV_SLAVE_ADDR_DIG); + pbRegVal = gsGlobalInfo.abRegValIF; + pwNextAddr = gawNextAddr; + bAInc = 0; + bAIncReg = 0; + bAddrADR = (UINT8)wAddr; + bAddrWINDOW = bAddrADR; + sRegInfo.bRegType = MCDRV_REGTYPE_IF; + break; + + case MCDRV_PACKET_REGTYPE_A: + wSlaveAddr = McDevProf_GetSlaveAddr(eMCDRV_SLAVE_ADDR_DIG); + pbRegVal = gsGlobalInfo.abRegValA; + pwNextAddr = gawNextAddrAInc; + bAInc = 1; + bAIncReg = MCB_A_REG_AINC; + bAddrADR = MCI_A_REG_A; + bAddrWINDOW = MCI_A_REG_D; + sRegInfo.bRegType = MCDRV_REGTYPE_A; + break; + + case MCDRV_PACKET_REGTYPE_MA: + wSlaveAddr = McDevProf_GetSlaveAddr(eMCDRV_SLAVE_ADDR_DIG); + pbRegVal = gsGlobalInfo.abRegValMA; + pwNextAddr = gawNextAddrAInc; + bAInc = 1; + bAIncReg = MCB_MA_REG_AINC; + bAddrADR = MCI_MA_REG_A; + bAddrWINDOW = MCI_MA_REG_D; + sRegInfo.bRegType = MCDRV_REGTYPE_MA; + break; + + case MCDRV_PACKET_REGTYPE_MB: + wSlaveAddr = McDevProf_GetSlaveAddr(eMCDRV_SLAVE_ADDR_DIG); + pbRegVal = gsGlobalInfo.abRegValMB; + pwNextAddr = gawNextAddrAInc; + bAInc = 1; + bAIncReg = MCB_MB_REG_AINC; + bAddrADR = MCI_MB_REG_A; + bAddrWINDOW = MCI_MB_REG_D; + sRegInfo.bRegType = MCDRV_REGTYPE_MB; + break; + + case MCDRV_PACKET_REGTYPE_B: + wSlaveAddr = McDevProf_GetSlaveAddr(eMCDRV_SLAVE_ADDR_DIG); + pbRegVal = gsGlobalInfo.abRegValB; + pwNextAddr = gawNextAddrAInc; + bAInc = 1; + bAIncReg = MCB_B_REG_AINC; + bAddrADR = MCI_B_REG_A; + bAddrWINDOW = MCI_B_REG_D; + sRegInfo.bRegType = MCDRV_REGTYPE_B; + break; + + case MCDRV_PACKET_REGTYPE_E: + wSlaveAddr = McDevProf_GetSlaveAddr(eMCDRV_SLAVE_ADDR_DIG); + pbRegVal = gsGlobalInfo.abRegValE; + pwNextAddr = gawNextAddrAInc; + bAInc = 1; + bAIncReg = MCB_E_REG_AINC; + bAddrADR = MCI_E_REG_A; + bAddrWINDOW = MCI_E_REG_D; + sRegInfo.bRegType = MCDRV_REGTYPE_E; + break; + + case MCDRV_PACKET_REGTYPE_C: + wSlaveAddr = McDevProf_GetSlaveAddr(eMCDRV_SLAVE_ADDR_DIG); + pbRegVal = gsGlobalInfo.abRegValC; + pwNextAddr = gawNextAddrAInc; + bAInc = 1; + bAIncReg = 0; + bAddrADR = MCI_C_REG_A; + bAddrWINDOW = MCI_C_REG_D; + sRegInfo.bRegType = MCDRV_REGTYPE_C; + break; + + case MCDRV_PACKET_REGTYPE_F: + wSlaveAddr = McDevProf_GetSlaveAddr(eMCDRV_SLAVE_ADDR_DIG); + pbRegVal = gsGlobalInfo.abRegValF; + pwNextAddr = gawNextAddrAInc; + bAInc = 1; + bAIncReg = MCB_F_REG_AINC; + bAddrADR = MCI_F_REG_A; + bAddrWINDOW = MCI_F_REG_D; + sRegInfo.bRegType = MCDRV_REGTYPE_F; + break; + + case MCDRV_PACKET_REGTYPE_ANA: + wSlaveAddr = McDevProf_GetSlaveAddr(eMCDRV_SLAVE_ADDR_ANA); + pbRegVal = gsGlobalInfo.abRegValANA; + pwNextAddr = gawNextAddrAInc; + bAInc = 1; + bAIncReg = MCB_ANA_REG_AINC; + bAddrADR = MCI_ANA_REG_A; + bAddrWINDOW = MCI_ANA_REG_D; + sRegInfo.bRegType = MCDRV_REGTYPE_ANA; + break; + + case MCDRV_PACKET_REGTYPE_CD: + wSlaveAddr = McDevProf_GetSlaveAddr(eMCDRV_SLAVE_ADDR_ANA); + pbRegVal = gsGlobalInfo.abRegValCD; + pwNextAddr = gawNextAddrAInc; + bAInc = 1; + bAIncReg = MCB_CD_REG_AINC; + bAddrADR = MCI_CD_REG_A; + bAddrWINDOW = MCI_CD_REG_D; + sRegInfo.bRegType = MCDRV_REGTYPE_CD; + break; + + default: +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McResCtrl_AddRegUpdate", 0); +#endif + return; + } + + sRegInfo.bAddress = (UINT8)wAddr; + if ((McResCtrl_GetRegAccess(&sRegInfo) & eMCDRV_CAN_WRITE) == 0) { +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McResCtrl_AddRegUpdate", 0); +#endif + return; + } + + if (machdep_GetBusSelect() == 0) { + /* I2C */ + if ((gsGlobalInfo.wCurSlaveAddr != 0xFFFF) + && (gsGlobalInfo.wCurSlaveAddr != wSlaveAddr)) { + McResCtrl_ExecuteRegUpdate(); + McResCtrl_InitRegUpdate(); + } + } + + if ((gsGlobalInfo.wCurRegType != 0xFFFF) + && (gsGlobalInfo.wCurRegType != wRegType)) { + gsGlobalInfo.wCurRegType = 0xFFFF; + gsGlobalInfo.wCurRegAddr = 0xFFFF; + } + + if ((eMCDRV_UPDATE_FORCE == eUpdateMode) + || (bData != pbRegVal[wAddr])) { + if (gsGlobalInfo.wCurRegAddr == 0xFFFF) { + ; + gsGlobalInfo.wCurRegAddr = wAddr; + } + + if (eMCDRV_UPDATE_DUMMY != eUpdateMode) { + pbCtrlData = gsGlobalInfo.sCtrlPacket.abData; + pwCtrlDataNum = &(gsGlobalInfo.sCtrlPacket.wDataNum); +#if MCDRV_BURST_WRITE_ENABLE + if (gsGlobalInfo.wCurRegType == 0xFFFF) { + ; + wNextAddr = 0xFFFF; + } else { + wNextAddr = pwNextAddr[ + gsGlobalInfo.wCurRegAddr]; + } + if ((wSlaveAddr == gsGlobalInfo.wCurSlaveAddr) + && (wRegType == gsGlobalInfo.wCurRegType) + && (0xFFFF != wNextAddr) + && (wAddr != wNextAddr) + && (bAInc != 0)) { + if (pwNextAddr[wNextAddr] == wAddr) { + if (0 == + gsGlobalInfo.wDataContinueCount) { + pbCtrlData[ + gsGlobalInfo.wPrevAddrIndex] + |= MCDRV_BURST_WRITE_ENABLE; + } + pbCtrlData[*pwCtrlDataNum] = + pbRegVal[wNextAddr]; + (*pwCtrlDataNum)++; + gsGlobalInfo.wDataContinueCount++; + wNextAddr = + pwNextAddr[wNextAddr]; + } else if ((0xFFFF != pwNextAddr[wNextAddr]) + && (pwNextAddr[pwNextAddr[wNextAddr]] + == wAddr)) { + if (0 == + gsGlobalInfo.wDataContinueCount) { + pbCtrlData[ + gsGlobalInfo.wPrevAddrIndex] + |= MCDRV_BURST_WRITE_ENABLE; + } + pbCtrlData[*pwCtrlDataNum] = + pbRegVal[wNextAddr]; + (*pwCtrlDataNum)++; + pbCtrlData[*pwCtrlDataNum] = + pbRegVal[pwNextAddr[wNextAddr]]; + (*pwCtrlDataNum)++; + gsGlobalInfo.wDataContinueCount += 2; + wNextAddr = + pwNextAddr[pwNextAddr[wNextAddr]]; + } + } + + if ((0 == *pwCtrlDataNum) || (wAddr != wNextAddr)) { + if (0 != gsGlobalInfo.wDataContinueCount) { + McResCtrl_ExecuteRegUpdate(); + McResCtrl_InitRegUpdate(); + } + + if (MCDRV_PACKET_REGTYPE_IF == wRegType) { + pbCtrlData[*pwCtrlDataNum] = + (bAddrADR << 1); + gsGlobalInfo.wPrevAddrIndex = + *pwCtrlDataNum; + (*pwCtrlDataNum)++; + } else { + pbCtrlData[(*pwCtrlDataNum)++] = + (bAddrADR << 1); + pbCtrlData[(*pwCtrlDataNum)++] = + (UINT8)wAddr|bAIncReg; + pbCtrlData[*pwCtrlDataNum] = + (bAddrWINDOW << 1); + gsGlobalInfo.wPrevAddrIndex = + (*pwCtrlDataNum)++; + } + } else { + if (0 == gsGlobalInfo.wDataContinueCount) { + pbCtrlData[gsGlobalInfo.wPrevAddrIndex] + |= MCDRV_BURST_WRITE_ENABLE; + } + gsGlobalInfo.wDataContinueCount++; + } +#else + wNextAddr = 0xFFFF; + if (MCDRV_PACKET_REGTYPE_IF == wRegType) { + pbCtrlData[*pwCtrlDataNum] = + (bAddrADR << 1); + gsGlobalInfo.wPrevAddrIndex = + *pwCtrlDataNum; + (*pwCtrlDataNum)++; + } else { + pbCtrlData[(*pwCtrlDataNum)++] = + (bAddrADR << 1); + pbCtrlData[(*pwCtrlDataNum)++] = + (UINT8)wAddr|bAIncReg; + pbCtrlData[*pwCtrlDataNum] = + (bAddrWINDOW << 1); + gsGlobalInfo.wPrevAddrIndex = + (*pwCtrlDataNum)++; + } +#endif + + pbCtrlData[(*pwCtrlDataNum)++] = bData; + + gsGlobalInfo.wCurSlaveAddr = wSlaveAddr; + gsGlobalInfo.wCurRegType = wRegType; + gsGlobalInfo.wCurRegAddr = wAddr; + } + + /* save register value */ + pbRegVal[wAddr] = bData; + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McResCtrl_AddRegUpdate", 0); +#endif +} + +/**************************************************************************** + * McResCtrl_ExecuteRegUpdate + * + * Description: + * Add register update packet and save register value. + * Arguments: + * none + * Return: + * none + * + ****************************************************************************/ +void McResCtrl_ExecuteRegUpdate( + void +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McResCtrl_ExecuteRegUpdate"); +#endif + + if (0 != gsGlobalInfo.sCtrlPacket.wDataNum) { + McSrv_WriteReg((UINT8)gsGlobalInfo.wCurSlaveAddr, + gsGlobalInfo.sCtrlPacket.abData, + gsGlobalInfo.sCtrlPacket.wDataNum); + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McResCtrl_ExecuteRegUpdate", 0); +#endif +} + +/**************************************************************************** + * McResCtrl_WaitEvent + * + * Description: + * Wait event. + * Arguments: + * dEvent event to wait + * dParam event parameter + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR_TIMEOUT + * + ****************************************************************************/ +SINT32 McResCtrl_WaitEvent( + UINT32 dEvent, + UINT32 dParam +) +{ + SINT32 sdRet = MCDRV_SUCCESS; + UINT32 dInterval; + UINT32 dTimeOut; + UINT8 bSlaveAddr; + UINT8 abWriteData[2]; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McResCtrl_WaitEvent"); +#endif + + + switch (dEvent) { + case MCDRV_EVT_SVOL_DONE: + dInterval = + gsGlobalInfo.sInitInfo.sWaitTime.dPollInterval[0]; + dTimeOut = + gsGlobalInfo.sInitInfo.sWaitTime.dPollTimeOut[0]; + bSlaveAddr = McDevProf_GetSlaveAddr(eMCDRV_SLAVE_ADDR_ANA); + if ((dParam>>8) != (UINT32)0) { + abWriteData[0] = MCI_ANA_REG_A<<1; + abWriteData[1] = MCI_BUSY1; + McSrv_WriteReg(bSlaveAddr, abWriteData, 2); + sdRet = WaitBitRelease(bSlaveAddr, + (UINT16)MCI_ANA_REG_D, + (UINT8)(dParam>>8), + dInterval, dTimeOut); + if (MCDRV_SUCCESS != sdRet) + break; + } + if ((dParam&(UINT32)0xFF) != (UINT32)0) { + abWriteData[0] = MCI_ANA_REG_A<<1; + abWriteData[1] = MCI_BUSY2; + McSrv_WriteReg(bSlaveAddr, abWriteData, 2); + sdRet = WaitBitRelease(bSlaveAddr, + (UINT16)MCI_ANA_REG_D, + (UINT8)(dParam&(UINT8)0xFF), + dInterval, dTimeOut); + } + break; + + case MCDRV_EVT_ALLMUTE: + dInterval = + gsGlobalInfo.sInitInfo.sWaitTime.dPollInterval[1]; + dTimeOut = + gsGlobalInfo.sInitInfo.sWaitTime.dPollTimeOut[1]; + bSlaveAddr = McDevProf_GetSlaveAddr(eMCDRV_SLAVE_ADDR_DIG); + abWriteData[0] = MCI_MA_REG_A<<1; + abWriteData[1] = MCI_DIFI_VFLAG; + McSrv_WriteReg(bSlaveAddr, abWriteData, 2); + sdRet = WaitBitRelease(bSlaveAddr, + (UINT16)MCI_MA_REG_D, + (MCB_DIFI3_VFLAG1|MCB_DIFI3_VFLAG0 + |MCB_DIFI2_VFLAG1|MCB_DIFI2_VFLAG0 + |MCB_DIFI1_VFLAG1|MCB_DIFI1_VFLAG0 + |MCB_DIFI1_VFLAG0|MCB_DIFI0_VFLAG0), + dInterval, dTimeOut); + if (MCDRV_SUCCESS != sdRet) + break; + abWriteData[1] = MCI_ADI_VFLAG; + McSrv_WriteReg(bSlaveAddr, abWriteData, 2); + sdRet = WaitBitRelease(bSlaveAddr, + (UINT16)MCI_MA_REG_D, + (MCB_ADI2_VFLAG1|MCB_ADI2_VFLAG0 + |MCB_ADI1_VFLAG1|MCB_ADI1_VFLAG0 + |MCB_ADI0_VFLAG1|MCB_ADI0_VFLAG0), + dInterval, dTimeOut); + if (MCDRV_SUCCESS != sdRet) + break; + abWriteData[1] = MCI_DIFO_VFLAG; + McSrv_WriteReg(bSlaveAddr, abWriteData, 2); + sdRet = WaitBitRelease(bSlaveAddr, + (UINT16)MCI_MA_REG_D, + (MCB_DIFO3_VFLAG1|MCB_DIFO3_VFLAG0 + |MCB_DIFO2_VFLAG1|MCB_DIFO2_VFLAG0 + |MCB_DIFO1_VFLAG1|MCB_DIFO1_VFLAG0 + |MCB_DIFO1_VFLAG0|MCB_DIFO0_VFLAG0), + dInterval, dTimeOut); + if (MCDRV_SUCCESS != sdRet) + break; + abWriteData[1] = MCI_DAO_VFLAG; + McSrv_WriteReg(bSlaveAddr, abWriteData, 2); + sdRet = WaitBitRelease(bSlaveAddr, + (UINT16)MCI_MA_REG_D, + (MCB_DAO1_VFLAG1|MCB_DAO1_VFLAG0 + |MCB_DAO0_VFLAG1|MCB_DAO0_VFLAG0), + dInterval, dTimeOut); + break; + + case MCDRV_EVT_DIRMUTE: + dInterval = + gsGlobalInfo.sInitInfo.sWaitTime.dPollInterval[1]; + dTimeOut = + gsGlobalInfo.sInitInfo.sWaitTime.dPollTimeOut[1]; + bSlaveAddr = McDevProf_GetSlaveAddr(eMCDRV_SLAVE_ADDR_DIG); + abWriteData[0] = MCI_MA_REG_A<<1; + abWriteData[1] = MCI_DIFI_VFLAG; + McSrv_WriteReg(bSlaveAddr, abWriteData, 2); + sdRet = WaitBitRelease(bSlaveAddr, + (UINT16)MCI_MA_REG_D, + (UINT8)dParam, + dInterval, dTimeOut); + break; + + case MCDRV_EVT_ADCMUTE: + dInterval = + gsGlobalInfo.sInitInfo.sWaitTime.dPollInterval[1]; + dTimeOut = + gsGlobalInfo.sInitInfo.sWaitTime.dPollTimeOut[1]; + bSlaveAddr = McDevProf_GetSlaveAddr(eMCDRV_SLAVE_ADDR_DIG); + abWriteData[0] = MCI_MA_REG_A<<1; + abWriteData[1] = MCI_ADI_VFLAG; + McSrv_WriteReg(bSlaveAddr, abWriteData, 2); + sdRet = WaitBitRelease(bSlaveAddr, + (UINT16)MCI_MA_REG_D, + (UINT8)dParam, + dInterval, dTimeOut); + break; + + case MCDRV_EVT_DITMUTE: + dInterval = + gsGlobalInfo.sInitInfo.sWaitTime.dPollInterval[1]; + dTimeOut = + gsGlobalInfo.sInitInfo.sWaitTime.dPollTimeOut[1]; + bSlaveAddr = McDevProf_GetSlaveAddr(eMCDRV_SLAVE_ADDR_DIG); + abWriteData[0] = MCI_MA_REG_A<<1; + abWriteData[1] = MCI_DIFO_VFLAG; + McSrv_WriteReg(bSlaveAddr, abWriteData, 2); + sdRet = WaitBitRelease(bSlaveAddr, + (UINT16)MCI_MA_REG_D, + (UINT8)dParam, + dInterval, dTimeOut); + break; + + case MCDRV_EVT_DACMUTE: + dInterval = + gsGlobalInfo.sInitInfo.sWaitTime.dPollInterval[1]; + dTimeOut = + gsGlobalInfo.sInitInfo.sWaitTime.dPollTimeOut[1]; + bSlaveAddr = McDevProf_GetSlaveAddr(eMCDRV_SLAVE_ADDR_DIG); + abWriteData[0] = MCI_MA_REG_A<<1; + abWriteData[1] = MCI_DAO_VFLAG; + McSrv_WriteReg(bSlaveAddr, abWriteData, 2); + sdRet = WaitBitRelease(bSlaveAddr, + (UINT16)MCI_MA_REG_D, + (UINT8)dParam, + dInterval, dTimeOut); + break; + + case MCDRV_EVT_CLKBUSY_RESET: + dInterval = + gsGlobalInfo.sInitInfo.sWaitTime.dPollInterval[2]; + dTimeOut = + gsGlobalInfo.sInitInfo.sWaitTime.dPollTimeOut[2]; + bSlaveAddr = McDevProf_GetSlaveAddr(eMCDRV_SLAVE_ADDR_DIG); + abWriteData[0] = MCI_A_REG_A<<1; + abWriteData[1] = MCI_CLKSRC; + McSrv_WriteReg(bSlaveAddr, abWriteData, 2); + sdRet = WaitBitRelease(bSlaveAddr, + (UINT16)MCI_A_REG_D, + MCB_CLKBUSY, + dInterval, dTimeOut); + break; + + case MCDRV_EVT_PSW_RESET: + dInterval = + gsGlobalInfo.sInitInfo.sWaitTime.dPollInterval[4]; + dTimeOut = + gsGlobalInfo.sInitInfo.sWaitTime.dPollTimeOut[4]; + bSlaveAddr = McDevProf_GetSlaveAddr(eMCDRV_SLAVE_ADDR_DIG); + sdRet = WaitBitRelease(bSlaveAddr, + (UINT16)(dParam>>8), + (UINT8)(dParam&(UINT8)0xFF), + dInterval, dTimeOut); + break; + + case MCDRV_EVT_OFFCAN_BSY_RESET: + dInterval = + gsGlobalInfo.sInitInfo.sWaitTime.dPollInterval[3]; + dTimeOut = + gsGlobalInfo.sInitInfo.sWaitTime.dPollTimeOut[3]; + bSlaveAddr = McDevProf_GetSlaveAddr(eMCDRV_SLAVE_ADDR_ANA); + abWriteData[0] = MCI_CD_REG_A<<1; + abWriteData[1] = MCI_SSENSEFIN; + McSrv_WriteReg(bSlaveAddr, abWriteData, 2); + sdRet = WaitBitRelease(bSlaveAddr, + (UINT16)MCI_CD_REG_D, + MCB_OFFCAN_BSY, + dInterval, dTimeOut); + break; + + case MCDRV_EVT_ANA_RDY: + dInterval = + gsGlobalInfo.sInitInfo.sWaitTime.dPollInterval[5]; + dTimeOut = + gsGlobalInfo.sInitInfo.sWaitTime.dPollTimeOut[5]; + bSlaveAddr = McDevProf_GetSlaveAddr(eMCDRV_SLAVE_ADDR_ANA); + abWriteData[0] = MCI_ANA_REG_A<<1; + abWriteData[1] = (UINT8)(dParam>>8); + McSrv_WriteReg(bSlaveAddr, abWriteData, 2); + sdRet = WaitBitSet(bSlaveAddr, + (UINT16)MCI_ANA_REG_D, + (UINT8)dParam&0xFF, + dInterval, dTimeOut); + break; + + case MCDRV_EVT_AP_CP_A_SET: + dInterval = + gsGlobalInfo.sInitInfo.sWaitTime.dPollInterval[5]; + dTimeOut = + gsGlobalInfo.sInitInfo.sWaitTime.dPollTimeOut[5]; + bSlaveAddr = McDevProf_GetSlaveAddr(eMCDRV_SLAVE_ADDR_ANA); + abWriteData[0] = MCI_ANA_REG_A<<1; + abWriteData[1] = (UINT8)(dParam>>8); + McSrv_WriteReg(bSlaveAddr, abWriteData, 2); + sdRet = WaitBitSet(bSlaveAddr, + (UINT16)MCI_ANA_REG_D, + (UINT8)dParam&0xFF, + dInterval, dTimeOut); + break; + + case MCDRV_EVT_IF_REG_FLAG_SET: + dInterval = + gsGlobalInfo.sInitInfo.sWaitTime.dPollInterval[3]; + dTimeOut = + gsGlobalInfo.sInitInfo.sWaitTime.dPollTimeOut[3]; + bSlaveAddr = McDevProf_GetSlaveAddr(eMCDRV_SLAVE_ADDR_DIG); + sdRet = WaitBitSet(bSlaveAddr, + (UINT16)(dParam>>8), + (UINT8)(dParam&(UINT8)0xFF), + dInterval, dTimeOut); + break; + case MCDRV_EVT_IF_REG_FLAG_RESET: + dInterval = + gsGlobalInfo.sInitInfo.sWaitTime.dPollInterval[3]; + dTimeOut = + gsGlobalInfo.sInitInfo.sWaitTime.dPollTimeOut[3]; + bSlaveAddr = McDevProf_GetSlaveAddr(eMCDRV_SLAVE_ADDR_DIG); + sdRet = WaitBitRelease(bSlaveAddr, + (UINT16)(dParam>>8), + (UINT8)(dParam&(UINT8)0xFF), + dInterval, dTimeOut); + break; + case MCDRV_EVT_B_REG_FLAG_SET: + dInterval = + gsGlobalInfo.sInitInfo.sWaitTime.dPollInterval[3]; + dTimeOut = + gsGlobalInfo.sInitInfo.sWaitTime.dPollTimeOut[3]; + bSlaveAddr = McDevProf_GetSlaveAddr(eMCDRV_SLAVE_ADDR_DIG); + sdRet = WaitDSPBitSet(bSlaveAddr, + MCI_B_REG_A, MCI_B_REG_D, + (UINT16)(dParam>>8), (UINT8)(dParam&0x00FF), + dInterval, dTimeOut); + break; + case MCDRV_EVT_B_REG_FLAG_RESET: + dInterval = + gsGlobalInfo.sInitInfo.sWaitTime.dPollInterval[3]; + dTimeOut = + gsGlobalInfo.sInitInfo.sWaitTime.dPollTimeOut[3]; + bSlaveAddr = McDevProf_GetSlaveAddr(eMCDRV_SLAVE_ADDR_DIG); + sdRet = WaitDSPBitRelease(bSlaveAddr, + MCI_B_REG_A, MCI_B_REG_D, + (UINT16)(dParam>>8), (UINT8)(dParam&0x00FF), + dInterval, dTimeOut); + break; + case MCDRV_EVT_E_REG_FLAG_SET: + dInterval = + gsGlobalInfo.sInitInfo.sWaitTime.dPollInterval[3]; + dTimeOut = + gsGlobalInfo.sInitInfo.sWaitTime.dPollTimeOut[3]; + bSlaveAddr = McDevProf_GetSlaveAddr(eMCDRV_SLAVE_ADDR_DIG); + sdRet = WaitDSPBitSet(bSlaveAddr, + MCI_E_REG_A, MCI_E_REG_D, + (UINT16)(dParam>>8), (UINT8)(dParam&0x00FF), + dInterval, dTimeOut); + break; + case MCDRV_EVT_E_REG_FLAG_RESET: + dInterval = + gsGlobalInfo.sInitInfo.sWaitTime.dPollInterval[3]; + dTimeOut = + gsGlobalInfo.sInitInfo.sWaitTime.dPollTimeOut[3]; + bSlaveAddr = McDevProf_GetSlaveAddr(eMCDRV_SLAVE_ADDR_DIG); + sdRet = WaitDSPBitRelease(bSlaveAddr, + MCI_E_REG_A, MCI_E_REG_D, + (UINT16)(dParam>>8), (UINT8)(dParam&0x00FF), + dInterval, dTimeOut); + break; + case MCDRV_EVT_C_REG_FLAG_SET: + dInterval = + gsGlobalInfo.sInitInfo.sWaitTime.dPollInterval[3]; + dTimeOut = + gsGlobalInfo.sInitInfo.sWaitTime.dPollTimeOut[3]; + bSlaveAddr = McDevProf_GetSlaveAddr(eMCDRV_SLAVE_ADDR_DIG); + sdRet = WaitDSPBitSet(bSlaveAddr, + MCI_C_REG_A, MCI_C_REG_D, + (UINT16)(dParam>>8), (UINT8)(dParam&0x00FF), + dInterval, dTimeOut); + break; + case MCDRV_EVT_C_REG_FLAG_RESET: + dInterval = + gsGlobalInfo.sInitInfo.sWaitTime.dPollInterval[3]; + dTimeOut = + gsGlobalInfo.sInitInfo.sWaitTime.dPollTimeOut[3]; + bSlaveAddr = McDevProf_GetSlaveAddr(eMCDRV_SLAVE_ADDR_DIG); + sdRet = WaitDSPBitRelease(bSlaveAddr, + MCI_C_REG_A, MCI_C_REG_D, + (UINT16)(dParam>>8), (UINT8)(dParam&0x00FF), + dInterval, dTimeOut); + break; + case MCDRV_EVT_F_REG_FLAG_SET: + dInterval = + gsGlobalInfo.sInitInfo.sWaitTime.dPollInterval[3]; + dTimeOut = + gsGlobalInfo.sInitInfo.sWaitTime.dPollTimeOut[3]; + bSlaveAddr = McDevProf_GetSlaveAddr(eMCDRV_SLAVE_ADDR_DIG); + sdRet = WaitDSPBitSet(bSlaveAddr, + MCI_F_REG_A, MCI_F_REG_D, + (UINT16)(dParam>>8), (UINT8)(dParam&0x00FF), + dInterval, dTimeOut); + break; + case MCDRV_EVT_F_REG_FLAG_RESET: + dInterval = + gsGlobalInfo.sInitInfo.sWaitTime.dPollInterval[3]; + dTimeOut = + gsGlobalInfo.sInitInfo.sWaitTime.dPollTimeOut[3]; + bSlaveAddr = McDevProf_GetSlaveAddr(eMCDRV_SLAVE_ADDR_DIG); + sdRet = WaitDSPBitRelease(bSlaveAddr, + MCI_F_REG_A, MCI_F_REG_D, + (UINT16)(dParam>>8), (UINT8)(dParam&0x00FF), + dInterval, dTimeOut); + break; + + default: + sdRet = MCDRV_ERROR_ARGUMENT; + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McResCtrl_WaitEvent", &sdRet); +#endif + + return sdRet; +} + +/**************************************************************************** + * WaitBitSet + * + * Description: + * Wait register bit to set. + * Arguments: + * bSlaveAddr slave address + * wRegAddr register address + * bBit bit + * dCycleTime cycle time to poll [us] + * dTimeOut number of read cycles for time out + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR_TIMEOUT + * + ****************************************************************************/ +static SINT32 WaitBitSet( + UINT8 bSlaveAddr, + UINT16 wRegAddr, + UINT8 bBit, + UINT32 dCycleTime, + UINT32 dTimeOut +) +{ + UINT8 bData; + UINT32 dCycles; + SINT32 sdRet; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("WaitBitSet"); +#endif + + + dCycles = 0; + sdRet = MCDRV_ERROR_TIMEOUT; + + while (dCycles < dTimeOut) { + bData = McSrv_ReadReg(bSlaveAddr, wRegAddr); + if ((bData & bBit) == bBit) { + sdRet = MCDRV_SUCCESS; + break; + } + + McSrv_Sleep(dCycleTime); + dCycles++; + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("WaitBitSet", &sdRet); +#endif + + return sdRet; +} + +/**************************************************************************** + * WaitBitRelease + * + * Description: + * Wait register bit to release. + * Arguments: + * bSlaveAddr slave address + * wRegAddr register address + * bBit bit + * dCycleTime cycle time to poll [us] + * dTimeOut number of read cycles for time out + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR_TIMEOUT + * + ****************************************************************************/ +static SINT32 WaitBitRelease( + UINT8 bSlaveAddr, + UINT16 wRegAddr, + UINT8 bBit, + UINT32 dCycleTime, + UINT32 dTimeOut +) +{ + UINT8 bData; + UINT32 dCycles; + SINT32 sdRet; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("WaitBitRelease"); +#endif + + + dCycles = 0; + sdRet = MCDRV_ERROR_TIMEOUT; + + while (dCycles < dTimeOut) { + bData = McSrv_ReadReg(bSlaveAddr, wRegAddr); + if (0 == (bData & bBit)) { + sdRet = MCDRV_SUCCESS; + break; + } + + McSrv_Sleep(dCycleTime); + dCycles++; + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("WaitBitRelease", &sdRet); +#endif + + return sdRet; +} + +/**************************************************************************** + * WaitDSPBitSet + * + * Description: + * Wait DSP register bit to set. + * Arguments: + * bSlaveAddr slave address + * wRegAddr_A IF register A address + * wRegAddr_D IF register D address + * wRegAddr register address + * bBit bit + * dCycleTime cycle time to poll [us] + * dTimeOut number of read cycles for time out + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR_TIMEOUT + * + ****************************************************************************/ +static SINT32 WaitDSPBitSet( + UINT8 bSlaveAddr, + UINT8 wRegAddr_A, + UINT8 wRegAddr_D, + UINT16 wRegAddr, + UINT8 bBit, + UINT32 dCycleTime, + UINT32 dTimeOut +) +{ + UINT8 bData; + UINT32 dCycles; + SINT32 sdRet; + UINT8 abWriteData[2]; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("WaitDSPBitSet"); +#endif + + + dCycles = 0; + sdRet = MCDRV_ERROR_TIMEOUT; + + abWriteData[0] = wRegAddr_A<<1; + abWriteData[1] = (UINT8)wRegAddr; + + while (dCycles < dTimeOut) { + McSrv_WriteReg(bSlaveAddr, abWriteData, 2); + bData = McSrv_ReadReg(bSlaveAddr, wRegAddr_D); + if ((bData & bBit) == bBit) { + sdRet = MCDRV_SUCCESS; + break; + } + + McSrv_Sleep(dCycleTime); + dCycles++; + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("WaitDSPBitSet", &sdRet); +#endif + + return sdRet; +} + +/**************************************************************************** + * WaitBitDSPRelease + * + * Description: + * Wait DSP register bit to release. + * Arguments: + * bSlaveAddr slave address + * wRegAddr_A IF register A address + * wRegAddr_D IF register D address + * wRegAddr register address + * bBit bit + * dCycleTime cycle time to poll [us] + * dTimeOut number of read cycles for time out + * Return: + * MCDRV_SUCCESS + * MCDRV_ERROR_TIMEOUT + * + ****************************************************************************/ +static SINT32 WaitDSPBitRelease( + UINT8 bSlaveAddr, + UINT8 wRegAddr_A, + UINT8 wRegAddr_D, + UINT16 wRegAddr, + UINT8 bBit, + UINT32 dCycleTime, + UINT32 dTimeOut +) +{ + UINT8 bData; + UINT32 dCycles; + SINT32 sdRet; + UINT8 abWriteData[2]; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("WaitCDSPBitRelease"); +#endif + + + dCycles = 0; + sdRet = MCDRV_ERROR_TIMEOUT; + + abWriteData[0] = wRegAddr_A<<1; + abWriteData[1] = (UINT8)wRegAddr; + + while (dCycles < dTimeOut) { + McSrv_WriteReg(bSlaveAddr, abWriteData, 2); + bData = McSrv_ReadReg(bSlaveAddr, wRegAddr_D); + if (0 == (bData & bBit)) { + sdRet = MCDRV_SUCCESS; + break; + } + + McSrv_Sleep(dCycleTime); + dCycles++; + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("WaitCDSPBitRelease", &sdRet); +#endif + + return sdRet; +} + +/**************************************************************************** + * McResCtrl_IsEnableIRQ + * + * Description: + * Is enable IRQ. + * Arguments: + * none + * Return: + * 0:Disable/1:Enable + * + ****************************************************************************/ +UINT8 McResCtrl_IsEnableIRQ( + void +) +{ + UINT8 bRet = 0; + +#if (MCDRV_DEBUG_LEVEL >= 4) + SINT32 sdRet; + McDebugLog_FuncIn("McResCtrl_IsEnableIRQ"); +#endif + +#if (MCDRV_DEBUG_LEVEL >= 4) + sdRet = bRet; + McDebugLog_FuncOut("McResCtrl_IsEnableIRQ", &sdRet); +#endif + return bRet; +} + diff --git a/sound/soc/codecs/ymu831/mcresctrl.h b/sound/soc/codecs/ymu831/mcresctrl.h new file mode 100644 index 00000000000..d8573c02286 --- /dev/null +++ b/sound/soc/codecs/ymu831/mcresctrl.h @@ -0,0 +1,497 @@ +/**************************************************************************** + * + * Copyright(c) 2012-2013 Yamaha Corporation. All rights reserved. + * + * Module : mcresctrl.h + * + * Description : MC Driver resource control header + * + * Version : 2.0.0 2013.04.04 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + * + ****************************************************************************/ + +#ifndef _MCRESCTRL_H_ +#define _MCRESCTRL_H_ + +#include "mcdevif.h" +#include "mcpacking.h" + +/* Slave Address */ +#define MCDRV_SLAVEADDR_ANA (0x3A) +#define MCDRV_SLAVEADDR_DIG (0x11) + +/* DEV_ID */ +#define MCDRV_DEVID_ANA (0x90) +#define MCDRV_DEVID_DIG (0x80) +#define MCDRV_DEVID_MASK (0xF0) +#define MCDRV_VERID_MASK (0x07) + +/* eState setting */ +enum MCDRV_STATE { + eMCDRV_STATE_NOTINIT, + eMCDRV_STATE_READY +}; + +/* volume setting */ +#define MCDRV_LOGICAL_VOL_MUTE (-24576) /* -96dB */ + +#define MCDRV_REG_MUTE (0x00) + +/* DIO port setting */ +enum MCDRV_DIO_PORT_NO { + eMCDRV_DIO_0 = 0, + eMCDRV_DIO_1, + eMCDRV_DIO_2, + eMCDRV_DIO_3 +}; + +/* Path destination setting */ +enum MCDRV_DST_CH { + eMCDRV_DST_CH0 = 0, + eMCDRV_DST_CH1, + eMCDRV_DST_CH2, + eMCDRV_DST_CH3 +}; + +enum MCDRV_DST_TYPE { + eMCDRV_DST_MUSICOUT = 0, + eMCDRV_DST_EXTOUT, + eMCDRV_DST_HIFIOUT, + eMCDRV_DST_VBOXMIXIN, + eMCDRV_DST_AE0, + eMCDRV_DST_AE1, + eMCDRV_DST_AE2, + eMCDRV_DST_AE3, + eMCDRV_DST_DAC0, + eMCDRV_DST_DAC1, + eMCDRV_DST_VOICEOUT, + eMCDRV_DST_VBOXIOIN, + eMCDRV_DST_VBOXHOSTIN, + eMCDRV_DST_HOSTOUT, + eMCDRV_DST_ADIF0, + eMCDRV_DST_ADIF1, + eMCDRV_DST_ADIF2, + eMCDRV_DST_ADC0, + eMCDRV_DST_ADC1, + eMCDRV_DST_SP, + eMCDRV_DST_HP, + eMCDRV_DST_RCV, + eMCDRV_DST_LOUT1, + eMCDRV_DST_LOUT2, + eMCDRV_DST_BIAS +}; + +/* Register accsess availability */ +enum MCDRV_REG_ACCSESS { + eMCDRV_ACCESS_DENY = 0, + eMCDRV_CAN_READ = 0x01, + eMCDRV_CAN_WRITE = 0x02, + eMCDRV_READ_WRITE = eMCDRV_CAN_READ | eMCDRV_CAN_WRITE +}; + +/* UpdateReg parameter */ +enum MCDRV_UPDATE_MODE { + eMCDRV_UPDATE_NORMAL, + eMCDRV_UPDATE_FORCE, + eMCDRV_UPDATE_DUMMY +}; + +/* ePacketBufAlloc setting */ +enum MCDRV_PACKETBUF_ALLOC { + eMCDRV_PACKETBUF_FREE, + eMCDRV_PACKETBUF_ALLOCATED +}; + +/* Power management mode */ +enum MCDRV_PMODE { + eMCDRV_APM_ON, + eMCDRV_APM_OFF +}; + +/* DSP Start */ +#define MCDRV_DSP_START_E (0x01) +#define MCDRV_DSP_START_B (0x02) +#define MCDRV_DSP_START_M (0x04) +#define MCDRV_DSP_START_F (0x08) +#define MCDRV_DSP_START_C (0x10) + +/* Register available num */ +#define MCDRV_REG_NUM_IF (59) +#define MCDRV_REG_NUM_A (68) +#define MCDRV_REG_NUM_MA (85) +#define MCDRV_REG_NUM_MB (86) +#define MCDRV_REG_NUM_B (72) +#define MCDRV_REG_NUM_E (101) +#define MCDRV_REG_NUM_C (160) +#define MCDRV_REG_NUM_F (128) +#define MCDRV_REG_NUM_ANA (116) +#define MCDRV_REG_NUM_CD (53) + +/* control packet for serial host interface */ +#define MCDRV_MAX_CTRL_DATA_NUM (MCDRV_MAX_PACKETS*4) +struct MCDRV_SERIAL_CTRL_PACKET { + UINT8 abData[MCDRV_MAX_CTRL_DATA_NUM]; + UINT16 wDataNum; +}; + +/* for AEC */ +struct MCDRV_AEC_B_DSP { + UINT8 *pbChunkData; + UINT32 dwSize; +}; + +struct MCDRV_AEC_F_DSP { + UINT8 *pbChunkData; + UINT32 dwSize; +}; + +struct MCDRV_AEC_C_DSP { + UINT8 *pbChunkData; + UINT32 dwSize; +}; + +struct MCDRV_AEC_C_DSP_DEBUG { + UINT8 bJtagOn; +}; + +struct MCDRV_AEC_SYSEQ_EX { + UINT8 bEnable; + struct { + UINT8 bCoef_A0[3]; + UINT8 bCoef_A1[3]; + UINT8 bCoef_A2[3]; + UINT8 bCoef_B1[3]; + UINT8 bCoef_B2[3]; + } sBand[2]; +}; + +struct MCDRV_AEC_E2_CONFIG { + UINT8 *pbChunkData; + UINT32 dwSize; +}; + +struct MCDRV_AEC_CONFIG { + UINT8 bFDspLocate; +}; + +struct MCDRV_AEC_AUDIOENGINE { + UINT8 bEnable; + UINT8 bAEOnOff; + UINT8 bFDspOnOff; + UINT8 bBDspAE0Src; + UINT8 bBDspAE1Src; + UINT8 bMixerIn0Src; + UINT8 bMixerIn1Src; + UINT8 bMixerIn2Src; + UINT8 bMixerIn3Src; + struct MCDRV_AEC_B_DSP sAecBDsp; + struct MCDRV_AEC_F_DSP sAecFDsp; +}; + +struct MCDRV_AEC_V_BOX { + UINT8 bEnable; + UINT8 bCDspFuncAOnOff; + UINT8 bCDspFuncBOnOff; + UINT8 bFDspOnOff; + UINT8 bFdsp_Po_Source; + UINT8 bISrc2_VSource; + UINT8 bISrc2_Ch1_VSource; + UINT8 bISrc3_VSource; + UINT8 bLPt2_VSource; + UINT8 bLPt2_Mix_VolO; + UINT8 bLPt2_Mix_VolI; + UINT8 bSrc3_Ctrl; + UINT8 bSrc2_Fs; + UINT8 bSrc2_Thru; + UINT8 bSrc3_Fs; + UINT8 bSrc3_Thru; + struct MCDRV_AEC_C_DSP sAecCDspA; + struct MCDRV_AEC_C_DSP sAecCDspB; + struct MCDRV_AEC_F_DSP sAecFDsp; + struct MCDRV_AEC_C_DSP_DEBUG sAecCDspDbg; +}; + +#define MCDRV_AEC_OUTPUT_N (2) +struct MCDRV_AEC_OUTPUT { + UINT8 bLpf_Pre_Thru[MCDRV_AEC_OUTPUT_N]; + UINT8 bLpf_Post_Thru[MCDRV_AEC_OUTPUT_N]; + UINT8 bDcc_Sel[MCDRV_AEC_OUTPUT_N]; + UINT8 bSig_Det_Lvl; + UINT8 bPow_Det_Lvl[MCDRV_AEC_OUTPUT_N]; + UINT8 bOsf_Sel[MCDRV_AEC_OUTPUT_N]; + UINT8 bSys_Eq_Enb[MCDRV_AEC_OUTPUT_N]; + UINT8 bSys_Eq_Coef_A0[MCDRV_AEC_OUTPUT_N][3]; + UINT8 bSys_Eq_Coef_A1[MCDRV_AEC_OUTPUT_N][3]; + UINT8 bSys_Eq_Coef_A2[MCDRV_AEC_OUTPUT_N][3]; + UINT8 bSys_Eq_Coef_B1[MCDRV_AEC_OUTPUT_N][3]; + UINT8 bSys_Eq_Coef_B2[MCDRV_AEC_OUTPUT_N][3]; + UINT8 bClip_Md[MCDRV_AEC_OUTPUT_N]; + UINT8 bClip_Att[MCDRV_AEC_OUTPUT_N]; + UINT8 bClip_Rel[MCDRV_AEC_OUTPUT_N]; + UINT8 bClip_G[MCDRV_AEC_OUTPUT_N]; + UINT8 bOsf_Gain[MCDRV_AEC_OUTPUT_N][2]; + UINT8 bDcl_OnOff[MCDRV_AEC_OUTPUT_N]; + UINT8 bDcl_Gain[MCDRV_AEC_OUTPUT_N]; + UINT8 bDcl_Limit[MCDRV_AEC_OUTPUT_N][2]; + UINT8 bRandom_Dither_OnOff[MCDRV_AEC_OUTPUT_N]; + UINT8 bRandom_Dither_Level[MCDRV_AEC_OUTPUT_N]; + UINT8 bRandom_Dither_POS[MCDRV_AEC_OUTPUT_N]; + UINT8 bDc_Dither_OnOff[MCDRV_AEC_OUTPUT_N]; + UINT8 bDc_Dither_Level[MCDRV_AEC_OUTPUT_N]; + UINT8 bDither_Type[MCDRV_AEC_OUTPUT_N]; + UINT8 bDng_On[MCDRV_AEC_OUTPUT_N]; + UINT8 bDng_Zero[MCDRV_AEC_OUTPUT_N]; + UINT8 bDng_Time[MCDRV_AEC_OUTPUT_N]; + UINT8 bDng_Fw[MCDRV_AEC_OUTPUT_N]; + UINT8 bDng_Attack; + UINT8 bDng_Release; + UINT8 bDng_Target[MCDRV_AEC_OUTPUT_N]; + UINT8 bDng_Target_LineOut[MCDRV_AEC_OUTPUT_N]; + UINT8 bDng_Target_Rc; + struct MCDRV_AEC_SYSEQ_EX sSysEqEx[MCDRV_AEC_OUTPUT_N]; +}; + +#define MCDRV_AEC_INPUT_N (3) +struct MCDRV_AEC_INPUT { + UINT8 bDsf32_L_Type[MCDRV_AEC_INPUT_N]; + UINT8 bDsf32_R_Type[MCDRV_AEC_INPUT_N]; + UINT8 bDsf4_Sel[MCDRV_AEC_INPUT_N]; + UINT8 bDcc_Sel[MCDRV_AEC_INPUT_N]; + UINT8 bDng_On[MCDRV_AEC_INPUT_N]; + UINT8 bDng_Att[MCDRV_AEC_INPUT_N]; + UINT8 bDng_Rel[MCDRV_AEC_INPUT_N]; + UINT8 bDng_Fw[MCDRV_AEC_INPUT_N]; + UINT8 bDng_Tim[MCDRV_AEC_INPUT_N]; + UINT8 bDng_Zero[MCDRV_AEC_INPUT_N][2]; + UINT8 bDng_Tgt[MCDRV_AEC_INPUT_N][2]; + UINT8 bDepop_Att[MCDRV_AEC_INPUT_N]; + UINT8 bDepop_Wait[MCDRV_AEC_INPUT_N]; + UINT8 bRef_Sel; +}; + +struct MCDRV_AEC_PDM { + UINT8 bMode; + UINT8 bStWait; + UINT8 bPdm0_LoadTim; + UINT8 bPdm0_LFineDly; + UINT8 bPdm0_RFineDly; + UINT8 bPdm1_LoadTim; + UINT8 bPdm1_LFineDly; + UINT8 bPdm1_RFineDly; + UINT8 bPdm0_Data_Delay; + UINT8 bPdm1_Data_Delay; +}; + +struct MCDRV_AEC_E2 { + UINT8 bEnable; + UINT8 bE2_Da_Sel; + UINT8 bE2_Ad_Sel; + UINT8 bE2OnOff; + struct MCDRV_AEC_E2_CONFIG sE2Config; +}; +struct MCDRV_AEC_ADJ { + UINT8 bHold; + UINT8 bCnt; + UINT8 bMax[2]; +}; + +struct MCDRV_AEC_EDSP_MISC { + UINT8 bI2SOut_Enb; + UINT8 bChSel; + UINT8 bLoopBack; +}; + +struct MCDRV_AEC_CONTROL { + UINT8 bCommand; + UINT8 bParam[4]; +}; + +struct MCDRV_AEC_INFO { + struct MCDRV_AEC_CONFIG sAecConfig; + struct MCDRV_AEC_AUDIOENGINE sAecAudioengine; + struct MCDRV_AEC_V_BOX sAecVBox; + struct MCDRV_AEC_OUTPUT sOutput; + struct MCDRV_AEC_INPUT sInput; + struct MCDRV_AEC_PDM sPdm; + struct MCDRV_AEC_E2 sE2; + struct MCDRV_AEC_ADJ sAdj; + struct MCDRV_AEC_EDSP_MISC sEDspMisc; + struct MCDRV_AEC_CONTROL sControl; +}; + +/* global information */ +struct MCDRV_GLOBAL_INFO { + UINT8 bHwId; + enum MCDRV_PACKETBUF_ALLOC ePacketBufAlloc; + UINT8 abRegValIF[MCDRV_REG_NUM_IF]; + UINT8 abRegValA[MCDRV_REG_NUM_A]; + UINT8 abRegValMA[MCDRV_REG_NUM_MA]; + UINT8 abRegValMB[MCDRV_REG_NUM_MB]; + UINT8 abRegValB[MCDRV_REG_NUM_B]; + UINT8 abRegValE[MCDRV_REG_NUM_E]; + UINT8 abRegValC[MCDRV_REG_NUM_C]; + UINT8 abRegValF[MCDRV_REG_NUM_F]; + UINT8 abRegValANA[MCDRV_REG_NUM_ANA]; + UINT8 abRegValCD[MCDRV_REG_NUM_CD]; + + struct MCDRV_INIT_INFO sInitInfo; + struct MCDRV_INIT2_INFO sInit2Info; + struct MCDRV_CLOCKSW_INFO sClockSwInfo; + struct MCDRV_PATH_INFO sPathInfo; + struct MCDRV_PATH_INFO sPathInfoVirtual; + struct MCDRV_VOL_INFO sVolInfo; + struct MCDRV_DIO_INFO sDioInfo; + struct MCDRV_DIOPATH_INFO sDioPathInfo; + struct MCDRV_SWAP_INFO sSwapInfo; + struct MCDRV_HSDET_INFO sHSDetInfo; + struct MCDRV_HSDET2_INFO sHSDet2Info; + struct MCDRV_AEC_INFO sAecInfo; + SINT32(*pcbfunc)(SINT32, UINT32, UINT32); + struct MCDRV_GP_MODE sGpMode; + UINT8 abGpMask[3]; + UINT8 abGpPad[3]; + UINT8 bClkSel; + UINT8 bEClkSel; + UINT8 bCClkSel; + UINT8 bFClkSel; + UINT8 bPlugDetDB; + + struct MCDRV_SERIAL_CTRL_PACKET sCtrlPacket; + UINT16 wCurSlaveAddr; + UINT16 wCurRegType; + UINT16 wCurRegAddr; + UINT16 wDataContinueCount; + UINT16 wPrevAddrIndex; + + enum MCDRV_PMODE eAPMode; +}; + + + +SINT32 McResCtrl_SetHwId(UINT8 bHwId_dig, UINT8 bHwId_ana); +void McResCtrl_Init(void); +void McResCtrl_InitABlockReg(void); +void McResCtrl_InitMBlockReg(void); +void McResCtrl_InitEReg(void); +void McResCtrl_SetRegDefault(void); +void McResCtrl_UpdateState(enum MCDRV_STATE eState); +enum MCDRV_STATE McResCtrl_GetState(void); +UINT8 McResCtrl_GetRegVal(UINT16 wRegType, UINT16 wRegAddr); +void McResCtrl_SetRegVal(UINT16 wRegType, + UINT16 wRegAddr, UINT8 bRegVal); + +void McResCtrl_SetInitInfo( + const struct MCDRV_INIT_INFO *psInitInfo, + const struct MCDRV_INIT2_INFO *psInit2Info); +void McResCtrl_GetInitInfo(struct MCDRV_INIT_INFO *psInitInfo, + struct MCDRV_INIT2_INFO *psInit2Info); +void McResCtrl_SetClockSwInfo( + const struct MCDRV_CLOCKSW_INFO *psClockSwInfo); +void McResCtrl_GetClockSwInfo( + struct MCDRV_CLOCKSW_INFO *psClockSwInfo); +SINT32 McResCtrl_SetPathInfo( + const struct MCDRV_PATH_INFO *psPathInfo); +void McResCtrl_GetPathInfo(struct MCDRV_PATH_INFO *psPathInfo); +void McResCtrl_GetPathInfoVirtual( + struct MCDRV_PATH_INFO *psPathInfo); +void McResCtrl_SetVolInfo(const struct MCDRV_VOL_INFO *psVolInfo); +void McResCtrl_GetVolInfo(struct MCDRV_VOL_INFO *psVolInfo); +void McResCtrl_SetDioInfo(const struct MCDRV_DIO_INFO *psDioInfo, + UINT32 dUpdateInfo); +void McResCtrl_GetDioInfo(struct MCDRV_DIO_INFO *psDioInfo); +void McResCtrl_SetDioPathInfo( + const struct MCDRV_DIOPATH_INFO *psDioPathInfo, + UINT32 dUpdateInfo); +void McResCtrl_GetDioPathInfo( + struct MCDRV_DIOPATH_INFO *psDioPathInfo); +void McResCtrl_SetSwap( + const struct MCDRV_SWAP_INFO *psSwapInfo, + UINT32 dUpdateInfo); +void McResCtrl_GetSwap(struct MCDRV_SWAP_INFO *psSwapInfo); +void McResCtrl_SetHSDet( + const struct MCDRV_HSDET_INFO *psHSDetInfo, + const struct MCDRV_HSDET2_INFO *psHSDet2Info, + UINT32 dUpdateInfo); +void McResCtrl_GetHSDet(struct MCDRV_HSDET_INFO *psHSDetInfo, + struct MCDRV_HSDET2_INFO *psHSDet2Info); +void McResCtrl_SetAecInfo( + const struct MCDRV_AEC_INFO *psAecInfo); +void McResCtrl_ReplaceAecInfo( + const struct MCDRV_AEC_INFO *psAecInfo); +void McResCtrl_GetAecInfo(struct MCDRV_AEC_INFO *psAecInfo); +void McResCtrl_SetDSPCBFunc( + SINT32 (*pcbfunc)(SINT32, UINT32, UINT32)); +void McResCtrl_GetDSPCBFunc( + SINT32 (**pcbfunc)(SINT32, UINT32, UINT32)); +void McResCtrl_SetGPMode(const struct MCDRV_GP_MODE *psGpMode); +void McResCtrl_GetGPMode(struct MCDRV_GP_MODE *psGpMode); +void McResCtrl_SetGPMask(UINT8 bMask, UINT32 dPadNo); +UINT8 McResCtrl_GetGPMask(UINT32 dPadNo); +void McResCtrl_SetGPPad(UINT8 bPad, UINT32 dPadNo); +UINT8 McResCtrl_GetGPPad(UINT32 dPadNo); + +void McResCtrl_SetClkSel(UINT8 bClkSel); +UINT8 McResCtrl_GetClkSel(void); +void McResCtrl_SetEClkSel(UINT8 bEClkSel); +UINT8 McResCtrl_GetEClkSel(void); +void McResCtrl_SetCClkSel(UINT8 bCClkSel); +UINT8 McResCtrl_GetCClkSel(void); +void McResCtrl_SetFClkSel(UINT8 bFClkSel); +UINT8 McResCtrl_GetFClkSel(void); +void McResCtrl_SetPlugDetDB(UINT8 bPlugDetDB); +UINT8 McResCtrl_GetPlugDetDB(void); + +void McResCtrl_GetVolReg(struct MCDRV_VOL_INFO *psVolInfo); +SINT16 McResCtrl_GetDigitalVolReg(SINT32 sdVol); +void McResCtrl_GetPowerInfo(struct MCDRV_POWER_INFO *psPowerInfo); +void McResCtrl_GetPowerInfoRegAccess( + const struct MCDRV_REG_INFO *psRegInfo, + struct MCDRV_POWER_INFO *psPowerInfo); +void McResCtrl_GetCurPowerInfo( + struct MCDRV_POWER_INFO *psPowerInfo); +UINT8 McResCtrl_IsD1SrcUsed(UINT32 dSrcOnOff); +UINT8 McResCtrl_IsD2SrcUsed(UINT32 dSrcOnOff); +UINT8 McResCtrl_IsASrcUsed(UINT32 dSrcOnOff); + +UINT8 McResCtrl_HasSrc(enum MCDRV_DST_TYPE eType, + enum MCDRV_DST_CH eCh); +UINT32 McResCtrl_GetSource(enum MCDRV_DST_TYPE eType, + enum MCDRV_DST_CH eCh); +UINT8 McResCtrl_GetDspStart(void); + +enum MCDRV_REG_ACCSESS McResCtrl_GetRegAccess( + const struct MCDRV_REG_INFO *psRegInfo); + +enum MCDRV_PMODE McResCtrl_GetAPMode(void); + +struct MCDRV_PACKET *McResCtrl_AllocPacketBuf(void); +void McResCtrl_ReleasePacketBuf(void); + +void McResCtrl_InitRegUpdate(void); +void McResCtrl_AddRegUpdate(UINT16 wRegType, + UINT16 wAddress, + UINT8 bData, + enum MCDRV_UPDATE_MODE eUpdateMode); +void McResCtrl_ExecuteRegUpdate(void); +SINT32 McResCtrl_WaitEvent(UINT32 dEvent, UINT32 dParam); + +UINT8 McResCtrl_IsEnableIRQ(void); + + +#endif /* _MCRESCTRL_H_ */ diff --git a/sound/soc/codecs/ymu831/mcservice.c b/sound/soc/codecs/ymu831/mcservice.c new file mode 100644 index 00000000000..3e93291b151 --- /dev/null +++ b/sound/soc/codecs/ymu831/mcservice.c @@ -0,0 +1,407 @@ +/**************************************************************************** + * + * Copyright(c) 2012 Yamaha Corporation. All rights reserved. + * + * Module : mcservice.c + * + * Description : MC Driver service routine + * + * Version : 1.0.0 2012.12.13 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + * + ****************************************************************************/ + + +#include "mcdefs.h" +#include "mcservice.h" +#include "mcmachdep.h" +#include "mcresctrl.h" +#include "mcdevprof.h" +#if (MCDRV_DEBUG_LEVEL >= 4) +#include "mcdebuglog.h" +#endif + + +/**************************************************************************** + * McSrv_SystemInit + * + * Description: + * Initialize the system. + * Arguments: + * none + * Return: + * none + * + ****************************************************************************/ +void McSrv_SystemInit( + void +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McSrv_SystemInit"); +#endif + + machdep_SystemInit(); + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McSrv_SystemInit", 0); +#endif +} + +/**************************************************************************** + * McSrv_SystemTerm + * + * Description: + * Terminate the system. + * Arguments: + * none + * Return: + * none + * + ****************************************************************************/ +void McSrv_SystemTerm( + void +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McSrv_SystemTerm"); +#endif + + machdep_SystemTerm(); + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McSrv_SystemTerm", 0); +#endif +} + +/**************************************************************************** + * McSrv_ClockStart + * + * Description: + * Start clock. + * Arguments: + * none + * Return: + * none + * + ****************************************************************************/ +void McSrv_ClockStart( + void +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McSrv_ClockStart"); +#endif + + machdep_ClockStart(); + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McSrv_ClockStart", 0); +#endif +} + +/**************************************************************************** + * McSrv_ClockStop + * + * Description: + * Stop clock. + * Arguments: + * none + * Return: + * none + * + ****************************************************************************/ +void McSrv_ClockStop( + void +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McSrv_ClockStop"); +#endif + + machdep_ClockStop(); + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McSrv_ClockStop", 0); +#endif +} + +/**************************************************************************** + * McSrv_WriteReg + * + * Description: + * Write data to register. + * Arguments: + * bSlaveAddr slave address + * pbData data + * dSize data size + * Return: + * none + * + ****************************************************************************/ +void McSrv_WriteReg( + UINT8 bSlaveAddr, + UINT8 *pbData, + UINT32 dSize +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McSrv_WriteReg"); +#endif + + McSrv_DisableIrq(); + machdep_WriteReg(bSlaveAddr, pbData, dSize); + McSrv_EnableIrq(); + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McSrv_WriteReg", 0); +#endif +} + +/**************************************************************************** + * McSrv_ReadReg + * + * Function: + * Read a byte data from the register. + * Arguments: + * bSlaveAddr slave address + * dRegAddr address of register + * Return: + * read data + * + ****************************************************************************/ +UINT8 McSrv_ReadReg( + UINT8 bSlaveAddr, + UINT32 dRegAddr +) +{ + UINT8 bReg; + +#if (MCDRV_DEBUG_LEVEL >= 4) + SINT32 sdRet; + McDebugLog_FuncIn("McSrv_ReadReg"); +#endif + + McSrv_DisableIrq(); + machdep_ReadReg(bSlaveAddr, dRegAddr, &bReg, 1); + McSrv_EnableIrq(); + +#if (MCDRV_DEBUG_LEVEL >= 4) + sdRet = (SINT32)bReg; + McDebugLog_FuncOut("McSrv_ReadReg", &sdRet); +#endif + + return bReg; +} + +/**************************************************************************** + * McSrv_ReadRegN + * + * Function: + * Read a byte data from the register. + * Arguments: + * bSlaveAddr slave address + * dRegAddr address of register + * pbData pointer to read data buffer + * dSize read count + * Return: + * none + * + ****************************************************************************/ +void McSrv_ReadRegN( + UINT8 bSlaveAddr, + UINT32 dRegAddr, + UINT8 *pbData, + UINT32 dSize +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + SINT32 sdRet; + McDebugLog_FuncIn("McSrv_ReadRegN"); +#endif + McSrv_DisableIrq(); + machdep_ReadReg(bSlaveAddr, dRegAddr, pbData, dSize); + McSrv_EnableIrq(); + +#if (MCDRV_DEBUG_LEVEL >= 4) + sdRet = (SINT32)dSize; + McDebugLog_FuncOut("McSrv_ReadRegN", &sdRet); +#endif +} + +/*************************************************************************** + * McSrv_Sleep + * + * Function: + * Sleep for a specified interval. + * Arguments: + * dSleepTime sleep time [us] + * Return: + * none + * + ****************************************************************************/ +void McSrv_Sleep( + UINT32 dSleepTime +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McSrv_Sleep"); +#endif + + machdep_Sleep(dSleepTime); + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McSrv_Sleep", 0); +#endif +} + +/**************************************************************************** + * McSrv_Lock + * + * Description: + * Lock a call of the driver. + * Arguments: + * none + * Return: + * none + * + ****************************************************************************/ +void McSrv_Lock( + void +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McSrv_Lock"); +#endif + + machdep_Lock(); + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McSrv_Lock", 0); +#endif +} + +/*************************************************************************** + * McSrv_Unlock + * + * Function: + * Unlock a call of the driver. + * Arguments: + * none + * Return: + * none + * + ****************************************************************************/ +void McSrv_Unlock( + void +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McSrv_Unlock"); +#endif + + machdep_Unlock(); + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McSrv_Unlock", 0); +#endif +} + +/*************************************************************************** + * McSrv_MemCopy + * + * Function: + * Copy memory. + * Arguments: + * pbSrc copy source + * pbDest copy destination + * dSize size + * Return: + * none + * + ****************************************************************************/ +void McSrv_MemCopy( + const UINT8 *pbSrc, + UINT8 *pbDest, + UINT32 dSize +) +{ + UINT32 i; + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McSrv_MemCopy"); +#endif + + for (i = 0; i < dSize; i++) { + ; + pbDest[i] = pbSrc[i]; + } + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McSrv_MemCopy", 0); +#endif +} + +/*************************************************************************** + * McSrv_DisableIrq + * + * Function: + * Disable interrupt. + * Arguments: + * none + * Return: + * none + * + ****************************************************************************/ +void McSrv_DisableIrq( + void +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McSrv_DisableIrq"); +#endif + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McSrv_DisableIrq", 0); +#endif +} + +/*************************************************************************** + * McSrv_EnableIrq + * + * Function: + * Enable interrupt. + * Arguments: + * none + * Return: + * none + * + ****************************************************************************/ +void McSrv_EnableIrq( + void +) +{ +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncIn("McSrv_EnableIrq"); +#endif + +#if (MCDRV_DEBUG_LEVEL >= 4) + McDebugLog_FuncOut("McSrv_EnableIrq", 0); +#endif +} + diff --git a/sound/soc/codecs/ymu831/mcservice.h b/sound/soc/codecs/ymu831/mcservice.h new file mode 100644 index 00000000000..807dca3e726 --- /dev/null +++ b/sound/soc/codecs/ymu831/mcservice.h @@ -0,0 +1,52 @@ +/**************************************************************************** + * + * Copyright(c) 2012 Yamaha Corporation. All rights reserved. + * + * Module : mcservice.h + * + * Description : MC Driver service routine header + * + * Version : 1.0.0 2012.12.13 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + * + ****************************************************************************/ + +#ifndef _MCSERVICE_H_ +#define _MCSERVICE_H_ + +#include "mctypedef.h" + + +void McSrv_SystemInit(void); +void McSrv_SystemTerm(void); +void McSrv_ClockStart(void); +void McSrv_ClockStop(void); +void McSrv_WriteReg(UINT8 bSlaveAddr, UINT8 *pbData, UINT32 dSize); +UINT8 McSrv_ReadReg(UINT8 bSlaveAddr, UINT32 dRegAddr); +void McSrv_ReadRegN(UINT8 bSlaveAddr, UINT32 dRegAddr, UINT8 *pbData, + UINT32 dSize); +void McSrv_Sleep(UINT32 dSleepTime); +void McSrv_Lock(void); +void McSrv_Unlock(void); +void McSrv_MemCopy(const UINT8 *pbSrc, UINT8 *pbDest, UINT32 dSize); +void McSrv_DisableIrq(void); +void McSrv_EnableIrq(void); + + + +#endif /* _MCSERVICE_H_ */ diff --git a/sound/soc/codecs/ymu831/mctypedef.h b/sound/soc/codecs/ymu831/mctypedef.h new file mode 100644 index 00000000000..054e0d5f7c7 --- /dev/null +++ b/sound/soc/codecs/ymu831/mctypedef.h @@ -0,0 +1,54 @@ +/**************************************************************************** + * + * Copyright(c) 2012 Yamaha Corporation. All rights reserved. + * + * Module : mctypedef.h + * + * Description : MC Device Type definitions + * + * Version : 1.0.0 2012.12.13 + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + * + ****************************************************************************/ + +#ifndef _MCTYPEDEF_H_ +#define _MCTYPEDEF_H_ + +#ifndef NULL + #define NULL ((void *)0) +#endif +#ifndef UINT8 + #define UINT8 unsigned char +#endif +#ifndef UINT16 + #define UINT16 unsigned short +#endif +#ifndef UINT32 + #define UINT32 unsigned long +#endif +#ifndef SINT8 + #define SINT8 signed char +#endif +#ifndef SINT16 + #define SINT16 signed short +#endif +#ifndef SINT32 + #define SINT32 signed long +#endif + +#endif /*_MCTYPEDEF_H_*/ diff --git a/sound/soc/codecs/ymu831/ymu831.c b/sound/soc/codecs/ymu831/ymu831.c new file mode 100644 index 00000000000..17f811fda0c --- /dev/null +++ b/sound/soc/codecs/ymu831/ymu831.c @@ -0,0 +1,9667 @@ +/* + * YMU831 ASoC codec driver + * + * Copyright (c) 2012-2013 Yamaha Corporation + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + */ + +#include <linux/delay.h> +#include <linux/errno.h> +#include <linux/slab.h> +#include <linux/irq.h> +#include <linux/gpio.h> +#include <linux/of_gpio.h> +#include <linux/init.h> +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/mutex.h> +#include <linux/platform_device.h> +#include <linux/io.h> +#ifdef CONFIG_SWITCH +#include <linux/switch.h> +#endif +#include <linux/types.h> +#include <linux/workqueue.h> +#include <sound/hwdep.h> +#include <sound/initval.h> +#include <sound/pcm.h> +#include <sound/pcm_params.h> +#include <sound/soc.h> +#include <sound/soc-dapm.h> +#include <sound/tlv.h> +#include <sound/jack.h> + +#include "ymu831_cfg.h" +#include "ymu831_path_cfg.h" +#include "ymu831.h" +#include "ymu831_priv.h" +#include "mcdefs.h" +#include "mcresctrl.h" +#include <linux/spi/spi.h> + +#define MC_ASOC_DRIVER_VERSION "2.0.1" + +#define MC_ASOC_IMPCLASS_THRESHOLD 3 + +#define MC_ASOC_RATE (SNDRV_PCM_RATE_8000_192000) +#define MC_ASOC_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | \ + SNDRV_PCM_FMTBIT_S20_3LE | \ + SNDRV_PCM_FMTBIT_S24_LE | \ + SNDRV_PCM_FMTBIT_S24_3LE | \ + SNDRV_PCM_FMTBIT_S32_LE) + +#define MC_ASOC_HWDEP_ID "ymu831" + +#define get_port_id(id) (id-1) +#define PORT_MUSIC (0) +#define PORT_EXT (1) +#define PORT_VOICE (2) +#define PORT_HIFI (3) + +#define DIO_MUSIC (0) +#define DIO_VOICE (1) +#define DIO_EXT (2) +#define LOUT1 (3) +#define LOUT2 (4) +#define LIN1 (3) +#define LIN1_LOUT1 (3) +#define LIN1_LOUT2 (5) + +#define DSP_PRM_OUTPUT (0) +#define DSP_PRM_INPUT (1) +#define DSP_PRM_VC_1MIC (2) +#define DSP_PRM_VC_2MIC (3) +#define DSP_PRM_BASE (0) +#define DSP_PRM_USER (1) + +#define MICOPEN_4POLE + +struct mc_asoc_info_store { + UINT32 get; + UINT32 set; + size_t offset; + UINT32 flags; +}; +static const struct mc_asoc_info_store info_store_tbl[] = { + { + MCDRV_GET_CLOCKSW, + MCDRV_SET_CLOCKSW, + offsetof(struct mc_asoc_data, clocksw_store), + 0 + }, + { + MCDRV_GET_DIGITALIO, + MCDRV_SET_DIGITALIO, + offsetof(struct mc_asoc_data, dio_store), + 0xfff + }, + { + MCDRV_GET_DIGITALIO_PATH, + MCDRV_SET_DIGITALIO_PATH, + offsetof(struct mc_asoc_data, diopath_store), + 0x7ff + }, + { + MCDRV_GET_PATH, MCDRV_SET_PATH, + offsetof(struct mc_asoc_data, path_store), + 0 + }, + { + MCDRV_GET_VOLUME, + MCDRV_SET_VOLUME, + offsetof(struct mc_asoc_data, vol_store), + 0 + }, + { + MCDRV_GET_SWAP, + MCDRV_SET_SWAP, + offsetof(struct mc_asoc_data, swap_store), + 0x7fff + }, +}; +#define MC_ASOC_N_INFO_STORE \ + (sizeof(info_store_tbl) / sizeof(struct mc_asoc_info_store)) + +static const char * const firmware_name[] = { + "", /* dummy */ + "aec_config.dat", + "aec_control_path_off.dat", + "aec_control_path_resume.dat", + "aec_hp_dac0.dat", + "aec_line1_dac0.dat", + "aec_line2_dac1.dat", + "aec_rc_dac0.dat", + "aec_sp_dac1.dat", + "aec_adc.dat", + "aec_hf50_vbox_nb.dat", + "aec_hf50_vbox_wb.dat", + "aec_hf50_chsel.dat", + "aec_hf50_nb_type0_rc_2mic_2.dat", + "aec_hf50_nb_type0_sp_2mic_2.dat", + "aec_hf50_nb_type1_rc_2mic_2.dat", + "aec_hf50_nb_type1_sp_2mic_2.dat", + "aec_hf50_wb_type0_rc_2mic_2.dat", + "aec_hf50_wb_type0_sp_2mic_2.dat", + "aec_hf50_wb_type1_rc_2mic_2.dat", + "aec_hf50_wb_type1_sp_2mic_2.dat", + "aec_hf50_vt_nb_type0_rc_2mic_2.dat", + "aec_hf50_vt_nb_type0_sp_2mic_2.dat", + "aec_hf50_vt_nb_type1_rc_2mic_2.dat", + "aec_hf50_vt_nb_type1_sp_2mic_2.dat", + "aec_hf50_vt_wb_type0_rc_2mic_2.dat", + "aec_hf50_vt_wb_type0_sp_2mic_2.dat", + "aec_hf50_vt_wb_type1_rc_2mic_2.dat", + "aec_hf50_vt_wb_type1_sp_2mic_2.dat", + "aec_hf50_wb_svoice_2.dat", + "aec_hf50_wb_svoicecar_2.dat", +}; + +/* volmap for Digital Volumes */ +static const SINT16 volmap_digital[] = { + 0xa000, 0xa100, 0xa200, 0xa300, 0xa400, 0xa500, 0xa600, 0xa700, + 0xa800, 0xa900, 0xaa00, 0xab00, 0xac00, 0xad00, 0xae00, 0xaf00, + 0xb000, 0xb100, 0xb200, 0xb300, 0xb400, 0xb500, 0xb600, 0xb700, + 0xb800, 0xb900, 0xba00, 0xbb00, 0xbc00, 0xbd00, 0xbe00, 0xbf00, + 0xc000, 0xc100, 0xc200, 0xc300, 0xc400, 0xc500, 0xc600, 0xc700, + 0xc800, 0xc900, 0xca00, 0xcb00, 0xcc00, 0xcd00, 0xce00, 0xcf00, + 0xd000, 0xd100, 0xd200, 0xd300, 0xd400, 0xd500, 0xd600, 0xd700, + 0xd800, 0xd900, 0xda00, 0xdb00, 0xdc00, 0xdd00, 0xde00, 0xdf00, + 0xe000, 0xe100, 0xe200, 0xe300, 0xe400, 0xe500, 0xe600, 0xe700, + 0xe800, 0xe900, 0xea00, 0xeb00, 0xec00, 0xed00, 0xee00, 0xef00, + 0xf000, 0xf100, 0xf200, 0xf300, 0xf400, 0xf500, 0xf600, 0xf700, + 0xf800, 0xf900, 0xfa00, 0xfb00, 0xfc00, 0xfd00, 0xfe00, 0xff00, + 0x0000, 0x0100, 0x0200, 0x0300, 0x0400, 0x0500, 0x0600, 0x0700, + 0x0800, 0x0900, 0x0a00, 0x0b00, 0x0c00, 0x0d00, 0x0e00, 0x0f00, + 0x1000, 0x1100, 0x1200 +}; + +/* volmap for LINE/MIC Input Volumes */ +static const SINT16 volmap_ain[] = { + 0xa000, 0xa000, 0xa000, 0xe200, 0xe300, 0xe400, 0xe500, 0xe600, + 0xe700, 0xe800, 0xe900, 0xea00, 0xeb00, 0xec00, 0xed00, 0xee00, + 0xef00, 0xf000, 0xf100, 0xf200, 0xf300, 0xf400, 0xf500, 0xf600, + 0xf700, 0xf800, 0xf900, 0xfa00, 0xfb00, 0xfc00, 0xfd00, 0xfe00, + 0xff00, 0x0000, 0x0100, 0x0200, 0x0300, 0x0400, 0x0500, 0x0600, + 0x0700, 0x0800, 0x0900, 0x0a00, 0x0b00, 0x0c00, 0x0d00, 0x0e00, + 0x0f00, 0x1000, 0x1100, 0x1200, 0x1300, 0x1400, 0x1500, 0x1580, + 0x1600, 0x1680, 0x1700, 0x1780, 0x1800, 0x1a00, 0x1c00, 0x1e00 +}; + +/* volmap for Analog Output Volumes */ +static const SINT16 volmap_aout[] = { + 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, + 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, + 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, + 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, + 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, + 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xdc00, + 0xdd00, 0xde00, 0xdf00, 0xe000, 0xe100, 0xe200, 0xe300, 0xe400, + 0xe500, 0xe600, 0xe700, 0xe800, 0xe900, 0xea00, 0xeb00, 0xec00, + 0xed00, 0xee00, 0xef00, 0xf000, 0xf080, 0xf100, 0xf180, 0xf200, + 0xf280, 0xf300, 0xf380, 0xf400, 0xf480, 0xf500, 0xf580, 0xf600, + 0xf680, 0xf700, 0xf780, 0xf800, 0xf880, 0xf900, 0xf980, 0xfa00, + 0xfa40, 0xfa80, 0xfac0, 0xfb00, 0xfb40, 0xfb80, 0xfbc0, 0xfc00, + 0xfc40, 0xfc80, 0xfcc0, 0xfd00, 0xfd40, 0xfd80, 0xfdc0, 0xfe00, + 0xfe40, 0xfe80, 0xfec0, 0xff00, 0xff40, 0xff80, 0xffc0, 0x0000 +}; + +/* volmap for SP Volumes */ +static const SINT16 volmap_sp[5][128] = { + { + 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, + 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, + 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, + 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, + 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, + 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xdc00, + 0xdd00, 0xde00, 0xdf00, 0xe000, 0xe100, 0xe200, 0xe300, 0xe400, + 0xe500, 0xe600, 0xe700, 0xe800, 0xe900, 0xea00, 0xeb00, 0xec00, + 0xed00, 0xee00, 0xef00, 0xf000, 0xf080, 0xf100, 0xf180, 0xf200, + 0xf280, 0xf300, 0xf380, 0xf400, 0xf480, 0xf500, 0xf580, 0xf600, + 0xf680, 0xf700, 0xf780, 0xf800, 0xf880, 0xf900, 0xf980, 0xfa00, + 0xfa40, 0xfa80, 0xfac0, 0xfb00, 0xfb40, 0xfb80, 0xfbc0, 0xfc00, + 0xfc40, 0xfc80, 0xfcc0, 0xfd00, 0xfd40, 0xfd80, 0xfdc0, 0xfe00, + 0xfe40, 0xfe80, 0xfec0, 0xff00, 0xff40, 0xff80, 0xffc0, 0x0000, + 0x0040, 0x0080, 0x00c0, 0x0100, 0x0140, 0x0180, 0x01c0, 0x0200, + 0x0240, 0x0280, 0x02c0, 0x0300, 0x0340, 0x0380, 0x03c0, 0x0400 + }, + { + 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, + 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, + 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, + 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, + 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, + 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xdd00, + 0xde00, 0xdf00, 0xe000, 0xe100, 0xe200, 0xe300, 0xe400, 0xe500, + 0xe600, 0xe700, 0xe800, 0xe900, 0xea00, 0xeb00, 0xec00, 0xed00, + 0xee00, 0xef00, 0xf000, 0xf100, 0xf180, 0xf200, 0xf280, 0xf300, + 0xf380, 0xf400, 0xf480, 0xf500, 0xf580, 0xf600, 0xf680, 0xf700, + 0xf780, 0xf800, 0xf880, 0xf900, 0xf980, 0xfa00, 0xfa80, 0xfb00, + 0xfb40, 0xfb80, 0xfbc0, 0xfc00, 0xfc40, 0xfc80, 0xfcc0, 0xfd00, + 0xfd40, 0xfd80, 0xfdc0, 0xfe00, 0xfe40, 0xfe80, 0xfec0, 0xff00, + 0xff40, 0xff80, 0xffc0, 0x0000, 0x0040, 0x0080, 0x00c0, 0x0100, + 0x0140, 0x0180, 0x01c0, 0x0200, 0x0240, 0x0280, 0x02c0, 0x0300, + 0x0340, 0x0380, 0x03c0, 0x0400, 0x0400, 0x0400, 0x0400, 0x0400 + }, + { + 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, + 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, + 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, + 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, + 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, + 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xde00, + 0xdf00, 0xe000, 0xe100, 0xe200, 0xe300, 0xe400, 0xe500, 0xe600, + 0xe700, 0xe800, 0xe900, 0xea00, 0xeb00, 0xec00, 0xed00, 0xee00, + 0xef00, 0xf000, 0xf100, 0xf200, 0xf280, 0xf300, 0xf380, 0xf400, + 0xf480, 0xf500, 0xf580, 0xf600, 0xf680, 0xf700, 0xf780, 0xf800, + 0xf880, 0xf900, 0xf980, 0xfa00, 0xfa80, 0xfb00, 0xfb80, 0xfc00, + 0xfc40, 0xfc80, 0xfcc0, 0xfd00, 0xfd40, 0xfd80, 0xfdc0, 0xfe00, + 0xfe40, 0xfe80, 0xfec0, 0xff00, 0xff40, 0xff80, 0xffc0, 0x0000, + 0x0040, 0x0080, 0x00c0, 0x0100, 0x0140, 0x0180, 0x01c0, 0x0200, + 0x0240, 0x0280, 0x02c0, 0x0300, 0x0340, 0x0380, 0x03c0, 0x0400, + 0x0400, 0x0400, 0x0400, 0x0400, 0x0400, 0x0400, 0x0400, 0x0400 + }, + { + 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, + 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, + 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, + 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, + 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, + 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xdf00, + 0xe000, 0xe100, 0xe200, 0xe300, 0xe400, 0xe500, 0xe600, 0xe700, + 0xe800, 0xe900, 0xea00, 0xeb00, 0xec00, 0xed00, 0xee00, 0xef00, + 0xf000, 0xf100, 0xf200, 0xf300, 0xf380, 0xf400, 0xf480, 0xf500, + 0xf580, 0xf600, 0xf680, 0xf700, 0xf780, 0xf800, 0xf880, 0xf900, + 0xf980, 0xfa00, 0xfa80, 0xfb00, 0xfb80, 0xfc00, 0xfc80, 0xfd00, + 0xfd40, 0xfd80, 0xfdc0, 0xfe00, 0xfe40, 0xfe80, 0xfec0, 0xff00, + 0xff40, 0xff80, 0xffc0, 0x0000, 0x0040, 0x0080, 0x00c0, 0x0100, + 0x0140, 0x0180, 0x01c0, 0x0200, 0x0240, 0x0280, 0x02c0, 0x0300, + 0x0340, 0x0380, 0x03c0, 0x0400, 0x0400, 0x0400, 0x0400, 0x0400, + 0x0400, 0x0400, 0x0400, 0x0400, 0x0400, 0x0400, 0x0400, 0x0400 + }, + { + 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, + 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, + 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, + 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, + 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, + 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xe000, + 0xe100, 0xe200, 0xe300, 0xe400, 0xe500, 0xe600, 0xe700, 0xe800, + 0xe900, 0xea00, 0xeb00, 0xec00, 0xed00, 0xee00, 0xef00, 0xf000, + 0xf100, 0xf200, 0xf300, 0xf400, 0xf480, 0xf500, 0xf580, 0xf600, + 0xf680, 0xf700, 0xf780, 0xf800, 0xf880, 0xf900, 0xf980, 0xfa00, + 0xfa80, 0xfb00, 0xfb80, 0xfc00, 0xfc80, 0xfd00, 0xfd80, 0xfe00, + 0xfe40, 0xfe80, 0xfec0, 0xff00, 0xff40, 0xff80, 0xffc0, 0x0000, + 0x0040, 0x0080, 0x00c0, 0x0100, 0x0140, 0x0180, 0x01c0, 0x0200, + 0x0240, 0x0280, 0x02c0, 0x0300, 0x0340, 0x0380, 0x03c0, 0x0400, + 0x0400, 0x0400, 0x0400, 0x0400, 0x0400, 0x0400, 0x0400, 0x0400, + 0x0400, 0x0400, 0x0400, 0x0400, 0x0400, 0x0400, 0x0400, 0x0400 + } +}; + +/* volmap for LineOut Volumes */ +static const SINT16 volmap_lineout[] = { + 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, + 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, + 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, + 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, + 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, + 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xdc00, + 0xdd00, 0xde00, 0xdf00, 0xe000, 0xe100, 0xe200, 0xe300, 0xe400, + 0xe500, 0xe600, 0xe700, 0xe800, 0xe900, 0xea00, 0xeb00, 0xec00, + 0xed00, 0xee00, 0xef00, 0xf000, 0xf080, 0xf100, 0xf180, 0xf200, + 0xf280, 0xf300, 0xf380, 0xf400, 0xf480, 0xf500, 0xf580, 0xf600, + 0xf680, 0xf700, 0xf780, 0xf800, 0xf880, 0xf900, 0xf980, 0xfa00, + 0xfa40, 0xfa80, 0xfac0, 0xfb00, 0xfb40, 0xfb80, 0xfbc0, 0xfc00, + 0xfc40, 0xfc80, 0xfcc0, 0xfd00, 0xfd40, 0xfd80, 0xfdc0, 0xfe00, + 0xfe40, 0xfe80, 0xfec0, 0xff00, 0xff40, 0xff80, 0xffc0, 0x0000, + 0x0040, 0x0080, 0x00c0, 0x0100, 0x0140, 0x0180, 0x01c0, 0x0200, +}; + +/* volmap for LineOut2 Volumes */ +static const SINT16 volmap_lineout2[] = { + 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, + 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, + 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, + 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, + 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, + 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xda00, + 0xdc00, 0xdc00, 0xdd00, 0xde00, 0xdf00, 0xe000, 0xe100, 0xe200, + 0xe300, 0xe400, 0xe500, 0xe600, 0xe700, 0xe800, 0xe900, 0xea00, + 0xeb00, 0xec00, 0xed00, 0xee00, 0xee00, 0xef00, 0xef00, 0xf000, + 0xf080, 0xf100, 0xf180, 0xf200, 0xf280, 0xf300, 0xf380, 0xf400, + 0xf480, 0xf500, 0xf580, 0xf600, 0xf680, 0xf700, 0xf780, 0xf800, + 0xf800, 0xf880, 0xf880, 0xf900, 0xf900, 0xf980, 0xf980, 0xfa00, + 0xfa40, 0xfa80, 0xfac0, 0xfb00, 0xfb40, 0xfb80, 0xfbc0, 0xfc00, + 0xfc40, 0xfc80, 0xfcc0, 0xfd00, 0xfd40, 0xfd80, 0xfdc0, 0xfe00, + 0xfe40, 0xfe80, 0xfec0, 0xff00, 0xff40, 0xff80, 0xffc0, 0x0000, +}; + +/* volmap for HP Output Volumes */ +static const SINT16 volmap_hp_es1[] = { + 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, + 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, + 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, + 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, + 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, + 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xdd00, + 0xde00, 0xdf00, 0xe000, 0xe100, 0xe200, 0xe300, 0xe400, 0xe500, + 0xe600, 0xe700, 0xe800, 0xe900, 0xea00, 0xeb00, 0xec00, 0xed00, + 0xee00, 0xef00, 0xf000, 0xf100, 0xf180, 0xf200, 0xf280, 0xf300, + 0xf380, 0xf400, 0xf480, 0xf500, 0xf580, 0xf600, 0xf680, 0xf700, + 0xf780, 0xf800, 0xf880, 0xf900, 0xf980, 0xfa00, 0xfa80, 0xfb00, + 0xfb40, 0xfb80, 0xfbc0, 0xfc00, 0xfc40, 0xfc80, 0xfcc0, 0xfd00, + 0xfd40, 0xfd80, 0xfdc0, 0xfe00, 0xfe40, 0xfe80, 0xfec0, 0xff00, + 0xff40, 0xff80, 0xffc0, 0x0000, 0x0040, 0x0080, 0x00c0, 0x0100, + 0x0140, 0x0180, 0x01c0, 0x0200, 0x0240, 0x0280, 0x02c0, 0x0300, + 0x0340, 0x0380, 0x03c0, 0x0400, 0x0400, 0x0400, 0x0400, 0x0400 +}; +static const SINT16 volmap_hp[] = { + 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, + 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, + 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, + 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, + 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, + 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xa000, 0xdc00, + 0xdd00, 0xde00, 0xdf00, 0xe000, 0xe100, 0xe200, 0xe300, 0xe400, + 0xe500, 0xe600, 0xe700, 0xe800, 0xe900, 0xea00, 0xeb00, 0xec00, + 0xed00, 0xee00, 0xef00, 0xf000, 0xf080, 0xf100, 0xf180, 0xf200, + 0xf280, 0xf300, 0xf380, 0xf400, 0xf480, 0xf500, 0xf580, 0xf600, + 0xf680, 0xf700, 0xf780, 0xf800, 0xf880, 0xf900, 0xf980, 0xfa00, + 0xfa40, 0xfa80, 0xfac0, 0xfb00, 0xfb40, 0xfb80, 0xfbc0, 0xfc00, + 0xfc40, 0xfc80, 0xfcc0, 0xfd00, 0xfd40, 0xfd80, 0xfdc0, 0xfe00, + 0xfe40, 0xfe80, 0xfec0, 0xff00, 0xff40, 0xff80, 0xffc0, 0x0000, + 0x0040, 0x0080, 0x00c0, 0x0100, 0x0140, 0x0180, 0x01c0, 0x0200, + 0x0240, 0x0280, 0x02c0, 0x0300, 0x0340, 0x0380, 0x03c0, 0x0400 +}; + +/* volmap for Master Volumes */ +static const SINT16 volmap_master[] = { + 0xb500, 0xb600, 0xb700, 0xb800, 0xb900, 0xba00, 0xbb00, 0xbc00, + 0xbd00, 0xbe00, 0xbf00, 0xc000, 0xc100, 0xc200, 0xc300, 0xc400, + 0xc500, 0xc600, 0xc700, 0xc800, 0xc900, 0xca00, 0xcb00, 0xcc00, + 0xcd00, 0xce00, 0xcf00, 0xd000, 0xd100, 0xd200, 0xd300, 0xd400, + 0xd500, 0xd600, 0xd700, 0xd800, 0xd900, 0xda00, 0xdb00, 0xdc00, + 0xdd00, 0xde00, 0xdf00, 0xe000, 0xe100, 0xe200, 0xe300, 0xe400, + 0xe500, 0xe600, 0xe700, 0xe800, 0xe900, 0xea00, 0xeb00, 0xec00, + 0xed00, 0xee00, 0xdf00, 0xf000, 0xf100, 0xf200, 0xf300, 0xf400, + 0xf500, 0xf600, 0xf700, 0xf800, 0xf900, 0xfa00, 0xfb00, 0xfc00, + 0xfd00, 0xfe00, 0xff00, 0x0000 +}; + +/* volmap for Voice Volumes */ +static const SINT16 volmap_voice[] = { + 0xb500, 0xb600, 0xb700, 0xb800, 0xb900, 0xba00, 0xbb00, 0xbc00, + 0xbd00, 0xbe00, 0xbf00, 0xc000, 0xc100, 0xc200, 0xc300, 0xc400, + 0xc500, 0xc600, 0xc700, 0xc800, 0xc900, 0xca00, 0xcb00, 0xcc00, + 0xcd00, 0xce00, 0xcf00, 0xd000, 0xd100, 0xd200, 0xd300, 0xd400, + 0xd500, 0xd600, 0xd700, 0xd800, 0xd900, 0xda00, 0xdb00, 0xdc00, + 0xdd00, 0xde00, 0xdf00, 0xe000, 0xe100, 0xe200, 0xe300, 0xe400, + 0xe500, 0xe600, 0xe700, 0xe800, 0xe900, 0xea00, 0xeb00, 0xec00, + 0xed00, 0xee00, 0xdf00, 0xf000, 0xf100, 0xf200, 0xf300, 0xf400, + 0xf500, 0xf600, 0xf700, 0xf800, 0xf900, 0xfa00, 0xfb00, 0xfc00, + 0xfd00, 0xfe00, 0xff00, 0x0000 +}; + +/* volmap for AnalogIn Ana Volumes */ +static const SINT16 volmap_aplay_a[] = { + 0xa000, 0xa000, 0xa000, 0xe200, 0xe300, 0xe400, 0xe500, 0xe600, + 0xe700, 0xe800, 0xe900, 0xea00, 0xeb00, 0xec00, 0xed00, 0xee00, + 0xef00, 0xf000, 0xf100, 0xf200, 0xf300, 0xf400, 0xf500, 0xf600, + 0xf700, 0xf800, 0xf900, 0xfa00, 0xfb00, 0xfc00, 0xfd00, 0xfe00, + 0xff00, 0x0000, 0x0100, 0x0200, 0x0300, 0x0400, 0x0500, 0x0600, + 0x0700, 0x0800, 0x0900, 0x0a00, 0x0b00, 0x0c00, 0x0d00, 0x0e00, + 0x0f00, 0x1000, 0x1100, 0x1200, 0x1300, 0x1400, 0x1500, 0x1580, + 0x1600, 0x1680, 0x1700, 0x1780, 0x1800, 0x1a00, 0x1c00, 0x1e00 +}; + +/* volmap for Adif(ES) Volumes */ +static const SINT16 volmap_adif[] = { + 0xa000, 0xa300, 0xa400, 0xa500, 0xa600, 0xa700, 0xa800, 0xa900, + 0xaa00, 0xab00, 0xac00, 0xad00, 0xae00, 0xaf00, 0xb000, 0xb100, + 0xb200, 0xb300, 0xb400, 0xb500, 0xb600, 0xb700, 0xb800, 0xb900, + 0xba00, 0xbb00, 0xbc00, 0xbd00, 0xbe00, 0xbf00, 0xc000, 0xc100, + 0xc200, 0xc300, 0xc400, 0xc500, 0xc600, 0xc700, 0xc800, 0xc900, + 0xca00, 0xcb00, 0xcc00, 0xcd00, 0xce00, 0xcf00, 0xd000, 0xd100, + 0xd200, 0xd300, 0xd400, 0xd500, 0xd600, 0xd700, 0xd800, 0xd900, + 0xda00, 0xdb00, 0xdc00, 0xdd00, 0xde00, 0xdf00, 0xe000, 0xe100, + 0xe200, 0xe300, 0xe400, 0xe500, 0xe600, 0xe700, 0xe800, 0xe900, + 0xea00, 0xeb00, 0xec00, 0xed00, 0xee00, 0xef00, 0xf000, 0xf100, + 0xf200, 0xf300, 0xf400, 0xf500, 0xf600, 0xf700, 0xf800, 0xf900, + 0xfa00, 0xfb00, 0xfc00, 0xfd00, 0xfe00, 0xff00, 0x0000, 0x0100, + 0x0200, 0x0300, 0x0400, 0x0500, 0x0600, 0x0700, 0x0800, 0x0900, + 0x0a00, 0x0b00, 0x0c00, 0x0d00, 0x0e00, 0x0f00, 0x1000, 0x1100, + 0x1200, 0x1200, 0x1200 +}; + +struct mc_asoc_vreg_info { + size_t offset; + const SINT16 *volmap; + UINT8 channels; +}; +static struct mc_asoc_vreg_info vreg_map[MC_ASOC_N_VOL_REG] = { + {offsetof(struct MCDRV_VOL_INFO, aswD_MusicIn), + volmap_digital, + MUSICIN_VOL_CHANNELS}, + {offsetof(struct MCDRV_VOL_INFO, aswD_ExtIn), + volmap_digital, + EXTIN_VOL_CHANNELS}, + {offsetof(struct MCDRV_VOL_INFO, aswD_VoiceIn), + volmap_digital, + VOICEIN_VOL_CHANNELS}, + {offsetof(struct MCDRV_VOL_INFO, aswD_RefIn), + volmap_digital, + REFIN_VOL_CHANNELS}, + {offsetof(struct MCDRV_VOL_INFO, aswD_Adif0In), + volmap_digital, + ADIF0IN_VOL_CHANNELS}, + {offsetof(struct MCDRV_VOL_INFO, aswD_Adif1In), + volmap_digital, + ADIF1IN_VOL_CHANNELS}, + {offsetof(struct MCDRV_VOL_INFO, aswD_Adif2In), + volmap_digital, + ADIF2IN_VOL_CHANNELS}, + {offsetof(struct MCDRV_VOL_INFO, aswD_MusicOut), + volmap_digital, + MUSICOUT_VOL_CHANNELS}, + {offsetof(struct MCDRV_VOL_INFO, aswD_ExtOut), + volmap_digital, + EXTOUT_VOL_CHANNELS}, + {offsetof(struct MCDRV_VOL_INFO, aswD_VoiceOut), + volmap_digital, + VOICEOUT_VOL_CHANNELS}, + {offsetof(struct MCDRV_VOL_INFO, aswD_RefOut), + volmap_digital, + REFOUT_VOL_CHANNELS}, + {offsetof(struct MCDRV_VOL_INFO, aswD_Dac0Out), + volmap_digital, + DAC0OUT_VOL_CHANNELS}, + {offsetof(struct MCDRV_VOL_INFO, aswD_Dac1Out), + volmap_digital, + DAC1OUT_VOL_CHANNELS}, + {offsetof(struct MCDRV_VOL_INFO, aswD_DpathDa), + volmap_digital, + DPATH_VOL_CHANNELS}, + {offsetof(struct MCDRV_VOL_INFO, aswD_DpathAd), + volmap_digital, + DPATH_VOL_CHANNELS}, + {offsetof(struct MCDRV_VOL_INFO, aswA_LineIn1), + volmap_ain, + LINEIN1_VOL_CHANNELS}, + {offsetof(struct MCDRV_VOL_INFO, aswA_Mic1), + volmap_ain, + MIC1_VOL_CHANNELS}, + {offsetof(struct MCDRV_VOL_INFO, aswA_Mic2), + volmap_ain, + MIC2_VOL_CHANNELS}, + {offsetof(struct MCDRV_VOL_INFO, aswA_Mic3), + volmap_ain, + MIC3_VOL_CHANNELS}, + {offsetof(struct MCDRV_VOL_INFO, aswA_Mic4), + volmap_ain, + MIC4_VOL_CHANNELS}, + {offsetof(struct MCDRV_VOL_INFO, aswA_Hp), + volmap_hp, + HP_VOL_CHANNELS}, + {offsetof(struct MCDRV_VOL_INFO, aswA_Sp), + volmap_sp[0], + SP_VOL_CHANNELS}, + {offsetof(struct MCDRV_VOL_INFO, aswA_Rc), + volmap_aout, + RC_VOL_CHANNELS}, + {offsetof(struct MCDRV_VOL_INFO, aswA_LineOut1), + volmap_lineout, + LINEOUT1_VOL_CHANNELS}, + {offsetof(struct MCDRV_VOL_INFO, aswA_LineOut2), + volmap_lineout2, + LINEOUT2_VOL_CHANNELS}, + + {(size_t)-1, NULL, 0}, + + {(size_t)-1, volmap_master, MUSICIN_VOL_CHANNELS}, + {(size_t)-1, volmap_voice, VOICEIN_VOL_CHANNELS}, + {(size_t)-1, volmap_aplay_a, LINEIN1_VOL_CHANNELS}, + {(size_t)-1, volmap_digital, ADIF0IN_VOL_CHANNELS}, +}; + +static const DECLARE_TLV_DB_SCALE(mc_asoc_tlv_digital, -9600, 100, 1); +static unsigned int mc_asoc_tlv_ain[] = { + TLV_DB_RANGE_HEAD(4), + 0x00, 0x02, TLV_DB_SCALE_ITEM(-9600, 0, 1), + 0x03, 0x36, TLV_DB_SCALE_ITEM(-3000, 100, 0), + 0x37, 0x3B, TLV_DB_SCALE_ITEM(2150, 50, 0), + 0x3C, 0x3F, TLV_DB_SCALE_ITEM(2400, 200, 0), +}; +static unsigned int mc_asoc_tlv_aout[] = { + TLV_DB_RANGE_HEAD(4), + 0x00, 0x2E, TLV_DB_SCALE_ITEM(-9600, 0, 1), + 0x2F, 0x43, TLV_DB_SCALE_ITEM(-3600, 100, 0), + 0x44, 0x57, TLV_DB_SCALE_ITEM(-1550, 50, 0), + 0x58, 0x6F, TLV_DB_SCALE_ITEM(-575, 25, 0), +}; +static unsigned int mc_asoc_tlv_sp[] = { + TLV_DB_RANGE_HEAD(4), + 0x00, 0x2E, TLV_DB_SCALE_ITEM(-9600, 0, 1), + 0x2F, 0x43, TLV_DB_SCALE_ITEM(-3600, 100, 0), + 0x44, 0x57, TLV_DB_SCALE_ITEM(-1550, 50, 0), + 0x58, 0x6F, TLV_DB_SCALE_ITEM(-575, 25, 0), +}; +static unsigned int mc_asoc_tlv_lout[] = { + TLV_DB_RANGE_HEAD(4), + 0x00, 0x2E, TLV_DB_SCALE_ITEM(-9600, 0, 1), + 0x2F, 0x43, TLV_DB_SCALE_ITEM(-3600, 100, 0), + 0x44, 0x57, TLV_DB_SCALE_ITEM(-1550, 50, 0), + 0x58, 0x77, TLV_DB_SCALE_ITEM(-575, 25, 0), +}; +static unsigned int mc_asoc_tlv_hp[] = { + TLV_DB_RANGE_HEAD(4), + 0x00, 0x2F, TLV_DB_SCALE_ITEM(-9600, 0, 1), + 0x30, 0x43, TLV_DB_SCALE_ITEM(-3500, 100, 0), + 0x44, 0x57, TLV_DB_SCALE_ITEM(-1550, 50, 0), + 0x58, 0x7F, TLV_DB_SCALE_ITEM(-575, 25, 0), +}; +static const DECLARE_TLV_DB_SCALE(mc_asoc_tlv_ext, -7500, 100, 1); + +/* SP Gain */ +static unsigned int mc_asoc_tlv_sp_gain[] = { + TLV_DB_RANGE_HEAD(1), + 0x00, 0x04, TLV_DB_SCALE_ITEM(1200, 100, 0) +}; + +/* Audio Mode */ +static const char * const audio_mode_play_param_text[] = { + "off", "audio", "incall", "audio+incall", "incommunication", "karaoke", + "incall2", "audio+incall2", "incommunication2", + "incall3", "audio+incall3", "incall4", "audio+incall4", + "audiocp" +}; +static const struct soc_enum audio_mode_play_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_AUDIO_MODE_PLAY, 0, + ARRAY_SIZE(audio_mode_play_param_text), + audio_mode_play_param_text); + +static const char * const audio_mode_cap_param_text[] = { + "off", "audio", "incall", "audio+incall", "incommunication", "audioex", + "audiovr", "audiolb" +}; +static const struct soc_enum audio_mode_cap_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_AUDIO_MODE_CAP, 0, + ARRAY_SIZE(audio_mode_cap_param_text), + audio_mode_cap_param_text); + +/* Output Path */ +static const char * const output_path_param_text[] = { + "SP", "RC", "HP", "HS", "LO1", "LO2", "BT", + "SP+RC", "SP+HP", "SP+LO1", "SP+LO2", "SP+BT", + "LO1+RC", "LO1+HP", "LO1+BT", "LO2+RC", "LO2+HP", "LO2+BT", + "LO1+LO2", "LO2+LO1" +}; +static const struct soc_enum output_path_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_OUTPUT_PATH, 0, + ARRAY_SIZE(output_path_param_text), output_path_param_text); + +/* Input Path */ +static const char * const input_path_param_text[] = { + "MainMIC", "SubMIC", "2MIC", "Headset", "Bluetooth", + "VoiceCall", "VoiceUplink", "VoiceDownlink", "Linein1" +}; +static const struct soc_enum input_path_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_INPUT_PATH, 0, + ARRAY_SIZE(input_path_param_text), input_path_param_text); + +/* Incall Mic */ +static const char * const incall_mic_param_text[] = { + "MainMIC", "SubMIC", "2MIC" +}; +static const struct soc_enum incall_mic_sp_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_INCALL_MIC_SP, 0, + ARRAY_SIZE(incall_mic_param_text), incall_mic_param_text); +static const struct soc_enum incall_mic_rc_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_INCALL_MIC_RC, 0, + ARRAY_SIZE(incall_mic_param_text), incall_mic_param_text); +static const struct soc_enum incall_mic_hp_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_INCALL_MIC_HP, 0, + ARRAY_SIZE(incall_mic_param_text), incall_mic_param_text); +static const struct soc_enum incall_mic_lo1_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_INCALL_MIC_LO1, 0, + ARRAY_SIZE(incall_mic_param_text), incall_mic_param_text); +static const struct soc_enum incall_mic_lo2_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_INCALL_MIC_LO2, 0, + ARRAY_SIZE(incall_mic_param_text), incall_mic_param_text); + +/* Playback Path */ +static const char * const playback_path_sw_param_text[] = { + "OFF", "ON" +}; +static const struct soc_enum mainmic_playback_path_sw_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_MAINMIC_PLAYBACK_PATH, 0, + ARRAY_SIZE(playback_path_sw_param_text), + playback_path_sw_param_text); +static const struct soc_enum submic_playback_path_sw_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_SUBMIC_PLAYBACK_PATH, 0, + ARRAY_SIZE(playback_path_sw_param_text), + playback_path_sw_param_text); +static const struct soc_enum msmic_playback_path_sw_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_2MIC_PLAYBACK_PATH, 0, + ARRAY_SIZE(playback_path_sw_param_text), + playback_path_sw_param_text); +static const struct soc_enum hsmic_playback_path_sw_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_HSMIC_PLAYBACK_PATH, 0, + ARRAY_SIZE(playback_path_sw_param_text), + playback_path_sw_param_text); +static const struct soc_enum btmic_playback_path_sw_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_BTMIC_PLAYBACK_PATH, 0, + ARRAY_SIZE(playback_path_sw_param_text), + playback_path_sw_param_text); +static const struct soc_enum lin1_playback_path_sw_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_LIN1_PLAYBACK_PATH, 0, + ARRAY_SIZE(playback_path_sw_param_text), + playback_path_sw_param_text); + +/* DTMF Control */ +static const char * const dtmf_control_param_text[] = { + "OFF", "ON" +}; +static const struct soc_enum dtmf_control_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_DTMF_CONTROL, 0, + ARRAY_SIZE(dtmf_control_param_text), dtmf_control_param_text); + +/* DTMF Output */ +static const char * const dtmf_output_param_text[] = { + "SP", "NORMAL" +}; +static const struct soc_enum dtmf_output_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_DTMF_OUTPUT, 0, + ARRAY_SIZE(dtmf_output_param_text), dtmf_output_param_text); + +/* Switch Clock */ +static const char * const switch_clock_param_text[] = { + "CLKA", "CLKB" +}; +static const struct soc_enum switch_clock_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_SWITCH_CLOCK, 0, + ARRAY_SIZE(switch_clock_param_text), switch_clock_param_text); + +/* Ext MasterSlave */ +static const char * const ext_masterslave_param_text[] = { + "Slave", "Master" +}; +static const struct soc_enum ext_masterslave_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_EXT_MASTERSLAVE, 0, + ARRAY_SIZE(ext_masterslave_param_text), + ext_masterslave_param_text); + +/* Ext Rate */ +static const char * const ext_rate_param_text[] = { + "48kHz", "44.1kHz", "32kHz", "", "24kHz", "22.05kHz", "16kHz", "", + "12kHz", "11.025kHz", "8kHz" +}; +static const struct soc_enum ext_rate_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_EXT_RATE, 0, + ARRAY_SIZE(ext_rate_param_text), ext_rate_param_text); + +/* Ext Bitclock Rate */ +static const char * const ext_bck_rate_param_text[] = { + "64fs", "48fs", "32fs", "", "512fs", "256fs", "192fs", "128fs", + "96fs", "24fs", "16fs", "8fs", "", "", "", "Slave" +}; +static const struct soc_enum ext_bck_rate_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_EXT_BITCLOCK_RATE, 0, + ARRAY_SIZE(ext_bck_rate_param_text), ext_bck_rate_param_text); + +/* Ext Interface */ +static const char * const ext_interface_param_text[] = { + "DA", "PCM" +}; +static const struct soc_enum ext_interface_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_EXT_INTERFACE, 0, + ARRAY_SIZE(ext_interface_param_text), ext_interface_param_text); + +/* Ext Bitclock Invert */ +static const char * const ext_bck_invert_param_text[] = { + "Normal", "Invert" +}; +static const struct soc_enum ext_bck_invert_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_EXT_BITCLOCK_INVERT, 0, + ARRAY_SIZE(ext_bck_invert_param_text), + ext_bck_invert_param_text); + +/* Ext DA Bit Width */ +static const char * const ext_bit_width_param_text[] = { + "16bit", "20bit", "24bit" +}; +static const struct soc_enum ext_input_bit_width_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_EXT_INPUT_DA_BIT_WIDTH, 0, + ARRAY_SIZE(ext_bit_width_param_text), ext_bit_width_param_text); +static const struct soc_enum ext_output_bit_width_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_EXT_OUTPUT_DA_BIT_WIDTH, 0, + ARRAY_SIZE(ext_bit_width_param_text), ext_bit_width_param_text); + +/* Ext DA Format */ +static const char * const ext_da_format_param_text[] = { + "HeadAlign", "I2S", "TailAlign" +}; +static const struct soc_enum ext_input_da_format_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_EXT_INPUT_DA_FORMAT, 0, + ARRAY_SIZE(ext_da_format_param_text), ext_da_format_param_text); +static const struct soc_enum ext_output_da_format_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_EXT_OUTPUT_DA_FORMAT, 0, + ARRAY_SIZE(ext_da_format_param_text), ext_da_format_param_text); + +/* Ext Pcm MonoStereo */ +static const char * const ext_pcm_mono_param_text[] = { + "Stereo", "Mono" +}; +static const struct soc_enum ext_input_pcm_mono_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_EXT_INPUT_PCM_MONOSTEREO, 0, + ARRAY_SIZE(ext_pcm_mono_param_text), ext_pcm_mono_param_text); +static const struct soc_enum ext_output_pcm_mono_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_EXT_OUTPUT_PCM_MONOSTEREO, 0, + ARRAY_SIZE(ext_pcm_mono_param_text), ext_pcm_mono_param_text); + +/* Ext Pcm Bit Order */ +static const char * const ext_pcm_bit_order_param_text[] = { + "MSB", "LSB" +}; +static const struct soc_enum ext_input_pcm_bit_order_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_EXT_INPUT_PCM_BIT_ORDER, 0, + ARRAY_SIZE(ext_pcm_bit_order_param_text), + ext_pcm_bit_order_param_text); +static const struct soc_enum ext_output_pcm_bit_order_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_EXT_OUTPUT_PCM_BIT_ORDER, 0, + ARRAY_SIZE(ext_pcm_bit_order_param_text), + ext_pcm_bit_order_param_text); + +/* Ext Pcm Format */ +static const char * const ext_pcm_format_param_text[] = { + "Linear", "Alaw", "Mulaw" +}; +static const struct soc_enum ext_input_pcm_format_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_EXT_INPUT_PCM_FORMAT, 0, + ARRAY_SIZE(ext_pcm_format_param_text), + ext_pcm_format_param_text); +static const struct soc_enum ext_output_pcm_format_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_EXT_OUTPUT_PCM_FORMAT, 0, + ARRAY_SIZE(ext_pcm_format_param_text), + ext_pcm_format_param_text); + +/* Ext PCM Bit Width */ +static const char * const ext_pcm_bit_width_param_text[] = { + "8bit", "16bit", "24bit" +}; +static const struct soc_enum ext_input_pcm_bit_width_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_EXT_INPUT_PCM_BIT_WIDTH, 0, + ARRAY_SIZE(ext_pcm_bit_width_param_text), + ext_pcm_bit_width_param_text); +static const struct soc_enum ext_output_pcm_bit_width_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_EXT_OUTPUT_PCM_BIT_WIDTH, 0, + ARRAY_SIZE(ext_pcm_bit_width_param_text), + ext_pcm_bit_width_param_text); + +/* Voice MasterSlave */ +static const char * const voice_masterslave_param_text[] = { + "Slave", "Master" +}; +static const struct soc_enum voice_masterslave_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_VOICE_MASTERSLAVE, 0, + ARRAY_SIZE(voice_masterslave_param_text), + voice_masterslave_param_text); + +/* Voice Rate */ +static const char * const voice_rate_param_text[] = { + "48kHz", "44.1kHz", "32kHz", "", "24kHz", "22.05kHz", "16kHz", "", + "12kHz", "11.025kHz", "8kHz", "", "192kHz", "96kHz" +}; +static const struct soc_enum voice_rate_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_VOICE_RATE, 0, + ARRAY_SIZE(voice_rate_param_text), voice_rate_param_text); + +/* Voice Bitclock Rate */ +static const char * const voice_bck_rate_param_text[] = { + "64fs", "48fs", "32fs", "", "512fs", "256fs", "192fs", "128fs", + "96fs", "24fs", "16fs", "8fs", "", "", "", "Slave" +}; +static const struct soc_enum voice_bck_rate_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_VOICE_BITCLOCK_RATE, 0, + ARRAY_SIZE(voice_bck_rate_param_text), + voice_bck_rate_param_text); + +/* Voice Interface */ +static const char * const voice_interface_param_text[] = { + "DA", "PCM" +}; +static const struct soc_enum voice_interface_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_VOICE_INTERFACE, 0, + ARRAY_SIZE(voice_interface_param_text), + voice_interface_param_text); + +/* Voice Bitclock Invert */ +static const char * const voice_bck_invert_param_text[] = { + "Normal", "Invert" +}; +static const struct soc_enum voice_bck_invert_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_VOICE_BITCLOCK_INVERT, 0, + ARRAY_SIZE(voice_bck_invert_param_text), + voice_bck_invert_param_text); + +/* Voice DA Bit Width */ +static const char * const voice_input_bit_width_param_text[] = { + "16bit", "20bit", "24bit" +}; +static const struct soc_enum voice_input_bit_width_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_VOICE_INPUT_DA_BIT_WIDTH, 0, + ARRAY_SIZE(voice_input_bit_width_param_text), + voice_input_bit_width_param_text); +static const char * const voice_output_bit_width_param_text[] = { + "16bit", "20bit", "24bit", "32bit" +}; +static const struct soc_enum voice_output_bit_width_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_VOICE_OUTPUT_DA_BIT_WIDTH, 0, + ARRAY_SIZE(voice_output_bit_width_param_text), + voice_output_bit_width_param_text); + +/* Voice DA Format */ +static const char * const voice_da_format_param_text[] = { + "HeadAlign", "I2S", "TailAlign" +}; +static const struct soc_enum voice_input_da_format_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_VOICE_INPUT_DA_FORMAT, 0, + ARRAY_SIZE(voice_da_format_param_text), + voice_da_format_param_text); +static const struct soc_enum voice_output_da_format_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_VOICE_OUTPUT_DA_FORMAT, 0, + ARRAY_SIZE(voice_da_format_param_text), + voice_da_format_param_text); + +/* Voice Pcm MonoStereo */ +static const char * const voice_pcm_mono_param_text[] = { + "Stereo", "Mono" +}; +static const struct soc_enum voice_input_pcm_mono_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_VOICE_INPUT_PCM_MONOSTEREO, 0, + ARRAY_SIZE(voice_pcm_mono_param_text), + voice_pcm_mono_param_text); +static const struct soc_enum voice_output_pcm_mono_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_VOICE_OUTPUT_PCM_MONOSTEREO, 0, + ARRAY_SIZE(voice_pcm_mono_param_text), + voice_pcm_mono_param_text); + +/* Voice Pcm Bit Order */ +static const char * const voice_pcm_bit_order_param_text[] = { + "MSB", "LSB" +}; +static const struct soc_enum voice_input_pcm_bit_order_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_VOICE_INPUT_PCM_BIT_ORDER, 0, + ARRAY_SIZE(voice_pcm_bit_order_param_text), + voice_pcm_bit_order_param_text); +static const struct soc_enum voice_output_pcm_bit_order_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_VOICE_OUTPUT_PCM_BIT_ORDER, 0, + ARRAY_SIZE(voice_pcm_bit_order_param_text), + voice_pcm_bit_order_param_text); + +/* Voice Pcm Format */ +static const char * const voice_pcm_format_param_text[] = { + "Linear", "Alaw", "Mulaw" +}; +static const struct soc_enum voice_input_pcm_format_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_VOICE_INPUT_PCM_FORMAT, 0, + ARRAY_SIZE(voice_pcm_format_param_text), + voice_pcm_format_param_text); +static const struct soc_enum voice_output_pcm_format_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_VOICE_OUTPUT_PCM_FORMAT, 0, + ARRAY_SIZE(voice_pcm_format_param_text), + voice_pcm_format_param_text); + +/* Voice PCM Bit Width */ +static const char * const voice_pcm_bit_width_param_text[] = { + "8bit", "16bit", "24bit" +}; +static const struct soc_enum voice_input_pcm_bit_width_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_VOICE_INPUT_PCM_BIT_WIDTH, 0, + ARRAY_SIZE(voice_pcm_bit_width_param_text), + voice_pcm_bit_width_param_text); +static const struct soc_enum voice_output_pcm_bit_width_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_VOICE_OUTPUT_PCM_BIT_WIDTH, 0, + ARRAY_SIZE(voice_pcm_bit_width_param_text), + voice_pcm_bit_width_param_text); + +/* Music Physical Port */ +static const char * const phy_port_param_text[] = { + "DIO0", "DIO1", "DIO2", "NONE", "SLIM0", "SLIM1", "SLIM2" +}; +static const struct soc_enum music_phy_port_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_MUSIC_PHYSICAL_PORT, 0, + ARRAY_SIZE(phy_port_param_text), phy_port_param_text); + +/* Ext Physical Port */ +static const struct soc_enum ext_phy_port_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_EXT_PHYSICAL_PORT, 0, + ARRAY_SIZE(phy_port_param_text), phy_port_param_text); + +/* Voice Physical Port */ +static const struct soc_enum voice_phy_port_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_VOICE_PHYSICAL_PORT, 0, + ARRAY_SIZE(phy_port_param_text), phy_port_param_text); + +/* Hifi Physical Port */ +static const struct soc_enum hifi_phy_port_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_HIFI_PHYSICAL_PORT, 0, + ARRAY_SIZE(phy_port_param_text), phy_port_param_text); + +/* Adif0 Swap */ +static const char * const swap_param_text[] = { + "Normal", "Swap", "Mute", "Center", "Mix", "MonoMix", "BothL", "BothR" +}; +static const struct soc_enum adif0_swap_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_ADIF0_SWAP, 0, + ARRAY_SIZE(swap_param_text), swap_param_text); + +/* Adif1 Swap */ +static const struct soc_enum adif1_swap_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_ADIF1_SWAP, 0, + ARRAY_SIZE(swap_param_text), swap_param_text); + +/* Adif2 Swap */ +static const struct soc_enum adif2_swap_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_ADIF2_SWAP, 0, + ARRAY_SIZE(swap_param_text), swap_param_text); + +/* Dac0 Swap */ +static const struct soc_enum dac0_swap_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_DAC0_SWAP, 0, + ARRAY_SIZE(swap_param_text), swap_param_text); + +/* Dac1 Swap */ +static const struct soc_enum dac1_swap_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_DAC1_SWAP, 0, + ARRAY_SIZE(swap_param_text), swap_param_text); + +/* Music Out0 Swap */ +static const struct soc_enum music_out0_swap_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_MUSIC_OUT0_SWAP, 0, + ARRAY_SIZE(swap_param_text), swap_param_text); + +/* Music In0 Swap */ +static const char * const swap2_param_text[] = { + "Normal", "Both1", "Both0", "Swap" +}; +static const struct soc_enum music_in0_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_MUSIC_IN0_SWAP, 0, + ARRAY_SIZE(swap2_param_text), swap2_param_text); + +/* Music In1 Swap */ +static const struct soc_enum music_in1_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_MUSIC_IN1_SWAP, 0, + ARRAY_SIZE(swap2_param_text), swap2_param_text); + +/* Music In2 Swap */ +static const struct soc_enum music_in2_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_MUSIC_IN2_SWAP, 0, + ARRAY_SIZE(swap2_param_text), swap2_param_text); + +/* Ext In Swap */ +static const struct soc_enum ext_in_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_EXT_IN_SWAP, 0, + ARRAY_SIZE(swap2_param_text), swap2_param_text); + +/* Voice In Swap */ +static const struct soc_enum voice_in_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_VOICE_IN_SWAP, 0, + ARRAY_SIZE(swap2_param_text), swap2_param_text); + +/* Music Out1 Swap */ +static const struct soc_enum music_out1_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_MUSIC_OUT1_SWAP, 0, + ARRAY_SIZE(swap2_param_text), swap2_param_text); + +/* Music Out2 Swap */ +static const struct soc_enum music_out2_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_MUSIC_OUT2_SWAP, 0, + ARRAY_SIZE(swap2_param_text), swap2_param_text); + +/* Ext Out Swap */ +static const struct soc_enum ext_out_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_EXT_OUT_SWAP, 0, + ARRAY_SIZE(swap2_param_text), swap2_param_text); + +/* Voice Out Swap */ +static const struct soc_enum voice_out_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_VOICE_OUT_SWAP, 0, + ARRAY_SIZE(swap2_param_text), swap2_param_text); + +/* Adif Source */ +static const char * const adif_src_param_text[] = { + "ymu831_path_cfg.h", "ADC0L", "ADC0R", "ADC1", + "PDM0L", "PDM0R", "PDM1L", "PDM1R", "DAC0REF", "DAC1REF" +}; +static const struct soc_enum adif_src[] = { + SOC_ENUM_DOUBLE(MC_ASOC_ADIF0_SOURCE, 0, 8, 8, adif_src_param_text), + SOC_ENUM_DOUBLE(MC_ASOC_ADIF1_SOURCE, 0, 8, 8, adif_src_param_text), + SOC_ENUM_DOUBLE(MC_ASOC_ADIF2_SOURCE, 0, 8, 10, adif_src_param_text) +}; +static const char * const clear_dsp_prm_param_text[] = { + "OFF", "ON" +}; +static const struct soc_enum clear_dsp_prm_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_CLEAR_DSP_PARAM, 0, + ARRAY_SIZE(clear_dsp_prm_param_text), clear_dsp_prm_param_text); + +/* Parameter Setting */ +static const char * const parameter_setting_param_text[] = { + "DUMMY" +}; +static const struct soc_enum parameter_setting_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_PARAMETER_SETTING, 0, + ARRAY_SIZE(parameter_setting_param_text), + parameter_setting_param_text); + +static const char * const mic_param_text[] = { + "NONE", "MIC1", "MIC2", "MIC3", "MIC4", "PDM0", "PDM1" +}; + +/* Main Mic */ +static const struct soc_enum main_mic_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_MAIN_MIC, 0, ARRAY_SIZE(mic_param_text), + mic_param_text); +/* Sub Mic */ +static const struct soc_enum sub_mic_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_SUB_MIC, 0, ARRAY_SIZE(mic_param_text), + mic_param_text); +/* Headset Mic */ +static const struct soc_enum hs_mic_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_HS_MIC, 0, ARRAY_SIZE(mic_param_text), + mic_param_text); + +#ifdef MC_ASOC_TEST +/* MICx_BIAS */ +static const char * const mic_bias_param_text[] = { + "OFF", "ALWAYS_ON", "SYNC_MIC" +}; +static const struct soc_enum mic1_bias_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_MIC1_BIAS, 0, ARRAY_SIZE(mic_bias_param_text), + mic_bias_param_text); +static const struct soc_enum mic2_bias_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_MIC2_BIAS, 0, ARRAY_SIZE(mic_bias_param_text), + mic_bias_param_text); +static const struct soc_enum mic3_bias_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_MIC3_BIAS, 0, ARRAY_SIZE(mic_bias_param_text), + mic_bias_param_text); +static const struct soc_enum mic4_bias_param_enum = + SOC_ENUM_SINGLE(MC_ASOC_MIC4_BIAS, 0, ARRAY_SIZE(mic_bias_param_text), + mic_bias_param_text); +#endif + +static const struct snd_kcontrol_new mc_asoc_snd_controls[] = { + SOC_DOUBLE_TLV("Music Input Volume", + MC_ASOC_DVOL_MUSICIN, 0, 8, 114, 0, mc_asoc_tlv_digital), + SOC_DOUBLE("Music Input Switch", + MC_ASOC_DVOL_MUSICIN, 7, 15, 1, 0), + + SOC_DOUBLE_TLV("Ext Input Volume", + MC_ASOC_DVOL_EXTIN, 0, 8, 114, 0, mc_asoc_tlv_digital), + SOC_DOUBLE("Ext Input Switch", + MC_ASOC_DVOL_EXTIN, 7, 15, 1, 0), + + SOC_DOUBLE_TLV("Voice Input Volume", + MC_ASOC_DVOL_VOICEIN, 0, 8, 114, 0, mc_asoc_tlv_digital), + SOC_DOUBLE("Voice Input Switch", + MC_ASOC_DVOL_VOICEIN, 7, 15, 1, 0), + + SOC_DOUBLE_TLV("Ref Input Volume", + MC_ASOC_DVOL_REFIN, 0, 8, 114, 0, mc_asoc_tlv_digital), + SOC_DOUBLE("Ref Input Switch", + MC_ASOC_DVOL_REFIN, 7, 15, 1, 0), + + SOC_DOUBLE_TLV("Adif0 Input Volume", + MC_ASOC_DVOL_ADIF0IN, 0, 8, 114, 0, mc_asoc_tlv_digital), + SOC_DOUBLE("Adif0 Input Switch", + MC_ASOC_DVOL_ADIF0IN, 7, 15, 1, 0), + SOC_DOUBLE_TLV("Adif1 Input Volume", + MC_ASOC_DVOL_ADIF1IN, 0, 8, 114, 0, mc_asoc_tlv_digital), + SOC_DOUBLE("Adif1 Input Switch", + MC_ASOC_DVOL_ADIF1IN, 7, 15, 1, 0), + SOC_DOUBLE_TLV("Adif2 Input Volume", + MC_ASOC_DVOL_ADIF2IN, 0, 8, 114, 0, mc_asoc_tlv_digital), + SOC_DOUBLE("Adif2 Input Switch", + MC_ASOC_DVOL_ADIF2IN, 7, 15, 1, 0), + + SOC_DOUBLE_TLV("Music Output Volume", + MC_ASOC_DVOL_MUSICOUT, 0, 8, 114, 0, mc_asoc_tlv_digital), + SOC_DOUBLE("Music Output Switch", + MC_ASOC_DVOL_MUSICOUT, 7, 15, 1, 0), + SOC_DOUBLE_TLV("Ext Output Volume", + MC_ASOC_DVOL_EXTOUT, 0, 8, 114, 0, mc_asoc_tlv_digital), + SOC_DOUBLE("Ext Output Switch", + MC_ASOC_DVOL_EXTOUT, 7, 15, 1, 0), + + SOC_DOUBLE_TLV("Voice Output Volume", + MC_ASOC_DVOL_VOICEOUT, 0, 8, 114, 0, mc_asoc_tlv_digital), + SOC_DOUBLE("Voice Output Switch", + MC_ASOC_DVOL_VOICEOUT, 7, 15, 1, 0), + + SOC_DOUBLE_TLV("Ref Output Volume", + MC_ASOC_DVOL_REFOUT, 0, 8, 114, 0, mc_asoc_tlv_digital), + SOC_DOUBLE("Ref Output Switch", + MC_ASOC_DVOL_REFOUT, 7, 15, 1, 0), + + SOC_DOUBLE_TLV("Dac0 Output Volume", + MC_ASOC_DVOL_DAC0OUT, 0, 8, 114, 0, mc_asoc_tlv_digital), + SOC_DOUBLE("Dac0 Output Switch", + MC_ASOC_DVOL_DAC0OUT, 7, 15, 1, 0), + + SOC_DOUBLE_TLV("Dac1 Output Volume", + MC_ASOC_DVOL_DAC1OUT, 0, 8, 114, 0, mc_asoc_tlv_digital), + SOC_DOUBLE("Dac1 Output Switch", + MC_ASOC_DVOL_DAC1OUT, 7, 15, 1, 0), + + SOC_DOUBLE_TLV("Dpath Da Volume", + MC_ASOC_DVOL_DPATHDA, 0, 8, 114, 0, mc_asoc_tlv_digital), + SOC_DOUBLE("Dpath Da Switch", + MC_ASOC_DVOL_DPATHDA, 7, 15, 1, 0), + + SOC_DOUBLE_TLV("Dpath Ad Volume", + MC_ASOC_DVOL_DPATHAD, 0, 8, 114, 0, mc_asoc_tlv_digital), + SOC_DOUBLE("Dpath Ad Switch", + MC_ASOC_DVOL_DPATHAD, 7, 15, 1, 0), + + + SOC_DOUBLE_TLV("LineIn1 Volume", + MC_ASOC_AVOL_LINEIN1, 0, 8, 63, 0, mc_asoc_tlv_ain), + SOC_DOUBLE("LineIn1 Switch", + MC_ASOC_AVOL_LINEIN1, 7, 15, 1, 0), + + SOC_SINGLE_TLV("Mic1 Volume", + MC_ASOC_AVOL_MIC1, 0, 63, 0, mc_asoc_tlv_ain), + SOC_SINGLE("Mic1 Switch", + MC_ASOC_AVOL_MIC1, 7, 1, 0), + + SOC_SINGLE_TLV("Mic2 Volume", + MC_ASOC_AVOL_MIC2, 0, 63, 0, mc_asoc_tlv_ain), + SOC_SINGLE("Mic2 Switch", + MC_ASOC_AVOL_MIC2, 7, 1, 0), + + SOC_SINGLE_TLV("Mic3 Volume", + MC_ASOC_AVOL_MIC3, 0, 63, 0, mc_asoc_tlv_ain), + SOC_SINGLE("Mic3 Switch", + MC_ASOC_AVOL_MIC3, 7, 1, 0), + + SOC_SINGLE_TLV("Mic4 Volume", + MC_ASOC_AVOL_MIC4, 0, 63, 0, mc_asoc_tlv_ain), + SOC_SINGLE("Mic4 Switch", + MC_ASOC_AVOL_MIC4, 7, 1, 0), + + SOC_DOUBLE_TLV("Headphone Volume", + MC_ASOC_AVOL_HP, 0, 8, 127, 0, mc_asoc_tlv_hp), + SOC_DOUBLE("Headphone Switch", + MC_ASOC_AVOL_HP, 7, 15, 1, 0), + + SOC_DOUBLE_TLV("Speaker Volume", + MC_ASOC_AVOL_SP, 0, 8, 127, 0, mc_asoc_tlv_sp), + SOC_DOUBLE("Speaker Switch", + MC_ASOC_AVOL_SP, 7, 15, 1, 0), + + SOC_SINGLE_TLV("Receiver Volume", + MC_ASOC_AVOL_RC, 0, 111, 0, mc_asoc_tlv_aout), + SOC_SINGLE("Receiver Switch", + MC_ASOC_AVOL_RC, 7, 1, 0), + + SOC_DOUBLE_TLV("LineOut1 Volume", + MC_ASOC_AVOL_LINEOUT1, 0, 8, 119, 0, mc_asoc_tlv_lout), + SOC_DOUBLE("LineOut1 Switch", + MC_ASOC_AVOL_LINEOUT1, 7, 15, 1, 0), + + SOC_DOUBLE_TLV("LineOut2 Volume", + MC_ASOC_AVOL_LINEOUT2, 0, 8, 119, 0, mc_asoc_tlv_lout), + SOC_DOUBLE("LineOut2 Switch", + MC_ASOC_AVOL_LINEOUT2, 7, 15, 1, 0), + + SOC_SINGLE_TLV("SP Gain", + MC_ASOC_AVOL_SP_GAIN, 0, 4, 0, mc_asoc_tlv_sp_gain), + + SOC_DOUBLE_TLV("Master Playback Volume", + MC_ASOC_DVOL_MASTER, 0, 8, 75, 0, mc_asoc_tlv_ext), + SOC_DOUBLE("Master Playback Switch", + MC_ASOC_DVOL_MASTER, 7, 15, 1, 0), + + SOC_DOUBLE_TLV("Voice Playback Volume", + MC_ASOC_DVOL_VOICE, 0, 8, 75, 0, mc_asoc_tlv_ext), + SOC_DOUBLE("Voice Playback Switch", + MC_ASOC_DVOL_VOICE, 7, 15, 1, 0), + + SOC_DOUBLE_TLV("AnalogIn Playback Analog Volume", + MC_ASOC_DVOL_APLAY_A, 0, 8, 63, 0, mc_asoc_tlv_ain), + SOC_DOUBLE("AnalogIn Playback Analog Switch", + MC_ASOC_DVOL_APLAY_A, 7, 15, 1, 0), + + SOC_DOUBLE_TLV("AnalogIn Playback Digital Volume", + MC_ASOC_DVOL_APLAY_D, 0, 8, 114, 0, mc_asoc_tlv_digital), + SOC_DOUBLE("AnalogIn Playback Digital Switch", + MC_ASOC_DVOL_APLAY_D, 7, 15, 1, 0), + + SOC_SINGLE("Voice Recording Switch", + MC_ASOC_VOICE_RECORDING, 0, 1, 0), + + SOC_ENUM("Audio Mode Playback", audio_mode_play_param_enum), + SOC_ENUM("Audio Mode Capture", audio_mode_cap_param_enum), + SOC_ENUM("Output Path", output_path_param_enum), + SOC_ENUM("Input Path", input_path_param_enum), + SOC_ENUM("Incall Mic Speaker", incall_mic_sp_param_enum), + SOC_ENUM("Incall Mic Receiver", incall_mic_rc_param_enum), + SOC_ENUM("Incall Mic Headphone", incall_mic_hp_param_enum), + SOC_ENUM("Incall Mic LineOut1", incall_mic_lo1_param_enum), + SOC_ENUM("Incall Mic LineOut2", incall_mic_lo2_param_enum), + SOC_ENUM("MainMIC Playback Path", + mainmic_playback_path_sw_param_enum), + SOC_ENUM("SubMIC Playback Path", submic_playback_path_sw_param_enum), + SOC_ENUM("2MIC Playback Path", msmic_playback_path_sw_param_enum), + SOC_ENUM("HeadsetMIC Playback Path", + hsmic_playback_path_sw_param_enum), + SOC_ENUM("BluetoothMIC Playback Path", + btmic_playback_path_sw_param_enum), + SOC_ENUM("LIN 1 Playback Path", lin1_playback_path_sw_param_enum), + SOC_ENUM("DTMF Control", dtmf_control_param_enum), + SOC_ENUM("DTMF Output", dtmf_output_param_enum), + SOC_ENUM("Switch Clock", switch_clock_param_enum), + SOC_ENUM("Ext MasterSlave", ext_masterslave_param_enum), + SOC_ENUM("Ext Rate", ext_rate_param_enum), + SOC_ENUM("Ext Bitclock Rate", ext_bck_rate_param_enum), + SOC_ENUM("Ext Interface", ext_interface_param_enum), + SOC_ENUM("Ext Bitclock Invert", ext_bck_invert_param_enum), + SOC_ENUM("Ext Input DA Bit Width", ext_input_bit_width_param_enum), + SOC_ENUM("Ext Output DA Bit Width", + ext_output_bit_width_param_enum), + SOC_ENUM("Ext Input DA Format", ext_input_da_format_param_enum), + SOC_ENUM("Ext Output DA Format", ext_output_da_format_param_enum), + SOC_ENUM("Ext Input Pcm MonoStereo", ext_input_pcm_mono_param_enum), + SOC_ENUM("Ext Output Pcm MonoStereo", ext_output_pcm_mono_param_enum), + SOC_ENUM("Ext Input Pcm Bit Order", ext_input_pcm_bit_order_param_enum), + SOC_ENUM("Ext Output Pcm Bit Order", + ext_output_pcm_bit_order_param_enum), + SOC_ENUM("Ext Input Pcm Format", ext_input_pcm_format_param_enum), + SOC_ENUM("Ext Output Pcm Format", ext_output_pcm_format_param_enum), + SOC_ENUM("Ext Input PCM Bit Width", ext_input_pcm_bit_width_param_enum), + SOC_ENUM("Ext Output PCM Bit Width", + ext_output_pcm_bit_width_param_enum), + SOC_ENUM("Voice MasterSlave", voice_masterslave_param_enum), + SOC_ENUM("Voice Rate", voice_rate_param_enum), + SOC_ENUM("Voice Bitclock Rate", voice_bck_rate_param_enum), + SOC_ENUM("Voice Interface", voice_interface_param_enum), + SOC_ENUM("Voice Bitclock Invert", voice_bck_invert_param_enum), + SOC_ENUM("Voice Input DA Bit Width", + voice_input_bit_width_param_enum), + SOC_ENUM("Voice Output DA Bit Width", + voice_output_bit_width_param_enum), + SOC_ENUM("Voice Input DA Format", voice_input_da_format_param_enum), + SOC_ENUM("Voice Output DA Format", voice_output_da_format_param_enum), + SOC_ENUM("Voice Input Pcm MonoStereo", voice_input_pcm_mono_param_enum), + SOC_ENUM("Voice Output Pcm MonoStereo", + voice_output_pcm_mono_param_enum), + SOC_ENUM("Voice Input Pcm Bit Order", + voice_input_pcm_bit_order_param_enum), + SOC_ENUM("Voice Output Pcm Bit Order", + voice_output_pcm_bit_order_param_enum), + SOC_ENUM("Voice Input Pcm Format", voice_input_pcm_format_param_enum), + SOC_ENUM("Voice Output Pcm Format", voice_output_pcm_format_param_enum), + SOC_ENUM("Voice Input PCM Bit Width", + voice_input_pcm_bit_width_param_enum), + SOC_ENUM("Voice Output PCM Bit Width", + voice_output_pcm_bit_width_param_enum), + SOC_ENUM("Music Physical Port", music_phy_port_param_enum), + SOC_ENUM("Ext Physical Port", ext_phy_port_param_enum), + SOC_ENUM("Voice Physical Port", voice_phy_port_param_enum), + SOC_ENUM("Hifi Physical Port", hifi_phy_port_param_enum), + SOC_ENUM("Adif0 Swap", adif0_swap_param_enum), + SOC_ENUM("Adif1 Swap", adif1_swap_param_enum), + SOC_ENUM("Adif2 Swap", adif2_swap_param_enum), + SOC_ENUM("Dac0 Swap", dac0_swap_param_enum), + SOC_ENUM("Dac1 Swap", dac1_swap_param_enum), + SOC_ENUM("Music Out0 Swap", music_out0_swap_param_enum), + SOC_ENUM("Music In0 Swap", music_in0_param_enum), + SOC_ENUM("Music In1 Swap", music_in1_param_enum), + SOC_ENUM("Music In2 Swap", music_in2_param_enum), + SOC_ENUM("Ext In Swap", ext_in_param_enum), + SOC_ENUM("Voice In Swap", voice_in_param_enum), + SOC_ENUM("Music Out1 Swap", music_out1_param_enum), + SOC_ENUM("Music Out2 Swap", music_out2_param_enum), + SOC_ENUM("Ext Out Swap", ext_out_param_enum), + SOC_ENUM("Voice Out Swap", voice_out_param_enum), + + SOC_ENUM("ADIF0 Source", adif_src[0]), + SOC_ENUM("ADIF1 Source", adif_src[1]), + SOC_ENUM("ADIF2 Source", adif_src[2]), + + SOC_SINGLE("Dsp Parameter", MC_ASOC_DSP_PARAM, 0, + ARRAY_SIZE(firmware_name)-1, 0), + SOC_SINGLE("Dsp Parameter Option", MC_ASOC_DSP_PARAM_OPT, 0, + YMC_DSP_VOICECALL_BASE_COMMON, 0), + SOC_ENUM("Clear Dsp Parameter", clear_dsp_prm_param_enum), + + SOC_SINGLE("Playback Scenario", MC_ASOC_PLAYBACK_SCENARIO, 0, + 500, 0), + SOC_SINGLE("Capture Scenario", MC_ASOC_CAPTURE_SCENARIO, 0, + 500, 0), + + SOC_ENUM("Parameter Setting", parameter_setting_param_enum) + , SOC_ENUM("Main Mic", main_mic_param_enum) + , SOC_ENUM("Sub Mic", sub_mic_param_enum) + , SOC_ENUM("Headset Mic", hs_mic_param_enum) +#ifdef MC_ASOC_TEST + , SOC_ENUM("MIC1 BIAS", mic1_bias_param_enum) + , SOC_ENUM("MIC2 BIAS", mic2_bias_param_enum) + , SOC_ENUM("MIC3 BIAS", mic3_bias_param_enum) + , SOC_ENUM("MIC4 BIAS", mic4_bias_param_enum) +#endif +}; + +struct snd_soc_codec *mc_asoc_codec; +static struct spi_device *mc_asoc_spi; + +static UINT8 mc_asoc_ver_id = 1; +static UINT8 mc_asoc_hold = YMC_NOTITY_HOLD_OFF; +static UINT8 mc_asoc_suspended; +static UINT8 mc_asoc_hpimpclass = (UINT8)-1; +static UINT8 mc_asoc_jack_status; +static UINT8 mc_asoc_irq_func; + +static struct MCDRV_VOL_INFO mc_asoc_vol_info_mute; + +static UINT8 mc_asoc_main_mic = MAIN_MIC; +static UINT8 mc_asoc_sub_mic = SUB_MIC; +static UINT8 mc_asoc_hs_mic = HEADSET_MIC; +static UINT8 mc_asoc_mic1_bias = MIC1_BIAS; +static UINT8 mc_asoc_mic2_bias = MIC2_BIAS; +static UINT8 mc_asoc_mic3_bias = MIC3_BIAS; +static UINT8 mc_asoc_mic4_bias = MIC4_BIAS; +static UINT8 mc_asoc_MBSEL4 = 0x80; + +static UINT8 mc_asoc_audio_play_port = DIO_MUSIC; +static UINT8 mc_asoc_audio_cap_port = DIO_MUSIC; +static UINT8 mc_asoc_voice_port = DIO_EXT; +static UINT8 mc_asoc_port_rate = MCDRV_FS_48000; + +static struct mutex mc_asoc_mutex; +static struct mutex hsdet_mutex; + +static struct mc_asoc_data *mc_asoc_get_mc_asoc( + const struct snd_soc_codec *codec); +static int map_drv_error(int err); +static int set_bias_level(struct snd_soc_codec *codec, + enum snd_soc_bias_level level); +/* + * Function + */ +UINT8 mc_asoc_get_bus_select(void) +{ + return BUS_SELECT; +} + +void mc_asoc_set_enable_clock_func( + int (*pcbfunc)(struct snd_soc_codec *, int, bool)) +{ + struct mc_asoc_data *mc_asoc = NULL; + + mc_asoc = mc_asoc_get_mc_asoc(mc_asoc_codec); + mc_asoc->penableclkfn = pcbfunc; +} + +void mc_asoc_enable_clock(int enable) +{ +#ifdef FEATURE_MCLK_CONTROL_BY_YMU831 + /* To do */ +#endif +} + +static void mc_asoc_lock(char *fn) +{ + mutex_lock(&mc_asoc_mutex); +} + +static void mc_asoc_unlock(char *fn) +{ + mutex_unlock(&mc_asoc_mutex); +} + +static struct mc_asoc_data *mc_asoc_get_mc_asoc( + const struct snd_soc_codec *codec) +{ + struct mc_asoc_priv *priv; + + if (codec == NULL) + return NULL; + + priv = snd_soc_codec_get_drvdata((struct snd_soc_codec *)codec); + if (priv != NULL) + return &priv->data; + + return NULL; +} + +/* deliver i2c access to machdep */ +static int map_drv_error(int err) +{ + switch (err) { + case MCDRV_SUCCESS: + return 0; + case MCDRV_ERROR_ARGUMENT: + return -EINVAL; + case MCDRV_ERROR_STATE: + return -EBUSY; + case MCDRV_ERROR_TIMEOUT: + return -EIO; + default: + /* internal error */ + return -EIO; + } +} + + +static int read_cache( + struct snd_soc_codec *codec, + unsigned int reg) +{ + int ret; + unsigned int val; + + ret = snd_soc_cache_read(codec, reg, &val); + if (ret != 0) { + dev_err(codec->dev, "Cache read to %x failed: %d\n", reg, ret); + return -EIO; + } + return val; +} + +static int write_cache( + struct snd_soc_codec *codec, + unsigned int reg, + unsigned int value) +{ + return snd_soc_cache_write(codec, reg, value); +} + +#define DSP_MEM_STATIC +#ifdef DSP_MEM_STATIC +#define DSP_MEM_SIZE (200000) +static int dsp_mem_pt; +static UINT8 dsp_mem[DSP_MEM_SIZE]; +#else +#include "linux/vmalloc.h" +#endif + +static UINT8 *get_dsp_mem(int size) +{ +#ifdef DSP_MEM_STATIC + UINT8 *p = NULL; + if ((dsp_mem_pt+size) < DSP_MEM_SIZE) { + p = dsp_mem + dsp_mem_pt; + dsp_mem_pt += size; + dbg_info("dsp_mem_pt:%d\n", dsp_mem_pt); + } else { + pr_info("mem alloc failed!\n"); + } + return p; +#else + return vmalloc(size); +#endif +} + +#include <linux/firmware.h> +static int load_file(const char *fn, char **fp) +{ + int ret; + struct device *dev = mc_asoc_codec->dev; + const struct firmware *fw; + char filename[512]; + + TRACE_FUNC(); + + strcpy(filename, MC_ASOC_HWDEP_ID); + strcat(filename, "/"); + strcat(filename, fn); + ret = request_firmware(&fw, filename, dev); + if (ret != 0) { + pr_err("request_firmware failed(errno %d) for %s", ret, fn); + return ret; + } + + *fp = get_dsp_mem(fw->size); + if (*fp == NULL) { + printk(KERN_INFO "Out of memory loading '%s'.\n", fn); + release_firmware(fw); + return -EIO; + } + memcpy(*fp, fw->data, fw->size); + ret = fw->size; + + release_firmware(fw); + return ret; +} + +static int get_mic_block_on(UINT8 mic) +{ + switch (mic) { + case MIC_1: + return MCDRV_ASRC_MIC1_ON; + case MIC_2: + return MCDRV_ASRC_MIC2_ON; + case MIC_3: + return MCDRV_ASRC_MIC3_ON; + case MIC_4: + return MCDRV_ASRC_MIC4_ON; + default: + return -1; + } +} + +static int get_main_mic_block_on(void) +{ + return get_mic_block_on(mc_asoc_main_mic); +} +static int get_sub_mic_block_on(void) +{ + return get_mic_block_on(mc_asoc_sub_mic); +} +static int get_hs_mic_block_on(void) +{ + return get_mic_block_on(mc_asoc_hs_mic); +} + +static int get_unused_mic_block_on(void) +{ + int ret = MCDRV_ASRC_MIC1_ON + | MCDRV_ASRC_MIC2_ON + | MCDRV_ASRC_MIC3_ON + | MCDRV_ASRC_MIC4_ON; + if ((mc_asoc_main_mic == MIC_1) + || (mc_asoc_sub_mic == MIC_1) + || (mc_asoc_hs_mic == MIC_1)) + ret &= ~MCDRV_ASRC_MIC1_ON; + if ((mc_asoc_main_mic == MIC_2) + || (mc_asoc_sub_mic == MIC_2) + || (mc_asoc_hs_mic == MIC_2)) + ret &= ~MCDRV_ASRC_MIC2_ON; + if ((mc_asoc_main_mic == MIC_3) + || (mc_asoc_sub_mic == MIC_3) + || (mc_asoc_hs_mic == MIC_3)) + ret &= ~MCDRV_ASRC_MIC3_ON; + if ((mc_asoc_main_mic == MIC_4) + || (mc_asoc_sub_mic == MIC_4) + || (mc_asoc_hs_mic == MIC_4)) + ret &= ~MCDRV_ASRC_MIC4_ON; + return ret; +} + + +static UINT8 get_incall_mic( + struct snd_soc_codec *codec, + int output_path +) +{ + switch (output_path) { + case MC_ASOC_OUTPUT_PATH_SP: + return read_cache(codec, MC_ASOC_INCALL_MIC_SP); + break; + case MC_ASOC_OUTPUT_PATH_RC: + case MC_ASOC_OUTPUT_PATH_SP_RC: + case MC_ASOC_OUTPUT_PATH_LO1_RC: + case MC_ASOC_OUTPUT_PATH_LO2_RC: + return read_cache(codec, MC_ASOC_INCALL_MIC_RC); + break; + case MC_ASOC_OUTPUT_PATH_HP: + case MC_ASOC_OUTPUT_PATH_SP_HP: + case MC_ASOC_OUTPUT_PATH_LO1_HP: + case MC_ASOC_OUTPUT_PATH_LO2_HP: + return read_cache(codec, MC_ASOC_INCALL_MIC_HP); + break; + case MC_ASOC_OUTPUT_PATH_LO1: + case MC_ASOC_OUTPUT_PATH_SP_LO1: + case MC_ASOC_OUTPUT_PATH_LO2_LO1: + return read_cache(codec, MC_ASOC_INCALL_MIC_LO1); + break; + case MC_ASOC_OUTPUT_PATH_LO2: + case MC_ASOC_OUTPUT_PATH_SP_LO2: + case MC_ASOC_OUTPUT_PATH_LO1_LO2: + return read_cache(codec, MC_ASOC_INCALL_MIC_LO2); + break; + case MC_ASOC_OUTPUT_PATH_HS: + case MC_ASOC_OUTPUT_PATH_BT: + case MC_ASOC_OUTPUT_PATH_SP_BT: + case MC_ASOC_OUTPUT_PATH_LO1_BT: + case MC_ASOC_OUTPUT_PATH_LO2_BT: + return MC_ASOC_INCALL_MIC_MAINMIC; + default: + break; + } + return -EIO; +} + +struct mc_asoc_mixer_path_ctl_info { + int audio_mode_play; + int audio_mode_cap; + int output_path; + int input_path; + int incall_mic; + int mainmic_play; + int submic_play; + int msmic_play; + int hsmic_play; + int btmic_play; + int lin1_play; + int dtmf_control; + int dtmf_output; +}; + +static int get_mixer_path_ctl_info( + struct snd_soc_codec *codec, + struct mc_asoc_mixer_path_ctl_info *mixer_ctl_info +) +{ + mixer_ctl_info->audio_mode_play = + read_cache(codec, MC_ASOC_AUDIO_MODE_PLAY); + if (mixer_ctl_info->audio_mode_play < 0) + return -EIO; + + mixer_ctl_info->audio_mode_cap = + read_cache(codec, MC_ASOC_AUDIO_MODE_CAP); + if (mixer_ctl_info->audio_mode_cap < 0) + return -EIO; + + mixer_ctl_info->output_path = + read_cache(codec, MC_ASOC_OUTPUT_PATH); + if (mixer_ctl_info->output_path < 0) + return -EIO; + + mixer_ctl_info->input_path = + read_cache(codec, MC_ASOC_INPUT_PATH); + if (mixer_ctl_info->input_path < 0) + return -EIO; + + mixer_ctl_info->incall_mic = + get_incall_mic(codec, mixer_ctl_info->output_path); + if (mixer_ctl_info->incall_mic < 0) + return -EIO; + + mixer_ctl_info->dtmf_control = + read_cache(codec, MC_ASOC_DTMF_CONTROL); + if (mixer_ctl_info->dtmf_control < 0) + return -EIO; + + mixer_ctl_info->dtmf_output = + read_cache(codec, MC_ASOC_DTMF_OUTPUT); + if (mixer_ctl_info->dtmf_output < 0) + return -EIO; + + mixer_ctl_info->mainmic_play = + read_cache(codec, MC_ASOC_MAINMIC_PLAYBACK_PATH); + if (mixer_ctl_info->mainmic_play < 0) + return -EIO; + + mixer_ctl_info->submic_play = + read_cache(codec, MC_ASOC_SUBMIC_PLAYBACK_PATH); + if (mixer_ctl_info->submic_play < 0) + return -EIO; + + mixer_ctl_info->msmic_play = + read_cache(codec, MC_ASOC_2MIC_PLAYBACK_PATH); + if (mixer_ctl_info->msmic_play < 0) + return -EIO; + + mixer_ctl_info->hsmic_play = + read_cache(codec, MC_ASOC_HSMIC_PLAYBACK_PATH); + if (mixer_ctl_info->hsmic_play < 0) + return -EIO; + + mixer_ctl_info->btmic_play = + read_cache(codec, MC_ASOC_BTMIC_PLAYBACK_PATH); + if (mixer_ctl_info->btmic_play < 0) + return -EIO; + + mixer_ctl_info->lin1_play = + read_cache(codec, MC_ASOC_LIN1_PLAYBACK_PATH); + if (mixer_ctl_info->lin1_play < 0) + return -EIO; + + return 0; +} + +int ymu831_get_codec_suspended(struct snd_soc_codec *codec) +{ + struct mc_asoc_data *mc_asoc = NULL; + struct mc_asoc_mixer_path_ctl_info mixer_ctl_info; + int check_codec_suspend = 0; + + mc_asoc = mc_asoc_get_mc_asoc(codec); + if (mc_asoc == NULL) { + pr_err("%s: Can not mc_asoc", __func__); + return -1; + } + + if (get_mixer_path_ctl_info(codec, &mixer_ctl_info) < 0) { + pr_err("%s: get_mixer_path_ctl_info failed", __func__); + return -EIO; + } + + if ((mixer_ctl_info.audio_mode_play == 0) + && (mixer_ctl_info.audio_mode_cap == 0) + && (mixer_ctl_info.mainmic_play == 0) + && (mixer_ctl_info.submic_play == 0) + && (mixer_ctl_info.msmic_play == 0) + && (mixer_ctl_info.hsmic_play == 0) + && (mixer_ctl_info.btmic_play == 0) + && (mixer_ctl_info.lin1_play == 0) + && (mixer_ctl_info.dtmf_control == 0)) + check_codec_suspend = 1; + else + check_codec_suspend = 0; + + pr_info("%s: %d", __func__, check_codec_suspend); + + return check_codec_suspend; +} + +static int get_path_preset_idx( + const struct mc_asoc_mixer_path_ctl_info *mixer_ctl_info +) +{ + if ((mixer_ctl_info->audio_mode_play == MC_ASOC_AUDIO_MODE_INCOMM) + && ((mixer_ctl_info->audio_mode_cap == MC_ASOC_AUDIO_MODE_INCOMM) || + (mixer_ctl_info->audio_mode_cap == MC_ASOC_AUDIO_MODE_OFF))) { + if (mixer_ctl_info->output_path == MC_ASOC_OUTPUT_PATH_BT) + return 25; + else if ((mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_SP_BT) + || (mixer_ctl_info->output_path == MC_ASOC_OUTPUT_PATH_LO1_BT) + || (mixer_ctl_info->output_path == MC_ASOC_OUTPUT_PATH_LO2_BT) + ) + return 26; + else + return 24; + } + if ((mixer_ctl_info->audio_mode_cap == MC_ASOC_AUDIO_MODE_INCOMM) + && ((mixer_ctl_info->audio_mode_play == MC_ASOC_AUDIO_MODE_INCOMM) || + (mixer_ctl_info->audio_mode_play == MC_ASOC_AUDIO_MODE_OFF))) { + if (mixer_ctl_info->output_path == MC_ASOC_OUTPUT_PATH_BT) + return 25; + else if ((mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_SP_BT) + || (mixer_ctl_info->output_path == MC_ASOC_OUTPUT_PATH_LO1_BT) + || (mixer_ctl_info->output_path == MC_ASOC_OUTPUT_PATH_LO2_BT) + ) + return 26; + else + return 24; + } + + if ((mixer_ctl_info->audio_mode_play == MC_ASOC_AUDIO_MODE_INCOMM2) + && ((mixer_ctl_info->audio_mode_cap == MC_ASOC_AUDIO_MODE_INCOMM) || + (mixer_ctl_info->audio_mode_cap == MC_ASOC_AUDIO_MODE_OFF))) { + if (mixer_ctl_info->output_path == MC_ASOC_OUTPUT_PATH_BT) + return 63; + else if ((mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_SP_BT) + || (mixer_ctl_info->output_path == MC_ASOC_OUTPUT_PATH_LO1_BT) + || (mixer_ctl_info->output_path == MC_ASOC_OUTPUT_PATH_LO2_BT) + ) + return 64; + else + return 62; + } + + if (mixer_ctl_info->audio_mode_play == MC_ASOC_AUDIO_MODE_INCALL) { + if (mixer_ctl_info->audio_mode_cap + == MC_ASOC_AUDIO_MODE_INCALL) { + if (mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_BT) + return 13; + if ((mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_SP_BT) + || (mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_LO1_BT) + || (mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_LO2_BT)) + return 14; + else + return 12; + } + if (mixer_ctl_info->audio_mode_cap + == MC_ASOC_AUDIO_MODE_AUDIO_INCALL) { + if (mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_BT) + return 19; + else if ((mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_SP_BT) + || (mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_LO1_BT) + || (mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_LO2_BT)) + return 20; + else + return 18; + } + } + + if (mixer_ctl_info->audio_mode_play == MC_ASOC_AUDIO_MODE_INCALL2) { + if (mixer_ctl_info->audio_mode_cap + == MC_ASOC_AUDIO_MODE_INCALL) { + if (mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_BT) + return 51; + if ((mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_SP_BT) + || (mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_LO1_BT) + || (mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_LO2_BT)) + return 52; + else + return 50; + } + if (mixer_ctl_info->audio_mode_cap + == MC_ASOC_AUDIO_MODE_AUDIO_INCALL) { + if (mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_BT) + return 57; + else if ((mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_SP_BT) + || (mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_LO1_BT) + || (mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_LO2_BT)) + return 58; + else + return 56; + } + } + + if (mixer_ctl_info->audio_mode_play == MC_ASOC_AUDIO_MODE_INCALL3) { + if (mixer_ctl_info->audio_mode_cap + == MC_ASOC_AUDIO_MODE_INCALL) { + if (mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_BT) + return 66; + if ((mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_SP_BT) + || (mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_LO1_BT) + || (mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_LO2_BT)) + return 67; + else + return 65; + } + if (mixer_ctl_info->audio_mode_cap + == MC_ASOC_AUDIO_MODE_AUDIO_INCALL) { + if (mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_BT) + return 72; + else if ((mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_SP_BT) + || (mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_LO1_BT) + || (mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_LO2_BT)) + return 73; + else + return 71; + } + } + + if (mixer_ctl_info->audio_mode_play == MC_ASOC_AUDIO_MODE_INCALL4) { + if (mixer_ctl_info->audio_mode_cap + == MC_ASOC_AUDIO_MODE_INCALL) { + if (mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_BT) + return 78; + if ((mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_SP_BT) + || (mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_LO1_BT) + || (mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_LO2_BT)) + return 79; + else + return 77; + } + if (mixer_ctl_info->audio_mode_cap + == MC_ASOC_AUDIO_MODE_AUDIO_INCALL) { + if (mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_BT) + return 84; + else if ((mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_SP_BT) + || (mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_LO1_BT) + || (mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_LO2_BT)) + return 85; + else + return 83; + } + } + + if (mixer_ctl_info->audio_mode_play + == MC_ASOC_AUDIO_MODE_AUDIO_INCALL) { + if (mixer_ctl_info->audio_mode_cap + == MC_ASOC_AUDIO_MODE_INCALL) { + if (mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_BT) + return 16; + else if ((mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_SP_BT) + || (mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_LO1_BT) + || (mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_LO2_BT)) + return 17; + else + return 15; + } + if (mixer_ctl_info->audio_mode_cap + == MC_ASOC_AUDIO_MODE_AUDIO_INCALL) { + if (mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_BT) + return 22; + if ((mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_SP_BT) + || (mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_LO1_BT) + || (mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_LO2_BT)) + return 23; + else + return 21; + } + } + + if (mixer_ctl_info->audio_mode_play + == MC_ASOC_AUDIO_MODE_AUDIO_INCALL2) { + if (mixer_ctl_info->audio_mode_cap + == MC_ASOC_AUDIO_MODE_INCALL) { + if (mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_BT) + return 54; + else if ((mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_SP_BT) + || (mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_LO1_BT) + || (mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_LO2_BT)) + return 55; + else + return 53; + } + if (mixer_ctl_info->audio_mode_cap + == MC_ASOC_AUDIO_MODE_AUDIO_INCALL) { + if (mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_BT) + return 60; + if ((mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_SP_BT) + || (mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_LO1_BT) + || (mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_LO2_BT)) + return 61; + else + return 59; + } + } + + if (mixer_ctl_info->audio_mode_play + == MC_ASOC_AUDIO_MODE_AUDIO_INCALL3) { + if (mixer_ctl_info->audio_mode_cap + == MC_ASOC_AUDIO_MODE_INCALL) { + if (mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_BT) + return 69; + else if ((mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_SP_BT) + || (mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_LO1_BT) + || (mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_LO2_BT)) + return 70; + else + return 68; + } + if (mixer_ctl_info->audio_mode_cap + == MC_ASOC_AUDIO_MODE_AUDIO_INCALL) { + if (mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_BT) + return 75; + if ((mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_SP_BT) + || (mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_LO1_BT) + || (mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_LO2_BT)) + return 76; + else + return 74; + } + } + + if (mixer_ctl_info->audio_mode_play + == MC_ASOC_AUDIO_MODE_AUDIO_INCALL4) { + if (mixer_ctl_info->audio_mode_cap + == MC_ASOC_AUDIO_MODE_INCALL) { + if (mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_BT) + return 81; + else if ((mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_SP_BT) + || (mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_LO1_BT) + || (mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_LO2_BT)) + return 82; + else + return 80; + } + if (mixer_ctl_info->audio_mode_cap + == MC_ASOC_AUDIO_MODE_AUDIO_INCALL) { + if (mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_BT) + return 87; + if ((mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_SP_BT) + || (mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_LO1_BT) + || (mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_LO2_BT)) + return 88; + else + return 86; + } + } + + if (((mixer_ctl_info->audio_mode_play == MC_ASOC_AUDIO_MODE_AUDIO) + && (mixer_ctl_info->audio_mode_cap == MC_ASOC_AUDIO_MODE_OFF)) + || ((mixer_ctl_info->audio_mode_play == MC_ASOC_AUDIO_MODE_AUDIO) + && (mixer_ctl_info->audio_mode_cap == MC_ASOC_AUDIO_MODE_INCALL)) + || ((mixer_ctl_info->audio_mode_play == MC_ASOC_AUDIO_MODE_AUDIO) + && (mixer_ctl_info->audio_mode_cap == MC_ASOC_AUDIO_MODE_INCOMM)) + || ((mixer_ctl_info->audio_mode_play + == MC_ASOC_AUDIO_MODE_AUDIO_INCALL) + && (mixer_ctl_info->audio_mode_cap == MC_ASOC_AUDIO_MODE_OFF)) + || ((mixer_ctl_info->audio_mode_play + == MC_ASOC_AUDIO_MODE_AUDIO_INCALL2) + && (mixer_ctl_info->audio_mode_cap == MC_ASOC_AUDIO_MODE_OFF)) + || ((mixer_ctl_info->audio_mode_play + == MC_ASOC_AUDIO_MODE_AUDIO_INCALL3) + && (mixer_ctl_info->audio_mode_cap == MC_ASOC_AUDIO_MODE_OFF)) + || ((mixer_ctl_info->audio_mode_play + == MC_ASOC_AUDIO_MODE_AUDIO_INCALL4) + && (mixer_ctl_info->audio_mode_cap == MC_ASOC_AUDIO_MODE_OFF)) + || ((mixer_ctl_info->audio_mode_play + == MC_ASOC_AUDIO_MODE_AUDIO_INCALL) + && (mixer_ctl_info->audio_mode_cap == MC_ASOC_AUDIO_MODE_INCOMM)) + || ((mixer_ctl_info->audio_mode_play + == MC_ASOC_AUDIO_MODE_AUDIO_INCALL2) + && (mixer_ctl_info->audio_mode_cap == MC_ASOC_AUDIO_MODE_INCOMM)) + || ((mixer_ctl_info->audio_mode_play + == MC_ASOC_AUDIO_MODE_AUDIO_INCALL3) + && (mixer_ctl_info->audio_mode_cap == MC_ASOC_AUDIO_MODE_INCOMM)) + || ((mixer_ctl_info->audio_mode_play + == MC_ASOC_AUDIO_MODE_AUDIO_INCALL4) + && (mixer_ctl_info->audio_mode_cap == MC_ASOC_AUDIO_MODE_INCOMM)) + ) { + if (mixer_ctl_info->output_path == MC_ASOC_OUTPUT_PATH_BT) { + if ((mc_asoc_port_rate == MCDRV_FS_96000) + || (mc_asoc_port_rate == MCDRV_FS_192000)) + return -1; + return 2; + } else if ((mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_SP_BT) + || (mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_LO1_BT) + || (mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_LO2_BT)) { + if ((mc_asoc_port_rate == MCDRV_FS_96000) + || (mc_asoc_port_rate == MCDRV_FS_192000)) + return -1; + return 3; + } else { + if ((mc_asoc_port_rate == MCDRV_FS_96000) + || (mc_asoc_port_rate == MCDRV_FS_192000)) + return 27; + return 1; + } + } + if (((mixer_ctl_info->audio_mode_play == MC_ASOC_AUDIO_MODE_OFF) + && (mixer_ctl_info->audio_mode_cap == MC_ASOC_AUDIO_MODE_AUDIO)) + || ((mixer_ctl_info->audio_mode_play == MC_ASOC_AUDIO_MODE_OFF) + && (mixer_ctl_info->audio_mode_cap + == MC_ASOC_AUDIO_MODE_AUDIO_INCALL)) + || ((mixer_ctl_info->audio_mode_play == MC_ASOC_AUDIO_MODE_INCALL) + && (mixer_ctl_info->audio_mode_cap == MC_ASOC_AUDIO_MODE_AUDIO)) + || ((mixer_ctl_info->audio_mode_play == MC_ASOC_AUDIO_MODE_INCALL2) + && (mixer_ctl_info->audio_mode_cap == MC_ASOC_AUDIO_MODE_AUDIO)) + || ((mixer_ctl_info->audio_mode_play == MC_ASOC_AUDIO_MODE_INCALL3) + && (mixer_ctl_info->audio_mode_cap == MC_ASOC_AUDIO_MODE_AUDIO)) + || ((mixer_ctl_info->audio_mode_play == MC_ASOC_AUDIO_MODE_INCALL4) + && (mixer_ctl_info->audio_mode_cap == MC_ASOC_AUDIO_MODE_AUDIO)) + || ((mixer_ctl_info->audio_mode_play == MC_ASOC_AUDIO_MODE_INCOMM) + && (mixer_ctl_info->audio_mode_cap == MC_ASOC_AUDIO_MODE_AUDIO)) + || ((mixer_ctl_info->audio_mode_play == MC_ASOC_AUDIO_MODE_INCOMM2) + && (mixer_ctl_info->audio_mode_cap == MC_ASOC_AUDIO_MODE_AUDIO)) + || ((mixer_ctl_info->audio_mode_play == MC_ASOC_AUDIO_MODE_INCOMM) + && (mixer_ctl_info->audio_mode_cap + == MC_ASOC_AUDIO_MODE_AUDIO_INCALL)) + || ((mixer_ctl_info->audio_mode_play == MC_ASOC_AUDIO_MODE_INCOMM2) + && (mixer_ctl_info->audio_mode_cap + == MC_ASOC_AUDIO_MODE_AUDIO_INCALL))) { + if ((mixer_ctl_info->input_path + != MC_ASOC_INPUT_PATH_VOICECALL) + && (mixer_ctl_info->input_path + != MC_ASOC_INPUT_PATH_VOICEUPLINK) + && (mixer_ctl_info->input_path + != MC_ASOC_INPUT_PATH_VOICEDOWNLINK)) { + if (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_BT) { + if ((mc_asoc_port_rate == MCDRV_FS_96000) + || (mc_asoc_port_rate == MCDRV_FS_192000)) + return -1; + return 5; + } else { + if ((mc_asoc_port_rate == MCDRV_FS_96000) + || (mc_asoc_port_rate == MCDRV_FS_192000)) + return 28; + return 4; + } + } else { + if ((mc_asoc_port_rate == MCDRV_FS_96000) + || (mc_asoc_port_rate == MCDRV_FS_192000)) + return 28; + return 4; + } + } + if (((mixer_ctl_info->audio_mode_play == MC_ASOC_AUDIO_MODE_AUDIO) + && (mixer_ctl_info->audio_mode_cap == MC_ASOC_AUDIO_MODE_AUDIO)) + || ((mixer_ctl_info->audio_mode_play == MC_ASOC_AUDIO_MODE_AUDIO) + && (mixer_ctl_info->audio_mode_cap + == MC_ASOC_AUDIO_MODE_AUDIO_INCALL)) + || ((mixer_ctl_info->audio_mode_play + == MC_ASOC_AUDIO_MODE_AUDIO_INCALL) + && (mixer_ctl_info->audio_mode_cap == MC_ASOC_AUDIO_MODE_AUDIO)) + || ((mixer_ctl_info->audio_mode_play + == MC_ASOC_AUDIO_MODE_AUDIO_INCALL2) + && (mixer_ctl_info->audio_mode_cap == MC_ASOC_AUDIO_MODE_AUDIO)) + || ((mixer_ctl_info->audio_mode_play + == MC_ASOC_AUDIO_MODE_AUDIO_INCALL3) + && (mixer_ctl_info->audio_mode_cap == MC_ASOC_AUDIO_MODE_AUDIO)) + || ((mixer_ctl_info->audio_mode_play + == MC_ASOC_AUDIO_MODE_AUDIO_INCALL4) + && (mixer_ctl_info->audio_mode_cap == MC_ASOC_AUDIO_MODE_AUDIO)) + ) { + if ((mixer_ctl_info->input_path + != MC_ASOC_INPUT_PATH_VOICECALL) + && (mixer_ctl_info->input_path + != MC_ASOC_INPUT_PATH_VOICEUPLINK) + && (mixer_ctl_info->input_path + != MC_ASOC_INPUT_PATH_VOICEDOWNLINK)) { + if (mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_BT) { + if ((mc_asoc_port_rate == MCDRV_FS_96000) + || (mc_asoc_port_rate == MCDRV_FS_192000)) + return -1; + if (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_BT) + return 9; + else + return 8; + } + if ((mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_SP_BT) + || (mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_LO1_BT) + || (mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_LO2_BT)) { + if ((mc_asoc_port_rate == MCDRV_FS_96000) + || (mc_asoc_port_rate == MCDRV_FS_192000)) + return -1; + if (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_BT) + return 11; + else + return 10; + } + if (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_BT) { + if ((mc_asoc_port_rate == MCDRV_FS_96000) + || (mc_asoc_port_rate == MCDRV_FS_192000)) + return -1; + return 7; + } else { + if ((mc_asoc_port_rate == MCDRV_FS_96000) + || (mc_asoc_port_rate == MCDRV_FS_192000)) + return 29; + return 6; + } + } else { + if (mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_BT) { + if ((mc_asoc_port_rate == MCDRV_FS_96000) + || (mc_asoc_port_rate == MCDRV_FS_192000)) + return -1; + return 8; + } + if ((mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_SP_BT) + || (mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_LO1_BT) + || (mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_LO2_BT)) { + if ((mc_asoc_port_rate == MCDRV_FS_96000) + || (mc_asoc_port_rate == MCDRV_FS_192000)) + return -1; + return 10; + } else { + if ((mc_asoc_port_rate == MCDRV_FS_96000) + || (mc_asoc_port_rate == MCDRV_FS_192000)) + return 29; + return 6; + } + } + } + + if (((mixer_ctl_info->audio_mode_play == MC_ASOC_AUDIO_MODE_OFF) + && (mixer_ctl_info->audio_mode_cap == MC_ASOC_AUDIO_MODE_AUDIOEX)) + || ((mixer_ctl_info->audio_mode_play == MC_ASOC_AUDIO_MODE_INCALL) + && (mixer_ctl_info->audio_mode_cap == MC_ASOC_AUDIO_MODE_AUDIOEX)) + || ((mixer_ctl_info->audio_mode_play == MC_ASOC_AUDIO_MODE_INCALL2) + && (mixer_ctl_info->audio_mode_cap == MC_ASOC_AUDIO_MODE_AUDIOEX)) + || ((mixer_ctl_info->audio_mode_play == MC_ASOC_AUDIO_MODE_INCALL3) + && (mixer_ctl_info->audio_mode_cap == MC_ASOC_AUDIO_MODE_AUDIOEX)) + || ((mixer_ctl_info->audio_mode_play == MC_ASOC_AUDIO_MODE_INCALL4) + && (mixer_ctl_info->audio_mode_cap == MC_ASOC_AUDIO_MODE_AUDIOEX)) + || ((mixer_ctl_info->audio_mode_play == MC_ASOC_AUDIO_MODE_INCOMM) + && (mixer_ctl_info->audio_mode_cap == MC_ASOC_AUDIO_MODE_AUDIOEX)) + || ((mixer_ctl_info->audio_mode_play == MC_ASOC_AUDIO_MODE_INCOMM2) + && (mixer_ctl_info->audio_mode_cap == MC_ASOC_AUDIO_MODE_AUDIOEX))) { + if ((mixer_ctl_info->input_path + != MC_ASOC_INPUT_PATH_VOICECALL) + && (mixer_ctl_info->input_path + != MC_ASOC_INPUT_PATH_VOICEUPLINK) + && (mixer_ctl_info->input_path + != MC_ASOC_INPUT_PATH_VOICEDOWNLINK)) { + if (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_BT) + return 31; + else + return 30; + } else + return 30; + } + if (((mixer_ctl_info->audio_mode_play == MC_ASOC_AUDIO_MODE_AUDIO) + && (mixer_ctl_info->audio_mode_cap == MC_ASOC_AUDIO_MODE_AUDIOEX)) + || ((mixer_ctl_info->audio_mode_play + == MC_ASOC_AUDIO_MODE_AUDIO_INCALL) + && (mixer_ctl_info->audio_mode_cap == MC_ASOC_AUDIO_MODE_AUDIOEX)) + || ((mixer_ctl_info->audio_mode_play + == MC_ASOC_AUDIO_MODE_AUDIO_INCALL2) + && (mixer_ctl_info->audio_mode_cap == MC_ASOC_AUDIO_MODE_AUDIOEX)) + || ((mixer_ctl_info->audio_mode_play + == MC_ASOC_AUDIO_MODE_AUDIO_INCALL3) + && (mixer_ctl_info->audio_mode_cap == MC_ASOC_AUDIO_MODE_AUDIOEX)) + || ((mixer_ctl_info->audio_mode_play + == MC_ASOC_AUDIO_MODE_AUDIO_INCALL4) + && (mixer_ctl_info->audio_mode_cap == MC_ASOC_AUDIO_MODE_AUDIOEX)) + ) { + if ((mixer_ctl_info->input_path + != MC_ASOC_INPUT_PATH_VOICECALL) + && (mixer_ctl_info->input_path + != MC_ASOC_INPUT_PATH_VOICEUPLINK) + && (mixer_ctl_info->input_path + != MC_ASOC_INPUT_PATH_VOICEDOWNLINK)) { + if (mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_BT) { + if (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_BT) + return 35; + else + return 34; + } + if ((mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_SP_BT) + || (mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_LO1_BT) + || (mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_LO2_BT)) { + if (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_BT) + return 37; + else + return 36; + } + if (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_BT) + return 33; + else + return 32; + } else { + if (mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_BT) + return 34; + if ((mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_SP_BT) + || (mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_LO1_BT) + || (mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_LO2_BT)) + return 36; + else + return 32; + } + } + + if (((mixer_ctl_info->audio_mode_play == MC_ASOC_AUDIO_MODE_OFF) + && (mixer_ctl_info->audio_mode_cap == MC_ASOC_AUDIO_MODE_AUDIOVR)) + || ((mixer_ctl_info->audio_mode_play == MC_ASOC_AUDIO_MODE_INCALL) + && (mixer_ctl_info->audio_mode_cap == MC_ASOC_AUDIO_MODE_AUDIOVR)) + || ((mixer_ctl_info->audio_mode_play == MC_ASOC_AUDIO_MODE_INCOMM) + && (mixer_ctl_info->audio_mode_cap == MC_ASOC_AUDIO_MODE_AUDIOVR))) { + if ((mixer_ctl_info->input_path + != MC_ASOC_INPUT_PATH_VOICECALL) + && (mixer_ctl_info->input_path + != MC_ASOC_INPUT_PATH_VOICEUPLINK) + && (mixer_ctl_info->input_path + != MC_ASOC_INPUT_PATH_VOICEDOWNLINK)) { + if (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_BT) + return 39; + else + return 38; + } else + return 38; + } + if (((mixer_ctl_info->audio_mode_play == MC_ASOC_AUDIO_MODE_AUDIO) + && (mixer_ctl_info->audio_mode_cap == MC_ASOC_AUDIO_MODE_AUDIOVR)) + || ((mixer_ctl_info->audio_mode_play + == MC_ASOC_AUDIO_MODE_AUDIO_INCALL) + && (mixer_ctl_info->audio_mode_cap == MC_ASOC_AUDIO_MODE_AUDIOVR))) { + if (mixer_ctl_info->output_path == MC_ASOC_OUTPUT_PATH_BT) { + if (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_BT) + return 43; + else + return 42; + } + if ((mixer_ctl_info->output_path == MC_ASOC_OUTPUT_PATH_SP_BT) + || (mixer_ctl_info->output_path == MC_ASOC_OUTPUT_PATH_LO1_BT) + || (mixer_ctl_info->output_path == MC_ASOC_OUTPUT_PATH_LO2_BT) + ) { + if (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_BT) + return 45; + else + return 44; + } + if (mixer_ctl_info->input_path == MC_ASOC_INPUT_PATH_BT) + return 41; + else + return 40; + } + + if (mixer_ctl_info->audio_mode_play == MC_ASOC_AUDIO_MODE_KARAOKE) { + if (mixer_ctl_info->audio_mode_cap == MC_ASOC_AUDIO_MODE_OFF) { + if (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_BT) + return 47; + else + return 46; + } else if (mixer_ctl_info->audio_mode_cap + == MC_ASOC_AUDIO_MODE_AUDIO) { + if (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_BT) + return 49; + else + return 48; + } + } + if ((mixer_ctl_info->audio_mode_play == MC_ASOC_AUDIO_MODE_AUDIO) + && (mixer_ctl_info->audio_mode_cap == MC_ASOC_AUDIO_MODE_AUDIOLB)) { + if ((mc_asoc_port_rate == MCDRV_FS_96000) + || (mc_asoc_port_rate == MCDRV_FS_192000)) { + ; + return -1; + } + if (mixer_ctl_info->output_path == MC_ASOC_OUTPUT_PATH_BT) { + return 90; + } else if ((mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_SP_BT) + || (mixer_ctl_info->output_path == MC_ASOC_OUTPUT_PATH_LO1_BT) + || (mixer_ctl_info->output_path == MC_ASOC_OUTPUT_PATH_LO2_BT) + ) { + return 91; + } else { + return 89; + } + } + + if ((mixer_ctl_info->audio_mode_play == MC_ASOC_AUDIO_MODE_AUDIOCP) + && (mixer_ctl_info->audio_mode_cap == MC_ASOC_AUDIO_MODE_OFF)) { + ; + return 92; + } + + return 0; +} + +static int is_incall( + int preset_idx +) +{ + if (((preset_idx >= 12) && (preset_idx <= 23)) + || ((preset_idx >= 50) && (preset_idx <= 61)) + || ((preset_idx >= 65) && (preset_idx <= 88)) + ) + return 1; + + return 0; +} + +static int is_incall_BT( + int preset_idx +) +{ + if ((preset_idx == 13) + || (preset_idx == 14) + || (preset_idx == 16) + || (preset_idx == 17) + || (preset_idx == 19) + || (preset_idx == 20) + || (preset_idx == 22) + || (preset_idx == 23) + || (preset_idx == 51) + || (preset_idx == 52) + || (preset_idx == 54) + || (preset_idx == 55) + || (preset_idx == 57) + || (preset_idx == 58) + || (preset_idx == 60) + || (preset_idx == 61) + || (preset_idx == 66) + || (preset_idx == 67) + || (preset_idx == 69) + || (preset_idx == 70) + || (preset_idx == 72) + || (preset_idx == 73) + || (preset_idx == 75) + || (preset_idx == 76) + || (preset_idx == 78) + || (preset_idx == 79) + || (preset_idx == 81) + || (preset_idx == 82) + || (preset_idx == 84) + || (preset_idx == 85) + || (preset_idx == 87) + || (preset_idx == 88) + ) + return 1; + + return 0; +} + +static int is_incommunication( + int preset_idx +) +{ + if (((preset_idx >= 24) && (preset_idx <= 26)) + || ((preset_idx >= 62) && (preset_idx <= 64))) + return 1; + + return 0; +} + +static void set_vol_mute_flg(size_t offset, UINT8 lr, UINT8 mute) +{ + SINT16 *vp = (SINT16 *)((void *)&mc_asoc_vol_info_mute+offset); + + if (offset == (size_t)-1) + return; + + if (mute == 1) + *(vp+lr) = 0xA000; + else + *(vp+lr) = 0; +} + +static UINT8 get_vol_mute_flg(size_t offset, UINT8 lr) +{ + SINT16 *vp; + + if (offset == (size_t)-1) + return 1; /* mute */ + + vp = (SINT16 *)((void *)&mc_asoc_vol_info_mute+offset); + return (*(vp+lr) != 0); +} + +static int get_master_vol( + struct snd_soc_codec *codec, + SINT16 *db, + int reg, + int i +) +{ + int cache; + unsigned int v; + int sw, vol; + SINT32 sum; + +/* TRACE_FUNC();*/ + + cache = read_cache(codec, MC_ASOC_DVOL_MASTER); + if (cache < 0) + return -EIO; + v = (cache >> (i*8)) & 0xff; + sw = (v & 0x80); + vol = sw ? (v & 0x7f) : 0; + if (vol == 0) + *db = vreg_map[reg].volmap[0]; + else { + sum = *db + vreg_map[MC_ASOC_DVOL_MASTER].volmap[vol]; + if (sum < vreg_map[reg].volmap[0]) + sum = vreg_map[reg].volmap[0]; + *db = sum; + } + /*dbg_info("db=%d\n", *db);*/ + return 0; +} + +static int get_voice_vol( + struct snd_soc_codec *codec, + SINT16 *db, + int reg, + int i +) +{ + int cache; + unsigned int v; + int sw, vol; + SINT32 sum; + +/* TRACE_FUNC();*/ + + cache = read_cache(codec, MC_ASOC_DVOL_VOICE); + if (cache < 0) + return -EIO; + v = (cache >> (i*8)) & 0xff; + sw = (v & 0x80); + vol = sw ? (v & 0x7f) : 0; + if (vol == 0) + *db = vreg_map[reg].volmap[0]; + else { + sum = *db + vreg_map[MC_ASOC_DVOL_VOICE].volmap[vol]; + if (sum < vreg_map[reg].volmap[0]) + sum = vreg_map[reg].volmap[0]; + *db = sum; + } + return 0; +} + +static int get_aplay_vol( + struct snd_soc_codec *codec, + SINT16 *db, + int reg, + int i, + int aplay_reg, + const struct mc_asoc_mixer_path_ctl_info *mixer_ctl_info, + int preset_idx +) +{ + int cache; + unsigned int v; + int sw, vol; + SINT16 aplay_db; + +/* TRACE_FUNC();*/ + + if ((preset_idx >= 46) + && (preset_idx <= 49)) + return 0; + + if ((is_incall(preset_idx) != 0) + || (is_incommunication(preset_idx) != 0)) + return 0; + + if ((preset_idx < 12) + || (preset_idx == 28) + || (preset_idx > 29)) + ; + else + return 0; + + cache = read_cache(codec, aplay_reg); + if (cache < 0) + return -EIO; + v = (cache >> (i*8)) & 0xff; + sw = (v & 0x80); + vol = sw ? (v & 0x7f) : 0; + aplay_db = vreg_map[reg].volmap[vol]; + + if (reg == MC_ASOC_DVOL_ADIF1IN) { + if (mixer_ctl_info->lin1_play == 1) { + if ((preset_idx < 4) + || (preset_idx >= 38) + || (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_BT) + || (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_LIN1)) { + *db = aplay_db; + return 0; + } + } + if (mixer_ctl_info->mainmic_play == 1) { + if ((preset_idx < 4) + || (preset_idx >= 38) + || (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_BT) + || (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_MAINMIC)) { + *db = aplay_db; + return 0; + } + } + if (mixer_ctl_info->submic_play == 1) { + if ((preset_idx < 4) + || (preset_idx >= 38) + || (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_BT) + || (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_SUBMIC)) { + *db = aplay_db; + return 0; + } + } + if (mixer_ctl_info->msmic_play == 1) { + if ((preset_idx < 4) + || (preset_idx >= 38) + || (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_BT) + || (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_2MIC)) { + *db = aplay_db; + return 0; + } + } + if (mixer_ctl_info->hsmic_play == 1) { + if ((preset_idx < 4) + || (preset_idx >= 38) + || (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_BT) + || (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_HS)) { + *db = aplay_db; + return 0; + } + } + return 0; + } + + if (reg == MC_ASOC_AVOL_LINEIN1) { + if (mixer_ctl_info->lin1_play == 1) { + if ((preset_idx < 4) + || (preset_idx >= 38) + || (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_BT) + || (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_LIN1)) + *db = aplay_db; + } + return 0; + } + + if (reg == MC_ASOC_AVOL_MIC1) { + if (mc_asoc_main_mic == MIC_1) { + if (mixer_ctl_info->mainmic_play == 1) + if ((preset_idx < 4) + || (preset_idx >= 38) + || (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_BT) + || (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_MAINMIC)) { + *db = aplay_db; + return 0; + } + if (mixer_ctl_info->msmic_play == 1) + if ((preset_idx < 4) + || (preset_idx >= 38) + || (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_BT) + || (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_2MIC)) { + *db = aplay_db; + return 0; + } + } + if (mc_asoc_sub_mic == MIC_1) { + if (mixer_ctl_info->submic_play == 1) + if ((preset_idx < 4) + || (preset_idx >= 38) + || (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_BT) + || (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_SUBMIC)) { + *db = aplay_db; + return 0; + } + if (mixer_ctl_info->msmic_play == 1) + if ((preset_idx < 4) + || (preset_idx >= 38) + || (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_BT) + || (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_2MIC)) { + *db = aplay_db; + return 0; + } + } + if ((mc_asoc_hs_mic == MIC_1) + && (mixer_ctl_info->hsmic_play == 1)) + if ((preset_idx < 4) + || (preset_idx >= 38) + || (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_BT) + || (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_HS)) + *db = aplay_db; + + return 0; + } + + if (reg == MC_ASOC_AVOL_MIC2) { + if (mc_asoc_main_mic == MIC_2) { + if (mixer_ctl_info->mainmic_play == 1) + if ((preset_idx < 4) + || (preset_idx >= 38) + || (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_BT) + || (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_MAINMIC)) { + *db = aplay_db; + return 0; + } + if (mixer_ctl_info->msmic_play == 1) + if ((preset_idx < 4) + || (preset_idx >= 38) + || (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_BT) + || (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_2MIC)) { + *db = aplay_db; + return 0; + } + } + if (mc_asoc_sub_mic == MIC_2) { + if (mixer_ctl_info->submic_play == 1) + if ((preset_idx < 4) + || (preset_idx >= 38) + || (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_BT) + || (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_SUBMIC)) { + *db = aplay_db; + return 0; + } + if (mixer_ctl_info->msmic_play == 1) + if ((preset_idx < 4) + || (preset_idx >= 38) + || (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_BT) + || (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_2MIC)) { + *db = aplay_db; + return 0; + } + } + if ((mc_asoc_hs_mic == MIC_2) + && (mixer_ctl_info->hsmic_play == 1)) + if ((preset_idx < 4) + || (preset_idx >= 38) + || (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_BT) + || (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_HS)) + *db = aplay_db; + + return 0; + } + + if (reg == MC_ASOC_AVOL_MIC3) { + if (mc_asoc_main_mic == MIC_3) { + if (mixer_ctl_info->mainmic_play == 1) + if ((preset_idx < 4) + || (preset_idx >= 38) + || (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_BT) + || (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_MAINMIC)) { + *db = aplay_db; + return 0; + } + if (mixer_ctl_info->msmic_play == 1) + if ((preset_idx < 4) + || (preset_idx >= 38) + || (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_BT) + || (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_2MIC)) { + *db = aplay_db; + return 0; + } + } + if (mc_asoc_sub_mic == MIC_3) { + if (mixer_ctl_info->submic_play == 1) + if ((preset_idx < 4) + || (preset_idx >= 38) + || (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_BT) + || (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_SUBMIC)) { + *db = aplay_db; + return 0; + } + if (mixer_ctl_info->msmic_play == 1) + if ((preset_idx < 4) + || (preset_idx >= 38) + || (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_BT) + || (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_2MIC)) { + *db = aplay_db; + return 0; + } + } + if ((mc_asoc_hs_mic == MIC_3) + && (mixer_ctl_info->hsmic_play == 1)) + if ((preset_idx < 4) + || (preset_idx >= 38) + || (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_BT) + || (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_HS)) + *db = aplay_db; + + return 0; + } + + if (reg == MC_ASOC_AVOL_MIC4) { + if (mc_asoc_main_mic == MIC_4) { + if (mixer_ctl_info->mainmic_play == 1) + if ((preset_idx < 4) + || (preset_idx >= 38) + || (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_BT) + || (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_MAINMIC)) { + *db = aplay_db; + return 0; + } + if (mixer_ctl_info->msmic_play == 1) + if ((preset_idx < 4) + || (preset_idx >= 38) + || (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_BT) + || (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_2MIC)) { + *db = aplay_db; + return 0; + } + } + if (mc_asoc_sub_mic == MIC_4) { + if (mixer_ctl_info->submic_play == 1) + if ((preset_idx < 4) + || (preset_idx >= 38) + || (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_BT) + || (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_SUBMIC)) { + *db = aplay_db; + return 0; + } + if (mixer_ctl_info->msmic_play == 1) + if ((preset_idx < 4) + || (preset_idx >= 38) + || (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_BT) + || (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_2MIC)) { + *db = aplay_db; + return 0; + } + } + if ((mc_asoc_hs_mic == MIC_4) + && (mixer_ctl_info->hsmic_play == 1)) + if ((preset_idx < 4) + || (preset_idx >= 38) + || (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_BT) + || (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_HS)) + *db = aplay_db; + + return 0; + } + return 0; +} + +static int set_vol_info( + struct snd_soc_codec *codec, + struct MCDRV_VOL_INFO *vol_info, + int reg, + const struct mc_asoc_mixer_path_ctl_info *mixer_ctl_info, + int preset_idx +) +{ + SINT16 *vp; + int i; + int cache; + +/* TRACE_FUNC();*/ + + if (codec == NULL) + return -EIO; + + if (reg >= MC_ASOC_AVOL_SP_GAIN) + return -EIO; + + if (vreg_map[reg].offset != (size_t)-1) { + vp = (SINT16 *)((void *)vol_info + + vreg_map[reg].offset); + cache = read_cache(codec, reg); + if (cache < 0) + return -EIO; + + for (i = 0; i < vreg_map[reg].channels; i++, vp++) { + unsigned int v; + int sw, vol; + SINT16 db; + + v = (cache >> (i*8)) & 0xff; + sw = (v & 0x80); + + if (is_incall(preset_idx) != 0) { + if (reg == MC_ASOC_DVOL_VOICEOUT) { + if (((mc_asoc_voice_port == DIO_VOICE) + || (mc_asoc_voice_port == DIO_EXT)) + && (sw != 0)) { + ; + sw = read_cache(codec, + MC_ASOC_VOICE_RECORDING); + } + } else if (reg == MC_ASOC_DVOL_DAC0OUT) { + if ((mc_asoc_voice_port == LIN1_LOUT1) + && (sw != 0)) + sw = read_cache(codec, + MC_ASOC_VOICE_RECORDING); + } else if (reg == MC_ASOC_DVOL_DAC1OUT) { + if ((mc_asoc_voice_port == LIN1_LOUT2) + && (sw != 0)) + sw = read_cache(codec, + MC_ASOC_VOICE_RECORDING); + } + } else if (is_incommunication(preset_idx) != 0) { + if (reg == MC_ASOC_DVOL_VOICEOUT) { + if (sw != 0) { + sw = read_cache(codec, + MC_ASOC_VOICE_RECORDING); + } + } + } + + vol = sw ? (v & 0x7f) : 0; + + if (get_vol_mute_flg( + vreg_map[reg].offset, i) != 0) + db = vreg_map[reg].volmap[0]; + else + db = vreg_map[reg].volmap[vol]; + + if (reg == MC_ASOC_DVOL_MUSICIN) { + if ((mc_asoc_audio_play_port != DIO_MUSIC) + || (vol == 0)) + db = vreg_map[reg].volmap[0]; + else if (get_master_vol(codec, &db, reg, i) + != 0) + return -EIO; + } else if (reg == MC_ASOC_DVOL_VOICEIN) { + if (is_incall(preset_idx) == 0) + db = vreg_map[reg].volmap[vol]; + else if ((mc_asoc_voice_port == LIN1_LOUT1) + || (mc_asoc_voice_port == LIN1_LOUT2) + || (vol == 0)) + db = vreg_map[reg].volmap[0]; + else if ((mc_asoc_voice_port == DIO_EXT) + && (is_incall_BT(preset_idx) == 0)) + db = vreg_map[reg].volmap[vol]; + else if (get_voice_vol(codec, &db, reg, i) + != 0) + return -EIO; + } else if (reg == MC_ASOC_DVOL_EXTIN) { + if (is_incall(preset_idx) == 0) + db = vreg_map[reg].volmap[vol]; + else if ((mc_asoc_voice_port == DIO_VOICE) + || (is_incall_BT(preset_idx) != 0)) + db = vreg_map[reg].volmap[vol]; + else if (get_voice_vol(codec, &db, reg, i) + != 0) + return -EIO; + } else if (reg == MC_ASOC_DVOL_ADIF1IN) { + if (get_aplay_vol(codec, &db, reg, i, + MC_ASOC_DVOL_APLAY_D, + mixer_ctl_info, + preset_idx) != 0) + return -EIO; + if (mc_asoc_audio_play_port == LIN1) + if (get_master_vol( + codec, &db, reg, i) != 0) + return -EIO; + } else if (reg == MC_ASOC_AVOL_LINEIN1) { + if (is_incall(preset_idx) != 0) { + if (((mc_asoc_voice_port == LIN1_LOUT1) + || (mc_asoc_voice_port == LIN1_LOUT2)) + && (get_voice_vol(codec, &db, reg, i) + != 0)) { + ; + return -EIO; + } + } else { + if (get_aplay_vol( + codec, &db, reg, i, + MC_ASOC_DVOL_APLAY_A, + mixer_ctl_info, + preset_idx) != 0) + return -EIO; + } + } else if ((reg == MC_ASOC_AVOL_MIC1) + || (reg == MC_ASOC_AVOL_MIC2) + || (reg == MC_ASOC_AVOL_MIC3) + || (reg == MC_ASOC_AVOL_MIC4)) { + if (get_aplay_vol(codec, &db, reg, i, + MC_ASOC_DVOL_APLAY_A, + mixer_ctl_info, + preset_idx) != 0) + return -EIO; + } else if (reg == MC_ASOC_AVOL_HP) { + if ((mc_asoc_hpimpclass != (UINT8)-1) + && (db > vreg_map[reg].volmap[0])) { + SINT16 db_max = + vreg_map[MC_ASOC_AVOL_HP].volmap[ARRAY_SIZE(volmap_hp)-1]; + db += + (aswHpVolImpTable[mc_asoc_hpimpclass] + <<8); + if (db < + vreg_map[MC_ASOC_AVOL_HP].volmap[0]) + db = + vreg_map[MC_ASOC_AVOL_HP].volmap[0]; + else if (db > db_max) + db = db_max; + } + } else if (reg == MC_ASOC_DVOL_DAC0OUT) { + if ((mc_asoc_hpimpclass != (UINT8)-1) + && (db > vreg_map[reg].volmap[0])) { + SINT16 db_max = + volmap_digital[ARRAY_SIZE(volmap_digital)-1]; + db += + (aswDac0VolImpTable[mc_asoc_hpimpclass] + <<8); + if (db < volmap_digital[0]) + db = volmap_digital[0]; + else if (db > db_max) + db = db_max; + } + } + *vp = db | MCDRV_VOL_UPDATE; + } + } + return 0; +} +static int set_volume( + struct snd_soc_codec *codec, + const struct mc_asoc_mixer_path_ctl_info *mixer_ctl_info, + int preset_idx +) +{ + struct MCDRV_VOL_INFO vol_info; + int err; + int reg; + + /*TRACE_FUNC();*/ + + if (codec == NULL) + return -EIO; + + memset(&vol_info, 0, sizeof(struct MCDRV_VOL_INFO)); + + for (reg = MC_ASOC_DVOL_MUSICIN; reg < MC_ASOC_AVOL_SP_GAIN; reg++) { + err = set_vol_info(codec, &vol_info, reg, mixer_ctl_info, + preset_idx); + if (err < 0) + return err; + } + + err = _McDrv_Ctrl(MCDRV_SET_VOLUME, &vol_info, NULL, 0); + if (err != MCDRV_SUCCESS) { + dev_err(codec->dev, "%d: Error in MCDRV_SET_VOLUME\n", err); + return -EIO; + } + + return 0; +} + +static void mask_AnaOut_src( + struct MCDRV_PATH_INFO *path_info, + const struct mc_asoc_mixer_path_ctl_info *mixer_ctl_info, + int preset_idx +) +{ + UINT8 bCh; + + /*TRACE_FUNC();*/ + + if ((mixer_ctl_info->output_path != MC_ASOC_OUTPUT_PATH_SP) + && (mixer_ctl_info->output_path != MC_ASOC_OUTPUT_PATH_SP_RC) + && (mixer_ctl_info->output_path != MC_ASOC_OUTPUT_PATH_SP_HP) + && (mixer_ctl_info->output_path != MC_ASOC_OUTPUT_PATH_SP_LO1) + && (mixer_ctl_info->output_path != MC_ASOC_OUTPUT_PATH_SP_LO2) + && (mixer_ctl_info->output_path != MC_ASOC_OUTPUT_PATH_SP_BT)) + for (bCh = 0; bCh < SP_PATH_CHANNELS; bCh++) + path_info->asSp[bCh].dSrcOnOff = 0x002AAAAA; + + if ((mixer_ctl_info->output_path != MC_ASOC_OUTPUT_PATH_RC) + && (mixer_ctl_info->output_path != MC_ASOC_OUTPUT_PATH_SP_RC) + && (mixer_ctl_info->output_path != MC_ASOC_OUTPUT_PATH_LO1_RC) + && (mixer_ctl_info->output_path != MC_ASOC_OUTPUT_PATH_LO2_RC)) + for (bCh = 0; bCh < RC_PATH_CHANNELS; bCh++) + path_info->asRc[bCh].dSrcOnOff = 0x002AAAAA; + + if ((mixer_ctl_info->output_path != MC_ASOC_OUTPUT_PATH_HP) + && (mixer_ctl_info->output_path != MC_ASOC_OUTPUT_PATH_HS) + && (mixer_ctl_info->output_path != MC_ASOC_OUTPUT_PATH_SP_HP) + && (mixer_ctl_info->output_path != MC_ASOC_OUTPUT_PATH_LO1_HP) + && (mixer_ctl_info->output_path != MC_ASOC_OUTPUT_PATH_LO2_HP)) + for (bCh = 0; bCh < HP_PATH_CHANNELS; bCh++) + path_info->asHp[bCh].dSrcOnOff = 0x002AAAAA; + + if ((mixer_ctl_info->output_path != MC_ASOC_OUTPUT_PATH_LO1) + && (mixer_ctl_info->output_path != MC_ASOC_OUTPUT_PATH_SP_LO1) + && (mixer_ctl_info->output_path != MC_ASOC_OUTPUT_PATH_LO1_RC) + && (mixer_ctl_info->output_path != MC_ASOC_OUTPUT_PATH_LO1_HP) + && (mixer_ctl_info->output_path != MC_ASOC_OUTPUT_PATH_LO1_BT) + && (mixer_ctl_info->output_path != MC_ASOC_OUTPUT_PATH_LO1_LO2) + && (mixer_ctl_info->output_path != MC_ASOC_OUTPUT_PATH_LO2_LO1)) { + if (preset_idx < 12) { + if (mc_asoc_audio_cap_port == LOUT1) { + if ((preset_idx <= 3) + || (preset_idx == 6) + || (preset_idx == 7)) + for (bCh = 0; + bCh < LOUT1_PATH_CHANNELS; + bCh++) { + ; + path_info->asLout1[bCh].dSrcOnOff + = 0x002AAAAA; + } + } else + for (bCh = 0; bCh < LOUT1_PATH_CHANNELS; bCh++) + path_info->asLout1[bCh].dSrcOnOff + = 0x002AAAAA; + } else if (is_incall(preset_idx) != 0) { + /* incall */ + if (mc_asoc_voice_port == LIN1_LOUT1) { + ; + } else if (mc_asoc_audio_cap_port == LOUT1) { + if ((preset_idx != 18) + && (preset_idx != 21) + && (preset_idx != 56) + && (preset_idx != 59) + && (preset_idx != 71) + && (preset_idx != 74) + && (preset_idx != 83) + && (preset_idx != 86) + ) + for (bCh = 0; + bCh < LOUT1_PATH_CHANNELS; + bCh++) { + ; + path_info->asLout1[bCh].dSrcOnOff + = 0x002AAAAA; + } + } else { + for (bCh = 0; bCh < LOUT1_PATH_CHANNELS; bCh++) + path_info->asLout1[bCh].dSrcOnOff + = 0x002AAAAA; + } + } else if ((preset_idx == 24) + || (preset_idx >= 26)) { + for (bCh = 0; bCh < LOUT1_PATH_CHANNELS; bCh++) + path_info->asLout1[bCh].dSrcOnOff + = 0x002AAAAA; + } else if (preset_idx == 25) { + ; + } + } + + if ((mixer_ctl_info->output_path != MC_ASOC_OUTPUT_PATH_LO2) + && (mixer_ctl_info->output_path != MC_ASOC_OUTPUT_PATH_SP_LO2) + && (mixer_ctl_info->output_path != MC_ASOC_OUTPUT_PATH_LO2_RC) + && (mixer_ctl_info->output_path != MC_ASOC_OUTPUT_PATH_LO2_HP) + && (mixer_ctl_info->output_path != MC_ASOC_OUTPUT_PATH_LO2_BT) + && (mixer_ctl_info->output_path != MC_ASOC_OUTPUT_PATH_LO1_LO2) + && (mixer_ctl_info->output_path != MC_ASOC_OUTPUT_PATH_LO2_LO1)) { + if (preset_idx < 12) { + if (mc_asoc_audio_cap_port == LOUT2) { + if ((preset_idx <= 3) + || (preset_idx == 6) + || (preset_idx == 7)) + for (bCh = 0; + bCh < LOUT2_PATH_CHANNELS; + bCh++) { + ; + path_info->asLout2[bCh].dSrcOnOff + = 0x002AAAAA; + } + } else + for (bCh = 0; bCh < LOUT2_PATH_CHANNELS; bCh++) + path_info->asLout2[bCh].dSrcOnOff + = 0x002AAAAA; + } else if (is_incall(preset_idx) != 0) { + if (mc_asoc_voice_port == LIN1_LOUT2) + ; + else if (mc_asoc_audio_cap_port == LOUT2) { + if ((preset_idx != 18) + && (preset_idx != 21) + && (preset_idx != 56) + && (preset_idx != 59) + && (preset_idx != 71) + && (preset_idx != 74) + && (preset_idx != 83) + && (preset_idx != 86) + ) + for (bCh = 0; + bCh < LOUT2_PATH_CHANNELS; + bCh++) { + ; + path_info->asLout2[bCh].dSrcOnOff + = 0x002AAAAA; + } + } else { + for (bCh = 0; bCh < LOUT2_PATH_CHANNELS; bCh++) + path_info->asLout2[bCh].dSrcOnOff + = 0x002AAAAA; + } + } else if ((preset_idx == 24) + || (preset_idx >= 26)) { + for (bCh = 0; bCh < LOUT2_PATH_CHANNELS; bCh++) + path_info->asLout2[bCh].dSrcOnOff = + 0x002AAAAA; + } else if (preset_idx == 25) { + ; + } + } +} + +static void mask_BTOut_src( + struct MCDRV_PATH_INFO *path_info, + int output_path +) +{ + UINT8 bCh; + + /*TRACE_FUNC();*/ + + if ((output_path != MC_ASOC_OUTPUT_PATH_BT) + && (output_path != MC_ASOC_OUTPUT_PATH_SP_BT) + && (output_path != MC_ASOC_OUTPUT_PATH_LO1_BT) + && (output_path != MC_ASOC_OUTPUT_PATH_LO2_BT)) + for (bCh = 0; bCh < EXTOUT_PATH_CHANNELS; bCh++) + path_info->asExtOut[bCh].dSrcOnOff + = 0x00AAAAAA; +} + +static void mask_ADC_src( + struct MCDRV_PATH_INFO *path_info, + const struct mc_asoc_mixer_path_ctl_info *mixer_ctl_info, + int preset_idx +) +{ + int main_mic_block_on = get_main_mic_block_on(); + int sub_mic_block_on = get_sub_mic_block_on(); + int hs_mic_block_on = get_hs_mic_block_on(); + int unused_mic_block_on = get_unused_mic_block_on(); + UINT8 bCh; + + /*TRACE_FUNC();*/ + + if ((is_incall(preset_idx) == 0) + && (is_incommunication(preset_idx) == 0)) { + /* !incall */ + if ((preset_idx == 4) + || (preset_idx == 6) + || (preset_idx == 8) + || (preset_idx == 10) + || (preset_idx == 28) + || (preset_idx == 29) + || (preset_idx == 30) + || (preset_idx == 32) + || (preset_idx == 34) + || (preset_idx == 36) + || (preset_idx == 46) + || (preset_idx == 48)) { + /* in capture */ + if ((mixer_ctl_info->input_path + != MC_ASOC_INPUT_PATH_MAINMIC) + && (mixer_ctl_info->input_path + != MC_ASOC_INPUT_PATH_2MIC)) { + if (main_mic_block_on != -1) + for (bCh = 0; bCh < ADC0_PATH_CHANNELS; + bCh++) { + ; + path_info->asAdc0[bCh].dSrcOnOff + &= ~main_mic_block_on; + } + } + if ((mixer_ctl_info->input_path + != MC_ASOC_INPUT_PATH_SUBMIC) + && (mixer_ctl_info->input_path + != MC_ASOC_INPUT_PATH_2MIC)) { + if (sub_mic_block_on != -1) + for (bCh = 0; bCh < ADC0_PATH_CHANNELS; + bCh++) { + ; + path_info->asAdc0[bCh].dSrcOnOff + &= ~sub_mic_block_on; + } + } + if (mixer_ctl_info->input_path + != MC_ASOC_INPUT_PATH_HS) { + if (hs_mic_block_on != -1) + for (bCh = 0; bCh < ADC0_PATH_CHANNELS; + bCh++) { + ; + path_info->asAdc0[bCh].dSrcOnOff + &= ~hs_mic_block_on; + } + } + if (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_2MIC) { + path_info->asAdc0[0].dSrcOnOff + &= ~sub_mic_block_on; + path_info->asAdc0[1].dSrcOnOff + &= ~main_mic_block_on; + } + if (mixer_ctl_info->input_path + != MC_ASOC_INPUT_PATH_LIN1) { + path_info->asAdc0[0].dSrcOnOff + &= ~MCDRV_ASRC_LINEIN1_L_ON; + path_info->asAdc0[1].dSrcOnOff + &= ~MCDRV_ASRC_LINEIN1_R_ON; + } + } else { + if ((mixer_ctl_info->mainmic_play != 1) + && (mixer_ctl_info->msmic_play != 1)) { + if (main_mic_block_on != -1) + for (bCh = 0; bCh < ADC0_PATH_CHANNELS; + bCh++) { + ; + path_info->asAdc0[bCh].dSrcOnOff + &= ~main_mic_block_on; + } + } + if ((mixer_ctl_info->submic_play != 1) + && (mixer_ctl_info->msmic_play != 1)) { + if (sub_mic_block_on != -1) + for (bCh = 0; bCh < ADC0_PATH_CHANNELS; + bCh++) { + ; + path_info->asAdc0[bCh].dSrcOnOff + &= ~sub_mic_block_on; + } + } + if (mixer_ctl_info->hsmic_play != 1) { + if (hs_mic_block_on != -1) + for (bCh = 0; bCh < ADC0_PATH_CHANNELS; + bCh++) { + ; + path_info->asAdc0[bCh].dSrcOnOff + &= ~hs_mic_block_on; + } + } + if (mixer_ctl_info->lin1_play != 1) { + for (bCh = 0; bCh < ADC0_PATH_CHANNELS; + bCh++) { + path_info->asAdc0[bCh].dSrcOnOff + &= ~MCDRV_ASRC_LINEIN1_L_ON; + path_info->asAdc0[bCh].dSrcOnOff + &= ~MCDRV_ASRC_LINEIN1_M_ON; + path_info->asAdc0[bCh].dSrcOnOff + &= ~MCDRV_ASRC_LINEIN1_R_ON; + } + } + } + } else { + /* incall or incommunication */ + if ((mixer_ctl_info->output_path != MC_ASOC_OUTPUT_PATH_BT) + && (mixer_ctl_info->output_path != MC_ASOC_OUTPUT_PATH_SP_BT) + && (mixer_ctl_info->output_path != MC_ASOC_OUTPUT_PATH_LO1_BT) + && (mixer_ctl_info->output_path != MC_ASOC_OUTPUT_PATH_LO2_BT) + ) { + if (mixer_ctl_info->output_path + != MC_ASOC_OUTPUT_PATH_HS) { + if (hs_mic_block_on != -1) + for (bCh = 0; bCh < ADC0_PATH_CHANNELS; + bCh++) { + ; + path_info->asAdc0[bCh].dSrcOnOff + &= ~hs_mic_block_on; + } + + if ((mixer_ctl_info->incall_mic + != MC_ASOC_INCALL_MIC_MAINMIC) + && (mixer_ctl_info->incall_mic + != MC_ASOC_INCALL_MIC_2MIC) + && (main_mic_block_on != -1)) { + for (bCh = 0; bCh < ADC0_PATH_CHANNELS; + bCh++) { + ; + path_info->asAdc0[bCh].dSrcOnOff + &= ~main_mic_block_on; + } + } + if ((mixer_ctl_info->incall_mic + != MC_ASOC_INCALL_MIC_SUBMIC) + && (mixer_ctl_info->incall_mic + != MC_ASOC_INCALL_MIC_2MIC) + && (sub_mic_block_on != -1)) { + for (bCh = 0; + bCh < ADC0_PATH_CHANNELS; + bCh++) { + ; + path_info->asAdc0[bCh].dSrcOnOff + &= ~sub_mic_block_on; + } + } + if (mixer_ctl_info->incall_mic + == MC_ASOC_INCALL_MIC_2MIC) { + path_info->asAdc0[0].dSrcOnOff + &= ~sub_mic_block_on; + path_info->asAdc0[1].dSrcOnOff + &= ~main_mic_block_on; + } + } else { + if (main_mic_block_on != -1) { + for (bCh = 0; bCh < ADC0_PATH_CHANNELS; + bCh++) { + ; + path_info->asAdc0[bCh].dSrcOnOff + &= ~main_mic_block_on; + } + } + if (sub_mic_block_on != -1) { + for (bCh = 0; bCh < ADC0_PATH_CHANNELS; + bCh++) { + ; + path_info->asAdc0[bCh].dSrcOnOff + &= ~sub_mic_block_on; + } + } + } + } + } + for (bCh = 0; bCh < ADC0_PATH_CHANNELS; bCh++) + path_info->asAdc0[bCh].dSrcOnOff &= ~unused_mic_block_on; +} + +static void mask_ADC1_src( + struct MCDRV_PATH_INFO *path_info, + const struct mc_asoc_mixer_path_ctl_info *mixer_ctl_info, + int preset_idx +) +{ + int main_mic_block_on = get_main_mic_block_on(); + int sub_mic_block_on = get_sub_mic_block_on(); + int hs_mic_block_on = get_hs_mic_block_on(); + int unused_mic_block_on = get_unused_mic_block_on(); + + /*TRACE_FUNC();*/ + + /* !incall */ + if ((preset_idx == 38) + || (preset_idx == 40) + || (preset_idx == 42) + || (preset_idx == 44)) { + /* in capture */ + if ((mixer_ctl_info->input_path != MC_ASOC_INPUT_PATH_MAINMIC) + && (mixer_ctl_info->input_path != MC_ASOC_INPUT_PATH_2MIC)) { + if (main_mic_block_on != -1) + path_info->asAdc1[0].dSrcOnOff + &= ~main_mic_block_on; + } + if ((mixer_ctl_info->input_path != MC_ASOC_INPUT_PATH_SUBMIC) + && (mixer_ctl_info->input_path != MC_ASOC_INPUT_PATH_2MIC)) { + if (sub_mic_block_on != -1) + path_info->asAdc1[0].dSrcOnOff + &= ~sub_mic_block_on; + } + if (mixer_ctl_info->input_path != MC_ASOC_INPUT_PATH_HS) { + if (hs_mic_block_on != -1) + path_info->asAdc1[0].dSrcOnOff + &= ~hs_mic_block_on; + } + if (mixer_ctl_info->input_path != MC_ASOC_INPUT_PATH_LIN1) { + ; + path_info->asAdc1[0].dSrcOnOff + &= ~MCDRV_ASRC_LINEIN1_M_ON; + } + } + path_info->asAdc1[0].dSrcOnOff &= ~unused_mic_block_on; +} + +static void mask_DacRef( + struct MCDRV_PATH_INFO *path_info, + int output_path +) +{ + UINT8 bCh; + + /*TRACE_FUNC();*/ + + switch (output_path) { + case MC_ASOC_OUTPUT_PATH_SP: + case MC_ASOC_OUTPUT_PATH_LO2: + case MC_ASOC_OUTPUT_PATH_SP_LO2: + case MC_ASOC_OUTPUT_PATH_SP_BT: + case MC_ASOC_OUTPUT_PATH_LO2_BT: + case MC_ASOC_OUTPUT_PATH_LO1_LO2: + for (bCh = 0; bCh < ADIF2_PATH_CHANNELS; bCh++) + path_info->asAdif2[bCh].dSrcOnOff + &= ~MCDRV_D2SRC_DAC0REF_ON; + break; + case MC_ASOC_OUTPUT_PATH_RC: + case MC_ASOC_OUTPUT_PATH_HP: + case MC_ASOC_OUTPUT_PATH_HS: + case MC_ASOC_OUTPUT_PATH_LO1: + case MC_ASOC_OUTPUT_PATH_LO1_RC: + case MC_ASOC_OUTPUT_PATH_LO1_HP: + case MC_ASOC_OUTPUT_PATH_LO1_BT: + case MC_ASOC_OUTPUT_PATH_SP_RC: + case MC_ASOC_OUTPUT_PATH_SP_HP: + case MC_ASOC_OUTPUT_PATH_SP_LO1: + case MC_ASOC_OUTPUT_PATH_LO2_RC: + case MC_ASOC_OUTPUT_PATH_LO2_HP: + case MC_ASOC_OUTPUT_PATH_LO2_LO1: + for (bCh = 0; bCh < ADIF2_PATH_CHANNELS; bCh++) + path_info->asAdif2[bCh].dSrcOnOff + &= ~MCDRV_D2SRC_DAC1REF_ON; + break; + default: + break; + } +} + +static void add_path_info( + struct MCDRV_PATH_INFO *dst_path_info, + struct MCDRV_PATH_INFO *src_path_info +) +{ + UINT8 bCh; + + /*TRACE_FUNC();*/ + + for (bCh = 0; bCh < MUSICOUT_PATH_CHANNELS; bCh++) + dst_path_info->asMusicOut[bCh].dSrcOnOff + |= src_path_info->asMusicOut[bCh].dSrcOnOff; + + for (bCh = 0; bCh < EXTOUT_PATH_CHANNELS; bCh++) + dst_path_info->asExtOut[bCh].dSrcOnOff + |= src_path_info->asExtOut[bCh].dSrcOnOff; + + for (bCh = 0; bCh < HIFIOUT_PATH_CHANNELS; bCh++) + dst_path_info->asHifiOut[bCh].dSrcOnOff + |= src_path_info->asHifiOut[bCh].dSrcOnOff; + + for (bCh = 0; bCh < VBOXMIXIN_PATH_CHANNELS; bCh++) + dst_path_info->asVboxMixIn[bCh].dSrcOnOff + |= src_path_info->asVboxMixIn[bCh].dSrcOnOff; + + for (bCh = 0; bCh < AE_PATH_CHANNELS; bCh++) { + dst_path_info->asAe0[bCh].dSrcOnOff + |= src_path_info->asAe0[bCh].dSrcOnOff; + dst_path_info->asAe1[bCh].dSrcOnOff + |= src_path_info->asAe1[bCh].dSrcOnOff; + dst_path_info->asAe2[bCh].dSrcOnOff + |= src_path_info->asAe2[bCh].dSrcOnOff; + dst_path_info->asAe3[bCh].dSrcOnOff + |= src_path_info->asAe3[bCh].dSrcOnOff; + } + + for (bCh = 0; bCh < DAC0_PATH_CHANNELS; bCh++) + dst_path_info->asDac0[bCh].dSrcOnOff + |= src_path_info->asDac0[bCh].dSrcOnOff; + + for (bCh = 0; bCh < DAC1_PATH_CHANNELS; bCh++) + dst_path_info->asDac1[bCh].dSrcOnOff + |= src_path_info->asDac1[bCh].dSrcOnOff; + + for (bCh = 0; bCh < VOICEOUT_PATH_CHANNELS; bCh++) + dst_path_info->asVoiceOut[bCh].dSrcOnOff + |= src_path_info->asVoiceOut[bCh].dSrcOnOff; + + for (bCh = 0; bCh < VBOXIOIN_PATH_CHANNELS; bCh++) + dst_path_info->asVboxIoIn[bCh].dSrcOnOff + |= src_path_info->asVboxIoIn[bCh].dSrcOnOff; + + for (bCh = 0; bCh < VBOXHOSTIN_PATH_CHANNELS; bCh++) + dst_path_info->asVboxHostIn[bCh].dSrcOnOff + |= src_path_info->asVboxHostIn[bCh].dSrcOnOff; + + for (bCh = 0; bCh < HOSTOUT_PATH_CHANNELS; bCh++) + dst_path_info->asHostOut[bCh].dSrcOnOff + |= src_path_info->asHostOut[bCh].dSrcOnOff; + + for (bCh = 0; bCh < ADIF0_PATH_CHANNELS; bCh++) + dst_path_info->asAdif0[bCh].dSrcOnOff + |= src_path_info->asAdif0[bCh].dSrcOnOff; + + for (bCh = 0; bCh < ADIF1_PATH_CHANNELS; bCh++) + dst_path_info->asAdif1[bCh].dSrcOnOff + |= src_path_info->asAdif1[bCh].dSrcOnOff; + + for (bCh = 0; bCh < ADIF2_PATH_CHANNELS; bCh++) + dst_path_info->asAdif2[bCh].dSrcOnOff + |= src_path_info->asAdif2[bCh].dSrcOnOff; + + for (bCh = 0; bCh < ADC0_PATH_CHANNELS; bCh++) + dst_path_info->asAdc0[bCh].dSrcOnOff + |= src_path_info->asAdc0[bCh].dSrcOnOff; + + for (bCh = 0; bCh < ADC1_PATH_CHANNELS; bCh++) + dst_path_info->asAdc1[bCh].dSrcOnOff + |= src_path_info->asAdc1[bCh].dSrcOnOff; + + for (bCh = 0; bCh < HP_PATH_CHANNELS; bCh++) + dst_path_info->asHp[bCh].dSrcOnOff + |= src_path_info->asHp[bCh].dSrcOnOff; + + for (bCh = 0; bCh < SP_PATH_CHANNELS; bCh++) + dst_path_info->asSp[bCh].dSrcOnOff + |= src_path_info->asSp[bCh].dSrcOnOff; + + for (bCh = 0; bCh < RC_PATH_CHANNELS; bCh++) + dst_path_info->asRc[bCh].dSrcOnOff + |= src_path_info->asRc[bCh].dSrcOnOff; + + for (bCh = 0; bCh < LOUT1_PATH_CHANNELS; bCh++) + dst_path_info->asLout1[bCh].dSrcOnOff + |= src_path_info->asLout1[bCh].dSrcOnOff; + + for (bCh = 0; bCh < LOUT2_PATH_CHANNELS; bCh++) + dst_path_info->asLout2[bCh].dSrcOnOff + |= src_path_info->asLout2[bCh].dSrcOnOff; + + for (bCh = 0; bCh < BIAS_PATH_CHANNELS; bCh++) + dst_path_info->asBias[bCh].dSrcOnOff + |= src_path_info->asBias[bCh].dSrcOnOff; +} + +static void exchange_ADCtoPDM( + struct MCDRV_PATH_INFO *path_info, + UINT32 dPdmLOn, + UINT32 dPdmROn +) +{ + UINT32 dAdcOn = MCDRV_D2SRC_ADC0_L_ON + |MCDRV_D2SRC_ADC0_R_ON; + UINT32 dAdcOff = MCDRV_D2SRC_ADC0_L_OFF + |MCDRV_D2SRC_ADC0_R_OFF; + + /*TRACE_FUNC();*/ + + if (dPdmLOn != 0) { + path_info->asAdif1[0].dSrcOnOff &= ~dAdcOn; + path_info->asAdif1[0].dSrcOnOff |= dAdcOff; + path_info->asAdif1[0].dSrcOnOff |= dPdmLOn; + } + if (dPdmROn != 0) { + path_info->asAdif1[1].dSrcOnOff &= ~dAdcOn; + path_info->asAdif1[1].dSrcOnOff |= dAdcOff; + path_info->asAdif1[1].dSrcOnOff |= dPdmROn; + } +} + +static void exchange_ADC1toPDM( + struct MCDRV_PATH_INFO *path_info, + UINT32 dPdmLOn, + UINT32 dPdmROn +) +{ + UINT32 dAdcOn = MCDRV_D2SRC_ADC1_ON; + UINT32 dAdcOff = MCDRV_D2SRC_ADC1_OFF; + + /*TRACE_FUNC();*/ + + if (dPdmLOn != 0) { + path_info->asAdif0[0].dSrcOnOff &= ~dAdcOn; + path_info->asAdif0[0].dSrcOnOff |= dAdcOff; + path_info->asAdif0[0].dSrcOnOff |= dPdmLOn; + } + if (dPdmROn != 0) { + path_info->asAdif0[1].dSrcOnOff &= ~dAdcOn; + path_info->asAdif0[1].dSrcOnOff |= dAdcOff; + path_info->asAdif0[1].dSrcOnOff |= dPdmROn; + } +} + +static void set_ain_play_path( + struct MCDRV_PATH_INFO *path_info, + const struct mc_asoc_mixer_path_ctl_info *mixer_ctl_info, + int preset_idx, + int ignore_input_path +) +{ + int idx = AnalogPathMapping[preset_idx]; + + /*TRACE_FUNC();*/ + + if (idx >= ARRAY_SIZE(AnalogInputPath)) { + dbg_info("\n********\nAnalogPathMapping err\n********\n"); + return; + } + + if (mixer_ctl_info->mainmic_play == 1) { + if ((ignore_input_path != 0) + || (mixer_ctl_info->input_path == MC_ASOC_INPUT_PATH_MAINMIC) + ) { + add_path_info(path_info, + (struct MCDRV_PATH_INFO *)&AnalogInputPath[idx]); + if (mc_asoc_main_mic == MIC_PDM0) + exchange_ADCtoPDM(path_info, + MCDRV_D2SRC_PDM0_L_ON, MCDRV_D2SRC_PDM0_R_ON); + else if (mc_asoc_main_mic == MIC_PDM1) + exchange_ADCtoPDM(path_info, + MCDRV_D2SRC_PDM1_L_ON, MCDRV_D2SRC_PDM1_R_ON); + mask_ADC_src(path_info, mixer_ctl_info, preset_idx); + mask_BTOut_src(path_info, mixer_ctl_info->output_path); + return; + } + } + if (mixer_ctl_info->submic_play == 1) { + if ((ignore_input_path != 0) + || (mixer_ctl_info->input_path == MC_ASOC_INPUT_PATH_SUBMIC)) { + add_path_info(path_info, + (struct MCDRV_PATH_INFO *)&AnalogInputPath[idx]); + if (mc_asoc_sub_mic == MIC_PDM0) + exchange_ADCtoPDM(path_info, + MCDRV_D2SRC_PDM0_L_ON, MCDRV_D2SRC_PDM0_R_ON); + else if (mc_asoc_sub_mic == MIC_PDM1) + exchange_ADCtoPDM(path_info, + MCDRV_D2SRC_PDM1_L_ON, MCDRV_D2SRC_PDM1_R_ON); + mask_ADC_src(path_info, mixer_ctl_info, preset_idx); + mask_BTOut_src(path_info, mixer_ctl_info->output_path); + return; + } + } + if (mixer_ctl_info->hsmic_play == 1) { + if ((ignore_input_path != 0) + || (mixer_ctl_info->input_path == MC_ASOC_INPUT_PATH_HS)) { + add_path_info(path_info, + (struct MCDRV_PATH_INFO *)&AnalogInputPath[idx]); + if (mc_asoc_hs_mic == MIC_PDM0) + exchange_ADCtoPDM(path_info, + MCDRV_D2SRC_PDM0_L_ON, MCDRV_D2SRC_PDM0_R_ON); + else if (mc_asoc_hs_mic == MIC_PDM1) + exchange_ADCtoPDM(path_info, + MCDRV_D2SRC_PDM1_L_ON, MCDRV_D2SRC_PDM1_R_ON); + mask_ADC_src(path_info, mixer_ctl_info, preset_idx); + mask_BTOut_src(path_info, mixer_ctl_info->output_path); + return; + } + } + if (mixer_ctl_info->msmic_play == 1) { + if ((ignore_input_path != 0) + || (mixer_ctl_info->input_path == MC_ASOC_INPUT_PATH_2MIC)) { + add_path_info(path_info, + (struct MCDRV_PATH_INFO *)&AnalogInputPath[idx]); + if (mc_asoc_main_mic == MIC_PDM0) + exchange_ADCtoPDM(path_info, + MCDRV_D2SRC_PDM0_L_ON, 0); + else if (mc_asoc_main_mic == MIC_PDM1) + exchange_ADCtoPDM(path_info, + MCDRV_D2SRC_PDM1_L_ON, 0); + if (mc_asoc_sub_mic == MIC_PDM0) + exchange_ADCtoPDM(path_info, + 0, MCDRV_D2SRC_PDM0_R_ON); + else if (mc_asoc_sub_mic == MIC_PDM1) + exchange_ADCtoPDM(path_info, + 0, MCDRV_D2SRC_PDM1_R_ON); + mask_ADC_src(path_info, mixer_ctl_info, preset_idx); + mask_BTOut_src(path_info, mixer_ctl_info->output_path); + return; + } + } + if (mixer_ctl_info->lin1_play == 1) { + if ((ignore_input_path != 0) + || (mixer_ctl_info->input_path == MC_ASOC_INPUT_PATH_LIN1)) { + add_path_info(path_info, + (struct MCDRV_PATH_INFO *)&AnalogInputPath[idx]); + mask_ADC_src(path_info, mixer_ctl_info, preset_idx); + mask_BTOut_src(path_info, mixer_ctl_info->output_path); + return; + } + } +} + +static void set_BIAS( + struct MCDRV_PATH_INFO *path_info +) +{ + int i; + int mic_bias[BIAS_PATH_CHANNELS] = { + mc_asoc_mic1_bias, + mc_asoc_mic2_bias, + mc_asoc_mic3_bias, + mc_asoc_mic4_bias}; + UINT32 dOn[BIAS_PATH_CHANNELS] = { + MCDRV_ASRC_MIC1_ON, + MCDRV_ASRC_MIC2_ON, + MCDRV_ASRC_MIC3_ON, + MCDRV_ASRC_MIC4_ON}; + UINT8 bCh; + struct mc_asoc_data *mc_asoc = NULL; + int err; + struct MCDRV_HSDET_INFO stHSDetInfo; + struct MCDRV_REG_INFO reg_info; + + for (i = 0; i < BIAS_PATH_CHANNELS; i++) { + switch (mic_bias[i]) { + case BIAS_ON_ALWAYS: + path_info->asBias[i].dSrcOnOff |= dOn[i]; + break; + case BIAS_OFF: + path_info->asBias[i].dSrcOnOff &= ~dOn[i]; + break; + case BIAS_SYNC_MIC: + path_info->asBias[i].dSrcOnOff &= ~dOn[i]; + for (bCh = 0; bCh < ADC0_PATH_CHANNELS; bCh++) { + if ((path_info->asAdc0[bCh].dSrcOnOff & dOn[i]) + != 0) { + path_info->asBias[i].dSrcOnOff + |= dOn[i]; + break; + } + } + for (bCh = 0; bCh < ADC1_PATH_CHANNELS; bCh++) { + if ((path_info->asAdc1[bCh].dSrcOnOff & dOn[i]) + != 0) { + path_info->asBias[i].dSrcOnOff + |= dOn[i]; + break; + } + } + break; + default: + break; + } + } + + if (mc_asoc_jack_status == SND_JACK_HEADPHONE) { + err = _McDrv_Ctrl(MCDRV_GET_HSDET, + (void *)&stHSDetInfo, NULL, 0); + if ((err == MCDRV_SUCCESS) + && (stHSDetInfo.bEnMicDet == MCDRV_MICDET_ENABLE)) { + ; + path_info->asBias[3].dSrcOnOff |= + MCDRV_ASRC_MIC4_ON; + } + } else if (mc_asoc_jack_status == SND_JACK_HEADSET) { + ; + path_info->asBias[3].dSrcOnOff |= MCDRV_ASRC_MIC4_ON; + } + + if (((path_info->asHp[0].dSrcOnOff & MCDRV_ASRC_DAC0_L_ON) != 0) + || ((path_info->asHp[1].dSrcOnOff & MCDRV_ASRC_DAC0_R_ON) != 0) + || ((path_info->asAdc0[0].dSrcOnOff & MCDRV_ASRC_MIC4_ON) != 0) + || ((path_info->asAdc0[1].dSrcOnOff & MCDRV_ASRC_MIC4_ON) != 0) + || ((path_info->asAdc1[0].dSrcOnOff & MCDRV_ASRC_MIC4_ON) != 0)) { + reg_info.bRegType = MCDRV_REGTYPE_ANA; + reg_info.bAddress = 13; + err = _McDrv_Ctrl(MCDRV_READ_REG, (void *)®_info, NULL, + 0); + if (err == MCDRV_SUCCESS) { + reg_info.bData &= 0x3F; + reg_info.bData |= 0x80; + err = _McDrv_Ctrl(MCDRV_WRITE_REG, + (void *)®_info, NULL, 0); + } + } else { + reg_info.bRegType = MCDRV_REGTYPE_ANA; + reg_info.bAddress = 13; + err = _McDrv_Ctrl(MCDRV_READ_REG, (void *)®_info, NULL, + 0); + if (err == MCDRV_SUCCESS) { + reg_info.bData &= 0x3F; + reg_info.bData |= mc_asoc_MBSEL4; + err = _McDrv_Ctrl(MCDRV_WRITE_REG, + (void *)®_info, NULL, 0); + } + } + if (err != MCDRV_SUCCESS) { + ; + dbg_info("%d: Error in set_BIAS\n", err); + } + + mc_asoc = mc_asoc_get_mc_asoc(mc_asoc_codec); + if (mc_asoc->pdata != NULL) { + if (mc_asoc->pdata->set_ext_micbias != NULL) { + if ((path_info->asAdc0[0].dSrcOnOff&MCDRV_ASRC_MIC1_ON) + || (path_info->asAdc0[1].dSrcOnOff&MCDRV_ASRC_MIC1_ON) + || (path_info->asAdc1[0].dSrcOnOff&MCDRV_ASRC_MIC1_ON) + ) { + ; + (*mc_asoc->pdata->set_ext_micbias)(1); + } else { + (*mc_asoc->pdata->set_ext_micbias)(0); + } + } + } +} + +static void get_path_info( + struct MCDRV_PATH_INFO *path_info, + const struct mc_asoc_mixer_path_ctl_info *mixer_ctl_info, + int preset_idx +) +{ + int ain_play = 0; + UINT8 mute_DIT = 0; + int idx; + struct MCDRV_PATH_INFO *preset_path_info; + + /*TRACE_FUNC();*/ + + if ((mixer_ctl_info->mainmic_play == 1) + || (mixer_ctl_info->submic_play == 1) + || (mixer_ctl_info->msmic_play == 1) + || (mixer_ctl_info->hsmic_play == 1) + || (mixer_ctl_info->lin1_play == 1)) + ain_play = 1; + else + ain_play = 0; + + preset_path_info = + (struct MCDRV_PATH_INFO *)&stPresetPathInfo[preset_idx]; + + if (mixer_ctl_info->dtmf_control == 1) { + if ((mixer_ctl_info->dtmf_output == MC_ASOC_DTMF_OUTPUT_SP) + && (mixer_ctl_info->output_path != MC_ASOC_OUTPUT_PATH_SP)) { + ; + } else { + idx = DtmfPathMapping[preset_idx]; + if (idx >= ARRAY_SIZE(DtmfPath)) { + dbg_info("\n***\nDtmfPathMapping err\n***\n"); + return; + } + add_path_info(path_info, + (struct MCDRV_PATH_INFO *)&DtmfPath[idx]); + mask_AnaOut_src(path_info, mixer_ctl_info, preset_idx); + mask_BTOut_src(path_info, mixer_ctl_info->output_path); + } + } + + set_vol_mute_flg(vreg_map[MC_ASOC_DVOL_EXTOUT].offset, 0, 0); + set_vol_mute_flg(vreg_map[MC_ASOC_DVOL_EXTOUT].offset, 1, 0); + set_vol_mute_flg(vreg_map[MC_ASOC_DVOL_MUSICOUT].offset, 0, 0); + set_vol_mute_flg(vreg_map[MC_ASOC_DVOL_MUSICOUT].offset, 1, 0); + + if (is_incommunication(preset_idx) != 0) { + if (mixer_ctl_info->output_path == MC_ASOC_OUTPUT_PATH_BT) { + add_path_info(path_info, preset_path_info); + path_info->asVboxMixIn[1].dSrcOnOff = 0x00AAAAAA; + } else if ((mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_SP_BT) + || (mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_LO1_BT) + || (mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_LO2_BT)) { + add_path_info(path_info, preset_path_info); + mask_AnaOut_src(path_info, mixer_ctl_info, preset_idx); + path_info->asVboxMixIn[1].dSrcOnOff = 0x00AAAAAA; + mask_DacRef(path_info, mixer_ctl_info->output_path); + } else { + add_path_info(path_info, preset_path_info); + + if (mixer_ctl_info->incall_mic + == MC_ASOC_INCALL_MIC_MAINMIC) { + if (mc_asoc_main_mic == MIC_PDM0) + exchange_ADCtoPDM(path_info, + MCDRV_D2SRC_PDM0_L_ON, + MCDRV_D2SRC_PDM0_R_ON); + else if (mc_asoc_main_mic == MIC_PDM1) + exchange_ADCtoPDM(path_info, + MCDRV_D2SRC_PDM1_L_ON, + MCDRV_D2SRC_PDM1_R_ON); + path_info->asVboxMixIn[1].dSrcOnOff + = 0x00AAAAAA; + } else if (mixer_ctl_info->incall_mic + == MC_ASOC_INCALL_MIC_SUBMIC) { + if (mc_asoc_sub_mic == MIC_PDM0) + exchange_ADCtoPDM(path_info, + MCDRV_D2SRC_PDM0_L_ON, + MCDRV_D2SRC_PDM0_R_ON); + else if (mc_asoc_sub_mic == MIC_PDM1) + exchange_ADCtoPDM(path_info, + MCDRV_D2SRC_PDM1_L_ON, + MCDRV_D2SRC_PDM1_R_ON); + path_info->asVboxMixIn[1].dSrcOnOff + = 0x00AAAAAA; + } else { + if (mc_asoc_main_mic == MIC_PDM0) + exchange_ADCtoPDM(path_info, + MCDRV_D2SRC_PDM0_L_ON, 0); + else if (mc_asoc_main_mic == MIC_PDM1) + exchange_ADCtoPDM(path_info, + MCDRV_D2SRC_PDM1_L_ON, 0); + if (mc_asoc_sub_mic == MIC_PDM0) + exchange_ADCtoPDM(path_info, + 0, MCDRV_D2SRC_PDM0_R_ON); + else if (mc_asoc_sub_mic == MIC_PDM1) + exchange_ADCtoPDM(path_info, + 0, MCDRV_D2SRC_PDM1_R_ON); + } + mask_DacRef(path_info, mixer_ctl_info->output_path); + + mask_ADC_src(path_info, mixer_ctl_info, preset_idx); + mask_AnaOut_src(path_info, mixer_ctl_info, preset_idx); + } + return; + } + + if ((preset_idx == 12) + || (preset_idx == 13) + || (preset_idx == 14) + || (preset_idx == 15) + || (preset_idx == 16) + || (preset_idx == 17) + || (preset_idx == 50) + || (preset_idx == 51) + || (preset_idx == 52) + || (preset_idx == 53) + || (preset_idx == 54) + || (preset_idx == 55) + || (preset_idx == 65) + || (preset_idx == 66) + || (preset_idx == 67) + || (preset_idx == 68) + || (preset_idx == 69) + || (preset_idx == 70) + || (preset_idx == 77) + || (preset_idx == 78) + || (preset_idx == 79) + || (preset_idx == 80) + || (preset_idx == 81) + || (preset_idx == 82) + || (preset_idx == 83) + ) { + if (mixer_ctl_info->output_path == MC_ASOC_OUTPUT_PATH_BT) { + add_path_info(path_info, preset_path_info); + path_info->asVboxMixIn[1].dSrcOnOff = 0x00AAAAAA; + } else if ((mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_SP_BT) + || (mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_LO1_BT) + || (mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_LO2_BT)) { + add_path_info(path_info, preset_path_info); + mask_AnaOut_src(path_info, mixer_ctl_info, preset_idx); + path_info->asVboxMixIn[1].dSrcOnOff = 0x00AAAAAA; + mask_DacRef(path_info, mixer_ctl_info->output_path); + } else { + add_path_info(path_info, preset_path_info); + if (mixer_ctl_info->incall_mic + == MC_ASOC_INCALL_MIC_MAINMIC) { + if (mc_asoc_main_mic == MIC_PDM0) + exchange_ADCtoPDM(path_info, + MCDRV_D2SRC_PDM0_L_ON, + MCDRV_D2SRC_PDM0_R_ON); + else if (mc_asoc_main_mic == MIC_PDM1) + exchange_ADCtoPDM(path_info, + MCDRV_D2SRC_PDM1_L_ON, + MCDRV_D2SRC_PDM1_R_ON); + path_info->asVboxMixIn[1].dSrcOnOff + = 0x00AAAAAA; + } else if (mixer_ctl_info->incall_mic + == MC_ASOC_INCALL_MIC_SUBMIC) { + if (mc_asoc_sub_mic == MIC_PDM0) + exchange_ADCtoPDM(path_info, + MCDRV_D2SRC_PDM0_L_ON, + MCDRV_D2SRC_PDM0_R_ON); + else if (mc_asoc_sub_mic == MIC_PDM1) + exchange_ADCtoPDM(path_info, + MCDRV_D2SRC_PDM1_L_ON, + MCDRV_D2SRC_PDM1_R_ON); + path_info->asVboxMixIn[1].dSrcOnOff + = 0x00AAAAAA; + } else { + if (mc_asoc_main_mic == MIC_PDM0) + exchange_ADCtoPDM(path_info, + MCDRV_D2SRC_PDM0_L_ON, + 0); + else if (mc_asoc_main_mic == MIC_PDM1) + exchange_ADCtoPDM(path_info, + MCDRV_D2SRC_PDM1_L_ON, + 0); + if (mc_asoc_sub_mic == MIC_PDM0) + exchange_ADCtoPDM(path_info, + 0, + MCDRV_D2SRC_PDM0_R_ON); + else if (mc_asoc_sub_mic == MIC_PDM1) + exchange_ADCtoPDM(path_info, + 0, + MCDRV_D2SRC_PDM1_R_ON); + } + + mask_ADC_src(path_info, mixer_ctl_info, preset_idx); + mask_AnaOut_src(path_info, mixer_ctl_info, preset_idx); + mask_DacRef(path_info, mixer_ctl_info->output_path); + } + return; + } + if ((preset_idx == 18) + || (preset_idx == 19) + || (preset_idx == 20) + || (preset_idx == 21) + || (preset_idx == 22) + || (preset_idx == 23) + || (preset_idx == 56) + || (preset_idx == 57) + || (preset_idx == 58) + || (preset_idx == 59) + || (preset_idx == 60) + || (preset_idx == 61) + || (preset_idx == 71) + || (preset_idx == 72) + || (preset_idx == 73) + || (preset_idx == 74) + || (preset_idx == 75) + || (preset_idx == 76) + || (preset_idx == 83) + || (preset_idx == 84) + || (preset_idx == 85) + || (preset_idx == 86) + || (preset_idx == 87) + || (preset_idx == 88) + ) { + if (mixer_ctl_info->output_path == MC_ASOC_OUTPUT_PATH_BT) { + add_path_info(path_info, preset_path_info); + path_info->asVboxMixIn[1].dSrcOnOff = 0x00AAAAAA; + } else if ((mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_SP_BT) + || (mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_LO1_BT) + || (mixer_ctl_info->output_path + == MC_ASOC_OUTPUT_PATH_LO2_BT)) { + add_path_info(path_info, preset_path_info); + mask_AnaOut_src(path_info, mixer_ctl_info, preset_idx); + path_info->asVboxMixIn[1].dSrcOnOff = 0x00AAAAAA; + mask_DacRef(path_info, mixer_ctl_info->output_path); + } else { + add_path_info(path_info, preset_path_info); + if (mixer_ctl_info->incall_mic + == MC_ASOC_INCALL_MIC_MAINMIC) { + if (mc_asoc_main_mic == MIC_PDM0) + exchange_ADCtoPDM(path_info, + MCDRV_D2SRC_PDM0_L_ON, + MCDRV_D2SRC_PDM0_R_ON); + else if (mc_asoc_main_mic == MIC_PDM1) + exchange_ADCtoPDM(path_info, + MCDRV_D2SRC_PDM1_L_ON, + MCDRV_D2SRC_PDM1_R_ON); + path_info->asVboxMixIn[1].dSrcOnOff + = 0x00AAAAAA; + } else if (mixer_ctl_info->incall_mic + == MC_ASOC_INCALL_MIC_SUBMIC) { + if (mc_asoc_sub_mic == MIC_PDM0) + exchange_ADCtoPDM(path_info, + MCDRV_D2SRC_PDM0_L_ON, + MCDRV_D2SRC_PDM0_R_ON); + else if (mc_asoc_sub_mic == MIC_PDM1) + exchange_ADCtoPDM(path_info, + MCDRV_D2SRC_PDM1_L_ON, + MCDRV_D2SRC_PDM1_R_ON); + path_info->asVboxMixIn[1].dSrcOnOff + = 0x00AAAAAA; + } else { + if (mc_asoc_main_mic == MIC_PDM0) + exchange_ADCtoPDM(path_info, + MCDRV_D2SRC_PDM0_L_ON, + 0); + else if (mc_asoc_main_mic == MIC_PDM1) + exchange_ADCtoPDM(path_info, + MCDRV_D2SRC_PDM1_L_ON, + 0); + if (mc_asoc_sub_mic == MIC_PDM0) + exchange_ADCtoPDM(path_info, + 0, + MCDRV_D2SRC_PDM0_R_ON); + else if (mc_asoc_sub_mic == MIC_PDM1) + exchange_ADCtoPDM(path_info, + 0, + MCDRV_D2SRC_PDM1_R_ON); + } + + mask_ADC_src(path_info, mixer_ctl_info, preset_idx); + mask_AnaOut_src(path_info, mixer_ctl_info, preset_idx); + mask_DacRef(path_info, mixer_ctl_info->output_path); + } + return; + } + + if (mixer_ctl_info->btmic_play == 1) { + idx = BtPathMapping[preset_idx]; + if (BtPathMapping[preset_idx] < ARRAY_SIZE(BtInputPath)) { + add_path_info(path_info, + (struct MCDRV_PATH_INFO *)&BtInputPath[idx]); + mask_BTOut_src(path_info, mixer_ctl_info->output_path); + } else + dbg_info("\n********\nBtPathMapping err\n********\n"); + } + + if ((preset_idx == 1) + || (preset_idx == 2) + || (preset_idx == 3) + || (preset_idx == 27) + || (preset_idx == 89) + || (preset_idx == 90) + || (preset_idx == 91) + || (preset_idx == 92)) { + if (ain_play == 1) + set_ain_play_path(path_info, mixer_ctl_info, + preset_idx, 1); + add_path_info(path_info, preset_path_info); + } else if ((preset_idx == 4) + || (preset_idx == 5) + || (preset_idx == 28) + || (preset_idx == 30) + || (preset_idx == 31)) { + if ((mixer_ctl_info->input_path + != MC_ASOC_INPUT_PATH_VOICECALL) + && (mixer_ctl_info->input_path + != MC_ASOC_INPUT_PATH_VOICEUPLINK) + && (mixer_ctl_info->input_path + != MC_ASOC_INPUT_PATH_VOICEDOWNLINK)) { + if (ain_play == 1) { + if (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_BT) + set_ain_play_path(path_info, + mixer_ctl_info, preset_idx, 1); + else + set_ain_play_path(path_info, + mixer_ctl_info, preset_idx, 0); + } + add_path_info(path_info, preset_path_info); + if (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_MAINMIC) { + if (mc_asoc_main_mic == MIC_PDM0) + exchange_ADCtoPDM(path_info, + MCDRV_D2SRC_PDM0_L_ON, + MCDRV_D2SRC_PDM0_R_ON); + else if (mc_asoc_main_mic == MIC_PDM1) + exchange_ADCtoPDM(path_info, + MCDRV_D2SRC_PDM1_L_ON, + MCDRV_D2SRC_PDM1_R_ON); + } else if (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_SUBMIC) { + if (mc_asoc_sub_mic == MIC_PDM0) + exchange_ADCtoPDM(path_info, + MCDRV_D2SRC_PDM0_L_ON, + MCDRV_D2SRC_PDM0_R_ON); + else if (mc_asoc_sub_mic == MIC_PDM1) + exchange_ADCtoPDM(path_info, + MCDRV_D2SRC_PDM1_L_ON, + MCDRV_D2SRC_PDM1_R_ON); + } else if (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_2MIC) { + if (mc_asoc_main_mic == MIC_PDM0) + exchange_ADCtoPDM(path_info, + MCDRV_D2SRC_PDM0_L_ON, + 0); + else if (mc_asoc_main_mic == MIC_PDM1) + exchange_ADCtoPDM(path_info, + MCDRV_D2SRC_PDM1_L_ON, + 0); + if (mc_asoc_sub_mic == MIC_PDM0) + exchange_ADCtoPDM(path_info, + 0, + MCDRV_D2SRC_PDM0_R_ON); + else if (mc_asoc_sub_mic == MIC_PDM1) + exchange_ADCtoPDM(path_info, + 0, + MCDRV_D2SRC_PDM1_R_ON); + } else if (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_HS) { + if (mc_asoc_hs_mic == MIC_PDM0) + exchange_ADCtoPDM(path_info, + MCDRV_D2SRC_PDM0_L_ON, + MCDRV_D2SRC_PDM0_R_ON); + else if (mc_asoc_hs_mic == MIC_PDM1) + exchange_ADCtoPDM(path_info, + MCDRV_D2SRC_PDM1_L_ON, + MCDRV_D2SRC_PDM1_R_ON); + } + mask_ADC_src(path_info, mixer_ctl_info, preset_idx); + if (mixer_ctl_info->input_path + != MC_ASOC_INPUT_PATH_2MIC) + path_info->asVboxMixIn[1].dSrcOnOff + = 0x00AAAAAA; + } else { + add_path_info(path_info, preset_path_info); + mute_DIT = 1; + } + } else if ((preset_idx == 6) + || (preset_idx == 7) + || (preset_idx == 8) + || (preset_idx == 9) + || (preset_idx == 10) + || (preset_idx == 11) + || (preset_idx == 29) + || (preset_idx == 32) + || (preset_idx == 33) + || (preset_idx == 34) + || (preset_idx == 35) + || (preset_idx == 36) + || (preset_idx == 37)) { + if ((mixer_ctl_info->input_path + != MC_ASOC_INPUT_PATH_VOICECALL) + && (mixer_ctl_info->input_path + != MC_ASOC_INPUT_PATH_VOICEUPLINK) + && (mixer_ctl_info->input_path + != MC_ASOC_INPUT_PATH_VOICEDOWNLINK)) { + if (ain_play == 1) { + if (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_BT) + set_ain_play_path(path_info, + mixer_ctl_info, preset_idx, 1); + else + set_ain_play_path(path_info, + mixer_ctl_info, preset_idx, 0); + } + add_path_info(path_info, preset_path_info); + if (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_MAINMIC) { + if (mc_asoc_main_mic == MIC_PDM0) + exchange_ADCtoPDM(path_info, + MCDRV_D2SRC_PDM0_L_ON, + MCDRV_D2SRC_PDM0_R_ON); + else if (mc_asoc_main_mic == MIC_PDM1) + exchange_ADCtoPDM(path_info, + MCDRV_D2SRC_PDM1_L_ON, + MCDRV_D2SRC_PDM1_R_ON); + } else if (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_SUBMIC) { + if (mc_asoc_sub_mic == MIC_PDM0) + exchange_ADCtoPDM(path_info, + MCDRV_D2SRC_PDM0_L_ON, + MCDRV_D2SRC_PDM0_R_ON); + else if (mc_asoc_sub_mic == MIC_PDM1) + exchange_ADCtoPDM(path_info, + MCDRV_D2SRC_PDM1_L_ON, + MCDRV_D2SRC_PDM1_R_ON); + } else if (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_2MIC) { + if (mc_asoc_main_mic == MIC_PDM0) + exchange_ADCtoPDM(path_info, + MCDRV_D2SRC_PDM0_L_ON, + 0); + else if (mc_asoc_main_mic == MIC_PDM1) + exchange_ADCtoPDM(path_info, + MCDRV_D2SRC_PDM1_L_ON, + 0); + if (mc_asoc_sub_mic == MIC_PDM0) + exchange_ADCtoPDM(path_info, + 0, + MCDRV_D2SRC_PDM0_R_ON); + else if (mc_asoc_sub_mic == MIC_PDM1) + exchange_ADCtoPDM(path_info, + 0, + MCDRV_D2SRC_PDM1_R_ON); + } else if (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_HS) { + if (mc_asoc_hs_mic == MIC_PDM0) + exchange_ADCtoPDM(path_info, + MCDRV_D2SRC_PDM0_L_ON, + MCDRV_D2SRC_PDM0_R_ON); + else if (mc_asoc_hs_mic == MIC_PDM1) + exchange_ADCtoPDM(path_info, + MCDRV_D2SRC_PDM1_L_ON, + MCDRV_D2SRC_PDM1_R_ON); + } + mask_ADC_src(path_info, mixer_ctl_info, preset_idx); + if (mixer_ctl_info->input_path + != MC_ASOC_INPUT_PATH_2MIC) + path_info->asVboxMixIn[1].dSrcOnOff + = 0x00AAAAAA; + } else { + add_path_info(path_info, preset_path_info); + mute_DIT = 1; + } + } else if ((preset_idx == 38) + || (preset_idx == 39) + || (preset_idx == 40) + || (preset_idx == 41) + || (preset_idx == 42) + || (preset_idx == 43) + || (preset_idx == 44) + || (preset_idx == 45)) { + if (ain_play == 1) + set_ain_play_path(path_info, + mixer_ctl_info, preset_idx, 1); + if ((mixer_ctl_info->input_path + != MC_ASOC_INPUT_PATH_VOICECALL) + && (mixer_ctl_info->input_path + != MC_ASOC_INPUT_PATH_VOICEUPLINK) + && (mixer_ctl_info->input_path + != MC_ASOC_INPUT_PATH_VOICEDOWNLINK)) { + add_path_info(path_info, preset_path_info); + if (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_MAINMIC) { + if (mc_asoc_main_mic == MIC_PDM0) + exchange_ADC1toPDM(path_info, + MCDRV_D2SRC_PDM0_L_ON, + MCDRV_D2SRC_PDM0_R_ON); + else if (mc_asoc_main_mic == MIC_PDM1) + exchange_ADC1toPDM(path_info, + MCDRV_D2SRC_PDM1_L_ON, + MCDRV_D2SRC_PDM1_R_ON); + } else if (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_SUBMIC) { + if (mc_asoc_sub_mic == MIC_PDM0) + exchange_ADC1toPDM(path_info, + MCDRV_D2SRC_PDM0_L_ON, + MCDRV_D2SRC_PDM0_R_ON); + else if (mc_asoc_sub_mic == MIC_PDM1) + exchange_ADC1toPDM(path_info, + MCDRV_D2SRC_PDM1_L_ON, + MCDRV_D2SRC_PDM1_R_ON); + } else if (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_2MIC) { + if (mc_asoc_main_mic == MIC_PDM0) + exchange_ADC1toPDM(path_info, + MCDRV_D2SRC_PDM0_L_ON, 0); + if (mc_asoc_main_mic == MIC_PDM1) + exchange_ADC1toPDM(path_info, + MCDRV_D2SRC_PDM1_L_ON, 0); + if (mc_asoc_sub_mic == MIC_PDM0) + exchange_ADC1toPDM(path_info, + 0, MCDRV_D2SRC_PDM0_R_ON); + else if (mc_asoc_sub_mic == MIC_PDM1) + exchange_ADC1toPDM(path_info, + 0, MCDRV_D2SRC_PDM1_R_ON); + } else if (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_HS) { + if (mc_asoc_hs_mic == MIC_PDM0) + exchange_ADC1toPDM(path_info, + MCDRV_D2SRC_PDM0_L_ON, + MCDRV_D2SRC_PDM0_R_ON); + else if (mc_asoc_hs_mic == MIC_PDM1) + exchange_ADC1toPDM(path_info, + MCDRV_D2SRC_PDM1_L_ON, + MCDRV_D2SRC_PDM1_R_ON); + } + mask_ADC1_src(path_info, mixer_ctl_info, preset_idx); + } else { + add_path_info(path_info, preset_path_info); + mute_DIT = 1; + } + } else if ((preset_idx == 46) + || (preset_idx == 47) + || (preset_idx == 48) + || (preset_idx == 49)) { + add_path_info(path_info, preset_path_info); + if (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_MAINMIC) { + if (mc_asoc_main_mic == MIC_PDM0) + exchange_ADCtoPDM(path_info, + MCDRV_D2SRC_PDM0_L_ON, + MCDRV_D2SRC_PDM0_R_ON); + else if (mc_asoc_main_mic == MIC_PDM1) + exchange_ADCtoPDM(path_info, + MCDRV_D2SRC_PDM1_L_ON, + MCDRV_D2SRC_PDM1_R_ON); + } else if (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_SUBMIC) { + if (mc_asoc_sub_mic == MIC_PDM0) + exchange_ADCtoPDM(path_info, + MCDRV_D2SRC_PDM0_L_ON, + MCDRV_D2SRC_PDM0_R_ON); + else if (mc_asoc_sub_mic == MIC_PDM1) + exchange_ADCtoPDM(path_info, + MCDRV_D2SRC_PDM1_L_ON, + MCDRV_D2SRC_PDM1_R_ON); + } else if (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_2MIC) { + if (mc_asoc_main_mic == MIC_PDM0) + exchange_ADCtoPDM(path_info, + MCDRV_D2SRC_PDM0_L_ON, + 0); + else if (mc_asoc_main_mic == MIC_PDM1) + exchange_ADCtoPDM(path_info, + MCDRV_D2SRC_PDM1_L_ON, + 0); + if (mc_asoc_sub_mic == MIC_PDM0) + exchange_ADCtoPDM(path_info, + 0, + MCDRV_D2SRC_PDM0_R_ON); + else if (mc_asoc_sub_mic == MIC_PDM1) + exchange_ADCtoPDM(path_info, + 0, + MCDRV_D2SRC_PDM1_R_ON); + } else if (mixer_ctl_info->input_path + == MC_ASOC_INPUT_PATH_HS) { + if (mc_asoc_hs_mic == MIC_PDM0) + exchange_ADCtoPDM(path_info, + MCDRV_D2SRC_PDM0_L_ON, + MCDRV_D2SRC_PDM0_R_ON); + else if (mc_asoc_hs_mic == MIC_PDM1) + exchange_ADCtoPDM(path_info, + MCDRV_D2SRC_PDM1_L_ON, + MCDRV_D2SRC_PDM1_R_ON); + } + mask_ADC_src(path_info, mixer_ctl_info, preset_idx); + } else if (ain_play == 1) + set_ain_play_path(path_info, mixer_ctl_info, preset_idx, 1); + + mask_AnaOut_src(path_info, mixer_ctl_info, preset_idx); + if ((preset_idx < 4) + || CAPTURE_PORT != CAPTURE_PORT_EXT) + mask_BTOut_src(path_info, mixer_ctl_info->output_path); + + if (CAPTURE_PORT == CAPTURE_PORT_EXT) { + if (preset_idx >= 4) { + path_info->asExtOut[0].dSrcOnOff + = path_info->asMusicOut[0].dSrcOnOff; + path_info->asMusicOut[0].dSrcOnOff = 0x00AAAAAA; + path_info->asExtOut[1].dSrcOnOff + = path_info->asMusicOut[1].dSrcOnOff; + path_info->asMusicOut[1].dSrcOnOff = 0x00AAAAAA; + if (mute_DIT != 0) { + set_vol_mute_flg( + vreg_map[MC_ASOC_DVOL_EXTOUT].offset, + 0, 1); + set_vol_mute_flg( + vreg_map[MC_ASOC_DVOL_EXTOUT].offset, + 1, 1); + } + } + } else if (mute_DIT != 0) { + set_vol_mute_flg(vreg_map[MC_ASOC_DVOL_MUSICOUT].offset, + 0, 1); + set_vol_mute_flg(vreg_map[MC_ASOC_DVOL_MUSICOUT].offset, + 1, 1); + } + + return; +} + +static void set_adif_src( + UINT8 bSrc, + UINT32 *dSrcOnOff +) +{ + switch (bSrc) { + default: + case 0: + break; + case 1: + /* ADC0L */ + *dSrcOnOff = 0x00AAAAAA | MCDRV_D2SRC_ADC0_L_ON; + break; + case 2: + /* ADC0R */ + *dSrcOnOff = 0x00AAAAAA | MCDRV_D2SRC_ADC0_R_ON; + break; + case 3: + /* ADC1 */ + *dSrcOnOff = 0x00AAAAAA | MCDRV_D2SRC_ADC1_ON; + break; + case 4: + /* PDM0L */ + *dSrcOnOff = 0x00AAAAAA | MCDRV_D2SRC_PDM0_L_ON; + break; + case 5: + /* PDM0R */ + *dSrcOnOff = 0x00AAAAAA | MCDRV_D2SRC_PDM0_R_ON; + break; + case 6: + /* PDM1L */ + *dSrcOnOff = 0x00AAAAAA | MCDRV_D2SRC_PDM1_L_ON; + break; + case 7: + /* PDM1R */ + *dSrcOnOff = 0x00AAAAAA | MCDRV_D2SRC_PDM1_R_ON; + break; + case 8: + /* DAC0REF */ + *dSrcOnOff = 0x00AAAAAA | MCDRV_D2SRC_DAC0REF_ON; + break; + case 9: + /* DAC1REF */ + *dSrcOnOff = 0x00AAAAAA | MCDRV_D2SRC_DAC1REF_ON; + break; + } +} + +static int connect_path( + struct snd_soc_codec *codec +) +{ + int err; + struct mc_asoc_mixer_path_ctl_info mixer_ctl_info; + struct MCDRV_PATH_INFO path_info; + int preset_idx = 0; + int cache; + + /* TRACE_FUNC(); */ + + if (mc_asoc_hold == YMC_NOTITY_HOLD_ON) { + dbg_info("hold=on\n"); + return 0; + } + + if (get_mixer_path_ctl_info(codec, &mixer_ctl_info) < 0) + return -EIO; + + preset_idx = get_path_preset_idx(&mixer_ctl_info); + dbg_info("preset_idx=%d\n", preset_idx); + if ((preset_idx < 0) || (preset_idx > PRESET_PATH_N)) + return -EIO; + + memcpy(&path_info, + &stPresetPathInfo[0], + sizeof(struct MCDRV_PATH_INFO)); + get_path_info(&path_info, &mixer_ctl_info, preset_idx); + set_BIAS(&path_info); + + cache = read_cache(codec, MC_ASOC_ADIF0_SOURCE); + if (cache < 0) + return -EIO; + if (((UINT8)cache != 0) + && ((UINT8)(cache>>8) != 0)) { + set_adif_src((UINT8)cache, &path_info.asAdif0[0].dSrcOnOff); + set_adif_src((UINT8)(cache>>8), + &path_info.asAdif0[1].dSrcOnOff); + } + cache = read_cache(codec, MC_ASOC_ADIF1_SOURCE); + if (cache < 0) + return -EIO; + if (((UINT8)cache != 0) + && ((UINT8)(cache>>8) != 0)) { + set_adif_src((UINT8)cache, &path_info.asAdif1[0].dSrcOnOff); + set_adif_src((UINT8)(cache>>8), + &path_info.asAdif1[1].dSrcOnOff); + } + cache = read_cache(codec, MC_ASOC_ADIF2_SOURCE); + if (cache < 0) + return -EIO; + if (((UINT8)cache != 0) + && ((UINT8)(cache>>8) != 0)) { + set_adif_src((UINT8)cache, &path_info.asAdif2[0].dSrcOnOff); + set_adif_src((UINT8)(cache>>8), + &path_info.asAdif2[1].dSrcOnOff); + } + + err = set_volume(codec, &mixer_ctl_info, preset_idx); + if (err < 0) + return err; + err = _McDrv_Ctrl(MCDRV_SET_PATH, &path_info, NULL, 0); + if (err != MCDRV_SUCCESS) + return map_drv_error(err); + + return err; +} + +/* + * DAI (PCM interface) + */ +static int is_dio_modified( + const struct MCDRV_DIO_PORT *port, + int id, + int mode, + UINT32 update +) +{ + int err; + struct MCDRV_DIO_INFO cur_dio; + + err = _McDrv_Ctrl(MCDRV_GET_DIGITALIO, &cur_dio, NULL, 0); + if (err != MCDRV_SUCCESS) + return map_drv_error(err); + + if (((update & MCDRV_MUSIC_COM_UPDATE_FLAG) != 0) + || ((update & MCDRV_EXT_COM_UPDATE_FLAG) != 0) + || ((update & MCDRV_HIFI_COM_UPDATE_FLAG) != 0)) { + if ((cur_dio.asPortInfo[id].sDioCommon.bMasterSlave + != port->sDioCommon.bMasterSlave) + || (cur_dio.asPortInfo[id].sDioCommon.bAutoFs + != port->sDioCommon.bAutoFs) + || (cur_dio.asPortInfo[id].sDioCommon.bFs + != port->sDioCommon.bFs) + || (cur_dio.asPortInfo[id].sDioCommon.bBckFs + != port->sDioCommon.bBckFs) + || (cur_dio.asPortInfo[id].sDioCommon.bInterface + != port->sDioCommon.bInterface) + || (cur_dio.asPortInfo[id].sDioCommon.bBckInvert + != port->sDioCommon.bBckInvert) + || (cur_dio.asPortInfo[id].sDioCommon.bSrcThru + != port->sDioCommon.bSrcThru)) + return 1; + if (mode == MCDRV_DIO_PCM) { + if ((cur_dio.asPortInfo[id].sDioCommon.bPcmHizTim + != port->sDioCommon.bPcmHizTim) + || (cur_dio.asPortInfo[id].sDioCommon.bPcmFrame + != port->sDioCommon.bPcmFrame) + || (cur_dio.asPortInfo[id].sDioCommon.bPcmHighPeriod + != port->sDioCommon.bPcmHighPeriod)) + return 1; + } + } + + if (((update & MCDRV_MUSIC_DIR_UPDATE_FLAG) != 0) + || ((update & MCDRV_HIFI_DIR_UPDATE_FLAG) != 0)) { + if (mode == MCDRV_DIO_DA) { + if ((cur_dio.asPortInfo[id].sDir.sDaFormat.bBitSel + != port->sDir.sDaFormat.bBitSel) + || (cur_dio.asPortInfo[id].sDir.sDaFormat.bMode + != port->sDir.sDaFormat.bMode)) + return 1; + } else { + if ((cur_dio.asPortInfo[id].sDir.sPcmFormat.bMono + != port->sDir.sPcmFormat.bMono) + || (cur_dio.asPortInfo[id].sDir.sPcmFormat.bOrder + != port->sDir.sPcmFormat.bOrder) + || (cur_dio.asPortInfo[id].sDir.sPcmFormat.bLaw + != port->sDir.sPcmFormat.bLaw) + || (cur_dio.asPortInfo[id].sDir.sPcmFormat.bBitSel + != port->sDir.sPcmFormat.bBitSel)) + return 1; + } + } + + if (((update & MCDRV_MUSIC_DIT_UPDATE_FLAG) != 0) + || ((update & MCDRV_EXT_DIT_UPDATE_FLAG) != 0) + || ((update & MCDRV_HIFI_DIT_UPDATE_FLAG) != 0)) { + if (mode == MCDRV_DIO_DA) { + if ((cur_dio.asPortInfo[id].sDit.sDaFormat.bBitSel + != port->sDit.sDaFormat.bBitSel) + || (cur_dio.asPortInfo[id].sDit.sDaFormat.bMode + != port->sDit.sDaFormat.bMode)) + return 1; + } else { + if ((cur_dio.asPortInfo[id].sDit.sPcmFormat.bMono + != port->sDit.sPcmFormat.bMono) + || (cur_dio.asPortInfo[id].sDit.sPcmFormat.bOrder + != port->sDit.sPcmFormat.bOrder) + || (cur_dio.asPortInfo[id].sDit.sPcmFormat.bLaw + != port->sDit.sPcmFormat.bLaw) + || (cur_dio.asPortInfo[id].sDit.sPcmFormat.bBitSel + != port->sDit.sPcmFormat.bBitSel)) + return 1; + } + } + return 0; +} + +static int setup_dai( + struct snd_soc_codec *codec, + struct mc_asoc_data *mc_asoc, + int id, + int mode, + int dir +) +{ + struct MCDRV_DIO_INFO dio; + struct MCDRV_DIO_PORT *port = &dio.asPortInfo[id]; + struct mc_asoc_port_params *port_prm = &mc_asoc->port; + UINT32 update = 0; + int bCh, err, modify; + struct MCDRV_PATH_INFO path_info, tmp_path_info; + + err = _McDrv_Ctrl(MCDRV_GET_PATH, &path_info, NULL, 0); + if (err != MCDRV_SUCCESS) + return map_drv_error(err); + + memset(&dio, 0, sizeof(struct MCDRV_DIO_INFO)); + + if (port_prm->stream == 0) { + port->sDioCommon.bMasterSlave = port_prm->master; + port->sDioCommon.bAutoFs = MCDRV_AUTOFS_OFF; + port->sDioCommon.bFs = port_prm->rate; + port->sDioCommon.bBckFs = port_prm->bckfs; + port->sDioCommon.bInterface = mode; + port->sDioCommon.bBckInvert = port_prm->inv; + port->sDioCommon.bSrcThru = port_prm->srcthru; + if (mode == MCDRV_DIO_PCM) + port->sDioCommon.bPcmFrame + = port_prm->format; + if (id == 0) + update |= MCDRV_MUSIC_COM_UPDATE_FLAG; + else if (id == 1) + update |= MCDRV_EXT_COM_UPDATE_FLAG; + else if (id == 3) + update |= MCDRV_HIFI_COM_UPDATE_FLAG; + } + + if (dir == SNDRV_PCM_STREAM_PLAYBACK) { + if (mode == MCDRV_DIO_DA) { + port->sDir.sDaFormat.bBitSel = port_prm->bits[dir]; + port->sDir.sDaFormat.bMode = port_prm->format; + } else { + port->sDir.sPcmFormat.bMono + = port_prm->pcm_mono[dir]; + port->sDir.sPcmFormat.bOrder + = port_prm->pcm_order[dir]; + port->sDir.sPcmFormat.bLaw + = port_prm->pcm_law[dir]; + port->sDir.sPcmFormat.bBitSel + = port_prm->bits[dir]; + } + if (id == 0) + update |= MCDRV_MUSIC_DIR_UPDATE_FLAG; + else if (id == 3) + update |= MCDRV_HIFI_DIR_UPDATE_FLAG; + } + + if (dir == SNDRV_PCM_STREAM_CAPTURE) { + if (mode == MCDRV_DIO_DA) { + port->sDit.sDaFormat.bBitSel = port_prm->bits[dir]; + port->sDit.sDaFormat.bMode = port_prm->format; + } else { + port->sDit.sPcmFormat.bMono + = port_prm->pcm_mono[dir]; + port->sDit.sPcmFormat.bOrder + = port_prm->pcm_order[dir]; + port->sDit.sPcmFormat.bLaw + = port_prm->pcm_law[dir]; + port->sDit.sPcmFormat.bBitSel + = port_prm->bits[dir]; + } + if (id == 0) + update |= MCDRV_MUSIC_DIT_UPDATE_FLAG; + else if (id == 1) + update |= MCDRV_EXT_DIT_UPDATE_FLAG; + else if (id == 3) + update |= MCDRV_HIFI_DIT_UPDATE_FLAG; + } + + modify = is_dio_modified(port, id, mode, update); + if (modify < 0) + return -EIO; + if (modify == 0) { + dbg_info("modify == 0\n"); + return 0; + } + + memcpy(&tmp_path_info, &path_info, sizeof(struct MCDRV_PATH_INFO)); + if ((dir == SNDRV_PCM_STREAM_PLAYBACK) + || (port_prm->stream == 0)) { + if (id == 0) { + for (bCh = 0; bCh < MUSICOUT_PATH_CHANNELS; bCh++) { + tmp_path_info.asMusicOut[bCh].dSrcOnOff + &= ~MCDRV_D1SRC_MUSICIN_ON; + tmp_path_info.asMusicOut[bCh].dSrcOnOff + |= MCDRV_D1SRC_MUSICIN_OFF; + } + for (bCh = 0; bCh < EXTOUT_PATH_CHANNELS; bCh++) { + tmp_path_info.asExtOut[bCh].dSrcOnOff + &= ~MCDRV_D1SRC_MUSICIN_ON; + tmp_path_info.asExtOut[bCh].dSrcOnOff + |= MCDRV_D1SRC_MUSICIN_OFF; + } + for (bCh = 0; bCh < VBOXMIXIN_PATH_CHANNELS; bCh++) { + tmp_path_info.asVboxMixIn[bCh].dSrcOnOff + &= ~MCDRV_D1SRC_MUSICIN_ON; + tmp_path_info.asVboxMixIn[bCh].dSrcOnOff + |= MCDRV_D1SRC_MUSICIN_OFF; + } + for (bCh = 0; bCh < AE_PATH_CHANNELS; bCh++) { + tmp_path_info.asAe0[bCh].dSrcOnOff + &= ~MCDRV_D1SRC_MUSICIN_ON; + tmp_path_info.asAe0[bCh].dSrcOnOff + |= MCDRV_D1SRC_MUSICIN_OFF; + tmp_path_info.asAe1[bCh].dSrcOnOff + &= ~MCDRV_D1SRC_MUSICIN_ON; + tmp_path_info.asAe1[bCh].dSrcOnOff + |= MCDRV_D1SRC_MUSICIN_OFF; + tmp_path_info.asAe2[bCh].dSrcOnOff + &= ~MCDRV_D1SRC_MUSICIN_ON; + tmp_path_info.asAe2[bCh].dSrcOnOff + |= MCDRV_D1SRC_MUSICIN_OFF; + tmp_path_info.asAe3[bCh].dSrcOnOff + &= ~MCDRV_D1SRC_MUSICIN_ON; + tmp_path_info.asAe3[bCh].dSrcOnOff + |= MCDRV_D1SRC_MUSICIN_OFF; + } + for (bCh = 0; bCh < DAC0_PATH_CHANNELS; bCh++) { + tmp_path_info.asDac0[bCh].dSrcOnOff + &= ~MCDRV_D1SRC_MUSICIN_ON; + tmp_path_info.asDac0[bCh].dSrcOnOff + |= MCDRV_D1SRC_MUSICIN_OFF; + } + for (bCh = 0; bCh < DAC1_PATH_CHANNELS; bCh++) { + tmp_path_info.asDac1[bCh].dSrcOnOff + &= ~MCDRV_D1SRC_MUSICIN_ON; + tmp_path_info.asDac1[bCh].dSrcOnOff + |= MCDRV_D1SRC_MUSICIN_OFF; + } + } else if (id == 3) { + for (bCh = 0; bCh < DAC0_PATH_CHANNELS; bCh++) { + tmp_path_info.asDac0[bCh].dSrcOnOff + &= ~MCDRV_D1SRC_HIFIIN_ON; + tmp_path_info.asDac0[bCh].dSrcOnOff + |= MCDRV_D1SRC_HIFIIN_OFF; + } + for (bCh = 0; bCh < DAC1_PATH_CHANNELS; bCh++) { + tmp_path_info.asDac1[bCh].dSrcOnOff + &= ~MCDRV_D1SRC_HIFIIN_ON; + tmp_path_info.asDac1[bCh].dSrcOnOff + |= MCDRV_D1SRC_HIFIIN_OFF; + } + } + } + if ((dir == SNDRV_PCM_STREAM_CAPTURE) + || (port_prm->stream == 0)) { + if (id == 0) + for (bCh = 0; bCh < MUSICOUT_PATH_CHANNELS; bCh++) + tmp_path_info.asMusicOut[bCh].dSrcOnOff + = 0x00AAAAAA; + else if (id == 1) + for (bCh = 0; bCh < EXTOUT_PATH_CHANNELS; bCh++) + tmp_path_info.asExtOut[bCh].dSrcOnOff + = 0x00AAAAAA; + else if (id == 3) + for (bCh = 0; bCh < HIFIOUT_PATH_CHANNELS; bCh++) + tmp_path_info.asHifiOut[bCh].dSrcOnOff + = 0x00AAAAAA; + } + + if (memcmp(&tmp_path_info, &path_info, sizeof(struct MCDRV_PATH_INFO)) + == 0) + modify = 0; + else { + err = _McDrv_Ctrl(MCDRV_SET_PATH, &tmp_path_info, NULL, 0); + if (err != MCDRV_SUCCESS) + return map_drv_error(err); + } + + err = _McDrv_Ctrl(MCDRV_SET_DIGITALIO, &dio, NULL, update); + if (err != MCDRV_SUCCESS) + return map_drv_error(err); + + if (modify != 0) { + err = connect_path(codec); + return err; + } + return 0; +} + +static int mc_asoc_set_clkdiv( + struct snd_soc_dai *dai, + int div_id, + int div) +{ + int err = 0; + struct snd_soc_codec *codec = NULL; + struct mc_asoc_data *mc_asoc = NULL; + struct mc_asoc_port_params *port = NULL; + + /*TRACE_FUNC();*/ + + if ((dai == NULL) + || (dai->codec == NULL) + || (get_port_id(dai->id) != 0)) + return -EINVAL; + + codec = dai->codec; + mc_asoc = mc_asoc_get_mc_asoc(codec); + if (mc_asoc == NULL) + return -EINVAL; + + mc_asoc_lock("mc_asoc_set_clkdiv"); + + port = &mc_asoc->port; + + switch (div_id) { + case MC_ASOC_BCLK_MULT: + switch (div) { + case MC_ASOC_LRCK_X64: + port->bckfs = MCDRV_BCKFS_64; + break; + case MC_ASOC_LRCK_X48: + port->bckfs = MCDRV_BCKFS_48; + break; + case MC_ASOC_LRCK_X32: + port->bckfs = MCDRV_BCKFS_32; + break; + case MC_ASOC_LRCK_X512: + port->bckfs = MCDRV_BCKFS_512; + break; + case MC_ASOC_LRCK_X256: + port->bckfs = MCDRV_BCKFS_256; + break; + case MC_ASOC_LRCK_X192: + port->bckfs = MCDRV_BCKFS_192; + break; + case MC_ASOC_LRCK_X128: + port->bckfs = MCDRV_BCKFS_128; + break; + case MC_ASOC_LRCK_X96: + port->bckfs = MCDRV_BCKFS_96; + break; + case MC_ASOC_LRCK_X24: + port->bckfs = MCDRV_BCKFS_24; + break; + case MC_ASOC_LRCK_X16: + port->bckfs = MCDRV_BCKFS_16; + break; + default: + err = -EINVAL; + } + break; + + default: + break; + } + + mc_asoc_unlock("mc_asoc_set_clkdiv"); + return err; +} + +static int mc_asoc_set_fmt( + struct snd_soc_dai *dai, + unsigned int fmt) +{ + int err = 0; + struct snd_soc_codec *codec = NULL; + struct mc_asoc_data *mc_asoc = NULL; + struct mc_asoc_port_params *port = NULL; + + /*TRACE_FUNC();*/ + + if ((dai == NULL) + || (dai->codec == NULL) + || (get_port_id(dai->id) != 0)) + return -EINVAL; + + codec = dai->codec; + mc_asoc = mc_asoc_get_mc_asoc(codec); + if (mc_asoc == NULL) + return -EINVAL; + + mc_asoc_lock("mc_asoc_set_fmt"); + + port = &mc_asoc->port; + + /* format */ + switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { + case SND_SOC_DAIFMT_I2S: + port->format = MCDRV_DAMODE_I2S; + break; + case SND_SOC_DAIFMT_RIGHT_J: + port->format = MCDRV_DAMODE_TAILALIGN; + break; + case SND_SOC_DAIFMT_LEFT_J: + port->format = MCDRV_DAMODE_HEADALIGN; + break; + case SND_SOC_DAIFMT_DSP_A: + port->format = MCDRV_PCM_SHORTFRAME; + break; + case SND_SOC_DAIFMT_DSP_B: + port->format = MCDRV_PCM_LONGFRAME; + break; + default: + err = -EINVAL; + goto exit; + break; + } + + /* master */ + switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { + case SND_SOC_DAIFMT_CBM_CFM: + port->master = MCDRV_DIO_MASTER; + break; + case SND_SOC_DAIFMT_CBS_CFS: + port->master = MCDRV_DIO_SLAVE; + break; + default: + err = -EINVAL; + goto exit; + break; + } + + /* inv */ + switch (fmt & SND_SOC_DAIFMT_INV_MASK) { + case SND_SOC_DAIFMT_NB_NF: + port->inv = MCDRV_BCLK_NORMAL; + break; + case SND_SOC_DAIFMT_IB_NF: + port->inv = MCDRV_BCLK_INVERT; + break; + default: + err = -EINVAL; + break; + } + +exit: + mc_asoc_unlock("mc_asoc_set_fmt"); + return err; +} + +#ifdef DELAY_CONNECT_XXX +#define DELAY_CFG_SLIM_SCH (200) + +static struct workqueue_struct *workq_cfg_slim_sch; +static struct delayed_work delayed_work_cfg_slim_sch; +static void work_cfg_slim_sch(struct work_struct *work) +{ + int err; + struct MCDRV_PATH_INFO path_info; + struct MCDRV_DIO_INFO sDioInfo; + struct MCDRV_DIOPATH_INFO sDioPathInfo; + int port; + int rate[] = {48000, 44100, 32000, -1, 24000, 22050, 16000, -1, + 12000, 11025, 8000, -1, 192000, 96000}; + + TRACE_FUNC(); + + err = _McDrv_Ctrl(MCDRV_GET_PATH, &path_info, NULL, 0); + if (err != MCDRV_SUCCESS) { + pr_info("get path info failed:%d\n", err); + return; + } + + _McDrv_Ctrl(MCDRV_GET_DIGITALIO, &sDioInfo, NULL, 0); + _McDrv_Ctrl(MCDRV_GET_DIGITALIO_PATH, &sDioPathInfo, NULL, 0); + + port = sDioPathInfo.abPhysPort[0]; + if (port >= MCDRV_PHYSPORT_SLIM0) { + if ((path_info.asMusicOut[0].dSrcOnOff != 0x00AAAAAA) + || (path_info.asMusicOut[1].dSrcOnOff != 0x00AAAAAA)) { + cfg_slim_sch_tx((port - MCDRV_PHYSPORT_SLIM0)*2, 1, + rate[sDioInfo.asPortInfo[0].sDioCommon.bFs]); + } + if (is_d1src_used(&path_info, MCDRV_D1SRC_MUSICIN_ON)) { + cfg_slim_sch_rx((port - MCDRV_PHYSPORT_SLIM0)*2, 2, + rate[sDioInfo.asPortInfo[0].sDioCommon.bFs]); + } + } + + port = sDioPathInfo.abPhysPort[1]; + if (port >= MCDRV_PHYSPORT_SLIM0) { + if ((path_info.asExtOut[0].dSrcOnOff != 0x00AAAAAA) + || (path_info.asExtOut[1].dSrcOnOff != 0x00AAAAAA)) { + cfg_slim_sch_tx((port - MCDRV_PHYSPORT_SLIM0)*2, 2, + rate[sDioInfo.asPortInfo[1].sDioCommon.bFs]); + } + if (is_d1src_used(&path_info, MCDRV_D1SRC_EXTIN_ON)) { + cfg_slim_sch_rx((port - MCDRV_PHYSPORT_SLIM0)*2, 2, + rate[sDioInfo.asPortInfo[1].sDioCommon.bFs]); + } + } + + port = sDioPathInfo.abPhysPort[2]; + if (port >= MCDRV_PHYSPORT_SLIM0) { + if (path_info.asVoiceOut[0].dSrcOnOff != 0x00AAAAAA) { + cfg_slim_sch_tx((port - MCDRV_PHYSPORT_SLIM0)*2, 2, + rate[sDioInfo.asPortInfo[2].sDioCommon.bFs]); + } + if ((path_info.asVboxIoIn[0].dSrcOnOff != 0x00AAAAAA) + || (path_info.asVboxHostIn[0].dSrcOnOff != 0x00AAAAAA)) { + cfg_slim_sch_rx((port - MCDRV_PHYSPORT_SLIM0)*2, 2, + rate[sDioInfo.asPortInfo[2].sDioCommon.bFs]); + } + } + + port = sDioPathInfo.abPhysPort[3]; + if (port >= MCDRV_PHYSPORT_SLIM0) { + if (path_info.asHifiOut[0].dSrcOnOff != 0x00AAAAAA) { + cfg_slim_sch_tx((port - MCDRV_PHYSPORT_SLIM0)*2, 2, + rate[sDioInfo.asPortInfo[3].sDioCommon.bFs]); + } + if (((path_info.asDac0[0].dSrcOnOff&MCDRV_D1SRC_HIFIIN_ON) != 0) + || ((path_info.asDac0[1].dSrcOnOff&MCDRV_D1SRC_HIFIIN_ON) != 0) + || ((path_info.asDac1[0].dSrcOnOff&MCDRV_D1SRC_HIFIIN_ON) != 0) + || ((path_info.asDac1[1].dSrcOnOff&MCDRV_D1SRC_HIFIIN_ON) != 0) + ) { + cfg_slim_sch_rx((port - MCDRV_PHYSPORT_SLIM0)*2, 2, + rate[sDioInfo.asPortInfo[3].sDioCommon.bFs]); + } + } +} +#endif + +static int mc_asoc_hw_params( + struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params, + struct snd_soc_dai *dai) +{ + struct snd_soc_codec *codec = NULL; + struct mc_asoc_data *mc_asoc = NULL; + struct mc_asoc_port_params *port = NULL; + int dir = substream->stream; + int rate; + int err = 0; + int id; + struct MCDRV_DIOPATH_INFO sDioPathInfo; + struct mc_asoc_mixer_path_ctl_info mixer_ctl_info; + int preset_idx = 0; + + /* TRACE_FUNC(); */ + + if ((substream == NULL) + || (dai == NULL)) + return -EINVAL; + + id = get_port_id(dai->id); + if (id != 0) { + dbg_info("dai->id=%d\n", id); + return -EINVAL; + } + + dbg_info("hw_params: [%d] name=%s, dir=%d, rate=%d, bits=%d, ch=%d\n", + id, + substream->name, + dir, + params_rate(params), + params_format(params), + params_channels(params)); + + codec = dai->codec; + mc_asoc = mc_asoc_get_mc_asoc(codec); + if ((codec == NULL) + || (mc_asoc == NULL)) { + dbg_info("mc_asoc=NULL\n"); + return -EINVAL; + } + port = &mc_asoc->port; + + /* channels */ + switch (params_channels(params)) { + case 1: + port->pcm_mono[dir] = MCDRV_PCM_MONO; + port->channels = MCDRV_MUSIC_2CH; + break; + case 2: + port->channels = MCDRV_MUSIC_2CH; + port->pcm_mono[dir] = MCDRV_PCM_STEREO; + break; + case 4: + port->channels = MCDRV_MUSIC_4CH; + port->pcm_mono[dir] = MCDRV_PCM_STEREO; + break; + case 6: + port->channels = MCDRV_MUSIC_6CH; + port->pcm_mono[dir] = MCDRV_PCM_STEREO; + break; + default: + return -EINVAL; + } + + /* format (bits) */ + switch (params_format(params)) { + case SNDRV_PCM_FORMAT_S16_LE: + port->bits[dir] = MCDRV_BITSEL_16; + break; + case SNDRV_PCM_FORMAT_S20_3LE: + port->bits[dir] = MCDRV_BITSEL_20; + break; + case SNDRV_PCM_FORMAT_S24_LE: + case SNDRV_PCM_FORMAT_S24_3LE: + port->bits[dir] = MCDRV_BITSEL_24; + break; + case SNDRV_PCM_FORMAT_S32_LE: + port->bits[dir] = MCDRV_BITSEL_32; + break; + default: + return -EINVAL; + } + if (dir == SNDRV_PCM_STREAM_PLAYBACK) { + port->pcm_order[dir] + = stMusicPort_Default.sDir.sPcmFormat.bOrder; + port->pcm_law[dir] + = stMusicPort_Default.sDir.sPcmFormat.bLaw; + } else { + port->pcm_order[dir] + = stMusicPort_Default.sDit.sPcmFormat.bOrder; + port->pcm_law[dir] + = stMusicPort_Default.sDit.sPcmFormat.bLaw; + } + + /* rate */ + switch (params_rate(params)) { + case 8000: + rate = MCDRV_FS_8000; + break; + case 11025: + rate = MCDRV_FS_11025; + break; + case 16000: + rate = MCDRV_FS_16000; + break; + case 22050: + rate = MCDRV_FS_22050; + break; + case 32000: + rate = MCDRV_FS_32000; + break; + case 44100: + rate = MCDRV_FS_44100; + break; + case 48000: + rate = MCDRV_FS_48000; + break; + case 96000: + rate = MCDRV_FS_96000; + break; + case 192000: + rate = MCDRV_FS_192000; + break; + default: + return -EINVAL; + } + + mc_asoc_lock("mc_asoc_hw_params"); + + if (CAPTURE_PORT == CAPTURE_PORT_MUSIC) + if ((port->stream & ~(1 << dir)) && (rate != port->rate)) { + err = -EBUSY; + goto error; + } + + port->rate = rate; + + if (get_mixer_path_ctl_info(codec, &mixer_ctl_info) < 0) { + err = -EIO; + goto error; + } + preset_idx = get_path_preset_idx(&mixer_ctl_info); + if ((rate == MCDRV_FS_96000) + || (rate == MCDRV_FS_192000)) { + if ((is_incall(preset_idx) != 0) + || (is_incommunication(preset_idx) != 0)) { + err = -EINVAL; + goto error; + } + } + + if ((rate == MCDRV_FS_96000) + || (rate == MCDRV_FS_192000)) { + id = 3; + } else { + sDioPathInfo.bMusicCh = port->channels; + err = _McDrv_Ctrl(MCDRV_SET_DIGITALIO_PATH, &sDioPathInfo, + NULL, MCDRV_MUSICNUM_UPDATE_FLAG); + if (err != MCDRV_SUCCESS) { + dev_err(codec->dev, + "%d: Error in MCDRV_SET_DIGITALIO_PATH\n", + err); + goto error; + } + + if ((dir == SNDRV_PCM_STREAM_CAPTURE) + && (CAPTURE_PORT == CAPTURE_PORT_EXT)) + id = 1; + } + + err = setup_dai(codec, mc_asoc, id, MCDRV_DIO_DA, dir); + if (err != MCDRV_SUCCESS) { + dev_err(codec->dev, "%d: Error in setup_dai\n", err); + err = -EIO; + goto error; + } + + mc_asoc_port_rate = rate; + port->stream |= (1 << dir); + + if (preset_idx != get_path_preset_idx(&mixer_ctl_info)) { + err = connect_path(codec); + if (err < 0) { + ; + goto error; + } + } + +error: + mc_asoc_unlock("mc_asoc_hw_params"); + +#ifdef DELAY_CONNECT_XXX + dbg_info("queue_delayed_work_cfg_slim_sch\n"); + queue_delayed_work(workq_cfg_slim_sch, &delayed_work_cfg_slim_sch, + msecs_to_jiffies(DELAY_CFG_SLIM_SCH)); +#endif + + return err; +} + +static int mc_asoc_hw_free( + struct snd_pcm_substream *substream, + struct snd_soc_dai *dai) +{ + struct snd_soc_codec *codec = NULL; + struct mc_asoc_data *mc_asoc = NULL; + struct mc_asoc_port_params *port = NULL; + int dir = substream->stream; + int err = 0; + + /* TRACE_FUNC(); */ + + if ((substream == NULL) + || (dai == NULL)) + return -EINVAL; + + codec = dai->codec; + mc_asoc = mc_asoc_get_mc_asoc(codec); + if ((codec == NULL) + || (mc_asoc == NULL) + || (get_port_id(dai->id) != 0)) + return -EINVAL; + + port = &mc_asoc->port; + + mc_asoc_lock("mc_asoc_hw_free"); + + if (!(port->stream & (1 << dir))) { + err = 0; + goto error; + } + + port->stream &= ~(1 << dir); + +error: + mc_asoc_unlock("mc_asoc_hw_free"); + +#ifdef DELAY_CONNECT_XXX + cancel_delayed_work(&delayed_work_cfg_slim_sch); + dbg_info("cancel_delayed_work_cfg_slim_sch\n"); +#endif + + return err; +} + +static struct snd_soc_dai_ops mc_asoc_dai_ops[] = { + { + .set_clkdiv = mc_asoc_set_clkdiv, + .set_fmt = mc_asoc_set_fmt, + .hw_params = mc_asoc_hw_params, + .hw_free = mc_asoc_hw_free, + }, +}; + +struct snd_soc_dai_driver mc_asoc_dai[] = { + { + .name = MC_ASOC_NAME "-da0", + .id = 1, + .playback = { + .stream_name = "Playback", + .channels_min = 1, + .channels_max = 6, + .rates = MC_ASOC_RATE, + .formats = MC_ASOC_FORMATS, + }, + .capture = { + .stream_name = "Capture", + .channels_min = 1, + .channels_max = 2, + .rates = MC_ASOC_RATE, + .formats = MC_ASOC_FORMATS, + }, + .ops = &mc_asoc_dai_ops[0] + }, +}; + +/* + * Control interface + */ +/* + * Virtual register + * + * 16bit software registers are implemented for volumes and mute + * switches (as an exception, no mute switches for MIC and HP gain). + * Register contents are stored in codec's register cache. + * + * 15 14 8 7 0 + * +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ + * |swR| volume-R |swL| volume-L | + * +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ + */ + +static int write_reg_vol( + struct snd_soc_codec *codec, + unsigned int reg, + unsigned int value) +{ + struct MCDRV_VOL_INFO vol_info; + int err; + struct mc_asoc_mixer_path_ctl_info mixer_ctl_info; + int preset_idx = 0; + + err = write_cache(codec, reg, value); + if (err != 0) + dev_err(codec->dev, "Cache write to %x failed: %d\n", reg, + err); + + if (get_mixer_path_ctl_info(codec, &mixer_ctl_info) < 0) + return -EIO; + + preset_idx = get_path_preset_idx(&mixer_ctl_info); + if ((preset_idx < 0) || (preset_idx > PRESET_PATH_N)) + return -EIO; + + memset(&vol_info, 0, sizeof(struct MCDRV_VOL_INFO)); + switch (reg) { + case MC_ASOC_AVOL_SP_GAIN: + if (mc_asoc_ver_id == 0) { + vreg_map[MC_ASOC_AVOL_SP].volmap + = volmap_sp[value]; + reg = MC_ASOC_AVOL_SP; + } else { + return 0; + } + break; + case MC_ASOC_DVOL_MASTER: + if (mc_asoc_audio_play_port == LIN1) + reg = MC_ASOC_DVOL_ADIF1IN; + else + reg = MC_ASOC_DVOL_MUSICIN; + break; + case MC_ASOC_DVOL_VOICE: + if (is_incall(preset_idx) != 0) { + reg = MC_ASOC_DVOL_VOICEIN; + if ((mc_asoc_voice_port == LIN1_LOUT1) + || (mc_asoc_voice_port == LIN1_LOUT2)) + reg = MC_ASOC_AVOL_LINEIN1; + else if ((mc_asoc_voice_port == DIO_EXT) + && (is_incall_BT(preset_idx) == 0)) + reg = MC_ASOC_DVOL_EXTIN; + } else { + return 0; + } + break; + case MC_ASOC_DVOL_APLAY_A: + reg = MC_ASOC_AVOL_MIC1; + err = set_vol_info(codec, &vol_info, reg, &mixer_ctl_info, + preset_idx); + if (err < 0) + return err; + reg = MC_ASOC_AVOL_MIC2; + err = set_vol_info(codec, &vol_info, reg, &mixer_ctl_info, + preset_idx); + if (err < 0) + return err; + reg = MC_ASOC_AVOL_MIC3; + err = set_vol_info(codec, &vol_info, reg, &mixer_ctl_info, + preset_idx); + if (err < 0) + return err; + reg = MC_ASOC_AVOL_MIC4; + err = set_vol_info(codec, &vol_info, reg, &mixer_ctl_info, + preset_idx); + if (err < 0) + return err; + reg = MC_ASOC_AVOL_LINEIN1; + break; + case MC_ASOC_DVOL_APLAY_D: + reg = MC_ASOC_DVOL_ADIF1IN; + break; + case MC_ASOC_VOICE_RECORDING: + if (is_incall(preset_idx) != 0) { + reg = MC_ASOC_DVOL_VOICEOUT; + if (mc_asoc_voice_port == LIN1_LOUT1) + reg = MC_ASOC_DVOL_DAC0OUT; + else if (mc_asoc_voice_port == LIN1_LOUT2) + reg = MC_ASOC_DVOL_DAC1OUT; + } else if (is_incommunication(preset_idx) != 0) { + reg = MC_ASOC_DVOL_VOICEOUT; + } else { + return 0; + } + break; + default: + break; + } + + err = set_vol_info(codec, &vol_info, reg, &mixer_ctl_info, + preset_idx); + if (err < 0) + return err; + err = _McDrv_Ctrl(MCDRV_SET_VOLUME, &vol_info, NULL, 0); + if (err != MCDRV_SUCCESS) { + dev_err(codec->dev, + "%d: Error in MCDRV_SET_VOLUME\n", err); + return -EIO; + } + return 0; +} + +static void auto_powerdown( + struct snd_soc_codec *codec +) +{ +#if (AUTO_POWEROFF == AUTO_POWEROFF_ON) + int err = 0; + struct mc_asoc_mixer_path_ctl_info mixer_ctl_info; + UINT8 bAEC[] = { + 0x41, 0x45, 0x43, + 0x05, + 0, 0, 0, 60, + 0x00, + 253, + 0, + 0, + /* D7: */ + 0x44, 0x37, + 0, 0, 0, 50, + /* AudioEngine:16 */ + 0x02, 0x00, 0x00, 0x00, + 0, 0, 0, 8, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + /* V-BOX:23 */ + 0x03, 0x00, 0x00, 0x00, + 0, 0, 0, 15, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + /* E-DSP:11 */ + 0x07, 0x00, 0x00, 0x00, + 0, 0, 0, 3, + 0, + 0, + 0, + }; + + get_mixer_path_ctl_info(codec, &mixer_ctl_info); + if ((mixer_ctl_info.audio_mode_play == 0) + && (mixer_ctl_info.audio_mode_cap == 0) + && (mixer_ctl_info.mainmic_play == 0) + && (mixer_ctl_info.submic_play == 0) + && (mixer_ctl_info.msmic_play == 0) + && (mixer_ctl_info.hsmic_play == 0) + && (mixer_ctl_info.btmic_play == 0) + && (mixer_ctl_info.lin1_play == 0) + && (mixer_ctl_info.dtmf_control == 0)) + err = _McDrv_Ctrl(MCDRV_SET_DSP, bAEC, NULL, sizeof(bAEC)); + if (err != MCDRV_SUCCESS) { + ; + dbg_info("%d: Error in MCDRV_SET_DSP\n", err); + } +#endif +} + +static int add_dsp_prm( + struct mc_asoc_data *mc_asoc, + int i, + int j, + UINT8 *param, + UINT32 dSize +) +{ + struct mc_asoc_dsp_param *dsp_prm = NULL; + + dsp_prm = &mc_asoc->param_store[i][j]; + if (dsp_prm->pabParam == NULL) + dbg_info("param_store[%d][%d]->pabParam = %8p\n", + i, j, dsp_prm->pabParam); + else + while (dsp_prm->pabParam != NULL) { + dbg_info("pabParam = %8p\n", dsp_prm->pabParam); + if (dsp_prm->next == NULL) { + dsp_prm->next = kzalloc( + sizeof(struct mc_asoc_dsp_param), + GFP_KERNEL); + if (dsp_prm->next == NULL) + return -ENOMEM; + dsp_prm = dsp_prm->next; + dbg_info("next = %8p\n", dsp_prm); + break; + } else + dsp_prm = dsp_prm->next; + } + + dbg_info("param = %8p\n", param); + + dsp_prm->pabParam = param; + dsp_prm->dSize = dSize; + return 0; +} + +static void del_dsp_prm( + struct mc_asoc_data *mc_asoc +) +{ + int i, j; + struct mc_asoc_dsp_param *dsp_prm = NULL; + struct mc_asoc_dsp_param *next_prm = NULL; + + for (i = 0; i <= DSP_PRM_VC_2MIC; i++) { + for (j = 0; j <= DSP_PRM_USER; j++) { + if (mc_asoc->param_store[i][j].pabParam + != NULL) { + dbg_info( + "free(param_store[%d][%d].pabParam:%8p)\n", + i, j, + mc_asoc->param_store[i][j].pabParam); +#ifdef DSP_MEM_STATIC +#else + vfree( + mc_asoc->param_store[i][j].pabParam); +#endif + } + dsp_prm = mc_asoc->param_store[i][j].next; + while (dsp_prm != NULL) { + dbg_info("free(pabParam:%8p)\n", + dsp_prm->pabParam); +#ifdef DSP_MEM_STATIC +#else + vfree(dsp_prm->pabParam); +#endif + next_prm = dsp_prm->next; + dbg_info("free(dsp_prm:%8p)\n", + dsp_prm); + kfree(dsp_prm); + dsp_prm = next_prm; + } + mc_asoc->param_store[i][j].pabParam + = NULL; + mc_asoc->param_store[i][j].dSize + = 0; + mc_asoc->param_store[i][j].next + = NULL; + } + } +#ifdef DSP_MEM_STATIC + dsp_mem_pt = 0; + dbg_info("dsp_mem_pt:%d\n", dsp_mem_pt); +#endif +} + +static int set_audio_mode_play( + struct snd_soc_codec *codec, + unsigned int value +) +{ + int ret; + struct mc_asoc_data *mc_asoc = NULL; + struct mc_asoc_port_params *port = NULL; + + /* TRACE_FUNC(); */ + + dbg_info("audio_mode=%d\n", value); + + mc_asoc = mc_asoc_get_mc_asoc(codec); + if (mc_asoc == NULL) + return -EINVAL; + + port = &mc_asoc->port; + if (value > 1) + if ((port->stream != 0) + && ((port->rate == MCDRV_FS_96000) + || (port->rate == MCDRV_FS_192000))) + return -EINVAL; + + ret = write_cache(codec, MC_ASOC_AUDIO_MODE_PLAY, value); + if (ret < 0) + return ret; + + if (mc_asoc_hold == YMC_NOTITY_HOLD_ON) + return 0; + + if (value == 0) + del_dsp_prm(mc_asoc); + + ret = connect_path(codec); + if (value == 0) + auto_powerdown(codec); + return ret; +} + +static int set_audio_mode_cap( + struct snd_soc_codec *codec, + unsigned int value +) +{ + int ret; + struct mc_asoc_data *mc_asoc = NULL; + struct mc_asoc_port_params *port = NULL; + + TRACE_FUNC(); + dbg_info("audio_mode=%d\n", value); + + mc_asoc = mc_asoc_get_mc_asoc(codec); + if (mc_asoc == NULL) + return -EINVAL; + + port = &mc_asoc->port; + if (value > 1) + if ((port->stream != 0) + && ((port->rate == MCDRV_FS_96000) + || (port->rate == MCDRV_FS_192000))) + return -EINVAL; + + ret = write_cache(codec, MC_ASOC_AUDIO_MODE_CAP, value); + if (ret < 0) + return ret; + + if (mc_asoc_hold == YMC_NOTITY_HOLD_ON) + return 0; + + if (value == 0) + del_dsp_prm(mc_asoc); + + ret = connect_path(codec); + if (value == 0) + auto_powerdown(codec); + return ret; +} + +static int set_incall_mic( + struct snd_soc_codec *codec, + unsigned int reg, + unsigned int value +) +{ + int ret; + struct mc_asoc_data *mc_asoc = NULL; + struct mc_asoc_dsp_param *dsp_prm = NULL; + + TRACE_FUNC(); + + mc_asoc = mc_asoc_get_mc_asoc(codec); + if (mc_asoc == NULL) + return -EINVAL; + + ret = write_cache(codec, reg, value); + if (ret < 0) + return ret; + + if ((value == MC_ASOC_INCALL_MIC_MAINMIC) + || (value == MC_ASOC_INCALL_MIC_SUBMIC)) + dsp_prm = &mc_asoc->param_store[DSP_PRM_VC_1MIC][DSP_PRM_BASE]; + else + dsp_prm = &mc_asoc->param_store[DSP_PRM_VC_2MIC][DSP_PRM_BASE]; + + while (dsp_prm != NULL) { + if (dsp_prm->dSize > 0) { + ret = _McDrv_Ctrl(MCDRV_SET_DSP, + dsp_prm->pabParam, NULL, dsp_prm->dSize); + if (ret != 0) + return map_drv_error(ret); + } + dsp_prm = dsp_prm->next; + } + + if (mc_asoc_hold == YMC_NOTITY_HOLD_ON) + return 0; + + ret = connect_path(codec); + return ret; +} + +static int set_ain_playback( + struct snd_soc_codec *codec, + unsigned int reg, + unsigned int value +) +{ + int ret; + int audio_mode; + int audio_mode_cap; + + TRACE_FUNC(); + + dbg_info("ain_playback=%d\n", value); + + audio_mode_cap = read_cache(codec, MC_ASOC_AUDIO_MODE_CAP); + if (audio_mode_cap < 0) + return -EIO; + audio_mode = read_cache(codec, MC_ASOC_AUDIO_MODE_PLAY); + if (audio_mode < 0) + return -EIO; + + ret = write_cache(codec, reg, value); + if (ret < 0) + return ret; + + if ((audio_mode == MC_ASOC_AUDIO_MODE_INCALL) + || (audio_mode == MC_ASOC_AUDIO_MODE_INCALL2) + || (audio_mode == MC_ASOC_AUDIO_MODE_INCALL3) + || (audio_mode == MC_ASOC_AUDIO_MODE_INCALL4) + || (audio_mode == MC_ASOC_AUDIO_MODE_AUDIO_INCALL) + || (audio_mode == MC_ASOC_AUDIO_MODE_AUDIO_INCALL2) + || (audio_mode == MC_ASOC_AUDIO_MODE_AUDIO_INCALL3) + || (audio_mode == MC_ASOC_AUDIO_MODE_AUDIO_INCALL4) + ) { + if ((audio_mode_cap == MC_ASOC_AUDIO_MODE_INCALL) + || (audio_mode_cap == MC_ASOC_AUDIO_MODE_AUDIO_INCALL)) + return 0; + } + if (((audio_mode == MC_ASOC_AUDIO_MODE_INCOMM) + || (audio_mode == MC_ASOC_AUDIO_MODE_INCOMM2)) + && ((audio_mode_cap == MC_ASOC_AUDIO_MODE_INCOMM) + || (audio_mode_cap == MC_ASOC_AUDIO_MODE_OFF))) + return 0; + if ((audio_mode == MC_ASOC_AUDIO_MODE_OFF) + && (audio_mode_cap == MC_ASOC_AUDIO_MODE_INCOMM)) + return 0; + + if (mc_asoc_hold == YMC_NOTITY_HOLD_ON) + return 0; + + ret = connect_path(codec); + if (value == 0) + auto_powerdown(codec); + return ret; +} + +static int set_dtmf_control( + struct snd_soc_codec *codec, + unsigned int reg, + unsigned int value +) +{ + int ret; + + TRACE_FUNC(); + + ret = write_cache(codec, reg, value); + if (ret < 0) + return ret; + + if (mc_asoc_hold == YMC_NOTITY_HOLD_ON) + return 0; + + ret = connect_path(codec); + if (value == 0) + auto_powerdown(codec); + return ret; +} + +static int set_dtmf_output( + struct snd_soc_codec *codec, + unsigned int reg, + unsigned int value +) +{ + int ret; + + TRACE_FUNC(); + + ret = write_cache(codec, reg, value); + if (ret < 0) + return ret; + + if (mc_asoc_hold == YMC_NOTITY_HOLD_ON) + return 0; + + ret = connect_path(codec); + return ret; +} + +static int set_switch_clock( + struct snd_soc_codec *codec, + unsigned int reg, + unsigned int value +) +{ + int ret; + struct MCDRV_CLOCKSW_INFO sInfo; + + TRACE_FUNC(); + + sInfo.bClkSrc = (UINT8)value; + ret = _McDrv_Ctrl(MCDRV_SET_CLOCKSW, &sInfo, NULL, 0); + if (ret != MCDRV_SUCCESS) + return map_drv_error(ret); + + ret = write_cache(codec, reg, value); + if (ret < 0) + return ret; + + return ret; +} + +static int set_masterslave( + struct snd_soc_codec *codec, + unsigned int reg, + unsigned int value, + UINT8 bPort +) +{ + int ret; + struct MCDRV_DIO_INFO sInfo; + UINT32 dFlag; + + TRACE_FUNC(); + + ret = _McDrv_Ctrl(MCDRV_GET_DIGITALIO, &sInfo, NULL, 0); + if (ret != MCDRV_SUCCESS) + return map_drv_error(ret); + + sInfo.asPortInfo[bPort].sDioCommon.bMasterSlave = (UINT8)value; + dFlag = (bPort == 1) ? MCDRV_EXT_COM_UPDATE_FLAG + : MCDRV_VOICE_COM_UPDATE_FLAG; + ret = _McDrv_Ctrl(MCDRV_SET_DIGITALIO, &sInfo, NULL, dFlag); + if (ret != MCDRV_SUCCESS) + return map_drv_error(ret); + + ret = write_cache(codec, reg, value); + if (ret < 0) + return ret; + + return ret; +} + +static int set_rate( + struct snd_soc_codec *codec, + unsigned int reg, + unsigned int value, + UINT8 bPort +) +{ + int ret; + struct MCDRV_DIO_INFO sInfo; + UINT32 dFlag; + + TRACE_FUNC(); + + ret = _McDrv_Ctrl(MCDRV_GET_DIGITALIO, &sInfo, NULL, 0); + if (ret != MCDRV_SUCCESS) + return map_drv_error(ret); + + sInfo.asPortInfo[bPort].sDioCommon.bFs = value; + dFlag = (bPort == 1) ? MCDRV_EXT_COM_UPDATE_FLAG + : MCDRV_VOICE_COM_UPDATE_FLAG; + ret = _McDrv_Ctrl(MCDRV_SET_DIGITALIO, &sInfo, NULL, dFlag); + if (ret != MCDRV_SUCCESS) + return map_drv_error(ret); + + ret = write_cache(codec, reg, value); + if (ret < 0) + return ret; + + return ret; +} + +static int set_bitclock_rate( + struct snd_soc_codec *codec, + unsigned int reg, + unsigned int value, + UINT8 bPort +) +{ + int ret; + struct MCDRV_DIO_INFO sInfo; + UINT32 dFlag; + + TRACE_FUNC(); + + ret = _McDrv_Ctrl(MCDRV_GET_DIGITALIO, &sInfo, NULL, 0); + if (ret != MCDRV_SUCCESS) + return map_drv_error(ret); + + sInfo.asPortInfo[bPort].sDioCommon.bBckFs = (UINT8)value; + dFlag = (bPort == 1) ? MCDRV_EXT_COM_UPDATE_FLAG + : MCDRV_VOICE_COM_UPDATE_FLAG; + ret = _McDrv_Ctrl(MCDRV_SET_DIGITALIO, &sInfo, NULL, dFlag); + if (ret != MCDRV_SUCCESS) + return map_drv_error(ret); + + ret = write_cache(codec, reg, value); + if (ret < 0) + return ret; + + return ret; +} + +static int set_interface( + struct snd_soc_codec *codec, + unsigned int reg, + unsigned int value, + UINT8 bPort +) +{ + int ret; + struct MCDRV_DIO_INFO sInfo; + UINT32 dFlag; + + TRACE_FUNC(); + + ret = _McDrv_Ctrl(MCDRV_GET_DIGITALIO, &sInfo, NULL, 0); + if (ret != MCDRV_SUCCESS) + return map_drv_error(ret); + + sInfo.asPortInfo[bPort].sDioCommon.bInterface = (UINT8)value; + dFlag = (bPort == 1) ? MCDRV_EXT_COM_UPDATE_FLAG + : MCDRV_VOICE_COM_UPDATE_FLAG; + ret = _McDrv_Ctrl(MCDRV_SET_DIGITALIO, &sInfo, NULL, dFlag); + if (ret != MCDRV_SUCCESS) + return map_drv_error(ret); + + ret = write_cache(codec, reg, value); + if (ret < 0) + return ret; + + return ret; +} + +static int set_bitclock_invert( + struct snd_soc_codec *codec, + unsigned int reg, + unsigned int value, + UINT8 bPort +) +{ + int ret; + struct MCDRV_DIO_INFO sInfo; + UINT32 dFlag; + + TRACE_FUNC(); + + ret = _McDrv_Ctrl(MCDRV_GET_DIGITALIO, &sInfo, NULL, 0); + if (ret != MCDRV_SUCCESS) + return map_drv_error(ret); + + sInfo.asPortInfo[bPort].sDioCommon.bBckInvert = (UINT8)value; + dFlag = (bPort == 1) ? MCDRV_EXT_COM_UPDATE_FLAG + : MCDRV_VOICE_COM_UPDATE_FLAG; + ret = _McDrv_Ctrl(MCDRV_SET_DIGITALIO, &sInfo, NULL, dFlag); + if (ret != MCDRV_SUCCESS) + return map_drv_error(ret); + + ret = write_cache(codec, reg, value); + if (ret < 0) + return ret; + + return ret; +} + +static int set_da_bit_width( + struct snd_soc_codec *codec, + unsigned int reg, + unsigned int value, + UINT8 bPort, + UINT8 bInOut +) +{ + int ret; + struct MCDRV_DIO_INFO sInfo; + UINT32 dFlag; + + TRACE_FUNC(); + + ret = _McDrv_Ctrl(MCDRV_GET_DIGITALIO, &sInfo, NULL, 0); + if (ret != MCDRV_SUCCESS) + return map_drv_error(ret); + + if (bInOut == 0) + sInfo.asPortInfo[bPort].sDir.sDaFormat.bBitSel = (UINT8)value; + else + sInfo.asPortInfo[bPort].sDit.sDaFormat.bBitSel = (UINT8)value; + dFlag = (bPort == 1) ? + MCDRV_EXT_DIR_UPDATE_FLAG|MCDRV_EXT_DIT_UPDATE_FLAG + : MCDRV_VOICE_DIR_UPDATE_FLAG|MCDRV_VOICE_DIT_UPDATE_FLAG; + + ret = _McDrv_Ctrl(MCDRV_SET_DIGITALIO, &sInfo, NULL, dFlag); + if (ret != MCDRV_SUCCESS) + return map_drv_error(ret); + + ret = write_cache(codec, reg, value); + if (ret < 0) + return ret; + + return ret; +} + +static int set_da_format( + struct snd_soc_codec *codec, + unsigned int reg, + unsigned int value, + UINT8 bPort, + UINT8 bInOut +) +{ + int ret; + struct MCDRV_DIO_INFO sInfo; + UINT32 dFlag; + + TRACE_FUNC(); + + ret = _McDrv_Ctrl(MCDRV_GET_DIGITALIO, &sInfo, NULL, 0); + if (ret != MCDRV_SUCCESS) + return map_drv_error(ret); + + if (bInOut == 0) + sInfo.asPortInfo[bPort].sDir.sDaFormat.bMode = (UINT8)value; + else + sInfo.asPortInfo[bPort].sDit.sDaFormat.bMode = (UINT8)value; + dFlag = (bPort == 1) ? + MCDRV_EXT_DIR_UPDATE_FLAG|MCDRV_EXT_DIT_UPDATE_FLAG + : MCDRV_VOICE_DIR_UPDATE_FLAG|MCDRV_VOICE_DIT_UPDATE_FLAG; + + ret = _McDrv_Ctrl(MCDRV_SET_DIGITALIO, &sInfo, NULL, dFlag); + if (ret != MCDRV_SUCCESS) + return map_drv_error(ret); + + ret = write_cache(codec, reg, value); + if (ret < 0) + return ret; + + return ret; +} + +static int set_pcm_monostereo( + struct snd_soc_codec *codec, + unsigned int reg, + unsigned int value, + UINT8 bPort, + UINT8 bInOut +) +{ + int ret; + struct MCDRV_DIO_INFO sInfo; + UINT32 dFlag; + + TRACE_FUNC(); + + ret = _McDrv_Ctrl(MCDRV_GET_DIGITALIO, &sInfo, NULL, 0); + if (ret != MCDRV_SUCCESS) + return map_drv_error(ret); + + if (bInOut == 0) + sInfo.asPortInfo[bPort].sDir.sPcmFormat.bMono = (UINT8)value; + else + sInfo.asPortInfo[bPort].sDit.sPcmFormat.bMono = (UINT8)value; + dFlag = (bPort == 1) ? + MCDRV_EXT_DIR_UPDATE_FLAG|MCDRV_EXT_DIT_UPDATE_FLAG + : MCDRV_VOICE_DIR_UPDATE_FLAG|MCDRV_VOICE_DIT_UPDATE_FLAG; + + ret = _McDrv_Ctrl(MCDRV_SET_DIGITALIO, &sInfo, NULL, dFlag); + if (ret != MCDRV_SUCCESS) + return map_drv_error(ret); + + ret = write_cache(codec, reg, value); + if (ret < 0) + return ret; + + return ret; +} + +static int set_pcm_bit_order( + struct snd_soc_codec *codec, + unsigned int reg, + unsigned int value, + UINT8 bPort, + UINT8 bInOut +) +{ + int ret; + struct MCDRV_DIO_INFO sInfo; + UINT32 dFlag; + + TRACE_FUNC(); + + ret = _McDrv_Ctrl(MCDRV_GET_DIGITALIO, &sInfo, NULL, 0); + if (ret != MCDRV_SUCCESS) + return map_drv_error(ret); + + if (bInOut == 0) + sInfo.asPortInfo[bPort].sDir.sPcmFormat.bOrder = (UINT8)value; + else + sInfo.asPortInfo[bPort].sDit.sPcmFormat.bOrder = (UINT8)value; + dFlag = (bPort == 1) ? + MCDRV_EXT_DIR_UPDATE_FLAG|MCDRV_EXT_DIT_UPDATE_FLAG + : MCDRV_VOICE_DIR_UPDATE_FLAG|MCDRV_VOICE_DIT_UPDATE_FLAG; + + ret = _McDrv_Ctrl(MCDRV_SET_DIGITALIO, &sInfo, NULL, dFlag); + if (ret != MCDRV_SUCCESS) + return map_drv_error(ret); + + ret = write_cache(codec, reg, value); + if (ret < 0) + return ret; + + return ret; +} + +static int set_pcm_format( + struct snd_soc_codec *codec, + unsigned int reg, + unsigned int value, + UINT8 bPort, + UINT8 bInOut +) +{ + int ret; + struct MCDRV_DIO_INFO sInfo; + UINT32 dFlag; + + TRACE_FUNC(); + + ret = _McDrv_Ctrl(MCDRV_GET_DIGITALIO, &sInfo, NULL, 0); + if (ret != MCDRV_SUCCESS) + return map_drv_error(ret); + + if (bInOut == 0) + sInfo.asPortInfo[bPort].sDir.sPcmFormat.bLaw = (UINT8)value; + else + sInfo.asPortInfo[bPort].sDit.sPcmFormat.bLaw = (UINT8)value; + dFlag = (bPort == 1) ? + MCDRV_EXT_DIR_UPDATE_FLAG|MCDRV_EXT_DIT_UPDATE_FLAG + : MCDRV_VOICE_DIR_UPDATE_FLAG|MCDRV_VOICE_DIT_UPDATE_FLAG; + + ret = _McDrv_Ctrl(MCDRV_SET_DIGITALIO, &sInfo, NULL, dFlag); + if (ret != MCDRV_SUCCESS) + return map_drv_error(ret); + + ret = write_cache(codec, reg, value); + if (ret < 0) + return ret; + + return ret; +} + +static int set_pcm_bit_width( + struct snd_soc_codec *codec, + unsigned int reg, + unsigned int value, + UINT8 bPort, + UINT8 bInOut +) +{ + int ret; + struct MCDRV_DIO_INFO sInfo; + UINT32 dFlag; + + TRACE_FUNC(); + + ret = _McDrv_Ctrl(MCDRV_GET_DIGITALIO, &sInfo, NULL, 0); + if (ret != MCDRV_SUCCESS) + return map_drv_error(ret); + + if (bInOut == 0) + sInfo.asPortInfo[bPort].sDir.sPcmFormat.bBitSel = (UINT8)value; + else + sInfo.asPortInfo[bPort].sDit.sPcmFormat.bBitSel = (UINT8)value; + dFlag = (bPort == 1) ? + MCDRV_EXT_DIR_UPDATE_FLAG|MCDRV_EXT_DIT_UPDATE_FLAG + : MCDRV_VOICE_DIR_UPDATE_FLAG|MCDRV_VOICE_DIT_UPDATE_FLAG; + + ret = _McDrv_Ctrl(MCDRV_SET_DIGITALIO, &sInfo, NULL, dFlag); + if (ret != MCDRV_SUCCESS) + return map_drv_error(ret); + + ret = write_cache(codec, reg, value); + if (ret < 0) + return ret; + + return ret; +} + +static int set_phys_port( + struct snd_soc_codec *codec, + unsigned int reg, + unsigned int value, + UINT8 bPort +) +{ + int ret; + struct MCDRV_DIOPATH_INFO sInfo; + + TRACE_FUNC(); + + sInfo.abPhysPort[bPort] = (UINT8)value; + ret = _McDrv_Ctrl(MCDRV_SET_DIGITALIO_PATH, &sInfo, NULL, + 1<<bPort); + if (ret != MCDRV_SUCCESS) + return map_drv_error(ret); + + ret = write_cache(codec, reg, value); + if (ret < 0) + return ret; + + return ret; +} + +static int set_swap( + struct snd_soc_codec *codec, + unsigned int reg, + unsigned int value, + size_t offset, + UINT32 dFlag +) +{ + int ret; + struct MCDRV_SWAP_INFO sInfo; + + /* TRACE_FUNC(); */ + + *(UINT8 *)((void *)&sInfo+offset) = (UINT8)value; + ret = _McDrv_Ctrl(MCDRV_SET_SWAP, &sInfo, NULL, dFlag); + if (ret != MCDRV_SUCCESS) + return map_drv_error(ret); + + ret = write_cache(codec, reg, value); + if (ret < 0) + return ret; + + return ret; +} + +static int set_dsp( + struct snd_soc_codec *codec, + UINT8 *param, + unsigned long size, + unsigned long option +) +{ + int err = 0; + struct mc_asoc_data *mc_asoc = NULL; + int output_path; + int input_path; + int incall_mic; + UINT8 *param2; + + mc_asoc = mc_asoc_get_mc_asoc(codec); + if (mc_asoc == NULL) + return -EINVAL; + + output_path = read_cache(codec, MC_ASOC_OUTPUT_PATH); + if (output_path < 0) + return -EIO; + input_path = read_cache(codec, MC_ASOC_INPUT_PATH); + if (input_path < 0) + return -EIO; + incall_mic = get_incall_mic(codec, output_path); + if (incall_mic < 0) + return -EIO; + + dbg_info("option=%08lX\n", option); + switch (option) { + case YMC_DSP_OUTPUT_BASE: + err = add_dsp_prm(mc_asoc, DSP_PRM_OUTPUT, + DSP_PRM_BASE, param, size); + break; + case YMC_DSP_INPUT_BASE: + err = add_dsp_prm(mc_asoc, DSP_PRM_INPUT, + DSP_PRM_BASE, param, size); + break; + case YMC_DSP_VOICECALL_BASE_COMMON: + err = add_dsp_prm(mc_asoc, DSP_PRM_VC_1MIC, + DSP_PRM_BASE, param, size); + if (err != 0) + break; + + param2 = get_dsp_mem(size); + if (param2 == NULL) { + err = -ENOMEM; + break; + } + memcpy(param2, param, size); + param = param2; + err = add_dsp_prm(mc_asoc, DSP_PRM_VC_2MIC, + DSP_PRM_BASE, param, size); + break; + case YMC_DSP_VOICECALL_BASE_1MIC: + err = add_dsp_prm(mc_asoc, DSP_PRM_VC_1MIC, + DSP_PRM_BASE, param, size); + if (err != 0) + break; + if ((incall_mic != MC_ASOC_INCALL_MIC_MAINMIC) + && (incall_mic != MC_ASOC_INCALL_MIC_SUBMIC)) + goto exit; + break; + case YMC_DSP_VOICECALL_BASE_2MIC: + err = add_dsp_prm(mc_asoc, DSP_PRM_VC_2MIC, + DSP_PRM_BASE, param, size); + if (err != 0) + break; + if (incall_mic != MC_ASOC_INCALL_MIC_2MIC) + goto exit; + break; + case YMC_DSP_OUTPUT_SP: + if (output_path != MC_ASOC_OUTPUT_PATH_SP) { +#ifdef DSP_MEM_STATIC +#else + vfree(param); +#endif + goto exit; + } + err = add_dsp_prm(mc_asoc, DSP_PRM_OUTPUT, + DSP_PRM_USER, param, size); + break; + case YMC_DSP_OUTPUT_RC: + if ((output_path != MC_ASOC_OUTPUT_PATH_RC) + && (output_path != MC_ASOC_OUTPUT_PATH_SP_RC) + && (output_path != MC_ASOC_OUTPUT_PATH_LO1_RC) + && (output_path != MC_ASOC_OUTPUT_PATH_LO2_RC)) { +#ifdef DSP_MEM_STATIC +#else + vfree(param); +#endif + goto exit; + } + err = add_dsp_prm(mc_asoc, DSP_PRM_OUTPUT, + DSP_PRM_USER, param, size); + break; + case YMC_DSP_OUTPUT_HP: + if ((output_path != MC_ASOC_OUTPUT_PATH_HP) + && (output_path != MC_ASOC_OUTPUT_PATH_HS) + && (output_path != MC_ASOC_OUTPUT_PATH_SP_HP) + && (output_path != MC_ASOC_OUTPUT_PATH_LO1_HP) + && (output_path != MC_ASOC_OUTPUT_PATH_LO2_HP)) { +#ifdef DSP_MEM_STATIC +#else + vfree(param); +#endif + goto exit; + } + err = add_dsp_prm(mc_asoc, DSP_PRM_OUTPUT, + DSP_PRM_USER, param, size); + break; + case YMC_DSP_OUTPUT_LO1: + if ((output_path != MC_ASOC_OUTPUT_PATH_LO1) + && (output_path != MC_ASOC_OUTPUT_PATH_SP_LO1) + && (output_path != MC_ASOC_OUTPUT_PATH_LO2_LO1)) { +#ifdef DSP_MEM_STATIC +#else + vfree(param); +#endif + goto exit; + } + err = add_dsp_prm(mc_asoc, DSP_PRM_OUTPUT, + DSP_PRM_USER, param, size); + break; + case YMC_DSP_OUTPUT_LO2: + if ((output_path != MC_ASOC_OUTPUT_PATH_LO2) + && (output_path != MC_ASOC_OUTPUT_PATH_SP_LO2) + && (output_path != MC_ASOC_OUTPUT_PATH_LO1_LO2)) { +#ifdef DSP_MEM_STATIC +#else + vfree(param); +#endif + goto exit; + } + err = add_dsp_prm(mc_asoc, DSP_PRM_OUTPUT, + DSP_PRM_USER, param, size); + break; + case YMC_DSP_OUTPUT_BT: + if ((output_path != MC_ASOC_OUTPUT_PATH_BT) + && (output_path != MC_ASOC_OUTPUT_PATH_SP_BT) + && (output_path != MC_ASOC_OUTPUT_PATH_LO1_BT) + && (output_path != MC_ASOC_OUTPUT_PATH_LO2_BT)) { +#ifdef DSP_MEM_STATIC +#else + vfree(param); +#endif + goto exit; + } + err = add_dsp_prm(mc_asoc, DSP_PRM_OUTPUT, + DSP_PRM_USER, param, size); + break; + case YMC_DSP_INPUT_MAINMIC: + if (input_path != MC_ASOC_INPUT_PATH_MAINMIC) { +#ifdef DSP_MEM_STATIC +#else + vfree(param); +#endif + goto exit; + } + err = add_dsp_prm(mc_asoc, DSP_PRM_INPUT, + DSP_PRM_USER, param, size); + break; + case YMC_DSP_INPUT_SUBMIC: + if (input_path != MC_ASOC_INPUT_PATH_SUBMIC) { +#ifdef DSP_MEM_STATIC +#else + vfree(param); +#endif + goto exit; + } + err = add_dsp_prm(mc_asoc, DSP_PRM_INPUT, + DSP_PRM_USER, param, size); + break; + case YMC_DSP_INPUT_2MIC: + if (input_path != MC_ASOC_INPUT_PATH_2MIC) { +#ifdef DSP_MEM_STATIC +#else + vfree(param); +#endif + goto exit; + } + err = add_dsp_prm(mc_asoc, DSP_PRM_INPUT, + DSP_PRM_USER, param, size); + break; + case YMC_DSP_INPUT_HEADSET: + if (input_path != MC_ASOC_INPUT_PATH_HS) { +#ifdef DSP_MEM_STATIC +#else + vfree(param); +#endif + goto exit; + } + err = add_dsp_prm(mc_asoc, DSP_PRM_INPUT, + DSP_PRM_USER, param, size); + break; + case YMC_DSP_INPUT_BT: + if (input_path != MC_ASOC_INPUT_PATH_BT) { +#ifdef DSP_MEM_STATIC +#else + vfree(param); +#endif + goto exit; + } + err = add_dsp_prm(mc_asoc, DSP_PRM_INPUT, + DSP_PRM_USER, param, size); + break; + case YMC_DSP_INPUT_LINEIN1: + if (input_path != MC_ASOC_INPUT_PATH_LIN1) { +#ifdef DSP_MEM_STATIC +#else + vfree(param); +#endif + goto exit; + } + err = add_dsp_prm(mc_asoc, DSP_PRM_INPUT, + DSP_PRM_USER, param, size); + break; + case YMC_DSP_VOICECALL_SP_1MIC: + if (output_path != MC_ASOC_OUTPUT_PATH_SP) { +#ifdef DSP_MEM_STATIC +#else + vfree(param); +#endif + goto exit; + } + err = add_dsp_prm(mc_asoc, DSP_PRM_VC_1MIC, + DSP_PRM_USER, param, size); + if (err != 0) + break; + if ((incall_mic != MC_ASOC_INCALL_MIC_MAINMIC) + && (incall_mic != MC_ASOC_INCALL_MIC_SUBMIC)) + goto exit; + break; + case YMC_DSP_VOICECALL_RC_1MIC: + if ((output_path != MC_ASOC_OUTPUT_PATH_RC) + && (output_path != MC_ASOC_OUTPUT_PATH_SP_RC) + && (output_path != MC_ASOC_OUTPUT_PATH_LO1_RC) + && (output_path != MC_ASOC_OUTPUT_PATH_LO2_RC)) { +#ifdef DSP_MEM_STATIC +#else + vfree(param); +#endif + goto exit; + } + err = add_dsp_prm(mc_asoc, DSP_PRM_VC_1MIC, + DSP_PRM_USER, param, size); + if (err != 0) + break; + if ((incall_mic != MC_ASOC_INCALL_MIC_MAINMIC) + && (incall_mic != MC_ASOC_INCALL_MIC_SUBMIC)) + goto exit; + break; + case YMC_DSP_VOICECALL_HP_1MIC: + if ((output_path != MC_ASOC_OUTPUT_PATH_HP) + && (output_path != MC_ASOC_OUTPUT_PATH_SP_HP) + && (output_path != MC_ASOC_OUTPUT_PATH_LO1_HP) + && (output_path != MC_ASOC_OUTPUT_PATH_LO2_HP)) { +#ifdef DSP_MEM_STATIC +#else + vfree(param); +#endif + goto exit; + } + err = add_dsp_prm(mc_asoc, DSP_PRM_VC_1MIC, + DSP_PRM_USER, param, size); + if (err != 0) + break; + if ((incall_mic != MC_ASOC_INCALL_MIC_MAINMIC) + && (incall_mic != MC_ASOC_INCALL_MIC_SUBMIC)) + goto exit; + break; + case YMC_DSP_VOICECALL_LO1_1MIC: + if ((output_path != MC_ASOC_OUTPUT_PATH_LO1) + && (output_path != MC_ASOC_OUTPUT_PATH_SP_LO1) + && (output_path != MC_ASOC_OUTPUT_PATH_LO2_LO1)) { +#ifdef DSP_MEM_STATIC +#else + vfree(param); +#endif + goto exit; + } + err = add_dsp_prm(mc_asoc, DSP_PRM_VC_1MIC, + DSP_PRM_USER, param, size); + if (err != 0) + break; + if ((incall_mic != MC_ASOC_INCALL_MIC_MAINMIC) + && (incall_mic != MC_ASOC_INCALL_MIC_SUBMIC)) + goto exit; + break; + case YMC_DSP_VOICECALL_LO2_1MIC: + if ((output_path != MC_ASOC_OUTPUT_PATH_LO2) + && (output_path != MC_ASOC_OUTPUT_PATH_SP_LO2) + && (output_path != MC_ASOC_OUTPUT_PATH_LO1_LO2)) { +#ifdef DSP_MEM_STATIC +#else + vfree(param); +#endif + goto exit; + } + err = add_dsp_prm(mc_asoc, DSP_PRM_VC_1MIC, + DSP_PRM_USER, param, size); + if (err != 0) + break; + if ((incall_mic != MC_ASOC_INCALL_MIC_MAINMIC) + && (incall_mic != MC_ASOC_INCALL_MIC_SUBMIC)) + goto exit; + break; + case YMC_DSP_VOICECALL_HEADSET: + if (output_path != MC_ASOC_OUTPUT_PATH_HS) { +#ifdef DSP_MEM_STATIC +#else + vfree(param); +#endif + goto exit; + } + err = add_dsp_prm(mc_asoc, DSP_PRM_VC_1MIC, + DSP_PRM_USER, param, size); + if (err != 0) + break; + if ((incall_mic != MC_ASOC_INCALL_MIC_MAINMIC) + && (incall_mic != MC_ASOC_INCALL_MIC_SUBMIC)) + goto exit; + break; + case YMC_DSP_VOICECALL_BT: + if ((output_path != MC_ASOC_OUTPUT_PATH_BT) + && (output_path != MC_ASOC_OUTPUT_PATH_SP_BT) + && (output_path != MC_ASOC_OUTPUT_PATH_LO1_BT) + && (output_path != MC_ASOC_OUTPUT_PATH_LO2_BT)) { +#ifdef DSP_MEM_STATIC +#else + vfree(param); +#endif + goto exit; + } + err = add_dsp_prm(mc_asoc, DSP_PRM_VC_2MIC, + DSP_PRM_USER, param, size); + if (err != 0) + break; + if ((incall_mic != MC_ASOC_INCALL_MIC_MAINMIC) + && (incall_mic != MC_ASOC_INCALL_MIC_SUBMIC)) + goto exit; + break; + case YMC_DSP_VOICECALL_SP_2MIC: + if (output_path != MC_ASOC_OUTPUT_PATH_SP) { +#ifdef DSP_MEM_STATIC +#else + vfree(param); +#endif + goto exit; + } + err = add_dsp_prm(mc_asoc, DSP_PRM_VC_2MIC, + DSP_PRM_USER, param, size); + if (err != 0) + break; + if (incall_mic != MC_ASOC_INCALL_MIC_2MIC) + goto exit; + break; + case YMC_DSP_VOICECALL_RC_2MIC: + if ((output_path != MC_ASOC_OUTPUT_PATH_RC) + && (output_path != MC_ASOC_OUTPUT_PATH_SP_RC) + && (output_path != MC_ASOC_OUTPUT_PATH_LO1_RC) + && (output_path != MC_ASOC_OUTPUT_PATH_LO2_RC)) { +#ifdef DSP_MEM_STATIC +#else + vfree(param); +#endif + goto exit; + } + err = add_dsp_prm(mc_asoc, DSP_PRM_VC_2MIC, + DSP_PRM_USER, param, size); + if (err != 0) + break; + if (incall_mic != MC_ASOC_INCALL_MIC_2MIC) + goto exit; + break; + case YMC_DSP_VOICECALL_HP_2MIC: + if ((output_path != MC_ASOC_OUTPUT_PATH_HP) + && (output_path != MC_ASOC_OUTPUT_PATH_HS) + && (output_path != MC_ASOC_OUTPUT_PATH_SP_HP) + && (output_path != MC_ASOC_OUTPUT_PATH_LO1_HP) + && (output_path != MC_ASOC_OUTPUT_PATH_LO2_HP)) { +#ifdef DSP_MEM_STATIC +#else + vfree(param); +#endif + goto exit; + } + err = add_dsp_prm(mc_asoc, DSP_PRM_VC_2MIC, + DSP_PRM_USER, param, size); + if (err != 0) + break; + if (incall_mic != MC_ASOC_INCALL_MIC_2MIC) + goto exit; + break; + case YMC_DSP_VOICECALL_LO1_2MIC: + if ((output_path != MC_ASOC_OUTPUT_PATH_LO1) + && (output_path != MC_ASOC_OUTPUT_PATH_SP_LO1) + && (output_path != MC_ASOC_OUTPUT_PATH_LO2_LO1)) { +#ifdef DSP_MEM_STATIC +#else + vfree(param); +#endif + goto exit; + } + err = add_dsp_prm(mc_asoc, DSP_PRM_VC_2MIC, + DSP_PRM_USER, param, size); + if (err != 0) + break; + if (incall_mic != MC_ASOC_INCALL_MIC_2MIC) + goto exit; + break; + case YMC_DSP_VOICECALL_LO2_2MIC: + if ((output_path != MC_ASOC_OUTPUT_PATH_LO2) + && (output_path != MC_ASOC_OUTPUT_PATH_SP_LO2) + && (output_path != MC_ASOC_OUTPUT_PATH_LO1_LO2)) { +#ifdef DSP_MEM_STATIC +#else + vfree(param); +#endif + goto exit; + } + err = add_dsp_prm(mc_asoc, DSP_PRM_VC_2MIC, + DSP_PRM_USER, param, size); + if (err != 0) + break; + if (incall_mic != MC_ASOC_INCALL_MIC_2MIC) + goto exit; + break; + default: + err = -EINVAL; + break; + } + if (err != 0) { + ; + goto error; + } + err = map_drv_error(_McDrv_Ctrl(MCDRV_SET_DSP, param, NULL, size)); +exit: + return err; +error: +#ifdef DSP_MEM_STATIC +#else + vfree(param); +#endif + return err; +} + +static int mc_asoc_write_reg( + struct snd_soc_codec *codec, + unsigned int reg, + unsigned int value) +{ + int err = 0; + struct mc_asoc_data *mc_asoc = NULL; + + /* TRACE_FUNC(); */ + + /* dbg_info("reg=%d, value=%04Xh\n", reg, value); */ + + if (codec == NULL) + return -EINVAL; + + mc_asoc = mc_asoc_get_mc_asoc(codec); + if (mc_asoc == NULL) + return -EINVAL; + + mc_asoc_lock("mc_asoc_write_reg"); + + if (reg <= MC_ASOC_N_VOL_REG) { + switch (reg) { + case MC_ASOC_DVOL_MUSICIN: + case MC_ASOC_DVOL_EXTIN: + case MC_ASOC_DVOL_VOICEIN: + case MC_ASOC_DVOL_REFIN: + case MC_ASOC_DVOL_ADIF0IN: + case MC_ASOC_DVOL_ADIF1IN: + case MC_ASOC_DVOL_ADIF2IN: + case MC_ASOC_DVOL_MUSICOUT: + case MC_ASOC_DVOL_EXTOUT: + case MC_ASOC_DVOL_VOICEOUT: + case MC_ASOC_DVOL_REFOUT: + case MC_ASOC_DVOL_DAC0OUT: + case MC_ASOC_DVOL_DAC1OUT: + case MC_ASOC_DVOL_DPATHDA: + case MC_ASOC_DVOL_DPATHAD: + case MC_ASOC_DVOL_APLAY_D: + if ((((value>>8)&0x7F) > 114) + || ((value&0x7F) > 114)) { + dbg_info("reg=%d, value=%04Xh\n", reg, value); + err = -EINVAL; + } + break; + case MC_ASOC_AVOL_LINEIN1: + case MC_ASOC_AVOL_MIC1: + case MC_ASOC_AVOL_MIC2: + case MC_ASOC_AVOL_MIC3: + case MC_ASOC_AVOL_MIC4: + case MC_ASOC_DVOL_APLAY_A: + if ((((value>>8)&0x7F) > 63) + || ((value&0x7F) > 63)) { + dbg_info("reg=%d, value=%04Xh\n", reg, value); + err = -EINVAL; + } + break; + case MC_ASOC_AVOL_HP: + if ((((value>>8)&0x7F) > 127) + || ((value&0x7F) > 127)) { + dbg_info("reg=%d, value=%04Xh\n", reg, value); + err = -EINVAL; + } + break; + case MC_ASOC_AVOL_SP: + if ((((value>>8)&0x7F) > 127) + || ((value&0x7F) > 127)) { + dbg_info("reg=%d, value=%04Xh\n", reg, value); + err = -EINVAL; + } + break; + case MC_ASOC_AVOL_RC: + if ((((value>>8)&0x7F) > 111) + || ((value&0x7F) > 111)) { + dbg_info("reg=%d, value=%04Xh\n", reg, value); + err = -EINVAL; + } + break; + case MC_ASOC_AVOL_LINEOUT1: + case MC_ASOC_AVOL_LINEOUT2: + if ((((value>>8)&0x7F) > 119) + || ((value&0x7F) > 119)) { + dbg_info("reg=%d, value=%04Xh\n", reg, value); + err = -EINVAL; + } + break; + case MC_ASOC_AVOL_SP_GAIN: + if ((((value>>8)&0x7F) > 4) + || ((value&0x7F) > 4)) { + dbg_info("reg=%d, value=%04Xh\n", reg, value); + err = -EINVAL; + } + break; + case MC_ASOC_DVOL_MASTER: + case MC_ASOC_DVOL_VOICE: + if ((((value>>8)&0x7F) > 75) + || ((value&0x7F) > 75)) { + dbg_info("reg=%d, value=%04Xh\n", reg, value); + err = -EINVAL; + } + break; + case MC_ASOC_VOICE_RECORDING: + if ((value&0x7F) > 1) { + dbg_info("reg=%d, value=%04Xh\n", reg, value); + err = -EINVAL; + } + break; + } + if (err == 0) { + ; + err = write_reg_vol(codec, reg, value); + } + } else { + switch (reg) { + case MC_ASOC_AUDIO_MODE_PLAY: + err = set_audio_mode_play(codec, value); + break; + case MC_ASOC_AUDIO_MODE_CAP: + err = set_audio_mode_cap(codec, value); + break; + case MC_ASOC_OUTPUT_PATH: + err = write_cache(codec, reg, value); + break; + case MC_ASOC_INPUT_PATH: + err = write_cache(codec, reg, value); + break; + case MC_ASOC_INCALL_MIC_SP: + case MC_ASOC_INCALL_MIC_RC: + case MC_ASOC_INCALL_MIC_HP: + case MC_ASOC_INCALL_MIC_LO1: + case MC_ASOC_INCALL_MIC_LO2: + err = set_incall_mic(codec, reg, value); + break; + case MC_ASOC_MAINMIC_PLAYBACK_PATH: + case MC_ASOC_SUBMIC_PLAYBACK_PATH: + case MC_ASOC_2MIC_PLAYBACK_PATH: + case MC_ASOC_HSMIC_PLAYBACK_PATH: + case MC_ASOC_BTMIC_PLAYBACK_PATH: + case MC_ASOC_LIN1_PLAYBACK_PATH: + err = set_ain_playback(codec, reg, value); + break; + case MC_ASOC_PARAMETER_SETTING: + break; + case MC_ASOC_DTMF_CONTROL: + err = set_dtmf_control(codec, reg, value); + break; + case MC_ASOC_DTMF_OUTPUT: + err = set_dtmf_output(codec, reg, value); + break; + case MC_ASOC_SWITCH_CLOCK: + err = set_switch_clock(codec, reg, value); + break; + case MC_ASOC_EXT_MASTERSLAVE: + if (CAPTURE_PORT != CAPTURE_PORT_EXT) + err = set_masterslave(codec, reg, value, + PORT_EXT); + break; + case MC_ASOC_EXT_RATE: + if (CAPTURE_PORT != CAPTURE_PORT_EXT) + err = set_rate(codec, reg, value, + PORT_EXT); + break; + case MC_ASOC_EXT_BITCLOCK_RATE: + if (CAPTURE_PORT != CAPTURE_PORT_EXT) + err = set_bitclock_rate(codec, reg, value, + PORT_EXT); + break; + case MC_ASOC_EXT_INTERFACE: + if (CAPTURE_PORT != CAPTURE_PORT_EXT) + err = set_interface(codec, reg, value, + PORT_EXT); + break; + case MC_ASOC_EXT_BITCLOCK_INVERT: + if (CAPTURE_PORT != CAPTURE_PORT_EXT) + err = set_bitclock_invert(codec, reg, + value, PORT_EXT); + break; + case MC_ASOC_EXT_INPUT_DA_BIT_WIDTH: + if (CAPTURE_PORT != CAPTURE_PORT_EXT) + err = set_da_bit_width(codec, reg, value, + PORT_EXT, 0); + break; + case MC_ASOC_EXT_INPUT_DA_FORMAT: + if (CAPTURE_PORT != CAPTURE_PORT_EXT) + err = set_da_format(codec, reg, value, + PORT_EXT, 0); + break; + case MC_ASOC_EXT_INPUT_PCM_MONOSTEREO: + if (CAPTURE_PORT != CAPTURE_PORT_EXT) + err = set_pcm_monostereo(codec, reg, value, + PORT_EXT, 0); + break; + case MC_ASOC_EXT_INPUT_PCM_BIT_ORDER: + if (CAPTURE_PORT != CAPTURE_PORT_EXT) + err = set_pcm_bit_order(codec, reg, value, + PORT_EXT, 0); + break; + case MC_ASOC_EXT_INPUT_PCM_FORMAT: + if (CAPTURE_PORT != CAPTURE_PORT_EXT) + err = set_pcm_format(codec, reg, value, + PORT_EXT, 0); + break; + case MC_ASOC_EXT_INPUT_PCM_BIT_WIDTH: + if (CAPTURE_PORT != CAPTURE_PORT_EXT) + err = set_pcm_bit_width(codec, reg, value, + PORT_EXT, 0); + break; + case MC_ASOC_EXT_OUTPUT_DA_BIT_WIDTH: + if (CAPTURE_PORT != CAPTURE_PORT_EXT) + err = set_da_bit_width(codec, reg, value, + PORT_EXT, 1); + break; + case MC_ASOC_EXT_OUTPUT_DA_FORMAT: + if (CAPTURE_PORT != CAPTURE_PORT_EXT) + err = set_da_format(codec, reg, value, + PORT_EXT, 1); + break; + case MC_ASOC_EXT_OUTPUT_PCM_MONOSTEREO: + if (CAPTURE_PORT != CAPTURE_PORT_EXT) + err = set_pcm_monostereo(codec, reg, value, + PORT_EXT, 1); + break; + case MC_ASOC_EXT_OUTPUT_PCM_BIT_ORDER: + if (CAPTURE_PORT != CAPTURE_PORT_EXT) + err = set_pcm_bit_order(codec, reg, value, + PORT_EXT, 1); + break; + case MC_ASOC_EXT_OUTPUT_PCM_FORMAT: + if (CAPTURE_PORT != CAPTURE_PORT_EXT) + err = set_pcm_format(codec, reg, value, + PORT_EXT, 1); + break; + case MC_ASOC_EXT_OUTPUT_PCM_BIT_WIDTH: + if (CAPTURE_PORT != CAPTURE_PORT_EXT) + err = set_pcm_bit_width(codec, reg, value, + PORT_EXT, 1); + break; + case MC_ASOC_VOICE_MASTERSLAVE: + err = set_masterslave(codec, reg, value, + PORT_VOICE); + break; + case MC_ASOC_VOICE_RATE: + err = set_rate(codec, reg, value, PORT_VOICE); + break; + case MC_ASOC_VOICE_BITCLOCK_RATE: + err = set_bitclock_rate(codec, reg, value, + PORT_VOICE); + break; + case MC_ASOC_VOICE_INTERFACE: + err = set_interface(codec, reg, value, PORT_VOICE); + break; + case MC_ASOC_VOICE_BITCLOCK_INVERT: + err = set_bitclock_invert(codec, reg, value, + PORT_VOICE); + break; + case MC_ASOC_VOICE_INPUT_DA_BIT_WIDTH: + err = set_da_bit_width(codec, reg, value, + PORT_VOICE, 0); + break; + case MC_ASOC_VOICE_INPUT_DA_FORMAT: + err = set_da_format(codec, reg, value, + PORT_VOICE, 0); + break; + case MC_ASOC_VOICE_INPUT_PCM_MONOSTEREO: + err = set_pcm_monostereo(codec, reg, value, + PORT_VOICE, 0); + break; + case MC_ASOC_VOICE_INPUT_PCM_BIT_ORDER: + err = set_pcm_bit_order(codec, reg, value, + PORT_VOICE, 0); + break; + case MC_ASOC_VOICE_INPUT_PCM_FORMAT: + err = set_pcm_format(codec, reg, value, + PORT_VOICE, 0); + break; + case MC_ASOC_VOICE_INPUT_PCM_BIT_WIDTH: + err = set_pcm_bit_width(codec, reg, value, + PORT_VOICE, 0); + break; + case MC_ASOC_VOICE_OUTPUT_DA_BIT_WIDTH: + err = set_da_bit_width(codec, reg, value, + PORT_VOICE, 1); + break; + case MC_ASOC_VOICE_OUTPUT_DA_FORMAT: + err = set_da_format(codec, reg, value, + PORT_VOICE, 1); + break; + case MC_ASOC_VOICE_OUTPUT_PCM_MONOSTEREO: + err = set_pcm_monostereo(codec, reg, value, + PORT_VOICE, 1); + break; + case MC_ASOC_VOICE_OUTPUT_PCM_BIT_ORDER: + err = set_pcm_bit_order(codec, reg, value, + PORT_VOICE, 1); + break; + case MC_ASOC_VOICE_OUTPUT_PCM_FORMAT: + err = set_pcm_format(codec, reg, value, + PORT_VOICE, 1); + break; + case MC_ASOC_VOICE_OUTPUT_PCM_BIT_WIDTH: + err = set_pcm_bit_width(codec, reg, value, + PORT_VOICE, 1); + break; + case MC_ASOC_MUSIC_PHYSICAL_PORT: + err = set_phys_port(codec, reg, value, PORT_MUSIC); + break; + case MC_ASOC_EXT_PHYSICAL_PORT: + err = set_phys_port(codec, reg, value, PORT_EXT); + break; + case MC_ASOC_VOICE_PHYSICAL_PORT: + err = set_phys_port(codec, reg, value, PORT_VOICE); + break; + case MC_ASOC_HIFI_PHYSICAL_PORT: + err = set_phys_port(codec, reg, value, PORT_HIFI); + break; + case MC_ASOC_ADIF0_SWAP: + err = set_swap(codec, reg, value, + offsetof(struct MCDRV_SWAP_INFO, bAdif0), + MCDRV_SWAP_ADIF0_UPDATE_FLAG); + break; + case MC_ASOC_ADIF1_SWAP: + err = set_swap(codec, reg, value, + offsetof(struct MCDRV_SWAP_INFO, bAdif1), + MCDRV_SWAP_ADIF1_UPDATE_FLAG); + break; + case MC_ASOC_ADIF2_SWAP: + err = set_swap(codec, reg, value, + offsetof(struct MCDRV_SWAP_INFO, bAdif2), + MCDRV_SWAP_ADIF2_UPDATE_FLAG); + break; + case MC_ASOC_DAC0_SWAP: + err = set_swap(codec, reg, value, + offsetof(struct MCDRV_SWAP_INFO, bDac0), + MCDRV_SWAP_DAC0_UPDATE_FLAG); + break; + case MC_ASOC_DAC1_SWAP: + err = set_swap(codec, reg, value, + offsetof(struct MCDRV_SWAP_INFO, bDac1), + MCDRV_SWAP_DAC1_UPDATE_FLAG); + break; + case MC_ASOC_MUSIC_OUT0_SWAP: + err = set_swap(codec, reg, value, + offsetof(struct MCDRV_SWAP_INFO, bMusicOut0), + MCDRV_SWAP_MUSICOUT0_UPDATE_FLAG); + break; + case MC_ASOC_MUSIC_IN0_SWAP: + err = set_swap(codec, reg, value, + offsetof(struct MCDRV_SWAP_INFO, bMusicIn0), + MCDRV_SWAP_MUSICIN0_UPDATE_FLAG); + break; + case MC_ASOC_MUSIC_IN1_SWAP: + err = set_swap(codec, reg, value, + offsetof(struct MCDRV_SWAP_INFO, bMusicIn1), + MCDRV_SWAP_MUSICIN1_UPDATE_FLAG); + break; + case MC_ASOC_MUSIC_IN2_SWAP: + err = set_swap(codec, reg, value, + offsetof(struct MCDRV_SWAP_INFO, bMusicIn2), + MCDRV_SWAP_MUSICIN2_UPDATE_FLAG); + break; + case MC_ASOC_EXT_IN_SWAP: + err = set_swap(codec, reg, value, + offsetof(struct MCDRV_SWAP_INFO, bExtIn), + MCDRV_SWAP_EXTIN_UPDATE_FLAG); + break; + case MC_ASOC_VOICE_IN_SWAP: + err = set_swap(codec, reg, value, + offsetof(struct MCDRV_SWAP_INFO, bVoiceIn), + MCDRV_SWAP_VOICEIN_UPDATE_FLAG); + break; + case MC_ASOC_MUSIC_OUT1_SWAP: + err = set_swap(codec, reg, value, + offsetof(struct MCDRV_SWAP_INFO, bMusicOut1), + MCDRV_SWAP_MUSICOUT1_UPDATE_FLAG); + break; + case MC_ASOC_MUSIC_OUT2_SWAP: + err = set_swap(codec, reg, value, + offsetof(struct MCDRV_SWAP_INFO, bMusicOut2), + MCDRV_SWAP_MUSICOUT2_UPDATE_FLAG); + break; + case MC_ASOC_EXT_OUT_SWAP: + err = set_swap(codec, reg, value, + offsetof(struct MCDRV_SWAP_INFO, bExtOut), + MCDRV_SWAP_EXTOUT_UPDATE_FLAG); + break; + case MC_ASOC_VOICE_OUT_SWAP: + err = set_swap(codec, reg, value, + offsetof(struct MCDRV_SWAP_INFO, bVoiceOut), + MCDRV_SWAP_VOICEOUT_UPDATE_FLAG); + break; + case MC_ASOC_ADIF0_SOURCE: + case MC_ASOC_ADIF1_SOURCE: + case MC_ASOC_ADIF2_SOURCE: + err = write_cache(codec, reg, value); + if (err < 0) + break; + err = connect_path(codec); + break; + case MC_ASOC_DSP_PARAM: + { + char *param = NULL; + UINT32 size; + UINT16 option; + + if (value >= ARRAY_SIZE(firmware_name)) { + err = -EINVAL; + break; + } + size = load_file(firmware_name[value], ¶m); + dbg_info("file:%s\n", firmware_name[value]); + dbg_info("size:%ld\n", size); + dbg_info("param:%p", param); + if (size < 0) { + break; + } else { +#if 0 + int i; + char tmp[20], str[256]; + tmp[0] = str[0] = 0; + strcat(str, "read data:\n"); + for (i = 0; i < size; i++) { + sprintf(tmp, " %02X", param[i]); + strcat(str, tmp); + if ((i%16) == 15) { + pr_info("%s", str); + str[0] = 0; + } + } + strcat(str, "\n"); + pr_info("%s", str); +#endif + } + + option = read_cache(codec, MC_ASOC_DSP_PARAM_OPT); + err = set_dsp(codec, param, size, option); + } + break; + case MC_ASOC_DSP_PARAM_OPT: + switch (value) { + case YMC_DSP_OUTPUT_BASE: + case YMC_DSP_OUTPUT_SP: + case YMC_DSP_OUTPUT_RC: + case YMC_DSP_OUTPUT_HP: + case YMC_DSP_OUTPUT_LO1: + case YMC_DSP_OUTPUT_LO2: + case YMC_DSP_OUTPUT_BT: + case YMC_DSP_INPUT_BASE: + case YMC_DSP_INPUT_MAINMIC: + case YMC_DSP_INPUT_SUBMIC: + case YMC_DSP_INPUT_2MIC: + case YMC_DSP_INPUT_HEADSET: + case YMC_DSP_INPUT_BT: + case YMC_DSP_INPUT_LINEIN1: + case YMC_DSP_INPUT_LINEIN2: + case YMC_DSP_VOICECALL_BASE_1MIC: + case YMC_DSP_VOICECALL_BASE_2MIC: + case YMC_DSP_VOICECALL_SP_1MIC: + case YMC_DSP_VOICECALL_SP_2MIC: + case YMC_DSP_VOICECALL_RC_1MIC: + case YMC_DSP_VOICECALL_RC_2MIC: + case YMC_DSP_VOICECALL_HP_1MIC: + case YMC_DSP_VOICECALL_HP_2MIC: + case YMC_DSP_VOICECALL_LO1_1MIC: + case YMC_DSP_VOICECALL_LO1_2MIC: + case YMC_DSP_VOICECALL_LO2_1MIC: + case YMC_DSP_VOICECALL_LO2_2MIC: + case YMC_DSP_VOICECALL_HEADSET: + case YMC_DSP_VOICECALL_BT: + case YMC_DSP_VOICECALL_BASE_COMMON: + write_cache(codec, reg, value); + break; + default: + err = -EINVAL; + break; + } + break; + case MC_ASOC_PLAYBACK_SCENARIO: + case MC_ASOC_CAPTURE_SCENARIO: + write_cache(codec, reg, value); + break; + case MC_ASOC_CLEAR_DSP_PARAM: + del_dsp_prm(mc_asoc); + break; + case MC_ASOC_MAIN_MIC: + mc_asoc_main_mic = value; + write_cache(codec, reg, value); + break; + case MC_ASOC_SUB_MIC: + mc_asoc_sub_mic = value; + write_cache(codec, reg, value); + break; + case MC_ASOC_HS_MIC: + mc_asoc_hs_mic = value; + write_cache(codec, reg, value); + break; +#ifdef MC_ASOC_TEST + case MC_ASOC_MIC1_BIAS: + mc_asoc_mic1_bias = value; + write_cache(codec, reg, value); + err = connect_path(codec); + break; + case MC_ASOC_MIC2_BIAS: + mc_asoc_mic2_bias = value; + write_cache(codec, reg, value); + err = connect_path(codec); + break; + case MC_ASOC_MIC3_BIAS: + mc_asoc_mic3_bias = value; + write_cache(codec, reg, value); + err = connect_path(codec); + break; + case MC_ASOC_MIC4_BIAS: + mc_asoc_mic4_bias = value; + write_cache(codec, reg, value); + err = connect_path(codec); + break; +#endif + + default: + err = -EINVAL; + break; + } + } + + if (err < 0) + dbg_info("err=%d\n", err); + + mc_asoc_unlock("mc_asoc_write_reg"); + return err; +} + +static unsigned int mc_asoc_read_reg( + struct snd_soc_codec *codec, + unsigned int reg) +{ + int ret; +/* + TRACE_FUNC(); + + dbg_info("reg=%d\n", reg); +*/ + mc_asoc_lock("mc_asoc_read_reg"); + if (codec == NULL) { + ret = -EINVAL; + goto exit; + } + ret = read_cache(codec, reg); + if (ret < 0) + ret = -EIO; +exit: + mc_asoc_unlock("mc_asoc_read_reg"); + return (unsigned int)ret; +} + +/* + * Same as snd_soc_add_controls supported in alsa-driver 1.0.19 or later. + * This function is implimented for compatibility with linux 2.6.29. + */ +static int mc_asoc_add_controls( + struct snd_soc_codec *codec, + const struct snd_kcontrol_new *controls, + int n) +{ + return snd_soc_add_codec_controls(codec, controls, n); +} + +static const struct snd_soc_dapm_widget mc_asoc_widgets[] = { + /* DACs */ + SND_SOC_DAPM_DAC("DAC DUMMY", "DAC Playback", SND_SOC_NOPM, 0, 0), + /* ADCs */ + SND_SOC_DAPM_ADC("ADC DUMMY", "ADC Capture", SND_SOC_NOPM, 0, 0), + + SND_SOC_DAPM_INPUT("INPUT DUMMY"), + SND_SOC_DAPM_OUTPUT("OUTPUT DUMMY"), +}; + +static const struct snd_soc_dapm_widget mc_asoc_widgets_Headset[] = { + SND_SOC_DAPM_OUTPUT("HPOUTL"), + SND_SOC_DAPM_OUTPUT("HPOUTR"), + SND_SOC_DAPM_INPUT("AMIC1"), + /* Headset Control */ + SND_SOC_DAPM_MIC("Mic Jack", NULL), + SND_SOC_DAPM_HP("Headphone Jack", NULL), +}; + +static const struct snd_soc_dapm_route mc_asoc_intercon[] = { + {"OUTPUT DUMMY", NULL, "DAC DUMMY"}, + {"ADC DUMMY", NULL, "INPUT DUMMY"} +}; + +static const struct snd_soc_dapm_route mc_asoc_intercon_Headset[] = { + {"Headphone Jack", NULL, "HPOUTL"}, + {"Headphone Jack", NULL, "HPOUTR"}, + {"Mic Jack", NULL, "AMIC1"}, +}; + +static int mc_asoc_add_widgets(struct snd_soc_codec *codec) +{ + int err; + + if (codec == NULL) + return -EINVAL; + + err = snd_soc_dapm_new_controls(&codec->dapm, + mc_asoc_widgets, + ARRAY_SIZE(mc_asoc_widgets)); + if (err < 0) + return err; + + err = snd_soc_dapm_add_routes(&codec->dapm, + mc_asoc_intercon, + ARRAY_SIZE(mc_asoc_intercon)); + if (err < 0) + return err; + + err = snd_soc_dapm_new_controls(&codec->dapm, + mc_asoc_widgets_Headset, + ARRAY_SIZE(mc_asoc_widgets_Headset)); + if (err < 0) + return err; + + err = snd_soc_dapm_add_routes(&codec->dapm, + mc_asoc_intercon_Headset, + ARRAY_SIZE(mc_asoc_intercon_Headset)); + if (err < 0) + return err; + + err = snd_soc_dapm_new_widgets(&codec->dapm); + if (err < 0) + return err; + return 0; +} + +/* + * Hwdep interface + */ +static int mc_asoc_hwdep_open(struct snd_hwdep *hw, struct file *file) +{ + /* Nothing to do */ + mc_asoc_lock("mc_asoc_hwdep_open"); + mc_asoc_unlock("mc_asoc_hwdep_open"); + return 0; +} + +static int mc_asoc_hwdep_release(struct snd_hwdep *hw, struct file *file) +{ + /* Nothing to do */ + mc_asoc_lock("mc_asoc_hwdep_release"); + mc_asoc_unlock("mc_asoc_hwdep_release"); + return 0; +} + +static int hwdep_ioctl_read_reg(struct MCDRV_REG_INFO *args) +{ + int err; + struct MCDRV_REG_INFO reg_info; + + if (!access_ok(VERIFY_WRITE, args, sizeof(struct MCDRV_REG_INFO))) + return -EFAULT; + if (copy_from_user(®_info, args, sizeof(struct MCDRV_REG_INFO)) + != 0) + return -EFAULT; + + err = _McDrv_Ctrl(MCDRV_READ_REG, ®_info, NULL, 0); + if (err != MCDRV_SUCCESS) + return map_drv_error(err); + else if (copy_to_user(args, ®_info, sizeof(struct MCDRV_REG_INFO)) + != 0) + err = -EFAULT; + + return 0; +} + +static int hwdep_ioctl_write_reg(const struct MCDRV_REG_INFO *args) +{ + int err; + struct MCDRV_REG_INFO reg_info; + + if (!access_ok(VERIFY_READ, args, sizeof(struct MCDRV_REG_INFO))) + return -EFAULT; + + if (copy_from_user(®_info, args, sizeof(struct MCDRV_REG_INFO)) + != 0) + return -EFAULT; + + err = _McDrv_Ctrl(MCDRV_WRITE_REG, ®_info, NULL, 0); + if (err != MCDRV_SUCCESS) + return map_drv_error(err); + return 0; +} + +static int hwdep_ioctl_get_dsp_data(struct ymc_dspdata_args *args) +{ + int ret = 0; + struct ymc_dspdata_args ymc_dspdata; + UINT8 *param = NULL; + + if (!access_ok(VERIFY_WRITE, args, sizeof(struct ymc_dspdata_args))) + return -EFAULT; + + if (copy_from_user(&ymc_dspdata, args, sizeof(struct ymc_dspdata_args)) + != 0) + return -EFAULT; + if (ymc_dspdata.bufsize == 0) + return 0; + + if (MAX_YMS_CTRL_PARAM_SIZE < ymc_dspdata.bufsize) + return -ENOMEM; + + param = kzalloc(ymc_dspdata.bufsize, GFP_KERNEL); + if (param == NULL) + return -ENOMEM; + + ret = _McDrv_Ctrl(MCDRV_GET_DSP_DATA, param, NULL, + ymc_dspdata.bufsize); + if (ret < MCDRV_SUCCESS) { + ret = map_drv_error(ret); + goto EXIT; + } + + ymc_dspdata.size = ret; + if (copy_to_user(args, &ymc_dspdata, + sizeof(struct ymc_dspdata_args)) != 0) { + ret = -EFAULT; + goto EXIT; + } + if (copy_to_user(args->buf, param, ymc_dspdata.size) != 0) { + ret = -EFAULT; + goto EXIT; + } +EXIT: + if (param != NULL) + kfree(param); + return ret; +} + +static int hwdep_ioctl_set_dsp_data(struct ymc_dspdata_args *args) +{ + int ret = 0; + struct ymc_dspdata_args ymc_dspdata; + UINT8 *param = NULL; + + if (!access_ok(VERIFY_WRITE, args, sizeof(struct ymc_dspdata_args))) + return -EFAULT; + + if (copy_from_user(&ymc_dspdata, args, sizeof(struct ymc_dspdata_args)) + != 0) + return -EFAULT; + + if (ymc_dspdata.bufsize == 0) + return 0; + + if (MAX_YMS_CTRL_PARAM_SIZE < ymc_dspdata.bufsize) + return -ENOMEM; + + param = kzalloc(ymc_dspdata.bufsize, GFP_KERNEL); + if (param == NULL) + return -ENOMEM; + if (copy_from_user(param, ymc_dspdata.buf, ymc_dspdata.bufsize) != 0) { + ret = EFAULT; + goto EXIT; + } + + ret = _McDrv_Ctrl(MCDRV_SET_DSP_DATA, param, NULL, + ymc_dspdata.bufsize); + if (ret < MCDRV_SUCCESS) { + ret = map_drv_error(ret); + goto EXIT; + } + ymc_dspdata.size = ret; + if (copy_to_user(args, &ymc_dspdata, + sizeof(struct ymc_dspdata_args)) != 0) { + ret = -EFAULT; + goto EXIT; + } +EXIT: + if (param != NULL) + kfree(param); + return ret; +} + +static int mc_asoc_hwdep_ioctl( + struct snd_hwdep *hw, + struct file *file, + unsigned int cmd, + unsigned long arg) +{ + int err = 0; + UINT8 *param = NULL; + struct snd_soc_codec *codec = NULL; + struct ymc_ctrl_args ymc_ctrl_arg; + UINT32 hold; + + if (hw != NULL) + codec = hw->private_data; + + mc_asoc_lock("mc_asoc_hwdep_ioctl"); + + switch (cmd) { + case YMC_IOCTL_SET_CTRL: + if (!access_ok(VERIFY_READ, + (struct ymc_ctrl_args *)arg, + sizeof(struct ymc_ctrl_args))) { + err = -EFAULT; + break; + } + if (copy_from_user(&ymc_ctrl_arg, + (struct ymc_ctrl_args *)arg, + sizeof(struct ymc_ctrl_args)) != 0) { + err = -EFAULT; + break; + } + if (ymc_ctrl_arg.size == 0) + break; + if (MAX_YMS_CTRL_PARAM_SIZE < ymc_ctrl_arg.size) { + err = -ENOMEM; + break; + } + + param = get_dsp_mem(ymc_ctrl_arg.size); + if (param == NULL) { + err = -ENOMEM; + break; + } + if (copy_from_user(param, ymc_ctrl_arg.param, + ymc_ctrl_arg.size) != 0) { +#ifdef DSP_MEM_STATIC +#else + vfree(param); +#endif + err = -EFAULT; + break; + } + err = set_dsp(codec, param, ymc_ctrl_arg.size, + ymc_ctrl_arg.option); + break; + + case YMC_IOCTL_READ_REG: + err = hwdep_ioctl_read_reg((struct MCDRV_REG_INFO *)arg); + dbg_info("err=%d, RegType=%d, Addr=%d, Data=0x%02X\n", + err, + ((struct MCDRV_REG_INFO *)arg)->bRegType, + ((struct MCDRV_REG_INFO *)arg)->bAddress, + ((struct MCDRV_REG_INFO *)arg)->bData); + break; + + case YMC_IOCTL_WRITE_REG: + err = hwdep_ioctl_write_reg((struct MCDRV_REG_INFO *)arg); + dbg_info("err=%d, RegType=%d, Addr=%d, Data=0x%02X\n", + err, + ((struct MCDRV_REG_INFO *)arg)->bRegType, + ((struct MCDRV_REG_INFO *)arg)->bAddress, + ((struct MCDRV_REG_INFO *)arg)->bData); + break; + + case YMC_IOCTL_NOTIFY_HOLD: + if (!access_ok(VERIFY_READ, (UINT32 *)arg, sizeof(UINT32))) { + err = -EFAULT; + break; + } + if (copy_from_user(&hold, (UINT32 *)arg, sizeof(UINT32)) != 0 + ) { + err = -EFAULT; + break; + } + dbg_info("hold=%ld\n", hold); + switch (hold) { + case YMC_NOTITY_HOLD_OFF: + mc_asoc_hold = (UINT8)hold; + err = connect_path(codec); + if (err == 0) + auto_powerdown(codec); + break; + case YMC_NOTITY_HOLD_ON: + mc_asoc_hold = (UINT8)hold; + break; + default: + err = -EINVAL; + break; + } + break; + + case YMC_IOCTL_GET_DSP_DATA: + err = hwdep_ioctl_get_dsp_data( + (struct ymc_dspdata_args *)arg); + break; + case YMC_IOCTL_SET_DSP_DATA: + err = hwdep_ioctl_set_dsp_data( + (struct ymc_dspdata_args *)arg); + break; + default: + err = -EINVAL; + } + + mc_asoc_unlock("mc_asoc_hwdep_ioctl"); + return err; +} + +static int mc_asoc_add_hwdep(struct snd_soc_codec *codec) +{ + struct snd_hwdep *hw; + struct mc_asoc_data *mc_asoc = NULL; + int err; + + mc_asoc = mc_asoc_get_mc_asoc(codec); + if (mc_asoc == NULL) + return -EINVAL; + + err = snd_hwdep_new((struct snd_card *)codec->card->snd_card, + MC_ASOC_HWDEP_ID, 0, &hw); + if (err < 0) + return err; + + hw->iface = SNDRV_HWDEP_IFACE_YAMAHA_YMU831; + hw->private_data = codec; + hw->ops.open = mc_asoc_hwdep_open; + hw->ops.release = mc_asoc_hwdep_release; + hw->ops.ioctl = mc_asoc_hwdep_ioctl; + hw->exclusive = 1; + strcpy(hw->name, MC_ASOC_HWDEP_ID); + mc_asoc->hwdep = hw; + + return 0; +} + +#ifdef CONFIG_SWITCH +#define SW_DRV +#endif +static struct input_dev *inp_dev; +#ifdef SW_DRV +static struct switch_dev *h2w_sdev; +static ssize_t headset_print_name(struct switch_dev *sdev, char *buf) +{ + switch (switch_get_state(sdev)) { + case 0: + return sprintf(buf, "No Device\n"); + case 1: + return sprintf(buf, "Headset\n"); + case 2: + return sprintf(buf, "Headphone\n"); + } + return -EINVAL; +} +#endif /* SW_DRV */ + +static struct snd_soc_jack hs_jack; +static struct snd_soc_jack_pin hs_jack_pins[] = { + { + .pin = "Mic Jack", + .mask = SND_JACK_MICROPHONE, + }, + { + .pin = "Headphone Jack", + .mask = SND_JACK_HEADPHONE, + }, +}; + +static struct workqueue_struct *workq_mb4; +static struct delayed_work delayed_work_mb4; + +static void work_mb4(struct work_struct *work) +{ + TRACE_FUNC(); + + mc_asoc_lock("work_mb4"); + mc_asoc_MBSEL4 = 0x00; + connect_path(mc_asoc_codec); + mc_asoc_unlock("work_mb4"); +} + +static struct workqueue_struct *workq_mkdeten; +static struct delayed_work delayed_work_mkdeten; +#ifdef MICOPEN_4POLE +static UINT8 mc_asoc_MICDET; +#endif + +static void work_mkdeten(struct work_struct *work) +{ + int err; + UINT8 jack_status = mc_asoc_jack_status; + struct MCDRV_HSDET_INFO stHSDetInfo; +#ifdef MICOPEN_4POLE + struct MCDRV_REG_INFO reg_info; +#endif + + TRACE_FUNC(); + + if (mc_asoc_jack_status == SND_JACK_HEADSET) { + dbg_info("skip mkdeten\n"); + return; + } + + mutex_lock(&hsdet_mutex); + mc_asoc_lock("work_mkdeten"); + +#ifdef MICOPEN_4POLE + reg_info.bRegType = MCDRV_REGTYPE_CD; + reg_info.bAddress = MCI_MICDET; + err = _McDrv_Ctrl(MCDRV_READ_REG, ®_info, NULL, 0); + if (err != MCDRV_SUCCESS) + reg_info.bData = 1; + if (((reg_info.bData&0x47) == 0) + && ((reg_info.bData&0x47) == mc_asoc_MICDET) + && ((mc_asoc_hpimpclass < MC_ASOC_IMPCLASS_THRESHOLD) + || (mc_asoc_hpimpclass == 5) + || (mc_asoc_hpimpclass == 6))) { + dbg_info("MICDET\n"); + mc_asoc_jack_status = SND_JACK_HEADSET; +#ifdef SW_DRV + switch_set_state(h2w_sdev, 0); + switch_set_state(h2w_sdev, 1); +#endif + dbg_info("queue_delayed_work_mb4\n"); + queue_delayed_work(workq_mb4, &delayed_work_mb4, + msecs_to_jiffies(MSDETMB4OFF)); + } else { +#endif + err = _McDrv_Ctrl(MCDRV_GET_HSDET, (void *)&stHSDetInfo, + NULL, 0); + if (err == MCDRV_SUCCESS) { + stHSDetInfo.bEnMicDet = MCDRV_MICDET_DISABLE; + stHSDetInfo.bEnDlyKeyOff = MCDRV_KEYEN_D_D_D; + stHSDetInfo.bEnDlyKeyOn = MCDRV_KEYEN_D_D_D; + stHSDetInfo.bEnKeyOff = MCDRV_KEYEN_D_D_D; + stHSDetInfo.bEnKeyOn = MCDRV_KEYEN_D_D_D; + err = _McDrv_Ctrl(MCDRV_SET_HSDET, + (void *)&stHSDetInfo, NULL, 0x7C); + } + if (err < MCDRV_SUCCESS) { + ; + dbg_info("%d: Error in work_mkdeten\n", err); + } + connect_path(mc_asoc_codec); +#ifdef MICOPEN_4POLE + } +#endif + + mc_asoc_unlock("work_mkdeten"); + if (jack_status != mc_asoc_jack_status) { + if (mc_asoc_jack_status != 0) { + ; + snd_soc_jack_report(&hs_jack, 0, SND_JACK_HEADSET); + } + snd_soc_jack_report(&hs_jack, + mc_asoc_jack_status, SND_JACK_HEADSET); + } + mutex_unlock(&hsdet_mutex); +} + +static void hsdet_cb(UINT32 dFlags, struct MCDRV_HSDET_RES *psRes) +{ + struct MCDRV_HSDET_INFO stHSDetInfo; + int err; + UINT8 hpimpclass = mc_asoc_hpimpclass; + UINT8 bCurEnPlugDetDb; + UINT8 bEnPlugDetDb; + UINT8 bEnMicDet; + UINT8 bEnDlyKeyOff; + UINT8 bEnDlyKeyOn; + UINT8 bEnKeyOff; + UINT8 bEnKeyOn; + UINT8 bKey0OnDlyTim; + UINT8 bKey1OnDlyTim; + UINT8 bKey2OnDlyTim; + UINT8 bKey0OnDlyTim2; + UINT8 bKey1OnDlyTim2; + UINT8 bKey2OnDlyTim2; + UINT8 bHsDetDbnc, bDbncNumPlug; + UINT8 jack_status = mc_asoc_jack_status; + UINT32 jack_btn_on = 0, + jack_btn_off = 0, + jack_btn_stat = 0; + + TRACE_FUNC(); + + mutex_lock(&hsdet_mutex); + mc_asoc_lock("hsdet_cb"); + + dbg_info("dFlags=0x%08lX, bKeyCnt0=%d, bKeyCnt1=%d, bKeyCnt2=%d\n", + dFlags, + psRes->bKeyCnt0, psRes->bKeyCnt1, + psRes->bKeyCnt2); + +#ifdef HSDET_WHILE_SUSPEND + if (mc_asoc_suspended == 0) { + bEnPlugDetDb = stHSDetInfo_Default.bEnPlugDetDb; + bEnMicDet = stHSDetInfo_Default.bEnMicDet; + bEnDlyKeyOff = stHSDetInfo_Default.bEnDlyKeyOff; + bEnDlyKeyOn = stHSDetInfo_Default.bEnDlyKeyOn; + bEnKeyOff = stHSDetInfo_Default.bEnKeyOff; + bEnKeyOn = stHSDetInfo_Default.bEnKeyOn; + bKey0OnDlyTim = stHSDetInfo_Default.bKey0OnDlyTim; + bKey1OnDlyTim = stHSDetInfo_Default.bKey1OnDlyTim; + bKey2OnDlyTim = stHSDetInfo_Default.bKey2OnDlyTim; + bKey0OnDlyTim2 = stHSDetInfo_Default.bKey0OnDlyTim2; + bKey1OnDlyTim2 = stHSDetInfo_Default.bKey1OnDlyTim2; + bKey2OnDlyTim2 = stHSDetInfo_Default.bKey2OnDlyTim2; + bHsDetDbnc = stHSDetInfo_Default.bHsDetDbnc; + bDbncNumPlug = stHSDetInfo_Default.bDbncNumPlug; + } else { + bEnPlugDetDb = stHSDetInfo_Suspend.bEnPlugDetDb; + bEnMicDet = stHSDetInfo_Suspend.bEnMicDet; + bEnDlyKeyOff = stHSDetInfo_Suspend.bEnDlyKeyOff; + bEnDlyKeyOn = stHSDetInfo_Suspend.bEnDlyKeyOn; + bEnKeyOff = stHSDetInfo_Suspend.bEnKeyOff; + bEnKeyOn = stHSDetInfo_Suspend.bEnKeyOn; + bKey0OnDlyTim = stHSDetInfo_Suspend.bKey0OnDlyTim; + bKey1OnDlyTim = stHSDetInfo_Suspend.bKey1OnDlyTim; + bKey2OnDlyTim = stHSDetInfo_Suspend.bKey2OnDlyTim; + bKey0OnDlyTim2 = stHSDetInfo_Suspend.bKey0OnDlyTim2; + bKey1OnDlyTim2 = stHSDetInfo_Suspend.bKey1OnDlyTim2; + bKey2OnDlyTim2 = stHSDetInfo_Suspend.bKey2OnDlyTim2; + bHsDetDbnc = stHSDetInfo_Suspend.bHsDetDbnc; + bDbncNumPlug = stHSDetInfo_Suspend.bDbncNumPlug; + } +#else + bEnPlugDetDb = stHSDetInfo_Default.bEnPlugDetDb; + bEnMicDet = stHSDetInfo_Default.bEnMicDet; + bEnDlyKeyOff = stHSDetInfo_Default.bEnDlyKeyOff; + bEnDlyKeyOn = stHSDetInfo_Default.bEnDlyKeyOn; + bEnKeyOff = stHSDetInfo_Default.bEnKeyOff; + bEnKeyOn = stHSDetInfo_Default.bEnKeyOn; + bKey0OnDlyTim = stHSDetInfo_Default.bKey0OnDlyTim; + bKey1OnDlyTim = stHSDetInfo_Default.bKey1OnDlyTim; + bKey2OnDlyTim = stHSDetInfo_Default.bKey2OnDlyTim; + bKey0OnDlyTim2 = stHSDetInfo_Default.bKey0OnDlyTim2; + bKey1OnDlyTim2 = stHSDetInfo_Default.bKey1OnDlyTim2; + bKey2OnDlyTim2 = stHSDetInfo_Default.bKey2OnDlyTim2; +#endif + err = _McDrv_Ctrl(MCDRV_GET_HSDET, (void *)&stHSDetInfo, NULL, 0); + if (err < MCDRV_SUCCESS) { + dbg_info("%d: Error in MCDRV_GET_HSDET\n", err); + goto exit; + } + bCurEnPlugDetDb = stHSDetInfo.bEnPlugDetDb; + + if (dFlags & MCDRV_HSDET_EVT_SENSEFIN_FLAG) { + dbg_info("bPlugRev=%d, bHpImpClass=%d, wHpImp=%d\n", + psRes->bPlugRev, psRes->bHpImpClass, + psRes->wHpImp); + mc_asoc_hpimpclass = psRes->bHpImpClass; + } + + if (dFlags & MCDRV_HSDET_EVT_PLUGUNDET_DB_FLAG) { + if (bCurEnPlugDetDb & MCDRV_PLUGDETDB_UNDET_ENABLE) { + dbg_info("PLUGUNDETDB\n"); + mc_asoc_jack_status = 0; +#ifdef SW_DRV + switch_set_state(h2w_sdev, 0); +#endif + cancel_delayed_work(&delayed_work_mb4); + dbg_info("cancel_delayed_work_mb4\n"); + cancel_delayed_work(&delayed_work_mkdeten); + dbg_info("cancel_delayed_work_mkdeten\n"); + + mc_asoc_MBSEL4 = 0x80; + + stHSDetInfo.bEnPlugDetDb = + bEnPlugDetDb & MCDRV_PLUGDETDB_DET_ENABLE; + stHSDetInfo.bEnMicDet = bEnMicDet; + stHSDetInfo.bEnDlyKeyOff = MCDRV_KEYEN_D_D_D; + stHSDetInfo.bEnDlyKeyOn = MCDRV_KEYEN_D_D_D; + stHSDetInfo.bEnKeyOff = MCDRV_KEYEN_D_D_D; + stHSDetInfo.bEnKeyOn = MCDRV_KEYEN_D_D_D; + stHSDetInfo.bHsDetDbnc = bHsDetDbnc; + stHSDetInfo.bDbncNumPlug = bDbncNumPlug; + stHSDetInfo.cbfunc = NULL; + err = _McDrv_Ctrl(MCDRV_SET_HSDET, + (void *)&stHSDetInfo, NULL, 0x410000FE); + if (err < MCDRV_SUCCESS) + dbg_info("%d: Error in MCDRV_SET_HSDET\n", err); + + stHSDetInfo.cbfunc = hsdet_cb; + err = _McDrv_Ctrl(MCDRV_SET_HSDET, + (void *)&stHSDetInfo, NULL, 0x40000000); + if (err < MCDRV_SUCCESS) + dbg_info("%d: Error in MCDRV_SET_HSDET\n", err); + mc_asoc_hpimpclass = (UINT8)-1; + } else { + connect_path(mc_asoc_codec); + } + } + + if (mc_asoc_jack_status == SND_JACK_HEADSET) { + if (dFlags & MCDRV_HSDET_EVT_KEYON0_FLAG) { + dbg_info("KEYON_0\n"); + if ((bEnKeyOn & MCDRV_KEYEN_D_D_E) != 0) { + jack_btn_on = SND_JACK_BTN_0; + jack_btn_stat = SND_JACK_BTN_0; + } + } else if (dFlags & MCDRV_HSDET_EVT_KEYON1_FLAG) { + dbg_info("KEYON_1\n"); + if ((bEnKeyOn & MCDRV_KEYEN_D_E_D) != 0) { + jack_btn_on = SND_JACK_BTN_1; + jack_btn_stat = SND_JACK_BTN_1; + } + } else if (dFlags & MCDRV_HSDET_EVT_KEYON2_FLAG) { + dbg_info("KEYON_2\n"); + if ((bEnKeyOn & MCDRV_KEYEN_E_D_D) != 0) { + jack_btn_on = SND_JACK_BTN_2; + jack_btn_stat = SND_JACK_BTN_2; + } + } + + if (dFlags & MCDRV_HSDET_EVT_KEYOFF0_FLAG) { + dbg_info("KEYOFF_0\n"); + if ((bEnKeyOff & MCDRV_KEYEN_D_D_E) != 0) { + ; + jack_btn_off = SND_JACK_BTN_0; + } + if (((bEnDlyKeyOn & MCDRV_KEYEN_D_D_E) != 0) + && (mc_asoc_ver_id == 0) + && (bKey0OnDlyTim2 == 0)) { + if ((stHSDetInfo.bEnKeyOff & 1) != 0) { + stHSDetInfo.bEnKeyOff &= ~1; + stHSDetInfo.bKey0OnDlyTim = + bKey0OnDlyTim; + err = _McDrv_Ctrl(MCDRV_SET_HSDET, + (void *)&stHSDetInfo, NULL, 0x2020); + if (err < MCDRV_SUCCESS) + dbg_info( + "%d: Error in MCDRV_SET_HSDET\n", err); + } + } + } else if (dFlags & MCDRV_HSDET_EVT_KEYOFF1_FLAG) { + dbg_info("KEYOFF_1\n"); + if ((bEnKeyOff & MCDRV_KEYEN_D_E_D) != 0) { + ; + jack_btn_off = SND_JACK_BTN_1; + } + if (((bEnDlyKeyOn & MCDRV_KEYEN_D_E_D) != 0) + && (mc_asoc_ver_id == 0) + && (bKey1OnDlyTim2 == 0)) { + if ((stHSDetInfo.bEnKeyOff & 2) != 0) { + stHSDetInfo.bEnKeyOff &= ~2; + stHSDetInfo.bKey1OnDlyTim = + bKey1OnDlyTim; + err = _McDrv_Ctrl(MCDRV_SET_HSDET, + (void *)&stHSDetInfo, NULL, 0x4020); + if (err < MCDRV_SUCCESS) + dbg_info( + "%d: Error in MCDRV_SET_HSDET\n", err); + } + } + } else if (dFlags & MCDRV_HSDET_EVT_KEYOFF2_FLAG) { + dbg_info("KEYOFF_2\n"); + if ((bEnKeyOff & MCDRV_KEYEN_E_D_D) != 0) { + ; + jack_btn_off = SND_JACK_BTN_2; + } + if (((bEnDlyKeyOn & MCDRV_KEYEN_E_D_D) != 0) + && (mc_asoc_ver_id == 0) + && (bKey2OnDlyTim2 == 0)) { + if ((stHSDetInfo.bEnKeyOff & 4) != 0) { + stHSDetInfo.bEnKeyOff &= ~4; + stHSDetInfo.bKey2OnDlyTim = + bKey2OnDlyTim; + err = _McDrv_Ctrl(MCDRV_SET_HSDET, + (void *)&stHSDetInfo, NULL, 0x8020); + if (err < MCDRV_SUCCESS) + dbg_info( + "%d: Error in MCDRV_SET_HSDET\n", err); + } + } + } + + if (dFlags & MCDRV_HSDET_EVT_DLYKEYON0_FLAG) { + dbg_info("DLYKEYON_0\n"); + if ((bEnDlyKeyOn & MCDRV_KEYEN_D_D_E) != 0) { + input_report_key(inp_dev, + MC_ASOC_EV_KEY_DELAYKEYON0, 1); + input_sync(inp_dev); + input_report_key(inp_dev, + MC_ASOC_EV_KEY_DELAYKEYON0, 0); + input_sync(inp_dev); + if ((mc_asoc_ver_id == 0) + && (bKey0OnDlyTim2 == 0)) { + stHSDetInfo.bEnKeyOff |= 1; + stHSDetInfo.bKey0OnDlyTim = 0; + err = _McDrv_Ctrl(MCDRV_SET_HSDET, + (void *)&stHSDetInfo, NULL, 0x2020); + if (err < MCDRV_SUCCESS) + dbg_info( + "%d: Error in MCDRV_SET_HSDET\n", err); + } + } + } else if (dFlags & MCDRV_HSDET_EVT_DLYKEYON1_FLAG) { + dbg_info("DLYKEYON_1\n"); + if ((bEnDlyKeyOn & MCDRV_KEYEN_D_E_D) != 0) { + input_report_key(inp_dev, + MC_ASOC_EV_KEY_DELAYKEYON1, 1); + input_sync(inp_dev); + input_report_key(inp_dev, + MC_ASOC_EV_KEY_DELAYKEYON1, 0); + input_sync(inp_dev); + + if ((mc_asoc_ver_id == 0) + && (bKey1OnDlyTim2 == 0)) { + stHSDetInfo.bEnKeyOff |= 2; + stHSDetInfo.bKey1OnDlyTim = 0; + err = _McDrv_Ctrl(MCDRV_SET_HSDET, + (void *)&stHSDetInfo, NULL, 0x4020); + if (err < MCDRV_SUCCESS) + dbg_info( + "%d: Error in MCDRV_SET_HSDET\n", err); + } + } + } else if (dFlags & MCDRV_HSDET_EVT_DLYKEYON2_FLAG) { + dbg_info("DLYKEYON_2\n"); + if ((bEnDlyKeyOn & MCDRV_KEYEN_E_D_D) != 0) { + input_report_key(inp_dev, + MC_ASOC_EV_KEY_DELAYKEYON2, 1); + input_sync(inp_dev); + input_report_key(inp_dev, + MC_ASOC_EV_KEY_DELAYKEYON2, 0); + input_sync(inp_dev); + + if ((mc_asoc_ver_id == 0) + && (bKey2OnDlyTim2 == 0)) { + stHSDetInfo.bEnKeyOff |= 4; + stHSDetInfo.bKey2OnDlyTim = 0; + err = _McDrv_Ctrl(MCDRV_SET_HSDET, + (void *)&stHSDetInfo, NULL, 0x8020); + if (err < MCDRV_SUCCESS) + dbg_info( + "%d: Error in MCDRV_SET_HSDET\n", err); + } + } + } + + if (dFlags & MCDRV_HSDET_EVT_DLYKEYOFF0_FLAG) { + dbg_info("DLYKEYOFF_0\n"); + if ((bEnDlyKeyOff & MCDRV_KEYEN_D_D_E) != 0) { + input_report_key(inp_dev, + mc_asoc_ev_key_delaykeyoff0[psRes->bKeyCnt0], + 1); + input_sync(inp_dev); + input_report_key(inp_dev, + mc_asoc_ev_key_delaykeyoff0[psRes->bKeyCnt0], + 0); + input_sync(inp_dev); + } + } else if (dFlags & MCDRV_HSDET_EVT_DLYKEYOFF1_FLAG) { + dbg_info("DLYKEYOFF_1\n"); + if ((bEnDlyKeyOff & MCDRV_KEYEN_D_E_D) != 0) { + input_report_key(inp_dev, + mc_asoc_ev_key_delaykeyoff1[psRes->bKeyCnt1], + 1); + input_sync(inp_dev); + input_report_key(inp_dev, + mc_asoc_ev_key_delaykeyoff1[psRes->bKeyCnt1], + 0); + input_sync(inp_dev); + } + } else if (dFlags & MCDRV_HSDET_EVT_DLYKEYOFF2_FLAG) { + dbg_info("DLYKEYOFF_2\n"); + if ((bEnDlyKeyOff & MCDRV_KEYEN_E_D_D) != 0) { + input_report_key(inp_dev, + mc_asoc_ev_key_delaykeyoff2[psRes->bKeyCnt2], + 1); + input_sync(inp_dev); + input_report_key(inp_dev, + mc_asoc_ev_key_delaykeyoff2[psRes->bKeyCnt2], + 0); + input_sync(inp_dev); + } + } + } + + if ((dFlags & MCDRV_HSDET_EVT_PLUGDET_DB_FLAG) + && (bCurEnPlugDetDb & MCDRV_PLUGDETDB_DET_ENABLE)) { + dbg_info("PLUGDETDB\n"); + if ((dFlags & MCDRV_HSDET_EVT_MICDET_FLAG) + && (bEnMicDet & MCDRV_MICDET_ENABLE)) { + if ((mc_asoc_hpimpclass >= MC_ASOC_IMPCLASS_THRESHOLD) + && (mc_asoc_hpimpclass != 5) + && (mc_asoc_hpimpclass != 6)) { + mc_asoc_jack_status = SND_JACK_HEADPHONE; +#ifdef SW_DRV + switch_set_state(h2w_sdev, 2); +#endif + bEnMicDet = MCDRV_MICDET_DISABLE; + stHSDetInfo.bEnMicDet = bEnMicDet; + bEnDlyKeyOff = MCDRV_KEYEN_D_D_D; + bEnDlyKeyOn = MCDRV_KEYEN_D_D_D; + bEnKeyOff = MCDRV_KEYEN_D_D_D; + bEnKeyOn = MCDRV_KEYEN_D_D_D; + } else { + dbg_info("MICDET\n"); + mc_asoc_jack_status = SND_JACK_HEADSET; +#ifdef SW_DRV + switch_set_state(h2w_sdev, 1); +#endif + dbg_info("queue_delayed_work_mb4\n"); + queue_delayed_work(workq_mb4, &delayed_work_mb4, + msecs_to_jiffies(MSDETMB4OFF)); + } + } else { +#ifdef MICOPEN_4POLE + struct MCDRV_REG_INFO reg_info; + reg_info.bRegType = MCDRV_REGTYPE_CD; + reg_info.bAddress = MCI_MICDET; + err = _McDrv_Ctrl(MCDRV_READ_REG, ®_info, NULL, + 0); + if (err != MCDRV_SUCCESS) + reg_info.bData = 1; + mc_asoc_MICDET = reg_info.bData & 0x47; +#endif + mc_asoc_jack_status = SND_JACK_HEADPHONE; +#ifdef SW_DRV + switch_set_state(h2w_sdev, 2); +#endif + dbg_info("queue_delayed_work_mkdeten\n"); + queue_delayed_work(workq_mkdeten, + &delayed_work_mkdeten, + msecs_to_jiffies(MSMKDETENOFF)); + } + stHSDetInfo.bEnPlugDetDb = + bEnPlugDetDb & MCDRV_PLUGDETDB_UNDET_ENABLE; + stHSDetInfo.bEnDlyKeyOff = bEnDlyKeyOff; + stHSDetInfo.bEnDlyKeyOn = bEnDlyKeyOn; + stHSDetInfo.bEnKeyOff = bEnKeyOff; + stHSDetInfo.bEnKeyOn = bEnKeyOn; + stHSDetInfo.bHsDetDbnc = HSUNDETDBNC; + stHSDetInfo.bDbncNumPlug = HSUNDETDBNCNUM; + stHSDetInfo.cbfunc = NULL; + err = _McDrv_Ctrl(MCDRV_SET_HSDET, + (void *)&stHSDetInfo, NULL, 0x410000FE); + if (err < MCDRV_SUCCESS) + dbg_info("%d: Error in MCDRV_SET_HSDET\n", err); + stHSDetInfo.cbfunc = hsdet_cb; + err = _McDrv_Ctrl(MCDRV_SET_HSDET, + (void *)&stHSDetInfo, NULL, 0x40000000); + if (err < MCDRV_SUCCESS) + dbg_info("%d: Error in MCDRV_SET_HSDET\n", err); + if (stHSDetInfo.bSgnlNum == 0xFF) + mc_asoc_hpimpclass = MC_ASOC_IMP_TBL_NUM - 1; + mc_asoc_MBSEL4 = 0x80; + } + if ((mc_asoc_jack_status == SND_JACK_HEADPHONE) + && (dFlags & MCDRV_HSDET_EVT_MICDET_FLAG) + && (bEnMicDet & MCDRV_MICDET_ENABLE)) { + if ((mc_asoc_hpimpclass >= MC_ASOC_IMPCLASS_THRESHOLD) + && (mc_asoc_hpimpclass != 5) + && (mc_asoc_hpimpclass != 6)) { + cancel_delayed_work(&delayed_work_mkdeten); + + stHSDetInfo.bEnMicDet = MCDRV_MICDET_DISABLE; + stHSDetInfo.bEnDlyKeyOff = MCDRV_KEYEN_D_D_D; + stHSDetInfo.bEnDlyKeyOn = MCDRV_KEYEN_D_D_D; + stHSDetInfo.bEnKeyOff = MCDRV_KEYEN_D_D_D; + stHSDetInfo.bEnKeyOn = MCDRV_KEYEN_D_D_D; + err = _McDrv_Ctrl(MCDRV_SET_HSDET, + (void *)&stHSDetInfo, NULL, 0x7C); + if (err < MCDRV_SUCCESS) + dbg_info("%d: Error in MCDRV_SET_HSDET\n", err); + } else { + dbg_info("MICDET\n"); + mc_asoc_jack_status = SND_JACK_HEADSET; + #ifdef SW_DRV + switch_set_state(h2w_sdev, 0); + switch_set_state(h2w_sdev, 1); + #endif + cancel_delayed_work(&delayed_work_mkdeten); + dbg_info("cancel_delayed_work_mkdeten\n"); + dbg_info("queue_delayed_work_mb4\n"); + queue_delayed_work(workq_mb4, &delayed_work_mb4, + msecs_to_jiffies(MSDETMB4OFF)); + } + } + + if (hpimpclass != mc_asoc_hpimpclass) { + if ((mc_asoc_hpimpclass == (UINT8)-1) + || ((mc_asoc_hpimpclass >= MC_ASOC_IMPCLASS_THRESHOLD) + && (mc_asoc_hpimpclass != 5) + && (mc_asoc_hpimpclass != 6))) { + connect_path(mc_asoc_codec); + } else { + struct mc_asoc_mixer_path_ctl_info mixer_ctl_info; + int preset_idx = 0; + + if (get_mixer_path_ctl_info(mc_asoc_codec, + &mixer_ctl_info) < 0) + goto exit; + preset_idx = get_path_preset_idx(&mixer_ctl_info); + if ((preset_idx < 0) || (preset_idx > PRESET_PATH_N)) + goto exit; + set_volume(mc_asoc_codec, &mixer_ctl_info, preset_idx); + } + } + +exit: + ; + mc_asoc_unlock("hsdet_cb"); + if (jack_status != mc_asoc_jack_status) { + dbg_info("mc_asoc_jack_status=%d\n", mc_asoc_jack_status); + if (mc_asoc_jack_status != 0) { + ; + snd_soc_jack_report(&hs_jack, 0, SND_JACK_HEADSET); + } + snd_soc_jack_report(&hs_jack, + mc_asoc_jack_status, SND_JACK_HEADSET); + } + if (jack_btn_on != 0) { + snd_soc_jack_report(&hs_jack, jack_btn_stat, jack_btn_on); + } + if (jack_btn_off != 0) { + snd_soc_jack_report(&hs_jack, 0, jack_btn_off); + } + mutex_unlock(&hsdet_mutex); +} + +static struct workqueue_struct *my_wq; + +static void irq_func(struct work_struct *work) +{ + int err; + struct mc_asoc_data *mc_asoc = NULL; + + TRACE_FUNC(); + + mc_asoc = mc_asoc_get_mc_asoc(mc_asoc_codec); + + err = _McDrv_Ctrl(MCDRV_IRQ, NULL, NULL, 0); + if (err < 0) + pr_info("irq_func %d\n", map_drv_error(err)); + + if (IRQ_TYPE == IRQ_TYPE_LEVEL_LOW) { + ; + enable_irq(mc_asoc->pdata->irq); + } + kfree((void *)work); +} +irqreturn_t irq_handler(int irq, void *data) +{ + int ret; + struct work_struct *work; + struct mc_asoc_data *mc_asoc = NULL; + + TRACE_FUNC(); + + if (mc_asoc_suspended == 1) { + mc_asoc_irq_func = 1; + return IRQ_HANDLED; + } + + mc_asoc = mc_asoc_get_mc_asoc(mc_asoc_codec); + + work = kmalloc(sizeof(struct work_struct), GFP_ATOMIC); + if (work) { + if (IRQ_TYPE == IRQ_TYPE_LEVEL_LOW) { + ; + disable_irq_nosync(mc_asoc->pdata->irq); + } + INIT_WORK((struct work_struct *)work, irq_func); + ret = queue_work(my_wq, (struct work_struct *)work); + } + return IRQ_HANDLED; +} + +static int init_irq(struct snd_soc_codec *codec) +{ + int err = 0; + struct mc_asoc_data *mc_asoc = NULL; + + TRACE_FUNC(); + + mc_asoc = mc_asoc_get_mc_asoc(codec); + if (!mc_asoc->pdata->irq) { + dev_err(codec->dev, "%s : No irq supported\n", __func__); + return 0; + } + + my_wq = create_workqueue("irq_queue"); + + err = irq_set_irq_type(mc_asoc->pdata->irq, IRQ_TYPE); + if (err < 0) { + dev_err(codec->dev, "Failed to set_irq_type: %d\n", err); + return -EIO; + } + err = request_irq(mc_asoc->pdata->irq, irq_handler, IRQF_DISABLED, + "MC_YAMAHA IRQ", NULL); + if (err < 0) { + dev_err(codec->dev, "Failed to request_irq: %d\n", err); + return -EIO; + } + return 0; +} +static int term_irq(void) +{ + struct mc_asoc_data *mc_asoc = NULL; + + mc_asoc = mc_asoc_get_mc_asoc(mc_asoc_codec); + + if (!mc_asoc->pdata->irq) { + dev_err(mc_asoc_codec->dev, "%s : No irq supported\n", __func__); + return 0; + } + + free_irq(mc_asoc->pdata->irq, NULL); + destroy_workqueue(my_wq); + if (workq_mb4) + destroy_workqueue(workq_mb4); + if (workq_mkdeten) + destroy_workqueue(workq_mkdeten); + + return 0; +} + + +/* + * Codec device + */ +static int mc_asoc_probe( + struct snd_soc_codec *codec +) +{ + int i; + struct mc_asoc_data *mc_asoc = NULL; + struct device *dev = NULL; + struct MCDRV_DIO_INFO sDioInfo; + struct MCDRV_DIOPATH_INFO sDioPathInfo; + int err, err2; + UINT32 update = 0; + struct MCDRV_REG_INFO reg_info; + + TRACE_FUNC(); + + + mc_asoc_codec = codec; + mc_asoc_suspended = 0; + mc_asoc_hpimpclass = (UINT8)-1; + mc_asoc_jack_status = 0; + mc_asoc_irq_func = 0; +#ifdef DSP_MEM_STATIC + dsp_mem_pt = 0; +#endif + + workq_mb4 = create_workqueue("mb4"); + if (workq_mb4 == NULL) { + err = -ENOMEM; + goto error_codec_data; + } + INIT_DELAYED_WORK(&delayed_work_mb4, work_mb4); + + workq_mkdeten = create_workqueue("mkdeten"); + if (workq_mkdeten == NULL) { + err = -ENOMEM; + goto error_codec_data; + } + INIT_DELAYED_WORK(&delayed_work_mkdeten, work_mkdeten); + +#ifdef DELAY_CONNECT_XXX + workq_cfg_slim_sch = create_workqueue("cfg_slim_sch"); + if (workq_cfg_slim_sch == NULL) { + err = -ENOMEM; + goto error_codec_data; + } + INIT_DELAYED_WORK(&delayed_work_cfg_slim_sch, work_cfg_slim_sch); +#endif + + if (codec == NULL) { + /*printk(KERN_ERR "I2C bus is not probed successfully\n");*/ + err = -ENODEV; + goto error_codec_data; + } + + mc_asoc = mc_asoc_get_mc_asoc(codec); + dev = codec->dev; + if (mc_asoc == NULL || dev == NULL) { + err = -ENODEV; + goto error_codec_data; + } + + /* init hardware */ + mc_asoc->setup = mc_asoc_cfg_setup; + mc_asoc->setup.init2.bOption[19] = 1; + if (mc_asoc->pdata != NULL) { + if (mc_asoc->pdata->set_codec_ldod != NULL) { + ; + mc_asoc->setup.init2.bOption[19] = 0; + } + } + err = _McDrv_Ctrl(MCDRV_INIT, &mc_asoc->setup.init, + &mc_asoc->setup.init2, 0); + if (err != MCDRV_SUCCESS) { + dev_err(dev, "%d: Error in MCDRV_INIT\n", err); + err = -EIO; + goto error_init_hw; + } + + reg_info.bRegType = MCDRV_REGTYPE_ANA; + reg_info.bAddress = 0; + err = _McDrv_Ctrl(MCDRV_READ_REG, ®_info, NULL, 0); + if (err != MCDRV_SUCCESS) { + dev_err(dev, "%d: Error in MCDRV_READ_REG\n", err); + err = -EIO; + goto error_init_hw; + } + mc_asoc_ver_id = reg_info.bData&0x07; + + if (mc_asoc_ver_id < 2) { + err = _McDrv_Ctrl(MCDRV_TERM, NULL, NULL, 0); + if (err != MCDRV_SUCCESS) { + dev_err(dev, "%d: Error in MCDRV_TERM\n", err); + err = -EIO; + goto error_init_hw; + } + mc_asoc->setup.init.bMbSel1 = MCDRV_MBSEL_20; + mc_asoc->setup.init.bMbSel2 = MCDRV_MBSEL_20; + mc_asoc->setup.init.bMbSel3 = MCDRV_MBSEL_20; + mc_asoc->setup.init.bMbSel4 = MCDRV_MBSEL_20; + err = _McDrv_Ctrl(MCDRV_INIT, &mc_asoc->setup.init, + &mc_asoc->setup.init2, 0); + if (err != MCDRV_SUCCESS) { + dev_err(dev, "%d: Error in MCDRV_INIT\n", err); + err = -EIO; + goto error_init_hw; + } + } + + if (mc_asoc_ver_id == 0) { + vreg_map[MC_ASOC_AVOL_HP].volmap = volmap_hp_es1; + vreg_map[MC_ASOC_AVOL_LINEOUT2].volmap = volmap_lineout; + vreg_map[MC_ASOC_DVOL_ADIF0IN].volmap = volmap_adif; + vreg_map[MC_ASOC_DVOL_ADIF1IN].volmap = volmap_adif; + vreg_map[MC_ASOC_DVOL_APLAY_D].volmap = volmap_adif; + } else { + vreg_map[MC_ASOC_AVOL_SP].volmap = volmap_sp[4]; + } + + /* controls */ + err = mc_asoc_add_controls(codec, mc_asoc_snd_controls, + ARRAY_SIZE(mc_asoc_snd_controls)); + if (err < 0) { + dev_err(dev, "%d: Error in mc_asoc_add_controls\n", err); + goto error_add_ctl; + } + + err = mc_asoc_add_widgets(codec); + if (err < 0) { + dev_err(dev, "%d: Error in mc_asoc_add_widgets\n", err); + goto error_add_ctl; + } + + /* hwdep */ + err = mc_asoc_add_hwdep(codec); + if (err < 0) { + dev_err(dev, "%d: Error in mc_asoc_add_hwdep\n", err); + goto error_add_hwdep; + } + + write_cache(codec, MC_ASOC_EXT_MASTERSLAVE, + stExtPort_Default.sDioCommon.bMasterSlave); + write_cache(codec, MC_ASOC_EXT_RATE, + stExtPort_Default.sDioCommon.bFs); + write_cache(codec, MC_ASOC_EXT_BITCLOCK_RATE, + stExtPort_Default.sDioCommon.bBckFs); + write_cache(codec, MC_ASOC_EXT_INTERFACE, + stExtPort_Default.sDioCommon.bInterface); + write_cache(codec, MC_ASOC_EXT_BITCLOCK_INVERT, + stExtPort_Default.sDioCommon.bBckInvert); + write_cache(codec, MC_ASOC_EXT_INPUT_DA_BIT_WIDTH, + stExtPort_Default.sDir.sDaFormat.bBitSel); + write_cache(codec, MC_ASOC_EXT_OUTPUT_DA_BIT_WIDTH, + stExtPort_Default.sDit.sDaFormat.bBitSel); + write_cache(codec, MC_ASOC_EXT_INPUT_DA_FORMAT, + stExtPort_Default.sDir.sDaFormat.bMode); + write_cache(codec, MC_ASOC_EXT_OUTPUT_DA_FORMAT, + stExtPort_Default.sDit.sDaFormat.bMode); + write_cache(codec, MC_ASOC_EXT_INPUT_PCM_MONOSTEREO, + stExtPort_Default.sDir.sPcmFormat.bMono); + write_cache(codec, MC_ASOC_EXT_OUTPUT_PCM_MONOSTEREO, + stExtPort_Default.sDit.sPcmFormat.bMono); + write_cache(codec, MC_ASOC_EXT_INPUT_PCM_BIT_ORDER, + stExtPort_Default.sDir.sPcmFormat.bOrder); + write_cache(codec, MC_ASOC_EXT_OUTPUT_PCM_BIT_ORDER, + stExtPort_Default.sDit.sPcmFormat.bOrder); + write_cache(codec, MC_ASOC_EXT_INPUT_PCM_FORMAT, + stExtPort_Default.sDir.sPcmFormat.bLaw); + write_cache(codec, MC_ASOC_EXT_OUTPUT_PCM_FORMAT, + stExtPort_Default.sDit.sPcmFormat.bLaw); + write_cache(codec, MC_ASOC_EXT_INPUT_PCM_BIT_WIDTH, + stExtPort_Default.sDir.sPcmFormat.bBitSel); + write_cache(codec, MC_ASOC_EXT_OUTPUT_PCM_BIT_WIDTH, + stExtPort_Default.sDit.sPcmFormat.bBitSel); + + write_cache(codec, MC_ASOC_VOICE_MASTERSLAVE, + stVoicePort_Default.sDioCommon.bMasterSlave); + write_cache(codec, MC_ASOC_VOICE_RATE, + stVoicePort_Default.sDioCommon.bFs); + write_cache(codec, MC_ASOC_VOICE_BITCLOCK_RATE, + stVoicePort_Default.sDioCommon.bBckFs); + write_cache(codec, MC_ASOC_VOICE_INTERFACE, + stVoicePort_Default.sDioCommon.bInterface); + write_cache(codec, MC_ASOC_VOICE_BITCLOCK_INVERT, + stVoicePort_Default.sDioCommon.bBckInvert); + write_cache(codec, MC_ASOC_VOICE_INPUT_DA_BIT_WIDTH, + stVoicePort_Default.sDir.sDaFormat.bBitSel); + write_cache(codec, MC_ASOC_VOICE_OUTPUT_DA_BIT_WIDTH, + stVoicePort_Default.sDit.sDaFormat.bBitSel); + write_cache(codec, MC_ASOC_VOICE_INPUT_DA_FORMAT, + stVoicePort_Default.sDir.sDaFormat.bMode); + write_cache(codec, MC_ASOC_VOICE_OUTPUT_DA_FORMAT, + stVoicePort_Default.sDit.sDaFormat.bMode); + write_cache(codec, MC_ASOC_VOICE_INPUT_PCM_MONOSTEREO, + stVoicePort_Default.sDir.sPcmFormat.bMono); + write_cache(codec, MC_ASOC_VOICE_OUTPUT_PCM_MONOSTEREO, + stVoicePort_Default.sDit.sPcmFormat.bMono); + write_cache(codec, MC_ASOC_VOICE_INPUT_PCM_BIT_ORDER, + stVoicePort_Default.sDir.sPcmFormat.bOrder); + write_cache(codec, MC_ASOC_VOICE_OUTPUT_PCM_BIT_ORDER, + stVoicePort_Default.sDit.sPcmFormat.bOrder); + write_cache(codec, MC_ASOC_VOICE_INPUT_PCM_FORMAT, + stVoicePort_Default.sDir.sPcmFormat.bLaw); + write_cache(codec, MC_ASOC_VOICE_OUTPUT_PCM_FORMAT, + stVoicePort_Default.sDit.sPcmFormat.bLaw); + write_cache(codec, MC_ASOC_VOICE_INPUT_PCM_BIT_WIDTH, + stVoicePort_Default.sDir.sPcmFormat.bBitSel); + + write_cache(codec, MC_ASOC_VOICE_OUTPUT_PCM_BIT_WIDTH, + stVoicePort_Default.sDit.sPcmFormat.bBitSel); + + write_cache(codec, MC_ASOC_VOICE_RECORDING, VOICE_RECORDING_UNMUTE); + write_cache(codec, MC_ASOC_INCALL_MIC_SP, INCALL_MIC_SP); + write_cache(codec, MC_ASOC_INCALL_MIC_RC, INCALL_MIC_RC); + write_cache(codec, MC_ASOC_INCALL_MIC_HP, INCALL_MIC_HP); + write_cache(codec, MC_ASOC_INCALL_MIC_LO1, INCALL_MIC_LO1); + write_cache(codec, MC_ASOC_INCALL_MIC_LO2, INCALL_MIC_LO2); + + write_cache(codec, MC_ASOC_MUSIC_PHYSICAL_PORT, MUSIC_PHYSICAL_PORT); + write_cache(codec, MC_ASOC_EXT_PHYSICAL_PORT, EXT_PHYSICAL_PORT); + write_cache(codec, MC_ASOC_VOICE_PHYSICAL_PORT, VOICE_PHYSICAL_PORT); + write_cache(codec, MC_ASOC_HIFI_PHYSICAL_PORT, HIFI_PHYSICAL_PORT); + + write_cache(codec, MC_ASOC_MAIN_MIC, mc_asoc_main_mic); + write_cache(codec, MC_ASOC_SUB_MIC, mc_asoc_sub_mic); + write_cache(codec, MC_ASOC_HS_MIC, mc_asoc_hs_mic); +#ifdef MC_ASOC_TEST + write_cache(codec, MC_ASOC_MIC1_BIAS, mc_asoc_mic1_bias); + write_cache(codec, MC_ASOC_MIC2_BIAS, mc_asoc_mic2_bias); + write_cache(codec, MC_ASOC_MIC3_BIAS, mc_asoc_mic3_bias); + write_cache(codec, MC_ASOC_MIC4_BIAS, mc_asoc_mic4_bias); +#endif + + /* Headset jack detection */ + snd_soc_jack_new(codec, "Headset", + SND_JACK_HEADSET|SND_JACK_BTN_0|SND_JACK_BTN_1|SND_JACK_BTN_2, + &hs_jack); + + snd_jack_set_key(hs_jack.jack, SND_JACK_BTN_0, KEY_MEDIA); + snd_jack_set_key(hs_jack.jack, SND_JACK_BTN_1, KEY_VOLUMEUP); + snd_jack_set_key(hs_jack.jack, SND_JACK_BTN_2, KEY_VOLUMEDOWN); + + snd_soc_jack_add_pins(&hs_jack, + ARRAY_SIZE(hs_jack_pins), + hs_jack_pins); + + mc_asoc->jack.hs_jack = &hs_jack; + + inp_dev = input_allocate_device(); + inp_dev->name = "Headset keys"; + input_set_capability(inp_dev, EV_KEY, MC_ASOC_EV_KEY_DELAYKEYON0); + input_set_capability(inp_dev, EV_KEY, MC_ASOC_EV_KEY_DELAYKEYON1); + input_set_capability(inp_dev, EV_KEY, MC_ASOC_EV_KEY_DELAYKEYON2); + for (i = 0; i < 8; i++) { + input_set_capability(inp_dev, + EV_KEY, + mc_asoc_ev_key_delaykeyoff0[i]); + input_set_capability(inp_dev, + EV_KEY, + mc_asoc_ev_key_delaykeyoff1[i]); + input_set_capability(inp_dev, + EV_KEY, + mc_asoc_ev_key_delaykeyoff2[i]); + } + err = input_register_device(inp_dev); + if (err != 0) { + dev_err(dev, "%d: Error in input_register_device\n", err); + goto error_set_mode; + } + +#ifdef SW_DRV + h2w_sdev = kzalloc(sizeof(struct switch_dev), GFP_KERNEL); + h2w_sdev->name = "h2w"; + h2w_sdev->print_name = headset_print_name; + err = switch_dev_register(h2w_sdev); + if (err < 0) { + dev_err(dev, "%d: Error in switch_dev_register\n", err); + goto error_set_mode; + } + + mc_asoc->jack.h2w_sdev = h2w_sdev; +#endif + + sDioInfo.asPortInfo[0] = stMusicPort_Default; + sDioInfo.asPortInfo[1] = stExtPort_Default; + sDioInfo.asPortInfo[2] = stVoicePort_Default; + sDioInfo.asPortInfo[3] = stHifiPort_Default; + + update = MCDRV_MUSIC_COM_UPDATE_FLAG + | MCDRV_MUSIC_DIR_UPDATE_FLAG + | MCDRV_MUSIC_DIT_UPDATE_FLAG + | MCDRV_EXT_COM_UPDATE_FLAG + | MCDRV_EXT_DIR_UPDATE_FLAG + | MCDRV_EXT_DIT_UPDATE_FLAG + | MCDRV_VOICE_COM_UPDATE_FLAG + | MCDRV_VOICE_DIR_UPDATE_FLAG + | MCDRV_VOICE_DIT_UPDATE_FLAG + | MCDRV_HIFI_COM_UPDATE_FLAG + | MCDRV_HIFI_DIR_UPDATE_FLAG + | MCDRV_HIFI_DIT_UPDATE_FLAG; + err = _McDrv_Ctrl(MCDRV_SET_DIGITALIO, &sDioInfo, NULL, update); + if (err != MCDRV_SUCCESS) { + dev_err(dev, "%d: Error in MCDRV_SET_DIGITALIO\n", err); + goto error_set_mode; + } + + update = MCDRV_PHYS0_UPDATE_FLAG + | MCDRV_PHYS1_UPDATE_FLAG + | MCDRV_PHYS2_UPDATE_FLAG + | MCDRV_PHYS3_UPDATE_FLAG + | MCDRV_DIR0SLOT_UPDATE_FLAG + | MCDRV_DIR1SLOT_UPDATE_FLAG + | MCDRV_DIR2SLOT_UPDATE_FLAG + | MCDRV_DIT0SLOT_UPDATE_FLAG + | MCDRV_DIT1SLOT_UPDATE_FLAG + | MCDRV_DIT2SLOT_UPDATE_FLAG; + sDioPathInfo.abPhysPort[0] = MUSIC_PHYSICAL_PORT; + sDioPathInfo.abPhysPort[1] = EXT_PHYSICAL_PORT; + sDioPathInfo.abPhysPort[2] = VOICE_PHYSICAL_PORT; + sDioPathInfo.abPhysPort[3] = HIFI_PHYSICAL_PORT; + sDioPathInfo.abMusicRSlot[0] = mc_asoc_cfg_setup.rslot[0]; + sDioPathInfo.abMusicRSlot[1] = mc_asoc_cfg_setup.rslot[1]; + sDioPathInfo.abMusicRSlot[2] = mc_asoc_cfg_setup.rslot[2]; + sDioPathInfo.abMusicTSlot[0] = mc_asoc_cfg_setup.tslot[0]; + sDioPathInfo.abMusicTSlot[1] = mc_asoc_cfg_setup.tslot[1]; + sDioPathInfo.abMusicTSlot[2] = mc_asoc_cfg_setup.tslot[2]; + err = _McDrv_Ctrl(MCDRV_SET_DIGITALIO_PATH, &sDioPathInfo, NULL, + update); + if (err != MCDRV_SUCCESS) { + dev_err(dev, "%d: Error in MCDRV_SET_DIGITALIO_PATH\n", err); + goto error_set_mode; + } + + mc_asoc->hsdet_store = stHSDetInfo_Default; + mc_asoc->hsdet_store.bEnDlyKeyOff = MCDRV_KEYEN_D_D_D; + mc_asoc->hsdet_store.bEnDlyKeyOn = MCDRV_KEYEN_D_D_D; + mc_asoc->hsdet_store.bEnKeyOff = MCDRV_KEYEN_D_D_D; + mc_asoc->hsdet_store.bEnKeyOn = MCDRV_KEYEN_D_D_D; + mc_asoc->hsdet_store.cbfunc = hsdet_cb; + if (mc_asoc_ver_id == 0) { + ; + mc_asoc->hsdet_store.bIrqType = MCDRV_IRQTYPE_NORMAL; + } + err = _McDrv_Ctrl(MCDRV_SET_HSDET, (void *)&mc_asoc->hsdet_store, + (void *)&stHSDet2Info_Default, 0x7fffffff); + if (err < MCDRV_SUCCESS) { + dev_err(dev, "%d: Error in MCDRV_SET_HSDET\n", err); + goto error_set_mode; + } + + err = _McDrv_Ctrl(MCDRV_IRQ, NULL, NULL, 0); + if (err < 0) { + dev_err(dev, "%d: Error in MCDRV_IRQ\n", err); + goto error_set_mode; + } + + /* IRQ Initialize */ + err = init_irq(codec); + if (err < 0) { + dev_err(dev, "%d: Error in init_irq\n", err); + goto error_set_mode; + } + +#ifdef HSDET_WHILE_SUSPEND + device_init_wakeup(dev, 1); +#endif + + set_bias_level(codec, SND_SOC_BIAS_OFF); + goto exit; + +error_set_mode: +error_add_hwdep: +error_add_ctl: + err2 = _McDrv_Ctrl(MCDRV_TERM, NULL, NULL, 0); + if (err2 < 0) { + ; + dev_err(dev, "%d: Error in MCDRV_TERM\n", err2); + } +error_init_hw: +error_codec_data: + if (workq_mb4) + destroy_workqueue(workq_mb4); + if (workq_mkdeten) + destroy_workqueue(workq_mkdeten); + workq_mb4 = NULL; + workq_mkdeten = NULL; +#ifdef DELAY_CONNECT_XXX + if (workq_cfg_slim_sch) + destroy_workqueue(workq_cfg_slim_sch); + workq_cfg_slim_sch = NULL; +#endif +exit: + return err; +} + +static int mc_asoc_remove(struct snd_soc_codec *codec) +{ + int err = 0; + struct mc_asoc_data *mc_asoc = NULL; + + /*TRACE_FUNC();*/ + + mc_asoc = mc_asoc_get_mc_asoc(codec); + if (mc_asoc == NULL) + return -EINVAL; + + /* IRQ terminate */ + term_irq(); + + input_unregister_device(inp_dev); +#ifdef SW_DRV + if (h2w_sdev != NULL) { + switch_dev_unregister(h2w_sdev); + kfree(h2w_sdev); + h2w_sdev = NULL; + } +#endif + + del_dsp_prm(mc_asoc); + + set_bias_level(codec, SND_SOC_BIAS_OFF); + if (codec) { + err = _McDrv_Ctrl(MCDRV_TERM, NULL, NULL, 0); + if (err != MCDRV_SUCCESS) { + dev_err(codec->dev, "%d: Error in MCDRV_TERM\n", err); + err = -EIO; + } + } + + destroy_workqueue(workq_mb4); + destroy_workqueue(workq_mkdeten); + workq_mb4 = NULL; + workq_mkdeten = NULL; +#ifdef DELAY_CONNECT_XXX + destroy_workqueue(workq_cfg_slim_sch); + workq_cfg_slim_sch = NULL; +#endif + return err; +} + +static int mc_asoc_suspend( + struct snd_soc_codec *codec +) +{ + int err; + struct mc_asoc_data *mc_asoc = NULL; + struct mc_asoc_mixer_path_ctl_info mixer_ctl_info; +#ifdef HSDET_WHILE_SUSPEND + struct MCDRV_HSDET_INFO stHSDetInfo; +#else + int i; +#endif + + TRACE_FUNC(); + + mc_asoc = mc_asoc_get_mc_asoc(codec); + if (mc_asoc == NULL) + return -EINVAL; + + get_mixer_path_ctl_info(codec, &mixer_ctl_info); +#ifdef HSDET_WHILE_SUSPEND + if ((mixer_ctl_info.audio_mode_play == 0) + && (mixer_ctl_info.audio_mode_cap == 0) + && (mixer_ctl_info.mainmic_play == 0) + && (mixer_ctl_info.submic_play == 0) + && (mixer_ctl_info.msmic_play == 0) + && (mixer_ctl_info.hsmic_play == 0) + && (mixer_ctl_info.btmic_play == 0) + && (mixer_ctl_info.lin1_play == 0) + && (mixer_ctl_info.dtmf_control == 0)) + set_bias_level(codec, SND_SOC_BIAS_OFF); +#else + if ((mixer_ctl_info.audio_mode_play != 0) + || (mixer_ctl_info.audio_mode_cap != 0) + || (mixer_ctl_info.mainmic_play != 0) + || (mixer_ctl_info.submic_play != 0) + || (mixer_ctl_info.msmic_play != 0) + || (mixer_ctl_info.hsmic_play != 0) + || (mixer_ctl_info.btmic_play != 0) + || (mixer_ctl_info.lin1_play != 0) + || (mixer_ctl_info.dtmf_control != 0)) + return 0; + + set_bias_level(codec, SND_SOC_BIAS_OFF); +#endif + + mc_asoc_lock("mc_asoc_suspend"); + + err = _McDrv_Ctrl(MCDRV_GET_HSDET, + (void *)&mc_asoc->hsdet_store, NULL, 0); + if (err != MCDRV_SUCCESS) { + dev_err(codec->dev, "%d: Error in mc_asoc_suspend\n", err); + err = -EIO; + goto error; + } + mc_asoc->hsdet_store.bDlyIrqStop = + stHSDetInfo_Default.bDlyIrqStop; + +#ifdef HSDET_WHILE_SUSPEND + if (device_may_wakeup(codec->dev)) + enable_irq_wake(mc_asoc->pdata->irq); + + stHSDetInfo = stHSDetInfo_Suspend; + if (mc_asoc_ver_id == 0) { + ; + stHSDetInfo.bIrqType = MCDRV_IRQTYPE_NORMAL; + } + if (mc_asoc_jack_status != SND_JACK_HEADSET) { + stHSDetInfo.bEnDlyKeyOff = MCDRV_KEYEN_D_D_D; + stHSDetInfo.bEnDlyKeyOn = MCDRV_KEYEN_D_D_D; + stHSDetInfo.bEnKeyOff = MCDRV_KEYEN_D_D_D; + stHSDetInfo.bEnKeyOn = MCDRV_KEYEN_D_D_D; + } + stHSDetInfo.bEnPlugDetDb &= mc_asoc->hsdet_store.bEnPlugDetDb; + stHSDetInfo.bEnMicDet &= mc_asoc->hsdet_store.bEnMicDet; + err = _McDrv_Ctrl(MCDRV_SET_HSDET, + (void *)&stHSDetInfo, NULL, 0x7fffffff); + if (err != MCDRV_SUCCESS) { + dev_err(codec->dev, "%d: Error in mc_asoc_suspend\n", err); + err = -EIO; + goto error; + } + stHSDetInfo.cbfunc = hsdet_cb; + err = _McDrv_Ctrl(MCDRV_SET_HSDET, + (void *)&stHSDetInfo, NULL, 0x40000000); + if (err != MCDRV_SUCCESS) { + dev_err(codec->dev, "%d: Error in mc_asoc_suspend\n", err); + err = -EIO; + goto error; + } + +#else + /* store parameters */ + for (i = 0; i < MC_ASOC_N_INFO_STORE; i++) { + if (info_store_tbl[i].get) { + err = _McDrv_Ctrl(info_store_tbl[i].get, + (void *)mc_asoc + info_store_tbl[i].offset, + NULL, 0); + if (err != MCDRV_SUCCESS) { + dev_err(codec->dev, + "%d: Error in mc_asoc_suspend\n", err); + err = -EIO; + goto error; + } + } + } + + /* IRQ terminate */ + term_irq(); + + err = _McDrv_Ctrl(MCDRV_TERM, NULL, NULL, 0); + if (err != MCDRV_SUCCESS) { + dev_err(codec->dev, "%d: Error in MCDRV_TERM\n", err); + err = -EIO; + } +#endif +#ifndef FEATURE_MCLK_CONTROL_BY_YMU831 + if ((mixer_ctl_info.audio_mode_play == 0) + && (mixer_ctl_info.audio_mode_cap == 0) + && (mixer_ctl_info.mainmic_play == 0) + && (mixer_ctl_info.submic_play == 0) + && (mixer_ctl_info.msmic_play == 0) + && (mixer_ctl_info.hsmic_play == 0) + && (mixer_ctl_info.btmic_play == 0) + && (mixer_ctl_info.lin1_play == 0) + && (mixer_ctl_info.dtmf_control == 0)) { + if (mc_asoc->pdata->set_codec_mclk) + mc_asoc->pdata->set_codec_mclk(0, 1); + } +#endif + mc_asoc_suspended = 1; + +error: + mc_asoc_unlock("mc_asoc_suspend"); + + return err; +} + +static int mc_asoc_resume( + struct snd_soc_codec *codec +) +{ + struct mc_asoc_data *mc_asoc = NULL; + int err; +#ifdef HSDET_WHILE_SUSPEND + struct MCDRV_HSDET_INFO stHSDetInfo; +#else + SINT16 *vol = NULL; + int i, j; + int output_path; + int incall_mic; + struct mc_asoc_dsp_param *dsp_prm = NULL; +#endif + struct mc_asoc_mixer_path_ctl_info mixer_ctl_info; + + TRACE_FUNC(); + + if (mc_asoc_suspended != 1) + return 0; + + mc_asoc = mc_asoc_get_mc_asoc(codec); + if (mc_asoc == NULL) + return -EINVAL; + +#ifndef FEATURE_MCLK_CONTROL_BY_YMU831 + if (mc_asoc->pdata->set_codec_mclk) + mc_asoc->pdata->set_codec_mclk(1, 0); +#endif + + mc_asoc_suspended = 0; + + if (mc_asoc_irq_func != 0) { + err = map_drv_error(_McDrv_Ctrl(MCDRV_IRQ, NULL, NULL, 0)); + mc_asoc_irq_func = 0; + } + + mc_asoc_lock("mc_asoc_resume"); + + get_mixer_path_ctl_info(codec, &mixer_ctl_info); +#ifdef HSDET_WHILE_SUSPEND + if ((mixer_ctl_info.audio_mode_play == 0) + && (mixer_ctl_info.audio_mode_cap == 0) + && (mixer_ctl_info.mainmic_play == 0) + && (mixer_ctl_info.submic_play == 0) + && (mixer_ctl_info.msmic_play == 0) + && (mixer_ctl_info.hsmic_play == 0) + && (mixer_ctl_info.btmic_play == 0) + && (mixer_ctl_info.lin1_play == 0) + && (mixer_ctl_info.dtmf_control == 0)) + set_bias_level(codec, SND_SOC_BIAS_STANDBY); +#else + set_bias_level(codec, SND_SOC_BIAS_STANDBY); +#endif + +#ifdef HSDET_WHILE_SUSPEND + + err = _McDrv_Ctrl(MCDRV_GET_HSDET, (void *)&stHSDetInfo, NULL, 0); + if (err != MCDRV_SUCCESS) { + dev_err(codec->dev, "%d: Error in mc_asoc_resume\n", err); + err = -EIO; + goto error; + } + + mc_asoc->hsdet_store.bEnPlugDetDb = + stHSDetInfo_Default.bEnPlugDetDb & stHSDetInfo.bEnPlugDetDb; + mc_asoc->hsdet_store.bEnMicDet = stHSDetInfo.bEnMicDet; + if (mc_asoc_jack_status != SND_JACK_HEADSET) { + mc_asoc->hsdet_store.bEnDlyKeyOff = MCDRV_KEYEN_D_D_D; + mc_asoc->hsdet_store.bEnDlyKeyOn = MCDRV_KEYEN_D_D_D; + mc_asoc->hsdet_store.bEnKeyOff = MCDRV_KEYEN_D_D_D; + mc_asoc->hsdet_store.bEnKeyOn = MCDRV_KEYEN_D_D_D; + } else { + mc_asoc->hsdet_store.bEnDlyKeyOff = + stHSDetInfo_Default.bEnDlyKeyOff; + mc_asoc->hsdet_store.bEnDlyKeyOn = + stHSDetInfo_Default.bEnDlyKeyOn; + mc_asoc->hsdet_store.bEnKeyOff = + stHSDetInfo_Default.bEnKeyOff; + mc_asoc->hsdet_store.bEnKeyOn = + stHSDetInfo_Default.bEnKeyOn; + } + mc_asoc->hsdet_store.cbfunc = NULL; + err = _McDrv_Ctrl(MCDRV_SET_HSDET, + (void *)&mc_asoc->hsdet_store, NULL, 0x7fffffff); + if (err != MCDRV_SUCCESS) { + dev_err(codec->dev, "%d: Error in mc_asoc_resume\n", err); + err = -EIO; + goto error; + } + mc_asoc->hsdet_store.cbfunc = hsdet_cb; + err = _McDrv_Ctrl(MCDRV_SET_HSDET, + (void *)&mc_asoc->hsdet_store, NULL, 0x40000000); + if (err != MCDRV_SUCCESS) { + dev_err(codec->dev, "%d: Error in mc_asoc_resume\n", err); + err = -EIO; + goto error; + } + if (device_may_wakeup(codec->dev)) { + if (!mc_asoc->pdata->irq) + dev_err(codec->dev, "%s : No irq supported\n", __func__); + else + disable_irq_wake(mc_asoc->pdata->irq); + } + +#else + err = _McDrv_Ctrl(MCDRV_INIT, &mc_asoc->setup.init, + &mc_asoc->setup.init2, 0); + if (err != MCDRV_SUCCESS) { + dev_err(codec->dev, "%d: Error in MCDRV_INIT\n", err); + err = -EIO; + goto error; + } + + /* restore parameters */ + output_path = read_cache(codec, MC_ASOC_OUTPUT_PATH); + if (output_path < 0) { + err = -EIO; + goto error; + } + incall_mic = get_incall_mic(codec, output_path); + if (incall_mic < 0) { + err = -EIO; + goto error; + } + + for (i = 0; i <= DSP_PRM_VC_2MIC; i++) { + if ((i == DSP_PRM_VC_1MIC) + && (incall_mic == MC_ASOC_INCALL_MIC_2MIC)) + continue; + if ((i == DSP_PRM_VC_2MIC) + && (incall_mic != MC_ASOC_INCALL_MIC_2MIC)) + continue; + + for (j = 0; j <= DSP_PRM_USER; j++) { + dsp_prm = &mc_asoc->param_store[i][j]; + while ((dsp_prm != NULL) + && (dsp_prm->pabParam != NULL)) { + dbg_info("pabParam = %8p\n", + dsp_prm->pabParam); + err = _McDrv_Ctrl(MCDRV_SET_DSP, + dsp_prm->pabParam, + NULL, + dsp_prm->dSize); + if (err != 0) { + dev_err(codec->dev, + "%d:Error in mc_asoc_resume(SET_DSP)\n" + , err); + dev_err(codec->dev, "i=%d, j=%d\n", + i, j); + err = -EIO; + goto error; + } + dsp_prm = dsp_prm->next; + } + } + } + + vol = (SINT16 *)&mc_asoc->vol_store; + for (i = 0; i < sizeof(struct MCDRV_VOL_INFO)/sizeof(SINT16); + i++, vol++) + *vol |= 0x0001; + + /* When pvPrm is "NULL" ,dPrm is "0" */ + for (i = 0; i < MC_ASOC_N_INFO_STORE; i++) { + if (info_store_tbl[i].set) { + err = _McDrv_Ctrl(info_store_tbl[i].set, + (void *)mc_asoc + + info_store_tbl[i].offset, + NULL, + info_store_tbl[i].flags); + if (err != MCDRV_SUCCESS) { + dev_err(codec->dev, + "%d: Error in mc_asoc_resume\n", err); + err = -EIO; + goto error; + } + } + } + + mc_asoc->hsdet_store.bEnPlugDetDb = + stHSDetInfo_Default.bEnPlugDetDb; + err = _McDrv_Ctrl(MCDRV_SET_HSDET, + (void *)&mc_asoc->hsdet_store, + (void *)&mc_asoc->hsdet2_store, + 0x7fffffff); + if (err != MCDRV_SUCCESS) { + dev_err(codec->dev, "%d: Error in mc_asoc_resume\n", err); + err = -EIO; + goto error; + } + + /* IRQ Initialize */ + err = init_irq(codec); + if (err < 0) { + dev_err(codec->dev, "%d: Error in init_irq\n", err); + goto error; + } +#endif + +error: + mc_asoc_unlock("mc_asoc_resume"); + return err; +} + +static int set_bias_level( + struct snd_soc_codec *codec, + enum snd_soc_bias_level level) +{ + pr_debug("%s codec[%p] level[%d]\n", __func__, codec, level); + codec->dapm.bias_level = level; + return 0; +} +static int mc_asoc_set_bias_level( + struct snd_soc_codec *codec, + enum snd_soc_bias_level level) +{ + mc_asoc_lock("mc_asoc_set_bias_level"); + set_bias_level(codec, level); + mc_asoc_unlock("mc_asoc_set_bias_level"); + return 0; +} + +struct snd_soc_codec_driver mc_asoc_codec_dev = { + .probe = mc_asoc_probe, + .remove = mc_asoc_remove, + .suspend = mc_asoc_suspend, + .resume = mc_asoc_resume, + .read = mc_asoc_read_reg, + .write = mc_asoc_write_reg, + .reg_cache_size = MC_ASOC_N_REG, + .reg_word_size = sizeof(u16), + .reg_cache_step = 1, + .idle_bias_off = true, + .set_bias_level = mc_asoc_set_bias_level +}; + +static int spi_rw(u8 *tx, u8 *rx, int len) +{ + struct spi_message spi_msg; + struct spi_transfer spi_xfer; + + /* Initialize SPI ,message */ + spi_message_init(&spi_msg); + + /* Initialize SPI transfer */ + memset(&spi_xfer, 0, sizeof spi_xfer); + spi_xfer.len = len; + spi_xfer.tx_buf = tx; + spi_xfer.rx_buf = rx; + + /* Add SPI transfer to SPI message */ + spi_message_add_tail(&spi_xfer, &spi_msg); + +#if 0 + { + int i; + char tmp[20], str[256]; + tmp[0] = str[0] = 0; + sprintf(tmp, "tx len %d:\n", spi_xfer.len); + strcat(str, tmp); + for (i = 0; i < spi_xfer.len && i < 32; i++) { + sprintf(tmp, " %02X", ((u8 *)spi_xfer.tx_buf)[i]); + strcat(str, tmp); + } + strcat(str, "\n"); + dbg_info("%s", str); + } +#endif + + /* Perform synchronous SPI transfer */ + if (spi_sync(mc_asoc_spi, &spi_msg)) { + dev_err(&mc_asoc_spi->dev, "spi_sync failure\n"); + return -EIO; + } + +#if 0 + if (spi_xfer.rx_buf) { + int i; + char tmp[20], str[256]; + tmp[0] = str[0] = 0; + sprintf(tmp, "rx len %d:\n", spi_xfer.len); + strcat(str, tmp); + for (i = 1; i < spi_xfer.len && i < 32; i++) { + sprintf(tmp, " %02X", ((u8 *)spi_xfer.rx_buf)[i]); + strcat(str, tmp); + } + strcat(str, "\n"); + dbg_info("%s", str); + } +#endif + return 0; +} + +static u8 buf[1024]; +void mc_asoc_read_data( + UINT8 bSlaveAdr, + UINT32 dAddress, + UINT8 *pbData, + UINT32 dSize) +{ + u8 *rx = NULL; + u8 *readBuf = buf; + + if ((dSize+2) > sizeof(buf)) { + rx = kmalloc(dSize+2, GFP_KERNEL); + if (rx == NULL) { + printk(KERN_ERR "Failed to ReadReg\n"); + return; + } + readBuf = rx; + } + readBuf[0] = (u8)(dAddress<<1) | 0x80; + if (dSize > 1) + readBuf[0] |= 0x01; /* burst */ + spi_rw(readBuf, readBuf+2, dSize+1); + memcpy(pbData, readBuf+3, dSize); +#ifdef CONFIG_SND_SOC_YAMAHA_YMU831_DEBUG + { + int i; + char tmp[20], str[256]; + tmp[0] = str[0] = 0; +#ifdef SHOW_REG_ACCESS + pr_info("read %02X:", (UINT8)dAddress); +#endif + strcat(str, "rx data:"); + for (i = 0; i < dSize && i < 32; i++) { + sprintf(tmp, " %02X", pbData[i]); + strcat(str, tmp); + } + strcat(str, "\n"); +#ifdef SHOW_REG_ACCESS + pr_info("%s", str); +#endif + } +#endif + if (rx != NULL) + kfree(rx); +} + +void mc_asoc_write_data( + UINT8 bSlaveAdr, + const UINT8 *pbData, + UINT32 dSize) +{ + spi_rw((u8 *)pbData, NULL, dSize); +#ifdef CONFIG_SND_SOC_YAMAHA_YMU831_DEBUG + { +#ifdef SHOW_REG_ACCESS + int i; + char tmp[20], str[256]; + tmp[0] = str[0] = 0; + strcat(str, "tx data:"); + for (i = 0; i < dSize; i++) { + if (strlen(str) >= 72) { + strcat(str, "\n"); + pr_info("%s", str); + str[0] = 0; + } + sprintf(tmp, " %02X", pbData[i]); + strcat(str, tmp); + } + strcat(str, "\n"); + pr_info("%s", str); +#endif + } +#endif +} + +void mc_asoc_set_codec_ldod(int status) +{ + struct mc_asoc_data *mc_asoc = NULL; + + mc_asoc = mc_asoc_get_mc_asoc(mc_asoc_codec); + if (mc_asoc->pdata != NULL) { + if (mc_asoc->pdata->set_codec_ldod != NULL) { + (*mc_asoc->pdata->set_codec_ldod)(status); + if (status == 1) { + ; + usleep_range(500, 600); + } + } + } +} + +static int gpio_codec_en; + +static void ymu831_set_ldod(int status) +{ + if (gpio_codec_en) + gpio_set_value(gpio_codec_en, status); +} + +static struct mc_asoc_platform_data *mc_asoc_parse_dt(struct device *dev) +{ + struct mc_asoc_platform_data *pdata; + struct device_node *node = dev->of_node; + int ret; + + pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + if (!pdata) { + dev_err(dev, "failed to allocate platform data\n"); + return ERR_PTR(-ENOMEM); + } + + gpio_codec_en = of_get_named_gpio(node, "codec-en-gpios", 0); + if (!gpio_is_valid(gpio_codec_en)) + return 0; + ret = devm_gpio_request_one(dev, gpio_codec_en, GPIOF_OUT_INIT_HIGH, "codec-enable"); + if (ret < 0) { + dev_err(dev, "failed to request gpio\n"); + return ERR_PTR(-ENOMEM); + } + pr_info("gpio: %d, ret: %d\n", gpio_codec_en, ret); + + pdata->set_codec_mclk = NULL; + pdata->set_codec_ldod = ymu831_set_ldod; + return pdata; +} + +static int mc_asoc_spi_probe( + struct spi_device *spi) +{ + struct mc_asoc_priv *mc_asoc_priv; + struct mc_asoc_data *mc_asoc; + int err; + + TRACE_FUNC(); + + mc_asoc_priv = kzalloc(sizeof(struct mc_asoc_priv), GFP_KERNEL); + if (!mc_asoc_priv) { + err = -ENOMEM; + goto err_alloc_priv; + } + mc_asoc = &mc_asoc_priv->data; + mc_asoc->pdata = + (struct mc_asoc_platform_data *)spi->dev.platform_data; + + if (spi->dev.of_node) { + mc_asoc->pdata = mc_asoc_parse_dt(&spi->dev); + mc_asoc->pdata->irq = spi->irq; + if (IS_ERR(mc_asoc->pdata)) { + dev_err(&spi->dev, "failed to parse DT data\n"); + return PTR_ERR(mc_asoc->pdata); + } + } + +#ifndef FEATURE_MCLK_CONTROL_BY_YMU831 + if (mc_asoc->pdata->set_codec_mclk) + mc_asoc->pdata->set_codec_mclk(1, 0); +#endif + + mutex_init(&mc_asoc->mutex); + dev_set_drvdata(&spi->dev, mc_asoc_priv); + mc_asoc_spi = spi; + + err = snd_soc_register_codec(&spi->dev, &mc_asoc_codec_dev, + mc_asoc_dai, ARRAY_SIZE(mc_asoc_dai)); + if (err < 0) + goto err_reg_codec; + + goto exit; + +err_reg_codec: + kfree(mc_asoc_priv); +err_alloc_priv: + dev_err(&spi->dev, "err=%d: failed to probe MC_ASOC\n", err); + +exit: + return err; +} + +static int mc_asoc_spi_remove(struct spi_device *spi) +{ + struct mc_asoc_priv *mc_asoc_priv = dev_get_drvdata(&spi->dev); + struct mc_asoc_data *mc_asoc; + + TRACE_FUNC(); + + mc_asoc = &mc_asoc_priv->data; + mc_asoc->pdata = + (struct mc_asoc_platform_data *)spi->dev.platform_data; + +#ifndef FEATURE_MCLK_CONTROL_BY_YMU831 + if (mc_asoc->pdata->set_codec_mclk) + mc_asoc->pdata->set_codec_mclk(0, 0); +#endif + + if (mc_asoc_priv != 0) { + mutex_destroy(&mc_asoc_priv->data.mutex); + kfree(mc_asoc_priv); + } + return 0; +} + +static struct spi_driver mc_asoc_spi_driver = { + .driver = { + .name = MC_ASOC_HWDEP_ID, + .owner = THIS_MODULE, + }, + .probe = mc_asoc_spi_probe, + .remove = mc_asoc_spi_remove, +}; +/* + * Module init and exit + */ +static int __init ymu831_init(void) +{ + int err = 0; + + TRACE_FUNC(); + + mutex_init(&mc_asoc_mutex); + mutex_init(&hsdet_mutex); + + err = spi_register_driver(&mc_asoc_spi_driver); + + if (err != 0) { + ; + printk(KERN_ERR "Failed to register MC ASoC Bus driver: %d\n", + err); + } + return err; +} +module_init(ymu831_init); + +static void __exit ymu831_exit(void) +{ + spi_unregister_driver(&mc_asoc_spi_driver); + mutex_destroy(&mc_asoc_mutex); + mutex_destroy(&hsdet_mutex); +} +module_exit(ymu831_exit); + +MODULE_AUTHOR("Yamaha Corporation"); +MODULE_DESCRIPTION("Yamaha YMU831 ALSA SoC codec driver"); +MODULE_LICENSE("GPL"); +MODULE_VERSION(MC_ASOC_DRIVER_VERSION); diff --git a/sound/soc/codecs/ymu831/ymu831.h b/sound/soc/codecs/ymu831/ymu831.h new file mode 100644 index 00000000000..b13abb15890 --- /dev/null +++ b/sound/soc/codecs/ymu831/ymu831.h @@ -0,0 +1,131 @@ +/* + * YMU831 ASoC codec driver + * + * Copyright (c) 2012 Yamaha Corporation + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + */ + +#ifndef YMU831_H +#define YMU831_H + +#include <sound/pcm.h> +#include <sound/soc.h> +#include "mcdriver.h" + +#define MC_ASOC_NAME "ymu831" +/* + * dai: set_clkdiv + */ +/* div_id */ +#define MC_ASOC_BCLK_MULT 5 + +/* div for MC_ASOC_BCLK_MULT */ +#define MC_ASOC_LRCK_X64 (0) +#define MC_ASOC_LRCK_X48 (1) +#define MC_ASOC_LRCK_X32 (2) +#define MC_ASOC_LRCK_X512 (3) +#define MC_ASOC_LRCK_X256 (4) +#define MC_ASOC_LRCK_X192 (5) +#define MC_ASOC_LRCK_X128 (6) +#define MC_ASOC_LRCK_X96 (7) +#define MC_ASOC_LRCK_X24 (8) +#define MC_ASOC_LRCK_X16 (9) + +/* + * hwdep: ioctl + */ +#define MC_ASOC_MAGIC 'N' +#define MC_ASOC_IOCTL_SET_CTRL (1) +#define MC_ASOC_IOCTL_READ_REG (2) +#define MC_ASOC_IOCTL_WRITE_REG (3) +#define MC_ASOC_IOCTL_NOTIFY_HOLD (4) +#define MC_ASOC_IOCTL_GET_DSP_DATA (5) +#define MC_ASOC_IOCTL_SET_DSP_DATA (6) + +struct ymc_ctrl_args { + void *param; + unsigned long size; + unsigned long option; +}; + +struct ymc_dspdata_args { + unsigned char *buf; + unsigned long bufsize; + unsigned long size; +}; + +#define YMC_IOCTL_SET_CTRL \ + _IOW(MC_ASOC_MAGIC, MC_ASOC_IOCTL_SET_CTRL, struct ymc_ctrl_args) + +#define YMC_IOCTL_READ_REG \ + _IOWR(MC_ASOC_MAGIC, MC_ASOC_IOCTL_READ_REG, struct MCDRV_REG_INFO) + +#define YMC_IOCTL_WRITE_REG \ + _IOWR(MC_ASOC_MAGIC, MC_ASOC_IOCTL_WRITE_REG, struct MCDRV_REG_INFO) + +#define YMC_IOCTL_NOTIFY_HOLD \ + _IOWR(MC_ASOC_MAGIC, MC_ASOC_IOCTL_NOTIFY_HOLD, unsigned long) +#define YMC_IOCTL_GET_DSP_DATA \ + _IOWR(MC_ASOC_MAGIC, MC_ASOC_IOCTL_GET_DSP_DATA, \ + struct ymc_dspdata_args) +#define YMC_IOCTL_SET_DSP_DATA \ + _IOWR(MC_ASOC_MAGIC, MC_ASOC_IOCTL_SET_DSP_DATA, \ + struct ymc_dspdata_args) + +#define YMC_DSP_OUTPUT_BASE (0x00000000) +#define YMC_DSP_OUTPUT_SP (0x00000001) +#define YMC_DSP_OUTPUT_RC (0x00000002) +#define YMC_DSP_OUTPUT_HP (0x00000003) +#define YMC_DSP_OUTPUT_LO1 (0x00000004) +#define YMC_DSP_OUTPUT_LO2 (0x00000005) +#define YMC_DSP_OUTPUT_BT (0x00000006) + +#define YMC_DSP_INPUT_BASE (0x00000010) +#define YMC_DSP_INPUT_MAINMIC (0x00000020) +#define YMC_DSP_INPUT_SUBMIC (0x00000030) +#define YMC_DSP_INPUT_2MIC (0x00000040) +#define YMC_DSP_INPUT_HEADSET (0x00000050) +#define YMC_DSP_INPUT_BT (0x00000060) +#define YMC_DSP_INPUT_LINEIN1 (0x00000070) +#define YMC_DSP_INPUT_LINEIN2 (0x00000080) + +#define YMC_DSP_VOICECALL_BASE_1MIC (0x00000100) +#define YMC_DSP_VOICECALL_BASE_2MIC (0x00000200) +#define YMC_DSP_VOICECALL_SP_1MIC (0x00000300) +#define YMC_DSP_VOICECALL_SP_2MIC (0x00000400) +#define YMC_DSP_VOICECALL_RC_1MIC (0x00000500) +#define YMC_DSP_VOICECALL_RC_2MIC (0x00000600) +#define YMC_DSP_VOICECALL_HP_1MIC (0x00000700) +#define YMC_DSP_VOICECALL_HP_2MIC (0x00000800) +#define YMC_DSP_VOICECALL_LO1_1MIC (0x00000900) +#define YMC_DSP_VOICECALL_LO1_2MIC (0x00000A00) +#define YMC_DSP_VOICECALL_LO2_1MIC (0x00000B00) +#define YMC_DSP_VOICECALL_LO2_2MIC (0x00000C00) +#define YMC_DSP_VOICECALL_HEADSET (0x00000D00) +#define YMC_DSP_VOICECALL_BT (0x00000E00) +#define YMC_DSP_VOICECALL_BASE_COMMON (0x00000F00) + +#define YMC_NOTITY_HOLD_OFF (0) +#define YMC_NOTITY_HOLD_ON (1) + +void mc_asoc_set_enable_clock_func( + int (*penableclkfn)(struct snd_soc_codec *, int, bool)); + +int ymu831_get_codec_suspended(struct snd_soc_codec *codec); + +#endif diff --git a/sound/soc/codecs/ymu831/ymu831_cfg.h b/sound/soc/codecs/ymu831/ymu831_cfg.h new file mode 100644 index 00000000000..092033cdec1 --- /dev/null +++ b/sound/soc/codecs/ymu831/ymu831_cfg.h @@ -0,0 +1,1034 @@ +/* + * YMU831 ASoC codec driver + * + * Copyright (c) 2012-2013 Yamaha Corporation + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + */ + +#ifndef YMU831_CFG_H +#define YMU831_CFG_H +#include <linux/input.h> +#include <linux/irq.h> + +#include "mcdriver.h" +#include "ymu831_priv.h" + +/* + * ALSA Version + */ +#define HSDET_WHILE_SUSPEND + +#define MAX_YMS_CTRL_PARAM_SIZE (524288UL) + +#define BUS_SEL_I2C (0) +#define BUS_SEL_SPI (1) +#define BUS_SEL_SLIM (2) +#define BUS_SELECT BUS_SEL_SPI + +#define CAPTURE_PORT_MUSIC (0) +#define CAPTURE_PORT_EXT (1) +#define CAPTURE_PORT CAPTURE_PORT_MUSIC + +#define MC_ASOC_PHYS_DIO0 MCDRV_PHYSPORT_DIO0 +#define MC_ASOC_PHYS_DIO1 MCDRV_PHYSPORT_DIO1 +#define MC_ASOC_PHYS_DIO2 MCDRV_PHYSPORT_DIO2 +#define MC_ASOC_PHYS_NONE MCDRV_PHYSPORT_NONE +#define MC_ASOC_PHYS_SLIM0 MCDRV_PHYSPORT_SLIM0 +#define MC_ASOC_PHYS_SLIM1 MCDRV_PHYSPORT_SLIM1 +#define MC_ASOC_PHYS_SLIM2 MCDRV_PHYSPORT_SLIM2 +#define MUSIC_PHYSICAL_PORT MC_ASOC_PHYS_DIO0 +#define EXT_PHYSICAL_PORT MC_ASOC_PHYS_DIO2 +#define VOICE_PHYSICAL_PORT MC_ASOC_PHYS_DIO1 +#define HIFI_PHYSICAL_PORT MC_ASOC_PHYS_DIO0 + +#define VOICE_RECORDING_UNMUTE (1) + +#define INCALL_MIC_SP MC_ASOC_INCALL_MIC_MAINMIC +#define INCALL_MIC_RC MC_ASOC_INCALL_MIC_MAINMIC +#define INCALL_MIC_HP MC_ASOC_INCALL_MIC_MAINMIC +#define INCALL_MIC_LO1 MC_ASOC_INCALL_MIC_MAINMIC +#define INCALL_MIC_LO2 MC_ASOC_INCALL_MIC_MAINMIC + +#define MIC_NONE (0) +#define MIC_1 (1) +#define MIC_2 (2) +#define MIC_3 (3) +#define MIC_4 (4) +#define MIC_PDM0 (5) +#define MIC_PDM1 (6) + +#define MAIN_MIC MIC_1 +#define SUB_MIC MIC_2 +#define HEADSET_MIC MIC_4 + +#define BIAS_OFF (0) +#define BIAS_ON_ALWAYS (1) +#define BIAS_SYNC_MIC (2) +#define MIC1_BIAS BIAS_SYNC_MIC +#define MIC2_BIAS BIAS_SYNC_MIC +#define MIC3_BIAS BIAS_SYNC_MIC +#define MIC4_BIAS BIAS_SYNC_MIC + +#define IRQ_TYPE IRQ_TYPE_EDGE_FALLING + +#define AUTO_POWEROFF_OFF (0) +#define AUTO_POWEROFF_ON (1) +#define AUTO_POWEROFF AUTO_POWEROFF_ON + +static const struct mc_asoc_setup mc_asoc_cfg_setup = { + /* init */ + { + MCDRV_CKSEL_CMOS_CMOS, /* bCkSel */ + MCDRV_CKINPUT_CLKI0_CLKI0, /* bCkInput */ + 0x04, /* bPllModeA */ + 0x16, /* bPllPrevDivA */ + 0x0087, /* wPllFbDivA */ + 0x2B02, /* wPllFracA */ + 1, /* bPllFreqA */ + 0x04, /* bPllModeB */ + 0x16, /* bPllPrevDivB */ + 0x0043, /* wPllFbDivB */ + 0x9581, /* wPllFracB */ + 0, /* bPllFreqB */ + 0, /* bHsdetClk */ + MCDRV_DAHIZ_HIZ, /* bDio0SdoHiz */ + MCDRV_DAHIZ_HIZ, /* bDio1SdoHiz */ + MCDRV_DAHIZ_HIZ, /* bDio2SdoHiz */ + MCDRV_DAHIZ_HIZ, /* bDio0ClkHiz */ + MCDRV_DAHIZ_HIZ, /* bDio1ClkHiz */ + MCDRV_DAHIZ_HIZ, /* bDio2ClkHiz */ + MCDRV_PCMHIZ_LOW, /* bDio0PcmHiz */ + MCDRV_PCMHIZ_LOW, /* bDio1PcmHiz */ + MCDRV_PCMHIZ_LOW, /* bDio2PcmHiz */ + MCDRV_PA_GPIO, /* bPa0Func */ + MCDRV_PA_GPIO, /* bPa1Func */ + MCDRV_PA_GPIO, /* bPa2Func */ + MCDRV_POWMODE_FULL, /* bPowerMode */ + MCDRV_MBSEL_22, /* bMbSel1 */ + MCDRV_MBSEL_22, /* bMbSel2 */ + MCDRV_MBSEL_22, /* bMbSel3 */ + MCDRV_MBSEL_22, /* bMbSel4 */ + MCDRV_MBSDISCH_1000, /* bMbsDisch */ + MCDRV_NONCLIP_OFF, /* bNonClip */ + MCDRV_LINE_STEREO, /* bLineIn1Dif */ + MCDRV_LINE_STEREO, /* bLineOut1Dif */ + MCDRV_LINE_STEREO, /* bLineOut2Dif */ + MCDRV_MIC_DIF, /* bMic1Sng */ + MCDRV_MIC_DIF, /* bMic2Sng */ + MCDRV_MIC_DIF, /* bMic3Sng */ + MCDRV_MIC_DIF, /* bMic4Sng */ + MCDRV_ZC_OFF, /* bZcLineOut1 */ + MCDRV_ZC_OFF, /* bZcLineOut2 */ + MCDRV_ZC_ON, /* bZcRc */ + MCDRV_ZC_ON, /* bZcSp */ + MCDRV_ZC_OFF, /* bZcHp */ + MCDRV_SVOL_ON, /* bSvolLineOut1 */ + MCDRV_SVOL_ON, /* bSvolLineOut2 */ + MCDRV_SVOL_ON, /* bSvolRc */ + MCDRV_SVOL_ON, /* bSvolSp */ + MCDRV_SVOL_ON, /* bSvolHp */ + MCDRV_RCIMP_FIXLOW, /* bRcHiz */ + MCDRV_WL_LOFF_ROFF, /* bSpHiz */ + MCDRV_IMP_LFIXLOW_RFIXLOW, /* bHpHiz */ + MCDRV_IMP_LFIXLOW_RFIXLOW, /* bLineOut1Hiz */ + MCDRV_IMP_LFIXLOW_RFIXLOW, /* bLineOut2Hiz */ + MCDRV_CPMOD_MID, /* bCpMod */ + MCDRV_RBSEL_2_2K, /* bRbSel */ + MCDRV_PLUG_LRGM, /* bPlugSel */ + MCDRV_GNDDET_OFF, /* bGndDet */ + MCDRV_PPD_OFF, /* bPpdRc */ + MCDRV_PPD_OFF, /* bPpdSp */ + MCDRV_PPD_OFF, /* bPpdHp */ + MCDRV_PPD_OFF, /* bPpdLineOut1 */ + MCDRV_PPD_OFF, /* bPpdLineOut2 */ + { + /* dWaitTime */ + { + 5000, 5000, 5000, 5000, 25000, 15000, 2000, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + }, + /* dPollInterval */ + { + 1000, 1000, 1000, 1000, 1000, 1000, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + }, + /* dPollTimeOut */ + { + 1000, 1000, 1000, 1000, 1000, 1000, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + } + }, + }, + /* init2 */ + { + { + MCDRV_DOA_DRV_HIGH, + MCDRV_SCKMSK_OFF, + MCDRV_SPMN_OFF_9, + 0x03, 0x30, 0x30, 0x21, 0x03, 0xC0, 0x6B, 0x00, + 0xC0, 0x01, 0x0F, 0, 0, 0, 0, 0, 0 + } + }, + /* rslot */ + { + 0, 1, 2 + }, + /* tslot */ + { + 0, 1, 2 + }, +}; + +static const struct MCDRV_DIO_PORT stMusicPort_Default = { + /* sDioCommon */ + { + /* bMasterSlave : Master / Slave Setting */ + /* MCDRV_DIO_SLAVE (0): Slave */ + /* MCDRV_DIO_MASTER (1): Master */ + MCDRV_DIO_MASTER, + + /* bAutoFs : Sampling frequency automatic measurement + ON/OFF Setting in slave mode */ + /* MCDRV_AUTOFS_OFF (0): OFF */ + /* MCDRV_AUTOFS_ON (1): ON */ + MCDRV_AUTOFS_ON , + + /* bFs : Sampling Rate Setting */ + /* MCDRV_FS_48000 (0): 48kHz */ + /* MCDRV_FS_44100 (1): 44.1kHz */ + /* MCDRV_FS_32000 (2): 32kHz */ + /* MCDRV_FS_24000 (4): 24kHz */ + /* MCDRV_FS_22050 (5): 22.05kHz */ + /* MCDRV_FS_16000 (6): 16kHz */ + /* MCDRV_FS_12000 (8): 12kHz */ + /* MCDRV_FS_11025 (9): 11.025kHz */ + /* MCDRV_FS_8000 (10): 8kHz */ + MCDRV_FS_48000, + + /* bBckFs : Bit Clock Frequency Setting */ + /* MCDRV_BCKFS_64 (0): LRCK x 64 */ + /* MCDRV_BCKFS_48 (1): LRCK x 48 */ + /* MCDRV_BCKFS_32 (2): LRCK x 32 */ + /* MCDRV_BCKFS_512 (4): LRCK x 512 */ + /* MCDRV_BCKFS_256 (5): LRCK x 256 */ + /* MCDRV_BCKFS_192 (6): LRCK x 192 */ + /* MCDRV_BCKFS_128 (7): LRCK x 128 */ + /* MCDRV_BCKFS_96 (8): LRCK x 96 */ + /* MCDRV_BCKFS_24 (9): LRCK x 24 */ + /* MCDRV_BCKFS_16 (10): LRCK x 16 */ + /* MCDRV_BCKFS_8 (11): LRCK x 8 */ + /* MCDRV_BCKFS_SLAVE (15): PCM I/F SLAVE */ + MCDRV_BCKFS_32, + + /* bInterface : Interface Selection */ + /* MCDRV_DIO_DA (0): Digital Audio */ + /* MCDRV_DIO_PCM (1): PCM */ + MCDRV_DIO_DA, + + /* bBckInvert : Bit Clock Inversion Setting */ + /* MCDRV_BCLK_NORMAL (0): Normal Operation */ + /* MCDRV_BCLK_INVERT (1): Clock Inverted */ + MCDRV_BCLK_NORMAL, + + /* MCDRV_SRC_NOT_THRU (0) */ + /* MCDRV_SRC_THRU (1) */ + MCDRV_SRC_NOT_THRU, + + /* bPcmHizTim : High Impedance transition timing + after transmitting the last PCM I/F data */ + /* MCDRV_PCMHIZTIM_FALLING (0): + BCLK#* Falling Edge */ + /* MCDRV_PCMHIZTIM_RISING (1): + BCLK#* Rising Edge */ + MCDRV_PCMHIZTIM_FALLING, + + /* bPcmFrame : Frame Mode Setting with PCM interface*/ + /* MCDRV_PCM_SHORTFRAME (0): Short Frame */ + /* MCDRV_PCM_LONGFRAME (1): Long Frame */ + MCDRV_PCM_SHORTFRAME, + + /* bPcmHighPeriod : + LR clock High time setting with PCM selected + and Master selected */ + /* 0 to 31: + High level keeps during the period of time of + (setting value + 1) of the bit clock. */ + 0, + }, + /* sDir */ + { + /* sDaFormat : Digital Audio Format Information */ + { + /* bBitSel : Bit Width Setting */ + /* MCDRV_BITSEL_16 (0): 16bit */ + /* MCDRV_BITSEL_20 (1): 20bit */ + /* MCDRV_BITSEL_24 (2): 24bit */ + /* MCDRV_BITSEL_32 (3): 32bit */ + MCDRV_BITSEL_16, + + /* bMode : Data Format Setting */ + /* MCDRV_DAMODE_HEADALIGN (0): + Left-justified Format */ + /* MCDRV_DAMODE_I2S (1): I2S */ + /* MCDRV_DAMODE_TAILALIGN (2): + Right-justified Format */ + MCDRV_DAMODE_I2S + }, + /* sPcmFormat : PCM Format Information */ + { + /* bMono : Mono / Stereo Setting */ + /* MCDRV_PCM_STEREO (0):Stereo */ + /* MCDRV_PCM_MONO (1):Mono */ + MCDRV_PCM_MONO , + /* bOrder : Bit Order Setting */ + /* MCDRV_PCM_MSB_FIRST (0): MSB First */ + /* MCDRV_PCM_LSB_FIRST (1): LSB First */ + MCDRV_PCM_MSB_FIRST, + /* bLaw : Data Format Setting */ + /* MCDRV_PCM_LINEAR (0): Linear */ + /* MCDRV_PCM_ALAW (1): A-Law */ + /* MCDRV_PCM_MULAW (2): u-Law */ + MCDRV_PCM_LINEAR, + /* bBitSel : Bit Width Setting */ + /* MCDRV_PCM_BITSEL_8 (0):8 bits */ + /* MCDRV_PCM_BITSEL_16 (1):16 bits */ + /* MCDRV_PCM_BITSEL_24 (2):24 bits */ + MCDRV_PCM_BITSEL_8 + } + }, + /* sDit */ + { + MCDRV_STMODE_ZERO, /* bStMode */ + MCDRV_SDOUT_NORMAL, /* bEdge */ + /* sDaFormat : Digital Audio Format Information */ + { + /* bBitSel : Bit Width Setting */ + /* MCDRV_BITSEL_16 (0): 16bit */ + /* MCDRV_BITSEL_20 (1): 20bit */ + /* MCDRV_BITSEL_24 (2): 24bit */ + /* MCDRV_BITSEL_32 (3): 32bit */ + MCDRV_BITSEL_16, + + /* bMode : Data Format Setting */ + /* MCDRV_DAMODE_HEADALIGN (0): + Left-justified Format */ + /* MCDRV_DAMODE_I2S (1): I2S */ + /* MCDRV_DAMODE_TAILALIGN (2): + Right-justified Format */ + MCDRV_DAMODE_I2S + }, + /* sPcmFormat : PCM Format Information */ + { + /* bMono : Mono / Stereo Setting */ + /* MCDRV_PCM_STEREO (0):Stereo */ + /* MCDRV_PCM_MONO (1):Mono */ + MCDRV_PCM_MONO , + /* bOrder : Bit Order Setting */ + /* MCDRV_PCM_MSB_FIRST (0): MSB First */ + /* MCDRV_PCM_LSB_FIRST (1): LSB First */ + MCDRV_PCM_MSB_FIRST, + /* bLaw : Data Format Setting */ + /* MCDRV_PCM_LINEAR (0): Linear */ + /* MCDRV_PCM_ALAW (1): A-Law */ + /* MCDRV_PCM_MULAW (2): u-Law */ + MCDRV_PCM_LINEAR, + /* bBitSel : Bit Width Setting */ + /* MCDRV_PCM_BITSEL_8 (0):8 bits */ + /* MCDRV_PCM_BITSEL_16 (1):16 bits */ + /* MCDRV_PCM_BITSEL_24 (2):24 bits */ + MCDRV_PCM_BITSEL_16 + } + } +}; + +static const struct MCDRV_DIO_PORT stExtPort_Default = { + /* sDioCommon */ + { + /* bMasterSlave : Master / Slave Setting */ + /* MCDRV_DIO_SLAVE (0): Slave */ + /* MCDRV_DIO_MASTER (1): Master */ + MCDRV_DIO_MASTER, + + /* bAutoFs : Sampling frequency automatic measurement + ON/OFF Setting in slave mode */ + /* MCDRV_AUTOFS_OFF (0): OFF */ + /* MCDRV_AUTOFS_ON (1): ON */ + MCDRV_AUTOFS_ON , + + /* bFs : Sampling Rate Setting */ + /* MCDRV_FS_48000 (0): 48kHz */ + /* MCDRV_FS_44100 (1): 44.1kHz */ + /* MCDRV_FS_32000 (2): 32kHz */ + /* MCDRV_FS_24000 (4): 24kHz */ + /* MCDRV_FS_22050 (5): 22.05kHz */ + /* MCDRV_FS_16000 (6): 16kHz */ + /* MCDRV_FS_12000 (8): 12kHz */ + /* MCDRV_FS_11025 (9): 11.025kHz */ + /* MCDRV_FS_8000 (10): 8kHz */ + MCDRV_FS_8000, + + /* bBckFs : Bit Clock Frequency Setting */ + /* MCDRV_BCKFS_64 (0): LRCK x 64 */ + /* MCDRV_BCKFS_48 (1): LRCK x 48 */ + /* MCDRV_BCKFS_32 (2): LRCK x 32 */ + /* MCDRV_BCKFS_512 (4): LRCK x 512 */ + /* MCDRV_BCKFS_256 (5): LRCK x 256 */ + /* MCDRV_BCKFS_192 (6): LRCK x 192 */ + /* MCDRV_BCKFS_128 (7): LRCK x 128 */ + /* MCDRV_BCKFS_96 (8): LRCK x 96 */ + /* MCDRV_BCKFS_24 (9): LRCK x 24 */ + /* MCDRV_BCKFS_16 (10): LRCK x 16 */ + /* MCDRV_BCKFS_8 (11): LRCK x 8 */ + /* MCDRV_BCKFS_SLAVE (15): PCM I/F SLAVE */ + MCDRV_BCKFS_32, + + /* bInterface : Interface Selection */ + /* MCDRV_DIO_DA (0): Digital Audio */ + /* MCDRV_DIO_PCM (1): PCM */ + MCDRV_DIO_DA, + + /* bBckInvert : Bit Clock Inversion Setting */ + /* MCDRV_BCLK_NORMAL (0): Normal Operation */ + /* MCDRV_BCLK_INVERT (1): Clock Inverted */ + MCDRV_BCLK_NORMAL, + + /* MCDRV_SRC_NOT_THRU (0) */ + /* MCDRV_SRC_THRU (1) */ + MCDRV_SRC_NOT_THRU, + + /* bPcmHizTim : High Impedance transition timing + after transmitting the last PCM I/F data */ + /* MCDRV_PCMHIZTIM_FALLING (0): + BCLK#* Falling Edge */ + /* MCDRV_PCMHIZTIM_RISING (1): + BCLK#* Rising Edge */ + MCDRV_PCMHIZTIM_FALLING, + + /* bPcmFrame : Frame Mode Setting with PCM interface*/ + /* MCDRV_PCM_SHORTFRAME (0): Short Frame */ + /* MCDRV_PCM_LONGFRAME (1): Long Frame */ + MCDRV_PCM_SHORTFRAME, + + /* bPcmHighPeriod : + LR clock High time setting with PCM selected + and Master selected */ + /* 0 to 31: + High level keeps during the period of time of + (setting value + 1) of the bit clock. */ + 0, + }, + /* sDir */ + { + /* sDaFormat : Digital Audio Format Information */ + { + /* bBitSel : Bit Width Setting */ + /* MCDRV_BITSEL_16 (0): 16bit */ + /* MCDRV_BITSEL_20 (1): 20bit */ + /* MCDRV_BITSEL_24 (2): 24bit */ + /* MCDRV_BITSEL_32 (3): 32bit */ + MCDRV_BITSEL_16, + + /* bMode : Data Format Setting */ + /* MCDRV_DAMODE_HEADALIGN (0): + Left-justified Format */ + /* MCDRV_DAMODE_I2S (1): I2S */ + /* MCDRV_DAMODE_TAILALIGN (2): + Right-justified Format */ + MCDRV_DAMODE_I2S + }, + /* sPcmFormat : PCM Format Information */ + { + /* bMono : Mono / Stereo Setting */ + /* MCDRV_PCM_STEREO (0):Stereo */ + /* MCDRV_PCM_MONO (1):Mono */ + MCDRV_PCM_MONO , + /* bOrder : Bit Order Setting */ + /* MCDRV_PCM_MSB_FIRST (0): MSB First */ + /* MCDRV_PCM_LSB_FIRST (1): LSB First */ + MCDRV_PCM_LSB_FIRST, + /* bLaw : Data Format Setting */ + /* MCDRV_PCM_LINEAR (0): Linear */ + /* MCDRV_PCM_ALAW (1): A-Law */ + /* MCDRV_PCM_MULAW (2): u-Law */ + MCDRV_PCM_LINEAR, + /* bBitSel : Bit Width Setting */ + /* MCDRV_PCM_BITSEL_8 (0):8 bits */ + /* MCDRV_PCM_BITSEL_16 (1):16 bits */ + /* MCDRV_PCM_BITSEL_24 (2):24 bits */ + MCDRV_PCM_BITSEL_16 + } + }, + /* sDit */ + { + MCDRV_STMODE_ZERO, /* bStMode */ + MCDRV_SDOUT_NORMAL, /* bEdge */ + /* sDaFormat : Digital Audio Format Information */ + { + /* bBitSel : Bit Width Setting */ + /* MCDRV_BITSEL_16 (0): 16bit */ + /* MCDRV_BITSEL_20 (1): 20bit */ + /* MCDRV_BITSEL_24 (2): 24bit */ + /* MCDRV_BITSEL_32 (3): 32bit */ + MCDRV_BITSEL_16, + + /* bMode : Data Format Setting */ + /* MCDRV_DAMODE_HEADALIGN (0): + Left-justified Format */ + /* MCDRV_DAMODE_I2S (1): I2S */ + /* MCDRV_DAMODE_TAILALIGN (2): + Right-justified Format */ + MCDRV_DAMODE_I2S + }, + /* sPcmFormat : PCM Format Information */ + { + /* bMono : Mono / Stereo Setting */ + /* MCDRV_PCM_STEREO (0):Stereo */ + /* MCDRV_PCM_MONO (1):Mono */ + MCDRV_PCM_MONO , + /* bOrder : Bit Order Setting */ + /* MCDRV_PCM_MSB_FIRST (0): MSB First */ + /* MCDRV_PCM_LSB_FIRST (1): LSB First */ + MCDRV_PCM_LSB_FIRST, + /* bLaw : Data Format Setting */ + /* MCDRV_PCM_LINEAR (0): Linear */ + /* MCDRV_PCM_ALAW (1): A-Law */ + /* MCDRV_PCM_MULAW (2): u-Law */ + MCDRV_PCM_LINEAR, + /* bBitSel : Bit Width Setting */ + /* MCDRV_PCM_BITSEL_8 (0):8 bits */ + /* MCDRV_PCM_BITSEL_16 (1):16 bits */ + /* MCDRV_PCM_BITSEL_24 (2):24 bits */ + MCDRV_PCM_BITSEL_16 + } + } +}; + +static const struct MCDRV_DIO_PORT stVoicePort_Default = { + /* sDioCommon */ + { + /* bMasterSlave : Master / Slave Setting */ + /* MCDRV_DIO_SLAVE (0): Slave */ + /* MCDRV_DIO_MASTER (1): Master */ + MCDRV_DIO_SLAVE, + + /* bAutoFs : Sampling frequency automatic measurement + ON/OFF Setting in slave mode */ + /* MCDRV_AUTOFS_OFF (0): OFF */ + /* MCDRV_AUTOFS_ON (1): ON */ + MCDRV_AUTOFS_ON , + + /* bFs : Sampling Rate Setting */ + /* MCDRV_FS_48000 (0): 48kHz */ + /* MCDRV_FS_44100 (1): 44.1kHz */ + /* MCDRV_FS_32000 (2): 32kHz */ + /* MCDRV_FS_24000 (4): 24kHz */ + /* MCDRV_FS_22050 (5): 22.05kHz */ + /* MCDRV_FS_16000 (6): 16kHz */ + /* MCDRV_FS_12000 (8): 12kHz */ + /* MCDRV_FS_11025 (9): 11.025kHz */ + /* MCDRV_FS_8000 (10): 8kHz */ + MCDRV_FS_8000, + + /* bBckFs : Bit Clock Frequency Setting */ + /* MCDRV_BCKFS_64 (0): LRCK x 64 */ + /* MCDRV_BCKFS_48 (1): LRCK x 48 */ + /* MCDRV_BCKFS_32 (2): LRCK x 32 */ + /* MCDRV_BCKFS_512 (4): LRCK x 512 */ + /* MCDRV_BCKFS_256 (5): LRCK x 256 */ + /* MCDRV_BCKFS_192 (6): LRCK x 192 */ + /* MCDRV_BCKFS_128 (7): LRCK x 128 */ + /* MCDRV_BCKFS_96 (8): LRCK x 96 */ + /* MCDRV_BCKFS_24 (9): LRCK x 24 */ + /* MCDRV_BCKFS_16 (10): LRCK x 16 */ + /* MCDRV_BCKFS_8 (11): LRCK x 8 */ + /* MCDRV_BCKFS_SLAVE (15): PCM I/F SLAVE */ + MCDRV_BCKFS_32, + + /* bInterface : Interface Selection */ + /* MCDRV_DIO_DA (0): Digital Audio */ + /* MCDRV_DIO_PCM (1): PCM */ + MCDRV_DIO_DA, + + /* bBckInvert : Bit Clock Inversion Setting */ + /* MCDRV_BCLK_NORMAL (0): Normal Operation */ + /* MCDRV_BCLK_INVERT (1): Clock Inverted */ + MCDRV_BCLK_NORMAL, + + /* bSrcThru */ + /* MCDRV_SRC_NOT_THRU (0) */ + /* MCDRV_SRC_THRU (1) */ + MCDRV_SRC_NOT_THRU, + + /* bPcmHizTim : High Impedance transition timing + after transmitting the last PCM I/F data */ + /* MCDRV_PCMHIZTIM_FALLING (0): + BCLK#* Falling Edge */ + /* MCDRV_PCMHIZTIM_RISING (1): + BCLK#* Rising Edge */ + MCDRV_PCMHIZTIM_FALLING, + + /* bPcmFrame : Frame Mode Setting with PCM interface*/ + /* MCDRV_PCM_SHORTFRAME (0): Short Frame */ + /* MCDRV_PCM_LONGFRAME (1): Long Frame */ + MCDRV_PCM_SHORTFRAME, + + /* bPcmHighPeriod : + LR clock High time setting with PCM selected + and Master selected */ + /* 0 to 31: + High level keeps during the period of time of + (setting value + 1) of the bit clock. */ + 0, + }, + /* sDir */ + { + /* sDaFormat : Digital Audio Format Information */ + { + /* bBitSel : Bit Width Setting */ + /* MCDRV_BITSEL_16 (0): 16bit */ + /* MCDRV_BITSEL_20 (1): 20bit */ + /* MCDRV_BITSEL_24 (2): 24bit */ + /* MCDRV_BITSEL_32 (3): 32bit */ + MCDRV_BITSEL_16, + + /* bMode : Data Format Setting */ + /* MCDRV_DAMODE_HEADALIGN (0): + Left-justified Format */ + /* MCDRV_DAMODE_I2S (1): I2S */ + /* MCDRV_DAMODE_TAILALIGN (2): + Right-justified Format */ + MCDRV_DAMODE_I2S + }, + /* sPcmFormat : PCM Format Information */ + { + /* bMono : Mono / Stereo Setting */ + /* MCDRV_PCM_STEREO (0):Stereo */ + /* MCDRV_PCM_MONO (1):Mono */ + MCDRV_PCM_MONO , + /* bOrder : Bit Order Setting */ + /* MCDRV_PCM_MSB_FIRST (0): MSB First */ + /* MCDRV_PCM_LSB_FIRST (1): LSB First */ + MCDRV_PCM_LSB_FIRST, + /* bLaw : Data Format Setting */ + /* MCDRV_PCM_LINEAR (0): Linear */ + /* MCDRV_PCM_ALAW (1): A-Law */ + /* MCDRV_PCM_MULAW (2): u-Law */ + MCDRV_PCM_LINEAR, + /* bBitSel : Bit Width Setting */ + /* MCDRV_PCM_BITSEL_8 (0):8 bits */ + /* MCDRV_PCM_BITSEL_16 (1):16 bits */ + /* MCDRV_PCM_BITSEL_24 (2):24 bits */ + MCDRV_PCM_BITSEL_16 + }, + }, + /* sDit */ + { + MCDRV_STMODE_ZERO, /* bStMode */ + MCDRV_SDOUT_NORMAL, /* bEdge */ + /* sDaFormat : Digital Audio Format Information */ + { + /* bBitSel : Bit Width Setting */ + /* MCDRV_BITSEL_16 (0): 16bit */ + /* MCDRV_BITSEL_20 (1): 20bit */ + /* MCDRV_BITSEL_24 (2): 24bit */ + /* MCDRV_BITSEL_32 (3): 32bit */ + MCDRV_BITSEL_16, + + /* bMode : Data Format Setting */ + /* MCDRV_DAMODE_HEADALIGN (0): + Left-justified Format */ + /* MCDRV_DAMODE_I2S (1): I2S */ + /* MCDRV_DAMODE_TAILALIGN (2): + Right-justified Format */ + MCDRV_DAMODE_I2S + }, + /* sPcmFormat : PCM Format Information */ + { + /* bMono : Mono / Stereo Setting */ + /* MCDRV_PCM_STEREO (0):Stereo */ + /* MCDRV_PCM_MONO (1):Mono */ + MCDRV_PCM_MONO , + /* bOrder : Bit Order Setting */ + /* MCDRV_PCM_MSB_FIRST (0): MSB First */ + /* MCDRV_PCM_LSB_FIRST (1): LSB First */ + MCDRV_PCM_LSB_FIRST, + /* bLaw : Data Format Setting */ + /* MCDRV_PCM_LINEAR (0): Linear */ + /* MCDRV_PCM_ALAW (1): A-Law */ + /* MCDRV_PCM_MULAW (2): u-Law */ + MCDRV_PCM_LINEAR, + /* bBitSel : Bit Width Setting */ + /* MCDRV_PCM_BITSEL_8 (0):8 bits */ + /* MCDRV_PCM_BITSEL_16 (1):16 bits */ + /* MCDRV_PCM_BITSEL_24 (2):24 bits */ + MCDRV_PCM_BITSEL_16 + } + } +}; + +static const struct MCDRV_DIO_PORT stHifiPort_Default = { + /* sDioCommon */ + { + /* bMasterSlave : Master / Slave Setting */ + /* MCDRV_DIO_SLAVE (0): Slave */ + /* MCDRV_DIO_MASTER (1): Master */ + MCDRV_DIO_MASTER, + + /* bAutoFs : Sampling frequency automatic measurement + ON/OFF Setting in slave mode */ + /* MCDRV_AUTOFS_OFF (0): OFF */ + /* MCDRV_AUTOFS_ON (1): ON */ + MCDRV_AUTOFS_ON , + + /* bFs : Sampling Rate Setting */ + /* MCDRV_FS_48000 (0): 48kHz */ + /* MCDRV_FS_44100 (1): 44.1kHz */ + /* MCDRV_FS_32000 (2): 32kHz */ + /* MCDRV_FS_24000 (4): 24kHz */ + /* MCDRV_FS_22050 (5): 22.05kHz */ + /* MCDRV_FS_16000 (6): 16kHz */ + /* MCDRV_FS_12000 (8): 12kHz */ + /* MCDRV_FS_11025 (9): 11.025kHz */ + /* MCDRV_FS_8000 (10): 8kHz */ + MCDRV_FS_48000, + + /* bBckFs : Bit Clock Frequency Setting */ + /* MCDRV_BCKFS_64 (0): LRCK x 64 */ + /* MCDRV_BCKFS_48 (1): LRCK x 48 */ + /* MCDRV_BCKFS_32 (2): LRCK x 32 */ + /* MCDRV_BCKFS_512 (4): LRCK x 512 */ + /* MCDRV_BCKFS_256 (5): LRCK x 256 */ + /* MCDRV_BCKFS_192 (6): LRCK x 192 */ + /* MCDRV_BCKFS_128 (7): LRCK x 128 */ + /* MCDRV_BCKFS_96 (8): LRCK x 96 */ + /* MCDRV_BCKFS_24 (9): LRCK x 24 */ + /* MCDRV_BCKFS_16 (10): LRCK x 16 */ + /* MCDRV_BCKFS_8 (11): LRCK x 8 */ + /* MCDRV_BCKFS_SLAVE (15): PCM I/F SLAVE */ + MCDRV_BCKFS_32, + + /* bInterface : Interface Selection */ + /* MCDRV_DIO_DA (0): Digital Audio */ + /* MCDRV_DIO_PCM (1): PCM */ + MCDRV_DIO_DA, + + /* bBckInvert : Bit Clock Inversion Setting */ + /* MCDRV_BCLK_NORMAL (0): Normal Operation */ + /* MCDRV_BCLK_INVERT (1): Clock Inverted */ + MCDRV_BCLK_NORMAL, + + /* MCDRV_SRC_NOT_THRU (0) */ + /* MCDRV_SRC_THRU (1) */ + MCDRV_SRC_NOT_THRU, + + /* bPcmHizTim : High Impedance transition timing + after transmitting the last PCM I/F data */ + /* MCDRV_PCMHIZTIM_FALLING (0): + BCLK#* Falling Edge */ + /* MCDRV_PCMHIZTIM_RISING (1): + BCLK#* Rising Edge */ + MCDRV_PCMHIZTIM_FALLING, + + /* bPcmFrame : Frame Mode Setting with PCM interface*/ + /* MCDRV_PCM_SHORTFRAME (0): Short Frame */ + /* MCDRV_PCM_LONGFRAME (1): Long Frame */ + MCDRV_PCM_SHORTFRAME, + + /* bPcmHighPeriod : + LR clock High time setting with PCM selected + and Master selected */ + /* 0 to 31: + High level keeps during the period of time of + (setting value + 1) of the bit clock. */ + 0, + }, + /* sDir */ + { + /* sDaFormat : Digital Audio Format Information */ + { + /* bBitSel : Bit Width Setting */ + /* MCDRV_BITSEL_16 (0): 16bit */ + /* MCDRV_BITSEL_20 (1): 20bit */ + /* MCDRV_BITSEL_24 (2): 24bit */ + /* MCDRV_BITSEL_32 (3): 32bit */ + MCDRV_BITSEL_16, + + /* bMode : Data Format Setting */ + /* MCDRV_DAMODE_HEADALIGN (0): + Left-justified Format */ + /* MCDRV_DAMODE_I2S (1): I2S */ + /* MCDRV_DAMODE_TAILALIGN (2): + Right-justified Format */ + MCDRV_DAMODE_I2S + }, + /* sPcmFormat : PCM Format Information */ + { + /* bMono : Mono / Stereo Setting */ + /* MCDRV_PCM_STEREO (0):Stereo */ + /* MCDRV_PCM_MONO (1):Mono */ + MCDRV_PCM_MONO , + /* bOrder : Bit Order Setting */ + /* MCDRV_PCM_MSB_FIRST (0): MSB First */ + /* MCDRV_PCM_LSB_FIRST (1): LSB First */ + MCDRV_PCM_MSB_FIRST, + /* bLaw : Data Format Setting */ + /* MCDRV_PCM_LINEAR (0): Linear */ + /* MCDRV_PCM_ALAW (1): A-Law */ + /* MCDRV_PCM_MULAW (2): u-Law */ + MCDRV_PCM_LINEAR, + /* bBitSel : Bit Width Setting */ + /* MCDRV_PCM_BITSEL_8 (0):8 bits */ + /* MCDRV_PCM_BITSEL_16 (1):16 bits */ + /* MCDRV_PCM_BITSEL_24 (2):24 bits */ + MCDRV_PCM_BITSEL_8 + } + }, + /* sDit */ + { + MCDRV_STMODE_ZERO, /* bStMode */ + MCDRV_SDOUT_NORMAL, /* bEdge */ + /* sDaFormat : Digital Audio Format Information */ + { + /* bBitSel : Bit Width Setting */ + /* MCDRV_BITSEL_16 (0): 16bit */ + /* MCDRV_BITSEL_20 (1): 20bit */ + /* MCDRV_BITSEL_24 (2): 24bit */ + /* MCDRV_BITSEL_32 (3): 32bit */ + MCDRV_BITSEL_16, + + /* bMode : Data Format Setting */ + /* MCDRV_DAMODE_HEADALIGN (0): + Left-justified Format */ + /* MCDRV_DAMODE_I2S (1): I2S */ + /* MCDRV_DAMODE_TAILALIGN (2): + Right-justified Format */ + MCDRV_DAMODE_I2S + }, + /* sPcmFormat : PCM Format Information */ + { + /* bMono : Mono / Stereo Setting */ + /* MCDRV_PCM_STEREO (0):Stereo */ + /* MCDRV_PCM_MONO (1):Mono */ + MCDRV_PCM_MONO , + /* bOrder : Bit Order Setting */ + /* MCDRV_PCM_MSB_FIRST (0): MSB First */ + /* MCDRV_PCM_LSB_FIRST (1): LSB First */ + MCDRV_PCM_MSB_FIRST, + /* bLaw : Data Format Setting */ + /* MCDRV_PCM_LINEAR (0): Linear */ + /* MCDRV_PCM_ALAW (1): A-Law */ + /* MCDRV_PCM_MULAW (2): u-Law */ + MCDRV_PCM_LINEAR, + /* bBitSel : Bit Width Setting */ + /* MCDRV_PCM_BITSEL_8 (0):8 bits */ + /* MCDRV_PCM_BITSEL_16 (1):16 bits */ + /* MCDRV_PCM_BITSEL_24 (2):24 bits */ + MCDRV_PCM_BITSEL_16 + } + } +}; + +/* ======================================== + HS DET settings + ========================================*/ +static const struct MCDRV_HSDET_INFO stHSDetInfo_Default = { + /* bEnPlugDet */ + MCDRV_PLUGDET_DISABLE, + /* bEnPlugDetDb */ + MCDRV_PLUGDETDB_BOTH_ENABLE, + /* bEnDlyKeyOff */ + MCDRV_KEYEN_D_D_D, + /* bEnDlyKeyOn */ + MCDRV_KEYEN_D_D_D, + /* bEnMicDet */ + MCDRV_MICDET_ENABLE, + /* bEnKeyOff */ + MCDRV_KEYEN_E_E_E, + /* bEnKeyOn */ + MCDRV_KEYEN_E_E_E, + /* bHsDetDbnc */ + MCDRV_DETDBNC_219, + /* bKeyOffMtim */ + MCDRV_KEYOFF_MTIM_63, + /* bKeyOnMtim */ + MCDRV_KEYON_MTIM_63, + /* bKey0OffDlyTim */ + 8, + /* bKey1OffDlyTim */ + 8, + /* bKey2OffDlyTim */ + 8, + /* bKey0OnDlyTim */ + 8, + /* bKey1OnDlyTim */ + 8, + /* bKey2OnDlyTim */ + 8, + /* bKey0OnDlyTim2 */ + 0, + /* bKey1OnDlyTim2 */ + 0, + /* bKey2OnDlyTim2 */ + 0, + /* bIrqType */ + MCDRV_IRQTYPE_EX, + /* bDetInv */ + MCDRV_DET_IN_INV_INV, + /* bHsDetMode */ + MCDRV_HSDET_MODE_DETIN_A, + /* bSperiod */ + MCDRV_SPERIOD_15625, + /* bLperiod */ + 0, + /* bDbncNumPlug */ + MCDRV_DBNC_NUM_7, + /* bDbncNumMic */ + MCDRV_DBNC_NUM_4, + /* bDbncNumKey */ + MCDRV_DBNC_NUM_4, + /* bSgnlPeriod */ + MCDRV_SGNLPERIOD_79, + /* bSgnlNum */ + MCDRV_SGNLNUM_4, + /* bSgnlPeak */ + MCDRV_SGNLPEAK_1182, + /* bImpSel */ + 0, + /* bDlyIrqStop */ + 0, + /* cbfunc */ + 0 +}; + +#define HSUNDETDBNC MCDRV_DETDBNC_109 +#define HSUNDETDBNCNUM MCDRV_DBNC_NUM_7 +#define MSDETMB4OFF (5000) +#define MSMKDETENOFF (200) + +static const struct MCDRV_HSDET_INFO stHSDetInfo_Suspend = { + /* bEnPlugDet */ + MCDRV_PLUGDET_DISABLE, + /* bEnPlugDetDb */ + MCDRV_PLUGDETDB_BOTH_ENABLE, + /* bEnDlyKeyOff */ + MCDRV_KEYEN_D_D_D, + /* bEnDlyKeyOn */ + MCDRV_KEYEN_D_D_D, + /* bEnMicDet */ + MCDRV_MICDET_ENABLE, + /* bEnKeyOff */ + MCDRV_KEYEN_D_D_E, + /* bEnKeyOn */ + MCDRV_KEYEN_D_D_E, + /* bHsDetDbnc */ + MCDRV_DETDBNC_219, + /* bKeyOffMtim */ + MCDRV_KEYOFF_MTIM_63, + /* bKeyOnMtim */ + MCDRV_KEYON_MTIM_63, + /* bKey0OffDlyTim */ + 8, + /* bKey1OffDlyTim */ + 8, + /* bKey2OffDlyTim */ + 8, + /* bKey0OnDlyTim */ + 8, + /* bKey1OnDlyTim */ + 8, + /* bKey2OnDlyTim */ + 8, + /* bKey0OnDlyTim2 */ + 0, + /* bKey1OnDlyTim2 */ + 0, + /* bKey2OnDlyTim2 */ + 0, + /* bIrqType */ + MCDRV_IRQTYPE_EX, + /* bDetInv */ + MCDRV_DET_IN_INV_INV, + /* bHsDetMode */ + MCDRV_HSDET_MODE_DETIN_A, + /* bSperiod */ + MCDRV_SPERIOD_15625, + /* bLperiod */ + 0, + /* bDbncNumPlug */ + MCDRV_DBNC_NUM_7, + /* bDbncNumMic */ + MCDRV_DBNC_NUM_4, + /* bDbncNumKey */ + MCDRV_DBNC_NUM_4, + /* bSgnlPeriod */ + MCDRV_SGNLPERIOD_79, + /* bSgnlNum */ + MCDRV_SGNLNUM_4, + /* bSgnlPeak */ + MCDRV_SGNLPEAK_1182, + /* bImpSel */ + 0, + /* bDlyIrqStop */ + 0, + /* cbfunc */ + 0 +}; + +static const struct MCDRV_HSDET2_INFO stHSDet2Info_Default = { + MCDRV_IRQTYPE_REF, + MCDRV_IRQTYPE_REF, + MCDRV_IRQTYPE_REF, + MCDRV_IRQTYPE_REF, + MCDRV_IRQTYPE_NORMAL, + MCDRV_IRQTYPE_REF, + MCDRV_IRQTYPE_REF, + MCDRV_IRQTYPE_NORMAL, + MCDRV_IRQTYPE_REF, + MCDRV_IRQTYPE_REF +}; + +/* ======================================== + Key Event settings + ========================================*/ +#define MC_ASOC_EV_KEY_DELAYKEYON0 KEY_RESERVED +#define MC_ASOC_EV_KEY_DELAYKEYON1 KEY_RESERVED +#define MC_ASOC_EV_KEY_DELAYKEYON2 KEY_RESERVED + +static const unsigned int mc_asoc_ev_key_delaykeyoff0[8] = { + KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, + KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED +}; +static const unsigned int mc_asoc_ev_key_delaykeyoff1[8] = { + KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, + KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED +}; +static const unsigned int mc_asoc_ev_key_delaykeyoff2[8] = { + KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, + KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED +}; + +#define MC_ASOC_IMP_TBL_NUM (8) +static const SINT16 aswHpVolImpTable[MC_ASOC_IMP_TBL_NUM] = { + 0, 0, 2, 4, 6, 8, 0, 0 +}; + +static const SINT16 aswDac0VolImpTable[MC_ASOC_IMP_TBL_NUM] = { + 0, 0, 0, 0, 0, 0, 0, 0 +}; + +#endif diff --git a/sound/soc/codecs/ymu831/ymu831_cfg_ctc.h b/sound/soc/codecs/ymu831/ymu831_cfg_ctc.h new file mode 100644 index 00000000000..1d7cfe11a40 --- /dev/null +++ b/sound/soc/codecs/ymu831/ymu831_cfg_ctc.h @@ -0,0 +1,1034 @@ +/* + * YMU831 ASoC codec driver + * + * Copyright (c) 2012-2013 Yamaha Corporation + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + */ + +#ifndef YMU831_CFG_H +#define YMU831_CFG_H +#include <linux/input.h> +#include <linux/irq.h> + +#include "mcdriver.h" +#include "ymu831_priv.h" + +/* + * ALSA Version + */ +#define HSDET_WHILE_SUSPEND + +#define MAX_YMS_CTRL_PARAM_SIZE (524288UL) + +#define BUS_SEL_I2C (0) +#define BUS_SEL_SPI (1) +#define BUS_SEL_SLIM (2) +#define BUS_SELECT BUS_SEL_SPI + +#define CAPTURE_PORT_MUSIC (0) +#define CAPTURE_PORT_EXT (1) +#define CAPTURE_PORT CAPTURE_PORT_MUSIC + +#define MC_ASOC_PHYS_DIO0 MCDRV_PHYSPORT_DIO0 +#define MC_ASOC_PHYS_DIO1 MCDRV_PHYSPORT_DIO1 +#define MC_ASOC_PHYS_DIO2 MCDRV_PHYSPORT_DIO2 +#define MC_ASOC_PHYS_NONE MCDRV_PHYSPORT_NONE +#define MC_ASOC_PHYS_SLIM0 MCDRV_PHYSPORT_SLIM0 +#define MC_ASOC_PHYS_SLIM1 MCDRV_PHYSPORT_SLIM1 +#define MC_ASOC_PHYS_SLIM2 MCDRV_PHYSPORT_SLIM2 +#define MUSIC_PHYSICAL_PORT MC_ASOC_PHYS_DIO0 +#define EXT_PHYSICAL_PORT MC_ASOC_PHYS_DIO2 +#define VOICE_PHYSICAL_PORT MC_ASOC_PHYS_DIO1 +#define HIFI_PHYSICAL_PORT MC_ASOC_PHYS_DIO0 + +#define VOICE_RECORDING_UNMUTE (1) + +#define INCALL_MIC_SP MC_ASOC_INCALL_MIC_MAINMIC +#define INCALL_MIC_RC MC_ASOC_INCALL_MIC_MAINMIC +#define INCALL_MIC_HP MC_ASOC_INCALL_MIC_MAINMIC +#define INCALL_MIC_LO1 MC_ASOC_INCALL_MIC_MAINMIC +#define INCALL_MIC_LO2 MC_ASOC_INCALL_MIC_MAINMIC + +#define MIC_NONE (0) +#define MIC_1 (1) +#define MIC_2 (2) +#define MIC_3 (3) +#define MIC_4 (4) +#define MIC_PDM0 (5) +#define MIC_PDM1 (6) + +#define MAIN_MIC MIC_1 +#define SUB_MIC MIC_2 +#define HEADSET_MIC MIC_4 + +#define BIAS_OFF (0) +#define BIAS_ON_ALWAYS (1) +#define BIAS_SYNC_MIC (2) +#define MIC1_BIAS BIAS_OFF +#define MIC2_BIAS BIAS_SYNC_MIC +#define MIC3_BIAS BIAS_SYNC_MIC +#define MIC4_BIAS BIAS_SYNC_MIC + +#define IRQ_TYPE IRQ_TYPE_EDGE_FALLING + +#define AUTO_POWEROFF_OFF (0) +#define AUTO_POWEROFF_ON (1) +#define AUTO_POWEROFF AUTO_POWEROFF_ON + +static const struct mc_asoc_setup mc_asoc_cfg_setup = { + /* init */ + { + MCDRV_CKSEL_CMOS_CMOS, /* bCkSel */ + MCDRV_CKINPUT_CLKI0_CLKI0, /* bCkInput */ + 0x04, /* bPllModeA */ + 0x16, /* bPllPrevDivA */ + 0x0087, /* wPllFbDivA */ + 0x2B02, /* wPllFracA */ + 1, /* bPllFreqA */ + 0x04, /* bPllModeB */ + 0x16, /* bPllPrevDivB */ + 0x0043, /* wPllFbDivB */ + 0x9581, /* wPllFracB */ + 0, /* bPllFreqB */ + 0, /* bHsdetClk */ + MCDRV_DAHIZ_HIZ, /* bDio0SdoHiz */ + MCDRV_DAHIZ_HIZ, /* bDio1SdoHiz */ + MCDRV_DAHIZ_HIZ, /* bDio2SdoHiz */ + MCDRV_DAHIZ_HIZ, /* bDio0ClkHiz */ + MCDRV_DAHIZ_HIZ, /* bDio1ClkHiz */ + MCDRV_DAHIZ_HIZ, /* bDio2ClkHiz */ + MCDRV_PCMHIZ_LOW, /* bDio0PcmHiz */ + MCDRV_PCMHIZ_LOW, /* bDio1PcmHiz */ + MCDRV_PCMHIZ_LOW, /* bDio2PcmHiz */ + MCDRV_PA_GPIO, /* bPa0Func */ + MCDRV_PA_GPIO, /* bPa1Func */ + MCDRV_PA_GPIO, /* bPa2Func */ + MCDRV_POWMODE_FULL, /* bPowerMode */ + MCDRV_MBSEL_22, /* bMbSel1 */ + MCDRV_MBSEL_22, /* bMbSel2 */ + MCDRV_MBSEL_22, /* bMbSel3 */ + MCDRV_MBSEL_22, /* bMbSel4 */ + MCDRV_MBSDISCH_1000, /* bMbsDisch */ + MCDRV_NONCLIP_OFF, /* bNonClip */ + MCDRV_LINE_STEREO, /* bLineIn1Dif */ + MCDRV_LINE_STEREO, /* bLineOut1Dif */ + MCDRV_LINE_STEREO, /* bLineOut2Dif */ + MCDRV_MIC_DIF, /* bMic1Sng */ + MCDRV_MIC_DIF, /* bMic2Sng */ + MCDRV_MIC_DIF, /* bMic3Sng */ + MCDRV_MIC_DIF, /* bMic4Sng */ + MCDRV_ZC_OFF, /* bZcLineOut1 */ + MCDRV_ZC_OFF, /* bZcLineOut2 */ + MCDRV_ZC_ON, /* bZcRc */ + MCDRV_ZC_ON, /* bZcSp */ + MCDRV_ZC_OFF, /* bZcHp */ + MCDRV_SVOL_ON, /* bSvolLineOut1 */ + MCDRV_SVOL_ON, /* bSvolLineOut2 */ + MCDRV_SVOL_ON, /* bSvolRc */ + MCDRV_SVOL_ON, /* bSvolSp */ + MCDRV_SVOL_ON, /* bSvolHp */ + MCDRV_RCIMP_FIXLOW, /* bRcHiz */ + MCDRV_WL_LOFF_ROFF, /* bSpHiz */ + MCDRV_IMP_LFIXLOW_RFIXLOW, /* bHpHiz */ + MCDRV_IMP_LFIXLOW_RFIXLOW, /* bLineOut1Hiz */ + MCDRV_IMP_LFIXLOW_RFIXLOW, /* bLineOut2Hiz */ + MCDRV_CPMOD_MID, /* bCpMod */ + MCDRV_RBSEL_2_2K, /* bRbSel */ + MCDRV_PLUG_LRGM, /* bPlugSel */ + MCDRV_GNDDET_OFF, /* bGndDet */ + MCDRV_PPD_OFF, /* bPpdRc */ + MCDRV_PPD_OFF, /* bPpdSp */ + MCDRV_PPD_OFF, /* bPpdHp */ + MCDRV_PPD_OFF, /* bPpdLineOut1 */ + MCDRV_PPD_OFF, /* bPpdLineOut2 */ + { + /* dWaitTime */ + { + 5000, 5000, 5000, 5000, 25000, 15000, 2000, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + }, + /* dPollInterval */ + { + 1000, 1000, 1000, 1000, 1000, 1000, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + }, + /* dPollTimeOut */ + { + 1000, 1000, 1000, 1000, 1000, 1000, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + } + }, + }, + /* init2 */ + { + { + MCDRV_DOA_DRV_HIGH, + MCDRV_SCKMSK_OFF, + MCDRV_SPMN_OFF_9, + 0x03, 0x30, 0x30, 0x21, 0x03, 0xC0, 0x6B, 0x00, + 0xC0, 0x01, 0x0F, 0, 0, 0, 0, 0, 0 + } + }, + /* rslot */ + { + 0, 1, 2 + }, + /* tslot */ + { + 0, 1, 2 + }, +}; + +static const struct MCDRV_DIO_PORT stMusicPort_Default = { + /* sDioCommon */ + { + /* bMasterSlave : Master / Slave Setting */ + /* MCDRV_DIO_SLAVE (0): Slave */ + /* MCDRV_DIO_MASTER (1): Master */ + MCDRV_DIO_MASTER, + + /* bAutoFs : Sampling frequency automatic measurement + ON/OFF Setting in slave mode */ + /* MCDRV_AUTOFS_OFF (0): OFF */ + /* MCDRV_AUTOFS_ON (1): ON */ + MCDRV_AUTOFS_ON , + + /* bFs : Sampling Rate Setting */ + /* MCDRV_FS_48000 (0): 48kHz */ + /* MCDRV_FS_44100 (1): 44.1kHz */ + /* MCDRV_FS_32000 (2): 32kHz */ + /* MCDRV_FS_24000 (4): 24kHz */ + /* MCDRV_FS_22050 (5): 22.05kHz */ + /* MCDRV_FS_16000 (6): 16kHz */ + /* MCDRV_FS_12000 (8): 12kHz */ + /* MCDRV_FS_11025 (9): 11.025kHz */ + /* MCDRV_FS_8000 (10): 8kHz */ + MCDRV_FS_48000, + + /* bBckFs : Bit Clock Frequency Setting */ + /* MCDRV_BCKFS_64 (0): LRCK x 64 */ + /* MCDRV_BCKFS_48 (1): LRCK x 48 */ + /* MCDRV_BCKFS_32 (2): LRCK x 32 */ + /* MCDRV_BCKFS_512 (4): LRCK x 512 */ + /* MCDRV_BCKFS_256 (5): LRCK x 256 */ + /* MCDRV_BCKFS_192 (6): LRCK x 192 */ + /* MCDRV_BCKFS_128 (7): LRCK x 128 */ + /* MCDRV_BCKFS_96 (8): LRCK x 96 */ + /* MCDRV_BCKFS_24 (9): LRCK x 24 */ + /* MCDRV_BCKFS_16 (10): LRCK x 16 */ + /* MCDRV_BCKFS_8 (11): LRCK x 8 */ + /* MCDRV_BCKFS_SLAVE (15): PCM I/F SLAVE */ + MCDRV_BCKFS_32, + + /* bInterface : Interface Selection */ + /* MCDRV_DIO_DA (0): Digital Audio */ + /* MCDRV_DIO_PCM (1): PCM */ + MCDRV_DIO_DA, + + /* bBckInvert : Bit Clock Inversion Setting */ + /* MCDRV_BCLK_NORMAL (0): Normal Operation */ + /* MCDRV_BCLK_INVERT (1): Clock Inverted */ + MCDRV_BCLK_NORMAL, + + /* MCDRV_SRC_NOT_THRU (0) */ + /* MCDRV_SRC_THRU (1) */ + MCDRV_SRC_NOT_THRU, + + /* bPcmHizTim : High Impedance transition timing + after transmitting the last PCM I/F data */ + /* MCDRV_PCMHIZTIM_FALLING (0): + BCLK#* Falling Edge */ + /* MCDRV_PCMHIZTIM_RISING (1): + BCLK#* Rising Edge */ + MCDRV_PCMHIZTIM_FALLING, + + /* bPcmFrame : Frame Mode Setting with PCM interface*/ + /* MCDRV_PCM_SHORTFRAME (0): Short Frame */ + /* MCDRV_PCM_LONGFRAME (1): Long Frame */ + MCDRV_PCM_SHORTFRAME, + + /* bPcmHighPeriod : + LR clock High time setting with PCM selected + and Master selected */ + /* 0 to 31: + High level keeps during the period of time of + (setting value + 1) of the bit clock. */ + 0, + }, + /* sDir */ + { + /* sDaFormat : Digital Audio Format Information */ + { + /* bBitSel : Bit Width Setting */ + /* MCDRV_BITSEL_16 (0): 16bit */ + /* MCDRV_BITSEL_20 (1): 20bit */ + /* MCDRV_BITSEL_24 (2): 24bit */ + /* MCDRV_BITSEL_32 (3): 32bit */ + MCDRV_BITSEL_16, + + /* bMode : Data Format Setting */ + /* MCDRV_DAMODE_HEADALIGN (0): + Left-justified Format */ + /* MCDRV_DAMODE_I2S (1): I2S */ + /* MCDRV_DAMODE_TAILALIGN (2): + Right-justified Format */ + MCDRV_DAMODE_I2S + }, + /* sPcmFormat : PCM Format Information */ + { + /* bMono : Mono / Stereo Setting */ + /* MCDRV_PCM_STEREO (0):Stereo */ + /* MCDRV_PCM_MONO (1):Mono */ + MCDRV_PCM_MONO , + /* bOrder : Bit Order Setting */ + /* MCDRV_PCM_MSB_FIRST (0): MSB First */ + /* MCDRV_PCM_LSB_FIRST (1): LSB First */ + MCDRV_PCM_MSB_FIRST, + /* bLaw : Data Format Setting */ + /* MCDRV_PCM_LINEAR (0): Linear */ + /* MCDRV_PCM_ALAW (1): A-Law */ + /* MCDRV_PCM_MULAW (2): u-Law */ + MCDRV_PCM_LINEAR, + /* bBitSel : Bit Width Setting */ + /* MCDRV_PCM_BITSEL_8 (0):8 bits */ + /* MCDRV_PCM_BITSEL_16 (1):16 bits */ + /* MCDRV_PCM_BITSEL_24 (2):24 bits */ + MCDRV_PCM_BITSEL_8 + } + }, + /* sDit */ + { + MCDRV_STMODE_ZERO, /* bStMode */ + MCDRV_SDOUT_NORMAL, /* bEdge */ + /* sDaFormat : Digital Audio Format Information */ + { + /* bBitSel : Bit Width Setting */ + /* MCDRV_BITSEL_16 (0): 16bit */ + /* MCDRV_BITSEL_20 (1): 20bit */ + /* MCDRV_BITSEL_24 (2): 24bit */ + /* MCDRV_BITSEL_32 (3): 32bit */ + MCDRV_BITSEL_16, + + /* bMode : Data Format Setting */ + /* MCDRV_DAMODE_HEADALIGN (0): + Left-justified Format */ + /* MCDRV_DAMODE_I2S (1): I2S */ + /* MCDRV_DAMODE_TAILALIGN (2): + Right-justified Format */ + MCDRV_DAMODE_I2S + }, + /* sPcmFormat : PCM Format Information */ + { + /* bMono : Mono / Stereo Setting */ + /* MCDRV_PCM_STEREO (0):Stereo */ + /* MCDRV_PCM_MONO (1):Mono */ + MCDRV_PCM_MONO , + /* bOrder : Bit Order Setting */ + /* MCDRV_PCM_MSB_FIRST (0): MSB First */ + /* MCDRV_PCM_LSB_FIRST (1): LSB First */ + MCDRV_PCM_MSB_FIRST, + /* bLaw : Data Format Setting */ + /* MCDRV_PCM_LINEAR (0): Linear */ + /* MCDRV_PCM_ALAW (1): A-Law */ + /* MCDRV_PCM_MULAW (2): u-Law */ + MCDRV_PCM_LINEAR, + /* bBitSel : Bit Width Setting */ + /* MCDRV_PCM_BITSEL_8 (0):8 bits */ + /* MCDRV_PCM_BITSEL_16 (1):16 bits */ + /* MCDRV_PCM_BITSEL_24 (2):24 bits */ + MCDRV_PCM_BITSEL_16 + } + } +}; + +static const struct MCDRV_DIO_PORT stExtPort_Default = { + /* sDioCommon */ + { + /* bMasterSlave : Master / Slave Setting */ + /* MCDRV_DIO_SLAVE (0): Slave */ + /* MCDRV_DIO_MASTER (1): Master */ + MCDRV_DIO_MASTER, + + /* bAutoFs : Sampling frequency automatic measurement + ON/OFF Setting in slave mode */ + /* MCDRV_AUTOFS_OFF (0): OFF */ + /* MCDRV_AUTOFS_ON (1): ON */ + MCDRV_AUTOFS_ON , + + /* bFs : Sampling Rate Setting */ + /* MCDRV_FS_48000 (0): 48kHz */ + /* MCDRV_FS_44100 (1): 44.1kHz */ + /* MCDRV_FS_32000 (2): 32kHz */ + /* MCDRV_FS_24000 (4): 24kHz */ + /* MCDRV_FS_22050 (5): 22.05kHz */ + /* MCDRV_FS_16000 (6): 16kHz */ + /* MCDRV_FS_12000 (8): 12kHz */ + /* MCDRV_FS_11025 (9): 11.025kHz */ + /* MCDRV_FS_8000 (10): 8kHz */ + MCDRV_FS_8000, + + /* bBckFs : Bit Clock Frequency Setting */ + /* MCDRV_BCKFS_64 (0): LRCK x 64 */ + /* MCDRV_BCKFS_48 (1): LRCK x 48 */ + /* MCDRV_BCKFS_32 (2): LRCK x 32 */ + /* MCDRV_BCKFS_512 (4): LRCK x 512 */ + /* MCDRV_BCKFS_256 (5): LRCK x 256 */ + /* MCDRV_BCKFS_192 (6): LRCK x 192 */ + /* MCDRV_BCKFS_128 (7): LRCK x 128 */ + /* MCDRV_BCKFS_96 (8): LRCK x 96 */ + /* MCDRV_BCKFS_24 (9): LRCK x 24 */ + /* MCDRV_BCKFS_16 (10): LRCK x 16 */ + /* MCDRV_BCKFS_8 (11): LRCK x 8 */ + /* MCDRV_BCKFS_SLAVE (15): PCM I/F SLAVE */ + MCDRV_BCKFS_32, + + /* bInterface : Interface Selection */ + /* MCDRV_DIO_DA (0): Digital Audio */ + /* MCDRV_DIO_PCM (1): PCM */ + MCDRV_DIO_DA, + + /* bBckInvert : Bit Clock Inversion Setting */ + /* MCDRV_BCLK_NORMAL (0): Normal Operation */ + /* MCDRV_BCLK_INVERT (1): Clock Inverted */ + MCDRV_BCLK_NORMAL, + + /* MCDRV_SRC_NOT_THRU (0) */ + /* MCDRV_SRC_THRU (1) */ + MCDRV_SRC_NOT_THRU, + + /* bPcmHizTim : High Impedance transition timing + after transmitting the last PCM I/F data */ + /* MCDRV_PCMHIZTIM_FALLING (0): + BCLK#* Falling Edge */ + /* MCDRV_PCMHIZTIM_RISING (1): + BCLK#* Rising Edge */ + MCDRV_PCMHIZTIM_FALLING, + + /* bPcmFrame : Frame Mode Setting with PCM interface*/ + /* MCDRV_PCM_SHORTFRAME (0): Short Frame */ + /* MCDRV_PCM_LONGFRAME (1): Long Frame */ + MCDRV_PCM_SHORTFRAME, + + /* bPcmHighPeriod : + LR clock High time setting with PCM selected + and Master selected */ + /* 0 to 31: + High level keeps during the period of time of + (setting value + 1) of the bit clock. */ + 0, + }, + /* sDir */ + { + /* sDaFormat : Digital Audio Format Information */ + { + /* bBitSel : Bit Width Setting */ + /* MCDRV_BITSEL_16 (0): 16bit */ + /* MCDRV_BITSEL_20 (1): 20bit */ + /* MCDRV_BITSEL_24 (2): 24bit */ + /* MCDRV_BITSEL_32 (3): 32bit */ + MCDRV_BITSEL_16, + + /* bMode : Data Format Setting */ + /* MCDRV_DAMODE_HEADALIGN (0): + Left-justified Format */ + /* MCDRV_DAMODE_I2S (1): I2S */ + /* MCDRV_DAMODE_TAILALIGN (2): + Right-justified Format */ + MCDRV_DAMODE_I2S + }, + /* sPcmFormat : PCM Format Information */ + { + /* bMono : Mono / Stereo Setting */ + /* MCDRV_PCM_STEREO (0):Stereo */ + /* MCDRV_PCM_MONO (1):Mono */ + MCDRV_PCM_MONO , + /* bOrder : Bit Order Setting */ + /* MCDRV_PCM_MSB_FIRST (0): MSB First */ + /* MCDRV_PCM_LSB_FIRST (1): LSB First */ + MCDRV_PCM_LSB_FIRST, + /* bLaw : Data Format Setting */ + /* MCDRV_PCM_LINEAR (0): Linear */ + /* MCDRV_PCM_ALAW (1): A-Law */ + /* MCDRV_PCM_MULAW (2): u-Law */ + MCDRV_PCM_LINEAR, + /* bBitSel : Bit Width Setting */ + /* MCDRV_PCM_BITSEL_8 (0):8 bits */ + /* MCDRV_PCM_BITSEL_16 (1):16 bits */ + /* MCDRV_PCM_BITSEL_24 (2):24 bits */ + MCDRV_PCM_BITSEL_16 + } + }, + /* sDit */ + { + MCDRV_STMODE_ZERO, /* bStMode */ + MCDRV_SDOUT_NORMAL, /* bEdge */ + /* sDaFormat : Digital Audio Format Information */ + { + /* bBitSel : Bit Width Setting */ + /* MCDRV_BITSEL_16 (0): 16bit */ + /* MCDRV_BITSEL_20 (1): 20bit */ + /* MCDRV_BITSEL_24 (2): 24bit */ + /* MCDRV_BITSEL_32 (3): 32bit */ + MCDRV_BITSEL_16, + + /* bMode : Data Format Setting */ + /* MCDRV_DAMODE_HEADALIGN (0): + Left-justified Format */ + /* MCDRV_DAMODE_I2S (1): I2S */ + /* MCDRV_DAMODE_TAILALIGN (2): + Right-justified Format */ + MCDRV_DAMODE_I2S + }, + /* sPcmFormat : PCM Format Information */ + { + /* bMono : Mono / Stereo Setting */ + /* MCDRV_PCM_STEREO (0):Stereo */ + /* MCDRV_PCM_MONO (1):Mono */ + MCDRV_PCM_MONO , + /* bOrder : Bit Order Setting */ + /* MCDRV_PCM_MSB_FIRST (0): MSB First */ + /* MCDRV_PCM_LSB_FIRST (1): LSB First */ + MCDRV_PCM_LSB_FIRST, + /* bLaw : Data Format Setting */ + /* MCDRV_PCM_LINEAR (0): Linear */ + /* MCDRV_PCM_ALAW (1): A-Law */ + /* MCDRV_PCM_MULAW (2): u-Law */ + MCDRV_PCM_LINEAR, + /* bBitSel : Bit Width Setting */ + /* MCDRV_PCM_BITSEL_8 (0):8 bits */ + /* MCDRV_PCM_BITSEL_16 (1):16 bits */ + /* MCDRV_PCM_BITSEL_24 (2):24 bits */ + MCDRV_PCM_BITSEL_16 + } + } +}; + +static const struct MCDRV_DIO_PORT stVoicePort_Default = { + /* sDioCommon */ + { + /* bMasterSlave : Master / Slave Setting */ + /* MCDRV_DIO_SLAVE (0): Slave */ + /* MCDRV_DIO_MASTER (1): Master */ + MCDRV_DIO_SLAVE, + + /* bAutoFs : Sampling frequency automatic measurement + ON/OFF Setting in slave mode */ + /* MCDRV_AUTOFS_OFF (0): OFF */ + /* MCDRV_AUTOFS_ON (1): ON */ + MCDRV_AUTOFS_ON , + + /* bFs : Sampling Rate Setting */ + /* MCDRV_FS_48000 (0): 48kHz */ + /* MCDRV_FS_44100 (1): 44.1kHz */ + /* MCDRV_FS_32000 (2): 32kHz */ + /* MCDRV_FS_24000 (4): 24kHz */ + /* MCDRV_FS_22050 (5): 22.05kHz */ + /* MCDRV_FS_16000 (6): 16kHz */ + /* MCDRV_FS_12000 (8): 12kHz */ + /* MCDRV_FS_11025 (9): 11.025kHz */ + /* MCDRV_FS_8000 (10): 8kHz */ + MCDRV_FS_8000, + + /* bBckFs : Bit Clock Frequency Setting */ + /* MCDRV_BCKFS_64 (0): LRCK x 64 */ + /* MCDRV_BCKFS_48 (1): LRCK x 48 */ + /* MCDRV_BCKFS_32 (2): LRCK x 32 */ + /* MCDRV_BCKFS_512 (4): LRCK x 512 */ + /* MCDRV_BCKFS_256 (5): LRCK x 256 */ + /* MCDRV_BCKFS_192 (6): LRCK x 192 */ + /* MCDRV_BCKFS_128 (7): LRCK x 128 */ + /* MCDRV_BCKFS_96 (8): LRCK x 96 */ + /* MCDRV_BCKFS_24 (9): LRCK x 24 */ + /* MCDRV_BCKFS_16 (10): LRCK x 16 */ + /* MCDRV_BCKFS_8 (11): LRCK x 8 */ + /* MCDRV_BCKFS_SLAVE (15): PCM I/F SLAVE */ + MCDRV_BCKFS_32, + + /* bInterface : Interface Selection */ + /* MCDRV_DIO_DA (0): Digital Audio */ + /* MCDRV_DIO_PCM (1): PCM */ + MCDRV_DIO_PCM, + + /* bBckInvert : Bit Clock Inversion Setting */ + /* MCDRV_BCLK_NORMAL (0): Normal Operation */ + /* MCDRV_BCLK_INVERT (1): Clock Inverted */ + MCDRV_BCLK_NORMAL, + + /* bSrcThru */ + /* MCDRV_SRC_NOT_THRU (0) */ + /* MCDRV_SRC_THRU (1) */ + MCDRV_SRC_NOT_THRU, + + /* bPcmHizTim : High Impedance transition timing + after transmitting the last PCM I/F data */ + /* MCDRV_PCMHIZTIM_FALLING (0): + BCLK#* Falling Edge */ + /* MCDRV_PCMHIZTIM_RISING (1): + BCLK#* Rising Edge */ + MCDRV_PCMHIZTIM_FALLING, + + /* bPcmFrame : Frame Mode Setting with PCM interface*/ + /* MCDRV_PCM_SHORTFRAME (0): Short Frame */ + /* MCDRV_PCM_LONGFRAME (1): Long Frame */ + MCDRV_PCM_SHORTFRAME, + + /* bPcmHighPeriod : + LR clock High time setting with PCM selected + and Master selected */ + /* 0 to 31: + High level keeps during the period of time of + (setting value + 1) of the bit clock. */ + 0, + }, + /* sDir */ + { + /* sDaFormat : Digital Audio Format Information */ + { + /* bBitSel : Bit Width Setting */ + /* MCDRV_BITSEL_16 (0): 16bit */ + /* MCDRV_BITSEL_20 (1): 20bit */ + /* MCDRV_BITSEL_24 (2): 24bit */ + /* MCDRV_BITSEL_32 (3): 32bit */ + MCDRV_BITSEL_16, + + /* bMode : Data Format Setting */ + /* MCDRV_DAMODE_HEADALIGN (0): + Left-justified Format */ + /* MCDRV_DAMODE_I2S (1): I2S */ + /* MCDRV_DAMODE_TAILALIGN (2): + Right-justified Format */ + MCDRV_DAMODE_HEADALIGN + }, + /* sPcmFormat : PCM Format Information */ + { + /* bMono : Mono / Stereo Setting */ + /* MCDRV_PCM_STEREO (0):Stereo */ + /* MCDRV_PCM_MONO (1):Mono */ + MCDRV_PCM_STEREO , + /* bOrder : Bit Order Setting */ + /* MCDRV_PCM_MSB_FIRST (0): MSB First */ + /* MCDRV_PCM_LSB_FIRST (1): LSB First */ + MCDRV_PCM_MSB_FIRST, + /* bLaw : Data Format Setting */ + /* MCDRV_PCM_LINEAR (0): Linear */ + /* MCDRV_PCM_ALAW (1): A-Law */ + /* MCDRV_PCM_MULAW (2): u-Law */ + MCDRV_PCM_LINEAR, + /* bBitSel : Bit Width Setting */ + /* MCDRV_PCM_BITSEL_8 (0):8 bits */ + /* MCDRV_PCM_BITSEL_16 (1):16 bits */ + /* MCDRV_PCM_BITSEL_24 (2):24 bits */ + MCDRV_PCM_BITSEL_16 + }, + }, + /* sDit */ + { + MCDRV_STMODE_ZERO, /* bStMode */ + MCDRV_SDOUT_NORMAL, /* bEdge */ + /* sDaFormat : Digital Audio Format Information */ + { + /* bBitSel : Bit Width Setting */ + /* MCDRV_BITSEL_16 (0): 16bit */ + /* MCDRV_BITSEL_20 (1): 20bit */ + /* MCDRV_BITSEL_24 (2): 24bit */ + /* MCDRV_BITSEL_32 (3): 32bit */ + MCDRV_BITSEL_16, + + /* bMode : Data Format Setting */ + /* MCDRV_DAMODE_HEADALIGN (0): + Left-justified Format */ + /* MCDRV_DAMODE_I2S (1): I2S */ + /* MCDRV_DAMODE_TAILALIGN (2): + Right-justified Format */ + MCDRV_DAMODE_HEADALIGN + }, + /* sPcmFormat : PCM Format Information */ + { + /* bMono : Mono / Stereo Setting */ + /* MCDRV_PCM_STEREO (0):Stereo */ + /* MCDRV_PCM_MONO (1):Mono */ + MCDRV_PCM_STEREO , + /* bOrder : Bit Order Setting */ + /* MCDRV_PCM_MSB_FIRST (0): MSB First */ + /* MCDRV_PCM_LSB_FIRST (1): LSB First */ + MCDRV_PCM_MSB_FIRST, + /* bLaw : Data Format Setting */ + /* MCDRV_PCM_LINEAR (0): Linear */ + /* MCDRV_PCM_ALAW (1): A-Law */ + /* MCDRV_PCM_MULAW (2): u-Law */ + MCDRV_PCM_LINEAR, + /* bBitSel : Bit Width Setting */ + /* MCDRV_PCM_BITSEL_8 (0):8 bits */ + /* MCDRV_PCM_BITSEL_16 (1):16 bits */ + /* MCDRV_PCM_BITSEL_24 (2):24 bits */ + MCDRV_PCM_BITSEL_16 + } + } +}; + +static const struct MCDRV_DIO_PORT stHifiPort_Default = { + /* sDioCommon */ + { + /* bMasterSlave : Master / Slave Setting */ + /* MCDRV_DIO_SLAVE (0): Slave */ + /* MCDRV_DIO_MASTER (1): Master */ + MCDRV_DIO_MASTER, + + /* bAutoFs : Sampling frequency automatic measurement + ON/OFF Setting in slave mode */ + /* MCDRV_AUTOFS_OFF (0): OFF */ + /* MCDRV_AUTOFS_ON (1): ON */ + MCDRV_AUTOFS_ON , + + /* bFs : Sampling Rate Setting */ + /* MCDRV_FS_48000 (0): 48kHz */ + /* MCDRV_FS_44100 (1): 44.1kHz */ + /* MCDRV_FS_32000 (2): 32kHz */ + /* MCDRV_FS_24000 (4): 24kHz */ + /* MCDRV_FS_22050 (5): 22.05kHz */ + /* MCDRV_FS_16000 (6): 16kHz */ + /* MCDRV_FS_12000 (8): 12kHz */ + /* MCDRV_FS_11025 (9): 11.025kHz */ + /* MCDRV_FS_8000 (10): 8kHz */ + MCDRV_FS_48000, + + /* bBckFs : Bit Clock Frequency Setting */ + /* MCDRV_BCKFS_64 (0): LRCK x 64 */ + /* MCDRV_BCKFS_48 (1): LRCK x 48 */ + /* MCDRV_BCKFS_32 (2): LRCK x 32 */ + /* MCDRV_BCKFS_512 (4): LRCK x 512 */ + /* MCDRV_BCKFS_256 (5): LRCK x 256 */ + /* MCDRV_BCKFS_192 (6): LRCK x 192 */ + /* MCDRV_BCKFS_128 (7): LRCK x 128 */ + /* MCDRV_BCKFS_96 (8): LRCK x 96 */ + /* MCDRV_BCKFS_24 (9): LRCK x 24 */ + /* MCDRV_BCKFS_16 (10): LRCK x 16 */ + /* MCDRV_BCKFS_8 (11): LRCK x 8 */ + /* MCDRV_BCKFS_SLAVE (15): PCM I/F SLAVE */ + MCDRV_BCKFS_32, + + /* bInterface : Interface Selection */ + /* MCDRV_DIO_DA (0): Digital Audio */ + /* MCDRV_DIO_PCM (1): PCM */ + MCDRV_DIO_DA, + + /* bBckInvert : Bit Clock Inversion Setting */ + /* MCDRV_BCLK_NORMAL (0): Normal Operation */ + /* MCDRV_BCLK_INVERT (1): Clock Inverted */ + MCDRV_BCLK_NORMAL, + + /* MCDRV_SRC_NOT_THRU (0) */ + /* MCDRV_SRC_THRU (1) */ + MCDRV_SRC_NOT_THRU, + + /* bPcmHizTim : High Impedance transition timing + after transmitting the last PCM I/F data */ + /* MCDRV_PCMHIZTIM_FALLING (0): + BCLK#* Falling Edge */ + /* MCDRV_PCMHIZTIM_RISING (1): + BCLK#* Rising Edge */ + MCDRV_PCMHIZTIM_FALLING, + + /* bPcmFrame : Frame Mode Setting with PCM interface*/ + /* MCDRV_PCM_SHORTFRAME (0): Short Frame */ + /* MCDRV_PCM_LONGFRAME (1): Long Frame */ + MCDRV_PCM_SHORTFRAME, + + /* bPcmHighPeriod : + LR clock High time setting with PCM selected + and Master selected */ + /* 0 to 31: + High level keeps during the period of time of + (setting value + 1) of the bit clock. */ + 0, + }, + /* sDir */ + { + /* sDaFormat : Digital Audio Format Information */ + { + /* bBitSel : Bit Width Setting */ + /* MCDRV_BITSEL_16 (0): 16bit */ + /* MCDRV_BITSEL_20 (1): 20bit */ + /* MCDRV_BITSEL_24 (2): 24bit */ + /* MCDRV_BITSEL_32 (3): 32bit */ + MCDRV_BITSEL_16, + + /* bMode : Data Format Setting */ + /* MCDRV_DAMODE_HEADALIGN (0): + Left-justified Format */ + /* MCDRV_DAMODE_I2S (1): I2S */ + /* MCDRV_DAMODE_TAILALIGN (2): + Right-justified Format */ + MCDRV_DAMODE_I2S + }, + /* sPcmFormat : PCM Format Information */ + { + /* bMono : Mono / Stereo Setting */ + /* MCDRV_PCM_STEREO (0):Stereo */ + /* MCDRV_PCM_MONO (1):Mono */ + MCDRV_PCM_MONO , + /* bOrder : Bit Order Setting */ + /* MCDRV_PCM_MSB_FIRST (0): MSB First */ + /* MCDRV_PCM_LSB_FIRST (1): LSB First */ + MCDRV_PCM_MSB_FIRST, + /* bLaw : Data Format Setting */ + /* MCDRV_PCM_LINEAR (0): Linear */ + /* MCDRV_PCM_ALAW (1): A-Law */ + /* MCDRV_PCM_MULAW (2): u-Law */ + MCDRV_PCM_LINEAR, + /* bBitSel : Bit Width Setting */ + /* MCDRV_PCM_BITSEL_8 (0):8 bits */ + /* MCDRV_PCM_BITSEL_16 (1):16 bits */ + /* MCDRV_PCM_BITSEL_24 (2):24 bits */ + MCDRV_PCM_BITSEL_8 + } + }, + /* sDit */ + { + MCDRV_STMODE_ZERO, /* bStMode */ + MCDRV_SDOUT_NORMAL, /* bEdge */ + /* sDaFormat : Digital Audio Format Information */ + { + /* bBitSel : Bit Width Setting */ + /* MCDRV_BITSEL_16 (0): 16bit */ + /* MCDRV_BITSEL_20 (1): 20bit */ + /* MCDRV_BITSEL_24 (2): 24bit */ + /* MCDRV_BITSEL_32 (3): 32bit */ + MCDRV_BITSEL_16, + + /* bMode : Data Format Setting */ + /* MCDRV_DAMODE_HEADALIGN (0): + Left-justified Format */ + /* MCDRV_DAMODE_I2S (1): I2S */ + /* MCDRV_DAMODE_TAILALIGN (2): + Right-justified Format */ + MCDRV_DAMODE_I2S + }, + /* sPcmFormat : PCM Format Information */ + { + /* bMono : Mono / Stereo Setting */ + /* MCDRV_PCM_STEREO (0):Stereo */ + /* MCDRV_PCM_MONO (1):Mono */ + MCDRV_PCM_MONO , + /* bOrder : Bit Order Setting */ + /* MCDRV_PCM_MSB_FIRST (0): MSB First */ + /* MCDRV_PCM_LSB_FIRST (1): LSB First */ + MCDRV_PCM_MSB_FIRST, + /* bLaw : Data Format Setting */ + /* MCDRV_PCM_LINEAR (0): Linear */ + /* MCDRV_PCM_ALAW (1): A-Law */ + /* MCDRV_PCM_MULAW (2): u-Law */ + MCDRV_PCM_LINEAR, + /* bBitSel : Bit Width Setting */ + /* MCDRV_PCM_BITSEL_8 (0):8 bits */ + /* MCDRV_PCM_BITSEL_16 (1):16 bits */ + /* MCDRV_PCM_BITSEL_24 (2):24 bits */ + MCDRV_PCM_BITSEL_16 + } + } +}; + +/* ======================================== + HS DET settings + ========================================*/ +static const struct MCDRV_HSDET_INFO stHSDetInfo_Default = { + /* bEnPlugDet */ + MCDRV_PLUGDET_DISABLE, + /* bEnPlugDetDb */ + MCDRV_PLUGDETDB_BOTH_ENABLE, + /* bEnDlyKeyOff */ + MCDRV_KEYEN_D_D_D, + /* bEnDlyKeyOn */ + MCDRV_KEYEN_D_D_D, + /* bEnMicDet */ + MCDRV_MICDET_ENABLE, + /* bEnKeyOff */ + MCDRV_KEYEN_E_E_E, + /* bEnKeyOn */ + MCDRV_KEYEN_E_E_E, + /* bHsDetDbnc */ + MCDRV_DETDBNC_219, + /* bKeyOffMtim */ + MCDRV_KEYOFF_MTIM_63, + /* bKeyOnMtim */ + MCDRV_KEYON_MTIM_63, + /* bKey0OffDlyTim */ + 8, + /* bKey1OffDlyTim */ + 8, + /* bKey2OffDlyTim */ + 8, + /* bKey0OnDlyTim */ + 8, + /* bKey1OnDlyTim */ + 8, + /* bKey2OnDlyTim */ + 8, + /* bKey0OnDlyTim2 */ + 0, + /* bKey1OnDlyTim2 */ + 0, + /* bKey2OnDlyTim2 */ + 0, + /* bIrqType */ + MCDRV_IRQTYPE_REF, + /* bDetInv */ + MCDRV_DET_IN_INV_INV, + /* bHsDetMode */ + MCDRV_HSDET_MODE_DETIN_A, + /* bSperiod */ + MCDRV_SPERIOD_15625, + /* bLperiod */ + 0, + /* bDbncNumPlug */ + MCDRV_DBNC_NUM_7, + /* bDbncNumMic */ + MCDRV_DBNC_NUM_4, + /* bDbncNumKey */ + MCDRV_DBNC_NUM_4, + /* bSgnlPeriod */ + MCDRV_SGNLPERIOD_79, + /* bSgnlNum */ + MCDRV_SGNLNUM_4, + /* bSgnlPeak */ + MCDRV_SGNLPEAK_1182, + /* bImpSel */ + 0, + /* bDlyIrqStop */ + 0, + /* cbfunc */ + 0 +}; + +#define HSUNDETDBNC MCDRV_DETDBNC_109 +#define HSUNDETDBNCNUM MCDRV_DBNC_NUM_7 +#define MSDETMB4OFF (5000) +#define MSMKDETENOFF (200) + +static const struct MCDRV_HSDET_INFO stHSDetInfo_Suspend = { + /* bEnPlugDet */ + MCDRV_PLUGDET_DISABLE, + /* bEnPlugDetDb */ + MCDRV_PLUGDETDB_BOTH_ENABLE, + /* bEnDlyKeyOff */ + MCDRV_KEYEN_D_D_D, + /* bEnDlyKeyOn */ + MCDRV_KEYEN_D_D_D, + /* bEnMicDet */ + MCDRV_MICDET_ENABLE, + /* bEnKeyOff */ + MCDRV_KEYEN_D_D_E, + /* bEnKeyOn */ + MCDRV_KEYEN_D_D_E, + /* bHsDetDbnc */ + MCDRV_DETDBNC_219, + /* bKeyOffMtim */ + MCDRV_KEYOFF_MTIM_63, + /* bKeyOnMtim */ + MCDRV_KEYON_MTIM_63, + /* bKey0OffDlyTim */ + 8, + /* bKey1OffDlyTim */ + 8, + /* bKey2OffDlyTim */ + 8, + /* bKey0OnDlyTim */ + 8, + /* bKey1OnDlyTim */ + 8, + /* bKey2OnDlyTim */ + 8, + /* bKey0OnDlyTim2 */ + 0, + /* bKey1OnDlyTim2 */ + 0, + /* bKey2OnDlyTim2 */ + 0, + /* bIrqType */ + MCDRV_IRQTYPE_REF, + /* bDetInv */ + MCDRV_DET_IN_INV_INV, + /* bHsDetMode */ + MCDRV_HSDET_MODE_DETIN_A, + /* bSperiod */ + MCDRV_SPERIOD_15625, + /* bLperiod */ + 0, + /* bDbncNumPlug */ + MCDRV_DBNC_NUM_7, + /* bDbncNumMic */ + MCDRV_DBNC_NUM_4, + /* bDbncNumKey */ + MCDRV_DBNC_NUM_4, + /* bSgnlPeriod */ + MCDRV_SGNLPERIOD_79, + /* bSgnlNum */ + MCDRV_SGNLNUM_4, + /* bSgnlPeak */ + MCDRV_SGNLPEAK_1182, + /* bImpSel */ + 0, + /* bDlyIrqStop */ + 0, + /* cbfunc */ + 0 +}; + +static const struct MCDRV_HSDET2_INFO stHSDet2Info_Default = { + MCDRV_IRQTYPE_REF, + MCDRV_IRQTYPE_REF, + MCDRV_IRQTYPE_REF, + MCDRV_IRQTYPE_REF, + MCDRV_IRQTYPE_REF, + MCDRV_IRQTYPE_REF, + MCDRV_IRQTYPE_REF, + MCDRV_IRQTYPE_REF, + MCDRV_IRQTYPE_REF, + MCDRV_IRQTYPE_REF +}; + +/* ======================================== + Key Event settings + ========================================*/ +#define MC_ASOC_EV_KEY_DELAYKEYON0 KEY_RESERVED +#define MC_ASOC_EV_KEY_DELAYKEYON1 KEY_RESERVED +#define MC_ASOC_EV_KEY_DELAYKEYON2 KEY_RESERVED + +static const unsigned int mc_asoc_ev_key_delaykeyoff0[8] = { + KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, + KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED +}; +static const unsigned int mc_asoc_ev_key_delaykeyoff1[8] = { + KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, + KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED +}; +static const unsigned int mc_asoc_ev_key_delaykeyoff2[8] = { + KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, + KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED +}; + +#define MC_ASOC_IMP_TBL_NUM (8) +static const SINT16 aswHpVolImpTable[MC_ASOC_IMP_TBL_NUM] = { + 0, 0, 1, 2, 3.5, 5, 0, 0 +}; + +static const SINT16 aswDac0VolImpTable[MC_ASOC_IMP_TBL_NUM] = { + 0, 0, 0, 0, 0, 0, 0, 0 +}; + +#endif diff --git a/sound/soc/codecs/ymu831/ymu831_cfg_pcm.h b/sound/soc/codecs/ymu831/ymu831_cfg_pcm.h new file mode 100644 index 00000000000..18c5519fdbc --- /dev/null +++ b/sound/soc/codecs/ymu831/ymu831_cfg_pcm.h @@ -0,0 +1,1034 @@ +/* + * YMU831 ASoC codec driver + * + * Copyright (c) 2012-2013 Yamaha Corporation + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + */ + +#ifndef YMU831_CFG_H +#define YMU831_CFG_H +#include <linux/input.h> +#include <linux/irq.h> + +#include "mcdriver.h" +#include "ymu831_priv.h" + +/* + * ALSA Version + */ +#define HSDET_WHILE_SUSPEND + +#define MAX_YMS_CTRL_PARAM_SIZE (524288UL) + +#define BUS_SEL_I2C (0) +#define BUS_SEL_SPI (1) +#define BUS_SEL_SLIM (2) +#define BUS_SELECT BUS_SEL_SPI + +#define CAPTURE_PORT_MUSIC (0) +#define CAPTURE_PORT_EXT (1) +#define CAPTURE_PORT CAPTURE_PORT_MUSIC + +#define MC_ASOC_PHYS_DIO0 MCDRV_PHYSPORT_DIO0 +#define MC_ASOC_PHYS_DIO1 MCDRV_PHYSPORT_DIO1 +#define MC_ASOC_PHYS_DIO2 MCDRV_PHYSPORT_DIO2 +#define MC_ASOC_PHYS_NONE MCDRV_PHYSPORT_NONE +#define MC_ASOC_PHYS_SLIM0 MCDRV_PHYSPORT_SLIM0 +#define MC_ASOC_PHYS_SLIM1 MCDRV_PHYSPORT_SLIM1 +#define MC_ASOC_PHYS_SLIM2 MCDRV_PHYSPORT_SLIM2 +#define MUSIC_PHYSICAL_PORT MC_ASOC_PHYS_DIO0 +#define EXT_PHYSICAL_PORT MC_ASOC_PHYS_DIO2 +#define VOICE_PHYSICAL_PORT MC_ASOC_PHYS_DIO1 +#define HIFI_PHYSICAL_PORT MC_ASOC_PHYS_DIO0 + +#define VOICE_RECORDING_UNMUTE (1) + +#define INCALL_MIC_SP MC_ASOC_INCALL_MIC_MAINMIC +#define INCALL_MIC_RC MC_ASOC_INCALL_MIC_MAINMIC +#define INCALL_MIC_HP MC_ASOC_INCALL_MIC_MAINMIC +#define INCALL_MIC_LO1 MC_ASOC_INCALL_MIC_MAINMIC +#define INCALL_MIC_LO2 MC_ASOC_INCALL_MIC_MAINMIC + +#define MIC_NONE (0) +#define MIC_1 (1) +#define MIC_2 (2) +#define MIC_3 (3) +#define MIC_4 (4) +#define MIC_PDM0 (5) +#define MIC_PDM1 (6) + +#define MAIN_MIC MIC_1 +#define SUB_MIC MIC_2 +#define HEADSET_MIC MIC_4 + +#define BIAS_OFF (0) +#define BIAS_ON_ALWAYS (1) +#define BIAS_SYNC_MIC (2) +#define MIC1_BIAS BIAS_OFF +#define MIC2_BIAS BIAS_SYNC_MIC +#define MIC3_BIAS BIAS_SYNC_MIC +#define MIC4_BIAS BIAS_SYNC_MIC + +#define IRQ_TYPE IRQ_TYPE_EDGE_FALLING + +#define AUTO_POWEROFF_OFF (0) +#define AUTO_POWEROFF_ON (1) +#define AUTO_POWEROFF AUTO_POWEROFF_ON + +static const struct mc_asoc_setup mc_asoc_cfg_setup = { + /* init */ + { + MCDRV_CKSEL_CMOS_CMOS, /* bCkSel */ + MCDRV_CKINPUT_CLKI0_CLKI0, /* bCkInput */ + 0x04, /* bPllModeA */ + 0x16, /* bPllPrevDivA */ + 0x0087, /* wPllFbDivA */ + 0x2B02, /* wPllFracA */ + 1, /* bPllFreqA */ + 0x04, /* bPllModeB */ + 0x16, /* bPllPrevDivB */ + 0x0043, /* wPllFbDivB */ + 0x9581, /* wPllFracB */ + 0, /* bPllFreqB */ + 0, /* bHsdetClk */ + MCDRV_DAHIZ_HIZ, /* bDio0SdoHiz */ + MCDRV_DAHIZ_HIZ, /* bDio1SdoHiz */ + MCDRV_DAHIZ_HIZ, /* bDio2SdoHiz */ + MCDRV_DAHIZ_HIZ, /* bDio0ClkHiz */ + MCDRV_DAHIZ_HIZ, /* bDio1ClkHiz */ + MCDRV_DAHIZ_HIZ, /* bDio2ClkHiz */ + MCDRV_PCMHIZ_LOW, /* bDio0PcmHiz */ + MCDRV_PCMHIZ_LOW, /* bDio1PcmHiz */ + MCDRV_PCMHIZ_LOW, /* bDio2PcmHiz */ + MCDRV_PA_GPIO, /* bPa0Func */ + MCDRV_PA_GPIO, /* bPa1Func */ + MCDRV_PA_GPIO, /* bPa2Func */ + MCDRV_POWMODE_FULL, /* bPowerMode */ + MCDRV_MBSEL_22, /* bMbSel1 */ + MCDRV_MBSEL_22, /* bMbSel2 */ + MCDRV_MBSEL_22, /* bMbSel3 */ + MCDRV_MBSEL_22, /* bMbSel4 */ + MCDRV_MBSDISCH_1000, /* bMbsDisch */ + MCDRV_NONCLIP_OFF, /* bNonClip */ + MCDRV_LINE_STEREO, /* bLineIn1Dif */ + MCDRV_LINE_STEREO, /* bLineOut1Dif */ + MCDRV_LINE_STEREO, /* bLineOut2Dif */ + MCDRV_MIC_DIF, /* bMic1Sng */ + MCDRV_MIC_DIF, /* bMic2Sng */ + MCDRV_MIC_DIF, /* bMic3Sng */ + MCDRV_MIC_DIF, /* bMic4Sng */ + MCDRV_ZC_OFF, /* bZcLineOut1 */ + MCDRV_ZC_OFF, /* bZcLineOut2 */ + MCDRV_ZC_ON, /* bZcRc */ + MCDRV_ZC_ON, /* bZcSp */ + MCDRV_ZC_OFF, /* bZcHp */ + MCDRV_SVOL_ON, /* bSvolLineOut1 */ + MCDRV_SVOL_ON, /* bSvolLineOut2 */ + MCDRV_SVOL_ON, /* bSvolRc */ + MCDRV_SVOL_ON, /* bSvolSp */ + MCDRV_SVOL_ON, /* bSvolHp */ + MCDRV_RCIMP_FIXLOW, /* bRcHiz */ + MCDRV_WL_LOFF_ROFF, /* bSpHiz */ + MCDRV_IMP_LFIXLOW_RFIXLOW, /* bHpHiz */ + MCDRV_IMP_LFIXLOW_RFIXLOW, /* bLineOut1Hiz */ + MCDRV_IMP_LFIXLOW_RFIXLOW, /* bLineOut2Hiz */ + MCDRV_CPMOD_MID, /* bCpMod */ + MCDRV_RBSEL_2_2K, /* bRbSel */ + MCDRV_PLUG_LRGM, /* bPlugSel */ + MCDRV_GNDDET_OFF, /* bGndDet */ + MCDRV_PPD_OFF, /* bPpdRc */ + MCDRV_PPD_OFF, /* bPpdSp */ + MCDRV_PPD_OFF, /* bPpdHp */ + MCDRV_PPD_OFF, /* bPpdLineOut1 */ + MCDRV_PPD_OFF, /* bPpdLineOut2 */ + { + /* dWaitTime */ + { + 5000, 5000, 5000, 5000, 25000, 15000, 2000, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + }, + /* dPollInterval */ + { + 1000, 1000, 1000, 1000, 1000, 1000, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + }, + /* dPollTimeOut */ + { + 1000, 1000, 1000, 1000, 1000, 1000, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + } + }, + }, + /* init2 */ + { + { + MCDRV_DOA_DRV_HIGH, + MCDRV_SCKMSK_OFF, + MCDRV_SPMN_OFF_9, + 0x03, 0x30, 0x30, 0x21, 0x03, 0xC0, 0x6B, 0x00, + 0xC0, 0x01, 0x0F, 0, 0, 0, 0, 0, 0 + } + }, + /* rslot */ + { + 0, 1, 2 + }, + /* tslot */ + { + 0, 1, 2 + }, +}; + +static const struct MCDRV_DIO_PORT stMusicPort_Default = { + /* sDioCommon */ + { + /* bMasterSlave : Master / Slave Setting */ + /* MCDRV_DIO_SLAVE (0): Slave */ + /* MCDRV_DIO_MASTER (1): Master */ + MCDRV_DIO_MASTER, + + /* bAutoFs : Sampling frequency automatic measurement + ON/OFF Setting in slave mode */ + /* MCDRV_AUTOFS_OFF (0): OFF */ + /* MCDRV_AUTOFS_ON (1): ON */ + MCDRV_AUTOFS_ON , + + /* bFs : Sampling Rate Setting */ + /* MCDRV_FS_48000 (0): 48kHz */ + /* MCDRV_FS_44100 (1): 44.1kHz */ + /* MCDRV_FS_32000 (2): 32kHz */ + /* MCDRV_FS_24000 (4): 24kHz */ + /* MCDRV_FS_22050 (5): 22.05kHz */ + /* MCDRV_FS_16000 (6): 16kHz */ + /* MCDRV_FS_12000 (8): 12kHz */ + /* MCDRV_FS_11025 (9): 11.025kHz */ + /* MCDRV_FS_8000 (10): 8kHz */ + MCDRV_FS_48000, + + /* bBckFs : Bit Clock Frequency Setting */ + /* MCDRV_BCKFS_64 (0): LRCK x 64 */ + /* MCDRV_BCKFS_48 (1): LRCK x 48 */ + /* MCDRV_BCKFS_32 (2): LRCK x 32 */ + /* MCDRV_BCKFS_512 (4): LRCK x 512 */ + /* MCDRV_BCKFS_256 (5): LRCK x 256 */ + /* MCDRV_BCKFS_192 (6): LRCK x 192 */ + /* MCDRV_BCKFS_128 (7): LRCK x 128 */ + /* MCDRV_BCKFS_96 (8): LRCK x 96 */ + /* MCDRV_BCKFS_24 (9): LRCK x 24 */ + /* MCDRV_BCKFS_16 (10): LRCK x 16 */ + /* MCDRV_BCKFS_8 (11): LRCK x 8 */ + /* MCDRV_BCKFS_SLAVE (15): PCM I/F SLAVE */ + MCDRV_BCKFS_32, + + /* bInterface : Interface Selection */ + /* MCDRV_DIO_DA (0): Digital Audio */ + /* MCDRV_DIO_PCM (1): PCM */ + MCDRV_DIO_DA, + + /* bBckInvert : Bit Clock Inversion Setting */ + /* MCDRV_BCLK_NORMAL (0): Normal Operation */ + /* MCDRV_BCLK_INVERT (1): Clock Inverted */ + MCDRV_BCLK_NORMAL, + + /* MCDRV_SRC_NOT_THRU (0) */ + /* MCDRV_SRC_THRU (1) */ + MCDRV_SRC_NOT_THRU, + + /* bPcmHizTim : High Impedance transition timing + after transmitting the last PCM I/F data */ + /* MCDRV_PCMHIZTIM_FALLING (0): + BCLK#* Falling Edge */ + /* MCDRV_PCMHIZTIM_RISING (1): + BCLK#* Rising Edge */ + MCDRV_PCMHIZTIM_FALLING, + + /* bPcmFrame : Frame Mode Setting with PCM interface*/ + /* MCDRV_PCM_SHORTFRAME (0): Short Frame */ + /* MCDRV_PCM_LONGFRAME (1): Long Frame */ + MCDRV_PCM_SHORTFRAME, + + /* bPcmHighPeriod : + LR clock High time setting with PCM selected + and Master selected */ + /* 0 to 31: + High level keeps during the period of time of + (setting value + 1) of the bit clock. */ + 0, + }, + /* sDir */ + { + /* sDaFormat : Digital Audio Format Information */ + { + /* bBitSel : Bit Width Setting */ + /* MCDRV_BITSEL_16 (0): 16bit */ + /* MCDRV_BITSEL_20 (1): 20bit */ + /* MCDRV_BITSEL_24 (2): 24bit */ + /* MCDRV_BITSEL_32 (3): 32bit */ + MCDRV_BITSEL_16, + + /* bMode : Data Format Setting */ + /* MCDRV_DAMODE_HEADALIGN (0): + Left-justified Format */ + /* MCDRV_DAMODE_I2S (1): I2S */ + /* MCDRV_DAMODE_TAILALIGN (2): + Right-justified Format */ + MCDRV_DAMODE_I2S + }, + /* sPcmFormat : PCM Format Information */ + { + /* bMono : Mono / Stereo Setting */ + /* MCDRV_PCM_STEREO (0):Stereo */ + /* MCDRV_PCM_MONO (1):Mono */ + MCDRV_PCM_MONO , + /* bOrder : Bit Order Setting */ + /* MCDRV_PCM_MSB_FIRST (0): MSB First */ + /* MCDRV_PCM_LSB_FIRST (1): LSB First */ + MCDRV_PCM_MSB_FIRST, + /* bLaw : Data Format Setting */ + /* MCDRV_PCM_LINEAR (0): Linear */ + /* MCDRV_PCM_ALAW (1): A-Law */ + /* MCDRV_PCM_MULAW (2): u-Law */ + MCDRV_PCM_LINEAR, + /* bBitSel : Bit Width Setting */ + /* MCDRV_PCM_BITSEL_8 (0):8 bits */ + /* MCDRV_PCM_BITSEL_16 (1):16 bits */ + /* MCDRV_PCM_BITSEL_24 (2):24 bits */ + MCDRV_PCM_BITSEL_8 + } + }, + /* sDit */ + { + MCDRV_STMODE_ZERO, /* bStMode */ + MCDRV_SDOUT_NORMAL, /* bEdge */ + /* sDaFormat : Digital Audio Format Information */ + { + /* bBitSel : Bit Width Setting */ + /* MCDRV_BITSEL_16 (0): 16bit */ + /* MCDRV_BITSEL_20 (1): 20bit */ + /* MCDRV_BITSEL_24 (2): 24bit */ + /* MCDRV_BITSEL_32 (3): 32bit */ + MCDRV_BITSEL_16, + + /* bMode : Data Format Setting */ + /* MCDRV_DAMODE_HEADALIGN (0): + Left-justified Format */ + /* MCDRV_DAMODE_I2S (1): I2S */ + /* MCDRV_DAMODE_TAILALIGN (2): + Right-justified Format */ + MCDRV_DAMODE_I2S + }, + /* sPcmFormat : PCM Format Information */ + { + /* bMono : Mono / Stereo Setting */ + /* MCDRV_PCM_STEREO (0):Stereo */ + /* MCDRV_PCM_MONO (1):Mono */ + MCDRV_PCM_MONO , + /* bOrder : Bit Order Setting */ + /* MCDRV_PCM_MSB_FIRST (0): MSB First */ + /* MCDRV_PCM_LSB_FIRST (1): LSB First */ + MCDRV_PCM_MSB_FIRST, + /* bLaw : Data Format Setting */ + /* MCDRV_PCM_LINEAR (0): Linear */ + /* MCDRV_PCM_ALAW (1): A-Law */ + /* MCDRV_PCM_MULAW (2): u-Law */ + MCDRV_PCM_LINEAR, + /* bBitSel : Bit Width Setting */ + /* MCDRV_PCM_BITSEL_8 (0):8 bits */ + /* MCDRV_PCM_BITSEL_16 (1):16 bits */ + /* MCDRV_PCM_BITSEL_24 (2):24 bits */ + MCDRV_PCM_BITSEL_16 + } + } +}; + +static const struct MCDRV_DIO_PORT stExtPort_Default = { + /* sDioCommon */ + { + /* bMasterSlave : Master / Slave Setting */ + /* MCDRV_DIO_SLAVE (0): Slave */ + /* MCDRV_DIO_MASTER (1): Master */ + MCDRV_DIO_SLAVE, + + /* bAutoFs : Sampling frequency automatic measurement + ON/OFF Setting in slave mode */ + /* MCDRV_AUTOFS_OFF (0): OFF */ + /* MCDRV_AUTOFS_ON (1): ON */ + MCDRV_AUTOFS_ON , + + /* bFs : Sampling Rate Setting */ + /* MCDRV_FS_48000 (0): 48kHz */ + /* MCDRV_FS_44100 (1): 44.1kHz */ + /* MCDRV_FS_32000 (2): 32kHz */ + /* MCDRV_FS_24000 (4): 24kHz */ + /* MCDRV_FS_22050 (5): 22.05kHz */ + /* MCDRV_FS_16000 (6): 16kHz */ + /* MCDRV_FS_12000 (8): 12kHz */ + /* MCDRV_FS_11025 (9): 11.025kHz */ + /* MCDRV_FS_8000 (10): 8kHz */ + MCDRV_FS_8000, + + /* bBckFs : Bit Clock Frequency Setting */ + /* MCDRV_BCKFS_64 (0): LRCK x 64 */ + /* MCDRV_BCKFS_48 (1): LRCK x 48 */ + /* MCDRV_BCKFS_32 (2): LRCK x 32 */ + /* MCDRV_BCKFS_512 (4): LRCK x 512 */ + /* MCDRV_BCKFS_256 (5): LRCK x 256 */ + /* MCDRV_BCKFS_192 (6): LRCK x 192 */ + /* MCDRV_BCKFS_128 (7): LRCK x 128 */ + /* MCDRV_BCKFS_96 (8): LRCK x 96 */ + /* MCDRV_BCKFS_24 (9): LRCK x 24 */ + /* MCDRV_BCKFS_16 (10): LRCK x 16 */ + /* MCDRV_BCKFS_8 (11): LRCK x 8 */ + /* MCDRV_BCKFS_SLAVE (15): PCM I/F SLAVE */ + MCDRV_BCKFS_SLAVE, + + /* bInterface : Interface Selection */ + /* MCDRV_DIO_DA (0): Digital Audio */ + /* MCDRV_DIO_PCM (1): PCM */ + MCDRV_DIO_PCM, + + /* bBckInvert : Bit Clock Inversion Setting */ + /* MCDRV_BCLK_NORMAL (0): Normal Operation */ + /* MCDRV_BCLK_INVERT (1): Clock Inverted */ + MCDRV_BCLK_NORMAL, + + /* MCDRV_SRC_NOT_THRU (0) */ + /* MCDRV_SRC_THRU (1) */ + MCDRV_SRC_NOT_THRU, + + /* bPcmHizTim : High Impedance transition timing + after transmitting the last PCM I/F data */ + /* MCDRV_PCMHIZTIM_FALLING (0): + BCLK#* Falling Edge */ + /* MCDRV_PCMHIZTIM_RISING (1): + BCLK#* Rising Edge */ + MCDRV_PCMHIZTIM_FALLING, + + /* bPcmFrame : Frame Mode Setting with PCM interface*/ + /* MCDRV_PCM_SHORTFRAME (0): Short Frame */ + /* MCDRV_PCM_LONGFRAME (1): Long Frame */ + MCDRV_PCM_SHORTFRAME, + + /* bPcmHighPeriod : + LR clock High time setting with PCM selected + and Master selected */ + /* 0 to 31: + High level keeps during the period of time of + (setting value + 1) of the bit clock. */ + 0, + }, + /* sDir */ + { + /* sDaFormat : Digital Audio Format Information */ + { + /* bBitSel : Bit Width Setting */ + /* MCDRV_BITSEL_16 (0): 16bit */ + /* MCDRV_BITSEL_20 (1): 20bit */ + /* MCDRV_BITSEL_24 (2): 24bit */ + /* MCDRV_BITSEL_32 (3): 32bit */ + MCDRV_BITSEL_16, + + /* bMode : Data Format Setting */ + /* MCDRV_DAMODE_HEADALIGN (0): + Left-justified Format */ + /* MCDRV_DAMODE_I2S (1): I2S */ + /* MCDRV_DAMODE_TAILALIGN (2): + Right-justified Format */ + MCDRV_DAMODE_I2S + }, + /* sPcmFormat : PCM Format Information */ + { + /* bMono : Mono / Stereo Setting */ + /* MCDRV_PCM_STEREO (0):Stereo */ + /* MCDRV_PCM_MONO (1):Mono */ + MCDRV_PCM_MONO , + /* bOrder : Bit Order Setting */ + /* MCDRV_PCM_MSB_FIRST (0): MSB First */ + /* MCDRV_PCM_LSB_FIRST (1): LSB First */ + MCDRV_PCM_LSB_FIRST, + /* bLaw : Data Format Setting */ + /* MCDRV_PCM_LINEAR (0): Linear */ + /* MCDRV_PCM_ALAW (1): A-Law */ + /* MCDRV_PCM_MULAW (2): u-Law */ + MCDRV_PCM_LINEAR, + /* bBitSel : Bit Width Setting */ + /* MCDRV_PCM_BITSEL_8 (0):8 bits */ + /* MCDRV_PCM_BITSEL_16 (1):16 bits */ + /* MCDRV_PCM_BITSEL_24 (2):24 bits */ + MCDRV_PCM_BITSEL_16 + } + }, + /* sDit */ + { + MCDRV_STMODE_ZERO, /* bStMode */ + MCDRV_SDOUT_NORMAL, /* bEdge */ + /* sDaFormat : Digital Audio Format Information */ + { + /* bBitSel : Bit Width Setting */ + /* MCDRV_BITSEL_16 (0): 16bit */ + /* MCDRV_BITSEL_20 (1): 20bit */ + /* MCDRV_BITSEL_24 (2): 24bit */ + /* MCDRV_BITSEL_32 (3): 32bit */ + MCDRV_BITSEL_16, + + /* bMode : Data Format Setting */ + /* MCDRV_DAMODE_HEADALIGN (0): + Left-justified Format */ + /* MCDRV_DAMODE_I2S (1): I2S */ + /* MCDRV_DAMODE_TAILALIGN (2): + Right-justified Format */ + MCDRV_DAMODE_I2S + }, + /* sPcmFormat : PCM Format Information */ + { + /* bMono : Mono / Stereo Setting */ + /* MCDRV_PCM_STEREO (0):Stereo */ + /* MCDRV_PCM_MONO (1):Mono */ + MCDRV_PCM_MONO , + /* bOrder : Bit Order Setting */ + /* MCDRV_PCM_MSB_FIRST (0): MSB First */ + /* MCDRV_PCM_LSB_FIRST (1): LSB First */ + MCDRV_PCM_LSB_FIRST, + /* bLaw : Data Format Setting */ + /* MCDRV_PCM_LINEAR (0): Linear */ + /* MCDRV_PCM_ALAW (1): A-Law */ + /* MCDRV_PCM_MULAW (2): u-Law */ + MCDRV_PCM_LINEAR, + /* bBitSel : Bit Width Setting */ + /* MCDRV_PCM_BITSEL_8 (0):8 bits */ + /* MCDRV_PCM_BITSEL_16 (1):16 bits */ + /* MCDRV_PCM_BITSEL_24 (2):24 bits */ + MCDRV_PCM_BITSEL_16 + } + } +}; + +static const struct MCDRV_DIO_PORT stVoicePort_Default = { + /* sDioCommon */ + { + /* bMasterSlave : Master / Slave Setting */ + /* MCDRV_DIO_SLAVE (0): Slave */ + /* MCDRV_DIO_MASTER (1): Master */ + MCDRV_DIO_SLAVE, + + /* bAutoFs : Sampling frequency automatic measurement + ON/OFF Setting in slave mode */ + /* MCDRV_AUTOFS_OFF (0): OFF */ + /* MCDRV_AUTOFS_ON (1): ON */ + MCDRV_AUTOFS_ON , + + /* bFs : Sampling Rate Setting */ + /* MCDRV_FS_48000 (0): 48kHz */ + /* MCDRV_FS_44100 (1): 44.1kHz */ + /* MCDRV_FS_32000 (2): 32kHz */ + /* MCDRV_FS_24000 (4): 24kHz */ + /* MCDRV_FS_22050 (5): 22.05kHz */ + /* MCDRV_FS_16000 (6): 16kHz */ + /* MCDRV_FS_12000 (8): 12kHz */ + /* MCDRV_FS_11025 (9): 11.025kHz */ + /* MCDRV_FS_8000 (10): 8kHz */ + MCDRV_FS_8000, + + /* bBckFs : Bit Clock Frequency Setting */ + /* MCDRV_BCKFS_64 (0): LRCK x 64 */ + /* MCDRV_BCKFS_48 (1): LRCK x 48 */ + /* MCDRV_BCKFS_32 (2): LRCK x 32 */ + /* MCDRV_BCKFS_512 (4): LRCK x 512 */ + /* MCDRV_BCKFS_256 (5): LRCK x 256 */ + /* MCDRV_BCKFS_192 (6): LRCK x 192 */ + /* MCDRV_BCKFS_128 (7): LRCK x 128 */ + /* MCDRV_BCKFS_96 (8): LRCK x 96 */ + /* MCDRV_BCKFS_24 (9): LRCK x 24 */ + /* MCDRV_BCKFS_16 (10): LRCK x 16 */ + /* MCDRV_BCKFS_8 (11): LRCK x 8 */ + /* MCDRV_BCKFS_SLAVE (15): PCM I/F SLAVE */ + MCDRV_BCKFS_SLAVE, + + /* bInterface : Interface Selection */ + /* MCDRV_DIO_DA (0): Digital Audio */ + /* MCDRV_DIO_PCM (1): PCM */ + MCDRV_DIO_PCM, + + /* bBckInvert : Bit Clock Inversion Setting */ + /* MCDRV_BCLK_NORMAL (0): Normal Operation */ + /* MCDRV_BCLK_INVERT (1): Clock Inverted */ + MCDRV_BCLK_NORMAL, + + /* bSrcThru */ + /* MCDRV_SRC_NOT_THRU (0) */ + /* MCDRV_SRC_THRU (1) */ + MCDRV_SRC_NOT_THRU, + + /* bPcmHizTim : High Impedance transition timing + after transmitting the last PCM I/F data */ + /* MCDRV_PCMHIZTIM_FALLING (0): + BCLK#* Falling Edge */ + /* MCDRV_PCMHIZTIM_RISING (1): + BCLK#* Rising Edge */ + MCDRV_PCMHIZTIM_FALLING, + + /* bPcmFrame : Frame Mode Setting with PCM interface*/ + /* MCDRV_PCM_SHORTFRAME (0): Short Frame */ + /* MCDRV_PCM_LONGFRAME (1): Long Frame */ + MCDRV_PCM_SHORTFRAME, + + /* bPcmHighPeriod : + LR clock High time setting with PCM selected + and Master selected */ + /* 0 to 31: + High level keeps during the period of time of + (setting value + 1) of the bit clock. */ + 0, + }, + /* sDir */ + { + /* sDaFormat : Digital Audio Format Information */ + { + /* bBitSel : Bit Width Setting */ + /* MCDRV_BITSEL_16 (0): 16bit */ + /* MCDRV_BITSEL_20 (1): 20bit */ + /* MCDRV_BITSEL_24 (2): 24bit */ + /* MCDRV_BITSEL_32 (3): 32bit */ + MCDRV_BITSEL_16, + + /* bMode : Data Format Setting */ + /* MCDRV_DAMODE_HEADALIGN (0): + Left-justified Format */ + /* MCDRV_DAMODE_I2S (1): I2S */ + /* MCDRV_DAMODE_TAILALIGN (2): + Right-justified Format */ + MCDRV_DAMODE_I2S + }, + /* sPcmFormat : PCM Format Information */ + { + /* bMono : Mono / Stereo Setting */ + /* MCDRV_PCM_STEREO (0):Stereo */ + /* MCDRV_PCM_MONO (1):Mono */ + MCDRV_PCM_MONO , + /* bOrder : Bit Order Setting */ + /* MCDRV_PCM_MSB_FIRST (0): MSB First */ + /* MCDRV_PCM_LSB_FIRST (1): LSB First */ + MCDRV_PCM_MSB_FIRST, + /* bLaw : Data Format Setting */ + /* MCDRV_PCM_LINEAR (0): Linear */ + /* MCDRV_PCM_ALAW (1): A-Law */ + /* MCDRV_PCM_MULAW (2): u-Law */ + MCDRV_PCM_LINEAR, + /* bBitSel : Bit Width Setting */ + /* MCDRV_PCM_BITSEL_8 (0):8 bits */ + /* MCDRV_PCM_BITSEL_16 (1):16 bits */ + /* MCDRV_PCM_BITSEL_24 (2):24 bits */ + MCDRV_PCM_BITSEL_16 + }, + }, + /* sDit */ + { + MCDRV_STMODE_ZERO, /* bStMode */ + MCDRV_SDOUT_NORMAL, /* bEdge */ + /* sDaFormat : Digital Audio Format Information */ + { + /* bBitSel : Bit Width Setting */ + /* MCDRV_BITSEL_16 (0): 16bit */ + /* MCDRV_BITSEL_20 (1): 20bit */ + /* MCDRV_BITSEL_24 (2): 24bit */ + /* MCDRV_BITSEL_32 (3): 32bit */ + MCDRV_BITSEL_16, + + /* bMode : Data Format Setting */ + /* MCDRV_DAMODE_HEADALIGN (0): + Left-justified Format */ + /* MCDRV_DAMODE_I2S (1): I2S */ + /* MCDRV_DAMODE_TAILALIGN (2): + Right-justified Format */ + MCDRV_DAMODE_I2S + }, + /* sPcmFormat : PCM Format Information */ + { + /* bMono : Mono / Stereo Setting */ + /* MCDRV_PCM_STEREO (0):Stereo */ + /* MCDRV_PCM_MONO (1):Mono */ + MCDRV_PCM_MONO , + /* bOrder : Bit Order Setting */ + /* MCDRV_PCM_MSB_FIRST (0): MSB First */ + /* MCDRV_PCM_LSB_FIRST (1): LSB First */ + MCDRV_PCM_MSB_FIRST, + /* bLaw : Data Format Setting */ + /* MCDRV_PCM_LINEAR (0): Linear */ + /* MCDRV_PCM_ALAW (1): A-Law */ + /* MCDRV_PCM_MULAW (2): u-Law */ + MCDRV_PCM_LINEAR, + /* bBitSel : Bit Width Setting */ + /* MCDRV_PCM_BITSEL_8 (0):8 bits */ + /* MCDRV_PCM_BITSEL_16 (1):16 bits */ + /* MCDRV_PCM_BITSEL_24 (2):24 bits */ + MCDRV_PCM_BITSEL_16 + } + } +}; + +static const struct MCDRV_DIO_PORT stHifiPort_Default = { + /* sDioCommon */ + { + /* bMasterSlave : Master / Slave Setting */ + /* MCDRV_DIO_SLAVE (0): Slave */ + /* MCDRV_DIO_MASTER (1): Master */ + MCDRV_DIO_MASTER, + + /* bAutoFs : Sampling frequency automatic measurement + ON/OFF Setting in slave mode */ + /* MCDRV_AUTOFS_OFF (0): OFF */ + /* MCDRV_AUTOFS_ON (1): ON */ + MCDRV_AUTOFS_ON , + + /* bFs : Sampling Rate Setting */ + /* MCDRV_FS_48000 (0): 48kHz */ + /* MCDRV_FS_44100 (1): 44.1kHz */ + /* MCDRV_FS_32000 (2): 32kHz */ + /* MCDRV_FS_24000 (4): 24kHz */ + /* MCDRV_FS_22050 (5): 22.05kHz */ + /* MCDRV_FS_16000 (6): 16kHz */ + /* MCDRV_FS_12000 (8): 12kHz */ + /* MCDRV_FS_11025 (9): 11.025kHz */ + /* MCDRV_FS_8000 (10): 8kHz */ + MCDRV_FS_48000, + + /* bBckFs : Bit Clock Frequency Setting */ + /* MCDRV_BCKFS_64 (0): LRCK x 64 */ + /* MCDRV_BCKFS_48 (1): LRCK x 48 */ + /* MCDRV_BCKFS_32 (2): LRCK x 32 */ + /* MCDRV_BCKFS_512 (4): LRCK x 512 */ + /* MCDRV_BCKFS_256 (5): LRCK x 256 */ + /* MCDRV_BCKFS_192 (6): LRCK x 192 */ + /* MCDRV_BCKFS_128 (7): LRCK x 128 */ + /* MCDRV_BCKFS_96 (8): LRCK x 96 */ + /* MCDRV_BCKFS_24 (9): LRCK x 24 */ + /* MCDRV_BCKFS_16 (10): LRCK x 16 */ + /* MCDRV_BCKFS_8 (11): LRCK x 8 */ + /* MCDRV_BCKFS_SLAVE (15): PCM I/F SLAVE */ + MCDRV_BCKFS_32, + + /* bInterface : Interface Selection */ + /* MCDRV_DIO_DA (0): Digital Audio */ + /* MCDRV_DIO_PCM (1): PCM */ + MCDRV_DIO_DA, + + /* bBckInvert : Bit Clock Inversion Setting */ + /* MCDRV_BCLK_NORMAL (0): Normal Operation */ + /* MCDRV_BCLK_INVERT (1): Clock Inverted */ + MCDRV_BCLK_NORMAL, + + /* MCDRV_SRC_NOT_THRU (0) */ + /* MCDRV_SRC_THRU (1) */ + MCDRV_SRC_NOT_THRU, + + /* bPcmHizTim : High Impedance transition timing + after transmitting the last PCM I/F data */ + /* MCDRV_PCMHIZTIM_FALLING (0): + BCLK#* Falling Edge */ + /* MCDRV_PCMHIZTIM_RISING (1): + BCLK#* Rising Edge */ + MCDRV_PCMHIZTIM_FALLING, + + /* bPcmFrame : Frame Mode Setting with PCM interface*/ + /* MCDRV_PCM_SHORTFRAME (0): Short Frame */ + /* MCDRV_PCM_LONGFRAME (1): Long Frame */ + MCDRV_PCM_SHORTFRAME, + + /* bPcmHighPeriod : + LR clock High time setting with PCM selected + and Master selected */ + /* 0 to 31: + High level keeps during the period of time of + (setting value + 1) of the bit clock. */ + 0, + }, + /* sDir */ + { + /* sDaFormat : Digital Audio Format Information */ + { + /* bBitSel : Bit Width Setting */ + /* MCDRV_BITSEL_16 (0): 16bit */ + /* MCDRV_BITSEL_20 (1): 20bit */ + /* MCDRV_BITSEL_24 (2): 24bit */ + /* MCDRV_BITSEL_32 (3): 32bit */ + MCDRV_BITSEL_16, + + /* bMode : Data Format Setting */ + /* MCDRV_DAMODE_HEADALIGN (0): + Left-justified Format */ + /* MCDRV_DAMODE_I2S (1): I2S */ + /* MCDRV_DAMODE_TAILALIGN (2): + Right-justified Format */ + MCDRV_DAMODE_I2S + }, + /* sPcmFormat : PCM Format Information */ + { + /* bMono : Mono / Stereo Setting */ + /* MCDRV_PCM_STEREO (0):Stereo */ + /* MCDRV_PCM_MONO (1):Mono */ + MCDRV_PCM_MONO , + /* bOrder : Bit Order Setting */ + /* MCDRV_PCM_MSB_FIRST (0): MSB First */ + /* MCDRV_PCM_LSB_FIRST (1): LSB First */ + MCDRV_PCM_MSB_FIRST, + /* bLaw : Data Format Setting */ + /* MCDRV_PCM_LINEAR (0): Linear */ + /* MCDRV_PCM_ALAW (1): A-Law */ + /* MCDRV_PCM_MULAW (2): u-Law */ + MCDRV_PCM_LINEAR, + /* bBitSel : Bit Width Setting */ + /* MCDRV_PCM_BITSEL_8 (0):8 bits */ + /* MCDRV_PCM_BITSEL_16 (1):16 bits */ + /* MCDRV_PCM_BITSEL_24 (2):24 bits */ + MCDRV_PCM_BITSEL_8 + } + }, + /* sDit */ + { + MCDRV_STMODE_ZERO, /* bStMode */ + MCDRV_SDOUT_NORMAL, /* bEdge */ + /* sDaFormat : Digital Audio Format Information */ + { + /* bBitSel : Bit Width Setting */ + /* MCDRV_BITSEL_16 (0): 16bit */ + /* MCDRV_BITSEL_20 (1): 20bit */ + /* MCDRV_BITSEL_24 (2): 24bit */ + /* MCDRV_BITSEL_32 (3): 32bit */ + MCDRV_BITSEL_16, + + /* bMode : Data Format Setting */ + /* MCDRV_DAMODE_HEADALIGN (0): + Left-justified Format */ + /* MCDRV_DAMODE_I2S (1): I2S */ + /* MCDRV_DAMODE_TAILALIGN (2): + Right-justified Format */ + MCDRV_DAMODE_I2S + }, + /* sPcmFormat : PCM Format Information */ + { + /* bMono : Mono / Stereo Setting */ + /* MCDRV_PCM_STEREO (0):Stereo */ + /* MCDRV_PCM_MONO (1):Mono */ + MCDRV_PCM_MONO , + /* bOrder : Bit Order Setting */ + /* MCDRV_PCM_MSB_FIRST (0): MSB First */ + /* MCDRV_PCM_LSB_FIRST (1): LSB First */ + MCDRV_PCM_MSB_FIRST, + /* bLaw : Data Format Setting */ + /* MCDRV_PCM_LINEAR (0): Linear */ + /* MCDRV_PCM_ALAW (1): A-Law */ + /* MCDRV_PCM_MULAW (2): u-Law */ + MCDRV_PCM_LINEAR, + /* bBitSel : Bit Width Setting */ + /* MCDRV_PCM_BITSEL_8 (0):8 bits */ + /* MCDRV_PCM_BITSEL_16 (1):16 bits */ + /* MCDRV_PCM_BITSEL_24 (2):24 bits */ + MCDRV_PCM_BITSEL_16 + } + } +}; + +/* ======================================== + HS DET settings + ========================================*/ +static const struct MCDRV_HSDET_INFO stHSDetInfo_Default = { + /* bEnPlugDet */ + MCDRV_PLUGDET_DISABLE, + /* bEnPlugDetDb */ + MCDRV_PLUGDETDB_BOTH_ENABLE, + /* bEnDlyKeyOff */ + MCDRV_KEYEN_D_D_D, + /* bEnDlyKeyOn */ + MCDRV_KEYEN_D_D_D, + /* bEnMicDet */ + MCDRV_MICDET_ENABLE, + /* bEnKeyOff */ + MCDRV_KEYEN_E_E_E, + /* bEnKeyOn */ + MCDRV_KEYEN_E_E_E, + /* bHsDetDbnc */ + MCDRV_DETDBNC_219, + /* bKeyOffMtim */ + MCDRV_KEYOFF_MTIM_63, + /* bKeyOnMtim */ + MCDRV_KEYON_MTIM_63, + /* bKey0OffDlyTim */ + 8, + /* bKey1OffDlyTim */ + 8, + /* bKey2OffDlyTim */ + 8, + /* bKey0OnDlyTim */ + 8, + /* bKey1OnDlyTim */ + 8, + /* bKey2OnDlyTim */ + 8, + /* bKey0OnDlyTim2 */ + 0, + /* bKey1OnDlyTim2 */ + 0, + /* bKey2OnDlyTim2 */ + 0, + /* bIrqType */ + MCDRV_IRQTYPE_REF, + /* bDetInv */ + MCDRV_DET_IN_INV_INV, + /* bHsDetMode */ + MCDRV_HSDET_MODE_DETIN_A, + /* bSperiod */ + MCDRV_SPERIOD_15625, + /* bLperiod */ + 0, + /* bDbncNumPlug */ + MCDRV_DBNC_NUM_7, + /* bDbncNumMic */ + MCDRV_DBNC_NUM_4, + /* bDbncNumKey */ + MCDRV_DBNC_NUM_4, + /* bSgnlPeriod */ + MCDRV_SGNLPERIOD_79, + /* bSgnlNum */ + MCDRV_SGNLNUM_4, + /* bSgnlPeak */ + MCDRV_SGNLPEAK_1182, + /* bImpSel */ + 0, + /* bDlyIrqStop */ + 0, + /* cbfunc */ + 0 +}; + +#define HSUNDETDBNC MCDRV_DETDBNC_109 +#define HSUNDETDBNCNUM MCDRV_DBNC_NUM_7 +#define MSDETMB4OFF (5000) +#define MSMKDETENOFF (200) + +static const struct MCDRV_HSDET_INFO stHSDetInfo_Suspend = { + /* bEnPlugDet */ + MCDRV_PLUGDET_DISABLE, + /* bEnPlugDetDb */ + MCDRV_PLUGDETDB_BOTH_ENABLE, + /* bEnDlyKeyOff */ + MCDRV_KEYEN_D_D_D, + /* bEnDlyKeyOn */ + MCDRV_KEYEN_D_D_D, + /* bEnMicDet */ + MCDRV_MICDET_ENABLE, + /* bEnKeyOff */ + MCDRV_KEYEN_D_D_E, + /* bEnKeyOn */ + MCDRV_KEYEN_D_D_E, + /* bHsDetDbnc */ + MCDRV_DETDBNC_219, + /* bKeyOffMtim */ + MCDRV_KEYOFF_MTIM_63, + /* bKeyOnMtim */ + MCDRV_KEYON_MTIM_63, + /* bKey0OffDlyTim */ + 8, + /* bKey1OffDlyTim */ + 8, + /* bKey2OffDlyTim */ + 8, + /* bKey0OnDlyTim */ + 8, + /* bKey1OnDlyTim */ + 8, + /* bKey2OnDlyTim */ + 8, + /* bKey0OnDlyTim2 */ + 0, + /* bKey1OnDlyTim2 */ + 0, + /* bKey2OnDlyTim2 */ + 0, + /* bIrqType */ + MCDRV_IRQTYPE_REF, + /* bDetInv */ + MCDRV_DET_IN_INV_INV, + /* bHsDetMode */ + MCDRV_HSDET_MODE_DETIN_A, + /* bSperiod */ + MCDRV_SPERIOD_15625, + /* bLperiod */ + 0, + /* bDbncNumPlug */ + MCDRV_DBNC_NUM_7, + /* bDbncNumMic */ + MCDRV_DBNC_NUM_4, + /* bDbncNumKey */ + MCDRV_DBNC_NUM_4, + /* bSgnlPeriod */ + MCDRV_SGNLPERIOD_79, + /* bSgnlNum */ + MCDRV_SGNLNUM_4, + /* bSgnlPeak */ + MCDRV_SGNLPEAK_1182, + /* bImpSel */ + 0, + /* bDlyIrqStop */ + 0, + /* cbfunc */ + 0 +}; + +static const struct MCDRV_HSDET2_INFO stHSDet2Info_Default = { + MCDRV_IRQTYPE_REF, + MCDRV_IRQTYPE_REF, + MCDRV_IRQTYPE_REF, + MCDRV_IRQTYPE_REF, + MCDRV_IRQTYPE_REF, + MCDRV_IRQTYPE_REF, + MCDRV_IRQTYPE_REF, + MCDRV_IRQTYPE_REF, + MCDRV_IRQTYPE_REF, + MCDRV_IRQTYPE_REF +}; + +/* ======================================== + Key Event settings + ========================================*/ +#define MC_ASOC_EV_KEY_DELAYKEYON0 KEY_RESERVED +#define MC_ASOC_EV_KEY_DELAYKEYON1 KEY_RESERVED +#define MC_ASOC_EV_KEY_DELAYKEYON2 KEY_RESERVED + +static const unsigned int mc_asoc_ev_key_delaykeyoff0[8] = { + KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, + KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED +}; +static const unsigned int mc_asoc_ev_key_delaykeyoff1[8] = { + KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, + KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED +}; +static const unsigned int mc_asoc_ev_key_delaykeyoff2[8] = { + KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, + KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED +}; + +#define MC_ASOC_IMP_TBL_NUM (8) +static const SINT16 aswHpVolImpTable[MC_ASOC_IMP_TBL_NUM] = { + 0, 0, 2, 4, 6, 8, 0, 0 +}; + +static const SINT16 aswDac0VolImpTable[MC_ASOC_IMP_TBL_NUM] = { + 0, 0, 0, 0, 0, 0, 0, 0 +}; + +#endif diff --git a/sound/soc/codecs/ymu831/ymu831_dbg.c b/sound/soc/codecs/ymu831/ymu831_dbg.c new file mode 100644 index 00000000000..9bcacb63448 --- /dev/null +++ b/sound/soc/codecs/ymu831/ymu831_dbg.c @@ -0,0 +1,526 @@ +/* + * YMU831 ASoC codec driver + * + * Copyright (c) 2012 Yamaha Corporation + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + */ + +#ifdef CONFIG_SND_SOC_YAMAHA_YMU831_DEBUG + +#include "mcdriver.h" +#include "ymu831_priv.h" + +static void mc_asoc_dump_init_info(const void *pvPrm, UINT32 dPrm) +{ + struct MCDRV_INIT_INFO *info = (struct MCDRV_INIT_INFO *)pvPrm; + UINT8 i; + char str[128], *p; + + dbg_info("%13s= 0x%02x\n", "bCkSel", info->bCkSel); + dbg_info("%13s= 0x%02x\n", "bCkInput", info->bCkInput); + dbg_info("%13s= 0x%02x\n", "bPllModeA", info->bPllModeA); + dbg_info("%13s= 0x%02x\n", "bPllPrevDivA", info->bPllPrevDivA); + dbg_info("%13s= 0x%04x\n", "wPllFbDivA", info->wPllFbDivA); + dbg_info("%13s= 0x%04x\n", "wPllFracA", info->wPllFracA); + dbg_info("%13s= 0x%02x\n", "bPllFreqA", info->bPllFreqA); + dbg_info("%13s= 0x%02x\n", "bPllModeB", info->bPllModeB); + dbg_info("%13s= 0x%02x\n", "bPllPrevDivB", info->bPllPrevDivB); + dbg_info("%13s= 0x%04x\n", "wPllFbDivB", info->wPllFbDivB); + dbg_info("%13s= 0x%04x\n", "wPllFracB", info->wPllFracB); + dbg_info("%13s= 0x%02x\n", "bPllFreqB", info->bPllFreqB); + dbg_info("%13s= 0x%02x\n", "bHsdetClk", info->bHsdetClk); + dbg_info("%13s= 0x%02x\n", "bDio1SdoHiz", info->bDio1SdoHiz); + dbg_info("%13s= 0x%02x\n", "bDio2SdoHiz", info->bDio2SdoHiz); + dbg_info("%13s= 0x%02x\n", "bDio0ClkHiz", info->bDio0ClkHiz); + dbg_info("%13s= 0x%02x\n", "bDio1ClkHiz", info->bDio1ClkHiz); + dbg_info("%13s= 0x%02x\n", "bDio2ClkHiz", info->bDio2ClkHiz); + dbg_info("%13s= 0x%02x\n", "bDio0PcmHiz", info->bDio0PcmHiz); + dbg_info("%13s= 0x%02x\n", "bDio1PcmHiz", info->bDio1PcmHiz); + dbg_info("%13s= 0x%02x\n", "bDio2PcmHiz", info->bDio2PcmHiz); + dbg_info("%13s= 0x%02x\n", "bPa0Func", info->bPa0Func); + dbg_info("%13s= 0x%02x\n", "bPa1Func", info->bPa1Func); + dbg_info("%13s= 0x%02x\n", "bPa2Func", info->bPa2Func); + dbg_info("%13s= 0x%02x\n", "bPowerMode", info->bPowerMode); + dbg_info("%13s= 0x%02x\n", "bMbSel1", info->bMbSel1); + dbg_info("%13s= 0x%02x\n", "bMbSel2", info->bMbSel2); + dbg_info("%13s= 0x%02x\n", "bMbSel3", info->bMbSel3); + dbg_info("%13s= 0x%02x\n", "bMbSel4", info->bMbSel4); + dbg_info("%13s= 0x%02x\n", "bMbsDisch", info->bMbsDisch); + dbg_info("%13s= 0x%02x\n", "bNonClip", info->bNonClip); + dbg_info("%13s= 0x%02x\n", "bLineIn1Dif", info->bLineIn1Dif); + dbg_info("%13s= 0x%02x\n", "bLineOut1Dif", info->bLineOut1Dif); + dbg_info("%13s= 0x%02x\n", "bLineOut2Dif", info->bLineOut2Dif); + dbg_info("%13s= 0x%02x\n", "bMic1Sng", info->bMic1Sng); + dbg_info("%13s= 0x%02x\n", "bMic2Sng", info->bMic2Sng); + dbg_info("%13s= 0x%02x\n", "bMic3Sng", info->bMic3Sng); + dbg_info("%13s= 0x%02x\n", "bMic4Sng", info->bMic4Sng); + dbg_info("%13s= 0x%02x\n", "bZcLineOut1", info->bZcLineOut1); + dbg_info("%13s= 0x%02x\n", "bZcLineOut2", info->bZcLineOut2); + dbg_info("%13s= 0x%02x\n", "bZcRc", info->bZcRc); + dbg_info("%13s= 0x%02x\n", "bZcSp", info->bZcSp); + dbg_info("%13s= 0x%02x\n", "bZcHp", info->bZcHp); + dbg_info("%13s= 0x%02x\n", "bSvolLineOut1", info->bSvolLineOut1); + dbg_info("%13s= 0x%02x\n", "bSvolLineOut2", info->bSvolLineOut2); + dbg_info("%13s= 0x%02x\n", "bSvolRc", info->bSvolRc); + dbg_info("%13s= 0x%02x\n", "bSvolSp", info->bSvolSp); + dbg_info("%13s= 0x%02x\n", "bSvolHp", info->bSvolHp); + dbg_info("%13s= 0x%02x\n", "bRcHiz", info->bRcHiz); + dbg_info("%13s= 0x%02x\n", "bSpHiz", info->bSpHiz); + dbg_info("%13s= 0x%02x\n", "bHpHiz", info->bHpHiz); + dbg_info("%13s= 0x%02x\n", "bLineOut1Hiz", info->bLineOut1Hiz); + dbg_info("%13s= 0x%02x\n", "bLineOut2Hiz", info->bLineOut2Hiz); + dbg_info("%13s= 0x%02x\n", "bCpMod", info->bCpMod); + dbg_info("%13s= 0x%02x\n", "bRbSel", info->bRbSel); + dbg_info("%13s= 0x%02x\n", "bPlugSel", info->bPlugSel); + dbg_info("%13s= 0x%02x\n", "bGndDet", info->bGndDet); + + dbg_info("sWaitTime.dWaitTime="); + p = str; + for (i = 0; i < 20; i++) { + if (i == 10) { + dbg_info("%s\n", str); + p = str; + } + p += sprintf(p, " %lu", info->sWaitTime.dWaitTime[i]); + } + dbg_info("%s\n", str); + + dbg_info("sWaitTime.dPollInterval="); + p = str; + for (i = 0; i < 20; i++) { + if (i == 10) { + dbg_info("%s\n", str); + p = str; + } + p += sprintf(p, " %lu", info->sWaitTime.dPollInterval[i]); + } + dbg_info("%s\n", str); + + dbg_info("sWaitTime.dPollTimeOut="); + p = str; + for (i = 0; i < 20; i++) { + if (i == 10) { + dbg_info("%s\n", str); + p = str; + } + p += sprintf(p, " %lu", info->sWaitTime.dPollTimeOut[i]); + } + dbg_info("%s\n", str); +} + +static void mc_asoc_dump_reg_info(const void *pvPrm, UINT32 dPrm) +{ + struct MCDRV_REG_INFO *info = (struct MCDRV_REG_INFO *)pvPrm; + + dbg_info("bRegType = 0x%02x\n", info->bRegType); + dbg_info("bAddress = 0x%02x\n", info->bAddress); + dbg_info("bData = 0x%02x\n", info->bData); +} + +#define DEF_PATH(p) {offsetof(struct MCDRV_PATH_INFO, p), #p} + +static void mc_asoc_dump_path_info(const void *pvPrm, UINT32 dPrm) +{ + struct MCDRV_PATH_INFO *info = (struct MCDRV_PATH_INFO *)pvPrm; + int i; + UINT32 mask = (dPrm == 0) ? 0xFFFFFF : dPrm; + size_t offset_hostin; + + struct path_table { + size_t offset; + char *name; + }; + + struct path_table table[] = { + DEF_PATH(asMusicOut[0]), DEF_PATH(asMusicOut[1]), + DEF_PATH(asExtOut[0]), DEF_PATH(asExtOut[1]), + DEF_PATH(asHifiOut[0]), + DEF_PATH(asVboxMixIn[0]), DEF_PATH(asVboxMixIn[1]), + DEF_PATH(asVboxMixIn[2]), DEF_PATH(asVboxMixIn[3]), + DEF_PATH(asAe0[0]), DEF_PATH(asAe0[1]), + DEF_PATH(asAe1[0]), DEF_PATH(asAe1[1]), + DEF_PATH(asAe2[0]), DEF_PATH(asAe2[1]), + DEF_PATH(asAe3[0]), DEF_PATH(asAe3[1]), + DEF_PATH(asDac0[0]), DEF_PATH(asDac0[1]), + DEF_PATH(asDac1[0]), DEF_PATH(asDac1[1]), + DEF_PATH(asVoiceOut[0]), + DEF_PATH(asVboxIoIn[0]), + DEF_PATH(asVboxHostIn[0]), + DEF_PATH(asHostOut[0]), + DEF_PATH(asAdif0[0]), DEF_PATH(asAdif0[1]), + DEF_PATH(asAdif1[0]), DEF_PATH(asAdif1[1]), + DEF_PATH(asAdif2[0]), DEF_PATH(asAdif2[1]), + DEF_PATH(asAdc0[0]), DEF_PATH(asAdc0[1]), + DEF_PATH(asAdc1[0]), + DEF_PATH(asSp[0]), DEF_PATH(asSp[1]), + DEF_PATH(asHp[0]), DEF_PATH(asHp[1]), + DEF_PATH(asRc[0]), + DEF_PATH(asLout1[0]), DEF_PATH(asLout1[1]), + DEF_PATH(asLout2[0]), DEF_PATH(asLout2[1]), + DEF_PATH(asBias[0]), DEF_PATH(asBias[1]), + DEF_PATH(asBias[2]), DEF_PATH(asBias[3]) + }; + +#define N_PATH_TABLE (sizeof(table) / sizeof(struct path_table)) + + offset_hostin = offsetof(struct MCDRV_PATH_INFO, asVboxHostIn); + for (i = 0; i < N_PATH_TABLE; i++) { + UINT32 *ch = (UINT32 *)((void *)info + table[i].offset); + if (*ch == 0x00AAAAAA) + continue; + if (*ch == 0x002AAAAA) + continue; + if (table[i].offset == offset_hostin) + dbg_info("%s.dSrcOnOff= 0x%08lX\n", + table[i].name, + (*ch) & mask); + else + dbg_info("%s.dSrcOnOff\t= 0x%08lX\n", + table[i].name, + (*ch) & mask); + } +} + +#define DEF_VOL(v) {offsetof(struct MCDRV_VOL_INFO, v), #v} + +static void mc_asoc_dump_vol_info(const void *pvPrm, UINT32 dPrm) +{ + struct MCDRV_VOL_INFO *info = (struct MCDRV_VOL_INFO *)pvPrm; + int i; + + struct vol_table { + size_t offset; + char *name; + }; + + struct vol_table table[] = { + DEF_VOL(aswD_MusicIn[0]), DEF_VOL(aswD_MusicIn[1]), + DEF_VOL(aswD_ExtIn[0]), DEF_VOL(aswD_ExtIn[1]), + DEF_VOL(aswD_VoiceIn[0]), DEF_VOL(aswD_VoiceIn[1]), + DEF_VOL(aswD_RefIn[0]), DEF_VOL(aswD_RefIn[1]), + DEF_VOL(aswD_Adif0In[0]), DEF_VOL(aswD_Adif0In[1]), + DEF_VOL(aswD_Adif1In[0]), DEF_VOL(aswD_Adif1In[1]), + DEF_VOL(aswD_Adif2In[0]), DEF_VOL(aswD_Adif2In[1]), + DEF_VOL(aswD_MusicOut[0]), DEF_VOL(aswD_MusicOut[1]), + DEF_VOL(aswD_ExtOut[0]), DEF_VOL(aswD_ExtOut[1]), + DEF_VOL(aswD_VoiceOut[0]), DEF_VOL(aswD_VoiceOut[1]), + DEF_VOL(aswD_RefOut[0]), DEF_VOL(aswD_RefOut[1]), + DEF_VOL(aswD_Dac0Out[0]), DEF_VOL(aswD_Dac0Out[1]), + DEF_VOL(aswD_Dac1Out[0]), DEF_VOL(aswD_Dac1Out[1]), + DEF_VOL(aswD_DpathDa[0]), DEF_VOL(aswD_DpathDa[1]), + DEF_VOL(aswD_DpathAd[0]), DEF_VOL(aswD_DpathAd[1]), + DEF_VOL(aswA_LineIn1[0]), DEF_VOL(aswA_LineIn1[1]), + DEF_VOL(aswA_Mic1[0]), + DEF_VOL(aswA_Mic2[0]), + DEF_VOL(aswA_Mic3[0]), + DEF_VOL(aswA_Mic4[0]), + DEF_VOL(aswA_Hp[0]), DEF_VOL(aswA_Hp[1]), + DEF_VOL(aswA_Sp[0]), DEF_VOL(aswA_Sp[1]), + DEF_VOL(aswA_Rc[0]), + DEF_VOL(aswA_LineOut1[0]), DEF_VOL(aswA_LineOut1[1]), + DEF_VOL(aswA_LineOut2[0]), DEF_VOL(aswA_LineOut2[1]), + DEF_VOL(aswA_HpDet[0]) + }; + +#define N_VOL_TABLE (sizeof(table) / sizeof(struct vol_table)) + + for (i = 0; i < N_VOL_TABLE; i++) { + SINT16 vol = *(SINT16 *)((void *)info + table[i].offset); + if ((vol & 0x0001) && (vol > -24575)) + dbg_info("%s = 0x%04x\n", + table[i].name, + (vol & 0xfffe)); + } +} + +static void mc_asoc_dump_dio_info(const void *pvPrm, UINT32 dPrm) +{ + struct MCDRV_DIO_INFO *info = (struct MCDRV_DIO_INFO *)pvPrm; + struct MCDRV_DIO_PORT *port; + UINT32 update; + int i; + + for (i = 0; i < 4; i++) { + dbg_info("asPortInfo[%d]:\n", i); + port = &info->asPortInfo[i]; + update = dPrm >> (i*3); + if (update & MCDRV_MUSIC_COM_UPDATE_FLAG) { + dbg_info("sDioCommon.bMasterSlave = 0x%02x\n", + port->sDioCommon.bMasterSlave); + dbg_info(" bAutoFs = 0x%02x\n", + port->sDioCommon.bAutoFs); + dbg_info(" bFs = 0x%02x\n", + port->sDioCommon.bFs); + dbg_info(" bBckFs = 0x%02x\n", + port->sDioCommon.bBckFs); + dbg_info(" bInterface = 0x%02x\n", + port->sDioCommon.bInterface); + dbg_info(" bBckInvert = 0x%02x\n", + port->sDioCommon.bBckInvert); + dbg_info(" bSrcThru = 0x%02x\n", + port->sDioCommon.bSrcThru); + dbg_info(" bPcmHizTim = 0x%02x\n", + port->sDioCommon.bPcmHizTim); + dbg_info(" bPcmFrame = 0x%02x\n", + port->sDioCommon.bPcmFrame); + dbg_info(" bPcmHighPeriod = 0x%02x\n", + port->sDioCommon.bPcmHighPeriod); + } + if (update & MCDRV_MUSIC_DIR_UPDATE_FLAG) { + dbg_info(" sDir.sDaFormat.bBitSel = 0x%02x\n", + port->sDir.sDaFormat.bBitSel); + dbg_info(" bMode = 0x%02x\n", + port->sDir.sDaFormat.bMode); + dbg_info(" sPcmFormat.bMono = 0x%02x\n", + port->sDir.sPcmFormat.bMono); + dbg_info(" bOrder = 0x%02x\n", + port->sDir.sPcmFormat.bOrder); + dbg_info(" bLaw = 0x%02x\n", + port->sDir.sPcmFormat.bLaw); + dbg_info(" bBitSel = 0x%02x\n", + port->sDir.sPcmFormat.bBitSel); + } + if (update & MCDRV_MUSIC_DIT_UPDATE_FLAG) { + dbg_info(" sDit.bStMode = 0x%02x\n", + port->sDit.bStMode); + dbg_info(" bEdge = 0x%02x\n", + port->sDit.bEdge); + dbg_info(" sDaFormat.bBitSel = 0x%02x\n", + port->sDit.sDaFormat.bBitSel); + dbg_info(" bMode = 0x%02x\n", + port->sDit.sDaFormat.bMode); + dbg_info(" sPcmFormat.bMono = 0x%02x\n", + port->sDit.sPcmFormat.bMono); + dbg_info(" bOrder = 0x%02x\n", + port->sDit.sPcmFormat.bOrder); + dbg_info(" bLaw = 0x%02x\n", + port->sDit.sPcmFormat.bLaw); + dbg_info(" bBitSel = 0x%02x\n", + port->sDit.sPcmFormat.bBitSel); + } + } +} + +static void mc_asoc_dump_dio_path_info(const void *pvPrm, UINT32 dPrm) +{ + struct MCDRV_DIOPATH_INFO *info = (struct MCDRV_DIOPATH_INFO *)pvPrm; + + if (dPrm & MCDRV_PHYS0_UPDATE_FLAG) + dbg_info("abPhysPort[0] = 0x%02x\n", info->abPhysPort[0]); + if (dPrm & MCDRV_PHYS1_UPDATE_FLAG) + dbg_info("abPhysPort[1] = 0x%02x\n", info->abPhysPort[1]); + if (dPrm & MCDRV_PHYS2_UPDATE_FLAG) + dbg_info("abPhysPort[2] = 0x%02x\n", info->abPhysPort[2]); + if (dPrm & MCDRV_PHYS3_UPDATE_FLAG) + dbg_info("abPhysPort[3] = 0x%02x\n", info->abPhysPort[3]); + + if (dPrm & MCDRV_MUSICNUM_UPDATE_FLAG) + dbg_info("bMusicCh = 0x%02x\n", info->bMusicCh); + + if (dPrm & MCDRV_DIR0SLOT_UPDATE_FLAG) + dbg_info("abMusicRSlot[0] = 0x%02x\n", info->abMusicRSlot[0]); + if (dPrm & MCDRV_DIR1SLOT_UPDATE_FLAG) + dbg_info("abMusicRSlot[1] = 0x%02x\n", info->abMusicRSlot[1]); + if (dPrm & MCDRV_DIR2SLOT_UPDATE_FLAG) + dbg_info("abMusicRSlot[2] = 0x%02x\n", info->abMusicRSlot[2]); + + if (dPrm & MCDRV_DIT0SLOT_UPDATE_FLAG) + dbg_info("abMusicTSlot[0] = 0x%02x\n", info->abMusicTSlot[0]); + if (dPrm & MCDRV_DIT1SLOT_UPDATE_FLAG) + dbg_info("abMusicTSlot[1] = 0x%02x\n", info->abMusicTSlot[1]); + if (dPrm & MCDRV_DIT2SLOT_UPDATE_FLAG) + dbg_info("abMusicTSlot[2] = 0x%02x\n", info->abMusicTSlot[2]); +} + +static void mc_asoc_dump_swap_info(const void *pvPrm, UINT32 dPrm) +{ + struct MCDRV_SWAP_INFO *info = (struct MCDRV_SWAP_INFO *)pvPrm; + + if (dPrm & MCDRV_SWAP_ADIF0_UPDATE_FLAG) + dbg_info("bAdif0= 0x%02x\n", info->bAdif0); + if (dPrm & MCDRV_SWAP_ADIF1_UPDATE_FLAG) + dbg_info("bAdif1= 0x%02x\n", info->bAdif1); + if (dPrm & MCDRV_SWAP_ADIF2_UPDATE_FLAG) + dbg_info("bAdif2= 0x%02x\n", info->bAdif2); + if (dPrm & MCDRV_SWAP_DAC0_UPDATE_FLAG) + dbg_info("bDac0= 0x%02x\n", info->bDac0); + if (dPrm & MCDRV_SWAP_DAC1_UPDATE_FLAG) + dbg_info("bDac1= 0x%02x\n", info->bDac1); + if (dPrm & MCDRV_SWAP_MUSICIN0_UPDATE_FLAG) + dbg_info("bMusicIn0= 0x%02x\n", info->bMusicIn0); + if (dPrm & MCDRV_SWAP_MUSICIN1_UPDATE_FLAG) + dbg_info("bMusicIn1= 0x%02x\n", info->bMusicIn1); + if (dPrm & MCDRV_SWAP_MUSICIN2_UPDATE_FLAG) + dbg_info("bMusicIn2= 0x%02x\n", info->bMusicIn2); + if (dPrm & MCDRV_SWAP_EXTIN_UPDATE_FLAG) + dbg_info("bExtIn= 0x%02x\n", info->bExtIn); + if (dPrm & MCDRV_SWAP_VOICEIN_UPDATE_FLAG) + dbg_info("bVoiceIn= 0x%02x\n", info->bVoiceIn); + if (dPrm & MCDRV_SWAP_MUSICOUT0_UPDATE_FLAG) + dbg_info("bMusicOut0= 0x%02x\n", info->bMusicOut0); + if (dPrm & MCDRV_SWAP_MUSICOUT1_UPDATE_FLAG) + dbg_info("bMusicOut1= 0x%02x\n", info->bMusicOut1); + if (dPrm & MCDRV_SWAP_MUSICOUT2_UPDATE_FLAG) + dbg_info("bMusicOut2= 0x%02x\n", info->bMusicOut2); + if (dPrm & MCDRV_SWAP_EXTOUT_UPDATE_FLAG) + dbg_info("bExtOut= 0x%02x\n", info->bExtOut); + if (dPrm & MCDRV_SWAP_VOICEOUT_UPDATE_FLAG) + dbg_info("bVoiceOut= 0x%02x\n", info->bVoiceOut); +} + +static void mc_asoc_dump_hsdet_info(const void *pvPrm, UINT32 dPrm) +{ + struct MCDRV_HSDET_INFO *info = (struct MCDRV_HSDET_INFO *)pvPrm; + + if (dPrm & MCDRV_ENPLUGDET_UPDATE_FLAG) + dbg_info("bEnPlugDet = 0x%02x\n", info->bEnPlugDet); + if (dPrm & MCDRV_ENPLUGDETDB_UPDATE_FLAG) + dbg_info("bEnPlugDetDb = 0x%02x\n", info->bEnPlugDetDb); + if (dPrm & MCDRV_ENDLYKEYOFF_UPDATE_FLAG) + dbg_info("bEnDlyKeyOff = 0x%02x\n", info->bEnDlyKeyOff); + if (dPrm & MCDRV_ENDLYKEYON_UPDATE_FLAG) + dbg_info("bEnDlyKeyOn = 0x%02x\n", info->bEnDlyKeyOn); + if (dPrm & MCDRV_ENMICDET_UPDATE_FLAG) + dbg_info("bEnMicDet = 0x%02x\n", info->bEnMicDet); + if (dPrm & MCDRV_ENKEYOFF_UPDATE_FLAG) + dbg_info("bEnKeyOff = 0x%02x\n", info->bEnKeyOff); + if (dPrm & MCDRV_ENKEYON_UPDATE_FLAG) + dbg_info("bEnKeyOn = 0x%02x\n", info->bEnKeyOn); + if (dPrm & MCDRV_HSDETDBNC_UPDATE_FLAG) + dbg_info("bHsDetDbnc = 0x%02x\n", info->bHsDetDbnc); + if (dPrm & MCDRV_KEYOFFMTIM_UPDATE_FLAG) + dbg_info("bKeyOffMtim = 0x%02x\n", info->bKeyOffMtim); + if (dPrm & MCDRV_KEYONMTIM_UPDATE_FLAG) + dbg_info("bKeyOnMtim = 0x%02x\n", info->bKeyOnMtim); + if (dPrm & MCDRV_KEY0OFFDLYTIM_UPDATE_FLAG) + dbg_info("bKey0OffDlyTim = 0x%02x\n", info->bKey0OffDlyTim); + if (dPrm & MCDRV_KEY1OFFDLYTIM_UPDATE_FLAG) + dbg_info("bKey1OffDlyTim = 0x%02x\n", info->bKey1OffDlyTim); + if (dPrm & MCDRV_KEY2OFFDLYTIM_UPDATE_FLAG) + dbg_info("bKey2OffDlyTim = 0x%02x\n", info->bKey2OffDlyTim); + if (dPrm & MCDRV_KEY0ONDLYTIM_UPDATE_FLAG) + dbg_info("bKey0OnDlyTim = 0x%02x\n", info->bKey0OnDlyTim); + if (dPrm & MCDRV_KEY1ONDLYTIM_UPDATE_FLAG) + dbg_info("bKey1OnDlyTim = 0x%02x\n", info->bKey1OnDlyTim); + if (dPrm & MCDRV_KEY2ONDLYTIM_UPDATE_FLAG) + dbg_info("bKey2OnDlyTim = 0x%02x\n", info->bKey2OnDlyTim); + if (dPrm & MCDRV_KEY0ONDLYTIM2_UPDATE_FLAG) + dbg_info("bKey0OnDlyTim2 = 0x%02x\n", info->bKey0OnDlyTim2); + if (dPrm & MCDRV_KEY1ONDLYTIM2_UPDATE_FLAG) + dbg_info("bKey1OnDlyTim2 = 0x%02x\n", info->bKey1OnDlyTim2); + if (dPrm & MCDRV_KEY2ONDLYTIM2_UPDATE_FLAG) + dbg_info("bKey2OnDlyTim2 = 0x%02x\n", info->bKey2OnDlyTim2); + if (dPrm & MCDRV_IRQTYPE_UPDATE_FLAG) + dbg_info("bIrqType = 0x%02x\n", info->bIrqType); + if (dPrm & MCDRV_DETINV_UPDATE_FLAG) + dbg_info("bDetInInv = 0x%02x\n", info->bDetInInv); + if (dPrm & MCDRV_HSDETMODE_UPDATE_FLAG) + dbg_info("bHsDetMode = 0x%02x\n", info->bHsDetMode); + if (dPrm & MCDRV_SPERIOD_UPDATE_FLAG) + dbg_info("bSperiod = 0x%02x\n", info->bSperiod); + if (dPrm & MCDRV_LPERIOD_UPDATE_FLAG) + dbg_info("bLperiod = 0x%02x\n", info->bLperiod); + if (dPrm & MCDRV_DBNCNUMPLUG_UPDATE_FLAG) + dbg_info("bDbncNumPlug = 0x%02x\n", info->bDbncNumPlug); + if (dPrm & MCDRV_DBNCNUMMIC_UPDATE_FLAG) + dbg_info("bDbncNumMic = 0x%02x\n", info->bDbncNumMic); + if (dPrm & MCDRV_DBNCNUMKEY_UPDATE_FLAG) + dbg_info("bDbncNumKey = 0x%02x\n", info->bDbncNumKey); + if (dPrm & MCDRV_SGNL_UPDATE_FLAG) { + dbg_info("bSgnlPeriod = 0x%02x\n", info->bSgnlPeriod); + dbg_info("bSgnlNum = 0x%02x\n", info->bSgnlNum); + dbg_info("bSgnlPeak = 0x%02x\n", info->bSgnlPeak); + } + if (dPrm & MCDRV_IMPSEL_UPDATE_FLAG) + dbg_info("bImpSel = 0x%02x\n", info->bImpSel); + + if (dPrm & MCDRV_DLYIRQSTOP_UPDATE_FLAG) + dbg_info("bDlyIrqStop = 0x%02x\n", info->bDlyIrqStop); + + if (dPrm & MCDRV_CBFUNC_UPDATE_FLAG) + dbg_info("cbfunc = %8p\n", info->cbfunc); +} + +struct mc_asoc_dump_func { + char *name; + void (*func)(const void *, UINT32); +}; + +struct mc_asoc_dump_func mc_asoc_dump_func_map[] = { + {"MCDRV_INIT", mc_asoc_dump_init_info}, + {"MCDRV_TERM", NULL}, + {"MCDRV_READ_REG", mc_asoc_dump_reg_info}, + {"MCDRV_WRITE_REG", mc_asoc_dump_reg_info}, + {"MCDRV_GET_CLOCKSW", NULL}, + {"MCDRV_SET_CLOCKSW", NULL}, + {"MCDRV_GET_PATH", NULL}, + {"MCDRV_SET_PATH", mc_asoc_dump_path_info}, + {"MCDRV_GET_VOLUME", NULL}, + {"MCDRV_SET_VOLUME", mc_asoc_dump_vol_info}, + {"MCDRV_GET_DIGITALIO", NULL}, + {"MCDRV_SET_DIGITALIO", mc_asoc_dump_dio_info}, + {"MCDRV_GET_DIGITALIO_PATH", NULL}, + {"MCDRV_SET_DIGITALIO_PATH", mc_asoc_dump_dio_path_info}, + {"MCDRV_GET_SWAP", NULL}, + {"MCDRV_SET_SWAP", mc_asoc_dump_swap_info}, + {"MCDRV_SET_DSP", NULL}, + {"MCDRV_GET_DSP", NULL}, + {"MCDRV_GET_DSP_DATA", NULL}, + {"MCDRV_SET_DSP_DATA", NULL}, + {"MCDRV_REGISTER_DSP_CB", NULL}, + {"MCDRV_GET_DSP_TRANSITION", NULL}, + {"MCDRV_IRQ", NULL}, + {"MCDRV_GET_HSDET", NULL}, + {"MCDRV_SET_HSDET", mc_asoc_dump_hsdet_info}, + {"MCDRV_CONFIG_GP", NULL}, + {"MCDRV_MASK_GP", NULL}, + {"MCDRV_GETSET_GP", NULL}, +}; + +SINT32 McDrv_Ctrl_dbg(UINT32 dCmd, void *pvPrm1, void *pvPrm2, UINT32 dPrm) +{ + SINT32 err; + + dbg_info("calling %s:\n", mc_asoc_dump_func_map[dCmd].name); + + if (mc_asoc_dump_func_map[dCmd].func) + mc_asoc_dump_func_map[dCmd].func(pvPrm1, dPrm); + + err = McDrv_Ctrl(dCmd, pvPrm1, pvPrm2, dPrm); + dbg_info("err(%s) = %d\n", mc_asoc_dump_func_map[dCmd].name, (int)err); + + if (dCmd == MCDRV_SET_VOLUME) { + /* + McDrv_Ctrl(MCDRV_GET_VOLUME, pvPrm1, NULL, 0); + mc_asoc_dump_vol_info(pvPrm1, 0xFF); + */ + } + if (dCmd == MCDRV_GET_PATH) + /*mc_asoc_dump_path_info(pvPrm1, 0xFFFFFF)*/; + + if (dCmd == MCDRV_SET_PATH) { + /* + McDrv_Ctrl(MCDRV_GET_PATH, pvPrm1, NULL, 0); + mc_asoc_dump_path_info(pvPrm1, 0x00555555); + */ + } + + return err; +} + +#endif /* CONFIG_SND_SOC_YAMAHA_YMU831_DEBUG */ diff --git a/sound/soc/codecs/ymu831/ymu831_dbg_sec.c b/sound/soc/codecs/ymu831/ymu831_dbg_sec.c new file mode 100644 index 00000000000..c69ec78bf1f --- /dev/null +++ b/sound/soc/codecs/ymu831/ymu831_dbg_sec.c @@ -0,0 +1,520 @@ +/* + * YMU831 ASoC codec driver + * + * Copyright (c) 2012 Yamaha Corporation + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + */ + +#ifndef CONFIG_SAMSUNG_PRODUCT_SHIP + +#include "mcdriver.h" +#include "ymu831_priv.h" + + +#define YMU831_SEC_DEBUG_LEVEL 1 + + +static void mc_asoc_dump_init_info_sec(const void *pvPrm, UINT32 dPrm) +{ + struct MCDRV_INIT_INFO *info = (struct MCDRV_INIT_INFO *)pvPrm; + UINT8 i; + char str[128], *p; + + dbg_info("%13s= 0x%02x\n", "bCkSel", info->bCkSel); + dbg_info("%13s= 0x%02x\n", "bCkInput", info->bCkInput); + dbg_info("%13s= 0x%02x\n", "bPllModeA", info->bPllModeA); + dbg_info("%13s= 0x%02x\n", "bPllPrevDivA", info->bPllPrevDivA); + dbg_info("%13s= 0x%04x\n", "wPllFbDivA", info->wPllFbDivA); + dbg_info("%13s= 0x%04x\n", "wPllFracA", info->wPllFracA); + dbg_info("%13s= 0x%02x\n", "bPllFreqA", info->bPllFreqA); + dbg_info("%13s= 0x%02x\n", "bPllModeB", info->bPllModeB); + dbg_info("%13s= 0x%02x\n", "bPllPrevDivB", info->bPllPrevDivB); + dbg_info("%13s= 0x%04x\n", "wPllFbDivB", info->wPllFbDivB); + dbg_info("%13s= 0x%04x\n", "wPllFracB", info->wPllFracB); + dbg_info("%13s= 0x%02x\n", "bPllFreqB", info->bPllFreqB); + dbg_info("%13s= 0x%02x\n", "bHsdetClk", info->bHsdetClk); + dbg_info("%13s= 0x%02x\n", "bDio1SdoHiz", info->bDio1SdoHiz); + dbg_info("%13s= 0x%02x\n", "bDio2SdoHiz", info->bDio2SdoHiz); + dbg_info("%13s= 0x%02x\n", "bDio0ClkHiz", info->bDio0ClkHiz); + dbg_info("%13s= 0x%02x\n", "bDio1ClkHiz", info->bDio1ClkHiz); + dbg_info("%13s= 0x%02x\n", "bDio2ClkHiz", info->bDio2ClkHiz); + dbg_info("%13s= 0x%02x\n", "bDio0PcmHiz", info->bDio0PcmHiz); + dbg_info("%13s= 0x%02x\n", "bDio1PcmHiz", info->bDio1PcmHiz); + dbg_info("%13s= 0x%02x\n", "bDio2PcmHiz", info->bDio2PcmHiz); + dbg_info("%13s= 0x%02x\n", "bPa0Func", info->bPa0Func); + dbg_info("%13s= 0x%02x\n", "bPa1Func", info->bPa1Func); + dbg_info("%13s= 0x%02x\n", "bPa2Func", info->bPa2Func); + dbg_info("%13s= 0x%02x\n", "bPowerMode", info->bPowerMode); + dbg_info("%13s= 0x%02x\n", "bMbSel1", info->bMbSel1); + dbg_info("%13s= 0x%02x\n", "bMbSel2", info->bMbSel2); + dbg_info("%13s= 0x%02x\n", "bMbSel3", info->bMbSel3); + dbg_info("%13s= 0x%02x\n", "bMbSel4", info->bMbSel4); + dbg_info("%13s= 0x%02x\n", "bMbsDisch", info->bMbsDisch); + dbg_info("%13s= 0x%02x\n", "bNonClip", info->bNonClip); + dbg_info("%13s= 0x%02x\n", "bLineIn1Dif", info->bLineIn1Dif); + dbg_info("%13s= 0x%02x\n", "bLineOut1Dif", info->bLineOut1Dif); + dbg_info("%13s= 0x%02x\n", "bLineOut2Dif", info->bLineOut2Dif); + dbg_info("%13s= 0x%02x\n", "bMic1Sng", info->bMic1Sng); + dbg_info("%13s= 0x%02x\n", "bMic2Sng", info->bMic2Sng); + dbg_info("%13s= 0x%02x\n", "bMic3Sng", info->bMic3Sng); + dbg_info("%13s= 0x%02x\n", "bMic4Sng", info->bMic4Sng); + dbg_info("%13s= 0x%02x\n", "bZcLineOut1", info->bZcLineOut1); + dbg_info("%13s= 0x%02x\n", "bZcLineOut2", info->bZcLineOut2); + dbg_info("%13s= 0x%02x\n", "bZcRc", info->bZcRc); + dbg_info("%13s= 0x%02x\n", "bZcSp", info->bZcSp); + dbg_info("%13s= 0x%02x\n", "bZcHp", info->bZcHp); + dbg_info("%13s= 0x%02x\n", "bSvolLineOut1", info->bSvolLineOut1); + dbg_info("%13s= 0x%02x\n", "bSvolLineOut2", info->bSvolLineOut2); + dbg_info("%13s= 0x%02x\n", "bSvolRc", info->bSvolRc); + dbg_info("%13s= 0x%02x\n", "bSvolSp", info->bSvolSp); + dbg_info("%13s= 0x%02x\n", "bSvolHp", info->bSvolHp); + dbg_info("%13s= 0x%02x\n", "bRcHiz", info->bRcHiz); + dbg_info("%13s= 0x%02x\n", "bSpHiz", info->bSpHiz); + dbg_info("%13s= 0x%02x\n", "bHpHiz", info->bHpHiz); + dbg_info("%13s= 0x%02x\n", "bLineOut1Hiz", info->bLineOut1Hiz); + dbg_info("%13s= 0x%02x\n", "bLineOut2Hiz", info->bLineOut2Hiz); + dbg_info("%13s= 0x%02x\n", "bCpMod", info->bCpMod); + dbg_info("%13s= 0x%02x\n", "bRbSel", info->bRbSel); + dbg_info("%13s= 0x%02x\n", "bPlugSel", info->bPlugSel); + dbg_info("%13s= 0x%02x\n", "bGndDet", info->bGndDet); + + dbg_info("sWaitTime.dWaitTime="); + p = str; + for (i = 0; i < 20; i++) { + if (i == 10) { + dbg_info("%s\n", str); + p = str; + } + p += sprintf(p, " %lu", info->sWaitTime.dWaitTime[i]); + } + dbg_info("%s\n", str); + + dbg_info("sWaitTime.dPollInterval="); + p = str; + for (i = 0; i < 20; i++) { + if (i == 10) { + dbg_info("%s\n", str); + p = str; + } + p += sprintf(p, " %lu", info->sWaitTime.dPollInterval[i]); + } + dbg_info("%s\n", str); + + dbg_info("sWaitTime.dPollTimeOut="); + p = str; + for (i = 0; i < 20; i++) { + if (i == 10) { + dbg_info("%s\n", str); + p = str; + } + p += sprintf(p, " %lu", info->sWaitTime.dPollTimeOut[i]); + } + dbg_info("%s\n", str); +} + +static void mc_asoc_dump_reg_info_sec(const void *pvPrm, UINT32 dPrm) +{ + struct MCDRV_REG_INFO *info = (struct MCDRV_REG_INFO *)pvPrm; + + dbg_info("bRegType = 0x%02x\n", info->bRegType); + dbg_info("bAddress = 0x%02x\n", info->bAddress); + dbg_info("bData = 0x%02x\n", info->bData); +} + +#define DEF_PATH(p) {offsetof(struct MCDRV_PATH_INFO, p), #p} + +static void mc_asoc_dump_path_info_sec(const void *pvPrm, UINT32 dPrm) +{ + struct MCDRV_PATH_INFO *info = (struct MCDRV_PATH_INFO *)pvPrm; + int i; + UINT32 mask = (dPrm == 0) ? 0xFFFFFF : dPrm; + size_t offset_hostin; + + struct path_table { + size_t offset; + char *name; + }; + + struct path_table table[] = { + DEF_PATH(asMusicOut[0]), DEF_PATH(asMusicOut[1]), + DEF_PATH(asExtOut[0]), DEF_PATH(asExtOut[1]), + DEF_PATH(asHifiOut[0]), + DEF_PATH(asVboxMixIn[0]), DEF_PATH(asVboxMixIn[1]), + DEF_PATH(asVboxMixIn[2]), DEF_PATH(asVboxMixIn[3]), + DEF_PATH(asAe0[0]), DEF_PATH(asAe0[1]), + DEF_PATH(asAe1[0]), DEF_PATH(asAe1[1]), + DEF_PATH(asAe2[0]), DEF_PATH(asAe2[1]), + DEF_PATH(asAe3[0]), DEF_PATH(asAe3[1]), + DEF_PATH(asDac0[0]), DEF_PATH(asDac0[1]), + DEF_PATH(asDac1[0]), DEF_PATH(asDac1[1]), + DEF_PATH(asVoiceOut[0]), + DEF_PATH(asVboxIoIn[0]), + DEF_PATH(asVboxHostIn[0]), + DEF_PATH(asHostOut[0]), + DEF_PATH(asAdif0[0]), DEF_PATH(asAdif0[1]), + DEF_PATH(asAdif1[0]), DEF_PATH(asAdif1[1]), + DEF_PATH(asAdif2[0]), DEF_PATH(asAdif2[1]), + DEF_PATH(asAdc0[0]), DEF_PATH(asAdc0[1]), + DEF_PATH(asAdc1[0]), + DEF_PATH(asSp[0]), DEF_PATH(asSp[1]), + DEF_PATH(asHp[0]), DEF_PATH(asHp[1]), + DEF_PATH(asRc[0]), + DEF_PATH(asLout1[0]), DEF_PATH(asLout1[1]), + DEF_PATH(asLout2[0]), DEF_PATH(asLout2[1]), + DEF_PATH(asBias[0]), DEF_PATH(asBias[1]), + DEF_PATH(asBias[2]), DEF_PATH(asBias[3]) + }; + +#define N_PATH_TABLE (sizeof(table) / sizeof(struct path_table)) + + offset_hostin = offsetof(struct MCDRV_PATH_INFO, asVboxHostIn); + for (i = 0; i < N_PATH_TABLE; i++) { + UINT32 *ch = (UINT32 *)((void *)info + table[i].offset); + if (*ch == 0x00AAAAAA) + continue; + if (*ch == 0x002AAAAA) + continue; + if (table[i].offset == offset_hostin) + dbg_info("%s.dSrcOnOff= 0x%08lX\n", + table[i].name, + (*ch) & mask); + else + dbg_info("%s.dSrcOnOff\t= 0x%08lX\n", + table[i].name, + (*ch) & mask); + } +} + +#define DEF_VOL(v) {offsetof(struct MCDRV_VOL_INFO, v), #v} + +static void mc_asoc_dump_vol_info_sec(const void *pvPrm, UINT32 dPrm) +{ + struct MCDRV_VOL_INFO *info = (struct MCDRV_VOL_INFO *)pvPrm; + int i; + + struct vol_table { + size_t offset; + char *name; + }; + + struct vol_table table[] = { + DEF_VOL(aswD_MusicIn[0]), DEF_VOL(aswD_MusicIn[1]), + DEF_VOL(aswD_ExtIn[0]), DEF_VOL(aswD_ExtIn[1]), + DEF_VOL(aswD_VoiceIn[0]), DEF_VOL(aswD_VoiceIn[1]), + DEF_VOL(aswD_RefIn[0]), DEF_VOL(aswD_RefIn[1]), + DEF_VOL(aswD_Adif0In[0]), DEF_VOL(aswD_Adif0In[1]), + DEF_VOL(aswD_Adif1In[0]), DEF_VOL(aswD_Adif1In[1]), + DEF_VOL(aswD_Adif2In[0]), DEF_VOL(aswD_Adif2In[1]), + DEF_VOL(aswD_MusicOut[0]), DEF_VOL(aswD_MusicOut[1]), + DEF_VOL(aswD_ExtOut[0]), DEF_VOL(aswD_ExtOut[1]), + DEF_VOL(aswD_VoiceOut[0]), DEF_VOL(aswD_VoiceOut[1]), + DEF_VOL(aswD_RefOut[0]), DEF_VOL(aswD_RefOut[1]), + DEF_VOL(aswD_Dac0Out[0]), DEF_VOL(aswD_Dac0Out[1]), + DEF_VOL(aswD_Dac1Out[0]), DEF_VOL(aswD_Dac1Out[1]), + DEF_VOL(aswD_DpathDa[0]), DEF_VOL(aswD_DpathDa[1]), + DEF_VOL(aswD_DpathAd[0]), DEF_VOL(aswD_DpathAd[1]), + DEF_VOL(aswA_LineIn1[0]), DEF_VOL(aswA_LineIn1[1]), + DEF_VOL(aswA_Mic1[0]), + DEF_VOL(aswA_Mic2[0]), + DEF_VOL(aswA_Mic3[0]), + DEF_VOL(aswA_Mic4[0]), + DEF_VOL(aswA_Hp[0]), DEF_VOL(aswA_Hp[1]), + DEF_VOL(aswA_Sp[0]), DEF_VOL(aswA_Sp[1]), + DEF_VOL(aswA_Rc[0]), + DEF_VOL(aswA_LineOut1[0]), DEF_VOL(aswA_LineOut1[1]), + DEF_VOL(aswA_LineOut2[0]), DEF_VOL(aswA_LineOut2[1]), + DEF_VOL(aswA_HpDet[0]) + }; + +#define N_VOL_TABLE (sizeof(table) / sizeof(struct vol_table)) + + for (i = 0; i < N_VOL_TABLE; i++) { + SINT16 vol = *(SINT16 *)((void *)info + table[i].offset); + if ((vol & 0x0001) && (vol > -24575)) + dbg_info("%s = 0x%04x\n", + table[i].name, + (vol & 0xfffe)); + } +} + +static void mc_asoc_dump_dio_info_sec(const void *pvPrm, UINT32 dPrm) +{ + struct MCDRV_DIO_INFO *info = (struct MCDRV_DIO_INFO *)pvPrm; + struct MCDRV_DIO_PORT *port; + UINT32 update; + int i; + + for (i = 0; i < 4; i++) { + dbg_info("asPortInfo[%d]:\n", i); + port = &info->asPortInfo[i]; + update = dPrm >> (i*3); + if (update & MCDRV_MUSIC_COM_UPDATE_FLAG) { + dbg_info("sDioCommon.bMasterSlave = 0x%02x\n", + port->sDioCommon.bMasterSlave); + dbg_info(" bAutoFs = 0x%02x\n", + port->sDioCommon.bAutoFs); + dbg_info(" bFs = 0x%02x\n", + port->sDioCommon.bFs); + dbg_info(" bBckFs = 0x%02x\n", + port->sDioCommon.bBckFs); + dbg_info(" bInterface = 0x%02x\n", + port->sDioCommon.bInterface); + dbg_info(" bBckInvert = 0x%02x\n", + port->sDioCommon.bBckInvert); + dbg_info(" bSrcThru = 0x%02x\n", + port->sDioCommon.bSrcThru); + dbg_info(" bPcmHizTim = 0x%02x\n", + port->sDioCommon.bPcmHizTim); + dbg_info(" bPcmFrame = 0x%02x\n", + port->sDioCommon.bPcmFrame); + dbg_info(" bPcmHighPeriod = 0x%02x\n", + port->sDioCommon.bPcmHighPeriod); + } + if (update & MCDRV_MUSIC_DIR_UPDATE_FLAG) { + dbg_info(" sDir.sDaFormat.bBitSel = 0x%02x\n", + port->sDir.sDaFormat.bBitSel); + dbg_info(" bMode = 0x%02x\n", + port->sDir.sDaFormat.bMode); + dbg_info(" sPcmFormat.bMono = 0x%02x\n", + port->sDir.sPcmFormat.bMono); + dbg_info(" bOrder = 0x%02x\n", + port->sDir.sPcmFormat.bOrder); + dbg_info(" bLaw = 0x%02x\n", + port->sDir.sPcmFormat.bLaw); + dbg_info(" bBitSel = 0x%02x\n", + port->sDir.sPcmFormat.bBitSel); + } + if (update & MCDRV_MUSIC_DIT_UPDATE_FLAG) { + dbg_info(" sDit.bStMode = 0x%02x\n", + port->sDit.bStMode); + dbg_info(" bEdge = 0x%02x\n", + port->sDit.bEdge); + dbg_info(" sDaFormat.bBitSel = 0x%02x\n", + port->sDit.sDaFormat.bBitSel); + dbg_info(" bMode = 0x%02x\n", + port->sDit.sDaFormat.bMode); + dbg_info(" sPcmFormat.bMono = 0x%02x\n", + port->sDit.sPcmFormat.bMono); + dbg_info(" bOrder = 0x%02x\n", + port->sDit.sPcmFormat.bOrder); + dbg_info(" bLaw = 0x%02x\n", + port->sDit.sPcmFormat.bLaw); + dbg_info(" bBitSel = 0x%02x\n", + port->sDit.sPcmFormat.bBitSel); + } + } +} + +static void mc_asoc_dump_dio_path_info_sec(const void *pvPrm, UINT32 dPrm) +{ + struct MCDRV_DIOPATH_INFO *info = (struct MCDRV_DIOPATH_INFO *)pvPrm; + + if (dPrm & MCDRV_PHYS0_UPDATE_FLAG) + dbg_info("abPhysPort[0] = 0x%02x\n", info->abPhysPort[0]); + if (dPrm & MCDRV_PHYS1_UPDATE_FLAG) + dbg_info("abPhysPort[1] = 0x%02x\n", info->abPhysPort[1]); + if (dPrm & MCDRV_PHYS2_UPDATE_FLAG) + dbg_info("abPhysPort[2] = 0x%02x\n", info->abPhysPort[2]); + if (dPrm & MCDRV_PHYS3_UPDATE_FLAG) + dbg_info("abPhysPort[3] = 0x%02x\n", info->abPhysPort[3]); + + if (dPrm & MCDRV_MUSICNUM_UPDATE_FLAG) + dbg_info("bMusicCh = 0x%02x\n", info->bMusicCh); + + if (dPrm & MCDRV_DIR0SLOT_UPDATE_FLAG) + dbg_info("abMusicRSlot[0] = 0x%02x\n", info->abMusicRSlot[0]); + if (dPrm & MCDRV_DIR1SLOT_UPDATE_FLAG) + dbg_info("abMusicRSlot[1] = 0x%02x\n", info->abMusicRSlot[1]); + if (dPrm & MCDRV_DIR2SLOT_UPDATE_FLAG) + dbg_info("abMusicRSlot[2] = 0x%02x\n", info->abMusicRSlot[2]); + + if (dPrm & MCDRV_DIT0SLOT_UPDATE_FLAG) + dbg_info("abMusicTSlot[0] = 0x%02x\n", info->abMusicTSlot[0]); + if (dPrm & MCDRV_DIT1SLOT_UPDATE_FLAG) + dbg_info("abMusicTSlot[1] = 0x%02x\n", info->abMusicTSlot[1]); + if (dPrm & MCDRV_DIT2SLOT_UPDATE_FLAG) + dbg_info("abMusicTSlot[2] = 0x%02x\n", info->abMusicTSlot[2]); +} + +static void mc_asoc_dump_swap_info_sec(const void *pvPrm, UINT32 dPrm) +{ + struct MCDRV_SWAP_INFO *info = (struct MCDRV_SWAP_INFO *)pvPrm; + + if (dPrm & MCDRV_SWAP_ADIF0_UPDATE_FLAG) + dbg_info("bAdif0= 0x%02x\n", info->bAdif0); + if (dPrm & MCDRV_SWAP_ADIF1_UPDATE_FLAG) + dbg_info("bAdif1= 0x%02x\n", info->bAdif1); + if (dPrm & MCDRV_SWAP_ADIF2_UPDATE_FLAG) + dbg_info("bAdif2= 0x%02x\n", info->bAdif2); + if (dPrm & MCDRV_SWAP_DAC0_UPDATE_FLAG) + dbg_info("bDac0= 0x%02x\n", info->bDac0); + if (dPrm & MCDRV_SWAP_DAC1_UPDATE_FLAG) + dbg_info("bDac1= 0x%02x\n", info->bDac1); + if (dPrm & MCDRV_SWAP_MUSICIN0_UPDATE_FLAG) + dbg_info("bMusicIn0= 0x%02x\n", info->bMusicIn0); + if (dPrm & MCDRV_SWAP_MUSICIN1_UPDATE_FLAG) + dbg_info("bMusicIn1= 0x%02x\n", info->bMusicIn1); + if (dPrm & MCDRV_SWAP_MUSICIN2_UPDATE_FLAG) + dbg_info("bMusicIn2= 0x%02x\n", info->bMusicIn2); + if (dPrm & MCDRV_SWAP_EXTIN_UPDATE_FLAG) + dbg_info("bExtIn= 0x%02x\n", info->bExtIn); + if (dPrm & MCDRV_SWAP_VOICEIN_UPDATE_FLAG) + dbg_info("bVoiceIn= 0x%02x\n", info->bVoiceIn); + if (dPrm & MCDRV_SWAP_MUSICOUT0_UPDATE_FLAG) + dbg_info("bMusicOut0= 0x%02x\n", info->bMusicOut0); + if (dPrm & MCDRV_SWAP_MUSICOUT1_UPDATE_FLAG) + dbg_info("bMusicOut1= 0x%02x\n", info->bMusicOut1); + if (dPrm & MCDRV_SWAP_MUSICOUT2_UPDATE_FLAG) + dbg_info("bMusicOut2= 0x%02x\n", info->bMusicOut2); + if (dPrm & MCDRV_SWAP_EXTOUT_UPDATE_FLAG) + dbg_info("bExtOut= 0x%02x\n", info->bExtOut); + if (dPrm & MCDRV_SWAP_VOICEOUT_UPDATE_FLAG) + dbg_info("bVoiceOut= 0x%02x\n", info->bVoiceOut); +} + +static void mc_asoc_dump_hsdet_info_sec(const void *pvPrm, UINT32 dPrm) +{ + struct MCDRV_HSDET_INFO *info = (struct MCDRV_HSDET_INFO *)pvPrm; + + if (dPrm & MCDRV_ENPLUGDET_UPDATE_FLAG) + dbg_info("bEnPlugDet = 0x%02x\n", info->bEnPlugDet); + if (dPrm & MCDRV_ENPLUGDETDB_UPDATE_FLAG) + dbg_info("bEnPlugDetDb = 0x%02x\n", info->bEnPlugDetDb); + if (dPrm & MCDRV_ENDLYKEYOFF_UPDATE_FLAG) + dbg_info("bEnDlyKeyOff = 0x%02x\n", info->bEnDlyKeyOff); + if (dPrm & MCDRV_ENDLYKEYON_UPDATE_FLAG) + dbg_info("bEnDlyKeyOn = 0x%02x\n", info->bEnDlyKeyOn); + if (dPrm & MCDRV_ENMICDET_UPDATE_FLAG) + dbg_info("bEnMicDet = 0x%02x\n", info->bEnMicDet); + if (dPrm & MCDRV_ENKEYOFF_UPDATE_FLAG) + dbg_info("bEnKeyOff = 0x%02x\n", info->bEnKeyOff); + if (dPrm & MCDRV_ENKEYON_UPDATE_FLAG) + dbg_info("bEnKeyOn = 0x%02x\n", info->bEnKeyOn); + if (dPrm & MCDRV_HSDETDBNC_UPDATE_FLAG) + dbg_info("bHsDetDbnc = 0x%02x\n", info->bHsDetDbnc); + if (dPrm & MCDRV_KEYOFFMTIM_UPDATE_FLAG) + dbg_info("bKeyOffMtim = 0x%02x\n", info->bKeyOffMtim); + if (dPrm & MCDRV_KEYONMTIM_UPDATE_FLAG) + dbg_info("bKeyOnMtim = 0x%02x\n", info->bKeyOnMtim); + if (dPrm & MCDRV_KEY0OFFDLYTIM_UPDATE_FLAG) + dbg_info("bKey0OffDlyTim = 0x%02x\n", info->bKey0OffDlyTim); + if (dPrm & MCDRV_KEY1OFFDLYTIM_UPDATE_FLAG) + dbg_info("bKey1OffDlyTim = 0x%02x\n", info->bKey1OffDlyTim); + if (dPrm & MCDRV_KEY2OFFDLYTIM_UPDATE_FLAG) + dbg_info("bKey2OffDlyTim = 0x%02x\n", info->bKey2OffDlyTim); + if (dPrm & MCDRV_KEY0ONDLYTIM_UPDATE_FLAG) + dbg_info("bKey0OnDlyTim = 0x%02x\n", info->bKey0OnDlyTim); + if (dPrm & MCDRV_KEY1ONDLYTIM_UPDATE_FLAG) + dbg_info("bKey1OnDlyTim = 0x%02x\n", info->bKey1OnDlyTim); + if (dPrm & MCDRV_KEY2ONDLYTIM_UPDATE_FLAG) + dbg_info("bKey2OnDlyTim = 0x%02x\n", info->bKey2OnDlyTim); + if (dPrm & MCDRV_KEY0ONDLYTIM2_UPDATE_FLAG) + dbg_info("bKey0OnDlyTim2 = 0x%02x\n", info->bKey0OnDlyTim2); + if (dPrm & MCDRV_KEY1ONDLYTIM2_UPDATE_FLAG) + dbg_info("bKey1OnDlyTim2 = 0x%02x\n", info->bKey1OnDlyTim2); + if (dPrm & MCDRV_KEY2ONDLYTIM2_UPDATE_FLAG) + dbg_info("bKey2OnDlyTim2 = 0x%02x\n", info->bKey2OnDlyTim2); + if (dPrm & MCDRV_IRQTYPE_UPDATE_FLAG) + dbg_info("bIrqType = 0x%02x\n", info->bIrqType); + if (dPrm & MCDRV_DETINV_UPDATE_FLAG) + dbg_info("bDetInInv = 0x%02x\n", info->bDetInInv); + if (dPrm & MCDRV_HSDETMODE_UPDATE_FLAG) + dbg_info("bHsDetMode = 0x%02x\n", info->bHsDetMode); + if (dPrm & MCDRV_SPERIOD_UPDATE_FLAG) + dbg_info("bSperiod = 0x%02x\n", info->bSperiod); + if (dPrm & MCDRV_LPERIOD_UPDATE_FLAG) + dbg_info("bLperiod = 0x%02x\n", info->bLperiod); + if (dPrm & MCDRV_DBNCNUMPLUG_UPDATE_FLAG) + dbg_info("bDbncNumPlug = 0x%02x\n", info->bDbncNumPlug); + if (dPrm & MCDRV_DBNCNUMMIC_UPDATE_FLAG) + dbg_info("bDbncNumMic = 0x%02x\n", info->bDbncNumMic); + if (dPrm & MCDRV_DBNCNUMKEY_UPDATE_FLAG) + dbg_info("bDbncNumKey = 0x%02x\n", info->bDbncNumKey); + if (dPrm & MCDRV_SGNL_UPDATE_FLAG) { + dbg_info("bSgnlPeriod = 0x%02x\n", info->bSgnlPeriod); + dbg_info("bSgnlNum = 0x%02x\n", info->bSgnlNum); + dbg_info("bSgnlPeak = 0x%02x\n", info->bSgnlPeak); + } + if (dPrm & MCDRV_IMPSEL_UPDATE_FLAG) + dbg_info("bImpSel = 0x%02x\n", info->bImpSel); + + if (dPrm & MCDRV_DLYIRQSTOP_UPDATE_FLAG) + dbg_info("bDlyIrqStop = 0x%02x\n", info->bDlyIrqStop); + + if (dPrm & MCDRV_CBFUNC_UPDATE_FLAG) + dbg_info("cbfunc = %8p\n", info->cbfunc); +} + +struct mc_asoc_dump_func { + bool level; + char *name; + void (*func)(const void *, UINT32); +}; + +struct mc_asoc_dump_func mc_asoc_dump_func_map_sec[] = { + {1, "MCDRV_INIT", mc_asoc_dump_init_info_sec}, + {0, "MCDRV_TERM", NULL}, + {1, "MCDRV_READ_REG", mc_asoc_dump_reg_info_sec}, + {1, "MCDRV_WRITE_REG", mc_asoc_dump_reg_info_sec}, + {0, "MCDRV_GET_CLOCKSW", NULL}, + {0, "MCDRV_SET_CLOCKSW", NULL}, + {0, "MCDRV_GET_PATH", NULL}, + {3, "MCDRV_SET_PATH", mc_asoc_dump_path_info_sec}, + {0, "MCDRV_GET_VOLUME", NULL}, + {3, "MCDRV_SET_VOLUME", mc_asoc_dump_vol_info_sec}, + {0, "MCDRV_GET_DIGITALIO", NULL}, + {2, "MCDRV_SET_DIGITALIO", mc_asoc_dump_dio_info_sec}, + {0, "MCDRV_GET_DIGITALIO_PATH", NULL}, + {2, "MCDRV_SET_DIGITALIO_PATH", mc_asoc_dump_dio_path_info_sec}, + {0, "MCDRV_GET_SWAP", NULL}, + {1, "MCDRV_SET_SWAP", mc_asoc_dump_swap_info_sec}, + {0, "MCDRV_SET_DSP", NULL}, + {0, "MCDRV_GET_DSP", NULL}, + {0, "MCDRV_GET_DSP_DATA", NULL}, + {0, "MCDRV_SET_DSP_DATA", NULL}, + {0, "MCDRV_REGISTER_DSP_CB", NULL}, + {0, "MCDRV_GET_DSP_TRANSITION", NULL}, + {0, "MCDRV_IRQ", NULL}, + {0, "MCDRV_GET_HSDET", NULL}, + {3, "MCDRV_SET_HSDET", mc_asoc_dump_hsdet_info_sec}, + {0, "MCDRV_CONFIG_GP", NULL}, + {0, "MCDRV_MASK_GP", NULL}, + {0, "MCDRV_GETSET_GP", NULL}, +}; + +SINT32 McDrv_Ctrl_dbg_sec(UINT32 dCmd, void *pvPrm1, void *pvPrm2, UINT32 dPrm) +{ + int err; + + if (mc_asoc_dump_func_map_sec[dCmd].level >= YMU831_SEC_DEBUG_LEVEL) { + + dbg_info("%s\n", mc_asoc_dump_func_map_sec[dCmd].name); + + if (mc_asoc_dump_func_map_sec[dCmd].func) + mc_asoc_dump_func_map_sec[dCmd].func(pvPrm1, dPrm); + } + + err = (int) McDrv_Ctrl(dCmd, pvPrm1, pvPrm2, dPrm); + if (err) + dbg_info("%s (err=%d)\n", + mc_asoc_dump_func_map_sec[dCmd].name, err); + + return err; +} + +#endif diff --git a/sound/soc/codecs/ymu831/ymu831_path_cfg.h b/sound/soc/codecs/ymu831/ymu831_path_cfg.h new file mode 100644 index 00000000000..a2265d6d6fa --- /dev/null +++ b/sound/soc/codecs/ymu831/ymu831_path_cfg.h @@ -0,0 +1,4173 @@ +/* + * YMU831 ASoC codec driver + * + * Copyright (c) 2012-2013 Yamaha Corporation + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + */ + +#ifndef YMU831_PATH_CFG_H +#define YMU831_PATH_CFG_H + +#include "mcdriver.h" + +#define PRESET_PATH_N (93) +/* ======================================== + Preset Path settings + ========================================*/ +static const struct MCDRV_PATH_INFO stPresetPathInfo[PRESET_PATH_N] = { + /* playback:off, capture:off */ + { + {{0x00AAAAAA}, {0x00AAAAAA} } , /* asMusicOut */ + {{0x00AAAAAA}, {0x00AAAAAA} }, /* asExtOut */ + {{0x00AAAAAA} } , /* asHifiOut */ + {{0x00AAAAAA}, {0x00AAAAAA}, + {0x00AAAAAA}, {0x00AAAAAA} }, /* asVboxMixIn */ + {{0x00AAAAAA}, {0x00AAAAAA} }, /* asAe0 */ + {{0x00AAAAAA}, {0x00AAAAAA} }, /* asAe1 */ + {{0x00AAAAAA}, {0x00AAAAAA} }, /* asAe2 */ + {{0x00AAAAAA}, {0x00AAAAAA} }, /* asAe3 */ + {{0x00AAAAAA}, {0x00AAAAAA} }, /* asDac0 */ + {{0x00AAAAAA}, {0x00AAAAAA} }, /* asDac1 */ + {{0x00AAAAAA} }, /* asVoiceOut */ + {{0x00AAAAAA} }, /* asVboxIoIn */ + {{0x00AAAAAA} }, /* asVboxHostIn */ + {{0x00AAAAAA} }, /* asHostOut */ + {{0x00AAAAAA}, {0x00AAAAAA} }, /* asAdif0 */ + {{0x00AAAAAA}, {0x00AAAAAA} }, /* asAdif1 */ + {{0x00AAAAAA}, {0x00AAAAAA} }, /* asAdif2 */ + {{0x002AAAAA}, {0x002AAAAA} }, /* asAdc0 */ + {{0x002AAAAA} }, /* asAdc1 */ + {{0x002AAAAA}, {0x002AAAAA} }, /* asSp */ + {{0x002AAAAA}, {0x002AAAAA} }, /* asHp */ + {{0x002AAAAA} }, /* asRc */ + {{0x002AAAAA}, {0x002AAAAA} }, /* asLout1 */ + {{0x002AAAAA}, {0x002AAAAA} }, /* asLout2 */ + {{0x002AAAAA}, {0x002AAAAA}, + {0x002AAAAA}, {0x002AAAAA} } /* asBias */ + }, + /* playback:audio, capture:off (analog output) */ + { + {{0x00000000}, {0x00000000} }, /* asMusicOut */ + {{0x00000000}, {0x00000000} }, /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} }, /* asVboxMixIn */ + {{MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_MUSICIN_ON} }, /* asAe0 */ + {{0x00000000}, {0x00000000} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{MCDRV_D1SRC_AE0_ON}, + {MCDRV_D1SRC_AE0_ON} }, /* asDac0 */ + {{MCDRV_D1SRC_AE0_ON}, + {MCDRV_D1SRC_AE0_ON} }, /* asDac1 */ + {{0x00000000} }, /* asVoiceOut */ + {{0x00000000} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{0x00000000} }, /* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{0x00000000}, {0x00000000} }, /* asAdif1 */ + {{0x00000000}, {0x00000000} }, /* asAdif2 */ + {{0x00000000}, {0x00000000} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {0x00000000} }, /* asSp */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asHp */ + {{MCDRV_ASRC_DAC0_L_ON} }, /* asRc */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asLout1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {MCDRV_ASRC_DAC1_R_ON} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:audio, capture:off (BT output) */ + { + {{0x00000000}, {0x00000000} }, /* asMusicOut */ + {{MCDRV_D1SRC_AE0_ON}, + {MCDRV_D1SRC_AE0_ON} }, /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} }, /* asVboxMixIn */ + {{MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_MUSICIN_ON} }, /* asAe0 */ + {{0x00000000}, {0x00000000} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{0x00000000}, {0x00000000} }, /* asDac0 */ + {{0x00000000}, {0x00000000} }, /* asDac1 */ + {{0x00000000} }, /* asVoiceOut */ + {{0x00000000} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{0x00000000} }, /* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{0x00000000}, {0x00000000} }, /* asAdif1 */ + {{0x00000000}, {0x00000000} }, /* asAdif2 */ + {{0x00000000}, {0x00000000} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{0x00000000}, {0x00000000} }, /* asSp */ + {{0x00000000}, {0x00000000} }, /* asHp */ + {{0x00000000} }, /* asRc */ + {{0x00000000}, {0x00000000} }, /* asLout1 */ + {{0x00000000}, {0x00000000} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:audio, capture:off (analog+BT output) */ + { + {{0x00000000}, {0x00000000} }, /* asMusicOut */ + {{MCDRV_D1SRC_AE0_ON}, + {MCDRV_D1SRC_AE0_ON} }, /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} }, /* asVboxMixIn */ + {{MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_MUSICIN_ON} }, /* asAe0 */ + {{0x00000000}, {0x00000000} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{MCDRV_D1SRC_AE0_ON}, + {MCDRV_D1SRC_AE0_ON} }, /* asDac0 */ + {{MCDRV_D1SRC_AE0_ON}, + {MCDRV_D1SRC_AE0_ON} }, /* asDac1 */ + {{0x00000000} }, /* asVoiceOut */ + {{0x00000000} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{0x00000000} }, /* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{0x00000000}, {0x00000000} }, /* asAdif1 */ + {{0x00000000}, {0x00000000} }, /* asAdif2 */ + {{0x00000000}, {0x00000000} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {0x00000000} }, /* asSp */ + {{0x00000000}, {0x00000000} }, /* asHp */ + {{0x00000000} }, /* asRc */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asLout1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {MCDRV_ASRC_DAC1_R_ON} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:off, capture:audio (analog input) */ + { + {{MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_AE1_ON} }, /* asMusicOut */ + {{0x00000000}, {0x00000000} }, /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_AE1_ON}, + {0x00000000}, {0x00000000} }, /* asVboxMixIn */ + {{0x00000000}, {0x00000000} }, /* asAe0 */ + {{MCDRV_D1SRC_ADIF1_ON}, + {MCDRV_D1SRC_ADIF1_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{0x00000000}, {0x00000000} }, /* asDac0 */ + {{0x00000000}, {0x00000000} }, /* asDac1 */ + {{0x00000000} }, /* asVoiceOut */ + {{0x00000000} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{MCDRV_D2SRC_ADC0_L_ON}, + {MCDRV_D2SRC_ADC0_R_ON} }, /* asAdif1 */ + {{0x00000000}, {0x00000000} }, /* asAdif2 */ + {{MCDRV_ASRC_MIC1_ON + |MCDRV_ASRC_MIC2_ON + |MCDRV_ASRC_MIC3_ON + |MCDRV_ASRC_MIC4_ON + |MCDRV_ASRC_LINEIN1_L_ON}, + {MCDRV_ASRC_MIC1_ON + |MCDRV_ASRC_MIC2_ON + |MCDRV_ASRC_MIC3_ON + |MCDRV_ASRC_MIC4_ON + |MCDRV_ASRC_LINEIN1_R_ON} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{0x00000000}, {0x00000000} }, /* asSp */ + {{0x00000000}, {0x00000000} }, /* asHp */ + {{0x00000000} }, /* asRc */ + {{0x00000000}, {0x00000000} }, /* asLout1 */ + {{0x00000000}, {0x00000000} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:off, capture:audio (BT input) */ + { + {{MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_AE1_ON} }, /* asMusicOut */ + {{0x00000000}, {0x00000000} }, /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_AE1_ON}, + {0x00000000}, {0x00000000} }, /* asVboxMixIn */ + {{0x00000000}, {0x00000000} }, /* asAe0 */ + {{MCDRV_D1SRC_EXTIN_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{0x00000000}, {0x00000000} }, /* asDac0 */ + {{0x00000000}, {0x00000000} }, /* asDac1 */ + {{0x00000000} }, /* asVoiceOut */ + {{0x00000000} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{0x00000000}, {0x00000000} }, /* asAdif1 */ + {{0x00000000}, {0x00000000} }, /* asAdif2 */ + {{0x00000000}, {0x00000000} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{0x00000000}, {0x00000000} }, /* asSp */ + {{0x00000000}, {0x00000000} }, /* asHp */ + {{0x00000000} }, /* asRc */ + {{0x00000000}, {0x00000000} }, /* asLout1 */ + {{0x00000000}, {0x00000000} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:audio, capture:audio (analog input, analog output) */ + { + {{MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_AE1_ON} }, /* asMusicOut */ + {{0x00000000}, {0x00000000} }, /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_AE1_ON}, + {0x00000000}, {0x00000000} }, /* asVboxMixIn */ + {{MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_MUSICIN_ON} }, /* asAe0 */ + {{MCDRV_D1SRC_ADIF1_ON}, + {MCDRV_D1SRC_ADIF1_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{MCDRV_D1SRC_AE0_ON}, + {MCDRV_D1SRC_AE0_ON} }, /* asDac0 */ + {{MCDRV_D1SRC_AE0_ON}, + {MCDRV_D1SRC_AE0_ON} }, /* asDac1 */ + {{0x00000000} }, /* asVoiceOut */ + {{0x00000000} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{MCDRV_D2SRC_ADC0_L_ON}, + {MCDRV_D2SRC_ADC0_R_ON} }, /* asAdif1 */ + {{0x00000000}, {0x00000000} }, /* asAdif2 */ + {{MCDRV_ASRC_MIC1_ON + |MCDRV_ASRC_MIC2_ON + |MCDRV_ASRC_MIC3_ON + |MCDRV_ASRC_MIC4_ON + |MCDRV_ASRC_LINEIN1_L_ON}, + {MCDRV_ASRC_MIC1_ON + |MCDRV_ASRC_MIC2_ON + |MCDRV_ASRC_MIC3_ON + |MCDRV_ASRC_MIC4_ON + |MCDRV_ASRC_LINEIN1_R_ON} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {0x00000000} }, /* asSp */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asHp */ + {{MCDRV_ASRC_DAC0_L_ON} }, /* asRc */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asLout1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {MCDRV_ASRC_DAC1_R_ON} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:audio, capture:audio (BT input, analog output) */ + { + {{MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_AE1_ON} }, /* asMusicOut */ + {{0x00000000}, {0x00000000} }, /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_AE1_ON}, + {0x00000000}, {0x00000000} }, /* asVboxMixIn */ + {{MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_MUSICIN_ON} }, /* asAe0 */ + {{MCDRV_D1SRC_EXTIN_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{MCDRV_D1SRC_AE0_ON}, + {MCDRV_D1SRC_AE0_ON} }, /* asDac0 */ + {{MCDRV_D1SRC_AE0_ON}, + {MCDRV_D1SRC_AE0_ON} }, /* asDac1 */ + {{0x00000000} }, /* asVoiceOut */ + {{0x00000000} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{0x00000000}, {0x00000000} }, /* asAdif1 */ + {{0x00000000}, {0x00000000} }, /* asAdif2 */ + {{0x00000000}, {0x00000000} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {0x00000000} }, /* asSp */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asHp */ + {{MCDRV_ASRC_DAC0_L_ON} }, /* asRc */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asLout1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {MCDRV_ASRC_DAC1_R_ON} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:audio, capture:audio (analog input, BT output) */ + { + {{MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_AE1_ON} }, /* asMusicOut */ + {{MCDRV_D1SRC_AE0_ON}, + {MCDRV_D1SRC_AE0_ON} }, /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_AE1_ON}, + {0x00000000}, {0x00000000} }, /* asVboxMixIn */ + {{MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_MUSICIN_ON} }, /* asAe0 */ + {{MCDRV_D1SRC_ADIF1_ON}, + {MCDRV_D1SRC_ADIF1_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{0x00000000}, {0x00000000} }, /* asDac0 */ + {{0x00000000}, {0x00000000} }, /* asDac1 */ + {{0x00000000} }, /* asVoiceOut */ + {{0x00000000} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{MCDRV_D2SRC_ADC0_L_ON}, + {MCDRV_D2SRC_ADC0_R_ON} }, /* asAdif1 */ + {{0x00000000}, {0x00000000} }, /* asAdif2 */ + {{MCDRV_ASRC_MIC1_ON + |MCDRV_ASRC_MIC2_ON + |MCDRV_ASRC_MIC3_ON + |MCDRV_ASRC_MIC4_ON + |MCDRV_ASRC_LINEIN1_L_ON}, + {MCDRV_ASRC_MIC1_ON + |MCDRV_ASRC_MIC2_ON + |MCDRV_ASRC_MIC3_ON + |MCDRV_ASRC_MIC4_ON + |MCDRV_ASRC_LINEIN1_R_ON} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{0x00000000}, {0x00000000} }, /* asSp */ + {{0x00000000}, {0x00000000} }, /* asHp */ + {{0x00000000} }, /* asRc */ + {{0x00000000}, {0x00000000} }, /* asLout1 */ + {{0x00000000}, {0x00000000} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:audio, capture:audio (BT input, BT output) */ + { + {{MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_AE1_ON} }, /* asMusicOut */ + {{MCDRV_D1SRC_AE0_ON}, + {MCDRV_D1SRC_AE0_ON} }, /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_AE1_ON}, + {0x00000000}, {0x00000000} }, /* asVboxMixIn */ + {{MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_MUSICIN_ON} }, /* asAe0 */ + {{MCDRV_D1SRC_EXTIN_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{0x00000000}, {0x00000000} }, /* asDac0 */ + {{0x00000000}, {0x00000000} }, /* asDac1 */ + {{0x00000000} }, /* asVoiceOut */ + {{0x00000000} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{0x00000000}, {0x00000000} }, /* asAdif1 */ + {{0x00000000}, {0x00000000} }, /* asAdif2 */ + {{0x00000000}, {0x00000000} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{0x00000000}, {0x00000000} }, /* asSp */ + {{0x00000000}, {0x00000000} }, /* asHp */ + {{0x00000000} }, /* asRc */ + {{0x00000000}, {0x00000000} }, /* asLout1 */ + {{0x00000000}, {0x00000000} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:audio, capture:audio (analog input, analog+BT output) */ + { + {{MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_AE1_ON} }, /* asMusicOut */ + {{MCDRV_D1SRC_AE0_ON}, + {MCDRV_D1SRC_AE0_ON} }, /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_AE1_ON}, + {0x00000000}, {0x00000000} }, /* asVboxMixIn */ + {{MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_MUSICIN_ON} }, /* asAe0 */ + {{MCDRV_D1SRC_ADIF1_ON}, + {MCDRV_D1SRC_ADIF1_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{MCDRV_D1SRC_AE0_ON}, + {MCDRV_D1SRC_AE0_ON} }, /* asDac0 */ + {{MCDRV_D1SRC_AE0_ON}, + {MCDRV_D1SRC_AE0_ON} }, /* asDac1 */ + {{0x00000000} }, /* asVoiceOut */ + {{0x00000000} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{MCDRV_D2SRC_ADC0_L_ON}, + {MCDRV_D2SRC_ADC0_R_ON} }, /* asAdif1 */ + {{0x00000000}, {0x00000000} }, /* asAdif2 */ + {{MCDRV_ASRC_MIC1_ON + |MCDRV_ASRC_MIC2_ON + |MCDRV_ASRC_MIC3_ON + |MCDRV_ASRC_MIC4_ON + |MCDRV_ASRC_LINEIN1_L_ON}, + {MCDRV_ASRC_MIC1_ON + |MCDRV_ASRC_MIC2_ON + |MCDRV_ASRC_MIC3_ON + |MCDRV_ASRC_MIC4_ON + |MCDRV_ASRC_LINEIN1_R_ON} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {0x00000000} }, /* asSp */ + {{0x00000000}, {0x00000000} }, /* asHp */ + {{0x00000000} }, /* asRc */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asLout1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {MCDRV_ASRC_DAC1_R_ON} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:audio, capture:audio (BT input, analog+BT output) */ + { + {{MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_AE1_ON} }, /* asMusicOut */ + {{MCDRV_D1SRC_AE0_ON}, + {MCDRV_D1SRC_AE0_ON} }, /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_AE1_ON}, + {0x00000000}, {0x00000000} }, /* asVboxMixIn */ + {{MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_MUSICIN_ON} }, /* asAe0 */ + {{MCDRV_D1SRC_EXTIN_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{MCDRV_D1SRC_AE0_ON}, + {MCDRV_D1SRC_AE0_ON} }, /* asDac0 */ + {{MCDRV_D1SRC_AE0_ON}, + {MCDRV_D1SRC_AE0_ON} }, /* asDac1 */ + {{0x00000000} }, /* asVoiceOut */ + {{0x00000000} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{0x00000000}, {0x00000000} }, /* asAdif1 */ + {{0x00000000}, {0x00000000} }, /* asAdif2 */ + {{0x00000000}, {0x00000000} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {0x00000000} }, /* asSp */ + {{0x00000000}, {0x00000000} }, /* asHp */ + {{0x00000000} }, /* asRc */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asLout1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {MCDRV_ASRC_DAC1_R_ON} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:incall, capture:incall (analog input, analog output) */ + { + {{0x00000000}, {0x00000000} }, /* asMusicOut */ + {{MCDRV_D1SRC_VBOXREFOUT_ON}, + {MCDRV_D1SRC_VBOXREFOUT_ON} }, /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_ADIF2_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asVboxMixIn */ + {{0x00000000}, {0x00000000} }, /* asAe0 */ + {{MCDRV_D1SRC_ADIF1_ON}, + {MCDRV_D1SRC_ADIF1_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{MCDRV_D1SRC_VBOXOUT_ON}, + {MCDRV_D1SRC_VBOXOUT_ON} }, /* asDac0 */ + {{MCDRV_D1SRC_VBOXOUT_ON}, + {MCDRV_D1SRC_VBOXOUT_ON} }, /* asDac1 */ + {{0x00000000} }, /* asVoiceOut */ + {{0x00000000} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{MCDRV_D2SRC_ADC0_L_ON}, + {MCDRV_D2SRC_ADC0_R_ON} }, /* asAdif1 */ + {{MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON}, + {MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON} }, + /* asAdif2 */ + {{MCDRV_ASRC_MIC1_ON + |MCDRV_ASRC_MIC2_ON + |MCDRV_ASRC_MIC3_ON + |MCDRV_ASRC_MIC4_ON}, + {MCDRV_ASRC_MIC1_ON + |MCDRV_ASRC_MIC2_ON + |MCDRV_ASRC_MIC3_ON + |MCDRV_ASRC_MIC4_ON} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {0x00000000} }, /* asSp */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asHp */ + {{MCDRV_ASRC_DAC0_L_ON} }, /* asRc */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asLout1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {MCDRV_ASRC_DAC1_R_ON} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:incall, capture:incall (BT input, BT output) */ + { + {{0x00000000}, {0x00000000} }, /* asMusicOut */ + {{MCDRV_D1SRC_VBOXOUT_ON}, + {MCDRV_D1SRC_VBOXOUT_ON} }, /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {0x00000000}, + {MCDRV_D1SRC_VBOXOUT_ON}, + {0x00000000} }, /* asVboxMixIn */ + {{0x00000000}, {0x00000000} }, /* asAe0 */ + {{MCDRV_D1SRC_EXTIN_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{0x00000000}, {0x00000000} }, /* asDac0 */ + {{0x00000000}, {0x00000000} }, /* asDac1 */ + {{MCDRV_D2SRC_VBOXIOOUT_ON} }, /* asVoiceOut */ + {{MCDRV_D2SRC_VOICEIN_ON} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{0x00000000}, {0x00000000} }, /* asAdif1 */ + {{0x00000000}, {0x00000000} }, /* asAdif2 */ + {{0x00000000}, {0x00000000} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{0x00000000}, {0x00000000} }, /* asSp */ + {{0x00000000}, {0x00000000} }, /* asHp */ + {{0x00000000} }, /* asRc */ + {{0x00000000}, {0x00000000} }, /* asLout1 */ + {{0x00000000}, {0x00000000} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:incall, capture:incall (BT input, analog+BT output) */ + { + {{0x00000000}, {0x00000000} }, /* asMusicOut */ + {{MCDRV_D1SRC_VBOXOUT_ON}, + {MCDRV_D1SRC_VBOXOUT_ON} }, /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {0x00000000}, + {MCDRV_D1SRC_ADIF2_ON}, + {0x00000000} }, /* asVboxMixIn */ + {{0x00000000}, {0x00000000} }, /* asAe0 */ + {{MCDRV_D1SRC_EXTIN_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{MCDRV_D1SRC_VBOXOUT_ON}, + {MCDRV_D1SRC_VBOXOUT_ON} }, /* asDac0 */ + {{MCDRV_D1SRC_VBOXOUT_ON}, + {MCDRV_D1SRC_VBOXOUT_ON} }, /* asDac1 */ + {{MCDRV_D2SRC_VBOXIOOUT_ON} }, /* asVoiceOut */ + {{MCDRV_D2SRC_VOICEIN_ON} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{0x00000000}, {0x00000000} }, /* asAdif1 */ + {{MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON}, + {MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON} }, + /* asAdif2 */ + {{0x00000000}, {0x00000000} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {0x00000000} }, /* asSp */ + {{0x00000000}, {0x00000000} }, /* asHp */ + {{0x00000000} }, /* asRc */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asLout1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {MCDRV_ASRC_DAC1_R_ON} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:audio+incall, capture:incall (analog input analog output) */ + { + {{0x00000000}, {0x00000000} }, /* asMusicOut */ + {{MCDRV_D1SRC_VBOXREFOUT_ON}, + {MCDRV_D1SRC_VBOXREFOUT_ON} }, /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_ADIF2_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asVboxMixIn */ + {{0x00000000}, {0x00000000} }, /* asAe0 */ + {{MCDRV_D1SRC_ADIF1_ON}, + {MCDRV_D1SRC_ADIF1_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{MCDRV_D1SRC_VBOXOUT_ON|MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_VBOXOUT_ON|MCDRV_D1SRC_MUSICIN_ON} }, + /* asDac0 */ + {{MCDRV_D1SRC_VBOXOUT_ON|MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_VBOXOUT_ON|MCDRV_D1SRC_MUSICIN_ON} }, + /* asDac1 */ + {{0x00000000} }, /* asVoiceOut */ + {{0x00000000} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{MCDRV_D2SRC_ADC0_L_ON}, + {MCDRV_D2SRC_ADC0_R_ON} }, /* asAdif1 */ + {{MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON}, + {MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON} }, + /* asAdif2 */ + {{MCDRV_ASRC_MIC1_ON + |MCDRV_ASRC_MIC2_ON + |MCDRV_ASRC_MIC3_ON + |MCDRV_ASRC_MIC4_ON}, + {MCDRV_ASRC_MIC1_ON + |MCDRV_ASRC_MIC2_ON + |MCDRV_ASRC_MIC3_ON + |MCDRV_ASRC_MIC4_ON} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {0x00000000} }, /* asSp */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asHp */ + {{MCDRV_ASRC_DAC0_L_ON} }, /* asRc */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asLout1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {MCDRV_ASRC_DAC1_R_ON} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:audio+incall, capture:incall (BT input BT output) */ + { + {{0x00000000}, {0x00000000} }, /* asMusicOut */ + {{MCDRV_D1SRC_VBOXOUT_ON|MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_VBOXOUT_ON|MCDRV_D1SRC_MUSICIN_ON} }, + /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {0x00000000}, + {MCDRV_D1SRC_VBOXOUT_ON}, + {0x00000000} }, /* asVboxMixIn */ + {{0x00000000}, {0x00000000} }, /* asAe0 */ + {{MCDRV_D1SRC_EXTIN_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{0x00000000}, {0x00000000} }, /* asDac0 */ + {{0x00000000}, {0x00000000} }, /* asDac1 */ + {{MCDRV_D2SRC_VBOXIOOUT_ON} }, /* asVoiceOut */ + {{MCDRV_D2SRC_VOICEIN_ON} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{0x00000000}, {0x00000000} }, /* asAdif1 */ + {{0x00000000}, {0x00000000} }, /* asAdif2 */ + {{0x00000000}, {0x00000000} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{0x00000000}, {0x00000000} }, /* asSp */ + {{0x00000000}, {0x00000000} }, /* asHp */ + {{0x00000000} }, /* asRc */ + {{0x00000000}, {0x00000000} }, /* asLout1 */ + {{0x00000000}, {0x00000000} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:audio+incall, capture:incall (BT input analog+BT output) */ + { + {{0x00000000}, {0x00000000} }, /* asMusicOut */ + {{MCDRV_D1SRC_VBOXOUT_ON|MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_VBOXOUT_ON|MCDRV_D1SRC_MUSICIN_ON} }, + /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {0x00000000}, + {MCDRV_D1SRC_ADIF2_ON}, + {0x00000000} }, /* asVboxMixIn */ + {{0x00000000}, {0x00000000} }, /* asAe0 */ + {{MCDRV_D1SRC_EXTIN_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{MCDRV_D1SRC_VBOXOUT_ON|MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_VBOXOUT_ON|MCDRV_D1SRC_MUSICIN_ON} }, + /* asDac0 */ + {{MCDRV_D1SRC_VBOXOUT_ON|MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_VBOXOUT_ON|MCDRV_D1SRC_MUSICIN_ON} }, + /* asDac1 */ + {{MCDRV_D2SRC_VBOXIOOUT_ON} }, /* asVoiceOut */ + {{MCDRV_D2SRC_VOICEIN_ON} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{0x00000000}, {0x00000000} }, /* asAdif1 */ + {{MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON}, + {MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON} }, + /* asAdif2 */ + {{0x00000000}, {0x00000000} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {0x00000000} }, /* asSp */ + {{0x00000000}, {0x00000000} }, /* asHp */ + {{0x00000000} }, /* asRc */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asLout1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {MCDRV_ASRC_DAC1_R_ON} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:incall, capture:audio+incall + (analog input, analog output) */ + { + {{MCDRV_D1SRC_VBOXREFOUT_ON}, + {MCDRV_D1SRC_VBOXREFOUT_ON} }, /* asMusicOut */ + {{MCDRV_D1SRC_VBOXREFOUT_ON}, + {MCDRV_D1SRC_VBOXREFOUT_ON} }, /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_ADIF2_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asVboxMixIn */ + {{0x00000000}, {0x00000000} }, /* asAe0 */ + {{MCDRV_D1SRC_ADIF1_ON}, + {MCDRV_D1SRC_ADIF1_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{MCDRV_D1SRC_VBOXOUT_ON}, + {MCDRV_D1SRC_VBOXOUT_ON} }, /* asDac0 */ + {{MCDRV_D1SRC_VBOXOUT_ON}, + {MCDRV_D1SRC_VBOXOUT_ON} }, /* asDac1 */ + {{0x00000000} }, /* asVoiceOut */ + {{0x00000000} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{MCDRV_D2SRC_ADC0_L_ON}, + {MCDRV_D2SRC_ADC0_R_ON} }, /* asAdif1 */ + {{MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON}, + {MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON} }, + /* asAdif2 */ + {{MCDRV_ASRC_MIC1_ON + |MCDRV_ASRC_MIC2_ON + |MCDRV_ASRC_MIC3_ON + |MCDRV_ASRC_MIC4_ON}, + {MCDRV_ASRC_MIC1_ON + |MCDRV_ASRC_MIC2_ON + |MCDRV_ASRC_MIC3_ON + |MCDRV_ASRC_MIC4_ON} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {0x00000000} }, /* asSp */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asHp */ + {{MCDRV_ASRC_DAC0_L_ON} }, /* asRc */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asLout1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {MCDRV_ASRC_DAC1_R_ON} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:incall, capture:audio+incall (BT input, BT output) */ + { + {{MCDRV_D1SRC_VBOXREFOUT_ON}, + {MCDRV_D1SRC_VBOXREFOUT_ON} }, /* asMusicOut */ + {{MCDRV_D1SRC_VBOXOUT_ON|MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_VBOXOUT_ON|MCDRV_D1SRC_MUSICIN_ON} }, + /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {0x00000000}, + {MCDRV_D1SRC_VBOXOUT_ON}, + {0x00000000} }, /* asVboxMixIn */ + {{0x00000000}, {0x00000000} }, /* asAe0 */ + {{MCDRV_D1SRC_EXTIN_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{0x00000000}, {0x00000000} }, /* asDac0 */ + {{0x00000000}, {0x00000000} }, /* asDac1 */ + {{MCDRV_D2SRC_VBOXIOOUT_ON} }, /* asVoiceOut */ + {{MCDRV_D2SRC_VOICEIN_ON} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{0x00000000}, {0x00000000} }, /* asAdif1 */ + {{0x00000000}, {0x00000000} }, /* asAdif2 */ + {{0x00000000}, {0x00000000} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{0x00000000}, {0x00000000} }, /* asSp */ + {{0x00000000}, {0x00000000} }, /* asHp */ + {{0x00000000} }, /* asRc */ + {{0x00000000}, {0x00000000} }, /* asLout1 */ + {{0x00000000}, {0x00000000} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:incall, capture:audio+incall (BT input, analog+BT output) */ + { + {{MCDRV_D1SRC_VBOXREFOUT_ON}, + {MCDRV_D1SRC_VBOXREFOUT_ON} }, /* asMusicOut */ + {{MCDRV_D1SRC_VBOXOUT_ON|MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_VBOXOUT_ON|MCDRV_D1SRC_MUSICIN_ON} }, + /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {0x00000000}, + {MCDRV_D1SRC_ADIF2_ON}, + {0x00000000} }, /* asVboxMixIn */ + {{0x00000000}, {0x00000000} }, /* asAe0 */ + {{MCDRV_D1SRC_EXTIN_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{MCDRV_D1SRC_VBOXOUT_ON}, + {MCDRV_D1SRC_VBOXOUT_ON} }, /* asDac0 */ + {{MCDRV_D1SRC_VBOXOUT_ON}, + {MCDRV_D1SRC_VBOXOUT_ON} }, /* asDac1 */ + {{MCDRV_D2SRC_VBOXIOOUT_ON} }, /* asVoiceOut */ + {{MCDRV_D2SRC_VOICEIN_ON} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{0x00000000}, {0x00000000} }, /* asAdif1 */ + {{MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON}, + {MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON} }, + /* asAdif2 */ + {{0x00000000}, {0x00000000} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {0x00000000} }, /* asSp */ + {{0x00000000}, {0x00000000} }, /* asHp */ + {{0x00000000} }, /* asRc */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asLout1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {MCDRV_ASRC_DAC1_R_ON} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:audio+incall, capture:audio+incall + (analog input, analog output) */ + { + {{MCDRV_D1SRC_VBOXREFOUT_ON}, + {MCDRV_D1SRC_VBOXREFOUT_ON} }, /* asMusicOut */ + {{MCDRV_D1SRC_VBOXREFOUT_ON}, + {MCDRV_D1SRC_VBOXREFOUT_ON} }, /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_ADIF2_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asVboxMixIn */ + {{0x00000000}, {0x00000000} }, /* asAe0 */ + {{MCDRV_D1SRC_ADIF1_ON}, + {MCDRV_D1SRC_ADIF1_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{MCDRV_D1SRC_VBOXOUT_ON|MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_VBOXOUT_ON|MCDRV_D1SRC_MUSICIN_ON} }, + /* asDac0 */ + {{MCDRV_D1SRC_VBOXOUT_ON|MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_VBOXOUT_ON|MCDRV_D1SRC_MUSICIN_ON} }, + /* asDac1 */ + {{0x00000000} }, /* asVoiceOut */ + {{0x00000000} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{MCDRV_D2SRC_ADC0_L_ON}, + {MCDRV_D2SRC_ADC0_R_ON} }, /* asAdif1 */ + {{MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON}, + {MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON} }, + /* asAdif2 */ + {{MCDRV_ASRC_MIC1_ON + |MCDRV_ASRC_MIC2_ON + |MCDRV_ASRC_MIC3_ON + |MCDRV_ASRC_MIC4_ON}, + {MCDRV_ASRC_MIC1_ON + |MCDRV_ASRC_MIC2_ON + |MCDRV_ASRC_MIC3_ON + |MCDRV_ASRC_MIC4_ON} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {0x00000000} }, /* asSp */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asHp */ + {{MCDRV_ASRC_DAC0_L_ON} }, /* asRc */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asLout1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {MCDRV_ASRC_DAC1_R_ON} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:audio+incall, capture:audio+incall (BT input, BT output) */ + { + {{MCDRV_D1SRC_VBOXREFOUT_ON}, + {MCDRV_D1SRC_VBOXREFOUT_ON} }, /* asMusicOut */ + {{MCDRV_D1SRC_VBOXOUT_ON|MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_VBOXOUT_ON|MCDRV_D1SRC_MUSICIN_ON} }, + /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {0x00000000}, + {MCDRV_D1SRC_VBOXOUT_ON}, + {0x00000000} }, /* asVboxMixIn */ + {{0x00000000}, {0x00000000} }, /* asAe0 */ + {{MCDRV_D1SRC_EXTIN_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{0x00000000}, {0x00000000} }, /* asDac0 */ + {{0x00000000}, {0x00000000} }, /* asDac1 */ + {{MCDRV_D2SRC_VBOXIOOUT_ON} }, /* asVoiceOut */ + {{MCDRV_D2SRC_VOICEIN_ON} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{0x00000000}, {0x00000000} }, /* asAdif1 */ + {{0x00000000}, {0x00000000} }, /* asAdif2 */ + {{0x00000000}, {0x00000000} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{0x00000000}, {0x00000000} }, /* asSp */ + {{0x00000000}, {0x00000000} }, /* asHp */ + {{0x00000000} }, /* asRc */ + {{0x00000000}, {0x00000000} }, /* asLout1 */ + {{0x00000000}, {0x00000000} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:audio+incall, capture:audio+incall + (BT input, analog+BT output) */ + { + {{MCDRV_D1SRC_VBOXREFOUT_ON}, + {MCDRV_D1SRC_VBOXREFOUT_ON} }, /* asMusicOut */ + {{MCDRV_D1SRC_VBOXOUT_ON|MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_VBOXOUT_ON|MCDRV_D1SRC_MUSICIN_ON} }, + /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {0x00000000}, + {MCDRV_D1SRC_ADIF2_ON}, + {0x00000000} }, /* asVboxMixIn */ + {{0x00000000}, {0x00000000} }, /* asAe0 */ + {{MCDRV_D1SRC_EXTIN_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{MCDRV_D1SRC_VBOXOUT_ON|MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_VBOXOUT_ON|MCDRV_D1SRC_MUSICIN_ON} }, + /* asDac0 */ + {{MCDRV_D1SRC_VBOXOUT_ON|MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_VBOXOUT_ON|MCDRV_D1SRC_MUSICIN_ON} }, + /* asDac1 */ + {{MCDRV_D2SRC_VBOXIOOUT_ON} }, /* asVoiceOut */ + {{MCDRV_D2SRC_VOICEIN_ON} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{0x00000000}, {0x00000000} }, /* asAdif1 */ + {{MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON}, + {MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON} }, + /* asAdif2 */ + {{0x00000000}, {0x00000000} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {0x00000000} }, /* asSp */ + {{0x00000000}, {0x00000000} }, /* asHp */ + {{0x00000000} }, /* asRc */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asLout1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {MCDRV_ASRC_DAC1_R_ON} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* incommunication (analog input, analog output) */ + { + {{MCDRV_D1SRC_VBOXREFOUT_ON}, + {MCDRV_D1SRC_VBOXREFOUT_ON} }, /* asMusicOut */ + {{0x00000000}, {0x00000000} }, /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_ADIF2_ON}, + {MCDRV_D1SRC_MUSICIN_ON} }, /* asVboxMixIn */ + {{0x00000000}, {0x00000000} }, /* asAe0 */ + {{MCDRV_D1SRC_ADIF1_ON}, + {MCDRV_D1SRC_ADIF1_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{MCDRV_D1SRC_VBOXOUT_ON}, + {MCDRV_D1SRC_VBOXOUT_ON} }, /* asDac0 */ + {{MCDRV_D1SRC_VBOXOUT_ON}, + {MCDRV_D1SRC_VBOXOUT_ON} }, /* asDac1 */ + {{0x00000000} }, /* asVoiceOut */ + {{0x00000000} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{MCDRV_D2SRC_ADC0_L_ON}, + {MCDRV_D2SRC_ADC0_R_ON} }, /* asAdif1 */ + {{MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON}, + {MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON} }, + /* asAdif2 */ + {{MCDRV_ASRC_MIC1_ON + |MCDRV_ASRC_MIC2_ON + |MCDRV_ASRC_MIC3_ON + |MCDRV_ASRC_MIC4_ON}, + {MCDRV_ASRC_MIC1_ON + |MCDRV_ASRC_MIC2_ON + |MCDRV_ASRC_MIC3_ON + |MCDRV_ASRC_MIC4_ON} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {0x00000000} }, /* asSp */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asHp */ + {{MCDRV_ASRC_DAC0_L_ON} }, /* asRc */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asLout1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {MCDRV_ASRC_DAC1_R_ON} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* incommunication (BT input, BT output) */ + { + {{MCDRV_D1SRC_VBOXREFOUT_ON}, + {MCDRV_D1SRC_VBOXREFOUT_ON} }, /* asMusicOut */ + {{MCDRV_D1SRC_VBOXOUT_ON}, + {MCDRV_D1SRC_VBOXOUT_ON} }, /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {0x00000000}, + {MCDRV_D1SRC_VBOXOUT_ON}, + {MCDRV_D1SRC_MUSICIN_ON} }, /* asVboxMixIn */ + {{0x00000000}, {0x00000000} }, /* asAe0 */ + {{MCDRV_D1SRC_EXTIN_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{0x00000000}, {0x00000000} }, /* asDac0 */ + {{0x00000000}, {0x00000000} }, /* asDac1 */ + {{0x00000000} }, /* asVoiceOut */ + {{0x00000000} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{0x00000000}, {0x00000000} }, /* asAdif1 */ + {{0x00000000}, {0x00000000} }, /* asAdif2 */ + {{0x00000000}, {0x00000000} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{0x00000000}, {0x00000000} }, /* asSp */ + {{0x00000000}, {0x00000000} }, /* asHp */ + {{0x00000000} }, /* asRc */ + {{0x00000000}, {0x00000000} }, /* asLout1 */ + {{0x00000000}, {0x00000000} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* incommunication (BT input, analog+BT output) */ + { + {{MCDRV_D1SRC_VBOXREFOUT_ON}, + {MCDRV_D1SRC_VBOXREFOUT_ON} }, /* asMusicOut */ + {{MCDRV_D1SRC_VBOXOUT_ON}, + {MCDRV_D1SRC_VBOXOUT_ON} }, /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {0x00000000}, + {MCDRV_D1SRC_ADIF2_ON}, + {MCDRV_D1SRC_MUSICIN_ON} }, /* asVboxMixIn */ + {{0x00000000}, {0x00000000} }, /* asAe0 */ + {{MCDRV_D1SRC_EXTIN_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{MCDRV_D1SRC_VBOXOUT_ON}, + {MCDRV_D1SRC_VBOXOUT_ON} }, /* asDac0 */ + {{MCDRV_D1SRC_VBOXOUT_ON}, + {MCDRV_D1SRC_VBOXOUT_ON} }, /* asDac1 */ + {{0x00000000} }, /* asVoiceOut */ + {{0x00000000} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{0x00000000}, {0x00000000} }, /* asAdif1 */ + {{MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON}, + {MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON} }, + /* asAdif2 */ + {{0x00000000}, {0x00000000} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {0x00000000} }, /* asSp */ + {{0x00000000}, {0x00000000} }, /* asHp */ + {{0x00000000} }, /* asRc */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asLout1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {MCDRV_ASRC_DAC1_R_ON} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:audio (HiFi), capture:off */ + { + {{0x00000000}, {0x00000000} }, /* asMusicOut */ + {{0x00000000}, {0x00000000} }, /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} }, /* asVboxMixIn */ + {{0x00000000}, {0x00000000} }, /* asAe0 */ + {{0x00000000}, {0x00000000} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{MCDRV_D1SRC_HIFIIN_ON}, + {MCDRV_D1SRC_HIFIIN_ON} }, /* asDac0 */ + {{MCDRV_D1SRC_HIFIIN_ON}, + {MCDRV_D1SRC_HIFIIN_ON} }, /* asDac1 */ + {{0x00000000} }, /* asVoiceOut */ + {{0x00000000} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{0x00000000} }, /* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{0x00000000}, {0x00000000} }, /* asAdif1 */ + {{0x00000000}, {0x00000000} }, /* asAdif2 */ + {{0x00000000}, {0x00000000} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {0x00000000} }, /* asSp */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asHp */ + {{MCDRV_ASRC_DAC0_L_ON} }, /* asRc */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asLout1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {MCDRV_ASRC_DAC1_R_ON} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:off, capture:audio (HiFi) */ + { + {{0x00000000}, {0x00000000} }, /* asMusicOut */ + {{0x00000000}, {0x00000000} }, /* asExtOut */ + {{MCDRV_D1SRC_ADIF0_ON} }, /* asHifiOut */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} }, /* asVboxMixIn */ + {{0x00000000}, {0x00000000} }, /* asAe0 */ + {{0x00000000}, {0x00000000} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{0x00000000}, {0x00000000} }, /* asDac0 */ + {{0x00000000}, {0x00000000} }, /* asDac1 */ + {{0x00000000} }, /* asVoiceOut */ + {{0x00000000} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{0x00000000} }, /* asHostOut */ + {{MCDRV_D2SRC_ADC0_L_ON}, + {MCDRV_D2SRC_ADC0_R_ON} }, /* asAdif0 */ + {{0x00000000}, {0x00000000} }, /* asAdif1 */ + {{0x00000000}, {0x00000000} }, /* asAdif2 */ + {{MCDRV_ASRC_MIC1_ON + |MCDRV_ASRC_MIC2_ON + |MCDRV_ASRC_MIC3_ON + |MCDRV_ASRC_MIC4_ON + |MCDRV_ASRC_LINEIN1_L_ON}, + {MCDRV_ASRC_MIC1_ON + |MCDRV_ASRC_MIC2_ON + |MCDRV_ASRC_MIC3_ON + |MCDRV_ASRC_MIC4_ON + |MCDRV_ASRC_LINEIN1_R_ON} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{0x00000000}, {0x00000000} }, /* asSp */ + {{0x00000000}, {0x00000000} }, /* asHp */ + {{0x00000000} }, /* asRc */ + {{0x00000000}, {0x00000000} }, /* asLout1 */ + {{0x00000000}, {0x00000000} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:audio (HiFi), capture:audio (HiFi) */ + { + {{0x00000000}, {0x00000000} }, /* asMusicOut */ + {{0x00000000}, {0x00000000} }, /* asExtOut */ + {{MCDRV_D1SRC_ADIF0_ON} }, /* asHifiOut */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} }, /* asVboxMixIn */ + {{0x00000000}, {0x00000000} }, /* asAe0 */ + {{0x00000000}, {0x00000000} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{MCDRV_D1SRC_HIFIIN_ON}, + {MCDRV_D1SRC_HIFIIN_ON} }, /* asDac0 */ + {{MCDRV_D1SRC_HIFIIN_ON}, + {MCDRV_D1SRC_HIFIIN_ON} }, /* asDac1 */ + {{0x00000000} }, /* asVoiceOut */ + {{0x00000000} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{0x00000000} }, /* asHostOut */ + {{MCDRV_D2SRC_ADC0_L_ON}, + {MCDRV_D2SRC_ADC0_R_ON} }, /* asAdif0 */ + {{0x00000000}, {0x00000000} }, /* asAdif1 */ + {{0x00000000}, {0x00000000} }, /* asAdif2 */ + {{MCDRV_ASRC_MIC1_ON + |MCDRV_ASRC_MIC2_ON + |MCDRV_ASRC_MIC3_ON + |MCDRV_ASRC_MIC4_ON + |MCDRV_ASRC_LINEIN1_L_ON}, + {MCDRV_ASRC_MIC1_ON + |MCDRV_ASRC_MIC2_ON + |MCDRV_ASRC_MIC3_ON + |MCDRV_ASRC_MIC4_ON + |MCDRV_ASRC_LINEIN1_R_ON} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {0x00000000} }, /* asSp */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asHp */ + {{MCDRV_ASRC_DAC0_L_ON} }, /* asRc */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asLout1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {MCDRV_ASRC_DAC1_R_ON} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:off, capture:audioex (analog input) */ + { + {{MCDRV_D1SRC_VBOXOUT_ON}, + {MCDRV_D1SRC_VBOXOUT_ON} }, /* asMusicOut */ + {{0x00000000}, {0x00000000} }, /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_AE1_ON}, + {0x00000000}, {0x00000000} }, /* asVboxMixIn */ + {{0x00000000}, {0x00000000} }, /* asAe0 */ + {{MCDRV_D1SRC_ADIF1_ON}, + {MCDRV_D1SRC_ADIF1_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{0x00000000}, {0x00000000} }, /* asDac0 */ + {{0x00000000}, {0x00000000} }, /* asDac1 */ + {{0x00000000} }, /* asVoiceOut */ + {{0x00000000} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{MCDRV_D2SRC_ADC0_L_ON}, + {MCDRV_D2SRC_ADC0_R_ON} }, /* asAdif1 */ + {{0x00000000}, {0x00000000} }, /* asAdif2 */ + {{MCDRV_ASRC_MIC1_ON + |MCDRV_ASRC_MIC2_ON + |MCDRV_ASRC_MIC3_ON + |MCDRV_ASRC_MIC4_ON + |MCDRV_ASRC_LINEIN1_L_ON}, + {MCDRV_ASRC_MIC1_ON + |MCDRV_ASRC_MIC2_ON + |MCDRV_ASRC_MIC3_ON + |MCDRV_ASRC_MIC4_ON + |MCDRV_ASRC_LINEIN1_R_ON} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{0x00000000}, {0x00000000} }, /* asSp */ + {{0x00000000}, {0x00000000} }, /* asHp */ + {{0x00000000} }, /* asRc */ + {{0x00000000}, {0x00000000} }, /* asLout1 */ + {{0x00000000}, {0x00000000} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:off, capture:audioex (BT input) */ + { + {{MCDRV_D1SRC_VBOXOUT_ON}, + {MCDRV_D1SRC_VBOXOUT_ON} }, /* asMusicOut */ + {{0x00000000}, {0x00000000} }, /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {0x00000000}, + {0x00000000}, {0x00000000} }, /* asVboxMixIn */ + {{0x00000000}, {0x00000000} }, /* asAe0 */ + {{MCDRV_D1SRC_EXTIN_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{0x00000000}, {0x00000000} }, /* asDac0 */ + {{0x00000000}, {0x00000000} }, /* asDac1 */ + {{0x00000000} }, /* asVoiceOut */ + {{0x00000000} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{0x00000000}, {0x00000000} }, /* asAdif1 */ + {{0x00000000}, {0x00000000} }, /* asAdif2 */ + {{0x00000000}, {0x00000000} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{0x00000000}, {0x00000000} }, /* asSp */ + {{0x00000000}, {0x00000000} }, /* asHp */ + {{0x00000000} }, /* asRc */ + {{0x00000000}, {0x00000000} }, /* asLout1 */ + {{0x00000000}, {0x00000000} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:audio, capture:audioex (analog input, analog output) */ + { + {{MCDRV_D1SRC_VBOXOUT_ON}, + {MCDRV_D1SRC_VBOXOUT_ON} }, /* asMusicOut */ + {{0x00000000}, {0x00000000} }, /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_AE0_ON}, {MCDRV_D1SRC_AE0_ON} }, /* asVboxMixIn */ + {{MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_MUSICIN_ON} }, /* asAe0 */ + {{MCDRV_D1SRC_ADIF1_ON}, + {MCDRV_D1SRC_ADIF1_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{MCDRV_D1SRC_AE0_ON}, + {MCDRV_D1SRC_AE0_ON} }, /* asDac0 */ + {{MCDRV_D1SRC_AE0_ON}, + {MCDRV_D1SRC_AE0_ON} }, /* asDac1 */ + {{0x00000000} }, /* asVoiceOut */ + {{0x00000000} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{MCDRV_D2SRC_ADC0_L_ON}, + {MCDRV_D2SRC_ADC0_R_ON} }, /* asAdif1 */ + {{MCDRV_D2SRC_DAC1REF_ON}, {MCDRV_D2SRC_DAC1REF_ON} }, /* asAdif2 */ + {{MCDRV_ASRC_MIC1_ON + |MCDRV_ASRC_MIC2_ON + |MCDRV_ASRC_MIC3_ON + |MCDRV_ASRC_MIC4_ON + |MCDRV_ASRC_LINEIN1_L_ON}, + {MCDRV_ASRC_MIC1_ON + |MCDRV_ASRC_MIC2_ON + |MCDRV_ASRC_MIC3_ON + |MCDRV_ASRC_MIC4_ON + |MCDRV_ASRC_LINEIN1_R_ON} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {0x00000000} }, /* asSp */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asHp */ + {{MCDRV_ASRC_DAC0_L_ON} }, /* asRc */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asLout1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {MCDRV_ASRC_DAC1_R_ON} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:audio, capture:audioex (BT input, analog output) */ + { + {{MCDRV_D1SRC_VBOXOUT_ON}, + {MCDRV_D1SRC_VBOXOUT_ON} }, /* asMusicOut */ + {{0x00000000}, {0x00000000} }, /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {0x00000000}, + {0x00000000}, {0x00000000} }, /* asVboxMixIn */ + {{MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_MUSICIN_ON} }, /* asAe0 */ + {{MCDRV_D1SRC_EXTIN_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{MCDRV_D1SRC_AE0_ON}, + {MCDRV_D1SRC_AE0_ON} }, /* asDac0 */ + {{MCDRV_D1SRC_AE0_ON}, + {MCDRV_D1SRC_AE0_ON} }, /* asDac1 */ + {{0x00000000} }, /* asVoiceOut */ + {{0x00000000} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{0x00000000}, {0x00000000} }, /* asAdif1 */ + {{0x00000000}, {0x00000000} }, /* asAdif2 */ + {{0x00000000}, {0x00000000} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {0x00000000} }, /* asSp */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asHp */ + {{MCDRV_ASRC_DAC0_L_ON} }, /* asRc */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asLout1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {MCDRV_ASRC_DAC1_R_ON} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:audio, capture:audioex (analog input, BT output) */ + { + {{MCDRV_D1SRC_VBOXOUT_ON}, + {MCDRV_D1SRC_VBOXOUT_ON} }, /* asMusicOut */ + {{MCDRV_D1SRC_AE0_ON}, + {MCDRV_D1SRC_AE0_ON} }, /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_AE1_ON}, + {0x00000000}, {0x00000000} }, /* asVboxMixIn */ + {{MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_MUSICIN_ON} }, /* asAe0 */ + {{MCDRV_D1SRC_ADIF1_ON}, + {MCDRV_D1SRC_ADIF1_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{0x00000000}, {0x00000000} }, /* asDac0 */ + {{0x00000000}, {0x00000000} }, /* asDac1 */ + {{0x00000000} }, /* asVoiceOut */ + {{0x00000000} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{MCDRV_D2SRC_ADC0_L_ON}, + {MCDRV_D2SRC_ADC0_R_ON} }, /* asAdif1 */ + {{0x00000000}, {0x00000000} }, /* asAdif2 */ + {{MCDRV_ASRC_MIC1_ON + |MCDRV_ASRC_MIC2_ON + |MCDRV_ASRC_MIC3_ON + |MCDRV_ASRC_MIC4_ON + |MCDRV_ASRC_LINEIN1_L_ON}, + {MCDRV_ASRC_MIC1_ON + |MCDRV_ASRC_MIC2_ON + |MCDRV_ASRC_MIC3_ON + |MCDRV_ASRC_MIC4_ON + |MCDRV_ASRC_LINEIN1_R_ON} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{0x00000000}, {0x00000000} }, /* asSp */ + {{0x00000000}, {0x00000000} }, /* asHp */ + {{0x00000000} }, /* asRc */ + {{0x00000000}, {0x00000000} }, /* asLout1 */ + {{0x00000000}, {0x00000000} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:audio, capture:audioex (BT input, BT output) */ + { + {{MCDRV_D1SRC_VBOXOUT_ON}, + {MCDRV_D1SRC_VBOXOUT_ON} }, /* asMusicOut */ + {{MCDRV_D1SRC_AE0_ON}, + {MCDRV_D1SRC_AE0_ON} }, /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {0x00000000}, + {0x00000000}, {0x00000000} }, /* asVboxMixIn */ + {{MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_MUSICIN_ON} }, /* asAe0 */ + {{MCDRV_D1SRC_EXTIN_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{0x00000000}, {0x00000000} }, /* asDac0 */ + {{0x00000000}, {0x00000000} }, /* asDac1 */ + {{0x00000000} }, /* asVoiceOut */ + {{0x00000000} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{0x00000000}, {0x00000000} }, /* asAdif1 */ + {{0x00000000}, {0x00000000} }, /* asAdif2 */ + {{0x00000000}, {0x00000000} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{0x00000000}, {0x00000000} }, /* asSp */ + {{0x00000000}, {0x00000000} }, /* asHp */ + {{0x00000000} }, /* asRc */ + {{0x00000000}, {0x00000000} }, /* asLout1 */ + {{0x00000000}, {0x00000000} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:audio, capture:audioex (analog input, analog+BT output) */ + { + {{MCDRV_D1SRC_VBOXOUT_ON}, + {MCDRV_D1SRC_VBOXOUT_ON} }, /* asMusicOut */ + {{MCDRV_D1SRC_AE0_ON}, + {MCDRV_D1SRC_AE0_ON} }, /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_AE1_ON}, + {0x00000000}, {0x00000000} }, /* asVboxMixIn */ + {{MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_MUSICIN_ON} }, /* asAe0 */ + {{MCDRV_D1SRC_ADIF1_ON}, + {MCDRV_D1SRC_ADIF1_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{MCDRV_D1SRC_AE0_ON}, + {MCDRV_D1SRC_AE0_ON} }, /* asDac0 */ + {{MCDRV_D1SRC_AE0_ON}, + {MCDRV_D1SRC_AE0_ON} }, /* asDac1 */ + {{0x00000000} }, /* asVoiceOut */ + {{0x00000000} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{MCDRV_D2SRC_ADC0_L_ON}, + {MCDRV_D2SRC_ADC0_R_ON} }, /* asAdif1 */ + {{0x00000000}, {0x00000000} }, /* asAdif2 */ + {{MCDRV_ASRC_MIC1_ON + |MCDRV_ASRC_MIC2_ON + |MCDRV_ASRC_MIC3_ON + |MCDRV_ASRC_MIC4_ON + |MCDRV_ASRC_LINEIN1_L_ON}, + {MCDRV_ASRC_MIC1_ON + |MCDRV_ASRC_MIC2_ON + |MCDRV_ASRC_MIC3_ON + |MCDRV_ASRC_MIC4_ON + |MCDRV_ASRC_LINEIN1_R_ON} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {0x00000000} }, /* asSp */ + {{0x00000000}, {0x00000000} }, /* asHp */ + {{0x00000000} }, /* asRc */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asLout1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {MCDRV_ASRC_DAC1_R_ON} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:audio, capture:audioex (BT input, analog+BT output) */ + { + {{MCDRV_D1SRC_VBOXOUT_ON}, + {MCDRV_D1SRC_VBOXOUT_ON} }, /* asMusicOut */ + {{MCDRV_D1SRC_AE0_ON}, + {MCDRV_D1SRC_AE0_ON} }, /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {0x00000000}, + {0x00000000}, {0x00000000} }, /* asVboxMixIn */ + {{MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_MUSICIN_ON} }, /* asAe0 */ + {{MCDRV_D1SRC_EXTIN_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{MCDRV_D1SRC_AE0_ON}, + {MCDRV_D1SRC_AE0_ON} }, /* asDac0 */ + {{MCDRV_D1SRC_AE0_ON}, + {MCDRV_D1SRC_AE0_ON} }, /* asDac1 */ + {{0x00000000} }, /* asVoiceOut */ + {{0x00000000} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{0x00000000}, {0x00000000} }, /* asAdif1 */ + {{0x00000000}, {0x00000000} }, /* asAdif2 */ + {{0x00000000}, {0x00000000} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {0x00000000} }, /* asSp */ + {{0x00000000}, {0x00000000} }, /* asHp */ + {{0x00000000} }, /* asRc */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asLout1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {MCDRV_ASRC_DAC1_R_ON} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:off, capture:audiovr (analog input) */ + { + {{MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_AE1_ON} }, /* asMusicOut */ + {{0x00000000}, {0x00000000} }, /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_AE1_ON}, + {0x00000000}, {0x00000000} }, /* asVboxMixIn */ + {{0x00000000}, {0x00000000} }, /* asAe0 */ + {{MCDRV_D1SRC_ADIF0_ON}, + {MCDRV_D1SRC_ADIF0_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{0x00000000}, {0x00000000} }, /* asDac0 */ + {{0x00000000}, {0x00000000} }, /* asDac1 */ + {{0x00000000} }, /* asVoiceOut */ + {{0x00000000} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{MCDRV_D2SRC_ADC1_ON}, + {MCDRV_D2SRC_ADC1_ON} }, /* asAdif0 */ + {{0x00000000}, {0x00000000} }, /* asAdif1 */ + {{0x00000000}, {0x00000000} }, /* asAdif2 */ + {{0x00000000}, {0x00000000} }, /* asAdc0 */ + {{MCDRV_ASRC_MIC1_ON + |MCDRV_ASRC_MIC2_ON + |MCDRV_ASRC_MIC3_ON + |MCDRV_ASRC_MIC4_ON + |MCDRV_ASRC_LINEIN1_M_ON} }, /* asAdc1 */ + {{0x00000000}, {0x00000000} }, /* asSp */ + {{0x00000000}, {0x00000000} }, /* asHp */ + {{0x00000000} }, /* asRc */ + {{0x00000000}, {0x00000000} }, /* asLout1 */ + {{0x00000000}, {0x00000000} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:off, capture:audiovr (BT input) */ + { + {{MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_AE1_ON} }, /* asMusicOut */ + {{0x00000000}, {0x00000000} }, /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_AE1_ON}, + {0x00000000}, {0x00000000} }, /* asVboxMixIn */ + {{0x00000000}, {0x00000000} }, /* asAe0 */ + {{MCDRV_D1SRC_EXTIN_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{0x00000000}, {0x00000000} }, /* asDac0 */ + {{0x00000000}, {0x00000000} }, /* asDac1 */ + {{0x00000000} }, /* asVoiceOut */ + {{0x00000000} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{0x00000000}, {0x00000000} }, /* asAdif1 */ + {{0x00000000}, {0x00000000} }, /* asAdif2 */ + {{0x00000000}, {0x00000000} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{0x00000000}, {0x00000000} }, /* asSp */ + {{0x00000000}, {0x00000000} }, /* asHp */ + {{0x00000000} }, /* asRc */ + {{0x00000000}, {0x00000000} }, /* asLout1 */ + {{0x00000000}, {0x00000000} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:audio, capture:audiovr (analog input, analog output) */ + { + {{MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_AE1_ON} }, /* asMusicOut */ + {{0x00000000}, {0x00000000} }, /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_AE1_ON}, + {0x00000000}, {0x00000000} }, /* asVboxMixIn */ + {{MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_MUSICIN_ON} }, /* asAe0 */ + {{MCDRV_D1SRC_ADIF0_ON}, + {MCDRV_D1SRC_ADIF0_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{MCDRV_D1SRC_AE0_ON}, + {MCDRV_D1SRC_AE0_ON} }, /* asDac0 */ + {{MCDRV_D1SRC_AE0_ON}, + {MCDRV_D1SRC_AE0_ON} }, /* asDac1 */ + {{0x00000000} }, /* asVoiceOut */ + {{0x00000000} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{MCDRV_D2SRC_ADC1_ON}, + {MCDRV_D2SRC_ADC1_ON} }, /* asAdif0 */ + {{0x00000000}, {0x00000000} }, /* asAdif1 */ + {{0x00000000}, {0x00000000} }, /* asAdif2 */ + {{0x00000000}, {0x00000000} }, /* asAdc0 */ + {{MCDRV_ASRC_MIC1_ON + |MCDRV_ASRC_MIC2_ON + |MCDRV_ASRC_MIC3_ON + |MCDRV_ASRC_MIC4_ON + |MCDRV_ASRC_LINEIN1_M_ON} }, /* asAdc1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {0x00000000} }, /* asSp */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asHp */ + {{MCDRV_ASRC_DAC0_L_ON} }, /* asRc */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asLout1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {MCDRV_ASRC_DAC1_R_ON} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:audio, capture:audiovr (BT input, analog output) */ + { + {{MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_AE1_ON} }, /* asMusicOut */ + {{0x00000000}, {0x00000000} }, /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_AE1_ON}, + {0x00000000}, {0x00000000} }, /* asVboxMixIn */ + {{MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_MUSICIN_ON} }, /* asAe0 */ + {{MCDRV_D1SRC_EXTIN_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{MCDRV_D1SRC_AE0_ON}, + {MCDRV_D1SRC_AE0_ON} }, /* asDac0 */ + {{MCDRV_D1SRC_AE0_ON}, + {MCDRV_D1SRC_AE0_ON} }, /* asDac1 */ + {{0x00000000} }, /* asVoiceOut */ + {{0x00000000} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{0x00000000}, {0x00000000} }, /* asAdif1 */ + {{0x00000000}, {0x00000000} }, /* asAdif2 */ + {{0x00000000}, {0x00000000} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {0x00000000} }, /* asSp */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asHp */ + {{MCDRV_ASRC_DAC0_L_ON} }, /* asRc */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asLout1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {MCDRV_ASRC_DAC1_R_ON} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:audio, capture:audiovr (analog input, BT output) */ + { + {{MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_AE1_ON} }, /* asMusicOut */ + {{MCDRV_D1SRC_AE0_ON}, + {MCDRV_D1SRC_AE0_ON} }, /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_AE1_ON}, + {0x00000000}, {0x00000000} }, /* asVboxMixIn */ + {{MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_MUSICIN_ON} }, /* asAe0 */ + {{MCDRV_D1SRC_ADIF0_ON}, + {MCDRV_D1SRC_ADIF0_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{0x00000000}, {0x00000000} }, /* asDac0 */ + {{0x00000000}, {0x00000000} }, /* asDac1 */ + {{0x00000000} }, /* asVoiceOut */ + {{0x00000000} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{MCDRV_D2SRC_ADC1_ON}, + {MCDRV_D2SRC_ADC1_ON} }, /* asAdif0 */ + {{0x00000000}, {0x00000000} }, /* asAdif1 */ + {{0x00000000}, {0x00000000} }, /* asAdif2 */ + {{0x00000000}, {0x00000000} }, /* asAdc0 */ + {{MCDRV_ASRC_MIC1_ON + |MCDRV_ASRC_MIC2_ON + |MCDRV_ASRC_MIC3_ON + |MCDRV_ASRC_MIC4_ON + |MCDRV_ASRC_LINEIN1_M_ON} }, /* asAdc1 */ + {{0x00000000}, {0x00000000} }, /* asSp */ + {{0x00000000}, {0x00000000} }, /* asHp */ + {{0x00000000} }, /* asRc */ + {{0x00000000}, {0x00000000} }, /* asLout1 */ + {{0x00000000}, {0x00000000} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:audio, capture:audiovr (BT input, BT output) */ + { + {{MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_AE1_ON} }, /* asMusicOut */ + {{MCDRV_D1SRC_AE0_ON}, + {MCDRV_D1SRC_AE0_ON} }, /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_AE1_ON}, + {0x00000000}, {0x00000000} }, /* asVboxMixIn */ + {{MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_MUSICIN_ON} }, /* asAe0 */ + {{MCDRV_D1SRC_EXTIN_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{0x00000000}, {0x00000000} }, /* asDac0 */ + {{0x00000000}, {0x00000000} }, /* asDac1 */ + {{0x00000000} }, /* asVoiceOut */ + {{0x00000000} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{0x00000000}, {0x00000000} }, /* asAdif1 */ + {{0x00000000}, {0x00000000} }, /* asAdif2 */ + {{0x00000000}, {0x00000000} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{0x00000000}, {0x00000000} }, /* asSp */ + {{0x00000000}, {0x00000000} }, /* asHp */ + {{0x00000000} }, /* asRc */ + {{0x00000000}, {0x00000000} }, /* asLout1 */ + {{0x00000000}, {0x00000000} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:audio, capture:audiovr (analog input, analog+BT output) */ + { + {{MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_AE1_ON} }, /* asMusicOut */ + {{MCDRV_D1SRC_AE0_ON}, + {MCDRV_D1SRC_AE0_ON} }, /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_AE1_ON}, + {0x00000000}, {0x00000000} }, /* asVboxMixIn */ + {{MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_MUSICIN_ON} }, /* asAe0 */ + {{MCDRV_D1SRC_ADIF0_ON}, + {MCDRV_D1SRC_ADIF0_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{MCDRV_D1SRC_AE0_ON}, + {MCDRV_D1SRC_AE0_ON} }, /* asDac0 */ + {{MCDRV_D1SRC_AE0_ON}, + {MCDRV_D1SRC_AE0_ON} }, /* asDac1 */ + {{0x00000000} }, /* asVoiceOut */ + {{0x00000000} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{MCDRV_D2SRC_ADC1_ON}, + {MCDRV_D2SRC_ADC1_ON} }, /* asAdif0 */ + {{0x00000000}, {0x00000000} }, /* asAdif1 */ + {{0x00000000}, {0x00000000} }, /* asAdif2 */ + {{0x00000000}, {0x00000000} }, /* asAdc0 */ + {{MCDRV_ASRC_MIC1_ON + |MCDRV_ASRC_MIC2_ON + |MCDRV_ASRC_MIC3_ON + |MCDRV_ASRC_MIC4_ON + |MCDRV_ASRC_LINEIN1_M_ON} }, /* asAdc1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {0x00000000} }, /* asSp */ + {{0x00000000}, {0x00000000} }, /* asHp */ + {{0x00000000} }, /* asRc */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asLout1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {MCDRV_ASRC_DAC1_R_ON} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:audio, capture:audiovr (BT input, analog+BT output) */ + { + {{MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_AE1_ON} }, /* asMusicOut */ + {{MCDRV_D1SRC_AE0_ON}, + {MCDRV_D1SRC_AE0_ON} }, /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_AE1_ON}, + {0x00000000}, {0x00000000} }, /* asVboxMixIn */ + {{MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_MUSICIN_ON} }, /* asAe0 */ + {{MCDRV_D1SRC_EXTIN_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{MCDRV_D1SRC_AE0_ON}, + {MCDRV_D1SRC_AE0_ON} }, /* asDac0 */ + {{MCDRV_D1SRC_AE0_ON}, + {MCDRV_D1SRC_AE0_ON} }, /* asDac1 */ + {{0x00000000} }, /* asVoiceOut */ + {{0x00000000} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{0x00000000}, {0x00000000} }, /* asAdif1 */ + {{0x00000000}, {0x00000000} }, /* asAdif2 */ + {{0x00000000}, {0x00000000} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {0x00000000} }, /* asSp */ + {{0x00000000}, {0x00000000} }, /* asHp */ + {{0x00000000} }, /* asRc */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asLout1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {MCDRV_ASRC_DAC1_R_ON} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:karaoke, capture:off (analog input) */ + { + {{0x00000000}, {0x00000000} }, /* asMusicOut */ + {{0x00000000}, {0x00000000} }, /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_ADIF1_ON}, + {MCDRV_D1SRC_ADIF1_ON} }, /* asVboxMixIn */ + {{MCDRV_D1SRC_VBOXOUT_ON + |MCDRV_D1SRC_VBOXREFOUT_ON}, + {MCDRV_D1SRC_VBOXOUT_ON + |MCDRV_D1SRC_VBOXREFOUT_ON} }, /* asAe0 */ + {{0x00000000}, {0x00000000} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{MCDRV_D1SRC_AE0_ON}, + {MCDRV_D1SRC_AE0_ON} }, /* asDac0 */ + {{MCDRV_D1SRC_AE0_ON}, + {MCDRV_D1SRC_AE0_ON} }, /* asDac1 */ + {{0x00000000} }, /* asVoiceOut */ + {{0x00000000} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{MCDRV_D2SRC_ADC0_L_ON}, + {MCDRV_D2SRC_ADC0_R_ON} }, /* asAdif1 */ + {{0x00000000}, {0x00000000} }, /* asAdif2 */ + {{MCDRV_ASRC_MIC1_ON + |MCDRV_ASRC_MIC2_ON + |MCDRV_ASRC_MIC4_ON}, + {MCDRV_ASRC_MIC1_ON + |MCDRV_ASRC_MIC2_ON + |MCDRV_ASRC_MIC4_ON} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {0x00000000} }, /* asSp */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asHp */ + {{MCDRV_ASRC_DAC0_L_ON} }, /* asRc */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asLout1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {MCDRV_ASRC_DAC1_R_ON} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:karaoke, capture:off (BT input) */ + { + {{0x00000000}, {0x00000000} }, /* asMusicOut */ + {{0x00000000}, {0x00000000} }, /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_EXTIN_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asVboxMixIn */ + {{MCDRV_D1SRC_VBOXOUT_ON + |MCDRV_D1SRC_VBOXREFOUT_ON}, + {MCDRV_D1SRC_VBOXOUT_ON + |MCDRV_D1SRC_VBOXREFOUT_ON} }, /* asAe0 */ + {{0x00000000}, {0x00000000} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{MCDRV_D1SRC_AE0_ON}, + {MCDRV_D1SRC_AE0_ON} }, /* asDac0 */ + {{MCDRV_D1SRC_AE0_ON}, + {MCDRV_D1SRC_AE0_ON} }, /* asDac1 */ + {{0x00000000} }, /* asVoiceOut */ + {{0x00000000} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{0x00000000}, {0x00000000} }, /* asAdif1 */ + {{0x00000000}, {0x00000000} }, /* asAdif2 */ + {{0x00000000}, {0x00000000} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {0x00000000} }, /* asSp */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asHp */ + {{MCDRV_ASRC_DAC0_L_ON} }, /* asRc */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asLout1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {MCDRV_ASRC_DAC1_R_ON} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:karaoke, capture:audio (analog input) */ + { + {{MCDRV_D1SRC_VBOXOUT_ON + |MCDRV_D1SRC_VBOXREFOUT_ON}, + {MCDRV_D1SRC_VBOXOUT_ON + |MCDRV_D1SRC_VBOXREFOUT_ON} }, /* asMusicOut */ + {{0x00000000}, {0x00000000} }, /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_ADIF1_ON}, + {MCDRV_D1SRC_ADIF1_ON} }, /* asVboxMixIn */ + {{MCDRV_D1SRC_VBOXOUT_ON + |MCDRV_D1SRC_VBOXREFOUT_ON}, + {MCDRV_D1SRC_VBOXOUT_ON + |MCDRV_D1SRC_VBOXREFOUT_ON} }, /* asAe0 */ + {{0x00000000}, {0x00000000} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{MCDRV_D1SRC_AE0_ON}, + {MCDRV_D1SRC_AE0_ON} }, /* asDac0 */ + {{MCDRV_D1SRC_AE0_ON}, + {MCDRV_D1SRC_AE0_ON} }, /* asDac1 */ + {{0x00000000} }, /* asVoiceOut */ + {{0x00000000} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{MCDRV_D2SRC_ADC0_L_ON}, + {MCDRV_D2SRC_ADC0_R_ON} }, /* asAdif1 */ + {{0x00000000}, {0x00000000} }, /* asAdif2 */ + {{MCDRV_ASRC_MIC1_ON + |MCDRV_ASRC_MIC2_ON + |MCDRV_ASRC_MIC4_ON}, + {MCDRV_ASRC_MIC1_ON + |MCDRV_ASRC_MIC2_ON + |MCDRV_ASRC_MIC4_ON} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {0x00000000} }, /* asSp */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asHp */ + {{MCDRV_ASRC_DAC0_L_ON} }, /* asRc */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asLout1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {MCDRV_ASRC_DAC1_R_ON} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:karaoke, capture:audio (BT input) */ + { + {{MCDRV_D1SRC_VBOXOUT_ON + |MCDRV_D1SRC_VBOXREFOUT_ON}, + {MCDRV_D1SRC_VBOXOUT_ON + |MCDRV_D1SRC_VBOXREFOUT_ON} }, /* asMusicOut */ + {{0x00000000}, {0x00000000} }, /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_EXTIN_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asVboxMixIn */ + {{MCDRV_D1SRC_VBOXOUT_ON + |MCDRV_D1SRC_VBOXREFOUT_ON}, + {MCDRV_D1SRC_VBOXOUT_ON + |MCDRV_D1SRC_VBOXREFOUT_ON} }, /* asAe0 */ + {{0x00000000}, {0x00000000} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{MCDRV_D1SRC_AE0_ON}, + {MCDRV_D1SRC_AE0_ON} }, /* asDac0 */ + {{MCDRV_D1SRC_AE0_ON}, + {MCDRV_D1SRC_AE0_ON} }, /* asDac1 */ + {{0x00000000} }, /* asVoiceOut */ + {{0x00000000} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{0x00000000}, {0x00000000} }, /* asAdif1 */ + {{0x00000000}, {0x00000000} }, /* asAdif2 */ + {{0x00000000}, {0x00000000} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {0x00000000} }, /* asSp */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asHp */ + {{MCDRV_ASRC_DAC0_L_ON} }, /* asRc */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asLout1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {MCDRV_ASRC_DAC1_R_ON} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:incall2, capture:incall (analog input, analog output) */ + { + {{0x00000000}, {0x00000000} }, /* asMusicOut */ + {{MCDRV_D1SRC_VBOXREFOUT_ON}, + {MCDRV_D1SRC_VBOXREFOUT_ON} }, /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_ADIF2_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asVboxMixIn */ + {{0x00000000}, {0x00000000} }, /* asAe0 */ + {{MCDRV_D1SRC_ADIF1_ON}, + {MCDRV_D1SRC_ADIF1_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{MCDRV_D1SRC_EXTIN_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asDac0 */ + {{MCDRV_D1SRC_EXTIN_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asDac1 */ + {{0x00000000} }, /* asVoiceOut */ + {{0x00000000} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{MCDRV_D2SRC_ADC0_L_ON}, + {MCDRV_D2SRC_ADC0_R_ON} }, /* asAdif1 */ + {{MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON}, + {MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON} }, + /* asAdif2 */ + {{MCDRV_ASRC_MIC1_ON + |MCDRV_ASRC_MIC2_ON + |MCDRV_ASRC_MIC3_ON + |MCDRV_ASRC_MIC4_ON}, + {MCDRV_ASRC_MIC1_ON + |MCDRV_ASRC_MIC2_ON + |MCDRV_ASRC_MIC3_ON + |MCDRV_ASRC_MIC4_ON} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {0x00000000} }, /* asSp */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asHp */ + {{MCDRV_ASRC_DAC0_L_ON} }, /* asRc */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asLout1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {MCDRV_ASRC_DAC1_R_ON} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:incall2, capture:incall (BT input, BT output) */ + { + {{0x00000000}, {0x00000000} }, /* asMusicOut */ + {{MCDRV_D1SRC_VBOXOUT_ON}, + {MCDRV_D1SRC_VBOXOUT_ON} }, /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {0x00000000}, + {MCDRV_D1SRC_VBOXOUT_ON}, + {0x00000000} }, /* asVboxMixIn */ + {{0x00000000}, {0x00000000} }, /* asAe0 */ + {{MCDRV_D1SRC_EXTIN_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{0x00000000}, {0x00000000} }, /* asDac0 */ + {{0x00000000}, {0x00000000} }, /* asDac1 */ + {{MCDRV_D2SRC_VBOXIOOUT_ON} }, /* asVoiceOut */ + {{MCDRV_D2SRC_VOICEIN_ON} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{0x00000000}, {0x00000000} }, /* asAdif1 */ + {{0x00000000}, {0x00000000} }, /* asAdif2 */ + {{0x00000000}, {0x00000000} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{0x00000000}, {0x00000000} }, /* asSp */ + {{0x00000000}, {0x00000000} }, /* asHp */ + {{0x00000000} }, /* asRc */ + {{0x00000000}, {0x00000000} }, /* asLout1 */ + {{0x00000000}, {0x00000000} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:incall2, capture:incall (BT input, analog+BT output) */ + { + {{0x00000000}, {0x00000000} }, /* asMusicOut */ + {{MCDRV_D1SRC_VBOXOUT_ON}, + {MCDRV_D1SRC_VBOXOUT_ON} }, /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {0x00000000}, + {MCDRV_D1SRC_ADIF2_ON}, + {0x00000000} }, /* asVboxMixIn */ + {{0x00000000}, {0x00000000} }, /* asAe0 */ + {{MCDRV_D1SRC_EXTIN_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{MCDRV_D1SRC_EXTIN_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asDac0 */ + {{MCDRV_D1SRC_EXTIN_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asDac1 */ + {{MCDRV_D2SRC_VBOXIOOUT_ON} }, /* asVoiceOut */ + {{MCDRV_D2SRC_VOICEIN_ON} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{0x00000000}, {0x00000000} }, /* asAdif1 */ + {{MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON}, + {MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON} }, + /* asAdif2 */ + {{0x00000000}, {0x00000000} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {0x00000000} }, /* asSp */ + {{0x00000000}, {0x00000000} }, /* asHp */ + {{0x00000000} }, /* asRc */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asLout1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {MCDRV_ASRC_DAC1_R_ON} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:audio+incall2, capture:incall + (analog input analog output) */ + { + {{0x00000000}, {0x00000000} }, /* asMusicOut */ + {{MCDRV_D1SRC_VBOXREFOUT_ON}, + {MCDRV_D1SRC_VBOXREFOUT_ON} }, /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_ADIF2_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asVboxMixIn */ + {{0x00000000}, + {0x00000000} }, /* asAe0 */ + {{MCDRV_D1SRC_ADIF1_ON}, + {MCDRV_D1SRC_ADIF1_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{MCDRV_D1SRC_EXTIN_ON|MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_EXTIN_ON|MCDRV_D1SRC_MUSICIN_ON} }, + /* asDac0 */ + {{MCDRV_D1SRC_EXTIN_ON|MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_EXTIN_ON|MCDRV_D1SRC_MUSICIN_ON} }, + /* asDac1 */ + {{0x00000000} }, /* asVoiceOut */ + {{0x00000000} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{MCDRV_D2SRC_ADC0_L_ON}, + {MCDRV_D2SRC_ADC0_R_ON} }, /* asAdif1 */ + {{MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON}, + {MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON} }, + /* asAdif2 */ + {{MCDRV_ASRC_MIC1_ON + |MCDRV_ASRC_MIC2_ON + |MCDRV_ASRC_MIC3_ON + |MCDRV_ASRC_MIC4_ON}, + {MCDRV_ASRC_MIC1_ON + |MCDRV_ASRC_MIC2_ON + |MCDRV_ASRC_MIC3_ON + |MCDRV_ASRC_MIC4_ON} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {0x00000000} }, /* asSp */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asHp */ + {{MCDRV_ASRC_DAC0_L_ON} }, /* asRc */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asLout1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {MCDRV_ASRC_DAC1_R_ON} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:audio+incall2, capture:incall (BT input BT output) */ + { + {{0x00000000}, {0x00000000} }, /* asMusicOut */ + {{MCDRV_D1SRC_VBOXOUT_ON|MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_VBOXOUT_ON|MCDRV_D1SRC_MUSICIN_ON} }, + /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {0x00000000}, + {MCDRV_D1SRC_VBOXOUT_ON}, + {0x00000000} }, /* asVboxMixIn */ + {{0x00000000}, + {0x00000000} }, /* asAe0 */ + {{MCDRV_D1SRC_EXTIN_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{0x00000000}, {0x00000000} }, /* asDac0 */ + {{0x00000000}, {0x00000000} }, /* asDac1 */ + {{MCDRV_D2SRC_VBOXIOOUT_ON} }, /* asVoiceOut */ + {{MCDRV_D2SRC_VOICEIN_ON} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{0x00000000}, {0x00000000} }, /* asAdif1 */ + {{0x00000000}, {0x00000000} }, /* asAdif2 */ + {{0x00000000}, {0x00000000} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{0x00000000}, {0x00000000} }, /* asSp */ + {{0x00000000}, {0x00000000} }, /* asHp */ + {{0x00000000} }, /* asRc */ + {{0x00000000}, {0x00000000} }, /* asLout1 */ + {{0x00000000}, {0x00000000} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:audio+incall2, capture:incall + (BT input analog+BT output) */ + { + {{0x00000000}, {0x00000000} }, /* asMusicOut */ + {{MCDRV_D1SRC_VBOXOUT_ON|MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_VBOXOUT_ON|MCDRV_D1SRC_MUSICIN_ON} }, + /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {0x00000000}, + {MCDRV_D1SRC_ADIF2_ON}, + {0x00000000} }, /* asVboxMixIn */ + {{0x00000000}, + {0x00000000} }, /* asAe0 */ + {{MCDRV_D1SRC_EXTIN_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{MCDRV_D1SRC_EXTIN_ON|MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_EXTIN_ON|MCDRV_D1SRC_MUSICIN_ON} }, + /* asDac0 */ + {{MCDRV_D1SRC_EXTIN_ON|MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_EXTIN_ON|MCDRV_D1SRC_MUSICIN_ON} }, + /* asDac1 */ + {{MCDRV_D2SRC_VBOXIOOUT_ON} }, /* asVoiceOut */ + {{MCDRV_D2SRC_VOICEIN_ON} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{0x00000000}, {0x00000000} }, /* asAdif1 */ + {{MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON}, + {MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON} }, + /* asAdif2 */ + {{0x00000000}, {0x00000000} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {0x00000000} }, /* asSp */ + {{0x00000000}, {0x00000000} }, /* asHp */ + {{0x00000000} }, /* asRc */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asLout1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {MCDRV_ASRC_DAC1_R_ON} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:incall2, capture:audio+incall + (analog input, analog output) */ + { + {{MCDRV_D1SRC_VBOXREFOUT_ON}, + {MCDRV_D1SRC_VBOXREFOUT_ON} }, /* asMusicOut */ + {{MCDRV_D1SRC_VBOXREFOUT_ON}, + {MCDRV_D1SRC_VBOXREFOUT_ON} }, /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_ADIF2_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asVboxMixIn */ + {{0x00000000}, {0x00000000} }, /* asAe0 */ + {{MCDRV_D1SRC_ADIF1_ON}, + {MCDRV_D1SRC_ADIF1_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{MCDRV_D1SRC_EXTIN_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asDac0 */ + {{MCDRV_D1SRC_EXTIN_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asDac1 */ + {{0x00000000} }, /* asVoiceOut */ + {{0x00000000} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{MCDRV_D2SRC_ADC0_L_ON}, + {MCDRV_D2SRC_ADC0_R_ON} }, /* asAdif1 */ + {{MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON}, + {MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON} }, + /* asAdif2 */ + {{MCDRV_ASRC_MIC1_ON + |MCDRV_ASRC_MIC2_ON + |MCDRV_ASRC_MIC3_ON + |MCDRV_ASRC_MIC4_ON}, + {MCDRV_ASRC_MIC1_ON + |MCDRV_ASRC_MIC2_ON + |MCDRV_ASRC_MIC3_ON + |MCDRV_ASRC_MIC4_ON} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {0x00000000} }, /* asSp */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asHp */ + {{MCDRV_ASRC_DAC0_L_ON} }, /* asRc */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asLout1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {MCDRV_ASRC_DAC1_R_ON} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:incall2, capture:audio+incall (BT input, BT output) */ + { + {{MCDRV_D1SRC_VBOXREFOUT_ON}, + {MCDRV_D1SRC_VBOXREFOUT_ON} }, /* asMusicOut */ + {{MCDRV_D1SRC_VBOXOUT_ON|MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_VBOXOUT_ON|MCDRV_D1SRC_MUSICIN_ON} }, + /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {0x00000000}, + {MCDRV_D1SRC_VBOXOUT_ON}, + {0x00000000} }, /* asVboxMixIn */ + {{0x00000000}, {0x00000000} }, /* asAe0 */ + {{MCDRV_D1SRC_EXTIN_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{0x00000000}, {0x00000000} }, /* asDac0 */ + {{0x00000000}, {0x00000000} }, /* asDac1 */ + {{MCDRV_D2SRC_VBOXIOOUT_ON} }, /* asVoiceOut */ + {{MCDRV_D2SRC_VOICEIN_ON} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{0x00000000}, {0x00000000} }, /* asAdif1 */ + {{0x00000000}, {0x00000000} }, /* asAdif2 */ + {{0x00000000}, {0x00000000} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{0x00000000}, {0x00000000} }, /* asSp */ + {{0x00000000}, {0x00000000} }, /* asHp */ + {{0x00000000} }, /* asRc */ + {{0x00000000}, {0x00000000} }, /* asLout1 */ + {{0x00000000}, {0x00000000} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:incall2, capture:audio+incall + (BT input, analog+BT output) */ + { + {{MCDRV_D1SRC_VBOXREFOUT_ON}, + {MCDRV_D1SRC_VBOXREFOUT_ON} }, /* asMusicOut */ + {{MCDRV_D1SRC_VBOXOUT_ON|MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_VBOXOUT_ON|MCDRV_D1SRC_MUSICIN_ON} }, + /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {0x00000000}, + {MCDRV_D1SRC_ADIF2_ON}, + {0x00000000} }, /* asVboxMixIn */ + {{0x00000000}, {0x00000000} }, /* asAe0 */ + {{MCDRV_D1SRC_EXTIN_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{MCDRV_D1SRC_EXTIN_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asDac0 */ + {{MCDRV_D1SRC_EXTIN_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asDac1 */ + {{MCDRV_D2SRC_VBOXIOOUT_ON} }, /* asVoiceOut */ + {{MCDRV_D2SRC_VOICEIN_ON} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{0x00000000}, {0x00000000} }, /* asAdif1 */ + {{MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON}, + {MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON} }, + /* asAdif2 */ + {{0x00000000}, {0x00000000} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {0x00000000} }, /* asSp */ + {{0x00000000}, {0x00000000} }, /* asHp */ + {{0x00000000} }, /* asRc */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asLout1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {MCDRV_ASRC_DAC1_R_ON} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:audio+incall2, capture:audio+incall + (analog input, analog output) */ + { + {{MCDRV_D1SRC_VBOXREFOUT_ON}, + {MCDRV_D1SRC_VBOXREFOUT_ON} }, /* asMusicOut */ + {{MCDRV_D1SRC_VBOXREFOUT_ON}, + {MCDRV_D1SRC_VBOXREFOUT_ON} }, /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_ADIF2_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asVboxMixIn */ + {{0x00000000}, + {0x00000000} }, /* asAe0 */ + {{MCDRV_D1SRC_ADIF1_ON}, + {MCDRV_D1SRC_ADIF1_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{MCDRV_D1SRC_EXTIN_ON|MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_EXTIN_ON|MCDRV_D1SRC_MUSICIN_ON} }, + /* asDac0 */ + {{MCDRV_D1SRC_EXTIN_ON|MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_EXTIN_ON|MCDRV_D1SRC_MUSICIN_ON} }, + /* asDac1 */ + {{0x00000000} }, /* asVoiceOut */ + {{0x00000000} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{MCDRV_D2SRC_ADC0_L_ON}, + {MCDRV_D2SRC_ADC0_R_ON} }, /* asAdif1 */ + {{MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON}, + {MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON} }, + /* asAdif2 */ + {{MCDRV_ASRC_MIC1_ON + |MCDRV_ASRC_MIC2_ON + |MCDRV_ASRC_MIC3_ON + |MCDRV_ASRC_MIC4_ON}, + {MCDRV_ASRC_MIC1_ON + |MCDRV_ASRC_MIC2_ON + |MCDRV_ASRC_MIC3_ON + |MCDRV_ASRC_MIC4_ON} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {0x00000000} }, /* asSp */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asHp */ + {{MCDRV_ASRC_DAC0_L_ON} }, /* asRc */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asLout1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {MCDRV_ASRC_DAC1_R_ON} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:audio+incall2, capture:audio+incall + (BT input, BT output) */ + { + {{MCDRV_D1SRC_VBOXREFOUT_ON}, + {MCDRV_D1SRC_VBOXREFOUT_ON} }, /* asMusicOut */ + {{MCDRV_D1SRC_VBOXOUT_ON|MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_VBOXOUT_ON|MCDRV_D1SRC_MUSICIN_ON} }, + /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {0x00000000}, + {MCDRV_D1SRC_VBOXOUT_ON}, + {0x00000000} }, /* asVboxMixIn */ + {{0x00000000}, + {0x00000000} }, /* asAe0 */ + {{MCDRV_D1SRC_EXTIN_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{0x00000000}, {0x00000000} }, /* asDac0 */ + {{0x00000000}, {0x00000000} }, /* asDac1 */ + {{MCDRV_D2SRC_VBOXIOOUT_ON} }, /* asVoiceOut */ + {{MCDRV_D2SRC_VOICEIN_ON} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{0x00000000}, {0x00000000} }, /* asAdif1 */ + {{0x00000000}, {0x00000000} }, /* asAdif2 */ + {{0x00000000}, {0x00000000} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{0x00000000}, {0x00000000} }, /* asSp */ + {{0x00000000}, {0x00000000} }, /* asHp */ + {{0x00000000} }, /* asRc */ + {{0x00000000}, {0x00000000} }, /* asLout1 */ + {{0x00000000}, {0x00000000} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:audio+incall2, capture:audio+incall + (BT input, analog+BT output) */ + { + {{MCDRV_D1SRC_VBOXREFOUT_ON}, + {MCDRV_D1SRC_VBOXREFOUT_ON} }, /* asMusicOut */ + {{MCDRV_D1SRC_VBOXOUT_ON|MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_VBOXOUT_ON|MCDRV_D1SRC_MUSICIN_ON} }, + /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {0x00000000}, + {MCDRV_D1SRC_ADIF2_ON}, + {0x00000000} }, /* asVboxMixIn */ + {{0x00000000}, + {0x00000000} }, /* asAe0 */ + {{MCDRV_D1SRC_EXTIN_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{MCDRV_D1SRC_EXTIN_ON|MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_EXTIN_ON|MCDRV_D1SRC_MUSICIN_ON} }, + /* asDac0 */ + {{MCDRV_D1SRC_EXTIN_ON|MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_EXTIN_ON|MCDRV_D1SRC_MUSICIN_ON} }, + /* asDac1 */ + {{MCDRV_D2SRC_VBOXIOOUT_ON} }, /* asVoiceOut */ + {{MCDRV_D2SRC_VOICEIN_ON} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{0x00000000}, {0x00000000} }, /* asAdif1 */ + {{MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON}, + {MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON} }, + /* asAdif2 */ + {{0x00000000}, {0x00000000} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {0x00000000} }, /* asSp */ + {{0x00000000}, {0x00000000} }, /* asHp */ + {{0x00000000} }, /* asRc */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asLout1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {MCDRV_ASRC_DAC1_R_ON} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* incommunication2 (analog input, analog output) */ + { + {{MCDRV_D1SRC_VBOXREFOUT_ON}, + {MCDRV_D1SRC_VBOXREFOUT_ON} }, /* asMusicOut */ + {{0x00000000}, {0x00000000} }, /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_ADIF2_ON}, + {MCDRV_D1SRC_MUSICIN_ON} }, /* asVboxMixIn */ + {{0x00000000}, {0x00000000} }, /* asAe0 */ + {{MCDRV_D1SRC_ADIF1_ON}, + {MCDRV_D1SRC_ADIF1_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_MUSICIN_ON} }, /* asDac0 */ + {{MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_MUSICIN_ON} }, /* asDac1 */ + {{0x00000000} }, /* asVoiceOut */ + {{0x00000000} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{MCDRV_D2SRC_ADC0_L_ON}, + {MCDRV_D2SRC_ADC0_R_ON} }, /* asAdif1 */ + {{MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON}, + {MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON} }, + /* asAdif2 */ + {{MCDRV_ASRC_MIC1_ON + |MCDRV_ASRC_MIC2_ON + |MCDRV_ASRC_MIC3_ON + |MCDRV_ASRC_MIC4_ON}, + {MCDRV_ASRC_MIC1_ON + |MCDRV_ASRC_MIC2_ON + |MCDRV_ASRC_MIC3_ON + |MCDRV_ASRC_MIC4_ON} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {0x00000000} }, /* asSp */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asHp */ + {{MCDRV_ASRC_DAC0_L_ON} }, /* asRc */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asLout1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {MCDRV_ASRC_DAC1_R_ON} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* incommunication2 (BT input, BT output) */ + { + {{MCDRV_D1SRC_VBOXREFOUT_ON}, + {MCDRV_D1SRC_VBOXREFOUT_ON} }, /* asMusicOut */ + {{MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_MUSICIN_ON} }, /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {0x00000000}, + {MCDRV_D1SRC_VBOXOUT_ON}, + {MCDRV_D1SRC_MUSICIN_ON} }, /* asVboxMixIn */ + {{0x00000000}, {0x00000000} }, /* asAe0 */ + {{MCDRV_D1SRC_EXTIN_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{0x00000000}, {0x00000000} }, /* asDac0 */ + {{0x00000000}, {0x00000000} }, /* asDac1 */ + {{0x00000000} }, /* asVoiceOut */ + {{0x00000000} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{0x00000000}, {0x00000000} }, /* asAdif1 */ + {{0x00000000}, {0x00000000} }, /* asAdif2 */ + {{0x00000000}, {0x00000000} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{0x00000000}, {0x00000000} }, /* asSp */ + {{0x00000000}, {0x00000000} }, /* asHp */ + {{0x00000000} }, /* asRc */ + {{0x00000000}, {0x00000000} }, /* asLout1 */ + {{0x00000000}, {0x00000000} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* incommunication2 (BT input, analog+BT output) */ + { + {{MCDRV_D1SRC_VBOXREFOUT_ON}, + {MCDRV_D1SRC_VBOXREFOUT_ON} }, /* asMusicOut */ + {{MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_MUSICIN_ON} }, /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {0x00000000}, + {MCDRV_D1SRC_ADIF2_ON}, + {MCDRV_D1SRC_MUSICIN_ON} }, /* asVboxMixIn */ + {{0x00000000}, {0x00000000} }, /* asAe0 */ + {{MCDRV_D1SRC_EXTIN_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_MUSICIN_ON} }, /* asDac0 */ + {{MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_MUSICIN_ON} }, /* asDac1 */ + {{0x00000000} }, /* asVoiceOut */ + {{0x00000000} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{0x00000000}, {0x00000000} }, /* asAdif1 */ + {{MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON}, + {MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON} }, + /* asAdif2 */ + {{0x00000000}, {0x00000000} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {0x00000000} }, /* asSp */ + {{0x00000000}, {0x00000000} }, /* asHp */ + {{0x00000000} }, /* asRc */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asLout1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {MCDRV_ASRC_DAC1_R_ON} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:incall3, capture:incall (analog input, analog output) */ + { + {{0x00000000}, {0x00000000} }, /* asMusicOut */ + {{MCDRV_D1SRC_VBOXREFOUT_ON}, + {MCDRV_D1SRC_VBOXREFOUT_ON} }, /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_ADIF2_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asVboxMixIn */ + {{0x00000000}, {0x00000000} }, /* asAe0 */ + {{MCDRV_D1SRC_ADIF1_ON}, + {MCDRV_D1SRC_ADIF1_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{MCDRV_D1SRC_VBOXOUT_ON}, + {MCDRV_D1SRC_VBOXOUT_ON} }, /* asDac0 */ + {{MCDRV_D1SRC_VBOXOUT_ON}, + {MCDRV_D1SRC_VBOXOUT_ON} }, /* asDac1 */ + {{0x00000000} }, /* asVoiceOut */ + {{0x00000000} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{MCDRV_D2SRC_ADC0_L_ON}, + {MCDRV_D2SRC_ADC0_R_ON} }, /* asAdif1 */ + {{MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON}, + {MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON} }, + /* asAdif2 */ + {{MCDRV_ASRC_MIC1_ON + |MCDRV_ASRC_MIC2_ON + |MCDRV_ASRC_MIC3_ON + |MCDRV_ASRC_MIC4_ON}, + {MCDRV_ASRC_MIC1_ON + |MCDRV_ASRC_MIC2_ON + |MCDRV_ASRC_MIC3_ON + |MCDRV_ASRC_MIC4_ON} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {0x00000000} }, /* asSp */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asHp */ + {{MCDRV_ASRC_DAC0_L_ON} }, /* asRc */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asLout1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {MCDRV_ASRC_DAC1_R_ON} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:incall3, capture:incall (BT input, BT output) */ + { + {{0x00000000}, {0x00000000} }, /* asMusicOut */ + {{MCDRV_D1SRC_VBOXOUT_ON}, + {MCDRV_D1SRC_VBOXOUT_ON} }, /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {0x00000000}, + {MCDRV_D1SRC_VBOXOUT_ON}, + {0x00000000} }, /* asVboxMixIn */ + {{0x00000000}, {0x00000000} }, /* asAe0 */ + {{MCDRV_D1SRC_EXTIN_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{0x00000000}, {0x00000000} }, /* asDac0 */ + {{0x00000000}, {0x00000000} }, /* asDac1 */ + {{MCDRV_D2SRC_VBOXIOOUT_ON} }, /* asVoiceOut */ + {{MCDRV_D2SRC_VOICEIN_ON} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{0x00000000}, {0x00000000} }, /* asAdif1 */ + {{0x00000000}, {0x00000000} }, /* asAdif2 */ + {{0x00000000}, {0x00000000} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{0x00000000}, {0x00000000} }, /* asSp */ + {{0x00000000}, {0x00000000} }, /* asHp */ + {{0x00000000} }, /* asRc */ + {{0x00000000}, {0x00000000} }, /* asLout1 */ + {{0x00000000}, {0x00000000} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:incall3, capture:incall (BT input, analog+BT output) */ + { + {{0x00000000}, {0x00000000} }, /* asMusicOut */ + {{MCDRV_D1SRC_VBOXOUT_ON}, + {MCDRV_D1SRC_VBOXOUT_ON} }, /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {0x00000000}, + {MCDRV_D1SRC_ADIF2_ON}, + {0x00000000} }, /* asVboxMixIn */ + {{0x00000000}, {0x00000000} }, /* asAe0 */ + {{MCDRV_D1SRC_EXTIN_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{MCDRV_D1SRC_VBOXOUT_ON}, + {MCDRV_D1SRC_VBOXOUT_ON} }, /* asDac0 */ + {{MCDRV_D1SRC_VBOXOUT_ON}, + {MCDRV_D1SRC_VBOXOUT_ON} }, /* asDac1 */ + {{MCDRV_D2SRC_VBOXIOOUT_ON} }, /* asVoiceOut */ + {{MCDRV_D2SRC_VOICEIN_ON} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{0x00000000}, {0x00000000} }, /* asAdif1 */ + {{MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON}, + {MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON} }, + /* asAdif2 */ + {{0x00000000}, {0x00000000} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {0x00000000} }, /* asSp */ + {{0x00000000}, {0x00000000} }, /* asHp */ + {{0x00000000} }, /* asRc */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asLout1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {MCDRV_ASRC_DAC1_R_ON} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:audio+incall3, capture:incall + (analog input analog output) */ + { + {{0x00000000}, {0x00000000} }, /* asMusicOut */ + {{MCDRV_D1SRC_VBOXREFOUT_ON}, + {MCDRV_D1SRC_VBOXREFOUT_ON} }, /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_ADIF2_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asVboxMixIn */ + {{0x00000000}, {0x00000000} }, /* asAe0 */ + {{MCDRV_D1SRC_ADIF1_ON}, + {MCDRV_D1SRC_ADIF1_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_MUSICIN_ON} }, /* asDac0 */ + {{MCDRV_D1SRC_VBOXOUT_ON}, + {MCDRV_D1SRC_VBOXOUT_ON} }, /* asDac1 */ + {{0x00000000} }, /* asVoiceOut */ + {{0x00000000} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{MCDRV_D2SRC_ADC0_L_ON}, + {MCDRV_D2SRC_ADC0_R_ON} }, /* asAdif1 */ + {{MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON}, + {MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON} }, + /* asAdif2 */ + {{MCDRV_ASRC_MIC1_ON + |MCDRV_ASRC_MIC2_ON + |MCDRV_ASRC_MIC3_ON + |MCDRV_ASRC_MIC4_ON}, + {MCDRV_ASRC_MIC1_ON + |MCDRV_ASRC_MIC2_ON + |MCDRV_ASRC_MIC3_ON + |MCDRV_ASRC_MIC4_ON} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {0x00000000} }, /* asSp */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asHp */ + {{MCDRV_ASRC_DAC0_L_ON} }, /* asRc */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asLout1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {MCDRV_ASRC_DAC1_R_ON} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:audio+incall3, capture:incall (BT input BT output) */ + { + {{0x00000000}, {0x00000000} }, /* asMusicOut */ + {{MCDRV_D1SRC_VBOXOUT_ON|MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_VBOXOUT_ON|MCDRV_D1SRC_MUSICIN_ON} }, + /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {0x00000000}, + {MCDRV_D1SRC_VBOXOUT_ON}, + {0x00000000} }, /* asVboxMixIn */ + {{0x00000000}, {0x00000000} }, /* asAe0 */ + {{MCDRV_D1SRC_EXTIN_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{0x00000000}, {0x00000000} }, /* asDac0 */ + {{0x00000000}, {0x00000000} }, /* asDac1 */ + {{MCDRV_D2SRC_VBOXIOOUT_ON} }, /* asVoiceOut */ + {{MCDRV_D2SRC_VOICEIN_ON} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{0x00000000}, {0x00000000} }, /* asAdif1 */ + {{0x00000000}, {0x00000000} }, /* asAdif2 */ + {{0x00000000}, {0x00000000} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{0x00000000}, {0x00000000} }, /* asSp */ + {{0x00000000}, {0x00000000} }, /* asHp */ + {{0x00000000} }, /* asRc */ + {{0x00000000}, {0x00000000} }, /* asLout1 */ + {{0x00000000}, {0x00000000} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:audio+incall3, capture:incall (BT input analog+BT output) */ + { + {{0x00000000}, {0x00000000} }, /* asMusicOut */ + {{MCDRV_D1SRC_VBOXOUT_ON|MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_VBOXOUT_ON|MCDRV_D1SRC_MUSICIN_ON} }, + /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {0x00000000}, + {MCDRV_D1SRC_ADIF2_ON}, + {0x00000000} }, /* asVboxMixIn */ + {{0x00000000}, {0x00000000} }, /* asAe0 */ + {{MCDRV_D1SRC_EXTIN_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_MUSICIN_ON} }, /* asDac0 */ + {{MCDRV_D1SRC_VBOXOUT_ON}, + {MCDRV_D1SRC_VBOXOUT_ON} }, /* asDac1 */ + {{MCDRV_D2SRC_VBOXIOOUT_ON} }, /* asVoiceOut */ + {{MCDRV_D2SRC_VOICEIN_ON} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{0x00000000}, {0x00000000} }, /* asAdif1 */ + {{MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON}, + {MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON} }, + /* asAdif2 */ + {{0x00000000}, {0x00000000} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {0x00000000} }, /* asSp */ + {{0x00000000}, {0x00000000} }, /* asHp */ + {{0x00000000} }, /* asRc */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asLout1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {MCDRV_ASRC_DAC1_R_ON} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:incall3, capture:audio+incall + (analog input, analog output) */ + { + {{MCDRV_D1SRC_VBOXREFOUT_ON}, + {MCDRV_D1SRC_VBOXREFOUT_ON} }, /* asMusicOut */ + {{MCDRV_D1SRC_VBOXREFOUT_ON}, + {MCDRV_D1SRC_VBOXREFOUT_ON} }, /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_ADIF2_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asVboxMixIn */ + {{0x00000000}, {0x00000000} }, /* asAe0 */ + {{MCDRV_D1SRC_ADIF1_ON}, + {MCDRV_D1SRC_ADIF1_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{MCDRV_D1SRC_VBOXOUT_ON}, + {MCDRV_D1SRC_VBOXOUT_ON} }, /* asDac0 */ + {{MCDRV_D1SRC_VBOXOUT_ON}, + {MCDRV_D1SRC_VBOXOUT_ON} }, /* asDac1 */ + {{0x00000000} }, /* asVoiceOut */ + {{0x00000000} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{MCDRV_D2SRC_ADC0_L_ON}, + {MCDRV_D2SRC_ADC0_R_ON} }, /* asAdif1 */ + {{MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON}, + {MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON} }, + /* asAdif2 */ + {{MCDRV_ASRC_MIC1_ON + |MCDRV_ASRC_MIC2_ON + |MCDRV_ASRC_MIC3_ON + |MCDRV_ASRC_MIC4_ON}, + {MCDRV_ASRC_MIC1_ON + |MCDRV_ASRC_MIC2_ON + |MCDRV_ASRC_MIC3_ON + |MCDRV_ASRC_MIC4_ON} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {0x00000000} }, /* asSp */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asHp */ + {{MCDRV_ASRC_DAC0_L_ON} }, /* asRc */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asLout1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {MCDRV_ASRC_DAC1_R_ON} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:incall3, capture:audio+incall (BT input, BT output) */ + { + {{MCDRV_D1SRC_VBOXREFOUT_ON}, + {MCDRV_D1SRC_VBOXREFOUT_ON} }, /* asMusicOut */ + {{MCDRV_D1SRC_VBOXOUT_ON|MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_VBOXOUT_ON|MCDRV_D1SRC_MUSICIN_ON} }, + /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {0x00000000}, + {MCDRV_D1SRC_VBOXOUT_ON}, + {0x00000000} }, /* asVboxMixIn */ + {{0x00000000}, {0x00000000} }, /* asAe0 */ + {{MCDRV_D1SRC_EXTIN_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{0x00000000}, {0x00000000} }, /* asDac0 */ + {{0x00000000}, {0x00000000} }, /* asDac1 */ + {{MCDRV_D2SRC_VBOXIOOUT_ON} }, /* asVoiceOut */ + {{MCDRV_D2SRC_VOICEIN_ON} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{0x00000000}, {0x00000000} }, /* asAdif1 */ + {{0x00000000}, {0x00000000} }, /* asAdif2 */ + {{0x00000000}, {0x00000000} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{0x00000000}, {0x00000000} }, /* asSp */ + {{0x00000000}, {0x00000000} }, /* asHp */ + {{0x00000000} }, /* asRc */ + {{0x00000000}, {0x00000000} }, /* asLout1 */ + {{0x00000000}, {0x00000000} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:incall3, capture:audio+incall + (BT input, analog+BT output) */ + { + {{MCDRV_D1SRC_VBOXREFOUT_ON}, + {MCDRV_D1SRC_VBOXREFOUT_ON} }, /* asMusicOut */ + {{MCDRV_D1SRC_VBOXOUT_ON|MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_VBOXOUT_ON|MCDRV_D1SRC_MUSICIN_ON} }, + /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {0x00000000}, + {MCDRV_D1SRC_ADIF2_ON}, + {0x00000000} }, /* asVboxMixIn */ + {{0x00000000}, {0x00000000} }, /* asAe0 */ + {{MCDRV_D1SRC_EXTIN_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{MCDRV_D1SRC_VBOXOUT_ON}, + {MCDRV_D1SRC_VBOXOUT_ON} }, /* asDac0 */ + {{MCDRV_D1SRC_VBOXOUT_ON}, + {MCDRV_D1SRC_VBOXOUT_ON} }, /* asDac1 */ + {{MCDRV_D2SRC_VBOXIOOUT_ON} }, /* asVoiceOut */ + {{MCDRV_D2SRC_VOICEIN_ON} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{0x00000000}, {0x00000000} }, /* asAdif1 */ + {{MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON}, + {MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON} }, + /* asAdif2 */ + {{0x00000000}, {0x00000000} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {0x00000000} }, /* asSp */ + {{0x00000000}, {0x00000000} }, /* asHp */ + {{0x00000000} }, /* asRc */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asLout1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {MCDRV_ASRC_DAC1_R_ON} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:audio+incall3, capture:audio+incall + (analog input, analog output) */ + { + {{MCDRV_D1SRC_VBOXREFOUT_ON}, + {MCDRV_D1SRC_VBOXREFOUT_ON} }, /* asMusicOut */ + {{MCDRV_D1SRC_VBOXREFOUT_ON}, + {MCDRV_D1SRC_VBOXREFOUT_ON} }, /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_ADIF2_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asVboxMixIn */ + {{0x00000000}, {0x00000000} }, /* asAe0 */ + {{MCDRV_D1SRC_ADIF1_ON}, + {MCDRV_D1SRC_ADIF1_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_MUSICIN_ON} }, /* asDac0 */ + {{MCDRV_D1SRC_VBOXOUT_ON}, + {MCDRV_D1SRC_VBOXOUT_ON} }, /* asDac1 */ + {{0x00000000} }, /* asVoiceOut */ + {{0x00000000} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{MCDRV_D2SRC_ADC0_L_ON}, + {MCDRV_D2SRC_ADC0_R_ON} }, /* asAdif1 */ + {{MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON}, + {MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON} }, + /* asAdif2 */ + {{MCDRV_ASRC_MIC1_ON + |MCDRV_ASRC_MIC2_ON + |MCDRV_ASRC_MIC3_ON + |MCDRV_ASRC_MIC4_ON}, + {MCDRV_ASRC_MIC1_ON + |MCDRV_ASRC_MIC2_ON + |MCDRV_ASRC_MIC3_ON + |MCDRV_ASRC_MIC4_ON} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {0x00000000} }, /* asSp */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asHp */ + {{MCDRV_ASRC_DAC0_L_ON} }, /* asRc */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asLout1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {MCDRV_ASRC_DAC1_R_ON} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:audio+incall3, capture:audio+incall (BT input, BT output) */ + { + {{MCDRV_D1SRC_VBOXREFOUT_ON}, + {MCDRV_D1SRC_VBOXREFOUT_ON} }, /* asMusicOut */ + {{MCDRV_D1SRC_VBOXOUT_ON|MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_VBOXOUT_ON|MCDRV_D1SRC_MUSICIN_ON} }, + /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {0x00000000}, + {MCDRV_D1SRC_VBOXOUT_ON}, + {0x00000000} }, /* asVboxMixIn */ + {{0x00000000}, {0x00000000} }, /* asAe0 */ + {{MCDRV_D1SRC_EXTIN_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{0x00000000}, {0x00000000} }, /* asDac0 */ + {{0x00000000}, {0x00000000} }, /* asDac1 */ + {{MCDRV_D2SRC_VBOXIOOUT_ON} }, /* asVoiceOut */ + {{MCDRV_D2SRC_VOICEIN_ON} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{0x00000000}, {0x00000000} }, /* asAdif1 */ + {{0x00000000}, {0x00000000} }, /* asAdif2 */ + {{0x00000000}, {0x00000000} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{0x00000000}, {0x00000000} }, /* asSp */ + {{0x00000000}, {0x00000000} }, /* asHp */ + {{0x00000000} }, /* asRc */ + {{0x00000000}, {0x00000000} }, /* asLout1 */ + {{0x00000000}, {0x00000000} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:audio+incall3, capture:audio+incall + (BT input, analog+BT output) */ + { + {{MCDRV_D1SRC_VBOXREFOUT_ON}, + {MCDRV_D1SRC_VBOXREFOUT_ON} }, /* asMusicOut */ + {{MCDRV_D1SRC_VBOXOUT_ON|MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_VBOXOUT_ON|MCDRV_D1SRC_MUSICIN_ON} }, + /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {0x00000000}, + {MCDRV_D1SRC_ADIF2_ON}, + {0x00000000} }, /* asVboxMixIn */ + {{0x00000000}, {0x00000000} }, /* asAe0 */ + {{MCDRV_D1SRC_EXTIN_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_MUSICIN_ON} }, /* asDac0 */ + {{MCDRV_D1SRC_VBOXOUT_ON}, + {MCDRV_D1SRC_VBOXOUT_ON} }, /* asDac1 */ + {{MCDRV_D2SRC_VBOXIOOUT_ON} }, /* asVoiceOut */ + {{MCDRV_D2SRC_VOICEIN_ON} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{0x00000000}, {0x00000000} }, /* asAdif1 */ + {{MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON}, + {MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON} }, + /* asAdif2 */ + {{0x00000000}, {0x00000000} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {0x00000000} }, /* asSp */ + {{0x00000000}, {0x00000000} }, /* asHp */ + {{0x00000000} }, /* asRc */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asLout1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {MCDRV_ASRC_DAC1_R_ON} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:incall4, capture:incall (analog input, analog output) */ + { + {{0x00000000}, {0x00000000} }, /* asMusicOut */ + {{MCDRV_D1SRC_VBOXREFOUT_ON}, + {MCDRV_D1SRC_VBOXREFOUT_ON} }, /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_ADIF2_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asVboxMixIn */ + {{0x00000000}, {0x00000000} }, /* asAe0 */ + {{MCDRV_D1SRC_ADIF1_ON}, + {MCDRV_D1SRC_ADIF1_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{MCDRV_D1SRC_EXTIN_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asDac0 */ + {{MCDRV_D1SRC_EXTIN_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asDac1 */ + {{0x00000000} }, /* asVoiceOut */ + {{0x00000000} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{MCDRV_D2SRC_ADC0_L_ON}, + {MCDRV_D2SRC_ADC0_R_ON} }, /* asAdif1 */ + {{MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON}, + {MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON} }, + /* asAdif2 */ + {{MCDRV_ASRC_MIC1_ON + |MCDRV_ASRC_MIC2_ON + |MCDRV_ASRC_MIC3_ON + |MCDRV_ASRC_MIC4_ON}, + {MCDRV_ASRC_MIC1_ON + |MCDRV_ASRC_MIC2_ON + |MCDRV_ASRC_MIC3_ON + |MCDRV_ASRC_MIC4_ON} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {0x00000000} }, /* asSp */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asHp */ + {{MCDRV_ASRC_DAC0_L_ON} }, /* asRc */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asLout1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {MCDRV_ASRC_DAC1_R_ON} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:incall4, capture:incall (BT input, BT output) */ + { + {{0x00000000}, {0x00000000} }, /* asMusicOut */ + {{MCDRV_D1SRC_VBOXOUT_ON}, + {MCDRV_D1SRC_VBOXOUT_ON} }, /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {0x00000000}, + {MCDRV_D1SRC_VBOXOUT_ON}, + {0x00000000} }, /* asVboxMixIn */ + {{0x00000000}, {0x00000000} }, /* asAe0 */ + {{MCDRV_D1SRC_EXTIN_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{0x00000000}, {0x00000000} }, /* asDac0 */ + {{0x00000000}, {0x00000000} }, /* asDac1 */ + {{MCDRV_D2SRC_VBOXIOOUT_ON} }, /* asVoiceOut */ + {{MCDRV_D2SRC_VOICEIN_ON} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{0x00000000}, {0x00000000} }, /* asAdif1 */ + {{0x00000000}, {0x00000000} }, /* asAdif2 */ + {{0x00000000}, {0x00000000} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{0x00000000}, {0x00000000} }, /* asSp */ + {{0x00000000}, {0x00000000} }, /* asHp */ + {{0x00000000} }, /* asRc */ + {{0x00000000}, {0x00000000} }, /* asLout1 */ + {{0x00000000}, {0x00000000} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:incall4, capture:incall (BT input, analog+BT output) */ + { + {{0x00000000}, {0x00000000} }, /* asMusicOut */ + {{MCDRV_D1SRC_VBOXOUT_ON}, + {MCDRV_D1SRC_VBOXOUT_ON} }, /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {0x00000000}, + {MCDRV_D1SRC_ADIF2_ON}, + {0x00000000} }, /* asVboxMixIn */ + {{0x00000000}, {0x00000000} }, /* asAe0 */ + {{MCDRV_D1SRC_EXTIN_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{MCDRV_D1SRC_EXTIN_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asDac0 */ + {{MCDRV_D1SRC_EXTIN_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asDac1 */ + {{MCDRV_D2SRC_VBOXIOOUT_ON} }, /* asVoiceOut */ + {{MCDRV_D2SRC_VOICEIN_ON} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{0x00000000}, {0x00000000} }, /* asAdif1 */ + {{MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON}, + {MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON} }, + /* asAdif2 */ + {{0x00000000}, {0x00000000} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {0x00000000} }, /* asSp */ + {{0x00000000}, {0x00000000} }, /* asHp */ + {{0x00000000} }, /* asRc */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asLout1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {MCDRV_ASRC_DAC1_R_ON} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:audio+incall4, capture:incall + (analog input analog output) */ + { + {{0x00000000}, {0x00000000} }, /* asMusicOut */ + {{MCDRV_D1SRC_VBOXREFOUT_ON}, + {MCDRV_D1SRC_VBOXREFOUT_ON} }, /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_ADIF2_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asVboxMixIn */ + {{0x00000000}, {0x00000000} }, /* asAe0 */ + {{MCDRV_D1SRC_ADIF1_ON}, + {MCDRV_D1SRC_ADIF1_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_MUSICIN_ON} }, /* asDac0 */ + {{MCDRV_D1SRC_EXTIN_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asDac1 */ + {{0x00000000} }, /* asVoiceOut */ + {{0x00000000} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{MCDRV_D2SRC_ADC0_L_ON}, + {MCDRV_D2SRC_ADC0_R_ON} }, /* asAdif1 */ + {{MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON}, + {MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON} }, + /* asAdif2 */ + {{MCDRV_ASRC_MIC1_ON + |MCDRV_ASRC_MIC2_ON + |MCDRV_ASRC_MIC3_ON + |MCDRV_ASRC_MIC4_ON}, + {MCDRV_ASRC_MIC1_ON + |MCDRV_ASRC_MIC2_ON + |MCDRV_ASRC_MIC3_ON + |MCDRV_ASRC_MIC4_ON} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {0x00000000} }, /* asSp */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asHp */ + {{MCDRV_ASRC_DAC0_L_ON} }, /* asRc */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asLout1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {MCDRV_ASRC_DAC1_R_ON} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:audio+incall4, capture:incall (BT input BT output) */ + { + {{0x00000000}, {0x00000000} }, /* asMusicOut */ + {{MCDRV_D1SRC_VBOXOUT_ON|MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_VBOXOUT_ON|MCDRV_D1SRC_MUSICIN_ON} }, + /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {0x00000000}, + {MCDRV_D1SRC_VBOXOUT_ON}, + {0x00000000} }, /* asVboxMixIn */ + {{0x00000000}, {0x00000000} }, /* asAe0 */ + {{MCDRV_D1SRC_EXTIN_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{0x00000000}, {0x00000000} }, /* asDac0 */ + {{0x00000000}, {0x00000000} }, /* asDac1 */ + {{MCDRV_D2SRC_VBOXIOOUT_ON} }, /* asVoiceOut */ + {{MCDRV_D2SRC_VOICEIN_ON} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{0x00000000}, {0x00000000} }, /* asAdif1 */ + {{0x00000000}, {0x00000000} }, /* asAdif2 */ + {{0x00000000}, {0x00000000} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{0x00000000}, {0x00000000} }, /* asSp */ + {{0x00000000}, {0x00000000} }, /* asHp */ + {{0x00000000} }, /* asRc */ + {{0x00000000}, {0x00000000} }, /* asLout1 */ + {{0x00000000}, {0x00000000} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:audio+incall4, capture:incall + (BT input analog+BT output) */ + { + {{0x00000000}, {0x00000000} }, /* asMusicOut */ + {{MCDRV_D1SRC_VBOXOUT_ON|MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_VBOXOUT_ON|MCDRV_D1SRC_MUSICIN_ON} }, + /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {0x00000000}, + {MCDRV_D1SRC_ADIF2_ON}, + {0x00000000} }, /* asVboxMixIn */ + {{0x00000000}, {0x00000000} }, /* asAe0 */ + {{MCDRV_D1SRC_EXTIN_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_MUSICIN_ON} }, /* asDac0 */ + {{MCDRV_D1SRC_EXTIN_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asDac1 */ + {{MCDRV_D2SRC_VBOXIOOUT_ON} }, /* asVoiceOut */ + {{MCDRV_D2SRC_VOICEIN_ON} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{0x00000000}, {0x00000000} }, /* asAdif1 */ + {{MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON}, + {MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON} }, + /* asAdif2 */ + {{0x00000000}, {0x00000000} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {0x00000000} }, /* asSp */ + {{0x00000000}, {0x00000000} }, /* asHp */ + {{0x00000000} }, /* asRc */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asLout1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {MCDRV_ASRC_DAC1_R_ON} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:incall4, capture:audio+incall + (analog input, analog output) */ + { + {{MCDRV_D1SRC_VBOXREFOUT_ON}, + {MCDRV_D1SRC_VBOXREFOUT_ON} }, /* asMusicOut */ + {{MCDRV_D1SRC_VBOXREFOUT_ON}, + {MCDRV_D1SRC_VBOXREFOUT_ON} }, /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_ADIF2_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asVboxMixIn */ + {{0x00000000}, {0x00000000} }, /* asAe0 */ + {{MCDRV_D1SRC_ADIF1_ON}, + {MCDRV_D1SRC_ADIF1_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{MCDRV_D1SRC_EXTIN_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asDac0 */ + {{MCDRV_D1SRC_EXTIN_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asDac1 */ + {{0x00000000} }, /* asVoiceOut */ + {{0x00000000} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{MCDRV_D2SRC_ADC0_L_ON}, + {MCDRV_D2SRC_ADC0_R_ON} }, /* asAdif1 */ + {{MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON}, + {MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON} }, + /* asAdif2 */ + {{MCDRV_ASRC_MIC1_ON + |MCDRV_ASRC_MIC2_ON + |MCDRV_ASRC_MIC3_ON + |MCDRV_ASRC_MIC4_ON}, + {MCDRV_ASRC_MIC1_ON + |MCDRV_ASRC_MIC2_ON + |MCDRV_ASRC_MIC3_ON + |MCDRV_ASRC_MIC4_ON} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {0x00000000} }, /* asSp */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asHp */ + {{MCDRV_ASRC_DAC0_L_ON} }, /* asRc */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asLout1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {MCDRV_ASRC_DAC1_R_ON} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:incall4, capture:audio+incall (BT input, BT output) */ + { + {{MCDRV_D1SRC_VBOXREFOUT_ON}, + {MCDRV_D1SRC_VBOXREFOUT_ON} }, /* asMusicOut */ + {{MCDRV_D1SRC_VBOXOUT_ON|MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_VBOXOUT_ON|MCDRV_D1SRC_MUSICIN_ON} }, + /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {0x00000000}, + {MCDRV_D1SRC_VBOXOUT_ON}, + {0x00000000} }, /* asVboxMixIn */ + {{0x00000000}, {0x00000000} }, /* asAe0 */ + {{MCDRV_D1SRC_EXTIN_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{0x00000000}, {0x00000000} }, /* asDac0 */ + {{0x00000000}, {0x00000000} }, /* asDac1 */ + {{MCDRV_D2SRC_VBOXIOOUT_ON} }, /* asVoiceOut */ + {{MCDRV_D2SRC_VOICEIN_ON} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{0x00000000}, {0x00000000} }, /* asAdif1 */ + {{0x00000000}, {0x00000000} }, /* asAdif2 */ + {{0x00000000}, {0x00000000} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{0x00000000}, {0x00000000} }, /* asSp */ + {{0x00000000}, {0x00000000} }, /* asHp */ + {{0x00000000} }, /* asRc */ + {{0x00000000}, {0x00000000} }, /* asLout1 */ + {{0x00000000}, {0x00000000} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:incall4, capture:audio+incall + (BT input, analog+BT output) */ + { + {{MCDRV_D1SRC_VBOXREFOUT_ON}, + {MCDRV_D1SRC_VBOXREFOUT_ON} }, /* asMusicOut */ + {{MCDRV_D1SRC_VBOXOUT_ON|MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_VBOXOUT_ON|MCDRV_D1SRC_MUSICIN_ON} }, + /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {0x00000000}, + {MCDRV_D1SRC_ADIF2_ON}, + {0x00000000} }, /* asVboxMixIn */ + {{0x00000000}, {0x00000000} }, /* asAe0 */ + {{MCDRV_D1SRC_EXTIN_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{MCDRV_D1SRC_EXTIN_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asDac0 */ + {{MCDRV_D1SRC_EXTIN_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asDac1 */ + {{MCDRV_D2SRC_VBOXIOOUT_ON} }, /* asVoiceOut */ + {{MCDRV_D2SRC_VOICEIN_ON} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{0x00000000}, {0x00000000} }, /* asAdif1 */ + {{MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON}, + {MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON} }, + /* asAdif2 */ + {{0x00000000}, {0x00000000} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {0x00000000} }, /* asSp */ + {{0x00000000}, {0x00000000} }, /* asHp */ + {{0x00000000} }, /* asRc */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asLout1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {MCDRV_ASRC_DAC1_R_ON} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:audio+incall4, capture:audio+incall + (analog input, analog output) */ + { + {{MCDRV_D1SRC_VBOXREFOUT_ON}, + {MCDRV_D1SRC_VBOXREFOUT_ON} }, /* asMusicOut */ + {{MCDRV_D1SRC_VBOXREFOUT_ON}, + {MCDRV_D1SRC_VBOXREFOUT_ON} }, /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_AE1_ON}, + {MCDRV_D1SRC_ADIF2_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asVboxMixIn */ + {{0x00000000}, {0x00000000} }, /* asAe0 */ + {{MCDRV_D1SRC_ADIF1_ON}, + {MCDRV_D1SRC_ADIF1_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_MUSICIN_ON} }, /* asDac0 */ + {{MCDRV_D1SRC_EXTIN_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asDac1 */ + {{0x00000000} }, /* asVoiceOut */ + {{0x00000000} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{MCDRV_D2SRC_ADC0_L_ON}, + {MCDRV_D2SRC_ADC0_R_ON} }, /* asAdif1 */ + {{MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON}, + {MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON} }, + /* asAdif2 */ + {{MCDRV_ASRC_MIC1_ON + |MCDRV_ASRC_MIC2_ON + |MCDRV_ASRC_MIC3_ON + |MCDRV_ASRC_MIC4_ON}, + {MCDRV_ASRC_MIC1_ON + |MCDRV_ASRC_MIC2_ON + |MCDRV_ASRC_MIC3_ON + |MCDRV_ASRC_MIC4_ON} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {0x00000000} }, /* asSp */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asHp */ + {{MCDRV_ASRC_DAC0_L_ON} }, /* asRc */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asLout1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {MCDRV_ASRC_DAC1_R_ON} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:audio+incall4, capture:audio+incall + (BT input, BT output) */ + { + {{MCDRV_D1SRC_VBOXREFOUT_ON}, + {MCDRV_D1SRC_VBOXREFOUT_ON} }, /* asMusicOut */ + {{MCDRV_D1SRC_VBOXOUT_ON|MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_VBOXOUT_ON|MCDRV_D1SRC_MUSICIN_ON} }, + /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {0x00000000}, + {MCDRV_D1SRC_VBOXOUT_ON}, + {0x00000000} }, /* asVboxMixIn */ + {{0x00000000}, {0x00000000} }, /* asAe0 */ + {{MCDRV_D1SRC_EXTIN_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{0x00000000}, {0x00000000} }, /* asDac0 */ + {{0x00000000}, {0x00000000} }, /* asDac1 */ + {{MCDRV_D2SRC_VBOXIOOUT_ON} }, /* asVoiceOut */ + {{MCDRV_D2SRC_VOICEIN_ON} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{0x00000000}, {0x00000000} }, /* asAdif1 */ + {{0x00000000}, {0x00000000} }, /* asAdif2 */ + {{0x00000000}, {0x00000000} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{0x00000000}, {0x00000000} }, /* asSp */ + {{0x00000000}, {0x00000000} }, /* asHp */ + {{0x00000000} }, /* asRc */ + {{0x00000000}, {0x00000000} }, /* asLout1 */ + {{0x00000000}, {0x00000000} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:audio+incall4, capture:audio+incall + (BT input, analog+BT output) */ + { + {{MCDRV_D1SRC_VBOXREFOUT_ON}, + {MCDRV_D1SRC_VBOXREFOUT_ON} }, /* asMusicOut */ + {{MCDRV_D1SRC_VBOXOUT_ON|MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_VBOXOUT_ON|MCDRV_D1SRC_MUSICIN_ON} }, + /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{MCDRV_D1SRC_AE1_ON}, + {0x00000000}, + {MCDRV_D1SRC_ADIF2_ON}, + {0x00000000} }, /* asVboxMixIn */ + {{0x00000000}, {0x00000000} }, /* asAe0 */ + {{MCDRV_D1SRC_EXTIN_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_MUSICIN_ON} }, /* asDac0 */ + {{MCDRV_D1SRC_EXTIN_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asDac1 */ + {{MCDRV_D2SRC_VBOXIOOUT_ON} }, /* asVoiceOut */ + {{MCDRV_D2SRC_VOICEIN_ON} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{MCDRV_D2SRC_VBOXHOSTOUT_ON} },/* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{0x00000000}, {0x00000000} }, /* asAdif1 */ + {{MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON}, + {MCDRV_D2SRC_DAC0REF_ON|MCDRV_D2SRC_DAC1REF_ON} }, + /* asAdif2 */ + {{0x00000000}, {0x00000000} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {0x00000000} }, /* asSp */ + {{0x00000000}, {0x00000000} }, /* asHp */ + {{0x00000000} }, /* asRc */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asLout1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {MCDRV_ASRC_DAC1_R_ON} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:audio, capture:audiolb (analog output) */ + { + {{MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_MUSICIN_ON} }, /* asMusicOut */ + {{0x00000000}, {0x00000000} }, /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} }, /* asVboxMixIn */ + {{MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_MUSICIN_ON} }, /* asAe0 */ + {{0x00000000}, {0x00000000} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{MCDRV_D1SRC_AE0_ON}, + {MCDRV_D1SRC_AE0_ON} }, /* asDac0 */ + {{MCDRV_D1SRC_AE0_ON}, + {MCDRV_D1SRC_AE0_ON} }, /* asDac1 */ + {{0x00000000} }, /* asVoiceOut */ + {{0x00000000} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{0x00000000} }, /* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{0x00000000}, {0x00000000} }, /* asAdif1 */ + {{0x00000000}, {0x00000000} }, /* asAdif2 */ + {{0x00000000}, {0x00000000} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {0x00000000} }, /* asSp */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asHp */ + {{MCDRV_ASRC_DAC0_L_ON} }, /* asRc */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asLout1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {MCDRV_ASRC_DAC1_R_ON} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:audio, capture:audiolb (BT output) */ + { + {{MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_MUSICIN_ON} }, /* asMusicOut */ + {{MCDRV_D1SRC_AE0_ON}, + {MCDRV_D1SRC_AE0_ON} }, /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} }, /* asVboxMixIn */ + {{MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_MUSICIN_ON} }, /* asAe0 */ + {{0x00000000}, {0x00000000} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{0x00000000}, {0x00000000} }, /* asDac0 */ + {{0x00000000}, {0x00000000} }, /* asDac1 */ + {{0x00000000} }, /* asVoiceOut */ + {{0x00000000} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{0x00000000} }, /* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{0x00000000}, {0x00000000} }, /* asAdif1 */ + {{0x00000000}, {0x00000000} }, /* asAdif2 */ + {{0x00000000}, {0x00000000} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{0x00000000}, {0x00000000} }, /* asSp */ + {{0x00000000}, {0x00000000} }, /* asHp */ + {{0x00000000} }, /* asRc */ + {{0x00000000}, {0x00000000} }, /* asLout1 */ + {{0x00000000}, {0x00000000} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:audio, capture:audiolb (analog+BT output) */ + { + {{MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_MUSICIN_ON} }, /* asMusicOut */ + {{MCDRV_D1SRC_AE0_ON}, + {MCDRV_D1SRC_AE0_ON} }, /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} }, /* asVboxMixIn */ + {{MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_MUSICIN_ON} }, /* asAe0 */ + {{0x00000000}, {0x00000000} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{MCDRV_D1SRC_AE0_ON}, + {MCDRV_D1SRC_AE0_ON} }, /* asDac0 */ + {{MCDRV_D1SRC_AE0_ON}, + {MCDRV_D1SRC_AE0_ON} }, /* asDac1 */ + {{0x00000000} }, /* asVoiceOut */ + {{0x00000000} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{0x00000000} }, /* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{0x00000000}, {0x00000000} }, /* asAdif1 */ + {{0x00000000}, {0x00000000} }, /* asAdif2 */ + {{0x00000000}, {0x00000000} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {0x00000000} }, /* asSp */ + {{0x00000000}, {0x00000000} }, /* asHp */ + {{0x00000000} }, /* asRc */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asLout1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {MCDRV_ASRC_DAC1_R_ON} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, + /* playback:audiocp, capture:off */ + { + {{0x00000000}, {0x00000000} }, /* asMusicOut */ + {{MCDRV_D1SRC_MUSICIN_ON}, + {MCDRV_D1SRC_MUSICIN_ON} }, /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} }, /* asVboxMixIn */ + {{0x00000000}, {0x00000000} }, /* asAe0 */ + {{0x00000000}, {0x00000000} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{0x00000000}, {0x00000000} }, /* asDac0 */ + {{0x00000000}, {0x00000000} }, /* asDac1 */ + {{0x00000000} }, /* asVoiceOut */ + {{0x00000000} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{0x00000000} }, /* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{0x00000000}, {0x00000000} }, /* asAdif1 */ + {{0x00000000}, {0x00000000} }, /* asAdif2 */ + {{0x00000000}, {0x00000000} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{0x00000000}, {0x00000000} }, /* asSp */ + {{0x00000000}, {0x00000000} }, /* asHp */ + {{0x00000000} }, /* asRc */ + {{0x00000000}, {0x00000000} }, /* asLout1 */ + {{0x00000000}, {0x00000000} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, +}; + + +static const struct MCDRV_PATH_INFO AnalogInputPath[] = { + { + {{0x00000000}, {0x00000000} }, /* asMusicOut */ + {{MCDRV_D1SRC_AE0_ON}, + {MCDRV_D1SRC_AE0_ON} }, /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} }, /* asVboxMixIn */ + {{MCDRV_D1SRC_ADIF1_ON}, + {MCDRV_D1SRC_ADIF1_ON} }, /* asAe0 */ + {{0x00000000}, {0x00000000} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{MCDRV_D1SRC_AE0_ON}, + {MCDRV_D1SRC_AE0_ON} }, /* asDac0 */ + {{MCDRV_D1SRC_AE0_ON}, + {MCDRV_D1SRC_AE0_ON} }, /* asDac1 */ + {{0x00000000} }, /* asVoiceOut */ + {{0x00000000} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{0x00000000} }, /* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{MCDRV_D2SRC_ADC0_L_ON}, + {MCDRV_D2SRC_ADC0_R_ON} }, /* asAdif1 */ + {{0x00000000}, {0x00000000} }, /* asAdif2 */ + {{MCDRV_ASRC_MIC1_ON + |MCDRV_ASRC_MIC2_ON + |MCDRV_ASRC_MIC3_ON + |MCDRV_ASRC_MIC4_ON + |MCDRV_ASRC_LINEIN1_L_ON}, + {MCDRV_ASRC_MIC1_ON + |MCDRV_ASRC_MIC2_ON + |MCDRV_ASRC_MIC3_ON + |MCDRV_ASRC_MIC4_ON + |MCDRV_ASRC_LINEIN1_R_ON} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {0x00000000} }, /* asSp */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asHp */ + {{MCDRV_ASRC_DAC0_L_ON} }, /* asRc */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asLout1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {MCDRV_ASRC_DAC1_R_ON} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + }, +}; +static const int AnalogPathMapping[PRESET_PATH_N] = { + 0, + 0, 0, 0, + 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + 0 +}; +static const struct MCDRV_PATH_INFO BtInputPath[] = { + { + {{0x00000000}, {0x00000000} }, /* asMusicOut */ + {{MCDRV_D1SRC_AE0_ON}, + {MCDRV_D1SRC_AE0_ON} }, /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} }, /* asVboxMixIn */ + {{MCDRV_D1SRC_EXTIN_ON}, + {MCDRV_D1SRC_EXTIN_ON} }, /* asAe0 */ + {{0x00000000}, {0x00000000} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{MCDRV_D1SRC_AE0_ON}, + {MCDRV_D1SRC_AE0_ON} }, /* asDac0 */ + {{MCDRV_D1SRC_AE0_ON}, + {MCDRV_D1SRC_AE0_ON} }, /* asDac1 */ + {{0x00000000} }, /* asVoiceOut */ + {{0x00000000} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{0x00000000} }, /* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{0x00000000}, {0x00000000} }, /* asAdif1 */ + {{0x00000000}, {0x00000000} }, /* asAdif2 */ + {{0x00000000}, {0x00000000} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {0x00000000} }, /* asSp */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asHp */ + {{MCDRV_ASRC_DAC0_L_ON} }, /* asRc */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asLout1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {MCDRV_ASRC_DAC1_R_ON} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + } +}; +static const int BtPathMapping[PRESET_PATH_N] = { + 0, + 0, 0, 0, + 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + 0 +}; +static const struct MCDRV_PATH_INFO DtmfPath[] = { + { + {{0x00000000}, {0x00000000} }, /* asMusicOut */ + {{MCDRV_D1SRC_AE0_ON}, + {MCDRV_D1SRC_AE0_ON} }, /* asExtOut */ + {{0x00000000} }, /* asHifiOut */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} }, /* asVboxMixIn */ + {{0x00000000}, {0x00000000} }, /* asAe0 */ + {{0x00000000}, {0x00000000} }, /* asAe1 */ + {{0x00000000}, {0x00000000} }, /* asAe2 */ + {{0x00000000}, {0x00000000} }, /* asAe3 */ + {{MCDRV_D1SRC_AE0_ON}, + {MCDRV_D1SRC_AE0_ON} }, /* asDac0 */ + {{MCDRV_D1SRC_AE0_ON}, + {MCDRV_D1SRC_AE0_ON} }, /* asDac1 */ + {{0x00000000} }, /* asVoiceOut */ + {{0x00000000} }, /* asVboxIoIn */ + {{0x00000000} }, /* asVboxHostIn */ + {{0x00000000} }, /* asHostOut */ + {{0x00000000}, {0x00000000} }, /* asAdif0 */ + {{0x00000000}, {0x00000000} }, /* asAdif1 */ + {{0x00000000}, {0x00000000} }, /* asAdif2 */ + {{0x00000000}, {0x00000000} }, /* asAdc0 */ + {{0x00000000} }, /* asAdc1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {0x00000000} }, /* asSp */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asHp */ + {{MCDRV_ASRC_DAC0_L_ON} }, /* asRc */ + {{MCDRV_ASRC_DAC0_L_ON}, + {MCDRV_ASRC_DAC0_R_ON} }, /* asLout1 */ + {{MCDRV_ASRC_DAC1_L_ON}, + {MCDRV_ASRC_DAC1_R_ON} }, /* asLout2 */ + {{0x00000000}, {0x00000000}, + {0x00000000}, {0x00000000} } /* asBias */ + } +}; +static const int DtmfPathMapping[PRESET_PATH_N] = { + 0, + 0, 0, 0, + 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + 0 +}; + +#endif diff --git a/sound/soc/codecs/ymu831/ymu831_priv.h b/sound/soc/codecs/ymu831/ymu831_priv.h new file mode 100644 index 00000000000..2088c05efe6 --- /dev/null +++ b/sound/soc/codecs/ymu831/ymu831_priv.h @@ -0,0 +1,354 @@ +/* + * YMU831 ASoC codec driver - private header + * + * Copyright (c) 2012-2013 Yamaha Corporation + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + */ + +#ifndef YMU831_PRIV_H +#define YMU831_PRIV_H + +#include <sound/soc.h> +#include "mcdriver.h" + +#undef MC_ASOC_TEST + +/* + * Virtual registers + */ +enum { + MC_ASOC_DVOL_MUSICIN, + MC_ASOC_DVOL_EXTIN, + MC_ASOC_DVOL_VOICEIN, + MC_ASOC_DVOL_REFIN, + MC_ASOC_DVOL_ADIF0IN, + MC_ASOC_DVOL_ADIF1IN, + MC_ASOC_DVOL_ADIF2IN, + MC_ASOC_DVOL_MUSICOUT, + MC_ASOC_DVOL_EXTOUT, + MC_ASOC_DVOL_VOICEOUT, + MC_ASOC_DVOL_REFOUT, + MC_ASOC_DVOL_DAC0OUT, + MC_ASOC_DVOL_DAC1OUT, + MC_ASOC_DVOL_DPATHDA, + MC_ASOC_DVOL_DPATHAD, + MC_ASOC_AVOL_LINEIN1, + MC_ASOC_AVOL_MIC1, + MC_ASOC_AVOL_MIC2, + MC_ASOC_AVOL_MIC3, + MC_ASOC_AVOL_MIC4, + MC_ASOC_AVOL_HP, + MC_ASOC_AVOL_SP, + MC_ASOC_AVOL_RC, + MC_ASOC_AVOL_LINEOUT1, + MC_ASOC_AVOL_LINEOUT2, + MC_ASOC_AVOL_SP_GAIN, + + MC_ASOC_DVOL_MASTER, + MC_ASOC_DVOL_VOICE, + MC_ASOC_DVOL_APLAY_A, + MC_ASOC_DVOL_APLAY_D, + + MC_ASOC_VOICE_RECORDING, + + MC_ASOC_AUDIO_MODE_PLAY, + MC_ASOC_AUDIO_MODE_CAP, + MC_ASOC_OUTPUT_PATH, + MC_ASOC_INPUT_PATH, + MC_ASOC_INCALL_MIC_SP, + MC_ASOC_INCALL_MIC_RC, + MC_ASOC_INCALL_MIC_HP, + MC_ASOC_INCALL_MIC_LO1, + MC_ASOC_INCALL_MIC_LO2, + + MC_ASOC_MAINMIC_PLAYBACK_PATH, + MC_ASOC_SUBMIC_PLAYBACK_PATH, + MC_ASOC_2MIC_PLAYBACK_PATH, + MC_ASOC_HSMIC_PLAYBACK_PATH, + MC_ASOC_BTMIC_PLAYBACK_PATH, + MC_ASOC_LIN1_PLAYBACK_PATH, + + MC_ASOC_DTMF_CONTROL, + MC_ASOC_DTMF_OUTPUT, + + MC_ASOC_SWITCH_CLOCK, + + MC_ASOC_EXT_MASTERSLAVE, + MC_ASOC_EXT_RATE, + MC_ASOC_EXT_BITCLOCK_RATE, + MC_ASOC_EXT_INTERFACE, + MC_ASOC_EXT_BITCLOCK_INVERT, + MC_ASOC_EXT_INPUT_DA_BIT_WIDTH, + MC_ASOC_EXT_INPUT_DA_FORMAT, + MC_ASOC_EXT_INPUT_PCM_MONOSTEREO, + MC_ASOC_EXT_INPUT_PCM_BIT_ORDER, + MC_ASOC_EXT_INPUT_PCM_FORMAT, + MC_ASOC_EXT_INPUT_PCM_BIT_WIDTH, + MC_ASOC_EXT_OUTPUT_DA_BIT_WIDTH, + MC_ASOC_EXT_OUTPUT_DA_FORMAT, + MC_ASOC_EXT_OUTPUT_PCM_MONOSTEREO, + MC_ASOC_EXT_OUTPUT_PCM_BIT_ORDER, + MC_ASOC_EXT_OUTPUT_PCM_FORMAT, + MC_ASOC_EXT_OUTPUT_PCM_BIT_WIDTH, + + MC_ASOC_VOICE_MASTERSLAVE, + MC_ASOC_VOICE_RATE, + MC_ASOC_VOICE_BITCLOCK_RATE, + MC_ASOC_VOICE_INTERFACE, + MC_ASOC_VOICE_BITCLOCK_INVERT, + MC_ASOC_VOICE_INPUT_DA_BIT_WIDTH, + MC_ASOC_VOICE_INPUT_DA_FORMAT, + MC_ASOC_VOICE_INPUT_PCM_MONOSTEREO, + MC_ASOC_VOICE_INPUT_PCM_BIT_ORDER, + MC_ASOC_VOICE_INPUT_PCM_FORMAT, + MC_ASOC_VOICE_INPUT_PCM_BIT_WIDTH, + MC_ASOC_VOICE_OUTPUT_DA_BIT_WIDTH, + MC_ASOC_VOICE_OUTPUT_DA_FORMAT, + MC_ASOC_VOICE_OUTPUT_PCM_MONOSTEREO, + MC_ASOC_VOICE_OUTPUT_PCM_BIT_ORDER, + MC_ASOC_VOICE_OUTPUT_PCM_FORMAT, + MC_ASOC_VOICE_OUTPUT_PCM_BIT_WIDTH, + + MC_ASOC_MUSIC_PHYSICAL_PORT, + MC_ASOC_EXT_PHYSICAL_PORT, + MC_ASOC_VOICE_PHYSICAL_PORT, + MC_ASOC_HIFI_PHYSICAL_PORT, + + MC_ASOC_ADIF0_SWAP, + MC_ASOC_ADIF1_SWAP, + MC_ASOC_ADIF2_SWAP, + + MC_ASOC_DAC0_SWAP, + MC_ASOC_DAC1_SWAP, + + MC_ASOC_MUSIC_OUT0_SWAP, + + MC_ASOC_MUSIC_IN0_SWAP, + MC_ASOC_MUSIC_IN1_SWAP, + MC_ASOC_MUSIC_IN2_SWAP, + + MC_ASOC_EXT_IN_SWAP, + + MC_ASOC_VOICE_IN_SWAP, + + MC_ASOC_MUSIC_OUT1_SWAP, + MC_ASOC_MUSIC_OUT2_SWAP, + + MC_ASOC_EXT_OUT_SWAP, + + MC_ASOC_VOICE_OUT_SWAP, + + MC_ASOC_ADIF0_SOURCE, + MC_ASOC_ADIF1_SOURCE, + MC_ASOC_ADIF2_SOURCE, + + MC_ASOC_DSP_PARAM, + MC_ASOC_DSP_PARAM_OPT, + MC_ASOC_CLEAR_DSP_PARAM, + + MC_ASOC_PLAYBACK_SCENARIO, + MC_ASOC_CAPTURE_SCENARIO, + + MC_ASOC_PARAMETER_SETTING, + + MC_ASOC_MAIN_MIC, + MC_ASOC_SUB_MIC, + MC_ASOC_HS_MIC, +#ifdef MC_ASOC_TEST + MC_ASOC_MIC1_BIAS, + MC_ASOC_MIC2_BIAS, + MC_ASOC_MIC3_BIAS, + MC_ASOC_MIC4_BIAS, +#endif + MC_ASOC_N_REG +}; +#define MC_ASOC_N_VOL_REG (MC_ASOC_DVOL_APLAY_D+1) + + +#define MC_ASOC_AUDIO_MODE_OFF (0) +#define MC_ASOC_AUDIO_MODE_AUDIO (1) +#define MC_ASOC_AUDIO_MODE_INCALL (2) +#define MC_ASOC_AUDIO_MODE_AUDIO_INCALL (3) +#define MC_ASOC_AUDIO_MODE_INCOMM (4) +#define MC_ASOC_AUDIO_MODE_KARAOKE (5) +#define MC_ASOC_AUDIO_MODE_INCALL2 (6) +#define MC_ASOC_AUDIO_MODE_AUDIO_INCALL2 (7) +#define MC_ASOC_AUDIO_MODE_INCOMM2 (8) +#define MC_ASOC_AUDIO_MODE_INCALL3 (9) +#define MC_ASOC_AUDIO_MODE_AUDIO_INCALL3 (10) +#define MC_ASOC_AUDIO_MODE_INCALL4 (11) +#define MC_ASOC_AUDIO_MODE_AUDIO_INCALL4 (12) +#define MC_ASOC_AUDIO_MODE_AUDIOCP (13) + +#define MC_ASOC_AUDIO_MODE_AUDIOEX (5) +#define MC_ASOC_AUDIO_MODE_AUDIOVR (6) +#define MC_ASOC_AUDIO_MODE_AUDIOLB (7) + +#define MC_ASOC_OUTPUT_PATH_SP (0) +#define MC_ASOC_OUTPUT_PATH_RC (1) +#define MC_ASOC_OUTPUT_PATH_HP (2) +#define MC_ASOC_OUTPUT_PATH_HS (3) +#define MC_ASOC_OUTPUT_PATH_LO1 (4) +#define MC_ASOC_OUTPUT_PATH_LO2 (5) +#define MC_ASOC_OUTPUT_PATH_BT (6) +#define MC_ASOC_OUTPUT_PATH_SP_RC (7) +#define MC_ASOC_OUTPUT_PATH_SP_HP (8) +#define MC_ASOC_OUTPUT_PATH_SP_LO1 (9) +#define MC_ASOC_OUTPUT_PATH_SP_LO2 (10) +#define MC_ASOC_OUTPUT_PATH_SP_BT (11) +#define MC_ASOC_OUTPUT_PATH_LO1_RC (12) +#define MC_ASOC_OUTPUT_PATH_LO1_HP (13) +#define MC_ASOC_OUTPUT_PATH_LO1_BT (14) +#define MC_ASOC_OUTPUT_PATH_LO2_RC (15) +#define MC_ASOC_OUTPUT_PATH_LO2_HP (16) +#define MC_ASOC_OUTPUT_PATH_LO2_BT (17) +#define MC_ASOC_OUTPUT_PATH_LO1_LO2 (18) +#define MC_ASOC_OUTPUT_PATH_LO2_LO1 (19) + +#define MC_ASOC_INPUT_PATH_MAINMIC (0) +#define MC_ASOC_INPUT_PATH_SUBMIC (1) +#define MC_ASOC_INPUT_PATH_2MIC (2) +#define MC_ASOC_INPUT_PATH_HS (3) +#define MC_ASOC_INPUT_PATH_BT (4) +#define MC_ASOC_INPUT_PATH_VOICECALL (5) +#define MC_ASOC_INPUT_PATH_VOICEUPLINK (6) +#define MC_ASOC_INPUT_PATH_VOICEDOWNLINK (7) +#define MC_ASOC_INPUT_PATH_LIN1 (8) + +#define MC_ASOC_INCALL_MIC_MAINMIC (0) +#define MC_ASOC_INCALL_MIC_SUBMIC (1) +#define MC_ASOC_INCALL_MIC_2MIC (2) + +#define MC_ASOC_DTMF_OUTPUT_SP (0) +#define MC_ASOC_DTMF_OUTPUT_NORMAL (1) + + +/* + * Driver private data structure + */ +struct mc_asoc_setup { + struct MCDRV_INIT_INFO init; + struct MCDRV_INIT2_INFO init2; + unsigned char rslot[3]; + unsigned char tslot[3]; +}; + +struct mc_asoc_port_params { + UINT8 rate; + UINT8 bits[SNDRV_PCM_STREAM_LAST+1]; + UINT8 pcm_mono[SNDRV_PCM_STREAM_LAST+1]; + UINT8 pcm_order[SNDRV_PCM_STREAM_LAST+1]; + UINT8 pcm_law[SNDRV_PCM_STREAM_LAST+1]; + UINT8 master; + UINT8 inv; + UINT8 srcthru; + UINT8 format; + UINT8 bckfs; + UINT8 channels; + UINT8 stream; /* bit0: Playback, bit1: Capture */ +}; + +struct mc_asoc_dsp_param { + UINT8 *pabParam; + UINT32 dSize; + struct mc_asoc_dsp_param *next; +}; + +struct mc_asoc_jack { + struct snd_soc_jack *hs_jack; +#ifdef CONFIG_SWITCH + struct switch_dev *h2w_sdev; +#endif +}; + +struct mc_asoc_platform_data { + void (*set_ext_micbias)(int en); + void (*set_codec_ldod)(int status); + void (*set_codec_mclk)(bool enable, bool forced); + int irq; +}; + +struct mc_asoc_data { + struct mutex mutex; + struct mc_asoc_setup setup; + struct mc_asoc_port_params port; + struct snd_hwdep *hwdep; + struct MCDRV_CLOCKSW_INFO clocksw_store; + struct MCDRV_PATH_INFO path_store; + struct MCDRV_VOL_INFO vol_store; + struct MCDRV_DIO_INFO dio_store; + struct MCDRV_DIOPATH_INFO diopath_store; + struct MCDRV_SWAP_INFO swap_store; + struct MCDRV_HSDET_INFO hsdet_store; + struct MCDRV_HSDET2_INFO hsdet2_store; + struct mc_asoc_dsp_param param_store[4][2]; + struct mc_asoc_jack jack; + struct mc_asoc_platform_data *pdata; + int (*penableclkfn)(struct snd_soc_codec *, int, bool); +}; + +struct mc_asoc_priv { + struct mc_asoc_data data; +}; + +extern void mc_asoc_write_data(UINT8 bSlaveAdr, + const UINT8 *pbData, + UINT32 dSize); +extern void mc_asoc_read_data(UINT8 bSlaveAdr, + UINT32 dAddress, + UINT8 *pbData, + UINT32 dSize); +extern void mc_asoc_set_codec_ldod(int status); +extern UINT8 mc_asoc_get_bus_select(void); +extern void mc_asoc_enable_clock(int enable); + + +/* + * For debugging + */ +#ifdef CONFIG_SND_SOC_YAMAHA_YMU831_DEBUG + +#define SHOW_REG_ACCESS +#define dbg_info(format, arg...) snd_printd(KERN_INFO format, ## arg) +#define TRACE_FUNC() snd_printd(KERN_INFO "<trace> %s()\n", __func__) +#define _McDrv_Ctrl McDrv_Ctrl_dbg + +extern SINT32 McDrv_Ctrl_dbg( + UINT32 dCmd, void *pvPrm1, void *pvPrm2, UINT32 dPrm); + +#else + +#ifdef CONFIG_SAMSUNG_PRODUCT_SHIP + +#define dbg_info(format, arg...) +#define TRACE_FUNC() +#define _McDrv_Ctrl McDrv_Ctrl + +#else + +#define dbg_info(format, arg...) printk(KERN_DEBUG "ymu831 " \ + format, ## arg) +#define TRACE_FUNC() printk(KERN_INFO "ymu831 %s\n", __func__) +#define _McDrv_Ctrl McDrv_Ctrl_dbg_sec + +extern SINT32 McDrv_Ctrl_dbg_sec( + UINT32 dCmd, void *pvPrm1, void *pvPrm2, UINT32 dPrm); +#endif +#endif /* CONFIG_SND_SOC_YAMAHA_YMU831_DEBUG */ + +#endif /* YMU831_PRIV_H */ |