From b047e1cce8fe32475ab61846772943a5e4c0a908 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Wed, 26 Jun 2013 12:45:59 +0100 Subject: 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 Reviewed-by: Stephen Warren Signed-off-by: Mark Brown --- sound/soc/blackfin/bf5xx-ac97.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'sound/soc/blackfin') diff --git a/sound/soc/blackfin/bf5xx-ac97.c b/sound/soc/blackfin/bf5xx-ac97.c index 024e2dbe6c7f..c5af677ba49c 100644 --- a/sound/soc/blackfin/bf5xx-ac97.c +++ b/sound/soc/blackfin/bf5xx-ac97.c @@ -198,13 +198,12 @@ static void bf5xx_ac97_cold_reset(struct snd_ac97 *ac97) #endif } -struct snd_ac97_bus_ops soc_ac97_ops = { +static struct snd_ac97_bus_ops bf5xx_ac97_ops = { .read = bf5xx_ac97_read, .write = bf5xx_ac97_write, .warm_reset = bf5xx_ac97_warm_reset, .reset = bf5xx_ac97_cold_reset, }; -EXPORT_SYMBOL_GPL(soc_ac97_ops); #ifdef CONFIG_PM static int bf5xx_ac97_suspend(struct snd_soc_dai *dai) @@ -336,6 +335,12 @@ static int asoc_bfin_ac97_probe(struct platform_device *pdev) goto sport_config_err; } + ret = snd_soc_set_ac97_ops(&bf5xx_ac97_ops); + if (ret != 0) { + dev_err(&pdev->dev, "Failed to set AC'97 ops: %d\n", ret); + goto sport_config_err; + } + ret = snd_soc_register_component(&pdev->dev, &bfin_ac97_component, &bfin_ac97_dai, 1); if (ret) { @@ -350,6 +355,7 @@ static int asoc_bfin_ac97_probe(struct platform_device *pdev) sport_config_err: sport_done(sport_handle); sport_err: + snd_soc_set_ac97_ops(NULL); return ret; } @@ -360,6 +366,7 @@ static int asoc_bfin_ac97_remove(struct platform_device *pdev) snd_soc_unregister_component(&pdev->dev); sport_done(sport_handle); + snd_soc_set_ac97_ops(NULL); return 0; } -- cgit v1.2.3