Rob Herring robh+dt@kernel.org writes:
Like PCI, USB, SDIO, etc., you need to define an AC97 bus binding which defines child node structure, compatible formatting (if you can base compatibles on something like VID/PID), and addressing (reg and unit-address formats). Then once you define child nodes, you can add whatever sideband connections you need. The AC97 core should be able to populate struct device_node if there are any matching child devices.
Ok, I thing I understand.
So the device-tree will look like : ac97: sound@40500000 { compatible = "marvell,pxa270-ac97"; reg = < 0x40500000 0x1000 >; interrupts = <14>; reset-gpios = <&gpio 95 GPIO_ACTIVE_HIGH>; #sound-dai-cells = <1>; pinctrl-names = "default"; pinctrl-0 = < &pinctrl_ac97_default >; clocks = <&clks CLK_AC97>, <&clks CLK_AC97CONF>; clock-names = "AC97CLK", "AC97CONFCLK";
wm9713@0 { reg = <0>; /* Codex index (between 0 and 3) */ compatible = "ac97-codec"; clocks = <&fixed_wm9713_clock>; clock-names = "ac97_clk"; } };
And the function ac97_codec_add() will : - scan the device-tree ac97 controller childs - match one if its reg equals (in our case wm9713@0) - set codec->dev.of_node to the matched one
It gets a bit more complicated if you need to do things like enable power or de-assert resets to discover the devices. Sounds like that might be the next person's problem in this case. :)
Yeah ... Crossing fingers that won't be me :)
Cheers.