diff --git a/Documentation/devicetree/bindings/display/apple,dcp.yaml b/Documentation/devicetree/bindings/display/apple,dcp.yaml index 497dfc96845b6..822b1608cabe4 100644 --- a/Documentation/devicetree/bindings/display/apple,dcp.yaml +++ b/Documentation/devicetree/bindings/display/apple,dcp.yaml @@ -730,7 +730,7 @@ allOf: properties: compatible: contains: - enum: ['apple,t6031-dcp', 'apple,t8132-dcp', 'apple,t8132-dcpext'] + enum: ['apple,t8132-dcp', 'apple,t8132-dcpext'] - not: properties: status: diff --git a/arch/arm64/boot/dts/apple/t6031-dcp.dtsi b/arch/arm64/boot/dts/apple/t6031-dcp.dtsi index f4099fe1504f8..bc92c519843d1 100644 --- a/arch/arm64/boot/dts/apple/t6031-dcp.dtsi +++ b/arch/arm64/boot/dts/apple/t6031-dcp.dtsi @@ -87,7 +87,9 @@ <0x3 0x86850000 0x0 0x4000>; power-domains = <&ps_disp_fe>; clocks = <&clk_disp0>; - /* The 14.x firmware runs once the PMP acknowledges this request. */ + /* PTD bandwidth request entry 577 in the disp-5 update window. */ + apple,bw-scratch = <&pmgr_dcp 0 5 0x1208>; + /* The 14.x/27.2 firmware runs once the PMP acknowledges this request. */ apple,pmp-report = <&pmp_report_disp>; #address-cells = <2>; #size-cells = <2>; diff --git a/drivers/gpu/drm/apple/dcp.c b/drivers/gpu/drm/apple/dcp.c index eb76920e0ea28..5b7e482bdb715 100644 --- a/drivers/gpu/drm/apple/dcp.c +++ b/drivers/gpu/drm/apple/dcp.c @@ -13000,10 +13000,12 @@ static const struct apple_dcp_hw_data apple_dcp_hw_t8122 = { .num_dptx_ports = 2, }; -/* The internal panel only, through the 14.x IOMFB, as on T6030. */ +/* The internal panel only, through the 14.x or 27.2 IOMFB, as on T6030. */ static const struct apple_dcp_hw_data apple_dcp_hw_t6031 = { .iboot_handoff = "apple,t6031-handoff", .num_dptx_ports = 1, + .afk_name_fallback = true, + .only_120hz_modes = true, }; static const struct apple_dcp_hw_data apple_dcp_hw_t6030_dcpext = { diff --git a/drivers/gpu/drm/apple/iomfb.c b/drivers/gpu/drm/apple/iomfb.c index f0a4c291f58f8..358be58290017 100644 --- a/drivers/gpu/drm/apple/iomfb.c +++ b/drivers/gpu/drm/apple/iomfb.c @@ -3893,13 +3893,14 @@ static bool dcp_mode_settable(struct apple_dcp *dcp, return dcp_mode->mode.type & DRM_MODE_TYPE_PREFERRED; /* - * The T6050 internal DCP (M5 Max, K114s) crashes on a mode set away - * from the timing iBoot left the panel at: 120 -> 60 Hz, and 60 -> - * 120 Hz when macOS left it at 60 Hz. Offer only the rate the - * firmware reported at start (dcp_rtk_syslog_boot_rate()), 120 Hz - * when it reported none. + * The T6050 (M5 Max, K114s) and firmware-27 T6031 (M3 Max) internal + * DCPs crash on a mode set away from the timing iBoot left the panel + * at: 120 -> 60 Hz, and 60 -> 120 Hz when macOS left it at 60 Hz. + * Offer only the rate the firmware reported at start + * (dcp_rtk_syslog_boot_rate()), 120 Hz when it reported none. */ if (dcp->hw.only_120hz_modes && + dcp->fw_compat == DCP_FIRMWARE_V_27_0 && drm_mode_vrefresh(mode) != (READ_ONCE(dcp->boot_rate) ?: 120)) return false; diff --git a/drivers/gpu/drm/apple/parser-test.c b/drivers/gpu/drm/apple/parser-test.c index 340e1157108d6..33cccbabf93f5 100644 --- a/drivers/gpu/drm/apple/parser-test.c +++ b/drivers/gpu/drm/apple/parser-test.c @@ -2142,6 +2142,12 @@ static void parser_internal_v27_only_120hz(struct kunit *test) KUNIT_EXPECT_EQ(test, dcp_mode_valid(&connector->base, &catalog[1].mode), MODE_OK); dcp->boot_rate = 0; + /* Firmware 14.7 on a shared profile (T6031) keeps every fixed rate. */ + dcp->fw_compat = DCP_FIRMWARE_V_14_7; + KUNIT_EXPECT_EQ(test, dcp_mode_valid(&connector->base, &catalog[0].mode), MODE_OK); + KUNIT_EXPECT_EQ(test, dcp_mode_valid(&connector->base, &catalog[1].mode), MODE_OK); + dcp->fw_compat = DCP_FIRMWARE_V_27_0; + /* The T8142 Air internal DCP (60 Hz panel, firmware 27.0) and the T6050 dcpext keep every mode. */ dcp->hw.only_120hz_modes = false; KUNIT_EXPECT_EQ(test, dcp_mode_valid(&connector->base, &catalog[0].mode), MODE_OK); diff --git a/drivers/soc/apple/display-gate-test.c b/drivers/soc/apple/display-gate-test.c index b542bbd79c372..0193c18dac9a2 100644 --- a/drivers/soc/apple/display-gate-test.c +++ b/drivers/soc/apple/display-gate-test.c @@ -543,6 +543,17 @@ static void __init gate_t6031_other_pmp_image(struct kunit *test) gt_expect_untouched(test); } +/* The 27.2 (26B123) T6031 PMP image is taken as well. */ +static void __init gate_t6031_pmp_image_27_2(struct kunit *test) +{ + struct gate_test *t = test->priv; + + t->pmp_uuid = "5135AF78-00F4-3217-9DA3-B33A2B9CCA70"; + gt_set_string(test, gt_t6031.values, "apple,tunable-uuid", t->pmp_uuid); + gt_run(test); + gt_expect_enabled(test); +} + /* The DCP on DISP_CPU, as on T6030, is not the T6031 power layout. */ static void __init gate_t6031_t6030_power_layout(struct kunit *test) { @@ -1056,6 +1067,7 @@ static struct kunit_case gate_t6031_cases[] __refdata = { KUNIT_CASE(gate_t6031_incomplete_pmp_values), KUNIT_CASE(gate_t6031_t6030_pmp_image), KUNIT_CASE(gate_t6031_other_pmp_image), + KUNIT_CASE(gate_t6031_pmp_image_27_2), KUNIT_CASE(gate_t6031_t6030_power_layout), KUNIT_CASE(gate_t6031_not_inherited_on), KUNIT_CASE(gate_t6031_no_report_pmp_link), diff --git a/drivers/soc/apple/display-gate.c b/drivers/soc/apple/display-gate.c index 6bc8de49503f8..20fce87740efb 100644 --- a/drivers/soc/apple/display-gate.c +++ b/drivers/soc/apple/display-gate.c @@ -187,11 +187,21 @@ static const char gate_t8122_pmp_uuid[] __initconst = "3B18C886-4C70-349B-B1C4-7 static const char gate_t8122_pmp_uuid_27_2[] __initconst = "C6CCB960-AC83-34A2-9493-C3131BD5AE4B"; /* - * The T6031 PMP image, as the J516C ADT names it (iop-pmp-nub, passed on by - * the boot loader in /chosen/asahi,t6031-pmp). It is not the T6030 image. + * The T6031 PMP image of the 14.x system firmware, as the J516C ADT names it + * (iop-pmp-nub, passed on by the boot loader in /chosen/asahi,t6031-pmp). It + * is not the T6030 image. */ static const char gate_t6031_pmp_uuid[] __initconst = "07FF4C5B-CB2E-3DE6-95FF-3B107D19B7AB"; +/* + * The T6031 PMP image of the 27.2 (26B123) system firmware, as the J516C ADT + * names it (iop-pmp0-nub). Its PTD map keeps SOC-DEV-PS-REQ (0x200), PS-ACK + * (0x208) and PMP-STATUS (0x1) at the 14.7 offsets and its 35 soc-device + * records stay in ID order (DISPINT at 0x10, ANS at 0x21), so the same PMP + * support takes either image. + */ +static const char gate_t6031_pmp_uuid_27_2[] __initconst = "5135AF78-00F4-3217-9DA3-B33A2B9CCA70"; + /* One SoC's internal display handoff, as the gate checks and completes it */ struct gate_soc { const char *machine; /* root compatible */ @@ -290,8 +300,8 @@ static const struct gate_soc gate_t8122 __initconst = { * T6031 (M3 Max): the T6030 handoff at the T6031 addresses, on every board * whose boot loader marks it, with no command-line switch. The PMP values * must come from the boot - * loader: there is no built-in fallback. The PMP image is T6031's own; - * any other, the T6030 image included, is refused. The report driver checks + * loader: there is no built-in fallback. The PMP image is T6031's own + * (14.x or 27.2); any other, the T6030 image included, is refused. The report driver checks * the image's SRAM layout before it starts the PMP. The internal display's * PMP request is bit 0x10. */ @@ -306,6 +316,7 @@ static const struct gate_soc gate_t6031 __initconst = { .dcp_full_name = "dcp@386c00000", .pmp_values = "/chosen/asahi,t6031-pmp", .pmp_uuid = gate_t6031_pmp_uuid, + .pmp_uuid_alt = gate_t6031_pmp_uuid_27_2, .report_compat = "apple,t6031-pmp-v2-report", .disp_entry = "report@10", .reuse_pmp = true, diff --git a/tools/testing/selftests/drivers/gpu/apple-dcp/boot.py b/tools/testing/selftests/drivers/gpu/apple-dcp/boot.py index 92e7f09277cab..8d067976f7e33 100644 --- a/tools/testing/selftests/drivers/gpu/apple-dcp/boot.py +++ b/tools/testing/selftests/drivers/gpu/apple-dcp/boot.py @@ -425,8 +425,8 @@ def v27_panel_handoff(root): const char *iboot_handoff; unsigned num_dptx_ports; u8 firmware_dma_bits; - /* Set in the T6030 profile, not read by dcp_apply_dt_profile(). */ - bool afk_name_fallback, v27_early_stop; + /* Set in the T6030/T6031 profiles, not read by dcp_apply_dt_profile(). */ + bool afk_name_fallback, v27_early_stop, only_120hz_modes; const struct dcp_s2r_layout *s2r_layout; }; struct apple_dcp {