aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJayachandran B <jayachandran.b@intel.com>2016-11-03 07:37:21 -0400
committerMark Brown <broonie@kernel.org>2016-11-09 10:22:48 -0500
commit8b4a133c6145a34618c770117b65b33f1aa993aa (patch)
tree5d6b7351ab858cacd933538f8ea202c8764ddba4
parent68d03a3aa2747e1a33231950d2c8369f1cef4244 (diff)
ASoC: Intel: Skylake: Flush pending D0i3 request on suspend
While going to suspend, if we have any pending D0i3 work scheduled, flush that and force the DSP to goto D0i3 mode before going to suspend. Signed-off-by: Jayachandran B <jayachandran.b@intel.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--sound/soc/intel/skylake/skl-messages.c27
-rw-r--r--sound/soc/intel/skylake/skl.c10
-rw-r--r--sound/soc/intel/skylake/skl.h1
3 files changed, 38 insertions, 0 deletions
diff --git a/sound/soc/intel/skylake/skl-messages.c b/sound/soc/intel/skylake/skl-messages.c
index 87fc647fa04c..4ae021aabc3a 100644
--- a/sound/soc/intel/skylake/skl-messages.c
+++ b/sound/soc/intel/skylake/skl-messages.c
@@ -294,6 +294,33 @@ int skl_free_dsp(struct skl *skl)
294 return 0; 294 return 0;
295} 295}
296 296
297/*
298 * In the case of "suspend_active" i.e, the Audio IP being active
299 * during system suspend, immediately excecute any pending D0i3 work
300 * before suspending. This is needed for the IP to work in low power
301 * mode during system suspend. In the case of normal suspend, cancel
302 * any pending D0i3 work.
303 */
304int skl_suspend_late_dsp(struct skl *skl)
305{
306 struct skl_sst *ctx = skl->skl_sst;
307 struct delayed_work *dwork;
308
309 if (!ctx)
310 return 0;
311
312 dwork = &ctx->d0i3.work;
313
314 if (dwork->work.func) {
315 if (skl->supend_active)
316 flush_delayed_work(dwork);
317 else
318 cancel_delayed_work_sync(dwork);
319 }
320
321 return 0;
322}
323
297int skl_suspend_dsp(struct skl *skl) 324int skl_suspend_dsp(struct skl *skl)
298{ 325{
299 struct skl_sst *ctx = skl->skl_sst; 326 struct skl_sst *ctx = skl->skl_sst;
diff --git a/sound/soc/intel/skylake/skl.c b/sound/soc/intel/skylake/skl.c
index ed59783e9846..61a484888cfa 100644
--- a/sound/soc/intel/skylake/skl.c
+++ b/sound/soc/intel/skylake/skl.c
@@ -228,6 +228,15 @@ static int skl_acquire_irq(struct hdac_ext_bus *ebus, int do_disconnect)
228 return 0; 228 return 0;
229} 229}
230 230
231static int skl_suspend_late(struct device *dev)
232{
233 struct pci_dev *pci = to_pci_dev(dev);
234 struct hdac_ext_bus *ebus = pci_get_drvdata(pci);
235 struct skl *skl = ebus_to_skl(ebus);
236
237 return skl_suspend_late_dsp(skl);
238}
239
231#ifdef CONFIG_PM 240#ifdef CONFIG_PM
232static int _skl_suspend(struct hdac_ext_bus *ebus) 241static int _skl_suspend(struct hdac_ext_bus *ebus)
233{ 242{
@@ -390,6 +399,7 @@ static int skl_runtime_resume(struct device *dev)
390static const struct dev_pm_ops skl_pm = { 399static const struct dev_pm_ops skl_pm = {
391 SET_SYSTEM_SLEEP_PM_OPS(skl_suspend, skl_resume) 400 SET_SYSTEM_SLEEP_PM_OPS(skl_suspend, skl_resume)
392 SET_RUNTIME_PM_OPS(skl_runtime_suspend, skl_runtime_resume, NULL) 401 SET_RUNTIME_PM_OPS(skl_runtime_suspend, skl_runtime_resume, NULL)
402 .suspend_late = skl_suspend_late,
393}; 403};
394 404
395/* 405/*
diff --git a/sound/soc/intel/skylake/skl.h b/sound/soc/intel/skylake/skl.h
index 88ba54ba5f72..4986e3929dd3 100644
--- a/sound/soc/intel/skylake/skl.h
+++ b/sound/soc/intel/skylake/skl.h
@@ -124,6 +124,7 @@ int skl_get_dmic_geo(struct skl *skl);
124int skl_nhlt_update_topology_bin(struct skl *skl); 124int skl_nhlt_update_topology_bin(struct skl *skl);
125int skl_init_dsp(struct skl *skl); 125int skl_init_dsp(struct skl *skl);
126int skl_free_dsp(struct skl *skl); 126int skl_free_dsp(struct skl *skl);
127int skl_suspend_late_dsp(struct skl *skl);
127int skl_suspend_dsp(struct skl *skl); 128int skl_suspend_dsp(struct skl *skl);
128int skl_resume_dsp(struct skl *skl); 129int skl_resume_dsp(struct skl *skl);
129void skl_cleanup_resources(struct skl *skl); 130void skl_cleanup_resources(struct skl *skl);