Device tree for I2S0 on Hikey 960


#63

Who can talk about i2s0_pmx_func and i2s0_cfg_func?


#64

Hi, guodong. I set some fike as you said in 30, March. but there is no BCLK when I play some audio.


#65

@guodong I could see I2S got enabled on Hikey960 and I assume this will work out-of box if we connect to codec board on LS expansion header on Hikey960.
#tinyplay /sdcard/Music/1khz_stereo_sinwave.wav -D 0 -d 0.
This will demonstrate play/capture audio data by ARM

However we like to send audio data directly from DSP to Codec board(i2s) or reading audio data from Codec board to DSP (i2s).

Could you please ask HiSilicon to provide the sample code to do same on latest AOSP ?


#66

-d 0 is the HDMI. You need to use -d 1.
Your sound file needs to be 16 bit, 48 kHz, stereo.


#67

Does below change is enough to enable 8mic recording using tinycap,
8 - Mic codec board connected to 40 pin expansion header on Hikey960?

diff --git a/sound/soc/hisilicon/hisi-i2s-plat.c b/sound/soc/hisilicon/hisi-i2s-plat.c
index 6789b59…099dffb 100644
— a/sound/soc/hisilicon/hisi-i2s-plat.c
+++ b/sound/soc/hisilicon/hisi-i2s-plat.c
@@ -64,9 +64,9 @@ static int virtual_set_dai_sysclk(struct snd_soc_dai *codec_dai,
},
.capture = {
.stream_name = “PCM Capture”,

  •                   .channels_min   = 2,
    
  •                   .channels_max   = 2,
    
  •                   .rates          = SNDRV_PCM_RATE_48000,
    
  •                   .channels_min   = 1,
    
  •                   .channels_max   = 8,
    
  •        .rates             = SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_48000,
                      .formats        = SNDRV_PCM_FMTBIT_S16_LE |
                                               SNDRV_PCM_FMTBIT_U16_LE,
              },
    

diff --git a/sound/soc/hisilicon/hisi-i2s.c b/sound/soc/hisilicon/hisi-i2s.c
index 77ff490…59e8b88 100644
— a/sound/soc/hisilicon/hisi-i2s.c
+++ b/sound/soc/hisilicon/hisi-i2s.c
@@ -320,6 +320,7 @@ static int hisi_i2s_hw_params(struct snd_pcm_substream *substream,
static int hisi_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
struct snd_soc_dai *cpu_dai)
{
+
switch (cmd) {
case SNDRV_PCM_TRIGGER_START:
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
@@ -377,11 +378,11 @@ struct snd_soc_dai_driver hisi_i2s_dai_init[] = {
.rates = SNDRV_PCM_RATE_48000,
},
.capture = {

  •           .channels_min = 2,
    
  •           .channels_max = 2,
    
  •           .channels_min = 1,
    
  •           .channels_max = 8,
              .formats = SNDRV_PCM_FMTBIT_S16_LE |
                         SNDRV_PCM_FMTBIT_U16_LE,
    
  •           .rates = SNDRV_PCM_RATE_48000,
    
  •    .rates         = SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_48000,
      },
      .ops = &hisi_i2s_dai_ops,
      },

#68

No. That’s just enough to make it lie to userspace about the maximum number of channels.

There are other changes needed to make it capture more than 2 channels, many or all of which are undocumented.

You will have to reverse engineer the needed changes from production kernels for other devices having the same soc.


#69

Below is our codec board capability and it has got 8 mics enabled with the below configuration.
I assume I have to modify from #define HI_ASP_CFG_R_CLK4_DIV_SEL 0x00ff000f
to #define HI_ASP_CFG_R_CLK4_DIV_SEL 0x00ff002f
please let me know if any other changes i have to make to receive 8 mics data using tinycap

  1. LRCLK: 16 KHz

  2. BCLK: 1.024 MHz

  3. AIF1TX path

    -> AIF1TX1 : Left Mic
    -> AIF1TX2 : Right Mic
    -> AIF1TX3 : Tone Generator
    -> AIF1TX4 : Left Mic
    -> AIF1TX5 : Right Mic
    -> AIF1TX6 : Tone Generator
    -> AIF1TX7 : Left Mic
    -> AIF1TX8 : Noise Generator