Skip to content

Commit 21e2b96

Browse files
kettenisjannau
authored andcommitted
arm: dts: apple: Add Apple M2 device trees
Device trees for the M2 MacBook Air and the M2 13" MacBook Pro. Taken from the asahi branch of the Asahi Linux github repository. Signed-off-by: Mark Kettenis <[email protected]>
1 parent 44a3984 commit 21e2b96

9 files changed

Lines changed: 4302 additions & 1 deletion

File tree

arch/arm/dts/Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,11 @@ dtb-$(CONFIG_ARCH_APPLE) += \
4343
t8103-j293.dtb \
4444
t8103-j313.dtb \
4545
t8103-j456.dtb \
46-
t8103-j457.dtb
46+
t8103-j457.dtb \
47+
t8112-j413.dtb \
48+
t8112-j415.dtb \
49+
t8112-j473.dtb \
50+
t8112-j493.dtb
4751

4852
dtb-$(CONFIG_ARCH_DAVINCI) += \
4953
da850-lcdk.dtb \

arch/arm/dts/isp-imx558-cfg0.dtsi

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
// SPDX-License-Identifier: GPL-2.0+ OR MIT
2+
/*
3+
* ISP configuration for platforms with IMX558 sensor in
4+
* config #0 mode.
5+
*
6+
* These platforms enable MLVNR for all configs except
7+
* #0, which we don't support. Config #0 is an uncropped
8+
* square 1920x1920 sensor, with dark corners.
9+
* Therefore, we synthesize common resolutions by using
10+
* crop/scale while always choosing config #0.
11+
*
12+
* Copyright The Asahi Linux Contributors
13+
*/
14+
15+
#include "isp-common.dtsi"
16+
17+
&isp {
18+
apple,temporal-filter = <0>;
19+
20+
sensor-presets {
21+
/* 1920x1080 */
22+
preset0 {
23+
apple,config-index = <0>;
24+
apple,input-size = <1920 1920>;
25+
apple,output-size = <1920 1080>;
26+
apple,crop = <0 420 1920 1080>;
27+
};
28+
/* 1080x1920 */
29+
preset1 {
30+
apple,config-index = <0>;
31+
apple,input-size = <1920 1920>;
32+
apple,output-size = <1080 1920>;
33+
apple,crop = <420 0 1080 1920>;
34+
};
35+
/* 1920x1440 */
36+
preset2 {
37+
apple,config-index = <0>;
38+
apple,input-size = <1920 1920>;
39+
apple,output-size = <1920 1440>;
40+
apple,crop = <0 240 1920 1440>;
41+
};
42+
/* 1440x1920 */
43+
preset3 {
44+
apple,config-index = <0>;
45+
apple,input-size = <1920 1920>;
46+
apple,output-size = <1440 1920>;
47+
apple,crop = <240 0 1440 1920>;
48+
};
49+
/* 1280x720 */
50+
preset4 {
51+
apple,config-index = <0>;
52+
apple,input-size = <1920 1920>;
53+
apple,output-size = <1280 720>;
54+
apple,crop = <0 420 1920 1080>;
55+
};
56+
/* 720x1280 */
57+
preset5 {
58+
apple,config-index = <0>;
59+
apple,input-size = <1920 1920>;
60+
apple,output-size = <720 1280>;
61+
apple,crop = <420 0 1080 1920>;
62+
};
63+
/* 1280x960 */
64+
preset6 {
65+
apple,config-index = <0>;
66+
apple,input-size = <1920 1920>;
67+
apple,output-size = <1280 960>;
68+
apple,crop = <0 240 1920 1440>;
69+
};
70+
/* 960x1280 */
71+
preset7 {
72+
apple,config-index = <0>;
73+
apple,input-size = <1920 1920>;
74+
apple,output-size = <960 1280>;
75+
apple,crop = <240 0 1440 1920>;
76+
};
77+
/* 640x480 */
78+
preset8 {
79+
apple,config-index = <0>;
80+
apple,input-size = <1920 1920>;
81+
apple,output-size = <640 480>;
82+
apple,crop = <0 240 1920 1440>;
83+
};
84+
/* 480x640 */
85+
preset9 {
86+
apple,config-index = <0>;
87+
apple,input-size = <1920 1920>;
88+
apple,output-size = <480 640>;
89+
apple,crop = <240 0 1440 1920>;
90+
};
91+
};
92+
};

arch/arm/dts/t8112-j413.dts

Lines changed: 245 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,245 @@
1+
// SPDX-License-Identifier: GPL-2.0+ OR MIT
2+
/*
3+
* Apple MacBook Air (M2, 2022)
4+
*
5+
* target-type: J413
6+
*
7+
* Copyright The Asahi Linux Contributors
8+
*/
9+
10+
/dts-v1/;
11+
12+
#include "t8112.dtsi"
13+
#include "t8112-jxxx.dtsi"
14+
#include <dt-bindings/leds/common.h>
15+
16+
/ {
17+
compatible = "apple,j413", "apple,t8112", "apple,arm-platform";
18+
model = "Apple MacBook Air (13-inch, M2, 2022)";
19+
20+
aliases {
21+
bluetooth0 = &bluetooth0;
22+
wifi0 = &wifi0;
23+
keyboard = &keyboard;
24+
};
25+
26+
led-controller {
27+
compatible = "pwm-leds";
28+
led-0 {
29+
pwms = <&fpwm1 0 40000>;
30+
label = "kbd_backlight";
31+
function = LED_FUNCTION_KBD_BACKLIGHT;
32+
color = <LED_COLOR_ID_WHITE>;
33+
max-brightness = <255>;
34+
default-state = "keep";
35+
};
36+
};
37+
};
38+
39+
&dcp {
40+
panel: panel {
41+
compatible = "apple,panel-j413", "apple,panel";
42+
width-mm = <290>;
43+
height-mm = <189>;
44+
adj-height-mm = <181>;
45+
apple,max-brightness = <525>;
46+
};
47+
};
48+
49+
/*
50+
* Force the bus number assignments so that we can declare some of the
51+
* on-board devices and properties that are populated by the bootloader
52+
* (such as MAC addresses).
53+
*/
54+
&port00 {
55+
bus-range = <1 1>;
56+
pwren-gpios = <&smc_gpio 13 GPIO_ACTIVE_HIGH>;
57+
wifi0: wifi@0,0 {
58+
compatible = "pci14e4,4433";
59+
reg = <0x10000 0x0 0x0 0x0 0x0>;
60+
/* To be filled by the loader */
61+
local-mac-address = [00 10 18 00 00 10];
62+
apple,antenna-sku = "XX";
63+
brcm,board-type = "apple,hokkaido";
64+
};
65+
66+
bluetooth0: bluetooth@0,1 {
67+
compatible = "pci14e4,5f71";
68+
reg = <0x10100 0x0 0x0 0x0 0x0>;
69+
/* To be filled by the loader */
70+
local-bd-address = [00 00 00 00 00 00];
71+
brcm,board-type = "apple,hokkaido";
72+
};
73+
};
74+
75+
/*
76+
* Provide labels for the USB type C ports.
77+
*/
78+
79+
&typec0 {
80+
label = "USB-C Left-back";
81+
};
82+
83+
&typec1 {
84+
label = "USB-C Left-front";
85+
};
86+
87+
&i2c0 {
88+
/* MagSafe port */
89+
hpm5: usb-pd@3a {
90+
compatible = "apple,cd321x";
91+
reg = <0x3a>;
92+
interrupt-parent = <&pinctrl_ap>;
93+
interrupts = <8 IRQ_TYPE_LEVEL_LOW>;
94+
interrupt-names = "irq";
95+
};
96+
};
97+
98+
/* Virtual regulator representing the shared shutdown GPIO */
99+
/ {
100+
speaker_sdz: fixed-regulator-sn012776-sdz {
101+
compatible = "regulator-fixed";
102+
regulator-name = "sn012776-sdz";
103+
startup-delay-us = <5000>;
104+
gpios = <&pinctrl_ap 88 GPIO_ACTIVE_HIGH>;
105+
enable-active-high;
106+
};
107+
};
108+
109+
&i2c1 {
110+
speaker_left_woof: codec@38 {
111+
compatible = "ti,sn012776", "ti,tas2764";
112+
reg = <0x38>;
113+
SDZ-supply = <&speaker_sdz>;
114+
#sound-dai-cells = <0>;
115+
sound-name-prefix = "Left Woofer";
116+
interrupts-extended = <&pinctrl_ap 11 IRQ_TYPE_LEVEL_LOW>;
117+
ti,imon-slot-no = <0>;
118+
ti,vmon-slot-no = <2>;
119+
ti,sdout-force-zero-mask = <0xf0f0>;
120+
};
121+
122+
speaker_left_tweet: codec@39 {
123+
compatible = "ti,sn012776", "ti,tas2764";
124+
reg = <0x39>;
125+
SDZ-supply = <&speaker_sdz>;
126+
#sound-dai-cells = <0>;
127+
sound-name-prefix = "Left Tweeter";
128+
interrupts-extended = <&pinctrl_ap 11 IRQ_TYPE_LEVEL_LOW>;
129+
ti,imon-slot-no = <8>;
130+
ti,vmon-slot-no = <10>;
131+
};
132+
};
133+
134+
&i2c3 {
135+
speaker_right_woof: codec@3b {
136+
compatible = "ti,sn012776", "ti,tas2764";
137+
reg = <0x3b>;
138+
SDZ-supply = <&speaker_sdz>;
139+
#sound-dai-cells = <0>;
140+
sound-name-prefix = "Right Woofer";
141+
interrupts-extended = <&pinctrl_ap 11 IRQ_TYPE_LEVEL_LOW>;
142+
ti,imon-slot-no = <4>;
143+
ti,vmon-slot-no = <6>;
144+
ti,sdout-force-zero-mask = <0x0f0f>;
145+
};
146+
147+
speaker_right_tweet: codec@3c {
148+
compatible = "ti,sn012776", "ti,tas2764";
149+
reg = <0x3c>;
150+
SDZ-supply = <&speaker_sdz>;
151+
#sound-dai-cells = <0>;
152+
sound-name-prefix = "Right Tweeter";
153+
interrupts-extended = <&pinctrl_ap 11 IRQ_TYPE_LEVEL_LOW>;
154+
ti,imon-slot-no = <12>;
155+
ti,vmon-slot-no = <14>;
156+
};
157+
158+
jack_codec: codec@4b {
159+
compatible = "cirrus,cs42l84";
160+
reg = <0x4b>;
161+
reset-gpios = <&pinctrl_nub 12 GPIO_ACTIVE_HIGH>;
162+
#sound-dai-cells = <0>;
163+
interrupts-extended = <&pinctrl_ap 149 IRQ_TYPE_LEVEL_LOW>;
164+
sound-name-prefix = "Jack";
165+
};
166+
};
167+
168+
&i2c4 {
169+
status = "okay";
170+
};
171+
172+
&fpwm1 {
173+
status = "okay";
174+
};
175+
176+
/ {
177+
sound {
178+
compatible = "apple,j413-macaudio", "apple,macaudio";
179+
model = "MacBook Air J413";
180+
181+
dai-link@0 {
182+
link-name = "Speakers";
183+
184+
cpu {
185+
sound-dai = <&mca 0>, <&mca 1>;
186+
};
187+
codec {
188+
sound-dai = <&speaker_left_woof>, <&speaker_left_tweet>,
189+
<&speaker_right_woof>, <&speaker_right_tweet>;
190+
};
191+
};
192+
193+
dai-link@1 {
194+
link-name = "Headphone Jack";
195+
196+
cpu {
197+
sound-dai = <&mca 2>;
198+
};
199+
codec {
200+
sound-dai = <&jack_codec>;
201+
};
202+
};
203+
};
204+
};
205+
206+
&mtp {
207+
status = "okay";
208+
};
209+
&mtp_mbox {
210+
status = "okay";
211+
};
212+
&mtp_dart {
213+
status = "okay";
214+
};
215+
&mtp_dockchannel {
216+
status = "okay";
217+
};
218+
&mtp_hid {
219+
multi-touch {
220+
apple,afe-reset-gpios = <&smc_gpio 8 GPIO_ACTIVE_LOW>;
221+
firmware-name = "apple/tpmtfw-j413.bin";
222+
};
223+
224+
keyboard: keyboard {
225+
hid-country-code = <0>;
226+
apple,keyboard-layout-id = <0>;
227+
};
228+
229+
stm {
230+
apple,stm-reset-gpios = <&smc_gpio 24 GPIO_ACTIVE_LOW>;
231+
};
232+
233+
actuator {
234+
};
235+
236+
tp_accel {
237+
};
238+
};
239+
240+
#include "isp-imx558-cfg0.dtsi"
241+
242+
&isp {
243+
apple,platform-id = <14>;
244+
apple,temporal-filter = <1>;
245+
};

0 commit comments

Comments
 (0)