From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755892Ab2GaIfT (ORCPT ); Tue, 31 Jul 2012 04:35:19 -0400 Received: from hqemgate04.nvidia.com ([216.228.121.35]:15140 "EHLO hqemgate04.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755809Ab2GaIfP (ORCPT ); Tue, 31 Jul 2012 04:35:15 -0400 X-PGP-Universal: processed; by hqnvupgp08.nvidia.com on Tue, 31 Jul 2012 01:35:14 -0700 Message-ID: <50179933.9090501@nvidia.com> Date: Tue, 31 Jul 2012 17:37:07 +0900 From: Alex Courbot Organization: NVIDIA User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120717 Thunderbird/14.0 MIME-Version: 1.0 To: Simon Glass CC: Stephen Warren , Thierry Reding , Grant Likely , Rob Herring , Greg Kroah-Hartman , Mark Brown , Arnd Bergmann , "linux-tegra@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-fbdev@vger.kernel.org" , "devicetree-discuss@lists.ozlabs.org" Subject: Re: [RFC][PATCH v3 1/3] runtime interpreted power sequences References: <1343390750-3642-1-git-send-email-acourbot@nvidia.com> <1343390750-3642-2-git-send-email-acourbot@nvidia.com> In-Reply-To: Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Simon, On 07/30/2012 08:00 PM, Simon Glass wrote: > For the delay, I think milliseconds is reasonable. I suppose there is > no reasonable need for microseconds? I don't see any need for microseconds myself - anybody sees use for finer-grained delays? Btw, I noticed I was using mdelay instead of msleep - caught and fixed that. >> +Device tree >> +----------- >> +All the same, power sequences can be encoded as device tree nodes. The following >> +properties and nodes are equivalent to the platform data defined previously: >> + >> + power-supply = <&mydevice_reg>; >> + enable-gpio = <&gpio 6 0>; >> + >> + power-on-sequence { >> + regulator@0 { >> + id = "power"; > > Is there a reason not to put the phandle here, like: > > id = <&mydevice_reg>; > > (or maybe 'device' instead of id?) There is one reason, but it might be a bad one. On Tegra, PWM phandle uses an extra cell to encode the duty-cycle the PWM should have when we call get_pwm(). This makes it possible to address the same PWM with different phandles (and different duty cycles), which causes an issue to know whether a PWM is already used in a sequence (potentially resulting in multiple get_pwm calls on the same PWM, and also opens the door to ambiguities in behavior (what is the correct duty-cycle to use if several different values are passed?) Maybe the problem lies in how PWM phandles are handled - if duty-cycle was not part of the information, we would not have this problem. >> +Note that first, the phandles of the regulator and gpio used in the sequences >> +are defined as properties. Then the sequence references them through the id >> +property of every step. The name of sub-properties defines the type of the step. >> +Valid names are "regulator", "gpio" and "pwm". Steps must be numbered >> +sequentially. > > For the regulator and gpio types I think you only have an enable. For > the pwm, what is the intended binding? Is that documented elsewhere? Same thing, enable/disable which would call pwm_enable and pwm_disable. One could also image an additional property to set the duty cycle if it can be taken off the phandle. > Also it might be worth mentioning how you get a struct power_seq from > an fdt node, and perhaps given an example of a device which has an > attached node, so we can see how it is referenced from the device > (of_parse_power_seq I think). Do put the sequence inside the device > node or reference it with a phandle? Yes, this definitely needs more documentation - especially the DT part. Thanks, Alex.