[Freedreno] [DPU PATCH v2 2/2] drm/panel: add backlight control support for truly panel

Bjorn Andersson bjorn.andersson at linaro.org
Mon Apr 16 16:41:52 UTC 2018


On Sat 14 Apr 00:25 PDT 2018, Abhinav Kumar wrote:

> Register truly panel as a backlight led device and
> provide methods to control its backlight operation.
> 
> Changes in v2:
> - Removed redundant NULL checks
> - Arranged headers alphabetically
> - Formatting fixes

The change log goes below the "---" line.

> 
> Signed-off-by: Abhinav Kumar <abhinavk at codeaurora.org>
> ---
[..]
> +static int truly_backlight_setup(struct truly_wqxga *ctx)
> +{
> +	struct backlight_properties props;
> +	char bl_node_name[BL_NODE_NAME_SIZE];
> +
> +	if (!ctx->backlight) {
> +		memset(&props, 0, sizeof(props));
> +		props.type = BACKLIGHT_RAW;
> +		props.power = FB_BLANK_UNBLANK;
> +		props.max_brightness = 4096;
> +
> +		snprintf(bl_node_name, BL_NODE_NAME_SIZE, "panel%u-backlight",
> +				 PRIM_DISPLAY_NODE);
> +
> +		ctx->backlight =  backlight_device_register(bl_node_name,
> +				ctx->dev, ctx,
> +				&truly_backlight_device_ops, &props);
> +
> +		if (IS_ERR_OR_NULL(ctx->backlight)) {
> +			pr_err("Failed to register backlight\n");
> +			ctx->backlight = NULL;
> +			return -ENODEV;
> +		}
> +
> +		/* Register with the LED driver interface */
> +		led_trigger_register_simple("bkl-trigger", &ctx->wled);
> +
> +		if (!ctx->wled) {
> +			pr_err("backlight led registration failed\n");
> +			return -ENODEV;
> +		}

It seems like you're registering a backlight driver for the sake of
invoking the LED backlight trigger to control the WLED.

The WLED is a backlight driver, so all you should have to do is add the
following line to your probe:

	ctx->backlight = devm_of_find_backlight(dev);

and then add "backlight = <&wled>" to your dt node.

Regards,
Bjorn


More information about the Freedreno mailing list