From: Thierry Reding <thierry.reding@gmail.com>
To: Stephen Warren <swarren@wwwdotorg.org>
Cc: Mark Rutland <mark.rutland@arm.com>,
devicetree@vger.kernel.org, Pawel Moll <pawel.moll@arm.com>,
Ian Campbell <ijc+devicetree@hellion.org.uk>,
dri-devel@lists.freedesktop.org, Rob Herring <robh+dt@kernel.org>,
Kumar Gala <galak@codeaurora.org>,
linux-tegra@vger.kernel.org
Subject: Re: [PATCH 2/2] drm/tegra: Obtain head number from DT
Date: Tue, 14 Jan 2014 15:14:19 +0100 [thread overview]
Message-ID: <20140114141416.GE10936@ulmo.nvidia.com> (raw)
In-Reply-To: <52D42685.1040603@wwwdotorg.org>
[-- Attachment #1.1: Type: text/plain, Size: 2586 bytes --]
On Mon, Jan 13, 2014 at 10:46:45AM -0700, Stephen Warren wrote:
> On 01/13/2014 07:21 AM, Thierry Reding wrote:
> > The head number of a given display controller is fixed in hardware and
> > required to program outputs appropriately. Relying on the driver probe
> > order to determine this number will not work, since that could yield a
> > situation where the second head was probed first and would be assigned
> > head number 0 instead of 1.
>
> This change makes the new properties mandatory, yet they aren't part of
> the DT files yet. So, won't this patch break all display on Tegra?
I don't think it'll make anything worse than it currently is, since both
display controllers can't run at the same time with the current code.
They can do so on Dalmore, so I guess that would be broken by the patch.
> To avoid having to modify the Tegra DTs in this patch, can't the code
> fall back to the existing broken algorithm if the property is missing, i.e.:
>
> > diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c
>
> > - dc->pipe = tegra->drm->mode_config.num_crtc;
>
> Instead,:
>
> if (dc->pipe == -1)
> dc->pipe = tegra->drm->mode_config.num_crtc;
>
> > +static int tegra_dc_parse_dt(struct tegra_dc *dc)
> > +{
> > + u32 value;
> > + int err;
> > +
> > + err = of_property_read_u32(dc->dev->of_node, "nvidia,head", &value);
> > + if (err < 0)
> > + return err;
> > +
> > + dc->pipe = value;
>
> Instead:
>
> err = ...
> if (!err)
> dc->pipe = value;
> else
> /* Perhaps also emit an error message here */
> dc->pipe = -1;
Yeah, that should work. It's still suboptimal because we fallback to
something that's broken and known not to work.
My original proposal was to make the dc->pipe assignment depend on the
physical address of the display controller's registers. That's ugly,
but all SoCs in existence do use the very same offset. So we could
reason that for anything that's still using the old DTB files we can
rely on the physical address of the registers, while any new DTBs
should include the new nvidia,head property.
I have a feeling that you won't like it, though.
One other method would be to iterate over all DT nodes that match the
display controller compatible and use the index for the pipe number.
That should fix the current issues, but is still a wee bit hackish
because it assumes that nodes in DTB will be in the same order as in
the DTS. That has been true since the beginning of DT on Linux AFAIK
and therefore should be reasonably safe.
Thierry
[-- Attachment #1.2: Type: application/pgp-signature, Size: 836 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-01-14 14:14 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-13 14:21 [PATCH 0/2] drm/tegra: Fix CRTC associated with outputs Thierry Reding
[not found] ` <1389622894-9574-1-git-send-email-treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2014-01-13 14:21 ` [PATCH 1/2] drm/tegra: Fix possible CRTC mask for RGB outputs Thierry Reding
[not found] ` <1389622894-9574-2-git-send-email-treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2014-01-13 17:44 ` Stephen Warren
[not found] ` <52D425FA.10402-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2014-01-14 13:45 ` Thierry Reding
2014-01-13 14:21 ` [PATCH 2/2] drm/tegra: Obtain head number from DT Thierry Reding
[not found] ` <1389622894-9574-3-git-send-email-treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2014-01-13 17:46 ` Stephen Warren
2014-01-14 14:14 ` Thierry Reding [this message]
[not found] ` <20140114141416.GE10936-AwZRO8vwLAwmlAP/+Wk3EA@public.gmane.org>
2014-01-14 16:54 ` Stephen Warren
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=20140114141416.GE10936@ulmo.nvidia.com \
--to=thierry.reding@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=galak@codeaurora.org \
--cc=ijc+devicetree@hellion.org.uk \
--cc=linux-tegra@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=pawel.moll@arm.com \
--cc=robh+dt@kernel.org \
--cc=swarren@wwwdotorg.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).