| 1 |
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) |
| 2 |
%YAML 1.2 |
| 3 |
--- |
| 4 |
$id: http://devicetree.org/schemas/sound/fsl,sai.yaml# |
| 5 |
$schema: http://devicetree.org/meta-schemas/core.yaml# |
| 6 |
|
| 7 |
title: Freescale Synchronous Audio Interface (SAI). |
| 8 |
|
| 9 |
maintainers: |
| 10 |
- Shengjiu Wang <[email protected]> |
| 11 |
|
| 12 |
description: | |
| 13 |
The SAI is based on I2S module that used communicating with audio codecs, |
| 14 |
which provides a synchronous audio interface that supports fullduplex |
| 15 |
serial interfaces with frame synchronization such as I2S, AC97, TDM, and |
| 16 |
codec/DSP interfaces. |
| 17 |
|
| 18 |
properties: |
| 19 |
compatible: |
| 20 |
oneOf: |
| 21 |
- items: |
| 22 |
- enum: |
| 23 |
- fsl,imx6ul-sai |
| 24 |
- fsl,imx7d-sai |
| 25 |
- const: fsl,imx6sx-sai |
| 26 |
|
| 27 |
- items: |
| 28 |
- enum: |
| 29 |
- fsl,imx8mm-sai |
| 30 |
- fsl,imx8mn-sai |
| 31 |
- fsl,imx8mp-sai |
| 32 |
- const: fsl,imx8mq-sai |
| 33 |
|
| 34 |
- items: |
| 35 |
- enum: |
| 36 |
- fsl,imx6sx-sai |
| 37 |
- fsl,imx7ulp-sai |
| 38 |
- fsl,imx8mq-sai |
| 39 |
- fsl,imx8qm-sai |
| 40 |
- fsl,imx8ulp-sai |
| 41 |
- fsl,imx93-sai |
| 42 |
- fsl,imx95-sai |
| 43 |
- fsl,vf610-sai |
| 44 |
- items: |
| 45 |
- enum: |
| 46 |
- fsl,imx94-sai |
| 47 |
- fsl,imx952-sai |
| 48 |
- const: fsl,imx95-sai |
| 49 |
|
| 50 |
reg: |
| 51 |
maxItems: 1 |
| 52 |
|
| 53 |
clocks: |
| 54 |
items: |
| 55 |
- description: The ipg clock for register access |
| 56 |
- description: master clock source 0 (obsoleted) |
| 57 |
- description: master clock source 1 |
| 58 |
- description: master clock source 2 |
| 59 |
- description: master clock source 3 |
| 60 |
- description: PLL clock source for 8kHz series |
| 61 |
- description: PLL clock source for 11kHz series |
| 62 |
minItems: 4 |
| 63 |
|
| 64 |
clock-names: |
| 65 |
oneOf: |
| 66 |
- items: |
| 67 |
- const: bus |
| 68 |
- const: mclk0 |
| 69 |
- const: mclk1 |
| 70 |
- const: mclk2 |
| 71 |
- const: mclk3 |
| 72 |
- const: pll8k |
| 73 |
- const: pll11k |
| 74 |
minItems: 5 |
| 75 |
- items: |
| 76 |
- const: bus |
| 77 |
- const: mclk1 |
| 78 |
- const: mclk2 |
| 79 |
- const: mclk3 |
| 80 |
- const: pll8k |
| 81 |
- const: pll11k |
| 82 |
minItems: 4 |
| 83 |
|
| 84 |
power-domains: |
| 85 |
maxItems: 1 |
| 86 |
|
| 87 |
dmas: |
| 88 |
minItems: 1 |
| 89 |
maxItems: 2 |
| 90 |
|
| 91 |
dma-names: |
| 92 |
minItems: 1 |
| 93 |
items: |
| 94 |
- enum: [ rx, tx ] |
| 95 |
- const: tx |
| 96 |
|
| 97 |
interrupts: |
| 98 |
items: |
| 99 |
- description: receive and transmit interrupt |
| 100 |
|
| 101 |
ports: |
| 102 |
$ref: /schemas/graph.yaml#/properties/ports |
| 103 |
properties: |
| 104 |
port@0: |
| 105 |
$ref: audio-graph-port.yaml# |
| 106 |
unevaluatedProperties: false |
| 107 |
description: port for TX and RX |
| 108 |
|
| 109 |
port@1: |
| 110 |
$ref: audio-graph-port.yaml# |
| 111 |
unevaluatedProperties: false |
| 112 |
description: port for TX only |
| 113 |
|
| 114 |
port@2: |
| 115 |
$ref: audio-graph-port.yaml# |
| 116 |
unevaluatedProperties: false |
| 117 |
description: port for RX only |
| 118 |
|
| 119 |
big-endian: |
| 120 |
description: | |
| 121 |
required if all the SAI registers are big-endian rather than little-endian. |
| 122 |
type: boolean |
| 123 |
|
| 124 |
fsl,dataline: |
| 125 |
$ref: /schemas/types.yaml#/definitions/uint32-matrix |
| 126 |
description: | |
| 127 |
Configure the dataline. It has 3 value for each configuration |
| 128 |
maxItems: 16 |
| 129 |
items: |
| 130 |
items: |
| 131 |
- description: format Default(0), I2S(1) or PDM(2) |
| 132 |
enum: [0, 1, 2] |
| 133 |
- description: dataline mask for 'rx' |
| 134 |
- description: dataline mask for 'tx' |
| 135 |
|
| 136 |
fsl,sai-amix-mode: |
| 137 |
$ref: /schemas/types.yaml#/definitions/string |
| 138 |
description: |
| 139 |
The audmix module is bypassed from hardware or not. |
| 140 |
enum: [none, bypass, audmix] |
| 141 |
default: none |
| 142 |
|
| 143 |
fsl,sai-mclk-direction-output: |
| 144 |
description: SAI will output the SAI MCLK clock. |
| 145 |
type: boolean |
| 146 |
|
| 147 |
fsl,sai-synchronous-rx: |
| 148 |
description: | |
| 149 |
SAI will work in the synchronous mode (sync Tx with Rx) which means |
| 150 |
both the transmitter and the receiver will send and receive data by |
| 151 |
following receiver's bit clocks and frame sync clocks. |
| 152 |
type: boolean |
| 153 |
|
| 154 |
fsl,sai-asynchronous: |
| 155 |
description: | |
| 156 |
SAI will work in the asynchronous mode, which means both transmitter |
| 157 |
and receiver will send and receive data by following their own bit clocks |
| 158 |
and frame sync clocks separately. |
| 159 |
If both fsl,sai-asynchronous and fsl,sai-synchronous-rx are absent, the |
| 160 |
default synchronous mode (sync Rx with Tx) will be used, which means both |
| 161 |
transmitter and receiver will send and receive data by following clocks |
| 162 |
of transmitter. |
| 163 |
type: boolean |
| 164 |
|
| 165 |
fsl,shared-interrupt: |
| 166 |
description: Interrupt is shared with other modules. |
| 167 |
type: boolean |
| 168 |
|
| 169 |
lsb-first: |
| 170 |
description: | |
| 171 |
Configures whether the LSB or the MSB is transmitted |
| 172 |
first for the fifo data. If this property is absent, |
| 173 |
the MSB is transmitted first as default, or the LSB |
| 174 |
is transmitted first. |
| 175 |
type: boolean |
| 176 |
|
| 177 |
"#sound-dai-cells": |
| 178 |
const: 0 |
| 179 |
description: optional, some dts node didn't add it. |
| 180 |
|
| 181 |
allOf: |
| 182 |
- $ref: dai-common.yaml# |
| 183 |
- if: |
| 184 |
required: |
| 185 |
- fsl,sai-asynchronous |
| 186 |
then: |
| 187 |
properties: |
| 188 |
fsl,sai-synchronous-rx: false |
| 189 |
|
| 190 |
- if: |
| 191 |
required: |
| 192 |
- fsl,sai-amix-mode |
| 193 |
then: |
| 194 |
properties: |
| 195 |
compatible: |
| 196 |
contains: |
| 197 |
const: fsl,imx952-sai |
| 198 |
|
| 199 |
required: |
| 200 |
- compatible |
| 201 |
- reg |
| 202 |
- clocks |
| 203 |
- clock-names |
| 204 |
- dmas |
| 205 |
- dma-names |
| 206 |
- interrupts |
| 207 |
|
| 208 |
unevaluatedProperties: false |
| 209 |
|
| 210 |
examples: |
| 211 |
- | |
| 212 |
#include <dt-bindings/interrupt-controller/arm-gic.h> |
| 213 |
#include <dt-bindings/clock/vf610-clock.h> |
| 214 |
sai2: sai@40031000 { |
| 215 |
compatible = "fsl,vf610-sai"; |
| 216 |
reg = <0x40031000 0x1000>; |
| 217 |
interrupts = <86 IRQ_TYPE_LEVEL_HIGH>; |
| 218 |
pinctrl-names = "default"; |
| 219 |
pinctrl-0 = <&pinctrl_sai2_1>; |
| 220 |
clocks = <&clks VF610_CLK_PLATFORM_BUS>, |
| 221 |
<&clks VF610_CLK_SAI2>, |
| 222 |
<&clks 0>, <&clks 0>; |
| 223 |
clock-names = "bus", "mclk1", "mclk2", "mclk3"; |
| 224 |
dma-names = "rx", "tx"; |
| 225 |
dmas = <&edma0 0 20>, <&edma0 0 21>; |
| 226 |
big-endian; |
| 227 |
lsb-first; |
| 228 |
}; |
| 229 |
|
| 230 |
- | |
| 231 |
#include <dt-bindings/interrupt-controller/arm-gic.h> |
| 232 |
#include <dt-bindings/clock/imx8mm-clock.h> |
| 233 |
sai1: sai@30010000 { |
| 234 |
compatible = "fsl,imx8mm-sai", "fsl,imx8mq-sai"; |
| 235 |
reg = <0x30010000 0x10000>; |
| 236 |
interrupts = <GIC_SPI 95 IRQ_TYPE_LEVEL_HIGH>; |
| 237 |
clocks = <&clk IMX8MM_CLK_SAI1_IPG>, |
| 238 |
<&clk IMX8MM_CLK_DUMMY>, |
| 239 |
<&clk IMX8MM_CLK_SAI1_ROOT>, |
| 240 |
<&clk IMX8MM_CLK_DUMMY>, <&clk IMX8MM_CLK_DUMMY>; |
| 241 |
clock-names = "bus", "mclk0", "mclk1", "mclk2", "mclk3"; |
| 242 |
dmas = <&sdma2 0 2 0>, <&sdma2 1 2 0>; |
| 243 |
dma-names = "rx", "tx"; |
| 244 |
fsl,dataline = <1 0xff 0xff 2 0xff 0x11>; |
| 245 |
#sound-dai-cells = <0>; |
| 246 |
|
| 247 |
ports { |
| 248 |
#address-cells = <1>; |
| 249 |
#size-cells = <0>; |
| 250 |
|
| 251 |
port@1 { |
| 252 |
reg = <1>; |
| 253 |
playback-only; |
| 254 |
|
| 255 |
sai1_endpoint0: endpoint { |
| 256 |
dai-tdm-slot-num = <8>; |
| 257 |
dai-tdm-slot-width = <32>; |
| 258 |
dai-tdm-slot-width-map = <32 8 32>; |
| 259 |
dai-format = "dsp_a"; |
| 260 |
bitclock-master; |
| 261 |
frame-master; |
| 262 |
remote-endpoint = <&mcodec01_ep>; |
| 263 |
}; |
| 264 |
}; |
| 265 |
|
| 266 |
port@2 { |
| 267 |
reg = <2>; |
| 268 |
capture-only; |
| 269 |
|
| 270 |
sai1_endpoint1: endpoint { |
| 271 |
dai-tdm-slot-num = <8>; |
| 272 |
dai-tdm-slot-width = <32>; |
| 273 |
dai-tdm-slot-width-map = <32 8 32>; |
| 274 |
dai-format = "dsp_a"; |
| 275 |
remote-endpoint = <&fe02_ep>; |
| 276 |
}; |
| 277 |
}; |
| 278 |
}; |
| 279 |
}; |