History log of /linux-master/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h
Revision Date Author Comments
# 16ac43a1 03-Feb-2024 Lorenzo Bianconi <lorenzo@kernel.org>

iio: imu: st_lsm6dsx: add support to ASM330LHHXG1

Add support to STM ASM330LHHXG1 (accelerometer and gyroscope) Mems
sensor.
The ASM330LHHXG1 sensor can use LSM6DSR as fallback device since LSM6DSR
implements all the ASM330LHHXG1 features currently implemented in
st_lsm6dsx.

Link: https://www.st.com/resource/en/datasheet/asm330lhhxg1.pdf
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://lore.kernel.org/r/e3dbe4720cdf407d0152e93b1331306a8c7f5df3.1706961432.git.lorenzo@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# bd66b6ac 30-Jan-2023 Jonathan Cameron <Jonathan.Cameron@huawei.com>

iio: imu: lsm6dsx: Support SMO8B30 ACPI ID for LSM6DS3TR-C

ID seen in the wild and it is a valid ST micro ID.
An offset of 1 for the device ID enum is needed when adding support for
retrieving the ID from device_get_match_data() to allow detection of
NULL pointer and fallback to i2c_device_id table.

DSDT chunk cropped for relevant parts.

Scope (_SB.PCI0.I2C5)
{
Device (DEV)
{
Name (_HID, EisaId ("SMO8B30")) // _HID: Hardware ID
Name (_CID, EisaId ("SMO8B30")) // _CID: Compatible ID
Name (_UID, Zero) // _UID: Unique ID
Method (_CRS, 0, NotSerialized) // _CRS: Current Resource Settings
{
Name (RBUF, ResourceTemplate ()
{
I2cSerialBusV2 (0x006A, ControllerInitiated, 0x00061A80,
AddressingMode7Bit, "\\_SB.PCI0.I2C5",
0x00, ResourceConsumer, , Exclusive,
)
})
Return (RBUF) /* \_SB_.PCI0.I2C5.DEV_._CRS.RBUF */
}

Method (ROTM, 0, NotSerialized)
{
Name (RBUF, Package (0x03)
{
"0 -1 0",
"1 0 0",
"0 0 1"
})
Return (RBUF) /* \_SB_.PCI0.I2C5.DEV_.ROTM.RBUF */
}
...

Link: https://lore.kernel.org/all/20230129182441.082f29d0@jic23-huawei/
Reported-by: Darrell Kavanagh <darrell.kavanagh@gmail.com>
Tested-by: Darrell Kavanagh <darrell.kavanagh@gmail.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Link: https://lore.kernel.org/r/20230130201018.981024-2-jic23@kernel.org


# 18462d08 05-Mar-2023 Lorenzo Bianconi <lorenzo@kernel.org>

iio: imu: st_lsm6dsx: add support to ASM330LHB

Add support to STM ASM330LHB (acc + gyro) automotive Mems sensor.
The ASM330LHB sensor can use ASM330LHH as fallback device since it
implements all the ASM330LHB features currently implemented in
st_lsm6dsx.

Datasheet: https://www.st.com/resource/en/datasheet/asm330lhb.pdf
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://lore.kernel.org/r/a1d675457da7aa9e979d8cabea410e942e015e71.1678100533.git.lorenzo@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# db3c4905 26-Feb-2023 Lorenzo Bianconi <lorenzo@kernel.org>

iio: imu: st_lsm6dsx: discard samples during filters settling time

During digital filters settling time the driver is expected to drop
samples since they can be corrupted. Introduce the capability to drop
a given number of samples according to the configured ODR.
Add sample_to_discard for LSM6DSM-like sensors since new generation
devices (e.g. LSM6DSO) support DRDY mask where corrupted samples are
masked in hw with values greather than 0x7ffd so the driver can easily
discard them.
I have not added sample_to_discard support for LSM6DS3 or LSM6DS3H since
I do not have any sample for testing at the moment.

Reported-by: Philippe De Muyter <phdm@macqel.be>
Tested-by: Philippe De Muyter <phdm@macqel.be>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://lore.kernel.org/r/21dcd94935c147ef9b1da4984b3da6264ee9609e.1677496295.git.lorenzo@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# d354a2ee 16-Jan-2023 Philippe De Muyter <phdm@macqel.be>

iio: imu: st_lsm6dsx: add 'mount_matrix' sysfs entry to gyro channel.

Signed-off-by: Philippe De Muyter <phdm@macqel.be>
Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://lore.kernel.org/r/1673874434-30750-3-git-send-email-Philippe.DeMuyter@macq.eu
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 3a042fda 24-Nov-2022 Lorenzo Bianconi <lorenzo@kernel.org>

iio: imu: st_lsm6dsx: add support to ISM330IS

Add support to STM ISM330IS (accelerometer and gyroscope) Mems sensor.
The ISM330IS sensor can use LSM6DSO16IS as fallback device since it
implements all the ISM330IS features currently implemented in
st_lsm6dsx.

Datasheet: https://www.st.com/resource/en/datasheet/ism330is.pdf
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://lore.kernel.org/r/4cd1614060e06f49cd92f5930d8fd40117c07920.1669279604.git.lorenzo@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# f35e1ee9 16-Nov-2022 Lorenzo Bianconi <lorenzo@kernel.org>

iio: imu: st_lsm6dsx: add support to LSM6DSO16IS

Add support to STM LSM6DSO16IS (accelerometer and gyroscope) Mems sensor.

Datasheet: https://www.st.com/resource/en/datasheet/lsm6dso16is.pdf
Tested-by: Mario Tesi <mario.tesi@st.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://lore.kernel.org/r/df6a9d4653cd69f7204190f8b6a9b618fd48bd23.1668605631.git.lorenzo@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 46975081 06-Nov-2022 Lorenzo Bianconi <lorenzo@kernel.org>

iio: imu: st_lsm6dsx: add support to LSM6DSV16X

Add support to STM LSM6DSV16X (accelerometer and gyroscope) Mems sensor.
The LSM6DSV16X sensor can use LSM6DSV as fallback device since it
implements all the LSM6DSV16X features currently implemented in
st_lsm6dsx.

Datasheet: https://www.st.com/resource/en/datasheet/lsm6dsv16x.pdf
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://lore.kernel.org/r/284b251f861dff30c399e5736a843c8e3a497249.1667745215.git.lorenzo@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# a1c6d631 30-Oct-2022 Lorenzo Bianconi <lorenzo@kernel.org>

iio: imu: st_lsm6dsx: add support to LSM6DSV

Add support to STM LSM6DSV (accelerometer and gyroscope)
Mems sensor.

Datasheet: https://www.st.com/resource/en/datasheet/lsm6dsv.pdf
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://lore.kernel.org/r/aad879e7af0fe583bbf043a2b93e32fade79fa19.1667216004.git.lorenzo@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 2cfb2180 28-Oct-2022 Lorenzo Bianconi <lorenzo@kernel.org>

iio: imu: st_lsm6dsx: introduce sw trigger support

There are some hw configuration where irq0 and/or irq1 pins are not
connected to the SPI or I2C/I3C controller. In order to avoid polling
the output register introduce iio-sw trigger support when irq line is
not available (or hw FIFO is not supported).

Suggested-by: Mario Tesi <mario.tesi@st.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://lore.kernel.org/r/93ae6ff1150b531a9d7a4d3d1b1adb8383613717.1666955685.git.lorenzo@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 6900cdbf 19-Aug-2022 Matti Vaittinen <mazziesaccount@gmail.com>

iio: imu: st_lsm6dsx: Simplify using devm_regulator_*get_enable()

Use devm_regulator_bulk_get_enable() instead of open coded bulk-get,
bulk-enable, add-action-to-disable-at-detach - pattern.

A functional change (which seems like a bugfix) is that if
regulator_bulk_get fails, the enable is not attempted.

Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Link: https://lore.kernel.org/r/876e58428cec056d51070e49eff559e2d7c23b12.1660934107.git.mazziesaccount@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# cd83c5c1 10-Oct-2022 Lorenzo Bianconi <lorenzo@kernel.org>

iio: imu: st_lsm6dsx: introduce st_lsm6dsx_device_set_enable routine

Introduce st_lsm6dsx_device_set_enable utility routine and remove
duplicated code used to enable/disable sensors

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://lore.kernel.org/r/e3fbe5d4a3bed41130908669f745f78c8505cf47.1665399959.git.lorenzo@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 186b9e38 15-Sep-2022 Lorenzo Bianconi <lorenzo@kernel.org>

iio: imu: st_lsm6dsx: add support to LSM6DSTX

Add support to STM LSM6DSTX (acc + gyro) Mems sensor.
The LSM6DSTX sensor can use LSM6DST as fallback device since it
implements all the LSM6DSTX features currently implemented in
st_lsm6dsx.

Datasheet: https://www.st.com/resource/en/datasheet/lsm6dstx.pdf
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://lore.kernel.org/r/573a232b0f320b2ec92c56fa24393cfb275183fb.1663262890.git.lorenzo@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# fdd70d7a 04-Apr-2022 Lorenzo Bianconi <lorenzo@kernel.org>

iio: imu: st_lsm6dsx: add support to ASM330LHHX

Add support to STM ASM330LHHX (acc + gyro) automotive Mems sensor.
The ASM330LHHX sensor can use LSM6DSR as fallback device since it
implements all the ASM330LHHX features currently implemented in
st_lsm6dsx.

Datasheet: https://www.st.com/resource/en/datasheet/asm330lhhx.pdf
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://lore.kernel.org/r/04e2644772a6761a25c36bb9679979567fdebda3.1649100168.git.lorenzo@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 1b7da2fa 26-Sep-2021 Lorenzo Bianconi <lorenzo@kernel.org>

iio: imu: st_lsm6dsx: move max_fifo_size in st_lsm6dsx_fifo_ops

Move max_fifo_size in st_lsm6dsx_fifo_ops in order to have all
FIFO configuration parameters in st_lsm6dsx_fifo_ops structure.
This patch does not introduce any logic change, just small code
rearrangement.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://lore.kernel.org/r/3262ad9d9d1497e19ea1bab208c495c2b9a98994.1632664866.git.lorenzo@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 2c57d265 29-Nov-2020 Lorenzo Bianconi <lorenzo@kernel.org>

iio: imu: st_lsm6dsx: add support to LSM6DSOP

Add support to STM LSM6DSOP (acc + gyro) Mems sensor
https://www.st.com/resource/en/datasheet/lsm6dsop.pdf

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://lore.kernel.org/r/d3c459ad945ccd1a256f4a217128be214b0c024e.1606642528.git.lorenzo@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 98c3544a 28-Nov-2020 Lorenzo Bianconi <lorenzo@kernel.org>

iio: imu: st_lsmdsx: compact st_lsm6dsx_sensor_settings table

Shrink st_lsm6dsx_sensor_settings table size moving wai address info in
id array and remove duplicated code

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://lore.kernel.org/r/c43286938b2fe03ab3abdb5fc095ea6b950abcb1.1606557946.git.lorenzo@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# f346b16f 17-Nov-2020 Lorenzo Bianconi <lorenzo@kernel.org>

iio: imu: st_lsm6dsx: add vdd-vddio voltage regulator

Like all other ST sensors, st_lsm6dsx devices have VDD and VDDIO power
lines. Introduce voltage regulators to control them.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://lore.kernel.org/r/a0427a66360bdec73c3b1fb536a46240f96b2ae7.1605631305.git.lorenzo@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 4393e4c5 06-Oct-2020 Lorenzo Bianconi <lorenzo@kernel.org>

iio: imu: st_lsm6dsx: add support to LSM6DST

Add support to STM LSM6DST (acc + gyro) Mems sensor
https://www.st.com/resource/en/datasheet/lsm6dst.pdf

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://lore.kernel.org/r/835127b76ef5ad05aa2aac58298aee5f3073fb71.1601985763.git.lorenzo@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# c14edb4d 22-Jul-2020 Jonathan Cameron <Jonathan.Cameron@huawei.com>

iio:imu:st_lsm6dsx Fix alignment and data leak issues

One of a class of bugs pointed out by Lars in a recent review.
iio_push_to_buffers_with_timestamp assumes the buffer used is aligned
to the size of the timestamp (8 bytes). This is not guaranteed in
this driver which uses an array of smaller elements on the stack.
As Lars also noted this anti pattern can involve a leak of data to
userspace and that indeed can happen here. We close both issues by
moving to an array of suitable structures in the iio_priv() data.

This data is allocated with kzalloc so no data can leak apart from
previous readings.

For the tagged path the data is aligned by using __aligned(8) for
the buffer on the stack.

There has been a lot of churn in this driver, so likely backports
may be needed for stable.

Fixes: 290a6ce11d93 ("iio: imu: add support to lsm6dsx driver")
Reported-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
Cc: <Stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20200722155103.979802-17-jic23@kernel.org


# a1bab939 13-Jul-2020 Lorenzo Bianconi <lorenzo@kernel.org>

iio: imu: st_lsm6dsx: reset hw ts after resume

Reset hw time samples generator after system resume in order to avoid
disalignment between system and device time reference since FIFO
batching and time samples generator are disabled during suspend.

Fixes: 213451076bd3 ("iio: imu: st_lsm6dsx: add hw timestamp support")
Tested-by: Sean Nyekjaer <sean@geanix.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 82cf139f 17-Jul-2020 Lee Jones <lee.jones@linaro.org>

iio: imu: st_lsm6dsx: st_lsm6dsx: Mark 'st_lsm6dsx_accel_ext_info' as __maybe_unused

It doesn't make sense to move it into '*core*' as it's co-located with
other, similar definitions which are used in multiple locations.

Fixes the following W=1 kernel build warning(s):

In file included from drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_i2c.c:17:
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h:497:44: warning: ‘st_lsm6dsx_accel_ext_info’ defined but not used [-Wunused-const-variable=]
497 | static const struct iio_chan_spec_ext_info st_lsm6dsx_accel_ext_info[] = {
| ^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_spi.c:17:
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h:497:44: warning: ‘st_lsm6dsx_accel_ext_info’ defined but not used [-Wunused-const-variable=]
497 | static const struct iio_chan_spec_ext_info st_lsm6dsx_accel_ext_info[] = {
| ^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_i3c.c:16:
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h:497:44: warning: ‘st_lsm6dsx_accel_ext_info’ defined but not used [-Wunused-const-variable=]
497 | static const struct iio_chan_spec_ext_info st_lsm6dsx_accel_ext_info[] = {
| ^~~~~~~~~~~~~~~~~~~~~~~~~

Cc: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
Cc: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# deb38af4 17-Jul-2020 Lee Jones <lee.jones@linaro.org>

iio: imu: st_lsm6dsx: st_lsm6dsx: Reorder 'inline' declaration

Fixes the following W=1 kernel build warning(s):

drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h:487:1: warning: ‘inline’ is not at beginning of declaration [-Wold-style-declaration]
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h:497:44: warning: ‘st_lsm6dsx_accel_ext_info’ defined but not used [-Wunused-const-variable=]

Cc: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
Cc: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# a0e35e24 24-Mar-2020 Jimmy Assarsson <jimmyassarsson@gmail.com>

iio: imu: st_lsm6dsx: Increase ODR_LIST_SIZE

Support for sensor with up to 8 different ODR settings.
Required for supporting LIS3MDL as sensor hub slave device.

Signed-off-by: Jimmy Assarsson <jimmyassarsson@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 76551a3c 13-Mar-2020 Lorenzo Bianconi <lorenzo@kernel.org>

iio: imu: st_lsm6dsx: specify slave odr in slv_odr

Introduce slv_odr in ext_info data structure in order to distinguish
between sensor hub trigger (accel sensor) odr and i2c slave odr and
properly compute samples in FIFO pattern

Fixes: e485e2a2cfd6 ("iio: imu: st_lsm6dsx: enable sensor-hub support for lsm6dsm")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 7762902c 13-Mar-2020 Lorenzo Bianconi <lorenzo@kernel.org>

iio: imu: st_lsm6dsx: fix read misalignment on untagged FIFO

st_lsm6dsx suffers of a read misalignment on untagged FIFO when
all 3 supported sensors (accel, gyro and ext device) are running
at different ODRs (the use-case is reported in the LSM6DSM Application
Note at pag 100).
Fix the issue taking into account decimation factor reading the FIFO
pattern.

Fixes: e485e2a2cfd6 ("iio: imu: st_lsm6dsx: enable sensor-hub support for lsm6dsm")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 5de6570b 27-Jan-2020 JieunKim <jieun.kim4758@gmail.com>

iio: imu: st_lsm6dsx: Fix mismatched comments

odr to odr_table
gain to fs_table

'gain' is actually in 'st_lsm6dsx_fs' structure of 'fs_table'

Signed-off-by: JieunKim <jieun.kim4758@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 04e6fedb 13-Jan-2020 Martin Kepplinger <martink@posteo.de>

iio: imu: st_lsm6dsx: add mount matrix support

Allow to read the mount-matrix device tree property and provide the
mount_matrix file for userspace to read.

Signed-off-by: Martin Kepplinger <martin.kepplinger@puri.sm>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# e485e2a2 14-Dec-2019 Lorenzo Bianconi <lorenzo@kernel.org>

iio: imu: st_lsm6dsx: enable sensor-hub support for lsm6dsm

Enabled i2c master controller support for LSM6DSM sensor. Enable
ext_sensor0 for lsm6dsm. This series has been tested using LIS2MDL as
slave device connected to the i2c controller of the LSM6DSM

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 5b8343e0 14-Dec-2019 Lorenzo Bianconi <lorenzo@kernel.org>

iio: imu: st_lsm6dsx: check if shub_output reg is located in primary page

Check if the sensor hub output register is located in the primary or in the
secondary memory page. This is a preliminary patch to support i2c master
controller on lsm6dsm devices

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 3a431957 14-Dec-2019 Lorenzo Bianconi <lorenzo@kernel.org>

iio: imu: st_lsm6dsx: check if pull_up is located in primary page

Check if the pull up register is located in the primary or in the
secondary memory page. This is a preliminary patch to support i2c master
controller on lsm6dsm devices

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 007f2ebb 14-Dec-2019 Lorenzo Bianconi <lorenzo@kernel.org>

iio: imu: st_lsm6dsx: check if master_enable is located in primary page

Check if the master enable register is located in the primary or in the
secondary memory page. This is a preliminary patch to support i2c master
controller on lsm6dsm devices

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# ee978bb8 14-Dec-2019 Lorenzo Bianconi <lorenzo@kernel.org>

iio: imu: st_lsm6dsx: export max num of slave devices in st_lsm6dsx_shub_settings

Export max number of slave devices supported by the i2c master
controller in st_lsm6dsx_shub_settings data structure.
This is a preliminary patch to support i2c master controller
on lsm6dsm sensors

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 07bf07e2 16-Dec-2019 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

iio: st_lsm6dsx: Mark predefined constants with __maybe_unused

Since we put static variable to a header file it's copied to each module
that includes the header. But not all of them are actually used it.

Mark predefined constants with __maybe_unused to calm a compiler down:

In file included from drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_i2c.c:17:
.../st_lsm6dsx/st_lsm6dsx.h:399:28: warning: ‘st_lsm6dsx_available_scan_masks’ defined but not used [-Wunused-const-variable=]
399 | static const unsigned long st_lsm6dsx_available_scan_masks[] = {0x7, 0x0};
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.../st_lsm6dsx/st_lsm6dsx.h:392:36: warning: ‘st_lsm6dsx_event’ defined but not used [-Wunused-const-variable=]
392 | static const struct iio_event_spec st_lsm6dsx_event = {
| ^~~~~~~~~~~~~~~~
...

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# c2686eb2 28-Nov-2019 Lorenzo Bianconi <lorenzo@kernel.org>

iio: imu: st_lsm6dsx: track hw FIFO buffering with fifo_mask

Track hw FIFO state introducing fifo_mask since now the accel sensor
can be enabled during suspend/resume in order to trigger the wake-up
enabling the FIFO in st_lsm6dsx_resume even if it was disabled before
the suspend. Hence we must separately track the fifo state.

Fixes: 4c997dfa692d ("iio: imu: st_lsm6dsx: add wakeup-source option")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Tested-by: Sean Nyekjaer <sean@geanix.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 5685b145 28-Nov-2019 Lorenzo Bianconi <lorenzo@kernel.org>

iio: imu: st_lsm6dsx: fix decimation factor estimation

Fix decimation factor and sip estimation for LSM6DSM series
(max value for decimation factor is 32).
If gyro and accel sensors are enabled at 12.5Hz and 416Hz
respectively, decimation factor lookup will fail, producing
unaligned data.
Remove unused decimator filed in st_lsm6dsx_sensor structure.

Fixes: f8710f0357bc ("iio: imu: st_lsm6dsx: express odr in mHZ")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# f8710f03 03-Nov-2019 Lorenzo Bianconi <lorenzo@kernel.org>

iio: imu: st_lsm6dsx: express odr in mHZ

Express available frequencies in mHZ in order to support even
rational ODRs. This patch is need to fix an Android CTS failure

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 59af4e20 03-Nov-2019 Lorenzo Bianconi <lorenzo@kernel.org>

iio: imu: st_lsm6dsx: explicitly define odr table size

Introduce odr_len in st_lsm6dsx_odr_table_entry data structure in order
to explicitly define odr table size and support devices with different
odr table map

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# cf9c71b3 24-Oct-2019 Lorenzo Bianconi <lorenzo@kernel.org>

iio: imu: st_lsm6dsx: add support to LSM6DSRX

Add support to STM LSM6DSRX 6-axis (acc + gyro) Mems sensor
https://www.st.com/resource/en/datasheet/lsm6dsrx.pdf

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# fa060a3d 07-Oct-2019 Lorenzo Bianconi <lorenzo@kernel.org>

iio: imu: st_lsm6dsx: add support to LSM6DS0

Add support to STM LSM6DS0 6-axis (acc + gyro) Mems sensor

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# cb3b6b8e 07-Oct-2019 Mario Tesi <mario.tesi@st.com>

iio: imu: st_lsm6dsx: add odr calibration feature

On LSM6DSO/LSM6DSR/LSM6DSOX/ASM330LHH and ISH330DHCX
devices it is possible to trim the hardware timestamp
resolution through the FREQ_FINE[7:0] bits of the
INTERNAL_FREQ_FINE register, which contains the difference
in percentage of the effective ODR (and timestamp rate)
with respect to the typical value.

The formula for calculating the effective ODR reported
in the application notes has been linearized to the first
order to simplify the calculation (pls. see note on source
code).

This change may be useful in the outcome of CTS
tests regarding the SingleSensorTests and the
SensorTest#testSensorTimeStamps for high ODRs

Signed-off-by: Mario Tesi <mario.tesi@st.com>
Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 960506ed 08-Oct-2019 Lorenzo Bianconi <lorenzo@kernel.org>

iio: imu: st_lsm6dsx: enable drdy-mask if available

Enable drdy mask if available in order to mark invalid samples during
sensor bootstrap phase

Tested-by: Mario Tesi <mario.tesi@st.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 3473b923 06-Oct-2019 Lorenzo Bianconi <lorenzo@kernel.org>

iio: imu: st_lsm6dsx: add missing kernel documenation

Add missing kernel doc for st_lsm6dsx_hw data structure

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Reviewed-by: Sean Nyekjaer <sean@geanix.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 66b662a1 06-Oct-2019 Lorenzo Bianconi <lorenzo@kernel.org>

iio: imu: st_lsm6dsx: move bdu/boot and reset register info in hw_settings

Move bdu, boot and reset register definitions in hw_settings register
map since not all supported sensors (e.g lsm9ds1) rely on the same
definitions

Fixes: 52f4b1f19679 ("iio: imu: st_lsm6dsx: add support for accel/gyro unit of lsm9ds1")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 31fe8d4e 06-Oct-2019 Lorenzo Bianconi <lorenzo@kernel.org>

iio: imu: st_lsm6dsx: do not access active-low/open-drain regs if not supported

Move active low and open drain register definitions in hw_settings
register map since not all supported sensors (e.g lsm9ds1) rely on the
same definitions

Fixes: 52f4b1f19679 ("iio: imu: st_lsm6dsx: add support for accel/gyro unit of lsm9ds1")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 7e906103 06-Oct-2019 Lorenzo Bianconi <lorenzo@kernel.org>

iio: imu: st_lsm6dsx: move irq related definitions in irq_config

Group irq related definition in irq_config structure in
st_lsm6dsx_settings. This is a preliminary patch to move
OpenDrain/Active low registers in st_lsm6dsx_settings.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Tested-by: Sean Nyekjaer <sean@geanix.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 1aabad1f 16-Sep-2019 Sean Nyekjaer <sean@geanix.com>

iio: imu: st_lsm6dsx: add motion report function and call from interrupt

Report iio motion events to iio subsystem and filter motion events.
Wakeup will still be on all channels as it's not possible to do the filtering
in hw.

Signed-off-by: Sean Nyekjaer <sean@geanix.com>
Reviewed-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# b5969abf 16-Sep-2019 Sean Nyekjaer <sean@geanix.com>

iio: imu: st_lsm6dsx: add motion events

Add event channels that controls the creation of motion events.
Tested on ISM330DLC

Signed-off-by: Sean Nyekjaer <sean@geanix.com>
Reviewed-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 22ea5651 11-Sep-2019 Lorenzo Bianconi <lorenzo@kernel.org>

iio: imu: st_lsm6dsx: enable clear on read for latched interrupts

Enable clear on read feature for latched interrupts. This bit allows
immediately clearing the latched interrupts of an event detection upon
the read of the corresponding status register.
It must be set to 1 together with LIR.
This feature is available just on LSM6DS0/LSM6DSR/ASM330LHH

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Tested-by: Sean Nyekjaer <sean@geanix.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 9db02d32 11-Sep-2019 Lorenzo Bianconi <lorenzo@kernel.org>

iio: imu: st_lsm6dsx: enable LIR for sensor events

Enable Latched interrupt by default for sensor events

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Tested-by: Sean Nyekjaer <sean@geanix.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 85ae3aee 31-Aug-2019 Lorenzo Bianconi <lorenzo@kernel.org>

iio: imu: st_lsm6dsx: forbid 0 sensor sensitivity

Do not allow configuring null sensor gain since it will force to 0
device outputs

Fixes: c8d4066c7246 ("iio: imu: st_lsm6dsx: remove invalid gain value for LSM9DS1")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 52f4b1f1 21-Aug-2019 Martin Kepplinger <martink@posteo.de>

iio: imu: st_lsm6dsx: add support for accel/gyro unit of lsm9ds1

The LSM9DS1's accelerometer / gyroscope unit and it's magnetometer (separately
supported in iio/magnetometer/st_magn*) are located on a separate i2c addresses
on the bus.

For the datasheet, see https://www.st.com/resource/en/datasheet/lsm9ds1.pdf

Treat it just like the LSM6* devices and, despite it's name, hook it up
to the st_lsm6dsx driver, using it's basic functionality.

accelerometer and gyroscope are not independently clocked. It runs at the gyro
frequencies if both are enabled, see chapter 7.12 of the datasheet.
We could have handled this as a single IIO device but we have split
it up to be more consistent with the other more flexible devices.

Despite supporting and testing the LSM9DS1, we call the gyro channels
iio_chan_spec struct "st_lsm6ds0_gyro_channels" because the register
description is equal. This suggests that supporting LSM6DS0 should be
trivial to do.

Signed-off-by: Martin Kepplinger <martin.kepplinger@puri.sm>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 5022c5a4 21-Aug-2019 Martin Kepplinger <martink@posteo.de>

iio: imu: st_lsm6dsx: move register definitions to sensor_settings struct

Move some register definitions to the per-device array of struct
st_lsm6dsx_sensor_settings in order to simplify adding new sensor
devices to the driver.

Also, remove completely unused register definitions.

Signed-off-by: Martin Kepplinger <martin.kepplinger@puri.sm>
Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 3b72950d 21-Aug-2019 Lorenzo Bianconi <lorenzo@kernel.org>

iio: imu: st_lsm6dsx: introduce update_fifo function pointer

Introduce update_fifo routine pointer in st_lsm6dsx_fifo_ops data
structure since we will need a different update FIFO configuration
callback adding support for lsm6ds0/lsm9ds1 imu device

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Tested-by: Martin Kepplinger <martin.kepplinger@puri.sm>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 48cceecf 01-Aug-2019 Martin Kepplinger <martink@posteo.de>

iio: imu: st_lsm6dsx: make IIO_CHAN_INFO_SCALE shared by type

in_accel_x_scale, in_accel_y_scale and in_accel_z_scale are always
the same. The scale is still defined to be in "info_mask_separate".

Userspace (iio-sensor-proxy and others) is not used to that and only
looks for "in_accel_scale" for the scaling factor to apply.

Change IIO_CHAN_INFO_SCALE from being separate in all channel to be
shared by type.

This removes in_accel_x_scale, in_accel_y_scale and in_accel_z_scale and
makes available in_accel_scale.

This is an ABI change, but hopefully in the 'no one will notice'
category. The cleanup in interface is worth the small risk that
there is a custom script out there somewhere that this will break.

Signed-off-by: Martin Kepplinger <martin.kepplinger@puri.sm>
Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# db947a79 04-Aug-2019 Lorenzo Bianconi <lorenzo@kernel.org>

iio: imu: st_lsm6dsx: add support to ISM330DHCX

Add support to STM ISM330DHCX 6-axis (acc + gyro) Mems sensor
https://www.st.com/resource/en/datasheet/ism330dhcx.pdf

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# f48bc49b 29-Jul-2019 Lorenzo Bianconi <lorenzo@kernel.org>

iio: imu: st_lsm6dsx: move iio chan definitions in st_lsm6dsx_sensor_settings

Move IIO channel definitions in st_lsm6dsx_sensor_settings in order to
support sensors with different channels maps.
This is a preliminary patch to add support for LSM9DS1 sensor to
st_lsm6dsx driver.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Tested-by: Martin Kepplinger <martin.kepplinger@puri.sm>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 640aca3f 29-Jul-2019 Lorenzo Bianconi <lorenzo@kernel.org>

iio: imu: st_lsm6dsx: move fs_table in st_lsm6dsx_sensor_settings

Move fs_table in st_lsm6dsx_sensor_settings in order to support
sensors with different gain maps. This is a preliminary patch to add
support for LSM9DS1 sensor to st_lsm6dsx driver

Tested-by: Martin Kepplinger <martin.kepplinger@puri.sm>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 40dd7343 29-Jul-2019 Lorenzo Bianconi <lorenzo@kernel.org>

iio: imu: st_lsm6dsx: move odr_table in st_lsm6dsx_sensor_settings

Move sensor odr table in st_lsm6dsx_sensor_settings in order to support
sensors with different odr maps. This is a preliminary patch to add
support for LSM9DS1 sensor to st_lsm6dsx driver

Tested-by: Martin Kepplinger <martin.kepplinger@puri.sm>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# dbcd2088 28-Jun-2019 Lorenzo Bianconi <lorenzo@kernel.org>

iio: imu: st_lsm6dsx: add support to LSM6DS3TR-C

Add support to STM LSM6DS3TR-C 6-axis (acc + gyro) Mems sensor
https://www.st.com/resource/en/datasheet/lsm6ds3tr-c.pdf

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 81956a93 08-Jun-2019 Lorenzo Bianconi <lorenzo@kernel.org>

iio: imu: st_lsm6dsx: get device name from st_lsm6dsx_sensor_settings

Introduce sensor name in st_lsm6dsx_sensor_settings table. This is
a preliminary patch to add I3C support to st_lsm6dsx since i3c_device_id
data structure does not contain a name field

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# fda8d26e 28-May-2019 Thomas Gleixner <tglx@linutronix.de>

treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 177

Based on 1 normalized pattern(s):

licensed under the gpl 2

extracted by the scancode license scanner the SPDX license identifier

GPL-2.0-only

has been chosen to replace the boilerplate/reference in 135 file(s).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Allison Randal <allison@lohutok.net>
Reviewed-by: Richard Fontana <rfontana@redhat.com>
Reviewed-by: Alexios Zavras <alexios.zavras@intel.com>
Reviewed-by: Steve Winslow <swinslow@gmail.com>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190528170026.071193225@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# bce0d57d 19-May-2019 Lorenzo Bianconi <lorenzo@kernel.org>

iio: imu: st_lsm6dsx: fix PM support for st_lsm6dsx i2c controller

Properly suspend/resume i2c slaves connected to st_lsm6dsx master
controller if the CPU goes in suspended state

Fixes: c91c1c844ebd ("imu: st_lsm6dsx: add i2c embedded controller support")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 43901008 04-Apr-2019 Lorenzo Bianconi <lorenzo@kernel.org>

iio: imu: st_lsm6dsx: add support to LSM6DSR

Add support to STM LSM6DSR 6-axis (acc + gyro) Mems sensor
https://www.st.com/resource/en/datasheet/lsm6dsr.pdf

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 6af0e8a9 15-Mar-2019 Lorenzo Bianconi <lorenzo@kernel.org>

iio: imu: st_lsm6dsx: add support to LSM6DSOX

Add support to STM LSM6DSOX 6-axis (acc + gyro) Mems sensor
https://www.st.com/resource/en/datasheet/lsm6dsox.pdf

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 3054c4ff 21-Feb-2019 Lorenzo Bianconi <lorenzo@kernel.org>

iio: imu: st_lsm6dsx: add support to ASM330LHH

Add support to STM ASM330LHH 6-axis (acc + gyro) Mems sensor
https://www.st.com/resource/en/datasheet/asm330lhh.pdf

Tested-by: Mario Tesi <mario.tesi@st.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 6d0205fd 11-Nov-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

iio: imu: st_lsm6dsx: add hw FIFO support to i2c controller

Introduce hw FIFO support to lsm6dsx i2c controller.
st_lsm6dsx sensor-hub relies on SLV0 for slave configuration since SLV0
is the only channel that can be used to write into i2c slave devices.
SLV{1,2,3} channels are used to read external data and push them into
the hw FIFO

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# c91c1c84 11-Nov-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

iio: imu: st_lsm6dsx: add i2c embedded controller support

i2c controller embedded in lsm6dx series can connect up to four
slave devices using accelerometer sensor as trigger for i2c
read/write operations.
Introduce sensor hub support for lsm6dso sensor. Add register map
for lis2mdl magnetometer sensor.
In order to perform single read/write operations st_lsm6dsx driver
relies on SLV0 channel (hw FIFO is not supported yet)

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 17750443 11-Nov-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

iio: imu: st_lsm6dsx: introduce st_lsm6dsx_sensor_set_enable routine

Add st_lsm6dsx_sensor_set_enable routine and remove
st_lsm6dsx_sensor_{enable/disable} ones in order to make the code more
readable and remove unnecessary functions

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 6ffb55e5 11-Nov-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

iio: imu: st_lsm6dsx: introduce ST_LSM6DSX_ID_EXT sensor ids

Add ST_LSM6DSX_ID_EXT{0,1,2} sensor ids as reference for slave devices
connected to st_lsm6dsx i2c controller. Moreover introduce odr dependency
between accel and ext devices since i2c embedded controller relies on the
accelerometer sensor as bus read/write trigger so we need to enable accel
device at odr = max(accel_odr, ext_odr) in order to properly communicate
with i2c slave devices

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# d40464f3 11-Nov-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

iio: imu: st_lsm6dsx: remove static from st_lsm6dsx_set_watermark

Remove static qualifier from st_lsm6dsx_set_watermark routine in
order to be reused supporting st_lsm6dsx i2c controller

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 739aff87 11-Nov-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

iio: imu: st_lsm6dsx: introduce locked read/write utility routines

Add st_lsm6dsx_update_bits_locked, st_lsm6dsx_read_locked and
st_lsm6dsx_write_locked utility routines in order to guarantee
the bus access is atomic respect to reg page configuration.
This is a preliminary patch to add i2c sensor hub support since
i2c master registers are accessed through a reg page multiplexer

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 801a6e0a 30-Aug-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

iio: imu: st_lsm6dsx: add support to LSM6DSO

Add support to STM LSM6DSO 6-axis (acc + gyro) Mems sensor
https://www.st.com/resource/en/datasheet/lsm6dso.pdf

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 54a6d0c6 30-Aug-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

iio: imu: st_lsm6dsx: make st_lsm6dsx_check_odr() non-static

Remove static qualifier from st_lsm6dsx_check_odr() definition in order to
use it for the support of new devices

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 50ff457d 30-Aug-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

iio: imu: st_lsm6dsx: add read_fifo callback to fifo_ops

Remove static qualifier from st_lsm6dsx_read_fifo definition and
introduce read_fifo function pointer in fifo_ops data structure
in order to run the proper read_fifo routine since other compliant
devices will use a different FIFO queueing scheme.

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 179c8d60 30-Mar-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

iio: imu: st_lsm6dsx: add support to ism330dlc

Add support to STM ISM330DLC 6-axis (acc + gyro) Mems sensor
http://www.st.com/resource/en/datasheet/ism330dlc.pdf

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 21345107 13-Jan-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

iio: imu: st_lsm6dsx: add hw timestamp support

Introduce hw timestamp support instead of compute sample timestamps
according to interrupt rate and configured watermark. LSM6DSx based
devices are able to queue in hw FIFO the time reference of data
sampling

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 5b6c65f4 06-Jan-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

iio: imu: st_lsm6dsx: remove st_lsm6dsx_write_with_mask() declaration

Remove st_lsm6dsx_write_with_mask() declaration since it has been removed
in commit 6674bef628e6 ("iio: imu: st_lsm6dsx: add regmap API support")

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 91a6b841 06-Jan-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

iio: imu: st_lsm6dsx: pre-allocate read buffer at bootstrap

Allocate device read buffer at bootstrap and do not put it on the stack
since it is pretty big (~200B) and its size will increase adding support
to device hw timestamp.
Moreover this patch fixes following sparse warnings:
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c:250:17: warning: Variable length
array is used.
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c:283:55: error: cannot size
expression

Fixes: 290a6ce11d93 ("iio: imu: add support to lsm6dsx driver")
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 51a8b707 01-Jan-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

iio: imu: st_lsm6dsx: add regmap API support

Introduce regmap API support to access to i2c/spi bus instead of
using a custom support. Set max bulk read to
(32 / SAMPLE_SIZE) * SAMPLE_SIZE since spi_write_then_read() used in
regmap_spi indicates that is the max buffer length to use in order to
avoid a kmalloc for each bus access.
Remove lock mutex since concurrency is already managed by regmap API

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 335eaedc 01-Jan-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

iio: imu: st_lsm6dsx: introduce conf_lock mutex

Add conf_lock mutex to prevent concurrent FIFO configuration update

Fixes: 290a6ce11d93 (iio: imu: add support to lsm6dsx driver)
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 92617c15 02-Oct-2017 Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>

iio: imu: st_lsm6dsx: add FIFO ops data structure

Introduce FIFO ops data structure to contain FIFO related parameters
in order to properly support more devices in st_lsm6dsx driver

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 7ca3ac9e 02-Oct-2017 Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>

iio: imu: st_lsm6dsx: move decimator info in st_lsm6dsx_sensor_settings

Move FIFO decimator info in st_lsm6dsx_sensor_settings list since
decimator registers are exported in register map just in
lsm6ds3/lsm6ds3h/lsm6dsl/lsm6dsm sensors and not in other compliant
devices

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# d3f77058 27-Apr-2017 Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>

iio: imu: st_lsm6dsx: add system power management support

Add system sleep power management support to st_lsm6dsx driver.
In particular during suspend phase each sensor is disabled and
hw fifo is configured in bypass in order to avoid subsequent
I/O operations. The patch has been tested on HiKey board device

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>


# 535de397 27-Apr-2017 Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>

iio: imu: st_lsm6dsx: modify st_lsm6dsx_flush_fifo and st_lsm6dsx_set_fifo_mode scope

Remove static qualifier from st_lsm6dsx_flush_fifo() and
st_lsm6dsx_set_fifo_mode() in order to use them in system sleep pm support

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>


# 510c0106 03-Apr-2017 Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>

iio: imu: st_lsm6dsx: use i2c/spi device name for iio_dev name

Use the correct chip name (e.g. lsm6dsm) as suffix for iio_dev name
instead of a generic one (lsm6dsx)

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>


# df47710a 29-Jan-2017 Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>

iio: imu: st_lsm6dsx: add support to lsm6ds3h

Add support to STM LSM6DS3H 6-axis (acc + gyro) Mems sensor

http://www.st.com/resource/en/datasheet/lsm6ds3h.pdf
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>


# 0b2a3e5f 29-Jan-2017 Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>

iio: imu: st_lsm6dsx: add support to lsm6dsl

Add support to STM LSM6DSL 6-axis (acc + gyro) Mems sensor

http://www.st.com/resource/en/datasheet/lsm6dsl.pdf
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>


# d068e4a0 29-Jan-2017 Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>

iio: imu: st_lsm6dsx: add support to multiple devices with the same settings

Add capability to support multiple devices with the same
st_lsm6dsx_settings like LSM6DSM/LSM6DSL

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>


# 290a6ce1 10-Jan-2017 Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>

iio: imu: add support to lsm6dsx driver

Add support to STM LSM6DS3-LSM6DSM 6-axis (acc + gyro) Mems sensor

http://www.st.com/resource/en/datasheet/lsm6ds3.pdf
http://www.st.com/resource/en/datasheet/lsm6dsm.pdf

- continuous mode support
- i2c support
- spi support
- sw fifo mode support
- supported devices: lsm6ds3, lsm6dsm

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>