diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/dp.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/dp.c index 979563434da8c480dbfaa4bb57f3f7709c80ad4f..545d4ccedffe5d737145145084510f441dce996c 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/dp.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/dp.c @@ -249,7 +249,7 @@ nvkm_dp_train_links(struct nvkm_dp *dp) return 0; } - dp->func->lnk_pwr(dp, ior->dp.nr); + ior->func->dp.power(ior, ior->dp.nr); /* Set desired link configuration on the sink. */ sink[0] = ior->dp.bw; diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/dp.h b/drivers/gpu/drm/nouveau/nvkm/engine/disp/dp.h index ae61e8f1a1b9fa23baf08c52bcdece04de5e35ca..c96959aa5d0eef60d4674df00e6565219d14906a 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/dp.h +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/dp.h @@ -34,7 +34,6 @@ struct nvkm_dp { struct nvkm_output_dp_func { int (*pattern)(struct nvkm_output_dp *, int); - int (*lnk_pwr)(struct nvkm_output_dp *, int nr); int (*drv_ctl)(struct nvkm_output_dp *, int ln, int vs, int pe, int pc); void (*vcpi)(struct nvkm_output_dp *, int head, u8 start_slot, u8 num_slots, u16 pbn, u16 aligned_pbn); @@ -50,7 +49,6 @@ int nv50_pior_dp_new(struct nvkm_disp *, int, struct dcb_output *, int g94_sor_dp_new(struct nvkm_disp *, int, struct dcb_output *, struct nvkm_output **); -int g94_sor_dp_lnk_pwr(struct nvkm_dp *, int); int gf119_sor_dp_new(struct nvkm_disp *, int, struct dcb_output *, struct nvkm_output **); diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/ior.h b/drivers/gpu/drm/nouveau/nvkm/engine/disp/ior.h index 680180dde0dd2d5f02a01d6de5fd540540944412..3b660a2fc7cb5af10e09550a1ee96fc59e31734e 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/ior.h +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/ior.h @@ -54,6 +54,7 @@ struct nvkm_ior_func { struct { u8 lanes[4]; int (*links)(struct nvkm_ior *, struct nvkm_i2c_aux *); + void (*power)(struct nvkm_ior *, int nr); } dp; }; @@ -82,6 +83,7 @@ void nv50_sor_power(struct nvkm_ior *, bool, bool, bool, bool, bool); void g94_sor_state(struct nvkm_ior *, struct nvkm_ior_state *); int g94_sor_dp_links(struct nvkm_ior *, struct nvkm_i2c_aux *); +void g94_sor_dp_power(struct nvkm_ior *, int); void gf119_sor_state(struct nvkm_ior *, struct nvkm_ior_state *); int gf119_sor_dp_links(struct nvkm_ior *, struct nvkm_i2c_aux *); diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/piornv50.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/piornv50.c index d366deef241e63815375f3daf7d4276acb1b057c..5e87c08f809e9bed1ab1afa9999f1e3e041d2fa7 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/piornv50.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/piornv50.c @@ -51,12 +51,6 @@ nv50_pior_output_dp_pattern(struct nvkm_output_dp *outp, int pattern) return 0; } -static int -nv50_pior_output_dp_lnk_pwr(struct nvkm_output_dp *outp, int nr) -{ - return 0; -} - static int nv50_pior_dp_links(struct nvkm_ior *pior, struct nvkm_i2c_aux *aux) { @@ -70,7 +64,6 @@ nv50_pior_dp_links(struct nvkm_ior *pior, struct nvkm_i2c_aux *aux) static const struct nvkm_output_dp_func nv50_pior_output_dp_func = { .pattern = nv50_pior_output_dp_pattern, - .lnk_pwr = nv50_pior_output_dp_lnk_pwr, }; int diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorg94.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorg94.c index 38d6148d8b11c0ab580888f7130bdabc1efa6560..569ed247bc1c43b3454176f01d9c2f5086e75065 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorg94.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorg94.c @@ -90,16 +90,16 @@ g94_sor_dp_pattern(struct nvkm_output_dp *outp, int pattern) return 0; } -int -g94_sor_dp_lnk_pwr(struct nvkm_output_dp *outp, int nr) +void +g94_sor_dp_power(struct nvkm_ior *sor, int nr) { - struct nvkm_device *device = outp->base.disp->engine.subdev.device; - const u32 soff = g94_sor_soff(outp); - const u32 loff = g94_sor_loff(outp); + struct nvkm_device *device = sor->disp->engine.subdev.device; + const u32 soff = nv50_ior_base(sor); + const u32 loff = nv50_sor_link(sor); u32 mask = 0, i; for (i = 0; i < nr; i++) - mask |= 1 << (g94_sor_dp_lane_map(device, i) >> 3); + mask |= 1 << sor->func->dp.lanes[i]; nvkm_mask(device, 0x61c130 + loff, 0x0000000f, mask); nvkm_mask(device, 0x61c034 + soff, 0x80000000, 0x80000000); @@ -107,7 +107,6 @@ g94_sor_dp_lnk_pwr(struct nvkm_output_dp *outp, int nr) if (!(nvkm_rd32(device, 0x61c034 + soff) & 0x80000000)) break; ); - return 0; } int @@ -133,7 +132,6 @@ g94_sor_dp_links(struct nvkm_ior *sor, struct nvkm_i2c_aux *aux) static const struct nvkm_output_dp_func g94_sor_dp_func = { .pattern = g94_sor_dp_pattern, - .lnk_pwr = g94_sor_dp_lnk_pwr, .drv_ctl = g94_sor_dp_drv_ctl, }; @@ -300,6 +298,7 @@ g94_sor = { .dp = { .lanes = { 2, 1, 0, 3}, .links = g94_sor_dp_links, + .power = g94_sor_dp_power, }, }; diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgf119.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgf119.c index 38f13ef6f97a6bd05c925c388ec3badb24dabe63..d45fd094fc6375d4af2c51dc3ab067f9fd4b7639 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgf119.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgf119.c @@ -117,7 +117,6 @@ gf119_sor_dp_links(struct nvkm_ior *sor, struct nvkm_i2c_aux *aux) static const struct nvkm_output_dp_func gf119_sor_dp_func = { .pattern = gf119_sor_dp_pattern, - .lnk_pwr = g94_sor_dp_lnk_pwr, .drv_ctl = gf119_sor_dp_drv_ctl, .vcpi = gf119_sor_dp_vcpi, }; @@ -162,6 +161,7 @@ gf119_sor = { .dp = { .lanes = { 2, 1, 0, 3 }, .links = gf119_sor_dp_links, + .power = g94_sor_dp_power, }, }; diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgk104.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgk104.c index 2dca1e391219dd65fdca02fa5f7d85d3d72696c0..4d376fd7d3d2e8f6bcb4c34fd6fbea22fc662124 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgk104.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgk104.c @@ -31,6 +31,7 @@ gk104_sor = { .dp = { .lanes = { 2, 1, 0, 3 }, .links = gf119_sor_dp_links, + .power = g94_sor_dp_power, }, }; diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgm107.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgm107.c index 9d1732257e4a9a79575d1b736759149b010339b7..642d3c4ed26ae9180bb7da5ee407663f56c6a3a3 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgm107.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgm107.c @@ -40,7 +40,6 @@ gm107_sor_dp_pattern(struct nvkm_output_dp *outp, int pattern) static const struct nvkm_output_dp_func gm107_sor_dp_func = { .pattern = gm107_sor_dp_pattern, - .lnk_pwr = g94_sor_dp_lnk_pwr, .drv_ctl = gf119_sor_dp_drv_ctl, .vcpi = gf119_sor_dp_vcpi, }; @@ -62,6 +61,7 @@ gm107_sor = { .dp = { .lanes = { 0, 1, 2, 3 }, .links = gf119_sor_dp_links, + .power = g94_sor_dp_power, }, }; diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgm200.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgm200.c index f3072c2d9beaed295cff18fcb7b660ef486643a1..b7083e99a7df597b1167cca3dd0e056672838ff7 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgm200.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgm200.c @@ -24,8 +24,6 @@ #include "ior.h" #include "nv50.h" -#include - static inline u32 gm200_sor_soff(struct nvkm_output_dp *outp) { @@ -82,30 +80,9 @@ gm200_sor_dp_drv_ctl(struct nvkm_output_dp *outp, return 0; } -static int -gm200_sor_dp_lnk_pwr(struct nvkm_output_dp *outp, int nr) -{ - struct nvkm_device *device = outp->base.disp->engine.subdev.device; - const u32 soff = gm200_sor_soff(outp); - const u32 loff = gm200_sor_loff(outp); - u32 mask = 0, i; - - for (i = 0; i < nr; i++) - mask |= 1 << (gm200_sor_dp_lane_map(device, i) >> 3); - - nvkm_mask(device, 0x61c130 + loff, 0x0000000f, mask); - nvkm_mask(device, 0x61c034 + soff, 0x80000000, 0x80000000); - nvkm_msec(device, 2000, - if (!(nvkm_rd32(device, 0x61c034 + soff) & 0x80000000)) - break; - ); - return 0; -} - static const struct nvkm_output_dp_func gm200_sor_dp_func = { .pattern = gm107_sor_dp_pattern, - .lnk_pwr = gm200_sor_dp_lnk_pwr, .drv_ctl = gm200_sor_dp_drv_ctl, .vcpi = gf119_sor_dp_vcpi, }; @@ -139,6 +116,7 @@ gm200_sor = { .dp = { .lanes = { 0, 1, 2, 3 }, .links = gf119_sor_dp_links, + .power = g94_sor_dp_power, }, }; diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgt215.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgt215.c index 059d88145f4711998b9e393d88e819338bba0743..4e5f6591e50bb7016b39b67650734d732990855a 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgt215.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgt215.c @@ -31,6 +31,7 @@ gt215_sor = { .dp = { .lanes = { 2, 1, 0, 3 }, .links = g94_sor_dp_links, + .power = g94_sor_dp_power, }, }; diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/sormcp77.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/sormcp77.c index 051670322d04ccba94661d3139960024e1ff4a05..6868f0758718a7f56e13936acdabac7053277e63 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/sormcp77.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/sormcp77.c @@ -31,6 +31,7 @@ mcp77_sor = { .dp = { .lanes = { 2, 1, 0, 3}, .links = g94_sor_dp_links, + .power = g94_sor_dp_power, }, }; diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/sormcp89.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/sormcp89.c index 0afdceb203d535527fd90f3b7a8079d3b1ce02f0..c2b7de0b29dde047610330b59885fdb9777c7251 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/sormcp89.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/sormcp89.c @@ -31,6 +31,7 @@ mcp89_sor = { .dp = { .lanes = { 3, 2, 1, 0 }, .links = g94_sor_dp_links, + .power = g94_sor_dp_power, }, };