Configure MI2S_2_DATA1(GPIO112) as a tx for playback

Hello,

We have connect external codec DA7212 over MI2S_2. we need to configure MI2S_2_DATA1(GPIO112) as a playback or TX.

We work on Linaro-18 Linux release.

Please find attached screenshot for CODEC connections.

Kindly help here.

Regards,
Arjun Salariya

Hi Support Team,

Is there any update?

Thanks,
Arjun

Hello Team,

We have completed above task and the patch is attached here.

Now, the issue we are facing is when we do record and play together, both activities are not happening in parallel. Can you please help here?

Regards,
Parth Y Shah

Attaching the actual patch in a code block would be a lot more useful than attaching a picture of the patch.

From a746d167dcc5866815837b9ca98c7dc00da054eb Mon Sep 17 00:00:00 2001
From: Arjun Salariya <arjun.salariya@einfochips.com>
Date: Fri, 20 Dec 2019 17:33:02 +0530
Subject: [PATCH] Tytocare_g2_a: Configure Mi2s_data1 as playback.

- Command to play audiofile over headphone
- amixer configuration
$ amixer -q cset name='Headphone Volume' 71%
$ amixer -q cset name='Headphone Switch' on
$ amixer -q cset name='Mixout Left DAC Left Switch' on
$ amixer -q cset name='Mixout Right DAC Right Switch' on
$ amixer -q cset name='DAC Left Source MUX' 'DAI Input Left'
$ amixer -q cset name='DAC Right Source MUX'  'DAI Input Right'

- play audio file
$ aplay -D plughw:0,0 <audiofile path *.wav>
---
 sound/soc/qcom/lpass-cpu.c | 27 ++++++++++++++++++++++-----
 1 file changed, 22 insertions(+), 5 deletions(-)

diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c
index 292b103..c15d40f 100644
--- a/sound/soc/qcom/lpass-cpu.c
+++ b/sound/soc/qcom/lpass-cpu.c
@@ -26,6 +26,8 @@
 #include <sound/soc-dai.h>
 #include "lpass-lpaif-reg.h"
 #include "lpass.h"
+#include <dt-bindings/sound/apq8016-lpass.h>
+

 static int lpass_cpu_daiops_set_sysclk(struct snd_soc_dai *dai, int clk_id,
                unsigned int freq, int dir)
@@ -110,23 +112,38 @@ static int lpass_cpu_daiops_hw_params(struct snd_pcm_substream *substream,
        if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
                switch (channels) {
                case 1:
-                       regval |= LPAIF_I2SCTL_SPKMODE_SD0;
+                       if (dai->driver->id == MI2S_QUATERNARY)
+                               regval |= LPAIF_I2SCTL_SPKMODE_SD1;
+                       else
+                               regval |= LPAIF_I2SCTL_SPKMODE_SD0;
                        regval |= LPAIF_I2SCTL_SPKMONO_MONO;
                        break;
                case 2:
-                       regval |= LPAIF_I2SCTL_SPKMODE_SD0;
+                       if (dai->driver->id == MI2S_QUATERNARY)
+                               regval |= LPAIF_I2SCTL_SPKMODE_SD1;
+                       else
+                               regval |= LPAIF_I2SCTL_SPKMODE_SD0;
                        regval |= LPAIF_I2SCTL_SPKMONO_STEREO;
                        break;
                case 4:
-                       regval |= LPAIF_I2SCTL_SPKMODE_QUAD01;
+                       if (dai->driver->id == MI2S_QUATERNARY)
+                               regval |= LPAIF_I2SCTL_SPKMODE_SD1;
+                       else
+                               regval |= LPAIF_I2SCTL_SPKMODE_QUAD01;
                        regval |= LPAIF_I2SCTL_SPKMONO_STEREO;
                        break;
                case 6:
-                       regval |= LPAIF_I2SCTL_SPKMODE_6CH;
+                       if (dai->driver->id == MI2S_QUATERNARY)
+                               regval |= LPAIF_I2SCTL_SPKMODE_SD1;
+                       else
+                               regval |= LPAIF_I2SCTL_SPKMODE_6CH;
                        regval |= LPAIF_I2SCTL_SPKMONO_STEREO;
                        break;
                case 8:
-                       regval |= LPAIF_I2SCTL_SPKMODE_8CH;
+                       if (dai->driver->id == MI2S_QUATERNARY)
+                               regval |= LPAIF_I2SCTL_SPKMODE_SD1;
+                       else
+                               regval |= LPAIF_I2SCTL_SPKMODE_8CH;
                        regval |= LPAIF_I2SCTL_SPKMONO_STEREO;
                        break;
                default:
--

Hello,

Any update here?

Regards,
Parth Y Shah

Ok, so what I’m understanding is that input and output are both working, just not concurrently. Is that correct? How exactly are you testing this?

Yes, Input/output works properly when played independently.

Commands we are using as below for testing:
arecord -D plughw:0,0 -f dat -t wav rec2.wav &
aplay -D plughw:0,0 rec.wav &

Regards,
Parth Y Shah

Those aren’t the full set of commands since you aren’t showing how you set up the mixers.

But judging how you are using the same device, I would assume that you are setting the mixers up such that playback and record are on the same FE, i.e. Multimedia1.

Try setting up the mixers to use separate FE’s.

Thanks for your reply. Below are the configuration commands for DA7212.

amixer -q cset name=‘Aux Switch’ on
amixer -q cset name=‘Mixin Left Aux Left Switch’ on
amixer -q cset name=‘Mixin Right Aux Right Switch’ on
amixer -q cset name=‘ADC Switch’ on
amixer -q cset name=‘Mixout Right Mixin Right Switch’ off
amixer -q cset name=‘Mixout Left Mixin Left Switch’ off
amixer -q cset name=‘Headphone Volume’ 70%
amixer -q cset name=‘Headphone Switch’ on

amixer -q cset name=‘Mixout Left DAC Left Switch’ on
amixer -q cset name=‘Mixout Right DAC Right Switch’ on
amixer -q cset name=‘DAC Left Source MUX’ ‘DAI Input Left’
amixer -q cset name=‘DAC Right Source MUX’ ‘DAI Input Right’

Regards,
Parth Y Shah

Any update here?

Regards,
Parth Y Shah

Yes, @doitright. you are correct. In our case we have same FE for our play and record devices.

root@linaro-alip:~# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: T410c [T410c], device 0: Dailog da7213-hifi-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: T410c [T410c], device 1: WCD multicodec-1 []
Subdevices: 1/1
Subdevice #0: subdevice #0

root@linaro-alip:~# arecord -l
**** List of CAPTURE Hardware Devices ****
card 0: T410c [T410c], device 0: Dailog da7213-hifi-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: T410c [T410c], device 2: WCD-Capture multicodec-2 []
Subdevices: 1/1
Subdevice #0: subdevice #0

I didn’t found any “multimudia1” FE. Belows are amixer controls,

root@linaro-alip:~# amixer controls
numid=39,iface=MIXER,name=‘Headphone Gain Ramping Switch’
numid=34,iface=MIXER,name=‘Headphone ZC Switch’
numid=28,iface=MIXER,name=‘Headphone Switch’
numid=7,iface=MIXER,name=‘Headphone Volume’
numid=40,iface=MIXER,name=‘Lineout Gain Ramping Switch’
numid=29,iface=MIXER,name=‘Lineout Switch’
numid=8,iface=MIXER,name=‘Lineout Volume’
numid=87,iface=MIXER,name=‘Mic 1 Amp Source MUX’
numid=23,iface=MIXER,name=‘Mic 1 Switch’
numid=1,iface=MIXER,name=‘Mic 1 Volume’
numid=88,iface=MIXER,name=‘Mic 2 Amp Source MUX’
numid=24,iface=MIXER,name=‘Mic 2 Switch’
numid=2,iface=MIXER,name=‘Mic 2 Volume’
numid=35,iface=MIXER,name=‘Aux Gain Ramping Switch’
numid=32,iface=MIXER,name=‘Aux ZC Switch’
numid=25,iface=MIXER,name=‘Aux Switch’
numid=3,iface=MIXER,name=‘Aux Volume’
numid=37,iface=MIXER,name=‘ADC Gain Ramping Switch’
numid=16,iface=MIXER,name=‘ADC HPF Cutoff’
numid=15,iface=MIXER,name=‘ADC HPF Switch’
numid=18,iface=MIXER,name=‘ADC Voice Cutoff’
numid=17,iface=MIXER,name=‘ADC Voice Mode Switch’
numid=84,iface=MIXER,name=‘ADC1 Volume’
numid=131,iface=MIXER,name=‘ADC2 MUX’
numid=85,iface=MIXER,name=‘ADC2 Volume’
numid=86,iface=MIXER,name=‘ADC3 Volume’
numid=27,iface=MIXER,name=‘ADC Switch’
numid=5,iface=MIXER,name=‘ADC Volume’
numid=65,iface=MIXER,name=‘ALC Anticlip Level’
numid=64,iface=MIXER,name=‘ALC Anticlip Mode Switch’
numid=52,iface=MIXER,name=‘ALC Attack Rate’
numid=54,iface=MIXER,name=‘ALC Hold Time’
numid=55,iface=MIXER,name=‘ALC Integ Attack Rate’
numid=56,iface=MIXER,name=‘ALC Integ Release Rate’
numid=63,iface=MIXER,name=‘ALC Max Analog Gain Volume’
numid=60,iface=MIXER,name=‘ALC Max Attenuation Volume’
numid=61,iface=MIXER,name=‘ALC Max Gain Volume’
numid=59,iface=MIXER,name=‘ALC Max Threshold Volume’
numid=62,iface=MIXER,name=‘ALC Min Analog Gain Volume’
numid=58,iface=MIXER,name=‘ALC Min Threshold Volume’
numid=57,iface=MIXER,name=‘ALC Noise Threshold Volume’
numid=53,iface=MIXER,name=‘ALC Release Rate’
numid=51,iface=MIXER,name=‘ALC Switch’
numid=124,iface=MIXER,name=‘CIC1 MUX’
numid=125,iface=MIXER,name=‘CIC2 MUX’
numid=9,iface=MIXER,name=‘DAC EQ Switch’
numid=10,iface=MIXER,name=‘DAC EQ1 Volume’
numid=11,iface=MIXER,name=‘DAC EQ2 Volume’
numid=12,iface=MIXER,name=‘DAC EQ3 Volume’
numid=13,iface=MIXER,name=‘DAC EQ4 Volume’
numid=14,iface=MIXER,name=‘DAC EQ5 Volume’
numid=38,iface=MIXER,name=‘DAC Gain Ramping Switch’
numid=20,iface=MIXER,name=‘DAC HPF Cutoff’
numid=19,iface=MIXER,name=‘DAC HPF Switch’
numid=49,iface=MIXER,name=‘DAC Invert Switch’
numid=99,iface=MIXER,name=‘DAC Left Source MUX’
numid=48,iface=MIXER,name=‘DAC Mono Switch’
numid=46,iface=MIXER,name=‘DAC NG OFF Threshold’
numid=47,iface=MIXER,name=‘DAC NG ON Threshold’
numid=45,iface=MIXER,name=‘DAC NG Rampdown Rate’
numid=44,iface=MIXER,name=‘DAC NG Rampup Rate’
numid=43,iface=MIXER,name=‘DAC NG Setup Time’
numid=42,iface=MIXER,name=‘DAC NG Switch’
numid=100,iface=MIXER,name=‘DAC Right Source MUX’
numid=31,iface=MIXER,name=‘DAC Soft Mute Rate’
numid=30,iface=MIXER,name=‘DAC Soft Mute Switch’
numid=22,iface=MIXER,name=‘DAC Voice Cutoff’
numid=21,iface=MIXER,name=‘DAC Voice Mode Switch’
numid=6,iface=MIXER,name=‘DAC Volume’
numid=97,iface=MIXER,name=‘DAI Left Source MUX’
numid=98,iface=MIXER,name=‘DAI Right Source MUX’
numid=126,iface=MIXER,name=‘DEC1 MUX’
numid=127,iface=MIXER,name=‘DEC2 MUX’
numid=50,iface=MIXER,name=‘DMIC Switch’
numid=41,iface=MIXER,name=‘Gain Ramping Rate’
numid=128,iface=MIXER,name=‘HPHL’
numid=129,iface=MIXER,name=‘HPHR’
numid=36,iface=MIXER,name=‘Mixin Gain Ramping Switch’
numid=89,iface=MIXER,name=‘Mixin Left Aux Left Switch’
numid=90,iface=MIXER,name=‘Mixin Left Mic 1 Switch’
numid=91,iface=MIXER,name=‘Mixin Left Mic 2 Switch’
numid=92,iface=MIXER,name=‘Mixin Left Mixin Right Switch’
numid=26,iface=MIXER,name=‘Mixin PGA Switch’
numid=4,iface=MIXER,name=‘Mixin PGA Volume’
numid=33,iface=MIXER,name=‘Mixin PGA ZC Switch’
numid=93,iface=MIXER,name=‘Mixin Right Aux Right Switch’
numid=95,iface=MIXER,name=‘Mixin Right Mic 1 Switch’
numid=94,iface=MIXER,name=‘Mixin Right Mic 2 Switch’
numid=96,iface=MIXER,name=‘Mixin Right Mixin Left Switch’
numid=105,iface=MIXER,name=‘Mixout Left Aux Left Invert Switch’
numid=101,iface=MIXER,name=‘Mixout Left Aux Left Switch’
numid=104,iface=MIXER,name=‘Mixout Left DAC Left Switch’
numid=106,iface=MIXER,name=‘Mixout Left Mixin Left Invert Switch’
numid=102,iface=MIXER,name=‘Mixout Left Mixin Left Switch’
numid=107,iface=MIXER,name=‘Mixout Left Mixin Right Invert Switch’
numid=103,iface=MIXER,name=‘Mixout Left Mixin Right Switch’
numid=112,iface=MIXER,name=‘Mixout Right Aux Right Invert Switch’
numid=108,iface=MIXER,name=‘Mixout Right Aux Right Switch’
numid=111,iface=MIXER,name=‘Mixout Right DAC Right Switch’
numid=114,iface=MIXER,name=‘Mixout Right Mixin Left Invert Switch’
numid=110,iface=MIXER,name=‘Mixout Right Mixin Left Switch’
numid=113,iface=MIXER,name=‘Mixout Right Mixin Right Invert Switch’
numid=109,iface=MIXER,name=‘Mixout Right Mixin Right Switch’
numid=132,iface=MIXER,name=‘RDAC2 MUX’
numid=75,iface=MIXER,name=‘RX1 DCB Cutoff’
numid=78,iface=MIXER,name=‘RX1 DCB Switch’
numid=66,iface=MIXER,name=‘RX1 Digital Volume’
numid=115,iface=MIXER,name=‘RX1 MIX1 INP1’
numid=116,iface=MIXER,name=‘RX1 MIX1 INP2’
numid=117,iface=MIXER,name=‘RX1 MIX1 INP3’
numid=81,iface=MIXER,name=‘RX1 Mute Switch’
numid=76,iface=MIXER,name=‘RX2 DCB Cutoff’
numid=79,iface=MIXER,name=‘RX2 DCB Switch’
numid=67,iface=MIXER,name=‘RX2 Digital Volume’
numid=118,iface=MIXER,name=‘RX2 MIX1 INP1’
numid=119,iface=MIXER,name=‘RX2 MIX1 INP2’
numid=120,iface=MIXER,name=‘RX2 MIX1 INP3’
numid=82,iface=MIXER,name=‘RX2 Mute Switch’
numid=77,iface=MIXER,name=‘RX3 DCB Cutoff’
numid=80,iface=MIXER,name=‘RX3 DCB Switch’
numid=68,iface=MIXER,name=‘RX3 Digital Volume’
numid=121,iface=MIXER,name=‘RX3 MIX1 INP1’
numid=122,iface=MIXER,name=‘RX3 MIX1 INP2’
numid=123,iface=MIXER,name=‘RX3 MIX1 INP3’
numid=83,iface=MIXER,name=‘RX3 Mute Switch’
numid=130,iface=MIXER,name=‘SPK DAC Switch’
numid=69,iface=MIXER,name=‘TX1 Digital Volume’
numid=71,iface=MIXER,name=‘TX1 HPF Cutoff’
numid=73,iface=MIXER,name=‘TX1 HPF Switch’
numid=70,iface=MIXER,name=‘TX2 Digital Volume’
numid=72,iface=MIXER,name=‘TX2 HPF Cutoff’
numid=74,iface=MIXER,name=‘TX2 HPF Switch’

Our DTS schema,

external-dai-link@0 {
link-name = “Dailog”;
cpu { /* QUAT */
sound-dai = <&lpass MI2S_QUATERNARY>;
};
codec {
sound-dai = <&codec_i2c 0>;
};
};

How to separate the FE for play and record device?

Thanks,
Arjun

I’m afraid I might not be the best person to ask about this. I was expecting the audio setup to be more similar to other qualcomm devices (like db820c), but apparently it isn’t.

Hi,

The issue is still not resolved. Can you please guide us how to configure QUAT MI2S as a full duplex for play and record simultaneously ?
Please provide us the kernel machine driver and DTS changes.

Thanks,
Arjun

It is highly unlikely that you will get the support you are requesting, since the Dragonboard 410c does not physically support the configuration you are attempting.

I believe that Linaro offers paid support services for unsupported hardware. I would suggest the email addresses listed on the 96boards main website or contact page to inquire about paid support.