ADAU7002 codec integration on I2S interface into VLP 3.0.5 yocto

Hi Renesas Team,

I am currently trying to integrated ADAU7002 codec interfaced through I2S channel on my RZ/V2L based customized board which has VLP 3.0.5 linux yocto distribution.

Below Pins are connected to I2S lines:
MIC_SCLK
MIC_DATA
MIC_TX
MIC_LRCLK

I have also enabled ADAU7002 linux kernel driver from menuconfig and able to insert the adau7002 module.

and written a DTS file for the same as given below:

// Basic DTS content for ADAU7002 on I2S channel
ssi0: ssi@10049c00 {
compatible = "renesas,r9a07g054-ssi",
"renesas,rz-ssi";
reg = <0 0x10049c00 0 0x400>;
interrupts = <GIC_SPI 326 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 327 IRQ_TYPE_EDGE_RISING>,
<GIC_SPI 328 IRQ_TYPE_EDGE_RISING>,
<GIC_SPI 329 IRQ_TYPE_EDGE_RISING>;
interrupt-names = "int_req", "dma_rx", "dma_tx", "dma_rt";
clocks = <&cpg CPG_MOD R9A07G054_SSI0_PCLK2>,
<&cpg CPG_MOD R9A07G054_SSI0_PCLK_SFR>,
<&audio_clk1>, <&audio_clk2>;
clock-names = "ssi", "ssi_sfr", "audio_clk1", "audio_clk2";
resets = <&cpg R9A07G054_SSI0_RST_M2_REG>;
dmas = <&dmac 0x2655>, <&dmac 0x2656>;
dma-names = "tx", "rx";
power-domains = <&cpg>;
#sound-dai-cells = <0>;
status = "disabled";
};


&pinctrl {
..................................
..................................

/* I2S Pin Configuration for SSI0 */
ssi0_pins: ssi0 {
pinmux = <RZG2L_PORT_PINMUX(31, 0, 5)>, /* SSI0_BCK */
<RZG2L_PORT_PINMUX(31, 1, 5)>, /* SSI0_RCK */
<RZG2L_PORT_PINMUX(32, 0, 5)>, /* SSI0_TXD */
<RZG2L_PORT_PINMUX(32, 1, 5)>; /* SSI0_RXD */
};
};

&ssi0 {
pinctrl-0 = <&ssi0_pins>;
pinctrl-names = "default";

status = "okay";

adau7002: adau7002@0 {
compatible = "adi,adau7002";
reg = <0x0>;
wakeup-delay-ms = <100>;
//i2s-controller = <&ssi0>; // Reference to the SSI controller
};
};

Issue i am facing is I am not getting any kernel logs to confirm the module is loaded and also sound related interfaces are also not visible as evident from below logs.

root@smarc-rzv2l:/home#
root@smarc-rzv2l:/home#
root@smarc-rzv2l:/home#
root@smarc-rzv2l:/home# dmesg | grep "ssi"
[    0.025335] CPU features: detected: Speculative Store Bypassing Safe (SSBS)
[    0.076789] OF: /soc/ssi@10049c00: could not find phandle
[    0.078942] OF: /soc/ssi@10049c00: could not find phandle
[    1.929712] ehci-platform 11c50100.usb: new USB bus registered, assigned bus number 1
[    1.978776] ohci-platform 11c50000.usb: new USB bus registered, assigned bus number 2
[    2.232159] OF: /soc/ssi@10049c00: could not find phandle
[    2.237669] OF: /soc/ssi@10049c00: could not find phandle
[    2.243127] rz-ssi-pcm-audio: probe of 10049c00.ssi failed with error -2
[    4.136112] systemd[1]: Created slice User and Session Slice.
[    4.997947] rgnmm_drv mmngr: assigned reserved memory node linux,multimedia
root@smarc-rzv2l:/home# cat /proc/asound/cards
--- no soundcards ---
root@smarc-rzv2l:/home# lsmod
Module                  Size  Used by
snd_soc_adau7002       16384  0
vspm_if                49152  0
vspm                  102400  1 vspm_if
uvcs_drv               40960  0
mmngrbuf               16384  0
mmngr                  24576  0
mali_kbase            663552  0
root@smarc-rzv2l:/home# dmesg | grep "ADAU7002"
root@smarc-rzv2l:/home# amixer
amixer: Mixer attach default error: No such file or directory
root@smarc-rzv2l:/home# ls /sys/bus/platform/devices/
10049c00.ssi     10050000.can       10800000.vcp4   10890000.display           11c10000.mmc          11c70100.usb       1p8v                 43500000.vring-shm1  psci-cpuidle             rpc-if-spi
1004ac00.spi     10058000.i2c       10820000.vcp4   11010000.clock-controller  11c40000.usbphy-ctrl  12800400.watchdog  2p8v                 Fixed MDIO bus.0     reg-dummy                serial8250
1004b000.spi     10058800.i2c       10830000.video  11030000.pinctrl           11c50000.usb          12800800.watchdog  42f00000.rsctbl      cpufreq-dt           regulator-usb0-vbus-otg  snd-soc-dummy
1004b800.serial  10059000.adc       10830400.csi2   11410000.edac              11c50100.usb          12800c00.watchdog  42f01000.mhu-shm     firmware:optee       regulator-vdd-core       soc
1004c000.serial  10059400.thermal   10840000.isum   11820000.dma-controller    11c50200.usb-phy      12801400.timer     43000000.vring-ctl0  mmngr                regulator0               timer
1004c400.serial  10060000.spi       10870000.vsp    11840000.gpu               11c60000.usb          12801800.timer     43100000.vring-ctl1  mmngrbuf             regulator1               vspm_if
1004c800.serial  10400000.mbox-uio  10880000.fcp    11c00000.mmc               11c70000.usb          1p5v               43200000.vring-shm0  psci                 regulatory.0
root@smarc-rzv2l:/home# ls /sys/class/sound/
timer
root@smarc-rzv2l:/home# arecord -l
arecord: device_list:272: no soundcards found...
root@smarc-rzv2l:/home# dmesg | grep -i adau7002
root@smarc-rzv2l:/home#


Can you please help to resolve this issue.

Parents
  • Here is your issue.

    [    0.076789] OF: /soc/ssi@10049c00: could not find phandle

    Your Device Tree syntax is not correct for that audio part.

    My suggestion is to look for other Device Tree examples of that specific audio code.

    Basically, do a search for    compatible = "adi,adau7002";

    Remember, the interface to the Renesas audio driver (SSI) is the standard Linux interface, so your issue here is the Device Tree for your external audio codec.

    Also, it looks like you are trying to put the node for your audio codec under the ssi node. That's not correct. Usually, it goes under the control interface, like the i2c node.

    Here is an example: renesas.info/.../RZG_DeviceTree

  • Thanks Chris for your prompt reply. FYI, we don't have any I2C interfacing for ADAU7002 codec, rather ADAU7002 codec device is only connected to I2S. Do i need to still use i2c node for my audio codec node in DTS. Is my understanding correct?

  • Oh, I see, a ADAU7002 is just a "Stereo PDM-to-I2 S or TDM Conversion IC

    https://www.analog.com/media/en/technical-documentation/data-sheets/ADAU7002.pdf

    Very simple.

    No I2C configuration interface.

    Again, I would go search for examples of how others have written their device tree. It will be the same for RZ since the audio interface to the kernel is standard.

  • I have updated the DTS file after going through some ADAU7002 specific device tree example, which is as follows,

    r9a07g054l2-smarc.dts(ADAU7002 related only)

    /* same as rzg2l-smarc.dtsi*/

                  aliases {      

                  sound = &snd_rzg2l;

                  };

                   ar0234_vddd_1v5: 1p5v {

                                 compatible = "regulator-fixed";

                                 regulator-name = "camera_vddd";

                                 regulator-min-microvolt = <1500000>;

                                 regulator-max-microvolt = <1500000>;

                                 regulator-always-on;

                  };

                 

            snd_rzg2l: sound {

                          compatible = "simple-audio-card";

                  simple-audio-card,format = "i2s";

                  simple-audio-card,bitclock-master = <&cpu_dai>;

                  simple-audio-card,frame-master = <&cpu_dai>;

                  simple-audio-card,mclk-fs = <256>;

     

                  simple-audio-card,widgets =

                  "Microphone", "Microphone Jack";

     

                  simple-audio-card,routing =

                  "Microphone Jack", "Mic Bias",

                  "Mic Bias", "Microphone";

     

                  cpu_dai: simple-audio-card,cpu {

                                 sound-dai = <&ssi0>;

                  };

     

                  codec_dai: simple-audio-card,codec {

                                 sound-dai = <&adau7002>;

                  };

                  };

     

        adau7002: codec {

            compatible = "adi,adau7002";

            status = "okay";

        };

     

    &pinctrl {

        /* I2S Pin Configuration for SSI0 */

        ssi0_pins: ssi0 {

            pinmux = <RZG2L_PORT_PINMUX(31, 0, 5)>, /* SSI0_BCK */

                     <RZG2L_PORT_PINMUX(31, 1, 5)>, /* SSI0_RCK */

                     <RZG2L_PORT_PINMUX(32, 0, 5)>, /* SSI0_TXD */

                     <RZG2L_PORT_PINMUX(32, 1, 5)>; /* SSI0_RXD */

        };

    };

    &ssi0 {

                  pinctrl-0 = <&ssi0_pins>;

                  pinctrl-names = "default";

                  status = "okay";

                  /* clock configuration */

                  clock-names = "audio_clk1";

                  /* Other SSI configuration */      

    };

    I am now successfully able to register ADAU7002 interface as evident from below log:

    root@smarc-rzv2l:~# dmesg | grep "ADAU7002"

    [    0.242501] ADAU7002: I2S probe function called

    [    0.242542] ADAU7002: Component registered successfully

    root@smarc-rzv2l:~# cat /sys/bus/platform/drivers/adau7002/codec/modalias

    of:NcodecT(null)Cadi,adau7002

     

    But probe function call is still failing,

    root@smarc-rzv2l:~# dmesg | grep "ssi"

    [    2.240455] rz-ssi-pcm-audio: probe of 10049c00.ssi failed with error -2

    root@smarc-rzv2l:~#

     

    Kindly guide here to resolve this issue.

  • But probe function call is still failing,

    root@smarc-rzv2l:~# dmesg | grep "ssi"

    [    2.240455] rz-ssi-pcm-audio: probe of 10049c00.ssi failed with error

    The next step is to find out what "error -2" means.

    Basically, what line of code in the ssi probe function is failing.

    You can put printk statements in the code to find out.

    Generally speaking, this is how most driver issue are solved.

    On this page: https://renesas.info/wiki/RZ-G/debug_tricks   search for the word "probe" and you will see it shows up multiple places.

    Once you know what line is failing, it should point you in the next direction to look.

    I have spent hours before doing this just to find out I had a simple spelling error in my Device Tree. But, that's the only way to find it.

    Chris

  • Hi Chris,

    Do you want me to put printk in adau7002.c driver file or somewhere else. I have already put printk in almost all the places for debugging purpose.

    /* adau7002.c */

    // SPDX-License-Identifier: GPL-2.0-only
    /*
    * ADAU7002 Stereo PDM-to-I2S/TDM converter driver
    *
    * Copyright 2014-2016 Analog Devices
    * Author: Lars-Peter Clausen <[email protected]>
    */

    #include <linux/acpi.h>
    #include <linux/delay.h>
    #include <linux/init.h>
    #include <linux/module.h>
    #include <linux/of.h>
    #include <linux/platform_device.h>

    #include <sound/soc.h>

    struct adau7002_priv {
    int wakeup_delay;
    };

    static int adau7002_aif_event(struct snd_soc_dapm_widget *w,
    struct snd_kcontrol *kcontrol, int event)
    {
    struct snd_soc_component *component =
    snd_soc_dapm_to_component(w->dapm);
    struct adau7002_priv *adau7002 =
    snd_soc_component_get_drvdata(component);

    switch (event) {
    case SND_SOC_DAPM_POST_PMU:
    if (adau7002->wakeup_delay)
    msleep(adau7002->wakeup_delay);
    break;
    }

    return 0;
    }

    static int adau7002_component_probe(struct snd_soc_component *component)
    {
    struct adau7002_priv *adau7002;
    int ret;

    pr_info("ADAU7002: Entering probe function\n");

    adau7002 = devm_kzalloc(component->dev, sizeof(*adau7002), GFP_KERNEL);
    if (!adau7002) {
    pr_err("ADAU7002: Memory allocation failed\n");
    return -ENOMEM;
    }
    pr_info("ADAU7002: Memory allocation successful\n");

    ret = device_property_read_u32(component->dev, "wakeup-delay-ms", &adau7002->wakeup_delay);
    if (ret) {
    pr_warn("ADAU7002: Failed to read wakeup-delay-ms property: %d\n", ret);
    } else {
    pr_info("ADAU7002: Wakeup delay: %d ms\n", adau7002->wakeup_delay);
    }

    snd_soc_component_set_drvdata(component, adau7002);

    pr_info("ADAU7002: Probe function executed successfully\n");

    return 0;
    }

    static const struct snd_soc_dapm_widget adau7002_widgets[] = {
    SND_SOC_DAPM_AIF_OUT_E("ADAU AIF", "Capture", 0,
    SND_SOC_NOPM, 0, 0, adau7002_aif_event,
    SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
    SND_SOC_DAPM_INPUT("PDM_DAT"),
    SND_SOC_DAPM_REGULATOR_SUPPLY("IOVDD", 0, 0),
    };

    static const struct snd_soc_dapm_route adau7002_routes[] = {
    { "ADAU AIF", NULL, "PDM_DAT"},
    { "Capture", NULL, "PDM_DAT" },
    { "Capture", NULL, "IOVDD" },
    };

    static struct snd_soc_dai_driver adau7002_dai = {
    .name = "adau7002-hifi",
    .capture = {
    .stream_name = "Capture",
    .channels_min = 2,
    .channels_max = 2,
    .rates = SNDRV_PCM_RATE_8000_96000,
    .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S18_3LE |
    SNDRV_PCM_FMTBIT_S20_3LE | SNDRV_PCM_FMTBIT_S24_LE |
    SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S32_LE,
    .sig_bits = 20,
    },
    };

    static const struct snd_soc_component_driver adau7002_component_driver = {
    .probe = adau7002_component_probe,
    .dapm_widgets = adau7002_widgets,
    .num_dapm_widgets = ARRAY_SIZE(adau7002_widgets),
    .dapm_routes = adau7002_routes,
    .num_dapm_routes = ARRAY_SIZE(adau7002_routes),
    .idle_bias_on = 1,
    .use_pmdown_time = 1,
    .endianness = 1,
    .non_legacy_dai_naming = 1,
    };

    static int adau7002_probe(struct platform_device *pdev)
    {
    printk(KERN_INFO "ADAU7002: I2S probe function called\n");

    int ret = devm_snd_soc_register_component(&pdev->dev,
    &adau7002_component_driver,
    &adau7002_dai, 1);
    if (ret) {
    printk(KERN_ERR "ADAU7002: Failed to register component: %d\n", ret);
    } else {
    printk(KERN_INFO "ADAU7002: Component registered successfully\n");
    }
    return ret;
    }

    static int adau7002_remove(struct platform_device *pdev)
    {
    pr_info("ADAU7002: I2S remove function called\n");
    return 0;
    }

    #ifdef CONFIG_OF
    static const struct of_device_id adau7002_dt_ids[] = {
    { .compatible = "adi,adau7002", },
    { }
    };
    MODULE_DEVICE_TABLE(of, adau7002_dt_ids);
    #endif

    #ifdef CONFIG_ACPI
    static const struct acpi_device_id adau7002_acpi_match[] = {
    { "ADAU7002", 0 },
    {},
    };
    MODULE_DEVICE_TABLE(acpi, adau7002_acpi_match);
    #endif

    static struct platform_driver adau7002_driver = {
    .driver = {
    .name = "adau7002",
    .of_match_table = of_match_ptr(adau7002_dt_ids),
    .acpi_match_table = ACPI_PTR(adau7002_acpi_match),
    },
    .probe = adau7002_probe,
    .remove = adau7002_remove,
    };
    module_platform_driver(adau7002_driver);

    MODULE_AUTHOR("Lars-Peter Clausen <[email protected]>");
    MODULE_DESCRIPTION("ADAU7002 Stereo PDM-to-I2S/TDM Converter driver");
    MODULE_LICENSE("GPL v2");

    I am also getting component registered successful from above code.

    root@smarc-rzv2l:~# dmesg | grep "ADAU7002"

    [    0.242501] ADAU7002: I2S probe function called

    [    0.242542] ADAU7002: Component registered successfully

    root@smarc-rzv2l:~# cat /sys/bus/platform/drivers/adau7002/codec/modalias

    of:NcodecT(null)Cadi,adau7002

    But getting below error, not sure from which driver code this error is coming

    root@smarc-rzv2l:~# dmesg | grep "ssi"

    [    2.240455] rz-ssi-pcm-audio: probe of 10049c00.ssi failed with error -2

    root@smarc-rzv2l:~#

    Which exact file i need to debug, apologies for my ignorance as i am doing the audio codec first time.

     Also any idea about adau7002_component_probe() and adau7002_probe() function.

    FYI, adau7002_probe() is invoked but i cannot see any logs from adau7002_component_probe(). What could be the issue?

    Regards,

    Mritunjai

  • [    2.240455] rz-ssi-pcm-audio: probe of 10049c00.ssi failed with error -2

    root@smarc-rzv2l:~#

    Which exact file i need to debug, apologies for my ignorance as i am doing the audio codec first time.

    The ssi driver is file  sound/soc/sh/rz-ssi.c

    That has the probe function that is failing. You need to find the line of code that fails.

     Also any idea about adau7002_component_probe() and adau7002_probe() function.

    FYI, adau7002_probe() is

    The adau7002 is the external codec device. The SSI is the RZ internal device.

    It could be that the adau7002 is getting registered, but if the SSI is not finding it, then the SSI cannot register.

    ALSA -> SSI -> adau7002 -> speakers

  • Hi Chris,

    I have updated the device tree to include the required clocks and pin configurations for the ADAU7002 codec.Configured the I2S pins for SSI0 to ensure correct functionality. Looks like all the necessary interfaces required for audio recording are available.
    root@smarc-rzv2l:~# ls /proc/asound/card0/
    id pcm0c
    root@smarc-rzv2l:~# cat /proc/asound/card0/id
    rzssidaiadau700

    It is also showing capture interface but not showing playback interface,
    root@smarc-rzv2l:~# aplay -l
    ** List of PLAYBACK Hardware Devices **
    root@smarc-rzv2l:~# arecord -l
    ** List of CAPTURE Hardware Devices **
    card 0: rzssidaiadau700 [rz-ssi-dai-adau7002-hifi], device 0: rz-ssi-dai-adau7002-hifi adau7002-hifi-0 []
    Subdevices: 1/1
    Subdevice #0: subdevice #0
    root@smarc-rzv2l:~#

    I am also encountering an issue during audio recording. While the system is able to create a .wav file, the file appears to be truncated and does not capture the full duration of the recording. 

    root@smarc-rzv2l:~#arecord -D plughw:0,0 -f S16_LE -r 48000 -c 2 -d 10 test1.wav
    Recording WAVE 'test1.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
    arecord: pcm_read:2151: read error: Input/output error

    after frequency changed to 3.072 MHz. it is stucking forever while recording
    arecord -D plughw:0,0 -f S16_LE -r 48000 -c 2 -d 10 test1.wav
    Recording WAVE

    Please find below the DTS files for this behaviour:

    /* r9a07g054l2-smarc.dts */
    snd_rzg2l: sound {
    compatible = "simple-audio-card";

    simple-audio-card-name = "adau7002";
    simple-audio-card,format = "i2s";
    simple-audio-card,mclk-fs = <256>;

    simple-audio-card,bitclock-master = <&cpu_dai>;
    simple-audio-card,frame-master = <&cpu_dai>;

    simple-audio-card,widgets =
    "Microphone", "Digital Mics",
    "Line In", "Line In",
    "Headphone", "Headphones",
    "Speaker", "Speaker";

    simple-audio-card,routing =
    "Digital Mics", "PDM_DAT",
    "Headphones", "Headphone Jack",
    "Line In", "Line In Jack",
    "Speaker", "Ext Spk";

    status = "okay";

    cpu_dai: simple-audio-card,cpu {
    sound-dai = <&ssi0>;

    clocks = <&cpg CPG_MOD R9A07G054_SSI0_PCLK2>,
    <&cpg CPG_MOD R9A07G054_SSI0_PCLK_SFR>,
    <&audio_clk1>, <&audio_clk2>;
    clock-names = "ssi", "ssi_sfr", "audio_clk1", "audio_clk2";

    assigned-clocks = <&audio_clk1>;
    //assigned-clock-rates = <4000000>; /* Set audio_clk1 to 4 MHz */
    //assigned-clock-rates = <6144000>; /* Set audio_clk1 to 6.144 MHz */
    assigned-clock-rates = <3072000>; /* Set audio_clk1 to 3.072 MHz */

    system-clock-frequency = <3072000>;
    //system-clock-frequency = <100000000>; // Set to 100 MHz

    /*
    Configure the BCLK to 64 x Fs (2 channels, 32 bit slot width).
    (bclk = 64x Fs = 3.072 MHz, mclk of the dsp is 256x Fs = 12.288 MHz @ 48 kHz/24 bit).
    */

    /* TDM slot configuration - BCLK ratio: 64 x Fs (2 x 32 bit) */
    dai-tdm-slot-num = <2>;
    dai-tdm-slot-width = <32>;
    };

    codec_dai: simple-audio-card,codec {
    sound-dai = <&adau7002>;

    clocks = <&audio_clk1>;
    clock-names = "audio_clk1";
    };

    };

    adau7002: codec {
    compatible = "adi,adau7002";
    #sound-dai-cells = <0>;
    #address-cells = <0>;
    #size-cells = <0>;

    status = "okay";

    // Commenting this out indicates supply pin is hardwired always on.
    //IOVDD-supply = <&reg_3p3v>;
    };


    /* I2S Pin Configuration for SSI0 */
    ssi0_pins: ssi0 {
    pinmux = <RZG2L_PORT_PINMUX(45, 0, 1)>, /* SSI0_BCK (A8), MIC_SCLK */
    <RZG2L_PORT_PINMUX(45, 1, 1)>, /* SSI0_RCK (D12), MIC_LRCLK */
    <RZG2L_PORT_PINMUX(45, 2, 1)>, /* SSI0_TXD (A9), MIC_TX */
    <RZG2L_PORT_PINMUX(45, 3, 1)>, /* SSI0_RXD (B9), MIC_DATA */
    <RZG2L_PORT_PINMUX(1, 0, 1)>; /* IRQ (C13), MIC_RCLK */
    };

    &ssi0 {
    pinctrl-0 = <&ssi0_pins>;
    pinctrl-names = "default";

    status = "okay";

    /* clock configuration */
    clock-names = "audio_clk1";

    /* Other SSI configuration */
    };


    /* r9a07g054.dtsi */
    / {
    compatible = "renesas,r9a07g054";
    #address-cells = <2>;
    #size-cells = <2>;

    audio_clk1: audio_clk1 {
    compatible = "fixed-clock";
    #clock-cells = <0>;
    /* This value must be overridden by boards that provide it */
    //clock-frequency = <0>;
    //clock-frequency = <4000000>; // This clock is set to 12.288 MHz (for 48 kHz * 256)
    //clock-frequency = <6144000>; /* Set audio_clk1 to 6.144 MHz */
    clock-frequency = <3072000>;
    };

    audio_clk2: audio_clk2 {
    compatible = "fixed-clock";
    #clock-cells = <0>;
    /* This value must be overridden by boards that provide it */
    clock-frequency = <3072000>;
    };

    ...........................................
    ...........................................
    ...........................................
    ...........................................
    }

    Kindly help me in resolving this issue. It has already taken so long for this codec working.

    Also can you guide me how to configure MCLK, BCLK and RCLK frequencies? 

  • It is also showing capture interface but not showing playback interface,

    Make sure you use amixer to check and set your audio inputs/outputs/volumes levels.

    For example, on the RZ/G2L eval board

    renesas.info/.../RZ-G2L_SMARC

    Playing and Recording Audio

    • The RZ/G2L SMARC has a WM8978 audio codec. By default, some ASLA settings are not configured so playing and recording is not available.
    • For example, if you play audio, you will not hear anything because the volume is set to 0%.
    • Before you can play or record audio, please enter the commands below.
    $ amixer cset name='Left Input Mixer L2 Switch' on
    $ amixer cset name='Right Input Mixer R2 Switch' on
    $ amixer cset name='Headphone Playback Volume' 100
    $ amixer cset name='PCM Volume' 100%
    $ amixer cset name='Input PGA Volume' 25
    
    • Then, you can record audio by using the command below
    $ arecord -M -twav -fS16_LE -r8000 /tmp/sample.wav 

    Kindly help me in resolving this issue. It has already taken so long for this codec working.

    Also can you guide me how to configure MCLK, BCLK and RCLK frequencies? 

    Sorry, I cannot provide you detailed debug instructions at this time.

Reply
  • It is also showing capture interface but not showing playback interface,

    Make sure you use amixer to check and set your audio inputs/outputs/volumes levels.

    For example, on the RZ/G2L eval board

    renesas.info/.../RZ-G2L_SMARC

    Playing and Recording Audio

    • The RZ/G2L SMARC has a WM8978 audio codec. By default, some ASLA settings are not configured so playing and recording is not available.
    • For example, if you play audio, you will not hear anything because the volume is set to 0%.
    • Before you can play or record audio, please enter the commands below.
    $ amixer cset name='Left Input Mixer L2 Switch' on
    $ amixer cset name='Right Input Mixer R2 Switch' on
    $ amixer cset name='Headphone Playback Volume' 100
    $ amixer cset name='PCM Volume' 100%
    $ amixer cset name='Input PGA Volume' 25
    
    • Then, you can record audio by using the command below
    $ arecord -M -twav -fS16_LE -r8000 /tmp/sample.wav 

    Kindly help me in resolving this issue. It has already taken so long for this codec working.

    Also can you guide me how to configure MCLK, BCLK and RCLK frequencies? 

    Sorry, I cannot provide you detailed debug instructions at this time.

Children
  • By default, some ASLA settings are not configured so playing and recording is not available.
    Can it be the reason for system hanging indefinitely, or aplay -l shown not playback devices?
    Also AMixer is not present in my yocto build. Do i need to have complete ALSA configuration/settings in order to fix this issue.

    Also we cannot observe BCLK signal on logic analyzer, my MIC related clock configuration is as follows, :

    • MCLK (audio_clk1): 12.288 MHz
    • mclk-fs ratio: 256 (from simple-audio-card,mclk-fs = <256>;)
    • RCLK(or FSYNC or Fs): MCLK/mclk-fs = 12.288/256 = 0.048 MHz = 48 KHz
    • dai-tdm-slot-num = <2>; dai-tdm-slot-width = <32>
      This sets the total bits per frame to 2 slots * 32 bits/slot = 64 bits.
    • BCLK (Bit Clock): With an MCLK of 12.288 MHz and Fs (sample rate) of 48 kHz, the BCLK is calculated as:
      BCLK=Fs×(Number of Slots×Slot Width)
      BCLK=48,000 Hz×64=3,072,000 Hz=3.072 MHz

    Can you confirm if it is supported clock configuration?

    With that configuration i should observe 3.072 CLK signal on BCLK pin which is not happening currently. Can you guide what could the issue here. Also i have one query regarding audio_clk1 and audio_clk2 which i have used as a clock source for above signals. Is audio_clk signal, output from processor or input to the processor. Meant to ask if we can use audio_clk as a clock source for ADAU7002 clock signa. I know SMARC EVK was using versa3 clock for the same purpose which is not available here.

    Kindly help us to resolve this issue?

  • Hi Chris,

    Back with one more doubt related to audio MIC.

    I am getting below error while booting related to audio MIC:
    [ 2.265970] rz-ssi-pcm-audio 10049c00.ssi: error -ENOENT: no audio clk2                                                    [ 2.266021] rz-ssi-pcm-audio: probe of 10049c00.ssi failed with error -2

    It is due to failure in rz_ssi_probe() function in rz-ssi.c file at below line,
    audio_clk = devm_clk_get(&pdev->dev, audio_clk1) and also,
    audio_clk = devm_clk_get(&pdev->dev, audio_clk2)

    My query here is in what scenario devm_clk_get function normally fails, is is due to only DTS issue or can it be hardware issue also(due to clock signal not provided to these audio_clk1 and audio_clk2 pins)? Why i am asking this question because i am very confident that i have provided correct DTS configuration related to these clocks.

    Kindly clarify?

  • My query here is in what scenario devm_clk_get function normally fails, is is due to only DTS issue

    Generally speaking, devm_clk_get just looks for the clock node in the Device Tree. It needs a reference to that so it can find out what frequency it is so the driver can do the math.

    I see you have a fixed-clock in your DT, so that looks correct.

    But, I see that you just used "clock-names = " in your ssi node.
    That does not point to anything.

    You need an actually node reference ( &xxxx ) to another node. That probably what you are missing.