From add8afa6996adb75e55ce76be0e46e2396978af4 Mon Sep 17 00:00:00 2001 From: "peter.yang" Date: Tue, 30 Jan 2018 19:19:13 +0800 Subject: [PATCH] Add: capturing & playing in Audacity is OK --- ac108.c | 10 +++--- seeed-8mic-voicecard-overlay.dts | 56 +++++++++++++++++++++---------- seeed-8mic-voicecard.dtbo | Bin 3045 -> 3901 bytes simple-card.c | 3 -- 4 files changed, 44 insertions(+), 25 deletions(-) diff --git a/ac108.c b/ac108.c index 6b2ae52..21f55b8 100644 --- a/ac108.c +++ b/ac108.c @@ -166,7 +166,7 @@ static const struct pll_div ac108_pll_div_list[] = { /* AC108 definition */ #define AC108_CHANNELS_MAX 16 /* range[1, 16] */ #define AC108_RATES (SNDRV_PCM_RATE_8000_96000 | SNDRV_PCM_RATE_KNOT) -#define AC108_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE) +#define AC108_FORMATS (/* SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | SNDRV_PCM_FMTBIT_S24_LE |*/ SNDRV_PCM_FMTBIT_S32_LE) static const DECLARE_TLV_DB_SCALE(tlv_adc_pga_gain, 0, 100, 0); static const DECLARE_TLV_DB_SCALE(tlv_ch_digital_vol, -11925,75,0); @@ -1127,22 +1127,22 @@ static int ac108_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) { case SND_SOC_DAIFMT_NB_NF: dev_dbg(dai->dev, "AC108 config BCLK&LRCK polarity: BCLK_normal,LRCK_normal\n"); brck_polarity = BCLK_NORMAL_DRIVE_N_SAMPLE_P; - lrck_polarity = LRCK_LEFT_LOW_RIGHT_HIGH; + lrck_polarity = LRCK_LEFT_HIGH_RIGHT_LOW; break; case SND_SOC_DAIFMT_NB_IF: dev_dbg(dai->dev, "AC108 config BCLK&LRCK polarity: BCLK_normal,LRCK_invert\n"); brck_polarity = BCLK_NORMAL_DRIVE_N_SAMPLE_P; - lrck_polarity = LRCK_LEFT_HIGH_RIGHT_LOW; + lrck_polarity = LRCK_LEFT_LOW_RIGHT_HIGH; break; case SND_SOC_DAIFMT_IB_NF: dev_dbg(dai->dev, "AC108 config BCLK&LRCK polarity: BCLK_invert,LRCK_normal\n"); brck_polarity = BCLK_INVERT_DRIVE_P_SAMPLE_N; - lrck_polarity = LRCK_LEFT_LOW_RIGHT_HIGH; + lrck_polarity = LRCK_LEFT_HIGH_RIGHT_LOW; break; case SND_SOC_DAIFMT_IB_IF: dev_dbg(dai->dev, "AC108 config BCLK&LRCK polarity: BCLK_invert,LRCK_invert\n"); brck_polarity = BCLK_INVERT_DRIVE_P_SAMPLE_N; - lrck_polarity = LRCK_LEFT_HIGH_RIGHT_LOW; + lrck_polarity = LRCK_LEFT_LOW_RIGHT_HIGH; break; default: pr_err("AC108 config BCLK/LRCLK polarity error:%u\n\n", (fmt & SND_SOC_DAIFMT_INV_MASK) >> 8); diff --git a/seeed-8mic-voicecard-overlay.dts b/seeed-8mic-voicecard-overlay.dts index 684e665..978fb28 100644 --- a/seeed-8mic-voicecard-overlay.dts +++ b/seeed-8mic-voicecard-overlay.dts @@ -52,7 +52,7 @@ reg = <0x1a>; #sound-dai-cells = <0>; }; -/* + ac108_a: ac108@35{ compatible = "x-power,ac108_0"; reg = <0x35>; @@ -66,7 +66,6 @@ #sound-dai-cells = <0>; data-protocol = <0>; }; -*/ }; }; @@ -75,26 +74,49 @@ sound_overlay: __overlay__ { compatible = "simple-audio-card"; - simple-audio-card,format = "dsp_a"; simple-audio-card,name = "seeed-8mic-voicecard"; - status = "okay"; - - simple-audio-card,bitclock-master = <&codec_dai>; - simple-audio-card,frame-master = <&codec_dai>; simple-audio-card,channels-playback-override = <8>; simple-audio-card,channels-capture-override = <8>; + status = "okay"; - cpu_dai: simple-audio-card,cpu { - sound-dai = <&i2s>; - dai-tdm-slot-num = <2>; - dai-tdm-slot-width = <32>; - dai-tdm-slot-tx-mask = <1 1 0 0>; - dai-tdm-slot-rx-mask = <1 1 0 0>; + simple-audio-card,dai-link@0 { + format = "dsp_a"; + bitclock-master = <&codec0_dai>; + frame-master = <&codec0_dai>; + + cpu { + sound-dai = <&i2s>; + dai-tdm-slot-num = <2>; + dai-tdm-slot-width = <32>; + dai-tdm-slot-tx-mask = <1 1 0 0>; + dai-tdm-slot-rx-mask = <1 1 0 0>; + }; + + codec0_dai: codec { + sound-dai = <&ac108_b>; + clocks = <&ac10x_mclk>; + system-clock-id = <1>; + }; }; - codec_dai: simple-audio-card,codec { - sound-dai = <&ac101>; - clocks = <&ac10x_mclk>; - system-clock-id = <1>; + + simple-audio-card,dai-link@1 { + format = "dsp_a"; + bitclock-master = <&codec1_dai>; + frame-master = <&codec1_dai>; + + cpu { + sound-dai = <&i2s>; + dai-tdm-slot-num = <2>; + dai-tdm-slot-width = <32>; + dai-tdm-slot-tx-mask = <1 1 0 0>; + dai-tdm-slot-rx-mask = <1 1 0 0>; + }; + + codec1_dai: codec { + sound-dai = <&ac101>; + clocks = <&ac10x_mclk>; + system-clock-id = <1>; + }; }; }; }; diff --git a/seeed-8mic-voicecard.dtbo b/seeed-8mic-voicecard.dtbo index 1360e19d26a3f608963b028d5e95329c8c182d56..024d5e3920e7c79695d581ba6f1a05d320749aee 100644 GIT binary patch literal 3901 zcmd5zZrYwL&n&c zvFm@({~f9~slG~;%F*Z4{|l%smiLef#HFD zp6azHROlasVg68+iCBdp0IvTvFjT<5K(&`I#0m{mj%@8@4^2C;SE#<*mq{)c8jYLs z1DQuk@>C`ZbQ}5CLCoT%intl*+F|EiFjSmf_kzqcIsQKN!9K^6uMF>O#J{t1L|lj6 z=Yv2ON-R_vinIvzMO?}Au!u7=AE!r<9ITP!F&nIh<6)Q2!!Gc~o_RsjAMBKgIXfAU z>GP0@@va{-{dum>^@Msm?7q1=Sy)@&-mlH*X8h**2SN@9!?U6AFfW5%@*=-b<+15+ zIw2o1@lB*=qE0Hby0%9|JD;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+&vD&++ZRvbKsp2g=$y4iA2K z(=kWXHdG|fskQ+)&2C)Wnn)cbQ6yYF2H-1WoT)W-@#xBNF_K=;6qeI=rEjUVPp4a;+)mI&bzbLe=YC*!BwGhDp7Q;+Ad{VfqTotHop+B6%)j}jwU Pi(oyFKFAuMf!GaaMIVtQ diff --git a/simple-card.c b/simple-card.c index 2f991bf..de08ffe 100644 --- a/simple-card.c +++ b/simple-card.c @@ -199,9 +199,6 @@ extern int ac10x_start_clock(void); static int asoc_simple_card_trigger(struct snd_pcm_substream *substream, int cmd) { - struct snd_soc_pcm_runtime *rtd = substream->private_data; - struct simple_card_data *priv = snd_soc_card_get_drvdata(rtd->card); - int ret = 0; printk("%s() stream=%d cmd=%d\n",