On Wed, Jun 20, 2018 at 8:52 AM, Robert Jarzmik robert.jarzmik@free.fr wrote:
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 {
audio-codec@0
reg = <0>; /* Codex index (between 0 and 3) */ compatible = "ac97-codec";
This should be something with 'wm9713' in it or if there are ID registers you can base it on that.
clocks = <&fixed_wm9713_clock>; clock-names = "ac97_clk";
This is the standard 12MHz clock?
}
};
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
Not familiar with that function, but that sounds about right.
Rob