Commit 41165298 authored by Ryo Kodama's avatar Ryo Kodama Committed by Mark Brown

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: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: default avatarRyo Kodama <ryo.kodama.vz@renesas.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent ec185f95
...@@ -252,6 +252,17 @@ static void ak4613_dai_shutdown(struct snd_pcm_substream *substream, ...@@ -252,6 +252,17 @@ static void ak4613_dai_shutdown(struct snd_pcm_substream *substream,
mutex_unlock(&priv->lock); mutex_unlock(&priv->lock);
} }
static int ak4613_dai_startup(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
struct snd_soc_codec *codec = dai->codec;
struct ak4613_priv *priv = snd_soc_codec_get_drvdata(codec);
priv->cnt++;
return 0;
}
static int ak4613_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) static int ak4613_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
{ {
struct snd_soc_codec *codec = dai->codec; struct snd_soc_codec *codec = dai->codec;
...@@ -349,7 +360,6 @@ static int ak4613_dai_hw_params(struct snd_pcm_substream *substream, ...@@ -349,7 +360,6 @@ static int ak4613_dai_hw_params(struct snd_pcm_substream *substream,
if ((priv->iface == NULL) || if ((priv->iface == NULL) ||
(priv->iface == iface)) { (priv->iface == iface)) {
priv->iface = iface; priv->iface = iface;
priv->cnt++;
ret = 0; ret = 0;
} }
mutex_unlock(&priv->lock); mutex_unlock(&priv->lock);
...@@ -398,6 +408,7 @@ static int ak4613_set_bias_level(struct snd_soc_codec *codec, ...@@ -398,6 +408,7 @@ static int ak4613_set_bias_level(struct snd_soc_codec *codec,
} }
static const struct snd_soc_dai_ops ak4613_dai_ops = { static const struct snd_soc_dai_ops ak4613_dai_ops = {
.startup = ak4613_dai_startup,
.shutdown = ak4613_dai_shutdown, .shutdown = ak4613_dai_shutdown,
.set_fmt = ak4613_dai_set_fmt, .set_fmt = ak4613_dai_set_fmt,
.hw_params = ak4613_dai_hw_params, .hw_params = ak4613_dai_hw_params,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment