diff --git a/arch/arm64/boot/dts/apple/t6050-j714c.dts b/arch/arm64/boot/dts/apple/t6050-j714c.dts index f6da08c085819..131a783fd5124 100644 --- a/arch/arm64/boot/dts/apple/t6050-j714c.dts +++ b/arch/arm64/boot/dts/apple/t6050-j714c.dts @@ -390,6 +390,8 @@ #include "t6050-max-atc2.dtsi" +#include "t6050-magsafe.dtsi" + /* The I2C power states have no described parent (SIO), as for i2c1 and i2c2 */ &ps_i2c3 { /delete-property/ power-domains; diff --git a/arch/arm64/boot/dts/apple/t6050-j714s.dts b/arch/arm64/boot/dts/apple/t6050-j714s.dts index 7f8f6313c77c3..730524ab0da70 100644 --- a/arch/arm64/boot/dts/apple/t6050-j714s.dts +++ b/arch/arm64/boot/dts/apple/t6050-j714s.dts @@ -212,30 +212,14 @@ status = "okay"; }; -/* The keyboard backlight: ADT pwm0/kbd-backlight, channel 0 at 25 kHz */ / { aliases { /* The loader fills the keyboard layout from the ADT's keyboard node */ keyboard = &keyboard; }; - - led-controller { - compatible = "pwm-leds"; - - led-0 { - pwms = <&fpwm0 0 40000>; - label = "kbd_backlight"; - function = LED_FUNCTION_KBD_BACKLIGHT; - color = ; - max-brightness = <255>; - default-state = "keep"; - }; - }; }; -&fpwm0 { - status = "okay"; -}; +#include "t6050-kbd-backlight.dtsi" /* The MTP and its DockChannel FIFO, which carry the keyboard and trackpad */ &mtp_mbox { @@ -374,20 +358,10 @@ }; }; }; - - /* - * The MagSafe 3 port's PD controller (ADT hpm5, port-type 0x11). It has no USB data - * path, so it gets no connector node; tipd registers a Type-C port and a power supply - * for it, as on J616s. Its ADT features-supported is <3>, "Power In" only: no liquid - * detection (LDCM, feature 2 of the USB-C ports' <1 2 3>). - */ - hpm5: usb-pd@8 { - compatible = "apple,sn201202x"; - reg = <0x8 SPMI_USID>; - apple,no-liquid-detection; - }; }; +#include "t6050-magsafe.dtsi" + &usb_drd1 { port { usb_drd1_hs: endpoint { diff --git a/arch/arm64/boot/dts/apple/t6050-j716c-sleep.dtsi b/arch/arm64/boot/dts/apple/t6050-j716c-sleep.dtsi index d575939cb6c45..5f52ec84bcab1 100644 --- a/arch/arm64/boot/dts/apple/t6050-j716c-sleep.dtsi +++ b/arch/arm64/boot/dts/apple/t6050-j716c-sleep.dtsi @@ -117,14 +117,12 @@ }; }; -/* MagSafe's controller is separate from all three USB-C data ports. */ -&nub_spmi_a0 { - hpm5: usb-pd@8 { - compatible = "apple,sn201202x"; - reg = <0x8 SPMI_USID>; - apple,no-liquid-detection; - status = "disabled"; - }; +/* + * MagSafe's PD controller (t6050-magsafe.dtsi) is separate from all three USB-C data ports. + * It stays off until t6050-j716c-sleep-devices.dtsi enables it with the sleep. + */ +&hpm5 { + status = "disabled"; }; /* Split the two ASC mailboxes from their coprocessor banks for later use. */ diff --git a/arch/arm64/boot/dts/apple/t6050-j716c.dts b/arch/arm64/boot/dts/apple/t6050-j716c.dts index a097951f39afd..ade6627e37f61 100644 --- a/arch/arm64/boot/dts/apple/t6050-j716c.dts +++ b/arch/arm64/boot/dts/apple/t6050-j716c.dts @@ -59,6 +59,8 @@ }; }; +#include "t6050-kbd-backlight.dtsi" + /* * The shared T6050 inventory sits in die 0's soc node on this board (the unit-less /soc * is not created here), so die 0's bus also needs the die's second MMIO window, which @@ -320,6 +322,7 @@ #include "t6050-j716c-display.dtsi" #include "t6050-j716c-left-usb4.dtsi" +#include "t6050-magsafe.dtsi" #include "t6050-j716c-sleep.dtsi" #include "t6050-j716c-sleep-full.dtsi" diff --git a/arch/arm64/boot/dts/apple/t6050-j716s.dts b/arch/arm64/boot/dts/apple/t6050-j716s.dts index 1db9d021fae9c..b33287de1b3dc 100644 --- a/arch/arm64/boot/dts/apple/t6050-j716s.dts +++ b/arch/arm64/boot/dts/apple/t6050-j716s.dts @@ -48,26 +48,9 @@ status = "disabled"; }; }; - - /* Keyboard backlight: ADT pwm0/kbd-backlight, channel 0 at 25 kHz */ - led-controller { - compatible = "pwm-leds"; - - led-0 { - pwms = <&fpwm0 0 40000>; - label = "kbd_backlight"; - function = LED_FUNCTION_KBD_BACKLIGHT; - color = ; - max-brightness = <255>; - default-state = "keep"; - }; - }; }; -/* The keyboard backlight PWM (ADT pwm0) */ -&fpwm0 { - status = "okay"; -}; +#include "t6050-kbd-backlight.dtsi" /* A block t6050-die0.dtsi does not describe yet: the third HPM bus */ &die0 { @@ -282,7 +265,7 @@ * ATC0 usb-drd0 left-back hpm0 nub-spmi-a0 0x0c (the debug port; t6050-atc0-enable.dtsi, end of file) * ATC1 usb-drd1 left-front hpm1 nub-spmi-a0 0x0a * ATC2 usb-drd2 right hpm2 nub-spmi-a1 0x0c - * MagSafe hpm5 nub-spmi-a0 0x08 (not a USB-C connector) + * MagSafe hpm5 nub-spmi-a0 0x08 (t6050-magsafe.dtsi, no connector node) * There is no usb-drd3 and no nub-spmi-a2, so ATC3's USB chain and that bus * stay off. */ @@ -348,6 +331,8 @@ }; }; +#include "t6050-magsafe.dtsi" + &usb_drd1 { port { usb_drd1_hs: endpoint { diff --git a/arch/arm64/boot/dts/apple/t6050-j775-hwmon.dtsi b/arch/arm64/boot/dts/apple/t6050-j775-hwmon.dtsi new file mode 100644 index 0000000000000..1c81a3f3482b3 --- /dev/null +++ b/arch/arm64/boot/dts/apple/t6050-j775-hwmon.dtsi @@ -0,0 +1,38 @@ +// SPDX-License-Identifier: GPL-2.0+ OR MIT +/* + * SMC hwmon keys of the T6050 Mac Studio: the DC input power and the two fans. + * The J775d includes this file; the J775c's board tree carries the same keys + * itself. + * + * Copyright The Asahi Linux Contributors + */ + +/* + * The Studio's DC input. PSTR and PDTR read 0 on the Studio; PD0R is its DC input (36.5 W at an + * idle desktop). + */ +&smc_hwmon { + power-PD0R { + apple,key-id = "PD0R"; + label = "DC Input Power"; + }; +}; + +#include "hwmon-fan-dual.dtsi" + +/* + * The Studio's SMC has F0Ac/F0Mn/F0Mx/F0Tg and F1*, but its mode keys are F0md/F1md (ui8, flags 0xd0: + * readable, writable, a function key), not the F0Md/F1Md the dtsi names. With the dtsi's names + * each fan loses its mode key, and with it kernel control. With the real keys the fans can be set by the kernel's + * thermal policy (the M5 GPU governor, through macsmc_hwmon_fans_request()). No + * apple,fan-manual-control: userspace still only reads them. + */ +&smc_hwmon { + fan-F0Ac { + apple,fan-mode = "F0md"; + }; + + fan-F1Ac { + apple,fan-mode = "F1md"; + }; +}; diff --git a/arch/arm64/boot/dts/apple/t6050-j775d.dts b/arch/arm64/boot/dts/apple/t6050-j775d.dts index d39396b6e0290..995b0a3b3ee81 100644 --- a/arch/arm64/boot/dts/apple/t6050-j775d.dts +++ b/arch/arm64/boot/dts/apple/t6050-j775d.dts @@ -228,35 +228,7 @@ status = "okay"; }; -/* - * The Studio's DC input. PSTR and PDTR read 0 on the Studio; PD0R is its DC input (36.5 W at an - * idle desktop). - */ -&smc_hwmon { - power-PD0R { - apple,key-id = "PD0R"; - label = "DC Input Power"; - }; -}; - -#include "hwmon-fan-dual.dtsi" - -/* - * The Studio's SMC has F0Ac/F0Mn/F0Mx/F0Tg and F1*, but its mode keys are F0md/F1md (ui8, flags 0xd0: - * readable, writable, a function key), not the F0Md/F1Md the dtsi names; with the dtsi's names fan - * creation failed on the missing key. With the real keys the fans can be set by the kernel's - * thermal policy (the M5 GPU governor, through macsmc_hwmon_fans_request()). No - * apple,fan-manual-control: userspace still only reads them. - */ -&smc_hwmon { - fan-F0Ac { - apple,fan-mode = "F0md"; - }; - - fan-F1Ac { - apple,fan-mode = "F1md"; - }; -}; +#include "t6050-j775-hwmon.dtsi" /* * The boot NOR's NVRAM: the loader fills the partition from ADT /arm-io/qspi/spinor/anvram reg diff --git a/arch/arm64/boot/dts/apple/t6050-j873s.dts b/arch/arm64/boot/dts/apple/t6050-j873s.dts index 3ed8c503ebdc5..fce036935d8b7 100644 --- a/arch/arm64/boot/dts/apple/t6050-j873s.dts +++ b/arch/arm64/boot/dts/apple/t6050-j873s.dts @@ -8,7 +8,8 @@ * yet. Beyond the SoC this file adds the board's hardware inventory * (t6050-peripherals.dtsi, all of it disabled), the onboard Ethernet and * the N1 (Wi-Fi and Bluetooth) on PCIe, and rear USB-C ports 1-3, from - * the board's ADT. + * the board's ADT. The SMC hwmon keys (one fan) follow the other Mac + * minis. * * Copyright The Asahi Linux Contributors */ @@ -137,6 +138,31 @@ * an HPM never gets. */ +/* + * SMC sensors, as on the other Mac minis: the shared power, voltage and current + * keys and the single fan, plus every readable float T* key through + * apple,discover-temperatures in t6050-die0.dtsi. A key this SMC lacks only + * drops its channel. + * + * Discovery refuses to run once any temperature channel exists, so the shared + * temperature nodes go (their keys are discovered anyway), as on J714s/J716s. + */ +#include "hwmon-common.dtsi" +#include "hwmon-mini.dtsi" + +&smc_hwmon { + /delete-node/ temperature-TH0x; + /delete-node/ temperature-TW0P; + + /* + * The T6050 SMC spells the fan mode key F0md, as on J714s, J716s, K116s + * and J775d. No apple,fan-manual-control: the SMC drives the fan. + */ + fan-F0Ac { + apple,fan-mode = "F0md"; + }; +}; + #define T6050_J873S /* ADT /arm-io/acio0 and acio1: rear ports 1 and 2's USB4/Thunderbolt routers (end of file) */ #define T6050_ATC0_USB4_ROUTER diff --git a/arch/arm64/boot/dts/apple/t6050-k114-k116.dtsi b/arch/arm64/boot/dts/apple/t6050-k114-k116.dtsi index c951c6cde0e2e..054fff49f479a 100644 --- a/arch/arm64/boot/dts/apple/t6050-k114-k116.dtsi +++ b/arch/arm64/boot/dts/apple/t6050-k114-k116.dtsi @@ -56,17 +56,16 @@ status = "disabled"; }; }; +}; - led-controller { - compatible = "pwm-leds"; +#include "t6050-kbd-backlight.dtsi" - /* ADT /arm-io/pwm0/kbd-backlight: default-hz 25000 */ +/ { + led-controller { + /* Here the keyboard light keeps its "apple::" name and no boot state */ led-0 { - pwms = <&fpwm0 0 40000>; label = "apple::kbd_backlight"; - function = LED_FUNCTION_KBD_BACKLIGHT; - color = ; - max-brightness = <255>; + /delete-property/ default-state; }; /* @@ -354,10 +353,6 @@ status = "okay"; }; -&fpwm0 { - status = "okay"; -}; - &ps_fpwm1 { status = "okay"; }; diff --git a/arch/arm64/boot/dts/apple/t6050-kbd-backlight.dtsi b/arch/arm64/boot/dts/apple/t6050-kbd-backlight.dtsi new file mode 100644 index 0000000000000..8e1dba5c6fea2 --- /dev/null +++ b/arch/arm64/boot/dts/apple/t6050-kbd-backlight.dtsi @@ -0,0 +1,28 @@ +// SPDX-License-Identifier: GPL-2.0+ OR MIT +/* + * The keyboard backlight of the T6050 MacBook Pros. Each board's ADT has it + * as pwm0/kbd-backlight: channel 0 of fpwm0 at 25 kHz, a 40000 ns period. + * + * Copyright The Asahi Linux Contributors + */ + +#include + +/ { + led-controller { + compatible = "pwm-leds"; + + led-0 { + pwms = <&fpwm0 0 40000>; + label = "kbd_backlight"; + function = LED_FUNCTION_KBD_BACKLIGHT; + color = ; + max-brightness = <255>; + default-state = "keep"; + }; + }; +}; + +&fpwm0 { + status = "okay"; +}; diff --git a/arch/arm64/boot/dts/apple/t6050-magsafe.dtsi b/arch/arm64/boot/dts/apple/t6050-magsafe.dtsi new file mode 100644 index 0000000000000..cf202fca74fb2 --- /dev/null +++ b/arch/arm64/boot/dts/apple/t6050-magsafe.dtsi @@ -0,0 +1,19 @@ +// SPDX-License-Identifier: GPL-2.0+ OR MIT +/* + * The M5 Pro/Max MacBook Pros' MagSafe 3 port: its PD controller, an SN201202x at SPMI address + * 0x8 on nub-spmi-a0 (ADT hpm5, port-type 0x11). Every 14" and 16" board's ADT has the same + * node. It has no USB data path, so it gets no connector node; tipd registers a Type-C port + * and a power supply for it, as on J616s. Its ADT features-supported is <3>, "Power In" only: + * no liquid detection (LDCM, feature 2 of the USB-C ports' <1 2 3>). + * + * The bus status is the board's. The boards that described the node before include this + * after their left-front port's PD controller (hpm1), where the node was. + */ + +&nub_spmi_a0 { + hpm5: usb-pd@8 { + compatible = "apple,sn201202x"; + reg = <0x8 SPMI_USID>; + apple,no-liquid-detection; + }; +};