* [PATCH 0/9] Add support of similar chips
@ 2020-01-20 9:36 Jean-Baptiste Maneyrol
2020-01-20 9:36 ` [PATCH 1/9] dt-bindings: iio: imu: inv_mpu6050: add missing entry for mpu6000 Jean-Baptiste Maneyrol
` (8 more replies)
0 siblings, 9 replies; 13+ messages in thread
From: Jean-Baptiste Maneyrol @ 2020-01-20 9:36 UTC (permalink / raw)
To: Jonathan Cameron, linux-iio, devicetree
Cc: Rob Herring, Mark Rutland, Jean-Baptiste Maneyrol
This series add support of new chips that are similar to the ones already
supported.
Add correct OF support for spi and modify low-pass filter settings to
support correctly all the chips.
Jean-Baptiste Maneyrol (9):
dt-bindings: iio: imu: inv_mpu6050: add missing entry for mpu6000
iio: imu: inv_mpu6050: cleanup spi support
iio: imu: inv_mpu6050: add support of ICM20609 & ICM20689
dt-bindings: add description for icm20609 and icm20689
iio: imu: inv_mpu6050: add support of IAM20680
dt-bindings: add description for iam20680
iio: imu: inv_mpu6050: add support of ICM20690
dt-bindings: add description for icm20690
iio: imu: inv_mpu6050: fix LPF bandwidth setting
.../bindings/iio/imu/inv_mpu6050.txt | 5 +
drivers/iio/imu/inv_mpu6050/Kconfig | 12 +--
drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 100 ++++++++++++++----
drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c | 23 ++++
drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h | 20 +++-
drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c | 55 ++++++++++
6 files changed, 181 insertions(+), 34 deletions(-)
--
2.17.1
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 1/9] dt-bindings: iio: imu: inv_mpu6050: add missing entry for mpu6000
2020-01-20 9:36 [PATCH 0/9] Add support of similar chips Jean-Baptiste Maneyrol
@ 2020-01-20 9:36 ` Jean-Baptiste Maneyrol
2020-01-31 14:37 ` Rob Herring
2020-01-20 9:36 ` [PATCH 2/9] iio: imu: inv_mpu6050: cleanup spi support Jean-Baptiste Maneyrol
` (7 subsequent siblings)
8 siblings, 1 reply; 13+ messages in thread
From: Jean-Baptiste Maneyrol @ 2020-01-20 9:36 UTC (permalink / raw)
To: Jonathan Cameron, linux-iio, devicetree
Cc: Rob Herring, Mark Rutland, Jean-Baptiste Maneyrol
mpu6000 is spi only.
Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
---
Documentation/devicetree/bindings/iio/imu/inv_mpu6050.txt | 1 +
1 file changed, 1 insertion(+)
diff --git a/Documentation/devicetree/bindings/iio/imu/inv_mpu6050.txt b/Documentation/devicetree/bindings/iio/imu/inv_mpu6050.txt
index c5ee8a20af9f..38483ea31fd4 100644
--- a/Documentation/devicetree/bindings/iio/imu/inv_mpu6050.txt
+++ b/Documentation/devicetree/bindings/iio/imu/inv_mpu6050.txt
@@ -4,6 +4,7 @@ http://www.invensense.com/mems/gyro/mpu6050.html
Required properties:
- compatible : should be one of
+ "invensense,mpu6000"
"invensense,mpu6050"
"invensense,mpu6500"
"invensense,mpu6515"
--
2.17.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 2/9] iio: imu: inv_mpu6050: cleanup spi support
2020-01-20 9:36 [PATCH 0/9] Add support of similar chips Jean-Baptiste Maneyrol
2020-01-20 9:36 ` [PATCH 1/9] dt-bindings: iio: imu: inv_mpu6050: add missing entry for mpu6000 Jean-Baptiste Maneyrol
@ 2020-01-20 9:36 ` Jean-Baptiste Maneyrol
2020-02-01 16:16 ` Jonathan Cameron
2020-01-20 9:36 ` [PATCH 3/9] iio: imu: inv_mpu6050: add support of ICM20609 & ICM20689 Jean-Baptiste Maneyrol
` (6 subsequent siblings)
8 siblings, 1 reply; 13+ messages in thread
From: Jean-Baptiste Maneyrol @ 2020-01-20 9:36 UTC (permalink / raw)
To: Jonathan Cameron, linux-iio, devicetree
Cc: Rob Herring, Mark Rutland, Jean-Baptiste Maneyrol
Add missing mpu6515 support and add of match table.
Reorganize Kconfig to display chips grouped by generations.
Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
---
drivers/iio/imu/inv_mpu6050/Kconfig | 8 +++---
drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c | 35 +++++++++++++++++++++++
2 files changed, 39 insertions(+), 4 deletions(-)
diff --git a/drivers/iio/imu/inv_mpu6050/Kconfig b/drivers/iio/imu/inv_mpu6050/Kconfig
index 017bc0fcc365..003134734646 100644
--- a/drivers/iio/imu/inv_mpu6050/Kconfig
+++ b/drivers/iio/imu/inv_mpu6050/Kconfig
@@ -15,8 +15,8 @@ config INV_MPU6050_I2C
select INV_MPU6050_IIO
select REGMAP_I2C
help
- This driver supports the Invensense MPU6050/6500/6515,
- MPU9150/9250/9255 and ICM20608/20602 motion tracking devices
+ This driver supports the Invensense MPU6050/9150,
+ MPU6500/6515/9250/9255, ICM20608 and ICM20602 motion tracking devices
over I2C.
This driver can be built as a module. The module will be called
inv-mpu6050-i2c.
@@ -27,8 +27,8 @@ config INV_MPU6050_SPI
select INV_MPU6050_IIO
select REGMAP_SPI
help
- This driver supports the Invensense MPU6000/6500/6515,
- MPU9250/9255 and ICM20608/20602 motion tracking devices
+ This driver supports the Invensense MPU6000,
+ MPU6500/6515/9250/9255, ICM20608 and ICM20602 motion tracking devices
over SPI.
This driver can be built as a module. The module will be called
inv-mpu6050-spi.
diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c
index ec102d5a5c77..f7276f9d83fc 100644
--- a/drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c
+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c
@@ -74,6 +74,7 @@ static int inv_mpu_probe(struct spi_device *spi)
static const struct spi_device_id inv_mpu_id[] = {
{"mpu6000", INV_MPU6000},
{"mpu6500", INV_MPU6500},
+ {"mpu6515", INV_MPU6515},
{"mpu9250", INV_MPU9250},
{"mpu9255", INV_MPU9255},
{"icm20608", INV_ICM20608},
@@ -83,6 +84,39 @@ static const struct spi_device_id inv_mpu_id[] = {
MODULE_DEVICE_TABLE(spi, inv_mpu_id);
+static const struct of_device_id inv_of_match[] = {
+ {
+ .compatible = "invensense,mpu6000",
+ .data = (void *)INV_MPU6000
+ },
+ {
+ .compatible = "invensense,mpu6500",
+ .data = (void *)INV_MPU6500
+ },
+ {
+ .compatible = "invensense,mpu6515",
+ .data = (void *)INV_MPU6515
+ },
+ {
+ .compatible = "invensense,mpu9250",
+ .data = (void *)INV_MPU9250
+ },
+ {
+ .compatible = "invensense,mpu9255",
+ .data = (void *)INV_MPU9255
+ },
+ {
+ .compatible = "invensense,icm20608",
+ .data = (void *)INV_ICM20608
+ },
+ {
+ .compatible = "invensense,icm20602",
+ .data = (void *)INV_ICM20602
+ },
+ { }
+};
+MODULE_DEVICE_TABLE(of, inv_of_match);
+
static const struct acpi_device_id inv_acpi_match[] = {
{"INVN6000", INV_MPU6000},
{ },
@@ -93,6 +127,7 @@ static struct spi_driver inv_mpu_driver = {
.probe = inv_mpu_probe,
.id_table = inv_mpu_id,
.driver = {
+ .of_match_table = inv_of_match,
.acpi_match_table = ACPI_PTR(inv_acpi_match),
.name = "inv-mpu6000-spi",
.pm = &inv_mpu_pmops,
--
2.17.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 3/9] iio: imu: inv_mpu6050: add support of ICM20609 & ICM20689
2020-01-20 9:36 [PATCH 0/9] Add support of similar chips Jean-Baptiste Maneyrol
2020-01-20 9:36 ` [PATCH 1/9] dt-bindings: iio: imu: inv_mpu6050: add missing entry for mpu6000 Jean-Baptiste Maneyrol
2020-01-20 9:36 ` [PATCH 2/9] iio: imu: inv_mpu6050: cleanup spi support Jean-Baptiste Maneyrol
@ 2020-01-20 9:36 ` Jean-Baptiste Maneyrol
2020-01-20 9:36 ` [PATCH 4/9] dt-bindings: add description for icm20609 and icm20689 Jean-Baptiste Maneyrol
` (5 subsequent siblings)
8 siblings, 0 replies; 13+ messages in thread
From: Jean-Baptiste Maneyrol @ 2020-01-20 9:36 UTC (permalink / raw)
To: Jonathan Cameron, linux-iio, devicetree
Cc: Rob Herring, Mark Rutland, Jean-Baptiste Maneyrol
They are similar to ICM20608 chip.
Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
---
drivers/iio/imu/inv_mpu6050/Kconfig | 8 +++----
drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 26 ++++++++++++++++++----
drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c | 12 ++++++++++
drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h | 5 +++++
drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c | 10 +++++++++
5 files changed, 53 insertions(+), 8 deletions(-)
diff --git a/drivers/iio/imu/inv_mpu6050/Kconfig b/drivers/iio/imu/inv_mpu6050/Kconfig
index 003134734646..e933db3a5a89 100644
--- a/drivers/iio/imu/inv_mpu6050/Kconfig
+++ b/drivers/iio/imu/inv_mpu6050/Kconfig
@@ -16,8 +16,8 @@ config INV_MPU6050_I2C
select REGMAP_I2C
help
This driver supports the Invensense MPU6050/9150,
- MPU6500/6515/9250/9255, ICM20608 and ICM20602 motion tracking devices
- over I2C.
+ MPU6500/6515/9250/9255, ICM20608/20609/20689 and ICM20602
+ motion tracking devices over I2C.
This driver can be built as a module. The module will be called
inv-mpu6050-i2c.
@@ -28,7 +28,7 @@ config INV_MPU6050_SPI
select REGMAP_SPI
help
This driver supports the Invensense MPU6000,
- MPU6500/6515/9250/9255, ICM20608 and ICM20602 motion tracking devices
- over SPI.
+ MPU6500/6515/9250/9255, ICM20608/20609/20689 and ICM20602
+ motion tracking devices over SPI.
This driver can be built as a module. The module will be called
inv-mpu6050-spi.
diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
index 5096fc49012d..5fd57a1bee90 100644
--- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
@@ -176,6 +176,22 @@ static const struct inv_mpu6050_hw hw_info[] = {
.fifo_size = 512,
.temp = {INV_ICM20608_TEMP_OFFSET, INV_ICM20608_TEMP_SCALE},
},
+ {
+ .whoami = INV_ICM20609_WHOAMI_VALUE,
+ .name = "ICM20609",
+ .reg = ®_set_6500,
+ .config = &chip_config_6050,
+ .fifo_size = 4 * 1024,
+ .temp = {INV_ICM20608_TEMP_OFFSET, INV_ICM20608_TEMP_SCALE},
+ },
+ {
+ .whoami = INV_ICM20689_WHOAMI_VALUE,
+ .name = "ICM20689",
+ .reg = ®_set_6500,
+ .config = &chip_config_6050,
+ .fifo_size = 4 * 1024,
+ .temp = {INV_ICM20608_TEMP_OFFSET, INV_ICM20608_TEMP_SCALE},
+ },
{
.whoami = INV_ICM20602_WHOAMI_VALUE,
.name = "ICM20602",
@@ -286,20 +302,22 @@ static int inv_mpu6050_set_lpf_regs(struct inv_mpu6050_state *st,
if (result)
return result;
+ /* set accel lpf */
switch (st->chip_type) {
case INV_MPU6050:
case INV_MPU6000:
case INV_MPU9150:
/* old chips, nothing to do */
- result = 0;
+ return 0;
+ case INV_ICM20689:
+ /* set FIFO size to maximum value */
+ val |= INV_ICM20689_BITS_FIFO_SIZE_MAX;
break;
default:
- /* set accel lpf */
- result = regmap_write(st->map, st->reg->accel_lpf, val);
break;
}
- return result;
+ return regmap_write(st->map, st->reg->accel_lpf, val);
}
/**
diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c
index f47a28b4be23..c2b5621edadb 100644
--- a/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c
+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c
@@ -74,6 +74,8 @@ static bool inv_mpu_i2c_aux_bus(struct device *dev)
switch (st->chip_type) {
case INV_ICM20608:
+ case INV_ICM20609:
+ case INV_ICM20689:
case INV_ICM20602:
/* no i2c auxiliary bus on the chip */
return false;
@@ -218,6 +220,8 @@ static const struct i2c_device_id inv_mpu_id[] = {
{"mpu9250", INV_MPU9250},
{"mpu9255", INV_MPU9255},
{"icm20608", INV_ICM20608},
+ {"icm20609", INV_ICM20609},
+ {"icm20689", INV_ICM20689},
{"icm20602", INV_ICM20602},
{}
};
@@ -253,6 +257,14 @@ static const struct of_device_id inv_of_match[] = {
.compatible = "invensense,icm20608",
.data = (void *)INV_ICM20608
},
+ {
+ .compatible = "invensense,icm20609",
+ .data = (void *)INV_ICM20609
+ },
+ {
+ .compatible = "invensense,icm20689",
+ .data = (void *)INV_ICM20689
+ },
{
.compatible = "invensense,icm20602",
.data = (void *)INV_ICM20602
diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h b/drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h
index 6158fca7f70e..75b8903450eb 100644
--- a/drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h
+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h
@@ -75,6 +75,8 @@ enum inv_devices {
INV_MPU9250,
INV_MPU9255,
INV_ICM20608,
+ INV_ICM20609,
+ INV_ICM20689,
INV_ICM20602,
INV_NUM_PARTS
};
@@ -276,6 +278,7 @@ struct inv_mpu6050_state {
/* mpu6500 registers */
#define INV_MPU6500_REG_ACCEL_CONFIG_2 0x1D
+#define INV_ICM20689_BITS_FIFO_SIZE_MAX 0xC0
#define INV_MPU6500_REG_ACCEL_OFFSET 0x77
/* delay time in milliseconds */
@@ -340,6 +343,8 @@ struct inv_mpu6050_state {
#define INV_MPU9255_WHOAMI_VALUE 0x73
#define INV_MPU6515_WHOAMI_VALUE 0x74
#define INV_ICM20608_WHOAMI_VALUE 0xAF
+#define INV_ICM20609_WHOAMI_VALUE 0xA6
+#define INV_ICM20689_WHOAMI_VALUE 0x98
#define INV_ICM20602_WHOAMI_VALUE 0x12
/* scan element definition for generic MPU6xxx devices */
diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c
index f7276f9d83fc..189df8bae7b4 100644
--- a/drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c
+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c
@@ -78,6 +78,8 @@ static const struct spi_device_id inv_mpu_id[] = {
{"mpu9250", INV_MPU9250},
{"mpu9255", INV_MPU9255},
{"icm20608", INV_ICM20608},
+ {"icm20609", INV_ICM20609},
+ {"icm20689", INV_ICM20689},
{"icm20602", INV_ICM20602},
{}
};
@@ -109,6 +111,14 @@ static const struct of_device_id inv_of_match[] = {
.compatible = "invensense,icm20608",
.data = (void *)INV_ICM20608
},
+ {
+ .compatible = "invensense,icm20609",
+ .data = (void *)INV_ICM20609
+ },
+ {
+ .compatible = "invensense,icm20689",
+ .data = (void *)INV_ICM20689
+ },
{
.compatible = "invensense,icm20602",
.data = (void *)INV_ICM20602
--
2.17.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 4/9] dt-bindings: add description for icm20609 and icm20689
2020-01-20 9:36 [PATCH 0/9] Add support of similar chips Jean-Baptiste Maneyrol
` (2 preceding siblings ...)
2020-01-20 9:36 ` [PATCH 3/9] iio: imu: inv_mpu6050: add support of ICM20609 & ICM20689 Jean-Baptiste Maneyrol
@ 2020-01-20 9:36 ` Jean-Baptiste Maneyrol
2020-01-20 9:36 ` [PATCH 5/9] iio: imu: inv_mpu6050: add support of IAM20680 Jean-Baptiste Maneyrol
` (4 subsequent siblings)
8 siblings, 0 replies; 13+ messages in thread
From: Jean-Baptiste Maneyrol @ 2020-01-20 9:36 UTC (permalink / raw)
To: Jonathan Cameron, linux-iio, devicetree
Cc: Rob Herring, Mark Rutland, Jean-Baptiste Maneyrol
New supported chips.
Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
---
Documentation/devicetree/bindings/iio/imu/inv_mpu6050.txt | 2 ++
1 file changed, 2 insertions(+)
diff --git a/Documentation/devicetree/bindings/iio/imu/inv_mpu6050.txt b/Documentation/devicetree/bindings/iio/imu/inv_mpu6050.txt
index 38483ea31fd4..606daa145975 100644
--- a/Documentation/devicetree/bindings/iio/imu/inv_mpu6050.txt
+++ b/Documentation/devicetree/bindings/iio/imu/inv_mpu6050.txt
@@ -12,6 +12,8 @@ Required properties:
"invensense,mpu9250"
"invensense,mpu9255"
"invensense,icm20608"
+ "invensense,icm20609"
+ "invensense,icm20689"
"invensense,icm20602"
- reg : the I2C address of the sensor
- interrupts: interrupt mapping for IRQ. It should be configured with flags
--
2.17.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 5/9] iio: imu: inv_mpu6050: add support of IAM20680
2020-01-20 9:36 [PATCH 0/9] Add support of similar chips Jean-Baptiste Maneyrol
` (3 preceding siblings ...)
2020-01-20 9:36 ` [PATCH 4/9] dt-bindings: add description for icm20609 and icm20689 Jean-Baptiste Maneyrol
@ 2020-01-20 9:36 ` Jean-Baptiste Maneyrol
2020-01-20 9:36 ` [PATCH 6/9] dt-bindings: add description for iam20680 Jean-Baptiste Maneyrol
` (3 subsequent siblings)
8 siblings, 0 replies; 13+ messages in thread
From: Jean-Baptiste Maneyrol @ 2020-01-20 9:36 UTC (permalink / raw)
To: Jonathan Cameron, linux-iio, devicetree
Cc: Rob Herring, Mark Rutland, Jean-Baptiste Maneyrol
Automotive certified IMU, similar to ICM20608.
Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
---
drivers/iio/imu/inv_mpu6050/Kconfig | 4 ++--
drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 8 ++++++++
drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c | 6 ++++++
drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h | 2 ++
drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c | 5 +++++
5 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/drivers/iio/imu/inv_mpu6050/Kconfig b/drivers/iio/imu/inv_mpu6050/Kconfig
index e933db3a5a89..e65474a64675 100644
--- a/drivers/iio/imu/inv_mpu6050/Kconfig
+++ b/drivers/iio/imu/inv_mpu6050/Kconfig
@@ -16,7 +16,7 @@ config INV_MPU6050_I2C
select REGMAP_I2C
help
This driver supports the Invensense MPU6050/9150,
- MPU6500/6515/9250/9255, ICM20608/20609/20689 and ICM20602
+ MPU6500/6515/9250/9255, ICM20608/20609/20689, ICM20602 and IAM20680
motion tracking devices over I2C.
This driver can be built as a module. The module will be called
inv-mpu6050-i2c.
@@ -28,7 +28,7 @@ config INV_MPU6050_SPI
select REGMAP_SPI
help
This driver supports the Invensense MPU6000,
- MPU6500/6515/9250/9255, ICM20608/20609/20689 and ICM20602
+ MPU6500/6515/9250/9255, ICM20608/20609/20689, ICM20602 and IAM20680
motion tracking devices over SPI.
This driver can be built as a module. The module will be called
inv-mpu6050-spi.
diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
index 5fd57a1bee90..e8e6beef3f04 100644
--- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
@@ -200,6 +200,14 @@ static const struct inv_mpu6050_hw hw_info[] = {
.fifo_size = 1008,
.temp = {INV_ICM20608_TEMP_OFFSET, INV_ICM20608_TEMP_SCALE},
},
+ {
+ .whoami = INV_IAM20680_WHOAMI_VALUE,
+ .name = "IAM20680",
+ .reg = ®_set_6500,
+ .config = &chip_config_6050,
+ .fifo_size = 512,
+ .temp = {INV_ICM20608_TEMP_OFFSET, INV_ICM20608_TEMP_SCALE},
+ },
};
int inv_mpu6050_switch_engine(struct inv_mpu6050_state *st, bool en, u32 mask)
diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c
index c2b5621edadb..66193786386c 100644
--- a/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c
+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c
@@ -77,6 +77,7 @@ static bool inv_mpu_i2c_aux_bus(struct device *dev)
case INV_ICM20609:
case INV_ICM20689:
case INV_ICM20602:
+ case INV_IAM20680:
/* no i2c auxiliary bus on the chip */
return false;
case INV_MPU9150:
@@ -223,6 +224,7 @@ static const struct i2c_device_id inv_mpu_id[] = {
{"icm20609", INV_ICM20609},
{"icm20689", INV_ICM20689},
{"icm20602", INV_ICM20602},
+ {"iam20680", INV_IAM20680},
{}
};
@@ -269,6 +271,10 @@ static const struct of_device_id inv_of_match[] = {
.compatible = "invensense,icm20602",
.data = (void *)INV_ICM20602
},
+ {
+ .compatible = "invensense,iam20680",
+ .data = (void *)INV_IAM20680
+ },
{ }
};
MODULE_DEVICE_TABLE(of, inv_of_match);
diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h b/drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h
index 75b8903450eb..404c289f8c84 100644
--- a/drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h
+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h
@@ -78,6 +78,7 @@ enum inv_devices {
INV_ICM20609,
INV_ICM20689,
INV_ICM20602,
+ INV_IAM20680,
INV_NUM_PARTS
};
@@ -346,6 +347,7 @@ struct inv_mpu6050_state {
#define INV_ICM20609_WHOAMI_VALUE 0xA6
#define INV_ICM20689_WHOAMI_VALUE 0x98
#define INV_ICM20602_WHOAMI_VALUE 0x12
+#define INV_IAM20680_WHOAMI_VALUE 0xA9
/* scan element definition for generic MPU6xxx devices */
enum inv_mpu6050_scan {
diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c
index 189df8bae7b4..e911e13edb86 100644
--- a/drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c
+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c
@@ -81,6 +81,7 @@ static const struct spi_device_id inv_mpu_id[] = {
{"icm20609", INV_ICM20609},
{"icm20689", INV_ICM20689},
{"icm20602", INV_ICM20602},
+ {"iam20680", INV_IAM20680},
{}
};
@@ -123,6 +124,10 @@ static const struct of_device_id inv_of_match[] = {
.compatible = "invensense,icm20602",
.data = (void *)INV_ICM20602
},
+ {
+ .compatible = "invensense,iam20680",
+ .data = (void *)INV_IAM20680
+ },
{ }
};
MODULE_DEVICE_TABLE(of, inv_of_match);
--
2.17.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 6/9] dt-bindings: add description for iam20680
2020-01-20 9:36 [PATCH 0/9] Add support of similar chips Jean-Baptiste Maneyrol
` (4 preceding siblings ...)
2020-01-20 9:36 ` [PATCH 5/9] iio: imu: inv_mpu6050: add support of IAM20680 Jean-Baptiste Maneyrol
@ 2020-01-20 9:36 ` Jean-Baptiste Maneyrol
2020-01-20 9:36 ` [PATCH 7/9] iio: imu: inv_mpu6050: add support of ICM20690 Jean-Baptiste Maneyrol
` (2 subsequent siblings)
8 siblings, 0 replies; 13+ messages in thread
From: Jean-Baptiste Maneyrol @ 2020-01-20 9:36 UTC (permalink / raw)
To: Jonathan Cameron, linux-iio, devicetree
Cc: Rob Herring, Mark Rutland, Jean-Baptiste Maneyrol
New supported chip.
Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
---
Documentation/devicetree/bindings/iio/imu/inv_mpu6050.txt | 1 +
1 file changed, 1 insertion(+)
diff --git a/Documentation/devicetree/bindings/iio/imu/inv_mpu6050.txt b/Documentation/devicetree/bindings/iio/imu/inv_mpu6050.txt
index 606daa145975..29cec46e27ec 100644
--- a/Documentation/devicetree/bindings/iio/imu/inv_mpu6050.txt
+++ b/Documentation/devicetree/bindings/iio/imu/inv_mpu6050.txt
@@ -15,6 +15,7 @@ Required properties:
"invensense,icm20609"
"invensense,icm20689"
"invensense,icm20602"
+ "invensense,iam20680"
- reg : the I2C address of the sensor
- interrupts: interrupt mapping for IRQ. It should be configured with flags
IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_EDGE_RISING, IRQ_TYPE_LEVEL_LOW or
--
2.17.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 7/9] iio: imu: inv_mpu6050: add support of ICM20690
2020-01-20 9:36 [PATCH 0/9] Add support of similar chips Jean-Baptiste Maneyrol
` (5 preceding siblings ...)
2020-01-20 9:36 ` [PATCH 6/9] dt-bindings: add description for iam20680 Jean-Baptiste Maneyrol
@ 2020-01-20 9:36 ` Jean-Baptiste Maneyrol
2020-01-20 9:36 ` [PATCH 8/9] dt-bindings: add description for icm20690 Jean-Baptiste Maneyrol
2020-01-20 9:36 ` [PATCH 9/9] iio: imu: inv_mpu6050: fix LPF bandwidth setting Jean-Baptiste Maneyrol
8 siblings, 0 replies; 13+ messages in thread
From: Jean-Baptiste Maneyrol @ 2020-01-20 9:36 UTC (permalink / raw)
To: Jonathan Cameron, linux-iio, devicetree
Cc: Rob Herring, Mark Rutland, Jean-Baptiste Maneyrol
Same generation as ICM20602 but different registers.
Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
---
drivers/iio/imu/inv_mpu6050/Kconfig | 8 ++---
drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 36 +++++++++++++++++++---
drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c | 5 +++
drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h | 3 ++
drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c | 5 +++
5 files changed, 48 insertions(+), 9 deletions(-)
diff --git a/drivers/iio/imu/inv_mpu6050/Kconfig b/drivers/iio/imu/inv_mpu6050/Kconfig
index e65474a64675..7137ea6f25db 100644
--- a/drivers/iio/imu/inv_mpu6050/Kconfig
+++ b/drivers/iio/imu/inv_mpu6050/Kconfig
@@ -16,8 +16,8 @@ config INV_MPU6050_I2C
select REGMAP_I2C
help
This driver supports the Invensense MPU6050/9150,
- MPU6500/6515/9250/9255, ICM20608/20609/20689, ICM20602 and IAM20680
- motion tracking devices over I2C.
+ MPU6500/6515/9250/9255, ICM20608/20609/20689, ICM20602/ICM20690 and
+ IAM20680 motion tracking devices over I2C.
This driver can be built as a module. The module will be called
inv-mpu6050-i2c.
@@ -28,7 +28,7 @@ config INV_MPU6050_SPI
select REGMAP_SPI
help
This driver supports the Invensense MPU6000,
- MPU6500/6515/9250/9255, ICM20608/20609/20689, ICM20602 and IAM20680
- motion tracking devices over SPI.
+ MPU6500/6515/9250/9255, ICM20608/20609/20689, ICM20602/ICM20690 and
+ IAM20680 motion tracking devices over SPI.
This driver can be built as a module. The module will be called
inv-mpu6050-spi.
diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
index e8e6beef3f04..9ecc667debbe 100644
--- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
@@ -200,6 +200,14 @@ static const struct inv_mpu6050_hw hw_info[] = {
.fifo_size = 1008,
.temp = {INV_ICM20608_TEMP_OFFSET, INV_ICM20608_TEMP_SCALE},
},
+ {
+ .whoami = INV_ICM20690_WHOAMI_VALUE,
+ .name = "ICM20690",
+ .reg = ®_set_icm20602,
+ .config = &chip_config_6050,
+ .fifo_size = 1024,
+ .temp = {INV_ICM20608_TEMP_OFFSET, INV_ICM20608_TEMP_SCALE},
+ },
{
.whoami = INV_IAM20680_WHOAMI_VALUE,
.name = "IAM20680",
@@ -295,6 +303,25 @@ int inv_mpu6050_set_power_itg(struct inv_mpu6050_state *st, bool power_on)
}
EXPORT_SYMBOL_GPL(inv_mpu6050_set_power_itg);
+static int inv_mpu6050_set_gyro_fsr(struct inv_mpu6050_state *st,
+ enum inv_mpu6050_fsr_e val)
+{
+ unsigned int gyro_shift;
+ u8 data;
+
+ switch (st->chip_type) {
+ case INV_ICM20690:
+ gyro_shift = INV_ICM20690_GYRO_CONFIG_FSR_SHIFT;
+ break;
+ default:
+ gyro_shift = INV_MPU6050_GYRO_CONFIG_FSR_SHIFT;
+ break;
+ }
+
+ data = val << gyro_shift;
+ return regmap_write(st->map, st->reg->gyro_config, data);
+}
+
/**
* inv_mpu6050_set_lpf_regs() - set low pass filter registers, chip dependent
*
@@ -318,6 +345,7 @@ static int inv_mpu6050_set_lpf_regs(struct inv_mpu6050_state *st,
/* old chips, nothing to do */
return 0;
case INV_ICM20689:
+ case INV_ICM20690:
/* set FIFO size to maximum value */
val |= INV_ICM20689_BITS_FIFO_SIZE_MAX;
break;
@@ -346,8 +374,8 @@ static int inv_mpu6050_init_config(struct iio_dev *indio_dev)
result = inv_mpu6050_set_power_itg(st, true);
if (result)
return result;
- d = (INV_MPU6050_FSR_2000DPS << INV_MPU6050_GYRO_CONFIG_FSR_SHIFT);
- result = regmap_write(st->map, st->reg->gyro_config, d);
+
+ result = inv_mpu6050_set_gyro_fsr(st, INV_MPU6050_FSR_2000DPS);
if (result)
goto error_power_off;
@@ -559,12 +587,10 @@ inv_mpu6050_read_raw(struct iio_dev *indio_dev,
static int inv_mpu6050_write_gyro_scale(struct inv_mpu6050_state *st, int val)
{
int result, i;
- u8 d;
for (i = 0; i < ARRAY_SIZE(gyro_scale_6050); ++i) {
if (gyro_scale_6050[i] == val) {
- d = (i << INV_MPU6050_GYRO_CONFIG_FSR_SHIFT);
- result = regmap_write(st->map, st->reg->gyro_config, d);
+ result = inv_mpu6050_set_gyro_fsr(st, i);
if (result)
return result;
diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c
index 66193786386c..f8b1fbca2d9e 100644
--- a/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c
+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c
@@ -224,6 +224,7 @@ static const struct i2c_device_id inv_mpu_id[] = {
{"icm20609", INV_ICM20609},
{"icm20689", INV_ICM20689},
{"icm20602", INV_ICM20602},
+ {"icm20690", INV_ICM20690},
{"iam20680", INV_IAM20680},
{}
};
@@ -271,6 +272,10 @@ static const struct of_device_id inv_of_match[] = {
.compatible = "invensense,icm20602",
.data = (void *)INV_ICM20602
},
+ {
+ .compatible = "invensense,icm20690",
+ .data = (void *)INV_ICM20690
+ },
{
.compatible = "invensense,iam20680",
.data = (void *)INV_IAM20680
diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h b/drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h
index 404c289f8c84..7ae614052210 100644
--- a/drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h
+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h
@@ -78,6 +78,7 @@ enum inv_devices {
INV_ICM20609,
INV_ICM20689,
INV_ICM20602,
+ INV_ICM20690,
INV_IAM20680,
INV_NUM_PARTS
};
@@ -297,6 +298,7 @@ struct inv_mpu6050_state {
#define INV_MPU6050_MAX_ACCL_FS_PARAM 3
#define INV_MPU6050_THREE_AXIS 3
#define INV_MPU6050_GYRO_CONFIG_FSR_SHIFT 3
+#define INV_ICM20690_GYRO_CONFIG_FSR_SHIFT 2
#define INV_MPU6050_ACCL_CONFIG_FSR_SHIFT 3
#define INV_MPU6500_TEMP_OFFSET 7011
@@ -347,6 +349,7 @@ struct inv_mpu6050_state {
#define INV_ICM20609_WHOAMI_VALUE 0xA6
#define INV_ICM20689_WHOAMI_VALUE 0x98
#define INV_ICM20602_WHOAMI_VALUE 0x12
+#define INV_ICM20690_WHOAMI_VALUE 0x20
#define INV_IAM20680_WHOAMI_VALUE 0xA9
/* scan element definition for generic MPU6xxx devices */
diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c
index e911e13edb86..2d069e7d468b 100644
--- a/drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c
+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c
@@ -81,6 +81,7 @@ static const struct spi_device_id inv_mpu_id[] = {
{"icm20609", INV_ICM20609},
{"icm20689", INV_ICM20689},
{"icm20602", INV_ICM20602},
+ {"icm20690", INV_ICM20690},
{"iam20680", INV_IAM20680},
{}
};
@@ -124,6 +125,10 @@ static const struct of_device_id inv_of_match[] = {
.compatible = "invensense,icm20602",
.data = (void *)INV_ICM20602
},
+ {
+ .compatible = "invensense,icm20690",
+ .data = (void *)INV_ICM20690
+ },
{
.compatible = "invensense,iam20680",
.data = (void *)INV_IAM20680
--
2.17.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 8/9] dt-bindings: add description for icm20690
2020-01-20 9:36 [PATCH 0/9] Add support of similar chips Jean-Baptiste Maneyrol
` (6 preceding siblings ...)
2020-01-20 9:36 ` [PATCH 7/9] iio: imu: inv_mpu6050: add support of ICM20690 Jean-Baptiste Maneyrol
@ 2020-01-20 9:36 ` Jean-Baptiste Maneyrol
2020-01-20 9:36 ` [PATCH 9/9] iio: imu: inv_mpu6050: fix LPF bandwidth setting Jean-Baptiste Maneyrol
8 siblings, 0 replies; 13+ messages in thread
From: Jean-Baptiste Maneyrol @ 2020-01-20 9:36 UTC (permalink / raw)
To: Jonathan Cameron, linux-iio, devicetree
Cc: Rob Herring, Mark Rutland, Jean-Baptiste Maneyrol
New supported chip.
Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
---
Documentation/devicetree/bindings/iio/imu/inv_mpu6050.txt | 1 +
1 file changed, 1 insertion(+)
diff --git a/Documentation/devicetree/bindings/iio/imu/inv_mpu6050.txt b/Documentation/devicetree/bindings/iio/imu/inv_mpu6050.txt
index 29cec46e27ec..f2f64749e818 100644
--- a/Documentation/devicetree/bindings/iio/imu/inv_mpu6050.txt
+++ b/Documentation/devicetree/bindings/iio/imu/inv_mpu6050.txt
@@ -15,6 +15,7 @@ Required properties:
"invensense,icm20609"
"invensense,icm20689"
"invensense,icm20602"
+ "invensense,icm20690"
"invensense,iam20680"
- reg : the I2C address of the sensor
- interrupts: interrupt mapping for IRQ. It should be configured with flags
--
2.17.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 9/9] iio: imu: inv_mpu6050: fix LPF bandwidth setting
2020-01-20 9:36 [PATCH 0/9] Add support of similar chips Jean-Baptiste Maneyrol
` (7 preceding siblings ...)
2020-01-20 9:36 ` [PATCH 8/9] dt-bindings: add description for icm20690 Jean-Baptiste Maneyrol
@ 2020-01-20 9:36 ` Jean-Baptiste Maneyrol
2020-02-01 16:23 ` Jonathan Cameron
8 siblings, 1 reply; 13+ messages in thread
From: Jean-Baptiste Maneyrol @ 2020-01-20 9:36 UTC (permalink / raw)
To: Jonathan Cameron, linux-iio, devicetree
Cc: Rob Herring, Mark Rutland, Jean-Baptiste Maneyrol
As every chip has some little variant in LPF bandwidth values,
use common values that are working for all chips.
Simplify the LPF setting function.
Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
---
drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 30 ++++++++++++----------
drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h | 10 ++++----
2 files changed, 21 insertions(+), 19 deletions(-)
diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
index 9ecc667debbe..c4db9086775c 100644
--- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
@@ -707,30 +707,32 @@ static int inv_mpu6050_write_raw(struct iio_dev *indio_dev,
/**
* inv_mpu6050_set_lpf() - set low pass filer based on fifo rate.
*
- * Based on the Nyquist principle, the sampling rate must
- * exceed twice of the bandwidth of the signal, or there
- * would be alising. This function basically search for the
- * correct low pass parameters based on the fifo rate, e.g,
- * sampling frequency.
+ * Based on the Nyquist principle, the bandwidth of the low
+ * pass filter must not exceed the signal sampling rate divided
+ * by 2, or there would be aliasing.
+ * This function basically search for the correct low pass
+ * parameters based on the fifo rate, e.g, sampling frequency.
*
* lpf is set automatically when setting sampling rate to avoid any aliases.
*/
static int inv_mpu6050_set_lpf(struct inv_mpu6050_state *st, int rate)
{
- static const int hz[] = {188, 98, 42, 20, 10, 5};
+ static const int hz[] = {400, 200, 90, 40, 20, 10};
static const int d[] = {
- INV_MPU6050_FILTER_188HZ, INV_MPU6050_FILTER_98HZ,
- INV_MPU6050_FILTER_42HZ, INV_MPU6050_FILTER_20HZ,
+ INV_MPU6050_FILTER_200HZ, INV_MPU6050_FILTER_100HZ,
+ INV_MPU6050_FILTER_45HZ, INV_MPU6050_FILTER_20HZ,
INV_MPU6050_FILTER_10HZ, INV_MPU6050_FILTER_5HZ
};
- int i, h, result;
+ int i, result;
u8 data;
- h = (rate >> 1);
- i = 0;
- while ((h < hz[i]) && (i < ARRAY_SIZE(d) - 1))
- i++;
- data = d[i];
+ data = INV_MPU6050_FILTER_5HZ;
+ for (i = 0; i < ARRAY_SIZE(hz); ++i) {
+ if (rate >= hz[i]) {
+ data = d[i];
+ break;
+ }
+ }
result = inv_mpu6050_set_lpf_regs(st, data);
if (result)
return result;
diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h b/drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h
index 7ae614052210..9a81098a8b4d 100644
--- a/drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h
+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h
@@ -370,14 +370,14 @@ enum inv_mpu6050_scan {
};
enum inv_mpu6050_filter_e {
- INV_MPU6050_FILTER_256HZ_NOLPF2 = 0,
- INV_MPU6050_FILTER_188HZ,
- INV_MPU6050_FILTER_98HZ,
- INV_MPU6050_FILTER_42HZ,
+ INV_MPU6050_FILTER_NOLPF2 = 0,
+ INV_MPU6050_FILTER_200HZ,
+ INV_MPU6050_FILTER_100HZ,
+ INV_MPU6050_FILTER_45HZ,
INV_MPU6050_FILTER_20HZ,
INV_MPU6050_FILTER_10HZ,
INV_MPU6050_FILTER_5HZ,
- INV_MPU6050_FILTER_2100HZ_NOLPF,
+ INV_MPU6050_FILTER_NOLPF,
NUM_MPU6050_FILTER
};
--
2.17.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH 1/9] dt-bindings: iio: imu: inv_mpu6050: add missing entry for mpu6000
2020-01-20 9:36 ` [PATCH 1/9] dt-bindings: iio: imu: inv_mpu6050: add missing entry for mpu6000 Jean-Baptiste Maneyrol
@ 2020-01-31 14:37 ` Rob Herring
0 siblings, 0 replies; 13+ messages in thread
From: Rob Herring @ 2020-01-31 14:37 UTC (permalink / raw)
To: Jean-Baptiste Maneyrol
Cc: Jonathan Cameron, linux-iio, devicetree, Mark Rutland
On Mon, Jan 20, 2020 at 10:36:12AM +0100, Jean-Baptiste Maneyrol wrote:
> mpu6000 is spi only.
>
> Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
> ---
> Documentation/devicetree/bindings/iio/imu/inv_mpu6050.txt | 1 +
> 1 file changed, 1 insertion(+)
Just combine all the DT patches if you're only adding new compatible
strings.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 2/9] iio: imu: inv_mpu6050: cleanup spi support
2020-01-20 9:36 ` [PATCH 2/9] iio: imu: inv_mpu6050: cleanup spi support Jean-Baptiste Maneyrol
@ 2020-02-01 16:16 ` Jonathan Cameron
0 siblings, 0 replies; 13+ messages in thread
From: Jonathan Cameron @ 2020-02-01 16:16 UTC (permalink / raw)
To: Jean-Baptiste Maneyrol; +Cc: linux-iio, devicetree, Rob Herring, Mark Rutland
On Mon, 20 Jan 2020 10:36:13 +0100
Jean-Baptiste Maneyrol <jmaneyrol@invensense.com> wrote:
> Add missing mpu6515 support and add of match table.
> Reorganize Kconfig to display chips grouped by generations.
>
> Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
The handling of of / acpi / directly probed could do with cleaning up in
here.
> ---
> drivers/iio/imu/inv_mpu6050/Kconfig | 8 +++---
> drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c | 35 +++++++++++++++++++++++
> 2 files changed, 39 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/iio/imu/inv_mpu6050/Kconfig b/drivers/iio/imu/inv_mpu6050/Kconfig
> index 017bc0fcc365..003134734646 100644
> --- a/drivers/iio/imu/inv_mpu6050/Kconfig
> +++ b/drivers/iio/imu/inv_mpu6050/Kconfig
> @@ -15,8 +15,8 @@ config INV_MPU6050_I2C
> select INV_MPU6050_IIO
> select REGMAP_I2C
> help
> - This driver supports the Invensense MPU6050/6500/6515,
> - MPU9150/9250/9255 and ICM20608/20602 motion tracking devices
> + This driver supports the Invensense MPU6050/9150,
> + MPU6500/6515/9250/9255, ICM20608 and ICM20602 motion tracking devices
> over I2C.
> This driver can be built as a module. The module will be called
> inv-mpu6050-i2c.
> @@ -27,8 +27,8 @@ config INV_MPU6050_SPI
> select INV_MPU6050_IIO
> select REGMAP_SPI
> help
> - This driver supports the Invensense MPU6000/6500/6515,
> - MPU9250/9255 and ICM20608/20602 motion tracking devices
> + This driver supports the Invensense MPU6000,
> + MPU6500/6515/9250/9255, ICM20608 and ICM20602 motion tracking devices
> over SPI.
> This driver can be built as a module. The module will be called
> inv-mpu6050-spi.
> diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c
> index ec102d5a5c77..f7276f9d83fc 100644
> --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c
> +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c
> @@ -74,6 +74,7 @@ static int inv_mpu_probe(struct spi_device *spi)
> static const struct spi_device_id inv_mpu_id[] = {
> {"mpu6000", INV_MPU6000},
> {"mpu6500", INV_MPU6500},
> + {"mpu6515", INV_MPU6515},
> {"mpu9250", INV_MPU9250},
> {"mpu9255", INV_MPU9255},
> {"icm20608", INV_ICM20608},
> @@ -83,6 +84,39 @@ static const struct spi_device_id inv_mpu_id[] = {
>
> MODULE_DEVICE_TABLE(spi, inv_mpu_id);
>
> +static const struct of_device_id inv_of_match[] = {
> + {
> + .compatible = "invensense,mpu6000",
> + .data = (void *)INV_MPU6000
The current code won't actually get this field as it uses
spi_id->driver_data directly.
We should be looking I think to moved to more unified handling
rather than explicit acpi / dt legs.
device_get_match_data should simplify things and will mean
the data pointers here are actually used.
Will still need the special handling for the case where
the driver wasn't probed as a result of dt or ACPI.
Thanks,
Jonathan
> + },
> + {
> + .compatible = "invensense,mpu6500",
> + .data = (void *)INV_MPU6500
> + },
> + {
> + .compatible = "invensense,mpu6515",
> + .data = (void *)INV_MPU6515
> + },
> + {
> + .compatible = "invensense,mpu9250",
> + .data = (void *)INV_MPU9250
> + },
> + {
> + .compatible = "invensense,mpu9255",
> + .data = (void *)INV_MPU9255
> + },
> + {
> + .compatible = "invensense,icm20608",
> + .data = (void *)INV_ICM20608
> + },
> + {
> + .compatible = "invensense,icm20602",
> + .data = (void *)INV_ICM20602
> + },
> + { }
> +};
> +MODULE_DEVICE_TABLE(of, inv_of_match);
> +
> static const struct acpi_device_id inv_acpi_match[] = {
> {"INVN6000", INV_MPU6000},
> { },
> @@ -93,6 +127,7 @@ static struct spi_driver inv_mpu_driver = {
> .probe = inv_mpu_probe,
> .id_table = inv_mpu_id,
> .driver = {
> + .of_match_table = inv_of_match,
> .acpi_match_table = ACPI_PTR(inv_acpi_match),
> .name = "inv-mpu6000-spi",
> .pm = &inv_mpu_pmops,
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 9/9] iio: imu: inv_mpu6050: fix LPF bandwidth setting
2020-01-20 9:36 ` [PATCH 9/9] iio: imu: inv_mpu6050: fix LPF bandwidth setting Jean-Baptiste Maneyrol
@ 2020-02-01 16:23 ` Jonathan Cameron
0 siblings, 0 replies; 13+ messages in thread
From: Jonathan Cameron @ 2020-02-01 16:23 UTC (permalink / raw)
To: Jean-Baptiste Maneyrol; +Cc: linux-iio, devicetree, Rob Herring, Mark Rutland
On Mon, 20 Jan 2020 10:36:20 +0100
Jean-Baptiste Maneyrol <jmaneyrol@invensense.com> wrote:
> As every chip has some little variant in LPF bandwidth values,
> use common values that are working for all chips.
> Simplify the LPF setting function.
>
> Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
hmm. On this one I wonder if the 'fix' title is strictly accurate.
It's certainly a good thing to have, but I'm not sure if we will
want to backport it. If you do, then break it out of this series
as a separate fix and add appropriate fixes tag.
All the other patches I haven't commented on in this series look fine
to me subject to Rob's suggestion of combining the dt ID additions for
the binding doc into one patch.
Thanks,
Jonathan
> ---
> drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 30 ++++++++++++----------
> drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h | 10 ++++----
> 2 files changed, 21 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
> index 9ecc667debbe..c4db9086775c 100644
> --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
> +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
> @@ -707,30 +707,32 @@ static int inv_mpu6050_write_raw(struct iio_dev *indio_dev,
> /**
> * inv_mpu6050_set_lpf() - set low pass filer based on fifo rate.
> *
> - * Based on the Nyquist principle, the sampling rate must
> - * exceed twice of the bandwidth of the signal, or there
> - * would be alising. This function basically search for the
> - * correct low pass parameters based on the fifo rate, e.g,
> - * sampling frequency.
> + * Based on the Nyquist principle, the bandwidth of the low
> + * pass filter must not exceed the signal sampling rate divided
> + * by 2, or there would be aliasing.
> + * This function basically search for the correct low pass
> + * parameters based on the fifo rate, e.g, sampling frequency.
> *
> * lpf is set automatically when setting sampling rate to avoid any aliases.
> */
> static int inv_mpu6050_set_lpf(struct inv_mpu6050_state *st, int rate)
> {
> - static const int hz[] = {188, 98, 42, 20, 10, 5};
> + static const int hz[] = {400, 200, 90, 40, 20, 10};
> static const int d[] = {
> - INV_MPU6050_FILTER_188HZ, INV_MPU6050_FILTER_98HZ,
> - INV_MPU6050_FILTER_42HZ, INV_MPU6050_FILTER_20HZ,
> + INV_MPU6050_FILTER_200HZ, INV_MPU6050_FILTER_100HZ,
> + INV_MPU6050_FILTER_45HZ, INV_MPU6050_FILTER_20HZ,
> INV_MPU6050_FILTER_10HZ, INV_MPU6050_FILTER_5HZ
> };
> - int i, h, result;
> + int i, result;
> u8 data;
>
> - h = (rate >> 1);
> - i = 0;
> - while ((h < hz[i]) && (i < ARRAY_SIZE(d) - 1))
> - i++;
> - data = d[i];
> + data = INV_MPU6050_FILTER_5HZ;
> + for (i = 0; i < ARRAY_SIZE(hz); ++i) {
> + if (rate >= hz[i]) {
> + data = d[i];
> + break;
> + }
> + }
> result = inv_mpu6050_set_lpf_regs(st, data);
> if (result)
> return result;
> diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h b/drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h
> index 7ae614052210..9a81098a8b4d 100644
> --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h
> +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h
> @@ -370,14 +370,14 @@ enum inv_mpu6050_scan {
> };
>
> enum inv_mpu6050_filter_e {
> - INV_MPU6050_FILTER_256HZ_NOLPF2 = 0,
> - INV_MPU6050_FILTER_188HZ,
> - INV_MPU6050_FILTER_98HZ,
> - INV_MPU6050_FILTER_42HZ,
> + INV_MPU6050_FILTER_NOLPF2 = 0,
> + INV_MPU6050_FILTER_200HZ,
> + INV_MPU6050_FILTER_100HZ,
> + INV_MPU6050_FILTER_45HZ,
> INV_MPU6050_FILTER_20HZ,
> INV_MPU6050_FILTER_10HZ,
> INV_MPU6050_FILTER_5HZ,
> - INV_MPU6050_FILTER_2100HZ_NOLPF,
> + INV_MPU6050_FILTER_NOLPF,
> NUM_MPU6050_FILTER
> };
>
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2020-02-01 16:23 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-20 9:36 [PATCH 0/9] Add support of similar chips Jean-Baptiste Maneyrol
2020-01-20 9:36 ` [PATCH 1/9] dt-bindings: iio: imu: inv_mpu6050: add missing entry for mpu6000 Jean-Baptiste Maneyrol
2020-01-31 14:37 ` Rob Herring
2020-01-20 9:36 ` [PATCH 2/9] iio: imu: inv_mpu6050: cleanup spi support Jean-Baptiste Maneyrol
2020-02-01 16:16 ` Jonathan Cameron
2020-01-20 9:36 ` [PATCH 3/9] iio: imu: inv_mpu6050: add support of ICM20609 & ICM20689 Jean-Baptiste Maneyrol
2020-01-20 9:36 ` [PATCH 4/9] dt-bindings: add description for icm20609 and icm20689 Jean-Baptiste Maneyrol
2020-01-20 9:36 ` [PATCH 5/9] iio: imu: inv_mpu6050: add support of IAM20680 Jean-Baptiste Maneyrol
2020-01-20 9:36 ` [PATCH 6/9] dt-bindings: add description for iam20680 Jean-Baptiste Maneyrol
2020-01-20 9:36 ` [PATCH 7/9] iio: imu: inv_mpu6050: add support of ICM20690 Jean-Baptiste Maneyrol
2020-01-20 9:36 ` [PATCH 8/9] dt-bindings: add description for icm20690 Jean-Baptiste Maneyrol
2020-01-20 9:36 ` [PATCH 9/9] iio: imu: inv_mpu6050: fix LPF bandwidth setting Jean-Baptiste Maneyrol
2020-02-01 16:23 ` Jonathan Cameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).