/* the I2S hw and IEC958 PCM output initation,958 initation here, for the case that only use our ALSA driver for PCM s/pdif output. */ static void aml_hw_i2s_init(struct snd_pcm_runtime *runtime) { switch(runtime->format){ case SNDRV_PCM_FORMAT_S32_LE: I2S_MODE = AIU_I2S_MODE_PCM32; // IEC958_MODE = AIU_958_MODE_PCM32; break; case SNDRV_PCM_FORMAT_S24_LE: I2S_MODE = AIU_I2S_MODE_PCM24; // IEC958_MODE = AIU_958_MODE_PCM24; break; case SNDRV_PCM_FORMAT_S16_LE: I2S_MODE = AIU_I2S_MODE_PCM16; // IEC958_MODE = AIU_958_MODE_PCM16; break; } audio_set_i2s_mode(I2S_MODE); audio_set_aiubuf(runtime->dma_addr, runtime->dma_bytes, runtime->channels); memset((void*)runtime->dma_area,0,runtime->dma_bytes + 4096); /* update the i2s hw buffer end addr as android may update that */ aml_pcm_playback_phy_end_addr = aml_pcm_playback_phy_start_addr+runtime->dma_bytes; printk("I2S hw init,i2s mode %d\n",I2S_MODE); }
static void aml_i2s_play(void) { audio_util_set_dac_i2s_format(AUDIO_ALGOUT_DAC_FORMAT_DSP); audio_set_i2s_mode(AIU_I2S_MODE_PCM16); memset(i2sbuf, 0, sizeof(i2sbuf)); audio_set_aiubuf((virt_to_phys(i2sbuf) + 63) & (~63), 128, 2); audio_out_i2s_enable(1); }
/* the I2S hw and IEC958 PCM output initation,958 initation here, for the case that only use our ALSA driver for PCM s/pdif output. */ static void aml_hw_i2s_init(struct snd_pcm_runtime *runtime) { unsigned i2s_mode = AIU_I2S_MODE_PCM16; switch (runtime->format) { case SNDRV_PCM_FORMAT_S32_LE: i2s_mode = AIU_I2S_MODE_PCM32; break; case SNDRV_PCM_FORMAT_S24_LE: i2s_mode = AIU_I2S_MODE_PCM24; break; case SNDRV_PCM_FORMAT_S16_LE: i2s_mode = AIU_I2S_MODE_PCM16; break; } audio_set_i2s_mode(i2s_mode); audio_set_aiubuf(runtime->dma_addr, runtime->dma_bytes, runtime->channels); ALSA_PRINT("i2s dma %x,phy addr %x,mode %d,ch %d \n", (unsigned)runtime->dma_area, (unsigned)runtime->dma_addr, i2s_mode, runtime->channels);