I’m porting the audio jack functionality using the RT5640 codec. Currently, the RT5640 can detect when my audio jack is plugged in and unplugged. I’ve observed that the snd_soc_jack_report function in rt5640_jack_work sends a SND_JACK_HEADSET event:
How can I change the amixer configuration when the audio jack is plugged in and unplugged? I know there’s a 02-tegra-rt5640.conf file that sets up the default amixer configuration. However, it doesn’t seem to change the amixer settings based on the SND_JACK_HEADSET event.
I don’t see any headset or headphone icon after plugging in the audio jack. Where can I implement this icon?
I am trying to capture the event using udevadm monitor, but no actions related to SND_JACK_HEADSET are being detected.
I also executed the command udevadm info -a /dev/snd/controlC1 (which is the APE card) to check for any action associated with SND_JACK_HEADSET. It appears that snd_soc_jack_report in the rt5640 driver might not be registered.
I finally found a path which can let me check headset is inserted or not. BTW, my codec is rt5640. And I choose the IN1N to be my jack detection pin.
I found there is a platform-sound-event under /dev/input/by-path/
You can use evteset to see what the information comes out when jack is being inserted or removed.
ubuntu@tegra-ubuntu:~$ sudo evtest /dev/input/by-path/platform-sound-event
Input driver version is 1.0.1
Input device ID: bus 0x0 vendor 0x0 product 0x0 version 0x0
Input device name: “NVIDIA Jetson Orin NX APE Headset Jack”
Supported events:
Event type 0 (EV_SYN)
Event type 1 (EV_KEY)
Event code 114 (KEY_VOLUMEDOWN)
Event code 115 (KEY_VOLUMEUP)
Event code 226 (KEY_MEDIA)
Event type 5 (EV_SW)
Event code 2 (SW_HEADPHONE_INSERT) state 0
Event code 4 (SW_MICROPHONE_INSERT) state 0
Properties:
Testing … (interrupt to exit)
Event: time 1746498138.944255, type 5 (EV_SW), code 4 (SW_MICROPHONE_INSERT), value 1
Event: time 1746498138.944255, -------------- SYN_REPORT ------------
Event: time 1746498141.955757, type 5 (EV_SW), code 4 (SW_MICROPHONE_INSERT), value 0
Event: time 1746498141.955757, -------------- SYN_REPORT ------------
So now you can make a C application/service to monitor the platform-sound-event to change amixer’s configuration or else…
Talking about the headset icon, I don’t need this feature. So no more suggestion from here.