aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sound/soc/tegra/tegra_asoc_utils.c9
-rw-r--r--sound/soc/tegra/tegra_asoc_utils.h2
-rw-r--r--sound/soc/tegra/tegra_wm8903.c17
3 files changed, 13 insertions, 15 deletions
diff --git a/sound/soc/tegra/tegra_asoc_utils.c b/sound/soc/tegra/tegra_asoc_utils.c
index 52f0a3f9ce40..dfa85cbb05c8 100644
--- a/sound/soc/tegra/tegra_asoc_utils.c
+++ b/sound/soc/tegra/tegra_asoc_utils.c
@@ -28,9 +28,10 @@
28#include "tegra_asoc_utils.h" 28#include "tegra_asoc_utils.h"
29 29
30int tegra_asoc_utils_set_rate(struct tegra_asoc_utils_data *data, int srate, 30int tegra_asoc_utils_set_rate(struct tegra_asoc_utils_data *data, int srate,
31 int mclk, int *mclk_change) 31 int mclk)
32{ 32{
33 int new_baseclock; 33 int new_baseclock;
34 bool clk_change;
34 int err; 35 int err;
35 36
36 switch (srate) { 37 switch (srate) {
@@ -52,10 +53,10 @@ int tegra_asoc_utils_set_rate(struct tegra_asoc_utils_data *data, int srate,
52 return -EINVAL; 53 return -EINVAL;
53 } 54 }
54 55
55 *mclk_change = ((new_baseclock != data->set_baseclock) || 56 clk_change = ((new_baseclock != data->set_baseclock) ||
56 (mclk != data->set_mclk)); 57 (mclk != data->set_mclk));
57 if (!*mclk_change) 58 if (!clk_change)
58 return 0; 59 return 0;
59 60
60 data->set_baseclock = 0; 61 data->set_baseclock = 0;
61 data->set_mclk = 0; 62 data->set_mclk = 0;
diff --git a/sound/soc/tegra/tegra_asoc_utils.h b/sound/soc/tegra/tegra_asoc_utils.h
index bbba7afdfc2c..4818195da25c 100644
--- a/sound/soc/tegra/tegra_asoc_utils.h
+++ b/sound/soc/tegra/tegra_asoc_utils.h
@@ -36,7 +36,7 @@ struct tegra_asoc_utils_data {
36}; 36};
37 37
38int tegra_asoc_utils_set_rate(struct tegra_asoc_utils_data *data, int srate, 38int tegra_asoc_utils_set_rate(struct tegra_asoc_utils_data *data, int srate,
39 int mclk, int *mclk_change); 39 int mclk);
40int tegra_asoc_utils_init(struct tegra_asoc_utils_data *data, 40int tegra_asoc_utils_init(struct tegra_asoc_utils_data *data,
41 struct device *dev); 41 struct device *dev);
42void tegra_asoc_utils_fini(struct tegra_asoc_utils_data *data); 42void tegra_asoc_utils_fini(struct tegra_asoc_utils_data *data);
diff --git a/sound/soc/tegra/tegra_wm8903.c b/sound/soc/tegra/tegra_wm8903.c
index b12b1fd1cb6e..988ff504dd59 100644
--- a/sound/soc/tegra/tegra_wm8903.c
+++ b/sound/soc/tegra/tegra_wm8903.c
@@ -72,7 +72,7 @@ static int tegra_wm8903_hw_params(struct snd_pcm_substream *substream,
72 struct snd_soc_codec *codec = rtd->codec; 72 struct snd_soc_codec *codec = rtd->codec;
73 struct snd_soc_card *card = codec->card; 73 struct snd_soc_card *card = codec->card;
74 struct tegra_wm8903 *machine = snd_soc_card_get_drvdata(card); 74 struct tegra_wm8903 *machine = snd_soc_card_get_drvdata(card);
75 int srate, mclk, mclk_change; 75 int srate, mclk;
76 int err; 76 int err;
77 77
78 srate = params_rate(params); 78 srate = params_rate(params);
@@ -90,8 +90,7 @@ static int tegra_wm8903_hw_params(struct snd_pcm_substream *substream,
90 while (mclk < 6000000) 90 while (mclk < 6000000)
91 mclk *= 2; 91 mclk *= 2;
92 92
93 err = tegra_asoc_utils_set_rate(&machine->util_data, srate, mclk, 93 err = tegra_asoc_utils_set_rate(&machine->util_data, srate, mclk);
94 &mclk_change);
95 if (err < 0) { 94 if (err < 0) {
96 dev_err(card->dev, "Can't configure clocks\n"); 95 dev_err(card->dev, "Can't configure clocks\n");
97 return err; 96 return err;
@@ -115,13 +114,11 @@ static int tegra_wm8903_hw_params(struct snd_pcm_substream *substream,
115 return err; 114 return err;
116 } 115 }
117 116
118 if (mclk_change) { 117 err = snd_soc_dai_set_sysclk(codec_dai, 0, mclk,
119 err = snd_soc_dai_set_sysclk(codec_dai, 0, mclk, 118 SND_SOC_CLOCK_IN);
120 SND_SOC_CLOCK_IN); 119 if (err < 0) {
121 if (err < 0) { 120 dev_err(card->dev, "codec_dai clock not set\n");
122 dev_err(card->dev, "codec_dai clock not set\n"); 121 return err;
123 return err;
124 }
125 } 122 }
126 123
127 return 0; 124 return 0;