aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/hda_eld.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/hda/hda_eld.c')
-rw-r--r--sound/pci/hda/hda_eld.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/sound/pci/hda/hda_eld.c b/sound/pci/hda/hda_eld.c
index 9446a5abea13..d8da18a9e98b 100644
--- a/sound/pci/hda/hda_eld.c
+++ b/sound/pci/hda/hda_eld.c
@@ -22,6 +22,7 @@
22 */ 22 */
23 23
24#include <linux/init.h> 24#include <linux/init.h>
25#include <linux/slab.h>
25#include <sound/core.h> 26#include <sound/core.h>
26#include <asm/unaligned.h> 27#include <asm/unaligned.h>
27#include "hda_codec.h" 28#include "hda_codec.h"
@@ -309,17 +310,12 @@ out_fail:
309 return -EINVAL; 310 return -EINVAL;
310} 311}
311 312
312static int hdmi_present_sense(struct hda_codec *codec, hda_nid_t nid)
313{
314 return snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PIN_SENSE, 0);
315}
316
317static int hdmi_eld_valid(struct hda_codec *codec, hda_nid_t nid) 313static int hdmi_eld_valid(struct hda_codec *codec, hda_nid_t nid)
318{ 314{
319 int eldv; 315 int eldv;
320 int present; 316 int present;
321 317
322 present = hdmi_present_sense(codec, nid); 318 present = snd_hda_pin_sense(codec, nid);
323 eldv = (present & AC_PINSENSE_ELDV); 319 eldv = (present & AC_PINSENSE_ELDV);
324 present = (present & AC_PINSENSE_PRESENCE); 320 present = (present & AC_PINSENSE_PRESENCE);
325 321
@@ -336,6 +332,7 @@ int snd_hdmi_get_eld_size(struct hda_codec *codec, hda_nid_t nid)
336 return snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_HDMI_DIP_SIZE, 332 return snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_HDMI_DIP_SIZE,
337 AC_DIPSIZE_ELD_BUF); 333 AC_DIPSIZE_ELD_BUF);
338} 334}
335EXPORT_SYMBOL_HDA(snd_hdmi_get_eld_size);
339 336
340int snd_hdmi_get_eld(struct hdmi_eld *eld, 337int snd_hdmi_get_eld(struct hdmi_eld *eld,
341 struct hda_codec *codec, hda_nid_t nid) 338 struct hda_codec *codec, hda_nid_t nid)
@@ -371,6 +368,7 @@ int snd_hdmi_get_eld(struct hdmi_eld *eld,
371 kfree(buf); 368 kfree(buf);
372 return ret; 369 return ret;
373} 370}
371EXPORT_SYMBOL_HDA(snd_hdmi_get_eld);
374 372
375static void hdmi_show_short_audio_desc(struct cea_sad *a) 373static void hdmi_show_short_audio_desc(struct cea_sad *a)
376{ 374{
@@ -409,6 +407,7 @@ void snd_print_channel_allocation(int spk_alloc, char *buf, int buflen)
409 } 407 }
410 buf[j] = '\0'; /* necessary when j == 0 */ 408 buf[j] = '\0'; /* necessary when j == 0 */
411} 409}
410EXPORT_SYMBOL_HDA(snd_print_channel_allocation);
412 411
413void snd_hdmi_show_eld(struct hdmi_eld *e) 412void snd_hdmi_show_eld(struct hdmi_eld *e)
414{ 413{
@@ -427,6 +426,7 @@ void snd_hdmi_show_eld(struct hdmi_eld *e)
427 for (i = 0; i < e->sad_count; i++) 426 for (i = 0; i < e->sad_count; i++)
428 hdmi_show_short_audio_desc(e->sad + i); 427 hdmi_show_short_audio_desc(e->sad + i);
429} 428}
429EXPORT_SYMBOL_HDA(snd_hdmi_show_eld);
430 430
431#ifdef CONFIG_PROC_FS 431#ifdef CONFIG_PROC_FS
432 432
@@ -477,6 +477,8 @@ static void hdmi_print_eld_info(struct snd_info_entry *entry,
477 [4 ... 7] = "reserved" 477 [4 ... 7] = "reserved"
478 }; 478 };
479 479
480 snd_iprintf(buffer, "monitor_present\t\t%d\n", e->monitor_present);
481 snd_iprintf(buffer, "eld_valid\t\t%d\n", e->eld_valid);
480 snd_iprintf(buffer, "monitor_name\t\t%s\n", e->monitor_name); 482 snd_iprintf(buffer, "monitor_name\t\t%s\n", e->monitor_name);
481 snd_iprintf(buffer, "connection_type\t\t%s\n", 483 snd_iprintf(buffer, "connection_type\t\t%s\n",
482 eld_connection_type_names[e->conn_type]); 484 eld_connection_type_names[e->conn_type]);
@@ -518,7 +520,11 @@ static void hdmi_write_eld_info(struct snd_info_entry *entry,
518 * monitor_name manufacture_id product_id 520 * monitor_name manufacture_id product_id
519 * eld_version edid_version 521 * eld_version edid_version
520 */ 522 */
521 if (!strcmp(name, "connection_type")) 523 if (!strcmp(name, "monitor_present"))
524 e->monitor_present = val;
525 else if (!strcmp(name, "eld_valid"))
526 e->eld_valid = val;
527 else if (!strcmp(name, "connection_type"))
522 e->conn_type = val; 528 e->conn_type = val;
523 else if (!strcmp(name, "port_id")) 529 else if (!strcmp(name, "port_id"))
524 e->port_id = val; 530 e->port_id = val;
@@ -560,13 +566,14 @@ static void hdmi_write_eld_info(struct snd_info_entry *entry,
560} 566}
561 567
562 568
563int snd_hda_eld_proc_new(struct hda_codec *codec, struct hdmi_eld *eld) 569int snd_hda_eld_proc_new(struct hda_codec *codec, struct hdmi_eld *eld,
570 int index)
564{ 571{
565 char name[32]; 572 char name[32];
566 struct snd_info_entry *entry; 573 struct snd_info_entry *entry;
567 int err; 574 int err;
568 575
569 snprintf(name, sizeof(name), "eld#%d", codec->addr); 576 snprintf(name, sizeof(name), "eld#%d.%d", codec->addr, index);
570 err = snd_card_proc_new(codec->bus->card, name, &entry); 577 err = snd_card_proc_new(codec->bus->card, name, &entry);
571 if (err < 0) 578 if (err < 0)
572 return err; 579 return err;
@@ -578,6 +585,7 @@ int snd_hda_eld_proc_new(struct hda_codec *codec, struct hdmi_eld *eld)
578 585
579 return 0; 586 return 0;
580} 587}
588EXPORT_SYMBOL_HDA(snd_hda_eld_proc_new);
581 589
582void snd_hda_eld_proc_free(struct hda_codec *codec, struct hdmi_eld *eld) 590void snd_hda_eld_proc_free(struct hda_codec *codec, struct hdmi_eld *eld)
583{ 591{
@@ -586,5 +594,6 @@ void snd_hda_eld_proc_free(struct hda_codec *codec, struct hdmi_eld *eld)
586 eld->proc_entry = NULL; 594 eld->proc_entry = NULL;
587 } 595 }
588} 596}
597EXPORT_SYMBOL_HDA(snd_hda_eld_proc_free);
589 598
590#endif /* CONFIG_PROC_FS */ 599#endif /* CONFIG_PROC_FS */