Commit graph

9 commits

Author SHA1 Message Date
Michael Auchter
48404cf578 iio: adc: ad7291: convert to device tree
There are no in-tree users of the platform data for this driver, so
remove it and convert the driver to use device tree instead.

Signed-off-by: Michael Auchter <michael.auchter@ni.com>
Link: https://lore.kernel.org/r/20200922144422.542669-1-michael.auchter@ni.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-09-29 17:27:05 +01:00
Lars-Peter Clausen
8cb631ccbb iio: Remove superfluous of_node assignments
If a driver does not assign an of_node to a IIO device to IIO core will
automatically assign the of_node of the parent device. This automatic
assignment is done in the iio_device_register() function.

There is a fair amount of drivers that currently manually assign the
of_node of the IIO device. All but 4 of them can make use of the automatic
assignment though.

The exceptions are:
 * mxs-lradc-adc: Which uses the of_node of the parent of the parent.
 * stm32-dfsdm-adc, stm32-adc and stm32-dac: Which reference the of_node
   assigned to the IIO device before iio_device_register() is called.

All other drivers are updated to use automatic assignment. This reduces
the amount of boilerplate code involved in setting up the IIO device.

The patch has mostly been auto-generated with the following semantic patch

// <smpl>
@exists@
expression indio_dev;
expression parent;
@@
indio_dev = \(devm_iio_device_alloc\|iio_device_alloc\)(&parent, ...)
...
-indio_dev->dev.of_node = parent.of_node;

@exists@
expression indio_dev;
expression parent;
@@
indio_dev = \(devm_iio_device_alloc\|iio_device_alloc\)(parent, ...)
...
-indio_dev->dev.of_node = parent->of_node;
// </smpl>

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-06-14 14:20:08 +01:00
Alexandru Ardelean
d3be83244c iio: remove explicit IIO device parent assignment
This patch applies the semantic patch:
@@
expression I, P, SP;
@@
   I = devm_iio_device_alloc(P, SP);
   ...
-  I->dev.parent = P;

It updates 302 files and does 307 deletions.
This semantic patch also removes some comments like
'/* Establish that the iio_dev is a child of the i2c device */'

But this is is only done in case where the block is left empty.

The patch does not seem to cover all cases. It looks like in some cases a
different variable is used in some cases to assign the parent, but it
points to the same reference.
In other cases, the block covered by ... may be just too big to be covered
by the semantic patch.

However, this looks pretty good as well, as it does cover a big bulk of the
drivers that should remove the parent assignment.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-06-14 11:49:59 +01:00
Thomas Gleixner
80503b23b2 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 149
Based on 1 normalized pattern(s):

  licensed under the gpl 2 or later

extracted by the scancode license scanner the SPDX license identifier

  GPL-2.0-or-later

has been chosen to replace the boilerplate/reference in 82 file(s).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Allison Randal <allison@lohutok.net>
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Richard Fontana <rfontana@redhat.com>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190524100845.150836982@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-30 11:25:18 -07:00
Jonathan Cameron
52b31bcc93 iio:adc: drop assign iio_info.driver_module and iio_trigger_ops.owner
The equivalent of both of these are now done via macro magic when
the relevant register calls are made.  The actual structure
elements will shortly go away.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
2017-08-22 21:22:25 +01:00
Matt Ranostay
b541eaff49 iio: adc: add missing of_node references to iio_dev
Adding missing indio_dev->dev.of_node references to allow iio consumers
to access the device channels.

Signed-off-by: Matt Ranostay <mranostay@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-07-03 13:40:08 +01:00
Gregor Boirie
bc2b7dab62 iio:core: timestamping clock selection support
Adds a new per-device sysfs attribute "current_timestamp_clock" to allow
userspace to select a particular POSIX clock for buffered samples and
events timestamping.

Following clocks, as listed in clock_gettime(2), are supported:
CLOCK_REALTIME, CLOCK_MONOTONIC, CLOCK_MONOTONIC_RAW,
CLOCK_REALTIME_COARSE, CLOCK_MONOTONIC_COARSE, CLOCK_BOOTTIME and
CLOCK_TAI.

Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com>
Acked-by: Sanchayan Maity <maitysanchayan@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-06-30 19:41:38 +01:00
Greg Kroah-Hartman
db7c17ecbf 3rd round of IIO new drivers, cleanups and functionality for the 3.17 cycle.
New drivers
 * isl29125 digital color light sensor driver
 * TAOS/AMS tcs3414 digital color sensor
 
 Staging graduation
 * ad7291 ADC driver.
 
 New functionality
 * st_sensors - device tree support and bindings
 * mma8452 - device tree support
 
 Cleanups
 * Drop redundant variables in a number of drivers.
 * Reorder a structure definition to ealy wiht a warning about static
   not being at the beginning in the hid-sensors driver.
 * Switch a few more drivers away from using explicit sampling_frequency
   attribute to providing this through the core.
 * Make hid_sensor_get_reporting_interval static as only used within a single
   file.
 * Drop a redundant check for negative values in an unsigned variable from
   ad9832
 * Drop some duplicate case labels in the event monitor example code.
 * Use devm_ioremap_resource to simplify error handling.
 * Use devm_kzalloc within the blackfin timer driver to simplify error
   handling and removal.
 * A number of cleanups of the ad7291 from Hartmut Knaack in response
   to a patch moving it out of staging.
 * Core support for the period info element about events.  It has been
   in the abi for a while, but not added until now to the newer handling
   of information related to events.
 * Add HAS_IOMEM dependency to mxs_lradc to avoid build issues when testing
   enabled.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABAgAGBQJTwtZlAAoJEFSFNJnE9BaIwk0P/AjNATwzEb+ODIeYdQXbliKJ
 ntQlUXhGa1ronrSD/iDsgW7JUbSDcVDKLfZFtmO0oqdJ8Mofb03jUJqRgivpIlq9
 8cbgNZd5Ef4LARHjEsfySAEgZB6x1nnmJkspwcvdAiGqXvooe9HYQuWUkX/e9CYK
 QSb9BpisaPqvuDV3OfGlzshJIm6ntO9O842xrZdvJDAwi4IAyfabGslflA/AGWU1
 ty3duPJvJzNHfq7iJiLhbGcc4yOmtc16lPKdVcpGC8BPdjdQdrw9axFrE0aoCZwF
 zYTUeQnoZGt9ervGaYRdi6rmcoyu/waRZvJUwIbXpHE4JNgB4waU/4iGqTqfQQnd
 tV/0RRKcke4QgQ0k9lZZCHUgedW1LSFpXWFWGXezlHyCieCicrx4WVkH4wEFheC1
 6fb4OeBQY6nwkAdMOwzzHYEkieeYgKA269uKEeyJ4rMhyS36hoQNpSzMqz31c43w
 Ct0iaZdlFIEjoXkx8OumGojJ67oOGJECzfuXSn3xkNFAT2enyy/LzTyGvxGxwaMq
 r3accTdYqd00Z1Jje2MV1KRIcrn9pDJS9obFdesFQj9aV00FSSD8ZyckeHrgLxqV
 zQN567YGpyr2/q3WEW3ecJksnre1tYSwagRmfGheJIcYV/n4qiXO0R/VbSZbnFIz
 68w07E9URklroJn/3wek
 =n+vY
 -----END PGP SIGNATURE-----

Merge tag 'iio-for-3.17c' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next

Jonathan writes:

3rd round of IIO new drivers, cleanups and functionality for the 3.17 cycle.

New drivers
* isl29125 digital color light sensor driver
* TAOS/AMS tcs3414 digital color sensor

Staging graduation
* ad7291 ADC driver.

New functionality
* st_sensors - device tree support and bindings
* mma8452 - device tree support

Cleanups
* Drop redundant variables in a number of drivers.
* Reorder a structure definition to ealy wiht a warning about static
  not being at the beginning in the hid-sensors driver.
* Switch a few more drivers away from using explicit sampling_frequency
  attribute to providing this through the core.
* Make hid_sensor_get_reporting_interval static as only used within a single
  file.
* Drop a redundant check for negative values in an unsigned variable from
  ad9832
* Drop some duplicate case labels in the event monitor example code.
* Use devm_ioremap_resource to simplify error handling.
* Use devm_kzalloc within the blackfin timer driver to simplify error
  handling and removal.
* A number of cleanups of the ad7291 from Hartmut Knaack in response
  to a patch moving it out of staging.
* Core support for the period info element about events.  It has been
  in the abi for a while, but not added until now to the newer handling
  of information related to events.
* Add HAS_IOMEM dependency to mxs_lradc to avoid build issues when testing
  enabled.
2014-07-13 12:31:47 -07:00
Lars-Peter Clausen
3b1cae7c2c staging:iio:ad7291: Move out of staging
The ad7291 driver is in a reasonable shape. It does not use non-standard API/ABI
and there are no major style issues with the driver. So this patch moves it out
of staging.

There is one small warning from checkpatch which is also fixed in this patch.
The patch also sorts the #include directives in alphabetical order.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-07-08 21:17:30 +01:00
Renamed from drivers/staging/iio/adc/ad7291.c (Browse further)