LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Oskar Senft <osk@google.com>
Cc: linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, Jean Delvare <jdelvare@suse.com>,
	Rob Herring <robh+dt@kernel.org>
Subject: Re: [PATCH] dt-bindings: hwmon: Add nct7802 bindings
Date: Tue, 14 Sep 2021 08:08:59 -0700	[thread overview]
Message-ID: <20210914150859.GB3457579@roeck-us.net> (raw)
In-Reply-To: <CABoTLcSdkmuBxd5Yh6z2Oqm1-_Vd4J5Ni1i1qq5s07mWu7Ndew@mail.gmail.com>

On Tue, Sep 14, 2021 at 08:41:36AM -0400, Oskar Senft wrote:
> Hi Guenter
> 
> > https://lore.kernel.org/linux-hwmon/cover.1631021349.git.krzysztof.adamski@nokia.com/
> >
> > That specifically includes the ability to enable or disable channels
> > using the standard 'status' property. While that series is primarily
> > for the n-factor property supported by the tmp421, the same approach
> > can be used for [temperature] sensor properties on other chips as well.
> 
> Good pointer! I should be able to replicate that for the LTD (@0) and
> RTDs (1, 2, 3) in a similar way.
> 
> > I put [temperature] in [] because we'd need to find a means to express
> > if the sub-nodes are for temperature, voltage, or something else, but
> > I think the basic principle is sound.
> Following the example from tmp421, this could then be like this:
> 

Something like that, only we'll need something to distinguish
temperature sensors from other sensor types, eg voltage or current.
Maybe a "type" property. I'd suggest "sensor-type", but we have
non-sensor attributes such as fan count and pwm values which should
be covered as well. But it looks like a good start for a set of
generic sensor properties.

> i2c {
>     #address-cells = <1>;
>     #size-cells = <0>;
> 
>     nct7802@28 {
>         compatible = "nuvoton,nct7802";
>         reg = <0x28>;
>         #address-cells = <1>;
>         #size-cells = <0>;
> 
>         /* LTD */
>         input@0 {
>             reg = <0x0>;
>             status = "okay";

Not sure what the default is here ('okay' or 'disabled').
We'd also need to define what to do if there is no data
for a given sensor.

>             /* No "mode" attribute here*/
>             label = "local temp";
>         };
> 
>         /* RTD1 */
>         input@1 {
>             reg = <0x1>;
>             mode = <0x2>; /* 3904 transistor */
>             label = "voltage mode";

That isn't the idea for "label", as "label" would be expected to
show up as tempX_label (and a label of "voltage mode" would be odd).
The label should indicate where the sensor is located on a board,
such as "inlet" or "outlet".

>         };
> 
>         input@2 {
>             reg = <0x2>;
>             mode = <0x4>; /* thermistor */
>             label = "thermistor mode";
>         };
> 
>         /* RTD3 */
>         input@3 {
>             reg = <0x3>;
>             mode = <0x3>; /* thermal diode */
>             label = "current mode";
>             status = "disabled";
>         };
>     };
> };
> 
> I noticed that "nct7802_temp_is_visible" only allows the temperature
> sensor to be visible for current and thermistor but not voltage. Is
> that right?
> 
No, that is a bug.

> Before I go and change the driver further, I'd like to make sure we
> agree on the interface.
> 
> Also: Is nct7802_temp_is_visible called again after temp_type_store
> was called (I didn't try it)?
> 
No. That would not be the idea. If enabling / disabling a sensor
is supposed with the _enable attribute (and/or with devicetree),
the affected sensor should always be instantiated, and reading
sensor data should return -ENODATA if the sensor is disabled.

Thanks,
Guenter

  reply	other threads:[~2021-09-14 15:09 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-10 13:03 Oskar Senft
2021-09-10 16:10 ` Guenter Roeck
2021-09-10 20:44   ` Oskar Senft
2021-09-10 21:28     ` Guenter Roeck
2021-09-14 12:41       ` Oskar Senft
2021-09-14 15:08         ` Guenter Roeck [this message]
2021-09-14 17:11           ` Oskar Senft
2021-09-14 17:33             ` Guenter Roeck
2021-09-16 19:19               ` Oskar Senft
2021-09-16 19:34                 ` Guenter Roeck
2021-09-16 19:53                   ` Oskar Senft
2021-09-16 20:07                     ` Guenter Roeck
2021-09-16 20:10                       ` Oskar Senft
2021-09-17  3:09                         ` Oskar Senft
2021-09-17  3:29                           ` Guenter Roeck
2021-09-12  4:03     ` Guenter Roeck
2021-09-10 21:03 ` Rob Herring

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=20210914150859.GB3457579@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=devicetree@vger.kernel.org \
    --cc=jdelvare@suse.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=osk@google.com \
    --cc=robh+dt@kernel.org \
    --subject='Re: [PATCH] dt-bindings: hwmon: Add nct7802 bindings' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).