From: Alex Courbot <acourbot@nvidia.com>
To: Mitch Bradley <wmb@firmworks.com>
Cc: Thierry Reding <thierry.reding@avionic-design.de>,
"linux-fbdev@vger.kernel.org" <linux-fbdev@vger.kernel.org>,
Stephen Warren <swarren@nvidia.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Mark Brown <broonie@opensource.wolfsonmicro.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Rob Herring <rob.herring@calxeda.com>,
"linux-tegra@vger.kernel.org" <linux-tegra@vger.kernel.org>,
"devicetree-discuss@lists.ozlabs.org"
<devicetree-discuss@lists.ozlabs.org>
Subject: Re: [RFC][PATCH v3 1/3] runtime interpreted power sequences
Date: Wed, 1 Aug 2012 10:47:39 +0900 [thread overview]
Message-ID: <50188ABB.2060304@nvidia.com> (raw)
In-Reply-To: <5017D5C9.3070905@firmworks.com>
On 07/31/2012 09:55 PM, Mitch Bradley wrote:
> On 7/31/2012 8:38 PM, Thierry Reding wrote:
>> On Tue, Jul 31, 2012 at 08:22:17PM +0800, Mitch Bradley wrote:
>>> On 7/31/2012 6:56 PM, Thierry Reding wrote:
>>>> On Tue, Jul 31, 2012 at 07:32:20PM +0900, Alex Courbot wrote:
>>>>> On 07/31/2012 07:45 AM, Stephen Warren wrote:
>>>>>> I wonder if using the same structure/array as input and output would
>>>>>> simplify the API; the platform data would fill in the fields mentioned
>>>>>> above, and power_seq_build() would parse those, then set other fields in
>>>>>> the same structs to the looked-up handle values?
>>>>>
>>>>> The thing is that I am not sure what happens to the platform data
>>>>> once probe() is done. Isn't it customary to mark it with __devinit
>>>>> and have it freed after probing is successful?
>>>>
>>>> No, platform data should stay around forever. Otherwise, consider what
>>>> would happen if your driver is built as a module and you unload and load
>>>> it again.
>>>>
>>>>> More generally, I think it is a good practice to have data
>>>>> structures tailored right for what they need to do - code with
>>>>> members that are meaningful only at given points of an instance's
>>>>> life tends to be more confusing.
>>>>
>>>> I agree. Furthermore the driver unload/reload would be another reason
>>>> not to reuse platform data as the output of the build() function.
>>>>
>>>> But maybe what Stephen meant was more like filling a structure with data
>>>> taken from the platform data and pass that to a resolve() function which
>>>> would fill in the missing pieces like pointers to actual resources. I
>>>> imagine a managed interface would become a little trickier to do using
>>>> such an approach.
>>>>
>>>>>> If the nodes have a unit address (i.e. end in "@n"), which they will
>>>>>> have to if all named "step" and there's more than one of them, then they
>>>>>> will need a matching reg property. Equally, the parent node will need
>>>>>> #address-cells and #size-cells too. So, the last couple lines would be:
>>>>>>
>>>>>> power-on-sequence {
>>>>>> #address-cells = <1>;
>>>>>> #size-cells = <0>;
>>>>>> step@0 {
>>>>>> reg = <0>;
>>>>>
>>>>> That's precisely what I would like to avoid - I don't need the steps
>>>>> to be numbered and I certainly have no use for a reg property. Isn't
>>>>> there a way to make it simpler?
>>>>
>>>> It's not technically valid to not have the reg property. Or
>>>> #address-cells and #size-cells properties for that matter.
>>>
>>> I'm not keen on this representation where individual steps are nodes.
>>> That seems like it could end up being too "heavyweight" for a long sequence.
>>
>> The other alternative would involve using a single property to encode
>> one sequence. I think that was the initial proposal, though using proper
>> phandle encoding it could probably be enhanced a bit. However anything
>> that involves a single property has the problem that we need to encode
>> the type of resource as an integer, and that makes things very hard to
>> read.
>>
>> So it would look something like this:
>>
>> power-on = <1 &gpio 6 0 1
>> 0 10000
>> 2 ® 1
>> 3 &pwm 0 5000000 1>;
>>
>> power-off = <3 &pwm 0 5000000 0
>> 2 ® 0
>> 0 10000
>> 1 &gpio 6 0 0>;
>>
>> So the first cell would encode the type:
>> 0: delay
>> 1: gpio
>> 2: regulator
>> 3: PWM
>>
>> The next n cells would be the phandle and the specifier, while the last
>> cell would encode a resource-specific parameter:
>> delay: time in microseconds
>> gpio: set level (0: low, 1: high)
>> regulator: 0: disable, 1: enable
>> pwm: 0: disable, 1: enable
>>
>> I guess this would be more compact, but it is also very hard to read. Is
>> that something you would be happier with? Perhaps you were thinking of
>> something completely different?
>
>
> Perhaps a compact/flexible encoding could be designed, with a textual
> encoding that is easy to read. A separate tool could convert the text
> encoding to the integer format, annotated with comments containing
> the "source text". A file containing that output could be #included
> into the dts file.
Do you mean having a external compiler that would run before dtc just
for producing the power sequences? That sounds a little bit overkill for
something that ough to remain simple.
Also, although I admit I don't have the whole picture of where they
could be used, I don't expect the power sequences to grow to sizes that
would make us bother about their footprint.
Alex.
next prev parent reply other threads:[~2012-08-01 1:45 UTC|newest]
Thread overview: 63+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-27 12:05 [RFC][PATCH v3 0/3] Power sequences with PWM and DT support Alexandre Courbot
2012-07-27 12:05 ` [RFC][PATCH v3 1/3] runtime interpreted power sequences Alexandre Courbot
2012-07-27 18:19 ` Greg Kroah-Hartman
2012-07-30 1:51 ` Alex Courbot
2012-07-30 2:40 ` Gethering power management/policy hw drivers under drivers/power/? (Re: [RFC][PATCH v3 1/3] runtime interpreted power sequences) Anton Vorontsov
2012-07-30 20:59 ` Rafael J. Wysocki
2012-08-01 0:51 ` Anton Vorontsov
2012-08-06 8:45 ` Pihet-XID, Jean
2012-07-27 18:20 ` [RFC][PATCH v3 1/3] runtime interpreted power sequences Greg Kroah-Hartman
2012-07-30 11:00 ` Simon Glass
2012-07-31 8:37 ` Alex Courbot
2012-07-31 9:13 ` Thierry Reding
2012-07-31 10:11 ` Alex Courbot
2012-07-31 10:46 ` Thierry Reding
2012-07-31 14:23 ` Mark Brown
2012-07-30 11:33 ` Thierry Reding
2012-07-31 9:51 ` Alex Courbot
2012-07-31 10:19 ` Thierry Reding
2012-08-01 2:50 ` Alex Courbot
2012-08-01 7:17 ` Thierry Reding
2012-07-31 14:11 ` Mark Brown
2012-07-30 15:44 ` Rob Herring
2012-07-30 15:47 ` Mark Brown
2012-07-31 9:16 ` Thierry Reding
2012-07-30 22:26 ` Stephen Warren
2012-07-31 10:15 ` Alex Courbot
2012-07-30 22:45 ` Stephen Warren
2012-07-31 10:32 ` Alex Courbot
2012-07-31 10:56 ` Thierry Reding
2012-07-31 12:22 ` Mitch Bradley
2012-07-31 12:38 ` Thierry Reding
2012-07-31 12:55 ` Mitch Bradley
2012-08-01 1:47 ` Alex Courbot [this message]
2012-08-01 2:15 ` Mitch Bradley
2012-08-01 1:42 ` Alex Courbot
2012-07-31 14:13 ` Mark Brown
2012-07-31 14:22 ` Thierry Reding
2012-07-31 14:26 ` Mark Brown
2012-07-31 14:32 ` Thierry Reding
2012-07-31 15:39 ` Mark Brown
2012-07-31 16:19 ` Greg Kroah-Hartman
2012-07-31 16:22 ` Mark Brown
2012-07-31 16:42 ` Greg Kroah-Hartman
2012-07-31 16:50 ` Mark Brown
2012-08-01 7:41 ` Thierry Reding
2012-08-01 13:26 ` Mark Brown
2012-08-01 13:38 ` Thierry Reding
2012-08-01 13:55 ` Mark Brown
2012-08-01 14:01 ` Thierry Reding
2012-07-31 16:34 ` Stephen Warren
2012-08-02 8:00 ` Alex Courbot
2012-08-02 8:21 ` Thierry Reding
2012-08-02 8:27 ` Alex Courbot
2012-08-02 8:45 ` Thierry Reding
2012-08-02 9:20 ` Alex Courbot
2012-08-02 18:11 ` Mark Brown
2012-08-03 1:15 ` Alex Courbot
2012-08-04 14:12 ` Mark Brown
2012-08-06 2:27 ` Alex Courbot
2012-08-06 16:16 ` Stephen Warren
2012-08-07 5:10 ` Alex Courbot
2012-07-27 12:05 ` [RFC][PATCH v3 2/3] pwm_backlight: use " Alexandre Courbot
2012-07-27 12:05 ` [RFC][PATCH v3 3/3] tegra: add pwm backlight device tree nodes Alexandre Courbot
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=50188ABB.2060304@nvidia.com \
--to=acourbot@nvidia.com \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=devicetree-discuss@lists.ozlabs.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=rob.herring@calxeda.com \
--cc=swarren@nvidia.com \
--cc=thierry.reding@avionic-design.de \
--cc=wmb@firmworks.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
Powered by JetHome