All of lore.kernel.org
 help / color / mirror / Atom feed
* [v2 1/2] dt-bindings: add extended-range-enable property to lm90.yaml
@ 2022-05-10  8:08 Holger Brunck
  2022-05-10  8:09 ` [v2 2/2] driver/hwmon/lm90: enable extended range according to DTS node Holger Brunck
  2022-05-11 15:32 ` [v2 1/2] dt-bindings: add extended-range-enable property to lm90.yaml Krzysztof Kozlowski
  0 siblings, 2 replies; 14+ messages in thread
From: Holger Brunck @ 2022-05-10  8:08 UTC (permalink / raw)
  To: linux-hwmon
  Cc: Holger Brunck, Jean Delvare, Guenter Roeck, Rob Herring,
	Krzysztof Kozlowski

Some devices can operate in an extended temperature mode.
Therefore add a boolean onsemi,extended-range-enable to be able to
select this feature in the device tree node.

Signed-off-by: Holger Brunck <holger.brunck@hitachienergy.com>
cc: Jean Delvare <jdelvare@suse.com>
cc: Guenter Roeck <linux@roeck-us.net>
cc: Rob Herring <robh+dt@kernel.org>
cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>
---
 Documentation/devicetree/bindings/hwmon/national,lm90.yaml | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Documentation/devicetree/bindings/hwmon/national,lm90.yaml b/Documentation/devicetree/bindings/hwmon/national,lm90.yaml
index 30db92977937..92afa01380eb 100644
--- a/Documentation/devicetree/bindings/hwmon/national,lm90.yaml
+++ b/Documentation/devicetree/bindings/hwmon/national,lm90.yaml
@@ -52,6 +52,10 @@ properties:
   vcc-supply:
     description: phandle to the regulator that provides the +VCC supply
 
+  onsemi,extended-range-enable:
+    description: Set to enable extended range temperature.
+    type: boolean
+
 required:
   - compatible
   - reg
-- 
2.35.1.871.gab1f276


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [v2 2/2] driver/hwmon/lm90: enable extended range according to DTS node
  2022-05-10  8:08 [v2 1/2] dt-bindings: add extended-range-enable property to lm90.yaml Holger Brunck
@ 2022-05-10  8:09 ` Holger Brunck
  2022-05-11  1:37   ` Guenter Roeck
  2022-05-11 15:32 ` [v2 1/2] dt-bindings: add extended-range-enable property to lm90.yaml Krzysztof Kozlowski
  1 sibling, 1 reply; 14+ messages in thread
From: Holger Brunck @ 2022-05-10  8:09 UTC (permalink / raw)
  To: linux-hwmon; +Cc: Holger Brunck, Jean Delvare, Guenter Roeck

Some lm90 devices can operate in a extended temperature mode, this feature
is now eanbled if the property is set in the corresponding device tree
node.

Signed-off-by: Holger Brunck <holger.brunck@hitachienergy.com>
cc: Jean Delvare <jdelvare@suse.com>
cc: Guenter Roeck <linux@roeck-us.net>
---
 drivers/hwmon/lm90.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c
index 1c9493c70813..6cdbcfab9f20 100644
--- a/drivers/hwmon/lm90.c
+++ b/drivers/hwmon/lm90.c
@@ -1707,6 +1707,7 @@ static void lm90_restore_conf(void *_data)
 
 static int lm90_init_client(struct i2c_client *client, struct lm90_data *data)
 {
+	struct device_node *np = client->dev.of_node;
 	int config, convrate;
 
 	convrate = lm90_read_reg(client, LM90_REG_R_CONVRATE);
@@ -1727,7 +1728,8 @@ static int lm90_init_client(struct i2c_client *client, struct lm90_data *data)
 
 	/* Check Temperature Range Select */
 	if (data->flags & LM90_HAVE_EXTENDED_TEMP) {
-		if (config & 0x04)
+		if (config & 0x04 ||
+		    of_property_read_bool(np, "onsemi,extended-range-enable"))
 			data->flags |= LM90_FLAG_ADT7461_EXT;
 	}
 
-- 
2.35.1.871.gab1f276


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [v2 2/2] driver/hwmon/lm90: enable extended range according to DTS node
  2022-05-10  8:09 ` [v2 2/2] driver/hwmon/lm90: enable extended range according to DTS node Holger Brunck
@ 2022-05-11  1:37   ` Guenter Roeck
  2022-05-11 13:50     ` Holger Brunck
  2022-05-16 20:01     ` Holger Brunck
  0 siblings, 2 replies; 14+ messages in thread
From: Guenter Roeck @ 2022-05-11  1:37 UTC (permalink / raw)
  To: Holger Brunck, linux-hwmon; +Cc: Jean Delvare

Hi,

On 5/10/22 01:09, Holger Brunck wrote:
> Some lm90 devices can operate in a extended temperature mode, this feature

lm90 compatible ... mode. This ...

> is now eanbled if the property is set in the corresponding device tree

enabled

> node.
> 
> Signed-off-by: Holger Brunck <holger.brunck@hitachienergy.com>
> cc: Jean Delvare <jdelvare@suse.com>
> cc: Guenter Roeck <linux@roeck-us.net>

Cc: isn't really necessary or useful to list maintainers; You might want to
use the --cc option of git send-email instead. Also, if used, it should
be "Cc:".

For the subject, please use "hwmon: (lm90) ...".

> ---
>   drivers/hwmon/lm90.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c
> index 1c9493c70813..6cdbcfab9f20 100644
> --- a/drivers/hwmon/lm90.c
> +++ b/drivers/hwmon/lm90.c
> @@ -1707,6 +1707,7 @@ static void lm90_restore_conf(void *_data)
>   
>   static int lm90_init_client(struct i2c_client *client, struct lm90_data *data)
>   {
> +	struct device_node *np = client->dev.of_node;
>   	int config, convrate;
>   
>   	convrate = lm90_read_reg(client, LM90_REG_R_CONVRATE);
> @@ -1727,7 +1728,8 @@ static int lm90_init_client(struct i2c_client *client, struct lm90_data *data)
>   
>   	/* Check Temperature Range Select */
>   	if (data->flags & LM90_HAVE_EXTENDED_TEMP) {
> -		if (config & 0x04)
> +		if (config & 0x04 ||
> +		    of_property_read_bool(np, "onsemi,extended-range-enable"))
>   			data->flags |= LM90_FLAG_ADT7461_EXT;

Maybe I am missing something, but I don't see the matching configuration
change. Specifying the flag in devicetree only really makes sense if the
chip configuration is changed accordingly.

Guenter

^ permalink raw reply	[flat|nested] 14+ messages in thread

* RE: [v2 2/2] driver/hwmon/lm90: enable extended range according to DTS node
  2022-05-11  1:37   ` Guenter Roeck
@ 2022-05-11 13:50     ` Holger Brunck
  2022-05-16 20:01     ` Holger Brunck
  1 sibling, 0 replies; 14+ messages in thread
From: Holger Brunck @ 2022-05-11 13:50 UTC (permalink / raw)
  To: Guenter Roeck, linux-hwmon; +Cc: Jean Delvare

> On 5/10/22 01:09, Holger Brunck wrote:
> > Some lm90 devices can operate in a extended temperature mode, this
> > feature
> 
> lm90 compatible ... mode. This ...
> 
> > is now eanbled if the property is set in the corresponding device tree
> 
> enabled
> 

ok.

> > node.
> >
> > Signed-off-by: Holger Brunck <holger.brunck@hitachienergy.com>
> > cc: Jean Delvare <jdelvare@suse.com>
> > cc: Guenter Roeck <linux@roeck-us.net>
> 
> Cc: isn't really necessary or useful to list maintainers; You might want to use
> the --cc option of git send-email instead. Also, if used, it should be "Cc:".
> 

ok.

> For the subject, please use "hwmon: (lm90) ...".
> 

ok, will change that.

> > ---
> >   drivers/hwmon/lm90.c | 4 +++-
> >   1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c index
> > 1c9493c70813..6cdbcfab9f20 100644
> > --- a/drivers/hwmon/lm90.c
> > +++ b/drivers/hwmon/lm90.c
> > @@ -1707,6 +1707,7 @@ static void lm90_restore_conf(void *_data)
> >
> >   static int lm90_init_client(struct i2c_client *client, struct lm90_data *data)
> >   {
> > +     struct device_node *np = client->dev.of_node;
> >       int config, convrate;
> >
> >       convrate = lm90_read_reg(client, LM90_REG_R_CONVRATE); @@
> > -1727,7 +1728,8 @@ static int lm90_init_client(struct i2c_client
> > *client, struct lm90_data *data)
> >
> >       /* Check Temperature Range Select */
> >       if (data->flags & LM90_HAVE_EXTENDED_TEMP) {
> > -             if (config & 0x04)
> > +             if (config & 0x04 ||
> > +                 of_property_read_bool(np,
> > + "onsemi,extended-range-enable"))
> >                       data->flags |= LM90_FLAG_ADT7461_EXT;
> 
> Maybe I am missing something, but I don't see the matching configuration
> change. Specifying the flag in devicetree only really makes sense if the chip
> configuration is changed accordingly.
> 

oops you are absolutely right I missed that. I didn't saw this in my test as
the config was still present from the previous run with my old kernel were 
this was hard coded and the config survived after warm start.

Best regards
Holger

 

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [v2 1/2] dt-bindings: add extended-range-enable property to lm90.yaml
  2022-05-10  8:08 [v2 1/2] dt-bindings: add extended-range-enable property to lm90.yaml Holger Brunck
  2022-05-10  8:09 ` [v2 2/2] driver/hwmon/lm90: enable extended range according to DTS node Holger Brunck
@ 2022-05-11 15:32 ` Krzysztof Kozlowski
  2022-05-11 17:00   ` Guenter Roeck
  1 sibling, 1 reply; 14+ messages in thread
From: Krzysztof Kozlowski @ 2022-05-11 15:32 UTC (permalink / raw)
  To: Holger Brunck, linux-hwmon
  Cc: Jean Delvare, Guenter Roeck, Rob Herring, Krzysztof Kozlowski

On 10/05/2022 10:08, Holger Brunck wrote:
> Some devices can operate in an extended temperature mode.
> Therefore add a boolean onsemi,extended-range-enable to be able to
> select this feature in the device tree node.
> 
> Signed-off-by: Holger Brunck <holger.brunck@hitachienergy.com>
> cc: Jean Delvare <jdelvare@suse.com>
> cc: Guenter Roeck <linux@roeck-us.net>
> cc: Rob Herring <robh+dt@kernel.org>
> cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>
> ---
>  Documentation/devicetree/bindings/hwmon/national,lm90.yaml | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/hwmon/national,lm90.yaml b/Documentation/devicetree/bindings/hwmon/national,lm90.yaml
> index 30db92977937..92afa01380eb 100644
> --- a/Documentation/devicetree/bindings/hwmon/national,lm90.yaml
> +++ b/Documentation/devicetree/bindings/hwmon/national,lm90.yaml
> @@ -52,6 +52,10 @@ properties:
>    vcc-supply:
>      description: phandle to the regulator that provides the +VCC supply
>  
> +  onsemi,extended-range-enable:
> +    description: Set to enable extended range temperature.
> +    type: boolean
>

There is no such vendor and it does not match the existing vendor for
these bindings (nor the current owner of National). Was there some
change? What is onsemi?

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [v2 1/2] dt-bindings: add extended-range-enable property to lm90.yaml
  2022-05-11 15:32 ` [v2 1/2] dt-bindings: add extended-range-enable property to lm90.yaml Krzysztof Kozlowski
@ 2022-05-11 17:00   ` Guenter Roeck
  2022-05-11 17:21     ` Krzysztof Kozlowski
  0 siblings, 1 reply; 14+ messages in thread
From: Guenter Roeck @ 2022-05-11 17:00 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Holger Brunck, linux-hwmon
  Cc: Jean Delvare, Rob Herring, Krzysztof Kozlowski

On 5/11/22 08:32, Krzysztof Kozlowski wrote:
> On 10/05/2022 10:08, Holger Brunck wrote:
>> Some devices can operate in an extended temperature mode.
>> Therefore add a boolean onsemi,extended-range-enable to be able to
>> select this feature in the device tree node.
>>
>> Signed-off-by: Holger Brunck <holger.brunck@hitachienergy.com>
>> cc: Jean Delvare <jdelvare@suse.com>
>> cc: Guenter Roeck <linux@roeck-us.net>
>> cc: Rob Herring <robh+dt@kernel.org>
>> cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>
>> ---
>>   Documentation/devicetree/bindings/hwmon/national,lm90.yaml | 4 ++++
>>   1 file changed, 4 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/hwmon/national,lm90.yaml b/Documentation/devicetree/bindings/hwmon/national,lm90.yaml
>> index 30db92977937..92afa01380eb 100644
>> --- a/Documentation/devicetree/bindings/hwmon/national,lm90.yaml
>> +++ b/Documentation/devicetree/bindings/hwmon/national,lm90.yaml
>> @@ -52,6 +52,10 @@ properties:
>>     vcc-supply:
>>       description: phandle to the regulator that provides the +VCC supply
>>   
>> +  onsemi,extended-range-enable:
>> +    description: Set to enable extended range temperature.
>> +    type: boolean
>>
> 
> There is no such vendor and it does not match the existing vendor for
> these bindings (nor the current owner of National). Was there some
> change? What is onsemi?
> 
My bad, I should have looked up official prefixes before suggesting onsemi
as an option. That should have been "onnn".

It should be either onnn (for adt7461/adt7461a) or ti for tmp451
and tmp461. adi instead of onnn may make sense since that is already
used in the driver. I personally don't have a preference.

Guenter

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [v2 1/2] dt-bindings: add extended-range-enable property to lm90.yaml
  2022-05-11 17:00   ` Guenter Roeck
@ 2022-05-11 17:21     ` Krzysztof Kozlowski
  2022-05-11 17:40       ` Guenter Roeck
  0 siblings, 1 reply; 14+ messages in thread
From: Krzysztof Kozlowski @ 2022-05-11 17:21 UTC (permalink / raw)
  To: Guenter Roeck, Holger Brunck, linux-hwmon
  Cc: Jean Delvare, Rob Herring, Krzysztof Kozlowski

On 11/05/2022 19:00, Guenter Roeck wrote:
> On 5/11/22 08:32, Krzysztof Kozlowski wrote:
>> On 10/05/2022 10:08, Holger Brunck wrote:
>>> Some devices can operate in an extended temperature mode.
>>> Therefore add a boolean onsemi,extended-range-enable to be able to
>>> select this feature in the device tree node.
>>>
>>> Signed-off-by: Holger Brunck <holger.brunck@hitachienergy.com>
>>> cc: Jean Delvare <jdelvare@suse.com>
>>> cc: Guenter Roeck <linux@roeck-us.net>
>>> cc: Rob Herring <robh+dt@kernel.org>
>>> cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>
>>> ---
>>>   Documentation/devicetree/bindings/hwmon/national,lm90.yaml | 4 ++++
>>>   1 file changed, 4 insertions(+)
>>>
>>> diff --git a/Documentation/devicetree/bindings/hwmon/national,lm90.yaml b/Documentation/devicetree/bindings/hwmon/national,lm90.yaml
>>> index 30db92977937..92afa01380eb 100644
>>> --- a/Documentation/devicetree/bindings/hwmon/national,lm90.yaml
>>> +++ b/Documentation/devicetree/bindings/hwmon/national,lm90.yaml
>>> @@ -52,6 +52,10 @@ properties:
>>>     vcc-supply:
>>>       description: phandle to the regulator that provides the +VCC supply
>>>   
>>> +  onsemi,extended-range-enable:
>>> +    description: Set to enable extended range temperature.
>>> +    type: boolean
>>>
>>
>> There is no such vendor and it does not match the existing vendor for
>> these bindings (nor the current owner of National). Was there some
>> change? What is onsemi?
>>
> My bad, I should have looked up official prefixes before suggesting onsemi
> as an option. That should have been "onnn".
> 
> It should be either onnn (for adt7461/adt7461a) or ti for tmp451
> and tmp461. adi instead of onnn may make sense since that is already
> used in the driver. I personally don't have a preference.

Me neither. Just pick one matching the device actually using this
property. If all of them are using it, how about keeping old "national"
or it's owner "ti"? If not all of them are using it, then this would
need "allOf:if:then" restricting where the property is (not) applicable.


Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [v2 1/2] dt-bindings: add extended-range-enable property to lm90.yaml
  2022-05-11 17:21     ` Krzysztof Kozlowski
@ 2022-05-11 17:40       ` Guenter Roeck
  2022-05-11 17:55         ` Krzysztof Kozlowski
  0 siblings, 1 reply; 14+ messages in thread
From: Guenter Roeck @ 2022-05-11 17:40 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Holger Brunck, linux-hwmon
  Cc: Jean Delvare, Rob Herring, Krzysztof Kozlowski

On 5/11/22 10:21, Krzysztof Kozlowski wrote:
> On 11/05/2022 19:00, Guenter Roeck wrote:
>> On 5/11/22 08:32, Krzysztof Kozlowski wrote:
>>> On 10/05/2022 10:08, Holger Brunck wrote:
>>>> Some devices can operate in an extended temperature mode.
>>>> Therefore add a boolean onsemi,extended-range-enable to be able to
>>>> select this feature in the device tree node.
>>>>
>>>> Signed-off-by: Holger Brunck <holger.brunck@hitachienergy.com>
>>>> cc: Jean Delvare <jdelvare@suse.com>
>>>> cc: Guenter Roeck <linux@roeck-us.net>
>>>> cc: Rob Herring <robh+dt@kernel.org>
>>>> cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>
>>>> ---
>>>>    Documentation/devicetree/bindings/hwmon/national,lm90.yaml | 4 ++++
>>>>    1 file changed, 4 insertions(+)
>>>>
>>>> diff --git a/Documentation/devicetree/bindings/hwmon/national,lm90.yaml b/Documentation/devicetree/bindings/hwmon/national,lm90.yaml
>>>> index 30db92977937..92afa01380eb 100644
>>>> --- a/Documentation/devicetree/bindings/hwmon/national,lm90.yaml
>>>> +++ b/Documentation/devicetree/bindings/hwmon/national,lm90.yaml
>>>> @@ -52,6 +52,10 @@ properties:
>>>>      vcc-supply:
>>>>        description: phandle to the regulator that provides the +VCC supply
>>>>    
>>>> +  onsemi,extended-range-enable:
>>>> +    description: Set to enable extended range temperature.
>>>> +    type: boolean
>>>>
>>>
>>> There is no such vendor and it does not match the existing vendor for
>>> these bindings (nor the current owner of National). Was there some
>>> change? What is onsemi?
>>>
>> My bad, I should have looked up official prefixes before suggesting onsemi
>> as an option. That should have been "onnn".
>>
>> It should be either onnn (for adt7461/adt7461a) or ti for tmp451
>> and tmp461. adi instead of onnn may make sense since that is already
>> used in the driver. I personally don't have a preference.
> 
> Me neither. Just pick one matching the device actually using this
> property. If all of them are using it, how about keeping old "national"
> or it's owner "ti"? If not all of them are using it, then this would
> need "allOf:if:then" restricting where the property is (not) applicable.
> 

It is only applicable for tmp451, tmp461, and adt7461[a], so it looks
like "allOf:if:then" will be needed. Note that none of those chips are
or have ever been owned by National. Given that, maybe ti would be most
appropriate ?

Thanks,
Guenter

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [v2 1/2] dt-bindings: add extended-range-enable property to lm90.yaml
  2022-05-11 17:40       ` Guenter Roeck
@ 2022-05-11 17:55         ` Krzysztof Kozlowski
  2022-05-16  9:15           ` Holger Brunck
  0 siblings, 1 reply; 14+ messages in thread
From: Krzysztof Kozlowski @ 2022-05-11 17:55 UTC (permalink / raw)
  To: Guenter Roeck, Holger Brunck, linux-hwmon
  Cc: Jean Delvare, Rob Herring, Krzysztof Kozlowski

On 11/05/2022 19:40, Guenter Roeck wrote:
>> Me neither. Just pick one matching the device actually using this
>> property. If all of them are using it, how about keeping old "national"
>> or it's owner "ti"? If not all of them are using it, then this would
>> need "allOf:if:then" restricting where the property is (not) applicable.
>>
> 
> It is only applicable for tmp451, tmp461, and adt7461[a], so it looks
> like "allOf:if:then" will be needed. 

Yes, please.

> Note that none of those chips are
> or have ever been owned by National. Given that, maybe ti would be most
> appropriate ?

Sure.


Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 14+ messages in thread

* RE: [v2 1/2] dt-bindings: add extended-range-enable property to lm90.yaml
  2022-05-11 17:55         ` Krzysztof Kozlowski
@ 2022-05-16  9:15           ` Holger Brunck
  2022-05-16  9:23             ` Krzysztof Kozlowski
  0 siblings, 1 reply; 14+ messages in thread
From: Holger Brunck @ 2022-05-16  9:15 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Guenter Roeck, linux-hwmon
  Cc: Jean Delvare, Rob Herring, Krzysztof Kozlowski

> On 11/05/2022 19:40, Guenter Roeck wrote:
> >> Me neither. Just pick one matching the device actually using this
> >> property. If all of them are using it, how about keeping old "national"
> >> or it's owner "ti"? If not all of them are using it, then this would
> >> need "allOf:if:then" restricting where the property is (not) applicable.
> >>
> >
> > It is only applicable for tmp451, tmp461, and adt7461[a], so it looks
> > like "allOf:if:then" will be needed.
> 
> Yes, please.
> 

ok I will have a look.

I noticed that tmp461 is missing at all in the yaml file, so this needs to be
added too. Should this go into a separate patch?

> > Note that none of those chips are
> > or have ever been owned by National. Given that, maybe ti would be
> > most appropriate ?
> 
> Sure.
> 

ok.

Best regards
Holger


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [v2 1/2] dt-bindings: add extended-range-enable property to lm90.yaml
  2022-05-16  9:15           ` Holger Brunck
@ 2022-05-16  9:23             ` Krzysztof Kozlowski
  0 siblings, 0 replies; 14+ messages in thread
From: Krzysztof Kozlowski @ 2022-05-16  9:23 UTC (permalink / raw)
  To: Holger Brunck, Guenter Roeck, linux-hwmon
  Cc: Jean Delvare, Rob Herring, Krzysztof Kozlowski

On 16/05/2022 11:15, Holger Brunck wrote:
>> On 11/05/2022 19:40, Guenter Roeck wrote:
>>>> Me neither. Just pick one matching the device actually using this
>>>> property. If all of them are using it, how about keeping old "national"
>>>> or it's owner "ti"? If not all of them are using it, then this would
>>>> need "allOf:if:then" restricting where the property is (not) applicable.
>>>>
>>>
>>> It is only applicable for tmp451, tmp461, and adt7461[a], so it looks
>>> like "allOf:if:then" will be needed.
>>
>> Yes, please.
>>
> 
> ok I will have a look.
> 
> I noticed that tmp461 is missing at all in the yaml file, so this needs to be
> added too. Should this go into a separate patch?

That one was about adding extended range, so yes - adding more
compatibles or other features should be in separate patches.


Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 14+ messages in thread

* RE: [v2 2/2] driver/hwmon/lm90: enable extended range according to DTS node
  2022-05-11  1:37   ` Guenter Roeck
  2022-05-11 13:50     ` Holger Brunck
@ 2022-05-16 20:01     ` Holger Brunck
  2022-05-16 20:31       ` Guenter Roeck
  1 sibling, 1 reply; 14+ messages in thread
From: Holger Brunck @ 2022-05-16 20:01 UTC (permalink / raw)
  To: Guenter Roeck, linux-hwmon; +Cc: Jean Delvare

> > diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c index
> > 1c9493c70813..6cdbcfab9f20 100644
> > --- a/drivers/hwmon/lm90.c
> > +++ b/drivers/hwmon/lm90.c
> > @@ -1707,6 +1707,7 @@ static void lm90_restore_conf(void *_data)
> >
> >   static int lm90_init_client(struct i2c_client *client, struct lm90_data *data)
> >   {
> > +     struct device_node *np = client->dev.of_node;
> >       int config, convrate;
> >
> >       convrate = lm90_read_reg(client, LM90_REG_R_CONVRATE); @@
> > -1727,7 +1728,8 @@ static int lm90_init_client(struct i2c_client
> > *client, struct lm90_data *data)
> >
> >       /* Check Temperature Range Select */
> >       if (data->flags & LM90_HAVE_EXTENDED_TEMP) {
> > -             if (config & 0x04)
> > +             if (config & 0x04 ||
> > +                 of_property_read_bool(np,
> > + "onsemi,extended-range-enable"))
> >                       data->flags |= LM90_FLAG_ADT7461_EXT;
> 
> Maybe I am missing something, but I don't see the matching configuration
> change. Specifying the flag in devicetree only really makes sense if the chip
> configuration is changed accordingly.
> 

what is confusing here for me is that in the current code we have
"if (config & 0x4)" and if this is true we configure the flags accordingly. But
the bit 0x4 in config is nowhere set in current code. Therefore also the flag is
never set. Or do I miss something? 

I am asking because if my assumption is correct I would replace the current
(never matching) check to the new property:
if (of_property_read_bool(np, "ti,extended-range-enable")) {
  config |= 0x4;
  data->flags |= LM90_FLAG_ADT7461_EXT;
}

Is this ok for you?

Best regards
Holger


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [v2 2/2] driver/hwmon/lm90: enable extended range according to DTS node
  2022-05-16 20:01     ` Holger Brunck
@ 2022-05-16 20:31       ` Guenter Roeck
  2022-05-17  6:27         ` Holger Brunck
  0 siblings, 1 reply; 14+ messages in thread
From: Guenter Roeck @ 2022-05-16 20:31 UTC (permalink / raw)
  To: Holger Brunck; +Cc: linux-hwmon, Jean Delvare

On Mon, May 16, 2022 at 08:01:34PM +0000, Holger Brunck wrote:
> > > diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c index
> > > 1c9493c70813..6cdbcfab9f20 100644
> > > --- a/drivers/hwmon/lm90.c
> > > +++ b/drivers/hwmon/lm90.c
> > > @@ -1707,6 +1707,7 @@ static void lm90_restore_conf(void *_data)
> > >
> > >   static int lm90_init_client(struct i2c_client *client, struct lm90_data *data)
> > >   {
> > > +     struct device_node *np = client->dev.of_node;
> > >       int config, convrate;
> > >
> > >       convrate = lm90_read_reg(client, LM90_REG_R_CONVRATE); @@
> > > -1727,7 +1728,8 @@ static int lm90_init_client(struct i2c_client
> > > *client, struct lm90_data *data)
> > >
> > >       /* Check Temperature Range Select */
> > >       if (data->flags & LM90_HAVE_EXTENDED_TEMP) {
> > > -             if (config & 0x04)
> > > +             if (config & 0x04 ||
> > > +                 of_property_read_bool(np,
> > > + "onsemi,extended-range-enable"))
> > >                       data->flags |= LM90_FLAG_ADT7461_EXT;
> > 
> > Maybe I am missing something, but I don't see the matching configuration
> > change. Specifying the flag in devicetree only really makes sense if the chip
> > configuration is changed accordingly.
> > 
> 
> what is confusing here for me is that in the current code we have
> "if (config & 0x4)" and if this is true we configure the flags accordingly. But
> the bit 0x4 in config is nowhere set in current code. Therefore also the flag is
> never set. Or do I miss something? 
> 
The idea is to pick up the configuration set by the BIOS/ROMMON.

> I am asking because if my assumption is correct I would replace the current
> (never matching) check to the new property:

It does match, if set by the BIOS.

> if (of_property_read_bool(np, "ti,extended-range-enable")) {
>   config |= 0x4;
>   data->flags |= LM90_FLAG_ADT7461_EXT;
> }
> 
> Is this ok for you?
> 
Looks ok at first glance, though of course I'll have to see the entire
patch.

Thanks,
Guenter

> Best regards
> Holger
> 

^ permalink raw reply	[flat|nested] 14+ messages in thread

* RE: [v2 2/2] driver/hwmon/lm90: enable extended range according to DTS node
  2022-05-16 20:31       ` Guenter Roeck
@ 2022-05-17  6:27         ` Holger Brunck
  0 siblings, 0 replies; 14+ messages in thread
From: Holger Brunck @ 2022-05-17  6:27 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: linux-hwmon, Jean Delvare

> On Mon, May 16, 2022 at 08:01:34PM +0000, Holger Brunck wrote:
> > > > diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c index
> > > > 1c9493c70813..6cdbcfab9f20 100644
> > > > --- a/drivers/hwmon/lm90.c
> > > > +++ b/drivers/hwmon/lm90.c
> > > > @@ -1707,6 +1707,7 @@ static void lm90_restore_conf(void *_data)
> > > >
> > > >   static int lm90_init_client(struct i2c_client *client, struct lm90_data
> *data)
> > > >   {
> > > > +     struct device_node *np = client->dev.of_node;
> > > >       int config, convrate;
> > > >
> > > >       convrate = lm90_read_reg(client, LM90_REG_R_CONVRATE); @@
> > > > -1727,7 +1728,8 @@ static int lm90_init_client(struct i2c_client
> > > > *client, struct lm90_data *data)
> > > >
> > > >       /* Check Temperature Range Select */
> > > >       if (data->flags & LM90_HAVE_EXTENDED_TEMP) {
> > > > -             if (config & 0x04)
> > > > +             if (config & 0x04 ||
> > > > +                 of_property_read_bool(np,
> > > > + "onsemi,extended-range-enable"))
> > > >                       data->flags |= LM90_FLAG_ADT7461_EXT;
> > >
> > > Maybe I am missing something, but I don't see the matching
> > > configuration change. Specifying the flag in devicetree only really
> > > makes sense if the chip configuration is changed accordingly.
> > >
> >
> > what is confusing here for me is that in the current code we have "if
> > (config & 0x4)" and if this is true we configure the flags
> > accordingly. But the bit 0x4 in config is nowhere set in current code.
> > Therefore also the flag is never set. Or do I miss something?
> >
> The idea is to pick up the configuration set by the BIOS/ROMMON.
> 

ok.
 
> > I am asking because if my assumption is correct I would replace the
> > current (never matching) check to the new property:
> 
> It does match, if set by the BIOS.
> 

ok thanks.

> > if (of_property_read_bool(np, "ti,extended-range-enable")) {
> >   config |= 0x4;
> >   data->flags |= LM90_FLAG_ADT7461_EXT; }
> >
> > Is this ok for you?
> >
> Looks ok at first glance, though of course I'll have to see the entire patch.
> 

sure, but I need to change it as now the use case that config bit 0x4 is set even
if the property is not set by DTS need to be covered as before. But anyhow, lets
discuss on the update then.

Best regards
Holger


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2022-05-17  6:27 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-10  8:08 [v2 1/2] dt-bindings: add extended-range-enable property to lm90.yaml Holger Brunck
2022-05-10  8:09 ` [v2 2/2] driver/hwmon/lm90: enable extended range according to DTS node Holger Brunck
2022-05-11  1:37   ` Guenter Roeck
2022-05-11 13:50     ` Holger Brunck
2022-05-16 20:01     ` Holger Brunck
2022-05-16 20:31       ` Guenter Roeck
2022-05-17  6:27         ` Holger Brunck
2022-05-11 15:32 ` [v2 1/2] dt-bindings: add extended-range-enable property to lm90.yaml Krzysztof Kozlowski
2022-05-11 17:00   ` Guenter Roeck
2022-05-11 17:21     ` Krzysztof Kozlowski
2022-05-11 17:40       ` Guenter Roeck
2022-05-11 17:55         ` Krzysztof Kozlowski
2022-05-16  9:15           ` Holger Brunck
2022-05-16  9:23             ` Krzysztof Kozlowski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.