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 3/5] ASoC: mediatek: mt8195-afe-pcm: Simplify runtime PM during probe
Date: Wed, 3 May 2023 13:23:17 +0000 [thread overview]
Message-ID: <46e01c133742d46cb59a9c381132858701b04844.camel@mediatek.com> (raw)
In-Reply-To: <20230503113413.149235-4-angelogioacchino.delregno@collabora.com>
On Wed, 2023-05-03 at 13:34 +0200, AngeloGioacchino Del Regno wrote:
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
>
>
> Use devm_pm_runtime_enable() and pm_runtime_resume_and_get() to
> to simplify the probe function.
>
> 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 | 22 ++++++++++++------
> ----
> 1 file changed, 12 insertions(+), 10 deletions(-)
>
> diff --git a/sound/soc/mediatek/mt8195/mt8195-afe-pcm.c
> b/sound/soc/mediatek/mt8195/mt8195-afe-pcm.c
> index 9e45efeada55..a54c16e0aa05 100644
> --- a/sound/soc/mediatek/mt8195/mt8195-afe-pcm.c
> +++ b/sound/soc/mediatek/mt8195/mt8195-afe-pcm.c
> @@ -3179,16 +3179,16 @@ static int mt8195_afe_pcm_dev_probe(struct
> platform_device *pdev)
>
> mt8195_afe_parse_of(afe, pdev->dev.of_node);
>
> - pm_runtime_enable(dev);
> - if (!pm_runtime_enabled(dev)) {
> - ret = mt8195_afe_runtime_resume(dev);
> - if (ret)
> - return ret;
> - }
> -
> /* enable clock for regcache get default value from hw */
> afe_priv->pm_runtime_bypass_reg_ctl = true;
> - pm_runtime_get_sync(dev);
> +
> + ret = devm_pm_runtime_enable(dev);
> + if (ret)
> + return ret;
> +
> + ret = pm_runtime_resume_and_get(dev);
> + if (ret)
> + return dev_err_probe(dev, ret, "Failed to resume
> device\n");
>
> afe->regmap = devm_regmap_init_mmio(&pdev->dev, afe-
> >base_addr,
> &mt8195_afe_regmap_config
> );
> @@ -3238,7 +3238,10 @@ static int mt8195_afe_pcm_dev_probe(struct
> platform_device *pdev)
>
> mt8195_afe_init_registers(afe);
>
> - pm_runtime_put_sync(dev);
> + ret = pm_runtime_put_sync(dev);
> + if (ret)
> + return dev_err_probe(dev, ret, "Failed to suspend
> device\n");
> +
> afe_priv->pm_runtime_bypass_reg_ctl = false;
>
> regcache_cache_only(afe->regmap, true);
> @@ -3248,7 +3251,6 @@ static int mt8195_afe_pcm_dev_probe(struct
> platform_device *pdev)
>
> err_pm_put:
> pm_runtime_put_sync(dev);
> - pm_runtime_disable(dev);
>
> return ret;
> }
> --
> 2.40.1
>
>
next prev parent reply other threads:[~2023-05-03 13:23 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 (吳文良) [this message]
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 (吳文良)
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=46e01c133742d46cb59a9c381132858701b04844.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®