diff --git a/sound/soc/sunxi/sunxi-codec.c b/sound/soc/sunxi/sunxi-codec.c index 3b266f1..26c81ad 100644 --- a/sound/soc/sunxi/sunxi-codec.c +++ b/sound/soc/sunxi/sunxi-codec.c @@ -100,7 +100,7 @@ static struct snd_pcm_hardware sunxi_pcm_playback_hardware = SNDRV_PCM_INFO_BLOCK_TRANSFER | SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_RESUME), - .formats = SNDRV_PCM_FMTBIT_S16_LE, + .formats = SNDRV_PCM_FMTBIT_S24_BE, .rates = (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000 |SNDRV_PCM_RATE_11025 |\ SNDRV_PCM_RATE_22050| SNDRV_PCM_RATE_32000 |\ SNDRV_PCM_RATE_44100| SNDRV_PCM_RATE_48000 |SNDRV_PCM_RATE_96000 | SNDRV_PCM_RATE_192000 |\ @@ -110,9 +110,9 @@ static struct snd_pcm_hardware sunxi_pcm_playback_hardware = .channels_min = 1, .channels_max = 2, .buffer_bytes_max = 128*1024,//最大的缓冲区大小 - .period_bytes_min = 1024*4,//最小周期大小 + .period_bytes_min = 16*2,//最小周期大小 .period_bytes_max = 1024*32,//最大周期大小 - .periods_min = 4,//最小周期数 + .periods_min = 2,//最小周期数 .periods_max = 8,//最大周期数 .fifo_size = 32,//fifo字节数 }; @@ -124,7 +124,7 @@ static struct snd_pcm_hardware sunxi_pcm_capture_hardware = SNDRV_PCM_INFO_BLOCK_TRANSFER | SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_RESUME), - .formats = SNDRV_PCM_FMTBIT_S16_LE, + .formats = SNDRV_PCM_FMTBIT_S24_BE, .rates = (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000 |SNDRV_PCM_RATE_11025 |\ SNDRV_PCM_RATE_22050| SNDRV_PCM_RATE_32000 |\ SNDRV_PCM_RATE_44100| SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_96000 |SNDRV_PCM_RATE_192000 |\ @@ -134,9 +134,9 @@ static struct snd_pcm_hardware sunxi_pcm_capture_hardware = .channels_min = 1, .channels_max = 2, .buffer_bytes_max = 128*1024,//最大的缓冲区大小 - .period_bytes_min = 1024*4,//最小周期大小 + .period_bytes_min = 16*2,//最小周期大小 .period_bytes_max = 1024*32,//最大周期大小 - .periods_min = 4,//最小周期数 + .periods_min = 2,//最小周期数 .periods_max = 8,//最大周期数 .fifo_size = 32,//fifo字节数 }; @@ -321,7 +321,13 @@ static int codec_init(void) //enable dac digital codec_wr_control(SUNXI_DAC_DPC, 0x1, DAC_EN, 0x1); - codec_wr_control(SUNXI_DAC_FIFOC , 0x1,28, 0x1); + //set TX and RX sampling resolution to 24bits + codec_wr_control(SUNXI_DAC_FIFOC, 0x1, TASR, 0x1); + codec_wr_control(SUNXI_ADC_FIFOC, 0x1, RASR, 0x1); + + //set FIR Version to 32-Tap + codec_wr_control(SUNXI_DAC_FIFOC, 0x1, FIR_VERSION, 0x1); + //set digital volume to maximum if (codec_chip_ver == SUNXI_VER_A10A) codec_wr_control(SUNXI_DAC_DPC, 0x6, DIGITAL_VOL, 0x0); @@ -365,12 +371,12 @@ static int codec_play_open(struct snd_pcm_substream *substream) //set TX FIFO send drq level codec_wr_control(SUNXI_DAC_FIFOC ,0x4, TX_TRI_LEVEL, 0xf); if(substream->runtime->rate > 32000){ - codec_wr_control(SUNXI_DAC_FIFOC , 0x1,28, 0x0); + codec_wr_control(SUNXI_DAC_FIFOC, 0x1, FIR_VERSION, 0x0); }else{ - codec_wr_control(SUNXI_DAC_FIFOC , 0x1,28, 0x1); + codec_wr_control(SUNXI_DAC_FIFOC, 0x1, FIR_VERSION, 0x1); } //set TX FIFO MODE - codec_wr_control(SUNXI_DAC_FIFOC ,0x1, TX_FIFO_MODE, 0x1); + //codec_wr_control(SUNXI_DAC_FIFOC ,0x1, TX_FIFO_MODE, 0x1); //send last sample when dac fifo under run codec_wr_control(SUNXI_DAC_FIFOC ,0x1, LAST_SE, 0x0); //enable dac analog @@ -398,7 +404,7 @@ static int codec_capture_open(void) //enable adc digital codec_wr_control(SUNXI_ADC_FIFOC, 0x1,ADC_DIG_EN, 0x1); //set RX FIFO mode - codec_wr_control(SUNXI_ADC_FIFOC, 0x1, RX_FIFO_MODE, 0x1); + //codec_wr_control(SUNXI_ADC_FIFOC, 0x1, RX_FIFO_MODE, 0x1); //flush RX FIFO codec_wr_control(SUNXI_ADC_FIFOC, 0x1, ADC_FIFO_FLUSH, 0x1); //set RX FIFO rec drq level