Skip to content

Commit bff03e8

Browse files
John-Hsubroonie
authored andcommitted
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 <[email protected]> Signed-off-by: Mark Brown <[email protected]>
1 parent 4983d32 commit bff03e8

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

sound/soc/codecs/nau8825.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1345,10 +1345,17 @@ EXPORT_SYMBOL_GPL(nau8825_enable_jack_detect);
13451345

13461346
static bool nau8825_is_jack_inserted(struct regmap *regmap)
13471347
{
1348-
int status;
1348+
bool active_high, is_high;
1349+
int status, jkdet;
13491350

1351+
regmap_read(regmap, NAU8825_REG_JACK_DET_CTRL, &jkdet);
1352+
active_high = !!(jkdet & NAU8825_JACK_POLARITY);
13501353
regmap_read(regmap, NAU8825_REG_I2C_DEVICE_ID, &status);
1351-
return !(status & NAU8825_GPIO2JD1);
1354+
is_high = !!(status & NAU8825_GPIO2JD1);
1355+
/* return jack connection status according to jack insertion logic
1356+
* active high or active low.
1357+
*/
1358+
return active_high == is_high;
13521359
}
13531360

13541361
static void nau8825_restart_jack_detection(struct regmap *regmap)

0 commit comments

Comments
 (0)