summaryrefslogtreecommitdiff
path: root/sound/soc/tegra/harmony.c
diff options
context:
space:
mode:
authorStephen Warren <swarren@nvidia.com>2011-01-28 14:26:40 -0700
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-01-31 13:16:29 +0000
commitd64e57cef0436833cfc9620e350ec6f5b041c9a9 (patch)
tree173c1f1bf2b87dfdc3bd7da379b9cf67e07b7906 /sound/soc/tegra/harmony.c
parentc244d477b7a5e0060b05d6ef90b7b29ef72a2188 (diff)
ASoC: Tegra: utils: Don't use global variables
Instead, have the machine driver provide storage for the utility data somehow. For Harmony in particular, store this within struct tegra_harmony, itself referenced by snd_soc_card's drvdata. Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/tegra/harmony.c')
-rw-r--r--sound/soc/tegra/harmony.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/sound/soc/tegra/harmony.c b/sound/soc/tegra/harmony.c
index 76793a93c13..d1faa63af03 100644
--- a/sound/soc/tegra/harmony.c
+++ b/sound/soc/tegra/harmony.c
@@ -50,6 +50,7 @@
#define DRV_NAME "tegra-snd-harmony"
struct tegra_harmony {
+ struct tegra_asoc_utils_data util_data;
struct harmony_audio_platform_data *pdata;
int gpio_spkr_en_requested;
};
@@ -62,6 +63,7 @@ static int harmony_asoc_hw_params(struct snd_pcm_substream *substream,
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
struct snd_soc_codec *codec = rtd->codec;
struct snd_soc_card *card = codec->card;
+ struct tegra_harmony *harmony = snd_soc_card_get_drvdata(card);
int srate, mclk, mclk_change;
int err;
@@ -80,7 +82,8 @@ static int harmony_asoc_hw_params(struct snd_pcm_substream *substream,
while (mclk < 6000000)
mclk *= 2;
- err = tegra_asoc_utils_set_rate(srate, mclk, &mclk_change);
+ err = tegra_asoc_utils_set_rate(&harmony->util_data, srate, mclk,
+ &mclk_change);
if (err < 0) {
dev_err(card->dev, "Can't configure clocks\n");
return err;
@@ -226,7 +229,7 @@ static __devinit int tegra_snd_harmony_probe(struct platform_device *pdev)
harmony->pdata = pdata;
- ret = tegra_asoc_utils_init();
+ ret = tegra_asoc_utils_init(&harmony->util_data, &pdev->dev);
if (ret)
goto err_free_harmony;
@@ -247,7 +250,7 @@ err_clear_drvdata:
snd_soc_card_set_drvdata(card, NULL);
platform_set_drvdata(pdev, NULL);
card->dev = NULL;
- tegra_asoc_utils_fini();
+ tegra_asoc_utils_fini(&harmony->util_data);
err_free_harmony:
kfree(harmony);
return ret;
@@ -265,7 +268,7 @@ static int __devexit tegra_snd_harmony_remove(struct platform_device *pdev)
platform_set_drvdata(pdev, NULL);
card->dev = NULL;
- tegra_asoc_utils_fini();
+ tegra_asoc_utils_fini(&harmony->util_data);
if (harmony->gpio_spkr_en_requested)
gpio_free(pdata->gpio_spkr_en);