How to enable DMIC and get data to ALSA

I need a direction as to how to create the driver (as well as DTS/DTB) for audio recording/encoding via DMIC.

Currently, we went only as far in getting a log from dmesg saying that

[    5.139855] tegra210_dmic_platform_probe: platform probe started
[    5.140208] tegra210-dmic tegra210-dmic.3: Missing dap-active state
[    5.140209] Missing dap-active state
[    5.140210] tegra210_dmic_platform_probe: return err_dap

It would be really helpful if someone could offer the guidance and share the insight.

Regarding the device tree, we found that in
t18x/common/kernel-dts/t18x-common-platforms/tegra186-quill-common.dtsi, DMIC pins have mapped to DMIC3

A0_DMIC_IN_CLK = CAN_GPIO1 = can_gpio_paa1 (input to camera carrier module)
A0_DMIC_IN_DAT = CAN_GPIO0 = can_gpio_paa0 (output from camera carrier module)

/* Dynamic pinmux config for DMIC3 */I/* Dynamic pinmux config for DMIC3 */
                dmic3_dap_active_state: dmic3_dap_active {
                        dmic_can_gpio0_paa0 {
                                nvidia,pins = "can_gpio0_paa0";
                                nvidia,function = "dmic3";
                        dmic_can_gpio1_paa1 {
                                nvidia,pins = "can_gpio1_paa1";
                                nvidia,function = "dmic3";
                dmic3_dap_inactive_state: dmic3_dap_inactive {
                        dmic_can_gpio0_paa0 {
                                nvidia,pins = "can_gpio0_paa0";
                                nvidia,function = "dmic5";
                        dmic_can_gpio1_paa1 {
                                nvidia,pins = "can_gpio1_paa1";
                                nvidia,function = "dmic5";

From there, apparently I need to enable DMIC3 and get the data from DMIC3 to ALSA. Please help, especially the reference to the driver and the methods.

Thanks in advance.


With regard to the “Missing dap-active state” error can you confirm that you have the following in the tegra186-quill-common.dtsi file …

733         ahub {
 734                 dmic@2904000 {
 735                         nvidia,is-pinctrl = <1>;
 736                         pinctrl-names = "dap_active", "dap_inactive";
 737                         pinctrl-0 = <&dmic1_dap_active_state>;
 738                         pinctrl-1 = <>;
 739                 };
 740                 dmic@2904100 {
 741                         nvidia,is-pinctrl = <1>;
 742                         pinctrl-names = "dap_active", "dap_inactive";
 743                         pinctrl-0 = <&dmic2_dap_active_state>;
 744                         pinctrl-1 = <>;
 745                 };
 746                 dmic@2904200 {
 747                         nvidia,is-pinctrl = <1>;
 748                         pinctrl-names = "dap_active", "dap_inactive";
 749                         pinctrl-0 = <&dmic3_dap_active_state>;
 750                         pinctrl-1 = <&dmic3_dap_inactive_state>;
 751                 };

The pins need to be configured as SFIO (special function IO) and not GPIO in order to be used as DMIC pins. Is busybox installed? If so you can check this by dumping the GPIO_ENABLE_CONFIG for the DMIC pins …

ubuntu@tegra-ubuntu:~$ sudo busybox devmem 0xc2f1c00
ubuntu@tegra-ubuntu:~$ sudo busybox devmem 0xc2f1c20

Bit 0 in the above registers determine if it is SFIO or GPIO. If bit 0 is 0 then it is SFIO (which we want).

Then to record from DMIC3 …

amixer -c tegrasndt186ref sset "ADMAIF2 Mux" DMIC3
arecord -D hw:tegrasndt186ref,1 -r 48000 -c2 -f S16_LE cap.wav


Thanks a lot, Jon. I’ll update you the test result.

The hardware is a customized daughter card with Knowles DMICs connecting to PIN 71 and 73 (Camera Expansion Header J22, ref: Developer Kit Carrier Board Specification, Table 14), plus cameras.

After a few rounds of trial-and-error, we went back to the default DT and driver. The error in dmesg log is actually gone. The amixer and arecord commands are working. In other words, DMIC works in default settings. No change is needed in DT and drivers. Thanks, Jon!

The next step is to integrate the commands with GST video capture. Any suggestions?

For GST video capture, you could reference our User Guide doc,

Thanks for the reference, chijen.

For update, please see my follow up thread