Skip to content

Commit c76f3b1

Browse files
vijendarmukundabroonie
authored andcommitted
ASoC: amd: ps: fix for acp pme wake for soundwire configuration
Consider the below scenario, When ACP and SoundWire managers are in D3 state and SoundWire manager power off mode is selected and acp and SoundWire manager instances are in runtime suspended state. In this case, for the ACP PME wake event, the ACP PCI driver should resume SoundWire manager devices based on wake enable status set. Add code for handling ACP PME wake event for runtime suspend scenario when SoundWire power off mode is selected. Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com> Link: https://msgid.link/r/20240214104014.1144668-4-Vijendar.Mukunda@amd.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 3c697ce commit c76f3b1

1 file changed

Lines changed: 34 additions & 1 deletion

File tree

sound/soc/amd/ps/pci-ps.c

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,19 @@ static bool check_acp_sdw_enable_status(struct acp63_dev_data *adata)
554554
return (sdw0_en || sdw1_en);
555555
}
556556

557+
static void handle_acp63_sdw_pme_event(struct acp63_dev_data *adata)
558+
{
559+
u32 val;
560+
561+
val = readl(adata->acp63_base + ACP_SW0_WAKE_EN);
562+
if (val && adata->sdw->pdev[0])
563+
pm_request_resume(&adata->sdw->pdev[0]->dev);
564+
565+
val = readl(adata->acp63_base + ACP_SW1_WAKE_EN);
566+
if (val && adata->sdw->pdev[1])
567+
pm_request_resume(&adata->sdw->pdev[1]->dev);
568+
}
569+
557570
static int __maybe_unused snd_acp63_suspend(struct device *dev)
558571
{
559572
struct acp63_dev_data *adata;
@@ -572,6 +585,26 @@ static int __maybe_unused snd_acp63_suspend(struct device *dev)
572585
return ret;
573586
}
574587

588+
static int __maybe_unused snd_acp63_runtime_resume(struct device *dev)
589+
{
590+
struct acp63_dev_data *adata;
591+
int ret;
592+
593+
adata = dev_get_drvdata(dev);
594+
if (adata->sdw_en_stat)
595+
return 0;
596+
597+
ret = acp63_init(adata->acp63_base, dev);
598+
if (ret) {
599+
dev_err(dev, "ACP init failed\n");
600+
return ret;
601+
}
602+
603+
if (!adata->sdw_en_stat)
604+
handle_acp63_sdw_pme_event(adata);
605+
return 0;
606+
}
607+
575608
static int __maybe_unused snd_acp63_resume(struct device *dev)
576609
{
577610
struct acp63_dev_data *adata;
@@ -589,7 +622,7 @@ static int __maybe_unused snd_acp63_resume(struct device *dev)
589622
}
590623

591624
static const struct dev_pm_ops acp63_pm_ops = {
592-
SET_RUNTIME_PM_OPS(snd_acp63_suspend, snd_acp63_resume, NULL)
625+
SET_RUNTIME_PM_OPS(snd_acp63_suspend, snd_acp63_runtime_resume, NULL)
593626
SET_SYSTEM_SLEEP_PM_OPS(snd_acp63_suspend, snd_acp63_resume)
594627
};
595628

0 commit comments

Comments
 (0)