Skip to content

Commit b3def46

Browse files
committed
intel_debug: add suggestions for DMIC and ES8336 platforms
Instead of repeating the same things on GitHub issues, maybe this documentation will help. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
1 parent 1b01989 commit b3def46

File tree

1 file changed

+136
-0
lines changed

1 file changed

+136
-0
lines changed

getting_started/intel_debug/suggestions.rst

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,3 +140,139 @@ to snd_sof module:
140140
.. code-block::
141141
142142
options snd_sof sof_debug=1
143+
144+
145+
Digital mic issues
146+
******************
147+
148+
The SOF driver and firmware have limited information related to the
149+
number of digital microphones and their physical location.
150+
151+
On devices designed for Windows, the presence of the microphone is
152+
reported as an NHLT endpoint (ACPI table in the BIOS). The SOF Linux
153+
driver will report this information with a 'dmesg' log such as
154+
155+
.. code-block::
156+
157+
[ 4.301490] sof-audio-pci-intel-tgl 0000:00:1f.3: DMICs detected in NHLT tables: 2
158+
159+
Recent versions of the ACPICA tools (acpica-tools package) can also be
160+
used to visualize the ACPI tables.
161+
162+
In some instances the number of DMICs reported by the NHLT does not
163+
match the hardware layout. The SOF driver provides a means to alter
164+
the value with a kernel parameter which can be added in
165+
/etc/modprobe.d/alsa-base.conf (or any other configuration file with
166+
this .conf extension). A reboot is necessary after changing the value
167+
168+
.. code-block::
169+
170+
options snd_sof_intel_hda_common dmic_num=4
171+
172+
The following command can then be used to check if the microphones are active at the lowest level
173+
174+
.. code-block:: bash
175+
176+
arecord -Dhw:0,6 -c4 -r48000 -sS32_LE -d 10 test.wav
177+
178+
In 99% of the cases, hardware designers connect the two microphones on
179+
the PDM0 controller. Some platforms use PDM1, which cannot really be
180+
detected by the OS. By capturing in 4ch mode, it's possible that
181+
channel3 and 4 capture data while channel0 and channel1 only show
182+
signs of transitions and DC-removal. Simply talking or recording music
183+
in this 10s test, then visualizing the recorded file with Audacity is
184+
often enough to diagnose the presence of 2 microphones on the 'wrong'
185+
PDM controller.
186+
187+
In that case, a different topology file needs to be used, typically
188+
sof-hda-generic-2ch-pdm1.tplg. On older distributions, it will be
189+
necessary to override the file installed in
190+
/lib/firmware/intel/sof-tplg/sof-hda-generic-2ch.tplg. On kernels
191+
5.20+ a kernel parameter will be enough with no need to change and
192+
override installed topology files, e.g.
193+
194+
.. code-block::
195+
196+
options snd-sof-pci tplg_filename=sof-hda-generic-2ch-pdm1.tplg
197+
198+
These PDM1 issues are tracked in GitHub with the label 'DMIC-PDM1' in the
199+
`firmware issues <https://github.com/thesofproject/sof/issues?q=is%3Aissue+label%3ADMIC-PDM1>`_
200+
and in the `Linux issues <https://github.com/thesofproject/linux/issues?q=is%3Aopen+is%3Aissue+label%3ADMIC-PDM1>`_.
201+
202+
Users running Linux distributions on Chromebooks routinely experience
203+
issues with digital microphones. In the Chrome environment, the
204+
topology always exposes 4 channels, and UCM files for specific
205+
platforms specify which of the 4 channels are valid. A plugin will
206+
then drop the useless/non-populated channels. This capability does not
207+
exist yet in upstream UCM/Linux. Capturing with the 'arecord; command
208+
above will help understand which channels are valid and configure UCM
209+
files.
210+
211+
ES8336 support
212+
**************
213+
214+
Since 2021, a number of OEMs relied on the ES8336 codec from Everest
215+
Audio on platforms as varied as AppoloLake, GeminiLake, JasperLake,
216+
CometLake, AlderLake.
217+
218+
End-users can verify if the hardware uses this configuration by
219+
running the 'alsa-info' command and checking for the presence an ACPI
220+
_HID, e.g.
221+
222+
.. code-block::
223+
224+
/sys/bus/acpi/devices/ESSX8336:00/status 15
225+
226+
.. code-block::
227+
228+
/sys/bus/acpi/devices/ESSX8326:00/status 15
229+
230+
Support for this platform only stated upstream with the kernel
231+
5.19-rc1. Any attempts with earlier kernels will require backports and
232+
experimental patches to be added. In the case of the 8326, the codec
233+
vendor submitted a driver to the ALSA/ASoC maintainers, which was not
234+
merged as of July 2022. In this specific case end-users will be forced
235+
to compile their own kernel.
236+
237+
The SOF driver implemented an automatic detection of the SSP/I2S port
238+
used by hardware and the presence of digital microphones based on
239+
platform firmware/NHLT.
240+
241+
There are however a number of hardware configurations that cannot be
242+
detected from platform firmware. To work-around this limitation, the
243+
'sof-es8336' machine driver exposes a 'quirk' kernel parameter which
244+
can be used for modify GPIO and jack detection settings. Existing
245+
quirks are listed in the sound/soc/intel/boards/sof_es8336.c machine
246+
driver:
247+
248+
.. code-block:: c
249+
250+
#define SOF_ES8336_SPEAKERS_EN_GPIO1_QUIRK BIT(4)
251+
#define SOF_ES8336_JD_INVERTED BIT(6)
252+
#define SOF_ES8336_HEADPHONE_GPIO BIT(7)
253+
#define SOC_ES8336_HEADSET_MIC1 BIT(8)
254+
255+
256+
The default quirk value for the platform can be read from
257+
/sys/module/snd_soc_sof_es8336/parameters/quirk (the value is reported
258+
as plain integer, not hexadecimal). Changes to the default can be
259+
added with the following option in
260+
e.g. /etc/modprobe.d/alsa-base.conf. Only the bits listed above can be
261+
modified, others need to be kept as is.
262+
263+
.. code-block::
264+
265+
options snd_soc_sof_es8336 quirk=<value>
266+
267+
Changing quirk values is an extremely experimental endeavor that
268+
should only attempted by users with working knowledge of the Linux
269+
audio subsystem and an understanding that playing with hardware
270+
settings MAY DAMAGE HARDWARE or generate extremely loud sounds that
271+
MAY DAMAGE YOUR HEARING.
272+
273+
In rare cases, some platforms use the MCLK1 signal instead of
274+
MCLK0. As of July 2022, there is no turn-key solution for those
275+
platforms.
276+
277+
These ES8336 issues are tracked in GitHub with the label 'codec
278+
ES8336' in the `Linux ES8336 issues <https://github.com/thesofproject/linux/issues?q=is%3Aopen+is%3Aissue++label%3A%22codec+ES8336%22>`_.

0 commit comments

Comments
 (0)