From 184006555f025932642c29bf9477d76fd63537f8 Mon Sep 17 00:00:00 2001 From: Sayak Ghosh Choudhury Date: Thu, 22 Mar 2012 19:33:19 +0530 Subject: ALSA:hda: add alsa control for query of device alsa control is added to facilitate querying dts decode capability of connected device. dts decode capability of the connected device is updated in the ELD buffer. That information is updated in the ALSA control structure. In addition to that, the code is amended to handle other pass through decoder mode support. Bug 943017 Change-Id: If8da7dfb24be3b86592191f5586b70492282b438 Signed-off-by: Sayak Ghosh Choudhury Reviewed-on: http://git-master/r/91813 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Scott Peterson --- sound/pci/hda/hda_codec.c | 16 +++++++++++++--- sound/pci/hda/hda_codec.h | 2 +- sound/pci/hda/hda_eld.c | 14 +++++++++----- 3 files changed, 23 insertions(+), 9 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 6e171eef07ee..91b2e4689175 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -2840,12 +2840,22 @@ static int snd_hda_spdif_out_switch_put(struct snd_kcontrol *kcontrol, return change; } +int snd_hda_hdmi_decode_info(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_info *uinfo) +{ + uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; + uinfo->count = 1; + uinfo->value.integer.min = 0; + uinfo->value.integer.max = 0xFFFFFFFF; + return 0; +} + static int snd_hda_hdmi_decode_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct hda_codec *codec = snd_kcontrol_chip(kcontrol); - ucontrol->value.integer.value[0] = codec->ac3dec_capable; + ucontrol->value.integer.value[0] = codec->recv_dec_cap; return 0; } @@ -2880,8 +2890,8 @@ static struct snd_kcontrol_new dig_mixes[] = { }, { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, - .name = "AC3 Decode Capability", - .info = snd_ctl_boolean_mono_info, + .name = "HDA Decode Capability", + .info = snd_hda_hdmi_decode_info, .get = snd_hda_hdmi_decode_get, }, { } /* end */ diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h index 59d4cbe7e06a..1c5dc6d73d6b 100644 --- a/sound/pci/hda/hda_codec.h +++ b/sound/pci/hda/hda_codec.h @@ -867,7 +867,7 @@ struct hda_codec { unsigned long power_jiffies; #endif - bool ac3dec_capable; + unsigned int recv_dec_cap; /* codec-specific additional proc output */ void (*proc_widget_hook)(struct snd_info_buffer *buffer, struct hda_codec *codec, hda_nid_t nid); diff --git a/sound/pci/hda/hda_eld.c b/sound/pci/hda/hda_eld.c index f3d204f01ab2..ad760f90053d 100644 --- a/sound/pci/hda/hda_eld.c +++ b/sound/pci/hda/hda_eld.c @@ -421,6 +421,15 @@ int snd_hdmi_get_eld(struct hdmi_eld *eld, if (!eld->lpcm_sad_ready) hdmi_update_lpcm_sad_eld(codec, nid, eld, size); + codec->recv_dec_cap = 0; + for (i = 0; i < eld->sad_count; i++) { + if (eld->sad[i].format == AUDIO_CODING_TYPE_AC3) { + codec->recv_dec_cap |= (1 << AUDIO_CODING_TYPE_AC3); + } else if (eld->sad[i].format == AUDIO_CODING_TYPE_DTS) { + codec->recv_dec_cap |= (1 << AUDIO_CODING_TYPE_DTS); + } + } + buf = kmalloc(size, GFP_KERNEL); if (!buf) return -ENOMEM; @@ -443,11 +452,6 @@ int snd_hdmi_get_eld(struct hdmi_eld *eld, } ret = hdmi_update_eld(eld, buf, size); - codec->ac3dec_capable = false; - for (i = 0; i < eld->sad_count; i++) { - if (eld->sad[i].format == AUDIO_CODING_TYPE_AC3) - codec->ac3dec_capable = true; - } error: kfree(buf); -- cgit v1.2.3