Message ID | 1483341277-14475-3-git-send-email-jeeja.kp@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Mon, Jan 02, 2017 at 12:44:29PM +0530, jeeja.kp@intel.com wrote: > From: Jeeja KP <jeeja.kp@intel.com> > > Some machine requires MCLK to be enabled before SSP start up, so add > set_tristate() DAI ops to enable/disable SSP MCLK. This ops will be > called from machine which requires early MCLK and removes the usage of > enabling early MLCK in platform DAI prepare by default which is not > machine specific. This isn't an *obvious* use of the tristate operation... > + /* > + * To enable ssp clk explicitly before gateway copier is configured, > + * need to use dma control IPC. > + * Disable will be done when DSP gateway copier modules are deleted. > + */ > + if (!tristate) > + return skl_dsp_set_dma_control(ctx, mconfig); So we never clear this? And to be frank I'd have no idea looking at this that it's doing anything to do with clocks though that's a bit of a separate thing. It feels like DAPM might be a more natural place to do this, have a clock widget supplying the AIF widget for the interface. That'd be a bit more idiomatic.
On Fri, Jan 06, 2017 at 06:32:33PM +0000, Mark Brown wrote: > On Mon, Jan 02, 2017 at 12:44:29PM +0530, jeeja.kp@intel.com wrote: > > From: Jeeja KP <jeeja.kp@intel.com> > > > > Some machine requires MCLK to be enabled before SSP start up, so add > > set_tristate() DAI ops to enable/disable SSP MCLK. This ops will be > > called from machine which requires early MCLK and removes the usage of > > enabling early MLCK in platform DAI prepare by default which is not > > machine specific. > > This isn't an *obvious* use of the tristate operation... > > > + /* > > + * To enable ssp clk explicitly before gateway copier is configured, > > + * need to use dma control IPC. > > + * Disable will be done when DSP gateway copier modules are deleted. > > + */ > > + if (!tristate) > > + return skl_dsp_set_dma_control(ctx, mconfig); > > So we never clear this? And to be frank I'd have no idea looking at > this that it's doing anything to do with clocks though that's a bit of a > separate thing. It feels like DAPM might be a more natural place to do > this, have a clock widget supplying the AIF widget for the interface. > That'd be a bit more idiomatic. The clk will be cleared, when DSP pipeline is deleted, that is when audio device is closed. My bad, yes this is not the correct usage of tristate operation, we need to model it as a clock supply widget, will rework on this patch.
diff --git a/sound/soc/intel/skylake/skl-pcm.c b/sound/soc/intel/skylake/skl-pcm.c index 10fa10d..3c16d41 100644 --- a/sound/soc/intel/skylake/skl-pcm.c +++ b/sound/soc/intel/skylake/skl-pcm.c @@ -396,6 +396,33 @@ static int skl_be_hw_params(struct snd_pcm_substream *substream, return skl_tplg_be_update_params(dai, &p_params); } +static int skl_soc_dai_set_tristate(struct snd_soc_dai *dai, int tristate) +{ + struct skl *skl = get_skl_ctx(dai->dev); + struct skl_sst *ctx = skl->skl_sst; + struct skl_module_cfg *mconfig; + int stream; + + if (dai->playback_active) + stream = SNDRV_PCM_STREAM_PLAYBACK; + else + stream = SNDRV_PCM_STREAM_CAPTURE; + + mconfig = skl_tplg_be_get_cpr_module(dai, stream); + if (!mconfig) + return -EINVAL; + + /* + * To enable ssp clk explicitly before gateway copier is configured, + * need to use dma control IPC. + * Disable will be done when DSP gateway copier modules are deleted. + */ + if (!tristate) + return skl_dsp_set_dma_control(ctx, mconfig); + + return 0; +} + static int skl_decoupled_trigger(struct snd_pcm_substream *substream, int cmd) { @@ -646,7 +673,7 @@ static struct snd_soc_dai_ops skl_dmic_dai_ops = { static struct snd_soc_dai_ops skl_be_ssp_dai_ops = { .hw_params = skl_be_hw_params, - .prepare = skl_be_prepare, + .set_tristate = skl_soc_dai_set_tristate, }; static struct snd_soc_dai_ops skl_link_dai_ops = {