Skip to content

Commit 076f322

Browse files
committed
Add RK3576 SAI Audio Controller Support
Merge series from Nicolas Frattaroli <nicolas.frattaroli@collabora.com>: This series adds support for Rockchip's Serial Audio Interface (SAI) controller, found on SoCs such as the RK3576. The SAI is a flexible controller IP that allows both transmitting and receiving digital audio in the I2S, TDM and PCM formats. Instances of this controller are used both for externally exposed audio interfaces, as well as for audio on video interfaces such as HDMI.
2 parents 6d7ee6d + cc78d1e commit 076f322

6 files changed

Lines changed: 1969 additions & 0 deletions

File tree

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/sound/rockchip,rk3576-sai.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: Rockchip Serial Audio Interface Controller
8+
9+
description:
10+
The Rockchip Serial Audio Interface (SAI) controller is a flexible audio
11+
controller that implements the I2S, I2S/TDM and the PDM standards.
12+
13+
maintainers:
14+
- Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
15+
16+
allOf:
17+
- $ref: dai-common.yaml#
18+
19+
properties:
20+
compatible:
21+
const: rockchip,rk3576-sai
22+
23+
reg:
24+
maxItems: 1
25+
26+
interrupts:
27+
maxItems: 1
28+
29+
dmas:
30+
minItems: 1
31+
maxItems: 2
32+
33+
dma-names:
34+
minItems: 1
35+
items:
36+
- enum: [tx, rx]
37+
- const: rx
38+
39+
clocks:
40+
items:
41+
- description: master audio clock
42+
- description: AHB clock driving the interface
43+
44+
clock-names:
45+
items:
46+
- const: mclk
47+
- const: hclk
48+
49+
resets:
50+
minItems: 1
51+
items:
52+
- description: reset for the mclk domain
53+
- description: reset for the hclk domain
54+
55+
reset-names:
56+
minItems: 1
57+
items:
58+
- const: m
59+
- const: h
60+
61+
port:
62+
$ref: audio-graph-port.yaml#
63+
unevaluatedProperties: false
64+
65+
power-domains:
66+
maxItems: 1
67+
68+
"#sound-dai-cells":
69+
const: 0
70+
71+
rockchip,sai-rx-route:
72+
$ref: /schemas/types.yaml#/definitions/uint32-array
73+
description:
74+
Defines the mapping of the controller's SDI ports to actual input lanes,
75+
as well as the number of input lanes.
76+
rockchip,sai-rx-route = <3> would mean sdi3 is receiving from data0, and
77+
that there is only one receiving lane.
78+
This property's absence is to be understood as only one receiving lane
79+
being used if the controller has capture capabilities.
80+
maxItems: 4
81+
items:
82+
minimum: 0
83+
maximum: 3
84+
85+
rockchip,sai-tx-route:
86+
$ref: /schemas/types.yaml#/definitions/uint32-array
87+
description:
88+
Defines the mapping of the controller's SDO ports to actual output lanes,
89+
as well as the number of output lanes.
90+
rockchip,sai-tx-route = <3> would mean sdo3 is sending to data0, and
91+
that there is only one transmitting lane.
92+
This property's absence is to be understood as only one transmitting lane
93+
being used if the controller has playback capabilities.
94+
maxItems: 4
95+
items:
96+
minimum: 0
97+
maximum: 3
98+
99+
required:
100+
- compatible
101+
- reg
102+
- dmas
103+
- dma-names
104+
- clocks
105+
- clock-names
106+
- "#sound-dai-cells"
107+
108+
unevaluatedProperties: false
109+
110+
examples:
111+
- |
112+
#include <dt-bindings/clock/rockchip,rk3576-cru.h>
113+
#include <dt-bindings/interrupt-controller/arm-gic.h>
114+
#include <dt-bindings/interrupt-controller/irq.h>
115+
#include <dt-bindings/pinctrl/rockchip.h>
116+
#include <dt-bindings/power/rockchip,rk3576-power.h>
117+
#include <dt-bindings/reset/rockchip,rk3576-cru.h>
118+
119+
bus {
120+
#address-cells = <2>;
121+
#size-cells = <2>;
122+
sai1: sai@2a610000 {
123+
compatible = "rockchip,rk3576-sai";
124+
reg = <0x0 0x2a610000 0x0 0x1000>;
125+
interrupts = <GIC_SPI 188 IRQ_TYPE_LEVEL_HIGH>;
126+
clocks = <&cru MCLK_SAI1_8CH>, <&cru HCLK_SAI1_8CH>;
127+
clock-names = "mclk", "hclk";
128+
dmas = <&dmac0 2>, <&dmac0 3>;
129+
dma-names = "tx", "rx";
130+
power-domains = <&power RK3576_PD_AUDIO>;
131+
resets = <&cru SRST_M_SAI1_8CH>, <&cru SRST_H_SAI1_8CH>;
132+
reset-names = "m", "h";
133+
pinctrl-names = "default";
134+
pinctrl-0 = <&sai1m0_lrck
135+
&sai1m0_sclk
136+
&sai1m0_sdi0
137+
&sai1m0_sdo0
138+
&sai1m0_sdo1
139+
&sai1m0_sdo2
140+
&sai1m0_sdo3>;
141+
rockchip,sai-tx-route = <3 1 2 0>;
142+
#sound-dai-cells = <0>;
143+
};
144+
};

MAINTAINERS

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20913,6 +20913,13 @@ F: Documentation/devicetree/bindings/sound/rockchip,rk3308-codec.yaml
2091320913
F: sound/soc/codecs/rk3308_codec.c
2091420914
F: sound/soc/codecs/rk3308_codec.h
2091520915

20916+
ROCKCHIP SAI DRIVER
20917+
M: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
20918+
L: linux-rockchip@lists.infradead.org
20919+
S: Maintained
20920+
F: Documentation/devicetree/bindings/sound/rockchip,rk3576-sai.yaml
20921+
F: sound/soc/rockchip/rockchip_sai.*
20922+
2091620923
ROCKCHIP VIDEO DECODER DRIVER
2091720924
M: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
2091820925
L: linux-media@vger.kernel.org

sound/soc/rockchip/Kconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,16 @@ config SND_SOC_ROCKCHIP_PDM
3737
Rockchip PDM Controller. The Controller supports up to maximum of
3838
8 channels record.
3939

40+
config SND_SOC_ROCKCHIP_SAI
41+
tristate "Rockchip SAI Controller Driver"
42+
depends on HAVE_CLK && SND_SOC_ROCKCHIP
43+
select SND_SOC_GENERIC_DMAENGINE_PCM
44+
help
45+
Say Y or M if you want to add support for the Rockchip Serial Audio
46+
Interface controller found on Rockchip SoCs such as the RK3576. The
47+
controller may support both playback and recording, with up to 4 lanes
48+
for each and up to 128 channels per lane in TDM mode.
49+
4050
config SND_SOC_ROCKCHIP_SPDIF
4151
tristate "Rockchip SPDIF Device Driver"
4252
depends on HAVE_CLK && SND_SOC_ROCKCHIP

sound/soc/rockchip/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33
snd-soc-rockchip-i2s-y := rockchip_i2s.o
44
snd-soc-rockchip-i2s-tdm-y := rockchip_i2s_tdm.o
55
snd-soc-rockchip-pdm-y := rockchip_pdm.o
6+
snd-soc-rockchip-sai-y := rockchip_sai.o
67
snd-soc-rockchip-spdif-y := rockchip_spdif.o
78

89
obj-$(CONFIG_SND_SOC_ROCKCHIP_I2S) += snd-soc-rockchip-i2s.o
910
obj-$(CONFIG_SND_SOC_ROCKCHIP_PDM) += snd-soc-rockchip-pdm.o
11+
obj-$(CONFIG_SND_SOC_ROCKCHIP_SAI) += snd-soc-rockchip-sai.o
1012
obj-$(CONFIG_SND_SOC_ROCKCHIP_SPDIF) += snd-soc-rockchip-spdif.o
1113
obj-$(CONFIG_SND_SOC_ROCKCHIP_I2S_TDM) += snd-soc-rockchip-i2s-tdm.o
1214

0 commit comments

Comments
 (0)