aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVinod Koul <vinod.koul@intel.com>2016-05-11 23:28:54 -0400
committerMark Brown <broonie@kernel.org>2016-05-13 06:43:12 -0400
commitcce6c149eba3aabf678ffea91ac1e4103b9c185e (patch)
tree05a94e8472c41faf3b39eda130e31f5e45bc63b7
parent4446085d21e75dd6c0c45577f12db0bd7c7bf35f (diff)
ASoC: Intel: Skylake: add link management
Use shiny new link APIs to manage the links. Also remove old link configuration logic from driver. We need to keep link and cmd dma to off during active suspend to allow system to enter low power state and turn it on if the link and cmd dma was on before active suspend in active resume. 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>
-rw-r--r--sound/soc/intel/skylake/skl-pcm.c1
-rw-r--r--sound/soc/intel/skylake/skl.c34
2 files changed, 34 insertions, 1 deletions
diff --git a/sound/soc/intel/skylake/skl-pcm.c b/sound/soc/intel/skylake/skl-pcm.c
index 4494db6a05f5..15480234b20b 100644
--- a/sound/soc/intel/skylake/skl-pcm.c
+++ b/sound/soc/intel/skylake/skl-pcm.c
@@ -533,7 +533,6 @@ static int skl_link_pcm_prepare(struct snd_pcm_substream *substream,
533 if (!link) 533 if (!link)
534 return -EINVAL; 534 return -EINVAL;
535 535
536 snd_hdac_ext_bus_link_power_up(link);
537 snd_hdac_ext_link_stream_reset(link_dev); 536 snd_hdac_ext_link_stream_reset(link_dev);
538 537
539 snd_hdac_ext_link_stream_setup(link_dev, format_val); 538 snd_hdac_ext_link_stream_setup(link_dev, format_val);
diff --git a/sound/soc/intel/skylake/skl.c b/sound/soc/intel/skylake/skl.c
index 83e985c0c0c9..06d8c263c68f 100644
--- a/sound/soc/intel/skylake/skl.c
+++ b/sound/soc/intel/skylake/skl.c
@@ -229,7 +229,12 @@ static int skl_suspend(struct device *dev)
229 * running, we need to save the state for these and continue 229 * running, we need to save the state for these and continue
230 */ 230 */
231 if (skl->supend_active) { 231 if (skl->supend_active) {
232 /* turn off the links and stop the CORB/RIRB DMA if it is On */
232 snd_hdac_ext_bus_link_power_down_all(ebus); 233 snd_hdac_ext_bus_link_power_down_all(ebus);
234
235 if (ebus->cmd_dma_state)
236 snd_hdac_bus_stop_cmd_io(&ebus->bus);
237
233 enable_irq_wake(bus->irq); 238 enable_irq_wake(bus->irq);
234 pci_save_state(pci); 239 pci_save_state(pci);
235 pci_disable_device(pci); 240 pci_disable_device(pci);
@@ -255,6 +260,7 @@ static int skl_resume(struct device *dev)
255 struct hdac_ext_bus *ebus = pci_get_drvdata(pci); 260 struct hdac_ext_bus *ebus = pci_get_drvdata(pci);
256 struct skl *skl = ebus_to_skl(ebus); 261 struct skl *skl = ebus_to_skl(ebus);
257 struct hdac_bus *bus = ebus_to_hbus(ebus); 262 struct hdac_bus *bus = ebus_to_hbus(ebus);
263 struct hdac_ext_link *hlink = NULL;
258 int ret; 264 int ret;
259 265
260 /* Turned OFF in HDMI codec driver after codec reconfiguration */ 266 /* Turned OFF in HDMI codec driver after codec reconfiguration */
@@ -276,8 +282,29 @@ static int skl_resume(struct device *dev)
276 ret = pci_enable_device(pci); 282 ret = pci_enable_device(pci);
277 snd_hdac_ext_bus_link_power_up_all(ebus); 283 snd_hdac_ext_bus_link_power_up_all(ebus);
278 disable_irq_wake(bus->irq); 284 disable_irq_wake(bus->irq);
285 /*
286 * turn On the links which are On before active suspend
287 * and start the CORB/RIRB DMA if On before
288 * active suspend.
289 */
290 list_for_each_entry(hlink, &ebus->hlink_list, list) {
291 if (hlink->ref_count)
292 snd_hdac_ext_bus_link_power_up(hlink);
293 }
294
295 if (ebus->cmd_dma_state)
296 snd_hdac_bus_init_cmd_io(&ebus->bus);
279 } else { 297 } else {
280 ret = _skl_resume(ebus); 298 ret = _skl_resume(ebus);
299
300 /* turn off the links which are off before suspend */
301 list_for_each_entry(hlink, &ebus->hlink_list, list) {
302 if (!hlink->ref_count)
303 snd_hdac_ext_bus_link_power_down(hlink);
304 }
305
306 if (!ebus->cmd_dma_state)
307 snd_hdac_bus_stop_cmd_io(&ebus->bus);
281 } 308 }
282 309
283 return ret; 310 return ret;
@@ -613,6 +640,7 @@ static int skl_probe(struct pci_dev *pci,
613 struct skl *skl; 640 struct skl *skl;
614 struct hdac_ext_bus *ebus = NULL; 641 struct hdac_ext_bus *ebus = NULL;
615 struct hdac_bus *bus = NULL; 642 struct hdac_bus *bus = NULL;
643 struct hdac_ext_link *hlink = NULL;
616 int err; 644 int err;
617 645
618 /* we use ext core ops, so provide NULL for ops here */ 646 /* we use ext core ops, so provide NULL for ops here */
@@ -679,6 +707,12 @@ static int skl_probe(struct pci_dev *pci,
679 } 707 }
680 } 708 }
681 709
710 /*
711 * we are done probling so decrement link counts
712 */
713 list_for_each_entry(hlink, &ebus->hlink_list, list)
714 snd_hdac_ext_bus_link_put(ebus, hlink);
715
682 /*configure PM */ 716 /*configure PM */
683 pm_runtime_put_noidle(bus->dev); 717 pm_runtime_put_noidle(bus->dev);
684 pm_runtime_allow(bus->dev); 718 pm_runtime_allow(bus->dev);