diff options
author | Mark Brown <broonie@linaro.org> | 2013-06-26 07:45:59 -0400 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2013-06-27 04:48:42 -0400 |
commit | b047e1cce8fe32475ab61846772943a5e4c0a908 (patch) | |
tree | 9d04d8101d161b96f96c2e2e5bd03900011828ec /sound/soc/samsung | |
parent | b49dff8cb61cd4715991612e2eb6905b73a0be78 (diff) |
ASoC: ac97: Support multi-platform AC'97
Currently we can only have a single platform built in with AC'97 support
due to the use of a global variable to provide the bus operations. Fix
this by making that variable a pointer and having the bus drivers set the
operations prior to registering.
This is not a particularly good or nice approach but it avoids blocking
multiplatform and a real fix involves fixing the fairly deep problems
with AC'97 support - we should be converting it to a real bus.
Acked-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'sound/soc/samsung')
-rw-r--r-- | sound/soc/samsung/ac97.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/sound/soc/samsung/ac97.c b/sound/soc/samsung/ac97.c index 04d7fd461484..2dd623fa3882 100644 --- a/sound/soc/samsung/ac97.c +++ b/sound/soc/samsung/ac97.c | |||
@@ -214,13 +214,12 @@ static irqreturn_t s3c_ac97_irq(int irq, void *dev_id) | |||
214 | return IRQ_HANDLED; | 214 | return IRQ_HANDLED; |
215 | } | 215 | } |
216 | 216 | ||
217 | struct snd_ac97_bus_ops soc_ac97_ops = { | 217 | static struct snd_ac97_bus_ops s3c_ac97_ops = { |
218 | .read = s3c_ac97_read, | 218 | .read = s3c_ac97_read, |
219 | .write = s3c_ac97_write, | 219 | .write = s3c_ac97_write, |
220 | .warm_reset = s3c_ac97_warm_reset, | 220 | .warm_reset = s3c_ac97_warm_reset, |
221 | .reset = s3c_ac97_cold_reset, | 221 | .reset = s3c_ac97_cold_reset, |
222 | }; | 222 | }; |
223 | EXPORT_SYMBOL_GPL(soc_ac97_ops); | ||
224 | 223 | ||
225 | static int s3c_ac97_hw_params(struct snd_pcm_substream *substream, | 224 | static int s3c_ac97_hw_params(struct snd_pcm_substream *substream, |
226 | struct snd_pcm_hw_params *params, | 225 | struct snd_pcm_hw_params *params, |
@@ -452,6 +451,12 @@ static int s3c_ac97_probe(struct platform_device *pdev) | |||
452 | goto err4; | 451 | goto err4; |
453 | } | 452 | } |
454 | 453 | ||
454 | ret = snd_soc_set_ac97_ops(&s3c_ac97_ops); | ||
455 | if (ret != 0) { | ||
456 | dev_err(&pdev->dev, "Failed to set AC'97 ops: %d\n", ret); | ||
457 | goto err4; | ||
458 | } | ||
459 | |||
455 | ret = snd_soc_register_component(&pdev->dev, &s3c_ac97_component, | 460 | ret = snd_soc_register_component(&pdev->dev, &s3c_ac97_component, |
456 | s3c_ac97_dai, ARRAY_SIZE(s3c_ac97_dai)); | 461 | s3c_ac97_dai, ARRAY_SIZE(s3c_ac97_dai)); |
457 | if (ret) | 462 | if (ret) |
@@ -472,7 +477,7 @@ err4: | |||
472 | err3: | 477 | err3: |
473 | clk_disable_unprepare(s3c_ac97.ac97_clk); | 478 | clk_disable_unprepare(s3c_ac97.ac97_clk); |
474 | err2: | 479 | err2: |
475 | 480 | snd_soc_set_ac97_ops(NULL); | |
476 | return ret; | 481 | return ret; |
477 | } | 482 | } |
478 | 483 | ||
@@ -488,6 +493,7 @@ static int s3c_ac97_remove(struct platform_device *pdev) | |||
488 | free_irq(irq_res->start, NULL); | 493 | free_irq(irq_res->start, NULL); |
489 | 494 | ||
490 | clk_disable_unprepare(s3c_ac97.ac97_clk); | 495 | clk_disable_unprepare(s3c_ac97.ac97_clk); |
496 | snd_soc_set_ac97_ops(NULL); | ||
491 | 497 | ||
492 | return 0; | 498 | return 0; |
493 | } | 499 | } |