]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
drm/nouveau/disp: split sor hda funcs out to their own struct
authorBen Skeggs <bskeggs@redhat.com>
Wed, 1 Jun 2022 10:46:29 +0000 (20:46 +1000)
committerDave Airlie <airlied@redhat.com>
Tue, 26 Jul 2022 23:05:48 +0000 (09:05 +1000)
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 files changed:
drivers/gpu/drm/nouveau/nvkm/engine/disp/ga102.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/gf119.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/gk104.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/gm107.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/gm200.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/gp100.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/gt215.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/gv100.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/ior.h
drivers/gpu/drm/nouveau/nvkm/engine/disp/mcp89.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/rootnv50.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/tu102.c

index 94a1984071722c54e7a7c925cf761c3842a6bac6..a9e2403da66c7d3a26ed9cc68774c3ad4a9175c8 100644 (file)
@@ -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
index 44bf07d8e244821cb2b312d516ad12d9ef6731d9..7e099e4f3c229ab9dac75fa3ded18b17a04a68b6 100644 (file)
@@ -33,7 +33,7 @@
 
 #include <nvif/class.h>
 
-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
index b75c1a3abc1edbd80ca163344e173bb3739bb5c2..f8b58ee3a76488240d7600951c632b0697a9ed23 100644 (file)
@@ -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
index c9bf319c01d1362dec955b03bc77eee21c17f06b..e96df705e79bae75a64e712efbc079634b7b1e89 100644 (file)
@@ -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
index 7cc6e82205ce41cd1c904c3dde091c7036993ceb..5a08c79dbb852db00aee4351089363cf49462b8b 100644 (file)
@@ -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
index 56a99217b740a6094cea4d8e47e4a47bc3af2906..a7cda46cfdb63a9b92eb14c0b864b19770be5c95 100644 (file)
@@ -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
index e01c0533bdf56a0c88508cd34675bc9d19845236..0b97b44e52e624d1fda9bda9c35edc41788a5966 100644 (file)
@@ -31,7 +31,7 @@
 
 #include <nvif/class.h>
 
-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 = &gt215_sor_dp,
-       .hda = {
-               .hpd = gt215_sor_hda_hpd,
-               .eld = gt215_sor_hda_eld,
-       },
+       .hda = &gt215_sor_hda,
 };
 
 static int
index 81c01a1bf92ef5ffc00647d82723337a4f5294fe..1708e0e3332e95db6b8fcaf74a12c525d92d5da4 100644 (file)
@@ -36,7 +36,7 @@
 #include <nvif/clc37e.h>
 #include <nvif/unpack.h>
 
-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
index 5b49f7bd2c469a99f942001f734a15e455f7cd50..671c4674ffcc3f1b0c8264514b5b20fb44da0879 100644 (file)
@@ -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);
 
index ab359deb1520f83d888c016553614f6ccc432477..0e921a87f10d8a17604638d4fc583438b2e341c5 100644 (file)
@@ -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 = &gt215_sor_hda,
 };
 
 static int
index a23040d26079ae42c83c7053327cfed9f0260f61..0a28db5b75e793903a647ddf2496af08d7a2307f 100644 (file)
@@ -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;
index 236176573cee3828011a7bb1ca42f568e50741cc..c85bde64fb76fd160f72f59e8198a03785542253 100644 (file)
@@ -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