November 22, 2019, 12:18:05 pm

News:

Have you visited the Allwinner Chipset wiki? - http://linux-sunxi.org/


ALSA bit-perfect output

Started by kevin, November 25, 2013, 06:07:05 am

Previous topic - Next topic

GeorgeIoak

you probably have to define the pins in the fex file and use the proper mux mode in order to get them to work.

Looking at http://dl.cubieforums.com/pdf/A10 EVB Manual.pdf (A10 developer manual) on p37 it states it supports up to 8 channel, 24-bit PCM in HDMI.

I'm at the point now that I'm thinking this could be related to DMA transfers and the driver code was never written to handle greater than 16-bit data. That's just a guess on my part and a hope that someone who actually knows the code will read this and take a look for us.

nikkov

Hi,

I also want to use I2S to connect an external DAC. Kevin, have you any progress?

kevin

Quote from: nikkov on January 09, 2014, 07:30:57 am
Hi,

I also want to use I2S to connect an external DAC. Kevin, have you any progress?

Hello nikkov,

Like GeorgeIoak said above, there are SW-side issues to handle 24-bit sound.
Unlike everybody else in this forum, I'm not developer so not used to modifying the kernel or sound driver.
The HW(A20 SoC) itself has 24-bit processing feature but not SW so far.
What I know and tested so far about 24-bit sound on Cubieboard as follow;

1. 16-bit sound is OK (up to 192khz sample rate)
2. 24-bit sound playable but it showed bit depth 16-bit like "S16_LE" on ALSA. (up to 192khz sample rate)
3. I recompiled the I2S module in CT which is disabled by default. And then, when I loaded I2S module, the system showed error message something like as follow;
    - [ccu-error] clk_enabled:invalid handle
    - [ccu-error] clk_set_parent:invalid handle try to set parent of i2s_moduleclk to i2s_pll2ck failed line=603
    - [ccu-err] clk_disabled:invalid handle

For above #2, I don't know my CT can play 24-bit sound correctly because "cat /proc/asound/card1/pcm0p1/sub0/hw_param" showed sound format "S16_LE" which is should be "S24_LE".
For above #3, even though I don't know how to configure I2S from scratch, I just give it a try but no luck.
All the testing was done with digital out(SPDIF).

nikkov

Thank you, kevin.

And I'm also beginner in linux-world.
I connected USB Audio device and CT can play up to 192/24, but for me very interesting how to use I2S.
Can you explain which system image you used and how enabled I2S module compilation?

kevin

Hi nikkov,

There are lots of things to explain why I recompile I2S kernel module even though I'm not used to do that. :'(
But you know, it's fun to do and great chance to learn a lot for about HD audio in Linux world etc.
Anyway, I used following kernel source and method;

1. For kernel source I used
    https://github.com/cubieboard2/linux-sunxi/tree/sunxi-3.4-ct-v101
2. For compiling the kernel and module, read the following
    http://dl.cubieboard.org/docs/How_to_make_a_cubieboard_system.pdf
3. For I2S module compile
    - You need to do some modification of "Kconfig" file at
       https://github.com/cubieboard2/linux-sunxi/blob/sunxi-3.4-ct-v101/sound/soc/Kconfig to include I2S driver source code when you compile the kernel or
    - You can choose the option to include I2S driver as module or built-in in the kernel when you compile the kernel by "menuconfig'.

Before compiling the kernel, you need read carefully #2 step and any relevant information about kernel compiling in this forum or googling whatever in the internet. ;)
Also you may need to look at this http://ubuntuone.com/3DhPanhzINWVGnQijjXWa0 in section 1.13, 5.2, 6.9 and 6.10 for about audio related information on A20 based cubieboard.

I know I can use usb DAC/converter for HD audio. This may be the most simplest way to do but it cost from tenth to a few hundreds of dollars depending on the device.
If the cubieboard can handle the I2S signal properly, one can play HD audio easily by connecting I2S capable DAC.(there are a lots of cheap I2S DACs in the market)
But it seems like a lot of people have interest other than HD audio on cubieboard. :'(
If you have any question or anything your own way about audio feature, let's share to improve this community!

Thanks.

Kevin.

kryoz

I really interested in progress about enabling I2S for CT but I'll be satisfied even in 16/44.1 because I prefer old multibit parallel DACs. I have an intention for tweaking my USB/SPDIF DAC with AD1866 on board to grab i2s source.

kevin

Quote from: kryoz on January 10, 2014, 02:49:22 am
I really interested in progress about enabling I2S for CT but I'll be satisfied even in 16/44.1 because I prefer old multibit parallel DACs. I have an intention for tweaking my USB/SPDIF DAC with AD1866 on board to grab i2s source.


Hi kryoz,

Glad to hear from you because it's counting up one more person to have interest for audio use. ;D
BTW, my original thought was to pull out I2S signal out of the CT via expansion port and connect to external DAC directly.
Otherwise IMHO, you need to use usb-to-I2S converter and then connect it to external DAC.(I2S input capable one)
If your DAC can have I2S input, you can give it a try but it's not that easy I guess. ;)

kryoz

January 10, 2014, 06:55:31 am #22 Last Edit: January 10, 2014, 06:58:21 am by kryoz
Quote from: kevin on January 10, 2014, 03:39:15 am
Hi kryoz,

Glad to hear from you because it's counting up one more person to have interest for audio use. ;D
BTW, my original thought was to pull out I2S signal out of the CT via expansion port and connect to external DAC directly.
Otherwise IMHO, you need to use usb-to-I2S converter and then connect it to external DAC.(I2S input capable one)
If your DAC can have I2S input, you can give it a try but it's not that easy I guess. ;)


Hi  8)

At first I have to solve another problem which is in progress now - implement i2s input in the DAC. I contacted with DAC developer and he gladly helped me with necessary information. The trick can be only with i2s format. DAC can accept only right justified.
Can we manipulate with output i2s format?

And a small offtopic. I've got USB-SPDIF converter with async mode (CM6631A chip) and external power supply. I was sure about its superb quality comparing to all internal soundcards on PC motherboards. But I was surprised when CT's optical SPDIF revealed even better quality. My best explanation is that power supply does really matter. Obviously in CT case it's much cleaner then in PCs.

HaikuZen

Hi Kevin,
I'm also interested in the topic.
I also would like have I2S kernel enabled in android. ;)

Did you heard about HiFiBerry for Raspberri PI? http://www.hifiberry.com/
Do you think the pins are compatibles?

kryoz

I've been trying to compile kernel with i2s module but stiil have no luck.
There were many things I discovered about this process and now I have a kernel with i2s module but looks like it doesn't start at all. syslog reports nothing when i do modprobe sunxi-sndi2s.
Also I couldn't make to work wi-fi module  :-\
I'll appreciate any help but .config for make can be the best option.

kevin

Quote from: kryoz on January 10, 2014, 06:55:31 am
Quote from: kevin on January 10, 2014, 03:39:15 am
Hi kryoz,

Glad to hear from you because it's counting up one more person to have interest for audio use. ;D
BTW, my original thought was to pull out I2S signal out of the CT via expansion port and connect to external DAC directly.
Otherwise IMHO, you need to use usb-to-I2S converter and then connect it to external DAC.(I2S input capable one)
If your DAC can have I2S input, you can give it a try but it's not that easy I guess. ;)


Hi  8)

At first I have to solve another problem which is in progress now - implement i2s input in the DAC. I contacted with DAC developer and he gladly helped me with necessary information. The trick can be only with i2s format. DAC can accept only right justified.
Can we manipulate with output i2s format?

And a small offtopic. I've got USB-SPDIF converter with async mode (CM6631A chip) and external power supply. I was sure about its superb quality comparing to all internal soundcards on PC motherboards. But I was surprised when CT's optical SPDIF revealed even better quality. My best explanation is that power supply does really matter. Obviously in CT case it's much cleaner then in PCs.


Hi kryoz,

How is modification going?
Yes, CT's SPDIF output quality is good. I'm running mpd with small cheap DAC(up to 24/192) for my music listening.
But I have pop noise when I stop or forward between tracks with HD audio file.(like 24bit 96khz)
Do you have any experience like this?

kevin

Quote from: HaikuZen on January 10, 2014, 09:56:07 am
Hi Kevin,
I'm also interested in the topic.
I also would like have I2S kernel enabled in android. ;)

Did you heard about HiFiBerry for Raspberri PI? http://www.hifiberry.com/
Do you think the pins are compatibles?

Hello HaikuZen,

I heard about that DAC before but I don't think it's compatible with cubieboard in terms of HW and SW.
Because RPi and Cubieboard has different HW spec.

kevin

Quote from: kryoz on January 11, 2014, 04:44:19 pm
I've been trying to compile kernel with i2s module but stiil have no luck.
There were many things I discovered about this process and now I have a kernel with i2s module but looks like it doesn't start at all. syslog reports nothing when i do modprobe sunxi-sndi2s.
Also I couldn't make to work wi-fi module  :-\
I'll appreciate any help but .config for make can be the best option.

Hi kryoz,

Compilation of I2S module itself is not an issue I guess.
When loading the module, it refused to load with some error.
It needs to be done something in I2S module source code.
Would you provide me what happen when you load the module?

Thanks.

nikkov

I looked up the source code and found that code from sunxi-i2s.c

//i2s module clk
i2s_moduleclk = clk_get(NULL, "i2s");
for A20 must be replaced:
//i2s module clk
i2s_moduleclk = clk_get(NULL, "i2s0");

because clock module with name "i2s" not exists.

kryoz

Quote from: kevin on January 12, 2014, 07:58:03 pm
Hi kryoz,

How is modification going?
Yes, CT's SPDIF output quality is good. I'm running mpd with small cheap DAC(up to 24/192) for my music listening.
But I have pop noise when I stop or forward between tracks with HD audio file.(like 24bit 96khz)
Do you have any experience like this?


Hi kevin,

I digged deeper and reproduced errors like yours. Then stucked. Also I haven't managed to make work wi-fi module correct despite on notes and even .config in near NAS thread :(

Quote
Yes, CT's SPDIF output quality is good. I'm running mpd with small cheap DAC(up to 24/192) for my music listening.
But I have pop noise when I stop or forward between tracks with HD audio file.(like 24bit 96khz)
Do you have any experience like this?


That's strange I don't have such an issue. But I have another one with skipping for about 1 second of the beginning of new track when I forward between them.

Quote from: nikkov on January 13, 2014, 02:13:37 am
I looked up the source code and found that code from sunxi-i2s.c

//i2s module clk
i2s_moduleclk = clk_get(NULL, "i2s");
for A20 must be replaced:
//i2s module clk
i2s_moduleclk = clk_get(NULL, "i2s0");

because clock module with name "i2s" not exists.



Tank you for advice. I'll try this patch today.