From: Ramesh Babu K V <[email protected]>

This interface module provides iceset interface for querying and
setting the iec958 status bits

Signed-off-by: Ramesh Babu K V <[email protected]>
Signed-off-by: Sailaja Bandarupalli <[email protected]>
---
 .../intel_mid_hdmi/intel_mid_hdmi_audio_if.c       |   68 ++++++++++++++++++++
 1 files changed, 68 insertions(+), 0 deletions(-)

diff --git a/sound/drivers/intel_mid_hdmi/intel_mid_hdmi_audio_if.c 
b/sound/drivers/intel_mid_hdmi/intel_mid_hdmi_audio_if.c
index 40b39e2..033a5d5 100644
--- a/sound/drivers/intel_mid_hdmi/intel_mid_hdmi_audio_if.c
+++ b/sound/drivers/intel_mid_hdmi/intel_mid_hdmi_audio_if.c
@@ -79,6 +79,74 @@ static void snd_intelhad_pcm_free(struct snd_pcm *pcm)
        snd_pcm_lib_preallocate_free_for_all(pcm);
 }
 
+static int had_iec958_info(struct snd_kcontrol *kcontrol,
+                               struct snd_ctl_elem_info *uinfo)
+{
+    uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958;
+    uinfo->count = 1;
+    return 0;
+}
+
+static int had_iec958_get(struct snd_kcontrol *kcontrol,
+                               struct snd_ctl_elem_value *ucontrol)
+{
+       struct snd_intelhad *intelhaddata = snd_kcontrol_chip(kcontrol);
+       mutex_lock(&intelhaddata->had_lock);
+       ucontrol->value.iec958.status[0] = (intelhaddata->aes_bits >> 0) & 0xff;
+       ucontrol->value.iec958.status[1] = (intelhaddata->aes_bits >> 8) & 0xff;
+       ucontrol->value.iec958.status[2] =
+                                       (intelhaddata->aes_bits >> 16) & 0xff;
+       ucontrol->value.iec958.status[3] =
+                                       (intelhaddata->aes_bits >> 24) & 0xff;
+       mutex_unlock(&intelhaddata->had_lock);
+       return 0;
+}
+static int had_iec958_mask_get(struct snd_kcontrol *kcontrol,
+                               struct snd_ctl_elem_value *ucontrol)
+{
+       ucontrol->value.iec958.status[0] = 0xff;
+       ucontrol->value.iec958.status[1] = 0xff;
+       ucontrol->value.iec958.status[2] = 0xff;
+       ucontrol->value.iec958.status[3] = 0xff;
+       return 0;
+}
+static int had_iec958_put(struct snd_kcontrol *kcontrol,
+                               struct snd_ctl_elem_value *ucontrol)
+{
+       unsigned int val;
+       struct snd_intelhad *intelhaddata = snd_kcontrol_chip(kcontrol);
+
+       pr_debug("entered had_iec958_put\n");
+       val = (ucontrol->value.iec958.status[0] << 0) |
+               (ucontrol->value.iec958.status[1] << 8) |
+               (ucontrol->value.iec958.status[2] << 16) |
+               (ucontrol->value.iec958.status[3] << 24);
+       mutex_lock(&intelhaddata->had_lock);
+       if (intelhaddata->aes_bits != val) {
+               intelhaddata->aes_bits = val;
+               mutex_unlock(&intelhaddata->had_lock);
+               return 1;
+       }
+       mutex_unlock(&intelhaddata->had_lock);
+       return 1;
+}
+
+static struct snd_kcontrol_new had_control_iec958_mask = {
+    .access =   SNDRV_CTL_ELEM_ACCESS_READ,
+    .iface =    SNDRV_CTL_ELEM_IFACE_PCM,
+    .name =     SNDRV_CTL_NAME_IEC958("", PLAYBACK, MASK),
+    .info =     had_iec958_info, /* shared */
+    .get =      had_iec958_mask_get,
+};
+
+static struct snd_kcontrol_new had_control_iec958 = {
+    .iface =    SNDRV_CTL_ELEM_IFACE_PCM,
+    .name =         SNDRV_CTL_NAME_IEC958("", PLAYBACK, DEFAULT),
+    .info =         had_iec958_info,
+    .get =          had_iec958_get,
+    .put =          had_iec958_put
+};
+
 /**
  * hdmi_audio_probe - to create sound card instance for HDMI audio playabck
  *
-- 
1.6.2.5

_______________________________________________
MeeGo-kernel mailing list
[email protected]
http://lists.meego.com/listinfo/meego-kernel

Reply via email to