aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyo Kodama <ryo.kodama.vz@renesas.com>2017-06-07 01:39:00 -0400
committerMark Brown <broonie@kernel.org>2017-06-07 15:24:00 -0400
commit411652982a20ab60957283e9084c81d791cb69f9 (patch)
tree4a73f2ccae2ba2bc90cdad9becbd5429d4f29e21
parentec185f95401e36f398b39706705f10d7fe7ff058 (diff)
ASoC: ak4613: Improve counting DAI number
Add the startup function to count DAI instead of hw_params. This change matches the number of opened DAIs. If this change isn't applied, you may get unexpected error due to mismatching of count. Since the excution number of hw_params and shutdown may be different, the mismatching happens. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Ryo Kodama <ryo.kodama.vz@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--sound/soc/codecs/ak4613.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/sound/soc/codecs/ak4613.c b/sound/soc/codecs/ak4613.c
index 557ac16d43e2..e3121ca3d1a2 100644
--- a/sound/soc/codecs/ak4613.c
+++ b/sound/soc/codecs/ak4613.c
@@ -252,6 +252,17 @@ static void ak4613_dai_shutdown(struct snd_pcm_substream *substream,
252 mutex_unlock(&priv->lock); 252 mutex_unlock(&priv->lock);
253} 253}
254 254
255static int ak4613_dai_startup(struct snd_pcm_substream *substream,
256 struct snd_soc_dai *dai)
257{
258 struct snd_soc_codec *codec = dai->codec;
259 struct ak4613_priv *priv = snd_soc_codec_get_drvdata(codec);
260
261 priv->cnt++;
262
263 return 0;
264}
265
255static int ak4613_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) 266static int ak4613_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
256{ 267{
257 struct snd_soc_codec *codec = dai->codec; 268 struct snd_soc_codec *codec = dai->codec;
@@ -349,7 +360,6 @@ static int ak4613_dai_hw_params(struct snd_pcm_substream *substream,
349 if ((priv->iface == NULL) || 360 if ((priv->iface == NULL) ||
350 (priv->iface == iface)) { 361 (priv->iface == iface)) {
351 priv->iface = iface; 362 priv->iface = iface;
352 priv->cnt++;
353 ret = 0; 363 ret = 0;
354 } 364 }
355 mutex_unlock(&priv->lock); 365 mutex_unlock(&priv->lock);
@@ -398,6 +408,7 @@ static int ak4613_set_bias_level(struct snd_soc_codec *codec,
398} 408}
399 409
400static const struct snd_soc_dai_ops ak4613_dai_ops = { 410static const struct snd_soc_dai_ops ak4613_dai_ops = {
411 .startup = ak4613_dai_startup,
401 .shutdown = ak4613_dai_shutdown, 412 .shutdown = ak4613_dai_shutdown,
402 .set_fmt = ak4613_dai_set_fmt, 413 .set_fmt = ak4613_dai_set_fmt,
403 .hw_params = ak4613_dai_hw_params, 414 .hw_params = ak4613_dai_hw_params,