~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to sound/pci/hda/hda_eld.c

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
294
294
                snd_printd(KERN_INFO "HDMI: out of range MNL %d\n", mnl);
295
295
                goto out_fail;
296
296
        } else
297
 
                strlcpy(e->monitor_name, buf + ELD_FIXED_BYTES, mnl);
 
297
                strlcpy(e->monitor_name, buf + ELD_FIXED_BYTES, mnl + 1);
298
298
 
299
299
        for (i = 0; i < e->sad_count; i++) {
300
300
                if (ELD_FIXED_BYTES + mnl + 3 * (i + 1) > size) {
312
312
        return -EINVAL;
313
313
}
314
314
 
315
 
static int hdmi_eld_valid(struct hda_codec *codec, hda_nid_t nid)
316
 
{
317
 
        int eldv;
318
 
        int present;
319
 
 
320
 
        present = snd_hda_pin_sense(codec, nid);
321
 
        eldv    = (present & AC_PINSENSE_ELDV);
322
 
        present = (present & AC_PINSENSE_PRESENCE);
323
 
 
324
 
#ifdef CONFIG_SND_DEBUG_VERBOSE
325
 
        printk(KERN_INFO "HDMI: sink_present = %d, eld_valid = %d\n",
326
 
                        !!present, !!eldv);
327
 
#endif
328
 
 
329
 
        return eldv && present;
330
 
}
331
 
 
332
315
int snd_hdmi_get_eld_size(struct hda_codec *codec, hda_nid_t nid)
333
316
{
334
317
        return snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_HDMI_DIP_SIZE,
343
326
        int size;
344
327
        unsigned char *buf;
345
328
 
346
 
        if (!hdmi_eld_valid(codec, nid))
 
329
        if (!eld->eld_valid)
347
330
                return -ENOENT;
348
331
 
349
332
        size = snd_hdmi_get_eld_size(codec, nid);
477
460
 
478
461
        snd_iprintf(buffer, "monitor_present\t\t%d\n", e->monitor_present);
479
462
        snd_iprintf(buffer, "eld_valid\t\t%d\n", e->eld_valid);
 
463
        if (!e->eld_valid)
 
464
                return;
480
465
        snd_iprintf(buffer, "monitor_name\t\t%s\n", e->monitor_name);
481
466
        snd_iprintf(buffer, "connection_type\t\t%s\n",
482
467
                                eld_connection_type_names[e->conn_type]);