Enables the audio codec on the Haikou Baseboard when used with a RK3399-Q7.
Changes in v2:
- reordered entries as suggested in review
- removed a conflicting i2s definition in rk3399-puma-haikou.dts
i2s0 was already enabled in rk3399-puma.dtsi as it should be,
so reuse it and fix the incorrect rockchip,*-channels values
- add a patch to the series that definies a generic i2s0-2ch-bus
- overwrite the generic pin definition of i2s0-2ch-bus with a specific
one used in the Haikou with RK3399-Q7 setup.
Klaus Goger (2):
arm64: dts: rockchip: add i2s0-2ch-bus pins on rk3399
arm64: dts: rockchip: enable I2S codec on rk3399-puma-haikou
.../arm64/boot/dts/rockchip/rk3399-puma-haikou.dts | 59 +++++++++++++++++++---
arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi | 25 +++++++++
arch/arm64/boot/dts/rockchip/rk3399.dtsi | 10 ++++
3 files changed, 86 insertions(+), 8 deletions(-)
--
2.11.0
Enable the NXP SGTL5000 audio codec on the RK3399-Q7 EVK baseboard
Haikou.
The i2s0_2ch_bus definition is only done in the SoM dtsi as it is
missing the LRCK_RX pin (that is used otherwise) and therefore not
generic enough for the SoC dtsi.
Signed-off-by: Klaus Goger <[email protected]>
---
Changes in v2:
- reordered entries as suggested in review
- removed a conflicting i2s definition in rk3399-puma-haikou.dts
i2s0 was already enabled in rk3399-puma.dtsi as it should be,
so reuse it and fix the incorrect rockchip,*-channels values
- add a patch to the series that definies a generic i2s0-2ch-bus
- overwrite the generic pin definition of i2s0-2ch-bus with a specific
one used in the Haikou with RK3399-Q7 setup.
.../arm64/boot/dts/rockchip/rk3399-puma-haikou.dts | 59 +++++++++++++++++++---
arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi | 25 +++++++++
2 files changed, 76 insertions(+), 8 deletions(-)
diff --git a/arch/arm64/boot/dts/rockchip/rk3399-puma-haikou.dts b/arch/arm64/boot/dts/rockchip/rk3399-puma-haikou.dts
index 9a7486058455..0e2fe2ae75ee 100644
--- a/arch/arm64/boot/dts/rockchip/rk3399-puma-haikou.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3399-puma-haikou.dts
@@ -61,6 +61,24 @@
};
};
+ i2s0_sound {
+ compatible = "simple-audio-card";
+ simple-audio-card,format = "i2s";
+ simple-audio-card,name = "Haikou,I2S-codec";
+ simple-audio-card,mclk-fs = <512>;
+
+ simple-audio-card,codec {
+ clocks = <&sgtl5000_clk>;
+ sound-dai = <&sgtl5000>;
+ };
+
+ simple-audio-card,cpu {
+ bitclock-master;
+ frame-master;
+ sound-dai = <&i2s0>;
+ };
+ };
+
dc_12v: dc-12v {
compatible = "regulator-fixed";
regulator-name = "dc_12v";
@@ -89,6 +107,28 @@
regulator-name = "vcc5v0_otg";
regulator-always-on;
};
+
+ vdda_codec: vdda-codec {
+ compatible = "regulator-fixed";
+ regulator-name = "vdda_codec";
+ regulator-boot-on;
+ regulator-min-microvolt = <3300000>;
+ regulator-max-microvolt = <3300000>;
+ };
+
+ vddd_codec: vddd-codec {
+ compatible = "regulator-fixed";
+ regulator-name = "vddd_codec";
+ regulator-boot-on;
+ regulator-min-microvolt = <1600000>;
+ regulator-max-microvolt = <1600000>;
+ };
+
+ sgtl5000_clk: sgtl5000-oscillator {
+ compatible = "fixed-clock";
+ #clock-cells = <0>;
+ clock-frequency = <24576000>;
+ };
};
&i2c1 {
@@ -110,6 +150,17 @@
&i2c4 {
status = "okay";
clock-frequency = <400000>;
+
+ sgtl5000: codec@0a {
+ compatible = "fsl,sgtl5000";
+ reg = <0x0a>;
+ clocks = <&sgtl5000_clk>;
+ #sound-dai-cells = <0>;
+ VDDA-supply = <&vdda_codec>;
+ VDDIO-supply = <&vdda_codec>;
+ VDDD-supply = <&vddd_codec>;
+ status = "okay";
+ };
};
&i2c6 {
@@ -117,14 +168,6 @@
clock-frequency = <400000>;
};
-&i2s0 {
- status = "okay";
- rockchip,playback-channels = <8>;
- rockchip,capture-channels = <8>;
- #sound-dai-cells = <0>;
- status = "okay";
-};
-
&pcie_phy {
status = "okay";
};
diff --git a/arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi
index 1fc5060d7027..fb57da126169 100644
--- a/arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi
@@ -435,6 +435,14 @@
};
};
+&i2s0 {
+ pinctrl-0 = <&i2s0_2ch_bus>;
+ rockchip,playback-channels = <2>;
+ rockchip,capture-channels = <2>;
+ #sound-dai-cells = <0>;
+ status = "okay";
+};
+
&io_domains {
status = "okay";
bt656-supply = <&vcc_1v8>;
@@ -461,6 +469,23 @@
};
};
+ i2s0 {
+ /*
+ * As Q7 does not specify neither a global nor a RX clock for I2S these
+ * signals are not used. Furthermore I2S0_LRCK_RX is used as GPIO.
+ * Therefore we have to redefine the i2s0_2ch_bus definition to prevent
+ * conflicts.
+ */
+ /delete-node/ i2s0_2ch_bus;
+ i2s0_2ch_bus: i2s0-2ch-bus {
+ rockchip,pins =
+ <RK_GPIO3 RK_PD0 RK_FUNC_1 &pcfg_pull_none>,
+ <RK_GPIO3 RK_PD2 RK_FUNC_1 &pcfg_pull_none>,
+ <RK_GPIO3 RK_PD3 RK_FUNC_1 &pcfg_pull_none>,
+ <RK_GPIO3 RK_PD7 RK_FUNC_1 &pcfg_pull_none>;
+ };
+ };
+
leds {
led_pin_module: led-module-gpio {
rockchip,pins =
--
2.11.0
Add pin definition for I2S0 if used as a 2-channel only bus.
Signed-off-by: Klaus Goger <[email protected]>
---
Changes in v2: None
arch/arm64/boot/dts/rockchip/rk3399.dtsi | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/arch/arm64/boot/dts/rockchip/rk3399.dtsi b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
index 7aa2144e0d47..3092700768e2 100644
--- a/arch/arm64/boot/dts/rockchip/rk3399.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
@@ -2043,6 +2043,16 @@
};
i2s0 {
+ i2s0_2ch_bus: i2s0-2ch-bus {
+ rockchip,pins =
+ <3 24 RK_FUNC_1 &pcfg_pull_none>,
+ <3 25 RK_FUNC_1 &pcfg_pull_none>,
+ <3 26 RK_FUNC_1 &pcfg_pull_none>,
+ <3 27 RK_FUNC_1 &pcfg_pull_none>,
+ <3 31 RK_FUNC_1 &pcfg_pull_none>,
+ <4 0 RK_FUNC_1 &pcfg_pull_none>;
+ };
+
i2s0_8ch_bus: i2s0-8ch-bus {
rockchip,pins =
<3 24 RK_FUNC_1 &pcfg_pull_none>,
--
2.11.0
Am Samstag, 3. Februar 2018, 16:50:15 CET schrieb Klaus Goger:
> Add pin definition for I2S0 if used as a 2-channel only bus.
>
> Signed-off-by: Klaus Goger <[email protected]>
applied for 4.17
Thanks
Heiko
Hi Klaus,
Am Samstag, 3. Februar 2018, 16:50:16 CET schrieb Klaus Goger:
> Enable the NXP SGTL5000 audio codec on the RK3399-Q7 EVK baseboard
> Haikou.
>
> The i2s0_2ch_bus definition is only done in the SoM dtsi as it is
> missing the LRCK_RX pin (that is used otherwise) and therefore not
> generic enough for the SoC dtsi.
>
> Signed-off-by: Klaus Goger <[email protected]>
as we talked about today at Fosdem, please add the changes as below
> + i2s0_sound {
nit: is20-sound
[...]
> regulator-name = "vcc5v0_otg";
> regulator-always-on;
> };
> +
> + vdda_codec: vdda-codec {
> + compatible = "regulator-fixed";
> + regulator-name = "vdda_codec";
> + regulator-boot-on;
> + regulator-min-microvolt = <3300000>;
> + regulator-max-microvolt = <3300000>;
vin-supply, so that the regulator-tree becomes an actual tree?
> + };
> +
> + vddd_codec: vddd-codec {
> + compatible = "regulator-fixed";
> + regulator-name = "vddd_codec";
> + regulator-boot-on;
> + regulator-min-microvolt = <1600000>;
> + regulator-max-microvolt = <1600000>;
vin-supply?
> -&i2s0 {
> - status = "okay";
> - rockchip,playback-channels = <8>;
> - rockchip,capture-channels = <8>;
> - #sound-dai-cells = <0>;
> - status = "okay";
> -};
> -
please do the move of the &i2s0 block in a separate patch
> @@ -461,6 +469,23 @@
> };
> };
>
> + i2s0 {
> + /*
> + * As Q7 does not specify neither a global nor a RX clock for I2S these
> + * signals are not used. Furthermore I2S0_LRCK_RX is used as GPIO.
> + * Therefore we have to redefine the i2s0_2ch_bus definition to prevent
> + * conflicts.
> + */
> + /delete-node/ i2s0_2ch_bus;
> + i2s0_2ch_bus: i2s0-2ch-bus {
> + rockchip,pins =
> + <RK_GPIO3 RK_PD0 RK_FUNC_1 &pcfg_pull_none>,
> + <RK_GPIO3 RK_PD2 RK_FUNC_1 &pcfg_pull_none>,
> + <RK_GPIO3 RK_PD3 RK_FUNC_1 &pcfg_pull_none>,
> + <RK_GPIO3 RK_PD7 RK_FUNC_1 &pcfg_pull_none>;
> + };
> + };
> +
please keep the comment but make this an
&i2s0_2ch_bus {
rockchip,pins =
}
as overriding only a single property doesn't require the /delete-node/
magic.
Thanks
Heiko