From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Courbot Date: Tue, 31 Jul 2012 08:37:07 +0000 Subject: Re: [RFC][PATCH v3 1/3] runtime interpreted power sequences Message-Id: <50179933.9090501@nvidia.com> List-Id: References: <1343390750-3642-1-git-send-email-acourbot@nvidia.com> <1343390750-3642-2-git-send-email-acourbot@nvidia.com> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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" 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.