thesofproject / linux

Linux kernel source tree
Other
91 stars 134 forks source link

[BUG] Infinix Inbook X2 no sound (both speakers and jack) #3873

Open faerics opened 2 years ago

faerics commented 2 years ago

Hello,

following docs and wiki I've compiled the 5.19.0 + fixes kernel. and see Dummy output instead of the sounding device. New topology files added. My laptop is Infinix Inbook X2 with the following:

System:
  Kernel: 5.19.0+ x86_64 bits: 64 compiler: gcc v: 11.2.0
    Desktop: Cinnamon 5.4.12 tk: GTK 3.24.33 wm: Mutter vt: 7
    dm: LightDM 1.30.0 Distro: Linux Mint 21 Vanessa base: Ubuntu 22.04 jammy
Machine:
  Type: Laptop System: Infinix product: Infinix INBOOK X2 v: N/A
    serial: <superuser required>
  Mobo: Infinix model: EM_IC325_200B_V1.0 20211012
    serial: <superuser required> UEFI: American Megatrends
    v: ICL_IC325_LPDDR4X_200B_V2.0.21 date: 11/25/2021
Battery:
  ID-1: BAT0 charge: 50.0 Wh (100.0%) condition: 50.0/50.0 Wh (100.0%)
    volts: 11.6 min: N/A model: Ice Lake Li-ion Battery type: Li-ion
    serial: <filter> status: Charging
CPU:
  Info: quad core model: Intel Core i7-1065G7 bits: 64 type: MT MCP
    smt: enabled arch: Ice Lake rev: 5 cache: L1: 320 KiB L2: 2 MiB L3: 8 MiB
  Speed (MHz): avg: 1500 min/max: 400/3900 cores: 1: 1500 2: 1500 3: 1500
    4: 1500 5: 1500 6: 1500 7: 1500 8: 1500 bogomips: 23961
  Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx
Graphics:
  Device-1: Intel Iris Plus Graphics G7 vendor: nCipher Security driver: i915
    v: kernel ports: active: eDP-1 empty: DP-1, DP-2, DP-3, HDMI-A-1
    bus-ID: 00:02.0 chip-ID: 8086:8a52 class-ID: 0300
  Device-2: Microdia USB 2.0 Camera type: USB driver: uvcvideo
    bus-ID: 3-3:2 chip-ID: 0c45:636b class-ID: 0e02 serial: <filter>
  Display: x11 server: X.Org v: 1.21.1.3 driver: X: loaded: modesetting
    unloaded: fbdev,vesa gpu: i915 display-ID: :0 screens: 1
  Screen-1: 0 s-res: 1920x1080 s-dpi: 96 s-size: 508x285mm (20.0x11.2")
    s-diag: 582mm (22.9")
  Monitor-1: eDP-1 res: 1920x1080 hz: 60 dpi: 158
    size: 309x174mm (12.2x6.9") diag: 355mm (14") modes: 1920x1080
  OpenGL: renderer: Mesa Intel Iris Plus Graphics (ICL GT2)
    v: 4.6 Mesa 22.0.5 direct render: Yes
Audio:
  Device-1: Intel Ice Lake-LP Smart Sound Audio
    driver: sof-audio-pci-intel-icl bus-ID: 00:1f.3 chip-ID: 8086:34c8
    class-ID: 0403
  Sound Server-1: ALSA v: k5.19.0+ running: yes
  Sound Server-2: PulseAudio v: 15.99.1 running: yes
  Sound Server-3: PipeWire v: 0.3.48 running: yes

<irrelevant parts omitted>

Attaching dmesg from boot. Not an audio expert so need some help from the community to investigate this. dmesg-5.19.0+.log

Thanks.

plbossart commented 2 years ago

@faerics Can you please attach the results of 'alsa-info'? it's likely that there's a missing entry in ACPI matching tables for your device since it defaults to the HDMI-only case.

faerics commented 2 years ago

@plbossart Hello, attaching sudo alsa-info result. alsa-info.txt

fredoh9 commented 2 years ago

Another ES8326/ES8336 codec issue?

/sys/bus/acpi/devices/ESSX8326:00/status     15
plbossart commented 2 years ago

Yes, it's a codec issue @faerics

/sys/bus/acpi/devices/ESSX8326:00/status 15

This points to the ES8326, NOT the ES8336. The required codec driver was upstreamed in August only, and it's certainly NOT in 5.19

As a courtesy I add the missing patches to https://github.com/thesofproject/linux/tree/es8336-v5.19 but this is not even compile-tested, and it's rather unlikely that you get sound. There will be a need for board configuration and mixer settings, but at least this branch should give you a card that's exposed to userpace.

faerics commented 2 years ago

@plbossart Many thanks for your help. Okay then, let me clarify what my next steps should be. (1) compile the new commit on branch es8336-v5.19 and see if something changes (2) the required codec driver was upsteamed, so I need to compile newer kernel than 5.19. Which one?

By the way, am I right that your new commit for ES8326 does not break entire 8336 branch? Cheers

plbossart commented 2 years ago

The es8336-v5.19 branch contains the backported patches from upstream. No need to switch kernel versions.

faerics commented 2 years ago

@plbossart Compiled the new kernel, no changes :( Attaching updated alsa-info output. What else can we do here? alsa-info-new-kernel.txt

plbossart commented 2 years ago

you should remove the option snd_intel_dspcfg: dsp_driver=3, that shouldn't be necessary.

also please double check if you see the e8326 driver probe and register ASoC components. You can double-check the latter by looking at /sys/kernel/debug/asoc/components and /sys/kernel/debug/asoc/dais. snd_soc_es8326 is loaded but it could very well be that the driver never probes or exits the probe with some error.

I would also check if we support an acpi table to select this sof_es8336 machine driver. If I look at your PCI ID 8086:34c8, that will be used to look at machine drivers in snd_soc_acpi_intel_icl_machines (sound/soc/intel/common/soc-acpi-intel-icl-match.c) and I don't see any ID for the ES8326. Try to copy this block from JSL into the ICL table:

{
        .comp_ids = &essx_83x6,
        .drv_name = "sof-essx8336",
        .sof_tplg_filename = "sof-jsl-es8336", /* the tplg suffix is added at run time */
        .tplg_quirk_mask = SND_SOC_ACPI_TPLG_INTEL_SSP_NUMBER |
                    SND_SOC_ACPI_TPLG_INTEL_SSP_MSB |
                    SND_SOC_ACPI_TPLG_INTEL_DMIC_NUMBER,
    },
faerics commented 2 years ago

Hello, @plbossart, sorry for the delay, just got free time to continue trying things you suggest.

snd_intel_dspcfg: dsp_driver=3 option is necessary, and when I remove it, the snd_hda_intel driver is used, which is not what we want. right?

Next,

cat /sys/kernel/debug/asoc/components
0000:00:1f.3
ehdaudio0D2
i2c-ESSX8326:00
dmic-codec
snd-soc-dummy
snd-soc-dummy 

/sys/kernel/debug/asoc/dais also contains string i2c-ESSX8326:00.

To the last step, I noticed that ES8336 wiki got updated, Should we try to repeat steps using newer v6 kernel? Also, can you point to the line where to paste that fragment of code? Looked at sound/soc/intel/common/soc-acpi-intel-icl-match.c and can't find similar block.

Thanks for your help!

plbossart commented 2 years ago

Yes @faerics you need the branch listed in the wiki, with the two patches in https://github.com/thesofproject/linux/pull/3954 added on top

faerics commented 2 years ago

@plbossart should these commits be added on top of es8336-v6.0?

plbossart commented 2 years ago

yes. I don't have the time to do it for now.

faerics commented 2 years ago

TL;DR no sound, dummy output but seems that something has changed and we need a topology. Cherry picked 2 commits on top of es8336-v6.0 and compiled.

No sound, dummy output is still here. Maybe we are missing some topologies? Loooking at dmesg I noticed this fragment:

[    4.993993] snd_sof:snd_sof_run_firmware: sof-audio-pci-intel-icl 0000:00:1f.3: firmware boot complete
[    4.993994] snd_sof:sof_set_fw_state: sof-audio-pci-intel-icl 0000:00:1f.3: fw_state change: 5 -> 6
[    4.993995] snd_sof:sof_probe_continue: sof-audio-pci-intel-icl 0000:00:1f.3: SOF firmware trace disabled
[    4.994019] snd_sof:ipc3_log_header: sof-audio-pci-intel-icl 0000:00:1f.3: ipc rx done: 0x70000000
[    4.994043] snd_sof:sof_machine_register: sof-audio-pci-intel-icl 0000:00:1f.3: created machine sof-essx8336
[    4.994053] snd_sof_pci:sof_pci_probe_complete: sof-audio-pci-intel-icl 0000:00:1f.3: Completing SOF PCI probe
[    4.996694] sof-essx8336 sof-essx8336: quirk mask 0x0
[    4.996697] sof-essx8336 sof-essx8336: quirk SSP0
[    4.997333] snd_sof:snd_sof_load_topology: sof-audio-pci-intel-icl 0000:00:1f.3: loading topology:intel/sof-tplg/sof-icl-es8336-ssp0.tplg
[    4.998051] sof-audio-pci-intel-icl 0000:00:1f.3: Direct firmware load for intel/sof-tplg/sof-icl-es8336-ssp0.tplg failed with error -2
[    4.998054] sof-audio-pci-intel-icl 0000:00:1f.3: error: tplg request firmware intel/sof-tplg/sof-icl-es8336-ssp0.tplg failed err: -2
[    4.998057] sof-audio-pci-intel-icl 0000:00:1f.3: you may need to download the firmware from https://github.com/thesofproject/sof-bin/
[    4.998058] sof-audio-pci-intel-icl 0000:00:1f.3: error: failed to load DSP topology -2
[    4.998059] sof-audio-pci-intel-icl 0000:00:1f.3: ASoC: error at snd_soc_component_probe on 0000:00:1f.3: -2
[    4.998066] sof-essx8336 sof-essx8336: ASoC: failed to instantiate card -2
[    4.998126] sof-essx8336 sof-essx8336: snd_soc_register_card failed: -2
[    4.998127] sof-essx8336: probe of sof-essx8336 failed with error -2

Attaching full alsa-info: alsa-info-v6.txt @plbossart

plbossart commented 2 years ago

@faerics please try this:

sudo cp /lib/firmware/intel/sof-tplg/sof-jsl-es8336-ssp0.tplg /lib/firmware/intel/sof-tplg/sof-icl-es8336-ssp0.tplg
faerics commented 2 years ago

@plbossart now I have the soundcard but still no sound. But I can hear some noises when changing volume in headphones. What are our next steps? alsa-info-v6+tplg.txt

faerics commented 2 years ago

@plbossart should I change quirk or try something else?

plbossart commented 2 years ago

You can try the quirks suggested here: https://thesofproject.github.io/latest/getting_started/intel_debug/suggestions.html#es8336-support

faerics commented 2 years ago

@plbossart Tested all the quirks, no luck. As per docs, changed 4th, 6th, 7th and 8th of the quirk mask. Results (numbers in breckets are bits enabled; 'no sound at all' options omitted):

noise on headphones (6)
noise on speakers (67)
noise on speakers (678)
noise on startup, no sound (4678)
random noise (7)
noise on headphnoes (4)
noise on speakers (78)
noise on speaker mixed (478)

Can you assist on next steps?

plbossart commented 2 years ago

Sorry @faerics I don't have additional suggestions. The only way to progress would be to read the configuration in the _DSM table suggested in another bug report. I don't have the time to work on this, and no hardware to test. This will have to be a community effort.

Mihara commented 1 year ago

To people who come here googling:

I got this sort of working on my own INBOOK X2 GEN11, which, while a model not identical to the one discussed in this issue, appears to be at least fairly similar:

Machine:
  Type: Laptop System: Infinix product: INBOOK X2 GEN11 v: N/A
    serial: XLCXL2362BK0445
  Mobo: Infinix model: EM_TG325_200B_V1.0 serial: 29961722B1300970
    UEFI: American Megatrends LLC. v: TGL_TG325_200B_V5.1.23 date: 11/10/2022
CPU:
  Info: dual core model: 11th Gen Intel Core i3-1115G4 bits: 64 type: MT MCP
    cache: L2: 2.5 MiB
  Speed (MHz): avg: 2503 min/max: 400/4100 cores: 1: 1015 2: 3000 3: 3000
    4: 3000
Audio:
  Device-1: Intel Tiger Lake-LP Smart Sound Audio
    driver: sof-audio-pci-intel-tgl
  Sound Server-1: ALSA v: k6.1.0-1013-oem running: yes
  Sound Server-2: PulseAudio v: 15.99.1 running: yes

The magic sauce, as it applies to Ubuntu 22.04:

  1. Install kernel 6.1.0 with the linux-oem-22.04c metapackage. Install linux-generic-hwe-22.04-edge metapackage, which will provide you with kernel version 6.2 with Ubuntu's patches, for which you will need to enable jammy-proposed repository. Make sure you have kernel 6.2 or newer, which is available through multiple -hwe and -edge packages by now, or possibly even without.
  2. Install firmware-sof-signed version 2.2.5 from Debian sid or Ubuntu mantic -- I believe these are identical.
  3. Download the custom-kernel repository, and install the missing alsa-ucm definitions with bash ucm.sh once you have the driver loading and no sound.
  4. Add to a file in /etc/modprobe.d/:
# Enable quirks:
# bit 8 - HEADSET_MIC1
# bit 7 - HEADPHONE_GPIO
options snd_soc_sof_es8336 quirk=0x80

(I originally had 0x180 for the quirk, but further experimentation revealed that 0x100 is unnecessary.)

Mess with alsamixer low-level volume levels for optimal results.

Caveats:

  1. There's a popping sound on bootup.
  2. Microphone does not work and I couldn't figure out where to kick it to get it to work. On this machine, there is apparently no DMIC. Careful study of Windows driver inf files for this machine implies that it should have a DMIC. However, it does not get detected, and when I force enable it, nothing I get out of it resembles actual sound. I do not have a wired mic handy to test if that works, either. There is some microphone input from the analog mic the machine doesn't have, which I can observe by turning recording levels up all the way and tapping the laptop casing, but mysteriously, yelling does not result in recorded sound.
  3. Plugging in headphones or a headset does not generate an event and is not otherwise detected. Switching inputs and outputs with pavucontrol works fine.
  4. I did not test HDMI output yet. While it shouldn't be affected, in theory, there's no telling with these things. HDMI output works with no issues.

Not ideal, but better than could be expected.

faerics commented 1 year ago

@Mihara Hi there, Eugene! Thanks for your input to the issue.

Could you please clarify the step

Mess with alsamixer low-level volume levels for optimal results.

What levels did you tweak and what values did you stick with? In my case, hearing strange noises, but not the actual sound.

Mihara commented 1 year ago

What levels did you tweak and what values did you stick with? In my case, hearing strange noises, but not the actual sound.

I tried tweaking pretty much all of them, so it's hard to describe. Here's what I have right now:

It is important to mention that without an alsa-ucm definition that fits this particular combination of hardware, nothing is going to work and you won't even see these sliders, so see step number 3 if you didn't do that already.

sundramsaysss commented 1 year ago

@Mihara Hi there, Eugene! Thanks for your input to the issue.

Could you please clarify the step

Mess with alsamixer low-level volume levels for optimal results.

What levels did you tweak and what values did you stick with? In my case, hearing strange noises, but not the actual sound.

Hey bro, Your sound started working?

sundramsaysss commented 1 year ago

What levels did you tweak and what values did you stick with? In my case, hearing strange noises, but not the actual sound.

I tried tweaking pretty much all of them, so it's hard to describe. Here's what I have right now:

  • DAC is 70 and this is the slider that controls the actual speaker volume.
  • DAC Ramp Rate is 27 and this affects how quickly volume goes from no sound to the set volume. Why is this even configurable, I couldn't tell you.
  • DAC Recovery Rate is 25 and I couldn't tell you why.
  • DRC Target Level is 100.
  • DRC Winsize is 0.25db/1024 LRCK

It is important to mention that without an alsa-ucm definition that fits this particular combination of hardware, nothing is going to work and you won't even see these sliders, so see step number 3 if you didn't do that already.

Bro I tried every step, still no help?

Mihara commented 1 year ago

Bro I tried every step, still no help?

This phrase is not actually a question, it's a confusing statement with a question mark added onto it.

It is tempting to assume that "tried every step" means "I have exactly the same situation as yours, exactly the same machine as yours, exactly the same Linux distribution as yours, I did everything you listed and I still hear no sound" but experience tells me this is never what people actually mean.

Please describe your situation in greater detail, what you are doing, and what you are expecting to happen that isn't happening.

sundramsaysss commented 1 year ago

Bro I tried every step, still no help?

This phrase is not actually a question, it's a confusing statement with a question mark added onto it.

It is tempting to assume that "tried every step" means "I have exactly the same situation as yours, exactly the same machine as yours, exactly the same Linux distribution as yours, I did everything you listed and I still hear no sound" but experience tells me this is never what people actually mean.

Please describe your situation in greater detail, what you are doing, and what you are expecting to happen that isn't happening.

Sorry for that question mark, but you have same device as me, not same linux distributor but yes pop os 22.04 and I did everything as you did and I got it working,

Thanks.

Bur only one issue that my earphones are not detecting.

Mihara commented 1 year ago

Bur only one issue that my earphones are not detecting.

Mine aren't detecting either, but manually switching them through pavucontrol works.

sundramsaysss commented 1 year ago

snd_soc_sof_es8336

I dont know what happened and sound stopped again

vershik-com commented 1 year ago

Супер! Реально помогло со звуком! Спасибо!!!!

Arkasha-P commented 1 week ago

Супер! Реально помогло со звуком! Спасибо!!!!

что именно ты сделал что у тебя заработало тред стал таким большим что я не понимаю где решение проблемы ?)