All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 00/13] iio: imu: new inv_icm42600 driver
@ 2020-06-08 20:42 Jean-Baptiste Maneyrol
  2020-06-08 20:42 ` [PATCH v3 01/13] iio: imu: inv_icm42600: add core of " Jean-Baptiste Maneyrol
                   ` (12 more replies)
  0 siblings, 13 replies; 28+ messages in thread
From: Jean-Baptiste Maneyrol @ 2020-06-08 20:42 UTC (permalink / raw)
  To: jic23, robh+dt, robh, mchehab+huawei, davem, gregkh
  Cc: linux-iio, devicetree, linux-kernel, Jean-Baptiste Maneyrol

Changelog
v1
  -initial patch submission
v2
  - formatting reworks, missing headers, code cleanup ...
  - delete all debug traces
  - add commentaries for better explanation of suspend/resume, timestamp, ...
  - delete i2c/spi table ids keeping only of, and use I2C probe_new function
  - switch calibbias to SI units and add calibias_available attribute
  - use DMA-safe buffer for all regmap_bulk_* calls
  - delete iio trigger usage and setup/handle interrupt in core module
  - add open-drain interrupt support
  - add FIFO on reference counter and buffer postenable/predisable to replace
    iio trigger usage
  - check that temperature data is present before copying in buffer
  - add temperature sensor off when fifo is turned off
  - delete timestamp channel reading
  - move timestamp state in IIO device private data
  - allow only 1 ODR change in a batch of data
  - add driver-open-drain in devicetree YAML and delete spi options
v3
  - delete const pointer cast for iio_device_get_drvdata
  - change gyro and accel init to return the allocated iio_dev structure
  - delete manual parent device assignment
  - correct style and improve readability
  - add commentaries about IIO buffer and watermark complex computation
  - add timestamp alignment in IIO buffer structure
  - wrap lines 80 columns for dt bindings
  - add ABI documentation for calibbias values in SI units

This series add a new driver for managing InvenSense ICM-426xx 6-axis IMUs.
This next generation of chips includes new generations of 3-axis gyroscope
and 3-axis accelerometer, support of I3C in addition to I2C and SPI, and
intelligent MotionTracking features like pedometer, tilt detection, and
tap detection.

This series is delivering a driver supporting gyroscope, accelerometer and
temperature data, with polling and buffering using hwfifo and watermark,
on I2C and SPI busses.

Gyroscope and accelerometer sensors are completely independent and can have
different ODRs. Since there is only a single FIFO a specific value is used to
mark invalid data. For keeping the device standard we are de-multiplexing data
from the FIFO to 2 IIO devices with 2 buffers, 1 for the accelerometer and 1
for the gyroscope. This architecture also enables to easily turn each sensor
on/off without impacting the other. The device interrupt is used to read the
FIFO and launch parsing of accelerometer and gyroscope data. A complex
timestamping mechanism is added to handle correctly FIFO watermark and dynamic
changes of settings.

Jean-Baptiste Maneyrol (13):
  iio: imu: inv_icm42600: add core of new inv_icm42600 driver
  iio: imu: inv_icm42600: add I2C driver for inv_icm42600 driver
  iio: imu: inv_icm42600: add SPI driver for inv_icm42600 driver
  iio: imu: inv_icm42600: add gyroscope IIO device
  iio: imu: inv_icm42600: add accelerometer IIO device
  iio: imu: inv_icm42600: add temperature sensor support
  iio: imu: add Kconfig and Makefile for inv_icm42600 driver
  Documentation: ABI: add specific icm42600 documentation
  iio: imu: inv_icm42600: add device interrupt
  iio: imu: inv_icm42600: add buffer support in iio devices
  iio: imu: inv_icm42600: add accurate timestamping
  dt-bindings: iio: imu: Add inv_icm42600 documentation
  MAINTAINERS: add entry for inv_icm42600 6-axis imu sensor

 .../ABI/testing/sysfs-bus-iio-icm42600        |  20 +
 .../bindings/iio/imu/invensense,icm42600.yaml |  90 ++
 MAINTAINERS                                   |   8 +
 drivers/iio/imu/Kconfig                       |   1 +
 drivers/iio/imu/Makefile                      |   1 +
 drivers/iio/imu/inv_icm42600/Kconfig          |  29 +
 drivers/iio/imu/inv_icm42600/Makefile         |  15 +
 drivers/iio/imu/inv_icm42600/inv_icm42600.h   | 395 +++++++++
 .../iio/imu/inv_icm42600/inv_icm42600_accel.c | 789 +++++++++++++++++
 .../imu/inv_icm42600/inv_icm42600_buffer.c    | 601 +++++++++++++
 .../imu/inv_icm42600/inv_icm42600_buffer.h    |  98 +++
 .../iio/imu/inv_icm42600/inv_icm42600_core.c  | 786 +++++++++++++++++
 .../iio/imu/inv_icm42600/inv_icm42600_gyro.c  | 800 ++++++++++++++++++
 .../iio/imu/inv_icm42600/inv_icm42600_i2c.c   | 101 +++
 .../iio/imu/inv_icm42600/inv_icm42600_spi.c   | 100 +++
 .../iio/imu/inv_icm42600/inv_icm42600_temp.c  |  87 ++
 .../iio/imu/inv_icm42600/inv_icm42600_temp.h  |  30 +
 .../imu/inv_icm42600/inv_icm42600_timestamp.c | 195 +++++
 .../imu/inv_icm42600/inv_icm42600_timestamp.h |  85 ++
 19 files changed, 4231 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-bus-iio-icm42600
 create mode 100644 Documentation/devicetree/bindings/iio/imu/invensense,icm42600.yaml
 create mode 100644 drivers/iio/imu/inv_icm42600/Kconfig
 create mode 100644 drivers/iio/imu/inv_icm42600/Makefile
 create mode 100644 drivers/iio/imu/inv_icm42600/inv_icm42600.h
 create mode 100644 drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c
 create mode 100644 drivers/iio/imu/inv_icm42600/inv_icm42600_buffer.c
 create mode 100644 drivers/iio/imu/inv_icm42600/inv_icm42600_buffer.h
 create mode 100644 drivers/iio/imu/inv_icm42600/inv_icm42600_core.c
 create mode 100644 drivers/iio/imu/inv_icm42600/inv_icm42600_gyro.c
 create mode 100644 drivers/iio/imu/inv_icm42600/inv_icm42600_i2c.c
 create mode 100644 drivers/iio/imu/inv_icm42600/inv_icm42600_spi.c
 create mode 100644 drivers/iio/imu/inv_icm42600/inv_icm42600_temp.c
 create mode 100644 drivers/iio/imu/inv_icm42600/inv_icm42600_temp.h
 create mode 100644 drivers/iio/imu/inv_icm42600/inv_icm42600_timestamp.c
 create mode 100644 drivers/iio/imu/inv_icm42600/inv_icm42600_timestamp.h

-- 
2.17.1


^ permalink raw reply	[flat|nested] 28+ messages in thread
* Re: [PATCH v3 10/13] iio: imu: inv_icm42600: add buffer support in iio devices
@ 2020-06-10 15:00 kernel test robot
  0 siblings, 0 replies; 28+ messages in thread
From: kernel test robot @ 2020-06-10 15:00 UTC (permalink / raw)
  To: kbuild

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

CC: kbuild-all(a)lists.01.org
In-Reply-To: <20200608204250.3291-11-jmaneyrol@invensense.com>
References: <20200608204250.3291-11-jmaneyrol@invensense.com>
TO: "Jean-Baptiste Maneyrol" <jmaneyrol@invensense.com>
TO: jic23(a)kernel.org
TO: robh+dt(a)kernel.org
TO: robh(a)kernel.org
TO: mchehab+huawei(a)kernel.org
TO: davem(a)davemloft.net
TO: gregkh(a)linuxfoundation.org
CC: linux-iio(a)vger.kernel.org
CC: devicetree(a)vger.kernel.org
CC: linux-kernel(a)vger.kernel.org
CC: "Jean-Baptiste Maneyrol" <jmaneyrol@invensense.com>

Hi Jean-Baptiste,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on iio/togreg]
[also build test WARNING on robh/for-next v5.7]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Jean-Baptiste-Maneyrol/iio-imu-new-inv_icm42600-driver/20200609-044917
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
:::::: branch date: 2 days ago
:::::: commit date: 2 days ago
compiler: gcc-9 (Debian 9.3.0-13) 9.3.0

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


cppcheck warnings: (new ones prefixed by >>)

>> drivers/iio/imu/inv_icm42600/inv_icm42600_buffer.c:70:3: warning: Address of local auto-variable assigned to a function parameter. [autoVariables]
     *accel = &pack2->accel;
     ^
   drivers/iio/imu/inv_icm42600/inv_icm42600_buffer.c:71:3: warning: Address of local auto-variable assigned to a function parameter. [autoVariables]
     *gyro = &pack2->gyro;
     ^
   drivers/iio/imu/inv_icm42600/inv_icm42600_buffer.c:72:3: warning: Address of local auto-variable assigned to a function parameter. [autoVariables]
     *temp = &pack2->temp;
     ^
   drivers/iio/imu/inv_icm42600/inv_icm42600_buffer.c:79:3: warning: Address of local auto-variable assigned to a function parameter. [autoVariables]
     *accel = &pack1->data;
     ^
   drivers/iio/imu/inv_icm42600/inv_icm42600_buffer.c:81:3: warning: Address of local auto-variable assigned to a function parameter. [autoVariables]
     *temp = &pack1->temp;
     ^
   drivers/iio/imu/inv_icm42600/inv_icm42600_buffer.c:89:3: warning: Address of local auto-variable assigned to a function parameter. [autoVariables]
     *gyro = &pack1->data;
     ^
   drivers/iio/imu/inv_icm42600/inv_icm42600_buffer.c:90:3: warning: Address of local auto-variable assigned to a function parameter. [autoVariables]
     *temp = &pack1->temp;
     ^

# https://github.com/0day-ci/linux/commit/aaea93463d06a3965ecc840c4d132a60478aa694
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout aaea93463d06a3965ecc840c4d132a60478aa694
vim +70 drivers/iio/imu/inv_icm42600/inv_icm42600_buffer.c

aaea93463d06a3 Jean-Baptiste Maneyrol 2020-06-08  41  
aaea93463d06a3 Jean-Baptiste Maneyrol 2020-06-08  42  ssize_t inv_icm42600_fifo_decode_packet(const void *packet, const void **accel,
aaea93463d06a3 Jean-Baptiste Maneyrol 2020-06-08  43  					const void **gyro, const int8_t **temp,
aaea93463d06a3 Jean-Baptiste Maneyrol 2020-06-08  44  					const void **timestamp, unsigned int *odr)
aaea93463d06a3 Jean-Baptiste Maneyrol 2020-06-08  45  {
aaea93463d06a3 Jean-Baptiste Maneyrol 2020-06-08  46  	const struct inv_icm42600_fifo_1sensor_packet *pack1 = packet;
aaea93463d06a3 Jean-Baptiste Maneyrol 2020-06-08  47  	const struct inv_icm42600_fifo_2sensors_packet *pack2 = packet;
aaea93463d06a3 Jean-Baptiste Maneyrol 2020-06-08  48  	uint8_t header = *((const uint8_t *)packet);
aaea93463d06a3 Jean-Baptiste Maneyrol 2020-06-08  49  
aaea93463d06a3 Jean-Baptiste Maneyrol 2020-06-08  50  	/* FIFO empty */
aaea93463d06a3 Jean-Baptiste Maneyrol 2020-06-08  51  	if (header & INV_ICM42600_FIFO_HEADER_MSG) {
aaea93463d06a3 Jean-Baptiste Maneyrol 2020-06-08  52  		*accel = NULL;
aaea93463d06a3 Jean-Baptiste Maneyrol 2020-06-08  53  		*gyro = NULL;
aaea93463d06a3 Jean-Baptiste Maneyrol 2020-06-08  54  		*temp = NULL;
aaea93463d06a3 Jean-Baptiste Maneyrol 2020-06-08  55  		*timestamp = NULL;
aaea93463d06a3 Jean-Baptiste Maneyrol 2020-06-08  56  		*odr = 0;
aaea93463d06a3 Jean-Baptiste Maneyrol 2020-06-08  57  		return 0;
aaea93463d06a3 Jean-Baptiste Maneyrol 2020-06-08  58  	}
aaea93463d06a3 Jean-Baptiste Maneyrol 2020-06-08  59  
aaea93463d06a3 Jean-Baptiste Maneyrol 2020-06-08  60  	/* handle odr flags */
aaea93463d06a3 Jean-Baptiste Maneyrol 2020-06-08  61  	*odr = 0;
aaea93463d06a3 Jean-Baptiste Maneyrol 2020-06-08  62  	if (header & INV_ICM42600_FIFO_HEADER_ODR_GYRO)
aaea93463d06a3 Jean-Baptiste Maneyrol 2020-06-08  63  		*odr |= INV_ICM42600_SENSOR_GYRO;
aaea93463d06a3 Jean-Baptiste Maneyrol 2020-06-08  64  	if (header & INV_ICM42600_FIFO_HEADER_ODR_ACCEL)
aaea93463d06a3 Jean-Baptiste Maneyrol 2020-06-08  65  		*odr |= INV_ICM42600_SENSOR_ACCEL;
aaea93463d06a3 Jean-Baptiste Maneyrol 2020-06-08  66  
aaea93463d06a3 Jean-Baptiste Maneyrol 2020-06-08  67  	/* accel + gyro */
aaea93463d06a3 Jean-Baptiste Maneyrol 2020-06-08  68  	if ((header & INV_ICM42600_FIFO_HEADER_ACCEL) &&
aaea93463d06a3 Jean-Baptiste Maneyrol 2020-06-08  69  	    (header & INV_ICM42600_FIFO_HEADER_GYRO)) {
aaea93463d06a3 Jean-Baptiste Maneyrol 2020-06-08 @70  		*accel = &pack2->accel;
aaea93463d06a3 Jean-Baptiste Maneyrol 2020-06-08  71  		*gyro = &pack2->gyro;
aaea93463d06a3 Jean-Baptiste Maneyrol 2020-06-08  72  		*temp = &pack2->temp;
aaea93463d06a3 Jean-Baptiste Maneyrol 2020-06-08  73  		*timestamp = &pack2->timestamp;
aaea93463d06a3 Jean-Baptiste Maneyrol 2020-06-08  74  		return INV_ICM42600_FIFO_2SENSORS_PACKET_SIZE;
aaea93463d06a3 Jean-Baptiste Maneyrol 2020-06-08  75  	}
aaea93463d06a3 Jean-Baptiste Maneyrol 2020-06-08  76  
aaea93463d06a3 Jean-Baptiste Maneyrol 2020-06-08  77  	/* accel only */
aaea93463d06a3 Jean-Baptiste Maneyrol 2020-06-08  78  	if (header & INV_ICM42600_FIFO_HEADER_ACCEL) {
aaea93463d06a3 Jean-Baptiste Maneyrol 2020-06-08  79  		*accel = &pack1->data;
aaea93463d06a3 Jean-Baptiste Maneyrol 2020-06-08  80  		*gyro = NULL;
aaea93463d06a3 Jean-Baptiste Maneyrol 2020-06-08  81  		*temp = &pack1->temp;
aaea93463d06a3 Jean-Baptiste Maneyrol 2020-06-08  82  		*timestamp = NULL;
aaea93463d06a3 Jean-Baptiste Maneyrol 2020-06-08  83  		return INV_ICM42600_FIFO_1SENSOR_PACKET_SIZE;
aaea93463d06a3 Jean-Baptiste Maneyrol 2020-06-08  84  	}
aaea93463d06a3 Jean-Baptiste Maneyrol 2020-06-08  85  
aaea93463d06a3 Jean-Baptiste Maneyrol 2020-06-08  86  	/* gyro only */
aaea93463d06a3 Jean-Baptiste Maneyrol 2020-06-08  87  	if (header & INV_ICM42600_FIFO_HEADER_GYRO) {
aaea93463d06a3 Jean-Baptiste Maneyrol 2020-06-08  88  		*accel = NULL;
aaea93463d06a3 Jean-Baptiste Maneyrol 2020-06-08  89  		*gyro = &pack1->data;
aaea93463d06a3 Jean-Baptiste Maneyrol 2020-06-08  90  		*temp = &pack1->temp;
aaea93463d06a3 Jean-Baptiste Maneyrol 2020-06-08  91  		*timestamp = NULL;
aaea93463d06a3 Jean-Baptiste Maneyrol 2020-06-08  92  		return INV_ICM42600_FIFO_1SENSOR_PACKET_SIZE;
aaea93463d06a3 Jean-Baptiste Maneyrol 2020-06-08  93  	}
aaea93463d06a3 Jean-Baptiste Maneyrol 2020-06-08  94  
aaea93463d06a3 Jean-Baptiste Maneyrol 2020-06-08  95  	/* invalid packet if here */
aaea93463d06a3 Jean-Baptiste Maneyrol 2020-06-08  96  	return -EINVAL;
aaea93463d06a3 Jean-Baptiste Maneyrol 2020-06-08  97  }
aaea93463d06a3 Jean-Baptiste Maneyrol 2020-06-08  98  

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

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

end of thread, other threads:[~2020-06-22  9:21 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-08 20:42 [PATCH v3 00/13] iio: imu: new inv_icm42600 driver Jean-Baptiste Maneyrol
2020-06-08 20:42 ` [PATCH v3 01/13] iio: imu: inv_icm42600: add core of " Jean-Baptiste Maneyrol
2020-06-08 20:42 ` [PATCH v3 02/13] iio: imu: inv_icm42600: add I2C driver for " Jean-Baptiste Maneyrol
2020-06-08 20:42 ` [PATCH v3 03/13] iio: imu: inv_icm42600: add SPI " Jean-Baptiste Maneyrol
2020-06-08 20:42 ` [PATCH v3 04/13] iio: imu: inv_icm42600: add gyroscope IIO device Jean-Baptiste Maneyrol
2020-06-08 20:42 ` [PATCH v3 05/13] iio: imu: inv_icm42600: add accelerometer " Jean-Baptiste Maneyrol
2020-06-08 20:42 ` [PATCH v3 06/13] iio: imu: inv_icm42600: add temperature sensor support Jean-Baptiste Maneyrol
2020-06-14 15:10   ` Lars-Peter Clausen
2020-06-14 20:35     ` Jean-Baptiste Maneyrol
2020-06-20 15:57       ` Jonathan Cameron
2020-06-22  9:21         ` Jean-Baptiste Maneyrol
2020-06-08 20:42 ` [PATCH v3 07/13] iio: imu: add Kconfig and Makefile for inv_icm42600 driver Jean-Baptiste Maneyrol
2020-06-08 23:03   ` kernel test robot
2020-06-08 23:03     ` kernel test robot
2020-06-14 13:52     ` Jonathan Cameron
2020-06-14 13:52       ` Jonathan Cameron
2020-06-09  6:33   ` kernel test robot
2020-06-09  6:33     ` kernel test robot
2020-06-08 20:42 ` [PATCH v3 08/13] Documentation: ABI: add specific icm42600 documentation Jean-Baptiste Maneyrol
2020-06-08 20:42 ` [PATCH v3 09/13] iio: imu: inv_icm42600: add device interrupt Jean-Baptiste Maneyrol
2020-06-08 20:42 ` [PATCH v3 10/13] iio: imu: inv_icm42600: add buffer support in iio devices Jean-Baptiste Maneyrol
2020-06-14 14:17   ` Jonathan Cameron
2020-06-08 20:42 ` [PATCH v3 11/13] iio: imu: inv_icm42600: add accurate timestamping Jean-Baptiste Maneyrol
2020-06-14 14:21   ` Jonathan Cameron
2020-06-08 20:42 ` [PATCH v3 12/13] dt-bindings: iio: imu: Add inv_icm42600 documentation Jean-Baptiste Maneyrol
2020-06-17 20:53   ` Rob Herring
2020-06-08 20:42 ` [PATCH v3 13/13] MAINTAINERS: add entry for inv_icm42600 6-axis imu sensor Jean-Baptiste Maneyrol
2020-06-10 15:00 [PATCH v3 10/13] iio: imu: inv_icm42600: add buffer support in iio devices 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.