diff options
author | Takashi Iwai <tiwai@suse.de> | 2016-07-11 04:39:11 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2016-07-11 13:19:23 -0400 |
commit | a395bdd6b24b692adbce0df6510ec9f2af57573e (patch) | |
tree | 4ee869e277a423be1df6138748f1fb9e5c1992c2 /sound/soc/intel | |
parent | 24dad509ed5528bbbe31ff17f9fb39c0473ec8f4 (diff) |
ASoC: intel: Fix sst-dsp dependency on dw stuff
The recent commit [a92ea59b74e2: ASoC: Intel: sst: only select
sst-firmware when DW DMAC is built-in] introduced more strict kconfig
dependency (depends on DW_DMAC_CORE=y) for avoiding the build failures
due to dependency messes in intel-sst. This makes, however, it
impossible to use this driver with the modularized systems,
i.e. typically on Linux distros.
The problem addressed in the commit above is that sst_dsp_new() and
sst_dsp_free() includes the firmware init / finish that call dw_*()
functions. Thus building it as built-in with DW_DMAC_CORE module
results in the missing symbols.
However, these sst_dsp functions are basically called only from the
drivers that depend on DW_DMAC_CORE already. That is, once when these
functions are split out, the rest can be independent from dw stuff.
This patch attempts to solve the issue by the following:
- Split sst-dsp stuff into two modules: snd-soc-sst-dsp and
snd-soc-sst-firmware.
- Move sst_dsp_new() and sst_dsp_free() to the latter module so that
the former module can be independent from DW_DMAC_CORE.
- Add a new kconfig SND_SOC_INTEL_SST_FIRMWARE to select the latter
module by machine drivers.
One only remaining pitfall is that each machine driver has to select
SND_SOC_INTEL_SST_FIRMWARE carefully depending on DW_DMAC_CORE.
This can't be done cleanly due to the restriction of the current
kbuild.
Bugzilla: https://bugzilla.opensuse.org/show_bug.cgi?id=988117
Fixes: a92ea59b74e2 ('ASoC: Intel: sst: only select sst-firmware when DW DMAC is built-in')
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/intel')
-rw-r--r-- | sound/soc/intel/Kconfig | 18 | ||||
-rw-r--r-- | sound/soc/intel/common/Makefile | 4 | ||||
-rw-r--r-- | sound/soc/intel/common/sst-dsp-priv.h | 4 | ||||
-rw-r--r-- | sound/soc/intel/common/sst-dsp.c | 67 | ||||
-rw-r--r-- | sound/soc/intel/common/sst-dsp.h | 2 | ||||
-rw-r--r-- | sound/soc/intel/common/sst-firmware.c | 68 |
6 files changed, 85 insertions, 78 deletions
diff --git a/sound/soc/intel/Kconfig b/sound/soc/intel/Kconfig index 9c86459d0fc3..a20c3dfbcb5d 100644 --- a/sound/soc/intel/Kconfig +++ b/sound/soc/intel/Kconfig | |||
@@ -32,6 +32,12 @@ config SND_SOC_INTEL_SST | |||
32 | select SND_SOC_INTEL_SST_MATCH if ACPI | 32 | select SND_SOC_INTEL_SST_MATCH if ACPI |
33 | depends on (X86 || COMPILE_TEST) | 33 | depends on (X86 || COMPILE_TEST) |
34 | 34 | ||
35 | # firmware stuff depends DW_DMAC_CORE; since there is no depends-on from | ||
36 | # the reverse selection, each machine driver needs to select | ||
37 | # SND_SOC_INTEL_SST_FIRMWARE carefully depending on DW_DMAC_CORE | ||
38 | config SND_SOC_INTEL_SST_FIRMWARE | ||
39 | tristate | ||
40 | |||
35 | config SND_SOC_INTEL_SST_ACPI | 41 | config SND_SOC_INTEL_SST_ACPI |
36 | tristate | 42 | tristate |
37 | 43 | ||
@@ -47,8 +53,9 @@ config SND_SOC_INTEL_BAYTRAIL | |||
47 | config SND_SOC_INTEL_HASWELL_MACH | 53 | config SND_SOC_INTEL_HASWELL_MACH |
48 | tristate "ASoC Audio DSP support for Intel Haswell Lynxpoint" | 54 | tristate "ASoC Audio DSP support for Intel Haswell Lynxpoint" |
49 | depends on X86_INTEL_LPSS && I2C && I2C_DESIGNWARE_PLATFORM | 55 | depends on X86_INTEL_LPSS && I2C && I2C_DESIGNWARE_PLATFORM |
50 | depends on DW_DMAC_CORE=y | 56 | depends on DW_DMAC_CORE |
51 | select SND_SOC_INTEL_SST | 57 | select SND_SOC_INTEL_SST |
58 | select SND_SOC_INTEL_SST_FIRMWARE | ||
52 | select SND_SOC_INTEL_HASWELL | 59 | select SND_SOC_INTEL_HASWELL |
53 | select SND_SOC_RT5640 | 60 | select SND_SOC_RT5640 |
54 | help | 61 | help |
@@ -91,8 +98,9 @@ config SND_SOC_INTEL_BXT_RT298_MACH | |||
91 | config SND_SOC_INTEL_BYT_RT5640_MACH | 98 | config SND_SOC_INTEL_BYT_RT5640_MACH |
92 | tristate "ASoC Audio driver for Intel Baytrail with RT5640 codec" | 99 | tristate "ASoC Audio driver for Intel Baytrail with RT5640 codec" |
93 | depends on X86_INTEL_LPSS && I2C | 100 | depends on X86_INTEL_LPSS && I2C |
94 | depends on DW_DMAC_CORE=y && (SND_SST_IPC_ACPI = n) | 101 | depends on DW_DMAC_CORE && (SND_SST_IPC_ACPI = n) |
95 | select SND_SOC_INTEL_SST | 102 | select SND_SOC_INTEL_SST |
103 | select SND_SOC_INTEL_SST_FIRMWARE | ||
96 | select SND_SOC_INTEL_BAYTRAIL | 104 | select SND_SOC_INTEL_BAYTRAIL |
97 | select SND_SOC_RT5640 | 105 | select SND_SOC_RT5640 |
98 | help | 106 | help |
@@ -103,8 +111,9 @@ config SND_SOC_INTEL_BYT_RT5640_MACH | |||
103 | config SND_SOC_INTEL_BYT_MAX98090_MACH | 111 | config SND_SOC_INTEL_BYT_MAX98090_MACH |
104 | tristate "ASoC Audio driver for Intel Baytrail with MAX98090 codec" | 112 | tristate "ASoC Audio driver for Intel Baytrail with MAX98090 codec" |
105 | depends on X86_INTEL_LPSS && I2C | 113 | depends on X86_INTEL_LPSS && I2C |
106 | depends on DW_DMAC_CORE=y && (SND_SST_IPC_ACPI = n) | 114 | depends on DW_DMAC_CORE && (SND_SST_IPC_ACPI = n) |
107 | select SND_SOC_INTEL_SST | 115 | select SND_SOC_INTEL_SST |
116 | select SND_SOC_INTEL_SST_FIRMWARE | ||
108 | select SND_SOC_INTEL_BAYTRAIL | 117 | select SND_SOC_INTEL_BAYTRAIL |
109 | select SND_SOC_MAX98090 | 118 | select SND_SOC_MAX98090 |
110 | help | 119 | help |
@@ -115,8 +124,9 @@ config SND_SOC_INTEL_BROADWELL_MACH | |||
115 | tristate "ASoC Audio DSP support for Intel Broadwell Wildcatpoint" | 124 | tristate "ASoC Audio DSP support for Intel Broadwell Wildcatpoint" |
116 | depends on X86_INTEL_LPSS && I2C && DW_DMAC && \ | 125 | depends on X86_INTEL_LPSS && I2C && DW_DMAC && \ |
117 | I2C_DESIGNWARE_PLATFORM | 126 | I2C_DESIGNWARE_PLATFORM |
118 | depends on DW_DMAC_CORE=y | 127 | depends on DW_DMAC_CORE |
119 | select SND_SOC_INTEL_SST | 128 | select SND_SOC_INTEL_SST |
129 | select SND_SOC_INTEL_SST_FIRMWARE | ||
120 | select SND_SOC_INTEL_HASWELL | 130 | select SND_SOC_INTEL_HASWELL |
121 | select SND_SOC_RT286 | 131 | select SND_SOC_RT286 |
122 | help | 132 | help |
diff --git a/sound/soc/intel/common/Makefile b/sound/soc/intel/common/Makefile index fbbb25c2ceed..1a35149bcad7 100644 --- a/sound/soc/intel/common/Makefile +++ b/sound/soc/intel/common/Makefile | |||
@@ -2,9 +2,9 @@ snd-soc-sst-dsp-objs := sst-dsp.o | |||
2 | snd-soc-sst-acpi-objs := sst-acpi.o | 2 | snd-soc-sst-acpi-objs := sst-acpi.o |
3 | snd-soc-sst-match-objs := sst-match-acpi.o | 3 | snd-soc-sst-match-objs := sst-match-acpi.o |
4 | snd-soc-sst-ipc-objs := sst-ipc.o | 4 | snd-soc-sst-ipc-objs := sst-ipc.o |
5 | 5 | snd-soc-sst-firmware-objs := sst-firmware.o | |
6 | snd-soc-sst-dsp-$(CONFIG_DW_DMAC_CORE) += sst-firmware.o | ||
7 | 6 | ||
8 | obj-$(CONFIG_SND_SOC_INTEL_SST) += snd-soc-sst-dsp.o snd-soc-sst-ipc.o | 7 | obj-$(CONFIG_SND_SOC_INTEL_SST) += snd-soc-sst-dsp.o snd-soc-sst-ipc.o |
9 | obj-$(CONFIG_SND_SOC_INTEL_SST_ACPI) += snd-soc-sst-acpi.o | 8 | obj-$(CONFIG_SND_SOC_INTEL_SST_ACPI) += snd-soc-sst-acpi.o |
10 | obj-$(CONFIG_SND_SOC_INTEL_SST_MATCH) += snd-soc-sst-match.o | 9 | obj-$(CONFIG_SND_SOC_INTEL_SST_MATCH) += snd-soc-sst-match.o |
10 | obj-$(CONFIG_SND_SOC_INTEL_SST_FIRMWARE) += snd-soc-sst-firmware.o | ||
diff --git a/sound/soc/intel/common/sst-dsp-priv.h b/sound/soc/intel/common/sst-dsp-priv.h index 97dc1ae05e69..d13c84364c3c 100644 --- a/sound/soc/intel/common/sst-dsp-priv.h +++ b/sound/soc/intel/common/sst-dsp-priv.h | |||
@@ -383,10 +383,6 @@ struct sst_mem_block *sst_mem_block_register(struct sst_dsp *dsp, u32 offset, | |||
383 | u32 index, void *private); | 383 | u32 index, void *private); |
384 | void sst_mem_block_unregister_all(struct sst_dsp *dsp); | 384 | void sst_mem_block_unregister_all(struct sst_dsp *dsp); |
385 | 385 | ||
386 | /* Create/Free DMA resources */ | ||
387 | int sst_dma_new(struct sst_dsp *sst); | ||
388 | void sst_dma_free(struct sst_dma *dma); | ||
389 | |||
390 | u32 sst_dsp_get_offset(struct sst_dsp *dsp, u32 offset, | 386 | u32 sst_dsp_get_offset(struct sst_dsp *dsp, u32 offset, |
391 | enum sst_mem_type type); | 387 | enum sst_mem_type type); |
392 | #endif | 388 | #endif |
diff --git a/sound/soc/intel/common/sst-dsp.c b/sound/soc/intel/common/sst-dsp.c index ff2196ef359f..c00ede4ea4d7 100644 --- a/sound/soc/intel/common/sst-dsp.c +++ b/sound/soc/intel/common/sst-dsp.c | |||
@@ -420,73 +420,6 @@ void sst_dsp_inbox_read(struct sst_dsp *sst, void *message, size_t bytes) | |||
420 | } | 420 | } |
421 | EXPORT_SYMBOL_GPL(sst_dsp_inbox_read); | 421 | EXPORT_SYMBOL_GPL(sst_dsp_inbox_read); |
422 | 422 | ||
423 | #ifdef CONFIG_DW_DMAC_CORE | ||
424 | struct sst_dsp *sst_dsp_new(struct device *dev, | ||
425 | struct sst_dsp_device *sst_dev, struct sst_pdata *pdata) | ||
426 | { | ||
427 | struct sst_dsp *sst; | ||
428 | int err; | ||
429 | |||
430 | dev_dbg(dev, "initialising audio DSP id 0x%x\n", pdata->id); | ||
431 | |||
432 | sst = devm_kzalloc(dev, sizeof(*sst), GFP_KERNEL); | ||
433 | if (sst == NULL) | ||
434 | return NULL; | ||
435 | |||
436 | spin_lock_init(&sst->spinlock); | ||
437 | mutex_init(&sst->mutex); | ||
438 | sst->dev = dev; | ||
439 | sst->dma_dev = pdata->dma_dev; | ||
440 | sst->thread_context = sst_dev->thread_context; | ||
441 | sst->sst_dev = sst_dev; | ||
442 | sst->id = pdata->id; | ||
443 | sst->irq = pdata->irq; | ||
444 | sst->ops = sst_dev->ops; | ||
445 | sst->pdata = pdata; | ||
446 | INIT_LIST_HEAD(&sst->used_block_list); | ||
447 | INIT_LIST_HEAD(&sst->free_block_list); | ||
448 | INIT_LIST_HEAD(&sst->module_list); | ||
449 | INIT_LIST_HEAD(&sst->fw_list); | ||
450 | INIT_LIST_HEAD(&sst->scratch_block_list); | ||
451 | |||
452 | /* Initialise SST Audio DSP */ | ||
453 | if (sst->ops->init) { | ||
454 | err = sst->ops->init(sst, pdata); | ||
455 | if (err < 0) | ||
456 | return NULL; | ||
457 | } | ||
458 | |||
459 | /* Register the ISR */ | ||
460 | err = request_threaded_irq(sst->irq, sst->ops->irq_handler, | ||
461 | sst_dev->thread, IRQF_SHARED, "AudioDSP", sst); | ||
462 | if (err) | ||
463 | goto irq_err; | ||
464 | |||
465 | err = sst_dma_new(sst); | ||
466 | if (err) | ||
467 | dev_warn(dev, "sst_dma_new failed %d\n", err); | ||
468 | |||
469 | return sst; | ||
470 | |||
471 | irq_err: | ||
472 | if (sst->ops->free) | ||
473 | sst->ops->free(sst); | ||
474 | |||
475 | return NULL; | ||
476 | } | ||
477 | EXPORT_SYMBOL_GPL(sst_dsp_new); | ||
478 | |||
479 | void sst_dsp_free(struct sst_dsp *sst) | ||
480 | { | ||
481 | free_irq(sst->irq, sst); | ||
482 | if (sst->ops->free) | ||
483 | sst->ops->free(sst); | ||
484 | |||
485 | sst_dma_free(sst->dma); | ||
486 | } | ||
487 | EXPORT_SYMBOL_GPL(sst_dsp_free); | ||
488 | #endif | ||
489 | |||
490 | /* Module information */ | 423 | /* Module information */ |
491 | MODULE_AUTHOR("Liam Girdwood"); | 424 | MODULE_AUTHOR("Liam Girdwood"); |
492 | MODULE_DESCRIPTION("Intel SST Core"); | 425 | MODULE_DESCRIPTION("Intel SST Core"); |
diff --git a/sound/soc/intel/common/sst-dsp.h b/sound/soc/intel/common/sst-dsp.h index 0b84c719ec48..859f0de00339 100644 --- a/sound/soc/intel/common/sst-dsp.h +++ b/sound/soc/intel/common/sst-dsp.h | |||
@@ -216,7 +216,7 @@ struct sst_pdata { | |||
216 | void *dsp; | 216 | void *dsp; |
217 | }; | 217 | }; |
218 | 218 | ||
219 | #ifdef CONFIG_DW_DMAC_CORE | 219 | #if IS_ENABLED(CONFIG_DW_DMAC_CORE) |
220 | /* Initialization */ | 220 | /* Initialization */ |
221 | struct sst_dsp *sst_dsp_new(struct device *dev, | 221 | struct sst_dsp *sst_dsp_new(struct device *dev, |
222 | struct sst_dsp_device *sst_dev, struct sst_pdata *pdata); | 222 | struct sst_dsp_device *sst_dev, struct sst_pdata *pdata); |
diff --git a/sound/soc/intel/common/sst-firmware.c b/sound/soc/intel/common/sst-firmware.c index 25993527370b..a086c35f91bb 100644 --- a/sound/soc/intel/common/sst-firmware.c +++ b/sound/soc/intel/common/sst-firmware.c | |||
@@ -1211,3 +1211,71 @@ u32 sst_dsp_get_offset(struct sst_dsp *dsp, u32 offset, | |||
1211 | } | 1211 | } |
1212 | } | 1212 | } |
1213 | EXPORT_SYMBOL_GPL(sst_dsp_get_offset); | 1213 | EXPORT_SYMBOL_GPL(sst_dsp_get_offset); |
1214 | |||
1215 | struct sst_dsp *sst_dsp_new(struct device *dev, | ||
1216 | struct sst_dsp_device *sst_dev, struct sst_pdata *pdata) | ||
1217 | { | ||
1218 | struct sst_dsp *sst; | ||
1219 | int err; | ||
1220 | |||
1221 | dev_dbg(dev, "initialising audio DSP id 0x%x\n", pdata->id); | ||
1222 | |||
1223 | sst = devm_kzalloc(dev, sizeof(*sst), GFP_KERNEL); | ||
1224 | if (sst == NULL) | ||
1225 | return NULL; | ||
1226 | |||
1227 | spin_lock_init(&sst->spinlock); | ||
1228 | mutex_init(&sst->mutex); | ||
1229 | sst->dev = dev; | ||
1230 | sst->dma_dev = pdata->dma_dev; | ||
1231 | sst->thread_context = sst_dev->thread_context; | ||
1232 | sst->sst_dev = sst_dev; | ||
1233 | sst->id = pdata->id; | ||
1234 | sst->irq = pdata->irq; | ||
1235 | sst->ops = sst_dev->ops; | ||
1236 | sst->pdata = pdata; | ||
1237 | INIT_LIST_HEAD(&sst->used_block_list); | ||
1238 | INIT_LIST_HEAD(&sst->free_block_list); | ||
1239 | INIT_LIST_HEAD(&sst->module_list); | ||
1240 | INIT_LIST_HEAD(&sst->fw_list); | ||
1241 | INIT_LIST_HEAD(&sst->scratch_block_list); | ||
1242 | |||
1243 | /* Initialise SST Audio DSP */ | ||
1244 | if (sst->ops->init) { | ||
1245 | err = sst->ops->init(sst, pdata); | ||
1246 | if (err < 0) | ||
1247 | return NULL; | ||
1248 | } | ||
1249 | |||
1250 | /* Register the ISR */ | ||
1251 | err = request_threaded_irq(sst->irq, sst->ops->irq_handler, | ||
1252 | sst_dev->thread, IRQF_SHARED, "AudioDSP", sst); | ||
1253 | if (err) | ||
1254 | goto irq_err; | ||
1255 | |||
1256 | err = sst_dma_new(sst); | ||
1257 | if (err) | ||
1258 | dev_warn(dev, "sst_dma_new failed %d\n", err); | ||
1259 | |||
1260 | return sst; | ||
1261 | |||
1262 | irq_err: | ||
1263 | if (sst->ops->free) | ||
1264 | sst->ops->free(sst); | ||
1265 | |||
1266 | return NULL; | ||
1267 | } | ||
1268 | EXPORT_SYMBOL_GPL(sst_dsp_new); | ||
1269 | |||
1270 | void sst_dsp_free(struct sst_dsp *sst) | ||
1271 | { | ||
1272 | free_irq(sst->irq, sst); | ||
1273 | if (sst->ops->free) | ||
1274 | sst->ops->free(sst); | ||
1275 | |||
1276 | sst_dma_free(sst->dma); | ||
1277 | } | ||
1278 | EXPORT_SYMBOL_GPL(sst_dsp_free); | ||
1279 | |||
1280 | MODULE_DESCRIPTION("Intel SST Firmware Loader"); | ||
1281 | MODULE_LICENSE("GPL v2"); | ||