Eva Rachel Retuya [Thu, 20 Oct 2016 13:08:23 +0000 (21:08 +0800)]
staging: iio: ad7606: rework regulator handling
Currently, this driver ignores all errors from regulator_get(). The way
it is now, it also breaks probe deferral (EPROBE_DEFER). The correct
behavior is to propagate the error to the upper layers so they can
handle it accordingly.
Rework the regulator handling so that it matches the standard behavior.
If the specific design uses a static always-on regulator and does not
explicitly specify it, regulator_get() will return the dummy regulator.
Suggested-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Eva Rachel Retuya [Thu, 20 Oct 2016 13:08:22 +0000 (21:08 +0800)]
staging: iio: ad7606: set proper supply name to devm_regulator_get()
The name passed to devm_regulator_get() should match the name of the
supply as specified in the device datasheet. The supply on this device
is called 'AVcc' while currently, the driver uses just 'vcc'.
Use 'avcc' to specify the supply voltage since it is custom to use the
lower-caps version of the datasheet name.
Suggested-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Lars-Peter Clausen [Wed, 19 Oct 2016 17:07:08 +0000 (19:07 +0200)]
staging:iio:ad7606: Move buffer code to main source file
Currently the ad7606 buffer handling code resides in its own source file.
But this file contains only 4 small functions of which half are just
wrappers around other functions. Buffer support is also always enabled for
this driver, so move them over to the main source file. This reduces the
amount of boilerplate code.
Also rename the main function from ad7606_core.c to ad7606.c since there is
only a single file now.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Lars-Peter Clausen [Wed, 19 Oct 2016 17:07:07 +0000 (19:07 +0200)]
staging:iio:ad7606: Use GPIO descriptor API
Convert the ad7606 driver away from the deprecated legacy GPIO API and use
the new GPIO descriptor API.
This also means that the platform data struct is now empty and can be
removed.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Lars-Peter Clausen [Wed, 19 Oct 2016 17:07:06 +0000 (19:07 +0200)]
staging:iio:ad7606: Run trigger handler only once per trigger event
Currently the ad7606 driver installs the same function for the hard-irq and
threaded trigger handlers. This was introduced in commit
1caf7cb46135
("staging:iio:adc:ad7606 Convert to new channel registration method Update
Add missing call to iio_trigger_notify_done() Set pollfunc top and bottom
half handler"). Unfortunately the commit message does not mention why this
was done and Michael does not remember either.
Since the trigger handler function is idempotent (set a GPIO to 1) running
it twice does not do any harm, but is simply not necessary either. So set
the threaded trigger handler for the driver to NULL.
While we are at it also remove the function description comment that does
no say anything that can't be derived from the function name itself.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Lars-Peter Clausen [Wed, 19 Oct 2016 17:07:05 +0000 (19:07 +0200)]
staging:iio:ad7606: Let common remove function take a struct device *
Currently the common remove function takes a struct iio_dev *. This
parameter is retrieved by the individual driver remove functions by calling
get_drvdata() on their device. To simplify the code let the common remove
function directly take a struct dev * and do the IIO device in retrieval
the common remove function.
This also aligns the interface with the common probe function.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Lars-Peter Clausen [Wed, 19 Oct 2016 17:07:04 +0000 (19:07 +0200)]
staging:iio:ad7606: Let the common probe function return int
The common probe function for the ad7606 currently returns a struct iio_dev
pointer. The returned value is not used by the individual driver probe
functions other than for error checking.
Let the common probe function return a int instead to report the error
value directly (or 0 on success). This allows to simplify the code.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Lars-Peter Clausen [Wed, 19 Oct 2016 17:07:03 +0000 (19:07 +0200)]
staging:iio:ad7606: Move set_drvdata() into common code
Both the platform_device and SPI driver call set_drvdata() at the end of
their probe function. Move this into the common probe() function to reduce
duplicated code.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Lars-Peter Clausen [Wed, 19 Oct 2016 17:07:02 +0000 (19:07 +0200)]
staging:iio:ad7606: Factor out common code between periodic and one-shot capture
Both the periodic buffer based and one-shot sysfs based capture methods
share a large portion of their code. Factor this out into a common helper
function.
Also provide a comment that better explains in more detail what is going on
in the capture function.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Lars-Peter Clausen [Wed, 19 Oct 2016 17:07:01 +0000 (19:07 +0200)]
staging:iio:ad7606: Avoid allocating buffer for each data capture
Currently the ad7606 driver dynamically allocates and frees a transfer
buffer each time a sample capture is performed in buffered mode, which
introduces unnecessary overhead. The driver state struct already contains a
buffer that is used for transfers in one-shot mode. This buffer is large
enough to hold all samples, but not the timestamp that might be present in
buffered mode. Extend the buffer size to be able to contain the timestamp
and update the buffered capture function to use this buffer.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Lars-Peter Clausen [Wed, 19 Oct 2016 17:07:00 +0000 (19:07 +0200)]
staging:iio:ad7606: Use oversampling ratio of 1 for no oversampling
Currently the ad7606 driver uses a value of 0 for the oversampling ratio to
express that no oversampling is done. Strictly speaking this means though
that no data capture is done at all. Instead change the driver to use a
value of 1, this is in accordance with what other drivers do and what the
IIO spec suggests.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Lars-Peter Clausen [Wed, 19 Oct 2016 17:06:59 +0000 (19:06 +0200)]
staging:iio:ad7606: Remove out-of-band error reporting
Currently the ad7606 driver prints a error message to the kernel log when
an application writes an invalid value to a sysfs attribute. While for
initial driver development and testing this might be useful it is quite
disadvantageous in a production environment. The write() call to the sysfs
attribute will already return an error if the value was invalid so the
application is aware that the operation failed. And generally speaking it
is impossible for an application to reliably match a log message in the
kernel log to a specific operation it performed, so the message becomes
just noise and might distract from more critical messages.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Lars-Peter Clausen [Wed, 19 Oct 2016 17:06:58 +0000 (19:06 +0200)]
staging:iio:ad7606: Remove default device configuration from platform data
While for some very selected setups it might be useful to be able to
provide default configuration data via the platform data, generally this
becomes very impractical as the number of configuration options increases.
So the general policy is to use the power-on default values of the device
and let the application using the device configure it according to its
needs.
Implement this scheme for the ad7606 driver by removing support for
specifying a default configuration via the platform data.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Lars-Peter Clausen [Wed, 19 Oct 2016 17:06:57 +0000 (19:06 +0200)]
staging:iio:ad7606: Remove redundant name field from ad7606_chip_info
The name field in the ad7606_chip_info struct is set to the same value as
the as the name field in the corresponding {platform,spi}_device_id table
entry. Remove it from the ad7606_chip_info struct and pass the name from
the ID to the probe function. This slightly reduces the size of the
chip_info table and adding new entries requires less boilerplate.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Lars-Peter Clausen [Wed, 19 Oct 2016 17:06:56 +0000 (19:06 +0200)]
staging:iio:ad7606: Remove unused int_vref_mv field
Remove the int_vref_mv field from the ad7606_chip_info struct since the
field is never used by the driver. The value is also the same for all
derivatives of this chip, so if it will ever be used in the driver a
constant value will work just fine.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Eva Rachel Retuya [Thu, 20 Oct 2016 09:19:24 +0000 (17:19 +0800)]
tools: iio: iio_generic_buffer: drop unneeded parentheses
Remove extra parentheses introduced in commit <
73e176a tools: iio:
iio_generic_buffer: add -A to force-enable all channels>.
Suggested-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Eva Rachel Retuya [Thu, 20 Oct 2016 09:19:23 +0000 (17:19 +0800)]
tools: iio: iio_generic_buffer: rename and change type of force variable
Replace the type of 'force' flag from int to bool and at the same time
rename it to 'force_autochannels' for better readability.
Suggested-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Lorenzo Bianconi [Thu, 13 Oct 2016 20:06:05 +0000 (22:06 +0200)]
Documentation: dt: iio: humidity: add hts221 sensor device binding
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Lorenzo Bianconi [Thu, 13 Oct 2016 20:06:04 +0000 (22:06 +0200)]
iio: humidity: add support to hts221 rh/temp combo device
Add support to STM HTS221 humidity + temperature sensor
http://www.st.com/resource/en/datasheet/hts221.pdf
- continuous mode support
- i2c support
- spi support
- trigger mode support
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Alison Schofield [Sun, 16 Oct 2016 05:02:19 +0000 (22:02 -0700)]
iio: light: ltr501: claim direct mode during raw writes
Driver was checking for direct mode but not locking it. Use
claim/release helper functions to guarantee the device stays
in direct mode during all raw write operations.
Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Acked-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Alison Schofield [Sun, 16 Oct 2016 05:00:53 +0000 (22:00 -0700)]
iio: light: ltr501: claim direct mode during select raw reads
Driver was checking for direct mode but not locking it. Use
claim/release helper functions to guarantee the device stays
in direct mode during required raw read cases.
Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Acked-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Jonathan Cameron [Sat, 8 Oct 2016 16:39:18 +0000 (17:39 +0100)]
staging:iio:accel:sca3000 Move out of staging.
Now the driver is in a reasonable state, lets get it (finally) out
of staging.
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Jonathan Cameron [Sat, 8 Oct 2016 16:39:17 +0000 (17:39 +0100)]
staging:iio:accel:sca3000 kernel docify comments that were nearly kernel doc.
Basic tidy up of comments to bring them into a standard style.
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Jonathan Cameron [Sat, 8 Oct 2016 16:39:16 +0000 (17:39 +0100)]
staging:iio:accel:sca3000 small checkpatch fixes (alignment etc)
Tidied up where checkpatch warning suppressions doesn't effect the
readability of the code.
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Jonathan Cameron [Sat, 8 Oct 2016 16:39:15 +0000 (17:39 +0100)]
staging:iio:accel:sca3000 Tidy up probe order to avoid a race.
Previously the device was exposed to userspace and in kernel consumers
before the interrupts had been configured. As nothing stopped them being
enabled in the interval this could cause unhandled interrupts.
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Jonathan Cameron [Sat, 8 Oct 2016 16:39:14 +0000 (17:39 +0100)]
staging:iio:accel:sca3000 replace non standard revision attr with dev_info on probe
There seems little point in being able to query the part revision number
via sysfs. Hence just put it in the kernel logs during probe incase
anyone ever wants to know.
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Jonathan Cameron [Sat, 8 Oct 2016 16:39:13 +0000 (17:39 +0100)]
staging:iio:accel:sca3000 Drop custom measurement mode attributes
This is now represented by the standard 3db filter frequency controls.
Things get complex wrt to the sampling frequency as these modes change
but that is fine under the IIO ABI where any value is allowed to effect
any other.
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Jonathan Cameron [Sat, 8 Oct 2016 16:39:12 +0000 (17:39 +0100)]
staging:iio:accel:sca3000 Add write support to the low pass filter control
Also includes an available attribute. The ordering of values appears
a bit random, but as the ABI doesn't specify this and we already have
both rising and falling lists I think this is fine.
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Jonathan Cameron [Sat, 8 Oct 2016 16:39:11 +0000 (17:39 +0100)]
staging:iio:accel:sca3000: Fix off by one error in axis due to IIO_NO_MOD
Given the introduction of IIO_NO_MOD was prior to the first submission
prior to IIO entering staging this has been broken for a while.
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Jonathan Cameron [Sat, 8 Oct 2016 16:39:10 +0000 (17:39 +0100)]
staging:iio:accel:sca3000 add readback of the 3db low pass filter frequency
Driving towards getting rid of the non standard mode control interface.
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Jonathan Cameron [Sat, 8 Oct 2016 16:39:09 +0000 (17:39 +0100)]
staging:iio:accel:sca3000 Clean up register defines.
Introduce some more masks and generally drive towards consistent naming.
Note the small indents used to indicate parts of registers + parts of
multiplexed registers.
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Jonathan Cameron [Sat, 8 Oct 2016 16:39:08 +0000 (17:39 +0100)]
staging:iio:accel:sca3000 use a 'fake' channel to handle freefall event registration.
This is an approach used in some newer drivers as it exposes the
compound channel events to the core rather than hiding their control
in sysfs attributes entirely via the driver.
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Jonathan Cameron [Sat, 8 Oct 2016 16:39:07 +0000 (17:39 +0100)]
staging:iio:accel:sca3000 drop some unused variables.
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Jonathan Cameron [Sat, 8 Oct 2016 16:39:06 +0000 (17:39 +0100)]
staging:iio:accel:sca3000 move to hybrid hard / soft buffer design.
In a similar fashion to other newer drivers (e.g. ti_am335x), instead
of using the hardware buffer support in IIO to directly access the hardware
fifo, insert a software fifo and feed that from the hardware one when
interrupts occur. This gives a simpler structure to the data flows and
allows more flexibility over how often data is shipped to userspace etc.
This was also the only direct user of the simplistic generalization found
in ring_hw.h so that header is removed.
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Jonathan Cameron [Sat, 8 Oct 2016 16:39:05 +0000 (17:39 +0100)]
staging:iio:accel:sca3000 Drop custom ABI for watersheds.
For now we support only the 50% watershed interrupt and start and stop it
as part of the buffer bring up. The 75% case may come back in future.
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Jonathan Cameron [Sat, 8 Oct 2016 16:39:04 +0000 (17:39 +0100)]
staging:iio:accel:sca3000 Fix clearing of flag + setting of size of scan.
Not clearing the stuff_to_read flag can lead to a false flag being set
on restarting the buffer if the data was not all read the previous time.
The size of the scan is needed to ensure the function
iio_buffer_read_first_n_outer actually tries to read the data.
This stuff has been broken for some time so not stable material.
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Jonathan Cameron [Sat, 8 Oct 2016 16:39:03 +0000 (17:39 +0100)]
staging:iio:accel:sca3000 drop sca3000_register_ring_funcs
This was needed when the buffer support was optional. Pointless wrapper
now so drop it.
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Jonathan Cameron [Sat, 8 Oct 2016 16:39:02 +0000 (17:39 +0100)]
staging:iio:accel:sca3000 merge files into one.
In the early days of IIO we were much more inclined to keep the impact
of the core IIO elements to the minimum. As time has moved on it has
become clear that hardly any builds are done without buffer support
and that it adds considerable complexity to the drivers.
Hence merge down the buffer and non buffer elements of the sca3000 driver
also allowing us to drop the header file used for the interfaces between
the two.
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Jonathan Cameron [Sat, 8 Oct 2016 16:39:01 +0000 (17:39 +0100)]
staging:iio:accel:sca3000 Fix a use before setting of the indio_dev->buffer pointer.
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Brian Masney [Mon, 10 Oct 2016 07:20:02 +0000 (03:20 -0400)]
staging: iio: isl29018: move out of staging
Move ISL29018/ISL29023/ISL29035 driver out of staging into mainline.
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Brian Masney [Mon, 10 Oct 2016 07:20:01 +0000 (03:20 -0400)]
staging: iio: isl29018: add ABI documentation for infrared suppression
Add ABI documentation from the ISL29018 Data Sheet (FN6619.4, Oct 8,
2012) about the infrared suppression that can be controlled
with the proximity_on_chip_ambient_infrared_suppression sysfs attribute.
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Alison Schofield [Tue, 11 Oct 2016 19:33:12 +0000 (12:33 -0700)]
iio: pressure: mpl3115: claim direct mode during raw reads
Driver was checking for direct mode but not locking it. Use
claim/release helper functions to guarantee the device stays
in direct mode during raw reads.
Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Jonathan Cameron [Sat, 15 Oct 2016 14:55:06 +0000 (15:55 +0100)]
iio: accel: mma8452: claim direct mode during write raw
Driver was checking for direct mode but not locking it. Use
claim/release helper functions to guarantee the device stays
in direct mode during all write raw operations.
Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Alison Schofield [Tue, 11 Oct 2016 19:31:36 +0000 (12:31 -0700)]
iio: accel: mma8452: claim direct mode during raw reads
Driver was checking for direct mode but not locking it. Use
claim/release helper functions to guarantee the device stays
in direct mode during raw reads.
Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Eva Rachel Retuya [Fri, 14 Oct 2016 10:18:39 +0000 (18:18 +0800)]
tools: iio: iio_generic_buffer: add -A to force-enable all channels
If attribute/s is/are already enabled (by default or via scripts or
manual interaction), issuing -a will fail to enable the channels thereby
one has to manually disable the said attribute/s before proceeding with
auto-enabling.
Add a command-line option -A to force-activate all channels regardless
of their current state.
Suggested-by: Alison Schofield <amsfield22@gmail.com>
Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Tomas Novotny [Tue, 11 Oct 2016 13:57:40 +0000 (15:57 +0200)]
iio: dac: mcp4725: use regulator framework
Use a standard framework to get the reference voltage. It is done that way
in the iio subsystem and it will simplify extending of the driver.
Structure mcp4725_platform_data is left undeleted because it used in the
next patch.
This change breaks the current users of the driver, but there is no
mainline user of struct mcp4725_platform_data.
Signed-off-by: Tomas Novotny <tomas@novotny.cz>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Crt Mori [Fri, 14 Oct 2016 13:43:14 +0000 (15:43 +0200)]
iio: ms65611_core: Fixes dereferencing regulator pointer
Change in handling of the regulator description means that static
checkers correctly assume we could be using dereferenced pointer to the
regulator. In reality we will never get the -ENODEV error, as current
behavior flow does not predict it, because:
If the device tree or board file does not define suitable regulators for
the component, it will be substituted by a dummy regulator, or, if
regulators are disabled altogether, by stubs.
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Suggested-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Crt Mori <cmo@melexis.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Dan Carpenter [Tue, 11 Oct 2016 11:12:29 +0000 (14:12 +0300)]
Staging: iio: fix a MAINTAINERS entry
The "drivers/" part of the path name was missing.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
sayli karnik [Tue, 11 Oct 2016 11:37:21 +0000 (17:07 +0530)]
iio: bmi160_core: Fix sparse warning due to incorrect type in assignment
There is a type mismatch between the buffer which is of type s16 and the
samples stored, which are declared as __le16.
Fix the following sparse warning:
drivers/iio/imu/bmi160/bmi160_core.c:411:26: warning: incorrect type
in assignment (different base types)
drivers/iio/imu/bmi160/bmi160_core.c:411:26: expected signed short
[signed] [short] [explicitly-signed] <noident>
drivers/iio/imu/bmi160/bmi160_core.c:411:26: got restricted __le16
[addressable] [usertype] sample
This is a cosmetic-type patch since it does not alter code behaviour.
The le16 is going into a 16bit buf element, and is labelled as IIO_LE in the
channel buffer definition.
Signed-off-by: sayli karnik <karniksayli1995@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Brian Masney [Mon, 10 Oct 2016 07:20:00 +0000 (03:20 -0400)]
staging: iio: isl29018: rename description in Kconfig for consistency
Rename description from "ISL 29018" to "Intersil 29018" in Kconfig for
consistency with other drivers in mainline.
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Brian Masney [Mon, 10 Oct 2016 07:19:59 +0000 (03:19 -0400)]
staging: iio: isl29018: remove blank line for consistency
Remove blank line between MODULE_DEVICE_TABLE() and its corresponding
structure for consistency with the other device table entries.
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Brian Masney [Mon, 10 Oct 2016 07:19:58 +0000 (03:19 -0400)]
staging: iio: isl29018: combine two return statements into one
Use the return value from isl29018_set_integration_time() as the return
value for isl29018_chip_init() since this is the last piece of work
inside that function.
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Brian Masney [Mon, 10 Oct 2016 07:19:57 +0000 (03:19 -0400)]
staging: iio: isl29018: fix multiline comment syntax
Change multiline comments from:
/* line1
* line2
* ...
*/
to
/*
* line1
* line2
* ...
*/
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Brian Masney [Mon, 10 Oct 2016 07:19:56 +0000 (03:19 -0400)]
staging: iio: isl29018: fix poorly named function
isl29035_detect() did not just do chip detection. Move functionality directly
into isl29018_chip_init() to avoid naming confusion.
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Brian Masney [Mon, 10 Oct 2016 07:19:55 +0000 (03:19 -0400)]
staging: iio: isl29018: add newlines to improve readability
Add newlines to improve code readability in preparation for moving the
driver out of staging.
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Jonathan Cameron [Sun, 9 Oct 2016 10:38:19 +0000 (11:38 +0100)]
staging:iio:TODO drop outdated entries in this todo.
There is still stuff to be done in the remaining drivers but pretty much
nothing was left from this original TODO.
Sorry Greg, should have been keeping this up to date.
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
sayli karnik [Mon, 10 Oct 2016 06:20:48 +0000 (11:50 +0530)]
staging: iio: cdc: ad7152: Replace mlock with a local mutex lock
mlock is intended to protect only switches between modes.
Given this driver doesn't support more than one mode (sysfs polled reads
only), replace mlock with a local mutex lock.
Signed-off-by: sayli karnik <karniksayli1995@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Eva Rachel Retuya [Mon, 10 Oct 2016 10:01:31 +0000 (18:01 +0800)]
staging: iio: cdc: ad7746: implement IIO_CHAN_INFO_SAMP_FREQ
This driver predates the availability of IIO_CHAN_INFO_SAMP_FREQ
attribute wherein usage has some advantages like it can be accessed by
in-kernel consumers as well as reduces the code size.
Therefore, use IIO_CHAN_INFO_SAMP_FREQ to implement the
sampling_frequency attribute instead of using IIO_DEVICE_ATTR() macro.
Move code from the functions associated with IIO_DEVICE_ATTR() into
respective read and write hooks with the mask set to
IIO_CHAN_INFO_SAMP_FREQ.
Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
sayli karnik [Mon, 10 Oct 2016 15:39:17 +0000 (21:09 +0530)]
staging: iio: cdc: ad7152: Implement IIO_CHAN_INFO_SAMP_FREQ attribute
Attributes that were once privately defined become standard with time
and hence a special global define is used. Hence update driver ad7152 to use
IIO_CHAN_INFO_SAMP_FREQ which is a global define instead of
IIO_DEV_ATTR_SAMP_FREQ.
Move functionality from IIO_DEV_ATTR_SAMP_FREQ attribute into
IIO_CHAN_INFO_SAMP_FREQ to implement the sampling_frequency attribute.
Modify ad7152_read_raw() and ad7152_write_raw() to allow reading and
writing the element as well. Also add a lock in the driver's private
data.
Signed-off-by: sayli karnik <karniksayli1995@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Brian Masney [Fri, 7 Oct 2016 00:48:34 +0000 (20:48 -0400)]
staging: iio: isl29018: add documentation about the infrared suppression
Add documentation from the ISL29018 Data Sheet (FN6619.4, Oct 8, 2012)
about the infrared suppression that can be controlled
with the proximity_on_chip_ambient_infrared_suppression sysfs attribute.
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Brian Masney [Fri, 7 Oct 2016 00:48:35 +0000 (20:48 -0400)]
staging: iio: isl29018: document device tree bindings
Fix the following warnings from checkpatch:
WARNING: DT compatible string "isil,isl29018" appears un-documented --
check ./Documentation/devicetree/bindings/
WARNING: DT compatible string "isil,isl29023" appears un-documented --
check ./Documentation/devicetree/bindings/
WARNING: DT compatible string "isil,isl29035" appears un-documented --
check ./Documentation/devicetree/bindings/
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Sandhya Bankar [Mon, 3 Oct 2016 20:59:06 +0000 (02:29 +0530)]
Staging: iio: meter: ade7758_core: implement IIO_CHAN_INFO_SAMP_FREQ
This driver predates the availability of IIO_CHAN_INFO_SAMP_FREQ attribute
wherein usage has some advantages like it can be accessed by in-kernel
consumers as well as reduces the code size.
Hence moving functionality from IIO_DEV_ATTR_SAMP_FREQ attribute into
IIO_CHAN_INFO_SAMP_FREQ handlers. Also Adding ade7758_read_raw() and
ade7758_write_raw() to allow reading/writing the element as well.
Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Hans de Goede [Thu, 6 Oct 2016 17:06:50 +0000 (19:06 +0200)]
dt: bindings: vendor-prefix: Add 3 accelerometer vendor prefixes
Recently the kernel has gotten support in the iio subsystem for a number
of new accelerometers from mCube, Memsic and MiraMEMS.
This commit adds the vendor prefixes already used for these vendors
in Documentation/devicetree/bindings/i2c/trivial-devices.txt to
vendor-prefixes.txt.
The "full" company names were taken from the company's websites:
http://www.mcubemems.com/
http://www.memsic.com/
http://www.miramems.com/en/
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Hans de Goede [Sat, 8 Oct 2016 18:15:27 +0000 (20:15 +0200)]
iio: accel: Add driver for the MiraMEMS DA280 3-axis 14-bit digital accelerometer
Add an iio driver for the MiraMEMS DA280 3-axis 14-bit accelerometer, as
well as for the DA226 which is a fully compatible 2-axis version.
Datasheets for the DA280 and DA226 can be found at the manufacturers site:
http://www.miramems.com/en/products.asp?list=1
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Eva Rachel Retuya [Wed, 5 Oct 2016 03:06:21 +0000 (11:06 +0800)]
staging: iio: ad7192: implement IIO_CHAN_INFO_SAMP_FREQ
This driver predates the availability of IIO_CHAN_INFO_SAMP_FREQ
attribute wherein usage has some advantages like it can be accessed by
in-kernel consumers as well as reduces the code size.
Therefore, use IIO_CHAN_INFO_SAMP_FREQ to implement the
sampling_frequency attribute instead of using IIO_DEV_ATTR_SAMP_FREQ()
macro.
Move code from the functions associated with IIO_DEV_ATTR_SAMP_FREQ()
into respective read and write hooks with the mask set to
IIO_CHAN_INFO_SAMP_FREQ.
Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Hans de Goede [Sat, 8 Oct 2016 12:34:25 +0000 (14:34 +0200)]
iio: accel: Add driver for the MiraMEMS DA311 3-axis 12-bit digital accelerometer
This driver is based on the DA311 Android driver which can be found here:
https://git.matricom.net/Firmware/kernel_amlogic_meson-common/tree/
1e70113a5befd07debb68f537156def84c5be57a/drivers/amlogic/input/sensor
the mir3da_* files are the DA311 driver.
Unfortunately there is no datasheet.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Hans de Goede [Sat, 8 Oct 2016 12:34:24 +0000 (14:34 +0200)]
iio: accel: Add driver for dmard10 3-axis Accelerometer
Add a driver for the Domintech ARD10 3-axis Accelerometer, based on the
android driver found here: https://github.com/domintech/dmard10
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Hans de Goede [Sat, 8 Oct 2016 12:34:23 +0000 (14:34 +0200)]
dt: bindings: i2c/trivial-devices.txt: Add 2 iio supported accelerometers
Add compatible strings for 2 accelerometers which follow the trivial
i2c device bindings and have been supported by the iio subsystem for
a while now.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Eva Rachel Retuya [Sat, 8 Oct 2016 16:05:40 +0000 (00:05 +0800)]
staging: iio: ad7606: implement IIO_CHAN_INFO_OVERSAMPLING_RATIO
This driver predates the availability of IIO_CHAN_INFO_OVERSAMPLING_RATIO
attribute wherein usage has some advantages like it can be accessed by
in-kernel consumers as well as reduces the code size.
Therefore, use IIO_CHAN_INFO_OVERSAMPLING_RATIO to implement the
oversampling_ratio attribute instead of using IIO_DEVICE_ATTR() macro.
Move code from the functions associated with IIO_DEVICE_ATTR() into
the read_raw hook as well as add the write_raw hook with both masks set
to IIO_CHAN_INFO_OVERSAMPLING_RATIO.
Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Eva Rachel Retuya [Sat, 8 Oct 2016 16:05:39 +0000 (00:05 +0800)]
staging: iio: ad7606: fix improper setting of oversampling pins
The oversampling ratio is controlled using the oversampling pins,
OS [2:0] with OS2 being the MSB control bit, and OS0 the LSB control
bit.
The gpio connected to the OS2 pin is not being set correctly, only OS0
and OS1 pins are being set. Fix the typo to allow proper control of the
oversampling pins.
Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Fixes:
b9618c0 ("staging: IIO: ADC: New driver for AD7606/AD7606-6/AD7606-4")
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Ico Doornekamp [Sat, 1 Oct 2016 17:30:14 +0000 (19:30 +0200)]
iio: magnetometer: ak8974: small endianness fixes
Fixes two cases of 'cast to restricted __le16' as reported by sparse.
Signed-off-by: Ico Doornekamp <ico@pruts.nl>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Bhumika Goyal [Sat, 1 Oct 2016 19:15:15 +0000 (00:45 +0530)]
Staging: iio: ad7150: constify attribute_group structures
Check for attribute_group structures that are only stored in the
event_attrs filed of iio_info structure. As the event_attrs field
of iio_info structures is constant, so these attribute_group
structures can also be declared constant.
Done using coccinelle:
@r1 disable optional_qualifier @
identifier i;
position p;
@@
static struct attribute_group i@p = {...};
@ok1@
identifier r1.i;
position p;
struct iio_info x;
@@
x.event_attrs=&i@p;
@bad@
position p!={r1.p,ok1.p};
identifier r1.i;
@@
i@p
@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
static
+const
struct attribute_group i={...};
@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
struct attribute_group i;
File size before:
text data bss dec hex filename
3561 1152 8 4721 1271 drivers/staging/iio/cdc/ad7150.o
File size after:
text data bss dec hex filename
3625 1088 8 4721 1271 drivers/staging/iio/cdc/ad7150.o
Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Bhumika Goyal [Sat, 1 Oct 2016 19:15:14 +0000 (00:45 +0530)]
Staging: iio: addac: constify attribute_group structures
Check for attribute_group structures that are only stored in the
event_attrs filed of iio_info structure. As the event_attrs field
of iio_info structures is constant, so these attribute_group
structures can also be declared constant.
Done using coccinelle:
@r1 disable optional_qualifier @
identifier i;
position p;
@@
static struct attribute_group i@p = {...};
@ok1@
identifier r1.i;
position p;
struct iio_info x;
@@
x.event_attrs=&i@p;
@bad@
position p!={r1.p,ok1.p};
identifier r1.i;
@@
i@p
@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
static
+const
struct attribute_group i={...};
@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
struct attribute_group i;
File size before:
text data bss dec hex filename
11013 6096 0 17109 42d5
drivers/staging/iio/addac/adt7316.o
File size after:
text data bss dec hex filename
11141 5968 0 17109 42d5
drivers/staging/iio/addac/adt7316.o
Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Bhumika Goyal [Sat, 1 Oct 2016 19:15:13 +0000 (00:45 +0530)]
Staging: iio: ad7816: constify attribute_group structures
Check for attribute_group structures that are only stored in the
event_attrs filed of iio_info structure. As the event_attrs field
of iio_info structures is constant, so these attribute_group
structures can also be declared constant.
Done using coccinelle:
@r1 disable optional_qualifier @
identifier i;
position p;
@@
static struct attribute_group i@p = {...};
@ok1@
identifier r1.i;
position p;
struct iio_info x;
@@
x.event_attrs=&i@p;
@bad@
position p!={r1.p,ok1.p};
identifier r1.i;
@@
i@p
@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
static
+const
struct attribute_group i={...};
@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
struct attribute_group i;
File size before:
text data bss dec hex filename
3295 768 0 4063 fdf drivers/staging/iio/adc/ad7816.o
File size after:
text data bss dec hex filename
3359 736 0 4095 fff drivers/staging/iio/adc/ad7816.o
Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Bhumika Goyal [Sat, 1 Oct 2016 19:15:12 +0000 (00:45 +0530)]
Staging: iio:
ad7280a: constify attribute_group structures
Check for attribute_group structures that are only stored in the
event_attrs filed of iio_info structure. As the event_attrs field
of iio_info structures is constant, so these attribute_group
structures can also be declared constant.
Done using coccinelle:
@r1 disable optional_qualifier @
identifier i;
position p;
@@
static struct attribute_group i@p = {...};
@ok1@
identifier r1.i;
position p;
struct iio_info x;
@@
x.event_attrs=&i@p;
@bad@
position p!={r1.p,ok1.p};
identifier r1.i;
@@
i@p
@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
static
+const
struct attribute_group i={...};
@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
struct attribute_group i;
File size before:
text data bss dec hex filename
6271 672 776 7719 1e27
drivers/staging/iio/adc/
ad7280a.o
File size after:
text data bss dec hex filename
6335 608 776 7719 1e27
drivers/staging/iio/adc/
ad7280a.o
Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Anchal Jain [Mon, 3 Oct 2016 13:08:28 +0000 (18:38 +0530)]
staging: iio: cdc: ad7152: Add blank line after declarations to increase readability
Add a blank line after the function to increase the readability of the code.
Signed-off-by: Anchal Jain <anchalj109@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
William Breathitt Gray [Wed, 28 Sep 2016 18:00:01 +0000 (14:00 -0400)]
iio: 104-quad-8: Add IIO support for the ACCES 104-QUAD-8
The ACCES 104-QUAD-8 is a general purpose quadrature encoder
counter/interface board. The 104-QUAD-8 is capable of monitoring the
outputs of eight encoders via four on-board LSI/CSI LS7266R1 24-bit
dual-axis quadrature counter chips. Core functions handled by the
LS7266R1, such as direction and total count, are available.
Performing a write to a counter's IIO_CHAN_INFO_RAW sets the counter and
also clears the counter's respective error flag. Although the counters
have a 25-bit range, only the lower 24 bits may be set, either directly
or via a counter's preset attribute. Interrupts are not supported by
this driver.
This driver adds IIO support for the ACCES 104-QUAD-8 and ACCES
104-QUAD-4. The base port addresses for the devices may be configured
via the base array module parameter.
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
William Breathitt Gray [Wed, 28 Sep 2016 17:59:49 +0000 (13:59 -0400)]
iio: Implement counter channel type and info constants
Quadrature encoders, such as rotary encoders and linear encoders, are
devices which are capable of encoding the relative position and
direction of motion of a shaft. This patch introduces several IIO
constants for supporting quadrature encoder counter devices.
IIO_COUNT: Current count (main data provided by the counter device)
IIO_INDEX: Counter device index value
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Marcin Malagowski [Mon, 26 Sep 2016 17:23:06 +0000 (19:23 +0200)]
iio: pressure: Add driver for Honeywell ABP family
This patch adds minimal driver for the Honeywell Amplified Basic
Pressure sensors series. Sensors are pretty simple but are
available in many variants:
- psi/mbar/kPa output,
- analog/i2c/spi,
- gage/differential measurement,
- different measure ranges etc.
Refer to datasheets for more details:
http://sensing.honeywell.com/honeywell-sensing-basic-board-mount-pressure-sensors-abp-series-datasheet-
323005128-c-en.pdf
http://sensing.honeywell.com/index.php%3Fci_id%
3D45841
Driver internals:
- i2c only. measure request is done by the SMBUS QUICK cmd, so if the i2c
bus doesn't support it, it is required to send a dummy byte to trigger
measurement,
- since iio sysfs expects kilopascals, mbar-variants are treated as their
respective kPa-s, hence i2c id-table has doubled entries in one line:
{ "abp060mg", ABP006KG }, { "abp006kg", ABP006KG },
- psi-variants have prescaled values in config,
- no temperature reads yet.
Work remained:
- optional temperature channel,
- SPI support,
- DT binding.
Changes since v1:
- mutex is now locked in read_raw(),
- corrected error codes,
- fixed coding style issues,
- renamed few defines and functions abp -> abp060mg
(some structs left as they were to keep the sensible meaning).
Signed-off-by: Marcin Malagowski <mrc@bourne.st>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Brian Masney [Tue, 27 Sep 2016 00:20:20 +0000 (20:20 -0400)]
staging: iio: isl29018: check if the chip is in a suspended state
Add a check to isl29018_write_raw() to ensure that the chip is not in a
suspended state. This makes the code consistent with what is present
in isl29018_read_raw().
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Brian Masney [Tue, 27 Sep 2016 00:20:19 +0000 (20:20 -0400)]
staging: iio: isl29018: change isl29018_read_raw() to only have one exit point
When the chip is in a suspended state, isl29018_read_raw() will return
-EBUSY. Change the function so that it only has a single exit point.
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Brian Masney [Tue, 27 Sep 2016 00:20:18 +0000 (20:20 -0400)]
staging: iio: isl29018: fixed race condition in in_illuminance_scale_available_show()
in_illuminance_scale_available_show() references the
isl29018_chip->int_time variable in three places inside a for loop.
The value of the int_time variable can be updated by the
isl29018_set_integration_time() function, which is called by the
isl29018_write_raw() function. isl29018_write_raw() locks a
mutex specific to this driver when the integration time variable is
updated.
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Brian Masney [Tue, 27 Sep 2016 00:20:17 +0000 (20:20 -0400)]
staging: iio: isl29018: use IIO_DEVICE_ATTR_{RO, RW} macros
Use the IIO_DEVICE_ATTR_RO and IIO_DEVICE_ATTR_RW macros to
create the device attributes.
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Brian Masney [Tue, 27 Sep 2016 00:20:16 +0000 (20:20 -0400)]
include: linux: iio: add IIO_ATTR_{RO, WO, RW} and IIO_DEVICE_ATTR_{RO, WO, RW} macros
Add new macros: IIO_ATTR_RO, IIO_ATTR_WO, IIO_ATTR_RW,
IIO_DEVICE_ATTR_RO, IIO_DEVICE_ATTR_WO and IIO_DEVICE_ATTR_RW to reduce
the amount of boiler plate code that is needed for creating new
attributes. This mimics the *_RO, *_WO, and *_RW macros that are found
in include/linux/device.h and include/linux/sysfs.h.
Signed-off-by: Brian Masney <masneyb@onstation.org>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Bhumika Goyal [Sat, 1 Oct 2016 09:57:18 +0000 (15:27 +0530)]
iio: Declare event_attrs field of iio_info structure as const
The event_attrs field of iio_info structure is only initialized once
whenever an object of iio_info is created. After that this field
is never modified again anywhere in the kernel. So, declare event_attrs
field of iio_info as a const struct attribute_group.
Checked for occurences throughout the kernel using grep and
coccinelle.
Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Bhumika Goyal [Mon, 26 Sep 2016 05:01:39 +0000 (10:31 +0530)]
Staging:iio:light:tsl2583: constify attribute_group structures
Check for attribute_group structures that are only stored in the
attrs filed of iio_info structure. As the attrs field of iio_info
structures is constant, so these attribute_group structures can also be
declared constant.
Done using coccinelle
@r1 disable optional_qualifier @
identifier i;
position p;
@@
static struct attribute_group i@p = {...};
@ok1@
identifier r1.i;
position p;
struct iio_info x;
@@
x.attrs=&i@p;
@bad@
position p!={r1.p,ok1.p};
identifier r1.i;
@@
i@p
@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
static
+const
struct attribute_group i={...};
@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
struct attribute_group i;
File size before: drivers/staging/iio/light/tsl2583.o
text data bss dec hex filename
6529 1052 0 7581 1d9d
drivers/staging/iio/light/tsl2583.o
File size after: drivers/staging/iio/light/tsl2583.o
text data bss dec hex filename
6593 988 0 7581 1d9d
drivers/staging/iio/light/tsl2583.o
Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Bhumika Goyal [Mon, 26 Sep 2016 05:01:38 +0000 (10:31 +0530)]
Staging:iio:adc:
ad7280a: constify attribute_group structures
Check for attribute_group structures that are only stored in the
attrs filed of iio_info structure. As the attrs field of iio_info
structures is constant, so these attribute_group structures can also be
declared constant.
Done using coccinelle:
@r1 disable optional_qualifier @
identifier i;
position p;
@@
static struct attribute_group i@p = {...};
@ok1@
identifier r1.i;
position p;
struct iio_info x;
@@
x.attrs=&i@p;
@bad@
position p!={r1.p,ok1.p};
identifier r1.i;
@@
i@p
@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
static
+const
struct attribute_group i={...};
@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
struct attribute_group i;
File size before: drivers/staging/iio/adc/
ad7280a.o
text data bss dec hex filename
6487 584 776 7847 1ea7
drivers/staging/iio/adc/
ad7280a.o
File size after: drivers/staging/iio/adc/
ad7280a.o
text data bss dec hex filename
6551 544 776 7871 1ebf
drivers/staging/iio/adc/
ad7280a.o
Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Brian Masney [Sun, 25 Sep 2016 11:41:07 +0000 (07:41 -0400)]
staging: iio: isl29018: fix comparison between signed and unsigned integers
Fixes warning found by make W=2:
warning: comparison between signed and unsigned integer expressions
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Brian Masney [Sun, 25 Sep 2016 11:41:06 +0000 (07:41 -0400)]
staging: iio: isl29018: made error handling consistent
Changed the processing of IIO_CHAN_INFO_INT_TIME in isl29018_write_raw()
to unlock the mutex and return at the end of the function if invalid
input is passed in. This makes the error handling code consistent with
the processing of IIO_CHAN_INFO_CALIBSCALE and IIO_CHAN_INFO_SCALE
within the same function.
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Brian Masney [Sun, 25 Sep 2016 11:41:05 +0000 (07:41 -0400)]
staging: iio: isl29018: remove unused variable and defines
Removes unused variable and associated #defines that was found using
make W=1.
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Sandhya Bankar [Sun, 25 Sep 2016 13:03:17 +0000 (18:33 +0530)]
drivers: iio: magnetometer: Fix sparse endianness warnings cast to restricted __be16
Fix the following sparse endianness warnings:
drivers/iio/magnetometer/ak8975.c:716:16: warning: cast to restricted __le16
drivers/iio/magnetometer/ak8975.c:837:19: warning: cast to restricted __le16
drivers/iio/magnetometer/ak8975.c:838:19: warning: cast to restricted __le16
drivers/iio/magnetometer/ak8975.c:839:19: warning: cast to restricted __le16
Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Matt Ranostay [Sun, 25 Sep 2016 04:03:00 +0000 (21:03 -0700)]
iio: potentiostat: add LMP91000 support
Add support for the LMP91000 potentiostat which is used for chemical
sensing applications.
Signed-off-by: Matt Ranostay <matt@ranostay.consulting>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Matt Ranostay [Sun, 18 Sep 2016 22:42:15 +0000 (15:42 -0700)]
iio: adc: ti-adc161s626: add regulator support
Allow IIO_CHAN_INFO_SCALE and IIO_CHAN_INFO_OFFSET attributes for
processing by checking voltage from a regulator.
Signed-off-by: Matt Ranostay <matt@ranostay.consulting>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Matt Ranostay [Sat, 24 Sep 2016 06:04:07 +0000 (23:04 -0700)]
iio: inkern: add iio_read_channel_offset helper
Allow access to underlying channel IIO_CHAN_INFO_OFFSET from a consumer.
Signed-off-by: Matt Ranostay <matt@ranostay.consulting>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Sandhya Bankar [Sat, 24 Sep 2016 16:14:55 +0000 (21:44 +0530)]
drivers: iio: light: Fix sparse warnings
Fixing below warnings:
drivers/iio/light/max44000.c:217:18: warning: cast to restricted __be16
drivers/iio/light/max44000.c:217:18: warning: cast to restricted __be16
drivers/iio/light/max44000.c:217:18: warning: cast to restricted __be16
drivers/iio/light/max44000.c:217:18: warning: cast to restricted __be16
Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Lars-Peter Clausen [Fri, 23 Sep 2016 15:19:44 +0000 (17:19 +0200)]
iio:adc: Add support for AD7766/AD7767
Add support for the AD7766, AD7766-1, AD7766-2, AD7767, AD7767-1, AD7767-2
Analog to Digital converters. It's a family of single channel 24-bit SAR
ADCs. They are all digital interface compatible and the main difference is
the internal decimation rate and analog performance. For communication with
the host processor a SPI interface is used.
In addition the part has a data ready pin that is pulsed for one MCLK cycle
when a conversion has completed and can be used as a IIO trigger.
Datasheets:
http://www.analog.com/media/en/technical-documentation/data-sheets/AD7766.pdf
http://www.analog.com/media/en/technical-documentation/data-sheets/AD7767.pdf
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Lars-Peter Clausen [Fri, 23 Sep 2016 15:19:43 +0000 (17:19 +0200)]
iio:max1027: Use iio_trigger_validate_own_device() helper
Use the new iio_trigger_validate_own_device() to verify that the trigger
can only be attached to the matching IIO device rather than using a custom
variant.
While the implementation of iio_trigger_validate_own_device() and the
custom variant and are not identical their behaviour is.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Lars-Peter Clausen [Fri, 23 Sep 2016 15:19:42 +0000 (17:19 +0200)]
iio:mma8452: Use new iio_trigger_validate_own_device() helper
Use the new iio_trigger_validate_own_device() to verify that the trigger
can only be attached to the matching IIO device rather than using a custom
variant.
While the implementation of iio_trigger_validate_own_device() and the
custom variant and are not identical their behaviour is.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Lars-Peter Clausen [Fri, 23 Sep 2016 15:19:41 +0000 (17:19 +0200)]
iio:trigger: Add helper function to verify that a trigger belongs to the same device
Some triggers can only be attached to the IIO device that corresponds to
the same physical device. Currently each driver that requires this
implements its own trigger validation function.
Introduce a new helper function called iio_trigger_validate_own_device()
that can be used to do this check. Having a common implementation avoids
code duplication and unnecessary boiler-plate code.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Sandhya Bankar [Fri, 23 Sep 2016 19:20:22 +0000 (00:50 +0530)]
drivers: iio: dac: Fix sparse warning
Fixing below warnings:
drivers/iio/dac/ad5592r.c:58:41: warning: incorrect type in argument 2 (different base types)
drivers/iio/dac/ad5592r.c:58:41: expected unsigned short [usertype] *buf
drivers/iio/dac/ad5592r.c:58:41: got restricted __be16 *<noident>
drivers/iio/dac/ad5592r.c:62:41: warning: incorrect type in argument 2 (different base types)
drivers/iio/dac/ad5592r.c:62:41: expected unsigned short [usertype] *buf
drivers/iio/dac/ad5592r.c:62:41: got restricted __be16 *<noident>
drivers/iio/dac/ad5592r.c:92:41: warning: incorrect type in argument 2 (different base types)
drivers/iio/dac/ad5592r.c:92:41: expected unsigned short [usertype] *buf
drivers/iio/dac/ad5592r.c:92:41: got restricted __be16 *<noident>
drivers/iio/dac/ad5592r.c:110:41: warning: incorrect type in argument 2 (different base types)
drivers/iio/dac/ad5592r.c:110:41: expected unsigned short [usertype] *buf
drivers/iio/dac/ad5592r.c:110:41: got restricted __be16 *<noident>
Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>