Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bff03e81 authored by John Hsu's avatar John Hsu Committed by Mark Brown
Browse files

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: default avatarJohn Hsu <KCHSU0@nuvoton.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 4983d325
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -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)