All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rob Herring <robh@kernel.org>
To: Guenter Roeck <linux@roeck-us.net>, Wolfram Sang <wsa@the-dreams.de>
Cc: Wojciech Slenska <wojciech.slenska@gmail.com>,
	Jean Delvare <jdelvare@suse.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Linux HWMON List <linux-hwmon@vger.kernel.org>,
	devicetree@vger.kernel.org, Linux I2C <linux-i2c@vger.kernel.org>
Subject: Re: [PATCH v2] hwmon: (sht3x) add devicetree support
Date: Thu, 18 Oct 2018 11:06:52 -0500	[thread overview]
Message-ID: <CAL_JsqK62Yi9+w=06LrsiDCgLp9W0WmfYTL9QCv98Qfij7Zbbw@mail.gmail.com> (raw)
In-Reply-To: <20181018144141.GA3963@roeck-us.net>

Adding Wolfram and i2c list...

On Thu, Oct 18, 2018 at 9:41 AM Guenter Roeck <linux@roeck-us.net> wrote:
>
> On Thu, Oct 18, 2018 at 08:47:43AM -0500, Rob Herring wrote:
> > On Tue, Oct 16, 2018 at 6:38 PM Guenter Roeck <linux@roeck-us.net> wrote:
> > >
> > > On Tue, Oct 16, 2018 at 01:02:08PM -0500, Rob Herring wrote:
> > > > On Mon, Oct 15, 2018 at 2:54 PM Guenter Roeck <linux@roeck-us.net> wrote:
> > > > >
> > > > > On Mon, Oct 15, 2018 at 07:55:58AM +0200, Wojciech Sleńska wrote:
> > > > > > pt., 12 paź 2018 o 22:28 Rob Herring <robh@kernel.org> napisał(a):
> > > > > > >
> > > > > > > On Fri, Oct 05, 2018 at 07:38:35AM +0200, Wojciech Slenska wrote:
> > > > > > >
> > > > > > > Commit msg?
> > > > > > >
> > > > > > > > Signed-off-by: Wojciech Slenska <wojciech.slenska@gmail.com>
> > > > > > > > ---
> > > > > > > >  Documentation/devicetree/bindings/hwmon/sht3x.txt | 16 +++++++++++++
> > > > > > >
> > > > > > > Please split bindings to separate patch.
> > > > > >
> > > > > > I will do this.
> > > > > >
> > > > > > >
> > > > > > > >  drivers/hwmon/sht3x.c                             | 28 ++++++++++++++++++++---
> > > > > > > >  2 files changed, 41 insertions(+), 3 deletions(-)
> > > > > > > >  create mode 100644 Documentation/devicetree/bindings/hwmon/sht3x.txt
> > > > > > > >
> > > > > > > > diff --git a/Documentation/devicetree/bindings/hwmon/sht3x.txt b/Documentation/devicetree/bindings/hwmon/sht3x.txt
> > > > > > > > new file mode 100644
> > > > > > > > index 0000000..80b117e
> > > > > > > > --- /dev/null
> > > > > > > > +++ b/Documentation/devicetree/bindings/hwmon/sht3x.txt
> > > > > > > > @@ -0,0 +1,16 @@
> > > > > > > > +Sensirion SHT3x Humidity and Temperature Sensor
> > > > > > > > +
> > > > > > > > +Required node properties:
> > > > > > > > +- compatible: "sensirion,sht3x" or "sensirion,sts3x"
> > > > > > > > +- reg: I2C bus address of the device
> > > > > > > > +
> > > > > > > > +Optional properties:
> > > > > > > > +- sensirion,blocking-io: enable blocking mode on i2c
> > > > > > >
> > > > > > > This is not a h/w parameter and shouldn't be in DT.
> > > > > > >
> > > > > > > > +- sensirion,no-high-precision: disable high accuracy
> > > > > > >
> > > > > > > Maybe this one is okay, but couldn't the user want to set this? If so,
> > > > > > > then it should be a sysfs attr.
> > > > > >
> > > > > > Those two parameters have been just moved from
> > > > > > linux/include/linux/platform_data/sht3x.h
> > > > > > Currently, those two parameters can be set in board file, so for me
> > > > > > was natural to move it to dts.
> > > > > > Of course, I can remove it from dts completely.
> > > > > >
> > > > >
> > > > > I wonder if there is an authoritative document explaining the current policy
> > > > > in respect to devicetree properties.
> > > >
> > > > No. In the end it is often a judgement call.
> > > >
> > > > > Sometimes I hear that platform
> > > > > configuration parameters are now permitted, sometimes I hear that we are
> > > > > back to hardware description only.
> > > >
> > > > Yes, configuration is permitted, but there are some constraints. The
> > > > questions I ask are is it OS specific or specific to current
> > > > implementation of an OS, who or what decides what the setting is? The
> > > > last question results in lots of things dropped in favor of a sysfs
> > > > control.
> > > >
> > > In this driver, both parameters were considered system / platform parameters.
> > > One controls if the chip uses i2c clock stretching or if the system has to poll
> > > for results. This is determined by the system's i2c controller and may also be
> > > influenced by considerations such as if there is another chip on the same bus.
> >
> > Okay, makes sense. As it is named, it sounded like picking a s/w API
> > to use (sync vs. async). So please improve the description based on
> > Guenter's explanation.
> >
> > > The other parameter controls accuracy which directly translates into power
> > > consumption. While there could be applications where both parameters are
> > > controlled by user space, that would be the exception. In the expected use
> > > case, ie for hardware monitoring, user space control would neither be feasible
> > > nor desirable. As such, sysfs controls for the parameters don't even exist.
> >
> > I could imagine you may want to switch modes based on battery powered
> > vs. plugged in. But that's not to say you couldn't want it one way or
> > the other for a system.
> >
> > > I don't mind if you reject adding those dt properties for now, but I would
> > > resist adding sysfs attributes unless someone provides me with an actual
> > > and specific use case.
> >
> > I'm not rejecting them. My next question though is should these be
> > common properties?
>
> No, they are chip specific.

Really?

Trading off accuracy vs. sampling frequency is very much common for
ADCs. Not exactly the same thing here, but surely there's other cases
out there.

And here's another device with programmable clock stretching[1]. Lots
of discussions in searching about masters not supporting clock
stretching more than I found of slaves which are configurable. At
least in that case, we should be able to derive it from master
compatible strings. But for the cases where both ends can support
stretching or not, seems like we need an i2c property.

Rob

[1] https://www.infineon.com/dgdl/Infineon-Infineon-TLE493D-A2B6-UM-v01_00-UM-v01_00-EN.pdf?fileId=5546d46262b31d2e01633b4bba5f3c5a

>
> Guenter

  reply	other threads:[~2018-10-18 16:06 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-05  5:38 [PATCH v2] hwmon: (sht3x) add devicetree support Wojciech Slenska
2018-10-12 20:28 ` Rob Herring
2018-10-15  5:55   ` Wojciech Sleńska
2018-10-15 19:54     ` Guenter Roeck
2018-10-16 18:02       ` Rob Herring
2018-10-16 23:38         ` Guenter Roeck
2018-10-18 13:47           ` Rob Herring
2018-10-18 14:41             ` Guenter Roeck
2018-10-18 16:06               ` Rob Herring [this message]
2018-10-18 16:58                 ` Guenter Roeck
2018-10-18 18:07                 ` Wolfram Sang

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='CAL_JsqK62Yi9+w=06LrsiDCgLp9W0WmfYTL9QCv98Qfij7Zbbw@mail.gmail.com' \
    --to=robh@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=jdelvare@suse.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=mark.rutland@arm.com \
    --cc=wojciech.slenska@gmail.com \
    --cc=wsa@the-dreams.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 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.