[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAD=FV=UuWuKibpT15McweuZ24qxsSAsSvJ3Q2MbZqgw5oggBVQ@mail.gmail.com>
Date: Thu, 27 May 2021 14:41:08 -0700
From: Doug Anderson <dianders@...omium.org>
To: Rajeev Nandan <rajeevny@...eaurora.org>
Cc: "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS"
<devicetree@...r.kernel.org>,
Daniel Thompson <daniel.thompson@...aro.org>,
mkrishn@...eaurora.org, Sam Ravnborg <sam@...nborg.org>,
Jani Nikula <jani.nikula@...el.com>,
linux-arm-msm <linux-arm-msm@...r.kernel.org>,
Abhinav Kumar <abhinavk@...eaurora.org>,
LKML <linux-kernel@...r.kernel.org>,
dri-devel <dri-devel@...ts.freedesktop.org>,
Andrzej Hajda <a.hajda@...sung.com>,
Thierry Reding <thierry.reding@...il.com>,
Sean Paul <seanpaul@...omium.org>,
Laurent Pinchart <laurent.pinchart@...asonboard.com>,
Kalyan Thota <kalyan_t@...eaurora.org>,
"Kristian H. Kristensen" <hoegsberg@...omium.org>,
freedreno <freedreno@...ts.freedesktop.org>
Subject: Re: [v4 1/4] drm/panel-simple: Add basic DPCD backlight support
Hi,
On Thu, May 27, 2021 at 5:21 AM <rajeevny@...eaurora.org> wrote:
>
> >> @@ -171,6 +172,19 @@ struct panel_desc {
> >>
> >> /** @connector_type: LVDS, eDP, DSI, DPI, etc. */
> >> int connector_type;
> >> +
> >> + /**
> >> + * @uses_dpcd_backlight: Panel supports eDP dpcd backlight
> >> control.
> >> + *
> >> + * Set true, if the panel supports backlight control over eDP
> >> AUX channel
> >> + * using DPCD registers as per VESA's standard.
> >> + */
> >> + bool uses_dpcd_backlight;
> >> +};
> >> +
> >> +struct edp_backlight {
> >> + struct backlight_device *dev;
> >
> > Can you pick a name other than "dev". In my mind "dev" means you've
> > got a "struct device" or a "struct device *".
>
> In the backlight.h "bd" is used for "struct backlight_device". I can use
> "bd"?
That would be OK w/ me since it's not "dev". In theory you could also
call it "base" like panel-simple does with the base class drm_panel,
but I'll leave that up to you. It's mostly that in my brain "dev" is
reserved for "struct device" but otherwise I'm pretty flexible.
> >> + struct drm_edp_backlight_info info;
> >> };
> >>
> >> struct panel_simple {
> >> @@ -194,6 +208,8 @@ struct panel_simple {
> >>
> >> struct edid *edid;
> >>
> >> + struct edp_backlight *edp_bl;
> >> +
> >
> > I don't think you need to add this pointer. See below for details, but
> > basically the backlight device should be in base.backlight. Any code
> > that needs the containing structure can use the standard
> > "container_of" syntax.
> >
>
> The documentation of the "struct drm_panel -> backlight" mentions
> "backlight is set by drm_panel_of_backlight() and drivers shall not
> assign it."
> That's why I was not sure if I should touch that part. Because of this,
> I added
> backlight enable/disable calls inside panel_simple_disable/enable().
Fair enough. In my opinion (subject to being overridden by the adults
in the room), if you move your backlight code into drm_panel.c and
call it drm_panel_dp_aux_backlight() then it's fair game to use. This
basically means that it's no longer a "driver" assigning it since it's
being done in drm_panel.c. ;-) Obviously you'd want to update the
comment, too...
> >> + err = drm_panel_of_backlight(&panel->base);
> >> + if (err)
> >> + goto disable_pm_runtime;
> >> + }
> >
> > See above where I'm suggesting some different logic. Specifically:
> > always try the drm_panel_of_backlight() call and then fallback to the
> > AUX backlight if "panel->base.backlight" is NULL and "panel->aux" is
> > not NULL.
>
> What I understood:
> 1. Create a new API drm_panel_dp_aux_backlight() in drm_panel.c
> 1.1. Register DP AUX backlight if "struct drm_dp_aux" is given and
> drm_edp_backlight_supported()
> 2. Create a call back function for backlight ".update_status()" inside
> drm_panel.c ?
> This function should also handle the backlight enable/disable
> operations.
> 3. Use the suggested rules to call drm_panel_dp_aux_backlight() as a
> fallback, if
> no backlight is specified in the DT.
> 4. Remove the @uses_dpcd_backlight flag from panel_desc as this should
> be auto-detected.
This sounds about right to me.
As per all of my reviews in the DRM subsystem, this is all just my
opinion and if someone more senior in DRM contradicts me then, of
course, you might have to change directions. Hopefully that doesn't
happen but it's always good to give warning...
-Doug
Powered by blists - more mailing lists