This is an 1/8 inch TRRS jack, where:
Tip | Left channel out |
Ring1 | Right channel out |
Ring2 | Ground |
Sleeve | Mic in |
The mic input has a bias voltage of approximately 2 V on it. There are also capacitors connected internally, so this is essential AC-coupled.
I put a transistor there (2N3904) biassed from this, and with 100 k between C-B, then feeding a signal to B via 4.7 microfarads, show a full-scale sensitivity there of about 1 mV peak-peak.
To make this work, we need to have some modules loaded, put the following into a file named /etc/modules-load.d/pine64-audiojack.conf
sunxi_codec sunxi_i2s sunxi_sndcodec
Then we also need to have some items added to the file /var/lib/alsa/asound.state
This was based on the info in two posts in the forum: https://forum.pine64.org/showthread.php?tid=807 and https://forum.pine64.org/showthread.php?tid=4413&highlight=mic+input
With the modules and this state file in place, the device hw:1,0 can be opened and read and will receive the signal coming in through the microphone wire.
This requires the libasound-dev packages:
apt-get install libasound2-dev libasound2-doc
The sound system has two output devices, or cards, one sends audio out via HDMI, this card is called sndhdmi and the other is through this headphone jack, which is called audiocodec. The PulseAudio system calls these "sinks", and in order to tell which they are, the commands
pactl list sinks pactl list short sinks
will do.
Each of these sinks have a (rather long) name, (such as alsa_output.platform-sound.6.analog-stereo ) and the long listing also shows index number (Sink #0 and so on) The long listing also shows which is which of these and their underlying output devices. Then we can see settings such as which one is set as default, whether it is muted, and volume settings; so in order to to change this, the following pactl commands will do:
pactl set-default-sink 0
This sets the default sink to the one shown as Sink #0 in the long listing.
pactl set-sink-mute 1 1
This will mute (turn off) the Sink #1
pactl set-sink-mute 0 0
This will un-mute (turn on) the Sink #0
Through this mechanism we can decide which channel to be used where.