Skip to content

Commit 1a512d1

Browse files
committed
Add I2S support for the StarFive JH7110 SoC
Merge series from Xingyu Wu <xingyu.wu@starfivetech.com>: This patch series adds I2S support for the StarFive JH7110 RISC-V SoC based on Designware I2S controller. There has three I2S channels (RX/TX0/TX1) on the JH7110 SoC, one of which is for record(RX) and two for playback(TX). The first patch adds support for the StarFive JH7110 SoC in the Designware I2S bindings. The second patch adds the ops to get data from platform bus in the I2S driver. The third patch adds support for the StarFive JH7110 SoC in the Designware I2S driver. The fourth patch fixes the name of I2STX1 pinmux. The last patch adds device node of I2S RX/TX0/TX1 in JH7110 dts. This patch series is based on Linux-next(20230818) which is merge clock, syscon and dma nodes for the StarFive JH7110 SoC. The series has been tested and works normally on the VisionFive 2 board by plugging an audio expansion board.
2 parents fd53c16 + 52ea7c0 commit 1a512d1

File tree

4 files changed

+393
-25
lines changed

4 files changed

+393
-25
lines changed

Documentation/devicetree/bindings/sound/snps,designware-i2s.yaml

Lines changed: 105 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ properties:
1717
- const: snps,designware-i2s
1818
- enum:
1919
- snps,designware-i2s
20+
- starfive,jh7110-i2stx0
21+
- starfive,jh7110-i2stx1
22+
- starfive,jh7110-i2srx
2023

2124
reg:
2225
maxItems: 1
@@ -29,15 +32,36 @@ properties:
2932
maxItems: 1
3033

3134
clocks:
32-
description: Sampling rate reference clock
33-
maxItems: 1
35+
items:
36+
- description: Sampling rate reference clock
37+
- description: APB clock
38+
- description: Audio master clock
39+
- description: Inner audio master clock source
40+
- description: External audio master clock source
41+
- description: Bit clock
42+
- description: Left/right channel clock
43+
- description: External bit clock
44+
- description: External left/right channel clock
45+
minItems: 1
3446

3547
clock-names:
36-
const: i2sclk
48+
items:
49+
- const: i2sclk
50+
- const: apb
51+
- const: mclk
52+
- const: mclk_inner
53+
- const: mclk_ext
54+
- const: bclk
55+
- const: lrck
56+
- const: bclk_ext
57+
- const: lrck_ext
58+
minItems: 1
3759

3860
resets:
3961
items:
4062
- description: Optional controller resets
63+
- description: controller reset of Sampling rate
64+
minItems: 1
4165

4266
dmas:
4367
items:
@@ -51,6 +75,17 @@ properties:
5175
- const: rx
5276
minItems: 1
5377

78+
starfive,syscon:
79+
$ref: /schemas/types.yaml#/definitions/phandle-array
80+
items:
81+
- items:
82+
- description: phandle to System Register Controller sys_syscon node.
83+
- description: I2S-rx enabled control offset of SYS_SYSCONSAIF__SYSCFG register.
84+
- description: I2S-rx enabled control mask
85+
description:
86+
The phandle to System Register Controller syscon node and the I2S-rx(ADC)
87+
enabled control offset and mask of SYS_SYSCONSAIF__SYSCFG register.
88+
5489
allOf:
5590
- $ref: dai-common.yaml#
5691
- if:
@@ -66,6 +101,73 @@ allOf:
66101
properties:
67102
"#sound-dai-cells":
68103
const: 0
104+
- if:
105+
properties:
106+
compatible:
107+
contains:
108+
const: snps,designware-i2s
109+
then:
110+
properties:
111+
clocks:
112+
maxItems: 1
113+
clock-names:
114+
maxItems: 1
115+
resets:
116+
maxItems: 1
117+
else:
118+
properties:
119+
resets:
120+
minItems: 2
121+
maxItems: 2
122+
- if:
123+
properties:
124+
compatible:
125+
contains:
126+
const: starfive,jh7110-i2stx0
127+
then:
128+
properties:
129+
clocks:
130+
minItems: 5
131+
maxItems: 5
132+
clock-names:
133+
minItems: 5
134+
maxItems: 5
135+
required:
136+
- resets
137+
- if:
138+
properties:
139+
compatible:
140+
contains:
141+
const: starfive,jh7110-i2stx1
142+
then:
143+
properties:
144+
clocks:
145+
minItems: 9
146+
maxItems: 9
147+
clock-names:
148+
minItems: 9
149+
maxItems: 9
150+
required:
151+
- resets
152+
- if:
153+
properties:
154+
compatible:
155+
contains:
156+
const: starfive,jh7110-i2srx
157+
then:
158+
properties:
159+
clocks:
160+
minItems: 9
161+
maxItems: 9
162+
clock-names:
163+
minItems: 9
164+
maxItems: 9
165+
required:
166+
- resets
167+
- starfive,syscon
168+
else:
169+
properties:
170+
starfive,syscon: false
69171

70172
required:
71173
- compatible

include/sound/designware_i2s.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ struct i2s_clk_config_data {
2121
u32 sample_rate;
2222
};
2323

24+
struct dw_i2s_dev;
25+
2426
struct i2s_platform_data {
2527
#define DWC_I2S_PLAY (1 << 0)
2628
#define DWC_I2S_RECORD (1 << 1)
@@ -42,6 +44,7 @@ struct i2s_platform_data {
4244
void *capture_dma_data;
4345
bool (*filter)(struct dma_chan *chan, void *slave);
4446
int (*i2s_clk_cfg)(struct i2s_clk_config_data *config);
47+
int (*i2s_pd_init)(struct dw_i2s_dev *dev);
4548
};
4649

4750
struct i2s_dma_data {

0 commit comments

Comments
 (0)