From 471f88b337936051e101254cde0bd32b056eb41d Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Sun, 13 Sep 2020 18:18:30 +0100 Subject: [PATCH 1/9] Use pr_info() for just routine information, not pr_warn() --- ac101.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ac101.c b/ac101.c index a4bcd62..762c8d3 100644 --- a/ac101.c +++ b/ac101.c @@ -1152,14 +1152,14 @@ int ac101_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) switch(fmt & SND_SOC_DAIFMT_MASTER_MASK) { case SND_SOC_DAIFMT_CBM_CFM: /* codec clk & frm master, ap is slave*/ #if _MASTER_MULTI_CODEC == _MASTER_AC101 - pr_warn("AC101 as Master\n"); + pr_info("AC101 as Master\n"); reg_val |= (0x0< Date: Sun, 13 Sep 2020 18:24:25 +0100 Subject: [PATCH 2/9] Use pr_warn() for recoverable errors, not pr_info() --- ac101.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ac101.c b/ac101.c index 762c8d3..92b2583 100644 --- a/ac101.c +++ b/ac101.c @@ -376,7 +376,7 @@ static int ac101_switch_probe(struct ac10x_priv *ac10x) { ac10x->irq = gpiod_to_irq(ac10x->gpiod_irq); if (IS_ERR_VALUE(ac10x->irq)) { - pr_info("[ac101] map gpio to irq failed, errno = %ld\n", ac10x->irq); + pr_warn("[ac101] map gpio to irq failed, errno = %ld\n", ac10x->irq); ac10x->irq = 0; goto _err_irq; } @@ -384,7 +384,7 @@ static int ac101_switch_probe(struct ac10x_priv *ac10x) { /* request irq, set irq type to falling edge trigger */ ret = devm_request_irq(ac10x->codec->dev, ac10x->irq, audio_hmic_irq, IRQF_TRIGGER_FALLING, "SWTICH_EINT", ac10x); if (IS_ERR_VALUE(ret)) { - pr_info("[ac101] request virq %ld failed, errno = %ld\n", ac10x->irq, ret); + pr_warn("[ac101] request virq %ld failed, errno = %ld\n", ac10x->irq, ret); goto _err_irq; } From 955707d944a022a5c41f47c90f192b27bcf20825 Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Mon, 14 Sep 2020 14:26:40 +0100 Subject: [PATCH 3/9] Revert "temporary work-around for not being able to read sysclk from dts for ac10x" This reverts commit 138d22226ed2b36a94d74873f8f1ac3193ee944f. --- seeed-voicecard.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/seeed-voicecard.c b/seeed-voicecard.c index aceb7b9..1ed9a0e 100644 --- a/seeed-voicecard.c +++ b/seeed-voicecard.c @@ -457,8 +457,6 @@ static int seeed_voice_card_dai_link_of(struct device_node *node, #else ret = asoc_simple_parse_clk_codec(dev, codec, dai_link, codec_dai); #endif - if (!strncmp(dai_link->codecs->dai_name, "ac10", 4)) - codec_dai->sysclk = 24000000; if (ret < 0) goto dai_link_of_err; From 47d97e7bd570e3d9cb2187fd041d7bbfda9d14b0 Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Mon, 14 Sep 2020 11:25:59 +0100 Subject: [PATCH 4/9] relocating fixed-clock entry, based on upstream advice See upstream - https://github.com/raspberrypi/documentation/issues/1671 https://github.com/raspberrypi/documentation/pull/1673 Quoted here: * Only Device Tree nodes at the top level of the tree and children of a bus node will be probed. For nodes added at run-time there is the further limitation that the bus must register for notifications of the addition and removal of children. However, there are exceptions that break this rule and cause confusion: the kernel explicitly scans the entire tree for some device types - clocks and interrupt controller being the two main ones - in order to (for clocks) initialise them early and/or (for interrupt controllers) in a particular order. This search mechanism only happens during booting and so doesn't work for nodes added by an overlay at run-time. It is therefore recommended for overlays to place fixed-clock nodes in the root of the tree unless it is guaranteed that the overlay will not be used at run-time. --- seeed-4mic-voicecard-overlay.dts | 2 +- seeed-8mic-voicecard-overlay.dts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/seeed-4mic-voicecard-overlay.dts b/seeed-4mic-voicecard-overlay.dts index de7213b..db0b988 100644 --- a/seeed-4mic-voicecard-overlay.dts +++ b/seeed-4mic-voicecard-overlay.dts @@ -13,7 +13,7 @@ }; fragment@1 { - target-path = "/clocks"; + target-path = "/"; __overlay__ { ac108_mclk: codec-mclk { compatible = "fixed-clock"; diff --git a/seeed-8mic-voicecard-overlay.dts b/seeed-8mic-voicecard-overlay.dts index 6d60469..56a1433 100644 --- a/seeed-8mic-voicecard-overlay.dts +++ b/seeed-8mic-voicecard-overlay.dts @@ -13,7 +13,7 @@ }; fragment@1 { - target-path = "/clocks"; + target-path = "/"; __overlay__ { ac10x_mclk: codec-mclk { compatible = "fixed-clock"; From 673305fc4e4a8ad5b188dbb3825b49ebbbbf3471 Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Mon, 14 Sep 2020 11:27:45 +0100 Subject: [PATCH 5/9] rebuilt dtbo on current Raspbian --- seeed-4mic-voicecard.dtbo | Bin 2349 -> 2259 bytes seeed-8mic-voicecard.dtbo | Bin 3463 -> 3385 bytes 2 files changed, 0 insertions(+), 0 deletions(-) diff --git a/seeed-4mic-voicecard.dtbo b/seeed-4mic-voicecard.dtbo index 764dc804b98a83cb68fff3a92157b5c2e20671f1..09ee56626c466a2f3d1bca1e8482608c2c88a8d9 100644 GIT binary patch delta 421 zcmZ20bXid20`I@K3=ABX85kHW7#P^@0BH>%76f7eAO-@)??CY-6E&7|Fadd5`V0&c zZ|6)7XLJ#a2FU_3GZ3=?an|HDjQ)&elm9Tv3swR7AOMpKo@~REF4~b&To9j#kP!tk z7fjy4WNx?($U-*jIvW2gkPos0Y96EFWCdpN$?nW5hCcs+07)hc$OgF-rZOGKR)F$> zUSh18Jcn7Dv48RoX64DRnKe{>fO5#{mq69RT@K_kPX55A&MF0Dte#xLV$Ha9@&*=t z#siZd0Lc@R1z43CuT3ss)tVf~D#&;b$ns}=G5G*%G~=7eGHl9>A16Do#S4Ob2m&y3 guTS2Ex0`I@K3=EvQ3=9kw3=HfBKw1Nc1%X%qh=G9dF9QSHkBJ(~c{qSPE&b%2 z{N(K7iPv*DnSp#3AdZ}D!{{xT2vQ5gFwug^GZ_6DYbL*7lviy4ih}@5E*QvWLgGh) z_>&zNB`2FQd5QL=6c@yUi~|CY4pAUpHhBt@dEg!(3)zmlX#C$mKFCE-dl=PG`3xX? zk>r6c=V8|N4f+oRNV;NxY$Vq)<^uT&PXhWHvB@81Dc@ zbSCq#@-sdGva}}eW9FRf&nmskzfXR{8ZQV6ClG*!1H;|PF>Kmk ecOZ!}u9`f94P^5Pwsf|f%)HVHoz42}OBey)FHxre diff --git a/seeed-8mic-voicecard.dtbo b/seeed-8mic-voicecard.dtbo index 4ef515b52dc5e8ef508e41cea63bb9f1f0fe3d55..2dcaa93d42b0a3535fbe2aaea8354e8690d6ac9e 100644 GIT binary patch delta 920 zcmah{&r4KM6u#&En0ar;2?t|Dr^V=yjftpD!c;~GxyT{{4T+>2-n>+pbZW+(QqUrV zAna`X11z^eRJ3RrZCVT@E~1UlqK)8k+F0M2dDlh|JaFzk-*>)q-#ho7=gCi$|a1lK4%BqsN>f3RNgALN&c z6@&+W@CLC|NE=es0)P7#hFv-k)BG1sneDXAIr9uJnmKzLxnUkLlU+aRy8qw(4XjTL zdNQxn^_N6{`dB^c9iA~d__Z}oHQuwj&(R4X;X!kB@i10LHQ&dZcIJs+D3|W%A&2Se zVi0S*d>AWfPK>Y#5t7wQ{YMW*Q)X$RO2 z)Zj@jPM#w;9mB8{%GxzBA>NNBxI5fM244*iP>d^BJ9z_Z59i&Kl_ zPo-kZN~vo~MULZ6!#(&BI4m%!l)Jr>UXMCJeYr|=veIbt$MCV0A9uq+|3&FpeEc+Su|5*)I+sOPyqn7FjH*Sp{S4cJsA zD$TDb@h6`@aA>}4QL8EONT^2N`Az7|ef1Xwqey83BTu8%iAUwx<_yw%4@gedEQ>Kk zF8Vn=WR)E&V|;Sf%H~ zM z2vvxaZpM?{h-pm={J>3kqFhX8clenr+TOc0yIF6|KFM+_QsDW>+xS$yRhgM?UTBpc OPqdXr{To-K7X1eSFNL@O From d64e99498251f0dec7e8c7420be9a2c071656d13 Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Mon, 14 Sep 2020 11:10:31 +0000 Subject: [PATCH 6/9] updating non-standard PATH for Ubuntu in uninstall.sh --- uninstall.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/uninstall.sh b/uninstall.sh index 6b9f8d1..c88caf9 100755 --- a/uninstall.sh +++ b/uninstall.sh @@ -53,6 +53,7 @@ do_overlay() { RPI_HATS="seeed-2mic-voicecard seeed-4mic-voicecard seeed-8mic-voicecard" +PATH=$PATH:/opt/vc/bin echo "remove dtbos" for i in $RPI_HATS; do dtoverlay -r $i From 655d7fe57bdeff7bb1bc198b87ce57d4b0719887 Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Mon, 14 Sep 2020 11:13:40 +0000 Subject: [PATCH 7/9] updating for Ubuntu location of dkms-generated kernel modules --- uninstall.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/uninstall.sh b/uninstall.sh index c88caf9..a00f7a1 100755 --- a/uninstall.sh +++ b/uninstall.sh @@ -82,6 +82,9 @@ echo "remove kernel modules" rm /lib/modules/*/kernel/sound/soc/codecs/snd-soc-wm8960.ko || true rm /lib/modules/*/kernel/sound/soc/codecs/snd-soc-ac108.ko || true rm /lib/modules/*/kernel/sound/soc/bcm/snd-soc-seeed-voicecard.ko || true +rm /lib/modules/*/updates/dkms/snd-soc-wm8960.ko || true +rm /lib/modules/*/updates/dkms/snd-soc-ac108.ko || true +rm /lib/modules/*/updates/dkms/snd-soc-seeed-voicecard.ko || true echo "remove $CONFIG configuration" for i in $RPI_HATS; do From edddb2fbe479c6a2a4ffac6fc9f4f2f7f3141c88 Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Sat, 12 Sep 2020 00:39:19 +0000 Subject: [PATCH 8/9] Apparently, snd_soc_dai_set_bclk_ratio should be used where snd_soc_dai_set_tdm_slot is. See, for example, commit b78b30e32a19f1ac79c26e0a3e9f7bc7385a02a2 Author: j-schambacher Date: Tue May 19 13:56:17 2020 +0200 Switch to snd_soc_dai_set_bclk_ratio Replaces obsolete function snd_soc_dai_set_tdm_slot --- seeed-voicecard.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/seeed-voicecard.c b/seeed-voicecard.c index 1ed9a0e..43535aa 100644 --- a/seeed-voicecard.c +++ b/seeed-voicecard.c @@ -322,10 +322,8 @@ static int asoc_simple_init_dai(struct snd_soc_dai *dai, } if (simple_dai->slots) { - ret = snd_soc_dai_set_tdm_slot(dai, - simple_dai->tx_slot_mask, - simple_dai->rx_slot_mask, - simple_dai->slots, + ret = snd_soc_dai_set_bclk_ratio(dai, + simple_dai->slots * simple_dai->slot_width); if (ret && ret != -ENOTSUPP) { dev_err(dai->dev, "simple-card: set_tdm_slot error\n"); From bb09e9d24b481c1891fd8f9b1a925fd6a16ab020 Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Sun, 13 Sep 2020 15:33:56 +0000 Subject: [PATCH 9/9] emit warning for calling ac108_set_sysclk() with unexpected arguments Don't know why Seeed Studio staff did not put it in. Conflicts: ac108.c --- ac108.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ac108.c b/ac108.c index 29e0a94..12ab27b 100644 --- a/ac108.c +++ b/ac108.c @@ -810,6 +810,9 @@ static int ac108_set_sysclk(struct snd_soc_dai *dai, int clk_id, unsigned int fr struct ac10x_priv *ac10x = snd_soc_dai_get_drvdata(dai); + if (freq != 24000000 || clk_id != SYSCLK_SRC_PLL) + dev_warn(dai->dev, "ac108_set_sysclk freq = %d clk = %d\n", freq, clk_id); + freq = 24000000; clk_id = SYSCLK_SRC_PLL;