Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESSX8326 HID not supported: No sound on GPD pocket 3 #3393

Closed
tonitch opened this issue Jan 25, 2022 · 33 comments
Closed

ESSX8326 HID not supported: No sound on GPD pocket 3 #3393

tonitch opened this issue Jan 25, 2022 · 33 comments
Labels
codec ES8336 codec Codec HW or driver restriction Community end-user or distro-reported issues JSL Jasper Lake platform issues

Comments

@tonitch
Copy link

tonitch commented Jan 25, 2022

Following the mail sent on alsa-devel : https://mailman.alsa-project.org/pipermail/alsa-devel/2022-January/195187.html

@plbossart asked to post and issue here

the sound doesn't work even with dsp_driver set to 1 or 3

here is the alsa-info : http://alsa-project.org/db/?f=7f788dae384202786108c0deceb50b87d6b234d8

@plbossart plbossart added Community end-user or distro-reported issues codec Codec HW or driver restriction codec ES8336 labels Jan 25, 2022
@plbossart
Copy link
Member

If you can extract ACPI tables that would be useful. Install acpica-tools on your device and acpixtract -a acpidump, then attach the gzipped binary.

@plbossart plbossart added the JSL Jasper Lake platform issues label Jan 25, 2022
@plbossart
Copy link
Member

PCI ID 4dc8 -> JasperLake

@plbossart plbossart changed the title No sound on GPD pocket 3 ESSX8326 HID not supported: No sound on GPD pocket 3 Jan 25, 2022
@tonitch
Copy link
Author

tonitch commented Jan 25, 2022

I'm not sure it is exactly what you asked for but here is the output of acpidump gziped
acpidump.out.gz
And here is a tar of all the files from the command acpixtract -a acpidump.out
acpidump.tar.gz
hope this help !

@plbossart
Copy link
Member

dsdt.dsl.txt
nhlt.dsl.txt

The tables show we should use SSP0 for the connection, and it's indeed an audio codec.

I don't know how to interpret the GPIO data, @hli25 can you help (might happen after CNY).

@hli25
Copy link

hli25 commented Jan 26, 2022

From the dsdt.dsl, the first gpio should be pa_enable, this is default setting in current machine driver. The second one is for interrupt. This is compatible with current machine driver.

However, synced with @yangxiaohua2009,ESSX8326 need new codec driver.

copied codec _CRS from dsdt.dsl.txt:

    Device (ESSX)
    {
        Name (_ADR, Zero)  // _ADR: Address
        Name (_HID, "ESSX8326")  // _HID: Hardware ID
        Name (_CID, "ESSX8326")  // _CID: Compatible ID
        Name (_DDN, "Everest Codec Controller ES8326")  // _DDN: DOS Device Name
        Name (_UID, One)  // _UID: Unique ID
        Name (_DEP, Package (0x02)  // _DEP: Dependencies
        {
            GPI0, 
            I2C1
        })
        Method (_SUB, 0, NotSerialized)  // _SUB: Subsystem ID
        {
            Return ("12970124")
        }

        Method (_CRS, 0, NotSerialized)  // _CRS: Current Resource Settings
        {
            Name (SBFB, ResourceTemplate ()
            {
                I2cSerialBusV2 (0x0019, ControllerInitiated, 0x00061A80,
                    AddressingMode7Bit, "\\_SB.PC00.I2C1",
                    0x00, ResourceConsumer, , Exclusive,
                    )
            })
            Name (BBUF, ResourceTemplate ()
            {
                GpioIo (Exclusive, PullDefault, 0x0000, 0x0000, IoRestrictionOutputOnly,
                    "\\_SB.GPI0", 0x00, ResourceConsumer, ,
                    )
                    {   // Pin list
                        0x0000
                    }
            })
            Name (SBFG, ResourceTemplate ()
            {
                GpioInt (Edge, ActiveBoth, Exclusive, PullNone, 0x0000,
                    "\\_SB.GPI0", 0x00, ResourceConsumer, ,
                    )
                    {   // Pin list
                        0x0000
                    }
            })
            CreateWordField (SBFG, 0x17, INT1)
            CreateWordField (BBUF, 0x17, SPIN)
            INT1 = GNUM (0x0702000F)
            SPIN = GNUM (0x07030005)
            Return (ConcatenateResTemplate (SBFB, ConcatenateResTemplate (BBUF, SBFG)))
        }
   ......

@plbossart
Copy link
Member

However, synced with @yangxiaohua2009,ESSX8326 need new codec driver.

What do you mean @hli25 @yangxiaohua2009?
a) an update of the es8316 driver to deal with minor changes in hardware
b) a completely different codec driver to deal with fundamentally incompatible hardware.

In the latter case, the machine driver wouldn't work since it would rely on the wrong components in the dailink.

These platforms are on their way to beat Baytrail in terms of general confusion and lack of drivers...Oh well.

@plbossart
Copy link
Member

From the dsdt.dsl, the first gpio should be pa_enable, this is default setting in current machine driver. The second one is for interrupt. This is compatible with current machine driver.

Thanks @hli25. Is there a way to detect which GPIO is used for what directly from the DSDT? That would remove the need for quirks for the pa_enable, that would be really good.

@yangxiaohua2009
Copy link

ES8326 is a completely different hardware compared with ES8316.
The machine driver of ES8316 and ES8326 is almost the same except the dailink.
It would be good if one machine driver can handle both codecs.
I do have a working codec driver here.
es8326.zip

@hli25
Copy link

hli25 commented Jan 27, 2022

From the dsdt.dsl, the first gpio should be pa_enable, this is default setting in current machine driver. The second one is for interrupt. This is compatible with current machine driver.

Thanks @hli25. Is there a way to detect which GPIO is used for what directly from the DSDT? That would remove the need for quirks for the pa_enable, that would be really good.

Hi Pierre,
Regarding to the gpios, _DSD always missed in DSDT, so we may not get right gpio by its name/lable. That's why we adopt the mapping table to access it: https://www.kernel.org/doc/Documentation/firmware-guide/acpi/gpio-properties.rst
Not sure we should attempt to request the 1st gpio, and then the 2nd if the 1st one is not available, but this solution is really ugly.
please correct me if there is any misunderstanding.

@plbossart
Copy link
Member

ES8326 is a completely different hardware compared with ES8316. The machine driver of ES8316 and ES8326 is almost the same except the dailink. It would be good if one machine driver can handle both codecs. I do have a working codec driver here. es8326.zip

Here's a set of comments to bring this code to a level of quality compatible with upstream requirements

  • use SPDX line for copyright
  • don't use C++ // comments in code
  • remove dead code that's commented out
  • use kernel alignment/indendation.
  • sort headers by alphabetical order
  • remove DEBUG
  • avoid hard-coded registers addresses and values, use defines and masks
  • remove 'master/slave' and use producer/consumer (CBP CBC)
  • use dev_dbg instead of printk
  • do the allocations (devm_ etc) in the I2C probe function, not the component probe
  • use devm_soc_register_component
  • use meaningful suspend/resume/shutdown functions
  • use helpers to register i2c driver, not open coding for es8326_modinit

@yangxiaohua2009
Copy link

ES8326 is a completely different hardware compared with ES8316. The machine driver of ES8316 and ES8326 is almost the same except the dailink. It would be good if one machine driver can handle both codecs. I do have a working codec driver here. es8326.zip

Here's a set of comments to bring this code to a level of quality compatible with upstream requirements

  • use SPDX line for copyright
  • don't use C++ // comments in code
  • remove dead code that's commented out
  • use kernel alignment/indendation.
  • sort headers by alphabetical order
  • remove DEBUG
  • avoid hard-coded registers addresses and values, use defines and masks
  • remove 'master/slave' and use producer/consumer (CBP CBC)
  • use dev_dbg instead of printk
  • do the allocations (devm_ etc) in the I2C probe function, not the component probe
  • use devm_soc_register_component
  • use meaningful suspend/resume/shutdown functions
  • use helpers to register i2c driver, not open coding for es8326_modinit

Updated code. @plbossart
es8326.zip

@tonitch
Copy link
Author

tonitch commented Feb 7, 2022

I might be wrong but I wanted to test it,
I'm not into modules or anything so I looked up online how to compile and load it so I made a Makefile with

obj-m += es8326.o

all:
	make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules

clean:
	make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean

and ran make

so the error seemed to be that symmetric_rates doesn't exist but symmetric_rate does (I looked up and it is on the soc.h)

make -C /lib/modules/5.16.5-arch1-1/build M=/home/tonitch/Downloads/es8326 modules
make[1]: Entering directory '/usr/lib/modules/5.16.5-arch1-1/build'
make[2]: Warning: File '/home/tonitch/Downloads/es8326/es8326.h' has modification time 21634 s in the future
  CC [M]  /home/tonitch/Downloads/es8326/es8326.o
/home/tonitch/Downloads/es8326/es8326.c:603:18: error: ‘struct snd_soc_dai_driver’ has no member named ‘symmetric_rates’; did you mean ‘symmetric_rate’?
  603 |                 .symmetric_rates = 1,
      |                  ^~~~~~~~~~~~~~~
      |                  symmetric_rate
/home/tonitch/Downloads/es8326/es8326.c:603:36: warning: initialization of ‘const struct snd_soc_cdai_ops *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
  603 |                 .symmetric_rates = 1,
      |                                    ^
/home/tonitch/Downloads/es8326/es8326.c:603:36: note: (near initialization for ‘es8326_dai.cops’)
/home/tonitch/Downloads/es8326/es8326.c: In function ‘es8326_i2c_probe’:
/home/tonitch/Downloads/es8326/es8326.c:750:17: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
  750 |                 if (!es8326->mclk)
      |                 ^~
/home/tonitch/Downloads/es8326/es8326.c:752:33: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
  752 |                                 ret = clk_prepare_enable(es8326->mclk);
      |                                 ^~~
make[2]: *** [scripts/Makefile.build:287: /home/tonitch/Downloads/es8326/es8326.o] Error 1
make[1]: *** [Makefile:1846: /home/tonitch/Downloads/es8326] Error 2
make[1]: Leaving directory '/usr/lib/modules/5.16.5-arch1-1/build'
make: *** [Makefile:4: all] Error 2

Anyway, I suppose you know what you are doing more than me but I wanted to give it a try anyway (worst case scenario, I will load my backup and I will be gtg again) so I replaced it with symmetric_rate = 1

then compile and it worked I now have a es8326.ko file that I wanted to load

so I tried to load it with insmod es8326.ko but I got insmod: ERROR: could not insert module es8326.ko: Unknown symbol in module

So here I am ^^ This whole thing might be irrelevant but I wanted to share in case there is anything useful in it

Anyway thank you for you work! it is really appreciated

@plbossart
Copy link
Member

ES8326 is a completely different hardware compared with ES8316. The machine driver of ES8316 and ES8326 is almost the same except the dailink. It would be good if one machine driver can handle both codecs. I do have a working codec driver here. es8326.zip

Here's a set of comments to bring this code to a level of quality compatible with upstream requirements

  • use SPDX line for copyright
  • don't use C++ // comments in code
  • remove dead code that's commented out
  • use kernel alignment/indendation.
  • sort headers by alphabetical order
  • remove DEBUG
  • avoid hard-coded registers addresses and values, use defines and masks
  • remove 'master/slave' and use producer/consumer (CBP CBC)
  • use dev_dbg instead of printk
  • do the allocations (devm_ etc) in the I2C probe function, not the component probe
  • use devm_soc_register_component
  • use meaningful suspend/resume/shutdown functions
  • use helpers to register i2c driver, not open coding for es8326_modinit

Updated code. @plbossart es8326.zip

The code looks mostly ok @yangxiaohua2009 but I would recommend you submit a proper PR or patch with your Signed-off-by tag, otherwise it's hard to review. You would also want to have the Makefile changes so that people can compile and run tests.

I also noted that the indentation is off, and that you didn't cleanup the 'master/slave' references.

@yangxiaohua2009
Copy link

Created a PR. @plbossart

@tonitch
Copy link
Author

tonitch commented Feb 11, 2022

again, I'm really not an expert but I tried to pull your branch, I compiled it and now I'm running it,

I clearry can be wrong but I tried with and without dsp config to 1 and either doesn't work for me

can I give any info on that ?

@tonitch
Copy link
Author

tonitch commented Feb 14, 2022

Hello,
Today the gdk team released what they call "sound firmware for N6000" (this is the firmware I own)
this is great in a way but this took me 3 sec by looking to the process to see that they don't really know what they are doing and I can't really trust that, I will try to analyze and install it my own way to see if it works but maybe this could be usefull for any of you ?

https://www.indiegogo.com/projects/pocket-3-a-modular-and-full-featured-handheld-pc#/updates/28

@yangxiaohua2009
Copy link

Hello, Today the gdk team released what they call "sound firmware for N6000" (this is the firmware I own) this is great in a way but this took me 3 sec by looking to the process to see that they don't really know what they are doing and I can't really trust that, I will try to analyze and install it my own way to see if it works but maybe this could be usefull for any of you ?

https://www.indiegogo.com/projects/pocket-3-a-modular-and-full-featured-handheld-pc#/updates/28

This update should solve your problem, go ahead and install it. Will ask the GPD team to update their kernel later.

@tonitch
Copy link
Author

tonitch commented Feb 15, 2022 via email

@ensayia
Copy link

ensayia commented Apr 30, 2022

Running kernel 5.17.5 and audio still does not work for this device. I would like to help look into this issue as these devices are in far more hands now than back at initial launch. Here is my dmesg info regarding the hardware:
EDIT: Cleaned up code block.

[Fri Apr 29 21:46:25 2022] snd_hda_intel 0000:00:1f.3: DSP detected with PCI class/subclass/prog-if info 0x040100
[Fri Apr 29 21:46:25 2022] sof-essx8336 sof-essx8336: snd_soc_register_card failed: -517
[Fri Apr 29 21:46:25 2022] sof-audio-pci-intel-icl 0000:00:1f.3: DSP detected with PCI class/subclass/prog-if info 0x040100
[Fri Apr 29 21:46:25 2022] sof-audio-pci-intel-icl 0000:00:1f.3: enabling device (0000 -> 0002)
[Fri Apr 29 21:46:25 2022] sof-audio-pci-intel-icl 0000:00:1f.3: DSP detected with PCI class/subclass/prog-if 0x040100
[Fri Apr 29 21:46:25 2022] sof-audio-pci-intel-icl 0000:00:1f.3: bound 0000:00:02.0 (ops i915_audio_component_bind_ops [i915])
[Fri Apr 29 21:46:25 2022] sof-audio-pci-intel-icl 0000:00:1f.3: use msi interrupt mode
[Fri Apr 29 21:46:25 2022] sof-audio-pci-intel-icl 0000:00:1f.3: hda codecs found, mask 4
[Fri Apr 29 21:46:25 2022] sof-audio-pci-intel-icl 0000:00:1f.3: Firmware info: version 2:1:1-3964a
[Fri Apr 29 21:46:25 2022] sof-audio-pci-intel-icl 0000:00:1f.3: Firmware: ABI 3:21:0 Kernel ABI 3:18:0
[Fri Apr 29 21:46:25 2022] sof-audio-pci-intel-icl 0000:00:1f.3: warn: FW ABI is more recent than kernel
[Fri Apr 29 21:46:25 2022] sof-audio-pci-intel-icl 0000:00:1f.3: unknown sof_ext_man header type 3 size 0x30
[Fri Apr 29 21:46:25 2022] sof-audio-pci-intel-icl 0000:00:1f.3: Firmware info: version 2:1:1-3964a
[Fri Apr 29 21:46:25 2022] sof-audio-pci-intel-icl 0000:00:1f.3: Firmware: ABI 3:21:0 Kernel ABI 3:18:0
[Fri Apr 29 21:46:25 2022] sof-audio-pci-intel-icl 0000:00:1f.3: warn: FW ABI is more recent than kernel

@tonitch
Copy link
Author

tonitch commented May 1, 2022

I can confirm that the issue is not solved for me ^^

@tonitch
Copy link
Author

tonitch commented May 18, 2022

here is the new alsa-info.sh in case this can help ?
http://alsa-project.org/db/?f=b984fb47dad3c9247fe8c8ee3926e3d4914b7db8

@plbossart
Copy link
Member

plbossart commented May 18, 2022

@tonitch the error is 'normal', -517 means 'deferred probe'. The machine driver expects resources that are not available.

That's again normal, you have a 8326 codec, not 8336, and the codec driver is not upstream so there's no component registered to make the machine driver happy.

You will have to ask nicely to the vendor to complete this work. @yangxiaohua2009 FYI

https://lore.kernel.org/alsa-devel/YkxL51j8E11u0uV%2F@sirena.org.uk/

@yangxiaohua2009
Copy link

here is the new alsa-info.sh in case this can help ? http://alsa-project.org/db/?f=b984fb47dad3c9247fe8c8ee3926e3d4914b7db8

Please tried the patch and tell us if you can hear sound from headphone.

@tonitch
Copy link
Author

tonitch commented May 19, 2022

Please tried the patch and tell us if you can hear sound from headphone.

Which patch do you mean ?
If this is the one you sent, I though it was in the main branch now ? I'm using 5.17 and saw the commit pop in somewhere

If you talk about the patch I told you the gpd team published, it was a piece of security nightmare. But I tried it anyway, it didn't worked and the god team removed the patch not even a week after -_-

They don't know linux and don't really try to support it unfortunately. I'm trying to dig myself and understand what is happening (following things I find on lwn on acpi for instance) but this is the first time and I honestly don't really know what I am doing...

Hopefully, one day this sound card model will be supported one way or the other

I talked with tomty89 on #linux who made this post tho #4591

I don't know if this concert my card too or not at all

Ps: I really understand that you are volunteer and don't want to disrespect at all in any way 😉

@yangxiaohua2009
Copy link

Please tried the patch and tell us if you can hear sound from headphone.

Which patch do you mean ? If this is the one you sent, I though it was in the main branch now ? I'm using 5.17 and saw the commit pop in somewhere

If you talk about the patch I told you the gpd team published, it was a piece of security nightmare. But I tried it anyway, it didn't worked and the god team removed the patch not even a week after -_-

They don't know linux and don't really try to support it unfortunately. I'm trying to dig myself and understand what is happening (following things I find on lwn on acpi for instance) but this is the first time and I honestly don't really know what I am doing...

Hopefully, one day this sound card model will be supported one way or the other

I talked with tomty89 on #linux who made this post tho thesofproject/linux#4591

I don't know if this concert my card too or not at all

Ps: I really understand that you are volunteer and don't want to disrespect at all in any way 😉

Please use this patch on your kernel source code because the code is out of main branch.
0001-ASoC-codecs-add-support-for-ES8326.zip

@tonitch
Copy link
Author

tonitch commented May 19, 2022

It took me sooo long to compile but yhea it finally worked ! thanks a lot, I will close this issue! I suppose you can push that to the main branch somehow ^^

@tonitch tonitch closed this as completed May 19, 2022
@thatnerdjosh
Copy link

@yangxiaohua2009 - I am not a firmware developer, but it had sounded like this patch worked great for @tonitch, was just wondering why plbossart#25 was closed

If it works, this would be a great thing to have upstream so that other users could benefit from not needing to custom compile their kernel for audio support on a device with ESSX8326 HID :)

@thatnerdjosh
Copy link

I've spent the last couple days trying to get this to work without much success. @tonitch - how did you get it working in arch? I am in arch linux as well

lspci -v:

...
00:1f.3 Multimedia audio controller: Intel Corporation Jasper Lake HD Audio (rev 01)
	DeviceName: Onboard - Sound
	Subsystem: Holco Enterprise Co, Ltd/Shuttle Computer Device 0000
	Flags: bus master, fast devsel, latency 32, IRQ 136
	Memory at 6001120000 (64-bit, non-prefetchable) [size=16K]
	Memory at 6001000000 (64-bit, non-prefetchable) [size=1M]
	Capabilities: <access denied>
	Kernel driver in use: sof-audio-pci-intel-icl
	Kernel modules: snd_sof_pci_intel_icl
...

lsmod

snd_compress           24576  2 snd_soc_core,snd_sof_probes
snd_pcm               131072  5 snd_sof,snd_sof_intel_hda_common,snd_compress,snd_soc_core,snd_sof_utils
snd_timer              40960  1 snd_pcm
snd                    98304  5 snd_sof,snd_timer,snd_compress,snd_soc_core,snd_pcm
i2c_hid_acpi           16384  0
i2c_hid                28672  1 i2c_hid_acpi
processor_thermal_mbox    16384  2 processor_thermal_rfim,processor_thermal_device
hid                   143360  3 i2c_hid,usbhid,hid_generic
intel_soc_dts_iosf     20480  1 processor_thermal_device_pci_legacy
regmap_i2c             16384  1 snd_soc_es8326
int3403_thermal        20480  0

dmesg | grep sof

[    4.346850] sof-audio-pci-intel-icl 0000:00:1f.3: DSP detected with PCI class/subclass/prog-if info 0x040100
[    4.346932] sof-audio-pci-intel-icl 0000:00:1f.3: enabling device (0000 -> 0002)
[    4.347140] sof-audio-pci-intel-icl 0000:00:1f.3: DSP detected with PCI class/subclass/prog-if 0x040100
[    4.349319] sof-audio-pci-intel-icl 0000:00:1f.3: use msi interrupt mode
[    4.353773] sof-audio-pci-intel-icl 0000:00:1f.3: NHLT_DEVICE_I2S detected, ssp_mask 0x1
[    4.355406] sof-audio-pci-intel-icl 0000:00:1f.3: Firmware info: version 2:2:0-57864
[    4.355410] sof-audio-pci-intel-icl 0000:00:1f.3: Firmware: ABI 3:22:1 Kernel ABI 3:19:1
[    4.355413] sof-audio-pci-intel-icl 0000:00:1f.3: warn: FW ABI is more recent than kernel
[    4.355420] sof-audio-pci-intel-icl 0000:00:1f.3: unknown sof_ext_man header type 3 size 0x30
[    4.456763] sof-audio-pci-intel-icl 0000:00:1f.3: Firmware info: version 2:2:0-57864
[    4.456769] sof-audio-pci-intel-icl 0000:00:1f.3: Firmware: ABI 3:22:1 Kernel ABI 3:19:1
[    4.456771] sof-audio-pci-intel-icl 0000:00:1f.3: warn: FW ABI is more recent than kernel

aplay -l

aplay -l
aplay: device_list:275: no soundcards found...

@thatnerdjosh
Copy link

For anyone potentially stuck on this in the future... the patch works great, but in my case I had disabled SND_SOC_INTEL_SOF_ES8336_MACH

It seems that kernel option is necessary to communicate with the 8336/8326 when on the intel SoC

@thatnerdjosh
Copy link

@yangxiaohua2009 - I'm noticing audio popping with this codec, is this expected?

@yangxiaohua2009
Copy link

SND_SOC_INTEL_SOF_ES8336_MACH

You need to enable SND_SOC_INTEL_SOF_ES8336_MACH otherwise you won't have soundcard.

@thatnerdjosh
Copy link

@yangxiaohua2009 , yup that's what I was mentioning in my comment. I had that disabled but it needed to be enabled

Do you know why this audio codec has popping issues? Also are there any plans to merge this upstream?

asheplyakov pushed a commit to altlinux/linux-arm that referenced this issue Sep 7, 2022
Based on ALSA SoF development branch.
Refer to:
Link: thesofproject#3393
Link: thesofproject#3508

Signed-off-by: Vasily Vinogradov <v.vinogradov@aq.ru>
Signed-off-by: Nikolai Kostrigin <nickel@altlinux.org>
@SelfRef
Copy link

SelfRef commented Jan 9, 2023

I was about to compile the newest Arch kernel with this patch but realized it was already applied.

It turns out this patch have been merged upstream and is in Linux since version 6.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
codec ES8336 codec Codec HW or driver restriction Community end-user or distro-reported issues JSL Jasper Lake platform issues
Projects
None yet
Development

No branches or pull requests

7 participants