diff mbox series

[v3,3/3] hwmon: (lm90) enable extended range according to DTS node

Message ID 20220517075738.16885-1-holger.brunck@hitachienergy.com (mailing list archive)
State Superseded
Headers show
Series [v3,1/3] dt-bindings: hwmon: lm90: add missing ti,tmp461 | expand

Commit Message

Holger Brunck May 17, 2022, 7:57 a.m. UTC
Some lm90 compatible devices can operate in a extended temperature mode.
This feature is now enabled if the property is set in the corresponding
device tree node.

Signed-off-by: Holger Brunck <holger.brunck@hitachienergy.com>
---
changes for v3:
  - set config bit is property is set in DTS
  - rephrase commit msg
  - rename property

 drivers/hwmon/lm90.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Guenter Roeck May 17, 2022, 12:54 p.m. UTC | #1
On Tue, May 17, 2022 at 09:57:38AM +0200, Holger Brunck wrote:
> Some lm90 compatible devices can operate in a extended temperature mode.
> This feature is now enabled if the property is set in the corresponding
> device tree node.
> 
> Signed-off-by: Holger Brunck <holger.brunck@hitachienergy.com>

For my reference:

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

> ---
> changes for v3:
>   - set config bit is property is set in DTS
>   - rephrase commit msg
>   - rename property
> 
>  drivers/hwmon/lm90.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c
> index 1c9493c70813..3820f0e61510 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,6 +1728,9 @@ 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 (of_property_read_bool(np, "ti,extended-range-enable"))
> +			config |= 0x04;
> +
>  		if (config & 0x04)
>  			data->flags |= LM90_FLAG_ADT7461_EXT;
>  	}
Holger Brunck May 17, 2022, 1:17 p.m. UTC | #2
> On Tue, May 17, 2022 at 09:57:38AM +0200, Holger Brunck wrote:
> > Some lm90 compatible devices can operate in a extended temperature
> mode.
> > This feature is now enabled if the property is set in the
> > corresponding device tree node.
> >
> > Signed-off-by: Holger Brunck <holger.brunck@hitachienergy.com>
> 
> For my reference:
> 
> Reviewed-by: Guenter Roeck <linux@roeck-us.net>
> 

thanks. As you now already applied 1/3 and I have to update 2/3 should
I send a v4 with the missing two patches, even if this one is reviewed?
Or should I only send a v4 for 2/3 and if this is applied you apply this
one?

Best regards
Holger
Guenter Roeck May 17, 2022, 1:37 p.m. UTC | #3
On 5/17/22 06:17, Holger Brunck wrote:
>> On Tue, May 17, 2022 at 09:57:38AM +0200, Holger Brunck wrote:
>>> Some lm90 compatible devices can operate in a extended temperature
>> mode.
>>> This feature is now enabled if the property is set in the
>>> corresponding device tree node.
>>>
>>> Signed-off-by: Holger Brunck <holger.brunck@hitachienergy.com>
>>
>> For my reference:
>>
>> Reviewed-by: Guenter Roeck <linux@roeck-us.net>
>>
> 
> thanks. As you now already applied 1/3 and I have to update 2/3 should
> I send a v4 with the missing two patches, even if this one is reviewed?
> Or should I only send a v4 for 2/3 and if this is applied you apply this
> one?
> 

I applied the first patch because it is independent of the other two
and should be applied in the next commit window even if the other two
patches don't make it. Just send the remaining two patches in the next
version. Please keep my Reviewed-by: tag when you do that.

Thanks,
Guenter
diff mbox series

Patch

diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c
index 1c9493c70813..3820f0e61510 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,6 +1728,9 @@  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 (of_property_read_bool(np, "ti,extended-range-enable"))
+			config |= 0x04;
+
 		if (config & 0x04)
 			data->flags |= LM90_FLAG_ADT7461_EXT;
 	}