Hi there, We are using the MAX98090 audio codec on a custom i.MX8MP-based board running linux and We are using the in-tree kernel driver (https://github.com/nxp-imx/linux-imx/blob/lf-6.6.y/sound/soc/codecs/max98090.c) to run it. The issue we are facing is with headphone jack detection.
In the MAX98090 codec driver, jack detection appears to work correctly — I can see debug prints when the jack is plugged in or removed. However, when streaming audio using aplay, audio is coming from both the speaker and headphone simultaneously, which is not the desired behavior. Ideally, the speaker should automatically turn off when headphones are connected. We have also observed the same issue with the MAX98091 EVK. However when I change the output path using pactl commands (such as pactl set-sink-port 0 analog-output-headphones and pactl set-sink-port 0 analog-output-speaker) it works as per requirement.
I am wondering if this could be related to ALSA or PulseAudio configuration, or if something is missing from the device tree and kernel side.
For reference, I am attaching the device tree snippet of the and the codec outputs of amixer -c 0 scontrols and pactl list cards command in the attached max-logs.txt file.
Any help would be appreciated!
DTS Snipppet:
sound-max98090 {
compatible = "simple-audio-card";
simple-audio-card,name = "max98090-audio";
simple-audio-card,format = "i2s";
simple-audio-card,frame-master = <&cpudai>;
simple-audio-card,bitclock-master = <&cpudai>;
simple-audio-card,bitclock-inversion;
simple-audio-card,widgets =
"Microphone", "Mic Jack",
"Speakers", "Speakers",
"Line", "Line In",
"Line", "Line Out",
"Headphone", "Headphone Jack";
simple-audio-card,routing =
"Headphone Jack", "HPL",
"Headphone Jack", "HPR",
"Line Out", "RCVL",
"Line Out", "RCVR",
/* Uncomment any of these below lines if the Line Input(s) is(are) used else leave it as such. */
"IN1","Line In",
"IN2","Line In",
"IN5", "Line In", /* IN1/IN2/IN3/IN4/IN6 (For single-ended input) */
"IN34", "Line In", /* IN34 (For differential inputs) */
"IN56", "Line In", /* IN34 (For differential inputs) */
"MIC1", "Mic Jack",
"MIC2", "Mic Jack",
"Mic Jack", "MICBIAS",
"IN1", "MICBIAS",
"MIC1","IN1",
"MIC2","IN1",
"Speakers", "SPKL",
"Speakers", "SPKR",
/* DMIC-3 Routings */
"DMICL", "DMIC Mux",
"DMIC Mux", "DMIC3",
"DMIC3", "DMIC3_ENA",
"DMIC3", "AHPF",
/* DMIC-4 Routings */
"DMICR", "DMIC Mux",
"DMIC Mux", "DMIC4",
"DMIC4", "DMIC4_ENA",
"DMIC3", "AHPF",
"DMIC4", "AHPF",
"HiFi Capture", "DMICL",
"HiFi Capture", "DMICR";
cpudai: simple-audio-card,cpu {
sound-dai = <&sai3>;
dai-tdm-slot-num = <2>;
};
simple-audio-card,codec {
sound-dai = <&max98090>;
clocks = <&audio_blk_ctrl IMX8MP_CLK_AUDIOMIX_SAI3_MCLK1>;
};
};
&i2c4 {
clock-frequency = <400000>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_i2c4>;
status = "okay";
max98090: max98090@10 {
#sound-dai-cells = <0>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_sai3>;
compatible = "maxim,max98091";
reg = <0x10>;
clocks = <&clk IMX8MP_CLK_SAI3_ROOT>;
interrupt-parent = <&gpio1>;
interrupts = <8 IRQ_TYPE_LEVEL_LOW>; /* NC from HW side */
clock-names = "mclk";
};
};
&sai3 {
#sound-dai-cells = <0>;
assigned-clocks = <&clk IMX8MP_AUDIO_PLL2_OUT>, <&clk IMX8MP_CLK_SAI3>;
assigned-clock-parents = <&clk IMX8MP_AUDIO_PLL2_OUT>, <&clk IMX8MP_AUDIO_PLL2_OUT>;
assigned-clock-rates = <361267200>,<11289600>;
fsl,sai-mclk-direction-output;
status = "okay";
};
/*********** Output of amixer -c 0 scontrols **************/
root@imx8mp-lpddr4-evk:/root# amixer -c 0 scontrols
Simple mixer control 'Headphone',0
Simple mixer control 'Headphone Left',0
Simple mixer control 'Headphone Left Mixer',0
Simple mixer control 'Headphone Right',0
Simple mixer control 'Headphone Right Mixer',0
Simple mixer control 'Speaker',0
Simple mixer control 'Speaker Left',0
Simple mixer control 'Speaker Left Mixer',0
Simple mixer control 'Speaker Right',0
Simple mixer control 'Speaker Right Mixer',0
Simple mixer control 'Playback Path DC Blocking',0
Simple mixer control 'ADC High Performance Mode',0
Simple mixer control 'ADC Oversampling Rate',0
Simple mixer control 'ADC Quantizer Dither',0
Simple mixer control 'ADCL',0
Simple mixer control 'ADCL Boost',0
Simple mixer control 'ADCR',0
Simple mixer control 'ADCR Boost',0
Simple mixer control 'ALC Attack Time',0
Simple mixer control 'ALC Compression Ratio',0
Simple mixer control 'ALC Compression Threshold',0
Simple mixer control 'ALC Enable',0
Simple mixer control 'ALC Expansion Ratio',0
Simple mixer control 'ALC Expansion Threshold',0
Simple mixer control 'ALC Make Up',0
Simple mixer control 'ALC Release Time',0
Simple mixer control 'Biquad',0
Simple mixer control 'DAC HP Playback Performance Mode',0
Simple mixer control 'DAC High Performance Mode',0
Simple mixer control 'DAC Mono Mode',0
Simple mixer control 'DMIC MIC Comp Filter Config',0
Simple mixer control 'DMIC Mux',0
Simple mixer control 'DMIC3',0
Simple mixer control 'DMIC3 Boost',0
Simple mixer control 'DMIC34 BQ PreAttenuation',0
Simple mixer control 'DMIC34 Biquad',0
Simple mixer control 'DMIC34 DC Blocking',0
Simple mixer control 'DMIC34 Zeropad',0
Simple mixer control 'DMIC4',0
Simple mixer control 'DMIC4 Boost',0
Simple mixer control 'Digital',0
Simple mixer control 'Digital BQ',0
Simple mixer control 'Digital Coarse',0
Simple mixer control 'Digital EQ',0
Simple mixer control 'Digital EQ 3 Band',0
Simple mixer control 'Digital EQ 5 Band',0
Simple mixer control 'Digital EQ 7 Band',0
Simple mixer control 'Digital EQ Clipping Detection',0
Simple mixer control 'Digital Sidetone',0
Simple mixer control 'Enhanced Vol Smoothing',0
Simple mixer control 'Filter DMIC34 Mode',0
Simple mixer control 'Filter Mode',0
Simple mixer control 'LBENL Mux',0
Simple mixer control 'LBENR Mux',0
Simple mixer control 'LINEA',0
Simple mixer control 'LINEA Ext Resistor Gain Mode',0
Simple mixer control 'LINEA Mixer IN1',0
Simple mixer control 'LINEA Mixer IN3',0
Simple mixer control 'LINEA Mixer IN34',0
Simple mixer control 'LINEA Mixer IN5',0
Simple mixer control 'LINEA Single Ended',0
Simple mixer control 'LINEB',0
Simple mixer control 'LINEB Ext Resistor Gain Mode',0
Simple mixer control 'LINEB Mixer IN2',0
Simple mixer control 'LINEB Mixer IN4',0
Simple mixer control 'LINEB Mixer IN56',0
Simple mixer control 'LINEB Mixer IN6',0
Simple mixer control 'LINEB Single Ended',0
Simple mixer control 'LINMOD Mux',0
Simple mixer control 'LTENL Mux',0
Simple mixer control 'LTENR Mux',0
Simple mixer control 'Left ADC Mixer IN12',0
Simple mixer control 'Left ADC Mixer IN34',0
Simple mixer control 'Left ADC Mixer IN56',0
Simple mixer control 'Left ADC Mixer LINEA',0
Simple mixer control 'Left ADC Mixer LINEB',0
Simple mixer control 'Left ADC Mixer MIC1',0
Simple mixer control 'Left ADC Mixer MIC2',0
Simple mixer control 'Left Headphone Mixer LINEA',0
Simple mixer control 'Left Headphone Mixer LINEB',0
Simple mixer control 'Left Headphone Mixer Left DAC',0
Simple mixer control 'Left Headphone Mixer MIC1',0
Simple mixer control 'Left Headphone Mixer MIC2',0
Simple mixer control 'Left Headphone Mixer Right DAC',0
Simple mixer control 'Left Receiver Mixer LINEA',0
Simple mixer control 'Left Receiver Mixer LINEB',0
Simple mixer control 'Left Receiver Mixer Left DAC',0
Simple mixer control 'Left Receiver Mixer MIC1',0
Simple mixer control 'Left Receiver Mixer MIC2',0
Simple mixer control 'Left Receiver Mixer Right DAC',0
Simple mixer control 'Left Speaker Mixer LINEA',0
Simple mixer control 'Left Speaker Mixer LINEB',0
Simple mixer control 'Left Speaker Mixer Left DAC',0
Simple mixer control 'Left Speaker Mixer MIC1',0
Simple mixer control 'Left Speaker Mixer MIC2',0
Simple mixer control 'Left Speaker Mixer Right DAC',0
Simple mixer control 'MIC Bias VCM Bandgap',0
Simple mixer control 'MIC1',0
Simple mixer control 'MIC1 Boost',0
Simple mixer control 'MIC1 Mux',0
Simple mixer control 'MIC2',0
Simple mixer control 'MIC2 Boost',0
Simple mixer control 'MIC2 Mux',0
Simple mixer control 'MIXHPLSEL Mux',0
Simple mixer control 'MIXHPRSEL Mux',0
Simple mixer control 'Receiver',0
Simple mixer control 'Receiver Left',0
Simple mixer control 'Receiver Left Mixer',0
Simple mixer control 'Receiver Right',0
Simple mixer control 'Receiver Right Mixer',0
Simple mixer control 'Record Path DC Blocking',0
Simple mixer control 'Right ADC Mixer IN12',0
Simple mixer control 'Right ADC Mixer IN34',0
Simple mixer control 'Right ADC Mixer IN56',0
Simple mixer control 'Right ADC Mixer LINEA',0
Simple mixer control 'Right ADC Mixer LINEB',0
Simple mixer control 'Right ADC Mixer MIC1',0
Simple mixer control 'Right ADC Mixer MIC2',0
Simple mixer control 'Right Headphone Mixer LINEA',0
Simple mixer control 'Right Headphone Mixer LINEB',0
Simple mixer control 'Right Headphone Mixer Left DAC',0
Simple mixer control 'Right Headphone Mixer MIC1',0
Simple mixer control 'Right Headphone Mixer MIC2',0
Simple mixer control 'Right Headphone Mixer Right DAC',0
Simple mixer control 'Right Receiver Mixer LINEA',0
Simple mixer control 'Right Receiver Mixer LINEB',0
Simple mixer control 'Right Receiver Mixer Left DAC',0
Simple mixer control 'Right Receiver Mixer MIC1',0
Simple mixer control 'Right Receiver Mixer MIC2',0
Simple mixer control 'Right Receiver Mixer Right DAC',0
Simple mixer control 'Right Speaker Mixer LINEA',0
Simple mixer control 'Right Speaker Mixer LINEB',0
Simple mixer control 'Right Speaker Mixer Left DAC',0
Simple mixer control 'Right Speaker Mixer MIC1',0
Simple mixer control 'Right Speaker Mixer MIC2',0
Simple mixer control 'Right Speaker Mixer Right DAC',0
Simple mixer control 'SDIN Mode',0
Simple mixer control 'SDOUT Hi-Z Mode',0
Simple mixer control 'SDOUT Mode',0
Simple mixer control 'STENL Mux',0
Simple mixer control 'STENR Mux',0
Simple mixer control 'Volume Adjustment Smoothing',0
Simple mixer control 'Zero-Crossing Detection',0
/************ Output from pactl list cards ************/
root@imx8mp-lpddr4-evk:/root# pactl list cards
Card #0
Name: alsa_card.platform-sound-max98090
Driver: module-alsa-card.c
Owner Module: 18
Properties:
alsa.card = "0"
alsa.card_name = "max98090-audio"
alsa.long_card_name = "max98090-audio"
device.bus_path = "platform-sound-max98090"
sysfs.path = "/devices/platform/sound-max98090/sound/card0"
device.form_factor = "internal"
device.string = "0"
device.description = "Built-in Audio"
module-udev-detect.discovered = "1"
device.icon_name = "audio-card"
Profiles:
input:stereo-fallback: Stereo Input (sinks: 0, sources: 1, priority: 51, available: yes)
output:stereo-fallback: Stereo Output (sinks: 1, sources: 0, priority: 5100, available: yes)
output:stereo-fallback+input:stereo-fallback: Stereo Output + Stereo Input (sinks: 1, sources: 1, priority
: 5151, available: yes)
off: Off (sinks: 0, sources: 0, priority: 0, available: yes)
Active Profile: output:stereo-fallback+input:stereo-fallback
Ports:
analog-input: Analog Input (type: Analog, priority: 10000, latency offset: 0 usec, availability unknown)
Part of profile(s): input:stereo-fallback, output:stereo-fallback+input:stereo-fallback
analog-output-speaker: Speakers (type: Speaker, priority: 10000, latency offset: 0 usec, availability unkn
own)
Properties:
device.icon_name = "audio-speakers"
Part of profile(s): output:stereo-fallback, output:stereo-fallback+input:stereo-fallback
analog-output-headphones: Headphones (type: Headphones, priority: 9900, latency offset: 0 usec, availabili
ty unknown)
Properties:
device.icon_name = "audio-headphones"
Part of profile(s): output:stereo-fallback, output:stereo-fallback+input:stereo-fallback