[PATCH v2 23/24] drm/omap: display: Backlight update

Sebastian Reichel sebastian.reichel at collabora.com
Fri Aug 28 11:55:23 UTC 2020


Hi,

On Sun, Aug 23, 2020 at 12:45:31PM +0200, Sam Ravnborg wrote:
> - Introduce backlight_{enable/disable)
> - Use get/set methods for backlight_properties
> - Drop redundant get_brightness() implementation
>   The default implementation return the current brightness value
> - Use macro for backlight initialization
> 
> v2:
>   - Drop backlight_update() call as it is redundant (Sebastian)
> 
> Signed-off-by: Sam Ravnborg <sam at ravnborg.org>
> Cc: Tomi Valkeinen <tomi.valkeinen at ti.com>
> Cc: Sebastian Reichel <sebastian.reichel at collabora.com>
> Cc: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> Cc: Zheng Bin <zhengbin13 at huawei.com>
> Cc: Sam Ravnborg <sam at ravnborg.org>
> ---

Reviewed-by: Sebastian Reichel <sebastian.reichel at collabora.com>

-- Sebastian

>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 37 +++----------------
>  1 file changed, 6 insertions(+), 31 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index 3484b5d4a91c..39b3a7affbc8 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -110,17 +110,10 @@ static void dsicm_bl_power(struct panel_drv_data *ddata, bool enable)
>  	else
>  		return;
>  
> -	if (enable) {
> -		backlight->props.fb_blank = FB_BLANK_UNBLANK;
> -		backlight->props.state = ~(BL_CORE_FBBLANK | BL_CORE_SUSPENDED);
> -		backlight->props.power = FB_BLANK_UNBLANK;
> -	} else {
> -		backlight->props.fb_blank = FB_BLANK_NORMAL;
> -		backlight->props.power = FB_BLANK_POWERDOWN;
> -		backlight->props.state |= BL_CORE_FBBLANK | BL_CORE_SUSPENDED;
> -	}
> -
> -	backlight_update_status(backlight);
> +	if (enable)
> +		backlight_enable(backlight);
> +	else
> +		backlight_disable(backlight);
>  }
>  
>  static void hw_guard_start(struct panel_drv_data *ddata, int guard_msec)
> @@ -363,13 +356,7 @@ static int dsicm_bl_update_status(struct backlight_device *dev)
>  	struct panel_drv_data *ddata = dev_get_drvdata(&dev->dev);
>  	struct omap_dss_device *src = ddata->src;
>  	int r = 0;
> -	int level;
> -
> -	if (dev->props.fb_blank == FB_BLANK_UNBLANK &&
> -			dev->props.power == FB_BLANK_UNBLANK)
> -		level = dev->props.brightness;
> -	else
> -		level = 0;
> +	int level = backlight_get_brightness(dev);
>  
>  	dev_dbg(&ddata->pdev->dev, "update brightness to %d\n", level);
>  
> @@ -390,17 +377,7 @@ static int dsicm_bl_update_status(struct backlight_device *dev)
>  	return r;
>  }
>  
> -static int dsicm_bl_get_intensity(struct backlight_device *dev)
> -{
> -	if (dev->props.fb_blank == FB_BLANK_UNBLANK &&
> -			dev->props.power == FB_BLANK_UNBLANK)
> -		return dev->props.brightness;
> -
> -	return 0;
> -}
> -
>  static const struct backlight_ops dsicm_bl_ops = {
> -	.get_brightness = dsicm_bl_get_intensity,
>  	.update_status  = dsicm_bl_update_status,
>  };
>  
> @@ -1305,9 +1282,7 @@ static int dsicm_probe(struct platform_device *pdev)
>  	dsicm_hw_reset(ddata);
>  
>  	if (ddata->use_dsi_backlight) {
> -		struct backlight_properties props = { 0 };
> -		props.max_brightness = 255;
> -		props.type = BACKLIGHT_RAW;
> +		DECLARE_BACKLIGHT_INIT_RAW(props, 0, 255);
>  
>  		bldev = devm_backlight_device_register(dev, dev_name(dev),
>  			dev, ddata, &dsicm_bl_ops, &props);
> -- 
> 2.25.1
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20200828/7a3ee087/attachment-0001.sig>


More information about the dri-devel mailing list