aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRicardo Neri <ricardo.neri@ti.com>2011-11-27 17:18:01 -0500
committerTomi Valkeinen <tomi.valkeinen@ti.com>2012-01-05 03:34:48 -0500
commitedefcdad6a57657a236638c937ccd5a3af272d02 (patch)
tree309b411494acce6f8025155f76a49428bc7aaa42
parent80a485962807aae44a93197ee88854910bb935ad (diff)
ASoC: OMAP: HDMI: Move HDMI codec trigger function to generic HDMI driver
The function hdmi_audio_trigger is a callback used by ASoC to stop/start HDMI audio. Also, it does not perform IP-specific configuration directly. Hence, it should be placed in the general portion of the HDMI driver, along with the other ASoC callbacks. Also, make this function static. Signed-off-by: Ricardo Neri <ricardo.neri@ti.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
-rw-r--r--drivers/video/omap2/dss/hdmi.c31
-rw-r--r--drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c32
-rw-r--r--drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h2
3 files changed, 31 insertions, 34 deletions
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index b727992efd6d..b4c270edb915 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -561,6 +561,37 @@ void omapdss_hdmi_display_disable(struct omap_dss_device *dssdev)
561#if defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI) || \ 561#if defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI) || \
562 defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI_MODULE) 562 defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI_MODULE)
563 563
564static int hdmi_audio_trigger(struct snd_pcm_substream *substream, int cmd,
565 struct snd_soc_dai *dai)
566{
567 struct snd_soc_pcm_runtime *rtd = substream->private_data;
568 struct snd_soc_codec *codec = rtd->codec;
569 struct platform_device *pdev = to_platform_device(codec->dev);
570 struct hdmi_ip_data *ip_data = snd_soc_codec_get_drvdata(codec);
571 int err = 0;
572
573 if (!(ip_data->ops) && !(ip_data->ops->audio_enable)) {
574 dev_err(&pdev->dev, "Cannot enable/disable audio\n");
575 return -ENODEV;
576 }
577
578 switch (cmd) {
579 case SNDRV_PCM_TRIGGER_START:
580 case SNDRV_PCM_TRIGGER_RESUME:
581 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
582 ip_data->ops->audio_enable(ip_data, true);
583 break;
584 case SNDRV_PCM_TRIGGER_STOP:
585 case SNDRV_PCM_TRIGGER_SUSPEND:
586 case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
587 ip_data->ops->audio_enable(ip_data, false);
588 break;
589 default:
590 err = -EINVAL;
591 }
592 return err;
593}
594
564static int hdmi_audio_hw_params(struct snd_pcm_substream *substream, 595static int hdmi_audio_hw_params(struct snd_pcm_substream *substream,
565 struct snd_pcm_hw_params *params, 596 struct snd_pcm_hw_params *params,
566 struct snd_soc_dai *dai) 597 struct snd_soc_dai *dai)
diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
index 220e0ce5e5ef..9af81f18f163 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
@@ -1213,36 +1213,4 @@ void ti_hdmi_4xxx_wp_audio_enable(struct hdmi_ip_data *ip_data, bool enable)
1213 REG_FLD_MOD(hdmi_wp_base(ip_data), 1213 REG_FLD_MOD(hdmi_wp_base(ip_data),
1214 HDMI_WP_AUDIO_CTRL, enable, 30, 30); 1214 HDMI_WP_AUDIO_CTRL, enable, 30, 30);
1215} 1215}
1216
1217int hdmi_audio_trigger(struct snd_pcm_substream *substream, int cmd,
1218 struct snd_soc_dai *dai)
1219{
1220 struct snd_soc_pcm_runtime *rtd = substream->private_data;
1221 struct snd_soc_codec *codec = rtd->codec;
1222 struct platform_device *pdev = to_platform_device(codec->dev);
1223 struct hdmi_ip_data *ip_data = snd_soc_codec_get_drvdata(codec);
1224 int err = 0;
1225
1226 if (!(ip_data->ops) && !(ip_data->ops->audio_enable)) {
1227 dev_err(&pdev->dev, "Cannot enable/disable audio\n");
1228 return -ENODEV;
1229 }
1230
1231 switch (cmd) {
1232 case SNDRV_PCM_TRIGGER_START:
1233 case SNDRV_PCM_TRIGGER_RESUME:
1234 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
1235 ip_data->ops->audio_enable(ip_data, true);
1236 break;
1237
1238 case SNDRV_PCM_TRIGGER_STOP:
1239 case SNDRV_PCM_TRIGGER_SUSPEND:
1240 case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
1241 ip_data->ops->audio_enable(ip_data, false);
1242 break;
1243 default:
1244 err = -EINVAL;
1245 }
1246 return err;
1247}
1248#endif 1216#endif
diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
index eb5e8f7120f8..a442998980f1 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
@@ -576,8 +576,6 @@ struct hdmi_core_audio_config {
576 576
577#if defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI) || \ 577#if defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI) || \
578 defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI_MODULE) 578 defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI_MODULE)
579int hdmi_audio_trigger(struct snd_pcm_substream *substream, int cmd,
580 struct snd_soc_dai *dai);
581int hdmi_config_audio_acr(struct hdmi_ip_data *ip_data, 579int hdmi_config_audio_acr(struct hdmi_ip_data *ip_data,
582 u32 sample_freq, u32 *n, u32 *cts); 580 u32 sample_freq, u32 *n, u32 *cts);
583void hdmi_core_audio_infoframe_config(struct hdmi_ip_data *ip_data, 581void hdmi_core_audio_infoframe_config(struct hdmi_ip_data *ip_data,