- transition from "ioctl" interface Signed-off-by: Ben Skeggs <bskeggs@xxxxxxxxxx> --- .../gpu/drm/nouveau/include/nvif/driverif.h | 1 + drivers/gpu/drm/nouveau/include/nvif/if0012.h | 13 ------------- drivers/gpu/drm/nouveau/nvif/outp.c | 12 +++--------- .../gpu/drm/nouveau/nvkm/engine/disp/uoutp.c | 18 ++++++++++-------- 4 files changed, 14 insertions(+), 30 deletions(-) diff --git a/drivers/gpu/drm/nouveau/include/nvif/driverif.h b/drivers/gpu/drm/nouveau/include/nvif/driverif.h index 2660f37c5443..db6fb1347b72 100644 --- a/drivers/gpu/drm/nouveau/include/nvif/driverif.h +++ b/drivers/gpu/drm/nouveau/include/nvif/driverif.h @@ -338,6 +338,7 @@ struct nvif_outp_impl { int (*rates)(struct nvif_outp_priv *, struct nvif_outp_dp_rate *, u8 rates); int (*train)(struct nvif_outp_priv *, u8 dpcd[DP_RECEIVER_CAP_SIZE], u8 lttprs, u8 link_nr, u32 link_bw, bool mst, bool post_lt_adj, bool retrain); + int (*drive)(struct nvif_outp_priv *, u8 lanes, u8 pe[4], u8 vs[4]); } dp; }; diff --git a/drivers/gpu/drm/nouveau/include/nvif/if0012.h b/drivers/gpu/drm/nouveau/include/nvif/if0012.h index 5db1f718e82c..8b0f90327187 100644 --- a/drivers/gpu/drm/nouveau/include/nvif/if0012.h +++ b/drivers/gpu/drm/nouveau/include/nvif/if0012.h @@ -2,24 +2,11 @@ #ifndef __NVIF_IF0012_H__ #define __NVIF_IF0012_H__ -#include <drm/display/drm_dp.h> - -#define NVIF_OUTP_V0_DP_DRIVE 0x74 #define NVIF_OUTP_V0_DP_SST 0x75 #define NVIF_OUTP_V0_DP_MST_ID_GET 0x76 #define NVIF_OUTP_V0_DP_MST_ID_PUT 0x77 #define NVIF_OUTP_V0_DP_MST_VCPI 0x78 -union nvif_outp_dp_drive_args { - struct nvif_outp_dp_drive_v0 { - __u8 version; - __u8 pad01[2]; - __u8 lanes; - __u8 pe[4]; - __u8 vs[4]; - } v0; -}; - union nvif_outp_dp_sst_args { struct nvif_outp_dp_sst_v0 { __u8 version; diff --git a/drivers/gpu/drm/nouveau/nvif/outp.c b/drivers/gpu/drm/nouveau/nvif/outp.c index f20846a7f487..3d4461e3a2cd 100644 --- a/drivers/gpu/drm/nouveau/nvif/outp.c +++ b/drivers/gpu/drm/nouveau/nvif/outp.c @@ -94,18 +94,12 @@ nvif_outp_dp_sst(struct nvif_outp *outp, int head, u32 watermark, u32 hblanksym, } int -nvif_outp_dp_drive(struct nvif_outp *outp, u8 link_nr, u8 pe[4], u8 vs[4]) +nvif_outp_dp_drive(struct nvif_outp *outp, u8 lanes, u8 pe[4], u8 vs[4]) { - struct nvif_outp_dp_drive_v0 args; int ret; - args.version = 0; - args.lanes = link_nr; - memcpy(args.pe, pe, sizeof(args.pe)); - memcpy(args.vs, vs, sizeof(args.vs)); - - ret = nvif_object_mthd(&outp->object, NVIF_OUTP_V0_DP_DRIVE, &args, sizeof(args)); - NVIF_ERRON(ret, &outp->object, "[DP_DRIVE lanes:%d]", args.lanes); + ret = outp->impl->dp.drive(outp->priv, lanes, pe, vs); + NVIF_ERRON(ret, &outp->object, "[DP_DRIVE lanes:%d]", lanes); return ret; } diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/uoutp.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/uoutp.c index 673c8c10c782..3d5b6cee97bc 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/uoutp.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/uoutp.c @@ -123,16 +123,18 @@ nvkm_uoutp_mthd_dp_sst(struct nvkm_outp *outp, void *argv, u32 argc) } static int -nvkm_uoutp_mthd_dp_drive(struct nvkm_outp *outp, void *argv, u32 argc) +nvkm_uoutp_dp_drive(struct nvif_outp_priv *uoutp, u8 lanes, u8 pe[4], u8 vs[4]) { - union nvif_outp_dp_drive_args *args = argv; + struct nvkm_outp *outp; + int ret; - if (argc != sizeof(args->v0) || args->v0.version != 0) - return -ENOSYS; - if (!outp->func->dp.drive) - return -EINVAL; + ret = nvkm_uoutp_lock_acquired(uoutp); + if (ret) + return ret; - return outp->func->dp.drive(outp, args->v0.lanes, args->v0.pe, args->v0.vs); + ret = outp->func->dp.drive(outp, lanes, pe, vs); + nvkm_uoutp_unlock(uoutp); + return ret; } static int @@ -548,7 +550,6 @@ static int nvkm_uoutp_mthd_acquired(struct nvkm_outp *outp, u32 mthd, void *argv, u32 argc) { switch (mthd) { - case NVIF_OUTP_V0_DP_DRIVE : return nvkm_uoutp_mthd_dp_drive (outp, argv, argc); case NVIF_OUTP_V0_DP_SST : return nvkm_uoutp_mthd_dp_sst (outp, argv, argc); case NVIF_OUTP_V0_DP_MST_ID_GET: return nvkm_uoutp_mthd_dp_mst_id_get(outp, argv, argc); case NVIF_OUTP_V0_DP_MST_ID_PUT: return nvkm_uoutp_mthd_dp_mst_id_put(outp, argv, argc); @@ -688,6 +689,7 @@ nvkm_uoutp_new(struct nvkm_disp *disp, u8 id, const struct nvif_outp_impl **pimp uoutp->impl.dp.aux_xfer = nvkm_uoutp_dp_aux_xfer; uoutp->impl.dp.rates = nvkm_uoutp_dp_rates; uoutp->impl.dp.train = nvkm_uoutp_dp_train; + uoutp->impl.dp.drive = nvkm_uoutp_dp_drive; break; default: WARN_ON(1); -- 2.41.0