bl: fix backlight regression
PATCH v2 1/1 bl: fix backlight regression
fixes d9c0aadc5aa241df26ce8301d34a8418919fb5ae
--- drm/nouveau/nouveau_backlight.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drm/nouveau/nouveau_backlight.c +5 -5
@@ -134,7 +134,7 @@ nv50_get_intensity(struct backlight_device *bd)struct nouveau_encoder *nv_encoder =bl_get_data (bd);struct nouveau_drm *drm =nouveau_drm (nv_encoder->base.base.dev);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 val;
@@ -149,7 +149,7 @@ nv50_set_intensity(struct backlight_device *bd)struct nouveau_encoder *nv_encoder =bl_get_data (bd);struct nouveau_drm *drm =nouveau_drm (nv_encoder->base.base.dev);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 val = (bd->props.brightness * div) /100 ;
@@ -170,7 +170,7 @@ nva3_get_intensity(struct backlight_device *bd)struct nouveau_encoder *nv_encoder =bl_get_data (bd);struct nouveau_drm *drm =nouveau_drm (nv_encoder->base.base.dev);struct nvif_object *device = &drm->client.device.object; -int or = nv_encoder->or; +int or =ffs (nv_encoder->dcb->or) -1 ;u32 div, val; div =nvif_rd32 (device,NV50_PDISP_SOR_PWM_DIV (or));
@@ -188,7 +188,7 @@ nva3_set_intensity(struct backlight_device *bd)struct nouveau_encoder *nv_encoder =bl_get_data (bd);struct nouveau_drm *drm =nouveau_drm (nv_encoder->base.base.dev);struct nvif_object *device = &drm->client.device.object; -int or = nv_encoder->or; +int or =ffs (nv_encoder->dcb->or) -1 ;u32 div, val; div =nvif_rd32 (device,NV50_PDISP_SOR_PWM_DIV (or));
@@ -228,7 +228,7 @@ nv50_backlight_init(struct drm_connector *connector)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 ; if (drm->client.device.info.chipset <= 0xa0 ||
Signature · 6 lines
2.14.3 _______________________________________________ Nouveau mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/nouveau
A message that is not in the archive (sent off-list or not yet received): 20180219160945.10411-1-kherbst-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org
A few words about why this change is needed would be nice, as well as what changed since the v1 (well, looking back to your original patch, absolutely everything changed :-D).
Quoted 1 line · Karol Herbst
fixes
d9c0aadc5aa241df26ce8301d34a8418919fb5ae
The formatting does not follow the kernel guidelines, see
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?id=91ab883eb21325ad80f3473633f794c78ac87f51#n183
Also, you might want to use the commit hash from Linus’ tree, rather than from Ben’s out-of-tree module.
Quoted 12 lines
Suggested-by Ben Skeggs <[email protected]>Signed-off-by Karol Herbst <[email protected]>--- drm/nouveau/nouveau_backlight.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)drm/nouveau/nouveau_backlight.c +0
-0
drm/nouveau/nouveau_backlight.c nv50_get_intensity(struct backlight_device *bd) · line 137
Quoted 5 lines
drm/nouveau/nouveau_backlight.c +1
-1@@ -134,7 +134,7 @@ nv50_get_intensity(struct backlight_device *bd)struct nouveau_encoder *nv_encoder =bl_get_data (bd);struct nouveau_drm *drm =nouveau_drm (nv_encoder->base.base.dev);struct nvif_object *device = &drm->client.device.object; -int or = nv_encoder->or; +int or =ffs (nv_encoder->dcb->or) -1 ;
Since you have that change in a few places, wouldn’t it make sense to have it in an helper function, that given an nv_encoder object would give you back the correct or value? The function wouldn’t be doing much, I agree, but it would be less error-prone to forgetting the -1 or using ffs in some cases.
Pierre
Quoted 46 lines
drm/nouveau/nouveau_backlight.c +4
-4u32 div =1025 ;u32 val;@@ -149,7 +149,7 @@ nv50_set_intensity(struct backlight_device *bd)struct nouveau_encoder *nv_encoder =bl_get_data (bd);struct nouveau_drm *drm =nouveau_drm (nv_encoder->base.base.dev);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 val = (bd->props.brightness * div) /100 ;@@ -170,7 +170,7 @@ nva3_get_intensity(struct backlight_device *bd)struct nouveau_encoder *nv_encoder =bl_get_data (bd);struct nouveau_drm *drm =nouveau_drm (nv_encoder->base.base.dev);struct nvif_object *device = &drm->client.device.object; -int or = nv_encoder->or; +int or =ffs (nv_encoder->dcb->or) -1 ;u32 div, val; div =nvif_rd32 (device,NV50_PDISP_SOR_PWM_DIV (or));@@ -188,7 +188,7 @@ nva3_set_intensity(struct backlight_device *bd)struct nouveau_encoder *nv_encoder =bl_get_data (bd);struct nouveau_drm *drm =nouveau_drm (nv_encoder->base.base.dev);struct nvif_object *device = &drm->client.device.object; -int or = nv_encoder->or; +int or =ffs (nv_encoder->dcb->or) -1 ;u32 div, val; div =nvif_rd32 (device,NV50_PDISP_SOR_PWM_DIV (or));@@ -228,7 +228,7 @@ nv50_backlight_init(struct drm_connector *connector)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 ; if (drm->client.device.info.chipset <= 0xa0 ||Signature · 6 lines
2.14.3 _______________________________________________ Nouveau mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/nouveau
_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau