[PATCH 117/156] drm/nouveau/nvif: rework outp "dp aux pwr" api
Ben Skeggs
bskeggs at nvidia.com
Tue Apr 16 23:39:23 UTC 2024
- transition from "ioctl" interface
Signed-off-by: Ben Skeggs <bskeggs at nvidia.com>
---
drivers/gpu/drm/nouveau/include/nvif/driverif.h | 2 ++
drivers/gpu/drm/nouveau/include/nvif/if0012.h | 9 ---------
drivers/gpu/drm/nouveau/nvif/outp.c | 8 ++------
.../gpu/drm/nouveau/nvkm/engine/disp/uoutp.c | 17 ++++++++---------
4 files changed, 12 insertions(+), 24 deletions(-)
diff --git a/drivers/gpu/drm/nouveau/include/nvif/driverif.h b/drivers/gpu/drm/nouveau/include/nvif/driverif.h
index 742cf0e1678b..0dd85d4fa9ab 100644
--- a/drivers/gpu/drm/nouveau/include/nvif/driverif.h
+++ b/drivers/gpu/drm/nouveau/include/nvif/driverif.h
@@ -325,6 +325,8 @@ struct nvif_outp_impl {
u8 increased_wm;
u8 link_nr;
u32 link_bw;
+
+ int (*aux_pwr)(struct nvif_outp_priv *, bool enable);
} dp;
};
diff --git a/drivers/gpu/drm/nouveau/include/nvif/if0012.h b/drivers/gpu/drm/nouveau/include/nvif/if0012.h
index 160387dfc2a0..c0981a5f9e87 100644
--- a/drivers/gpu/drm/nouveau/include/nvif/if0012.h
+++ b/drivers/gpu/drm/nouveau/include/nvif/if0012.h
@@ -4,7 +4,6 @@
#include <drm/display/drm_dp.h>
-#define NVIF_OUTP_V0_DP_AUX_PWR 0x70
#define NVIF_OUTP_V0_DP_AUX_XFER 0x71
#define NVIF_OUTP_V0_DP_RATES 0x72
#define NVIF_OUTP_V0_DP_TRAIN 0x73
@@ -14,14 +13,6 @@
#define NVIF_OUTP_V0_DP_MST_ID_PUT 0x77
#define NVIF_OUTP_V0_DP_MST_VCPI 0x78
-union nvif_outp_dp_aux_pwr_args {
- struct nvif_outp_dp_aux_pwr_v0 {
- __u8 version;
- __u8 state;
- __u8 pad02[6];
- } v0;
-};
-
union nvif_outp_dp_aux_xfer_args {
struct nvif_outp_dp_aux_xfer_v0 {
__u8 version;
diff --git a/drivers/gpu/drm/nouveau/nvif/outp.c b/drivers/gpu/drm/nouveau/nvif/outp.c
index cf79c56aae0c..8b09a7ae9876 100644
--- a/drivers/gpu/drm/nouveau/nvif/outp.c
+++ b/drivers/gpu/drm/nouveau/nvif/outp.c
@@ -181,14 +181,10 @@ nvif_outp_dp_aux_xfer(struct nvif_outp *outp, u8 type, u8 *psize, u32 addr, u8 *
int
nvif_outp_dp_aux_pwr(struct nvif_outp *outp, bool enable)
{
- struct nvif_outp_dp_aux_pwr_v0 args;
int ret;
- args.version = 0;
- args.state = enable;
-
- ret = nvif_object_mthd(&outp->object, NVIF_OUTP_V0_DP_AUX_PWR, &args, sizeof(args));
- NVIF_ERRON(ret, &outp->object, "[DP_AUX_PWR state:%d]", args.state);
+ ret = outp->impl->dp.aux_pwr(outp->priv, enable);
+ NVIF_ERRON(ret, &outp->object, "[DP_AUX_PWR state:%d]", enable);
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 7184f13f39f5..36b4ea9a10fd 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/uoutp.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/uoutp.c
@@ -195,16 +195,15 @@ nvkm_uoutp_mthd_dp_aux_xfer(struct nvkm_outp *outp, void *argv, u32 argc)
}
static int
-nvkm_uoutp_mthd_dp_aux_pwr(struct nvkm_outp *outp, void *argv, u32 argc)
+nvkm_uoutp_dp_aux_pwr(struct nvif_outp_priv *uoutp, bool enable)
{
- union nvif_outp_dp_aux_pwr_args *args = argv;
-
- if (argc != sizeof(args->v0) || args->v0.version != 0)
- return -ENOSYS;
- if (!outp->func->dp.aux_pwr)
- return -EINVAL;
+ struct nvkm_outp *outp = uoutp->outp;
+ int ret;
- return outp->func->dp.aux_pwr(outp, !!args->v0.state);
+ nvkm_uoutp_lock(uoutp);
+ ret = outp->func->dp.aux_pwr(outp, enable);
+ nvkm_uoutp_unlock(uoutp);
+ return ret;
}
static int
@@ -564,7 +563,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_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);
default:
@@ -705,6 +703,7 @@ nvkm_uoutp_new(struct nvkm_disp *disp, u8 id, const struct nvif_outp_impl **pimp
uoutp->impl.dp.increased_wm = outp->dp.increased_wm;
uoutp->impl.dp.link_nr = outp->info.dpconf.link_nr;
uoutp->impl.dp.link_bw = outp->info.dpconf.link_bw * 27000;
+ uoutp->impl.dp.aux_pwr = nvkm_uoutp_dp_aux_pwr;
break;
default:
WARN_ON(1);
--
2.41.0
More information about the Nouveau
mailing list