Repository navigation
[RFC] Add sof_probe_complete to deal with delayed/failed hardware initialization #599
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
9c3e169
0138be3
e7845e1
4476a56
0770b36
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 |
|---|---|---|
|
|
@@ -150,6 +150,24 @@ static const struct dev_pm_ops sof_pci_pm = { | |
| NULL) | ||
| }; | ||
|
|
||
| static void sof_pci_probe_complete(struct device *dev) | ||
| { | ||
| dev_dbg(dev, "Completing SOF PCI probe"); | ||
|
|
||
| /* allow runtime_pm */ | ||
| pm_runtime_set_autosuspend_delay(dev, SND_SOF_SUSPEND_DELAY_MS); | ||
| pm_runtime_use_autosuspend(dev); | ||
|
|
||
| /* | ||
| * runtime pm for pci device is "forbidden" by default. | ||
| * so call pm_runtime_allow() to enable it. | ||
| */ | ||
| pm_runtime_allow(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. @plbossart I am wondering what would happen if the dsp probe failed in sof_probe() failed and we never enabled PM?
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 you tell me :-) |
||
|
|
||
| /* follow recommendation in pci-driver.c to decrement usage counter */ | ||
| pm_runtime_put_noidle(dev); | ||
| } | ||
|
|
||
| static int sof_pci_probe(struct pci_dev *pci, | ||
| const struct pci_device_id *pci_id) | ||
| { | ||
|
|
@@ -217,26 +235,16 @@ static int sof_pci_probe(struct pci_dev *pci, | |
| sof_pdata->dev = &pci->dev; | ||
| sof_pdata->platform = "sof-audio"; | ||
|
|
||
| /* set callback to enable runtime_pm */ | ||
| sof_pdata->sof_probe_complete = sof_pci_probe_complete; | ||
|
|
||
| /* register sof-audio platform driver */ | ||
| ret = sof_create_platform_device(priv); | ||
| if (ret) { | ||
| dev_err(dev, "error: failed to create platform device!\n"); | ||
| goto release_regions; | ||
| } | ||
|
|
||
| /* allow runtime_pm */ | ||
| pm_runtime_set_autosuspend_delay(dev, SND_SOF_SUSPEND_DELAY_MS); | ||
| pm_runtime_use_autosuspend(dev); | ||
|
|
||
| /* | ||
| * runtime pm for pci device is "forbidden" by default. | ||
| * so call pm_runtime_allow() to enable it. | ||
| */ | ||
| pm_runtime_allow(dev); | ||
|
|
||
| /* follow recommendation in pci-driver.c to decrement usage counter */ | ||
| pm_runtime_put_noidle(dev); | ||
|
|
||
| return ret; | ||
|
|
||
| release_regions: | ||
|
|
||
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 Thanks, yes this covers all our discussions on this topic but I have a question here. If sdev is in fact NULL, should we return 0 or an error? 0 indicates that suspend/resume was successful. But what we're doing here is avoiding a suspend/resume in this case.