[ 2.097680] imx-wm8962 sound-wm8962: 2111111111111111111111111
[ 2.103533] imx-wm8962 sound-wm8962: 22222222222222222222222222
[ 2.109467] imx-wm8962 sound-wm8962: 333333333333333333
[ 2.114705] imx-wm8962 sound-wm8962: 888888888888888888
[ 2.119953] imx-wm8962 sound-wm8962: failed to find codec platform device
[ 2.126759] imx-wm8962: probe of sound-wm8962 failed with error -22
[ 2.995796] wm8962 2-001a: afrrgrgtrggggggggggggggggggg
[ 3.001038] wm8962 2-001a: bbbbbbbbbbbbbbbbbbbbbbbbb
[ 3.008259] random: fast init done
[ 3.011807] wm8962 2-001a: customer id 0 revision FDTS:
sound-wm8960-forenex {
compatible = "fsl,imx-audio-wm8962";
model = "wm8962-audio";
audio-codec = <&codec>;
audio-cpu = <&sai3>;
audio-routing = "Headphone Jack", "HPOUTL",
"Headphone Jack", "HPOUTR",
"Ext Spk", "SPKOUTL",
"Ext Spk", "SPKOUTR",
"AMIC", "MICBIAS",
"IN3R", "AMIC",
"IN1R", "AMIC";
};
&i2c3 {
clock-frequency = <100000>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_i2c3>;
status = "okay";
pca6416: gpio@20 {
compatible = "ti,tca6416";
reg = <0x20>;
gpio-controller;
#gpio-cells = <2>;
};
ov5640_1: ov5640_mipi@3c {
compatible = "ovti,ov5640";
reg = <0x3c>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_csi0_pwn>, <&pinctrl_csi0_rst>, <&pinctrl_csi_mclk>;
clocks = <&clk IMX8MP_CLK_IPP_DO_CLKO2>;
clock-names = "xclk";
assigned-clocks = <&clk IMX8MP_CLK_IPP_DO_CLKO2>;
assigned-clock-parents = <&clk IMX8MP_CLK_24M>;
assigned-clock-rates = <24000000>;
csi_id = <0>;
powerdown-gpios = <&gpio4 1 GPIO_ACTIVE_HIGH>;
reset-gpios = <&gpio4 0 GPIO_ACTIVE_LOW>;
mclk = <24000000>;
mclk_source = <0>;
mipi_csi;
status = "disabled";
port {
ov5640_mipi_1_ep: endpoint {
remote-endpoint = <&mipi_csi1_ep>;
data-lanes = <1 2>;
clock-lanes = <0>;
};
};
};
codec: wm8962@1a {
compatible = "wlf,wm8962";
reg = <0x1a>;
clocks = <&audiomix_clk IMX8MP_CLK_AUDIOMIX_SAI3_MCLK1>;
clock-names = "mclk";
wlf,shared-lrclk;
AVDD-supply = <®_audio_pwr>;
CPVDD-supply = <®_audio_pwr>;
DBVDD-supply = <®_audio_pwr>;
DCVDD-supply = <®_audio_pwr>;
MICVDD-supply = <®_audio_pwr>;
PLLVDD-supply = <®_audio_pwr>;
SPKVDD1-supply = <®_audio_pwr>;
SPKVDD2-supply = <®_audio_pwr>;
gpio-cfg = <
0x0000 /* 0:Default */
0x0000 /* 1:Default */
0x0000 /* 2:FN_DMICCLK */
0x0000 /* 3:Default */
0x0000 /* 4:FN_DMICCDAT */
0x0000 /* 5:Default */
>;
};
};In your imx-wm8962.c probe path, distinguish between:
For example, conceptually:
codec_np = of_parse_phandle(np, "audio-codec", 0);
if (!codec_np) {
dev_err(&pdev->dev, "audio-codec missing or invalid\n");
return -EINVAL;
}
codec_dev = of_find_i2c_device_by_node(codec_np);
if (!codec_dev) {
dev_info(&pdev->dev, "codec device not ready, defer probe\n");
of_node_put(codec_np);
return -EPROBE_DEFER;
}
Similarly for the CPU DAI / SAI node:
cpu_np = of_parse_phandle(np, "audio-cpu", 0);
if (!cpu_np) {
dev_err(&pdev->dev, "audio-cpu missing or invalid\n");
return -EINVAL;
}
cpu_pdev = of_find_device_by_node(cpu_np);
if (!cpu_pdev) {
dev_info(&pdev->dev, "SAI platform device not ready, defer probe\n");
of_node_put(cpu_np);
return -EPROBE_DEFER;
}
This is the most direct fix if you keep your current machine driver.
For Linux 5.4-era NXP kernels, compatible = "fsl,imx-audio-wm8962" is handled by sound/soc/fsl/fsl-asoc-card.c , which has explicit WM8962 handling, including codec DAI name "wm8962" and WM8962 clock/FLL IDs . Also verify that snd-soc-fsl-asoc-card.ko is loaded or built in .
That means you should avoid having both a legacy/custom imx-wm8962 machine driver and fsl-asoc-card trying to bind the same compatible string. Recommended approach:
Your codec node is broadly in the expected shape: examples for WM8962 use compatible = "wlf,wm8962" , reg = <0x1a> , clocks , supply properties, and gpio-cfg . However, confirm the parts not shown in your DTS:
&sai3 {
#sound-dai-cells = <0>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_sai3>;
assigned-clocks = <&clk IMX8MP_CLK_SAI3>;
assigned-clock-parents = <&clk IMX8MP_AUDIO_PLL1_OUT>;
assigned-clock-rates = <12288000>; /* or board-required MCLK */
status = "okay";
};
And the codec should also normally expose:
codec: wm8962@1a {
compatible = "wlf,wm8962";
reg = <0x1a>;
#sound-dai-cells = <0>;
clocks = <&audiomix_clk IMX8MP_CLK_AUDIOMIX_SAI3_MCLK1>;
clock-names = "mclk";
...
};
Also ensure the regulator referenced by reg_audio_pwr is defined, enabled, and has a valid voltage range. Your codec is being detected, so the supplies are probably not the cause of this specific error, but bad supply or MCLK setup can cause later audio failures.
There is a known class of WM8962 bring-up issues where enabling the codec MCLK in the audio machine driver was required; adding clk_prepare_enable(codec_clk) in imx_wm8962_probe() was reported to make WM8962 audio work . If your codec probe succeeds but playback/capture later fails, check that SAI3 MCLK is actually present at the codec pin during codec initialization and stream startup.
Make sure only one active sound node targets this codec/SAI pair and that the model string is unique. A similar failure involving failed to find codec platform device was also associated with sound-card naming / duplicate-card conflicts in NXP community debugging . Your node name says sound-wm8960-forenex while the compatible/model are WM8962; the node name itself is not normally functional, but I would rename it for clarity and verify there is no second enabled sound-wm8962 node elsewhere.
Recommended minimal path