[alsa-devel] [RFC PATCH 2/4] ASoC: hdac_hdmi: jack_event represents the status

libin.yang at intel.com libin.yang at intel.com
Mon May 27 11:07:25 CEST 2019


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

As jack status represents the monitor connected or not, it represents
a status. So it should not be used as a counter. If driver receives
a monitor disconnection event, it should report this disconnection event
to userspace. For example, if the monitor connection event is sent to
driver twice (this should not happen, but in case there is some mistake),
when driver receives monitor disconnection event, it should still send the
disconnection event to user space.

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

diff --git a/sound/soc/codecs/hdac_hdmi.c b/sound/soc/codecs/hdac_hdmi.c
index 5a9e7f9..90c2ee3 100644
--- a/sound/soc/codecs/hdac_hdmi.c
+++ b/sound/soc/codecs/hdac_hdmi.c
@@ -177,11 +177,6 @@ static void hdac_hdmi_jack_report(struct hdac_hdmi_pcm *pcm,
 		snd_soc_dapm_disable_pin(port->dapm, port->jack_pin);
 
 	if (is_connect) {
-		/*
-		 * Report Jack connect event when a device is connected
-		 * for the first time where same PCM is attached to multiple
-		 * ports.
-		 */
 		if (pcm->jack_event == 0) {
 			dev_dbg(&hdev->dev,
 					"jack report for pcm=%d\n",
@@ -189,17 +184,11 @@ static void hdac_hdmi_jack_report(struct hdac_hdmi_pcm *pcm,
 			snd_soc_jack_report(pcm->jack, SND_JACK_AVOUT,
 						SND_JACK_AVOUT);
 		}
-		pcm->jack_event++;
+		pcm->jack_event = 1;
 	} else {
-		/*
-		 * Report Jack disconnect event when a device is disconnected
-		 * is the only last connected device when same PCM is attached
-		 * to multiple ports.
-		 */
 		if (pcm->jack_event == 1)
 			snd_soc_jack_report(pcm->jack, 0, SND_JACK_AVOUT);
-		if (pcm->jack_event > 0)
-			pcm->jack_event--;
+		pcm->jack_event = 0;
 	}
 
 	snd_soc_dapm_sync(port->dapm);
-- 
2.7.4



More information about the Alsa-devel mailing list