Found with scripts/coccinelle/misc/boolconv.cocci.
Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Structures st_uvis25_i2c_regmap_config and st_uvis25_spi_regmap_config are
local to the source and do not need to be in global scope, so make them
both static.
Cleans up sparse warnings:
warning: symbol 'st_uvis25_i2c_regmap_config' was not declared. Should
it be static?
warning: symbol 'st_uvis25_spi_regmap_config' was not declared. Should
it be static?
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Add a sysfs attribute that exposes buffer data available to userspace.
This attribute can be checked at runtime to determine the overall buffer
fill level (across all allocated buffers).
Signed-off-by: Matt Fornero <matt.fornero@mathworks.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This replaces the custom license information text with the appropriate
SPDX identifier. While the information here stays the same, it is easier
to read.
Signed-off-by: Martin Kepplinger <martink@posteo.de>
Acked-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Acked-by: Harinath Nampally <harinath922@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
getnstimeofday() suffers from the overflow in y2038 on 32-bit
architectures and requires a conversion into the nanosecond format that
we want here.
This changes ssp_parse_dataframe() to use ktime_get_real_ns() directly,
which does not have that problem.
An open question is what time base should be used here. Normally
timestamps should use ktime_get_ns() or ktime_get_boot_ns() to read
monotonic time instead of "real" time, which suffers from time jumps
due to settimeofday() calls or leap seconds.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
As discussed with Marc Zyngier: irq_sim_init() and its devres variant
should return the base of the allocated interrupt range on success
rather than 0. This will be modified later - first, change the way
users handle the return value of these routines.
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This resolves the merge issue pointed out by Stephen in
drivers/iio/adc/meson_saradc.c.
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The GPIO core provides a handy GPIO_LOOKUP() macro to populate a struct
gpiod_lookup array without having to spell out attribute names (but
still avoid breakage when attributes within the struct are rearranged
or added).
The axp288_adc.c driver uses a similar macro to populate a struct
iio_map array. Make it available to others.
Cc: Jacob Pan <jacob.jun.pan@linux.intel.com>
Signed-off-by: Lukas Wunner <lukas@wunner.de>
Acked-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
The driver doesn't have a struct of_device_id table but supported devices
are registered via Device Trees. This is working on the assumption that a
I2C device registered via OF will always match a legacy I2C device ID and
that the MODALIAS reported will always be of the form i2c:<device>.
But this could change in the future so the correct approach is to have an
OF device ID table if the devices are registered via OF.
The I2C device ID table entries have the .driver_data field set, but they
are not used in the driver so weren't set in the OF device table entries.
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
The "sana" clock is not used at SAR ADC module in Amlogic Meson SoC,
it is irrelevant for the SAR ADC.
Signed-off-by: Xingyu Chen <xingyu.chen@amlogic.com>
Signed-off-by: Yixun Lan <yixun.lan@amlogic.com>
Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
As per ABI temperature should be in milli Celsius after scaling,
not Celsius
Note on stable cc. This driver is breaking the standard IIO
ABI. (JC)
Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Fix build errors in kernel-doc notation. Symbols that end in '_'
have a special meaning, but adding a '*' makes them OK.
../drivers/iio/industrialio-core.c:635: ERROR: Unknown target name: "iio_val".
../drivers/iio/industrialio-core.c:642: ERROR: Unknown target name: "iio_val".
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
The Meson GXBB and newer SoCs have a few more registers than the older
Meson8 and Meson8b SoCs.
Use a separate regmap config to limit the older SoCs to the DELTA_10
register.
Fixes: 6c76ed31cd ("iio: adc: meson-saradc: add Meson8b SoC compatibility")
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Meson8 and Meson8b do not have the MESON_SAR_ADC_REG11 register. The
bandgap setting for these SoCs is configured in the
MESON_SAR_ADC_DELTA_10 register instead.
Make the driver aware of this difference and use the correct bandgap
register depending on the SoC.
This has worked fine on Meson8 and Meson8b because the bootloader is
already initializing the bandgap setting.
Fixes: 6c76ed31cd ("iio: adc: meson-saradc: add Meson8b SoC compatibility")
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Meson8 and Meson8b SoCs use the the SAR ADC gate clock provided by the
MESON_SAR_ADC_REG3 register within the SAR ADC register area.
According to the datasheet (and the existing MESON_SAR_ADC_REG3_CLK_EN
definition) the gate is on bit 30.
The fls() function returns the last set bit, which is "bit index + 1"
(fls(MESON_SAR_ADC_REG3_CLK_EN) returns 31). Fix this by switching to
__ffs() which returns the first set bit, which is bit 30 in our case.
This off by one error results in the ADC not being usable on devices
where the bootloader did not enable the clock.
Fixes: 3adbf34273 ("iio: adc: add a driver for the SAR ADC found in Amlogic Meson SoCs")
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
The commit 0f0796509c
("iio: remove gpio interrupt probing from drivers that use a single interrupt")
removed custom IRQ assignment for the drivers which are enumerated via
ACPI or OF. Unfortunately, some ACPI tables have IRQ line defined as
GpioIo() resource and thus automatic IRQ allocation will fail.
Partially revert the commit 0f0796509c to restore original behaviour.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Function platform_get_irq_byname() returns a negative error code on
failure, and a zero or positive number on success. However, in function
cpcap_adc_probe(), positive IRQ numbers are also taken as error cases.
Use "if (ddata->irq < 0)" instead of "if (!ddata->irq)" to validate the
return value of platform_get_irq_byname().
Signed-off-by: Pan Bian <bianpan2016@163.com>
Fixes: 25ec249632 ("iio: adc: cpcap: Add minimal support for CPCAP PMIC ADC")
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Acked-by: Tony Lindgren <tony@atomide.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Pointer pdata is being assigned but it is never being used, hence
it is redundant and can be removed. Cleans up clang warning:
drivers/iio/accel/st_accel_core.c:952:3: warning: Value stored to 'pdata'
is never read
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This adds an ACPI table to the driver and the ACPI ID of the sensor
on the tablet.
Signed-off-by: Luke Ross <luke@lukeross.name>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
add support for STMicroelectronics UVIS25 uv sensor
http://www.st.com/resource/en/datasheet/uvis25.pdf
- continuos mode support
- i2c support
- spi support
- trigger mode support
- system PM support
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
The ASPEED SoC must deassert a reset in order to use the ADC peripheral.
The device tree bindings are updated to document the resets phandle, and
the example is updated to match what is expected for both the reset and
clock phandle. Note that the bindings should have always had the reset
controller, as the hardware is unusable without it.
Signed-off-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
The Maxim MAX30105 part adds a third LED (green) and uses a multi-LED
measuring mode producing three measurements
Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Current code assumes always 2 measurements (6 bytes) have to be copied,
prepare for more flexibility
Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Move the programming of the mode setting from init() to
buffer_postenable()
Split out a separate function to
only update the power/shutdown bit
This changes permits to more easily implement different
modes of measurements in further patches
Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Chip must not be in shutdown for reading temperature, so briefly leave
shutdown if buffer is not already running
Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Peter Meerwald-Stalder <pmeerw@pmeerw.net>
Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Table 4 of the datasheet specifies the mode control, these are not
individual bits; add multi LED mode
Add multi-LED mode and fix MODE_MASK (3 bits wide, not 2)
Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
STM32H7 ADC channels can be configured either as single ended or
differential with 'st,adc-channels' or 'st,adc-diff-channels'
(positive and negative input pair: <vinp vinn>, ...).
Differential channels have different offset and scale, from spec:
raw value = (full_scale / 2) * (1 + (vinp - vinn) / vref).
Add offset attribute.
Differential channels are selected by DIFSEL register. Negative
inputs must be added to pre-selected channels as well (PCSEL).
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Remove const array that defines channels. Build channels definition
at probe time, when initializing channels (only for requested ones).
This will ease adding differential channels support.
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reducing shunt and bus voltage range improves the accuracy, so allow
altering the default settings.
Both settings are exposed as gain values. While for the shunt voltage
this is straightforward, the bus range settings of 32V (default) and 16V
are mapped to gain values of 1 resp. 2, to provide a uniform API to
userspace.
As the gain settings are incorporated into the raw values by the sensor
itself, adjusting of the scale attributes is not necessary.
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
While the config uses the physical value corresponding to the LSB
for both the power and the bus voltage register, the shunt voltage is
specified as parts of 1 mV. Use the LSB physical value for all registers.
No functional change.
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Lower bits of the INA219/220 bus voltage register are conversion
status flags, properly shift the value.
When reading via IIO buffer, the value is passed on unaltered,
shifting is the responsibility of the user.
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Since i2c_unregister_device() became NULL-aware we may remove duplicate
NULL check.
Cc: Jonathan Cameron <jic23@kernel.org>
Cc: Hartmut Knaack <knaack.h@gmx.de>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Cc: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Cc: linux-iio@vger.kernel.org
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Add new ACPI ID for ak9911 as had been found on prototype board.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Add new ACPI ID for sx9500 as had been found on prototype board.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Rename structs holding event configuration registers
to more appropriate names. This naming is consistent
with the event config register names given in the
mma845x and fxls8471 datasheets.
Signed-off-by: Harinath Nampally <harinath922@gmail.com>
Acked-by: Martin Kepplinger <martink@posteo.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Rename time step look up struct to generic name
as the values in the look table are same for all
the other events like pulse, transient etc.
Signed-off-by: Harinath Nampally <harinath922@gmail.com>
Acked-by: Martin Kepplinger <martink@posteo.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Driver for 20-bit ALS and UV B sensor with I2C interface exposing
the following API:
in_uvindex_input
in_illuminance_raw
in_illuminance_scale
in_illuminance_scale_available
in_intensity_uv_raw
in_intensity_uv_scale
in_intensity_uv_scale_available
integration_time
integration_time_available
Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.
Addresses-Coverity-ID: 1397962
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Fix gcc warnings about variable 'ec_device' being set but not used
in these files:
common/cros_ec_sensors/cros_ec_sensors.c:194:25
light/cros_ec_light_prox.c:184:25
Signed-off-by: Paolo Cretaro <paolocretaro@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Need to acknowledge DRDY irq in direct mode/ software
triggered mode. Otherwise, on the next conversion, overrun
flag will be raised, which is not a correct state.
This doesn't affect the functionality, but will generate
possible incorrect overrun reports.
Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Added support for DMA transfers. The implementation uses the user watermark
to decide whether DMA will be used or not. For watermark 1, DMA will not be
used. If watermark is bigger, DMA will be used.
Sysfs attributes are created to indicate whether the DMA is used,
with hwfifo_enabled, and the current DMA watermark is readable
in hwfifo_watermark. Minimum and maximum values are in hwfifo_watermark_min
and hwfifo_watermark_max.
Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
The module license checker complains about these two so just fix
it up. They are both GPLv2, both written by me or using code
I extracted while refactoring from the GPLv2 drivers.
Cc: Randy Dunlap <rdunlap@infradead.org>
Reported-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
- proper use of the bool type (Thomas Meyer)
- constification of struct config_item_type (Bhumika Goyal)
-----BEGIN PGP SIGNATURE-----
iQI/BAABCAApFiEEgdbnc3r/njty3Iq9D55TZVIEUYMFAloLSTALHGhjaEBsc3Qu
ZGUACgkQD55TZVIEUYNxfhAAv3cunxiEPEAvs+1xuGd3cZYaxz7qinvIODPxIKoF
kRWiuy5PUklRMnJ8seOgJ1p1QokX6Sk4cZ8HcctDJVByqODjOq4K5eaKVN1ZqJoz
BUzO/gOqfs64r9yaFIlKfe8nFA+gpUftSeWyv3lThxAIJ1iSbue7OZ/A10tTOS1m
RWp9FPepFv+nJMfWqeQU64BsoDQ4kgZ2NcEA+jFxNx5dlmIbLD49tk0lfddvZQXr
j5WyAH73iugilLtNUGVOqSzHBY4kUvfCKUV7leirCegyMoGhFtA87m6Wzwbo6ZUI
DwQLzWvuPaGv1P2PpNEHfKiNbfIEp75DRyyyf87DD3lc5ffAxQSm28mGuwcr7Rn5
Ow/yWL6ERMzCLExoCzEkXYJISy7T5LIzYDgNggKMpeWxysAduF7Onx7KfW1bTuhK
mHvY7iOXCjEvaIVaF8uMKE6zvuY1vCMRXaJ+kC9jcIE3gwhg+2hmQvrdJ2uAFXY+
rkeF2Poj/JlblPU4IKWAjiPUbzB7Lv0gkypCB2pD4riaYIN5qCAgF8ULIGQp2hsO
lYW1EEgp5FBop85oSO/HAGWeH9dFg0WaV7WqNRVv0AGXhKjgy+bVd7iYPpvs7mGw
z9IqSQDORcG2ETLcFhZgiJpCk/itwqXBD+wgMOjJPP8lL+4kZ8FcuhtY9kc9WlJE
Tew=
=+tMO
-----END PGP SIGNATURE-----
Merge tag 'configfs-for-4.15' of git://git.infradead.org/users/hch/configfs
Pull configfs updates from Christoph Hellwig:
"A couple of configfs cleanups:
- proper use of the bool type (Thomas Meyer)
- constification of struct config_item_type (Bhumika Goyal)"
* tag 'configfs-for-4.15' of git://git.infradead.org/users/hch/configfs:
RDMA/cma: make config_item_type const
stm class: make config_item_type const
ACPI: configfs: make config_item_type const
nvmet: make config_item_type const
usb: gadget: configfs: make config_item_type const
PCI: endpoint: make config_item_type const
iio: make function argument and some structures const
usb: gadget: make config_item_type structures const
dlm: make config_item_type const
netconsole: make config_item_type const
nullb: make config_item_type const
ocfs2/cluster: make config_item_type const
target: make config_item_type const
configfs: make ci_type field, some pointers and function arguments const
configfs: make config_item_type const
configfs: Fix bool initialization/comparison
Here is the "big" staging and IIO driver update for 4.15-rc1.
Lots and lots of little changes, almost all minor code cleanups as the
Outreachy application process happened during this development cycle.
Also happened was a lot of IIO driver activity, and the typec USB code
moving out of staging to drivers/usb (same commits are in the USB tree
on a persistent branch to not cause merge issues.)
Overall, it's a wash, I think we added a few hundred more lines than
removed, but really only a few thousand were modified at all.
All of these have been in linux-next for a while. There might be a
merge issue with Al's vfs tree in the pi433 driver (take his changes,
they are always better), and the media tree with some of the odd atomisp
cleanups (take the media tree's version).
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-----BEGIN PGP SIGNATURE-----
iG0EABECAC0WIQT0tgzFv3jCIUoxPcsxR9QN2y37KQUCWgnFrg8cZ3JlZ0Brcm9h
aC5jb20ACgkQMUfUDdst+ymxbwCgtNlBkqD2JJYpLRKvI/C4w1vzZsEAnA2THRkt
g3ioPBqmqC/2DSbldr2o
=/ebw
-----END PGP SIGNATURE-----
Merge tag 'staging-4.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
Pull staging and IIO updates from Greg KH:
"Here is the "big" staging and IIO driver update for 4.15-rc1.
Lots and lots of little changes, almost all minor code cleanups as the
Outreachy application process happened during this development cycle.
Also happened was a lot of IIO driver activity, and the typec USB code
moving out of staging to drivers/usb (same commits are in the USB tree
on a persistent branch to not cause merge issues.)
Overall, it's a wash, I think we added a few hundred more lines than
removed, but really only a few thousand were modified at all.
All of these have been in linux-next for a while. There might be a
merge issue with Al's vfs tree in the pi433 driver (take his changes,
they are always better), and the media tree with some of the odd
atomisp cleanups (take the media tree's version)"
* tag 'staging-4.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (507 commits)
staging: lustre: add SPDX identifiers to all lustre files
staging: greybus: Remove redundant license text
staging: greybus: add SPDX identifiers to all greybus driver files
staging: ccree: simplify ioread/iowrite
staging: ccree: simplify registers access
staging: ccree: simplify error handling logic
staging: ccree: remove dead code
staging: ccree: handle limiting of DMA masks
staging: ccree: copy IV to DMAable memory
staging: fbtft: remove redundant initialization of buf
staging: sm750fb: Fix parameter mistake in poke32
staging: wilc1000: Fix bssid buffer offset in Txq
staging: fbtft: fb_ssd1331: fix mirrored display
staging: android: Fix checkpatch.pl error
staging: greybus: loopback: convert loopback to use generic async operations
staging: greybus: operation: add private data with get/set accessors
staging: greybus: loopback: Fix iteration count on async path
staging: greybus: loopback: Hold per-connection mutex across operations
staging: greybus/loopback: use ktime_get() for time intervals
staging: fsl-dpaa2/eth: Extra headroom in RX buffers
...
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.
By default all files without license information are under the default
license of the kernel, which is GPL version 2.
Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier. The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.
This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.
How this work was done:
Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
- file had no licensing information it it.
- file was a */uapi/* one with no licensing information in it,
- file was a */uapi/* one with existing licensing information,
Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.
The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne. Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.
The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed. Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.
Criteria used to select files for SPDX license identifier tagging was:
- Files considered eligible had to be source code files.
- Make and config files were included as candidates if they contained >5
lines of source
- File already had some variant of a license header in it (even if <5
lines).
All documentation files were explicitly excluded.
The following heuristics were used to determine which SPDX license
identifiers to apply.
- when both scanners couldn't find any license traces, file was
considered to have no license information in it, and the top level
COPYING file license applied.
For non */uapi/* files that summary was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 11139
and resulted in the first patch in this series.
If that file was a */uapi/* path one, it was "GPL-2.0 WITH
Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 WITH Linux-syscall-note 930
and resulted in the second patch in this series.
- if a file had some form of licensing information in it, and was one
of the */uapi/* ones, it was denoted with the Linux-syscall-note if
any GPL family license was found in the file or had no licensing in
it (per prior point). Results summary:
SPDX license identifier # files
---------------------------------------------------|------
GPL-2.0 WITH Linux-syscall-note 270
GPL-2.0+ WITH Linux-syscall-note 169
((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21
((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17
LGPL-2.1+ WITH Linux-syscall-note 15
GPL-1.0+ WITH Linux-syscall-note 14
((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5
LGPL-2.0+ WITH Linux-syscall-note 4
LGPL-2.1 WITH Linux-syscall-note 3
((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3
((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1
and that resulted in the third patch in this series.
- when the two scanners agreed on the detected license(s), that became
the concluded license(s).
- when there was disagreement between the two scanners (one detected a
license but the other didn't, or they both detected different
licenses) a manual inspection of the file occurred.
- In most cases a manual inspection of the information in the file
resulted in a clear resolution of the license that should apply (and
which scanner probably needed to revisit its heuristics).
- When it was not immediately clear, the license identifier was
confirmed with lawyers working with the Linux Foundation.
- If there was any question as to the appropriate license identifier,
the file was flagged for further research and to be revisited later
in time.
In total, over 70 hours of logged manual review was done on the
spreadsheet to determine the SPDX license identifiers to apply to the
source files by Kate, Philippe, Thomas and, in some cases, confirmation
by lawyers working with the Linux Foundation.
Kate also obtained a third independent scan of the 4.13 code base from
FOSSology, and compared selected files where the other two scanners
disagreed against that SPDX file, to see if there was new insights. The
Windriver scanner is based on an older version of FOSSology in part, so
they are related.
Thomas did random spot checks in about 500 files from the spreadsheets
for the uapi headers and agreed with SPDX license identifier in the
files he inspected. For the non-uapi files Thomas did random spot checks
in about 15000 files.
In initial set of patches against 4.14-rc6, 3 files were found to have
copy/paste license identifier errors, and have been fixed to reflect the
correct identifier.
Additionally Philippe spent 10 hours this week doing a detailed manual
inspection and review of the 12,461 patched files from the initial patch
version early this week with:
- a full scancode scan run, collecting the matched texts, detected
license ids and scores
- reviewing anything where there was a license detected (about 500+
files) to ensure that the applied SPDX license was correct
- reviewing anything where there was no detection but the patch license
was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
SPDX license was correct
This produced a worksheet with 20 files needing minor correction. This
worksheet was then exported into 3 different .csv files for the
different types of files to be modified.
These .csv files were then reviewed by Greg. Thomas wrote a script to
parse the csv files and add the proper SPDX tag to the file, in the
format that the file expected. This script was further refined by Greg
based on the output to detect more types of files automatically and to
distinguish between header and source .c files (which need different
comment types.) Finally Greg ran the script using the .csv files to
generate the patches.
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
New device support
* ti-dac082s085 dac
- new driver supporting 8, 10 and 12 bit TI DACs with 2 and 4 channels:
DAC082S085, DAC102S085, DAC122S085, DAC104s085 and DAC124S085.
Minor features and cleanps
* adc12138
- make array ch_to_mux static for small object code size reduction.
* sun4i-gpadc
- use of_device_get_match_data rather than opencoding it.
* stm32 trigger
- add tim15 tigger on STM32H7
- check clock rate to avoid potential division by zero
* tsl2x7x staging cleanups.
- move *_thresh_period to being created by IIO core.
- remove unused tsl2x7x_parse_result structure.
- sort includes
- drop a repeat iio_dev forward definition
- fix some code alignment of defines.
- use IIO_CONST_ATTR for constant string attribute
- drop some unnecessary parentheses
- fix various alignment with parenthese
- rename power defines for readability reasons
- fix a missaligned break statement
- Tidy up function definitions so they fit on a single line.
-----BEGIN PGP SIGNATURE-----
iQJFBAABCAAvFiEEbilms4eEBlKRJoGxVIU0mcT0FogFAlnyJXQRHGppYzIzQGtl
cm5lbC5vcmcACgkQVIU0mcT0FogSMw/9Hv7euztsUr7lq+6pN+lXZVBCTveIxqf8
JSKoUt7unA0OqlZAyQv2oR2Vd6/d0Oy6WuAgpBg/mXEjBYC5/yy2NdXKLFvG0HVX
5JdaKg+ZVTzGceWk75fEFbQ+6bzonXGwkWGMEqV+tb3MPQPD1ffP222pjj6Q8nqZ
9c72WsScZhU5FxvJsyD31pAx0BxPUTKQKU/ShFF5o1jtQPo/rtoLKQDB4tysaJ9g
SK5CKvoZMZScMffUnhGUTCOQEXUiew3jgSEHWOpl5JYAO/tTwDkR6EpLAbkbkNFr
wvwPErfuxoY/PAXuJDQaBX3/wrGqd4UBj0w+w+l3CbkkX8xvmdfVVr+ri501QHUO
pZYxdvQ5u+lBn6bkTjzf7A2IbT7Y1rdJJvTSIcRieFGmJ3nTOjrWNEo5QnxR5IME
xR4qHgABqwFJ6dZSgofJ2yWH/t9zjz66guY1IkH3+yzeOjnSAGlrXY3+bJrCJpL8
vgvNnTwHAWdKYx+1luPTN5vWqB/2ylWcgP2LK/cxslSP1l1jT+JmqmfQ9ydk8NgG
CT4DuoH0ECSHmWpvPgv6Lu6wJ60hZH5y5u1O7gr2MndYOPGg3L0a7aFWUtzzHgGj
9GVolsgFHoKGq2hr5FZ5fFJk88FRZP2U7Vus07r34XWuxZItn1aYqHqRTLgaa2hU
Z9TMNvh4RS4=
=IXO+
-----END PGP SIGNATURE-----
Merge tag 'iio-for-4.15c' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next
Jonathan writes:
Third set of new device support, cleanups and features for IIO in the 4.15 cycle
New device support
* ti-dac082s085 dac
- new driver supporting 8, 10 and 12 bit TI DACs with 2 and 4 channels:
DAC082S085, DAC102S085, DAC122S085, DAC104s085 and DAC124S085.
Minor features and cleanps
* adc12138
- make array ch_to_mux static for small object code size reduction.
* sun4i-gpadc
- use of_device_get_match_data rather than opencoding it.
* stm32 trigger
- add tim15 tigger on STM32H7
- check clock rate to avoid potential division by zero
* tsl2x7x staging cleanups.
- move *_thresh_period to being created by IIO core.
- remove unused tsl2x7x_parse_result structure.
- sort includes
- drop a repeat iio_dev forward definition
- fix some code alignment of defines.
- use IIO_CONST_ATTR for constant string attribute
- drop some unnecessary parentheses
- fix various alignment with parenthese
- rename power defines for readability reasons
- fix a missaligned break statement
- Tidy up function definitions so they fit on a single line.
The two properties unique to each supported chip, resolution and number
of channels, are currently gleaned from the chip's name.
E.g. dac102s085 is a dual channel 10-bit DAC.
^^^
This was deemed unmaintainable by the subsystem maintainer once the
driver is extended to support further chips, hence it was requested
to add an explicit table for chip-specific information and use an
enum to reference into it.
This adds 17 LoC without any immediate gain, so make the change in a
separate commit which can be reverted if we determine in 10 years that
it was unnecessary.
Signed-off-by: Lukas Wunner <lukas@wunner.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
The DACrrcS085 (rr = 08/10/12, c = 2/4) family of SPI DACs was
inherited by TI when they acquired National Semiconductor in 2011.
This driver was developed for and tested with the DAC082S085 built into
the Revolution Pi by KUNBUS, but should work with any of the other
chips as they share the same programming interface.
There is also a family of I2C DACs with just a single channel called
DACrr1C08x (rr = 08/10/12, x = 1/5). Their programming interface is
very similar and it should be possible to extend the driver for these
chips with moderate effort. Alternatively they could be integrated into
ad5446.c. (The AD5301/AD5311/AD5321 use different power-down modes but
otherwise appear to be comparable.)
Furthermore there is a family of 8-channel DACs called DACrr8S085
(rr = 08/10/12) as well as two 16-bit DACs called DAC161Sxxx
(xxx = 055/997). These are more complicated devices with support for
daisy-chaining and the ability to power down each channel separately.
They could either be handled by a separate driver or integrated into the
present driver with a larger effort.
Cc: Mathias Duckeck <m.duckeck@kunbus.de>
Signed-off-by: Lukas Wunner <lukas@wunner.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
The usage of of_device_get_match_data reduce the code size a bit.
Furthermore, it prevents an improbable dereference when
of_match_device() return NULL.
Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Don't populate const array ch_to_mux on the stack, instead
make it static. Makes the object code smaller by over 200 bytes:
Before:
text data bss dec hex filename
12663 1648 128 14439 3867 drivers/iio/adc/ti-adc12138.o
After
text data bss dec hex filename
12353 1744 128 14225 3791 drivers/iio/adc/ti-adc12138.o
(gcc version 7.2.0 x86_64)
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Add check on STM32 ADC clock rate to report an explicit error.
This may avoid division by 0 later in stm32-adc driver.
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Add TIM15_TRGO trigger that is now supported on STM32H7.
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Make the argument of the functions iio_sw{d/t}_group_init_type_name const
as they are only passed to the function config_group_init_type_name having
the argument as const.
Make the config_item_type structures const as they are either passed to
the functions having the argument as const or they are
stored in the const "ci_type" field of a config_item structure.
Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Acked-by: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Add driver to support older EC firmware that only support deprecated
ec command. Rely on ACPI memory map register to access sensor
information.
Present same interface as the regular cros_ec sensor stack:
- one iio device per accelerometer
- use HTML5 axis definition
- use iio abi units
- accept calibration calls, but do nothing
Chrome can use the same code than regular cros_ec sensor stack to
calculate orientation and lid angle.
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Signed-off-by: Thierry Escande <thierry.escande@collabora.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This fix allows platforms to probe correctly even if the
trigger edge property is missing. The hardware trigger
will no longer be registered in the sybsystem
Preserves backwards compatibility with the support that
was in the driver before the hardware trigger.
https://storage.kernelci.org/mainline/master/v4.14-rc2-255-g74d83ec2b734/arm/sama5_defconfig/lab-free-electrons/boot-at91-sama5d2_xplained.txt
Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Fixes: 5e1a1da0f ("iio: adc: at91-sama5d2_adc: add hw trigger and buffer support")
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
One of the user complained that on his system Thinkpad Yoga S1, with
commit f1664eaace ("iio: hid-sensor-trigger: Fix the race with user
space powering up sensors") causes the system to resume immediately
on suspend (S3 operation). On this system the sensor hub is on USB
and is a wake up device from S3. So if any sensor sends data on
motion, the system will wake up. This can be a legitimate use case
to wake up device motion, but that needs proper user space support
to set right thresholds.
In fact the above commit didn't cause this regression, but any operation
which cause sensors to wake up would have caused the same issue. So if
user reads the raw sensor data, same issue occurs, with or without this
commit. Only difference is that the above commit by default will trigger
a power up and power down of sensors as part of runtime pm enable
(runtime enable will cause a runtime resume callback followed by
runtime_suspend callback). Previously user has to do some action on
sensors.
On investigation it was observed that the current driver correctly
changing the state of all sensors to power off but then also some sensor
will still send some data. Only option is to never power up any sensor.
Only good option is to:
- Using sysfs interface disable USB as a wakeup device (This will not
need any driver change)
Since some user don't care about sensors. So for those users this change
brings back old functionality. As long as they don't cause any operation
to power up sensors (like raw read or start iio-sensor-proxy service),
the sensors will not be to touched. This is done by delaying run time
enable till user space does some operation with sensors.
Link: https://bugzilla.kernel.org/show_bug.cgi?id=196853
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Driver for RF Digital RFD77402 VCSEL (vertical-cavity surface-emitting
laser) Time-of-Flight (ToF) sensor to measure distance up to 2 m with
millimeter precision
Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
add support to STMicroelectronics LIS3DHH accel sensor
http://www.st.com/resource/en/datasheet/lis3dhh.pdf
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Do not try to configure sample frequency if the sensor do not export
odr register address in register map. That change will be used to
properly support LIS3DHH accel sensor.
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Define st_sensor_int_drdy structure in st_sensor_data_ready_irq in order
to contain irq line parameters of the device.
Moreover separate data-ready open-drain configuration parameters for INT1
and INT2 pins in st_sensor_data_ready_irq data structure.
That change will be used to properly support LIS3DHH accel sensor.
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Add SPI Serial Interface Mode (SIM) register information
to STM pressure framework
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Add SPI Serial Interface Mode (SIM) register information to
LIS3MDL magn sensor
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Add SPI Serial Interface Mode (SIM) register information
to STM gyroscope framework
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
add support to STMicroelectronics LIS2DW12 accelerometer in
st_accel framework
http://www.st.com/resource/en/datasheet/lis2dw12.pdf
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
New devices (e.g. LIS2DW12) enable all axis by default and do not export
that capability in register map. Check if the enable_axis register
address has been declared in st_sensor_settings map in order to verify if
the driver needs to enable all sensor axis
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Separate data-ready configuration parameters for INT1 and INT2 pins in
st_sensor_data_ready_irq data structure. That change will be use to
properly support LIS2DW12 accel sensor.
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Introduce register mask for data-ready status register since
pressure sensors (e.g. LPS22HB) export just two channels
(BIT(0) and BIT(1)) and BIT(2) is marked reserved while in
st_sensors_new_samples_available() value read from status register
is masked using 0x7.
Moreover do not mask status register using active_scan_mask since
now status value is properly masked and if the result is not zero the
interrupt has to be consumed by the driver. This fix an issue on LPS25H
and LPS331AP where channel definition is swapped respect to status
register.
Furthermore that change allows to properly support new devices
(e.g LIS2DW12) that report just ZYXDA (data-ready) field in status register
to figure out if the interrupt has been generated by the device.
Fixes: 97865fe413 (iio: st_sensors: verify interrupt event to status)
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
These ADCs are marketed as single-channel 22 bit delta-sigma ADCs, but
in reality their resolution is 21 bit with an overrange or underrange
of 12% beyond Vref. In other words, "full scale" means +/- 2^20.
This driver does not explicitly signal back to the user when an
overrange or underrange occurs, but the user can detect it by comparing
the raw value to +/- 2^20 (or the scaled value to Vref).
The chips feature an extended temperature range and high accuracy,
low noise characteristics, but their conversion times are slow with
up to 80 ms +/- 2% (on the MCP3550-50).
Hence, unlike the other ADCs supported by the driver, conversion does
not take place in realtime upon lowering CS. Instead, CS is asserted
for 8 usec to start the conversion. After waiting for the duration of
the conversion, the result can be fetched. While waiting, control of
the bus is ceased so it may be used by a different device.
After the result has been fetched and 10 us have passed, the chip goes
into shutdown and an additional power-up delay of 144 clock periods is
then required to wake the analog circuitry upon the next conversion
(footnote below table 4-1, page 16 in the spec).
Optionally, the chips can be used in so-called "continuous conversion
mode": Conversions then take place continuously and the last result may
be fetched at any time without observing a delay. The mode is enabled
by permanently driving CS low, e.g. by wiring it to ground. The driver
only supports "single conversion mode" for now but should be adaptable
to "continuous conversion mode" with moderate effort.
The chips clock out a 3 byte word, unlike the other ADCs supported by
the driver which all have a lower resolution than 16 bit and thus make
do with 2 bytes. Calculate the word length on probe by rounding up the
resolution to full bytes. Crucially, if the clock idles low, the
transfer is preceded by a useless Data Ready bit which increases its
length from 24 bit to 25 bit = 4 bytes (section 5.5 in the spec).
Autosense this based on the SPI slave's configuration.
Cc: Mathias Duckeck <m.duckeck@kunbus.de>
Signed-off-by: Lukas Wunner <lukas@wunner.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
According to the ABI documentation, the shunt resistor value should be
specificied in Ohm. As this is also used/documented for the MAX9611,
use the same for the INA2xx driver.
This poses an ABI break for anyone actually altering the shunt value
through the sysfs interface, it does not alter the default value nor
a value set from the devicetree.
Minor change: Fix comment, 1mA is 10^-3A.
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Introduce FIFO ops data structure to contain FIFO related parameters
in order to properly support more devices in st_lsm6dsx driver
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Move FIFO decimator info in st_lsm6dsx_sensor_settings list since
decimator registers are exported in register map just in
lsm6ds3/lsm6ds3h/lsm6dsl/lsm6dsm sensors and not in other compliant
devices
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Separate fifo mode and max fifo sample rate configuration.
That change will be necessary to reuse st_lsm6dsx_set_fifo_mode()
routine and to support more devices in st_lsm6dsx driver
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Express max fifo depth in ST_LSM6DSX_SAMPLE_SIZE instead of in bytes.
That change will be necessary to properly support more devices
in st_lsm6dsx driver
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Use the of_device_get_match_data() helper instead of open coding.
Note that the rcar-gyroadc driver is used with DT only, so there's
always a valid match.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
The rcar-gyroadc driver compiles fine on other platforms, hence increase
compile coverage.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
On 64-bit:
drivers/iio/adc/rcar-gyroadc.c: In function 'rcar_gyroadc_parse_subdevs':
drivers/iio/adc/rcar-gyroadc.c:352:15: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
childmode = (unsigned int)of_id->data;
^
Cast the pointer to uintptr_t instead of unsigned int to fix this.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
The reported scale was only correct for the default settings of 100 ms
integration time and gain 1.
This aligns the reported scale with the behaviour of any other IIO driver
and the documented ABI, but may require userspace changes if someone uses
non-default settings.
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Instead of manually iterating the array of allowed gain values, use
find_closest. Storing the current gain setting avoids accessing the
hardware on each query.
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Instead of reading the value from the register on each query, store the
set value.
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This improves code uniformity (range checks for als_gain are also done
in the setter). Also unmangle rounding and calculation of register value.
The calculated integration time it_ms is required in the next patch of
the series.
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
KXTF9 has mostly compatible register layout to KXCJK accelerometer.
There is no motion direction interrupt support, but there is tap
direction detection instead (not implemented in this patch).
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Make sampling_frequency_avail per-type - like sampling_frequency is.
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
In preparation for KXTF9 support, make sampling_frequency_avail
attribute dynamic.
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Extract reporting of motion event direction from interrupt handler,
as it is not supported by KXTF9.
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Fix INT_CTRL1 bit names to match register name and add names
for INT_SRC1 bits.
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Refactor ODR/WUF setting code in preparation of KXTF9 support.
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
'mma8452_read_thresh' and 'mma8452_write_thresh' functions
does more than just read/write threshold values.
They also handle IIO_EV_INFO_HIGH_PASS_FILTER_3DB and
IIO_EV_INFO_PERIOD therefore renaming to generic names.
Improves code readability, no impact on functionality.
Signed-off-by: Harinath Nampally <harinath922@gmail.com>
Acked-by: Martin Kepplinger <martink@posteo.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Before this patch, forgetting to put a thermal-zones DT node would
result in the driver failing to probe.
It should be perfectly acceptable to have the driver probe even if no
thermal-zones DT is found. However, it shouldn't want to fail if the
thermal registering fail for any other reason (waiting for other drivers
for example) so check on ENODEV only.
Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This driver has a get_temp function used by the thermal framework that
uses pm functions.
However, the driver isn't registered in pm before it is registered in
thermal framework, resulting in the pm_resume not being called and thus
the IP not enabled.
When the IP is disabled, the raw temp value is always 0. With the
devices currently supported, it isn't a problem since with their
respective formula, they return a really cold SoC temperature which
isn't a problem for the thermal framework. But for future SoC that have
a different formula, it could return a critically hot temperature,
forcing the thermal framework to shutdown the board.
Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>