iio: chemical: ccs811: Fix output of IIO_CONCENTRATION channels
authorNarcisa Ana Maria Vasile <narcisaanamaria12@gmail.com>
Wed, 6 Dec 2017 16:57:58 +0000 (18:57 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 3 Feb 2018 16:39:23 +0000 (17:39 +0100)
commit0db5de4f4e1884c0ceb246bbcf450fbfd01881f7
tree6b3c089ba2efb1801067632756694ce388571fb3
parente2d4cdb7b8a4b2f8d4dfc2ae067229595ec0190c
iio: chemical: ccs811: Fix output of IIO_CONCENTRATION channels

commit 8f114acd4e1a9cfa05b70bcc4219bc88197b5c9b upstream.

in_concentration_raw should report, according to sysfs-bus-iio documentation,
a "Raw (unscaled no offset etc.) percentage reading of a substance."

Modify scale to convert from ppm/ppb to percentage:
1 ppm = 0.0001%
1 ppb = 0.0000001%

There is no offset needed to convert the ppm/ppb to percentage,
so remove offset from IIO_CONCENTRATION (IIO_MOD_CO2) channel.

Cc'd stable to reduce chance of userspace breakage in the long
run as we fix this wrong bit of ABI usage.

Signed-off-by: Narcisa Ana Maria Vasile <narcisaanamaria12@gmail.com>
Reviewed-by: Matt Ranostay <matt.ranostay@konsulko.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/iio/chemical/ccs811.c