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 1360e19..024d5e3 100644 Binary files a/seeed-8mic-voicecard.dtbo and b/seeed-8mic-voicecard.dtbo differ 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",