From: Yingjoe Chen <yingjoe.chen-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
To: Jiaxin Yu <jiaxin.yu-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
Cc: alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw@public.gmane.org,
lgirdwood-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
perex-/Fr2/VpizcU@public.gmane.org,
tzungbi-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org,
broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
eason.yen-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org
Subject: Re: [PATCH 2/2] ASoC: mt8183: fix audio playback slowly after playback during bootup
Date: Fri, 13 Sep 2019 00:50:07 +0800 [thread overview]
Message-ID: <1568307007.22948.3.camel@mtksdaap41> (raw)
In-Reply-To: <1568282096-13821-3-git-send-email-jiaxin.yu-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
On Thu, 2019-09-12 at 17:54 +0800, Jiaxin Yu wrote:
> Before regmap_reinit_cache we must reset audio reg as default value.
> So we use reset controller unit(toprgu) to reset audio hw.
>
> Signed-off-by: Jiaxin Yu <jiaxin.yu-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
> ---
> sound/soc/mediatek/common/mtk-base-afe.h | 1 +
> sound/soc/mediatek/mt8183/mt8183-afe-pcm.c | 21 +++++++++++++++++++++
> sound/soc/mediatek/mt8183/mt8183-reg.h | 6 ++++++
> 3 files changed, 28 insertions(+)
>
> diff --git a/sound/soc/mediatek/common/mtk-base-afe.h b/sound/soc/mediatek/common/mtk-base-afe.h
> index 60cb609a9790..bccc079ee660 100644
> --- a/sound/soc/mediatek/common/mtk-base-afe.h
> +++ b/sound/soc/mediatek/common/mtk-base-afe.h
> @@ -60,6 +60,7 @@ struct mtk_base_afe {
> void __iomem *base_addr;
> struct device *dev;
> struct regmap *regmap;
> + struct regmap *toprgu_regmap;
> struct mutex irq_alloc_lock; /* dynamic alloc irq lock */
>
> unsigned int const *reg_back_up_list;
> diff --git a/sound/soc/mediatek/mt8183/mt8183-afe-pcm.c b/sound/soc/mediatek/mt8183/mt8183-afe-pcm.c
> index 4a31106d3471..0e5634b3a8e3 100644
> --- a/sound/soc/mediatek/mt8183/mt8183-afe-pcm.c
> +++ b/sound/soc/mediatek/mt8183/mt8183-afe-pcm.c
> @@ -1089,6 +1089,7 @@ static int mt8183_afe_pcm_dev_probe(struct platform_device *pdev)
> struct mtk_base_afe *afe;
> struct mt8183_afe_private *afe_priv;
> struct device *dev;
> + unsigned int reg_value;
> int i, irq_id, ret;
>
> afe = devm_kzalloc(&pdev->dev, sizeof(*afe), GFP_KERNEL);
> @@ -1126,6 +1127,26 @@ static int mt8183_afe_pcm_dev_probe(struct platform_device *pdev)
> return ret;
> }
>
> + /* toprgu_regmap init */
> + afe->toprgu_regmap = syscon_regmap_lookup_by_phandle(dev->of_node,
> + "mediatek,toprgu");
> + if (IS_ERR(afe->toprgu_regmap)) {
> + dev_err(dev, "could not get toprgu_regmap from dev\n");
> + return PTR_ERR(afe->toprgu_regmap);
> + }
> +
> + /* read TOPRGUWDT_SWSYSRST, the high 8bits must be zero */
> + regmap_read(afe->toprgu_regmap, TOPRGUWDT_SWSYSRST, ®_value);
> +
> + /* write TOPRGUWDT_SWSYSRST, we need set high 8bits as 0x88 first */
> + reg_value |= 0x88000000;
> +
> + /* reset audio domain registers */
> + reg_value |= 1 << AUDIO_RST_SFT;
> + regmap_write(afe->toprgu_regmap, TOPRGUWDT_SWSYSRST, reg_value);
> + reg_value &= ~(1 << AUDIO_RST_SFT);
> + regmap_write(afe->toprgu_regmap, TOPRGUWDT_SWSYSRST, reg_value);
This register contain reset bits for many components.
If components access it directly at the same time, we might have race
condition.
Instead, watchdog driver should export this as reset controller so this
driver can access it using reset API.
Joe.C
prev parent reply other threads:[~2019-09-12 16:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-12 9:54 [PATCH 0/2] ASoC: mt8183: fix audio playback slowly after playback during bootup Jiaxin Yu
[not found] ` <1568282096-13821-1-git-send-email-jiaxin.yu-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
2019-09-12 9:54 ` [PATCH 1/2] ASoC: dt-bingdings: mediatek: mt8183: add a property "medaitek, toprgu" Jiaxin Yu
[not found] ` <1568282096-13821-2-git-send-email-jiaxin.yu-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
2019-09-12 16:52 ` Yingjoe Chen
2019-09-12 9:54 ` [PATCH 2/2] ASoC: mt8183: fix audio playback slowly after playback during bootup Jiaxin Yu
[not found] ` <1568282096-13821-3-git-send-email-jiaxin.yu-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
2019-09-12 16:50 ` Yingjoe Chen [this message]
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=1568307007.22948.3.camel@mtksdaap41 \
--to=yingjoe.chen-nus5lvnupcjwk0htik3j/w@public.gmane.org \
--cc=alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw@public.gmane.org \
--cc=broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=eason.yen-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org \
--cc=jiaxin.yu-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org \
--cc=lgirdwood-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=perex-/Fr2/VpizcU@public.gmane.org \
--cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=tzungbi-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
/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