Commit 7bcf89ee authored by Ben Skeggs's avatar Ben Skeggs Committed by Dave Airlie

drm/nouveau/disp: split sor hda funcs out to their own struct

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
Reviewed-by: default avatarLyude Paul <lyude@redhat.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent 9a4514fb
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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);
......
......@@ -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
......
......@@ -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;
......
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment