* [PATCH 0/4] Getting rid of the reset controller in i2s-tdm
@ 2021-10-16 10:53 Nicolas Frattaroli
2021-10-16 10:53 ` [PATCH 2/4] ASoC: dt-bindings: rockchip: i2s-tdm: Drop rockchip,cru property Nicolas Frattaroli
` (4 more replies)
0 siblings, 5 replies; 8+ messages in thread
From: Nicolas Frattaroli @ 2021-10-16 10:53 UTC (permalink / raw)
Cc: Nicolas Frattaroli, Liam Girdwood, Mark Brown, Rob Herring,
Heiko Stuebner, Jaroslav Kysela, Takashi Iwai, Philipp Zabel,
linux-rockchip, alsa-devel, devicetree, linux-arm-kernel,
linux-kernel
Hello,
after some discussion with Heiko on IRC, he has admitted to me
that the rockchip,cru property, and its corresponding half a reset
controller in the driver, is weighing heavily on his mind.
The background is that if the lrck only uses one clock for both rx
and tx direction, then according to the downstream driver, the rx
and tx resets should be asserted at roughly the same time to keep
things in sync.
Since there is no existing kernel way of doing this, the driver
would manually write to the CRU's registers to achieve this,
violating abstractions.
We've agreed that an atomic bulk reset API would be the best way to
achieve what it does in a clean fashion. The details of such an API
have yet to be worked out by me, but as it turns out, this is not
a pressing need.
During my investigation, I noticed that I can simply drop the
synchronised reset for now and assert the two resets manually one
after the other, and deassert them in the same manner.
For the case I care about, which is audio playback, this seems to
work just fine. Should someone actually find a case where this
causes a problem, it should be fixed with an atomic bulk reset API.
Patch 1 removes the direct CRU writing stuff from the i2s-tdm driver.
Patch 2 drops the rockchip,cru property from the bindings; they have
not yet been in a kernel release, so as far as I know, we can still
change them with no regard for backwards compatibility.
Patch 3 adds the rk356x i2s1 node without the rockchip,cru property.
Patch 4 adds the analog audio output on Quartz64, included here for
Heiko's convenience.
Regards,
Nicolas Frattaroli
Nicolas Frattaroli (4):
ASoC: rockchip: i2s-tdm: Strip out direct CRU use
ASoC: dt-bindings: rockchip: i2s-tdm: Drop rockchip,cru property
arm64: dts: rockchip: Add i2s1 on rk356x
arm64: dts: rockchip: Add analog audio on Quartz64
.../bindings/sound/rockchip,i2s-tdm.yaml | 16 ---
.../boot/dts/rockchip/rk3566-quartz64-a.dts | 31 ++++-
arch/arm64/boot/dts/rockchip/rk356x.dtsi | 25 ++++
sound/soc/rockchip/rockchip_i2s_tdm.c | 126 +++---------------
4 files changed, 76 insertions(+), 122 deletions(-)
--
2.33.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 2/4] ASoC: dt-bindings: rockchip: i2s-tdm: Drop rockchip,cru property
2021-10-16 10:53 [PATCH 0/4] Getting rid of the reset controller in i2s-tdm Nicolas Frattaroli
@ 2021-10-16 10:53 ` Nicolas Frattaroli
2021-10-16 15:47 ` Heiko Stuebner
2021-10-16 10:53 ` [PATCH 3/4] arm64: dts: rockchip: Add i2s1 on rk356x Nicolas Frattaroli
` (3 subsequent siblings)
4 siblings, 1 reply; 8+ messages in thread
From: Nicolas Frattaroli @ 2021-10-16 10:53 UTC (permalink / raw)
To: Nicolas Frattaroli, Liam Girdwood, Mark Brown, Rob Herring,
Heiko Stuebner
Cc: linux-rockchip, alsa-devel, devicetree, linux-arm-kernel,
linux-kernel
This property was only needed for a driver hack, which we can
remove. Since the bindings were not in any kernel release yet, we
are able to just drop the property instead of silently accepting
and ignoring it.
Signed-off-by: Nicolas Frattaroli <frattaroli.nicolas@gmail.com>
---
.../bindings/sound/rockchip,i2s-tdm.yaml | 16 ----------------
1 file changed, 16 deletions(-)
diff --git a/Documentation/devicetree/bindings/sound/rockchip,i2s-tdm.yaml b/Documentation/devicetree/bindings/sound/rockchip,i2s-tdm.yaml
index ce3e18b50230..6a7c004bef17 100644
--- a/Documentation/devicetree/bindings/sound/rockchip,i2s-tdm.yaml
+++ b/Documentation/devicetree/bindings/sound/rockchip,i2s-tdm.yaml
@@ -82,12 +82,6 @@ properties:
- tx-m
- rx-m
- rockchip,cru:
- $ref: /schemas/types.yaml#/definitions/phandle
- description:
- The phandle of the cru.
- Required if neither trcm-sync-tx-only nor trcm-sync-rx-only are specified.
-
rockchip,grf:
$ref: /schemas/types.yaml#/definitions/phandle
description:
@@ -144,15 +138,6 @@ required:
- rockchip,grf
- "#sound-dai-cells"
-allOf:
- - if:
- properties:
- rockchip,trcm-sync-tx-only: false
- rockchip,trcm-sync-rx-only: false
- then:
- required:
- - rockchip,cru
-
additionalProperties: false
examples:
@@ -177,7 +162,6 @@ examples:
resets = <&cru SRST_M_I2S1_8CH_TX>, <&cru SRST_M_I2S1_8CH_RX>;
reset-names = "tx-m", "rx-m";
rockchip,trcm-sync-tx-only;
- rockchip,cru = <&cru>;
rockchip,grf = <&grf>;
#sound-dai-cells = <0>;
pinctrl-names = "default";
--
2.33.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/4] arm64: dts: rockchip: Add i2s1 on rk356x
2021-10-16 10:53 [PATCH 0/4] Getting rid of the reset controller in i2s-tdm Nicolas Frattaroli
2021-10-16 10:53 ` [PATCH 2/4] ASoC: dt-bindings: rockchip: i2s-tdm: Drop rockchip,cru property Nicolas Frattaroli
@ 2021-10-16 10:53 ` Nicolas Frattaroli
2021-10-16 10:53 ` [PATCH 4/4] arm64: dts: rockchip: Add analog audio on Quartz64 Nicolas Frattaroli
` (2 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Nicolas Frattaroli @ 2021-10-16 10:53 UTC (permalink / raw)
To: Rob Herring, Heiko Stuebner
Cc: Nicolas Frattaroli, devicetree, linux-arm-kernel, linux-rockchip,
linux-kernel
This adds the necessary device tree node on rk3566 and rk3568
to enable the I2S1 TDM audio controller.
I2S0 has not been added, as it is connected to HDMI and there is
no way to test that it's working without a functioning video
clock (read: VOP2 driver).
Signed-off-by: Nicolas Frattaroli <frattaroli.nicolas@gmail.com>
---
arch/arm64/boot/dts/rockchip/rk356x.dtsi | 25 ++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/arch/arm64/boot/dts/rockchip/rk356x.dtsi b/arch/arm64/boot/dts/rockchip/rk356x.dtsi
index b721a34ffa8c..dbe0123e74e8 100644
--- a/arch/arm64/boot/dts/rockchip/rk356x.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk356x.dtsi
@@ -608,6 +608,31 @@ sdhci: mmc@fe310000 {
status = "disabled";
};
+ i2s1_8ch: i2s@fe410000 {
+ compatible = "rockchip,rk3568-i2s-tdm";
+ reg = <0x0 0xfe410000 0x0 0x1000>;
+ interrupts = <GIC_SPI 53 IRQ_TYPE_LEVEL_HIGH>;
+ assigned-clocks = <&cru CLK_I2S1_8CH_TX_SRC>, <&cru CLK_I2S1_8CH_RX_SRC>;
+ assigned-clock-rates = <1188000000>, <1188000000>;
+ clocks = <&cru MCLK_I2S1_8CH_TX>, <&cru MCLK_I2S1_8CH_RX>,
+ <&cru HCLK_I2S1_8CH>;
+ clock-names = "mclk_tx", "mclk_rx", "hclk";
+ dmas = <&dmac1 3>, <&dmac1 2>;
+ dma-names = "rx", "tx";
+ resets = <&cru SRST_M_I2S1_8CH_TX>, <&cru SRST_M_I2S1_8CH_RX>;
+ reset-names = "tx-m", "rx-m";
+ rockchip,grf = <&grf>;
+ #sound-dai-cells = <0>;
+ pinctrl-names = "default";
+ pinctrl-0 = <&i2s1m0_sclktx &i2s1m0_sclkrx
+ &i2s1m0_lrcktx &i2s1m0_lrckrx
+ &i2s1m0_sdi0 &i2s1m0_sdi1
+ &i2s1m0_sdi2 &i2s1m0_sdi3
+ &i2s1m0_sdo0 &i2s1m0_sdo1
+ &i2s1m0_sdo2 &i2s1m0_sdo3>;
+ status = "disabled";
+ };
+
dmac0: dmac@fe530000 {
compatible = "arm,pl330", "arm,primecell";
reg = <0x0 0xfe530000 0x0 0x4000>;
--
2.33.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 4/4] arm64: dts: rockchip: Add analog audio on Quartz64
2021-10-16 10:53 [PATCH 0/4] Getting rid of the reset controller in i2s-tdm Nicolas Frattaroli
2021-10-16 10:53 ` [PATCH 2/4] ASoC: dt-bindings: rockchip: i2s-tdm: Drop rockchip,cru property Nicolas Frattaroli
2021-10-16 10:53 ` [PATCH 3/4] arm64: dts: rockchip: Add i2s1 on rk356x Nicolas Frattaroli
@ 2021-10-16 10:53 ` Nicolas Frattaroli
2021-10-17 11:36 ` (subset) [PATCH 0/4] Getting rid of the reset controller in i2s-tdm Mark Brown
2021-10-17 12:36 ` Heiko Stuebner
4 siblings, 0 replies; 8+ messages in thread
From: Nicolas Frattaroli @ 2021-10-16 10:53 UTC (permalink / raw)
To: Rob Herring, Heiko Stuebner
Cc: Nicolas Frattaroli, devicetree, linux-arm-kernel, linux-rockchip,
linux-kernel
On the Quartz64 Model A, the I2S1 TDM controller is connected
to the rk817 codec in I2S mode. Enabling it and adding the
necessary simple-sound-card and codec nodes allows for analog
audio output on the PINE64 Quartz64 Model A SBC.
Signed-off-by: Nicolas Frattaroli <frattaroli.nicolas@gmail.com>
---
.../boot/dts/rockchip/rk3566-quartz64-a.dts | 31 ++++++++++++++++++-
1 file changed, 30 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/boot/dts/rockchip/rk3566-quartz64-a.dts b/arch/arm64/boot/dts/rockchip/rk3566-quartz64-a.dts
index a244f7b87e38..f1261f25cb35 100644
--- a/arch/arm64/boot/dts/rockchip/rk3566-quartz64-a.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3566-quartz64-a.dts
@@ -58,6 +58,20 @@ led-diy {
};
};
+ rk817-sound {
+ compatible = "simple-audio-card";
+ simple-audio-card,format = "i2s";
+ simple-audio-card,name = "Analog RK817";
+ simple-audio-card,mclk-fs = <256>;
+
+ simple-audio-card,cpu {
+ sound-dai = <&i2s1_8ch>;
+ };
+ simple-audio-card,codec {
+ sound-dai = <&rk817>;
+ };
+ };
+
vcc12v_dcin: vcc12v_dcin {
compatible = "regulator-fixed";
regulator-name = "vcc12v_dcin";
@@ -199,8 +213,13 @@ rk817: pmic@20 {
interrupts = <RK_PA3 IRQ_TYPE_LEVEL_LOW>;
clock-output-names = "rk808-clkout1", "rk808-clkout2";
+ #sound-dai-cells = <0>;
+ clock-names = "mclk";
+ clocks = <&cru I2S1_MCLKOUT_TX>;
+ assigned-clocks = <&cru I2S1_MCLKOUT_TX>;
+ assigned-clock-parents = <&cru CLK_I2S1_8CH_TX>;
pinctrl-names = "default";
- pinctrl-0 = <&pmic_int_l>;
+ pinctrl-0 = <&pmic_int_l>, <&i2s1m0_mclk>;
rockchip,system-power-controller;
wakeup-source;
#clock-cells = <1>;
@@ -392,6 +411,16 @@ regulator-state-mem {
};
};
+&i2s1_8ch {
+ status = "okay";
+ rockchip,trcm-sync-tx-only;
+ pinctrl-names = "default";
+ pinctrl-0 = <&i2s1m0_sclktx
+ &i2s1m0_lrcktx
+ &i2s1m0_sdi0
+ &i2s1m0_sdo0>;
+};
+
&mdio1 {
rgmii_phy1: ethernet-phy@0 {
compatible = "ethernet-phy-ieee802.3-c22";
--
2.33.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 2/4] ASoC: dt-bindings: rockchip: i2s-tdm: Drop rockchip,cru property
2021-10-16 10:53 ` [PATCH 2/4] ASoC: dt-bindings: rockchip: i2s-tdm: Drop rockchip,cru property Nicolas Frattaroli
@ 2021-10-16 15:47 ` Heiko Stuebner
0 siblings, 0 replies; 8+ messages in thread
From: Heiko Stuebner @ 2021-10-16 15:47 UTC (permalink / raw)
To: Nicolas Frattaroli, Liam Girdwood, Mark Brown, Rob Herring,
Nicolas Frattaroli
Cc: linux-rockchip, alsa-devel, devicetree, linux-arm-kernel,
linux-kernel
Am Samstag, 16. Oktober 2021, 12:53:51 CEST schrieb Nicolas Frattaroli:
> This property was only needed for a driver hack, which we can
> remove. Since the bindings were not in any kernel release yet, we
> are able to just drop the property instead of silently accepting
> and ignoring it.
>
> Signed-off-by: Nicolas Frattaroli <frattaroli.nicolas@gmail.com>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Thanks for doing that change :-)
Heiko
> ---
> .../bindings/sound/rockchip,i2s-tdm.yaml | 16 ----------------
> 1 file changed, 16 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/sound/rockchip,i2s-tdm.yaml b/Documentation/devicetree/bindings/sound/rockchip,i2s-tdm.yaml
> index ce3e18b50230..6a7c004bef17 100644
> --- a/Documentation/devicetree/bindings/sound/rockchip,i2s-tdm.yaml
> +++ b/Documentation/devicetree/bindings/sound/rockchip,i2s-tdm.yaml
> @@ -82,12 +82,6 @@ properties:
> - tx-m
> - rx-m
>
> - rockchip,cru:
> - $ref: /schemas/types.yaml#/definitions/phandle
> - description:
> - The phandle of the cru.
> - Required if neither trcm-sync-tx-only nor trcm-sync-rx-only are specified.
> -
> rockchip,grf:
> $ref: /schemas/types.yaml#/definitions/phandle
> description:
> @@ -144,15 +138,6 @@ required:
> - rockchip,grf
> - "#sound-dai-cells"
>
> -allOf:
> - - if:
> - properties:
> - rockchip,trcm-sync-tx-only: false
> - rockchip,trcm-sync-rx-only: false
> - then:
> - required:
> - - rockchip,cru
> -
> additionalProperties: false
>
> examples:
> @@ -177,7 +162,6 @@ examples:
> resets = <&cru SRST_M_I2S1_8CH_TX>, <&cru SRST_M_I2S1_8CH_RX>;
> reset-names = "tx-m", "rx-m";
> rockchip,trcm-sync-tx-only;
> - rockchip,cru = <&cru>;
> rockchip,grf = <&grf>;
> #sound-dai-cells = <0>;
> pinctrl-names = "default";
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: (subset) [PATCH 0/4] Getting rid of the reset controller in i2s-tdm
2021-10-16 10:53 [PATCH 0/4] Getting rid of the reset controller in i2s-tdm Nicolas Frattaroli
` (2 preceding siblings ...)
2021-10-16 10:53 ` [PATCH 4/4] arm64: dts: rockchip: Add analog audio on Quartz64 Nicolas Frattaroli
@ 2021-10-17 11:36 ` Mark Brown
2021-10-17 11:45 ` Mark Brown
2021-10-17 12:36 ` Heiko Stuebner
4 siblings, 1 reply; 8+ messages in thread
From: Mark Brown @ 2021-10-17 11:36 UTC (permalink / raw)
To: Nicolas Frattaroli
Cc: Liam Girdwood, Rob Herring, Philipp Zabel, linux-rockchip,
devicetree, linux-arm-kernel, Jaroslav Kysela, alsa-devel,
Heiko Stuebner, linux-kernel, Takashi Iwai
On Sat, 16 Oct 2021 12:53:49 +0200, Nicolas Frattaroli wrote:
> after some discussion with Heiko on IRC, he has admitted to me
> that the rockchip,cru property, and its corresponding half a reset
> controller in the driver, is weighing heavily on his mind.
>
> The background is that if the lrck only uses one clock for both rx
> and tx direction, then according to the downstream driver, the rx
> and tx resets should be asserted at roughly the same time to keep
> things in sync.
>
> [...]
Applied, thanks!
[1/4] ASoC: rockchip: i2s-tdm: Strip out direct CRU use
commit: d6365d0f0a03c1feb28d86dfd192972ddc647013
[2/4] ASoC: dt-bindings: rockchip: i2s-tdm: Drop rockchip,cru property
commit: 4e52cb9e2c22c9d860910794c82461064baadd9f
Best regards,
--
Mark Brown <broonie@kernel.org>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: (subset) [PATCH 0/4] Getting rid of the reset controller in i2s-tdm
2021-10-17 11:36 ` (subset) [PATCH 0/4] Getting rid of the reset controller in i2s-tdm Mark Brown
@ 2021-10-17 11:45 ` Mark Brown
0 siblings, 0 replies; 8+ messages in thread
From: Mark Brown @ 2021-10-17 11:45 UTC (permalink / raw)
To: Nicolas Frattaroli
Cc: Mark Brown, Liam Girdwood, Rob Herring, Philipp Zabel,
linux-rockchip, devicetree, linux-arm-kernel, Jaroslav Kysela,
alsa-devel, Heiko Stuebner, linux-kernel, Takashi Iwai
On Sat, 16 Oct 2021 12:53:49 +0200, Nicolas Frattaroli wrote:
> after some discussion with Heiko on IRC, he has admitted to me
> that the rockchip,cru property, and its corresponding half a reset
> controller in the driver, is weighing heavily on his mind.
>
> The background is that if the lrck only uses one clock for both rx
> and tx direction, then according to the downstream driver, the rx
> and tx resets should be asserted at roughly the same time to keep
> things in sync.
>
> [...]
Applied, thanks!
[1/4] ASoC: rockchip: i2s-tdm: Strip out direct CRU use
commit: d6365d0f0a03c1feb28d86dfd192972ddc647013
[2/4] ASoC: dt-bindings: rockchip: i2s-tdm: Drop rockchip,cru property
commit: 4e52cb9e2c22c9d860910794c82461064baadd9f
Best regards,
--
Mark Brown <broonie@kernel.org>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: (subset) [PATCH 0/4] Getting rid of the reset controller in i2s-tdm
2021-10-16 10:53 [PATCH 0/4] Getting rid of the reset controller in i2s-tdm Nicolas Frattaroli
` (3 preceding siblings ...)
2021-10-17 11:36 ` (subset) [PATCH 0/4] Getting rid of the reset controller in i2s-tdm Mark Brown
@ 2021-10-17 12:36 ` Heiko Stuebner
4 siblings, 0 replies; 8+ messages in thread
From: Heiko Stuebner @ 2021-10-17 12:36 UTC (permalink / raw)
To: Nicolas Frattaroli
Cc: Heiko Stuebner, devicetree, alsa-devel, Takashi Iwai,
Liam Girdwood, Philipp Zabel, linux-kernel, linux-rockchip,
Rob Herring, Mark Brown, linux-arm-kernel
On Sat, 16 Oct 2021 12:53:49 +0200, Nicolas Frattaroli wrote:
> after some discussion with Heiko on IRC, he has admitted to me
> that the rockchip,cru property, and its corresponding half a reset
> controller in the driver, is weighing heavily on his mind.
>
> The background is that if the lrck only uses one clock for both rx
> and tx direction, then according to the downstream driver, the rx
> and tx resets should be asserted at roughly the same time to keep
> things in sync.
>
> [...]
Applied, thanks!
[3/4] arm64: dts: rockchip: Add i2s1 on rk356x
commit: ef5c913570040df1955dd49cea221783468faeaf
[4/4] arm64: dts: rockchip: Add analog audio on Quartz64
commit: 1938b585ed19bb01969b4e923664db88c5ee8798
Best regards,
--
Heiko Stuebner <heiko@sntech.de>
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2021-10-17 12:36 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-16 10:53 [PATCH 0/4] Getting rid of the reset controller in i2s-tdm Nicolas Frattaroli
2021-10-16 10:53 ` [PATCH 2/4] ASoC: dt-bindings: rockchip: i2s-tdm: Drop rockchip,cru property Nicolas Frattaroli
2021-10-16 15:47 ` Heiko Stuebner
2021-10-16 10:53 ` [PATCH 3/4] arm64: dts: rockchip: Add i2s1 on rk356x Nicolas Frattaroli
2021-10-16 10:53 ` [PATCH 4/4] arm64: dts: rockchip: Add analog audio on Quartz64 Nicolas Frattaroli
2021-10-17 11:36 ` (subset) [PATCH 0/4] Getting rid of the reset controller in i2s-tdm Mark Brown
2021-10-17 11:45 ` Mark Brown
2021-10-17 12:36 ` Heiko Stuebner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).