public inbox for linux-iio@vger.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Eugene Zaikonnikov <eugene.zaikonnikov@norphonic.com>
Cc: Hartmut Knaack <knaack.h@gmx.de>,
	Lars-Peter Clausen <lars@metafoo.de>,
	development@norphonic.com, linux-iio@vger.kernel.org
Subject: Re: [PATCH 0/1] Add support for TI HDC200x humidity and temperature sensors
Date: Sat, 23 Nov 2019 14:15:15 +0000	[thread overview]
Message-ID: <20191123141515.55d9eebc@archlinux> (raw)
In-Reply-To: <996dd531-cbc6-9ecc-0a67-0a9b8e686c0c@norphonic.com>

On Fri, 22 Nov 2019 15:50:43 +0100
Eugene Zaikonnikov <eugene.zaikonnikov@norphonic.com> wrote:

> Jonathan,
> 
> Just got back to fixing most of the issues you pointed out, excepting these:
> 
> On 03.11.2019 13:19, Jonathan Cameron wrote:
> 
> > +  
> >> +static const struct iio_chan_spec hdc200x_channels[] = {
> >> +    {
> >> +        .type = IIO_TEMP,
> >> +        .extend_name = "Temperature",  
> > Any use of extend_name changes the ABI and should be done extremely
> > carefully.  It basically means that generic userspace code cannot
> > use your driver.
> >
> > Here I can't see any advantage in doing so at all so drop it.  
> 
> If I have two temperature channels and provide no extend_name to at least one of them, they fail to register.
This only worked on the assumption that you could use PEAK below so only
have one channel for both.

Alternative would be to index them, but that doesn't make much sense here either.

> 
> >  
> >> +        },
> >> +    },
> >> +    {
> >> +        .type = IIO_TEMP,
> >> +        .extend_name = "Temperature_MAX",  
> > Could we use the IIO_CHAN_INFO_PEAK element for this?  Given
> > the different scale, we'd need to do some work to make it
> > have the same scale as temp.  
> 
> Started looking into this.
> Are there any examples or docs of using IIO_CHAN_INFO_PEAK? Couldn't find much in the IIO subtree.
> Is it used together with INFO_RAW? And temp&max temp channels have different scales already.

ah. I missed they had different scale values.  That's unfortunate.
A simple work around for this might be to just multiply the output in the _MAX
case by 256.  That way the two would have the same scale which is assumed if using
the IIO_RAW and IIO_PEAK together.

> 
> >> +{
> >> +    char tmp = (~mask & data->drdy_config) | val;
> >> +    int ret;
> >> +
> >> +    ret = i2c_smbus_write_byte_data(data->client,
> >> +                    HDC200X_REG_RESET_DRDY_INT_CONF, tmp);
> >> +    if (!ret)
> >> +        data->drdy_config = tmp;
> >> +
> >> +    return ret;
> >> +}
> >> +
> >> +static int hdc200x_get_measurement_word(struct hdc200x_data *data,
> >> +                    struct iio_chan_spec const *chan)  
> > These wrappers add relatively little.  I'd prefer that you just call
> > the i2c calls directly instead.  Less code and ultimately a tiny
> > bit easier to review.  
> 
> Removed wrappers that are called once. Leaving the wrapper called in different places, makes intent more clear IMO.
Hmm. It's always a trade off.  Will see what the result looks
like!

Jonathan

> 
> --
> 
>   Eugene
> 


      reply	other threads:[~2019-11-23 14:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <71176abd-4997-70f8-8132-137fadda7768@norphonic.com>
2019-11-03 12:19 ` [PATCH 0/1] Add support for TI HDC200x humidity and temperature sensors Jonathan Cameron
2019-11-04 14:06   ` Eugene Zaikonnikov
2019-11-22 14:50   ` Eugene Zaikonnikov
2019-11-23 14:15     ` Jonathan Cameron [this message]

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=20191123141515.55d9eebc@archlinux \
    --to=jic23@kernel.org \
    --cc=development@norphonic.com \
    --cc=eugene.zaikonnikov@norphonic.com \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    /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