mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Trevor Wu (吳文良)" <Trevor.Wu@mediatek.com>
To: "lgirdwood@gmail.com" <lgirdwood@gmail.com>,
	"angelogioacchino.delregno@collabora.com" 
	<angelogioacchino.delregno@collabora.com>
Cc: "sound-open-firmware@alsa-project.org"
	<sound-open-firmware@alsa-project.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
	"ribalda@chromium.org" <ribalda@chromium.org>,
	"linux-mediatek@lists.infradead.org"
	<linux-mediatek@lists.infradead.org>,
	"u.kleine-koenig@pengutronix.de" <u.kleine-koenig@pengutronix.de>,
	"YC Hung (洪堯俊)" <yc.hung@mediatek.com>,
	"kai.vehmanen@linux.intel.com" <kai.vehmanen@linux.intel.com>,
	"Chunxu Li (李春旭)" <Chunxu.Li@mediatek.com>,
	"kernel@collabora.com" <kernel@collabora.com>,
	"pierre-louis.bossart@linux.intel.com"
	<pierre-louis.bossart@linux.intel.com>,
	"Allen-KH Cheng (程冠勳)" <Allen-KH.Cheng@mediatek.com>,
	"broonie@kernel.org" <broonie@kernel.org>,
	"tiwai@suse.com" <tiwai@suse.com>,
	"yung-chuan.liao@linux.intel.com"
	<yung-chuan.liao@linux.intel.com>,
	"ranjani.sridharan@linux.intel.com"
	<ranjani.sridharan@linux.intel.com>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
	"peter.ujfalusi@linux.intel.com" <peter.ujfalusi@linux.intel.com>,
	"perex@perex.cz" <perex@perex.cz>,
	"daniel.baluta@nxp.com" <daniel.baluta@nxp.com>,
	"nicolas.ferre@microchip.com" <nicolas.ferre@microchip.com>,
	"TingHan Shen (沈廷翰)" <TingHan.Shen@mediatek.com>,
	"error27@gmail.com" <error27@gmail.com>
Subject: Re: [PATCH 5/5] ASoC: mediatek: mt8195-afe-pcm: Clean up unnecessary functions
Date: Wed, 3 May 2023 13:25:46 +0000	[thread overview]
Message-ID: <131123e4dde4d95927bb9ec92aefc50bbde53cd6.camel@mediatek.com> (raw)
In-Reply-To: <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@collabora.com>

Acked-by: Trevor Wu <trevor.wu@mediatek.com>

> ---
>  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
> 
> 

  reply	other threads:[~2023-05-03 13:26 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-03 11:34 [PATCH 0/5] ASoC: MediaTek MT8195/86 Cleanups AngeloGioacchino Del Regno
2023-05-03 11:34 ` [PATCH 1/5] ASoC: SOF: mediatek: mt8195: Use snd_sof_ipc_process_reply() helper AngeloGioacchino Del Regno
2023-05-03 11:34 ` [PATCH 2/5] ASoC: SOF: mediatek: mt8186: " AngeloGioacchino Del Regno
2023-05-03 11:34 ` [PATCH 3/5] ASoC: mediatek: mt8195-afe-pcm: Simplify runtime PM during probe AngeloGioacchino Del Regno
2023-05-03 13:23   ` Trevor Wu (吳文良)
2023-05-03 11:34 ` [PATCH 4/5] ASoC: mediatek: mt8195-afe-pcm: Simplify with dev_err_probe() AngeloGioacchino Del Regno
2023-05-03 13:24   ` Trevor Wu (吳文良)
2023-05-03 11:34 ` [PATCH 5/5] ASoC: mediatek: mt8195-afe-pcm: Clean up unnecessary functions AngeloGioacchino Del Regno
2023-05-03 13:25   ` Trevor Wu (吳文良) [this message]
2023-05-09  6:38 ` [PATCH 0/5] ASoC: MediaTek MT8195/86 Cleanups Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=131123e4dde4d95927bb9ec92aefc50bbde53cd6.camel@mediatek.com \
    --to=trevor.wu@mediatek.com \
    --cc=Allen-KH.Cheng@mediatek.com \
    --cc=Chunxu.Li@mediatek.com \
    --cc=TingHan.Shen@mediatek.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=broonie@kernel.org \
    --cc=daniel.baluta@nxp.com \
    --cc=error27@gmail.com \
    --cc=kai.vehmanen@linux.intel.com \
    --cc=kernel@collabora.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=nicolas.ferre@microchip.com \
    --cc=perex@perex.cz \
    --cc=peter.ujfalusi@linux.intel.com \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=ranjani.sridharan@linux.intel.com \
    --cc=ribalda@chromium.org \
    --cc=sound-open-firmware@alsa-project.org \
    --cc=tiwai@suse.com \
    --cc=u.kleine-koenig@pengutronix.de \
    --cc=yc.hung@mediatek.com \
    --cc=yung-chuan.liao@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®