From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DF9483806C2 for ; Tue, 18 Aug 2026 23:56:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787097417; cv=none; b=QFd8xgNhdJgm6uZ75JYcXKucX3JVyUL0FFeRIHDc4PVaKpWLxxtaAZcDsVxGq59kmrgP5YybLhUwpEcC8phYFDI+HgHf4NTRbMk0K4nwJJEjrO8sq/8bHwwv011jWUjEMaIFJ6FZ/mtrE7OIbidIUjpsUaqZD82zQJkfb/PG56c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787097417; c=relaxed/simple; bh=BJ/kVaE/61dNOwCMKw6yVJWUCXGmmJw0OAbiOOPSdz8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=BmVMAo7j7fc9P/4o6yMi2AX4mWzlY9bM9Vsp4Tm5KGPfJlKK6LlKttD3PO+i9KTAgeZHLtZ0xhA9gHbZhziAwHhvx/zdyEzUUBTPfuXWx13E9PmzF5ocbEgA0bMxFNeCnBYAO0jysIy6PZro4jJ4JbG00NqcQhk6BUOZZvPqN4o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=MC5whajg; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="MC5whajg" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787097415; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yQ3/ySkk4MATWRJyNja7KbHykfH+1xBTq7SfrpfOH5s=; b=MC5whajg6dnDRA0aei7W5k98+cisuNyk5mYG3+NrIbx+SwzooPKO1Yi2pN8893xbsO6qOX sRXdaMmwamFPWrpMGTMCTq2jGYWbAY0ikRZukCbkppsyH7d7qL9cyqrzGBPhtoXdK6dpEa Y4GFAcHR2yWDWveyqZ24Wv6Wq9qGItI= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-135-kpkGkP4lMGm6evd75ZFzzw-1; Tue, 18 Aug 2026 19:56:52 -0400 X-MC-Unique: kpkGkP4lMGm6evd75ZFzzw-1 X-Mimecast-MFC-AGG-ID: kpkGkP4lMGm6evd75ZFzzw_1787097410 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D8D8A19560B4; Tue, 18 Aug 2026 23:56:49 +0000 (UTC) Received: from GoldenWind.lan (unknown [10.22.80.100]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id DCF76180049F; Tue, 18 Aug 2026 23:56:46 +0000 (UTC) From: Lyude Paul To: dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org, linux-kernel@vger.kernel.org, Marek Czernohous Cc: stable@vger.kernel.org, "Faith Ekstrand" , "Dave Airlie" , "Marek Czernohous" , "Maarten Lankhorst" , "Luca Ceresoli" , "Kees Cook" , "Marco Crivellari" , "Simona Vetter" , "Ben Skeggs" , "David Airlie" , "Thomas Zimmermann" , "Maxime Ripard" , "Danilo Krummrich" , "Jani Nikula" , "James Jones" , "Lyude Paul" Subject: [PATCH 1/6] drm/nouveau/kms/nv50-: Move DPCD backlight disable into its own function Date: Tue, 18 Aug 2026 19:48:43 -0400 Message-ID: <20260818235637.1738055-2-lyude@redhat.com> In-Reply-To: <20260818235637.1738055-1-lyude@redhat.com> References: <20260818235637.1738055-1-lyude@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 Besides using state->dev to access the nouveau_drm device again, there should be no functional changes here. Fixes: f575f2bdb6c3 ("drm/nouveau/kms/nv50-: Remove (nv_encoder->crtc) checks in ->disable callbacks") Cc: # v5.12+ Signed-off-by: Lyude Paul --- drivers/gpu/drm/nouveau/dispnv50/disp.c | 39 +++++++++++++++++-------- 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c b/drivers/gpu/drm/nouveau/dispnv50/disp.c index 2c66e480b5116..a885394f7cb92 100644 --- a/drivers/gpu/drm/nouveau/dispnv50/disp.c +++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c @@ -1561,24 +1561,39 @@ nv50_sor_update(struct nouveau_encoder *nv_encoder, u8 head, * the panel backlight has been shut off? Intel doesn't seem to do this, and uses a * fixed time delay from the vbios… */ +#ifdef CONFIG_DRM_NOUVEAU_BACKLIGHT +static inline void +nv50_sor_atomic_disable_backlight(struct nouveau_drm *drm, + struct nouveau_encoder *nv_encoder, + struct drm_atomic_commit *state) +{ + struct nouveau_connector *nv_connector; + struct nouveau_backlight *backlight; + int ret; + + nv_connector = nv50_outp_get_old_connector(state, nv_encoder); + if (drm_WARN_ON(drm->dev, !nv_connector)) + return; + backlight = nv_connector->backlight; + + if (!backlight || !backlight->uses_dpcd) + return; + + ret = drm_edp_backlight_disable(&nv_connector->aux, &backlight->edp_info); + if (ret < 0) + NV_ERROR(drm, "Failed to disable backlight on [CONNECTOR:%d:%s]: %d\n", + nv_connector->base.base.id, nv_connector->base.name, ret); +} +#endif + static void nv50_sor_atomic_disable(struct drm_encoder *encoder, struct drm_atomic_commit *state) { struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder); struct nv50_head *head = nv50_head(nv_encoder->crtc); -#ifdef CONFIG_DRM_NOUVEAU_BACKLIGHT - struct nouveau_connector *nv_connector = nv50_outp_get_old_connector(state, nv_encoder); - struct nouveau_drm *drm = nouveau_drm(nv_encoder->base.base.dev); - struct nouveau_backlight *backlight = nv_connector->backlight; - struct drm_dp_aux *aux = &nv_connector->aux; - int ret; - if (backlight && backlight->uses_dpcd) { - ret = drm_edp_backlight_disable(aux, &backlight->edp_info); - if (ret < 0) - NV_ERROR(drm, "Failed to disable backlight on [CONNECTOR:%d:%s]: %d\n", - nv_connector->base.base.id, nv_connector->base.name, ret); - } +#ifdef CONFIG_DRM_NOUVEAU_BACKLIGHT + nv50_sor_atomic_disable_backlight(nouveau_drm(state->dev), nv_encoder, state); #endif if (nv_encoder->dcb->type == DCB_OUTPUT_TMDS && nv_encoder->hdmi.enabled) { -- 2.55.0