From: Marek Vasut <marex-ynQEQJNshbs@public.gmane.org>
To: Jonathan Cameron <jic23-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: Matt Ranostay <mranostay-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
"devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Mark Rutland <Mark.Rutland-5wv7dgnIgG8@public.gmane.org>,
Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
Pawel Moll <Pawel.Moll-5wv7dgnIgG8@public.gmane.org>,
Ian Campbell
<ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org>,
Kumar Gala <galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
Subject: Re: [PATCH V3] iio: pressure: hp03: Add Hope RF HP03 sensor support
Date: Mon, 18 Apr 2016 15:26:19 +0200 [thread overview]
Message-ID: <5714E07B.4090902@denx.de> (raw)
In-Reply-To: <57129538.6010300-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
On 04/16/2016 09:40 PM, Jonathan Cameron wrote:
> On 10/04/16 21:52, Marek Vasut wrote:
>> Add support for HopeRF pressure and temperature sensor.
>>
>> This device uses two fixed I2C addresses, one for storing
>> calibration coefficients and another for accessing the ADC.
>>
>> Signed-off-by: Marek Vasut <marex-ynQEQJNshbs@public.gmane.org>
>> Cc: Matt Ranostay <mranostay-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
>> Cc: Jonathan Cameron <jic23-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> Sorry I didn't get to this earlier in the week.
>
> Unfortunately the resulting scales don't match the standard ABI for these
> two channel types.
Ah, sorry for the inconvenience.
> Otherwise, looks good. I've cc'd the devicetree list and maintainers.
> The binding is trivial I think, but always good to give people a
> opportunity to comment.
>
> Jonathan
>> ---
>> V2: - Expand the binding document with more details on the XCLR pin
>> - Switch from IIO_CHAN_INFO_PROCESSED to RAW + SCALE
>> - Add failpath into hp03_update_temp_pressure() for the case
>> when ADC readout fails. This correctly sets the XCLR pin back
>> to LO now.
>> - Add comment explaining the need for allocation of child device
>> in hp03_probe().
>> V3: - Fix indent in the DT binding documentation
>> - Report raw pressure and temperature unmodified
> Good
>> - Report pressure scale to be 1 , since pressure is in Pa
> Standard units for pressure (see Documentation/ABI/testing/sysfs-bus-iio
> are KPa so it wants to report 0.001)
OK, got it.
>> - Report temperature scale to be 0.01 , since temp is in 0.01C steps
> Unfortunately the documented base unit for temp (originally from hwmon before
> we started going for SI units every time) are milli Celcius. Thus the value
> reported * scale should end up in milli degrees Celcius. Hence if it is in 0.01
> steps the scale should be 0.1
Shouldn't this be 10 ? The value is in 0.01C steps , so the value has to
be multiplied by 10 to convert it into mC units.
>> ---
>> .../devicetree/bindings/iio/pressure/hp03.txt | 17 ++
>> drivers/iio/pressure/Kconfig | 11 +
>> drivers/iio/pressure/Makefile | 1 +
>> drivers/iio/pressure/hp03.c | 307 +++++++++++++++++++++
>> 4 files changed, 336 insertions(+)
>> create mode 100644 Documentation/devicetree/bindings/iio/pressure/hp03.txt
>> create mode 100644 drivers/iio/pressure/hp03.c
[...]
>> +static int hp03_read_raw(struct iio_dev *indio_dev,
>> + struct iio_chan_spec const *chan,
>> + int *val, int *val2, long mask)
>> +{
>> + struct hp03_priv *priv = iio_priv(indio_dev);
>> + int ret;
>> +
>> + mutex_lock(&priv->lock);
>> + ret = hp03_update_temp_pressure(priv);
>> + mutex_unlock(&priv->lock);
>> +
>> + if (ret)
>> + return ret;
>> +
>> + switch (mask) {
>> + case IIO_CHAN_INFO_RAW:
>> + switch (chan->type) {
>> + case IIO_PRESSURE:
>> + *val = priv->pressure;
>> + return IIO_VAL_INT;
>> + case IIO_TEMP:
>> + *val = priv->temp;
>> + return IIO_VAL_INT;
>> + default:
>> + return -EINVAL;
>> + }
>> + break;
>> + case IIO_CHAN_INFO_SCALE:
>> + switch (chan->type) {
>> + case IIO_PRESSURE:
>> + *val = 1;
>> + return IIO_VAL_INT;
> *val = 0, *val2 = 1000;
> return IIO_VAL_INT_PLUS_MICRO;
>> + case IIO_TEMP:
>> + *val = 0;
>> + *val2 = 10000;
> Val2 should I think be 100000 giving scale * lsb of 0.001 degrees.
I think this should be:
val = 10;
return IIO_VAL_INT;
Since the temp value is in 10mC steps.
>> + return IIO_VAL_INT_PLUS_MICRO;
>> + default:
>> + return -EINVAL;
>> + }
>> + break;
>> + default:
>> + return -EINVAL;
>> + }
>> +
>> + return -EINVAL;
>> +}
[...]
Best regards,
Marek Vasut
next prev parent reply other threads:[~2016-04-18 13:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1460321544-8619-1-git-send-email-marex@denx.de>
[not found] ` <1460321544-8619-1-git-send-email-marex-ynQEQJNshbs@public.gmane.org>
2016-04-16 19:40 ` [PATCH V3] iio: pressure: hp03: Add Hope RF HP03 sensor support Jonathan Cameron
[not found] ` <57129538.6010300-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2016-04-18 13:26 ` Marek Vasut [this message]
[not found] ` <5714E07B.4090902-ynQEQJNshbs@public.gmane.org>
2016-04-18 13:44 ` jic23-tko9wxEg+fIOOJlXag/Snyp2UmYkHbXO
[not found] ` <1a6d907d4f0229c80eae5075139febbb-tko9wxEg+fIOOJlXag/Snyp2UmYkHbXO@public.gmane.org>
2016-04-18 13:56 ` Marek Vasut
[not found] ` <5714E78F.6020305-ynQEQJNshbs@public.gmane.org>
2016-04-18 13:57 ` jic23-tko9wxEg+fIOOJlXag/Snyp2UmYkHbXO
[not found] ` <809d6d41963caff6c7f3fa26e2009dff-tko9wxEg+fIOOJlXag/Snyp2UmYkHbXO@public.gmane.org>
2016-04-18 13:59 ` Marek Vasut
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=5714E07B.4090902@denx.de \
--to=marex-ynqeqjnshbs@public.gmane.org \
--cc=Mark.Rutland-5wv7dgnIgG8@public.gmane.org \
--cc=Pawel.Moll-5wv7dgnIgG8@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
--cc=ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org \
--cc=jic23-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=mranostay-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.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;
as well as URLs for NNTP newsgroup(s).