[alsa-devel] Cherry trail and Nau 88l24 codec
Hi all,
I've been trying to get sound working on my W9S pipo device. The people at Nuvoton have been extraordinarily helpful, but now the issue is writing the machine driver.
My work is at
https://github.com/joequant/nau8824
I've gotten the drivers to load, but getting timeouts with the firmware....
[ 102.447840] intel_sst_acpi 808622A8:00: Wait timed-out condition:0x0, msg_id:0x2 fw_state 0x3 [ 102.447872] intel_sst_acpi 808622A8:00: fw returned err -16 [ 103.471448] intel_sst_acpi 808622A8:00: Wait timed-out condition:0x0, msg_id:0x2 fw_state 0x3
and then
[ 116.820782] intel_sst_acpi 808622A8:00: fw returned err -16 [ 116.938921] intel_sst_acpi 808622A8:00: FW sent error response 0x5000e [ 116.939065] intel_sst_acpi 808622A8:00: FW sent error response 0x5000e [ 116.939579] intel_sst_acpi 808622A8:00: FW sent async error msg: [ 116.939614] (null)00040021 00000000 [ 116.939685] (null)00040021 00000000 [ 116.953260] sst-mfld-platform sst-mfld-platform: Enter: enable=1 port_name=ssp2-port [ 116.953704] intel_sst_acpi 808622A8:00: Alloc for str 3 pipe 0xe [ 116.954062] sst-mfld-sst-mfld-platform: SET_SWM cmd max inputs reached
One other path is that ICube has gotten this codec to work on their iwork8 Ultimate android device. They are required to release the source under GPL2, but haven't done so, so if all else fails, it will be a matter of tracking down someone in that company and explaining the issues to them. Since I'm in Hong Kong, I might just find where the things are manufactured, and just show up at their office.
But it appears that there are some "magic bits" that are missing. One question that I have is what is the proper DAI to use (i.e. PCM or I2S) for cherry trail. The second question is that looking at the windows driver for nau88l24, there appears to be a test mode that runs the driver against a Realtek rt5645. Should I assume that this means that the initialization is similar?
Also I'm quite interested in getting this to work. The W9S Pipo is a perfect netbook that has a big screen that is half the weight of my old laptop. The big thing is that someone realized that instead of putting in a SATA hard disk, that they can use an SD card as main storage, and that cuts down on the weight.
On 12/2/16 7:16 PM, Joseph Wang wrote:
Hi all,
I've been trying to get sound working on my W9S pipo device. The people at Nuvoton have been extraordinarily helpful, but now the issue is writing the machine driver.
My work is at
https://github.com/joequant/nau8824
I've gotten the drivers to load, but getting timeouts with the firmware....
[ 102.447840] intel_sst_acpi 808622A8:00: Wait timed-out condition:0x0, msg_id:0x2 fw_state 0x3 [ 102.447872] intel_sst_acpi 808622A8:00: fw returned err -16 [ 103.471448] intel_sst_acpi 808622A8:00: Wait timed-out condition:0x0, msg_id:0x2 fw_state 0x3
and then
[ 116.820782] intel_sst_acpi 808622A8:00: fw returned err -16 [ 116.938921] intel_sst_acpi 808622A8:00: FW sent error response 0x5000e [ 116.939065] intel_sst_acpi 808622A8:00: FW sent error response 0x5000e [ 116.939579] intel_sst_acpi 808622A8:00: FW sent async error msg: [ 116.939614] (null)00040021 00000000 [ 116.939685] (null)00040021 00000000 [ 116.953260] sst-mfld-platform sst-mfld-platform: Enter: enable=1 port_name=ssp2-port [ 116.953704] intel_sst_acpi 808622A8:00: Alloc for str 3 pipe 0xe [ 116.954062] sst-mfld-sst-mfld-platform: SET_SWM cmd max inputs reached
Just a wild guess: this looks the communication with the DSP isn't working and the messages look similar to what we saw with Baytrail-CR where a BIOS genius decided to swap the order of interrupt resources.
Can you share the DSDT (on a pastebin, not as attachment) so that we can compare the BIOS information for the DSP with known and working configurations.
One other path is that ICube has gotten this codec to work on their iwork8 Ultimate android device. They are required to release the source under GPL2, but haven't done so, so if all else fails, it will be a matter of tracking down someone in that company and explaining the issues to them. Since I'm in Hong Kong, I might just find where the things are manufactured, and just show up at their office.
But it appears that there are some "magic bits" that are missing. One question that I have is what is the proper DAI to use (i.e. PCM or I2S) for cherry trail. The second question is that looking at the windows driver for nau88l24, there appears to be a test mode that runs the driver against a Realtek rt5645. Should I assume that this means that the initialization is similar?
Also I'm quite interested in getting this to work. The W9S Pipo is a perfect netbook that has a big screen that is half the weight of my old laptop. The big thing is that someone realized that instead of putting in a SATA hard disk, that they can use an SD card as main storage, and that cuts down on the weight.
I've dumped the DSDT into a github gist
https://gist.github.com/joequant/8fbdcbb71204562505b6647b18c608ef
Nothing particularly strange to me stands out. I'm trying to get in touch twith the manufacturer, and I'm here in HK so if I get really bored or adventurous, I might just walk over to the factory and see if I can meet the designers directly.
Also, just a note of thanks for the support for open source by Intel. I realize that driver design is a pain, but it's really useful. The reason that I'm extremely keen to get this working is that they've put together a new laptop configuration that I've never seen before. What they've done is to rip out the hard drive and replace it with an MMC device. That recreates a device that is both superlight and supercheap.
Hi Joseph, After checking the dsl of pipo, I think you should add the property values as follows in the ACPI configuration. Then you can check the driver can get these values in nau8824_read_device_properties. Name (_DSD, Package () { ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), Package () { /* Enable jack detection via JKDET pin */ Package () { "nuvoton,jkdet-enable", 1 }, /* * JKDET pin is pulled up by R389 on board. * JKDET pin polarity = active low */ Package () { "nuvoton,jkdet-pull-enable", 1 }, Package () { "nuvoton,jkdet-pull-up", 1 }, Package () { "nuvoton,jkdet-polarity", 1 }, /* VDDA(1.8) * 1.53 = 2.754 */ Package () { "nuvoton,micbias-voltage", 6 }, /* VREF Impedance = 125 kOhm */ Package () { "nuvoton,vref-impedance", 2 }, /* * Setup 4 buttons impedance according to * Android specification */ Package () { "nuvoton,sar-threshold-num", 4 }, Package () { "nuvoton,sar-threshold", Package() { 0x0a, 0x14, 0x26, 0x73 } }, /* * Coeff 0-15 used to adjust threshold level * 0 for low resist range */ Package () { "nuvoton,sar-hysteresis", 0 }, /* SAR tracking gain based on 2.754 micbias-voltage */ Package () { "nuvoton,sar-voltage", 6 }, /* 100ms short key press debounce */ Package () { "nuvoton,short-key-debounce", 3 }, /* 2^(7+2) = 512 ms insert/eject debounce */ Package () { "nuvoton,jack-insert-debounce", 7 }, /* debounce not needed for eject normally */ Package () { "nuvoton,jack-eject-debounce", 0 }, } })
BR. John Hsu AC30, Nuvoton Technology Corp. +886 3 5770066 Ext. 37111 KCHSU0@nuvoton.commailto:KCHSU0@nuvoton.com
From: Joseph Wang [mailto:joequant@gmail.com] Sent: Sunday, December 04, 2016 10:19 PM To: Pierre-Louis Bossart Cc: AP MS30 Linux ALSA; AC30 KCHsu0 Subject: Re: Cherry trail and Nau 88l24 codec
I've dumped the DSDT into a github gist
https://gist.github.com/joequant/8fbdcbb71204562505b6647b18c608ef
Nothing particularly strange to me stands out. I'm trying to get in touch twith the manufacturer, and I'm here in HK so if I get really bored or adventurous, I might just walk over to the factory and see if I can meet the designers directly. Also, just a note of thanks for the support for open source by Intel. I realize that driver design is a pain, but it's really useful. The reason that I'm extremely keen to get this working is that they've put together a new laptop configuration that I've never seen before. What they've done is to rip out the hard drive and replace it with an MMC device. That recreates a device that is both superlight and supercheap. [https://ssl.gstatic.com/ui/v1/icons/mail/images/cleardot.gif]
=========================================================================================== The privileged confidential information contained in this email is intended for use only by the addressees as indicated by the original sender of this email. If you are not the addressee indicated in this email or are not responsible for delivery of the email to such a person, please kindly reply to the sender indicating this fact and delete all copies of it from your computer and network server immediately. Your cooperation is highly appreciated. It is advised that any unauthorized use of confidential information of Nuvoton is strictly prohibited; and any information in this email irrelevant to the official business of Nuvoton shall be deemed as neither given nor endorsed by Nuvoton.
Hi Joseph,
The following log shows the SST DSP firmware version which we used in our development kit. Maybe you can confirm which version in your platform. [ 2.681633] snd_intel_sst: Requesting FW fw_sst_22a8.bin now...
BR. John Hsu AC30, Nuvoton Technology Corp. +886 3 5770066 Ext. 37111 KCHSU0@nuvoton.commailto:KCHSU0@nuvoton.com
From: Joseph Wang [mailto:joequant@gmail.com] Sent: Saturday, December 03, 2016 9:17 AM To: AP MS30 Linux ALSA; pierre-louis.bossart@linux.intel.com; AC30 KCHsu0 Subject: Cherry trail and Nau 88l24 codec
Hi all, I've been trying to get sound working on my W9S pipo device. The people at Nuvoton have been extraordinarily helpful, but now the issue is writing the machine driver. My work is at
https://github.com/joequant/nau8824 I've gotten the drivers to load, but getting timeouts with the firmware....
[ 102.447840] intel_sst_acpi 808622A8:00: Wait timed-out condition:0x0, msg_id:0x2 fw_state 0x3 [ 102.447872] intel_sst_acpi 808622A8:00: fw returned err -16 [ 103.471448] intel_sst_acpi 808622A8:00: Wait timed-out condition:0x0, msg_id:0x2 fw_state 0x3 and then
[ 116.820782] intel_sst_acpi 808622A8:00: fw returned err -16 [ 116.938921] intel_sst_acpi 808622A8:00: FW sent error response 0x5000e [ 116.939065] intel_sst_acpi 808622A8:00: FW sent error response 0x5000e [ 116.939579] intel_sst_acpi 808622A8:00: FW sent async error msg: [ 116.939614] (null)00040021 00000000 [ 116.939685] (null)00040021 00000000 [ 116.953260] sst-mfld-platform sst-mfld-platform: Enter: enable=1 port_name=ssp2-port [ 116.953704] intel_sst_acpi 808622A8:00: Alloc for str 3 pipe 0xe [ 116.954062] sst-mfld-sst-mfld-platform: SET_SWM cmd max inputs reached One other path is that ICube has gotten this codec to work on their iwork8 Ultimate android device. They are required to release the source under GPL2, but haven't done so, so if all else fails, it will be a matter of tracking down someone in that company and explaining the issues to them. Since I'm in Hong Kong, I might just find where the things are manufactured, and just show up at their office. But it appears that there are some "magic bits" that are missing. One question that I have is what is the proper DAI to use (i.e. PCM or I2S) for cherry trail. The second question is that looking at the windows driver for nau88l24, there appears to be a test mode that runs the driver against a Realtek rt5645. Should I assume that this means that the initialization is similar? Also I'm quite interested in getting this to work. The W9S Pipo is a perfect netbook that has a big screen that is half the weight of my old laptop. The big thing is that someone realized that instead of putting in a SATA hard disk, that they can use an SD card as main storage, and that cuts down on the weight.
=========================================================================================== The privileged confidential information contained in this email is intended for use only by the addressees as indicated by the original sender of this email. If you are not the addressee indicated in this email or are not responsible for delivery of the email to such a person, please kindly reply to the sender indicating this fact and delete all copies of it from your computer and network server immediately. Your cooperation is highly appreciated. It is advised that any unauthorized use of confidential information of Nuvoton is strictly prohibited; and any information in this email irrelevant to the official business of Nuvoton shall be deemed as neither given nor endorsed by Nuvoton.
[ 2.681633] snd_intel_sst: Requesting FW fw_sst_22a8.bin now...
Hi,
This is the firmware that I am using. Right now the problem is that I'm getting timeouts. I've confirmed that the device runs fine under the Windows WDM Audio drivers and the Windows NAUL88 codec. So what appears to be happening is that machine driver is doing something incorrectly.
If you can look at
https://github.com/joequant/nau8824/blob/master/linux-4.8/cht_bsw_nau8824.c
And check to see how the initialization is different than the Windows driver, this would be very useful. I don't know how the device is wired, but I do know that it appears to work with the Cherry Trail windows drivers. That being the case, I think the issue is my misinitialization rather than device quirk.
Also to answer your other question. I am no longer getting kernel errors in the codec. I believe that at one point I was loading old versions of the codec, but once I did a clean build with the sources that you've provided me, I get no issues with the codec, and I've removed the workaround code. The problems that I'm having with the firmware appear to arise from the machine drivers.
One other thing, I was wondering if you have a Cherry Trail dev environment that you can test to see if you can load in my machine driver and replicate the firmware time outs.
Hi Joseph,
The initiation is different from windows. It is fine as I think because the codec driver is different between two systems. The machine driver is only to bring up the sound device. If you can see the sound card in your platform, the machine driver has worked as well. Could you check the following information in your platform now?
1. Can register dump work? Try the command. Ex.
# cat /sys/kernel/debug/regmap/i2c-10508824:00/registers
2. Can you see sound card info.? There are some virtual files in the folder and you can cat the info..
/sys/devices/platform/cht-bsw-nau8824/SSP2-Codec
/proc/asound/
Besides, I think the timeout is nothing with the machine and codec. Maybe you can consult with Intel about the issue.
BR. John Hsu AC30, Nuvoton Technology Corp. +886 3 5770066 Ext. 37111 KCHSU0@nuvoton.commailto:KCHSU0@nuvoton.com
From: Joseph Wang [mailto:joequant@gmail.com] Sent: Monday, December 05, 2016 2:46 PM To: AC30 KCHsu0 Cc: AP MS30 Linux ALSA; Pierre-Louis Bossart; AC30 CTLin0 Subject: Re: Cherry trail and Nau 88l24 codec
[ 2.681633] snd_intel_sst: Requesting FW fw_sst_22a8.bin now...
Hi, This is the firmware that I am using. Right now the problem is that I'm getting timeouts. I've confirmed that the device runs fine under the Windows WDM Audio drivers and the Windows NAUL88 codec. So what appears to be happening is that machine driver is doing something incorrectly. If you can look at
https://github.com/joequant/nau8824/blob/master/linux-4.8/cht_bsw_nau8824.c And check to see how the initialization is different than the Windows driver, this would be very useful. I don't know how the device is wired, but I do know that it appears to work with the Cherry Trail windows drivers. That being the case, I think the issue is my misinitialization rather than device quirk. Also to answer your other question. I am no longer getting kernel errors in the codec. I believe that at one point I was loading old versions of the codec, but once I did a clean build with the sources that you've provided me, I get no issues with the codec, and I've removed the workaround code. The problems that I'm having with the firmware appear to arise from the machine drivers. One other thing, I was wondering if you have a Cherry Trail dev environment that you can test to see if you can load in my machine driver and replicate the firmware time outs.
=========================================================================================== The privileged confidential information contained in this email is intended for use only by the addressees as indicated by the original sender of this email. If you are not the addressee indicated in this email or are not responsible for delivery of the email to such a person, please kindly reply to the sender indicating this fact and delete all copies of it from your computer and network server immediately. Your cooperation is highly appreciated. It is advised that any unauthorized use of confidential information of Nuvoton is strictly prohibited; and any information in this email irrelevant to the official business of Nuvoton shall be deemed as neither given nor endorsed by Nuvoton.
On 12/5/16 12:45 AM, Joseph Wang wrote:
[ 2.681633] snd_intel_sst: Requesting FW fw_sst_22a8.bin now...
Hi,
This is the firmware that I am using. Right now the problem is that I'm getting timeouts. I've confirmed that the device runs fine under the Windows WDM Audio drivers and the Windows NAUL88 codec. So what appears to be happening is that machine driver is doing something incorrectly.
If you can look at
https://github.com/joequant/nau8824/blob/master/linux-4.8/cht_bsw_nau8824.c
The only thing that comes to my mind and that might tie firmware with the machine driver is the use of this:
fmt = SND_SOC_DAIFMT_LEFT_J | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS;
I am not aware of any other drivers using LEFT_J, why can't you use I2S for 2ch links?
And check to see how the initialization is different than the Windows driver, this would be very useful. I don't know how the device is wired, but I do know that it appears to work with the Cherry Trail windows drivers. That being the case, I think the issue is my misinitialization rather than device quirk.
Also to answer your other question. I am no longer getting kernel errors in the codec. I believe that at one point I was loading old versions of the codec, but once I did a clean build with the sources that you've provided me, I get no issues with the codec, and I've removed the workaround code. The problems that I'm having with the firmware appear to arise from the machine drivers.
One other thing, I was wondering if you have a Cherry Trail dev environment that you can test to see if you can load in my machine driver and replicate the firmware time outs. _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Making good progress. I rebuilt and reinstalled my kernel, and the firmware timeouts disappeared. The system is seeing the card. I'm getting the attached errors. While hitting random buttons in alsa mixer, I came up with one combination that gave me static, but I couldn't replicate that. However, it means that something is happening.
I used the following for mixer settings
#DSP routing amixer -c0 sset 'codec_out0 mix 0 pcm0_in' on amixer -c0 sset 'media0_out mix 0 media1_in' on amixer -c0 sset 'media1_in Gain 0' 80% amixer -c0 sset 'media1_in Gain 0 Ramp Delay' 50 amixer -c0 sset 'media1_in Gain 0' off amixer -c0 sset 'pcm0_in Gain 0' 80% amixer -c0 sset 'pcm0_in Gain 0 Ramp Delay' 50 amixer -c0 sset 'pcm0_in Gain 0' off amixer -c0 sset 'codec_out0 Gain 0' 80% amixer -c0 sset 'codec_out0 Gain 0 Ramp Delay' 50 amixer -c0 sset 'codec_out0 Gain 0' off
If someone has some ideas on what the mixer setting should be that would useful. Also, I can't seem to find documentation on how all of the switches work. If someone can point me to that this would also be very useful.
[ 305.825863] Audio Port: ASoC: no backend DAIs enabled for Audio Port [ 305.826348] Audio Port: ASoC: no backend DAIs enabled for Audio Port [ 305.826569] Audio Port: ASoC: no backend DAIs enabled for Audio Port [ 305.828013] Audio Port: ASoC: no backend DAIs enabled for Audio Port [ 305.828560] Audio Port: ASoC: no backend DAIs enabled for Audio Port [ 305.828882] Audio Port: ASoC: no backend DAIs enabled for Audio Port [ 305.830556] Audio Port: ASoC: no backend DAIs enabled for Audio Port [ 305.831284] Audio Port: ASoC: no backend DAIs enabled for Audio Port [ 305.831791] Audio Port: ASoC: no backend DAIs enabled for Audio Port [ 305.834121] sst-mfld-platform sst-mfld-platform: Enter: enable=0 port_name=ssp2-port [ 305.835515] sst-mfld-platform sst-mfld-platform: Enter: enable=0 port_name=ssp2-port [ 305.837214] sst-mfld-platform sst-mfld-platform: Enter: enable=0 port_name=ssp2-port [ 305.838713] sst-mfld-platform sst-mfld-platform: Enter: enable=0 port_name=ssp2-port [ 305.848477] sst-mfld-platform sst-mfld-platform: Enter: enable=1 port_name=ssp2-port [ 305.873277] intel_sst_acpi 808622A8:00: Alloc for str 1 pipe 0x90
Two new items:
1) The firmware time outs happen when I try to turn on all of the switches in alsa mixer and set the volumes and gains of everything to 100%, It doesn't like that.
2) In pulseaudio, I'm only seeing the output device "Headphones". Not sure where this is getting set.
But it looks like things are working up until the mixer, and it's a matter of finding the right magic configurations for those.
On 12/7/16 3:21 AM, Joseph Wang wrote:
Two new items:
- The firmware time outs happen when I try to turn on all of the switches
in alsa mixer and set the volumes and gains of everything to 100%, It doesn't like that.
- In pulseaudio, I'm only seeing the output device "Headphones". Not sure
where this is getting set.
But it looks like things are working up until the mixer, and it's a matter of finding the right magic configurations for those.
Don't try random settings and 100% volume, you're going to lose your hearing or speakers, or both.
start from the mixer values used here for the dsp https://github.com/plbossart/UCM/blob/master/bytcr-rt5640/HiFi
remove everything related to rt5640 and add the modes for each input/output supported by your codec, starting from low volume until you find a setting that seems fine.
you really want to copy paste this directory and rename as needed, and copy the files in /usr/share/alsa/ucm.
participants (3)
-
Joseph Wang
-
KCHSU0@nuvoton.com
-
Pierre-Louis Bossart