diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index 3fc201c3b95a..eaf9a276ad82 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c @@ -95,6 +95,7 @@ struct hdmi_spec_per_pin { bool non_pcm; bool chmap_set; /* channel-map override by ALSA API? */ unsigned char chmap[8]; /* ALSA API channel-map */ + int forced_conn_type_val; /* if non-neg, value forced by procfs */ #ifdef CONFIG_SND_PROC_FS struct snd_info_entry *proc_entry; #endif @@ -458,9 +459,21 @@ static void write_eld_info(struct snd_info_entry *entry, struct snd_info_buffer *buffer) { struct hdmi_spec_per_pin *per_pin = entry->private_data; + int old_conn_type, new_conn_type; mutex_lock(&per_pin->lock); + old_conn_type = per_pin->sink_eld.info.conn_type; snd_hdmi_write_eld_info(&per_pin->sink_eld, buffer); + new_conn_type = per_pin->sink_eld.info.conn_type; + if (new_conn_type != old_conn_type) { + if ((unsigned)new_conn_type >= 4) { /*hardcoded limit*/ + /* preserve and unforce */ + per_pin->sink_eld.info.conn_type = old_conn_type; + per_pin->forced_conn_type_val = -1; + } else { + per_pin->forced_conn_type_val = new_conn_type; + } + } mutex_unlock(&per_pin->lock); } @@ -1431,6 +1444,8 @@ static bool hdmi_present_sense_via_verbs(struct hdmi_spec_per_pin *per_pin, if (snd_hdmi_parse_eld(codec, &eld->info, eld->eld_buffer, eld->eld_size) < 0) eld->eld_valid = false; + if (per_pin->forced_conn_type_val >= 0) + eld->info.conn_type = per_pin->forced_conn_type_val; } if (!eld->eld_valid && repoll) do_repoll = true; @@ -1493,6 +1508,8 @@ static void sync_eld_via_acomp(struct hda_codec *codec, if (snd_hdmi_parse_eld(codec, &eld->info, eld->eld_buffer, size) < 0) size = -EINVAL; + if (per_pin->forced_conn_type_val >= 0) + eld->info.conn_type = per_pin->forced_conn_type_val; } if (size > 0) { @@ -1591,6 +1608,7 @@ static int hdmi_add_pin(struct hda_codec *codec, hda_nid_t pin_nid) per_pin->pcm_idx = pin_idx; } per_pin->pin_nid_idx = pin_idx; + per_pin->forced_conn_type_val = -1; err = hdmi_read_pin_conn(codec, pin_idx); if (err < 0)