diff options
author | Ricardo Neri <ricardo.neri@ti.com> | 2011-11-27 17:09:58 -0500 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2012-01-05 03:34:48 -0500 |
commit | 80a485962807aae44a93197ee88854910bb935ad (patch) | |
tree | 1ccfba67a0625db1b8f34895535b5c3f30333d10 /drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c | |
parent | 284cb318c8f84744f073d4f4d3820946afaf5442 (diff) |
OMAPDSS: HDMI: Create function to enable HDMI audio
In order to separate clearly IP-specific code from general DSS code,
a function for OMAP4 audio enable is created. This function is
included in the HDMI IP ops to align with the current implementation
of the DSS HDMI driver. This function is to be used by the ASoC
HDMI audio codec.
Signed-off-by: Ricardo Neri <ricardo.neri@ti.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c')
-rw-r--r-- | drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c index 3f74f55269bd..220e0ce5e5ef 100644 --- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c +++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c | |||
@@ -1204,35 +1204,41 @@ int hdmi_config_audio_acr(struct hdmi_ip_data *ip_data, | |||
1204 | return 0; | 1204 | return 0; |
1205 | } | 1205 | } |
1206 | 1206 | ||
1207 | void ti_hdmi_4xxx_wp_audio_enable(struct hdmi_ip_data *ip_data, bool enable) | ||
1208 | { | ||
1209 | REG_FLD_MOD(hdmi_av_base(ip_data), | ||
1210 | HDMI_CORE_AV_AUD_MODE, enable, 0, 0); | ||
1211 | REG_FLD_MOD(hdmi_wp_base(ip_data), | ||
1212 | HDMI_WP_AUDIO_CTRL, enable, 31, 31); | ||
1213 | REG_FLD_MOD(hdmi_wp_base(ip_data), | ||
1214 | HDMI_WP_AUDIO_CTRL, enable, 30, 30); | ||
1215 | } | ||
1216 | |||
1207 | int hdmi_audio_trigger(struct snd_pcm_substream *substream, int cmd, | 1217 | int hdmi_audio_trigger(struct snd_pcm_substream *substream, int cmd, |
1208 | struct snd_soc_dai *dai) | 1218 | struct snd_soc_dai *dai) |
1209 | { | 1219 | { |
1210 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 1220 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
1211 | struct snd_soc_codec *codec = rtd->codec; | 1221 | struct snd_soc_codec *codec = rtd->codec; |
1222 | struct platform_device *pdev = to_platform_device(codec->dev); | ||
1212 | struct hdmi_ip_data *ip_data = snd_soc_codec_get_drvdata(codec); | 1223 | struct hdmi_ip_data *ip_data = snd_soc_codec_get_drvdata(codec); |
1213 | int err = 0; | 1224 | int err = 0; |
1214 | 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 | |||
1215 | switch (cmd) { | 1231 | switch (cmd) { |
1216 | case SNDRV_PCM_TRIGGER_START: | 1232 | case SNDRV_PCM_TRIGGER_START: |
1217 | case SNDRV_PCM_TRIGGER_RESUME: | 1233 | case SNDRV_PCM_TRIGGER_RESUME: |
1218 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: | 1234 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: |
1219 | REG_FLD_MOD(hdmi_av_base(ip_data), | 1235 | ip_data->ops->audio_enable(ip_data, true); |
1220 | HDMI_CORE_AV_AUD_MODE, 1, 0, 0); | ||
1221 | REG_FLD_MOD(hdmi_wp_base(ip_data), | ||
1222 | HDMI_WP_AUDIO_CTRL, 1, 31, 31); | ||
1223 | REG_FLD_MOD(hdmi_wp_base(ip_data), | ||
1224 | HDMI_WP_AUDIO_CTRL, 1, 30, 30); | ||
1225 | break; | 1236 | break; |
1226 | 1237 | ||
1227 | case SNDRV_PCM_TRIGGER_STOP: | 1238 | case SNDRV_PCM_TRIGGER_STOP: |
1228 | case SNDRV_PCM_TRIGGER_SUSPEND: | 1239 | case SNDRV_PCM_TRIGGER_SUSPEND: |
1229 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: | 1240 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: |
1230 | REG_FLD_MOD(hdmi_av_base(ip_data), | 1241 | ip_data->ops->audio_enable(ip_data, false); |
1231 | HDMI_CORE_AV_AUD_MODE, 0, 0, 0); | ||
1232 | REG_FLD_MOD(hdmi_wp_base(ip_data), | ||
1233 | HDMI_WP_AUDIO_CTRL, 0, 30, 30); | ||
1234 | REG_FLD_MOD(hdmi_wp_base(ip_data), | ||
1235 | HDMI_WP_AUDIO_CTRL, 0, 31, 31); | ||
1236 | break; | 1242 | break; |
1237 | default: | 1243 | default: |
1238 | err = -EINVAL; | 1244 | err = -EINVAL; |