devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anatolij Gustschin <agust-ynQEQJNshbs@public.gmane.org>
To: Dirk Behme <dirk.behme-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: "Lothar Waßmann"
	<LW-bxm8fMRDkQLDiMYJYoSAnRvVK+yQ3ZXh@public.gmane.org>,
	"Shawn Guo" <shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	"Dirk Behme" <dirk.behme-V5te9oGctAVWk0Htik3J/w@public.gmane.org>,
	"devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"Rob Herring"
	<rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org>,
	"linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org"
	<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>
Subject: Re: How to select between different display timings?
Date: Fri, 14 Feb 2014 21:06:35 +0100	[thread overview]
Message-ID: <20140214210635.1561d4b6@crub> (raw)
In-Reply-To: <52FE53DD.7040102-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

On Fri, 14 Feb 2014 18:35:25 +0100
Dirk Behme <dirk.behme-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
...
> > You need to set the property 'native-mode' to the phandle of the
> > display-timings entry like marked above.
> 
> Hmm, let's see if we talk about the same thing ;) Let me rephrase my 
> questions:
> 
> Using above example and booting a system with the resulting .dtb, 
> timing5 is selected at boot time, correct?

yes.

> Assuming I want to use timing1 instead: who would set when the 
> property 'native-mode' to &timing1?
> 
> Can the switch to
> 
> native-mode = <&timing1>;
> 
> only be done at compile time of the dts -> dtb? Or can this be done at 
> boot/kernel run time, too?

it could be done in U-Boot before booting the kernel. You can load
the dtb and patch the property as needed, i.e.:

U-Boot > tftp 107f0000 ${fdtfile}
U-Boot > fdt addr 107f0000
U-Boot > fdt pri /soc/aips-bus@02000000/ldb@020e0008/lvds-channel@0/display-timings
display-timings {
	native-mode = <0x0000000d>;
	hsd100pxn1 {
		clock-frequency = <0x03dfd240>;
		hactive = <0x00000400>;
		vactive = <0x00000300>;
		hback-porch = <0x000000dc>;
		hfront-porch = <0x00000028>;
		vback-porch = <0x00000015>;
		vfront-porch = <0x00000007>;
		hsync-len = <0x0000003c>;
		vsync-len = <0x0000000a>;
		linux,phandle = <0x0000000d>;
		phandle = <0x0000000d>;
	};
	wvga {
		clock-frequency = <0x019bfcc0>;
		hactive = <0x00000320>;
		vactive = <0x000001e0>;
		hback-porch = <0x00000028>;
		hfront-porch = <0x0000003c>;
		vback-porch = <0x0000000a>;
		vfront-porch = <0x0000000a>;
		hsync-len = <0x00000014>;
		vsync-len = <0x0000000a>;
		hsync-active = <0x00000000>;
		vsync-active = <0x00000000>;
		de-active = <0x00000001>;
		pixelclk-active = <0x00000000>;
		linux,phandle = <0x0000000e>;
		phandle = <0x0000000e>;
	};
};

U-Boot > fdt set /soc/aips-bus@02000000/ldb@020e0008/lvds-channel@0/display-timings native-mode <0x0000000e>

U-Boot > fdt list /soc/aips-bus@02000000/ldb@020e0008/lvds-channel@0/display-timings/          
display-timings {
	native-mode = <0x0000000e>;
	hsd100pxn1 {
	};
	wvga {
	};
};

native-mode is referencing second timing node now.

But note that dtc could eliminate the phandles in the nodes if
these are not referenced in dts. To avoid this, the nodes could
contain a self-reference:

 timing1: wvga {
   ...
   linux,phandle = <&timing1>;
 };

> In the end, I'm looking for a way to have several timings like above 
> in the device tree, and select one at kernel boot time based on the 
> display detected. Would this be possible?

You could add a function in U-Boot to detect the display and
update the dtb before booting. This function can be called
before booting if you define CONFIG_OF_BOARD_SETUP in the
U-Boot config file for your board and provide ft_board_setup()
in your board code.

HTH,

Anatolij
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

      parent reply	other threads:[~2014-02-14 20:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1375966287-6784-1-git-send-email-LW@KARO-electronics.de>
     [not found] ` <1375966287-6784-8-git-send-email-LW@KARO-electronics.de>
     [not found]   ` <1375966287-6784-8-git-send-email-LW-bxm8fMRDkQLDiMYJYoSAnRvVK+yQ3ZXh@public.gmane.org>
2014-02-14 13:50     ` How to select between different display timings? (was: [PATCH 7/8] ARM: dts: tx28: restructure and update DTS file) Dirk Behme
     [not found]       ` <52FE1F2D.4010102-V5te9oGctAVWk0Htik3J/w@public.gmane.org>
2014-02-14 14:02         ` Lothar Waßmann
     [not found]           ` <20140214150208.12417b11-VjFSrY7JcPWvSplVBqRQBQ@public.gmane.org>
2014-02-14 17:35             ` How to select between different display timings? Dirk Behme
     [not found]               ` <52FE53DD.7040102-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-02-14 20:06                 ` Anatolij Gustschin [this message]

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=20140214210635.1561d4b6@crub \
    --to=agust-ynqeqjnshbs@public.gmane.org \
    --cc=LW-bxm8fMRDkQLDiMYJYoSAnRvVK+yQ3ZXh@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=dirk.behme-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=dirk.behme-V5te9oGctAVWk0Htik3J/w@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org \
    --cc=shawn.guo-QSEj5FYQhm4dnm+yROfE0A@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;
as well as URLs for NNTP newsgroup(s).