Commit 46c13c13 authored by Ben Skeggs's avatar Ben Skeggs

drm/nv50-/disp: 0x0000 is a valid udisp config value

Return an out-of-range value instead to signal a failure from
exec_clkcmp().
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent ac8cc241
...@@ -863,8 +863,8 @@ exec_clkcmp(struct nv50_disp_priv *priv, int head, int id, u32 pclk, ...@@ -863,8 +863,8 @@ exec_clkcmp(struct nv50_disp_priv *priv, int head, int id, u32 pclk,
struct nvbios_outp info1; struct nvbios_outp info1;
struct nvbios_ocfg info2; struct nvbios_ocfg info2;
u8 ver, hdr, cnt, len; u8 ver, hdr, cnt, len;
u16 data, conf;
u32 ctrl = 0x00000000; u32 ctrl = 0x00000000;
u32 data, conf = ~0;
int i; int i;
for (i = 0; !(ctrl & (1 << head)) && i < 3; i++) for (i = 0; !(ctrl & (1 << head)) && i < 3; i++)
...@@ -885,12 +885,12 @@ exec_clkcmp(struct nv50_disp_priv *priv, int head, int id, u32 pclk, ...@@ -885,12 +885,12 @@ exec_clkcmp(struct nv50_disp_priv *priv, int head, int id, u32 pclk,
} }
if (!(ctrl & (1 << head))) if (!(ctrl & (1 << head)))
return 0x0000; return conf;
i--; i--;
data = exec_lookup(priv, head, i, ctrl, outp, &ver, &hdr, &cnt, &len, &info1); data = exec_lookup(priv, head, i, ctrl, outp, &ver, &hdr, &cnt, &len, &info1);
if (!data) if (!data)
return 0x0000; return conf;
switch (outp->type) { switch (outp->type) {
case DCB_OUTPUT_TMDS: case DCB_OUTPUT_TMDS:
...@@ -923,13 +923,11 @@ exec_clkcmp(struct nv50_disp_priv *priv, int head, int id, u32 pclk, ...@@ -923,13 +923,11 @@ exec_clkcmp(struct nv50_disp_priv *priv, int head, int id, u32 pclk,
.execute = 1, .execute = 1,
}; };
if (nvbios_exec(&init)) nvbios_exec(&init);
return 0x0000;
return conf;
} }
} }
return 0x0000; return conf;
} }
static void static void
...@@ -1082,7 +1080,7 @@ nv50_disp_intr_unk20(struct nv50_disp_priv *priv, u32 super) ...@@ -1082,7 +1080,7 @@ nv50_disp_intr_unk20(struct nv50_disp_priv *priv, u32 super)
if (head >= 0) { if (head >= 0) {
u32 pclk = nv_rd32(priv, 0x610ad0 + (head * 0x540)) & 0x3fffff; u32 pclk = nv_rd32(priv, 0x610ad0 + (head * 0x540)) & 0x3fffff;
u32 conf = exec_clkcmp(priv, head, 0, pclk, &outp); u32 conf = exec_clkcmp(priv, head, 0, pclk, &outp);
if (conf) { if (conf != ~0) {
if (outp.type == DCB_OUTPUT_ANALOG) { if (outp.type == DCB_OUTPUT_ANALOG) {
addr = 0x614280 + (ffs(outp.or) - 1) * 0x800; addr = 0x614280 + (ffs(outp.or) - 1) * 0x800;
mask = 0xffffffff; mask = 0xffffffff;
...@@ -1132,7 +1130,7 @@ nv50_disp_intr_unk40(struct nv50_disp_priv *priv, u32 super) ...@@ -1132,7 +1130,7 @@ nv50_disp_intr_unk40(struct nv50_disp_priv *priv, u32 super)
if (head >= 0) { if (head >= 0) {
struct dcb_output outp; struct dcb_output outp;
u32 pclk = nv_rd32(priv, 0x610ad0 + (head * 0x540)) & 0x3fffff; u32 pclk = nv_rd32(priv, 0x610ad0 + (head * 0x540)) & 0x3fffff;
if (pclk && exec_clkcmp(priv, head, 1, pclk, &outp)) { if (exec_clkcmp(priv, head, 1, pclk, &outp) != ~0) {
if (outp.type == DCB_OUTPUT_TMDS) if (outp.type == DCB_OUTPUT_TMDS)
nv50_disp_intr_unk40_tmds(priv, &outp); nv50_disp_intr_unk40_tmds(priv, &outp);
} }
......
...@@ -657,11 +657,11 @@ exec_clkcmp(struct nv50_disp_priv *priv, int head, int outp, ...@@ -657,11 +657,11 @@ exec_clkcmp(struct nv50_disp_priv *priv, int head, int outp,
struct nvbios_ocfg info2; struct nvbios_ocfg info2;
struct dcb_output dcb; struct dcb_output dcb;
u8 ver, hdr, cnt, len; u8 ver, hdr, cnt, len;
u16 data, conf; u32 data, conf = ~0;
data = exec_lookup(priv, head, outp, ctrl, &dcb, &ver, &hdr, &cnt, &len, &info1); data = exec_lookup(priv, head, outp, ctrl, &dcb, &ver, &hdr, &cnt, &len, &info1);
if (data == 0x0000) if (data == 0x0000)
return false; return conf;
switch (dcb.type) { switch (dcb.type) {
case DCB_OUTPUT_TMDS: case DCB_OUTPUT_TMDS:
...@@ -694,13 +694,11 @@ exec_clkcmp(struct nv50_disp_priv *priv, int head, int outp, ...@@ -694,13 +694,11 @@ exec_clkcmp(struct nv50_disp_priv *priv, int head, int outp,
.execute = 1, .execute = 1,
}; };
if (nvbios_exec(&init)) nvbios_exec(&init);
return 0x0000;
return conf;
} }
} }
return 0x0000; return conf;
} }
static void static void
...@@ -785,9 +783,10 @@ nvd0_display_unk2_handler(struct nv50_disp_priv *priv, u32 head, u32 mask) ...@@ -785,9 +783,10 @@ nvd0_display_unk2_handler(struct nv50_disp_priv *priv, u32 head, u32 mask)
nv_wr32(priv, 0x612200 + (head * 0x800), 0x00000000); nv_wr32(priv, 0x612200 + (head * 0x800), 0x00000000);
for (i = 0; mask && i < 8; i++) { for (i = 0; mask && i < 8; i++) {
u32 mcp = nv_rd32(priv, 0x660180 + (i * 0x20)), cfg; u32 mcp = nv_rd32(priv, 0x660180 + (i * 0x20));
if (mcp & (1 << head)) { if (mcp & (1 << head)) {
if ((cfg = exec_clkcmp(priv, head, i, mcp, 0, pclk))) { u32 cfg = exec_clkcmp(priv, head, i, mcp, 0, pclk);
if (cfg != ~0) {
u32 addr, mask, data = 0x00000000; u32 addr, mask, data = 0x00000000;
if (i < 4) { if (i < 4) {
addr = 0x612280 + ((i - 0) * 0x800); addr = 0x612280 + ((i - 0) * 0x800);
......
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