Go to error_ret if sca3000_read_ctrl_reg() failed.
Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Add ACPI device ID matching for TI ADC081C/ADC101C/ADC121C ADCs.
Signed-off-by: Dan O'Donovan <dan@emutex.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
The trigger name is documented as unique but drivers are currently
allowed to register triggers with duplicate names. This should be
considered a bug since it makes the 'current_trigger' interface
unusable.
Signed-off-by: Crestez Dan Leonard <leonard.crestez@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Initialize trig_num to -1 and handle trig_num=0 as a valid id.
Fixes: 7c7e9dad (iio: iio_generic_buffer: Add --trigger-num option)
Signed-off-by: Crestez Dan Leonard <leonard.crestez@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Set current email address to replace previous employers email addresses.
Cc: Jonathan Cameron <jic23@kernel.org>
Cc: Daniel Baluta <daniel.baluta@intel.com>
Cc: linux-iio@vger.kernel.org
Signed-off-by: Matt Ranostay <mranostay@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Set current email address instead of previous employers email address.
Signed-off-by: Adriana Reus <adi.reus@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
NXP took over Freescale, so add NXP to the driver descriptions
Signed-off-by: Martin Kepplinger <martink@posteo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Replace the code that guarantees the device stays in direct mode
with iio_device_claim_direct_mode() which does same. Includes a
tiny bit of refactoring (single case -> if) and simplified return
flow.
Also prevents a theoretical race condition by effectively taking the lock
a little earlier than before.
Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Cc: Daniel Baluta <daniel.baluta@gmail.com>
Acked-by: Jacek Anaszewski <j.anaszewski@samsung.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Replace the code that guarantees the device stays in direct mode
with iio_device_claim_direct_mode() which does same. This allows
removal of an unused lock in the device private global data.
Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Cc: Daniel Baluta <daniel.baluta@gmail.com>
Acked-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Replace the code that guarantees the device stays in direct mode
with iio_device_claim_direct_mode() which does same. This allows
removal of an unused lock in the device private global data.
Also prevents a previous race condition when a buffer is enabled whilst
a raw read is going on.
Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Cc: Daniel Baluta <daniel.baluta@gmail.com>
Acked-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Replace the code that guarantees the device stays in direct mode
with iio_device_claim_direct_mode() which does same. This allows
removal of an unused lock in the device private global data.
Also prevents a possible race around a buffer being enabled whilst
a read is going on.
Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Cc: Daniel Baluta <daniel.baluta@gmail.com>
Acked-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Switch from using indio_dev->mlock to the iio_device_claim_*_mode
helper functions.
Signed-off-by: Matt Ranostay <mranostay@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This patch is in response to that of
Gregor Boirie <gregor.boirie@parrot.com>
who proposed using a tight kthread within a device driver (be it with the
support factored out into a helper library) in order to basically spin as
fast as possible.
It is meant as a talking point rather than a formal proposal of the code
(though we are heading towards that I think).
Also gives people some working code to mess around with.
I proposed that this could be done with a trigger with a few constraints
and this is the proof (be it ugly) of that.
There are some constraints though, some of which we would want to relax
if this were to move forward.
* Will only run the thread part of the registered pollfunc. This is to
avoid the overhead of jumping in and out of interrupt context. Is the
overhead significant? Not certain but feels like it should be!
* This limitation precludes any device that 'must' do some work in
interrupt context. However, that is true of few if any drivers and
I suspect that any that do will be restricted to using triggers they
provide themselves. Usually we have a top half mainly to grab a
timestamp as soon after the dataready type signal as possible.
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Daniel Baluta <daniel.baluta@intel.com>
Fix the code formatting to use the kernel preferred style
of using the actual variables to determize the size using
the sizeof() operator.
Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Driver was checking for direct mode and trying to lock it, but
left a gap where mode could change before the desired operation.
Use iio_device_claim_direct_mode() to guarantee device stays in
direct mode.
Refactor function to clarify look-up followed by lock sequence.
Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Cc: Daniel Baluta <daniel.baluta@gmail.com>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Driver was checking for direct mode and trying to lock it, but
left a gap where mode could change before the desired operation.
Use iio_device_claim_direct_mode() to guarantee device stays in
direct mode.
Refactor function to clarify look-up followed by lock sequence.
Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Cc: Daniel Baluta <daniel.baluta@gmail.com>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This makes it possible to distinguish between iio devices with the same
name.
Signed-off-by: Crestez Dan Leonard <leonard.crestez@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This will clean (disable buffer/trigger/channels) when doing
something like a CTRL-C. Otherwise restarting generic_buffer requires a
manual echo 0 > buffer/enable
This also cleanup up all the code freeing string buffers at
the end of main. We initialize all pointers to NULL so that cleanup can
all be done under a single error label.
Signed-off-by: Crestez Dan Leonard <leonard.crestez@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
MODULE_ALIAS isn't needed since the module name is the same as the alias
defined.
Signed-off-by: Matt Ranostay <mranostay@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
bmc150 driver supports also BMC156 and BMM150 chips.
Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This makes it clear that generic_buffer is an IIO tool
and also complies with filename conventions in tools/iio.
Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Add options to the Makefile for install/uninstall similar to other tools.
Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Replace the code that guarantees the device stays in direct mode
with iio_device_claim_direct_mode() which does same.
Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Acked-by: Daniel Baluta <daniel.baluta@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Replace the code that guarantees the device stays in direct mode
with iio_device_claim_direct_mode() which does same.
Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Acked-by: Daniel Baluta <daniel.baluta@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Replace the code that guarantees the device stays in direct mode
with iio_device_claim_direct_mode() which does same.
Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Acked-by: Daniel Baluta <daniel.baluta@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Replace the code that guarantees the device stays in direct mode
with iio_device_claim_direct_mode() which does same.
Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Acked-by: Daniel Baluta <daniel.baluta@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Driver was checking for direct mode but not locking it down.
Use iio_device_claim_direct_mode() to guarantee device stays
in direct mode.
Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Acked-by: Daniel Baluta <daniel.baluta@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Ensure failure to enable power regulators is properly handled.
Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Use SMBus "block read" protocol only when supported by adapter.
Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Remove st_sensors_get_buffer_element symbol export since not explicitly
used outside of st_sensors driver.
Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Initial support for ST LPS22HB pressure sensor. Datasheet:
http://www2.st.com/resource/en/datasheet/lps22hb.pdf
Features:
* pressure data and timestamping channels
* sampling frequency selection
* interrupt based trigger
* over I2C or SPI
Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This structure has not been optional for a long time (if ever) but the
code implies that it is. As we then use it later in a fashion that would
crash if it was in fact NULL, it's inconsistent so fix it up by removing
unnecessary checks.
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Add datasheet names for ADC channels to allow iio consumers access.
Signed-off-by: Matt Ranostay <matt.ranostay@intel.com>
Acked-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Submitters of device tree binding documentation may forget to CC
the subsystem maintainer if this is missing.
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Jonathan Cameron <jic23@kernel.org>
Cc: linux-iio@vger.kernel.org
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Submitters of device tree binding documentation may forget to CC
the subsystem maintainer if this is missing.
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
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: Jonathan Cameron <jic23@kernel.org>
Enable humidity support for the BME280 part
Signed-off-by: Matt Ranostay <matt.ranostay@intel.com>
Acked-by: Vlad Dogaru <vlad.dogaru@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This driver does not call i2c_smbus_read|write_byte_data(),
so remove the corresponding functionality test. It uses regmap
to handle byte transfers transparently.
Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Reviewed-by:Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
Reviewed-by: Matt Ranostay <matt.ranostay@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
The Nuvoton NAU7802 ADC is able to adjust its gain but prior knowledge of
its possible values was required to adjust it. Users had to guess the
possible gain values based on the ADC datasheet or on this driver's code.
This exposes the possible values in the in_voltage_scale_available file of
each nau7802 ADC device. The gain is set for the whole ADC and is therefore
not configurable by channel. Thus, there exists only one
in_voltage_scale_available file for each nau7802 ADC device even if it has
two separate channels.
Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com>
Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
The I2C drivers have an i2c_device_id array but that information isn't
exported to the modules using the MODULE_DEVICE_TABLE() macro. So the
modules autoloading won't work if the I2C device is registered using
OF or legacy board files due missing alias information in the modules.
The issue was found using Kieran Bingham's coccinelle semantic patch:
https://lkml.org/lkml/2016/5/10/520
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
TI ADS1115 is a 16-bit resolution ADC that is register map
compatible with the ADS1015 device.
Signed-off-by: Matt Ranostay <matt.ranostay@intel.com>
Acked-by: Daniel Baluta <daniel.baluta@intel.com>
Acked-by: Crt Mori <cmo@melexis.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>