From 7bcf89eed48f3fba8d0e2c19236e7dc547b6e037 Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Wed, 1 Jun 2022 20:46:29 +1000 Subject: drm/nouveau/disp: split sor hda funcs out to their own struct Signed-off-by: Ben Skeggs Reviewed-by: Lyude Paul Signed-off-by: Dave Airlie --- drivers/gpu/drm/nouveau/nvkm/engine/disp/ga102.c | 6 +----- drivers/gpu/drm/nouveau/nvkm/engine/disp/gf119.c | 17 ++++++++++------- drivers/gpu/drm/nouveau/nvkm/engine/disp/gk104.c | 6 +----- drivers/gpu/drm/nouveau/nvkm/engine/disp/gm107.c | 6 +----- drivers/gpu/drm/nouveau/nvkm/engine/disp/gm200.c | 6 +----- drivers/gpu/drm/nouveau/nvkm/engine/disp/gp100.c | 6 +----- drivers/gpu/drm/nouveau/nvkm/engine/disp/gt215.c | 15 +++++++++------ drivers/gpu/drm/nouveau/nvkm/engine/disp/gv100.c | 15 +++++++++------ drivers/gpu/drm/nouveau/nvkm/engine/disp/ior.h | 11 +++++------ drivers/gpu/drm/nouveau/nvkm/engine/disp/mcp89.c | 5 +---- drivers/gpu/drm/nouveau/nvkm/engine/disp/rootnv50.c | 8 ++++---- drivers/gpu/drm/nouveau/nvkm/engine/disp/tu102.c | 6 +----- 12 files changed, 44 insertions(+), 63 deletions(-) (limited to 'drivers/gpu/drm') diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/ga102.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/ga102.c index 94a198407172..a9e2403da66c 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/ga102.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/ga102.c @@ -110,11 +110,7 @@ ga102_sor = { .scdc = gm200_sor_hdmi_scdc, }, .dp = &ga102_sor_dp, - .hda = { - .hpd = gf119_sor_hda_hpd, - .eld = gf119_sor_hda_eld, - .device_entry = gv100_sor_hda_device_entry, - }, + .hda = &gv100_sor_hda, }; static int diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/gf119.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/gf119.c index 44bf07d8e244..7e099e4f3c22 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/gf119.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/gf119.c @@ -33,7 +33,7 @@ #include -void +static void gf119_sor_hda_device_entry(struct nvkm_ior *ior, int head) { struct nvkm_device *device = ior->disp->engine.subdev.device; @@ -65,7 +65,7 @@ gf119_sor_hda_hpd(struct nvkm_ior *ior, int head, bool present) u32 mask = 0x80000001; if (present) { - ior->func->hda.device_entry(ior, head); + ior->func->hda->device_entry(ior, head); data |= 0x00000001; } else { mask |= 0x00000002; @@ -74,6 +74,13 @@ gf119_sor_hda_hpd(struct nvkm_ior *ior, int head, bool present) nvkm_mask(device, 0x10ec10 + soff, mask, data); } +const struct nvkm_ior_func_hda +gf119_sor_hda = { + .hpd = gf119_sor_hda_hpd, + .eld = gf119_sor_hda_eld, + .device_entry = gf119_sor_hda_device_entry, +}; + void gf119_sor_dp_watermark(struct nvkm_ior *sor, int head, u8 watermark) { @@ -302,11 +309,7 @@ gf119_sor = { .ctrl = gf119_sor_hdmi_ctrl, }, .dp = &gf119_sor_dp, - .hda = { - .hpd = gf119_sor_hda_hpd, - .eld = gf119_sor_hda_eld, - .device_entry = gf119_sor_hda_device_entry, - }, + .hda = &gf119_sor_hda, }; static int diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/gk104.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/gk104.c index b75c1a3abc1e..f8b58ee3a764 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/gk104.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/gk104.c @@ -96,11 +96,7 @@ gk104_sor = { .ctrl = gk104_sor_hdmi_ctrl, }, .dp = &gf119_sor_dp, - .hda = { - .hpd = gf119_sor_hda_hpd, - .eld = gf119_sor_hda_eld, - .device_entry = gf119_sor_hda_device_entry, - }, + .hda = &gf119_sor_hda, }; int diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/gm107.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/gm107.c index c9bf319c01d1..e96df705e79b 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/gm107.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/gm107.c @@ -74,11 +74,7 @@ gm107_sor = { .ctrl = gk104_sor_hdmi_ctrl, }, .dp = &gm107_sor_dp, - .hda = { - .hpd = gf119_sor_hda_hpd, - .eld = gf119_sor_hda_eld, - .device_entry = gf119_sor_hda_device_entry, - }, + .hda = &gf119_sor_hda, }; static int diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/gm200.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/gm200.c index 7cc6e82205ce..5a08c79dbb85 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/gm200.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/gm200.c @@ -136,11 +136,7 @@ gm200_sor = { .scdc = gm200_sor_hdmi_scdc, }, .dp = &gm200_sor_dp, - .hda = { - .hpd = gf119_sor_hda_hpd, - .eld = gf119_sor_hda_eld, - .device_entry = gf119_sor_hda_device_entry, - }, + .hda = &gf119_sor_hda, }; static int diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/gp100.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/gp100.c index 56a99217b740..a7cda46cfdb6 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/gp100.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/gp100.c @@ -42,11 +42,7 @@ gp100_sor = { .scdc = gm200_sor_hdmi_scdc, }, .dp = &gm200_sor_dp, - .hda = { - .hpd = gf119_sor_hda_hpd, - .eld = gf119_sor_hda_eld, - .device_entry = gf119_sor_hda_device_entry, - }, + .hda = &gf119_sor_hda, }; int diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/gt215.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/gt215.c index e01c0533bdf5..0b97b44e52e6 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/gt215.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/gt215.c @@ -31,7 +31,7 @@ #include -void +static void gt215_sor_hda_eld(struct nvkm_ior *ior, int head, u8 *data, u8 size) { struct nvkm_device *device = ior->disp->engine.subdev.device; @@ -45,7 +45,7 @@ gt215_sor_hda_eld(struct nvkm_ior *ior, int head, u8 *data, u8 size) nvkm_mask(device, 0x61c448 + soff, 0x80000002, 0x80000002); } -void +static void gt215_sor_hda_hpd(struct nvkm_ior *ior, int head, bool present) { struct nvkm_device *device = ior->disp->engine.subdev.device; @@ -58,6 +58,12 @@ gt215_sor_hda_hpd(struct nvkm_ior *ior, int head, bool present) nvkm_mask(device, 0x61c448 + ior->id * 0x800, mask, data); } +const struct nvkm_ior_func_hda +gt215_sor_hda = { + .hpd = gt215_sor_hda_hpd, + .eld = gt215_sor_hda_eld, +}; + void gt215_sor_dp_audio(struct nvkm_ior *sor, int head, bool enable) { @@ -162,10 +168,7 @@ gt215_sor = { .ctrl = gt215_sor_hdmi_ctrl, }, .dp = >215_sor_dp, - .hda = { - .hpd = gt215_sor_hda_hpd, - .eld = gt215_sor_hda_eld, - }, + .hda = >215_sor_hda, }; static int diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/gv100.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/gv100.c index 81c01a1bf92e..1708e0e3332e 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/gv100.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/gv100.c @@ -36,7 +36,7 @@ #include #include -void +static void gv100_sor_hda_device_entry(struct nvkm_ior *ior, int head) { struct nvkm_device *device = ior->disp->engine.subdev.device; @@ -45,6 +45,13 @@ gv100_sor_hda_device_entry(struct nvkm_ior *ior, int head) nvkm_mask(device, 0x616528 + hoff, 0x00000070, head << 4); } +const struct nvkm_ior_func_hda +gv100_sor_hda = { + .hpd = gf119_sor_hda_hpd, + .eld = gf119_sor_hda_eld, + .device_entry = gv100_sor_hda_device_entry, +}; + void gv100_sor_dp_watermark(struct nvkm_ior *sor, int head, u8 watermark) { @@ -190,11 +197,7 @@ gv100_sor = { .scdc = gm200_sor_hdmi_scdc, }, .dp = &gv100_sor_dp, - .hda = { - .hpd = gf119_sor_hda_hpd, - .eld = gf119_sor_hda_eld, - .device_entry = gv100_sor_hda_device_entry, - }, + .hda = &gv100_sor_hda, }; static int diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/ior.h b/drivers/gpu/drm/nouveau/nvkm/engine/disp/ior.h index 5b49f7bd2c46..671c4674ffcc 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/ior.h +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/ior.h @@ -86,11 +86,11 @@ struct nvkm_ior_func { void (*watermark)(struct nvkm_ior *, int head, u8 watermark); } *dp; - struct { + const struct nvkm_ior_func_hda { void (*hpd)(struct nvkm_ior *, int head, bool present); void (*eld)(struct nvkm_ior *, int head, u8 *data, u8 size); void (*device_entry)(struct nvkm_ior *, int head); - } hda; + } *hda; }; int nvkm_ior_new_(const struct nvkm_ior_func *func, struct nvkm_disp *, @@ -139,8 +139,7 @@ void g94_sor_dp_watermark(struct nvkm_ior *, int, u8); void gt215_sor_hdmi_ctrl(struct nvkm_ior *, int, bool, u8, u8, u8 *, u8 , u8 *, u8); void gt215_sor_dp_audio(struct nvkm_ior *, int, bool); -void gt215_sor_hda_hpd(struct nvkm_ior *, int, bool); -void gt215_sor_hda_eld(struct nvkm_ior *, int, u8 *, u8); +extern const struct nvkm_ior_func_hda gt215_sor_hda; int gf119_sor_cnt(struct nvkm_disp *, unsigned long *); void gf119_sor_state(struct nvkm_ior *, struct nvkm_ior_state *); @@ -152,9 +151,9 @@ void gf119_sor_dp_vcpi(struct nvkm_ior *, int, u8, u8, u16, u16); void gf119_sor_dp_audio(struct nvkm_ior *, int, bool); void gf119_sor_dp_audio_sym(struct nvkm_ior *, int, u16, u32); void gf119_sor_dp_watermark(struct nvkm_ior *, int, u8); +extern const struct nvkm_ior_func_hda gf119_sor_hda; void gf119_sor_hda_hpd(struct nvkm_ior *, int, bool); void gf119_sor_hda_eld(struct nvkm_ior *, int, u8 *, u8); -void gf119_sor_hda_device_entry(struct nvkm_ior *, int); int gk104_sor_new(struct nvkm_disp *, int); void gk104_sor_hdmi_ctrl(struct nvkm_ior *, int, bool, u8, u8, u8 *, u8 , u8 *, u8); @@ -175,7 +174,7 @@ void gv100_sor_hdmi_ctrl(struct nvkm_ior *, int, bool, u8, u8, u8 *, u8 , u8 *, void gv100_sor_dp_audio(struct nvkm_ior *, int, bool); void gv100_sor_dp_audio_sym(struct nvkm_ior *, int, u16, u32); void gv100_sor_dp_watermark(struct nvkm_ior *, int, u8); -void gv100_sor_hda_device_entry(struct nvkm_ior *, int); +extern const struct nvkm_ior_func_hda gv100_sor_hda; void tu102_sor_dp_vcpi(struct nvkm_ior *, int, u8, u8, u16, u16); diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/mcp89.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/mcp89.c index ab359deb1520..0e921a87f10d 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/mcp89.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/mcp89.c @@ -48,10 +48,7 @@ mcp89_sor = { .ctrl = gt215_sor_hdmi_ctrl, }, .dp = &mcp89_sor_dp, - .hda = { - .hpd = gt215_sor_hda_hpd, - .eld = gt215_sor_hda_eld, - }, + .hda = >215_sor_hda, }; static int diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/rootnv50.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/rootnv50.c index a23040d26079..0a28db5b75e7 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/rootnv50.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/rootnv50.c @@ -146,18 +146,18 @@ nv50_disp_root_mthd_(struct nvkm_object *object, u32 mthd, void *data, u32 size) } else return ret; - if (!ior->func->hda.hpd) + if (!ior->hda) return -ENODEV; if (size && args->v0.data[0]) { if (outp->info.type == DCB_OUTPUT_DP) ior->func->dp->audio(ior, hidx, true); - ior->func->hda.hpd(ior, hidx, true); - ior->func->hda.eld(ior, hidx, data, size); + ior->func->hda->hpd(ior, hidx, true); + ior->func->hda->eld(ior, hidx, data, size); } else { if (outp->info.type == DCB_OUTPUT_DP) ior->func->dp->audio(ior, hidx, false); - ior->func->hda.hpd(ior, hidx, false); + ior->func->hda->hpd(ior, hidx, false); } return 0; diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/tu102.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/tu102.c index 236176573cee..c85bde64fb76 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/tu102.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/tu102.c @@ -93,11 +93,7 @@ tu102_sor = { .scdc = gm200_sor_hdmi_scdc, }, .dp = &tu102_sor_dp, - .hda = { - .hpd = gf119_sor_hda_hpd, - .eld = gf119_sor_hda_eld, - .device_entry = gv100_sor_hda_device_entry, - }, + .hda = &gv100_sor_hda, }; static int -- cgit v1.2.3