Repository navigation
ASoC: SOF: PM: consolidate runtime PM initialization. #385
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -411,3 +411,21 @@ int snd_sof_prepare(struct device *dev) | |
| return 0; | ||
| } | ||
| EXPORT_SYMBOL(snd_sof_prepare); | ||
|
|
||
| void snd_sof_pm_runtime_enable(struct snd_sof_dev *sdev) | ||
| { | ||
| /* allow runtime_pm */ | ||
| pm_runtime_set_autosuspend_delay(sdev->dev, SND_SOF_SUSPEND_DELAY); | ||
| pm_runtime_use_autosuspend(sdev->dev); | ||
|
|
||
| /* | ||
| * runtime pm for pci device is "forbidden" by default. | ||
| * so call pm_runtime_allow() to enable it. | ||
| */ | ||
| pm_runtime_allow(sdev->dev); | ||
|
|
||
| /* follow recommendation in pci-driver.c to decrement usage counter */ | ||
| if (sdev->pci) | ||
| pm_runtime_put_noidle(sdev->dev); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @lgirdwood and here. this should also be pm_runtime_put_nodle(&sdev->pci->dev).
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @lgirdwood yes that was my point, you need to be careful on which device you interact with. The common routine only handled sdev->dev.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ranj063 probably want to be sdev->parent->dev instead of sdev->pci->dev here as this will cover ACPI, SPI devices etc. Can you send a new PR ? and ping @mengdonglin to have it tested on other devices tomorrow to make sure it's good.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @lgirdwood sure, I will There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ranj063 Now we observed PM failure on APL thesofproject/sof#611 and thesofproject/sof#613 Once you've a new PR, we can test it on APL and GLK. |
||
| } | ||
| EXPORT_SYMBOL(snd_sof_pm_runtime_enable); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lgirdwood the problem is here I think. I think this should be pm_runtime_allow(&sdev->pci->dev)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but if this is a common routine it needs to deal with both the PCI and non-PCI cases, can't hard-code as suggested.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@plbossart agree. I only tested for the pci case. We will need to rework this to address all cases