Want to use I2S3 s Audio on my custom carrier board

Normally, the node would be disabled in base or other original dtsi.
And you could use overlay dts to enable them. It could help you to clarify which is enabled from you.

You could just enable the necessary node for your codec.
If you don’t know which one is necessary, you could enable all of them first to make sure nothing lost.

Even after enabling all the sound related nodes to “okay”, I am not able to see my APE sound card list in the alsamixer.

Also I have done the necessary changes required as per website documentation and changes suggested by Kevin and Kumar. Please let me know what might be going wrong or any other thing we should do to enable my Sound card.

you mean we should make the status to “okay” in the overlay dts files directly?

@kevin @kumar

I have done all necessary changes for enabling sound on I2S4 to codec. Please review the sound. Dtsi file and let me know, if there is anything that needs to be done.

Thanks

Please provide the following information:

  1. full dmesg
  2. Result of the following commands
$ cat /proc/asound/cards
# cat /sys/kernel/debug/aso/components
1 Like

23_nov_cards.txt (134 Bytes)
23_nov_snd_components.txt (865 Bytes)
dmesg_23_nov.txt (92.6 KB)

and also the dtb from your board. (/boot/dtb/kernel_XXXX.dtb)

kernel_tegra194-p2888-0008-p2822-0000.txt (486.9 KB)

I found there’s a space before sgtl5000, please remove it as following.

		sgtl5000@0a {
-			compatible = "fsl, sgtl5000";
+			compatible = "fsl,sgtl5000";

and maybe you could add some debug message in probe function sgtl5000_probe() to do further debug.

Updated

Also please see, if the bit-clock inversion should be set to type “i2s” or “dsp_a” is fine in the below part of the device tree code:

/* Override with BT SCO entries */
&i2s4_to_codec {

  //bitclock-master;
   bitclock-inversion;

//frame-master;
format = “dsp_a”;

//Nagesh - Trident changes start
link-name = “fe-pi-audio-z-v2”;
codec {
sound-dai = <&sgtl5000>;
//prefix = “H40-SGTL”;
};

  //Nagesh - Trident changes end

};

&i2s4_dap_ep {
dai-format = “dsp_a”;
bitclock-inversion;
remote-endpoint = <&sgtl5000_ep>;
};

Added the below debug message inside this function:

//Trident - Nagesh - 23-Nov
printk("KERN_INFO, “Entering SGTL5000 Probe Function\0”);

static int sgtl5000_probe(struct snd_soc_component *component)
{
int ret;
u16 reg;
struct sgtl5000_priv *sgtl5000 = snd_soc_component_get_drvdata(component);
unsigned int zcd_mask = SGTL5000_HP_ZCD_EN | SGTL5000_ADC_ZCD_EN;

/* power up sgtl5000 */
ret = sgtl5000_set_power_regs(component);
if (ret)
goto err;

//Trident - Nagesh - 23-Nov
printk("KERN_INFO, “Entering SGTL5000 Probe > Function\0”);

/* enable small pop, introduce 400ms delay in turning off */
snd_soc_component_update_bits(component, SGTL5000_CHIP_REF_CTRL,
SGTL5000_SMALL_POP, SGTL5000_SMALL_POP);

/* disable short cut detector */
snd_soc_component_write(component, SGTL5000_CHIP_SHORT_CTRL, 0);

snd_soc_component_write(component, SGTL5000_CHIP_DIG_POWER,
SGTL5000_ADC_EN | SGTL5000_DAC_EN);

/* enable dac volume ramp by default */
snd_soc_component_write(component, SGTL5000_CHIP_ADCDAC_CTRL,
SGTL5000_DAC_VOL_RAMP_EN |
SGTL5000_DAC_MUTE_RIGHT |
SGTL5000_DAC_MUTE_LEFT);

reg = ((sgtl5000->lrclk_strength) << SGTL5000_PAD_I2S_LRCLK_SHIFT |
(sgtl5000->sclk_strength) << SGTL5000_PAD_I2S_SCLK_SHIFT |
0x1f);
snd_soc_component_write(component, SGTL5000_CHIP_PAD_STRENGTH, reg);

snd_soc_component_update_bits(component, SGTL5000_CHIP_ANA_CTRL,
zcd_mask, zcd_mask);

snd_soc_component_update_bits(component, SGTL5000_CHIP_MIC_CTRL,
SGTL5000_BIAS_R_MASK,
sgtl5000->micbias_resistor << SGTL5000_BIAS_R_SHIFT);

snd_soc_component_update_bits(component, SGTL5000_CHIP_MIC_CTRL,
SGTL5000_BIAS_VOLT_MASK,
sgtl5000->micbias_voltage << SGTL5000_BIAS_VOLT_SHIFT);
/*

  • enable DAP Graphic EQ
  • TODO:
  • Add control for changing between PEQ/Tone Control/GEQ
    */
    snd_soc_component_write(component, SGTL5000_DAP_AUDIO_EQ, SGTL5000_DAP_SEL_GEQ);

/* Unmute DAC after start */
snd_soc_component_update_bits(component, SGTL5000_CHIP_ADCDAC_CTRL,
SGTL5000_DAC_MUTE_LEFT | SGTL5000_DAC_MUTE_RIGHT, 0);

return 0;

err:
return ret;
}

Please share current dmesg after applying above changes for further check.

This is specific to bt chip.
Please remove it for sgtl and it would use i2s format by default.

I meant “dai-format” not bit-inversion. so should I comment "dai-format= “dsp_a”; " line?

As it takes time to fully flash the complete image through flash command,

can we just copy the kernel__XXX.dtb and Image file from <linux_for_Tegra>/rootfs/ folder to the target PC and restart it.

Would that be fine to avoid the flashing time??

dmesg_sgtl_updated.txt (83.4 KB)

I am seeing this error in the kernel log, looks like reading error:

[ 19.545832] sgtl5000 0-000a: Error reading chip id -121
[ 19.583090] sgtl5000: probe of 0-000a failed with error -121

Please remove both lines.

You are still porting the codec so that I would suggest flashing the whole board to make sure your modification applied correctly.

Why I don’t see this message in your latest dmesg?

1 Like

ok

But I am seeing these two below messages now in the kernel log now. May be the change I did in the my audio.dtsi file where I removed the space before “sgtl5000” in the SGTL5000 node made stgl5000 node to be detected by the kernel.

I feel the control is not going to the location where I have put my printk message and the codec is failing at the initial stage of reading chip ID itself before control comes to STGL_probe(…){ } function. This is just my understanding.

Also it says No sound cards found.

[ 7.346650] ALSA device list:
[ 7.346659] No soundcards found.

[ 19.545832] sgtl5000 0-000a: Error reading chip id -121
[ 19.583090] sgtl5000: probe of 0-000a failed with error -121

@Kevin,
I am able to find the place where this error is coming, in the file - /soc/codecs/sgtl5000.c

Any idea why this error is coming?

/* Need 8 clocks before I2C accesses */
udelay(1);

/* read chip information */
ret = regmap_read(sgtl5000->regmap, SGTL5000_CHIP_ID, &reg);
if (ret) {
dev_err(&client->dev, “Error reading chip id %d\n”, ret);
goto disable_clk;

It means the codec is not properly connected.
Please check with your hardware team about the codec I2C connection and the power.
It’s not in our scope to support. I would suggest you could measure the I2C signal to check if there’s any data.

1 Like

I did not get from where the abv error message is coming.

Also I am seeing this below error message from the kernel log about sound card “NVIDIA Jetson AGX Xavier APE” not registered:

[ 7.293228] hvc_sysfs: hypervisor is not present
[ 7.346650] ALSA device list:
[ 7.346659] No soundcards found.

I see two set of .c/.h files related to sgtl5000 one inside codec folder and another outside in the parent tegra folder.

Also I see some of the node/property naming used in .c file ( for example, widget, routing etc ) are not exact match to my audio device tree .dtsi file

Is this might be the reason for not able to see no sound card is registered.