Skip to content

Commit

Permalink
ASoC: cs42l84: Double tip and ring sense debounce timings
Browse files Browse the repository at this point in the history
There are user reports of unreliable headset detection on Macbooks with
cs42l84 jack codecs like in #294. One way to reproduce this is to insert
a headset jack not fully but only until tip sense tiggers. The
headset/mic detection fails and is not retried once the jack is fully
inserted.
This might not be related to the issue the user sees. Another
possiblility is that the headset detection parameters / algorithm
differs from macos and doesn't detect this particular headset reliably.

Signed-off-by: Janne Grunau <[email protected]>
  • Loading branch information
jannau committed Oct 3, 2024
1 parent fca8dbb commit 9600181
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
8 changes: 4 additions & 4 deletions sound/soc/codecs/cs42l84.c
Original file line number Diff line number Diff line change
Expand Up @@ -906,14 +906,14 @@ static void cs42l84_setup_plug_detect(struct cs42l84_private *cs42l84)
CS42L84_RING_SENSE_CTL_INV | CS42L84_RING_SENSE_CTL_UNK1 |
CS42L84_RING_SENSE_CTL_RISETIME | CS42L84_RING_SENSE_CTL_FALLTIME,
CS42L84_RING_SENSE_CTL_INV | CS42L84_RING_SENSE_CTL_UNK1 |
FIELD_PREP(CS42L84_RING_SENSE_CTL_RISETIME, CS42L84_DEBOUNCE_TIME_125MS) |
FIELD_PREP(CS42L84_RING_SENSE_CTL_FALLTIME, CS42L84_DEBOUNCE_TIME_125MS));
FIELD_PREP(CS42L84_RING_SENSE_CTL_RISETIME, CS42L84_DEBOUNCE_TIME_250MS) |
FIELD_PREP(CS42L84_RING_SENSE_CTL_FALLTIME, CS42L84_DEBOUNCE_TIME_250MS));
regmap_update_bits(cs42l84->regmap, CS42L84_TIP_SENSE_CTL,
CS42L84_TIP_SENSE_CTL_INV |
CS42L84_TIP_SENSE_CTL_RISETIME | CS42L84_TIP_SENSE_CTL_FALLTIME,
CS42L84_TIP_SENSE_CTL_INV |
FIELD_PREP(CS42L84_TIP_SENSE_CTL_RISETIME, CS42L84_DEBOUNCE_TIME_500MS) |
FIELD_PREP(CS42L84_TIP_SENSE_CTL_FALLTIME, CS42L84_DEBOUNCE_TIME_125MS));
FIELD_PREP(CS42L84_TIP_SENSE_CTL_RISETIME, CS42L84_DEBOUNCE_TIME_1000MS) |
FIELD_PREP(CS42L84_TIP_SENSE_CTL_FALLTIME, CS42L84_DEBOUNCE_TIME_250MS));
regmap_update_bits(cs42l84->regmap, CS42L84_MSM_BLOCK_EN3,
CS42L84_MSM_BLOCK_EN3_TR_SENSE,
CS42L84_MSM_BLOCK_EN3_TR_SENSE);
Expand Down
3 changes: 3 additions & 0 deletions sound/soc/codecs/cs42l84.h
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,10 @@
#define CS42L84_ASP_TX_CH2_WIDTH 0x506e

#define CS42L84_DEBOUNCE_TIME_125MS 0b001
#define CS42L84_DEBOUNCE_TIME_250MS 0b010
#define CS42L84_DEBOUNCE_TIME_500MS 0b011
#define CS42L84_DEBOUNCE_TIME_750MS 0b100
#define CS42L84_DEBOUNCE_TIME_1000MS 0b101

#define CS42L84_BOOT_TIME_US 3000
#define CS42L84_CLOCK_SWITCH_DELAY_US 150
Expand Down

0 comments on commit 9600181

Please sign in to comment.