[BUG] On Allwinner A20 Board Cubietruck distorted SPDIF opical output

178 views
Skip to first unread message

Markus Mitsch

unread,
May 20, 2018, 8:23:43 AM5/20/18
to alsa-...@alsa-project.org, linux...@googlegroups.com, Chen-Yu Tsai, maxime...@free-electrons.com
Hello,

i have a new problem. if i want to output sound from optical i get
distorted sound. At 44.1 khz its like an old vinly, but at 48 khz and
higher it is very bad. thanks in advance for your time.

mfg

Code Kipper

unread,
May 20, 2018, 2:36:55 PM5/20/18
to markusm...@gmail.com, Linux-ALSA, linux-sunxi, Chen-Yu Tsai, Maxime Ripard
On 20 May 2018 at 14:23, 'Markus Mitsch' via linux-sunxi
Hi Markus,
I haven't tested it for a while but when I did it worked as high as
96K with no issues. Does it work ok with the original cubietruck
software?,
CK
>
> mfg
>
> --
> You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Markus Mitsch

unread,
May 21, 2018, 5:43:35 AM5/21/18
to Code Kipper, Markus Mitsch, Linux-ALSA, linux-sunxi, Chen-Yu Tsai, Maxime Ripard
>> Hello,
>>
>> i have a new problem. if i want to output sound from optical i get
>> distorted sound. At 44.1 khz its like an old vinly, but at 48 khz and
>> higher it is very bad. thanks in advance for your time.

> Hi Markus,
> I haven't tested it for a while but when I did it worked as high as
> 96K with no issues. Does it work ok with the original cubietruck
> software?,
> CK

Hello,
i am using arch linux with mainline kernel 4.16.8. parhaps i can try
today with official image.
mfg

Markus Mitsch

unread,
May 21, 2018, 8:43:58 AM5/21/18
to Code Kipper, Markus Mitsch, Linux-ALSA, linux-sunxi, Chen-Yu Tsai, Maxime Ripard
Hi.
So, with debian image from 2014 with 3.4.79 kernel the sound is clear
up to 96 khz.
mfg

Maxime Ripard

unread,
May 21, 2018, 9:17:32 AM5/21/18
to Markus Mitsch, Code Kipper, Markus Mitsch, Linux-ALSA, linux-sunxi, Chen-Yu Tsai
You said that it is a new problem, when was it introduced? Could you
bisect the issue?

Maxime

--
Maxime Ripard, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
signature.asc

Markus Mitsch

unread,
May 21, 2018, 2:17:06 PM5/21/18
to Maxime Ripard, Code Kipper, Markus Mitsch, Linux-ALSA, linux-sunxi, Chen-Yu Tsai
2018-05-21 15:17 GMT+02:00 Maxime Ripard <maxime...@bootlin.com>:
> On Mon, May 21, 2018 at 02:43:55PM +0200, Markus Mitsch wrote:
>> 2018-05-21 11:43 GMT+02:00 Markus Mitsch <markusm...@googlemail.com>:
>> >>> Hello,
>> >>>
>> >>> i have a new problem. if i want to output sound from optical i get
>> >>> distorted sound. At 44.1 khz its like an old vinly, but at 48 khz and
>> >>> higher it is very bad. thanks in advance for your time.
>> >
>> >> Hi Markus,
>> >> I haven't tested it for a while but when I did it worked as high as
>> >> 96K with no issues. Does it work ok with the original cubietruck
>> >> software?,
>> >> CK
>> >
>> > Hello,
>> > i am using arch linux with mainline kernel 4.16.8. parhaps i can try
>> > today with official image.
>> > mfg
>>
>> Hi.
>> So, with debian image from 2014 with 3.4.79 kernel the sound is clear
>> up to 96 khz.
>
> You said that it is a new problem, when was it introduced? Could you
> bisect the issue?
>
> Maxime

Hello.
I dont know since when this problem appears. When saying "new" i
refered to my older post. I tried to look into the dts file and the
code
but i am afraid this is a bit too high for me. I can say that the
analog output works, even at high sampling rates.
And I have read something about a clock source could be the problem.
I'm sorry I can't tell you any more.

mfg
Markus

Code Kipper

unread,
May 22, 2018, 3:27:57 PM5/22/18
to Markus Mitsch, Maxime Ripard, Markus Mitsch, Linux-ALSA, linux-sunxi, Chen-Yu Tsai
Hi Markus,
I've been able to reproduce this on my A31 board with linux-next(plays
at 44100 but not at 96K)so it is an issue. I also tested the same code
on my A64 and it worked fine, The blocks are very similar so it maybe
a clocking issue, I'll look into this.
BR,
CK

Code Kipper

unread,
May 23, 2018, 11:12:18 AM5/23/18
to Markus Mitsch, Maxime Ripard, Markus Mitsch, Linux-ALSA, linux-sunxi, Chen-Yu Tsai
Hi All,
I can see that the problem was introduced somewhere here

DOESN'T WORK
ffc3eb6f3a83 Merge tag 'sunxi-clk-for-4.15' of
https://git.kernel.org/pub/scm/linux/kernel/git/sunxi/linux into
clk-next
ae74ac082886 Merge tag 'clk-v4.15-exynos-pm' of
git://git.kernel.org/pub/scm/linux/kernel/git/snawrocki/clk into
clk-next
faa865f18cb7 Merge tag 'clk-v4.15-samsung' of
git://git.kernel.org/pub/scm/linux/kernel/git/snawrocki/clk into
clk-next
f09a6b86fdae Merge tag 'clk-renesas-for-v4.15-tag1' of
git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers
into clk-next
4328a2186e51 clk: sunxi-ng: sun4i: Export video PLLs
553c7d5ba2fe clk: sunxi-ng: Add A83T display clocks
7679eb20353d clk: samsung: Add a separate driver for Exynos4412 ISP clocks
8ca8ac102484 clk: samsung: Add dt bindings for Exynos4412 ISP clock controller
75920aac275a clk: samsung: Instantiate Exynos4412 ISP clocks only when available
24ea78a09f89 clk: sunxi-ng: sun8i: a23: Use sigma-delta modulation for audio PLL
ee6501d69217 clk: sunxi-ng: sun6i: Use sigma-delta modulation for audio PLL
042f7f8f9715 clk: sunxi-ng: sun5i: Use sigma-delta modulation for audio PLL
de3448519194 clk: sunxi-ng: sun4i: Use sigma-delta modulation for audio PLL
a5e3e2b2ef85 clk: sunxi-ng: sun8i: h3: Use sigma-delta modulation for audio PLL
392ba5fafcdf clk: sunxi-ng: nm: Add support for sigma-delta modulation
05d2eaac96d4 clk: sunxi-ng: Add sigma-delta modulation support
4cdbc40d64d4 clk: sunxi-ng: nm: Check if requested rate is supported
by fractional clock
d51fe3ba9773 clk: sunxi-ng: sun5i: Fix bit offset of audio PLL post-divider
4e8975cbb516 clk: samsung: exynos5433: mark PM functions as __maybe_unused
a4f21e9ceb5c clk: samsung: Remove obsolete clkdev alias support
45d882daf88a clk: samsung: Add explicit MPLL, EPLL clkdev aliases in
S3C2443 driver
cd05417f728b clk: samsung: Rework clkdev alias handling in S3C2443 driver
efea8d377184 clk: samsung: Rework clkdev alias handling in Exynos5440 driver
36ba48240b19 clk: samsung: Drop useless alias in Exynos5420 clk driver
29964890f31c clk: samsung: Remove clkdev alias support in Exynos5250 clk driver
6de08891c896 clk: samsung: Remove double assignment of CLK_ARM_CLK in
Exynos4 driver
58f4a5ff3a62 clk: samsung: Remove clkdev alias support in Exynos4 clk driver
c9194fb623b0 clk: samsung: Remove support for obsolete Exynos4212 CPU clock
d5cd103b06f9 clk: samsung: Remove support for Exynos4212 SoCs in
Exynos CLKOUT driver
7c4f63ec94a1 clk: sunxi-ng: a83t: Fix invalid csi-mclk mux offset
WORKS
0a4e632b6f9d Merge branch 'clk-fixes' into clk-next

BR,
CK

Markus Mitsch

unread,
Jun 9, 2018, 1:46:25 PM6/9/18
to Maxime Ripard, Linux-ALSA, linux-sunxi, Chen-Yu Tsai
hi.

i posted my answer wrong so here is my finding:
i made the output work by disabling the sigma delta modulation.
after compiling the kernel i can output through spdif with any rate.

greetings
markus

2018-05-26 18:38 GMT+02:00 Markus Mitsch <markusm...@googlemail.com>:
> 2018-05-26 16:57 GMT+02:00 Markus Mitsch <markusm...@googlemail.com>:
>> Hello,
>> i tried undoing part of the commit
>> de3448519194 clk: sunxi-ng: sun4i: Use sigma-delta modulation for audio PLL
>> by setting the value for the divider from 1 to 4 again on both places.
>> with no success.
>>
>> markus
>
> i now had a little success. the output works!!
> i disabled the sigma-delta support by making
> ccu_sdm_helper_enable in drivers/clk/sunxi-ng/ccu_sdm.c return imediately.
>
> markus

Chen-Yu Tsai

unread,
Aug 8, 2018, 6:00:00 AM8/8/18
to Markus Mitsch, Maxime Ripard, Linux-ALSA, linux-sunxi
Hi,

On Sun, Jun 10, 2018 at 1:46 AM, Markus Mitsch
<markusm...@googlemail.com> wrote:
> hi.
>
> i posted my answer wrong so here is my finding:
> i made the output work by disabling the sigma delta modulation.
> after compiling the kernel i can output through spdif with any rate.

So it seems that the default mid-level bias current setting for PLL2
interferes with sigma-delta modulation. Similarly, the VCO bias setting
also interferes.

Try zeroing out bits 16 ~ 25 in the PLL2 tuning register (0x01c2000c)
with sigma delta on, and see if that fixes things.

I'll send out a patch later.

ChenYu

granger...@gmail.com

unread,
Oct 20, 2018, 12:30:36 PM10/20/18
to linux-sunxi
Hi,

Sorry to step in the discussion, but are there any updates on this? Where can one track the progress on this issue?

Best,
Nicolas

Chen-Yu Tsai

unread,
Oct 22, 2018, 6:11:44 AM10/22/18
to granger...@gmail.com, linux...@googlegroups.com
On Sat, Oct 20, 2018 at 5:30 PM <granger...@gmail.com> wrote:
>
> Hi,
>
> Sorry to step in the discussion, but are there any updates on this? Where can one track the progress on this issue?

The fix for this was merged and is in the final 4.19 release.

ChenYu

granger...@gmail.com

unread,
Oct 25, 2018, 6:46:00 AM10/25/18
to linux-sunxi
Great! Thank you very much.

Markus Mitsch

unread,
Oct 27, 2018, 5:55:16 PM10/27/18
to Chen-Yu Tsai, Maxime Ripard, Linux-ALSA, linux...@googlegroups.com, granger...@gmail.com
Hello,
sorry for the late answer. all my problems with optical out seem to
be solved with this. i still dont understand why without sigma delta
modulation the 44.1 khz did not work while all other sampling rates
were ok.
but now i can leave sdm on an did not see a sampling rate fail. thanks to all.

greetings
markus
Reply all
Reply to author
Forward
0 new messages