All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
To: Thierry Reding
	<thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>
Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Prashant Gaikwad
	<pgaikwad-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>,
	Joseph Lo <josephl-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Subject: Re: Tegra DRM with HDMI support (\o/)
Date: Fri, 12 Oct 2012 15:17:04 -0600	[thread overview]
Message-ID: <507888D0.1090103@wwwdotorg.org> (raw)
In-Reply-To: <20121012050957.GA29881-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>

On 10/11/2012 11:09 PM, Thierry Reding wrote:
> On Thu, Oct 11, 2012 at 05:36:35PM -0600, Stephen Warren wrote:
>> On 10/11/2012 02:07 PM, Thierry Reding wrote:
>>> Hi,
>>> 
>>> I've finally managed to get HDMI working on Tegra20.
>>> Unfortunately the xf86-video-modesetting driver doesn't work on
>>> top of it yet, but I think that's a different error somewhere
>>> else and I'm still trying to figure out what exactly is going
>>> wrong. However, a framebuffer console can be run on top of it,
>>> as does a small test program that I've written for testing.
>> 
>> I should start out by saying that this is all very excellent
>> news! Thanks so much for your hard work on tegra-drm.
>> 
>> I have managed to get Harmony HDMI working, mostly just by
>> copying the obvious device tree entries from
>> tegra20-trimslice.dts. This didn't quite work immediately though,
>> and while debugging this I found a few issues...
...
>> The code in clock.c uses lots of clk_get_sys() calls with
>> hard-coded clock names. We really should be using the common
>> clock DT bindings for this instead of hard-coding names. This is
>> especially true since the names differ on different SoCs, so
>> there's a ton of of_device_is_compatible(output->dev->of_node,
>> "nvidia,tegra30-hdmi") in this code.
> 
> I don't quite see how that is supposed to work. Wouldn't that mean
> that we needed to setup various entries in the clock tables to be
> able to look the clocks up by generic names? Like pll_d would need
> to be the "parent" clock of "tegra-hdmi" or similar. In that case
> we could call clk_get(hdmi->dev, "parent") instead. Is that what
> you had in mind?

There are two ways this could work:

1)

All clocks needed could be represented in the node of that device (or
perhaps in the DC node?) For example, perhaps hdmi might contain:

clocks = <&car TEGRA_CLK_PLL_D>
         <&car TEGRA_CLK_PLL_D_OUT_0>
         <&car TEGRA_CLK_HDMI>
         ...;
clock-names = "pll_d", "pll_d_out_0", "hdmi", ...;

That should work (I think) with pretty much no modification to the
current code, other than calling clk_get(dev, "hdmi") rather than
clk_get_sys(NULL, "hdmi").

However, I'm not sure this is the best way or not; this still requires
the HDMI driver to implement all the clocking policy (e.g. is the HDMI
clock a child of PLL_D, PLL_C, PLL_P, ... and what rate should the
parent PLL be set to, etc.)

For example, what if the clock frequency HDMI needs can be generated
by PLL_C, so we make PLL_C the parent of HDMI (so as to save power by
not running PLL_D, or to use PLL_D for a second display head), then
something else comes along and /has/ to use PLL_C. If the two childs'
frequency requirements are the same, everything is fine. If the two
child's frequency requirements are not compatible, we might need to
spin up PLL_D and reparent HDMI onto it. More complex scenarios are
possible where PLL_C needs to be reprogrammed, yet can be in a way
that supports both HDMI and some other requirement, so we only need to
temporarily move HDMI onto PLL_D, then reprogram PLL_C, then move HDMI
back to it and spin PLL_D down. All these decisions should be made
centrally in the Tegra clock driver, or at least some kind of
centralized policy management point, and not by the HDMI driver:

2)

The HDMI device node only knows about the clocks used directly by the
HDMI module:

clocks = <&car TEGRA_CLK_HDMI>;
clock-names = "hdmi";

(note: that's just an example; I don't know off the top of my head
exactly which clocks that module consumes directly)

Then, the HDMI driver will simply perform a single clk = clk_get(dev,
"hdmi"), and later call clk_set_rate(clk, rate) as appropriate. All
the policy decisions then get made internally to the Tegra clock
driver (since it's a central nexus for all clock outputs from the
Clock And Reset controller (CAR).

A similar question exists for audio too. Currently, our audio drivers
do something similar to what tegra-drm is doing; (1) above. However, I
have a feeling we may want to convert audio over to model (2) above too.

Oh, and the cpufreq driver has a similar for centralized policy, since
at 216MHz the CPU clocks are derived from one PLL, but for anything
faster we use PLL_X to generate them. Right now, this is implemented
in the cpufreq driver, but again should really be centrally managed.

  parent reply	other threads:[~2012-10-12 21:17 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-11 20:07 Tegra DRM with HDMI support (\o/) Thierry Reding
     [not found] ` <20121011200705.GB27599-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>
2012-10-11 23:36   ` Stephen Warren
     [not found]     ` <50775803.1010209-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2012-10-12  1:16       ` Mark Zhang
2012-10-12  5:09       ` Thierry Reding
     [not found]         ` <20121012050957.GA29881-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>
2012-10-12 21:17           ` Stephen Warren [this message]
     [not found]             ` <507888D0.1090103-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2012-10-13 20:42               ` Thierry Reding
     [not found]                 ` <20121013204223.GA24354-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>
2012-10-15 16:11                   ` Stephen Warren
     [not found]                     ` <507C35C6.20705-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2012-10-17  6:46                       ` Thierry Reding
2012-10-16  8:28               ` Peter De Schrijver
     [not found]                 ` <20121016082827.GI3196-Rysk9IDjsxmJz7etNGeUX8VPkgjIgRvpAL8bYrjMMd8@public.gmane.org>
2012-10-17  6:55                   ` Thierry Reding
     [not found]                     ` <20121017065547.GE21783-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>
2012-10-17 15:20                       ` Stephen Warren
     [not found]                         ` <507ECCCD.7000600-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2012-10-17 18:04                           ` Jon Mayo
     [not found]                             ` <D6C615D3E4730340AE82D5BD856631C0A1DA306B31-QfAaPSPn5qZDw2glCA4ptUEOCMrvLtNR@public.gmane.org>
2012-10-17 19:12                               ` Thierry Reding
     [not found]                                 ` <20121017191240.GA22570-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>
2012-10-17 19:41                                   ` Stephen Warren
     [not found]                                     ` <507F0A03.2050008-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2012-10-17 20:08                                       ` Jon Mayo
     [not found]                                         ` <D6C615D3E4730340AE82D5BD856631C0A1DA306B39-QfAaPSPn5qZDw2glCA4ptUEOCMrvLtNR@public.gmane.org>
2012-10-18  6:29                                           ` Thierry Reding
     [not found]                                             ` <20121018062918.GC24637-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>
2012-10-18 21:37                                               ` Jon Mayo
2012-10-18 22:05                                               ` Stephen Warren
2012-10-18 22:14                                           ` Stephen Warren
2012-10-12  1:20   ` Mark Zhang
2012-10-16  8:18   ` Mark Zhang
2012-10-16 16:03     ` Stephen Warren
     [not found]       ` <507D856C.1070708-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2012-10-17  1:32         ` Mark Zhang
     [not found]           ` <507E0AC1.8020001-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2012-10-17 20:38             ` Stephen Warren
     [not found]               ` <507F175A.3000406-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2012-10-18  5:55                 ` Thierry Reding
     [not found]                   ` <20121018055518.GB24637-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>
2012-10-18  8:43                     ` Mark Zhang
2012-10-18  7:00                 ` Mark Zhang
2012-10-17  5:42         ` Thierry Reding
     [not found]           ` <20121017054224.GA21783-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>
2012-10-18  6:04             ` Mark Zhang
     [not found]               ` <507F9BF5.20002-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2012-10-18  6:34                 ` Thierry Reding
     [not found]                   ` <20121018063453.GD24637-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>
2012-10-18  7:05                     ` Mark Zhang

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=507888D0.1090103@wwwdotorg.org \
    --to=swarren-3lzwwm7+weoh9zmkesr00q@public.gmane.org \
    --cc=josephl-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
    --cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=pgaikwad-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
    --cc=thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.