public inbox for linux-hwmon@vger.kernel.org
 help / color / mirror / Atom feed
From: Trent Piepho <tpiepho@impinj.com>
To: "linux@roeck-us.net" <linux@roeck-us.net>,
	"m.felsch@pengutronix.de" <m.felsch@pengutronix.de>
Cc: "dmitry.torokhov@gmail.com" <dmitry.torokhov@gmail.com>,
	"linux-hwmon@vger.kernel.org" <linux-hwmon@vger.kernel.org>,
	"jdelvare@suse.com" <jdelvare@suse.com>,
	"kernel@pengutronix.de" <kernel@pengutronix.de>
Subject: Re: [PATCH v2 2/2] hwmon: add generic GPIO brownout support
Date: Thu, 1 Nov 2018 17:41:44 +0000	[thread overview]
Message-ID: <1541094101.30311.140.camel@impinj.com> (raw)
In-Reply-To: <20181101104059.em3bvpdzo2bsyazy@pengutronix.de>

On Thu, 2018-11-01 at 11:40 +0100, Marco Felsch wrote:
> On 18-10-30 13:11, Guenter Roeck wrote:
> > On Tue, Oct 30, 2018 at 07:34:11PM +0000, Trent Piepho wrote:
> > > 
> > 	voltage@0 {
> 
> 		reg = <0>;
> 
> I remember that we have to add a reg property if we want to use xyz@0.

Kernel disables that dtc warning, but still seems good to follow that
rule.

> > with some better (acceptable) values for "alarm-type" and the actual fields. 
> 
> Should we use the @<reg> suffix to map it to in<reg>_*_alarm or should
> we do something like that:

Usually the node name, e.g. "node@0", isn't used at all by the driver. 
It's arbitrary, so the dt author can name it what they want.

I've used to identify a device in a udev rule.  So I can have a rule
that acts on a device based on what I want the device to do, rather
than what bus and address the device happens to be on.  The latter are
subject to change based on other devices, SoC pinmuxing, board routing,
etc.

Using the "reg" property to identify the input/temp/fan number seems
totally appropriate to me.

> 
> hwmon_dev {
> 	compatible = "gpio-alarm";
> 
> 	voltage {

I think you'd need something like type = "voltage" here instead of
using the node name.

> 		bat@0 {
> 			reg = <0>;
> 	 		label = "Battery Pack1 Voltage";
> 		};
> 
> 		bat@1 {
> 			reg = <1>;
> 	 		label = "Battery Pack2 Voltage";
> 		};
> 	};

Seems better to me to have the flatter tree with each alarm having a
"type" attribute rather than grouping them by type.

Usually the tree structure of a DT is meant to show a "contains"
relationship, one present in the actual hardware.  A bus with devices
behind it.  Lines attached to controller.  If I've got three op-amps on
GPIOs, two measuring voltage rails and the third on a thermistor, then
IMHO all three are peers.  The hardware design doesn't group the two
voltage rail op-amps in some way that excludes the thermistor op-amp.


> Now the subnodes imply the type. Since the hwmon-gpio-simple should
> work interrupt driven all the time we should replace the alarm-gpios by

Not all GPIOs can generate interrupts.  It would be an unfortunate
hardware design to use such a GPIO for this.  Seems ok to me to defer
that problem to the poor sod who needs to support such hardware if it
ever exists.

  parent reply	other threads:[~2018-11-01 17:41 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-29 14:35 [PATCH v2 0/2] Add GPIO brownout detection support Marco Felsch
2018-10-29 14:35 ` [PATCH v2 1/2] dt-binding: hwmon: add gpio-brownout bindings Marco Felsch
2018-10-29 14:35 ` [PATCH v2 2/2] hwmon: add generic GPIO brownout support Marco Felsch
2018-10-29 19:52   ` Guenter Roeck
2018-10-29 21:16     ` Trent Piepho
2018-10-30  1:12       ` Guenter Roeck
2018-10-30 10:47         ` Marco Felsch
2018-10-30 13:13           ` Guenter Roeck
2018-10-30 17:00             ` Marco Felsch
2018-10-30 19:34               ` Trent Piepho
2018-10-30 20:11                 ` Guenter Roeck
2018-11-01 10:40                   ` Marco Felsch
2018-11-01 13:01                     ` Guenter Roeck
2018-11-01 14:53                       ` Marco Felsch
2018-11-01 15:14                         ` Guenter Roeck
2018-11-01 18:21                           ` Trent Piepho
2018-11-02  6:38                             ` Marco Felsch
2018-11-02 23:05                               ` Trent Piepho
2018-11-05  8:19                                 ` Marco Felsch
2018-11-06 20:50                                   ` Trent Piepho
2018-11-07  9:35                                     ` Marco Felsch
2018-11-07 18:07                                       ` Trent Piepho
2018-11-01 13:02                     ` Guenter Roeck
2018-11-01 14:58                       ` Marco Felsch
2018-11-01 15:08                         ` Guenter Roeck
2018-11-01 17:41                     ` Trent Piepho [this message]
2018-11-02  6:48                       ` Marco Felsch
2018-10-30 19:56               ` Guenter Roeck
2018-11-01  9:44                 ` Marco Felsch
2018-10-30 18:54           ` Trent Piepho
2018-10-30 18:49         ` Trent Piepho
2018-10-30 20:13           ` Guenter Roeck

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=1541094101.30311.140.camel@impinj.com \
    --to=tpiepho@impinj.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=jdelvare@suse.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=m.felsch@pengutronix.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox