Skip to content

Commit 2e67021

Browse files
committed
Merge branch 'refs/heads/bits/070-audio' into asahi-wip
2 parents a5f8920 + a83cba6 commit 2e67021

20 files changed

Lines changed: 3057 additions & 71 deletions

File tree

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/sound/apple,macaudio.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: Apple Silicon Macs integrated sound peripherals
8+
9+
description:
10+
This binding represents the overall machine-level integration of sound
11+
peripherals on 'Apple Silicon' machines by Apple.
12+
13+
maintainers:
14+
- Martin Povišer <[email protected]>
15+
16+
properties:
17+
compatible:
18+
items:
19+
- enum:
20+
- apple,j274-macaudio
21+
- apple,j293-macaudio
22+
- apple,j314-macaudio
23+
- const: apple,macaudio
24+
25+
"#address-cells":
26+
const: 1
27+
28+
"#size-cells":
29+
const: 0
30+
31+
model:
32+
description:
33+
Model name for presentation to users
34+
$ref: /schemas/types.yaml#/definitions/string
35+
36+
patternProperties:
37+
"^dai-link(@[0-9a-f]+)?$":
38+
description: |
39+
Node for each sound peripheral such as the speaker array, headphones jack,
40+
or microphone.
41+
type: object
42+
43+
additionalProperties: false
44+
45+
properties:
46+
reg:
47+
maxItems: 1
48+
49+
link-name:
50+
description: |
51+
Name for the peripheral, expecting 'Speaker' or 'Speakers' if this is
52+
the speaker array.
53+
$ref: /schemas/types.yaml#/definitions/string
54+
55+
cpu:
56+
type: object
57+
58+
properties:
59+
sound-dai:
60+
description: |
61+
DAI list with CPU-side I2S ports involved in this peripheral.
62+
minItems: 1
63+
maxItems: 2
64+
65+
required:
66+
- sound-dai
67+
68+
codec:
69+
type: object
70+
71+
properties:
72+
sound-dai:
73+
minItems: 1
74+
maxItems: 8
75+
description: |
76+
DAI list with the CODEC-side DAIs connected to the above CPU-side
77+
DAIs and involved in this sound peripheral.
78+
79+
The list is in left/right order if applicable. If there are more
80+
than one CPU-side DAIs (there can be two), the CODECs must be
81+
listed first those connected to the first CPU, then those
82+
connected to the second.
83+
84+
In addition, on some machines with many speaker codecs, the CODECs
85+
are listed in this fixed order:
86+
87+
J293: Left Front, Left Rear, Right Front, Right Rear
88+
J314: Left Woofer 1, Left Tweeter, Left Woofer 2,
89+
Right Woofer 1, Right Tweeter, Right Woofer 2
90+
91+
required:
92+
- sound-dai
93+
94+
required:
95+
- reg
96+
- cpu
97+
- codec
98+
99+
required:
100+
- compatible
101+
- model
102+
103+
additionalProperties: false
104+
105+
examples:
106+
- |
107+
mca: mca@9b600000 {
108+
compatible = "apple,t6000-mca", "apple,mca";
109+
reg = <0x9b600000 0x10000>,
110+
<0x9b500000 0x20000>;
111+
112+
clocks = <&nco 0>, <&nco 1>, <&nco 2>, <&nco 3>;
113+
power-domains = <&ps_audio_p>, <&ps_mca0>, <&ps_mca1>,
114+
<&ps_mca2>, <&ps_mca3>;
115+
dmas = <&admac 0>, <&admac 1>, <&admac 2>, <&admac 3>,
116+
<&admac 4>, <&admac 5>, <&admac 6>, <&admac 7>,
117+
<&admac 8>, <&admac 9>, <&admac 10>, <&admac 11>,
118+
<&admac 12>, <&admac 13>, <&admac 14>, <&admac 15>;
119+
dma-names = "tx0a", "rx0a", "tx0b", "rx0b",
120+
"tx1a", "rx1a", "tx1b", "rx1b",
121+
"tx2a", "rx2a", "tx2b", "rx2b",
122+
"tx3a", "rx3a", "tx3b", "rx3b";
123+
124+
#sound-dai-cells = <1>;
125+
};
126+
127+
sound {
128+
compatible = "apple,j314-macaudio", "apple,macaudio";
129+
model = "MacBook Pro J314 integrated audio";
130+
131+
#address-cells = <1>;
132+
#size-cells = <0>;
133+
134+
dai-link@0 {
135+
reg = <0>;
136+
link-name = "Speakers";
137+
138+
cpu {
139+
sound-dai = <&mca 0>, <&mca 1>;
140+
};
141+
codec {
142+
sound-dai = <&speaker_left_woof1>,
143+
<&speaker_left_tweet>,
144+
<&speaker_left_woof2>,
145+
<&speaker_right_woof1>,
146+
<&speaker_right_tweet>,
147+
<&speaker_right_woof2>;
148+
};
149+
};
150+
151+
dai-link@1 {
152+
reg = <1>;
153+
link-name = "Headphones Jack";
154+
155+
cpu {
156+
sound-dai = <&mca 2>;
157+
};
158+
codec {
159+
sound-dai = <&jack_codec>;
160+
};
161+
};
162+
};

include/sound/cs42l42.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@
6262
#define CS42L42_INTERNAL_FS_MASK (1 << CS42L42_INTERNAL_FS_SHIFT)
6363

6464
#define CS42L42_SFTRAMP_RATE (CS42L42_PAGE_10 + 0x0A)
65+
#define CS42L42_SFTRAMP_ASR_RATE_MASK GENMASK(7, 4)
66+
#define CS42L42_SFTRAMP_ASR_RATE_SHIFT 4
67+
#define CS42L42_SFTRAMP_DSR_RATE_MASK GENMASK(3, 0)
68+
#define CS42L42_SFTRAMP_DSR_RATE_SHIFT 0
6569
#define CS42L42_SLOW_START_ENABLE (CS42L42_PAGE_10 + 0x0B)
6670
#define CS42L42_SLOW_START_EN_MASK GENMASK(6, 4)
6771
#define CS42L42_SLOW_START_EN_SHIFT 4

include/sound/soc-card.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ int snd_soc_card_resume_post(struct snd_soc_card *card);
2929

3030
int snd_soc_card_probe(struct snd_soc_card *card);
3131
int snd_soc_card_late_probe(struct snd_soc_card *card);
32-
void snd_soc_card_fixup_controls(struct snd_soc_card *card);
32+
int snd_soc_card_fixup_controls(struct snd_soc_card *card);
3333
int snd_soc_card_remove(struct snd_soc_card *card);
3434

3535
int snd_soc_card_set_bias_level(struct snd_soc_card *card,

include/sound/soc.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,10 @@ int snd_soc_get_volsw_range(struct snd_kcontrol *kcontrol,
586586
struct snd_ctl_elem_value *ucontrol);
587587
int snd_soc_limit_volume(struct snd_soc_card *card,
588588
const char *name, int max);
589+
int snd_soc_deactivate_kctl(struct snd_soc_card *card,
590+
const char *name, int active);
591+
int snd_soc_set_enum_kctl(struct snd_soc_card *card,
592+
const char *name, const char *strval);
589593
int snd_soc_bytes_info(struct snd_kcontrol *kcontrol,
590594
struct snd_ctl_elem_info *uinfo);
591595
int snd_soc_bytes_get(struct snd_kcontrol *kcontrol,
@@ -926,7 +930,7 @@ struct snd_soc_card {
926930

927931
int (*probe)(struct snd_soc_card *card);
928932
int (*late_probe)(struct snd_soc_card *card);
929-
void (*fixup_controls)(struct snd_soc_card *card);
933+
int (*fixup_controls)(struct snd_soc_card *card);
930934
int (*remove)(struct snd_soc_card *card);
931935

932936
/* the pre and post PM functions are used to do any PM work before and

sound/soc/apple/Kconfig

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,20 @@ config SND_SOC_APPLE_MCA
66
help
77
This option enables an ASoC platform driver for MCA peripherals found
88
on Apple Silicon SoCs.
9+
10+
config SND_SOC_APPLE_MACAUDIO
11+
tristate "Sound support for Apple Silicon Macs"
12+
depends on ARCH_APPLE || COMPILE_TEST
13+
select SND_SOC_APPLE_MCA
14+
select SND_SIMPLE_CARD_UTILS
15+
select APPLE_ADMAC
16+
select COMMON_CLK_APPLE_NCO
17+
select SND_SOC_TAS2764
18+
select SND_SOC_TAS2770
19+
select SND_SOC_CS42L83
20+
select SND_SOC_CS42L84
21+
default ARCH_APPLE
22+
help
23+
This option enables an ASoC machine-level driver for Apple Silicon Macs
24+
and it also enables the required SoC and codec drivers for overall
25+
sound support on these machines.

sound/soc/apple/Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
snd-soc-apple-mca-objs := mca.o
22

33
obj-$(CONFIG_SND_SOC_APPLE_MCA) += snd-soc-apple-mca.o
4+
5+
snd-soc-macaudio-objs := macaudio.o
6+
7+
obj-$(CONFIG_SND_SOC_APPLE_MACAUDIO) += snd-soc-macaudio.o

0 commit comments

Comments
 (0)