Based on 1 normalized pattern(s):
this program is free software you can redistribute it and or modify
it under the terms and conditions of the gnu general public license
version 2 as published by the free software foundation this program
is distributed in the hope that it will be useful but without any
warranty without even the implied warranty of merchantability or
fitness for a particular purpose see the gnu general public license
for more details
extracted by the scancode license scanner the SPDX license identifier
GPL-2.0-only
has been chosen to replace the boilerplate/reference in 3 file(s).
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Enrico Weigelt <info@metux.net>
Reviewed-by: Allison Randal <allison@lohutok.net>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190604081205.739216165@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The equivalent of both of these are now done via macro magic when
the relevant register calls are made. The actual structure
elements will shortly go away.
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
This adds devicetree support for the si7020 iio driver. Since it works
well without requiring any additional property, its compatible string is
added to the trivial i2c devices bindings list.
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Previously most drivers that used a i2c_check_functionality() check
condition required various error codes on failure. This patchset
converts to a standard of -EOPNOTSUPP
Signed-off-by: Matt Ranostay <mranostay@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This patch adds support for Hoperf th06 humidity and
temperature sensor as it uses same register definitions
as si7020
th06 Datasheet: http://www.hoperf.com/upload/sensor/TH06.pdf
Signed-off-by: Cristina Moraru <cristina.moraru09@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This set does not include those for issues introduced during the merge
window. Fixes of those will follow in a future series.
* ad5064
- Make sure the local i2c_write returns 0 on success rather than the
number of bytes transfered. Otherwise we report an error on all writes.
- Fix a shift for ad5629 and ad5669 which gives incorrect DAC output on
these parts.
* ad7793
- The product ID on the datasheet is wrong. Fix it in the driver.
* IIO_DUMMY_EVGEN
- select IRQ_WORK as a dependency.
* lpc32xx
- make sure clock is prepared before enabling.
* si7020
- data byte order was reversed. Fix it.
* vf610
- Internal temperature calculation was wrong if a different
reference voltage was used. Now use a linear interpolation
function to make it work over the full range.
- Fix a division by zero in the case of a device tree property
not being present (same issue two fixes).
* xilinx XADC
- VREFN scale was wrong - fix it.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iQIcBAABCAAGBQJWSH0iAAoJEFSFNJnE9BaILcYP/Rb70yJE23oTx6iyMDLip/Im
7yG+TMh/mFJCrwmpvloRX4IxQ20WApQPEQRaO6ivcoykQ/8eGDK3hrHWiHwYNs9z
P+q1qxz0F0pnvWHPZ2UZ+p8ZNzuy9ovTSeeuAHQWMVSsPCgiQR3kq0hBVrvV4mVn
4AQejD0M/x69TWdisZtGJqKBZs44mXHbgqC6Xw/6u0MLpA8ZLHO2XAr9vaSA042T
PsYXbEMmb/ElRKwadbX4JCqrMsA3FhPx+qD7qPu14bsC8WR4tlNLIBzEmBQJotWf
8wjK7AF7Af/HMO5KjO6uJe+EdypMq1UjlmqeRWUZIGUlLtmjmkhnRzO4Qahsbx2K
6TEO1uNhOjg7JQGfeuL9fKMHI6QKkeFIJ/cl2ekRWRwbxS2kOmXA9HTCsxynrdAR
qC49Eqkbfr/F1vdgDx61JAWgWuZNdxFg3tiD3wP2BMjOipKBuKRt9CvHuOORW7Tp
aUPruyJduIpcVQBL+wbSElAc4XsjgL4+/KROcfG3x3zWKUjOux73G8WsgaSSQ4Fe
rP2stYFmZUigIpSW/vTwbdcN8tIT9S/XZjxF/mlP7azIQHyafWTVl6CUlphtewtY
YZVT2K+t07zQV2NgOi9J+H5yCPG39d1Fb1R4OsWF1Brq2QsQJwqR9Y1ERXiPEJzZ
DvylTHu0lxP+xgE/Xjuz
=362F
-----END PGP SIGNATURE-----
Merge tag 'iio-fixes-for-4.4a' of ssh://ra.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-linus
Jonathan writes:
First set of IIO fixes for the 4.4 cycle.
This set does not include those for issues introduced during the merge
window. Fixes of those will follow in a future series.
* ad5064
- Make sure the local i2c_write returns 0 on success rather than the
number of bytes transfered. Otherwise we report an error on all writes.
- Fix a shift for ad5629 and ad5669 which gives incorrect DAC output on
these parts.
* ad7793
- The product ID on the datasheet is wrong. Fix it in the driver.
* IIO_DUMMY_EVGEN
- select IRQ_WORK as a dependency.
* lpc32xx
- make sure clock is prepared before enabling.
* si7020
- data byte order was reversed. Fix it.
* vf610
- Internal temperature calculation was wrong if a different
reference voltage was used. Now use a linear interpolation
function to make it work over the full range.
- Fix a division by zero in the case of a device tree property
not being present (same issue two fixes).
* xilinx XADC
- VREFN scale was wrong - fix it.
The Silicon Labs Si7013, Si7020, and Si7021 family of I2C humidity and
temperature sensors deliver 16 bit data high byte first.
See the datasheet available at:
https://www.silabs.com/Support%20Documents%2fTechnicalDocs%2fSi7020-A20.pdf
But as documented in Documentation/i2c/smbus-protocol,
i2c_smbus_read_word_data() expects the low byte first.
Change the driver to use i2c_smbus_read_word_swapped to get correct byte
order.
Signed-off-by: Chris Lesiak <chris.lesiak@licor.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
The maximum possible value for the relative humidity is 55575 (100%RH).
This value, if shifted right by 2 bits, uses 14 bits and masking it with
a 12 bit mask removes 2 meaningful bits.
The masking has been replaced with a range check that sets the minimum
value at 786 (0%RH) and the maximum at 13893 (99.998%RH).
Signed-off-by: Nicola Corna <nicola@corna.info>
Reviewed-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Since only a pointer to struct i2c_client is stored in a private area
of IIO device created by the driver there's no need to allocate
sizeof(struct i2c_client) worth of storage.
Pushed to stable as this is linked to the revert patch previously.
Without this followup the original patch looks sensible.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Cc: Stable@vger.kernel.org
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This reverts commit e0922e5e3c.
Requested by Andrey Smirnov.
It incorrectly assumes that the level of indirection is not needed
which is not true(probably because the driver incorrectly allocates
sizeof(*client) instead of sizeof(*data) via devm_iio_device_alloc).
If you look at the code of the probe function(see below) it is easy to
see that what is being stored in the private memory of the IIO device
instance is not a copy of a 'struct i2c_client' but a pointer to an
instance passed as an argument to the probe function.
struct i2c_client **data;
int ret;
< Some code skipped >
indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*client));
if (!indio_dev)
return -ENOMEM;
data = iio_priv(indio_dev);
*data = client;
Without reverting this change any read of a raw value of this sensor
leads to a kernel oops due to a NULL pointer de-reference on my
hardware setup.
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Cc: Stable@vger.kernel.org
In si7020_read_raw() the pointer to the i2c client was obtained as second level
pointer, although a simple pointer is appropriate.
Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
When reading temperature or humidity values, a shift of two bits to the right
needs to be applied, and only for the humidity channel a mask of the lower
12 bits needs to be applied. This reduces code repetition.
During probe, i2c_set_clientdata() was used, although its counterpart was not,
so drop it.
Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This patch adds support to the Industrial IO subsystem
for the Silicon Labs Si7013/20/21 Relative Humidity and
Temperature Sensors.
Website: http://www.silabs.com/products/sensors/humidity-sensors/Pages/si7013-20-21.aspx
These are i2c devices which measure relative humidity
and temperature and all use the same protocol. The
Si7013 has an additional input with programmable
linearization which is not supported because that's
complicated and I didn't need it.
Signed-off-by: David Barksdale <dbarksdale@uplogix.com>
--
Changes since v1:
* Renamed to si7020 and replaced Si701x/2x with Si7013/20/21.
* Removed unneeded mutex.
* Pre-computed floating-point constant expressions.
* Removed address_list and I2C_CLASS_HWMON.
Changes since v2:
* Return correct raw sensor values.
* Rename dev variable to indio_dev.
* Issue a software reset command during probe.
* Un-broke string literal.
Changes since v3:
* enum changed to #define
Signed-off-by: Jonathan Cameron <jic23@kernel.org>