ASoC: wcd9310: Turn off slimbus clocks when no ports are active

With the recent change in tabla shutdown, turning off the clocks
were being taken care after all the slimbus ports are closed.
But, there are instants where tabla startup is being called
during bootup, which keeps the runtime PM votes running,
and as there are no ports open, clocks are on all the time,
due to one of the votes. Bringing back tabla shutdown, but
turn off the clocks only if there are no slimbus ports
open at the time of shutdown, else it will taken care when
the slimbus ports are getting closed

Change-Id: Iaa9378b171d7c169a0f3306d55698e18d28dd111
CRs-fixed: 390003
Signed-off-by: Swaminathan Sathappan <Swami@codeaurora.org>
Signed-off-by: Ajay Dudani <adudani@codeaurora.org>
This commit is contained in:
Ajay Dudani 2012-08-23 16:01:50 -07:00 committed by Iliyan Malchev
parent cbff6e7a0c
commit 4172e74684

View file

@ -3760,6 +3760,35 @@ static int tabla_startup(struct snd_pcm_substream *substream,
return 0;
}
static void tabla_shutdown(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
struct wcd9xxx *tabla_core = dev_get_drvdata(dai->codec->dev->parent);
struct tabla_priv *tabla = snd_soc_codec_get_drvdata(dai->codec);
u32 active = 0;
pr_debug("%s(): substream = %s stream = %d\n" , __func__,
substream->name, substream->stream);
if (tabla->intf_type != WCD9XXX_INTERFACE_TYPE_SLIMBUS)
return;
if (dai->id <= NUM_CODEC_DAIS) {
if (tabla->dai[dai->id-1].ch_mask) {
active = 1;
pr_debug("%s(): Codec DAI: chmask[%d] = 0x%x\n",
__func__, dai->id-1, tabla->dai[dai->id-1].ch_mask);
}
}
if ((tabla_core != NULL) &&
(tabla_core->dev != NULL) &&
(tabla_core->dev->parent != NULL) &&
(active == 0)) {
pm_runtime_mark_last_busy(tabla_core->dev->parent);
pm_runtime_put(tabla_core->dev->parent);
}
}
int tabla_mclk_enable(struct snd_soc_codec *codec, int mclk_enable, bool dapm)
{
struct tabla_priv *tabla = snd_soc_codec_get_drvdata(codec);
@ -4320,6 +4349,7 @@ static int tabla_hw_params(struct snd_pcm_substream *substream,
static struct snd_soc_dai_ops tabla_dai_ops = {
.startup = tabla_startup,
.shutdown = tabla_shutdown,
.hw_params = tabla_hw_params,
.set_sysclk = tabla_set_dai_sysclk,
.set_fmt = tabla_set_dai_fmt,