nouveau.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [Nouveau] [PATCH] drm/nouveau/backlight: Just set all backlight types as RAW
@ 2022-02-04 19:33 Lyude Paul
  2022-02-08 12:21 ` Karol Herbst
  0 siblings, 1 reply; 2+ messages in thread
From: Lyude Paul @ 2022-02-04 19:33 UTC (permalink / raw)
  To: nouveau
  Cc: David Airlie, open list, stable, dri-devel, Daniel Vetter, Ben Skeggs

Currently we can get a warning on systems with eDP backlights like so:

  nv_backlight: invalid backlight type
  WARNING: CPU: 4 PID: 454 at drivers/video/backlight/backlight.c:420
    backlight_device_register+0x226/0x250

This happens as a result of us not filling out props.type for the eDP
backlight, even though we do it for all other backlight types.

Since nothing in our driver uses anything but BACKLIGHT_RAW, let's take the
props\.type assignments out of the codepaths for individual backlight types
and just set it unconditionally to prevent this from happening again.

Signed-off-by: Lyude Paul <lyude@redhat.com>
Fixes: 6eca310e8924 ("drm/nouveau/kms/nv50-: Add basic DPCD backlight support for nouveau")
Cc: <stable@vger.kernel.org> # v5.15+
---
 drivers/gpu/drm/nouveau/nouveau_backlight.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_backlight.c b/drivers/gpu/drm/nouveau/nouveau_backlight.c
index 6af12dc99d7f..daf9f87477ba 100644
--- a/drivers/gpu/drm/nouveau/nouveau_backlight.c
+++ b/drivers/gpu/drm/nouveau/nouveau_backlight.c
@@ -101,7 +101,6 @@ nv40_backlight_init(struct nouveau_encoder *encoder,
 	if (!(nvif_rd32(device, NV40_PMC_BACKLIGHT) & NV40_PMC_BACKLIGHT_MASK))
 		return -ENODEV;
 
-	props->type = BACKLIGHT_RAW;
 	props->max_brightness = 31;
 	*ops = &nv40_bl_ops;
 	return 0;
@@ -343,7 +342,6 @@ nv50_backlight_init(struct nouveau_backlight *bl,
 	else
 		*ops = &nva3_bl_ops;
 
-	props->type = BACKLIGHT_RAW;
 	props->max_brightness = 100;
 
 	return 0;
@@ -411,6 +409,7 @@ nouveau_backlight_init(struct drm_connector *connector)
 		goto fail_alloc;
 	}
 
+	props.type = BACKLIGHT_RAW;
 	bl->dev = backlight_device_register(backlight_name, connector->kdev,
 					    nv_encoder, ops, &props);
 	if (IS_ERR(bl->dev)) {
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Nouveau] [PATCH] drm/nouveau/backlight: Just set all backlight types as RAW
  2022-02-04 19:33 [Nouveau] [PATCH] drm/nouveau/backlight: Just set all backlight types as RAW Lyude Paul
@ 2022-02-08 12:21 ` Karol Herbst
  0 siblings, 0 replies; 2+ messages in thread
From: Karol Herbst @ 2022-02-08 12:21 UTC (permalink / raw)
  To: Lyude Paul
  Cc: David Airlie, nouveau, open list, stable, dri-devel,
	Daniel Vetter, Ben Skeggs

Reviewed-by: Karol Herbst <kherbst@redhat.com>

On Fri, Feb 4, 2022 at 8:33 PM Lyude Paul <lyude@redhat.com> wrote:
>
> Currently we can get a warning on systems with eDP backlights like so:
>
>   nv_backlight: invalid backlight type
>   WARNING: CPU: 4 PID: 454 at drivers/video/backlight/backlight.c:420
>     backlight_device_register+0x226/0x250
>
> This happens as a result of us not filling out props.type for the eDP
> backlight, even though we do it for all other backlight types.
>
> Since nothing in our driver uses anything but BACKLIGHT_RAW, let's take the
> props\.type assignments out of the codepaths for individual backlight types
> and just set it unconditionally to prevent this from happening again.
>
> Signed-off-by: Lyude Paul <lyude@redhat.com>
> Fixes: 6eca310e8924 ("drm/nouveau/kms/nv50-: Add basic DPCD backlight support for nouveau")
> Cc: <stable@vger.kernel.org> # v5.15+
> ---
>  drivers/gpu/drm/nouveau/nouveau_backlight.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/nouveau/nouveau_backlight.c b/drivers/gpu/drm/nouveau/nouveau_backlight.c
> index 6af12dc99d7f..daf9f87477ba 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_backlight.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_backlight.c
> @@ -101,7 +101,6 @@ nv40_backlight_init(struct nouveau_encoder *encoder,
>         if (!(nvif_rd32(device, NV40_PMC_BACKLIGHT) & NV40_PMC_BACKLIGHT_MASK))
>                 return -ENODEV;
>
> -       props->type = BACKLIGHT_RAW;
>         props->max_brightness = 31;
>         *ops = &nv40_bl_ops;
>         return 0;
> @@ -343,7 +342,6 @@ nv50_backlight_init(struct nouveau_backlight *bl,
>         else
>                 *ops = &nva3_bl_ops;
>
> -       props->type = BACKLIGHT_RAW;
>         props->max_brightness = 100;
>
>         return 0;
> @@ -411,6 +409,7 @@ nouveau_backlight_init(struct drm_connector *connector)
>                 goto fail_alloc;
>         }
>
> +       props.type = BACKLIGHT_RAW;
>         bl->dev = backlight_device_register(backlight_name, connector->kdev,
>                                             nv_encoder, ops, &props);
>         if (IS_ERR(bl->dev)) {
> --
> 2.34.1
>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-02-08 12:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-04 19:33 [Nouveau] [PATCH] drm/nouveau/backlight: Just set all backlight types as RAW Lyude Paul
2022-02-08 12:21 ` Karol Herbst

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).