From: <Claudiu.Beznea@microchip.com>
To: <Vijendar.Mukunda@amd.com>, <vkoul@kernel.org>
Cc: <alsa-devel@alsa-project.org>,
<pierre-louis.bossart@linux.intel.com>,
<Basavaraj.Hiregoudar@amd.com>, <Sunil-kumar.Dommati@amd.com>,
<Mario.Limonciello@amd.com>,
<amadeuszx.slawinski@linux.intel.com>,
<Mastan.Katragadda@amd.com>, <Arungopal.kondaveeti@amd.com>,
<yung-chuan.liao@linux.intel.com>, <sanyog.r.kale@intel.com>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH V4 6/8] soundwire: amd: add runtime pm ops for AMD SoundWire manager driver
Date: Tue, 28 Feb 2023 10:30:50 +0000 [thread overview]
Message-ID: <cc6ab93b-c964-8bf8-db60-ac20aa0a3006@microchip.com> (raw)
In-Reply-To: <20230227154801.50319-7-Vijendar.Mukunda@amd.com>
On 27.02.2023 17:47, Vijendar Mukunda wrote:
> Add support for runtime pm ops for AMD SoundWire manager driver.
>
> Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
> Signed-off-by: Mastan Katragadda <Mastan.Katragadda@amd.com>
> ---
> drivers/soundwire/amd_manager.c | 161 ++++++++++++++++++++++++++++++
> drivers/soundwire/amd_manager.h | 3 +
> include/linux/soundwire/sdw_amd.h | 17 ++++
> 3 files changed, 181 insertions(+)
>
> diff --git a/drivers/soundwire/amd_manager.c b/drivers/soundwire/amd_manager.c
> index 7bb2300f16b3..12345077c395 100644
> --- a/drivers/soundwire/amd_manager.c
> +++ b/drivers/soundwire/amd_manager.c
> @@ -14,6 +14,7 @@
> #include <linux/slab.h>
> #include <linux/soundwire/sdw.h>
> #include <linux/soundwire/sdw_registers.h>
> +#include <linux/pm_runtime.h>
> #include <linux/wait.h>
> #include <sound/pcm_params.h>
> #include <sound/soc.h>
> @@ -178,6 +179,12 @@ static void amd_disable_sdw_interrupts(struct amd_sdw_manager *amd_manager)
> acp_reg_writel(0x00, amd_manager->mmio + ACP_SW_ERROR_INTR_MASK);
> }
>
> +static int amd_deinit_sdw_manager(struct amd_sdw_manager *amd_manager)
> +{
> + amd_disable_sdw_interrupts(amd_manager);
> + return amd_disable_sdw_manager(amd_manager);
> +}
> +
> static void amd_sdw_set_frameshape(struct amd_sdw_manager *amd_manager)
> {
> u32 frame_size;
> @@ -957,6 +964,12 @@ static void amd_sdw_probe_work(struct work_struct *work)
> return;
> amd_sdw_set_frameshape(amd_manager);
> }
> + /* Enable runtime PM */
> + pm_runtime_set_autosuspend_delay(amd_manager->dev, AMD_SDW_MASTER_SUSPEND_DELAY_MS);
> + pm_runtime_use_autosuspend(amd_manager->dev);
> + pm_runtime_mark_last_busy(amd_manager->dev);
> + pm_runtime_set_active(amd_manager->dev);
> + pm_runtime_enable(amd_manager->dev);
> }
>
> static int amd_sdw_manager_probe(struct platform_device *pdev)
> @@ -1040,17 +1053,165 @@ static int amd_sdw_manager_remove(struct platform_device *pdev)
> {
> struct amd_sdw_manager *amd_manager = dev_get_drvdata(&pdev->dev);
>
> + pm_runtime_disable(&pdev->dev);
> cancel_work_sync(&amd_manager->probe_work);
> amd_disable_sdw_interrupts(amd_manager);
> sdw_bus_master_delete(&amd_manager->bus);
> return amd_disable_sdw_manager(amd_manager);
> }
>
> +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);
> + if (val & AMD_SDW_CLK_STOP_DONE) {
> + amd_manager->clk_stopped = true;
> + break;
> + }
> + usleep_range(10, 20);
> + } while (retry_count++ < AMD_SDW_CLK_STOP_MAX_RETRY_COUNT);
Could these do { } while () be replaced by read_poll_timeout() ?
next prev parent reply other threads:[~2023-02-28 10:31 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20230227154801.50319-1-Vijendar.Mukunda@amd.com>
2023-02-27 15:47 ` [PATCH V4 1/8] soundwire: export sdw_compute_slave_ports() function Vijendar Mukunda
2023-02-27 15:47 ` [PATCH V4 2/8] soundwire: amd: Add support for AMD Manager driver Vijendar Mukunda
2023-02-27 16:35 ` Pierre-Louis Bossart
2023-02-27 18:08 ` Mukunda,Vijendar
2023-02-27 18:08 ` Mario Limonciello
2023-02-27 15:47 ` [PATCH V4 3/8] soundwire: amd: register SoundWire manager dai ops Vijendar Mukunda
2023-02-27 16:37 ` Pierre-Louis Bossart
2023-02-27 15:47 ` [PATCH V4 4/8] soundwire: amd: enable build for AMD SoundWire manager driver Vijendar Mukunda
2023-02-27 15:47 ` [PATCH V4 5/8] soundwire: amd: add SoundWire manager interrupt handling Vijendar Mukunda
2023-02-27 16:38 ` Pierre-Louis Bossart
2023-02-27 15:47 ` [PATCH V4 6/8] soundwire: amd: add runtime pm ops for AMD SoundWire manager driver Vijendar Mukunda
2023-02-27 17:01 ` Pierre-Louis Bossart
2023-02-28 10:30 ` Claudiu.Beznea [this message]
2023-02-27 15:48 ` [PATCH V4 7/8] soundwire: amd: handle SoundWire wake enable interrupt Vijendar Mukunda
2023-02-27 17:02 ` Pierre-Louis Bossart
2023-02-27 15:48 ` [PATCH V4 8/8] soundwire: amd: add pm_prepare callback and pm ops support Vijendar Mukunda
2023-02-27 17:07 ` Pierre-Louis Bossart
2023-02-27 18:42 ` Mukunda,Vijendar
2023-02-27 19:40 ` Pierre-Louis Bossart
2023-02-28 1:03 ` Mukunda,Vijendar
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=cc6ab93b-c964-8bf8-db60-ac20aa0a3006@microchip.com \
--to=claudiu.beznea@microchip.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=Vijendar.Mukunda@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
all inboxes | Powered by JetHome®