[PATCH v2 06/24] backlight: gpio: Use DECLARE_BACKLIGHT_INIT_RAW
Daniel Thompson
daniel.thompson at linaro.org
Wed Sep 2 11:21:15 UTC 2020
On Sun, Aug 23, 2020 at 12:45:14PM +0200, Sam Ravnborg wrote:
> Introduce use of DECLARE_BACKLIGHT_INIT_RAW when registering the
> backlight.
>
> Signed-off-by: Sam Ravnborg <sam at ravnborg.org>
> Cc: Lee Jones <lee.jones at linaro.org>
> Cc: Daniel Thompson <daniel.thompson at linaro.org>
> Cc: Jingoo Han <jingoohan1 at gmail.com>
> ---
> drivers/video/backlight/gpio_backlight.c | 7 +------
> 1 file changed, 1 insertion(+), 6 deletions(-)
>
> diff --git a/drivers/video/backlight/gpio_backlight.c b/drivers/video/backlight/gpio_backlight.c
> index 1d509b626b12..13d44417446a 100644
> --- a/drivers/video/backlight/gpio_backlight.c
> +++ b/drivers/video/backlight/gpio_backlight.c
> @@ -49,7 +49,7 @@ static int gpio_backlight_probe(struct platform_device *pdev)
> struct device *dev = &pdev->dev;
> struct gpio_backlight_platform_data *pdata = dev_get_platdata(dev);
> struct device_node *of_node = dev->of_node;
> - struct backlight_properties props;
> + DECLARE_BACKLIGHT_INIT_RAW(props, 1, 1);
Other than the existing comment about wanting a scale this looks fine.
Curiously I think no value of scale would be wrong for this driver...
but I'd be tempted to mark it as logarithmic (e.g. hint that userspace
should expose it directly on a slider without any remapping).
However since no value is wrong then whatever you choose is OK and this
will be:
Reviewed-by: Daniel Thompson <daniel.thompson at linaro.org>
Daniel.
> struct backlight_device *bl;
> struct gpio_backlight *gbl;
> int ret, init_brightness, def_value;
> @@ -69,9 +69,6 @@ static int gpio_backlight_probe(struct platform_device *pdev)
> return dev_err_probe(dev, PTR_ERR(gbl->gpiod),
> "The gpios parameter is missing or invalid.\n");
>
> - memset(&props, 0, sizeof(props));
> - props.type = BACKLIGHT_RAW;
> - props.max_brightness = 1;
> bl = devm_backlight_device_register(dev, dev_name(dev), dev, gbl,
> &gpio_backlight_ops, &props);
> if (IS_ERR(bl)) {
> @@ -96,8 +93,6 @@ static int gpio_backlight_probe(struct platform_device *pdev)
> else
> backlight_disable(bl);
>
> - bl->props.brightness = 1;
> -
> init_brightness = backlight_get_brightness(bl);
> ret = gpiod_direction_output(gbl->gpiod, init_brightness);
> if (ret) {
> --
> 2.25.1
>
More information about the dri-devel
mailing list