Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 263161
b: refs/heads/master
c: b6acf01
h: refs/heads/master
i:
  263159: c5cab14
v: v3
  • Loading branch information
Takashi Iwai committed Aug 20, 2011
1 parent a0b6aa8 commit 8d405b9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 38b65190c6ab0be8ce7cff69e734ca5b5e7fa309
refs/heads/master: b6acf013bdc6f6ff9643030add85832d44034a28
31 changes: 19 additions & 12 deletions trunk/sound/pci/hda/hda_eld.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,25 +144,17 @@ static int cea_sampling_frequencies[8] = {
SNDRV_PCM_RATE_192000, /* 7: 192000Hz */
};

static unsigned char hdmi_get_eld_byte(struct hda_codec *codec, hda_nid_t nid,
static unsigned int hdmi_get_eld_data(struct hda_codec *codec, hda_nid_t nid,
int byte_index)
{
unsigned int val;

val = snd_hda_codec_read(codec, nid, 0,
AC_VERB_GET_HDMI_ELDD, byte_index);

#ifdef BE_PARANOID
printk(KERN_INFO "HDMI: ELD data byte %d: 0x%x\n", byte_index, val);
#endif

if ((val & AC_ELDD_ELD_VALID) == 0) {
snd_printd(KERN_INFO "HDMI: invalid ELD data byte %d\n",
byte_index);
val = 0;
}

return val & AC_ELDD_ELD_DATA;
return val;
}

#define GRAB_BITS(buf, byte, lowbit, bits) \
Expand Down Expand Up @@ -344,11 +336,26 @@ int snd_hdmi_get_eld(struct hdmi_eld *eld,
if (!buf)
return -ENOMEM;

for (i = 0; i < size; i++)
buf[i] = hdmi_get_eld_byte(codec, nid, i);
for (i = 0; i < size; i++) {
unsigned int val = hdmi_get_eld_data(codec, nid, i);
if (!(val & AC_ELDD_ELD_VALID)) {
if (!i) {
snd_printd(KERN_INFO
"HDMI: invalid ELD data\n");
ret = -EINVAL;
goto error;
}
snd_printd(KERN_INFO
"HDMI: invalid ELD data byte %d\n", i);
val = 0;
} else
val &= AC_ELDD_ELD_DATA;
buf[i] = val;
}

ret = hdmi_update_eld(eld, buf, size);

error:
kfree(buf);
return ret;
}
Expand Down

0 comments on commit 8d405b9

Please sign in to comment.