--- Begin Message ---
- To: "lgirdwood@xxxxxxxxx" <lgirdwood@xxxxxxxxx>, "angelogioacchino.delregno@xxxxxxxxxxxxx" <angelogioacchino.delregno@xxxxxxxxxxxxx>
- Subject: Re: [PATCH 5/5] ASoC: mediatek: mt8195-afe-pcm: Clean up unnecessary functions
- From: Trevor Wu (吳文良) <Trevor.Wu@xxxxxxxxxxxx>
- Date: Wed, 3 May 2023 13:25:46 +0000
- Cc: "sound-open-firmware@xxxxxxxxxxxxxxxx" <sound-open-firmware@xxxxxxxxxxxxxxxx>, "linux-kernel@xxxxxxxxxxxxxxx" <linux-kernel@xxxxxxxxxxxxxxx>, "alsa-devel@xxxxxxxxxxxxxxxx" <alsa-devel@xxxxxxxxxxxxxxxx>, "ribalda@xxxxxxxxxxxx" <ribalda@xxxxxxxxxxxx>, "linux-mediatek@xxxxxxxxxxxxxxxxxxx" <linux-mediatek@xxxxxxxxxxxxxxxxxxx>, "u.kleine-koenig@xxxxxxxxxxxxxx" <u.kleine-koenig@xxxxxxxxxxxxxx>, YC Hung (洪堯俊) <yc.hung@xxxxxxxxxxxx>, "kai.vehmanen@xxxxxxxxxxxxxxx" <kai.vehmanen@xxxxxxxxxxxxxxx>, Chunxu Li (李春旭) <Chunxu.Li@xxxxxxxxxxxx>, "kernel@xxxxxxxxxxxxx" <kernel@xxxxxxxxxxxxx>, "pierre-louis.bossart@xxxxxxxxxxxxxxx" <pierre-louis.bossart@xxxxxxxxxxxxxxx>, Allen-KH Cheng (程冠勳) <Allen-KH.Cheng@xxxxxxxxxxxx>, "broonie@xxxxxxxxxx" <broonie@xxxxxxxxxx>, "tiwai@xxxxxxxx" <tiwai@xxxxxxxx>, "yung-chuan.liao@xxxxxxxxxxxxxxx" <yung-chuan.liao@xxxxxxxxxxxxxxx>, "ranjani.sridharan@xxxxxxxxxxxxxxx" <ranjani.sridharan@xxxxxxxxxxxxxxx>, "linux-arm-kernel@xxxxxxxxxxxxxxxxxxx" <linux-arm-kernel@xxxxxxxxxxxxxxxxxxx>, "matthias.bgg@xxxxxxxxx" <matthias.bgg@xxxxxxxxx>, "peter.ujfalusi@xxxxxxxxxxxxxxx" <peter.ujfalusi@xxxxxxxxxxxxxxx>, "daniel.baluta@xxxxxxx" <daniel.baluta@xxxxxxx>, "nicolas.ferre@xxxxxxxxxxxxx" <nicolas.ferre@xxxxxxxxxxxxx>, TingHan Shen (沈廷翰) <TingHan.Shen@xxxxxxxxxxxx>, "error27@xxxxxxxxx" <error27@xxxxxxxxx>
- In-reply-to: <20230503113413.149235-6-angelogioacchino.delregno@collabora.com>
- References: <20230503113413.149235-1-angelogioacchino.delregno@collabora.com> <20230503113413.149235-6-angelogioacchino.delregno@collabora.com>
On Wed, 2023-05-03 at 13:34 +0200, AngeloGioacchino Del Regno wrote:
> Function mt8195_afe_init_registers() performs just a single call to
> regmap_multi_reg_write(), it returns int and it's not error checked;
> move that call to the probe function and also add some error check.
>
> While at it, also move the contents of mt8195_afe_parse_of() to the
> probe function as well: since this is getting a handle to topckgen
> and since that's optional, the ifdef for CONFIG_SND_SOC_MT6359 can
> also be removed.
>
> Signed-off-by: AngeloGioacchino Del Regno <
> angelogioacchino.delregno@xxxxxxxxxxxxx>
Acked-by: Trevor Wu <trevor.wu@xxxxxxxxxxxx>
> ---
> sound/soc/mediatek/mt8195/mt8195-afe-pcm.c | 32 ++++++------------
> ----
> 1 file changed, 8 insertions(+), 24 deletions(-)
>
> diff --git a/sound/soc/mediatek/mt8195/mt8195-afe-pcm.c
> b/sound/soc/mediatek/mt8195/mt8195-afe-pcm.c
> index 105db11eecec..d22cf1664d8a 100644
> --- a/sound/soc/mediatek/mt8195/mt8195-afe-pcm.c
> +++ b/sound/soc/mediatek/mt8195/mt8195-afe-pcm.c
> @@ -3030,28 +3030,6 @@ static const struct reg_sequence
> mt8195_cg_patch[] = {
> { AUDIO_TOP_CON1, 0xfffffff8 },
> };
>
> -static int mt8195_afe_init_registers(struct mtk_base_afe *afe)
> -{
> - return regmap_multi_reg_write(afe->regmap,
> - mt8195_afe_reg_defaults,
> - ARRAY_SIZE(mt8195_afe_reg_defaults));
> -}
> -
> -static void mt8195_afe_parse_of(struct mtk_base_afe *afe,
> - struct device_node *np)
> -{
> -#if IS_ENABLED(CONFIG_SND_SOC_MT6359)
> - struct mt8195_afe_private *afe_priv = afe->platform_priv;
> -
> - afe_priv->topckgen = syscon_regmap_lookup_by_phandle(afe-
> >dev->of_node,
> - "mediate
> k,topckgen");
> - if (IS_ERR(afe_priv->topckgen)) {
> - dev_info(afe->dev, "%s() Cannot find topckgen
> controller: %ld\n",
> - __func__, PTR_ERR(afe_priv->topckgen));
> - }
> -#endif
> -}
> -
> static int mt8195_afe_pcm_dev_probe(struct platform_device *pdev)
> {
> struct mtk_base_afe *afe;
> @@ -3160,7 +3138,10 @@ static int mt8195_afe_pcm_dev_probe(struct
> platform_device *pdev)
>
> platform_set_drvdata(pdev, afe);
>
> - mt8195_afe_parse_of(afe, pdev->dev.of_node);
> + afe_priv->topckgen = syscon_regmap_lookup_by_phandle(dev-
> >of_node, "mediatek,topckgen");
> + if (IS_ERR(afe_priv->topckgen))
> + dev_dbg(afe->dev, "Cannot find topckgen controller:
> %ld\n",
> + PTR_ERR(afe_priv->topckgen));
>
> /* enable clock for regcache get default value from hw */
> afe_priv->pm_runtime_bypass_reg_ctl = true;
> @@ -3219,7 +3200,10 @@ static int mt8195_afe_pcm_dev_probe(struct
> platform_device *pdev)
> goto err_pm_put;
> }
>
> - mt8195_afe_init_registers(afe);
> + ret = regmap_multi_reg_write(afe->regmap,
> mt8195_afe_reg_defaults,
> + ARRAY_SIZE(mt8195_afe_reg_defaul
> ts));
> + if (ret)
> + goto err_pm_put;
>
> ret = pm_runtime_put_sync(dev);
> if (ret)
> --
> 2.40.1
>
>
--- End Message ---