From: "Mukunda,Vijendar" <vijendar.mukunda@amd.com>
To: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
vkoul@kernel.org
Cc: alsa-devel@alsa-project.org, amadeuszx.slawinski@linux.intel.com,
Mario.Limonciello@amd.com, Sunil-kumar.Dommati@amd.com,
Basavaraj.Hiregoudar@amd.com, Mastan.Katragadda@amd.com,
Arungopal.kondaveeti@amd.com,
Bard Liao <yung-chuan.liao@linux.intel.com>,
Sanyog Kale <sanyog.r.kale@intel.com>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH V3 6/8] soundwire: amd: add runtime pm ops for AMD SoundWire manager driver
Date: Wed, 22 Feb 2023 02:20:41 +0530 [thread overview]
Message-ID: <db9b7a9c-7067-a955-ce4c-52bbf374bb59@amd.com> (raw)
In-Reply-To: <72b601b9-93bf-b9f5-c898-c63ad46e5167@linux.intel.com>
On 21/02/23 21:40, Pierre-Louis Bossart wrote:
>> +static int amd_deinit_sdw_manager(struct amd_sdw_manager *amd_manager)
>> +{
>> + int ret;
>> +
>> + amd_disable_sdw_interrupts(amd_manager);
>> + ret = amd_disable_sdw_manager(amd_manager);
>> + return ret;
> return amd_disable_sdw_manager(amd_manager); ?
will fix it.
>> +}
>> +static int amd_sdw_clock_stop(struct amd_sdw_manager *amd_manager)
>> +{
>> + u32 val;
>> + u32 retry_count = 0;
>> + int ret;
>> +
>> + ret = sdw_bus_prep_clk_stop(&amd_manager->bus);
>> + if (ret < 0 && ret != -ENODATA) {
>> + dev_err(amd_manager->dev, "prepare clock stop failed %d", ret);
>> + return 0;
>> + }
>> + ret = sdw_bus_clk_stop(&amd_manager->bus);
>> + if (ret < 0 && ret != -ENODATA) {
>> + dev_err(amd_manager->dev, "bus clock stop failed %d", ret);
>> + return 0;
>> + }
>> +
>> + do {
>> + val = acp_reg_readl(amd_manager->mmio + ACP_SW_CLK_RESUME_CTRL);
> don't you need a minimal usleep_range to avoid re-reading the same
> register over and over?
>
> This is tied to the frame duration, isn't it? this is 20us typically.
I agree. will update the code with usleep_range(10,20)
>
>> + if (val & AMD_SDW_CLK_STOP_DONE) {
>> + amd_manager->clk_stopped = true;
>> + break;
>> + }
>> + } while (retry_count++ < AMD_SDW_CLK_STOP_MAX_RETRY_COUNT);
>> +
>> + if (!amd_manager->clk_stopped) {
>> + dev_err(amd_manager->dev, "SDW%x clock stop failed\n", amd_manager->instance);
>> + return 0;
>> + }
>> +
>> + if (amd_manager->wake_en_mask)
>> + acp_reg_writel(0x01, amd_manager->acp_mmio + ACP_SW_WAKE_EN(amd_manager->instance));
>> +
>> + dev_dbg(amd_manager->dev, "SDW%x clock stop successful\n", amd_manager->instance);
>> + return 0;
>> +}
>> +
>> +static int amd_sdw_clock_stop_exit(struct amd_sdw_manager *amd_manager)
>> +{
>> + int ret;
>> + u32 val;
>> + u32 retry_count = 0;
>> +
>> + if (amd_manager->clk_stopped) {
>> + val = acp_reg_readl(amd_manager->mmio + ACP_SW_CLK_RESUME_CTRL);
>> + val |= AMD_SDW_CLK_RESUME_REQ;
>> + acp_reg_writel(val, amd_manager->mmio + ACP_SW_CLK_RESUME_CTRL);
>> + do {
>> + val = acp_reg_readl(amd_manager->mmio + ACP_SW_CLK_RESUME_CTRL);
>> + if (val & AMD_SDW_CLK_RESUME_DONE)
>> + break;
>> + usleep_range(10, 100);
> that's 10x range for sleep, that sounds a vague and suspicious, no?
Agreed . usleep_range(10, 20) is enough in this case.
will fix it.
>
>> + } while (retry_count++ < AMD_SDW_CLK_STOP_MAX_RETRY_COUNT);
>> + if (val & AMD_SDW_CLK_RESUME_DONE) {
>> + acp_reg_writel(0, amd_manager->mmio + ACP_SW_CLK_RESUME_CTRL);
>> + ret = sdw_bus_exit_clk_stop(&amd_manager->bus);
>> + if (ret < 0)
>> + dev_err(amd_manager->dev, "bus failed to exit clock stop %d\n",
>> + ret);
>> + amd_manager->clk_stopped = false;
>> + }
>> + }
>> + if (amd_manager->clk_stopped) {
>> + dev_err(amd_manager->dev, "SDW%x clock stop exit failed\n", amd_manager->instance);
>> + return 0;
>> + }
>> + dev_dbg(amd_manager->dev, "SDW%x clock stop exit successful\n", amd_manager->instance);
>> + return 0;
next prev parent reply other threads:[~2023-02-21 20:49 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-20 10:04 [PATCH V3 0/8] Add SoundWire support for AMD platforms Vijendar Mukunda
2023-02-20 10:04 ` [PATCH V3 1/8] soundwire: export sdw_compute_slave_ports() function Vijendar Mukunda
2023-02-20 10:04 ` [PATCH V3 2/8] soundwire: amd: Add support for AMD Manager driver Vijendar Mukunda
2023-02-21 15:57 ` Pierre-Louis Bossart
2023-02-22 7:18 ` Mukunda,Vijendar
2023-02-22 9:31 ` Claudiu.Beznea
2023-02-20 10:04 ` [PATCH V3 3/8] soundwire: amd: register SoundWire manager dai ops Vijendar Mukunda
2023-02-21 15:59 ` Pierre-Louis Bossart
2023-02-21 21:05 ` Mukunda,Vijendar
2023-02-21 23:48 ` Pierre-Louis Bossart
2023-02-22 5:39 ` Mukunda,Vijendar
2023-02-20 10:04 ` [PATCH V3 4/8] soundwire: amd: enable build for AMD SoundWire manager driver Vijendar Mukunda
2023-02-21 16:01 ` Pierre-Louis Bossart
2023-02-20 10:04 ` [PATCH V3 5/8] soundwire: amd: add SoundWire manager interrupt handling Vijendar Mukunda
2023-02-21 16:05 ` Pierre-Louis Bossart
2023-02-22 9:02 ` Mukunda,Vijendar
2023-02-20 10:04 ` [PATCH V3 6/8] soundwire: amd: add runtime pm ops for AMD SoundWire manager driver Vijendar Mukunda
2023-02-21 16:10 ` Pierre-Louis Bossart
2023-02-21 20:50 ` Mukunda,Vijendar [this message]
2023-02-20 10:04 ` [PATCH V3 7/8] soundwire: amd: handle SoundWire wake enable interrupt Vijendar Mukunda
2023-02-21 16:13 ` Pierre-Louis Bossart
2023-02-21 20:40 ` Mukunda,Vijendar
2023-02-20 10:04 ` [PATCH V3 8/8] soundwire: amd: add pm_prepare callback and pm ops support Vijendar Mukunda
2023-02-21 16:24 ` Pierre-Louis Bossart
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=db9b7a9c-7067-a955-ce4c-52bbf374bb59@amd.com \
--to=vijendar.mukunda@amd.com \
--cc=Arungopal.kondaveeti@amd.com \
--cc=Basavaraj.Hiregoudar@amd.com \
--cc=Mario.Limonciello@amd.com \
--cc=Mastan.Katragadda@amd.com \
--cc=Sunil-kumar.Dommati@amd.com \
--cc=alsa-devel@alsa-project.org \
--cc=amadeuszx.slawinski@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=pierre-louis.bossart@linux.intel.com \
--cc=sanyog.r.kale@intel.com \
--cc=vkoul@kernel.org \
--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