aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sound/hda/ext/hdac_ext_stream.c5
-rw-r--r--sound/soc/intel/Kconfig1
-rw-r--r--sound/soc/intel/haswell/sst-haswell-ipc.c2
-rw-r--r--sound/soc/intel/skylake/skl-sst-dsp.c5
-rw-r--r--sound/soc/intel/skylake/skl-topology.c42
-rw-r--r--sound/soc/intel/skylake/skl-topology.h8
-rw-r--r--sound/soc/intel/skylake/skl.c32
7 files changed, 63 insertions, 32 deletions
diff --git a/sound/hda/ext/hdac_ext_stream.c b/sound/hda/ext/hdac_ext_stream.c
index 023cc4cad5c1..626f3bb24c55 100644
--- a/sound/hda/ext/hdac_ext_stream.c
+++ b/sound/hda/ext/hdac_ext_stream.c
@@ -104,12 +104,11 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_stream_init_all);
104 */ 104 */
105void snd_hdac_stream_free_all(struct hdac_ext_bus *ebus) 105void snd_hdac_stream_free_all(struct hdac_ext_bus *ebus)
106{ 106{
107 struct hdac_stream *s; 107 struct hdac_stream *s, *_s;
108 struct hdac_ext_stream *stream; 108 struct hdac_ext_stream *stream;
109 struct hdac_bus *bus = ebus_to_hbus(ebus); 109 struct hdac_bus *bus = ebus_to_hbus(ebus);
110 110
111 while (!list_empty(&bus->stream_list)) { 111 list_for_each_entry_safe(s, _s, &bus->stream_list, list) {
112 s = list_first_entry(&bus->stream_list, struct hdac_stream, list);
113 stream = stream_to_hdac_ext_stream(s); 112 stream = stream_to_hdac_ext_stream(s);
114 snd_hdac_ext_stream_decouple(ebus, stream, false); 113 snd_hdac_ext_stream_decouple(ebus, stream, false);
115 list_del(&s->list); 114 list_del(&s->list);
diff --git a/sound/soc/intel/Kconfig b/sound/soc/intel/Kconfig
index b3e6c2300457..1120f4f4d011 100644
--- a/sound/soc/intel/Kconfig
+++ b/sound/soc/intel/Kconfig
@@ -163,7 +163,6 @@ config SND_SOC_INTEL_SKYLAKE
163 tristate 163 tristate
164 select SND_HDA_EXT_CORE 164 select SND_HDA_EXT_CORE
165 select SND_SOC_TOPOLOGY 165 select SND_SOC_TOPOLOGY
166 select SND_HDA_I915
167 select SND_SOC_INTEL_SST 166 select SND_SOC_INTEL_SST
168 167
169config SND_SOC_INTEL_SKL_RT286_MACH 168config SND_SOC_INTEL_SKL_RT286_MACH
diff --git a/sound/soc/intel/haswell/sst-haswell-ipc.c b/sound/soc/intel/haswell/sst-haswell-ipc.c
index ac60f1301e21..91565229d074 100644
--- a/sound/soc/intel/haswell/sst-haswell-ipc.c
+++ b/sound/soc/intel/haswell/sst-haswell-ipc.c
@@ -1345,7 +1345,7 @@ int sst_hsw_stream_reset(struct sst_hsw *hsw, struct sst_hsw_stream *stream)
1345 return 0; 1345 return 0;
1346 1346
1347 /* wait for pause to complete before we reset the stream */ 1347 /* wait for pause to complete before we reset the stream */
1348 while (stream->running && tries--) 1348 while (stream->running && --tries)
1349 msleep(1); 1349 msleep(1);
1350 if (!tries) { 1350 if (!tries) {
1351 dev_err(hsw->dev, "error: reset stream %d still running\n", 1351 dev_err(hsw->dev, "error: reset stream %d still running\n",
diff --git a/sound/soc/intel/skylake/skl-sst-dsp.c b/sound/soc/intel/skylake/skl-sst-dsp.c
index a5267e8a96e0..2962ef22fc84 100644
--- a/sound/soc/intel/skylake/skl-sst-dsp.c
+++ b/sound/soc/intel/skylake/skl-sst-dsp.c
@@ -336,6 +336,11 @@ void skl_dsp_free(struct sst_dsp *dsp)
336 skl_ipc_int_disable(dsp); 336 skl_ipc_int_disable(dsp);
337 337
338 free_irq(dsp->irq, dsp); 338 free_irq(dsp->irq, dsp);
339 dsp->cl_dev.ops.cl_cleanup_controller(dsp);
340 skl_cldma_int_disable(dsp);
341 skl_ipc_op_int_disable(dsp);
342 skl_ipc_int_disable(dsp);
343
339 skl_dsp_disable_core(dsp); 344 skl_dsp_disable_core(dsp);
340} 345}
341EXPORT_SYMBOL_GPL(skl_dsp_free); 346EXPORT_SYMBOL_GPL(skl_dsp_free);
diff --git a/sound/soc/intel/skylake/skl-topology.c b/sound/soc/intel/skylake/skl-topology.c
index 545b4e77b8aa..cdb78b7e5a14 100644
--- a/sound/soc/intel/skylake/skl-topology.c
+++ b/sound/soc/intel/skylake/skl-topology.c
@@ -239,6 +239,7 @@ static void skl_tplg_update_buffer_size(struct skl_sst *ctx,
239{ 239{
240 int multiplier = 1; 240 int multiplier = 1;
241 struct skl_module_fmt *in_fmt, *out_fmt; 241 struct skl_module_fmt *in_fmt, *out_fmt;
242 int in_rate, out_rate;
242 243
243 244
244 /* Since fixups is applied to pin 0 only, ibs, obs needs 245 /* Since fixups is applied to pin 0 only, ibs, obs needs
@@ -249,15 +250,24 @@ static void skl_tplg_update_buffer_size(struct skl_sst *ctx,
249 250
250 if (mcfg->m_type == SKL_MODULE_TYPE_SRCINT) 251 if (mcfg->m_type == SKL_MODULE_TYPE_SRCINT)
251 multiplier = 5; 252 multiplier = 5;
252 mcfg->ibs = (in_fmt->s_freq / 1000) * 253
253 (mcfg->in_fmt->channels) * 254 if (in_fmt->s_freq % 1000)
254 (mcfg->in_fmt->bit_depth >> 3) * 255 in_rate = (in_fmt->s_freq / 1000) + 1;
255 multiplier; 256 else
256 257 in_rate = (in_fmt->s_freq / 1000);
257 mcfg->obs = (mcfg->out_fmt->s_freq / 1000) * 258
258 (mcfg->out_fmt->channels) * 259 mcfg->ibs = in_rate * (mcfg->in_fmt->channels) *
259 (mcfg->out_fmt->bit_depth >> 3) * 260 (mcfg->in_fmt->bit_depth >> 3) *
260 multiplier; 261 multiplier;
262
263 if (mcfg->out_fmt->s_freq % 1000)
264 out_rate = (mcfg->out_fmt->s_freq / 1000) + 1;
265 else
266 out_rate = (mcfg->out_fmt->s_freq / 1000);
267
268 mcfg->obs = out_rate * (mcfg->out_fmt->channels) *
269 (mcfg->out_fmt->bit_depth >> 3) *
270 multiplier;
261} 271}
262 272
263static int skl_tplg_update_be_blob(struct snd_soc_dapm_widget *w, 273static int skl_tplg_update_be_blob(struct snd_soc_dapm_widget *w,
@@ -485,11 +495,15 @@ skl_tplg_init_pipe_modules(struct skl *skl, struct skl_pipe *pipe)
485 if (!skl_is_pipe_mcps_avail(skl, mconfig)) 495 if (!skl_is_pipe_mcps_avail(skl, mconfig))
486 return -ENOMEM; 496 return -ENOMEM;
487 497
498 skl_tplg_alloc_pipe_mcps(skl, mconfig);
499
488 if (mconfig->is_loadable && ctx->dsp->fw_ops.load_mod) { 500 if (mconfig->is_loadable && ctx->dsp->fw_ops.load_mod) {
489 ret = ctx->dsp->fw_ops.load_mod(ctx->dsp, 501 ret = ctx->dsp->fw_ops.load_mod(ctx->dsp,
490 mconfig->id.module_id, mconfig->guid); 502 mconfig->id.module_id, mconfig->guid);
491 if (ret < 0) 503 if (ret < 0)
492 return ret; 504 return ret;
505
506 mconfig->m_state = SKL_MODULE_LOADED;
493 } 507 }
494 508
495 /* update blob if blob is null for be with default value */ 509 /* update blob if blob is null for be with default value */
@@ -509,7 +523,6 @@ skl_tplg_init_pipe_modules(struct skl *skl, struct skl_pipe *pipe)
509 ret = skl_tplg_set_module_params(w, ctx); 523 ret = skl_tplg_set_module_params(w, ctx);
510 if (ret < 0) 524 if (ret < 0)
511 return ret; 525 return ret;
512 skl_tplg_alloc_pipe_mcps(skl, mconfig);
513 } 526 }
514 527
515 return 0; 528 return 0;
@@ -524,7 +537,8 @@ static int skl_tplg_unload_pipe_modules(struct skl_sst *ctx,
524 list_for_each_entry(w_module, &pipe->w_list, node) { 537 list_for_each_entry(w_module, &pipe->w_list, node) {
525 mconfig = w_module->w->priv; 538 mconfig = w_module->w->priv;
526 539
527 if (mconfig->is_loadable && ctx->dsp->fw_ops.unload_mod) 540 if (mconfig->is_loadable && ctx->dsp->fw_ops.unload_mod &&
541 mconfig->m_state > SKL_MODULE_UNINIT)
528 return ctx->dsp->fw_ops.unload_mod(ctx->dsp, 542 return ctx->dsp->fw_ops.unload_mod(ctx->dsp,
529 mconfig->id.module_id); 543 mconfig->id.module_id);
530 } 544 }
@@ -558,6 +572,9 @@ static int skl_tplg_mixer_dapm_pre_pmu_event(struct snd_soc_dapm_widget *w,
558 if (!skl_is_pipe_mem_avail(skl, mconfig)) 572 if (!skl_is_pipe_mem_avail(skl, mconfig))
559 return -ENOMEM; 573 return -ENOMEM;
560 574
575 skl_tplg_alloc_pipe_mem(skl, mconfig);
576 skl_tplg_alloc_pipe_mcps(skl, mconfig);
577
561 /* 578 /*
562 * Create a list of modules for pipe. 579 * Create a list of modules for pipe.
563 * This list contains modules from source to sink 580 * This list contains modules from source to sink
@@ -601,9 +618,6 @@ static int skl_tplg_mixer_dapm_pre_pmu_event(struct snd_soc_dapm_widget *w,
601 src_module = dst_module; 618 src_module = dst_module;
602 } 619 }
603 620
604 skl_tplg_alloc_pipe_mem(skl, mconfig);
605 skl_tplg_alloc_pipe_mcps(skl, mconfig);
606
607 return 0; 621 return 0;
608} 622}
609 623
diff --git a/sound/soc/intel/skylake/skl-topology.h b/sound/soc/intel/skylake/skl-topology.h
index de3c401284d9..d2d923002d5c 100644
--- a/sound/soc/intel/skylake/skl-topology.h
+++ b/sound/soc/intel/skylake/skl-topology.h
@@ -274,10 +274,10 @@ struct skl_pipe {
274 274
275enum skl_module_state { 275enum skl_module_state {
276 SKL_MODULE_UNINIT = 0, 276 SKL_MODULE_UNINIT = 0,
277 SKL_MODULE_INIT_DONE = 1, 277 SKL_MODULE_LOADED = 1,
278 SKL_MODULE_LOADED = 2, 278 SKL_MODULE_INIT_DONE = 2,
279 SKL_MODULE_UNLOADED = 3, 279 SKL_MODULE_BIND_DONE = 3,
280 SKL_MODULE_BIND_DONE = 4 280 SKL_MODULE_UNLOADED = 4,
281}; 281};
282 282
283struct skl_module_cfg { 283struct skl_module_cfg {
diff --git a/sound/soc/intel/skylake/skl.c b/sound/soc/intel/skylake/skl.c
index ab5e25aaeee3..3982f5536f2d 100644
--- a/sound/soc/intel/skylake/skl.c
+++ b/sound/soc/intel/skylake/skl.c
@@ -222,6 +222,7 @@ static int skl_suspend(struct device *dev)
222 struct hdac_ext_bus *ebus = pci_get_drvdata(pci); 222 struct hdac_ext_bus *ebus = pci_get_drvdata(pci);
223 struct skl *skl = ebus_to_skl(ebus); 223 struct skl *skl = ebus_to_skl(ebus);
224 struct hdac_bus *bus = ebus_to_hbus(ebus); 224 struct hdac_bus *bus = ebus_to_hbus(ebus);
225 int ret = 0;
225 226
226 /* 227 /*
227 * Do not suspend if streams which are marked ignore suspend are 228 * Do not suspend if streams which are marked ignore suspend are
@@ -232,10 +233,20 @@ static int skl_suspend(struct device *dev)
232 enable_irq_wake(bus->irq); 233 enable_irq_wake(bus->irq);
233 pci_save_state(pci); 234 pci_save_state(pci);
234 pci_disable_device(pci); 235 pci_disable_device(pci);
235 return 0;
236 } else { 236 } else {
237 return _skl_suspend(ebus); 237 ret = _skl_suspend(ebus);
238 if (ret < 0)
239 return ret;
240 }
241
242 if (IS_ENABLED(CONFIG_SND_SOC_HDAC_HDMI)) {
243 ret = snd_hdac_display_power(bus, false);
244 if (ret < 0)
245 dev_err(bus->dev,
246 "Cannot turn OFF display power on i915\n");
238 } 247 }
248
249 return ret;
239} 250}
240 251
241static int skl_resume(struct device *dev) 252static int skl_resume(struct device *dev)
@@ -316,17 +327,20 @@ static int skl_free(struct hdac_ext_bus *ebus)
316 327
317 if (bus->irq >= 0) 328 if (bus->irq >= 0)
318 free_irq(bus->irq, (void *)bus); 329 free_irq(bus->irq, (void *)bus);
319 if (bus->remap_addr)
320 iounmap(bus->remap_addr);
321
322 snd_hdac_bus_free_stream_pages(bus); 330 snd_hdac_bus_free_stream_pages(bus);
323 snd_hdac_stream_free_all(ebus); 331 snd_hdac_stream_free_all(ebus);
324 snd_hdac_link_free_all(ebus); 332 snd_hdac_link_free_all(ebus);
333
334 if (bus->remap_addr)
335 iounmap(bus->remap_addr);
336
325 pci_release_regions(skl->pci); 337 pci_release_regions(skl->pci);
326 pci_disable_device(skl->pci); 338 pci_disable_device(skl->pci);
327 339
328 snd_hdac_ext_bus_exit(ebus); 340 snd_hdac_ext_bus_exit(ebus);
329 341
342 if (IS_ENABLED(CONFIG_SND_SOC_HDAC_HDMI))
343 snd_hdac_i915_exit(&ebus->bus);
330 return 0; 344 return 0;
331} 345}
332 346
@@ -719,12 +733,12 @@ static void skl_remove(struct pci_dev *pci)
719 if (skl->tplg) 733 if (skl->tplg)
720 release_firmware(skl->tplg); 734 release_firmware(skl->tplg);
721 735
722 if (IS_ENABLED(CONFIG_SND_SOC_HDAC_HDMI))
723 snd_hdac_i915_exit(&ebus->bus);
724
725 if (pci_dev_run_wake(pci)) 736 if (pci_dev_run_wake(pci))
726 pm_runtime_get_noresume(&pci->dev); 737 pm_runtime_get_noresume(&pci->dev);
727 pci_dev_put(pci); 738
739 /* codec removal, invoke bus_device_remove */
740 snd_hdac_ext_bus_device_remove(ebus);
741
728 skl_platform_unregister(&pci->dev); 742 skl_platform_unregister(&pci->dev);
729 skl_free_dsp(skl); 743 skl_free_dsp(skl);
730 skl_machine_device_unregister(skl); 744 skl_machine_device_unregister(skl);