Skip to content
Open
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
28 changes: 28 additions & 0 deletions arch/arm64/boot/dts/apple/t8132-j713.dts
Original file line number Diff line number Diff line change
Expand Up @@ -286,15 +286,31 @@
apple,clock-protection = <&ps_prot 18>;
};

/*
* Clock-protection slice 5 (ADT dart-dcpext0): it guards DISPEXT0_CPU's power
* state, and the DCPEXT's own stop and start release and restore it as the
* internal DCP's do.
*/
&dcpext0_dart {
reg = <0x2 0x86340000 0x0 0x20000>,
<0x3 0x8079c240 0x0 0x4>;
reg-names = "dart", "gapf";
apple,clock-protection = <&ps_prot 5>;
};

&dispext0_dart {
apple,clock-protection = <&ps_prot 4>;
};

/*
* Clock-protection slice 30 (ADT dart-dcpext1): it guards DISPEXT1_CPU's power
* state, and the DCPEXT's own stop and start release and restore it as the
* internal DCP's do.
*/
&dcpext1_dart {
reg = <0x4 0x8a340000 0x0 0x20000>,
<0x3 0x8079c880 0x0 0x4>;
reg-names = "dart", "gapf";
apple,clock-protection = <&ps_prot 30>;
};

Expand Down Expand Up @@ -410,9 +426,21 @@
&dcpext0 {
memory-region = <&dcpext0_text>, <&dcpext0_data>, <&dcpext0_heap>;
memory-region-names = "text", "data", "heap";
/*
* Its deep-sleep stop writes the same words as the internal DCP's: its
* DISPEXT0 power states and retention in the same blocks, and pmc-dcp,
* which counts every powered DCP.
*/
apple,display-power = <&dcp_power>;
};

&dcpext1 {
memory-region = <&dcpext1_text>, <&dcpext1_data>, <&dcpext1_heap>;
memory-region-names = "text", "data", "heap";
/*
* Its deep-sleep stop writes the same words as the internal DCP's: its
* DISPEXT1 power states and retention in the same blocks, and pmc-dcp,
* which counts every powered DCP.
*/
apple,display-power = <&dcp_power>;
};
48 changes: 41 additions & 7 deletions drivers/gpu/drm/apple/dcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,17 @@ static void dcp_s2r_check_dt(struct apple_dcp *dcp)
dev_info(dcp->dev, "no apple,display-power in the device tree, the firmware keeps running\n");
dcp->hw.s2r_ext = false;
}
/*
* Without a layout from the device tree, an external DCP keeps the fixed DISPEXT0
* sequence it had before (T8140); a firmware-27 one is then not dcp_s2r_ext_capable()
* without the lab parameter and refuses a deep sleep instead.
*/
if (dcp->hw.s2r_ext && !dcp->hw.s2r_layout) {
int ret = dcp_s2r_layout_from_dt(dcp);

if (ret)
dev_dbg(dcp->dev, "display power words not in the device tree (%d)\n", ret);
}
if (dcp->hw.s2r && dcp->hw.s2r_untested)
dev_info(dcp->dev, "firmware stop enabled (appledrm.s2r_untested)\n");
}
Expand Down Expand Up @@ -7206,8 +7217,9 @@ static int dcp_s2r_pm_register(struct apple_dcp *dcp);
* over; Linux never starts its CPU.
* - sink_metadata_edid: the display it finds at boot is its first sink,
* as on the T6041 dcpext.
* No sleep support: neither a firmware-27 sleep nor a link release has run
* on this processor.
* - s2r_ext: its deep-sleep stop and start (dcp_s2r_ext_suspend()), with the
* power words from the device tree; without them it keeps running and its
* deep sleep is refused.
*/
/*
* T8132 internal display processor on firmware 27.2, admitted by
Expand Down Expand Up @@ -7237,6 +7249,9 @@ static const struct apple_dcp_hw_data apple_dcp_hw_t8132_dcpext_v27 = {
.adopt_live_session = true,
.firmware_compat = DCP_FIRMWARE_V_27_0,
.sink_metadata_edid = true,
/* Its sleep stop and start, with the power words from the device tree. */
.s2r_ext = true,
.s2r_no_secure_port = true,
};

static int dcp_platform_probe_pipe(struct platform_device *pdev)
Expand Down Expand Up @@ -8379,6 +8394,15 @@ static bool dcp_s2r_is_t8142_ext(struct apple_dcp *dcp)
return of_device_is_compatible(dcp->dev->of_node, "apple,t8142-dcpext");
}

/*
* An external DCP powered by its layout's words (T8142's table, or the device tree's), not
* by the fixed DISPEXT0 sequence of the firmware-12 external DCPs.
*/
static bool dcp_s2r_ext_by_layout(struct apple_dcp *dcp)
{
return dcp_s2r_is_t8142_ext(dcp) || dcp->s2r_dt_layout_ok;
}

static const struct dcp_s2r_layout *dcp_s2r_layout(struct apple_dcp *dcp)
{
if (dcp_s2r_is_t8142_ext(dcp))
Expand Down Expand Up @@ -8664,7 +8688,13 @@ static int dcp_s2r_stop_firmware(struct apple_dcp *dcp)
static bool dcp_s2r_ext_capable(struct apple_dcp *dcp)
{
if (dcp->fw_compat == DCP_FIRMWARE_V_27_0)
return dcp->hw.s2r_ext && s2r_untested && dcp->v27_methods &&
/*
* Only with a power layout: the device tree's, or a static one under the lab
* parameter. Without one the fixed DISPEXT0 sequence below is not this DCP's.
*/
return dcp->hw.s2r_ext &&
(dcp->s2r_dt_layout_ok || (dcp->hw.s2r_layout && s2r_untested)) &&
dcp->v27_methods &&
dcp->v27_methods[dcpep_unnamed_500].tag[0];
return dcp->fw_compat == DCP_FIRMWARE_H17P && dcp->hw.s2r_ext;
}
Expand Down Expand Up @@ -8992,7 +9022,7 @@ static int dcp_s2r_domains_on(struct apple_dcp *dcp)
val = readl(ps + l->disp_fe) & ~(GENMASK(9, 8) | GENMASK(3, 0));
writel(val | 0xf, ps + l->disp_fe);
val = readl(ps + l->disp_cpu) & ~(GENMASK(9, 8) | GENMASK(3, 0) | BIT(28));
if (dcp_s2r_is_t8142_ext(dcp)) {
if (dcp_s2r_is_t8142_ext(dcp) || (dcp->hw.external_processor && dcp->s2r_dt_layout_ok)) {
/* Retain the CPU when idle, as in the measured J813 wake sequence. */
val = (val & ~DCP_PS_MIN) | FIELD_PREP(DCP_PS_MIN, 4);
writel(val, ps + l->disp_cpu);
Expand Down Expand Up @@ -9035,7 +9065,7 @@ static int dcp_s2r_ext_domains_on(struct apple_dcp *dcp)
u32 val;
int i, ret = -ENODEV;

if (dcp_s2r_is_t8142_ext(dcp))
if (dcp_s2r_ext_by_layout(dcp))
return dcp_s2r_domains_on(dcp);

np = of_parse_phandle(dcp->dev->of_node, "apple,display-power", 0);
Expand Down Expand Up @@ -9132,8 +9162,12 @@ static int dcp_s2r_ext_domains_off(struct apple_dcp *dcp)
int i, ret = -ENODEV;
u32 val;

if (dcp_s2r_is_t8142_ext(dcp))
if (dcp_s2r_ext_by_layout(dcp)) {
/* Its display DART goes off with the domains too: dark until they are back. */
if (dcp->s2r_disp_dart)
apple_dart_power_dark(dcp->s2r_disp_dart, true);
return dcp_s2r_domains_off(dcp);
}

np = of_parse_phandle(dcp->dev->of_node, "apple,display-power", 0);
if (!np)
Expand Down Expand Up @@ -9191,7 +9225,7 @@ static bool dcp_s2r_ext_cpu_on(struct apple_dcp *dcp)
of_node_put(np);
if (!ps)
return false;
on = FIELD_GET(GENMASK(7, 4), readl(ps + (dcp_s2r_is_t8142_ext(dcp) ?
on = FIELD_GET(GENMASK(7, 4), readl(ps + (dcp_s2r_ext_by_layout(dcp) ?
dcp_s2r_layout(dcp)->disp_cpu : 0x328)));
iounmap(ps);

Expand Down