All of lore.kernel.org
 help / color / mirror / Atom feed
From: Holger Brunck <holger.brunck@hitachienergy.com>
To: Guenter Roeck <linux@roeck-us.net>
Cc: "linux-hwmon@vger.kernel.org" <linux-hwmon@vger.kernel.org>,
	Jean Delvare <jdelvare@suse.com>
Subject: RE: [v2 2/2] driver/hwmon/lm90: enable extended range according to DTS node
Date: Tue, 17 May 2022 06:27:42 +0000	[thread overview]
Message-ID: <DB9PR06MB7289D39850290F93698E39DDF7CE9@DB9PR06MB7289.eurprd06.prod.outlook.com> (raw)
In-Reply-To: <20220516203114.GA4080547@roeck-us.net>

> 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


  reply	other threads:[~2022-05-17  6:27 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DB9PR06MB7289D39850290F93698E39DDF7CE9@DB9PR06MB7289.eurprd06.prod.outlook.com \
    --to=holger.brunck@hitachienergy.com \
    --cc=jdelvare@suse.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux@roeck-us.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.