diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-04-09 14:40:00 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-04-19 09:10:21 -0400 |
commit | fde39a6b15612943673555aec7237f9e7228f27d (patch) | |
tree | d78f550c0911468219f646280f244b9439e2190e /sound/soc/codecs/wm1250-ev1.c | |
parent | 5f6ac59f7019c568f6657707efe210ab92e61b9c (diff) |
ASoC: wm1250-ev1: Support sample rate configuration
The Springbank module can support a range of sample rates, selected at
runtime via GPIO configuration. Allow these to be configured at runtime.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/codecs/wm1250-ev1.c')
-rw-r--r-- | sound/soc/codecs/wm1250-ev1.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/sound/soc/codecs/wm1250-ev1.c b/sound/soc/codecs/wm1250-ev1.c index 0766b5fabae7..e0b51e9f8b12 100644 --- a/sound/soc/codecs/wm1250-ev1.c +++ b/sound/soc/codecs/wm1250-ev1.c | |||
@@ -79,6 +79,48 @@ static const struct snd_soc_dapm_route wm1250_ev1_dapm_routes[] = { | |||
79 | { "WM1250 Output", NULL, "DAC" }, | 79 | { "WM1250 Output", NULL, "DAC" }, |
80 | }; | 80 | }; |
81 | 81 | ||
82 | static int wm1250_ev1_hw_params(struct snd_pcm_substream *substream, | ||
83 | struct snd_pcm_hw_params *params, | ||
84 | struct snd_soc_dai *dai) | ||
85 | { | ||
86 | struct wm1250_priv *wm1250 = snd_soc_codec_get_drvdata(dai->codec); | ||
87 | |||
88 | switch (params_rate(params)) { | ||
89 | case 8000: | ||
90 | gpio_set_value(wm1250->gpios[WM1250_EV1_GPIO_CLK_SEL0].gpio, | ||
91 | 1); | ||
92 | gpio_set_value(wm1250->gpios[WM1250_EV1_GPIO_CLK_SEL1].gpio, | ||
93 | 1); | ||
94 | break; | ||
95 | case 16000: | ||
96 | gpio_set_value(wm1250->gpios[WM1250_EV1_GPIO_CLK_SEL0].gpio, | ||
97 | 0); | ||
98 | gpio_set_value(wm1250->gpios[WM1250_EV1_GPIO_CLK_SEL1].gpio, | ||
99 | 1); | ||
100 | break; | ||
101 | case 32000: | ||
102 | gpio_set_value(wm1250->gpios[WM1250_EV1_GPIO_CLK_SEL0].gpio, | ||
103 | 1); | ||
104 | gpio_set_value(wm1250->gpios[WM1250_EV1_GPIO_CLK_SEL1].gpio, | ||
105 | 0); | ||
106 | break; | ||
107 | case 64000: | ||
108 | gpio_set_value(wm1250->gpios[WM1250_EV1_GPIO_CLK_SEL0].gpio, | ||
109 | 0); | ||
110 | gpio_set_value(wm1250->gpios[WM1250_EV1_GPIO_CLK_SEL1].gpio, | ||
111 | 0); | ||
112 | break; | ||
113 | default: | ||
114 | return -EINVAL; | ||
115 | } | ||
116 | |||
117 | return 0; | ||
118 | } | ||
119 | |||
120 | static const struct snd_soc_dai_ops wm1250_ev1_ops = { | ||
121 | .hw_params = wm1250_ev1_hw_params, | ||
122 | }; | ||
123 | |||
82 | static struct snd_soc_dai_driver wm1250_ev1_dai = { | 124 | static struct snd_soc_dai_driver wm1250_ev1_dai = { |
83 | .name = "wm1250-ev1", | 125 | .name = "wm1250-ev1", |
84 | .playback = { | 126 | .playback = { |
@@ -95,6 +137,7 @@ static struct snd_soc_dai_driver wm1250_ev1_dai = { | |||
95 | .rates = SNDRV_PCM_RATE_8000, | 137 | .rates = SNDRV_PCM_RATE_8000, |
96 | .formats = SNDRV_PCM_FMTBIT_S16_LE, | 138 | .formats = SNDRV_PCM_FMTBIT_S16_LE, |
97 | }, | 139 | }, |
140 | .ops = &wm1250_ev1_ops, | ||
98 | }; | 141 | }; |
99 | 142 | ||
100 | static struct snd_soc_codec_driver soc_codec_dev_wm1250_ev1 = { | 143 | static struct snd_soc_codec_driver soc_codec_dev_wm1250_ev1 = { |