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
7 changes: 7 additions & 0 deletions Documentation/devicetree/bindings/display/apple,dcp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,13 @@ properties:
because kernels that share the display DART unconditionally accept 1
and nothing else.

apple,t6031-dcpext-firmware-ready:
$ref: /schemas/types.yaml#/definitions/uint32
enum: [1, 2]
description:
Set by the boot loader on a T6031 external coprocessor whose firmware
it has reserved for the kernel's display gate.

apple,pmp:
$ref: /schemas/types.yaml#/definitions/phandle
description: Native PMP supplier, independent of the report request entry.
Expand Down
50 changes: 45 additions & 5 deletions arch/arm64/boot/dts/apple/t6031-dcp.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
display: display-subsystem {
compatible = "apple,t6031-display-subsystem";
iommus = <&disp0_dart 0>;
/* Keep the inherited scanout alias when adding external streams. */
apple,dma-range = /bits/ 64 <0x10000000000 0x1000000000>;
status = "disabled";
};
};
Expand Down Expand Up @@ -76,19 +78,18 @@
mbox-names = "mbox";
iommus = <&dcp_dart 5>;
reg-names = "coproc", "disp-0", "disp-1", "disp-2", "disp-3",
"disp-4", "disp-5", "iop-vbar";
"disp-4", "iop-vbar";
reg = <0x3 0x86c00000 0x0 0x4000>,
<0x3 0x84000000 0x0 0x690000>,
<0x3 0x84800000 0x0 0x690000>,
<0x3 0x84000000 0x0 0x4000000>,
<0x3 0x85320000 0x0 0x4000>,
<0x3 0x85344000 0x0 0x4000>,
<0x3 0x86800000 0x0 0x800000>,
<0x2 0x903d0000 0x0 0x4000>,
<0x3 0x86850000 0x0 0x4000>;
power-domains = <&ps_disp_fe>;
clocks = <&clk_disp0>;
/* PTD bandwidth request entry 577 in the disp-5 update window. */
apple,bw-scratch = <&pmgr_dcp 0 5 0x1208>;
/* PTD bandwidth request entry 577 in the disp-4 update window. */
apple,bw-scratch = <&pmgr_dcp 0 4 0x1208>;
/* The 14.x/27.2 firmware runs once the PMP acknowledges this request. */
apple,pmp-report = <&pmp_report_disp>;
#address-cells = <2>;
Expand Down Expand Up @@ -119,3 +120,42 @@
&pmp_report {
apple,pmp = <&pmp>;
};

/*
* External display processor 0 (dcpext0): the boot loader reserves its
* firmware, and the display gate enables it and its routes once ready.
*/
&dispext0_dart {
#iommu-cells = <1>;
apple,dma-range = <0x100 0x0 0x10 0x0>;
power-domains = <&ps_dispext0_fe>;
};

&dcpext0_dart {
#iommu-cells = <1>;
apple,dma-range = <0x100 0x0 0x10 0x0>;
power-domains = <&ps_dispext0_fe>;
};

&dcpext0_mbox {
power-domains = <&ps_dispext0_fe>;
};

&dcpext0 {
iommus = <&dcpext0_dart 5>;
reg-names = "coproc", "disp-0", "disp-1", "disp-2", "disp-3";
reg = <0x3 0x6c00000 0x0 0x4000>,
<0x3 0x4000000 0x0 0x4000000>,
<0x3 0x5320000 0x0 0x4000>,
<0x3 0x5344000 0x0 0x4000>,
<0x3 0x6800000 0x0 0x800000>;
power-domains = <&ps_dispext0_fe>;
resets = <&ps_dispext0_cpu>;
apple,bw-scratch = <&pmgr_dcp 0 4 0x1210>;
apple,pmp-report = <&pmp_report_dispext0>;
apple,dcp-index = <1>;

piodma {
iommus = <&dispext0_dart 4>;
};
};
98 changes: 98 additions & 0 deletions arch/arm64/boot/dts/apple/t6031-j516c.dts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
/ {
compatible = "apple,j516c", "apple,t6031", "apple,arm-platform";
model = "Apple MacBook Pro (16-inch, M3 Max, 16 CPU cores, Nov 2023)";

aliases {
dcpext0 = &dcpext0;
};
};

&mtp_mt {
Expand Down Expand Up @@ -154,3 +158,97 @@
apple,sleep-report = /bits/ 8 <0x21 0x00>;
};
};

/*
* External display on any of the three USB-C ports: dcpext0 is crossbar state 0
* of each ATC and its DPTX target is the ATC index. The display gate enables it
* and the routes once the boot loader has readied its firmware.
*/
&dcpext0 {
apple,connector-type = "USB-C";
phys = <&atcphy0 PHY_TYPE_DP>, <&atcphy1 PHY_TYPE_DP>,
<&atcphy2 PHY_TYPE_DP>;
phy-names = "typec0", "typec1", "typec2";
mux-controls = <&atcphy0_xbar 0>, <&atcphy1_xbar 0>,
<&atcphy2_xbar 0>;
mux-control-names = "typec0", "typec1", "typec2";
apple,typec-mux-indices = <0 0 0>;
apple,typec-dptx-phys = <0 1 2>;

typec-routes {
#address-cells = <1>;
#size-cells = <0>;

route@0 {
reg = <0>;
mode-switch;
status = "disabled";

port {
dcpext0_typec0: endpoint {
remote-endpoint = <&typec0_dcpext0>;
};
};
};

route@1 {
reg = <1>;
mode-switch;
status = "disabled";

port {
dcpext0_typec1: endpoint {
remote-endpoint = <&typec1_dcpext0>;
};
};
};

route@2 {
reg = <2>;
mode-switch;
status = "disabled";

port {
dcpext0_typec2: endpoint {
remote-endpoint = <&typec2_dcpext0>;
};
};
};
};
};

&typec0 {
ports {
port@3 {
reg = <3>;

typec0_dcpext0: endpoint {
remote-endpoint = <&dcpext0_typec0>;
};
};
};
};

&typec1 {
ports {
port@3 {
reg = <3>;

typec1_dcpext0: endpoint {
remote-endpoint = <&dcpext0_typec1>;
};
};
};
};

&typec2 {
ports {
port@3 {
reg = <3>;

typec2_dcpext0: endpoint {
remote-endpoint = <&dcpext0_typec2>;
};
};
};
};
38 changes: 36 additions & 2 deletions drivers/gpu/drm/apple/dcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -7265,6 +7265,14 @@ static enum dcp_firmware_version dcp_check_firmware_version(struct device *dev)
return DCP_FIRMWARE_UNKNOWN;
}

if (of_device_is_compatible(dev->of_node, "apple,t6031-dcpext") &&
dcp_firmware_27(dev, &version)) {
if (apple_t6031_dcpext_v27_2(dev->of_node))
return version;
dev_err(dev, "T6031 external display not started: unpinned 27.x DCP firmware\n");
return DCP_FIRMWARE_UNKNOWN;
}

/*
* TEST: the T6030 external processors on firmware 27 run only the idle-only session of
* the 27.2 image, never the generic firmware-27 pipe (they have no such lifecycle).
Expand Down Expand Up @@ -7333,6 +7341,14 @@ static enum dcp_firmware_version dcp_check_firmware_version(struct device *dev)
return DCP_FIRMWARE_UNKNOWN;
}

if (of_device_is_compatible(dev->of_node, "apple,t6031-dcpext")) {
if (apple_t6031_dcpext_v27_2(dev->of_node))
return dcp_v27_method_table(dev, compat_str);
dev_err(dev, "T6031 external display not started: DCP firmware-compat %s is not the 27.2 image\n",
compat_str);
return DCP_FIRMWARE_UNKNOWN;
}

/* The internal panels with a board record (T6030, J613): the same. */
v14_board = iomfb_v14_7_board(dev);
if (IS_ERR(v14_board))
Expand Down Expand Up @@ -7581,9 +7597,10 @@ static int dcp_firmware_clocks_v27(struct apple_dcp *dcp)
dcp->num_firmware_clocks = 2;
return 0;
}
/* External processors without a provider clock table (T6041, T8122). */
/* External processors without a provider clock table (T6031, T6041, T8122). */
if (!of_property_present(dev->of_node, "apple,clock-ids") &&
(of_device_is_compatible(dev->of_node, "apple,t6041-dcpext") ||
(of_device_is_compatible(dev->of_node, "apple,t6031-dcpext") ||
of_device_is_compatible(dev->of_node, "apple,t6041-dcpext") ||
of_device_is_compatible(dev->of_node, "apple,t8122-dcpext")))
return 0;
clocks = of_property_count_u32_elems(dev->of_node, "apple,clock-ids");
Expand Down Expand Up @@ -8195,6 +8212,7 @@ static void dcp_ext_give_up(struct apple_dcp *dcp, int err, const char *when);
static bool dcp_ext_is_failsafe(struct device_node *np)
{
return of_device_is_compatible(np, "apple,t8122-dcpext") ||
of_device_is_compatible(np, "apple,t6031-dcpext") ||
of_device_is_compatible(np, "apple,t6041-dcpext") ||
of_device_is_compatible(np, "apple,t6050-dcpext") ||
of_device_is_compatible(np, "apple,t8142-dcpext") ||
Expand Down Expand Up @@ -9265,6 +9283,14 @@ static int dcp_platform_probe_pipe(struct platform_device *pdev)
dcp->hw.s2r_ext = true;
dcp->hw.s2r_dart_save_restore = true;
}
if (fw_compat == DCP_FIRMWARE_V_27_0 &&
of_device_is_compatible(dev->of_node, "apple,t6031-dcpext")) {
if (!dcp->hw.firmware_dma_bits)
dcp->hw.firmware_dma_bits = 41;
dcp->hw.num_dptx_ports = 2;
dcp->hw.fw_14_7_endpoints = false;
dcp->hw.adopt_live_session = false;
}
if (fw_compat == DCP_FIRMWARE_V_27_0 &&
of_device_is_compatible(dev->of_node, "apple,t6041-dcpext")) {
if (!dcp->hw.firmware_dma_bits)
Expand Down Expand Up @@ -13842,6 +13868,13 @@ static const struct apple_dcp_hw_data apple_dcp_hw_t6030_dcpext = {
.num_dptx_ports = 1,
};

static const struct apple_dcp_hw_data apple_dcp_hw_t6031_dcpext = {
.external_processor = true,
.num_dptx_ports = 2,
.afk_name_fallback = true,
.no_ext_idle = true,
};

static const struct apple_dcp_hw_data apple_dcp_hw_t8122_dcpext = {
.external_processor = true,
.num_dptx_ports = 2,
Expand Down Expand Up @@ -13993,6 +14026,7 @@ static const struct of_device_id of_match[] = {
{ .compatible = "apple,t6030-dcpext", .data = &apple_dcp_hw_t6030_dcpext, },
{ .compatible = "apple,t8122-dcp", .data = &apple_dcp_hw_t8122, },
{ .compatible = "apple,t6031-dcp", .data = &apple_dcp_hw_t6031, },
{ .compatible = "apple,t6031-dcpext", .data = &apple_dcp_hw_t6031_dcpext, },
{ .compatible = "apple,t8122-dcpext", .data = &apple_dcp_hw_t8122_dcpext, },
{ .compatible = "apple,dcp", .data = &apple_dcp_hw_dcp, },
{ .compatible = "apple,dcpext", .data = &apple_dcp_hw_dcpext, },
Expand Down
Loading
Loading