From: Linus Walleij <linus.walleij@linaro.org>
To: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Cc: Jonathan Cameron <jic23@kernel.org>,
"linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
Daniel Mack <daniel@caiaq.de>
Subject: Re: [PATCH] iio: light: new driver for the ROHM BH1780
Date: Wed, 30 Mar 2016 10:28:30 +0200 [thread overview]
Message-ID: <CACRpkdY2AP=UOg=yqyQi61+Z=rs+cvf4xmkZhnGgekdht1wfOg@mail.gmail.com> (raw)
In-Reply-To: <alpine.DEB.2.02.1603300946280.14313@pmeerw.net>
On Wed, Mar 30, 2016 at 9:48 AM, Peter Meerwald-Stadler
<pmeerw@pmeerw.net> wrote:
>> >> + case IIO_CHAN_INFO_SCALE:
>> >> + /* Returns raw lux value */
>> >> + *val = 1;
>> >
>> > not needed to scale by 1.0
>> >
>> >> + *val2 = 0;
>> >> + return IIO_VAL_INT;
>>
>> How do you mean?
>> If I don't implement this (just let this function return negative)
>> this happens:
>>
>> iio:device1 ls
>> dev of_node
>> in_illuminance_integration_time power
>> in_illuminance_raw subsystem
>> in_illuminance_scale uevent
>>
>> iio:device1 cat in_illuminance_scale
>> cat: read error: Invalid argument
>>
>> Do you mean all userspace programs should assume scale by 1x
>> if they get an error when they try to read the scale file, or is there
>> a bug in IIO such that this file should return "1" if the callback asking for
>> IIO_CHAN_INFO_SCALE returns negative?
>
> IIO_CHAN_INFO_SCALE is optional, if it is not given 1.0 is to be assumed
>
> you do not give _OFFSET as well and assume that offset is 0.0 when
> interpreting _RAW
I see what you mean, but the actual error I did was this:
> + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |
> + BIT(IIO_CHAN_INFO_SCALE) |
> + BIT(IIO_CHAN_INFO_INT_TIME)
If I drop IIO_CHAN_INFO_SCALE I don't get the file in sysfs
even and then the userspace should assume scale by 1.
I assume. OK changed it like so...
Yours,
Linus Walleij
next prev parent reply other threads:[~2016-03-30 8:28 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-29 14:27 [PATCH] iio: light: new driver for the ROHM BH1780 Linus Walleij
2016-03-29 14:46 ` Peter Meerwald-Stadler
2016-03-30 7:43 ` Linus Walleij
2016-03-30 7:48 ` Peter Meerwald-Stadler
2016-03-30 8:28 ` Linus Walleij [this message]
2016-03-30 8:32 ` Peter Meerwald-Stadler
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='CACRpkdY2AP=UOg=yqyQi61+Z=rs+cvf4xmkZhnGgekdht1wfOg@mail.gmail.com' \
--to=linus.walleij@linaro.org \
--cc=daniel@caiaq.de \
--cc=jic23@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=pmeerw@pmeerw.net \
/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.