.. include:: /keyword.rst =============== |G510-G700-EVK| =============== .. contents:: Sections :local: :depth: 2 Overview -------- On |G510-EVK|, there are 5 playback hardware and 5 capture hardware. On |G700-EVK|, there are 4 playback hardware and 4 capture hardware. The difference between |G510-EVK| and |G700-EVK| is that |G510-EVK| has I2S pin out while |G700-EVK| doesn't. .. figure:: /_asset/sw_rity_app-dev_audio_evk_afe_g510.svg :align: center :scale: 100% |G510-EVK| audio data route diagram .. figure:: /_asset/sw_rity_app-dev_audio_evk_afe_g700.svg :align: center :scale: 100% |G700-EVK| audio data route diagram .. table:: Definitions of data pin channels ================= ================== Data Pin Name Number of Channels ================= ================== DMIC1_DAT 2 DMIC2_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 HDMITX 8 DPTX 8 AU_HPL 1 AU_HPR 1 AU_LOL 1 AU_VIN1 1 AU_VIN0 1 ================= ================== .. note:: On |G700-EVK|, I2S is accessible exclusively through test points, whereas on Genio 510-EVK, General Purpose Input/Output pins are available for I2S connectivity. Apart from the I2S section, the audio parts of the G510 and G700 are the same, so they are documented in the same page. - Playback - Earphone-Out Jack - Speaker-Out Jack - PCM Out - HDMI/DP Audio Out - I2S Out - Capture - PCM In - Earphone-In Jack - AMIC In - DMIC In - I2S In |G510-G700-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. |G510-G700-EVK| board was designed with one analog microphone and two digital microphones. 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-g700-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``. - ``pcmC0D6p`` plays the sound to ``I2S Out``. - ``pcmC0D8c`` records the voice from ``PCM In``. - ``pcmC0D10c`` records the voice from ``Earphone-In Jack`` or ``AMIC In``. - ``pcmC0D14c`` records the voice from ``DMIC In``. - ``pcmC0D11c`` records the voice from ``I2S 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 |G510-G700-EVK|, and specify if the software is supported. .. csv-table:: Genio 510/700-EVK Audio Interfaces :file: /_asset/tables/audio-g510-g700-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 510/700-EVK :file: /_asset/tables/audio-mt6365-g510-g700-interfaces.csv :width: 60% :header-rows: 1 Playback -------- Earphone Jack Speaker ^^^^^^^^^^^^^^^^^^^^^ By default, the |G510-G700-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 mt8390evk 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 mt8390evk cset name='Headset Volume' 30 # amixer -c mt8390evk 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 mt8390evk cset name='HP Mux' 'Open' # amixer -c mt8390evk 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 mt8390evk cset name='HDMI_OUT_MUX' on # amixer -c mt8390evk cset name='DPTX_OUT_MUX' off After using it, turn off the ``HDMI_OUT_MUX``. .. prompt:: bash # auto # amixer -c mt8390evk 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 |G510-G700-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 mt8390evk cset name='DPTX_OUT_MUX' on # amixer -c mt8390evk cset name='HDMI_OUT_MUX' off After using it, turn off the ``DPTX_OUT_MUX``. .. prompt:: bash # auto # amixer -c mt8390evk 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 mt8390evk cset name='HDMI_OUT_MUX' on # amixer -c mt8390evk 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. I2S Out ^^^^^^^ Use ``aplay`` to output I2S signal, the platform uses eTDM out2 interface for I2S output by default. .. prompt:: bash # auto # aplay -D i2s_out sample.wav 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 |G510-G700-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 mt8390evk 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 mt8390evk 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 mt8390evk cset name='PGA_L_Mux' 'AIN0' The range of the AMIC volume value from small to loud is 0 to 4. Volume setting: .. prompt:: bash # auto # amixer -c mt8390evk 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 I2S In ^^^^^^^ To record voice through the I2S interface, please use the following command. .. prompt:: bash # auto # arecord -D i2s_in -c 2 -r 48000 -f S32_LE -d 10 sample.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_g700.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 connected to **I070** and **I071** by default. Please verify whether the input and output components for the earphone playback in the Mix Engine have been connected. .. prompt:: bash # auto # amixer -c mt8390evk cset name='O176 I070 Switch' on # amixer -c mt8390evk 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 mt8390evk 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 mt8390evk cset name='HP Mux' 'Audio Playback' # amixer -c mt8390evk 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 mt8390evk 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_g700.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 connected to **I070** and **I071** by default. .. prompt:: bash # auto # amixer -c mt8390evk cset name='O176 I070 Switch' on # amixer -c mt8390evk 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 mt8390evk cset name='HP Mux' 'Open' # amixer -c mt8390evk 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 mt8390evk 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_g700.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 mt8390evk cset name='HDMI_OUT_MUX' on 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_g700.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 mt8390evk 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_g700.svg :align: center :scale: 100% PCM playback audio data complete route The PCM playback is a two-channel output. The **DL6** memory interface is connected to **I000** and **I001** by default. Please confirm if the components for PCM playback in the Mix Engine have been connected. .. prompt:: bash # auto # amixer -c mt8390evk cset name='O000 I000 Switch' on # amixer -c mt8390evk 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:: To enable PCM output on |G510-EVK|, please set jumper J4217 to ``Raspberry Pi``. I2S Playback ^^^^^^^^^^^^ The platform supports 8-channel I2S audio playback, this feature is particularly useful for applications that require multi-channel audio output. Complete Route: MEMIF DL11 -> Mix Engine -> ETDM_OUT2 Interface-> I2S pin .. figure:: /_asset/sw_rity_app-dev_audio_evk_i2s_playback_g700.svg :align: center :scale: 100% I2S playback audio data complete route The **DL11** memory interface is default connected to **I022~I029**, and then the audio data comes out from AFE and is then connected to the eTDM_out2 interface. .. prompt:: bash # auto # amixer -c mt8390evk cset name='O048 I022 Switch' on # amixer -c mt8390evk cset name='O049 I023 Switch' on # amixer -c mt8390evk cset name='O050 I024 Switch' on # amixer -c mt8390evk cset name='O051 I025 Switch' on # amixer -c mt8390evk cset name='O052 I026 Switch' on # amixer -c mt8390evk cset name='O053 I027 Switch' on # amixer -c mt8390evk cset name='O054 I028 Switch' on # amixer -c mt8390evk cset name='O055 I029 Switch' on Configure the clock source for the eTDM interface, where ``a1sys`` and ``a2sys`` respectively represent the clock sources generated from ``APLL1`` and ``APLL2`` for 48 KHz and 44.1 KHz sample rate. .. prompt:: bash # auto # amixer -c mt8390evk cset name='ETDM_OUT2_Clock_Source' a1sys_a2sys |G510-EVK| has set up the I2S pin on the board. For more details, please refer to |G510-EVK|'s schematic. 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_g700.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 mt8390evk cset name='O034 I168 Switch' on # amixer -c mt8390evk 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 mt8390evk 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 mt8390evk cset name='PGA1 Volume' 4 Analog Microphone Capture ^^^^^^^^^^^^^^^^^^^^^^^^^ On the |G510-EVK| and |G700-EVK|, there is a default analog microphone that can record mono audio. Complete Route: mic -> AU_VIN0 -> PGA Mux -> PGA0 -> ADC0 -> PMIC Interface -> Mix Engine -> MEMIF UL4 .. figure:: /_asset/sw_rity_app-dev_audio_evk_amic_capture_g700.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 **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 AMIC capture in the Mix Engine have been connected. .. prompt:: bash # auto # amixer -c mt8390evk cset name='O034 I168 Switch' on # amixer -c mt8390evk cset name='O035 I169 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 mt8390evk cset name='PGA_L_Mux' 'AIN0' You can adjust the ``PGA1 Volume`` to control the volume. This mixer control enables users to adjust the hardware gain of AMIC, which ranges from 0 to 4. .. prompt:: bash # auto # amixer -c mt8390evk cset name='PGA1 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_g700.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 mt8390evk cset name='O002 I004 Switch' on # amixer -c mt8390evk cset name='O003 I006 Switch' on The default setting for DMIC is **clock nomo mode**, which means each DMIC component is connected to one clock. To enable DMIC **clock mono mode**, additional configuration needs to be done in the DTS file. Additionally, the corresponding connection path should also be set up. 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 mt8390evk cset name='DMIC1_HW_GAIN_EN' on # amixer -c mt8390evk cset name='DMIC2_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 mt8390evk cset name='DMIC1_HW_GAIN_CURRENT' 524288 # amixer -c mt8390evk cset name='DMIC2_HW_GAIN_CURRENT' 524288 # amixer -c mt8390evk cset name='DMIC1_HW_GAIN_TARGET' 1657944 # amixer -c mt8390evk cset name='DMIC2_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_g700.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 mt8390evk cset name='O040 I002 Switch' on # amixer -c mt8390evk 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:: To enable PCM input on |G510-EVK|, please set jumper J4216 to ``Raspberry Pi``. I2S Capture ^^^^^^^^^^^ The platform supports two channels of I2S audio capture. Complete Route: I2S pin -> eTDM in2 interface -> Mix Engine -> MEMIF UL5 .. figure:: /_asset/sw_rity_app-dev_audio_evk_i2s_capture_g700.svg :align: center :scale: 100% I2S capture audio data complete route The platform by default uses the eTDM_in2 interface to receive audio data, which then enters the AFE through **I012** and **I013**, and is subsequently routed from **O036** and **O037** to the **UL5** memory interface. Please confirm whether the components for I2S capture in the Mix Engine have been connected. .. prompt:: bash # auto # amixer -c mt8390evk cset name='O036 I012 Switch' on # amixer -c mt8390evk cset name='O037 I013 Switch' on Configure the clock source for the eTDM interface, where ``a1sys`` and ``a2sys`` respectively represent the clock sources generated from ``APLL1`` and ``APLL2`` for 48 KHz and 44.1 KHz sample rate. .. prompt:: bash # auto # amixer -c mt8390evk cset name='ETDM_IN2_Clock_Source' a1sys_a2sys For using I2S capture on the platform, it is necessary to consider whether the playback side is in master mode or slave mode and adjust the configuration accordingly. The playback end and capture end must be in different modes; otherwise, serious noise will occur. For detailed operations, please refer to the eTDM porting guide. |G510-EVK| has set up the I2S pin on the board. For more details, please refer to |G510-EVK|'s schematic. .. _audio_dsp: Audio DSP --------- Introduction ^^^^^^^^^^^^ The Audio Digital Signal Processor (ADSP) is a specialized microprocessor designed for processing audio signals in real time. ADSPs perform complex audio processing tasks such as filtering, equalization, compression, noise reduction, and effects like reverb and echo. ADSPs are also designed to be highly efficient in power consumption and processing speed, making them ideal for use in IoT devices and various other applications. The Genio boards utilize Cadence’s Xtensa HiFi4 and HiFi5 DSPs, which leverage the Sound Open Firmware (SOF) framework, an open-source project aimed at providing an efficient and flexible firmware stack for audio DSPs. Supported Platforms and ADSP Specifications ******************************************* ============= ========= ==================== ========================= ======== ========= Platform SoC ADSP Architecture Cores/Clocks DRAM SRAM ============= ========= ==================== ========================= ======== ========= Genio 1200 MT8395 Xtensa HiFi4 1 @ 220 MHz - 720 MHz 16 MB 256 KB Genio 700 MT8390 Xtensa HiFi5 1 @ 260 MHz - 800 MHz 17 MB 512 KB Genio 510 MT8370 Xtensa HiFi5 1 @ 260 MHz - 800 MHz 17 MB 512 KB ============= ========= ==================== ========================= ======== ========= On Genio 510-EVK, there are 2 playback hardware and 2 capture hardware for the Audio DSP. .. figure:: /_asset/sw_rity_app-dev_audio_evk_sof_g510.svg :align: center :scale: 100% Genio 510-EVK audio data route On Genio 700-EVK, there are 2 playback hardware and 2 capture hardware for the Audio DSP. .. figure:: /_asset/sw_rity_app-dev_audio_evk_sof_g700.svg :align: center :scale: 100% Genio 700-EVK ADSP audio data route Earphone Playback using ADSP on Genio 510/700 ********************************************* Complete Route: SOF_DL2/SOF_DL3 -> Mix Engine -> PMIC Interface -> Audio DAC -> HPL/HPR Mux -> Headset Volume Control -> Earphone .. figure:: /_asset/sw_rity_app-dev_audio_evk_sof_headphone_playback_g700.svg :align: center :scale: 100% Genio 510/700 ADSP earphone playback route Headset Capture using ADSP on Genio 510/700 ******************************************* Complete Route: Headset -> AU_VIN1 -> PGA Mux -> PGA0 -> ADC0 -> PMIC UL Interface -> Mix Engine -> SOF_UL4/SOF_UL5 .. figure:: /_asset/sw_rity_app-dev_audio_evk_sof_headset_capture_g700.svg :align: center :scale: 100% Genio 510/700 ADSP headset capture route Usage ^^^^^ To use audio DSP, flash the image onto |G510-G700-EVK| with ``audio-sof.dtbo``. .. prompt:: bash > auto > genio-flash --load-dtbo audio-sof.dtbo |G510-G700-EVK| supports DSP playback of headphones, and supports DSP capture of headset & DMIC. - DSP Playback The two PCM device nodes, ``hw:0,16`` and ``hw:0,17``, are linked to the ``SOF_DL2`` and ``SOF_DL3``, both connected to the DSP headphone playback. .. prompt:: bash # auto root@genio-510-evk:~# aplay -l **** List of PLAYBACK Hardware Devices **** card 0: sofmt8370evk [sof-mt8370-evk], device 16: SOF_DL2 (*) [] Subdevices: 1/1 Subdevice #0: subdevice #0 card 0: sofmt8370evk [sof-mt8370-evk], device 17: SOF_DL3 (*) [] Subdevices: 1/1 Subdevice #0: subdevice #0 The following is an example of using DSP headphone playback. .. prompt:: bash # auto # aplay -D hw:0,16 -c 2 -f S16_LE -r 48000 test.wav This is a GStreamer DSP headphones playback test. A sine wave of 440 Hz will be played through the headphones. .. prompt:: bash # auto # gst-launch-1.0 audiotestsrc freq=440 ! audioconvert ! audioresample ! alsasink device=hw:0,17 You can adjust the volume of the DSP headphone playback by controlling the ``ADDA_DL_Gain`` mixer control. ``ADDA_DL_Gain`` has a range from 0 to 65535. .. prompt:: bash # auto root@genio-510-evk:~# amixer -c 0 sset 'ADDA_DL_GAIN' 50000 Simple mixer control 'ADDA_DL_GAIN',0 Capabilities: volume volume-joined Playback channels: Mono Capture channels: Mono Limits: 0 - 65535 Mono: 50000 [76%] - DSP Capture The ``hw:0,18`` is linked to the ``SOF_UL4``, connected to the DSP headset capture; and the ``hw:0,19`` is linked to the ``SOF_UL5``, connected to the DSP DMIC capture. .. prompt:: bash # auto root@genio-510-evk:~# arecord -l **** List of CAPTURE Hardware Devices **** card 0: sofmt8370evk [sof-mt8370-evk], device 18: SOF_UL4 (*) [] Subdevices: 1/1 Subdevice #0: subdevice #0 card 0: sofmt8370evk [sof-mt8370-evk], device 19: SOF_UL5 (*) [] Subdevices: 1/1 Subdevice #0: subdevice #0 The following is an example of DSP headset capture. .. prompt:: bash # auto # arecord -D hw:0,18 -c 2 -f S16_LE -r 48000 -d 10 test_headset.wav The following is an example of DSP DMIC capture. .. prompt:: bash # auto # arecord -D hw:0,19 -c 2 -f S16_LE -r 48000 -d 10 test_dmic.wav - Loopback test This test involves using GStreamer for loopback testing. Speak into the microphone of the headset, and you should be able to hear your voice from headphones. .. prompt:: bash # auto # gst-launch-1.0 alsasrc device=hw:0,18 ! audio/x-raw,rate=48000 ! alsasink device=hw:0,16 .. _headset-jack-detection-g700-g510: Headset Jack Detection ---------------------- Introduction ^^^^^^^^^^^^ Headset jack detection is a feature that identifies when a headset is inserted or removed. This functionality allows the system to switch audio paths automatically, adjust volume settings, and perform other related actions based on the presence of a headset. .. figure:: /_asset/sw_yocto_app-dev_audio_jack_g700.svg :align: center :scale: 20% Genio 510/700-EVK Earphone Jack |G510-G700-EVK| supports the headset jack detection on the **Earphone Jack**. Headsets with a 3.5mm jack can be categorized based on the number of poles (or rings) on the connector. These poles determine the functionality and compatibility of the headset with various devices. The two main types are 3-pole and 4-pole headsets. - 3-pole headset - LRG A 3-pole headset, also known as a LRG connector, has three distinct sections on the plug: - L: Carries the left audio channel. - R: Carries the right audio channel. - G: Serves as the common ground for both audio channels. 3-pole headsets are designed for audio playback only, without a built-in microphone. .. figure:: /_asset/sw_yocto_app-dev_audio_3pole.svg :align: center :scale: 100% 3 pole headset - 4 pole headset - LRMG/LRGM A 4-pole headset, also known as a LRGM (or LRMG) connector, has four distinct sections on the plug: - L: Carries the left audio channel. - R: Carries the right audio channel. - G: Serves as the common ground for both audio channels. - M: Carries the microphone signal. 4-pole headsets include a built-in microphone, making them suitable for voice communication and recording. 4-pole headsets can further be divided into two standards based on the arrangement of the microphone and ground connections: - **OMTP** (Open Mobile Terminal Platform): The order of the connections from the tip to the sleeve is Left Audio, Right Audio, Microphone, and Ground (LRMG). OMTP standard is originally used by older mobile phones and some specific brands. - **CTIA** (Cellular Telecommunications Industry Association): The order of the connections from the tip to the sleeve is Left Audio, Right Audio, Ground, and Microphone (LRGM). CTIA standard is the most widely adopted standard, used by most modern smartphones, tablets, and laptops. .. figure:: /_asset/sw_yocto_app-dev_audio_4pole.svg :align: center :scale: 100% 4 pole headset The detection mechanism combines two key technologies: Earphone Interrupt (EINT) and Accessory Detection (ACCDET). - EINT This technology detects the headset jack's physical state changes, such as insertion and removal. When a headset is plugged in or unplugged, an earphone interrupt is triggered, notifying the system to take appropriate actions. |G510-G700-EVK| uses EINT to trigger ACCDET. - ACCDET ACCDET is a hardware mechanism that detects and identifies the type of events connected to the headset jack. ACCDET monitors voltage changes through a combination of comparators and triggers an interrupt when an accessory event occurs. The comparators are set to specific voltage thresholds to distinguish between various accessory types and events. On the |G510-G700-EVK|, EINT is triggered by a low-level signal, and the jack circuit is default open. - State 1: **Before plug in** or **After plug out** - ``EINT`` node is open during these two status. - State 2: **During plug in** - ``EINT`` node and ``Left`` node are shorted after plugging in. - EINT output changes from **High** to **Low**. - ACCDET function starts after EINT function detects plugging in. .. figure:: /_asset/sw_yocto_app-dev_audio_low-level.svg :align: center :scale: 30% EINT low-level trigger Usage ^^^^^ To test the headset jack detection, you can use **evtest**. .. prompt:: bash # auto # evtest You may see the following output, then select the **Headset Jack** event. For example: .. prompt:: bash # auto root@genio-700-evk:~# evtest No device specified, trying to scan all of /dev/input/event* Available devices: /dev/input/event0: Goodix Capacitive TouchScreen /dev/input/event1: gpio-keys /dev/input/event2: mtk-pmic-keys /dev/input/event3: mt8390-evk Headset Jack /dev/input/event4: mt8390-evk HDMI Jack Select the device event number [0-4]: Select ``3``, then you will see: .. prompt:: bash # auto Input driver version is 1.0.1 Input device ID: bus 0x0 vendor 0x0 product 0x0 version 0x0 Input device name: "mt8390-evk 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 164 (KEY_PLAYPAUSE) Event code 582 (KEY_VOICECOMMAND) Event type 5 (EV_SW) Event code 2 (SW_HEADPHONE_INSERT) state 1 Event code 4 (SW_MICROPHONE_INSERT) state 1 Properties: Testing ... (interrupt to exit) At this time, testing the plugging and unplugging of the headset. You will see a change in the value of **Event type 5**. - Plugging .. prompt:: bash # auto Event: time 1262644591.632507, type 5 (EV_SW), code 2 (SW_HEADPHONE_INSERT), value 1 Event: time 1262644591.632507, type 5 (EV_SW), code 4 (SW_MICROPHONE_INSERT), value 1 Event: time 1262644591.632507, -------------- SYN_REPORT ------------ - Unplugging .. prompt:: bash # auto Event: time 1262645383.175670, type 5 (EV_SW), code 2 (SW_HEADPHONE_INSERT), value 0 Event: time 1262645383.175670, type 5 (EV_SW), code 4 (SW_MICROPHONE_INSERT), value 0 Event: time 1262645383.175670, -------------- SYN_REPORT ------------ Use ``Ctrl + C`` to exit evtest. Additionally, headset jack detection has corresponding mixer controls named **Headphone Jack** and **Headset Mic Jack**. By utilizing applications such as ``asound.conf`` or ``alsaucm``, it is possible to implement features such as automatically switching the usage device and routing the audio path based on the headset jack detection status.