dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>
To: Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
Cc: "Jon Mayo" <jmayo-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>,
	"Terje Bergström"
	<tbergstrom-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	"Olof Johansson" <olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org>,
	"Colin Cross" <ccross-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org>,
	"Lucas Stach" <dev-8ppwABl0HbeELgA04lAiVw@public.gmane.org>,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	"David Airlie" <airlied-cv59FeDIM0c@public.gmane.org>,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
	"Joerg Roedel" <joerg.roedel-5C7GfCeVMHo@public.gmane.org>,
	"Hiroshi Doyu" <hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
	"Grant Likely"
	<grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>,
	"Rob Herring"
	<rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org>,
	"Liam Girdwood" <lrg-l0cyMroinI0@public.gmane.org>,
	"Mark Brown"
	<broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>,
	"Ben Dooks" <ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org>,
	"Wolfram Sang" <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [RFC v2 5/5] drm: Add NVIDIA Tegra support
Date: Mon, 21 May 2012 12:55:12 +0200	[thread overview]
Message-ID: <20120521105512.GB27686@avionic-0098.mockup.avionic-design.de> (raw)
In-Reply-To: <4FA2F702.6040701-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 7165 bytes --]

* Stephen Warren wrote:
> On 04/25/2012 03:45 AM, Thierry Reding wrote:
> > This commit adds a very basic DRM driver for NVIDIA Tegra SoCs. It
> > currently has rudimentary GEM support and can run a console on the
> > framebuffer as well as X using the xf86-video-modesetting driver. Only
> > the RGB output is supported.
> > 
> > HDMI support was taken from NVIDIA's Linux kernel tree but it doesn't
> > quite work. EDID data can be retrieved but the output doesn't properly
> > activate the connected TV.
> > 
> > The DSI and TVO outputs and the HOST1X driver are just stubs that setup
> > the corresponding resources but don't do anything useful yet.
> 
> I'm mainly going to comment on the device tree bindings here; hopefully
> Jon and Terje can chime in on the code itself.
> 
> > diff --git a/Documentation/devicetree/bindings/gpu/drm/tegra.txt b/Documentation/devicetree/bindings/gpu/drm/tegra.txt
> 
> > +Example:
> > +
> > +/memreserve/ 0x0e000000 0x02000000;
> > +
> > +...
> > +
> > +/ {
> > +	...
> > +
> > +	/* host1x */
> > +	host1x: host1x@50000000 {
> > +		compatible = "nvidia,tegra20-host1x";
> > +		reg = <0x50000000 0x00024000>;
> > +		interrupts = <0 64 0x04   /* cop syncpt */
> > +			      0 65 0x04   /* mpcore syncpt */
> > +			      0 66 0x04   /* cop general */
> > +			      0 67 0x04>; /* mpcore general */
> > +	};
> 
> The host1x module is apparently a register bus, behind which all the
> other modules sit. According to the address map in the TRM, "all the
> other modules" appears to include all of MPE, VI, CSI, EPP, ISP, GR2D,
> GR3D, DISPLAY A/B, HDMI, TVO, DSI, plus VG, VS, VCI, DSIB on Tegra30.
> 
> That said, I believe Terje wasn't convinced that all those modules are
> really host1x children, just some. Can you check please, Terje?
> 
> Also, I wonder if host1x is really the parent of these modules,
> register-bus-access-wise, or whether the bus covers the "graphic host
> registers" at 0x50000000-0x50023fff?
> 
> As such, I think the DT nodes for all those modules should be within the
> host1x node (or perhaps graphics host node, pending above discussion):
> 
>     host1x: host1x@50000000 {
>         mpe@54040000 { ... };
>         vi@54080000 { ... };
>         ...
>     };
> 
> host1x can easily instantiate all the child nodes simply by calling
> of_platform_populate() at the end of its probe; see
> sound/soc/tegra/tegra30_ahub.c for an example.

I actually had an implementation at some point that did exactly that. The
problem was that there is no equivalent to of_platform_populate() to call at
module removal, so that when the tegra-drm module was unloaded and reloaded,
it would try to create duplicate devices.

Something ugly can probably be done with device_for_each_child(), but maybe a
better option would be to add a helper to the DT code to explicitly undo the
effects of of_platform_populate() (of_platform_desolate()?).

> > +	/* video-encoding/decoding */
> > +	mpe@54040000 {
> > +		reg = <0x54040000 0x00040000>;
> > +		interrupts = <0 68 0x04>;
> > +	};
> 
> We'll probably end up needing a phandle from each of these nodes to
> host1x, and a channel ID, so the drivers for these nodes can register
> themselves with host1x. However, I it's probably OK to defer the DT
> binding for this until we actually start working on command-channels.

I suppose these should now also drop the unit addresses to follow your
cleanup patches of the DTS files.

> > +	/* graphics host */
> > +	graphics@54000000 {
> > +		compatible = "nvidia,tegra20-graphics";
> > +
> > +		#address-cells = <1>;
> > +		#size-cells = <1>;
> > +		ranges;
> 
> I don't think those 3 properties are needed, unless there are child
> nodes with registers.

Right, those are relics from the earlier version I mentioned above, where the
other nodes were children of the graphics node.

> > +		display-controllers = <&disp1 &disp2>;
> > +		carveout = <0x0e000000 0x02000000>;
> > +		host1x = <&host1x>;
> > +		gart = <&gart>;
> > +
> > +		connectors {
> 
> I'm not sure that it makes sense to put the connectors nodes underneath
> the graphics host node; the connectors aren't objects with registers
> that are accessed through a bus managed by the graphics node. Equally,
> the connectors could be useful outside of the graphics driver - e.g. the
> audio driver might need to refer to an HDMI connector.
> 
> Instead, I'd probably put the connector nodes at the top level of the
> device tree, and have graphics contain a property that lists the
> phandles of all available connectors.

That makes a lot of sense.

> > +			#address-cells = <1>;
> > +			#size-cells = <0>;
> > +
> > +			connector@0 {
> > +				reg = <0>;
> > +				edid = /incbin/("machine.edid");
> > +				output = <&lvds>;
> > +			};
> 
> I think each of these needs some kind of compatible value to indicate
> their type. Also, the ability to represent both HDMI video and audio
> streams so that a sound card binding could use the HDMI connector too. I
> see that drivers/extcon/ has appeared recently, and I wonder if the
> connector nodes in DT shouldn't be handled by that subsystem?

I just took a brief look at it. I'll have to play around with it a bit to see
how it fits.

> > +			connector@1 {
> > +				reg = <1>;
> > +				output = <&hdmi>;
> > +				ddc = <&i2c2>;
> > +
> > +				hpd-gpio = <&gpio 111 0>; /* PN7 */
> > +			};
> > +		};
> > +	};
> > +};
> 
> > diff --git a/arch/arm/mach-tegra/board-dt-tegra20.c b/arch/arm/mach-tegra/board-dt-tegra20.c
> 
> > +	{ "host1x",     "pll_c",        144000000,      true },
> > +	{ "disp1",      "pll_p",        600000000,      true },
> > +	{ "disp2",      "pll_p",        600000000,      true },
> 
> Can we use these tables /just/ to set up the clock parent relationships,
> and rely on the drivers to enable/disable the clocks as needed? I'm
> hoping to replace these tables with DT once Tegra support common clock
> and bindings, but I don't want to see the ability to turn clocks on
> there, just set the parenting relationships, and perhaps initial rates.

I did try setting the enabled field to false, but that broke RGB output. I
didn't have much time to investigate why. Once Tegra moves to the common
clock bindings this should definitely be fixed properly.

> > diff --git a/arch/arm/mach-tegra/include/mach/iomap.h b/arch/arm/mach-tegra/include/mach/iomap.h
> > index 7e76da7..3e80f3f 100644
> > --- a/arch/arm/mach-tegra/include/mach/iomap.h
> > +++ b/arch/arm/mach-tegra/include/mach/iomap.h
> > @@ -56,6 +56,12 @@
> >  #define TEGRA_HDMI_BASE			0x54280000
> >  #define TEGRA_HDMI_SIZE			SZ_256K
> >  
> > +#define TEGRA_TVO_BASE			0x542c0000
> > +#define TEGRA_TVO_SIZE			SZ_256K
> > +
> > +#define TEGRA_DSI_BASE			0x54300000
> > +#define TEGRA_DSI_SIZE			SZ_256K
> 
> Perhaps we can just hard-code the addresses into the AUXDATA in
> board-dt-tegra20.c to save defining more entries in this file. Hopefully
> this file is going away ASAP when we get rid of board files.

Okay, I can do that.

Thierry

[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]

  parent reply	other threads:[~2012-05-21 10:55 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-25  9:44 [RFC v2 0/5] Add NVIDIA Tegra DRM support Thierry Reding
     [not found] ` <1335347102-14905-1-git-send-email-thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>
2012-04-25  9:44   ` [RFC v2 1/5] iommu: Include linux/types.h Thierry Reding
2012-04-25  9:44   ` [RFC v2 2/5] tps6586x: Add device tree support Thierry Reding
     [not found]     ` <1335347102-14905-3-git-send-email-thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>
2012-04-25 10:10       ` Mark Brown
     [not found]         ` <20120425101031.GH3195-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2012-04-25 10:14           ` Thierry Reding
     [not found]             ` <20120425101429.GA5085-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>
2012-04-25 10:41               ` Thierry Reding
     [not found]                 ` <20120425104147.GB5085-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>
2012-04-25 10:47                   ` Mark Brown
     [not found]                     ` <20120425104742.GA20492-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2012-04-25 11:14                       ` Thierry Reding
2012-04-25  9:45   ` [RFC v2 3/5] i2c: Add of_i2c_get_adapter() function Thierry Reding
     [not found]     ` <1335347102-14905-4-git-send-email-thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>
2012-04-25 15:36       ` Stephen Warren
     [not found]         ` <4F981A09.2020304-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2012-04-25 16:39           ` Thierry Reding
2012-04-25  9:45   ` [RFC v2 4/5] drm: fixed: Add dfixed_frac Thierry Reding
2012-04-25  9:45   ` [RFC v2 5/5] drm: Add NVIDIA Tegra support Thierry Reding
     [not found]     ` <1335347102-14905-6-git-send-email-thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>
2012-05-03 21:22       ` Stephen Warren
     [not found]         ` <4FA2F702.6040701-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2012-05-21 10:55           ` Thierry Reding [this message]
2012-05-07  8:50       ` Terje Bergström
     [not found]         ` <4FA78CBD.5010606-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2012-05-07 16:27           ` Stephen Warren
     [not found]             ` <4FA7F80F.5090002-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2012-05-21 11:05               ` Thierry Reding
     [not found]                 ` <20120521110514.GC27686-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>
2012-05-21 11:37                   ` Terje Bergström
     [not found]                     ` <4FBA28FD.2060504-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2012-05-21 13:58                       ` Thierry Reding
     [not found]                         ` <20120521135838.GA15046-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>
2012-05-22  6:19                           ` Terje Bergström
2012-05-22  7:01       ` Jon Mayo
2012-04-25 12:27   ` [RFC v2 0/5] Add NVIDIA Tegra DRM support Thierry Reding

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=20120521105512.GB27686@avionic-0098.mockup.avionic-design.de \
    --to=thierry.reding-rm9k5ik7kjkj5m59nbduvrnah6klmebb@public.gmane.org \
    --cc=airlied-cv59FeDIM0c@public.gmane.org \
    --cc=ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org \
    --cc=broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org \
    --cc=ccross-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org \
    --cc=dev-8ppwABl0HbeELgA04lAiVw@public.gmane.org \
    --cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
    --cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org \
    --cc=hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
    --cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=jmayo-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
    --cc=joerg.roedel-5C7GfCeVMHo@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=lrg-l0cyMroinI0@public.gmane.org \
    --cc=olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org \
    --cc=rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org \
    --cc=swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org \
    --cc=tbergstrom-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
    --cc=w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@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