diff mbox series

[1/2] ALSA: ac97: add bus binding for codecs

Message ID 20180621154356.5438-1-robert.jarzmik@free.fr
State Superseded, archived
Headers show
Series [1/2] ALSA: ac97: add bus binding for codecs | expand

Commit Message

Robert Jarzmik June 21, 2018, 3:43 p.m. UTC
Add the generic ac97 bus binding, especially for ac97 codecs discovered
by ac97 hardware probing.

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
---
 .../devicetree/bindings/sound/ac97-bus.txt         | 32 ++++++++++++++++++++++
 1 file changed, 32 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/ac97-bus.txt

Comments

Takashi Iwai June 21, 2018, 7:45 p.m. UTC | #1
On Thu, 21 Jun 2018 17:43:56 +0200,
Robert Jarzmik wrote:
> 
> Add a devicetree binding for codecs. This is especially useful if the
> AC97 bitclk clock is provided by the codec, as it has to be described in
> the devicetree description for the ac97 bus code to aquire it.
> 
> Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
> ---
> Special review query: review the "return of_node_get(node)", which
> assumes that upon device removal, of_put_node(dev.of_node) will be
> called...

Is it really done automagically?  I couldn't spot it.


thanks,

Takashi
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Robert Jarzmik June 22, 2018, 10:41 a.m. UTC | #2
Takashi Iwai <tiwai@suse.de> writes:

>> Special review query: review the "return of_node_get(node)", which
>> assumes that upon device removal, of_put_node(dev.of_node) will be
>> called...
>
> Is it really done automagically?  I couldn't spot it.
Neither could I ...

I based this on device_set_of_node_from_dev(), and the it "seemed" logical to me
that a device probed from devicetree would take a refcnt on the devicetree node.

As the "logical" conflicted with my search for the automagical of_node_get(), I
need the special review query.

Cheers.
Takashi Iwai June 22, 2018, 10:49 a.m. UTC | #3
On Fri, 22 Jun 2018 12:41:14 +0200,
Robert Jarzmik wrote:
> 
> Takashi Iwai <tiwai@suse.de> writes:
> 
> >> Special review query: review the "return of_node_get(node)", which
> >> assumes that upon device removal, of_put_node(dev.of_node) will be
> >> called...
> >
> > Is it really done automagically?  I couldn't spot it.
> Neither could I ...
> 
> I based this on device_set_of_node_from_dev(), and the it "seemed" logical to me
> that a device probed from devicetree would take a refcnt on the devicetree node.
> 
> As the "logical" conflicted with my search for the automagical of_node_get(), I
> need the special review query.

Hm, some of these users (e.g. drivers/usb/core/*) do call
of_node_put() properly at releasing, but some look leaking to me.
I don't think we have the common code in the driver core to release
dev->of_node, at least.

If any, this should be done in ac97_codec_release(), I suppose.


Takashi
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Mark Brown June 22, 2018, 2:43 p.m. UTC | #4
On Fri, Jun 22, 2018 at 12:49:49PM +0200, Takashi Iwai wrote:

> Hm, some of these users (e.g. drivers/usb/core/*) do call
> of_node_put() properly at releasing, but some look leaking to me.
> I don't think we have the common code in the driver core to release
> dev->of_node, at least.

> If any, this should be done in ac97_codec_release(), I suppose.

Yeah, I'd expect this to be handled in each bus.
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/sound/ac97-bus.txt b/Documentation/devicetree/bindings/sound/ac97-bus.txt
new file mode 100644
index 000000000000..103c428f2595
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/ac97-bus.txt
@@ -0,0 +1,32 @@ 
+Generic AC97 Device Properties
+
+This documents describes the devicetree bindings for an ac97 controller child
+node describing ac97 codecs.
+
+Required properties:
+-compatible : Must be "ac97,vendor_id1,vendor_id2
+	      The ids shall be the 4 characters hexadecimal encoding, such as
+	      given by "%04x" formatting of printf
+-reg	    : Must be the ac97 codec number, between 0 and 3
+
+Example:
+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";
+
+	#address-cells = <1>;
+	#size-cells = <0>;
+	audio-codec@0 {
+		reg = <0>;
+		compatible = "ac97,574d,4c13";
+		clocks = <&fixed_wm9713_clock>;
+		clock-names = "ac97_clk";
+	}
+};