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

ghost commented 8 years ago

I'm working on a patch for -rc3. It seems it needs a little more than just the quirk.

ghost commented 8 years ago

I just had a look at this, and the new audio stuff got backed out from -rc3.

So, I think you can use the same patch we've been using on -rc3, if you want to run this kernel: http://home.ix.netcom.com/~jingber/linux-4.8-baytrail_patchset.tar.gz. Haven't tested, but I'm building -rc3 now against the original patch.

I'm going to get the new audio stuff out of the kernel git and make a new patch with the new audio code.

ghost commented 8 years ago

UPDATE: (If you D/L'd the first patch posted here, grab the new pair and apply in order - the first patch was missing the codec fixes. 0013 is the entire asoc-for-next branch for 4.8-rc4).

Sorry I took so long on this --

Here is the 'new' audio code from linux-next backported to 4.8-rc4. Audio works, but I haven't played around any further.

http://home.ix.netcom.com/~jjingber/0013-sound_asoc_for_next_20160825.diff http://home.ix.netcom.com/~jjingber/0014-rt5640_audio_on_nextbook_tablets.diff

nicman23 commented 8 years ago

did you still get the distortion on one speaker?

Also I am opening this and will close it when we have proper upstream support..

nicman23 commented 8 years ago

also what is the situation with the firmware? do you still have to replace the already-in-upstream with the sp0 one?

ghost commented 8 years ago

I don't know what caused the distortion, but it happened after a Debian update of pulse audio, and after I restored my original asound.state, it never re-occured.

You still need the symlink to the ssp0 firmware.

The dw_dmac* stuff can also be complied as modules now, if you so choose.

nicman23 commented 8 years ago

Btw does linux-next have our devices?

nicman23 commented 8 years ago

also compile exits with sound/soc/intel/skylake/skl-topology.c:24:39: fatal error: uapi/sound/snd_sst_tokens.h: No such file or directory

If you can post the file that will be great as i do not wish to clone the whole linux-next for a single file..

ghost commented 8 years ago

Btw does linux-next have our devices?

It has the proper audio code now, but does not have the two quirks for the Flexx tablets.

This is the audio branch from linux-next, specifically the SOC audio, backported to 4.8-rc4. This is just the SOC audio-code, not anything else:

http://home.ix.netcom.com/%7Ejjingber/0013-sound_asoc_for_next_20160825.diff

This is the patch to add the quirks for the Flexx 9 and 10 tablets:

http://home.ix.netcom.com/%7Ejjingber/0014-rt5640_audio_on_nextbook_tablets.diff

If you apply both of these to 4.8-rc4, you have the the new audio code from linux-next, along with the quirks for our tablets. I only compile with our audio devices selected. Being this code is from linux-next, if you're compiling using a generic or distro-provided .config, there is a chance something is broken if you're trying to compile the kernel with all of the audio devices selected. That's an issue for the ALSA people, but our audio driver compiles cleanly.

nicman23 commented 8 years ago

Yeah sorry missread a codec - that i thought bytcr needed - and concluded that skylake snd was selected by it :P

nicman23 commented 8 years ago

Sound does not work for me...

bytcr_rt5640 bytcr_rt5640: quirk DMIC1_MAP enabled
bytcr_rt5640 bytcr_rt5640: quirk DMIC enabled
bytcr_rt5640 bytcr_rt5640: quirk SSP0_AIF2 enabled
bytcr_rt5640 bytcr_rt5640: quirk MCLK_EN enabled
bytcr_rt5640 bytcr_rt5640: Failed to get MCLK from pmc_plt_clk_3: -2
bytcr_rt5640: probe of bytcr_rt5640 failed with error -2

Compiled it with the same patch that i know works from my github

https://github.com/nicman23/misc_aur/blob/master/linux-sp0-bytcr/custom_entry.patch

detection works and then it craps out..

ghost commented 8 years ago

The driver is using the wrong set of quirks. Did you apply the second patch?

It should be using DMIC2_MAP and no MCLK_EN.

nicman23 commented 8 years ago

I do not have a flexx :P , although the strange thing is that it worked with 4.6.5 :/

I will retry in 2 or 3 days. Deep into finals right now

nicman23 commented 8 years ago

BYT_RT5640_DMIC2_MAP and BYT_RT5640_DMIC_EN are the quirks that I am using that produced the previous error.

These are the same one that your device is and that you have written in the patch file :/

youling257 commented 8 years ago

Failed to get MCLK from pmc_plt_clk_3: -2 need this, https://patchwork.kernel.org/patch/9277989/ @nicman23

youling257 commented 8 years ago

[ 27.108226] bytcr_rt5640 bytcr_rt5640: quirk DMIC1_MAP enabled [ 27.108230] bytcr_rt5640 bytcr_rt5640: quirk DMIC enabled [ 27.108233] bytcr_rt5640 bytcr_rt5640: quirk SSP0_AIF2 enabled [ 27.108235] bytcr_rt5640 bytcr_rt5640: quirk MCLK_EN enabled [ 27.212440] bytcr_rt5640 bytcr_rt5640: snd-soc-dummy-dai <-> media-cpu-dai mapping ok [ 27.212516] bytcr_rt5640 bytcr_rt5640: snd-soc-dummy-dai <-> deepbuffer-cpu-dai mapping ok [ 27.212567] compress asoc: snd-soc-dummy-dai <-> compress-cpu-dai mapping ok [ 27.235549] bytcr_rt5640 bytcr_rt5640: rt5640-aif2 <-> ssp0-port mapping ok [ 44.779963] intel_sst_acpi 80860F28:00: Free for str 3 pipe 0xe [ 44.785251] sst-mfld-platform sst-mfld-platform: Enter: enable=0 port_name=ssp0-port [ 44.786441] intel_sst_acpi 80860F28:00: Free for str 1 pipe 0x90 no sound

nicman23 commented 8 years ago

Ok thabks will reply to you in 2 days

nicman23 commented 8 years ago

do you have the correct firmware?

ghost commented 8 years ago

BYT_RT5640_DMIC2_MAP and BYT_RT5640_DMIC_EN are the quirks that I am using that produced the previous error.

The driver is not using those quirks. Look @ your output. You should see only DMIC2_MAP and DMIC_EN listed. Nothing else. It'll never work with the set of quirks your driver is reporting.

ghost commented 8 years ago

Failed to get MCLK from pmc_plt_clk_3: -2

That patch is not germane to the problem at hand (he's still getting DMIC1 and MCLK, etc.). Something is wrong with this configuration. If the proper quirks are used, the proper clock source and routing will be used.

youling257 commented 8 years ago

must use this patch,https://patchwork.kernel.org/patch/9277989/ ,and each z3735f tablet need special patch,such as https://patchwork.kernel.org/patch/9285627/https://patchwork.kernel.org/patch/9281569/https://patchwork.kernel.org/patch/9281533/

why it should disable mclk ?

nicman23 commented 8 years ago

@jharrison022 then what I am supposed to do? The quirk table is correct for my device and detection probably works as it enables sp0 ...

ghost commented 8 years ago

[ 27.108226] bytcr_rt5640 bytcr_rt5640: quirk DMIC1_MAP enabled [ 27.108230] bytcr_rt5640 bytcr_rt5640: quirk DMIC enabled [ 27.108233] bytcr_rt5640 bytcr_rt5640: quirk SSP0_AIF2 enabled [ 27.108235] bytcr_rt5640 bytcr_rt5640: quirk MCLK_EN enabled

Your PATCH has the correct quirks, but the driver is not using them ^. These tablets don't use (and can't use) the DMIC1_MAP routing or the MCLK_EN quirks, which your driver is reporting.

Re-check your DSDT and make sure it has the same output under this kernel. I don't know why it wouldn't, but it doesn't hurt to check. It looks to me like this match is failing for some reason. Why not add a printk and see if you're really getting to this point?

If all else fails, you can certainly remove the conditional portion of your patch and just force the set of quirks.

ghost commented 8 years ago

youling257,

All of that stuff is in the asoc-for-next patch which nicman23 is using.

youling257 commented 8 years ago

https://github.com/plbossart/UCM/issues/1#issuecomment-24530581

ghost commented 8 years ago

youling257,

All of this stuff is in the asoc-for-next branch, and audio works on these tablets (for me and other people). Nicman23 is having an issue separate from what those patches address: the quirks for his tablet are not being applied by the driver.

nicman23 commented 8 years ago

https://bugzilla.kernel.org/attachment.cgi?id=221351 is my dmidecode

with

Manufacturer: VERO
Product Name: W10i
nicman23 commented 8 years ago

Got ccache so compiling will not take long but don't know if I have the time to test today will update this with results

ghost commented 8 years ago

Different quirks in the bytcr_5640.zip from youling257 for your tablet. Please let us know if this works for you. This set doesn't work on my Flexx 9 (with my vendor/product name).

{ .callback = byt_rt5640_quirk_cb, .matches = { DMI_MATCH(DMI_SYS_VENDOR, "VERO"), DMI_MATCH(DMI_PRODUCT_NAME, "W10i"), }, .driver_data = (unsigned long *)(BYT_RT5640_IN1_MAP | BYT_RT5640_MCLK_EN | BYT_RT5640_SSP0_AIF1),

},
{}

youling257 commented 8 years ago
    .callback = byt_rt5640_quirk_cb,
    .matches = {
        DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
        DMI_MATCH(DMI_PRODUCT_NAME, "Aspire SW5-012"),
    },
    .driver_data = (unsigned long *)(BYT_RT5640_IN1_MAP |
                     BYT_RT5640_MCLK_EN |
                     BYT_RT5640_SSP0_AIF1),

},
{
    .callback = byt_rt5640_quirk_cb,
    .matches = {
        DMI_MATCH(DMI_SYS_VENDOR, "Insyde"),
        DMI_MATCH(DMI_PRODUCT_NAME, "ONDA Tablet"),
    },
    .driver_data = (unsigned long *)(BYT_RT5640_IN1_MAP |
                     BYT_RT5640_MCLK_EN |
                     BYT_RT5640_SSP0_AIF1),

at present, Aspire SW5-012 and ONDA Tablet,sound work .may be only for z3735f. we don't know nicman23' W10i whether or not work.

youling257 commented 8 years ago
  git clone https://github.com/torvalds/linux.git
  git remote add sound https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
  git fetch sound
  git merge sound/topic/intel
  patch -p1 > 13-17-clk-x86-Add-Atom-PMC-platform-clocks.patch

then edit bytcr_rt5640.c ,compille kernel use this HiFi https://drive.google.com/open?id=0B1HDhURlGNctSDRvMkVSWURsN2s , removed old asound.state from /var/lib/alsa

ghost commented 8 years ago

If that works for nicman23's tablet, I'll eat my shoe (both of them), and post it on youtube. :)

ghost commented 7 years ago

On my configuration with working audio, these are the only quirks reported in dmesg:

[ 12.286915] bytcr_rt5640 bytcr_rt5640: quirk DMIC2_MAP enabled [ 12.286919] bytcr_rt5640 bytcr_rt5640: quirk DMIC enabled

youling257 commented 7 years ago

u0_a25@x86:/ $ su root@x86:/ # dmesg | grep bytcr

<6>[ 15.522212] bytcr_rt5640 bytcr_rt5640: quirk IN1_MAP enabled <6>[ 15.529248] bytcr_rt5640 bytcr_rt5640: quirk SSP0_AIF1 enabled <6>[ 15.536152] bytcr_rt5640 bytcr_rt5640: quirk MCLK_EN enabled <6>[ 15.567575] bytcr_rt5640 bytcr_rt5640: snd-soc-dummy-dai <-> media-cpu-dai mapping ok <6>[ 15.578813] bytcr_rt5640 bytcr_rt5640: snd-soc-dummy-dai <-> deepbuffer-cpu-dai mapping ok <6>[ 15.594009] bytcr_rt5640 bytcr_rt5640: rt5640-aif1 <-> ssp0-port mapping ok root@x86:/ # also need https://github.com/burzumishi/linux-baytrail-flexx10/tree/master/sound/alsa_ctrl you need talk with plbossart
nicman23 commented 7 years ago

so with these quirks dmesg | grep bytcr_rt5640 gets me :

[   10.366535] bytcr_rt5640 bytcr_rt5640: quirk IN1_MAP enabled
[   10.366540] bytcr_rt5640 bytcr_rt5640: quirk SSP0_AIF1 enabled
[   10.366543] bytcr_rt5640 bytcr_rt5640: quirk MCLK_EN enabled
[   10.366551] bytcr_rt5640 bytcr_rt5640: Failed to get MCLK from pmc_plt_clk_3: -2
[   10.373291] bytcr_rt5640: probe of bytcr_rt5640 failed with error -2

sigh i really wanted the shoe video :(

also @youling257 you on android ?

nicman23 commented 7 years ago

that worked for me (4.6.5-zen). Recompiling now to test it again..

youling257 commented 7 years ago

https://sourceforge.net/p/android-x86/kernel/ci/kernel-4.8/tree/ https://github.com/maurossi/linux/tree/kernel-4.8rc5 compile android x86 kernel method, make android-x86_defconfig ,time make -j8,time make -j8 targz-pkg -i

nicman23 commented 7 years ago

just confirming that

BYT_RT5640_DMIC2_MAP |
BYT_RT5640_DMIC_EN

works for me on 4.6.5 on the same machine / install with the same firmware

youling257 commented 7 years ago

quirk SSP0_AIF1 enabled, very nice, [ 10.366551] bytcr_rt5640 bytcr_rt5640: Failed to get MCLK from pmc_plt_clk_3: -2 [ 10.373291] bytcr_rt5640: probe of bytcr_rt5640 failed with error -2 you must patch -p1 > 13-17-clk-x86-Add-Atom-PMC-platform-clocks.patch https://patchwork.kernel.org/patch/9277989/ ok ?

nicman23 commented 7 years ago

that was in my to do next list, compiling right now. should not take long

ghost commented 7 years ago

Trying this too... I think that kernel patch might make that set of quirks work.

nicman23 commented 7 years ago
BYT_RT5640_IN1_MAP |
 BYT_RT5640_MCLK_EN |
 BYT_RT5640_SSP0_AIF1

built with https://patchwork.kernel.org/patch/9277989/ does not work.

trying

BYT_RT5640_DMIC2_MAP |
BYT_RT5640_DMIC_EN
nicman23 commented 7 years ago

Ok it works now with this commit

ignore the PKGBUILD, megre-with-testing, change-default-console-loglevel.patch and linux.preset and linux.install.

this is 4.8-rc4

ghost commented 7 years ago

I'm wondering if you had this: https://lkml.org/lkml/2015/3/31/1087 in your 4.6 kernel when sound was working?

You shouldn't need the ipc_irq workaround as the audio patch identifies the specific Baytrails which have the audio IRQ at index 0 and work around this properly.

ghost commented 7 years ago

Wondering if you can now use MCLK_EN with that kernel patch along with BYT_RT5640_DMIC2_MAP and BYT_RT5640_DMIC_EN.

nicman23 commented 7 years ago

what benefit would it add? also the only patches except from zen (i just happened to have the sources and was too bored to download anything else) are in your old post.

btw 8723bs wifi from hadess repo does not work for me ... i applied the only patch you mentioned in https://github.com/burzumishi/linux-baytrail-flexx10/issues/11#issuecomment-239809289

wifi just times out and asks for password again

also forgot to say thanks @youling257 :)

ghost commented 7 years ago

what benefit would it add?

All the models which use 48Khz mixing need the MLCK_EN quirk. In reality I don't know what difference it would make, if any.

The patch I posted for audio on 4.6 did have the ipc_irq = 0 stuff in there. I didn't carry this over because it's not necessary (at least on my) hardware.

Here's all the patches and my kernel config I use for 4.8-rc4: http://home.ix.netcom.com/~jjingber/linux-4.8-nextbook-patchset.tar.gz

Wifi and everything else that worked previously works with this configuration.

nicman23 commented 7 years ago

well that is the thing never got wifi to work... maybe because i have a 300n router? I ll test with android hotspot.

thanks for the patch set. I ll add the clock one and recompile

ghost commented 7 years ago

FWIW, I'm connecting to a B/G router.

ghost commented 7 years ago

MCLK_EN does work with the kernel patch.