Sound clicks at channel change on Spark hardware

Entwicklung
Benny
Interessierter
Interessierter
Beiträge: 57
Registriert: Samstag 17. Mai 2014, 18:28
Sonstiges: GM990

Sound clicks at channel change on Spark hardware

Beitrag von Benny »

Greetings,

not sure that is Neutrino issue, may be this something deeper, at kernel/modules level, but anyway:
- when audio play is started/stopped (channel zap, media file play, in audioplayer/internet radio, etc) there is a clear and loud "click" on analog output;
- also, same clicks presents on digital (HDMI) output, but there they less noticeable;
- those clicks not relevant to volume level settings - ie, they presents always, even if volume level set to "0" or "MUTE" is enabled.

Can somebody explain source of this clicks and, if it possible - how to fix this issue?

PS On original Spark firmware audio output is clear, but something like short "fade in/out" effect is present.
martii
Einsteiger
Einsteiger
Beiträge: 217
Registriert: Donnerstag 14. Juni 2012, 09:39

Re: Sound clicks at channel change on Spark hardware

Beitrag von martii »

Hi Benny,

adding the pcm_noise patch might help. Could you please try and give feedback? I've never experienced that issue.

Cheers,

martii

Code: Alles auswählen

diff --git a/make/stlinux-211.mk b/make/stlinux-211.mk
index 691d3c1..530d3d7 100644
--- a/make/stlinux-211.mk
+++ b/make/stlinux-211.mk
@@ -95,6 +95,7 @@ COMMONPATCHES_24 = \
 		linux-sh4-strcpy_stm24$(PATCH_STR).patch \
 		linux-squashfs-lzma_stm24$(PATCH_STR).patch \
 		linux-sh4-ext23_as_ext4_stm24$(PATCH_STR).patch \
+		linux-sh4-pcm_noise_fix_stm24_0211.patch \
 		bpa2_procfs_stm24$(PATCH_STR).patch \
 		linux-ftdi_sio.c_stm24$(PATCH_STR).patch \
 		linux-sh4-lzma-fix_stm24$(PATCH_STR).patch \
Benny
Interessierter
Interessierter
Beiträge: 57
Registriert: Samstag 17. Mai 2014, 18:28
Sonstiges: GM990

Re: Sound clicks at channel change on Spark hardware

Beitrag von Benny »

martii hat geschrieben: Could you please try and give feedback?
Thank you, report below:

Patch string added to .mk file, kernel and drivers rebuilded. Or i should rebuild the whole image?

After kernel/drivers update, and reboot it works until first channel switch, then "Player Aud Mixer" is crashed, and no any sound anymore.

Code: Alles auswählen

44.016000] (da 0, 0)(da 0, 4)Find spdif_bypass control at 8720ce00
[   44.016000] (da 0, 0)(da 0, 4)virtual bool CSTmBDispAQ::HandleBlitterInterrupt() @ 870f59c8: BDisp not running? BDISP_ITS 00010000!
[   44.384000] ksound: Set parameters for hw:0,2 to 2 x 48000hz with period 1536 (of 4608)
[   44.384000] ksound: Set parameters for hw:0,1 to 2 x 48000hz with period 1536 (of 4608)
[   44.384000] ksound: Set parameters for hw:0,0 to 2 x 48000hz with period 1536 (of 4608)
[   69.568000] warning: `vsftpd' uses 32-bit capabilities (legacy support in use)
-------------------switching channel-----------------
[  124.124000] Demodulator acquired LOCK
[  124.160000] Demodulator acquired LOCK
[  124.172000] Demodulator acquired LOCK
[  124.468000] (da 0, 0)(da 0, 4)Find spdif_bypass control at 8720ce00
[  124.468000] (da 0, 0)(da 0, 4)CA_SET_PID index = 0 pid 2315
[  124.536000] pid 90b is already linked to descrambler 0
[  124.536000] CA_SET_PID index = 0 pid 2314
[  124.536000] pid 90a is already linked to descrambler 0
[  124.748000] ksound: Set parameters for hw:0,2 to 2 x 48000hz with period 1536 (of 4608)
[  124.748000] ksound: Set parameters for hw:0,1 to 2 x 48000hz with period 1536 (of 4608)
[  124.748000] ksound: Set parameters for hw:0,0 to 2 x 48000hz with period 1536 (of 4608)
[  124.752000] ------------[ cut here ]------------
[  124.752000] Kernel BUG at 80a621fe [verbose debug info unavailable]
[  124.752000] Kernel BUG: 003e [#1]
[  124.752000] last sysfs file: /sys/devices/virtual/input/input1/event1/dev
[  124.752000] Modules linked in: uinput smartcard bpamem silencegen platform stmalloc sth264pp player2 stmdvb stmsysfs stm_monitor pti(P) stv090x pseudocard stmvbi stmvout stm_v4l2 p2div64 ksound mmelog avs mme_host embxshm embxmailbox embxshell stmfb stmcore_display_sti7111 e2_proc cpu_frequ aotom
[  124.752000]
[  124.752000] Pid : 1143, Comm:                Player Aud Mixe
[  124.752000] CPU : 0                  Tainted: P            (2.6.32.59_stm24_0211 #2)
[  124.752000]
[  124.752000] PC is at snd_stm_conv_enable+0x2a/0xd8
[  124.752000] PR is at snd_stm_pcm_player_trigger+0xd6/0x18c
[  124.752000] PC  : 80a621fe SP  : 86327e9c SR  : 400081f0 TEA : c109056c
[  124.752000] R0  : 80a621d4 R1  : 00000001 R2  : fffffffc R3  : 80b10fb4
[  124.752000] R4  : 87e0b080 R5  : 00000000 R6  : 00000001 R7  : 00000091
[  124.752000] R8  : 87c01c00 R9  : 00000000 R10 : 00000001 R11 : 80a66b2c
[  124.752000] R12 : 0000093c R13 : 80984b34 R14 : 922bb000
[  124.752000] MACH: 00000000 MACL: 00002d50 GBR : 00000000 PR  : 80a636c6
[  124.752000]
[  124.752000] Call trace:
[  124.752000]  [<80a636c6>] snd_stm_pcm_player_trigger+0xd6/0x18c
[  124.752000]  [<80984b34>] memset+0x0/0x8c
[  124.752000]  [<80a66b2c>] dma_extend+0x0/0x48
[  124.752000]  [<80a5754e>] snd_pcm_action_single+0x26/0x4c
[  124.752000]  [<c11ecd68>] ksnd_pcm_mmap_commit+0xf0/0x158 [ksound]
[  124.752000]  [<c16e0702>] _ZN18PcmPlayer_Ksound_c19CommitMappedSamplesEv+0x2a/0x8c [player2]
[  124.752000]  [<c16dc02e>] _ZN11Mixer_Mme_c19CommitMappedSamplesEv+0x2e/0xc8 [player2]
[  124.752000]  [<80984b8c>] memset+0x58/0x8c
[  124.752000]  [<c16dc132>] _ZN11Mixer_Mme_c14StartPcmPlayerEv+0x6a/0xb8 [player2]
[  124.752000]  [<c16dfc3a>] _ZN11Mixer_Mme_c14PlaybackThreadEv+0x86/0x1dc [player2]
[  124.752000]  [<c16dfd98>] _ZL18PlaybackThreadStubPv+0x8/0x1c [player2]
[  124.752000]  [<c16eaf2c>] OSDEV_CreateThreadHelper+0x0/0x20 [player2]
[  124.752000]  [<c16eaf38>] OSDEV_CreateThreadHelper+0xc/0x20 [player2]
[  124.752000]  [<80824c30>] kthread+0x54/0x74
[  124.752000]  [<808038a6>] kernel_thread_helper+0x6/0x10
[  124.752000]  [<80824bdc>] kthread+0x0/0x74
[  124.752000]  [<808038a0>] kernel_thread_helper+0x0/0x10
[  124.752000]
[  124.752000] Process: Player Aud Mixe (pid: 1143, stack limit = 86326001)
[  124.752000] Stack: (0x86327e9c to 0x86328000)
[  124.752000] 7e80:                                                                000000f0
[  124.752000] 7ea0: 80a636c6 922bb000 80984b34 0000093c 80a66b2c 00000000 87dad640 87c01c00
[  124.752000] 7ec0: 00000000 80a5754e 00000000 00000003 80c11e3c 87dad600 c11ecd68 00001200
[  124.752000] 7ee0: 00001200 86227840 87dad600 c16e0702 00000000 00000001 c1789988 861fc000
[  124.752000] 7f00: 00001200 0000093c c16dc02e c1789000 86327f30 80984b8c c16dc132 0000093c
[  124.752000] 7f20: 00001200 00000003 c178998c c1789000 00000000 c16dfc3a 00000000 000000bc
[  124.752000] 7f40: 0000093c 000002c4 c178997c 00000001 c1789000 c16dfd98 00000000 00000000
[  124.752000] 7f60: 00000000 00000000 86045580 c16eaf2c 86045580 c16eaf38 80824c30 869fdad4
[  124.752000] 7f80: 00000000 00000000 86327f88 86327f88 808038a6 00000000 00000000 00000000
[  124.752000] 7fa0: 00000000 00000000 00000000 00000000 00000000 869fdad4 80824bdc 00000000
[  124.752000] 7fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  124.752000] 7fe0: 86327fa4 808038a0 00000000 40008000 00000000 00000000 00000000 00000000
[  124.752000] HandleVSYNCInterrupt: - time discontinuity detected, vsync interval = 343063 field duration = 20000
[  124.756000] ---[ end trace f386fdc91f363364 ]---
[  124.760000] note: Player Aud Mixe[1143] exited with preempt_count 2
martii
Einsteiger
Einsteiger
Beiträge: 217
Registriert: Donnerstag 14. Juni 2012, 09:39

Re: Sound clicks at channel change on Spark hardware

Beitrag von martii »

Rebuilding the kernel was sufficient, thanks for testing this.

Looking at the GIT history, the

clk_disable(pcm_player->clock);

wasn't part of the original stm24_0205 patch. You could try commenting this line in the 0211 patch.

Cheers,

martii
Benny
Interessierter
Interessierter
Beiträge: 57
Registriert: Samstag 17. Mai 2014, 18:28
Sonstiges: GM990

Re: Sound clicks at channel change on Spark hardware

Beitrag von Benny »

martii hat geschrieben: You could try commenting this line in the 0211 patch.
You mean, with or without previous patch applied?
Well, i've tried for both cases:
- with 'linux-sh4-pcm_noise_fix_stm24_0211.patch' and 'clk_disable(pcm_player->clock)' removed from pcm_player.c - nothing changes, it works until first channel switch, then "Player Aud Mixer" is crashed, and no any sound anymore;
- without 'linux-sh4-pcm_noise_fix_stm24_0211.patch' and 'clk_disable(pcm_player->clock)' removed from pcm_player.c - it works as usual, clicks also presents.

PS There some speaks-for-itself code pairs in pcm_player.c:

Code: Alles auswählen

	/* Wake up & unmute DAC */

	if (pcm_player->conv_group) {
		snd_stm_conv_enable(pcm_player->conv_group,
				0, substream->runtime->channels - 1);
		snd_stm_conv_unmute(pcm_player->conv_group);
	}

....

	/* Mute & shutdown DAC */

	if (pcm_player->conv_group) {
		snd_stm_conv_mute(pcm_player->conv_group);
		snd_stm_conv_disable(pcm_player->conv_group);
	}
is it worth to investigate it further?
AFAIU, STM drivers provide some basic ALSA controls - can we use external binary, something like alsa-mixer to set volume, mute/unmute different outputs?
martii
Einsteiger
Einsteiger
Beiträge: 217
Registriert: Donnerstag 14. Juni 2012, 09:39

Re: Sound clicks at channel change on Spark hardware

Beitrag von martii »

Hi Benny,

I don't know whether it's a kernel or neutrino issue, or possibly both.

The neutrino binary is already linked to the ALSA library (and "make alsa-utils" will build a amixer opkg). You can easily check whether muting via the mixer makes the clicking sound go away by setting the mixer values to zero in the audio menu. If it does, then the next step is to find the appropriate code spots where muting/unmuting via the mixer would make sense.

I can't reproduce that clicking sound on my HDMI-connected TV, so I won't be able to help with that.

Cheers,

martii
Benny
Interessierter
Interessierter
Beiträge: 57
Registriert: Samstag 17. Mai 2014, 18:28
Sonstiges: GM990

Re: Sound clicks at channel change on Spark hardware

Beitrag von Benny »

martii hat geschrieben:I don't know whether it's a kernel or neutrino issue, or possibly both.
I suppose, that this is low-level issue - in Enigma2, running on same platform and in same environment, clicks also present.
martii hat geschrieben:"make alsa-utils" will build a amixer opkg).
Ok, thanks for the tip - i builded amixer, and played with it a little - nothing good to report: with all outputs set to minimum or disabled clicks still present.
martii hat geschrieben:I can't reproduce that clicking sound on my HDMI-connected TV,
You can try "mute" sound in Neutrino, set in "Audio menu" volume level for HDMI 50% (or more), set on TV volume level at maximum and switch channel or open "Internet radio" - on HDMI output those clicks really hard to notice - if the same "noise level" was for analog output, then i don't even bother with this.
martii hat geschrieben:so I won't be able to help with that.
Thanks for the help anyway.