[PATCH v1 10/22] drm/panel: raydium-rm67191: Backlight update
daniel at ffwll.ch
daniel at ffwll.ch
Tue Aug 4 17:04:11 UTC 2020
On Sun, Aug 02, 2020 at 01:06:24PM +0200, Sam Ravnborg wrote:
> - Replace direct access to backlight_properties with
> backlight_get_brightness().
> - Use macro for initialization
>
> Signed-off-by: Sam Ravnborg <sam at ravnborg.org>
> Cc: Robert Chiras <robert.chiras at nxp.com>
> Cc: Thierry Reding <thierry.reding at gmail.com>
> Cc: Sam Ravnborg <sam at ravnborg.org>
> ---
> drivers/gpu/drm/panel/panel-raydium-rm67191.c | 11 +++--------
> 1 file changed, 3 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/panel/panel-raydium-rm67191.c b/drivers/gpu/drm/panel/panel-raydium-rm67191.c
> index 313637d53d28..5553db385dd5 100644
> --- a/drivers/gpu/drm/panel/panel-raydium-rm67191.c
> +++ b/drivers/gpu/drm/panel/panel-raydium-rm67191.c
> @@ -479,7 +479,7 @@ static int rad_bl_get_brightness(struct backlight_device *bl)
> if (ret < 0)
> return ret;
>
> - bl->props.brightness = brightness;
> + backlight_set_brightness(bl, brightness);
This sounds like a bad idea, again because this overrides the software
brightness value potentially when the backlight is off. Althought that's
checked a bit higher up, so not too terrible.
I'm also feeling like a helper for standard mipi dsi panel backlight would
be great, it's pretty much all the same code.
-Daniel
>
> return brightness & 0xff;
> }
> @@ -495,7 +495,7 @@ static int rad_bl_update_status(struct backlight_device *bl)
>
> dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
>
> - ret = mipi_dsi_dcs_set_display_brightness(dsi, bl->props.brightness);
> + ret = mipi_dsi_dcs_set_display_brightness(dsi, backlight_get_brightness(bl));
> if (ret < 0)
> return ret;
>
> @@ -539,10 +539,10 @@ static int rad_init_regulators(struct rad_panel *rad)
>
> static int rad_panel_probe(struct mipi_dsi_device *dsi)
> {
> + DECLARE_BACKLIGHT_INIT_RAW(bl_props, 255, 255);
> struct device *dev = &dsi->dev;
> struct device_node *np = dev->of_node;
> struct rad_panel *panel;
> - struct backlight_properties bl_props;
> int ret;
> u32 video_mode;
>
> @@ -588,11 +588,6 @@ static int rad_panel_probe(struct mipi_dsi_device *dsi)
> if (IS_ERR(panel->reset))
> return PTR_ERR(panel->reset);
>
> - memset(&bl_props, 0, sizeof(bl_props));
> - bl_props.type = BACKLIGHT_RAW;
> - bl_props.brightness = 255;
> - bl_props.max_brightness = 255;
> -
> panel->backlight = devm_backlight_device_register(dev, dev_name(dev),
> dev, dsi, &rad_bl_ops,
> &bl_props);
> --
> 2.25.1
>
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
More information about the dri-devel
mailing list