Skip to content

Commit b6fa16a

Browse files
jannaumarcan
authored andcommitted
drm: apple: Add D129 allocate_bandwidth iomfb callback
Used on M2 Ultra During startup. Units are unclear. Signed-off-by: Janne Grunau <[email protected]>
1 parent f4266bb commit b6fa16a

3 files changed

Lines changed: 28 additions & 0 deletions

File tree

drivers/gpu/drm/apple/iomfb.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,21 @@ struct dcp_component_types {
127127
u8 types[7];
128128
} __packed;
129129

130+
struct dcp_allocate_bandwidth_req {
131+
u64 unk1;
132+
u64 unk2;
133+
u64 unk3;
134+
u8 unk1_null;
135+
u8 unk2_null;
136+
u8 padding[8];
137+
} __packed;
138+
139+
struct dcp_allocate_bandwidth_resp {
140+
u64 unk1;
141+
u64 unk2;
142+
u32 ret;
143+
} __packed;
144+
130145
struct dcp_rt_bandwidth {
131146
u64 unk1;
132147
u64 reg_scratch;

drivers/gpu/drm/apple/iomfb_template.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -652,6 +652,16 @@ static bool dcpep_cb_boot_1(struct apple_dcp *dcp, int tag, void *out, void *in)
652652
return false;
653653
}
654654

655+
static struct dcp_allocate_bandwidth_resp dcpep_cb_allocate_bandwidth(struct apple_dcp *dcp,
656+
struct dcp_allocate_bandwidth_req *req)
657+
{
658+
return (struct dcp_allocate_bandwidth_resp){
659+
.unk1 = req->unk1,
660+
.unk2 = req->unk2,
661+
.ret = 1,
662+
};
663+
}
664+
655665
static struct dcp_rt_bandwidth dcpep_cb_rt_bandwidth(struct apple_dcp *dcp)
656666
{
657667
if (dcp->disp_registers[5] && dcp->disp_registers[6]) {
@@ -1057,6 +1067,8 @@ TRAMPOLINE_INOUT(trampoline_prop_chunk, dcpep_cb_prop_chunk,
10571067
struct dcp_set_dcpav_prop_chunk_req, u8);
10581068
TRAMPOLINE_INOUT(trampoline_prop_end, dcpep_cb_prop_end,
10591069
struct dcp_set_dcpav_prop_end_req, u8);
1070+
TRAMPOLINE_INOUT(trampoline_allocate_bandwidth, dcpep_cb_allocate_bandwidth,
1071+
struct dcp_allocate_bandwidth_req, struct dcp_allocate_bandwidth_resp);
10601072
TRAMPOLINE_OUT(trampoline_rt_bandwidth, dcpep_cb_rt_bandwidth,
10611073
struct dcp_rt_bandwidth);
10621074
TRAMPOLINE_INOUT(trampoline_set_frame_sync_props, dcpep_cb_set_frame_sync_props,

drivers/gpu/drm/apple/iomfb_v13_3.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ static const iomfb_cb_handler cb_handlers[IOMFB_MAX_CB] = {
6262
[126] = trampoline_prop_start,
6363
[127] = trampoline_prop_chunk,
6464
[128] = trampoline_prop_end,
65+
[129] = trampoline_allocate_bandwidth,
6566
[201] = trampoline_map_piodma,
6667
[202] = trampoline_unmap_piodma,
6768
[206] = iomfbep_cb_match_pmu_service_2,

0 commit comments

Comments
 (0)