Add: capturing & playing in Audacity is OK

This commit is contained in:
peter.yang 2018-01-30 19:19:13 +08:00
parent 995c17c160
commit add8afa699
4 changed files with 44 additions and 25 deletions

10
ac108.c
View file

@ -166,7 +166,7 @@ static const struct pll_div ac108_pll_div_list[] = {
/* AC108 definition */ /* AC108 definition */
#define AC108_CHANNELS_MAX 16 /* range[1, 16] */ #define AC108_CHANNELS_MAX 16 /* range[1, 16] */
#define AC108_RATES (SNDRV_PCM_RATE_8000_96000 | SNDRV_PCM_RATE_KNOT) #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_adc_pga_gain, 0, 100, 0);
static const DECLARE_TLV_DB_SCALE(tlv_ch_digital_vol, -11925,75,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: case SND_SOC_DAIFMT_NB_NF:
dev_dbg(dai->dev, "AC108 config BCLK&LRCK polarity: BCLK_normal,LRCK_normal\n"); dev_dbg(dai->dev, "AC108 config BCLK&LRCK polarity: BCLK_normal,LRCK_normal\n");
brck_polarity = BCLK_NORMAL_DRIVE_N_SAMPLE_P; brck_polarity = BCLK_NORMAL_DRIVE_N_SAMPLE_P;
lrck_polarity = LRCK_LEFT_LOW_RIGHT_HIGH; lrck_polarity = LRCK_LEFT_HIGH_RIGHT_LOW;
break; break;
case SND_SOC_DAIFMT_NB_IF: case SND_SOC_DAIFMT_NB_IF:
dev_dbg(dai->dev, "AC108 config BCLK&LRCK polarity: BCLK_normal,LRCK_invert\n"); dev_dbg(dai->dev, "AC108 config BCLK&LRCK polarity: BCLK_normal,LRCK_invert\n");
brck_polarity = BCLK_NORMAL_DRIVE_N_SAMPLE_P; brck_polarity = BCLK_NORMAL_DRIVE_N_SAMPLE_P;
lrck_polarity = LRCK_LEFT_HIGH_RIGHT_LOW; lrck_polarity = LRCK_LEFT_LOW_RIGHT_HIGH;
break; break;
case SND_SOC_DAIFMT_IB_NF: case SND_SOC_DAIFMT_IB_NF:
dev_dbg(dai->dev, "AC108 config BCLK&LRCK polarity: BCLK_invert,LRCK_normal\n"); dev_dbg(dai->dev, "AC108 config BCLK&LRCK polarity: BCLK_invert,LRCK_normal\n");
brck_polarity = BCLK_INVERT_DRIVE_P_SAMPLE_N; brck_polarity = BCLK_INVERT_DRIVE_P_SAMPLE_N;
lrck_polarity = LRCK_LEFT_LOW_RIGHT_HIGH; lrck_polarity = LRCK_LEFT_HIGH_RIGHT_LOW;
break; break;
case SND_SOC_DAIFMT_IB_IF: case SND_SOC_DAIFMT_IB_IF:
dev_dbg(dai->dev, "AC108 config BCLK&LRCK polarity: BCLK_invert,LRCK_invert\n"); dev_dbg(dai->dev, "AC108 config BCLK&LRCK polarity: BCLK_invert,LRCK_invert\n");
brck_polarity = BCLK_INVERT_DRIVE_P_SAMPLE_N; brck_polarity = BCLK_INVERT_DRIVE_P_SAMPLE_N;
lrck_polarity = LRCK_LEFT_HIGH_RIGHT_LOW; lrck_polarity = LRCK_LEFT_LOW_RIGHT_HIGH;
break; break;
default: default:
pr_err("AC108 config BCLK/LRCLK polarity error:%u\n\n", (fmt & SND_SOC_DAIFMT_INV_MASK) >> 8); pr_err("AC108 config BCLK/LRCLK polarity error:%u\n\n", (fmt & SND_SOC_DAIFMT_INV_MASK) >> 8);

View file

@ -52,7 +52,7 @@
reg = <0x1a>; reg = <0x1a>;
#sound-dai-cells = <0>; #sound-dai-cells = <0>;
}; };
/*
ac108_a: ac108@35{ ac108_a: ac108@35{
compatible = "x-power,ac108_0"; compatible = "x-power,ac108_0";
reg = <0x35>; reg = <0x35>;
@ -66,7 +66,6 @@
#sound-dai-cells = <0>; #sound-dai-cells = <0>;
data-protocol = <0>; data-protocol = <0>;
}; };
*/
}; };
}; };
@ -75,29 +74,52 @@
sound_overlay: __overlay__ { sound_overlay: __overlay__ {
compatible = "simple-audio-card"; compatible = "simple-audio-card";
simple-audio-card,format = "dsp_a";
simple-audio-card,name = "seeed-8mic-voicecard"; 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-playback-override = <8>;
simple-audio-card,channels-capture-override = <8>; simple-audio-card,channels-capture-override = <8>;
status = "okay";
cpu_dai: simple-audio-card,cpu { simple-audio-card,dai-link@0 {
format = "dsp_a";
bitclock-master = <&codec0_dai>;
frame-master = <&codec0_dai>;
cpu {
sound-dai = <&i2s>; sound-dai = <&i2s>;
dai-tdm-slot-num = <2>; dai-tdm-slot-num = <2>;
dai-tdm-slot-width = <32>; dai-tdm-slot-width = <32>;
dai-tdm-slot-tx-mask = <1 1 0 0>; dai-tdm-slot-tx-mask = <1 1 0 0>;
dai-tdm-slot-rx-mask = <1 1 0 0>; dai-tdm-slot-rx-mask = <1 1 0 0>;
}; };
codec_dai: simple-audio-card,codec {
codec0_dai: codec {
sound-dai = <&ac108_b>;
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>; sound-dai = <&ac101>;
clocks = <&ac10x_mclk>; clocks = <&ac10x_mclk>;
system-clock-id = <1>; system-clock-id = <1>;
}; };
}; };
}; };
};
__overrides__ { __overrides__ {
card-name = <&sound_overlay>,"seeed-voicecard,name"; card-name = <&sound_overlay>,"seeed-voicecard,name";

Binary file not shown.

View file

@ -199,9 +199,6 @@ extern int ac10x_start_clock(void);
static int asoc_simple_card_trigger(struct snd_pcm_substream *substream, int cmd) 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; int ret = 0;
printk("%s() stream=%d cmd=%d\n", printk("%s() stream=%d cmd=%d\n",