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/tegra/tegra20_ac97.c | |
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/tegra/tegra20_ac97.c')
-rw-r--r-- | sound/soc/tegra/tegra20_ac97.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/sound/soc/tegra/tegra20_ac97.c b/sound/soc/tegra/tegra20_ac97.c index 48037f784a86..f52eab6d2231 100644 --- a/sound/soc/tegra/tegra20_ac97.c +++ b/sound/soc/tegra/tegra20_ac97.c | |||
@@ -142,13 +142,12 @@ static void tegra20_ac97_codec_write(struct snd_ac97 *ac97_snd, | |||
142 | } while (!time_after(jiffies, timeout)); | 142 | } while (!time_after(jiffies, timeout)); |
143 | } | 143 | } |
144 | 144 | ||
145 | struct snd_ac97_bus_ops soc_ac97_ops = { | 145 | static struct snd_ac97_bus_ops tegra20_ac97_ops = { |
146 | .read = tegra20_ac97_codec_read, | 146 | .read = tegra20_ac97_codec_read, |
147 | .write = tegra20_ac97_codec_write, | 147 | .write = tegra20_ac97_codec_write, |
148 | .reset = tegra20_ac97_codec_reset, | 148 | .reset = tegra20_ac97_codec_reset, |
149 | .warm_reset = tegra20_ac97_codec_warm_reset, | 149 | .warm_reset = tegra20_ac97_codec_warm_reset, |
150 | }; | 150 | }; |
151 | EXPORT_SYMBOL_GPL(soc_ac97_ops); | ||
152 | 151 | ||
153 | static inline void tegra20_ac97_start_playback(struct tegra20_ac97 *ac97) | 152 | static inline void tegra20_ac97_start_playback(struct tegra20_ac97 *ac97) |
154 | { | 153 | { |
@@ -409,6 +408,12 @@ static int tegra20_ac97_platform_probe(struct platform_device *pdev) | |||
409 | goto err_asoc_utils_fini; | 408 | goto err_asoc_utils_fini; |
410 | } | 409 | } |
411 | 410 | ||
411 | ret = snd_soc_set_ac97_ops(&tegra20_ac97_ops); | ||
412 | if (ret) { | ||
413 | dev_err(&pdev->dev, "Failed to set AC'97 ops: %d\n", ret); | ||
414 | goto err_asoc_utils_fini; | ||
415 | } | ||
416 | |||
412 | ret = snd_soc_register_component(&pdev->dev, &tegra20_ac97_component, | 417 | ret = snd_soc_register_component(&pdev->dev, &tegra20_ac97_component, |
413 | &tegra20_ac97_dai, 1); | 418 | &tegra20_ac97_dai, 1); |
414 | if (ret) { | 419 | if (ret) { |
@@ -436,6 +441,7 @@ err_asoc_utils_fini: | |||
436 | tegra_asoc_utils_fini(&ac97->util_data); | 441 | tegra_asoc_utils_fini(&ac97->util_data); |
437 | err_clk_put: | 442 | err_clk_put: |
438 | err: | 443 | err: |
444 | snd_soc_set_ac97_ops(NULL); | ||
439 | return ret; | 445 | return ret; |
440 | } | 446 | } |
441 | 447 | ||
@@ -450,6 +456,8 @@ static int tegra20_ac97_platform_remove(struct platform_device *pdev) | |||
450 | 456 | ||
451 | clk_disable_unprepare(ac97->clk_ac97); | 457 | clk_disable_unprepare(ac97->clk_ac97); |
452 | 458 | ||
459 | snd_soc_set_ac97_ops(NULL); | ||
460 | |||
453 | return 0; | 461 | return 0; |
454 | } | 462 | } |
455 | 463 | ||