Message ID | 20240216102820.1395815-1-m.felsch@pengutronix.de |
---|---|
State | Superseded, archived |
Headers | show |
Series | [RESEND,1/2] dt-bindings: iio: ti,tmp117: add vcc supply binding | expand |
Context | Check | Description |
---|---|---|
robh/checkpatch | success | |
robh/patch-applied | success | |
robh/dtbs-check | warning | build log |
robh/dt-meta-schema | success |
On Fri, 16 Feb 2024 11:28:19 +0100 Marco Felsch <m.felsch@pengutronix.de> wrote: > From: Thomas Haemmerle <thomas.haemmerle@leica-geosystems.com> > > Add the binding to specify the vcc supply. We can't make it required > since this would break the backward compatibility. Given convention for supplies like this is to make them required in the dt-binding to reflect that providing power is not optional (unlikely some other supplies that might not be wired up) and not worry about the fact that we happily provide dummy supplies for them if they aren't in a particular dts, it should be fine to make it required here. Jonathan > > Signed-off-by: Thomas Haemmerle <thomas.haemmerle@leica-geosystems.com> > Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> > --- > Resend since I forgot to add the DT maintainers > > .../devicetree/bindings/iio/temperature/ti,tmp117.yaml | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/Documentation/devicetree/bindings/iio/temperature/ti,tmp117.yaml b/Documentation/devicetree/bindings/iio/temperature/ti,tmp117.yaml > index 8c6d7735e875..cf7799c9734f 100644 > --- a/Documentation/devicetree/bindings/iio/temperature/ti,tmp117.yaml > +++ b/Documentation/devicetree/bindings/iio/temperature/ti,tmp117.yaml > @@ -24,6 +24,9 @@ properties: > reg: > maxItems: 1 > > + vcc-supply: > + description: provide VCC power to the sensor. > + > required: > - compatible > - reg > @@ -39,5 +42,6 @@ examples: > tmp117@48 { > compatible = "ti,tmp117"; > reg = <0x48>; > + vcc-supply = <&pmic_reg_3v3>; > }; > };
On 24-02-16, Jonathan Cameron wrote: > On Fri, 16 Feb 2024 11:28:19 +0100 > Marco Felsch <m.felsch@pengutronix.de> wrote: > > > From: Thomas Haemmerle <thomas.haemmerle@leica-geosystems.com> > > > > Add the binding to specify the vcc supply. We can't make it required > > since this would break the backward compatibility. > > Given convention for supplies like this is to make them required in > the dt-binding to reflect that providing power is not optional (unlikely > some other supplies that might not be wired up) and not worry about the > fact that we happily provide dummy supplies for them if they aren't in a > particular dts, it should be fine to make it required here. Will this fact apply to all dt-bindings? I'm asking because, there are many bindings out there without having the -supply in place. Regards, Marco > > Jonathan > > > > > Signed-off-by: Thomas Haemmerle <thomas.haemmerle@leica-geosystems.com> > > Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> > > --- > > Resend since I forgot to add the DT maintainers > > > > .../devicetree/bindings/iio/temperature/ti,tmp117.yaml | 4 ++++ > > 1 file changed, 4 insertions(+) > > > > diff --git a/Documentation/devicetree/bindings/iio/temperature/ti,tmp117.yaml b/Documentation/devicetree/bindings/iio/temperature/ti,tmp117.yaml > > index 8c6d7735e875..cf7799c9734f 100644 > > --- a/Documentation/devicetree/bindings/iio/temperature/ti,tmp117.yaml > > +++ b/Documentation/devicetree/bindings/iio/temperature/ti,tmp117.yaml > > @@ -24,6 +24,9 @@ properties: > > reg: > > maxItems: 1 > > > > + vcc-supply: > > + description: provide VCC power to the sensor. > > + > > required: > > - compatible > > - reg > > @@ -39,5 +42,6 @@ examples: > > tmp117@48 { > > compatible = "ti,tmp117"; > > reg = <0x48>; > > + vcc-supply = <&pmic_reg_3v3>; > > }; > > }; > >
On Fri, 16 Feb 2024 11:28:20 +0100 Marco Felsch <m.felsch@pengutronix.de> wrote: > From: Thomas Haemmerle <thomas.haemmerle@leica-geosystems.com> > > Add support to specify the VCC supply which is required to power the > device. > > Signed-off-by: Thomas Haemmerle <thomas.haemmerle@leica-geosystems.com> > Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Hi. With power supply enables, the question that normally comes up is whether the device takes significant time to become available after the power is turned on. I had a look at the datasheet but couldn't find clear language on how long we need to wait before the device is usable following power up. There is a number for reset of 1.5 msecs so I guess we could use that safely? Maybe no delay is fine for reading the device ID. I've no idea. Sometimes we start with no delay and only end up adding one later when people report issues. We could do that here. Jonathan > --- > Resend since I forgot to add the DT maintainers > > drivers/iio/temperature/tmp117.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/drivers/iio/temperature/tmp117.c b/drivers/iio/temperature/tmp117.c > index 059953015ae7..69328066811a 100644 > --- a/drivers/iio/temperature/tmp117.c > +++ b/drivers/iio/temperature/tmp117.c > @@ -17,6 +17,7 @@ > #include <linux/kernel.h> > #include <linux/limits.h> > #include <linux/property.h> > +#include <linux/regulator/consumer.h> > > #include <linux/iio/iio.h> > > @@ -152,6 +153,10 @@ static int tmp117_probe(struct i2c_client *client) > if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_WORD_DATA)) > return -EOPNOTSUPP; > > + ret = devm_regulator_get_enable(&client->dev, "vcc"); > + if (ret) > + return ret; > + > dev_id = i2c_smbus_read_word_swapped(client, TMP117_REG_DEVICE_ID); > if (dev_id < 0) > return dev_id;
On 24-02-16, Jonathan Cameron wrote: > On Fri, 16 Feb 2024 11:28:20 +0100 > Marco Felsch <m.felsch@pengutronix.de> wrote: > > > From: Thomas Haemmerle <thomas.haemmerle@leica-geosystems.com> > > > > Add support to specify the VCC supply which is required to power the > > device. > > > > Signed-off-by: Thomas Haemmerle <thomas.haemmerle@leica-geosystems.com> > > Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> > > Hi. > > With power supply enables, the question that normally comes up is whether > the device takes significant time to become available after the power is > turned on. > > I had a look at the datasheet but couldn't find clear language on > how long we need to wait before the device is usable following power up. > There is a number for reset of 1.5 msecs so I guess we could use that > safely? You're right, section 7.3.1 Power Up mention the 1.5ms as well. I will add this albeit we didn't had issues with this patch in place for like months. > Maybe no delay is fine for reading the device ID. I've no idea. > Sometimes we start with no delay and only end up adding one later when > people report issues. We could do that here. Yes, I will add it and send a v2. Thanks, Marco > > Jonathan > > > --- > > Resend since I forgot to add the DT maintainers > > > > drivers/iio/temperature/tmp117.c | 5 +++++ > > 1 file changed, 5 insertions(+) > > > > diff --git a/drivers/iio/temperature/tmp117.c b/drivers/iio/temperature/tmp117.c > > index 059953015ae7..69328066811a 100644 > > --- a/drivers/iio/temperature/tmp117.c > > +++ b/drivers/iio/temperature/tmp117.c > > @@ -17,6 +17,7 @@ > > #include <linux/kernel.h> > > #include <linux/limits.h> > > #include <linux/property.h> > > +#include <linux/regulator/consumer.h> > > > > #include <linux/iio/iio.h> > > > > @@ -152,6 +153,10 @@ static int tmp117_probe(struct i2c_client *client) > > if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_WORD_DATA)) > > return -EOPNOTSUPP; > > > > + ret = devm_regulator_get_enable(&client->dev, "vcc"); > > + if (ret) > > + return ret; > > + > > dev_id = i2c_smbus_read_word_swapped(client, TMP117_REG_DEVICE_ID); > > if (dev_id < 0) > > return dev_id; > >
On Fri, 16 Feb 2024 12:23:48 +0100 Marco Felsch <m.felsch@pengutronix.de> wrote: > On 24-02-16, Jonathan Cameron wrote: > > On Fri, 16 Feb 2024 11:28:19 +0100 > > Marco Felsch <m.felsch@pengutronix.de> wrote: > > > > > From: Thomas Haemmerle <thomas.haemmerle@leica-geosystems.com> > > > > > > Add the binding to specify the vcc supply. We can't make it required > > > since this would break the backward compatibility. > > > > Given convention for supplies like this is to make them required in > > the dt-binding to reflect that providing power is not optional (unlikely > > some other supplies that might not be wired up) and not worry about the > > fact that we happily provide dummy supplies for them if they aren't in a > > particular dts, it should be fine to make it required here. > > Will this fact apply to all dt-bindings? I'm asking because, there are > many bindings out there without having the -supply in place. Yes in theory - in practice it's noise to do it unless we have a reason to be touching the dt-binding anyway. I don't plan to fix them up on mass. Jonathan > > Regards, > Marco > > > > > Jonathan > > > > > > > > Signed-off-by: Thomas Haemmerle <thomas.haemmerle@leica-geosystems.com> > > > Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> > > > --- > > > Resend since I forgot to add the DT maintainers > > > > > > .../devicetree/bindings/iio/temperature/ti,tmp117.yaml | 4 ++++ > > > 1 file changed, 4 insertions(+) > > > > > > diff --git a/Documentation/devicetree/bindings/iio/temperature/ti,tmp117.yaml b/Documentation/devicetree/bindings/iio/temperature/ti,tmp117.yaml > > > index 8c6d7735e875..cf7799c9734f 100644 > > > --- a/Documentation/devicetree/bindings/iio/temperature/ti,tmp117.yaml > > > +++ b/Documentation/devicetree/bindings/iio/temperature/ti,tmp117.yaml > > > @@ -24,6 +24,9 @@ properties: > > > reg: > > > maxItems: 1 > > > > > > + vcc-supply: > > > + description: provide VCC power to the sensor. > > > + > > > required: > > > - compatible > > > - reg > > > @@ -39,5 +42,6 @@ examples: > > > tmp117@48 { > > > compatible = "ti,tmp117"; > > > reg = <0x48>; > > > + vcc-supply = <&pmic_reg_3v3>; > > > }; > > > }; > > > >
On Fri, Feb 16, 2024 at 11:21:20AM +0000, Jonathan Cameron wrote: > On Fri, 16 Feb 2024 11:28:19 +0100 > Marco Felsch <m.felsch@pengutronix.de> wrote: > > > From: Thomas Haemmerle <thomas.haemmerle@leica-geosystems.com> > > > > Add the binding to specify the vcc supply. We can't make it required > > since this would break the backward compatibility. > > Given convention for supplies like this is to make them required in > the dt-binding to reflect that providing power is not optional (unlikely > some other supplies that might not be wired up) and not worry about the > fact that we happily provide dummy supplies for them if they aren't in a > particular dts, it should be fine to make it required here. With the suggested change, Reviewed-by: Conor Dooley <conor.dooley@microchip.com> Cheers, Conor.
diff --git a/Documentation/devicetree/bindings/iio/temperature/ti,tmp117.yaml b/Documentation/devicetree/bindings/iio/temperature/ti,tmp117.yaml index 8c6d7735e875..cf7799c9734f 100644 --- a/Documentation/devicetree/bindings/iio/temperature/ti,tmp117.yaml +++ b/Documentation/devicetree/bindings/iio/temperature/ti,tmp117.yaml @@ -24,6 +24,9 @@ properties: reg: maxItems: 1 + vcc-supply: + description: provide VCC power to the sensor. + required: - compatible - reg @@ -39,5 +42,6 @@ examples: tmp117@48 { compatible = "ti,tmp117"; reg = <0x48>; + vcc-supply = <&pmic_reg_3v3>; }; };