Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No sound after installing drivers #13

Open
kmickz opened this issue Mar 22, 2023 · 11 comments
Open

No sound after installing drivers #13

kmickz opened this issue Mar 22, 2023 · 11 comments

Comments

@kmickz
Copy link

kmickz commented Mar 22, 2023

Hii

i have mt7628evb board with wm8960 codec openwrt version is 21.02. mt762x-wm8960 driver version is 5.4
the device is registered but when i play any wav file there is no sound.

logs:--

[ 14.834064] kmodloader: loading kernel modules from /etc/modules.d/*
[ 14.981660] i2c /dev entries driver
[ 15.000940] ralink_gdma: module is from the staging directory, the quality is unknown, you have been warned.
[ 15.039663] gdma-rt2880 10002800.gdma: revision: 3, channels: 16
[ 15.116108] i2c-mt7621 10000900.i2c: clock 100 kHz
[ 15.140496] ralink-i2s 10000a00.i2s: mclk 480MHz
[ 15.205956] mt762x-wm8960 sound: wm8960-hifi <-> 10000a00.i2s mapping ok
[ 15.261825] urngd: v1.0.2 started.
[ 15.340943] Loading modules backported from Linux version v5.10.157-0-gf4245f05389c

### aplay -l output :-

root@OpenWrt:/# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: Card [MT762X WM8960 ASoC Card], device 0: wm8960-hifi wm8960-hifi-0 [wm8960-hifi wm8960-hifi-0]
Subdevices: 1/1
Subdevice #0: subdevice #0

root@OpenWrt:/# aplay -L
null
Discard all samples (playback) or generate zero samples (capture)
default:CARD=Card
MT762X WM8960 ASoC Card, wm8960-hifi wm8960-hifi-0
Default Audio Device
sysdefault:CARD=Card
MT762X WM8960 ASoC Card, wm8960-hifi wm8960-hifi-0
Default Audio Device

commands given to amixer :--

amixer sset "Headphone" 90
mixer sset "Speaker" 90Simple mixer control 'Headphone',0
Capabilities: pvolume
Playback channels: Front Left - Front Right
Limits: Playback 0 - 127
Mono:
Front Left: Playback 90 [71%] [-31.00dB]
Front Right: Playback 90 [71%] [-31.00dB]
root@OpenWrt:/# amixer sset "Speaker" 90
Simple mixer control 'Speaker',0
Capabilities: pvolume
Playback channels: Front Left - Front Right
Limits: Playback 0 - 127
Mono:
Front Left: Playback 90 [71%] [-31.00dB]
Front Right: Playback 90 [71%] [-31.00dB]
root@OpenWrt:/#
root@OpenWrt:/#
root@OpenWrt:/#
root@OpenWrt:/#
root@OpenWrt:/# amixer sset "Left Output Mixer PCM" on
ixer sset "Right Output Mixer PCM" onSimple mixer control 'Left Output Mixer PCM',0
Capabilities: pswitch pswitch-joined
Playback channels: Mono
Mono: Playback [on]
root@OpenWrt:/# amixer sset "Right Output Mixer PCM" on
Simple mixer control 'Right Output Mixer PCM',0
Capabilities: pswitch pswitch-joined
Playback channels: Mono
Mono: Playback [on]

aplay sampl music play

aplay -vv preamble10.wav
Playing WAVE 'preamble10.wav' : Signed 16 bit Little Endian, Rate 22050 Hz, Mono
Plug PCM: Route conversion PCM (sformat=S16_LE)
Transformation table:
0 <- 0
1 <- 0
Its setup is:
stream : PLAYBACK
access : RW_INTERLEAVED
format : S16_LE
subformat : STD
channels : 1
rate : 22050
exact rate : 22050 (22050/1)
msbits : 16
buffer_size : 10240
period_size : 2048
period_time : 92879
tstamp_mode : NONE
tstamp_type : MONOTONIC
period_step : 1
avail_min : 2048
period_event : 0
start_threshold : 10240
stop_threshold : 10240
silence_threshold: 0
silence_size : 0
boundary : 1342177280
Slave: Hardware PCM card 0 'MT762X WM8960 ASoC Card' device 0 subdevice 0
Its setup is:
stream : PLAYBACK
access : MMAP_INTERLEAVED
format : S16_LE
subformat : STD
channels : 2
rate : 22050
exact rate : 22050 (22050/1)
msbits : 16
buffer_size : 10240
period_size : 2048
period_time : 92879
tstamp_mode : NONE
tstamp_type : MONOTONIC
period_step : 1
avail_min : 2048
period_event : 0
start_threshold : 10240
stop_threshold : 10240
silence_threshold: 0
silence_size : 0
boundary : 1342177280
appl_ptr : 0
hw_ptr : 0

@redchenjs
Copy link
Owner

Hi @kmickz , can you provide the image file you are using? Not all audio formats are supported by the driver.

@redchenjs
Copy link
Owner

Have you tried playing stereo audio?

@kmickz
Copy link
Author

kmickz commented Apr 3, 2023

can you provide me supported audio file link

@kmickz kmickz closed this as completed Apr 10, 2023
@kmickz kmickz reopened this Apr 10, 2023
@kmickz
Copy link
Author

kmickz commented Apr 10, 2023

hey @redchenjs i tried all formats but still there is no sound please can you suggest me what i am doing wrong also tried both mono and stereo audio but still make no difference

root@OpenWrt:~# aplay -vv pcm1608s.wav
Playing WAVE 'pcm1608s.wav' : Signed 16 bit Little Endian, Rate 8000 Hz, Stereo
Plug PCM: Hardware PCM card 0 'MT762X WM8960 ASoC Card' device 0 subdevice 0
Its setup is:
stream : PLAYBACK
access : RW_INTERLEAVED
format : S16_LE
subformat : STD
channels : 2
rate : 8000
exact rate : 8000 (8000/1)
msbits : 16
buffer_size : 4096
period_size : 1024
period_time : 128000
tstamp_mode : NONE
tstamp_type : MONOTONIC
period_step : 1
avail_min : 1024
period_event : 0
start_threshold : 4096
stop_threshold : 4096
silence_threshold: 0
silence_size : 0
boundary : 1073741824
appl_ptr : 0
hw_ptr : 0
#+ | 00%

@redchenjs
Copy link
Owner

Hi @kmickz, have you checked the REFCLK pin of the WM8960 and the device tree file you used? Maybe we can take a look at the schematic for the audio part.

@kmickz
Copy link
Author

kmickz commented Apr 10, 2023

@redchenjs , yes i check REFCLK pin it continuously generating 12Mhz clock(cross-check with CRO) here is my dts file configuration
for better understating of problem

#include "mt7628an.dtsi"

#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>

/ {
compatible = "mediatek,mt7628an-eval-board", "mediatek,mt7628an-soc";
model = "Mediatek MT7628AN evaluation board";

};

&state_default {
gpio {
groups = "gpio";
function = "gpio";
};

refclk {
	groups = "refclk";
	function = "refclk";
};


i2s {
	groups = "i2s";
	function = "i2s";
};

};

&wmac {
status = "okay";
};

&spi0 {
status = "okay";

flash@0 {
	compatible = "jedec,spi-nor";
	reg = <0>;
	spi-max-frequency = <10000000>;

	partitions {
		compatible = "fixed-partitions";
		#address-cells = <1>;
		#size-cells = <1>;

		partition@0 {
			label = "u-boot";
			reg = <0x0 0x30000>;
			read-only;
		};

		partition@30000 {
			label = "u-boot-env";
			reg = <0x30000 0x10000>;
			read-only;
		};

		factory: partition@40000 {
			label = "factory";
			reg = <0x40000 0x10000>;
			read-only;
		};

		partition@50000 {
			compatible = "denx,uimage";
			label = "firmware";
			reg = <0x50000 0x7b0000>;
		};
	};
};

};

&i2c {
status = "okay";

codec: wm8960@1a {
	compatible = "wlf,wm8960";
	reg = <0x1a>;
	wlf,shared-lrclk;
};

};

&i2s {
status = "okay";
};

&gdma {
status = "okay";
};

/ {
sound {
compatible = "mediatek,mt762x-wm8960-machine";
mediatek,platform = <&i2s>;
mediatek,audio-codec = <&codec>;
audio-routing =
"Headphone", "HP_L",
"Headphone", "HP_R",
"Ext Spk", "SPK_LN",
"Ext Spk", "SPK_LP",
"Ext Spk", "SPK_RN",
"Ext Spk", "SPK_RP",
"Mic", "MICB",
"LINPUT1", "Mic",
"LINPUT2", "Line In",
"RINPUT2", "Line In";
};
};

@kmickz
Copy link
Author

kmickz commented Apr 10, 2023

following is circuit i am using

Screenshot from 2023-04-10 17-44-31

@redchenjs
Copy link
Owner

@kmickz The refclk in the dts file is not needed, the board has an external crystal oscillator for WM8960.

@kmickz
Copy link
Author

kmickz commented Apr 11, 2023

@redchenjs removing refclk from dts file make no difference

@redchenjs
Copy link
Owner

微信截图_20230417204942

@kmickz I use the LinkIt Smart 7688 board with Breakout for LinkIt Smart 7688 v2.0. The WM8960 configuration is almost the same, except for the audio input part. Breakout_for_LinkIt_Smart_7688_v2.0_schematic_files.zip

I tested the wav file and mp3 file using the following commands: test.wav.zip test.mp3.zip

WAV file:
aplay /tmp/test.wav

MP3 file:
madplay /tmp/test.mp3

The playback is fine, and the capture works as well:

arecord -f cd | aplay

My build environment is as follows:

OpenWrt 21.02-SNAPSHOT, r16827-23ad680a345 Kernel 5.4.231
Driver source: https://github.com/redchenjs/mt762x-wm8960/tree/linux-5.4
DTS file: https://github.com/redchenjs/mt762x-wm8960/blob/linux-5.4/examples/mt7628an_mediatek_linkit-smart-7688.dts

@kmickz
Copy link
Author

kmickz commented Jun 10, 2023

hii @redchenjs i was trying to fix this problem can not find solution yet can you please provide me some details regarding your linux 5.4.231

it looks like my DAC is in off state here is some logs which i get

root@OpenWrt:/sys/kernel/debug/asoc/MT762X WM8960 ASoC Card/wm8960.0-001a/dapm# cat Left\ DAC Left DAC: Off in 0 out 4 - R26(0x1a) mask 0x100 stream Playback inactive out "PCM Playback Switch" "Left Output Mixer" in "static" "Playback"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants