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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>