static int hdmi_audio_trigger(struct snd_pcm_substream *substream, int cmd, struct snd_soc_dai *dai) { struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_codec *codec = rtd->codec; struct hdmi_codec_data *priv = snd_soc_codec_get_drvdata(codec); int err = 0; switch (cmd) { case SNDRV_PCM_TRIGGER_START: case SNDRV_PCM_TRIGGER_RESUME: case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: /* * switch to no-idle to avoid DSS_L3_ICLK clock * to be shutdown during audio activity (as per TRM) */ omap_hwmod_set_slave_idlemode(priv->oh, HWMOD_IDLEMODE_NO); hdmi_ti_4xxx_wp_audio_enable(&priv->ip_data, 1); queue_delayed_work(priv->workqueue, &priv->delayed_work, msecs_to_jiffies(1)); priv->active = 1; break; case SNDRV_PCM_TRIGGER_STOP: case SNDRV_PCM_TRIGGER_SUSPEND: case SNDRV_PCM_TRIGGER_PAUSE_PUSH: if (delayed_work_pending(&hdmi_data.delayed_work)) cancel_delayed_work(&hdmi_data.delayed_work); priv->active = 0; hdmi_ti_4xxx_audio_transfer_en(&priv->ip_data, 0); hdmi_ti_4xxx_wp_audio_enable(&priv->ip_data, 0); /* * switch back to smart-idle & wakeup capable * after audio activity stops */ omap_hwmod_set_slave_idlemode(priv->oh, HWMOD_IDLEMODE_SMART_WKUP); break; default: err = -EINVAL; } return err; }
static void hdmi_audio_work(struct work_struct *work) { hdmi_ti_4xxx_audio_transfer_en(&hdmi_data.ip_data, 1); }