Based on the dmesg output you provided, the logs for plug-in and plug-out are completely identical, and no new kernel messages were generated during the physical action. This indicates that the operating system/driver is not receiving or registering any interrupt event at all when you plug or unplug the headset.
Since your custom board has a reversed detection mechanism compared to the EVK board, modifying the polarity in the device tree alone will not work if the hardware state transitions are not triggering the EINT (External Interrupt) engine in the first place.
Please follow below troubleshooting guidelines:
1. Check /proc/interrupts to Verify Hardware Interrupts
Before investigating the driver logic, you must confirm if the hardware interrupt is physically reaching the CPU.
-
Run the following command with the headset unplugged:
cat /proc/interrupts | grep -iE "accdet|pmic|eint"
-
Plug the headset in, and run the command again.
-
Analyze the results:
- Look at the counter column for the accdet/PMIC EINT interrupt line.
- If the count does not increase, the physical voltage transition on the pin is failing to trigger the PMIC interrupt engine.
- If the count increases but nothing happens, the interrupt is firing, but the driver is rejecting it (likely due to debounce settings or state machine mismatch).
2. Measure and Compare Hardware Voltages (Crucial)
The MT6359 PMIC uses internal analog comparators (mediatek,eint-comp-vth) to sense state changes. If your custom board uses different pull-up/pull-down resistors or a reversed jack switch, the voltage levels during plug-in/out might not cross the PMIC’s internal comparator thresholds.
Please use a multimeter to measure the voltage on the HP_DET pin:
| State |
EVK Board Voltage |
Custom Board Voltage |
| Headset Unplugged |
e.g., 1.8V |
Measure this |
| Headset Plugged In |
e.g., 0V |
Measure this |
-
If your Custom Board voltages do not drop/rise cleanly to the threshold levels, the PMIC will never fire an interrupt.
-
Comparator Threshold Configuration:
In your DTS node:
mediatek,eint-comp-vth = <2>;
This value determines the internal reference voltage threshold. If your custom board’s voltage swing is different, you may need to adjust this value or modify your hardware resistor divider to match the EVK voltage levels.
3. Verify Alternative DTS Polarity Properties
MediaTek’s PMIC driver implementations vary significantly across kernel versions (e.g., 4.19, 5.10, 5.15, 6.1). Depending on your specific driver codebase, the driver might ignore mediatek,eint-pol and instead look for other properties.
Search your kernel driver source code (usually located in drivers/misc/mediatek/accdet/ or sound/soc/codecs/mt6359-accdet.c) for the properties it parses, or try adding these common alternative properties to your DTS:
accdet: accdet {
...
/* Try enabling high-level active or low-level active explicitly */
mediatek,hp-eint-high = <1>; // Try 1 or 0
/* Some drivers use this property even when eint-use-ap = <0> */
mediatek,headset-eint-level-pol = <4>; // Try 4 (High-active) or 3 (Low-active)
/* Check if the trigger mode needs to match the inactive-to-active edge */
mediatek,eint-trig-mode = <2>; // 1: falling, 2: rising, 3: high level, 4: low level
...
};
4. Enable Kernel Dynamic Debugging
To see exactly what the mt6359-accdet driver is doing when the state changes, enable dynamic debugging for the accdet driver:
# Enable all debug logs for the accdet driver
echo "file mt6359-accdet.c +p" > /sys/kernel/debug/dynamic_debug/control
# If the file is named differently in your kernel, you can target the module:
echo "module mt6359_accdet +p" > /sys/kernel/debug/dynamic_debug/control
Once enabled, plug and unplug the headset again. You should see detailed prints in dmesg regarding the internal state machine transitions, comparator readings, and debounce timers, which will pinpoint exactly why the driver is rejecting the event.