Commit Graph

129 Commits

Author SHA1 Message Date
Nuno Sá 16afe125b5 iio: core: move 'mlock' to 'struct iio_dev_opaque'
Now that there are no more users accessing 'mlock' directly, we can move
it to the iio_dev private structure. Hence, it's now explicit that new
driver's should not directly use this lock.

Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20221012151620.1725215-5-nuno.sa@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-11-23 19:44:00 +00:00
Nuno Sá 0a8565425a iio: core: introduce iio_device_{claim|release}_buffer_mode() APIs
These APIs are analogous to iio_device_claim_direct_mode() and
iio_device_release_direct_mode() but, as the name suggests, with the
logic flipped. While this looks odd enough, it will have at least two
users (in following changes) and it will be important to move the IIO
mlock to the private struct.

Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20221012151620.1725215-2-nuno.sa@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-11-23 19:43:59 +00:00
Nuno Sá b22bc4d607 iio: inkern: remove OF dependencies
Since all users of the OF dependendent API are now converted to use the
firmware agnostic alternative, we can drop OF dependencies from the IIO
in kernel interface.

Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220715122903.332535-15-nuno.sa@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-08-15 22:30:00 +01:00
Nuno Sá 1e64b9c5f9 iio: inkern: move to fwnode properties
This moves the IIO in kernel interface to use fwnode properties and thus
be firmware agnostic.

Note that the interface is still not firmware agnostic. At this point we
have both OF and fwnode interfaces so that we don't break any user. On
top of this we also want to have a per driver conversion and that is the
main reason we have both of_xlate() and fwnode_xlate() support.

Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220715122903.332535-6-nuno.sa@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-08-15 22:29:59 +01:00
Dmitry Rokosov bc72d938c1 iio: trigger: move trig->owner init to trigger allocate() stage
To provide a new IIO trigger to the IIO core, usually driver executes the
following pipeline: allocate()/register()/get(). Before, IIO core assigned
trig->owner as a pointer to the module which registered this trigger at
the register() stage. But actually the trigger object is owned by the
module earlier, on the allocate() stage, when trigger object is
successfully allocated for the driver.

This patch moves trig->owner initialization from register()
stage of trigger initialization pipeline to allocate() stage to
eliminate all misunderstandings and time gaps between trigger object
creation and owner acquiring.

Signed-off-by: Dmitry Rokosov <ddrokosov@sberdevices.ru>
Link: https://lore.kernel.org/r/20220601174837.20292-1-ddrokosov@sberdevices.ru
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-07-16 16:24:19 +01:00
Nuno Sá 10f0930719 iio: core: drop of.h from iio.h
There is no reason to include OF as we only need to forward declare
'of_phandle_args'. Previously, some drivers were actually relying on
this for some headers (those were already fixed).

Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220610084545.547700-20-nuno.sa@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-06-15 22:07:09 +01:00
Jonathan Cameron 12c4efe350 iio: core: Fix IIO_ALIGN and rename as it was not sufficiently large
Discussion of the series:
https://lore.kernel.org/all/20220405135758.774016-1-catalin.marinas@arm.com/
mm, arm64: Reduce ARCH_KMALLOC_MINALIGN brought to my attention that
our current IIO usage of L1CACHE_ALIGN is insufficient as their are Arm
platforms out their with non coherent DMA and larger cache lines at
at higher levels of their cache hierarchy.

Rename the define to make it's purpose more explicit. It will be used
much more widely going forwards (to replace incorrect ____cacheline_aligned
markings.

Note this patch will greatly reduce the padding on some architectures
that have smaller requirements for DMA safe buffers.

The history of changing values of ARCH_KMALLOC_MINALIGN via
ARCH_DMA_MINALIGN on arm64 is rather complex. I'm not tagging this
as fixing a particular patch from that route as it's not clear what to tag.

Most recently a change to bring them back inline was reverted because
of some Qualcomm Kryo cores with an L2 cache with 128-byte lines
sitting above the point of coherency.

c1132702c7 Revert "arm64: cache: Lower ARCH_DMA_MINALIGN to 64 (L1_CACHE_BYTES)"
That reverts:
65688d2a05 arm64: cache: Lower ARCH_DMA_MINALIGN to 64 (L1_CACHE_BYTES) which
refers to the change originally being motivated by Thunder x1 performance
rather than correctness.

Fixes: 6f7c8ee585 ("staging:iio: Add ability to allocate private data space to iio_allocate_device")
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Acked-by: Nuno Sá <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20220508175712.647246-2-jic23@kernel.org
2022-06-14 11:53:11 +01:00
Jonathan Cameron 9822bb87ce iio: core: drop iio_get_time_res()
This function was introduced with the ability to pick a clock.
There are no upstream users so presumably it isn't as obviously useful
as it seemed at the time.  Hence drop it.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Link: https://lore.kernel.org/r/20220220163327.424696-1-jic23@kernel.org
2022-06-14 11:53:09 +01:00
Miquel Raynal ac3e62f51b iio: core: Clarify the modes
As part of a previous discussion with Jonathan Cameron [1], it appeared
necessary to clarify the meaning of each mode so that new developers
could understand better what they should use or not use and when.

The idea of renaming these modes as been let aside because naming is a
big deal and requires a lot of thinking. So for now let's focus on
correctly explaining what each mode implies.

[1] https://lore.kernel.org/linux-iio/20210930165510.2295e6c4@jic23-huawei/

Suggested-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/r/20220207143840.707510-14-miquel.raynal@bootlin.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-04-28 19:22:48 +01:00
Miquel Raynal 51570c9d4b iio: core: Move the currentmode entry to the opaque structure
This entry should, under no situation, be modified by device
drivers. Now that we have limited its read access to device drivers
really needing it and did so through a dedicated helper, we can
easily move this variable to the opaque structure in order to
prevent any further modification from non-authorized code (out of the
core, basically).

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: Alexandru Ardelean <ardeleanalex@gmail.com>
Link: https://lore.kernel.org/r/20220207143840.707510-12-miquel.raynal@bootlin.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-04-10 16:23:01 +01:00
Miquel Raynal 8c576f87ad iio: core: Hide read accesses to iio_dev->currentmode
In order to later move this variable within the opaque structure, let's
create a helper for accessing it in read-only mode. This helper will be
exposed to device drivers and kept accessible for the few that could need
it. The write access to this variable however should be fully reserved to
the core so in a second step we will hide this variable into the opaque
structure.

Cc: Eugen Hristev <eugen.hristev@microchip.com>
Cc: Nicolas Ferre <nicolas.ferre@microchip.com>
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: Ludovic Desroches <ludovic.desroches@microchip.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/r/20220207143840.707510-11-miquel.raynal@bootlin.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-04-10 16:21:45 +01:00
Miquel Raynal 2f53b4adfe iio: Un-inline iio_buffer_enabled()
As we are going to hide the currentmode inside the opaque structure,
this helper would soon need to call a non-inline function which would
simply drop the benefit of having the helper defined inline in a header.

One alternative is to move this helper in the core as there is no more
interest in defining it inline in a header. We will pay the minor cost
either way.

Let's do like the iio_device_id() helper which also refers to the opaque
structure and gets defined in the core.

Suggested-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/r/20220207143840.707510-10-miquel.raynal@bootlin.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-04-10 16:21:45 +01:00
Miquel Raynal a8b6d6708b iio: core: Enhance the kernel doc of modes and currentmodes iio_dev entries
Let's provide more details about these two variables because their
understanding may not be straightforward for someone not used to the IIO
subsystem internal logic. The different modes will soon be also be more
documented for the same reason.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/r/20220207143840.707510-2-miquel.raynal@bootlin.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-04-10 16:15:02 +01:00
Miquel Raynal 1e73d7f689 iio: core: Fix the kernel doc regarding the currentmode iio_dev entry
This is an internal variable, which should be accessed in a very
sporadic way and in no case changed by any device driver.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: Alexandru Ardelean <ardeleanalex@gmail.com>
Link: https://lore.kernel.org/r/20211215151344.163036-2-miquel.raynal@bootlin.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-01-23 18:03:35 +00:00
Antoniu Miclaus ffc7c5172a iio: expose shared parameter in IIO_ENUM_AVAILABLE
The shared parameter should be configurable based on its usage, and not
constrained to IIO_SHARED_BY_TYPE.

This patch aims to improve the flexibility in using the
IIO_ENUM_AVAILABLE define and avoid redefining custom iio enums that
expose the shared parameter.

An example is the ad5766.c driver where IIO_ENUM_AVAILABLE_SHARED was
defined in order to achieve `shared` parameter customization.

The current state of the IIO_ENUM_AVAILABLE implementation will imply
similar redefinitions each time a driver will require access to the
`shared` parameter. An example would be admv1013 driver which will
require custom device attribute for the frequency translation modes:
Quadrature I/Q mode and Intermediate Frequency mode.

Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
Reviewed-by: Alexandru Ardelean <ardeleanalex@gmail.com>
Link: https://lore.kernel.org/r/20211119085627.6348-1-antoniu.miclaus@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-11-27 16:12:23 +00:00
Andy Shevchenko b892770a2c iio: Drop Duplicated "mount-matrix" parameter
All of the users of iio_read_mount_matrix() are using the very same
property name. Moreover, the property name is hard coded in the API
documentation.

Make this clear and avoid duplication now and in the future.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Sean Nyekjaer <sean@geanix.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20210518112546.44592-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-06-03 18:24:13 +01:00
Jonathan Cameron 62a486c46d iio: core: move @clock_id from struct iio_dev to struct iio_dev_opaque
There is already an acessor function used to access it, making this
move straight forward.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Alexandru Ardelean <ardeleanalex@gmail.com>
Link: https://lore.kernel.org/r/20210426174911.397061-10-jic23@kernel.org
2021-05-17 13:54:21 +01:00
Jonathan Cameron 8b1c82cb84 iio: core: move @flags from struct iio_dev to struct iio_dev_opaque
No reason any driver should ever need access to this field, so hide it.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Alexandru Ardelean <ardeleanalex@gmail.com>
Link: https://lore.kernel.org/r/20210426174911.397061-9-jic23@kernel.org
2021-05-17 13:54:21 +01:00
Jonathan Cameron 396f723485 iio: core: move @chrdev from struct iio_dev to struct iio_dev_opaque
No reason for this to be exposed to the drivers, so lets move it to the
opaque structure.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Alexandru Ardelean <ardeleanalex@gmail.com>
Link: https://lore.kernel.org/r/20210426174911.397061-8-jic23@kernel.org
2021-05-17 13:54:17 +01:00
Jonathan Cameron b804e2b76a iio: core: move @info_exist_lock to struct iio_dev_opaque
This lock is only of interest to the IIO core, so make it only
visible there.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Alexandru Ardelean <ardeleanalex@gmail.com>
Link: https://lore.kernel.org/r/20210426174911.397061-7-jic23@kernel.org
2021-05-17 13:49:13 +01:00
Jonathan Cameron 62f4f36cdf iio: core: move @scan_index_timestamp to struct iio_dev_opaque
No reason for this cached value to be exposed to drivers so move it
to the opaque structure.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Alexandru Ardelean <ardeleanalex@gmail.com>
Link: https://lore.kernel.org/r/20210426174911.397061-6-jic23@kernel.org
2021-05-17 13:49:13 +01:00
Jonathan Cameron 3028e0c2af iio: core: move @trig_readonly from struct iio_dev to struct iio_dev_opaque
This is only set via the iio_trig_set_immutable() call and later used
by the IIO core so there is no benefit in drivers being able to access
it.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Alexandru Ardelean <ardeleanalex@gmail.com>
Link: https://lore.kernel.org/r/20210426174911.397061-5-jic23@kernel.org
2021-05-17 13:49:13 +01:00
Jonathan Cameron 6eaf9f6a27 iio: core: move @driver_module from struct iio_dev to struct iio_dev_opaque
Continuing move to hide internal elements from drivers, move this structure
element over.  It's only accessed from iio core files so this one was
straight forward and no accessor functions are needed.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Alexandru Ardelean <ardeleanalex@gmail.com>
Link: https://lore.kernel.org/r/20210426174911.397061-4-jic23@kernel.org
2021-05-17 13:49:13 +01:00
Jonathan Cameron 15ea2878bf iio: core: move @id from struct iio_dev to struct iio_dev_opaque
Continuing from Alexandru Ardelean's introduction of the split between
driver modifiable fields and those that should only be set by the core.

This could have been done in two steps to make the actual move after
introducing iio_device_id() but there seemed limited point to that
given how mechanical the majority of the patch is.

Includes fixup from Alex for missing mxs-lradc-adc conversion.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Alexandru Ardelean <ardeleanalex@gmail.com>
Link: https://lore.kernel.org/r/20210426174911.397061-2-jic23@kernel.org
2021-05-17 13:49:13 +01:00
Gwendal Grignou 995071d36b iio: set default trig->dev.parent
When allocated with [devm_]iio_trigger_alloc(), set trig device parent to
the device the trigger is allocated for by default.

It can always be reassigned in the probe routine.

Change iio_trigger_alloc() API to add the device pointer to be coherent
with devm_iio_trigger_alloc, using similar interface to
iio_device_alloc().

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20210309193620.2176163-2-gwendal@chromium.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-03-25 19:13:50 +00:00
Alexandru Ardelean 32f171724e iio: core: rework iio device group creation
Up until now, the device groups that an IIO device had were limited to 6.
Two of these groups would account for buffer attributes (the buffer/ and
scan_elements/ directories).

Since we want to add multiple buffers per IIO device, this number may not
be enough, when adding a second buffer. So, this change reallocates the
groups array whenever an IIO device group is added, via a
iio_device_register_sysfs_group() helper.

This also means that the groups array should be assigned to
'indio_dev.dev.groups' really late, right before {cdev_}device_add() is
called to do the entire setup.
And we also must take care to free this array when the sysfs resources are
being cleaned up.

With this change we can also move the 'groups' & 'groupcounter' fields to
the iio_dev_opaque object. Up until now, this didn't make a whole lot of
sense (especially since we weren't sure how multibuffer support would look
like in the end).
But doing it now kills one birds with one stone.

An alternative, would be to add a configurable Kconfig symbol
CONFIG_IIO_MAX_BUFFERS_PER_DEVICE (or something like that) and compute a
static maximum of the groups we can support per IIO device. But that would
probably annoy a few people since that would make the system less
configurable.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Link: https://lore.kernel.org/r/20210215104043.91251-11-alexandru.ardelean@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-03-11 20:47:03 +00:00
Greg Kroah-Hartman 749c1e1481 First set of new device support, features and cleanups for IIO in the 5.11 cycle
Usual mixed bag of new drivers / device support + cleanups etc with the
 addition of a fairly big set of yaml conversions.
 
 Txt to yaml format conversions.
 In some cases dropped separate binding and moved to trivial devices (drop).
 
 Listed by manufacturer
   - dht11 temperature(drop)
   - adi,ad2s90 adi,ad5272 adi,ad5592r adi,ad5758 adi,ad5933 adi,ad7303
     adi,adis16480 adi,adf4350
   - ams,as3935
   - asahi-kasei,ak8974
   - atmel,sama5d2-adc
   - avago,apds9300 avago,apds9960
   - bosch,bma180 bosch,bmc150_magn bosch,bme680 bosch,bmg180
   - brcm,iproc-static-adc
   - capella,cm36651
   - domintech,dmard06(drop)
   - fsl,mag3110 fsl,mma8452 fsl,vf610-dac
   - hoperf,hp03
   - honeywell,hmc5843
   - kionix,kxcjk1013
   - maxim,ds1803(drop) maxim,ds4424 maxim,max30100 maxim,max30102
     maxim,max31856 maxim,max31855k maxim,max44009
     maxim,max5481 maxim,max5821
   - meas,htu21(drop) meas,ms5367(drop) meas,ms5611 meas,tsys01(drop)
   - mediatek,mt2701-auxadc
   - melexis,mlx90614 melexis,mlx90632
   - memsic,mmc35240(drop)
   - microchip,mcp41010 microchip,mcp4131 microchip,mcp4725
   - murata,zap2326
   - nxp,fxas21002c nxp,lpc1850-dac
   - pni,rm3100
   - qcom,pm8018-adc qcom,spmi-iadc
   - renesas,isl29501 renesas,rcar-gyroadc
   - samsung,sensorhub-rinato
   - sensiron,sgp30
   - sentech,sx9500
   - sharp,gp2ap020a00f
   - st,hts221 st,lsm6dsx st,st-sensors(many!) st,uvis25 st,vcl53l0x st,vl6180
   - ti,adc084s021 ti,ads124s08
     ti,dac5571 ti,dac7311 ti,dac7512 ti,dac7612
     ti,hdc1000(drop) ti,palmas-gpadc ti,opt3001 ti,tmp07
   - upisemi,us51882
   - vishay,vcnl4035
   - x-powers,axp209
 
 New device support
 * adi,ad5685
   - Add support for AD5338R dual output 10-bit DAC
   - Add DT-binding doc.
 * mediatek,mt6360
   - New driver for this SoC ADC with bindings and using new channel label
     support in the IIO core.
 * st,lsm6dsx
   - Add support for LSM6DST
 
 Core:
 * Add "label" to device channels, provided via a new core callback. Including
   DT docs for when that is the source, and ABI docs.
 * Add devm_iio_triggered_buffer_setup_ext to take extra attributes.
 * dmaengine, unwrap use of iio_buffer_set_attrs()
 * Drop iio_buffer_set_attrs()
 * Centralize ioctl call handling. Later fix to ensure -EINVAL returned if
   no handler has run.
 * Fix an issue with IIO_VAL_FRACTIONAL and negative values - doesn't affect
   any known existing drivers, but will impact a future one.
 * kernel-doc fix in trigger.h
 * file-ops ordering cleanup
 
 Features
 * semtech,sx9310
   - Add control of hardware gain, proximity thresholds, hysteresis and
     debounce.
   - Increase what information on hardware configuration can be provided
     via DT.
 
 Cleanup and minor features
 * adi,ad5685
   - Add of_match_table
 * adi,ad7292
   - Drop pointless spi_set_drvdata() call
 * adi,ad7298
   - Drop platform data and tidy up external reference config.
 * adi,ad7303
   - Drop platform data handling as unused.
 * adi,ad7768
   - Add new label attribute for channels provided from dt.
 * adi,ad7887
   - devm_ usage in probe simplifying remove and error handling.
 * adi,adis16201
   - Drop pointless spi_set_drvdata() call
 * adi,adis16209
   - Drop pointless spi_set_drvdata() call
 * adi,adis16240
   - White space fixup
 * adi,adxl372
   - use new devm_iio_triggered-buffer_setup_ext()
 * amlogic,meson-saradc
   - Drop pointless semicolon.
 * amstaos,tsl2563
   - Put back i2c_device_id table as needed for greybus probing.
 * atmel,at91_adc
   - Use of_device_get_match_data() instead of open coding it.
   - Constify some driver data
   - Add KCONFIG dep on CONFIG_OF and drop of_match_ptr()
   - Drop platform data as mostly dead code.
   - Tidy up reference voltage logic
 * atmel-sama5d2
   - Drop a pointless semicolon
   - Merge buffer and trigger init into a separate function
   - Use new devm_iio_triggered_buff_setup_ext()
 * avago,apds9960
   - Drop a pointless semicolon
 * bosch,bmc150
   - Drop a pointless semicolon
   - Use new iio_triggered_buffer_setup_ext()
 * bosch,bmp280
   - Drop a pointless semicolon
 * fsl,mma8452
   - Constification
 * (google),cros_ec
   - Use new devm_iio_triggered_buffer_setup_ext()
 * hid-sensors
   - Use new iio_triggered_buffer_setup_ext()
 * ingenic,adc
   - Drop a pointless semicolon
 * invensense,icm426xx
   - Fix MAINTAINERS entry missing :
 * mediatek,mt6577_audxac
   - Add binding doc for mt8516 compatible with mt8173
 * motorola,cpcap-adc
   - Fix an implicit fallthrough marking that clang needs to avoid warning.
 * samsung,exynos-adc
   - Stop relying on users counter form input device in ISR.
 * st,lsm6dsx
   - add vdd and vddio regulator control (including binding update)
 * st,stm32-adc
   - Tidy up code for dma transfers.
   - Adapt clock duty cycle for proper functioning. Note no known problems
     with existing boards.
 * st,vl53l0x-i2c
   - Put back i2c_device_id table as needed for greybus probing.
 * vishay,vcnl4035
   - Put back i2c_device_id table as needed for greybus probing.
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCAAvFiEEbilms4eEBlKRJoGxVIU0mcT0FogFAl+8H3IRHGppYzIzQGtl
 cm5lbC5vcmcACgkQVIU0mcT0FogLLA//cE+rUI0ztkE5KD1DY5mu8dy3GotLJe2y
 kVlYao/8H4n3qL9Sm+i47v7pZZfB6UH5jaPa3BqXcGU3HaBaTSza5VhP/hDyfpgD
 Nt46UyE0FxcNEpwqiiyVuVFFx9ifUOayzKwL9ckyPs7n1X6ecZA+sPdmSQLmFzoZ
 IYDR148UxlAr33j7DVF1DLiIdObCIpNc3pn7YDflT/NnXvRY2XgIjqeOiPbldVgm
 8nGgeSQXTyYBKaSyv6seE2qaxyDAhjkz7SVOidWZxPgMjiJJmpRdL3yCn2wVCCCy
 eLh9Ez0zPhywOhsRImICZ9ds0+Wq1Ke2kVqo0N8FJtB+JVZig+R1ElTaUKhES7B2
 zKW1PR3nknP2oo3LWoXL6QR4vm0RcasRYnE2Qmtv6y04Hv3vbdyx6ZW+WCwrlsM8
 fCxHV/m/NN4piTHEFFFkW912GMZM4XqnJ/H4bLd4oA+HP/2vzMuzdBLKZPZRdYYf
 Xd2YTF+iyNYlbN+ZLDd9840cAcKabPsd+ptaJh7lb0MUPPcv5qukhwIBs1/vqrE6
 9/AnJ/Wj/oQZoDbcrgnMVoRn8dxqnQkd883sxiHZAvztEn1CQ9dDyUfKlHHB5BOD
 GhtrEyMn87VWM19yqArW/3ZU7dPBbXHkzlw6FQ67gIYbqaCRwfRi26FCJh0C6Kzi
 auCmjubaALo=
 =kkcj
 -----END PGP SIGNATURE-----

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

Jonathan writes:

First set of new device support, features and cleanups for IIO in the 5.11 cycle

Usual mixed bag of new drivers / device support + cleanups etc with the
addition of a fairly big set of yaml conversions.

Txt to yaml format conversions.
In some cases dropped separate binding and moved to trivial devices (drop).

Listed by manufacturer
  - dht11 temperature(drop)
  - adi,ad2s90 adi,ad5272 adi,ad5592r adi,ad5758 adi,ad5933 adi,ad7303
    adi,adis16480 adi,adf4350
  - ams,as3935
  - asahi-kasei,ak8974
  - atmel,sama5d2-adc
  - avago,apds9300 avago,apds9960
  - bosch,bma180 bosch,bmc150_magn bosch,bme680 bosch,bmg180
  - brcm,iproc-static-adc
  - capella,cm36651
  - domintech,dmard06(drop)
  - fsl,mag3110 fsl,mma8452 fsl,vf610-dac
  - hoperf,hp03
  - honeywell,hmc5843
  - kionix,kxcjk1013
  - maxim,ds1803(drop) maxim,ds4424 maxim,max30100 maxim,max30102
    maxim,max31856 maxim,max31855k maxim,max44009
    maxim,max5481 maxim,max5821
  - meas,htu21(drop) meas,ms5367(drop) meas,ms5611 meas,tsys01(drop)
  - mediatek,mt2701-auxadc
  - melexis,mlx90614 melexis,mlx90632
  - memsic,mmc35240(drop)
  - microchip,mcp41010 microchip,mcp4131 microchip,mcp4725
  - murata,zap2326
  - nxp,fxas21002c nxp,lpc1850-dac
  - pni,rm3100
  - qcom,pm8018-adc qcom,spmi-iadc
  - renesas,isl29501 renesas,rcar-gyroadc
  - samsung,sensorhub-rinato
  - sensiron,sgp30
  - sentech,sx9500
  - sharp,gp2ap020a00f
  - st,hts221 st,lsm6dsx st,st-sensors(many!) st,uvis25 st,vcl53l0x st,vl6180
  - ti,adc084s021 ti,ads124s08
    ti,dac5571 ti,dac7311 ti,dac7512 ti,dac7612
    ti,hdc1000(drop) ti,palmas-gpadc ti,opt3001 ti,tmp07
  - upisemi,us51882
  - vishay,vcnl4035
  - x-powers,axp209

New device support
* adi,ad5685
  - Add support for AD5338R dual output 10-bit DAC
  - Add DT-binding doc.
* mediatek,mt6360
  - New driver for this SoC ADC with bindings and using new channel label
    support in the IIO core.
* st,lsm6dsx
  - Add support for LSM6DST

Core:
* Add "label" to device channels, provided via a new core callback. Including
  DT docs for when that is the source, and ABI docs.
* Add devm_iio_triggered_buffer_setup_ext to take extra attributes.
* dmaengine, unwrap use of iio_buffer_set_attrs()
* Drop iio_buffer_set_attrs()
* Centralize ioctl call handling. Later fix to ensure -EINVAL returned if
  no handler has run.
* Fix an issue with IIO_VAL_FRACTIONAL and negative values - doesn't affect
  any known existing drivers, but will impact a future one.
* kernel-doc fix in trigger.h
* file-ops ordering cleanup

Features
* semtech,sx9310
  - Add control of hardware gain, proximity thresholds, hysteresis and
    debounce.
  - Increase what information on hardware configuration can be provided
    via DT.

Cleanup and minor features
* adi,ad5685
  - Add of_match_table
* adi,ad7292
  - Drop pointless spi_set_drvdata() call
* adi,ad7298
  - Drop platform data and tidy up external reference config.
* adi,ad7303
  - Drop platform data handling as unused.
* adi,ad7768
  - Add new label attribute for channels provided from dt.
* adi,ad7887
  - devm_ usage in probe simplifying remove and error handling.
* adi,adis16201
  - Drop pointless spi_set_drvdata() call
* adi,adis16209
  - Drop pointless spi_set_drvdata() call
* adi,adis16240
  - White space fixup
* adi,adxl372
  - use new devm_iio_triggered-buffer_setup_ext()
* amlogic,meson-saradc
  - Drop pointless semicolon.
* amstaos,tsl2563
  - Put back i2c_device_id table as needed for greybus probing.
* atmel,at91_adc
  - Use of_device_get_match_data() instead of open coding it.
  - Constify some driver data
  - Add KCONFIG dep on CONFIG_OF and drop of_match_ptr()
  - Drop platform data as mostly dead code.
  - Tidy up reference voltage logic
* atmel-sama5d2
  - Drop a pointless semicolon
  - Merge buffer and trigger init into a separate function
  - Use new devm_iio_triggered_buff_setup_ext()
* avago,apds9960
  - Drop a pointless semicolon
* bosch,bmc150
  - Drop a pointless semicolon
  - Use new iio_triggered_buffer_setup_ext()
* bosch,bmp280
  - Drop a pointless semicolon
* fsl,mma8452
  - Constification
* (google),cros_ec
  - Use new devm_iio_triggered_buffer_setup_ext()
* hid-sensors
  - Use new iio_triggered_buffer_setup_ext()
* ingenic,adc
  - Drop a pointless semicolon
* invensense,icm426xx
  - Fix MAINTAINERS entry missing :
* mediatek,mt6577_audxac
  - Add binding doc for mt8516 compatible with mt8173
* motorola,cpcap-adc
  - Fix an implicit fallthrough marking that clang needs to avoid warning.
* samsung,exynos-adc
  - Stop relying on users counter form input device in ISR.
* st,lsm6dsx
  - add vdd and vddio regulator control (including binding update)
* st,stm32-adc
  - Tidy up code for dma transfers.
  - Adapt clock duty cycle for proper functioning. Note no known problems
    with existing boards.
* st,vl53l0x-i2c
  - Put back i2c_device_id table as needed for greybus probing.
* vishay,vcnl4035
  - Put back i2c_device_id table as needed for greybus probing.

* tag 'iio-for-5.11a' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (126 commits)
  dt-bindings:iio:adc:x-powers,axp209-adc: txt to yaml conversion
  dt-bindings:iio:adc:renesas,rcar-gyroadc: txt to yaml conversion.
  dt-bindings:iio:adc:atmel,sama5d2-adc: txt to yaml conversion
  dt-bindings:iio:magnetometer:pni,rm3100: txt to yaml conversion.
  dt-bindings:iio:magnetometer:honeywell,hmc5843: txt to yaml format conversion
  dt-bindings:iio:magnetometer:bosch,bmc150_magn: txt to yaml conversion.
  dt-bindings:iio:magnetometer:asahi-kasei,ak8974: txt to yaml format conversion
  dt-bindings:iio:magnetometer:fsl,mag3110: txt to yaml conversion
  dt-bindings:iio:light:st,vl6180: txt to yaml format conversion.
  dt-bindings:iio:light:vishay,vcnl4035: txt to yaml conversion
  dt-bindings:iio:light:st,uvis25: txt to yaml conversion for this UV sensor
  dt-bindings:iio:light:upisemi,us51882: txt to yaml conversion.
  dt-bindings:iio:light:ti,opt3001: txt to yaml conversion
  dt-bindings:iio:light:maxim,max44009: txt to yaml conversion.
  dt-bindings:iio:light:sharp,gp2ap020a00f: txt to yaml conversion.
  dt-bindings:iio:light:capella,cm36651: txt to yaml conversion.
  dt-bindings:iio:light:avago,apds9960: txt to yaml conversion
  dt-bindings:iio:light:avago,apds9300: txt to yaml conversion.
  dt-bindings:iio:imu:st,lsm6dsx: txt to yaml conversion
  dt-bindings:iio:imu:adi,adis16480: txt to yaml conversion
  ...
2020-11-24 08:30:08 +01:00
Cristian Pop 1d4ef9b39e iio: core: Add optional symbolic label to a device channel
If a label is defined in the device tree for this channel add that
to the channel specific attributes. This is useful for userspace to
be able to identify an individual channel.

Signed-off-by: Cristian Pop <cristian.pop@analog.com>
Link: https://lore.kernel.org/r/20200928090959.88842-1-cristian.pop@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-11-08 16:07:39 +00:00
Linus Torvalds ade7afe3e6 Staging / IIO driver updates for 5.10-rc1
Here is the large set of staging and IIO driver updates for 5.10-rc1.
 
 Included in here are:
 	- new IIO drivers
 	- new IIO driver frameworks
 	- various IIO driver fixes and updates
 	- IIO device tree conversions to yaml
 	- so many minor staging driver coding style cleanups
 	- most cdev driver moved out of staging
 	- no new drivers added or removed
 
 Full details are in the shortlog.
 
 All of these have been in linux-next for a while with no reported
 issues.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 
 iG0EABECAC0WIQT0tgzFv3jCIUoxPcsxR9QN2y37KQUCX4g+oQ8cZ3JlZ0Brcm9h
 aC5jb20ACgkQMUfUDdst+ymAyQCghI58tN/Np3itPlZuc+HYFN7OHH8An1TKzCm1
 bwkfw5qAcHab+R7KQZOA
 =BaXS
 -----END PGP SIGNATURE-----

Merge tag 'staging-5.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging

Pull staging / IIO driver updates from Greg KH:
 "Here is the large set of staging and IIO driver updates for 5.10-rc1.

  Included in here are:

   - new IIO drivers

   - new IIO driver frameworks

   - various IIO driver fixes and updates

   - IIO device tree conversions to yaml

   - so many minor staging driver coding style cleanups

   - most cdev driver moved out of staging

   - no staging drivers added or removed

  Full details are in the shortlog.

  All of these have been in linux-next for a while with no reported
  issues"

* tag 'staging-5.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (476 commits)
  staging: comedi: check validity of wMaxPacketSize of usb endpoints found
  staging: wfx: improve robustness of wfx_get_hw_rate()
  staging: wfx: drop unicode characters from strings
  staging: wfx: gpiod_get_value() can return an error
  staging: wfx: increase robustness of hif_generic_confirm()
  staging: wfx: wfx_init_common() returns NULL on error
  staging: wfx: standardize the error when vif does not exist
  staging: wfx: check memory allocation
  staging: wfx: improve error handling of hif_join()
  staging: dpaa2-switch: add a dpaa2_switch prefix to all functions in ethsw.c
  staging: dpaa2-switch: add a dpaa2_switch_ prefix to all functions in ethsw-ethtool.c
  staging: rtl8188eu: Fix long lines
  dt-bindings: staging: wfx: silabs,wfx yaml conversion
  staging: wfx: update copyrights dates
  staging: wfx: fix QoS priority for slow buses
  staging: wfx: fix BA sessions for older firmwares
  staging: wfx: remove remaining code of 'secure link' feature
  staging: wfx: fix handling of MMIC error
  staging: vchiq: Fix list_for_each exit tests
  staging: greybus: use __force when assigning __u8 value to snd_ctl_elem_type_t
  ...
2020-10-15 09:46:23 -07:00
Jonathan Cameron cd7798cbd2 iio: Add __printf() attributes to various allocation functions
A partial set of these was added to IIO a long time back.
This fills in some gaps in coverage highlighted by building
with W=1

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20200913132115.800131-3-jic23@kernel.org
2020-09-21 18:54:18 +01:00
Mauro Carvalho Chehab 78ff97ebd4 iio: iio.h: fix a warning at the kernel-doc markup
There's a warning at iio.h kernel-doc markup:

	./include/linux/iio/iio.h:644: WARNING: Unknown target name: "devm".

Because it is using {devm_}foo notation. Well, this is not
a valid kernel-doc notation. Also, it prevents creating hyperlinks
to other documentation functions.

So, replace it to a better notation.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Link: https://lore.kernel.org/r/d8f2275c438c459ede4e6fba03ce719cc6ad898b.1599660067.git.mchehab+huawei@kernel.org
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
2020-09-11 09:39:57 -06:00
Alexandru Ardelean f4bf09d530 iio: core: remove iio_priv_to_dev() helper
All users of this helper have been updated to not use it.
Remove it now, so that we don't need to move it when creating the
iio_dev_opaque structure.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-07-13 15:07:34 +01:00
Alexandru Ardelean fa83c3baa5 iio: core: move event interface on the opaque struct
Same as with other private fields, this moves the event interface reference
to the opaque IIO device object, to be invisible to drivers.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-07-07 20:24:07 +01:00
Alexandru Ardelean 6a8c6b26f7 iio: core: move iio_dev's buffer_list to the private iio device object
This change moves the 'buffer_list' away from the public IIO device object
into the private part.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-07-07 20:24:06 +01:00
Alexandru Ardelean 207c2d27a0 iio: core: move channel list & group to private iio device object
This change bit straightforward and simple, since the
'channel_attr_list' & 'chan_attr_group' fields are only used in
'industrialio-core.c'.

This change moves to the private IIO device object

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-07-07 20:24:06 +01:00
Alexandru Ardelean 96fb1b6742 iio: core: move debugfs data on the private iio dev info
This change moves all iio_dev debugfs fields to the iio_dev_priv object.
It's not the biggest advantage yet (to the whole thing of abstractization)
but it's a start.

The iio_get_debugfs_dentry() function (which is moved in
industrialio-core.c) needs to also be guarded against the CONFIG_DEBUG_FS
symbol, when it isn't defined. We do want to keep the inline definition in
the iio.h header, so that the compiler can better infer when to compile out
debugfs code that is related to the IIO debugfs directory.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-07-07 20:24:06 +01:00
Alexandru Ardelean 6d4ebd565d iio: core: wrap IIO device into an iio_dev_opaque object
There are plenty of bad designs we want to discourage or not have to review
manually usually about accessing private (marked as [INTERN]) fields of
'struct iio_dev'.

Sometimes users copy drivers that are not always the best examples.

A better idea is to hide those fields into the framework.
For 'struct iio_dev' this is a 'struct iio_dev_opaque' which wraps a public
'struct iio_dev' object.

In the next series, some fields will be moved to this new struct, each with
it's own rework.

This rework will not be complete-able for a while, as many fields need some
drivers to be reworked in order to finalize them (e.g. 'indio_dev->mlock').

But some fields can already be moved, and in time, all of them may get
there (in the 'struct iio_dev_opaque' object).

Since a lot of drivers also call 'iio_priv()', in order to preserve
fast-paths (where this matters), the public iio_dev object will have a
'priv' field that will have the pointer to the private information already
computed. The reference returned by this field should be guaranteed to be
cacheline aligned.

The opaque parts will be moved into the 'include/linux/iio/iio-opaque.h'
header. Should the hidden information be required for some debugging or
some special needs, it can be made available via this header.
Otherwise, only the IIO core files should include this file.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-07-07 20:24:06 +01:00
Alexandru Ardelean f5d017938e iio: core: add iio_device_set_parent() helper
By default, the device allocation will also assign a parent device to the
IIO device object. In cases where devm_iio_device_alloc() is used,
sometimes the parent device must be different than the device used to
manage the allocation.

In that case, this helper should be used to change the parent, hence the
requirement to call this between allocation & registration.

This pattern/requirement is not very common in the IIO space, and it may be
cleaned up later.
But until then, assigning the parent manually between allocation &
registration is slightly easier.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-06-14 11:49:57 +01:00
Alexandru Ardelean 78289b4a58 iio: core: pass parent device as parameter during allocation
The change passes the parent device to the iio_device_alloc() call. This
also updates the devm_iio_device_alloc() call to consider the device object
as the parent device by default.

Having it passed like this, should ensure that any IIO device object
already has a device object as parent, allowing for neater control, like
passing the 'indio_dev' object for other stuff [like buffers/triggers/etc],
and potentially creating iiom_xxx(indio_dev) functions.

With this patch, only the 'drivers/platform/x86/toshiba_acpi.c' needs an
update to pass the parent object as a parameter.

In the next patch all devm_iio_device_alloc() calls will be handled.

Acked-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-06-14 11:49:56 +01:00
Jonathan Cameron 18d563858d iio: make iio_device_get_drvdata take a const struct iio_dev *.
As this just calls dev_get_drvdata underneath which is happy with
a const struct device * we should change and avoid potentially
casting away a const in order to then put it back again.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-06-14 11:49:50 +01:00
Greg Kroah-Hartman e8014d83f6 Merge 5.7-rc3 into staging-next
We need the staging fixes in here too, and this resolves a merge issue
with the vt6656 driver.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-27 12:20:40 +02:00
Greg Kroah-Hartman 4e1d96306d First set of new IIO device support, features and cleanup for the 5.8 cycle
Usual mix of new drivers, new support in old drivers and lots of minor
 cleanup. Yaml conversions also continue to trickle in (plenty more to go!)
 
 New device support
 * ad7476
   - Add ad7091 support (ID only)
 * ad9467
   - New driver for this 200/250 MSPS adi-axi-adc and SPI attached ADC.
 * adi-axi-adc
   - New driver to support ADIs generic AXI ADC IP core, used to provide
     high speed interfaces to ADCs (JESD204B/C or parallel interfaces). Usually
     paired with a device using a slow configuration interface (spi etc)
     Includes DT bindings and some fixes for fpga headers.
 * bmg160
   - Add support for BMI088 (ID only)
 * max1241
   - New driver for this ADC.
 * st_sensors
   - Add support for LIS2HH12 accelerometer
 * sx9310
   - New driver supporting sx9310 and sx9311 proximity sensors.
 
 Yaml DT binding conversions
 * rockchip-saradc (including adding some missing parts)
 * stm32-dac
 * tsl2563
 * vcnl4000
 
 Features
 * st_lsm6dsx
   - Add LIS3MDL as a possible sensor hub device.
 * vcnl4000
   - Add new concept of near level (from DT) to provide to userspace which
     often needs to have some calibrated concept of 'near'.
 
 Cleanups, minor fixes etc.
 * core
   - Use snprintf for functions where strings are built and there is
     potential for overflow.
   - Correct docs to indicate mlock should not be used directly by drivers.
   - Fix up accidental dropping of a patch to use bitmap_zalloc.
   - Stop allowing enabling of buffers with no channels enabled.
   - Drop unused 'stufftoread' from iio_buffer.
   - Drop scan_el_attrs form iio_buffer as unused.
   - Reorder sanity checks in __iio_device_register to fail earlier.
   - Drop all the devm_ runregister / free functions from IIO as they
     were never used and encourage poor design.
 * dma-buffer
   - Tidy up includes.
 * dma-engine-buffer
   - Provide dev-managed allocator.
   - Fix an issue with printing a size_t
 * cross subsystem (kxsd9, bmg160, mpu3050, bmi160, mpu6050, bmc150)
   - Replace some unnecessary casts of error ptrs and whilst there.
     use the %pe printf parameter to print them in a more useful fashion.
 * cross subsystem
   - Drop casts in calls to regmap_bulk_read as they make no sense.
   - Use devm_platform_ioremap_resource to reduce boilerplate.
   - Fix typos in Analog Devices.
 * counters/104-quad
   - Add Syed Nayyar Waris as an additional maintainer.
 * ad7476
   - Generate CONVST signal internally rather than requiring external
     trigger.  Add sysfs read back as can now do so.
   - use devm_add_action_or_reset to tidy up error and remove handling.
 * ad7793
   - Switch to read_avail from explicit attribute. Mostly done to avoid
     confusing people with a - sign (without surounding spaces) that
     was correct but checkpatch didn't like.
 * adis library
   - Add missing newlines at end of error messages.
 * adis16400
   - Use DEFINE_DEBUGS_ATTRIBUTE rather than DEFINE_SIMPLE_ATTR.
 * adis16460
   - Use DEFINE_DEBUGS_ATTRIBUTE rather than DEFINE_SIMPLE_ATTR.
 * ad_sigma_delta
   - Move some channel definitions into individual drivers to avoid
     having to deal with complex options.
 * ak8974
   - Silence an error on deffered probe.
 * bmp280
   - Harden against IRQ before registration.
   - Convert to read_avail instead of opencoding the equivalent.
   - Explicitly mark GPIO as optional.
   - Cleanup casts.
   - Remove line breaks from strings.
 * htts221
   - Replace direct access to platform_data with dev_get_platdata().
   - Use device properties rather than device tree ones to allow ACPI
     probing.
   - Casting cleanups.
 * intel_mrfld_adc
   - Don't use unaligned accessor for aligned data.
 * isl29125
   - Reorder buer pre and post hooks to allow for coming core rework.
 * ltc2983
   - Remove comp to bool.
 * max1363
   - Stop using mlock from the iio_dev directly in favour of a local lock
     with clearly defined scope.
 * max30100
   - Use generic device properties to allow ACPI probe.
 * mpu6050
   - Convert to i2c_new_client_device.
   - Add debugfs register access.
 * st_lsm6dsx
   - Provide means of configuring full scale on slave device if supported.
   - Drop include of st_sensors header to get one value. Its not otherwise
     used by this driver.
 * st-sensors
   - Replace direct access to platform_data with dev_get_platdata().
   - Casting cleanups.
   - Avoid splitting strings.
 * st_uvis25
   - Casting cleanups.
 * tsl2563
   - Typo fix.
 * tsl2772
   - scnprintf in a non obvious string building usecase. Note also 'fixes'
     a wrong calculation of remaining space that couldn't actually cause
     any trouble as there was lots of room.
 * xilinx-xadc
   - Fix Lars-Peter spelling his own name wrong :) + additional typos.
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCAAvFiEEbilms4eEBlKRJoGxVIU0mcT0FogFAl6gicARHGppYzIzQGtl
 cm5lbC5vcmcACgkQVIU0mcT0Foj3ig//XRAAHRSfzXFpvYxITVKDIGwP/giYdp91
 OflGw/0aOZFExr72ENLmCArXZPOT2qAZyNNoDNvuJ9SkcVDf4bT3w9gYwWtJ1sd7
 Hhh+1JpPspSo6vS85FMjm37UDfSbmYqB6wC57cZ5pKQIiJwi6W2hGsyOoOXmfLLc
 57d3mlg4g3KLl9Hl4UTU84gE1ushKQgNxVH21Y71pOTa8p+xbWWcspWjR2Jf+kVZ
 qPr2+2rP/AjeAVLu9SKfdBiczYQCNR3uFWKkOKsBE9fq3sbcN6NT5DktrSJUH+qU
 zfUGmShCEP908/9fARazXQZcTOX1tIUOnrpHG9l54GNPh3S2Qk9xGaZxvQy5sguC
 AmC4p+MaIMrMcgWMk9po+nE5INJq7HBV/0jnADG307wEhFrKrjh/2PtP4f9k/Mcv
 sHB7K1+dcJAUwFb5gccdDBfmKMnwfnGS8OFGLXZZKBIDqSvptmIs/pmavjEPgqhV
 GwGTDPyZKeyDnyhTXGafxii03Q2I62Zte5l4jcZ+q8Q4UMxQovEkX6IvUpXwA0Kk
 eoxedbgdvzxrDNiNrXa0k6CLzqSQW+aVHgJG+HEig4IXQse8zXb11HCs35zq5r4j
 JI2UjLk3zUHLiNR/Ir9fKAbPwWSWv3IWkfmFEEUWvUFjM+Xot1Hg+61vBTFKo4iK
 EIqqPZmd5Mk=
 =DyTF
 -----END PGP SIGNATURE-----

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

Jonathan writes:

First set of new IIO device support, features and cleanup for the 5.8 cycle

Usual mix of new drivers, new support in old drivers and lots of minor
cleanup. Yaml conversions also continue to trickle in (plenty more to go!)

New device support
* ad7476
  - Add ad7091 support (ID only)
* ad9467
  - New driver for this 200/250 MSPS adi-axi-adc and SPI attached ADC.
* adi-axi-adc
  - New driver to support ADIs generic AXI ADC IP core, used to provide
    high speed interfaces to ADCs (JESD204B/C or parallel interfaces). Usually
    paired with a device using a slow configuration interface (spi etc)
    Includes DT bindings and some fixes for fpga headers.
* bmg160
  - Add support for BMI088 (ID only)
* max1241
  - New driver for this ADC.
* st_sensors
  - Add support for LIS2HH12 accelerometer
* sx9310
  - New driver supporting sx9310 and sx9311 proximity sensors.

Yaml DT binding conversions
* rockchip-saradc (including adding some missing parts)
* stm32-dac
* tsl2563
* vcnl4000

Features
* st_lsm6dsx
  - Add LIS3MDL as a possible sensor hub device.
* vcnl4000
  - Add new concept of near level (from DT) to provide to userspace which
    often needs to have some calibrated concept of 'near'.

Cleanups, minor fixes etc.
* core
  - Use snprintf for functions where strings are built and there is
    potential for overflow.
  - Correct docs to indicate mlock should not be used directly by drivers.
  - Fix up accidental dropping of a patch to use bitmap_zalloc.
  - Stop allowing enabling of buffers with no channels enabled.
  - Drop unused 'stufftoread' from iio_buffer.
  - Drop scan_el_attrs form iio_buffer as unused.
  - Reorder sanity checks in __iio_device_register to fail earlier.
  - Drop all the devm_ runregister / free functions from IIO as they
    were never used and encourage poor design.
* dma-buffer
  - Tidy up includes.
* dma-engine-buffer
  - Provide dev-managed allocator.
  - Fix an issue with printing a size_t
* cross subsystem (kxsd9, bmg160, mpu3050, bmi160, mpu6050, bmc150)
  - Replace some unnecessary casts of error ptrs and whilst there.
    use the %pe printf parameter to print them in a more useful fashion.
* cross subsystem
  - Drop casts in calls to regmap_bulk_read as they make no sense.
  - Use devm_platform_ioremap_resource to reduce boilerplate.
  - Fix typos in Analog Devices.
* counters/104-quad
  - Add Syed Nayyar Waris as an additional maintainer.
* ad7476
  - Generate CONVST signal internally rather than requiring external
    trigger.  Add sysfs read back as can now do so.
  - use devm_add_action_or_reset to tidy up error and remove handling.
* ad7793
  - Switch to read_avail from explicit attribute. Mostly done to avoid
    confusing people with a - sign (without surounding spaces) that
    was correct but checkpatch didn't like.
* adis library
  - Add missing newlines at end of error messages.
* adis16400
  - Use DEFINE_DEBUGS_ATTRIBUTE rather than DEFINE_SIMPLE_ATTR.
* adis16460
  - Use DEFINE_DEBUGS_ATTRIBUTE rather than DEFINE_SIMPLE_ATTR.
* ad_sigma_delta
  - Move some channel definitions into individual drivers to avoid
    having to deal with complex options.
* ak8974
  - Silence an error on deffered probe.
* bmp280
  - Harden against IRQ before registration.
  - Convert to read_avail instead of opencoding the equivalent.
  - Explicitly mark GPIO as optional.
  - Cleanup casts.
  - Remove line breaks from strings.
* htts221
  - Replace direct access to platform_data with dev_get_platdata().
  - Use device properties rather than device tree ones to allow ACPI
    probing.
  - Casting cleanups.
* intel_mrfld_adc
  - Don't use unaligned accessor for aligned data.
* isl29125
  - Reorder buer pre and post hooks to allow for coming core rework.
* ltc2983
  - Remove comp to bool.
* max1363
  - Stop using mlock from the iio_dev directly in favour of a local lock
    with clearly defined scope.
* max30100
  - Use generic device properties to allow ACPI probe.
* mpu6050
  - Convert to i2c_new_client_device.
  - Add debugfs register access.
* st_lsm6dsx
  - Provide means of configuring full scale on slave device if supported.
  - Drop include of st_sensors header to get one value. Its not otherwise
    used by this driver.
* st-sensors
  - Replace direct access to platform_data with dev_get_platdata().
  - Casting cleanups.
  - Avoid splitting strings.
* st_uvis25
  - Casting cleanups.
* tsl2563
  - Typo fix.
* tsl2772
  - scnprintf in a non obvious string building usecase. Note also 'fixes'
    a wrong calculation of remaining space that couldn't actually cause
    any trouble as there was lots of room.
* xilinx-xadc
  - Fix Lars-Peter spelling his own name wrong :) + additional typos.

* tag 'iio-for-5.8a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (101 commits)
  iio: magnetometer: ak8974: Silence deferred-probe error
  Documentation: ABI: document IIO in_proximity_nearlevel file
  iio: vcnl4000: Export near level property for proximity sensor
  dt-bindings: iio: light: vcnl4000: Add proximity-near-level
  dt-bindings: iio: Introduce common properties for iio sensors
  dt-bindings: iio: vcnl4000: convert bindings to YAML format
  iio: Fix misspellings of "Analog Devices"
  iio: light: isl29125: fix iio_triggered_buffer_{predisable,postenable} positions
  iio: adc: fsl-imx25-gcq: Use devm_platform_ioremap_resource
  iio: adc: at91-adc: Use devm_platform_ioremap_resource
  iio: adc: sun4i-gpadc-iio: Use devm_platform_ioremap_resource
  iio:light:ltr501: Drop unnecessary cast of parameter in regmap_bulk_read
  iio:magn:mmc35240: Drop unnecessary casts of val parameter in regmap_bulk*
  iio:imu:mpu6050: Tidy up parameters to regmap_bulk functions.
  iio:chemical:bme680: Tidy up parameters to regmap_bulk_read
  iio:chemical:atlas-sensor: Drop unnecessary explicit casts in regmap_bulk_read calls
  iio:accel:mxc4005: Drop unnecessary explicit casts in regmap_bulk_read calls
  iio: imu: st_lsm6dsx: drop huge include in sensor-hub driver
  iio: buffer: drop devm_iio_kfifo_free() API call
  iio: buffer: drop devm_iio_hw_consumer_free() API call
  ...
2020-04-23 11:06:48 +02:00
Greg Kroah-Hartman c532cc617e First set of IIO fixes for the 5.7 cycle.
Includes one MAINTAINERS update to avoid people getting a lot of bounce
 messages and complaining about it.
 
 * MAINTAINERS
   - Drop Stefan Popa's Analog Devices email address in favour of
     Michael Hennerich.
 * core
   - Fix handling of dB sysfs inputs.
   - Drop a stray semi colon in macro definition.
 * ad5770r
   - Fix an off by one in chec on maximum number of channels.
 * ad7192
   - Fix a null pointer de-reference due to the name previously being
     retrieved from the spi_get_device_id call which no longer works as
     the relevant table was removed.
 * ad7797
   - Use correct attribute group.
 * counter/104-quad-8
   - Add locks to prevent some race conditions.
 * inv-mpu6050
   - Fix issues around suspend / resume clashing with runtime PM.
 * stm32-adc
   - Fix sleep in invalid context
   - Fix id relative path error in device tree binding doc.
 * st_lsm6dsx
   - Fix a read alignment issue on an untagged FIFO.
   - Handle odr for slave to properly compute the FIFO data layout / pattern.
   - Flush the HW FIFO before resettting the device to avoid a race on
     interrupt line 1.
 * st_sensors
   - Rely on ODR mask not ODR address to identify if the ODR can be set.
     Some devices have an ODR address of 0.
 * ti-ads8344
   - Byte ordering was wrong - fix it.
 * xilinx-xadc
   - Fix inverted logic in powering down the second ADC.
   - Fix clearing interrupt when enabling the trigger.
   - Fix configuration of sequencer when in simultaneous sampling mode.
   - Limit initial sampling rate as done for runtime configured ones.
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCAAvFiEEbilms4eEBlKRJoGxVIU0mcT0FogFAl6cgbkRHGppYzIzQGtl
 cm5lbC5vcmcACgkQVIU0mcT0Foj/qg//c1TF2fhXEuGNua2M9PzaO+UgEkymF5lD
 R9bQPOPLXesTxmIZDIPWuIYaoFOIBrB6Kc9DvE8+7apVc0I/JFYmuXSjY1LGoBj5
 6WSrbtfAHYD5HBY/ZQq92iw+feFlctWtpp7H6Ngy2c7lQy8OKMhrHOA1NgbC++HH
 5OA5uoMD7Fo0mvAGY7/74DiJFEKG/PUUrGWSbH792Mh0EmvXgyFkWyHEXCUrS6Qo
 gbaLk8mZsTac3iwYoLk7AdYyQpEdQD/tnCHpBzHHdTdDcQuKHbknP9t/zFuEkM/e
 hAH6H/cOr+IMOkMvYe1HDRQsOwkPQppz2GnxtWAUwCV8Shkn7khOExnV17zqUfJx
 NSzX60/iZWj53cAJkp4ZW4Uf6dqEEeCvV9jzWngXsCTRz96tpwJoLDilTEStSp1r
 0d17OpFSkrPoJQR6miK+wCeoA4CcLLfGJXG1BcDpsT0qgHq/TNx7P7AX55Ip//IL
 uu7qCDzFHAct8C50r1725pthsX/69PI34F8wHQ+bSt8eBlEMc/+iDavXO7MPvNNi
 Xd/Je0c+6pV15X9lCN7RqujDjBb2yMzX9f3Omq0txc4ughYGYb3QLwAfBidjW6Wy
 fI6AgBXOdqUOlFgq0ncDUVmS73AMfb2ilvstfY+cfhLrtGIzZNwin1znSIxcesaS
 tUGD9Xk/bPc=
 =SmJy
 -----END PGP SIGNATURE-----

Merge tag 'iio-fixes-for-5.7a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-linus

Jonathan writes:

First set of IIO fixes for the 5.7 cycle.

Includes one MAINTAINERS update to avoid people getting a lot of bounce
messages and complaining about it.

* MAINTAINERS
  - Drop Stefan Popa's Analog Devices email address in favour of
    Michael Hennerich.
* core
  - Fix handling of dB sysfs inputs.
  - Drop a stray semi colon in macro definition.
* ad5770r
  - Fix an off by one in chec on maximum number of channels.
* ad7192
  - Fix a null pointer de-reference due to the name previously being
    retrieved from the spi_get_device_id call which no longer works as
    the relevant table was removed.
* ad7797
  - Use correct attribute group.
* counter/104-quad-8
  - Add locks to prevent some race conditions.
* inv-mpu6050
  - Fix issues around suspend / resume clashing with runtime PM.
* stm32-adc
  - Fix sleep in invalid context
  - Fix id relative path error in device tree binding doc.
* st_lsm6dsx
  - Fix a read alignment issue on an untagged FIFO.
  - Handle odr for slave to properly compute the FIFO data layout / pattern.
  - Flush the HW FIFO before resettting the device to avoid a race on
    interrupt line 1.
* st_sensors
  - Rely on ODR mask not ODR address to identify if the ODR can be set.
    Some devices have an ODR address of 0.
* ti-ads8344
  - Byte ordering was wrong - fix it.
* xilinx-xadc
  - Fix inverted logic in powering down the second ADC.
  - Fix clearing interrupt when enabling the trigger.
  - Fix configuration of sequencer when in simultaneous sampling mode.
  - Limit initial sampling rate as done for runtime configured ones.

* tag 'iio-fixes-for-5.7a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio:
  MAINTAINERS: remove Stefan Popa's email
  iio: adc: ad7192: fix null pointer de-reference crash during probe
  iio: core: remove extra semi-colon from devm_iio_device_register() macro
  iio: adc: ti-ads8344: properly byte swap value
  iio: imu: inv_mpu6050: fix suspend/resume with runtime power
  iio: st_sensors: rely on odr mask to know if odr can be set
  iio: xilinx-xadc: Make sure not exceed maximum samplerate
  iio: xilinx-xadc: Fix sequencer configuration for aux channels in simultaneous mode
  iio: xilinx-xadc: Fix clearing interrupt when enabling trigger
  iio: xilinx-xadc: Fix ADC-B powerdown
  iio: dac: ad5770r: fix off-by-one check on maximum number of channels
  iio: imu: st_lsm6dsx: flush hw FIFO before resetting the device
  iio: core: Fix handling of 'dB'
  dt-bindings: iio: adc: stm32-adc: fix id relative path
  counter: 104-quad-8: Add lock guards - generic interface
  iio: imu: st_lsm6dsx: specify slave odr in slv_odr
  iio: imu: st_lsm6dsx: fix read misalignment on untagged FIFO
  iio: adc: stm32-adc: fix sleep in atomic context
  iio:ad7797: Use correct attribute_group
2020-04-20 14:07:00 +02:00
Lars Engebretsen a07479147b iio: core: remove extra semi-colon from devm_iio_device_register() macro
This change removes the semi-colon from the devm_iio_device_register()
macro which seems to have been added by accident.

Fixes: 63b19547cc ("iio: Use macro magic to avoid manual assign of driver_module")
Signed-off-by: Lars Engebretsen <lars@engebretsen.ch>
Cc: <Stable@vger.kernel.org>
Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-04-19 17:50:02 +01:00
Alexandru Ardelean 92b7ed7fe4 iio: core: drop devm_iio_trigger_free() API call
It's unused so far, so it can be removed. Also makes sense to remove it
to discourage weird uses of this call during review.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-04-19 16:56:37 +01:00
Alexandru Ardelean 66be392a48 iio: core: drop devm_iio_device_free() API call
It's unused so far, so it can be removed. Also makes sense to remove it
to discourage weird uses of this call during review.

This is the last user of 'devm_iio_device_match()', so it can be removed as
well in this patch.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-04-19 16:56:36 +01:00
Alexandru Ardelean 83af573e98 iio: core: drop devm_iio_device_unregister() API call
It's unused so far, so it can be removed. Also makes sense to remove it
to discourage weird uses of this call during review.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-04-19 16:56:35 +01:00
Linus Torvalds 413a103cf6 chrome platform changes for 5.7
* cros-usbpd-notify and cros_ec_typec
 - Add a new notification driver that handles and dispatches USB PD
  related events to other drivers.
 - Add a Type C connector class driver for cros_ec
 
 * CrOS EC
 - Introduce a new cros_ec_cmd_xfer_status helper
 
 * Sensors/iio:
 - A series from Gwendal that adds Cros EC sensor hub FIFO support
 
 * Wilco EC
 - Fix a build warning.
 - Platform data shouldn't include kernel.h
 
 * Misc
 - i2c api conversion complete, with i2c_new_client_device instead of
  i2c_new_device in chromeos_laptop.
 - Replace zero-length array with flexible-array member in cros_ec_chardev
  and wilco_ec
 - Update new structure for SPI transfer delays in cros_ec_spi
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYKAB0WIQQCtZK6p/AktxXfkOlzbaomhzOwwgUCXo1lfQAKCRBzbaomhzOw
 wo6TAQCKHOcrqq5Y9HYXs1QBx8e/0vVwe5Jh76Qi6hUVqXu56QEA65lBZ2ni8Udp
 f6jQDFkaeYaF2tkghvuNoAkFRI6/rAk=
 =j4Tt
 -----END PGP SIGNATURE-----

Merge tag 'tag-chrome-platform-for-v5.7' of git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux

Pull chrome platform updates from Benson Leung:

  cros-usbpd-notify and cros_ec_typec:
   - Add a new notification driver that handles and dispatches USB PD
     related events to other drivers.
   - Add a Type C connector class driver for cros_ec

  CrOS EC:
   - Introduce a new cros_ec_cmd_xfer_status helper

  Sensors/iio:
   - A series from Gwendal that adds Cros EC sensor hub FIFO support

  Wilco EC:
   - Fix a build warning.
   - Platform data shouldn't include kernel.h

  Misc:
   - i2c api conversion complete, with i2c_new_client_device instead of
     i2c_new_device in chromeos_laptop.
   - Replace zero-length array with flexible-array member in
     cros_ec_chardev and wilco_ec
   - Update new structure for SPI transfer delays in cros_ec_spi

* tag 'tag-chrome-platform-for-v5.7' of git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux: (34 commits)
  platform/chrome: cros_ec_spi: Wait for USECS, not NSECS
  iio: cros_ec: Use Hertz as unit for sampling frequency
  iio: cros_ec: Report hwfifo_watermark_max
  iio: cros_ec: Expose hwfifo_timeout
  iio: cros_ec: Remove pm function
  iio: cros_ec: Register to cros_ec_sensorhub when EC supports FIFO
  iio: expose iio_device_set_clock
  iio: cros_ec: Move function description to .c file
  platform/chrome: cros_ec_sensorhub: Add median filter
  platform/chrome: cros_ec_sensorhub: Add code to spread timestmap
  platform/chrome: cros_ec_sensorhub: Add FIFO support
  platform/chrome: cros_ec_sensorhub: Add the number of sensors in sensorhub
  platform/chrome: chromeos_laptop: make I2C API conversion complete
  platform/chrome: wilco_ec: event: Replace zero-length array with flexible-array member
  platform/chrome: cros_ec_chardev: Replace zero-length array with flexible-array member
  platform/chrome: cros_ec_typec: Update port info from EC
  platform/chrome: Add Type C connector class driver
  platform/chrome: cros_usbpd_notify: Pull PD_HOST_EVENT status
  platform/chrome: cros_usbpd_notify: Amend ACPI driver to plat
  platform/chrome: cros_usbpd_notify: Add driver data struct
  ...
2020-04-08 21:25:49 -07:00
Gwendal Grignou 69f0793eb6 iio: expose iio_device_set_clock
Some IIO devices may want to override the default (realtime) to another
clock source by default.

It can beneficial when timestamps coming from the hardware or underlying
drivers are already in that format.

It can always be overridden by attribute current_timestamp_clock.

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
2020-03-28 22:04:32 +01:00
Rohit Sarkar 143324fd89 iio: core: Make mlock internal to the iio core
"mlock" should ideally only be used by the iio core. The mlock
implementation may change in the future which means that no driver
should be explicitly using mlock.

Signed-off-by: Rohit Sarkar <rohitsarkar5398@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-03-21 11:01:31 +00:00