ASoC: OMAP: HDMI: Move HDMI codec trigger function to generic HDMI driver
authorRicardo Neri <ricardo.neri@ti.com>
Sun, 27 Nov 2011 22:18:01 +0000 (16:18 -0600)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Thu, 5 Jan 2012 08:34:48 +0000 (10:34 +0200)
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>
drivers/video/omap2/dss/hdmi.c
drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h

index b727992efd6d7f7f4123ff010a739d854363c832..b4c270edb915bde5ce721d8373950ee8fa2df667 100644 (file)
@@ -561,6 +561,37 @@ void omapdss_hdmi_display_disable(struct omap_dss_device *dssdev)
 #if defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI) || \
        defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI_MODULE)
 
+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 platform_device *pdev = to_platform_device(codec->dev);
+       struct hdmi_ip_data *ip_data = snd_soc_codec_get_drvdata(codec);
+       int err = 0;
+
+       if (!(ip_data->ops) && !(ip_data->ops->audio_enable)) {
+               dev_err(&pdev->dev, "Cannot enable/disable audio\n");
+               return -ENODEV;
+       }
+
+       switch (cmd) {
+       case SNDRV_PCM_TRIGGER_START:
+       case SNDRV_PCM_TRIGGER_RESUME:
+       case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
+               ip_data->ops->audio_enable(ip_data, true);
+               break;
+       case SNDRV_PCM_TRIGGER_STOP:
+       case SNDRV_PCM_TRIGGER_SUSPEND:
+       case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
+               ip_data->ops->audio_enable(ip_data, false);
+               break;
+       default:
+               err = -EINVAL;
+       }
+       return err;
+}
+
 static int hdmi_audio_hw_params(struct snd_pcm_substream *substream,
                                    struct snd_pcm_hw_params *params,
                                    struct snd_soc_dai *dai)
index 220e0ce5e5effdc95280d96e1c32e274a833bfbb..9af81f18f1633ffaaeae842d922f8800cd9d285c 100644 (file)
@@ -1213,36 +1213,4 @@ void ti_hdmi_4xxx_wp_audio_enable(struct hdmi_ip_data *ip_data, bool enable)
        REG_FLD_MOD(hdmi_wp_base(ip_data),
                                HDMI_WP_AUDIO_CTRL, enable, 30, 30);
 }
-
-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 platform_device *pdev = to_platform_device(codec->dev);
-       struct hdmi_ip_data *ip_data = snd_soc_codec_get_drvdata(codec);
-       int err = 0;
-
-       if (!(ip_data->ops) && !(ip_data->ops->audio_enable)) {
-               dev_err(&pdev->dev, "Cannot enable/disable audio\n");
-               return -ENODEV;
-       }
-
-       switch (cmd) {
-       case SNDRV_PCM_TRIGGER_START:
-       case SNDRV_PCM_TRIGGER_RESUME:
-       case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
-               ip_data->ops->audio_enable(ip_data, true);
-               break;
-
-       case SNDRV_PCM_TRIGGER_STOP:
-       case SNDRV_PCM_TRIGGER_SUSPEND:
-       case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
-               ip_data->ops->audio_enable(ip_data, false);
-               break;
-       default:
-               err = -EINVAL;
-       }
-       return err;
-}
 #endif
index eb5e8f7120f83f726701f4196250a48c10d6e602..a442998980f12231070592e9ade2d45cc5764716 100644 (file)
@@ -576,8 +576,6 @@ struct hdmi_core_audio_config {
 
 #if defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI) || \
        defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI_MODULE)
-int hdmi_audio_trigger(struct snd_pcm_substream *substream, int cmd,
-                               struct snd_soc_dai *dai);
 int hdmi_config_audio_acr(struct hdmi_ip_data *ip_data,
                                u32 sample_freq, u32 *n, u32 *cts);
 void hdmi_core_audio_infoframe_config(struct hdmi_ip_data *ip_data,