public inbox for alsa-devel@alsa-project.org
 help / color / mirror / Atom feed
From: "Mukunda,Vijendar" <vijendar.mukunda@amd.com>
To: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
	vkoul@kernel.org
Cc: 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>,
	"moderated list:SOUNDWIRE SUBSYSTEM"
	<alsa-devel@alsa-project.org>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH V2 6/8] soundwire: amd: add runtime pm ops for AMD soundwire manager driver
Date: Tue, 14 Feb 2023 11:43:31 +0530	[thread overview]
Message-ID: <65ec1f29-2ad2-acd6-feff-7d1d6f40ef8b@amd.com> (raw)
In-Reply-To: <383a8166-bc60-8557-e76b-f6287c967598@linux.intel.com>

On 13/02/23 23:50, Pierre-Louis Bossart wrote:
>
> On 2/13/23 03:40, 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   | 163 ++++++++++++++++++++++++++++++
>>  drivers/soundwire/amd_manager.h   |   3 +
>>  include/linux/soundwire/sdw_amd.h |  16 +++
>>  3 files changed, 182 insertions(+)
>>
>> diff --git a/drivers/soundwire/amd_manager.c b/drivers/soundwire/amd_manager.c
>> index 87f9a987d93a..eced189ba6e0 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>
>> @@ -185,6 +186,15 @@ 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)
>> +{
>> +	int ret;
>> +
>> +	amd_disable_sdw_interrupts(amd_manager);
>> +	ret = amd_disable_sdw_manager(amd_manager);
>> +	return ret;
>> +}
>> +
>>  static void amd_sdw_set_frameshape(struct amd_sdw_manager *amd_manager)
>>  {
>>  	u32 frame_size;
>> @@ -1043,6 +1053,12 @@ static int amd_sdw_manager_probe(struct platform_device *pdev)
>>  	INIT_WORK(&amd_manager->amd_sdw_work, amd_sdw_update_slave_status_work);
>>  	INIT_WORK(&amd_manager->probe_work, amd_sdw_probe_work);
>>  	schedule_work(&amd_manager->probe_work);
>> +	/* Enable runtime PM */
>> +	pm_runtime_set_autosuspend_delay(dev, AMD_SDW_MASTER_SUSPEND_DELAY_MS);
>> +	pm_runtime_use_autosuspend(dev);
>> +	pm_runtime_mark_last_busy(dev);
>> +	pm_runtime_set_active(dev);
>> +	pm_runtime_enable(dev);
> that doesn't sound good to me, why do this here and not in the work
> function? That creates a racy case where the device might suspend before
> being initialized.
This can be moved to work function.
>
>>  	return 0;
>>  }
>>  
>> @@ -1057,14 +1073,161 @@ static int amd_sdw_manager_remove(struct platform_device *pdev)
>>  	amd_disable_sdw_interrupts(amd_manager);
>>  	sdw_bus_master_delete(&amd_manager->bus);
>>  	ret = amd_disable_sdw_manager(amd_manager);
>> +	pm_runtime_disable(&pdev->dev);
> shouldn't you do the pm_runtime_disable first?
I agree. Will fix it.
>
>>  	return ret;
>>  }
>> +/* AMD pm_runtime quirk definitions */
>> +
>> +/*
>> + * Force the clock to stop(ClockStopMode0) when suspend callback
>> + * is invoked.
>> + */
>> +#define AMD_SDW_CLK_STOP_MODE		1
>> +
>> +/*
>> + * Stop the bus when runtime suspend/system level suspend callback
>> + * is invoked. If set, a complete bus reset and re-enumeration will
>> + * be performed when the bus restarts.
>> + */
>> +#define AMD_SDW_POWER_OFF_MODE		2
> You need to clarify this mode, can you deal with device in-band wakes if
> the power is off?
On the Current platform, in-band wakes are not supported if the power is off.


>
>>  #define ACP_SDW0	0
>>  #define ACP_SDW1	1
>>  
>> @@ -57,6 +71,7 @@ struct sdw_amd_dai_runtime {
>>   * @instance: soundwire manager instance
>>   * @quirks: soundwire manager quirks
>>   * @wake_en_mask: wake enable mask per soundwire manager
>> + * @clk_stopped: flag set to true when clock is stopped
>>   * @power_mode_mask: flag interprets amd soundwire manager power mode
>>   * @dai_runtime_array: dai runtime array
>>   */
>> @@ -86,6 +101,7 @@ struct amd_sdw_manager {
>>  	u32 quirks;
>>  	u32 wake_en_mask;
>>  	u32 power_mode_mask;
>> +	bool clk_stopped;
>>  
>>  	struct sdw_amd_dai_runtime **dai_runtime_array;
>>  };


  reply	other threads:[~2023-02-14  6:12 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20230213094031.2231058-1-Vijendar.Mukunda@amd.com>
2023-02-13  9:40 ` [PATCH V2 1/8] soundwire: export sdw_compute_slave_ports() function Vijendar Mukunda
2023-02-13  9:40 ` [PATCH V2 2/8] soundwire: amd: Add support for AMD Manager driver Vijendar Mukunda
2023-02-13 18:05   ` Pierre-Louis Bossart
2023-02-14  5:28     ` Mukunda,Vijendar
2023-02-14 13:21       ` Pierre-Louis Bossart
2023-02-14 22:29         ` Mukunda,Vijendar
2023-02-13  9:40 ` [PATCH V2 3/8] soundwire: amd: register soundwire manager dai ops Vijendar Mukunda
2023-02-13 18:09   ` Pierre-Louis Bossart
2023-02-14  5:49     ` Mukunda,Vijendar
2023-02-13  9:40 ` [PATCH V2 4/8] soundwire: amd: enable build for AMD soundwire manager driver Vijendar Mukunda
2023-02-13  9:40 ` [PATCH V2 5/8] soundwire: amd: add soundwire manager interrupt handling Vijendar Mukunda
2023-02-13 18:15   ` Pierre-Louis Bossart
2023-02-14  5:56     ` Mukunda,Vijendar
2023-02-14  7:54       ` Mukunda,Vijendar
2023-02-14 13:28         ` Pierre-Louis Bossart
2023-02-14 22:18           ` Mukunda,Vijendar
2023-02-13  9:40 ` [PATCH V2 6/8] soundwire: amd: add runtime pm ops for AMD soundwire manager driver Vijendar Mukunda
2023-02-13 18:20   ` Pierre-Louis Bossart
2023-02-14  6:13     ` Mukunda,Vijendar [this message]
2023-02-14 13:33       ` Pierre-Louis Bossart
2023-02-14 21:44         ` Mukunda,Vijendar
2023-02-13  9:40 ` [PATCH V2 7/8] soundwire: amd: handle soundwire wake enable interrupt Vijendar Mukunda
2023-02-13 18:24   ` Pierre-Louis Bossart
2023-02-14  6:15     ` Mukunda,Vijendar
2023-02-14 13:35       ` Pierre-Louis Bossart
2023-02-14 21:24         ` Mukunda,Vijendar
2023-02-13  9:40 ` [PATCH V2 8/8] soundwire: amd: add pm_prepare callback and pm ops support Vijendar Mukunda

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=65ec1f29-2ad2-acd6-feff-7d1d6f40ef8b@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