Skip to contentSkip to conversation

dt-bindings: Add Rockchip rk817 audio CODEC support

PATCH Superseded Chris Morgan 2 participants 6 messages Mar 19, 2021 – Apr 7, 2021 1 message not in the archive

Subsystems (4)

v5 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 v5 2/4 ASoC: Add Rockchip rk817 audio CODEC support

Add support for the Rockchip rk817 audio codec integrated into the rk817 PMIC. This is based on the sources provided by Rockchip from their BSP kernel.

Changes from v4:
Switched to using parent regmap instead of private regmap. Removed of_compatible strings.
Removed register definitions and moved them to the MFD driver.

---
 sound/soc/codecs/Kconfig       |   6 +
 sound/soc/codecs/Makefile      |   2 +
 sound/soc/codecs/rk817_codec.c | 560 +++++++++++++++++++++++++++++++++
 3 files changed, 566 insertions(+)
 create mode 100644 sound/soc/codecs/rk817_codec.c
sound/soc/codecs/Kconfig +6 -0
index e4cf14e66a51..d835145ad65e 100644
@@ -155,6 +155,7 @@ config SND_SOC_ALL_CODECS
 	imply SND_SOC_PCM512x_I2C
 	imply SND_SOC_PCM512x_SPI
 	imply SND_SOC_RK3328
+	imply SND_SOC_RK817
 	imply SND_SOC_RT274
 	imply SND_SOC_RT286
 	imply SND_SOC_RT298
@@ -1059,6 +1060,11 @@ config SND_SOC_RK3328
 	tristate "Rockchip RK3328 audio CODEC"
 	select REGMAP_MMIO
 
+config SND_SOC_RK817
+	tristate "Rockchip RK817 audio CODEC"
+	depends on MFD_RK808
+	select REGMAP_I2C
+
 config SND_SOC_RL6231
 	tristate
 	default y if SND_SOC_RT5514=y
sound/soc/codecs/Makefile +2 -0
index 81357dc62ea0..4e5e9b28775c 100644
@@ -165,6 +165,7 @@ snd-soc-pcm512x-objs := pcm512x.o
 snd-soc-pcm512x-i2c-objs := pcm512x-i2c.o
 snd-soc-pcm512x-spi-objs := pcm512x-spi.o
 snd-soc-rk3328-objs := rk3328_codec.o
+snd-soc-rk817-objs := rk817_codec.o
 snd-soc-rl6231-objs := rl6231.o
 snd-soc-rl6347a-objs := rl6347a.o
 snd-soc-rt1011-objs := rt1011.o
@@ -479,6 +480,7 @@ obj-$(CONFIG_SND_SOC_PCM512x)	+= snd-soc-pcm512x.o
 obj-$(CONFIG_SND_SOC_PCM512x_I2C)	+= snd-soc-pcm512x-i2c.o
 obj-$(CONFIG_SND_SOC_PCM512x_SPI)	+= snd-soc-pcm512x-spi.o
 obj-$(CONFIG_SND_SOC_RK3328)	+= snd-soc-rk3328.o
+obj-$(CONFIG_SND_SOC_RK817)	+= snd-soc-rk817.o
 obj-$(CONFIG_SND_SOC_RL6231)	+= snd-soc-rl6231.o
 obj-$(CONFIG_SND_SOC_RL6347A)	+= snd-soc-rl6347a.o
 obj-$(CONFIG_SND_SOC_RT1011)	+= snd-soc-rt1011.o
sound/soc/codecs/rk817_codec.c new file +560 -0

560 lines not on this page · raw message

Signature · 1 line
2.25.1
maintainer Reviewed-by on v5 2/4
#2 lore raw

Re: [PATCH v5 2/4] ASoC: Add Rockchip rk817 audio CODEC support

Quoted 3 lines · Chris Morgan

Add support for the Rockchip rk817 audio codec integrated into the rk817 PMIC. This is based on the sources provided by Rockchip from their BSP kernel.

Quoted 2 lines

Changes from v4:
Switched to using parent regmap instead of private regmap.

This should go after the --- as per submitting-patches.rst.

#3 lore raw

Re: [PATCH v5 2/4] ASoC: Add Rockchip rk817 audio CODEC support

Quoted 11 lines · Mark Brown
Quoted 3 lines · Chris Morgan

Add support for the Rockchip rk817 audio codec integrated into the rk817 PMIC. This is based on the sources provided by Rockchip from their BSP kernel.

Quoted 2 lines

Changes from v4:
Switched to using parent regmap instead of private regmap.

This should go after the --- as per submitting-patches.rst.

Thank you... should I resubmit for this?

maintainer
#4 lore raw

Re: [PATCH v5 2/4] ASoC: Add Rockchip rk817 audio CODEC support

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

This should go after the --- as per submitting-patches.rst.

Thank you... should I resubmit for this?

It's fine from my point of view, don't know if Lee would want a resend or not.

#5 lore raw

PATCH v5 3/4 dt-bindings: Add Rockchip rk817 audio CODEC support

In reply to a message not in the archive

Create dt-binding documentation to document rk817 codec.

---
 .../bindings/sound/rockchip,rk817-codec.yaml  | 60 +++++++++++++++++++
 1 file changed, 60 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/rockchip,rk817-codec.yaml
Documentation/devicetree/bindings/sound/rockchip,rk817-codec.yaml new file +60 -0
new file mode 100644
index 000000000000..845886e2fdf4
@@ -0,0 +1,60 @@
+# 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>, <&i2s_8ch_mclk>;
+	#sound-dai-cells = <0>;
+	clocks = <&cru SCLK_I2S_8CH_OUT>;
+	clock-names = "mclk";
+
+	........
+
+	rk817_codec: codec {
+			mic-in-differential;
+			status = "okay";
+	};
+
+	........
+
+};
Signature · 1 line
2.25.1
#6 lore raw

PATCH v5 4/4 arm64: dts: rockchip: add rk817 codec to Odroid Go Advance

In reply to a message not in the archive

Add the new rk817 codec driver to the Odroid Go Advance.

---
 .../boot/dts/rockchip/rk3326-odroid-go2.dts   | 35 ++++++++++++++++++-
 1 file changed, 34 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/rockchip/rk3326-odroid-go2.dts +34 -1
index 97fb93e1cc00..e48dcf430efc 100644
@@ -161,6 +161,29 @@ blue_led: led-0 {
 		};
 	};
 
+	rk817-sound {
+		compatible = "simple-audio-card";
+		simple-audio-card,format = "i2s";
+		simple-audio-card,name = "rockchip,rk817-codec";
+		simple-audio-card,mclk-fs = <256>;
+		simple-audio-card,widgets =
+			"Microphone", "Mic Jack",
+			"Headphone", "Headphones",
+			"Speaker", "Speaker";
+		simple-audio-card,routing =
+			"MICL", "Mic Jack",
+			"Headphones", "HPOL",
+			"Headphones", "HPOR",
+			"Speaker", "SPKO";
+		simple-audio-card,hp-det-gpio = <&gpio2 RK_PC6 GPIO_ACTIVE_HIGH>;
+		simple-audio-card,cpu {
+			sound-dai = <&i2s1_2ch>;
+		};
+		simple-audio-card,codec {
+			sound-dai = <&rk817>;
+		};
+	};
+
 	vccsys: vccsys {
 		compatible = "regulator-fixed";
 		regulator-name = "vcc3v8_sys";
@@ -266,10 +289,13 @@ rk817: pmic@20 {
 		interrupt-parent = <&gpio0>;
 		interrupts = <RK_PB2 IRQ_TYPE_LEVEL_LOW>;
 		pinctrl-names = "default";
-		pinctrl-0 = <&pmic_int>;
+		pinctrl-0 = <&pmic_int>, <&i2s1_2ch_mclk>;
 		wakeup-source;
 		#clock-cells = <1>;
 		clock-output-names = "rk808-clkout1", "xin32k";
+		clocks = <&cru SCLK_I2S1_OUT>;
+		clock-names = "mclk";
+		#sound-dai-cells = <0>;
 
 		vcc1-supply = <&vccsys>;
 		vcc2-supply = <&vccsys>;
@@ -428,6 +454,11 @@ regulator-state-mem {
 				};
 			};
 		};
+
+		rk817_codec: codec {
+			mic-in-differential;
+			status = "okay";
+		};
 	};
 };
 
@@ -439,6 +470,8 @@ &i2c1 {
 
 /* I2S 1 Channel Used */
 &i2s1_2ch {
+	resets = <&cru SRST_I2S1>, <&cru SRST_I2S1_H>;
+	reset-names = "reset-m", "reset-h";
 	status = "okay";
 };
 
Signature · 1 line
2.25.1