[PATCH v6 22/24] tools: iio: make iioutils_get_type() private in iio_utils

2021-02-15 Thread Alexandru Ardelean
' in the iioutils_get_type() function definition. Signed-off-by: Alexandru Ardelean --- tools/iio/iio_utils.c | 9 + tools/iio/iio_utils.h | 4 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/tools/iio/iio_utils.c b/tools/iio/iio_utils.c index 7399eb7f1378..a96002f2c2d5 100644 --- a/tools/iio

[PATCH v6 20/24] iio: buffer: add ioctl() to support opening extra buffers for IIO device

2021-02-15 Thread Alexandru Ardelean
o:device0 has some fake kfifo buffers attached to an IIO device. Signed-off-by: Alexandru Ardelean --- drivers/iio/iio_core.h| 12 +-- drivers/iio/industrialio-buffer.c | 144 -- include/linux/iio/buffer_impl.h | 5 ++ include/linux/iio/iio-opaque.h

[PATCH v6 19/24] iio: buffer: introduce support for attaching more IIO buffers

2021-02-15 Thread Alexandru Ardelean
, no driver should call iio_device_attach_buffer() directly, it should call one of the {devm_}iio_triggered_buffer_setup() or devm_iio_kfifo_buffer_setup() or devm_iio_dmaengine_buffer_setup() functions. This makes iio_device_attach_buffer() a bit easier to handle. Signed-off-by: Alexandru Ardelean

[PATCH v6 18/24] iio: dummy: iio_simple_dummy_buffer: use triggered buffer core calls

2021-02-15 Thread Alexandru Ardelean
in this driver as well. One minor drawback is that the pollfunc name may not be 100% identical with the one in the original code, but since it's an example, it should be a big problem. This change does a minor re-arranging of the included iio headers, as a minor tidy-up. Signed-off-by: Alexandru Ardelean

[PATCH v6 17/24] iio: buffer: move __iio_buffer_free_sysfs_and_mask() before alloc

2021-02-15 Thread Alexandru Ardelean
in this patch to make the patch that adds multiple buffers per IIO device a bit cleaner. Signed-off-by: Alexandru Ardelean --- drivers/iio/industrialio-buffer.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio

[PATCH v6 16/24] iio: core: wrap iio device & buffer into struct for character devices

2021-02-15 Thread Alexandru Ardelean
need to pass another buffer object than 'indio_dev->buffer'. Since we'll also open some chardevs via anon inodes, we can pass extra buffers in that function by assigning another object to the iio_dev_buffer_pair object. Signed-off-by: Alexandru Ardelean --- drivers/iio/iio_core.h

[PATCH v6 13/24] iio: add reference to iio buffer on iio_dev_attr

2021-02-15 Thread Alexandru Ardelean
by 1. This looks like it could do with a bit of a re-think. Signed-off-by: Alexandru Ardelean --- drivers/iio/iio_core.h| 2 ++ drivers/iio/industrialio-buffer.c | 4 drivers/iio/industrialio-core.c | 6 ++ drivers/iio/industrialio-event.c | 1 + include/linux/iio/sysfs.h

[PATCH v6 14/24] iio: buffer: wrap all buffer attributes into iio_dev_attr

2021-02-15 Thread Alexandru Ardelean
erging (or finalizing the merge) of the buffer/ & scan_elements/ attributes internally. Accessing these new buffer attributes can now be done via 'to_iio_dev_attr(attr)->buffer' inside the show/store handlers. Signed-off-by: Alexandru Ardelean --- drivers/iio/industrialio-

[PATCH v6 15/24] iio: buffer: dmaengine: obtain buffer object from attribute

2021-02-15 Thread Alexandru Ardelean
The reference to the IIO buffer object is stored on the attribute object. So we need to unwind it to obtain it. Signed-off-by: Alexandru Ardelean --- drivers/iio/buffer/industrialio-buffer-dmaengine.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iio/buffer

[PATCH v6 12/24] iio: core: merge buffer/ & scan_elements/ attributes

2021-02-15 Thread Alexandru Ardelean
IIO device object. This way the IIO buffer can have just a single attribute_group object, saving a bit of memory when adding multiple IIO buffers. Signed-off-by: Alexandru Ardelean --- drivers/iio/industrialio-buffer.c | 115 +++--- include/linux/iio/buffer_impl.h |

[PATCH v6 11/24] iio: buffer: group attr count and attr alloc

2021-02-15 Thread Alexandru Ardelean
(for buffer/ and scan_elements/), and also a /sys/bus/iio/iio:devicesX/buffer0 attribute group. For buffer1 and above, just a single attribute group will be allocated (the merged one). Signed-off-by: Alexandru Ardelean --- drivers/iio/industrialio-buffer.c | 71 --- 1 file

[PATCH v6 10/24] iio: core: rework iio device group creation

2021-02-15 Thread Alexandru Ardelean
nnoy a few people since that would make the system less configurable. Signed-off-by: Alexandru Ardelean --- drivers/iio/iio_core.h | 3 +++ drivers/iio/industrialio-buffer.c | 12 ++-- drivers/iio/industrialio-core.c| 30 +++--- drivers/iio/industri

[PATCH v6 09/24] iio: core-trigger: make iio_device_register_trigger_consumer() an int return

2021-02-15 Thread Alexandru Ardelean
Oddly enough the noop function is an int-return. This one seems to be void. This change converts it to int, because we want to change how groups are registered. With that change this function could error out with -ENOMEM. Signed-off-by: Alexandru Ardelean --- drivers/iio/iio_core_trigger.h

[PATCH v6 08/24] iio: core: register chardev only if needed

2021-02-15 Thread Alexandru Ardelean
ing this is required, it should be easy enough to do it. Signed-off-by: Alexandru Ardelean --- drivers/iio/industrialio-core.c | 23 ++- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c in

[PATCH v6 07/24] docs: ioctl-number.rst: reserve IIO subsystem ioctl() space

2021-02-15 Thread Alexandru Ardelean
is reserved for IIO ioctl() calls. Signed-off-by: Alexandru Ardelean --- Documentation/userspace-api/ioctl/ioctl-number.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/userspace-api/ioctl/ioctl-number.rst b/Documentation/userspace-api/ioctl/ioctl-number.rst index

[PATCH v6 05/24] iio: kfifo: un-export devm_iio_kfifo_allocate() function

2021-02-15 Thread Alexandru Ardelean
devm_iio_kfifo_buffer_setup() or devm_iio_triggered_buffer_setup() to create a kfifo buffer. Signed-off-by: Alexandru Ardelean --- Documentation/driver-api/driver-model/devres.rst | 1 - drivers/iio/buffer/kfifo_buf.c | 3 +-- include/linux/iio/kfifo_buf.h| 2 -- 3 files

[PATCH v6 06/24] iio: buffer-dma,adi-axi-adc: introduce devm_iio_dmaengine_buffer_setup()

2021-02-15 Thread Alexandru Ardelean
). Since the only user of the devm_iio_dmaengine_buffer_alloc() was the adi-axi-adc driver, this change does the replacement in a single go in the driver. Signed-off-by: Alexandru Ardelean --- .../driver-api/driver-model/devres.rst| 1 + drivers/iio/adc/adi-axi-adc.c | 12

[PATCH v6 03/24] iio: make use of devm_iio_kfifo_buffer_setup() helper

2021-02-15 Thread Alexandru Ardelean
. Signed-off-by: Alexandru Ardelean --- drivers/iio/accel/ssp_accel_sensor.c | 14 --- drivers/iio/adc/ina2xx-adc.c | 14 +-- drivers/iio/adc/ti_am335x_adc.c | 18 --- .../cros_ec_sensors/cros_ec_sensors_core.c| 13 --- dri

[PATCH v6 04/24] iio: accel: sca3000: use devm_iio_kfifo_buffer_setup() helper

2021-02-15 Thread Alexandru Ardelean
this change) it shouldn't be a problem. Signed-off-by: Alexandru Ardelean --- drivers/iio/accel/sca3000.c | 19 +++ 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/drivers/iio/accel/sca3000.c b/drivers/iio/accel/sca3000.c index 194738660523..467b5fcb81db 100644 --- a/drivers

[PATCH v6 02/24] iio: kfifo: add devm_iio_kfifo_buffer_setup() helper

2021-02-15 Thread Alexandru Ardelean
. So, this should have a more familiar ring to what it is. Signed-off-by: Alexandru Ardelean --- .../driver-api/driver-model/devres.rst| 1 + drivers/iio/buffer/kfifo_buf.c| 39 +++ include/linux/iio/kfifo_buf.h | 7 3 files changed

[PATCH v6 00/24] iio: core,buffer: add support for multiple IIO buffers per IIO device

2021-02-15 Thread Alexandru Ardelean
IOCTL call returns 0 for buffer0; this is because I can't find a way to determine the FD of the ioctl() in the kernel; duplicating an ioctl() for buffer0 is also bad; Alexandru Ardelean (24): iio: adc: ti_am335x_adc: remove omitted iio_kfifo_free() iio: kfifo: add devm_iio_kfifo_buffer_

[PATCH v6 01/24] iio: adc: ti_am335x_adc: remove omitted iio_kfifo_free()

2021-02-15 Thread Alexandru Ardelean
When the conversion was done to use devm_iio_kfifo_allocate(), a call to iio_kfifo_free() was omitted (to be removed). This change removes it. Fixes: 3c5308058899 ("iio: adc: ti_am335x_adc: alloc kfifo & IRQ via devm_ functions") Signed-off-by: Alexandru Ardelean --- d

Re: [PATCH v5 13/17] iio: buffer: add ioctl() to support opening extra buffers for IIO device

2021-02-15 Thread Alexandru Ardelean
On Sun, Feb 14, 2021 at 4:38 PM Jonathan Cameron wrote: > > On Thu, 11 Feb 2021 14:24:48 +0200 > Alexandru Ardelean wrote: > > > With this change, an ioctl() call is added to open a character device for a > > buffer. The ioctl() number is 'i' 0x91, which follows the &g

Re: [PATCH 0/5] iio: kfifo: define a devm_iio_kfifo_buffer_setup helper

2021-02-14 Thread Alexandru Ardelean
On Sun, Feb 14, 2021 at 5:06 PM Jonathan Cameron wrote: > > On Sun, 14 Feb 2021 16:33:08 +0200 > Alexandru Ardelean wrote: > > > This is a re-spin of an older set [1]: > > > > https://patchwork.kernel.org/project/linux-iio/patch/20200401125936.6398-1

Re: [PATCH 0/5] iio: kfifo: define a devm_iio_kfifo_buffer_setup helper

2021-02-14 Thread Alexandru Ardelean
On Sun, Feb 14, 2021 at 5:06 PM Jonathan Cameron wrote: > > On Sun, 14 Feb 2021 16:33:08 +0200 > Alexandru Ardelean wrote: > > > This is a re-spin of an older set [1]: > > > > https://patchwork.kernel.org/project/linux-iio/patch/20200401125936.6398-1

[PATCH] iio: buffer-dma,adi-axi-adc: introduce devm_iio_dmaengine_buffer_setup()

2021-02-14 Thread Alexandru Ardelean
). Since the only user of the devm_iio_dmaengine_buffer_alloc() was the adi-axi-adc driver, this change does the replacement in a single go in the driver. Signed-off-by: Alexandru Ardelean --- Related to https://lore.kernel.org/linux-iio/20210214143313.67202-2-alexandru.ardel...@analog.com/T

Re: [PATCH v5 12/17] iio: buffer: introduce support for attaching more IIO buffers

2021-02-14 Thread Alexandru Ardelean
On Sun, Feb 14, 2021 at 4:02 PM Alexandru Ardelean wrote: > > On Sun, Feb 14, 2021 at 3:21 PM Jonathan Cameron wrote: > > > > On Thu, 11 Feb 2021 14:24:47 +0200 > > Alexandru Ardelean wrote: > > > > > With this change, calling iio_device_attach_buffer()

[PATCH 2/5] iio: kfifo: add devm_iio_kfifo_buffer_setup() helper

2021-02-14 Thread Alexandru Ardelean
. So, this should have a more familiar ring to what it is. Signed-off-by: Alexandru Ardelean --- .../driver-api/driver-model/devres.rst| 1 + drivers/iio/buffer/kfifo_buf.c| 39 +++ include/linux/iio/kfifo_buf.h | 7 3 files changed

[PATCH 1/5] iio: adc: ti_am335x_adc: remove omitted iio_kfifo_free()

2021-02-14 Thread Alexandru Ardelean
When the conversion was done to use devm_iio_kfifo_allocate(), a call to iio_kfifo_free() was omitted (to be removed). This change removes it. Fixes: 3c5308058899 ("iio: adc: ti_am335x_adc: alloc kfifo & IRQ via devm_ functions") Signed-off-by: Alexandru Ardelean --- d

[PATCH 3/5] iio: make use of devm_iio_kfifo_buffer_setup() helper

2021-02-14 Thread Alexandru Ardelean
. Signed-off-by: Alexandru Ardelean --- drivers/iio/accel/ssp_accel_sensor.c | 14 --- drivers/iio/adc/ina2xx-adc.c | 14 +-- drivers/iio/adc/ti_am335x_adc.c | 18 --- .../cros_ec_sensors/cros_ec_sensors_core.c| 13 --- dri

[PATCH 5/5] iio: kfifo: un-export devm_iio_kfifo_allocate() function

2021-02-14 Thread Alexandru Ardelean
devm_iio_kfifo_buffer_setup() or devm_iio_triggered_buffer_setup() to create a kfifo buffer. Signed-off-by: Alexandru Ardelean --- Documentation/driver-api/driver-model/devres.rst | 1 - drivers/iio/buffer/kfifo_buf.c | 3 +-- include/linux/iio/kfifo_buf.h| 2 -- 3 files

[PATCH 0/5] iio: kfifo: define a devm_iio_kfifo_buffer_setup helper

2021-02-14 Thread Alexandru Ardelean
ummy buffer. Related to patchset: https://lore.kernel.org/linux-iio/20201203095005.72252-1-alexandru.ardel...@analog.com/ The IIO dummy driver seems to be one of those blockers in cleaning up some IIO API. Alexandru Ardelean (5): iio: adc: ti_am335x_adc: remove omitted iio_kfifo_free() iio: k

[PATCH 4/5] iio: accel: sca3000: use devm_iio_kfifo_buffer_setup() helper

2021-02-14 Thread Alexandru Ardelean
this change) it shouldn't be a problem. Signed-off-by: Alexandru Ardelean --- drivers/iio/accel/sca3000.c | 19 +++ 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/drivers/iio/accel/sca3000.c b/drivers/iio/accel/sca3000.c index 194738660523..467b5fcb81db 100644 --- a/drivers

Re: [PATCH v5 12/17] iio: buffer: introduce support for attaching more IIO buffers

2021-02-14 Thread Alexandru Ardelean
On Sun, Feb 14, 2021 at 3:21 PM Jonathan Cameron wrote: > > On Thu, 11 Feb 2021 14:24:47 +0200 > Alexandru Ardelean wrote: > > > With this change, calling iio_device_attach_buffer() will actually attach > > more buffers. > > Right now this doesn't do any

Re: [PATCH v2 1/3] iio: core: Add mmap interface infrastructure

2021-02-12 Thread Alexandru Ardelean
On Fri, Feb 12, 2021 at 12:12 PM Alexandru Ardelean wrote: > > From: Lars-Peter Clausen > > Add the necessary infrastructure to the IIO core to support an mmap based > interface to access the capture data. > > The advantage of the mmap based interface compared to the rea

[RFC PATCH 4/5] iio: buffer-dma: Add output buffer support

2021-02-12 Thread Alexandru Ardelean
From: Lars-Peter Clausen Add support for output buffers to the dma buffer implementation. Signed-off-by: Lars-Peter Clausen Signed-off-by: Alexandru Ardelean --- drivers/iio/adc/adi-axi-adc.c | 3 +- drivers/iio/buffer/industrialio-buffer-dma.c | 116

[RFC PATCH 3/5] iio: buffer-dma: Allow to provide custom buffer ops

2021-02-12 Thread Alexandru Ardelean
From: Lars-Peter Clausen Some devices that want to make use of the DMA buffer might need to do something special, like write a register when the buffer is enabled. Extend the API to allow those drivers to provide their own buffer ops. Signed-off-by: Lars-Peter Clausen Signed-off-by: Alexandru

[RFC PATCH 5/5] iio: buffer-dma: add support for cyclic DMA transfers

2021-02-12 Thread Alexandru Ardelean
-by: Alexandru Ardelean --- .../buffer/industrialio-buffer-dmaengine.c| 24 --- include/uapi/linux/iio/buffer.h | 1 + 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/drivers/iio/buffer/industrialio-buffer-dmaengine.c b/drivers/iio/buffer

[RFC PATCH 2/5] iio: kfifo-buffer: Add output buffer support

2021-02-12 Thread Alexandru Ardelean
From: Lars-Peter Clausen Add output buffer support to the kfifo buffer implementation. The implementation is straight forward and mostly just wraps the kfifo API to provide the required operations. Signed-off-by: Lars-Peter Clausen Signed-off-by: Alexandru Ardelean --- drivers/iio/buffer

[RFC PATCH 1/5] iio: Add output buffer support

2021-02-12 Thread Alexandru Ardelean
after allocating and before registering it. Signed-off-by: Lars-Peter Clausen Signed-off-by: Alexandru Ardelean --- drivers/iio/industrialio-buffer.c | 110 -- include/linux/iio/buffer.h| 7 ++ include/linux/iio/buffer_impl.h | 11 +++ 3 files changed

[RFC PATCH 0/5] iio: buffer: add output buffer and cyclic mode

2021-02-12 Thread Alexandru Ardelean
Largely, an adaptation of Lars' work, applied on the IIO multi-buffer support + high-speed/mmap support [1]. Found here: https://github.com/larsclausen/linux/commits/iio-high-speed-5.10 But this isn't tested. [1] Requires that these sets be applied (in this order): *

[PATCH v2 1/3] iio: core: Add mmap interface infrastructure

2021-02-12 Thread Alexandru Ardelean
Clausen Signed-off-by: Alexandru Ardelean --- drivers/iio/industrialio-buffer.c | 157 ++ include/linux/iio/buffer-dma.h| 5 - include/linux/iio/buffer_impl.h | 23 + include/uapi/linux/iio/buffer.h | 26 + 4 files changed, 206 insertions(+), 5

[PATCH v2 3/3] tools: iio: add example for high-speed buffer support

2021-02-12 Thread Alexandru Ardelean
), to make sure that the mmap mode is used and not the fileio mode. Signed-off-by: Alexandru Ardelean --- tools/iio/iio_generic_buffer.c | 183 +++-- 1 file changed, 177 insertions(+), 6 deletions(-) diff --git a/tools/iio/iio_generic_buffer.c b/tools/iio

[PATCH v2 2/3] iio: buffer-dma: Add mmap support

2021-02-12 Thread Alexandru Ardelean
a significant overhead. In addition this interface allows more fine grained control over how many blocks are allocated and their size. Signed-off-by: Lars-Peter Clausen Signed-off-by: Alexandru Ardelean --- drivers/iio/buffer/industrialio-buffer-dma.c | 314 -- .../buffer

[PATCH v2 0/3] iio: core,buffer-dma: add mmap support

2021-02-12 Thread Alexandru Ardelean
com/analogdevicesinc/libiio/blob/master/local.c#L51 but will all the ioctl()s organized after the one that are reserved (hopefully) for IIO Tested that mmap() works. Moved (artifically) valid buffer0 as buffer2 and the operation still works. Alexandru Ardelean (1): tools: iio: add example for high-sp

Re: [PATCH 3/3] tools: iio: add example for high-speed buffer support

2021-02-11 Thread Alexandru Ardelean
On Thu, Feb 11, 2021 at 2:38 PM Alexandru Ardelean wrote: > > Following a recent update to the IIO buffer infrastructure, this change > adds a basic example on how to access an IIO buffer via the new mmap() > interface. > > The ioctl() for the high-speed mode needs to be

[PATCH 0/3] iio: core,buffer-dma: add mmap support

2021-02-11 Thread Alexandru Ardelean
the ioctl()s organized after the one that are reserved (hopefully) for IIO Tested that mmap() works. Moved (artifically) valid buffer0 as buffer2 and the operation still works. Alexandru Ardelean (1): tools: iio: add example for high-speed buffer support Lars-Peter Clausen (2): iio: core: Add mmap

[PATCH 1/3] iio: core: Add mmap interface infrastructure

2021-02-11 Thread Alexandru Ardelean
Clausen Signed-off-by: Alexandru Ardelean --- drivers/iio/industrialio-buffer.c | 157 ++ include/linux/iio/buffer-dma.h| 5 - include/linux/iio/buffer_impl.h | 11 +++ include/uapi/linux/iio/buffer.h | 27 + 4 files changed, 195 insertions(+), 5

[PATCH 2/3] iio: buffer-dma: Add mmap support

2021-02-11 Thread Alexandru Ardelean
a significant overhead. In addition this interface allows more fine grained control over how many blocks are allocated and their size. Signed-off-by: Lars-Peter Clausen Signed-off-by: Alexandru Ardelean --- drivers/iio/buffer/industrialio-buffer-dma.c | 314 -- .../buffer

[PATCH 3/3] tools: iio: add example for high-speed buffer support

2021-02-11 Thread Alexandru Ardelean
), to make sure that the mmap mode is used and not the fileio mode. Signed-off-by: Alexandru Ardelean --- tools/iio/iio_generic_buffer.c | 184 +++-- 1 file changed, 178 insertions(+), 6 deletions(-) diff --git a/tools/iio/iio_generic_buffer.c b/tools/iio

[PATCH v5 17/17] tools: iio: convert iio_generic_buffer to use new IIO buffer API

2021-02-11 Thread Alexandru Ardelean
. Tested buffer0 works with ioctl() 2. Tested that buffer0 can't be opened via /dev/iio:deviceX after ioctl() 3. Moved valid buffer0 to be buffer1, and tested that data comes from it Signed-off-by: Alexandru Ardelean --- tools/iio/Makefile | 1 + tools/iio/iio_generic_buffer.c | 120

[PATCH v5 14/17] iio: core: rename 'dev' -> 'indio_dev' in iio_device_alloc()

2021-02-11 Thread Alexandru Ardelean
' type objects. It makes grepping a bit easier as well. Signed-off-by: Alexandru Ardelean --- drivers/iio/industrialio-core.c | 28 ++-- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c index

[PATCH v5 16/17] tools: iio: privatize globals and functions in iio_generic_buffer.c file

2021-02-11 Thread Alexandru Ardelean
Mostly a tidy-up. But also helps to understand the limits of scope of these functions and globals. Signed-off-by: Alexandru Ardelean --- tools/iio/iio_generic_buffer.c | 31 +++ 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/tools/iio

[PATCH v5 13/17] iio: buffer: add ioctl() to support opening extra buffers for IIO device

2021-02-11 Thread Alexandru Ardelean
o:device0 has some fake kfifo buffers attached to an IIO device. Signed-off-by: Alexandru Ardelean --- drivers/iio/iio_core.h| 12 +-- drivers/iio/industrialio-buffer.c | 138 -- drivers/iio/industrialio-core.c | 1 + include/linux/iio/buffer_im

[PATCH v5 15/17] tools: iio: make iioutils_get_type() private in iio_utils

2021-02-11 Thread Alexandru Ardelean
' in the iioutils_get_type() function definition. Signed-off-by: Alexandru Ardelean --- tools/iio/iio_utils.c | 9 + tools/iio/iio_utils.h | 4 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/tools/iio/iio_utils.c b/tools/iio/iio_utils.c index 7399eb7f1378..a96002f2c2d5 100644 --- a/tools/iio

[PATCH v5 10/17] iio: core: wrap iio device & buffer into struct for character devices

2021-02-11 Thread Alexandru Ardelean
need to pass another buffer object than 'indio_dev->buffer'. Since we'll also open some chardevs via anon inodes, we can pass extra buffers in that function by assigning another object to the iio_dev_buffer_pair object. Signed-off-by: Alexandru Ardelean --- drivers/iio/iio_core.h

[PATCH v5 09/17] iio: buffer: dmaengine: obtain buffer object from attribute

2021-02-11 Thread Alexandru Ardelean
The reference to the IIO buffer object is stored on the attribute object. So we need to unwind it to obtain it. Signed-off-by: Alexandru Ardelean --- drivers/iio/buffer/industrialio-buffer-dmaengine.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iio/buffer

[PATCH v5 11/17] iio: buffer: move __iio_buffer_free_sysfs_and_mask() before alloc

2021-02-11 Thread Alexandru Ardelean
in this patch to make the patch that adds multiple buffers per IIO device a bit cleaner. Signed-off-by: Alexandru Ardelean --- drivers/iio/industrialio-buffer.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio

[PATCH v5 12/17] iio: buffer: introduce support for attaching more IIO buffers

2021-02-11 Thread Alexandru Ardelean
-ed for more buffers. Signed-off-by: Alexandru Ardelean --- drivers/iio/iio_core.h| 2 + drivers/iio/industrialio-buffer.c | 96 +-- drivers/iio/industrialio-core.c | 6 +- include/linux/iio/buffer.h| 4 +- include/linux/iio/buffer_impl.h | 3

[PATCH v5 07/17] iio: add reference to iio buffer on iio_dev_attr

2021-02-11 Thread Alexandru Ardelean
by 1. This looks like it could do with a bit of a re-think. Signed-off-by: Alexandru Ardelean --- drivers/iio/iio_core.h| 2 ++ drivers/iio/industrialio-buffer.c | 4 drivers/iio/industrialio-core.c | 6 ++ drivers/iio/industrialio-event.c | 1 + include/linux/iio/sysfs.h

[PATCH v5 04/17] iio: core: rework iio device group creation

2021-02-11 Thread Alexandru Ardelean
nnoy a few people since that would make the system less configurable. Signed-off-by: Alexandru Ardelean --- drivers/iio/iio_core.h | 3 +++ drivers/iio/industrialio-buffer.c | 12 ++-- drivers/iio/industrialio-core.c| 30 +++--- drivers/iio/industri

[PATCH v5 08/17] iio: buffer: wrap all buffer attributes into iio_dev_attr

2021-02-11 Thread Alexandru Ardelean
erging (or finalizing the merge) of the buffer/ & scan_elements/ attributes internally. Accessing these new buffer attributes can now be done via 'to_iio_dev_attr(attr)->buffer' inside the show/store handlers. Signed-off-by: Alexandru Ardelean --- drivers/iio/industrialio-

[PATCH v5 02/17] iio: core: register chardev only if needed

2021-02-11 Thread Alexandru Ardelean
ing this is required, it should be easy enough to do it. Signed-off-by: Alexandru Ardelean --- drivers/iio/industrialio-core.c | 23 ++- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c in

[PATCH v5 03/17] iio: core-trigger: make iio_device_register_trigger_consumer() an int return

2021-02-11 Thread Alexandru Ardelean
Oddly enough the noop function is an int-return. This one seems to be void. This change converts it to int, because we want to change how groups are registered. With that change this function could error out with -ENOMEM. Signed-off-by: Alexandru Ardelean --- drivers/iio/iio_core_trigger.h

[PATCH v5 06/17] iio: core: merge buffer/ & scan_elements/ attributes

2021-02-11 Thread Alexandru Ardelean
IIO device object. This way the IIO buffer can have just a single attribute_group object, saving a bit of memory when adding multiple IIO buffers. Signed-off-by: Alexandru Ardelean --- drivers/iio/industrialio-buffer.c | 115 +++--- include/linux/iio/buffer_impl.h |

[PATCH v5 05/17] iio: buffer: group attr count and attr alloc

2021-02-11 Thread Alexandru Ardelean
(for buffer/ and scan_elements/), and also a /sys/bus/iio/iio:devicesX/buffer0 attribute group. For buffer1 and above, just a single attribute group will be allocated (the merged one). Signed-off-by: Alexandru Ardelean --- drivers/iio/industrialio-buffer.c | 71 --- 1 file

[PATCH v5 00/17] iio: core,buffer: add support for multiple IIO buffers per IIO device

2021-02-11 Thread Alexandru Ardelean
GET_FD_IOCTL call returns 0 for buffer0; this is because I can't find a way to determine the FD of the ioctl() in the kernel; duplicating an ioctl() for buffer0 is also bad; Alexandru Ardelean (17): docs: ioctl-number.rst: reserve IIO subsystem ioctl() space iio: core: register chardev o

[PATCH v5 01/17] docs: ioctl-number.rst: reserve IIO subsystem ioctl() space

2021-02-11 Thread Alexandru Ardelean
is reserved for IIO ioctl() calls. Signed-off-by: Alexandru Ardelean --- Documentation/userspace-api/ioctl/ioctl-number.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/userspace-api/ioctl/ioctl-number.rst b/Documentation/userspace-api/ioctl/ioctl-number.rst index

Re: [PATCH 1/2] include: fpga: adi-axi-common.h: add definitions for supported FPGAs

2021-02-10 Thread Alexandru Ardelean
On Thu, Feb 11, 2021 at 6:00 AM Moritz Fischer wrote: > > Alexandru, > > On Wed, Feb 10, 2021 at 12:15:34PM +0200, Alexandru Ardelean wrote: > > From: Mircea Caprioru > > > > All (newer) FPGA IP cores supported by Analog Devices, store information in > >

[PATCH] MAINTAINERS: replace my with email with replacements

2021-02-10 Thread Alexandru Ardelean
This email will become inactive in a few weeks. This change removes it from the MAINTAINERS file and adds the people that will be responsible for the parts moving forward. Signed-off-by: Alexandru Ardelean --- MAINTAINERS | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git

[PATCH] iio: adc: adi-axi-adc: add proper Kconfig dependencies

2021-02-10 Thread Alexandru Ardelean
("iio: adc: adi-axi-adc: add support for AXI ADC IP core") Reported-by: kernel test robot Signed-off-by: Alexandru Ardelean --- drivers/iio/adc/Kconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index 769381b05b9a..d20a3b574

[PATCH 1/2] include: fpga: adi-axi-common.h: add definitions for supported FPGAs

2021-02-10 Thread Alexandru Ardelean
-by: Mircea Caprioru Signed-off-by: Alexandru Ardelean --- This is a continuation of this old set: https://lore.kernel.org/linux-clk/20200929144417.89816-1-alexandru.ardel...@analog.com/ Particularly patches: https://lore.kernel.org/linux-clk/20200929144417.89816-15-alexandru.ardel...@analog.com

[PATCH 2/2] clk: axi-clkgen: Add support for FPGA info

2021-02-10 Thread Alexandru Ardelean
, which are stored in the 'include/linux/fpga/adi-axi-common.h' file as they are common to all ADI FPGA cores. Signed-off-by: Mircea Caprioru Signed-off-by: Alexandru Ardelean --- drivers/clk/clk-axi-clkgen.c | 52 +++- 1 file changed, 51 insertions(+), 1 deletion

[PATCH v4 05/17] iio: buffer: group attr count and attr alloc

2021-02-10 Thread Alexandru Ardelean
(for buffer/ and scan_elements/), and also a /sys/bus/iio/iio:devicesX/buffer0 attribute group. For buffer1 and above, just a single attribute group will be allocated (the merged one). Signed-off-by: Alexandru Ardelean --- drivers/iio/industrialio-buffer.c | 71 --- 1 file

[PATCH v4 06/17] iio: core: merge buffer/ & scan_elements/ attributes

2021-02-10 Thread Alexandru Ardelean
IIO device object. This way the IIO buffer can have just a single attribute_group object, saving a bit of memory when adding multiple IIO buffers. Signed-off-by: Alexandru Ardelean --- drivers/iio/industrialio-buffer.c | 115 +++--- include/linux/iio/buffer_impl.h |

[PATCH v4 12/17] iio: buffer: introduce support for attaching more IIO buffers

2021-02-10 Thread Alexandru Ardelean
-ed for more buffers. Signed-off-by: Alexandru Ardelean --- drivers/iio/iio_core.h| 2 + drivers/iio/industrialio-buffer.c | 96 +-- drivers/iio/industrialio-core.c | 6 +- include/linux/iio/buffer.h| 4 +- include/linux/iio/buffer_impl.h | 3

[PATCH v4 10/17] iio: core: wrap iio device & buffer into struct for character devices

2021-02-10 Thread Alexandru Ardelean
need to pass another buffer object than 'indio_dev->buffer'. Since we'll also open some chardevs via anon inodes, we can pass extra buffers in that function by assigning another object to the iio_dev_buffer_pair object. Signed-off-by: Alexandru Ardelean --- drivers/iio/iio_core.h

[PATCH v4 13/17] iio: buffer: add ioctl() to support opening extra buffers for IIO device

2021-02-10 Thread Alexandru Ardelean
o:device0 has some fake kfifo buffers attached to an IIO device. Signed-off-by: Alexandru Ardelean --- drivers/iio/iio_core.h| 12 +-- drivers/iio/industrialio-buffer.c | 137 -- drivers/iio/industrialio-core.c | 1 + include/linux/iio/buffer_im

[PATCH v4 09/17] iio: buffer: dmaengine: obtain buffer object from attribute

2021-02-10 Thread Alexandru Ardelean
The reference to the IIO buffer object is stored on the attribute object. So we need to unwind it to obtain it. Signed-off-by: Alexandru Ardelean --- drivers/iio/buffer/industrialio-buffer-dmaengine.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/iio/buffer

[PATCH v4 17/17] tools: iio: convert iio_generic_buffer to use new IIO buffer API

2021-02-10 Thread Alexandru Ardelean
. Tested buffer0 works with ioctl() 2. Tested that buffer0 can't be opened via /dev/iio:deviceX after ioctl() 3. Moved valid buffer0 to be buffer1, and tested that data comes from it Signed-off-by: Alexandru Ardelean --- tools/iio/Makefile | 1 + tools/iio/iio_generic_buffer.c | 102

[PATCH v4 15/17] tools: iio: make iioutils_get_type() private in iio_utils

2021-02-10 Thread Alexandru Ardelean
' in the iioutils_get_type() function definition. Signed-off-by: Alexandru Ardelean --- tools/iio/iio_utils.c | 9 + tools/iio/iio_utils.h | 4 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/tools/iio/iio_utils.c b/tools/iio/iio_utils.c index 7399eb7f1378..a96002f2c2d5 100644 --- a/tools/iio

[PATCH v4 16/17] tools: iio: privatize globals and functions in iio_generic_buffer.c file

2021-02-10 Thread Alexandru Ardelean
Mostly a tidy-up. But also helps to understand the limits of scope of these functions and globals. Signed-off-by: Alexandru Ardelean --- tools/iio/iio_generic_buffer.c | 31 +++ 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/tools/iio

[PATCH v4 11/17] iio: buffer: move __iio_buffer_free_sysfs_and_mask() before alloc

2021-02-10 Thread Alexandru Ardelean
in this patch to make the patch that adds multiple buffers per IIO device a bit cleaner. Signed-off-by: Alexandru Ardelean --- drivers/iio/industrialio-buffer.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio

[PATCH v4 14/17] iio: core: rename 'dev' -> 'indio_dev' in iio_device_alloc()

2021-02-10 Thread Alexandru Ardelean
' type objects. It makes grepping a bit easier as well. Signed-off-by: Alexandru Ardelean --- drivers/iio/industrialio-core.c | 28 ++-- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c index

[PATCH v4 08/17] iio: buffer: wrap all buffer attributes into iio_dev_attr

2021-02-10 Thread Alexandru Ardelean
erging (or finalizing the merge) of the buffer/ & scan_elements/ attributes internally. Accessing these new buffer attributes can now be done via 'to_iio_dev_attr(attr)->buffer' inside the show/store handlers. Signed-off-by: Alexandru Ardelean --- drivers/iio/industrialio-

[PATCH v4 04/17] iio: core: rework iio device group creation

2021-02-10 Thread Alexandru Ardelean
nnoy a few people since that would make the system less configurable. Signed-off-by: Alexandru Ardelean --- drivers/iio/iio_core.h | 3 +++ drivers/iio/industrialio-buffer.c | 12 ++-- drivers/iio/industrialio-core.c| 30 +++--- drivers/iio/industri

[PATCH v4 00/17] iio: core,buffer: add support for multiple IIO buffers per IIO device

2021-02-10 Thread Alexandru Ardelean
fer.c file tools: iio: convert iio_generic_buffer to use new IIO buffer API Alexandru Ardelean (17): docs: ioctl-number.rst: reserve IIO subsystem ioctl() space iio: core: register chardev only if needed iio: core-trigger: make iio_device_register_trigger_consumer() an int return ii

[PATCH v4 03/17] iio: core-trigger: make iio_device_register_trigger_consumer() an int return

2021-02-10 Thread Alexandru Ardelean
Oddly enough the noop function is an int-return. This one seems to be void. This change converts it to int, because we want to change how groups are registered. With that change this function could error out with -ENOMEM. Signed-off-by: Alexandru Ardelean --- drivers/iio/iio_core_trigger.h

[PATCH v4 07/17] iio: add reference to iio buffer on iio_dev_attr

2021-02-10 Thread Alexandru Ardelean
by 1. This looks like it could do with a bit of a re-think. Signed-off-by: Alexandru Ardelean --- drivers/iio/iio_core.h| 2 ++ drivers/iio/industrialio-buffer.c | 4 drivers/iio/industrialio-core.c | 6 ++ drivers/iio/industrialio-event.c | 1 + include/linux/iio/sysfs.h

[PATCH v4 02/17] iio: core: register chardev only if needed

2021-02-10 Thread Alexandru Ardelean
ing this is required, it should be easy enough to do it. Signed-off-by: Alexandru Ardelean --- drivers/iio/industrialio-core.c | 23 ++- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c in

[PATCH v4 01/17] docs: ioctl-number.rst: reserve IIO subsystem ioctl() space

2021-02-10 Thread Alexandru Ardelean
is reserved for IIO ioctl() calls. Signed-off-by: Alexandru Ardelean --- Documentation/userspace-api/ioctl/ioctl-number.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/userspace-api/ioctl/ioctl-number.rst b/Documentation/userspace-api/ioctl/ioctl-number.rst index

Re: [PATCH v3 08/11] iio: buffer: wrap all buffer attributes into iio_dev_attr

2021-02-05 Thread Alexandru Ardelean
On Fri, Feb 5, 2021 at 2:40 PM Jonathan Cameron wrote: > > On Fri, 5 Feb 2021 11:17:04 +0200 > Alexandru Ardelean wrote: > > > On Thu, Feb 4, 2021 at 8:26 PM Jonathan Cameron > > wrote: > > > > > > On Mon, 1 Feb 2021 16:51:02 +0200 > > > A

Re: [PATCH v3 11/11] iio: buffer: add ioctl() to support opening extra buffers for IIO device

2021-02-05 Thread Alexandru Ardelean
On Fri, Feb 5, 2021 at 2:44 PM Jonathan Cameron wrote: > > On Fri, 5 Feb 2021 11:51:13 +0200 > Alexandru Ardelean wrote: > > > On Thu, Feb 4, 2021 at 9:06 PM Jonathan Cameron > > wrote: > > > > > > On Mon, 1 Feb 2021 16:51:05 +0200 > > > Alexan

Re: [PATCH v3 11/11] iio: buffer: add ioctl() to support opening extra buffers for IIO device

2021-02-05 Thread Alexandru Ardelean
On Thu, Feb 4, 2021 at 9:06 PM Jonathan Cameron wrote: > > On Mon, 1 Feb 2021 16:51:05 +0200 > Alexandru Ardelean wrote: > > > With this change, an ioctl() call is added to open a character device for a > > buffer. The ioctl() number is 'i' 0x91, which follows the &g

Re: [PATCH v3 10/11] iio: buffer: introduce support for attaching more IIO buffers

2021-02-05 Thread Alexandru Ardelean
On Thu, Feb 4, 2021 at 8:39 PM Jonathan Cameron wrote: > > On Mon, 1 Feb 2021 16:51:04 +0200 > Alexandru Ardelean wrote: > > > With this change, calling iio_device_attach_buffer() will actually attach > > more buffers. > > Right now this doesn't do any validation o

Re: [PATCH v3 08/11] iio: buffer: wrap all buffer attributes into iio_dev_attr

2021-02-05 Thread Alexandru Ardelean
On Thu, Feb 4, 2021 at 8:26 PM Jonathan Cameron wrote: > > On Mon, 1 Feb 2021 16:51:02 +0200 > Alexandru Ardelean wrote: > > > This change wraps all buffer attributes into iio_dev_attr objects, and > > assigns a reference to the IIO buffer they belong to. > > >

Re: [PATCH v3 07/11] iio: add reference to iio buffer on iio_dev_attr

2021-02-05 Thread Alexandru Ardelean
On Thu, Feb 4, 2021 at 8:16 PM Jonathan Cameron wrote: > > On Mon, 1 Feb 2021 16:51:01 +0200 > Alexandru Ardelean wrote: > > > This change adds a reference to a 'struct iio_buffer' object on the > > iio_dev_attr object. This way, we can use the created iio_dev_attr o

Re: [PATCH v3 05/11] iio: buffer: group attr count and attr alloc

2021-02-05 Thread Alexandru Ardelean
On Thu, Feb 4, 2021 at 7:57 PM Jonathan Cameron wrote: > > On Mon, 1 Feb 2021 16:50:59 +0200 > Alexandru Ardelean wrote: > > > If we want to merge the attributes of the buffer/ and scan_elements/ > > directories, we'll need to count all attributes first, then (depend

Re: [PATCH v3 04/11] iio: core: rework iio device group creation

2021-02-04 Thread Alexandru Ardelean
On Thu, Feb 4, 2021 at 7:39 PM Jonathan Cameron wrote: > > On Mon, 1 Feb 2021 16:50:58 +0200 > Alexandru Ardelean wrote: > > > 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 buffe

Re: [PATCH v3 01/11] docs: ioctl-number.rst: reserve IIO subsystem ioctl() space

2021-02-04 Thread Alexandru Ardelean
On Thu, Feb 4, 2021 at 7:13 PM Jonathan Cameron wrote: > > On Mon, 1 Feb 2021 16:50:55 +0200 > Alexandru Ardelean wrote: > > > Currently, only the 'i' 0x90 ioctl() actually exists and is defined in > > 'uapi/linux/iio/events.h'. > > > > It's the IIO_GET_EVENT

<    1   2   3   4   5   6   7   8   9   10   >