aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/hda_eld.c
diff options
context:
space:
mode:
authorWu Fengguang <wfg@linux.intel.com>2008-11-20 22:41:50 -0500
committerTakashi Iwai <tiwai@suse.de>2008-11-21 02:27:49 -0500
commitacdda7915eb5dae20b6e43b8b772b712b1ed32c3 (patch)
tree03e2f24563f0046f706a714f7eabf60b9bbfc19e /sound/pci/hda/hda_eld.c
parentdb742104704cfb047732aa66451c608382da3aee (diff)
ALSA: hda - support writing to the ELD proc file
Allow users to fix quicks of ELD ROMs by writing new values to the ELD proc interface. The format is one or more lines of "name hex_value". Users can add/remove/modify up to 32 SAD(Short Audio Descriptor) entries. Signed-off-by: Wu Fengguang <wfg@linux.intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/hda_eld.c')
-rw-r--r--sound/pci/hda/hda_eld.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/sound/pci/hda/hda_eld.c b/sound/pci/hda/hda_eld.c
index 248cddf0ee80..d2b7ccca3bb3 100644
--- a/sound/pci/hda/hda_eld.c
+++ b/sound/pci/hda/hda_eld.c
@@ -500,6 +500,59 @@ static void hdmi_print_eld_info(struct snd_info_entry *entry,
500 hdmi_print_sad_info(i, e->sad + i, buffer); 500 hdmi_print_sad_info(i, e->sad + i, buffer);
501} 501}
502 502
503static void hdmi_write_eld_item(struct snd_info_entry *entry,
504 struct snd_info_buffer *buffer)
505{
506 struct hdmi_eld *e = entry->private_data;
507 char line[64];
508 char name[64];
509 char *sname;
510 long long val;
511 int n;
512
513 while (!snd_info_get_line(buffer, line, sizeof(line))) {
514 if (sscanf(line, "%s %llx", name, &val) != 2)
515 continue;
516 if (!strcmp(name, "connection_type"))
517 e->conn_type = val;
518 else if (!strcmp(name, "port_id"))
519 e->port_id = val;
520 else if (!strcmp(name, "support_hdcp"))
521 e->support_hdcp = val;
522 else if (!strcmp(name, "support_ai"))
523 e->support_ai = val;
524 else if (!strcmp(name, "audio_sync_delay"))
525 e->aud_synch_delay = val;
526 else if (!strcmp(name, "speakers"))
527 e->spk_alloc = val;
528 else if (!strcmp(name, "sad_count"))
529 e->sad_count = val;
530 else if (!strncmp(name, "sad", 3)) {
531 sname = name + 4;
532 n = name[3] - '0';
533 if (name[4] >= '0' && name[4] <= '9') {
534 sname++;
535 n = 10 * n + name[4] - '0';
536 }
537 if (n < 0 || n > 31) /* double the CEA limit */
538 continue;
539 if (!strcmp(sname, "_coding_type"))
540 e->sad[n].format = val;
541 else if (!strcmp(sname, "_channels"))
542 e->sad[n].channels = val;
543 else if (!strcmp(sname, "_rates"))
544 e->sad[n].rates = val;
545 else if (!strcmp(sname, "_bits"))
546 e->sad[n].sample_bits = val;
547 else if (!strcmp(sname, "_max_bitrate"))
548 e->sad[n].max_bitrate = val;
549 if (n >= e->sad_count)
550 e->sad_count = n + 1;
551 }
552 }
553}
554
555
503int snd_hda_eld_proc_new(struct hda_codec *codec, struct hdmi_eld *eld) 556int snd_hda_eld_proc_new(struct hda_codec *codec, struct hdmi_eld *eld)
504{ 557{
505 char name[32]; 558 char name[32];
@@ -512,6 +565,9 @@ int snd_hda_eld_proc_new(struct hda_codec *codec, struct hdmi_eld *eld)
512 return err; 565 return err;
513 566
514 snd_info_set_text_ops(entry, eld, hdmi_print_eld_info); 567 snd_info_set_text_ops(entry, eld, hdmi_print_eld_info);
568 entry->c.text.write = hdmi_write_eld_item;
569 entry->mode |= S_IWUSR;
570
515 return 0; 571 return 0;
516} 572}
517 573