示例#1
0
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;
}
示例#2
0
int hdmi_audio_notifier_callback(struct notifier_block *nb,
				unsigned long arg, void *ptr)
{
	enum omap_dss_display_state state = arg;

	if (state == OMAP_DSS_DISPLAY_ACTIVE) {
		/* this happens just after hdmi_power_on */
		hdmi_audio_set_configuration(&hdmi_data);
		if (hdmi_data.active) {
			omap_hwmod_set_slave_idlemode(hdmi_data.oh,
							HWMOD_IDLEMODE_NO);
			hdmi_ti_4xxx_wp_audio_enable(&hdmi_data.ip_data, 1);
			queue_delayed_work(hdmi_data.workqueue,
				&hdmi_data.delayed_work,
				msecs_to_jiffies(1));
		}
	} else {
		cancel_delayed_work_sync(&hdmi_data.delayed_work);
	}
	return 0;
}