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
4 changes: 2 additions & 2 deletions Documentation/devicetree/bindings/display/apple,dcp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -810,7 +810,7 @@ allOf:
properties:
compatible:
contains:
enum: ['apple,t6050-dcp', 'apple,t6050-dcpext']
enum: ['apple,t6050-dcp', 'apple,t6050-dcpext', 'apple,t8122-dcp']
then:
properties:
apple,sleep-power-args: false
Expand All @@ -820,7 +820,7 @@ allOf:
properties:
compatible:
contains:
const: apple,t6050-dcp
enum: ['apple,t6050-dcp', 'apple,t8122-dcp']
then:
properties:
apple,sleep-display-power-args: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ properties:
- apple,t6030-display-power
- apple,t6030-dispext-power
- apple,t8103-display-power
- apple,t8122-display-power
- apple,t6041-display-power
- apple,t8132-display-power
- apple,t8140-display-power
Expand Down Expand Up @@ -130,7 +131,9 @@ allOf:
properties:
compatible:
contains:
const: apple,t6030-display-power
enum:
- apple,t6030-display-power
- apple,t8122-display-power
then:
properties:
reg:
Expand Down
13 changes: 13 additions & 0 deletions arch/arm64/boot/dts/apple/t8122-dcp.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@
apple,bw-scratch = <&pmgr_dcp 0 5 0x908>;
/* The 14.x firmware runs once the PMP acknowledges this request. */
apple,pmp-report = <&pmp_report_disp>;
apple,display-power = <&dcp_power>;
#address-cells = <2>;
#size-cells = <2>;
ranges;
Expand All @@ -118,6 +119,17 @@
#apple,bw-scratch-cells = <3>;
};

/*
* Display power gates and PMGR power states for DCP and DCPext sleep
* (DISP_CPU/FE/SYS and DISPEXT_CPU/FE/SYS).
*/
dcp_power: display-power@2d0724000 {
compatible = "apple,t8122-display-power";
reg = <0x2 0xd0724000 0x0 0x1000>,
<0x2 0xd0700000 0x0 0x14000>;
reg-names = "pwrgate", "ps";
};

/*
* External display processor: the boot loader only reserves its
* firmware, the driver starts it. DMA windows as on T8112.
Expand Down Expand Up @@ -181,6 +193,7 @@
clocks = <&clk_dispext0>;
/* Its first mode set completes only with this PMP request. */
apple,pmp-report = <&pmp_report_dispext>;
apple,display-power = <&dcp_power>;
apple,dcp-index = <1>;
status = "disabled";

Expand Down
14 changes: 14 additions & 0 deletions arch/arm64/boot/dts/apple/t8122-j613-j615.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,20 @@
status = "okay";
};

&dcp {
/*
* Firmware 27.2's display sleep calls on J613/J615, matching the 27.2.0
* internal DCP ABI (A534, A550, A534, A464, A537).
*/
apple,sleep-power-args = /bits/ 8 <0x01 0x00 0x00 0x01 0x01 0xaa 0xaa 0xaa>;
apple,sleep-a500-args = /bits/ 8 <0x00 0x01 0xaa 0xaa 0x00 0x00 0xaa 0xaa>;
apple,sleep-display-power-args = /bits/ 8 <0x00 0x00 0x00 0x00 0x00 0xaa 0xaa 0xaa>;
apple,sleep-display-stage-args = /bits/ 8 <0x00 0x00 0x00 0x00 0x00 0xaa 0xaa 0xaa
0x01 0x00 0x00 0x00>;
apple,panel-video-open-delay-us = <10000>;
apple,panel-hdcp-open-arg = <3>;
};

&sleep {
apple,debug-port = <&hpm0>;
status = "okay";
Expand Down
4 changes: 4 additions & 0 deletions drivers/gpu/drm/apple/dcp-firmware-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,10 @@ static void dcp_ext_idle_s2r_disp_dart_gate(struct kunit *test)
dcp_ext_idle_close(dcp, false);
KUNIT_EXPECT_FALSE(test, dcp->ext_idle_armed);
KUNIT_EXPECT_FALSE(test, delayed_work_pending(&dcp->ext_idle_wq));

dcp->hw.no_ext_idle = true;
KUNIT_EXPECT_TRUE(test, dcp_s2r_ext_capable(dcp));
KUNIT_EXPECT_FALSE(test, dcp_ext_idle_capable(dcp));
}

/*
Expand Down
13 changes: 13 additions & 0 deletions drivers/gpu/drm/apple/dcp-internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,19 @@ struct apple_dcp_hw_data {
* D572 turns it off first, and the stop's power-down resets it (T8103).
*/
bool s2r_disp_dart_with_dcp;
/*
* Keep the external processor out of runtime idle power-off
* (dcp_ext_idle_capable()) while hot-plug wake from idle-off is
* untested; system-sleep s2r_ext stop and wake still run.
*/
bool no_ext_idle;
/*
* Save and restore display/DCP DART TTBR/TCR across this DCP's
* stop/wake (apple_dart_display_streams_saved()), gated in the
* caller so other firmware paths sharing the DART compatible stay
* untouched.
*/
bool s2r_dart_save_restore;
};

enum dcp_test_point {
Expand Down
71 changes: 65 additions & 6 deletions drivers/gpu/drm/apple/dcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -9119,6 +9119,12 @@ static int dcp_platform_probe_pipe(struct platform_device *pdev)
return ret;
dcp->hw = *(struct apple_dcp_hw_data *)of_device_get_match_data(dev);
dcp_apply_dt_profile(dcp);
/*
* v27_early_stop's layout has no DART streams: firmware 26.6's sleep takes
* them from its own (dcp_v26_find_darts()).
*/
if (dcp->hw.v27_early_stop && fw_compat != DCP_FIRMWARE_V_27_0)
dcp->hw.s2r_layout = NULL;
/* The link report: on the board it has run on (dcp_j714s_ext()). */
if (!dcp_j714s_ext(dev))
dcp->hw.link_report = false;
Expand All @@ -9144,6 +9150,9 @@ static int dcp_platform_probe_pipe(struct platform_device *pdev)
dcp->hw.num_dptx_ports = 2;
dcp->hw.fw_14_7_endpoints = false;
dcp->hw.adopt_live_session = false;
/* Its stop and start are this firmware's, not 14.7's or 26.6's. */
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,t6041-dcpext")) {
Expand Down Expand Up @@ -10347,6 +10356,29 @@ static const struct dcp_s2r_layout dcp_s2r_t6030 = {
.pmc_dcp = false,
};

/*
* T8122's internal and external display power words from the ADT/PMGR
* (DISP_CPU/FE/SYS with its flip-flop and SRAM retention words, and
* DISPEXT_CPU/FE/SYS with its DART streams). No pmc-dcp word.
*/
static const struct dcp_s2r_layout dcp_s2r_t8122 = {
.disp_cpu = 0x10000,
.disp_fe = 0x208,
.disp_sys = 0x1d8,
.ret_ff = 0xcac,
.ret_mem = 0xcd0,
.pmc_dcp = false,
};

static const struct dcp_s2r_layout dcp_s2r_t8122_ext = {
.disp_cpu = 0x488,
.disp_fe = 0x480,
.disp_sys = 0x410,
.dcp_streams = BIT(5),
.disp_streams = BIT(0) | BIT(4),
.pmc_dcp = false,
};

/* TEST: J813 external processors, ADT DISPEXT0/1 power words. */
static const struct dcp_s2r_layout dcp_s2r_t8142_ext[] = {
{ .disp_cpu = 0x428, .disp_fe = 0x418, .disp_sys = 0x308,
Expand Down Expand Up @@ -10643,13 +10675,23 @@ static int dcp_s2r_stop_streams(struct apple_dcp *dcp)
if (!dcp->s2r_dcp_dart)
return -ENODEV;
if (dcp->hw.s2r_disp_dart_with_dcp && dcp->s2r_disp_dart) {
ret = apple_dart_display_streams(dcp->s2r_disp_dart,
dcp_s2r_layout(dcp)->disp_streams, false, true);
ret = dcp->hw.s2r_dart_save_restore ?
apple_dart_display_streams_saved(dcp->s2r_disp_dart,
dcp_s2r_layout(dcp)->disp_streams,
false, true) :
apple_dart_display_streams(dcp->s2r_disp_dart,
dcp_s2r_layout(dcp)->disp_streams,
false, true);
if (ret)
return ret;
}

return apple_dart_display_streams(dcp->s2r_dcp_dart, dcp_s2r_layout(dcp)->dcp_streams,
return dcp->hw.s2r_dart_save_restore ?
apple_dart_display_streams_saved(dcp->s2r_dcp_dart,
dcp_s2r_layout(dcp)->dcp_streams,
false, true) :
apple_dart_display_streams(dcp->s2r_dcp_dart,
dcp_s2r_layout(dcp)->dcp_streams,
false, true);
}

Expand Down Expand Up @@ -11204,6 +11246,14 @@ static int dcp_s2r_dart_display_streams(struct device *dev, u32 streams, bool on
return apple_dart_display_streams(dev, streams, on, flush);
}

static int dcp_s2r_dart_streams(struct apple_dcp *dcp, struct device *dev, u32 streams,
bool on, bool flush)
{
if (dcp->hw.s2r_dart_save_restore)
return apple_dart_display_streams_saved(dev, streams, on, flush);
return dcp_s2r_dart_display_streams(dev, streams, on, flush);
}

static int dcp_s2r_ext_rtkit_wake(struct apple_dcp *dcp, void __iomem *control, bool cycled)
{
KUNIT_STATIC_STUB_REDIRECT(dcp_s2r_ext_rtkit_wake, dcp, control, cycled);
Expand Down Expand Up @@ -11231,14 +11281,13 @@ static int dcp_s2r_wake_darts(struct apple_dcp *dcp)
}
/* After the domains, whose writes it would reject, the DART protects them again. */
if (dcp->s2r_dcp_dart) {
ret = dcp_s2r_dart_display_streams(dcp->s2r_dcp_dart, l->dcp_streams, true, false);
ret = dcp_s2r_dart_streams(dcp, dcp->s2r_dcp_dart, l->dcp_streams, true, false);
if (ret)
return ret;
}
/* Set up again before the firmware runs, which uses it right away. */
if (dcp->hw.s2r_disp_dart_with_dcp && dcp->s2r_disp_dart)
return dcp_s2r_dart_display_streams(dcp->s2r_disp_dart, l->disp_streams, true,
false);
return dcp_s2r_dart_streams(dcp, dcp->s2r_disp_dart, l->disp_streams, true, false);

return 0;
}
Expand Down Expand Up @@ -11647,6 +11696,7 @@ static int dcp_s2r_resume(struct apple_dcp *dcp)
static bool dcp_ext_idle_capable(struct apple_dcp *dcp)
{
return dcp_s2r_ext_capable(dcp) &&
!dcp->hw.no_ext_idle &&
dcp->fw_compat == DCP_FIRMWARE_V_27_0 &&
dcp->fixed_connector_type == DRM_MODE_CONNECTOR_USB &&
!dcp->hdmi_hpd;
Expand Down Expand Up @@ -12998,6 +13048,10 @@ static const struct apple_dcp_hw_data apple_dcp_hw_t6030 = {
static const struct apple_dcp_hw_data apple_dcp_hw_t8122 = {
.iboot_handoff = "apple,t8122-handoff",
.num_dptx_ports = 2,
.afk_name_fallback = true,
/* Firmware 27.2's sleep: only with the DT's sleep arguments and display power words */
.v27_early_stop = true,
.s2r_layout = &dcp_s2r_t8122,
};

/* The internal panel only, through the 14.x IOMFB, as on T6030. */
Expand All @@ -13015,6 +13069,11 @@ static const struct apple_dcp_hw_data apple_dcp_hw_t8122_dcpext = {
.external_processor = true,
.num_dptx_ports = 2,
.fw_14_7_endpoints = true,
/* For firmware 27's s2r_ext, see dcp_platform_probe_pipe(). */
.no_ext_idle = true,
.s2r_no_secure_port = true,
.s2r_disp_dart_with_dcp = true,
.s2r_layout = &dcp_s2r_t8122_ext,
};

static const struct apple_dcp_hw_data apple_dcp_hw_dcpext = {
Expand Down
10 changes: 10 additions & 0 deletions drivers/iommu/apple-dart.c
Original file line number Diff line number Diff line change
Expand Up @@ -9352,6 +9352,16 @@ static int apple_dart_t8112_display_streams(struct apple_dart *dart, u32 streams
return 0;
}

int apple_dart_display_streams_saved(struct device *dev, u32 streams, bool on, bool flush)
{
struct apple_dart *dart = dev_get_drvdata(dev);

if (!dart)
return -ENODEV;
return apple_dart_t8112_display_streams(dart, streams, on, flush);
}
EXPORT_SYMBOL_GPL(apple_dart_display_streams_saved);

int apple_dart_display_streams(struct device *dev, u32 streams, bool on, bool flush)
{
struct apple_dart *dart = dev_get_drvdata(dev);
Expand Down
Loading
Loading