ASoC: Intel: Skylake: Add support for active suspend

Some of the usecases can be marked as 'ignore_suspend' by
machine. For these on suspend we should keep audio controller
ON by saving the state and not suspending the device

For this we need to maintain a counter for these streams and be
active on suspend when such a stream is opened.

Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Šī revīzija ir iekļauta:
Jeeja KP
2015-12-03 23:30:00 +05:30
revīziju iesūtīja Mark Brown
vecāks 820f339fe9
revīzija 4557c305d4
3 mainīti faili ar 55 papildinājumiem un 2 dzēšanām

Parādīt failu

@@ -169,16 +169,40 @@ static int skl_suspend(struct device *dev)
{
struct pci_dev *pci = to_pci_dev(dev);
struct hdac_ext_bus *ebus = pci_get_drvdata(pci);
struct skl *skl = ebus_to_skl(ebus);
return _skl_suspend(ebus);
/*
* Do not suspend if streams which are marked ignore suspend are
* running, we need to save the state for these and continue
*/
if (skl->supend_active) {
pci_save_state(pci);
pci_disable_device(pci);
return 0;
} else {
return _skl_suspend(ebus);
}
}
static int skl_resume(struct device *dev)
{
struct pci_dev *pci = to_pci_dev(dev);
struct hdac_ext_bus *ebus = pci_get_drvdata(pci);
struct skl *skl = ebus_to_skl(ebus);
int ret;
return _skl_resume(ebus);
/*
* resume only when we are not in suspend active, otherwise need to
* restore the device
*/
if (skl->supend_active) {
pci_restore_state(pci);
ret = pci_enable_device(pci);
} else {
ret = _skl_resume(ebus);
}
return ret;
}
#endif /* CONFIG_PM_SLEEP */