[PATCH v2 5/6] drm/nouveau/kms/nv50-: Add nouveau_encoder->audio.crtc
Lyude Paul <[email protected]>
| Newsgroups | org.freedesktop.lists.nouveau,org.freedesktop.lists.dri-devel,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
This is the only spot in nouveau where we do actually need to keep track of the currently assigned CRTC for an encoder, and it ideally should be happening outside of the modesetting locks. So in preparation for obliterating nouveau_encoder->crtc, let's just add a variable into nouveau_encoder->audio for tracking this and use it instead of nouveau_encoder->crtc. This makes it a lot more obvious that this is only intended for state-tracking for audio. Signed-off-by: Lyude Paul <[email protected]> --- drivers/gpu/drm/nouveau/dispnv50/disp.c | 4 +++- drivers/gpu/drm/nouveau/nouveau_encoder.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c b/drivers/gpu/drm/nouveau/dispnv50/disp.c index d038743d1382a..fbb874b11d7a8 100644 --- a/drivers/gpu/drm/nouveau/dispnv50/disp.c +++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c @@ -636,7 +636,7 @@ nv50_audio_component_get_eld(struct device *kdev, int port, int dev_id, nv_encoder = nouveau_encoder(encoder); nv_connector = nv_encoder->conn; - nv_crtc = nouveau_crtc(nv_encoder->crtc); + nv_crtc = nv_encoder->audio.crtc; if (!nv_crtc || nv_encoder->outp.or.id != port || nv_crtc->index != dev_id) continue; @@ -757,6 +757,7 @@ nv50_audio_disable(struct drm_encoder *encoder, struct nouveau_crtc *nv_crtc) mutex_lock(&drm->audio.lock); if (nv_encoder->audio.enabled) { nv_encoder->audio.enabled = false; + nv_encoder->audio.crtc = NULL; nvif_outp_hda_eld(&nv_encoder->outp, nv_crtc->index, NULL, 0); } mutex_unlock(&drm->audio.lock); @@ -781,6 +782,7 @@ nv50_audio_enable(struct drm_encoder *encoder, struct nouveau_crtc *nv_crtc, nvif_outp_hda_eld(&nv_encoder->outp, nv_crtc->index, nv_connector->base.eld, drm_eld_size(nv_connector->base.eld)); nv_encoder->audio.enabled = true; + nv_encoder->audio.crtc = nv_crtc; mutex_unlock(&drm->audio.lock); diff --git a/drivers/gpu/drm/nouveau/nouveau_encoder.h b/drivers/gpu/drm/nouveau/nouveau_encoder.h index 4422c6185d498..647322ac1c8df 100644 --- a/drivers/gpu/drm/nouveau/nouveau_encoder.h +++ b/drivers/gpu/drm/nouveau/nouveau_encoder.h @@ -62,6 +62,7 @@ struct nouveau_encoder { /* Protected by nouveau_drm.audio.lock */ struct { bool enabled; + struct nouveau_crtc *crtc; } audio; struct drm_display_mode mode; -- 2.55.0