[alsa-devel] [PATCH 2/2] ASoC: Intel: Add machine driver for CX2072X on BYT/CHT platforms
Takashi Iwai
tiwai at suse.de
Wed Apr 24 15:08:04 CEST 2019
On Tue, 23 Apr 2019 21:39:50 +0200,
Takashi Iwai wrote:
>
> > > +static int byt_cht_cx2072x_fixup(struct snd_soc_pcm_runtime *rtd,
> > > + struct snd_pcm_hw_params *params)
> > > +{
> > > + struct snd_interval *rate =
> > > + hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE);
> > > + struct snd_interval *channels =
> > > + hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS);
> > > + int ret;
> > > +
> > > + /* The DSP will covert the FE rate to 48k, stereo, 24bits */
> > > + rate->min = rate->max = 48000;
> > > + channels->min = channels->max = 2;
> > > +
> > > + /* set SSP2 to 24-bit */
> > > + params_set_format(params, SNDRV_PCM_FORMAT_S24_LE);
> > > +
> > > + /*
> > > + * Default mode for SSP configuration is TDM 4 slot, override config
> > > + * with explicit setting to I2S 2ch 24-bit. The word length is set with
> > > + * dai_set_tdm_slot() since there is no other API exposed
> > > + */
> > > + ret = snd_soc_dai_set_fmt(rtd->cpu_dai,
> > > + SND_SOC_DAIFMT_I2S |
> > > + SND_SOC_DAIFMT_NB_NF |
> > > + SND_SOC_DAIFMT_CBS_CFS);
> > > + if (ret < 0) {
> > > + dev_err(rtd->dev, "can't set format to I2S, err %d\n", ret);
> > > + return ret;
> > > + }
> > > +
> > > + ret = snd_soc_dai_set_tdm_slot(rtd->cpu_dai, 0x3, 0x3, 2, 24);
> > > + if (ret < 0) {
> > > + dev_err(rtd->dev, "can't set I2S config, err %d\n", ret);
> > > + return ret;
> > > + }
> > > +
> > > + snd_soc_dai_set_bclk_ratio(rtd->codec_dai, 50);
> >
> > that part would be problematic for SOF. IIRC we put all clock-related
> > stuff in the init, and ignore the fixups to use topology-based
> > information instead. If this call to _set_bclk_ratio can be moved to
> > the init it's more future-proof. Is there a reason to do this here in
> > the fixup?
>
> No particular reason from my side. I just took over your code ;)
>
> That is, it'd be appreciated if you can give a fixup patch that can be
> applied on top.
OK, I tried just moving snd_soc_dai_set_bclk_ratio() into the init
callback, and it seems working fine. The fix will be included in v2
patch.
thanks,
Takashi
More information about the Alsa-devel
mailing list