Skip to contentSkip to conversation

Add power control for lm90

PATCH Superseded Wei Ni 5 participants 45 messages Sep 9, 2013 – Sep 11, 2013

Subsystems (4)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Wei Ni

author
#0 lore raw

v3 cover Add power control for lm90

The device lm90 can be controlled by the vcc rail. Add function to power on/off the vcc.

This series is v3, previous version patches are:
[v2]: http://www.spinics.net/lists/arm-kernel/msg265373.html
[v1]: http://www.mail-archive.com/[email protected]/msg12034.html

Changes from v2:
1. use devm_regulator_get_optional(), as suggested by Mark.
2. remove the lm90_power_control(), enable the regulator in the probe() directly, so the codes are more clear, as suggested by Alexander and Guenter.
3. change the binding documentation, as per Stephen suggestion.
4. couple of changes, as per previous review.

Changes from v1:
1. if get regulator failed, we should continue to run probe function, not return fail.
2. call regulator_put() in error handler and remove function.
3. add LM90 DT binding document.

Wei Ni (2):
hwmon: (lm90) Add power control
Documentation: dt: hwmon: add OF document for LM90

 Documentation/devicetree/bindings/hwmon/lm90.txt |   44 ++++++++++++++++++++++
 drivers/hwmon/lm90.c                             |   25 ++++++++++++
 2 files changed, 69 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/hwmon/lm90.txt
Signature · 1 line
1.7.9.5
author
#1 lore raw

PATCH v3 1/2 hwmon: (lm90) Add power control

The device lm90 can be controlled by the vcc rail. Adding the regulator support to power on/off the vcc rail. Enable the "vcc" regulator before accessing the device.

---
 drivers/hwmon/lm90.c |   25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
drivers/hwmon/lm90.c +25 -0
index cdff742..bd313f4 100644
@@ -89,6 +89,8 @@
 #include <linux/err.h>
 #include <linux/mutex.h>
 #include <linux/sysfs.h>
+#include <linux/regulator/consumer.h>
+#include <linux/delay.h>
 
 /*
  * Addresses to scan
@@ -302,6 +304,7 @@ static const struct lm90_params lm90_params[] = {
 struct lm90_data {
 	struct device *hwmon_dev;
 	struct mutex update_lock;
+	struct regulator *lm90_reg;
 	char valid; /* zero until following fields are valid */
 	unsigned long last_updated; /* in jiffies */
 	int kind;
@@ -1397,8 +1400,23 @@ static int lm90_probe(struct i2c_client *client,
 	struct device *dev = &client->dev;
 	struct i2c_adapter *adapter = to_i2c_adapter(dev->parent);
 	struct lm90_data *data;
+	struct regulator *reg;
 	int err;
 
+	reg = devm_regulator_get_optional(dev, "vcc");
+	if (!IS_ERR(reg)) {
+		err = regulator_enable(reg);
+		if (err < 0) {
+			dev_err(&client->dev,
+				"Failed to enable regulator: %d\n", err);
+			return err;
+		}
+		msleep(25);
+	} else {
+		if (PTR_ERR(reg) == -EPROBE_DEFER)
+			return -EPROBE_DEFER;
+	}
+
 	data = devm_kzalloc(&client->dev, sizeof(struct lm90_data), GFP_KERNEL);
 	if (!data)
 		return -ENOMEM;
@@ -1406,6 +1424,8 @@ static int lm90_probe(struct i2c_client *client,
 	i2c_set_clientdata(client, data);
 	mutex_init(&data->update_lock);
 
+	data->lm90_reg = reg;
+
 	/* Set the device type */
 	data->kind = id->driver_data;
 	if (data->kind == adm1032) {
@@ -1473,6 +1493,9 @@ exit_remove_files:
 	lm90_remove_files(client, data);
 exit_restore:
 	lm90_restore_conf(client, data);
+	if (!IS_ERR(data->lm90_reg))
+		regulator_disable(data->lm90_reg);
+
 	return err;
 }
 
@@ -1483,6 +1506,8 @@ static int lm90_remove(struct i2c_client *client)
 	hwmon_device_unregister(data->hwmon_dev);
 	lm90_remove_files(client, data);
 	lm90_restore_conf(client, data);
+	if (!IS_ERR(data->lm90_reg))
+		regulator_disable(data->lm90_reg);
 
 	return 0;
 }
Signature · 1 line
1.7.9.5
#2 lore raw

Re: [PATCH v3 1/2] hwmon: (lm90) Add power control

drivers/hwmon/lm90.c static int lm90_probe(struct i2c_client *client, · line 1418

Quoted 13 lines · Wei Ni
drivers/hwmon/lm90.c +13 -0
+	reg = devm_regulator_get_optional(dev, "vcc");
+	if (!IS_ERR(reg)) {
+		err = regulator_enable(reg);
+		if (err < 0) {
+			dev_err(&client->dev,
+				"Failed to enable regulator: %d\n", err);
+			return err;
+		}
+		msleep(25);
+	} else {
+		if (PTR_ERR(reg) == -EPROBE_DEFER)
+			return -EPROBE_DEFER;
+	}

This doesn't look good, it is going to ignore actual errors - I *really* doubt that vcc is optional, it looks like it's the main power supply for the device. You should use normal regulator_get(), _optional() is for supplies which could physically not be provided in a system (eg, if the device can generate them internally if required).

Also do you really need 25ms after power on?

maintainer
#3 lore raw

Re: [PATCH v3 1/2] hwmon: (lm90) Add power control

Quoted 13 lines · Mark Brown
Quoted 11 lines · Wei Ni
drivers/hwmon/lm90.c +11 -0
+	reg = devm_regulator_get_optional(dev, "vcc");
+	if (!IS_ERR(reg)) {
+		err = regulator_enable(reg);
+		if (err < 0) {
+			dev_err(&client->dev,
+				"Failed to enable regulator: %d\n", err);
+			return err;
+		}
+		msleep(25);
+	} else {
+		if (PTR_ERR(reg) == -EPROBE_DEFER)
Quoted 9 lines

drivers/hwmon/lm90.c static int lm90_probe(struct i2c_client *client, · line 1418

Quoted 2 lines
drivers/hwmon/lm90.c +2 -0
+			return -EPROBE_DEFER;
+	}

This doesn't look good, it is going to ignore actual errors - I *really* doubt that vcc is optional, it looks like it's the main power supply for the device. You should use normal regulator_get(), _optional() is for supplies which could physically not be provided in a system (eg, if the device can generate them internally if required).

Then he'll have to make sure that all devicetree files in the system contain references to this regulator.

Quoted 2 lines

Also do you really need 25ms after power on?

I had not noticed, but I recommend to reject the patch because of it. If we add 25ms delay to each driver, booting the system will take as long as booting windows. If enabling the regulator needs time, the regulator subsystem should do it.

Guenter

#4 lore raw

Re: [PATCH v3 1/2] hwmon: (lm90) Add power control

Quoted 11 lines · Guenter Roeck
Quoted 7 lines · Mark Brown

On Mon, Sep 09, 2013 at 06:29:11PM +0800, Wei Ni wrote:

This doesn't look good, it is going to ignore actual errors - I *really* doubt that vcc is optional, it looks like it's the main power supply for the device. You should use normal regulator_get(), _optional() is for supplies which could physically not be provided in a system (eg, if the device can generate them internally if required).

Then he'll have to make sure that all devicetree files in the system contain references to this regulator.

Or get the patches applied on top of the code that'll be going in this cycle implementing get_optional() properly - when that's done the default will be to provide a dummy supply for regulator_get(). If you ack the patch I'd be happy to carry it.

Quoted 6 lines
Quoted 1 line

Also do you really need 25ms after power on?

I had not noticed, but I recommend to reject the patch because of it. If we add 25ms delay to each driver, booting the system will take as long as booting windows. If enabling the regulator needs time, the regulator subsystem should do it.

And indeed it does this (well, it does whatever the driver says in terms of delay). However it is possible that the lm90 needs this time for itself - if it's doing some sort of initialisation or callibration sequence then that'll happen after the supplies come up. 25ms did seem rather long, especially for such simple devices, but it's not beyond the bounds of possibility.

maintainer
#5 lore raw

Re: [PATCH v3 1/2] hwmon: (lm90) Add power control

Quoted 10 lines · Mark Brown
Quoted 8 lines · Guenter Roeck
Quoted 7 lines · Mark Brown

On Mon, Sep 09, 2013 at 06:29:11PM +0800, Wei Ni wrote:

This doesn't look good, it is going to ignore actual errors - I *really* doubt that vcc is optional, it looks like it's the main power supply for the device. You should use normal regulator_get(), _optional() is for supplies which could physically not be provided in a system (eg, if the device can generate them internally if required).

Quoted 8 lines
Quoted 2 lines

Then he'll have to make sure that all devicetree files in the system contain references to this regulator.

Or get the patches applied on top of the code that'll be going in this cycle implementing get_optional() properly - when that's done the default will be to provide a dummy supply for regulator_get(). If you ack the patch I'd be happy to carry it.

Jean will have to ack it.

Quoted 7 lines
Quoted 6 lines
Quoted 1 line

Also do you really need 25ms after power on?

I had not noticed, but I recommend to reject the patch because of it. If we add 25ms delay to each driver, booting the system will take as long as booting windows. If enabling the regulator needs time, the regulator subsystem should do it.

Quoted 6 lines

And indeed it does this (well, it does whatever the driver says in terms of delay). However it is possible that the lm90 needs this time for itself - if it's doing some sort of initialisation or callibration sequence then that'll happen after the supplies come up. 25ms did seem rather long, especially for such simple devices, but it's not beyond the bounds of possibility.

Even then it would be unreasonable to enforce such a delay for every instance of this driver, even if the regulator is a dummy one and/or has been enabled already. Many if not almost all users of the driver work just fine as-is, without additional enforced delay (and, for that matter, without regulator ;).

If there is a delay, it would have to be optional: Only wait if the regulator was really turned on by the call and not already active. I don't know if the regulator subsystem has this capability; if not, maybe it should.

On a higher level, I wonder if such functionality should be added in the i2c subsystem and not in i2c client drivers. Has anyone thought about this ?

Guenter

#6 lore raw

Re: [PATCH v3 1/2] hwmon: (lm90) Add power control

Quoted 9 lines · Guenter Roeck
Quoted 6 lines · Mark Brown

And indeed it does this (well, it does whatever the driver says in terms of delay). However it is possible that the lm90 needs this time for itself - if it's doing some sort of initialisation or callibration sequence then that'll happen after the supplies come up. 25ms did seem rather long, especially for such simple devices, but it's not beyond the bounds of possibility.

Quoted 8 lines

Even then it would be unreasonable to enforce such a delay for every instance of this driver, even if the regulator is a dummy one and/or has been enabled already. Many if not almost all users of the driver work just fine as-is, without additional enforced delay (and, for that matter, without regulator ;).

If there is a delay, it would have to be optional: Only wait if the regulator was really turned on by the call and not already active. I don't know if the regulator subsystem has this capability; if not, maybe it should.

It does, though it gets complicated trying to use it for a case like this since you can't really tell if the regulator was powered on immediately before the device got probed by another device on the bus.

Quoted 2 lines

On a higher level, I wonder if such functionality should be added in the i2c subsystem and not in i2c client drivers. Has anyone thought about this ?

I'm not sure what the subsystem would do for such delays? It's fairly common for things that need this to also want to do things like manipulate GPIOs as part of the power on sequence so the applicability is relatively limited, plus it's not even I2C specific, the same applies to other buses so it ought to be a driver core thing.

There was some work on a generic helper for power on sequences but it stalled since it wasn't accepted for the original purpose (LCD panel power ons IIRC).

maintainer
#7 lore raw

Re: [PATCH v3 1/2] hwmon: (lm90) Add power control

Quoted 15 lines · Mark Brown
Quoted 13 lines · Guenter Roeck
Quoted 6 lines · Mark Brown

And indeed it does this (well, it does whatever the driver says in terms of delay). However it is possible that the lm90 needs this time for itself - if it's doing some sort of initialisation or callibration sequence then that'll happen after the supplies come up. 25ms did seem rather long, especially for such simple devices, but it's not beyond the bounds of possibility.

Even then it would be unreasonable to enforce such a delay for every instance of this driver, even if the regulator is a dummy one and/or has been enabled already. Many if not almost all users of the driver work just fine as-is, without additional enforced delay (and, for that matter, without regulator ;).

Quoted 8 lines
Quoted 3 lines

If there is a delay, it would have to be optional: Only wait if the regulator was really turned on by the call and not already active. I don't know if the regulator subsystem has this capability; if not, maybe it should.

It does, though it gets complicated trying to use it for a case like this since you can't really tell if the regulator was powered on immediately before the device got probed by another device on the bus.

Why not ? Just keep a timestamp.

Quoted 9 lines
Quoted 2 lines

On a higher level, I wonder if such functionality should be added in the i2c subsystem and not in i2c client drivers. Has anyone thought about this ?

I'm not sure what the subsystem would do for such delays? It's fairly common for things that need this to also want to do things like manipulate GPIOs as part of the power on sequence so the applicability is relatively limited, plus it's not even I2C specific, the same applies to other buses so it ought to be a driver core thing.

Possibly. I just thought about i2c since it also takes care of basic devicetree bindings. Something along the line of
if devicetree bindings for this device declare one or more regulators, enable those regulators before calling the driver probe function.

That was not intended to solve the delay problem, though. The delay problem seems to be more of a generic regulator problem and, as I suggested, should be solved in the regulator subsystem.
if the regulator is enabled and the device specifies a poweron delay, wait for the specified amount of time after (and only after) enabling the regulator.

Quoted 3 lines

There was some work on a generic helper for power on sequences but it stalled since it wasn't accepted for the original purpose (LCD panel power ons IIRC).

Too bad. I think it could be kept quite simple, though, by handling it through the regulator subsystem as suggested above. A generic binding for a per-regulator and per-device poweron delay should solve that and possibly even make it transparent to the actual driver code.

Guenter

#8 lore raw

Re: [PATCH v3 1/2] hwmon: (lm90) Add power control

Quoted 7 lines · Guenter Roeck
Quoted 3 lines · Mark Brown

It does, though it gets complicated trying to use it for a case like this since you can't really tell if the regulator was powered on immediately before the device got probed by another device on the bus.

Why not ? Just keep a timestamp.

The support is a callback on state changes; we could keep a timestamp but there's still going to be race conditions around bootloaders. It's doable though.

Quoted 9 lines
Quoted 8 lines
Quoted 2 lines

On a higher level, I wonder if such functionality should be added in the i2c subsystem and not in i2c client drivers. Has anyone thought about this ?

I'm not sure what the subsystem would do for such delays? It's fairly common for things that need this to also want to do things like manipulate GPIOs as part of the power on sequence so the applicability is relatively limited, plus it's not even I2C specific, the same applies to other buses so it ought to be a driver core thing.

Quoted 5 lines

Possibly. I just thought about i2c since it also takes care of basic devicetree bindings. Something along the line of
if devicetree bindings for this device declare one or more regulators, enable those regulators before calling the driver probe function.

That's definitely a driver core thing, not I2C - there's nothing specific to I2C in there at all, needing power is pretty generic. I have considered this before, something along the lines of what we have for pinctrl, but unfortunately the generic case isn't quite generic enough to make it easy. It'd need to be an explicit list of regulators (partly just to make it opt in and avoid breaking things) and you'd want to have a way of handling the different suspend/resume behaviour that devices want. There's a few patterns there.

It's definitely something I think about from time to time and it would be useful to factor things out, the issue is getting a good enough model of what's going on.

Quoted 8 lines
Quoted 3 lines

There was some work on a generic helper for power on sequences but it stalled since it wasn't accepted for the original purpose (LCD panel power ons IIRC).

Too bad. I think it could be kept quite simple, though, by handling it through the regulator subsystem as suggested above. A generic binding for a per-regulator and per-device poweron delay should solve that and possibly even make it transparent to the actual driver code.

Lots of things have a GPIO for reset too, and some want clocks too. For maximum usefulness this should be cross subsystem. I suspect the reset controller API may be able to handle some of it.

The regulator power on delays are already handled transparently, by the time regulator_enable() returns the ramp should be finished.

author
#9 lore raw

Re: [PATCH v3 1/2] hwmon: (lm90) Add power control

Quoted 52 lines · Mark Brown

* PGP Signed by an unknown key

Quoted 7 lines · Guenter Roeck
Quoted 3 lines · Mark Brown

It does, though it gets complicated trying to use it for a case like this since you can't really tell if the regulator was powered on immediately before the device got probed by another device on the bus.

Why not ? Just keep a timestamp.

The support is a callback on state changes; we could keep a timestamp but there's still going to be race conditions around bootloaders. It's doable though.

Quoted 9 lines
Quoted 8 lines
Quoted 2 lines

On a higher level, I wonder if such functionality should be added in the i2c subsystem and not in i2c client drivers. Has anyone thought about this ?

I'm not sure what the subsystem would do for such delays? It's fairly common for things that need this to also want to do things like manipulate GPIOs as part of the power on sequence so the applicability is relatively limited, plus it's not even I2C specific, the same applies to other buses so it ought to be a driver core thing.

Quoted 5 lines

Possibly. I just thought about i2c since it also takes care of basic devicetree bindings. Something along the line of
if devicetree bindings for this device declare one or more regulators, enable those regulators before calling the driver probe function.

That's definitely a driver core thing, not I2C - there's nothing specific to I2C in there at all, needing power is pretty generic. I have considered this before, something along the lines of what we have for pinctrl, but unfortunately the generic case isn't quite generic enough to make it easy. It'd need to be an explicit list of regulators (partly just to make it opt in and avoid breaking things) and you'd want to have a way of handling the different suspend/resume behaviour that devices want. There's a few patterns there.

It's definitely something I think about from time to time and it would be useful to factor things out, the issue is getting a good enough model of what's going on.

Quoted 8 lines
Quoted 3 lines

There was some work on a generic helper for power on sequences but it stalled since it wasn't accepted for the original purpose (LCD panel power ons IIRC).

Too bad. I think it could be kept quite simple, though, by handling it through the regulator subsystem as suggested above. A generic binding for a per-regulator and per-device poweron delay should solve that and possibly even make it transparent to the actual driver code.

Quoted 6 lines

Lots of things have a GPIO for reset too, and some want clocks too. For maximum usefulness this should be cross subsystem. I suspect the reset controller API may be able to handle some of it.

The regulator power on delays are already handled transparently, by the time regulator_enable() returns the ramp should be finished.

I think the regulator should encoded its own startup delay. Each individual device should handle its own requirements for delay after power is stable.
The regulator_enable() will handle the delays for the regulator device. And adding the msleep(25) is for lm90 device. If without delay, sometimes the device can't work properly. If read lm90 register immediately after enabling regulator, the reading may be failed. I'm not sure if 25ms is the right value, I read the LM90 SPEC, the max of "SMBus Clock Low Time" is 25ms, so I supposed that it may need about 25ms to stable after power on.

Thanks.
Wei.

Quoted 4 lines

* Unknown Key
* 0x7EA229BD

maintainer
#10 lore raw

Re: [PATCH v3 1/2] hwmon: (lm90) Add power control

Quoted 60 lines · Wei Ni
Quoted 52 lines · Mark Brown

* PGP Signed by an unknown key

Quoted 7 lines · Guenter Roeck
Quoted 3 lines · Mark Brown

It does, though it gets complicated trying to use it for a case like this since you can't really tell if the regulator was powered on immediately before the device got probed by another device on the bus.

Why not ? Just keep a timestamp.

The support is a callback on state changes; we could keep a timestamp but there's still going to be race conditions around bootloaders. It's doable though.

Quoted 9 lines
Quoted 8 lines
Quoted 2 lines

On a higher level, I wonder if such functionality should be added in the i2c subsystem and not in i2c client drivers. Has anyone thought about this ?

I'm not sure what the subsystem would do for such delays? It's fairly common for things that need this to also want to do things like manipulate GPIOs as part of the power on sequence so the applicability is relatively limited, plus it's not even I2C specific, the same applies to other buses so it ought to be a driver core thing.

Quoted 5 lines

Possibly. I just thought about i2c since it also takes care of basic devicetree bindings. Something along the line of
if devicetree bindings for this device declare one or more regulators, enable those regulators before calling the driver probe function.

That's definitely a driver core thing, not I2C - there's nothing specific to I2C in there at all, needing power is pretty generic. I have considered this before, something along the lines of what we have for pinctrl, but unfortunately the generic case isn't quite generic enough to make it easy. It'd need to be an explicit list of regulators (partly just to make it opt in and avoid breaking things) and you'd want to have a way of handling the different suspend/resume behaviour that devices want. There's a few patterns there.

It's definitely something I think about from time to time and it would be useful to factor things out, the issue is getting a good enough model of what's going on.

Quoted 8 lines
Quoted 3 lines

There was some work on a generic helper for power on sequences but it stalled since it wasn't accepted for the original purpose (LCD panel power ons IIRC).

Too bad. I think it could be kept quite simple, though, by handling it through the regulator subsystem as suggested above. A generic binding for a per-regulator and per-device poweron delay should solve that and possibly even make it transparent to the actual driver code.

Quoted 6 lines

Lots of things have a GPIO for reset too, and some want clocks too. For maximum usefulness this should be cross subsystem. I suspect the reset controller API may be able to handle some of it.

The regulator power on delays are already handled transparently, by the time regulator_enable() returns the ramp should be finished.

Quoted 11 lines

I think the regulator should encoded its own startup delay. Each individual device should handle its own requirements for delay after power is stable.
The regulator_enable() will handle the delays for the regulator device. And adding the msleep(25) is for lm90 device. If without delay, sometimes the device can't work properly. If read lm90 register immediately after enabling regulator, the reading may be failed. I'm not sure if 25ms is the right value, I read the LM90 SPEC, the max of "SMBus Clock Low Time" is 25ms, so I supposed that it may need about 25ms to stable after power on.

Problem is that you are always waiting, even if the same regulator was turned on already, and even if it is a dummy regulator.

Imagine every driver doing that. Booting would take forever, just because of unnecessary delays all over the place. There has to be a better solution which does not include a mandatory and potentially unnecessary wait time in the driver. At a previous company we had a design with literally dozens of those chip. You really want to force such a boot delay on every user ?

But essentially you don't even know if it is needed; you are just guessing. That is not an acceptable reason to add such a delay, mandatory or not.

Guenter

author
#11 lore raw

Re: [PATCH v3 1/2] hwmon: (lm90) Add power control

Quoted 76 lines · Guenter Roeck
Quoted 60 lines · Wei Ni
Quoted 52 lines · Mark Brown

* PGP Signed by an unknown key

Quoted 7 lines · Guenter Roeck
Quoted 3 lines · Mark Brown

It does, though it gets complicated trying to use it for a case like this since you can't really tell if the regulator was powered on immediately before the device got probed by another device on the bus.

Why not ? Just keep a timestamp.

The support is a callback on state changes; we could keep a timestamp but there's still going to be race conditions around bootloaders. It's doable though.

Quoted 9 lines
Quoted 8 lines
Quoted 2 lines

On a higher level, I wonder if such functionality should be added in the i2c subsystem and not in i2c client drivers. Has anyone thought about this ?

I'm not sure what the subsystem would do for such delays? It's fairly common for things that need this to also want to do things like manipulate GPIOs as part of the power on sequence so the applicability is relatively limited, plus it's not even I2C specific, the same applies to other buses so it ought to be a driver core thing.

Quoted 5 lines

Possibly. I just thought about i2c since it also takes care of basic devicetree bindings. Something along the line of
if devicetree bindings for this device declare one or more regulators, enable those regulators before calling the driver probe function.

That's definitely a driver core thing, not I2C - there's nothing specific to I2C in there at all, needing power is pretty generic. I have considered this before, something along the lines of what we have for pinctrl, but unfortunately the generic case isn't quite generic enough to make it easy. It'd need to be an explicit list of regulators (partly just to make it opt in and avoid breaking things) and you'd want to have a way of handling the different suspend/resume behaviour that devices want. There's a few patterns there.

It's definitely something I think about from time to time and it would be useful to factor things out, the issue is getting a good enough model of what's going on.

Quoted 8 lines
Quoted 3 lines

There was some work on a generic helper for power on sequences but it stalled since it wasn't accepted for the original purpose (LCD panel power ons IIRC).

Too bad. I think it could be kept quite simple, though, by handling it through the regulator subsystem as suggested above. A generic binding for a per-regulator and per-device poweron delay should solve that and possibly even make it transparent to the actual driver code.

Quoted 6 lines

Lots of things have a GPIO for reset too, and some want clocks too. For maximum usefulness this should be cross subsystem. I suspect the reset controller API may be able to handle some of it.

The regulator power on delays are already handled transparently, by the time regulator_enable() returns the ramp should be finished.

Quoted 11 lines

I think the regulator should encoded its own startup delay. Each individual device should handle its own requirements for delay after power is stable.
The regulator_enable() will handle the delays for the regulator device. And adding the msleep(25) is for lm90 device. If without delay, sometimes the device can't work properly. If read lm90 register immediately after enabling regulator, the reading may be failed. I'm not sure if 25ms is the right value, I read the LM90 SPEC, the max of "SMBus Clock Low Time" is 25ms, so I supposed that it may need about 25ms to stable after power on.

Problem is that you are always waiting, even if the same regulator was turned on already, and even if it is a dummy regulator.

Quoted 8 lines

Imagine every driver doing that. Booting would take forever, just because of unnecessary delays all over the place. There has to be a better solution which does not include a mandatory and potentially unnecessary wait time in the driver. At a previous company we had a design with literally dozens of those chip. You really want to force such a boot delay on every user ?

But essentially you don't even know if it is needed; you are just guessing. That is not an acceptable reason to add such a delay, mandatory or not.

I think the device need time to wait stable after power on, but it's difficult to get an exact delay value, and this delay may also relate with platform design, so how about to add a optional property in the DT node, such as "power-on-delay-ms" ?

Quoted 3 lines

Guenter

maintainer
#12 lore raw

Re: [PATCH v3 1/2] hwmon: (lm90) Add power control

Quoted 83 lines · Wei Ni
Quoted 82 lines · Guenter Roeck
Quoted 60 lines · Wei Ni
Quoted 52 lines · Mark Brown

* PGP Signed by an unknown key

Quoted 7 lines · Guenter Roeck
Quoted 3 lines · Mark Brown

It does, though it gets complicated trying to use it for a case like this since you can't really tell if the regulator was powered on immediately before the device got probed by another device on the bus.

Why not ? Just keep a timestamp.

The support is a callback on state changes; we could keep a timestamp but there's still going to be race conditions around bootloaders. It's doable though.

Quoted 9 lines
Quoted 8 lines
Quoted 2 lines

On a higher level, I wonder if such functionality should be added in the i2c subsystem and not in i2c client drivers. Has anyone thought about this ?

I'm not sure what the subsystem would do for such delays? It's fairly common for things that need this to also want to do things like manipulate GPIOs as part of the power on sequence so the applicability is relatively limited, plus it's not even I2C specific, the same applies to other buses so it ought to be a driver core thing.

Quoted 5 lines

Possibly. I just thought about i2c since it also takes care of basic devicetree bindings. Something along the line of
if devicetree bindings for this device declare one or more regulators, enable those regulators before calling the driver probe function.

That's definitely a driver core thing, not I2C - there's nothing specific to I2C in there at all, needing power is pretty generic. I have considered this before, something along the lines of what we have for pinctrl, but unfortunately the generic case isn't quite generic enough to make it easy. It'd need to be an explicit list of regulators (partly just to make it opt in and avoid breaking things) and you'd want to have a way of handling the different suspend/resume behaviour that devices want. There's a few patterns there.

It's definitely something I think about from time to time and it would be useful to factor things out, the issue is getting a good enough model of what's going on.

Quoted 8 lines
Quoted 3 lines

There was some work on a generic helper for power on sequences but it stalled since it wasn't accepted for the original purpose (LCD panel power ons IIRC).

Too bad. I think it could be kept quite simple, though, by handling it through the regulator subsystem as suggested above. A generic binding for a per-regulator and per-device poweron delay should solve that and possibly even make it transparent to the actual driver code.

Quoted 6 lines

Lots of things have a GPIO for reset too, and some want clocks too. For maximum usefulness this should be cross subsystem. I suspect the reset controller API may be able to handle some of it.

The regulator power on delays are already handled transparently, by the time regulator_enable() returns the ramp should be finished.

Quoted 11 lines

I think the regulator should encoded its own startup delay. Each individual device should handle its own requirements for delay after power is stable.
The regulator_enable() will handle the delays for the regulator device. And adding the msleep(25) is for lm90 device. If without delay, sometimes the device can't work properly. If read lm90 register immediately after enabling regulator, the reading may be failed. I'm not sure if 25ms is the right value, I read the LM90 SPEC, the max of "SMBus Clock Low Time" is 25ms, so I supposed that it may need about 25ms to stable after power on.

Problem is that you are always waiting, even if the same regulator was turned on already, and even if it is a dummy regulator.

Imagine every driver doing that. Booting would take forever, just because of unnecessary delays all over the place. There has to be a better solution which does not include a mandatory and potentially unnecessary wait time in the driver. At a previous company we had a design with literally dozens of those chip. You really want to force such a boot delay on every user ?

Quoted 7 lines
Quoted 2 lines

But essentially you don't even know if it is needed; you are just guessing. That is not an acceptable reason to add such a delay, mandatory or not.

I think the device need time to wait stable after power on, but it's difficult to get an exact delay value, and this delay may also relate with platform design, so how about to add a optional property in the DT node, such as "power-on-delay-ms" ?

Possibly, but that still doesn't solve the problem that you are going to wait even if the regulator was already turned on. Simple example:
A system with two sensors, both of which share the same regulator. Each of them will require a delay after turning on power, but only if it was just turned on and not if it was already active.

Guenter

author
#13 lore raw

Re: [PATCH v3 1/2] hwmon: (lm90) Add power control

Quoted 92 lines · Guenter Roeck
Quoted 83 lines · Wei Ni
Quoted 82 lines · Guenter Roeck
Quoted 60 lines · Wei Ni
Quoted 52 lines · Mark Brown

* PGP Signed by an unknown key

Quoted 7 lines · Guenter Roeck
Quoted 3 lines · Mark Brown

It does, though it gets complicated trying to use it for a case like this since you can't really tell if the regulator was powered on immediately before the device got probed by another device on the bus.

Why not ? Just keep a timestamp.

The support is a callback on state changes; we could keep a timestamp but there's still going to be race conditions around bootloaders. It's doable though.

Quoted 9 lines
Quoted 8 lines
Quoted 2 lines

On a higher level, I wonder if such functionality should be added in the i2c subsystem and not in i2c client drivers. Has anyone thought about this ?

I'm not sure what the subsystem would do for such delays? It's fairly common for things that need this to also want to do things like manipulate GPIOs as part of the power on sequence so the applicability is relatively limited, plus it's not even I2C specific, the same applies to other buses so it ought to be a driver core thing.

Quoted 5 lines

Possibly. I just thought about i2c since it also takes care of basic devicetree bindings. Something along the line of
if devicetree bindings for this device declare one or more regulators, enable those regulators before calling the driver probe function.

That's definitely a driver core thing, not I2C - there's nothing specific to I2C in there at all, needing power is pretty generic. I have considered this before, something along the lines of what we have for pinctrl, but unfortunately the generic case isn't quite generic enough to make it easy. It'd need to be an explicit list of regulators (partly just to make it opt in and avoid breaking things) and you'd want to have a way of handling the different suspend/resume behaviour that devices want. There's a few patterns there.

It's definitely something I think about from time to time and it would be useful to factor things out, the issue is getting a good enough model of what's going on.

Quoted 8 lines
Quoted 3 lines

There was some work on a generic helper for power on sequences but it stalled since it wasn't accepted for the original purpose (LCD panel power ons IIRC).

Too bad. I think it could be kept quite simple, though, by handling it through the regulator subsystem as suggested above. A generic binding for a per-regulator and per-device poweron delay should solve that and possibly even make it transparent to the actual driver code.

Quoted 6 lines

Lots of things have a GPIO for reset too, and some want clocks too. For maximum usefulness this should be cross subsystem. I suspect the reset controller API may be able to handle some of it.

The regulator power on delays are already handled transparently, by the time regulator_enable() returns the ramp should be finished.

Quoted 11 lines

I think the regulator should encoded its own startup delay. Each individual device should handle its own requirements for delay after power is stable.
The regulator_enable() will handle the delays for the regulator device. And adding the msleep(25) is for lm90 device. If without delay, sometimes the device can't work properly. If read lm90 register immediately after enabling regulator, the reading may be failed. I'm not sure if 25ms is the right value, I read the LM90 SPEC, the max of "SMBus Clock Low Time" is 25ms, so I supposed that it may need about 25ms to stable after power on.

Problem is that you are always waiting, even if the same regulator was turned on already, and even if it is a dummy regulator.

Imagine every driver doing that. Booting would take forever, just because of unnecessary delays all over the place. There has to be a better solution which does not include a mandatory and potentially unnecessary wait time in the driver. At a previous company we had a design with literally dozens of those chip. You really want to force such a boot delay on every user ?

Quoted 7 lines
Quoted 2 lines

But essentially you don't even know if it is needed; you are just guessing. That is not an acceptable reason to add such a delay, mandatory or not.

I think the device need time to wait stable after power on, but it's difficult to get an exact delay value, and this delay may also relate with platform design, so how about to add a optional property in the DT node, such as "power-on-delay-ms" ?

Quoted 5 lines

Possibly, but that still doesn't solve the problem that you are going to wait even if the regulator was already turned on. Simple example:
A system with two sensors, both of which share the same regulator. Each of them will require a delay after turning on power, but only if it was just turned on and not if it was already active.

Yes, but as Mark said, the regulator subsystem still can't know if the regulator was powered on.
Do you have any suggestions?

Quoted 3 lines

Guenter

#14 lore raw

Re: [PATCH v3 1/2] hwmon: (lm90) Add power control

In reply to Wei Ni
Quoted 4 lines · Wei Ni

I think the device need time to wait stable after power on, but it's difficult to get an exact delay value, and this delay may also relate with platform design, so how about to add a optional property in the DT node, such as "power-on-delay-ms" ?

This is something you should *really* be able to get from the datasheet for the part - this sort of stuff has to be documented for hardware to be used robustly. It seems entirely possible that you are working around an issue with the regulator driver you are using not correctly providing its ramp time here.

author
#15 lore raw

Re: [PATCH v3 1/2] hwmon: (lm90) Add power control

Quoted 9 lines · Mark Brown

* PGP Signed by an unknown key

Quoted 4 lines · Wei Ni

I think the device need time to wait stable after power on, but it's difficult to get an exact delay value, and this delay may also relate with platform design, so how about to add a optional property in the DT node, such as "power-on-delay-ms" ?

Quoted 5 lines

This is something you should *really* be able to get from the datasheet for the part - this sort of stuff has to be documented for hardware to be used robustly. It seems entirely possible that you are working around an issue with the regulator driver you are using not correctly providing its ramp time here.

On my platform, it use palmas-regulator.c, ldo6 for this lm90 power rail. I checked this driver, it will handle ramp_delay except LDOx. Since I'm not familiar with this palmas device and driver, so do you mean I can set regulator-ramp-delay property in the DT for ldo6, but I really don't know what value should I set :(

Thanks.
Wei.

Quoted 4 lines

* Unknown Key
* 0x7EA229BD

#16 lore raw

Re: [PATCH v3 1/2] hwmon: (lm90) Add power control

Quoted 5 lines · Wei Ni

On my platform, it use palmas-regulator.c, ldo6 for this lm90 power rail. I checked this driver, it will handle ramp_delay except LDOx. Since I'm not familiar with this palmas device and driver, so do you mean I can set regulator-ramp-delay property in the DT for ldo6, but I really don't know what value should I set :(

Laxman just submitted a patch adding the ramp delay information which I applied. It seems like this is just a hack for your board and can therefore be removed?

author
#17 lore raw

Re: [PATCH v3 1/2] hwmon: (lm90) Add power control

Quoted 10 lines · Mark Brown

* PGP Signed by an unknown key

Quoted 5 lines · Wei Ni

On my platform, it use palmas-regulator.c, ldo6 for this lm90 power rail. I checked this driver, it will handle ramp_delay except LDOx. Since I'm not familiar with this palmas device and driver, so do you mean I can set regulator-ramp-delay property in the DT for ldo6, but I really don't know what value should I set :(

Quoted 3 lines

Laxman just submitted a patch adding the ramp delay information which I applied. It seems like this is just a hack for your board and can therefore be removed?

Oh, yes, it seems the patches is Laxman's [PATCH 1/2] regulator: palmas:
configure enable time for LDOs.
Thanks, I will check it, and remove the delay in my next patch.

Wei.

Quoted 4 lines

* Unknown Key
* 0x7EA229BD

author
#18 lore raw

Re: [PATCH v3 1/2] hwmon: (lm90) Add power control

In reply to Guenter Roeck
Quoted 14 lines · Guenter Roeck
Quoted 13 lines · Mark Brown
Quoted 11 lines · Guenter Roeck
Quoted 7 lines · Mark Brown

On Mon, Sep 09, 2013 at 06:29:11PM +0800, Wei Ni wrote:

This doesn't look good, it is going to ignore actual errors - I *really* doubt that vcc is optional, it looks like it's the main power supply for the device. You should use normal regulator_get(), _optional() is for supplies which could physically not be provided in a system (eg, if the device can generate them internally if required).

Then he'll have to make sure that all devicetree files in the system contain references to this regulator.

Quoted 7 lines
Quoted 5 lines

Or get the patches applied on top of the code that'll be going in this cycle implementing get_optional() properly - when that's done the default will be to provide a dummy supply for regulator_get(). If you ack the patch I'd be happy to carry it.

Jean will have to ack it.

I think it's better to use get_optional(), and ignore the errors except -EPROBE_DEFER. Because many platform may always power on this device, and will not provide regulator for it, so if we get errors from regulator subsystem and return it directly, then the probe() can't be implemented, this driver can't work properly, even though it can work without regulator support.
Mark, do you mean you have patches for regulator_get_optional() and regulator_get()?

Wei.

maintainer
#19 lore raw

Re: [PATCH v3 1/2] hwmon: (lm90) Add power control

Quoted 22 lines · Wei Ni
Quoted 14 lines · Guenter Roeck
Quoted 13 lines · Mark Brown
Quoted 11 lines · Guenter Roeck
Quoted 7 lines · Mark Brown

On Mon, Sep 09, 2013 at 06:29:11PM +0800, Wei Ni wrote:

This doesn't look good, it is going to ignore actual errors - I *really* doubt that vcc is optional, it looks like it's the main power supply for the device. You should use normal regulator_get(), _optional() is for supplies which could physically not be provided in a system (eg, if the device can generate them internally if required).

Then he'll have to make sure that all devicetree files in the system contain references to this regulator.

Quoted 7 lines
Quoted 5 lines

Or get the patches applied on top of the code that'll be going in this cycle implementing get_optional() properly - when that's done the default will be to provide a dummy supply for regulator_get(). If you ack the patch I'd be happy to carry it.

Jean will have to ack it.

Quoted 9 lines

I think it's better to use get_optional(), and ignore the errors except -EPROBE_DEFER. Because many platform may always power on this device, and will not provide regulator for it, so if we get errors from regulator subsystem and return it directly, then the probe() can't be implemented, this driver can't work properly, even though it can work without regulator support.
Mark, do you mean you have patches for regulator_get_optional() and regulator_get()?

My understanding is that by adding regulator support you essentially committed to adding regulators (if necessary dummy ones) for this driver to all those platforms. This is quite similar to other drivers in the same situation. Once you start along that route, you'll have to go it all the way.

Guenter

#20 lore raw

Re: [PATCH v3 1/2] hwmon: (lm90) Add power control

Quoted 37 lines · Guenter Roeck
Quoted 26 lines · Wei Ni
Quoted 18 lines · Guenter Roeck
Quoted 17 lines · Mark Brown
Quoted 15 lines · Guenter Roeck
Quoted 11 lines · Mark Brown

On Mon, Sep 09, 2013 at 06:29:11PM +0800, Wei Ni wrote:

This doesn't look good, it is going to ignore actual errors - I *really*
doubt that vcc is optional, it looks like it's the main power supply for
the device. You should use normal regulator_get(), _optional() is for
supplies which could physically not be provided in a system (eg, if the
device can generate them internally if required).

Then he'll have to make sure that all devicetree files in the system contain references to this regulator.

Quoted 7 lines
Quoted 5 lines

Or get the patches applied on top of the code that'll be going in this cycle implementing get_optional() properly - when that's done the default will be to provide a dummy supply for regulator_get(). If you ack the patch I'd be happy to carry it.

Jean will have to ack it.

Quoted 9 lines

I think it's better to use get_optional(), and ignore the errors except -EPROBE_DEFER. Because many platform may always power on this device, and will not provide regulator for it, so if we get errors from regulator subsystem and return it directly, then the probe() can't be implemented, this driver can't work properly, even though it can work without regulator support.
Mark, do you mean you have patches for regulator_get_optional() and regulator_get()?

Quoted 5 lines

My understanding is that by adding regulator support you essentially committed to adding regulators (if necessary dummy ones) for this driver to all those platforms. This is quite similar to other drivers in the same situation. Once you start along that route, you'll have to go it all the way.

By using regulator_get_optional(), the regulator should be optional, hence you only have to add it to platforms that need it.

maintainer
#21 lore raw

Re: [PATCH v3 1/2] hwmon: (lm90) Add power control

Quoted 38 lines · Stephen Warren
Quoted 37 lines · Guenter Roeck
Quoted 35 lines · Wei Ni
Quoted 18 lines · Guenter Roeck
Quoted 17 lines · Mark Brown
Quoted 15 lines · Guenter Roeck
Quoted 11 lines · Mark Brown

On Mon, Sep 09, 2013 at 06:29:11PM +0800, Wei Ni wrote:

This doesn't look good, it is going to ignore actual errors - I *really*
doubt that vcc is optional, it looks like it's the main power supply for
the device. You should use normal regulator_get(), _optional() is for
supplies which could physically not be provided in a system (eg, if the
device can generate them internally if required).

Then he'll have to make sure that all devicetree files in the system contain references to this regulator.

Quoted 7 lines
Quoted 5 lines

Or get the patches applied on top of the code that'll be going in this cycle implementing get_optional() properly - when that's done the default will be to provide a dummy supply for regulator_get(). If you ack the patch I'd be happy to carry it.

Jean will have to ack it.

I think it's better to use get_optional(), and ignore the errors except -EPROBE_DEFER. Because many platform may always power on this device, and will not provide regulator for it, so if we get errors from regulator subsystem and return it directly, then the probe() can't be implemented, this driver can't work properly, even though it can work without regulator support.
Mark, do you mean you have patches for regulator_get_optional() and regulator_get()?

Quoted 9 lines
Quoted 5 lines

My understanding is that by adding regulator support you essentially committed to adding regulators (if necessary dummy ones) for this driver to all those platforms. This is quite similar to other drivers in the same situation. Once you start along that route, you'll have to go it all the way.

By using regulator_get_optional(), the regulator should be optional, hence you only have to add it to platforms that need it.

Earlier comments suggest that this is not the intended use case for regulator_get_optional().

Guenter

author
#22 lore raw

Re: [PATCH v3 1/2] hwmon: (lm90) Add power control

Quoted 45 lines · Guenter Roeck
Quoted 44 lines · Stephen Warren
Quoted 42 lines · Guenter Roeck
Quoted 26 lines · Wei Ni
Quoted 18 lines · Guenter Roeck
Quoted 17 lines · Mark Brown
Quoted 15 lines · Guenter Roeck
Quoted 11 lines · Mark Brown

On Mon, Sep 09, 2013 at 06:29:11PM +0800, Wei Ni wrote:

This doesn't look good, it is going to ignore actual errors - I *really*
doubt that vcc is optional, it looks like it's the main power supply for
the device. You should use normal regulator_get(), _optional() is for
supplies which could physically not be provided in a system (eg, if the
device can generate them internally if required).

Then he'll have to make sure that all devicetree files in the system contain references to this regulator.

Quoted 7 lines
Quoted 5 lines

Or get the patches applied on top of the code that'll be going in this cycle implementing get_optional() properly - when that's done the default will be to provide a dummy supply for regulator_get(). If you ack the patch I'd be happy to carry it.

Jean will have to ack it.

Quoted 9 lines

I think it's better to use get_optional(), and ignore the errors except -EPROBE_DEFER. Because many platform may always power on this device, and will not provide regulator for it, so if we get errors from regulator subsystem and return it directly, then the probe() can't be implemented, this driver can't work properly, even though it can work without regulator support.
Mark, do you mean you have patches for regulator_get_optional() and regulator_get()?

My understanding is that by adding regulator support you essentially committed to adding regulators (if necessary dummy ones) for this driver to all those platforms. This is quite similar to other drivers in the same situation. Once you start along that route, you'll have to go it all the way.

Quoted 6 lines
Quoted 3 lines

By using regulator_get_optional(), the regulator should be optional, hence you only have to add it to platforms that need it.

Earlier comments suggest that this is not the intended use case for regulator_get_optional().

So I just need to use the regulator_get() instead, is it right?

Quoted 3 lines

Guenter

#23 lore raw

Re: [PATCH v3 1/2] hwmon: (lm90) Add power control

In reply to Guenter Roeck
Quoted 2 lines · Guenter Roeck
Quoted 1 line · Stephen Warren

On 09/09/2013 09:36 PM, Guenter Roeck wrote:

...

Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

My understanding is that by adding regulator support you essentially committed to adding regulators (if necessary dummy ones) for this driver to all those platforms. This is quite similar to other drivers in the same situation. Once you start along that route, you'll have to go it all the way.

Quoted 6 lines
Quoted 3 lines

By using regulator_get_optional(), the regulator should be optional, hence you only have to add it to platforms that need it.

Earlier comments suggest that this is not the intended use case for regulator_get_optional().

Isn't the issue only whether the optional aspect of the regulator is implemented by:

a) regulator_get_optional() returning failure, then the driver having to check for that and either using or not-using the regulator.

b) regulator_get_optional() returning a dummy regulator automatically when none is specified in DT or the regulator lookup table, and hence the driver can always call regulator_enable/disable on the returned value.

maintainer
#24 lore raw

Re: [PATCH v3 1/2] hwmon: (lm90) Add power control

Quoted 20 lines · Stephen Warren
Quoted 2 lines · Guenter Roeck
Quoted 1 line · Stephen Warren

On 09/09/2013 09:36 PM, Guenter Roeck wrote:

...

Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

My understanding is that by adding regulator support you essentially committed to adding regulators (if necessary dummy ones) for this driver to all those platforms. This is quite similar to other drivers in the same situation. Once you start along that route, you'll have to go it all the way.

Quoted 6 lines
Quoted 3 lines

By using regulator_get_optional(), the regulator should be optional, hence you only have to add it to platforms that need it.

Earlier comments suggest that this is not the intended use case for regulator_get_optional().

Isn't the issue only whether the optional aspect of the regulator is implemented by:

Quoted 7 lines

a) regulator_get_optional() returning failure, then the driver having to check for that and either using or not-using the regulator.

b) regulator_get_optional() returning a dummy regulator automatically when none is specified in DT or the regulator lookup table, and hence the driver can always call regulator_enable/disable on the returned value.

I don't know. The regulator folks would have to answer that.

Guenter

#25 lore raw

Re: [PATCH v3 1/2] hwmon: (lm90) Add power control

In reply to Stephen Warren
Quoted 4 lines · Stephen Warren
Quoted 2 lines · Guenter Roeck

Earlier comments suggest that this is not the intended use case for regulator_get_optional().

That's right.

Quoted 9 lines

Isn't the issue only whether the optional aspect of the regulator is implemented by:

a) regulator_get_optional() returning failure, then the driver having to check for that and either using or not-using the regulator.

b) regulator_get_optional() returning a dummy regulator automatically when none is specified in DT or the regulator lookup table, and hence the driver can always call regulator_enable/disable on the returned value.

No. There are a couple of issues here. One is that we don't want to litter all drivers with conditional code to check if they actually got the regulator and so on, that's just pointless make work on the part of consumers. The other is that just ignoring errors is generally terrible practice which we don't want to encourage - ignoring the specific case where nothing is provided and the system has control of that is one thing but just ignoring any error is another.

#26 lore raw

Re: [PATCH v3 1/2] hwmon: (lm90) Add power control

Quoted 20 lines · Mark Brown
Quoted 4 lines · Stephen Warren
Quoted 2 lines · Guenter Roeck

Earlier comments suggest that this is not the intended use case for regulator_get_optional().

That's right.

Quoted 11 lines

Isn't the issue only whether the optional aspect of the regulator is implemented by:

a) regulator_get_optional() returning failure, then the driver having to check for that and either using or not-using the regulator.

b) regulator_get_optional() returning a dummy regulator automatically when none is specified in DT or the regulator lookup table, and hence the driver can always call regulator_enable/disable on the returned value.

Quoted 4 lines

No. There are a couple of issues here. One is that we don't want to litter all drivers with conditional code to check if they actually got the regulator and so on, that's just pointless make work on the part of consumers.

So that's exactly the difference between (a) and (b) above.

Quoted 4 lines

The other is that just ignoring errors is generally terrible practice which we don't want to encourage - ignoring the specific case where nothing is provided and the system has control of that is one thing but just ignoring any error is another.

Yes, obviously the code somewhere needs to distinguish between missing-so-use-a-dummy, and specified-but-in-a-broken-way. Doesn't regulator_get_optional() already distinguish those two cases? Perhaps that's the enhancement to regulator_get_optional() that you were requesting.

#27 lore raw

Re: [PATCH v3 1/2] hwmon: (lm90) Add power control

Quoted 8 lines · Stephen Warren
Quoted 4 lines · Mark Brown

No. There are a couple of issues here. One is that we don't want to litter all drivers with conditional code to check if they actually got the regulator and so on, that's just pointless make work on the part of consumers.

So that's exactly the difference between (a) and (b) above.

Right, but the idea is that we just only ignore a failure to get a supply if we can usefully run without that supply being present and there's more code there than simply ignoring the error - if the driver can genuinely just ignore all errors and otherwise not do anything different then requesting the regulator in the first place is clearly a waste of time and enabling it would be a waste of power.

A driver should only be carrying code for a missing regulator if it can usefully work without it, like the cases where devices can use an internal reference if one is not available.

Quoted 10 lines
Quoted 4 lines

The other is that just ignoring errors is generally terrible practice which we don't want to encourage - ignoring the specific case where nothing is provided and the system has control of that is one thing but just ignoring any error is another.

Yes, obviously the code somewhere needs to distinguish between missing-so-use-a-dummy, and specified-but-in-a-broken-way. Doesn't regulator_get_optional() already distinguish those two cases? Perhaps that's the enhancement to regulator_get_optional() that you were requesting.

Both calls are identical in terms of handling genuine errors. If the driver is just trying to ignore errors it will be more work to use _optional() since it has to cope with the regulator not being present in a system.

#28 lore raw

Re: [PATCH v3 1/2] hwmon: (lm90) Add power control

Quoted 17 lines · Mark Brown
Quoted 8 lines · Stephen Warren
Quoted 4 lines · Mark Brown

No. There are a couple of issues here. One is that we don't want to litter all drivers with conditional code to check if they actually got the regulator and so on, that's just pointless make work on the part of consumers.

So that's exactly the difference between (a) and (b) above.

Right, but the idea is that we just only ignore a failure to get a supply if we can usefully run without that supply being present and there's more code there than simply ignoring the error - if the driver can genuinely just ignore all errors and otherwise not do anything different then requesting the regulator in the first place is clearly a waste of time and enabling it would be a waste of power.

Quoted 3 lines

A driver should only be carrying code for a missing regulator if it can usefully work without it, like the cases where devices can use an internal reference if one is not available.

OK, so I believe you're saying that the case of a chip with just a single power source, which absolutely must be present in HW for the chip to be powered, isn't appropriate for regulator_get_optional(). Something must always define a regulator for that power source, even if there is no external SW control over that power source.

If so, how does a driver (or binding) that's been written without any support for a regulator (since so far all boards have had no SW control over that power source; it's always on) get enhanced to support boards where there is SW control over the power source?

We either allow the regulator to be optional (since SW control over the regulator is optional), or go back to every board file and DT and add a dummy regulator in (which then breaks DT ABI, and even ignoring that is a pain).

And note that when I say "optional" at the start of the previous paragraph, I'm talking about probe-time regulator_get() operations and DT content. Clearly as far as the rest of the driver is concerned, something can always provide a dummy regulator so that e.g. regulator_enable/disable() elsewhere always have something to operate on. However, probe() either needs to call an API that automatically provides such a dummy regulator, or open-code that itself. I'm still not clear which option you think should be used.

maintainer
#29 lore raw

Re: [PATCH v3 1/2] hwmon: (lm90) Add power control

Quoted 22 lines · Stephen Warren
Quoted 17 lines · Mark Brown
Quoted 8 lines · Stephen Warren
Quoted 4 lines · Mark Brown

No. There are a couple of issues here. One is that we don't want to litter all drivers with conditional code to check if they actually got the regulator and so on, that's just pointless make work on the part of consumers.

So that's exactly the difference between (a) and (b) above.

Right, but the idea is that we just only ignore a failure to get a supply if we can usefully run without that supply being present and there's more code there than simply ignoring the error - if the driver can genuinely just ignore all errors and otherwise not do anything different then requesting the regulator in the first place is clearly a waste of time and enabling it would be a waste of power.

Quoted 3 lines

A driver should only be carrying code for a missing regulator if it can usefully work without it, like the cases where devices can use an internal reference if one is not available.

Quoted 6 lines

OK, so I believe you're saying that the case of a chip with just a single power source, which absolutely must be present in HW for the chip to be powered, isn't appropriate for regulator_get_optional(). Something must always define a regulator for that power source, even if there is no external SW control over that power source.

I think you are supposed to use a dummy regulator in that case.

Guenter

Quoted 19 lines

If so, how does a driver (or binding) that's been written without any support for a regulator (since so far all boards have had no SW control over that power source; it's always on) get enhanced to support boards where there is SW control over the power source?

We either allow the regulator to be optional (since SW control over the regulator is optional), or go back to every board file and DT and add a dummy regulator in (which then breaks DT ABI, and even ignoring that is a pain).

And note that when I say "optional" at the start of the previous paragraph, I'm talking about probe-time regulator_get() operations and DT content. Clearly as far as the rest of the driver is concerned, something can always provide a dummy regulator so that e.g. regulator_enable/disable() elsewhere always have something to operate on. However, probe() either needs to call an API that automatically provides such a dummy regulator, or open-code that itself. I'm still not clear which option you think should be used.

#30 lore raw

Re: [PATCH v3 1/2] hwmon: (lm90) Add power control

In reply to Stephen Warren
Quoted 5 lines · Stephen Warren

OK, so I believe you're saying that the case of a chip with just a single power source, which absolutely must be present in HW for the chip to be powered, isn't appropriate for regulator_get_optional(). Something must always define a regulator for that power source, even if there is no external SW control over that power source.

Well, it really should be mandatory - personally I don't think it's sensible to add off-SoC chips without defining their regulators, it's more trouble than it's worth to have to add them later for all the time it takes to define the bindings. In IETF terms it's a should.

Quoted 4 lines

We either allow the regulator to be optional (since SW control over the regulator is optional), or go back to every board file and DT and add a dummy regulator in (which then breaks DT ABI, and even ignoring that is a pain).

The whole point of the way I'm changing the dummy support is to allow us to gracefully cope with errors here so there's no mandatory update even though strictly there should be one.

Quoted 8 lines

And note that when I say "optional" at the start of the previous paragraph, I'm talking about probe-time regulator_get() operations and DT content. Clearly as far as the rest of the driver is concerned, something can always provide a dummy regulator so that e.g. regulator_enable/disable() elsewhere always have something to operate on. However, probe() either needs to call an API that automatically provides such a dummy regulator, or open-code that itself. I'm still not clear which option you think should be used.

Clearly open coding this in every single driver is just not sane, you're immediately in the situation where every single driver has to implement the same thing at which point no driver ought to be doing it.

#31 lore raw

Re: [PATCH v3 1/2] hwmon: (lm90) Add power control

Quoted 15 lines · Mark Brown
Quoted 6 lines · Stephen Warren

OK, so I believe you're saying that the case of a chip with just a single power source, which absolutely must be present in HW for the chip to be powered, isn't appropriate for regulator_get_optional(). Something must always define a regulator for that power source, even if there is no external SW control over that power source.

Well, it really should be mandatory - personally I don't think it's sensible to add off-SoC chips without defining their regulators, it's more trouble than it's worth to have to add them later for all the time it takes to define the bindings. In IETF terms it's a should.

Quoted 8 lines
Quoted 4 lines

We either allow the regulator to be optional (since SW control over the regulator is optional), or go back to every board file and DT and add a dummy regulator in (which then breaks DT ABI, and even ignoring that is a pain).

The whole point of the way I'm changing the dummy support is to allow us to gracefully cope with errors here so there's no mandatory update even though strictly there should be one.

OK, so for the DT binding we should make vcc-supply a required property, yet the driver will still work OK if that property just happens to be missing (or e.g. when instantiated from a board file, and there's no regulator).

#32 lore raw

Re: [PATCH v3 1/2] hwmon: (lm90) Add power control

Quoted 4 lines · Stephen Warren

OK, so for the DT binding we should make vcc-supply a required property, yet the driver will still work OK if that property just happens to be missing (or e.g. when instantiated from a board file, and there's no regulator).

Yup. That way we've got both the binding and code trying to make things work, hopefully that'll maximise robustness.

author
#33 lore raw

Re: [PATCH v3 1/2] hwmon: (lm90) Add power control

Quoted 11 lines · Mark Brown

* PGP Signed by an unknown key

Quoted 4 lines · Stephen Warren

OK, so for the DT binding we should make vcc-supply a required property, yet the driver will still work OK if that property just happens to be missing (or e.g. when instantiated from a board file, and there's no regulator).

Yup. That way we've got both the binding and code trying to make things work, hopefully that'll maximise robustness.

Ok, it looks like regulator_get will handle all things, looking forward to your patches :)
Then I think my changes will be simple, just something like:
+ reg = devm_regulator_get(dev, "vcc");
+ if (!IS_ERR(reg)) {
+ err = regulator_enable(reg);
+ if (err < 0)
+ return err;
+ } else {
+ return PTR_ERR(reg);
+ }

Wei.

Quoted 4 lines

* Unknown Key
* 0x7EA229BD

#34 lore raw

Re: [PATCH v3 1/2] hwmon: (lm90) Add power control

In reply to Wei Ni
Quoted 2 lines · Wei Ni

Mark, do you mean you have patches for regulator_get_optional() and regulator_get()?

Not yet but they'll be there by the time the next merge window comes.

author
#35 lore raw

PATCH v3 2/2 Documentation: dt: hwmon: add OF document for LM90

In reply to Wei Ni

Add OF document for LM90 in Documentation/devicetree/.

---
 Documentation/devicetree/bindings/hwmon/lm90.txt |   44 ++++++++++++++++++++++
 1 file changed, 44 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/hwmon/lm90.txt
Documentation/devicetree/bindings/hwmon/lm90.txt new file +44 -0
new file mode 100644
index 0000000..5570875
@@ -0,0 +1,44 @@
+* LM90 series thermometer.
+
+Required node properties:
+- compatible: manufacture and chip name, one of
+		"<manufacture>,adm1032"
+		"<manufacture>,adt7461"
+		"<manufacture>,adt7461a"
+		"<manufacture>,g781"
+		"<manufacture>,lm90"
+		"<manufacture>,lm86"
+		"<manufacture>,lm89"
+		"<manufacture>,lm99"
+		"<manufacture>,max6646"
+		"<manufacture>,max6647"
+		"<manufacture>,max6649"
+		"<manufacture>,max6657"
+		"<manufacture>,max6658"
+		"<manufacture>,max6659"
+		"<manufacture>,max6680"
+		"<manufacture>,max6681"
+		"<manufacture>,max6695"
+		"<manufacture>,max6696"
+		"<manufacture>,nct1008"
+		"<manufacture>,w83l771"
+		"<manufacture>,sa56004"
+
+- reg: I2C bus address of the device
+
+Optional properties:
+- vcc-supply: vcc regulator for the supply voltage.
+              If this is not set, assuming vdd is always powered.
+- interrupts: Contains a single interrupt specifier which describes the
+              LM90 pin6 output.
+              See interrupt-controller/interrupts.txt for the format.
+
+Example LM90 node:
+
+temp-sensor {
+	compatible = "onnn,nct1008";
+	reg = <0x4c>;
+	vcc-supply = <&palmas_ldo6_reg>;
+	interrupt-parent = <&gpio>;
+	interrupts = <TEGRA_GPIO(O, 4) IRQ_TYPE_LEVEL_LOW>;
+}
Signature · 1 line
1.7.9.5
maintainer
#36 lore raw

Re: [PATCH v3 2/2] Documentation: dt: hwmon: add OF document for LM90

Quoted 14 lines · Wei Ni

Add OF document for LM90 in Documentation/devicetree/.

---
  Documentation/devicetree/bindings/hwmon/lm90.txt |   44 ++++++++++++++++++++++
  1 file changed, 44 insertions(+)

create mode 100644 Documentation/devicetree/bindings/hwmon/lm90.txt

Documentation/devicetree/bindings/hwmon/lm90.txt new file +0 -0
new file mode 100644
index 0000000..5570875

Documentation/devicetree/bindings/hwmon/lm90.txt line 4

Quoted 4 lines
Documentation/devicetree/bindings/hwmon/lm90.txt new file +4 -0
@@ -0,0 +1,44 @@
+* LM90 series thermometer.
+
+Required node properties:
+- compatible: manufacture and chip name, one of

manufacturer

Quoted 12 lines
Documentation/devicetree/bindings/hwmon/lm90.txt new file +12 -0
+		"<manufacture>,adm1032"
+		"<manufacture>,adt7461"
+		"<manufacture>,adt7461a"
+		"<manufacture>,g781"
+		"<manufacture>,lm90"
+		"<manufacture>,lm86"
+		"<manufacture>,lm89"
+		"<manufacture>,lm99"
+		"<manufacture>,max6646"
+		"<manufacture>,max6647"
+		"<manufacture>,max6649"
+		"<manufacture>,max6657"

Documentation/devicetree/bindings/hwmon/lm90.txt line 26

Quoted 10 lines
Documentation/devicetree/bindings/hwmon/lm90.txt new file +10 -0
+		"<manufacture>,max6658"
+		"<manufacture>,max6659"
+		"<manufacture>,max6680"
+		"<manufacture>,max6681"
+		"<manufacture>,max6695"
+		"<manufacture>,max6696"
+		"<manufacture>,nct1008"
+		"<manufacture>,w83l771"
+		"<manufacture>,sa56004"
+

Shouldn't the manufacturers be listed explicitly ?

Documentation/devicetree/bindings/hwmon/lm90.txt line 31

Quoted 5 lines
Documentation/devicetree/bindings/hwmon/lm90.txt new file +5 -0
+- reg: I2C bus address of the device
+
+Optional properties:
+- vcc-supply: vcc regulator for the supply voltage.
+              If this is not set, assuming vdd is always powered.

s/assuming/assume/

Documentation/devicetree/bindings/hwmon/lm90.txt line 42

Quoted 11 lines
Documentation/devicetree/bindings/hwmon/lm90.txt new file +11 -0
+- interrupts: Contains a single interrupt specifier which describes the
+              LM90 pin6 output.
+              See interrupt-controller/interrupts.txt for the format.
+
+Example LM90 node:
+
+temp-sensor {
+	compatible = "onnn,nct1008";
+	reg = <0x4c>;
+	vcc-supply = <&palmas_ldo6_reg>;
+	interrupt-parent = <&gpio>;

List above as optional property.

Quoted 3 lines
Documentation/devicetree/bindings/hwmon/lm90.txt new file +2 -0
+	interrupts = <TEGRA_GPIO(O, 4) IRQ_TYPE_LEVEL_LOW>;
+}
#37 lore raw

Re: [PATCH v3 2/2] Documentation: dt: hwmon: add OF document for LM90

Quoted 13 lines · Guenter Roeck

Documentation/devicetree/bindings/hwmon/lm90.txt line 4

Quoted 8 lines · Wei Ni

Add OF document for LM90 in Documentation/devicetree/.

Documentation/devicetree/bindings/hwmon/lm90.txt new file +4 -0
 
+* LM90 series thermometer.
+
+Required node properties:
+- compatible: manufacture and chip name, one of

manufacturer

Quoted 1 line

+ "<manufacture>,adm1032"

...

Quoted 3 lines
Quoted 1 line

+ "<manufacture>,sa56004"

Shouldn't the manufacturers be listed explicitly ?

Yes, and they must all be present in Documentation/devicetree/bindings/vendor-prefixes.txt.

Quoted 9 lines

Documentation/devicetree/bindings/hwmon/lm90.txt line 42

Quoted 7 lines
Documentation/devicetree/bindings/hwmon/lm90.txt new file +7 -0
+Example LM90 node:
+
+temp-sensor {
+    compatible = "onnn,nct1008";
+    reg = <0x4c>;
+    vcc-supply = <&palmas_ldo6_reg>;
+    interrupt-parent = <&gpio>;

List above as optional property.

I believe it's common not to document this, since it's implicitly supported as part of any node that is an interrupt source.

author
#38 lore raw

Re: [PATCH v3 2/2] Documentation: dt: hwmon: add OF document for LM90

Quoted 13 lines · Stephen Warren
Quoted 12 lines · Guenter Roeck

Documentation/devicetree/bindings/hwmon/lm90.txt line 4

Quoted 8 lines · Wei Ni

Add OF document for LM90 in Documentation/devicetree/.

Documentation/devicetree/bindings/hwmon/lm90.txt new file +4 -0
 
+* LM90 series thermometer.
+
+Required node properties:
+- compatible: manufacture and chip name, one of

manufacturer

Quoted 8 lines
Quoted 1 line
Quoted 1 line

+ "<manufacture>,adm1032"

...

Quoted 3 lines
Quoted 1 line

+ "<manufacture>,sa56004"

Shouldn't the manufacturers be listed explicitly ?

Yes, and they must all be present in Documentation/devicetree/bindings/vendor-prefixes.txt.

Oh, got it, I will update it, thanks.

Quoted 14 lines
Quoted 10 lines

Documentation/devicetree/bindings/hwmon/lm90.txt line 42

Quoted 8 lines
Documentation/devicetree/bindings/hwmon/lm90.txt new file +7 -0
+Example LM90 node:
+
+temp-sensor {
+    compatible = "onnn,nct1008";
+    reg = <0x4c>;
+    vcc-supply = <&palmas_ldo6_reg>;
+    interrupt-parent = <&gpio>;

List above as optional property.

I believe it's common not to document this, since it's implicitly supported as part of any node that is an interrupt source.

#39 lore raw

Re: [PATCH v3 2/2] Documentation: dt: hwmon: add OF document for LM90

In reply to Wei Ni

Documentation/devicetree/bindings/hwmon/lm90.txt

Quoted 5 lines · Wei Ni
Documentation/devicetree/bindings/hwmon/lm90.txt new file +0 -0
new file mode 100644
index 0000000..5570875

While at it, please update and rename ads1015.txt.

Documentation/devicetree/bindings/hwmon/lm90.txt line 12

Quoted 13 lines
Documentation/devicetree/bindings/hwmon/lm90.txt new file +12 -0
@@ -0,0 +1,44 @@
+* LM90 series thermometer.
+
+Required node properties:
+- compatible: manufacture and chip name, one of
+               "<manufacture>,adm1032"
+               "<manufacture>,adt7461"
+               "<manufacture>,adt7461a"
+               "<manufacture>,g781"
+               "<manufacture>,lm90"
+               "<manufacture>,lm86"
+               "<manufacture>,lm89"
+               "<manufacture>,lm99"

More versions of this of different ages are required.

Documentation/devicetree/bindings/hwmon/lm90.txt line 22

Quoted 10 lines
Documentation/devicetree/bindings/hwmon/lm90.txt new file +10 -0
+               "<manufacture>,max6646"
+               "<manufacture>,max6647"
+               "<manufacture>,max6649"
+               "<manufacture>,max6657"
+               "<manufacture>,max6658"
+               "<manufacture>,max6659"
+               "<manufacture>,max6680"
+               "<manufacture>,max6681"
+               "<manufacture>,max6695"
+               "<manufacture>,max6696"

SSDNow devices are required.

author
#40 lore raw

Re: [PATCH v3 2/2] Documentation: dt: hwmon: add OF document for LM90

Quoted 8 lines · Ramkumar Ramachandra

Documentation/devicetree/bindings/hwmon/lm90.txt

Quoted 5 lines · Wei Ni
Documentation/devicetree/bindings/hwmon/lm90.txt new file +0 -0
new file mode 100644
index 0000000..5570875

While at it, please update and rename ads1015.txt.

This series is for lm90 compatible devices, it seems ads1015 is not register-compatible with lm90.

Quoted 16 lines
Quoted 4 lines
Documentation/devicetree/bindings/hwmon/lm90.txt new file +2 -0
@@ -0,0 +1,44 @@
+* LM90 series thermometer.
+

Documentation/devicetree/bindings/hwmon/lm90.txt line 12

Quoted 10 lines
Documentation/devicetree/bindings/hwmon/lm90.txt new file +10 -0
+Required node properties:
+- compatible: manufacture and chip name, one of
+               "<manufacture>,adm1032"
+               "<manufacture>,adt7461"
+               "<manufacture>,adt7461a"
+               "<manufacture>,g781"
+               "<manufacture>,lm90"
+               "<manufacture>,lm86"
+               "<manufacture>,lm89"
+               "<manufacture>,lm99"

More versions of this of different ages are required.

In here, the chip names, such as "lm99", come from lm90.c id_table, the i2c subsystem want to use it to load driver, so we can add any other names.

Quoted 12 lines

Documentation/devicetree/bindings/hwmon/lm90.txt line 22

Quoted 11 lines
Documentation/devicetree/bindings/hwmon/lm90.txt new file +10 -0
+               "<manufacture>,max6646"
+               "<manufacture>,max6647"
+               "<manufacture>,max6649"
+               "<manufacture>,max6657"
+               "<manufacture>,max6658"
+               "<manufacture>,max6659"
+               "<manufacture>,max6680"
+               "<manufacture>,max6681"
+               "<manufacture>,max6695"
+               "<manufacture>,max6696"
Quoted 1 line

SSDNow devices are required.

What's the SSDNow device? It seems the lm90.c doesn't support it.

Thanks.
Wei.

Quoted 1 line
author
#41 lore raw

Re: [PATCH v3 2/2] Documentation: dt: hwmon: add OF document for LM90

Quoted 30 lines · Wei Ni
Quoted 8 lines · Ramkumar Ramachandra

Documentation/devicetree/bindings/hwmon/lm90.txt

Quoted 5 lines · Wei Ni
Documentation/devicetree/bindings/hwmon/lm90.txt new file +0 -0
new file mode 100644
index 0000000..5570875

While at it, please update and rename ads1015.txt.

This series is for lm90 compatible devices, it seems ads1015 is not register-compatible with lm90.

Quoted 16 lines
Quoted 4 lines
Documentation/devicetree/bindings/hwmon/lm90.txt new file +2 -0
@@ -0,0 +1,44 @@
+* LM90 series thermometer.
+

Documentation/devicetree/bindings/hwmon/lm90.txt line 12

Quoted 10 lines
Documentation/devicetree/bindings/hwmon/lm90.txt new file +10 -0
+Required node properties:
+- compatible: manufacture and chip name, one of
+               "<manufacture>,adm1032"
+               "<manufacture>,adt7461"
+               "<manufacture>,adt7461a"
+               "<manufacture>,g781"
+               "<manufacture>,lm90"
+               "<manufacture>,lm86"
+               "<manufacture>,lm89"
+               "<manufacture>,lm99"

More versions of this of different ages are required.

Quoted 2 lines

In here, the chip names, such as "lm99", come from lm90.c id_table, the i2c subsystem want to use it to load driver, so we can add any other names.

Sorry, it's typo, it should be "can't add any other names".

Quoted 26 lines
Quoted 13 lines

Documentation/devicetree/bindings/hwmon/lm90.txt line 22

Quoted 12 lines
Documentation/devicetree/bindings/hwmon/lm90.txt new file +10 -0
+               "<manufacture>,max6646"
+               "<manufacture>,max6647"
+               "<manufacture>,max6649"
+               "<manufacture>,max6657"
+               "<manufacture>,max6658"
+               "<manufacture>,max6659"
+               "<manufacture>,max6680"
+               "<manufacture>,max6681"
+               "<manufacture>,max6695"
+               "<manufacture>,max6696"
Quoted 1 line

SSDNow devices are required.

What's the SSDNow device? It seems the lm90.c doesn't support it.

Thanks.
Wei.

Quoted 1 line

--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#42 lore raw

Re: [PATCH v3 2/2] Documentation: dt: hwmon: add OF document for LM90

In reply to Wei Ni
Quoted 9 lines · Wei Ni

Add OF document for LM90 in Documentation/devicetree/.

Documentation/devicetree/bindings/hwmon/lm90.txt +2 -0
 
+Optional properties:
 
+- interrupts: Contains a single interrupt specifier which

describes the + LM90 pin6 output.

Does the pin also have a standard name you could include here, rather than (or in addition to) just the pin number?

maintainer
#43 lore raw

Re: [PATCH v3 2/2] Documentation: dt: hwmon: add OF document for LM90

Quoted 6 lines · Stephen Warren
Quoted 4 lines · Wei Ni

Add OF document for LM90 in Documentation/devicetree/.

Documentation/devicetree/bindings/hwmon/lm90.txt +0 -0
Quoted 8 lines
Quoted 4 lines

+Optional properties:

+- interrupts: Contains a single interrupt specifier which
describes the +              LM90 pin6 output.

Does the pin also have a standard name you could include here, rather than (or in addition to) just the pin number?

This is the "ALERT" pin (or maybe "-ALERT" to reflect that it is low-active).

Guenter

author
#44 lore raw

Re: [PATCH v3 2/2] Documentation: dt: hwmon: add OF document for LM90

Quoted 9 lines · Guenter Roeck
Quoted 8 lines · Stephen Warren
Quoted 6 lines · Wei Ni

Add OF document for LM90 in Documentation/devicetree/.

Documentation/devicetree/bindings/hwmon/lm90.txt +1 -0
 
+Optional properties:
Quoted 7 lines
Quoted 6 lines
Quoted 2 lines
+- interrupts: Contains a single interrupt specifier which
describes the +              LM90 pin6 output.

Does the pin also have a standard name you could include here, rather than (or in addition to) just the pin number?

This is the "ALERT" pin (or maybe "-ALERT" to reflect that it is low-active).

Thanks, Guenter, I will update it.

Quoted 3 lines

Guenter