lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 29 Sep 2021 16:21:07 +0200
From:   Robin van der Gracht <robin@...tonic.nl>
To:     Geert Uytterhoeven <geert@...ux-m68k.org>
Cc:     Miguel Ojeda <ojeda@...nel.org>, Rob Herring <robh+dt@...nel.org>,
        Paul Burton <paulburton@...nel.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Pavel Machek <pavel@....cz>, Marek Behun <marek.behun@....cz>,
        devicetree@...r.kernel.org, linux-leds@...r.kernel.org,
        linux-mips@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v6 09/19] auxdisplay: ht16k33: Connect backlight to fbdev

Reviewed-by: Robin van der Gracht <robin@...tonic.nl>

On 2021-09-14 16:38, Geert Uytterhoeven wrote:
> Currently /sys/class/graphics/fb0/bl_curve is not accessible (-ENODEV),
> as the driver does not connect the backlight to the frame buffer device.
> Fix this moving backlight initialization up, and filling in
> fb_info.bl_dev.
> 
> Fixes: 8992da44c6805d53 ("auxdisplay: ht16k33: Driver for LED controller")
> Signed-off-by: Geert Uytterhoeven <geert@...ux-m68k.org>
> ---
> v6:
>   - No changes,
> 
> v5:
>   - No changes,
> 
> v4:
>   - No changes,
> 
> v3:
>   - No changes,
> 
> v2:
>   - New.
> ---
>  drivers/auxdisplay/ht16k33.c | 56 ++++++++++++++++++------------------
>  1 file changed, 28 insertions(+), 28 deletions(-)
> 
> diff --git a/drivers/auxdisplay/ht16k33.c b/drivers/auxdisplay/ht16k33.c
> index 1e69cc6d21a0dca2..2b630e194570f6e5 100644
> --- a/drivers/auxdisplay/ht16k33.c
> +++ b/drivers/auxdisplay/ht16k33.c
> @@ -413,6 +413,33 @@ static int ht16k33_probe(struct i2c_client *client,
>  	if (err)
>  		return err;
> 
> +	/* Backlight */
> +	memset(&bl_props, 0, sizeof(struct backlight_properties));
> +	bl_props.type = BACKLIGHT_RAW;
> +	bl_props.max_brightness = MAX_BRIGHTNESS;
> +
> +	bl = devm_backlight_device_register(&client->dev, DRIVER_NAME"-bl",
> +					    &client->dev, priv,
> +					    &ht16k33_bl_ops, &bl_props);
> +	if (IS_ERR(bl)) {
> +		dev_err(&client->dev, "failed to register backlight\n");
> +		return PTR_ERR(bl);
> +	}
> +
> +	err = of_property_read_u32(node, "default-brightness-level",
> +				   &dft_brightness);
> +	if (err) {
> +		dft_brightness = MAX_BRIGHTNESS;
> +	} else if (dft_brightness > MAX_BRIGHTNESS) {
> +		dev_warn(&client->dev,
> +			 "invalid default brightness level: %u, using %u\n",
> +			 dft_brightness, MAX_BRIGHTNESS);
> +		dft_brightness = MAX_BRIGHTNESS;
> +	}
> +
> +	bl->props.brightness = dft_brightness;
> +	ht16k33_bl_update_status(bl);
> +
>  	/* Framebuffer (2 bytes per column) */
>  	BUILD_BUG_ON(PAGE_SIZE < HT16K33_FB_SIZE);
>  	fbdev->buffer = (unsigned char *) get_zeroed_page(GFP_KERNEL);
> @@ -445,6 +472,7 @@ static int ht16k33_probe(struct i2c_client *client,
>  	fbdev->info->screen_size = HT16K33_FB_SIZE;
>  	fbdev->info->fix = ht16k33_fb_fix;
>  	fbdev->info->var = ht16k33_fb_var;
> +	fbdev->info->bl_dev = bl;
>  	fbdev->info->pseudo_palette = NULL;
>  	fbdev->info->flags = FBINFO_FLAG_DEFAULT;
>  	fbdev->info->par = priv;
> @@ -460,34 +488,6 @@ static int ht16k33_probe(struct i2c_client *client,
>  			goto err_fbdev_unregister;
>  	}
> 
> -	/* Backlight */
> -	memset(&bl_props, 0, sizeof(struct backlight_properties));
> -	bl_props.type = BACKLIGHT_RAW;
> -	bl_props.max_brightness = MAX_BRIGHTNESS;
> -
> -	bl = devm_backlight_device_register(&client->dev, DRIVER_NAME"-bl",
> -					    &client->dev, priv,
> -					    &ht16k33_bl_ops, &bl_props);
> -	if (IS_ERR(bl)) {
> -		dev_err(&client->dev, "failed to register backlight\n");
> -		err = PTR_ERR(bl);
> -		goto err_fbdev_unregister;
> -	}
> -
> -	err = of_property_read_u32(node, "default-brightness-level",
> -				   &dft_brightness);
> -	if (err) {
> -		dft_brightness = MAX_BRIGHTNESS;
> -	} else if (dft_brightness > MAX_BRIGHTNESS) {
> -		dev_warn(&client->dev,
> -			 "invalid default brightness level: %u, using %u\n",
> -			 dft_brightness, MAX_BRIGHTNESS);
> -		dft_brightness = MAX_BRIGHTNESS;
> -	}
> -
> -	bl->props.brightness = dft_brightness;
> -	ht16k33_bl_update_status(bl);
> -
>  	ht16k33_fb_queue(priv);
>  	return 0;

Powered by blists - more mailing lists