- transition from "ioctl" interfaces Signed-off-by: Ben Skeggs <bskeggs@xxxxxxxxxx> --- .../gpu/drm/nouveau/include/nvif/driverif.h | 5 +++ drivers/gpu/drm/nouveau/include/nvif/if0012.h | 17 -------- drivers/gpu/drm/nouveau/nvif/outp.c | 18 +++----- .../gpu/drm/nouveau/nvkm/engine/disp/uoutp.c | 43 ++++++++----------- 4 files changed, 29 insertions(+), 54 deletions(-) diff --git a/drivers/gpu/drm/nouveau/include/nvif/driverif.h b/drivers/gpu/drm/nouveau/include/nvif/driverif.h index 2b29ac64e5cd..7c4e3df12a8e 100644 --- a/drivers/gpu/drm/nouveau/include/nvif/driverif.h +++ b/drivers/gpu/drm/nouveau/include/nvif/driverif.h @@ -295,6 +295,11 @@ struct nvif_outp_impl { u8 acpi_edid; } lvds; + struct { + int (*get)(struct nvif_outp_priv *, u8 *level); + int (*set)(struct nvif_outp_priv *, u8 level); + } bl; + struct { u8 aux; u8 mst; diff --git a/drivers/gpu/drm/nouveau/include/nvif/if0012.h b/drivers/gpu/drm/nouveau/include/nvif/if0012.h index 1a8f0720c14a..0bdd8ddc65d3 100644 --- a/drivers/gpu/drm/nouveau/include/nvif/if0012.h +++ b/drivers/gpu/drm/nouveau/include/nvif/if0012.h @@ -4,9 +4,6 @@ #include <drm/display/drm_dp.h> -#define NVIF_OUTP_V0_BL_GET 0x30 -#define NVIF_OUTP_V0_BL_SET 0x31 - #define NVIF_OUTP_V0_LVDS 0x40 #define NVIF_OUTP_V0_HDMI 0x50 @@ -24,20 +21,6 @@ #define NVIF_OUTP_V0_DP_MST_ID_PUT 0x77 #define NVIF_OUTP_V0_DP_MST_VCPI 0x78 -union nvif_outp_bl_get_args { - struct nvif_outp_bl_get_v0 { - __u8 version; - __u8 level; - } v0; -}; - -union nvif_outp_bl_set_args { - struct nvif_outp_bl_set_v0 { - __u8 version; - __u8 level; - } v0; -}; - union nvif_outp_lvds_args { struct nvif_outp_lvds_v0 { __u8 version; diff --git a/drivers/gpu/drm/nouveau/nvif/outp.c b/drivers/gpu/drm/nouveau/nvif/outp.c index efdcc1c28874..7929dc896b6b 100644 --- a/drivers/gpu/drm/nouveau/nvif/outp.c +++ b/drivers/gpu/drm/nouveau/nvif/outp.c @@ -269,28 +269,22 @@ nvif_outp_lvds(struct nvif_outp *outp, bool dual, bool bpc8) int nvif_outp_bl_set(struct nvif_outp *outp, int level) { - struct nvif_outp_bl_set_v0 args; int ret; - args.version = 0; - args.level = level; - - ret = nvif_object_mthd(&outp->object, NVIF_OUTP_V0_BL_SET, &args, sizeof(args)); - NVIF_ERRON(ret, &outp->object, "[BL_SET level:%d]", args.level); + ret = outp->impl->bl.set(outp->priv, level); + NVIF_ERRON(ret, &outp->object, "[BL_SET level:%d]", level); return ret; } int nvif_outp_bl_get(struct nvif_outp *outp) { - struct nvif_outp_bl_get_v0 args; + u8 level; int ret; - args.version = 0; - - ret = nvif_object_mthd(&outp->object, NVIF_OUTP_V0_BL_GET, &args, sizeof(args)); - NVIF_ERRON(ret, &outp->object, "[BL_GET level:%d]", args.level); - return ret ? ret : args.level; + ret = outp->impl->bl.get(outp->priv, &level); + NVIF_ERRON(ret, &outp->object, "[BL_GET level:%d]", level); + return ret ? ret : level; } void diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/uoutp.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/uoutp.c index f5d3b3647dac..5483ca37ca0e 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/uoutp.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/uoutp.c @@ -320,39 +320,29 @@ nvkm_uoutp_mthd_lvds(struct nvkm_outp *outp, void *argv, u32 argc) } static int -nvkm_uoutp_mthd_bl_set(struct nvkm_outp *outp, void *argv, u32 argc) +nvkm_uoutp_bl_set(struct nvif_outp_priv *uoutp, u8 level) { - union nvif_outp_bl_get_args *args = argv; + struct nvkm_outp *outp = uoutp->outp; int ret; - if (argc != sizeof(args->v0) || args->v0.version != 0) - return -ENOSYS; - - if (outp->func->bl.set) - ret = outp->func->bl.set(outp, args->v0.level); - else - ret = -EINVAL; - + nvkm_uoutp_lock(uoutp); + ret = outp->func->bl.set(outp, level); + nvkm_uoutp_unlock(uoutp); return ret; } static int -nvkm_uoutp_mthd_bl_get(struct nvkm_outp *outp, void *argv, u32 argc) +nvkm_uoutp_bl_get(struct nvif_outp_priv *uoutp, u8 *level) { - union nvif_outp_bl_get_args *args = argv; + struct nvkm_outp *outp = uoutp->outp; int ret; - if (argc != sizeof(args->v0) || args->v0.version != 0) - return -ENOSYS; - - if (outp->func->bl.get) { - ret = outp->func->bl.get(outp); - if (ret >= 0) { - args->v0.level = ret; - ret = 0; - } - } else { - ret = -EINVAL; + nvkm_uoutp_lock(uoutp); + ret = outp->func->bl.get(outp); + nvkm_uoutp_unlock(uoutp); + if (ret >= 0) { + *level = ret; + ret = 0; } return ret; @@ -552,8 +542,6 @@ static int nvkm_uoutp_mthd_noacquire(struct nvkm_outp *outp, u32 mthd, void *argv, u32 argc, bool *invalid) { switch (mthd) { - case NVIF_OUTP_V0_BL_GET : return nvkm_uoutp_mthd_bl_get (outp, argv, argc); - case NVIF_OUTP_V0_BL_SET : return nvkm_uoutp_mthd_bl_set (outp, argv, argc); case NVIF_OUTP_V0_DP_AUX_PWR : return nvkm_uoutp_mthd_dp_aux_pwr (outp, argv, argc); case NVIF_OUTP_V0_DP_AUX_XFER: return nvkm_uoutp_mthd_dp_aux_xfer(outp, argv, argc); case NVIF_OUTP_V0_DP_RATES : return nvkm_uoutp_mthd_dp_rates (outp, argv, argc); @@ -704,6 +692,11 @@ nvkm_uoutp_new(struct nvkm_disp *disp, u8 id, const struct nvif_outp_impl **pimp uoutp->impl.heads = outp->info.heads; uoutp->impl.conn = outp->info.connector; + if (outp->func->bl.get) { + uoutp->impl.bl.get = nvkm_uoutp_bl_get; + uoutp->impl.bl.set = nvkm_uoutp_bl_set; + } + spin_lock(&disp->user.lock); if (outp->user) { spin_unlock(&disp->user.lock); -- 2.41.0