burzumishi / linux-baytrail-flexx10

Install GNU/Linux on NextBook Flexx 10.1
GNU General Public License v2.0
82 stars 18 forks source link

Possible progress on the audio #7

Closed nicman23 closed 7 years ago

nicman23 commented 8 years ago

There is some progress/traction on the kernel bugtracker, for our uncommon audio card.

the bug is tracked here.

Our is the insyde reference - see description.

PS: do not try anything from other models. It will not work. Our chip does not have 2 pins (or something technical like that) and it will timeout alsa. Basically, alsa, cannot start the chip - let alone produce sound. No amount of hacking/ trying different firmwares will do anything.

tl;dr : follow the link ; pray to Saint Gnusious

nicman23 commented 8 years ago

If anyone cares to try a diff from a intel dude's repo (that i have forked to make a pull request to get his changes to a more recent repo) you can use that link :)

burzumishi commented 8 years ago

Thank you! It looks Good! I'll give it a try this weekend! :)

nicman23 commented 8 years ago

Did you try it @burzumishi ? Mine is currently on rma hell :C . Also could you post your dmidecode in the bugtracker?

nicman23 commented 8 years ago

can you give me your dmidecode ? I just made an account and we should add it for our machines to be added in the quirk table. Also I will be receiving my tablet from rma tomorrow and i ll run some tests :)

burzumishi commented 8 years ago

Hi! dmidecode flexx10: https://github.com/burzumishi/linux-baytrail-flexx10/blob/master/doc/dmidecode.out

nicman23 commented 8 years ago

Ok I will upload it in the bugtracker when I go home :)

burzumishi commented 8 years ago

OK thank you! We will have to wait for the patch update :)

nicman23 commented 8 years ago

Uploaded, also need recompiled dsdt tablet, as per dev request :-).

nicman23 commented 8 years ago

I'm close... The problem is that the irqs in the dsdt are not how the kernel expects them (as per http://mailman.alsa-project.org/pipermail/alsa-devel/2015-July/094627.html)...

I edited my dsdt and recompiled it... Now there are no dmesg firmware errors. However, there is also no sound... But, I am close...

More in a few days, got some finals left to write.

ps: i promise a tutorial :)

ghost commented 8 years ago

I've adapted the patch linked in the second post. I can load the kernel modules without errors, and hear all kinds of beeps and bonks by playing with the the 1000+ mixer controls, but unfortunately no real audio.

I have a Flexx 9, which is 95% similar. I can tell you that I need to keep acpi_ipc_irq_index at 0, not at 5, otherwise the driver won't load.

YIFANG / NXW9QC132. Audio I2C device 10EC5640.

Tried all the quirks from the other machines in the patch with no success.

nicman23 commented 8 years ago

I did not use the kernel patch. I edited the DSDT and loaded it with grub.

There are no clicks or any heat from the speakers. There is also no sound. Please upload a DSDT.dsl file

ghost commented 8 years ago

Github reports "unfortunately, we don't support that file type".

You'll have to leach it from my web site: http://home.ix.netcom.com/~jjingber/flexx9.dsl

ghost commented 8 years ago

No clicks or heat here - but if you play some audio file in a loop, and gradually unmute the mixer channels, you're going to get something that sounds like a hearing test.

nicman23 commented 8 years ago

The kernel expects this order: (Basically hex from smaller to bigger)

                Interrupt (ResourceConsumer, Level, ActiveLow, Exclusive, ,, )
                {
                    0x00000018,
                }
                Interrupt (ResourceConsumer, Level, ActiveLow, Exclusive, ,, )
                {
                    0x00000019,
                }
                Interrupt (ResourceConsumer, Level, ActiveLow, Exclusive, ,, )
                {
                    0x0000001A,
                }
                Interrupt (ResourceConsumer, Level, ActiveLow, Exclusive, ,, )
                {
                    0x0000001B,
                }
                Interrupt (ResourceConsumer, Level, ActiveLow, Exclusive, ,, )
                {
                    0x0000001C,
                }
                Interrupt (ResourceConsumer, Level, ActiveLow, Exclusive, ,, )
                {
                    0x0000001D,
                }

Your dsdt file has this: (The first one is 1D and then 18, 19 ...)

Interrupt (ResourceConsumer, Level, ActiveLow, Exclusive, ,, )
                {
                    0x0000001D,
                }
                Interrupt (ResourceConsumer, Level, ActiveLow, Exclusive, ,, )
                {
                    0x00000018,
                }
                Interrupt (ResourceConsumer, Level, ActiveLow, Exclusive, ,, )
                {
                    0x00000019,
                }
                Interrupt (ResourceConsumer, Level, ActiveLow, Exclusive, ,, )
                {
                    0x0000001A,
                }
                Interrupt (ResourceConsumer, Level, ActiveLow, Exclusive, ,, )
                {
                    0x0000001B,
                }
                Interrupt (ResourceConsumer, Level, ActiveLow, Exclusive, ,, )
                {
                    0x0000001C,
                }
nicman23 commented 8 years ago

Sorry missclick

ghost commented 8 years ago

Your dsdt file has this: (The first one is 1D and then 18, 19 ...)

Roger..... Playing with this now.

nicman23 commented 8 years ago

The sound you are hearing is basically dc current in your speakers. I have already blown one and had to rma it (and pay for the replacement) ...

ghost commented 8 years ago

The sound you are hearing is basically dc current in your speakers. I have already blown one and had to rma it (and pay for the replacement) ...

Understood.

ghost commented 8 years ago

UPDATED: Alright, got it working --

  1. Kernel 4.6.3.
  2. Apply the following patch, (adapted from "2.diff" in second post, with IRQ workaround and quirks for Flexx 9 and 10 tablets, and some configuration fixes): http://home.ix.netcom.com/~jjingber/0018-rt5640_audio_on_intel_baytrail.patch
  3. Configure the kernel as follows:

CONFIG_DW_DMAC_CORE=y, CONFIG_DW_DMAC=y (these must be statically linked for now) CONFIG_SND_SOC_INTEL_BYTCR_RT5640=m ( * NOT * CONFIG_SND_SOC_INTEL_BYT_RT5640_MACH ) CONFIG_SND_SOC_AC97_CODEC=m CONFIG_SND_SOC_ALC5623=m

  1. Use firmware fw_sst_0f28_sp0.bin linked to fw_sst_0f28.bin in /lib/firmware/intel (073bb387eb96f8c01d039778086484ac): http://home.ix.netcom.com/~jjingber/fw_sst_0f28_ssp0.bin.
  2. Nuke all your old snd_* modules (otherwise, you'll end up loading both versions of x5640 modules and it won't work). Rebuild and re-install kernel. There should be no errors during boot.
  3. Run alsa_cr.sh, followed by alsa_cr_spk.sh from the following archive: https://groups.google.com/group/android-x86/attach/d1ffc290d6d56/alsa_bytcr_andx86.zip?part=0.1&view=1

This was a big help in getting it going: https://groups.google.com/forum/#!topic/android-x86/un74okmr30g.

ghost commented 8 years ago

And DAC1 in the mixer is the master volume control.

ghost commented 8 years ago

UPDATED: Clarified the instructions and included a missing patch.

Sounds fantastic - no pops or other noises.

nicman23 commented 8 years ago

Yay :) So you did not bother with the dsdt fix? Probably more static that way... I ll try this against arch's kernel and report back (got limited cpu cycles atm)

https://groups.google.com/forum/#!topic/android-x86/un74okmr30g

Shit I should had added it here sooner, that is where I got most of my info... (that and maillists.... so many mails and threads)

About your 1 and 2, how did you force use spp0 and how did you unload the old snd_* modules (probably blacklisted them?)

nicman23 commented 8 years ago

also, this patch is static about irq, right? I cannot seem to find any quirk tables...

ghost commented 8 years ago
  1. No DSDT fix, although that certainly would have obviated the need for the IRQ fix in the source. The IRQ fix in the source is only a one-liner. (I don't think the IRQ in the DSDT is incorrect for this version of the HW: There apparently was pin change at some point and newer BT HW now uses IRQ 1 for the audio.).

The IRQ fix is static, because I used the framework the original author of the patch used, which didn't seem aware of the possibility for IRQ variance.... So, it won't work if the IRQ is on 5. We could certainly improve this, but I don't know how to identify which system types use which IRQ (and I'm not sure the alsa people know either at this point). We could certainly just add the IRQ change to the below code for the systems we know use IRQ 1 (at least the Flexx 9/10).

  1. I just removed all my old snd_* modules, and rebuilt the kernel modules with just the CONFIG options specified above. It won't build a duplicate set unless you select both x5640 variants. You can also certainly blacklist. (It's second RT5640 card option in the kernel config you need.)
  2. It addresses the IRQ mapping, but also quirks the Flexx 9 and 10 in the same fashion as the Dell Venue 8.

    
    
        {
                .callback = byt_rt5640_quirk_cb,
                .matches = {
                        DMI_EXACT_MATCH(DMI_SYS_VENDOR, "YIFANG"),
                        DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "NXW9QC132"),
                },
                .driver_data = (unsigned long *)(BYT_RT5640_DMIC2_MAP |
                                                 BYT_RT5640_DMIC_EN),
        },
        {
                .callback = byt_rt5640_quirk_cb,
                .matches = {
                        DMI_EXACT_MATCH(DMI_SYS_VENDOR, "YIFANG"),
                        DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "NXW101QC232"),
                },
                .driver_data = (unsigned long *)(BYT_RT5640_DMIC2_MAP |
                                                 BYT_RT5640_DMIC_EN),
        },
ghost commented 8 years ago

The following file set will (allegedly) enable automatic headphone/speaker switching through Pulse Audio (untested by me). http://home.ix.netcom.com/~jjingber/alsa-ucm-5640.tar.gz

nicman23 commented 8 years ago

I cannot apply the patch you listed before ... Getting a

patch: **** malformed patch at line 537: + },

ghost commented 8 years ago

Let me look, but try running it through dos2unix - I bounced it around a bunch of machines.

ghost commented 8 years ago

It's missing a bracket --- gimme a sec...

ghost commented 8 years ago

Alright. D/L it again.

nicman23 commented 8 years ago

I fixed it myself :) thanks anyways (i do not have a flexx but a clone and I had to make my own quirk entry anyways)

nicman23 commented 8 years ago

DAMN IT WORKS :dancer:

https://www.youtube.com/watch?v=igJAJV-ckIk on a flac and sounds great :) thanks again :D

ghost commented 8 years ago

Damn right!!! Hehe...

nicman23 commented 8 years ago

there is also this that we might want to look at https://github.com/plbossart/UCM/tree/master/bytcr-rt5640

nicman23 commented 8 years ago

I - with great happiness - closing this bitch of a bug :D

ghost commented 8 years ago

But now nobody can find exactly how (or if) it was fixed, cuz it's no longer viewable in the bug tracker without manually editing the URL.

nicman23 commented 8 years ago

I will update the readme do not worry ;) , I will create a more general version (adding your device to the quirk table and one for flexx10) and I will make a pull request. Bugtrackers are not for permanent tutorials :P

nicman23 commented 7 years ago

btw @jingber couldn't fw_sst_0f28 in patch be renamed to fw_sst_0f28_sp0 to be a more cleaner install?

nicman23 commented 7 years ago

linux 4.7 did not want to compile :S no error no nothing.

Patches were generated again to allow for a clean environment and they did succeed....

Trying now linux-zen 4.6.5

nicman23 commented 7 years ago

Sound works with zen 4.6.5 and sp0 firmware.

Made pkgbuilds for both on https://github.com/nicman23/misc_aur

Also did automatic headphone detection ever work?

nicman23 commented 7 years ago

made a sort of tutorial for arch https://www.reddit.com/r/archlinux/comments/4x8txv/tutorial_intel_atom_tablets_with_bytcr_sound_and/

ghost commented 7 years ago

btw @jingber couldn't fw_sst_0f28 in patch be renamed to fw_sst_0f28_sp0 to be a more cleaner install?

Sure can, but I don't know the reason for the various file namings so I left it like it is.

You can also clean up the patch further by removing the 1-line hard-coded ipc irq fix entirely - it's not needed. I don't remember off-hand which file it's in, but the IRQ issue is address properly in the first file patched by 2.diff.

ghost commented 7 years ago

Here is an archive with the patch set I use for Baytrail on 4.8-rc1 (includes a refactored audio patch):

http://home.ix.netcom.com/~jjingber/linux-4.8-baytrail_patchset.tar.gz

nicman23 commented 7 years ago

Look if it is only one line and the alternative is risking a blown speaker / amp, I'll take the one extra line ;)

ghost commented 7 years ago

The audio patch landed in linux-next and it'll be in 4.8-rc3. We'll still need to add the two blocks dealing with the Flexx tablets.

burzumishi commented 7 years ago

Hi, there!

Great job guys! Congrats!

I'm glad of reading that sound is working on these devices, I've been on holidays and I'm a bit outdated.

I'll test the new sound and Wifi/BT patches with kernel 4.8 and update this github repository, I'll test UCM files for Pulseaudio too.

I'll try to make a newer and smaller kernel configuration without unneeded modules for this devices (eth, scsi, ...) and I'll add the newest AXP20X modules.

Once I've tested all the changes, patches and I've mixed all together ... then I'll update the main README to have a new guide.

Great job!

nicman23 commented 7 years ago

Should we move further developments in a new issue?

Something like: UCM support, upstream news and automatic firmware picking

burzumishi commented 7 years ago

I agree, sound is working here now!

I have just got sound to work with kernel 4.8.0-rc2 merging all patches manually and using the new firmware file.

I'm going to update the repo with the kernel config and full patch files, including all latest commits done to kernel git repos before applying my changes to the sources. Also, I have merged the wifi module sources as a staging driver in this patch.

I have installed UCM, I have Mic settings but seems not to be working, needs more testing ...

Tomorrow I'll test your DKMS ... ;)

ghost commented 7 years ago

Before you guys play with the UCM files, I would suggest waiting for 4.8-rc3 - it incorporates the audio fixes our tablets need, but the patch also is more extensive than what we had to work with. This should only be a few more days.

burzumishi commented 7 years ago

Right thanks, I just make sound to work and installed UCM files because I had a kernel without sound yet, but I didn't anything with UCM ... I'm waiting for RC3 and review the new required changes/patches to get all working again :)

Meanwhile I'll be moving all documentation from the main README to github Wiki pages . :)

nicman23 commented 7 years ago

so @jingber what is it need now? do i have to add my own device to the quirk table?