Commit 9e75dc61 authored by Karol Herbst's avatar Karol Herbst Committed by Ben Skeggs

drm/nouveau/bl: fix backlight regression

Fixes: 3c66c87d ("drm/nouveau/disp: remove hw-specific customisation
of output paths")
Suggested-by: default avatarBen Skeggs <skeggsb@redhat.com>
Signed-off-by: default avatarKarol Herbst <kherbst@redhat.com>
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent 76f2e2bc
...@@ -134,7 +134,7 @@ nv50_get_intensity(struct backlight_device *bd) ...@@ -134,7 +134,7 @@ nv50_get_intensity(struct backlight_device *bd)
struct nouveau_encoder *nv_encoder = bl_get_data(bd); struct nouveau_encoder *nv_encoder = bl_get_data(bd);
struct nouveau_drm *drm = nouveau_drm(nv_encoder->base.base.dev); struct nouveau_drm *drm = nouveau_drm(nv_encoder->base.base.dev);
struct nvif_object *device = &drm->client.device.object; struct nvif_object *device = &drm->client.device.object;
int or = nv_encoder->or; int or = ffs(nv_encoder->dcb->or) - 1;
u32 div = 1025; u32 div = 1025;
u32 val; u32 val;
...@@ -149,7 +149,7 @@ nv50_set_intensity(struct backlight_device *bd) ...@@ -149,7 +149,7 @@ nv50_set_intensity(struct backlight_device *bd)
struct nouveau_encoder *nv_encoder = bl_get_data(bd); struct nouveau_encoder *nv_encoder = bl_get_data(bd);
struct nouveau_drm *drm = nouveau_drm(nv_encoder->base.base.dev); struct nouveau_drm *drm = nouveau_drm(nv_encoder->base.base.dev);
struct nvif_object *device = &drm->client.device.object; struct nvif_object *device = &drm->client.device.object;
int or = nv_encoder->or; int or = ffs(nv_encoder->dcb->or) - 1;
u32 div = 1025; u32 div = 1025;
u32 val = (bd->props.brightness * div) / 100; u32 val = (bd->props.brightness * div) / 100;
...@@ -170,7 +170,7 @@ nva3_get_intensity(struct backlight_device *bd) ...@@ -170,7 +170,7 @@ nva3_get_intensity(struct backlight_device *bd)
struct nouveau_encoder *nv_encoder = bl_get_data(bd); struct nouveau_encoder *nv_encoder = bl_get_data(bd);
struct nouveau_drm *drm = nouveau_drm(nv_encoder->base.base.dev); struct nouveau_drm *drm = nouveau_drm(nv_encoder->base.base.dev);
struct nvif_object *device = &drm->client.device.object; struct nvif_object *device = &drm->client.device.object;
int or = nv_encoder->or; int or = ffs(nv_encoder->dcb->or) - 1;
u32 div, val; u32 div, val;
div = nvif_rd32(device, NV50_PDISP_SOR_PWM_DIV(or)); div = nvif_rd32(device, NV50_PDISP_SOR_PWM_DIV(or));
...@@ -188,7 +188,7 @@ nva3_set_intensity(struct backlight_device *bd) ...@@ -188,7 +188,7 @@ nva3_set_intensity(struct backlight_device *bd)
struct nouveau_encoder *nv_encoder = bl_get_data(bd); struct nouveau_encoder *nv_encoder = bl_get_data(bd);
struct nouveau_drm *drm = nouveau_drm(nv_encoder->base.base.dev); struct nouveau_drm *drm = nouveau_drm(nv_encoder->base.base.dev);
struct nvif_object *device = &drm->client.device.object; struct nvif_object *device = &drm->client.device.object;
int or = nv_encoder->or; int or = ffs(nv_encoder->dcb->or) - 1;
u32 div, val; u32 div, val;
div = nvif_rd32(device, NV50_PDISP_SOR_PWM_DIV(or)); div = nvif_rd32(device, NV50_PDISP_SOR_PWM_DIV(or));
...@@ -228,7 +228,7 @@ nv50_backlight_init(struct drm_connector *connector) ...@@ -228,7 +228,7 @@ nv50_backlight_init(struct drm_connector *connector)
return -ENODEV; return -ENODEV;
} }
if (!nvif_rd32(device, NV50_PDISP_SOR_PWM_CTL(nv_encoder->or))) if (!nvif_rd32(device, NV50_PDISP_SOR_PWM_CTL(ffs(nv_encoder->dcb->or) - 1)))
return 0; return 0;
if (drm->client.device.info.chipset <= 0xa0 || if (drm->client.device.info.chipset <= 0xa0 ||
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment