summaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorJohn Hsu <KCHSU0@nuvoton.com>2016-07-06 10:09:35 +0800
committerMark Brown <broonie@kernel.org>2016-07-14 17:33:19 +0100
commitbff03e81502cb9ac99daeeb47b4d0e779cc48fde (patch)
tree6b9f9fd15b3b8fbe4f5022dd25e220ced681b8f1 /sound
parent4983d32526ab6db2f8bd2288def8abf2da5f37b2 (diff)
downloadlinux-bff03e81502cb9ac99daeeb47b4d0e779cc48fde.tar.bz2
ASoC: nau8825: jack connection decision with different insertion logic
The original design only covers the jack insertion logic is active low. Add more condition to cover no matter the logic is active low and high. Signed-off-by: John Hsu <KCHSU0@nuvoton.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/codecs/nau8825.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/sound/soc/codecs/nau8825.c b/sound/soc/codecs/nau8825.c
index 3f30e6ed210c..a97418deb034 100644
--- a/sound/soc/codecs/nau8825.c
+++ b/sound/soc/codecs/nau8825.c
@@ -1345,10 +1345,17 @@ EXPORT_SYMBOL_GPL(nau8825_enable_jack_detect);
static bool nau8825_is_jack_inserted(struct regmap *regmap)
{
- int status;
+ bool active_high, is_high;
+ int status, jkdet;
+ regmap_read(regmap, NAU8825_REG_JACK_DET_CTRL, &jkdet);
+ active_high = !!(jkdet & NAU8825_JACK_POLARITY);
regmap_read(regmap, NAU8825_REG_I2C_DEVICE_ID, &status);
- return !(status & NAU8825_GPIO2JD1);
+ is_high = !!(status & NAU8825_GPIO2JD1);
+ /* return jack connection status according to jack insertion logic
+ * active high or active low.
+ */
+ return active_high == is_high;
}
static void nau8825_restart_jack_detection(struct regmap *regmap)