All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/16] Bring software triggers support to MAX1027-like ADCs
@ 2021-08-18 11:11 Miquel Raynal
  2021-08-18 11:11 ` [PATCH 01/16] iio: adc: max1027: Fix wrong shift with 12-bit devices Miquel Raynal
                   ` (15 more replies)
  0 siblings, 16 replies; 72+ messages in thread
From: Miquel Raynal @ 2021-08-18 11:11 UTC (permalink / raw)
  To: Jonathan Cameron, Lars-Peter Clausen
  Cc: Thomas Petazzoni, linux-iio, linux-kernel, Miquel Raynal

Until now the max1027.c driver, which handles 10-bit devices (max10xx)
and 12-bit devices (max12xx), only supported hardware triggers. When a
hardware trigger is not wired it is very convenient to trigger periodic
conversions with timers or on userspace demand with a sysfs
trigger. Overall, when several values are needed at the same time using
triggers and buffers improves quite a lot the performances.

This series starts with two small fixes, then does a bit of
cleaning/code reorganization before actually adding support for software
triggers.

This series has been developed and tested on a custom board with a 4.14
kernel. I then rebased the series on top of a mainline kernel
(v5.14-rc1) but unfortunately after quite some time debugging it I was
unable to get all the necessary blocks running in order to properly test
it. Anyway, there was very little changes in that series when rebasing
it from v4.14 to v5.14-rc1 so I am pretty confident it will smoothly
work with a more recent kernel.

How to test sysfs triggers:
    echo 0 > /sys/bus/iio/devices/iio_sysfs_trigger/add_trigger
    cat /sys/bus/iio/devices/iio_sysfs_trigger/trigger0/name > \
        /sys/bus/iio/devices/iio:device0/trigger/current_trigger
    echo 1 > /sys/bus/iio/devices/iio:device0/scan_elements/in_voltageX_en
    echo 1 > /sys/bus/iio/devices/iio:device0/scan_elements/in_voltageY_en
    echo 1 > /sys/bus/iio/devices/iio:device0/buffer/enable
    cat /dev/iio\:device0 > /tmp/data &
    echo 1 > /sys/bus/iio/devices/trigger0/trigger_now
    od -t x1 /tmp/data

Cheers,
Miquèl

Miquel Raynal (16):
  iio: adc: max1027: Fix wrong shift with 12-bit devices
  iio: adc: max1027: Fix the number of max1X31 channels
  iio: adc: max1027: Push only the requested samples
  iio: adc: max1027: Lower conversion time
  iio: adc: max1027: Drop extra warning message
  iio: adc: max1027: Rename a helper
  iio: adc: max1027: Create a helper to configure the trigger
  iio: adc: max1027: Explain better how the trigger state gets changed
  iio: adc: max1027: Create a helper to configure the channels to scan
  iio: adc: max1027: Prevent single channel accesses during buffer reads
  iio: adc: max1027: Separate the IRQ handler from the read logic
  iio: adc: max1027: Introduce an end of conversion helper
  iio: adc: max1027: Prepare re-using the EOC interrupt
  iio: adc: max1027: Consolidate the end of conversion helper
  iio: adc: max1027: Support software triggers
  iio: adc: max1027: Enable software triggers to be used without IRQ

 drivers/iio/adc/max1027.c | 236 ++++++++++++++++++++++++++++----------
 1 file changed, 177 insertions(+), 59 deletions(-)

-- 
2.27.0


^ permalink raw reply	[flat|nested] 72+ messages in thread
* Re: [PATCH 10/16] iio: adc: max1027: Prevent single channel accesses during buffer reads
@ 2021-08-18 20:58 kernel test robot
  0 siblings, 0 replies; 72+ messages in thread
From: kernel test robot @ 2021-08-18 20:58 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 4547 bytes --]

CC: kbuild-all(a)lists.01.org
In-Reply-To: <20210818111139.330636-11-miquel.raynal@bootlin.com>
References: <20210818111139.330636-11-miquel.raynal@bootlin.com>
TO: Miquel Raynal <miquel.raynal@bootlin.com>
TO: Jonathan Cameron <jic23@kernel.org>
TO: "Lars-Peter Clausen" <lars@metafoo.de>
CC: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
CC: linux-iio(a)vger.kernel.org
CC: linux-kernel(a)vger.kernel.org
CC: Miquel Raynal <miquel.raynal@bootlin.com>

Hi Miquel,

I love your patch! Perhaps something to improve:

[auto build test WARNING on iio/togreg]
[also build test WARNING on linux/master linus/master v5.14-rc6 next-20210818]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Miquel-Raynal/Bring-software-triggers-support-to-MAX1027-like-ADCs/20210818-191619
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
:::::: branch date: 10 hours ago
:::::: commit date: 10 hours ago
config: i386-randconfig-m021-20210818 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
drivers/iio/adc/max1027.c:366 max1027_read_raw() warn: inconsistent returns '&st->lock'.

vim +366 drivers/iio/adc/max1027.c

fc167f62483325 Philippe Reynes 2014-06-14  326  
fc167f62483325 Philippe Reynes 2014-06-14  327  static int max1027_read_raw(struct iio_dev *indio_dev,
fc167f62483325 Philippe Reynes 2014-06-14  328  			    struct iio_chan_spec const *chan,
fc167f62483325 Philippe Reynes 2014-06-14  329  			    int *val, int *val2, long mask)
fc167f62483325 Philippe Reynes 2014-06-14  330  {
fc167f62483325 Philippe Reynes 2014-06-14  331  	int ret = 0;
fc167f62483325 Philippe Reynes 2014-06-14  332  	struct max1027_state *st = iio_priv(indio_dev);
fc167f62483325 Philippe Reynes 2014-06-14  333  
fc167f62483325 Philippe Reynes 2014-06-14  334  	mutex_lock(&st->lock);
fc167f62483325 Philippe Reynes 2014-06-14  335  
fc167f62483325 Philippe Reynes 2014-06-14  336  	switch (mask) {
fc167f62483325 Philippe Reynes 2014-06-14  337  	case IIO_CHAN_INFO_RAW:
69515d07652c09 Miquel Raynal   2021-08-18  338  		if (iio_buffer_enabled(indio_dev))
69515d07652c09 Miquel Raynal   2021-08-18  339  			return -EBUSY;
fc167f62483325 Philippe Reynes 2014-06-14  340  		ret = max1027_read_single_value(indio_dev, chan, val);
fc167f62483325 Philippe Reynes 2014-06-14  341  		break;
fc167f62483325 Philippe Reynes 2014-06-14  342  	case IIO_CHAN_INFO_SCALE:
fc167f62483325 Philippe Reynes 2014-06-14  343  		switch (chan->type) {
fc167f62483325 Philippe Reynes 2014-06-14  344  		case IIO_TEMP:
fc167f62483325 Philippe Reynes 2014-06-14  345  			*val = 1;
fc167f62483325 Philippe Reynes 2014-06-14  346  			*val2 = 8;
fc167f62483325 Philippe Reynes 2014-06-14  347  			ret = IIO_VAL_FRACTIONAL;
fc167f62483325 Philippe Reynes 2014-06-14  348  			break;
fc167f62483325 Philippe Reynes 2014-06-14  349  		case IIO_VOLTAGE:
fc167f62483325 Philippe Reynes 2014-06-14  350  			*val = 2500;
7af5257d84275c Miquel Raynal   2019-10-11  351  			*val2 = chan->scan_type.realbits;
fc167f62483325 Philippe Reynes 2014-06-14  352  			ret = IIO_VAL_FRACTIONAL_LOG2;
fc167f62483325 Philippe Reynes 2014-06-14  353  			break;
fc167f62483325 Philippe Reynes 2014-06-14  354  		default:
fc167f62483325 Philippe Reynes 2014-06-14  355  			ret = -EINVAL;
fc167f62483325 Philippe Reynes 2014-06-14  356  			break;
fc167f62483325 Philippe Reynes 2014-06-14  357  		}
fc167f62483325 Philippe Reynes 2014-06-14  358  		break;
fc167f62483325 Philippe Reynes 2014-06-14  359  	default:
fc167f62483325 Philippe Reynes 2014-06-14  360  		ret = -EINVAL;
fc167f62483325 Philippe Reynes 2014-06-14  361  		break;
fc167f62483325 Philippe Reynes 2014-06-14  362  	}
fc167f62483325 Philippe Reynes 2014-06-14  363  
fc167f62483325 Philippe Reynes 2014-06-14  364  	mutex_unlock(&st->lock);
fc167f62483325 Philippe Reynes 2014-06-14  365  
fc167f62483325 Philippe Reynes 2014-06-14 @366  	return ret;
fc167f62483325 Philippe Reynes 2014-06-14  367  }
fc167f62483325 Philippe Reynes 2014-06-14  368  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 38766 bytes --]

^ permalink raw reply	[flat|nested] 72+ messages in thread

end of thread, other threads:[~2021-09-06 17:34 UTC | newest]

Thread overview: 72+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-18 11:11 [PATCH 00/16] Bring software triggers support to MAX1027-like ADCs Miquel Raynal
2021-08-18 11:11 ` [PATCH 01/16] iio: adc: max1027: Fix wrong shift with 12-bit devices Miquel Raynal
2021-08-20  7:02   ` Sa, Nuno
2021-08-30  9:57     ` Jonathan Cameron
2021-08-18 11:11 ` [PATCH 02/16] iio: adc: max1027: Fix the number of max1X31 channels Miquel Raynal
2021-08-20  7:03   ` Sa, Nuno
2021-08-30 10:00     ` Jonathan Cameron
2021-08-18 11:11 ` [PATCH 03/16] iio: adc: max1027: Push only the requested samples Miquel Raynal
2021-08-20  7:10   ` Sa, Nuno
2021-08-30 10:07     ` Jonathan Cameron
2021-08-30 10:49       ` Sa, Nuno
2021-08-30 14:29         ` Jonathan Cameron
2021-08-30 15:02           ` Sa, Nuno
2021-09-01  8:12             ` Miquel Raynal
2021-09-04 14:06               ` Jonathan Cameron
2021-09-06  8:59               ` Sa, Nuno
2021-09-06 16:56                 ` Jonathan Cameron
2021-09-06 17:34                   ` Miquel Raynal
2021-08-30 10:06   ` Jonathan Cameron
2021-08-18 11:11 ` [PATCH 04/16] iio: adc: max1027: Lower conversion time Miquel Raynal
2021-08-20  7:12   ` Sa, Nuno
2021-08-30 10:10   ` Jonathan Cameron
2021-08-18 11:11 ` [PATCH 05/16] iio: adc: max1027: Drop extra warning message Miquel Raynal
2021-08-20  7:12   ` Sa, Nuno
2021-08-30 10:12   ` Jonathan Cameron
2021-08-18 11:11 ` [PATCH 06/16] iio: adc: max1027: Rename a helper Miquel Raynal
2021-08-20  7:13   ` Sa, Nuno
2021-08-18 11:11 ` [PATCH 07/16] iio: adc: max1027: Create a helper to configure the trigger Miquel Raynal
2021-08-20  7:16   ` Sa, Nuno
2021-08-30 10:16   ` Jonathan Cameron
2021-08-18 11:11 ` [PATCH 08/16] iio: adc: max1027: Explain better how the trigger state gets changed Miquel Raynal
2021-08-20  7:17   ` Sa, Nuno
2021-08-18 11:11 ` [PATCH 09/16] iio: adc: max1027: Create a helper to configure the channels to scan Miquel Raynal
2021-08-20  7:18   ` Sa, Nuno
2021-08-18 11:11 ` [PATCH 10/16] iio: adc: max1027: Prevent single channel accesses during buffer reads Miquel Raynal
2021-08-20  7:20   ` Sa, Nuno
2021-08-20  7:30     ` Sa, Nuno
2021-08-30 10:20       ` Jonathan Cameron
2021-09-02  8:56         ` Miquel Raynal
2021-08-18 11:11 ` [PATCH 11/16] iio: adc: max1027: Separate the IRQ handler from the read logic Miquel Raynal
2021-08-20  7:23   ` Sa, Nuno
2021-09-02  8:55     ` Miquel Raynal
2021-09-04 14:08       ` Jonathan Cameron
2021-08-18 11:11 ` [PATCH 12/16] iio: adc: max1027: Introduce an end of conversion helper Miquel Raynal
2021-08-20  7:28   ` Sa, Nuno
2021-09-02  9:26     ` Miquel Raynal
2021-08-30 10:34   ` Jonathan Cameron
2021-08-18 11:11 ` [PATCH 13/16] iio: adc: max1027: Prepare re-using the EOC interrupt Miquel Raynal
2021-08-20  7:31   ` Sa, Nuno
2021-08-30 10:30   ` Jonathan Cameron
2021-08-30 10:47   ` Jonathan Cameron
2021-08-18 11:11 ` [PATCH 14/16] iio: adc: max1027: Consolidate the end of conversion helper Miquel Raynal
2021-08-20  7:45   ` Sa, Nuno
2021-08-30 10:37   ` Jonathan Cameron
2021-08-30 12:44     ` Sa, Nuno
2021-08-30 14:32       ` Jonathan Cameron
2021-09-02 15:12       ` Miquel Raynal
2021-09-03 14:28         ` Sa, Nuno
2021-09-03 14:46           ` Miquel Raynal
2021-09-05  9:41             ` Jonathan Cameron
2021-09-06  9:12               ` Sa, Nuno
2021-09-06  9:30                 ` Sa, Nuno
2021-08-18 11:11 ` [PATCH 15/16] iio: adc: max1027: Support software triggers Miquel Raynal
2021-08-20  7:58   ` Sa, Nuno
2021-09-02 12:25     ` Miquel Raynal
2021-09-03 14:20       ` Sa, Nuno
2021-08-30 10:50   ` Jonathan Cameron
2021-09-02 15:21     ` Miquel Raynal
2021-09-05  9:43       ` Jonathan Cameron
2021-08-18 11:11 ` [PATCH 16/16] iio: adc: max1027: Enable software triggers to be used without IRQ Miquel Raynal
2021-08-30 10:54   ` Jonathan Cameron
2021-08-18 20:58 [PATCH 10/16] iio: adc: max1027: Prevent single channel accesses during buffer reads kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.