Skip to content

Commit 6f0fce2

Browse files
committed
ASoC: ti: davinci-mcasp: Add asynchronous mode
Merge series from Sen Wang <sen@ti.com>: This series adds asynchronous mode support to the McASP driver, which enables independent configuration of bitclocks, frame sync, and audio configurations between tx(playback) and rx(record). And achieves simultaneous playback & record using different audio configurations. It also adds two clean up patches to the McASP driver that disambiguate and simplifies the logic which avoids the async enhancement from being too convoluted to review and analyze. The implementation is based on vendor documentation and patches tested in both SK-AM62P-LP (sync mode, McASP slave) and AM62D-EVM (async mode, McASP master, rx & tx has different TDM configs). Testing verifies async mode functionality while maintaining backward compatibility with the default sync mode. Bootlog and Async mode tests on AM62D-EVM: [0] [0]: https://gist.github.com/SenWang125/f31f9172b186d414695e37c8b9ef127d
2 parents 7c2280e + 9db3270 commit 6f0fce2

4 files changed

Lines changed: 481 additions & 113 deletions

File tree

Documentation/devicetree/bindings/sound/davinci-mcasp-audio.yaml

Lines changed: 66 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,33 @@ properties:
4040
tdm-slots:
4141
$ref: /schemas/types.yaml#/definitions/uint32
4242
description:
43-
number of channels over one serializer
44-
the property is ignored in DIT mode
43+
Number of channels over one serializer. This property
44+
specifies the TX playback TDM slot count, along with default RX slot count
45+
if tdm-slots-rx is not specified.
46+
The property is ignored in DIT mode.
4547
minimum: 2
4648
maximum: 32
4749

50+
tdm-slots-rx:
51+
$ref: /schemas/types.yaml#/definitions/uint32
52+
description:
53+
Number of RX capture channels over one serializer. If specified,
54+
allows independent RX TDM slot count separate from TX. Requires
55+
ti,async-mode to be enabled for independent TX/RX clock rates.
56+
The property is ignored in DIT mode.
57+
minimum: 2
58+
maximum: 32
59+
60+
ti,async-mode:
61+
description:
62+
Specify to allow independent TX & RX clocking,
63+
to enable audio playback & record with different sampling rate,
64+
and different number of bits per frame.
65+
if property is omitted, TX and RX will share same bit clock and frame clock signals,
66+
thus RX need to use same bits per frame and sampling rate as TX in synchronous mode.
67+
the property is ignored in DIT mode (as DIT is TX-only)
68+
type: boolean
69+
4870
serial-dir:
4971
description:
5072
A list of serializer configuration
@@ -125,7 +147,21 @@ properties:
125147

126148
auxclk-fs-ratio:
127149
$ref: /schemas/types.yaml#/definitions/uint32
128-
description: ratio of AUCLK and FS rate if applicable
150+
description:
151+
Ratio of AUCLK and FS rate if applicable. This property specifies
152+
the TX ratio, along with default RX ratio if auxclk-fs-ratio-rx
153+
is not specified.
154+
When not specified, the inputted system clock frequency via set_sysclk
155+
callback by the machine driver is used for divider calculation.
156+
157+
auxclk-fs-ratio-rx:
158+
$ref: /schemas/types.yaml#/definitions/uint32
159+
description:
160+
Ratio of AUCLK and FS rate for RX. If specified, allows
161+
for a different RX ratio. Requires ti,async-mode to be
162+
enabled when the ratio differs from auxclk-fs-ratio.
163+
When not specified, it defaults to the value of auxclk-fs-ratio.
164+
The property is ignored in DIT mode.
129165

130166
gpio-controller: true
131167

@@ -170,14 +206,38 @@ allOf:
170206
- $ref: dai-common.yaml#
171207
- if:
172208
properties:
173-
opmode:
209+
op-mode:
174210
enum:
175211
- 0
176-
177212
then:
178213
required:
179214
- tdm-slots
180215

216+
- if:
217+
properties:
218+
op-mode:
219+
const: 1
220+
then:
221+
properties:
222+
tdm-slots: false
223+
tdm-slots-rx: false
224+
ti,async-mode: false
225+
auxclk-fs-ratio-rx: false
226+
227+
- if:
228+
required:
229+
- tdm-slots-rx
230+
then:
231+
required:
232+
- ti,async-mode
233+
234+
- if:
235+
required:
236+
- auxclk-fs-ratio-rx
237+
then:
238+
required:
239+
- ti,async-mode
240+
181241
unevaluatedProperties: false
182242

183243
examples:
@@ -190,6 +250,7 @@ examples:
190250
interrupt-names = "tx", "rx";
191251
op-mode = <0>; /* MCASP_IIS_MODE */
192252
tdm-slots = <2>;
253+
ti,async-mode;
193254
dmas = <&main_udmap 0xc400>, <&main_udmap 0x4400>;
194255
dma-names = "tx", "rx";
195256
serial-dir = <

include/linux/platform_data/davinci_asp.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ struct davinci_mcasp_pdata {
5959
bool i2s_accurate_sck;
6060

6161
/* McASP specific fields */
62-
int tdm_slots;
62+
int tdm_slots_tx;
63+
int tdm_slots_rx;
6364
u8 op_mode;
6465
u8 dismod;
6566
u8 num_serializer;

0 commit comments

Comments
 (0)