Lars-Peter Clausen [Thu, 19 Sep 2013 12:59:00 +0000 (13:59 +0100)]
iio:mpu6050: Use iio_push_to_buffers_with_timestamp()
Makes the code a bit shorter and less ugly.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Cc: Ge Gao <ggao@invensense.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Lars-Peter Clausen [Thu, 19 Sep 2013 12:59:00 +0000 (13:59 +0100)]
iio:adis_lib: Use iio_push_to_buffers_with_timestamp()
Makes the code a bit shorter and less ugly.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Lars-Peter Clausen [Thu, 19 Sep 2013 12:59:00 +0000 (13:59 +0100)]
iio:adis16400: Use iio_push_to_buffers_with_timestamp()
Makes the code a bit shorter and less ugly.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Lars-Peter Clausen [Thu, 19 Sep 2013 12:59:00 +0000 (13:59 +0100)]
iio:itg3200: Use iio_push_to_buffers_with_timestamp()
Makes the code a bit shorter and less ugly.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Cc: Manuel Stahl <manuel.stahl@iis.fraunhofer.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Lars-Peter Clausen [Thu, 19 Sep 2013 12:59:00 +0000 (13:59 +0100)]
iio:st_sensors: Use iio_push_to_buffers_with_timestamp()
Makes the code a bit shorter and less ugly.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Cc: Denis Ciocca <denis.ciocca@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Lars-Peter Clausen [Thu, 19 Sep 2013 12:59:00 +0000 (13:59 +0100)]
iio:max1363: Use iio_push_to_buffers_with_timestamp()
Makes the code a bit shorter and less ugly.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Lars-Peter Clausen [Thu, 19 Sep 2013 12:59:00 +0000 (13:59 +0100)]
iio:at91_adc: Use iio_push_to_buffers_with_timestamp()
Makes the code a bit shorter and less ugly.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Cc: Josh Wu <josh.wu@atmel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Lars-Peter Clausen [Thu, 19 Sep 2013 12:59:00 +0000 (13:59 +0100)]
iio:ad_sigma_delta: Use iio_push_to_buffers_with_timestamp()
Makes the code a bit shorter and less ugly.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Lars-Peter Clausen [Thu, 19 Sep 2013 12:59:00 +0000 (13:59 +0100)]
iio:ad7923: Use iio_push_to_buffers_with_timestamp()
Makes the code a bit shorter and less ugly.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Lars-Peter Clausen [Thu, 19 Sep 2013 12:59:00 +0000 (13:59 +0100)]
iio:ad7887: Use iio_push_to_buffers_with_timestamp()
Makes the code a bit shorter and less ugly.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Lars-Peter Clausen [Thu, 19 Sep 2013 12:59:00 +0000 (13:59 +0100)]
iio:ad7476: Use iio_push_to_buffers_with_timestamp()
Makes the code a bit shorter and less ugly.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Lars-Peter Clausen [Thu, 19 Sep 2013 12:59:00 +0000 (13:59 +0100)]
iio:ad7298: Use iio_push_to_buffers_with_timestamp()
Makes the code a bit shorter and less ugly.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Lars-Peter Clausen [Thu, 19 Sep 2013 12:59:00 +0000 (13:59 +0100)]
iio:ad7266: Use iio_push_to_buffers_with_timestamp()
Makes the code a bit shorter and less ugly.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Lars-Peter Clausen [Thu, 19 Sep 2013 12:59:00 +0000 (13:59 +0100)]
iio:bma180: Use iio_push_buffers_with_timestamp()
Makes the code shorter and a bit less ugly.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Cc: Oleksandr Kravchenko <o.v.kravchenko@globallogic.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Lars-Peter Clausen [Thu, 19 Sep 2013 12:59:00 +0000 (13:59 +0100)]
iio: Add iio_push_buffers_with_timestamp() helper
Drivers using software buffers often store the timestamp in their data buffer
before calling iio_push_to_buffers() with that data buffer. Storing the
timestamp in the buffer usually involves some ugly pointer arithmetic. This
patch adds a new helper function called iio_push_buffers_with_timestamp() which
is similar to iio_push_to_buffers but takes an additional timestamp parameter.
The function will help to hide to uglyness in one central place instead of
exposing it in every driver. If timestamps are enabled for the IIO device
iio_push_buffers_with_timestamp() will store the timestamp as the last element
in buffer, before passing the buffer on to iio_push_buffers(). The buffer needs
large enough to hold the timestamp in this case. If timestamps are disabled
iio_push_buffers_with_timestamp() will behave just like iio_push_buffers().
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Cc: Oleksandr Kravchenko <o.v.kravchenko@globallogic.com>
Cc: Josh Wu <josh.wu@atmel.com>
Cc: Denis Ciocca <denis.ciocca@gmail.com>
Cc: Manuel Stahl <manuel.stahl@iis.fraunhofer.de>
Cc: Ge Gao <ggao@invensense.com>
Cc: Peter Meerwald <pmeerw@pmeerw.net>
Cc: Jacek Anaszewski <j.anaszewski@samsung.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Marek Vasut <marex@denx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Peter Meerwald [Wed, 18 Sep 2013 21:10:00 +0000 (22:10 +0100)]
iio: Pass scan mask as unsigned long
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Peter Meerwald [Wed, 18 Sep 2013 21:47:00 +0000 (22:47 +0100)]
iio: Fix tcs3472 dev-to-indio_dev conversion in suspend/resume
dev_to_iio_dev() is a false friend
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Zubair Lutfullah [Thu, 19 Sep 2013 06:24:00 +0000 (07:24 +0100)]
iio: ti_am335x_adc: Add continuous sampling support
Previously the driver had only one-shot reading functionality.
This patch adds continuous sampling support to the driver.
Continuous sampling starts when buffer is enabled.
HW IRQ wakes worker thread that pushes samples to userspace.
Sampling stops when buffer is disabled by userspace.
Patil Rachna (TI) laid the ground work for ADC HW register access.
Russ Dill (TI) fixed bugs in the driver relevant to FIFOs and IRQs.
I fixed channel scanning so multiple ADC channels can be read
simultaneously and pushed to userspace.
Restructured the driver to fit IIO ABI.
And added INDIO_BUFFER_HARDWARE mode.
Signed-off-by: Zubair Lutfullah <zubair.lutfullah@gmail.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Russ Dill <Russ.Dill@ti.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Zubair Lutfullah [Thu, 19 Sep 2013 06:24:00 +0000 (07:24 +0100)]
iio: ti_am335x_adc: optimize memory usage
12 bit ADC data is stored in 32 bits of storage.
Change from u32 to u16 to reduce wasted memory.
Signed-off-by: Zubair Lutfullah <zubair.lutfullah@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Zubair Lutfullah [Thu, 19 Sep 2013 06:24:00 +0000 (07:24 +0100)]
input: ti_am335x_tsc: Enable shared IRQ for TSC
Enable shared IRQ to allow ADC to share IRQ line from
parent MFD core. Only FIFO0 IRQs are for TSC and handled
on the TSC side.
Step mask would be updated from cached variable only previously.
In rare cases when both TSC and ADC are used, the cached
variable gets mixed up.
The step mask is written with the required mask every time.
Rachna Patil (TI) laid ground work for shared IRQ.
Signed-off-by: Zubair Lutfullah <zubair.lutfullah@gmail.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Thomas Meyer [Thu, 19 Sep 2013 21:42:00 +0000 (22:42 +0100)]
iio: at91_adc: Cocci spatch "noderef"
sizeof when applied to a pointer typed expression gives the size of the
pointer.
Found by coccinelle spatch "misc/noderef.cocci"
Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Peter Meerwald [Tue, 17 Sep 2013 21:33:00 +0000 (22:33 +0100)]
iio: Make available scan_masks const in ad7266
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Peter Meerwald [Tue, 17 Sep 2013 22:42:00 +0000 (23:42 +0100)]
iio: Minor cleanups of industrialio-buffer
adding one return value check
fix one kerneldoc
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Lars-Peter Clausen [Mon, 16 Sep 2013 08:34:00 +0000 (09:34 +0100)]
iio:max1361: Use default triggered buffer setup ops
The max1361 driver uses the same callbacks as the triggered buffer default
buffer setup ops, so just remove the max1361 specific ops and let it use the
default ops.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Lars-Peter Clausen [Sun, 15 Sep 2013 16:50:00 +0000 (17:50 +0100)]
staging:iio: Remove unnecessary casts for iio_push_to_buffers()
Now that iio_push_to_buffers() takes a void pointer for the data parameter we
can remove those casts to u8*.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Lars-Peter Clausen [Sun, 15 Sep 2013 16:50:00 +0000 (17:50 +0100)]
iio: Remove unnecessary casts for iio_push_to_buffers()
Now that iio_push_to_buffers() takes a void pointer for the data parameter we
can remove those casts to u8*.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Lars-Peter Clausen [Sun, 15 Sep 2013 16:50:00 +0000 (17:50 +0100)]
iio: iio_push_to_buffers(): Change type of 'data' to const void *
Change the type of the 'data' parameter for iio_push_to_buffers() from 'u8 *' to
'const void *'. Drivers typically use the correct type (e.g. __be16 *) for their
data buffer. When passing the buffer to iio_push_to_buffers() it needs to be
cast to 'u8 *' for the compiler to not complain (and also having to add __force
if we want to keep sparse happy as well). Since the buffer implementation should
not care about the data layout (except the size of one sample) using a void
pointer is the correct thing to do. Also make it const as the buffer
implementations are not supposed to modify it.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Lars-Peter Clausen [Sun, 15 Sep 2013 16:09:00 +0000 (17:09 +0100)]
iio:buffer_cb: Constify iio_cb_access
The iio_cb_access struct is never modified so we can mark it as const.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Peter Meerwald [Sun, 15 Sep 2013 15:52:00 +0000 (16:52 +0100)]
iio: Fix tcs3472 buffer size
and drop obsolete #define
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Jonathan Cameron [Sun, 8 Sep 2013 13:57:00 +0000 (14:57 +0100)]
iio:temperature:tmp006 put sampling_frequency in info_mask_shared_by_all
Doing this makes it possible to access this control from within the kernel.
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Peter Meerwald <pmeerw@pmeerw.net>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Jonathan Cameron [Sun, 8 Sep 2013 13:57:00 +0000 (14:57 +0100)]
staging:iio: dummy driver additions to show shared_by_dir infomask usage
Note that as this driver has output as well as output channels an
example of info_mask_shared_by_all that makes any sense does not exist.
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Jonathan Cameron [Sun, 8 Sep 2013 13:57:00 +0000 (14:57 +0100)]
iio: add info_mask_[shared_by_dir/shared_by_all]
These two additional info_mask bitmaps should allow all 'standard'
numeric attributes to be handled using the read_raw and write_raw
callbacks. Whilst this should reduce code, the more important element
is that this makes these values easily accessible to in kernel users
of IIO devices.
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Jonathan Cameron [Sun, 8 Sep 2013 13:57:00 +0000 (14:57 +0100)]
iio: refactor info mask and ext_info attribute creation.
Introduce an enum to specify whether the attribute is separate or
shared.
Factor out the bitmap handling for loop into a separate function.
Tidy up error handling and add a NULL assignment to squish a false
positive warning from GCC.
Change ext_info shared type from boolean to enum and update in all
drivers.
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Jonathan Cameron [Sun, 8 Sep 2013 13:57:00 +0000 (14:57 +0100)]
iio: drop info_mask from struct iio_dev
Somehow this got missed when dropping all the code that used it
prior to the split. Remove it now, there are no users.
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Lars-Peter Clausen [Sun, 15 Sep 2013 15:31:00 +0000 (16:31 +0100)]
iio:kfifo_buf: Use wake_up_interruptible_poll()
Use wake_up_interruptible_poll() instead of wake_up_interruptible() to only wake
up those threads that listen for input poll notifications.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Lars-Peter Clausen [Sun, 15 Sep 2013 15:31:00 +0000 (16:31 +0100)]
iio:buffer: Simplify iio_buffer_is_active()
We can skip having to loop through all the device's buffers to see if a certain
buffer is active, if we let the buffer's list head point to itself when the
buffer is inactive.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Yann Droneaud [Fri, 6 Sep 2013 10:39:00 +0000 (11:39 +0100)]
iio: use anon_inode_getfd() with O_CLOEXEC flag
IIO uses anon_inode_get() to allocate file descriptors as part
of its ioctls. But those ioctls are lacking a flag argument
allowing userspace to choose options for the newly opened file
descriptor.
In such case it's advised to use O_CLOEXEC by default so that
userspace is allowed to choose, without race, if the file descriptor
is going to be inherited across exec().
KVM usage of anon_inode_getfd() was fixed in a previous patchset [1],
so IIO is the only subsystem using anon_inode_getfd() with a fixed set
of flags not including O_CLOEXEC.
This patch set O_CLOEXEC flag on the event file descriptor created
with anon_inode_getfd() to not leak file descriptors across exec().
Links:
- Secure File Descriptor Handling (Ulrich Drepper, 2008)
http://udrepper.livejournal.com/20407.html
- Excuse me son, but your code is leaking !!! (Dan Walsh, March 2012)
http://danwalsh.livejournal.com/53603.html
- [1] kvm: use anon_inode_getfd() with O_CLOEXEC flag
http://lkml.kernel.org/r/cover.
1377372576.git.ydroneaud@opteya.com
Signed-off-by: Yann Droneaud <ydroneaud@opteya.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Jacek Anaszewski [Mon, 9 Sep 2013 15:23:00 +0000 (16:23 +0100)]
iio: gp2ap020a00f: Add a driver for the device
Add a new driver for the ambient light/proximity sensor
device. The driver exposes three channels: light_clear
light_ir and proximity. It also supports triggered buffer,
high and low ambient light threshold event and proximity
detection events.
Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Jacek Anaszewski [Wed, 21 Aug 2013 15:06:00 +0000 (16:06 +0100)]
DT: Add documentation for gp2ap020a00f sensor
This patch adds device tree binding documentation
for the gp2ap020a00f proximity/als sensor.
Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Peter Meerwald [Sat, 14 Sep 2013 19:38:00 +0000 (20:38 +0100)]
iio: Add tcs3472 color light sensor driver
chip has four 16-bit channels for red, green, blue, clear color
intensity; driver supports the TCS3x7x family of devices and was
tested with a TCS34725 chip; further information here:
http://www.ams.com/eng/Products/Light-Sensors/Color-Sensor/TCS34725
v2 (thanks to Jonathan Cameron):
* drop dynamic buffer allocation, buffer is in tcs3472_data
* limit sysfs output to PAGE_SIZE
* check val2 == 0 when writing CALIBSCALE
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Cc: Jon Brenner <jon.brenner@ams.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Lee Jones [Tue, 10 Sep 2013 12:49:00 +0000 (13:49 +0100)]
iio: pressure-core: st: Allow for number of channels to vary
At the moment the number of channels specified is dictated by the first
sensor supported by the driver. As we add support for more sensors this
is likely to vary. Instead of using the ARRAY_SIZE() of the LPS331AP's
channel specifier we'll use a new adaptable 'struct st_sensors' element
instead.
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Lee Jones [Tue, 10 Sep 2013 12:49:00 +0000 (13:49 +0100)]
iio: pressure-core: st: Expand and rename LPS331AP's channel descriptor
Due to the MACRO used, the task of reading, understanding and maintaining
the LPS331AP's channel descriptor is substantially difficult. This patch
is based on the view that it's better to have easy to read, maintainable
code than to save a few lines here and there. For that reason we're
expanding the array so initialisation is completed in full.
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Lee Jones [Tue, 10 Sep 2013 12:49:00 +0000 (13:49 +0100)]
iio: pressure-core: st: Describe LPS331AP defines by name
They're currently named *_1_*, for 'Sensor 1', but the code will be much
more readable if we use the naming convention *_LPS331AP_* instead.
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Lee Jones [Tue, 10 Sep 2013 12:49:00 +0000 (13:49 +0100)]
iio: sensors-core: st: Clean-up error handling in st_sensors_read_info_raw()
Saving a few lines of code.
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Lee Jones [Tue, 10 Sep 2013 12:49:00 +0000 (13:49 +0100)]
iio: sensors-core: st: Allow full-scale to be an optional feature
Some chips either don't support it or fail to provide adequate documentation,
so sometimes it's impossible to enable the feature even if it is supported.
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Peter Meerwald [Sun, 8 Sep 2013 15:20:00 +0000 (16:20 +0100)]
iio: Add tsl4531 ambient light sensor driver
driver for the TSL4531 family of 16-bit I2C ambient light
sensors; information is here:
http://www.ams.com/eng/Products/Light-Sensors/Ambient-Light-Sensor-ALS/TSL45315
the chip offers simple lux output
v3 (thanks Lars-Peter Clausen):
* add mutex to when updating integration time
* fix chip ID checking
* code cleanups
v2:
* rename to tsl4351
* use INT_TIME
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Peter Meerwald [Sun, 8 Sep 2013 15:20:00 +0000 (16:20 +0100)]
iio: adjd_s311: Use INT_TIME channel info
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Peter Meerwald [Sun, 8 Sep 2013 15:20:00 +0000 (16:20 +0100)]
iio: Add INT_TIME (integration time) channel info attribute
Integration time is in seconds; it controls the measurement
time and influences the gain of a sensor.
There are two typical ways that scaling is implemented in a device:
1) input amplifier,
2) reference to the ADC is changed.
These both result in the accuracy of the ADC varying (by applying its
sampling over a more relevant range).
Integration time is a way of dealing with noise inherent in the analog
sensor itself. In the case of a light sensor, a mixture of photon noise
and device specific noise. Photon noise is dealt with by either improving
the efficiency of the sensor, (more photons actually captured) which is not
easily varied dynamically, or by integrating the measurement over a longer
time period. Note that this can also be thought of as an averaging of a
number of individual samples and is infact sometimes implemented this way.
Altering integration time implies that the duration of a measurement changes,
a fact the device's user may be interested in.
Hence it makes sense to distinguish between integration time and simple
scale. In some devices both types of control are present and whilst they
will have similar effects on the amplitude of the reading, their effect
on the noise of the measurements will differ considerably.
Used by adjd_s311, tsl4531, tcs3472
The following drivers have similar controls (and could be adapted):
* tsl2563 (integration time is controlled via CALIBSCALE among other things)
* tsl2583 (has integration_time device_attr, but driver doesn't use channels yet)
* tsl2x7x (has integration_time attr)
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Cc: Jon Brenner <jon.brenner@ams.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Sachin Kamat [Wed, 11 Sep 2013 09:55:00 +0000 (10:55 +0100)]
staging: iio:
ade7854: Use devm_iio_device_alloc
devm_iio_device_alloc makes code simpler.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Barry Song <21cnbao@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Sachin Kamat [Wed, 11 Sep 2013 09:55:00 +0000 (10:55 +0100)]
staging: iio:
ade7759: Use devm_iio_device_alloc
devm_iio_device_alloc makes code simpler.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Barry Song <21cnbao@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Sachin Kamat [Wed, 11 Sep 2013 09:55:00 +0000 (10:55 +0100)]
staging: iio: ade7758_core: Use devm_iio_device_alloc
devm_iio_device_alloc makes code simpler.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Barry Song <21cnbao@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Sachin Kamat [Wed, 11 Sep 2013 09:55:00 +0000 (10:55 +0100)]
staging: iio:
ade7754: Use devm_iio_device_alloc
devm_iio_device_alloc makes code simpler.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Barry Song <21cnbao@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Sachin Kamat [Wed, 11 Sep 2013 09:55:00 +0000 (10:55 +0100)]
staging: iio:
ade7753: Use devm_iio_device_alloc
devm_iio_device_alloc makes code simpler.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Barry Song <21cnbao@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Sachin Kamat [Wed, 11 Sep 2013 09:55:00 +0000 (10:55 +0100)]
staging: iio: ad2s90: Use devm_iio_device_alloc
devm_iio_device_alloc makes code simpler.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Graff Yang <graff.yang@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Sachin Kamat [Wed, 11 Sep 2013 09:55:00 +0000 (10:55 +0100)]
staging: iio: ad2s1210: Use devm_iio_device_alloc
devm_iio_device_alloc makes code simpler.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Graff Yang <graff.yang@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Sachin Kamat [Wed, 11 Sep 2013 09:55:00 +0000 (10:55 +0100)]
staging: iio: ad2s1200: Use dev_err instead of pr_err
dev_err is preferred over pr_err.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Sachin Kamat [Wed, 11 Sep 2013 09:55:00 +0000 (10:55 +0100)]
staging: iio: ad2s1200: Use devm_* APIs
devm_* APIs are device managed and make code simpler.
This patch also fixes the missing gpio_free call in remove.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Graff Yang <graff.yang@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Sachin Kamat [Wed, 11 Sep 2013 10:20:00 +0000 (11:20 +0100)]
staging: iio: tsl2x7x_core: Remove redundant break
'break' after return is redundant. Remove it.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Sachin Kamat [Wed, 11 Sep 2013 10:20:00 +0000 (11:20 +0100)]
iio: dac: ad5686: Remove redundant break
'break' after return is redundant. Remove it.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Sachin Kamat [Wed, 11 Sep 2013 10:20:00 +0000 (11:20 +0100)]
iio: gyro: adxrs450: Remove redundant break
'break' after return is redundant. Remove it.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Sachin Kamat [Wed, 11 Sep 2013 10:20:00 +0000 (11:20 +0100)]
iio: gyro: adis16260: Remove redundant break
'break' after return is redundant. Remove it.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Sachin Kamat [Wed, 11 Sep 2013 10:20:00 +0000 (11:20 +0100)]
iio: gyro: adis16130: Remove redundant break
'break' after return is redundant. Remove it.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Peter Meerwald [Tue, 3 Sep 2013 01:05:00 +0000 (02:05 +0100)]
staging:iio:hmc5843: Use devm_iio_device_alloc
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Sachin Kamat [Wed, 11 Sep 2013 10:00:00 +0000 (11:00 +0100)]
MAINTAINERS: Update Jonathan's email address
Updated with the current one.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Xie XiuQi [Fri, 6 Sep 2013 11:02:00 +0000 (12:02 +0100)]
staging:iio:adc:ad7606 remove unnecessary work pending test
Remove unnecessary work pending test before calling schedule_work().
It has been tested in queue_work_on() already. No functional changed.
Signed-off-by: Xie XiuQi <xiexiuqi@huawei.com>
Reviewed-by: Tejun Heo <tj@kernel.org>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Fabio Estevam [Tue, 3 Sep 2013 00:48:00 +0000 (01:48 +0100)]
iio: mxs-lradc: Add MODULE_ALIAS
Add MODULE_ALIAS, so that auto module loading can work.
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Acked-by: Marek Vasut <marex@denx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Fabio Estevam [Tue, 3 Sep 2013 00:48:00 +0000 (01:48 +0100)]
iio: mxs-lradc: Fix the order of resources removal
Fix the order of resources removal in the error path of mxs_lradc_probe()
and also in mxs_lradc_remove().
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Acked-by: Marek Vasut <marex@denx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Jingoo Han [Tue, 20 Aug 2013 02:31:00 +0000 (03:31 +0100)]
staging: iio: replace strict_strto*() with kstrto*()
The usage of strict_strto*() is not preferred, because
strict_strto*() is obsolete. Thus, kstrto*() should be
used.
Previously, there were only strict_strtol(), strict_strtoul(),
strict_strtoull(), and strict_strtoll(). Thus, when converting
to the variables, only long, unsigned long, unsigned long long,
and long long can be used.
However, kstrto*() provides various functions handling all types
of variables. Therefore, the types of variables can be changed
properly.
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Angelo Compagnucci [Mon, 2 Sep 2013 14:00:00 +0000 (15:00 +0100)]
iio: adc: Add driver for Microchip MCP3422/3/4 high resolution ADC
Sysfs access to all channels.
Signed-off-by: Angelo Compagnucci <angelo.compagnucci@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Sachin Kamat [Thu, 5 Sep 2013 09:29:00 +0000 (10:29 +0100)]
staging: iio: hmc5843: Fix a trivial typo
Add a missing closing brace.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Shubhrajyoti Datta <shubhrajyoti@ti.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Sachin Kamat [Thu, 5 Sep 2013 09:29:00 +0000 (10:29 +0100)]
staging: iio: tsl2x7x_core: Fix sparse warning
Silences the following warning:
drivers/staging/iio/light/tsl2x7x_core.c:553:70:
warning: Using plain integer as NULL pointer
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: J. August Brenner <jbrenner@taosinc.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Sachin Kamat [Thu, 5 Sep 2013 09:29:00 +0000 (10:29 +0100)]
staging: iio: tsl2x7x_core: Use devm_* APIs
devm_* APIs are device managed and make code simpler.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: J. August Brenner <jbrenner@taosinc.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Sachin Kamat [Thu, 5 Sep 2013 09:29:00 +0000 (10:29 +0100)]
staging: iio: ad9951: Use devm_iio_device_alloc
devm_iio_device_alloc makes code simpler.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Sachin Kamat [Thu, 5 Sep 2013 09:29:00 +0000 (10:29 +0100)]
staging: iio: ad9910: Use devm_iio_device_alloc
devm_iio_device_alloc makes code simpler.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Sachin Kamat [Thu, 5 Sep 2013 09:29:00 +0000 (10:29 +0100)]
staging: iio: ad9852: Use devm_iio_device_alloc
devm_iio_device_alloc makes code simpler.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Sachin Kamat [Thu, 5 Sep 2013 09:29:00 +0000 (10:29 +0100)]
staging: iio: ad9850: Use devm_iio_device_alloc
devm_iio_device_alloc makes code simpler.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Sachin Kamat [Thu, 5 Sep 2013 09:29:00 +0000 (10:29 +0100)]
staging: iio: ad9834: Use devm_* APIs
devm_* APIs are device managed and make code simpler.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Sachin Kamat [Thu, 5 Sep 2013 09:29:00 +0000 (10:29 +0100)]
staging: iio: ad9832: Use devm_* APIs
devm_* APIs are device managed and make code simpler.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Sachin Kamat [Thu, 5 Sep 2013 09:29:00 +0000 (10:29 +0100)]
staging: iio: ad5930: Use devm_iio_device_alloc
devm_iio_device_alloc makes code simpler.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Sachin Kamat [Thu, 5 Sep 2013 09:29:00 +0000 (10:29 +0100)]
staging: iio: tsl2583: Use devm_iio_device_alloc
devm_iio_device_alloc makes the code simple. While at it also
fixed an uninitialized return with -EINVAL.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: J. August Brenner <jbrenner@taosinc.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Sachin Kamat [Thu, 5 Sep 2013 09:29:00 +0000 (10:29 +0100)]
staging: iio: ad5933: Use devm_* APIs
devm_* APIs are device managed and make code simpler.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Sachin Kamat [Sat, 31 Aug 2013 17:12:00 +0000 (18:12 +0100)]
staging: iio: adt7316: Use devm_* APIs
devm_* APIs are device managed and make code simpler.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Sachin Kamat [Sat, 31 Aug 2013 17:12:00 +0000 (18:12 +0100)]
staging: iio: lpc32xx_adc: Use devm_* APIs
devm_* APIs are device managed and make code simpler.
This also fixes an error in return type during clk_get
failure.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Roland Stigge <stigge@antcom.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Sachin Kamat [Sat, 31 Aug 2013 17:12:00 +0000 (18:12 +0100)]
staging: iio: ad799x_core: Use devm_* APIs
devm_* APIs are device managed and make code simpler.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Sachin Kamat [Sat, 31 Aug 2013 17:12:00 +0000 (18:12 +0100)]
staging: iio: ad7816: Use devm_* APIs
devm_* APIs are device managed and make code simpler.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Sachin Kamat [Sat, 31 Aug 2013 17:12:00 +0000 (18:12 +0100)]
staging: iio: ad7780: Use devm_* APIs
devm_* APIs are device managed and make code simpler.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Sachin Kamat [Sat, 31 Aug 2013 17:12:00 +0000 (18:12 +0100)]
staging: iio: ad7606_core: Use devm_* APIs
devm_* APIs are device managed and make code simpler.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Sachin Kamat [Sat, 31 Aug 2013 17:12:00 +0000 (18:12 +0100)]
staging: iio: ad7291: Use devm_* APIs
devm_* APIs are device managed and make code simpler.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Sachin Kamat [Sat, 31 Aug 2013 17:12:00 +0000 (18:12 +0100)]
staging: iio:
ad7280a: Use devm_iio_device_alloc
devm_iio_device_alloc makes code simpler.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Sachin Kamat [Sat, 31 Aug 2013 17:12:00 +0000 (18:12 +0100)]
staging: iio: ad7192: Use devm_* APIs and fix a memory leak
devm_* APIs are device managed and make code simpler.
The memory leak was a lack of freeing the iio_dev structure in the
remove function.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Peter Meerwald [Tue, 20 Aug 2013 23:15:00 +0000 (00:15 +0100)]
iio: Remove trailing ; from function definitions
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Matthijs Kooijman [Fri, 30 Aug 2013 16:45:23 +0000 (18:45 +0200)]
staging: dwc2: make dwc2_core_params documentation more complete
Some of the defaults were missing or unclear. In particular, I suspect
the defaults were documented assuming there were still module parameters
and taking the default module parameters into account. Now, the defaults
are the values that will get chosen when the params passed to
dwc2_hcd_init are all -1.
Signed-off-by: Matthijs Kooijman <matthijs@stdin.nl>
Acked-by: Paul Zimmerman <paulz@synopsys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Matthijs Kooijman [Fri, 30 Aug 2013 16:45:22 +0000 (18:45 +0200)]
staging: dwc2: validate the value for phy_utmi_width
The HWCFG4 register stores the supported utmi width values (8, 16 or
both). This commit reads that value and validates the configured value
against that.
If no (valid) value is given, the parameter defaulted to 8 bits
previously. However, the documentation for dwc2_core_params_struct
suggests that the default should have been 16. Also, the pci bindings
explicitely set the value to 16, so this commit changes the default to
16 bits (if supported, 8 bits otherwise).
With the default changed, the value set in pci.c is changed to -1 to
make it autodetected as well.
Signed-off-by: Matthijs Kooijman <matthijs@stdin.nl>
Acked-by: Paul Zimmerman <paulz@synopsys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Matthijs Kooijman [Fri, 30 Aug 2013 16:45:21 +0000 (18:45 +0200)]
staging: dwc2: interpret all hwcfg and related register at init time
Before, the hwcfg registers were read at device init time, but
interpreted at various parts in the code. This commit unpacks the hwcfg
register values into a struct with properly labeled variables at init
time, which makes all the other code using these values more consise and
easier to read. Some values that were previously stored in the hsotg
struct are now moved into this new struct as well.
In addition to the hwcfg registers, the contents of some fifo size
registers are also unpacked. The hwcfg registers are read-only, so they
can be safely stored. The fifo size registers are read-write registers,
but their power-on values are significant: they give the maximum depth
of the fifo they describe.
This commit mostly moves code, but also attempts to simplify some
expressions from (val >> shift) & (mask >> shift) to
(val & mask) >> shift.
Finally, all of the parameters read from the hardware are debug printed
after unpacking them, so a bunch of debug prints can be removed from
other places.
Signed-off-by: Matthijs Kooijman <matthijs@stdin.nl>
Acked-by: Paul Zimmerman <paulz@synopsys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Matthijs Kooijman [Fri, 30 Aug 2013 16:45:20 +0000 (18:45 +0200)]
staging: dwc2: properly mask the GRXFSIZ register
Bits 16-31 are reserved, so the old code just reads the whole register to
get bits 0-15, assuming the reserved bits would be 0 (which seems true
on current hardware, but who knows...).
This commit properly masks out the reserved bits when reading and
doesn't touch the reserved bits while writing.
Signed-off-by: Matthijs Kooijman <matthijs@stdin.nl>
Acked-by: Paul Zimmerman <paulz@synopsys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Matthijs Kooijman [Fri, 30 Aug 2013 16:45:19 +0000 (18:45 +0200)]
staging: dwc2: remove redundant register reads
For calculating FIFO offsets, the sizes of preceding fifos need to be
known. For filling the GDFIFOCFG register, these fifo sizes were read
from hardware registers. However, these values were written to these
registers just a few lines before, so we can just use the values written
instead.
Signed-off-by: Matthijs Kooijman <matthijs@stdin.nl>
Acked-by: Paul Zimmerman <paulz@synopsys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Matthijs Kooijman [Fri, 30 Aug 2013 16:45:18 +0000 (18:45 +0200)]
staging: dwc2: re-use hptxfsiz variable
For some reason, the value of the HPTXFSIZ register was built in the
ptxfsiz variable, while there was also a hptxfsiz variable availble.
Better just use that and remove the (now unused) ptxfsiz variable.
Signed-off-by: Matthijs Kooijman <matthijs@stdin.nl>
Acked-by: Paul Zimmerman <paulz@synopsys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Matthijs Kooijman [Fri, 30 Aug 2013 16:45:17 +0000 (18:45 +0200)]
staging: dwc2: simplify debug output in dwc_hc_init
The value of the hcchar register is built from individual values by
shifting and masking. Before, the debug output extracted the individual
values out of the complete hcchar register again by doing the reverse.
This commit makes the debug output use the original values instead.
One debug message got removed, since it would always print a fixed value
of zero.
Signed-off-by: Matthijs Kooijman <matthijs@stdin.nl>
Acked-by: Paul Zimmerman <paulz@synopsys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Matthijs Kooijman [Fri, 30 Aug 2013 16:45:16 +0000 (18:45 +0200)]
staging: dwc2: add missing shift
This line extracted the available queue space without properly shifting
it. Since the code only cared wether it was zero or not, it worked as
expected without the shift, but adding shift makes the code cleaner.
While we're here, store the result in a helper variable that was already
declared to increase readability a bit more.
Signed-off-by: Matthijs Kooijman <matthijs@stdin.nl>
Acked-by: Paul Zimmerman <paulz@synopsys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Matthijs Kooijman [Fri, 30 Aug 2013 16:45:15 +0000 (18:45 +0200)]
staging: dwc2: simplify register shift expressions
This commit changes expressions from (val >> shift) & (mask >> shift) to
(val & mask) >> shift.
Signed-off-by: Matthijs Kooijman <matthijs@stdin.nl>
Acked-by: Paul Zimmerman <paulz@synopsys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>