diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2010-12-10 14:17:07 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2010-12-11 07:43:48 -0500 |
commit | f2c1fe090093ed62271473342f093df53c4f8a59 (patch) | |
tree | b5b23736e57c1c13e2a40093ab88135fb2adf1ba /sound/soc/codecs | |
parent | dcf9ada3bce67feab4482845f5e8e78fd278a176 (diff) |
ASoC: Remove open coded symmetry implementation from WM8903
We're already flagged as using symmetric rates so we don't need to
have a custom implementation.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Diffstat (limited to 'sound/soc/codecs')
-rw-r--r-- | sound/soc/codecs/wm8903.c | 79 |
1 files changed, 1 insertions, 78 deletions
diff --git a/sound/soc/codecs/wm8903.c b/sound/soc/codecs/wm8903.c index 542c7c4868ba..f9ae403715c6 100644 --- a/sound/soc/codecs/wm8903.c +++ b/sound/soc/codecs/wm8903.c | |||
@@ -218,10 +218,8 @@ struct wm8903_priv { | |||
218 | int sysclk; | 218 | int sysclk; |
219 | int irq; | 219 | int irq; |
220 | 220 | ||
221 | /* Reference counts */ | 221 | /* Reference count */ |
222 | int class_w_users; | 222 | int class_w_users; |
223 | int playback_active; | ||
224 | int capture_active; | ||
225 | 223 | ||
226 | struct completion wseq; | 224 | struct completion wseq; |
227 | 225 | ||
@@ -230,9 +228,6 @@ struct wm8903_priv { | |||
230 | int mic_short; | 228 | int mic_short; |
231 | int mic_last_report; | 229 | int mic_last_report; |
232 | int mic_delay; | 230 | int mic_delay; |
233 | |||
234 | struct snd_pcm_substream *master_substream; | ||
235 | struct snd_pcm_substream *slave_substream; | ||
236 | }; | 231 | }; |
237 | 232 | ||
238 | static int wm8903_volatile_register(unsigned int reg) | 233 | static int wm8903_volatile_register(unsigned int reg) |
@@ -1243,58 +1238,6 @@ static struct { | |||
1243 | { 0, 0 }, | 1238 | { 0, 0 }, |
1244 | }; | 1239 | }; |
1245 | 1240 | ||
1246 | static int wm8903_startup(struct snd_pcm_substream *substream, | ||
1247 | struct snd_soc_dai *dai) | ||
1248 | { | ||
1249 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | ||
1250 | struct snd_soc_codec *codec = rtd->codec; | ||
1251 | struct wm8903_priv *wm8903 = snd_soc_codec_get_drvdata(codec); | ||
1252 | struct snd_pcm_runtime *master_runtime; | ||
1253 | |||
1254 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | ||
1255 | wm8903->playback_active++; | ||
1256 | else | ||
1257 | wm8903->capture_active++; | ||
1258 | |||
1259 | /* The DAI has shared clocks so if we already have a playback or | ||
1260 | * capture going then constrain this substream to match it. | ||
1261 | */ | ||
1262 | if (wm8903->master_substream) { | ||
1263 | master_runtime = wm8903->master_substream->runtime; | ||
1264 | |||
1265 | dev_dbg(codec->dev, "Constraining to %d bits\n", | ||
1266 | master_runtime->sample_bits); | ||
1267 | |||
1268 | snd_pcm_hw_constraint_minmax(substream->runtime, | ||
1269 | SNDRV_PCM_HW_PARAM_SAMPLE_BITS, | ||
1270 | master_runtime->sample_bits, | ||
1271 | master_runtime->sample_bits); | ||
1272 | |||
1273 | wm8903->slave_substream = substream; | ||
1274 | } else | ||
1275 | wm8903->master_substream = substream; | ||
1276 | |||
1277 | return 0; | ||
1278 | } | ||
1279 | |||
1280 | static void wm8903_shutdown(struct snd_pcm_substream *substream, | ||
1281 | struct snd_soc_dai *dai) | ||
1282 | { | ||
1283 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | ||
1284 | struct snd_soc_codec *codec = rtd->codec; | ||
1285 | struct wm8903_priv *wm8903 = snd_soc_codec_get_drvdata(codec); | ||
1286 | |||
1287 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | ||
1288 | wm8903->playback_active--; | ||
1289 | else | ||
1290 | wm8903->capture_active--; | ||
1291 | |||
1292 | if (wm8903->master_substream == substream) | ||
1293 | wm8903->master_substream = wm8903->slave_substream; | ||
1294 | |||
1295 | wm8903->slave_substream = NULL; | ||
1296 | } | ||
1297 | |||
1298 | static int wm8903_hw_params(struct snd_pcm_substream *substream, | 1241 | static int wm8903_hw_params(struct snd_pcm_substream *substream, |
1299 | struct snd_pcm_hw_params *params, | 1242 | struct snd_pcm_hw_params *params, |
1300 | struct snd_soc_dai *dai) | 1243 | struct snd_soc_dai *dai) |
@@ -1319,11 +1262,6 @@ static int wm8903_hw_params(struct snd_pcm_substream *substream, | |||
1319 | u16 clock1 = snd_soc_read(codec, WM8903_CLOCK_RATES_1); | 1262 | u16 clock1 = snd_soc_read(codec, WM8903_CLOCK_RATES_1); |
1320 | u16 dac_digital1 = snd_soc_read(codec, WM8903_DAC_DIGITAL_1); | 1263 | u16 dac_digital1 = snd_soc_read(codec, WM8903_DAC_DIGITAL_1); |
1321 | 1264 | ||
1322 | if (substream == wm8903->slave_substream) { | ||
1323 | dev_dbg(codec->dev, "Ignoring hw_params for slave substream\n"); | ||
1324 | return 0; | ||
1325 | } | ||
1326 | |||
1327 | /* Enable sloping stopband filter for low sample rates */ | 1265 | /* Enable sloping stopband filter for low sample rates */ |
1328 | if (fs <= 24000) | 1266 | if (fs <= 24000) |
1329 | dac_digital1 |= WM8903_DAC_SB_FILT; | 1267 | dac_digital1 |= WM8903_DAC_SB_FILT; |
@@ -1341,19 +1279,6 @@ static int wm8903_hw_params(struct snd_pcm_substream *substream, | |||
1341 | } | 1279 | } |
1342 | } | 1280 | } |
1343 | 1281 | ||
1344 | /* Constraints should stop us hitting this but let's make sure */ | ||
1345 | if (wm8903->capture_active) | ||
1346 | switch (sample_rates[dsp_config].rate) { | ||
1347 | case 88200: | ||
1348 | case 96000: | ||
1349 | dev_err(codec->dev, "%dHz unsupported by ADC\n", | ||
1350 | fs); | ||
1351 | return -EINVAL; | ||
1352 | |||
1353 | default: | ||
1354 | break; | ||
1355 | } | ||
1356 | |||
1357 | dev_dbg(codec->dev, "DSP fs = %dHz\n", sample_rates[dsp_config].rate); | 1282 | dev_dbg(codec->dev, "DSP fs = %dHz\n", sample_rates[dsp_config].rate); |
1358 | clock1 &= ~WM8903_SAMPLE_RATE_MASK; | 1283 | clock1 &= ~WM8903_SAMPLE_RATE_MASK; |
1359 | clock1 |= sample_rates[dsp_config].value; | 1284 | clock1 |= sample_rates[dsp_config].value; |
@@ -1592,8 +1517,6 @@ static irqreturn_t wm8903_irq(int irq, void *data) | |||
1592 | SNDRV_PCM_FMTBIT_S24_LE) | 1517 | SNDRV_PCM_FMTBIT_S24_LE) |
1593 | 1518 | ||
1594 | static struct snd_soc_dai_ops wm8903_dai_ops = { | 1519 | static struct snd_soc_dai_ops wm8903_dai_ops = { |
1595 | .startup = wm8903_startup, | ||
1596 | .shutdown = wm8903_shutdown, | ||
1597 | .hw_params = wm8903_hw_params, | 1520 | .hw_params = wm8903_hw_params, |
1598 | .digital_mute = wm8903_digital_mute, | 1521 | .digital_mute = wm8903_digital_mute, |
1599 | .set_fmt = wm8903_set_dai_fmt, | 1522 | .set_fmt = wm8903_set_dai_fmt, |