* [PATCH v5 2/4] ASoC: dt-bindings: rockchip: add i2s-tdm bindings
2021-10-01 17:15 [PATCH v5 0/4] Rockchip I2S/TDM controller Nicolas Frattaroli
@ 2021-10-01 17:15 ` Nicolas Frattaroli
2021-10-01 17:15 ` [PATCH v5 3/4] arm64: dts: rockchip: add i2s1 on rk356x Nicolas Frattaroli
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Nicolas Frattaroli @ 2021-10-01 17:15 UTC (permalink / raw)
To: Nicolas Frattaroli, Liam Girdwood, Mark Brown, Rob Herring,
Heiko Stuebner
Cc: Rob Herring, linux-rockchip, alsa-devel, devicetree,
linux-arm-kernel, linux-kernel
This adds the YAML bindings for the Rockchip I2S/TDM audio driver.
Signed-off-by: Nicolas Frattaroli <frattaroli.nicolas@gmail.com>
Reviewed-by: Rob Herring <robh@kernel.org>
---
.../bindings/sound/rockchip,i2s-tdm.yaml | 198 ++++++++++++++++++
MAINTAINERS | 1 +
2 files changed, 199 insertions(+)
create mode 100644 Documentation/devicetree/bindings/sound/rockchip,i2s-tdm.yaml
diff --git a/Documentation/devicetree/bindings/sound/rockchip,i2s-tdm.yaml b/Documentation/devicetree/bindings/sound/rockchip,i2s-tdm.yaml
new file mode 100644
index 000000000000..dce8b4136ec6
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/rockchip,i2s-tdm.yaml
@@ -0,0 +1,198 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/sound/rockchip,i2s-tdm.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Rockchip I2S/TDM Controller
+
+description:
+ The Rockchip I2S/TDM Controller is a Time Division Multiplexed
+ audio interface found in various Rockchip SoCs, allowing up
+ to 8 channels of audio over a serial interface.
+
+maintainers:
+ - Nicolas Frattaroli <frattaroli.nicolas@gmail.com>
+
+properties:
+ compatible:
+ enum:
+ - rockchip,px30-i2s-tdm
+ - rockchip,rk1808-i2s-tdm
+ - rockchip,rk3308-i2s-tdm
+ - rockchip,rk3568-i2s-tdm
+ - rockchip,rv1126-i2s-tdm
+
+ reg:
+ maxItems: 1
+
+ interrupts:
+ maxItems: 1
+
+ dmas:
+ minItems: 1
+ maxItems: 2
+
+ dma-names:
+ minItems: 1
+ maxItems: 2
+ items:
+ enum:
+ - rx
+ - tx
+
+ clocks:
+ minItems: 3
+ items:
+ - description: clock for TX
+ - description: clock for RX
+ - description: AHB clock driving the interface
+ - description:
+ Parent clock for mclk_tx (only required when using mclk-calibrate)
+ - description:
+ Parent clock for mclk_rx (only required when using mclk-calibrate)
+ - description:
+ Clock for sample rates that are an integer multiple of 8000
+ (only required when using mclk-calibrate)
+ - description:
+ Clock for sample rates that are an integer multiple of 11025
+ (only required when using mclk-calibrate)
+
+ clock-names:
+ minItems: 3
+ items:
+ - const: mclk_tx
+ - const: mclk_rx
+ - const: hclk
+ - const: mclk_tx_src
+ - const: mclk_rx_src
+ - const: mclk_root0
+ - const: mclk_root1
+
+ resets:
+ minItems: 1
+ maxItems: 2
+ description: resets for the tx and rx directions
+
+ reset-names:
+ minItems: 1
+ maxItems: 2
+ items:
+ enum:
+ - 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:
+ The phandle of the syscon node for the GRF register.
+
+ rockchip,trcm-sync-tx-only:
+ type: boolean
+ description: Use TX BCLK/LRCK for both TX and RX.
+
+ rockchip,trcm-sync-rx-only:
+ type: boolean
+ description: Use RX BCLK/LRCK for both TX and RX.
+
+ "#sound-dai-cells":
+ const: 0
+
+ rockchip,i2s-rx-route:
+ $ref: /schemas/types.yaml#/definitions/uint32-array
+ description:
+ Defines the mapping of I2S RX sdis to I2S data bus lines.
+ By default, they are mapped one-to-one.
+ rockchip,i2s-rx-route = <3> would mean sdi3 is receiving from data0.
+ maxItems: 4
+ items:
+ - enum: [0, 1, 2, 3]
+
+ rockchip,i2s-tx-route:
+ $ref: /schemas/types.yaml#/definitions/uint32-array
+ description:
+ Defines the mapping of I2S TX sdos to I2S data bus lines.
+ By default, they are mapped one-to-one.
+ rockchip,i2s-tx-route = <3> would mean sdo3 is sending to data0.
+ maxItems: 4
+ items:
+ - enum: [0, 1, 2, 3]
+
+ rockchip,io-multiplex:
+ description:
+ Specify that the GPIO lines on the I2S bus are multiplexed such that
+ the direction (input/output) needs to be dynamically adjusted.
+ type: boolean
+
+
+required:
+ - compatible
+ - reg
+ - interrupts
+ - dmas
+ - dma-names
+ - clocks
+ - clock-names
+ - resets
+ - reset-names
+ - 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:
+ - |
+ #include <dt-bindings/clock/rk3568-cru.h>
+ #include <dt-bindings/interrupt-controller/arm-gic.h>
+ #include <dt-bindings/interrupt-controller/irq.h>
+ #include <dt-bindings/pinctrl/rockchip.h>
+
+ bus {
+ #address-cells = <2>;
+ #size-cells = <2>;
+ i2s@fe410000 {
+ compatible = "rockchip,rk3568-i2s-tdm";
+ reg = <0x0 0xfe410000 0x0 0x1000>;
+ interrupts = <GIC_SPI 53 IRQ_TYPE_LEVEL_HIGH>;
+ 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,trcm-sync-tx-only;
+ rockchip,cru = <&cru>;
+ 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>;
+ };
+ };
diff --git a/MAINTAINERS b/MAINTAINERS
index 106d448e660d..e2cc0357e2b7 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -16119,6 +16119,7 @@ ROCKCHIP I2S TDM DRIVER
M: Nicolas Frattaroli <frattaroli.nicolas@gmail.com>
L: linux-rockchip@lists.infradead.org
S: Maintained
+F: Documentation/devicetree/bindings/sound/rockchip,i2s-tdm.yaml
F: sound/soc/rockchip/rockchip_i2s_tdm.*
ROCKCHIP ISP V1 DRIVER
--
2.33.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v5 3/4] arm64: dts: rockchip: add i2s1 on rk356x
2021-10-01 17:15 [PATCH v5 0/4] Rockchip I2S/TDM controller Nicolas Frattaroli
2021-10-01 17:15 ` [PATCH v5 2/4] ASoC: dt-bindings: rockchip: add i2s-tdm bindings Nicolas Frattaroli
@ 2021-10-01 17:15 ` Nicolas Frattaroli
2021-10-01 17:15 ` [PATCH v5 4/4] arm64: dts: rockchip: add analog audio on Quartz64 Nicolas Frattaroli
2021-10-07 21:37 ` (subset) [PATCH v5 0/4] Rockchip I2S/TDM controller Mark Brown
3 siblings, 0 replies; 5+ messages in thread
From: Nicolas Frattaroli @ 2021-10-01 17:15 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 | 26 ++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/arch/arm64/boot/dts/rockchip/rk356x.dtsi b/arch/arm64/boot/dts/rockchip/rk356x.dtsi
index e42fbac6147b..a24f7160f6d4 100644
--- a/arch/arm64/boot/dts/rockchip/rk356x.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk356x.dtsi
@@ -564,6 +564,32 @@ 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,cru = <&cru>;
+ 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.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v5 4/4] arm64: dts: rockchip: add analog audio on Quartz64
2021-10-01 17:15 [PATCH v5 0/4] Rockchip I2S/TDM controller Nicolas Frattaroli
2021-10-01 17:15 ` [PATCH v5 2/4] ASoC: dt-bindings: rockchip: add i2s-tdm bindings Nicolas Frattaroli
2021-10-01 17:15 ` [PATCH v5 3/4] arm64: dts: rockchip: add i2s1 on rk356x Nicolas Frattaroli
@ 2021-10-01 17:15 ` Nicolas Frattaroli
2021-10-07 21:37 ` (subset) [PATCH v5 0/4] Rockchip I2S/TDM controller Mark Brown
3 siblings, 0 replies; 5+ messages in thread
From: Nicolas Frattaroli @ 2021-10-01 17:15 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.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: (subset) [PATCH v5 0/4] Rockchip I2S/TDM controller
2021-10-01 17:15 [PATCH v5 0/4] Rockchip I2S/TDM controller Nicolas Frattaroli
` (2 preceding siblings ...)
2021-10-01 17:15 ` [PATCH v5 4/4] arm64: dts: rockchip: add analog audio on Quartz64 Nicolas Frattaroli
@ 2021-10-07 21:37 ` Mark Brown
3 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2021-10-07 21:37 UTC (permalink / raw)
To: Nicolas Frattaroli
Cc: Mark Brown, devicetree, Philipp Zabel, linux-rockchip,
Heiko Stuebner, linux-kernel, alsa-devel, Jaroslav Kysela,
Takashi Iwai, Liam Girdwood, linux-arm-kernel, Rob Herring
On Fri, 1 Oct 2021 19:15:27 +0200, Nicolas Frattaroli wrote:
> this is version 5 of the I2S/TDM driver patchset. A big thanks
> to everyone who has provided their valuable feedback so far.
>
> Changes in v5:
> driver:
> - change comment style of the first comment to C++ style
> - make refcount non-atomic, as it's only ever used inside
> a spinlock
> - use newer SND_SOC_DAIFMT_CB* defines
> - change ternary statements to if/else conditions
> - make _clk_compensation_put return 1 if clock changed
> - implement set_bclk_ratio callback
> - always set half frame sync mode in TDM mode
> - automatically enable mclk-calibrate mode when the clocks for
> it are specified in the device tree
> bindings:
> - add Reviewed-by: Rob Herring
> - drop rockchip,frame-width property (done by set_bclk_ratio)
> - drop rockchip,fsync-half-frame property
> - drop rockchip,mclk-calibrate property
> dts:
> - drop empty codec block from Quartz64 device tree
>
> [...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/4] ASoC: rockchip: add support for i2s-tdm controller
commit: 081068fd641403994f0505e6b91e021d3925f348
[2/4] ASoC: dt-bindings: rockchip: add i2s-tdm bindings
commit: 510f1c133aedcf69847786c14681e7f7bf4db778
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
^ permalink raw reply [flat|nested] 5+ messages in thread