Currently, proximity sensor boundary check is done
inside the switch block but outside the case
statement.Since this code will never get executed,
moved the check outside the switch case statement.
867 case IIO_PROXIMITY:
868 switch (dir) {
// Following line has been moved outside the switch block.
869 if (val > LTR501_PS_THRESH_MASK)
870 return -EINVAL;
871 case IIO_EV_DIR_RISING:
Signed-off-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Vignesh R [Tue, 31 Mar 2015 11:12:37 +0000 (16:42 +0530)]
iio: adc: ti_am335x_adc: make sample delay, open delay, averaging DT parameters
Add optional DT properties to set open delay, sample delay and number
of averages per sample for each adc step. Open delay, sample delay
and averaging are some of the parameters that affect the sampling rate
and accuracy of the sample. Making these parameters configurable via
DT will help in balancing speed vs accuracy.
Signed-off-by: Vignesh R <vigneshr@ti.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
iio: acpi: Add support for ACPI0008 Ambient Light Sensor
This driver adds the initial support for the ACPI Ambient Light Sensor
as defined in Section 9.2 of the ACPI specification (Revision 5.0) [1].
Sensors complying with the standard are exposed as ACPI devices with
ACPI0008 as hardware ID and provide standard methods by which the OS
can query properties of the ambient light environment the system is
currently operating in.
This driver currently allows only to get the current ambient light
illuminance reading through the _ALI method, but is ready to be
extended extended to handle _ALC, _ALT and _ALP as well.
[1] http://www.acpi.info/DOWNLOADS/ACPIspec50.pdf
Signed-off-by: Martin Liska <marxin.liska@gmail.com> Signed-off-by: Marek Vasut <marex@denx.de> Signed-off-by: Gabriele Mazzotta <gabriele.mzt@gmail.com> Cc: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Linus Walleij [Tue, 5 May 2015 08:42:12 +0000 (10:42 +0200)]
iio: make tools more cross-compilation friendly
When cross-compiling the IIO tools we need to opportunity to
specify a cross compiler prefix and some extra CFLAGS. This
patch enables this in the same way as for other stuff in
tools.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Daniel Baluta <daniel.baluta@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Export the oversampling ratio so that the user can change the
number of repetions for x/y/z axis.
The sampling frequency is limited by the oversampling ratio.
The available sampling frequencies might change depending
on the values of oversampling_ratio.
The specification can be downloaded from:
http://ae-bst.resource.bosch.com/media/products/dokumente/bmc150/BST-BMC150-DS000-04.pdf.
Signed-off-by: Irina Tirdea <irina.tirdea@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Some magnetometers can perform a number of repetitions in HW
for each measurement to increase accuracy. One example is
Bosch BMC150:
http://ae-bst.resource.bosch.com/media/products/dokumente/bmc150/BST-BMC150-DS000-04.pdf.
Introduce an interface to set the oversampling ratio
for these devices.
Signed-off-by: Irina Tirdea <irina.tirdea@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Add support for the Bosh BMC150 Magnetometer.
The specification can be downloaded from:
http://ae-bst.resource.bosch.com/media/products/dokumente/bmc150/BST-BMC150-DS000-04.pdf.
The chip contains both an accelerometer and a magnetometer.
This patch adds support only for the magnetometer part.
The temperature compensation formulas are based on bmm050_api.c
authored by contact@bosch.sensortec.com.
Signed-off-by: Irina Tirdea <irina.tirdea@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Staging: iio: Allow compile test of GPIO consumers if !GPIOLIB
The GPIO subsystem provides dummy GPIO consumer functions if GPIOLIB is
not enabled. Hence drivers that depend on GPIOLIB, but use GPIO consumer
functionality only, can still be compiled if GPIOLIB is not enabled.
Relax the dependency on GPIOLIB if COMPILE_TEST is enabled, where
appropriate.
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Cc: Jonathan Cameron <jic23@kernel.org> Cc: linux-iio@vger.kernel.org Cc: devel@driverdev.osuosl.org Signed-off-by: Jonathan Cameron <jic23@kernel.org>
iio: Allow compile test of GPIO consumers if !GPIOLIB
The GPIO subsystem provides dummy GPIO consumer functions if GPIOLIB is
not enabled. Hence drivers that depend on GPIOLIB, but use GPIO consumer
functionality only, can still be compiled if GPIOLIB is not enabled.
Relax the dependency on GPIOLIB if COMPILE_TEST is enabled, where
appropriate.
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>
Minimal implementation of an IIO driver for the Sensortek
STK3310 ambient light and proximity sensor. The STK3311
model is also supported.
Includes:
- ACPI support;
- read_raw and write_raw;
- reading and setting configuration parameters for gain/scale
and integration time for both ALS and PS.
- power management
Signed-off-by: Tiberiu Breana <tiberiu.a.breana@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Merge tag 'iio-for-v4.2a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next
Jonathan writes:
First round of new drivers, functionality and cleanups for the 4.2 cycle
New drivers / device support
* st sensors driver, lsm303dlh magnetometer support.
* ltr501 - support ltr301 and ltr559 chips.
New functionality
* IIO_CHAN_INFO_CALIBEMISSIVITY for thermopile sensors.
* kxcjk1013 - make driver operational with external trigger.
* Add iio targets to the tools Makefile.
Cleanups
* st sensors - more helpful error message if device id wrong or irq request
fails, explicitly make the Block Data Update optional rather
than relying on writes to address 0 not doing anything, make interrupt
support optional (Not always wired, and not all devices actually have
an interrupt line.)
* kxcjk-1013 white space additions for readability, add the KXCJ9000 ACPI
id as seen in the wild.
* sx9500 - GPIO reset support, refactor the GPIO interrupt code, add power
management, optimize power usage by powering down when possible, rename
the gpio interrupt pin to be more useful, trivial return path simplification,
trivial formatting fixes.
* isl29018 - move towards ABI compliance with a view to moving this driver
out of staging, add some brackets to ensure code works as expected. Note
there is no actual bug as the condition being tested is always true
(with current devices).
* ltr501 - add regmap support to get caching etc for later patches,
fix a parameter sanity check that always fails (bug introduced
earlier in this series), ACPI enumeration support,
interrupt rate control support, interrupt support in general and
integration time control support, code alignment cleanups.
* mma9553 - a number of little cleanups following a review from Hartmut
after I'd already applied the original driver patch.
* tmp006 - prefix some defines with TMP006 for consistency.
* tsl4531 - cleanup some wrong prefixes, presumably from copy and paste.
* mlx90614 - check for errors in read values, add power management,
add emissivity setting, add device tree binding documentation,
fix a duplicate const warning.
* ti_am335x_adc - refactor the DT parsing into a separate function.
Erik Arfvidson [Tue, 5 May 2015 22:37:06 +0000 (18:37 -0400)]
staging: unisys: remove timskmod.h and procobjecttree.h
This patch move the needed linux include files from timskmod.h
to the files that calls those include. Also procobjecttree.h is
removed since it is dead code.
Signed-off-by: Erik Arfvidson <erik.arfvidson@unisys.com> Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Erik Arfvidson [Tue, 5 May 2015 22:37:04 +0000 (18:37 -0400)]
staging: unisys: move timskmod.h functionality
This patch removes all timksmod.h pound defines. It also removes
visorkmodutils.c since it no longer has any use by itself. Since
visorkmodutils.c is no longer needed the module_init for
visorchipset.c is modified to call visorutil_spar_detect directly
instead of the extern variable in timksmod.h.
Signed-off-by: Erik Arfvidson <erik.arfvidson@unisys.com> Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Prarit Bhargava [Tue, 5 May 2015 22:37:02 +0000 (18:37 -0400)]
staging: unisys: add acpi pnp driver
According to Unisys, another OS detects the PNP0A07 as the auto load
device. We can also do this in the linux kernel by simply converting the
driver over to the ACPI driver model.
Notes: This changes the usage of __init and it had to be removed from some
functions to avoid a !__init function calling an __init function.
Additionally I also cleaned up the headers in visorchipset.c since I was
adding a header file.
visorchannel's signal code should call visorchannel_write() directly.
This is more consistent and cleaner, and allows us to remove the last
memregion call.
Jes Sorensen [Tue, 5 May 2015 22:36:55 +0000 (18:36 -0400)]
staging: unisys: visorchannel_read(): Use memcpy_fromio() directly
Note, this changes the behavior of visorchannel_read(). The old code
would return the channel header, if the offset argument was 0, and the
caller tried to read beyond the size of the visorchannel. Note this
only worked for offset == 0, but not for
(offset > 0) && (offset < header_size), which was inconsistent.
The new implementation returns an error if someone tries to read
beyond the visorchannel size.
David Kershner [Tue, 5 May 2015 22:36:39 +0000 (18:36 -0400)]
staging: unisys: remove server crust from visorchipset.
The visorchipset driver originally serviced both servers and
clients. This implementation is client only so remove some
more server side implementation.
Signed-off-by: David Kershner <david.kershner@unisys.com> Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Jes Sorensen [Tue, 5 May 2015 22:36:32 +0000 (18:36 -0400)]
staging: unisys: memregion: Embed memregion in struct channel
This changes the API for visor_memregion_create() to require a
pre-allocated struct memregion. Embedding this in struct channel
avoids a layer of additional kmalloc()'s and error checks.
Prarit Bhargava [Tue, 5 May 2015 22:36:19 +0000 (18:36 -0400)]
staging: unisys: fix sig_read_data and sig_read_data functions
The sig_read_data() and sig_write_data() functions are involved in 2 steps
of calls. They really don't need to be and this makes for much simpler
code.
The error handling in this function was broken and while looking at that
I noticed that the whole function was in need of cleanup. This patch
fixes the error handling, specifically
if (!p) {
visorchannel_destroy(p);
channel = NULL;
}
and does a lot of cleanup. I also verified that the called functions
returned correct errors, and that led to a change in
visor_memregion_resize(), visorchannel_destroy() and
visor_memregion_destroy().
Prarit Bhargava [Tue, 5 May 2015 22:36:16 +0000 (18:36 -0400)]
staging: unisys: cleanup visorbus_private.h
visorbus_private.h contains code that is called from visorbus into the
visorchipset code. Now that the visorchipset code has been brought into
the visorbus directory, many of the declarations are not necessary and
can be cleaned up.
TODO: PARSER_WHICH_STRING enum only has one member used
(PARSERSTRING_NAME).
TODO: crash_obj_type appears to be unnecessary in the overall scheme of
code.
Prarit Bhargava [Tue, 5 May 2015 22:36:15 +0000 (18:36 -0400)]
staging: unisys: move visorchipset files to visorbus
Move visorchipset_main.c and visorchipset.h to visorbus/visorchipset.c and
visorbus/visorbus_private.h. This leaves an empty visorchipset directory
which can also be destroyed.
As a result of this patch the visorchipset init code now calls the
visorbus_init() directly. Similarily the visorchipset exit code now
cleans up by calling visorbus_exit().
Prarit Bhargava [Tue, 5 May 2015 22:36:07 +0000 (18:36 -0400)]
staging: unisys: unify devmajorminor attributes into visorbus_main.c
The code in devmajorminor_attr.[ch] only creates sysfs files and is
called only in visorbus_main.c. This code should be unified into
visorbus_main.c. The only changes are a forward declaration issue with
register_devmajorminor_attributes() and making the functions static.
Prarit Bhargava [Tue, 5 May 2015 22:36:06 +0000 (18:36 -0400)]
staging: unisys: unify channel attributes into visorbus_main.c
The code in channel_attr.[ch] only creates sysfs files and is called
only in visorbus_main.c. This code should be unified into
visorbus_main.c. There are some functions that have been made static.