Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions sound/soc/sof/pcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -713,9 +713,8 @@ static int sof_pcm_probe(struct snd_soc_component *component)
}

/* enable runtime PM with auto suspend */
pm_runtime_set_autosuspend_delay(component->dev,
SND_SOF_SUSPEND_DELAY);
pm_runtime_use_autosuspend(component->dev);
snd_sof_pm_runtime_enable(sdev);

pm_runtime_enable(component->dev);

pm_runtime_mark_last_busy(component->dev);
Expand Down
18 changes: 18 additions & 0 deletions sound/soc/sof/pm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Copy link
Copy Markdown
Collaborator

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)

Copy link
Copy Markdown
Member

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.

Copy link
Copy Markdown
Collaborator

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


/* follow recommendation in pci-driver.c to decrement usage counter */
if (sdev->pci)
pm_runtime_put_noidle(sdev->dev);

@ranj063 ranj063 Dec 6, 2018 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The 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).
I've just tested it with these 2 changes and things look good.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The 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.

@lgirdwood lgirdwood Dec 6, 2018 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The 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.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lgirdwood sure, I will

Copy link
Copy Markdown

Choose a reason for hiding this comment

The 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);
5 changes: 0 additions & 5 deletions sound/soc/sof/sof-acpi-dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,11 +218,6 @@ static int sof_acpi_probe(struct platform_device *pdev)
return ret;
}

/* allow runtime_pm */
pm_runtime_set_autosuspend_delay(dev, SND_SOF_SUSPEND_DELAY);
pm_runtime_use_autosuspend(dev);
pm_runtime_allow(dev);

return ret;
}

Expand Down
13 changes: 0 additions & 13 deletions sound/soc/sof/sof-pci-dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -253,19 +253,6 @@ static int sof_pci_probe(struct pci_dev *pci,
goto release_regions;
}

/* allow runtime_pm */
pm_runtime_set_autosuspend_delay(dev, SND_SOF_SUSPEND_DELAY);
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:
Expand Down
1 change: 1 addition & 0 deletions sound/soc/sof/sof-priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,7 @@ int snd_sof_resume(struct device *dev);
int snd_sof_suspend(struct device *dev);
int snd_sof_prepare(struct device *dev);
int snd_sof_suspend_late(struct device *dev);
void snd_sof_pm_runtime_enable(struct snd_sof_dev *sdev);

void snd_sof_new_platform_drv(struct snd_sof_dev *sdev);

Expand Down
5 changes: 0 additions & 5 deletions sound/soc/sof/sof-spi-dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,6 @@ static int sof_spi_probe(struct spi_device *spi)

spi->irq = irq;

/* allow runtime_pm */
pm_runtime_set_autosuspend_delay(dev, SND_SOF_SUSPEND_DELAY);
pm_runtime_use_autosuspend(dev);
pm_runtime_allow(dev);

return ret;
}

Expand Down