Re: [PATCH 09/15] ASoC: mediatek: mt8186: support tdm in platform driver

From: Jiaxin Yu
Date: Thu Feb 17 2022 - 09:00:55 EST


On Fri, 2022-02-11 at 15:24 +0000, Mark Brown wrote:
> On Fri, Feb 11, 2022 at 06:38:12PM +0800, Jiaxin Yu wrote:
>
> Again, mostly looks good just fairly small and easily fixable issues:
>
> > +static int mtk_tdm_hd_en_event(struct snd_soc_dapm_widget *w,
> > + struct snd_kcontrol *kcontrol,
> > + int event)
> > +{
> > + struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w-
> > >dapm);
> > +
> > + dev_info(cmpnt->dev, "%s(), name %s, event 0x%x\n",
> > + __func__, w->name, event);
> > +
> > + return 0;
> > +}
>
> This does nothing, you can just remove it.

Yes, this is readlly useless, removed it in the v2 version.

>
> > + switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
> > + case SND_SOC_DAIFMT_NB_NF:
> > + tdm_priv->bck_invert = TDM_BCK_NON_INV;
> > + tdm_priv->lck_invert = TDM_LCK_NON_INV;
> > + break;
> > + case SND_SOC_DAIFMT_NB_IF:
> > + tdm_priv->bck_invert = TDM_BCK_NON_INV;
> > + tdm_priv->lck_invert = TDM_LCK_INV;
> > + break;
> > + case SND_SOC_DAIFMT_IB_NF:
> > + tdm_priv->bck_invert = TDM_BCK_INV;
> > + tdm_priv->lck_invert = TDM_LCK_NON_INV;
> > + break;
> > + case SND_SOC_DAIFMT_IB_IF:
> > + default:
> > + tdm_priv->bck_invert = TDM_BCK_INV;
> > + tdm_priv->lck_invert = TDM_LCK_INV;
>
> You should return an error in the default case rather than just
> picking
> one of the behaviours to help spot any configuration errors.

Done in the v2 version.

>
> > + switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
> > + case SND_SOC_DAIFMT_CBM_CFM:
> > + tdm_priv->slave_mode = false;
> > + break;
> > + case SND_SOC_DAIFMT_CBS_CFS:
> > + tdm_priv->slave_mode = true;
>
> We're trying to move away from these defines and the master/slave
> terminology to talk about clock providers instead - the new defines
> are
> _PROVIDER_MASK, _DAIFMT_CBP_CFP and _DAIFMT_CBC_CFC.

Done in the v2 version.