Add the necessary infrastructure to the IIO core to support a new
optional DMABUF based interface.
With this new interface, DMABUF objects (externally created) can be
attached to a IIO buffer, and subsequently used for data transfer.
A userspace application can then use this interface to share DMABUF
objects between several interfaces, allowing it to transfer data in a
zero-copy fashion, for instance between IIO and the USB stack.
The userspace application can also memory-map the DMABUF objects, and
access the sample data directly. The advantage of doing this vs. the
read() interface is that it avoids an extra copy of the data between the
kernel and userspace. This is particularly userful for high-speed
devices which produce several megabytes or even gigabytes of data per
second.
As part of the interface, 3 new IOCTLs have been added:
IIO_BUFFER_DMABUF_ATTACH_IOCTL(int fd):
Attach the DMABUF object identified by the given file descriptor to the
buffer.
IIO_BUFFER_DMABUF_DETACH_IOCTL(int fd):
Detach the DMABUF object identified by the given file descriptor from
the buffer. Note that closing the IIO buffer's file descriptor will
automatically detach all previously attached DMABUF objects.
IIO_BUFFER_DMABUF_ENQUEUE_IOCTL(struct iio_dmabuf *):
Request a data transfer to/from the given DMABUF object. Its file
descriptor, as well as the transfer size and flags are provided in the
"iio_dmabuf" structure.
These three IOCTLs have to be performed on the IIO buffer's file
descriptor, obtained using the IIO_BUFFER_GET_FD_IOCTL() ioctl.
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Co-developed-by: Nuno Sa <nuno.sa@analog.com>
Signed-off-by: Nuno Sa <nuno.sa@analog.com>
Link: https://patch.msgid.link/20240620122726.41232-4-paul@crapouillou.net
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This is a Framework to handle complex IIO aggregate devices.
The typical architecture is to have one device as the frontend device which
can be "linked" against one or multiple backend devices. All the IIO and
userspace interface is expected to be registers/managed by the frontend
device which will callback into the backends when needed (to get/set
some configuration that it does not directly control).
The basic framework interface is pretty simple:
- Backends should register themselves with @devm_iio_backend_register()
- Frontend devices should get backends with @devm_iio_backend_get()
Signed-off-by: Nuno Sa <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20240210-iio-backend-v11-5-f5242a5fb42a@analog.com
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Some light sensors can adjust both the HW-gain and integration time.
There are cases where adjusting the integration time has similar impact
to the scale of the reported values as gain setting has.
IIO users do typically expect to handle scale by a single writable 'scale'
entry. Driver should then adjust the gain/time accordingly.
It however is difficult for a driver to know whether it should change
gain or integration time to meet the requested scale. Usually it is
preferred to have longer integration time which usually improves
accuracy, but there may be use-cases where long measurement times can be
an issue. Thus it can be preferable to allow also changing the
integration time - but mitigate the scale impact by also changing the gain
underneath. Eg, if integration time change doubles the measured values,
the driver can reduce the HW-gain to half.
The theory of the computations of gain-time-scale is simple. However,
some people (undersigned) got that implemented wrong for more than once.
Add some gain-time-scale helpers in order to not dublicate errors in all
drivers needing these computations.
Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Link: https://lore.kernel.org/r/268d418e7cffcdaa2ece6738478bbc57692c213e.1680263956.git.mazziesaccount@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This capacitance to digital converter (CDC) driver is compliant with
the IIO ABI. Note, not all features supported (e.g. window event modes)
but the driver should be in a useful functional state.
The cleanup was done against QEMU emulation of the device rather than
actual hardware. Whilst this was a bit of an experiment, it made it
easy to confirm that the driver remained in a consistent working state
through the various refactors. If it worked in the first place, it
should still be working after this cleanup.
Given some IIO drivers require expensive hardware setups, (not particularly
true with this one) the use of QEMU may provide a viable way forward
for providing testing during code changes where previously we'd had
to rely on sharp eyes and crossed fingers.
Note, no explicit MAINTAINERS entry as it will be covered by the
generic catch-alls for ADI and IIO drivers which are sufficient.
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Link: https://lore.kernel.org/r/20210314181511.531414-25-jic23@kernel.org
The IIO core provides a function to do formatting of fixedpoint numbers.
In the past there have been some issues with the implementation of the
function where for example negative numbers were not handled correctly.
Introduce a basic unit test based on kunit that tests the function and
ensures that the generated output matches the expected output.
This gives us some confidence that future modifications to the function
implementation will not break ABI compatibility.
To run the unit tests follow the kunit documentation and add
CONFIG_IIO=y
CONFIG_IIO_TEST_FORMAT=y
to the .kunitconfig and run
> ./tools/testing/kunit/kunit.py run
Configuring KUnit Kernel ...
Building KUnit Kernel ...
Starting KUnit Kernel ...
============================================================
======== [PASSED] iio-format ========
[PASSED] iio_test_iio_format_value_integer
[PASSED] iio_test_iio_format_value_fixedpoint
[PASSED] iio_test_iio_format_value_fractional
[PASSED] iio_test_iio_format_value_fractional_log2
[PASSED] iio_test_iio_format_value_multiple
============================================================
Testing complete. 21 tests run. 0 failed. 0 crashed.
Elapsed time: 8.242s total, 0.001s configuring, 3.865s building, 0.000s running
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Link: https://lore.kernel.org/r/20201215191743.2725-3-lars@metafoo.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
For some embedded systems, a workflow involving external kernel modules
that implement IIO devices is more practical than working with in-tree
sources.
Kconfig symbols without any titles do not show up in menuconfig, and as
such are more difficult to configure granularly, as they need to be
selected by potentially unused/un-needed drivers.
Albeit, the IIO_TRIGGERED_EVENT is used by a single mainline driver, this
could allow for some out-of-tree drivers to use this kmod.
This change adds a title to the IIO_TRIGGERED_EVENT Kconfig symbol.
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Link: https://lore.kernel.org/r/20200924111758.196367-3-alexandru.ardelean@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This patch adds support for the Azoteq IQS624 and IQS625 angular position
sensors, capable of reporting the angle of a rotating shaft down to 1 and
10 degrees of accuracy, respectively.
This patch also introduces a home for linear and angular position sensors.
Unlike resolvers, they are typically contactless and use the Hall effect.
Signed-off-by: Jeff LaBundy <jeff@labundy.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
A few bits for the counters subsystem mixed in here as well.
There are some late breaking fixes as well, which aren't so urgent
they can't wait for the merge window.
New Device Support
* adf4371
- New driver + bindings.
- Support the adf4372 PLL. Mostly ID and bindings.
* ad8366 (note includes rework of driver needed to allow support for these).
- Support the ADL5240 variable gain amplifier (VGA).
- Support the ADA4961 digital gain amplifier (DGA).
* dps310
- New driver, in several parts from different authors for this temp
and pressure sensor.
- Includes errata workaround for a temperature reading issue.
* stk3310
- Support the stk3335, mostly ID.
Features and cleanups
* core
- drop error handling on debugfs registration.
- harden by making sure we don't overrun iio_chan_info_postfix.
* docs
- convert remaining docs to rst. At somepoint we'll fit these few
into the main IIO docs.
- improve sampling_frequency_available docs but explaining the
range form.
* ad_sigma_delta
- Drop a pointless goto.
* ad2s1210
- Drop pointless platform data null check seeing as we don't actually
use platform data anymore.
* ad7124
- Relax limitation on channel numbers to allow pseudo different channels.
- Support control of whether the input is buffered via DT.
- Use dynamic allocation for channel configuration to make it easier
to support new devices.
- YAML binding conversion.
* ad7150
- Comment tidy up.
- Consistent and simple if (ret) handling of i2c errors.
- FIELD_GET and GENMASK.
- Ternary rather than !!(condition) for readability.
- Use macros to avoid repetition of channel definitions.
* ad7606
- Add software channel config (rather that pin controlled)
- Refactor to simplify addition of new part in future.
* ad7746
- of_deivce_id table.
* ad7780
- MAINTAINERS entry
- YAML DT bindings.
* ad8366
- Stop using core mlock in favour of well scoped local lock.
- SPDX + copyright date update.
* ad9834
- of_device_id table
* adf4371
- Add support for output stage muting before lock on has occured.
* adis library
- MAINTAINERS entry to reflect that this now Alexandru's problem ;)
* adis162xx:
- Fix a slightly incorrect set of comments and print statements on
minimum supported voltage.
* adis16203
- of_device_id table.
* adis16240
- Add of_device_id table (in two parts as first patch only used it for
MODULE_DEVICE_TABLE.)
* adt7316-spi
- of_device_id table
* adxl372
- YAML DT binding conversion.
- Cleanup use of buffer callback functions (precursor to core rework).
* bh1710
- Simplify getting the i2c adapter from the client.
* dht11
- Mote to newer GPIO consumer interface.
* kxcjk-1013.c
- Add binding for sensor in display of some ultrabooks after userspace
tools updated for it not be a problem to report two similar sensors.
* imx7d
- drop unused variables.
- white space
- define instead of variable for clock frequency that is fixed.
- drop pointless error message.
* messon_saradc
- SPDX
* sps30
- MAINTAINERS entry
- YAML binding conversion.
* st_accel
- Tidy up ordering in various buffer related callbacks. This is
part of a long running effort to simplify the core code.
* stm32-dfsdm:
- Manage the resolution cleanly in triggerd modes.
- Add fast mode support which allows more flexible filter choices.
- Add a comment on the reason for a 16 bit record when technically
not 'required'.
* st_lsm6dsx
- Embed device name in the sensor_settings struct as i3c doesn't
have a convenient name field to use for this.
* xilinx-adc
- Relax constraints on supported platforms to reflect that this
can used with FPGAs on PCIe cards and hence many architectures.
* counters/ftm-quaddec
- Fix some formatting io MODULE_AUTHOR
- MAINTAINERS entry
Fixes
* tools
- fix incorrect handling of 32 bit channels.
* sca3000
- Potential endian bug that is unlikely to bite anyone (be64 host
seems unlikely for this old part).
* stm32-adc
- Add vdda-supply. On some boards it needs to be turned on to supply
the ADC. DT bindings included.
* stm32-dfsdm
- Fix output resolution to work with filter orders other than 3.
- Fix output datatype as it's signed and previously claimed not to be.
-----BEGIN PGP SIGNATURE-----
iQJFBAABCAAvFiEEbilms4eEBlKRJoGxVIU0mcT0FogFAl0VHIkRHGppYzIzQGtl
cm5lbC5vcmcACgkQVIU0mcT0FojyxhAAgrLRy2wlHjQCAh0S6J22LKs02uPX1qvY
nm1aI/av2DGcMCV2NF6J1sW2Mocvtt5a79/1f/wRqDzOHBrTpFr0Q0Ngwijv9bzc
fv6NwfHlWolmXynKx8wK4b6Sa3KVCkltojEVpEVbhkuMkafSQ+pQzYF1Uf7enOrX
j3Gq6NYaCks4YtFZsBphgzo3DC0mh7CfunlPiOdVcgcg4Pj/KZY9QCX86fJx972x
YI3BRFHnDSMDOxOTjeqeKvMiqU2zLPlqLSEOCUw2XCrh6HI9qFiU+LVsYx6SP0tx
aJ2q+qYc9raOTANHk7O2JZYWv/52JXvtKcFSLiuQdABjaAI20xEr1QAZYVYUiXmg
dFH6lBsWvQyAy5F/SyZ5tavZvTfGsNDB5LhlpEggeO2W6cIIL4CLfHimB2EcxFSH
utqEA72HQZosEUKut1jbmG6iYMiRnHS72pLOqkJ6HC/2/pZfoEWlEH9x/S3xbBsW
918ISs9852VwjebQwck96+Dh0LwiKOl8Aii5ONzfNObJB6/JbULPoKKArsMdENQA
mqDXLOMz6GspY3JgiVDCXAwg2x2Ht/ictR6svRJtOTLiBU2Iybpm/HRkPePhoePF
HLw8fhwE+mOSWr22KhzjUJBHEAkoejo/14XOgKSTkO9V6amLlOWRDV3uK2PksmdI
7DQyYhX9Tos=
=a3vh
-----END PGP SIGNATURE-----
Merge tag 'iio-for-5.3b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next
Jonathan writes:
Second set of IIO device support, features, cleanups and minor fixes for 5.3.
A few bits for the counters subsystem mixed in here as well.
There are some late breaking fixes as well, which aren't so urgent
they can't wait for the merge window.
New Device Support
* adf4371
- New driver + bindings.
- Support the adf4372 PLL. Mostly ID and bindings.
* ad8366 (note includes rework of driver needed to allow support for these).
- Support the ADL5240 variable gain amplifier (VGA).
- Support the ADA4961 digital gain amplifier (DGA).
* dps310
- New driver, in several parts from different authors for this temp
and pressure sensor.
- Includes errata workaround for a temperature reading issue.
* stk3310
- Support the stk3335, mostly ID.
Features and cleanups
* core
- drop error handling on debugfs registration.
- harden by making sure we don't overrun iio_chan_info_postfix.
* docs
- convert remaining docs to rst. At somepoint we'll fit these few
into the main IIO docs.
- improve sampling_frequency_available docs but explaining the
range form.
* ad_sigma_delta
- Drop a pointless goto.
* ad2s1210
- Drop pointless platform data null check seeing as we don't actually
use platform data anymore.
* ad7124
- Relax limitation on channel numbers to allow pseudo different channels.
- Support control of whether the input is buffered via DT.
- Use dynamic allocation for channel configuration to make it easier
to support new devices.
- YAML binding conversion.
* ad7150
- Comment tidy up.
- Consistent and simple if (ret) handling of i2c errors.
- FIELD_GET and GENMASK.
- Ternary rather than !!(condition) for readability.
- Use macros to avoid repetition of channel definitions.
* ad7606
- Add software channel config (rather that pin controlled)
- Refactor to simplify addition of new part in future.
* ad7746
- of_deivce_id table.
* ad7780
- MAINTAINERS entry
- YAML DT bindings.
* ad8366
- Stop using core mlock in favour of well scoped local lock.
- SPDX + copyright date update.
* ad9834
- of_device_id table
* adf4371
- Add support for output stage muting before lock on has occured.
* adis library
- MAINTAINERS entry to reflect that this now Alexandru's problem ;)
* adis162xx:
- Fix a slightly incorrect set of comments and print statements on
minimum supported voltage.
* adis16203
- of_device_id table.
* adis16240
- Add of_device_id table (in two parts as first patch only used it for
MODULE_DEVICE_TABLE.)
* adt7316-spi
- of_device_id table
* adxl372
- YAML DT binding conversion.
- Cleanup use of buffer callback functions (precursor to core rework).
* bh1710
- Simplify getting the i2c adapter from the client.
* dht11
- Mote to newer GPIO consumer interface.
* kxcjk-1013.c
- Add binding for sensor in display of some ultrabooks after userspace
tools updated for it not be a problem to report two similar sensors.
* imx7d
- drop unused variables.
- white space
- define instead of variable for clock frequency that is fixed.
- drop pointless error message.
* messon_saradc
- SPDX
* sps30
- MAINTAINERS entry
- YAML binding conversion.
* st_accel
- Tidy up ordering in various buffer related callbacks. This is
part of a long running effort to simplify the core code.
* stm32-dfsdm:
- Manage the resolution cleanly in triggerd modes.
- Add fast mode support which allows more flexible filter choices.
- Add a comment on the reason for a 16 bit record when technically
not 'required'.
* st_lsm6dsx
- Embed device name in the sensor_settings struct as i3c doesn't
have a convenient name field to use for this.
* xilinx-adc
- Relax constraints on supported platforms to reflect that this
can used with FPGAs on PCIe cards and hence many architectures.
* counters/ftm-quaddec
- Fix some formatting io MODULE_AUTHOR
- MAINTAINERS entry
Fixes
* tools
- fix incorrect handling of 32 bit channels.
* sca3000
- Potential endian bug that is unlikely to bite anyone (be64 host
seems unlikely for this old part).
* stm32-adc
- Add vdda-supply. On some boards it needs to be turned on to supply
the ADC. DT bindings included.
* stm32-dfsdm
- Fix output resolution to work with filter orders other than 3.
- Fix output datatype as it's signed and previously claimed not to be.
* tag 'iio-for-5.3b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (68 commits)
iio: iio-utils: Fix possible incorrect mask calculation
iio: frequency: adf4371: Add support for output stage mute
dt-bindings: iio: frequency: Add ADF4372 PLL documentation
iio: frequency: adf4371: Add support for ADF4372 PLL
dt-bindings: iio: adc: Add buffered input property
Convert AD7124 bindings documentation to YAML format.
iio: adc: ad7124: Shift to dynamic allocation for channel configuration
iio: adc: ad7124: Add buffered input support
iio: adc: ad7124: Remove input number limitation
MAINTAINERS: add ADIS IMU driver library entry
iio: adis162xx: fix low-power docs & reports
counter/ftm-quaddec: Add missing '>' in MODULE_AUTHOR
iio: core: no need to check return value of debugfs_create functions
docs: iio: convert to ReST
iio: adc: stm32-adc: add missing vdda-supply
dt-bindings: iio: adc: stm32: add missing vdda supply
iio: adc: stm32-dfsdm: add comment for 16 bits record
iio: adc: stm32-dfsdm: add fast mode support
iio: adc: stm32-dfsdm: manage data resolution in trigger mode
iio: adc: stm32-dfsdm: fix data type
...
Rename the iio documentation files to ReST, add an
index for them and adjust in order to produce a nice html
output via the Sphinx build system.
At its new index.rst, let's add a :orphan: while this is not linked to
the main index.rst file, in order to avoid build warnings.
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Add SPDX license identifiers to all Make/Kconfig files which:
- Have no license information of any form
These files fall under the project license, GPL v2 only. The resulting SPDX
license identifier is:
GPL-2.0-only
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Here is the big staging and iio driver update for 5.2-rc1.
Lots of tiny fixes all over the staging and IIO driver trees here, along
with some new IIO drivers.
Also we ended up deleting two drivers, making this pull request remove a
few hundred thousand lines of code, always a nice thing to see. Both of
the drivers removed have been replaced with "real" drivers in their
various subsystem directories, and they will be coming to you from those
locations during this merge window.
There are some core vt/selection changes in here, that was due to some
cleanups needed for the speakup fixes. Those have all been acked by the
various subsystem maintainers (i.e. me), so those are ok.
We also added a few new drivers, for some odd hardware, giving new
developers plenty to work on with basic coding style cleanups to come in
the near future.
Other than that, nothing unusual here.
All of these have been in linux-next for a while with no reported
issues, other than an odd gcc warning for one of the new drivers that
should be fixed up soon.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-----BEGIN PGP SIGNATURE-----
iG0EABECAC0WIQT0tgzFv3jCIUoxPcsxR9QN2y37KQUCXNHGMQ8cZ3JlZ0Brcm9h
aC5jb20ACgkQMUfUDdst+ynQRACgwtlC6DFsEFwCplYxQXP5uzuIVTMAoJ61xzC0
Qim7K31f5ulaa3GJuhzo
=zEY5
-----END PGP SIGNATURE-----
Merge tag 'staging-5.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
Pull staging / IIO driver updates from Greg KH:
"Here is the big staging and iio driver update for 5.2-rc1.
Lots of tiny fixes all over the staging and IIO driver trees here,
along with some new IIO drivers.
The "counter" subsystem was added in here as well, as it is needed by
the IIO drivers and subsystem.
Also we ended up deleting two drivers, making this pull request remove
a few hundred thousand lines of code, always a nice thing to see. Both
of the drivers removed have been replaced with "real" drivers in their
various subsystem directories, and they will be coming to you from
those locations during this merge window.
There are some core vt/selection changes in here, that was due to some
cleanups needed for the speakup fixes. Those have all been acked by
the various subsystem maintainers (i.e. me), so those are ok.
We also added a few new drivers, for some odd hardware, giving new
developers plenty to work on with basic coding style cleanups to come
in the near future.
Other than that, nothing unusual here.
All of these have been in linux-next for a while with no reported
issues, other than an odd gcc warning for one of the new drivers that
should be fixed up soon"
[ I fixed up the warning myself - Linus ]
* tag 'staging-5.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (663 commits)
staging: kpc2000: kpc_spi: Fix build error for {read,write}q
Staging: rtl8192e: Remove extra space before break statement
Staging: rtl8192u: ieee80211: Fix if-else indentation warning
Staging: rtl8192u: ieee80211: Fix indentation errors by removing extra spaces
staging: most: cdev: fix chrdev_region leak in mod_exit
staging: wlan-ng: Fix improper SPDX comment style
staging: rtl8192u: ieee80211: Resolve ERROR reported by checkpatch
staging: vc04_services: bcm2835-camera: Compress two lines into one line
staging: rtl8723bs: core: Use !x in place of NULL comparison.
staging: rtl8723bs: core: Prefer using the BIT Macro.
staging: fieldbus: anybus-s: fix wait_for_completion_timeout return handling
staging: kpc2000: fix up build problems with readq()
staging: rtlwifi: move remaining phydm .h files
staging: rtlwifi: strip down phydm .h files
staging: rtlwifi: delete the staging driver
staging: fieldbus: anybus-s: rename bus id field to avoid confusion
staging: fieldbus: anybus-s: keep device bus id in bus endianness
Staging: sm750fb: Change *array into *const array
staging: rtl8192u: ieee80211: Fix spelling mistake
staging: rtl8192u: ieee80211: Replace bit shifting with BIT macro
...
Add support for new counter device to stm32-lptimer.
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Make the anon_inodes facility unconditional so that it can be used by core
VFS code and pidfd code.
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
[christian@brauner.io: adapt commit message to mention pidfds]
Signed-off-by: Christian Brauner <christian@brauner.io>
Formatting of Kconfig files doesn't look so pretty, so just
take damp cloth and clean it up.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Move the iio driver for the ad2s1200 and ad2s1205 resolver-to-digital
converter out of staging, into mainline iio subsystems.
Signed-off-by: David Veenstra <davidjulianveenstra@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
If an ADC channel measures the midpoint of a voltage divider, the
interesting voltage is often the voltage over the full resistance.
E.g. if the full voltage is too big for the ADC to handle.
Likewise, if an ADC channel measures the voltage across a shunt
resistor, with or without amplification, the interesting value is
often the current through the resistor.
This driver solves these problems by allowing to linearly scale a channel
and/or by allowing changes to the type of the channel.
Signed-off-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
When a multiplexer changes how an iio device behaves (for example
by feeding different signals to an ADC), this driver can be used
to create one virtual iio channel for each multiplexer state.
Depends on the generic multiplexer subsystem.
Cache any ext_info values from the parent iio channel, creating a private
copy of the ext_info attributes for each multiplexer state/channel.
Reviewed-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The ACCES 104-QUAD-8 is a general purpose quadrature encoder
counter/interface board. The 104-QUAD-8 is capable of monitoring the
outputs of eight encoders via four on-board LSI/CSI LS7266R1 24-bit
dual-axis quadrature counter chips. Core functions handled by the
LS7266R1, such as direction and total count, are available.
Performing a write to a counter's IIO_CHAN_INFO_RAW sets the counter and
also clears the counter's respective error flag. Although the counters
have a 25-bit range, only the lower 24 bits may be set, either directly
or via a counter's preset attribute. Interrupts are not supported by
this driver.
This driver adds IIO support for the ACCES 104-QUAD-8 and ACCES
104-QUAD-4. The base port addresses for the devices may be configured
via the base array module parameter.
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Add support for the LMP91000 potentiostat which is used for chemical
sensing applications.
Signed-off-by: Matt Ranostay <matt@ranostay.consulting>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This is similar with support for creating triggers via configfs.
Devices will be hosted under:
* /config/iio/devices
We allow users to register "device types" under:
* /config/iio/devices/<device_types>/
Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
MAX30100 is an heart rate and pulse oximeter sensor that works using
two LEDS of different wavelengths, and detecting the light reflected
back.
This patchset adds support for both IR and RED LED channels which can
be processed in userspace to determine heart rate and blood oxygen
levels.
Signed-off-by: Matt Ranostay <mranostay@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
A software trigger associates an IIO device trigger with a software
interrupt source (e.g: timer, sysfs). This patch adds the generic
infrastructure for handling software triggers.
Software interrupts sources are kept in a iio_trigger_types_list and
registered separately when the associated kernel module is loaded.
Software triggers can be created directly from drivers or from user
space via configfs interface.
To sum up, this dynamically creates "triggers" group to be found under
/config/iio/triggers and offers the possibility of dynamically
creating trigger types groups. The first supported trigger type is
"hrtimer" found under /config/iio/triggers/hrtimer.
Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This patch creates the IIO configfs root group. The group
will appear under <mount-point>/iio/, usually /config/iio.
We introduce configfs support in IIO in order to be able to easily
create IIO objects from userspace. The first supported IIO objects
are triggers introduced with next patches.
Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Tested-by: Matt Ranostay <matt.ranostay@intel>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This patch moves the reference IIO dummy driver from drivers/staging/iio
into a separate folder, drivers/iio/dummy and adds the proper Kconfig
and Makefile for it.
A new config menu entry called IIO dummy driver has also been added
in the Industrial I/O support menu, corresponding to this driver.
Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Add support for VZ89X sensors VOC and CO2 reporting channels in
percentage which can be converted to part per million.
Signed-off-by: Matt Ranostay <mranostay@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Support triggered events.
This is useful for chips that don't have their own interrupt sources.
It allows to use generic/standalone iio triggers for those drivers.
Signed-off-by: Vladimir Barinov <vladimir.barinov@cogentembedded.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
For generic IIO trigger implementations we already have a sub-directory,
but the generic buffer implementations currently reside in the IIO
top-level directory. The main reason is that things have historically grown
into this form.
With more generic buffer implementations on its way now is the perfect time
to clean this up and introduce a sub-directory for generic buffer
implementations to avoid too much clutter in the top-level directory.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Currently the IIO callback buffer implementation is directly built into the
IIO core module when enabled. Given that the callback buffer module is
standalone functionallity there is really no reason to do this. So move it
to its own module.
Also rename the source to follow the standard IIO module naming convention
as well as add a license notice to the file.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Pull kconfig updates from Michal Marek:
"Yann E Morin was supposed to take over kconfig maintainership, but
this hasn't happened. So I'm sending a few kconfig patches that I
collected:
- Fix for missing va_end in kconfig
- merge_config.sh displays used if given too few arguments
- s/boolean/bool/ in Kconfig files for consistency, with the plan to
only support bool in the future"
* 'kconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild:
kconfig: use va_end to match corresponding va_start
merge_config.sh: Display usage if given too few arguments
kconfig: use bool instead of boolean for type definition attributes
iio kfifo can be used without trigger support so there is no need to build it.
Signed-off-by: Karol Wrona <k.wrona@samsung.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Support for keyword 'boolean' will be dropped later on.
No functional change.
Reference: http://lkml.kernel.org/r/cover.1418003065.git.cj@linux.com
Signed-off-by: Christoph Jaeger <cj@linux.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Without ANON_INODES, we get this build error:
drivers/built-in.o: In function `iio_event_getfd':
:(.text+0x14bf18): undefined reference to `anon_inode_getfd'
All other users explicitly select this symbol, so we should
do the same thing here.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Jonathan Cameron <jic23@kernel.org>
Cc: linux-iio@vger.kernel.org
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
AS3935 chipset can detect lightning strikes and reports those back as
events and the estimated distance to the storm.
Signed-off-by: Matt Ranostay <mranostay@gmail.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Added usage id processing for Inclinometer 3D. This uses IIO
interfaces for triggered buffer to present data to user
mode.This uses HID sensor framework for registering callback
events from the sensor hub.
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
After the last architecture switched to generic hard irqs the config
options HAVE_GENERIC_HARDIRQS & GENERIC_HARDIRQS and the related code
for !CONFIG_GENERIC_HARDIRQS can be removed.
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
the TI TMP006 is a non-contact temperature sensor with I2C interface;
it measures the surface temperature of a distance object using a
thermopile to absorb IR energy emitted from the object
the sensor has two channels: IR sensor voltage (16-bit) and reference
temperature of the chip (14-bit); datasheet is here:
http://www.ti.com/lit/ds/symlink/tmp006.pdf
v2 (thanks to Grygorii Strashko, Lars-Peter Clausen, Jonathan Cameron
for review comments):
* power down device on driver remove
* use sign_extend32()
* style cleanup
* add comments what channel raw LSBs mean
* spelling of thermopile
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Cc: Grygorii Strashko <grygorii.strashko@ti.com>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Cc: Jonathan Cameron <jic23@kernel.org>
Cc: LM Sensors <lm-sensors@lm-sensors.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This reverts commit 98a5e9e99d.
IIO, like the rest of the kernel, should rely on dynamic debugging, not
have a special config option for it. That way, no user has to rebuild
their kernel to have debug messages, which is a good thing, let's not
revert back to the bad old days of the 2000's.
Cc: Otavio Salvador <otavio@ossystems.com.br>
Cc: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ring buffers are only in staging, don't mention them here
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This patch adds a generic pressure driver for STMicroelectronics
pressure sensors, currently it supports: LPS331AP.
Signed-off-by: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This simple driver is rather useful. No issues about its interface
have been raised for some time hence the proposal to move it out
of staging.
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Now that the adis library no longer depends on the sw_ring buffer implementation
we can move it out of staging.
While we are at it also sort the entries in the iio Kconfig and Makefile to be
in alphabetical order.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This callback buffer is meant to be opaque to users, but basically
adds a very simple pass through buffer to which data may be
pushed when it is inserted into the buffer list.
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Added usage id processing for ALS. This uses IIO
interfaces for triggered buffer to present data to user
mode.This uses HID sensor framework for registering callback
events from the sensor hub.
Signed-off-by: srinivas pandruvada <srinivas.pandruvada@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>