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

Sean Paul seanpaul at chromium.org
Mon Apr 16 16:51:09 UTC 2018


On Mon, Apr 16, 2018 at 12:41 PM Bjorn Andersson
<bjorn.andersson at linaro.org>
wrote:

> 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.

FYI: In drm, people generally prefer to put them above --- so the history
is preserved in the logs. Some choose to annotate with the name of the
person suggesting the change for added information/credit.

Sean



> >
> > 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