All of lore.kernel.org
 help / color / mirror / Atom feed
From: libin.yang@intel.com
To: alsa-devel@alsa-project.org
Cc: tiwai@suse.de, libin.yang@intel.com, broonie@kernel.org,
	pierre-louis.bossart@linux.intel.com
Subject: [RFC PATCH 1/4] ASoC: hdac_hdmi: amixer kctl setting should not impact on jack status
Date: Mon, 27 May 2019 17:07:24 +0800	[thread overview]
Message-ID: <1558948047-18930-2-git-send-email-libin.yang@intel.com> (raw)
In-Reply-To: <1558948047-18930-1-git-send-email-libin.yang@intel.com>

From: Libin Yang <libin.yang@intel.com>

Amixer kctl setting should not impact on the jack connection status.
In hdac_hdmi_present_sense(), it will call hdac_hdmi_jack_report() to
report the monitor connection status. This means the jack status represents
the HDMI monitor connection status.

However, in the original code, hdac_hdmi_set_pin_port_mux() will also
call hdac_hdmi_jack_report() when "pinx-porty Mux" setting is changed. This
means the kctl setting will also impact on the jack status regardless of
the monitor connection. This will introduce some troubles. For example,
assuming the original amixer setting is:
"pin5-port0 Mux" is set "cvt 2"
"pin5-port1 Mux" is set "cvt 2"
HDMI uses pin5 and HDMI is connected to the machine.
After booting the system, setting "pin5-port1 Mux" to "NONE" will
trigger hdac_hdmi_set_pin_port_mux() calling hdac_hdmi_jack_report(false)
In this situation, user space will get the wrong status.

This patch removes calling hdac_hdmi_jack_report() in
hdac_hdmi_set_pin_port_mux(). This makes jack status always represents
the monitor connection status.

Signed-off-by: Libin Yang <libin.yang@intel.com>
---
 sound/soc/codecs/hdac_hdmi.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/sound/soc/codecs/hdac_hdmi.c b/sound/soc/codecs/hdac_hdmi.c
index 660e058..5a9e7f9 100644
--- a/sound/soc/codecs/hdac_hdmi.c
+++ b/sound/soc/codecs/hdac_hdmi.c
@@ -855,7 +855,6 @@ static int hdac_hdmi_pin_mux_widget_event(struct snd_soc_dapm_widget *w,
 static int hdac_hdmi_set_pin_port_mux(struct snd_kcontrol *kcontrol,
 		struct snd_ctl_elem_value *ucontrol)
 {
-	int ret;
 	struct hdac_hdmi_port *p, *p_next;
 	struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
 	struct snd_soc_dapm_widget *w = snd_soc_dapm_kcontrol_widget(kcontrol);
@@ -865,6 +864,7 @@ static int hdac_hdmi_set_pin_port_mux(struct snd_kcontrol *kcontrol,
 	struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev);
 	struct hdac_hdmi_pcm *pcm = NULL;
 	const char *cvt_name =  e->texts[ucontrol->value.enumerated.item[0]];
+	int ret;
 
 	ret = snd_soc_dapm_put_enum_double(kcontrol, ucontrol);
 	if (ret < 0)
@@ -880,10 +880,8 @@ static int hdac_hdmi_set_pin_port_mux(struct snd_kcontrol *kcontrol,
 
 		list_for_each_entry_safe(p, p_next, &pcm->port_list, head) {
 			if (p == port && p->id == port->id &&
-					p->pin == port->pin) {
-				hdac_hdmi_jack_report(pcm, port, false);
+			    p->pin == port->pin)
 				list_del(&p->head);
-			}
 		}
 	}
 
@@ -895,7 +893,6 @@ static int hdac_hdmi_set_pin_port_mux(struct snd_kcontrol *kcontrol,
 		if (!strcmp(cvt_name, pcm->cvt->name)) {
 			list_add_tail(&port->head, &pcm->port_list);
 			if (port->eld.monitor_present && port->eld.eld_valid) {
-				hdac_hdmi_jack_report(pcm, port, true);
 				mutex_unlock(&hdmi->pin_mutex);
 				return ret;
 			}
-- 
2.7.4

  reply	other threads:[~2019-05-27  9:27 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-27  9:07 [RFC PATCH 0/4] ASoC: hdac_hdmi: refine the hdac_hdmi jacks libin.yang
2019-05-27  9:07 ` libin.yang [this message]
2019-05-27  9:07 ` [RFC PATCH 2/4] ASoC: hdac_hdmi: jack_event represents the status libin.yang
2019-05-27  9:07 ` [RFC PATCH 3/4] ASoC: hdac_hdmi: refine hdmi jacks libin.yang
2019-05-30  7:13   ` Takashi Iwai
2019-05-30 15:00     ` Yang, Libin
2019-05-30 15:22       ` Takashi Iwai
2019-05-31  2:27         ` Yang, Libin
2019-06-14  8:04           ` Yang, Libin
2019-06-25  6:02             ` Yang, Libin
2019-06-25 11:05               ` Takashi Iwai
2019-06-25 11:41                 ` Hui Wang
2019-06-27  6:38                   ` Takashi Iwai
2019-06-27  1:46                 ` Yang, Libin
2019-05-27  9:07 ` [RFC PATCH 4/4] ASoC: hdac_hdmi: fix some coding style issue libin.yang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1558948047-18930-2-git-send-email-libin.yang@intel.com \
    --to=libin.yang@intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.