Enable DMic (Linux)

Hello,

I am trying to enable The DMic but not successful yet:(.
Is there any document that helps in the exact procedure of disabling the UART and enabling the DMic?
It would be really helpful if someone could help me with the procedure.
Thank you in advance.

Note : I am working on the Linaro Linux release 17.09 and Linux kernel 4.9.56.

Hi @SharatKulkarni,

Below diff works fine for me.

diff --git a/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi b/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi
index 5d0d5a3..061f5f3 100644
--- a/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi
+++ b/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi
@@ -42,7 +42,7 @@
 
                serial@78af000 {
                        label = "LS-UART0";
-                       status = "okay";
+                       status = "disabled";
                        pinctrl-names = "default", "sleep";
                        pinctrl-0 = <&blsp1_uart1_default>;
                        pinctrl-1 = <&blsp1_uart1_sleep>;
@@ -281,13 +281,17 @@
                         reg-names = "mic-iomux", "spkr-iomux";
 
                         status = "okay";
-                        pinctrl-0 = <&cdc_pdm_lines_act &ext_sec_tlmm_lines_act &ext_mclk_tlmm_lines_act>;
-                        pinctrl-1 = <&cdc_pdm_lines_sus &ext_sec_tlmm_lines_sus &ext_mclk_tlmm_lines_sus>;
+                        pinctrl-0 = <&cdc_pdm_lines_act &ext_sec_tlmm_lines_act &ext_mclk_tlmm_lines_act &cdc_dmic_lines_act>;
+                        pinctrl-1 = <&cdc_pdm_lines_sus &ext_sec_tlmm_lines_sus &ext_mclk_tlmm_lines_sus &cdc_dmic_lines_sus>;
                         pinctrl-names = "default", "sleep";
                         qcom,model = "DB410c";
                         qcom,audio-routing =
                                 "AMIC2", "MIC BIAS Internal2",
-                                "AMIC3", "MIC BIAS External1";
+                                "AMIC3", "MIC BIAS External1",
+                               "DMIC1", "MIC BIAS Internal1",
+                               "DMIC1", "Digital Mic1",
+                               "DMIC2", "MIC BIAS Internal1",
+                               "DMIC2", "Digital Mic2";
                        external-dai-link@0 {
                                link-name = "ADV7533";
                                cpu { /* QUAT */
@@ -609,4 +613,4 @@

Note: Make sure you have soldered the unpopulated J7 aka. Analog Expansion Connector, as MIC_BIAS1 is available there only.

Hope this helps.

Thanks,
Mani

Source is still DEC1 MUX only.

root@linaro-alip:~# amixer -c0

Simple mixer control 'DEC1 MUX',0
  Capabilities: enum
  Items: 'ZERO' 'ADC1' 'ADC2' 'ADC3' 'DMIC1' 'DMIC2'
  Item0: 'DMIC1'

I will work on creating a guide in 96Boards documentation.

Thanks,
Mani

1 Like

Most excellent!

I was recently able to get this to work with the same mods to apq8016-sbc.dtsi as you posted however there was some very strange behaviour. Basically, once DEC1 MUX was set to DMIC1 it worked correctly BUT I could no longer switch back to other inputs (was able to change value of DEC1 MUX in alsamixer but to no effect). The only way to get DEC1 MUX back to another input was by restarting the device.

Any ideas?

How about resetting the mux? :wink:

amixer cset iface=MIXER,name='DEC1 MUX' 'ZERO'

-Mani

Hello @Mani,

I made the changes as suggested by you and now DMIC works perfectly :slight_smile: .
Thank you very much for the suggestions.

Thanks and Regards,
Sharat Kulkarni.

1 Like

Hi Leonid,

in your comment, you set “# tinymix 631 DMIC1”. May I ask u 1 thing. What did u set with number “631” here? because I’m using Android 6.0.1 with kernel 3.10.49. the env may be different with yours.

When I set like u, the shell returned to me “MultiMedia2 EQ Band3: 0 0 0 0 0 (range 0->255)”. I thought that It does not relate to DMIC.
And definitely, I did not receive anything from my DMIC board.

[EDIT]
when booting up, I received the below log many times:
msm8x16-asoc-wcd sound.66: ASoC: CODEC (null) not registered
msm8x16-asoc-wcd sound.66: snd_soc_register_card failed (-517)

Is it the problem from the driver or something missed from the Device tree? And does it affect the DMIC communication?

I appreciate any ideas from you.
thanks

@Mani
finally got around to trying this command, still having the same problem :frowning:

Any other ideas?

@sabjorn

You need to reset both Muxes as below:

$ amixer cset iface=MIXER,name='DEC1 MUX' 'ZERO'
$ amixer cset iface=MIXER,name='CIC1 MUX' 'ZERO'

Will update the guide accordingly.

Thanks,
Mani