[PATCH 3/7] ASoC: mediatek: mt8188: revise ETDM control flow

Trevor Wu (吳文良) Trevor.Wu at mediatek.com
Sun Apr 16 19:52:35 PDT 2023


On Thu, 2023-04-13 at 15:17 +0200, AngeloGioacchino Del Regno wrote:
> 
> > +static int mtk_etdm_mclk_connect(struct snd_soc_dapm_widget
> > *source,
> > +                              struct snd_soc_dapm_widget *sink)
> > +{
> > +     struct snd_soc_dapm_widget *w = sink;
> > +     struct snd_soc_component *cmpnt =
> > snd_soc_dapm_to_component(w->dapm);
> > +     struct mtk_base_afe *afe =
> > snd_soc_component_get_drvdata(cmpnt);
> > +     struct mt8188_afe_private *afe_priv = afe->platform_priv;
> > +     struct mtk_dai_etdm_priv *etdm_priv;
> > +     int mclk_id;
> > +
> > +     mclk_id = get_etdm_id_by_name(afe, source->name);
> > +     if (mclk_id < 0) {
> > +             dev_info(afe->dev, "mclk_id < 0");
> 
> Since you're returning 0, this doesn't appear to be an error and this
> print is
> useless unless it is used for debugging purposes.
> 
> Please change it to dev_dbg().
> 
> > +             return 0;
> > +     }
> > +
> > +     etdm_priv = get_etdm_priv_by_name(afe, w->name);
> > +     if (!etdm_priv) {
> > +             dev_info(afe->dev, "etdm_priv == NULL");
> 
> dev_dbg()
> 
> > +             return 0;
> > +     }
> > +
> > +     if (get_etdm_id_by_name(afe, sink->name) == mclk_id)
> > +             return !!(etdm_priv->mclk_freq > 0);
> > +
> > +     if (etdm_priv->cowork_source_id == mclk_id) {
> > +             etdm_priv = afe_priv->dai_priv[mclk_id];
> > +             return !!(etdm_priv->mclk_freq > 0);
> > +     }
> > +
> > +     return 0;
> > +}
> > +
> > +static int mtk_etdm_cowork_connect(struct snd_soc_dapm_widget
> > *source,
> > +                                struct snd_soc_dapm_widget *sink)
> > +{
> > +     struct snd_soc_dapm_widget *w = sink;
> > +     struct snd_soc_component *cmpnt =
> > snd_soc_dapm_to_component(w->dapm);
> > +     struct mtk_base_afe *afe =
> > snd_soc_component_get_drvdata(cmpnt);
> > +     struct mt8188_afe_private *afe_priv = afe->platform_priv;
> > +     struct mtk_dai_etdm_priv *etdm_priv;
> > +     int source_id;
> > +     int i;
> > +
> > +     source_id = get_etdm_id_by_name(afe, source->name);
> > +     if (source_id < 0) {
> > +             dev_info(afe->dev, "%s() source_id < 0\n", __func__);
> 
> dev_dbg() please
> 
> > +             return 0;
> > +     }
> > +
> > +     etdm_priv = get_etdm_priv_by_name(afe, w->name);
> > +     if (!etdm_priv) {
> > +             dev_info(afe->dev, "%s() etdm_priv == NULL\n",
> > __func__);
> 
> ...again... and everywhere else.
> 
> > +             return 0;
> > +     }
> > +
> 


OK, I will review all dev_info and replace them with dev_dbg in V2.

Thanks,
Trevor

> 


More information about the Linux-mediatek mailing list