From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: Ravulapati Vishnu vardhan rao <Vishnuvardhanrao.Ravulapati@amd.com>
Cc: "moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER
MANAGEM..." <alsa-devel@alsa-project.org>,
Maruthi Bayyavarapu <maruthi.bayyavarapu@amd.com>,
Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>,
Liam Girdwood <lgirdwood@gmail.com>,
YueHaibing <yuehaibing@huawei.com>,
open list <linux-kernel@vger.kernel.org>,
Takashi Iwai <tiwai@suse.com>, Mark Brown <broonie@kernel.org>,
djkurtz@google.com, Vijendar Mukunda <Vijendar.Mukunda@amd.com>,
Alex Deucher <alexander.deucher@amd.com>,
Colin Ian King <colin.king@canonical.com>,
Akshu.Agrawal@amd.com, Dan Carpenter <dan.carpenter@oracle.com>
Subject: Re: [alsa-devel] [PATCH v3 6/6] ASoC: amd: Added ACP3x system resume and runtime pm
Date: Thu, 7 Nov 2019 09:34:28 -0600 [thread overview]
Message-ID: <dc3c320e-970f-ff49-b542-16dd7058e882@linux.intel.com> (raw)
In-Reply-To: <1573133093-28208-7-git-send-email-Vishnuvardhanrao.Ravulapati@amd.com>
> +static int acp3x_power_on(void __iomem *acp3x_base)
> +{
> + u32 val;
> + u32 timeout = 0;
> + int ret = 0;
> +
> + val = rv_readl(acp3x_base + mmACP_PGFSM_STATUS);
> +
> + if (val == 0)
> + return val;
> +
> + if (!((val & ACP_PGFSM_STATUS_MASK) ==
> + ACP_POWER_ON_IN_PROGRESS))
> + rv_writel(ACP_PGFSM_CNTL_POWER_ON_MASK,
> + acp3x_base + mmACP_PGFSM_CONTROL);
> + while (++timeout < 500) {
> + val = rv_readl(acp3x_base + mmACP_PGFSM_STATUS);
> + if (!val)
> + break;
> + udelay(1);
> + if (timeout > 500) {
your timeout cannot reach 500, isn't this dead code?
> + pr_err("ACP is Not Powered ON\n");
> + return -ETIMEDOUT;
> + }
> + }
> +}
> +
> +static int acp3x_power_off(void __iomem *acp3x_base)
> +{
> + u32 val;
> + u32 timeout = 0;
> +
> + rv_writel(ACP_PGFSM_CNTL_POWER_OFF_MASK,
> + acp3x_base + mmACP_PGFSM_CONTROL);
> + while (++timeout < 500) {
> + val = rv_readl(acp3x_base + mmACP_PGFSM_STATUS);
> + if ((val & ACP_PGFSM_STATUS_MASK) == ACP_POWERED_OFF)
> + return 0;
> + udelay(1);
> + if (timeout > 500) {
same here, the timeout handling looks broken
> + pr_err("ACP is Not Powered OFF\n");
> + return -ETIMEDOUT;
> + }
> + }
> +}
> +
> +
> +static int acp3x_reset(void __iomem *acp3x_base)
> +{
> + u32 val, timeout;
> +
> + rv_writel(1, acp3x_base + mmACP_SOFT_RESET);
> + timeout = 0;
> + while (++timeout < 100) {
> + val = rv_readl(acp3x_base + mmACP_SOFT_RESET);
> + if ((val & ACP3x_SOFT_RESET__SoftResetAudDone_MASK) ||
> + timeout > 100) {
and here, how can timeout > 100 if the outer loops controls it.
> + if (val & ACP3x_SOFT_RESET__SoftResetAudDone_MASK)
> + break;
> + return -ENODEV;
> + }
> + cpu_relax();
> + }
> + rv_writel(0, acp3x_base + mmACP_SOFT_RESET);
> + timeout = 0;
> + while (++timeout < 100) {
> + val = rv_readl(acp3x_base + mmACP_SOFT_RESET);
> + if (!val)
> + break;
> + if (timeout > 100)
same here
> +static int snd_acp3x_suspend(struct device *dev)
extra spaces?
> +{
> + int status;
> + struct acp3x_dev_data *adata = dev_get_drvdata(dev);
> +
> + status = acp3x_deinit(adata->acp3x_base);
> + if (status)
> + dev_err(dev, "ACP de-init failed\n");
> + else
> + dev_info(dev, "ACP de-initialized\n");
> +
> + return 0;
> +}
> +static int snd_acp3x_resume(struct device *dev)
extra spaces?
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
prev parent reply other threads:[~2019-11-07 17:08 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1573133093-28208-1-git-send-email-Vishnuvardhanrao.Ravulapati@amd.com>
2019-11-07 13:24 ` [alsa-devel] [PATCH v3 1/6] ASoC: amd:Create multiple I2S platform device endpoints Ravulapati Vishnu vardhan rao
2019-11-07 13:24 ` [alsa-devel] [PATCH v3 2/6] ASoC: amd: Refactoring of DAI from DMA driver Ravulapati Vishnu vardhan rao
2019-11-07 15:13 ` Pierre-Louis Bossart
2019-11-07 13:24 ` [alsa-devel] [PATCH v3 3/6] ASoC: amd: Enabling I2S instance in DMA and DAI Ravulapati Vishnu vardhan rao
2019-11-07 15:22 ` Pierre-Louis Bossart
2019-11-07 13:24 ` [alsa-devel] [RESEND PATCH v3 4/6] ASoC: amd: add ACP3x TDM mode support Ravulapati Vishnu vardhan rao
2019-11-07 13:24 ` [alsa-devel] [RESEND PATCH v3 5/6] ASoC: amd: handle ACP3x i2s-sp watermark interrupt Ravulapati Vishnu vardhan rao
2019-11-07 15:27 ` Pierre-Louis Bossart
2019-11-07 13:24 ` [alsa-devel] [PATCH v3 6/6] ASoC: amd: Added ACP3x system resume and runtime pm Ravulapati Vishnu vardhan rao
2019-11-07 15:34 ` Pierre-Louis Bossart [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=dc3c320e-970f-ff49-b542-16dd7058e882@linux.intel.com \
--to=pierre-louis.bossart@linux.intel.com \
--cc=Akshu.Agrawal@amd.com \
--cc=Vijendar.Mukunda@amd.com \
--cc=Vishnuvardhanrao.Ravulapati@amd.com \
--cc=alexander.deucher@amd.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=colin.king@canonical.com \
--cc=dan.carpenter@oracle.com \
--cc=djkurtz@google.com \
--cc=kuninori.morimoto.gx@renesas.com \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maruthi.bayyavarapu@amd.com \
--cc=tiwai@suse.com \
--cc=yuehaibing@huawei.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;
as well as URLs for NNTP newsgroup(s).