.. include:: /keyword.rst =========== |G1200-EVK| =========== .. contents:: Sections :local: :depth: 2 Overview -------- On |G1200-EVK|, there are 4 playback hardware and 4 capture hardware. .. figure:: /_asset/sw_rity_app-dev_audio_evk_afe_g1200.svg :align: center :scale: 100% |G1200-EVK| audio data route diagram .. table:: Definitions of data pin channels ================= ================== Data Pin Name Number of Channels ================= ================== DMIC1_DAT 2 PCM_DO 2 PCM_DI 2 I2SIN_D0 2 I2SO2_D[0-3] 2 AUD_DAT_MOSI[0-1] 1 AUD_DAT_MISO[0-1] 1 AUD_DAT_MISO2 1 HDMITX 8 DPTX 8 HDMIRX 8 AU_HPL 1 AU_HPR 1 AU_LOL 1 AU_VIN1 1 AU_VIN0 1 AU_VIN2 1 AU_VIN3 1 ================= ================== - Playback - Earphone-Out Jack - Speaker-Out Jack - PCM Out - HDMI/DP Audio Out - Capture - PCM In - Earphone-In Jack - AMIC In - DMIC In - HDMI Rx |G1200-EVK| board provides a 3.5mm Earphone jack which has both playback and capture functions. Another 3.5mm Speaker jack for line out which has no built-in audio amplifier. PCM interface is used for the transmission of audio-digital signals. |G1200-EVK| board was designed with three analog microphones and two digital microphones. The |G1200-EVK| does not have I2S pins, and it also does not support I2S feature. If the user wishes to use I2S with the |G1200-EVK|, they will need to perform additional configuration work on their board. For more details, please refer to the I2S porting guide. Furthermore, the |G1200-EVK| supports HDMI RX. For the position of the earphone jack, speaker jack, HDMI/DP port, DMIC, and AMIC, please refer to :ref:`Board Top View `. .. figure:: /_asset/sw_rity_app-dev_audio_evk_route-g1200-2.svg :align: center :scale: 20% The route between the hardware and the device nodes - ``pcmC0D0p`` plays the sound to ``Earphone-Out Jack`` or ``Speaker-Out Jack``. - ``pcmC0D2p`` plays the sound to ``PCM Out``. - ``pcmC0D5p`` plays the sound to either ``HDMI Audio Out`` or ``DP Audio Out``. - ``pcmC0D7c`` records the voice from ``HDMI Rx``. - ``pcmC0D8c`` records the voice from ``PCM In``. - ``pcmC0D10c`` records the voice from ``Earphone-In Jack``. - ``pcmC0D14c`` records the voice from ``DMIC In``. - ``pcmC0D15c`` records the voice from ``AMIC In``. Audio Interfaces ---------------- The audio system provides audio data exchange between the device and external audio components. Audio interfaces play a crucial role in enabling high-quality sound recording and playback. This section aims to offer a thorough guide to the integrated audio interface on the EVK. The following table will detail the interfaces accessible on the |G1200-EVK|, and specify if the software is supported. .. csv-table:: Genio 1200-EVK Audio Interfaces :file: /_asset/tables/audio-g1200-interfaces.csv :width: 70% :header-rows: 1 .. note:: For information about if the software is supported, please refer to the :ref:`release notes `. .. csv-table:: MT6365 Audio CODEC Interfaces on Genio 1200-EVK :file: /_asset/tables/audio-mt6365-g1200-interfaces.csv :width: 50% :header-rows: 1 Playback -------- Earphone Jack Speaker ^^^^^^^^^^^^^^^^^^^^^ By default, the |G1200-EVK| board plays the audio to the earphone jack speaker. Run the provided command to verify that the sound output is coming from the earphone jack: .. prompt:: bash # auto # amixer -c mt8395evk cset name='HP Mux' 'Audio Playback' Please make sure to set ``LOL Mux`` to open before using the earphone jack. Otherwise, there will be noise when playing music. You can use ``aplay`` to play the music through the earphone jack. ``aplay`` is a command-line sound file player for the ALSA sound card driver. For more details about ``aplay``, please refer to `aplay `_. .. prompt:: bash # auto # aplay -D jack_speaker sample.wav You can adjust the gain of the earphone jack. The range of the value is from **0 to 30**. The value **0** represents the maximum volume and the value **30** represents the minimum volume. Use the following command to control the volume: .. prompt:: bash # auto # amixer -c mt8395evk cset name='Headset Volume' 30 # amixer -c mt8395evk cset name='Headset Volume' 0 Speaker Jack Speaker ^^^^^^^^^^^^^^^^^^^^ The default setting of ``HP Mux`` works for earphone jack playback. ``HP Mux`` is a mixer switch for the earphone jack and speaker jack. It has 5 cases in ``HP Mux``: - Item #0 ``Open`` - Item #1 ``LoudSPK Playback`` - Item #2 ``Audio Playback`` - Item #3 ``Test Mode`` - Item #4 ``HP Impedance`` You should set ``HP Mux`` ``Open`` when using speaker jack playback. .. prompt:: bash # auto # amixer -c mt8395evk cset name='HP Mux' 'Open' # amixer -c mt8395evk cset name='LOL Mux' 'Playback_L_DAC' Please make sure to set ``HP Mux`` to open before using the speaker jack. Otherwise, there will be noise when playing music. Use ``aplay`` to play the music through the speaker jack. .. prompt:: bash # auto # aplay -D jack_speaker sample.wav PCM Out ^^^^^^^ Use ``aplay`` to play the music through the PCM interface. .. prompt:: bash # auto # aplay -D pcm_out sample.wav HDMI/DP Speaker ^^^^^^^^^^^^^^^ - Only HDMI playback To enable audio playback from a HDMI device, please first enable the ``HDMI_OUT_MUX``. .. prompt:: bash # auto # amixer -c mt8395evk cset name='HDMI_OUT_MUX' on # amixer -c mt8395evk cset name='DPTX_OUT_MUX' off After using it, turn off the ``HDMI_OUT_MUX``. .. prompt:: bash # auto # amixer -c mt8395evk cset name='HDMI_OUT_MUX' off Use ``aplay`` to play the music via an HDMI device. .. prompt:: bash # auto # aplay -D hdmi_dp_out sample.wav - Only DP playback The default configuration for |G1200-EVK| is to enable HDMI and disable DP. If you want to use DP audio, you need to load the dtbo file to enable DP. To enable audio playback from a DP device, please first enable the ``DPTX_OUT_ MUX``. .. prompt:: bash # auto # amixer -c mt8395evk cset name='DPTX_OUT_MUX' on # amixer -c mt8395evk cset name='HDMI_OUT_MUX' off After using it, turn off the ``DPTX_OUT_MUX``. .. prompt:: bash # auto # amixer -c mt8395evk cset name='DPTX_OUT_MUX' off Use ``aplay`` to play the music via the DP device. .. prompt:: bash # auto # aplay -D hdmi_dp_out sample.wav - HDMI + DP playback If you want to use HDMI and DP devices at the same time, remember to load the ``display-hdmidp.dtbo`` file and enable both the ``HDMI_OUT_MUX`` and ``DPTX_OUT_MUX``. .. prompt:: bash # auto # amixer -c mt8395evk cset name='HDMI_OUT_MUX' on # amixer -c mt8395evk cset name='DPTX_OUT_MUX' on .. warning:: When there are no HDMI or DP devices connected to the platform, the corresponding MUX should be set to off. Capture ------- PCM In ^^^^^^ To record voice through the PCM interface, use the following command. The recorded file will be named sample.wav. .. prompt:: bash # auto # arecord -D pcm_in -c 2 -r 48000 -f S32_LE -d 10 sample.wav Earphone Jack Microphone ^^^^^^^^^^^^^^^^^^^^^^^^ By default, the |G1200-EVK| board records the voice from the earphone jack microphone. The default setting of ``PGA_L_Mux``: ``AIN1`` is used for headset recording, but ``PGA_L_Mux`` is also used by AMIC. Run the following command to set the ``PGA_L_Mux``: .. prompt:: bash # auto # amixer -c mt8395evk cset name='PGA_L_Mux' 'AIN1' The range of the Headset volume value from small to loud is 0 to 4. .. prompt:: bash # auto # amixer -c mt8395evk cset name='PGA1 Volume' 3 The following command is an example that will start a mono record with a 48KHz sampling rate and signed 32-bit format: .. prompt:: bash # auto # arecord -D jack_mic -r 48000 -f S32_LE -d 10 sample.wav Digital Microphone ^^^^^^^^^^^^^^^^^^ You can record the voice from the DMIC port. Here is an example command that records a 10-second file named sample.wav using DMIC: .. prompt:: bash # auto # arecord -D dmic -c 2 -r 48000 -f S32_LE -d 10 sample.wav Analog Microphone ^^^^^^^^^^^^^^^^^ To record voice from the AMIC port, you should change the default setting of ``PGA_L_Mux`` from ``AIN1`` to ``AIN0``. .. prompt:: bash # auto # amixer -c mt8395evk cset name='PGA_L_Mux' 'AIN0' There are three analog microphones on |G1200-EVK|, remember to set the ``MISO1_MUX``. .. prompt:: bash # auto # amixer -c mt8395evk cset name='MISO1_MUX' 'UL1_CH2' The range of the AMIC volume value from small to loud is 0 to 4. Volume setting: .. prompt:: bash # auto # amixer -c mt8395evk cset name='PGA1 Volume' 3 The following command is an example that will record a 10 seconds file using AMIC: .. prompt:: bash # auto # arecord -D amic -r 48000 -f S32_LE -d 10 sample.wav HDMI RX ^^^^^^^ HDMI receiver refers to a hardware component that is capable of receiving high-definition video and audio signals transmitted through an HDMI interface. Before using the HDMI RX, set the ``MULTI_IN1_MUX`` first. .. prompt:: bash # auto # amixer -c 0 cset name='MULTI_IN1_MUX' HDMI_RX_I2S The following command is an example that will record a 10 seconds file named ``rec.wav``: .. prompt:: bash # auto # arecord -D hdmi_rx -r 48000 -c 2 -f S16_LE -d 10 rec.wav AFE Interconnection ------------------- This section will provide a more detailed explanation of the audio data transmission path between the SoC and external codec for each audio devices. The Audio Front-End of the SoC plays a critical role in managing audio functions. This chapter aims to familiarize you with the AFE interconnections on the SoC, highlighting how the audio components collaborate to process and output sound. By default, the platform has configured the audio data transmission paths within the AFE for each audio device. Users generally do not need to modify these settings unless there are special circumstances. It is important to ensure that the switches on the path are turned on before use. If the user needs it, they can also see all the pre-configured paths and all the replaceable paths in the `platform driver `_. Earphone Playback ^^^^^^^^^^^^^^^^^^ The platform is equipped with a 3.5mm **Earphone Jack** that supports stereo audio playback. Complete Route: MEMIF DL2 -> Mix Engine -> PMIC Interface -> Audio DAC -> HPL/HPR Mux -> Headset Volume Control -> Earphone .. figure:: /_asset/sw_rity_app-dev_audio_evk_headphone_playback_g1200.svg :align: center :scale: 100% Earphone playback audio data complete route The data pathway in the Mix Engine has been pre-configured. The **DL2** memory interface is defaultly connected to **I070** and **I071**. Please verify whether the input and output components for the earphone playback in the Mix Engine have been connected. .. prompt:: bash # auto # amixer -c mt8395evk cset name='O176 I070 Switch' on # amixer -c mt8395evk cset name='O177 I071 Switch' on The audio data will be transmitted to the PMIC via the PMIC DL interface. After the data enters the PMIC, it first goes into the DAC, which converts the digital signal into the analog signal. A mixer control called ``DAC In Mux`` is used to determine if the audio data should pass through the DAC. Set it to ``Normal Path`` for general use. .. prompt:: bash # auto # amixer -c mt8395evk cset name='DAC In Mux' Normal Path Next, the audio data output from the DAC will be sent to both the ``HP Mux`` and the ``LOL Mux``. ``HP Mux`` and ``LOL Mux`` are used to select whether to output audio through earphone or speaker. To use earphone playback, you need to set the ``HP Mux`` as ``Audio Playback`` and set the ``LOL Mux`` as ``Open``: .. prompt:: bash # auto # amixer -c mt8395evk cset name='HP Mux' 'Audio Playback' # amixer -c mt8395evk cset name='LOL Mux' 'Open' After choosing earphone as the audio playback device, you can adjust the hardware gain using the ``Headset Volume`` mixer control. .. prompt:: bash # auto # amixer -c mt8395evk cset name='Headset Volume' 4 Speaker Playback ^^^^^^^^^^^^^^^^ The platform has a 3.5mm **Speaker Jack** that supports mono audio playback. Complete Route: MEMIF DL2 -> Mix Engine -> PMIC Interface -> Audio DAC -> LOL Mux -> Lineout Volume -> Speaker .. figure:: /_asset/sw_rity_app-dev_audio_evk_speaker_playback_g1200.svg :align: center :scale: 100% Speaker playback audio data complete route The speaker playback and earphone playback use the same data source. The **DL2** memory interface is defaultly connected to **I070** and **I071**. .. prompt:: bash # auto # amixer -c mt8395evk cset name='O176 I070 Switch' on # amixer -c mt8395evk cset name='O177 I071 Switch' on The audio data will be transmitted to the PMIC via the PMIC DL interface. In the PMIC, the audio data output from the DAC will be sent to both the ``HP Mux`` and the ``LOL Mux``. The default settings of ``HP Mux`` and ``LOL Mux`` are configured for earphone playback. To use speaker playback, you need to set the ``HP Mux`` as ``Open`` and set the ``LOL Mux`` as ``Playback_L_DAC``. .. prompt:: bash # auto # amixer -c mt8395evk cset name='HP Mux' 'Open' # amixer -c mt8395evk cset name='LOL Mux' 'Playback_L_DAC' After choosing the speaker as the audio playback device, you can adjust the hardware gain using the ``Lineout Volume`` mixer control. .. prompt:: bash # auto # amixer -c mt8395evk cset name='Lineout Volume' 4 HDMI Playback ^^^^^^^^^^^^^ The platform supports up to 8-channel HDMI Audio output. Regarding HDMI and DP devices, the platform has implemented a **Jack Control** feature to detect whether HDMI or DP has been connected to the platform. Therefore, please ensure that the corresponding device is connected to the platform before starting the configuration adaptation. Complete Route: MEMIF DL10 -> afe_conn_hdmi -> ETDM_OUT3 Interface -> HDMI device .. figure:: /_asset/sw_rity_app-dev_audio_evk_hdmi_playback_g1200.svg :align: center :scale: 100% HDMI playback audio data complete route HDMI audio playback defaults to using **DL10** and is connected to the eTDM_out3 interface. The HDMI audio and DP audio are both output from the same AFE memory interface in the SoC. However, they are controlled separately by the ``HDMI_OUT_MUX`` and ``DPTX_OUT_MUX``. To use HDMI audio, please ensure that ``HDMI_OUT_MUX`` is connected. .. prompt:: bash # auto # amixer -c mt8395evk cset name='HDMI_OUT_MUX' 1 DP Playback ^^^^^^^^^^^ The platform supports up to 8-channel DP Audio output. Regarding HDMI and DP devices, the platform has implemented a jack control feature to detect whether HDMI or DP has been connected to the platform. Therefore, please ensure that the corresponding device is connected to the platform before starting the configuration adaptation. Complete Route: MEMIF DL10 -> afe_conn_hdmi -> DPTX Interface -> DP device .. figure:: /_asset/sw_rity_app-dev_audio_evk_dp_playback_g1200.svg :align: center :scale: 100% DP playback audio data complete route DP audio playback defaults to using **DL10** and is connected to the DPTX interface. To use DP audio, please ensure that ``DPTX_OUT_MUX`` is connected. .. prompt:: bash # auto # amixer -c mt8395evk cset name='DPTX_OUT_MUX' on PCM Playback ^^^^^^^^^^^^ Complete Route: MEMIF DL6 -> Mix Engine -> PCM interface -> PCM pins .. figure:: /_asset/sw_rity_app-dev_audio_evk_pcm_playback_g1200.svg :align: center :scale: 100% PCM playback audio data complete route The PCM playback is a two-channel output. The **DL6** memory interface is defaultly connected to **I000** and **I001**. Please confirm if the components for PCM playback in the Mix Engine have been connected. .. prompt:: bash # auto # amixer -c mt8395evk cset name='O000 I000 Switch' on # amixer -c mt8395evk cset name='O001 I001 Switch' on The platform has configured GPIO pins for PCM use, and for details on how to connect the hardware, please refer to :ref:`Raspberry Pi HAT `. .. note:: Please don't forget to take out the jumper ``J43``. Headset Capture ^^^^^^^^^^^^^^^ The headset captures audio in mono format, recording the voice from the headset device connected to the **Earphone Jack**. Complete Route: Headset -> AU_VIN1 -> PGA Mux -> PGA0 -> ADC0 -> PMIC UL Interface -> Mix Engine -> MEMIF UL4 .. figure:: /_asset/sw_rity_app-dev_audio_evk_headset_capture_g1200.svg :align: center :scale: 100% Headset capture audio data complete route The **UL4** memory interface is initially connected to **O034** and **O035**, and then the AFE will be connected to the PMIC UL interface. Please confirm if the components for headset capture in the Mix Engine have been connected. .. prompt:: bash # auto # amixer -c mt8395evk cset name='O034 I168 Switch' on # amixer -c mt8395evk cset name='O035 I169 Switch' on The ``PGA_L_Mux`` controls whether the audio signals input to the PMIC come from the headset or the analog microphone. To utilize headset capture, you must set the ``PGA_L_Mux`` to ``AIN1``. .. prompt:: bash # auto # amixer -c mt8395evk cset name='PGA_L_Mux' 'AIN1' PGA Gain refers to the hardware gain for capturing audio from the headset and AMIC. To control the volume, you can adjust the ``PGA1 Volume``, which has a range of 0 to 4: .. prompt:: bash # auto # amixer -c mt8395evk cset name='PGA1 Volume' 4 Analog Microphone Capture ^^^^^^^^^^^^^^^^^^^^^^^^^ On the |G1200-EVK|, there are three default analog microphones that can record audio in three channels. Complete Route: mic1 -> AU_VIN0 -> PGA Mux -> PGA0 -> ADC0 -> PMIC Interface -> Mix Engine -> MEMIF UL4 Complete Route: mic2 -> AU_VIN2 -> PGA1 -> ADC1 -> PMIC Interface -> Mix Engine -> MEMIF UL4 Complete Route: mic3 -> AU_VIN3 -> PGA2 -> ADC2 -> PMIC Interface -> Mix Engine -> MEMIF UL4 .. figure:: /_asset/sw_rity_app-dev_audio_evk_amic_capture_g1200.svg :align: center :scale: 100% Analog Microphone capture audio data complete route The AMIC and Headset conflict because they both use the same audio data transmission path, so only one of them can be selected for use at a time. The **UL10** memory interface is initially connected to **O038**, **O039** and **O182**, and then the AFE will be connected to the PMIC UL interface. Please confirm if the components for AMIC capture in the Mix Engine have been connected. .. prompt:: bash # auto # amixer -c mt8395evk cset name='O038 I168 Switch' on # amixer -c mt8395evk cset name='O039 I169 Switch' on # amixer -c mt8395evk cset name='O182 I170 Switch' on The default setting for ``PGA_L_Mux`` is ``AIN1`` for headset capture. To enable AMIC capture, you should change the ``PGA_L_Mux`` setting to ``AIN0``. .. prompt:: bash # auto # amixer -c mt8395evk cset name='PGA_L_Mux' 'AIN0' You can adjust the ``PGA1 Volume``, ``PGA2 Volume`` and ``PGA3 Volume`` to control the volume. These mixer controls enable users to adjust the hardware gain of AMIC, which ranges from 0 to 4. .. prompt:: bash # auto # amixer -c mt8395evk cset name='PGA1 Volume' 4 # amixer -c mt8395evk cset name='PGA2 Volume' 4 # amixer -c mt8395evk cset name='PGA3 Volume' 4 Digital Microphone Capture ^^^^^^^^^^^^^^^^^^^^^^^^^^ The platform by default has two DMICs, so it supports stereo recording. Complete Route: mic -> DMIC interface -> Mix Engine -> MEMIF UL9 .. figure:: /_asset/sw_rity_app-dev_audio_evk_dmic_capture_g1200.svg :align: center :scale: 100% Digital Microphone capture audio data complete route The **UL9** memory interface is by default connected to **O002** and **O003** on the AFE. Please confirm if the components for DMIC capture in the Mix Engine have been connected. .. prompt:: bash # auto # amixer -c mt8395evk cset name='O002 I004 Switch' on # amixer -c mt8395evk cset name='O003 I005 Switch' on By default, DMIC is set to **one-wire mode**, where one data pin is connected to two DMIC interfaces. If the user wants to use the **two-wire mode**, then they need to configure additional settings in the DTS file. For details, you can refer to the DMIC porting guide. Regarding the volume of DMIC recording, it can be adjusted through the DMIC hardware gain. Please enable the DMIC hardware gain using the following command. .. prompt:: bash # auto # amixer -c mt8395evk cset name='DMIC1_HW_GAIN_EN' on This is an example of increasing the volume by setting the current gain to **0 dB** and then adjusting the target gain to **10 dB**. .. prompt:: bash # auto # amixer -c mt8395evk cset name='DMIC1_HW_GAIN_CURRENT' 524288 # amixer -c mt8395evk cset name='DMIC1_HW_GAIN_TARGET' 1657944 Please refer to the DMIC porting guide for additional information about DMIC hardware gain. PCM Capture ^^^^^^^^^^^ The platform supports two channels of PCM audio capture. Complete Route: PCM pins -> PCM interface -> Mix Engine -> MEMIF UL2 .. figure:: /_asset/sw_rity_app-dev_audio_evk_pcm_capture_g1200.svg :align: center :scale: 100% PCM capture audio data complete route By default, PCM capture uses the **UL2** memory interface and is connected to **O040** and **O041** on the AFE. The audio data comes in from the PCM interface and then passes through **I002** and **I003** into the AFE. Please confirm whether the components for PCM capture in the Mix Engine have been connected. .. prompt:: bash # auto # amixer -c mt8395evk cset name='O040 I002 Switch' on # amixer -c mt8395evk cset name='O041 I003 Switch' on The platform has configured GPIO pins for PCM use, and for details on how to connect the hardware, please refer to :ref:`Raspberry Pi HAT `. .. note:: Please don't forget to take out the jumper ``J43``. HDMI RX ^^^^^^^ |G1200-EVK| supports HDMI audio capture. Complete Route: HDMI Receiver -> HDMI RX interface -> MEMIF UL1 .. figure:: /_asset/sw_rity_app-dev_audio_evk_hdmi_capture_g1200.svg :align: center :scale: 100% HDMI capture audio data complete route HDMI RX by default uses the **UL1** memory interface(**UL6** can also be used to receive HDMI audio data). The incoming audio data format is I2S, which supports up to 8 channels. Within the HDMI RX interface, it is necessary to configure the ``MULTI_IN1_MUX`` to enable the HDMI RX functionality. .. prompt:: bash # auto # amixer -c mt8395evk cset name='MULTI_IN1_MUX' HDMI_RX_I2S