diff options
author | Stephen Warren <swarren@nvidia.com> | 2011-01-28 16:26:40 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-01-31 08:16:29 -0500 |
commit | d64e57cef0436833cfc9620e350ec6f5b041c9a9 (patch) | |
tree | 173c1f1bf2b87dfdc3bd7da379b9cf67e07b7906 /sound/soc/tegra/harmony.c | |
parent | c244d477b7a5e0060b05d6ef90b7b29ef72a2188 (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.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/sound/soc/tegra/harmony.c b/sound/soc/tegra/harmony.c index 76793a93c133..d1faa63af034 100644 --- a/sound/soc/tegra/harmony.c +++ b/sound/soc/tegra/harmony.c | |||
@@ -50,6 +50,7 @@ | |||
50 | #define DRV_NAME "tegra-snd-harmony" | 50 | #define DRV_NAME "tegra-snd-harmony" |
51 | 51 | ||
52 | struct tegra_harmony { | 52 | struct tegra_harmony { |
53 | struct tegra_asoc_utils_data util_data; | ||
53 | struct harmony_audio_platform_data *pdata; | 54 | struct harmony_audio_platform_data *pdata; |
54 | int gpio_spkr_en_requested; | 55 | int gpio_spkr_en_requested; |
55 | }; | 56 | }; |
@@ -62,6 +63,7 @@ static int harmony_asoc_hw_params(struct snd_pcm_substream *substream, | |||
62 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; | 63 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
63 | struct snd_soc_codec *codec = rtd->codec; | 64 | struct snd_soc_codec *codec = rtd->codec; |
64 | struct snd_soc_card *card = codec->card; | 65 | struct snd_soc_card *card = codec->card; |
66 | struct tegra_harmony *harmony = snd_soc_card_get_drvdata(card); | ||
65 | int srate, mclk, mclk_change; | 67 | int srate, mclk, mclk_change; |
66 | int err; | 68 | int err; |
67 | 69 | ||
@@ -80,7 +82,8 @@ static int harmony_asoc_hw_params(struct snd_pcm_substream *substream, | |||
80 | while (mclk < 6000000) | 82 | while (mclk < 6000000) |
81 | mclk *= 2; | 83 | mclk *= 2; |
82 | 84 | ||
83 | err = tegra_asoc_utils_set_rate(srate, mclk, &mclk_change); | 85 | err = tegra_asoc_utils_set_rate(&harmony->util_data, srate, mclk, |
86 | &mclk_change); | ||
84 | if (err < 0) { | 87 | if (err < 0) { |
85 | dev_err(card->dev, "Can't configure clocks\n"); | 88 | dev_err(card->dev, "Can't configure clocks\n"); |
86 | return err; | 89 | return err; |
@@ -226,7 +229,7 @@ static __devinit int tegra_snd_harmony_probe(struct platform_device *pdev) | |||
226 | 229 | ||
227 | harmony->pdata = pdata; | 230 | harmony->pdata = pdata; |
228 | 231 | ||
229 | ret = tegra_asoc_utils_init(); | 232 | ret = tegra_asoc_utils_init(&harmony->util_data, &pdev->dev); |
230 | if (ret) | 233 | if (ret) |
231 | goto err_free_harmony; | 234 | goto err_free_harmony; |
232 | 235 | ||
@@ -247,7 +250,7 @@ err_clear_drvdata: | |||
247 | snd_soc_card_set_drvdata(card, NULL); | 250 | snd_soc_card_set_drvdata(card, NULL); |
248 | platform_set_drvdata(pdev, NULL); | 251 | platform_set_drvdata(pdev, NULL); |
249 | card->dev = NULL; | 252 | card->dev = NULL; |
250 | tegra_asoc_utils_fini(); | 253 | tegra_asoc_utils_fini(&harmony->util_data); |
251 | err_free_harmony: | 254 | err_free_harmony: |
252 | kfree(harmony); | 255 | kfree(harmony); |
253 | return ret; | 256 | return ret; |
@@ -265,7 +268,7 @@ static int __devexit tegra_snd_harmony_remove(struct platform_device *pdev) | |||
265 | platform_set_drvdata(pdev, NULL); | 268 | platform_set_drvdata(pdev, NULL); |
266 | card->dev = NULL; | 269 | card->dev = NULL; |
267 | 270 | ||
268 | tegra_asoc_utils_fini(); | 271 | tegra_asoc_utils_fini(&harmony->util_data); |
269 | 272 | ||
270 | if (harmony->gpio_spkr_en_requested) | 273 | if (harmony->gpio_spkr_en_requested) |
271 | gpio_free(pdata->gpio_spkr_en); | 274 | gpio_free(pdata->gpio_spkr_en); |