TLVAI32x4 driver with Jetson TX2

Continuing the discussion from Add I2S audio in the source code of JetPack4.2:

Hi,
I am trying to use this tlv320aic32x4.c but i am getting following error:
undefined reference to `aic32x4_regmap_config’

Can you please help to resolve this ?

Hello!

This error means that aic32x4_regmap_config is being used but it is not defined. Looking at the v4.9 kernel, I see that this structure is defined here. You mentioned in the other thread that you had made a lot of changes and so I would check to see if you have removed this. If you had an earlier working version of the driver the easiest thing to do is undo your changes and figure out which change introduced this problem.

Regards,
Jon

Hi Jon,

I have made the changes as mentioned in this thread . As sson as i make changes in machine_driver.c file , I am getting kernel panic due to this message:
[ 1.754958] Process swapper/0 (pid: 1, stack limit = 0xffffffc1adb38000)
[ 1.761645] Call trace:
[ 1.764086] [] add_timer+0x38/0x40
[ 1.769040] [] __queue_delayed_work+0xac/0x190
[ 1.775035] [] queue_delayed_work_on+0x7c/0x88
[ 1.781032] [] rt5659_set_jack_detect+0x5c/0x70
[ 1.787115] [] tegra_machine_rt565x_init+0xa4/0x1b0
[ 1.793543] [] snd_soc_instantiate_card+0x7fc/0xbb8
[ 1.799972] [] snd_soc_register_card+0x164/0x210
[ 1.806141] [] tegra_machine_driver_probe+0x454/0x600
[ 1.812744] [] platform_drv_probe+0x60/0xc0
[ 1.818478] [] driver_probe_device+0xd8/0x408
[ 1.824385] [] __driver_attach+0xdc/0x128
[ 1.829947] [] bus_for_each_dev+0x5c/0xa8
[ 1.835508] [] driver_attach+0x30/0x40
[ 1.840808] [] bus_add_driver+0x20c/0x2a8
[ 1.846369] [] driver_register+0x6c/0x110
[ 1.851930] [] __platform_driver_register+0x5c/0x68
[ 1.858358] [] tegra_asoc_machine_driver_init+0x18/0x20
[ 1.865132] [] do_one_initcall+0x44/0x130
[ 1.870694] [] kernel_init_freeable+0x1a0/0x244
[ 1.876776] [] kernel_init+0x18/0x108
[ 1.881990] [] ret_from_fork+0x10/0x40
[ 1.887295] —[ end trace bc1eccdfd4854f6e ]—
[ 1.896950] Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
Can you please help to resolve this?

Hello!

Yes we have seen this problem and has been fixed in the most latest L4T release. You can find a fix for this here.

Regards,
Jon

Thanks.But how do we fix it if i am using Jetpack 4.2?
Regards
Goutam

Hello!

Are you able to make the change shown in the above patch locally?

Jon

I am not able to make the change. Where is the function rt5659_set_jack_detect() called? Can you please help to make this change.

Regards

Hello!

So you just need to make the following change …

--- a/sound/soc/tegra-alt/machine_drivers/tegra_machine_driver_mobile.c
+++ b/sound/soc/tegra-alt/machine_drivers/tegra_machine_driver_mobile.c
@@ -1266,11 +1266,11 @@ static int tegra_machine_driver_probe(struct platform_device *pdev)
                        dev_info(&pdev->dev, "This is a dummy codec\n");
                        machine->is_codec_dummy = 1;
                }
-       }
 
-       if (!machine->is_codec_dummy) {
-               /* setup for jack detection only in non-dummy case */
-               rt5659_set_jack_detect(codec, &tegra_machine_hp_jack);
+               if (!machine->is_codec_dummy) {
+                       /* setup for jack detection only in non-dummy case */
+                       rt5659_set_jack_detect(codec, &tegra_machine_hp_jack);
+               }
        }
 
        return 0;

Per the diff, this is in the sound/soc/tegra-alt/machine_drivers/tegra_machine_driver_mobile.c file. Does this help?

Regards,
Jon

Hi Jon,
Thanks for your input. The kernel panic message is not coming and the system boots now. I am still not able to make the audio up and running. I have followed the same changes as mentioned in this forum Add I2S audio in the source code of JetPack4.2 - #12 by sharadg.

Please find attached the demsg logs and other debug logs. dmesg.txt (105.1 KB) clock_summary.txt (2.0 KB)

Regards
Goutam

Hello!

Please can you share a diff of all the changes that you have made? That will probably be easier. Please note that there is another user attempting to use the same codec here.

Jon

Hi Jon,
Please find attacheddiff.txt (35.1 KB) the list of all the diff changes:

Regards
Goutam

Hello!

It appears that you are trying to apply all of Igal’s changes directly to JP 4.2. We should not need to do that and there are some changes you no longer need to make. I would recommend that you …

  1. Remove all the changes you have made.
  2. First make the changes as shown here
  3. Then apply the correction here
  4. Correction the codec routing as shown here

Regards,
Jon

Thanks Jon.
How do we enable the MICBIAS voltage as i can not see any MICBIAS voltage. As per wiki, I tried this but it didn’t work.

aic32x4: tlv320aic32x4.1-0018@18 {
                    compatible = "ti,tlv320aic32x4";
                    status = "okay";
                    reg = <0x18>;
                    clocks = <&tegra_car TEGRA186_CLK_AUD_MCLK>;
                    clock-names = "mclk";
                      micbias-resistor-k-ohms = <2>;
                      micbias-voltage-m-volts = <3000>;
                    dv-supply = <&battery_reg>;
                    av-supply = <&battery_reg>;
                    iov-supply = <&battery_reg>;
           };	
};

As there any command for mixer setting to enable MICIN and LINE IN .
Regards

Hello!

There is a SND_SOC_DAPM_MICBIAS definition for the codec MICBIAS in the driver. To enable this, you would typically add a route to enable it when recording. So if you have the following routing …

nvidia,audio-routing =
            "z Headphone", "z LOL",
            "z Headphone", "z LOR",
            "z IN1_L",           "z Mic",
            "z IN1_R",           "z Mic";

Then update as follows …

nvidia,audio-routing =
            "z Headphone", "z LOL",
            "z Headphone", "z LOR",
            "z Mic Bias",       "z Mic",
            "z IN1_L",           "z Mic",
            "z IN1_R",           "z Mic";

Regards
Jon

Hi Jon,
Hi Tried above for MICIN. I also tried below amux setting commands:

amixer -c tegrasndt186ref cset name=‘z Left Input Mixer IN1_L P Switch’ 1
amixer -c tegrasndt186ref cset name=‘z Right Input Mixer IN1_R P Switch’ 1

But i am not able to record signals coming on MIC pins. Following amux command should route IN1 signal to HPOUT which means the mic IN signals can be heard on HP out lines. But that didn’t work too. Any idea will be helpful.

amixer -c tegrasndt186ref cset name=‘z HPR Output Mixer IN1_R Switch’ 1
amixer -c tegrasndt186ref cset name=‘z HPL Output Mixer IN1_L Switch’ 1

Moreover, I don’t see any MICBIAS voltage even after adding MIC bias in audio routing as suggested above.
Thanks for your help.
Regards

Hello!

You might need to reference to the codec documentation to understand how this works or ask the codec vendor for help with this. I am not familiar enough with this codec or have access to one to try.

Regards,
Jon