Re: [RFC][PATCH v3 1/3] runtime interpreted power sequences

From: Alex Courbot
Date: Tue Jul 31 2012 - 04:35:14 EST


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.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/