Skip to contentSkip to conversation

drm/nouveau/backlight: Fix LVDS backlight detection on some laptops

PATCH In review Lyude Paul 2 participants 2 messages Feb 4, 2022 – Feb 8, 2022

Subsystems (4)
lore
Share & tools
lore

Lyude Paul

author maintainer
#0 lore raw

PATCH 1/1 drm/nouveau/backlight: Fix LVDS backlight detection on some laptops

It seems that some laptops will report having both an eDP and LVDS connector, even though only the LVDS connector is actually hooked up. This can lead to issues with backlight registration if the eDP connector ends up getting registered before the LVDS connector, as the backlight device will then be registered to the eDP connector instead of the LVDS connector.

So, fix this by only registering the backlight on connectors that are reported as being connected.

Fixes 6eca310e8924 ("drm/nouveau/kms/nv50-: Add basic DPCD backlight support for nouveau")

Bugzilla: https://gitlab.freedesktop.org/drm/nouveau/-/issues/137
Cc: <[email protected]> # v5.15+

---
 drivers/gpu/drm/nouveau/nouveau_backlight.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nouveau_backlight.c +2 -1
index ae2f2abc8f5a..6af12dc99d7f 100644
@@ -294,7 +294,8 @@ nv50_backlight_init(struct nouveau_backlight *bl,
 	struct nouveau_drm *drm = nouveau_drm(nv_encoder->base.base.dev);
 	struct nvif_object *device = &drm->client.device.object;
 
-	if (!nvif_rd32(device, NV50_PDISP_SOR_PWM_CTL(ffs(nv_encoder->dcb->or) - 1)))
+	if (!nvif_rd32(device, NV50_PDISP_SOR_PWM_CTL(ffs(nv_encoder->dcb->or) - 1)) ||
+	    nv_conn->base.status != connector_status_connected)
 		return -ENODEV;
 
 	if (nv_conn->type == DCB_CONNECTOR_eDP) {
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Lyude Paul

It seems that some laptops will report having both an eDP and LVDS connector, even though only the LVDS connector is actually hooked up. This can lead to issues with backlight registration if the eDP connector ends up getting registered before the LVDS connector, as the backlight device will then be registered to the eDP connector instead of the LVDS connector.

So, fix this by only registering the backlight on connectors that are reported as being connected.

I think the patch might risk breaking muxed systems where we have two GPUs, but.. the systems I know of have different ways of controlling the backlight anyway. So unless there is something I missed this is

Quoted 25 lines
Fixes 6eca310e8924 ("drm/nouveau/kms/nv50-: Add basic DPCD backlight support for nouveau")

Bugzilla: https://gitlab.freedesktop.org/drm/nouveau/-/issues/137
Cc: <[email protected]> # v5.15+

---
 drivers/gpu/drm/nouveau/nouveau_backlight.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nouveau_backlight.c +2 -2
index ae2f2abc8f5a..6af12dc99d7f 100644
@@ -294,7 +294,8 @@ nv50_backlight_init(struct nouveau_backlight *bl,
        struct nouveau_drm *drm = nouveau_drm(nv_encoder->base.base.dev);
        struct nvif_object *device = &drm->client.device.object;
 
-       if (!nvif_rd32(device, NV50_PDISP_SOR_PWM_CTL(ffs(nv_encoder->dcb->or) - 1)))
+       if (!nvif_rd32(device, NV50_PDISP_SOR_PWM_CTL(ffs(nv_encoder->dcb->or) - 1)) ||
+           nv_conn->base.status != connector_status_connected)
                return -ENODEV;
 
        if (nv_conn->type == DCB_CONNECTOR_eDP) {
--

2.34.1