From: Thierry Reding <thierry.reding@gmail.com>
To: Ajay kumar <ajaynumb@gmail.com>
Cc: "linux-samsung-soc@vger.kernel.org"
<linux-samsung-soc@vger.kernel.org>,
Sean Paul <seanpaul@google.com>,
Daniel Vetter <daniel.vetter@ffwll.ch>,
sunil joshi <joshi@samsung.com>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>,
Javier Martinez Canillas <javier@dowhile0.org>,
Prashanth G <prashanth.g@samsung.com>,
Ajay Kumar <ajaykumar.rs@samsung.com>,
Rahul Sharma <rahul.sharma@samsung.com>
Subject: Re: [RESEND PATCH V5 12/12] drm/exynos: Add ps8622 lvds bridge discovery to DP driver
Date: Mon, 21 Jul 2014 16:44:28 +0200 [thread overview]
Message-ID: <20140721144427.GA28336@ulmo> (raw)
In-Reply-To: <CAEC9eQODqv=vkWhxnSVC4fFcfn1pHAmXzMZowayBbgKPjdppzw@mail.gmail.com>
[-- Attachment #1.1: Type: text/plain, Size: 5825 bytes --]
On Mon, Jul 21, 2014 at 08:06:01PM +0530, Ajay kumar wrote:
> Hi Thierry,
>
> On Mon, Jul 21, 2014 at 6:24 PM, Thierry Reding
> <thierry.reding@gmail.com> wrote:
> > On Mon, Jul 21, 2014 at 04:58:25PM +0530, Ajay kumar wrote:
> >> On Mon, Jul 21, 2014 at 12:40 PM, Thierry Reding
> >> <thierry.reding@gmail.com> wrote:
> >> > On Fri, Jul 18, 2014 at 02:13:58AM +0530, Ajay Kumar wrote:
> >> >> From: Rahul Sharma <Rahul.Sharma@samsung.com>
> >> >>
> >> >> This patch adds ps8622 lvds bridge discovery code to the dp driver.
> >> >>
> >> >> Signed-off-by: Rahul Sharma <Rahul.Sharma@samsung.com>
> >> >> Signed-off-by: Ajay Kumar <ajaykumar.rs@samsung.com>
> >> >> ---
> >> >> drivers/gpu/drm/exynos/exynos_dp_core.c | 5 +++++
> >> >> 1 file changed, 5 insertions(+)
> >> >>
> >> >> diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c b/drivers/gpu/drm/exynos/exynos_dp_core.c
> >> >> index 0ca6256..82e2942 100644
> >> >> --- a/drivers/gpu/drm/exynos/exynos_dp_core.c
> >> >> +++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
> >> >> @@ -31,6 +31,7 @@
> >> >> #include <drm/drm_panel.h>
> >> >> #include <drm/bridge/ptn3460.h>
> >> >> #include <drm/bridge/panel_binder.h>
> >> >> +#include <drm/bridge/ps8622.h>
> >> >>
> >> >> #include "exynos_drm_drv.h"
> >> >> #include "exynos_dp_core.h"
> >> >> @@ -999,6 +1000,10 @@ static int exynos_drm_attach_lcd_bridge(struct exynos_dp_device *dp,
> >> >> if (find_bridge("nxp,ptn3460", &bridge)) {
> >> >> bridge_chain = ptn3460_init(dp->drm_dev, encoder, bridge.client,
> >> >> bridge.node);
> >> >> + } else if (find_bridge("parade,ps8622", &bridge) ||
> >> >> + find_bridge("parade,ps8625", &bridge)) {
> >> >> + bridge_chain = ps8622_init(dp->drm_dev, encoder, bridge.client,
> >> >> + bridge.node);
> >> >> }
> >> >
> >> > We really ought to be adding some sort of registry at some point.
> >> > Otherwise every driver that wants to use bridges needs to come up with a
> >> > similar set of helpers to instantiate them.
> >> >
> >> > Also you're making this driver depend on (now) two bridges, whereas it
> >> > really shouldn't matter which exact types it supports. Bridges should be
> >> > exposed via a generic interface.
> >>
> >> How about moving out the find_bridge() function into a common header file,
> >> and also supporting the list of bridge_init declarations in the same file?
> >>
> >> We get bridge chip node from phandle, and then pass the same node
> >> to find_bridge() which searches the list using of_device_is_compatible()
> >> to call the appropriate bridge_init function?
> >
> > That could work, but it's still somewhat unusual and shouldn't be
> > required. I think we'd be better of with some sort of registry like we
> > have for panels. That would mean that a driver that wants to use a
> > bridge would do something like this:
> >
> > struct drm_bridge *bridge;
> > struct device_node *np;
> >
> > np = of_parse_phandle(dev->of_node, "bridge", 0);
> > if (np) {
> > bridge = of_drm_find_bridge(np);
> > of_node_put(np);
> >
> > if (!bridge)
> > return -EPROBE_DEFER;
> > }
> >
> > An alternative way would be to add a non-OF wrapper around this, like
> > this for example:
> Let me try the DT version first :)
>
> > bridge = drm_bridge_get(dev, NULL);
> >
> > Which would be conceptually the same as clk_get() or regulator_get() and
> > could be easily extended to support non-DT setups as well.
> >
> > As for bridge drivers I think we may have to rework things a little, so
> > that a driver can call some sequence like this:
> >
> > struct foo_bridge {
> > struct drm_bridge base;
> > ...
> > };
> >
> > static const struct drm_bridge_funcs foo_bridge_funcs = {
> > ...
> > };
> >
> > static int foo_probe(...)
> > {
> > struct foo_bridge *bridge;
> > int err;
> >
> > bridge = devm_kzalloc(dev, sizeof(*bridge), GFP_KERNEL);
> > if (!bridge)
> > return -ENOMEM;
> >
> > /* setup bridge (return -EPROBE_DEFER if necessary, ...) */
> >
> > /* register bridge with DRM */
> > drm_bridge_init(&bridge->base);
> > bridge->base.dev = dev;
> > bridge->base.funcs = &foo_bridge_funcs;
> >
> > err = drm_bridge_add(&bridge->base);
> > if (err < 0)
> > return err;
> >
> > dev_set_drvdata(dev, bridge);
> > ...
> > }
> >
> > drm_bridge_add() would add the bridge to a global list of bridge devices
> > which drm_bridge_get()/of_drm_find_bridge() can use to find the one that
> > it needs. The above has the big advantage that it'sdev->mode_config.bridge_list completely
> > independent of the underlying bus that the bridge is on. It could be I2C
> > or SPI, platform device or PCI device.
> >
> > Thierry
> Ok. This is all about making the bridge driver confine to the driver model.
> But, I would need a drm_device pointer to register the bridge to DRM core.
> How do I get it?
Once you've obtained a reference to the DRM bridge from your driver you
should carry it around until you've set up the DRM device. Then you can
hook it up, which possibly requires a new function (since it's what the
drm_bridge_init() used to do).
Thierry
[-- Attachment #1.2: Type: application/pgp-signature, Size: 819 bytes --]
[-- Attachment #2: Type: text/plain, Size: 159 bytes --]
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2014-07-21 14:44 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-17 20:43 [PATCH V5 00/12] drm/exynos: few patches to enhance bridge chip support Ajay Kumar
2014-07-17 20:43 ` [RESEND PATCH V5 01/12] drm/exynos: Move DP setup out of hotplug workqueue Ajay Kumar
2014-07-22 14:59 ` Sean Paul
2014-07-23 11:22 ` Ajay kumar
2014-07-23 14:42 ` Sean Paul
2014-07-23 15:18 ` Ajay kumar
2014-07-24 20:16 ` Sean Paul
2014-07-17 20:43 ` [RESEND PATCH V5 02/12] drm/panel: add prepare and unprepare routines Ajay Kumar
2014-07-17 20:43 ` [RESEND PATCH V5 03/12] drm/exynos: dp: modify driver to support drm_panel Ajay Kumar
2014-07-21 8:02 ` Thierry Reding
2014-07-21 8:14 ` Thierry Reding
2014-07-21 12:18 ` Ajay kumar
2014-07-17 20:43 ` [PATCH V5 04/12] drm/panel: Add driver for lvds/edp based panels Ajay Kumar
2014-07-17 20:43 ` [PATCH V5 05/12] Documentation: Add DT bindings for panel-lvds driver Ajay Kumar
2014-07-17 20:50 ` Ajay kumar
2014-07-17 22:48 ` Thierry Reding
2014-07-18 6:48 ` Ajay kumar
2014-07-21 7:52 ` Thierry Reding
2014-07-21 12:30 ` Ajay kumar
2014-07-17 20:43 ` [RESEND PATCH V5 06/12] drm/bridge: add helper functions to support bridge chain Ajay Kumar
2014-07-17 20:43 ` [PATCH V5 07/12] drm/bridge: Add a driver which binds drm_bridge with drm_panel Ajay Kumar
2014-07-17 20:43 ` [RESEND PATCH V5 08/12] drm/bridge: ptn3460: Support bridge chaining Ajay Kumar
2014-07-21 7:55 ` Inki Dae
2014-07-21 8:22 ` Thierry Reding
2014-07-21 11:58 ` Ajay kumar
2014-07-21 12:40 ` Thierry Reding
2014-07-22 6:21 ` Ajay kumar
2014-07-17 20:43 ` [RESEND PATCH V5 09/12] drm/exynos: dp: create bridge chain using ptn3460 and panel_binder Ajay Kumar
2014-07-17 20:43 ` [PATCH V5 10/12] drm/bridge: Add ps8622/ps8625 bridge driver Ajay Kumar
2014-07-17 20:43 ` [PATCH V5 11/12] Documentation: Add DT bindings for " Ajay Kumar
2014-07-17 20:51 ` Ajay kumar
2014-07-21 7:06 ` Thierry Reding
2014-07-21 10:54 ` Ajay kumar
2014-07-17 20:43 ` [RESEND PATCH V5 12/12] drm/exynos: Add ps8622 lvds bridge discovery to DP driver Ajay Kumar
2014-07-21 7:10 ` Thierry Reding
2014-07-21 11:28 ` Ajay kumar
2014-07-21 12:54 ` Thierry Reding
2014-07-21 14:36 ` Ajay kumar
2014-07-21 14:44 ` Thierry Reding [this message]
2014-07-22 6:05 ` Ajay kumar
2014-07-22 7:51 ` Thierry Reding
2014-07-21 7:51 ` [PATCH V5 00/12] drm/exynos: few patches to enhance bridge chip support Inki Dae
2014-07-21 11:33 ` Ajay kumar
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=20140721144427.GA28336@ulmo \
--to=thierry.reding@gmail.com \
--cc=ajaykumar.rs@samsung.com \
--cc=ajaynumb@gmail.com \
--cc=daniel.vetter@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=javier@dowhile0.org \
--cc=joshi@samsung.com \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=prashanth.g@samsung.com \
--cc=rahul.sharma@samsung.com \
--cc=seanpaul@google.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