linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bjorn Andersson <bjorn.andersson-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
To: abhinavk-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org
Cc: architt-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org,
	jeykumar-jfJNa2p1gH1BDgjK7y7TUQ@public.gmane.org,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	robdclark-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	nganji-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org,
	seanpaul-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org,
	hoegsberg-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org,
	jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org,
	freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	chandanu-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org
Subject: Re: [DPU PATCH v2 2/2] drm/panel: add backlight control support for truly panel
Date: Mon, 16 Apr 2018 23:13:56 -0700	[thread overview]
Message-ID: <20180417061356.GG10725@tuxbook-pro> (raw)
In-Reply-To: <d50c2a2dac7d6541d78eee60c2ff4739-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>

On Mon 16 Apr 15:45 PDT 2018, abhinavk@codeaurora.org wrote:

> Hi Bjorn
> 
> Thanks for the review.
> 
> Reply inline.
> 
> On 2018-04-16 09:41, Bjorn Andersson 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.
> > 
> [Abhinav] As sean mentioned, its quite common to list it to view it in the
> log.
> This practice has been followed by quite a few in DRM
> Another reference here https://patchwork.freedesktop.org/patch/211361/
> 

If that's the practice in DRM land, then that's what you should do.

> > > 
> > > Signed-off-by: Abhinav Kumar <abhinavk@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
> [Abhinav] Thats not the only purpose of backlight_device_register().
> We want to hook up our panel with the parent backlight driver in
> drivers/video/backlight/backlight.c and also route all the
> update_backlight_status()
> calls through the sysfs of the newly registered node.
> 
> The of_find_backlight() method doesnt seem to allow us to register our own
> sysfs method.
> 

Are you saying that you want to be able to create an alias for the wled
entry already in /sys/class/backlight named panel0-backlight?

> BTW, this isnt something which we are doing uniquely.
> There are other panels which seem to be doing this :
> 
> drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c
> 

What seems to be going on in the s6e3ha2 driver is that the hardware has
some sort of builtin backlight control, so the driver is creating a
backlight driver for the purpose of exposing those controls.

> Can you please comment on whether we can have our own sysfs without
> the device_register()?
> 

If the panel isn't actually a piece of backlight hardware then it should
not register a backlight device. Why do you need your own sysfs?

Regards,
Bjorn
_______________________________________________
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno

  parent reply	other threads:[~2018-04-17  6:13 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-14  7:25 [DPU PATCH v2 1/2] drm/panel: Add Truly NT35597 panel Abhinav Kumar
     [not found] ` <1523690713-22543-1-git-send-email-abhinavk-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-04-14  7:25   ` [DPU PATCH v2 2/2] drm/panel: add backlight control support for truly panel Abhinav Kumar
     [not found]     ` <1523690713-22543-2-git-send-email-abhinavk-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-04-16 16:41       ` Bjorn Andersson
2018-04-16 16:51         ` Sean Paul
2018-04-16 22:45         ` abhinavk-sgV2jX0FEOL9JmXXK+q4OQ
     [not found]           ` <d50c2a2dac7d6541d78eee60c2ff4739-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-04-17  6:13             ` Bjorn Andersson [this message]
2018-04-17 18:21               ` [Freedreno] " abhinavk
     [not found]                 ` <e220ca93282a7d942d4144ac2313efc0-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-04-17 18:57                   ` Sujeev Dias
2018-04-17 21:29                   ` Bjorn Andersson
2018-04-18  0:04                     ` abhinavk-sgV2jX0FEOL9JmXXK+q4OQ
2018-04-18  0:42                       ` [Freedreno] " abhinavk
2018-04-18 10:52                         ` Daniel Thompson
     [not found]                           ` <20180418105218.oja4gogmcx32ym5a-SoAo7ar8mTX/PtFMR13I2A@public.gmane.org>
2018-04-18 13:42                             ` Sean Paul
2018-04-18 22:08                               ` abhinavk-sgV2jX0FEOL9JmXXK+q4OQ
     [not found]                         ` <be0fa84101458da4cd6d77b963189baf-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-04-19  4:24                           ` Bjorn Andersson
2018-04-18 13:32                       ` [Freedreno] " Sean Paul
     [not found]                       ` <7cb250765fbf7b633fd54e4338cc433d-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-04-19  4:00                         ` Bjorn Andersson
2018-04-19  4:23                           ` abhinavk-sgV2jX0FEOL9JmXXK+q4OQ
     [not found]                             ` <b2e4e39d6911d4ab89fa753d194392b6-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-04-19  4:42                               ` Bjorn Andersson
2018-05-24  1:37                                 ` abhinavk-sgV2jX0FEOL9JmXXK+q4OQ
2018-04-19 17:44   ` [DPU PATCH v2 1/2] drm/panel: Add Truly NT35597 panel Archit Taneja
2018-05-24  1:28     ` abhinavk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180417061356.GG10725@tuxbook-pro \
    --to=bjorn.andersson-qsej5fyqhm4dnm+yrofe0a@public.gmane.org \
    --cc=abhinavk-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
    --cc=architt-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
    --cc=chandanu-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
    --cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=hoegsberg-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
    --cc=jeykumar-jfJNa2p1gH1BDgjK7y7TUQ@public.gmane.org \
    --cc=jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
    --cc=linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=nganji-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
    --cc=robdclark-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=seanpaul-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).