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
21 changes: 15 additions & 6 deletions arch/arm64/boot/dts/apple/t8132-gpu.dtsi
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// SPDX-License-Identifier: GPL-2.0+ OR MIT
/*
* The T8132 G16 GPU, its ASC mailbox and the outer GFX power gate (TVM),
* as on the J713. m1n1 fills the inherited UAT and firmware ranges (reg)
* and enables them; a board enables the GPU once its firmware and board data
* are qualified.
* as on the J713. The GPU depends on the 26.6.2 firmware, not the board: the
* boot loader fills the inherited UAT and firmware ranges (reg), enables
* them and publishes the handoff, or disables the GPU.
*
* Copyright The Asahi Linux Contributors
*/
Expand Down Expand Up @@ -54,7 +54,6 @@
compatible = "apple,t8132-gfx-tvm";
reg = <0x3 0x80760800 0x0 0x4>;
#power-domain-cells = <0>;
status = "disabled";
};

gpu: gpu@302600000 {
Expand All @@ -72,7 +71,6 @@
<&gpu_shared_l2>, <&gpu_fw_text>, <&gpu_fw_data>;
memory-region-names = "ttbs", "pagetables", "handoff",
"shared-l2", "fw-text", "fw-data";
status = "disabled";
};

agx_mbox: mailbox@302608000 {
Expand All @@ -88,6 +86,17 @@
interrupt-names = "send-empty", "send-not-empty",
"recv-empty", "recv-not-empty";
#mbox-cells = <0>;
status = "disabled";
};
};

/* The outer TVM gate is the parent of the GFX PMGR domain. */
&ps_gfx {
power-domains = <&gfx_tvm>;
/* The G16 firmware stays live across suspend-to-idle. */
apple,sleep-retained;
};

/* The existing report provider owns readiness for shared PMP commands. */
&pmp {
apple,pmp-report = <&pmp_report>;
};
16 changes: 16 additions & 0 deletions arch/arm64/boot/dts/apple/t8132-j604.dts
Original file line number Diff line number Diff line change
Expand Up @@ -312,3 +312,19 @@
#include "hwmon-common.dtsi"
#include "hwmon-laptop.dtsi"
#include "hwmon-fan-dual.dtsi"

/*
* The PMGR domains of the USB-C ports this board wires beyond ATC0/ATC1, as
* the M4 firmware path's policy enables ATC0/ATC1's.
*/
&ps_atc3_common {
status = "okay";
};

&ps_atc3_usb_aon {
status = "okay";
};

&ps_atc3_usb {
status = "okay";
};
28 changes: 28 additions & 0 deletions arch/arm64/boot/dts/apple/t8132-j624.dts
Original file line number Diff line number Diff line change
Expand Up @@ -197,3 +197,31 @@
};
};
};

/*
* The PMGR domains of the USB-C ports this board wires beyond ATC0/ATC1, as
* the M4 firmware path's policy enables ATC0/ATC1's.
*/
&ps_atc2_common {
status = "okay";
};

&ps_atc2_usb_aon {
status = "okay";
};

&ps_atc2_usb {
status = "okay";
};

&ps_atc3_common {
status = "okay";
};

&ps_atc3_usb_aon {
status = "okay";
};

&ps_atc3_usb {
status = "okay";
};
22 changes: 1 addition & 21 deletions arch/arm64/boot/dts/apple/t8132-j713-j715.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -132,31 +132,11 @@
};
};

/* GPU: the outer TVM gate is the parent of the GFX domain. */
&gfx_tvm {
status = "okay";
};

&gpu {
status = "okay";
};

&agx_mbox {
status = "okay";
};

/* The GPU itself is described for every M4 Mac in t8132-gpu.dtsi. */
&ps_gfx {
power-domains = <&gfx_tvm>;
/* The G16 firmware stays live across suspend-to-idle. */
apple,sleep-retained;
status = "okay";
};

/* The report provider owns readiness for shared PMP commands. */
&pmp {
apple,pmp-report = <&pmp_report>;
};

/*
* Internal display: the loader enables disp0_dart, piodma and the display
* subsystem once it has validated the inherited frontend mappings.
Expand Down
28 changes: 28 additions & 0 deletions arch/arm64/boot/dts/apple/t8132-j773g.dts
Original file line number Diff line number Diff line change
Expand Up @@ -198,3 +198,31 @@

#include "hwmon-common.dtsi"
#include "hwmon-mini.dtsi"

/*
* The PMGR domains of the USB-C ports this board wires beyond ATC0/ATC1, as
* the M4 firmware path's policy enables ATC0/ATC1's.
*/
&ps_atc2_common {
status = "okay";
};

&ps_atc2_usb_aon {
status = "okay";
};

&ps_atc2_usb {
status = "okay";
};

&ps_atc3_common {
status = "okay";
};

&ps_atc3_usb_aon {
status = "okay";
};

&ps_atc3_usb {
status = "okay";
};
2 changes: 1 addition & 1 deletion drivers/gpu/drm/apple/t8132_ext_drm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1090,7 +1090,7 @@ int t8132_ext_drm_init(struct drm_device *drm)
bool mine, reg;
int ret = 0;

if (!apple_t8132_air())
if (!apple_t8132_firmware_path())
return 0;
/* Sleep handling for the outputs of one DRM device only. */
mutex_lock(&t8132_ext_reg_lock);
Expand Down
10 changes: 7 additions & 3 deletions drivers/iommu/apple-dart-dcp-format.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,13 @@ static inline int dcp_adt_value(struct dcp_adt_tables *out,

if (kind == 1 && !strcmp(name, "target-type")) {
bit = 1;
/* The M4 Airs share the retained display handoff. */
if (length != 5 ||
(memcmp(value, "J713", 5) && memcmp(value, "J715", 5)))
/* Every M4 Mac shares the retained display handoff. */
if (!(length == 5 && (!memcmp(value, "J713", 5) ||
!memcmp(value, "J715", 5) ||
!memcmp(value, "J604", 5) ||
!memcmp(value, "J623", 5) ||
!memcmp(value, "J624", 5))) &&
!(length == 6 && !memcmp(value, "J773g", 6)))
return -ENODEV;
} else if (kind == 3 && !strcmp(name, "compatible")) {
bit = 2;
Expand Down
8 changes: 4 additions & 4 deletions drivers/iommu/apple-dart.c
Original file line number Diff line number Diff line change
Expand Up @@ -4112,20 +4112,20 @@ static int apple_dart_probe(struct platform_device *pdev)
bool j713_display, j713_dcpext, j713_dispext, j713_radio;

/*
* The J713/J715 internal display DARTs are live: DCP firmware (SID23)
* The M4 internal display DARTs are live: DCP firmware (SID23)
* and the scanout/PIODMA frontend (SID0/SID16) keep using them. Leave
* both untouched until userspace, with its watchdog armed, opts in.
*/
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
j713_display = res && !tunneled && apple_t8132_air() &&
j713_display = res && !tunneled && apple_t8132_firmware_path() &&
of_device_is_compatible(dev->of_node, "apple,t8132-dart") &&
(res->start == 0x30a300000ULL || res->start == 0x30a340000ULL);
/* The external DCP firmware DARTs (SID23) of dcpext0 and dcpext1. */
j713_dcpext = res && !tunneled && apple_t8132_air() &&
j713_dcpext = res && !tunneled && apple_t8132_firmware_path() &&
of_device_is_compatible(dev->of_node, "apple,t8132-dart") &&
(res->start == 0x286340000ULL || res->start == 0x48a340000ULL);
/* The external display DARTs (SID0/SID16) of dispext0 and dispext1. */
j713_dispext = res && !tunneled && apple_t8132_air() &&
j713_dispext = res && !tunneled && apple_t8132_firmware_path() &&
of_device_is_compatible(dev->of_node, "apple,t8132-dart") &&
(res->start == 0x286300000ULL || res->start == 0x48a300000ULL);
/* The radio DART's fault interrupt is not described by the loader. */
Expand Down
13 changes: 6 additions & 7 deletions drivers/pmdomain/apple/pmgr-pwrstate.c
Original file line number Diff line number Diff line change
Expand Up @@ -532,14 +532,13 @@ static int apple_pmgr_ps_probe(struct platform_device *pdev)

t8132 = of_device_is_compatible(node, "apple,t8132-pmgr-pwrstate");
/*
* The original J713 loader tree, which the J715 shares, exposes domains
* Linux cannot access. The early compatibility adapter supplies the
* board's explicit status and ownership before population; fail closed
* if it was not enabled. Other T8132 boards keep their own domain
* descriptions and behaviour.
* On the M4 firmware path some domains are the firmware's, which Linux
* cannot access. The early compatibility adapter supplies the explicit
* status and ownership before population; fail closed if it was not
* enabled. Other firmware keeps the tree's own domain descriptions.
*/
if (t8132 && apple_t8132_air() && !of_property_present(node, "status"))
return dev_err_probe(dev, -ENODEV, "missing J713 power-domain policy\n");
if (t8132 && apple_t8132_firmware_path() && !of_property_present(node, "status"))
return dev_err_probe(dev, -ENODEV, "missing M4 power-domain policy\n");

tvm = of_parse_phandle(node, "power-domains", 0);
if (t8132 && tvm)
Expand Down
2 changes: 1 addition & 1 deletion drivers/pmdomain/apple/pmp-report.c
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ int apple_pmp_report_wait_supplier_ready(struct device *supplier, unsigned int t
struct platform_device *pdev;
struct apple_pmp_report *rep;
u64 status;
bool t8132 = apple_t8132_air() &&
bool t8132 = apple_t8132_firmware_path() &&
of_device_is_compatible(supplier->of_node, "apple,t8132-pmp-v2");
int ret;

Expand Down
4 changes: 2 additions & 2 deletions drivers/soc/apple/display-gate.c
Original file line number Diff line number Diff line change
Expand Up @@ -3069,7 +3069,7 @@ static void __init gate_t6041_max_run(void)
}

/*
* J713 and J715: the dcpext Type-C routes are disabled in the device tree,
* M4: the dcpext Type-C routes are disabled in the device tree,
* as on J613, because a USB-C port controller waits for the mode switch of
* every available route. Enable them only for a dcpext the boot loader handed
* over (apple,t8132-dcpext-firmware-ready = 1). A handed-over dcpext that is
Expand Down Expand Up @@ -3115,7 +3115,7 @@ static int __init apple_display_gate(void)
{
int i;

if (apple_t8132_air()) {
if (apple_t8132_firmware_path()) {
gate_j713_dcpext_routes();
return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/soc/apple/pmp-telemetry.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

bool apple_pmp_telemetry_retained_board(void)
{
return apple_t8132_air() && of_machine_is_compatible("apple,t8132");
return apple_t8132_firmware_path() && of_machine_is_compatible("apple,t8132");
}

static LIST_HEAD(apple_pmp_telemetry_list);
Expand Down
2 changes: 1 addition & 1 deletion drivers/soc/apple/rtkit-helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ static int apple_rtkit_helper_probe(struct platform_device *pdev)
helper->preserved = true;
}

if (!live && apple_t8132_air() && of_machine_is_compatible("apple,t8132")) {
if (!live && apple_t8132_live_mtp() && of_machine_is_compatible("apple,t8132")) {
struct property *prop;
u32 inherited;
int len;
Expand Down
24 changes: 18 additions & 6 deletions drivers/soc/apple/t8132-platform-handoff.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only OR MIT
/* Supply missing platform descriptions for the original J713 loader ABI,
* which the J715 shares.
* which the J715 shares, and the M4 PMGR ownership policy on the qualified
* firmware for every M4 Mac.
* Keep the shared m1n1 payload usable by the stable kernel. Hardware control
* remains in the ordinary MCC, PMC and CLPC drivers, with one DTS data source.
* J713 PMGR ownership/status also comes from its board DTS, before any domain
Expand Down Expand Up @@ -132,8 +133,14 @@ static int __init t8132_fdt_node_offset(const void *data,
return fdt_subnode_offset(data, parent, kbasename(node->full_name));
}

/* Apply only board availability/ownership, never imported register values. */
static int __init t8132_pmgr_policy(struct of_changeset *cs, unsigned int *changed)
/*
* Apply only availability/ownership, never imported register values. Only the
* original J713 loader tree (the Airs') can mark a domain okay that the policy
* refuses. Other trees state what their board wires, so keep their status,
* except on domains the policy gives the firmware.
*/
static int __init t8132_pmgr_policy(struct of_changeset *cs, unsigned int *changed,
bool legacy)
{
const void *data = __dtb_t8132_platform_data_begin;
const char * const ownership[] = { "apple,firmware-owned", "apple,inherited-on" };
Expand All @@ -152,6 +159,7 @@ static int __init t8132_pmgr_policy(struct of_changeset *cs, unsigned int *chang
for_each_child_of_node_scoped(pmgr, node) {
const char *status, *live;
int offset, len;
bool owned;

if (!of_device_is_compatible(node, "apple,t8132-pmgr-pwrstate"))
continue;
Expand All @@ -161,12 +169,16 @@ static int __init t8132_pmgr_policy(struct of_changeset *cs, unsigned int *chang
/* Unknown legacy domains stay inaccessible, rather than being probed. */
if (!status)
status = "disabled";
owned = offset >= 0 &&
(fdt_getprop(data, offset, ownership[0], NULL) ||
fdt_getprop(data, offset, ownership[1], NULL));
if (of_property_read_string(node, "status", &live)) {
ret = of_changeset_add_prop_string(cs, node, "status", status);
if (ret)
goto put_pmgr;
(*changed)++;
} else if (!strcmp(status, "disabled") && strcmp(live, status)) {
} else if (strcmp(live, status) &&
(legacy ? !strcmp(status, "disabled") : owned)) {
ret = of_changeset_update_prop_string(cs, node, "status", status);
if (ret)
goto put_pmgr;
Expand Down Expand Up @@ -217,7 +229,7 @@ static int __init t8132_platform_handoff(void)
unsigned int added = 0, changed = 0;
int root, node, ret;

if (!apple_t8132_air() || !of_machine_is_compatible("apple,t8132"))
if (!apple_t8132_firmware_path() || !of_machine_is_compatible("apple,t8132"))
return 0;
if (fdt_check_header(data))
return -EINVAL;
Expand All @@ -230,7 +242,7 @@ static int __init t8132_platform_handoff(void)
goto out;
}
of_changeset_init(cs);
ret = t8132_pmgr_policy(cs, &changed);
ret = t8132_pmgr_policy(cs, &changed, apple_t8132_air());
if (ret)
goto destroy;

Expand Down
4 changes: 2 additions & 2 deletions drivers/thermal/apple-pmp-thermal.c
Original file line number Diff line number Diff line change
Expand Up @@ -740,8 +740,8 @@ static int apple_pmp_thermal_probe(struct platform_device *pdev)
{
const struct apple_pmp_sensor_data *sensors = dev_get_platdata(&pdev->dev);

/* Only the M4 Airs' sensor topology and operating policy are qualified. */
if (!apple_t8132_air())
/* The M4 PMP sensor records and the Airs' fanless policy are qualified. */
if (!apple_t8132_firmware_path())
return -ENODEV;
if (!sensors || !sensors->read || !sensors->dev)
return -EINVAL;
Expand Down
4 changes: 2 additions & 2 deletions include/linux/soc/apple/pmp-display.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
#include <linux/soc/apple/t8132.h>
#include <linux/types.h>

/* The retained M4 bridge and raw thermal records: J713, and the J715 too. */
/* The retained M4 bridge and raw thermal records: the M4 firmware path. */
static inline bool apple_pmp_j713_board(void)
{
return apple_t8132_air() && of_machine_is_compatible("apple,t8132");
return apple_t8132_firmware_path() && of_machine_is_compatible("apple,t8132");
}

struct device;
Expand Down
Loading
Loading