Skip to contentSkip to conversation

mfd: Add Rockchip rk817 audio CODEC support

PATCH Superseded Chris Morgan 2 participants 8 messages Mar 17, 2021 – Mar 18, 2021 1 message not in the archive

Subsystems (4)

v4 of 6 Superseded Latest is v6 →

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH v4 2/3 dt-bindings: Add Rockchip rk817 audio CODEC support

Create dt-binding documentation to document rk817 codec.

---
 .../bindings/sound/rockchip,rk817-codec.yaml  | 63 +++++++++++++++++++
 1 file changed, 63 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/rockchip,rk817-codec.yaml
Documentation/devicetree/bindings/sound/rockchip,rk817-codec.yaml new file +63 -0
new file mode 100644
index 000000000000..986cebcd0832
@@ -0,0 +1,63 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/sound/rockchip-rk817.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Rockchip rk817 audio codec
+
+description:
+  The rk817 codec is an I2C codec integrated with every Rockchip
+  rk817 PMIC MFD.
+
+properties:
+  compatible:
+    enum:
+      - rockchip,rk817-codec
+
+  "#sound-dai-cells":
+    const: 1
+
+  clocks:
+    maxItems: 1
+
+  clock-names:
+    const: "mclk"
+
+  mic-in-differential:
+    description: the microphone is in differential mode.
+    $ref: /schemas/types.yaml#/definitions/flag
+
+required:
+  - compatible
+  - clocks
+  - clock-names
+
+additionalProperties: false
+
+examples:
+  - |
+rk817: pmic@20 {
+	compatible = "rockchip,rk817";
+	reg = <0x20>;
+	interrupt-parent = <&gpio0>;
+	interrupts = <7 IRQ_TYPE_LEVEL_LOW>;
+	pinctrl-names = "default";
+	pinctrl-0 = <&pmic_int>;
+
+	........
+
+	rk817_codec: codec {
+			#sound-dai-cells = <0>;
+			compatible = "rockchip,rk817-codec";
+			clocks = <&cru SCLK_I2S_8CH_OUT>;
+			clock-names = "mclk";
+			pinctrl-names = "default";
+			pinctrl-0 = <&i2s_8ch_mclk>;
+			mic-in-differential;
+			status = "okay";
+	};
+
+	........
+
+};
Signature · 1 line
2.25.1
maintainer
#2 lore raw

Re: [PATCH v4 2/3] dt-bindings: Add Rockchip rk817 audio CODEC support

Documentation/devicetree/bindings/sound/rockchip,rk817-codec.yaml line 16

Quoted 3 lines · Chris Morgan
Documentation/devicetree/bindings/sound/rockchip,rk817-codec.yaml new file +3 -0
+  compatible:
+    enum:
+      - rockchip,rk817-codec

Sorry, should have picked this up on the previous version - you shouldn't need the compatible here, an rk817 always has a CODEC. The actual driver has already been updatd and doesn't use it anyway.

#3 lore raw

Re: [PATCH v4 2/3] dt-bindings: Add Rockchip rk817 audio CODEC support

The compatible is still needed so that it can be registered with the mfd device itself in the cell.

Thank you.

Quoted 9 lines · Mark Brown

Documentation/devicetree/bindings/sound/rockchip,rk817-codec.yaml line 16

Quoted 3 lines · Chris Morgan
Documentation/devicetree/bindings/sound/rockchip,rk817-codec.yaml new file +3 -0
+  compatible:
+    enum:
+      - rockchip,rk817-codec

Sorry, should have picked this up on the previous version - you shouldn't need the compatible here, an rk817 always has a CODEC. The actual driver has already been updatd and doesn't use it anyway.

maintainer
#4 lore raw

Re: [PATCH v4 2/3] dt-bindings: Add Rockchip rk817 audio CODEC support

Quoted 1 line · Chris Morgan

The compatible is still needed so that it can be registered with the mfd device itself in the cell.

I can't parse this? What does "registered with the mfd device itself in the cell" mean? If you register a MFD cell then the function device will instantaite based on platform bus matching.

Please don't top post, reply in line with needed context. This allows readers to readily follow the flow of conversation and understand what you are talking about and also helps ensure that everything in the discussion is being addressed.

Please fix your mail client to word wrap within paragraphs at something substantially less than 80 columns. Doing this makes your messages much easier to read and reply to.

#5 lore raw

Re: [PATCH v4 2/3] dt-bindings: Add Rockchip rk817 audio CODEC support

Sorry, still getting the hang of mutt. I've got my wrap set at 80 now, and I'll try to make sure I'm replying correctly. Hopefully this one comes through correct.

As-is, when I start the driver after removing the device-tree compatible field or the of_compatible from the MFD driver, it doesn't find the mclk (and thus doesn't start). But that's my problem, and I'll try to get to the bottom of it.

Thank you.

Quoted 16 lines · Mark Brown
Quoted 1 line · Chris Morgan

The compatible is still needed so that it can be registered with the mfd device itself in the cell.

I can't parse this? What does "registered with the mfd device itself in the cell" mean? If you register a MFD cell then the function device will instantaite based on platform bus matching.

Please don't top post, reply in line with needed context. This allows readers to readily follow the flow of conversation and understand what you are talking about and also helps ensure that everything in the discussion is being addressed.

Please fix your mail client to word wrap within paragraphs at something substantially less than 80 columns. Doing this makes your messages much easier to read and reply to.

maintainer
#6 lore raw

Re: [PATCH v4 2/3] dt-bindings: Add Rockchip rk817 audio CODEC support

Quoted 1 line · Chris Morgan

Sorry, still getting the hang of mutt. I've got my wrap set at 80 now, and I'll try to make sure I'm replying correctly. Hopefully this one comes through correct.

No change visible at this end :/

Quoted 1 line

As-is, when I start the driver after removing the device-tree compatible field or the of_compatible from the MFD driver, it doesn't find the mclk (and thus doesn't start). But that's my problem, and I'll try to get to the bottom of it.

Do you have the MCLK mapped in the CODEC node or the top level node? You will need to have it mapped in the top level node.

#7 lore raw

PATCH v4 3/3 mfd: Add Rockchip rk817 audio CODEC support

In reply to a message not in the archive

Add rk817 codec support cell to rk808 mfd driver.

---
 drivers/mfd/rk808.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/mfd/rk808.c +6 -0
index ad923dd4e007..adb8a7da29db 100644
@@ -163,6 +163,12 @@ static const struct mfd_cell rk817s[] = {
 		.num_resources = ARRAY_SIZE(rk817_rtc_resources),
 		.resources = &rk817_rtc_resources[0],
 	},
+#ifdef CONFIG_SND_SOC_RK817
+	{
+		.name = "rk817-codec",
+		.of_compatible = "rockchip,rk817-codec",
+	},
+#endif
 };
 
 static const struct mfd_cell rk818s[] = {
Signature · 1 line
2.25.1
maintainer
#8 lore raw

drivers/mfd/rk808.c static const struct mfd_cell rk817s[] = { · line 171

Quoted 6 lines · Chris Morgan
drivers/mfd/rk808.c +6 -0
+#ifdef CONFIG_SND_SOC_RK817
+	{
+		.name = "rk817-codec",
+		.of_compatible = "rockchip,rk817-codec",
+	},
+#endif

The of_compatible should be redundant here. I'm not sure if the config guard is really useful?