Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion arch/arm64/boot/dts/apple/t6040-j616s-extdisp-hdmi.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* -> atcphy3 -> DP-to-HDMI converter) with every node left DISABLED. The
* nodes must not be enabled at boot in the device tree: powering the DISPEXT
* chain without the PMP acknowledgement hangs the machine before root. The
* enable gate (drivers/soc/apple/t6041-display-gate.c) switches them on in
* enable gate (drivers/soc/apple/display-gate.c) switches them on in
* order once the PMP is bound.
*
* dispext0's DART is not in the display node's iommus: the gate appends it
Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/boot/dts/apple/t6040-j616s-extdisp-usbc.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/*
* USB-C DisplayPort: dcpext1 over any of the three Type-C ports. As for
* HDMI, the DISPEXT1 chain and dcpext1 stay DISABLED in the DTB and are
* enabled by the enable gate (drivers/soc/apple/t6041-display-gate.c). The
* enabled by the enable gate (drivers/soc/apple/display-gate.c). The
* routes go through the display fabric (typec-routes, end of this file):
* tipd's mode switch reaches dcpext1, which claims the port. Boot-time
* changes: mode-switch on atcphy0..2 (the PHY registers a Type-C mode
Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/boot/dts/apple/t6040-j616s-extdisp.dtsi
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0+ OR MIT
/*
* External display resources of the J616s. Everything here is disabled in
* the device tree: the enable gate (drivers/soc/apple/t6041-display-gate.c)
* the device tree: the enable gate (drivers/soc/apple/display-gate.c)
* switches the chain on once the boot loader has provided the firmware
* memory of the external display processors, so without that the booted
* hardware state is the same as without this file.
Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/boot/dts/apple/t6040-j616s.dts
Original file line number Diff line number Diff line change
Expand Up @@ -4368,7 +4368,7 @@

#include "t6040-j616s-usb3.dtsi"

/* External display chain, all disabled: the gate in drivers/soc/apple/t6041-display-gate.c enables it. */
/* External display chain, all disabled: the gate in drivers/soc/apple/display-gate.c enables it. */
#include "t6040-j616s-extdisp.dtsi"
#include "t6040-j616s-extdisp-mem-loader.dtsi"
#include "t6040-j616s-extdisp-hdmi.dtsi"
Expand Down
37 changes: 3 additions & 34 deletions drivers/gpu/drm/asahi/m3/t8122_hwdata.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// SPDX-License-Identifier: GPL-2.0-only OR MIT

//! The 20-word block at HwDataA +0x418c..+0x41db that the runtime backend writes on a T8122
//! with the G15 14.8.3 firmware, unless `asahi.t8122_hwdata_418c=0`. Plain data only, so that
//! the host tests run it (tools/asahi).
//! with the G15 14.8.3 firmware. The chip and firmware identity select it, as they select the
//! rest of HwDataA; there is no switch to leave it out. Plain data only, so that the host tests
//! run it (tools/asahi).
//!
//! The words are not in the device tree, and what they mean is not known. They have been
//! tested on 10-core and 8-core J613s only; J615 on this firmware is untested.
Expand Down Expand Up @@ -31,28 +32,8 @@ pub(crate) const WORDS: [u32; 20] = [
/// Size of the block in bytes.
pub(crate) const SIZE: usize = WORDS.len() * 4;

/// `asahi.t8122_hwdata_418c` values: 0 leaves the range as the builder made it (zero), 1 writes
/// the block. The default is 1.
pub(crate) const OFF: u64 = 0;
pub(crate) const ON: u64 = 1;
pub(crate) const DEFAULT: u64 = ON;

const _: () = assert!(SIZE == 0x50 && OFFSET % 4 == 0);

/// Parse `asahi.t8122_hwdata_418c`: `0` or `1`. Anything else is refused.
pub(crate) fn parse(text: &str) -> Option<u64> {
match text.trim() {
"0" => Some(OFF),
"1" => Some(ON),
_ => None,
}
}

/// Whether a parameter value asks for the block.
pub(crate) fn enabled(value: u64) -> bool {
value == ON
}

/// Write the block into `hwdata_a`, the bytes of HwDataA. Nothing outside
/// `OFFSET..OFFSET + SIZE` changes. Err, with nothing written, when `hwdata_a` is too short.
pub(crate) fn write(hwdata_a: &mut [u8]) -> Result<(), ()> {
Expand Down Expand Up @@ -112,16 +93,4 @@ mod tests {
let mut exact = vec![0u8; OFFSET + SIZE];
assert_eq!(write(&mut exact), Ok(()));
}

#[test]
fn the_parameter_accepts_0_and_1_only_and_defaults_to_1() {
assert_eq!(parse("0"), Some(OFF));
assert_eq!(parse("1"), Some(ON));
assert_eq!(parse(" 1\n"), Some(ON));
for text in ["", "2", "-1", "+1", "0x1", "on", "yes", "01"] {
assert_eq!(parse(text), None, "{text:?}");
}
assert!(enabled(DEFAULT));
assert!(!enabled(OFF));
}
}
2 changes: 1 addition & 1 deletion drivers/pmdomain/apple/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ config APPLE_PMP_REPORT

On T8122 (M3), T6031 (M3 Max), and opted-in T6030 (M3 Pro) Macs
whose boot loader hands the
internal display over (see APPLE_T6030_DISPLAY_GATE), iBoot leaves
internal display over (see APPLE_DISPLAY_GATE), iBoot leaves
the PMP halted, and this driver starts it when the display driver
first asks for it. Once its nodes are enabled the PMP may run until
the next reboot. That holds when the start then fails, too (the PMP
Expand Down
33 changes: 12 additions & 21 deletions drivers/soc/apple/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,8 @@ config APPLE_CLPC

Say 'y' or 'm' here if you have an Apple SoC with a PMC.

config APPLE_T6030_DISPLAY_GATE
bool "Apple T6030 internal display enable gate"
config APPLE_DISPLAY_GATE
bool "Apple internal display enable gate"
depends on ARCH_APPLE && OF_DYNAMIC && OF_OVERLAY
default ARCH_APPLE
help
Expand All @@ -257,28 +257,19 @@ config APPLE_T6030_DISPLAY_GATE
apple_t6031_display.enable=1 on the kernel command line, and only
with the PMP values the boot loader passes.

Say 'y' if you want the native display on M3 Pro MacBook Pros.
On T6041 (M4 Pro) device trees it enables the internal display nodes
only when the boot loader has handed the running display coprocessor
over (apple,t6041-handoff, 26.6.2 display firmware), and powers up
the J616s external display chain (HDMI, Type-C DisplayPort) once the
boot loader has given the external display processors their
firmware memory. Without these, or with nomodeset, it does nothing.

config APPLE_T6041_DISPLAY_GATE
bool "Apple T6041 internal display enable gate"
depends on ARCH_APPLE && OF_DYNAMIC
default ARCH_APPLE
help
The J616s (M4 Pro) device tree keeps the internal display nodes
disabled, so the display stays on the boot framebuffer until the
boot loader has handed the running display coprocessor over. This
option enables those nodes before devices are created, only when
the boot loader has published a complete T6041 handoff for the
26.6.2 display firmware. It also powers up the J616s external
display chain (HDMI, Type-C DisplayPort) once the boot loader has
given the external display processors their firmware memory.
Without these, or with nomodeset, it does nothing.

Say 'y' if you want the native display on M4 Pro MacBook Pros.
Say 'y' if you want the native display on M3 Pro, M3 Max, M3 and
M4 Pro Macs.

config APPLE_T6030_GPU_PMP_LINK
bool
depends on APPLE_T6030_DISPLAY_GATE
depends on APPLE_DISPLAY_GATE
default n
help
Link an opted-in T6030 GPU to the PMP admitted by the display gate.
Expand All @@ -287,7 +278,7 @@ config APPLE_T6030_GPU_PMP_LINK

config APPLE_DISPLAY_GATE_KUNIT_TEST
bool "KUnit tests for the Apple display gate" if !KUNIT_ALL_TESTS
depends on KUNIT=y && APPLE_T6030_DISPLAY_GATE
depends on KUNIT=y && APPLE_DISPLAY_GATE
default KUNIT_ALL_TESTS
help
Runs the display gate on test device trees with the T6030, T6031
Expand Down
12 changes: 5 additions & 7 deletions drivers/soc/apple/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ apple-rtkit-helper-y = rtkit-helper.o
obj-$(CONFIG_APPLE_SART) += apple-sart.o
apple-sart-y = sart.o

obj-$(CONFIG_APPLE_T6030_DISPLAY_GATE) += apple-t6030-display.o
apple-t6030-display-y := t6030-display-gate.o t6030-pmp.dtbo.o t6030-j516s-pmp.dtbo.o
apple-t6030-display-$(CONFIG_APPLE_DISPLAY_GATE_KUNIT_TEST) += t6031-gate-test.dtbo.o \
t6030-gate-test.dtbo.o \
t8122-gate-test.dtbo.o
obj-$(CONFIG_APPLE_DISPLAY_GATE) += apple-display-gate.o
apple-display-gate-y := display-gate.o t6030-pmp.dtbo.o t6030-j516s-pmp.dtbo.o
apple-display-gate-$(CONFIG_APPLE_DISPLAY_GATE_KUNIT_TEST) += t6031-gate-test.dtbo.o \
t6030-gate-test.dtbo.o \
t8122-gate-test.dtbo.o
# The gate adds the interrupt parent from the base tree at boot.
DTC_FLAGS_t6030-pmp := -Wno-interrupts_property
DTC_FLAGS_t6030-j516s-pmp := -Wno-interrupts_property
Expand All @@ -32,8 +32,6 @@ DTC_FLAGS_t6030-gate-test := -Wno-interrupts_property -Wno-chosen_node_is_root \
-Wno-avoid_unnecessary_addr_size
DTC_FLAGS_t8122-gate-test := -Wno-interrupts_property -Wno-chosen_node_is_root

obj-$(CONFIG_APPLE_T6041_DISPLAY_GATE) += t6041-display-gate.o

obj-$(CONFIG_APPLE_TUNABLE) += apple-tunable.o
apple-tunable-y = tunable.o

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* - T8122 (t8122-gate-test.dtso): on by default, with the full handoff,
* and nothing changed when a check of the handoff or of the reused PMP
* topology fails.
* Included at the end of t6030-display-gate.c.
* Included at the end of display-gate.c.
*
* The test trees are applied once and stay: the gate gives some properties
* names it does not allocate, which the tree must never free. Each case
Expand Down
Loading
Loading