lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Fri,  9 Sep 2016 22:01:35 +0800
From:   Xing Zheng <zhengxing@...k-chips.com>
To:     linux-rockchip@...ts.infradead.org,
        Adam.Thomson.Opensource@...semi.com
Cc:     cychiang@...gle.com, heiko@...ech.de, smbarber@...gle.com,
        hychao@...gle.com, Xing Zheng <zhengxing@...k-chips.com>,
        Support Opensource <support.opensource@...semi.com>,
        Liam Girdwood <lgirdwood@...il.com>,
        Mark Brown <broonie@...nel.org>,
        Jaroslav Kysela <perex@...ex.cz>,
        Takashi Iwai <tiwai@...e.com>, alsa-devel@...a-project.org,
        linux-kernel@...r.kernel.org
Subject: [PATCH] ASoC: da7219: make sure the valid event when startup

We need to ensure the master bias and jack detection to be enabled
before reporting event at the da7219_aad_irq_thread. Otherwise, we
may acquire the incorrect the unplug event when the DUT startup
with a plugged headphone.

Signed-off-by: Xing Zheng <zhengxing@...k-chips.com>
---

 sound/soc/codecs/da7219-aad.c | 7 +++++++
 sound/soc/codecs/da7219-aad.h | 1 +
 2 files changed, 8 insertions(+)

diff --git a/sound/soc/codecs/da7219-aad.c b/sound/soc/codecs/da7219-aad.c
index 4e369a1..cef17c0d 100644
--- a/sound/soc/codecs/da7219-aad.c
+++ b/sound/soc/codecs/da7219-aad.c
@@ -38,6 +38,7 @@ void da7219_aad_jack_det(struct snd_soc_codec *codec, struct snd_soc_jack *jack)
 
 	da7219->aad->jack = jack;
 	da7219->aad->jack_inserted = false;
+	da7219->aad->accdet_en = false;
 
 	/* Send an initial empty report */
 	snd_soc_jack_report(jack, 0, DA7219_AAD_REPORT_ALL_MASK);
@@ -46,6 +47,8 @@ void da7219_aad_jack_det(struct snd_soc_codec *codec, struct snd_soc_jack *jack)
 	snd_soc_update_bits(codec, DA7219_ACCDET_CONFIG_1,
 			    DA7219_ACCDET_EN_MASK,
 			    (jack ? DA7219_ACCDET_EN_MASK : 0));
+
+	da7219->aad->accdet_en = true;
 }
 EXPORT_SYMBOL_GPL(da7219_aad_jack_det);
 
@@ -293,6 +296,10 @@ static irqreturn_t da7219_aad_irq_thread(int irq, void *data)
 	u8 statusa;
 	int i, report = 0, mask = 0;
 
+	/* Ensure the master bias to be enabled */
+	if (!da7219_aad->accdet_en)
+		return IRQ_NONE;
+
 	/* Read current IRQ events */
 	regmap_bulk_read(da7219->regmap, DA7219_ACCDET_IRQ_EVENT_A,
 			 events, DA7219_AAD_IRQ_REG_MAX);
diff --git a/sound/soc/codecs/da7219-aad.h b/sound/soc/codecs/da7219-aad.h
index 4fccf67..5641965 100644
--- a/sound/soc/codecs/da7219-aad.h
+++ b/sound/soc/codecs/da7219-aad.h
@@ -200,6 +200,7 @@ struct da7219_aad_priv {
 
 	struct snd_soc_jack *jack;
 	bool jack_inserted;
+	bool accdet_en;
 };
 
 /* AAD control */
-- 
1.9.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ