Commit 7df1bb87 authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau/disp/nv50-: avoid creating ORs that aren't present on HW

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent 5499473c
...@@ -58,5 +58,8 @@ gf119_dac = { ...@@ -58,5 +58,8 @@ gf119_dac = {
int int
gf119_dac_new(struct nvkm_disp *disp, int id) gf119_dac_new(struct nvkm_disp *disp, int id)
{ {
struct nvkm_device *device = disp->engine.subdev.device;
if (!(nvkm_rd32(device, 0x612004) & (0x00000010 << id)))
return 0;
return nvkm_ior_new_(&gf119_dac, disp, DAC, id); return nvkm_ior_new_(&gf119_dac, disp, DAC, id);
} }
...@@ -109,5 +109,8 @@ nv50_dac = { ...@@ -109,5 +109,8 @@ nv50_dac = {
int int
nv50_dac_new(struct nvkm_disp *disp, int id) nv50_dac_new(struct nvkm_disp *disp, int id)
{ {
struct nvkm_device *device = disp->engine.subdev.device;
if (!(nvkm_rd32(device, 0x610184) & (0x00100000 << id)))
return 0;
return nvkm_ior_new_(&nv50_dac, disp, DAC, id); return nvkm_ior_new_(&nv50_dac, disp, DAC, id);
} }
...@@ -104,6 +104,7 @@ nv50_sor_link(struct nvkm_ior *ior) ...@@ -104,6 +104,7 @@ nv50_sor_link(struct nvkm_ior *ior)
return nv50_ior_base(ior) + ((ior->asy.link == 2) * 0x80); return nv50_ior_base(ior) + ((ior->asy.link == 2) * 0x80);
} }
int nv50_sor_new_(const struct nvkm_ior_func *, struct nvkm_disp *, int id);
void nv50_sor_state(struct nvkm_ior *, struct nvkm_ior_state *); void nv50_sor_state(struct nvkm_ior *, struct nvkm_ior_state *);
void nv50_sor_power(struct nvkm_ior *, bool, bool, bool, bool, bool); void nv50_sor_power(struct nvkm_ior *, bool, bool, bool, bool, bool);
void nv50_sor_clock(struct nvkm_ior *); void nv50_sor_clock(struct nvkm_ior *);
...@@ -119,6 +120,7 @@ void g94_sor_dp_watermark(struct nvkm_ior *, int, u8); ...@@ -119,6 +120,7 @@ void g94_sor_dp_watermark(struct nvkm_ior *, int, u8);
void gt215_sor_dp_audio(struct nvkm_ior *, int, bool); void gt215_sor_dp_audio(struct nvkm_ior *, int, bool);
int gf119_sor_new_(const struct nvkm_ior_func *, struct nvkm_disp *, int id);
void gf119_sor_state(struct nvkm_ior *, struct nvkm_ior_state *); void gf119_sor_state(struct nvkm_ior *, struct nvkm_ior_state *);
void gf119_sor_clock(struct nvkm_ior *); void gf119_sor_clock(struct nvkm_ior *);
int gf119_sor_dp_links(struct nvkm_ior *, struct nvkm_i2c_aux *); int gf119_sor_dp_links(struct nvkm_ior *, struct nvkm_i2c_aux *);
......
...@@ -127,5 +127,8 @@ nv50_pior = { ...@@ -127,5 +127,8 @@ nv50_pior = {
int int
nv50_pior_new(struct nvkm_disp *disp, int id) nv50_pior_new(struct nvkm_disp *disp, int id)
{ {
struct nvkm_device *device = disp->engine.subdev.device;
if (!(nvkm_rd32(device, 0x610184) & (0x10000000 << id)))
return 0;
return nvkm_ior_new_(&nv50_pior, disp, PIOR, id); return nvkm_ior_new_(&nv50_pior, disp, PIOR, id);
} }
...@@ -34,5 +34,5 @@ g84_sor = { ...@@ -34,5 +34,5 @@ g84_sor = {
int int
g84_sor_new(struct nvkm_disp *disp, int id) g84_sor_new(struct nvkm_disp *disp, int id)
{ {
return nvkm_ior_new_(&g84_sor, disp, SOR, id); return nv50_sor_new_(&g84_sor, disp, id);
} }
...@@ -279,5 +279,5 @@ g94_sor = { ...@@ -279,5 +279,5 @@ g94_sor = {
int int
g94_sor_new(struct nvkm_disp *disp, int id) g94_sor_new(struct nvkm_disp *disp, int id)
{ {
return nvkm_ior_new_(&g94_sor, disp, SOR, id); return nv50_sor_new_(&g94_sor, disp, id);
} }
...@@ -152,6 +152,15 @@ gf119_sor_state(struct nvkm_ior *sor, struct nvkm_ior_state *state) ...@@ -152,6 +152,15 @@ gf119_sor_state(struct nvkm_ior *sor, struct nvkm_ior_state *state)
state->head = ctrl & 0x0000000f; state->head = ctrl & 0x0000000f;
} }
int
gf119_sor_new_(const struct nvkm_ior_func *func, struct nvkm_disp *disp, int id)
{
struct nvkm_device *device = disp->engine.subdev.device;
if (!(nvkm_rd32(device, 0x612004) & (0x00000100 << id)))
return 0;
return nvkm_ior_new_(func, disp, SOR, id);
}
static const struct nvkm_ior_func static const struct nvkm_ior_func
gf119_sor = { gf119_sor = {
.state = gf119_sor_state, .state = gf119_sor_state,
...@@ -179,5 +188,5 @@ gf119_sor = { ...@@ -179,5 +188,5 @@ gf119_sor = {
int int
gf119_sor_new(struct nvkm_disp *disp, int id) gf119_sor_new(struct nvkm_disp *disp, int id)
{ {
return nvkm_ior_new_(&gf119_sor, disp, SOR, id); return gf119_sor_new_(&gf119_sor, disp, id);
} }
...@@ -49,5 +49,5 @@ gk104_sor = { ...@@ -49,5 +49,5 @@ gk104_sor = {
int int
gk104_sor_new(struct nvkm_disp *disp, int id) gk104_sor_new(struct nvkm_disp *disp, int id)
{ {
return nvkm_ior_new_(&gk104_sor, disp, SOR, id); return gf119_sor_new_(&gk104_sor, disp, id);
} }
...@@ -63,5 +63,5 @@ gm107_sor = { ...@@ -63,5 +63,5 @@ gm107_sor = {
int int
gm107_sor_new(struct nvkm_disp *disp, int id) gm107_sor_new(struct nvkm_disp *disp, int id)
{ {
return nvkm_ior_new_(&gm107_sor, disp, SOR, id); return gf119_sor_new_(&gm107_sor, disp, id);
} }
...@@ -120,5 +120,5 @@ gm200_sor = { ...@@ -120,5 +120,5 @@ gm200_sor = {
int int
gm200_sor_new(struct nvkm_disp *disp, int id) gm200_sor_new(struct nvkm_disp *disp, int id)
{ {
return nvkm_ior_new_(&gm200_sor, disp, SOR, id); return gf119_sor_new_(&gm200_sor, disp, id);
} }
...@@ -65,5 +65,5 @@ gt215_sor = { ...@@ -65,5 +65,5 @@ gt215_sor = {
int int
gt215_sor_new(struct nvkm_disp *disp, int id) gt215_sor_new(struct nvkm_disp *disp, int id)
{ {
return nvkm_ior_new_(&gt215_sor, disp, SOR, id); return nv50_sor_new_(&gt215_sor, disp, id);
} }
...@@ -44,5 +44,5 @@ mcp77_sor = { ...@@ -44,5 +44,5 @@ mcp77_sor = {
int int
mcp77_sor_new(struct nvkm_disp *disp, int id) mcp77_sor_new(struct nvkm_disp *disp, int id)
{ {
return nvkm_ior_new_(&mcp77_sor, disp, SOR, id); return nv50_sor_new_(&mcp77_sor, disp, id);
} }
...@@ -49,5 +49,5 @@ mcp89_sor = { ...@@ -49,5 +49,5 @@ mcp89_sor = {
int int
mcp89_sor_new(struct nvkm_disp *disp, int id) mcp89_sor_new(struct nvkm_disp *disp, int id)
{ {
return nvkm_ior_new_(&mcp89_sor, disp, SOR, id); return nv50_sor_new_(&mcp89_sor, disp, id);
} }
...@@ -84,6 +84,15 @@ nv50_sor_state(struct nvkm_ior *sor, struct nvkm_ior_state *state) ...@@ -84,6 +84,15 @@ nv50_sor_state(struct nvkm_ior *sor, struct nvkm_ior_state *state)
state->head = ctrl & 0x00000003; state->head = ctrl & 0x00000003;
} }
int
nv50_sor_new_(const struct nvkm_ior_func *func, struct nvkm_disp *disp, int id)
{
struct nvkm_device *device = disp->engine.subdev.device;
if (!(nvkm_rd32(device, 0x610184) & (0x01000000 << id)))
return 0;
return nvkm_ior_new_(func, disp, SOR, id);
}
static const struct nvkm_ior_func static const struct nvkm_ior_func
nv50_sor = { nv50_sor = {
.state = nv50_sor_state, .state = nv50_sor_state,
...@@ -94,5 +103,5 @@ nv50_sor = { ...@@ -94,5 +103,5 @@ nv50_sor = {
int int
nv50_sor_new(struct nvkm_disp *disp, int id) nv50_sor_new(struct nvkm_disp *disp, int id)
{ {
return nvkm_ior_new_(&nv50_sor, disp, SOR, id); return nv50_sor_new_(&nv50_sor, disp, id);
} }
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