static snd_pcm_uframes_t mtk_capture_pcm_pointer(struct snd_pcm_substream *substream) { kal_int32 HW_memory_index = 0; kal_int32 HW_Cur_ReadIdx = 0; //kal_uint32 Frameidx = 0; kal_int32 Hw_Get_bytes = 0; bool bIsOverflow = false; unsigned long flags; AFE_BLOCK_T *UL1_Block = &(VUL_Control_context->rBlock); PRINTK_AUD_UL1("mtk_capture_pcm_pointer Awb_Block->u4WriteIdx;= 0x%x \n", UL1_Block->u4WriteIdx); Auddrv_UL1_Spinlock_lock(); spin_lock_irqsave(&VUL_Control_context->substream_lock, flags); if (GetMemoryPathEnable(Soc_Aud_Digital_Block_MEM_VUL) == true) { HW_Cur_ReadIdx = Align64ByteSize(Afe_Get_Reg(AFE_VUL_CUR)); if (HW_Cur_ReadIdx == 0) { PRINTK_AUD_UL1("[Auddrv] mtk_awb_pcm_pointer HW_Cur_ReadIdx ==0 \n"); HW_Cur_ReadIdx = UL1_Block->pucPhysBufAddr; } HW_memory_index = (HW_Cur_ReadIdx - UL1_Block->pucPhysBufAddr); // update for data get to hardware Hw_Get_bytes = (HW_Cur_ReadIdx - UL1_Block->pucPhysBufAddr) - UL1_Block->u4WriteIdx; if (Hw_Get_bytes < 0) { Hw_Get_bytes += UL1_Block->u4BufferSize; } UL1_Block->u4WriteIdx += Hw_Get_bytes; UL1_Block->u4WriteIdx %= UL1_Block->u4BufferSize; UL1_Block->u4DataRemained += Hw_Get_bytes; // buffer overflow if (UL1_Block->u4DataRemained > UL1_Block->u4BufferSize) { bIsOverflow = true; printk("mtk_capture_pcm_pointer buffer overflow u4DMAReadIdx:%x, u4WriteIdx:%x, u4DataRemained:%x, u4BufferSize:%x \n", UL1_Block->u4DMAReadIdx, UL1_Block->u4WriteIdx, UL1_Block->u4DataRemained, UL1_Block->u4BufferSize); } PRINTK_AUD_UL1("[Auddrv] mtk_capture_pcm_pointer =0x%x HW_memory_index = 0x%x\n", HW_Cur_ReadIdx, HW_memory_index); spin_unlock_irqrestore(&VUL_Control_context->substream_lock, flags); Auddrv_UL1_Spinlock_unlock(); if (bIsOverflow == true) { return -1; } return audio_bytes_to_frame(substream, HW_memory_index); } spin_unlock_irqrestore(&VUL_Control_context->substream_lock, flags); Auddrv_UL1_Spinlock_unlock(); return 0; }
static int mtk_voice_md2_bt_pm_ops_resume(struct device *device) { bool b_modem1_speech_on; bool b_modem2_speech_on; AudDrv_Clk_On();//should enable clk for access reg b_modem1_speech_on = (bool)(Afe_Get_Reg(PCM2_INTF_CON) & 0x1); b_modem2_speech_on = (bool)(Afe_Get_Reg(PCM_INTF_CON) & 0x1); AudDrv_Clk_Off(); if (b_modem1_speech_on == true || b_modem2_speech_on == true) { #ifdef RAINIER_NEED_CHECK clkmux_sel(MT_MUX_AUDINTBUS, 1, "AUDIO"); //mainpll #endif return 0; } return 0; }
static int Audio_Irqcnt2_Get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { printk("Audio_Irqcnt2_Get \n"); AudDrv_Clk_On(); ucontrol->value.integer.value[0] = Afe_Get_Reg(AFE_IRQ_MCU_CNT2); AudDrv_Clk_Off(); return 0; }
//supend and resume function static int mtk_voice_md2_bt_pm_ops_suspend(struct device *device) { // if now in phone call state, not suspend!! bool b_modem1_speech_on; bool b_modem2_speech_on; AudDrv_Clk_On();//should enable clk for access reg b_modem1_speech_on = (bool)(Afe_Get_Reg(PCM2_INTF_CON) & 0x1); b_modem2_speech_on = (bool)(Afe_Get_Reg(PCM_INTF_CON) & 0x1); AudDrv_Clk_Off(); if (b_modem1_speech_on == true || b_modem2_speech_on == true) { #ifdef RAINIER_NEED_CHECK clkmux_sel(MT_MUX_AUDINTBUS, 0, "AUDIO"); //select 26M #endif return 0; } return 0; }
static void StartAudioI2S0AWBHardware(struct snd_pcm_substream *substream) { struct snd_pcm_runtime *runtime = substream->runtime; uint32 Audio_I2S_Dac = 0; uint32 MclkDiv0 = 0; const bool bEnablePhaseShiftFix = true; printk("StartAudioI2S0AWBHardware \n"); MclkDiv0 = SetCLkMclk(Soc_Aud_I2S0, runtime->rate); //select I2S SetCLkBclk(MclkDiv0, runtime->rate, runtime->channels, Soc_Aud_I2S_WLEN_WLEN_32BITS); // 2nd I2S In SetSampleRate(Soc_Aud_Digital_Block_MEM_I2S, runtime->rate); Audio_I2S_Dac |= (bEnablePhaseShiftFix << 31); Audio_I2S_Dac |= (Soc_Aud_I2S_IN_PAD_SEL_I2S_IN_FROM_IO_MUX << 28);//I2S in from io_mux Audio_I2S_Dac |= Soc_Aud_LOW_JITTER_CLOCK << 12 ; //Low jitter mode Audio_I2S_Dac |= (Soc_Aud_INV_LRCK_NO_INVERSE << 5); Audio_I2S_Dac |= (Soc_Aud_I2S_FORMAT_I2S << 3); Audio_I2S_Dac |= (Soc_Aud_I2S_WLEN_WLEN_32BITS << 1); Afe_Set_Reg(AFE_I2S_CON, Audio_I2S_Dac | 0x1, MASK_ALL); // here to set interrupt SetIrqMcuCounter(Soc_Aud_IRQ_MCU_MODE_IRQ2_MCU_MODE, substream->runtime->period_size >> 1); SetIrqMcuSampleRate(Soc_Aud_IRQ_MCU_MODE_IRQ2_MCU_MODE, substream->runtime->rate); SetIrqEnable(Soc_Aud_IRQ_MCU_MODE_IRQ2_MCU_MODE, true); SetSampleRate(Soc_Aud_Digital_Block_MEM_AWB, substream->runtime->rate); SetMemoryPathEnable(Soc_Aud_Digital_Block_MEM_AWB, true); SetMemoryPathEnable(Soc_Aud_Digital_Block_I2S_IN_2, true); // here to turn off digital part #ifdef DUMP_HWGAIN1_AWB uint32 REG420 = 0; SetConnection(Soc_Aud_InterCon_DisConnect, Soc_Aud_InterConnectionInput_I00, Soc_Aud_InterConnectionOutput_O05); SetConnection(Soc_Aud_InterCon_DisConnect, Soc_Aud_InterConnectionInput_I01, Soc_Aud_InterConnectionOutput_O06); printk("%s() Soc_Aud_InterCon_Connection I10 O5\n", __func__); SetConnection(Soc_Aud_InterCon_Connection, Soc_Aud_InterConnectionInput_I10, Soc_Aud_InterConnectionOutput_O05); printk("%s() Soc_Aud_InterCon_Connection I11 O6\n", __func__); SetConnection(Soc_Aud_InterCon_Connection, Soc_Aud_InterConnectionInput_I11, Soc_Aud_InterConnectionOutput_O06); REG420 = Afe_Get_Reg(AFE_GAIN1_CONN); printk("%s() AFE_GAIN1_CONN (0X420) =0x%x\n", __func__, REG420); #else SetConnection(Soc_Aud_InterCon_Connection, Soc_Aud_InterConnectionInput_I00, Soc_Aud_InterConnectionOutput_O05); SetConnection(Soc_Aud_InterCon_Connection, Soc_Aud_InterConnectionInput_I01, Soc_Aud_InterConnectionOutput_O06); #endif EnableAfe(true); }
static snd_pcm_uframes_t mtk_pcm_I2S0dl1_pointer(struct snd_pcm_substream *substream) { kal_int32 HW_memory_index = 0; kal_int32 HW_Cur_ReadIdx = 0; kal_uint32 Frameidx = 0; kal_int32 Afe_consumed_bytes = 0; AFE_BLOCK_T *Afe_Block = &pI2S0dl1MemControl->rBlock; unsigned long flags; //struct snd_pcm_runtime *runtime = substream->runtime; spin_lock_irqsave(&pI2S0dl1MemControl->substream_lock, flags); PRINTK_AUD_DL1(" %s Afe_Block->u4DMAReadIdx = 0x%x\n", __func__, Afe_Block->u4DMAReadIdx); // get total bytes to copy //Frameidx = audio_bytes_to_frame(substream , Afe_Block->u4DMAReadIdx); //return Frameidx; if (GetMemoryPathEnable(Soc_Aud_Digital_Block_MEM_DL1) == true) { HW_Cur_ReadIdx = Afe_Get_Reg(AFE_DL1_CUR); if (HW_Cur_ReadIdx == 0) { PRINTK_AUDDRV("[Auddrv] HW_Cur_ReadIdx ==0 \n"); HW_Cur_ReadIdx = Afe_Block->pucPhysBufAddr; } HW_memory_index = (HW_Cur_ReadIdx - Afe_Block->pucPhysBufAddr); if (HW_memory_index >= Afe_Block->u4DMAReadIdx) { Afe_consumed_bytes = HW_memory_index - Afe_Block->u4DMAReadIdx; } else { Afe_consumed_bytes = Afe_Block->u4BufferSize + HW_memory_index - Afe_Block->u4DMAReadIdx ; } Afe_consumed_bytes = Align64ByteSize(Afe_consumed_bytes); Afe_Block->u4DataRemained -= Afe_consumed_bytes; Afe_Block->u4DMAReadIdx += Afe_consumed_bytes; Afe_Block->u4DMAReadIdx %= Afe_Block->u4BufferSize; PRINTK_AUD_DL1("[Auddrv] HW_Cur_ReadIdx =0x%x HW_memory_index = 0x%x Afe_consumed_bytes = 0x%x\n", HW_Cur_ReadIdx, HW_memory_index, Afe_consumed_bytes); spin_unlock_irqrestore(&pI2S0dl1MemControl->substream_lock, flags); return audio_bytes_to_frame(substream , Afe_Block->u4DMAReadIdx); } else { Frameidx = audio_bytes_to_frame(substream , Afe_Block->u4DMAReadIdx); spin_unlock_irqrestore(&pI2S0dl1MemControl->substream_lock, flags); return Frameidx; } }
/* supend and resume function */ static int mtk_voice_pm_ops_suspend(struct device *device) { /* if now in phone call state, not suspend!! */ bool b_modem1_speech_on; bool b_modem2_speech_on; AudDrv_Clk_On(); /* should enable clk for access reg */ b_modem1_speech_on = (bool) (Afe_Get_Reg(PCM2_INTF_CON) & 0x1); b_modem2_speech_on = (bool) (Afe_Get_Reg(PCM_INTF_CON) & 0x1); AudDrv_Clk_Off(); /* should enable clk for access reg */ pr_warn ("mtk_voice_pm_ops_suspend, b_modem1_speech_on=%d, b_modem2_speech_on=%d, speech_md_usage_control=%d\n", b_modem1_speech_on, b_modem2_speech_on, speech_md_usage_control); if (b_modem1_speech_on == true || b_modem2_speech_on == true || speech_md_usage_control == true) { /* select 26M */ clkmux_sel(MT_CLKMUX_AUD_HF_26M_SEL, MT_CG_SYS_26M, "AUDIO "); clkmux_sel(MT_CLKMUX_AUD_INTBUS_SEL, MT_CG_SYS_26M, "AUDIO "); return 0; } return 0; }
/* supend and resume function */ static int mtk_voice_bt_pm_ops_suspend(struct device *device) { /* if now in phone call state, not suspend!! */ bool b_modem1_speech_on; bool b_modem2_speech_on; AudDrv_ANA_Clk_On(); AudDrv_Clk_On(); /* should enable clk for access reg */ b_modem1_speech_on = (bool) (Afe_Get_Reg(PCM2_INTF_CON) & 0x1); b_modem2_speech_on = (bool) (Afe_Get_Reg(PCM_INTF_CON) & 0x1); AudDrv_Clk_Off(); AudDrv_ANA_Clk_Off(); if (b_modem1_speech_on == true || b_modem2_speech_on == true) { #ifdef CONFIG_MTK_CLKMGR clkmux_sel(MT_MUX_AUDINTBUS, 0, "AUDIO"); /* select 26M */ #endif return 0; } return 0; }
static int mtk_voice_bt_pm_ops_resume(struct device *device) { bool b_modem1_speech_on; bool b_modem2_speech_on; AudDrv_ANA_Clk_On(); AudDrv_Clk_On(); /* should enable clk for access reg */ b_modem1_speech_on = (bool) (Afe_Get_Reg(PCM2_INTF_CON) & 0x1); b_modem2_speech_on = (bool) (Afe_Get_Reg(PCM_INTF_CON) & 0x1); AudDrv_Clk_Off(); AudDrv_ANA_Clk_Off(); if (b_modem1_speech_on == true || b_modem2_speech_on == true) { #ifdef CONFIG_MTK_CLKMGR clkmux_sel(MT_MUX_AUDINTBUS, 1, "AUDIO"); /* mainpll */ #endif return 0; } return 0; }
static snd_pcm_uframes_t mtk_awb_pcm_pointer(struct snd_pcm_substream *substream) { kal_int32 HW_memory_index = 0; kal_int32 HW_Cur_ReadIdx = 0; kal_uint32 Frameidx = 0; AFE_BLOCK_T *Awb_Block = &(FM_I2S_AWB_Control_context->rBlock); PRINTK_AUD_AWB("mtk_awb_pcm_pointer Awb_Block->u4WriteIdx;= 0x%x\n", Awb_Block->u4WriteIdx); if (GetMemoryPathEnable(Soc_Aud_Digital_Block_MEM_AWB) == true) { /* get total bytes to copysinewavetohdmi */ #ifdef AUDIO_64BYTE_ALIGN Frameidx = Align64ByteSize(audio_bytes_to_frame(substream, Awb_Block->u4WriteIdx)); #else Frameidx = audio_bytes_to_frame(substream, Awb_Block->u4WriteIdx); #endif return Frameidx; #ifdef AUDIO_64BYTE_ALIGN HW_Cur_ReadIdx = Align64ByteSize(Afe_Get_Reg(AFE_AWB_CUR)); #else HW_Cur_ReadIdx = Afe_Get_Reg(AFE_AWB_CUR); #endif if (HW_Cur_ReadIdx == 0) { pr_warn("[Auddrv] mtk_awb_pcm_pointer HW_Cur_ReadIdx ==0\n"); HW_Cur_ReadIdx = Awb_Block->pucPhysBufAddr; } HW_memory_index = (HW_Cur_ReadIdx - Awb_Block->pucPhysBufAddr); Previous_Hw_cur = HW_memory_index; PRINTK_AUD_AWB("[Auddrv] mtk_awb_pcm_pointer =0x%x HW_memory_index = 0x%x\n", HW_Cur_ReadIdx, HW_memory_index); return audio_bytes_to_frame(substream, Previous_Hw_cur); } return 0; }
static snd_pcm_uframes_t mtk_pcm_dl2_pointer(struct snd_pcm_substream *substream) { kal_int32 HW_memory_index = 0; kal_int32 HW_Cur_ReadIdx = 0; kal_uint32 Frameidx = 0; kal_int32 Afe_consumed_bytes = 0; AFE_BLOCK_T *Afe_Block = &pMemControl->rBlock; /* struct snd_pcm_runtime *runtime = substream->runtime; */ PRINTK_AUD_DL2(" %s Afe_Block->u4DMAReadIdx = 0x%x\n", __func__, Afe_Block->u4DMAReadIdx); Auddrv_Dl2_Spinlock_lock(); /* get total bytes to copy */ /* Frameidx = audio_bytes_to_frame(substream , Afe_Block->u4DMAReadIdx); */ /* return Frameidx; */ if (GetMemoryPathEnable(Soc_Aud_Digital_Block_MEM_DL2) == true) { HW_Cur_ReadIdx = Afe_Get_Reg(AFE_DL2_CUR); if (HW_Cur_ReadIdx == 0) { PRINTK_AUDDRV("[Auddrv] HW_Cur_ReadIdx ==0\n"); HW_Cur_ReadIdx = Afe_Block->pucPhysBufAddr; } HW_memory_index = (HW_Cur_ReadIdx - Afe_Block->pucPhysBufAddr); if (HW_memory_index >= Afe_Block->u4DMAReadIdx) { Afe_consumed_bytes = HW_memory_index - Afe_Block->u4DMAReadIdx; } else { Afe_consumed_bytes = Afe_Block->u4BufferSize + HW_memory_index - Afe_Block->u4DMAReadIdx; } #ifdef AUDIO_64BYTE_ALIGN /* no need to do 64byte align */ Afe_consumed_bytes = Align64ByteSize(Afe_consumed_bytes); #endif Afe_Block->u4DataRemained -= Afe_consumed_bytes; Afe_Block->u4DMAReadIdx += Afe_consumed_bytes; Afe_Block->u4DMAReadIdx %= Afe_Block->u4BufferSize; PRINTK_AUD_DL2 ("[Auddrv] HW_Cur_ReadIdx =0x%x HW_memory_index = 0x%x Afe_consumed_bytes = 0x%x\n", HW_Cur_ReadIdx, HW_memory_index, Afe_consumed_bytes); Auddrv_Dl2_Spinlock_unlock(); Frameidx = audio_bytes_to_frame(substream, Afe_Block->u4DMAReadIdx); } else { Frameidx = audio_bytes_to_frame(substream, Afe_Block->u4DMAReadIdx); Auddrv_Dl2_Spinlock_unlock(); } return Frameidx; }
static snd_pcm_uframes_t mtk_pcm_fmtx_pointer(struct snd_pcm_substream *substream) { kal_int32 HW_memory_index = 0; kal_int32 HW_Cur_ReadIdx = 0; kal_uint32 Frameidx = 0; kal_int32 Afe_consumed_bytes = 0; AFE_BLOCK_T *Afe_Block = &pMemControl->rBlock; PRINTK_AUD_FMTX("[mtk_pcm_fmtx_pointer] Afe_Block->u4DMAReadIdx = 0x%x\n", Afe_Block->u4DMAReadIdx); Auddrv_Dl1_Spinlock_lock(); if (GetMemoryPathEnable(Soc_Aud_Digital_Block_MEM_DL1) == true) { HW_Cur_ReadIdx = Afe_Get_Reg(AFE_DL1_CUR); if (HW_Cur_ReadIdx == 0) { PRINTK_AUD_FMTX("[Auddrv] HW_Cur_ReadIdx ==0 \n"); HW_Cur_ReadIdx = Afe_Block->pucPhysBufAddr; } HW_memory_index = (HW_Cur_ReadIdx - Afe_Block->pucPhysBufAddr); if (HW_memory_index >= Afe_Block->u4DMAReadIdx) { Afe_consumed_bytes = HW_memory_index - Afe_Block->u4DMAReadIdx; } else { Afe_consumed_bytes = Afe_Block->u4BufferSize + HW_memory_index - Afe_Block->u4DMAReadIdx ; } Afe_consumed_bytes = Align64ByteSize(Afe_consumed_bytes); Afe_Block->u4DataRemained -= Afe_consumed_bytes; Afe_Block->u4DMAReadIdx += Afe_consumed_bytes; Afe_Block->u4DMAReadIdx %= Afe_Block->u4BufferSize; PRINTK_AUD_DL1("[Auddrv] HW_Cur_ReadIdx =0x%x HW_memory_index = 0x%x Afe_consumed_bytes = 0x%x\n", HW_Cur_ReadIdx, HW_memory_index, Afe_consumed_bytes); Auddrv_Dl1_Spinlock_unlock(); return audio_bytes_to_frame(substream , Afe_Block->u4DMAReadIdx); } else { Frameidx = audio_bytes_to_frame(substream , Afe_Block->u4DMAReadIdx); Auddrv_Dl1_Spinlock_unlock(); return Frameidx; } }
static snd_pcm_uframes_t mtk_i2s0_awb_pcm_pointer(struct snd_pcm_substream *substream) { kal_int32 HW_memory_index = 0; kal_int32 HW_Cur_ReadIdx = 0; /*modified by jiaqing.yang for ALPS02074446(For_JHZ6735M_65C_L_ALPS.L1.MP3.V1_P67) 20150706 begin*/ #if 0 //kal_uint32 Frameidx =0; #else kal_uint32 Frameidx =0; #endif /*modified by jiaqing.yang for ALPS02074446(For_JHZ6735M_65C_L_ALPS.L1.MP3.V1_P67) 20150706 end*/ AFE_BLOCK_T *Awb_Block = &(I2S0_AWB_Control_context->rBlock); PRINTK_AUD_AWB("mtk_i2s0_awb_pcm_pointer Awb_Block->u4WriteIdx;= 0x%x \n",Awb_Block->u4WriteIdx); if (GetMemoryPathEnable(Soc_Aud_Digital_Block_MEM_AWB) == true) { // get total bytes to copysinewavetohdmi /*modified by jiaqing.yang for ALPS02074446(For_JHZ6735M_65C_L_ALPS.L1.MP3.V1_P67) 20150706 begin*/ #if 0 //Frameidx =audio_bytes_to_frame(substream , Awb_Block->u4WriteIdx); //return Frameidx; #else Frameidx =audio_bytes_to_frame(substream , Awb_Block->u4WriteIdx); return Frameidx; #endif /*modified by jiaqing.yang for ALPS02074446(For_JHZ6735M_65C_L_ALPS.L1.MP3.V1_P67) 20150706 begin*/ /*modified by jiaqing.yang for ALPS02074446(For_JHZ6735M_65C_L_ALPS.L1.MP3.V1_P67) 20150706 begin*/ #if 0 /*modified by jiaqing.yang for ALPS02074446(For_JHZ6735M_65C_L_ALPS.L1.MP3.V1_P67) 20150706 end*/ HW_Cur_ReadIdx = Align64ByteSize(Afe_Get_Reg(AFE_AWB_CUR)); if (HW_Cur_ReadIdx == 0) { printk("[Auddrv] mtk_awb_pcm_pointer HW_Cur_ReadIdx ==0 \n"); HW_Cur_ReadIdx = Awb_Block->pucPhysBufAddr; } HW_memory_index = (HW_Cur_ReadIdx - Awb_Block->pucPhysBufAddr); Previous_Hw_cur = HW_memory_index; PRINTK_AUD_AWB("[Auddrv] mtk_i2s0_awb_pcm_pointer =0x%x HW_memory_index = 0x%x\n", HW_Cur_ReadIdx, HW_memory_index); return audio_bytes_to_frame(substream,Previous_Hw_cur); /*modified by jiaqing.yang for ALPS02074446(For_JHZ6735M_65C_L_ALPS.L1.MP3.V1_P67) 20150706 begin*/ #endif /*modified by jiaqing.yang for ALPS02074446(For_JHZ6735M_65C_L_ALPS.L1.MP3.V1_P67) 20150706 end*/ } return 0; }
void Afe_Set_Reg(uint32 offset,uint32 value,uint32 mask) { #ifdef AUDIO_MEM_IOREMAP extern void* AFE_BASE_ADDRESS; //PRINTK_AUDDRV("Afe_Set_Reg AUDIO_MEM_IOREMAP AFE_BASE_ADDRESS = %p\n",AFE_BASE_ADDRESS); volatile uint32 address =(uint32) ((char*)AFE_BASE_ADDRESS + offset); #else volatile uint32 address = (AFE_BASE+offset); #endif volatile uint32 *AFE_Register = (volatile uint32*)address; volatile uint32 val_tmp; //PRINTK_AFE_REG("Afe_Set_Reg offset=%x, value=%x, mask=%x \n",offset,value,mask); val_tmp = Afe_Get_Reg(offset); val_tmp &= (~mask); val_tmp |= (value&mask); mt65xx_reg_sync_writel(val_tmp,AFE_Register); }
static snd_pcm_uframes_t mtk_pcm_hdmi_pointer(struct snd_pcm_substream *substream) { kal_int32 HW_memory_index = 0; kal_int32 HW_Cur_ReadIdx = 0; kal_uint32 Frameidx = 0; kal_int32 Afe_consumed_bytes = 0; AFE_BLOCK_T *Afe_Block = &(pMemControl->rBlock); PRINTK_AUD_HDMI("%s Afe_Block->u4DMAReadIdx = 0x%x\n", __func__, Afe_Block->u4DMAReadIdx); if (GetMemoryPathEnable(Soc_Aud_Digital_Block_MEM_HDMI) == true) { HW_Cur_ReadIdx = Afe_Get_Reg(AFE_HDMI_CUR); if (HW_Cur_ReadIdx == 0) { PRINTK_AUD_HDMI("[Auddrv] HW_Cur_ReadIdx == 0\n"); HW_Cur_ReadIdx = Afe_Block->pucPhysBufAddr; } HW_memory_index = (HW_Cur_ReadIdx - Afe_Block->pucPhysBufAddr); if (HW_memory_index >= Afe_Block->u4DMAReadIdx) Afe_consumed_bytes = HW_memory_index - Afe_Block->u4DMAReadIdx; else { Afe_consumed_bytes = Afe_Block->u4BufferSize + HW_memory_index - Afe_Block->u4DMAReadIdx; } Afe_Block->u4DataRemained -= Afe_consumed_bytes; Afe_Block->u4DMAReadIdx += Afe_consumed_bytes; Afe_Block->u4DMAReadIdx %= Afe_Block->u4BufferSize; PRINTK_AUD_HDMI ("[Auddrv] HW_Cur_ReadIdx = 0x%x, HW_memory_index = 0x%x, Afe_consumed_bytes = 0x%x\n", HW_Cur_ReadIdx, HW_memory_index, Afe_consumed_bytes); return audio_bytes_to_frame(substream, Afe_Block->u4DMAReadIdx); } Frameidx = audio_bytes_to_frame(substream, Afe_Block->u4DMAReadIdx); return Frameidx; }
static snd_pcm_uframes_t mtk_capture_pcm_pointer(struct snd_pcm_substream *substream) { //printk("mtk_capture_pcm_pointer \n"); struct snd_pcm_runtime *runtime = substream->runtime; struct dummy_hrtimer_pcm *dpcm = runtime->private_data; kal_int32 HW_memory_index = 0; kal_int32 HW_Cur_ReadIdx = 0; AFE_BLOCK_T *Vul_Block = &(VUL_Control_context.rBlock); if (InterruptTrigger == 1) { HW_Cur_ReadIdx = Afe_Get_Reg(AFE_VUL_CUR); if (HW_Cur_ReadIdx == 0) { printk("[Auddrv] mtk_capture_pcm_pointer HW_Cur_ReadIdx ==0 \n"); HW_Cur_ReadIdx = Vul_Block->pucPhysBufAddr; } HW_memory_index = (HW_Cur_ReadIdx - Vul_Block->pucPhysBufAddr); Previous_Hw_cur = HW_memory_index; printk("[Auddrv] mtk_capture_pcm_pointer =0x%x HW_memory_index = 0x%x\n", HW_Cur_ReadIdx, HW_memory_index); InterruptTrigger = 0; return (HW_memory_index >> 2); }
static snd_pcm_uframes_t mtk_pcm_hdmi_pointer(struct snd_pcm_substream *substream) { kal_int32 HW_memory_index = 0; kal_int32 HW_Cur_ReadIdx = 0; AFE_BLOCK_T *Afe_Block = &(pMemControl->rBlock); PRINTK_AUD_HDMI("mtk_pcm_hdmi_pointer u4DMAReadIdx=%x\n",Afe_Block->u4DMAReadIdx); if (pMemControl->interruptTrigger == 1) { HW_Cur_ReadIdx = Afe_Get_Reg(AFE_HDMI_CUR); if (HW_Cur_ReadIdx == 0) { PRINTK_AUD_HDMI("[mtk_pcm_hdmi_pointer] HW_Cur_ReadIdx ==0 \n"); HW_Cur_ReadIdx = Afe_Block->pucPhysBufAddr; } HW_memory_index = (HW_Cur_ReadIdx - Afe_Block->pucPhysBufAddr); Previous_Hw_cur = HW_memory_index; PRINTK_AUD_HDMI("[mtk_pcm_hdmi_pointer] HW_Cur_ReadIdx =0x%x HW_memory_index = 0x%x pointer return = 0x%x \n", HW_Cur_ReadIdx, HW_memory_index,(HW_memory_index >> 2)); pMemControl->interruptTrigger = 0; return (HW_memory_index >> 2); }
static snd_pcm_uframes_t mtk_capture_pcm_pointer(struct snd_pcm_substream *substream) { kal_int32 HW_memory_index = 0; kal_int32 HW_Cur_ReadIdx = 0; //kal_uint32 Frameidx = 0; kal_int32 Hw_Get_bytes = 0; AFE_BLOCK_T *UL1_Block = &(VUL_Control_context->rBlock); PRINTK_AUD_UL1("mtk_capture_pcm_pointer Awb_Block->u4WriteIdx;= 0x%x \n", UL1_Block->u4WriteIdx); Auddrv_UL1_Spinlock_lock(); if (GetMemoryPathEnable(Soc_Aud_Digital_Block_MEM_VUL) == true) { HW_Cur_ReadIdx = Align64ByteSize(Afe_Get_Reg(AFE_VUL_CUR)); if (HW_Cur_ReadIdx == 0) { PRINTK_AUD_UL1("[Auddrv] mtk_awb_pcm_pointer HW_Cur_ReadIdx ==0 \n"); HW_Cur_ReadIdx = UL1_Block->pucPhysBufAddr; } HW_memory_index = (HW_Cur_ReadIdx - UL1_Block->pucPhysBufAddr); // update for data get to hardware Hw_Get_bytes = (HW_Cur_ReadIdx - UL1_Block->pucPhysBufAddr) - UL1_Block->u4WriteIdx; if (Hw_Get_bytes < 0) { Hw_Get_bytes += UL1_Block->u4BufferSize; } UL1_Block->u4WriteIdx += Hw_Get_bytes; UL1_Block->u4WriteIdx %= UL1_Block->u4BufferSize; UL1_Block->u4DataRemained += Hw_Get_bytes; PRINTK_AUD_UL1("[Auddrv] mtk_capture_pcm_pointer =0x%x HW_memory_index = 0x%x\n", HW_Cur_ReadIdx, HW_memory_index); Auddrv_UL1_Spinlock_unlock(); return audio_bytes_to_frame(substream, HW_memory_index); } Auddrv_UL1_Spinlock_unlock(); return 0; }
static snd_pcm_uframes_t mtk_bt_dai_pcm_pointer(struct snd_pcm_substream *substream) { kal_int32 HW_memory_index = 0; kal_int32 HW_Cur_ReadIdx = 0; AFE_BLOCK_T *Dai_Block = &(Bt_Dai_Control_context->rBlock); pr_debug("mtk_bt_dai_pcm_pointer Dai_Block->u4WriteIdx;= 0x%x\n", Dai_Block->u4WriteIdx); if (Bt_Dai_Control_context->interruptTrigger == 1) { Previous_Hw_cur = Dai_Block->u4WriteIdx; return ((Dai_Block->u4WriteIdx >> 1) / substream->runtime->channels); HW_Cur_ReadIdx = Afe_Get_Reg(AFE_DAI_CUR); if (HW_Cur_ReadIdx == 0) { pr_debug("[Auddrv] mtk_bt_dai_pcm_pointer HW_Cur_ReadIdx ==0\n"); HW_Cur_ReadIdx = Dai_Block->pucPhysBufAddr; } HW_memory_index = (HW_Cur_ReadIdx - Dai_Block->pucPhysBufAddr); Previous_Hw_cur = HW_memory_index; pr_debug("[Auddrv] mtk_bt_dai_pcm_pointer =0x%x HW_memory_index = 0x%x\n", HW_Cur_ReadIdx, HW_memory_index); Bt_Dai_Control_context->interruptTrigger = 0; return (HW_memory_index / substream->runtime->channels); }
static snd_pcm_uframes_t mtk_dl1_awb_pcm_pointer(struct snd_pcm_substream *substream) { kal_int32 HW_memory_index = 0; kal_int32 HW_Cur_ReadIdx = 0; AFE_BLOCK_T *Awb_Block = &(Dl1_AWB_Control_context->rBlock); pr_debug("mtk_dl1_awb_pcm_pointer Awb_Block->u4WriteIdx;= 0x%x\n", Awb_Block->u4WriteIdx); if (Dl1_AWB_Control_context->interruptTrigger == 1) { Previous_Hw_cur = Awb_Block->u4WriteIdx; return Awb_Block->u4WriteIdx >> 2; HW_Cur_ReadIdx = Afe_Get_Reg(AFE_AWB_CUR); if (HW_Cur_ReadIdx == 0) { pr_debug("[Auddrv] mtk_dl1_awb_pcm_pointer HW_Cur_ReadIdx ==0\n"); HW_Cur_ReadIdx = Awb_Block->pucPhysBufAddr; } HW_memory_index = (HW_Cur_ReadIdx - Awb_Block->pucPhysBufAddr); Previous_Hw_cur = HW_memory_index; pr_debug("[Auddrv] mtk_dl1_awb_pcm_pointer =0x%x HW_memory_index = 0x%x\n", HW_Cur_ReadIdx, HW_memory_index); Dl1_AWB_Control_context->interruptTrigger = 0; return (HW_memory_index >> 2); }
static snd_pcm_uframes_t mtk_capture_pcm_pointer(struct snd_pcm_substream *substream) { kal_int32 HW_memory_index = 0; kal_int32 HW_Cur_ReadIdx = 0; AFE_BLOCK_T *Awb_Block = &(TDM_VUL_Control_context->rBlock); PRINTK_AUD_UL1("mtk_capture_pcm_pointer Awb_Block->u4WriteIdx;= 0x%x \n", Awb_Block->u4WriteIdx); if (TDM_VUL_Control_context->interruptTrigger == 1) { Previous_Hw_cur = Awb_Block->u4WriteIdx; return Awb_Block->u4WriteIdx >> 2; HW_Cur_ReadIdx = Align64ByteSize(Afe_Get_Reg(AFE_AWB_CUR)); if (HW_Cur_ReadIdx == 0) { PRINTK_AUD_UL1("[Auddrv] mtk_capture_pcm_pointer HW_Cur_ReadIdx ==0 \n"); HW_Cur_ReadIdx = Awb_Block->pucPhysBufAddr; } HW_memory_index = (HW_Cur_ReadIdx - Awb_Block->pucPhysBufAddr); Previous_Hw_cur = HW_memory_index; PRINTK_AUD_UL1("[Auddrv] mtk_capture_pcm_pointer =0x%x HW_memory_index = 0x%x\n", HW_Cur_ReadIdx, HW_memory_index); TDM_VUL_Control_context->interruptTrigger = 0; return (HW_memory_index >> 2); }
static snd_pcm_uframes_t mtk_dl1bt_pcm_pointer(struct snd_pcm_substream *substream) { kal_int32 HW_memory_index = 0; kal_int32 HW_Cur_ReadIdx = 0; kal_uint32 Frameidx = 0; AFE_BLOCK_T *Afe_Block = &pdl1btMemControl->rBlock; PRINTK_AUD_DL1(" %s Afe_Block->u4DMAReadIdx = 0x%x\n", __func__, Afe_Block->u4DMAReadIdx); // get total bytes to copy //Frameidx = audio_bytes_to_frame(substream , Afe_Block->u4DMAReadIdx); //return Frameidx; if (GetMemoryPathEnable(Soc_Aud_Digital_Block_MEM_DL1) == true) { HW_Cur_ReadIdx = Afe_Get_Reg(AFE_DL1_CUR); if (HW_Cur_ReadIdx == 0) { PRINTK_AUD_DL1("[Auddrv] HW_Cur_ReadIdx ==0 \n"); HW_Cur_ReadIdx = Afe_Block->pucPhysBufAddr; } HW_memory_index = (HW_Cur_ReadIdx - Afe_Block->pucPhysBufAddr); Previous_Hw_cur = HW_memory_index; PRINTK_AUD_DL1("[Auddrv] HW_Cur_ReadIdx =0x%x HW_memory_index = 0x%x pointer return = 0x%x \n", HW_Cur_ReadIdx, HW_memory_index, (HW_memory_index >> 2)); return audio_bytes_to_frame(substream , Previous_Hw_cur); }
void Afe_Log_Print(void) { AudDrv_Clk_On(); pr_debug("+AudDrv Afe_Log_Print\n"); pr_debug("AUDIO_TOP_CON0 = 0x%x\n", Afe_Get_Reg(AUDIO_TOP_CON0)); pr_debug("AUDIO_TOP_CON1 = 0x%x\n", Afe_Get_Reg(AUDIO_TOP_CON1)); pr_debug("AUDIO_TOP_CON3 = 0x%x\n", Afe_Get_Reg(AUDIO_TOP_CON3)); pr_debug("AFE_DAC_CON0 = 0x%x\n", Afe_Get_Reg(AFE_DAC_CON0)); pr_debug("AFE_DAC_CON1 = 0x%x\n", Afe_Get_Reg(AFE_DAC_CON1)); pr_debug("AFE_I2S_CON = 0x%x\n", Afe_Get_Reg(AFE_I2S_CON)); pr_debug("AFE_DAIBT_CON0 = 0x%x\n", Afe_Get_Reg(AFE_DAIBT_CON0)); pr_debug("AFE_CONN0 = 0x%x\n", Afe_Get_Reg(AFE_CONN0)); pr_debug("AFE_CONN1 = 0x%x\n", Afe_Get_Reg(AFE_CONN1)); pr_debug("AFE_CONN2 = 0x%x\n", Afe_Get_Reg(AFE_CONN2)); pr_debug("AFE_CONN3 = 0x%x\n", Afe_Get_Reg(AFE_CONN3)); pr_debug("AFE_CONN4 = 0x%x\n", Afe_Get_Reg(AFE_CONN4)); pr_debug("AFE_I2S_CON1 = 0x%x\n", Afe_Get_Reg(AFE_I2S_CON1)); pr_debug("AFE_I2S_CON2 = 0x%x\n", Afe_Get_Reg(AFE_I2S_CON2)); pr_debug("AFE_MRGIF_CON = 0x%x\n", Afe_Get_Reg(AFE_MRGIF_CON)); pr_debug("AFE_DL1_BASE = 0x%x\n", Afe_Get_Reg(AFE_DL1_BASE)); pr_debug("AFE_DL1_CUR = 0x%x\n", Afe_Get_Reg(AFE_DL1_CUR)); pr_debug("AFE_DL1_END = 0x%x\n", Afe_Get_Reg(AFE_DL1_END)); pr_debug("AFE_VUL_D2_BASE = 0x%x\n", Afe_Get_Reg(AFE_VUL_D2_BASE)); pr_debug("AFE_VUL_D2_END = 0x%x\n", Afe_Get_Reg(AFE_VUL_D2_END)); pr_debug("AFE_VUL_D2_CUR = 0x%x\n", Afe_Get_Reg(AFE_VUL_D2_CUR)); pr_debug("AFE_I2S_CON3 = 0x%x\n", Afe_Get_Reg(AFE_I2S_CON3)); pr_debug("AFE_DL2_BASE = 0x%x\n", Afe_Get_Reg(AFE_DL2_BASE)); pr_debug("AFE_DL2_CUR = 0x%x\n", Afe_Get_Reg(AFE_DL2_CUR)); pr_debug("AFE_DL2_END = 0x%x\n", Afe_Get_Reg(AFE_DL2_END)); pr_debug("AFE_CONN5 = 0x%x\n", Afe_Get_Reg(AFE_CONN5)); pr_debug("AFE_CONN_24BIT = 0x%x\n", Afe_Get_Reg(AFE_CONN_24BIT)); pr_debug("AFE_AWB_BASE = 0x%x\n", Afe_Get_Reg(AFE_AWB_BASE)); pr_debug("AFE_AWB_END = 0x%x\n", Afe_Get_Reg(AFE_AWB_END)); pr_debug("AFE_AWB_CUR = 0x%x\n", Afe_Get_Reg(AFE_AWB_CUR)); pr_debug("AFE_VUL_BASE = 0x%x\n", Afe_Get_Reg(AFE_VUL_BASE)); pr_debug("AFE_VUL_END = 0x%x\n", Afe_Get_Reg(AFE_VUL_END)); pr_debug("AFE_VUL_CUR = 0x%x\n", Afe_Get_Reg(AFE_VUL_CUR)); pr_debug("AFE_DAI_BASE = 0x%x\n", Afe_Get_Reg(AFE_DAI_BASE)); pr_debug("AFE_DAI_END = 0x%x\n", Afe_Get_Reg(AFE_DAI_END)); pr_debug("AFE_DAI_CUR = 0x%x\n", Afe_Get_Reg(AFE_DAI_CUR)); pr_debug("AFE_CONN6 = 0x%x\n", Afe_Get_Reg(AFE_CONN6)); pr_debug("AFE_MEMIF_MSB = 0x%x\n", Afe_Get_Reg(AFE_MEMIF_MSB)); pr_debug("AFE_MEMIF_MON0 = 0x%x\n", Afe_Get_Reg(AFE_MEMIF_MON0)); pr_debug("AFE_MEMIF_MON1 = 0x%x\n", Afe_Get_Reg(AFE_MEMIF_MON1)); pr_debug("AFE_MEMIF_MON2 = 0x%x\n", Afe_Get_Reg(AFE_MEMIF_MON2)); pr_debug("AFE_MEMIF_MON4 = 0x%x\n", Afe_Get_Reg(AFE_MEMIF_MON4)); pr_debug("AFE_ADDA_DL_SRC2_CON0 = 0x%x\n", Afe_Get_Reg(AFE_ADDA_DL_SRC2_CON0)); pr_debug("AFE_ADDA_DL_SRC2_CON1 = 0x%x\n", Afe_Get_Reg(AFE_ADDA_DL_SRC2_CON1)); pr_debug("AFE_ADDA_UL_SRC_CON0 = 0x%x\n", Afe_Get_Reg(AFE_ADDA_UL_SRC_CON0)); pr_debug("AFE_ADDA_UL_SRC_CON1 = 0x%x\n", Afe_Get_Reg(AFE_ADDA_UL_SRC_CON1)); pr_debug("AFE_ADDA_TOP_CON0 = 0x%x\n", Afe_Get_Reg(AFE_ADDA_TOP_CON0)); pr_debug("AFE_ADDA_UL_DL_CON0 = 0x%x\n", Afe_Get_Reg(AFE_ADDA_UL_DL_CON0)); pr_debug("AFE_ADDA_SRC_DEBUG = 0x%x\n", Afe_Get_Reg(AFE_ADDA_SRC_DEBUG)); pr_debug("AFE_ADDA_SRC_DEBUG_MON0= 0x%x\n", Afe_Get_Reg(AFE_ADDA_SRC_DEBUG_MON0)); pr_debug("AFE_ADDA_SRC_DEBUG_MON1= 0x%x\n", Afe_Get_Reg(AFE_ADDA_SRC_DEBUG_MON1)); pr_debug("AFE_ADDA_NEWIF_CFG0 = 0x%x\n", Afe_Get_Reg(AFE_ADDA_NEWIF_CFG0)); pr_debug("AFE_ADDA_NEWIF_CFG1 = 0x%x\n", Afe_Get_Reg(AFE_ADDA_NEWIF_CFG1)); pr_debug("AFE_ADDA_NEWIF_CFG2 = 0x%x\n", Afe_Get_Reg(AFE_ADDA_NEWIF_CFG2)); pr_debug("AFE_SIDETONE_DEBUG = 0x%x\n", Afe_Get_Reg(AFE_SIDETONE_DEBUG)); pr_debug("AFE_SIDETONE_MON = 0x%x\n", Afe_Get_Reg(AFE_SIDETONE_MON)); pr_debug("AFE_SIDETONE_CON0 = 0x%x\n", Afe_Get_Reg(AFE_SIDETONE_CON0)); pr_debug("AFE_SIDETONE_COEFF = 0x%x\n", Afe_Get_Reg(AFE_SIDETONE_COEFF)); pr_debug("AFE_SIDETONE_CON1 = 0x%x\n", Afe_Get_Reg(AFE_SIDETONE_CON1)); pr_debug("AFE_SIDETONE_GAIN = 0x%x\n", Afe_Get_Reg(AFE_SIDETONE_GAIN)); pr_debug("AFE_SGEN_CON0 = 0x%x\n", Afe_Get_Reg(AFE_SGEN_CON0)); pr_debug("AFE_TOP_CON0 = 0x%x\n", Afe_Get_Reg(AFE_TOP_CON0)); pr_debug("AFE_ADDA_PREDIS_CON0 = 0x%x\n", Afe_Get_Reg(AFE_ADDA_PREDIS_CON0)); pr_debug("AFE_ADDA_PREDIS_CON1 = 0x%x\n", Afe_Get_Reg(AFE_ADDA_PREDIS_CON1)); pr_debug("AFE_MRGIF_MON0 = 0x%x\n", Afe_Get_Reg(AFE_MRGIF_MON0)); pr_debug("AFE_MRGIF_MON1 = 0x%x\n", Afe_Get_Reg(AFE_MRGIF_MON1)); pr_debug("AFE_MRGIF_MON2 = 0x%x\n", Afe_Get_Reg(AFE_MRGIF_MON2)); pr_debug("AFE_MOD_DAI_BASE = 0x%x\n", Afe_Get_Reg(AFE_MOD_DAI_BASE)); pr_debug("AFE_MOD_DAI_END = 0x%x\n", Afe_Get_Reg(AFE_MOD_DAI_END)); pr_debug("AFE_MOD_DAI_CUR = 0x%x\n", Afe_Get_Reg(AFE_MOD_DAI_CUR)); pr_debug("AFE_IRQ_MCU_CON = 0x%x\n", Afe_Get_Reg(AFE_IRQ_MCU_CON)); pr_debug("AFE_IRQ_MCU_STATUS = 0x%x\n", Afe_Get_Reg(AFE_IRQ_MCU_STATUS)); pr_debug("AFE_IRQ_MCU_CLR = 0x%x\n", Afe_Get_Reg(AFE_IRQ_MCU_CLR)); pr_debug("AFE_IRQ_MCU_CNT1 = 0x%x\n", Afe_Get_Reg(AFE_IRQ_MCU_CNT1)); pr_debug("AFE_IRQ_MCU_CNT2 = 0x%x\n", Afe_Get_Reg(AFE_IRQ_MCU_CNT2)); pr_debug("AFE_IRQ_MCU_EN = 0x%x\n", Afe_Get_Reg(AFE_IRQ_MCU_EN)); pr_debug("AFE_IRQ_MCU_MON2 = 0x%x\n", Afe_Get_Reg(AFE_IRQ_MCU_MON2)); pr_debug("AFE_IRQ_MCU_CNT5 = 0x%x\n", Afe_Get_Reg(AFE_IRQ_MCU_CNT5)); pr_debug("AFE_IRQ1_MCU_CNT_MON = 0x%x\n", Afe_Get_Reg(AFE_IRQ1_MCU_CNT_MON)); pr_debug("AFE_IRQ2_MCU_CNT_MON = 0x%x\n", Afe_Get_Reg(AFE_IRQ2_MCU_CNT_MON)); pr_debug("AFE_IRQ1_MCU_EN_CNT_MON= 0x%x\n", Afe_Get_Reg(AFE_IRQ1_MCU_EN_CNT_MON)); pr_debug("AFE_IRQ5_MCU_CNT_MON = 0x%x\n", Afe_Get_Reg(AFE_IRQ5_MCU_CNT_MON)); pr_debug("AFE_MEMIF_MAXLEN = 0x%x\n", Afe_Get_Reg(AFE_MEMIF_MAXLEN)); pr_debug("AFE_MEMIF_PBUF_SIZE = 0x%x\n", Afe_Get_Reg(AFE_MEMIF_PBUF_SIZE)); pr_debug("AFE_IRQ_MCU_CNT7 = 0x%x\n", Afe_Get_Reg(AFE_IRQ_MCU_CNT7)); pr_debug("AFE_APLL1_TUNER_CFG = 0x%x\n", Afe_Get_Reg(AFE_APLL1_TUNER_CFG)); pr_debug("AFE_APLL2_TUNER_CFG = 0x%x\n", Afe_Get_Reg(AFE_APLL2_TUNER_CFG)); pr_debug("AFE_GAIN1_CON0 = 0x%x\n", Afe_Get_Reg(AFE_GAIN1_CON0)); pr_debug("AFE_GAIN1_CON1 = 0x%x\n", Afe_Get_Reg(AFE_GAIN1_CON1)); pr_debug("AFE_GAIN1_CON2 = 0x%x\n", Afe_Get_Reg(AFE_GAIN1_CON2)); pr_debug("AFE_GAIN1_CON3 = 0x%x\n", Afe_Get_Reg(AFE_GAIN1_CON3)); pr_debug("AFE_GAIN1_CUR = 0x%x\n", Afe_Get_Reg(AFE_GAIN1_CUR)); pr_debug("AFE_GAIN2_CON0 = 0x%x\n", Afe_Get_Reg(AFE_GAIN2_CON0)); pr_debug("AFE_GAIN2_CON1 = 0x%x\n", Afe_Get_Reg(AFE_GAIN2_CON1)); pr_debug("AFE_GAIN2_CON2 = 0x%x\n", Afe_Get_Reg(AFE_GAIN2_CON2)); pr_debug("AFE_GAIN2_CON3 = 0x%x\n", Afe_Get_Reg(AFE_GAIN2_CON3)); pr_debug("AFE_GAIN2_CUR = 0x%x\n", Afe_Get_Reg(AFE_GAIN2_CUR)); pr_debug("AFE_CONN7 = 0x%x\n", Afe_Get_Reg(AFE_CONN7)); pr_debug("AFE_CONN8 = 0x%x\n", Afe_Get_Reg(AFE_CONN8)); pr_debug("AFE_CONN9 = 0x%x\n", Afe_Get_Reg(AFE_CONN9)); pr_debug("AFE_CONN10 = 0x%x\n", Afe_Get_Reg(AFE_CONN10)); pr_debug("AFE_ASRC_CON0 = 0x%x\n", Afe_Get_Reg(AFE_ASRC_CON0)); pr_debug("AFE_ASRC_CON1 = 0x%x\n", Afe_Get_Reg(AFE_ASRC_CON1)); pr_debug("AFE_ASRC_CON2 = 0x%x\n", Afe_Get_Reg(AFE_ASRC_CON2)); pr_debug("AFE_ASRC_CON3 = 0x%x\n", Afe_Get_Reg(AFE_ASRC_CON3)); pr_debug("AFE_ASRC_CON4 = 0x%x\n", Afe_Get_Reg(AFE_ASRC_CON4)); pr_debug("AFE_ASRC_CON5 = 0x%x\n", Afe_Get_Reg(AFE_ASRC_CON5)); pr_debug("AFE_ASRC_CON6 = 0x%x\n", Afe_Get_Reg(AFE_ASRC_CON6)); pr_debug("AFE_ASRC_CON7 = 0x%x\n", Afe_Get_Reg(AFE_ASRC_CON7)); pr_debug("AFE_ASRC_CON8 = 0x%x\n", Afe_Get_Reg(AFE_ASRC_CON8)); pr_debug("AFE_ASRC_CON9 = 0x%x\n", Afe_Get_Reg(AFE_ASRC_CON9)); pr_debug("AFE_ASRC_CON10 = 0x%x\n", Afe_Get_Reg(AFE_ASRC_CON10)); pr_debug("AFE_ASRC_CON11 = 0x%x\n", Afe_Get_Reg(AFE_ASRC_CON11)); pr_debug("PCM_INTF_CON = 0x%x\n", Afe_Get_Reg(PCM_INTF_CON1)); pr_debug("PCM_INTF_CON2 = 0x%x\n", Afe_Get_Reg(PCM_INTF_CON2)); pr_debug("PCM2_INTF_CON = 0x%x\n", Afe_Get_Reg(PCM2_INTF_CON)); pr_debug("AFE_ASRC_CON13 = 0x%x\n", Afe_Get_Reg(AFE_ASRC_CON13)); pr_debug("AFE_ASRC_CON14 = 0x%x\n", Afe_Get_Reg(AFE_ASRC_CON14)); pr_debug("AFE_ASRC_CON15 = 0x%x\n", Afe_Get_Reg(AFE_ASRC_CON15)); pr_debug("AFE_ASRC_CON16 = 0x%x\n", Afe_Get_Reg(AFE_ASRC_CON16)); pr_debug("AFE_ASRC_CON17 = 0x%x\n", Afe_Get_Reg(AFE_ASRC_CON17)); pr_debug("AFE_ASRC_CON18 = 0x%x\n", Afe_Get_Reg(AFE_ASRC_CON18)); pr_debug("AFE_ASRC_CON19 = 0x%x\n", Afe_Get_Reg(AFE_ASRC_CON19)); pr_debug("AFE_ASRC_CON20 = 0x%x\n", Afe_Get_Reg(AFE_ASRC_CON20)); pr_debug("AFE_ASRC_CON21 = 0x%x\n", Afe_Get_Reg(AFE_ASRC_CON21)); pr_debug("AFE_ASRC4_CON0 = 0x%x\n", Afe_Get_Reg(AFE_ASRC4_CON0)); pr_debug("AFE_ASRC4_CON1 = 0x%x\n", Afe_Get_Reg(AFE_ASRC4_CON1)); pr_debug("AFE_ASRC4_CON2 = 0x%x\n", Afe_Get_Reg(AFE_ASRC4_CON2)); pr_debug("AFE_ASRC4_CON3 = 0x%x\n", Afe_Get_Reg(AFE_ASRC4_CON3)); pr_debug("AFE_ASRC4_CON4 = 0x%x\n", Afe_Get_Reg(AFE_ASRC4_CON4)); pr_debug("AFE_ASRC4_CON5 = 0x%x\n", Afe_Get_Reg(AFE_ASRC4_CON5)); pr_debug("AFE_ASRC4_CON6 = 0x%x\n", Afe_Get_Reg(AFE_ASRC4_CON6)); pr_debug("AFE_ASRC4_CON7 = 0x%x\n", Afe_Get_Reg(AFE_ASRC4_CON7)); pr_debug("AFE_ASRC4_CON8 = 0x%x\n", Afe_Get_Reg(AFE_ASRC4_CON8)); pr_debug("AFE_ASRC4_CON9 = 0x%x\n", Afe_Get_Reg(AFE_ASRC4_CON9)); pr_debug("AFE_ASRC4_CON10 = 0x%x\n", Afe_Get_Reg(AFE_ASRC4_CON10)); pr_debug("AFE_ASRC4_CON11 = 0x%x\n", Afe_Get_Reg(AFE_ASRC4_CON11)); pr_debug("AFE_ASRC4_CON12 = 0x%x\n", Afe_Get_Reg(AFE_ASRC4_CON12)); pr_debug("AFE_ASRC4_CON13 = 0x%x\n", Afe_Get_Reg(AFE_ASRC4_CON13)); pr_debug("AFE_ASRC4_CON14 = 0x%x\n", Afe_Get_Reg(AFE_ASRC4_CON14)); pr_debug("AFE_ASRC2_CON0 = 0x%x\n", Afe_Get_Reg(AFE_ASRC2_CON0)); pr_debug("AFE_ASRC2_CON1 = 0x%x\n", Afe_Get_Reg(AFE_ASRC2_CON1)); pr_debug("AFE_ASRC2_CON2 = 0x%x\n", Afe_Get_Reg(AFE_ASRC2_CON2)); pr_debug("AFE_ASRC2_CON3 = 0x%x\n", Afe_Get_Reg(AFE_ASRC2_CON3)); pr_debug("AFE_ASRC2_CON4 = 0x%x\n", Afe_Get_Reg(AFE_ASRC2_CON4)); pr_debug("AFE_ASRC2_CON5 = 0x%x\n", Afe_Get_Reg(AFE_ASRC2_CON5)); pr_debug("AFE_ASRC2_CON6 = 0x%x\n", Afe_Get_Reg(AFE_ASRC2_CON6)); pr_debug("AFE_ASRC2_CON7 = 0x%x\n", Afe_Get_Reg(AFE_ASRC2_CON7)); pr_debug("AFE_ASRC2_CON8 = 0x%x\n", Afe_Get_Reg(AFE_ASRC2_CON8)); pr_debug("AFE_ASRC2_CON9 = 0x%x\n", Afe_Get_Reg(AFE_ASRC2_CON9)); pr_debug("AFE_ASRC2_CON10 = 0x%x\n", Afe_Get_Reg(AFE_ASRC2_CON10)); pr_debug("AFE_ASRC2_CON11 = 0x%x\n", Afe_Get_Reg(AFE_ASRC2_CON11)); pr_debug("AFE_ASRC2_CON12 = 0x%x\n", Afe_Get_Reg(AFE_ASRC2_CON12)); pr_debug("AFE_ASRC2_CON13 = 0x%x\n", Afe_Get_Reg(AFE_ASRC2_CON13)); pr_debug("AFE_ASRC2_CON14 = 0x%x\n", Afe_Get_Reg(AFE_ASRC2_CON14)); pr_debug("AFE_ASRC3_CON0 = 0x%x\n", Afe_Get_Reg(AFE_ASRC3_CON0)); pr_debug("AFE_ASRC3_CON1 = 0x%x\n", Afe_Get_Reg(AFE_ASRC3_CON1)); pr_debug("AFE_ASRC3_CON2 = 0x%x\n", Afe_Get_Reg(AFE_ASRC3_CON2)); pr_debug("AFE_ASRC3_CON3 = 0x%x\n", Afe_Get_Reg(AFE_ASRC3_CON3)); pr_debug("AFE_ASRC3_CON4 = 0x%x\n", Afe_Get_Reg(AFE_ASRC3_CON4)); pr_debug("AFE_ASRC3_CON5 = 0x%x\n", Afe_Get_Reg(AFE_ASRC3_CON5)); pr_debug("AFE_ASRC3_CON6 = 0x%x\n", Afe_Get_Reg(AFE_ASRC3_CON6)); pr_debug("AFE_ASRC3_CON7 = 0x%x\n", Afe_Get_Reg(AFE_ASRC3_CON7)); pr_debug("AFE_ASRC3_CON8 = 0x%x\n", Afe_Get_Reg(AFE_ASRC3_CON8)); pr_debug("AFE_ASRC3_CON9 = 0x%x\n", Afe_Get_Reg(AFE_ASRC3_CON9)); pr_debug("AFE_ASRC3_CON10 = 0x%x\n", Afe_Get_Reg(AFE_ASRC3_CON10)); pr_debug("AFE_ASRC3_CON11 = 0x%x\n", Afe_Get_Reg(AFE_ASRC3_CON11)); pr_debug("AFE_ASRC3_CON12 = 0x%x\n", Afe_Get_Reg(AFE_ASRC3_CON12)); pr_debug("AFE_ASRC3_CON13 = 0x%x\n", Afe_Get_Reg(AFE_ASRC3_CON13)); pr_debug("AFE_ASRC3_CON14 = 0x%x\n", Afe_Get_Reg(AFE_ASRC3_CON14)); #ifdef CONFIG_FPGA_EARLY_PORTING pr_debug("FPGA_CFG0 = 0x%x\n", Afe_Get_Reg(FPGA_CFG0)); #endif AudDrv_Clk_Off(); pr_debug("-AudDrv Afe_Log_Print\n"); }
static int Audio_i2s0_SideGen_Set(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { uint32 u32AudioI2S = 0, MclkDiv0, MclkDiv3, REG448 = 0, REG44C = 0; uint32 samplerate = 0; AudDrv_Clk_On(); printk("%s() mi2s0_hdoutput_control = %d\n", __func__, mi2s0_hdoutput_control); if (ucontrol->value.enumerated.item[0] > ARRAY_SIZE(i2s0_SIDEGEN)) { printk("return -EINVAL\n"); return -EINVAL; } mi2s0_sidegen_control = ucontrol->value.integer.value[0]; if (mi2s0_sidegen_control == 1) { samplerate = 48000; } else if (mi2s0_sidegen_control == 2) { samplerate = 44100; } else if (mi2s0_sidegen_control == 3) { samplerate = 32000; } else if (mi2s0_sidegen_control == 4) { samplerate = 16000; // here start digital part SetConnection(Soc_Aud_InterCon_Connection, Soc_Aud_InterConnectionInput_I14, Soc_Aud_InterConnectionOutput_O00); SetConnection(Soc_Aud_InterCon_Connection, Soc_Aud_InterConnectionInput_I14, Soc_Aud_InterConnectionOutput_O01); } else if (mi2s0_sidegen_control == 5) { samplerate = 8000; // here start digital part SetConnection(Soc_Aud_InterCon_Connection, Soc_Aud_InterConnectionInput_I14, Soc_Aud_InterConnectionOutput_O00); SetConnection(Soc_Aud_InterCon_Connection, Soc_Aud_InterConnectionInput_I14, Soc_Aud_InterConnectionOutput_O01); } else if (mi2s0_sidegen_control == 6) { samplerate = 16000; // here start digital part SetConnection(Soc_Aud_InterCon_Connection, Soc_Aud_InterConnectionInput_I14, Soc_Aud_InterConnectionOutput_O00); SetConnection(Soc_Aud_InterCon_Connection, Soc_Aud_InterConnectionInput_I14, Soc_Aud_InterConnectionOutput_O01); printk("%s() Soc_Aud_InterCon_Connection I01 O14\n", __func__); //phone call echo reference connection: I0/I1->O13/O14(HW Gain1)->I11 ->O24 SetConnection(Soc_Aud_InterCon_Connection, Soc_Aud_InterConnectionInput_I01, Soc_Aud_InterConnectionOutput_O14);//0x448, 0x10000 REG448 = Afe_Get_Reg(AFE_GAIN1_CONN2); printk("%s() AFE_GAIN1_CONN2 (0X448) =0x%x\n", __func__, REG448); printk("%s() Soc_Aud_InterCon_Connection I11 O24\n", __func__); SetConnection(Soc_Aud_InterCon_Connection, Soc_Aud_InterConnectionInput_I11, Soc_Aud_InterConnectionOutput_O24);//0x44c, 0x8 REG44C = Afe_Get_Reg(AFE_GAIN1_CONN3); printk("%s() AFE_GAIN1_CONN3 (0X44C) =0x%x\n", __func__, REG44C); // Set HW_GAIN1 SetHwDigitalGainMode(Soc_Aud_Hw_Digital_Gain_HW_DIGITAL_GAIN1, samplerate, 0x80); SetHwDigitalGainEnable(Soc_Aud_Hw_Digital_Gain_HW_DIGITAL_GAIN1, true); SetHwDigitalGain(0x80000, Soc_Aud_Hw_Digital_Gain_HW_DIGITAL_GAIN1); Afe_Set_Reg(AFE_DAC_CON1, 0x400, 0xF00); } if (mi2s0_sidegen_control != 0) { printk("%s() mi2s0_sidegen_control=%d, mi2s0_hdoutput_control=%d\n", __func__, mi2s0_sidegen_control, mi2s0_hdoutput_control); AudDrv_Clk_On(); Afe_Set_Reg(AUDIO_TOP_CON1, 0x2, 0x2); // I2S_SOFT_Reset Afe_Set_Reg(AUDIO_TOP_CON1, 0x1 << 4, 0x1 << 4); // I2S_SOFT_Reset uint32 Audio_I2S_Dac = 0; SetSampleRate(Soc_Aud_Digital_Block_MEM_I2S, samplerate); Audio_I2S_Dac |= (Soc_Aud_LR_SWAP_NO_SWAP << 31); // Audio_I2S_Dac |= (Soc_Aud_INV_BCK_INVESE << 29);//BCK Inv Audio_I2S_Dac |= (Soc_Aud_I2S_IN_PAD_SEL_I2S_IN_FROM_IO_MUX << 28);//I2S in from io_mux Audio_I2S_Dac |= (Soc_Aud_INV_LRCK_NO_INVERSE << 5); Audio_I2S_Dac |= (Soc_Aud_I2S_FORMAT_I2S << 3); Audio_I2S_Dac |= (Soc_Aud_I2S_WLEN_WLEN_32BITS << 1); u32AudioI2S = SampleRateTransform(samplerate) << 8; u32AudioI2S |= Soc_Aud_I2S_FORMAT_I2S << 3; // us3 I2s format u32AudioI2S |= Soc_Aud_I2S_WLEN_WLEN_32BITS << 1; // 32 BITS if (mi2s0_hdoutput_control == true) { printk("%s() mi2s0_sidegen_control = %d set low jitter\n", __func__, mi2s0_sidegen_control); MclkDiv0 = SetCLkMclk(Soc_Aud_I2S0, samplerate); //select I2S SetCLkBclk(MclkDiv0, samplerate, 2, Soc_Aud_I2S_WLEN_WLEN_32BITS); MclkDiv3 = SetCLkMclk(Soc_Aud_I2S3, samplerate); //select I2S SetCLkBclk(MclkDiv3, samplerate, 2, Soc_Aud_I2S_WLEN_WLEN_32BITS); u32AudioI2S |= Soc_Aud_LOW_JITTER_CLOCK << 12 ; //Low jitter mode Audio_I2S_Dac |= Soc_Aud_LOW_JITTER_CLOCK << 12 ; //Low jitter mode } else { printk("%s() mi2s0_sidegen_control = %d NOT set low jitter\n", __func__, mi2s0_sidegen_control); u32AudioI2S &= ~(Soc_Aud_LOW_JITTER_CLOCK << 12) ; Audio_I2S_Dac &= ~(Soc_Aud_LOW_JITTER_CLOCK << 12) ; } // start I2S DAC out if (GetMemoryPathEnable(Soc_Aud_Digital_Block_I2S_OUT_2) == false) { printk("%s(), mi2s0_sidegen_control=%d, write AFE_I2S_CON (0x%x), AFE_I2S_CON3(0x%x)\n", __func__, mi2s0_sidegen_control, Audio_I2S_Dac, u32AudioI2S); Afe_Set_Reg(AFE_I2S_CON, 0x0, 0x1); SetMemoryPathEnable(Soc_Aud_Digital_Block_I2S_OUT_2, true); Afe_Set_Reg(AFE_I2S_CON, Audio_I2S_Dac | 0x1, MASK_ALL); Afe_Set_Reg(AFE_I2S_CON3, u32AudioI2S | 1, AFE_MASK_ALL); Afe_Set_Reg(AUDIO_TOP_CON1, 0x0 << 4, 0x1 << 4); Afe_Set_Reg(AUDIO_TOP_CON1, 0x0, 0x2); // I2S_SOFT_Reset EnableAfe(true); } else { printk("%s(), mi2s0_sidegen_control=%d, write AFE_I2S_CON (0x%x), AFE_I2S_CON3(0x%x)\n", __func__, mi2s0_sidegen_control, Audio_I2S_Dac, u32AudioI2S); Afe_Set_Reg(AFE_I2S_CON, 0x0, 0x1); SetMemoryPathEnable(Soc_Aud_Digital_Block_I2S_OUT_2, true); Afe_Set_Reg(AFE_I2S_CON, Audio_I2S_Dac | 0x1, MASK_ALL); Afe_Set_Reg(AFE_I2S_CON3, u32AudioI2S | 1, AFE_MASK_ALL); Afe_Set_Reg(AUDIO_TOP_CON1, 0x0 << 4, 0x1 << 4); Afe_Set_Reg(AUDIO_TOP_CON1, 0x0, 0x2); // I2S_SOFT_Reset EnableAfe(true); } } else { SetMemoryPathEnable(Soc_Aud_Digital_Block_I2S_OUT_2, false); if (GetMemoryPathEnable(Soc_Aud_Digital_Block_I2S_OUT_2) == false) { if (mi2s0_hdoutput_control == true) { Afe_Set_Reg(AFE_I2S_CON3, 0, 1 << 12); //Clear Low jitter mode setting } Afe_Set_Reg(AFE_I2S_CON3, 0x0, 0x1); Afe_Set_Reg(AFE_I2S_CON, 0x0, 0x1); SetConnection(Soc_Aud_InterCon_DisConnect, Soc_Aud_InterConnectionInput_I14, Soc_Aud_InterConnectionOutput_O00); SetConnection(Soc_Aud_InterCon_DisConnect, Soc_Aud_InterConnectionInput_I14, Soc_Aud_InterConnectionOutput_O01); EnableAfe(false); } AudDrv_Clk_Off(); } AudDrv_Clk_Off(); return 0; }
static ssize_t mt_soc_debug_read(struct file *file, char __user *buf, size_t count, loff_t *pos) { const int size = 4096; char buffer[size]; int n = 0; AudDrv_Clk_On(); printk("mt_soc_debug_read\n"); n = scnprintf(buffer + n, size - n, "AUDIO_TOP_CON0 = 0x%x\n", Afe_Get_Reg(AUDIO_TOP_CON0)); n += scnprintf(buffer + n, size - n, "AUDIO_TOP_CON1 = 0x%x\n", Afe_Get_Reg(AUDIO_TOP_CON1)); n += scnprintf(buffer + n, size - n, "AUDIO_TOP_CON2 = 0x%x\n", Afe_Get_Reg(AUDIO_TOP_CON2)); n += scnprintf(buffer + n, size - n, "AUDIO_TOP_CON3 = 0x%x\n", Afe_Get_Reg(AUDIO_TOP_CON3)); n += scnprintf(buffer + n, size - n, "AFE_DAC_CON0 = 0x%x\n", Afe_Get_Reg(AFE_DAC_CON0)); n += scnprintf(buffer + n, size - n, "AFE_DAC_CON1 = 0x%x\n", Afe_Get_Reg(AFE_DAC_CON1)); n += scnprintf(buffer + n, size - n, "AFE_I2S_CON = 0x%x\n", Afe_Get_Reg(AFE_I2S_CON)); n += scnprintf(buffer + n, size - n, "AFE_DAIBT_CON0 = 0x%x\n", Afe_Get_Reg(AFE_DAIBT_CON0)); n += scnprintf(buffer + n, size - n, "AFE_CONN0 = 0x%x\n", Afe_Get_Reg(AFE_CONN0)); n += scnprintf(buffer + n, size - n, "AFE_CONN1 = 0x%x\n", Afe_Get_Reg(AFE_CONN1)); n += scnprintf(buffer + n, size - n, "AFE_CONN2 = 0x%x\n", Afe_Get_Reg(AFE_CONN2)); n += scnprintf(buffer + n, size - n, "AFE_CONN3 = 0x%x\n", Afe_Get_Reg(AFE_CONN3)); n += scnprintf(buffer + n, size - n, "AFE_CONN4 = 0x%x\n", Afe_Get_Reg(AFE_CONN4)); n += scnprintf(buffer + n, size - n, "AFE_I2S_CON1 = 0x%x\n", Afe_Get_Reg(AFE_I2S_CON1)); n += scnprintf(buffer + n, size - n, "AFE_I2S_CON2 = 0x%x\n", Afe_Get_Reg(AFE_I2S_CON2)); n += scnprintf(buffer + n, size - n, "AFE_MRGIF_CON = 0x%x\n", Afe_Get_Reg(AFE_MRGIF_CON)); n += scnprintf(buffer + n, size - n, "AFE_DL1_BASE = 0x%x\n", Afe_Get_Reg(AFE_DL1_BASE)); n += scnprintf(buffer + n, size - n, "AFE_DL1_CUR = 0x%x\n", Afe_Get_Reg(AFE_DL1_CUR)); n += scnprintf(buffer + n, size - n, "AFE_DL1_END = 0x%x\n", Afe_Get_Reg(AFE_DL1_END)); n += scnprintf(buffer + n, size - n, "AFE_I2S_CON3 = 0x%x\n", Afe_Get_Reg(AFE_I2S_CON3)); n += scnprintf(buffer + n, size - n, "AFE_DL2_BASE = 0x%x\n", Afe_Get_Reg(AFE_DL2_BASE)); n += scnprintf(buffer + n, size - n, "AFE_DL2_CUR = 0x%x\n", Afe_Get_Reg(AFE_DL2_CUR)); n += scnprintf(buffer + n, size - n, "AFE_DL2_END = 0x%x\n", Afe_Get_Reg(AFE_DL2_END)); n += scnprintf(buffer + n, size - n, "AFE_CONN5 = 0x%x\n", Afe_Get_Reg(AFE_CONN5)); n += scnprintf(buffer + n, size - n, "AFE_CONN_24BIT = 0x%x\n", Afe_Get_Reg(AFE_CONN_24BIT)); n += scnprintf(buffer + n, size - n, "AFE_AWB_BASE = 0x%x\n", Afe_Get_Reg(AFE_AWB_BASE)); n += scnprintf(buffer + n, size - n, "AFE_AWB_END = 0x%x\n", Afe_Get_Reg(AFE_AWB_END)); n += scnprintf(buffer + n, size - n, "AFE_AWB_CUR = 0x%x\n", Afe_Get_Reg(AFE_AWB_CUR)); n += scnprintf(buffer + n, size - n, "AFE_VUL_BASE = 0x%x\n", Afe_Get_Reg(AFE_VUL_BASE)); n += scnprintf(buffer + n, size - n, "AFE_VUL_END = 0x%x\n", Afe_Get_Reg(AFE_VUL_END)); n += scnprintf(buffer + n, size - n, "AFE_VUL_CUR = 0x%x\n", Afe_Get_Reg(AFE_VUL_CUR)); n += scnprintf(buffer + n, size - n, "AFE_CONN6 = 0x%x\n", Afe_Get_Reg(AFE_CONN6)); n += scnprintf(buffer + n, size - n, "AFE_DAI_BASE = 0x%x\n", Afe_Get_Reg(AFE_DAI_BASE)); n += scnprintf(buffer + n, size - n, "AFE_DAI_END = 0x%x\n", Afe_Get_Reg(AFE_DAI_END)); n += scnprintf(buffer + n, size - n, "AFE_DAI_CUR = 0x%x\n", Afe_Get_Reg(AFE_DAI_CUR)); n += scnprintf(buffer + n, size - n, "AFE_MEMIF_MSB = 0x%x\n", Afe_Get_Reg(AFE_MEMIF_MSB)); n += scnprintf(buffer + n, size - n, "AFE_MEMIF_MON0 = 0x%x\n", Afe_Get_Reg(AFE_MEMIF_MON0)); n += scnprintf(buffer + n, size - n, "AFE_MEMIF_MON1 = 0x%x\n", Afe_Get_Reg(AFE_MEMIF_MON1)); n += scnprintf(buffer + n, size - n, "AFE_MEMIF_MON2 = 0x%x\n", Afe_Get_Reg(AFE_MEMIF_MON2)); n += scnprintf(buffer + n, size - n, "AFE_MEMIF_MON4 = 0x%x\n", Afe_Get_Reg(AFE_MEMIF_MON4)); n += scnprintf(buffer + n, size - n, "AFE_ADDA_DL_SRC2_CON0 = 0x%x\n", Afe_Get_Reg(AFE_ADDA_DL_SRC2_CON0)); n += scnprintf(buffer + n, size - n, "AFE_ADDA_DL_SRC2_CON1 = 0x%x\n", Afe_Get_Reg(AFE_ADDA_DL_SRC2_CON1)); n += scnprintf(buffer + n, size - n, "AFE_ADDA_UL_SRC_CON0 = 0x%x\n", Afe_Get_Reg(AFE_ADDA_UL_SRC_CON0)); n += scnprintf(buffer + n, size - n, "AFE_ADDA_UL_SRC_CON1 = 0x%x\n", Afe_Get_Reg(AFE_ADDA_UL_SRC_CON1)); n += scnprintf(buffer + n, size - n, "AFE_ADDA_TOP_CON0 = 0x%x\n", Afe_Get_Reg(AFE_ADDA_TOP_CON0)); n += scnprintf(buffer + n, size - n, "AFE_ADDA_UL_DL_CON0 = 0x%x\n", Afe_Get_Reg(AFE_ADDA_UL_DL_CON0)); n += scnprintf(buffer + n, size - n, "AFE_ADDA_SRC_DEBUG = 0x%x\n", Afe_Get_Reg(AFE_ADDA_SRC_DEBUG)); n += scnprintf(buffer + n, size - n, "AFE_ADDA_SRC_DEBUG_MON0 = 0x%x\n", Afe_Get_Reg(AFE_ADDA_SRC_DEBUG_MON0)); n += scnprintf(buffer + n, size - n, "AFE_ADDA_SRC_DEBUG_MON1 = 0x%x\n", Afe_Get_Reg(AFE_ADDA_SRC_DEBUG_MON1)); n += scnprintf(buffer + n, size - n, "AFE_ADDA_NEWIF_CFG0 = 0x%x\n", Afe_Get_Reg(AFE_ADDA_NEWIF_CFG0)); n += scnprintf(buffer + n, size - n, "AFE_ADDA_NEWIF_CFG1 = 0x%x\n", Afe_Get_Reg(AFE_ADDA_NEWIF_CFG1)); n += scnprintf(buffer + n, size - n, "AFE_SIDETONE_DEBUG = 0x%x\n", Afe_Get_Reg(AFE_SIDETONE_DEBUG)); n += scnprintf(buffer + n, size - n, "AFE_SIDETONE_MON = 0x%x\n", Afe_Get_Reg(AFE_SIDETONE_MON)); n += scnprintf(buffer + n, size - n, "AFE_SIDETONE_CON0 = 0x%x\n", Afe_Get_Reg(AFE_SIDETONE_CON0)); n += scnprintf(buffer + n, size - n, "AFE_SIDETONE_COEFF = 0x%x\n", Afe_Get_Reg(AFE_SIDETONE_COEFF)); n += scnprintf(buffer + n, size - n, "AFE_SIDETONE_CON1 = 0x%x\n", Afe_Get_Reg(AFE_SIDETONE_CON1)); n += scnprintf(buffer + n, size - n, "AFE_SIDETONE_GAIN = 0x%x\n", Afe_Get_Reg(AFE_SIDETONE_GAIN)); n += scnprintf(buffer + n, size - n, "AFE_SGEN_CON0 = 0x%x\n", Afe_Get_Reg(AFE_SGEN_CON0)); n += scnprintf(buffer + n, size - n, "AFE_TOP_CON0 = 0x%x\n", Afe_Get_Reg(AFE_TOP_CON0)); n += scnprintf(buffer + n, size - n, "AFE_ADDA_PREDIS_CON0 = 0x%x\n", Afe_Get_Reg(AFE_ADDA_PREDIS_CON0)); n += scnprintf(buffer + n, size - n, "AFE_ADDA_PREDIS_CON1 = 0x%x\n", Afe_Get_Reg(AFE_ADDA_PREDIS_CON1)); n += scnprintf(buffer + n, size - n, "AFE_MRG_MON0 = 0x%x\n", Afe_Get_Reg(AFE_MRGIF_MON0)); n += scnprintf(buffer + n, size - n, "AFE_MRG_MON1 = 0x%x\n", Afe_Get_Reg(AFE_MRGIF_MON1)); n += scnprintf(buffer + n, size - n, "AFE_MRG_MON2 = 0x%x\n", Afe_Get_Reg(AFE_MRGIF_MON2)); n += scnprintf(buffer + n, size - n, "AFE_MOD_DAI_BASE = 0x%x\n", Afe_Get_Reg(AFE_MOD_DAI_BASE)); n += scnprintf(buffer + n, size - n, "AFE_MOD_DAI_END = 0x%x\n", Afe_Get_Reg(AFE_MOD_DAI_END)); n += scnprintf(buffer + n, size - n, "AFE_MOD_DAI_CUR = 0x%x\n", Afe_Get_Reg(AFE_MOD_DAI_CUR)); n += scnprintf(buffer + n, size - n, "AFE_DL1_D2_BASE = 0x%x\n", Afe_Get_Reg(AFE_DL1_D2_BASE)); n += scnprintf(buffer+n,size-n,"AFE_DL1_D2_END = 0x%x\n", Afe_Get_Reg(AFE_DL1_D2_END)); n += scnprintf(buffer + n, size - n, "AFE_DL1_D2_CUR = 0x%x\n", Afe_Get_Reg(AFE_DL1_D2_CUR)); n += scnprintf(buffer + n, size - n, "AFE_VUL_D2_BASE = 0x%x\n", Afe_Get_Reg(AFE_VUL_D2_BASE)); n += scnprintf(buffer + n, size - n, "AFE_VUL_D2_END = 0x%x\n", Afe_Get_Reg(AFE_VUL_D2_END)); n += scnprintf(buffer + n, size - n, "AFE_VUL_D2_CUR = 0x%x\n", Afe_Get_Reg(AFE_VUL_D2_CUR)); n += scnprintf(buffer + n, size - n, "AFE_IRQ_CON = 0x%x\n", Afe_Get_Reg(AFE_IRQ_MCU_CON)); n += scnprintf(buffer + n, size - n, "AFE_IRQ_MCU_CON = 0x%x\n", Afe_Get_Reg(AFE_IRQ_MCU_CON)); n += scnprintf(buffer + n, size - n, "AFE_IRQ_STATUS = 0x%x\n", Afe_Get_Reg(AFE_IRQ_MCU_STATUS)); n += scnprintf(buffer + n, size - n, "AFE_IRQ_CLR = 0x%x\n", Afe_Get_Reg(AFE_IRQ_MCU_CLR)); n += scnprintf(buffer + n, size - n, "AFE_IRQ_MCU_CNT1 = 0x%x\n", Afe_Get_Reg(AFE_IRQ_MCU_CNT1)); n += scnprintf(buffer + n, size - n, "AFE_IRQ_MCU_CNT2 = 0x%x\n", Afe_Get_Reg(AFE_IRQ_MCU_CNT2)); n += scnprintf(buffer + n, size - n, "AFE_IRQ_MCU_EN = 0x%x\n", Afe_Get_Reg(AFE_IRQ_MCU_EN)); n += scnprintf(buffer + n, size - n, "AFE_IRQ_MON2 = 0x%x\n", Afe_Get_Reg(AFE_IRQ_MCU_MON2)); n += scnprintf(buffer + n, size - n, "AFE_IRQ1_CNT_MON = 0x%x\n", Afe_Get_Reg(AFE_IRQ1_MCU_CNT_MON)); n += scnprintf(buffer + n, size - n, "AFE_IRQ2_CNT_MON = 0x%x\n", Afe_Get_Reg(AFE_IRQ2_MCU_CNT_MON)); n += scnprintf(buffer + n, size - n, "AFE_IRQ1_EN_CNT_MON = 0x%x\n", Afe_Get_Reg(AFE_IRQ1_MCU_EN_CNT_MON)); n += scnprintf(buffer + n, size - n, "AFE_MEMIF_MAXLEN = 0x%x\n", Afe_Get_Reg(AFE_MEMIF_MAXLEN)); n += scnprintf(buffer + n, size - n, "AFE_MEMIF_PBUF_SIZE = 0x%x\n", Afe_Get_Reg(AFE_MEMIF_PBUF_SIZE)); n += scnprintf(buffer + n, size - n, "AFE_IRQ_MCU_CNT7 = 0x%x\n", Afe_Get_Reg(AFE_IRQ_MCU_CNT7)); // k2 add n += scnprintf(buffer + n, size - n, "AFE_APLL1_TUNER_CFG = 0x%x\n", Afe_Get_Reg(AFE_APLL1_TUNER_CFG)); n += scnprintf(buffer + n, size - n, "AFE_APLL2_TUNER_CFG = 0x%x\n", Afe_Get_Reg(AFE_APLL2_TUNER_CFG)); n += scnprintf(buffer + n, size - n, "AFE_GAIN1_CON0 = 0x%x\n", Afe_Get_Reg(AFE_GAIN1_CON0)); n += scnprintf(buffer + n, size - n, "AFE_GAIN1_CON1 = 0x%x\n", Afe_Get_Reg(AFE_GAIN1_CON1)); n += scnprintf(buffer + n, size - n, "AFE_GAIN1_CON2 = 0x%x\n", Afe_Get_Reg(AFE_GAIN1_CON2)); n += scnprintf(buffer + n, size - n, "AFE_GAIN1_CON3 = 0x%x\n", Afe_Get_Reg(AFE_GAIN1_CON3)); n += scnprintf(buffer + n, size - n, "AFE_GAIN1_CONN = 0x%x\n", Afe_Get_Reg(AFE_GAIN1_CONN)); n += scnprintf(buffer + n, size - n, "AFE_GAIN1_CUR = 0x%x\n", Afe_Get_Reg(AFE_GAIN1_CUR)); n += scnprintf(buffer + n, size - n, "AFE_GAIN2_CON0 = 0x%x\n", Afe_Get_Reg(AFE_GAIN2_CON0)); n += scnprintf(buffer + n, size - n, "AFE_GAIN2_CON1 = 0x%x\n", Afe_Get_Reg(AFE_GAIN2_CON1)); n += scnprintf(buffer + n, size - n, "AFE_GAIN2_CON2 = 0x%x\n", Afe_Get_Reg(AFE_GAIN2_CON2)); n += scnprintf(buffer + n, size - n, "AFE_GAIN2_CON3 = 0x%x\n", Afe_Get_Reg(AFE_GAIN2_CON3)); n += scnprintf(buffer + n, size - n, "AFE_GAIN2_CONN = 0x%x\n", Afe_Get_Reg(AFE_GAIN2_CONN)); n += scnprintf(buffer + n, size - n, "AFE_GAIN2_CUR = 0x%x\n", Afe_Get_Reg(AFE_GAIN2_CUR)); n += scnprintf(buffer + n, size - n, "AFE_GAIN2_CONN2 = 0x%x\n", Afe_Get_Reg(AFE_GAIN2_CONN2)); n += scnprintf(buffer + n, size - n, "FPGA_CFG2 = 0x%x\n", Afe_Get_Reg(FPGA_CFG2)); n += scnprintf(buffer + n, size - n, "FPGA_CFG3 = 0x%x\n", Afe_Get_Reg(FPGA_CFG3)); n += scnprintf(buffer + n, size - n, "FPGA_CFG0 = 0x%x\n", Afe_Get_Reg(FPGA_CFG0)); n += scnprintf(buffer + n, size - n, "FPGA_CFG1 = 0x%x\n", Afe_Get_Reg(FPGA_CFG1)); n += scnprintf(buffer + n, size - n, "FPGA_STC = 0x%x\n", Afe_Get_Reg(FPGA_STC)); n += scnprintf(buffer + n, size - n, "AFE_ASRC_CON0 = 0x%x\n", Afe_Get_Reg(AFE_ASRC_CON0)); n += scnprintf(buffer + n, size - n, "AFE_ASRC_CON1 = 0x%x\n", Afe_Get_Reg(AFE_ASRC_CON1)); n += scnprintf(buffer + n, size - n, "AFE_ASRC_CON2 = 0x%x\n", Afe_Get_Reg(AFE_ASRC_CON2)); n += scnprintf(buffer + n, size - n, "AFE_ASRC_CON3 = 0x%x\n", Afe_Get_Reg(AFE_ASRC_CON3)); n += scnprintf(buffer + n, size - n, "AFE_ASRC_CON4 = 0x%x\n", Afe_Get_Reg(AFE_ASRC_CON4)); n += scnprintf(buffer + n, size - n, "AFE_ASRC_CON5 = 0x%x\n", Afe_Get_Reg(AFE_ASRC_CON5)); n += scnprintf(buffer + n, size - n, "AFE_ASRC_CON6 = 0x%x\n", Afe_Get_Reg(AFE_ASRC_CON6)); n += scnprintf(buffer + n, size - n, "AFE_ASRC_CON7 = 0x%x\n", Afe_Get_Reg(AFE_ASRC_CON7)); n += scnprintf(buffer + n, size - n, "AFE_ASRC_CON8 = 0x%x\n", Afe_Get_Reg(AFE_ASRC_CON8)); n += scnprintf(buffer + n, size - n, "AFE_ASRC_CON9 = 0x%x\n", Afe_Get_Reg(AFE_ASRC_CON9)); n += scnprintf(buffer + n, size - n, "AFE_ASRC_CON10 = 0x%x\n", Afe_Get_Reg(AFE_ASRC_CON10)); n += scnprintf(buffer + n, size - n, "AFE_ASRC_CON11 = 0x%x\n", Afe_Get_Reg(AFE_ASRC_CON11)); n += scnprintf(buffer + n, size - n, "PCM_INTF_CON1 = 0x%x\n", Afe_Get_Reg(PCM_INTF_CON)); n += scnprintf(buffer + n, size - n, "PCM_INTF_CON2 = 0x%x\n", Afe_Get_Reg(PCM_INTF_CON2)); n += scnprintf(buffer + n, size - n, "PCM2_INTF_CON = 0x%x\n", Afe_Get_Reg(PCM2_INTF_CON)); n += scnprintf(buffer + n, size - n, "AFE_ASRC_CON13 = 0x%x\n", Afe_Get_Reg(AFE_ASRC_CON13)); n += scnprintf(buffer + n, size - n, "AFE_ASRC_CON14 = 0x%x\n", Afe_Get_Reg(AFE_ASRC_CON14)); n += scnprintf(buffer + n, size - n, "AFE_ASRC_CON15 = 0x%x\n", Afe_Get_Reg(AFE_ASRC_CON15)); n += scnprintf(buffer + n, size - n, "AFE_ASRC_CON16 = 0x%x\n", Afe_Get_Reg(AFE_ASRC_CON16)); n += scnprintf(buffer + n, size - n, "AFE_ASRC_CON17 = 0x%x\n", Afe_Get_Reg(AFE_ASRC_CON17)); n += scnprintf(buffer + n, size - n, "AFE_ASRC_CON18 = 0x%x\n", Afe_Get_Reg(AFE_ASRC_CON18)); n += scnprintf(buffer + n, size - n, "AFE_ASRC_CON19 = 0x%x\n", Afe_Get_Reg(AFE_ASRC_CON19)); n += scnprintf(buffer + n, size - n, "AFE_ASRC_CON20 = 0x%x\n", Afe_Get_Reg(AFE_ASRC_CON20)); n += scnprintf(buffer + n, size - n, "AFE_ASRC_CON21 = 0x%x\n", Afe_Get_Reg(AFE_ASRC_CON21)); n += scnprintf(buffer + n, size - n, "AFE_ASRC4_CON0 = 0x%x\n", Afe_Get_Reg(AFE_ASRC4_CON0)); n += scnprintf(buffer + n, size - n, "AFE_ASRC4_CON1 = 0x%x\n", Afe_Get_Reg(AFE_ASRC4_CON1)); n += scnprintf(buffer + n, size - n, "AFE_ASRC4_CON2 = 0x%x\n", Afe_Get_Reg(AFE_ASRC4_CON2)); n += scnprintf(buffer + n, size - n, "AFE_ASRC4_CON3 = 0x%x\n", Afe_Get_Reg(AFE_ASRC4_CON3)); n += scnprintf(buffer + n, size - n, "AFE_ASRC4_CON4 = 0x%x\n", Afe_Get_Reg(AFE_ASRC4_CON4)); n += scnprintf(buffer + n, size - n, "AFE_ASRC4_CON5 = 0x%x\n", Afe_Get_Reg(AFE_ASRC4_CON5)); n += scnprintf(buffer + n, size - n, "AFE_ASRC4_CON6 = 0x%x\n", Afe_Get_Reg(AFE_ASRC4_CON6)); n += scnprintf(buffer + n, size - n, "AFE_ASRC4_CON7 = 0x%x\n", Afe_Get_Reg(AFE_ASRC4_CON7)); n += scnprintf(buffer + n, size - n, "AFE_ASRC2_CON0 = 0x%x\n", Afe_Get_Reg(AFE_ASRC2_CON0)); n += scnprintf(buffer + n, size - n, "AFE_ASRC2_CON5 = 0x%x\n", Afe_Get_Reg(AFE_ASRC2_CON5)); n += scnprintf(buffer + n, size - n, "AFE_ASRC2_CON6 = 0x%x\n", Afe_Get_Reg(AFE_ASRC2_CON6)); n += scnprintf(buffer + n, size - n, "AFE_ASRC3_CON0 = 0x%x\n", Afe_Get_Reg(AFE_ASRC3_CON0)); n += scnprintf(buffer + n, size - n, "AFE_ASRC3_CON5 = 0x%x\n", Afe_Get_Reg(AFE_ASRC3_CON5)); n += scnprintf(buffer + n, size - n, "AFE_ASRC3_CON6 = 0x%x\n", Afe_Get_Reg(AFE_ASRC3_CON6)); // k2 add n += scnprintf(buffer + n, size - n, "AFE_ADDA4_TOP_CON0 = 0x%x\n", Afe_Get_Reg(AFE_ADDA4_TOP_CON0)); n += scnprintf(buffer + n, size - n, "AFE_ADDA4_UL_SRC_CON0 = 0x%x\n", Afe_Get_Reg(AFE_ADDA4_UL_SRC_CON0)); n += scnprintf(buffer + n, size - n, "AFE_ADDA4_UL_SRC_CON1 = 0x%x\n", Afe_Get_Reg(AFE_ADDA4_UL_SRC_CON1)); n += scnprintf(buffer + n, size - n, "AFE_ADDA4_NEWIF_CFG0 = 0x%x\n", Afe_Get_Reg(AFE_ADDA4_NEWIF_CFG0)); n += scnprintf(buffer + n, size - n, "AFE_ADDA4_NEWIF_CFG1 = 0x%x\n", Afe_Get_Reg(AFE_ADDA4_NEWIF_CFG1)); n += scnprintf(buffer + n, size - n, "AUDIO_CLK_AUDDIV_0 = 0x%x\n", GetClkCfg(AUDIO_CLK_AUDDIV_0)); n += scnprintf(buffer + n, size - n, "AUDIO_CLK_AUDDIV_1 = 0x%x\n", GetClkCfg(AUDIO_CLK_AUDDIV_1)); printk("mt_soc_debug_read len = %d\n", n); AudDrv_Clk_Off(); return simple_read_from_buffer(buf, count, pos, buffer, n); }
static int mtk_pcm_hdmi_start(struct snd_pcm_substream *substream) { struct snd_pcm_runtime *runtime = substream->runtime; uint32 mclkDiv; pr_debug("[%s] runtime->rate = %d, runtime->channels = %d, runtime->period_size = %d\n", __func__, runtime->rate, runtime->channels, (unsigned int)runtime->period_size); SetMemifSubStream(Soc_Aud_Digital_Block_MEM_HDMI, substream); /* HDMI I2S clock setting */ mclkDiv = SetCLkMclk(Soc_Aud_HDMI_MCK, runtime->rate); SetCLkHdmiBclk(mclkDiv, runtime->rate, 2, 32); /* enable mclk divider */ EnableSpdifDivPower(AUDIO_APLL_SPDIF_DIV, true); /* enable bck divider */ EnableHDMIDivPower(AUDIO_APLL_HDMI_BCK_DIV, true); /* turn on hdmi clk */ SetHdmiClkOn(); /* config hdmi irq */ SetIrqMcuCounter(Soc_Aud_IRQ_MCU_MODE_IRQ5_MCU_MODE, runtime->period_size); /* config hdmi interface */ if (runtime->format == SNDRV_PCM_FORMAT_S32_LE || runtime->format == SNDRV_PCM_FORMAT_U32_LE) { SetMemIfFetchFormatPerSample(Soc_Aud_Digital_Block_MEM_HDMI, AFE_WLEN_32_BIT_ALIGN_24BIT_DATA_8BIT_0); Afe_Set_Reg(AFE_HDMI_OUT_CON0, 0x2, 0x2); } else SetMemIfFetchFormatPerSample(Soc_Aud_Digital_Block_MEM_HDMI, AFE_WLEN_16_BIT); SetHdmiTdm1Config(runtime->channels, AFE_DATA_WLEN_32BIT); SetHdmiTdm2Config(runtime->channels); SetHDMIChannels(runtime->channels); /* config hdmi connection */ SetHdmiPcmInterConnection(Soc_Aud_InterCon_Connection, runtime->channels); /* Enable hdmi Memory Path */ SetMemoryPathEnable(Soc_Aud_Digital_Block_MEM_HDMI, true); /* enable irq */ SetIrqEnable(Soc_Aud_IRQ_MCU_MODE_IRQ5_MCU_MODE, true); /* enable hdmi out */ SetHDMIEnable(true); /* enable afe */ EnableAfe(true); /* enable TDM */ SetTDMEnable(runtime->channels); pr_debug ("[%s] AFE_IRQ_MCU_STATUS = 0x%x AFE_IRQ_MCU_EN = 0x%x AFE_IRQ_CNT5=0x%x AFE_IRQ_DEBUG =0x%x\n", __func__, Afe_Get_Reg(AFE_IRQ_MCU_STATUS), Afe_Get_Reg(AFE_IRQ_MCU_EN), Afe_Get_Reg(AFE_IRQ_CNT5), Afe_Get_Reg(AFE_IRQ_DEBUG)); return 0; }
static ssize_t mt_soc_debug_write(struct file *f, const char __user *buf, size_t count, loff_t *offset) { int ret = 0; char InputString[256]; char *token1 = NULL ; char *token2 = NULL ; char *token3 = NULL; char *token4 = NULL; char *token5 = NULL; char *temp = NULL; long unsigned int regaddr = 0; long unsigned int regvalue = 0; char delim[] = " ,"; memset((void *)InputString, 0, 256); if (copy_from_user((InputString), buf, count)) { printk("copy_from_user mt_soc_debug_write count = %zu temp = %s\n", count, InputString); } temp = kstrdup(InputString, GFP_KERNEL); printk("copy_from_user mt_soc_debug_write count = %zu temp = %s pointer = %p\n", count, InputString, InputString); token1 = strsep(&temp, delim); printk("token1 \n"); printk("token1 = %s\n", token1); token2 = strsep(&temp, delim); printk("token2 = %s\n", token2); token3 = strsep(&temp, delim); printk("token3 = %s\n", token3); token4 = strsep(&temp, delim); printk("token4 = %s\n", token4); token5 = strsep(&temp, delim); printk("token5 = %s\n", token5); if (strcmp(token1, ParSetkeyAfe) == 0) { printk("strcmp (token1,ParSetkeyAfe) \n"); ret = strict_strtoul(token3, 16, ®addr); ret = strict_strtoul(token5, 16, ®value); printk("%s regaddr = 0x%lu regvalue = 0x%lu\n", ParSetkeyAfe, regaddr, regvalue); Afe_Set_Reg(regaddr, regvalue, 0xffffffff); regvalue = Afe_Get_Reg(regaddr); printk("%s regaddr = 0x%lu regvalue = 0x%lu\n", ParSetkeyAfe, regaddr, regvalue); } if (strcmp(token1, ParSetkeyAna) == 0) { printk("strcmp (token1,ParSetkeyAna)\n"); ret = strict_strtoul(token3, 16, ®addr); ret = strict_strtoul(token5, 16, ®value); printk("%s regaddr = 0x%lu regvalue = 0x%lu\n", ParSetkeyAna, regaddr, regvalue); //clk_buf_ctrl(CLK_BUF_AUDIO, true); //k2 need? AudDrv_Clk_On(); audckbufEnable(true); Ana_Set_Reg(regaddr, regvalue, 0xffffffff); regvalue = Ana_Get_Reg(regaddr); printk("%s regaddr = 0x%lu regvalue = 0x%lu\n", ParSetkeyAna, regaddr, regvalue); } if (strcmp(token1, ParSetkeyCfg) == 0) { printk("strcmp (token1,ParSetkeyCfg)\n"); ret = strict_strtoul(token3, 16, ®addr); ret = strict_strtoul(token5, 16, ®value); printk("%s regaddr = 0x%lu regvalue = 0x%lu\n", ParSetkeyCfg, regaddr, regvalue); SetClkCfg(regaddr, regvalue, 0xffffffff); regvalue = GetClkCfg(regaddr); printk("%s regaddr = 0x%lu regvalue = 0x%lu\n", ParSetkeyCfg, regaddr, regvalue); } if (strcmp(token1, PareGetkeyAfe) == 0) { printk("strcmp (token1,PareGetkeyAfe)\n"); ret = strict_strtoul(token3, 16, ®addr); regvalue = Afe_Get_Reg(regaddr); printk("%s regaddr = 0x%lu regvalue = 0x%lu\n", PareGetkeyAfe, regaddr, regvalue); } if (strcmp(token1, PareGetkeyAna) == 0) { printk("strcmp (token1,PareGetkeyAna)\n"); ret = strict_strtoul(token3, 16, ®addr); regvalue = Ana_Get_Reg(regaddr); printk("%s regaddr = 0x%lu regvalue = 0x%lu\n", PareGetkeyAna, regaddr, regvalue); } return count; }
void Afe_Log_Print(void) { AudDrv_Clk_On(); printk("+AudDrv Afe_Log_Print \n"); printk("AUDIOAFE_TOP_CON0 = 0x%x\n", Afe_Get_Reg(AUDIO_TOP_CON0)); printk("AUDIO_TOP_CON1 = 0x%x\n", Afe_Get_Reg(AUDIO_TOP_CON1)); printk("AUDIO_TOP_CON2 = 0x%x\n", Afe_Get_Reg(AUDIO_TOP_CON2)); printk("AUDIO_TOP_CON3 = 0x%x\n", Afe_Get_Reg(AUDIO_TOP_CON3)); printk("AFE_DAC_CON0 = 0x%x\n", Afe_Get_Reg(AFE_DAC_CON0)); printk("AFE_DAC_CON1 = 0x%x\n", Afe_Get_Reg(AFE_DAC_CON1)); printk("AFE_I2S_CON = 0x%x\n", Afe_Get_Reg(AFE_I2S_CON)); printk("AFE_DAIBT_CON0 = 0x%x\n",Afe_Get_Reg(AFE_DAIBT_CON0)); printk("AFE_CONN0 = 0x%x\n", Afe_Get_Reg(AFE_CONN0)); printk("AFE_CONN1 = 0x%x\n", Afe_Get_Reg(AFE_CONN1)); printk("AFE_CONN2 = 0x%x\n", Afe_Get_Reg(AFE_CONN2)); printk("AFE_CONN3 = 0x%x\n", Afe_Get_Reg(AFE_CONN3)); printk("AFE_CONN4 = 0x%x\n", Afe_Get_Reg(AFE_CONN4)); printk("AFE_I2S_CON1 = 0x%x\n", Afe_Get_Reg(AFE_I2S_CON1)); printk("AFE_I2S_CON2 = 0x%x\n", Afe_Get_Reg(AFE_I2S_CON2)); printk("AFE_MRGIF_CON = 0x%x\n",Afe_Get_Reg(AFE_MRGIF_CON)); printk("AFE_DL1_BASE = 0x%x\n", Afe_Get_Reg(AFE_DL1_BASE)); printk("AFE_DL1_CUR = 0x%x\n", Afe_Get_Reg(AFE_DL1_CUR)); printk("AFE_DL1_END = 0x%x\n", Afe_Get_Reg(AFE_DL1_END)); printk("AFE_I2S_CON3 = 0x%x\n", Afe_Get_Reg(AFE_I2S_CON3)); printk("AFE_DL2_BASE = 0x%x\n", Afe_Get_Reg(AFE_DL2_BASE)); printk("AFE_DL2_CUR = 0x%x\n", Afe_Get_Reg(AFE_DL2_CUR)); printk("AFE_DL2_END = 0x%x\n", Afe_Get_Reg(AFE_DL2_END)); printk("AFE_CONN5 = 0x%x\n", Afe_Get_Reg(AFE_CONN5)); printk("AFE_CONN_24BIT = 0x%x\n", Afe_Get_Reg(AFE_CONN_24BIT)); printk("AFE_AWB_BASE = 0x%x\n", Afe_Get_Reg(AFE_AWB_BASE)); printk("AFE_AWB_END = 0x%x\n", Afe_Get_Reg(AFE_AWB_END)); printk("AFE_AWB_CUR = 0x%x\n", Afe_Get_Reg(AFE_AWB_CUR)); printk("AFE_VUL_BASE = 0x%x\n", Afe_Get_Reg(AFE_VUL_BASE)); printk("AFE_VUL_END = 0x%x\n", Afe_Get_Reg(AFE_VUL_END)); printk("AFE_VUL_CUR = 0x%x\n", Afe_Get_Reg(AFE_VUL_CUR)); printk("AFE_CONN6 = 0x%x\n", Afe_Get_Reg(AFE_CONN6)); printk("AFE_DAI_BASE = 0x%x\n",Afe_Get_Reg(AFE_DAI_BASE)); printk("AFE_DAI_END = 0x%x\n",Afe_Get_Reg(AFE_DAI_END)); printk("AFE_DAI_CUR = 0x%x\n",Afe_Get_Reg(AFE_DAI_CUR)); printk("AFE_MEMIF_MSB = 0x%x\n", Afe_Get_Reg(AFE_MEMIF_MSB)); printk("AFE_MEMIF_MON0 = 0x%x\n", Afe_Get_Reg(AFE_MEMIF_MON0)); printk("AFE_MEMIF_MON1 = 0x%x\n", Afe_Get_Reg(AFE_MEMIF_MON1)); printk("AFE_MEMIF_MON2 = 0x%x\n", Afe_Get_Reg(AFE_MEMIF_MON2)); //printk("AFE_MEMIF_MON3 = 0x%x\n",Afe_Get_Reg(AFE_MEMIF_MON3)); printk("AFE_MEMIF_MON4 = 0x%x\n", Afe_Get_Reg(AFE_MEMIF_MON4)); printk("AFE_ADDA_DL_SRC2_CON0 = 0x%x\n", Afe_Get_Reg(AFE_ADDA_DL_SRC2_CON0)); printk("AFE_ADDA_DL_SRC2_CON1 = 0x%x\n", Afe_Get_Reg(AFE_ADDA_DL_SRC2_CON1)); printk("AFE_ADDA_UL_SRC_CON0 = 0x%x\n", Afe_Get_Reg(AFE_ADDA_UL_SRC_CON0)); printk("AFE_ADDA_UL_SRC_CON1 = 0x%x\n", Afe_Get_Reg(AFE_ADDA_UL_SRC_CON1)); printk("AFE_ADDA_TOP_CON0 = 0x%x\n", Afe_Get_Reg(AFE_ADDA_TOP_CON0)); printk("AFE_ADDA_UL_DL_CON0 = 0x%x\n", Afe_Get_Reg(AFE_ADDA_UL_DL_CON0)); printk("AFE_ADDA_SRC_DEBUG = 0x%x\n", Afe_Get_Reg(AFE_ADDA_SRC_DEBUG)); printk("AFE_ADDA_SRC_DEBUG_MON0 = 0x%x\n", Afe_Get_Reg(AFE_ADDA_SRC_DEBUG_MON0)); printk("AFE_ADDA_SRC_DEBUG_MON1 = 0x%x\n", Afe_Get_Reg(AFE_ADDA_SRC_DEBUG_MON1)); printk("AFE_ADDA_NEWIF_CFG0 = 0x%x\n", Afe_Get_Reg(AFE_ADDA_NEWIF_CFG0)); printk("AFE_ADDA_NEWIF_CFG1 = 0x%x\n", Afe_Get_Reg(AFE_ADDA_NEWIF_CFG1)); printk("AFE_SIDETONE_DEBUG = 0x%x\n", Afe_Get_Reg(AFE_SIDETONE_DEBUG)); printk("AFE_SIDETONE_MON = 0x%x\n", Afe_Get_Reg(AFE_SIDETONE_MON)); printk("AFE_SIDETONE_CON0 = 0x%x\n", Afe_Get_Reg(AFE_SIDETONE_CON0)); printk("AFE_SIDETONE_COEFF = 0x%x\n", Afe_Get_Reg(AFE_SIDETONE_COEFF)); printk("AFE_SIDETONE_CON1 = 0x%x\n", Afe_Get_Reg(AFE_SIDETONE_CON1)); printk("AFE_SIDETONE_GAIN = 0x%x\n", Afe_Get_Reg(AFE_SIDETONE_GAIN)); printk("AFE_SGEN_CON0 = 0x%x\n", Afe_Get_Reg(AFE_SGEN_CON0)); printk("AFE_SGEN_CON0 = 0x%x\n", Afe_Get_Reg(AFE_SGEN_CON1)); printk("AFE_TOP_CON0 = 0x%x\n", Afe_Get_Reg(AFE_TOP_CON0)); printk("AFE_ADDA_PREDIS_CON0 = 0x%x\n", Afe_Get_Reg(AFE_ADDA_PREDIS_CON0)); printk("AFE_ADDA_PREDIS_CON1 = 0x%x\n", Afe_Get_Reg(AFE_ADDA_PREDIS_CON1)); printk("AFE_MRG_MON0 = 0x%x\n",Afe_Get_Reg(AFE_MRGIF_MON0)); printk("AFE_MRG_MON1 = 0x%x\n",Afe_Get_Reg(AFE_MRGIF_MON1)); printk("AFE_MRG_MON2 = 0x%x\n",Afe_Get_Reg(AFE_MRGIF_MON2)); printk("AFE_MOD_DAI_BASE = 0x%x\n", Afe_Get_Reg(AFE_MOD_DAI_BASE)); printk("AFE_MOD_DAI_END = 0x%x\n", Afe_Get_Reg(AFE_MOD_DAI_END)); printk("AFE_MOD_DAI_CUR = 0x%x\n", Afe_Get_Reg(AFE_MOD_DAI_CUR)); printk("AFE_HDMI_OUT_CON0 = 0x%x\n", Afe_Get_Reg(AFE_HDMI_OUT_CON0)); printk("AFE_HDMI_BASE = 0x%x\n", Afe_Get_Reg(AFE_HDMI_BASE)); printk("AFE_HDMI_CUR = 0x%x\n", Afe_Get_Reg(AFE_HDMI_CUR)); printk("AFE_HDMI_END = 0x%x\n", Afe_Get_Reg(AFE_HDMI_END)); printk("AFE_HDMI_CONN0 = 0x%x\n", Afe_Get_Reg(AFE_HDMI_CONN0)); //printk("AFE_IRQ_CON = 0x%x\n",Afe_Get_Reg(AFE_IRQ_CON)); printk("AFE_IRQ_MCU_CON = 0x%x\n", Afe_Get_Reg(AFE_IRQ_MCU_CON)); printk("AFE_IRQ_STATUS = 0x%x\n", Afe_Get_Reg(AFE_IRQ_MCU_STATUS)); printk("AFE_IRQ_CLR = 0x%x\n", Afe_Get_Reg(AFE_IRQ_MCU_CLR)); printk("AFE_IRQ_MCU_CNT1 = 0x%x\n", Afe_Get_Reg(AFE_IRQ_MCU_CNT1)); printk("AFE_IRQ_MCU_CNT2 = 0x%x\n", Afe_Get_Reg(AFE_IRQ_MCU_CNT2)); printk("AFE_IRQ_MCU_EN = 0x%x\n", Afe_Get_Reg(AFE_IRQ_MCU_EN)); printk("AFE_IRQ_MON2 = 0x%x\n", Afe_Get_Reg(AFE_IRQ_MCU_MON2)); //printk("AFE_IRQ_CNT5 = 0x%x\n",Afe_Get_Reg(AFE_IRQ_CNT5));MT6582 printk("AFE_IRQ1_CNT_MON = 0x%x\n", Afe_Get_Reg(AFE_IRQ1_MCU_CNT_MON)); printk("AFE_IRQ2_CNT_MON = 0x%x\n", Afe_Get_Reg(AFE_IRQ2_MCU_CNT_MON)); printk("AFE_IRQ1_EN_CNT_MON = 0x%x\n", Afe_Get_Reg(AFE_IRQ1_MCU_EN_CNT_MON)); //printk("AFE_IRQ5_MCU_EN_CNT_MON = 0x%x\n",Afe_Get_Reg(AFE_IRQ5_MCU_EN_CNT_MON)); printk("AFE_MEMIF_MAXLEN = 0x%x\n", Afe_Get_Reg(AFE_MEMIF_MAXLEN)); printk("AFE_MEMIF_PBUF_SIZE = 0x%x\n", Afe_Get_Reg(AFE_MEMIF_PBUF_SIZE)); printk("AFE_GAIN1_CON0 = 0x%x\n", Afe_Get_Reg(AFE_GAIN1_CON0)); printk("AFE_GAIN1_CON1 = 0x%x\n", Afe_Get_Reg(AFE_GAIN1_CON1)); printk("AFE_GAIN1_CON2 = 0x%x\n", Afe_Get_Reg(AFE_GAIN1_CON2)); printk("AFE_GAIN1_CON3 = 0x%x\n", Afe_Get_Reg(AFE_GAIN1_CON3)); printk("AFE_GAIN1_CONN = 0x%x\n", Afe_Get_Reg(AFE_GAIN1_CONN)); printk("AFE_GAIN1_CUR = 0x%x\n", Afe_Get_Reg(AFE_GAIN1_CUR)); printk("AFE_GAIN2_CON0 = 0x%x\n", Afe_Get_Reg(AFE_GAIN2_CON0)); printk("AFE_GAIN2_CON1 = 0x%x\n", Afe_Get_Reg(AFE_GAIN2_CON1)); printk("AFE_GAIN2_CON2 = 0x%x\n", Afe_Get_Reg(AFE_GAIN2_CON2)); printk("AFE_GAIN2_CON3 = 0x%x\n", Afe_Get_Reg(AFE_GAIN2_CON3)); printk("AFE_GAIN2_CONN = 0x%x\n", Afe_Get_Reg(AFE_GAIN2_CONN)); printk("AFE_GAIN2_CUR = 0x%x\n", Afe_Get_Reg(AFE_GAIN2_CUR)); printk("AFE_GAIN2_CONN2 = 0x%x\n", Afe_Get_Reg(AFE_GAIN2_CONN2)); printk("FPGA_CFG2 = 0x%x\n", Afe_Get_Reg(FPGA_CFG2)); printk("FPGA_CFG3 = 0x%x\n", Afe_Get_Reg(FPGA_CFG3)); printk("FPGA_CFG0 = 0x%x\n", Afe_Get_Reg(FPGA_CFG0)); printk("FPGA_CFG1 = 0x%x\n", Afe_Get_Reg(FPGA_CFG1)); printk("FPGA_STC = 0x%x\n", Afe_Get_Reg(FPGA_STC)); printk("AFE_ASRC_CON0 = 0x%x\n", Afe_Get_Reg(AFE_ASRC_CON0)); printk("AFE_ASRC_CON1 = 0x%x\n", Afe_Get_Reg(AFE_ASRC_CON1)); printk("AFE_ASRC_CON2 = 0x%x\n", Afe_Get_Reg(AFE_ASRC_CON2)); printk("AFE_ASRC_CON3 = 0x%x\n", Afe_Get_Reg(AFE_ASRC_CON3)); printk("AFE_ASRC_CON4 = 0x%x\n", Afe_Get_Reg(AFE_ASRC_CON4)); printk("AFE_ASRC_CON5 = 0x%x\n", Afe_Get_Reg(AFE_ASRC_CON5)); printk("AFE_ASRC_CON6 = 0x%x\n", Afe_Get_Reg(AFE_ASRC_CON6)); printk("AFE_ASRC_CON7 = 0x%x\n", Afe_Get_Reg(AFE_ASRC_CON7)); printk("AFE_ASRC_CON8 = 0x%x\n", Afe_Get_Reg(AFE_ASRC_CON8)); printk("AFE_ASRC_CON9 = 0x%x\n", Afe_Get_Reg(AFE_ASRC_CON9)); printk("AFE_ASRC_CON10 = 0x%x\n", Afe_Get_Reg(AFE_ASRC_CON10)); printk("AFE_ASRC_CON11 = 0x%x\n", Afe_Get_Reg(AFE_ASRC_CON11)); printk("PCM_INTF_CON1 = 0x%x\n", Afe_Get_Reg(PCM_INTF_CON)); printk("PCM_INTF_CON2 = 0x%x\n", Afe_Get_Reg(PCM_INTF_CON2)); printk("PCM2_INTF_CON = 0x%x\n", Afe_Get_Reg(PCM2_INTF_CON)); printk("AFE_ASRC_CON13 = 0x%x\n", Afe_Get_Reg(AFE_ASRC_CON13)); printk("AFE_ASRC_CON14 = 0x%x\n", Afe_Get_Reg(AFE_ASRC_CON14)); printk("AFE_ASRC_CON15 = 0x%x\n", Afe_Get_Reg(AFE_ASRC_CON15)); printk("AFE_ASRC_CON16 = 0x%x\n", Afe_Get_Reg(AFE_ASRC_CON16)); printk("AFE_ASRC_CON17 = 0x%x\n", Afe_Get_Reg(AFE_ASRC_CON17)); printk("AFE_ASRC_CON18 = 0x%x\n", Afe_Get_Reg(AFE_ASRC_CON18)); printk("AFE_ASRC_CON19 = 0x%x\n", Afe_Get_Reg(AFE_ASRC_CON19)); printk("AFE_ASRC_CON20 = 0x%x\n", Afe_Get_Reg(AFE_ASRC_CON20)); printk("AFE_ASRC_CON21 = 0x%x\n", Afe_Get_Reg(AFE_ASRC_CON21)); AudDrv_Clk_Off(); printk("-AudDrv Afe_Log_Print \n"); }