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 000000000000..dcdec14140c2 --- /dev/null +++ b/arch/arm64/boot/dts/apple/t6050-j775-hwmon.dtsi @@ -0,0 +1,37 @@ +// SPDX-License-Identifier: GPL-2.0+ OR MIT +/* + * SMC hwmon keys shared by the T6050 Mac Studios (J775c M5 Max, J775d M5 Ultra): + * the DC input power and the two fans. + * + * 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 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"; + }; +}; diff --git a/arch/arm64/boot/dts/apple/t6050-j775c.dts b/arch/arm64/boot/dts/apple/t6050-j775c.dts index 65d92d3a1748..4170a7bd2b49 100644 --- a/arch/arm64/boot/dts/apple/t6050-j775c.dts +++ b/arch/arm64/boot/dts/apple/t6050-j775c.dts @@ -7,6 +7,8 @@ * One T6050 die (t6050-max.dtsi). Nobody has booted Linux on this board * yet: beyond the SoC this file only adds the board's hardware inventory * (t6050-peripherals.dtsi), all of it disabled, from the board's ADT. + * The SMC hwmon keys (DC input power, two fans) are the J775d's + * (t6050-j775-hwmon.dtsi). * * Copyright The Asahi Linux Contributors */ @@ -32,5 +34,7 @@ status = "disabled"; }; +#include "t6050-j775-hwmon.dtsi" + #define T6050_J775C #include "t6050-peripherals.dtsi" diff --git a/arch/arm64/boot/dts/apple/t6050-j775d.dts b/arch/arm64/boot/dts/apple/t6050-j775d.dts index 68b4c324aca0..d72e1725f902 100644 --- a/arch/arm64/boot/dts/apple/t6050-j775d.dts +++ b/arch/arm64/boot/dts/apple/t6050-j775d.dts @@ -284,35 +284,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 0a7976e50230..2b0bd266c13d 100644 --- a/arch/arm64/boot/dts/apple/t6050-j873s.dts +++ b/arch/arm64/boot/dts/apple/t6050-j873s.dts @@ -7,6 +7,7 @@ * One T6050 die (t6050-max.dtsi). Nobody has booted Linux on this board * yet: beyond the SoC this file only adds the board's hardware inventory * (t6050-peripherals.dtsi), all of it disabled, from the board's ADT. + * The SMC hwmon keys (one fan) follow the other Mac minis. * * Copyright The Asahi Linux Contributors */ @@ -32,5 +33,30 @@ status = "disabled"; }; +/* + * 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 #include "t6050-peripherals.dtsi"