linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "dbasehore ." <dbasehore@chromium.org>
To: Derek Basehore <dbasehore@chromium.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Thierry Reding <thierry.reding@gmail.com>,
	Sam Ravnborg <sam@ravnborg.org>, David Airlie <airlied@linux.ie>,
	Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <maxime.ripard@bootlin.com>,
	Sean Paul <sean@poorly.run>,
	Jani Nikula <jani.nikula@linux.intel.com>,
	Joonas Lahtinen <joonas.lahtinen@linux.intel.com>,
	Rodrigo Vivi <rodrigo.vivi@intel.com>, CK Hu <ck.hu@mediatek.com>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	dri-devel <dri-devel@lists.freedesktop.org>,
	devicetree@vger.kernel.org,
	Intel Graphics <intel-gfx@lists.freedesktop.org>,
	"moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" 
	<linux-arm-kernel@lists.infradead.org>,
	"moderated list:ARM/Mediatek SoC support" 
	<linux-mediatek@lists.infradead.org>
Cc: Daniel Vetter <daniel@ffwll.ch>
Subject: Re: [PATCH 3/5] drm/panel: Add attach/detach callbacks
Date: Thu, 20 Jun 2019 18:57:52 -0700	[thread overview]
Message-ID: <CAGAzgsoE5CgkQVhU_LSsetBRistMnuRqO7Sh+cuycMJa7QXzDg@mail.gmail.com> (raw)
In-Reply-To: <CAGAzgsr2sh5B1xi_ztQPN0xoQsZd26DDXwWT_qqJ68XeKReJ_Q@mail.gmail.com>

If we want to query the device tree outside of the panel code in
helper functions, we can do this with the struct as is. There's
already a device struct pointer in drm_panel, so I think we can pull
from that.

On Tue, Jun 11, 2019 at 5:25 PM dbasehore . <dbasehore@chromium.org> wrote:
>
> On Tue, Jun 11, 2019 at 1:57 AM Daniel Vetter <daniel@ffwll.ch> wrote:
> >
> > On Mon, Jun 10, 2019 at 09:03:48PM -0700, Derek Basehore wrote:
> > > This adds the attach/detach callbacks. These are for setting up
> > > internal state for the connector/panel pair that can't be done at
> > > probe (since the connector doesn't exist) and which don't need to be
> > > repeatedly done for every get/modes, prepare, or enable callback.
> > > Values such as the panel orientation, and display size can be filled
> > > in for the connector.
> > >
> > > Signed-off-by: Derek Basehore <dbasehore@chromium.org>
> > > ---
> > >  drivers/gpu/drm/drm_panel.c | 14 ++++++++++++++
> > >  include/drm/drm_panel.h     |  4 ++++
> > >  2 files changed, 18 insertions(+)
> > >
> > > diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c
> > > index 3b689ce4a51a..72f67678d9d5 100644
> > > --- a/drivers/gpu/drm/drm_panel.c
> > > +++ b/drivers/gpu/drm/drm_panel.c
> > > @@ -104,12 +104,23 @@ EXPORT_SYMBOL(drm_panel_remove);
> > >   */
> > >  int drm_panel_attach(struct drm_panel *panel, struct drm_connector *connector)
> > >  {
> > > +     int ret;
> > > +
> > >       if (panel->connector)
> > >               return -EBUSY;
> > >
> > >       panel->connector = connector;
> > >       panel->drm = connector->dev;
> > >
> > > +     if (panel->funcs->attach) {
> > > +             ret = panel->funcs->attach(panel);
> > > +             if (ret < 0) {
> > > +                     panel->connector = NULL;
> > > +                     panel->drm = NULL;
> > > +                     return ret;
> > > +             }
> > > +     }
> >
> > Why can't we just implement this in the drm helpers for everyone, by e.g.
> > storing a dt node in drm_panel? Feels a bit overkill to have these new
> > hooks here.
> >
> > Also, my understanding is that this dt stuff is supposed to be
> > standardized, so this should work.
>
> So do you want all of this information added to the drm_panel struct?
> If we do that, we don't necessarily even need the drm helper function.
> We could just copy the values over here in the drm_panel_attach
> function (and clear them in drm_panel_detach).
>
> > -Daniel
> >
> > > +
> > >       return 0;
> > >  }
> > >  EXPORT_SYMBOL(drm_panel_attach);
> > > @@ -128,6 +139,9 @@ EXPORT_SYMBOL(drm_panel_attach);
> > >   */
> > >  int drm_panel_detach(struct drm_panel *panel)
> > >  {
> > > +     if (panel->funcs->detach)
> > > +             panel->funcs->detach(panel);
> > > +
> > >       panel->connector = NULL;
> > >       panel->drm = NULL;
> > >
> > > diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h
> > > index 13631b2efbaa..e136e3a3c996 100644
> > > --- a/include/drm/drm_panel.h
> > > +++ b/include/drm/drm_panel.h
> > > @@ -37,6 +37,8 @@ struct display_timing;
> > >   * struct drm_panel_funcs - perform operations on a given panel
> > >   * @disable: disable panel (turn off back light, etc.)
> > >   * @unprepare: turn off panel
> > > + * @detach: detach panel->connector (clear internal state, etc.)
> > > + * @attach: attach panel->connector (update internal state, etc.)
> > >   * @prepare: turn on panel and perform set up
> > >   * @enable: enable panel (turn on back light, etc.)
> > >   * @get_modes: add modes to the connector that the panel is attached to and
> > > @@ -70,6 +72,8 @@ struct display_timing;
> > >  struct drm_panel_funcs {
> > >       int (*disable)(struct drm_panel *panel);
> > >       int (*unprepare)(struct drm_panel *panel);
> > > +     void (*detach)(struct drm_panel *panel);
> > > +     int (*attach)(struct drm_panel *panel);
> > >       int (*prepare)(struct drm_panel *panel);
> > >       int (*enable)(struct drm_panel *panel);
> > >       int (*get_modes)(struct drm_panel *panel);
> > > --
> > > 2.22.0.rc2.383.gf4fbbf30c2-goog
> > >
> >
> > --
> > Daniel Vetter
> > Software Engineer, Intel Corporation
> > http://blog.ffwll.ch

  reply	other threads:[~2019-06-21  1:58 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-11  4:03 [PATCH v2 0/5] Panel rotation patches Derek Basehore
2019-06-11  4:03 ` [PATCH 1/5] drm/panel: Add helper for reading DT rotation Derek Basehore
2019-06-12 21:18   ` Sam Ravnborg
2019-06-15  0:43     ` dbasehore .
2019-06-15  0:44       ` dbasehore .
2019-06-12 21:20   ` Sam Ravnborg
2019-06-14  0:32     ` dbasehore .
2019-06-11  4:03 ` [PATCH 2/5] dt-bindings: display/panel: Expand rotation documentation Derek Basehore
2019-06-11 15:25   ` Rob Herring
2019-06-11 22:01     ` dbasehore .
2019-06-13 12:51       ` Rob Herring
2019-06-13 21:00         ` dbasehore .
2019-06-11  4:03 ` [PATCH 3/5] drm/panel: Add attach/detach callbacks Derek Basehore
2019-06-11  8:57   ` Daniel Vetter
2019-06-12  0:25     ` dbasehore .
2019-06-21  1:57       ` dbasehore . [this message]
2019-06-21  9:19       ` Thierry Reding
2019-06-22  1:54         ` dbasehore .
2019-06-11  4:03 ` [PATCH 4/5] drm/connector: Split out orientation quirk detection Derek Basehore
2019-06-11  8:08   ` Jani Nikula
2019-06-11  8:54     ` Hans de Goede
2019-06-12  0:16       ` dbasehore .
2019-06-12 12:33         ` Hans de Goede
2019-06-14  0:36           ` dbasehore .
2019-06-11  4:03 ` [PATCH 5/5] drm/mtk: add panel orientation property Derek Basehore
  -- strict thread matches above, loose matches on Subject: below --
2019-06-11  0:22 [PATCH 0/5] Panel rotation patches Derek Basehore
2019-06-11  0:22 ` [PATCH 3/5] drm/panel: Add attach/detach callbacks Derek Basehore

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=CAGAzgsoE5CgkQVhU_LSsetBRistMnuRqO7Sh+cuycMJa7QXzDg@mail.gmail.com \
    --to=dbasehore@chromium.org \
    --cc=airlied@linux.ie \
    --cc=ck.hu@mediatek.com \
    --cc=daniel@ffwll.ch \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=joonas.lahtinen@linux.intel.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mark.rutland@arm.com \
    --cc=matthias.bgg@gmail.com \
    --cc=maxime.ripard@bootlin.com \
    --cc=p.zabel@pengutronix.de \
    --cc=robh+dt@kernel.org \
    --cc=rodrigo.vivi@intel.com \
    --cc=sam@ravnborg.org \
    --cc=sean@poorly.run \
    --cc=thierry.reding@gmail.com \
    /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).