pcm_mode = 2;
max_bits = 0x17;
valid_bits = 0x17;
-
- //pcm_mode = 3;
- max_bits = 0x1f;
break;
case SNDRV_PCM_FORMAT_S16_LE:
pcm_mode = 1;
break;
case SNDRV_PCM_FORMAT_S24_LE:
pcm_mode = 2;
- valid_bits = 0x1f;
+ valid_bits = 0x17;
if (dsp_mode == SND_SOC_DAIFMT_DSP_A) {
bit_offset_s = 0xF;
- slot_offset_s = 0x1F;
+ slot_offset_s = 0x17;
bit_offset_e = 0;
slot_offset_e = 0;
}
/* pcmout control2 */
/* FS * 16 * 16 = BCLK */
+ /* FS * 32 * 16 = BCLK */
aml_write_cbus(PCMOUT_CTRL2,
/* underrun use mute constant */
(0 << 29) |
#define PCM_DEFAULT_SAMPLERATE 8000
#define PCM_DEFAULT_MCLK_RATIO_SR 256
+#define PCM_24BIT_MCLK_RATIO_SR 384
+#define PCM_32BIT_MCLK_RATIO_SR 512
static int aml_pcm_set_clk(struct aml_pcm *pcm, unsigned long rate)
{
{
struct snd_pcm_runtime *runtime = substream->runtime;
struct aml_pcm_runtime_data *prtd = runtime->private_data;
+ struct aml_pcm *pcm = snd_soc_dai_get_drvdata(dai);
+ int mclk_rate;
pr_debug("***Entered %s\n", __func__);
+ /* set bclk */
+ if (runtime->format == SNDRV_PCM_FORMAT_S32_LE)
+ mclk_rate = runtime->rate * PCM_32BIT_MCLK_RATIO_SR;
+ else if (runtime->format == SNDRV_PCM_FORMAT_S24_LE)
+ mclk_rate = runtime->rate * PCM_24BIT_MCLK_RATIO_SR;
+ else
+ mclk_rate = runtime->rate * PCM_DEFAULT_MCLK_RATIO_SR;
+
+ aml_pcm_set_clk(pcm, mclk_rate);
+
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
pr_info(
"%s playback stream buffer start: %ld size: 0x%x\n",
struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai)
{
- struct aml_pcm *pcm = snd_soc_dai_get_drvdata(dai);
- int srate, mclk_rate;
-
- srate = params_rate(params);
- if (pcm->old_samplerate != srate) {
- pcm->old_samplerate = srate;
- mclk_rate = srate * PCM_DEFAULT_MCLK_RATIO_SR;
- aml_pcm_set_clk(pcm, mclk_rate);
- }
-
pr_debug("***Entered %s:%s\n", __FILE__, __func__);
return 0;
}
goto err;
}
- /* now only 256fs is supported */
+ /* Default 256fs */
ret = aml_pcm_set_clk(pcm_p,
PCM_DEFAULT_SAMPLERATE * PCM_DEFAULT_MCLK_RATIO_SR);
if (ret < 0) {