From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B4DF0C5DF81 for ; Wed, 19 Aug 2026 16:00:13 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1086010EE66; Wed, 19 Aug 2026 16:00:13 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="g1ZGrpnF"; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by gabe.freedesktop.org (Postfix) with ESMTPS id 245F110EE2E for ; Wed, 19 Aug 2026 16:00:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787155210; 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=g1ZGrpnFdNk+57Gt1yY2bGscppwwAXL6/fT5CQmqmgWSMcxXW9ZHPcuqjibravXTYfzkOI C0I7FPxkOfP+YcvGgBCZ3Vv/gVrYNXpwtgH3hbZ5/UUqrFtcQI187whnfw4TAESfVjCKqy pz9FUDuDZWXkZsBpczTh69T6zXQ0Qyw= 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-501-GM-ns7WWP726exDZ-ptw4A-1; Wed, 19 Aug 2026 12:00:01 -0400 X-MC-Unique: GM-ns7WWP726exDZ-ptw4A-1 X-Mimecast-MFC-AGG-ID: GM-ns7WWP726exDZ-ptw4A_1787155193 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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 78AAD1955DD2; Wed, 19 Aug 2026 15:59:49 +0000 (UTC) Received: from GoldenWind.lan (unknown [10.22.89.72]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id C237518005BC; Wed, 19 Aug 2026 15:59:44 +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" , "Marco Crivellari" , "Kees Cook" , "Simona Vetter" , "Ben Skeggs" , "David Airlie" , "Thomas Zimmermann" , "Maxime Ripard" , "Danilo Krummrich" , "Jani Nikula" , "James Jones" , "Lyude Paul" Subject: [PATCH v2 1/6] drm/nouveau/kms/nv50-: Move DPCD backlight disable into its own function Date: Wed, 19 Aug 2026 11:43:48 -0400 Message-ID: <20260819155934.154125-2-lyude@redhat.com> In-Reply-To: <20260819155934.154125-1-lyude@redhat.com> References: <20260819155934.154125-1-lyude@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-MFC-PROC-ID: aiBx8RDB0mnnD-HhYY0sjTuvrM6lWW0vOqFR1QSz6Xc_1787155193 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3A2E0C5B572 for ; Wed, 19 Aug 2026 16:00:15 +0000 (UTC) Received: from kara.freedesktop.org (unknown [131.252.210.166]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7C88810EE6D; Wed, 19 Aug 2026 16:00:14 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="g1ZGrpnF"; dkim-atps=neutral Received: from kara.freedesktop.org (localhost [127.0.0.1]) by kara.freedesktop.org (Postfix) with ESMTP id 4E47747998; Wed, 19 Aug 2026 15:43:41 +0000 (UTC) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=lists.freedesktop.org; s=20240201; t=1787154221; b=o5k75QcK1oLoTtHbitHrjUn3VTVIhVGq+mvOmxEwNtJ7YoEvDulClfPJ9IA6nTfElktVM yMkPgsgOu6wr9votBuXmhjLV5rRGSuVfo9j/g47IZLHlTRpHo1r30z2T7XSvp/y8EfM6fMN s6btFrOShDXamZCzAJeMFQ9q1lXBv3FRVA5DIT0WSjuPrPh89kSBbLWcfJbG/thia+bunR7 /vOSC7NsVeoTHRlJ0Cj9mS6m5eg63KIH1pH6uHcEF7Dp8X/ZnjfxnC1gZLY+bxo23ECIGNv L55S27yImwaGPoyUqA3r1vaw955Nbz6Nizz0E7fnYlyGifwzKa6zt8V/ObNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=lists.freedesktop.org; s=20240201; t=1787154221; h=from : sender : reply-to : subject : date : message-id : to : cc : mime-version : content-type : content-transfer-encoding : content-id : content-description : resent-date : resent-from : resent-sender : resent-to : resent-cc : resent-message-id : in-reply-to : references : list-id : list-help : list-unsubscribe : list-subscribe : list-post : list-owner : list-archive; bh=yQ3/ySkk4MATWRJyNja7KbHykfH+1xBTq7SfrpfOH5s=; b=fLhFZ0yYSW8n0QSLqXIbDG15755/3EQxM5SroLn1hCkeoJKc76637c5l2X+SoehIwIpHu DFRbNrW2eBKGis68UiJ+cVL1cNL8cr01TfFr+vnaKNZozGgSYpzzhFZtxq/BF5vcseFPGXF /37Fn7SktsOzHiC2lxHzcI0LrbcyowagJs2MCf2R5IKM49GEbvcqkjGu9ePyUT8DqB2PEqX e0J4wLgdq546rYAuH6MR6OchUo8krqVsl1m3DFQUZDMHgkMBi2dTTgN0q+Q89L+oOOzrMn1 GKeovSrV2I4OGXg0yh3K+6da85hm6Nxb3UVJryD7GcpJ9U1Y7I7Gf/oRqgTw== ARC-Authentication-Results: i=1; mail.freedesktop.org; dkim=pass header.d=redhat.com; arc=none (Message is not ARC signed); dmarc=pass (Used From Domain Record) header.from=redhat.com policy.dmarc=quarantine Authentication-Results: mail.freedesktop.org; dkim=pass header.d=redhat.com; arc=none (Message is not ARC signed); dmarc=pass (Used From Domain Record) header.from=redhat.com policy.dmarc=quarantine Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by kara.freedesktop.org (Postfix) with ESMTPS id 399FC450AA for ; Wed, 19 Aug 2026 15:43:38 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2487F10EE57 for ; Wed, 19 Aug 2026 16:00:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787155210; 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=g1ZGrpnFdNk+57Gt1yY2bGscppwwAXL6/fT5CQmqmgWSMcxXW9ZHPcuqjibravXTYfzkOI C0I7FPxkOfP+YcvGgBCZ3Vv/gVrYNXpwtgH3hbZ5/UUqrFtcQI187whnfw4TAESfVjCKqy pz9FUDuDZWXkZsBpczTh69T6zXQ0Qyw= 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-501-GM-ns7WWP726exDZ-ptw4A-1; Wed, 19 Aug 2026 12:00:01 -0400 X-MC-Unique: GM-ns7WWP726exDZ-ptw4A-1 X-Mimecast-MFC-AGG-ID: GM-ns7WWP726exDZ-ptw4A_1787155193 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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 78AAD1955DD2; Wed, 19 Aug 2026 15:59:49 +0000 (UTC) Received: from GoldenWind.lan (unknown [10.22.89.72]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id C237518005BC; Wed, 19 Aug 2026 15:59:44 +0000 (UTC) From: Lyude Paul To: dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org, linux-kernel@vger.kernel.org, Marek Czernohous Subject: [PATCH v2 1/6] drm/nouveau/kms/nv50-: Move DPCD backlight disable into its own function Date: Wed, 19 Aug 2026 11:43:48 -0400 Message-ID: <20260819155934.154125-2-lyude@redhat.com> In-Reply-To: <20260819155934.154125-1-lyude@redhat.com> References: <20260819155934.154125-1-lyude@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-MFC-PROC-ID: HVef3P3BcJIkeHPUU3r4Y_0YfUF1hQDVpJMxfUtoYqQ_1787155193 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-ID-Hash: RSGACPGVUDN4QB5IUIIZX6MFPE5AYHOC X-Message-ID-Hash: RSGACPGVUDN4QB5IUIIZX6MFPE5AYHOC X-MailFrom: lyude@redhat.com X-Mailman-Rule-Hits: member-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address CC: stable@vger.kernel.org, Faith Ekstrand , Dave Airlie , Marek Czernohous , Maarten Lankhorst , Marco Crivellari , Kees Cook , Simona Vetter , Ben Skeggs , Maxime Ripard , Danilo Krummrich , Jani Nikula X-Mailman-Version: 3.3.8 Precedence: list List-Id: Nouveau development list Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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